@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
|
+
@use '@carbon/styles/scss/utilities/focus-outline';
|
|
13
|
+
|
|
14
|
+
@use '../label';
|
|
15
|
+
|
|
16
|
+
@use '../../layout';
|
|
17
|
+
@use '../../utilities/icons';
|
|
18
|
+
|
|
19
|
+
$config: () !default;
|
|
20
|
+
|
|
21
|
+
$-default-config: (
|
|
22
|
+
selector: 'label:has(input[type="checkbox"])',
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
/// @group checkbox
|
|
26
|
+
/// @param {Map} config [()]
|
|
27
|
+
/// @param {Selector} config.selector ['label:has(input[type="checkbox"])']
|
|
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: 'inline',
|
|
35
|
+
));
|
|
36
|
+
|
|
37
|
+
justify-content: start;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
|
|
40
|
+
& input[type="checkbox"] {
|
|
41
|
+
grid-column: 1;
|
|
42
|
+
position: relative;
|
|
43
|
+
appearance: none;
|
|
44
|
+
border: none;
|
|
45
|
+
block-size: 1rem;
|
|
46
|
+
inline-size: 1rem;
|
|
47
|
+
color: theme.$icon-primary;
|
|
48
|
+
border-radius: 0.125rem;
|
|
49
|
+
|
|
50
|
+
&:focus {
|
|
51
|
+
@include focus-outline.focus-outline('outline');
|
|
52
|
+
outline-offset: 0.125rem;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&:disabled {
|
|
56
|
+
color: theme.$icon-disabled;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&::before {
|
|
60
|
+
content: '';
|
|
61
|
+
position: absolute;
|
|
62
|
+
inset: 0;
|
|
63
|
+
@include icons.checkbox;
|
|
64
|
+
scale: 1.25;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&:checked::before {
|
|
68
|
+
@include icons.checkbox--checked--filled;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&:indeterminate::before {
|
|
72
|
+
@include icons.checkbox--indeterminate--filled;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
|
|
13
|
+
@use '../../layout';
|
|
14
|
+
|
|
15
|
+
$config: () !default;
|
|
16
|
+
|
|
17
|
+
$-default-config: (
|
|
18
|
+
selector: 'code',
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
/// @group code
|
|
22
|
+
/// @param {Map} config [()]
|
|
23
|
+
/// @param {Selector} config.selector ['code']
|
|
24
|
+
@mixin styles($config: $config) {
|
|
25
|
+
$props: map.deep-merge($-default-config, $config);
|
|
26
|
+
|
|
27
|
+
#{map.get($props, 'selector')} {
|
|
28
|
+
@include layout.mode--code;
|
|
29
|
+
background-color: theme.$layer;
|
|
30
|
+
padding-inline: spacing.$spacing-01;
|
|
31
|
+
border-radius: 0.0625rem;
|
|
32
|
+
box-shadow: 0 0 0 0.125rem theme.$layer;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
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 '../../utilities/icons';
|
|
15
|
+
|
|
16
|
+
$config: () !default;
|
|
17
|
+
|
|
18
|
+
$-default-config: (
|
|
19
|
+
selector: 'label:has(input[type="text"][list])',
|
|
20
|
+
axis: 'block',
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
/// @group combo-box
|
|
24
|
+
/// @param {Map} config [()]
|
|
25
|
+
/// @param {Selector} config.selector ['label:has(input[type="text"][list])']
|
|
26
|
+
/// @param {'block' | 'inline'} config.axis ['block']
|
|
27
|
+
@mixin styles($config: $config) {
|
|
28
|
+
$props: map.deep-merge($-default-config, $config);
|
|
29
|
+
|
|
30
|
+
#{map.get($props, 'selector')} {
|
|
31
|
+
@include labelled-input.styles((
|
|
32
|
+
label: (
|
|
33
|
+
selector: '&',
|
|
34
|
+
axis: map.get($props, 'axis'),
|
|
35
|
+
),
|
|
36
|
+
input: (
|
|
37
|
+
selector: 'input[type="text"][list]',
|
|
38
|
+
emit-readonly: false,
|
|
39
|
+
),
|
|
40
|
+
fixed-input-trailing-slots: 1,
|
|
41
|
+
input-invalid-slot: 'after',
|
|
42
|
+
));
|
|
43
|
+
|
|
44
|
+
&::before {
|
|
45
|
+
@include labelled-input.input-trailing-slot {
|
|
46
|
+
@include icons.chevron--down;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
& input[type="text"][list] {
|
|
51
|
+
&:enabled:hover {
|
|
52
|
+
background-color: theme.$field-hover;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&:enabled:active {
|
|
56
|
+
background-color: theme.$layer-active;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@if map.get($props, 'axis') == 'inline' {
|
|
60
|
+
&:enabled,
|
|
61
|
+
&:disabled {
|
|
62
|
+
background-color: transparent;
|
|
63
|
+
border-block-end: none;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -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="date"])',
|
|
18
|
+
axis: 'block',
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
/// @group date-input
|
|
22
|
+
/// @param {Map} config [()]
|
|
23
|
+
/// @param {Selector} config.selector ['label:has(input[type="date"])']
|
|
24
|
+
/// @param {'block' | 'inline'} 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="date"]',
|
|
36
|
+
),
|
|
37
|
+
fixed-input-trailing-slots: 1,
|
|
38
|
+
input-invalid-slot: 'after',
|
|
39
|
+
));
|
|
40
|
+
|
|
41
|
+
&::before {
|
|
42
|
+
@include labelled-input.input-trailing-slot {
|
|
43
|
+
@include icons.calendar;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -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="datetime-local"])',
|
|
18
|
+
axis: 'block',
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
/// @group date-time-input
|
|
22
|
+
/// @param {Map} config [()]
|
|
23
|
+
/// @param {Selector} config.selector ['label:has(input[type="datetime-local"])']
|
|
24
|
+
/// @param {'block' | 'inline'} 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="datetime-local"]',
|
|
36
|
+
),
|
|
37
|
+
fixed-input-trailing-slots: 1,
|
|
38
|
+
input-invalid-slot: 'after',
|
|
39
|
+
));
|
|
40
|
+
|
|
41
|
+
&::before {
|
|
42
|
+
@include labelled-input.input-trailing-slot {
|
|
43
|
+
@include icons.event--schedule;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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/components/tag/tokens' as tag-tokens;
|
|
12
|
+
|
|
13
|
+
@use '../../layout';
|
|
14
|
+
|
|
15
|
+
$config: () !default;
|
|
16
|
+
|
|
17
|
+
$-default-config: (
|
|
18
|
+
selector: 'del',
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
/// @group deleted-text
|
|
22
|
+
/// @param {Map} config [()]
|
|
23
|
+
/// @param {Selector} config.selector ['del']
|
|
24
|
+
@mixin styles($config: $config) {
|
|
25
|
+
$props: map.deep-merge($-default-config, $config);
|
|
26
|
+
|
|
27
|
+
#{map.get($props, 'selector')} {
|
|
28
|
+
padding-inline: spacing.$spacing-01;
|
|
29
|
+
background-color: tag-tokens.$tag-background-red;
|
|
30
|
+
color: tag-tokens.$tag-color-red;
|
|
31
|
+
text-decoration: line-through;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
|
|
12
|
+
@use '../../layout';
|
|
13
|
+
|
|
14
|
+
$config: () !default;
|
|
15
|
+
|
|
16
|
+
$-default-config: (
|
|
17
|
+
selector: 'dl',
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
/// @group description-list
|
|
21
|
+
/// @param {Map} config [()]
|
|
22
|
+
/// @param {Selector} config.selector ['dl']
|
|
23
|
+
@mixin styles($config: $config) {
|
|
24
|
+
$props: map.deep-merge($-default-config, $config);
|
|
25
|
+
|
|
26
|
+
#{map.get($props, 'selector')} {
|
|
27
|
+
display: grid;
|
|
28
|
+
grid-template-columns: max-content 1fr;
|
|
29
|
+
column-gap: spacing.$spacing-04;
|
|
30
|
+
row-gap: layout.$density--padding;
|
|
31
|
+
|
|
32
|
+
& dt {
|
|
33
|
+
@include layout.mode--heading;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
& dd {
|
|
37
|
+
@include layout.mode--body;
|
|
38
|
+
max-inline-size: layout.$mode--max-inline-size;
|
|
39
|
+
margin-inline-start: 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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/utilities/focus-outline';
|
|
12
|
+
|
|
13
|
+
@use '../../layout';
|
|
14
|
+
@use '../../utilities/icons';
|
|
15
|
+
|
|
16
|
+
$config: () !default;
|
|
17
|
+
|
|
18
|
+
$-default-config: (
|
|
19
|
+
selector: 'details',
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
/// @group details
|
|
23
|
+
/// @param {Map} config [()]
|
|
24
|
+
/// @param {Selector} config.selector ['details']
|
|
25
|
+
@mixin styles($config: $config) {
|
|
26
|
+
$props: map.deep-merge($-default-config, $config);
|
|
27
|
+
|
|
28
|
+
#{map.get($props, 'selector')} {
|
|
29
|
+
border-block-start: 0.0625rem solid theme.$border-subtle;
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
padding-inline-start: calc(layout.$density--padding + 1rem + layout.$density--padding);
|
|
32
|
+
padding-inline-end: layout.$density--padding;
|
|
33
|
+
|
|
34
|
+
&:last-of-type {
|
|
35
|
+
border-block-end: 0.0625rem solid theme.$border-subtle;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
& summary {
|
|
39
|
+
@include layout.mode--body-compact;
|
|
40
|
+
block-size: layout.$size--block-size;
|
|
41
|
+
box-sizing: border-box;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
display: flex;
|
|
44
|
+
padding-block-start: layout.$size--padding-block-start;
|
|
45
|
+
padding-block-end: layout.$size--padding-block-end;
|
|
46
|
+
margin-inline-start: calc((layout.$density--padding + 1rem + layout.$density--padding) * -1);
|
|
47
|
+
padding-inline-start: layout.$density--padding;
|
|
48
|
+
margin-inline-end: calc(layout.$density--padding * -1);
|
|
49
|
+
padding-inline-end: layout.$density--padding;
|
|
50
|
+
|
|
51
|
+
&:hover {
|
|
52
|
+
background-color: theme.$layer-hover;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&:active {
|
|
56
|
+
background-color: theme.$layer-active;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:focus {
|
|
60
|
+
@include focus-outline.focus-outline('outline');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
& summary::before {
|
|
65
|
+
content: '';
|
|
66
|
+
@include icons.chevron--down;
|
|
67
|
+
translate: 0 calc((1lh - 1rem) * 0.5);
|
|
68
|
+
display: inline-block;
|
|
69
|
+
margin-inline-end: layout.$density--padding;
|
|
70
|
+
transition: rotate layout.$mode--transition-duration layout.$mode--transition-timing-function;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&[open] {
|
|
74
|
+
padding-block-end: layout.$density--padding;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&[open] summary {
|
|
78
|
+
margin-block-end: layout.$density--padding;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&[open] summary::before {
|
|
82
|
+
rotate: 180deg;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
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/breakpoint';
|
|
13
|
+
@use '@carbon/styles/scss/motion';
|
|
14
|
+
@use '@carbon/styles/scss/utilities/focus-outline';
|
|
15
|
+
@use '@carbon/styles/scss/layer/layer-tokens';
|
|
16
|
+
|
|
17
|
+
@use '../button';
|
|
18
|
+
|
|
19
|
+
@use '../../layout';
|
|
20
|
+
@use '../../utilities/icons';
|
|
21
|
+
|
|
22
|
+
$config: () !default;
|
|
23
|
+
|
|
24
|
+
$-default-config: (
|
|
25
|
+
selector: 'dialog',
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
/// @group dialog
|
|
29
|
+
/// @param {Map} config [()]
|
|
30
|
+
/// @param {Selector} config.selector ['dialog']
|
|
31
|
+
@mixin styles($config: $config) {
|
|
32
|
+
$props: map.deep-merge($-default-config, $config);
|
|
33
|
+
|
|
34
|
+
#{map.get($props, 'selector')} {
|
|
35
|
+
position: relative;
|
|
36
|
+
padding: 0;
|
|
37
|
+
|
|
38
|
+
&:modal {
|
|
39
|
+
@include layout.size('md');
|
|
40
|
+
@include layout.density('normal');
|
|
41
|
+
|
|
42
|
+
background-color: theme.$layer;
|
|
43
|
+
color: theme.$text-primary;
|
|
44
|
+
border: none;
|
|
45
|
+
padding-inline: layout.$density--padding;
|
|
46
|
+
box-shadow: none;
|
|
47
|
+
margin: auto;
|
|
48
|
+
box-sizing: border-box;
|
|
49
|
+
|
|
50
|
+
&:focus {
|
|
51
|
+
@include focus-outline.focus-outline('outline');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@include breakpoint.breakpoint('xlg') {
|
|
55
|
+
inline-size: 48%;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@include breakpoint.breakpoint-down('xlg') {
|
|
59
|
+
inline-size: 60%;
|
|
60
|
+
max-block-size: 84%;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@include breakpoint.breakpoint-down('lg') {
|
|
64
|
+
inline-size: 84%;
|
|
65
|
+
max-block-size: 90%;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@include breakpoint.breakpoint-down('md') {
|
|
69
|
+
inline-size: 100%;
|
|
70
|
+
block-size: 100%;
|
|
71
|
+
max-inline-size: 100dvi;
|
|
72
|
+
max-block-size: 100dvb;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&:modal::backdrop {
|
|
77
|
+
background-color: theme.$overlay;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&:modal header {
|
|
81
|
+
@include layout.mode--heading-level-5;
|
|
82
|
+
margin-block: layout.$density--padding;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&:modal footer {
|
|
86
|
+
@include layout.size('xl');
|
|
87
|
+
display: grid;
|
|
88
|
+
grid-template-columns: repeat(4, 1fr);
|
|
89
|
+
margin-inline: calc(layout.$density--padding * -1);
|
|
90
|
+
margin-block-start: spacing.$spacing-09;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&:modal:not(:has(footer)) {
|
|
94
|
+
padding-block-end: spacing.$spacing-09;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// single button
|
|
98
|
+
&:modal footer > button:only-child {
|
|
99
|
+
grid-column: 3 / span 2;
|
|
100
|
+
@include button.styles((
|
|
101
|
+
selector: '&',
|
|
102
|
+
kind: 'primary',
|
|
103
|
+
));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// two buttons
|
|
107
|
+
&:modal footer > button:first-child:has(+ button:last-child) {
|
|
108
|
+
grid-column: 1 / span 2;
|
|
109
|
+
@include button.styles((
|
|
110
|
+
selector: '&',
|
|
111
|
+
kind: 'secondary',
|
|
112
|
+
));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&:modal footer > button:first-child + button:last-child {
|
|
116
|
+
grid-column: 3 / span 2;
|
|
117
|
+
@include button.styles((
|
|
118
|
+
selector: '&',
|
|
119
|
+
kind: 'primary',
|
|
120
|
+
));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// three buttons
|
|
124
|
+
&:modal footer > button:first-child:not(:has(+ button:last-child), :last-child) {
|
|
125
|
+
grid-column: 1;
|
|
126
|
+
@include button.styles((
|
|
127
|
+
selector: '&',
|
|
128
|
+
kind: 'ghost',
|
|
129
|
+
));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&:modal footer > button:not(:first-child):has(+ button:last-child) {
|
|
133
|
+
grid-column: 3;
|
|
134
|
+
@include button.styles((
|
|
135
|
+
selector: '&',
|
|
136
|
+
kind: 'secondary',
|
|
137
|
+
));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&:modal footer > button:not(:first-child) + button:last-child {
|
|
141
|
+
grid-column: 4;
|
|
142
|
+
@include button.styles((
|
|
143
|
+
selector: '&',
|
|
144
|
+
kind: 'primary',
|
|
145
|
+
));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// header close button
|
|
149
|
+
&:modal header > button {
|
|
150
|
+
position: absolute;
|
|
151
|
+
inset-block-start: 0;
|
|
152
|
+
inset-inline-end: 0;
|
|
153
|
+
appearance: none;
|
|
154
|
+
box-shadow: none;
|
|
155
|
+
border: none;
|
|
156
|
+
border-radius: 0;
|
|
157
|
+
padding: 0;
|
|
158
|
+
background-color: transparent;
|
|
159
|
+
color: theme.$icon-primary;
|
|
160
|
+
block-size: layout.$size--block-size;
|
|
161
|
+
inline-size: layout.$size--block-size;
|
|
162
|
+
display: flex;
|
|
163
|
+
align-items: center;
|
|
164
|
+
justify-content: center;
|
|
165
|
+
cursor: pointer;
|
|
166
|
+
transition: background-color layout.$mode--transition-duration layout.$mode--transition-timing-function;
|
|
167
|
+
|
|
168
|
+
&:hover {
|
|
169
|
+
background-color: theme.$layer-hover;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&:active {
|
|
173
|
+
background-color: theme.$layer-active;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
&:focus {
|
|
177
|
+
@include focus-outline.focus-outline('outline');
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
&:modal header > button::after {
|
|
182
|
+
@include icons.close($size: 1.25rem);
|
|
183
|
+
display: block;
|
|
184
|
+
inset: 0;
|
|
185
|
+
content: '';
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// entry animation
|
|
189
|
+
&[open]:modal {
|
|
190
|
+
translate: 0 0;
|
|
191
|
+
opacity: 1;
|
|
192
|
+
transition-property: opacity, translate;
|
|
193
|
+
transition-duration: motion.$duration-moderate-02;
|
|
194
|
+
transition-timing-function: layout.$mode--transition-timing-function;
|
|
195
|
+
|
|
196
|
+
@starting-style {
|
|
197
|
+
opacity: 0;
|
|
198
|
+
translate: 0 -1.5rem;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
&[open]:modal::backdrop {
|
|
203
|
+
opacity: 1;
|
|
204
|
+
transition: inherit;
|
|
205
|
+
|
|
206
|
+
@starting-style {
|
|
207
|
+
opacity: 0;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
|
|
12
|
+
@use '../label';
|
|
13
|
+
|
|
14
|
+
@use '../../layout';
|
|
15
|
+
|
|
16
|
+
$config: () !default;
|
|
17
|
+
|
|
18
|
+
$-default-config: (
|
|
19
|
+
selector: 'fieldset',
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
/// @group fieldset
|
|
23
|
+
/// @param {Map} config [()]
|
|
24
|
+
/// @param {Selector} config.selector ['fieldset']
|
|
25
|
+
@mixin styles($config: $config) {
|
|
26
|
+
$props: map.deep-merge($-default-config, $config);
|
|
27
|
+
|
|
28
|
+
#{map.get($props, 'selector')} {
|
|
29
|
+
border: none;
|
|
30
|
+
padding: 0;
|
|
31
|
+
margin-block: layout.$mode--margin-block;
|
|
32
|
+
|
|
33
|
+
& legend {
|
|
34
|
+
@include label.styles((
|
|
35
|
+
selector: '&',
|
|
36
|
+
));
|
|
37
|
+
padding: 0;
|
|
38
|
+
margin-block-end: spacing.$spacing-03;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|