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B,CAAC;AAEF,kBAAkB,CAAC,QAAQ,GAAG;IAC5B,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IACrC,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IACpC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IACvC,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IACxC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACnC,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;CACvC,CAAC","sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport { useState } from 'react';\n\nimport { Card, ThemeOverride, Switch } from '@pega/cosmos-react-core';\nimport type { SwitchProps } from '@pega/cosmos-react-core';\n\nimport { StyledCard } from './Switch.styles';\n\nexport default {\n  title: 'Core/Switch',\n  component: Switch,\n  excludeStories: ['ConfigurableSwitch'],\n  args: {\n    label: 'Toggle on/off',\n    disabled: false\n  },\n  argTypes: {\n    label: { control: { type: 'text' } },\n    disabled: { control: { type: 'boolean' } }\n  }\n} as Meta;\n\nexport const SwitchDemo: StoryFn<SwitchProps> = (args: SwitchProps) => {\n  const [on, setOn] = useState(false);\n\n  return (\n    <Switch\n      id='switch'\n      on={on}\n      onChange={() => setOn(curr => !curr)}\n      label={args.label}\n      disabled={args.disabled}\n    />\n  );\n};\n\nexport const SwitchInCard: StoryFn<SwitchProps> = (args: SwitchProps) => {\n  const [on, setOn] = useState(false);\n\n  return (\n    <Card as={StyledCard}>\n      <Switch\n        id='switch'\n        on={on}\n        onChange={() => setOn(curr => !curr)}\n        label={args.label}\n        disabled={args.disabled}\n      />\n    </Card>\n  );\n};\n\ninterface ConfigurableSwitchProps extends SwitchProps {\n  height?: string;\n  width?: string;\n  onColor?: string;\n  offColor?: string;\n}\n\nexport const ConfigurableSwitch: StoryFn<ConfigurableSwitchProps> = (\n  args: ConfigurableSwitchProps\n) => {\n  const [on, setOn] = useState(false);\n\n  return (\n    <ThemeOverride\n      theme={{\n        components: {\n          switch: {\n            height: args.height,\n            width: args.width,\n            on: {\n              color: args.onColor\n            },\n            off: {\n              color: args.offColor\n            }\n          }\n        }\n      }}\n    >\n      <Switch on={on} onChange={() => setOn(curr => !curr)} label='Toggle on/off' />\n    </ThemeOverride>\n  );\n};\n\nConfigurableSwitch.args = {\n  height: '1.5rem',\n  width: '3rem',\n  onColor: '#076bc9',\n  offColor: '#939393'\n};\n\nConfigurableSwitch.argTypes = {\n  height: { control: { type: 'text' } },\n  width: { control: { type: 'text' } },\n  onColor: { control: { type: 'color' } },\n  offColor: { control: { type: 'color' } },\n  label: { table: { disable: true } },\n  disabled: { table: { disable: true } }\n};\n"]}