@leaflink/stash 49.5.0 → 50.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Accordion.js +25 -28
- package/dist/Accordion.js.map +1 -1
- package/dist/Accordion.vue.d.ts +16 -16
- package/dist/ActionsDropdown.js +14 -26
- package/dist/ActionsDropdown.js.map +1 -1
- package/dist/ActionsDropdown.vue.d.ts +12 -12
- package/dist/AddressSelect.js +22 -47
- package/dist/AddressSelect.js.map +1 -1
- package/dist/AddressSelect.vue.d.ts +45 -45
- package/dist/Alert.js +4 -6
- package/dist/Alert.js.map +1 -1
- package/dist/Alert.vue.d.ts +18 -18
- package/dist/AppNavigationItem.js +16 -19
- package/dist/AppNavigationItem.js.map +1 -1
- package/dist/AppNavigationItem.vue.d.ts +4 -4
- package/dist/AppSidebar.js +27 -28
- package/dist/AppSidebar.js.map +1 -1
- package/dist/AppSidebar.vue.d.ts +7 -7
- package/dist/AppTopbar.js +12 -17
- package/dist/AppTopbar.js.map +1 -1
- package/dist/AppTopbar.vue.d.ts +8 -8
- package/dist/Avatar.js +1 -1
- package/dist/Avatar.vue.d.ts +22 -22
- package/dist/Backdrop.js +1 -1
- package/dist/Backdrop.vue.d.ts +1 -1
- package/dist/Badge.js +1 -1
- package/dist/Badge.js.map +1 -1
- package/dist/Badge.vue.d.ts +36 -36
- package/dist/Box.js +2 -3
- package/dist/Box.js.map +1 -1
- package/dist/Box.vue.d.ts +12 -12
- package/dist/{Box.vue_vue_type_script_setup_true_lang-69e5176b.js → Box.vue_vue_type_script_setup_true_lang-DgJHq-09.js} +1 -1
- package/dist/{Box.vue_vue_type_script_setup_true_lang-69e5176b.js.map → Box.vue_vue_type_script_setup_true_lang-DgJHq-09.js.map} +1 -1
- package/dist/Button.js +40 -27
- package/dist/Button.js.map +1 -1
- package/dist/Button.vue.d.ts +34 -27
- package/dist/ButtonGroup.js +1 -1
- package/dist/ButtonGroup.vue.d.ts +14 -14
- package/dist/Card.vue.d.ts +3 -3
- package/dist/CardContent.js +1 -1
- package/dist/CardContent.vue.d.ts +1 -1
- package/dist/CardFooter.js +1 -1
- package/dist/CardFooter.vue.d.ts +1 -1
- package/dist/CardMedia.js +11 -14
- package/dist/CardMedia.js.map +1 -1
- package/dist/Carousel.js +179 -180
- package/dist/Carousel.js.map +1 -1
- package/dist/Carousel.vue.d.ts +33 -11
- package/dist/Checkbox.js +38 -35
- package/dist/Checkbox.js.map +1 -1
- package/dist/Checkbox.vue.d.ts +31 -31
- package/dist/ChevronToggle.js +2 -10
- package/dist/ChevronToggle.js.map +1 -1
- package/dist/ChevronToggle.vue.d.ts +5 -5
- package/dist/{ChevronToggle.vue_vue_type_script_setup_true_lang-fcdf0c19.js → ChevronToggle.vue_vue_type_script_setup_true_lang-DuvluoTi.js} +1 -1
- package/dist/{ChevronToggle.vue_vue_type_script_setup_true_lang-fcdf0c19.js.map → ChevronToggle.vue_vue_type_script_setup_true_lang-DuvluoTi.js.map} +1 -1
- package/dist/Chip.js +17 -20
- package/dist/Chip.js.map +1 -1
- package/dist/Chip.vue.d.ts +32 -32
- package/dist/ConfirmationCodeInput.js +1 -1
- package/dist/ConfirmationCodeInput.js.map +1 -1
- package/dist/ConfirmationCodeInput.vue.d.ts +29 -29
- package/dist/ContextSwitcher.js +8 -14
- package/dist/ContextSwitcher.js.map +1 -1
- package/dist/ContextSwitcher.vue.d.ts +32 -32
- package/dist/Copy.js +23 -34
- package/dist/Copy.js.map +1 -1
- package/dist/Copy.vue.d.ts +9 -9
- package/dist/CurrencyInput.js +117 -128
- package/dist/CurrencyInput.js.map +1 -1
- package/dist/CurrencyInput.vue.d.ts +26 -21
- package/dist/CustomRender.vue.d.ts +12 -1
- package/dist/DataView.js +70 -73
- package/dist/DataView.js.map +1 -1
- package/dist/{DataView.vue_used_vue_type_style_index_0_lang.module-5c180dba.js → DataView.keys-C7eaZg2G.js} +5 -8
- package/dist/DataView.keys-C7eaZg2G.js.map +1 -0
- package/dist/DataView.vue.d.ts +51 -51
- package/dist/DataViewFilters.js +76 -90
- package/dist/DataViewFilters.js.map +1 -1
- package/dist/{DataViewFilters.keys-c80ffabe.js → DataViewFilters.keys-BLu07FiP.js} +1 -1
- package/dist/{DataViewFilters.keys-c80ffabe.js.map → DataViewFilters.keys-BLu07FiP.js.map} +1 -1
- package/dist/DataViewFilters.vue.d.ts +39 -39
- package/dist/DataViewSortButton.js +30 -43
- package/dist/DataViewSortButton.js.map +1 -1
- package/dist/DataViewSortButton.vue.d.ts +3 -3
- package/dist/DataViewToolbar.js +27 -36
- package/dist/DataViewToolbar.js.map +1 -1
- package/dist/DataViewToolbar.vue.d.ts +17 -17
- package/dist/DatePicker.js +649 -662
- package/dist/DatePicker.js.map +1 -1
- package/dist/DatePicker.vue.d.ts +73 -73
- package/dist/DescriptionList.js +1 -1
- package/dist/{DescriptionList.keys-c906ce05.js → DescriptionList.keys-BHlHYV6b.js} +1 -1
- package/dist/{DescriptionList.keys-c906ce05.js.map → DescriptionList.keys-BHlHYV6b.js.map} +1 -1
- package/dist/DescriptionList.vue.d.ts +6 -6
- package/dist/DescriptionListDetail.js +1 -1
- package/dist/DescriptionListDetail.vue.d.ts +1 -1
- package/dist/DescriptionListGroup.js +1 -1
- package/dist/DescriptionListGroup.vue.d.ts +1 -1
- package/dist/DescriptionListTerm.js +1 -1
- package/dist/DescriptionListTerm.vue.d.ts +1 -1
- package/dist/Dialog.js +26 -30
- package/dist/Dialog.js.map +1 -1
- package/dist/Dialog.vue.d.ts +34 -34
- package/dist/Divider.js +1 -1
- package/dist/Divider.js.map +1 -1
- package/dist/Divider.vue.d.ts +1 -1
- package/dist/Dropdown.js +21 -28
- package/dist/Dropdown.js.map +1 -1
- package/dist/Dropdown.vue.d.ts +28 -28
- package/dist/EmptyState.js +32 -33
- package/dist/EmptyState.js.map +1 -1
- package/dist/EmptyState.vue.d.ts +36 -36
- package/dist/Expand.js +2 -3
- package/dist/Expand.js.map +1 -1
- package/dist/Expand.vue.d.ts +14 -14
- package/dist/{Expand.vue_vue_type_script_setup_true_lang-0f236267.js → Expand.vue_vue_type_script_setup_true_lang-D0fSAtHr.js} +1 -1
- package/dist/{Expand.vue_vue_type_script_setup_true_lang-0f236267.js.map → Expand.vue_vue_type_script_setup_true_lang-D0fSAtHr.js.map} +1 -1
- package/dist/Field.js +2 -7
- package/dist/Field.js.map +1 -1
- package/dist/Field.vue.d.ts +30 -30
- package/dist/{Field.vue_vue_type_script_setup_true_lang-fded4f75.js → Field.vue_vue_type_script_setup_true_lang-DjxUvSRF.js} +2 -2
- package/dist/{Field.vue_vue_type_script_setup_true_lang-fded4f75.js.map → Field.vue_vue_type_script_setup_true_lang-DjxUvSRF.js.map} +1 -1
- package/dist/FileUpload.js +58 -57
- package/dist/FileUpload.js.map +1 -1
- package/dist/FileUpload.vue.d.ts +28 -28
- package/dist/FilterChip.js +12 -17
- package/dist/FilterChip.js.map +1 -1
- package/dist/FilterChip.vue.d.ts +19 -19
- package/dist/FilterDrawerItem.js +24 -30
- package/dist/FilterDrawerItem.js.map +1 -1
- package/dist/FilterDrawerItem.vue.d.ts +2 -2
- package/dist/FilterDropdown.js +41 -57
- package/dist/FilterDropdown.js.map +1 -1
- package/dist/FilterDropdown.vue.d.ts +9 -9
- package/dist/FilterSelect.js +36 -45
- package/dist/FilterSelect.js.map +1 -1
- package/dist/FilterSelect.vue.d.ts +5 -5
- package/dist/Filters.js +60 -96
- package/dist/Filters.js.map +1 -1
- package/dist/Filters.vue.d.ts +2005 -2294
- package/dist/HttpError.js +16 -23
- package/dist/HttpError.js.map +1 -1
- package/dist/HttpError.vue.d.ts +18 -18
- package/dist/Icon.js +27 -22
- package/dist/Icon.js.map +1 -1
- package/dist/Icon.vue.d.ts +13 -13
- package/dist/IconLabel.js +9 -12
- package/dist/IconLabel.js.map +1 -1
- package/dist/IconLabel.vue.d.ts +17 -17
- package/dist/Illustration.js +8 -11
- package/dist/Illustration.js.map +1 -1
- package/dist/Illustration.vue.d.ts +21 -21
- package/dist/{Illustration.vue_vue_type_script_setup_true_lang-e26c3841.js → Illustration.vue_vue_type_script_setup_true_lang-C3qG3Ty6.js} +2 -2
- package/dist/{Illustration.vue_vue_type_script_setup_true_lang-e26c3841.js.map → Illustration.vue_vue_type_script_setup_true_lang-C3qG3Ty6.js.map} +1 -1
- package/dist/Image.js.map +1 -1
- package/dist/Image.vue.d.ts +18 -18
- package/dist/InlineEdit.js +19 -30
- package/dist/InlineEdit.js.map +1 -1
- package/dist/InlineEdit.vue.d.ts +26 -26
- package/dist/Input.js +58 -64
- package/dist/Input.js.map +1 -1
- package/dist/Input.vue.d.ts +44 -36
- package/dist/InputOptions.js +66 -93
- package/dist/InputOptions.js.map +1 -1
- package/dist/InputOptions.vue.d.ts +66 -58
- package/dist/IntegrationIcon.js +2 -2
- package/dist/IntegrationIcon.js.map +1 -1
- package/dist/IntegrationIcon.vue.d.ts +12 -12
- package/dist/Label.js +2 -5
- package/dist/Label.js.map +1 -1
- package/dist/Label.vue.d.ts +17 -17
- package/dist/{Label.vue_vue_type_script_setup_true_lang-b6ba2f02.js → Label.vue_vue_type_script_setup_true_lang-C4JKdqvC.js} +1 -1
- package/dist/{Label.vue_vue_type_script_setup_true_lang-b6ba2f02.js.map → Label.vue_vue_type_script_setup_true_lang-C4JKdqvC.js.map} +1 -1
- package/dist/LicenseChip.js +10 -16
- package/dist/LicenseChip.js.map +1 -1
- package/dist/LicenseChip.vue.d.ts +3 -3
- package/dist/ListItem.js +5 -8
- package/dist/ListItem.js.map +1 -1
- package/dist/ListItem.vue.d.ts +275 -225
- package/dist/ListItemCell.js +1 -1
- package/dist/ListItemCell.js.map +1 -1
- package/dist/ListItemCell.vue.d.ts +13 -2
- package/dist/ListView.js +57 -101
- package/dist/ListView.js.map +1 -1
- package/dist/ListView.vue.d.ts +5185 -5430
- package/dist/Loading.js +12 -10
- package/dist/Loading.js.map +1 -1
- package/dist/Loading.vue.d.ts +1 -1
- package/dist/Logo.js +2 -4
- package/dist/Logo.js.map +1 -1
- package/dist/Logo.vue.d.ts +17 -17
- package/dist/{Logo.vue_vue_type_script_setup_true_lang-2a2597cb.js → Logo.vue_vue_type_script_setup_true_lang-BfUU9J9O.js} +1 -1
- package/dist/{Logo.vue_vue_type_script_setup_true_lang-2a2597cb.js.map → Logo.vue_vue_type_script_setup_true_lang-BfUU9J9O.js.map} +1 -1
- package/dist/Menu.js +1 -1
- package/dist/Menu.vue.d.ts +1 -1
- package/dist/MenuItem.js +1 -1
- package/dist/MenuItem.vue.d.ts +1 -1
- package/dist/{MenusPlugin-9288029a.js → MenusPlugin-Bk6UW6o9.js} +1 -1
- package/dist/{MenusPlugin-9288029a.js.map → MenusPlugin-Bk6UW6o9.js.map} +1 -1
- package/dist/Metric.vue.d.ts +10 -10
- package/dist/Modal.js +27 -32
- package/dist/Modal.js.map +1 -1
- package/dist/Modal.vue.d.ts +42 -42
- package/dist/Modals.js +14 -16
- package/dist/Modals.js.map +1 -1
- package/dist/Modals.vue.d.ts +1 -1
- package/dist/ModalsPlugin.js +9 -12
- package/dist/ModalsPlugin.js.map +1 -1
- package/dist/Module.js +3 -3
- package/dist/{Module.keys-2cc7d830.js → Module.keys-CEsrW2f0.js} +1 -1
- package/dist/{Module.keys-2cc7d830.js.map → Module.keys-CEsrW2f0.js.map} +1 -1
- package/dist/{Module.types-3f78f2a0.js → Module.types-B1FfGGac.js} +1 -1
- package/dist/{Module.types-3f78f2a0.js.map → Module.types-B1FfGGac.js.map} +1 -1
- package/dist/Module.vue.d.ts +3 -3
- package/dist/ModuleContent.js +2 -2
- package/dist/ModuleContent.vue.d.ts +1 -1
- package/dist/ModuleFooter.js +2 -2
- package/dist/ModuleFooter.vue.d.ts +1 -1
- package/dist/ModuleHeader.js +3 -3
- package/dist/ModuleHeader.vue.d.ts +15 -15
- package/dist/ObfuscateText.js +8 -13
- package/dist/ObfuscateText.js.map +1 -1
- package/dist/ObfuscateText.vue.d.ts +18 -18
- package/dist/PageContent.js +1 -1
- package/dist/PageContent.vue.d.ts +1 -1
- package/dist/PageHeader.js +26 -23
- package/dist/PageHeader.js.map +1 -1
- package/dist/PageHeader.vue.d.ts +7 -4
- package/dist/PageNavigation.js +41 -64
- package/dist/PageNavigation.js.map +1 -1
- package/dist/PageNavigation.vue.d.ts +10 -10
- package/dist/Paginate.js +36 -34
- package/dist/Paginate.js.map +1 -1
- package/dist/Paginate.vue.d.ts +11 -11
- package/dist/PlaidLink.js +3 -5
- package/dist/PlaidLink.js.map +1 -1
- package/dist/PlaidLink.vue.d.ts +29 -29
- package/dist/QuickAction.js +12 -15
- package/dist/QuickAction.js.map +1 -1
- package/dist/QuickAction.vue.d.ts +1 -1
- package/dist/Radio.js +1 -1
- package/dist/Radio.js.map +1 -1
- package/dist/Radio.vue.d.ts +83 -12
- package/dist/RadioGroup.js +41 -45
- package/dist/RadioGroup.js.map +1 -1
- package/dist/{RadioGroup.keys-974818d6.js → RadioGroup.keys-CqfiKkNz.js} +1 -1
- package/dist/{RadioGroup.keys-974818d6.js.map → RadioGroup.keys-CqfiKkNz.js.map} +1 -1
- package/dist/RadioGroup.vue.d.ts +30 -30
- package/dist/RadioNew.js +2 -2
- package/dist/RadioNew.js.map +1 -1
- package/dist/RadioNew.vue.d.ts +26 -26
- package/dist/RangeInput.js +10 -14
- package/dist/RangeInput.js.map +1 -1
- package/dist/RangeInput.vue.d.ts +1 -1
- package/dist/SearchBar.js +31 -41
- package/dist/SearchBar.js.map +1 -1
- package/dist/SearchBar.vue.d.ts +22 -22
- package/dist/Select.js +66 -78
- package/dist/Select.js.map +1 -1
- package/dist/Select.vue.d.ts +123 -123
- package/dist/SelectStatus.js +47 -69
- package/dist/SelectStatus.js.map +1 -1
- package/dist/SelectStatus.vue.d.ts +33 -26
- package/dist/Skeleton.js +1 -1
- package/dist/Skeleton.js.map +1 -1
- package/dist/Skeleton.vue.d.ts +9 -9
- package/dist/Step.js +10 -14
- package/dist/Step.js.map +1 -1
- package/dist/Step.vue.d.ts +21 -21
- package/dist/Stepper.js +37 -40
- package/dist/Stepper.js.map +1 -1
- package/dist/Stepper.vue.d.ts +34 -29
- package/dist/Switch.js +1 -1
- package/dist/Switch.vue.d.ts +23 -23
- package/dist/Tab.js +21 -36
- package/dist/Tab.js.map +1 -1
- package/dist/Table.js +38 -55
- package/dist/Table.js.map +1 -1
- package/dist/Table.keys-LHQf6FEH.js +7 -0
- package/dist/{Table.keys-83e4f09b.js.map → Table.keys-LHQf6FEH.js.map} +1 -1
- package/dist/Table.vue.d.ts +36 -36
- package/dist/TableCell.js +26 -26
- package/dist/TableCell.js.map +1 -1
- package/dist/TableCell.vue.d.ts +6 -6
- package/dist/TableHeaderCell.js +6 -13
- package/dist/TableHeaderCell.js.map +1 -1
- package/dist/TableHeaderCell.vue.d.ts +3 -3
- package/dist/TableHeaderRow.js +22 -32
- package/dist/TableHeaderRow.js.map +1 -1
- package/dist/TableHeaderRow.vue.d.ts +8 -8
- package/dist/TableRow.js +59 -59
- package/dist/TableRow.js.map +1 -1
- package/dist/TableRow.vue.d.ts +26 -26
- package/dist/Tabs.js +10 -24
- package/dist/Tabs.js.map +1 -1
- package/dist/Tabs.vue.d.ts +5 -5
- package/dist/{Tabs.vue_used_vue_type_style_index_0_lang.module-d7530989.js → Tabs.vue_vue_type_script_setup_true_lang-l41hWkV4.js} +31 -34
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-l41hWkV4.js.map +1 -0
- package/dist/TextEditor.js +1269 -1364
- package/dist/TextEditor.js.map +1 -1
- package/dist/TextEditor.vue.d.ts +46 -46
- package/dist/Textarea.js +30 -31
- package/dist/Textarea.js.map +1 -1
- package/dist/Textarea.vue.d.ts +34 -26
- package/dist/Timeline.js +9 -10
- package/dist/Timeline.js.map +1 -1
- package/dist/Timeline.vue.d.ts +6 -6
- package/dist/TimelineItem.js +1 -1
- package/dist/TimelineItem.vue.d.ts +1 -1
- package/dist/Toast.js +5 -9
- package/dist/Toast.js.map +1 -1
- package/dist/Toast.vue.d.ts +3 -3
- package/dist/Toasts.js +15 -25
- package/dist/Toasts.js.map +1 -1
- package/dist/Toasts.vue.d.ts +1 -1
- package/dist/ToastsPlugin.js +11 -23
- package/dist/ToastsPlugin.js.map +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/Tooltip.js.map +1 -1
- package/dist/Tooltip.vue.d.ts +15 -15
- package/dist/{_commonjsHelpers-10dfc225.js → _commonjsHelpers-DaMA6jEr.js} +1 -1
- package/dist/_commonjsHelpers-DaMA6jEr.js.map +1 -0
- package/dist/{_plugin-vue_export-helper-dad06003.js → _plugin-vue_export-helper-CHgC5LLL.js} +1 -1
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js.map +1 -0
- package/dist/{colors-8d9b9429.js → colors-DDDVvqfQ.js} +1 -1
- package/dist/{colors-8d9b9429.js.map → colors-DDDVvqfQ.js.map} +1 -1
- package/dist/components.css +2 -2
- package/dist/directives/observe.js.map +1 -1
- package/dist/directives/sticky.js.map +1 -1
- package/dist/directives/tooltip.js +21 -27
- package/dist/directives/tooltip.js.map +1 -1
- package/dist/directives/viewable.js +1 -1
- package/dist/directives/viewable.js.map +1 -1
- package/dist/{floating-ui.vue-8d7f7932.js → floating-ui.vue-BmfQDqE-.js} +2 -3
- package/dist/{floating-ui.vue-8d7f7932.js.map → floating-ui.vue-BmfQDqE-.js.map} +1 -1
- package/dist/{formatDateTime-a5e70901.js → formatDateTime-C8CYECpd.js} +8 -12
- package/dist/{formatDateTime-a5e70901.js.map → formatDateTime-C8CYECpd.js.map} +1 -1
- package/dist/{index-9e1095ef.js → index-D6bxWkZ1.js} +2 -3
- package/dist/{index-9e1095ef.js.map → index-D6bxWkZ1.js.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +90 -112
- package/dist/index.js.map +1 -1
- package/dist/{isDefined-2ce6cde4.js → isDefined-DzVx0B6k.js} +1 -1
- package/dist/{isDefined-2ce6cde4.js.map → isDefined-DzVx0B6k.js.map} +1 -1
- package/dist/{isValid-4b2b7a54.js → isValid-DN-HkCoi.js} +1 -1
- package/dist/{isValid-4b2b7a54.js.map → isValid-DN-HkCoi.js.map} +1 -1
- package/dist/{keys-241d03b7.js → keys-BEdEsanp.js} +1 -1
- package/dist/{keys-241d03b7.js.map → keys-BEdEsanp.js.map} +1 -1
- package/dist/{keys-7ecef029.js → keys-C8Zfr_By.js} +1 -1
- package/dist/{keys-7ecef029.js.map → keys-C8Zfr_By.js.map} +1 -1
- package/dist/{misc-76697f61.js → misc-CHQs-G03.js} +1 -1
- package/dist/{misc-76697f61.js.map → misc-CHQs-G03.js.map} +1 -1
- package/dist/{parseISO-ed4094c1.js → parseISO-wlfIB_QJ.js} +12 -18
- package/dist/{parseISO-ed4094c1.js.map → parseISO-wlfIB_QJ.js.map} +1 -1
- package/dist/{searchFuzzy-9b74ec4e.js → searchFuzzy-DKooyZM8.js} +110 -149
- package/dist/{searchFuzzy-9b74ec4e.js.map → searchFuzzy-DKooyZM8.js.map} +1 -1
- package/dist/{statusLevels-a8b041f4.js → statusLevels-D8EgtE_L.js} +1 -1
- package/dist/{statusLevels-a8b041f4.js.map → statusLevels-D8EgtE_L.js.map} +1 -1
- package/dist/storage.js +8 -15
- package/dist/storage.js.map +1 -1
- package/dist/tailwind-base.js.map +1 -1
- package/dist/{toTimeZone-a2ed6470.js → toTimeZone-CVE1ZmsS.js} +1 -1
- package/dist/{toTimeZone-a2ed6470.js.map → toTimeZone-CVE1ZmsS.js.map} +1 -1
- package/dist/useDialog.js +7 -7
- package/dist/useGoogleMaps.js +18 -28
- package/dist/useGoogleMaps.js.map +1 -1
- package/dist/useModals.js +1 -2
- package/dist/useModals.js.map +1 -1
- package/dist/useScriptTag.js.map +1 -1
- package/dist/useSearch.js +14 -19
- package/dist/useSearch.js.map +1 -1
- package/dist/useStepper.js.map +1 -1
- package/dist/useValidation.js +1 -1
- package/dist/useValidation.js.map +1 -1
- package/dist/utils/calculateElementOverflow.js +9 -13
- package/dist/utils/calculateElementOverflow.js.map +1 -1
- package/dist/utils/colorScheme.js.map +1 -1
- package/dist/utils/createQueryString.js +4 -5
- package/dist/utils/createQueryString.js.map +1 -1
- package/dist/utils/createValidDate.js +2 -2
- package/dist/utils/formatDateTime.js +4 -5
- package/dist/utils/formatDateTime.js.map +1 -1
- package/dist/utils/getContrastingTextColor.js +1 -1
- package/dist/utils/getContrastingTextColor.js.map +1 -1
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/i18n.js +25 -26
- package/dist/utils/i18n.js.map +1 -1
- package/dist/utils/normalizeDate.js +1 -1
- package/dist/utils/searchFuzzy.js +3 -10
- package/dist/utils/searchFuzzy.js.map +1 -1
- package/dist/utils/storage.js +6 -11
- package/dist/utils/storage.js.map +1 -1
- package/dist/utils/toTimeZone.js +2 -3
- package/dist/utils/toTimeZone.js.map +1 -1
- package/package.json +13 -14
- package/dist/Button.vue_used_vue_type_style_index_0_lang.module-4dabc2a9.js +0 -17
- package/dist/Button.vue_used_vue_type_style_index_0_lang.module-4dabc2a9.js.map +0 -1
- package/dist/Carousel.types.d.ts +0 -33
- package/dist/Carousel.types.js +0 -2
- package/dist/Carousel.types.js.map +0 -1
- package/dist/Checkbox.vue_used_vue_type_style_index_0_lang.module-fa8d9c06.js +0 -9
- package/dist/Checkbox.vue_used_vue_type_style_index_0_lang.module-fa8d9c06.js.map +0 -1
- package/dist/DataView.vue_used_vue_type_style_index_0_lang.module-5c180dba.js.map +0 -1
- package/dist/EmptyState.vue_used_vue_type_style_index_0_lang.module-f5d89366.js +0 -8
- package/dist/EmptyState.vue_used_vue_type_style_index_0_lang.module-f5d89366.js.map +0 -1
- package/dist/Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js +0 -11
- package/dist/Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js.map +0 -1
- package/dist/Loading.vue_used_vue_type_style_index_0_lang.module-ef5a3bc6.js +0 -8
- package/dist/Loading.vue_used_vue_type_style_index_0_lang.module-ef5a3bc6.js.map +0 -1
- package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-18343da7.js +0 -11
- package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-18343da7.js.map +0 -1
- package/dist/Table.keys-83e4f09b.js +0 -27
- package/dist/Tabs.vue_used_vue_type_style_index_0_lang.module-d7530989.js.map +0 -1
- package/dist/_commonjsHelpers-10dfc225.js.map +0 -1
- package/dist/_plugin-vue_export-helper-dad06003.js.map +0 -1
package/dist/useStepper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStepper.js","sources":["../src/composables/useStepper/useStepper.ts"],"sourcesContent":["import { computed, readonly, Ref, ref } from 'vue';\n\nexport interface StepDefinition {\n completed: boolean;\n substeps: Array<Omit<StepDefinition, 'substeps'>>;\n}\n\nexport interface StepperOptions {\n /**\n * If true, the stepper will prevent skipping steps\n */\n linear?: boolean;\n /**\n * The index of the active step\n */\n activeStep?: number;\n /**\n * The index of the active substep\n */\n activeSubstep?: number;\n /**\n * The stepper representation as an array of steps and substeps\n */\n steps?: Array<StepDefinition>;\n /**\n * A ref to the stepper element\n */\n ref?: Ref<HTMLUListElement | null>;\n}\n\nexport default function useStepper(\n options: StepperOptions = {\n linear: false,\n activeStep: -1,\n activeSubstep: -1,\n steps: [],\n },\n) {\n /**\n * The steps and substeps of the stepper, so we can keep track of their state.\n * Can be populated with the `steps` option, or via the `registerStep` function.\n */\n const steps = ref<Array<StepDefinition>>(options.steps ? options.steps : []);\n\n const stepCount = computed(() => steps.value.length);\n\n const activeStepIndex = ref(\n options.activeStep !== null && options.activeStep !== undefined ? options.activeStep : -1,\n );\n const activeSubstepIndex = ref(\n options.activeSubstep !== null && options.activeSubstep !== undefined ? options.activeSubstep : -1,\n );\n\n const stepElements = computed(() => {\n return Array.from((options.ref?.value?.children || []) as HTMLCollectionOf<HTMLLIElement>);\n });\n\n const activeStepElement = computed(() => stepElements.value[activeStepIndex.value]);\n\n /**\n * Returns true if the step at the given index has substeps\n * @param stepIndex The index of the step to check\n */\n function stepHasSubsteps(stepIndex: number): boolean {\n return !!steps.value[stepIndex].substeps.length;\n }\n\n /**\n * Goes to the next step or substep, while flagging the current one as completed.\n * If the current step has substeps, it will go to the next substep if there are any, or to the next substep.\n * And if the next step has substeps, automatically goes to the first substep\n */\n function next(): void {\n const hasNoActiveStep = activeStepIndex.value === -1;\n const isLastStep = activeStepIndex.value === steps.value.length - 1;\n\n // If there is no active step, we want to activate the first step\n if (hasNoActiveStep) {\n activeStepIndex.value++;\n\n // If the step we just navigated to has substeps, we want to activate the first substep\n if (stepHasSubsteps(activeStepIndex.value)) {\n activeSubstepIndex.value++;\n }\n } else if (isLastStep) {\n if (stepHasSubsteps(activeStepIndex.value)) {\n const hasNoActiveSubstep = activeSubstepIndex.value === -1;\n const isLastSubstep = activeSubstepIndex.value === steps.value[activeStepIndex.value].substeps.length - 1;\n\n // if there are no active substeps, we want to activate the first substep\n if (hasNoActiveSubstep) {\n activeSubstepIndex.value++;\n // if the active substep is the last one, we want to reset the step and substep to -1\n } else if (isLastSubstep) {\n steps.value[activeStepIndex.value].substeps[activeSubstepIndex.value].completed = true;\n activeSubstepIndex.value = -1;\n\n steps.value[activeStepIndex.value].completed = true;\n activeStepIndex.value = -1;\n // if there are more substeps, we want to complete the current one and proceed to the next substep\n } else {\n steps.value[activeStepIndex.value].substeps[activeSubstepIndex.value].completed = true;\n activeSubstepIndex.value++;\n }\n // If there are no substeps, we want to complete the current step and reset the step to -1\n } else {\n steps.value[activeStepIndex.value].completed = true;\n activeStepIndex.value = -1;\n }\n } else {\n if (stepHasSubsteps(activeStepIndex.value)) {\n const hasNoActiveSubstep = activeSubstepIndex.value === -1;\n const isLastSubstep = activeSubstepIndex.value === steps.value[activeStepIndex.value].substeps.length - 1;\n\n // if there are no active substeps, we want to activate the first substep\n if (hasNoActiveSubstep) {\n activeSubstepIndex.value++;\n // if the active substep is the last one, we want to go to the next step\n } else if (isLastSubstep) {\n steps.value[activeStepIndex.value].substeps[activeSubstepIndex.value].completed = true;\n activeSubstepIndex.value = -1;\n\n steps.value[activeStepIndex.value].completed = true;\n activeStepIndex.value++;\n\n // If the step we just navigated to has substeps, we want to activate the first substep right away\n if (stepHasSubsteps(activeStepIndex.value) && activeSubstepIndex.value === -1) {\n activeSubstepIndex.value++;\n }\n // if there are more substeps, we want to complete the current one and proceed to the next substep\n } else {\n steps.value[activeStepIndex.value].substeps[activeSubstepIndex.value].completed = true;\n activeSubstepIndex.value++;\n }\n } else {\n steps.value[activeStepIndex.value].completed = true;\n activeStepIndex.value++;\n\n // If the step we just navigated to has substeps, we want to activate the first substep right away\n if (stepHasSubsteps(activeStepIndex.value) && activeSubstepIndex.value === -1) {\n activeSubstepIndex.value++;\n }\n }\n }\n }\n\n function back(): void {\n // We don't want to go back if there is no active step\n if (activeStepIndex.value === -1) {\n return;\n }\n\n if (stepHasSubsteps(activeStepIndex.value)) {\n // If the active substep is the first one, we want to go back to the previous step\n if (activeSubstepIndex.value === 0) {\n activeStepIndex.value--;\n activeSubstepIndex.value--;\n\n // If the step that we just navigated to has substeps, we want to navigate to the last substep\n if (activeStepIndex.value >= 0 && stepHasSubsteps(activeStepIndex.value)) {\n activeSubstepIndex.value = steps.value[activeStepIndex.value].substeps.length - 1;\n }\n } else {\n activeSubstepIndex.value--;\n }\n } else {\n activeStepIndex.value--;\n\n // If the step that we just navigated to has substeps, we want to navigate to the last substep\n if (activeStepIndex.value >= 0 && stepHasSubsteps(activeStepIndex.value)) {\n activeSubstepIndex.value = steps.value[activeStepIndex.value].substeps.length - 1;\n }\n }\n }\n\n /**\n * Navigates to a specific step and substep.\n */\n function goTo(stepIndex: number, substepIndex = -1): void {\n // A linear stepper prevents navigation to incomplete steps\n if (options.linear) {\n if (isStepCompleted(stepIndex - 1) || stepIndex === 0) {\n if (stepHasSubsteps(stepIndex)) {\n if (substepIndex <= 0) {\n activeSubstepIndex.value = 0;\n } else if (isStepCompleted(stepIndex, substepIndex - 1)) {\n activeSubstepIndex.value = substepIndex;\n }\n }\n activeStepIndex.value = stepIndex;\n }\n } else {\n activeStepIndex.value = stepIndex;\n\n if (stepHasSubsteps(stepIndex)) {\n if (substepIndex < 0) {\n activeSubstepIndex.value = 0;\n } else {\n activeSubstepIndex.value = substepIndex;\n }\n }\n }\n }\n\n /**\n * Returns true if the step is completed.\n * if the substep index is provided, check if the substep is completed.\n */\n function isStepCompleted(stepIndex: number, substepIndex = -1): boolean {\n if (substepIndex >= 0) {\n return steps.value[stepIndex]?.substeps[substepIndex]?.completed;\n } else {\n return steps.value[stepIndex]?.completed;\n }\n }\n\n /**\n * Returns true if the step is active.\n * if the substep index is provided, check both if the step and the substep are active.\n */\n function isStepActive(stepIndex: number, substepIndex = -1): boolean {\n if (substepIndex >= 0) {\n return activeStepIndex.value === stepIndex && activeSubstepIndex.value === substepIndex;\n } else {\n return activeStepIndex.value === stepIndex;\n }\n }\n\n /**\n * Registers a new step or substep into the steps array\n */\n function registerStep(nested = false): void {\n if (nested && !steps.value.length) {\n throw new Error('Cannot register a substep without a parent step.');\n }\n\n if (nested) {\n steps.value[steps.value.length - 1].substeps.push({ completed: false });\n } else {\n steps.value.push({ completed: false, substeps: [] });\n }\n }\n\n return {\n steps: readonly(steps),\n stepCount,\n activeStepElement,\n activeStepIndex,\n activeSubstepIndex,\n registerStep,\n next,\n back,\n goTo,\n isStepActive,\n isStepCompleted,\n };\n}\n"],"names":["useStepper","options","steps","ref","stepCount","computed","activeStepIndex","activeSubstepIndex","stepElements","_b","_a","activeStepElement","stepHasSubsteps","stepIndex","next","hasNoActiveStep","isLastStep","hasNoActiveSubstep","isLastSubstep","back","goTo","substepIndex","isStepCompleted","_c","isStepActive","registerStep","nested","readonly"],"mappings":";AA8BA,SAAwBA,EACtBC,IAA0B;AAAA,EACxB,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,OAAO,CAAC;AACV,GACA;AAKA,QAAMC,IAAQC,EAA2BF,EAAQ,QAAQA,EAAQ,QAAQ,CAAA,CAAE,GAErEG,IAAYC,EAAS,MAAMH,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e,CAAC,MACpDd,EAAmB,QAAQc,KAG/Bf,EAAgB,QAAQO,MAG1BP,EAAgB,QAAQO,GAEpBD,EAAgBC,CAAS,MACvBQ,IAAe,IACjBd,EAAmB,QAAQ,IAE3BA,EAAmB,QAAQc;AAAA,EAInC;AAMS,WAAAC,EAAgBT,GAAmBQ,IAAe,IAAa;;AACtE,WAAIA,KAAgB,KACXZ,KAAAC,IAAAR,EAAM,MAAMW,CAAS,MAArB,gBAAAH,EAAwB,SAASW,OAAjC,gBAAAZ,EAAgD,aAEhDc,IAAArB,EAAM,MAAMW,CAAS,MAArB,gBAAAU,EAAwB;AAAA,EAEnC;AAMS,WAAAC,EAAaX,GAAmBQ,IAAe,IAAa;AACnE,WAAIA,KAAgB,IACXf,EAAgB,UAAUO,KAAaN,EAAmB,UAAUc,IAEpEf,EAAgB,UAAUO;AAAA,EAErC;AAKS,WAAAY,EAAaC,IAAS,IAAa;AAC1C,QAAIA,KAAU,CAACxB,EAAM,MAAM;AACnB,YAAA,IAAI,MAAM,kDAAkD;AAGpE,IAAIwB,IACIxB,EAAA,MAAMA,EAAM,MAAM,SAAS,CAAC,EAAE,SAAS,KAAK,EAAE,WAAW,GAAO,CAAA,IAEhEA,EAAA,MAAM,KAAK,EAAE,WAAW,IAAO,UAAU,IAAI;AAAA,EAEvD;AAEO,SAAA;AAAA,IACL,OAAOyB,EAASzB,CAAK;AAAA,IACrB,WAAAE;AAAA,IACA,mBAAAO;AAAA,IACA,iBAAAL;AAAA,IACA,oBAAAC;AAAA,IACA,cAAAkB;AAAA,IACA,MAAAX;AAAA,IACA,MAAAK;AAAA,IACA,MAAAC;AAAA,IACA,cAAAI;AAAA,IACA,iBAAAF;AAAA,EAAA;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"useStepper.js","sources":["../src/composables/useStepper/useStepper.ts"],"sourcesContent":["import { computed, readonly, Ref, ref } from 'vue';\n\nexport interface StepDefinition {\n completed: boolean;\n substeps: Array<Omit<StepDefinition, 'substeps'>>;\n}\n\nexport interface StepperOptions {\n /**\n * If true, the stepper will prevent skipping steps\n */\n linear?: boolean;\n /**\n * The index of the active step\n */\n activeStep?: number;\n /**\n * The index of the active substep\n */\n activeSubstep?: number;\n /**\n * The stepper representation as an array of steps and substeps\n */\n steps?: Array<StepDefinition>;\n /**\n * A ref to the stepper element\n */\n ref?: Ref<HTMLUListElement | null>;\n}\n\nexport default function useStepper(\n options: StepperOptions = {\n linear: false,\n activeStep: -1,\n activeSubstep: -1,\n steps: [],\n },\n) {\n /**\n * The steps and substeps of the stepper, so we can keep track of their state.\n * Can be populated with the `steps` option, or via the `registerStep` function.\n */\n const steps = ref<Array<StepDefinition>>(options.steps ? options.steps : []);\n\n const stepCount = computed(() => steps.value.length);\n\n const activeStepIndex = ref(\n options.activeStep !== null && options.activeStep !== undefined ? options.activeStep : -1,\n );\n const activeSubstepIndex = ref(\n options.activeSubstep !== null && options.activeSubstep !== undefined ? options.activeSubstep : -1,\n );\n\n const stepElements = computed(() => {\n return Array.from((options.ref?.value?.children || []) as HTMLCollectionOf<HTMLLIElement>);\n });\n\n const activeStepElement = computed(() => stepElements.value[activeStepIndex.value]);\n\n /**\n * Returns true if the step at the given index has substeps\n * @param stepIndex The index of the step to check\n */\n function stepHasSubsteps(stepIndex: number): boolean {\n return !!steps.value[stepIndex].substeps.length;\n }\n\n /**\n * Goes to the next step or substep, while flagging the current one as completed.\n * If the current step has substeps, it will go to the next substep if there are any, or to the next substep.\n * And if the next step has substeps, automatically goes to the first substep\n */\n function next(): void {\n const hasNoActiveStep = activeStepIndex.value === -1;\n const isLastStep = activeStepIndex.value === steps.value.length - 1;\n\n // If there is no active step, we want to activate the first step\n if (hasNoActiveStep) {\n activeStepIndex.value++;\n\n // If the step we just navigated to has substeps, we want to activate the first substep\n if (stepHasSubsteps(activeStepIndex.value)) {\n activeSubstepIndex.value++;\n }\n } else if (isLastStep) {\n if (stepHasSubsteps(activeStepIndex.value)) {\n const hasNoActiveSubstep = activeSubstepIndex.value === -1;\n const isLastSubstep = activeSubstepIndex.value === steps.value[activeStepIndex.value].substeps.length - 1;\n\n // if there are no active substeps, we want to activate the first substep\n if (hasNoActiveSubstep) {\n activeSubstepIndex.value++;\n // if the active substep is the last one, we want to reset the step and substep to -1\n } else if (isLastSubstep) {\n steps.value[activeStepIndex.value].substeps[activeSubstepIndex.value].completed = true;\n activeSubstepIndex.value = -1;\n\n steps.value[activeStepIndex.value].completed = true;\n activeStepIndex.value = -1;\n // if there are more substeps, we want to complete the current one and proceed to the next substep\n } else {\n steps.value[activeStepIndex.value].substeps[activeSubstepIndex.value].completed = true;\n activeSubstepIndex.value++;\n }\n // If there are no substeps, we want to complete the current step and reset the step to -1\n } else {\n steps.value[activeStepIndex.value].completed = true;\n activeStepIndex.value = -1;\n }\n } else {\n if (stepHasSubsteps(activeStepIndex.value)) {\n const hasNoActiveSubstep = activeSubstepIndex.value === -1;\n const isLastSubstep = activeSubstepIndex.value === steps.value[activeStepIndex.value].substeps.length - 1;\n\n // if there are no active substeps, we want to activate the first substep\n if (hasNoActiveSubstep) {\n activeSubstepIndex.value++;\n // if the active substep is the last one, we want to go to the next step\n } else if (isLastSubstep) {\n steps.value[activeStepIndex.value].substeps[activeSubstepIndex.value].completed = true;\n activeSubstepIndex.value = -1;\n\n steps.value[activeStepIndex.value].completed = true;\n activeStepIndex.value++;\n\n // If the step we just navigated to has substeps, we want to activate the first substep right away\n if (stepHasSubsteps(activeStepIndex.value) && activeSubstepIndex.value === -1) {\n activeSubstepIndex.value++;\n }\n // if there are more substeps, we want to complete the current one and proceed to the next substep\n } else {\n steps.value[activeStepIndex.value].substeps[activeSubstepIndex.value].completed = true;\n activeSubstepIndex.value++;\n }\n } else {\n steps.value[activeStepIndex.value].completed = true;\n activeStepIndex.value++;\n\n // If the step we just navigated to has substeps, we want to activate the first substep right away\n if (stepHasSubsteps(activeStepIndex.value) && activeSubstepIndex.value === -1) {\n activeSubstepIndex.value++;\n }\n }\n }\n }\n\n function back(): void {\n // We don't want to go back if there is no active step\n if (activeStepIndex.value === -1) {\n return;\n }\n\n if (stepHasSubsteps(activeStepIndex.value)) {\n // If the active substep is the first one, we want to go back to the previous step\n if (activeSubstepIndex.value === 0) {\n activeStepIndex.value--;\n activeSubstepIndex.value--;\n\n // If the step that we just navigated to has substeps, we want to navigate to the last substep\n if (activeStepIndex.value >= 0 && stepHasSubsteps(activeStepIndex.value)) {\n activeSubstepIndex.value = steps.value[activeStepIndex.value].substeps.length - 1;\n }\n } else {\n activeSubstepIndex.value--;\n }\n } else {\n activeStepIndex.value--;\n\n // If the step that we just navigated to has substeps, we want to navigate to the last substep\n if (activeStepIndex.value >= 0 && stepHasSubsteps(activeStepIndex.value)) {\n activeSubstepIndex.value = steps.value[activeStepIndex.value].substeps.length - 1;\n }\n }\n }\n\n /**\n * Navigates to a specific step and substep.\n */\n function goTo(stepIndex: number, substepIndex = -1): void {\n // A linear stepper prevents navigation to incomplete steps\n if (options.linear) {\n if (isStepCompleted(stepIndex - 1) || stepIndex === 0) {\n if (stepHasSubsteps(stepIndex)) {\n if (substepIndex <= 0) {\n activeSubstepIndex.value = 0;\n } else if (isStepCompleted(stepIndex, substepIndex - 1)) {\n activeSubstepIndex.value = substepIndex;\n }\n }\n activeStepIndex.value = stepIndex;\n }\n } else {\n activeStepIndex.value = stepIndex;\n\n if (stepHasSubsteps(stepIndex)) {\n if (substepIndex < 0) {\n activeSubstepIndex.value = 0;\n } else {\n activeSubstepIndex.value = substepIndex;\n }\n }\n }\n }\n\n /**\n * Returns true if the step is completed.\n * if the substep index is provided, check if the substep is completed.\n */\n function isStepCompleted(stepIndex: number, substepIndex = -1): boolean {\n if (substepIndex >= 0) {\n return steps.value[stepIndex]?.substeps[substepIndex]?.completed;\n } else {\n return steps.value[stepIndex]?.completed;\n }\n }\n\n /**\n * Returns true if the step is active.\n * if the substep index is provided, check both if the step and the substep are active.\n */\n function isStepActive(stepIndex: number, substepIndex = -1): boolean {\n if (substepIndex >= 0) {\n return activeStepIndex.value === stepIndex && activeSubstepIndex.value === substepIndex;\n } else {\n return activeStepIndex.value === stepIndex;\n }\n }\n\n /**\n * Registers a new step or substep into the steps array\n */\n function registerStep(nested = false): void {\n if (nested && !steps.value.length) {\n throw new Error('Cannot register a substep without a parent step.');\n }\n\n if (nested) {\n steps.value[steps.value.length - 1].substeps.push({ completed: false });\n } else {\n steps.value.push({ completed: false, substeps: [] });\n }\n }\n\n return {\n steps: readonly(steps),\n stepCount,\n activeStepElement,\n activeStepIndex,\n activeSubstepIndex,\n registerStep,\n next,\n back,\n goTo,\n isStepActive,\n isStepCompleted,\n };\n}\n"],"names":["useStepper","options","steps","ref","stepCount","computed","activeStepIndex","activeSubstepIndex","stepElements","_b","_a","activeStepElement","stepHasSubsteps","stepIndex","next","hasNoActiveStep","isLastStep","hasNoActiveSubstep","isLastSubstep","back","goTo","substepIndex","isStepCompleted","_c","isStepActive","registerStep","nested","readonly"],"mappings":";AA8BA,SAAwBA,EACtBC,IAA0B;AAAA,EACxB,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,OAAO,CAAC;AACV,GACA;AAKA,QAAMC,IAAQC,EAA2BF,EAAQ,QAAQA,EAAQ,QAAQ,CAAA,CAAE,GAErEG,IAAYC,EAAS,MAAMH,EAAM,MAAM,MAAM,GAE7CI,IAAkBH;AAAA,IACtBF,EAAQ,eAAe,QAAQA,EAAQ,eAAe,SAAYA,EAAQ,aAAa;AAAA,EAAA,GAEnFM,IAAqBJ;AAAA,IACzBF,EAAQ,kBAAkB,QAAQA,EAAQ,kBAAkB,SAAYA,EAAQ,gBAAgB;AAAA,EAAA,GAG5FO,IAAeH,EAAS,MAAM;;AAClC,WAAO,MAAM,OAAMI,KAAAC,IAAAT,EAAQ,QAAR,gBAAAS,EAAa,UAAb,gBAAAD,EAAoB,aAAY,CAAA,CAAsC;AAAA,EAAA,CAC1F,GAEKE,IAAoBN,EAAS,MAAMG,EAAa,MAAMF,EAAgB,KAAK,CAAC;AAMlF,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IAAa;AACnE,WAAIA,KAAgB,IACXf,EAAgB,UAAUO,KAAaN,EAAmB,UAAUc,IAEpEf,EAAgB,UAAUO;AAAA,EAErC;AAKS,WAAAY,EAAaC,IAAS,IAAa;AAC1C,QAAIA,KAAU,CAACxB,EAAM,MAAM;AACnB,YAAA,IAAI,MAAM,kDAAkD;AAGpE,IAAIwB,IACIxB,EAAA,MAAMA,EAAM,MAAM,SAAS,CAAC,EAAE,SAAS,KAAK,EAAE,WAAW,GAAO,CAAA,IAEhEA,EAAA,MAAM,KAAK,EAAE,WAAW,IAAO,UAAU,IAAI;AAAA,EAEvD;AAEO,SAAA;AAAA,IACL,OAAOyB,EAASzB,CAAK;AAAA,IACrB,WAAAE;AAAA,IACA,mBAAAO;AAAA,IACA,iBAAAL;AAAA,IACA,oBAAAC;AAAA,IACA,cAAAkB;AAAA,IACA,MAAAX;AAAA,IACA,MAAAK;AAAA,IACA,MAAAC;AAAA,IACA,cAAAI;AAAA,IACA,iBAAAF;AAAA,EAAA;AAEJ;"}
|
package/dist/useValidation.js
CHANGED
|
@@ -3,7 +3,7 @@ import S from "lodash-es/get";
|
|
|
3
3
|
import { toValue as u, computed as c, ref as w, watch as L, reactive as T, nextTick as I, readonly as V } from "vue";
|
|
4
4
|
import { DECIMAL_PRECISION as A, DEBOUNCE as q } from "./constants.js";
|
|
5
5
|
import { t as f } from "./locale.js";
|
|
6
|
-
import { i as l } from "./isDefined-
|
|
6
|
+
import { i as l } from "./isDefined-DzVx0B6k.js";
|
|
7
7
|
import D from "lodash-es/round";
|
|
8
8
|
function j(e) {
|
|
9
9
|
return e && e.constructor && typeof e.constructor.isBuffer == "function" && e.constructor.isBuffer(e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useValidation.js","sources":["../node_modules/flat/index.js","../src/composables/useValidation/ruleFactories/email.ts","../src/composables/useValidation/ruleFactories/maxLength.ts","../src/composables/useValidation/ruleFactories/maxValue.ts","../src/composables/useValidation/ruleFactories/minLength.ts","../src/composables/useValidation/ruleFactories/minValue.ts","../src/composables/useValidation/ruleFactories/pattern.ts","../src/composables/useValidation/ruleFactories/positiveNumber.ts","../src/composables/useValidation/ruleFactories/price.ts","../src/composables/useValidation/ruleFactories/required.ts","../src/composables/useValidation/ruleFactories/wholeNumber.ts","../src/composables/useValidation/useValidation.ts"],"sourcesContent":["function isBuffer (obj) {\n return obj &&\n obj.constructor &&\n (typeof obj.constructor.isBuffer === 'function') &&\n obj.constructor.isBuffer(obj)\n}\n\nfunction keyIdentity (key) {\n return key\n}\n\nexport function flatten (target, opts) {\n opts = opts || {}\n\n const delimiter = opts.delimiter || '.'\n const maxDepth = opts.maxDepth\n const transformKey = opts.transformKey || keyIdentity\n const output = {}\n\n function step (object, prev, currentDepth) {\n currentDepth = currentDepth || 1\n Object.keys(object).forEach(function (key) {\n const value = object[key]\n const isarray = opts.safe && Array.isArray(value)\n const type = Object.prototype.toString.call(value)\n const isbuffer = isBuffer(value)\n const isobject = (\n type === '[object Object]' ||\n type === '[object Array]'\n )\n\n const newKey = prev\n ? prev + delimiter + transformKey(key)\n : transformKey(key)\n\n if (!isarray && !isbuffer && isobject && Object.keys(value).length &&\n (!opts.maxDepth || currentDepth < maxDepth)) {\n return step(value, newKey, currentDepth + 1)\n }\n\n output[newKey] = value\n })\n }\n\n step(target)\n\n return output\n}\n\nexport function unflatten (target, opts) {\n opts = opts || {}\n\n const delimiter = opts.delimiter || '.'\n const overwrite = opts.overwrite || false\n const transformKey = opts.transformKey || keyIdentity\n const result = {}\n\n const isbuffer = isBuffer(target)\n if (isbuffer || Object.prototype.toString.call(target) !== '[object Object]') {\n return target\n }\n\n // safely ensure that the key is\n // an integer.\n function getkey (key) {\n const parsedKey = Number(key)\n\n return (\n isNaN(parsedKey) ||\n key.indexOf('.') !== -1 ||\n opts.object\n )\n ? key\n : parsedKey\n }\n\n function addKeys (keyPrefix, recipient, target) {\n return Object.keys(target).reduce(function (result, key) {\n result[keyPrefix + delimiter + key] = target[key]\n\n return result\n }, recipient)\n }\n\n function isEmpty (val) {\n const type = Object.prototype.toString.call(val)\n const isArray = type === '[object Array]'\n const isObject = type === '[object Object]'\n\n if (!val) {\n return true\n } else if (isArray) {\n return !val.length\n } else if (isObject) {\n return !Object.keys(val).length\n }\n }\n\n target = Object.keys(target).reduce(function (result, key) {\n const type = Object.prototype.toString.call(target[key])\n const isObject = (type === '[object Object]' || type === '[object Array]')\n if (!isObject || isEmpty(target[key])) {\n result[key] = target[key]\n return result\n } else {\n return addKeys(\n key,\n result,\n flatten(target[key], opts)\n )\n }\n }, {})\n\n Object.keys(target).forEach(function (key) {\n const split = key.split(delimiter).map(transformKey)\n let key1 = getkey(split.shift())\n let key2 = getkey(split[0])\n let recipient = result\n\n while (key2 !== undefined) {\n if (key1 === '__proto__') {\n return\n }\n\n const type = Object.prototype.toString.call(recipient[key1])\n const isobject = (\n type === '[object Object]' ||\n type === '[object Array]'\n )\n\n // do not write over falsey, non-undefined values if overwrite is false\n if (!overwrite && !isobject && typeof recipient[key1] !== 'undefined') {\n return\n }\n\n if ((overwrite && !isobject) || (!overwrite && recipient[key1] == null)) {\n recipient[key1] = (\n typeof key2 === 'number' &&\n !opts.object\n ? []\n : {}\n )\n }\n\n recipient = recipient[key1]\n if (split.length > 0) {\n key1 = getkey(split.shift())\n key2 = getkey(split[0])\n }\n }\n\n // unflatten again for 'messy objects'\n recipient[key1] = unflatten(target[key], opts)\n })\n\n return result\n}\n","import { t } from '../../../locale';\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n message?: ValidationMessage;\n}\n\nexport default function email(config: Config = {}): ValidationRule {\n return {\n name: 'email',\n validator(value) {\n return !isDefined(value) || (typeof value === 'string' && /^\\S+@\\S+\\.\\S+$/.test(value));\n },\n message: config.message || t('ll.validation.email'),\n };\n}\n","import { MaybeRefOrGetter, toValue } from 'vue';\n\nimport { t } from '../../../locale';\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n max: MaybeRefOrGetter<number>;\n message?: ValidationMessage;\n trim?: boolean;\n}\n\nexport default function maxLength(config: Config): ValidationRule {\n return {\n name: 'maxLength',\n validator(_value) {\n const max = toValue(config.max);\n const value = toValue(_value);\n\n if (!isDefined(value)) {\n return true;\n }\n\n let valueString = String(value);\n\n if (config.trim) {\n valueString = valueString.trim();\n }\n\n return valueString.length <= max;\n },\n message: config.message || (() => t('ll.validation.maxLength', { max: String(toValue(config.max)) })),\n };\n}\n","import { MaybeRefOrGetter, toValue } from 'vue';\n\nimport { t } from '../../../locale';\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n max: MaybeRefOrGetter<number>;\n message?: ValidationMessage;\n}\n\nexport default function maxValue(config: Config): ValidationRule {\n return {\n name: 'maxValue',\n validator(value) {\n const max = toValue(config.max);\n\n return !isDefined(value) || Number(value) <= max;\n },\n message: config.message || (() => t('ll.validation.maxValue', { max: String(toValue(config.max)) })),\n };\n}\n","import { MaybeRefOrGetter, toValue } from 'vue';\n\nimport { t } from '../../../locale';\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n min: MaybeRefOrGetter<number>;\n message?: ValidationMessage;\n trim?: boolean;\n}\n\nexport default function minLength(config: Config): ValidationRule {\n return {\n name: 'minLength',\n validator(_value) {\n const min = toValue(config.min);\n const value = toValue(_value);\n\n if (!isDefined(value)) {\n return true;\n }\n\n let valueString = String(value);\n\n if (config.trim) {\n valueString = valueString.trim();\n }\n\n return valueString.length >= min;\n },\n message: config.message || (() => t('ll.validation.minLength', { min: String(toValue(config.min)) })),\n };\n}\n","import { MaybeRefOrGetter, toValue } from 'vue';\n\nimport { t } from '../../../locale';\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n min: MaybeRefOrGetter<number>;\n message?: ValidationMessage;\n}\n\nexport default function minValue(config: Config): ValidationRule {\n return {\n name: 'minValue',\n validator(value) {\n const min = toValue(config.min);\n\n return !isDefined(value) || Number(value) >= min;\n },\n message: config.message || (() => t('ll.validation.minValue', { min: String(toValue(config.min)) })),\n };\n}\n","import { toValue } from 'vue';\n\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n regex: RegExp;\n /** A custom message is required in order to inform the user of the required pattern. */\n message: ValidationMessage;\n}\n\nexport default function pattern(config: Config): ValidationRule {\n return {\n name: 'pattern',\n validator(_value) {\n const value = toValue(_value);\n\n return !isDefined(value) || config.regex.test(String(value));\n },\n message: () => {\n if (typeof config.message !== 'string' || !config.message.trim()) {\n throw new Error(\n 'The \"pattern\" ruleFactory requires a custom message informing the user of the required pattern.',\n );\n }\n\n return config.message;\n },\n };\n}\n","import { t } from '../../../locale';\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n message?: ValidationMessage;\n}\n\nexport default function positiveNumber(config: Config = {}): ValidationRule {\n return {\n name: 'positiveNumber',\n validator(value) {\n return !isDefined(value) || Number(value) > 0;\n },\n message: config.message || t('ll.validation.positiveNumber'),\n };\n}\n","import round from 'lodash-es/round';\n\nimport { DECIMAL_PRECISION } from '../../../constants';\nimport { t } from '../../../locale';\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n message?: ValidationMessage;\n}\n\nexport default function price(config: Config = {}): ValidationRule {\n return {\n name: 'price',\n validator(value) {\n const price = Number(value);\n\n return (\n !isDefined(value) || (price !== Infinity && price >= 0 && price === round(price, DECIMAL_PRECISION.CURRENCY))\n );\n },\n message: config.message || t('ll.validation.price'),\n };\n}\n","import { t } from '../../../locale';\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n message?: ValidationMessage;\n}\n\nexport default function required(config: Config = {}): ValidationRule {\n return {\n name: 'required',\n validator(value) {\n return isDefined(typeof value === 'string' ? value.trim() : value);\n },\n message: config.message || t('ll.validation.required'),\n };\n}\n","import { t } from '../../../locale';\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n message?: ValidationMessage;\n}\n\nexport default function wholeNumber(config: Config = {}): ValidationRule {\n return {\n name: 'wholeNumber',\n validator(value) {\n return !isDefined(value) || (Number.isInteger(Number(value)) && Number(value) >= 0);\n },\n message: config.message || t('ll.validation.wholeNumber'),\n };\n}\n","import { flatten } from 'flat';\nimport debounce from 'lodash-es/debounce';\nimport get from 'lodash-es/get';\nimport { computed, nextTick, reactive, readonly, Ref, ref, toValue, UnwrapRef, watch } from 'vue';\n\nimport { DEBOUNCE } from '../../constants';\nimport {\n UseValidationArgs,\n ValidationError,\n ValidationField,\n ValidationGroup,\n ValidationRule,\n} from './useValidation.types';\n\nexport default function useValidation<Values extends object>({\n rules,\n values,\n}: UseValidationArgs<Values>): ValidationGroup<Values> {\n const fieldNames = computed(() => Object.keys(flatten(rules, { safe: true })));\n\n const fields = fieldNames.value.reduce((map, fieldName) => {\n const fieldValue = ref(get(toValue(values), fieldName));\n\n // Having this function here allows us to update the fieldValue when the value of the field changes.\n // Also, passing `fieldValue` outside the `.reduce()` loop will cause a racing condition on `fieldValue` updates\n const updateFieldValue = (fieldName: string) => {\n fieldValue.value = get(toValue(values), fieldName);\n };\n\n const debouncedSetFieldValue = debounce(() => {\n updateFieldValue(fieldName);\n }, DEBOUNCE.FAST);\n\n watch(\n () => get(toValue(values), fieldName),\n () => {\n debouncedSetFieldValue();\n },\n );\n\n map[fieldName] = buildField<UnwrapRef<typeof fieldValue>>({\n fieldName,\n fieldValue,\n flush: () => {\n debouncedSetFieldValue.cancel();\n updateFieldValue(fieldName);\n },\n rules: get(rules, fieldName),\n });\n\n return map;\n }, {} as Record<string, ValidationField>);\n\n const fieldList = computed(() => Object.values(fields));\n\n const hasErrors = computed(() => fieldList.value.some((field) => field.errors.length > 0));\n\n const someTouched = computed(() => fieldList.value.some((field) => field.isTouched));\n\n const dirtyFields = computed(() => fieldList.value.filter((field) => field.isDirty));\n\n const validate: ValidationGroup<Values>['validate'] = async function ({ preventScroll } = {}) {\n fieldList.value.forEach((field) => {\n // Doing setTouched(true) on a field that already has isTouched as `true` will not trigger reactivity for that field. Therefore, setting isTouched to `false` for all fields ensures that setTouched(true) will trigger reactivity for every field, which will cause all validations to run and display any error messages.\n field.setTouched(false);\n field.setTouched(true);\n });\n await nextTick();\n\n if (hasErrors.value && !preventScroll) {\n const firstFieldWithError = Object.entries(fields).find(([_, field]) => field.errorMessage);\n const fieldName = firstFieldWithError?.[0] || '';\n const firstErrorElement = document?.querySelector(`[name=${fieldName}]`);\n\n if (firstErrorElement) {\n firstErrorElement.scrollIntoView({ behavior: 'smooth' });\n }\n }\n\n return !hasErrors.value;\n };\n\n const getError: ValidationGroup<Values>['getError'] = function (fieldName: string) {\n return fields[fieldName]?.errorMessage || '';\n };\n\n const touch: ValidationGroup<Values>['touch'] = function (fieldName: string) {\n if (!fields[fieldName]) {\n throw new Error(`In touch: fieldName \"${fieldName}\" does not exist in the validation fields.`);\n }\n\n fields[fieldName].setTouched();\n };\n\n const setAllUntouched: ValidationGroup<Values>['setAllUntouched'] = async function () {\n await nextTick(); // wait for field values to be reset\n fieldList.value.forEach((field) => {\n field.setTouched(false);\n });\n };\n\n const setInitialValues: ValidationGroup<Values>['setInitialValues'] = function (intialValues: Values) {\n fieldList.value.forEach((field) => {\n field.setInitialValue(intialValues[field.name]);\n });\n };\n\n return reactive({\n validate,\n getError,\n touch,\n setAllUntouched,\n setInitialValues,\n fields,\n dirtyFields,\n hasErrors,\n someTouched,\n });\n}\n\ninterface BuildFieldArgs<Value = unknown> {\n fieldName: string;\n fieldValue: Ref<Value> | Ref<Value>;\n rules: ValidationRule[];\n flush: () => void;\n}\n\nfunction buildField<Value = unknown>({\n fieldName,\n fieldValue,\n rules,\n flush,\n}: BuildFieldArgs<Value>): ValidationField<Value> {\n /**\n * In order for `initialValue` to work properly, the `buildField` function must not be reactive; `buildField` should be called only once for each field when `useValidation` is called.\n */\n const initialValue = ref(fieldValue.value) as Ref<Value>;\n const isTouched = ref(false);\n const isDirty = computed(() => (fieldValue.value ?? '') !== (initialValue.value ?? ''));\n\n const results = computed(() => {\n // Adding a check for `isTouched` to avoid running the validation rules on the initial load, when the field is not touched.\n // if receives a fieldValue with some value as default or not, rule validation should also be triggered only via `touch()` or `validate()` methods.\n if (!isTouched.value) {\n return [];\n }\n\n return rules.map((rule) => ({\n fieldName,\n ruleName: rule.name,\n isValid: rule.validator(fieldValue.value),\n message: typeof rule.message === 'function' ? rule.message(fieldValue.value) : rule.message,\n }));\n });\n\n const errors = computed<ValidationError[]>(() =>\n results.value\n .filter((result) => !result.isValid)\n .map((result) => {\n return {\n ruleName: result.ruleName,\n message: result.message,\n };\n }),\n );\n\n function setTouched(value = true) {\n // Flushing the debounced value to be updated right away.\n // So that, we can have reactivity for `rules` validation, `isTouched`, `isDirty`, among other values\n flush();\n\n isTouched.value = value;\n }\n\n function setInitialValue(value: Value) {\n initialValue.value = value;\n }\n\n return reactive({\n name: fieldName,\n currentValue: readonly(fieldValue),\n initialValue: readonly(initialValue),\n isTouched: readonly(isTouched),\n isDirty: readonly(isDirty),\n errorMessage: computed(() => errors.value?.[0]?.message || ''),\n errors,\n setInitialValue,\n setTouched,\n });\n}\n\n// The ruleFactories are excluded from the main entrypoint in vite.config.ts, so they are exported here instead. This allows one import statement to be used for useValidation, its types, and all of the ruleFactories.\nexport { default as email } from './ruleFactories/email';\nexport { default as maxLength } from './ruleFactories/maxLength';\nexport { default as maxValue } from './ruleFactories/maxValue';\nexport { default as minLength } from './ruleFactories/minLength';\nexport { default as minValue } from './ruleFactories/minValue';\nexport { default as pattern } from './ruleFactories/pattern';\nexport { default as positiveNumber } from './ruleFactories/positiveNumber';\nexport { default as price } from './ruleFactories/price';\nexport { default as required } from './ruleFactories/required';\nexport { default as wholeNumber } from './ruleFactories/wholeNumber';\nexport * from './useValidation.types';\nexport { default as isDefined } from './utils/isDefined';\n"],"names":["isBuffer","obj","keyIdentity","key","flatten","target","opts","delimiter","maxDepth","transformKey","output","step","object","prev","currentDepth","value","isarray","type","isbuffer","isobject","newKey","email","config","isDefined","t","maxLength","_value","max","toValue","valueString","maxValue","minLength","min","minValue","pattern","positiveNumber","price","round","DECIMAL_PRECISION","required","wholeNumber","useValidation","rules","values","fields","computed","map","fieldName","fieldValue","ref","get","updateFieldValue","debouncedSetFieldValue","debounce","DEBOUNCE","watch","buildField","fieldList","hasErrors","field","someTouched","dirtyFields","reactive","preventScroll","nextTick","firstFieldWithError","_","firstErrorElement","_a","intialValues","flush","initialValue","isTouched","isDirty","results","rule","errors","result","setTouched","setInitialValue","readonly","_b"],"mappings":";;;;;;;AAAA,SAASA,EAAUC,GAAK;AACtB,SAAOA,KACLA,EAAI,eACH,OAAOA,EAAI,YAAY,YAAa,cACrCA,EAAI,YAAY,SAASA,CAAG;AAChC;AAEA,SAASC,EAAaC,GAAK;AACzB,SAAOA;AACT;AAEO,SAASC,EAASC,GAAQC,GAAM;AACrC,EAAAA,IAAOA,KAAQ,CAAE;AAEjB,QAAMC,IAAYD,EAAK,aAAa,KAC9BE,IAAWF,EAAK,UAChBG,IAAeH,EAAK,gBAAgBJ,GACpCQ,IAAS,CAAE;AAEjB,WAASC,EAAMC,GAAQC,GAAMC,GAAc;AACzC,IAAAA,IAAeA,KAAgB,GAC/B,OAAO,KAAKF,CAAM,EAAE,QAAQ,SAAUT,GAAK;AACzC,YAAMY,IAAQH,EAAOT,CAAG,GAClBa,IAAUV,EAAK,QAAQ,MAAM,QAAQS,CAAK,GAC1CE,IAAO,OAAO,UAAU,SAAS,KAAKF,CAAK,GAC3CG,IAAWlB,EAASe,CAAK,GACzBI,IACJF,MAAS,qBACTA,MAAS,kBAGLG,IAASP,IACXA,IAAON,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AASA,EAAK,UAAU3B,EAAW,KAAK;AAAA,IACxC,SAAS,OAAO2B,EAAK,WAAY,aAAaA,EAAK,QAAQ3B,EAAW,KAAK,IAAI2B,EAAK;AAAA,EACpF,EAAA,IARO,EASV,GAEKC,IAAS/B;AAAA,IAA4B,MACzC6B,EAAQ,MACL,OAAO,CAACG,MAAW,CAACA,EAAO,OAAO,EAClC,IAAI,CAACA,OACG;AAAA,MACL,UAAUA,EAAO;AAAA,MACjB,SAASA,EAAO;AAAA,IAAA,EAEnB;AAAA,EAAA;AAGI,WAAAC,EAAW/D,IAAQ,IAAM;AAG1B,IAAAuD,KAENE,EAAU,QAAQzD;AAAA,EACpB;AAEA,WAASgE,EAAgBhE,GAAc;AACrC,IAAAwD,EAAa,QAAQxD;AAAA,EACvB;AAEA,SAAO+C,EAAS;AAAA,IACd,MAAMf;AAAA,IACN,cAAciC,EAAShC,CAAU;AAAA,IACjC,cAAcgC,EAAST,CAAY;AAAA,IACnC,WAAWS,EAASR,CAAS;AAAA,IAC7B,SAASQ,EAASP,CAAO;AAAA,IACzB,cAAc5B,EAAS;;AAAM,eAAAoC,KAAAb,IAAAQ,EAAO,UAAP,gBAAAR,EAAe,OAAf,gBAAAa,EAAmB,YAAW;AAAA,KAAE;AAAA,IAC7D,QAAAL;AAAA,IACA,iBAAAG;AAAA,IACA,YAAAD;AAAA,EAAA,CACD;AACH;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"useValidation.js","sources":["../node_modules/flat/index.js","../src/composables/useValidation/ruleFactories/email.ts","../src/composables/useValidation/ruleFactories/maxLength.ts","../src/composables/useValidation/ruleFactories/maxValue.ts","../src/composables/useValidation/ruleFactories/minLength.ts","../src/composables/useValidation/ruleFactories/minValue.ts","../src/composables/useValidation/ruleFactories/pattern.ts","../src/composables/useValidation/ruleFactories/positiveNumber.ts","../src/composables/useValidation/ruleFactories/price.ts","../src/composables/useValidation/ruleFactories/required.ts","../src/composables/useValidation/ruleFactories/wholeNumber.ts","../src/composables/useValidation/useValidation.ts"],"sourcesContent":["function isBuffer (obj) {\n return obj &&\n obj.constructor &&\n (typeof obj.constructor.isBuffer === 'function') &&\n obj.constructor.isBuffer(obj)\n}\n\nfunction keyIdentity (key) {\n return key\n}\n\nexport function flatten (target, opts) {\n opts = opts || {}\n\n const delimiter = opts.delimiter || '.'\n const maxDepth = opts.maxDepth\n const transformKey = opts.transformKey || keyIdentity\n const output = {}\n\n function step (object, prev, currentDepth) {\n currentDepth = currentDepth || 1\n Object.keys(object).forEach(function (key) {\n const value = object[key]\n const isarray = opts.safe && Array.isArray(value)\n const type = Object.prototype.toString.call(value)\n const isbuffer = isBuffer(value)\n const isobject = (\n type === '[object Object]' ||\n type === '[object Array]'\n )\n\n const newKey = prev\n ? prev + delimiter + transformKey(key)\n : transformKey(key)\n\n if (!isarray && !isbuffer && isobject && Object.keys(value).length &&\n (!opts.maxDepth || currentDepth < maxDepth)) {\n return step(value, newKey, currentDepth + 1)\n }\n\n output[newKey] = value\n })\n }\n\n step(target)\n\n return output\n}\n\nexport function unflatten (target, opts) {\n opts = opts || {}\n\n const delimiter = opts.delimiter || '.'\n const overwrite = opts.overwrite || false\n const transformKey = opts.transformKey || keyIdentity\n const result = {}\n\n const isbuffer = isBuffer(target)\n if (isbuffer || Object.prototype.toString.call(target) !== '[object Object]') {\n return target\n }\n\n // safely ensure that the key is\n // an integer.\n function getkey (key) {\n const parsedKey = Number(key)\n\n return (\n isNaN(parsedKey) ||\n key.indexOf('.') !== -1 ||\n opts.object\n )\n ? key\n : parsedKey\n }\n\n function addKeys (keyPrefix, recipient, target) {\n return Object.keys(target).reduce(function (result, key) {\n result[keyPrefix + delimiter + key] = target[key]\n\n return result\n }, recipient)\n }\n\n function isEmpty (val) {\n const type = Object.prototype.toString.call(val)\n const isArray = type === '[object Array]'\n const isObject = type === '[object Object]'\n\n if (!val) {\n return true\n } else if (isArray) {\n return !val.length\n } else if (isObject) {\n return !Object.keys(val).length\n }\n }\n\n target = Object.keys(target).reduce(function (result, key) {\n const type = Object.prototype.toString.call(target[key])\n const isObject = (type === '[object Object]' || type === '[object Array]')\n if (!isObject || isEmpty(target[key])) {\n result[key] = target[key]\n return result\n } else {\n return addKeys(\n key,\n result,\n flatten(target[key], opts)\n )\n }\n }, {})\n\n Object.keys(target).forEach(function (key) {\n const split = key.split(delimiter).map(transformKey)\n let key1 = getkey(split.shift())\n let key2 = getkey(split[0])\n let recipient = result\n\n while (key2 !== undefined) {\n if (key1 === '__proto__') {\n return\n }\n\n const type = Object.prototype.toString.call(recipient[key1])\n const isobject = (\n type === '[object Object]' ||\n type === '[object Array]'\n )\n\n // do not write over falsey, non-undefined values if overwrite is false\n if (!overwrite && !isobject && typeof recipient[key1] !== 'undefined') {\n return\n }\n\n if ((overwrite && !isobject) || (!overwrite && recipient[key1] == null)) {\n recipient[key1] = (\n typeof key2 === 'number' &&\n !opts.object\n ? []\n : {}\n )\n }\n\n recipient = recipient[key1]\n if (split.length > 0) {\n key1 = getkey(split.shift())\n key2 = getkey(split[0])\n }\n }\n\n // unflatten again for 'messy objects'\n recipient[key1] = unflatten(target[key], opts)\n })\n\n return result\n}\n","import { t } from '../../../locale';\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n message?: ValidationMessage;\n}\n\nexport default function email(config: Config = {}): ValidationRule {\n return {\n name: 'email',\n validator(value) {\n return !isDefined(value) || (typeof value === 'string' && /^\\S+@\\S+\\.\\S+$/.test(value));\n },\n message: config.message || t('ll.validation.email'),\n };\n}\n","import { MaybeRefOrGetter, toValue } from 'vue';\n\nimport { t } from '../../../locale';\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n max: MaybeRefOrGetter<number>;\n message?: ValidationMessage;\n trim?: boolean;\n}\n\nexport default function maxLength(config: Config): ValidationRule {\n return {\n name: 'maxLength',\n validator(_value) {\n const max = toValue(config.max);\n const value = toValue(_value);\n\n if (!isDefined(value)) {\n return true;\n }\n\n let valueString = String(value);\n\n if (config.trim) {\n valueString = valueString.trim();\n }\n\n return valueString.length <= max;\n },\n message: config.message || (() => t('ll.validation.maxLength', { max: String(toValue(config.max)) })),\n };\n}\n","import { MaybeRefOrGetter, toValue } from 'vue';\n\nimport { t } from '../../../locale';\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n max: MaybeRefOrGetter<number>;\n message?: ValidationMessage;\n}\n\nexport default function maxValue(config: Config): ValidationRule {\n return {\n name: 'maxValue',\n validator(value) {\n const max = toValue(config.max);\n\n return !isDefined(value) || Number(value) <= max;\n },\n message: config.message || (() => t('ll.validation.maxValue', { max: String(toValue(config.max)) })),\n };\n}\n","import { MaybeRefOrGetter, toValue } from 'vue';\n\nimport { t } from '../../../locale';\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n min: MaybeRefOrGetter<number>;\n message?: ValidationMessage;\n trim?: boolean;\n}\n\nexport default function minLength(config: Config): ValidationRule {\n return {\n name: 'minLength',\n validator(_value) {\n const min = toValue(config.min);\n const value = toValue(_value);\n\n if (!isDefined(value)) {\n return true;\n }\n\n let valueString = String(value);\n\n if (config.trim) {\n valueString = valueString.trim();\n }\n\n return valueString.length >= min;\n },\n message: config.message || (() => t('ll.validation.minLength', { min: String(toValue(config.min)) })),\n };\n}\n","import { MaybeRefOrGetter, toValue } from 'vue';\n\nimport { t } from '../../../locale';\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n min: MaybeRefOrGetter<number>;\n message?: ValidationMessage;\n}\n\nexport default function minValue(config: Config): ValidationRule {\n return {\n name: 'minValue',\n validator(value) {\n const min = toValue(config.min);\n\n return !isDefined(value) || Number(value) >= min;\n },\n message: config.message || (() => t('ll.validation.minValue', { min: String(toValue(config.min)) })),\n };\n}\n","import { toValue } from 'vue';\n\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n regex: RegExp;\n /** A custom message is required in order to inform the user of the required pattern. */\n message: ValidationMessage;\n}\n\nexport default function pattern(config: Config): ValidationRule {\n return {\n name: 'pattern',\n validator(_value) {\n const value = toValue(_value);\n\n return !isDefined(value) || config.regex.test(String(value));\n },\n message: () => {\n if (typeof config.message !== 'string' || !config.message.trim()) {\n throw new Error(\n 'The \"pattern\" ruleFactory requires a custom message informing the user of the required pattern.',\n );\n }\n\n return config.message;\n },\n };\n}\n","import { t } from '../../../locale';\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n message?: ValidationMessage;\n}\n\nexport default function positiveNumber(config: Config = {}): ValidationRule {\n return {\n name: 'positiveNumber',\n validator(value) {\n return !isDefined(value) || Number(value) > 0;\n },\n message: config.message || t('ll.validation.positiveNumber'),\n };\n}\n","import round from 'lodash-es/round';\n\nimport { DECIMAL_PRECISION } from '../../../constants';\nimport { t } from '../../../locale';\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n message?: ValidationMessage;\n}\n\nexport default function price(config: Config = {}): ValidationRule {\n return {\n name: 'price',\n validator(value) {\n const price = Number(value);\n\n return (\n !isDefined(value) || (price !== Infinity && price >= 0 && price === round(price, DECIMAL_PRECISION.CURRENCY))\n );\n },\n message: config.message || t('ll.validation.price'),\n };\n}\n","import { t } from '../../../locale';\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n message?: ValidationMessage;\n}\n\nexport default function required(config: Config = {}): ValidationRule {\n return {\n name: 'required',\n validator(value) {\n return isDefined(typeof value === 'string' ? value.trim() : value);\n },\n message: config.message || t('ll.validation.required'),\n };\n}\n","import { t } from '../../../locale';\nimport { ValidationMessage, ValidationRule } from '../useValidation.types';\nimport isDefined from '../utils/isDefined';\n\ninterface Config {\n message?: ValidationMessage;\n}\n\nexport default function wholeNumber(config: Config = {}): ValidationRule {\n return {\n name: 'wholeNumber',\n validator(value) {\n return !isDefined(value) || (Number.isInteger(Number(value)) && Number(value) >= 0);\n },\n message: config.message || t('ll.validation.wholeNumber'),\n };\n}\n","import { flatten } from 'flat';\nimport debounce from 'lodash-es/debounce';\nimport get from 'lodash-es/get';\nimport { computed, nextTick, reactive, readonly, Ref, ref, toValue, UnwrapRef, watch } from 'vue';\n\nimport { DEBOUNCE } from '../../constants';\nimport {\n UseValidationArgs,\n ValidationError,\n ValidationField,\n ValidationGroup,\n ValidationRule,\n} from './useValidation.types';\n\nexport default function useValidation<Values extends object>({\n rules,\n values,\n}: UseValidationArgs<Values>): ValidationGroup<Values> {\n const fieldNames = computed(() => Object.keys(flatten(rules, { safe: true })));\n\n const fields = fieldNames.value.reduce((map, fieldName) => {\n const fieldValue = ref(get(toValue(values), fieldName));\n\n // Having this function here allows us to update the fieldValue when the value of the field changes.\n // Also, passing `fieldValue` outside the `.reduce()` loop will cause a racing condition on `fieldValue` updates\n const updateFieldValue = (fieldName: string) => {\n fieldValue.value = get(toValue(values), fieldName);\n };\n\n const debouncedSetFieldValue = debounce(() => {\n updateFieldValue(fieldName);\n }, DEBOUNCE.FAST);\n\n watch(\n () => get(toValue(values), fieldName),\n () => {\n debouncedSetFieldValue();\n },\n );\n\n map[fieldName] = buildField<UnwrapRef<typeof fieldValue>>({\n fieldName,\n fieldValue,\n flush: () => {\n debouncedSetFieldValue.cancel();\n updateFieldValue(fieldName);\n },\n rules: get(rules, fieldName),\n });\n\n return map;\n }, {} as Record<string, ValidationField>);\n\n const fieldList = computed(() => Object.values(fields));\n\n const hasErrors = computed(() => fieldList.value.some((field) => field.errors.length > 0));\n\n const someTouched = computed(() => fieldList.value.some((field) => field.isTouched));\n\n const dirtyFields = computed(() => fieldList.value.filter((field) => field.isDirty));\n\n const validate: ValidationGroup<Values>['validate'] = async function ({ preventScroll } = {}) {\n fieldList.value.forEach((field) => {\n // Doing setTouched(true) on a field that already has isTouched as `true` will not trigger reactivity for that field. Therefore, setting isTouched to `false` for all fields ensures that setTouched(true) will trigger reactivity for every field, which will cause all validations to run and display any error messages.\n field.setTouched(false);\n field.setTouched(true);\n });\n await nextTick();\n\n if (hasErrors.value && !preventScroll) {\n const firstFieldWithError = Object.entries(fields).find(([_, field]) => field.errorMessage);\n const fieldName = firstFieldWithError?.[0] || '';\n const firstErrorElement = document?.querySelector(`[name=${fieldName}]`);\n\n if (firstErrorElement) {\n firstErrorElement.scrollIntoView({ behavior: 'smooth' });\n }\n }\n\n return !hasErrors.value;\n };\n\n const getError: ValidationGroup<Values>['getError'] = function (fieldName: string) {\n return fields[fieldName]?.errorMessage || '';\n };\n\n const touch: ValidationGroup<Values>['touch'] = function (fieldName: string) {\n if (!fields[fieldName]) {\n throw new Error(`In touch: fieldName \"${fieldName}\" does not exist in the validation fields.`);\n }\n\n fields[fieldName].setTouched();\n };\n\n const setAllUntouched: ValidationGroup<Values>['setAllUntouched'] = async function () {\n await nextTick(); // wait for field values to be reset\n fieldList.value.forEach((field) => {\n field.setTouched(false);\n });\n };\n\n const setInitialValues: ValidationGroup<Values>['setInitialValues'] = function (intialValues: Values) {\n fieldList.value.forEach((field) => {\n field.setInitialValue(intialValues[field.name]);\n });\n };\n\n return reactive({\n validate,\n getError,\n touch,\n setAllUntouched,\n setInitialValues,\n fields,\n dirtyFields,\n hasErrors,\n someTouched,\n });\n}\n\ninterface BuildFieldArgs<Value = unknown> {\n fieldName: string;\n fieldValue: Ref<Value> | Ref<Value>;\n rules: ValidationRule[];\n flush: () => void;\n}\n\nfunction buildField<Value = unknown>({\n fieldName,\n fieldValue,\n rules,\n flush,\n}: BuildFieldArgs<Value>): ValidationField<Value> {\n /**\n * In order for `initialValue` to work properly, the `buildField` function must not be reactive; `buildField` should be called only once for each field when `useValidation` is called.\n */\n const initialValue = ref(fieldValue.value) as Ref<Value>;\n const isTouched = ref(false);\n const isDirty = computed(() => (fieldValue.value ?? '') !== (initialValue.value ?? ''));\n\n const results = computed(() => {\n // Adding a check for `isTouched` to avoid running the validation rules on the initial load, when the field is not touched.\n // if receives a fieldValue with some value as default or not, rule validation should also be triggered only via `touch()` or `validate()` methods.\n if (!isTouched.value) {\n return [];\n }\n\n return rules.map((rule) => ({\n fieldName,\n ruleName: rule.name,\n isValid: rule.validator(fieldValue.value),\n message: typeof rule.message === 'function' ? rule.message(fieldValue.value) : rule.message,\n }));\n });\n\n const errors = computed<ValidationError[]>(() =>\n results.value\n .filter((result) => !result.isValid)\n .map((result) => {\n return {\n ruleName: result.ruleName,\n message: result.message,\n };\n }),\n );\n\n function setTouched(value = true) {\n // Flushing the debounced value to be updated right away.\n // So that, we can have reactivity for `rules` validation, `isTouched`, `isDirty`, among other values\n flush();\n\n isTouched.value = value;\n }\n\n function setInitialValue(value: Value) {\n initialValue.value = value;\n }\n\n return reactive({\n name: fieldName,\n currentValue: readonly(fieldValue),\n initialValue: readonly(initialValue),\n isTouched: readonly(isTouched),\n isDirty: readonly(isDirty),\n errorMessage: computed(() => errors.value?.[0]?.message || ''),\n errors,\n setInitialValue,\n setTouched,\n });\n}\n\n// The ruleFactories are excluded from the main entrypoint in vite.config.ts, so they are exported here instead. This allows one import statement to be used for useValidation, its types, and all of the ruleFactories.\nexport { default as email } from './ruleFactories/email';\nexport { default as maxLength } from './ruleFactories/maxLength';\nexport { default as maxValue } from './ruleFactories/maxValue';\nexport { default as minLength } from './ruleFactories/minLength';\nexport { default as minValue } from './ruleFactories/minValue';\nexport { default as pattern } from './ruleFactories/pattern';\nexport { default as positiveNumber } from './ruleFactories/positiveNumber';\nexport { default as price } from './ruleFactories/price';\nexport { default as required } from './ruleFactories/required';\nexport { default as wholeNumber } from './ruleFactories/wholeNumber';\nexport * from './useValidation.types';\nexport { default as isDefined } from './utils/isDefined';\n"],"names":["isBuffer","obj","keyIdentity","key","flatten","target","opts","delimiter","maxDepth","transformKey","output","step","object","prev","currentDepth","value","isarray","type","isbuffer","isobject","newKey","email","config","isDefined","t","maxLength","_value","max","toValue","valueString","maxValue","minLength","min","minValue","pattern","positiveNumber","price","round","DECIMAL_PRECISION","required","wholeNumber","useValidation","rules","values","fields","computed","map","fieldName","fieldValue","ref","get","updateFieldValue","debouncedSetFieldValue","debounce","DEBOUNCE","watch","buildField","fieldList","hasErrors","field","someTouched","dirtyFields","reactive","preventScroll","nextTick","firstFieldWithError","_","firstErrorElement","_a","intialValues","flush","initialValue","isTouched","isDirty","results","rule","errors","result","setTouched","setInitialValue","readonly","_b"],"mappings":";;;;;;;AAAA,SAASA,EAAUC,GAAK;AACtB,SAAOA,KACLA,EAAI,eACH,OAAOA,EAAI,YAAY,YAAa,cACrCA,EAAI,YAAY,SAASA,CAAG;AAChC;AAEA,SAASC,EAAaC,GAAK;AACzB,SAAOA;AACT;AAEO,SAASC,EAASC,GAAQC,GAAM;AACrC,EAAAA,IAAOA,KAAQ,CAAE;AAEjB,QAAMC,IAAYD,EAAK,aAAa,KAC9BE,IAAWF,EAAK,UAChBG,IAAeH,EAAK,gBAAgBJ,GACpCQ,IAAS,CAAE;AAEjB,WAASC,EAAMC,GAAQC,GAAMC,GAAc;AACzC,IAAAA,IAAeA,KAAgB,GAC/B,OAAO,KAAKF,CAAM,EAAE,QAAQ,SAAUT,GAAK;AACzC,YAAMY,IAAQH,EAAOT,CAAG,GAClBa,IAAUV,EAAK,QAAQ,MAAM,QAAQS,CAAK,GAC1CE,IAAO,OAAO,UAAU,SAAS,KAAKF,CAAK,GAC3CG,IAAWlB,EAASe,CAAK,GACzBI,IACJF,MAAS,qBACTA,MAAS,kBAGLG,IAASP,IACXA,IAAON,IAAYE,EAAaN,CAAG,IACnCM,EAAaN,CAAG;AAEpB,UAAI,CAACa,KAAW,CAACE,KAAYC,KAAY,OAAO,KAAKJ,CAAK,EAAE,WACzD,CAACT,EAAK,YAAYQ,IAAeN;AAClC,eAAOG,EAAKI,GAAOK,GAAQN,IAAe,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,IAA4B,MACzC6B,EAAQ,MACL,OAAO,CAACG,MAAW,CAACA,EAAO,OAAO,EAClC,IAAI,CAACA,OACG;AAAA,MACL,UAAUA,EAAO;AAAA,MACjB,SAASA,EAAO;AAAA,IAAA,EAEnB;AAAA,EAAA;AAGI,WAAAC,EAAW/D,IAAQ,IAAM;AAG1B,IAAAuD,KAENE,EAAU,QAAQzD;AAAA,EACpB;AAEA,WAASgE,EAAgBhE,GAAc;AACrC,IAAAwD,EAAa,QAAQxD;AAAA,EACvB;AAEA,SAAO+C,EAAS;AAAA,IACd,MAAMf;AAAA,IACN,cAAciC,EAAShC,CAAU;AAAA,IACjC,cAAcgC,EAAST,CAAY;AAAA,IACnC,WAAWS,EAASR,CAAS;AAAA,IAC7B,SAASQ,EAASP,CAAO;AAAA,IACzB,cAAc5B,EAAS;;AAAM,eAAAoC,KAAAb,IAAAQ,EAAO,UAAP,gBAAAR,EAAe,OAAf,gBAAAa,EAAmB,YAAW;AAAA,KAAE;AAAA,IAC7D,QAAAL;AAAA,IACA,iBAAAG;AAAA,IACA,YAAAD;AAAA,EAAA,CACD;AACH;","x_google_ignoreList":[0]}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import { CSS_VARS as
|
|
2
|
-
import { getCssVar as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import "lodash-es/isFinite";
|
|
6
|
-
import "lodash-es/isPlainObject";
|
|
7
|
-
function m(e) {
|
|
8
|
-
const r = isNaN(parseFloat(i(o.GRID_GUTTER))) ? 0 : parseFloat(i(o.GRID_GUTTER)), t = e == null ? void 0 : e.getBoundingClientRect();
|
|
1
|
+
import { CSS_VARS as n } from "../constants.js";
|
|
2
|
+
import { getCssVar as o } from "./helpers.js";
|
|
3
|
+
function a(r) {
|
|
4
|
+
const e = isNaN(parseFloat(o(n.GRID_GUTTER))) ? 0 : parseFloat(o(n.GRID_GUTTER)), t = r == null ? void 0 : r.getBoundingClientRect();
|
|
9
5
|
if (t)
|
|
10
|
-
return Math.round(t.left) <
|
|
11
|
-
value:
|
|
6
|
+
return Math.round(t.left) < e ? {
|
|
7
|
+
value: e - Math.round(t.left),
|
|
12
8
|
side: "left"
|
|
13
|
-
} : Math.round(t.right) > document.documentElement.clientWidth -
|
|
14
|
-
value: Math.round(t.right) - (document.documentElement.clientWidth -
|
|
9
|
+
} : Math.round(t.right) > document.documentElement.clientWidth - e ? {
|
|
10
|
+
value: Math.round(t.right) - (document.documentElement.clientWidth - e),
|
|
15
11
|
side: "right"
|
|
16
12
|
} : {
|
|
17
13
|
side: "",
|
|
@@ -19,6 +15,6 @@ function m(e) {
|
|
|
19
15
|
};
|
|
20
16
|
}
|
|
21
17
|
export {
|
|
22
|
-
|
|
18
|
+
a as default
|
|
23
19
|
};
|
|
24
20
|
//# sourceMappingURL=calculateElementOverflow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateElementOverflow.js","sources":["../../src/utils/calculateElementOverflow.ts"],"sourcesContent":["import { CSS_VARS } from '../constants';\nimport { getCssVar } from '../utils/helpers';\n\n/**\n * Calculates the distance (in px) an element overflows the page (and gutter).\n * If left aligned, returns the overflow on the right side, and vice versa\n *\n * @param element element to test page overflow\n * @return object with the offset distance `value` in pixels, and the `side` of the page it's overflowing\n */\nexport default function calculateElementOverflow(element: HTMLElement | null) {\n const gutter = isNaN(parseFloat(getCssVar(CSS_VARS.GRID_GUTTER))) ? 0 : parseFloat(getCssVar(CSS_VARS.GRID_GUTTER));\n const elementBCR = element?.getBoundingClientRect();\n\n if (!elementBCR) {\n return;\n }\n\n // overflowing left side of the page\n if (Math.round(elementBCR.left) < gutter) {\n return {\n value: gutter - Math.round(elementBCR.left),\n side: 'left',\n };\n }\n\n // overflowing right side of the page\n if (Math.round(elementBCR.right) > document.documentElement.clientWidth - gutter) {\n return {\n value: Math.round(elementBCR.right) - (document.documentElement.clientWidth - gutter),\n side: 'right',\n };\n }\n\n return {\n side: '',\n value: 0,\n };\n}\n"],"names":["calculateElementOverflow","element","gutter","getCssVar","CSS_VARS","elementBCR"],"mappings":"
|
|
1
|
+
{"version":3,"file":"calculateElementOverflow.js","sources":["../../src/utils/calculateElementOverflow.ts"],"sourcesContent":["import { CSS_VARS } from '../constants';\nimport { getCssVar } from '../utils/helpers';\n\n/**\n * Calculates the distance (in px) an element overflows the page (and gutter).\n * If left aligned, returns the overflow on the right side, and vice versa\n *\n * @param element element to test page overflow\n * @return object with the offset distance `value` in pixels, and the `side` of the page it's overflowing\n */\nexport default function calculateElementOverflow(element: HTMLElement | null) {\n const gutter = isNaN(parseFloat(getCssVar(CSS_VARS.GRID_GUTTER))) ? 0 : parseFloat(getCssVar(CSS_VARS.GRID_GUTTER));\n const elementBCR = element?.getBoundingClientRect();\n\n if (!elementBCR) {\n return;\n }\n\n // overflowing left side of the page\n if (Math.round(elementBCR.left) < gutter) {\n return {\n value: gutter - Math.round(elementBCR.left),\n side: 'left',\n };\n }\n\n // overflowing right side of the page\n if (Math.round(elementBCR.right) > document.documentElement.clientWidth - gutter) {\n return {\n value: Math.round(elementBCR.right) - (document.documentElement.clientWidth - gutter),\n side: 'right',\n };\n }\n\n return {\n side: '',\n value: 0,\n };\n}\n"],"names":["calculateElementOverflow","element","gutter","getCssVar","CSS_VARS","elementBCR"],"mappings":";;AAUA,SAAwBA,EAAyBC,GAA6B;AAC5E,QAAMC,IAAS,MAAM,WAAWC,EAAUC,EAAS,WAAW,CAAC,CAAC,IAAI,IAAI,WAAWD,EAAUC,EAAS,WAAW,CAAC,GAC5GC,IAAaJ,KAAA,gBAAAA,EAAS;AAE5B,MAAKI;AAKL,WAAI,KAAK,MAAMA,EAAW,IAAI,IAAIH,IACzB;AAAA,MACL,OAAOA,IAAS,KAAK,MAAMG,EAAW,IAAI;AAAA,MAC1C,MAAM;AAAA,IAAA,IAKN,KAAK,MAAMA,EAAW,KAAK,IAAI,SAAS,gBAAgB,cAAcH,IACjE;AAAA,MACL,OAAO,KAAK,MAAMG,EAAW,KAAK,KAAK,SAAS,gBAAgB,cAAcH;AAAA,MAC9E,MAAM;AAAA,IAAA,IAIH;AAAA,MACL,MAAM;AAAA,MACN,OAAO;AAAA,IAAA;AAEX;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorScheme.js","sources":["../../src/utils/colorScheme.ts"],"sourcesContent":["import { StashPrimaryColorGroup } from '../../types/colors';\n\nconst CONTRAST_TEXT_MAP: { [key in StashPrimaryColorGroup]: string } = {\n blue: 'white',\n green: 'white',\n ice: 'ice-900',\n orange: 'ice-900',\n purple: 'white',\n red: 'white',\n royal: 'white',\n seafoam: 'ice-900',\n teal: 'ice-900',\n yellow: 'ice-900',\n};\n\ntype Shade = 'light' | 'main';\n\ninterface ColorSchemeArgs {\n shade: Shade;\n color: StashPrimaryColorGroup;\n}\n\nfunction bgColor(shade: Shade, color: StashPrimaryColorGroup) {\n if (shade === 'main') {\n return `${color}-500`;\n }\n\n const lightColorNo = color === 'ice' ? '200' : '100';\n\n return `${color}-${lightColorNo}`;\n}\n\nfunction textColor(shade: Shade, color: StashPrimaryColorGroup) {\n if (shade === 'main') {\n return CONTRAST_TEXT_MAP[color];\n }\n\n return `${color}-700`;\n}\n\n// TODO: Look into dynamically inferring contrast text color based on bg.\n// Might be easier when tailwind is around.\n// @see https://wunnle.com/dynamic-text-color-based-on-background\nexport default function colorScheme({ shade, color }: ColorSchemeArgs) {\n const computedBgColor = bgColor(shade, color);\n const computedTextColor = textColor(shade, color);\n\n return { computedBgColor, computedTextColor };\n}\n"],"names":["CONTRAST_TEXT_MAP","bgColor","shade","color","textColor","colorScheme","computedBgColor","computedTextColor"],"mappings":"AAEA,MAAMA,IAAiE;AAAA,EACrE,MAAM;AAAA,EACN,OAAO;AAAA,EACP,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,QAAQ;AACV;AASA,SAASC,EAAQC,GAAcC,GAA+B;AAC5D,SAAID,MAAU,SACL,GAAGC,
|
|
1
|
+
{"version":3,"file":"colorScheme.js","sources":["../../src/utils/colorScheme.ts"],"sourcesContent":["import { StashPrimaryColorGroup } from '../../types/colors';\n\nconst CONTRAST_TEXT_MAP: { [key in StashPrimaryColorGroup]: string } = {\n blue: 'white',\n green: 'white',\n ice: 'ice-900',\n orange: 'ice-900',\n purple: 'white',\n red: 'white',\n royal: 'white',\n seafoam: 'ice-900',\n teal: 'ice-900',\n yellow: 'ice-900',\n};\n\ntype Shade = 'light' | 'main';\n\ninterface ColorSchemeArgs {\n shade: Shade;\n color: StashPrimaryColorGroup;\n}\n\nfunction bgColor(shade: Shade, color: StashPrimaryColorGroup) {\n if (shade === 'main') {\n return `${color}-500`;\n }\n\n const lightColorNo = color === 'ice' ? '200' : '100';\n\n return `${color}-${lightColorNo}`;\n}\n\nfunction textColor(shade: Shade, color: StashPrimaryColorGroup) {\n if (shade === 'main') {\n return CONTRAST_TEXT_MAP[color];\n }\n\n return `${color}-700`;\n}\n\n// TODO: Look into dynamically inferring contrast text color based on bg.\n// Might be easier when tailwind is around.\n// @see https://wunnle.com/dynamic-text-color-based-on-background\nexport default function colorScheme({ shade, color }: ColorSchemeArgs) {\n const computedBgColor = bgColor(shade, color);\n const computedTextColor = textColor(shade, color);\n\n return { computedBgColor, computedTextColor };\n}\n"],"names":["CONTRAST_TEXT_MAP","bgColor","shade","color","textColor","colorScheme","computedBgColor","computedTextColor"],"mappings":"AAEA,MAAMA,IAAiE;AAAA,EACrE,MAAM;AAAA,EACN,OAAO;AAAA,EACP,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,QAAQ;AACV;AASA,SAASC,EAAQC,GAAcC,GAA+B;AAC5D,SAAID,MAAU,SACL,GAAGC,CAAK,SAKV,GAAGA,CAAK,IAFMA,MAAU,QAAQ,QAAQ,KAEhB;AACjC;AAEA,SAASC,EAAUF,GAAcC,GAA+B;AAC9D,SAAID,MAAU,SACLF,EAAkBG,CAAK,IAGzB,GAAGA,CAAK;AACjB;AAKA,SAAwBE,EAAY,EAAE,OAAAH,GAAO,OAAAC,KAA0B;AAC/D,QAAAG,IAAkBL,EAAQC,GAAOC,CAAK,GACtCI,IAAoBH,EAAUF,GAAOC,CAAK;AAEzC,SAAA,EAAE,iBAAAG,GAAiB,mBAAAC;AAC5B;"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import o from "lodash-es/snakeCase";
|
|
2
|
-
import { i as n } from "../isDefined-
|
|
3
|
-
|
|
4
|
-
function m(i, { shouldInclude: a = n } = {}) {
|
|
2
|
+
import { i as n } from "../isDefined-DzVx0B6k.js";
|
|
3
|
+
function f(i, { shouldInclude: a = n } = {}) {
|
|
5
4
|
const e = new URLSearchParams({});
|
|
6
5
|
return Object.entries(i).forEach(([t, r]) => {
|
|
7
6
|
if (a(r, t))
|
|
@@ -23,7 +22,7 @@ Values must be Primitive Values or arrays of Primitive Values. See: https://deve
|
|
|
23
22
|
}), e.toString();
|
|
24
23
|
}
|
|
25
24
|
export {
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
f as createQueryString,
|
|
26
|
+
f as default
|
|
28
27
|
};
|
|
29
28
|
//# sourceMappingURL=createQueryString.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createQueryString.js","sources":["../../src/utils/createQueryString.ts"],"sourcesContent":["import snakeCase from 'lodash-es/snakeCase';\n\nimport isDefined from '../composables/useValidation/utils/isDefined';\n\ninterface Options {\n /**\n * A function that determines whether a param should be included in the query string based on its value.\n */\n shouldInclude?: (value: unknown, name: string) => boolean;\n}\n\n/**\n * Creates a URL query string from an object of key/value pairs.\n *\n * Values that are `undefined` will be excluded from the query string.\n *\n * For a param that has multiple values, use an array:\n * - input: `{ brands: [1, 2, 3] }`\n * - output: `brands=1&brands=2&brands=3`\n */\nexport function createQueryString(\n params: Record<string, unknown>,\n { shouldInclude = isDefined }: Options = {},\n): string {\n const searchParams = new URLSearchParams({});\n\n Object.entries(params).forEach(([name, value]) => {\n if (!shouldInclude(value, name)) {\n return;\n }\n\n if (Array.isArray(value)) {\n value.forEach((item: string | number) => {\n searchParams.append(name, String(item));\n });\n } else {\n if (typeof value === 'object' && value !== null) {\n throw new TypeError(\n `Invalid query string parameter value.\\n\\nReceived value: \"${value}\".\\n\\nValues must be Primitive Values or arrays of Primitive Values. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#primitive_values`,\n );\n }\n\n searchParams.append(snakeCase(name), String(value));\n }\n });\n\n return searchParams.toString();\n}\n\nexport default createQueryString;\n"],"names":["createQueryString","params","shouldInclude","isDefined","searchParams","name","value","item","snakeCase"],"mappings":"
|
|
1
|
+
{"version":3,"file":"createQueryString.js","sources":["../../src/utils/createQueryString.ts"],"sourcesContent":["import snakeCase from 'lodash-es/snakeCase';\n\nimport isDefined from '../composables/useValidation/utils/isDefined';\n\ninterface Options {\n /**\n * A function that determines whether a param should be included in the query string based on its value.\n */\n shouldInclude?: (value: unknown, name: string) => boolean;\n}\n\n/**\n * Creates a URL query string from an object of key/value pairs.\n *\n * Values that are `undefined` will be excluded from the query string.\n *\n * For a param that has multiple values, use an array:\n * - input: `{ brands: [1, 2, 3] }`\n * - output: `brands=1&brands=2&brands=3`\n */\nexport function createQueryString(\n params: Record<string, unknown>,\n { shouldInclude = isDefined }: Options = {},\n): string {\n const searchParams = new URLSearchParams({});\n\n Object.entries(params).forEach(([name, value]) => {\n if (!shouldInclude(value, name)) {\n return;\n }\n\n if (Array.isArray(value)) {\n value.forEach((item: string | number) => {\n searchParams.append(name, String(item));\n });\n } else {\n if (typeof value === 'object' && value !== null) {\n throw new TypeError(\n `Invalid query string parameter value.\\n\\nReceived value: \"${value}\".\\n\\nValues must be Primitive Values or arrays of Primitive Values. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#primitive_values`,\n );\n }\n\n searchParams.append(snakeCase(name), String(value));\n }\n });\n\n return searchParams.toString();\n}\n\nexport default createQueryString;\n"],"names":["createQueryString","params","shouldInclude","isDefined","searchParams","name","value","item","snakeCase"],"mappings":";;AAoBO,SAASA,EACdC,GACA,EAAE,eAAAC,IAAgBC,EAAU,IAAa,CAAA,GACjC;AACR,QAAMC,IAAe,IAAI,gBAAgB,CAAA,CAAE;AAEpC,gBAAA,QAAQH,CAAM,EAAE,QAAQ,CAAC,CAACI,GAAMC,CAAK,MAAM;AAChD,QAAKJ,EAAcI,GAAOD,CAAI;AAI1B,UAAA,MAAM,QAAQC,CAAK;AACf,QAAAA,EAAA,QAAQ,CAACC,MAA0B;AACvC,UAAAH,EAAa,OAAOC,GAAM,OAAOE,CAAI,CAAC;AAAA,QAAA,CACvC;AAAA,WACI;AACL,YAAI,OAAOD,KAAU,YAAYA,MAAU;AACzC,gBAAM,IAAI;AAAA,YACR;AAAA;AAAA,mBAA6DA,CAAK;AAAA;AAAA;AAAA,UAAA;AAItE,QAAAF,EAAa,OAAOI,EAAUH,CAAI,GAAG,OAAOC,CAAK,CAAC;AAAA,MACpD;AAAA,EAAA,CACD,GAEMF,EAAa;AACtB;"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import "../constants.js";
|
|
2
2
|
import "./normalizeDate.js";
|
|
3
|
-
import "../toTimeZone-
|
|
4
|
-
import { k as
|
|
5
|
-
import "../isValid-
|
|
6
|
-
import "../parseISO-ed4094c1.js";
|
|
3
|
+
import "../toTimeZone-CVE1ZmsS.js";
|
|
4
|
+
import { k as a } from "../formatDateTime-C8CYECpd.js";
|
|
5
|
+
import "../isValid-DN-HkCoi.js";
|
|
7
6
|
export {
|
|
8
|
-
|
|
7
|
+
a as default
|
|
9
8
|
};
|
|
10
9
|
//# sourceMappingURL=formatDateTime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatDateTime.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formatDateTime.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getContrastingTextColor.js","sources":["../../src/utils/getContrastingTextColor.ts"],"sourcesContent":["import { StashColors } from '../../types/colors';\n\n/**\n * @see: https://wunnle.com/dynamic-text-color-based-on-background\n */\n\nfunction getRGB(c) {\n return parseInt(c, 16) || c;\n}\n\nfunction getsRGB(c) {\n return getRGB(c) / 255 <= 0.03928 ? getRGB(c) / 255 / 12.92 : Math.pow((getRGB(c) / 255 + 0.055) / 1.055, 2.4);\n}\n\nfunction getLuminance(hexColor) {\n return (\n 0.2126 * getsRGB(hexColor.substr(1, 2)) +\n 0.7152 * getsRGB(hexColor.substr(3, 2)) +\n 0.0722 * getsRGB(hexColor.substr(-2))\n );\n}\n\nfunction getContrast(f, b) {\n const L1 = getLuminance(f);\n const L2 = getLuminance(b);\n return (Math.max(L1, L2) + 0.05) / (Math.min(L1, L2) + 0.05);\n}\n\nfunction getStashColorValueFromCssVar(color: string) {\n return getComputedStyle(document.documentElement).getPropertyValue(`--color-${color}`);\n}\n\nfunction getStashColor(color: string) {\n const stashColors = Object.values(StashColors) as string[];\n const exactMatch = stashColors.includes(color);\n\n if (exactMatch) {\n return getStashColorValueFromCssVar(color);\n }\n\n // check if a primary color group is provided, eg. 'blue' in 'blue-100'\n const partialMatch = stashColors.find((stashColor) => {\n return stashColor.split('-')[0] === color;\n });\n\n if (partialMatch) {\n return getStashColorValueFromCssVar(`${color}-500`);\n }\n\n return '';\n}\n\nfunction normalizeHexValue(hexValue: string) {\n if (hexValue.startsWith('#')) {\n return hexValue;\n }\n\n return `#${hexValue}`;\n}\n\nfunction getContrastingHexValue(colorHexValue: string) {\n const darkTextColor = '#27282A'; // ice-900\n const lightTextColor = '#FFFFFF'; // white\n\n const lightTextContrast = getContrast(colorHexValue, lightTextColor);\n const darkTextContrast = getContrast(colorHexValue, darkTextColor);\n\n return lightTextContrast > darkTextContrast ? lightTextColor : darkTextColor;\n}\n\nexport default function getContrastingTextColor(color: string) {\n const hexRegex = new RegExp('^#?(([A-Fa-f0-9]{3})|([A-Fa-f0-9]{6}))$');\n if (hexRegex.test(color)) {\n const normalizedHexValue = normalizeHexValue(color);\n return getContrastingHexValue(normalizedHexValue);\n }\n\n const stashColor = getStashColor(color);\n if (stashColor) {\n return getContrastingHexValue(stashColor);\n }\n\n // eslint-disable-next-line no-console\n console.warn(`getContrastingTextColor received an invalid color value: ${color}`);\n return '#27282A';\n}\n"],"names":["getRGB","c","getsRGB","getLuminance","hexColor","getContrast","f","b","L1","L2","getStashColorValueFromCssVar","color","getStashColor","stashColors","StashColors","stashColor","normalizeHexValue","hexValue","getContrastingHexValue","colorHexValue","darkTextColor","lightTextColor","lightTextContrast","darkTextContrast","getContrastingTextColor","normalizedHexValue"],"mappings":";AAMA,SAASA,EAAOC,GAAG;AACV,SAAA,SAASA,GAAG,EAAE,KAAKA;AAC5B;AAEA,SAASC,EAAQD,GAAG;AAClB,SAAOD,EAAOC,CAAC,IAAI,OAAO,UAAUD,EAAOC,CAAC,IAAI,MAAM,QAAQ,KAAK,KAAKD,EAAOC,CAAC,IAAI,MAAM,SAAS,OAAO,GAAG;AAC/G;AAEA,SAASE,EAAaC,GAAU;AAE5B,SAAA,SAASF,EAAQE,EAAS,OAAO,GAAG,CAAC,CAAC,IACtC,SAASF,EAAQE,EAAS,OAAO,GAAG,CAAC,CAAC,IACtC,SAASF,EAAQE,EAAS,OAAO,EAAE,CAAC;AAExC;AAEA,SAASC,EAAYC,GAAGC,GAAG;AACnB,QAAAC,IAAKL,EAAaG,CAAC,GACnBG,IAAKN,EAAaI,CAAC;AACjB,UAAA,KAAK,IAAIC,GAAIC,CAAE,IAAI,SAAS,KAAK,IAAID,GAAIC,CAAE,IAAI;AACzD;AAEA,SAASC,EAA6BC,GAAe;AACnD,SAAO,iBAAiB,SAAS,eAAe,EAAE,iBAAiB,WAAWA,
|
|
1
|
+
{"version":3,"file":"getContrastingTextColor.js","sources":["../../src/utils/getContrastingTextColor.ts"],"sourcesContent":["import { StashColors } from '../../types/colors';\n\n/**\n * @see: https://wunnle.com/dynamic-text-color-based-on-background\n */\n\nfunction getRGB(c) {\n return parseInt(c, 16) || c;\n}\n\nfunction getsRGB(c) {\n return getRGB(c) / 255 <= 0.03928 ? getRGB(c) / 255 / 12.92 : Math.pow((getRGB(c) / 255 + 0.055) / 1.055, 2.4);\n}\n\nfunction getLuminance(hexColor) {\n return (\n 0.2126 * getsRGB(hexColor.substr(1, 2)) +\n 0.7152 * getsRGB(hexColor.substr(3, 2)) +\n 0.0722 * getsRGB(hexColor.substr(-2))\n );\n}\n\nfunction getContrast(f, b) {\n const L1 = getLuminance(f);\n const L2 = getLuminance(b);\n return (Math.max(L1, L2) + 0.05) / (Math.min(L1, L2) + 0.05);\n}\n\nfunction getStashColorValueFromCssVar(color: string) {\n return getComputedStyle(document.documentElement).getPropertyValue(`--color-${color}`);\n}\n\nfunction getStashColor(color: string) {\n const stashColors = Object.values(StashColors) as string[];\n const exactMatch = stashColors.includes(color);\n\n if (exactMatch) {\n return getStashColorValueFromCssVar(color);\n }\n\n // check if a primary color group is provided, eg. 'blue' in 'blue-100'\n const partialMatch = stashColors.find((stashColor) => {\n return stashColor.split('-')[0] === color;\n });\n\n if (partialMatch) {\n return getStashColorValueFromCssVar(`${color}-500`);\n }\n\n return '';\n}\n\nfunction normalizeHexValue(hexValue: string) {\n if (hexValue.startsWith('#')) {\n return hexValue;\n }\n\n return `#${hexValue}`;\n}\n\nfunction getContrastingHexValue(colorHexValue: string) {\n const darkTextColor = '#27282A'; // ice-900\n const lightTextColor = '#FFFFFF'; // white\n\n const lightTextContrast = getContrast(colorHexValue, lightTextColor);\n const darkTextContrast = getContrast(colorHexValue, darkTextColor);\n\n return lightTextContrast > darkTextContrast ? lightTextColor : darkTextColor;\n}\n\nexport default function getContrastingTextColor(color: string) {\n const hexRegex = new RegExp('^#?(([A-Fa-f0-9]{3})|([A-Fa-f0-9]{6}))$');\n if (hexRegex.test(color)) {\n const normalizedHexValue = normalizeHexValue(color);\n return getContrastingHexValue(normalizedHexValue);\n }\n\n const stashColor = getStashColor(color);\n if (stashColor) {\n return getContrastingHexValue(stashColor);\n }\n\n // eslint-disable-next-line no-console\n console.warn(`getContrastingTextColor received an invalid color value: ${color}`);\n return '#27282A';\n}\n"],"names":["getRGB","c","getsRGB","getLuminance","hexColor","getContrast","f","b","L1","L2","getStashColorValueFromCssVar","color","getStashColor","stashColors","StashColors","stashColor","normalizeHexValue","hexValue","getContrastingHexValue","colorHexValue","darkTextColor","lightTextColor","lightTextContrast","darkTextContrast","getContrastingTextColor","normalizedHexValue"],"mappings":";AAMA,SAASA,EAAOC,GAAG;AACV,SAAA,SAASA,GAAG,EAAE,KAAKA;AAC5B;AAEA,SAASC,EAAQD,GAAG;AAClB,SAAOD,EAAOC,CAAC,IAAI,OAAO,UAAUD,EAAOC,CAAC,IAAI,MAAM,QAAQ,KAAK,KAAKD,EAAOC,CAAC,IAAI,MAAM,SAAS,OAAO,GAAG;AAC/G;AAEA,SAASE,EAAaC,GAAU;AAE5B,SAAA,SAASF,EAAQE,EAAS,OAAO,GAAG,CAAC,CAAC,IACtC,SAASF,EAAQE,EAAS,OAAO,GAAG,CAAC,CAAC,IACtC,SAASF,EAAQE,EAAS,OAAO,EAAE,CAAC;AAExC;AAEA,SAASC,EAAYC,GAAGC,GAAG;AACnB,QAAAC,IAAKL,EAAaG,CAAC,GACnBG,IAAKN,EAAaI,CAAC;AACjB,UAAA,KAAK,IAAIC,GAAIC,CAAE,IAAI,SAAS,KAAK,IAAID,GAAIC,CAAE,IAAI;AACzD;AAEA,SAASC,EAA6BC,GAAe;AACnD,SAAO,iBAAiB,SAAS,eAAe,EAAE,iBAAiB,WAAWA,CAAK,EAAE;AACvF;AAEA,SAASC,EAAcD,GAAe;AAC9B,QAAAE,IAAc,OAAO,OAAOC,CAAW;AAG7C,SAFmBD,EAAY,SAASF,CAAK,IAGpCD,EAA6BC,CAAK,IAItBE,EAAY,KAAK,CAACE,MAC9BA,EAAW,MAAM,GAAG,EAAE,CAAC,MAAMJ,CACrC,IAGQD,EAA6B,GAAGC,CAAK,MAAM,IAG7C;AACT;AAEA,SAASK,EAAkBC,GAAkB;AACvC,SAAAA,EAAS,WAAW,GAAG,IAClBA,IAGF,IAAIA,CAAQ;AACrB;AAEA,SAASC,EAAuBC,GAAuB;AACrD,QAAMC,IAAgB,WAChBC,IAAiB,WAEjBC,IAAoBjB,EAAYc,GAAeE,CAAc,GAC7DE,IAAmBlB,EAAYc,GAAeC,CAAa;AAE1D,SAAAE,IAAoBC,IAAmBF,IAAiBD;AACjE;AAEA,SAAwBI,EAAwBb,GAAe;AAEzD,MADa,IAAI,OAAO,yCAAyC,EACxD,KAAKA,CAAK,GAAG;AAClB,UAAAc,IAAqBT,EAAkBL,CAAK;AAClD,WAAOO,EAAuBO,CAAkB;AAAA,EAClD;AAEM,QAAAV,IAAaH,EAAcD,CAAK;AACtC,SAAII,IACKG,EAAuBH,CAAU,KAIlC,QAAA,KAAK,4DAA4DJ,CAAK,EAAE,GACzE;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":["../../src/utils/helpers.ts"],"sourcesContent":["import camelCase from 'lodash-es/camelCase';\nimport get from 'lodash-es/get';\nimport isFinite from 'lodash-es/isFinite';\nimport isPlainObject from 'lodash-es/isPlainObject';\n\nimport { INBOUND_LEADS, LICENSE_COLORS, ORDER, SELLER_STATUSES } from '../constants';\n\nconst BULK = 'BULK';\nconst MOUNT_POINT_CLASS = '.mount-point-container';\n\n/**\n * Filters the list of `items` based on options selected in the `filters` object\n * @param {array} items A list of items to filter\n * @param {IFilter} options an options object for the filtering configuration\n */\nexport function filterItems(items, filters) {\n if (!Object.keys(filters).length) {\n return items;\n }\n\n return items.filter((item) => {\n for (const key in filters) {\n // eg. `brand`, `category`, `status`...\n const filter = filters[key]; // IFilter;\n const filterValues = filter.filterBy; // eg. ['1906', 'LuvBuds'], ['vape', 'pen', 'flower']\n let itemValue = get(item, key.split('.')); // eg `LuvBuds`, 'vape'\n\n // TODO take care of this upstream. ie write custom filter function if itemValue is an object\n // ie. if (typeof itemValue !== 'string' || typeof itemValue !== 'number' )\n if (isPlainObject(itemValue)) {\n itemValue = item[key].id;\n }\n\n if ('customFilter' in filter) {\n // custom function should return `false` when the filter logic does not match\n if (!filter.customFilter(filterValues, itemValue, item)) {\n return false;\n }\n } else {\n if (!Array.isArray(itemValue) && !~filterValues.indexOf(itemValue)) {\n return false;\n }\n }\n }\n\n return true;\n });\n}\n\n/**\n * Sorts an array of items\n * @param {Array} items the list of things to sort\n * @param {ISort} options an options object for the sorting configuration\n * sortBy: the object key to sort on\n * sortDesc: whether to sort descending or not\n * customSorter: a custom sorting function\n *\n * https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/util/helpers.ts#L381\n */\nexport function sortItems(items, options) {\n const { sortBy, sortDesc, customSorter, locale = 'en' } = options;\n const isObject = items.length && typeof items[0] === 'object';\n\n if (!sortBy && isObject) {\n return items;\n }\n\n return [...items].sort((a, b) => {\n let sortA = get(a, sortBy) || a;\n let sortB = get(b, sortBy) || b;\n\n if (sortDesc) {\n [sortA, sortB] = [sortB, sortA];\n }\n\n if (customSorter) {\n return customSorter(sortA, sortB);\n }\n\n [sortA, sortB] = [sortA, sortB].map((s) => (s || '').toString().toLocaleLowerCase());\n\n if (sortA !== sortB) {\n const sortResult =\n !isNaN(sortA) && !isNaN(sortB) ? Number(sortA) - Number(sortB) : sortA.localeCompare(sortB, locale);\n\n if (sortResult) {\n return sortResult;\n }\n }\n\n return 0;\n });\n}\n\n/**\n * Removes all accents/diacritics and converts to lower case\n * @param {string} text to normalize\n */\nexport function normalizeText(text) {\n if (isFinite(text)) {\n text = text.toString();\n }\n\n if (!text || typeof text !== 'string') {\n return '';\n }\n\n /**\n * NFD splits the canonical form and the regex removed only accent characters\n * see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize for more detail.\n */\n return text\n .toLowerCase()\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '');\n}\n\n/**\n * Generates a hash code from a string\n * @param {string} s The string to generate a hash from\n * @see https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript/52171480\n */\nexport function hashCode(s) {\n return s.split('').reduce((a, b) => {\n a = (a << 5) - a + b.charCodeAt(0);\n return a & a;\n }, 0);\n}\n\n/**\n * Returns the mount point for elements that will reattach themselves, or creates one if not available\n */\nexport function getMountPoint() {\n const el = document.querySelector(MOUNT_POINT_CLASS);\n\n if (!el) {\n const div = document.createElement('div');\n\n div.className = MOUNT_POINT_CLASS.slice(1, MOUNT_POINT_CLASS.length);\n return document.body.appendChild(div);\n }\n\n return el;\n}\n\n/**\n * Retrieves the value of a css variable\n *\n * @param {string} name name of the css var, with or without `--`\n * @return {string} value of the css var\n */\nexport function getCssVar(name) {\n let variable = name;\n\n if (variable.substring(0, 2) !== '--') {\n variable = `--${variable}`;\n }\n\n return getComputedStyle(document.documentElement).getPropertyValue(variable);\n}\n\n/**\n * Format the license type text to display\n * @param {string} licenseType the first three characters of the licenseType\n */\nexport function formatLicenseTypeText(licenseType = '') {\n const type = licenseType.toUpperCase();\n\n return type === BULK ? type : type.slice(0, 3);\n}\n\nexport function generateColorClass(type, value) {\n let color;\n\n try {\n switch (type) {\n case 'license':\n value = formatLicenseTypeText(value);\n color = LICENSE_COLORS[value];\n break;\n case 'order':\n color = 'tw-bg-' + ORDER[value.toUpperCase()].color;\n break;\n case 'certified-seller':\n color = SELLER_STATUSES[camelCase(value)].color;\n break;\n case 'inbound-leads':\n color = INBOUND_LEADS[value.toUpperCase()].color;\n break;\n }\n\n return color || 'tw-bg-ice-500';\n } catch (e) {\n return 'tw-bg-ice-500';\n }\n}\n"],"names":["BULK","MOUNT_POINT_CLASS","filterItems","items","filters","item","key","filter","filterValues","itemValue","get","isPlainObject","sortItems","options","sortBy","sortDesc","customSorter","locale","isObject","a","b","sortA","sortB","s","sortResult","normalizeText","text","isFinite","hashCode","getMountPoint","el","div","getCssVar","name","variable","formatLicenseTypeText","licenseType","type","generateColorClass","value","color","LICENSE_COLORS","ORDER","SELLER_STATUSES","camelCase","INBOUND_LEADS"],"mappings":";;;;;AAOA,MAAMA,IAAO,QACPC,IAAoB;AAOV,SAAAC,EAAYC,GAAOC,GAAS;AAC1C,SAAK,OAAO,KAAKA,CAAO,EAAE,SAInBD,EAAM,OAAO,CAACE,MAAS;AAC5B,eAAWC,KAAOF,GAAS;AAEnB,YAAAG,IAASH,EAAQE,CAAG,GACpBE,IAAeD,EAAO;AAC5B,UAAIE,IAAYC,EAAIL,GAAMC,EAAI,MAAM,GAAG,CAAC;AAQxC,UAJIK,EAAcF,CAAS,MACbA,IAAAJ,EAAKC,CAAG,EAAE,KAGpB,kBAAkBC;AAEpB,YAAI,CAACA,EAAO,aAAaC,GAAcC,GAAWJ,CAAI;AAC7C,iBAAA;AAAA,iBAGL,CAAC,MAAM,QAAQI,CAAS,KAAK,CAAC,CAACD,EAAa,QAAQC,CAAS;AACxD,eAAA;AAAA;
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../../src/utils/helpers.ts"],"sourcesContent":["import camelCase from 'lodash-es/camelCase';\nimport get from 'lodash-es/get';\nimport isFinite from 'lodash-es/isFinite';\nimport isPlainObject from 'lodash-es/isPlainObject';\n\nimport { INBOUND_LEADS, LICENSE_COLORS, ORDER, SELLER_STATUSES } from '../constants';\n\nconst BULK = 'BULK';\nconst MOUNT_POINT_CLASS = '.mount-point-container';\n\n/**\n * Filters the list of `items` based on options selected in the `filters` object\n * @param {array} items A list of items to filter\n * @param {IFilter} options an options object for the filtering configuration\n */\nexport function filterItems(items, filters) {\n if (!Object.keys(filters).length) {\n return items;\n }\n\n return items.filter((item) => {\n for (const key in filters) {\n // eg. `brand`, `category`, `status`...\n const filter = filters[key]; // IFilter;\n const filterValues = filter.filterBy; // eg. ['1906', 'LuvBuds'], ['vape', 'pen', 'flower']\n let itemValue = get(item, key.split('.')); // eg `LuvBuds`, 'vape'\n\n // TODO take care of this upstream. ie write custom filter function if itemValue is an object\n // ie. if (typeof itemValue !== 'string' || typeof itemValue !== 'number' )\n if (isPlainObject(itemValue)) {\n itemValue = item[key].id;\n }\n\n if ('customFilter' in filter) {\n // custom function should return `false` when the filter logic does not match\n if (!filter.customFilter(filterValues, itemValue, item)) {\n return false;\n }\n } else {\n if (!Array.isArray(itemValue) && !~filterValues.indexOf(itemValue)) {\n return false;\n }\n }\n }\n\n return true;\n });\n}\n\n/**\n * Sorts an array of items\n * @param {Array} items the list of things to sort\n * @param {ISort} options an options object for the sorting configuration\n * sortBy: the object key to sort on\n * sortDesc: whether to sort descending or not\n * customSorter: a custom sorting function\n *\n * https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/util/helpers.ts#L381\n */\nexport function sortItems(items, options) {\n const { sortBy, sortDesc, customSorter, locale = 'en' } = options;\n const isObject = items.length && typeof items[0] === 'object';\n\n if (!sortBy && isObject) {\n return items;\n }\n\n return [...items].sort((a, b) => {\n let sortA = get(a, sortBy) || a;\n let sortB = get(b, sortBy) || b;\n\n if (sortDesc) {\n [sortA, sortB] = [sortB, sortA];\n }\n\n if (customSorter) {\n return customSorter(sortA, sortB);\n }\n\n [sortA, sortB] = [sortA, sortB].map((s) => (s || '').toString().toLocaleLowerCase());\n\n if (sortA !== sortB) {\n const sortResult =\n !isNaN(sortA) && !isNaN(sortB) ? Number(sortA) - Number(sortB) : sortA.localeCompare(sortB, locale);\n\n if (sortResult) {\n return sortResult;\n }\n }\n\n return 0;\n });\n}\n\n/**\n * Removes all accents/diacritics and converts to lower case\n * @param {string} text to normalize\n */\nexport function normalizeText(text) {\n if (isFinite(text)) {\n text = text.toString();\n }\n\n if (!text || typeof text !== 'string') {\n return '';\n }\n\n /**\n * NFD splits the canonical form and the regex removed only accent characters\n * see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize for more detail.\n */\n return text\n .toLowerCase()\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '');\n}\n\n/**\n * Generates a hash code from a string\n * @param {string} s The string to generate a hash from\n * @see https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript/52171480\n */\nexport function hashCode(s) {\n return s.split('').reduce((a, b) => {\n a = (a << 5) - a + b.charCodeAt(0);\n return a & a;\n }, 0);\n}\n\n/**\n * Returns the mount point for elements that will reattach themselves, or creates one if not available\n */\nexport function getMountPoint() {\n const el = document.querySelector(MOUNT_POINT_CLASS);\n\n if (!el) {\n const div = document.createElement('div');\n\n div.className = MOUNT_POINT_CLASS.slice(1, MOUNT_POINT_CLASS.length);\n return document.body.appendChild(div);\n }\n\n return el;\n}\n\n/**\n * Retrieves the value of a css variable\n *\n * @param {string} name name of the css var, with or without `--`\n * @return {string} value of the css var\n */\nexport function getCssVar(name) {\n let variable = name;\n\n if (variable.substring(0, 2) !== '--') {\n variable = `--${variable}`;\n }\n\n return getComputedStyle(document.documentElement).getPropertyValue(variable);\n}\n\n/**\n * Format the license type text to display\n * @param {string} licenseType the first three characters of the licenseType\n */\nexport function formatLicenseTypeText(licenseType = '') {\n const type = licenseType.toUpperCase();\n\n return type === BULK ? type : type.slice(0, 3);\n}\n\nexport function generateColorClass(type, value) {\n let color;\n\n try {\n switch (type) {\n case 'license':\n value = formatLicenseTypeText(value);\n color = LICENSE_COLORS[value];\n break;\n case 'order':\n color = 'tw-bg-' + ORDER[value.toUpperCase()].color;\n break;\n case 'certified-seller':\n color = SELLER_STATUSES[camelCase(value)].color;\n break;\n case 'inbound-leads':\n color = INBOUND_LEADS[value.toUpperCase()].color;\n break;\n }\n\n return color || 'tw-bg-ice-500';\n } catch (e) {\n return 'tw-bg-ice-500';\n }\n}\n"],"names":["BULK","MOUNT_POINT_CLASS","filterItems","items","filters","item","key","filter","filterValues","itemValue","get","isPlainObject","sortItems","options","sortBy","sortDesc","customSorter","locale","isObject","a","b","sortA","sortB","s","sortResult","normalizeText","text","isFinite","hashCode","getMountPoint","el","div","getCssVar","name","variable","formatLicenseTypeText","licenseType","type","generateColorClass","value","color","LICENSE_COLORS","ORDER","SELLER_STATUSES","camelCase","INBOUND_LEADS"],"mappings":";;;;;AAOA,MAAMA,IAAO,QACPC,IAAoB;AAOV,SAAAC,EAAYC,GAAOC,GAAS;AAC1C,SAAK,OAAO,KAAKA,CAAO,EAAE,SAInBD,EAAM,OAAO,CAACE,MAAS;AAC5B,eAAWC,KAAOF,GAAS;AAEnB,YAAAG,IAASH,EAAQE,CAAG,GACpBE,IAAeD,EAAO;AAC5B,UAAIE,IAAYC,EAAIL,GAAMC,EAAI,MAAM,GAAG,CAAC;AAQxC,UAJIK,EAAcF,CAAS,MACbA,IAAAJ,EAAKC,CAAG,EAAE,KAGpB,kBAAkBC;AAEpB,YAAI,CAACA,EAAO,aAAaC,GAAcC,GAAWJ,CAAI;AAC7C,iBAAA;AAAA,iBAGL,CAAC,MAAM,QAAQI,CAAS,KAAK,CAAC,CAACD,EAAa,QAAQC,CAAS;AACxD,eAAA;AAAA,IAGb;AAEO,WAAA;AAAA,EAAA,CACR,IA7BQN;AA8BX;AAYgB,SAAAS,EAAUT,GAAOU,GAAS;AACxC,QAAM,EAAE,QAAAC,GAAQ,UAAAC,GAAU,cAAAC,GAAc,QAAAC,IAAS,KAAS,IAAAJ,GACpDK,IAAWf,EAAM,UAAU,OAAOA,EAAM,CAAC,KAAM;AAEjD,SAAA,CAACW,KAAUI,IACNf,IAGF,CAAC,GAAGA,CAAK,EAAE,KAAK,CAACgB,GAAGC,MAAM;AAC/B,QAAIC,IAAQX,EAAIS,GAAGL,CAAM,KAAKK,GAC1BG,IAAQZ,EAAIU,GAAGN,CAAM,KAAKM;AAM9B,QAJIL,MACF,CAACM,GAAOC,CAAK,IAAI,CAACA,GAAOD,CAAK,IAG5BL;AACK,aAAAA,EAAaK,GAAOC,CAAK;AAKlC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AAC/C;AAEgB,SAAAC,EAAmBD,GAAME,GAAO;AAC1C,MAAAC;AAEA,MAAA;AACF,YAAQH,GAAM;AAAA,MACZ,KAAK;AACH,QAAAE,IAAQJ,EAAsBI,CAAK,GACnCC,IAAQC,EAAeF,CAAK;AAC5B;AAAA,MACF,KAAK;AACH,QAAAC,IAAQ,WAAWE,EAAMH,EAAM,YAAA,CAAa,EAAE;AAC9C;AAAA,MACF,KAAK;AACH,QAAAC,IAAQG,EAAgBC,EAAUL,CAAK,CAAC,EAAE;AAC1C;AAAA,MACF,KAAK;AACH,QAAAC,IAAQK,EAAcN,EAAM,YAAa,CAAA,EAAE;AAC3C;AAAA,IACJ;AAEA,WAAOC,KAAS;AAAA,UACN;AACH,WAAA;AAAA,EACT;AACF;"}
|
package/dist/utils/i18n.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { CURRENCY_SYMBOL_MAP as n } from "../constants.js";
|
|
2
|
-
import { locale as
|
|
3
|
-
import "lodash-es/get";
|
|
2
|
+
import { locale as t } from "../locale.js";
|
|
4
3
|
const m = (r) => {
|
|
5
4
|
if (typeof r != "string")
|
|
6
5
|
return;
|
|
7
|
-
const
|
|
8
|
-
if (Object.prototype.hasOwnProperty.call(n,
|
|
9
|
-
return n[
|
|
10
|
-
},
|
|
6
|
+
const e = r.toUpperCase();
|
|
7
|
+
if (Object.prototype.hasOwnProperty.call(n, e))
|
|
8
|
+
return n[e];
|
|
9
|
+
}, y = a(t), o = m("USD"), g = {
|
|
11
10
|
default: "USD",
|
|
12
11
|
position: u(),
|
|
13
12
|
symbol: o
|
|
@@ -18,43 +17,43 @@ function a(r) {
|
|
|
18
17
|
function u({ type: r = "currency" } = {}) {
|
|
19
18
|
return r === "percent" && p(1).indexOf("%") === 0 || r === "currency" && l({ amount: 1 }).indexOf(o) === 0 ? "prepend" : "append";
|
|
20
19
|
}
|
|
21
|
-
function
|
|
22
|
-
return new Intl.NumberFormat(
|
|
23
|
-
minimumFractionDigits:
|
|
24
|
-
maximumFractionDigits:
|
|
20
|
+
function D(r, e) {
|
|
21
|
+
return new Intl.NumberFormat(t, {
|
|
22
|
+
minimumFractionDigits: e,
|
|
23
|
+
maximumFractionDigits: e,
|
|
25
24
|
style: "decimal"
|
|
26
25
|
}).format(r);
|
|
27
26
|
}
|
|
28
|
-
function l({ amount: r, currency:
|
|
29
|
-
return new Intl.NumberFormat(
|
|
27
|
+
function l({ amount: r, currency: e = "USD" }) {
|
|
28
|
+
return new Intl.NumberFormat(t, {
|
|
30
29
|
style: "currency",
|
|
31
|
-
currency:
|
|
30
|
+
currency: e
|
|
32
31
|
}).format(r);
|
|
33
32
|
}
|
|
34
|
-
function p(r,
|
|
35
|
-
return new Intl.NumberFormat(
|
|
33
|
+
function p(r, e) {
|
|
34
|
+
return new Intl.NumberFormat(t, {
|
|
36
35
|
style: "percent",
|
|
37
|
-
minimumFractionDigits:
|
|
38
|
-
maximumFractionDigits:
|
|
36
|
+
minimumFractionDigits: e,
|
|
37
|
+
maximumFractionDigits: e || 2
|
|
39
38
|
}).format(r);
|
|
40
39
|
}
|
|
41
|
-
function
|
|
42
|
-
const c = `[^0-9${
|
|
40
|
+
function S(r, e = ".") {
|
|
41
|
+
const c = `[^0-9${e}+-]*`, i = new RegExp(c, "g");
|
|
43
42
|
return `${r}`.replace(i, "");
|
|
44
43
|
}
|
|
45
|
-
function
|
|
46
|
-
return `${r}`.replace(
|
|
44
|
+
function d(r, e = ".") {
|
|
45
|
+
return `${r}`.replace(e === "." ? "," : ".", e);
|
|
47
46
|
}
|
|
48
47
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
d as convertDecimal,
|
|
49
|
+
g as currency,
|
|
51
50
|
o as currencySymbol,
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
D as decimal,
|
|
52
|
+
y as decimalSeparator,
|
|
54
53
|
u as getLocaleSymbolPosition,
|
|
55
54
|
m as getSymbolFromCurrency,
|
|
56
55
|
l as money,
|
|
57
56
|
p as percent,
|
|
58
|
-
|
|
57
|
+
S as sanitizeDecimal
|
|
59
58
|
};
|
|
60
59
|
//# sourceMappingURL=i18n.js.map
|
package/dist/utils/i18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","sources":["../../src/utils/i18n.ts"],"sourcesContent":["import { CURRENCY_SYMBOL_MAP } from '../constants';\nimport { locale } from '../locale';\n\n/**\n * Return the correct symbol for a currency based on code.\n *\n * @param {string} currencyCode - The code used to determine the symbol (i.e. 'USD').\n * @returns {string} - Currency symbol, i.e. '$'.\n */\nexport const getSymbolFromCurrency = (currencyCode) => {\n if (typeof currencyCode !== 'string') {\n return undefined;\n }\n\n const code = currencyCode.toUpperCase();\n\n if (!Object.prototype.hasOwnProperty.call(CURRENCY_SYMBOL_MAP, code)) {\n return undefined;\n }\n\n return CURRENCY_SYMBOL_MAP[code];\n};\n\nexport const decimalSeparator = getLocaleDecimalSeparator(locale);\nexport const currencySymbol = getSymbolFromCurrency('USD');\nexport const currency = {\n default: 'USD',\n position: getLocaleSymbolPosition(),\n symbol: currencySymbol,\n};\n\n/**\n * A helper function for obtaining the current decimal separator\n * @param {string} locale The locale used to determine the separator.\n * @returns {string} Decimal separator ('.', ',')\n */\nfunction getLocaleDecimalSeparator(locale) {\n return (1.1).toLocaleString(locale).replace(/\\d/g, '');\n}\n\n/**\n * A helper function for obtaining symbol position relative to a value\n * This should be fine going forward unless we get into RTL, or Arabic.\n * @param {string} type the type of symbol\n */\nexport function getLocaleSymbolPosition({ type = 'currency' } = {}) {\n return (type === 'percent' && percent(1).indexOf('%') === 0) ||\n (type === 'currency' && money({ amount: 1 }).indexOf(currencySymbol) === 0)\n ? 'prepend'\n : 'append';\n}\n\n/**\n * Format a value as a decimal in a locale-aware format.\n * NOTE: Be careful as this returns a string and should not be used for\n * additional calculation unless converted.\n * @param {number|string} value number to format\n * @param {number} [decimalPlaces] number of decimal places\n * @return {string} locale-aware number as a string\n */\nexport function decimal(value, decimalPlaces) {\n return new Intl.NumberFormat(locale, {\n minimumFractionDigits: decimalPlaces,\n maximumFractionDigits: decimalPlaces,\n style: 'decimal',\n }).format(value);\n}\n\n/**\n * Format a value as a money string in a locale-aware format.\n * @param {Object} object\n * @param {number} object.amount The number to format\n * @param {string} [object.currency] ISO 4217 currency code (USD, CAD, EUR, etc)\n * @return {string} locale-aware money value as a string\n */\nexport function money({ amount, currency = 'USD' }) {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n }).format(amount);\n}\n\n/**\n * Format a value as a percent in a locale-aware format.\n * @param {number|string} value number to format\n * @param {number} [decimalPlaces] number of decimal places\n * @return {string} locale-aware percentage value as a string\n */\nexport function percent(value, decimalPlaces?) {\n return new Intl.NumberFormat(locale, {\n style: 'percent',\n minimumFractionDigits: decimalPlaces,\n maximumFractionDigits: decimalPlaces || 2,\n }).format(value);\n}\n\n/**\n * Cleans a value to reflect type=number restrictions.\n * Omits exponents, and restricts the decimal separator.\n * @param {number|string} value value to format\n * @param {string} value decimal separator\n */\nexport function sanitizeDecimal(value, separator = '.') {\n const replace = `[^0-9${separator}+-]*`;\n const re = new RegExp(replace, 'g');\n\n return `${value}`.replace(re, '');\n}\n\n/**\n * Replace decimal separator of `value` with `convertTo`\n * @param {string|number} value\n * @param {string} convertTo decimal character to update the value with\n */\nexport function convertDecimal(value, convertTo = '.') {\n return `${value}`.replace(convertTo === '.' ? ',' : '.', convertTo);\n}\n"],"names":["getSymbolFromCurrency","currencyCode","code","CURRENCY_SYMBOL_MAP","decimalSeparator","getLocaleDecimalSeparator","locale","currencySymbol","currency","getLocaleSymbolPosition","type","percent","money","decimal","value","decimalPlaces","amount","sanitizeDecimal","separator","replace","re","convertDecimal","convertTo"],"mappings":"
|
|
1
|
+
{"version":3,"file":"i18n.js","sources":["../../src/utils/i18n.ts"],"sourcesContent":["import { CURRENCY_SYMBOL_MAP } from '../constants';\nimport { locale } from '../locale';\n\n/**\n * Return the correct symbol for a currency based on code.\n *\n * @param {string} currencyCode - The code used to determine the symbol (i.e. 'USD').\n * @returns {string} - Currency symbol, i.e. '$'.\n */\nexport const getSymbolFromCurrency = (currencyCode) => {\n if (typeof currencyCode !== 'string') {\n return undefined;\n }\n\n const code = currencyCode.toUpperCase();\n\n if (!Object.prototype.hasOwnProperty.call(CURRENCY_SYMBOL_MAP, code)) {\n return undefined;\n }\n\n return CURRENCY_SYMBOL_MAP[code];\n};\n\nexport const decimalSeparator = getLocaleDecimalSeparator(locale);\nexport const currencySymbol = getSymbolFromCurrency('USD');\nexport const currency = {\n default: 'USD',\n position: getLocaleSymbolPosition(),\n symbol: currencySymbol,\n};\n\n/**\n * A helper function for obtaining the current decimal separator\n * @param {string} locale The locale used to determine the separator.\n * @returns {string} Decimal separator ('.', ',')\n */\nfunction getLocaleDecimalSeparator(locale) {\n return (1.1).toLocaleString(locale).replace(/\\d/g, '');\n}\n\n/**\n * A helper function for obtaining symbol position relative to a value\n * This should be fine going forward unless we get into RTL, or Arabic.\n * @param {string} type the type of symbol\n */\nexport function getLocaleSymbolPosition({ type = 'currency' } = {}) {\n return (type === 'percent' && percent(1).indexOf('%') === 0) ||\n (type === 'currency' && money({ amount: 1 }).indexOf(currencySymbol) === 0)\n ? 'prepend'\n : 'append';\n}\n\n/**\n * Format a value as a decimal in a locale-aware format.\n * NOTE: Be careful as this returns a string and should not be used for\n * additional calculation unless converted.\n * @param {number|string} value number to format\n * @param {number} [decimalPlaces] number of decimal places\n * @return {string} locale-aware number as a string\n */\nexport function decimal(value, decimalPlaces) {\n return new Intl.NumberFormat(locale, {\n minimumFractionDigits: decimalPlaces,\n maximumFractionDigits: decimalPlaces,\n style: 'decimal',\n }).format(value);\n}\n\n/**\n * Format a value as a money string in a locale-aware format.\n * @param {Object} object\n * @param {number} object.amount The number to format\n * @param {string} [object.currency] ISO 4217 currency code (USD, CAD, EUR, etc)\n * @return {string} locale-aware money value as a string\n */\nexport function money({ amount, currency = 'USD' }) {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n }).format(amount);\n}\n\n/**\n * Format a value as a percent in a locale-aware format.\n * @param {number|string} value number to format\n * @param {number} [decimalPlaces] number of decimal places\n * @return {string} locale-aware percentage value as a string\n */\nexport function percent(value, decimalPlaces?) {\n return new Intl.NumberFormat(locale, {\n style: 'percent',\n minimumFractionDigits: decimalPlaces,\n maximumFractionDigits: decimalPlaces || 2,\n }).format(value);\n}\n\n/**\n * Cleans a value to reflect type=number restrictions.\n * Omits exponents, and restricts the decimal separator.\n * @param {number|string} value value to format\n * @param {string} value decimal separator\n */\nexport function sanitizeDecimal(value, separator = '.') {\n const replace = `[^0-9${separator}+-]*`;\n const re = new RegExp(replace, 'g');\n\n return `${value}`.replace(re, '');\n}\n\n/**\n * Replace decimal separator of `value` with `convertTo`\n * @param {string|number} value\n * @param {string} convertTo decimal character to update the value with\n */\nexport function convertDecimal(value, convertTo = '.') {\n return `${value}`.replace(convertTo === '.' ? ',' : '.', convertTo);\n}\n"],"names":["getSymbolFromCurrency","currencyCode","code","CURRENCY_SYMBOL_MAP","decimalSeparator","getLocaleDecimalSeparator","locale","currencySymbol","currency","getLocaleSymbolPosition","type","percent","money","decimal","value","decimalPlaces","amount","sanitizeDecimal","separator","replace","re","convertDecimal","convertTo"],"mappings":";;AASa,MAAAA,IAAwB,CAACC,MAAiB;AACjD,MAAA,OAAOA,KAAiB;AACnB;AAGH,QAAAC,IAAOD,EAAa;AAE1B,MAAK,OAAO,UAAU,eAAe,KAAKE,GAAqBD,CAAI;AAInE,WAAOC,EAAoBD,CAAI;AACjC,GAEaE,IAAmBC,EAA0BC,CAAM,GACnDC,IAAiBP,EAAsB,KAAK,GAC5CQ,IAAW;AAAA,EACtB,SAAS;AAAA,EACT,UAAUC,EAAwB;AAAA,EAClC,QAAQF;AACV;AAOA,SAASF,EAA0BC,GAAQ;AACzC,SAAQ,IAAK,eAAeA,CAAM,EAAE,QAAQ,OAAO,EAAE;AACvD;AAOO,SAASG,EAAwB,EAAE,MAAAC,IAAO,WAAW,IAAI,CAAA,GAAI;AAC1D,SAAAA,MAAS,aAAaC,EAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,KACvDD,MAAS,cAAcE,EAAM,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQL,CAAc,MAAM,IACvE,YACA;AACN;AAUgB,SAAAM,EAAQC,GAAOC,GAAe;AACrC,SAAA,IAAI,KAAK,aAAaT,GAAQ;AAAA,IACnC,uBAAuBS;AAAA,IACvB,uBAAuBA;AAAA,IACvB,OAAO;AAAA,EAAA,CACR,EAAE,OAAOD,CAAK;AACjB;AASO,SAASF,EAAM,EAAE,QAAAI,GAAQ,UAAAR,IAAW,SAAS;AAC3C,SAAA,IAAI,KAAK,aAAaF,GAAQ;AAAA,IACnC,OAAO;AAAA,IACP,UAAAE;AAAAA,EAAA,CACD,EAAE,OAAOQ,CAAM;AAClB;AAQgB,SAAAL,EAAQG,GAAOC,GAAgB;AACtC,SAAA,IAAI,KAAK,aAAaT,GAAQ;AAAA,IACnC,OAAO;AAAA,IACP,uBAAuBS;AAAA,IACvB,uBAAuBA,KAAiB;AAAA,EAAA,CACzC,EAAE,OAAOD,CAAK;AACjB;AAQgB,SAAAG,EAAgBH,GAAOI,IAAY,KAAK;AAChD,QAAAC,IAAU,QAAQD,CAAS,QAC3BE,IAAK,IAAI,OAAOD,GAAS,GAAG;AAElC,SAAO,GAAGL,CAAK,GAAG,QAAQM,GAAI,EAAE;AAClC;AAOgB,SAAAC,EAAeP,GAAOQ,IAAY,KAAK;AAC9C,SAAA,GAAGR,CAAK,GAAG,QAAQQ,MAAc,MAAM,MAAM,KAAKA,CAAS;AACpE;"}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import { s as
|
|
1
|
+
import { s as e, s as o } from "../searchFuzzy-DKooyZM8.js";
|
|
2
2
|
import "./helpers.js";
|
|
3
|
-
import "../_commonjsHelpers-10dfc225.js";
|
|
4
|
-
import "lodash-es/isPlainObject";
|
|
5
|
-
import "vue";
|
|
6
|
-
import "lodash-es/camelCase";
|
|
7
|
-
import "lodash-es/get";
|
|
8
|
-
import "lodash-es/isFinite";
|
|
9
|
-
import "../constants.js";
|
|
10
3
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
e as default,
|
|
5
|
+
o as searchFuzzy
|
|
13
6
|
};
|
|
14
7
|
//# sourceMappingURL=searchFuzzy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchFuzzy.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"searchFuzzy.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|