@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
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
3
4
|
|
|
4
5
|
import { Button } from './Button';
|
|
5
6
|
|
|
6
7
|
describe('Button', () => {
|
|
7
8
|
it('renders correctly', () => {
|
|
8
|
-
|
|
9
|
-
expect(
|
|
9
|
+
render(<Button>Click me</Button>);
|
|
10
|
+
expect(screen.getByRole('button', { name: 'Click me' })).toBeVisible();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('calls onClick when clicked', async () => {
|
|
14
|
+
const user = userEvent.setup();
|
|
15
|
+
const onClick = jest.fn();
|
|
16
|
+
|
|
17
|
+
render(<Button onClick={onClick}>Click me</Button>);
|
|
18
|
+
|
|
19
|
+
await user.click(screen.getByRole('button', { name: 'Click me' }));
|
|
20
|
+
expect(onClick).toBeCalled();
|
|
10
21
|
});
|
|
11
22
|
});
|
|
@@ -2,9 +2,9 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import { States } from 'storybook-states';
|
|
3
3
|
|
|
4
4
|
import { Text } from '../Text';
|
|
5
|
-
import { Checkbox, CheckboxProps } from './Checkbox';
|
|
6
5
|
import { Stack } from '../Stack';
|
|
7
6
|
import { RadioButton } from '../RadioButton';
|
|
7
|
+
import { Checkbox, CheckboxProps } from './Checkbox';
|
|
8
8
|
|
|
9
9
|
export default { title: 'Components/Checkbox' };
|
|
10
10
|
|
|
@@ -18,9 +18,9 @@ export const Default = () => (
|
|
|
18
18
|
{ children: 'Remember me', checked: true },
|
|
19
19
|
{ children: 'Disabled', disabled: true },
|
|
20
20
|
{ children: 'Disabled', checked: true, disabled: true },
|
|
21
|
-
{ children: 'Filtering/Circle',
|
|
22
|
-
{ children: 'Disabled',
|
|
23
|
-
{ children: <Text color=
|
|
21
|
+
{ children: 'Filtering/Circle', checkIcon: 'circle' },
|
|
22
|
+
{ children: 'Disabled', checkIcon: 'circle', checked: true, disabled: true },
|
|
23
|
+
{ children: <Text color="code-red">Important!</Text> }
|
|
24
24
|
]}
|
|
25
25
|
>
|
|
26
26
|
<Checkbox />
|
|
@@ -33,11 +33,11 @@ export const Check = () => {
|
|
|
33
33
|
return (
|
|
34
34
|
<States>
|
|
35
35
|
<Stack space={2}>
|
|
36
|
-
<Text color=
|
|
36
|
+
<Text color="burnt-orange">{checked ? 'Remembering' : 'Forgetting'}</Text>
|
|
37
37
|
|
|
38
38
|
<Checkbox
|
|
39
|
-
id=
|
|
40
|
-
name=
|
|
39
|
+
id="rememberMe"
|
|
40
|
+
name="rememberMe"
|
|
41
41
|
checked={checked}
|
|
42
42
|
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
|
|
43
43
|
check(event.target.checked);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
4
|
|
|
5
5
|
import { Checkbox } from './Checkbox';
|
|
@@ -7,33 +7,31 @@ import { Checkbox } from './Checkbox';
|
|
|
7
7
|
describe('Checkbox', () => {
|
|
8
8
|
it('works correctly with checked attribute (controlled)', async () => {
|
|
9
9
|
const handleChange = jest.fn();
|
|
10
|
-
const {
|
|
11
|
-
<Checkbox data-testid=
|
|
10
|
+
const { rerender } = render(
|
|
11
|
+
<Checkbox data-testid="checkbox" checked onChange={handleChange} />
|
|
12
12
|
);
|
|
13
13
|
|
|
14
|
-
expect(
|
|
14
|
+
expect(screen.getByRole('checkbox') as HTMLInputElement).toBeChecked();
|
|
15
15
|
|
|
16
|
-
await userEvent.click(getByTestId('checkbox'));
|
|
16
|
+
await userEvent.click(screen.getByTestId('checkbox'));
|
|
17
17
|
|
|
18
18
|
expect(handleChange).toBeCalled();
|
|
19
|
-
expect(
|
|
19
|
+
expect(screen.getByRole('checkbox') as HTMLInputElement).toBeChecked();
|
|
20
20
|
|
|
21
|
-
rerender(<Checkbox data-testid=
|
|
21
|
+
rerender(<Checkbox data-testid="checkbox" checked={false} onChange={handleChange} />);
|
|
22
22
|
|
|
23
|
-
expect(
|
|
23
|
+
expect(screen.getByRole('checkbox') as HTMLInputElement).not.toBeChecked();
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
it('works correctly with defaultChecked attribute (uncontrolled)', async () => {
|
|
27
27
|
const handleChange = jest.fn();
|
|
28
|
-
|
|
29
|
-
<Checkbox data-testid='checkbox' defaultChecked={false} onChange={handleChange} />
|
|
30
|
-
);
|
|
28
|
+
render(<Checkbox data-testid="checkbox" defaultChecked={false} onChange={handleChange} />);
|
|
31
29
|
|
|
32
|
-
expect(
|
|
30
|
+
expect(screen.getByRole('checkbox') as HTMLInputElement).not.toBeChecked();
|
|
33
31
|
|
|
34
|
-
await userEvent.click(getByTestId('checkbox'));
|
|
32
|
+
await userEvent.click(screen.getByTestId('checkbox'));
|
|
35
33
|
|
|
36
34
|
expect(handleChange).toBeCalled();
|
|
37
|
-
expect(
|
|
35
|
+
expect(screen.getByRole('checkbox') as HTMLInputElement).toBeChecked();
|
|
38
36
|
});
|
|
39
37
|
});
|
|
@@ -15,7 +15,7 @@ export type ShowCheckedUsing = 'checkmark' | 'circle';
|
|
|
15
15
|
|
|
16
16
|
export type CheckboxProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
17
17
|
children?: JSX.Element | string;
|
|
18
|
-
|
|
18
|
+
checkIcon?: ShowCheckedUsing;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export const Checkbox: React.FC<CheckboxProps> = ({
|
|
@@ -26,7 +26,7 @@ export const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
26
26
|
value,
|
|
27
27
|
onChange,
|
|
28
28
|
disabled,
|
|
29
|
-
|
|
29
|
+
checkIcon = 'checkmark',
|
|
30
30
|
...rest
|
|
31
31
|
}) => {
|
|
32
32
|
const [isChecked, setIsChecked] = useState(checked ?? defaultChecked ?? false);
|
|
@@ -45,7 +45,7 @@ export const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
45
45
|
|
|
46
46
|
return (
|
|
47
47
|
<label
|
|
48
|
-
role=
|
|
48
|
+
role="button"
|
|
49
49
|
tabIndex={0}
|
|
50
50
|
className={classNames('Checkbox', className, {
|
|
51
51
|
'Checkbox--disabled': disabled
|
|
@@ -59,17 +59,17 @@ export const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
59
59
|
>
|
|
60
60
|
{isChecked && (
|
|
61
61
|
<>
|
|
62
|
-
{
|
|
62
|
+
{checkIcon === 'checkmark' && <CheckmarkIcon {...CHECKED_ITEM_PROPS} />}
|
|
63
63
|
|
|
64
|
-
{
|
|
64
|
+
{checkIcon === 'circle' && <CircleIcon {...CHECKED_ITEM_PROPS} />}
|
|
65
65
|
</>
|
|
66
66
|
)}
|
|
67
67
|
</span>
|
|
68
68
|
|
|
69
69
|
<input
|
|
70
70
|
tabIndex={-1}
|
|
71
|
-
className=
|
|
72
|
-
type=
|
|
71
|
+
className="Checkbox__input"
|
|
72
|
+
type="checkbox"
|
|
73
73
|
checked={isChecked}
|
|
74
74
|
value={value}
|
|
75
75
|
onChange={handleChange}
|
|
@@ -77,7 +77,7 @@ export const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
77
77
|
{...rest}
|
|
78
78
|
/>
|
|
79
79
|
|
|
80
|
-
{children && <span className=
|
|
80
|
+
{children && <span className="Checkbox__label">{children}</span>}
|
|
81
81
|
</label>
|
|
82
82
|
);
|
|
83
83
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { action } from '@storybook/addon-actions';
|
|
3
3
|
import { States } from 'storybook-states';
|
|
4
|
-
import { Clickable, ClickableProps } from './Clickable';
|
|
5
4
|
import { BrowserRouter } from 'react-router-dom';
|
|
5
|
+
import { Clickable, ClickableProps } from './Clickable';
|
|
6
6
|
|
|
7
7
|
export default { title: 'Components/Clickable' };
|
|
8
8
|
|
|
@@ -16,14 +16,14 @@ export const Button = () => (
|
|
|
16
16
|
|
|
17
17
|
export const Anchor = () => (
|
|
18
18
|
<States<ClickableProps>>
|
|
19
|
-
<Clickable href=
|
|
19
|
+
<Clickable href="#">Useful to extend in place of <a/>. Click me.</Clickable>
|
|
20
20
|
</States>
|
|
21
21
|
);
|
|
22
22
|
|
|
23
23
|
export const Link = () => (
|
|
24
24
|
<BrowserRouter>
|
|
25
25
|
<States<ClickableProps>>
|
|
26
|
-
<Clickable to=
|
|
26
|
+
<Clickable to="#href">Useful to extend in place of <Link/>. Click me.</Clickable>
|
|
27
27
|
</States>
|
|
28
28
|
</BrowserRouter>
|
|
29
29
|
);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
|
|
4
4
|
import { Clickable } from './Clickable';
|
|
5
5
|
|
|
6
6
|
describe('Clickable', () => {
|
|
7
7
|
it('renders correctly', () => {
|
|
8
|
-
|
|
9
|
-
expect(
|
|
8
|
+
render(<Clickable>Hello</Clickable>);
|
|
9
|
+
expect(screen.getByRole('button', { name: 'Hello' })).toBeVisible();
|
|
10
10
|
});
|
|
11
11
|
});
|
|
@@ -20,33 +20,33 @@ const STATES = [
|
|
|
20
20
|
|
|
21
21
|
export const Default = () => (
|
|
22
22
|
<States<Partial<ColorSwatchProps>> states={STATES}>
|
|
23
|
-
<ColorSwatch color=
|
|
23
|
+
<ColorSwatch color="yellow" onClick={action('onClick')} />
|
|
24
24
|
</States>
|
|
25
25
|
);
|
|
26
26
|
|
|
27
27
|
export const Small = () => (
|
|
28
28
|
<States<Partial<ColorSwatchProps>> states={STATES}>
|
|
29
|
-
<ColorSwatch size=
|
|
29
|
+
<ColorSwatch size="small" color="yellow" onClick={action('onClick')} />
|
|
30
30
|
</States>
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
export const White = () => (
|
|
34
34
|
<States<Partial<ColorSwatchProps>> states={STATES}>
|
|
35
|
-
<ColorSwatch size=
|
|
35
|
+
<ColorSwatch size="small" color="white" onClick={action('onClick')} />
|
|
36
36
|
</States>
|
|
37
37
|
);
|
|
38
38
|
|
|
39
39
|
export const Swatches = () => (
|
|
40
40
|
<States<ColorSwatchProps>>
|
|
41
|
-
<Stack space={1} direction=
|
|
42
|
-
<ColorSwatch onClick={action('onClick')} color=
|
|
43
|
-
<ColorSwatch onClick={action('onClick')} color=
|
|
44
|
-
<ColorSwatch onClick={action('onClick')} color=
|
|
45
|
-
<ColorSwatch onClick={action('onClick')} color=
|
|
41
|
+
<Stack space={1} direction="horizontal">
|
|
42
|
+
<ColorSwatch onClick={action('onClick')} color="red" />
|
|
43
|
+
<ColorSwatch onClick={action('onClick')} color="white" />
|
|
44
|
+
<ColorSwatch onClick={action('onClick')} color="bronze" soldOut disabled />
|
|
45
|
+
<ColorSwatch onClick={action('onClick')} color="nude" onSale />
|
|
46
46
|
<ColorSwatch
|
|
47
47
|
onClick={action('onClick')}
|
|
48
|
-
backgroundUrl=
|
|
49
|
-
color=
|
|
48
|
+
backgroundUrl="https://www.modaoperandi.com/assets/images/products/730581/340267/sw/prada-animal-leopard-print-shell-shoulder-bag.jpg?_v=1581323237"
|
|
49
|
+
color="nude"
|
|
50
50
|
onSale
|
|
51
51
|
onMouseEnter={action('onMouseEnter')}
|
|
52
52
|
onMouseLeave={action('onMouseLeave')}
|
|
@@ -56,7 +56,7 @@ export const Swatches = () => (
|
|
|
56
56
|
);
|
|
57
57
|
|
|
58
58
|
export const Constrained = () => (
|
|
59
|
-
<Stack direction=
|
|
59
|
+
<Stack direction="horizontal" space={3}>
|
|
60
60
|
{Object.keys(SKU_COLORS).map(color => (
|
|
61
61
|
<ColorSwatch key={color} onClick={action('onClick')} color={color} />
|
|
62
62
|
))}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
|
|
4
4
|
import { ColorSwatch } from './ColorSwatch';
|
|
5
5
|
|
|
6
6
|
describe('ColorSwatch', () => {
|
|
7
7
|
it('renders correctly', () => {
|
|
8
|
-
|
|
9
|
-
expect(
|
|
10
|
-
'<button class="Clickable ColorSwatch"><div class="ColorSwatch__chip" style="background-color:#eee4d7"></div></button>'
|
|
11
|
-
);
|
|
8
|
+
render(<ColorSwatch color="nude" />);
|
|
9
|
+
expect(screen.getByRole('button')).toBeVisible();
|
|
12
10
|
});
|
|
13
11
|
});
|
|
@@ -26,7 +26,7 @@ const Constrained = () => {
|
|
|
26
26
|
return (
|
|
27
27
|
<Constrain>
|
|
28
28
|
<div ref={ref} style={{ backgroundColor: 'black', color: 'white', padding: '1rem' }}>
|
|
29
|
-
<Text color=
|
|
29
|
+
<Text color="snow">
|
|
30
30
|
window: {windowWidth}px
|
|
31
31
|
<br />
|
|
32
32
|
constrained: {constrainWidth}px
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
|
|
4
4
|
import { Constrain } from './Constrain';
|
|
5
5
|
|
|
6
6
|
describe('Constrain', () => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
expect(
|
|
7
|
+
it('renders correctly', () => {
|
|
8
|
+
render(<Constrain>Hello</Constrain>);
|
|
9
|
+
expect(screen.getByText('Hello')).toBeVisible();
|
|
10
10
|
});
|
|
11
11
|
});
|
|
@@ -10,10 +10,10 @@ const Constrained = () => {
|
|
|
10
10
|
return (
|
|
11
11
|
<Constrain>
|
|
12
12
|
<div style={{ backgroundColor: 'black', color: 'white', padding: '1rem' }}>
|
|
13
|
-
<Text color=
|
|
13
|
+
<Text color="snow">This div is constrained.</Text>
|
|
14
14
|
</div>
|
|
15
15
|
<ExceedConstrain style={{ backgroundColor: 'gray', color: 'white', padding: '1rem' }}>
|
|
16
|
-
<Text color=
|
|
16
|
+
<Text color="snow">This exceeds the constrain.</Text>
|
|
17
17
|
</ExceedConstrain>
|
|
18
18
|
</Constrain>
|
|
19
19
|
);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { action } from '@storybook/addon-actions';
|
|
3
3
|
import { States } from 'storybook-states';
|
|
4
|
-
import { ControlLink, ControlLinkProps } from './ControlLink';
|
|
5
4
|
import { BrowserRouter } from 'react-router-dom';
|
|
5
|
+
import { ControlLink, ControlLinkProps } from './ControlLink';
|
|
6
6
|
|
|
7
7
|
export default { title: 'Components/ControlLink' };
|
|
8
8
|
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
|
|
4
4
|
import { ControlLink } from './ControlLink';
|
|
5
5
|
|
|
6
6
|
describe('ControlLink', () => {
|
|
7
7
|
it('renders correctly', () => {
|
|
8
|
-
|
|
9
|
-
expect(
|
|
10
|
-
|
|
11
|
-
);
|
|
8
|
+
render(<ControlLink> click me! </ControlLink>);
|
|
9
|
+
expect(screen.getByRole('button', { name: 'click me!' })).toBeVisible();
|
|
10
|
+
expect(screen.getByRole('button', { name: 'click me!' })).toBeEnabled();
|
|
12
11
|
});
|
|
13
12
|
|
|
14
13
|
it('renders correctly while disabled', () => {
|
|
15
|
-
|
|
16
|
-
expect(
|
|
17
|
-
'<button class="Clickable Clickable--disabled ControlLink ControlLink--underlined ControlLink--disabled" disabled=""> do not click me! </button>'
|
|
18
|
-
);
|
|
14
|
+
render(<ControlLink disabled> do not click me! </ControlLink>);
|
|
15
|
+
expect(screen.getByRole('button', { name: 'do not click me!' })).toBeDisabled();
|
|
19
16
|
});
|
|
20
17
|
|
|
21
18
|
it('renders correctly while underlined', () => {
|
|
22
|
-
|
|
23
|
-
expect(
|
|
24
|
-
|
|
19
|
+
render(<ControlLink underlined> click me! </ControlLink>);
|
|
20
|
+
expect(screen.getByRole('button', { name: 'click me!' })).toBeVisible();
|
|
21
|
+
expect(screen.getByRole('button', { name: 'click me!' })).toHaveClass(
|
|
22
|
+
'ControlLink--underlined'
|
|
25
23
|
);
|
|
26
24
|
});
|
|
27
25
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './ControlLink';
|
|
1
|
+
export * from './ControlLink';
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
4
|
import { CreditCardNumberInput } from './CreditCardNumberInput';
|
|
5
5
|
|
|
6
6
|
describe('credit card number input', () => {
|
|
7
7
|
it('renders without errors', () => {
|
|
8
|
-
|
|
9
|
-
const input = getByLabelText('Card Number');
|
|
10
|
-
expect(input).
|
|
8
|
+
render(<CreditCardNumberInput label="Card Number" />);
|
|
9
|
+
const input = screen.getByLabelText('Card Number');
|
|
10
|
+
expect(input).toBeInTheDocument();
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
// TODO: userEvent.type does not work here for some reason
|
|
14
|
-
xit('does not allow non-numeric characters', () => {
|
|
15
|
-
|
|
16
|
-
const input = getByLabelText('Card Number') as HTMLInputElement;
|
|
14
|
+
xit('does not allow non-numeric characters', async () => {
|
|
15
|
+
render(<CreditCardNumberInput label="Card Number" />);
|
|
16
|
+
const input = screen.getByLabelText('Card Number') as HTMLInputElement;
|
|
17
17
|
|
|
18
|
-
userEvent.type(input, 'foo1234');
|
|
18
|
+
await userEvent.type(input, 'foo1234');
|
|
19
19
|
|
|
20
20
|
expect(input.value).toBe('1234 ____ ____ ____');
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
// TODO: userEvent.type does not work here for some reason
|
|
24
|
-
xit('puts spaces between the numbers', () => {
|
|
25
|
-
|
|
26
|
-
const input = getByLabelText('Card Number') as HTMLInputElement;
|
|
24
|
+
xit('puts spaces between the numbers', async () => {
|
|
25
|
+
render(<CreditCardNumberInput label="Card Number" />);
|
|
26
|
+
const input = screen.getByLabelText('Card Number') as HTMLInputElement;
|
|
27
27
|
|
|
28
|
-
userEvent.type(input, '5510000000000000');
|
|
28
|
+
await userEvent.type(input, '5510000000000000');
|
|
29
29
|
|
|
30
30
|
expect(input.value).toBe('5510 0000 0000 0000');
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
// TODO: userEvent.type does not work here for some reason
|
|
34
|
-
xit('does not allow more characters than required', () => {
|
|
35
|
-
|
|
36
|
-
const input = getByLabelText('Card Number') as HTMLInputElement;
|
|
34
|
+
xit('does not allow more characters than required', async () => {
|
|
35
|
+
render(<CreditCardNumberInput label="Card Number" />);
|
|
36
|
+
const input = screen.getByLabelText('Card Number') as HTMLInputElement;
|
|
37
37
|
|
|
38
|
-
userEvent.type(input, '5510000000000000251');
|
|
38
|
+
await userEvent.type(input, '5510000000000000251');
|
|
39
39
|
|
|
40
40
|
expect(input.value).toBe('5510 0000 0000 0000');
|
|
41
41
|
});
|
|
@@ -62,6 +62,7 @@ export const CreditCardNumberInput: React.FC<CreditCardNumberInputProps> = ({
|
|
|
62
62
|
);
|
|
63
63
|
|
|
64
64
|
// TODO: get rid of the any, the types of react-input-mask are incorrect here, it should expect a function as a child, but it expects a ReactNode
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
66
|
const renderInputField: any = (inputProps: CreditCardNumberInputFieldProps) => (
|
|
66
67
|
<CreditCardNumberInputField {...rest} {...inputProps} />
|
|
67
68
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { States } from 'storybook-states';
|
|
3
|
-
import { DefinitionList, DefinitionListProps } from './DefinitionList';
|
|
4
3
|
import { Text } from '../Text';
|
|
4
|
+
import { DefinitionList, DefinitionListProps } from './DefinitionList';
|
|
5
5
|
|
|
6
6
|
export default { title: 'Components/DefinitionList' };
|
|
7
7
|
|
|
@@ -14,13 +14,13 @@ export const Default = () => (
|
|
|
14
14
|
term: 'Size',
|
|
15
15
|
children: (
|
|
16
16
|
<>
|
|
17
|
-
US 2 — <Text color=
|
|
17
|
+
US 2 — <Text color="code-red">Only 2 Left</Text>
|
|
18
18
|
</>
|
|
19
19
|
)
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
term: 'Supports',
|
|
23
|
-
children: <a href=
|
|
23
|
+
children: <a href="#link">Links</a>
|
|
24
24
|
}
|
|
25
25
|
]}
|
|
26
26
|
>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
|
|
4
4
|
import { DefinitionList } from './DefinitionList';
|
|
5
5
|
|
|
6
6
|
describe('DefinitionList', () => {
|
|
7
7
|
it('renders correctly', () => {
|
|
8
|
-
|
|
9
|
-
expect(
|
|
8
|
+
render(<DefinitionList term="Foo">Bar</DefinitionList>);
|
|
9
|
+
expect(screen.getByText('Foo')).toBeVisible();
|
|
10
|
+
expect(screen.getByText('Bar')).toBeVisible();
|
|
10
11
|
});
|
|
11
12
|
});
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { States } from 'storybook-states';
|
|
3
|
-
import { Divider, NoLineDivider, TwoLineDivider } from './';
|
|
4
3
|
import { DividerProps } from './Divider';
|
|
4
|
+
import { Divider, NoLineDivider, TwoLineDivider } from './';
|
|
5
5
|
|
|
6
6
|
export default { title: 'Components/Divider' };
|
|
7
7
|
|
|
8
8
|
export const Default = () => (
|
|
9
9
|
<States<Partial<DividerProps>> states={[{}, { type: 'no-line' }, { type: 'two-line' }]}>
|
|
10
|
-
<Divider text=
|
|
10
|
+
<Divider text="Moda Operandi" />
|
|
11
11
|
</States>
|
|
12
12
|
);
|
|
13
13
|
|
|
14
14
|
export const WithNoLine = () => (
|
|
15
15
|
<States>
|
|
16
|
-
<NoLineDivider text=
|
|
16
|
+
<NoLineDivider text="Divider with No Line" />
|
|
17
17
|
</States>
|
|
18
18
|
);
|
|
19
19
|
|
|
20
20
|
export const WithDoubleLine = () => (
|
|
21
21
|
<States>
|
|
22
|
-
<TwoLineDivider text=
|
|
22
|
+
<TwoLineDivider text="Divider with Double Line" />
|
|
23
23
|
</States>
|
|
24
24
|
);
|
|
25
25
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
|
|
4
4
|
import { Divider } from './Divider';
|
|
5
5
|
|
|
6
6
|
describe('Divider', () => {
|
|
7
7
|
it('renders correctly', () => {
|
|
8
|
-
|
|
9
|
-
expect(
|
|
10
|
-
|
|
8
|
+
render(<Divider style={{ padding: '30px 0' }} text="Hello" />);
|
|
9
|
+
expect(screen.getByText('Hello')).toBeVisible();
|
|
10
|
+
// eslint-disable-next-line testing-library/no-node-access
|
|
11
|
+
expect(screen.getByText('Hello').parentNode).toHaveStyle('padding: 30px 0px;');
|
|
11
12
|
});
|
|
12
13
|
});
|
|
@@ -29,7 +29,7 @@ export const Divider: React.FC<DividerProps> = ({
|
|
|
29
29
|
<div className={classNames('Divider', type ? `Divider--${type}` : '', className)} {...rest}>
|
|
30
30
|
{text && (
|
|
31
31
|
<Text
|
|
32
|
-
className=
|
|
32
|
+
className="Divider__text"
|
|
33
33
|
treatment={treatment ?? defaultTreatment}
|
|
34
34
|
color={color}
|
|
35
35
|
family={family ?? defaultFamily}
|