@carbon/ibm-products-web-components 0.0.1-canary.3564

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. package/.storybook/Preview.ts +161 -0
  2. package/.storybook/_container.scss +73 -0
  3. package/.storybook/container.ts +41 -0
  4. package/.storybook/main.ts +25 -0
  5. package/.storybook/manager.ts +13 -0
  6. package/.storybook/preview-head.html +3 -0
  7. package/.storybook/templates/with-layer.scss +38 -0
  8. package/.storybook/templates/with-layer.ts +90 -0
  9. package/.storybook/theme.ts +12 -0
  10. package/LICENSE +201 -0
  11. package/es/components/side-panel/defs.d.ts +39 -0
  12. package/es/components/side-panel/defs.js +51 -0
  13. package/es/components/side-panel/defs.js.map +1 -0
  14. package/es/components/side-panel/index.d.ts +9 -0
  15. package/es/components/side-panel/index.js +9 -0
  16. package/es/components/side-panel/index.js.map +1 -0
  17. package/es/components/side-panel/side-panel.d.ts +539 -0
  18. package/es/components/side-panel/side-panel.js +837 -0
  19. package/es/components/side-panel/side-panel.js.map +1 -0
  20. package/es/components/side-panel/side-panel.scss.js +13 -0
  21. package/es/components/side-panel/side-panel.scss.js.map +1 -0
  22. package/es/components/side-panel/side-panel.test.d.ts +7 -0
  23. package/es/components/side-panel/side-panel.test.js +56 -0
  24. package/es/components/side-panel/side-panel.test.js.map +1 -0
  25. package/es/globals/internal/handle.d.ts +18 -0
  26. package/es/globals/internal/handle.js +8 -0
  27. package/es/globals/internal/handle.js.map +1 -0
  28. package/es/globals/settings.d.ts +15 -0
  29. package/es/globals/settings.js +28 -0
  30. package/es/globals/settings.js.map +1 -0
  31. package/es/index.d.ts +9 -0
  32. package/es/index.js +9 -0
  33. package/es/index.js.map +1 -0
  34. package/lib/components/side-panel/defs.d.ts +39 -0
  35. package/lib/components/side-panel/defs.js +51 -0
  36. package/lib/components/side-panel/defs.js.map +1 -0
  37. package/lib/components/side-panel/index.d.ts +9 -0
  38. package/lib/components/side-panel/side-panel.d.ts +539 -0
  39. package/lib/components/side-panel/side-panel.test.d.ts +7 -0
  40. package/lib/globals/internal/handle.d.ts +18 -0
  41. package/lib/globals/settings.d.ts +15 -0
  42. package/lib/globals/settings.js +32 -0
  43. package/lib/globals/settings.js.map +1 -0
  44. package/lib/index.d.ts +9 -0
  45. package/netlify.toml +8 -0
  46. package/package.json +96 -0
  47. package/scss/components/side-panel/side-panel.scss +302 -0
  48. package/scss/components/side-panel/story-styles.scss +46 -0
  49. package/src/components/side-panel/defs.ts +46 -0
  50. package/src/components/side-panel/index.ts +10 -0
  51. package/src/components/side-panel/side-panel.mdx +106 -0
  52. package/src/components/side-panel/side-panel.scss +302 -0
  53. package/src/components/side-panel/side-panel.stories.ts +525 -0
  54. package/src/components/side-panel/side-panel.test.ts +52 -0
  55. package/src/components/side-panel/side-panel.ts +980 -0
  56. package/src/components/side-panel/story-styles.scss +46 -0
  57. package/src/globals/internal/handle.ts +19 -0
  58. package/src/globals/settings.ts +22 -0
  59. package/src/index.ts +10 -0
  60. package/src/typings/resources.d.ts +26 -0
  61. package/tasks/build.js +165 -0
  62. package/tools/rollup-plugin-icon-paths.js +39 -0
  63. package/tools/rollup-plugin-icons.js +73 -0
  64. package/tools/rollup-plugin-lit-scss.js +89 -0
  65. package/tools/svg-result-carbon-icon-loader.js +28 -0
  66. package/tools/svg-result-carbon-icon.js +42 -0
  67. package/tools/vite-svg-result-carbon-icon-loader.ts +65 -0
  68. package/tsconfig.json +36 -0
  69. package/vite.config.ts +32 -0
