@carbon/styles 0.17.0 → 1.0.0-rc.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.
Files changed (99) hide show
  1. package/package.json +23 -10
  2. package/scss/__tests__/__snapshots__/colors-test.js.snap +404 -0
  3. package/scss/__tests__/__snapshots__/config-test.js.snap +44 -0
  4. package/scss/__tests__/__snapshots__/motion-test.js.snap +39 -0
  5. package/scss/__tests__/breakpoint-test.js +42 -0
  6. package/scss/__tests__/colors-test.js +28 -0
  7. package/scss/__tests__/config-test.js +53 -0
  8. package/scss/__tests__/grid-test.js +48 -0
  9. package/scss/__tests__/layer-test.js +82 -0
  10. package/scss/__tests__/motion-test.js +37 -0
  11. package/scss/__tests__/reset-test.js +28 -0
  12. package/scss/__tests__/theme-test.js +151 -0
  13. package/scss/__tests__/themes-test.js +36 -0
  14. package/scss/__tests__/type-test.js +77 -0
  15. package/scss/_breakpoint.scss +2 -1
  16. package/scss/_config.scss +9 -2
  17. package/scss/_spacing.scss +1 -1
  18. package/scss/_theme.scss +4 -4
  19. package/scss/_themes.scss +2 -1
  20. package/scss/components/__tests__/accordion-test.js +47 -0
  21. package/scss/components/__tests__/breadcrumb-test.js +27 -0
  22. package/scss/components/__tests__/button-test.js +71 -0
  23. package/scss/components/__tests__/checkbox-test.js +27 -0
  24. package/scss/components/__tests__/code-snippet-test.js +44 -0
  25. package/scss/components/__tests__/combo-box-test.js +27 -0
  26. package/scss/components/__tests__/content-switcher-test.js +27 -0
  27. package/scss/components/__tests__/copy-button-test.js +27 -0
  28. package/scss/components/__tests__/data-table-test.js +85 -0
  29. package/scss/components/__tests__/date-picker-test.js +26 -0
  30. package/scss/components/__tests__/dropdown-test.js +27 -0
  31. package/scss/components/__tests__/file-uploader.js +27 -0
  32. package/scss/components/__tests__/form-test.js +43 -0
  33. package/scss/components/__tests__/inline-loading-test.js +26 -0
  34. package/scss/components/__tests__/link-test.js +26 -0
  35. package/scss/components/__tests__/list-box-test.js +36 -0
  36. package/scss/components/__tests__/list-test.js +26 -0
  37. package/scss/components/__tests__/loading-test.js +26 -0
  38. package/scss/components/__tests__/menu-test.js +27 -0
  39. package/scss/components/__tests__/modal-test.js +27 -0
  40. package/scss/components/__tests__/multiselect-test.js +27 -0
  41. package/scss/components/__tests__/notification-test.js +49 -0
  42. package/scss/components/__tests__/number-input-test.js +27 -0
  43. package/scss/components/__tests__/overflow-menu-test.js +27 -0
  44. package/scss/components/__tests__/pagination-nav-test.js +26 -0
  45. package/scss/components/__tests__/pagination-test.js +26 -0
  46. package/scss/components/__tests__/progress-bar-test.js +26 -0
  47. package/scss/components/__tests__/progress-indicator-test.js +26 -0
  48. package/scss/components/__tests__/radio-button-test.js +25 -0
  49. package/scss/components/__tests__/search-test.js +25 -0
  50. package/scss/components/__tests__/select-test.js +26 -0
  51. package/scss/components/__tests__/skeleton-test.js +26 -0
  52. package/scss/components/__tests__/slider-test.js +26 -0
  53. package/scss/components/__tests__/structured-list-test.js +27 -0
  54. package/scss/components/__tests__/tabs-test.js +27 -0
  55. package/scss/components/__tests__/tag-test.js +25 -0
  56. package/scss/components/__tests__/text-area-test.js +26 -0
  57. package/scss/components/__tests__/text-input-test.js +26 -0
  58. package/scss/components/__tests__/tile-test.js +26 -0
  59. package/scss/components/__tests__/time-picker-test.js +26 -0
  60. package/scss/components/__tests__/toggle-test.js +27 -0
  61. package/scss/components/__tests__/tooltip-test.js +25 -0
  62. package/scss/components/__tests__/treeview-test.js +25 -0
  63. package/scss/components/__tests__/ui-shell-test.js +27 -0
  64. package/scss/components/accordion/_accordion.scss +1 -1
  65. package/scss/components/aspect-ratio/_aspect-ratio.scss +2 -2
  66. package/scss/components/breadcrumb/_breadcrumb.scss +1 -1
  67. package/scss/components/button/_button.scss +1 -5
  68. package/scss/components/button/_tokens.scss +1 -0
  69. package/scss/components/code-snippet/_code-snippet.scss +32 -47
  70. package/scss/components/content-switcher/_content-switcher.scss +0 -2
  71. package/scss/components/copy-button/_copy-button.scss +0 -59
  72. package/scss/components/dropdown/_dropdown.scss +0 -1
  73. package/scss/components/modal/_modal.scss +1 -1
  74. package/scss/components/notification/_actionable-notification.scss +58 -19
  75. package/scss/components/notification/_inline-notification.scss +9 -21
  76. package/scss/components/notification/_toast-notification.scss +29 -58
  77. package/scss/components/notification/_tokens.scss +2 -1
  78. package/scss/components/pagination/_unstable_pagination.scss +1 -1
  79. package/scss/components/progress-indicator/_progress-indicator.scss +5 -5
  80. package/scss/components/radio-button/_radio-button.scss +2 -10
  81. package/scss/components/tabs/_tabs.scss +1 -1
  82. package/scss/components/tag/_tokens.scss +1 -0
  83. package/scss/components/text-input/_text-input.scss +7 -22
  84. package/scss/components/tile/_tile.scss +60 -29
  85. package/scss/components/toggletip/_toggletip.scss +1 -2
  86. package/scss/fonts/__tests__/__snapshots__/fonts-test.js.snap +269 -0
  87. package/scss/fonts/__tests__/fonts-test.js +197 -0
  88. package/scss/fonts/_src.scss +42 -31
  89. package/scss/grid/_css-grid.scss +11 -0
  90. package/scss/grid/_flexbox.scss +1 -1
  91. package/scss/grid/_index.scss +7 -2
  92. package/scss/grid/_mixins.scss +9 -0
  93. package/scss/type/_reset.scss +1 -1
  94. package/scss/utilities/__tests__/custom-property-test.js +50 -0
  95. package/scss/utilities/_component-tokens.scss +2 -1
  96. package/scss/utilities/_convert.scss +2 -4
  97. package/scss/utilities/_high-contrast-mode.scss +2 -4
  98. package/docs/sass.md +0 -462
  99. package/scss/grid/_config.scss +0 -18
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
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
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('@carbon/styles/scss/grid', () => {
17
+ test('Public API', async () => {
18
+ const { get } = await render(`
19
+ @use 'sass:meta';
20
+ @use '../grid' as *;
21
+
22
+ $_: get('api', (
23
+ variables: (
24
+ grid-gutter: meta.variable-exists('grid-gutter'),
25
+ grid-gutter-condensed: meta.variable-exists('grid-gutter-condensed'),
26
+ grid-breakpoints: meta.variable-exists('grid-breakpoints'),
27
+ ),
28
+ mixins: (
29
+ css-grid: meta.mixin-exists('css-grid'),
30
+ flex-grid: meta.mixin-exists('flex-grid'),
31
+ ),
32
+ ));
33
+ `);
34
+
35
+ const { value: api } = get('api');
36
+ expect(api).toEqual({
37
+ variables: {
38
+ 'grid-gutter': true,
39
+ 'grid-gutter-condensed': true,
40
+ 'grid-breakpoints': true,
41
+ },
42
+ mixins: {
43
+ 'css-grid': true,
44
+ 'flex-grid': true,
45
+ },
46
+ });
47
+ });
48
+ });
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
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
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+ const css = require('css');
14
+
15
+ const { render } = SassRenderer.create(__dirname);
16
+
17
+ describe('scss/layer', () => {
18
+ it('should map layer set values to scoped $prefix--layer selectors', async () => {
19
+ const { result } = await render(`
20
+ @use '../config' with (
21
+ $prefix: 'cds',
22
+ );
23
+ @use '../layer' with (
24
+ $layer-sets: (
25
+ field: (
26
+ rgba(0, 0, 0, 0.3),
27
+ rgba(0, 0, 0, 0.2),
28
+ rgba(0, 0, 0, 0.1),
29
+ ),
30
+ background: (
31
+ rgba(0, 0, 0, 0.8),
32
+ rgba(0, 0, 0, 0.7),
33
+ rgba(0, 0, 0, 0.6),
34
+ ),
35
+ )
36
+ );
37
+ `);
38
+ const { stylesheet } = css.parse(result.css.toString());
39
+
40
+ function findSelector(stylesheet, matcher) {
41
+ return stylesheet.rules.find((rule) => {
42
+ return rule.selectors.some((selector) => {
43
+ return selector.includes(matcher);
44
+ });
45
+ });
46
+ }
47
+
48
+ function findDeclaration(rule, property) {
49
+ return rule.declarations.find((declaration) => {
50
+ return declaration.property.includes(property);
51
+ });
52
+ }
53
+
54
+ const root = findSelector(stylesheet, ':root');
55
+ const layer1 = findSelector(stylesheet, '.cds--layer-one');
56
+ const layer2 = findSelector(stylesheet, '.cds--layer-two');
57
+ const layer3 = findSelector(stylesheet, '.cds--layer-three');
58
+
59
+ expect(findDeclaration(root, '--cds-field').value).toBe(
60
+ 'rgba(0, 0, 0, 0.3)'
61
+ );
62
+ expect(findDeclaration(layer1, '--cds-field').value).toBe(
63
+ 'rgba(0, 0, 0, 0.3)'
64
+ );
65
+ expect(findDeclaration(layer2, '--cds-field').value).toBe(
66
+ 'rgba(0, 0, 0, 0.2)'
67
+ );
68
+ expect(findDeclaration(layer3, '--cds-field').value).toBe(
69
+ 'rgba(0, 0, 0, 0.1)'
70
+ );
71
+
72
+ expect(findDeclaration(layer1, '--cds-background').value).toBe(
73
+ 'rgba(0, 0, 0, 0.8)'
74
+ );
75
+ expect(findDeclaration(layer2, '--cds-background').value).toBe(
76
+ 'rgba(0, 0, 0, 0.7)'
77
+ );
78
+ expect(findDeclaration(layer3, '--cds-background').value).toBe(
79
+ 'rgba(0, 0, 0, 0.6)'
80
+ );
81
+ });
82
+ });
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
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
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('@carbon/styles/scss/motion', () => {
17
+ test('Public API', async () => {
18
+ const { get } = await render(`
19
+ @use 'sass:meta';
20
+ @use '../motion';
21
+
22
+ $_: get('api', (
23
+ variables: meta.module-variables('motion'),
24
+ functions: (
25
+ motion: meta.function-exists('motion', 'motion'),
26
+ ),
27
+ mixins: (
28
+ motion: meta.mixin-exists('motion', 'motion'),
29
+ ),
30
+ ));
31
+ `);
32
+
33
+ const { value: api } = get('api');
34
+
35
+ expect(api).toMatchSnapshot();
36
+ });
37
+ });
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
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
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('@carbon/styles/scss/reset', () => {
17
+ test('Public API', async () => {
18
+ const { get } = await render(`
19
+ @use 'sass:meta';
20
+ @use '../reset';
21
+
22
+ $_: get('mixin', meta.mixin-exists('reset', 'reset'));
23
+ `);
24
+
25
+ const { value: mixin } = get('mixin');
26
+ expect(mixin).toBe(true);
27
+ });
28
+ });
@@ -0,0 +1,151 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
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
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('@carbon/styles/scss/theme', () => {
17
+ test('Public API', async () => {
18
+ const { get } = await render(`
19
+ @use 'sass:map';
20
+ @use 'sass:meta';
21
+ @use '../theme';
22
+
23
+ $_: get('api', (
24
+ variables: map.keys(meta.module-variables('theme')),
25
+ mixins: (
26
+ theme: meta.mixin-exists('theme', 'theme'),
27
+ ),
28
+ ));
29
+ `);
30
+
31
+ const { value: api } = get('api');
32
+ expect(api.mixins).toEqual({
33
+ theme: true,
34
+ });
35
+ expect(api.variables).toMatchInlineSnapshot(`
36
+ Array [
37
+ "fallback",
38
+ "theme",
39
+ "background",
40
+ "background-active",
41
+ "background-selected",
42
+ "background-selected-hover",
43
+ "background-hover",
44
+ "background-brand",
45
+ "background-inverse",
46
+ "background-inverse-hover",
47
+ "layer-01",
48
+ "layer-active-01",
49
+ "layer-hover-01",
50
+ "layer-selected-01",
51
+ "layer-selected-hover-01",
52
+ "layer-02",
53
+ "layer-active-02",
54
+ "layer-hover-02",
55
+ "layer-selected-02",
56
+ "layer-selected-hover-02",
57
+ "layer-03",
58
+ "layer-active-03",
59
+ "layer-hover-03",
60
+ "layer-selected-03",
61
+ "layer-selected-hover-03",
62
+ "layer-selected-inverse",
63
+ "layer-selected-disabled",
64
+ "layer-accent-01",
65
+ "layer-accent-active-01",
66
+ "layer-accent-hover-01",
67
+ "layer-accent-02",
68
+ "layer-accent-active-02",
69
+ "layer-accent-hover-02",
70
+ "layer-accent-03",
71
+ "layer-accent-active-03",
72
+ "layer-accent-hover-03",
73
+ "field-01",
74
+ "field-hover-01",
75
+ "field-02",
76
+ "field-hover-02",
77
+ "field-03",
78
+ "field-hover-03",
79
+ "interactive",
80
+ "border-subtle-00",
81
+ "border-subtle-01",
82
+ "border-subtle-selected-01",
83
+ "border-subtle-02",
84
+ "border-subtle-selected-02",
85
+ "border-subtle-03",
86
+ "border-subtle-selected-03",
87
+ "border-strong-01",
88
+ "border-strong-02",
89
+ "border-strong-03",
90
+ "border-inverse",
91
+ "border-interactive",
92
+ "border-disabled",
93
+ "text-primary",
94
+ "text-secondary",
95
+ "text-placeholder",
96
+ "text-helper",
97
+ "text-error",
98
+ "text-inverse",
99
+ "text-on-color",
100
+ "text-on-color-disabled",
101
+ "text-disabled",
102
+ "link-primary",
103
+ "link-primary-hover",
104
+ "link-secondary",
105
+ "link-visited",
106
+ "link-inverse",
107
+ "link-inverse-active",
108
+ "link-inverse-hover",
109
+ "icon-primary",
110
+ "icon-secondary",
111
+ "icon-inverse",
112
+ "icon-on-color",
113
+ "icon-on-color-disabled",
114
+ "icon-disabled",
115
+ "support-error",
116
+ "support-success",
117
+ "support-warning",
118
+ "support-info",
119
+ "support-error-inverse",
120
+ "support-success-inverse",
121
+ "support-warning-inverse",
122
+ "support-info-inverse",
123
+ "support-caution-major",
124
+ "support-caution-minor",
125
+ "support-caution-undefined",
126
+ "highlight",
127
+ "overlay",
128
+ "toggle-off",
129
+ "shadow",
130
+ "focus",
131
+ "focus-inset",
132
+ "focus-inverse",
133
+ "skeleton-background",
134
+ "skeleton-element",
135
+ "layer",
136
+ "layer-active",
137
+ "layer-hover",
138
+ "layer-selected",
139
+ "layer-selected-hover",
140
+ "layer-accent",
141
+ "layer-accent-hover",
142
+ "layer-accent-active",
143
+ "field",
144
+ "field-hover",
145
+ "border-subtle",
146
+ "border-subtle-selected",
147
+ "border-strong",
148
+ ]
149
+ `);
150
+ });
151
+ });
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
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
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('@carbon/styles/scss/themes', () => {
17
+ test('Public API', async () => {
18
+ const { get } = await render(`
19
+ @use 'sass:map';
20
+ @use 'sass:meta';
21
+ @use '../themes';
22
+
23
+ $_: get('api', map.keys(meta.module-variables('themes')));
24
+ `);
25
+
26
+ const { value: api } = get('api');
27
+ expect(api).toMatchInlineSnapshot(`
28
+ Array [
29
+ "white",
30
+ "g10",
31
+ "g90",
32
+ "g100",
33
+ ]
34
+ `);
35
+ });
36
+ });
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
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
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('@carbon/styles/scss/type', () => {
17
+ test('Public API', async () => {
18
+ const { get } = await render(`
19
+ @use 'sass:map';
20
+ @use 'sass:meta';
21
+ @use '../type';
22
+
23
+ $_: get('api', (
24
+ variables: map.keys(meta.module-variables('type')),
25
+ mixins: (
26
+ reset: meta.mixin-exists('reset', 'type'),
27
+ type-style: meta.mixin-exists('type-style', 'type'),
28
+ font-family: meta.mixin-exists('font-family', 'type'),
29
+ default-type: meta.mixin-exists('default-type', 'type'),
30
+ ),
31
+ ));
32
+ `);
33
+
34
+ const { value: api } = get('api');
35
+ expect(api.mixins).toEqual({
36
+ reset: true,
37
+ 'type-style': true,
38
+ 'font-family': true,
39
+ 'default-type': true,
40
+ });
41
+ expect(api.variables).toMatchInlineSnapshot(`
42
+ Array [
43
+ "label-01",
44
+ "helper-text-01",
45
+ "body-short-01",
46
+ "body-short-02",
47
+ "body-long-01",
48
+ "body-long-02",
49
+ "code-01",
50
+ "code-02",
51
+ "heading-01",
52
+ "heading-02",
53
+ "productive-heading-01",
54
+ "productive-heading-02",
55
+ "productive-heading-03",
56
+ "productive-heading-04",
57
+ "productive-heading-05",
58
+ "productive-heading-06",
59
+ "productive-heading-07",
60
+ "expressive-paragraph-01",
61
+ "expressive-heading-01",
62
+ "expressive-heading-02",
63
+ "expressive-heading-03",
64
+ "expressive-heading-04",
65
+ "expressive-heading-05",
66
+ "expressive-heading-06",
67
+ "quotation-01",
68
+ "quotation-02",
69
+ "display-01",
70
+ "display-02",
71
+ "display-03",
72
+ "display-04",
73
+ "tokens",
74
+ ]
75
+ `);
76
+ });
77
+ });
@@ -5,5 +5,6 @@
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  //
7
7
 
