From 2623b636a9667e28ee585b0d757a414b293e8999 Mon Sep 17 00:00:00 2001 From: Taylor Jones Date: Thu, 23 Jun 2022 17:01:30 -0500 Subject: [PATCH] docs(select): add playground story, controls (#11623) * docs(select): add playground story, controls * fix(select): remove unused playground argtypes * fix(select): ensure string controls work, remove unecessary props from controls Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../react/src/components/Select/Select.js | 14 +-- .../src/components/Select/Select.stories.js | 95 ++++++++++++++++--- 2 files changed, 87 insertions(+), 22 deletions(-) diff --git a/packages/react/src/components/Select/Select.js b/packages/react/src/components/Select/Select.js index 47b81fa9e67a..b2a08ceadc8b 100644 --- a/packages/react/src/components/Select/Select.js +++ b/packages/react/src/components/Select/Select.js @@ -21,20 +21,20 @@ const Select = React.forwardRef(function Select( { className, id, - inline, + inline = false, labelText, - disabled, + disabled = false, children, // reserved for use with component - noLabel, + noLabel = false, // eslint-disable-next-line no-unused-vars - hideLabel, - invalid, + hideLabel = false, + invalid = false, invalidText, helperText, - light, + light = false, size, - warn, + warn = false, warnText, ...other }, diff --git a/packages/react/src/components/Select/Select.stories.js b/packages/react/src/components/Select/Select.stories.js index 553aa2151c53..cdf71a11a6c1 100644 --- a/packages/react/src/components/Select/Select.stories.js +++ b/packages/react/src/components/Select/Select.stories.js @@ -14,15 +14,48 @@ import { Layer } from '../Layer'; export default { title: 'Components/Select', component: Select, - argTypes: { - size: { - options: ['sm', 'md', 'lg'], - control: { type: 'select' }, - }, - }, args: { + disabled: false, + inline: false, + noLabel: false, + hideLabel: false, + invalid: false, + warn: false, size: 'md', }, + argTypes: { + onChange: { + action: 'onChange', + table: { + disable: true, + }, + }, + children: { + table: { + disable: true, + }, + }, + className: { + table: { + disable: true, + }, + }, + defaultValue: { + table: { + disable: true, + }, + }, + id: { + table: { + disable: true, + }, + }, + light: { + table: { + disable: true, + }, + }, + }, decorators: [(story) =>
{story()}
], subcomponents: { SelectItem, @@ -31,11 +64,10 @@ export default { }, }; -export const _Default = (args) => { +export const Default = () => { return (
{ ); }; -export const _Skeleton = () => ( +export const Skeleton = () => (
(
); -export const WithLayer = (args) => { +export const WithLayer = () => { return ( <> +
+ ); +}; + +Playground.argTypes = { + helperText: { + control: 'text', + }, + invalidText: { control: 'text' }, + labelText: { control: 'text' }, + warnText: { control: 'text' }, +};