@assistanz/carbideui 1.4.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/assistanz-carbideui.mjs +5526 -2691
- package/fesm2022/assistanz-carbideui.mjs.map +1 -1
- package/index.d.ts +2436 -203
- package/package.json +1 -1
- package/styles/_content-switcher.scss +64 -15
package/package.json
CHANGED
|
@@ -1,29 +1,46 @@
|
|
|
1
1
|
// ngcc-content-switcher wraps every Carbon button in an <ngcc-content-switcher-option>, so Carbon's
|
|
2
2
|
// sibling-based rules (:first-child, :last-child, :first-of-type, `+`) see each button as both the
|
|
3
3
|
// first and the last. These rules re-create the intended look from the option's position instead.
|
|
4
|
-
//
|
|
5
|
-
.
|
|
4
|
+
// The class is doubled so these (0,4,1)+ selectors out-rank Carbon's (0,4,0) first/last-child rules
|
|
5
|
+
// without !important.
|
|
6
|
+
// Equal-width segments that are never narrower than their label: a grid of `1fr` columns sizes every
|
|
7
|
+
// column to the longest label when the switcher is only as wide as its content, and shares the room
|
|
8
|
+
// equally when it is wider. Not set inline on the option, so apps can override it.
|
|
9
|
+
.cds--content-switcher:not(.cds--content-switcher--icon-only):has(> ngcc-content-switcher-option) {
|
|
10
|
+
display: grid;
|
|
11
|
+
grid-auto-flow: column;
|
|
12
|
+
grid-auto-columns: 1fr;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
ngcc-content-switcher-option {
|
|
16
|
+
display: flex;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Specificity note: `.cds--content-switcher` is doubled on purpose (see above).
|
|
20
|
+
.cds--content-switcher.cds--content-switcher:not(.cds--content-switcher--icon-only) {
|
|
21
|
+
// The container already draws the outline; per-segment top/bottom borders would bend into a
|
|
22
|
+
// pill around every tab once the segments have a radius.
|
|
6
23
|
ngcc-content-switcher-option > .cds--content-switcher-btn {
|
|
24
|
+
border-block: 0;
|
|
7
25
|
border-radius: 0;
|
|
8
26
|
box-shadow: none;
|
|
9
27
|
}
|
|
10
28
|
|
|
29
|
+
// The radius follows the corner style, square included (Carbon's own 0.25rem is not square).
|
|
11
30
|
ngcc-content-switcher-option:first-child > .cds--content-switcher-btn {
|
|
12
|
-
border-end-start-radius:
|
|
13
|
-
border-start-start-radius:
|
|
14
|
-
box-shadow: inset 0.0625rem 0 0 0 var(--cds-border-inverse);
|
|
31
|
+
border-end-start-radius: var(--ngcc-radius-button);
|
|
32
|
+
border-start-start-radius: var(--ngcc-radius-button);
|
|
15
33
|
}
|
|
16
34
|
|
|
17
35
|
ngcc-content-switcher-option:last-child > .cds--content-switcher-btn {
|
|
18
|
-
border-end-end-radius:
|
|
19
|
-
border-start-end-radius:
|
|
20
|
-
box-shadow: inset -0.0625rem 0 0 0 var(--cds-border-inverse);
|
|
36
|
+
border-end-end-radius: var(--ngcc-radius-button);
|
|
37
|
+
border-start-end-radius: var(--ngcc-radius-button);
|
|
21
38
|
}
|
|
22
39
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
40
|
+
// The selected fill and the focus layers must follow the segment's radius.
|
|
41
|
+
ngcc-content-switcher-option > .cds--content-switcher-btn::before,
|
|
42
|
+
ngcc-content-switcher-option > .cds--content-switcher-btn::after {
|
|
43
|
+
border-radius: inherit;
|
|
27
44
|
}
|
|
28
45
|
|
|
29
46
|
// Divider between neighbours; Carbon hides it on every button here.
|
|
@@ -31,15 +48,15 @@
|
|
|
31
48
|
background-color: var(--cds-border-subtle);
|
|
32
49
|
}
|
|
33
50
|
|
|
34
|
-
// No divider next to the hovered, focused or selected button.
|
|
51
|
+
// No divider next to the hovered, keyboard-focused or selected button.
|
|
35
52
|
ngcc-content-switcher-option:not(:first-child) > .cds--content-switcher-btn:hover::before,
|
|
36
|
-
ngcc-content-switcher-option:not(:first-child) > .cds--content-switcher-btn:focus::before,
|
|
53
|
+
ngcc-content-switcher-option:not(:first-child) > .cds--content-switcher-btn:focus-visible::before,
|
|
37
54
|
ngcc-content-switcher-option:not(:first-child)
|
|
38
55
|
> .cds--content-switcher-btn.cds--content-switcher--selected::before,
|
|
39
56
|
ngcc-content-switcher-option:hover
|
|
40
57
|
+ ngcc-content-switcher-option
|
|
41
58
|
> .cds--content-switcher-btn::before,
|
|
42
|
-
ngcc-content-switcher-option:focus-
|
|
59
|
+
ngcc-content-switcher-option:has(> :focus-visible)
|
|
43
60
|
+ ngcc-content-switcher-option
|
|
44
61
|
> .cds--content-switcher-btn::before,
|
|
45
62
|
ngcc-content-switcher-option:has(> .cds--content-switcher--selected)
|
|
@@ -47,4 +64,36 @@
|
|
|
47
64
|
> .cds--content-switcher-btn::before {
|
|
48
65
|
background-color: transparent;
|
|
49
66
|
}
|
|
67
|
+
|
|
68
|
+
// Focus ring for keyboard users only (Carbon draws it on :focus, so a mouse click left a ring).
|
|
69
|
+
ngcc-content-switcher-option
|
|
70
|
+
> .cds--content-switcher-btn:not(.cds--content-switcher--selected):focus:not(:focus-visible) {
|
|
71
|
+
&::before {
|
|
72
|
+
display: none;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&::after {
|
|
76
|
+
transform: scaleY(0);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
ngcc-content-switcher-option > .cds--content-switcher-btn:focus:not(:focus-visible)::after {
|
|
81
|
+
box-shadow: none;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Hovering a keyboard-focused, unselected tab: keep the flat focus look, no extra borders.
|
|
85
|
+
ngcc-content-switcher-option
|
|
86
|
+
> .cds--content-switcher-btn:not(.cds--content-switcher--selected):focus-visible:hover::after {
|
|
87
|
+
border-block: 0;
|
|
88
|
+
border-radius: inherit;
|
|
89
|
+
box-shadow:
|
|
90
|
+
inset 0 0 0 2px var(--cds-focus),
|
|
91
|
+
inset 0 0 0 3px var(--cds-focus-inset);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// The container follows the corner style too, including square.
|
|
96
|
+
.cds--content-switcher:not(.cds--content-switcher--icon-only):has(> ngcc-content-switcher-option) {
|
|
97
|
+
border-radius: var(--ngcc-radius-button);
|
|
98
|
+
overflow: hidden;
|
|
50
99
|
}
|