@dxc-technology/halstack-react 0.0.0-fcf16fe → 0.0.0-fd47ea5
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/BackgroundColorContext.d.ts +10 -0
- package/BackgroundColorContext.js +47 -0
- package/HalstackContext.d.ts +12 -0
- package/HalstackContext.js +343 -0
- package/accordion/Accordion.d.ts +4 -0
- package/accordion/Accordion.js +239 -0
- package/accordion/Accordion.stories.tsx +395 -0
- package/accordion/Accordion.test.js +71 -0
- package/accordion/types.d.ts +69 -0
- package/accordion/types.js +5 -0
- package/accordion-group/AccordionGroup.d.ts +7 -0
- package/accordion-group/AccordionGroup.js +149 -0
- package/accordion-group/AccordionGroup.stories.tsx +251 -0
- package/accordion-group/AccordionGroup.test.js +126 -0
- package/accordion-group/types.d.ts +79 -0
- package/accordion-group/types.js +5 -0
- package/alert/Alert.d.ts +4 -0
- package/alert/Alert.js +293 -0
- package/alert/Alert.stories.tsx +198 -0
- package/alert/Alert.test.js +92 -0
- package/alert/types.d.ts +49 -0
- package/alert/types.js +5 -0
- package/badge/Badge.d.ts +4 -0
- package/badge/Badge.js +61 -0
- package/badge/types.d.ts +5 -0
- package/badge/types.js +5 -0
- package/bleed/Bleed.d.ts +3 -0
- package/bleed/Bleed.js +51 -0
- package/bleed/Bleed.stories.tsx +341 -0
- package/bleed/types.d.ts +37 -0
- package/bleed/types.js +5 -0
- package/box/Box.d.ts +4 -0
- package/box/Box.js +116 -0
- package/box/Box.stories.tsx +147 -0
- package/box/Box.test.js +18 -0
- package/box/types.d.ts +44 -0
- package/box/types.js +5 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +123 -0
- package/bulleted-list/BulletedList.stories.tsx +200 -0
- package/bulleted-list/types.d.ts +11 -0
- package/bulleted-list/types.js +5 -0
- package/button/Button.d.ts +4 -0
- package/button/Button.js +154 -0
- package/button/Button.stories.tsx +425 -0
- package/button/Button.test.js +35 -0
- package/button/types.d.ts +53 -0
- package/button/types.js +5 -0
- package/card/Card.d.ts +4 -0
- package/card/Card.js +161 -0
- package/card/Card.stories.tsx +201 -0
- package/card/Card.test.js +50 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +68 -0
- package/card/types.js +5 -0
- package/checkbox/Checkbox.d.ts +4 -0
- package/checkbox/Checkbox.js +250 -0
- package/checkbox/Checkbox.stories.tsx +260 -0
- package/checkbox/Checkbox.test.js +155 -0
- package/checkbox/types.d.ts +68 -0
- package/checkbox/types.js +5 -0
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +155 -0
- package/chip/Chip.stories.tsx +206 -0
- package/chip/Chip.test.js +56 -0
- package/chip/types.d.ts +45 -0
- package/chip/types.js +5 -0
- package/common/variables.js +1538 -0
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.d.ts +4 -0
- package/date-input/DateInput.js +269 -0
- package/date-input/DateInput.stories.tsx +304 -0
- package/date-input/DateInput.test.js +835 -0
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +146 -0
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +75 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +126 -0
- package/date-input/types.d.ts +158 -0
- package/date-input/types.js +5 -0
- package/dialog/Dialog.d.ts +4 -0
- package/dialog/Dialog.js +160 -0
- package/dialog/Dialog.stories.tsx +289 -0
- package/dialog/Dialog.test.js +70 -0
- package/dialog/types.d.ts +44 -0
- package/dialog/types.js +5 -0
- package/dropdown/Dropdown.d.ts +4 -0
- package/dropdown/Dropdown.js +388 -0
- package/dropdown/Dropdown.stories.tsx +438 -0
- package/dropdown/Dropdown.test.js +585 -0
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +70 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +81 -0
- package/dropdown/types.d.ts +100 -0
- package/dropdown/types.js +5 -0
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +548 -0
- package/file-input/FileInput.stories.tsx +618 -0
- package/file-input/FileInput.test.js +457 -0
- package/file-input/FileItem.d.ts +4 -0
- package/file-input/FileItem.js +162 -0
- package/file-input/types.d.ts +129 -0
- package/file-input/types.js +5 -0
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +69 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +32 -0
- package/flex/types.js +5 -0
- package/footer/Footer.d.ts +4 -0
- package/footer/Footer.js +185 -0
- package/footer/Footer.stories.tsx +228 -0
- package/footer/Footer.test.js +109 -0
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +77 -0
- package/footer/types.d.ts +66 -0
- package/footer/types.js +5 -0
- package/header/Header.d.ts +7 -0
- package/header/Header.js +303 -0
- package/header/Header.stories.tsx +315 -0
- package/header/Header.test.js +79 -0
- package/header/Icons.d.ts +2 -0
- package/header/Icons.js +34 -0
- package/header/types.d.ts +48 -0
- package/header/types.js +5 -0
- package/heading/Heading.d.ts +4 -0
- package/{dist/heading → heading}/Heading.js +31 -94
- package/heading/Heading.stories.tsx +54 -0
- package/heading/Heading.test.js +186 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/inset/Inset.d.ts +3 -0
- package/inset/Inset.js +51 -0
- package/inset/Inset.stories.tsx +229 -0
- package/inset/types.d.ts +37 -0
- package/inset/types.js +5 -0
- package/layout/ApplicationLayout.d.ts +20 -0
- package/layout/ApplicationLayout.js +171 -0
- package/layout/ApplicationLayout.stories.tsx +162 -0
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +66 -0
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +42 -0
- package/layout/types.js +5 -0
- package/link/Link.d.ts +4 -0
- package/link/Link.js +136 -0
- package/link/Link.stories.tsx +253 -0
- package/link/Link.test.js +83 -0
- package/link/types.d.ts +54 -0
- package/link/types.js +5 -0
- package/main.d.ts +44 -0
- package/{dist/main.js → main.js} +148 -90
- package/nav-tabs/NavTabs.d.ts +8 -0
- package/nav-tabs/NavTabs.js +125 -0
- package/nav-tabs/NavTabs.stories.tsx +260 -0
- package/nav-tabs/NavTabs.test.js +82 -0
- package/nav-tabs/Tab.d.ts +4 -0
- package/nav-tabs/Tab.js +150 -0
- package/nav-tabs/types.d.ts +53 -0
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +76 -0
- package/number-input/NumberInput.stories.tsx +115 -0
- package/number-input/NumberInput.test.js +542 -0
- package/number-input/NumberInputContext.d.ts +4 -0
- package/number-input/NumberInputContext.js +19 -0
- package/number-input/numberInputContextTypes.d.ts +19 -0
- package/number-input/numberInputContextTypes.js +5 -0
- package/number-input/types.d.ts +124 -0
- package/number-input/types.js +5 -0
- package/package.json +48 -40
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +54 -0
- package/paginator/Paginator.d.ts +4 -0
- package/paginator/Paginator.js +165 -0
- package/paginator/Paginator.stories.tsx +87 -0
- package/paginator/Paginator.test.js +315 -0
- package/paginator/types.d.ts +38 -0
- package/paginator/types.js +5 -0
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/password-input/PasswordInput.js +166 -0
- package/password-input/PasswordInput.stories.tsx +131 -0
- package/password-input/PasswordInput.test.js +181 -0
- package/password-input/types.d.ts +110 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.d.ts +4 -0
- package/progress-bar/ProgressBar.js +176 -0
- package/progress-bar/ProgressBar.stories.jsx +93 -0
- package/progress-bar/ProgressBar.test.js +110 -0
- package/progress-bar/types.d.ts +36 -0
- package/progress-bar/types.js +5 -0
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +117 -0
- package/quick-nav/QuickNav.stories.tsx +356 -0
- package/quick-nav/types.d.ts +21 -0
- package/quick-nav/types.js +5 -0
- package/radio-group/Radio.d.ts +4 -0
- package/radio-group/Radio.js +156 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +283 -0
- package/radio-group/RadioGroup.stories.tsx +214 -0
- package/radio-group/RadioGroup.test.js +722 -0
- package/radio-group/types.d.ts +114 -0
- package/radio-group/types.js +5 -0
- package/resultsetTable/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.d.ts +4 -0
- package/resultsetTable/ResultsetTable.js +195 -0
- package/resultsetTable/ResultsetTable.stories.tsx +300 -0
- package/resultsetTable/ResultsetTable.test.js +325 -0
- package/resultsetTable/types.d.ts +67 -0
- package/resultsetTable/types.js +5 -0
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +93 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +169 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +97 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +664 -0
- package/select/Select.stories.tsx +971 -0
- package/select/Select.test.js +2228 -0
- package/select/types.d.ts +210 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.d.ts +10 -0
- package/sidenav/Sidenav.js +266 -0
- package/sidenav/Sidenav.stories.tsx +282 -0
- package/sidenav/Sidenav.test.js +44 -0
- package/sidenav/types.d.ts +73 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +4 -0
- package/slider/Slider.js +343 -0
- package/slider/Slider.stories.tsx +240 -0
- package/slider/Slider.test.js +250 -0
- package/slider/types.d.ts +86 -0
- package/slider/types.js +5 -0
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +250 -0
- package/spinner/Spinner.stories.jsx +129 -0
- package/spinner/Spinner.test.js +64 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/switch/Switch.d.ts +4 -0
- package/switch/Switch.js +262 -0
- package/switch/Switch.stories.tsx +171 -0
- package/switch/Switch.test.js +225 -0
- package/switch/types.d.ts +66 -0
- package/switch/types.js +5 -0
- package/table/Table.d.ts +4 -0
- package/{dist/table → table}/Table.js +14 -24
- package/table/Table.stories.jsx +356 -0
- package/table/Table.test.js +26 -0
- package/table/types.d.ts +21 -0
- package/table/types.js +5 -0
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +133 -0
- package/tabs/Tabs.d.ts +4 -0
- package/tabs/Tabs.js +467 -0
- package/tabs/Tabs.stories.tsx +226 -0
- package/tabs/Tabs.test.js +351 -0
- package/tabs/types.d.ts +92 -0
- package/tabs/types.js +5 -0
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +183 -0
- package/tag/Tag.stories.tsx +155 -0
- package/tag/Tag.test.js +60 -0
- package/tag/types.d.ts +69 -0
- package/tag/types.js +5 -0
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +60 -0
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +84 -0
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +673 -0
- package/text-input/TextInput.stories.tsx +569 -0
- package/text-input/TextInput.test.js +1724 -0
- package/text-input/types.d.ts +197 -0
- package/text-input/types.js +5 -0
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +277 -0
- package/textarea/Textarea.stories.jsx +216 -0
- package/textarea/Textarea.test.js +437 -0
- package/textarea/types.d.ts +137 -0
- package/textarea/types.js +5 -0
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +215 -0
- package/toggle-group/ToggleGroup.stories.tsx +215 -0
- package/toggle-group/ToggleGroup.test.js +156 -0
- package/toggle-group/types.d.ts +105 -0
- package/toggle-group/types.js +5 -0
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +131 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/typography/types.js +5 -0
- package/useTheme.d.ts +2 -0
- package/{dist/useTheme.js → useTheme.js} +2 -2
- package/useTranslatedLabels.d.ts +2 -0
- package/useTranslatedLabels.js +20 -0
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +285 -0
- package/wizard/Wizard.stories.tsx +253 -0
- package/wizard/Wizard.test.js +141 -0
- package/wizard/types.d.ts +65 -0
- package/wizard/types.js +5 -0
- package/README.md +0 -66
- package/babel.config.js +0 -8
- package/dist/BackgroundColorContext.js +0 -46
- package/dist/ThemeContext.js +0 -216
- package/dist/accordion/Accordion.js +0 -346
- package/dist/accordion/Accordion.stories.js +0 -207
- package/dist/accordion/readme.md +0 -96
- package/dist/accordion-group/AccordionGroup.js +0 -188
- package/dist/accordion-group/AccordionGroup.stories.js +0 -207
- package/dist/accordion-group/readme.md +0 -70
- package/dist/alert/Alert.js +0 -388
- package/dist/alert/Alert.stories.js +0 -158
- package/dist/alert/close.svg +0 -4
- package/dist/alert/error.svg +0 -4
- package/dist/alert/info.svg +0 -4
- package/dist/alert/readme.md +0 -43
- package/dist/alert/success.svg +0 -4
- package/dist/alert/warning.svg +0 -4
- package/dist/badge/Badge.js +0 -63
- package/dist/box/Box.js +0 -164
- package/dist/button/Button.js +0 -232
- package/dist/button/Button.stories.js +0 -224
- package/dist/button/readme.md +0 -93
- package/dist/card/Card.js +0 -254
- package/dist/checkbox/Checkbox.js +0 -291
- package/dist/checkbox/Checkbox.stories.js +0 -144
- package/dist/checkbox/readme.md +0 -116
- package/dist/chip/Chip.js +0 -269
- package/dist/common/RequiredComponent.js +0 -40
- package/dist/common/variables.js +0 -1158
- package/dist/date/Date.js +0 -381
- package/dist/date/Date.stories.js +0 -205
- package/dist/date/readme.md +0 -73
- package/dist/dialog/Dialog.js +0 -235
- package/dist/dialog/Dialog.stories.js +0 -217
- package/dist/dialog/readme.md +0 -32
- package/dist/dropdown/Dropdown.js +0 -492
- package/dist/dropdown/Dropdown.stories.js +0 -249
- package/dist/dropdown/baseline-arrow_drop_down.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_down_wh.svg +0 -4
- package/dist/dropdown/baseline-arrow_drop_up.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_up_wh.svg +0 -4
- package/dist/dropdown/readme.md +0 -69
- package/dist/footer/Footer.js +0 -405
- package/dist/footer/Footer.stories.js +0 -94
- package/dist/footer/dxc_logo_wht.png +0 -0
- package/dist/footer/readme.md +0 -41
- package/dist/header/Header.js +0 -431
- package/dist/header/Header.stories.js +0 -176
- package/dist/header/close_icon.svg +0 -1
- package/dist/header/dxc_logo_black.png +0 -0
- package/dist/header/dxc_logo_blk_rgb.svg +0 -6
- package/dist/header/dxc_logo_white.png +0 -0
- package/dist/header/hamb_menu_black.svg +0 -1
- package/dist/header/hamb_menu_white.svg +0 -1
- package/dist/header/readme.md +0 -33
- package/dist/input-text/InputText.js +0 -669
- package/dist/input-text/InputText.stories.js +0 -209
- package/dist/input-text/error.svg +0 -1
- package/dist/input-text/readme.md +0 -91
- package/dist/layout/ApplicationLayout.js +0 -331
- package/dist/layout/facebook.svg +0 -45
- package/dist/layout/linkedin.svg +0 -50
- package/dist/layout/twitter.svg +0 -53
- package/dist/link/Link.js +0 -237
- package/dist/link/readme.md +0 -51
- package/dist/paginator/Paginator.js +0 -283
- package/dist/paginator/images/next.svg +0 -3
- package/dist/paginator/images/nextPage.svg +0 -3
- package/dist/paginator/images/previous.svg +0 -3
- package/dist/paginator/images/previousPage.svg +0 -3
- package/dist/paginator/readme.md +0 -50
- package/dist/progress-bar/ProgressBar.js +0 -206
- package/dist/progress-bar/ProgressBar.stories.js +0 -280
- package/dist/progress-bar/readme.md +0 -63
- package/dist/radio/Radio.js +0 -209
- package/dist/radio/Radio.stories.js +0 -166
- package/dist/radio/readme.md +0 -70
- package/dist/resultsetTable/ResultsetTable.js +0 -358
- package/dist/resultsetTable/arrow_downward-24px_wht.svg +0 -1
- package/dist/resultsetTable/arrow_upward-24px_wht.svg +0 -1
- package/dist/resultsetTable/unfold_more-24px_wht.svg +0 -1
- package/dist/select/Select.js +0 -563
- package/dist/select/Select.stories.js +0 -235
- package/dist/select/readme.md +0 -72
- package/dist/sidenav/Sidenav.js +0 -183
- package/dist/slider/Slider.js +0 -315
- package/dist/slider/Slider.stories.js +0 -241
- package/dist/slider/readme.md +0 -64
- package/dist/spinner/Spinner.js +0 -214
- package/dist/spinner/Spinner.stories.js +0 -183
- package/dist/spinner/readme.md +0 -65
- package/dist/switch/Switch.js +0 -222
- package/dist/switch/Switch.stories.js +0 -134
- package/dist/switch/readme.md +0 -133
- package/dist/tabs/Tabs.js +0 -343
- package/dist/tabs/Tabs.stories.js +0 -130
- package/dist/tabs/readme.md +0 -78
- package/dist/tabs-for-sections/TabsForSections.js +0 -92
- package/dist/tabs-for-sections/readme.md +0 -78
- package/dist/tag/Tag.js +0 -280
- package/dist/textarea/Textarea.js +0 -260
- package/dist/toggle/Toggle.js +0 -220
- package/dist/toggle/Toggle.stories.js +0 -297
- package/dist/toggle/readme.md +0 -80
- package/dist/toggle-group/ToggleGroup.js +0 -241
- package/dist/toggle-group/readme.md +0 -82
- package/dist/upload/Upload.js +0 -205
- package/dist/upload/Upload.stories.js +0 -72
- package/dist/upload/buttons-upload/ButtonsUpload.js +0 -135
- package/dist/upload/buttons-upload/drag-drop-icon.svg +0 -4
- package/dist/upload/buttons-upload/upload-button.svg +0 -1
- package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -325
- package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
- package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
- package/dist/upload/file-upload/FileToUpload.js +0 -184
- package/dist/upload/file-upload/audio-icon.svg +0 -4
- package/dist/upload/file-upload/close.svg +0 -4
- package/dist/upload/file-upload/file-icon.svg +0 -4
- package/dist/upload/file-upload/video-icon.svg +0 -4
- package/dist/upload/files-upload/FilesToUpload.js +0 -123
- package/dist/upload/readme.md +0 -37
- package/dist/upload/transaction/Transaction.js +0 -171
- package/dist/upload/transaction/audio-icon-err.svg +0 -4
- package/dist/upload/transaction/audio-icon.svg +0 -4
- package/dist/upload/transaction/error-icon.svg +0 -4
- package/dist/upload/transaction/file-icon-err.svg +0 -4
- package/dist/upload/transaction/file-icon.svg +0 -4
- package/dist/upload/transaction/image-icon-err.svg +0 -4
- package/dist/upload/transaction/image-icon.svg +0 -4
- package/dist/upload/transaction/success-icon.svg +0 -4
- package/dist/upload/transaction/video-icon-err.svg +0 -4
- package/dist/upload/transaction/video-icon.svg +0 -4
- package/dist/upload/transactions/Transactions.js +0 -138
- package/dist/wizard/Wizard.js +0 -411
- package/dist/wizard/invalid_icon.svg +0 -5
- package/dist/wizard/valid_icon.svg +0 -5
- package/dist/wizard/validation-wrong.svg +0 -6
- package/test/Accordion.test.js +0 -33
- package/test/AccordionGroup.test.js +0 -125
- package/test/Alert.test.js +0 -53
- package/test/Box.test.js +0 -10
- package/test/Button.test.js +0 -18
- package/test/Card.test.js +0 -30
- package/test/Checkbox.test.js +0 -45
- package/test/Chip.test.js +0 -25
- package/test/Date.test.js +0 -393
- package/test/Dialog.test.js +0 -23
- package/test/Dropdown.test.js +0 -130
- package/test/Footer.test.js +0 -99
- package/test/Header.test.js +0 -39
- package/test/Heading.test.js +0 -35
- package/test/InputText.test.js +0 -240
- package/test/Link.test.js +0 -43
- package/test/Paginator.test.js +0 -177
- package/test/ProgressBar.test.js +0 -35
- package/test/Radio.test.js +0 -37
- package/test/ResultsetTable.test.js +0 -330
- package/test/Select.test.js +0 -192
- package/test/Sidenav.test.js +0 -45
- package/test/Slider.test.js +0 -82
- package/test/Spinner.test.js +0 -27
- package/test/Switch.test.js +0 -45
- package/test/Table.test.js +0 -36
- package/test/Tabs.test.js +0 -109
- package/test/TabsForSections.test.js +0 -34
- package/test/Tag.test.js +0 -32
- package/test/TextArea.test.js +0 -52
- package/test/ToggleGroup.test.js +0 -81
- package/test/Upload.test.js +0 -60
- package/test/Wizard.test.js +0 -130
- package/test/mocks/pngMock.js +0 -1
- package/test/mocks/svgMock.js +0 -1
- /package/{dist/common → common}/OpenSans.css +0 -0
- /package/{dist/common → common}/fonts/OpenSans-Bold.ttf +0 -0
- /package/{dist/common → common}/fonts/OpenSans-BoldItalic.ttf +0 -0
- /package/{dist/common → common}/fonts/OpenSans-ExtraBold.ttf +0 -0
- /package/{dist/common → common}/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- /package/{dist/common → common}/fonts/OpenSans-Italic.ttf +0 -0
- /package/{dist/common → common}/fonts/OpenSans-Light.ttf +0 -0
- /package/{dist/common → common}/fonts/OpenSans-LightItalic.ttf +0 -0
- /package/{dist/common → common}/fonts/OpenSans-Regular.ttf +0 -0
- /package/{dist/common → common}/fonts/OpenSans-SemiBold.ttf +0 -0
- /package/{dist/common → common}/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- /package/{dist/common → common}/utils.js +0 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
19
|
+
|
|
20
|
+
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
21
|
+
|
|
22
|
+
var _main = require("../main");
|
|
23
|
+
|
|
24
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
25
|
+
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
|
|
28
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
+
|
|
30
|
+
var getDays = function getDays(innerDate) {
|
|
31
|
+
var monthDayCells = [];
|
|
32
|
+
var lastMonthNumberOfDays = innerDate.set("month", innerDate.get("month") - 1).endOf("month");
|
|
33
|
+
var firstDayOfMonth = innerDate.startOf("month").day() === 0 ? 6 : innerDate.startOf("month").day() - 1;
|
|
34
|
+
var daysInMonth = firstDayOfMonth + innerDate.daysInMonth();
|
|
35
|
+
|
|
36
|
+
for (var i = 0; i < 42; i++) {
|
|
37
|
+
if (i < firstDayOfMonth) {
|
|
38
|
+
monthDayCells.push({
|
|
39
|
+
day: lastMonthNumberOfDays.get("date") - firstDayOfMonth + i + 1,
|
|
40
|
+
month: innerDate.get("month") ? innerDate.get("month") - 1 : 11,
|
|
41
|
+
year: innerDate.set("month", innerDate.get("month") - 1).get("year")
|
|
42
|
+
});
|
|
43
|
+
} else if (i < daysInMonth) {
|
|
44
|
+
monthDayCells.push({
|
|
45
|
+
day: i - firstDayOfMonth + 1,
|
|
46
|
+
month: innerDate.get("month"),
|
|
47
|
+
year: innerDate.get("year")
|
|
48
|
+
});
|
|
49
|
+
} else {
|
|
50
|
+
monthDayCells.push({
|
|
51
|
+
day: i - daysInMonth + 1,
|
|
52
|
+
month: innerDate.get("month") === 11 ? 0 : innerDate.get("month") + 1,
|
|
53
|
+
year: innerDate.set("month", innerDate.get("month") + 1).get("year")
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return monthDayCells;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
var getDateToFocus = function getDateToFocus(selectedDate, innerDate, today) {
|
|
62
|
+
return (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("month")) === innerDate.get("month") && (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("year")) === innerDate.get("year") ? selectedDate : today.get("month") === innerDate.get("month") && today.get("year") === innerDate.get("year") ? today : innerDate.set("date", 1);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
var isDaySelected = function isDaySelected(date, selectedDate) {
|
|
66
|
+
return (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("month")) === date.month && (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("year")) === date.year && (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.get("date")) === date.day;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
var Calendar = function Calendar(_ref) {
|
|
70
|
+
var selectedDate = _ref.selectedDate,
|
|
71
|
+
innerDate = _ref.innerDate,
|
|
72
|
+
onInnerDateChange = _ref.onInnerDateChange,
|
|
73
|
+
onDaySelect = _ref.onDaySelect,
|
|
74
|
+
today = _ref.today;
|
|
75
|
+
|
|
76
|
+
var _useState = (0, _react.useState)(getDateToFocus(selectedDate, innerDate, today)),
|
|
77
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
78
|
+
dateToFocus = _useState2[0],
|
|
79
|
+
setDateToFocus = _useState2[1];
|
|
80
|
+
|
|
81
|
+
var _useState3 = (0, _react.useState)(false),
|
|
82
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
83
|
+
isFocusable = _useState4[0],
|
|
84
|
+
setIsFocusable = _useState4[1];
|
|
85
|
+
|
|
86
|
+
var dayCells = (0, _react.useMemo)(function () {
|
|
87
|
+
return getDays(innerDate);
|
|
88
|
+
}, [innerDate]);
|
|
89
|
+
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
90
|
+
var weekDays = translatedLabels.calendar.daysShort;
|
|
91
|
+
|
|
92
|
+
var onDateClickHandler = function onDateClickHandler(date) {
|
|
93
|
+
var newDate = innerDate.set("month", date.month).set("date", date.day);
|
|
94
|
+
onDaySelect(newDate);
|
|
95
|
+
setDateToFocus(newDate);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
var handleOnBlur = function handleOnBlur(event) {
|
|
99
|
+
if (!(event !== null && event !== void 0 && event.currentTarget.contains(event.relatedTarget))) {
|
|
100
|
+
setDateToFocus(getDateToFocus(selectedDate, innerDate, today));
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
var focusDate = function focusDate(date) {
|
|
105
|
+
if (innerDate.get("month") !== date.get("month") || innerDate.get("year") !== date.get("year")) {
|
|
106
|
+
onInnerDateChange(date);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
setDateToFocus(date);
|
|
110
|
+
setIsFocusable(true);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
(0, _react.useEffect)(function () {
|
|
114
|
+
if (isFocusable) {
|
|
115
|
+
var _document$getElementB;
|
|
116
|
+
|
|
117
|
+
(_document$getElementB = document.getElementById("day_".concat(dateToFocus.get("date"), "_month").concat(dateToFocus.get("month")))) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.focus();
|
|
118
|
+
setIsFocusable(false);
|
|
119
|
+
}
|
|
120
|
+
}, [dateToFocus, isFocusable]);
|
|
121
|
+
(0, _react.useEffect)(function () {
|
|
122
|
+
if (dateToFocus.get("month") !== innerDate.get("month") || dateToFocus.get("year") !== innerDate.get("year")) {
|
|
123
|
+
setDateToFocus(getDateToFocus(selectedDate, innerDate, today));
|
|
124
|
+
}
|
|
125
|
+
}, [innerDate, dateToFocus, selectedDate, today]);
|
|
126
|
+
|
|
127
|
+
var handleDayKeyboardEvent = function handleDayKeyboardEvent(event, date) {
|
|
128
|
+
var dateToFocusTemp = date.month === innerDate.get("month") ? innerDate.set("date", date.day) : innerDate.set("date", date.day).set("month", date.month);
|
|
129
|
+
|
|
130
|
+
switch (event.key) {
|
|
131
|
+
case "PageUp":
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
event.shiftKey ? dateToFocusTemp = dateToFocusTemp.set("year", dateToFocusTemp.get("year") - 1) : dateToFocusTemp = dateToFocusTemp.set("month", dateToFocusTemp.get("month") - 1);
|
|
134
|
+
focusDate(dateToFocusTemp);
|
|
135
|
+
break;
|
|
136
|
+
|
|
137
|
+
case "PageDown":
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
event.shiftKey ? dateToFocusTemp = dateToFocusTemp.set("year", dateToFocusTemp.get("year") + 1) : dateToFocusTemp = dateToFocusTemp.set("month", dateToFocusTemp.get("month") + 1);
|
|
140
|
+
focusDate(dateToFocusTemp);
|
|
141
|
+
break;
|
|
142
|
+
|
|
143
|
+
case "ArrowLeft":
|
|
144
|
+
event.preventDefault();
|
|
145
|
+
dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") - 1);
|
|
146
|
+
focusDate(dateToFocusTemp);
|
|
147
|
+
break;
|
|
148
|
+
|
|
149
|
+
case "ArrowRight":
|
|
150
|
+
event.preventDefault();
|
|
151
|
+
dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") + 1);
|
|
152
|
+
focusDate(dateToFocusTemp);
|
|
153
|
+
break;
|
|
154
|
+
|
|
155
|
+
case "ArrowUp":
|
|
156
|
+
event.preventDefault();
|
|
157
|
+
dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") - 7);
|
|
158
|
+
focusDate(dateToFocusTemp);
|
|
159
|
+
break;
|
|
160
|
+
|
|
161
|
+
case "ArrowDown":
|
|
162
|
+
event.preventDefault();
|
|
163
|
+
dateToFocusTemp = dateToFocusTemp.set("date", dateToFocusTemp.get("date") + 7);
|
|
164
|
+
focusDate(dateToFocusTemp);
|
|
165
|
+
break;
|
|
166
|
+
|
|
167
|
+
case "Home":
|
|
168
|
+
event.preventDefault();
|
|
169
|
+
dateToFocus.get("day") !== 0 ? dateToFocusTemp = dateToFocusTemp.day(1) : dateToFocusTemp = innerDate.date(date.day - 1).day(1);
|
|
170
|
+
focusDate(dateToFocusTemp);
|
|
171
|
+
break;
|
|
172
|
+
|
|
173
|
+
case "End":
|
|
174
|
+
event.preventDefault();
|
|
175
|
+
dateToFocusTemp.get("day") !== 0 && (dateToFocusTemp = dateToFocusTemp.day(7));
|
|
176
|
+
focusDate(dateToFocusTemp);
|
|
177
|
+
break;
|
|
178
|
+
|
|
179
|
+
case " ":
|
|
180
|
+
event.preventDefault();
|
|
181
|
+
onDaySelect(dateToFocusTemp);
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
return /*#__PURE__*/_react["default"].createElement(CalendarContainer, null, /*#__PURE__*/_react["default"].createElement(_main.DxcFlex, {
|
|
187
|
+
alignItems: "center",
|
|
188
|
+
justifyContent: "space-between"
|
|
189
|
+
}, weekDays.map(function (weekDay) {
|
|
190
|
+
return /*#__PURE__*/_react["default"].createElement(WeekHeaderCell, {
|
|
191
|
+
key: weekDay
|
|
192
|
+
}, weekDay);
|
|
193
|
+
})), /*#__PURE__*/_react["default"].createElement(DayCellsContainer, {
|
|
194
|
+
onBlur: handleOnBlur
|
|
195
|
+
}, dayCells.map(function (date, index) {
|
|
196
|
+
return /*#__PURE__*/_react["default"].createElement(DayCell, {
|
|
197
|
+
onKeyDown: function onKeyDown(event) {
|
|
198
|
+
return handleDayKeyboardEvent(event, date);
|
|
199
|
+
},
|
|
200
|
+
"aria-label": date.day,
|
|
201
|
+
id: "day_".concat(date.day, "_month").concat(date.month),
|
|
202
|
+
key: "day_".concat(index),
|
|
203
|
+
onClick: function onClick() {
|
|
204
|
+
return onDateClickHandler(date);
|
|
205
|
+
},
|
|
206
|
+
selected: isDaySelected(date, selectedDate),
|
|
207
|
+
actualMonth: date.month === innerDate.get("month"),
|
|
208
|
+
autoFocus: date.day === dateToFocus.get("date") && date.month === dateToFocus.get("month"),
|
|
209
|
+
"aria-selected": isDaySelected(date, selectedDate),
|
|
210
|
+
tabIndex: date.day === dateToFocus.get("date") && date.month === dateToFocus.get("month") ? 0 : -1,
|
|
211
|
+
isCurrentDay: today.get("date") === date.day && today.get("month") === innerDate.get("month") && today.get("month") === date.month && today.get("year") === innerDate.get("year")
|
|
212
|
+
}, date.day);
|
|
213
|
+
})));
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
var CalendarContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 0px 8px 8px 8px;\n width: 292px;\n font-family: ", ";\n font-size: ", ";\n color: ", ";\n font-weight: ", ";\n"])), function (props) {
|
|
217
|
+
return props.theme.dateInput.pickerFontFamily;
|
|
218
|
+
}, function (props) {
|
|
219
|
+
return props.theme.dateInput.pickerFontSize;
|
|
220
|
+
}, function (props) {
|
|
221
|
+
return props.theme.dateInput.pickerFontColor;
|
|
222
|
+
}, function (props) {
|
|
223
|
+
return props.theme.dateInput.pickerFontWeight;
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
var WeekHeaderCell = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n"])));
|
|
227
|
+
|
|
228
|
+
var DayCellsContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n gap: 4px;\n flex-wrap: wrap;\n justify-content: space-between;\n"])));
|
|
229
|
+
|
|
230
|
+
var DayCell = _styledComponents["default"].button(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n width: 36px;\n height: 36px;\n padding: 0;\n border: none;\n border-radius: 50%;\n cursor: pointer;\n font-family: ", ";\n font-size: ", ";\n color: ", ";\n font-weight: ", ";\n\n &:focus {\n outline: ", " solid 2px;\n }\n &:hover {\n background-color: ", ";\n color: ", ";\n }\n &:active {\n background-color: ", ";\n color: ", ";\n }\n\n ", "\n background-color: ", ";\n color: ", ";\n"])), function (props) {
|
|
231
|
+
return props.theme.dateInput.pickerFontFamily;
|
|
232
|
+
}, function (props) {
|
|
233
|
+
return props.theme.dateInput.pickerFontSize;
|
|
234
|
+
}, function (props) {
|
|
235
|
+
return props.theme.dateInput.pickerFontColor;
|
|
236
|
+
}, function (props) {
|
|
237
|
+
return props.theme.dateInput.pickerFontWeight;
|
|
238
|
+
}, function (props) {
|
|
239
|
+
return props.theme.dateInput.pickerFocusColor;
|
|
240
|
+
}, function (props) {
|
|
241
|
+
return props.selected ? props.theme.dateInput.pickerSelectedBackgroundColor : props.theme.dateInput.pickerHoverBackgroundColor;
|
|
242
|
+
}, function (props) {
|
|
243
|
+
return props.selected ? props.theme.dateInput.pickerSelectedFontColor : props.theme.dateInput.pickerHoverFontColor;
|
|
244
|
+
}, function (props) {
|
|
245
|
+
return props.theme.dateInput.pickerActiveBackgroundColor;
|
|
246
|
+
}, function (props) {
|
|
247
|
+
return props.theme.dateInput.pickerActiveFontColor;
|
|
248
|
+
}, function (props) {
|
|
249
|
+
return props.isCurrentDay && !props.selected && "border: ".concat(props.theme.dateInput.pickerCurrentDateBorderWidth, " solid ").concat(props.theme.dateInput.pickerCurrentDateBorderColor, ";");
|
|
250
|
+
}, function (props) {
|
|
251
|
+
return props.selected ? props.theme.dateInput.pickerSelectedBackgroundColor : "transparent";
|
|
252
|
+
}, function (props) {
|
|
253
|
+
return props.selected ? props.theme.dateInput.pickerSelectedFontColor : props.isCurrentDay ? props.theme.dateInput.pickerCurrentDateFontColor : !props.actualMonth ? props.theme.dateInput.pickerNonCurrentMonthFontColor : props.theme.dateInput.pickerFontColor;
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
var _default = /*#__PURE__*/_react["default"].memo(Calendar);
|
|
257
|
+
|
|
258
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
16
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
20
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
21
|
+
|
|
22
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
23
|
+
|
|
24
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
|
+
|
|
26
|
+
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
27
|
+
|
|
28
|
+
var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
|
|
29
|
+
|
|
30
|
+
var _DatePicker = _interopRequireDefault(require("./DatePicker"));
|
|
31
|
+
|
|
32
|
+
var Popover = _interopRequireWildcard(require("@radix-ui/react-popover"));
|
|
33
|
+
|
|
34
|
+
var _customParseFormat = _interopRequireDefault(require("dayjs/plugin/customParseFormat"));
|
|
35
|
+
|
|
36
|
+
var _uuid = require("uuid");
|
|
37
|
+
|
|
38
|
+
var _Icons = require("./Icons");
|
|
39
|
+
|
|
40
|
+
var _templateObject;
|
|
41
|
+
|
|
42
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
43
|
+
|
|
44
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
45
|
+
|
|
46
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
47
|
+
|
|
48
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
49
|
+
|
|
50
|
+
_dayjs["default"].extend(_customParseFormat["default"]);
|
|
51
|
+
|
|
52
|
+
var getValueForPicker = function getValueForPicker(value, format) {
|
|
53
|
+
return (0, _dayjs["default"])(value, format.toUpperCase(), true);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var getDate = function getDate(value, format, lastValidYear, setLastValidYear) {
|
|
57
|
+
if ((value || value === "") && format.toUpperCase().includes("YYYY")) return getValueForPicker(value, format);else {
|
|
58
|
+
var newDate = getValueForPicker(value, format);
|
|
59
|
+
|
|
60
|
+
if (!lastValidYear) {
|
|
61
|
+
if (+newDate.format("YY") < 68) {
|
|
62
|
+
setLastValidYear(2000 + +newDate.format("YY"));
|
|
63
|
+
newDate = newDate.set("year", 2000 + +newDate.format("YY"));
|
|
64
|
+
} else {
|
|
65
|
+
setLastValidYear(1900 + +newDate.format("YY"));
|
|
66
|
+
newDate = newDate.set("year", 1900 + +newDate.format("YY"));
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
newDate = newDate.set("year", (lastValidYear <= 1999 ? 1900 : 2000) + +newDate.format("YY"));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return newDate;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
77
|
+
var _ref2;
|
|
78
|
+
|
|
79
|
+
var label = _ref.label,
|
|
80
|
+
name = _ref.name,
|
|
81
|
+
_ref$defaultValue = _ref.defaultValue,
|
|
82
|
+
defaultValue = _ref$defaultValue === void 0 ? "" : _ref$defaultValue,
|
|
83
|
+
value = _ref.value,
|
|
84
|
+
_ref$format = _ref.format,
|
|
85
|
+
format = _ref$format === void 0 ? "dd-MM-yyyy" : _ref$format,
|
|
86
|
+
helperText = _ref.helperText,
|
|
87
|
+
_ref$placeholder = _ref.placeholder,
|
|
88
|
+
placeholder = _ref$placeholder === void 0 ? false : _ref$placeholder,
|
|
89
|
+
clearable = _ref.clearable,
|
|
90
|
+
disabled = _ref.disabled,
|
|
91
|
+
optional = _ref.optional,
|
|
92
|
+
onChange = _ref.onChange,
|
|
93
|
+
onBlur = _ref.onBlur,
|
|
94
|
+
error = _ref.error,
|
|
95
|
+
autocomplete = _ref.autocomplete,
|
|
96
|
+
margin = _ref.margin,
|
|
97
|
+
size = _ref.size,
|
|
98
|
+
tabIndex = _ref.tabIndex;
|
|
99
|
+
|
|
100
|
+
var _useState = (0, _react.useState)(defaultValue),
|
|
101
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
102
|
+
innerValue = _useState2[0],
|
|
103
|
+
setInnerValue = _useState2[1];
|
|
104
|
+
|
|
105
|
+
var _useState3 = (0, _react.useState)(false),
|
|
106
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
107
|
+
isOpen = _useState4[0],
|
|
108
|
+
setIsOpen = _useState4[1];
|
|
109
|
+
|
|
110
|
+
var _useState5 = (0, _react.useState)("date-picker-".concat((0, _uuid.v4)())),
|
|
111
|
+
_useState6 = (0, _slicedToArray2["default"])(_useState5, 1),
|
|
112
|
+
calendarId = _useState6[0];
|
|
113
|
+
|
|
114
|
+
var _useState7 = (0, _react.useState)(getValueForPicker((_ref2 = value !== null && value !== void 0 ? value : defaultValue) !== null && _ref2 !== void 0 ? _ref2 : "", format)),
|
|
115
|
+
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
116
|
+
dayjsDate = _useState8[0],
|
|
117
|
+
setDayjsDate = _useState8[1];
|
|
118
|
+
|
|
119
|
+
var _useState9 = (0, _react.useState)(innerValue || value ? !format.toUpperCase().includes("YYYY") && +getValueForPicker(value !== null && value !== void 0 ? value : innerValue, format).format("YY") < 68 ? 2000 : 1900 : undefined),
|
|
120
|
+
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
121
|
+
lastValidYear = _useState10[0],
|
|
122
|
+
setLastValidYear = _useState10[1];
|
|
123
|
+
|
|
124
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
125
|
+
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
126
|
+
var dateRef = (0, _react.useRef)(null);
|
|
127
|
+
(0, _react.useEffect)(function () {
|
|
128
|
+
if (value || value === "") setDayjsDate(getDate(value, format, lastValidYear, setLastValidYear));
|
|
129
|
+
}, [value, format, lastValidYear]);
|
|
130
|
+
(0, _react.useLayoutEffect)(function () {
|
|
131
|
+
if (!disabled) {
|
|
132
|
+
var actionButtonRef = dateRef === null || dateRef === void 0 ? void 0 : dateRef.current.querySelector("[title='Open calendar']");
|
|
133
|
+
actionButtonRef === null || actionButtonRef === void 0 ? void 0 : actionButtonRef.setAttribute("aria-haspopup", true);
|
|
134
|
+
actionButtonRef === null || actionButtonRef === void 0 ? void 0 : actionButtonRef.setAttribute("role", "combobox");
|
|
135
|
+
actionButtonRef === null || actionButtonRef === void 0 ? void 0 : actionButtonRef.setAttribute("aria-expanded", isOpen);
|
|
136
|
+
actionButtonRef === null || actionButtonRef === void 0 ? void 0 : actionButtonRef.setAttribute("aria-controls", calendarId);
|
|
137
|
+
actionButtonRef === null || actionButtonRef === void 0 ? void 0 : actionButtonRef.setAttribute("aria-describedby", calendarId);
|
|
138
|
+
}
|
|
139
|
+
}, [isOpen, disabled, calendarId]);
|
|
140
|
+
|
|
141
|
+
var handleCalendarOnClick = function handleCalendarOnClick(newDate) {
|
|
142
|
+
var newValue = newDate.format(format.toUpperCase());
|
|
143
|
+
|
|
144
|
+
if (!value) {
|
|
145
|
+
setDayjsDate(newDate);
|
|
146
|
+
setInnerValue(newValue);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
setLastValidYear(newDate.get("year"));
|
|
150
|
+
newDate !== null && newDate !== void 0 && newDate.set("day", newDate.get("date")).toJSON() ? onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
151
|
+
value: newValue,
|
|
152
|
+
date: newDate.toDate()
|
|
153
|
+
}) : onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
154
|
+
value: newValue
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
var handleIOnChange = function handleIOnChange(_ref3) {
|
|
159
|
+
var newValue = _ref3.value,
|
|
160
|
+
inputError = _ref3.error;
|
|
161
|
+
value !== null && value !== void 0 ? value : setInnerValue(newValue);
|
|
162
|
+
var newDate = getDate(newValue, format, lastValidYear, setLastValidYear);
|
|
163
|
+
var invalidDateMessage = newValue !== "" && !newDate.isValid() && translatedLabels.dateInput.invalidDateErrorMessage;
|
|
164
|
+
var callbackParams = inputError || invalidDateMessage ? {
|
|
165
|
+
value: newValue,
|
|
166
|
+
error: inputError || invalidDateMessage
|
|
167
|
+
} : {
|
|
168
|
+
value: newValue
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
if (newDate.isValid()) {
|
|
172
|
+
setDayjsDate(newDate);
|
|
173
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread(_objectSpread({}, callbackParams), {}, {
|
|
174
|
+
date: newDate.toDate()
|
|
175
|
+
}));
|
|
176
|
+
} else {
|
|
177
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(callbackParams);
|
|
178
|
+
setLastValidYear(function (validYear) {
|
|
179
|
+
var _dayjsDate$get;
|
|
180
|
+
|
|
181
|
+
return (_dayjsDate$get = dayjsDate === null || dayjsDate === void 0 ? void 0 : dayjsDate.get("year")) !== null && _dayjsDate$get !== void 0 ? _dayjsDate$get : validYear;
|
|
182
|
+
});
|
|
183
|
+
setDayjsDate(null);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
var handleIOnBlur = function handleIOnBlur(_ref4) {
|
|
188
|
+
var value = _ref4.value,
|
|
189
|
+
inputError = _ref4.error;
|
|
190
|
+
var date = getDate(value, format, lastValidYear, setLastValidYear);
|
|
191
|
+
var invalidDateMessage = value !== "" && !date.isValid() && translatedLabels.dateInput.invalidDateErrorMessage;
|
|
192
|
+
var callbackParams = inputError || invalidDateMessage ? {
|
|
193
|
+
value: value,
|
|
194
|
+
error: inputError || invalidDateMessage
|
|
195
|
+
} : {
|
|
196
|
+
value: value
|
|
197
|
+
};
|
|
198
|
+
date.isValid() ? onBlur === null || onBlur === void 0 ? void 0 : onBlur(_objectSpread(_objectSpread({}, callbackParams), {}, {
|
|
199
|
+
date: date.toDate()
|
|
200
|
+
})) : onBlur === null || onBlur === void 0 ? void 0 : onBlur(callbackParams);
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
var openCalendar = function openCalendar() {
|
|
204
|
+
setIsOpen(!isOpen);
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
var closeCalendar = function closeCalendar() {
|
|
208
|
+
setIsOpen(false);
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
var handleDatePickerEscKeydown = function handleDatePickerEscKeydown(event) {
|
|
212
|
+
event.preventDefault();
|
|
213
|
+
closeCalendar();
|
|
214
|
+
dateRef === null || dateRef === void 0 ? void 0 : dateRef.current.getElementsByTagName("input")[0].focus();
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
var handleDatePickerOnBlur = function handleDatePickerOnBlur(event) {
|
|
218
|
+
if (!(event !== null && event !== void 0 && event.currentTarget.contains(event.relatedTarget))) closeCalendar();
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
222
|
+
theme: colorsTheme
|
|
223
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
224
|
+
ref: ref
|
|
225
|
+
}, /*#__PURE__*/_react["default"].createElement(Popover.Root, {
|
|
226
|
+
open: isOpen
|
|
227
|
+
}, /*#__PURE__*/_react["default"].createElement(Popover.Trigger, {
|
|
228
|
+
asChild: true,
|
|
229
|
+
"aria-controls": undefined
|
|
230
|
+
}, /*#__PURE__*/_react["default"].createElement(_TextInput["default"], {
|
|
231
|
+
label: label,
|
|
232
|
+
name: name,
|
|
233
|
+
defaultValue: defaultValue,
|
|
234
|
+
value: value !== null && value !== void 0 ? value : innerValue,
|
|
235
|
+
helperText: helperText,
|
|
236
|
+
placeholder: placeholder ? format.toUpperCase() : null,
|
|
237
|
+
action: {
|
|
238
|
+
onClick: openCalendar,
|
|
239
|
+
icon: _Icons.calendarIcon,
|
|
240
|
+
title: "Open calendar"
|
|
241
|
+
},
|
|
242
|
+
clearable: clearable,
|
|
243
|
+
disabled: disabled,
|
|
244
|
+
optional: optional,
|
|
245
|
+
onChange: handleIOnChange,
|
|
246
|
+
onBlur: handleIOnBlur,
|
|
247
|
+
error: error,
|
|
248
|
+
autocomplete: autocomplete,
|
|
249
|
+
margin: margin,
|
|
250
|
+
size: size,
|
|
251
|
+
tabIndex: tabIndex,
|
|
252
|
+
ref: dateRef
|
|
253
|
+
})), /*#__PURE__*/_react["default"].createElement(StyledContent, {
|
|
254
|
+
sideOffset: error ? -18 : 2,
|
|
255
|
+
align: "end",
|
|
256
|
+
"aria-modal": true,
|
|
257
|
+
onBlur: handleDatePickerOnBlur,
|
|
258
|
+
onEscapeKeyDown: handleDatePickerEscKeydown,
|
|
259
|
+
avoidCollisions: false
|
|
260
|
+
}, /*#__PURE__*/_react["default"].createElement(_DatePicker["default"], {
|
|
261
|
+
id: calendarId,
|
|
262
|
+
onDateSelect: handleCalendarOnClick,
|
|
263
|
+
date: dayjsDate
|
|
264
|
+
})))));
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
var StyledContent = (0, _styledComponents["default"])(Popover.Content)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n &:focus-visible {\n outline: none;\n }\n"])));
|
|
268
|
+
var _default = DxcDateInput;
|
|
269
|
+
exports["default"] = _default;
|