8
- @forward '@carbon/grid/scss/modules/breakpoint'
8
+ @use './config';
9
+ @forward '@carbon/grid/scss/breakpoint'
9
10
  show breakpoint, breakpoint-between, breakpoint-down, breakpoint-up;
package/scss/_config.scss CHANGED
@@ -36,11 +36,11 @@ $font-display: 'swap' !default;
36
36
  /// @group config
37
37
  $font-path: '~@ibm/plex' !default;
38
38
 
39
- /// Specify if IBM Plex should be provided by Google Fonts
39
+ /// Specify if IBM Plex should be provided by the IBM Akamai CDN
40
40
  /// @access public
41
41
  /// @type String
42
42
  /// @group config
43
- $use-google-fonts: false !default;
43
+ $use-akamai-cdn: false !default;
44
44
 
45
45
  /// The value used to prefix selectors and CSS Custom Properties across the
46
46
  /// codebase
@@ -59,3 +59,10 @@ $flex-grid-columns: 16 !default;
59
59
  /// @type Boolean
60
60
  /// @group config
61
61
  $use-flexbox-grid: false !default;
62
+
63
+ @forward '@carbon/grid/scss/config'
64
+ hide $prefix, $flex-grid-columns
65
+ with (
66
+ $prefix: $prefix,
67
+ $flex-grid-columns: $flex-grid-columns,
68
+ );
@@ -5,7 +5,7 @@
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  //
7
7
 
