@digigov/ui 1.2.0-a7ffb5dc → 2.0.0-4be8f7cc
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/app/Footer/index.mdx +18 -5
- package/app/Header/index.mdx +7 -5
- package/app/Masthead/index.mdx +9 -4
- package/app/Modal/auto.d.ts +2 -2
- package/app/Modal/index.d.ts +2 -2
- package/app/Modal/index.js +1 -1
- package/app/Modal/index.mdx +11 -4
- package/app/NotFound/index.mdx +2 -0
- package/app/Panel/index.mdx +9 -4
- package/app/PhaseBannerHeader/index.mdx +4 -4
- package/app/QrCodeViewer/QRCode.stories.d.ts +1 -0
- package/app/QrCodeViewer/index.d.ts +1 -0
- package/app/QrCodeViewer/index.js +2 -1
- package/app/QrCodeViewer/index.mdx +4 -4
- package/app/Skeleton/Skeleton.stories/index.js +16 -0
- package/{utils/Kitchensink/AllComponents → app/Skeleton/Skeleton.stories}/package.json +1 -1
- package/app/Skeleton/Skeleton.stories.d.ts +17 -0
- package/app/Skeleton/__stories__/Button/index.js +9 -0
- package/{utils/Kitchensink/KitchensinkByLetter → app/Skeleton/__stories__/Button}/package.json +1 -1
- package/app/Skeleton/__stories__/Button.d.ts +3 -0
- package/app/Skeleton/__stories__/Circular/index.js +11 -0
- package/{utils/Kitchensink/KitchensinkComponent → app/Skeleton/__stories__/Circular}/package.json +1 -1
- package/app/Skeleton/__stories__/Circular.d.ts +3 -0
- package/app/Skeleton/__stories__/Default/index.js +7 -0
- package/app/Skeleton/__stories__/Default/package.json +6 -0
- package/app/Skeleton/__stories__/Default.d.ts +3 -0
- package/app/Skeleton/__stories__/NoAnimation/index.js +9 -0
- package/{utils/Kitchensink/KitchensinkByCategory → app/Skeleton/__stories__/NoAnimation}/package.json +1 -1
- package/app/Skeleton/__stories__/NoAnimation.d.ts +3 -0
- package/app/Skeleton/__stories__/Rectangular/index.js +10 -0
- package/app/Skeleton/__stories__/Rectangular/package.json +6 -0
- package/app/Skeleton/__stories__/Rectangular.d.ts +3 -0
- package/app/Skeleton/__stories__/SpecificWidthAndHeight/index.js +10 -0
- package/app/Skeleton/__stories__/SpecificWidthAndHeight/package.json +6 -0
- package/app/Skeleton/__stories__/SpecificWidthAndHeight.d.ts +3 -0
- package/app/Skeleton/__stories__/UnderTypography/index.js +10 -0
- package/{form/AutoComplete/__stories__/WithInLine → app/Skeleton/__stories__/UnderTypography}/package.json +1 -1
- package/app/Skeleton/__stories__/UnderTypography.d.ts +3 -0
- package/app/Skeleton/__stories__/WithChildren/index.js +8 -0
- package/app/Skeleton/__stories__/WithChildren/package.json +6 -0
- package/app/Skeleton/__stories__/WithChildren.d.ts +3 -0
- package/app/Skeleton/index.d.ts +3 -0
- package/app/Skeleton/index.js +3 -0
- package/{misc/KitchenSink → app/Skeleton}/package.json +1 -1
- package/app/ThemeOptions/index.d.ts +2 -2
- package/cjs/app/Footer/index.mdx +18 -5
- package/cjs/app/Header/index.mdx +7 -5
- package/cjs/app/Masthead/index.mdx +9 -4
- package/cjs/app/Modal/index.js +1 -1
- package/cjs/app/Modal/index.mdx +11 -4
- package/cjs/app/NotFound/index.mdx +2 -0
- package/cjs/app/Panel/index.mdx +9 -4
- package/cjs/app/PhaseBannerHeader/index.mdx +4 -4
- package/cjs/app/QrCodeViewer/index.js +3 -2
- package/cjs/app/QrCodeViewer/index.mdx +4 -4
- package/cjs/app/Skeleton/Skeleton.stories/index.js +111 -0
- package/cjs/app/Skeleton/__stories__/Button/index.js +16 -0
- package/cjs/app/Skeleton/__stories__/Circular/index.js +18 -0
- package/cjs/app/Skeleton/__stories__/Default/index.js +14 -0
- package/cjs/app/Skeleton/__stories__/NoAnimation/index.js +16 -0
- package/cjs/app/Skeleton/__stories__/Rectangular/index.js +17 -0
- package/cjs/app/Skeleton/__stories__/SpecificWidthAndHeight/index.js +17 -0
- package/cjs/app/Skeleton/__stories__/UnderTypography/index.js +17 -0
- package/cjs/app/Skeleton/__stories__/WithChildren/index.js +15 -0
- package/cjs/app/Skeleton/index.js +23 -0
- package/cjs/content/Accordion/__stories__/Auto/index.js +2 -3
- package/cjs/content/Accordion/hooks/index.js +0 -1
- package/cjs/content/Accordion/index.mdx +9 -5
- package/cjs/content/Blockquote/index.mdx +3 -5
- package/cjs/content/Card/index.mdx +3 -5
- package/cjs/content/Chip/index.mdx +4 -5
- package/cjs/content/Details/index.mdx +3 -5
- package/cjs/content/List/__stories__/Default/index.js +1 -2
- package/cjs/content/List/index.mdx +3 -5
- package/cjs/content/SafeHTML/index.js +5 -8
- package/cjs/content/StepNav/index.mdx +28 -5
- package/cjs/content/SummaryList/index.mdx +10 -5
- package/cjs/content/Table/index.js +2 -2
- package/cjs/content/Table/index.mdx +13 -14
- package/cjs/content/TaskList/index.mdx +9 -5
- package/cjs/content/Timeline/index.mdx +10 -5
- package/cjs/feedback/CopyToClipboard/index.mdx +3 -5
- package/cjs/feedback/ErrorSummary/index.mdx +3 -5
- package/cjs/feedback/NotificationBanner/index.mdx +14 -5
- package/cjs/feedback/PhaseBanner/index.mdx +8 -5
- package/cjs/feedback/WarningText/index.mdx +5 -5
- package/cjs/form/AutoComplete/AutoComplete.stories/index.js +44 -8
- package/cjs/form/AutoComplete/AutoComplete.stories.playwright.json +33 -0
- package/cjs/form/AutoComplete/Status/index.js +12 -5
- package/cjs/form/AutoComplete/__stories__/Multiple/index.js +24 -0
- package/cjs/form/AutoComplete/__stories__/{WithInLine → MultipleShowingTwoSelected}/index.js +7 -6
- package/cjs/form/AutoComplete/__stories__/MultipleWithDefaultValues/index.js +23 -0
- package/cjs/form/AutoComplete/__stories__/MultipleWithMinLength/index.js +26 -0
- package/cjs/form/AutoComplete/__stories__/WithShowAllValues/index.js +0 -1
- package/cjs/form/AutoComplete/index.js +312 -202
- package/cjs/form/AutoComplete/index.mdx +13 -20
- package/cjs/form/AutoComplete/utils/index.js +2 -1
- package/cjs/form/Button/index.mdx +3 -5
- package/cjs/form/Checkbox/index.mdx +3 -5
- package/cjs/form/DateInputContainer/index.mdx +3 -5
- package/cjs/form/ErrorMessage/index.mdx +3 -5
- package/cjs/form/FileUpload/index.mdx +3 -5
- package/cjs/form/RadioContainer/index.mdx +2 -14
- package/cjs/form/SelectContainer/index.mdx +3 -1
- package/cjs/form/SingleCharacterInputs/index.mdx +3 -5
- package/cjs/form/TextArea/index.mdx +3 -5
- package/cjs/form/TextInput/TextInput.stories/index.js +12 -0
- package/cjs/form/TextInput/__stories__/DisabledInputWithValue/index.js +31 -0
- package/cjs/form/TextInput/index.mdx +3 -5
- package/cjs/govgr/Footer/index.mdx +1 -1
- package/cjs/i18n/locales/el/index.js +2 -2
- package/cjs/i18n/locales/en/index.js +2 -2
- package/cjs/layouts/Basic/Bottom/__stories__/Default/index.js +22 -0
- package/cjs/layouts/Basic/Bottom/index.mdx +9 -28
- package/cjs/layouts/Basic/Container/__stories__/Default/index.js +20 -0
- package/cjs/layouts/Basic/Container/index.mdx +23 -0
- package/cjs/layouts/Basic/Main/__stories__/Default/index.js +20 -0
- package/cjs/layouts/Basic/Main/index.mdx +10 -47
- package/cjs/layouts/Basic/Top/__stories__/Default/index.js +20 -0
- package/cjs/layouts/Basic/Top/index.mdx +10 -55
- package/cjs/layouts/Basic/index.mdx +27 -25
- package/cjs/layouts/Grid/index.mdx +39 -0
- package/cjs/lazy/index.js +152 -134
- package/cjs/navigation/BackLink/index.mdx +4 -5
- package/cjs/navigation/Breadcrumbs/index.mdx +6 -5
- package/cjs/navigation/Drawer/index.mdx +4 -10
- package/cjs/navigation/Dropdown/Dropdown.stories/index.js +12 -0
- package/cjs/navigation/Dropdown/Dropdown.stories.playwright.json +16 -0
- package/cjs/navigation/Dropdown/__stories__/ScrollableContent/index.js +68 -0
- package/cjs/navigation/Dropdown/index.mdx +3 -5
- package/cjs/navigation/Link/index.mdx +5 -15
- package/cjs/navigation/NavList/__stories__/Default/index.js +14 -2
- package/cjs/navigation/NavList/__stories__/HorizontalWithDrawer/index.js +35 -2
- package/cjs/navigation/NavList/__stories__/HorizontalWithoutDrawer/index.js +35 -2
- package/cjs/navigation/NavList/__stories__/NavListWithoutNav/index.js +14 -2
- package/cjs/navigation/NavList/__stories__/UsingNavListAuto/index.js +37 -4
- package/cjs/navigation/NavList/__stories__/Vertical/index.js +14 -2
- package/cjs/navigation/NavList/__stories__/VerticalWithoutDrawer/index.js +35 -2
- package/cjs/navigation/NavList/index.mdx +23 -7
- package/cjs/navigation/Pagination/__stories__/PaginationWithSmallFont/index.js +2 -2
- package/cjs/navigation/Pagination/__stories__/WithResultsPerPage/index.js +2 -2
- package/cjs/navigation/Pagination/index.mdx +9 -5
- package/cjs/navigation/Tabs/index.mdx +9 -5
- package/cjs/registry/index.js +6 -12
- package/cjs/typography/Heading/index.mdx +3 -5
- package/cjs/typography/HeadingCaption/index.mdx +3 -5
- package/cjs/typography/Hint/index.mdx +3 -5
- package/cjs/typography/NormalText/index.mdx +3 -5
- package/cjs/typography/Paragraph/index.mdx +9 -30
- package/cjs/typography/Typography/index.js +23 -0
- package/cjs/typography/Typography/index.mdx +12 -0
- package/cjs/typography/index.js +11 -0
- package/cjs/utils/Base/index.mdx +13 -0
- package/cjs/utils/VisuallyHidden/index.mdx +10 -5
- package/content/Accordion/__stories__/Auto/index.js +2 -3
- package/content/Accordion/auto.d.ts +3 -3
- package/content/Accordion/hooks/index.js +0 -1
- package/content/Accordion/index.mdx +9 -5
- package/content/Blockquote/index.mdx +3 -5
- package/content/Card/index.mdx +3 -5
- package/content/Chip/index.mdx +4 -5
- package/content/Details/index.mdx +3 -5
- package/content/List/__stories__/Default/index.js +1 -2
- package/content/List/index.mdx +3 -5
- package/content/SafeHTML/index.d.ts +1 -1
- package/content/SafeHTML/index.js +5 -8
- package/content/StepNav/auto.d.ts +3 -3
- package/content/StepNav/index.mdx +28 -5
- package/content/SummaryList/index.mdx +10 -5
- package/content/Table/index.d.ts +1 -1
- package/content/Table/index.js +2 -2
- package/content/Table/index.mdx +13 -14
- package/content/TaskList/index.mdx +9 -5
- package/content/Timeline/index.mdx +10 -5
- package/feedback/CopyToClipboard/index.d.ts +1 -1
- package/feedback/CopyToClipboard/index.mdx +3 -5
- package/feedback/ErrorSummary/index.mdx +3 -5
- package/feedback/NotificationBanner/index.mdx +14 -5
- package/feedback/PhaseBanner/index.mdx +8 -5
- package/feedback/WarningText/index.mdx +5 -5
- package/form/AutoComplete/AutoComplete.stories/index.js +4 -1
- package/form/AutoComplete/AutoComplete.stories.d.ts +4 -1
- package/form/AutoComplete/AutoComplete.stories.playwright.json +33 -0
- package/form/AutoComplete/Status/index.d.ts +4 -2
- package/form/AutoComplete/Status/index.js +11 -4
- package/form/AutoComplete/__stories__/Multiple/index.js +17 -0
- package/form/AutoComplete/__stories__/Multiple/package.json +6 -0
- package/form/AutoComplete/__stories__/Multiple.d.ts +3 -0
- package/form/AutoComplete/__stories__/{WithInLine → MultipleShowingTwoSelected}/index.js +6 -5
- package/form/AutoComplete/__stories__/MultipleShowingTwoSelected/package.json +6 -0
- package/form/AutoComplete/__stories__/MultipleShowingTwoSelected.d.ts +3 -0
- package/form/AutoComplete/__stories__/MultipleWithDefaultValues/index.js +16 -0
- package/form/AutoComplete/__stories__/MultipleWithDefaultValues/package.json +6 -0
- package/form/AutoComplete/__stories__/MultipleWithDefaultValues.d.ts +3 -0
- package/form/AutoComplete/__stories__/MultipleWithMinLength/index.js +19 -0
- package/form/AutoComplete/__stories__/MultipleWithMinLength/package.json +6 -0
- package/form/AutoComplete/__stories__/MultipleWithMinLength.d.ts +3 -0
- package/form/AutoComplete/__stories__/WithShowAllValues/index.js +0 -1
- package/form/AutoComplete/index.d.ts +12 -18
- package/form/AutoComplete/index.js +295 -197
- package/form/AutoComplete/index.mdx +13 -20
- package/form/AutoComplete/utils/index.js +2 -1
- package/form/AutoComplete/utils.d.ts +1 -0
- package/form/Button/index.mdx +3 -5
- package/form/Checkbox/index.mdx +3 -5
- package/form/DateInputContainer/index.mdx +3 -5
- package/form/ErrorMessage/index.mdx +3 -5
- package/form/FileUpload/index.mdx +3 -5
- package/form/RadioContainer/index.mdx +2 -14
- package/form/SelectContainer/index.mdx +3 -1
- package/form/SingleCharacterInputs/index.mdx +3 -5
- package/form/TextArea/index.mdx +3 -5
- package/form/TextInput/TextInput.stories/index.js +1 -0
- package/form/TextInput/TextInput.stories.d.ts +1 -0
- package/form/TextInput/__stories__/DisabledInputWithValue/index.js +25 -0
- package/form/TextInput/__stories__/DisabledInputWithValue/package.json +6 -0
- package/form/TextInput/__stories__/DisabledInputWithValue.d.ts +3 -0
- package/form/TextInput/index.mdx +3 -5
- package/govgr/Footer/index.mdx +1 -1
- package/i18n/locales/el/index.js +2 -2
- package/i18n/locales/en/index.js +2 -2
- package/index.js +1 -1
- package/layouts/Basic/Bottom/__stories__/Default/index.js +15 -0
- package/layouts/Basic/Bottom/__stories__/Default/package.json +6 -0
- package/layouts/Basic/Bottom/__stories__/Default.d.ts +3 -0
- package/layouts/Basic/Bottom/index.mdx +9 -28
- package/layouts/Basic/Container/__stories__/Default/index.js +13 -0
- package/layouts/Basic/Container/__stories__/Default/package.json +6 -0
- package/layouts/Basic/Container/__stories__/Default.d.ts +3 -0
- package/layouts/Basic/Container/index.mdx +23 -0
- package/layouts/Basic/Main/__stories__/Default/index.js +13 -0
- package/layouts/Basic/Main/__stories__/Default/package.json +6 -0
- package/layouts/Basic/Main/__stories__/Default.d.ts +3 -0
- package/layouts/Basic/Main/index.mdx +10 -47
- package/layouts/Basic/Top/__stories__/Default/index.js +13 -0
- package/layouts/Basic/Top/__stories__/Default/package.json +6 -0
- package/layouts/Basic/Top/__stories__/Default.d.ts +3 -0
- package/layouts/Basic/Top/index.mdx +10 -55
- package/layouts/Basic/index.mdx +27 -25
- package/layouts/Grid/index.mdx +39 -0
- package/lazy/index.js +120 -106
- package/lazy.d.ts +269 -267
- package/navigation/BackLink/index.mdx +4 -5
- package/navigation/Breadcrumbs/index.mdx +6 -5
- package/navigation/Drawer/auto.d.ts +3 -3
- package/navigation/Drawer/index.mdx +4 -10
- package/navigation/Dropdown/Dropdown.stories/index.js +1 -0
- package/navigation/Dropdown/Dropdown.stories.d.ts +1 -0
- package/navigation/Dropdown/Dropdown.stories.playwright.json +16 -0
- package/navigation/Dropdown/__stories__/ScrollableContent/index.js +61 -0
- package/navigation/Dropdown/__stories__/ScrollableContent/package.json +6 -0
- package/navigation/Dropdown/__stories__/ScrollableContent.d.ts +3 -0
- package/navigation/Dropdown/index.d.ts +1 -1
- package/navigation/Dropdown/index.mdx +3 -5
- package/navigation/Link/index.mdx +5 -15
- package/navigation/NavList/__stories__/Default/index.js +13 -1
- package/navigation/NavList/__stories__/HorizontalWithDrawer/index.js +34 -1
- package/navigation/NavList/__stories__/HorizontalWithoutDrawer/index.js +34 -1
- package/navigation/NavList/__stories__/NavListWithoutNav/index.js +13 -1
- package/navigation/NavList/__stories__/UsingNavListAuto/index.js +35 -2
- package/navigation/NavList/__stories__/Vertical/index.js +13 -1
- package/navigation/NavList/__stories__/VerticalWithoutDrawer/index.js +34 -1
- package/navigation/NavList/index.mdx +23 -7
- package/navigation/NavList/types.d.ts +1 -2
- package/navigation/Pagination/__stories__/PaginationWithSmallFont/index.js +1 -1
- package/navigation/Pagination/__stories__/WithResultsPerPage/index.js +1 -1
- package/navigation/Pagination/auto.d.ts +4 -4
- package/navigation/Pagination/index.d.ts +2 -2
- package/navigation/Pagination/index.mdx +9 -5
- package/navigation/Tabs/auto.d.ts +2 -2
- package/navigation/Tabs/index.mdx +9 -5
- package/package.json +4 -6
- package/registry/index.js +6 -12
- package/registry.d.ts +4 -6
- package/src/app/Footer/index.mdx +18 -5
- package/src/app/Header/index.mdx +7 -5
- package/src/app/Masthead/index.mdx +9 -4
- package/src/app/Modal/index.mdx +11 -4
- package/src/app/Modal/index.tsx +1 -1
- package/src/app/NotFound/index.mdx +2 -0
- package/src/app/Panel/index.mdx +9 -4
- package/src/app/PhaseBannerHeader/index.mdx +4 -4
- package/src/app/QrCodeViewer/index.mdx +4 -4
- package/src/app/QrCodeViewer/index.tsx +2 -0
- package/src/app/Skeleton/Skeleton.stories.js +18 -0
- package/src/app/Skeleton/__stories__/Button.tsx +6 -0
- package/src/app/Skeleton/__stories__/Circular.tsx +8 -0
- package/src/app/Skeleton/__stories__/Default.tsx +6 -0
- package/src/app/Skeleton/__stories__/NoAnimation.tsx +6 -0
- package/src/app/Skeleton/__stories__/Rectangular.tsx +8 -0
- package/src/app/Skeleton/__stories__/SpecificWidthAndHeight.tsx +8 -0
- package/src/app/Skeleton/__stories__/UnderTypography.tsx +17 -0
- package/src/app/Skeleton/__stories__/WithChildren.tsx +11 -0
- package/src/app/Skeleton/index.tsx +4 -0
- package/src/app/ThemeOptions/index.tsx +1 -1
- package/src/content/Accordion/__stories__/Auto.tsx +2 -2
- package/src/content/Accordion/auto.tsx +1 -1
- package/src/content/Accordion/hooks.ts +0 -1
- package/src/content/Accordion/index.mdx +9 -5
- package/src/content/Blockquote/index.mdx +3 -5
- package/src/content/Card/index.mdx +3 -5
- package/src/content/Chip/index.mdx +4 -5
- package/src/content/Details/index.mdx +3 -5
- package/src/content/List/__stories__/Default.tsx +3 -4
- package/src/content/List/index.mdx +3 -5
- package/src/content/SafeHTML/index.tsx +3 -4
- package/src/content/StepNav/index.mdx +28 -5
- package/src/content/SummaryList/index.mdx +10 -5
- package/src/content/Table/index.mdx +13 -14
- package/src/content/Table/index.tsx +2 -2
- package/src/content/TaskList/index.mdx +9 -5
- package/src/content/Timeline/index.mdx +10 -5
- package/src/feedback/CopyToClipboard/index.mdx +3 -5
- package/src/feedback/ErrorSummary/index.mdx +3 -5
- package/src/feedback/NotificationBanner/index.mdx +14 -5
- package/src/feedback/PhaseBanner/index.mdx +8 -5
- package/src/feedback/WarningText/index.mdx +5 -5
- package/src/form/AutoComplete/AutoComplete.stories.js +4 -1
- package/src/form/AutoComplete/AutoComplete.stories.playwright.json +33 -0
- package/src/form/AutoComplete/Status/index.tsx +10 -6
- package/src/form/AutoComplete/__stories__/Multiple.tsx +18 -0
- package/src/form/AutoComplete/__stories__/{WithInLine.tsx → MultipleShowingTwoSelected.tsx} +3 -8
- package/src/form/AutoComplete/__stories__/MultipleWithDefaultValues.tsx +16 -0
- package/src/form/AutoComplete/__stories__/MultipleWithMinLength.tsx +29 -0
- package/src/form/AutoComplete/__stories__/WithShowAllValues.tsx +0 -1
- package/src/form/AutoComplete/index.mdx +13 -20
- package/src/form/AutoComplete/index.tsx +351 -213
- package/src/form/AutoComplete/utils.ts +3 -2
- package/src/form/Button/index.mdx +3 -5
- package/src/form/Checkbox/index.mdx +3 -5
- package/src/form/DateInputContainer/index.mdx +3 -5
- package/src/form/ErrorMessage/index.mdx +3 -5
- package/src/form/FileUpload/index.mdx +3 -5
- package/src/form/RadioContainer/index.mdx +2 -14
- package/src/form/SelectContainer/index.mdx +3 -1
- package/src/form/SingleCharacterInputs/index.mdx +3 -5
- package/src/form/TextArea/index.mdx +3 -5
- package/src/form/TextInput/TextInput.stories.js +1 -0
- package/src/form/TextInput/__stories__/DisabledInputWithValue.tsx +27 -0
- package/src/form/TextInput/index.mdx +3 -5
- package/src/govgr/Footer/index.mdx +1 -1
- package/src/i18n/locales/el.ts +2 -2
- package/src/i18n/locales/en.ts +2 -2
- package/src/layouts/Basic/Bottom/__stories__/Default.tsx +35 -0
- package/src/layouts/Basic/Bottom/index.mdx +9 -28
- package/src/layouts/Basic/Container/__stories__/Default.tsx +30 -0
- package/src/layouts/Basic/Container/index.mdx +23 -0
- package/src/layouts/Basic/Main/__stories__/Default.tsx +30 -0
- package/src/layouts/Basic/Main/index.mdx +10 -47
- package/src/layouts/Basic/Top/__stories__/Default.tsx +28 -0
- package/src/layouts/Basic/Top/index.mdx +10 -55
- package/src/layouts/Basic/index.mdx +27 -25
- package/src/layouts/Grid/index.mdx +39 -0
- package/src/lazy.js +18 -16
- package/src/navigation/BackLink/index.mdx +4 -5
- package/src/navigation/Breadcrumbs/index.mdx +6 -5
- package/src/navigation/Drawer/index.mdx +4 -10
- package/src/navigation/Dropdown/Dropdown.stories.js +1 -0
- package/src/navigation/Dropdown/Dropdown.stories.playwright.json +16 -0
- package/src/navigation/Dropdown/__stories__/ScrollableContent.tsx +82 -0
- package/src/navigation/Dropdown/index.mdx +3 -5
- package/src/navigation/Link/index.mdx +5 -15
- package/src/navigation/NavList/__stories__/Default.tsx +18 -1
- package/src/navigation/NavList/__stories__/HorizontalWithDrawer.tsx +37 -1
- package/src/navigation/NavList/__stories__/HorizontalWithoutDrawer.tsx +37 -1
- package/src/navigation/NavList/__stories__/NavListWithoutNav.tsx +18 -1
- package/src/navigation/NavList/__stories__/UsingNavListAuto.tsx +39 -2
- package/src/navigation/NavList/__stories__/Vertical.tsx +18 -1
- package/src/navigation/NavList/__stories__/VerticalWithoutDrawer.tsx +37 -1
- package/src/navigation/NavList/index.mdx +23 -7
- package/src/navigation/NavList/types.tsx +1 -2
- package/src/navigation/Pagination/__stories__/PaginationWithSmallFont.tsx +1 -1
- package/src/navigation/Pagination/__stories__/WithResultsPerPage.tsx +1 -1
- package/src/navigation/Pagination/index.mdx +9 -5
- package/src/navigation/Tabs/index.mdx +9 -5
- package/src/registry.js +6 -12
- package/src/typography/Heading/index.mdx +3 -5
- package/src/typography/HeadingCaption/index.mdx +3 -5
- package/src/typography/Hint/index.mdx +3 -5
- package/src/typography/NormalText/index.mdx +3 -5
- package/src/typography/Paragraph/index.mdx +9 -30
- package/src/typography/Typography/index.mdx +12 -0
- package/src/typography/Typography/index.tsx +4 -0
- package/src/typography/index.ts +1 -0
- package/src/utils/Base/index.mdx +13 -0
- package/src/utils/VisuallyHidden/index.mdx +10 -5
- package/typography/Heading/index.mdx +3 -5
- package/typography/HeadingCaption/index.mdx +3 -5
- package/typography/Hint/index.mdx +3 -5
- package/typography/NormalText/index.mdx +3 -5
- package/typography/Paragraph/index.mdx +9 -30
- package/typography/Typography/index.d.ts +3 -0
- package/typography/Typography/index.js +3 -0
- package/typography/Typography/index.mdx +12 -0
- package/typography/Typography/package.json +6 -0
- package/typography/index.d.ts +1 -0
- package/typography/index.js +2 -1
- package/utils/Base/index.mdx +13 -0
- package/utils/VisuallyHidden/index.mdx +10 -5
- package/cjs/content/List/List.stories.playwright.json +0 -27
- package/cjs/layouts/Basic/Masthead/index.mdx +0 -65
- package/cjs/misc/KitchenSink/index.js +0 -93
- package/cjs/utils/Kitchensink/AllComponents/index.js +0 -16
- package/cjs/utils/Kitchensink/KitchensinkByCategory/index.js +0 -39
- package/cjs/utils/Kitchensink/KitchensinkByLetter/index.js +0 -26
- package/cjs/utils/Kitchensink/KitchensinkComponent/index.js +0 -55
- package/cjs/utils/Kitchensink/KitchensinkDashboard/index.js +0 -47
- package/content/List/List.stories.playwright.json +0 -27
- package/form/AutoComplete/__stories__/WithInLine.d.ts +0 -3
- package/layouts/Basic/Masthead/index.mdx +0 -65
- package/misc/KitchenSink/index.d.ts +0 -8
- package/misc/KitchenSink/index.js +0 -8
- package/src/content/List/List.stories.playwright.json +0 -27
- package/src/layouts/Basic/Masthead/index.mdx +0 -65
- package/src/misc/KitchenSink/index.tsx +0 -8
- package/src/utils/Kitchensink/AllComponents.tsx +0 -6
- package/src/utils/Kitchensink/KitchensinkByCategory.tsx +0 -56
- package/src/utils/Kitchensink/KitchensinkByLetter.tsx +0 -35
- package/src/utils/Kitchensink/KitchensinkComponent.tsx +0 -70
- package/src/utils/Kitchensink/KitchensinkDashboard.tsx +0 -56
- package/utils/Kitchensink/AllComponents/index.js +0 -9
- package/utils/Kitchensink/AllComponents.d.ts +0 -2
- package/utils/Kitchensink/KitchensinkByCategory/index.js +0 -32
- package/utils/Kitchensink/KitchensinkByCategory.d.ts +0 -6
- package/utils/Kitchensink/KitchensinkByLetter/index.js +0 -19
- package/utils/Kitchensink/KitchensinkByLetter.d.ts +0 -6
- package/utils/Kitchensink/KitchensinkComponent/index.js +0 -45
- package/utils/Kitchensink/KitchensinkComponent.d.ts +0 -10
- package/utils/Kitchensink/KitchensinkDashboard/index.js +0 -40
- package/utils/Kitchensink/KitchensinkDashboard/package.json +0 -6
- package/utils/Kitchensink/KitchensinkDashboard.d.ts +0 -5
|
@@ -14,10 +14,24 @@ import AutoCompleteInput from '@digigov/react-core/AutoCompleteInput';
|
|
|
14
14
|
import AutoCompleteInputTypeahead from '@digigov/react-core/AutoCompleteInputTypeahead';
|
|
15
15
|
import AutoCompleteResultList from '@digigov/react-core/AutoCompleteResultList';
|
|
16
16
|
import AutoCompleteResultListItem from '@digigov/react-core/AutoCompleteResultListItem';
|
|
17
|
-
import
|
|
17
|
+
import AutoCompleteContainer from '@digigov/react-core/AutoCompleteContainer';
|
|
18
|
+
import AutoCompleteMultipleInputContainer from '@digigov/react-core/AutoCompleteMultipleInputContainer';
|
|
19
|
+
import AutoCompleteMultipleInput from '@digigov/react-core/AutoCompleteMultipleInput';
|
|
18
20
|
import { CaretIcon } from '@digigov/react-icons/CaretIcon';
|
|
19
21
|
import Status from '@digigov/ui/form/AutoComplete/Status';
|
|
20
22
|
import { isIosDevice, keyCodes, isPrintableKeyCode } from '@digigov/ui/form/AutoComplete/utils';
|
|
23
|
+
import Checkbox, { CheckboxItem } from "../Checkbox";
|
|
24
|
+
import { Chip, ChipContainer } from '@digigov/ui/content/Chip';
|
|
25
|
+
import Button from '@digigov/ui/form/Button';
|
|
26
|
+
import { NormalText } from '@digigov/ui/typography/NormalText';
|
|
27
|
+
var _ref2 = /*#__PURE__*/React.createElement(CaretIcon, {
|
|
28
|
+
direction: "down",
|
|
29
|
+
size: "md"
|
|
30
|
+
});
|
|
31
|
+
var _ref3 = /*#__PURE__*/React.createElement(CaretIcon, {
|
|
32
|
+
direction: "down",
|
|
33
|
+
size: "md"
|
|
34
|
+
});
|
|
21
35
|
var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
22
36
|
_inherits(AutoComplete, _Component);
|
|
23
37
|
function AutoComplete(props) {
|
|
@@ -26,32 +40,41 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
|
26
40
|
_this = _callSuper(this, AutoComplete, [props]);
|
|
27
41
|
_this.elementReferences = {};
|
|
28
42
|
_this.$pollInput = void 0;
|
|
29
|
-
|
|
43
|
+
var customState = {};
|
|
44
|
+
if (Array.isArray(props.defaultValue)) {
|
|
45
|
+
customState.selectedValues = props.defaultValue;
|
|
46
|
+
} else if (props.defaultValue) {
|
|
47
|
+
customState.selectedValues = [props.defaultValue];
|
|
48
|
+
}
|
|
49
|
+
_this.state = _extends({
|
|
30
50
|
focused: null,
|
|
31
51
|
hovered: null,
|
|
32
52
|
menuOpen: false,
|
|
33
|
-
options:
|
|
34
|
-
query: props.defaultValue,
|
|
53
|
+
options: [],
|
|
54
|
+
query: _this.props.multiple ? '' : props.defaultValue || '',
|
|
55
|
+
selectedValues: [],
|
|
35
56
|
validChoiceMade: false,
|
|
36
57
|
selected: null,
|
|
37
58
|
ariaHint: true
|
|
38
|
-
};
|
|
59
|
+
}, customState);
|
|
39
60
|
_this.handleComponentBlur = _this.handleComponentBlur.bind(_assertThisInitialized(_this));
|
|
61
|
+
_this.handleAutoCompleteBlur = _this.handleAutoCompleteBlur.bind(_assertThisInitialized(_this));
|
|
40
62
|
_this.handleKeyDown = _this.handleKeyDown.bind(_assertThisInitialized(_this));
|
|
41
63
|
_this.handleUpArrow = _this.handleUpArrow.bind(_assertThisInitialized(_this));
|
|
42
64
|
_this.handleDownArrow = _this.handleDownArrow.bind(_assertThisInitialized(_this));
|
|
43
65
|
_this.handleEnter = _this.handleEnter.bind(_assertThisInitialized(_this));
|
|
44
66
|
_this.handlePrintableKey = _this.handlePrintableKey.bind(_assertThisInitialized(_this));
|
|
45
67
|
_this.handleListMouseLeave = _this.handleListMouseLeave.bind(_assertThisInitialized(_this));
|
|
46
|
-
|
|
47
|
-
|
|
68
|
+
if (_this.props.multiple) {
|
|
69
|
+
_this.handleOptionClick = _this.handleOptionClickMultiple.bind(_assertThisInitialized(_this));
|
|
70
|
+
} else {
|
|
71
|
+
_this.handleOptionClick = _this.handleOptionClick.bind(_assertThisInitialized(_this));
|
|
72
|
+
}
|
|
48
73
|
_this.handleOptionFocus = _this.handleOptionFocus.bind(_assertThisInitialized(_this));
|
|
49
74
|
_this.handleOptionMouseDown = _this.handleOptionMouseDown.bind(_assertThisInitialized(_this));
|
|
50
75
|
_this.handleOptionMouseEnter = _this.handleOptionMouseEnter.bind(_assertThisInitialized(_this));
|
|
51
|
-
_this.handleInputBlur = _this.handleInputBlur.bind(_assertThisInitialized(_this));
|
|
52
76
|
_this.handleInputChange = _this.handleInputChange.bind(_assertThisInitialized(_this));
|
|
53
77
|
_this.handleInputFocus = _this.handleInputFocus.bind(_assertThisInitialized(_this));
|
|
54
|
-
_this.pollInputElement = _this.pollInputElement.bind(_assertThisInitialized(_this));
|
|
55
78
|
_this.getDirectInputChanges = _this.getDirectInputChanges.bind(_assertThisInitialized(_this));
|
|
56
79
|
return _this;
|
|
57
80
|
}
|
|
@@ -66,32 +89,14 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
|
66
89
|
}, {
|
|
67
90
|
key: "componentDidMount",
|
|
68
91
|
value: function componentDidMount() {
|
|
69
|
-
this.pollInputElement();
|
|
70
|
-
}
|
|
71
|
-
}, {
|
|
72
|
-
key: "componentWillUnmount",
|
|
73
|
-
value: function componentWillUnmount() {
|
|
74
|
-
clearTimeout(this.$pollInput);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Applications like Dragon NaturallySpeaking will modify the
|
|
78
|
-
// `input` field by directly changing its `.value`. These events
|
|
79
|
-
// don't trigger our JavaScript event listeners, so we need to poll
|
|
80
|
-
// to handle when and if they occur.
|
|
81
|
-
}, {
|
|
82
|
-
key: "pollInputElement",
|
|
83
|
-
value: function pollInputElement() {
|
|
84
|
-
var _this3 = this;
|
|
85
92
|
this.getDirectInputChanges();
|
|
86
|
-
this.$pollInput = setTimeout(function () {
|
|
87
|
-
_this3.pollInputElement();
|
|
88
|
-
}, 100);
|
|
89
93
|
}
|
|
90
94
|
}, {
|
|
91
95
|
key: "getDirectInputChanges",
|
|
92
96
|
value: function getDirectInputChanges() {
|
|
97
|
+
var _this$state$query;
|
|
93
98
|
var inputReference = this.elementReferences[-1];
|
|
94
|
-
var queryHasChanged = inputReference && inputReference.value !== this.state.query;
|
|
99
|
+
var queryHasChanged = inputReference && inputReference.value !== ((_this$state$query = this.state.query) !== null && _this$state$query !== void 0 ? _this$state$query : '');
|
|
95
100
|
if (queryHasChanged) {
|
|
96
101
|
this.handleInputChange({
|
|
97
102
|
target: {
|
|
@@ -137,7 +142,7 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
|
137
142
|
key: "templateSuggestion",
|
|
138
143
|
value: function templateSuggestion(value) {
|
|
139
144
|
var suggestionTemplate = this.props.templates && this.props.templates.suggestion;
|
|
140
|
-
return suggestionTemplate ? suggestionTemplate(value) : value;
|
|
145
|
+
return suggestionTemplate ? suggestionTemplate(value, this.state.query) : value;
|
|
141
146
|
}
|
|
142
147
|
}, {
|
|
143
148
|
key: "handleComponentBlur",
|
|
@@ -149,14 +154,14 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
|
149
154
|
var newQuery;
|
|
150
155
|
if (this.props.confirmOnBlur) {
|
|
151
156
|
var _this$props$onConfirm, _this$props;
|
|
152
|
-
newQuery = newState.query || query;
|
|
157
|
+
newQuery = (newState === null || newState === void 0 ? void 0 : newState.query) || query;
|
|
153
158
|
(_this$props$onConfirm = (_this$props = this.props).onConfirm) === null || _this$props$onConfirm === void 0 ? void 0 : _this$props$onConfirm.call(_this$props, options[selected]);
|
|
154
159
|
} else {
|
|
155
160
|
newQuery = query;
|
|
156
161
|
}
|
|
157
162
|
this.setState({
|
|
158
163
|
focused: null,
|
|
159
|
-
menuOpen: newState.menuOpen || false,
|
|
164
|
+
menuOpen: (newState === null || newState === void 0 ? void 0 : newState.menuOpen) || false,
|
|
160
165
|
query: newQuery,
|
|
161
166
|
selected: null,
|
|
162
167
|
validChoiceMade: this.isQueryAnOption(newQuery, options)
|
|
@@ -170,40 +175,33 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
|
170
175
|
});
|
|
171
176
|
}
|
|
172
177
|
}, {
|
|
173
|
-
key: "
|
|
174
|
-
value: function
|
|
178
|
+
key: "handleAutoCompleteBlur",
|
|
179
|
+
value: function handleAutoCompleteBlur(event, index) {
|
|
175
180
|
var _this$state2 = this.state,
|
|
176
181
|
focused = _this$state2.focused,
|
|
177
|
-
menuOpen = _this$state2.menuOpen,
|
|
178
182
|
options = _this$state2.options,
|
|
183
|
+
query = _this$state2.query,
|
|
179
184
|
selected = _this$state2.selected;
|
|
180
|
-
var focusingOutsideComponent =
|
|
185
|
+
var focusingOutsideComponent = false;
|
|
186
|
+
if (event.relatedTarget === null) {
|
|
187
|
+
focusingOutsideComponent = true;
|
|
188
|
+
} else {
|
|
189
|
+
// This affects if we have multiple autocompletes in same page and we click the first button-arrow and then another button-arrow
|
|
190
|
+
focusingOutsideComponent = this.elementReferences['button-arrow'] !== event.relatedTarget;
|
|
191
|
+
}
|
|
181
192
|
var focusingInput = event.relatedTarget === this.elementReferences[-1];
|
|
182
|
-
var
|
|
183
|
-
var
|
|
184
|
-
if (
|
|
185
|
-
|
|
186
|
-
this.handleComponentBlur({
|
|
187
|
-
menuOpen: keepMenuOpen,
|
|
188
|
-
query: this.templateInputValue(options[selected])
|
|
189
|
-
});
|
|
193
|
+
var focusingButtonArrow = this.elementReferences['button-arrow'] === event.relatedTarget || false;
|
|
194
|
+
var focusingAnotherOption = focused !== null && focused !== -1;
|
|
195
|
+
if (index !== undefined) {
|
|
196
|
+
focusingAnotherOption = focused !== index && focused !== -1;
|
|
190
197
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
var _this$state3 = this.state,
|
|
196
|
-
focused = _this$state3.focused,
|
|
197
|
-
menuOpen = _this$state3.menuOpen,
|
|
198
|
-
options = _this$state3.options,
|
|
199
|
-
query = _this$state3.query,
|
|
200
|
-
selected = _this$state3.selected;
|
|
201
|
-
var focusingAnOption = focused !== -1;
|
|
202
|
-
if (!focusingAnOption) {
|
|
203
|
-
var keepMenuOpen = menuOpen && isIosDevice();
|
|
198
|
+
// Check if the user clicks outside and not either on option, either on input or on button arrow
|
|
199
|
+
var blurComponent = focusingOutsideComponent && !(focusingAnotherOption || focusingInput || focusingButtonArrow);
|
|
200
|
+
if (blurComponent) {
|
|
201
|
+
// In handleInputBlur:
|
|
204
202
|
var newQuery = isIosDevice() ? query : this.templateInputValue(options[selected]);
|
|
205
203
|
this.handleComponentBlur({
|
|
206
|
-
menuOpen:
|
|
204
|
+
menuOpen: false,
|
|
207
205
|
query: newQuery
|
|
208
206
|
});
|
|
209
207
|
}
|
|
@@ -211,37 +209,27 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
|
211
209
|
}, {
|
|
212
210
|
key: "handleInputChange",
|
|
213
211
|
value: function handleInputChange(event) {
|
|
214
|
-
var
|
|
212
|
+
var _this3 = this;
|
|
215
213
|
var _this$props2 = this.props,
|
|
216
|
-
minLength = _this$props2.minLength,
|
|
217
214
|
source = _this$props2.source,
|
|
218
|
-
|
|
215
|
+
minLength = _this$props2.minLength;
|
|
219
216
|
var autoselect = this.hasAutoselect();
|
|
220
217
|
var query = event.target.value;
|
|
221
218
|
var queryEmpty = query.length === 0;
|
|
222
|
-
var queryChanged = this.state.query.length !== query.length;
|
|
223
|
-
var queryLongEnough = query.length >= minLength;
|
|
224
219
|
this.setState({
|
|
225
220
|
query: query,
|
|
226
221
|
ariaHint: queryEmpty
|
|
227
222
|
});
|
|
228
|
-
var
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
validChoiceMade: false
|
|
237
|
-
});
|
|
223
|
+
var minLengthQuery = minLength != undefined && minLength > query.length ? '' : query;
|
|
224
|
+
source(minLengthQuery, function (options) {
|
|
225
|
+
var optionsAvailable = options.length > 0;
|
|
226
|
+
_this3.setState({
|
|
227
|
+
menuOpen: optionsAvailable,
|
|
228
|
+
options: options,
|
|
229
|
+
selected: autoselect && optionsAvailable ? 0 : -1,
|
|
230
|
+
validChoiceMade: false
|
|
238
231
|
});
|
|
239
|
-
}
|
|
240
|
-
this.setState({
|
|
241
|
-
menuOpen: false,
|
|
242
|
-
options: []
|
|
243
|
-
});
|
|
244
|
-
}
|
|
232
|
+
});
|
|
245
233
|
}
|
|
246
234
|
}, {
|
|
247
235
|
key: "handleInputClick",
|
|
@@ -251,10 +239,12 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
|
251
239
|
}, {
|
|
252
240
|
key: "handleInputFocus",
|
|
253
241
|
value: function handleInputFocus() {
|
|
254
|
-
var
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
242
|
+
var _this4 = this;
|
|
243
|
+
var source = this.props.source;
|
|
244
|
+
var _this$state3 = this.state,
|
|
245
|
+
query = _this$state3.query,
|
|
246
|
+
validChoiceMade = _this$state3.validChoiceMade,
|
|
247
|
+
options = _this$state3.options;
|
|
258
248
|
var minLength = this.props.minLength;
|
|
259
249
|
var shouldReopenMenu = !validChoiceMade && query.length >= minLength && options.length > 0;
|
|
260
250
|
if (shouldReopenMenu) {
|
|
@@ -267,8 +257,11 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
|
267
257
|
};
|
|
268
258
|
});
|
|
269
259
|
} else {
|
|
270
|
-
|
|
271
|
-
|
|
260
|
+
source(query, function (options) {
|
|
261
|
+
_this4.setState({
|
|
262
|
+
focused: -1,
|
|
263
|
+
options: options
|
|
264
|
+
});
|
|
272
265
|
});
|
|
273
266
|
}
|
|
274
267
|
}
|
|
@@ -292,18 +285,43 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
|
292
285
|
});
|
|
293
286
|
}
|
|
294
287
|
}
|
|
288
|
+
}, {
|
|
289
|
+
key: "handleOptionClickMultiple",
|
|
290
|
+
value: function handleOptionClickMultiple(index) {
|
|
291
|
+
var _this$props$onConfirm2, _this$props3;
|
|
292
|
+
var selectedOption = this.state.options[index];
|
|
293
|
+
var selectedValues = this.state.selectedValues;
|
|
294
|
+
if (this.state.selectedValues.indexOf(selectedOption) === -1) {
|
|
295
|
+
selectedValues = selectedValues.concat([selectedOption]);
|
|
296
|
+
} else {
|
|
297
|
+
selectedValues.splice(this.state.selectedValues.indexOf(selectedOption), 1);
|
|
298
|
+
}
|
|
299
|
+
(_this$props$onConfirm2 = (_this$props3 = this.props).onConfirm) === null || _this$props$onConfirm2 === void 0 ? void 0 : _this$props$onConfirm2.call(_this$props3, selectedValues);
|
|
300
|
+
this.setState({
|
|
301
|
+
focused: index,
|
|
302
|
+
hovered: null,
|
|
303
|
+
menuOpen: true,
|
|
304
|
+
query: '',
|
|
305
|
+
selectedValues: selectedValues,
|
|
306
|
+
selected: index,
|
|
307
|
+
validChoiceMade: true
|
|
308
|
+
});
|
|
309
|
+
this.forceUpdate();
|
|
310
|
+
}
|
|
295
311
|
}, {
|
|
296
312
|
key: "handleOptionClick",
|
|
297
313
|
value: function handleOptionClick(index) {
|
|
298
|
-
var _this$props$
|
|
314
|
+
var _this$props$onConfirm3, _this$props4;
|
|
299
315
|
var selectedOption = this.state.options[index];
|
|
300
316
|
var newQuery = this.templateInputValue(selectedOption);
|
|
301
|
-
(_this$props$
|
|
317
|
+
(_this$props$onConfirm3 = (_this$props4 = this.props).onConfirm) === null || _this$props$onConfirm3 === void 0 ? void 0 : _this$props$onConfirm3.call(_this$props4, selectedOption);
|
|
318
|
+
var selectedValues = this.props.multiple ? this.state.selectedValues.concat(selectedOption) : [selectedOption];
|
|
302
319
|
this.setState({
|
|
303
320
|
focused: -1,
|
|
304
321
|
hovered: null,
|
|
305
322
|
menuOpen: false,
|
|
306
323
|
query: newQuery,
|
|
324
|
+
selectedValues: selectedValues,
|
|
307
325
|
selected: -1,
|
|
308
326
|
validChoiceMade: true
|
|
309
327
|
});
|
|
@@ -324,9 +342,9 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
|
324
342
|
key: "handleUpArrow",
|
|
325
343
|
value: function handleUpArrow(event) {
|
|
326
344
|
event.preventDefault();
|
|
327
|
-
var _this$
|
|
328
|
-
menuOpen = _this$
|
|
329
|
-
selected = _this$
|
|
345
|
+
var _this$state4 = this.state,
|
|
346
|
+
menuOpen = _this$state4.menuOpen,
|
|
347
|
+
selected = _this$state4.selected;
|
|
330
348
|
var isNotAtTop = selected !== -1;
|
|
331
349
|
var allowMoveUp = isNotAtTop && menuOpen;
|
|
332
350
|
if (allowMoveUp) {
|
|
@@ -339,7 +357,7 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
|
339
357
|
var _this5 = this;
|
|
340
358
|
event.preventDefault();
|
|
341
359
|
// if not open, open
|
|
342
|
-
if (this.
|
|
360
|
+
if (this.state.menuOpen === false) {
|
|
343
361
|
event.preventDefault();
|
|
344
362
|
this.props.source('', function (options) {
|
|
345
363
|
_this5.setState({
|
|
@@ -351,10 +369,10 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
|
351
369
|
});
|
|
352
370
|
});
|
|
353
371
|
} else if (this.state.menuOpen === true) {
|
|
354
|
-
var _this$
|
|
355
|
-
menuOpen = _this$
|
|
356
|
-
_options = _this$
|
|
357
|
-
selected = _this$
|
|
372
|
+
var _this$state5 = this.state,
|
|
373
|
+
menuOpen = _this$state5.menuOpen,
|
|
374
|
+
_options = _this$state5.options,
|
|
375
|
+
selected = _this$state5.selected;
|
|
358
376
|
var isNotAtBottom = selected !== _options.length - 1;
|
|
359
377
|
var allowMoveDown = isNotAtBottom && menuOpen;
|
|
360
378
|
if (allowMoveDown) {
|
|
@@ -367,7 +385,7 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
|
367
385
|
value: function handleSpace(event) {
|
|
368
386
|
var _this6 = this;
|
|
369
387
|
// if not open, open
|
|
370
|
-
if (this.
|
|
388
|
+
if (this.state.menuOpen === false && this.state.query === '') {
|
|
371
389
|
event.preventDefault();
|
|
372
390
|
this.props.source('', function (options) {
|
|
373
391
|
_this6.setState({
|
|
@@ -390,6 +408,12 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
|
390
408
|
var hasSelectedOption = this.state.selected >= 0;
|
|
391
409
|
if (hasSelectedOption) {
|
|
392
410
|
this.handleOptionClick(this.state.selected);
|
|
411
|
+
if (this.props.multiple) {
|
|
412
|
+
this.setState({
|
|
413
|
+
menuOpen: false,
|
|
414
|
+
focused: -1
|
|
415
|
+
});
|
|
416
|
+
}
|
|
393
417
|
}
|
|
394
418
|
}
|
|
395
419
|
}
|
|
@@ -426,6 +450,15 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
|
426
450
|
query: this.state.query
|
|
427
451
|
});
|
|
428
452
|
break;
|
|
453
|
+
case 'backspace':
|
|
454
|
+
if (this.props.multiple) {
|
|
455
|
+
if (this.state.query.length === 0) {
|
|
456
|
+
this.setState({
|
|
457
|
+
selectedValues: this.state.selectedValues.slice(0, -1)
|
|
458
|
+
});
|
|
459
|
+
break;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
429
462
|
default:
|
|
430
463
|
if (isPrintableKeyCode(event.keyCode)) {
|
|
431
464
|
this.handlePrintableKey(event);
|
|
@@ -436,40 +469,39 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
|
436
469
|
}, {
|
|
437
470
|
key: "render",
|
|
438
471
|
value: function render() {
|
|
439
|
-
var
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
minLength = _this$
|
|
445
|
-
name = _this$
|
|
446
|
-
placeholder = _this$
|
|
447
|
-
required = _this$
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
var _this$
|
|
457
|
-
focused = _this$
|
|
458
|
-
hovered = _this$
|
|
459
|
-
menuOpen = _this$
|
|
460
|
-
options = _this$
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
validChoiceMade = _this$state7.validChoiceMade;
|
|
472
|
+
var _this$state$query2,
|
|
473
|
+
_this7 = this;
|
|
474
|
+
var _this$props5 = this.props,
|
|
475
|
+
id = _this$props5.id,
|
|
476
|
+
width = _this$props5.width,
|
|
477
|
+
minLength = _this$props5.minLength,
|
|
478
|
+
name = _this$props5.name,
|
|
479
|
+
placeholder = _this$props5.placeholder,
|
|
480
|
+
required = _this$props5.required,
|
|
481
|
+
tNoResults = _this$props5.tNoResults,
|
|
482
|
+
tStatusQueryTooShort = _this$props5.tStatusQueryTooShort,
|
|
483
|
+
tStatusNoResults = _this$props5.tStatusNoResults,
|
|
484
|
+
tStatusSelectedOption = _this$props5.tStatusSelectedOption,
|
|
485
|
+
tStatusResults = _this$props5.tStatusResults,
|
|
486
|
+
tAssistiveHint = _this$props5.tAssistiveHint,
|
|
487
|
+
multiple = _this$props5.multiple,
|
|
488
|
+
source = _this$props5.source;
|
|
489
|
+
var _this$state6 = this.state,
|
|
490
|
+
focused = _this$state6.focused,
|
|
491
|
+
hovered = _this$state6.hovered,
|
|
492
|
+
menuOpen = _this$state6.menuOpen,
|
|
493
|
+
options = _this$state6.options,
|
|
494
|
+
selected = _this$state6.selected,
|
|
495
|
+
ariaHint = _this$state6.ariaHint,
|
|
496
|
+
validChoiceMade = _this$state6.validChoiceMade;
|
|
465
497
|
var autoselect = this.hasAutoselect();
|
|
498
|
+
var query = (_this$state$query2 = this.state.query) !== null && _this$state$query2 !== void 0 ? _this$state$query2 : '';
|
|
466
499
|
var inputFocused = focused === -1;
|
|
467
500
|
var noOptionsAvailable = options.length === 0;
|
|
468
501
|
var queryNotEmpty = query.length !== 0;
|
|
469
502
|
var queryLongEnough = query.length >= minLength;
|
|
470
|
-
var showNoOptionsFound =
|
|
503
|
+
var showNoOptionsFound = inputFocused && noOptionsAvailable && queryNotEmpty && queryLongEnough;
|
|
471
504
|
var componentIsFocused = focused !== null;
|
|
472
|
-
var dropdownArrowClassName = "ds-autocomplete__dropdown-arrow-down";
|
|
473
505
|
var optionFocused = focused !== -1 && focused !== null;
|
|
474
506
|
var menuIsVisible = menuOpen || showNoOptionsFound;
|
|
475
507
|
var selectedOptionText = this.templateInputValue(options[selected]);
|
|
@@ -479,7 +511,57 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
|
479
511
|
var ariaDescribedProp = ariaHint ? {
|
|
480
512
|
'aria-describedby': assistiveHintID
|
|
481
513
|
} : null;
|
|
482
|
-
|
|
514
|
+
var showAutoCompleteResultListItems = function showAutoCompleteResultListItems(options, multiple) {
|
|
515
|
+
{
|
|
516
|
+
return options.map(function (option, index) {
|
|
517
|
+
var showFocused = focused === -1 ? selected === index : focused === index;
|
|
518
|
+
var iosPosinsetHtml = isIosDevice() ? /*#__PURE__*/React.createElement("span", {
|
|
519
|
+
id: "".concat(id, "__option-suffix--").concat(index),
|
|
520
|
+
style: {
|
|
521
|
+
border: '0',
|
|
522
|
+
clip: 'rect(0 0 0 0)',
|
|
523
|
+
height: '1px',
|
|
524
|
+
marginBottom: '-1px',
|
|
525
|
+
marginRight: '-1px',
|
|
526
|
+
overflow: 'hidden',
|
|
527
|
+
padding: '0',
|
|
528
|
+
position: 'absolute',
|
|
529
|
+
whiteSpace: 'nowrap',
|
|
530
|
+
width: '1px'
|
|
531
|
+
}
|
|
532
|
+
}, index + 1, " \u03B1\u03C0\u03CC ", options.length) : '';
|
|
533
|
+
return /*#__PURE__*/React.createElement(AutoCompleteResultListItem, {
|
|
534
|
+
isFocused: showFocused,
|
|
535
|
+
isHovered: hovered,
|
|
536
|
+
index: index,
|
|
537
|
+
"aria-selected": focused === index ? 'true' : 'false',
|
|
538
|
+
key: index,
|
|
539
|
+
onBlur: function onBlur(event) {
|
|
540
|
+
return _this7.handleAutoCompleteBlur(event, index);
|
|
541
|
+
},
|
|
542
|
+
onClick: function onClick() {
|
|
543
|
+
return _this7.handleOptionClick(index);
|
|
544
|
+
},
|
|
545
|
+
onMouseDown: _this7.handleOptionMouseDown,
|
|
546
|
+
onMouseEnter: function onMouseEnter() {
|
|
547
|
+
return _this7.handleOptionMouseEnter(index);
|
|
548
|
+
},
|
|
549
|
+
ref: function ref(optionEl) {
|
|
550
|
+
_this7.elementReferences[index] = optionEl;
|
|
551
|
+
},
|
|
552
|
+
role: "option",
|
|
553
|
+
tabIndex: -1,
|
|
554
|
+
"aria-posinset": index + 1,
|
|
555
|
+
"aria-setsize": options.length
|
|
556
|
+
}, multiple ? /*#__PURE__*/React.createElement(CheckboxItem, {
|
|
557
|
+
value: option,
|
|
558
|
+
checked: _this7.state.selectedValues.includes(option),
|
|
559
|
+
onChange: function onChange() {}
|
|
560
|
+
}, _this7.templateSuggestion(option)) : _this7.templateSuggestion(option), iosPosinsetHtml);
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
return /*#__PURE__*/React.createElement(AutoCompleteContainer, {
|
|
483
565
|
onKeyDown: this.handleKeyDown,
|
|
484
566
|
width: width
|
|
485
567
|
}, /*#__PURE__*/React.createElement(Status, {
|
|
@@ -495,22 +577,41 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
|
495
577
|
tNoResults: tStatusNoResults,
|
|
496
578
|
tSelectedOption: tStatusSelectedOption,
|
|
497
579
|
tResults: tStatusResults
|
|
498
|
-
}), hintValue && /*#__PURE__*/React.createElement(AutoCompleteInputTypeahead, {
|
|
580
|
+
}), hintValue && (placeholder === '' || !placeholder) && /*#__PURE__*/React.createElement(AutoCompleteInputTypeahead, {
|
|
499
581
|
value: hintValue
|
|
500
|
-
}), /*#__PURE__*/React.createElement(
|
|
582
|
+
}), multiple ? /*#__PURE__*/React.createElement(AutoCompleteMultipleInputContainer, {
|
|
583
|
+
isFocused: componentIsFocused,
|
|
584
|
+
numberOfSelected: this.props.numberOfSelected
|
|
585
|
+
}, /*#__PURE__*/React.createElement(ChipContainer, null, this.state.selectedValues.map(function (value) {
|
|
586
|
+
return /*#__PURE__*/React.createElement(Chip, {
|
|
587
|
+
key: value,
|
|
588
|
+
onDelete: function onDelete() {
|
|
589
|
+
_this7.setState({
|
|
590
|
+
selectedValues: _this7.state.selectedValues.filter(function (v) {
|
|
591
|
+
return v !== value;
|
|
592
|
+
})
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
}, value);
|
|
596
|
+
}), !componentIsFocused && typeof this.props.numberOfSelected === 'number' && this.state.selectedValues.length > this.props.numberOfSelected && /*#__PURE__*/React.createElement(NormalText, {
|
|
597
|
+
fontWeight: "bold",
|
|
598
|
+
margin: 0
|
|
599
|
+
}, "+", this.state.selectedValues.length - this.props.numberOfSelected)), /*#__PURE__*/React.createElement(AutoCompleteMultipleInput, _extends({
|
|
501
600
|
"aria-expanded": menuOpen ? 'true' : 'false',
|
|
502
601
|
"aria-activedescendant": optionFocused ? "".concat(id, "__option--").concat(focused) : '',
|
|
503
602
|
"aria-owns": "".concat(id, "__listbox"),
|
|
504
603
|
"aria-autocomplete": this.hasAutoselect() ? 'both' : 'list'
|
|
505
604
|
}, ariaDescribedProp, {
|
|
506
|
-
autoComplete: "off"
|
|
507
|
-
isFocused
|
|
508
|
-
|
|
605
|
+
autoComplete: "off"
|
|
606
|
+
// isFocused={componentIsFocused}
|
|
607
|
+
,
|
|
509
608
|
id: id,
|
|
510
609
|
onClick: function onClick(event) {
|
|
511
610
|
return _this7.handleInputClick(event);
|
|
512
611
|
},
|
|
513
|
-
onBlur:
|
|
612
|
+
onBlur: function onBlur(event) {
|
|
613
|
+
return _this7.handleAutoCompleteBlur(event);
|
|
614
|
+
},
|
|
514
615
|
onChange: this.handleInputChange,
|
|
515
616
|
onFocus: this.handleInputFocus,
|
|
516
617
|
name: name,
|
|
@@ -521,80 +622,85 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
|
521
622
|
role: "combobox",
|
|
522
623
|
required: required,
|
|
523
624
|
value: query
|
|
524
|
-
})),
|
|
525
|
-
|
|
625
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
626
|
+
ref: function ref(buttonElement) {
|
|
627
|
+
_this7.elementReferences['button-arrow'] = buttonElement;
|
|
628
|
+
},
|
|
629
|
+
variant: "link",
|
|
526
630
|
onClick: function onClick() {
|
|
527
|
-
_this7.
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
631
|
+
if (!_this7.state.menuOpen) {
|
|
632
|
+
source(query, function (options) {
|
|
633
|
+
var optionsAvailable = options.length > 0;
|
|
634
|
+
_this7.setState({
|
|
635
|
+
menuOpen: optionsAvailable,
|
|
636
|
+
options: options,
|
|
637
|
+
selected: autoselect && optionsAvailable ? 0 : -1,
|
|
638
|
+
validChoiceMade: false
|
|
639
|
+
});
|
|
640
|
+
});
|
|
641
|
+
} else {
|
|
642
|
+
_this7.setState({
|
|
643
|
+
menuOpen: false,
|
|
644
|
+
focused: null
|
|
645
|
+
});
|
|
646
|
+
}
|
|
533
647
|
},
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
648
|
+
onBlur: function onBlur(event) {
|
|
649
|
+
return _this7.handleAutoCompleteBlur(event);
|
|
650
|
+
}
|
|
651
|
+
}, _ref2), /*#__PURE__*/React.createElement(AutoCompleteResultList, {
|
|
537
652
|
isVisible: menuIsVisible,
|
|
538
653
|
onMouseLeave: function onMouseLeave() {
|
|
539
654
|
return _this7.handleListMouseLeave();
|
|
540
655
|
},
|
|
541
656
|
id: "".concat(id, "__listbox"),
|
|
542
657
|
role: "listbox"
|
|
543
|
-
},
|
|
544
|
-
var showFocused = focused === -1 ? selected === index : focused === index;
|
|
545
|
-
var iosPosinsetHtml = isIosDevice() ? /*#__PURE__*/React.createElement("span", {
|
|
546
|
-
id: "".concat(id, "__option-suffix--").concat(index),
|
|
547
|
-
style: {
|
|
548
|
-
border: '0',
|
|
549
|
-
clip: 'rect(0 0 0 0)',
|
|
550
|
-
height: '1px',
|
|
551
|
-
marginBottom: '-1px',
|
|
552
|
-
marginRight: '-1px',
|
|
553
|
-
overflow: 'hidden',
|
|
554
|
-
padding: '0',
|
|
555
|
-
position: 'absolute',
|
|
556
|
-
whiteSpace: 'nowrap',
|
|
557
|
-
width: '1px'
|
|
558
|
-
}
|
|
559
|
-
}, index + 1, " \u03B1\u03C0\u03CC ", options.length) : '';
|
|
560
|
-
return /*#__PURE__*/React.createElement(AutoCompleteResultListItem, {
|
|
561
|
-
isFocused: showFocused,
|
|
562
|
-
isHovered: hovered,
|
|
563
|
-
index: index,
|
|
564
|
-
"aria-selected": focused === index ? 'true' : 'false',
|
|
565
|
-
key: index,
|
|
566
|
-
onBlur: function onBlur(event) {
|
|
567
|
-
return _this7.handleOptionBlur(event, index);
|
|
568
|
-
},
|
|
569
|
-
onClick: function onClick() {
|
|
570
|
-
return _this7.handleOptionClick(index);
|
|
571
|
-
},
|
|
572
|
-
onMouseDown: _this7.handleOptionMouseDown,
|
|
573
|
-
onMouseEnter: function onMouseEnter() {
|
|
574
|
-
return _this7.handleOptionMouseEnter(index);
|
|
575
|
-
},
|
|
576
|
-
ref: function ref(optionEl) {
|
|
577
|
-
_this7.elementReferences[index] = optionEl;
|
|
578
|
-
},
|
|
579
|
-
role: "option",
|
|
580
|
-
tabIndex: -1,
|
|
581
|
-
"aria-posinset": index + 1,
|
|
582
|
-
"aria-setsize": options.length
|
|
583
|
-
}, _this7.templateSuggestion(option), " ", iosPosinsetHtml);
|
|
584
|
-
}), showNoOptionsFound && /*#__PURE__*/React.createElement(AutoCompleteResultListItem, {
|
|
658
|
+
}, /*#__PURE__*/React.createElement(Checkbox, null, showAutoCompleteResultListItems(options, multiple)), showNoOptionsFound && /*#__PURE__*/React.createElement(AutoCompleteResultListItem, {
|
|
585
659
|
empty: true
|
|
586
660
|
}, tNoResults === null || tNoResults === void 0 ? void 0 : tNoResults())), /*#__PURE__*/React.createElement(AutoCompleteAssistiveHint, {
|
|
587
661
|
id: assistiveHintID
|
|
588
|
-
}, tAssistiveHint === null || tAssistiveHint === void 0 ? void 0 : tAssistiveHint()))
|
|
662
|
+
}, tAssistiveHint === null || tAssistiveHint === void 0 ? void 0 : tAssistiveHint())) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AutoCompleteInput, _extends({
|
|
663
|
+
"aria-expanded": menuOpen ? 'true' : 'false',
|
|
664
|
+
"aria-activedescendant": optionFocused ? "".concat(id, "__option--").concat(focused) : '',
|
|
665
|
+
"aria-owns": "".concat(id, "__listbox"),
|
|
666
|
+
"aria-autocomplete": this.hasAutoselect() ? 'both' : 'list'
|
|
667
|
+
}, ariaDescribedProp, {
|
|
668
|
+
autoComplete: "off",
|
|
669
|
+
isFocused: componentIsFocused,
|
|
670
|
+
id: id,
|
|
671
|
+
onClick: function onClick(event) {
|
|
672
|
+
return _this7.handleInputClick(event);
|
|
673
|
+
},
|
|
674
|
+
onBlur: this.handleAutoCompleteBlur,
|
|
675
|
+
onChange: this.handleInputChange,
|
|
676
|
+
onFocus: this.handleInputFocus,
|
|
677
|
+
name: name,
|
|
678
|
+
placeholder: placeholder,
|
|
679
|
+
ref: function ref(inputElement) {
|
|
680
|
+
_this7.elementReferences[-1] = inputElement;
|
|
681
|
+
},
|
|
682
|
+
role: "combobox",
|
|
683
|
+
required: required,
|
|
684
|
+
value: query
|
|
685
|
+
})), _ref3, /*#__PURE__*/React.createElement(AutoCompleteResultList, {
|
|
686
|
+
isVisible: menuIsVisible,
|
|
687
|
+
onMouseLeave: function onMouseLeave() {
|
|
688
|
+
return _this7.handleListMouseLeave();
|
|
689
|
+
},
|
|
690
|
+
id: "".concat(id, "__listbox"),
|
|
691
|
+
role: "listbox"
|
|
692
|
+
}, showAutoCompleteResultListItems(options, false), showNoOptionsFound && /*#__PURE__*/React.createElement(AutoCompleteResultListItem, {
|
|
693
|
+
empty: true
|
|
694
|
+
}, tNoResults === null || tNoResults === void 0 ? void 0 : tNoResults())), /*#__PURE__*/React.createElement(AutoCompleteAssistiveHint, {
|
|
695
|
+
id: assistiveHintID
|
|
696
|
+
}, tAssistiveHint === null || tAssistiveHint === void 0 ? void 0 : tAssistiveHint())));
|
|
589
697
|
}
|
|
590
698
|
}]);
|
|
591
699
|
return AutoComplete;
|
|
592
700
|
}(Component);
|
|
593
701
|
AutoComplete.defaultProps = {
|
|
594
|
-
width: '
|
|
702
|
+
width: 'full',
|
|
595
703
|
autoselect: false,
|
|
596
|
-
defaultValue: '',
|
|
597
|
-
displayMenu: 'overlay',
|
|
598
704
|
minLength: 0,
|
|
599
705
|
name: 'ds-input-autocomplete',
|
|
600
706
|
placeholder: '',
|
|
@@ -602,21 +708,13 @@ AutoComplete.defaultProps = {
|
|
|
602
708
|
return;
|
|
603
709
|
},
|
|
604
710
|
confirmOnBlur: false,
|
|
605
|
-
showNoOptionsFound: true,
|
|
606
|
-
showAllValues: false,
|
|
607
711
|
required: false,
|
|
608
712
|
tNoResults: function tNoResults() {
|
|
609
713
|
return 'No results found';
|
|
610
714
|
},
|
|
611
715
|
tAssistiveHint: function tAssistiveHint() {
|
|
612
716
|
return 'When autocomplete results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures.';
|
|
613
|
-
},
|
|
614
|
-
dropdownArrow: function dropdownArrow(props) {
|
|
615
|
-
return /*#__PURE__*/React.createElement(CaretIcon, _extends({
|
|
616
|
-
direction: "down",
|
|
617
|
-
size: "sm"
|
|
618
|
-
}, props));
|
|
619
717
|
}
|
|
620
718
|
};
|
|
621
719
|
export { AutoComplete as default };
|
|
622
|
-
export { AutoComplete, AutoCompleteInput, AutoCompleteInputTypeahead, AutoCompleteResultList, AutoCompleteResultListItem,
|
|
720
|
+
export { AutoComplete, AutoCompleteInput, AutoCompleteInputTypeahead, AutoCompleteResultList, AutoCompleteResultListItem, AutoCompleteContainer, AutoCompleteAssistiveHint, AutoCompleteMultipleInputContainer, AutoCompleteMultipleInput };
|