Skip to content

Commit 3103e2f

Browse files
authored
fix: remove style modifying all host components with hidden attribute (#7346)
**Related Issue:** #7325 ## Summary - Removes style modifying all host components with hidden attribute. This is modifying components outside of calcite and applying host styles outside of the host. Host styles should have no effect outside of a shadow DOM. https://developer.mozilla.org/en-US/docs/Web/CSS/:host - Adds includes mixin for common component internal styles such as hidden attribute styling - Includes mixin in every component file.
1 parent ca9f35a commit 3103e2f

File tree

99 files changed

+244
-84
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+244
-84
lines changed

packages/calcite-components/src/assets/styles/includes.scss

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
}
1616
}
1717

18-
:host([hidden]) {
19-
display: none;
20-
}
21-
2218
@mixin word-break() {
2319
word-wrap: break-word;
2420
word-break: break-word;
@@ -75,6 +71,16 @@
7571
}
7672
}
7773

74+
@mixin base-component() {
75+
:host([hidden]) {
76+
@apply hidden;
77+
}
78+
79+
[hidden] {
80+
@apply hidden;
81+
}
82+
}
83+
7884
@mixin xButton() {
7985
:host([scale="s"]) {
8086
.x-button {

packages/calcite-components/src/components/accordion-item/accordion-item.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,3 +213,5 @@
213213
}
214214
}
215215
}
216+
217+
@include base-component();

packages/calcite-components/src/components/accordion/accordion.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,5 @@
3737
.accordion {
3838
@apply border border-solid border-color-2 border-b-0;
3939
}
40+
41+
@include base-component();

packages/calcite-components/src/components/action-bar/action-bar.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,5 @@
6161
.action-group--bottom {
6262
@apply justify-end;
6363
}
64+
65+
@include base-component();

packages/calcite-components/src/components/action-group/action-group.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,5 @@
5252

5353
grid-template-columns: repeat(var(--calcite-action-group-columns), auto);
5454
}
55+
56+
@include base-component();

packages/calcite-components/src/components/action-menu/action-menu.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@
3535
.menu {
3636
@apply flex-col flex-nowrap outline-none;
3737
}
38+
39+
@include base-component();

packages/calcite-components/src/components/action-pad/action-pad.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,5 @@
5555
::slotted(calcite-action-group:last-child) {
5656
@apply border-b-0;
5757
}
58+
59+
@include base-component();

packages/calcite-components/src/components/action/action.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,5 @@
239239
.indicator-text {
240240
@apply sr-only;
241241
}
242+
243+
@include base-component();

packages/calcite-components/src/components/alert/alert.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,6 @@
126126

127127
@include calciteHydratedHidden();
128128

129-
[hidden] {
130-
@apply hidden;
131-
}
132-
133129
.container {
134130
@apply flex
135131
w-full
@@ -333,3 +329,5 @@ $alertDurations: "fast" 6000ms, "medium" 10000ms, "slow" 14000ms;
333329
.container.slotted-in-shell {
334330
position: absolute;
335331
}
332+
333+
@include base-component();

packages/calcite-components/src/components/avatar/avatar.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@
2929
.thumbnail {
3030
@apply rounded-half h-full w-full;
3131
}
32+
33+
@include base-component();

packages/calcite-components/src/components/block-section/block-section.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,5 @@
8181
.status-icon.invalid {
8282
color: theme("colors.danger");
8383
}
84+
85+
@include base-component();

packages/calcite-components/src/components/block/block.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,5 @@ calcite-action-menu {
160160
@apply text-color-1;
161161
}
162162
}
163+
164+
@include base-component();

packages/calcite-components/src/components/button/button.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,3 +732,5 @@
732732
:host([scale="l"][icon-start][icon-end][appearance="transparent"]) a:not(.content--slotted) {
733733
--calcite-button-padding-x-internal: theme("padding.11");
734734
}
735+
736+
@include base-component();

packages/calcite-components/src/components/card/card.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,5 @@ slot[name="footer-start"]::slotted(*),
125125
slot[name="footer-end"]::slotted(*) {
126126
@apply flex gap-1;
127127
}
128+
129+
@include base-component();