8
- @forward '@carbon/layout/scss/modules/spacing'
8
+ @forward '@carbon/layout/scss/spacing'
9
9
  show
10
10
  $spacing,
11
11
  $spacing-01,
package/scss/_theme.scss CHANGED
@@ -6,18 +6,18 @@
6
6
  //
7
7
 
8
8
  @use './config' as *;
9
- @use '@carbon/themes/scss/modules/config' with (
9
+ @use '@carbon/themes/scss/config' with (
10
10
  $prefix: $prefix,
11
11
  );
12
12
  @use './compat/themes' as compat;
13
13
  @use './themes';
14
14
 
15
- @forward '@carbon/themes/scss/modules/theme' with (
15
+ @forward '@carbon/themes/scss/theme' with (
16
16
  $fallback: themes.$white !default,
17
17
  $theme: compat.$white !default,
18
18
  );
19
- @forward '@carbon/themes/scss/modules/tokens';
20
- @use '@carbon/themes/scss/modules/tokens';
19
+ @forward '@carbon/themes/scss/tokens';
20
+ @use '@carbon/themes/scss/tokens';
21
21
  @use './utilities/custom-property';
22
22
 
23
23
  // Layer sets
package/scss/_themes.scss CHANGED
@@ -5,4 +5,5 @@
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  //
7
7
 
8
- @forward '@carbon/themes/scss/modules/themes' show $white, $g10, $g90, $g100;
8
+ @use './config';
9
+ @forward '@carbon/themes/scss/themes' show $white, $g10, $g90, $g100;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
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
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('scss/components/accordion', () => {
17
+ test('Public API', async () => {
18
+ const { unwrap } = await render(`
19
+ @use 'sass:map';
20
+ @use 'sass:meta';
21
+ @use '../accordion';
22
+
23
+ $_: get('mixin', meta.mixin-exists('accordion', 'accordion'));
24
+ $_: get('variables', map.keys(meta.module-variables('accordion')));
25
+ `);
26
+ expect(unwrap('mixin')).toBe(true);
27
+ expect(unwrap('variables')).toMatchInlineSnapshot(`
28
+ Array [
29
+ "flex-direction",
30
+ "justify-content",
31
+ "arrow-margin",
32
+ "title-margin",
33
+ "content-padding",
34
+ ]
35
+ `);
36
+ });
37
+
38
+ test('configuration', async () => {
39
+ const { unwrap } = await render(`
40
+ @use '../accordion' with (
41
+ $flex-direction: row,
42
+ );
43
+ $_: get('direction', accordion.$flex-direction);
44
+ `);
45
+ expect(unwrap('direction')).toBe('row');
46
+ });
47
+ });
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
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
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('scss/components/breadcrumb', () => {
17
+ test('Public API', async () => {
18
+ const { unwrap } = await render(`
19
+ @use 'sass:map';
20
+ @use 'sass:meta';
21
+ @use '../breadcrumb';
22
+
23
+ $_: get('mixin', meta.mixin-exists('breadcrumb', 'breadcrumb'));
24
+ `);
25
+ expect(unwrap('mixin')).toBe(true);
26
+ });
27
+ });
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Copyright IBM Corp. 2018, 2018
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
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const { SassRenderer } = require('@carbon/test-utils/scss');
13
+
14
+ const { render } = SassRenderer.create(__dirname);
15
+
16
+ describe('scss/components/button', () => {
17
+ test('Public API', async () => {
18
+ const { unwrap } = await render(`
19
+ @use 'sass:map';
20
+ @use 'sass:meta';
21
+ @use '../button';
22
+
23
+ $_: get('mixin', meta.mixin-exists('button', 'button'));
24
+ $_: get('variables', map.keys(meta.module-variables('button')));
25
+ `);
26
+ expect(unwrap('mixin')).toBe(true);
27
+ expect(unwrap('variables')).toMatchInlineSnapshot(`
28
+ Array [
29
+ "button-font-weight",
30
+ "button-font-size",
31
+ "button-border-radius",
32
+ "button-height",
33
+ "button-padding",
34
+ "button-padding-field",
35
+ "button-padding-sm",
36
+ "button-padding-lg",
37
+ "button-padding-ghost",
38
+ "button-padding-ghost-field",
39
+ "button-padding-ghost-sm",
40
+ "button-border-width",
41
+ "button-outline-width",
42
+ "button-separator",
43
+ "button-primary",
44
+ "button-secondary",
45
+ "button-tertiary",
46
+ "button-danger-primary",
47
+ "button-danger-secondary",
48
+ "button-danger-active",
49
+ "button-primary-active",
50
+ "button-secondary-active",
51
+ "button-tertiary-active",
52
+ "button-danger-hover",
53
+ "button-primary-hover",
54
+ "button-secondary-hover",
55
+ "button-tertiary-hover",
56
+ "button-disabled",
57
+ "button-tokens",
58
+ ]
59
+ `);
60
+ });
61
+
62
+ test('configuration', async () => {
63
+ const { unwrap } = await render(`
64
+ @use '../button' with (
65
+ $button-height: 2rem,
66
+ );
67
+ $_: get('height', button.$button-height);
68
+ `);
69
+ expect(unwrap('height')).toBe('2rem');
70
+ });
71
+ });