@carbon/styles 1.75.0 → 1.76.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/css/styles.css +217 -1
- package/css/styles.min.css +1 -1
- package/package.json +8 -8
- package/scss/__tests__/__snapshots__/config-test.js.snap +1 -0
- package/scss/__tests__/__snapshots__/type-test.js.snap +4539 -1464
- package/scss/__tests__/config-test.js +3 -0
- package/scss/__tests__/type-test.js +21 -2
- package/scss/_config.scss +6 -0
- package/scss/components/fluid-text-area/_fluid-text-area.scss +6 -0
- package/scss/components/tabs/_tabs.scss +2 -0
- package/scss/components/treeview/_treeview.scss +19 -0
- package/scss/type/_index.scss +24 -0
|
@@ -33,12 +33,14 @@ describe('@carbon/styles/scss/config', () => {
|
|
|
33
33
|
$css--font-face: false,
|
|
34
34
|
$css--reset: false,
|
|
35
35
|
$css--default-type: false,
|
|
36
|
+
$css--emit-type-custom-props: false
|
|
36
37
|
);
|
|
37
38
|
|
|
38
39
|
$_: get('config', (
|
|
39
40
|
css--default-type: config.$css--default-type,
|
|
40
41
|
css--font-face: config.$css--font-face,
|
|
41
42
|
css--reset: config.$css--reset,
|
|
43
|
+
css--emit-type-custom-props: config.$css--emit-type-custom-props,
|
|
42
44
|
prefix: config.$prefix,
|
|
43
45
|
));
|
|
44
46
|
`);
|
|
@@ -47,6 +49,7 @@ describe('@carbon/styles/scss/config', () => {
|
|
|
47
49
|
'css--default-type': false,
|
|
48
50
|
'css--font-face': false,
|
|
49
51
|
'css--reset': false,
|
|
52
|
+
'css--emit-type-custom-props': false,
|
|
50
53
|
prefix: 'test',
|
|
51
54
|
});
|
|
52
55
|
});
|
|
@@ -130,8 +130,8 @@ describe('@carbon/styles/scss/type', () => {
|
|
|
130
130
|
const { stylesheet } = css.parse(result.css.toString());
|
|
131
131
|
const [rule] = stylesheet.rules;
|
|
132
132
|
for (const declaration of rule.declarations) {
|
|
133
|
-
expect(declaration.
|
|
134
|
-
expect.stringContaining('
|
|
133
|
+
expect(declaration.property).toEqual(
|
|
134
|
+
expect.stringContaining('--custom-')
|
|
135
135
|
);
|
|
136
136
|
}
|
|
137
137
|
});
|
|
@@ -150,3 +150,22 @@ describe('@carbon/styles/scss/type', () => {
|
|
|
150
150
|
expect(stylesheet).toMatchSnapshot();
|
|
151
151
|
});
|
|
152
152
|
});
|
|
153
|
+
|
|
154
|
+
describe('type custom properties', () => {
|
|
155
|
+
it('should emit the css Custom properties for non-fluid typography', async () => {
|
|
156
|
+
const { result } = await render(`
|
|
157
|
+
@use '../scss/type' as *;
|
|
158
|
+
|
|
159
|
+
.selector {
|
|
160
|
+
@include emit-type-custom-properties()
|
|
161
|
+
}
|
|
162
|
+
`);
|
|
163
|
+
const { stylesheet } = css.parse(result.css.toString());
|
|
164
|
+
const rules = stylesheet.rules.filter(
|
|
165
|
+
(rule) => rule.selectors[0] === '.selector'
|
|
166
|
+
);
|
|
167
|
+
const declarations = rules[0].declarations;
|
|
168
|
+
|
|
169
|
+
expect(declarations.length).toBe(191);
|
|
170
|
+
});
|
|
171
|
+
});
|
package/scss/_config.scss
CHANGED
|
@@ -18,6 +18,12 @@ $css--body: true !default;
|
|
|
18
18
|
/// @group config
|
|
19
19
|
$css--font-face: true !default;
|
|
20
20
|
|
|
21
|
+
/// If true, emit the custom type properties in in :root
|
|
22
|
+
/// @access public
|
|
23
|
+
/// @type Bool
|
|
24
|
+
/// @group config
|
|
25
|
+
$css--emit-type-custom-props: true !default;
|
|
26
|
+
|
|
21
27
|
/// If true, include reset CSS
|
|
22
28
|
/// @access public
|
|
23
29
|
/// @type Bool
|
|
@@ -57,6 +57,12 @@
|
|
|
57
57
|
inset-inline-end: $spacing-05;
|
|
58
58
|
inset-inline-start: auto;
|
|
59
59
|
}
|
|
60
|
+
.#{$prefix}--toggletip-button {
|
|
61
|
+
padding: $spacing-02;
|
|
62
|
+
margin-inline-start: -$spacing-02;
|
|
63
|
+
min-block-size: $spacing-06;
|
|
64
|
+
min-inline-size: $spacing-06;
|
|
65
|
+
}
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
.#{$prefix}--text-area--fluid .#{$prefix}--label::-webkit-scrollbar,
|
|
@@ -522,6 +522,8 @@
|
|
|
522
522
|
//-----------------------------
|
|
523
523
|
// Icon Item
|
|
524
524
|
//-----------------------------
|
|
525
|
+
&.#{$prefix}--tabs__icon--default,
|
|
526
|
+
&.#{$prefix}--tabs__icon--lg,
|
|
525
527
|
&.#{$prefix}--tabs__icon--default .#{$prefix}--tab--list,
|
|
526
528
|
&.#{$prefix}--tabs__icon--lg .#{$prefix}--tab--list {
|
|
527
529
|
overflow-x: visible;
|
|
@@ -88,6 +88,25 @@
|
|
|
88
88
|
cursor: not-allowed;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
// Overrides link styling
|
|
92
|
+
li a.#{$prefix}--tree-node {
|
|
93
|
+
text-decoration: none;
|
|
94
|
+
|
|
95
|
+
&:not(.cds--tree-node--disabled) {
|
|
96
|
+
color: $text-secondary;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
li.#{$prefix}--tree-node-link-parent {
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: column;
|
|
103
|
+
background-color: $layer-01;
|
|
104
|
+
|
|
105
|
+
> .#{$prefix}--tree-node__children {
|
|
106
|
+
padding-inline-start: $spacing-05;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
91
110
|
.#{$prefix}--tree-node__label {
|
|
92
111
|
@include type-style('body-compact-01');
|
|
93
112
|
|
package/scss/type/_index.scss
CHANGED
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
+
@use '../feature-flags' as *;
|
|
8
9
|
@use '../config';
|
|
10
|
+
@use 'sass:string';
|
|
11
|
+
@use 'sass:map';
|
|
9
12
|
|
|
10
13
|
// prettier-ignore
|
|
11
14
|
@forward '@carbon/type' show
|
|
@@ -90,3 +93,24 @@
|
|
|
90
93
|
custom-property-prefix: config.$prefix,
|
|
91
94
|
)
|
|
92
95
|
);
|
|
96
|
+
|
|
97
|
+
// output type custom properties used by non-fluid type-style below
|
|
98
|
+
/// @access public
|
|
99
|
+
/// @group @carbon/type
|
|
100
|
+
@mixin emit-type-custom-properties() {
|
|
101
|
+
@each $name, $token in type.$tokens {
|
|
102
|
+
@if string.slice($name, 1, 5) != 'fluid' {
|
|
103
|
+
@each $property, $value in $token {
|
|
104
|
+
@if $property != 'breakpoints' {
|
|
105
|
+
--#{config.$prefix}-#{$name}-#{$property}: #{$value};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@if config.$css--emit-type-custom-props == true {
|
|
113
|
+
:root {
|
|
114
|
+
@include emit-type-custom-properties();
|
|
115
|
+
}
|
|
116
|
+
}
|