@carbon/ibm-products-web-components 0.3.0-canary.20 → 0.3.0-canary.30
Sign up to get free protection for your applications and to get access to all the features.
- package/.storybook/main.ts +13 -5
- package/CHANGELOG.md +8 -0
- package/es/components/side-panel/side-panel.d.ts +4 -4
- package/es/components/side-panel/side-panel.js +5 -5
- package/es/components/tearsheet/tearsheet.js +1 -1
- package/es/components/tearsheet/tearsheet.scss.js +1 -1
- package/es/globals/internal/storybook-cdn.js +80 -0
- package/es/globals/internal/storybook-cdn.js.map +1 -0
- package/es/packages/ibm-products-web-components/package.json.js +121 -0
- package/es/packages/ibm-products-web-components/package.json.js.map +1 -0
- package/lib/components/side-panel/side-panel.d.ts +4 -4
- package/package.json +5 -4
- package/scss/components/tearsheet/tearsheet.scss +6 -0
- package/src/components/side-panel/side-panel.mdx +1 -10
- package/src/components/side-panel/side-panel.stories.ts +1 -1
- package/src/components/side-panel/side-panel.ts +5 -5
- package/src/components/tearsheet/tearsheet.mdx +1 -9
- package/src/components/tearsheet/tearsheet.scss +6 -0
- package/src/components/tearsheet/tearsheet.stories.ts +52 -41
- package/src/components/tearsheet/tearsheet.ts +1 -1
- package/src/globals/internal/storybook-cdn.ts +69 -0
- package/tasks/build.js +2 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"storybook-cdn.js","sources":["../../../src/globals/internal/storybook-cdn.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2021, 2024\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport packageJson from '../../../package.json';\n\n/* eslint-disable max-len */\n\n/**\n *\n */\n/**\n * Renders the component(s) script tag content and returns back the string\n *\n * @param {Array} components array of component names\n * @param {string} tag tag folder\n */\nfunction _renderScript(components, tag) {\n let scripts = '';\n components.forEach((component) => {\n scripts += `<script type=\"module\" src=\"https://1.www.s81c.com/common/carbon/web-components/${tag}/${component}.min.js\"></script>\\n`;\n });\n return scripts;\n}\n\n/**\n * This is the markdown block for JS via CDN\n *\n * @param {Array} components array of components to render\n * @param components.components components to render\n */\nexport const cdnJs = ({ components }) => {\n return `\n### JS (via CDN)\n\n > NOTE: Only one version of artifacts should be used. Mixing versions will cause rendering issues.\n\n \\`\\`\\`html\n // SPECIFIC VERSION (available starting v2.0.0)\n ${_renderScript(components, `version/v${packageJson.version}`)}\n \\`\\`\\`\n\n #### Right-to-left (RTL) versions\n\n \\`\\`\\`html\n // SPECIFIC VERSION (available starting v2.0.0)\n ${_renderScript(components, `version/v${packageJson.version}`)}\n \\`\\`\\`\n `;\n};\n\n/**\n * This is the markdown block for CSS via CDN\n */\nexport const cdnCss = () => {\n return `\n### Carbon CDN style helpers (optional)\n\nThere are optional CDN artifacts available that can assist with global Carbon\nstyles in lieu of including into your specific application bundle.\n\n[Click here to learn more](https://github.com/carbon-design-system/carbon-for-ibm-dotcom/blob/main/packages/web-components/docs/carbon-cdn-style-helpers.md)\\n\\n\n `;\n};\n"],"names":[],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAIA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,aAAa,CAAC,UAAU,EAAE,GAAG,EAAE;AACxC,EAAE,IAAI,OAAO,GAAG,EAAE;AAClB,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,KAAK;AACpC,IAAI,OAAO,IAAI,CAAC,+EAA+E,EAAE,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,oBAAoB,CAAC;AACvI,GAAG,CAAC;AACJ,EAAE,OAAO,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,KAAK,GAAG,CAAC,EAAE,UAAU,EAAE,KAAK;AACzC,EAAE,OAAO;AACT;;AAEA;;AAEA;AACA;AACA,CAAC,EAAE,aAAa,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;AAC/D;;AAEA;;AAEA;AACA;AACA,CAAC,EAAE,aAAa,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;AAC/D;AACA,GAAG,CAAC;AACJ;;AAEA;AACA;AACA;AACY,MAAC,MAAM,GAAG,MAAM;AAC5B,EAAE,OAAO;AACT;;AAEA;AACA;;AAEA;AACA,EAAE,CAAC;AACH;;;;"}
|
@@ -0,0 +1,121 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 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
|
+
var name = "@carbon/ibm-products-web-components";
|
9
|
+
var description = "Carbon for IBM Products Web Components";
|
10
|
+
var version = "0.3.0";
|
11
|
+
var license = "Apache-2.0";
|
12
|
+
var main = "es/index.js";
|
13
|
+
var module = "es/index.js";
|
14
|
+
var type = "module";
|
15
|
+
var bugs = "https://github.com/carbon-design-system/ibm-products/issues";
|
16
|
+
var repository = {
|
17
|
+
type: "git",
|
18
|
+
url: "https://github.com/carbon-design-system/ibm-products.git",
|
19
|
+
directory: "packages/ibm-products-web-components"
|
20
|
+
};
|
21
|
+
var publishConfig = {
|
22
|
+
access: "public",
|
23
|
+
provenance: true
|
24
|
+
};
|
25
|
+
var exports = {
|
26
|
+
"./es/components/*": {
|
27
|
+
node: "./lib/components/*",
|
28
|
+
"default": "./es/components/*"
|
29
|
+
},
|
30
|
+
"./es/globals/*": {
|
31
|
+
node: "./lib/globals/*",
|
32
|
+
"default": "./es/globals/*"
|
33
|
+
},
|
34
|
+
"./es/*": "./es/*",
|
35
|
+
"./lib/*": "./lib/*",
|
36
|
+
"./custom-elements.json": "./custom-elements.json",
|
37
|
+
"./package.json": "./package.json"
|
38
|
+
};
|
39
|
+
var keywords = [
|
40
|
+
"carbon",
|
41
|
+
"carbon design system",
|
42
|
+
"carbon community",
|
43
|
+
"carbon for ibm products",
|
44
|
+
"carbon for ibm products web components",
|
45
|
+
"web components"
|
46
|
+
];
|
47
|
+
var scripts = {
|
48
|
+
build: "node tasks/build.js && yarn wca",
|
49
|
+
"build:storybook": "storybook build",
|
50
|
+
clean: "rimraf es lib scss dist storybook-static",
|
51
|
+
preview: "vite preview",
|
52
|
+
storybook: "storybook dev -p 3000",
|
53
|
+
test: "vitest run",
|
54
|
+
"test:ui": "vitest --ui",
|
55
|
+
wca: "web-component-analyzer analyze src --outFile custom-elements.json"
|
56
|
+
};
|
57
|
+
var dependencies = {
|
58
|
+
"@carbon/ibm-products-styles": "^2.50.0",
|
59
|
+
"@carbon/styles": "1.68.0",
|
60
|
+
"@carbon/web-components": "2.16.0",
|
61
|
+
lit: "^3.1.0"
|
62
|
+
};
|
63
|
+
var devDependencies = {
|
64
|
+
"@carbon/icons": "^11.52.0",
|
65
|
+
"@carbon/motion": "^11.24.0",
|
66
|
+
"@mordech/vite-lit-loader": "^0.35.0",
|
67
|
+
"@rollup/plugin-alias": "^5.1.1",
|
68
|
+
"@rollup/plugin-commonjs": "^28.0.1",
|
69
|
+
"@rollup/plugin-json": "^6.1.0",
|
70
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
71
|
+
"@rollup/plugin-typescript": "^12.1.1",
|
72
|
+
"@storybook/addon-essentials": "^8.3.6",
|
73
|
+
"@storybook/addon-links": "^8.3.6",
|
74
|
+
"@storybook/addon-storysource": "^8.3.6",
|
75
|
+
"@storybook/addon-toolbars": "^8.3.6",
|
76
|
+
"@storybook/blocks": "^8.3.6",
|
77
|
+
"@storybook/theming": "^8.3.6",
|
78
|
+
"@storybook/web-components": "^8.3.6",
|
79
|
+
"@storybook/web-components-vite": "^8.3.6",
|
80
|
+
"@types/jest": "^29.5.13",
|
81
|
+
"@vitest/browser": "latest",
|
82
|
+
"@vitest/ui": "latest",
|
83
|
+
autoprefixer: "^10.4.20",
|
84
|
+
cssnano: "^7.0.6",
|
85
|
+
eslint: "^9.11.1",
|
86
|
+
"eslint-config-carbon": "3.17.1",
|
87
|
+
globby: "^14.0.2",
|
88
|
+
"happy-dom": "^15.11.6",
|
89
|
+
postcss: "^8.4.47",
|
90
|
+
"remark-gfm": "^4.0.0",
|
91
|
+
rimraf: "^5.0.5",
|
92
|
+
rollup: "^4.27.3",
|
93
|
+
"rollup-plugin-copy": "^3.5.0",
|
94
|
+
sass: "^1.80.6",
|
95
|
+
storybook: "^8.2.8",
|
96
|
+
"storybook-addon-accessibility-checker": "^3.1.61-rc.3",
|
97
|
+
typescript: "^5.5.3",
|
98
|
+
vite: "^5.4.1",
|
99
|
+
vitest: "^2.1.2",
|
100
|
+
"web-component-analyzer": "2.0.0"
|
101
|
+
};
|
102
|
+
var packageJson = {
|
103
|
+
name: name,
|
104
|
+
description: description,
|
105
|
+
version: version,
|
106
|
+
license: license,
|
107
|
+
main: main,
|
108
|
+
module: module,
|
109
|
+
type: type,
|
110
|
+
bugs: bugs,
|
111
|
+
repository: repository,
|
112
|
+
publishConfig: publishConfig,
|
113
|
+
exports: exports,
|
114
|
+
keywords: keywords,
|
115
|
+
scripts: scripts,
|
116
|
+
dependencies: dependencies,
|
117
|
+
devDependencies: devDependencies
|
118
|
+
};
|
119
|
+
|
120
|
+
export { bugs, packageJson as default, dependencies, description, devDependencies, exports, keywords, license, main, module, name, publishConfig, repository, scripts, type, version };
|
121
|
+
//# sourceMappingURL=package.json.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"package.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -338,13 +338,13 @@ declare const CDSSidePanel_base: {
|
|
338
338
|
/**
|
339
339
|
* SidePanel.
|
340
340
|
*
|
341
|
-
* @element
|
341
|
+
* @element c4p-side-panel
|
342
342
|
* @csspart dialog The dialog.
|
343
|
-
* @fires
|
343
|
+
* @fires c4p-side-panel-beingclosed
|
344
344
|
* The custom event fired before this side-panel is being closed upon a user gesture.
|
345
345
|
* Cancellation of this event stops the user-initiated action of closing this side-panel.
|
346
|
-
* @fires
|
347
|
-
* @fires
|
346
|
+
* @fires c4p-side-panel-closed - The custom event fired after this side-panel is closed upon a user gesture.
|
347
|
+
* @fires c4p-side-panel-navigate-back - custom event fired when clicking navigate back (available when step > 0)
|
348
348
|
*/
|
349
349
|
declare class CDSSidePanel extends CDSSidePanel_base {
|
350
350
|
/**
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@carbon/ibm-products-web-components",
|
3
3
|
"description": "Carbon for IBM Products Web Components",
|
4
|
-
"version": "0.3.0-canary.
|
4
|
+
"version": "0.3.0-canary.30+cdd0b8eb3",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "es/index.js",
|
7
7
|
"module": "es/index.js",
|
@@ -49,7 +49,7 @@
|
|
49
49
|
"wca": "web-component-analyzer analyze src --outFile custom-elements.json"
|
50
50
|
},
|
51
51
|
"dependencies": {
|
52
|
-
"@carbon/ibm-products-styles": "^2.50.0
|
52
|
+
"@carbon/ibm-products-styles": "^2.50.0",
|
53
53
|
"@carbon/styles": "1.68.0",
|
54
54
|
"@carbon/web-components": "2.16.0",
|
55
55
|
"lit": "^3.1.0"
|
@@ -60,6 +60,7 @@
|
|
60
60
|
"@mordech/vite-lit-loader": "^0.35.0",
|
61
61
|
"@rollup/plugin-alias": "^5.1.1",
|
62
62
|
"@rollup/plugin-commonjs": "^28.0.1",
|
63
|
+
"@rollup/plugin-json": "^6.1.0",
|
63
64
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
64
65
|
"@rollup/plugin-typescript": "^12.1.1",
|
65
66
|
"@storybook/addon-essentials": "^8.3.6",
|
@@ -78,7 +79,7 @@
|
|
78
79
|
"eslint": "^9.11.1",
|
79
80
|
"eslint-config-carbon": "3.17.1",
|
80
81
|
"globby": "^14.0.2",
|
81
|
-
"happy-dom": "^15.
|
82
|
+
"happy-dom": "^15.11.6",
|
82
83
|
"postcss": "^8.4.47",
|
83
84
|
"remark-gfm": "^4.0.0",
|
84
85
|
"rimraf": "^5.0.5",
|
@@ -92,5 +93,5 @@
|
|
92
93
|
"vitest": "^2.1.2",
|
93
94
|
"web-component-analyzer": "2.0.0"
|
94
95
|
},
|
95
|
-
"gitHead": "
|
96
|
+
"gitHead": "cdd0b8eb39c0c4fd149bc77856385f6cd8c54fcc"
|
96
97
|
}
|
@@ -102,6 +102,12 @@ $motion-duration: $duration-moderate-02;
|
|
102
102
|
.#{$block-class}__influencer[wide] {
|
103
103
|
@extend .#{$block-class}__influencer--wide;
|
104
104
|
}
|
105
|
+
::slotted(#{$carbon-prefix}-slug) {
|
106
|
+
display: flex;
|
107
|
+
inset-inline-end: 0;
|
108
|
+
margin-block: 6px;
|
109
|
+
margin-inline-end: 1rem;
|
110
|
+
}
|
105
111
|
}
|
106
112
|
|
107
113
|
:host(#{$prefix}-tearsheet[open]) {
|
@@ -6,12 +6,6 @@ import * as SidePanelStories from './side-panel.stories';
|
|
6
6
|
|
7
7
|
# SidePanel
|
8
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
9
|
Side panels keep users in-context of a page while performing tasks like
|
16
10
|
navigating, editing, viewing details, or configuring something new.
|
17
11
|
|
@@ -22,16 +16,13 @@ Here's a quick example to get you started.
|
|
22
16
|
### JS (via import)
|
23
17
|
|
24
18
|
```javascript
|
25
|
-
import '@carbon/web-components/es/components/side-panel/index.js';
|
19
|
+
import '@carbon/ibm-products-web-components/es/components/side-panel/index.js';
|
26
20
|
// The following are used for slotted fields
|
27
21
|
import '@carbon/web-components/es/components/text-input/index.js';
|
28
22
|
import '@carbon/web-components/es/components/textarea/index.js';
|
29
23
|
import '@carbon/web-components/es/components/button/index.js';
|
30
24
|
```
|
31
25
|
|
32
|
-
<Markdown>{`${cdnJs({ components: ['side-panel'] })}`}</Markdown>
|
33
|
-
<Markdown>{`${cdnCss()}`}</Markdown>
|
34
|
-
|
35
26
|
### HTML
|
36
27
|
|
37
28
|
```html
|
@@ -432,7 +432,7 @@ const defaultTemplate = {
|
|
432
432
|
size=${args.size}
|
433
433
|
?slide-in=${args.slideIn}
|
434
434
|
.title=${args.title}
|
435
|
-
@
|
435
|
+
@c4p-side-panel-navigate-back=${prevStep}
|
436
436
|
>
|
437
437
|
<!-- default slotted content -->
|
438
438
|
${args.content}
|
@@ -85,13 +85,13 @@ function tryFocusElements(elements: NodeListOf<HTMLElement>, reverse: boolean) {
|
|
85
85
|
/**
|
86
86
|
* SidePanel.
|
87
87
|
*
|
88
|
-
* @element
|
88
|
+
* @element c4p-side-panel
|
89
89
|
* @csspart dialog The dialog.
|
90
|
-
* @fires
|
90
|
+
* @fires c4p-side-panel-beingclosed
|
91
91
|
* The custom event fired before this side-panel is being closed upon a user gesture.
|
92
92
|
* Cancellation of this event stops the user-initiated action of closing this side-panel.
|
93
|
-
* @fires
|
94
|
-
* @fires
|
93
|
+
* @fires c4p-side-panel-closed - The custom event fired after this side-panel is closed upon a user gesture.
|
94
|
+
* @fires c4p-side-panel-navigate-back - custom event fired when clicking navigate back (available when step > 0)
|
95
95
|
*/
|
96
96
|
@customElement(`${prefix}-side-panel`)
|
97
97
|
class CDSSidePanel extends HostListenerMixin(LitElement) {
|
@@ -913,7 +913,7 @@ class CDSSidePanel extends HostListenerMixin(LitElement) {
|
|
913
913
|
await (this.constructor as typeof CDSSidePanel)._delay();
|
914
914
|
if (focusNode) {
|
915
915
|
// For cases where a `carbon-web-components` component (e.g. `<cds-button>`) being `primaryFocusNode`,
|
916
|
-
// where its first update/render cycle that makes it focusable happens after `<
|
916
|
+
// where its first update/render cycle that makes it focusable happens after `<c4p-side-panel>`'s first update/render cycle
|
917
917
|
(focusNode as HTMLElement).focus();
|
918
918
|
} else if (
|
919
919
|
!tryFocusElements(
|
@@ -6,12 +6,6 @@ import * as TearsheetStories from './tearsheet.stories';
|
|
6
6
|
|
7
7
|
# Tearsheet
|
8
8
|
|
9
|
-
> 💡 Check our
|
10
|
-
> [Stackblitz](https://stackblitz.com/github/carbon-design-system/carbon/tree/main/packages/web-components/examples/components/tearsheet)
|
11
|
-
> example implementation.
|
12
|
-
|
13
|
-
[![Edit carbon-web-components](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/carbon-design-system/carbon/tree/main/packages/web-components/examples/components/tearsheet)
|
14
|
-
|
15
9
|
Tearsheets keep users in-context of a page while performing tasks like
|
16
10
|
navigating, editing, viewing details, or configuring something new.
|
17
11
|
|
@@ -22,15 +16,13 @@ Here's a quick example to get you started.
|
|
22
16
|
### JS (via import)
|
23
17
|
|
24
18
|
```javascript
|
25
|
-
import '@carbon/web-components/es/components/tearsheet/index.js';
|
19
|
+
import '@carbon/ibm-products-web-components/es/components/tearsheet/index.js';
|
26
20
|
// The following are used for slotted fields
|
27
21
|
import '@carbon/web-components/es/components/text-input/index.js';
|
28
22
|
import '@carbon/web-components/es/components/textarea/index.js';
|
29
23
|
import '@carbon/web-components/es/components/button/index.js';
|
30
24
|
```
|
31
25
|
|
32
|
-
<Markdown>{`${cdnJs({ components: ['tearsheet'] })}`}</Markdown>
|
33
|
-
<Markdown>{`${cdnCss()}`}</Markdown>
|
34
26
|
|
35
27
|
### HTML
|
36
28
|
|
@@ -102,6 +102,12 @@ $motion-duration: $duration-moderate-02;
|
|
102
102
|
.#{$block-class}__influencer[wide] {
|
103
103
|
@extend .#{$block-class}__influencer--wide;
|
104
104
|
}
|
105
|
+
::slotted(#{$carbon-prefix}-slug) {
|
106
|
+
display: flex;
|
107
|
+
inset-inline-end: 0;
|
108
|
+
margin-block: 6px;
|
109
|
+
margin-inline-end: 1rem;
|
110
|
+
}
|
105
111
|
}
|
106
112
|
|
107
113
|
:host(#{$prefix}-tearsheet[open]) {
|
@@ -16,6 +16,7 @@ import {
|
|
16
16
|
import './index';
|
17
17
|
import '@carbon/web-components/es/components/tabs/index.js';
|
18
18
|
import '@carbon/web-components/es/components/slug/index.js';
|
19
|
+
import '@carbon/web-components/es/components/dropdown/index.js';
|
19
20
|
import '@carbon/web-components/es/components/progress-indicator/index.js';
|
20
21
|
import '@carbon/web-components/es/components/progress-bar/index.js';
|
21
22
|
import '@carbon/web-components/es/components/button/index.js';
|
@@ -25,10 +26,15 @@ import { prefix } from '../../globals/settings';
|
|
25
26
|
|
26
27
|
import styles from './story-styles.scss?lit';
|
27
28
|
import { BUTTON_KIND } from '@carbon/web-components/es/components/button/defs.js';
|
29
|
+
|
28
30
|
const toggleButton = () => {
|
29
31
|
document.querySelector(`${prefix}-tearsheet`)?.toggleAttribute('open');
|
30
32
|
};
|
31
33
|
|
34
|
+
const cancelButton = () => {
|
35
|
+
document.querySelector(`${prefix}-tearsheet`)?.removeAttribute('open');
|
36
|
+
};
|
37
|
+
|
32
38
|
const widths = {
|
33
39
|
// 'default (narrow)': null,
|
34
40
|
[`Narrow (${TEARSHEET_WIDTH.NARROW})`]: TEARSHEET_WIDTH.NARROW,
|
@@ -205,7 +211,7 @@ const headerActions = {
|
|
205
211
|
const getActionToolbarItems = (index) => {
|
206
212
|
switch (index) {
|
207
213
|
case 1:
|
208
|
-
return html`<cds-dropdown slot="header-actions">
|
214
|
+
return html`<cds-dropdown slot="header-actions" value="option 1">
|
209
215
|
${['option 1', 'option 2', 'option 3', 'option 4'].map(
|
210
216
|
(option) => html` <cds-dropdown-item value="${option}"
|
211
217
|
>${option}</cds-dropdown-item
|
@@ -250,7 +256,12 @@ const actionItems = {
|
|
250
256
|
|
251
257
|
const toActions = (kinds: BUTTON_KIND[]) => {
|
252
258
|
return kinds?.map((kind) => {
|
253
|
-
return html`<cds-button
|
259
|
+
return html`<cds-button
|
260
|
+
key=${kind}
|
261
|
+
slot="actions"
|
262
|
+
kind=${kind}
|
263
|
+
@click=${kind === 'ghost' && cancelButton}
|
264
|
+
>
|
254
265
|
${kind.charAt(0).toUpperCase() + kind.slice(1)}
|
255
266
|
</cds-button>`;
|
256
267
|
});
|
@@ -359,21 +370,21 @@ const getSlug = (index) => {
|
|
359
370
|
|
360
371
|
export const Default = {
|
361
372
|
args: {
|
362
|
-
actionItems:
|
363
|
-
headerActions:
|
364
|
-
content:
|
365
|
-
label:
|
373
|
+
actionItems: 4,
|
374
|
+
headerActions: 0,
|
375
|
+
content: 2,
|
376
|
+
label: 1,
|
366
377
|
open: false,
|
367
378
|
influencerWidth: TEARSHEET_INFLUENCER_WIDTH.NARROW,
|
368
379
|
influencerPlacement: TEARSHEET_INFLUENCER_PLACEMENT.LEFT,
|
369
|
-
influencer:
|
380
|
+
influencer: 0,
|
370
381
|
preventCloseOnClickOutside: false,
|
371
382
|
selectorInitialFocus: '',
|
372
383
|
width: TEARSHEET_WIDTH.WIDE,
|
373
|
-
slug:
|
384
|
+
slug: 0,
|
374
385
|
description: 'Description used to describe the flow if need be.',
|
375
386
|
title: 'Title used to designate the overarching flow of the tearsheet.',
|
376
|
-
headerNavigation:
|
387
|
+
headerNavigation: 0,
|
377
388
|
},
|
378
389
|
argTypes: {
|
379
390
|
actionItems: {
|
@@ -465,10 +476,10 @@ export const Default = {
|
|
465
476
|
width=${args.width}
|
466
477
|
>
|
467
478
|
<!-- default slotted content -->
|
468
|
-
${args.content}
|
479
|
+
${getContent(args.content)}
|
469
480
|
|
470
481
|
<!-- slotted header label -->
|
471
|
-
${args.label}
|
482
|
+
${getLabel(args.label)}
|
472
483
|
|
473
484
|
<!-- slotted header title -->
|
474
485
|
${args.title ? html`<span slot="title">${args.title}</span>` : ''}
|
@@ -479,19 +490,19 @@ export const Default = {
|
|
479
490
|
: ''}
|
480
491
|
|
481
492
|
<!-- slotted action in header cds-buttons -->
|
482
|
-
${args.headerActions}
|
493
|
+
${getActionToolbarItems(args.headerActions)}
|
483
494
|
|
484
495
|
<!-- slotted action items cds-buttons -->
|
485
|
-
${args.actionItems}
|
496
|
+
${getActionItems(args.actionItems)}
|
486
497
|
|
487
498
|
<!-- slotted slug -->
|
488
|
-
${args.slug}
|
499
|
+
${getSlug(args.slug)}
|
489
500
|
|
490
501
|
<!-- slotted header-navigation -->
|
491
|
-
${args.headerNavigation}
|
502
|
+
${getNavigation(args.headerNavigation)}
|
492
503
|
|
493
504
|
<!-- slotted influencer -->
|
494
|
-
${args.influencer}
|
505
|
+
${getInfluencer(args.influencer)}
|
495
506
|
</c4p-tearsheet>
|
496
507
|
`;
|
497
508
|
},
|
@@ -501,7 +512,7 @@ export const WithNavigation = {
|
|
501
512
|
...Default,
|
502
513
|
args: {
|
503
514
|
...Default.args,
|
504
|
-
headerNavigation:
|
515
|
+
headerNavigation: 1,
|
505
516
|
},
|
506
517
|
};
|
507
518
|
|
@@ -509,7 +520,7 @@ export const WithInfluencer = {
|
|
509
520
|
...Default,
|
510
521
|
args: {
|
511
522
|
...Default.args,
|
512
|
-
influencer:
|
523
|
+
influencer: 2,
|
513
524
|
},
|
514
525
|
};
|
515
526
|
|
@@ -517,8 +528,8 @@ export const WithAllHeaderItemsAndInfluencer = {
|
|
517
528
|
...Default,
|
518
529
|
args: {
|
519
530
|
...Default.args,
|
520
|
-
headerActions:
|
521
|
-
influencer:
|
531
|
+
headerActions: 2,
|
532
|
+
influencer: 2,
|
522
533
|
},
|
523
534
|
};
|
524
535
|
|
@@ -581,10 +592,10 @@ export const StackingTemplate = {
|
|
581
592
|
<cds-button @click="${() => toggleButton('two')}"
|
582
593
|
>Toggle tearsheet two</cds-button
|
583
594
|
>
|
584
|
-
${args.content}
|
595
|
+
${getContent(args.content)}
|
585
596
|
|
586
597
|
<!-- slotted header label -->
|
587
|
-
${args.label}
|
598
|
+
${getLabel(args.label)}
|
588
599
|
|
589
600
|
<!-- slotted header title -->
|
590
601
|
${args.title ? html`<span slot="title">One ${args.title}</span>` : ''}
|
@@ -595,19 +606,19 @@ export const StackingTemplate = {
|
|
595
606
|
: ''}
|
596
607
|
|
597
608
|
<!-- slotted action in header cds-buttons -->
|
598
|
-
${args.headerActions}
|
609
|
+
${getActionToolbarItems(args.headerActions)}
|
599
610
|
|
600
611
|
<!-- slotted action items cds-buttons -->
|
601
|
-
${args.actionItems}
|
612
|
+
${getActionItems(args.actionItems)}
|
602
613
|
|
603
614
|
<!-- slotted slug -->
|
604
|
-
${args.slug}
|
615
|
+
${getSlug(args.slug)}
|
605
616
|
|
606
617
|
<!-- slotted header-navigation -->
|
607
|
-
${args.headerNavigation}
|
618
|
+
${getNavigation(args.headerNavigation)}
|
608
619
|
|
609
620
|
<!-- slotted influencer -->
|
610
|
-
${args.influencer}
|
621
|
+
${getInfluencer(args.influencer)}
|
611
622
|
</c4p-tearsheet>
|
612
623
|
<c4p-tearsheet
|
613
624
|
data-index="two"
|
@@ -624,10 +635,10 @@ export const StackingTemplate = {
|
|
624
635
|
<cds-button @click="${() => toggleButton('three')}"
|
625
636
|
>Toggle tearsheet three</cds-button
|
626
637
|
>
|
627
|
-
${args.content}
|
638
|
+
${getContent(args.content)}
|
628
639
|
|
629
640
|
<!-- slotted header label -->
|
630
|
-
${args.label}
|
641
|
+
${getLabel(args.label)}
|
631
642
|
|
632
643
|
<!-- slotted header title -->
|
633
644
|
${args.title ? html`<span slot="title">Two ${args.title}</span>` : ''}
|
@@ -638,19 +649,19 @@ export const StackingTemplate = {
|
|
638
649
|
: ''}
|
639
650
|
|
640
651
|
<!-- slotted action in header cds-buttons -->
|
641
|
-
${args.headerActions}
|
652
|
+
${getActionToolbarItems(args.headerActions)}
|
642
653
|
|
643
654
|
<!-- slotted action items cds-buttons -->
|
644
|
-
${args.actionItems}
|
655
|
+
${getActionItems(args.actionItems)}
|
645
656
|
|
646
657
|
<!-- slotted slug -->
|
647
|
-
${args.slug}
|
658
|
+
${getSlug(args.slug)}
|
648
659
|
|
649
660
|
<!-- slotted header-navigation -->
|
650
|
-
${args.headerNavigation}
|
661
|
+
${getNavigation(args.headerNavigation)}
|
651
662
|
|
652
663
|
<!-- slotted influencer -->
|
653
|
-
${args.influencer}
|
664
|
+
${getInfluencer(args.influencer)}
|
654
665
|
</c4p-tearsheet>
|
655
666
|
<c4p-tearsheet
|
656
667
|
data-index="three"
|
@@ -664,10 +675,10 @@ export const StackingTemplate = {
|
|
664
675
|
width=${args.width}
|
665
676
|
>
|
666
677
|
<!-- default slotted content -->
|
667
|
-
${args.content}
|
678
|
+
${getContent(args.content)}
|
668
679
|
|
669
680
|
<!-- slotted header label -->
|
670
|
-
${args.label}
|
681
|
+
${getLabel(args.label)}
|
671
682
|
|
672
683
|
<!-- slotted header title -->
|
673
684
|
${args.title ? html`<span slot="title">Three ${args.title}</span>` : ''}
|
@@ -678,19 +689,19 @@ export const StackingTemplate = {
|
|
678
689
|
: ''}
|
679
690
|
|
680
691
|
<!-- slotted action in header cds-buttons -->
|
681
|
-
${args.headerActions}
|
692
|
+
${getActionToolbarItems(args.headerActions)}
|
682
693
|
|
683
694
|
<!-- slotted action items cds-buttons -->
|
684
|
-
${args.actionItems}
|
695
|
+
${getActionItems(args.actionItems)}
|
685
696
|
|
686
697
|
<!-- slotted slug -->
|
687
|
-
${args.slug}
|
698
|
+
${getSlug(args.slug)}
|
688
699
|
|
689
700
|
<!-- slotted header-navigation -->
|
690
|
-
${args.headerNavigation}
|
701
|
+
${getNavigation(args.headerNavigation)}
|
691
702
|
|
692
703
|
<!-- slotted influencer -->
|
693
|
-
${args.influencer}
|
704
|
+
${getInfluencer(args.influencer)}
|
694
705
|
</c4p-tearsheet>
|
695
706
|
`;
|
696
707
|
},
|
@@ -314,7 +314,7 @@ class CDSTearsheet extends HostListenerMixin(LitElement) {
|
|
314
314
|
|
315
315
|
this._hasSlug = childItems.length > 0;
|
316
316
|
if (this._hasSlug) {
|
317
|
-
childItems[0].setAttribute('size', '
|
317
|
+
childItems[0].setAttribute('size', 'sm');
|
318
318
|
this.setAttribute('slug', '');
|
319
319
|
} else {
|
320
320
|
this.removeAttribute('slug');
|
@@ -0,0 +1,69 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
*
|
4
|
+
* Copyright IBM Corp. 2021, 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
|
+
import packageJson from '../../../package.json';
|
11
|
+
|
12
|
+
/* eslint-disable max-len */
|
13
|
+
|
14
|
+
/**
|
15
|
+
*
|
16
|
+
*/
|
17
|
+
/**
|
18
|
+
* Renders the component(s) script tag content and returns back the string
|
19
|
+
*
|
20
|
+
* @param {Array} components array of component names
|
21
|
+
* @param {string} tag tag folder
|
22
|
+
*/
|
23
|
+
function _renderScript(components, tag) {
|
24
|
+
let scripts = '';
|
25
|
+
components.forEach((component) => {
|
26
|
+
scripts += `<script type="module" src="https://1.www.s81c.com/common/carbon/web-components/${tag}/${component}.min.js"></script>\n`;
|
27
|
+
});
|
28
|
+
return scripts;
|
29
|
+
}
|
30
|
+
|
31
|
+
/**
|
32
|
+
* This is the markdown block for JS via CDN
|
33
|
+
*
|
34
|
+
* @param {Array} components array of components to render
|
35
|
+
* @param components.components components to render
|
36
|
+
*/
|
37
|
+
export const cdnJs = ({ components }) => {
|
38
|
+
return `
|
39
|
+
### JS (via CDN)
|
40
|
+
|
41
|
+
> NOTE: Only one version of artifacts should be used. Mixing versions will cause rendering issues.
|
42
|
+
|
43
|
+
\`\`\`html
|
44
|
+
// SPECIFIC VERSION (available starting v2.0.0)
|
45
|
+
${_renderScript(components, `version/v${packageJson.version}`)}
|
46
|
+
\`\`\`
|
47
|
+
|
48
|
+
#### Right-to-left (RTL) versions
|
49
|
+
|
50
|
+
\`\`\`html
|
51
|
+
// SPECIFIC VERSION (available starting v2.0.0)
|
52
|
+
${_renderScript(components, `version/v${packageJson.version}`)}
|
53
|
+
\`\`\`
|
54
|
+
`;
|
55
|
+
};
|
56
|
+
|
57
|
+
/**
|
58
|
+
* This is the markdown block for CSS via CDN
|
59
|
+
*/
|
60
|
+
export const cdnCss = () => {
|
61
|
+
return `
|
62
|
+
### Carbon CDN style helpers (optional)
|
63
|
+
|
64
|
+
There are optional CDN artifacts available that can assist with global Carbon
|
65
|
+
styles in lieu of including into your specific application bundle.
|
66
|
+
|
67
|
+
[Click here to learn more](https://github.com/carbon-design-system/carbon-for-ibm-dotcom/blob/main/packages/web-components/docs/carbon-cdn-style-helpers.md)\n\n
|
68
|
+
`;
|
69
|
+
};
|
package/tasks/build.js
CHANGED
@@ -22,6 +22,7 @@ import nodeResolve from '@rollup/plugin-node-resolve';
|
|
22
22
|
import path from 'path';
|
23
23
|
import postcss from 'postcss';
|
24
24
|
import typescript from '@rollup/plugin-typescript';
|
25
|
+
import json from '@rollup/plugin-json';
|
25
26
|
|
26
27
|
import * as packageJson from '../package.json' assert { type: 'json' };
|
27
28
|
|
@@ -125,6 +126,7 @@ function getRollupConfig(input, rootDir, outDir, iconInput) {
|
|
125
126
|
targets: [{ src: 'src/components/**/*.scss', dest: 'scss' }],
|
126
127
|
flatten: false,
|
127
128
|
}),
|
129
|
+
[json()],
|
128
130
|
nodeResolve({
|
129
131
|
browser: true,
|
130
132
|
mainFields: ['jsnext', 'module', 'main'],
|