@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.
- package/.storybook/Preview.ts +161 -0
- package/.storybook/_container.scss +73 -0
- package/.storybook/container.ts +41 -0
- package/.storybook/main.ts +25 -0
- package/.storybook/manager.ts +13 -0
- package/.storybook/preview-head.html +3 -0
- package/.storybook/templates/with-layer.scss +38 -0
- package/.storybook/templates/with-layer.ts +90 -0
- package/.storybook/theme.ts +12 -0
- package/LICENSE +201 -0
- package/es/components/side-panel/defs.d.ts +39 -0
- package/es/components/side-panel/defs.js +51 -0
- package/es/components/side-panel/defs.js.map +1 -0
- package/es/components/side-panel/index.d.ts +9 -0
- package/es/components/side-panel/index.js +9 -0
- package/es/components/side-panel/index.js.map +1 -0
- package/es/components/side-panel/side-panel.d.ts +539 -0
- package/es/components/side-panel/side-panel.js +837 -0
- package/es/components/side-panel/side-panel.js.map +1 -0
- package/es/components/side-panel/side-panel.scss.js +13 -0
- package/es/components/side-panel/side-panel.scss.js.map +1 -0
- package/es/components/side-panel/side-panel.test.d.ts +7 -0
- package/es/components/side-panel/side-panel.test.js +56 -0
- package/es/components/side-panel/side-panel.test.js.map +1 -0
- package/es/globals/internal/handle.d.ts +18 -0
- package/es/globals/internal/handle.js +8 -0
- package/es/globals/internal/handle.js.map +1 -0
- package/es/globals/settings.d.ts +15 -0
- package/es/globals/settings.js +28 -0
- package/es/globals/settings.js.map +1 -0
- package/es/index.d.ts +9 -0
- package/es/index.js +9 -0
- package/es/index.js.map +1 -0
- package/lib/components/side-panel/defs.d.ts +39 -0
- package/lib/components/side-panel/defs.js +51 -0
- package/lib/components/side-panel/defs.js.map +1 -0
- package/lib/components/side-panel/index.d.ts +9 -0
- package/lib/components/side-panel/side-panel.d.ts +539 -0
- package/lib/components/side-panel/side-panel.test.d.ts +7 -0
- package/lib/globals/internal/handle.d.ts +18 -0
- package/lib/globals/settings.d.ts +15 -0
- package/lib/globals/settings.js +32 -0
- package/lib/globals/settings.js.map +1 -0
- package/lib/index.d.ts +9 -0
- package/netlify.toml +8 -0
- package/package.json +96 -0
- package/scss/components/side-panel/side-panel.scss +302 -0
- package/scss/components/side-panel/story-styles.scss +46 -0
- package/src/components/side-panel/defs.ts +46 -0
- package/src/components/side-panel/index.ts +10 -0
- package/src/components/side-panel/side-panel.mdx +106 -0
- package/src/components/side-panel/side-panel.scss +302 -0
- package/src/components/side-panel/side-panel.stories.ts +525 -0
- package/src/components/side-panel/side-panel.test.ts +52 -0
- package/src/components/side-panel/side-panel.ts +980 -0
- package/src/components/side-panel/story-styles.scss +46 -0
- package/src/globals/internal/handle.ts +19 -0
- package/src/globals/settings.ts +22 -0
- package/src/index.ts +10 -0
- package/src/typings/resources.d.ts +26 -0
- package/tasks/build.js +165 -0
- package/tools/rollup-plugin-icon-paths.js +39 -0
- package/tools/rollup-plugin-icons.js +73 -0
- package/tools/rollup-plugin-lit-scss.js +89 -0
- package/tools/svg-result-carbon-icon-loader.js +28 -0
- package/tools/svg-result-carbon-icon.js +42 -0
- package/tools/vite-svg-result-carbon-icon-loader.ts +65 -0
- package/tsconfig.json +36 -0
- package/vite.config.ts +32 -0
package/package.json
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
{
|
2
|
+
"name": "@carbon/ibm-products-web-components",
|
3
|
+
"description": "Carbon for IBM Products Web Components",
|
4
|
+
"version": "0.0.1-canary.3564+17bbbfbcf",
|
5
|
+
"license": "Apache-2.0",
|
6
|
+
"main": "es/index.js",
|
7
|
+
"module": "es/index.js",
|
8
|
+
"type": "module",
|
9
|
+
"bugs": "https://github.com/carbon-design-system/ibm-products/issues",
|
10
|
+
"repository": {
|
11
|
+
"type": "git",
|
12
|
+
"url": "https://github.com/carbon-design-system/ibm-products.git",
|
13
|
+
"directory": "packages/ibm-products-web-components"
|
14
|
+
},
|
15
|
+
"publishConfig": {
|
16
|
+
"access": "public",
|
17
|
+
"provenance": true
|
18
|
+
},
|
19
|
+
"exports": {
|
20
|
+
"./es/components/*": {
|
21
|
+
"node": "./lib/components/*",
|
22
|
+
"default": "./es/components/*"
|
23
|
+
},
|
24
|
+
"./es/globals/*": {
|
25
|
+
"node": "./lib/globals/*",
|
26
|
+
"default": "./es/globals/*"
|
27
|
+
},
|
28
|
+
"./es/*": "./es/*",
|
29
|
+
"./lib/*": "./lib/*",
|
30
|
+
"./custom-elements.json": "./custom-elements.json",
|
31
|
+
"./package.json": "./package.json"
|
32
|
+
},
|
33
|
+
"keywords": [
|
34
|
+
"carbon",
|
35
|
+
"carbon design system",
|
36
|
+
"carbon community",
|
37
|
+
"carbon for ibm products",
|
38
|
+
"carbon for ibm products web components",
|
39
|
+
"web components"
|
40
|
+
],
|
41
|
+
"scripts": {
|
42
|
+
"build": "yarn clean && node tasks/build.js && yarn wca",
|
43
|
+
"build:storybook": "yarn wca && storybook build",
|
44
|
+
"clean": "rimraf es lib scss dist storybook-static",
|
45
|
+
"preview": "vite preview",
|
46
|
+
"storybook": "storybook dev -p 3000",
|
47
|
+
"test": "vitest run",
|
48
|
+
"test:ui": "vitest --ui",
|
49
|
+
"wca": "web-component-analyzer analyze src --outFile custom-elements.json"
|
50
|
+
},
|
51
|
+
"dependencies": {
|
52
|
+
"@carbon/ibm-products-styles": "^2.47.0-rc.0",
|
53
|
+
"@carbon/styles": "1.63.1",
|
54
|
+
"@carbon/web-components": "2.13.0",
|
55
|
+
"lit": "^3.1.0"
|
56
|
+
},
|
57
|
+
"devDependencies": {
|
58
|
+
"@carbon/icons": "^11.50.0",
|
59
|
+
"@carbon/motion": "^11.23.0",
|
60
|
+
"@mordech/vite-lit-loader": "^0.35.0",
|
61
|
+
"@rollup/plugin-alias": "^5.1.1",
|
62
|
+
"@rollup/plugin-commonjs": "^28.0.0",
|
63
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
64
|
+
"@rollup/plugin-typescript": "^12.1.0",
|
65
|
+
"@storybook/addon-essentials": "^8.2.8",
|
66
|
+
"@storybook/addon-links": "^8.2.8",
|
67
|
+
"@storybook/addon-storysource": "^8.2.8",
|
68
|
+
"@storybook/blocks": "^8.2.8",
|
69
|
+
"@storybook/manager-api": "^8.3.4",
|
70
|
+
"@storybook/theming": "^8.3.4",
|
71
|
+
"@storybook/web-components": "^8.2.8",
|
72
|
+
"@storybook/web-components-vite": "^8.2.8",
|
73
|
+
"@types/jest": "^29.5.13",
|
74
|
+
"@vitest/browser": "latest",
|
75
|
+
"@vitest/ui": "latest",
|
76
|
+
"autoprefixer": "^10.4.20",
|
77
|
+
"cssnano": "^7.0.6",
|
78
|
+
"eslint": "^9.11.1",
|
79
|
+
"eslint-config-carbon": "^3.17.0",
|
80
|
+
"globby": "^14.0.2",
|
81
|
+
"happy-dom": "^15.7.4",
|
82
|
+
"postcss": "^8.4.47",
|
83
|
+
"remark-gfm": "^4.0.0",
|
84
|
+
"rimraf": "^5.0.5",
|
85
|
+
"rollup": "^3.29.5",
|
86
|
+
"rollup-plugin-copy": "^3.5.0",
|
87
|
+
"sass": "^1.77.2",
|
88
|
+
"storybook": "^8.2.8",
|
89
|
+
"storybook-addon-accessibility-checker": "^3.1.61-rc.3",
|
90
|
+
"typescript": "^5.5.3",
|
91
|
+
"vite": "^5.4.1",
|
92
|
+
"vitest": "^2.1.2",
|
93
|
+
"web-component-analyzer": "2.0.0"
|
94
|
+
},
|
95
|
+
"gitHead": "17bbbfbcf7be1c462a301972ac441a69b61faf1a"
|
96
|
+
}
|
@@ -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
|
+
}
|
@@ -0,0 +1,46 @@
|
|
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
|
+
@use '@carbon/styles/scss/theme' as *;
|
8
|
+
|
9
|
+
$story-prefix: 'side-panel-stories__';
|
10
|
+
|
11
|
+
.#{$story-prefix}body-content {
|
12
|
+
display: flex;
|
13
|
+
flex-direction: column;
|
14
|
+
padding: 1rem;
|
15
|
+
gap: 1rem;
|
16
|
+
}
|
17
|
+
|
18
|
+
.#{$story-prefix}text-inputs {
|
19
|
+
display: flex;
|
20
|
+
gap: 1rem;
|
21
|
+
|
22
|
+
> * {
|
23
|
+
flex-basis: 50%;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
.#{$story-prefix}story-container {
|
28
|
+
position: fixed;
|
29
|
+
display: grid;
|
30
|
+
block-size: 100vh;
|
31
|
+
grid-template-rows: 3rem 1fr;
|
32
|
+
inline-size: 100vw;
|
33
|
+
inset-block-start: 0;
|
34
|
+
inset-inline-start: 0;
|
35
|
+
}
|
36
|
+
|
37
|
+
.#{$story-prefix}story-header {
|
38
|
+
background: $background-inverse;
|
39
|
+
}
|
40
|
+
|
41
|
+
.#{$story-prefix}story-content {
|
42
|
+
position: relative;
|
43
|
+
display: flex;
|
44
|
+
align-items: center;
|
45
|
+
justify-content: center;
|
46
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
*
|
4
|
+
* Copyright IBM Corp. 2023, 2024
|
5
|
+
*
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
8
|
+
*/
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Modal size.
|
12
|
+
*/
|
13
|
+
export enum SIDE_PANEL_SIZE {
|
14
|
+
/**
|
15
|
+
* Extra small size.
|
16
|
+
*/
|
17
|
+
EXTRA_SMALL = 'xs',
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Small size.
|
21
|
+
*/
|
22
|
+
SMALL = 'sm',
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Medium size.
|
26
|
+
*/
|
27
|
+
MEDIUM = 'md',
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Large size.
|
31
|
+
*/
|
32
|
+
LARGE = 'lg',
|
33
|
+
|
34
|
+
/**
|
35
|
+
* 2X-Large size.
|
36
|
+
*/
|
37
|
+
EXTRA_EXTRA_LARGE = '2xl',
|
38
|
+
}
|
39
|
+
|
40
|
+
export enum SIDE_PANEL_PLACEMENT {
|
41
|
+
/** right / default */
|
42
|
+
RIGHT = 'right',
|
43
|
+
|
44
|
+
/** left */
|
45
|
+
LEFT = 'left',
|
46
|
+
}
|
@@ -0,0 +1,106 @@
|
|
1
|
+
import { ArgTypes, Markdown, Meta } from '@storybook/blocks';
|
2
|
+
import { cdnJs, cdnCss } from '../../globals/internal/storybook-cdn';
|
3
|
+
import * as SidePanelStories from './side-panel.stories';
|
4
|
+
|
5
|
+
<Meta of={SidePanelStories} />
|
6
|
+
|
7
|
+
# SidePanel
|
8
|
+
|
9
|
+
> 💡 Check our
|
10
|
+
> [CodeSandbox](https://codesandbox.io/s/github/carbon-design-system/carbon/tree/main/packages/web-components/examples/components/side-panel)
|
11
|
+
> example implementation.
|
12
|
+
|
13
|
+
[![Edit carbon-web-components](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/carbon-design-system/carbon/tree/main/packages/web-components/examples/components/side-panel)
|
14
|
+
|
15
|
+
Side panels keep users in-context of a page while performing tasks like
|
16
|
+
navigating, editing, viewing details, or configuring something new.
|
17
|
+
|
18
|
+
## Getting started
|
19
|
+
|
20
|
+
Here's a quick example to get you started.
|
21
|
+
|
22
|
+
### JS (via import)
|
23
|
+
|
24
|
+
```javascript
|
25
|
+
import '@carbon/web-components/es/components/side-panel/index.js';
|
26
|
+
// The following are used for slotted fields
|
27
|
+
import '@carbon/web-components/es/components/text-input/index.js';
|
28
|
+
import '@carbon/web-components/es/components/textarea/index.js';
|
29
|
+
import '@carbon/web-components/es/components/button/index.js';
|
30
|
+
```
|
31
|
+
|
32
|
+
<Markdown>{`${cdnJs({ components: ['side-panel'] })}`}</Markdown>
|
33
|
+
<Markdown>{`${cdnCss()}`}</Markdown>
|
34
|
+
|
35
|
+
### HTML
|
36
|
+
|
37
|
+
```html
|
38
|
+
<c4p-side-panel
|
39
|
+
include-overlay
|
40
|
+
open
|
41
|
+
label-text="An optional label"
|
42
|
+
size="md"
|
43
|
+
title="A title, can be omitted">
|
44
|
+
<!-- Content -->
|
45
|
+
<h5>Side panel content</h5>
|
46
|
+
<div class="${storyPrefix}text-inputs">
|
47
|
+
<cds-text-input
|
48
|
+
label="Input A"
|
49
|
+
id="side-panel-story-text-input-a"></cds-text-input>
|
50
|
+
<cds-text-input
|
51
|
+
label="Input B"
|
52
|
+
id="side-panel-story-text-input-b"></cds-text-input>
|
53
|
+
</div>
|
54
|
+
<div class="${storyPrefix}text-inputs">
|
55
|
+
<cds-text-input
|
56
|
+
label="Input C"
|
57
|
+
id="side-panel-story-text-input-c"></cds-text-input>
|
58
|
+
<cds-text-input
|
59
|
+
label="Input D"
|
60
|
+
id="side-panel-story-text-input-d"></cds-text-input>
|
61
|
+
</div>
|
62
|
+
<div class="${storyPrefix}textarea-container">
|
63
|
+
<cds-textarea label="Notes" value="This is a text area"></cds-textarea>
|
64
|
+
<cds-textarea label="Notes" value="This is a text area"></cds-textarea>
|
65
|
+
<cds-textarea label="Notes" value="This is a text area"></cds-textarea>
|
66
|
+
</div>
|
67
|
+
|
68
|
+
<!-- subtitle optional -->
|
69
|
+
<div slot="subtitle">
|
70
|
+
Subtitle text which can provide more detail on the content being displayed.
|
71
|
+
</div>
|
72
|
+
|
73
|
+
<!-- Action toolbar optional -->
|
74
|
+
<cds-button slot="action-toolbar">Copy</cds-button>
|
75
|
+
<cds-button
|
76
|
+
slot="action-toolbar"
|
77
|
+
aria-label="Settings"
|
78
|
+
has-icon-only="true"
|
79
|
+
kind="${BUTTON_KIND.GHOST}"
|
80
|
+
size="sm"
|
81
|
+
tooltip-text="Settings">
|
82
|
+
${Settings({ slot: 'icon' })}
|
83
|
+
</cds-button>
|
84
|
+
<cds-button
|
85
|
+
slot="action-toolbar"
|
86
|
+
aria-label="Delete"
|
87
|
+
has-icon-only="true"
|
88
|
+
kind="${BUTTON_KIND.GHOST}"
|
89
|
+
size="sm"
|
90
|
+
tooltip-text="Delete">
|
91
|
+
${Trashcan({ slot: 'icon' })}
|
92
|
+
</cds-button>
|
93
|
+
|
94
|
+
<!-- Side panel actions optional -->
|
95
|
+
<cds-button slot="actions" kind="${BUTTON_KIND.GHOST}">Ghost</cds-button>
|
96
|
+
<cds-button slot="actions" kind="${BUTTON_KIND.PRIMARY}"></cds-button>
|
97
|
+
</c4p-side-panel>
|
98
|
+
```
|
99
|
+
|
100
|
+
## `<c4p-side-panel>` attributes, properties and events
|
101
|
+
|
102
|
+
Note: For `boolean` attributes, `true` means simply setting the attribute (e.g.
|
103
|
+
`<c4p-side-panel open>`) and `false` means not setting the attribute (e.g.
|
104
|
+
`<c4p-side-panel>` without `open` attribute).
|
105
|
+
|
106
|
+
<ArgTypes of="c4p-side-panel" />
|