@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,143 @@
|
|
|
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
|
+
@use '../_input';
|
|
15
|
+
|
|
16
|
+
@use '../../layout';
|
|
17
|
+
@use '../../utilities/icons';
|
|
18
|
+
|
|
19
|
+
$config: () !default;
|
|
20
|
+
|
|
21
|
+
$-default-config: (
|
|
22
|
+
label: (
|
|
23
|
+
selector: 'label',
|
|
24
|
+
axis: 'block',
|
|
25
|
+
),
|
|
26
|
+
input: (
|
|
27
|
+
selector: 'input',
|
|
28
|
+
emit-readonly: true,
|
|
29
|
+
emit-disabled: true,
|
|
30
|
+
emit-invalid: true,
|
|
31
|
+
emit-focus: true,
|
|
32
|
+
),
|
|
33
|
+
fixed-input-leading-slots: 0,
|
|
34
|
+
fixed-input-trailing-slots: 0,
|
|
35
|
+
input-invalid-slot: false, // after | before
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
/// @group _labelled-input
|
|
39
|
+
/// @param {Map} config [()]
|
|
40
|
+
/// @param {Map} config.label [()]
|
|
41
|
+
/// @param {Selector} config.label.selector [label]
|
|
42
|
+
/// @param {'block' | 'inline'} config.label.axis ['block]
|
|
43
|
+
/// @param {Map} config.input [()]
|
|
44
|
+
/// @param {Selector} config.input.selector [input]
|
|
45
|
+
/// @param {Bool} config.input.emit-readonly [true]
|
|
46
|
+
/// @param {Bool} config.input.emit-disabled [true]
|
|
47
|
+
/// @param {Bool} config.input.emit-invalid [true]
|
|
48
|
+
/// @param {Bool} config.input.emit-focus [true]
|
|
49
|
+
/// @param {0 | 1 | 2} config.fixed-input-leading-slots [0] - How many fixed leading slots should be reserved
|
|
50
|
+
/// @param {0 | 1 | 2} config.fixed-input-trailing-slots [0] - How many fixed trailing slots should be reserved
|
|
51
|
+
/// @param {false | 'before' | 'after'} config.input-invalid-slot [false] - Which pseudo element should render the dynamic invalid slot. `false` if it shouldn't be rendered at all.
|
|
52
|
+
@mixin styles($config: $config) {
|
|
53
|
+
$props: map.deep-merge($-default-config, $config);
|
|
54
|
+
|
|
55
|
+
#{map.get($props, 'label', 'selector')} {
|
|
56
|
+
@include label.styles((
|
|
57
|
+
selector: '&',
|
|
58
|
+
axis: map.get($props, 'label', 'axis'),
|
|
59
|
+
));
|
|
60
|
+
|
|
61
|
+
position: relative;
|
|
62
|
+
|
|
63
|
+
#{map.get($props, 'input', 'selector')} {
|
|
64
|
+
@include input.styles((
|
|
65
|
+
selector: '&',
|
|
66
|
+
emit-readonly: map.get($props, 'input', 'emit-readonly'),
|
|
67
|
+
emit-disabled: map.get($props, 'input', 'emit-disabled'),
|
|
68
|
+
emit-invalid: map.get($props, 'input', 'emit-invalid'),
|
|
69
|
+
emit-focus: map.get($props, 'input', 'emit-focus'),
|
|
70
|
+
));
|
|
71
|
+
|
|
72
|
+
padding-inline-start: -get-slot-space(map.get($props, 'fixed-input-leading-slots'));
|
|
73
|
+
padding-inline-end: -get-slot-space(map.get($props, 'fixed-input-trailing-slots'));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&::before,
|
|
77
|
+
&::after {
|
|
78
|
+
z-index: 9999;
|
|
79
|
+
position: absolute;
|
|
80
|
+
pointer-events: none;
|
|
81
|
+
inset-block-start: calc(layout.$size--padding-block-start - ((1rem - 1lh) * 0.5));
|
|
82
|
+
|
|
83
|
+
@if map.get($props, 'label', 'axis') == 'block' {
|
|
84
|
+
grid-row: 2;
|
|
85
|
+
} @else {
|
|
86
|
+
grid-column: 2;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@if map.get($props, 'input-invalid-slot') and map.get($props, 'input', 'emit-invalid') {
|
|
91
|
+
&:has(#{map.get($props, 'input', 'selector')}:invalid),
|
|
92
|
+
&:has(#{map.get($props, 'input', 'selector')}[aria-invalid="true"]) {
|
|
93
|
+
&::#{map.get($props, 'input-invalid-slot')} {
|
|
94
|
+
@include input-trailing-slot(map.get($props, 'fixed-input-trailing-slots') + 1) {
|
|
95
|
+
@include icons.warning--filled;
|
|
96
|
+
color: theme.$support-error;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
#{map.get($props, 'input', 'selector')} {
|
|
101
|
+
padding-inline-end: -get-slot-space(map.get($props, 'fixed-input-trailing-slots') + 1);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@function -get-slot-offset($index: 1) {
|
|
109
|
+
@return calc((spacing.$spacing-03 + 1rem) * ($index - 1) + layout.$density--padding);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@function -get-slot-space($count: 0) {
|
|
113
|
+
$additional-inline-padding: 0rem;
|
|
114
|
+
|
|
115
|
+
@if $count > 0 {
|
|
116
|
+
$additional-inline-padding: layout.$density--padding;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/*
|
|
120
|
+
regular inline padding
|
|
121
|
+
+ number of slots
|
|
122
|
+
+ number of gaps between slots
|
|
123
|
+
+ inline padding if has any slots
|
|
124
|
+
*/
|
|
125
|
+
@return calc(
|
|
126
|
+
layout.$density--padding
|
|
127
|
+
+ $count * 1rem
|
|
128
|
+
+ max(($count - 1) * spacing.$spacing-03, 0rem)
|
|
129
|
+
+ $additional-inline-padding
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@mixin input-leading-slot($index: 1) {
|
|
134
|
+
content: '';
|
|
135
|
+
inset-inline-start: -get-slot-offset($index);
|
|
136
|
+
@content;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@mixin input-trailing-slot($index: 1) {
|
|
140
|
+
content: '';
|
|
141
|
+
inset-inline-end: -get-slot-offset($index);
|
|
142
|
+
@content;
|
|
143
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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/layer/layer-tokens';
|
|
12
|
+
@use '@carbon/styles/scss/utilities/custom-property';
|
|
13
|
+
|
|
14
|
+
@use '../../layout';
|
|
15
|
+
@use '../../utilities/tokens';
|
|
16
|
+
|
|
17
|
+
$config: () !default;
|
|
18
|
+
|
|
19
|
+
$-default-config: ();
|
|
20
|
+
|
|
21
|
+
/// @group _layer
|
|
22
|
+
/// @param {'01' | '02' | '03'} n - The layer level
|
|
23
|
+
/// @param {Bool} is-initial [false] - If this level should be treated as the intial, meaning it'll be used as a fallback if no matching css custom property is found
|
|
24
|
+
@mixin -on-layer($n, $is-initial: false) {
|
|
25
|
+
@container style(#{tokens.get-name('layer-level')}: #{$n}) {
|
|
26
|
+
@content;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@if $is-initial {
|
|
30
|
+
// if custom property doesn't exist
|
|
31
|
+
@container style(#{tokens.get-name('layer-level')}: unset) {
|
|
32
|
+
@content;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/// @group _layer
|
|
38
|
+
/// @param {Map} config [()]
|
|
39
|
+
@mixin styles($config: $config) {
|
|
40
|
+
$props: map.deep-merge($-default-config, $config);
|
|
41
|
+
|
|
42
|
+
// fallback for browers without container style query support
|
|
43
|
+
background-color: theme.$layer;
|
|
44
|
+
|
|
45
|
+
@include -on-layer('01', true) {
|
|
46
|
+
background-color: theme.$layer-background;
|
|
47
|
+
@include tokens.set('layer-level', '02');
|
|
48
|
+
@include layer-tokens.emit-layer-tokens(2);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@include -on-layer('02') {
|
|
52
|
+
background-color: theme.$layer-background;
|
|
53
|
+
@include tokens.set('layer-level', '03');
|
|
54
|
+
@include layer-tokens.emit-layer-tokens(3);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@include -on-layer('03') {
|
|
58
|
+
background-color: theme.$layer;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@mixin layer-background-hover {
|
|
63
|
+
// fallback for browers without container style query support
|
|
64
|
+
background-color: theme.$layer-hover;
|
|
65
|
+
|
|
66
|
+
@include -on-layer('01') { background-color: theme.$layer-hover-01; }
|
|
67
|
+
@include -on-layer('02') { background-color: theme.$layer-hover-02; }
|
|
68
|
+
@include -on-layer('03') { background-color: theme.$layer-hover-03; }
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@mixin layer-background-active {
|
|
72
|
+
// fallback for browers without container style query support
|
|
73
|
+
background-color: theme.$layer-active;
|
|
74
|
+
|
|
75
|
+
@include -on-layer('01') { background-color: theme.$layer-active-01; }
|
|
76
|
+
@include -on-layer('02') { background-color: theme.$layer-active-02; }
|
|
77
|
+
@include -on-layer('03') { background-color: theme.$layer-active-03; }
|
|
78
|
+
}
|
|
@@ -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: 'abbr[title]',
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
/// @group abbreviation
|
|
21
|
+
/// @param {Map} config [()]
|
|
22
|
+
/// @param {Selector} config.selector ['abbr[title]']
|
|
23
|
+
@mixin styles($config: $config) {
|
|
24
|
+
$props: map.deep-merge($-default-config, $config);
|
|
25
|
+
|
|
26
|
+
#{map.get($props, 'selector')} {
|
|
27
|
+
text-decoration: none;
|
|
28
|
+
cursor: help;
|
|
29
|
+
border-block-end: 0.0625rem dotted theme.$border-strong;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -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: 'address',
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
/// @group address
|
|
21
|
+
/// @param {Map} config [()]
|
|
22
|
+
/// @param {Selector} config.selector ['address']
|
|
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
|
+
color: theme.$text-secondary;
|
|
29
|
+
font-style: normal;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
|
|
14
|
+
@use '../../layout';
|
|
15
|
+
|
|
16
|
+
$config: () !default;
|
|
17
|
+
|
|
18
|
+
$-default-config: (
|
|
19
|
+
selector: 'a',
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
/// @group anchor
|
|
23
|
+
/// @param {Map} config [()]
|
|
24
|
+
/// @param {Selector} config.selector ['a']
|
|
25
|
+
@mixin styles($config: $config) {
|
|
26
|
+
$props: map.deep-merge($-default-config, $config);
|
|
27
|
+
|
|
28
|
+
#{map.get($props, 'selector')} {
|
|
29
|
+
display: inline-flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
column-gap: spacing.$spacing-03;
|
|
32
|
+
color: theme.$link-primary;
|
|
33
|
+
text-decoration: underline;
|
|
34
|
+
transition: color layout.$mode--transition-duration layout.$mode--transition-timing-function;
|
|
35
|
+
|
|
36
|
+
&:hover {
|
|
37
|
+
color: theme.$link-primary-hover;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&:focus {
|
|
41
|
+
@include focus-outline.focus-outline('outline');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
& svg {
|
|
45
|
+
fill: currentColor;
|
|
46
|
+
block-size: 1rem;
|
|
47
|
+
inline-size: 1rem;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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 '../../layout';
|
|
14
|
+
|
|
15
|
+
$config: () !default;
|
|
16
|
+
|
|
17
|
+
$-default-config: (
|
|
18
|
+
selector: 'blockquote',
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
/// @group block-quotation
|
|
22
|
+
/// @param {Map} config [()]
|
|
23
|
+
/// @param {Selector} config.selector ['blockquote']
|
|
24
|
+
@mixin styles($config: $config) {
|
|
25
|
+
$props: map.deep-merge($-default-config, $config);
|
|
26
|
+
|
|
27
|
+
#{map.get($props, 'selector')} {
|
|
28
|
+
margin-block: layout.$mode--margin-block;
|
|
29
|
+
margin-inline: spacing.$spacing-08;
|
|
30
|
+
max-inline-size: 50ch;
|
|
31
|
+
|
|
32
|
+
@include layout.mode--quotation;
|
|
33
|
+
|
|
34
|
+
& p {
|
|
35
|
+
@include layout.mode--quotation;
|
|
36
|
+
quotes: auto;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
& p::before {
|
|
40
|
+
content: open-quote;
|
|
41
|
+
margin-inline-start: -1.1ch;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
& p::after {
|
|
45
|
+
content: close-quote;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
& p {
|
|
49
|
+
margin-block: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
& + cite {
|
|
53
|
+
@include layout.mode--body-compact;
|
|
54
|
+
margin-inline-start: spacing.$spacing-08;
|
|
55
|
+
font-style: italic;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
& + cite::before {
|
|
59
|
+
content: '—';
|
|
60
|
+
margin-inline-end: spacing.$spacing-02;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 '../../layout';
|
|
14
|
+
|
|
15
|
+
$config: () !default;
|
|
16
|
+
|
|
17
|
+
$-default-config: (
|
|
18
|
+
selector: 'body',
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
/// @group body
|
|
22
|
+
/// @param {Map} config [()]
|
|
23
|
+
/// @param {Selector} config.selector ['body']
|
|
24
|
+
@mixin styles($config: $config) {
|
|
25
|
+
$props: map.deep-merge($-default-config, $config);
|
|
26
|
+
|
|
27
|
+
#{map.get($props, 'selector')} {
|
|
28
|
+
margin: 0;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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 '../../layout';
|
|
11
|
+
|
|
12
|
+
$config: () !default;
|
|
13
|
+
|
|
14
|
+
$-default-config: (
|
|
15
|
+
selector: 'b, strong',
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
/// @group bold-text
|
|
19
|
+
/// @param {Map} config [()]
|
|
20
|
+
/// @param {Selector} config.selector ['b, strong']
|
|
21
|
+
@mixin styles($config: $config) {
|
|
22
|
+
$props: map.deep-merge($-default-config, $config);
|
|
23
|
+
|
|
24
|
+
#{map.get($props, 'selector')} {
|
|
25
|
+
font-weight: 600;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,235 @@
|
|
|
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
|
+
@use 'sass:string';
|
|
10
|
+
|
|
11
|
+
@use '@carbon/styles/scss/spacing';
|
|
12
|
+
@use '@carbon/styles/scss/theme';
|
|
13
|
+
@use '@carbon/styles/scss/components/button/tokens' as carbon-button;
|
|
14
|
+
|
|
15
|
+
@use '../../layout';
|
|
16
|
+
|
|
17
|
+
$config: () !default;
|
|
18
|
+
|
|
19
|
+
$-default-config: (
|
|
20
|
+
selector: 'button',
|
|
21
|
+
kind: 'secondary',
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
/// @group button
|
|
25
|
+
/// @param {Map} config [()]
|
|
26
|
+
/// @param {Selector} config.selector ['button']
|
|
27
|
+
/// @param {'primary' | 'secondary' | 'tertiary' | 'ghost' | 'danger--primary' | 'danger--tertiary' | 'danger--ghost'} config.kind ['secondary']
|
|
28
|
+
@mixin styles($config: $config) {
|
|
29
|
+
$props: map.deep-merge($-default-config, $config);
|
|
30
|
+
|
|
31
|
+
#{map.get($props, 'selector')} {
|
|
32
|
+
@include layout.mode--body-compact;
|
|
33
|
+
appearance: none;
|
|
34
|
+
border: none;
|
|
35
|
+
box-shadow: none;
|
|
36
|
+
border-radius: 0;
|
|
37
|
+
text-align: start;
|
|
38
|
+
block-size: layout.$size--block-size;
|
|
39
|
+
padding-block-start: layout.$size--padding-block-start;
|
|
40
|
+
padding-block-end: layout.$size--padding-block-end;
|
|
41
|
+
padding-inline-start: layout.$density--padding;
|
|
42
|
+
padding-inline-end: calc(layout.$density--padding + 1rem + layout.$density--padding);
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
transition-property: color, background-color;
|
|
45
|
+
transition-duration: layout.$mode--transition-duration;
|
|
46
|
+
transition-timing-function: layout.$mode--transition-timing-function;
|
|
47
|
+
|
|
48
|
+
&:focus {
|
|
49
|
+
outline: 0.125rem solid theme.$focus;
|
|
50
|
+
outline-offset: -0.125rem;
|
|
51
|
+
box-shadow: inset 0 0 0 0.1875rem theme.$layer-background;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&:disabled {
|
|
55
|
+
cursor: not-allowed;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
& > svg {
|
|
59
|
+
fill: currentColor;
|
|
60
|
+
block-size: 1rem;
|
|
61
|
+
inline-size: 1rem;
|
|
62
|
+
translate: 0 0.125rem;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&:has(> svg:not(:only-child)) {
|
|
66
|
+
padding-inline-end: layout.$density--padding;
|
|
67
|
+
|
|
68
|
+
& > svg {
|
|
69
|
+
margin-inline-start: layout.$density--padding;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&:has(> svg:only-child) {
|
|
74
|
+
padding-inline: unset;
|
|
75
|
+
aspect-ratio: 1;
|
|
76
|
+
text-align: center;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@if map.get($props, 'kind') == 'primary' {
|
|
80
|
+
background-color: carbon-button.$button-primary;
|
|
81
|
+
color: theme.$text-on-color;
|
|
82
|
+
|
|
83
|
+
&:hover {
|
|
84
|
+
background-color: carbon-button.$button-primary-hover;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&:active {
|
|
88
|
+
background-color: carbon-button.$button-primary-active;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&:disabled {
|
|
92
|
+
background-color: carbon-button.$button-disabled;
|
|
93
|
+
color: theme.$text-on-color-disabled;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@if map.get($props, 'kind') == 'secondary' {
|
|
98
|
+
background-color: carbon-button.$button-secondary;
|
|
99
|
+
color: theme.$text-on-color;
|
|
100
|
+
|
|
101
|
+
&:enabled:hover {
|
|
102
|
+
background-color: carbon-button.$button-secondary-hover;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&:enabled:active {
|
|
106
|
+
background-color: carbon-button.$button-secondary-active;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&:disabled {
|
|
110
|
+
background-color: carbon-button.$button-disabled;
|
|
111
|
+
color: theme.$text-on-color-disabled;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@if map.get($props, 'kind') == 'tertiary' {
|
|
116
|
+
background-color: transparent;
|
|
117
|
+
color: carbon-button.$button-tertiary;
|
|
118
|
+
outline: 0.0625rem solid carbon-button.$button-tertiary;
|
|
119
|
+
outline-offset: -0.0625rem;
|
|
120
|
+
|
|
121
|
+
&:focus {
|
|
122
|
+
color: theme.$text-inverse;
|
|
123
|
+
background-color: carbon-button.$button-tertiary;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&:enabled:hover {
|
|
127
|
+
color: theme.$text-inverse;
|
|
128
|
+
background-color: carbon-button.$button-tertiary-hover;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&:enabled:active {
|
|
132
|
+
background-color: carbon-button.$button-tertiary-active;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&:disabled {
|
|
136
|
+
outline-color: carbon-button.$button-disabled;
|
|
137
|
+
color: theme.$text-disabled;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
@if map.get($props, 'kind') == 'ghost' {
|
|
142
|
+
background-color: transparent;
|
|
143
|
+
color: theme.$link-primary;
|
|
144
|
+
padding-inline-end: layout.$density--padding;
|
|
145
|
+
|
|
146
|
+
&:enabled:hover {
|
|
147
|
+
color: theme.$link-primary-hover;
|
|
148
|
+
background-color: theme.$layer-hover;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&:enabled:active {
|
|
152
|
+
background-color: theme.$layer-active;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&:disabled {
|
|
156
|
+
color: theme.$text-disabled;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&:has(> svg:not(:only-child)) > svg {
|
|
160
|
+
margin-inline-start: spacing.$spacing-03;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
@if map.get($props, 'kind') == 'danger--primary' {
|
|
165
|
+
background-color: carbon-button.$button-danger-primary;
|
|
166
|
+
color: theme.$text-on-color;
|
|
167
|
+
|
|
168
|
+
&:enabled:hover {
|
|
169
|
+
background-color: carbon-button.$button-danger-hover;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&:enabled:active {
|
|
173
|
+
background-color: carbon-button.$button-danger-active;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
&:disabled {
|
|
177
|
+
background-color: carbon-button.$button-disabled;
|
|
178
|
+
color: theme.$text-on-color-disabled;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@if map.get($props, 'kind') == 'danger--tertiary' {
|
|
183
|
+
background-color: transparent;
|
|
184
|
+
color: carbon-button.$button-danger-secondary;
|
|
185
|
+
outline: 0.0625rem solid carbon-button.$button-danger-secondary;
|
|
186
|
+
outline-offset: -0.0625rem;
|
|
187
|
+
|
|
188
|
+
&:focus {
|
|
189
|
+
color: theme.$text-on-color;
|
|
190
|
+
background-color: carbon-button.$button-danger-primary;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
&:enabled:hover {
|
|
194
|
+
color: theme.$text-on-color;
|
|
195
|
+
background-color: carbon-button.$button-danger-hover;
|
|
196
|
+
outline-color: carbon-button.$button-danger-hover;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
&:enabled:active {
|
|
200
|
+
background-color: carbon-button.$button-danger-active;
|
|
201
|
+
outline-color: carbon-button.$button-danger-active;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
&:disabled {
|
|
205
|
+
outline-color: carbon-button.$button-disabled;
|
|
206
|
+
color: theme.$text-disabled;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@if map.get($props, 'kind') == 'danger--ghost' {
|
|
211
|
+
background-color: transparent;
|
|
212
|
+
color: carbon-button.$button-danger-secondary;
|
|
213
|
+
padding-inline-end: layout.$density--padding;
|
|
214
|
+
|
|
215
|
+
&:enabled:hover {
|
|
216
|
+
color: theme.$text-on-color;
|
|
217
|
+
background-color: carbon-button.$button-danger-hover;
|
|
218
|
+
outline-color: carbon-button.$button-danger-hover;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
&:enabled:active {
|
|
222
|
+
background-color: carbon-button.$button-danger-active;
|
|
223
|
+
outline-color: carbon-button.$button-danger-active;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
&:disabled {
|
|
227
|
+
color: theme.$text-disabled;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
&:has(> svg:not(:only-child)) > svg {
|
|
231
|
+
margin-inline-start: spacing.$spacing-03;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|