@carbon/ibm-products-web-components 0.1.0 → 0.1.1-canary.3605

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. package/.storybook/main.ts +15 -1
  2. package/.storybook/preview-head.html +5 -1
  3. package/.storybook/{theme.ts → theme.js} +2 -2
  4. package/es/components/side-panel/side-panel.d.ts +61 -80
  5. package/es/components/side-panel/side-panel.js +5 -3
  6. package/es/components/side-panel/side-panel.js.map +1 -1
  7. package/es/components/side-panel/side-panel.scss.js +1 -1
  8. package/es/components/tearsheet/defs.d.ts +26 -0
  9. package/es/components/tearsheet/defs.js +39 -0
  10. package/es/components/tearsheet/defs.js.map +1 -0
  11. package/es/components/tearsheet/index.d.ts +9 -0
  12. package/es/components/tearsheet/index.js +9 -0
  13. package/es/components/tearsheet/index.js.map +1 -0
  14. package/es/components/tearsheet/tearsheet.d.ts +490 -0
  15. package/es/components/tearsheet/tearsheet.js +685 -0
  16. package/es/components/tearsheet/tearsheet.js.map +1 -0
  17. package/es/components/tearsheet/tearsheet.scss.js +13 -0
  18. package/es/components/tearsheet/tearsheet.scss.js.map +1 -0
  19. package/es/components/tearsheet/tearsheet.test.d.ts +7 -0
  20. package/es/components/tearsheet/tearsheet.test.js +122 -0
  21. package/es/components/tearsheet/tearsheet.test.js.map +1 -0
  22. package/es/index.d.ts +1 -0
  23. package/es/index.js +1 -0
  24. package/es/index.js.map +1 -1
  25. package/lib/components/side-panel/side-panel.d.ts +61 -80
  26. package/lib/components/tearsheet/defs.d.ts +26 -0
  27. package/lib/components/tearsheet/defs.js +39 -0
  28. package/lib/components/tearsheet/defs.js.map +1 -0
  29. package/lib/components/tearsheet/index.d.ts +9 -0
  30. package/lib/components/tearsheet/tearsheet.d.ts +490 -0
  31. package/lib/components/tearsheet/tearsheet.test.d.ts +7 -0
  32. package/lib/index.d.ts +1 -0
  33. package/package.json +17 -17
  34. package/scss/components/tearsheet/story-styles.scss +23 -0
  35. package/scss/components/tearsheet/tearsheet.scss +318 -0
  36. package/src/components/side-panel/side-panel.ts +5 -5
  37. package/src/components/tearsheet/defs.ts +30 -0
  38. package/src/components/tearsheet/index.ts +10 -0
  39. package/src/components/tearsheet/story-styles.scss +23 -0
  40. package/src/components/tearsheet/tearsheet.mdx +101 -0
  41. package/src/components/tearsheet/tearsheet.scss +318 -0
  42. package/src/components/tearsheet/tearsheet.stories.ts +703 -0
  43. package/src/components/tearsheet/tearsheet.test.ts +118 -0
  44. package/src/components/tearsheet/tearsheet.ts +792 -0
  45. package/src/index.ts +1 -0
  46. package/netlify.toml +0 -8
  47. /package/.storybook/{Preview.ts → preview.ts} +0 -0
