diff --git a/packages/components/src/components/chip/__snapshots__/chip.spec.ts.snap b/packages/components/src/components/chip/__snapshots__/chip.spec.ts.snap new file mode 100644 index 0000000000..95f6118f16 --- /dev/null +++ b/packages/components/src/components/chip/__snapshots__/chip.spec.ts.snap @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Chip should match snapshot 1`] = ` + + + + + + + + + + Label + +`; diff --git a/packages/components/src/components/chip/chip.css b/packages/components/src/components/chip/chip.css new file mode 100644 index 0000000000..a48ff209d8 --- /dev/null +++ b/packages/components/src/components/chip/chip.css @@ -0,0 +1,169 @@ +/** + * @license + * Scale https://github.com/telekom/scale + * + * Copyright (c) 2021 Egor Kirpichev and contributors, Deutsche Telekom AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +:host { + --font-size: var(--telekom-typography-font-size-body); + --line-height: var(--telekom-typography-line-spacing-standard); + --font-weight: var(--telekom-typography-font-weight-bold); + --color-focus: var(--telekom-color-functional-focus); + --focus-outline: var(--telekom-line-weight-highlight) solid + var(--telekom-color-functional-focus); + --box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1), 0px 2px 8px rgba(0, 0, 0, 0.1); + + /*standard selected*/ + --background-standard-selected: var(--telekom-color-ui-extra-strong); + --color-standard-selected: var( + --telekom-color-text-and-icon-inverted-standard + ); +} +/**TODO: colors unexplained in figma **/ +.chip { + border: var(--telekom-spacing-unit-x025) solid transparent; + display: inline-flex; + outline: none; + padding: 0 var(--telekom-spacing-unit-x3); + text-align: center; + align-items: center; + white-space: nowrap; + border-radius: 1rem; + border-color: rgba(255, 255, 255, 0.14); + height: 32px; + vertical-align: baseline; + justify-content: center; + cursor: default; + color: var(--telekom-color-text-and-icon-standard); + background: var(--telekom-color-text-and-icon-inverted-standard); + border: 1px solid var(--telekom-color-ui-border-standard); +} + +.chip:not(.chip--disabled):focus, +.chip.chip--type-dynamic:not(.chip--selected):focus { + outline: var(--telekom-spacing-unit-x05) solid var(--color-focus); + outline-offset: var(--telekom-spacing-unit-x025); +} + +.chip:not(.chip--disabled):hover, +.chip.chip--type-dynamic:not(.chip--selected):hover { + background: linear-gradient( + var(--telekom-color-ui-state-fill-hovered), + var(--telekom-color-ui-state-fill-hovered) + ), + var(--telekom-color-text-and-icon-inverted-standard); +} + +.chip:not(.chip--disabled):active, +.chip.chip--type-dynamic:not(.chip--selected):active { + background: linear-gradient( + var(--telekom-color-ui-state-fill-pressed), + var(--telekom-color-ui-state-fill-pressed) + ), + var(--telekom-color-text-and-icon-inverted-standard); +} + +.chip--selected { + background: var(--background-standard-selected); + color: var(--color-standard-selected); +} + +.chip--selected:not(.chip--disabled):hover { + background: linear-gradient( + var(--telekom-color-ui-state-fill-hovered-inverted), + var(--telekom-color-ui-state-fill-hovered-inverted) + ), + var(--background-standard-selected); +} + +.chip--selected:not(.chip--disabled):active { + background: linear-gradient( + var(--telekom-color-ui-state-fill-pressed-inverted), + var(--telekom-color-ui-state-fill-pressed-inverted) + ), + var(--background-standard-selected); +} + +/** +label +**/ + +.chip-label { + padding: 0 var(--telekom-spacing-unit-x1) 0 var(--telekom-spacing-unit-x1); + font-weight: var(--telekom-typography-font-weight-bold); + font-size: 1rem; + line-height: 100%; +} + +.chip--type-dynamic.chip--selected .chip-label, +.chip--selected .chip-label { + padding-right: var(--telekom-spacing-unit-x2); +} + +/** +icon front (slot) +**/ + +.chip slot[name='chip-icon']::slotted(*) { + padding-right: var(--telekom-spacing-unit-x1); + padding-top: var(--telekom-spacing-unit-x1); +} + +/** +icon end +*/ + +/** +disabled +**/ +.chip.chip--disabled:not(.chip--type-dynamic) { + color: var(--telekom-color-text-and-icon-disabled); + border: 1px solid var(--telekom-color-ui-border-disabled); +} + +.chip--selected:not(.chip--variant-outlined):not(.chip--type-dynamic).chip--disabled { + background: var(--telekom-color-ui-disabled); + color: var(--telekom-color-text-and-icon-disabled); + border: none; +} + +.chip--variant-outlined.chip--selected.chip--disabled:not(.chip--type-dynamic) { + background-color: var(--telekom-color-text-and-icon-inverted-standard); + color: var(--telekom-color-text-and-icon-disabled); + border: 1px solid var(--telekom-color-ui-border-disabled); +} + +/** +variant outline +**/ + +.chip.chip--variant-outline.chip--selected { + color: var(--telekom-color-text-and-icon-primary-standard); + background: var(--telekom-color-text-and-icon-inverted-standard); + border: 1px solid var(--telekom-color-text-and-icon-primary-standard); +} + +.chip.chip--variant-outline.chip--selected:not(.chip.chip--disabled):hover { + background: linear-gradient( + var(--telekom-color-ui-state-fill-hovered), + var(--telekom-color-ui-state-fill-hovered) + ), + var(--telekom-color-text-and-icon-inverted-standard); + color: var(--telekom-color-text-and-icon-primary-hovered); + border: 1px solid var(--telekom-color-text-and-icon-primary-hovered); +} + +.chip.chip--variant-outline.chip--selected:not(.chip.chip--disabled):active { + background: linear-gradient( + var(--telekom-color-ui-state-fill-pressed), + var(--telekom-color-ui-state-fill-pressed) + ), + var(--telekom-color-text-and-icon-inverted-standard); + color: var(--telekom-color-text-and-icon-primary-pressed); + border: 1px solid var(--telekom-color-text-and-icon-primary-pressed); +} diff --git a/packages/components/src/components/chip/chip.spec.ts b/packages/components/src/components/chip/chip.spec.ts new file mode 100644 index 0000000000..59d82d1029 --- /dev/null +++ b/packages/components/src/components/chip/chip.spec.ts @@ -0,0 +1,25 @@ +import { newSpecPage } from '@stencil/core/testing'; +import { Chip } from './chip'; + +describe('Chip', () => { + let element; + + beforeEach(async () => { + element = new Chip(); + }); + + it('should match snapshot', async () => { + const page = await newSpecPage({ + components: [Chip], + html: `Label`, + }); + expect(page.root).toMatchSnapshot(); + }); + it('should handle css classes', () => { + element.selected = true; + expect(element.getCssClassMap()).toContain('chip--selected'); + + element.disabled = true; + expect(element.getCssClassMap()).toContain('chip--disabled'); + }); +}); diff --git a/packages/components/src/components/chip/chip.tsx b/packages/components/src/components/chip/chip.tsx new file mode 100644 index 0000000000..1faf66c65c --- /dev/null +++ b/packages/components/src/components/chip/chip.tsx @@ -0,0 +1,171 @@ +/** + * @license + * Scale https://github.com/telekom/scale + * + * Copyright (c) 2021 Egor Kirpichev and contributors, Deutsche Telekom AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import { + Component, + Prop, + h, + Host, + Event, + EventEmitter, + Element, +} from '@stencil/core'; +import classNames from 'classnames'; +import { emitEvent } from '../../utils/utils'; +@Component({ + tag: 'scale-chip', + styleUrl: './chip.css', + shadow: true, +}) +export class Chip { + @Element() hostElement: HTMLElement; + /** (optional) */ + @Prop() variant?: 'standard' | 'outline' = 'standard'; + /** (optional) */ + @Prop() type?: 'dynamic' | 'persistent' = 'persistent'; + /** (optional) */ + @Prop() selected?: boolean = false; + /** (optional) chip aria-role */ + @Prop() ariaRoleTitle?: string = 'switch'; + /** (optional) chip aria-checked */ + @Prop() ariaCheckedState?: boolean; + /** (optional) chip label */ + @Prop() label?: string; + /** (optional) chip disabled */ + @Prop() disabled?: boolean = false; + /** (optional) Injected CSS styles */ + @Prop() styles?: string; + + /** (optional) Change icon click event */ + @Event({ eventName: 'scale-change' }) scaleChange: EventEmitter; + /** @deprecated in v3 in favor of kebab-case event names */ + @Event({ eventName: 'scaleChange' }) + scaleChangeLegacy: EventEmitter; + /** (optional) Close icon click event */ + @Event({ eventName: 'scale-close' }) scaleClose: EventEmitter; + /** @deprecated in v3 in favor of kebab-case event names */ + @Event({ eventName: 'scaleClose' }) + scaleCloseLegacy: EventEmitter; + + componentDidRender() { + // handle no setted icon size attribute + const defaultIconSize = 24; + const iconSlot = this.hostElement.querySelector( + '[slot="chip-icon"]' + ) as HTMLElement; + if (iconSlot !== null) { + if ( + iconSlot.children[0].getAttribute('size') === String(defaultIconSize) + ) { + iconSlot.children[0].setAttribute('size', String(16)); + } + if (this.selected) { + iconSlot.children[0].setAttribute('selected', String(true)); + } else { + iconSlot.children[0].setAttribute('selected', String(false)); + } + } + } + disconnectedCallback() {} + + handleClose = (event: MouseEvent) => { + event.preventDefault(); + event.stopPropagation(); + if (this.disabled && this.type !== 'dynamic') { + return; + } + emitEvent(this, 'scaleClose', event); + }; + + handleClick = (event: MouseEvent) => { + if (this.type !== 'dynamic') { + this.selected = !this.selected; + } + event.preventDefault(); + event.stopPropagation(); + if (this.disabled && this.type !== 'dynamic') { + return; + } + emitEvent(this, 'scaleChange', event); + }; + + getIcon() { + if (this.type === 'dynamic' && this.selected) { + return ( + + ); + } else if (this.type === 'persistent' && this.selected) { + return ( + + ); + } else if (this.type === 'persistent') { + return ( + + ); + } + } + + render() { + return ( + + {this.styles && } + + + + + + {this.selected ? this.getIcon() : null} + + + ); + } + + getBasePartMap() { + return this.getCssOrBasePartMap('basePart'); + } + + getCssClassMap() { + return this.getCssOrBasePartMap('css'); + } + + getCssOrBasePartMap(mode: 'basePart' | 'css') { + const component = 'chip'; + const prefix = mode === 'basePart' ? '' : `${component}--`; + + return classNames( + mode === 'basePart' ? 'base' : component, + !!this.selected && `${prefix}selected`, + !!this.disabled && `${prefix}disabled`, + this.type && `${prefix}type-${this.type}`, + this.variant && `${prefix}variant-${this.variant}` + ); + } +} diff --git a/packages/components/src/components/chip/readme.md b/packages/components/src/components/chip/readme.md new file mode 100644 index 0000000000..0c842a84a4 --- /dev/null +++ b/packages/components/src/components/chip/readme.md @@ -0,0 +1,49 @@ +# scale-chip + + + + + + +## Properties + +| Property | Attribute | Description | Type | Default | +| ------------------ | -------------------- | ------------------------------ | --------------------------- | -------------- | +| `ariaCheckedState` | `aria-checked-state` | (optional) chip aria-checked | `boolean` | `undefined` | +| `ariaRoleTitle` | `aria-role-title` | (optional) chip aria-role | `string` | `'switch'` | +| `disabled` | `disabled` | (optional) chip disabled | `boolean` | `false` | +| `label` | `label` | (optional) chip label | `string` | `undefined` | +| `selected` | `selected` | (optional) | `boolean` | `false` | +| `styles` | `styles` | (optional) Injected CSS styles | `string` | `undefined` | +| `type` | `type` | (optional) | `"dynamic" \| "persistent"` | `'persistent'` | +| `variant` | `variant` | (optional) | `"outline" \| "standard"` | `'standard'` | + + +## Events + +| Event | Description | Type | +| -------------- | -------------------------------------------------------------------------------------------------- | ------------------------- | +| `scale-change` | (optional) Change icon click event | `CustomEvent` | +| `scale-close` | (optional) Close icon click event | `CustomEvent` | +| `scaleChange` | **[DEPRECATED]** in v3 in favor of kebab-case event names

| `CustomEvent` | +| `scaleClose` | **[DEPRECATED]** in v3 in favor of kebab-case event names

| `CustomEvent` | + + +## Dependencies + +### Depends on + +- [scale-icon-action-close](../icons/action-close) +- [scale-icon-action-success](../icons/action-success) + +### Graph +```mermaid +graph TD; + scale-chip --> scale-icon-action-close + scale-chip --> scale-icon-action-success + style scale-chip fill:#f9f,stroke:#333,stroke-width:4px +``` + +---------------------------------------------- + +*Built with [StencilJS](https://stenciljs.com/)* diff --git a/packages/components/src/components/helper-text/readme.md b/packages/components/src/components/helper-text/readme.md index a12da92bd8..1c3ccd0186 100644 --- a/packages/components/src/components/helper-text/readme.md +++ b/packages/components/src/components/helper-text/readme.md @@ -38,6 +38,7 @@ - [scale-dropdown](../dropdown) - [scale-dropdown-select](../dropdown-select) + - [scale-segmented-button](../segmented-button) - [scale-text-field](../text-field) ### Depends on @@ -54,6 +55,7 @@ graph TD; scale-helper-text --> scale-icon-alert-success scale-dropdown --> scale-helper-text scale-dropdown-select --> scale-helper-text + scale-segmented-button --> scale-helper-text scale-text-field --> scale-helper-text style scale-helper-text fill:#f9f,stroke:#333,stroke-width:4px ``` diff --git a/packages/components/src/components/segment/__snapshots__/segment.spec.ts.snap b/packages/components/src/components/segment/__snapshots__/segment.spec.ts.snap new file mode 100644 index 0000000000..5fbf4a3cae --- /dev/null +++ b/packages/components/src/components/segment/__snapshots__/segment.spec.ts.snap @@ -0,0 +1,20 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Segment should match standard snapshot 1`] = ` + + + + + Label + +`; diff --git a/packages/components/src/components/segment/readme.md b/packages/components/src/components/segment/readme.md new file mode 100644 index 0000000000..d1114184fe --- /dev/null +++ b/packages/components/src/components/segment/readme.md @@ -0,0 +1,66 @@ +# scale-segmented-button + + + + + + +## Properties + +| Property | Attribute | Description | Type | Default | +| ---------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------- | -------------- | +| `adjacentSiblings` | `adjacent-siblings` | | `"left" \| "leftright" \| "right"` | `undefined` | +| `ariaDescriptionTranslation` | `aria-description-translation` | a11y text for getting meaningful value. `$buttonNumber` and `$selected` are template variables and will be replaces by their corresponding properties. | `string` | `'$selected'` | +| `ariaLabelSegment` | `aria-label-segment` | (optional) aria-label attribute needed for icon-only segments | `string` | `undefined` | +| `ariaLangDeselected` | `aria-lang-deselected` | (optional) translation of 'deselected | `string` | `'deselected'` | +| `ariaLangSelected` | `aria-lang-selected` | (optional) translation of 'selected | `string` | `'selected'` | +| `disabled` | `disabled` | (optional) If `true`, the segment is disabled | `boolean` | `false` | +| `hasIcon` | `has-icon` | (optional) position within group | `boolean` | `undefined` | +| `iconOnly` | `icon-only` | (optional) position within group | `boolean` | `undefined` | +| `position` | `position` | (optional) position within group | `number` | `undefined` | +| `segmentId` | `segment-id` | (optional) segment's id | `string` | `undefined` | +| `selected` | `selected` | (optional) If `true`, the segment is selected | `boolean` | `false` | +| `selectedIndex` | `selected-index` | (optional) the index of the currently selected segment in the segmented-button | `string` | `undefined` | +| `size` | `size` | (optional) The size of the segment | `"large" \| "medium" \| "small"` | `'small'` | +| `styles` | `styles` | (optional) Injected CSS styles | `string` | `undefined` | +| `textOnly` | `text-only` | (optional) position within group | `boolean` | `undefined` | +| `width` | `width` | (optional) Segment width set to ensure that all segments have the same width | `string` | `undefined` | + + +## Events + +| Event | Description | Type | +| ------------- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------- | +| `scale-click` | Emitted when button is clicked | `CustomEvent<{ id: string; selected: boolean; }>` | +| `scaleClick` | **[DEPRECATED]** in v3 in favor of kebab-case event names

