Skip to content

Commit

Permalink
docs: updates storybook documentation (#2382)
Browse files Browse the repository at this point in the history
* feat(storybook-vue): added multiple props to component documentation in storybook

* feat(storybook-vue): added types to logged out and logged in in telekom brand header component

* docs(storybook-vue): refactors props for multiple component documentation in storybook

* "docs(storybook-vue): refactors props for multiple component documentation in storybook

* docs(storybook-vue): refactors props for multiple component documentation in storybook

* docs(storybook-vue): refactors props for multiple component documentation in storybook

---------

Co-authored-by: Gammel <[email protected]>
  • Loading branch information
MaxGammel and Gammel authored Jan 29, 2025
1 parent 0874436 commit 525e1c4
Show file tree
Hide file tree
Showing 48 changed files with 318 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
:styles="styles"
>
<slot></slot>
<slot name="separator"></slot>
</scale-breadcrumb>
</template>

<script>
export default {
props: {
separator: String,
separator: { type: String},
styles: { type: String }
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
:value="value"
:variant="variant"
:icon-only="iconOnly"
:icon-position="iconPosition"
:inner-tabindex="innerTabindex"
:inner-aria-label="innerAriaLabel"
:styles="styles"
Expand All @@ -36,6 +37,7 @@ export default {
variant: String,
size: String,
iconOnly: Boolean,
iconPosition: String,
innerTabindex: Number,
innerAriaLabel: String,
styles: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@ import ScaleCheckboxGroup from './ScaleCheckboxGroup.vue';
argTypes={{}}
/>

export const Template = (args, { argTypes }) => ({
components: { ScaleCheckboxGroup },
props: ScaleCheckboxGroup.props,
template: `
<scale-checkbox-group
:name="name"
:label="label"
:helper-text="helperText"
:aria-label-checkbox-group="ariaLabelCheckboxGroup"
:invalid="invalid"
:select-text="selectText"
:unselect-text="unselectText"
:value="value"
:input-id="inputId"
:styles="styles"
:status="status"
></scale-checkbox-group>
`,
});

<div
style={{
display: 'inline-flex',
Expand All @@ -28,7 +48,9 @@ import ScaleCheckboxGroup from './ScaleCheckboxGroup.vue';
## Standard

<Canvas withSource="none">
<Story name="Standard" args={{}}>
<Story
name="Standard"
args={{}}>
{() => ({
template: `
<scale-checkbox-group label="Group Label" name="group" value="">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
<template>
<div>
<!-- this has the slots show up in ArgsTable -->
<scale-checkbox-group>
:name="name"
:label="label"
:helper-text="helperText"
:aria-label-checkbox-group="ariaLabelCheckboxGroup"
:invalid="invalid"
:select-text="selectText"
:unselect-text="unselectText"
:value="value"
:input-id="inputId"
:styles="styles"
:status="status"
<slot></slot>
</div>
</scale-checkbox-group>
</template>

<script>
Expand All @@ -11,14 +21,14 @@ export default {
name: { type: String },
label: { type: String, default: '' },
helperText: { type: String },
ariaLabelCheckboxGroup: { type: String },
ariaLabelCheckboxGroup: { type: String, default: 'COMMENT: ariaLabelCheckboxGroup should replace ariaLabel' },
invalid: { type: Boolean },
selectText: { type: String, default: 'Select all' },
unselectText: { type: String, default: 'Unselect all' },
value: { type: String, default: '' },
inputId: { type: String },
styles: { type: String },
status: { type: String, default: 'COMMENT: DEPRECATED - invalid should replace status'}
},
};
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ import {
import ScaleCheckbox from './ScaleCheckbox.vue';
import { action } from '@storybook/addon-actions';

<Meta title="Components/Checkbox" component={ScaleCheckbox} argTypes={{}} />
<Meta
title="Components/Checkbox"
component={ScaleCheckbox}
argTypes={{
status: {
description: 'DEPRECATED - invalid should replace status'
}
}}
/>

export const Template = (args, { argTypes }) => ({
props: {
Expand All @@ -27,6 +35,9 @@ export const Template = (args, { argTypes }) => ({
:value="value"
:input-id="inputId"
:required="required"
:hide-label="hideLabel"
:status="status"
:styles="styles"
@scaleChange="action('scaleChange')($event)"
@scale-change="action('scale-change')($event)"
></scale-checkbox>
Expand Down Expand Up @@ -68,9 +79,8 @@ export const Template = (args, { argTypes }) => ({
```css
scale-checkbox {
--spacing-x: var(--telekom-spacing-composition-space-04);
--transition: all var(--telekom-motion-duration-transition) var(
--telekom-motion-easing-standard
);
--transition: all var(--telekom-motion-duration-transition)
var(--telekom-motion-easing-standard);
--color-text: var(--telekom-color-text-and-icon-standard);
--color-error: var(--telekom-color-functional-danger-standard);
--color-disabled: var(--telekom-color-text-and-icon-disabled);
Expand Down Expand Up @@ -255,4 +265,4 @@ scale-checkbox {
></scale-icon-alert-imprint-dataprivacy>
</span>
</scale-checkbox>
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
:input-id="inputId"
:required="required"
:aria-label-checkbox="ariaLabelCheckbox"
:hide-label="hideLabel"
:status="status"
:styles="styles"
@scaleChange="scaleChange"
>
</scale-checkbox>
Expand All @@ -33,6 +36,9 @@ export default {
required: { type: Boolean },
ariaLabelCheckbox: { type: String },
ariaDetailsId: { type: String },
hideLabel: { type: Boolean},
status: { type: String },
styles: { type: String },
},
methods: {
scaleChange($event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ import { action } from '@storybook/addon-actions';
disabled: {
description: `only valid for persistent type`,
},
ariaCheckedState :{
description: ' DEPRECATED - (optional) chip aria-checked - should be derived from selected state attribute'
}
}}
/>

Expand Down
4 changes: 4 additions & 0 deletions packages/storybook-vue/stories/components/chip/ScaleChip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
:aria-role-title="ariaRoleTitle"
:disabled="disabled"
:styles="styles"
:label="label"
:dismiss-text="dismissText"
@scaleChange="scaleChange"
@scaleClose="scaleClose"
>
Expand All @@ -26,6 +28,8 @@ export default {
styles: { type: 'switch' | 'radio' | 'option' | 'menuitemreadio' | 'menuitemcheckbox' | 'checkbox', default: 'switch'},
ariaRoleTitle: { type: String },
ariaCheckedState: { type: Boolean },
label: { type: String },
dismissText: { type: String },
},
methods: {
scaleChange($event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ import ScaleDataGrid from './ScaleDataGrid.vue';
description: `(optional) Freeze header row from scrolling`,
control: { type: null },
},
visible: {
table: {
type: { summary: 'boolean' },
defaultValue: { summary: true },
},
description: `(optional) Set to false to hide table, used for nested tables to re-render upon toggle`,
control: { type: null },
},
heading: {
table: {
type: { summary: 'string' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ import { action } from '@storybook/addon-actions';
description: `(optional) DEPRECATED - css overwrite should replace size`,
control: { type: null },
},
popupTitle: {
description: 'DEPRECATED - in v3 in favor of localization.calendarHeading'
},
status: {
description: 'DEPRECATED - invalid should replace status'
},
}}
/>

Expand All @@ -45,6 +51,9 @@ export const Template = (args, { argTypes }) => ({
:helper-text="helperText"
:invalid="invalid"
:placeholder="placeholder"
:inner-role="innerRole"
:status="status"
:variant="variant"
@scaleChange="scaleChange"
@scale-change="scale-change"
@scaleFocus="scaleFocus"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
:popup-title="popupTitle"
:placeholder="placeholder"
:styles="styles"
:inner-role="innerRole"
:status="status"
:variant="variant"
@scaleChange="scaleChange"
@scaleFocus="scaleFocus"
@scaleBlur="scaleBlur"
Expand Down Expand Up @@ -51,6 +54,9 @@ export default {
placeholder: { type: String },
size: { type: String },
ariaDetailsId: { type: String },
innerRole: { type: String },
status: { type: String },
variant: { type: 'informational' | 'warning' | 'danger' | 'success' | 'informational'},
},
methods: {
scaleChange($event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,23 @@ import { action } from '@storybook/addon-actions';
title="Components/Dropdown Select"
component={ScaleDropdownSelect}
subcomponents={{ 'Dropdown Select Item': ScaleDropdownSelectItem }}
argTypes={{}}
argTypes={{
hideLabelVisually: {
description: "(optional) to hide the label."
},
ariaLabelSelected: {
description: "(optional) Screen reader text appended to the selected element."
},
hcmLabelDisabled: {
description: "(optional) Text displayed in high contrast mode only to indicate disabled state."
},
ariaDetailsId: {
description: "(optional) id or space separated list of ids of elements that provide or link to additional related information."
},
floatingStrategy: {
description: "see https://floating-ui.com/docs/computePosition#strategy "
},
}}
/>

export const Template = (args, { argTypes }) => ({
Expand Down Expand Up @@ -38,6 +54,10 @@ export const Template = (args, { argTypes }) => ({
:combobox-id="comboboxId"
:hide-label-visually="hideLabelVisually"
:floating-strategy="floatingStrategy"
:read-only="readOnly"
:transparent="transparent"
:aria-label-selected="ariaLabelSelected"
:hcm-label-disabled="hcmLabelDisabled"
@scaleChange="['scale-change']"
@scaleFocus="['scale-focus']"
@scaleBlur="['scale-blur']"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
:combobox-id="comboboxId"
:hide-label-visually="hideLabelVisually"
:floating-strategy="floatingStrategy"
:read-only="readOnly"
:transparent="transparent"
:aria-label-selected="ariaLabelSelected"
:hcm-label-disabled="hcmLabelDisabled"
@scaleChange="['scale-change']"
@scaleFocus="['scale-focus']"
@scaleBlur="['scale-blur']"
Expand All @@ -30,12 +34,17 @@ export default {
invalid: { type: Boolean },
disabled: { type: Boolean },
size: { type: String },
value: { type: String },
floatingStrategy: { type: 'absolute' | 'fixed' , default: 'absolute' },
variant: { type: String },
comboboxId: { type: String },
hideLabelVisually: { type: Boolean, default: false },
floatingStrategy: { type: String },
ariaDetailsId: { type: String },
readOnly: { type: Boolean },
transparent: { type: Boolean },
ariaLabelSelected: { type: String },
hcmLabelDisabled: { type: String },
value: { type: String},
},
methods: {
'scale-change'($event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,6 @@ The display error is on the browser side.
<option value="1">item 1</option>
<option value="2" selected>item 2</option>
<option value="3">item 3</option>
<scale-icon-content-calendar
size="20"
slot="icon"
></scale-icon-content-calendar>
<scale-icon-content-calendar size="20" slot="icon"></scale-icon-content-calendar>
</scale-dropdown>
```
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ import ScaleMenuFlyout from './ScaleMenuFlyout.vue';
description:
'Determines whether the dropdown should close when a menu item is selected',
},
triggerHasPopup: {
control: {
type: 'boolean',
},
description:
'Determines whether the flyout trigger should get the aria-haspopup attribute ',
},
}}
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
closeOnSelect: { type: Boolean, default: true },
direction: { type: String, default: 'bottom-right' },
styles: { type: String },
triggerHasPopup: { type: Boolean, default: true}
},
methods: {
emit() {
Expand Down
3 changes: 3 additions & 0 deletions packages/storybook-vue/stories/components/logo/ScaleLogo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
:logo-title="logoTitle"
:logo-hide-title="logoHideTitle"
:logo-aria-described-by="logoAriaDescribedBy"
:logo-aria-hidden="logoAriaHidden"
:accessibility-title="accessibilityTitle"
:focusable="focusable"
:scroll-into-view-on-focus="scrollIntoViewOnFocus"
Expand Down Expand Up @@ -42,8 +43,10 @@ export default {
href: { type: String },
styles: { type: String },
logoAriaDescribedBy: { type: String },
logoAriaHidden: { type: Boolean },
logoTitle: { type: String },
logoHideTitle: { type: Boolean },
accessibilityTitle: { type: String },
},
};
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export const Template = (args, context) => ({
<scale-modal
:heading="heading"
:size="size"
:variant="size"
:opened="isOpen"
:duration="duration"
:close-button-label="closeButtonLabel"
Expand Down
Loading

0 comments on commit 525e1c4

Please sign in to comment.