Skip to content

Commit

Permalink
fix(documentation): Some attributes are displayed when they have no v…
Browse files Browse the repository at this point in the history
…alue on select story (#2166)
  • Loading branch information
imagoiq authored Oct 31, 2023
1 parent 26d2cc4 commit af10002
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Args, Meta, StoryContext, StoryObj } from '@storybook/web-componen
import { html, nothing } from 'lit';
import { useArgs } from '@storybook/preview-api';
import { BADGE } from '../../../../.storybook/constants';
import { ifDefined } from 'lit/directives/if-defined.js';

const VALIDATION_STATE_MAP: Record<string, undefined | boolean> = {
'null': undefined,
Expand Down Expand Up @@ -222,12 +223,11 @@ const Template: Story = {
<select
id=${id}
class=${classes}
defaultValue=${args.value ?? nothing}
?multiple=${args.multiple}
size=${args.multipleSize ?? nothing}
?disabled=${args.disabled}
aria-label=${useAriaLabel ? args.label : undefined}
aria-invalid=${VALIDATION_STATE_MAP[args.validation]}
aria-label=${useAriaLabel ? args.label : nothing}
aria-invalid=${ifDefined(VALIDATION_STATE_MAP[args.validation])}
@change=${(e: Event) => {
updateArgs({ value: (e.target as HTMLSelectElement).value });
}}
Expand Down

0 comments on commit af10002

Please sign in to comment.