@carbon/ibm-products-web-components 0.3.0-canary.26 → 0.3.0-canary.30

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,20 @@
1
1
  import { mergeConfig } from 'vite';
2
2
  import { litStyleLoader, litTemplateLoader } from '@mordech/vite-lit-loader';
3
3
  import viteSVGResultCarbonIconLoader from '../tools/vite-svg-result-carbon-icon-loader';
4
-
4
+ const glob = require('fast-glob');
5
+ const stories = glob.sync(
6
+ [
7
+ '../docs/**/*.mdx',
8
+ '../src/**/*.mdx',
9
+ '../src/**/*.stories.@(js|jsx|ts|tsx)',
10
+ ],
11
+ {
12
+ ignore: ['../src/**/docs/*.mdx'],
13
+ cwd: __dirname,
14
+ }
15
+ );
5
16
  const config = {
6
- stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
17
+ stories: stories,
7
18
  addons: [
8
19
  '@storybook/addon-links',
9
20
  '@storybook/addon-toolbars',
@@ -23,9 +34,6 @@ const config = {
23
34
  name: '@storybook/web-components-vite',
24
35
  options: {},
25
36
  },
26
- docs: {
27
- autodocs: 'tag',
28
- },
29
37
  async viteFinal(config) {
30
38
  return mergeConfig(config, {
31
39
  plugins: [
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.3.0](https://github.com/carbon-design-system/ibm-products/compare/@carbon/ibm-products-web-components@0.3.0-rc.1...@carbon/ibm-products-web-components@0.3.0) (2024-11-20)
7
+
8
+ **Note:** Version bump only for package @carbon/ibm-products-web-components
9
+
10
+
11
+
12
+
13
+
6
14
  # 0.3.0-rc.1 (2024-11-15)
7
15
 
8
16
 
@@ -338,13 +338,13 @@ declare const CDSSidePanel_base: {
338
338
  /**
339
339
  * SidePanel.
340
340
  *
341
- * @element cds-side-panel
341
+ * @element c4p-side-panel
342
342
  * @csspart dialog The dialog.
343
- * @fires cds-side-panel-beingclosed
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 cds-side-panel-closed - The custom event fired after this side-panel is closed upon a user gesture.
347
- * @fires cds-side-panel-navigate-back - custom event fired when clicking navigate back (available when step > 0)
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
  /**
@@ -73,13 +73,13 @@ function tryFocusElements(elements, reverse) {
73
73
  /**
74
74
  * SidePanel.
75
75
  *
76
- * @element cds-side-panel
76
+ * @element c4p-side-panel
77
77
  * @csspart dialog The dialog.
78
- * @fires cds-side-panel-beingclosed
78
+ * @fires c4p-side-panel-beingclosed
79
79
  * The custom event fired before this side-panel is being closed upon a user gesture.
80
80
  * Cancellation of this event stops the user-initiated action of closing this side-panel.
81
- * @fires cds-side-panel-closed - The custom event fired after this side-panel is closed upon a user gesture.
82
- * @fires cds-side-panel-navigate-back - custom event fired when clicking navigate back (available when step > 0)
81
+ * @fires c4p-side-panel-closed - The custom event fired after this side-panel is closed upon a user gesture.
82
+ * @fires c4p-side-panel-navigate-back - custom event fired when clicking navigate back (available when step > 0)
83
83
  */
84
84
  let CDSSidePanel = class CDSSidePanel extends HostListenerMixin(LitElement) {
85
85
  constructor() {
@@ -660,7 +660,7 @@ let CDSSidePanel = class CDSSidePanel extends HostListenerMixin(LitElement) {
660
660
  await this.constructor._delay();
661
661
  if (focusNode) {
662
662
  // For cases where a `carbon-web-components` component (e.g. `<cds-button>`) being `primaryFocusNode`,
663
- // where its first update/render cycle that makes it focusable happens after `<cds-side-panel>`'s first update/render cycle
663
+ // where its first update/render cycle that makes it focusable happens after `<c4p-side-panel>`'s first update/render cycle
664
664
  focusNode.focus();
665
665
  }
666
666
  else if (!tryFocusElements(this.querySelectorAll(this.constructor.selectorTabbable))) {
@@ -0,0 +1,80 @@
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
+ import packageJson from '../../packages/ibm-products-web-components/package.json.js';
9
+
10
+ /**
11
+ * @license
12
+ *
13
+ * Copyright IBM Corp. 2021, 2024
14
+ *
15
+ * This source code is licensed under the Apache-2.0 license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */
18
+
19
+
20
+ /* eslint-disable max-len */
21
+
22
+ /**
23
+ *
24
+ */
25
+ /**
26
+ * Renders the component(s) script tag content and returns back the string
27
+ *
28
+ * @param {Array} components array of component names
29
+ * @param {string} tag tag folder
30
+ */
31
+ function _renderScript(components, tag) {
32
+ let scripts = '';
33
+ components.forEach((component) => {
34
+ scripts += `<script type="module" src="https://1.www.s81c.com/common/carbon/web-components/${tag}/${component}.min.js"></script>\n`;
35
+ });
36
+ return scripts;
37
+ }
38
+
39
+ /**
40
+ * This is the markdown block for JS via CDN
41
+ *
42
+ * @param {Array} components array of components to render
43
+ * @param components.components components to render
44
+ */
45
+ const cdnJs = ({ components }) => {
46
+ return `
47
+ ### JS (via CDN)
48
+
49
+ > NOTE: Only one version of artifacts should be used. Mixing versions will cause rendering issues.
50
+
51
+ \`\`\`html
52
+ // SPECIFIC VERSION (available starting v2.0.0)
53
+ ${_renderScript(components, `version/v${packageJson.version}`)}
54
+ \`\`\`
55
+
56
+ #### Right-to-left (RTL) versions
57
+
58
+ \`\`\`html
59
+ // SPECIFIC VERSION (available starting v2.0.0)
60
+ ${_renderScript(components, `version/v${packageJson.version}`)}
61
+ \`\`\`
62
+ `;
63
+ };
64
+
65
+ /**
66
+ * This is the markdown block for CSS via CDN
67
+ */
68
+ const cdnCss = () => {
69
+ return `
70
+ ### Carbon CDN style helpers (optional)
71
+
72
+ There are optional CDN artifacts available that can assist with global Carbon
73
+ styles in lieu of including into your specific application bundle.
74
+
75
+ [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
76
+ `;
77
+ };
78
+
79
+ export { cdnCss, cdnJs };
80
+ //# sourceMappingURL=storybook-cdn.js.map
@@ -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 cds-side-panel
341
+ * @element c4p-side-panel
342
342
  * @csspart dialog The dialog.
343
- * @fires cds-side-panel-beingclosed
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 cds-side-panel-closed - The custom event fired after this side-panel is closed upon a user gesture.
347
- * @fires cds-side-panel-navigate-back - custom event fired when clicking navigate back (available when step > 0)
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.26+2461f8120",
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-rc.1",
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",
@@ -92,5 +93,5 @@
92
93
  "vitest": "^2.1.2",
93
94
  "web-component-analyzer": "2.0.0"
94
95
  },
95
- "gitHead": "2461f8120431c125ceb826ccb5d139a82d49f39c"
96
+ "gitHead": "cdd0b8eb39c0c4fd149bc77856385f6cd8c54fcc"
96
97
  }
@@ -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
- @cds-side-panel-navigate-back=${prevStep}
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 cds-side-panel
88
+ * @element c4p-side-panel
89
89
  * @csspart dialog The dialog.
90
- * @fires cds-side-panel-beingclosed
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 cds-side-panel-closed - The custom event fired after this side-panel is closed upon a user gesture.
94
- * @fires cds-side-panel-navigate-back - custom event fired when clicking navigate back (available when step > 0)
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 `<cds-side-panel>`'s first update/render cycle
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
 
@@ -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'],