packages/calcite-components/src/components/checkbox/checkbox.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
:host([scale="l"]) {
1616
--calcite-checkbox-size: theme("spacing.4");
1717
}
18+
1819
:host {
1920
@apply relative
2021
inline-flex
@@ -68,3 +69,4 @@
6869

6970
@include disabled();
7071
@include hidden-form-input();
72+
@include base-component();

packages/calcite-components/src/components/chip-group/chip-group.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@
2222
}
2323

2424
@include disabled();
25+
@include base-component();

packages/calcite-components/src/components/chip/chip.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,3 +302,4 @@ slot[name="image"]::slotted(*) {
302302
}
303303

304304
@include disabled();
305+
@include base-component();

packages/calcite-components/src/components/color-picker-hex-input/color-picker-hex-input.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@
3131
inline-size: 88px;
3232
}
3333
}
34+
35+
@include base-component();

packages/calcite-components/src/components/color-picker-swatch/color-picker-swatch.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,5 @@ $size-l: 28px;
4141
.checker {
4242
fill: #cacaca;
4343
}
44+
45+
@include base-component();

packages/calcite-components/src/components/color-picker/color-picker.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,5 @@
189189
outline-offset: 2px;
190190
}
191191
}
192+
193+
@include base-component();

packages/calcite-components/src/components/combobox-item/combobox-item.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@include base-component();
2+
13
.scale--s {
24
@apply text-n2h;
35
--calcite-combobox-item-spacing-unit-l: theme("spacing.2");

packages/calcite-components/src/components/combobox/combobox.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,4 @@
208208
}
209209

210210
@include hidden-form-input();
211+
@include base-component();

packages/calcite-components/src/components/date-picker-day/date-picker-day.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,3 +488,5 @@
488488
}
489489
}
490490
}
491+
492+
@include base-component();

packages/calcite-components/src/components/date-picker-month-header/date-picker-month-header.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@
126126
}
127127

128128
.suffix {
129-
@apply top-0
129+
@apply top-0
130130
whitespace-nowrap
131131
text-start;
132132
inset-inline-start: 0;
133133
}
134+
135+
@include base-component();

packages/calcite-components/src/components/date-picker-month/date-picker-month.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@include base-component();
2+
13
.calendar {
24
@apply mb-1;
35
}

packages/calcite-components/src/components/date-picker/date-picker.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@
2323
:host([scale="l"]) {
2424
max-inline-size: 398px;
2525
}
26+
27+
@include base-component();

packages/calcite-components/src/components/dropdown-group/dropdown-group.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,5 @@
4545
@apply block h-px;
4646
background-color: theme("borderColor.color.3");
4747
}
48+
49+
@include base-component();

packages/calcite-components/src/components/dropdown-item/dropdown-item.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,5 @@
217217
margin-inline-start: theme("margin.4");
218218
}
219219
}
220+
221+
@include base-component();

packages/calcite-components/src/components/dropdown/dropdown.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,5 @@
5353
:host([width="l"]) {
5454
--calcite-dropdown-width: theme("spacing.64");
5555
}
56+
57+
@include base-component();

packages/calcite-components/src/components/fab/fab.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ calcite-button {
1313
@apply shadow-2-sm;
1414
}
1515
}
16+
17+
@include base-component();

packages/calcite-components/src/components/filter/filter.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,5 @@ input[type="text"]:focus {
6969
@apply text-color-1;
7070
}
7171
}
72+
73+
@include base-component();

packages/calcite-components/src/components/flow-item/flow-item.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@
2424
calcite-panel {
2525
--calcite-panel-footer-padding: var(--calcite-flow-item-footer-padding);
2626
}
27+
28+
@include base-component();

packages/calcite-components/src/components/flow/flow.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,5 @@
6060
}
6161
}
6262
}
63+
64+
@include base-component();

packages/calcite-components/src/components/graph/graph.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@
1313
@apply opacity-50;
1414
}
1515
}
16+
17+
@include base-component();