@@ -0,0 +1,302 @@
1
+ /*
2
+ * Copyright IBM Corp. 2023, 2024
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
+ $css--plex: true !default;
9
+
10
+ /* Other Carbon settings. */
11
+ @use '@carbon/styles/scss/reset';
12
+ @use '@carbon/styles/scss/config' as *;
13
+ @use '@carbon/styles/scss/motion' as *;
14
+ @use '@carbon/styles/scss/spacing' as *;
15
+ @use '@carbon/styles/scss/theme' as *;
16
+ @use '@carbon/styles/scss/utilities/ai-gradient' as *;
17
+ @use '@carbon/styles/scss/utilities/convert' as *;
18
+ @use 'sass:map';
19
+
20
+ $prefix: 'c4p';
21
+ $carbon-prefix: 'cds';
22
+ @use '@carbon/ibm-products-styles/scss/components/ActionSet/index' as *;
23
+ @use '@carbon/ibm-products-styles/scss/components/SidePanel/index' as *;
24
+ @use '@carbon/ibm-products-styles/scss/components/SidePanel/side-panel-variables'
25
+ as spv;
26
+
27
+ $block-class: #{$prefix}--side-panel;
28
+ $block-class-action-set: #{$prefix}--action-set;
29
+
30
+ :host(#{$prefix}-side-panel) {
31
+ /* Replaces use of Framer for slide in / out animation */
32
+ --#{$block-class}--displaced: 100%;
33
+
34
+ * {
35
+ /* not sure why things are coming out as content-box */
36
+ box-sizing: border-box;
37
+ }
38
+
39
+ .#{$block-class} {
40
+ @extend .#{$block-class};
41
+
42
+ /* for actions container query - note this changes the size calculation */
43
+ container-name: side-panel;
44
+ container-type: inline-size;
45
+
46
+ &[placement='left'] {
47
+ --#{$block-class}--displaced: -100%;
48
+ }
49
+
50
+ &[opening] {
51
+ transform: translateX(var(--#{$block-class}--displaced));
52
+ }
53
+
54
+ &[open] {
55
+ transform: translateX(0);
56
+ transition: all $duration-moderate-02 motion(standard, productive);
57
+ }
58
+
59
+ @media screen and (prefers-reduced-motion: reduce) {
60
+ &[open] {
61
+ transition: none;
62
+ }
63
+ }
64
+
65
+ &[closing] {
66
+ transform: translateX(var(--#{$block-class}--displaced));
67
+ transition: all $duration-moderate-01 motion(exit, productive);
68
+ }
69
+
70
+ @media screen and (prefers-reduced-motion: reduce) {
71
+ &[closing] {
72
+ transition: none;
73
+ }
74
+ }
75
+
76
+ &[placement='right'] {
77
+ @extend .#{$block-class}--right-placement;
78
+
79
+ /* remove if https://github.com/carbon-design-system/ibm-products/pull/3983 merged */
80
+ border-inline-end: 1px solid $border-subtle-02;
81
+ inset-inline-end: 0;
82
+ }
83
+
84
+ /* stylelint-disable-next-line no-duplicate-selectors -- disabled to keep close to 'right' setting */
85
+ &[placement='left'] {
86
+ @extend .#{$block-class}--left-placement;
87
+
88
+ /* remove if https://github.com/carbon-design-system/ibm-products/pull/3983 merged */
89
+ border-inline-end: 1px solid $border-subtle-02;
90
+ inset-inline-start: 0;
91
+ }
92
+
93
+ @each $size, $size_value in spv.$side-panel-sizes {
94
+ &[size='#{$size}'] {
95
+ @extend .#{$block-class}--#{$size};
96
+ }
97
+ }
98
+
99
+ &[condensed-actions] {
100
+ @extend .#{$block-class}--condensed-actions;
101
+ }
102
+ }
103
+
104
+ #{$prefix}-layer {
105
+ display: contents;
106
+ }
107
+
108
+ .#{$block-class}__overlay {
109
+ &[opening] {
110
+ opacity: 0;
111
+ }
112
+
113
+ @media screen and (prefers-reduced-motion: reduce) {
114
+ &[open] {
115
+ opacity: 1;
116
+ transition: none;
117
+ }
118
+ }
119
+
120
+ &[open] {
121
+ opacity: 1;
122
+ transition: all $duration-moderate-02 motion(standard, productive);
123
+ }
124
+ @media screen and (prefers-reduced-motion: reduce) {
125
+ &[closing] {
126
+ opacity: 0;
127
+ transition: none;
128
+ }
129
+ }
130
+
131
+ &[closing] {
132
+ opacity: 0;
133
+ transition: all $duration-moderate-01 motion(exit, productive);
134
+ }
135
+ }
136
+
137
+ .#{$block-class}__header {
138
+ &::before {
139
+ z-index: 99; /* must be higher than action toolbar */
140
+ }
141
+
142
+ &[detail-step] {
143
+ @extend .#{$block-class}__header--on-detail-step;
144
+ }
145
+
146
+ &[no-title-animation] {
147
+ @extend .#{$block-class}__header--no-title-animation;
148
+ // inset-block-start: 0;
149
+ }
150
+
151
+ &[reduced-motion] {
152
+ @extend .#{$block-class}__header--reduced-motion;
153
+ }
154
+
155
+ &[has-action-toolbar] {
156
+ margin-block-end: $spacing-03;
157
+ padding-block-end: 0;
158
+ }
159
+ }
160
+
161
+ .#{$block-class} .#{$block-class}__header[has-action-toolbar]::before {
162
+ content: initial; /* remove border below */
163
+ }
164
+
165
+ .#{$block-class}__subtitle-text {
166
+ &[hidden] {
167
+ @extend .#{$carbon-prefix}--visually-hidden !optional;
168
+ }
169
+ }
170
+
171
+ .#{$block-class}__action-toolbar {
172
+ margin-block-end: 0;
173
+ padding-inline-start: 0;
174
+
175
+ &[hidden] {
176
+ @extend .#{$carbon-prefix}--visually-hidden !optional;
177
+ }
178
+ }
179
+
180
+ .#{$block-class} .#{$block-class}__action-toolbar[hidden] {
181
+ @extend .#{$carbon-prefix}--visually-hidden !optional;
182
+ }
183
+
184
+ .#{$block-class}[has-slug] {
185
+ @extend .#{$block-class}--has-slug;
186
+ }
187
+
188
+ [scrolls] {
189
+ @extend .#{$block-class}--scrolls;
190
+ }
191
+
192
+ .#{$block-class}__body-content {
193
+ @extend .#{$block-class}__body-content;
194
+ }
195
+
196
+ @mixin actions-placement() {
197
+ --flex-direction: row;
198
+ /* non carbon for IBM Products adjustment */
199
+ flex-direction: var(--flex-direction);
200
+
201
+ ::slotted(#{$prefix}-button) {
202
+ flex: 0 1 25%;
203
+ max-inline-size: to-rem(232px);
204
+ }
205
+
206
+ ::slotted(#{$prefix}-button[kind='ghost']) {
207
+ flex: 1 1 25%;
208
+ max-inline-size: none;
209
+ }
210
+
211
+ ::slotted(#{$prefix}-button[hidden]) {
212
+ @extend .#{$carbon-prefix}--visually-hidden !optional;
213
+
214
+ display: none;
215
+ }
216
+
217
+ // -1 in @container query is for 1px left border
218
+ @container (width <= #{map.get(spv.$side-panel-sizes, lg)}) {
219
+ &:not([actions-multiple='triple']) ::slotted(#{$carbon-prefix}-button) {
220
+ // double and single on lg use 50%
221
+ flex: 0 1 50%;
222
+ max-inline-size: none;
223
+ }
224
+ }
225
+
226
+ // -1 in @container query is for 1px left border
227
+ @container (width <= #{map.get(spv.$side-panel-sizes, md)}) {
228
+ // md is 50% for two and 100% for one
229
+ // column for triple
230
+ &[actions-multiple] ::slotted(#{$carbon-prefix}-button) {
231
+ flex: 0 0 100%;
232
+ max-inline-size: none;
233
+ }
234
+
235
+ &[actions-multiple='double'] ::slotted(#{$carbon-prefix}-button) {
236
+ flex: 0 1 50%;
237
+ max-inline-size: none;
238
+ }
239
+
240
+ &[actions-multiple='triple'] {
241
+ --flex-direction: column;
242
+
243
+ ::slotted(#{$carbon-prefix}-button) {
244
+ flex: initial;
245
+ inline-size: 100%;
246
+ max-inline-size: none;
247
+ }
248
+ }
249
+ }
250
+
251
+ // -1 in @container query is for 1px left border
252
+ @container (width <= #{map.get(spv.$side-panel-sizes, sm)}) {
253
+ --flex-direction: column;
254
+
255
+ ::slotted(#{$carbon-prefix}-button) {
256
+ flex: initial;
257
+ inline-size: 100%;
258
+ max-inline-size: none;
259
+ }
260
+ }
261
+ }
262
+
263
+ .#{$block-class}__actions-container {
264
+ @extend .#{$block-class-action-set};
265
+ @include actions-placement();
266
+
267
+ display: flex;
268
+ inline-size: 100%;
269
+
270
+ ::slotted(#{$carbon-prefix}-button) {
271
+ @extend .#{$block-class-action-set}__action-button;
272
+ }
273
+
274
+ &[hidden] {
275
+ @extend .#{$carbon-prefix}--visually-hidden !optional;
276
+
277
+ display: none;
278
+ }
279
+
280
+ $multiples: 'single' 'double' 'triple';
281
+ @each $m in $multiples {
282
+ &[actions-multiple='#{$m}'] {
283
+ @extend .#{$carbon-prefix}--action-set--row-#{$m} !optional;
284
+ }
285
+ }
286
+
287
+ $sizes: 'xs' 'sm';
288
+ @each $s in $sizes {
289
+ &[size='#{$s}'] {
290
+ @extend .#{$block-class-action-set}--#{$s} !optional;
291
+ }
292
+ }
293
+ }
294
+
295
+ .sentinel {
296
+ @extend .#{$carbon-prefix}--visually-hidden !optional;
297
+ }
298
+
299
+ .#{$block-class}__close-button {
300
+ width: 2rem;
301
+ }
302
+ }