| `CustomEvent<{ id: string; selected: boolean; }>` | + + +## Methods + +### `setFocus() => Promise` + + + +#### Returns + +Type: `Promise` + + + + +## Dependencies + +### Depends on + +- [scale-icon-action-success](../icons/action-success) + +### Graph +```mermaid +graph TD; + scale-segment --> scale-icon-action-success + style scale-segment fill:#f9f,stroke:#333,stroke-width:4px +``` + +---------------------------------------------- + +*Built with [StencilJS](https://stenciljs.com/)* diff --git a/packages/components/src/components/segment/segment.css b/packages/components/src/components/segment/segment.css new file mode 100644 index 0000000000..8b4cc5d229 --- /dev/null +++ b/packages/components/src/components/segment/segment.css @@ -0,0 +1,231 @@ +/** + * @license + * Scale https://github.com/telekom/scale + * + * Copyright (c) 2021 Egor Kirpichev and contributors, Deutsche Telekom AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +:host { + /* not selected */ + --background-color-selected: var(--telekom-color-ui-base); + --button-radius: 6px; + --padding-top-bottom: var(--telekom-spacing-unit-x1); + --height: 28px; + --font-family: var(--telekom-typography-font-family-sans); + --font-weight: var(--telekom-typography-font-weight-bold); + --font-size: var(--telekom-typography-font-size-caption); + --label-disabled: var(--telekom-color-text-and-icon-disabled); + --transition: all var(--telekom-motion-duration-transition) + var(--telekom-motion-easing-standard); + --color: var(--telekom-color-text-and-icon-standard); + + --color-selected: var(--telekom-color-text-and-icon-primary-standard); + + /* medium styles */ + --font-size-medium: var(--telekom-typography-font-size-body); + --height-medium: 36px; + + /* large styles */ + --font-size-large: var(--telekom-typography-font-size-body); + --height-large: 40px; + + /* hover styles */ + --background-color-hover: var(--telekom-color-ui-state-fill-hovered); + + /* active styles */ + --background-color-active: var(--telekom-color-ui-state-fill-pressed); + + display: flex; + align-items: center; + justify-content: center; + flex: 1; +} + +.segment { + box-sizing: border-box; + position: relative; + border: 0; + height: 100%; + width: 100%; + border-radius: var(--button-radius); + padding-top: var(--padding-top-bottom); + padding-bottom: var(--padding-top-bottom); + transition: var(--transition); + background-color: transparent; + padding: 0; +} + +.segment--mask { + box-sizing: border-box; + display: flex; + align-items: center; + justify-content: center; + position: relative; + height: 100%; + width: 100%; + border-radius: var(--button-radius); + background-color: transparent; + font-family: var(--font-family); + font-size: var(--font-size); + font-weight: var(--font-weight); + transition: var(--transition); + white-space: nowrap; + color: var(--color); +} + +button.segment--icon-only.segment--small .segment--mask { + padding-left: var(--telekom-spacing-unit-x4); + padding-right: var(--telekom-spacing-unit-x4); +} + +button.segment--small.segment--selected .segment--mask { + padding-left: var(--telekom-spacing-unit-x2); + padding-right: var(--telekom-spacing-unit-x3); +} + +button.segment--small .segment--mask { + padding-left: 0.625rem; + padding-right: 0.625rem; +} + +.segment--small { + height: var(--height); +} + +.segment--medium { + font-size: var(--font-size-medium); + height: var(--height-medium); +} + +button.segment--medium.segment--selected .segment--mask { + padding-left: var(--telekom-spacing-unit-x3); + padding-right: var(--telekom-spacing-unit-x4); +} + +button.segment--medium .segment--mask { + padding-left: 0.875rem; + padding-right: 0.875rem; +} + +.segment--large { + font-size: var(--font-size-large); + height: var(--height-large); +} + +button.segment--large .segment--mask { + padding-left: var(--telekom-spacing-unit-x4); + padding-right: var(--telekom-spacing-unit-x5); +} + +button.segment--large.segment--selected .segment--mask { + padding-left: 1.125rem; + padding-right: 1.125rem; +} + +.segment--selected { + background-color: var(--background-color-selected); + box-shadow: var(--telekom-shadow-raised-standard); +} + +.segment--selected .segment--mask { + color: var(--color-selected); +} + +.segment--disabled.segment--selected .segment--mask { + color: var(--label-disabled); +} + +.segment--disabled:not(.segment--selected) .segment--mask { + color: var(--label-disabled); + background-color: transparent; +} + +.segment--left-sibling-selected { + border-radius: 0 var(--button-radius) var(--button-radius) 0; + margin-left: 0; + clip-path: inset(-2.75rem -2.75rem -2.75rem 0); + backface-visibility: hidden; + overflow: hidden; +} + +.segment--right-sibling-selected { + border-radius: var(--button-radius) 0 0 var(--button-radius); + clip-path: inset(-2.75rem 0 -2.75rem -2.75rem); + margin-right: 0; + backface-visibility: hidden; + overflow: hidden; + position: relative; +} + +.segment--left-right-sibling-selected { + clip-path: inset(-2.75rem 0 -2.75rem 0); + border-radius: 0; + margin-left: 0; + margin-right: 0; + backface-visibility: hidden; +} + +.segment:not(.segment--disabled):hover .segment--mask { + background-color: var(--background-color-hover); +} + +.segment:not(.segment--disabled):active .segment--mask { + background-color: var(--background-color-active); +} + +.segment:focus { + box-shadow: var(--telekom-shadow-raised-standard); + outline: var(--telekom-spacing-unit-x05) solid + var(--telekom-color-functional-focus); + outline-offset: var(--telekom-spacing-unit-x025); + z-index: 40; + position: relative; +} + +.segment--left-right-sibling-selected:focus, +.segment--right-sibling-selected:focus, +.segment--left-sibling-selected:focus { + clip-path: none; +} + +.segment:not(.segment--icon-only) scale-icon-action-success, +.segment scale-icon-action-close { + margin-right: var(--telekom-spacing-unit-x1); +} + +.segment:not(.segment--selected) scale-icon-action-success { + visibility: hidden !important; +} + +.segment scale-icon-action-success { + vertical-align: middle; +} + +.segment--selected:not(.segment--icon-only) .icon-container { + display: none !important; +} + +.segment .success-icon-container { + display: none; +} + +.segment--selected .success-icon-container { + display: flex; + justify-content: center; + align-items: center; +} + +.icon-container { + height: 100%; + display: flex; + justify-content: center; + align-items: center; +} + +.segment--selected .icon-container { + color: var(--color-selected); +} diff --git a/packages/components/src/components/segment/segment.spec.ts b/packages/components/src/components/segment/segment.spec.ts new file mode 100644 index 0000000000..0991fb789d --- /dev/null +++ b/packages/components/src/components/segment/segment.spec.ts @@ -0,0 +1,56 @@ +import { newSpecPage } from '@stencil/core/testing'; +import { Segment } from './segment'; + +describe('Segment', () => { + it('should match standard snapshot', async () => { + const page = await newSpecPage({ + components: [Segment], + html: ` + Label`, + }); + expect(page.root).toMatchSnapshot(); + }); + it('should include right properties', async () => { + const page = await newSpecPage({ + components: [Segment], + html: ` + Label`, + }); + page.root.disabled = true; + (page.root.size = 'medium'), (page.root.selected = true); + page.root.hasIcon = true; + page.root.ariaLangSelected = 'ariaLangSelected'; + page.root.ariaLangDeselected = 'ariaLangDeselected'; + page.root.ariaDescriptionTranslation = 'ariaDescriptionTranslation'; + await page.waitForChanges(); + expect(page.rootInstance.disabled).toBe(true); + expect(page.rootInstance.size).toBe('medium'); + expect(page.rootInstance.selected).toBe(true); + expect(page.rootInstance.hasIcon).toBe(true); + expect(page.rootInstance.ariaLangSelected).toBe('ariaLangSelected'); + expect(page.rootInstance.ariaLangDeselected).toBe('ariaLangDeselected'); + expect(page.rootInstance.ariaDescriptionTranslation).toBe( + 'ariaDescriptionTranslation' + ); + }); + it('should include iconOnly', async () => { + const page = await newSpecPage({ + components: [Segment], + html: ` + Label`, + }); + page.root.iconOnly = true; + await page.waitForChanges(); + expect(page.rootInstance.iconOnly).toBe(true); + }); + it('should include textOnly', async () => { + const page = await newSpecPage({ + components: [Segment], + html: ` + Label`, + }); + page.root.textOnly = true; + await page.waitForChanges(); + expect(page.rootInstance.textOnly).toBe(true); + }); +}); diff --git a/packages/components/src/components/segment/segment.tsx b/packages/components/src/components/segment/segment.tsx new file mode 100644 index 0000000000..c088531217 --- /dev/null +++ b/packages/components/src/components/segment/segment.tsx @@ -0,0 +1,225 @@ +/** + * @license + * Scale https://github.com/telekom/scale + * + * Copyright (c) 2021 Egor Kirpichev and contributors, Deutsche Telekom AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import { + Component, + Prop, + h, + Host, + Element, + Event, + EventEmitter, + Method, +} from '@stencil/core'; +import classNames from 'classnames'; +import { emitEvent } from '../../utils/utils'; +import statusNote from '../../utils/status-note'; + +let i = 0; + +@Component({ + tag: 'scale-segment', + styleUrl: 'segment.css', + shadow: true, +}) +export class Segment { + @Element() hostElement: HTMLElement; + /** (optional) The size of the segment */ + @Prop() size?: 'small' | 'medium' | 'large' = 'small'; + /** (optional) If `true`, the segment is selected */ + @Prop({ mutable: true }) selected?: boolean = false; + /** (optional) If `true`, the segment is disabled */ + @Prop() disabled?: boolean = false; + /** (optional) segment's id */ + @Prop({ reflect: true, mutable: true }) segmentId?: string; + /** (optional) aria-label attribute needed for icon-only segments */ + @Prop() ariaLabelSegment: string; + /** (optional) Segment width set to ensure that all segments have the same width */ + @Prop() width?: string; + /** (optional) Injected CSS styles */ + @Prop() styles?: string; + // /** (optional) */ + @Prop({ reflect: true, mutable: true }) adjacentSiblings?: + | 'left' + | 'right' + | 'leftright'; + /** (optional) translation of 'selected */ + @Prop() ariaLangSelected? = 'selected'; + /** (optional) translation of 'deselected */ + @Prop() ariaLangDeselected? = 'deselected'; + /** a11y text for getting meaningful value. `$buttonNumber` and `$selected` are template variables and will be replaces by their corresponding properties. */ + @Prop() ariaDescriptionTranslation = '$selected'; + /** (optional) position within group */ + @Prop() position?: number; + /** (optional) position within group */ + @Prop({ mutable: true }) hasIcon?: boolean; + /** (optional) position within group */ + @Prop({ mutable: true }) textOnly?: boolean; + /** (optional) position within group */ + @Prop({ mutable: true }) iconOnly?: boolean; + /** (optional) the index of the currently selected segment in the segmented-button */ + @Prop({ mutable: true }) selectedIndex?: string; + + /** Emitted when button is clicked */ + @Event({ eventName: 'scale-click' }) scaleClick!: EventEmitter<{ + id: string; + selected: boolean; + }>; + /** @deprecated in v3 in favor of kebab-case event names */ + @Event({ eventName: 'scaleClick' }) scaleClickLegacy!: EventEmitter<{ + id: string; + selected: boolean; + }>; + + private focusableElement: HTMLElement; + + @Method() + async setFocus() { + this.focusableElement.focus(); + } + + componentWillLoad() { + if (this.segmentId == null) { + this.segmentId = 'segment-' + i++; + } + } + componentDidUpdate() { + this.handleIcon(); + } + + getAriaDescriptionTranslation() { + const replaceSelected = this.selected + ? this.ariaLangSelected + : this.ariaLangDeselected; + const filledText = this.ariaDescriptionTranslation + .replace(/\$position/g, `${this.position}`) + .replace(/\$selected/g, `${replaceSelected}`); + return filledText; + } + + handleIcon() { + Array.from(this.hostElement.childNodes).forEach((child) => { + if ( + child.nodeType === 1 && + child.nodeName.substr(0, 10) === 'SCALE-ICON' + ) { + const icon: HTMLElement = this.hostElement.querySelector( + child.nodeName + ); + switch (this.size) { + case 'small': + icon.setAttribute('size', '14'); + break; + case 'medium' || 'large': + icon.setAttribute('size', '16'); + break; + } + icon.style.display = 'inline-flex'; + icon.style.marginRight = '4px'; + this.hasIcon = true; + } + if (child.nodeType === 3 && this.hostElement.childNodes.length === 1) { + this.textOnly = true; + const span = document.createElement('span'); + child.parentNode.insertBefore(span, child); + span.appendChild(child); + } + if ( + child.nodeType === 1 && + child.nodeName.substr(0, 10) === 'SCALE-ICON' && + this.hostElement.childNodes.length === 1 + ) { + this.iconOnly = true; + this.hostElement.setAttribute('icon-only', 'true'); + const icon: HTMLElement = this.hostElement.querySelector( + child.nodeName + ); + icon.style.marginRight = '0px'; + this.selected + ? icon.setAttribute('selected', '') + : icon.removeAttribute('selected'); + } + }); + } + + handleClick = (event: MouseEvent) => { + if (parseInt(this.selectedIndex, 10) + 1 === this.position) { + return; + } + event.preventDefault(); + this.selected = !this.selected; + emitEvent(this, 'scaleClick', { + id: this.segmentId, + selected: this.selected, + }); + }; + + render() { + return ( + + {this.styles && } + + + ); + } + + getBasePartMap() { + return this.getCssOrBasePartMap('basePart'); + } + + getCssClassMap() { + return this.getCssOrBasePartMap('css'); + } + + getCssOrBasePartMap(mode: 'basePart' | 'css') { + const prefix = mode === 'basePart' ? '' : 'segment--'; + + return classNames( + 'segment', + this.size && `${prefix}${this.size}`, + this.selected && `${prefix}selected`, + this.disabled && `${prefix}disabled`, + this.adjacentSiblings && + `${prefix}${this.adjacentSiblings.replace(/ /g, '-')}-sibling-selected`, + this.hasIcon && `${prefix}has-icon`, + this.iconOnly && `${prefix}icon-only` + ); + } +} diff --git a/packages/components/src/components/segmented-button/__snapshots__/segmented-button.spec.ts.snap b/packages/components/src/components/segmented-button/__snapshots__/segmented-button.spec.ts.snap new file mode 100644 index 0000000000..41c565086d --- /dev/null +++ b/packages/components/src/components/segmented-button/__snapshots__/segmented-button.spec.ts.snap @@ -0,0 +1,39 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`SegmentedButton should match selected button snapshot 1`] = ` + + +
+ +
+
+ + Label + + + Label + +
+`; + +exports[`SegmentedButton should match standard snapshot 1`] = ` + + +
+ +
+
+ + Label + + + Label + + + Label + + + Label + +
+`; diff --git a/packages/components/src/components/segmented-button/readme.md b/packages/components/src/components/segmented-button/readme.md new file mode 100644 index 0000000000..64567f0d3f --- /dev/null +++ b/packages/components/src/components/segmented-button/readme.md @@ -0,0 +1,51 @@ +# scale-segmented-button-group + + + + + + +## Properties + +| Property | Attribute | Description | Type | Default | +| ---------------------- | ------------------------ | ------------------------------------------------------------ | -------------------------------- | ---------------------------------------- | +| `ariaLabelTranslation` | `aria-label-translation` | (optional) aria-label attribute needed for icon-only buttons | `string` | ``segment button with $slottedSegments`` | +| `disabled` | `disabled` | (optional) If `true`, the button is disabled | `boolean` | `false` | +| `fullWidth` | `full-width` | (optional) If `true`, expand to container width | `boolean` | `false` | +| `helperText` | `helper-text` | (optional) If `true`, show error message | `string` | `'Please select an option'` | +| `invalid` | `invalid` | (optional) If `true`, show error message | `boolean` | `false` | +| `label` | `label` | (optional) Button label | `string` | `undefined` | +| `longestButtonWidth` | `longest-button-width` | | `string` | `undefined` | +| `multiSelect` | `multi-select` | (optional) Allow more than one button to be selected | `boolean` | `false` | +| `selectedIndex` | `selected-index` | (optional) the index of the selected segment | `number` | `undefined` | +| `size` | `size` | (optional) The size of the button | `"large" \| "medium" \| "small"` | `'small'` | +| `styles` | `styles` | (optional) Injected CSS styles | `string` | `undefined` | + + +## Events + +| Event | Description | Type | +| -------------- | -------------------------------------------------------------------------------------------------- | ------------------ | +| `scale-change` | Emitted when button is clicked | `CustomEvent` | +| `scaleChange` | **[DEPRECATED]** in v3 in favor of kebab-case event names

| `CustomEvent` | + + +## Dependencies + +### Depends on + +- [scale-helper-text](../helper-text) + +### Graph +```mermaid +graph TD; + scale-segmented-button --> scale-helper-text + scale-helper-text --> scale-icon-alert-information + scale-helper-text --> scale-icon-alert-error + scale-helper-text --> scale-icon-alert-success + style scale-segmented-button fill:#f9f,stroke:#333,stroke-width:4px +``` + +---------------------------------------------- + +*Built with [StencilJS](https://stenciljs.com/)* diff --git a/packages/components/src/components/segmented-button/segmented-button.css b/packages/components/src/components/segmented-button/segmented-button.css new file mode 100644 index 0000000000..f7dbef1968 --- /dev/null +++ b/packages/components/src/components/segmented-button/segmented-button.css @@ -0,0 +1,59 @@ +/** + * @license + * Scale https://github.com/telekom/scale + * + * Copyright (c) 2021 Egor Kirpichev and contributors, Deutsche Telekom AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +:host { + --background-color: var(--telekom-color-ui-faint); + --radius: var(--telekom-radius-standard); + --height: 32px; + + /* medium styles */ + --height-medium: 40px; + + /* large styles */ + --height-large: 44px; + + display: flex; + flex-direction: column; +} + +.segmented-button { + background-color: var(--background-color); + border: 0; + border-radius: var(--radius); + padding: 0 var(--telekom-spacing-unit-x05); + width: fit-content; + height: var(--height); + display: inline-grid; +} + +.segmented-button--full-width { + width: 100%; +} + +.segmented-button--medium { + height: var(--height-medium); + padding: 0 var(--telekom-spacing-unit-x05); +} + +.segmented-button--large { + height: var(--height-large); + padding: 0 var(--telekom-spacing-unit-x05); +} + +.segmented-button--label { + font-size: var(--telekom-typography-font-size-body); + font-weight: var(--telekom-typography-font-weight-bold); + margin-bottom: var(--telekom-spacing-unit-x2); +} + +.segmented-button--helper-text { + margin-top: var(--telekom-spacing-unit-x2); +} diff --git a/packages/components/src/components/segmented-button/segmented-button.spec.ts b/packages/components/src/components/segmented-button/segmented-button.spec.ts new file mode 100644 index 0000000000..aadc728f1e --- /dev/null +++ b/packages/components/src/components/segmented-button/segmented-button.spec.ts @@ -0,0 +1,51 @@ +import { newSpecPage } from '@stencil/core/testing'; +import { SegmentedButton } from './segmented-button'; + +describe('SegmentedButton', () => { + it('should match standard snapshot', async () => { + const page = await newSpecPage({ + components: [SegmentedButton], + html: ` + + Label + Label + Label + Label + `, + }); + expect(page.root).toMatchSnapshot(); + }); + it('should include right properties', async () => { + const page = await newSpecPage({ + components: [SegmentedButton], + html: ` + + Label + `, + }); + page.root.invalid = true; + page.root.fullWidth = true; + page.root.helperText = 'helpertext'; + page.root.disabled = true; + page.root.multiSelect = true; + page.root.size = 'medium'; + await page.waitForChanges(); + expect(page.rootInstance.invalid).toBe(true); + expect(page.rootInstance.fullWidth).toBe(true); + expect(page.rootInstance.helperText).toBe('helpertext'); + expect(page.rootInstance.disabled).toBe(true); + expect(page.rootInstance.multiSelect).toBe(true); + expect(page.rootInstance.size).toBe('medium'); + }); + it('should match selected button snapshot', async () => { + const page = await newSpecPage({ + components: [SegmentedButton], + html: ` + + Label + Label + `, + }); + expect(page.root).toMatchSnapshot(); + }); +}); diff --git a/packages/components/src/components/segmented-button/segmented-button.tsx b/packages/components/src/components/segmented-button/segmented-button.tsx new file mode 100644 index 0000000000..771b4428a7 --- /dev/null +++ b/packages/components/src/components/segmented-button/segmented-button.tsx @@ -0,0 +1,291 @@ +/** + * @license + * Scale https://github.com/telekom/scale + * + * Copyright (c) 2021 Egor Kirpichev and contributors, Deutsche Telekom AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import { + Component, + Prop, + h, + Host, + Element, + State, + Listen, + Event, + EventEmitter, + Watch, +} from '@stencil/core'; +import classNames from 'classnames'; +import { emitEvent } from '../../utils/utils'; + +interface SegmentStatus { + id: string; + selected: boolean; +} + +const CHECKMARK_WIDTH_SMALL = 14; +const CHECKMARK_WIDTH_LARGE = 18; + +@Component({ + tag: 'scale-segmented-button', + styleUrl: 'segmented-button.css', + shadow: true, +}) +export class SegmentedButton { + /** segment position within button */ + position = 0; + + slottedSegments = 0; + + @Element() hostElement: HTMLElement; + /** state */ + @State() status: SegmentStatus[] = []; + /** (optional) The size of the button */ + @Prop() size?: 'small' | 'medium' | 'large' = 'small'; + /** (optional) Allow more than one button to be selected */ + @Prop() multiSelect: boolean = false; + /** (optional) the index of the selected segment */ + @Prop() selectedIndex?: number; + /** (optional) If `true`, the button is disabled */ + @Prop({ reflect: true }) disabled?: boolean = false; + /** (optional) If `true`, expand to container width */ + @Prop() fullWidth?: boolean = false; + /** (optional) If `true`, show error message */ + @Prop() invalid?: boolean = false; + /** (optional) If `true`, show error message */ + @Prop() helperText?: string = 'Please select an option'; + /** (optional) Button label */ + @Prop() label?: string; + /** (optional) Injected CSS styles */ + @Prop() styles?: string; + /** (optional) aria-label attribute needed for icon-only buttons */ + @Prop() + ariaLabelTranslation = `segment button with $slottedSegments`; + @Prop({ mutable: true }) + longestButtonWidth: string; + /** Emitted when button is clicked */ + @Event({ eventName: 'scale-change' }) scaleChange: EventEmitter; + /** @deprecated in v3 in favor of kebab-case event names */ + @Event({ eventName: 'scaleChange' }) scaleChangeLegacy: EventEmitter; + + container: HTMLElement; + showHelperText = false; + @Listen('scaleClick') + scaleClickHandler(ev: { detail: { id: string; selected: boolean } }) { + let tempState: SegmentStatus[]; + if (!this.multiSelect) { + if (!ev.detail.selected) { + tempState = this.status.map((obj) => + ev.detail.id === obj.id ? ev.detail : { ...obj } + ); + /* clicked button has now selected state */ + } else { + tempState = this.status.map((obj) => + ev.detail.id === obj.id ? ev.detail : { ...obj, selected: false } + ); + } + } else { + tempState = this.status.map((obj) => + ev.detail.id === obj.id ? ev.detail : { ...obj } + ); + } + this.setState(tempState); + } + + @Watch('disabled') + @Watch('size') + @Watch('selectedIndex') + handlePropsChange() { + this.propagatePropsToChildren(); + } + + /** + * Keep props, needed in children buttons, in sync + */ + propagatePropsToChildren() { + this.getAllSegments().forEach((segment) => { + segment.setAttribute('size', this.size); + segment.setAttribute('selected-index', this.selectedIndex.toString()); + if (this.disabled) { + segment.setAttribute('disabled', true && 'disabled'); + } + }); + } + + componentDidLoad() { + const tempState: SegmentStatus[] = []; + const segments = this.getAllSegments(); + this.slottedSegments = segments.length; + const longestButtonWidth = this.getLongestButtonWidth(); + segments.forEach((segment) => { + this.position++; + tempState.push({ + id: segment.getAttribute('segment-id'), + selected: segment.hasAttribute('selected'), + }); + segment.setAttribute('position', this.position.toString()); + segment.setAttribute( + 'aria-description-translation', + '$position $selected' + ); + }); + if (!this.fullWidth) { + this.container.style.gridTemplateColumns = `repeat(${ + this.hostElement.children.length + }, ${Math.ceil(longestButtonWidth)}px)`; + } else { + this.container.style.display = 'flex'; + } + + this.selectedIndex = this.getSelectedIndex(); + this.propagatePropsToChildren(); + this.position = 0; + this.status = tempState; + this.setState(tempState); + } + + componentWillUpdate() { + this.selectedIndex = this.getSelectedIndex(); + this.showHelperText = false; + if ( + this.invalid && + this.status.filter((e) => e.selected === true).length <= 0 + ) { + this.showHelperText = true; + } + } + + getSelectedIndex() { + if (this.multiSelect) { + // in multi-select having no selected segments is allowed + return -1; + } else { + const allSegments = this.getAllSegments(); + const selectedIndex = allSegments.findIndex( + (el: HTMLScaleSegmentElement) => el.selected === true + ); + return selectedIndex; + } + } + + getAdjacentSiblings = (tempState, i) => { + let adjacentSiblings = ''; + if (i !== 0 && tempState[i].selected && tempState[i - 1].selected) { + adjacentSiblings = 'left'; + } + if ( + i !== tempState.length - 1 && + tempState[i].selected && + tempState[i + 1].selected + ) { + adjacentSiblings = `${ + adjacentSiblings ? adjacentSiblings + ' right' : 'right' + }`; + } + return adjacentSiblings; + }; + + // all segmented buttons should have the same width, based on the largest one + getLongestButtonWidth() { + let tempWidth = 0; + Array.from(this.hostElement.children).forEach((child) => { + const selected = child.hasAttribute('selected'); + const iconOnly = child.hasAttribute('icon-only'); + const checkmark = + this.size === 'small' ? CHECKMARK_WIDTH_SMALL : CHECKMARK_WIDTH_LARGE; + if (selected || iconOnly) { + tempWidth = + child.getBoundingClientRect().width > tempWidth + ? child.getBoundingClientRect().width + : tempWidth; + } else { + tempWidth = + child.getBoundingClientRect().width + checkmark > tempWidth + ? child.getBoundingClientRect().width + checkmark + : tempWidth; + } + }); + return tempWidth; + } + + setState(tempState: SegmentStatus[]) { + const segments = Array.from( + this.hostElement.querySelectorAll('scale-segment') + ); + segments.forEach((segment, i) => { + segment.setAttribute( + 'adjacent-siblings', + this.getAdjacentSiblings(tempState, i) + ); + segment.setAttribute( + 'selected', + tempState[i].selected ? 'true' : 'false' + ); + }); + this.status = tempState; + emitEvent(this, 'scaleChange', this.status); + } + + getAllSegments() { + return Array.from(this.hostElement.querySelectorAll('scale-segment')); + } + + getAriaLabelTranslation() { + const filledText = this.ariaLabelTranslation.replace( + /\$slottedSegments/g, + `${this.slottedSegments}` + ); + return filledText; + } + + render() { + return ( + + {this.styles && } + {this.label && ( + {this.label} + )} +
(this.container = el as HTMLInputElement)} + > + +
+ {this.showHelperText && ( + + )} +
+ ); + } + + getBasePartMap() { + return this.getCssOrBasePartMap('basePart'); + } + + getCssClassMap() { + return this.getCssOrBasePartMap('css'); + } + + getCssOrBasePartMap(mode: 'basePart' | 'css') { + const prefix = mode === 'basePart' ? '' : 'segmented-button--'; + + return classNames( + 'segmented-button', + this.size && `${prefix}${this.size}`, + this.fullWidth && `${prefix}full-width` + ); + } +} diff --git a/packages/storybook-vue/.storybook/preview.js b/packages/storybook-vue/.storybook/preview.js index 2d05939b0e..cef2a18e19 100644 --- a/packages/storybook-vue/.storybook/preview.js +++ b/packages/storybook-vue/.storybook/preview.js @@ -69,6 +69,7 @@ export const parameters = { ['Design', 'Development'], 'Components', 'Beta Components', + 'Deprecated Components', 'Contact', 'Legal', ['Disclaimer', 'Legal Notice', 'Privacy'], diff --git a/packages/storybook-vue/.storybook/usage-addon/usage.js b/packages/storybook-vue/.storybook/usage-addon/usage.js index dc3d5b81d0..faaf65e309 100644 --- a/packages/storybook-vue/.storybook/usage-addon/usage.js +++ b/packages/storybook-vue/.storybook/usage-addon/usage.js @@ -27,6 +27,8 @@ import checkbox_en from 'raw-loader!../../stories/components/checkbox/checkbox.m import checkbox_de from 'raw-loader!../../stories/components/checkbox/checkbox_de.md'; import checkboxGroup_en from 'raw-loader!../../stories/components/checkbox-group/checkbox-group.md'; import checkboxGroup_de from 'raw-loader!../../stories/components/checkbox-group/checkbox-group_de.md'; +import chip_de from 'raw-loader!../../stories/components/chip/chip_de.md'; +import chip_en from 'raw-loader!../../stories/components/chip/chip.md'; import datagrid_en from 'raw-loader!../../stories/components/data-grid/data-grid.md'; import datagrid_de from 'raw-loader!../../stories/components/data-grid/data-grid_de.md'; import date_picker_en from 'raw-loader!../../stories/components/date-picker/date-picker.md'; @@ -69,6 +71,8 @@ import dropdownSelect_en from 'raw-loader!../../stories/components/dropdown-sele import dropdownSelect_de from 'raw-loader!../../stories/components/dropdown-select/dropdown-select_de.md'; import dropdown_en from 'raw-loader!../../stories/components/dropdown/dropdown.md'; import dropdown_de from 'raw-loader!../../stories/components/dropdown/dropdown_de.md'; +import segmentedButton_en from 'raw-loader!../../stories/components/segmented-button/segmented-button.md'; +import segmentedButton_de from 'raw-loader!../../stories/components/segmented-button/segmented-button_de.md'; import sidebarNav_en from 'raw-loader!../../stories/components/sidebar-navigation/sidebar-nav.md'; import sidebarNav_de from 'raw-loader!../../stories/components/sidebar-navigation/sidebar-nav_de.md'; import slider_en from 'raw-loader!../../stories/components/slider/slider.md'; @@ -129,6 +133,8 @@ const Usage = (props) => { checkbox_de, 'checkbox-group_en': checkboxGroup_en, 'checkbox-group_de': checkboxGroup_de, + chip_en, + chip_de, divider_en, divider_de, callout_en, @@ -175,6 +181,8 @@ const Usage = (props) => { 'dropdown-select_de': dropdownSelect_de, dropdown_en, dropdown_de, + 'segmented-button_en': segmentedButton_en, + 'segmented-button_de': segmentedButton_de, 'sidebar-navigation_en': sidebarNav_en, 'sidebar-navigation_de': sidebarNav_de, slider_en, diff --git a/packages/storybook-vue/public/assets/3_components/chip/Chips-Disabled-Outline-DE.png b/packages/storybook-vue/public/assets/3_components/chip/Chips-Disabled-Outline-DE.png new file mode 100644 index 0000000000..15efdc9f77 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/chip/Chips-Disabled-Outline-DE.png differ diff --git a/packages/storybook-vue/public/assets/3_components/chip/Chips-Disabled-Outline-EN.png b/packages/storybook-vue/public/assets/3_components/chip/Chips-Disabled-Outline-EN.png new file mode 100644 index 0000000000..f509c41742 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/chip/Chips-Disabled-Outline-EN.png differ diff --git a/packages/storybook-vue/public/assets/3_components/chip/Chips-Disabled-Standard-DE.png b/packages/storybook-vue/public/assets/3_components/chip/Chips-Disabled-Standard-DE.png new file mode 100644 index 0000000000..e3858cfb54 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/chip/Chips-Disabled-Standard-DE.png differ diff --git a/packages/storybook-vue/public/assets/3_components/chip/Chips-Disabled-Standard-EN.png b/packages/storybook-vue/public/assets/3_components/chip/Chips-Disabled-Standard-EN.png new file mode 100644 index 0000000000..41ea118279 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/chip/Chips-Disabled-Standard-EN.png differ diff --git a/packages/storybook-vue/public/assets/3_components/chip/Chips-Dynamic-Example1.png b/packages/storybook-vue/public/assets/3_components/chip/Chips-Dynamic-Example1.png new file mode 100644 index 0000000000..29104c5efc Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/chip/Chips-Dynamic-Example1.png differ diff --git a/packages/storybook-vue/public/assets/3_components/chip/Chips-Dynamic-Example_Chatbot2.png b/packages/storybook-vue/public/assets/3_components/chip/Chips-Dynamic-Example_Chatbot2.png new file mode 100644 index 0000000000..b022b77bc6 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/chip/Chips-Dynamic-Example_Chatbot2.png differ diff --git a/packages/storybook-vue/public/assets/3_components/chip/Chips-Persistent-Default.png b/packages/storybook-vue/public/assets/3_components/chip/Chips-Persistent-Default.png new file mode 100644 index 0000000000..60db725f2c Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/chip/Chips-Persistent-Default.png differ diff --git a/packages/storybook-vue/public/assets/3_components/chip/Chips-Persistent-Selected.png b/packages/storybook-vue/public/assets/3_components/chip/Chips-Persistent-Selected.png new file mode 100644 index 0000000000..e274e0ed16 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/chip/Chips-Persistent-Selected.png differ diff --git a/packages/storybook-vue/public/assets/3_components/chip/Chips-Types.png b/packages/storybook-vue/public/assets/3_components/chip/Chips-Types.png new file mode 100644 index 0000000000..2b36801c58 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/chip/Chips-Types.png differ diff --git a/packages/storybook-vue/public/assets/3_components/chip/Chips-Variant-Outline.png b/packages/storybook-vue/public/assets/3_components/chip/Chips-Variant-Outline.png new file mode 100644 index 0000000000..f3fd02c42f Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/chip/Chips-Variant-Outline.png differ diff --git a/packages/storybook-vue/public/assets/3_components/chip/Chips-Variant-Standard.png b/packages/storybook-vue/public/assets/3_components/chip/Chips-Variant-Standard.png new file mode 100644 index 0000000000..6d91b6452c Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/chip/Chips-Variant-Standard.png differ diff --git a/packages/storybook-vue/public/assets/3_components/chip/Chips-elements.png b/packages/storybook-vue/public/assets/3_components/chip/Chips-elements.png new file mode 100644 index 0000000000..df8fbffbf1 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/chip/Chips-elements.png differ diff --git a/packages/storybook-vue/public/assets/3_components/chip/Standard_Chip.png b/packages/storybook-vue/public/assets/3_components/chip/Standard_Chip.png new file mode 100644 index 0000000000..d00bc3ac47 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/chip/Standard_Chip.png differ diff --git a/packages/storybook-vue/public/assets/3_components/chip/chips-disabled-de.png b/packages/storybook-vue/public/assets/3_components/chip/chips-disabled-de.png new file mode 100644 index 0000000000..24af640cf6 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/chip/chips-disabled-de.png differ diff --git a/packages/storybook-vue/public/assets/3_components/chip/chips-disabled-en.png b/packages/storybook-vue/public/assets/3_components/chip/chips-disabled-en.png new file mode 100644 index 0000000000..4424fa7222 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/chip/chips-disabled-en.png differ diff --git a/packages/storybook-vue/public/assets/3_components/segmented-button/Icon_Only.png b/packages/storybook-vue/public/assets/3_components/segmented-button/Icon_Only.png new file mode 100644 index 0000000000..ea756f7e45 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/segmented-button/Icon_Only.png differ diff --git a/packages/storybook-vue/public/assets/3_components/segmented-button/Map-DE.png b/packages/storybook-vue/public/assets/3_components/segmented-button/Map-DE.png new file mode 100644 index 0000000000..c95b19777f Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/segmented-button/Map-DE.png differ diff --git a/packages/storybook-vue/public/assets/3_components/segmented-button/Map.png b/packages/storybook-vue/public/assets/3_components/segmented-button/Map.png new file mode 100644 index 0000000000..b51fa380ea Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/segmented-button/Map.png differ diff --git a/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Disabled.png b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Disabled.png new file mode 100644 index 0000000000..8e24f40f07 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Disabled.png differ diff --git a/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Elements-2.png b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Elements-2.png new file mode 100644 index 0000000000..5d521acc54 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Elements-2.png differ diff --git a/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Filter-list-DE.png b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Filter-list-DE.png new file mode 100644 index 0000000000..5cc8943967 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Filter-list-DE.png differ diff --git a/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Filter-list.png b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Filter-list.png new file mode 100644 index 0000000000..d0cdd2d451 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Filter-list.png differ diff --git a/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Multiselect.png b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Multiselect.png new file mode 100644 index 0000000000..d953743f8f Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Multiselect.png differ diff --git a/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Single_Select.png b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Single_Select.png new file mode 100644 index 0000000000..7a0bd96694 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Single_Select.png differ diff --git a/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Sizes.png b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Sizes.png new file mode 100644 index 0000000000..606440b131 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Sizes.png differ diff --git a/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-SortBy-Price-DE.png b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-SortBy-Price-DE.png new file mode 100644 index 0000000000..2a14d28f14 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-SortBy-Price-DE.png differ diff --git a/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-SortBy-Price.png b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-SortBy-Price.png new file mode 100644 index 0000000000..0aaea1e808 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-SortBy-Price.png differ diff --git a/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Text_Icon.png b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Text_Icon.png new file mode 100644 index 0000000000..46b3dde5c5 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Text_Icon.png differ diff --git a/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Text_Only_1.png b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Text_Only_1.png new file mode 100644 index 0000000000..400312cada Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Text_Only_1.png differ diff --git a/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Tip-DE.png b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Tip-DE.png new file mode 100644 index 0000000000..84d12e3392 Binary files /dev/null and b/packages/storybook-vue/public/assets/3_components/segmented-button/SegmentedButton-Tip-DE.png differ diff --git a/packages/storybook-vue/public/assets/deprecated.png b/packages/storybook-vue/public/assets/deprecated.png new file mode 100644 index 0000000000..8d5cb5292c Binary files /dev/null and b/packages/storybook-vue/public/assets/deprecated.png differ diff --git a/packages/storybook-vue/stories/components/chip/Chip.stories.mdx b/packages/storybook-vue/stories/components/chip/Chip.stories.mdx new file mode 100644 index 0000000000..b7bef4ca8e --- /dev/null +++ b/packages/storybook-vue/stories/components/chip/Chip.stories.mdx @@ -0,0 +1,380 @@ +import { + Meta, + Story, + ArgsTable, + Canvas, + Description, +} from '@storybook/addon-docs'; +import ScaleChip from './ScaleChip.vue'; +import { action } from '@storybook/addon-actions'; + + + +export const Template = (args, { argTypes }) => ({ + props: { + label: String, + ...ScaleChip.props, + }, + template: ` + + {{label}} + + `, + methods: { + action, + }, +}); + +export const TemplateIcon = (args, { argTypes }) => ({ + props: { + label: String, + ...ScaleChip.props, + }, + template: ` + + {{label}} +
+ +
+
+ `, + methods: { + action, + }, +}); + +export const TemplateInteractive = (args, { argTypes }) => ({ + template: ` +
+
Please select one option:
+
    +
  • + + {{label}} + +
  • + +
+
+ `, + methods: { + action: action('scaleChange'), + removeChip(label) { + this.action(); + this.labels = null; + this.text = this.label; + setTimeout(() => { + this.$el.querySelector('#root > ul > li > scale-chip') && + this.$el + .querySelector('#root > ul > li > scale-chip') + .shadowRoot.querySelector('span > button') + .focus(); + }); + }, + }, + data: () => ({ + labels: ['option 1', 'option 2', 'option 3', 'option 4'], + }), +}); + +
+

Chip

+ Beta Component +
+ +## Standard + + + + {Template.bind({})} + + + + + +```html +{{label}} +``` + +## Persistent + +
+ +### Persistent Standard + + + + {Template.bind({})} + + + +```html +Label +``` + +### Persistent Standard Selected + + + + {Template.bind({})} + + + +```html +Label +``` + +### Persistent Standard Disabled + + + + {Template.bind({})} + + + +```html +Label +``` + +### Persistent Standard Selected Disabled + + + + {Template.bind({})} + + + +```html +Label +``` + +### Persistent Outline + + + + {Template.bind({})} + + + +```html +Label +``` + +### Persistent Outline Selected + + + + {Template.bind({})} + + + +```html +Label +``` + +### Persistent Outline Disabled + + + + {Template.bind({})} + + + +```html +Label +``` + +### Persistent Outline Selected Disabled + + + + {Template.bind({})} + + + +```html +Label +``` + +## Dynamic + +### Dynamic Suggestion + + + + {Template.bind({})} + + + +```html +Label +``` + +### Dynamic Selection Standard + + + + {Template.bind({})} + + + +```html +Label +``` + +### Dynamic Selection Outline + + + + {Template.bind({})} + + + +```html +Label +``` + +## Icon + Text + + + + {TemplateIcon.bind({})} + + + +```html +Label +
+ +
+
+``` diff --git a/packages/storybook-vue/stories/components/chip/ScaleChip.vue b/packages/storybook-vue/stories/components/chip/ScaleChip.vue new file mode 100644 index 0000000000..c3538ff3f8 --- /dev/null +++ b/packages/storybook-vue/stories/components/chip/ScaleChip.vue @@ -0,0 +1,49 @@ + + + diff --git a/packages/storybook-vue/stories/components/chip/chip.md b/packages/storybook-vue/stories/components/chip/chip.md new file mode 100644 index 0000000000..d3941ac478 --- /dev/null +++ b/packages/storybook-vue/stories/components/chip/chip.md @@ -0,0 +1,101 @@ +
+

Chip

+ Beta Component +
+ +Chips are contextual components that allow users to filter content or trigger actions. + +## General + +Chips consist of relevant keywords in a container. They often appear dynamically (triggered by a user action) and as a group. + +### When to use + +Use chips to: + +- give users filtering possibilities, +- display the filters users set, or +- suggest options to users (search criteria, possible answers). + +### When not to use + +Don’t use chips when: + +- you want to mark a category (use tags instead) or +- you can use a button instead. + +## Basic types + +![Image Name](assets/3_components/chip/Chips-Types.png) + +### Persistent chips + +Persistent chips are an integral part of the UI and can be selected and deselected. + +![Image Name](assets/3_components/chip/Chips-Persistent-Default.png) + +**Example 1 – Default**
+A group of filter options as an integral part of the UI. + +![Image Name](assets/3_components/chip/Chips-Persistent-Selected.png) + +**Example 1 – Filter selected**
+Users can recognize selected filters with the checkmark icon. + +### Dynamic chips + +Dynamic chips fade in or out after a user action. + +![Image Name](assets/3_components/chip/Chips-Dynamic-Example1.png) + +**Example 1**
+The chip appears after users set a filter. Clicking/tapping on the close icon hides it again and resets the filter. + +![Image Name](assets/3_components/chip/Chips-Dynamic-Example_Chatbot2.png) + +**Example 2**
+A set of possible responses in a chat. After clicking/tapping on the chip, it fades out again. + +## Variants + +![Image Name](assets/3_components/chip/Standard_Chip.png) + +Chips can be displayed in two variants: standard and outline. + +### Disabled state + +![Image Name](assets/3_components/chip/chips-disabled-en.png) + +In the disabled state, the chip's interactive function is switched off. Use this state when an interaction can’t occur due to permissions or dependencies. + +### Element + +![Image Name](assets/3_components/chip/Chips-elements.png) + +#### Label (1) + +The label of the chip should be short and easily understandable. + +#### Checkmark icon (2) + +Depending on the type, the close icon or checkmark icon is displayed. + +#### Icon (3) (optional) + +Add an icon if it makes it easier for users to understand the function of the chip. + +## Best practice + +### Chips in groups + +- Arrange chips horizontally or vertically. +- Vertical layouts are suitable, for example, for a side menu that should integrate groups of chips. +- Chips arranged horizontally are often located above the content they refer to. +- Word the label as precisely as possible. + +## Related components + +[Tag](?path=/usage/components-tag--standard), +[Button](?path=/usage/components-button--standard), +[Segmented Button](?path=/usage/beta-components-segmented-button--standard), +[Checkbox Group](?path=/usage/components-checkbox-group--standard) diff --git a/packages/storybook-vue/stories/components/chip/chip_de.md b/packages/storybook-vue/stories/components/chip/chip_de.md new file mode 100644 index 0000000000..4388c05850 --- /dev/null +++ b/packages/storybook-vue/stories/components/chip/chip_de.md @@ -0,0 +1,97 @@ +
+

Chip

+ Beta Component +
+ +Chips sind kontextabhängige Komponenten mit denen Nutzer\*innen Inhalte filtern oder Aktionen auslösen können. + +## Allgemein + +Chips bestehen aus relevanten Schlüsselwörtern in einem Container. Sie erscheinen häufig dynamisch – ausgelöst durch eine Aktion der Nutzer\*innen – und als Gruppe. + +### Verwende einen Chip, um + +- Nutzer\*innen Filtermöglichkeiten anzubieten, +- die von Nutzer\*innen gesetzten Filter darzustellen oder +- Nutzer\*innen Optionen vorzuschlagen (Suchkriterien, Antwortmöglichkeiten). + +### Verwende Chips besser nicht, wenn + +- du ein Element kategorisieren möchtest (hier sind Tags besser geeignet) oder +- wenn du stattdessen einen Button verwenden kannst. + +## Basistypen + +![Image Name](assets/3_components/chip/Chips-Types.png) + +### Persistente Chips + +Persistente Chips sind fester Bestandteil des UIs und lassen sich aus- und abwählen. + +![Image Name](assets/3_components/chip/Chips-Persistent-Default.png) + +**Beispiel 1 – Default**
+Eine Gruppe von Filtermöglichkeiten als fester Bestandteil des UI + +![Image Name](assets/3_components/chip/Chips-Persistent-Selected.png) + +**Beispiel 2 - Filter ausgewählt**
+Ausgewählte Filter erkennen Nutzer\*innen am Checkmark Icon. + +### Dynamische Chips + +Dynamische Chips blenden sich nach einer Aktion der Nutzer\*innen ein oder aus. + +![Image Name](assets/3_components/chip/Chips-Dynamic-Example1.png) + +**Beispiel 1**
+Der Chip blendet sich ein, nachdem Nutzer\*innen einen Filter gesetzt haben. Per Klick/Tap auf das Schließen-Icon blendet er sich wieder aus und der Filter ist zurückgesetzt. + +![Image Name](assets/3_components/chip/Chips-Dynamic-Example_Chatbot2.png) + +**Beispiel 2**
+Eine Gruppe von Antwortmöglichkeiten in einem Chat. Nach Klick/Tap auf den Chip blendet er sich wieder aus. + +## Varianten + +![Image Name](assets/3_components/chip/Standard_Chip.png) + +Chips lassen sich in zwei Varianten darstellen: Standard und Outline. + +### Deaktivierter Zustand + +![Image Name](assets/3_components/chip/chips-disabled-de.png) + +Im deaktivierten Zustand ist die interaktive Funktion des Chips ausgeschaltet. Verwende diesen Zustand, wenn eine Interaktion aufgrund von Berechtigungen oder Abhängigkeiten nicht möglich ist. + +### Elemente + +![Image Name](assets/3_components/chip/Chips-elements.png) + +#### Label (1) + +Das Label des Chips sollte kurz und verständlich sein. + +#### Checkmark Icon (2) + +Je nach Typ wird das Schließen-Icon oder Checkmark Icon angezeigt. + +#### Icon (3) (Optional) + +Füge ein Icon hinzu, wenn Nutzer\*innen die Funktion des Chips dadurch leichter verstehen können. + +## Best Practice + +### Chips in Gruppierungen + +- Ordne Chips horizontal oder vertikal an. +- Vertikale Layouts eigenen sich zum Beispiel für ein Seitenmenü, das Chips-Gruppierungen integrieren soll. +- Horizontal angeordnete Chips befinden sich häufig oberhalb vom Inhalt auf den sie sich beziehen. +- Formuliere das Label so präzise wie möglich. + +## Verwandte Komponenten + +[Tag](?path=/usage/components-tag--standard), +[Button](?path=/usage/components-button--standard), +[Segmented Button](?path=/usage/beta-components-segmented-button--standard), +[Checkbox Group](?path=/usage/components-checkbox-group--standard) diff --git a/packages/storybook-vue/stories/components/segmented-button/ScaleSegmentedButton.vue b/packages/storybook-vue/stories/components/segmented-button/ScaleSegmentedButton.vue new file mode 100644 index 0000000000..a0e3c4aa54 --- /dev/null +++ b/packages/storybook-vue/stories/components/segmented-button/ScaleSegmentedButton.vue @@ -0,0 +1,41 @@ + + + diff --git a/packages/storybook-vue/stories/components/segmented-button/SegmentedButton.stories.mdx b/packages/storybook-vue/stories/components/segmented-button/SegmentedButton.stories.mdx new file mode 100644 index 0000000000..d8b3ea414b --- /dev/null +++ b/packages/storybook-vue/stories/components/segmented-button/SegmentedButton.stories.mdx @@ -0,0 +1,348 @@ +import { Meta, Story, ArgsTable, Canvas } from '@storybook/addon-docs'; +import ScaleSegmentedButton from './ScaleSegmentedButton.vue'; + + + +export const Template = (args, { argTypes }) => ({ + components: { ScaleSegmentedButton }, + props: { + label: String, + icon: String, + ...ScaleSegmentedButton.props, + }, + template: ` + + Apple + One+ + Samsung + Huawei + + `, +}); + +export const MultiSelectTemplate = (args, { argTypes }) => ({ + components: { ScaleSegmentedButton }, + props: { + label: String, + icon: String, + ...ScaleSegmentedButton.props, + }, + template: ` + + Apple + One+ + Samsung + Huawei + + `, +}); + +export const IconOnlyTemplate = (args, { argTypes }) => ({ + components: { ScaleSegmentedButton }, + props: { + label: String, + icon: String, + ...ScaleSegmentedButton.props, + }, + template: ` + + + + + + + `, +}); + +export const IconTextTemplate = (args, { argTypes }) => ({ + components: { ScaleSegmentedButton }, + props: { + label: String, + icon: String, + ...ScaleSegmentedButton.props, + }, + template: ` + + Apple + One+ + Samsung + Huawei + + `, +}); + +export const DisabledTemplate = (args, { argTypes }) => ({ + components: { ScaleSegmentedButton }, + props: { + label: String, + icon: String, + disabled: 'true', + ...ScaleSegmentedButton.props, + }, + template: ` + + Apple + One+ + Samsung + Huawei + + `, +}); + +export const DisabledSegmentTemplate = (args, { argTypes }) => ({ + components: { ScaleSegmentedButton }, + props: { + label: String, + icon: String, + disabled: true, + ...ScaleSegmentedButton.props, + }, + template: ` + + Apple + One+ + Samsung + Huawei + + `, +}); + +export const InvalidTemplate = (args, { argTypes }) => ({ + components: { ScaleSegmentedButton }, + props: { + label: String, + icon: String, + invalid: Boolean, + ...ScaleSegmentedButton.props, + }, + template: ` + + Apple + One+ + Samsung + Huawei + + `, +}); + +## Standard + + + + {Template.bind({})} + + + + + +```html + + Apple + One+ + Samsung + Huawei + +``` + +## Multi Select + + + + {MultiSelectTemplate.bind({})} + + + +```html + + Apple + One+ + Samsung + Huawei + +``` + +## Disabled + +### Disabled Segment + + + + {DisabledSegmentTemplate.bind({})} + + + +```html + + Apple + One+ + Samsung + Huawei + +``` + +### Disabled Button + + + + {DisabledTemplate.bind({})} + + + +```html + + Apple + One+ + Samsung + Huawei + +``` + +## Icon only + + + + {IconOnlyTemplate.bind({})} + + + +```html + + + + + + + + + + + + + + + + + + +``` + +## Icon and Text + + + + {IconTextTemplate.bind({})} + + + +```html + + + + + Apple + + + + + One+ + + + + + Samsung + + + + + Huawei + + +``` + +## Invalid + + + + {InvalidTemplate.bind({})} + + + +```html + + + + + Apple + + + + + One+ + + + + + Samsung + + + + + Huawei + + +``` diff --git a/packages/storybook-vue/stories/components/segmented-button/segmented-button.md b/packages/storybook-vue/stories/components/segmented-button/segmented-button.md new file mode 100644 index 0000000000..0c622960bf --- /dev/null +++ b/packages/storybook-vue/stories/components/segmented-button/segmented-button.md @@ -0,0 +1,130 @@ +
+

Segmented Button

+ Beta Component +
+ +Segmented buttons make it easier for users to filter content, select options, or change views. + +## General + +A segmented button can consist of two to five selection options, where the options always belong to a common category. Selecting both single and multiple options is possible. + +![Image Name](assets/3_components/segmented-button/SegmentedButton-Text_Only_1.png) + +### When to use + +Use a segmented button to: + +- display selected filters, +- offer functions like sorting content or changing views, or +- provide input options. + +### When not to use + +Don’t use a segmented button when: + +- there are more than five selection options, +- the options are not logically related, +- actions should be triggered (e.g., editing, adding, or deleting), or +- the view should switch between separate content (use tabs instead). + +## Basic types + +### Single selection + +![Image Name](assets/3_components/segmented-button/SegmentedButton-Single_Select.png) + +As with the Radio Button Group, users can only select one option. One option is always preselected. If necessary, specify a neutral option – for example "All" to override the set filters. + +### Multiple selection + +![Image Name](assets/3_components/segmented-button/SegmentedButton-Multiselect.png) + +As with Check Box Groups, users can also select multiple options. Multiple selections are typically used to filter content. + +## Variants + +### Text only + +![Image Name](assets/3_components/segmented-button/SegmentedButton-Text_Only_1.png) + +A text that describes the option is ideal for most use cases. In the selected state, add a checkmark icon to the segmented button. + +### Icon and text + +![Image Name](assets/3_components/segmented-button/SegmentedButton-Text_Icon.png) + +Add appropriate icons to clarify options (optional). In the selected state, a checkmark icon replaces the previously displayed icon. + +### Icon only + +![Image Name](assets/3_components/segmented-button/Icon_Only.png) + +If the icon clearly refers to the action, you can omit the text. In this case, set an aria-label for the screen reader. +By default, icons are used in the outline variant. Flat icons indicate a selected status. + +## Sizes + +![Image Name](assets/3_components/segmented-button/SegmentedButton-Sizes.png) + +Segmented buttons are available in three different sizes: + +- Small +- Medium +- Large + +The segment with the longest label dictates the width of all segments. If necessary, you can switch the segmented button to the full width of the area + +## Disabled state + +![Image Name](assets/3_components/segmented-button/SegmentedButton-Disabled.png) + +If an interaction is temporarily unavailable, you can deactivate the entire component or just individual segments of the segmented button. + +## Elements + +![Image Name](assets/3_components/segmented-button/SegmentedButton-Elements-2.png) + +### Group label (1) (optional) + +Choose a short descriptive title for the whole group (for example, "Sort by" or "Distance"). + +### Container (2) + +The container visually summarizes all the options or fields of a segmented button into a group. + +### Segment (3) + +Each selection is represented as a segment. With a multiple selection, group adjacent selected segments together. + +### Icon (4) (optional) + +The icon either supports the label to illustrate the content or replaces the text as a standalone variant. + +### Label (5) + +The label describes individual choices and should be short and precise. + +## Best practice + +- Don’t mix variants: text only, text and icon, or icon only. +- Use short and clear labels. +- Offer a neutral option, for example to disable filters and sorting. +- Use the full width option on mobile devices and make sure the total width doesn't exceed the smallest display size (320 px). + +## Examples + +![Image Name](assets/3_components/segmented-button/SegmentedButton-Filter-list.png) + +![Image Name](assets/3_components/segmented-button/SegmentedButton-SortBy-Price.png) + +![Image Name](assets/3_components/segmented-button/Map.png) + +## Related components + +[Tab Navigation](?path=/usage/components-tab-navigation--text-icon), +[Button](?path=/usage/components-button--standard), +[Radio Button Group](?path=/usage/components-radio-button-group--standard), +[Checkbox Group](?path=/usage/components-checkbox-group--standard), +[Chip](?path=/usage/beta-components-chip--standard), +[Icon Button](?path=/usage/components-button--icon-only) diff --git a/packages/storybook-vue/stories/components/segmented-button/segmented-button_de.md b/packages/storybook-vue/stories/components/segmented-button/segmented-button_de.md new file mode 100644 index 0000000000..5a597d6eba --- /dev/null +++ b/packages/storybook-vue/stories/components/segmented-button/segmented-button_de.md @@ -0,0 +1,127 @@ +
+

Segmented Button

+ Beta Component +
+ +Segmented Buttons erleichtern Nutzer\*innen das Filtern von Inhalten, die Auswahl von Optionen oder dem Wechsel von Ansichten. + +## Allgemein + +Ein Segmented Button besteht aus zwei bis fünf Auswahlmöglichkeiten derselben Kategorie. Mit dem Segmented Button kannst du sowohl einzelne Optionen auswählen als auch mehrere gleichzeitig. + +![Image Name](assets/3_components/segmented-button/SegmentedButton-Text_Only_1.png) + +### Verwende einen Segmented Button, um + +- ausgewählte Filter anzuzeigen, +- Funktionen wie Inhalte sortieren oder Ansicht ändern anzubieten oder +- Eingabebeoptionen zur Verfügung zu stellen. + +### Verwende Segmented Buttons besser nicht, wenn + +- es mehr als fünf Auswahlmöglichkeiten gibt, +- die Optionen in keinem logischen Zusammenhang stehen, +- Aktionen ausgelöst werden sollen (zum Beispiel Editieren, Hinzufügen oder Löschen) oder +- die Ansicht zwischen unterschiedlichen Inhalten gewechselt werden soll (hierfür sind Tabs besser geeignet). + +## Basistypen + +### Einfachauswahl + +![Image Name](assets/3_components/segmented-button/SegmentedButton-Single_Select.png) + +Wie bei der Radio Button Group können Nutzer\*innen nur eine Option auswählen. Es ist immer eine Option vorausgewählt. Gib bei Bedarf eine neutrale Option an – zum Beispiel „Alle“, um gesetzte Filter aufzuheben. + +### Mehrfachauswahl + +![Image Name](assets/3_components/segmented-button/SegmentedButton-Multiselect.png) + +Wie bei Check Box Groups kannst du auch mehrere Optionen auswählen. Die Mehrfachauswahl wird in der Regel zum Filtern von Inhalten benutzt. + +## Varianten + +### Nur Text + +![Image Name](assets/3_components/segmented-button/SegmentedButton-Text_Only_1.png) + +Für die meisten Use Cases reicht ein Text, der die Option beschreibt. Ein Checkmark Icon verdeutlicht den ausgewählten Zustand. + +### Icon und Text + +![Image Name](assets/3_components/segmented-button/SegmentedButton-Text_Icon.png) + +Füge passende Icons hinzu, um die Optionen zu verdeutlichen (optional). Im ausgewählten Zustand ersetzt ein Checkmark Icon das vorher dargestellte Icon. + +### Nur Icon + +![Image Name](assets/3_components/segmented-button/Icon_Only.png) + +Verweist das Icon eindeutig auf die Aktion, kannst du den Text weglassen. Setze in diesem Fall ein Aria-Label für den Screenreader. Icons werden per Default in der Outline-Variante verwendet. Flächige Icons bedeuten, dass das Segment ausgewählt ist. + +## Größen + +![Image Name](assets/3_components/segmented-button/SegmentedButton-Sizes.png) + +Der Segmented Button ist in drei Größen verfügbar: + +- Small +- Medium +- Large + +Das Segment mit dem längsten Label gibt die Breite aller Segmente vor. Bei Bedarf kannst du den Segmented Button auf eine flächenfüllende Breite umschalten. + +## Deaktivierter Zustand + +![Image Name](assets/3_components/segmented-button/SegmentedButton-Disabled.png) + +Du kannst sowohl die gesamte Komponente als auch nur einzelne Segmente des Segmented Buttons deaktivieren, wenn eine Interaktion temporär nicht möglich ist. + +## Elemente + +![Image Name](assets/3_components/segmented-button/SegmentedButton-Elements-2.png) + +### Gruppenlabel (1) (optional) + +Wähle einen kurzen unterstützenden Titel für die gesamte Gruppe (zum Beispiel „Sortieren nach“ oder „Distanz“). + +### Container (2) + +Der Container fasst alle Optionen bzw. die Segmente des Segmented Buttons visuell zu einer Gruppe zusammen. + +### Segment (3) + +Jede Auswahlmöglichkeit wird als ein Segment dargestellt. Bei der Mehrfachauswahl sind nebeneinanderliegende, ausgewählte Segmente zu einer Gruppe zusammengefasst. + +### Icon (4) (optional) + +Das Icon unterstützt entweder das Label, um den Inhalt zu veranschaulichen, oder ersetzt den Text als eigenständige Variante. + +### Label (5) + +Das Label beschreibt einzelne Auswahlmöglichkeiten und sollte kurz und präzise sein. + +## Best Practice + +- Mische keine Varianten: Nur Text, Text und Icon, Nur Icon. +- Verwende kurze und eindeutige Labels. +- Biete eine neutrale Option, um zum Beispiel Filter und Sortierungen zu deaktivieren. +- Nutze die Full-Width-Option auf Mobilgeräten und stelle sicher, dass die Gesamtbereite nicht die kleinste Displaygröße (320px) überschreitet. + +### Beispiele + +![Image Name](assets/3_components/segmented-button/SegmentedButton-Filter-list-DE.png) + +![Image Name](assets/3_components/segmented-button/SegmentedButton-SortBy-Price-DE.png) + +![Image Name](assets/3_components/segmented-button/Map-DE.png) + +![Image Name](assets/3_components/segmented-button/SegmentedButton-Tip-DE.png) + +## Verwandte Komponenten + +[Tab Navigation](?path=/usage/components-tab-navigation--text-icon), +[Button](?path=/usage/components-button--standard), +[Radio Button Group](?path=/usage/components-radio-button-group--standard), +[Checkbox Group](?path=/usage/components-checkbox-group--standard), +[Chip](?path=/usage/beta-components-chip--standard), +[Icon Button](?path=/usage/components-button--icon-only) diff --git a/packages/storybook-vue/stories/components/tag/tag.md b/packages/storybook-vue/stories/components/tag/tag.md index fb06d5410d..4c1919bcb9 100644 --- a/packages/storybook-vue/stories/components/tag/tag.md +++ b/packages/storybook-vue/stories/components/tag/tag.md @@ -89,3 +89,7 @@ By clicking/tapping on the icon, users remove the tag. - Decide on one size for your tags. - Use a clear keyword for the label. + +## Related components + +[Chip](?path=/usage/components-chip--standard), diff --git a/packages/storybook-vue/stories/components/tag/tag_de.md b/packages/storybook-vue/stories/components/tag/tag_de.md index 67cd310c6a..9fbf4335e6 100644 --- a/packages/storybook-vue/stories/components/tag/tag_de.md +++ b/packages/storybook-vue/stories/components/tag/tag_de.md @@ -85,3 +85,7 @@ Per Klick/Tap auf das Icon blenden Nutzer\*innen den Tag aus. - Wähle eine einheitliche Größe für Tags. - Verwende eine eindeutige Bezeichnung für das Label. + +## Verwandte Komponenten + +[Chip](?path=/usage/components-chip--standard), diff --git a/packages/storybook-vue/stories/components/toggle-group/ToggleGroup.stories.mdx b/packages/storybook-vue/stories/components/toggle-group/ToggleGroup.stories.mdx index 3158963619..020a76e817 100644 --- a/packages/storybook-vue/stories/components/toggle-group/ToggleGroup.stories.mdx +++ b/packages/storybook-vue/stories/components/toggle-group/ToggleGroup.stories.mdx @@ -2,7 +2,7 @@ import { Meta, Story, ArgsTable, Canvas } from '@storybook/addon-docs'; import ScaleToggleGroup from './ScaleToggleGroup.vue'; ({ ```html - - + Label - Label - ({ ```html - + diff --git a/packages/storybook-vue/stories/components/toggle-group/toggle-group.md b/packages/storybook-vue/stories/components/toggle-group/toggle-group.md index 1f1ca5b096..04e26af23a 100644 --- a/packages/storybook-vue/stories/components/toggle-group/toggle-group.md +++ b/packages/storybook-vue/stories/components/toggle-group/toggle-group.md @@ -1,11 +1,6 @@
-

Toggle-Group

- Beta Component +

Toggle Group

+ Deprecated Component
-A Toggle-Group ist eine collection of Toggle-Buttons. -Depending on the settings there may be only one Toggle-Button activated/selected (radio-group principle) or more (checkbox-group princple) of them. - -## Beta components - -This component is still in the beta phase. When testing it, keep in mind that it may not have gone through all quality control measures, and it may not yet have WCAG accessibility certification. There may be changes to this component in the future. +We no longer support the Toggle Group. Please use the [Segmented Button](?path=/usage/beta-components-segmented-button--standard) instead. diff --git a/packages/storybook-vue/stories/components/toggle-group/toggle-group_de.md b/packages/storybook-vue/stories/components/toggle-group/toggle-group_de.md index 1a4a11c4d9..dd9c82e4d3 100644 --- a/packages/storybook-vue/stories/components/toggle-group/toggle-group_de.md +++ b/packages/storybook-vue/stories/components/toggle-group/toggle-group_de.md @@ -1,11 +1,6 @@

Toggle Group

- Beta Component + Deprecated Component
-Eine Toggle-Group ist eine Ansammlung von Toggle-Buttons. -Je nach Einstellung kann nur ein Toggle-Button (Prinzip einer Radio-Gruppe) oder mehrere (Prinzip einer Checkbox-Gruppe) aktiv (selektiert) sein. - -## Beta-Komponente - -Diese Komponente befindet sich noch im Beta-Stadium. Wenn du sie testest, bedenke, dass sie möglicherweise noch nicht alle Qualitätskontrollmaßnahmen durchlaufen hat und noch keine WCAG-Zertifizierung zur Barrierefreiheit vorliegt. In Zukunft kann es zu Änderungen an dieser Komponente kommen. +Wir unterstützen die Toggle Group nicht mehr. Bitte verwende stattdessen den [Segmented Button](?path=/usage/beta-components-segmented-button--standard). diff --git a/packages/storybook-vue/stories/update_history/Design_de.md b/packages/storybook-vue/stories/update_history/Design_de.md index dc9a0c8ce3..5799f2fddc 100644 --- a/packages/storybook-vue/stories/update_history/Design_de.md +++ b/packages/storybook-vue/stories/update_history/Design_de.md @@ -2,6 +2,16 @@ Diese Seite dokumentiert Updates der visuellen Erscheinung von Scale +## Neue Beta-Komponenten + +25.01.2023 + +- Veröffentlichung der neuen Beta-Komponenten Segmented Button und Chip. +- Der Segmented Button ersetzt die Beta-Komponente Toggle Group. +- Neue Kategorie „Deprecated Components“. Hier sind Komponenten aufgelistet, die wir nicht weiter unterstützen. + +
+ ## Komponenten-Update (Optimierung von Mobile und Visual Design) 27.10.2022 diff --git a/packages/storybook-vue/stories/update_history/Design_en.md b/packages/storybook-vue/stories/update_history/Design_en.md index 7a072f0901..abb438c6af 100644 --- a/packages/storybook-vue/stories/update_history/Design_en.md +++ b/packages/storybook-vue/stories/update_history/Design_en.md @@ -2,6 +2,16 @@ This page documents updates to the visual appearance of Scale. +## New Beta Components + +25.01.2023 + +- Release of the new beta components Segmented Button and Chip. +- The Segmented Button replaces the beta component Toggle Group. +- New category Deprecated Components. This lists components we no longer support. + +
+ ## Component Update (Optimized Mobile and Visual Design) 27.10.2022 diff --git a/packages/storybook-vue/stories/update_history/Development_de.md b/packages/storybook-vue/stories/update_history/Development_de.md index f97fafa8be..6e5fb0b4ab 100644 --- a/packages/storybook-vue/stories/update_history/Development_de.md +++ b/packages/storybook-vue/stories/update_history/Development_de.md @@ -2,6 +2,16 @@ Diese Seite dokumentiert Aktualisierungen in `@telekom/scale-components` und verwandten Paketen. +## Neue Beta-Komponenten + +25.01.2023 + +- Veröffentlichung der neuen Beta-Komponenten Segmented Button und Chip. +- Der Segmented Button ersetzt die Beta-Komponente Toggle Group. +- Neue Kategorie „Deprecated Components“. Hier sind Komponenten aufgelistet, die wir nicht weiter unterstützen. + +
+ ## Komponenten-Update (Optimierung von Mobile und Visual Design) 27.10.2022 diff --git a/packages/storybook-vue/stories/update_history/Development_en.md b/packages/storybook-vue/stories/update_history/Development_en.md index 3a9209bb9a..4de02bc41d 100644 --- a/packages/storybook-vue/stories/update_history/Development_en.md +++ b/packages/storybook-vue/stories/update_history/Development_en.md @@ -2,6 +2,16 @@ This page documents updates in `@telekom/scale-components` and related packages. +## New Beta Components + +25.01.2023 + +- Release of the new beta components Segmented Button and Chip. +- The Segmented Button replaces the beta component Toggle Group. +- New category Deprecated Components. This lists components we no longer support. + +
+ ## Component Update (Optimized Mobile and Visual Design) 27.10.2022 diff --git a/packages/storybook-vue/translations.json b/packages/storybook-vue/translations.json index 778d281822..76adb4eaa0 100644 --- a/packages/storybook-vue/translations.json +++ b/packages/storybook-vue/translations.json @@ -23,7 +23,7 @@ "elementSelector": "#new-release", "en": "New Release", "de": "New Release" - }, + }, { "elementSelector": "#new-release-release-notes--page", "en": "Release Notes", @@ -127,7 +127,11 @@ "en": "Beta Components", "de": "Beta Komponenten" }, - + { + "elementSelector": "#deprecated-components", + "en": "Deprecated Components", + "de": "Deprecated Komponenten" + }, { "elementSelector": "#update-history", "en": "Update History", diff --git a/packages/storybook-vue/yarn.lock b/packages/storybook-vue/yarn.lock index 99e7bbc45b..d5ea9fb140 100644 --- a/packages/storybook-vue/yarn.lock +++ b/packages/storybook-vue/yarn.lock @@ -4395,19 +4395,19 @@ camelcase@^6.2.0: integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== caniuse-lite@^1.0.30001093: - version "1.0.30001102" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001102.tgz#3275e7a8d09548f955f665e532df88de0b63741a" - integrity sha512-fOjqRmHjRXv1H1YD6QVLb96iKqnu17TjcLSaX64TwhGYed0P1E1CCWZ9OujbbK4Z/7zax7zAzvQidzdtjx8RcA== + version "1.0.30001436" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001436.tgz" + integrity sha512-ZmWkKsnC2ifEPoWUvSAIGyOYwT+keAaaWPHiQ9DfMqS1t6tfuyFYoWR78TeZtznkEQ64+vGXH9cZrElwR2Mrxg== caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001317: - version "1.0.30001325" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001325.tgz#2b4ad19b77aa36f61f2eaf72e636d7481d55e606" - integrity sha512-sB1bZHjseSjDtijV1Hb7PB2Zd58Kyx+n/9EotvZ4Qcz2K3d0lWB8dB4nb8wN/TsOGFq3UuAm0zQZNQ4SoR7TrQ== + version "1.0.30001436" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001436.tgz" + integrity sha512-ZmWkKsnC2ifEPoWUvSAIGyOYwT+keAaaWPHiQ9DfMqS1t6tfuyFYoWR78TeZtznkEQ64+vGXH9cZrElwR2Mrxg== caniuse-lite@^1.0.30001332: - version "1.0.30001346" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001346.tgz#e895551b46b9cc9cc9de852facd42f04839a8fbe" - integrity sha512-q6ibZUO2t88QCIPayP/euuDREq+aMAxFE5S70PkrLh0iTDj/zEhgvJRKC2+CvXY6EWc6oQwUR48lL5vCW6jiXQ== + version "1.0.30001436" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001436.tgz" + integrity sha512-ZmWkKsnC2ifEPoWUvSAIGyOYwT+keAaaWPHiQ9DfMqS1t6tfuyFYoWR78TeZtznkEQ64+vGXH9cZrElwR2Mrxg== capture-exit@^2.0.0: version "2.0.0" diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-dynamic-selection-outline-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-dynamic-selection-outline-1-snap.png new file mode 100644 index 0000000000..a46aa2fe29 Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-dynamic-selection-outline-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-dynamic-selection-standard-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-dynamic-selection-standard-1-snap.png new file mode 100644 index 0000000000..3aa87deb08 Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-dynamic-selection-standard-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-dynamic-suggestion-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-dynamic-suggestion-1-snap.png new file mode 100644 index 0000000000..b072affad3 Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-dynamic-suggestion-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-outline-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-outline-1-snap.png new file mode 100644 index 0000000000..b072affad3 Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-outline-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-outline-disabled-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-outline-disabled-1-snap.png new file mode 100644 index 0000000000..ccb9498610 Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-outline-disabled-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-outline-selected-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-outline-selected-1-snap.png new file mode 100644 index 0000000000..da8dc14f77 Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-outline-selected-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-outline-selected-disabled-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-outline-selected-disabled-1-snap.png new file mode 100644 index 0000000000..df033bc06e Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-outline-selected-disabled-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-standard-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-standard-1-snap.png new file mode 100644 index 0000000000..b072affad3 Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-standard-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-standard-disabled-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-standard-disabled-1-snap.png new file mode 100644 index 0000000000..ccb9498610 Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-standard-disabled-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-standard-selected-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-standard-selected-1-snap.png new file mode 100644 index 0000000000..d72aeaf328 Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-standard-selected-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-standard-selected-disabled-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-standard-selected-disabled-1-snap.png new file mode 100644 index 0000000000..09d438c18f Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-dark-persistent-standard-selected-disabled-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-dynamic-selection-outline-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-dynamic-selection-outline-1-snap.png new file mode 100644 index 0000000000..6a6571be15 Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-dynamic-selection-outline-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-dynamic-selection-standard-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-dynamic-selection-standard-1-snap.png new file mode 100644 index 0000000000..90730dacb1 Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-dynamic-selection-standard-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-dynamic-suggestion-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-dynamic-suggestion-1-snap.png new file mode 100644 index 0000000000..ea4cda5e2d Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-dynamic-suggestion-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-outline-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-outline-1-snap.png new file mode 100644 index 0000000000..ea4cda5e2d Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-outline-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-outline-disabled-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-outline-disabled-1-snap.png new file mode 100644 index 0000000000..1686cff444 Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-outline-disabled-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-outline-selected-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-outline-selected-1-snap.png new file mode 100644 index 0000000000..1d3ddd7616 Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-outline-selected-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-outline-selected-disabled-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-outline-selected-disabled-1-snap.png new file mode 100644 index 0000000000..9f8ea3d212 Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-outline-selected-disabled-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-standard-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-standard-1-snap.png new file mode 100644 index 0000000000..ea4cda5e2d Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-standard-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-standard-disabled-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-standard-disabled-1-snap.png new file mode 100644 index 0000000000..1686cff444 Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-standard-disabled-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-standard-selected-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-standard-selected-1-snap.png new file mode 100644 index 0000000000..8d0efc635a Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-standard-selected-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-standard-selected-disabled-1-snap.png b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-standard-selected-disabled-1-snap.png new file mode 100644 index 0000000000..363035fd30 Binary files /dev/null and b/packages/visual-tests/src/__image_snapshots__/chip-visual-spec-js-chip-light-persistent-standard-selected-disabled-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-disabled-1-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-disabled-1-snap.png index c063a713d5..c82177d997 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-disabled-1-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-disabled-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-full-width-1-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-full-width-1-snap.png index a1b0ed3577..990bb497b8 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-full-width-1-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-full-width-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-grey-background-1-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-grey-background-1-snap.png index 66244967db..450dd7c3f3 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-grey-background-1-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-grey-background-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-icon-before-1-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-icon-before-1-snap.png index 05f7a5c3ec..d2966ee6a4 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-icon-before-1-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-icon-before-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-1-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-1-snap.png index 5c78cbb61f..ea0e8f1b4c 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-1-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-2-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-2-snap.png index fd62b8169e..beab4b61c4 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-2-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-2-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-3-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-3-snap.png index b917b8a132..a6b51b8fec 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-3-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-3-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-4-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-4-snap.png index 5c4dcd8270..d9b6b3c673 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-4-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-4-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-5-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-5-snap.png index 8814ecf13d..155b26ecfe 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-5-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-5-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-6-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-6-snap.png index 9aacd1106e..9d4e6fd3ae 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-6-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-monochrome-variant-6-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-no-border-1-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-no-border-1-snap.png index bdb30a53d9..c000c99632 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-no-border-1-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-no-border-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-single-select-1-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-single-select-1-snap.png index 99ab8377b8..dd628a63df 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-single-select-1-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-single-select-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-small-size-1-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-small-size-1-snap.png index 527b23fddb..2bf3cdec8b 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-small-size-1-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-small-size-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-1-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-1-snap.png index 99ab8377b8..dd628a63df 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-1-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-2-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-2-snap.png index 9d1ea1604e..4734252126 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-2-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-2-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-3-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-3-snap.png index c75da1bb44..26760ab0c9 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-3-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-3-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-4-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-4-snap.png index a35c18f424..f6cfa76246 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-4-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-4-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-5-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-5-snap.png index ec11a8ad76..2e67b9c183 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-5-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-5-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-6-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-6-snap.png index 80d123d49e..dd3994d1b4 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-6-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-dark-standard-6-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-disabled-1-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-disabled-1-snap.png index f792b653ff..6a92fe5c83 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-disabled-1-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-disabled-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-full-width-1-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-full-width-1-snap.png index 375708e165..ded65fd03d 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-full-width-1-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-full-width-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-grey-background-1-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-grey-background-1-snap.png index 69b4cf0a13..532773b933 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-grey-background-1-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-grey-background-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-icon-before-1-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-icon-before-1-snap.png index f698f788ed..3c37db8f02 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-icon-before-1-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-icon-before-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-1-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-1-snap.png index 1bdb541944..5d88baa208 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-1-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-2-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-2-snap.png index 22569013ff..ac1ef48869 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-2-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-2-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-3-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-3-snap.png index 240e099f47..9e6398c900 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-3-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-3-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-4-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-4-snap.png index 355374e6e3..5b462026e1 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-4-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-4-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-5-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-5-snap.png index a1bad628e5..6afc73f286 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-5-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-5-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-6-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-6-snap.png index 7798971a14..94fce01915 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-6-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-monochrome-variant-6-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-no-border-1-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-no-border-1-snap.png index f4920a7446..8d38db401f 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-no-border-1-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-no-border-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-single-select-1-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-single-select-1-snap.png index 2827df545b..4d2b932e6b 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-single-select-1-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-single-select-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-small-size-1-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-small-size-1-snap.png index 9ffb1cc874..a82e9474bb 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-small-size-1-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-small-size-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-1-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-1-snap.png index 2827df545b..4d2b932e6b 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-1-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-1-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-2-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-2-snap.png index 9a8323f99d..f8903153bd 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-2-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-2-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-3-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-3-snap.png index 99d3a29fc8..f0f985419c 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-3-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-3-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-4-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-4-snap.png index 33f32faab0..23f581bfea 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-4-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-4-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-5-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-5-snap.png index 0923353a57..11c04e6243 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-5-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-5-snap.png differ diff --git a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-6-snap.png b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-6-snap.png index 38f31b1adb..d6f03cd875 100644 Binary files a/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-6-snap.png and b/packages/visual-tests/src/__image_snapshots__/toggle-group-visual-spec-js-toggle-group-light-standard-6-snap.png differ diff --git a/packages/visual-tests/src/chip.visual.spec.js b/packages/visual-tests/src/chip.visual.spec.js new file mode 100644 index 0000000000..2902d015ed --- /dev/null +++ b/packages/visual-tests/src/chip.visual.spec.js @@ -0,0 +1,24 @@ +describe('Chip', () => { + describe.each(['light', 'dark'])('%p', (mode) => { + beforeAll(async () => { + await global.runColorSetup('components-chip--standard', mode); + }); + test.each([ + ['persistent-standard'], + ['persistent-standard-selected'], + ['persistent-standard-disabled'], + ['persistent-standard-selected-disabled'], + ['persistent-outline'], + ['persistent-outline-selected'], + ['persistent-outline-disabled'], + ['persistent-outline-selected-disabled'], + ['dynamic-suggestion'], + ['dynamic-selection-standard'], + ['dynamic-selection-outline'], + ])('%p', async (variant) => { + await global.runSetup(`beta-components-chip--${variant}`); + await global.page.waitFor(3000); + await global.visualCheck(); + }); + }); +}); diff --git a/packages/visual-tests/src/segmented-button.visual.spec.js b/packages/visual-tests/src/segmented-button.visual.spec.js new file mode 100644 index 0000000000..9456016ec2 --- /dev/null +++ b/packages/visual-tests/src/segmented-button.visual.spec.js @@ -0,0 +1,19 @@ +describe.skip('SegmentedButton', () => { + describe.each(['light', 'dark'])('%p', (mode) => { + beforeAll(async () => { + await global.runColorSetup('components-segmented-button--standard', mode); + }); + test.each([ + ['standard'], + ['multi-select'], + ['disabled-segment'], + ['disabled-button'], + ['icon-only'], + ['icon-and-text'], + ['invalid'], + ])('%p', async (variant) => { + await global.runSetup(`beta-components-segmented-button--${variant}`); + await global.visualCheck(); + }); + }); +}); diff --git a/packages/visual-tests/src/toggle-group.visual.spec.js b/packages/visual-tests/src/toggle-group.visual.spec.js index b49971df17..33a3bb6fe6 100644 --- a/packages/visual-tests/src/toggle-group.visual.spec.js +++ b/packages/visual-tests/src/toggle-group.visual.spec.js @@ -15,13 +15,13 @@ describe('ToggleGroup', () => { ['icon-before'], ['icon-only'], ])('%p', async (variant) => { - await global.runSetup(`beta-components-toggle-group--${variant}`); + await global.runSetup(`deprecated-components-toggle-group--${variant}`); await global.page.waitFor(500); await global.visualCheck(); }); // hover, active, focus test.each([['standard'], ['monochrome-variant']])('%p', async (variant) => { - await global.runSetup(`beta-components-toggle-group--${variant}`); + await global.runSetup(`deprecated-components-toggle-group--${variant}`); const buttonOne = await global.page.evaluateHandle( `document.querySelector("#root scale-toggle-group > scale-toggle-button[radius='left']").shadowRoot.querySelector("button")` ); diff --git a/yarn.lock b/yarn.lock index f7af105a74..3344d4abff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7979,6 +7979,11 @@ caniuse-lite@^1.0.30001370: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001382.tgz#4d37f0d0b6fffb826c8e5e1c0f4bf8ce592db949" integrity sha512-2rtJwDmSZ716Pxm1wCtbPvHtbDWAreTPxXbkc5RkKglow3Ig/4GNGazDI9/BVnXbG/wnv6r3B5FEbkfg9OcTGg== +caniuse-lite@^1.0.30001436: + version "1.0.30001436" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001436.tgz#22d7cbdbbbb60cdc4ca1030ccd6dea9f5de4848b" + integrity sha512-ZmWkKsnC2ifEPoWUvSAIGyOYwT+keAaaWPHiQ9DfMqS1t6tfuyFYoWR78TeZtznkEQ64+vGXH9cZrElwR2Mrxg== + canonical-path@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/canonical-path/-/canonical-path-1.0.0.tgz"