@@ -0,0 +1,318 @@
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/breakpoint' as *;
13
+ @use '@carbon/styles/scss/config' as *;
14
+ @use '@carbon/styles/scss/motion' as *;
15
+ @use '@carbon/styles/scss/spacing' as *;
16
+ @use '@carbon/styles/scss/theme' as *;
17
+ @use '@carbon/styles/scss/type';
18
+ @use '@carbon/styles/scss/utilities';
19
+ @use '@carbon/styles/scss/utilities/ai-gradient' as *;
20
+ @use '@carbon/styles/scss/components/modal' as *;
21
+ @use '@carbon/styles/scss/utilities/convert' as *;
22
+ @use 'sass:map';
23
+
24
+ $prefix: 'c4p';
25
+ $carbon-prefix: 'cds';
26
+
27
+ @use '@carbon/ibm-products-styles/scss/components/Tearsheet/index' as *;
28
+ @use '@carbon/ibm-products-styles/scss/components/ActionSet/index' as *;
29
+
30
+ $block-class: #{$prefix}--tearsheet;
31
+ $block-class-action-set: #{$prefix}--action-set;
32
+ $motion-duration: $duration-moderate-02;
33
+
34
+ :host(#{$prefix}-tearsheet) {
35
+ --content-padding: #{$spacing-05};
36
+
37
+ @extend .#{$carbon-prefix}--modal;
38
+ @extend .#{$prefix}--tearsheet;
39
+
40
+ .#{$block-class}__header,
41
+ .#{$block-class}__content,
42
+ .#{$block-class}__influencer {
43
+ padding: var(--content-padding);
44
+ }
45
+
46
+ .#{$block-class}__container {
47
+ /* lower prop is deprecated but the default in ibm products */
48
+ @extend .#{$block-class}__container--lower;
49
+
50
+ max-block-size: calc(100% - (#{$spacing-09} + #{$spacing-08}));
51
+ }
52
+
53
+ .#{$block-class}__container[stack-position='1'][stack-depth='2'],
54
+ .#{$block-class}__container[stack-position='2'][stack-depth='3'] {
55
+ max-block-size: calc(
56
+ 100% - (#{$spacing-09} + #{$spacing-08}) + #{$spacing-05}
57
+ );
58
+ transform: scale(var(--#{$block-class}--stacking-scale-factor-single));
59
+ }
60
+
61
+ .#{$block-class}__container[stack-position='1'][stack-depth='3'] {
62
+ max-block-size: calc(
63
+ 100% - (#{$spacing-09} + #{$spacing-08}) + (2 * #{$spacing-05})
64
+ );
65
+ transform: scale(var(--#{$block-class}--stacking-scale-factor-double));
66
+ }
67
+
68
+ .#{$block-class}__buttons {
69
+ @extend .#{$block-class}__button-container;
70
+ @extend .#{$block-class-action-set};
71
+
72
+ display: flex;
73
+ background: $background;
74
+ inline-size: 100%;
75
+ }
76
+
77
+ .#{$block-class}__buttons[hidden] {
78
+ @extend .#{$carbon-prefix}--visually-hidden;
79
+
80
+ display: none;
81
+ }
82
+
83
+ .#{$block-class}__buttons ::slotted(#{$carbon-prefix}-button) {
84
+ @extend .#{$block-class-action-set}__action-button;
85
+
86
+ flex: 0 1 25%;
87
+ block-size: $spacing-11;
88
+ max-inline-size: to-rem(232px);
89
+ }
90
+
91
+ .#{$block-class}__buttons ::slotted(#{$carbon-prefix}-button[kind='ghost']) {
92
+ flex: 1 1 25%;
93
+ max-inline-size: none;
94
+ }
95
+
96
+ .#{$block-class}__buttons ::slotted(#{$carbon-prefix}-button[hidden]) {
97
+ @extend .#{$carbon-prefix}--visually-hidden;
98
+
99
+ display: none;
100
+ }
101
+
102
+ .#{$block-class}__influencer[wide] {
103
+ @extend .#{$block-class}__influencer--wide;
104
+ }
105
+ }
106
+
107
+ :host(#{$prefix}-tearsheet[open]) {
108
+ --overlay-color: #{$overlay};
109
+ --overlay-opacity: 1;
110
+
111
+ z-index: utilities.z('modal');
112
+ align-items: flex-end;
113
+ background: initial;
114
+ opacity: 1;
115
+
116
+ transition: visibility 0s linear;
117
+ visibility: inherit;
118
+
119
+ .#{$prefix}--tearsheet__container {
120
+ transform: translate3d(0, 0, 0);
121
+ transition: transform $duration-moderate-02 motion(entrance, expressive);
122
+ }
123
+
124
+ @media (prefers-reduced-motion: reduce) {
125
+ transition: none;
126
+ }
127
+
128
+ &::before {
129
+ position: absolute;
130
+ display: block;
131
+ background: var(--overlay-color);
132
+ content: '';
133
+ inset: 0;
134
+ opacity: var(--overlay-opacity);
135
+
136
+ transition: background-color $motion-duration motion(exit, expressive),
137
+ opacity $motion-duration motion(exit, expressive);
138
+
139
+ @media (prefers-reduced-motion: reduce) {
140
+ transition: none;
141
+ }
142
+
143
+ &[stack-position='1'][stack-depth='2'] {
144
+ --overlay-opacity: 0.67;
145
+ }
146
+
147
+ &[stack-position='1'][stack-depth='3'] {
148
+ --overlay-opacity: 0.22;
149
+ }
150
+
151
+ &[stack-position='2'][stack-depth='3'] {
152
+ --overlay-opacity: 0.5;
153
+ }
154
+
155
+ &[stack-position='2'][stack-depth='2'],
156
+ &[stack-position='3'][stack-depth='3'] {
157
+ --overlay-opacity: 0.5;
158
+ }
159
+ }
160
+ }
161
+
162
+ :host(#{$prefix}-tearsheet[hidden]) {
163
+ @extend .#{$carbon-prefix}--visually-hidden;
164
+ }
165
+
166
+ :host(#{$prefix}-tearsheet[slug]) {
167
+ --overlay-color: #{$ai-overlay};
168
+
169
+ .#{$block-class}__container {
170
+ border: 1px solid transparent;
171
+
172
+ /* override carbon ai removing background gradient */
173
+ background: linear-gradient(to top, var(--cds-layer), var(--cds-layer))
174
+ padding-box,
175
+ linear-gradient(
176
+ to bottom,
177
+ var(--cds-ai-border-start, #78a9ff),
178
+ var(--cds-ai-border-end, #d0e2ff)
179
+ )
180
+ border-box,
181
+ linear-gradient(to top, var(--cds-layer), var(--cds-layer)) border-box;
182
+ border-block-end: 0;
183
+ box-shadow: 0 24px 40px -24px $ai-drop-shadow;
184
+ }
185
+
186
+ .#{$block-class}__content {
187
+ @include utilities.ai-popover-gradient('default', 0);
188
+
189
+ box-shadow: inset 0 -80px 70px -65px $ai-inner-shadow;
190
+ }
191
+ }
192
+
193
+ :host(#{$prefix}-tearsheet[slug])
194
+ .#{$prefix}--tearsheet__header[has-actions]
195
+ ::slotted(#{$prefix}-slug) {
196
+ inset-inline-end: 0;
197
+ }
198
+
199
+ :host(#{$prefix}-tearsheet[stack-position='1'][stack-depth='2']),
200
+ :host(#{$prefix}-tearsheet[stack-position='2'][stack-depth='3']) {
201
+ z-index: utilities.z('modal') - 1;
202
+ }
203
+
204
+ :host(#{$prefix}-tearsheet[stack-position='1'][stack-depth='3']) {
205
+ z-index: utilities.z('modal') - 2;
206
+ }
207
+
208
+ :host(#{$prefix}-tearsheet[width='narrow']) {
209
+ .#{$block-class}__header {
210
+ margin: 0;
211
+ background-color: $layer;
212
+ border-block-end: 1px solid $border-subtle-01;
213
+ }
214
+
215
+ .#{$block-class}__header-description {
216
+ margin-block-start: $spacing-03;
217
+ max-inline-size: 80%;
218
+ }
219
+
220
+ .#{$block-class}__main {
221
+ background-color: $layer;
222
+ }
223
+ }
224
+
225
+ :host(#{$prefix}-tearsheet[width='wide']) {
226
+ --content-padding: #{$spacing-06 $spacing-07};
227
+
228
+ .#{$block-class}__header {
229
+ margin: 0;
230
+ background-color: $layer;
231
+ border-block-end: 1px solid $border-subtle-01;
232
+ }
233
+
234
+ .#{$block-class}__header[has-navigation] {
235
+ padding-block-end: 0;
236
+ }
237
+
238
+ .#{$block-class}__container {
239
+ inline-size: 100%;
240
+
241
+ @include breakpoint(md) {
242
+ inline-size: calc(100% - (2 * #{$spacing-10}));
243
+ }
244
+ }
245
+
246
+ .#{$carbon-prefix}--modal-header__heading.#{$block-class}__heading {
247
+ @include type.type-style('heading-04');
248
+ }
249
+
250
+ .#{$block-class}__header[has-close-icon],
251
+ .#{$block-class}__header[has-slug] {
252
+ padding-inline-end: $spacing-11;
253
+ }
254
+
255
+ .#{$block-class}__header[has-close-icon][has-slug] {
256
+ padding-inline-end: calc(#{$spacing-11 + $spacing-09});
257
+ }
258
+
259
+ .#{$block-class}__header-navigation {
260
+ margin-inline-start: calc(-1 * #{$spacing-05});
261
+ max-block-size: $spacing-08; /* #{$prefix}-tabs too tall */
262
+ }
263
+
264
+ .#{$block-class}__content {
265
+ // Revert background color overridden by Carbon's modal - https://github.com/carbon-design-system/carbon/blob/main/packages/styles/scss/components/modal/_modal.scss#L54
266
+ .#{$carbon-prefix}--pagination,
267
+ .#{$carbon-prefix}--pagination__control-buttons,
268
+ .#{$carbon-prefix}--text-input,
269
+ .#{$carbon-prefix}--text-area,
270
+ .#{$carbon-prefix}--search-input,
271
+ .#{$carbon-prefix}--select-input,
272
+ .#{$carbon-prefix}--dropdown,
273
+ .#{$carbon-prefix}--dropdown-list,
274
+ .#{$carbon-prefix}--number input[type='number'],
275
+ .#{$carbon-prefix}--date-picker__input {
276
+ background-color: $field;
277
+ }
278
+
279
+ .#{$carbon-prefix}--select--inline .#{$carbon-prefix}--select-input {
280
+ background-color: transparent;
281
+ }
282
+
283
+ // and restore the 'light' prop in case light fields are wanted
284
+ .#{$carbon-prefix}--text-input--light,
285
+ .#{$carbon-prefix}--text-area--light,
286
+ .#{$carbon-prefix}--search--light .#{$carbon-prefix}--search-input,
287
+ .#{$carbon-prefix}--select--light .#{$carbon-prefix}--select-input,
288
+ .#{$carbon-prefix}--dropdown--light,
289
+ .#{$carbon-prefix}--dropdown--light .#{$carbon-prefix}--dropdown-list,
290
+ /* stylelint-disable-next-line prettier/prettier */
291
+ .#{$carbon-prefix}--number--light input[type='number'],
292
+ .#{$carbon-prefix}--date-picker--light
293
+ .#{$carbon-prefix}--date-picker__input {
294
+ background-color: $field-02;
295
+ }
296
+ }
297
+ .#{$prefix}--action-set
298
+ .#{$prefix}--action-set__action-button.#{$prefix}--action-set__action-button--expressive {
299
+ block-size: $spacing-11;
300
+ }
301
+ }
302
+
303
+ :host(#{$prefix}-tearsheet[width='narrow'])
304
+ .#{$block-class}__buttons[actions-multiple='single']
305
+ ::slotted(#{$carbon-prefix}-button),
306
+ :host(#{$prefix}-tearsheet[width='narrow'])
307
+ .#{$block-class}__buttons[actions-multiple='double']
308
+ ::slotted(#{$carbon-prefix}-button) {
309
+ // double and single on lg use 50%
310
+ flex: 0 1 50%;
311
+ max-inline-size: none;
312
+ }
313
+
314
+ :host(#{$prefix}-tearsheet[width='narrow'])
315
+ .#{$block-class}__buttons
316
+ ::slotted(#{$carbon-prefix}-button) {
317
+ block-size: $spacing-10;
318
+ }