@nulogy/components 16.0.0 → 16.0.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/dist/locales/ja_JP.json +63 -0
- package/dist/main.js +1733 -587
- package/dist/main.js.map +1 -1
- package/dist/main.module.js +1732 -586
- package/dist/main.module.js.map +1 -1
- package/dist/src/Alert/Alert.d.ts +1 -1
- package/dist/src/Alert/Alert.js +3 -8
- package/dist/src/Alert/Alert.story.d.ts +1 -1
- package/dist/src/Alert/Alert.story.js +3 -9
- package/dist/src/Alert/CloseButton.d.ts +1 -1
- package/dist/src/Alert/CloseButton.js +2 -3
- package/dist/src/AppTag/AppTag.d.ts +1 -2
- package/dist/src/AppTag/AppTag.js +2 -6
- package/dist/src/AppTag/components/NulogyLogo.d.ts +1 -1
- package/dist/src/AppTag/components/NulogyLogo.js +2 -3
- package/dist/src/AppTag/stories/AppTag.story.d.ts +2 -3
- package/dist/src/AppTag/stories/AppTag.story.js +6 -8
- package/dist/src/AppTag/stories/AppTag.usecases.story.d.ts +5 -6
- package/dist/src/AppTag/stories/AppTag.usecases.story.js +12 -58
- package/dist/src/AsyncSelect/AsyncSelect.graphql.story.d.ts +1 -2
- package/dist/src/AsyncSelect/AsyncSelect.graphql.story.js +4 -4
- package/dist/src/AsyncSelect/AsyncSelect.js +21 -23
- package/dist/src/AsyncSelect/AsyncSelect.story.d.ts +9 -10
- package/dist/src/AsyncSelect/AsyncSelect.story.js +11 -14
- package/dist/src/AsyncSelect/AsyncSelectComponents.d.ts +8 -9
- package/dist/src/AsyncSelect/AsyncSelectComponents.js +9 -19
- package/dist/src/Banner/Banner.d.ts +2 -2
- package/dist/src/Banner/Banner.js +2 -2
- package/dist/src/Banner/Banner.story.d.ts +6 -7
- package/dist/src/Banner/Banner.story.js +7 -24
- package/dist/src/BottomSheet/BottomSheet.d.ts +1 -1
- package/dist/src/BottomSheet/BottomSheet.js +3 -17
- package/dist/src/BottomSheet/BottomSheet.parts.d.ts +3 -3
- package/dist/src/BottomSheet/BottomSheet.parts.js +6 -5
- package/dist/src/BottomSheet/BottomSheet.styled.d.ts +4 -4
- package/dist/src/BottomSheet/BottomSheetProvider.d.ts +1 -1
- package/dist/src/BottomSheet/BottomSheetProvider.js +2 -2
- package/dist/src/BottomSheet/stories/BottomSheet.actions.story.d.ts +3 -4
- package/dist/src/BottomSheet/stories/BottomSheet.actions.story.js +4 -9
- package/dist/src/BottomSheet/stories/BottomSheet.content.story.d.ts +3 -4
- package/dist/src/BottomSheet/stories/BottomSheet.content.story.js +4 -11
- package/dist/src/BottomSheet/stories/BottomSheet.features.story.d.ts +5 -6
- package/dist/src/BottomSheet/stories/BottomSheet.features.story.js +12 -42
- package/dist/src/BottomSheet/stories/BottomSheet.parts.story.d.ts +2 -3
- package/dist/src/BottomSheet/stories/BottomSheet.parts.story.js +3 -23
- package/dist/src/BottomSheet/stories/BottomSheet.story.d.ts +2 -3
- package/dist/src/BottomSheet/stories/BottomSheet.story.js +3 -5
- package/dist/src/Box/Box.story.d.ts +12 -13
- package/dist/src/Box/Box.story.js +14 -32
- package/dist/src/BrandedNavBar/BrandLogoContainer.d.ts +1 -1
- package/dist/src/BrandedNavBar/BrandLogoContainer.js +2 -5
- package/dist/src/BrandedNavBar/DesktopMenu.js +6 -9
- package/dist/src/BrandedNavBar/MenuTrigger.d.ts +1 -1
- package/dist/src/BrandedNavBar/MenuTrigger.js +12 -12
- package/dist/src/BrandedNavBar/MenuTriggerButton.js +7 -8
- package/dist/src/BrandedNavBar/MobileMenu.d.ts +1 -1
- package/dist/src/BrandedNavBar/MobileMenu.js +8 -24
- package/dist/src/BrandedNavBar/NavBar.d.ts +1 -1
- package/dist/src/BrandedNavBar/NavBar.js +6 -16
- package/dist/src/BrandedNavBar/NavBar.story.d.ts +13 -14
- package/dist/src/BrandedNavBar/NavBar.story.js +27 -42
- package/dist/src/BrandedNavBar/NavBarDropdownMenu.js +34 -39
- package/dist/src/BrandedNavBar/NulogyLogo.d.ts +1 -2
- package/dist/src/BrandedNavBar/NulogyLogo.js +2 -14
- package/dist/src/BrandedNavBar/NulogyLogoContainer.d.ts +1 -2
- package/dist/src/BrandedNavBar/NulogyLogoContainer.js +2 -5
- package/dist/src/BrandedNavBar/SmallNavBar.js +9 -17
- package/dist/src/BrandedNavBar/SmallNavBar.story.d.ts +6 -7
- package/dist/src/BrandedNavBar/SmallNavBar.story.js +10 -16
- package/dist/src/BrandedNavBar/SubMenuTrigger.d.ts +1 -1
- package/dist/src/BrandedNavBar/SubMenuTrigger.js +4 -5
- package/dist/src/BrandedNavBar/SubMenuTriggerButton.js +2 -4
- package/dist/src/BrandedNavBar/renderSubMenuItems.js +5 -10
- package/dist/src/Branding/Branding.d.ts +1 -2
- package/dist/src/Branding/Branding.js +5 -10
- package/dist/src/Branding/Branding.story.d.ts +1 -2
- package/dist/src/Branding/Branding.story.js +2 -77
- package/dist/src/Branding/LettermarkLogo.d.ts +1 -2
- package/dist/src/Branding/LettermarkLogo.js +2 -3
- package/dist/src/Branding/WordmarkLogo.d.ts +1 -1
- package/dist/src/Branding/WordmarkLogo.js +2 -10
- package/dist/src/Breadcrumbs/Breadcrumbs.d.ts +1 -2
- package/dist/src/Breadcrumbs/Breadcrumbs.js +4 -5
- package/dist/src/Breadcrumbs/Breadcrumbs.story.d.ts +3 -4
- package/dist/src/Breadcrumbs/Breadcrumbs.story.js +4 -16
- package/dist/src/Button/Button.js +2 -4
- package/dist/src/Button/Button.story.d.ts +9 -10
- package/dist/src/Button/Button.story.js +10 -26
- package/dist/src/Button/CloseButton.js +2 -2
- package/dist/src/Button/ControlIcon.js +2 -2
- package/dist/src/Button/ControlIcon.story.d.ts +3 -4
- package/dist/src/Button/ControlIcon.story.js +4 -4
- package/dist/src/Button/IconicButton.js +13 -17
- package/dist/src/Button/IconicButton.story.d.ts +15 -16
- package/dist/src/Button/IconicButton.story.js +16 -31
- package/dist/src/ButtonGroup/ButtonGroup.story.d.ts +5 -6
- package/dist/src/ButtonGroup/ButtonGroup.story.js +6 -43
- package/dist/src/Card/Card.d.ts +1 -2
- package/dist/src/Card/Card.js +2 -2
- package/dist/src/Card/Card.story.d.ts +4 -5
- package/dist/src/Card/Card.story.js +6 -39
- package/dist/src/Checkbox/Checkbox.js +3 -6
- package/dist/src/Checkbox/Checkbox.story.d.ts +11 -12
- package/dist/src/Checkbox/Checkbox.story.js +13 -26
- package/dist/src/Checkbox/CheckboxGroup.d.ts +1 -1
- package/dist/src/Checkbox/CheckboxGroup.js +3 -11
- package/dist/src/Checkbox/CheckboxGroup.story.d.ts +6 -7
- package/dist/src/Checkbox/CheckboxGroup.story.js +7 -25
- package/dist/src/DatePickers/DatePicker.js +3 -2
- package/dist/src/DatePickers/MonthPicker.js +3 -2
- package/dist/src/DatePickers/WeekPicker.js +4 -7
- package/dist/src/DatePickers/custom/MonthPickerHeader.d.ts +1 -2
- package/dist/src/DatePickers/custom/MonthPickerHeader.js +2 -5
- package/dist/src/DatePickers/shared/components/BasePicker.js +3 -5
- package/dist/src/DatePickers/shared/components/DatePickerHeader.d.ts +2 -2
- package/dist/src/DatePickers/shared/components/DatePickerHeader.js +3 -9
- package/dist/src/DatePickers/shared/components/DatePickerInput.js +2 -1
- package/dist/src/DatePickers/stories/DatePicker.story.d.ts +4 -4
- package/dist/src/DatePickers/stories/DatePicker.story.js +6 -7
- package/dist/src/DatePickers/stories/MonthPicker.story.d.ts +6 -7
- package/dist/src/DatePickers/stories/MonthPicker.story.js +8 -7
- package/dist/src/DatePickers/stories/WeekPicker.story.d.ts +8 -9
- package/dist/src/DatePickers/stories/WeekPicker.story.js +10 -11
- package/dist/src/DateRange/DateRange.js +12 -17
- package/dist/src/DateRange/DateRange.story.d.ts +12 -13
- package/dist/src/DateRange/DateRange.story.js +14 -20
- package/dist/src/Decorations/index.d.ts +1 -2
- package/dist/src/Decorations/index.js +2 -4
- package/dist/src/DescriptionList/DescriptionList.d.ts +1 -2
- package/dist/src/DescriptionList/DescriptionList.js +2 -4
- package/dist/src/DescriptionList/DescriptionListContext.d.ts +2 -2
- package/dist/src/DescriptionList/DescriptionListContext.js +3 -2
- package/dist/src/DescriptionList/stories/DescriptionList.column.story.d.ts +3 -4
- package/dist/src/DescriptionList/stories/DescriptionList.column.story.js +7 -26
- package/dist/src/DescriptionList/stories/DescriptionList.group-min-width.story.js +2 -8
- package/dist/src/DescriptionList/stories/DescriptionList.layout.story.d.ts +3 -4
- package/dist/src/DescriptionList/stories/DescriptionList.layout.story.js +4 -30
- package/dist/src/DescriptionList/stories/DescriptionList.playground.story.js +83 -148
- package/dist/src/DescriptionList/stories/DescriptionList.sizing.story.d.ts +3 -4
- package/dist/src/DescriptionList/stories/DescriptionList.sizing.story.js +5 -44
- package/dist/src/DescriptionList/stories/DescriptionList.spanning.story.d.ts +3 -4
- package/dist/src/DescriptionList/stories/DescriptionList.spanning.story.js +5 -59
- package/dist/src/DescriptionList/stories/fixtures.d.ts +1 -1
- package/dist/src/DescriptionList/stories/fixtures.js +2 -27
- package/dist/src/Divider/Divider.story.d.ts +4 -4
- package/dist/src/Divider/Divider.story.js +5 -17
- package/dist/src/DropdownMenu/DropdownMenu.js +10 -10
- package/dist/src/DropdownMenu/DropdownMenu.story.d.ts +12 -13
- package/dist/src/DropdownMenu/DropdownMenu.story.js +13 -45
- package/dist/src/DropdownMenu/DropdownText.d.ts +2 -2
- package/dist/src/FieldLabel/FieldLabel.d.ts +1 -2
- package/dist/src/FieldLabel/FieldLabel.js +2 -10
- package/dist/src/FieldLabel/FieldLabel.story.d.ts +7 -8
- package/dist/src/FieldLabel/FieldLabel.story.js +12 -32
- package/dist/src/FieldLabel/MaybeFieldLabel.d.ts +1 -2
- package/dist/src/FieldLabel/MaybeFieldLabel.js +2 -2
- package/dist/src/FieldLabel/RequirementText.d.ts +1 -2
- package/dist/src/FieldLabel/RequirementText.js +2 -2
- package/dist/src/Flex/Flex.story.d.ts +18 -19
- package/dist/src/Flex/Flex.story.js +23 -122
- package/dist/src/Form/Form.d.ts +1 -1
- package/dist/src/Form/Form.js +2 -4
- package/dist/src/Form/Form.story.d.ts +6 -7
- package/dist/src/Form/Form.story.js +7 -59
- package/dist/src/Form/FormSection.d.ts +1 -1
- package/dist/src/Form/FormSection.js +2 -4
- package/dist/src/Icon/Icon.js +5 -5
- package/dist/src/Icon/Icon.story.d.ts +6 -7
- package/dist/src/Icon/Icon.story.js +8 -37
- package/dist/src/Icon/LoadingIcon.js +2 -11
- package/dist/src/Input/Input.js +3 -4
- package/dist/src/Input/Input.story.d.ts +11 -12
- package/dist/src/Input/Input.story.js +24 -55
- package/dist/src/Input/InputField.js +5 -13
- package/dist/src/Input/Prefix.d.ts +1 -2
- package/dist/src/Input/Prefix.js +2 -3
- package/dist/src/Input/Suffix.d.ts +1 -2
- package/dist/src/Input/Suffix.js +2 -3
- package/dist/src/Layout/ApplicationFrame.d.ts +2 -2
- package/dist/src/Layout/ApplicationFrame.js +2 -6
- package/dist/src/Layout/ApplicationFrame.story.d.ts +1 -2
- package/dist/src/Layout/ApplicationFrame.story.js +2 -2
- package/dist/src/Layout/Header.d.ts +2 -2
- package/dist/src/Layout/Header.js +2 -13
- package/dist/src/Layout/Header.story.d.ts +10 -11
- package/dist/src/Layout/Header.story.js +12 -52
- package/dist/src/Layout/Page.applicationFrame.story.d.ts +2 -3
- package/dist/src/Layout/Page.applicationFrame.story.js +7 -14
- package/dist/src/Layout/Page.d.ts +2 -2
- package/dist/src/Layout/Page.js +4 -6
- package/dist/src/Layout/Page.story.d.ts +1 -2
- package/dist/src/Layout/Page.story.js +15 -28
- package/dist/src/Layout/Sidebar.d.ts +1 -1
- package/dist/src/Layout/Sidebar.js +4 -16
- package/dist/src/Layout/Sidebar.story.d.ts +10 -11
- package/dist/src/Layout/Sidebar.story.js +17 -88
- package/dist/src/Link/Link.d.ts +1 -1
- package/dist/src/Link/Link.js +3 -6
- package/dist/src/Link/Link.story.d.ts +10 -11
- package/dist/src/Link/Link.story.js +11 -12
- package/dist/src/List/List.story.d.ts +5 -6
- package/dist/src/List/List.story.js +6 -21
- package/dist/src/LoadingAnimation/LoadingAnimation.d.ts +1 -1
- package/dist/src/LoadingAnimation/LoadingAnimation.js +2 -21
- package/dist/src/LoadingAnimation/LoadingAnimation.story.d.ts +4 -5
- package/dist/src/LoadingAnimation/LoadingAnimation.story.js +5 -22
- package/dist/src/MaybeTooltip/MaybeTooltip.d.ts +1 -2
- package/dist/src/MaybeTooltip/MaybeTooltip.js +3 -3
- package/dist/src/MaybeTooltip/MaybeTooltip.story.d.ts +1 -2
- package/dist/src/MaybeTooltip/MaybeTooltip.story.js +4 -5
- package/dist/src/MiniTooltip/index.d.ts +2 -2
- package/dist/src/MiniTooltip/index.js +3 -7
- package/dist/src/Modal/Modal.js +5 -10
- package/dist/src/Modal/Modal.story.js +10 -40
- package/dist/src/NDSProvider/ComponentVariantContext.d.ts +1 -1
- package/dist/src/NDSProvider/ComponentVariantContext.js +3 -2
- package/dist/src/NDSProvider/FeatureFlagsContext.d.ts +1 -1
- package/dist/src/NDSProvider/FeatureFlagsContext.js +3 -2
- package/dist/src/NDSProvider/GlobalStylesComposer.d.ts +1 -1
- package/dist/src/NDSProvider/GlobalStylesComposer.js +3 -6
- package/dist/src/NDSProvider/LocaleContext.d.ts +1 -1
- package/dist/src/NDSProvider/LocaleContext.js +2 -1
- package/dist/src/NDSProvider/NDSProvider.d.ts +1 -1
- package/dist/src/NDSProvider/NDSProvider.js +3 -7
- package/dist/src/NDSProvider/renderWithNDSProvider.spec-utils.js +2 -2
- package/dist/src/NavBarSearch/NavBarSearch.d.ts +1 -1
- package/dist/src/NavBarSearch/NavBarSearch.js +2 -5
- package/dist/src/Navigation/Navigation.d.ts +1 -1
- package/dist/src/Navigation/Navigation.js +2 -2
- package/dist/src/Navigation/components/AppSwitcher/NulogyAppSwitcher.d.ts +1 -1
- package/dist/src/Navigation/components/AppSwitcher/NulogyAppSwitcher.js +3 -12
- package/dist/src/Navigation/components/AppSwitcher/parts/Item.js +2 -1
- package/dist/src/Navigation/components/AppSwitcher/parts/Link.js +2 -2
- package/dist/src/Navigation/components/DesktopNav/DesktopNav.d.ts +1 -2
- package/dist/src/Navigation/components/DesktopNav/DesktopNav.js +3 -30
- package/dist/src/Navigation/components/DesktopNav/parts/MoreMenuItem.d.ts +1 -1
- package/dist/src/Navigation/components/DesktopNav/parts/MoreMenuItem.js +2 -2
- package/dist/src/Navigation/components/EnvironmentBanner/EnvironmentBanner.d.ts +1 -1
- package/dist/src/Navigation/components/EnvironmentBanner/EnvironmentBanner.js +2 -3
- package/dist/src/Navigation/components/MenuSubItem/MenuSubItem.d.ts +1 -2
- package/dist/src/Navigation/components/MenuSubItem/MenuSubItem.js +5 -13
- package/dist/src/Navigation/components/MobileNav/MobileNav.d.ts +1 -2
- package/dist/src/Navigation/components/MobileNav/MobileNav.js +2 -29
- package/dist/src/Navigation/components/MobileNav/parts/MobileMenuItem.js +11 -27
- package/dist/src/Navigation/components/NulogyLogo/NulogyLogo.d.ts +1 -2
- package/dist/src/Navigation/components/NulogyLogo/NulogyLogo.js +8 -10
- package/dist/src/Navigation/components/NulogyLogo/SvgNulogyLogo.d.ts +2 -2
- package/dist/src/Navigation/components/NulogyLogo/SvgNulogyLogo.js +2 -9
- package/dist/src/Navigation/components/UserMenu/UserMenu.d.ts +1 -1
- package/dist/src/Navigation/components/UserMenu/parts/Header.d.ts +1 -2
- package/dist/src/Navigation/components/UserMenu/parts/Header.js +2 -6
- package/dist/src/Navigation/components/UserMenu/parts/Item.js +5 -7
- package/dist/src/Navigation/components/UserMenu/parts/MobileItem.js +6 -10
- package/dist/src/Navigation/components/shared/NavigationLogo.d.ts +1 -1
- package/dist/src/Navigation/components/shared/NavigationLogo.js +2 -2
- package/dist/src/Navigation/components/shared/NavigationLogoLink.d.ts +1 -2
- package/dist/src/Navigation/components/shared/NavigationLogoLink.js +2 -2
- package/dist/src/Navigation/components/shared/NavigationMenuItem.js +9 -18
- package/dist/src/Navigation/stories/Navigation.appSwitcher.story.d.ts +4 -5
- package/dist/src/Navigation/stories/Navigation.appSwitcher.story.js +10 -30
- package/dist/src/Navigation/stories/Navigation.logos.story.d.ts +9 -10
- package/dist/src/Navigation/stories/Navigation.logos.story.js +11 -70
- package/dist/src/Navigation/stories/Navigation.mobileVisibility.story.d.ts +5 -6
- package/dist/src/Navigation/stories/Navigation.mobileVisibility.story.js +12 -38
- package/dist/src/Navigation/stories/Navigation.navigationMenus.story.d.ts +5 -6
- package/dist/src/Navigation/stories/Navigation.navigationMenus.story.js +17 -70
- package/dist/src/Navigation/stories/Navigation.navigationMenus.subMenus.story.d.ts +3 -4
- package/dist/src/Navigation/stories/Navigation.navigationMenus.subMenus.story.js +4 -4
- package/dist/src/Navigation/stories/Navigation.story.d.ts +3 -4
- package/dist/src/Navigation/stories/Navigation.story.js +16 -36
- package/dist/src/Navigation/stories/Navigation.userMenu.story.d.ts +5 -6
- package/dist/src/Navigation/stories/Navigation.userMenu.story.js +40 -71
- package/dist/src/Navigation/stories/fixtures/logos/CustomLogo2.d.ts +2 -2
- package/dist/src/Navigation/stories/fixtures/logos/CustomLogo2.js +2 -13
- package/dist/src/Navigation/stories/fixtures/logos/CustomLogo3.d.ts +2 -2
- package/dist/src/Navigation/stories/fixtures/logos/CustomLogo3.js +2 -29
- package/dist/src/Navigation/stories/fixtures/logos/Customlogo1.d.ts +2 -2
- package/dist/src/Navigation/stories/fixtures/logos/Customlogo1.js +2 -3
- package/dist/src/Overlay/Overlay.story.d.ts +2 -3
- package/dist/src/Overlay/Overlay.story.js +3 -9
- package/dist/src/Pagination/NextButton.d.ts +1 -1
- package/dist/src/Pagination/NextButton.js +2 -4
- package/dist/src/Pagination/Pagination.d.ts +2 -2
- package/dist/src/Pagination/Pagination.js +23 -26
- package/dist/src/Pagination/Pagination.story.d.ts +6 -7
- package/dist/src/Pagination/Pagination.story.js +12 -44
- package/dist/src/Pagination/PaginationCount.d.ts +1 -2
- package/dist/src/Pagination/PaginationCount.js +2 -2
- package/dist/src/Pagination/PreviousButton.d.ts +1 -1
- package/dist/src/Pagination/PreviousButton.js +2 -4
- package/dist/src/Popper/Popper.js +25 -26
- package/dist/src/Radio/Radio.js +3 -9
- package/dist/src/Radio/Radio.story.js +8 -16
- package/dist/src/Radio/RadioGroup.d.ts +1 -1
- package/dist/src/Radio/RadioGroup.js +3 -8
- package/dist/src/Radio/RadioGroup.story.d.ts +6 -7
- package/dist/src/Radio/RadioGroup.story.js +7 -28
- package/dist/src/RangeContainer/RangeContainer.d.ts +1 -1
- package/dist/src/RangeContainer/RangeContainer.js +2 -9
- package/dist/src/RangeContainer/RangeContainer.story.d.ts +1 -2
- package/dist/src/RangeContainer/RangeContainer.story.js +2 -2
- package/dist/src/Select/MenuList.d.ts +1 -2
- package/dist/src/Select/MenuList.js +10 -10
- package/dist/src/Select/Select.js +18 -20
- package/dist/src/Select/Select.story.d.ts +24 -24
- package/dist/src/Select/Select.story.fixture.d.ts +2 -3
- package/dist/src/Select/Select.story.fixture.js +4 -8
- package/dist/src/Select/Select.story.js +29 -52
- package/dist/src/Select/SelectComponents.d.ts +7 -8
- package/dist/src/Select/SelectComponents.js +8 -15
- package/dist/src/Select/SelectOption.d.ts +1 -1
- package/dist/src/Select/SelectOption.js +2 -3
- package/dist/src/SortingTable/SortingTable.d.ts +1 -2
- package/dist/src/SortingTable/SortingTable.js +4 -3
- package/dist/src/SortingTable/SortingTable.story.d.ts +1 -2
- package/dist/src/SortingTable/SortingTable.story.js +2 -2
- package/dist/src/StatusIndicator/StatusIndicator.story.d.ts +10 -11
- package/dist/src/StatusIndicator/StatusIndicator.story.js +11 -51
- package/dist/src/Summary/Summary.js +2 -3
- package/dist/src/Summary/Summary.story.d.ts +2 -3
- package/dist/src/Summary/Summary.story.js +3 -11
- package/dist/src/Summary/SummaryContext.js +4 -3
- package/dist/src/Summary/SummaryDivider.d.ts +1 -2
- package/dist/src/Summary/SummaryDivider.js +2 -2
- package/dist/src/Summary/SummaryItem.js +2 -4
- package/dist/src/Switcher/Switch.js +2 -1
- package/dist/src/Switcher/Switcher.js +2 -2
- package/dist/src/Switcher/Switcher.story.d.ts +3 -4
- package/dist/src/Switcher/Switcher.story.js +5 -17
- package/dist/src/Table/BaseTable.d.ts +2 -2
- package/dist/src/Table/BaseTable.js +2 -5
- package/dist/src/Table/SortingColumnHeader.d.ts +1 -1
- package/dist/src/Table/SortingColumnHeader.js +2 -4
- package/dist/src/Table/StatefulTable.d.ts +1 -1
- package/dist/src/Table/StatefulTable.js +3 -4
- package/dist/src/Table/Table.d.ts +1 -2
- package/dist/src/Table/Table.js +2 -2
- package/dist/src/Table/TableBody.d.ts +2 -2
- package/dist/src/Table/TableBody.js +8 -13
- package/dist/src/Table/TableCell.d.ts +1 -1
- package/dist/src/Table/TableCell.js +3 -3
- package/dist/src/Table/TableFoot.d.ts +1 -2
- package/dist/src/Table/TableFoot.js +8 -8
- package/dist/src/Table/TableHead.d.ts +1 -2
- package/dist/src/Table/TableHead.js +3 -4
- package/dist/src/Table/addExpandableControl.js +3 -3
- package/dist/src/Table/addSelectableControl.js +4 -4
- package/dist/src/Table/stories/BaseTable.story.d.ts +7 -8
- package/dist/src/Table/stories/BaseTable.story.js +15 -24
- package/dist/src/Table/stories/CustomContent.story.d.ts +2 -3
- package/dist/src/Table/stories/CustomContent.story.js +89 -116
- package/dist/src/Table/stories/Density.story.d.ts +2 -3
- package/dist/src/Table/stories/Density.story.js +3 -3
- package/dist/src/Table/stories/Table.story.js +6 -13
- package/dist/src/Table/stories/TableWithCustomSorting.story.d.ts +1 -2
- package/dist/src/Table/stories/TableWithCustomSorting.story.js +5 -4
- package/dist/src/Table/stories/TableWithExpandableRows.story.d.ts +2 -3
- package/dist/src/Table/stories/TableWithExpandableRows.story.js +4 -5
- package/dist/src/Table/stories/TableWithFiltering.story.d.ts +2 -3
- package/dist/src/Table/stories/TableWithFiltering.story.js +7 -6
- package/dist/src/Table/stories/TableWithSelectableRows.story.d.ts +2 -3
- package/dist/src/Table/stories/TableWithSelectableRows.story.js +3 -3
- package/dist/src/Table/stories/TableWithServerSidePagination.story.d.ts +1 -2
- package/dist/src/Table/stories/TableWithServerSidePagination.story.js +3 -4
- package/dist/src/Tabs/Tab.js +2 -1
- package/dist/src/Tabs/TabScrollIndicator.js +2 -3
- package/dist/src/Tabs/TabScrollIndicators.d.ts +1 -1
- package/dist/src/Tabs/TabScrollIndicators.js +5 -8
- package/dist/src/Tabs/Tabs.d.ts +2 -2
- package/dist/src/Tabs/Tabs.js +3 -6
- package/dist/src/Tabs/Tabs.story.d.ts +9 -10
- package/dist/src/Tabs/Tabs.story.js +11 -60
- package/dist/src/Textarea/Textarea.js +3 -5
- package/dist/src/Textarea/Textarea.story.d.ts +9 -10
- package/dist/src/Textarea/Textarea.story.js +11 -12
- package/dist/src/TimePicker/TimePicker.js +10 -14
- package/dist/src/TimePicker/TimePicker.story.d.ts +10 -11
- package/dist/src/TimePicker/TimePicker.story.js +13 -14
- package/dist/src/TimeRange/TimeRange.js +5 -4
- package/dist/src/TimeRange/TimeRange.story.d.ts +5 -6
- package/dist/src/TimeRange/TimeRange.story.js +7 -9
- package/dist/src/Toast/Toast.d.ts +1 -2
- package/dist/src/Toast/Toast.js +3 -3
- package/dist/src/Toast/Toast.story.d.ts +7 -8
- package/dist/src/Toast/Toast.story.js +18 -39
- package/dist/src/ToastContainer/ToastContainer.d.ts +1 -2
- package/dist/src/ToastContainer/ToastContainer.js +3 -2
- package/dist/src/ToastContainer/ToastContainer.story.d.ts +1 -2
- package/dist/src/ToastContainer/ToastContainer.story.js +26 -51
- package/dist/src/ToastContainer/ToastFunction.js +6 -7
- package/dist/src/Toggle/Toggle.js +2 -5
- package/dist/src/Toggle/Toggle.story.d.ts +8 -9
- package/dist/src/Toggle/Toggle.story.js +10 -14
- package/dist/src/Toggle/ToggleButton.js +5 -6
- package/dist/src/Tokens/Tokens.story.d.ts +9 -10
- package/dist/src/Tokens/Tokens.story.js +13 -46
- package/dist/src/Tooltip/Tooltip.d.ts +1 -1
- package/dist/src/Tooltip/Tooltip.js +2 -6
- package/dist/src/Tooltip/Tooltip.story.js +14 -89
- package/dist/src/Tooltip/components/TooltipComponents.d.ts +1 -1
- package/dist/src/Tooltip/components/TooltipComponents.js +5 -7
- package/dist/src/TopBar/TopBar.d.ts +1 -1
- package/dist/src/TopBar/TopBar.js +2 -4
- package/dist/src/TopBar/components/BackLink.d.ts +2 -2
- package/dist/src/TopBar/components/BackLink.js +2 -5
- package/dist/src/TopBar/components/Menu.d.ts +1 -1
- package/dist/src/TopBar/components/Menu.js +6 -10
- package/dist/src/TopBar/components/MenuItem.d.ts +1 -1
- package/dist/src/TopBar/components/MenuItem.js +2 -2
- package/dist/src/TopBar/components/MenuItemLink.d.ts +2 -2
- package/dist/src/TopBar/components/MenuItemLink.js +2 -6
- package/dist/src/TopBar/components/PageTitle.d.ts +2 -2
- package/dist/src/TopBar/components/PageTitle.js +2 -2
- package/dist/src/TopBar/stories/TopBar.backButton.story.d.ts +3 -4
- package/dist/src/TopBar/stories/TopBar.backButton.story.js +9 -21
- package/dist/src/TopBar/stories/TopBar.menu.story.d.ts +5 -6
- package/dist/src/TopBar/stories/TopBar.menu.story.js +6 -27
- package/dist/src/TopBar/stories/TopBar.story.d.ts +3 -4
- package/dist/src/TopBar/stories/TopBar.story.js +4 -38
- package/dist/src/TruncatedText/TruncatedText.d.ts +1 -2
- package/dist/src/TruncatedText/TruncatedText.js +3 -3
- package/dist/src/TruncatedText/TruncatedText.story.d.ts +9 -10
- package/dist/src/TruncatedText/TruncatedText.story.js +10 -17
- package/dist/src/TruncatedText/components/TruncatedTextFillWidth.d.ts +1 -2
- package/dist/src/TruncatedText/components/TruncatedTextFillWidth.js +3 -3
- package/dist/src/TruncatedText/components/TruncatedTextMaxCharacters.d.ts +1 -2
- package/dist/src/TruncatedText/components/TruncatedTextMaxCharacters.js +2 -3
- package/dist/src/Type/Headings.d.ts +8 -8
- package/dist/src/Type/Headings.story.d.ts +3 -4
- package/dist/src/Type/Headings.story.js +4 -12
- package/dist/src/Type/Text.story.d.ts +6 -7
- package/dist/src/Type/Text.story.js +7 -24
- package/dist/src/Type/Typography.story.d.ts +2 -3
- package/dist/src/Type/Typography.story.js +3 -204
- package/dist/src/Validation/InlineValidation.d.ts +1 -1
- package/dist/src/Validation/InlineValidation.js +2 -7
- package/dist/src/Validation/InlineValidation.story.d.ts +4 -5
- package/dist/src/Validation/InlineValidation.story.js +5 -10
- package/dist/src/Validation/mapErrorsToList.d.ts +1 -2
- package/dist/src/Validation/mapErrorsToList.js +2 -2
- package/dist/src/VerticalDivider/VerticalDivider.story.d.ts +2 -2
- package/dist/src/VerticalDivider/VerticalDivider.story.js +3 -9
- package/dist/src/VisualTests/Select.story.d.ts +6 -7
- package/dist/src/VisualTests/Select.story.js +7 -15
- package/dist/src/VisualTests/WithSpace.story.d.ts +18 -19
- package/dist/src/VisualTests/WithSpace.story.js +19 -39
- package/dist/src/i18n.js +4 -0
- package/dist/src/locale.story.d.ts +1 -2
- package/dist/src/locale.story.js +8 -7
- package/dist/src/locales.const.d.ts +5 -0
- package/dist/src/locales.const.js +7 -1
- package/dist/src/pages/ErrorPage.story.d.ts +4 -5
- package/dist/src/pages/ErrorPage.story.js +5 -31
- package/dist/src/pages/LoginPage.story.d.ts +5 -6
- package/dist/src/pages/LoginPage.story.js +6 -55
- package/dist/src/theme/NDSThemeProvider.d.ts +1 -2
- package/dist/src/theme/NDSThemeProvider.js +2 -3
- package/dist/src/utils/DetectOutsideClick.d.ts +1 -1
- package/dist/src/utils/DetectOutsideClick.js +2 -1
- package/dist/src/utils/ScrollIndicators.d.ts +1 -1
- package/dist/src/utils/ScrollIndicators.js +7 -13
- package/dist/src/utils/story/placeholder.d.ts +1 -2
- package/dist/src/utils/story/placeholder.js +2 -7
- package/dist/src/utils/story/resizable.d.ts +1 -1
- package/dist/src/utils/story/resizable.js +5 -8
- package/dist/src/utils/ts/FocusManager.js +7 -6
- package/dist/src/utils/useWindowDimension.story.d.ts +1 -2
- package/dist/src/utils/useWindowDimension.story.js +2 -14
- package/dist/src/utils/withMenuState.js +2 -1
- package/dist/vite.config.js +2 -0
- package/package.json +22 -24
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from "react";
|
|
2
3
|
import { action } from "@storybook/addon-actions";
|
|
3
4
|
import { Button, PrimaryButton } from "..";
|
|
4
5
|
import TimeRange from "./TimeRange";
|
|
5
6
|
export default {
|
|
6
7
|
title: "Components/TimeRange",
|
|
7
8
|
};
|
|
8
|
-
export const Default = () => (
|
|
9
|
+
export const Default = () => (_jsx(TimeRange, { p: "x3", onRangeChange: action("range changed"), onStartTimeChange: action("start date changed"), onEndTimeChange: action("end date changed") }));
|
|
9
10
|
Default.story = {
|
|
10
11
|
name: "default",
|
|
11
12
|
};
|
|
12
|
-
export const DefaultSelections = () => (
|
|
13
|
+
export const DefaultSelections = () => (_jsx(TimeRange, { onRangeChange: action("range changed"), defaultStartTime: "12:00 AM", defaultEndTime: "01:30 PM", onStartTimeChange: action("start date changed"), onEndTimeChange: action("end date changed") }));
|
|
13
14
|
DefaultSelections.story = {
|
|
14
15
|
name: "default selections",
|
|
15
16
|
};
|
|
16
|
-
export const WithRangeValidation = () => (
|
|
17
|
+
export const WithRangeValidation = () => (_jsx(TimeRange, { onRangeChange: action("range changed"), defaultStartTime: "12:00 AM", defaultEndTime: "03:30 AM", onStartTimeChange: action("start date changed"), onEndTimeChange: action("end date changed") }));
|
|
17
18
|
WithRangeValidation.story = {
|
|
18
19
|
name: "with range validation",
|
|
19
20
|
};
|
|
20
|
-
export const WithMinAndMaxTimeRange = () => (
|
|
21
|
+
export const WithMinAndMaxTimeRange = () => (_jsx(TimeRange, { onRangeChange: action("range changed"), minTime: "09:00", maxTime: "18:30", onStartTimeChange: action("start date changed"), onEndTimeChange: action("end date changed") }));
|
|
21
22
|
WithMinAndMaxTimeRange.story = {
|
|
22
23
|
name: "with min and max time range",
|
|
23
24
|
};
|
|
@@ -29,10 +30,7 @@ export const UsingRefToControlFocus = () => {
|
|
|
29
30
|
const handleClick2 = () => {
|
|
30
31
|
ref.current.inputRef2.focus();
|
|
31
32
|
};
|
|
32
|
-
return (
|
|
33
|
-
React.createElement(TimeRange, { onRangeChange: action("range changed"), onStartTimeChange: action("start date changed"), onEndTimeChange: action("end date changed"), ref: ref }),
|
|
34
|
-
React.createElement(Button, { onClick: handleClick, ml: "x2" }, "Focus the First Input"),
|
|
35
|
-
React.createElement(PrimaryButton, { onClick: handleClick2, ml: "x2" }, "Focus the Second Input")));
|
|
33
|
+
return (_jsxs(_Fragment, { children: [_jsx(TimeRange, { onRangeChange: action("range changed"), onStartTimeChange: action("start date changed"), onEndTimeChange: action("end date changed"), ref: ref }), _jsx(Button, { onClick: handleClick, ml: "x2", children: "Focus the First Input" }), _jsx(PrimaryButton, { onClick: handleClick2, ml: "x2", children: "Focus the Second Input" })] }));
|
|
36
34
|
};
|
|
37
35
|
UsingRefToControlFocus.story = {
|
|
38
36
|
name: "using ref to control focus",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { AlertProps } from "../Alert/Alert";
|
|
3
2
|
type ToastProps = AlertProps & {
|
|
4
3
|
triggered?: boolean;
|
|
@@ -32,5 +31,5 @@ export declare const toastAnimationConfig: {
|
|
|
32
31
|
};
|
|
33
32
|
};
|
|
34
33
|
};
|
|
35
|
-
export declare const Toast: ({ triggered, isCloseable, showDuration, onHide, onShow, children, onHidden, zIndex, ...props }: ToastProps) =>
|
|
34
|
+
export declare const Toast: ({ triggered, isCloseable, showDuration, onHide, onShow, children, onHidden, zIndex, ...props }: ToastProps) => import("react/jsx-runtime").JSX.Element;
|
|
36
35
|
export default Toast;
|
package/dist/src/Toast/Toast.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
2
3
|
import { AnimatePresence } from "framer-motion";
|
|
3
4
|
import Alert from "../Alert/Alert";
|
|
4
5
|
import { AnimatedBox } from "../Box";
|
|
@@ -73,7 +74,6 @@ export const Toast = ({ triggered = false, isCloseable = false, showDuration = T
|
|
|
73
74
|
const handleCloseButtonClick = () => {
|
|
74
75
|
hideToast(0);
|
|
75
76
|
};
|
|
76
|
-
return (
|
|
77
|
-
React.createElement(Alert, { minWidth: "200px", maxWidth: "600px", isCloseable: isCloseable, onClose: handleCloseButtonClick, controlled: true, ...props }, children)))));
|
|
77
|
+
return (_jsx(AnimatePresence, { initial: false, children: visible && (_jsx(AnimatedBox, { onMouseEnter: onMouseIn, onFocus: onMouseIn, onMouseLeave: onMouseOut, onBlur: onMouseOut, position: "fixed", bottom: "0", left: "0", right: "0", marginLeft: "auto", marginRight: "auto", width: "fit-content", zIndex: zIndex, boxShadow: "medium", layout: true, ...toastAnimationConfig, children: _jsx(Alert, { minWidth: "200px", maxWidth: "600px", isCloseable: isCloseable, onClose: handleCloseButtonClick, controlled: true, ...props, children: children }) })) }));
|
|
78
78
|
};
|
|
79
79
|
export default Toast;
|
|
@@ -1,41 +1,40 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
declare const _default: {
|
|
3
2
|
title: string;
|
|
4
3
|
};
|
|
5
4
|
export default _default;
|
|
6
|
-
export declare const _Toast: () =>
|
|
5
|
+
export declare const _Toast: () => import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
export declare const _MultipleToastsExample: {
|
|
8
|
-
():
|
|
7
|
+
(): import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
story: {
|
|
10
9
|
name: string;
|
|
11
10
|
};
|
|
12
11
|
};
|
|
13
12
|
export declare const CustomizeLengthOfTimeToastIsVisible: {
|
|
14
|
-
():
|
|
13
|
+
(): import("react/jsx-runtime").JSX.Element;
|
|
15
14
|
story: {
|
|
16
15
|
name: string;
|
|
17
16
|
};
|
|
18
17
|
};
|
|
19
18
|
export declare const WithCloseButton: {
|
|
20
|
-
():
|
|
19
|
+
(): import("react/jsx-runtime").JSX.Element;
|
|
21
20
|
story: {
|
|
22
21
|
name: string;
|
|
23
22
|
};
|
|
24
23
|
};
|
|
25
24
|
export declare const WithModal: {
|
|
26
|
-
():
|
|
25
|
+
(): import("react/jsx-runtime").JSX.Element;
|
|
27
26
|
story: {
|
|
28
27
|
name: string;
|
|
29
28
|
};
|
|
30
29
|
};
|
|
31
30
|
export declare const CloseableWithMultiLineMessage: {
|
|
32
|
-
():
|
|
31
|
+
(): import("react/jsx-runtime").JSX.Element;
|
|
33
32
|
story: {
|
|
34
33
|
name: string;
|
|
35
34
|
};
|
|
36
35
|
};
|
|
37
36
|
export declare const MultipleCloseableToastsExample: {
|
|
38
|
-
():
|
|
37
|
+
(): import("react/jsx-runtime").JSX.Element;
|
|
39
38
|
story: {
|
|
40
39
|
name: string;
|
|
41
40
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
2
3
|
import { Button, DangerButton, IconicButton, Modal, PrimaryButton, Flex, Toast } from "../index";
|
|
3
4
|
export default {
|
|
4
5
|
title: "Components/Toast",
|
|
@@ -12,11 +13,9 @@ export const _Toast = () => {
|
|
|
12
13
|
const onHideHandler = () => {
|
|
13
14
|
setTriggered(false);
|
|
14
15
|
};
|
|
15
|
-
return (
|
|
16
|
-
React.createElement(Button, { onClick: triggerToast }, "Save Changes"),
|
|
17
|
-
React.createElement(Toast, { triggered: triggered, onHide: onHideHandler }, "Saved")));
|
|
16
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { onClick: triggerToast, children: "Save Changes" }), _jsx(Toast, { triggered: triggered, onHide: onHideHandler, children: "Saved" })] }));
|
|
18
17
|
};
|
|
19
|
-
return
|
|
18
|
+
return _jsx(ToastWithTrigger, {});
|
|
20
19
|
};
|
|
21
20
|
export const _MultipleToastsExample = () => {
|
|
22
21
|
const MultipleToastsExample = () => {
|
|
@@ -68,17 +67,11 @@ export const _MultipleToastsExample = () => {
|
|
|
68
67
|
type: "danger",
|
|
69
68
|
},
|
|
70
69
|
];
|
|
71
|
-
return (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
React.createElement(Button, { onClick: () => triggerToast(TOAST_ACTIONS.RESET), mr: "x2" }, "Reset"),
|
|
75
|
-
React.createElement(DangerButton, { onClick: () => triggerToast(TOAST_ACTIONS.ERROR), mr: "x2" }, "Trigger Error"),
|
|
76
|
-
React.createElement(IconicButton, { icon: "delete", onClick: () => triggerToast(TOAST_ACTIONS.DELETE) }, "Delete")),
|
|
77
|
-
TOASTS.map((toast) => {
|
|
78
|
-
return (React.createElement(Toast, { triggered: currentToast === toast.action, onHide: () => onHideHandler(toast.action), type: toast.type, key: toast.action }, toast.message));
|
|
79
|
-
})));
|
|
70
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Flex, { alignItems: "center", children: [_jsx(PrimaryButton, { onClick: () => triggerToast(TOAST_ACTIONS.SAVE), mr: "x2", children: "Save Changes" }), _jsx(Button, { onClick: () => triggerToast(TOAST_ACTIONS.RESET), mr: "x2", children: "Reset" }), _jsx(DangerButton, { onClick: () => triggerToast(TOAST_ACTIONS.ERROR), mr: "x2", children: "Trigger Error" }), _jsx(IconicButton, { icon: "delete", onClick: () => triggerToast(TOAST_ACTIONS.DELETE), children: "Delete" })] }), TOASTS.map((toast) => {
|
|
71
|
+
return (_jsx(Toast, { triggered: currentToast === toast.action, onHide: () => onHideHandler(toast.action), type: toast.type, children: toast.message }, toast.action));
|
|
72
|
+
})] }));
|
|
80
73
|
};
|
|
81
|
-
return
|
|
74
|
+
return _jsx(MultipleToastsExample, {});
|
|
82
75
|
};
|
|
83
76
|
_MultipleToastsExample.story = {
|
|
84
77
|
name: "multiple toasts example",
|
|
@@ -92,11 +85,9 @@ export const CustomizeLengthOfTimeToastIsVisible = () => {
|
|
|
92
85
|
const onHideHandler = () => {
|
|
93
86
|
setTriggered(false);
|
|
94
87
|
};
|
|
95
|
-
return (
|
|
96
|
-
React.createElement(Button, { onClick: triggerToast }, "Save Changes"),
|
|
97
|
-
React.createElement(Toast, { triggered: triggered, onHide: onHideHandler, showDuration: 5000 }, "Saved")));
|
|
88
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { onClick: triggerToast, children: "Save Changes" }), _jsx(Toast, { triggered: triggered, onHide: onHideHandler, showDuration: 5000, children: "Saved" })] }));
|
|
98
89
|
};
|
|
99
|
-
return
|
|
90
|
+
return _jsx(ToastWithTrigger, {});
|
|
100
91
|
};
|
|
101
92
|
CustomizeLengthOfTimeToastIsVisible.story = {
|
|
102
93
|
name: "customize length of time toast is visible",
|
|
@@ -110,18 +101,14 @@ export const WithCloseButton = () => {
|
|
|
110
101
|
const onHideHandler = () => {
|
|
111
102
|
setTriggered(false);
|
|
112
103
|
};
|
|
113
|
-
return (
|
|
114
|
-
React.createElement(Button, { onClick: triggerToast }, "Save Changes"),
|
|
115
|
-
React.createElement(Toast, { triggered: triggered, onHide: onHideHandler, isCloseable: true }, "An error occurred while saving results. Please try again")));
|
|
104
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { onClick: triggerToast, children: "Save Changes" }), _jsx(Toast, { triggered: triggered, onHide: onHideHandler, isCloseable: true, children: "An error occurred while saving results. Please try again" })] }));
|
|
116
105
|
};
|
|
117
|
-
return
|
|
106
|
+
return _jsx(ToastWithTrigger, {});
|
|
118
107
|
};
|
|
119
108
|
WithCloseButton.story = {
|
|
120
109
|
name: "with close button",
|
|
121
110
|
};
|
|
122
|
-
export const WithModal = () => (
|
|
123
|
-
React.createElement(Toast, { triggered: true, type: "danger", isCloseable: true, zIndex: 1001 }, "Something went wrong. Try again."),
|
|
124
|
-
React.createElement(Modal, { title: "Modal Title", onRequestClose: () => { }, maxWidth: "456px" }, "Modal Body")));
|
|
111
|
+
export const WithModal = () => (_jsxs(_Fragment, { children: [_jsx(Toast, { triggered: true, type: "danger", isCloseable: true, zIndex: 1001, children: "Something went wrong. Try again." }), _jsx(Modal, { title: "Modal Title", onRequestClose: () => { }, maxWidth: "456px", children: "Modal Body" })] }));
|
|
125
112
|
WithModal.story = {
|
|
126
113
|
name: "with a modal",
|
|
127
114
|
};
|
|
@@ -133,9 +120,7 @@ export const CloseableWithMultiLineMessage = () => {
|
|
|
133
120
|
const onHideHandler = () => {
|
|
134
121
|
setTriggered(false);
|
|
135
122
|
};
|
|
136
|
-
return (
|
|
137
|
-
React.createElement(Button, { onClick: triggerToast }, "Save Changes"),
|
|
138
|
-
React.createElement(Toast, { triggered: triggered, onHide: onHideHandler, type: "danger", isCloseable: true }, "Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum quidem eveniet, repellat accusamus error reiciendis libero. Totam autem distinctio vo")));
|
|
123
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { onClick: triggerToast, children: "Save Changes" }), _jsx(Toast, { triggered: triggered, onHide: onHideHandler, type: "danger", isCloseable: true, children: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum quidem eveniet, repellat accusamus error reiciendis libero. Totam autem distinctio vo" })] }));
|
|
139
124
|
};
|
|
140
125
|
CloseableWithMultiLineMessage.story = {
|
|
141
126
|
name: "closeable with a 150 character long multi-line message",
|
|
@@ -173,17 +158,11 @@ export const MultipleCloseableToastsExample = () => {
|
|
|
173
158
|
message: "An error occurred, please retry",
|
|
174
159
|
},
|
|
175
160
|
];
|
|
176
|
-
return (
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
React.createElement(Button, { onClick: () => triggerToast(TOAST_ACTIONS.RESET), mr: "x2" }, "Reset"),
|
|
180
|
-
React.createElement(DangerButton, { onClick: () => triggerToast(TOAST_ACTIONS.ERROR), mr: "x2" }, "Trigger Error"),
|
|
181
|
-
React.createElement(IconicButton, { icon: "delete", onClick: () => triggerToast(TOAST_ACTIONS.DELETE) }, "Delete")),
|
|
182
|
-
TOASTS.map((toast) => {
|
|
183
|
-
return (React.createElement(Toast, { triggered: currentToasts.includes(toast.action), onHide: () => onHideHandler(toast.action), type: "danger", key: toast.action, isCloseable: true }, toast.message));
|
|
184
|
-
})));
|
|
161
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Flex, { alignItems: "center", children: [_jsx(PrimaryButton, { onClick: () => triggerToast(TOAST_ACTIONS.SAVE), mr: "x2", children: "Save Changes" }), _jsx(Button, { onClick: () => triggerToast(TOAST_ACTIONS.RESET), mr: "x2", children: "Reset" }), _jsx(DangerButton, { onClick: () => triggerToast(TOAST_ACTIONS.ERROR), mr: "x2", children: "Trigger Error" }), _jsx(IconicButton, { icon: "delete", onClick: () => triggerToast(TOAST_ACTIONS.DELETE), children: "Delete" })] }), TOASTS.map((toast) => {
|
|
162
|
+
return (_jsx(Toast, { triggered: currentToasts.includes(toast.action), onHide: () => onHideHandler(toast.action), type: "danger", isCloseable: true, children: toast.message }, toast.action));
|
|
163
|
+
})] }));
|
|
185
164
|
};
|
|
186
|
-
return
|
|
165
|
+
return _jsx(MultipleToastsExample, {});
|
|
187
166
|
};
|
|
188
167
|
MultipleCloseableToastsExample.story = {
|
|
189
168
|
name: "multiple closeable toasts example",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { ToasterProps } from "react-hot-toast";
|
|
3
2
|
import { ToastOptions } from "./ToastFunction";
|
|
4
3
|
type ToastContainerProps = {
|
|
@@ -6,5 +5,5 @@ type ToastContainerProps = {
|
|
|
6
5
|
maxVisibleToasts?: number;
|
|
7
6
|
toastOptions?: ToastOptions;
|
|
8
7
|
} & Omit<ToasterProps, "gutter" | "toastOptions">;
|
|
9
|
-
declare const ToastContainer: ({ gap, position, reverseOrder, containerClassName, toastOptions, maxVisibleToasts, ...props }: ToastContainerProps) =>
|
|
8
|
+
declare const ToastContainer: ({ gap, position, reverseOrder, containerClassName, toastOptions, maxVisibleToasts, ...props }: ToastContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
9
|
export default ToastContainer;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from "react";
|
|
2
3
|
import { toast as _toast, Toaster, useToasterStore } from "react-hot-toast";
|
|
3
4
|
import { useTheme } from "styled-components";
|
|
4
5
|
import { TOAST_SHOW_DURATION } from "../Toast/Toast";
|
|
@@ -12,7 +13,7 @@ const ToastContainer = ({ gap, position = "bottom-center", reverseOrder = false,
|
|
|
12
13
|
.filter((_, i) => i >= maxVisibleToasts)
|
|
13
14
|
.forEach((t) => _toast.dismiss(t.id));
|
|
14
15
|
}, [toasts, maxVisibleToasts]);
|
|
15
|
-
return (
|
|
16
|
+
return (_jsx(Toaster, { gutter: gap || numberFromDimension(theme.space.x1), toastOptions: {
|
|
16
17
|
custom: { ...toastOptions },
|
|
17
18
|
}, position: position, reverseOrder: reverseOrder, containerClassName: containerClassName, ...props }));
|
|
18
19
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
2
3
|
import { PrimaryButton } from "../Button";
|
|
3
4
|
import { Input } from "../Input";
|
|
4
5
|
import { Flex } from "../Flex";
|
|
@@ -27,56 +28,30 @@ export const WithEverything = () => {
|
|
|
27
28
|
{ value: "warning", label: "Warning" },
|
|
28
29
|
{ value: "danger", label: "Danger" },
|
|
29
30
|
];
|
|
30
|
-
return (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
{ value: "top-center", label: "Top center" },
|
|
55
|
-
{ value: "top-left", label: "Top left" },
|
|
56
|
-
{ value: "top-right", label: "Top right" },
|
|
57
|
-
], labelText: "Position", onChange: (value) => setPosition(value) })),
|
|
58
|
-
React.createElement(Flex, { flexDirection: "column", flexBasis: "100%", gap: "x2" },
|
|
59
|
-
React.createElement(Flex, { flexDirection: "column" },
|
|
60
|
-
React.createElement(Text, { fontWeight: "bold" }, "Trigger toasts from anywhere using the `toast` function"),
|
|
61
|
-
React.createElement("pre", null, `import { toast } from "@nulogy/components"`),
|
|
62
|
-
React.createElement("pre", null, toastFunctionTemplate ?? getToastFunctionTemplate())),
|
|
63
|
-
React.createElement(Flex, { gap: "x2", flexDirection: "column" },
|
|
64
|
-
React.createElement(Select, { defaultValue: type, options: [{ value: "random", label: "Random" }, ...types], labelText: "Type", onChange: (value) => setType(value) }),
|
|
65
|
-
React.createElement(Select, { defaultValue: behavior, options: [
|
|
66
|
-
{ label: "Random", value: "random" },
|
|
67
|
-
{ label: "Dismissible", value: "dismissible" },
|
|
68
|
-
{ label: "Auto-dismissed", value: "auto" },
|
|
69
|
-
], labelText: "Behavior", onChange: (value) => setBehavior(value) }),
|
|
70
|
-
React.createElement(PrimaryButton, { onClick: () => {
|
|
71
|
-
const toastTypeValue = toastType();
|
|
72
|
-
const isClosableValue = isCloseable();
|
|
73
|
-
setToastFunctionTemplate(getToastFunctionTemplate({ isClosable: isClosableValue, toastType: toastTypeValue }));
|
|
74
|
-
toast[toastTypeValue]("This is a toast content", {
|
|
75
|
-
title: `This is a '${toastTypeValue}' type toast title`,
|
|
76
|
-
isCloseable: isClosableValue,
|
|
77
|
-
});
|
|
78
|
-
} }, "Trigger toast"))),
|
|
79
|
-
React.createElement(ToastContainer, { position: position, toastOptions: { duration }, maxVisibleToasts: maxVisibleToasts }))));
|
|
31
|
+
return (_jsxs(_Fragment, { children: [_jsx(Heading1, { children: "Toast container playground" }), _jsxs(Flex, { gap: "x3", flexDirection: "column", maxWidth: "600px", children: [_jsxs(Flex, { flexDirection: "column", flexBasis: "100%", gap: "x2", children: [_jsxs(Flex, { flexDirection: "column", children: [_jsxs(Text, { fontWeight: "bold", children: ["1) Add the ", "<ToastContainer />", " to a top level component in your UI tree. The ", "<ToastContainer />", " ", "should always be mounted when you call the `toast` function bellow"] }), _jsx("pre", { children: `import { ToastContainer } from "@nulogy/components"` }), _jsx("pre", { children: `<ToastContainer position="${position}" maxVisibleToasts={${maxVisibleToasts}} toastOptions={{ duration: ${duration} }} />` })] }), _jsx(Input, { value: duration, labelText: "Show duration in milliseconds", onChange: (event) => {
|
|
32
|
+
setDuration(Number(event.target.value));
|
|
33
|
+
} }), _jsx(Input, { value: maxVisibleToasts, labelText: "Maximum number of visible toasts", onChange: (event) => {
|
|
34
|
+
setMaxVisibleToasts(Number(event.target.value));
|
|
35
|
+
} }), _jsx(Select, { defaultValue: position, options: [
|
|
36
|
+
{ value: "bottom-center", label: "Bottom center" },
|
|
37
|
+
{ value: "bottom-left", label: "Bottom left" },
|
|
38
|
+
{ value: "bottom-right", label: "Bottom right" },
|
|
39
|
+
{ value: "top-center", label: "Top center" },
|
|
40
|
+
{ value: "top-left", label: "Top left" },
|
|
41
|
+
{ value: "top-right", label: "Top right" },
|
|
42
|
+
], labelText: "Position", onChange: (value) => setPosition(value) })] }), _jsxs(Flex, { flexDirection: "column", flexBasis: "100%", gap: "x2", children: [_jsxs(Flex, { flexDirection: "column", children: [_jsx(Text, { fontWeight: "bold", children: "Trigger toasts from anywhere using the `toast` function" }), _jsx("pre", { children: `import { toast } from "@nulogy/components"` }), _jsx("pre", { children: toastFunctionTemplate ?? getToastFunctionTemplate() })] }), _jsxs(Flex, { gap: "x2", flexDirection: "column", children: [_jsx(Select, { defaultValue: type, options: [{ value: "random", label: "Random" }, ...types], labelText: "Type", onChange: (value) => setType(value) }), _jsx(Select, { defaultValue: behavior, options: [
|
|
43
|
+
{ label: "Random", value: "random" },
|
|
44
|
+
{ label: "Dismissible", value: "dismissible" },
|
|
45
|
+
{ label: "Auto-dismissed", value: "auto" },
|
|
46
|
+
], labelText: "Behavior", onChange: (value) => setBehavior(value) }), _jsx(PrimaryButton, { onClick: () => {
|
|
47
|
+
const toastTypeValue = toastType();
|
|
48
|
+
const isClosableValue = isCloseable();
|
|
49
|
+
setToastFunctionTemplate(getToastFunctionTemplate({ isClosable: isClosableValue, toastType: toastTypeValue }));
|
|
50
|
+
toast[toastTypeValue]("This is a toast content", {
|
|
51
|
+
title: `This is a '${toastTypeValue}' type toast title`,
|
|
52
|
+
isCloseable: isClosableValue,
|
|
53
|
+
});
|
|
54
|
+
}, children: "Trigger toast" })] })] }), _jsx(ToastContainer, { position: position, toastOptions: { duration }, maxVisibleToasts: maxVisibleToasts })] })] }));
|
|
80
55
|
};
|
|
81
56
|
export default {
|
|
82
57
|
title: "Components/ToastContainer",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { AnimatePresence } from "framer-motion";
|
|
3
3
|
import { toast as _toast } from "react-hot-toast";
|
|
4
4
|
import { Alert } from "../Alert";
|
|
@@ -8,13 +8,12 @@ const CustomToast = ({ isVisible, id, children, ...props }) => {
|
|
|
8
8
|
const handleClose = () => {
|
|
9
9
|
_toast.dismiss(id);
|
|
10
10
|
};
|
|
11
|
-
return (
|
|
12
|
-
React.createElement(Alert, { controlled: true, onClose: handleClose, ...props }, children)))));
|
|
11
|
+
return (_jsx(AnimatePresence, { children: isVisible && (_jsx(AnimatedBox, { role: "alert", ...toastAnimationConfig, children: _jsx(Alert, { controlled: true, onClose: handleClose, ...props, children: children }) }, "notification")) }));
|
|
13
12
|
};
|
|
14
13
|
const toast = {
|
|
15
|
-
danger: (children, props = {}, options = {}) => _toast.custom((t) => (
|
|
16
|
-
informative: (children, props = {}, options = {}) => _toast.custom((t) => (
|
|
17
|
-
success: (children, props = {}, options = {}) => _toast.custom((t) => (
|
|
18
|
-
warning: (children, props = {}, options = {}) => _toast.custom((t) => (
|
|
14
|
+
danger: (children, props = {}, options = {}) => _toast.custom((t) => (_jsx(CustomToast, { id: t.id, isVisible: t.visible, type: "danger", ...props, children: children })), { duration: props.isCloseable ? Infinity : options.duration, ...options }),
|
|
15
|
+
informative: (children, props = {}, options = {}) => _toast.custom((t) => (_jsx(CustomToast, { id: t.id, isVisible: t.visible, type: "informative", ...props, children: children })), { duration: props.isCloseable ? Infinity : options.duration, ...options }),
|
|
16
|
+
success: (children, props = {}, options = {}) => _toast.custom((t) => (_jsx(CustomToast, { id: t.id, isVisible: t.visible, type: "success", ...props, children: children })), { duration: props.isCloseable ? Infinity : options.duration, ...options }),
|
|
17
|
+
warning: (children, props = {}, options = {}) => _toast.custom((t) => (_jsx(CustomToast, { id: t.id, isVisible: t.visible, type: "warning", ...props, children: children })), { duration: props.isCloseable ? Infinity : options.duration, ...options }),
|
|
19
18
|
};
|
|
20
19
|
export default toast;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
import React, { useCallback, useEffect } from "react";
|
|
2
3
|
import propTypes from "@styled-system/prop-types";
|
|
3
4
|
import { FieldLabel } from "../FieldLabel";
|
|
@@ -36,10 +37,6 @@ const Toggle = React.forwardRef(({ checked, variant, className, labelText, requi
|
|
|
36
37
|
console.warn("onChange or onClick is required when checked is set.");
|
|
37
38
|
}
|
|
38
39
|
}, []);
|
|
39
|
-
return (
|
|
40
|
-
React.createElement(FieldLabel, { htmlFor: id, labelText: labelText, requirementText: requirementText, helpText: helpText, hint: hint, disabled: disabled, variant: componentVariant, "data-testid": dataTestId },
|
|
41
|
-
React.createElement(Flex, { flexDirection: "row", alignItems: "center" },
|
|
42
|
-
React.createElement(ToggleButton, { id: id, checked: _checked, onChange: _onChange, disabled: disabled, required: required, "aria-required": required, "aria-invalid": error, ...restProps, ref: ref }),
|
|
43
|
-
(onText || offText) && (React.createElement(Text, { disabled: disabled, mb: "none", ml: "x1", "aria-hidden": true }, _checked ? onText : offText))))));
|
|
40
|
+
return (_jsx(Field, { className: className, alignItems: "flex-start", py: "half", ...spaceProps, children: _jsx(FieldLabel, { htmlFor: id, labelText: labelText, requirementText: requirementText, helpText: helpText, hint: hint, disabled: disabled, variant: componentVariant, "data-testid": dataTestId, children: _jsxs(Flex, { flexDirection: "row", alignItems: "center", children: [_jsx(ToggleButton, { id: id, checked: _checked, onChange: _onChange, disabled: disabled, required: required, "aria-required": required, "aria-invalid": error, ...restProps, ref: ref }), (onText || offText) && (_jsx(Text, { disabled: disabled, mb: "none", ml: "x1", "aria-hidden": true, children: _checked ? onText : offText }))] }) }) }));
|
|
44
41
|
});
|
|
45
42
|
export default Toggle;
|
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
declare const _default: {
|
|
3
2
|
title: string;
|
|
4
3
|
};
|
|
5
4
|
export default _default;
|
|
6
|
-
export declare const _Toggle: () =>
|
|
5
|
+
export declare const _Toggle: () => import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
export declare const ToggleWithAllProps: {
|
|
8
|
-
():
|
|
7
|
+
(): import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
storyName: string;
|
|
10
9
|
};
|
|
11
10
|
export declare const ToggleSetToDisabled: {
|
|
12
|
-
():
|
|
11
|
+
(): import("react/jsx-runtime").JSX.Element;
|
|
13
12
|
storyName: string;
|
|
14
13
|
};
|
|
15
14
|
export declare const WithCustomId: {
|
|
16
|
-
():
|
|
15
|
+
(): import("react/jsx-runtime").JSX.Element;
|
|
17
16
|
storyName: string;
|
|
18
17
|
};
|
|
19
18
|
export declare const WithText: {
|
|
20
|
-
():
|
|
19
|
+
(): import("react/jsx-runtime").JSX.Element;
|
|
21
20
|
storyName: string;
|
|
22
21
|
};
|
|
23
22
|
export declare const WithLongText: {
|
|
24
|
-
():
|
|
23
|
+
(): import("react/jsx-runtime").JSX.Element;
|
|
25
24
|
storyName: string;
|
|
26
25
|
};
|
|
27
26
|
export declare const WithContraintWidth: {
|
|
28
|
-
():
|
|
27
|
+
(): import("react/jsx-runtime").JSX.Element;
|
|
29
28
|
storyName: string;
|
|
30
29
|
};
|
|
31
30
|
export declare const UsingRefToControlFocus: {
|
|
32
|
-
():
|
|
31
|
+
(): import("react/jsx-runtime").JSX.Element;
|
|
33
32
|
storyName: string;
|
|
34
33
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState } from "react";
|
|
2
3
|
import { action } from "@storybook/addon-actions";
|
|
3
4
|
import { Toggle, Button, Box } from "../index";
|
|
4
5
|
import { dashed } from "../utils/story/dashed";
|
|
@@ -8,38 +9,35 @@ export default {
|
|
|
8
9
|
};
|
|
9
10
|
export const _Toggle = () => {
|
|
10
11
|
const [toggled, setToggled] = useState(false);
|
|
11
|
-
return
|
|
12
|
+
return _jsx(Toggle, { "data-testid": "toggle-example", toggled: toggled, onChange: (e) => setToggled(e.target.checked) });
|
|
12
13
|
};
|
|
13
14
|
export const ToggleWithAllProps = () => {
|
|
14
15
|
const [toggled, setToggled] = useState(true);
|
|
15
|
-
return (
|
|
16
|
+
return (_jsx(Toggle, { labelText: "Toggle", helpText: "Turns setting on/off", onText: "on", offText: "off", toggled: toggled, required: true, requirementText: "(Required)", onChange: (e) => setToggled(e.target.checked) }));
|
|
16
17
|
};
|
|
17
18
|
ToggleWithAllProps.storyName = "Toggle with all props";
|
|
18
19
|
export const ToggleSetToDisabled = () => {
|
|
19
|
-
return (
|
|
20
|
-
React.createElement(Toggle, { labelText: "Toggle", disabled: true, onText: "on", offText: "off", onChange: action("on change"), "data-testid": "toggle-example" }),
|
|
21
|
-
React.createElement(Toggle, { id: "toggle-2", disabled: true, onText: "on", offText: "off", toggled: true, labelText: "Toggle", onChange: action("on change") })));
|
|
20
|
+
return (_jsxs(_Fragment, { children: [_jsx(Toggle, { labelText: "Toggle", disabled: true, onText: "on", offText: "off", onChange: action("on change"), "data-testid": "toggle-example" }), _jsx(Toggle, { id: "toggle-2", disabled: true, onText: "on", offText: "off", toggled: true, labelText: "Toggle", onChange: action("on change") })] }));
|
|
22
21
|
};
|
|
23
22
|
ToggleSetToDisabled.storyName = "Toggle set to disabled";
|
|
24
23
|
export const WithCustomId = () => {
|
|
25
24
|
const [toggled, setToggled] = useState(true);
|
|
26
|
-
return (
|
|
25
|
+
return (_jsx(Toggle, { id: "my-custom-id", labelText: "Toggle", onText: "on", offText: "off", toggled: toggled, onChange: (e) => setToggled(e.target.checked) }));
|
|
27
26
|
};
|
|
28
27
|
WithCustomId.storyName = "With custom id";
|
|
29
28
|
export const WithText = () => {
|
|
30
29
|
const [toggled, setToggled] = useState(true);
|
|
31
|
-
return (
|
|
30
|
+
return (_jsx(Toggle, { labelText: "Toggle", onText: "on", offText: "off", toggled: toggled, onChange: (e) => setToggled(e.target.checked) }));
|
|
32
31
|
};
|
|
33
32
|
WithText.storyName = "With text";
|
|
34
33
|
export const WithLongText = () => {
|
|
35
34
|
const [toggled, setToggled] = useState(true);
|
|
36
|
-
return (
|
|
35
|
+
return (_jsx(Toggle, { labelText: "Toggle", toggled: toggled, onText: "this state has a very long text label to explain it's state", offText: "not this one", onChange: (e) => setToggled(e.target.checked) }));
|
|
37
36
|
};
|
|
38
37
|
WithLongText.storyName = "With long text";
|
|
39
38
|
export const WithContraintWidth = () => {
|
|
40
39
|
const [toggled, setToggled] = useState(true);
|
|
41
|
-
return (
|
|
42
|
-
React.createElement(Toggle, { labelText: "Toggle", onText: "This is a long On label for the toggle component.", offText: "This is a long Off label for the toggle component.", toggled: toggled, onChange: (e) => setToggled(e.target.checked) })));
|
|
40
|
+
return (_jsx(DashedBox, { width: "200px", padding: "x2", children: _jsx(Toggle, { labelText: "Toggle", onText: "This is a long On label for the toggle component.", offText: "This is a long Off label for the toggle component.", toggled: toggled, onChange: (e) => setToggled(e.target.checked) }) }));
|
|
43
41
|
};
|
|
44
42
|
WithContraintWidth.storyName = "With constraint width";
|
|
45
43
|
export const UsingRefToControlFocus = () => {
|
|
@@ -48,8 +46,6 @@ export const UsingRefToControlFocus = () => {
|
|
|
48
46
|
const handleClick = () => {
|
|
49
47
|
ref.current.focus();
|
|
50
48
|
};
|
|
51
|
-
return (
|
|
52
|
-
React.createElement(Toggle, { id: "my-custom-id", labelText: "Toggle", onText: "on", offText: "off", toggled: toggled, onChange: (e) => setToggled(e.target.checked), ref: ref }),
|
|
53
|
-
React.createElement(Button, { onClick: handleClick }, "Focus the Toggle")));
|
|
49
|
+
return (_jsxs(_Fragment, { children: [_jsx(Toggle, { id: "my-custom-id", labelText: "Toggle", onText: "on", offText: "off", toggled: toggled, onChange: (e) => setToggled(e.target.checked), ref: ref }), _jsx(Button, { onClick: handleClick, children: "Focus the Toggle" })] }));
|
|
54
50
|
};
|
|
55
51
|
UsingRefToControlFocus.storyName = "Using ref to control focus";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { motion } from "framer-motion";
|
|
3
4
|
import { styled, useTheme } from "styled-components";
|
|
@@ -15,11 +16,11 @@ const animationConfig = {
|
|
|
15
16
|
};
|
|
16
17
|
function Switch({ children, disabled, checked }) {
|
|
17
18
|
const componentVariant = useComponentVariant();
|
|
18
|
-
return (
|
|
19
|
+
return (_jsx(AnimatedBox, { marginTop: componentVariant === "touch" ? "x0_25" : "none", position: "relative", flexShrink: 0, height: "24px", width: "48px", bg: disabled ? "grey" : getSwitchBackground(checked), borderRadius: "20px", padding: "2px", boxShadow: "small", animate: checked ? "toggled" : "initial", whileHover: "active", whileFocus: "active", children: children }));
|
|
19
20
|
}
|
|
20
21
|
const Slider = ({ disabled, children }) => {
|
|
21
22
|
const theme = useTheme();
|
|
22
|
-
return (
|
|
23
|
+
return (_jsx(motion.div, { className: "slider", initial: false, variants: {
|
|
23
24
|
active: {
|
|
24
25
|
boxShadow: disabled ? undefined : theme.shadows.focus,
|
|
25
26
|
scale: disabled ? undefined : animationConfig.scale,
|
|
@@ -35,7 +36,7 @@ const Slider = ({ disabled, children }) => {
|
|
|
35
36
|
width: "20px",
|
|
36
37
|
borderRadius: "50%",
|
|
37
38
|
backgroundColor: disabled ? theme.colors.whiteGrey : theme.colors.white,
|
|
38
|
-
}
|
|
39
|
+
}, children: children }));
|
|
39
40
|
};
|
|
40
41
|
const ToggleInput = styled.input(({ disabled, theme }) => ({
|
|
41
42
|
width: "1px",
|
|
@@ -51,8 +52,6 @@ const ToggleInput = styled.input(({ disabled, theme }) => ({
|
|
|
51
52
|
},
|
|
52
53
|
}));
|
|
53
54
|
const ToggleButton = React.forwardRef(({ disabled, checked, ...props }, ref) => {
|
|
54
|
-
return (
|
|
55
|
-
React.createElement(ToggleInput, { type: "checkbox", role: "switch", checked: checked, ref: ref, value: checked ? "on" : "off", disabled: disabled, ...props }),
|
|
56
|
-
React.createElement(Slider, { disabled: disabled })));
|
|
55
|
+
return (_jsxs(Switch, { disabled: disabled, checked: checked, children: [_jsx(ToggleInput, { type: "checkbox", role: "switch", checked: checked, ref: ref, value: checked ? "on" : "off", disabled: disabled, ...props }), _jsx(Slider, { disabled: disabled })] }));
|
|
57
56
|
});
|
|
58
57
|
export default ToggleButton;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
declare const _default: {
|
|
3
2
|
title: string;
|
|
4
3
|
};
|
|
5
4
|
export default _default;
|
|
6
|
-
export declare const Colors: () =>
|
|
7
|
-
export declare const FontSizes: () =>
|
|
8
|
-
export declare const LineHeights: () =>
|
|
9
|
-
export declare const FontWeights: () =>
|
|
10
|
-
export declare const SpaceAndSize: () =>
|
|
11
|
-
export declare const Font: () =>
|
|
12
|
-
export declare const Shadows: () =>
|
|
13
|
-
export declare const Radii: () =>
|
|
14
|
-
export declare const Breakpoints: () =>
|
|
5
|
+
export declare const Colors: () => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const FontSizes: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const LineHeights: () => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const FontWeights: () => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const SpaceAndSize: () => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const Font: () => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const Shadows: () => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const Radii: () => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const Breakpoints: () => import("react/jsx-runtime").JSX.Element;
|