packages/calcite-components/src/components/handle/handle.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@
2828
color: inherit;
2929
}
3030
}
31+
32+
@include base-component();

packages/calcite-components/src/components/icon/icon.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@
3535
.svg {
3636
@apply block;
3737
}
38+
39+
@include base-component();

packages/calcite-components/src/components/inline-editable/inline-editable.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,5 @@
4949
@apply border-color-2;
5050
}
5151
}
52+
53+
@include base-component();

packages/calcite-components/src/components/input-date-picker/input-date-picker.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,5 @@
157157
.assistive-text {
158158
@apply sr-only;
159159
}
160+
161+
@include base-component();

packages/calcite-components/src/components/input-message/input-message.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,5 @@
6464
:host([status][scale="l"]) {
6565
@apply text-n1h mt-1;
6666
}
67+
68+
@include base-component();

packages/calcite-components/src/components/input-number/input-number.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,3 +411,4 @@
411411
}
412412

413413
@include hidden-form-input();
414+
@include base-component();

packages/calcite-components/src/components/input-text/input-text.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,3 +299,4 @@ input[type="text"]::-ms-reveal {
299299
}
300300

301301
@include hidden-form-input();
302+
@include base-component();

packages/calcite-components/src/components/input-time-picker/input-time-picker.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@
3030
inset-block: 0;
3131
padding-inline: var(--calcite-toggle-spacing);
3232
}
33+
34+
@include base-component();

packages/calcite-components/src/components/input/input.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,3 +570,4 @@ input[type="time"]::-webkit-clear-button {
570570
}
571571

572572
@include hidden-form-input();
573+
@include base-component();

packages/calcite-components/src/components/label/label.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,5 @@
8787
@apply bg-opacity-0;
8888
}
8989
}
90+
91+
@include base-component();

packages/calcite-components/src/components/link/link.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,4 @@ calcite-icon {
8686
}
8787

8888
@include disabled();
89+
@include base-component();

packages/calcite-components/src/components/list-item-group/list-item-group.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,4 @@
2323
@apply shadow-none;
2424
}
2525

26-
[hidden] {
27-
display: none;
28-
}
26+
@include base-component();

packages/calcite-components/src/components/list-item/list-item.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,4 @@ td:focus {
142142
@apply border-solid border-0 border-t border-color-3;
143143
}
144144

145-
[hidden] {
146-
display: none;
147-
}
145+
@include base-component();

packages/calcite-components/src/components/list/list.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,5 @@
4747
@apply p-0;
4848
}
4949
}
50+
51+
@include base-component();

packages/calcite-components/src/components/loader/loader.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,5 @@ $loader-circumference: ($loader-scale - (2 * $stroke-width)) * 3.14159;
226226
transform: rotate(360deg);
227227
}
228228
}
229+
230+
@include base-component();

packages/calcite-components/src/components/menu-item/menu-item.scss

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
:host {
22
@apply flex
3-
items-center
4-
relative
3+
items-center
4+
relative
55
box-border;
66
flex-shrink: 0;
77
& .container,
@@ -29,14 +29,14 @@
2929
items-center
3030
relative
3131
justify-center
32-
cursor-pointer
32+
cursor-pointer
3333
outline-none
3434
text-0
35-
text-color-2
36-
box-border
35+
text-color-2
36+
box-border
3737
bg-foreground-1
38-
px-4
39-
h-full
38+
px-4
39+
h-full
4040
w-full;
4141
text-decoration: none;
4242
border-block-end: theme("spacing[0.5]") solid transparent;
@@ -171,3 +171,5 @@ calcite-action {
171171
.content:hover .hover-href-icon {
172172
@apply opacity-100 -end-1;
173173
}
174+
175+
@include base-component();

packages/calcite-components/src/components/menu/menu.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ ul {
99
:host([layout="vertical"]) ul {
1010
@apply flex flex-col w-full;
1111
}
12+
13+
@include base-component();

packages/calcite-components/src/components/modal/modal.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,3 +407,5 @@ slot[name="primary"] {
407407
position: absolute;
408408
}
409409
}
410+
411+
@include base-component();

0 commit comments

Comments
 (0)