@carbon/element-styles 0.2.0-rc.2
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/LICENSE +201 -0
- package/README.md +281 -0
- package/package.json +40 -0
- package/src/_config.scss +8 -0
- package/src/elements/_heading/index.scss +27 -0
- package/src/elements/_input/index.scss +92 -0
- package/src/elements/_labelled-input/index.scss +143 -0
- package/src/elements/_layer/index.scss +78 -0
- package/src/elements/abbreviation/index.scss +31 -0
- package/src/elements/address/index.scss +31 -0
- package/src/elements/anchor/index.scss +50 -0
- package/src/elements/block-quotation/index.scss +63 -0
- package/src/elements/body/index.scss +30 -0
- package/src/elements/bold-text/index.scss +27 -0
- package/src/elements/button/index.scss +235 -0
- package/src/elements/checkbox/index.scss +76 -0
- package/src/elements/code/index.scss +34 -0
- package/src/elements/combo-box/index.scss +68 -0
- package/src/elements/date-input/index.scss +47 -0
- package/src/elements/date-time-input/index.scss +47 -0
- package/src/elements/deleted-text/index.scss +33 -0
- package/src/elements/description-list/index.scss +42 -0
- package/src/elements/details/index.scss +85 -0
- package/src/elements/dialog/index.scss +211 -0
- package/src/elements/fieldset/index.scss +41 -0
- package/src/elements/file-input/index.scss +84 -0
- package/src/elements/footer/index.scss +34 -0
- package/src/elements/header-navigation/index.scss +125 -0
- package/src/elements/heading-level-1/index.scss +30 -0
- package/src/elements/heading-level-2/index.scss +30 -0
- package/src/elements/heading-level-3/index.scss +30 -0
- package/src/elements/heading-level-4/index.scss +30 -0
- package/src/elements/heading-level-5/index.scss +30 -0
- package/src/elements/heading-level-6/index.scss +30 -0
- package/src/elements/horizontal-rule/index.scss +41 -0
- package/src/elements/inline-loading/index.scss +70 -0
- package/src/elements/inline-quotation/index.scss +28 -0
- package/src/elements/inserted-text/index.scss +34 -0
- package/src/elements/italic-text/index.scss +27 -0
- package/src/elements/keyboard-input/index.scss +34 -0
- package/src/elements/label/index.scss +52 -0
- package/src/elements/main/index.scss +32 -0
- package/src/elements/marked-text/index.scss +33 -0
- package/src/elements/menu/index.scss +106 -0
- package/src/elements/number-input/index.scss +37 -0
- package/src/elements/ordered-list/index.scss +50 -0
- package/src/elements/paragraph/index.scss +30 -0
- package/src/elements/password-input/index.scss +38 -0
- package/src/elements/popover/index.scss +71 -0
- package/src/elements/preformatted/index.scss +43 -0
- package/src/elements/progress-bar/index.scss +86 -0
- package/src/elements/radio-button/index.scss +67 -0
- package/src/elements/range-input/index.scss +76 -0
- package/src/elements/search-input/index.scss +47 -0
- package/src/elements/select/index.scss +71 -0
- package/src/elements/side-navigation/index.scss +141 -0
- package/src/elements/small-text/index.scss +31 -0
- package/src/elements/table/index.scss +131 -0
- package/src/elements/tabs/index.scss +214 -0
- package/src/elements/text-area/index.scss +43 -0
- package/src/elements/text-input/index.scss +40 -0
- package/src/elements/tile/index.scss +72 -0
- package/src/elements/time-input/index.scss +47 -0
- package/src/elements/toggle/index.scss +106 -0
- package/src/elements/tooltip/index.scss +44 -0
- package/src/elements/tree-view/index.scss +127 -0
- package/src/elements/unordered-list/index.scss +46 -0
- package/src/index.scss +10 -0
- package/src/layout/_density.scss +27 -0
- package/src/layout/_mode.scss +349 -0
- package/src/layout/_size.scss +54 -0
- package/src/layout/index.scss +10 -0
- package/src/prebuilt/editorial.scss +94 -0
- package/src/prebuilt/expressive.scss +153 -0
- package/src/prebuilt/productive.scss +153 -0
- package/src/utilities/_carbon.scss +96 -0
- package/src/utilities/_icons.scss +111 -0
- package/src/utilities/_tokens.scss +35 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
@use 'sass:map';
|
|
9
|
+
|
|
10
|
+
@use '@carbon/styles/scss/theme';
|
|
11
|
+
@use '@carbon/styles/scss/spacing';
|
|
12
|
+
|
|
13
|
+
@use '../label';
|
|
14
|
+
|
|
15
|
+
@use '../../layout';
|
|
16
|
+
|
|
17
|
+
$config: () !default;
|
|
18
|
+
|
|
19
|
+
$-default-config: (
|
|
20
|
+
selector: 'label:has(input[type="range"])',
|
|
21
|
+
axis: 'block',
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
/// @group range-input
|
|
25
|
+
/// @param {Map} config [()]
|
|
26
|
+
/// @param {Selector} config.selector ['label:has(input[type="range"])']
|
|
27
|
+
/// @param {'block' | 'axis'} config.axis ['block']
|
|
28
|
+
@mixin styles($config: $config) {
|
|
29
|
+
$props: map.deep-merge($-default-config, $config);
|
|
30
|
+
|
|
31
|
+
#{map.get($props, 'selector')} {
|
|
32
|
+
@include label.styles((
|
|
33
|
+
selector: '&',
|
|
34
|
+
axis: map.get($props, 'axis'),
|
|
35
|
+
));
|
|
36
|
+
|
|
37
|
+
& input[type="range"] {
|
|
38
|
+
display: block;
|
|
39
|
+
appearance: none;
|
|
40
|
+
background-color: transparent;
|
|
41
|
+
block-size: 1.25rem;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
& input[type="range"]::-webkit-slider-thumb {
|
|
45
|
+
appearance: none;
|
|
46
|
+
block-size: 0.875rem;
|
|
47
|
+
inline-size: 0.875rem;
|
|
48
|
+
border-radius: 50%;
|
|
49
|
+
background-color: theme.$layer-selected-inverse;
|
|
50
|
+
translate: 0 calc(-50% + 0.125rem * 0.5);
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
& input[type="range"]::-webkit-slider-runnable-track {
|
|
55
|
+
height: 0.125rem;
|
|
56
|
+
background-color: theme.$border-subtle;
|
|
57
|
+
cursor: pointer;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
& input[type="range"]:focus {
|
|
61
|
+
outline: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
& input[type="range"]:focus::-webkit-slider-thumb {
|
|
65
|
+
background-color: theme.$border-interactive;
|
|
66
|
+
outline: 0.125rem solid theme.$border-interactive;
|
|
67
|
+
outline-offset: calc(0.0625rem + 0.125rem);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
& input[type="range"]:disabled::-webkit-slider-thumb,
|
|
71
|
+
& input[type="range"]::-webkit-slider-runnable-track {
|
|
72
|
+
background-color: theme.$border-disabled;
|
|
73
|
+
cursor: not-allowed;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
@use 'sass:map';
|
|
9
|
+
|
|
10
|
+
@use '../_labelled-input';
|
|
11
|
+
|
|
12
|
+
@use '../../utilities/icons';
|
|
13
|
+
|
|
14
|
+
$config: () !default;
|
|
15
|
+
|
|
16
|
+
$-default-config: (
|
|
17
|
+
selector: 'label:has(input[type="search"])',
|
|
18
|
+
axis: 'block',
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
/// @group search-input
|
|
22
|
+
/// @param {Map} config [()]
|
|
23
|
+
/// @param {Selector} config.selector ['label:has(input[type="search"])']
|
|
24
|
+
/// @param {'block' | 'axis'} config.axis ['block']
|
|
25
|
+
@mixin styles($config: $config) {
|
|
26
|
+
$props: map.deep-merge($-default-config, $config);
|
|
27
|
+
|
|
28
|
+
#{map.get($props, 'selector')} {
|
|
29
|
+
@include labelled-input.styles((
|
|
30
|
+
label: (
|
|
31
|
+
selector: '&',
|
|
32
|
+
axis: map.get($props, 'axis'),
|
|
33
|
+
),
|
|
34
|
+
input: (
|
|
35
|
+
selector: 'input[type="search"]',
|
|
36
|
+
),
|
|
37
|
+
fixed-input-leading-slots: 1,
|
|
38
|
+
input-invalid-slot: 'after',
|
|
39
|
+
));
|
|
40
|
+
|
|
41
|
+
&::before {
|
|
42
|
+
@include labelled-input.input-leading-slot {
|
|
43
|
+
@include icons.search;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
@use 'sass:map';
|
|
9
|
+
|
|
10
|
+
@use '@carbon/styles/scss/theme';
|
|
11
|
+
|
|
12
|
+
@use '../_labelled-input';
|
|
13
|
+
|
|
14
|
+
@use '../../layout';
|
|
15
|
+
@use '../../utilities/icons';
|
|
16
|
+
|
|
17
|
+
$config: () !default;
|
|
18
|
+
|
|
19
|
+
$-default-config: (
|
|
20
|
+
selector: 'label:has(select)',
|
|
21
|
+
axis: 'block',
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
/// @group select
|
|
25
|
+
/// @param {Map} config [()]
|
|
26
|
+
/// @param {Selector} config.selector ['label:has(select)']
|
|
27
|
+
/// @param {'block' | 'axis'} config.axis ['block']
|
|
28
|
+
@mixin styles($config: $config) {
|
|
29
|
+
$props: map.deep-merge($-default-config, $config);
|
|
30
|
+
|
|
31
|
+
#{map.get($props, 'selector')} {
|
|
32
|
+
@include labelled-input.styles((
|
|
33
|
+
label: (
|
|
34
|
+
selector: '&',
|
|
35
|
+
axis: map.get($props, 'axis'),
|
|
36
|
+
),
|
|
37
|
+
input: (
|
|
38
|
+
selector: 'select',
|
|
39
|
+
emit-readonly: false,
|
|
40
|
+
),
|
|
41
|
+
fixed-input-trailing-slots: 1,
|
|
42
|
+
input-invalid-slot: 'after',
|
|
43
|
+
));
|
|
44
|
+
|
|
45
|
+
&::before {
|
|
46
|
+
@include labelled-input.input-trailing-slot {
|
|
47
|
+
@include icons.chevron--down;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
& select {
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
|
|
54
|
+
&:enabled:hover {
|
|
55
|
+
background-color: theme.$field-hover;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&:enabled:active {
|
|
59
|
+
background-color: theme.$layer-active;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@if map.get($props, 'axis') == 'inline' {
|
|
63
|
+
&:enabled,
|
|
64
|
+
&:disabled {
|
|
65
|
+
background-color: transparent;
|
|
66
|
+
border-block-end: none;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
@use 'sass:map';
|
|
9
|
+
|
|
10
|
+
@use '@carbon/styles/scss/spacing';
|
|
11
|
+
@use '@carbon/styles/scss/theme';
|
|
12
|
+
@use '@carbon/styles/scss/utilities/focus-outline';
|
|
13
|
+
|
|
14
|
+
@use '../../layout';
|
|
15
|
+
@use '../../utilities/icons';
|
|
16
|
+
|
|
17
|
+
$config: () !default;
|
|
18
|
+
|
|
19
|
+
$-default-config: (
|
|
20
|
+
selector: 'nav:has(+ main)',
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
/// @group side-navigation
|
|
24
|
+
/// @param {Map} config [()]
|
|
25
|
+
/// @param {Selector} config.selector ['nav:has(+ main)']
|
|
26
|
+
@mixin styles($config: $config) {
|
|
27
|
+
$props: map.deep-merge($-default-config, $config);
|
|
28
|
+
|
|
29
|
+
#{map.get($props, 'selector')} {
|
|
30
|
+
padding-block: layout.$density--padding;
|
|
31
|
+
inline-size: 16rem;
|
|
32
|
+
background-color: theme.$layer-background;
|
|
33
|
+
border-inline-end: 0.0625rem solid theme.$border-subtle;
|
|
34
|
+
position: fixed;
|
|
35
|
+
inset-inline-start: 0;
|
|
36
|
+
inset-block: 0;
|
|
37
|
+
overflow-y: auto;
|
|
38
|
+
box-sizing: border-box;
|
|
39
|
+
|
|
40
|
+
& ul {
|
|
41
|
+
margin: 0;
|
|
42
|
+
padding: 0;
|
|
43
|
+
list-style: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
& li {
|
|
47
|
+
margin: 0;
|
|
48
|
+
padding: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
& li > button[aria-expanded],
|
|
52
|
+
& li > a {
|
|
53
|
+
@include layout.mode--heading-compact;
|
|
54
|
+
position: relative;
|
|
55
|
+
appearance: none;
|
|
56
|
+
border: none;
|
|
57
|
+
box-shadow: none;
|
|
58
|
+
border-radius: 0;
|
|
59
|
+
inline-size: 100%;
|
|
60
|
+
text-align: start;
|
|
61
|
+
display: block;
|
|
62
|
+
box-sizing: border-box;
|
|
63
|
+
color: theme.$text-secondary;
|
|
64
|
+
background-color: transparent;
|
|
65
|
+
text-decoration: none;
|
|
66
|
+
block-size: layout.$size--block-size;
|
|
67
|
+
padding-block-start: layout.$size--padding-block-start;
|
|
68
|
+
padding-block-end: layout.$size--padding-block-end;
|
|
69
|
+
padding-inline: layout.$density--padding;
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
white-space: nowrap;
|
|
72
|
+
text-overflow: ellipsis;
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
transition-property: color, background-color;
|
|
75
|
+
transition-duration: layout.$mode--transition-duration;
|
|
76
|
+
transition-timing-function: layout.$mode--transition-timing-function;
|
|
77
|
+
|
|
78
|
+
&:hover {
|
|
79
|
+
background-color: theme.$layer-hover;
|
|
80
|
+
color: theme.$text-primary;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&:active {
|
|
84
|
+
background-color: theme.$layer-active;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&:focus {
|
|
88
|
+
@include focus-outline.focus-outline('outline');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
& li > button[aria-expanded] {
|
|
93
|
+
padding-inline-end: calc(layout.$density--padding + 1rem + layout.$density--padding);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
& li > button[aria-expanded]::after {
|
|
97
|
+
content: '';
|
|
98
|
+
@include icons.chevron--down;
|
|
99
|
+
display: block;
|
|
100
|
+
position: absolute;
|
|
101
|
+
inset-inline-end: layout.$density--padding;
|
|
102
|
+
inset-block-start: layout.$size--padding-block-start;
|
|
103
|
+
transition: rotate layout.$mode--transition-duration layout.$mode--transition-timing-function;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
& li > button[aria-expanded="true"]::after {
|
|
107
|
+
rotate: 180deg;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
& li > button[aria-expanded] + ul a {
|
|
111
|
+
@include layout.mode--body-compact;
|
|
112
|
+
padding-inline-start: calc(layout.$density--padding * 2);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
& li > button[aria-expanded]:has(+ ul a[aria-current="page"]) {
|
|
116
|
+
color: theme.$text-primary;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
& li > button[aria-expanded="false"]:has(+ ul a[aria-current="page"]),
|
|
120
|
+
& li > button[aria-expanded] + ul a[aria-current="page"],
|
|
121
|
+
& li > a[aria-current="page"] {
|
|
122
|
+
@include layout.mode--heading-compact;
|
|
123
|
+
background-color: theme.$layer-selected;
|
|
124
|
+
box-shadow: inset 0.25rem 0 0 0 theme.$border-interactive;
|
|
125
|
+
color: theme.$text-primary;
|
|
126
|
+
|
|
127
|
+
&:hover {
|
|
128
|
+
background-color: theme.$layer-selected-hover;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
& li > button[aria-expanded="false"] + ul {
|
|
133
|
+
display: none;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
& + main,
|
|
137
|
+
& + main + footer {
|
|
138
|
+
margin-inline-start: 16rem;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
@use 'sass:map';
|
|
9
|
+
|
|
10
|
+
@use '@carbon/styles/scss/theme';
|
|
11
|
+
|
|
12
|
+
@use '../../layout';
|
|
13
|
+
|
|
14
|
+
$config: () !default;
|
|
15
|
+
|
|
16
|
+
$-default-config: (
|
|
17
|
+
selector: 'small',
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
/// @group small-text
|
|
21
|
+
/// @param {Map} config [()]
|
|
22
|
+
/// @param {Selector} config.selector ['small']
|
|
23
|
+
@mixin styles($config: $config) {
|
|
24
|
+
$props: map.deep-merge($-default-config, $config);
|
|
25
|
+
|
|
26
|
+
#{map.get($props, 'selector')} {
|
|
27
|
+
@include layout.mode--helper-text;
|
|
28
|
+
display: inline-block;
|
|
29
|
+
color: theme.$text-helper;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
@use 'sass:map';
|
|
9
|
+
|
|
10
|
+
@use '@carbon/styles/scss/theme';
|
|
11
|
+
@use '@carbon/styles/scss/spacing';
|
|
12
|
+
|
|
13
|
+
@use '../_layer';
|
|
14
|
+
|
|
15
|
+
@use '../../layout';
|
|
16
|
+
|
|
17
|
+
$config: () !default;
|
|
18
|
+
|
|
19
|
+
$-default-config: (
|
|
20
|
+
selector: 'table',
|
|
21
|
+
kind: 'data-table',
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
/// @group table
|
|
25
|
+
/// @param {Map} config [()]
|
|
26
|
+
/// @param {Selector} config.selector ['table']
|
|
27
|
+
/// @param {'data-table' | 'structured-list' | 'structured-list--flush'} config.kind ['data-table']
|
|
28
|
+
@mixin styles($config: $config) {
|
|
29
|
+
$props: map.deep-merge($-default-config, $config);
|
|
30
|
+
|
|
31
|
+
#{map.get($props, 'selector')} {
|
|
32
|
+
border-spacing: 0;
|
|
33
|
+
inline-size: 100%;
|
|
34
|
+
margin-block: layout.$mode--margin-block;
|
|
35
|
+
|
|
36
|
+
& th {
|
|
37
|
+
@include layout.mode--heading-compact;
|
|
38
|
+
text-align: start;
|
|
39
|
+
color: theme.$text-primary;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
& td {
|
|
43
|
+
@include layout.mode--body-compact;
|
|
44
|
+
color: theme.$text-secondary;
|
|
45
|
+
vertical-align: top;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
& th,
|
|
49
|
+
& td {
|
|
50
|
+
block-size: layout.$size--block-size;
|
|
51
|
+
box-sizing: border-box;
|
|
52
|
+
border-block-end: 0.0625rem solid theme.$border-subtle;
|
|
53
|
+
padding-block-start: layout.$size--padding-block-start;
|
|
54
|
+
padding-block-end: layout.$size--padding-block-end;
|
|
55
|
+
padding-inline: layout.$density--padding;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
& tbody:has(+ tfoot) tr:last-child th,
|
|
59
|
+
& tbody:has(+ tfoot) tr:last-child td,
|
|
60
|
+
& tfoot th,
|
|
61
|
+
& tfoot td {
|
|
62
|
+
border-block-end: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
& tfoot td {
|
|
66
|
+
color: theme.$text-primary;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
& caption {
|
|
70
|
+
text-align: start;
|
|
71
|
+
@include layout.mode--helper-text;
|
|
72
|
+
padding: layout.$density--padding;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@if map.get($props, 'kind') == 'data-table' {
|
|
76
|
+
background-color: theme.$layer;
|
|
77
|
+
|
|
78
|
+
& tbody tr,
|
|
79
|
+
& tfoot tr {
|
|
80
|
+
@include layer.styles;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
& th {
|
|
84
|
+
background-color: theme.$layer-accent;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
& tr:hover {
|
|
88
|
+
@include layer.layer-background-hover;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
& tfoot th,
|
|
92
|
+
& tfoot td {
|
|
93
|
+
border-block-start: 0.0625rem solid theme.$border-strong;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
& caption {
|
|
97
|
+
background-color: theme.$layer;
|
|
98
|
+
color: theme.$text-secondary;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@if map.get($props, 'kind') == 'structured-list' or map.get($props, 'kind') == 'structured-list--flush' {
|
|
103
|
+
& tfoot th,
|
|
104
|
+
& tfoot td {
|
|
105
|
+
border-block-start: 0.0625rem solid theme.$border-subtle;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
& caption {
|
|
109
|
+
caption-side: bottom;
|
|
110
|
+
color: theme.$text-helper;
|
|
111
|
+
max-inline-size: layout.$mode--max-inline-size;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@if map.get($props, 'kind') == 'structured-list--flush' {
|
|
116
|
+
& th:first-child,
|
|
117
|
+
& td:first-child {
|
|
118
|
+
padding-inline-start: 0;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
& th:last-child,
|
|
122
|
+
& td:last-child {
|
|
123
|
+
padding-inline-end: 0;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
& caption {
|
|
127
|
+
padding-inline: 0;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
@use 'sass:map';
|
|
9
|
+
|
|
10
|
+
@use '@carbon/styles/scss/theme';
|
|
11
|
+
@use '@carbon/styles/scss/spacing';
|
|
12
|
+
@use '@carbon/styles/scss/utilities/focus-outline';
|
|
13
|
+
@use '@carbon/styles/scss/components/button/tokens' as carbon-button;
|
|
14
|
+
@use '@carbon/styles/scss/components/content-switcher/tokens' as carbon-content-switcher;
|
|
15
|
+
|
|
16
|
+
@use '../../layout';
|
|
17
|
+
|
|
18
|
+
$config: () !default;
|
|
19
|
+
|
|
20
|
+
$-default-config: (
|
|
21
|
+
selector: '[role="tablist"]',
|
|
22
|
+
kind: 'line',
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
/// @group tabs
|
|
26
|
+
/// @param {Map} config [()]
|
|
27
|
+
/// @param {Selector} config.selector ['[role="tablist"]']
|
|
28
|
+
/// @param {'line' | 'contained' | 'content-swither | 'content-switcher--low-contrast'} config.kind ['line']
|
|
29
|
+
@mixin styles($config: $config) {
|
|
30
|
+
$props: map.deep-merge($-default-config, $config);
|
|
31
|
+
|
|
32
|
+
#{map.get($props, 'selector')} {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: row;
|
|
35
|
+
|
|
36
|
+
& button[role="tab"] {
|
|
37
|
+
@include layout.mode--body-compact;
|
|
38
|
+
position: relative;
|
|
39
|
+
appearance: none;
|
|
40
|
+
border: none;
|
|
41
|
+
box-shadow: none;
|
|
42
|
+
border-radius: 0;
|
|
43
|
+
background: none;
|
|
44
|
+
color: theme.$text-secondary;
|
|
45
|
+
block-size: layout.$size--block-size;
|
|
46
|
+
padding-inline: layout.$density--padding;
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
transition-property: color, background-color, border-color;
|
|
49
|
+
transition-duration: layout.$mode--transition-duration;
|
|
50
|
+
transition-timing-function: layout.$mode--transition-timing-function;
|
|
51
|
+
|
|
52
|
+
&:enabled:hover:not([aria-selected="true"]) {
|
|
53
|
+
color: theme.$text-primary;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&:focus {
|
|
57
|
+
@include focus-outline.focus-outline('outline');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&:disabled {
|
|
61
|
+
cursor: not-allowed;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
& ~ [role="tabpanel"] {
|
|
66
|
+
@include layout.mode--body;
|
|
67
|
+
padding: layout.$density--padding;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@if map.get($props, 'kind') == 'line' {
|
|
71
|
+
& button[role="tab"] {
|
|
72
|
+
border-block-end: 0.125rem solid theme.$border-subtle;
|
|
73
|
+
margin-inline-end: 0.0625rem;
|
|
74
|
+
|
|
75
|
+
&:enabled:hover:not([aria-selected="true"]) {
|
|
76
|
+
border-block-end-color: theme.$border-strong;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&[aria-selected="true"] {
|
|
80
|
+
@include layout.mode--heading-compact;
|
|
81
|
+
color: theme.$text-primary;
|
|
82
|
+
border-block-end-color: theme.$border-interactive;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&:disabled {
|
|
86
|
+
color: theme.$text-disabled;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@if map.get($props, 'kind') == 'contained' {
|
|
92
|
+
& button[role="tab"] {
|
|
93
|
+
background-color: theme.$layer-accent;
|
|
94
|
+
border-block-start: 0.125rem solid transparent;
|
|
95
|
+
|
|
96
|
+
&:not(:last-of-type, [aria-selected="true"], :has(+ [aria-selected="true"])) {
|
|
97
|
+
border-inline-end: 0.0625rem solid theme.$border-strong;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&:enabled:hover:not([aria-selected="true"]) {
|
|
101
|
+
background-color: theme.$layer-accent-hover;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&[aria-selected="true"] {
|
|
105
|
+
@include layout.mode--heading-compact;
|
|
106
|
+
color: theme.$text-primary;
|
|
107
|
+
border-block-start: 0.125rem solid theme.$border-interactive;
|
|
108
|
+
background-color: theme.$layer;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&:disabled {
|
|
112
|
+
background-color: carbon-button.$button-disabled;
|
|
113
|
+
color: theme.$text-on-color-disabled;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
& ~ [role="tabpanel"] {
|
|
118
|
+
background-color: theme.$layer;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@if map.get($props, 'kind') == 'content-switcher' or map.get($props, 'kind') == 'content-switcher--low-contrast' {
|
|
123
|
+
& {
|
|
124
|
+
box-shadow: 0 0 0 0.0625rem theme.$border-inverse;
|
|
125
|
+
border-radius: 0.25rem;
|
|
126
|
+
display: inline-grid;
|
|
127
|
+
grid-auto-flow: column;
|
|
128
|
+
grid-auto-columns: 1fr;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
& button[role="tab"] {
|
|
132
|
+
text-align: start;
|
|
133
|
+
|
|
134
|
+
&:first-child {
|
|
135
|
+
border-start-start-radius: inherit;
|
|
136
|
+
border-end-start-radius: inherit;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&:last-child {
|
|
140
|
+
border-start-end-radius: inherit;
|
|
141
|
+
border-end-end-radius: inherit;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&:enabled:hover:not([aria-selected="true"]) {
|
|
145
|
+
background-color: theme.$layer-hover;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&:enabled:active:not([aria-selected="true"]) {
|
|
149
|
+
background-color: theme.$layer-active;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
&[aria-selected="true"] {
|
|
153
|
+
z-index: 1;
|
|
154
|
+
border-radius: inherit;
|
|
155
|
+
color: theme.$text-inverse;
|
|
156
|
+
background-color: theme.$border-inverse;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&:focus {
|
|
160
|
+
box-shadow: inset 0 0 0 0.1875rem theme.$background;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
&:disabled {
|
|
164
|
+
color: theme.$text-disabled;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&::after {
|
|
168
|
+
content: '';
|
|
169
|
+
display: block;
|
|
170
|
+
position: absolute;
|
|
171
|
+
inset-inline-end: 0;
|
|
172
|
+
block-size: 1lh;
|
|
173
|
+
inset-block: calc(50% - 0.5lh);
|
|
174
|
+
inline-size: 0.0625rem;
|
|
175
|
+
background-color: theme.$border-subtle;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&[aria-selected="true"]::after,
|
|
179
|
+
&:last-child::after,
|
|
180
|
+
&:has(+ [aria-selected="true"])::after,
|
|
181
|
+
&:hover::after,
|
|
182
|
+
&:has(+ :hover)::after,
|
|
183
|
+
&:focus::after {
|
|
184
|
+
visibility: hidden;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@if map.get($props, 'kind') == 'content-switcher--low-contrast' {
|
|
190
|
+
& {
|
|
191
|
+
background-color: carbon-content-switcher.$content-switcher-background;
|
|
192
|
+
box-shadow: 0 0 0 0.0625rem theme.$border-strong;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
& button[role="tab"] {
|
|
196
|
+
&:enabled:hover:not([aria-selected="true"]),
|
|
197
|
+
&:enabled:active:not([aria-selected="true"]) {
|
|
198
|
+
background-color: carbon-content-switcher.$content-switcher-background-hover;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
&[aria-selected="true"] {
|
|
202
|
+
@include layout.mode--heading-compact;
|
|
203
|
+
background-color: carbon-content-switcher.$content-switcher-selected;
|
|
204
|
+
color: theme.$text-primary;
|
|
205
|
+
box-shadow: 0 0 0 0.0625rem theme.$border-inverse;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
&::after {
|
|
209
|
+
background-color: theme.$border-strong;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|