diff --git a/packages/carbon-web-components/.storybook/main.ts b/packages/carbon-web-components/.storybook/main.ts index da410a4c868..50961ac4838 100644 --- a/packages/carbon-web-components/.storybook/main.ts +++ b/packages/carbon-web-components/.storybook/main.ts @@ -28,6 +28,14 @@ const stories = glob.sync( '../src/**/overflow-menu.stories.ts', '../src/**/progress-indicator.mdx', '../src/**/progress-indicator.stories.ts', + '../src/**/skeleton-placeholder.mdx', + '../src/**/skeleton-placeholder.stories.ts', + '../src/**/skeleton-text.mdx', + '../src/**/skeleton-text.stories.ts', + '../src/**/skip-to-content.mdx', + '../src/**/skip-to-content.stories.ts', + '../src/**/slider.mdx', + '../src/**/slider.stories.ts', ], { ignore: ['../src/**/docs/*.mdx'], diff --git a/packages/carbon-web-components/src/components/skeleton-placeholder/skeleton-placeholder-story.ts b/packages/carbon-web-components/src/components/skeleton-placeholder/skeleton-placeholder-story.ts deleted file mode 100644 index 9cb37821bdf..00000000000 --- a/packages/carbon-web-components/src/components/skeleton-placeholder/skeleton-placeholder-story.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @license - * - * Copyright IBM Corp. 2019, 2023 - * - * This source code is licensed under the Apache-2.0 license found in the - * LICENSE file in the root directory of this source tree. - */ - -import { html } from 'lit'; -import './skeleton-placeholder'; -import storyDocs from './skeleton-placeholder-story.mdx'; - -export const Default = () => - html``; - -Default.storyName = 'Default'; - -Default.parameters = { - percy: { - skip: true, - }, -}; - -export default { - title: 'Components/Skeleton/Skeleton placeholder', - parameters: { - ...storyDocs.parameters, - }, -}; diff --git a/packages/carbon-web-components/src/components/skeleton-placeholder/skeleton-placeholder-story.mdx b/packages/carbon-web-components/src/components/skeleton-placeholder/skeleton-placeholder.mdx similarity index 72% rename from packages/carbon-web-components/src/components/skeleton-placeholder/skeleton-placeholder-story.mdx rename to packages/carbon-web-components/src/components/skeleton-placeholder/skeleton-placeholder.mdx index fcb3bf9676e..ef10759a074 100644 --- a/packages/carbon-web-components/src/components/skeleton-placeholder/skeleton-placeholder-story.mdx +++ b/packages/carbon-web-components/src/components/skeleton-placeholder/skeleton-placeholder.mdx @@ -1,5 +1,8 @@ -import { Props, Description } from '@storybook/addon-docs/blocks'; +import { ArgsTable, Meta, Markdown } from '@storybook/addon-docs/blocks'; import { cdnJs, cdnCss } from '../../globals/internal/storybook-cdn'; +import * as SkeletonPlaceholderStories from './skeleton-placeholder.stories'; + + # Skeleton placeholder @@ -19,8 +22,8 @@ Here's a quick example to get you started. import '@carbon/web-components/es/components/skeleton-placeholder/index.js'; ``` - - +{`${cdnJs({ components: ['skeleton-placeholder'] })}`} +{`${cdnCss()}`} ### HTML @@ -30,4 +33,4 @@ import '@carbon/web-components/es/components/skeleton-placeholder/index.js'; ## `` attributes, properties and events - + diff --git a/packages/carbon-web-components/src/components/skeleton-placeholder/skeleton-placeholder.stories.ts b/packages/carbon-web-components/src/components/skeleton-placeholder/skeleton-placeholder.stories.ts new file mode 100644 index 00000000000..0d455f997b1 --- /dev/null +++ b/packages/carbon-web-components/src/components/skeleton-placeholder/skeleton-placeholder.stories.ts @@ -0,0 +1,32 @@ +/** + * @license + * + * Copyright IBM Corp. 2019, 2024 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + */ + +import { html } from 'lit'; +import './skeleton-placeholder'; +import storyDocs from './skeleton-placeholder.mdx'; + +export const Default = { + parameters: { + percy: { + skip: true, + }, + }, + render: () => html``, +}; + +const meta = { + title: 'Components/Skeleton/Skeleton Placeholder', + parameters: { + docs: { + page: storyDocs, + }, + }, +}; + +export default meta; diff --git a/packages/carbon-web-components/src/components/skeleton-text/skeleton-text-story.ts b/packages/carbon-web-components/src/components/skeleton-text/skeleton-text-story.ts deleted file mode 100644 index 032c03c4dbc..00000000000 --- a/packages/carbon-web-components/src/components/skeleton-text/skeleton-text-story.ts +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @license - * - * Copyright IBM Corp. 2019, 2023 - * - * This source code is licensed under the Apache-2.0 license found in the - * LICENSE file in the root directory of this source tree. - */ - -import { html } from 'lit'; -import { boolean, number, select, text } from '@storybook/addon-knobs'; -import { ifDefined } from 'lit/directives/if-defined.js'; -import { prefix } from '../../globals/settings'; -import { SKELETON_TEXT_TYPE } from './skeleton-text'; -import storyDocs from './skeleton-text-story.mdx'; - -const types = { - Regular: null, - [`Heading (${SKELETON_TEXT_TYPE.HEADING})`]: SKELETON_TEXT_TYPE.HEADING, -}; - -export const Default = () => html` `; - -Default.storyName = 'Default'; - -Default.parameters = { - percy: { - skip: true, - }, -}; - -export const Playground = (args) => { - const { type, paragraph, lineCount, width } = - args?.[`${prefix}-skeleton-text`] ?? {}; - return html` - - - `; -}; - -Playground.parameters = { - knobs: { - [`${prefix}-skeleton-text`]: () => ({ - type: select('Skeleton text type (type)', types, null), - paragraph: boolean('Use multiple lines of text (paragraph)', true), - lineCount: number('The number of lines in a paragraph (lineCount)', 3), - width: text( - 'Width (in px or %) of single line of text or max-width of paragraph lines (width)', - '100%' - ), - }), - }, -}; - -export default { - title: 'Components/Skeleton/Skeleton text', - parameters: { - ...storyDocs.parameters, - percy: { - skip: true, - }, - }, -}; diff --git a/packages/carbon-web-components/src/components/skeleton-text/skeleton-text-story.mdx b/packages/carbon-web-components/src/components/skeleton-text/skeleton-text.mdx similarity index 78% rename from packages/carbon-web-components/src/components/skeleton-text/skeleton-text-story.mdx rename to packages/carbon-web-components/src/components/skeleton-text/skeleton-text.mdx index 860c3aee993..6a523900234 100644 --- a/packages/carbon-web-components/src/components/skeleton-text/skeleton-text-story.mdx +++ b/packages/carbon-web-components/src/components/skeleton-text/skeleton-text.mdx @@ -1,5 +1,8 @@ -import { Props, Description } from '@storybook/addon-docs/blocks'; +import { ArgsTable, Meta, Markdown } from '@storybook/addon-docs/blocks'; import { cdnJs, cdnCss } from '../../globals/internal/storybook-cdn'; +import * as SkeletonTextStories from './skeleton-text.stories'; + + # Skeleton text @@ -19,8 +22,8 @@ Here's a quick example to get you started. import '@carbon/web-components/es/components/skeleton-text/index.js'; ``` - - +{`${cdnJs({ components: ['skeleton-text'] })}`} +{`${cdnCss()}`} ### HTML @@ -41,4 +44,4 @@ multiple instances of ``. ## `` attributes and properties - + diff --git a/packages/carbon-web-components/src/components/skeleton-text/skeleton-text.stories.ts b/packages/carbon-web-components/src/components/skeleton-text/skeleton-text.stories.ts new file mode 100644 index 00000000000..107efa685ff --- /dev/null +++ b/packages/carbon-web-components/src/components/skeleton-text/skeleton-text.stories.ts @@ -0,0 +1,85 @@ +/** + * @license + * + * Copyright IBM Corp. 2019, 2024 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + */ + +import { html } from 'lit'; +import { ifDefined } from 'lit/directives/if-defined.js'; +import { SKELETON_TEXT_TYPE } from './skeleton-text'; +import storyDocs from './skeleton-text.mdx'; + +const types = { + Regular: null, + [`Heading (${SKELETON_TEXT_TYPE.HEADING})`]: SKELETON_TEXT_TYPE.HEADING, +}; + +const args = { + type: null, + paragraph: true, + lineCount: 3, + width: '100%', +}; + +const argTypes = { + type: { + control: 'select', + description: 'Indicate the type of skeleton text, heading or regular.', + options: types, + }, + paragraph: { + control: 'boolean', + description: 'Set this to true to generate multiple lines of text.', + }, + lineCount: { + control: 'number', + description: 'The number of lines shown if paragraph is true.', + }, + width: { + control: 'text', + description: + 'Width (in px or %) of single line of text or max-width of paragraph lines.', + }, +}; + +export const Default = { + parameters: { + percy: { + skip: true, + }, + }, + render: () => html``, +}; + +export const Playground = { + args, + argTypes, + render: (args) => { + const { type, paragraph, lineCount, width } = args ?? {}; + return html` + + + `; + }, +}; + +const meta = { + title: 'Components/Skeleton/Skeleton Text', + parameters: { + docs: { + page: storyDocs, + }, + percy: { + skip: true, + }, + }, +}; + +export default meta; diff --git a/packages/carbon-web-components/src/components/skip-to-content/skip-to-content-story.ts b/packages/carbon-web-components/src/components/skip-to-content/skip-to-content-story.ts deleted file mode 100644 index 58484d45702..00000000000 --- a/packages/carbon-web-components/src/components/skip-to-content/skip-to-content-story.ts +++ /dev/null @@ -1,75 +0,0 @@ -/** - * @license - * - * Copyright IBM Corp. 2020, 2023 - * - * This source code is licensed under the Apache-2.0 license found in the - * LICENSE file in the root directory of this source tree. - */ - -import { html } from 'lit'; -import './skip-to-content'; -import styles from './skip-to-content-story.scss?lit'; -import storyDocs from './skip-to-content-story.mdx'; -import { prefix } from '../../globals/settings'; - -export const Default = () => html` - -
-
-
-

Purpose and function

-

- The shell is perhaps the most crucial piece of any UI built with - Carbon. It contains the shared navigation framework for the entire - design system and ties the products in IBM’s portfolio together in a - cohesive and elegant way. The shell is the home of the topmost - navigation, where users can quickly and dependably gain their bearings - and move between pages. -
-
- The shell was designed with maximum flexibility built in, to serve the - needs of a broad range of products and users. Adopting the shell - ensures compliance with IBM design standards, simplifies development - efforts, and provides great user experiences. All IBM products built - with Carbon are required to use the shell’s header. -
-
- To better understand the purpose and function of the UI shell, - consider the “shell” of MacOS, which contains the Apple menu, - top-level navigation, and universal, OS-level controls at the top of - the screen, as well as a universal dock along the bottom or side of - the screen. The Carbon UI shell is roughly analogous in function to - these parts of the Mac UI. For example, the app switcher portion of - the shell can be compared to the dock in MacOS. -

-

Header responsive behavior

-

- As a header scales down to fit smaller screen sizes, headers with - persistent side nav menus should have the side nav collapse into - “hamburger” menu. See the example to better understand responsive - behavior of the header. -

-

Secondary navigation

-

- The side-nav contains secondary navigation and fits below the header. - It can be configured to be either fixed-width or flexible, with only - one level of nested items allowed. Both links and category lists can - be used in the side-nav and may be mixed together. There are several - configurations of the side-nav, but only one configuration should be - used per product section. If tabs are needed on a page when using a - side-nav, then the tabs are secondary in hierarchy to the side-nav. -

-
-
-
-`; - -export default { - title: 'Components/Skip to content', - parameters: { - ...storyDocs.parameters, - }, -}; diff --git a/packages/carbon-web-components/src/components/skip-to-content/skip-to-content-story.mdx b/packages/carbon-web-components/src/components/skip-to-content/skip-to-content.mdx similarity index 70% rename from packages/carbon-web-components/src/components/skip-to-content/skip-to-content-story.mdx rename to packages/carbon-web-components/src/components/skip-to-content/skip-to-content.mdx index 93c22b66d17..6c53a070adf 100644 --- a/packages/carbon-web-components/src/components/skip-to-content/skip-to-content-story.mdx +++ b/packages/carbon-web-components/src/components/skip-to-content/skip-to-content.mdx @@ -1,4 +1,8 @@ -import { Props } from '@storybook/addon-docs/blocks'; +import { ArgsTable, Meta, Markdown } from '@storybook/addon-docs/blocks'; +import { cdnJs, cdnCss } from '../../globals/internal/storybook-cdn'; +import * as SkipToContentStories from './skip-to-content.stories'; + + # Skip to content @@ -21,8 +25,8 @@ Here's a quick example to get you started. import '@carbon/web-components/es/components/skip-to-content/index.js'; ``` - - +{`${cdnJs({ components: ['skip-to-content'] })}`} +{`${cdnCss()}`} ### HTML @@ -32,4 +36,4 @@ import '@carbon/web-components/es/components/skip-to-content/index.js'; ## `` attributes and properties - + diff --git a/packages/carbon-web-components/src/components/skip-to-content/skip-to-content.stories.ts b/packages/carbon-web-components/src/components/skip-to-content/skip-to-content.stories.ts new file mode 100644 index 00000000000..1b653a4f272 --- /dev/null +++ b/packages/carbon-web-components/src/components/skip-to-content/skip-to-content.stories.ts @@ -0,0 +1,82 @@ +/** + * @license + * + * Copyright IBM Corp. 2020, 2024 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + */ + +import { html } from 'lit'; +import './skip-to-content'; +import styles from './skip-to-content-story.scss?lit'; +import storyDocs from './skip-to-content.mdx'; +import { prefix } from '../../globals/settings'; + +export const Default = { + render: () => html` + +
+
+
+

Purpose and function

+

+ The shell is perhaps the most crucial piece of any UI built with + Carbon. It contains the shared navigation framework for the entire + design system and ties the products in IBM’s portfolio together in a + cohesive and elegant way. The shell is the home of the topmost + navigation, where users can quickly and dependably gain their + bearings and move between pages. +
+
+ The shell was designed with maximum flexibility built in, to serve + the needs of a broad range of products and users. Adopting the shell + ensures compliance with IBM design standards, simplifies development + efforts, and provides great user experiences. All IBM products built + with Carbon are required to use the shell’s header. +
+
+ To better understand the purpose and function of the UI shell, + consider the “shell” of MacOS, which contains the Apple menu, + top-level navigation, and universal, OS-level controls at the top of + the screen, as well as a universal dock along the bottom or side of + the screen. The Carbon UI shell is roughly analogous in function to + these parts of the Mac UI. For example, the app switcher portion of + the shell can be compared to the dock in MacOS. +

+

Header responsive behavior

+

+ As a header scales down to fit smaller screen sizes, headers with + persistent side nav menus should have the side nav collapse into + “hamburger” menu. See the example to better understand responsive + behavior of the header. +

+

Secondary navigation

+

+ The side-nav contains secondary navigation and fits below the + header. It can be configured to be either fixed-width or flexible, + with only one level of nested items allowed. Both links and category + lists can be used in the side-nav and may be mixed together. There + are several configurations of the side-nav, but only one + configuration should be used per product section. If tabs are needed + on a page when using a side-nav, then the tabs are secondary in + hierarchy to the side-nav. +

+
+
+
+ `, +}; + +const meta = { + title: 'Components/Skip To Content', + parameters: { + docs: { + page: storyDocs, + }, + }, +}; + +export default meta; diff --git a/packages/carbon-web-components/src/components/slider/slider-story.ts b/packages/carbon-web-components/src/components/slider/slider-story.ts deleted file mode 100644 index 636955df9bb..00000000000 --- a/packages/carbon-web-components/src/components/slider/slider-story.ts +++ /dev/null @@ -1,223 +0,0 @@ -/** - * @license - * - * Copyright IBM Corp. 2019, 2023 - * - * This source code is licensed under the Apache-2.0 license found in the - * LICENSE file in the root directory of this source tree. - */ - -import { html } from 'lit'; -import { action } from '@storybook/addon-actions'; -import { boolean, number, text } from '@storybook/addon-knobs'; -import { ifDefined } from 'lit/directives/if-defined.js'; -import './slider'; -import './slider-input'; -import './slider-skeleton'; -import '../form/form-item'; -import '../layer'; -import storyDocs from './slider-story.mdx'; -import { prefix } from '../../globals/settings'; -import '../../../.storybook/templates/with-layer'; - -export const Default = () => { - return html` - - - - - - `; -}; - -export const ControlledSlider = () => { - let value = 87; - function onClick() { - value = Math.round(Math.random() * 100); - const sliders = document.getElementsByTagName('cds-slider'); - for (const slider of sliders) { - slider.setAttribute('value', `${value}`); - } - - const headers = document.getElementsByClassName('slider-headers'); - for (const header of headers) { - header.innerHTML = `${value}`; - } - } - return html` - - - - - - -

${value}

- `; -}; - -export const ControlledSliderWithLayer = () => { - let value = 87; - function onClick() { - value = Math.round(Math.random() * 100); - const sliders = document.getElementsByTagName('cds-slider'); - for (const slider of sliders) { - slider.setAttribute('value', `${value}`); - } - - const headers = document.getElementsByClassName('slider-headers'); - for (const header of headers) { - header.innerHTML = `${value}`; - } - } - - return html` - -
- - - - - - -

${value}

-
-
- `; -}; - -export const WithLayer = () => { - return html` - - - - - - - - `; -}; - -export const skeleton = () => - html` - - `; - -skeleton.parameters = { - percy: { - skip: true, - }, -}; - -export const Playground = (args) => { - const { - ariaLabelInput, - disabled, - hideTextInput, - invalid, - invalidText, - inputType, - labelText, - max, - min, - maxLabel, - minLabel, - name, - readonly, - required, - step, - stepMultiplier, - warn, - warnText, - value, - onChange, - } = args?.[`${prefix}-slider`] || {}; - return html` - - - ${!hideTextInput - ? html`` - : null} - - - `; -}; - -Playground.storyName = 'Playground'; - -Playground.parameters = { - knobs: { - [`${prefix}-slider`]: () => ({ - ariaLabelInput: text('Aria label for input (aria-label-input)', ''), - disabled: boolean('Disabled (disabled)', false), - hideTextInput: boolean('Hide text input (hide-text-input)', false), - labelText: text( - 'Label text (label-text)', - 'Slider (must be an increment of 5)' - ), - inputType: text('Input type (type)', 'number'), - invalid: boolean('Invalid (invalid)', false), - invalidText: text( - 'Invalid text (invalid-text)', - 'Invalid message goes here' - ), - name: text('Name (name)', ''), - max: number('Maximum value (max)', 100), - min: number('Minimum value (min)', 0), - maxLabel: text('Maximum value label (max-label)', ''), - minLabel: text('Minimum value label (min-label)', ''), - readonly: boolean('Readonly (readonly)', false), - required: boolean('Required (required)', false), - step: number('Step (step)', 5), - stepMultiplier: number('Step multiplier (step-multiplier)', 5), - warn: boolean('Warn (warn)', false), - warnText: text('Warn text (warn-text)', 'Warning message goes here'), - value: number('Value (value)', 50), - onAfterChange: action(`${prefix}-slider-changed`), - }), - }, -}; - -export default { - title: 'Components/Slider', - parameters: { - ...storyDocs.parameters, - }, -}; diff --git a/packages/carbon-web-components/src/components/slider/slider-story.mdx b/packages/carbon-web-components/src/components/slider/slider.mdx similarity index 85% rename from packages/carbon-web-components/src/components/slider/slider-story.mdx rename to packages/carbon-web-components/src/components/slider/slider.mdx index dbdad58c33b..b222f0b4641 100644 --- a/packages/carbon-web-components/src/components/slider/slider-story.mdx +++ b/packages/carbon-web-components/src/components/slider/slider.mdx @@ -1,5 +1,8 @@ -import { Props, Description } from '@storybook/addon-docs/blocks'; +import { ArgsTable, Meta, Markdown } from '@storybook/addon-docs/blocks'; import { cdnJs, cdnCss } from '../../globals/internal/storybook-cdn'; +import * as SliderStories from './slider.stories'; + + # Slider @@ -22,8 +25,8 @@ Here's a quick example to get you started. import '@carbon/web-components/es/components/slider/index.js'; ``` - - +{`${cdnJs({ components: ['slider'] })}`} +{`${cdnCss()}`} ### HTML @@ -60,7 +63,7 @@ Note: For `boolean` attributes, `true` means simply setting the attribute (e.g. ``) and `false` means not setting the attribute (e.g. `` without `disabled` attribute). - + ## `` attributes, properties and events @@ -68,4 +71,4 @@ Note: For `boolean` attributes, `true` means simply setting the attribute (e.g. ``) and `false` means not setting the attribute (e.g. `` without `invalid` attribute). - + diff --git a/packages/carbon-web-components/src/components/slider/slider.stories.ts b/packages/carbon-web-components/src/components/slider/slider.stories.ts new file mode 100644 index 00000000000..cfd4d3a7ea9 --- /dev/null +++ b/packages/carbon-web-components/src/components/slider/slider.stories.ts @@ -0,0 +1,306 @@ +/** + * @license + * + * Copyright IBM Corp. 2019, 2024 + * + * This source code is licensed under the Apache-2.0 license found in the + * LICENSE file in the root directory of this source tree. + */ + +import { html } from 'lit'; +import { ifDefined } from 'lit/directives/if-defined.js'; +import './index'; +import '../form/form-item'; +import '../layer'; +import storyDocs from './slider.mdx'; +import { prefix } from '../../globals/settings'; +import '../../../.storybook/templates/with-layer'; + +const args = { + ariaLabelInput: 'Lower bound', + disabled: false, + hideTextInput: false, + labelText: 'Slider (must be an increment of 5)', + invalid: false, + invalidText: 'Invalid message goes here', + max: 100, + min: 0, + readOnly: false, + required: false, + step: 5, + stepMultiplier: 5, + warn: false, + warnText: 'Warning message goes here', + value: 50, +}; + +const argTypes = { + ariaLabelInput: { + control: 'text', + description: + 'The ariaLabel for the <input>.', + }, + disabled: { + control: 'boolean', + description: 'true to disable this slider.', + }, + hideTextInput: { + control: 'boolean', + description: 'true to hide the number input box.', + }, + labelText: { + control: 'text', + description: 'Provide the text for the slider label.', + }, + inputType: { + control: 'text', + description: 'The type attribute of the <input>.', + }, + invalid: { + control: 'boolean', + description: 'Specify whether the Slider is currently invalid.', + }, + invalidText: { + control: 'text', + description: + 'Provide the text that is displayed when the Slider is in an invalid state.', + }, + name: { + control: 'text', + description: 'The name attribute of the <input>.', + }, + max: { + control: 'number', + description: 'The maximum value.', + }, + min: { + control: 'number', + description: 'The minimum value.', + }, + maxLabel: { + control: 'text', + description: 'The label associated with the maximum value.', + }, + minLabel: { + control: 'text', + description: 'The label associated with the minimum value.', + }, + readOnly: { + control: 'boolean', + description: 'Whether the slider should be read-only.', + }, + required: { + control: 'boolean', + description: 'true to specify if the control is required.', + }, + step: { + control: 'number', + description: + 'A value determining how much the value should increase/decrease by moving the thumb by mouse. If a value other than 1 is provided and the input is not hidden, the new step requirement should be added to a visible label. Values outside the step increment will be considered invalid.', + }, + stepMultiplier: { + control: 'number', + description: + 'A value determining how much the value should increase/decrease by Shift+arrow keys, which will be (max - min) / stepMultiplier.', + }, + warn: { + control: 'boolean', + description: 'Specify whether the control is currently in warning state.', + }, + warnText: { + control: 'text', + description: + 'Provide the text that is displayed when the control is in warning state.', + }, + value: { + control: 'number', + description: + 'The value of the slider. When there are two handles, value is the lower bound.', + }, + onAfterChange: { + action: `${prefix}-slider-changed`, + table: { + disable: true, + }, + }, +}; + +export const Default = { + render: () => { + return html` + + + + + + `; + }, +}; + +export const ControlledSlider = { + render: () => { + let value = 87; + function onClick() { + value = Math.round(Math.random() * 100); + const sliders = document.getElementsByTagName('cds-slider'); + for (const slider of sliders) { + slider.setAttribute('value', `${value}`); + } + + const headers = document.getElementsByClassName('slider-headers'); + for (const header of headers) { + header.innerHTML = `${value}`; + } + } + return html` + + + + + + +

${value}

+ `; + }, +}; + +export const ControlledSliderWithLayer = { + render: () => { + let value = 87; + function onClick() { + value = Math.round(Math.random() * 100); + const sliders = document.getElementsByTagName('cds-slider'); + for (const slider of sliders) { + slider.setAttribute('value', `${value}`); + } + + const headers = document.getElementsByClassName('slider-headers'); + for (const header of headers) { + header.innerHTML = `${value}`; + } + } + + return html` + +
+ + + + + + +

${value}

+
+
+ `; + }, +}; + +export const WithLayer = { + render: () => { + return html` + + + + + + + + `; + }, +}; + +export const Skeleton = { + parameters: { + percy: { + skip: true, + }, + }, + render: () => + html` + + `, +}; + +export const Playground = { + args, + argTypes, + render: (args) => { + const { + ariaLabelInput, + disabled, + hideTextInput, + invalid, + invalidText, + inputType, + labelText, + max, + min, + maxLabel, + minLabel, + name, + readOnly, + required, + step, + stepMultiplier, + warn, + warnText, + value, + onChange, + } = args || {}; + return html` + + + ${!hideTextInput + ? html`` + : null} + + + `; + }, +}; + +export default { + title: 'Components/Slider', + parameters: { + ...storyDocs.parameters, + }, +};