@moda/om 16.1.0 → 16.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/index.cjs.js +316 -284
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +315 -283
- package/dist/index.esm.js.map +1 -1
- package/dist/{__mocks__ → src/__mocks__}/Icon.d.ts +0 -0
- package/dist/{components → src/components}/AspectRatioBox/AspectRatioBox.d.ts +0 -0
- package/dist/{components → src/components}/AspectRatioBox/AspectRatioBox.stories.d.ts +0 -0
- package/dist/{components → src/components}/AspectRatioBox/AspectRatioBox.test.d.ts +0 -0
- package/dist/{components → src/components}/AspectRatioBox/index.d.ts +0 -0
- package/dist/{components → src/components}/Badge/Badge.d.ts +0 -0
- package/dist/{components → src/components}/Badge/Badge.stories.d.ts +0 -0
- package/dist/{components → src/components}/Badge/Badge.test.d.ts +0 -0
- package/dist/{components → src/components}/Badge/index.d.ts +0 -0
- package/dist/{components → src/components}/Breadcrumbs/Breadcrumb/Breadcrumb.d.ts +0 -0
- package/dist/{components → src/components}/Breadcrumbs/Breadcrumb/index.d.ts +0 -0
- package/dist/{components → src/components}/Breadcrumbs/Breadcrumbs.d.ts +0 -0
- package/dist/{components → src/components}/Breadcrumbs/Breadcrumbs.stories.d.ts +0 -0
- package/dist/{components → src/components}/Breadcrumbs/Breadcrumbs.test.d.ts +0 -0
- package/dist/{components → src/components}/Breadcrumbs/index.d.ts +0 -0
- package/dist/{components → src/components}/Breakpoint/Breakpoint.d.ts +0 -0
- package/dist/{components → src/components}/Breakpoint/Breakpoint.stories.d.ts +0 -0
- package/dist/{components → src/components}/Breakpoint/Breakpoint.test.d.ts +0 -0
- package/dist/{components → src/components}/Breakpoint/BreakpointProvider.d.ts +0 -0
- package/dist/{components → src/components}/Breakpoint/generateMediaQuery.d.ts +0 -0
- package/dist/{components → src/components}/Breakpoint/generateMediaQuery.test.d.ts +0 -0
- package/dist/{components → src/components}/Breakpoint/index.d.ts +0 -0
- package/dist/{components → src/components}/Button/Button.d.ts +0 -0
- package/dist/{components → src/components}/Button/Button.stories.d.ts +0 -0
- package/dist/{components → src/components}/Button/Button.test.d.ts +0 -0
- package/dist/{components → src/components}/Button/index.d.ts +0 -0
- package/dist/{components → src/components}/Checkbox/Checkbox.d.ts +1 -1
- package/dist/{components → src/components}/Checkbox/Checkbox.stories.d.ts +0 -0
- package/dist/{components → src/components}/Checkbox/Checkbox.test.d.ts +0 -0
- package/dist/{components → src/components}/Checkbox/index.d.ts +0 -0
- package/dist/{components → src/components}/Clickable/Clickable.d.ts +0 -0
- package/dist/{components → src/components}/Clickable/Clickable.stories.d.ts +0 -0
- package/dist/{components → src/components}/Clickable/Clickable.test.d.ts +0 -0
- package/dist/{components → src/components}/Clickable/index.d.ts +0 -0
- package/dist/{components → src/components}/ColorSwatch/ColorSwatch.d.ts +0 -0
- package/dist/{components → src/components}/ColorSwatch/ColorSwatch.stories.d.ts +0 -0
- package/dist/{components → src/components}/ColorSwatch/ColorSwatch.test.d.ts +0 -0
- package/dist/{components → src/components}/ColorSwatch/index.d.ts +0 -0
- package/dist/{components → src/components}/ColorSwatch/skuColors.d.ts +0 -0
- package/dist/{components → src/components}/Constrain/Constrain.d.ts +0 -0
- package/dist/{components → src/components}/Constrain/Constrain.stories.d.ts +0 -0
- package/dist/{components → src/components}/Constrain/Constrain.test.d.ts +0 -0
- package/dist/{components → src/components}/Constrain/ExceedConstrain.d.ts +0 -0
- package/dist/{components → src/components}/Constrain/ExceedConstrain.stories.d.ts +0 -0
- package/dist/{components → src/components}/Constrain/index.d.ts +0 -0
- package/dist/{components → src/components}/ControlLink/ControlLink.d.ts +0 -0
- package/dist/{components → src/components}/ControlLink/ControlLink.stories.d.ts +0 -0
- package/dist/{components → src/components}/ControlLink/ControlLink.test.d.ts +0 -0
- package/dist/{components → src/components}/ControlLink/index.d.ts +0 -0
- package/dist/{components → src/components}/CreditCardNumberInput/CreditCardNumberInput.d.ts +0 -0
- package/dist/{components → src/components}/CreditCardNumberInput/CreditCardNumberInput.stories.d.ts +0 -0
- package/dist/{components → src/components}/CreditCardNumberInput/CreditCardNumberInput.test.d.ts +0 -0
- package/dist/{components → src/components}/CreditCardNumberInput/CreditCardNumberInputField.d.ts +0 -0
- package/dist/{components → src/components}/CreditCardNumberInput/index.d.ts +0 -0
- package/dist/{components → src/components}/DefinitionList/DefinitionList.d.ts +0 -0
- package/dist/{components → src/components}/DefinitionList/DefinitionList.stories.d.ts +0 -0
- package/dist/{components → src/components}/DefinitionList/DefinitionList.test.d.ts +0 -0
- package/dist/{components → src/components}/DefinitionList/index.d.ts +0 -0
- package/dist/{components → src/components}/Divider/Divider.d.ts +0 -0
- package/dist/{components → src/components}/Divider/Divider.stories.d.ts +0 -0
- package/dist/{components → src/components}/Divider/Divider.test.d.ts +0 -0
- package/dist/{components → src/components}/Divider/NoLineDivider.d.ts +0 -0
- package/dist/{components → src/components}/Divider/TwoLineDivider.d.ts +0 -0
- package/dist/{components → src/components}/Divider/index.d.ts +0 -0
- package/dist/{components → src/components}/Expandable/Expandable.d.ts +0 -0
- package/dist/{components → src/components}/Expandable/Expandable.stories.d.ts +0 -0
- package/dist/{components → src/components}/Expandable/Expandable.test.d.ts +0 -0
- package/dist/{components → src/components}/Expandable/index.d.ts +0 -0
- package/dist/{components → src/components}/Field/Field.d.ts +0 -0
- package/dist/{components → src/components}/Field/Field.stories.d.ts +0 -0
- package/dist/{components → src/components}/Field/Field.test.d.ts +0 -0
- package/dist/{components → src/components}/Field/index.d.ts +0 -0
- package/dist/{components → src/components}/Label/Label.d.ts +0 -0
- package/dist/{components → src/components}/Label/Label.stories.d.ts +0 -0
- package/dist/{components → src/components}/Label/Label.test.d.ts +0 -0
- package/dist/{components → src/components}/Label/index.d.ts +0 -0
- package/dist/{components → src/components}/Loading/Loading.d.ts +0 -0
- package/dist/{components → src/components}/Loading/Loading.stories.d.ts +0 -0
- package/dist/{components → src/components}/Loading/Loading.test.d.ts +0 -0
- package/dist/{components → src/components}/Loading/index.d.ts +0 -0
- package/dist/{components → src/components}/LoadingBalls/LoadingBalls.d.ts +0 -0
- package/dist/{components → src/components}/LoadingBalls/LoadingBalls.stories.d.ts +0 -0
- package/dist/{components → src/components}/LoadingBalls/index.d.ts +0 -0
- package/dist/{components → src/components}/Modal/Modal.d.ts +0 -0
- package/dist/{components → src/components}/Modal/Modal.stories.d.ts +0 -0
- package/dist/{components → src/components}/Modal/Modal.test.d.ts +0 -0
- package/dist/{components → src/components}/Modal/index.d.ts +0 -0
- package/dist/{components → src/components}/ModalOverlay/ModalOverlay.d.ts +0 -0
- package/dist/{components → src/components}/ModalOverlay/ModalOverlay.stories.d.ts +0 -0
- package/dist/{components → src/components}/ModalOverlay/ModalOverlay.test.d.ts +0 -0
- package/dist/{components → src/components}/ModalOverlay/index.d.ts +0 -0
- package/dist/{components → src/components}/Overlay/Overlay.d.ts +0 -0
- package/dist/{components → src/components}/Overlay/Overlay.stories.d.ts +0 -0
- package/dist/{components → src/components}/Overlay/Overlay.test.d.ts +0 -0
- package/dist/{components → src/components}/Overlay/index.d.ts +0 -0
- package/dist/{components → src/components}/Paginator/Paginator.d.ts +0 -0
- package/dist/{components → src/components}/Paginator/Paginator.stories.d.ts +0 -0
- package/dist/{components → src/components}/Paginator/index.d.ts +0 -0
- package/dist/{components → src/components}/PasswordInput/PasswordInput.d.ts +0 -0
- package/dist/{components → src/components}/PasswordInput/PasswordInput.stories.d.ts +0 -0
- package/dist/{components → src/components}/PasswordInput/index.d.ts +0 -0
- package/dist/{components → src/components}/Popover/Popover.d.ts +0 -0
- package/dist/{components → src/components}/Popover/Popover.stories.d.ts +0 -0
- package/dist/{components → src/components}/Popover/Popover.test.d.ts +0 -0
- package/dist/{components → src/components}/Popover/index.d.ts +0 -0
- package/dist/{components → src/components}/PromoBanner/PromoBanner.d.ts +0 -0
- package/dist/{components → src/components}/PromoBanner/PromoBanner.stories.d.ts +0 -0
- package/dist/{components → src/components}/PromoBanner/PromoBanner.test.d.ts +0 -0
- package/dist/{components → src/components}/PromoBanner/index.d.ts +0 -0
- package/dist/{components → src/components}/RadioButton/RadioButton.d.ts +0 -0
- package/dist/{components → src/components}/RadioButton/RadioButton.stories.d.ts +0 -0
- package/dist/{components → src/components}/RadioButton/RadioButton.test.d.ts +0 -0
- package/dist/{components → src/components}/RadioButton/index.d.ts +0 -0
- package/dist/{components → src/components}/SearchInput/SearchInput.d.ts +0 -0
- package/dist/{components → src/components}/SearchInput/SearchInput.stories.d.ts +0 -0
- package/dist/{components → src/components}/SearchInput/SearchInput.test.d.ts +0 -0
- package/dist/{components → src/components}/SearchInput/index.d.ts +0 -0
- package/dist/{components → src/components}/Select/MultiSelect.d.ts +0 -0
- package/dist/{components → src/components}/Select/Select.d.ts +0 -0
- package/dist/{components → src/components}/Select/Select.stories.d.ts +0 -0
- package/dist/{components → src/components}/Select/Select.test.d.ts +0 -0
- package/dist/{components → src/components}/Select/SelectLabel.d.ts +0 -0
- package/dist/{components → src/components}/Select/SelectOption.d.ts +0 -0
- package/dist/{components → src/components}/Select/SelectOptions.d.ts +0 -0
- package/dist/{components → src/components}/Select/index.d.ts +0 -0
- package/dist/{components → src/components}/Select/useSelect.d.ts +0 -0
- package/dist/{components → src/components}/SelectableButton/SelectableButton.d.ts +0 -0
- package/dist/{components → src/components}/SelectableButton/SelectableButton.stories.d.ts +0 -0
- package/dist/{components → src/components}/SelectableButton/SelectableButton.test.d.ts +0 -0
- package/dist/{components → src/components}/SelectableButton/index.d.ts +0 -0
- package/dist/{components → src/components}/Shape/ArcWindow.d.ts +0 -0
- package/dist/{components → src/components}/Shape/Bradley.d.ts +0 -0
- package/dist/{components → src/components}/Shape/Brancusi.d.ts +0 -0
- package/dist/{components → src/components}/Shape/Circle.d.ts +0 -0
- package/dist/{components → src/components}/Shape/Diamond.d.ts +0 -0
- package/dist/{components → src/components}/Shape/Keyhole.d.ts +0 -0
- package/dist/{components → src/components}/Shape/Mirror.d.ts +0 -0
- package/dist/{components → src/components}/Shape/Oval.d.ts +0 -0
- package/dist/{components → src/components}/Shape/Shape.d.ts +0 -0
- package/dist/{components → src/components}/Shape/Shape.stories.d.ts +0 -0
- package/dist/{components → src/components}/Shape/Triangle.d.ts +0 -0
- package/dist/{components → src/components}/Shape/Window.d.ts +0 -0
- package/dist/{components → src/components}/Shape/index.d.ts +0 -0
- package/dist/{components → src/components}/Stack/Stack.d.ts +0 -0
- package/dist/{components → src/components}/Stack/Stack.stories.d.ts +0 -0
- package/dist/{components → src/components}/Stack/Stack.test.d.ts +0 -0
- package/dist/{components → src/components}/Stack/index.d.ts +0 -0
- package/dist/{components → src/components}/Tabs/Tab.d.ts +0 -0
- package/dist/{components → src/components}/Tabs/TabList.d.ts +0 -0
- package/dist/{components → src/components}/Tabs/TabPanel.d.ts +0 -0
- package/dist/{components → src/components}/Tabs/TabPanels.d.ts +0 -0
- package/dist/{components → src/components}/Tabs/Tabs.d.ts +0 -0
- package/dist/{components → src/components}/Tabs/Tabs.stories.d.ts +0 -0
- package/dist/{components → src/components}/Tabs/Tabs.test.d.ts +0 -0
- package/dist/{components → src/components}/Tabs/index.d.ts +0 -0
- package/dist/{components → src/components}/Tag/Tag.d.ts +0 -0
- package/dist/{components → src/components}/Tag/Tag.stories.d.ts +0 -0
- package/dist/{components → src/components}/Tag/Tag.test.d.ts +0 -0
- package/dist/{components → src/components}/Tag/index.d.ts +0 -0
- package/dist/{components → src/components}/Text/Text.d.ts +0 -0
- package/dist/{components → src/components}/Text/Text.stories.d.ts +0 -0
- package/dist/{components → src/components}/Text/Text.test.d.ts +0 -0
- package/dist/{components → src/components}/Text/index.d.ts +0 -0
- package/dist/{components → src/components}/TextInput/TextInput.d.ts +0 -0
- package/dist/{components → src/components}/TextInput/TextInput.stories.d.ts +0 -0
- package/dist/{components → src/components}/TextInput/TextInput.test.d.ts +0 -0
- package/dist/{components → src/components}/TextInput/index.d.ts +0 -0
- package/dist/{components → src/components}/Textarea/Textarea.d.ts +0 -0
- package/dist/{components → src/components}/Textarea/Textarea.stories.d.ts +0 -0
- package/dist/{components → src/components}/Textarea/Textarea.test.d.ts +0 -0
- package/dist/{components → src/components}/Textarea/index.d.ts +0 -0
- package/dist/{components → src/components}/Toast/Toast.d.ts +0 -0
- package/dist/{components → src/components}/Toast/Toast.stories.d.ts +0 -0
- package/dist/{components → src/components}/Toast/Toast.test.d.ts +0 -0
- package/dist/{components → src/components}/Toast/index.d.ts +0 -0
- package/dist/{components → src/components}/VerticalDivider/VerticalDivider.d.ts +0 -0
- package/dist/{components → src/components}/VerticalDivider/VerticalDivider.stories.d.ts +0 -0
- package/dist/{components → src/components}/VerticalDivider/VerticalDivider.test.d.ts +0 -0
- package/dist/{components → src/components}/VerticalDivider/index.d.ts +0 -0
- package/dist/{components → src/components}/index.d.ts +0 -0
- package/dist/{hooks → src/hooks}/index.d.ts +0 -0
- package/dist/{hooks → src/hooks}/useBreakpoint.d.ts +0 -0
- package/dist/{hooks → src/hooks}/useClickOutside.d.ts +0 -0
- package/dist/{hooks → src/hooks}/useKeyboardListNavigation.d.ts +0 -0
- package/dist/{hooks → src/hooks}/useKeyboardListNavigation.spec.d.ts +0 -0
- package/dist/{hooks → src/hooks}/useUpdateEffect.d.ts +0 -0
- package/dist/{index.d.ts → src/index.d.ts} +0 -0
- package/dist/{mixins → src/mixins}/font-smoothing/font-smoothing.stories.d.ts +0 -0
- package/dist/{mixins → src/mixins}/overflow-scroll/overflow-scroll.stories.d.ts +0 -0
- package/dist/{mixins → src/mixins}/stack/stack.stories.d.ts +0 -0
- package/dist/{mixins → src/mixins}/thin-underline/thin-underline.stories.d.ts +0 -0
- package/dist/{mixins → src/mixins}/visually-hidden/visually-hidden.stories.d.ts +0 -0
- package/dist/{utilities → src/utilities}/States/State.d.ts +0 -0
- package/dist/{utilities → src/utilities}/States/States.d.ts +0 -0
- package/dist/{utilities → src/utilities}/States/StatesProps.d.ts +0 -0
- package/dist/{utilities → src/utilities}/States/index.d.ts +0 -0
- package/dist/{utilities → src/utilities}/States/isRenderProps.d.ts +0 -0
- package/dist/{utilities → src/utilities}/States/stringifyProps.d.ts +0 -0
- package/dist/{utilities → src/utilities}/index.d.ts +0 -0
- package/dist/{utilities → src/utilities}/omit.d.ts +0 -0
- package/dist/{utilities → src/utilities}/sample.d.ts +0 -0
- package/dist/styles.css +1 -1
- package/dist/test/mocks/matchMedia.d.ts +1 -0
- package/dist/test/setupTests.d.ts +3 -0
- package/package.json +30 -19
- package/src/components/AspectRatioBox/AspectRatioBox.test.tsx +3 -3
- package/src/components/AspectRatioBox/AspectRatioBox.tsx +4 -4
- package/src/components/AspectRatioBox/index.ts +1 -1
- package/src/components/Badge/Badge.stories.tsx +5 -5
- package/src/components/Badge/Badge.test.tsx +5 -12
- package/src/components/Breadcrumbs/Breadcrumb/Breadcrumb.tsx +6 -6
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +6 -6
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +7 -7
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +1 -1
- package/src/components/Breakpoint/Breakpoint.stories.tsx +10 -9
- package/src/components/Breakpoint/Breakpoint.test.tsx +7 -8
- package/src/components/Breakpoint/generateMediaQuery.ts +5 -4
- package/src/components/Button/Button.stories.tsx +4 -4
- package/src/components/Button/Button.test.tsx +14 -3
- package/src/components/Checkbox/Checkbox.stories.tsx +7 -7
- package/src/components/Checkbox/Checkbox.test.tsx +12 -14
- package/src/components/Checkbox/Checkbox.tsx +8 -8
- package/src/components/Clickable/Clickable.stories.tsx +3 -3
- package/src/components/Clickable/Clickable.test.tsx +3 -3
- package/src/components/ColorSwatch/ColorSwatch.stories.tsx +11 -11
- package/src/components/ColorSwatch/ColorSwatch.test.tsx +3 -5
- package/src/components/ColorSwatch/ColorSwatch.tsx +1 -1
- package/src/components/Constrain/Constrain.stories.tsx +1 -1
- package/src/components/Constrain/Constrain.test.tsx +4 -4
- package/src/components/Constrain/ExceedConstrain.stories.tsx +2 -2
- package/src/components/ControlLink/ControlLink.stories.tsx +1 -1
- package/src/components/ControlLink/ControlLink.test.tsx +10 -12
- package/src/components/ControlLink/index.ts +1 -1
- package/src/components/CreditCardNumberInput/CreditCardNumberInput.stories.tsx +1 -1
- package/src/components/CreditCardNumberInput/CreditCardNumberInput.test.tsx +16 -16
- package/src/components/CreditCardNumberInput/CreditCardNumberInput.tsx +1 -0
- package/src/components/DefinitionList/DefinitionList.stories.tsx +3 -3
- package/src/components/DefinitionList/DefinitionList.test.tsx +4 -3
- package/src/components/Divider/Divider.stories.tsx +4 -4
- package/src/components/Divider/Divider.test.tsx +5 -4
- package/src/components/Divider/Divider.tsx +1 -1
- package/src/components/Divider/NoLineDivider.tsx +1 -1
- package/src/components/Divider/TwoLineDivider.tsx +1 -1
- package/src/components/Expandable/Expandable.stories.tsx +8 -8
- package/src/components/Expandable/Expandable.test.tsx +17 -6
- package/src/components/Expandable/Expandable.tsx +3 -2
- package/src/components/Field/Field.stories.tsx +4 -4
- package/src/components/Field/Field.test.tsx +25 -34
- package/src/components/Field/Field.tsx +5 -5
- package/src/components/Field/index.ts +1 -0
- package/src/components/Label/Label.test.tsx +3 -3
- package/src/components/Loading/Loading.test.tsx +3 -5
- package/src/components/Loading/Loading.tsx +2 -1
- package/src/components/Modal/Modal.test.tsx +8 -9
- package/src/components/ModalOverlay/ModalOverlay.test.tsx +11 -11
- package/src/components/ModalOverlay/ModalOverlay.tsx +2 -2
- package/src/components/Overlay/Overlay.stories.tsx +1 -1
- package/src/components/Overlay/Overlay.test.tsx +3 -3
- package/src/components/Paginator/Paginator.tsx +3 -3
- package/src/components/PasswordInput/PasswordInput.stories.tsx +1 -1
- package/src/components/PasswordInput/PasswordInput.tsx +6 -6
- package/src/components/Popover/Popover.stories.tsx +1 -1
- package/src/components/Popover/Popover.test.tsx +9 -6
- package/src/components/Popover/Popover.tsx +10 -7
- package/src/components/PromoBanner/PromoBanner.stories.tsx +9 -9
- package/src/components/PromoBanner/PromoBanner.test.tsx +3 -3
- package/src/components/PromoBanner/PromoBanner.tsx +1 -1
- package/src/components/RadioButton/RadioButton.stories.tsx +2 -2
- package/src/components/RadioButton/RadioButton.test.tsx +6 -10
- package/src/components/RadioButton/RadioButton.tsx +4 -4
- package/src/components/SearchInput/SearchInput.stories.tsx +2 -2
- package/src/components/SearchInput/SearchInput.test.tsx +10 -6
- package/src/components/SearchInput/SearchInput.tsx +3 -3
- package/src/components/Select/MultiSelect.tsx +7 -7
- package/src/components/Select/Select.stories.tsx +17 -15
- package/src/components/Select/Select.test.tsx +21 -21
- package/src/components/Select/Select.tsx +13 -8
- package/src/components/Select/SelectOption.tsx +1 -1
- package/src/components/Select/SelectOptions.tsx +5 -5
- package/src/components/SelectableButton/SelectableButton.stories.tsx +1 -1
- package/src/components/SelectableButton/SelectableButton.test.tsx +3 -3
- package/src/components/Shape/ArcWindow.tsx +10 -10
- package/src/components/Shape/Bradley.tsx +4 -4
- package/src/components/Shape/Brancusi.tsx +4 -4
- package/src/components/Shape/Circle.tsx +10 -10
- package/src/components/Shape/Diamond.tsx +10 -10
- package/src/components/Shape/Keyhole.tsx +4 -4
- package/src/components/Shape/Mirror.tsx +4 -4
- package/src/components/Shape/Oval.tsx +4 -4
- package/src/components/Shape/Triangle.tsx +7 -7
- package/src/components/Shape/Window.tsx +4 -4
- package/src/components/Stack/Stack.stories.tsx +3 -3
- package/src/components/Stack/Stack.test.tsx +7 -5
- package/src/components/Tabs/TabList.tsx +1 -1
- package/src/components/Tabs/TabPanel.tsx +1 -1
- package/src/components/Tabs/TabPanels.tsx +1 -1
- package/src/components/Tabs/Tabs.stories.tsx +2 -2
- package/src/components/Tabs/Tabs.test.tsx +6 -7
- package/src/components/Tabs/Tabs.tsx +7 -1
- package/src/components/Tag/Tag.test.tsx +1 -1
- package/src/components/Tag/Tag.tsx +6 -5
- package/src/components/Text/Text.stories.tsx +5 -5
- package/src/components/Text/Text.test.tsx +4 -6
- package/src/components/TextInput/TextInput.stories.tsx +1 -1
- package/src/components/TextInput/TextInput.test.tsx +4 -5
- package/src/components/Textarea/Textarea.stories.tsx +1 -1
- package/src/components/Textarea/Textarea.test.tsx +11 -16
- package/src/components/Toast/Toast.stories.tsx +1 -1
- package/src/components/Toast/Toast.test.tsx +2 -2
- package/src/components/Toast/Toast.tsx +6 -6
- package/src/components/VerticalDivider/VerticalDivider.stories.tsx +3 -3
- package/src/components/VerticalDivider/VerticalDivider.test.tsx +6 -7
- package/src/hooks/useKeyboardListNavigation.spec.ts +26 -64
- package/src/hooks/useKeyboardListNavigation.ts +2 -0
- package/src/hooks/useUpdateEffect.ts +1 -0
- package/src/index.ts +2 -2
- package/src/mixins/font-smoothing/font-smoothing.stories.tsx +8 -8
- package/src/mixins/overflow-scroll/overflow-scroll.stories.tsx +2 -2
- package/src/mixins/stack/stack.stories.tsx +5 -6
- package/src/mixins/thin-underline/thin-underline.stories.tsx +1 -1
- package/src/mixins/visually-hidden/visually-hidden.stories.tsx +1 -1
- package/src/utilities/States/State.tsx +3 -2
- package/src/utilities/States/States.tsx +4 -3
- package/src/utilities/States/StatesProps.tsx +5 -2
- package/src/utilities/States/isRenderProps.ts +1 -0
- package/src/utilities/States/stringifyProps.tsx +1 -0
|
@@ -3,18 +3,18 @@ import { ShapeProps } from './Shape';
|
|
|
3
3
|
|
|
4
4
|
export const ArcWindow: React.FC<ShapeProps> = () => (
|
|
5
5
|
<svg
|
|
6
|
-
className=
|
|
7
|
-
width=
|
|
8
|
-
height=
|
|
9
|
-
viewBox=
|
|
10
|
-
fill=
|
|
11
|
-
xmlns=
|
|
6
|
+
className="ArcWindow"
|
|
7
|
+
width="24"
|
|
8
|
+
height="24"
|
|
9
|
+
viewBox="0 0 24 24"
|
|
10
|
+
fill="none"
|
|
11
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
12
12
|
>
|
|
13
13
|
<path
|
|
14
|
-
fillRule=
|
|
15
|
-
clipRule=
|
|
16
|
-
d=
|
|
17
|
-
fill=
|
|
14
|
+
fillRule="evenodd"
|
|
15
|
+
clipRule="evenodd"
|
|
16
|
+
d="M20.1097 24V11.6273V8.8331V8.81993C20.1018 3.96884 16.4806 0 12.0536 0C7.6291 0 4.00527 3.96884 4 8.81993V8.8331V11.6273V24H20.1097Z"
|
|
17
|
+
fill="#003728"
|
|
18
18
|
/>
|
|
19
19
|
</svg>
|
|
20
20
|
);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ShapeProps } from './Shape';
|
|
3
3
|
|
|
4
|
-
export const Bradley: React.FC<ShapeProps> =
|
|
4
|
+
export const Bradley: React.FC<ShapeProps> = props => (
|
|
5
5
|
<svg
|
|
6
6
|
style={{ fill: 'currentcolor' }}
|
|
7
|
-
xmlns=
|
|
8
|
-
viewBox=
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
viewBox="0 0 110 211"
|
|
9
9
|
{...props}
|
|
10
10
|
>
|
|
11
|
-
<path d=
|
|
11
|
+
<path d="M110 .336H0v210h45.11v-52.595h19.78v52.595H110V105.147z" />
|
|
12
12
|
</svg>
|
|
13
13
|
);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ShapeProps } from './Shape';
|
|
3
3
|
|
|
4
|
-
export const Brancusi: React.FC<ShapeProps> =
|
|
4
|
+
export const Brancusi: React.FC<ShapeProps> = props => (
|
|
5
5
|
<svg
|
|
6
6
|
style={{ fill: 'currentcolor' }}
|
|
7
|
-
xmlns=
|
|
8
|
-
viewBox=
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
viewBox="0 0 111 210"
|
|
9
9
|
{...props}
|
|
10
10
|
>
|
|
11
|
-
<path d=
|
|
11
|
+
<path d="M110.575 210l-27.5-105 27.5-105h-110l27.501 105L.575 210z" />
|
|
12
12
|
</svg>
|
|
13
13
|
);
|
|
@@ -3,18 +3,18 @@ import { ShapeProps } from './Shape';
|
|
|
3
3
|
|
|
4
4
|
export const Circle: React.FC<ShapeProps> = () => (
|
|
5
5
|
<svg
|
|
6
|
-
className=
|
|
7
|
-
width=
|
|
8
|
-
height=
|
|
9
|
-
viewBox=
|
|
10
|
-
fill=
|
|
11
|
-
xmlns=
|
|
6
|
+
className="Circle"
|
|
7
|
+
width="24"
|
|
8
|
+
height="24"
|
|
9
|
+
viewBox="0 0 24 24"
|
|
10
|
+
fill="none"
|
|
11
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
12
12
|
>
|
|
13
13
|
<path
|
|
14
|
-
fillRule=
|
|
15
|
-
clipRule=
|
|
16
|
-
d=
|
|
17
|
-
fill=
|
|
14
|
+
fillRule="evenodd"
|
|
15
|
+
clipRule="evenodd"
|
|
16
|
+
d="M24 12C24 18.6282 18.6282 24 12 24C5.37184 24 0 18.6282 0 12C0 5.37184 5.37184 0 12 0C18.6282 0 24 5.37184 24 12Z"
|
|
17
|
+
fill="#D7B3D0"
|
|
18
18
|
/>
|
|
19
19
|
</svg>
|
|
20
20
|
);
|
|
@@ -3,18 +3,18 @@ import { ShapeProps } from './Shape';
|
|
|
3
3
|
|
|
4
4
|
export const Diamond: React.FC<ShapeProps> = () => (
|
|
5
5
|
<svg
|
|
6
|
-
className=
|
|
7
|
-
width=
|
|
8
|
-
height=
|
|
9
|
-
viewBox=
|
|
10
|
-
fill=
|
|
11
|
-
xmlns=
|
|
6
|
+
className="Diamond"
|
|
7
|
+
width="24"
|
|
8
|
+
height="24"
|
|
9
|
+
viewBox="0 0 24 24"
|
|
10
|
+
fill="none"
|
|
11
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
12
12
|
>
|
|
13
13
|
<path
|
|
14
|
-
fillRule=
|
|
15
|
-
clipRule=
|
|
16
|
-
d=
|
|
17
|
-
fill=
|
|
14
|
+
fillRule="evenodd"
|
|
15
|
+
clipRule="evenodd"
|
|
16
|
+
d="M12 24.0026L0 12.0026L12 0L24 12.0026L12 24.0026Z"
|
|
17
|
+
fill="#C44CB0"
|
|
18
18
|
/>
|
|
19
19
|
</svg>
|
|
20
20
|
);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ShapeProps } from './Shape';
|
|
3
3
|
|
|
4
|
-
export const Keyhole: React.FC<ShapeProps> =
|
|
4
|
+
export const Keyhole: React.FC<ShapeProps> = props => (
|
|
5
5
|
<svg
|
|
6
6
|
style={{ fill: 'currentcolor' }}
|
|
7
|
-
xmlns=
|
|
8
|
-
viewBox=
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
viewBox="0 0 111 210"
|
|
9
9
|
{...props}
|
|
10
10
|
>
|
|
11
|
-
<path d=
|
|
11
|
+
<path d="M.8 210h110V86.403h-9.317c5.88-8.833 9.317-19.46 9.317-30.902C110.8 24.85 86.175 0 55.8 0S.8 24.85.8 55.501c0 11.441 3.436 22.069 9.315 30.902H.8V210z" />
|
|
12
12
|
</svg>
|
|
13
13
|
);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ShapeProps } from './Shape';
|
|
3
3
|
|
|
4
|
-
export const Mirror: React.FC<ShapeProps> =
|
|
4
|
+
export const Mirror: React.FC<ShapeProps> = props => (
|
|
5
5
|
<svg
|
|
6
6
|
style={{ fill: 'currentcolor' }}
|
|
7
|
-
xmlns=
|
|
8
|
-
viewBox=
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
viewBox="0 0 111 210"
|
|
9
9
|
{...props}
|
|
10
10
|
>
|
|
11
|
-
<path d=
|
|
11
|
+
<path d="M110.03 105c0-22.7-3.786-43.7-10.2-60.874V15.97H84.176C75.724 5.862 65.739 0 55.03 0 44.323 0 34.336 5.862 25.885 15.969H10.23v28.157C3.817 61.3.03 82.3.03 105c0 22.7 3.787 43.7 10.2 60.874v28.157h15.655C34.336 204.138 44.323 210 55.03 210c10.708 0 20.693-5.862 29.146-15.969h15.652v-28.157C106.244 148.7 110.03 127.7 110.03 105z" />
|
|
12
12
|
</svg>
|
|
13
13
|
);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ShapeProps } from './Shape';
|
|
3
3
|
|
|
4
|
-
export const Oval: React.FC<ShapeProps> =
|
|
4
|
+
export const Oval: React.FC<ShapeProps> = props => (
|
|
5
5
|
<svg
|
|
6
6
|
style={{ fill: 'currentcolor' }}
|
|
7
|
-
xmlns=
|
|
8
|
-
viewBox=
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
viewBox="0 0 110 210"
|
|
9
9
|
{...props}
|
|
10
10
|
>
|
|
11
|
-
<path d=
|
|
11
|
+
<path d="M110 105C110 47.01 85.376 0 55 0S0 47.01 0 105s24.624 105 55 105 55-47.01 55-105z" />
|
|
12
12
|
</svg>
|
|
13
13
|
);
|
|
@@ -3,13 +3,13 @@ import { ShapeProps } from './Shape';
|
|
|
3
3
|
|
|
4
4
|
export const Triangle: React.FC<ShapeProps> = () => (
|
|
5
5
|
<svg
|
|
6
|
-
className=
|
|
7
|
-
width=
|
|
8
|
-
height=
|
|
9
|
-
viewBox=
|
|
10
|
-
fill=
|
|
11
|
-
xmlns=
|
|
6
|
+
className="Triangle"
|
|
7
|
+
width="24"
|
|
8
|
+
height="24"
|
|
9
|
+
viewBox="0 0 24 24"
|
|
10
|
+
fill="none"
|
|
11
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
12
12
|
>
|
|
13
|
-
<path fillRule=
|
|
13
|
+
<path fillRule="evenodd" clipRule="evenodd" d="M11.9986 0L0 24H24L11.9986 0Z" fill="#D56B27" />
|
|
14
14
|
</svg>
|
|
15
15
|
);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ShapeProps } from './Shape';
|
|
3
3
|
|
|
4
|
-
export const Window: React.FC<ShapeProps> =
|
|
4
|
+
export const Window: React.FC<ShapeProps> = props => (
|
|
5
5
|
<svg
|
|
6
6
|
style={{ fill: 'currentcolor' }}
|
|
7
|
-
xmlns=
|
|
8
|
-
viewBox=
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
viewBox="0 0 110 210"
|
|
9
9
|
{...props}
|
|
10
10
|
>
|
|
11
|
-
<path d=
|
|
11
|
+
<path d="M110 187.673V21.948H98.87C88.873 8.64 73.08 0 55.247 0 37.412 0 21.619 8.64 11.622 21.948H0v165.725h11.34C21.32 201.198 37.245 210 55.248 210c18 0 33.924-8.802 43.904-22.327H110z" />
|
|
12
12
|
</svg>
|
|
13
13
|
);
|
|
@@ -6,7 +6,7 @@ import { Stack, StackProps } from './Stack';
|
|
|
6
6
|
export default { title: 'Components/Stack' };
|
|
7
7
|
|
|
8
8
|
export const Vertical = () => (
|
|
9
|
-
<States<StackProps> states={space.scale.map((_,
|
|
9
|
+
<States<StackProps> states={space.scale.map((_, index) => ({ space: index }))}>
|
|
10
10
|
<Stack space={0}>
|
|
11
11
|
<div style={{ backgroundColor: 'yellow' }}>One</div>
|
|
12
12
|
<div style={{ backgroundColor: 'yellow' }}>Two</div>
|
|
@@ -17,8 +17,8 @@ export const Vertical = () => (
|
|
|
17
17
|
|
|
18
18
|
export const Horizontal = () => (
|
|
19
19
|
<States<StackProps>
|
|
20
|
-
states={space.scale.map((_,
|
|
21
|
-
space:
|
|
20
|
+
states={space.scale.map((_, index) => ({
|
|
21
|
+
space: index,
|
|
22
22
|
direction: 'horizontal'
|
|
23
23
|
}))}
|
|
24
24
|
>
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
|
|
4
4
|
import { Stack } from './Stack';
|
|
5
5
|
|
|
6
6
|
describe('Stack', () => {
|
|
7
7
|
it('renders correctly', () => {
|
|
8
|
-
|
|
9
|
-
<Stack space={6} direction=
|
|
8
|
+
render(
|
|
9
|
+
<Stack space={6} direction="horizontal">
|
|
10
10
|
<div>Hello</div>
|
|
11
11
|
<div>World</div>
|
|
12
12
|
</Stack>
|
|
13
13
|
);
|
|
14
14
|
|
|
15
|
-
expect(
|
|
16
|
-
expect(
|
|
15
|
+
expect(screen.getByText('Hello')).toBeVisible();
|
|
16
|
+
expect(screen.getByText('World')).toBeVisible();
|
|
17
|
+
// eslint-disable-next-line testing-library/no-node-access
|
|
18
|
+
expect(screen.getByText('Hello').parentNode).toHaveClass('Stack--horizontal-6');
|
|
17
19
|
});
|
|
18
20
|
});
|
|
@@ -10,7 +10,7 @@ export type TabListProps = {
|
|
|
10
10
|
|
|
11
11
|
export const TabList: React.FC<TabListProps> = ({ tabs, onTabSelected, activePanel }) => {
|
|
12
12
|
return (
|
|
13
|
-
<div className=
|
|
13
|
+
<div className="TabList">
|
|
14
14
|
{tabs.map(tab => (
|
|
15
15
|
<Tab key={tab.name} tab={tab} onTabChosen={onTabSelected} activeTab={activePanel} />
|
|
16
16
|
))}
|
|
@@ -9,7 +9,7 @@ export type TabPanelsProps = {
|
|
|
9
9
|
|
|
10
10
|
export const TabPanels: React.FC<TabPanelsProps> = ({ panels, activePanel }) => {
|
|
11
11
|
return (
|
|
12
|
-
<div className=
|
|
12
|
+
<div className="TabPanels">
|
|
13
13
|
{panels
|
|
14
14
|
.filter(tab => tab.name === activePanel)
|
|
15
15
|
.map(tab => (
|
|
@@ -47,9 +47,9 @@ export const WithCallback = () => {
|
|
|
47
47
|
return (
|
|
48
48
|
<States<TabsProps>>
|
|
49
49
|
<>
|
|
50
|
-
<Text treatment=
|
|
50
|
+
<Text treatment="h5">Selected Tab:</Text>
|
|
51
51
|
<Text> {tabName} </Text>
|
|
52
|
-
<Tabs tabs={TAB_LIST} onTabClicked={handleTabClick} activeTab="tab2"/>
|
|
52
|
+
<Tabs tabs={TAB_LIST} onTabClicked={handleTabClick} activeTab="tab2" />
|
|
53
53
|
</>
|
|
54
54
|
</States>
|
|
55
55
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
|
|
4
4
|
import { Tabs } from './Tabs';
|
|
5
5
|
|
|
@@ -8,20 +8,19 @@ describe('Tabs', () => {
|
|
|
8
8
|
{
|
|
9
9
|
name: 'tab1',
|
|
10
10
|
title: 'Tab 1',
|
|
11
|
-
panel: <div className=
|
|
11
|
+
panel: <div className="test">I am a panel</div>
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
name: 'tab2',
|
|
15
15
|
title: 'Tab 2',
|
|
16
|
-
panel: <div className=
|
|
16
|
+
panel: <div className="test">I am also a panel</div>
|
|
17
17
|
}
|
|
18
18
|
];
|
|
19
19
|
|
|
20
20
|
it('renders correctly with first tab displayed', () => {
|
|
21
|
-
|
|
21
|
+
render(<Tabs tabs={testList} />);
|
|
22
22
|
|
|
23
|
-
expect(
|
|
24
|
-
|
|
25
|
-
);
|
|
23
|
+
expect(screen.getByRole('button', { name: 'Tab 1' })).toBeVisible();
|
|
24
|
+
expect(screen.getByRole('button', { name: 'Tab 2' })).toBeVisible();
|
|
26
25
|
});
|
|
27
26
|
});
|
|
@@ -9,7 +9,13 @@ export type TabsProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
9
9
|
activeTab?: string;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
export const Tabs: React.FC<TabsProps> = ({
|
|
12
|
+
export const Tabs: React.FC<TabsProps> = ({
|
|
13
|
+
tabs,
|
|
14
|
+
onTabClicked,
|
|
15
|
+
activeTab,
|
|
16
|
+
className,
|
|
17
|
+
...rest
|
|
18
|
+
}) => {
|
|
13
19
|
const [activePanel, setActivePanel] = useState(activeTab || tabs[0].name);
|
|
14
20
|
const handleTabClick = (tabName: string) => {
|
|
15
21
|
setActivePanel(tabName);
|
|
@@ -8,7 +8,7 @@ describe('Tag', () => {
|
|
|
8
8
|
const onRemove = jest.fn();
|
|
9
9
|
render(<Tag onRemove={onRemove}>Hello</Tag>);
|
|
10
10
|
|
|
11
|
-
expect(screen.getByText('Hello')).
|
|
11
|
+
expect(screen.getByText('Hello')).toBeInTheDocument();
|
|
12
12
|
|
|
13
13
|
await userEvent.click(screen.getByRole('button'));
|
|
14
14
|
expect(onRemove).toBeCalled();
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import { Clickable } from '../Clickable';
|
|
4
3
|
import ExitIcon from '@moda/icons/exit-16';
|
|
4
|
+
import { Clickable } from '../Clickable';
|
|
5
5
|
import './Tag.scss';
|
|
6
6
|
|
|
7
|
-
export type TagProps = {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
export type TagProps = {
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
onRemove?: () => void;
|
|
10
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
10
11
|
|
|
11
12
|
export const Tag: React.FC<TagProps> = ({ className, disabled, onRemove, children, ...rest }) => (
|
|
12
13
|
<div className={classNames('Tag', className, { 'Tag--disabled': disabled })} {...rest}>
|
|
13
14
|
<div>{children}</div>
|
|
14
15
|
{onRemove && (
|
|
15
|
-
<Clickable disabled={disabled} aria-label=
|
|
16
|
+
<Clickable disabled={disabled} aria-label="Remove" onClick={onRemove}>
|
|
16
17
|
<ExitIcon />
|
|
17
18
|
</Clickable>
|
|
18
19
|
)}
|
|
@@ -23,24 +23,24 @@ export const Treatments = () => (
|
|
|
23
23
|
|
|
24
24
|
export const Colors = () => (
|
|
25
25
|
<States<Partial<TextProps>> states={COLORS}>
|
|
26
|
-
<Text treatment=
|
|
26
|
+
<Text treatment="h5">Moda Operandi</Text>
|
|
27
27
|
</States>
|
|
28
28
|
);
|
|
29
29
|
|
|
30
30
|
export const Families = () => (
|
|
31
31
|
<States<Partial<TextProps>> states={FAMILIES}>
|
|
32
|
-
<Text treatment=
|
|
32
|
+
<Text treatment="h5">Moda Operandi</Text>
|
|
33
33
|
</States>
|
|
34
34
|
);
|
|
35
35
|
|
|
36
36
|
export const Complex = () => (
|
|
37
37
|
<Text>
|
|
38
|
-
<Text treatment=
|
|
38
|
+
<Text treatment="h6" color="fuchsia" family="serif">
|
|
39
39
|
Moda Operandi
|
|
40
40
|
</Text>
|
|
41
41
|
{' — '}
|
|
42
|
-
<Text color=
|
|
43
|
-
Happy <Text color=
|
|
42
|
+
<Text color="money-good" treatment="eyebrow">
|
|
43
|
+
Happy <Text color="code-red">Holidays</Text>
|
|
44
44
|
</Text>
|
|
45
45
|
</Text>
|
|
46
46
|
);
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
|
|
4
4
|
import { Text } from './Text';
|
|
5
5
|
|
|
6
6
|
describe('Text', () => {
|
|
7
7
|
it('renders correctly', () => {
|
|
8
|
-
|
|
9
|
-
<Text treatment=
|
|
8
|
+
render(
|
|
9
|
+
<Text treatment="body2" color="money-good" family="serif">
|
|
10
10
|
Hello
|
|
11
11
|
</Text>
|
|
12
12
|
);
|
|
13
|
-
expect(
|
|
14
|
-
'<span class="Text Text--body2 Text--serif" style="color:rgb(4, 108, 0)">Hello</span>'
|
|
15
|
-
);
|
|
13
|
+
expect(screen.getByText('Hello')).toBeVisible();
|
|
16
14
|
});
|
|
17
15
|
});
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
|
|
4
4
|
import { TextInput } from './TextInput';
|
|
5
5
|
|
|
6
6
|
describe('TextInput', () => {
|
|
7
7
|
it('renders correctly', () => {
|
|
8
|
-
|
|
9
|
-
expect(
|
|
10
|
-
|
|
11
|
-
);
|
|
8
|
+
render(<TextInput placeholder="Hello" />);
|
|
9
|
+
expect(screen.getByRole('textbox')).toHaveValue('');
|
|
10
|
+
expect(screen.getByRole('textbox')).toHaveAttribute('placeholder', 'Hello');
|
|
12
11
|
});
|
|
13
12
|
});
|
|
@@ -1,34 +1,29 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
|
|
4
4
|
import { Textarea } from './Textarea';
|
|
5
5
|
|
|
6
6
|
describe('Textarea', () => {
|
|
7
7
|
it('renders correctly', () => {
|
|
8
|
-
|
|
8
|
+
render(<Textarea placeholder="Placeholder" defaultValue="Hello" />);
|
|
9
9
|
|
|
10
|
-
expect(
|
|
11
|
-
|
|
12
|
-
);
|
|
10
|
+
expect(screen.getByRole('textbox')).toHaveValue('Hello');
|
|
11
|
+
expect(screen.getByRole('textbox')).toHaveAttribute('placeholder', 'Placeholder');
|
|
13
12
|
});
|
|
14
13
|
|
|
15
14
|
it('renders with an error', () => {
|
|
16
|
-
|
|
17
|
-
<Textarea placeholder='Placeholder' defaultValue='Hello' label='Label' error='Error' />
|
|
18
|
-
);
|
|
15
|
+
render(<Textarea placeholder="Placeholder" defaultValue="Hello" label="Label" error="Error" />);
|
|
19
16
|
|
|
20
|
-
expect(
|
|
21
|
-
|
|
22
|
-
);
|
|
17
|
+
expect(screen.getByRole('textbox')).toHaveValue('Hello');
|
|
18
|
+
expect(screen.getByRole('textbox')).toHaveClass('Textarea--error');
|
|
23
19
|
});
|
|
24
20
|
|
|
25
21
|
it('renders with a className', () => {
|
|
26
|
-
|
|
27
|
-
<Textarea className=
|
|
22
|
+
render(
|
|
23
|
+
<Textarea className="Custom" placeholder="Placeholder" defaultValue="Hello" label="Label" />
|
|
28
24
|
);
|
|
29
25
|
|
|
30
|
-
expect(
|
|
31
|
-
|
|
32
|
-
);
|
|
26
|
+
expect(screen.getByRole('textbox')).toHaveValue('Hello');
|
|
27
|
+
expect(screen.getByRole('textbox')).toHaveClass('Custom');
|
|
33
28
|
});
|
|
34
29
|
});
|
|
@@ -7,7 +7,7 @@ export default { title: 'Components/Toast' };
|
|
|
7
7
|
|
|
8
8
|
export const Default = () => (
|
|
9
9
|
<States<ToastProps> states={[{ theme: 'success' }, { theme: 'warning' }, { theme: 'error' }]}>
|
|
10
|
-
<Toast theme=
|
|
10
|
+
<Toast theme="success" onRemove={() => action('removed')}>
|
|
11
11
|
This is a toast notification.
|
|
12
12
|
</Toast>
|
|
13
13
|
</States>
|
|
@@ -7,12 +7,12 @@ describe('Toast', () => {
|
|
|
7
7
|
it('works correctly', async () => {
|
|
8
8
|
const onRemove = jest.fn();
|
|
9
9
|
render(
|
|
10
|
-
<Toast theme=
|
|
10
|
+
<Toast theme="success" onRemove={onRemove}>
|
|
11
11
|
Hello
|
|
12
12
|
</Toast>
|
|
13
13
|
);
|
|
14
14
|
|
|
15
|
-
expect(screen.getByText('Hello')).
|
|
15
|
+
expect(screen.getByText('Hello')).toBeInTheDocument();
|
|
16
16
|
|
|
17
17
|
await userEvent.click(screen.getByRole('button', { name: 'Remove' }));
|
|
18
18
|
expect(onRemove).toBeCalled();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
+
import ExitIcon from '@moda/icons/exit-16';
|
|
3
4
|
import { Clickable } from '../Clickable';
|
|
4
5
|
import { Text } from '../Text';
|
|
5
6
|
import { Stack, StackProps } from '../Stack';
|
|
6
|
-
import ExitIcon from '@moda/icons/exit-16';
|
|
7
7
|
import './Toast.scss';
|
|
8
8
|
|
|
9
9
|
export type ToastProps = {
|
|
@@ -14,17 +14,17 @@ export type ToastProps = {
|
|
|
14
14
|
export const Toast: React.FC<ToastProps> = ({ theme, className, onRemove, children, ...rest }) => (
|
|
15
15
|
<Stack
|
|
16
16
|
className={classNames('Toast', `Toast--${theme}`, className)}
|
|
17
|
-
direction=
|
|
17
|
+
direction="horizontal"
|
|
18
18
|
space={2}
|
|
19
|
-
alignItems=
|
|
20
|
-
justifyContent=
|
|
19
|
+
alignItems="center"
|
|
20
|
+
justifyContent="space-between"
|
|
21
21
|
{...rest}
|
|
22
22
|
>
|
|
23
|
-
<Text treatment=
|
|
23
|
+
<Text treatment="bold1" color="snow">
|
|
24
24
|
{children}
|
|
25
25
|
</Text>
|
|
26
26
|
{onRemove && (
|
|
27
|
-
<Clickable aria-label=
|
|
27
|
+
<Clickable aria-label="Remove" onClick={onRemove}>
|
|
28
28
|
<ExitIcon />
|
|
29
29
|
</Clickable>
|
|
30
30
|
)}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { States } from 'storybook-states';
|
|
4
|
-
import { VerticalDivider } from './VerticalDivider';
|
|
5
4
|
import { Stack } from '../Stack';
|
|
5
|
+
import { VerticalDivider } from './VerticalDivider';
|
|
6
6
|
|
|
7
7
|
export default { title: 'Components/VerticalDivider' };
|
|
8
8
|
|
|
9
9
|
export const Default = () => (
|
|
10
10
|
<States>
|
|
11
|
-
<Stack direction=
|
|
11
|
+
<Stack direction="horizontal" space={4}>
|
|
12
12
|
<div> Lorem ipsum dolor sit amet</div>
|
|
13
13
|
|
|
14
14
|
<VerticalDivider />
|
|
@@ -20,7 +20,7 @@ export const Default = () => (
|
|
|
20
20
|
|
|
21
21
|
export const Double = () => (
|
|
22
22
|
<States>
|
|
23
|
-
<Stack direction=
|
|
23
|
+
<Stack direction="horizontal" space={4}>
|
|
24
24
|
<div> Lorem ipsum dolor sit amet</div>
|
|
25
25
|
|
|
26
26
|
<VerticalDivider double />
|