@fremtind/jokul 5.2.3 → 6.0.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build/build-stats.html +37 -36
- package/build/cjs/components/autosuggest/BaseAutosuggest.cjs +1 -1
- package/build/cjs/components/autosuggest/BaseAutosuggest.cjs.map +1 -1
- package/build/cjs/components/date-input/DateInput.cjs +2 -0
- package/build/cjs/components/date-input/DateInput.cjs.map +1 -0
- package/build/cjs/components/date-input/DateInput.d.cts +7 -0
- package/build/cjs/components/date-input/calendar/Calendar.cjs +2 -0
- package/build/cjs/components/date-input/calendar/Calendar.cjs.map +1 -0
- package/build/cjs/components/date-input/calendar/Calendar.d.cts +6 -0
- package/build/cjs/components/date-input/calendar/CalendarDay.cjs +2 -0
- package/build/cjs/components/date-input/calendar/CalendarDay.cjs.map +1 -0
- package/build/cjs/components/date-input/calendar/CalendarDay.d.cts +16 -0
- package/build/cjs/components/date-input/calendar/CalendarWeek.cjs +2 -0
- package/build/cjs/components/date-input/calendar/CalendarWeek.cjs.map +1 -0
- package/build/cjs/components/date-input/calendar/CalendarWeek.d.cts +8 -0
- package/build/cjs/components/date-input/calendar/types.d.cts +6 -0
- package/build/cjs/components/date-input/calendar/utils.cjs +2 -0
- package/build/cjs/components/date-input/calendar/utils.cjs.map +1 -0
- package/build/cjs/components/date-input/calendar/utils.d.cts +19 -0
- package/build/cjs/components/date-input/index.cjs +2 -0
- package/build/cjs/components/date-input/index.d.cts +3 -0
- package/build/cjs/components/date-input/types.d.cts +35 -0
- package/build/cjs/components/date-input/utils.cjs +2 -0
- package/build/cjs/components/date-input/utils.cjs.map +1 -0
- package/build/cjs/components/date-input/utils.d.cts +34 -0
- package/build/cjs/components/file/File.cjs +1 -1
- package/build/cjs/components/file/File.cjs.map +1 -1
- package/build/cjs/components/file/types.d.cts +10 -1
- package/build/cjs/components/search/Search.cjs +1 -1
- package/build/cjs/components/search/Search.cjs.map +1 -1
- package/build/cjs/components/select/Option.cjs +2 -0
- package/build/cjs/components/select/Option.cjs.map +1 -0
- package/build/cjs/components/select/Option.d.cts +12 -0
- package/build/cjs/components/select/Select.cjs +1 -1
- package/build/cjs/components/select/Select.cjs.map +1 -1
- package/build/cjs/components/select/Select.d.cts +18 -3
- package/build/cjs/components/select/index.cjs +1 -1
- package/build/cjs/components/select/index.d.cts +1 -5
- package/build/cjs/components/select/utils.cjs +2 -0
- package/build/cjs/components/select/utils.cjs.map +1 -0
- package/build/cjs/components/select/utils.d.cts +5 -0
- package/build/cjs/components/table/TablePagination.cjs +1 -1
- package/build/cjs/components/table/TablePagination.cjs.map +1 -1
- package/build/cjs/components/tabs/Tabs.cjs.map +1 -1
- package/build/cjs/hooks/index.cjs +1 -1
- package/build/cjs/hooks/index.d.cts +0 -1
- package/build/cjs/hooks/useListNavigation/useListNavigation.cjs +1 -1
- package/build/cjs/hooks/useListNavigation/useListNavigation.cjs.map +1 -1
- package/build/cjs/hooks/useListNavigation/useListNavigation.d.cts +4 -2
- package/build/cjs/utilities/formatters/index.cjs +1 -1
- package/build/cjs/utilities/formatters/index.d.cts +1 -1
- package/build/cjs/utilities/formatters/util/registerWithMask.cjs +1 -1
- package/build/cjs/utilities/formatters/util/registerWithMask.cjs.map +1 -1
- package/build/cjs/utilities/formatters/util/registerWithMask.d.cts +0 -8
- package/build/cjs/utilities/index.cjs +1 -1
- package/build/cjs/utilities/validators/index.cjs +1 -1
- package/build/cjs/utilities/validators/index.d.cts +0 -1
- package/build/cjs/utilities/valuePair.cjs.map +1 -1
- package/build/cjs/utilities/valuePair.d.cts +2 -0
- package/build/es/components/autosuggest/BaseAutosuggest.js +1 -1
- package/build/es/components/autosuggest/BaseAutosuggest.js.map +1 -1
- package/build/es/components/date-input/DateInput.d.ts +7 -0
- package/build/es/components/date-input/DateInput.js +2 -0
- package/build/es/components/date-input/DateInput.js.map +1 -0
- package/build/es/components/date-input/calendar/Calendar.d.ts +6 -0
- package/build/es/components/date-input/calendar/Calendar.js +2 -0
- package/build/es/components/date-input/calendar/Calendar.js.map +1 -0
- package/build/es/components/date-input/calendar/CalendarDay.d.ts +16 -0
- package/build/es/components/date-input/calendar/CalendarDay.js +2 -0
- package/build/es/components/date-input/calendar/CalendarDay.js.map +1 -0
- package/build/es/components/date-input/calendar/CalendarWeek.d.ts +8 -0
- package/build/es/components/date-input/calendar/CalendarWeek.js +2 -0
- package/build/es/components/date-input/calendar/CalendarWeek.js.map +1 -0
- package/build/es/components/date-input/calendar/types.d.ts +6 -0
- package/build/es/components/date-input/calendar/utils.d.ts +19 -0
- package/build/es/components/date-input/calendar/utils.js +2 -0
- package/build/es/components/date-input/calendar/utils.js.map +1 -0
- package/build/es/components/date-input/index.d.ts +3 -0
- package/build/es/components/date-input/index.js +2 -0
- package/build/es/components/date-input/types.d.ts +35 -0
- package/build/es/components/date-input/utils.d.ts +34 -0
- package/build/es/components/date-input/utils.js +2 -0
- package/build/es/components/date-input/utils.js.map +1 -0
- package/build/es/components/file/File.js +1 -1
- package/build/es/components/file/File.js.map +1 -1
- package/build/es/components/file/types.d.ts +10 -1
- package/build/es/components/search/Search.js +1 -1
- package/build/es/components/search/Search.js.map +1 -1
- package/build/es/components/select/Option.d.ts +12 -0
- package/build/es/components/select/Option.js +2 -0
- package/build/es/components/select/Option.js.map +1 -0
- package/build/es/components/select/Select.d.ts +18 -3
- package/build/es/components/select/Select.js +1 -1
- package/build/es/components/select/Select.js.map +1 -1
- package/build/es/components/select/index.d.ts +1 -5
- package/build/es/components/select/index.js +1 -1
- package/build/es/components/select/utils.d.ts +5 -0
- package/build/es/components/select/utils.js +2 -0
- package/build/es/components/select/utils.js.map +1 -0
- package/build/es/components/table/TablePagination.js +1 -1
- package/build/es/components/table/TablePagination.js.map +1 -1
- package/build/es/components/tabs/Tabs.js.map +1 -1
- package/build/es/hooks/index.d.ts +0 -1
- package/build/es/hooks/index.js +1 -1
- package/build/es/hooks/useListNavigation/useListNavigation.d.ts +4 -2
- package/build/es/hooks/useListNavigation/useListNavigation.js +1 -1
- package/build/es/hooks/useListNavigation/useListNavigation.js.map +1 -1
- package/build/es/utilities/formatters/index.d.ts +1 -1
- package/build/es/utilities/formatters/index.js +1 -1
- package/build/es/utilities/formatters/util/registerWithMask.d.ts +0 -8
- package/build/es/utilities/formatters/util/registerWithMask.js +1 -1
- package/build/es/utilities/formatters/util/registerWithMask.js.map +1 -1
- package/build/es/utilities/index.js +1 -1
- package/build/es/utilities/validators/index.d.ts +0 -1
- package/build/es/utilities/validators/index.js +1 -1
- package/build/es/utilities/valuePair.d.ts +2 -0
- package/build/es/utilities/valuePair.js.map +1 -1
- package/codemods/CODEMODS.md +55 -0
- package/codemods/__tests__/import-paths.test.mjs +155 -0
- package/codemods/import-paths.mjs +10 -2
- package/codemods/transforms/date-input.mjs +225 -0
- package/codemods/transforms/import-specifiers.mjs +26 -0
- package/codemods/transforms/register-with-mask.mjs +267 -0
- package/package.json +14 -13
- package/src/fonts/Jokul-Icons.woff2 +0 -0
- package/src/fonts/brands/fremtind/Jokul-Icons.woff2 +0 -0
- package/styles/base.css +8 -1
- package/styles/base.min.css +1 -1
- package/styles/components/autosuggest/autosuggest.min.css +1 -1
- package/styles/components/beta/description-list/description-list.min.css +1 -1
- package/styles/components/beta/nav-link/navlink.min.css +1 -1
- package/styles/components/breadcrumb/breadcrumb.min.css +1 -1
- package/styles/components/button/button.min.css +1 -1
- package/styles/components/card/card.min.css +1 -1
- package/styles/components/checkbox/checkbox.min.css +1 -1
- package/styles/components/checkbox-panel/checkbox-panel.min.css +1 -1
- package/styles/components/checkbox-panel/development/styles.min.css +1 -1
- package/styles/components/chip/chip.min.css +1 -1
- package/styles/components/combobox/combobox.min.css +1 -1
- package/styles/components/cookie-consent/cookie-consent.min.css +1 -1
- package/styles/components/countdown/countdown.css +2 -2
- package/styles/components/countdown/countdown.min.css +1 -1
- package/styles/components/date-input/_index.scss +8 -0
- package/styles/components/date-input/calendar/_index.scss +8 -0
- package/styles/components/date-input/calendar/calendar.css +60 -0
- package/styles/components/date-input/calendar/calendar.min.css +1 -0
- package/styles/components/date-input/calendar/calendar.scss +79 -0
- package/styles/components/date-input/date-input.css +187 -0
- package/styles/components/date-input/date-input.min.css +1 -0
- package/styles/components/date-input/date-input.scss +67 -0
- package/styles/components/description-list/description-list.min.css +1 -1
- package/styles/components/expander/accordion.min.css +1 -1
- package/styles/components/expander/expandable.min.css +1 -1
- package/styles/components/feedback/feedback.css +2 -2
- package/styles/components/feedback/feedback.min.css +1 -1
- package/styles/components/file/file.css +50 -61
- package/styles/components/file/file.min.css +1 -1
- package/styles/components/file/file.scss +66 -79
- package/styles/components/file-input/file-input.css +59 -70
- package/styles/components/file-input/file-input.min.css +1 -1
- package/styles/components/flex/flex.min.css +1 -1
- package/styles/components/help/help.min.css +1 -1
- package/styles/components/icon/icon.css +1 -1
- package/styles/components/icon/icon.min.css +1 -1
- package/styles/components/icon/icon.scss +1 -0
- package/styles/components/icon-button/icon-button.min.css +1 -1
- package/styles/components/image/development/style.min.css +1 -1
- package/styles/components/image/image.min.css +1 -1
- package/styles/components/input-group/input-group.css +2 -2
- package/styles/components/input-group/input-group.min.css +1 -1
- package/styles/components/input-panel/input-panel.min.css +1 -1
- package/styles/components/link/link.min.css +1 -1
- package/styles/components/link-list/link-list.min.css +1 -1
- package/styles/components/list/list.min.css +1 -1
- package/styles/components/loader/loader.css +6 -6
- package/styles/components/loader/loader.min.css +1 -1
- package/styles/components/loader/skeleton-loader.css +3 -3
- package/styles/components/loader/skeleton-loader.min.css +1 -1
- package/styles/components/logo/development/styles.min.css +1 -1
- package/styles/components/logo/logo.min.css +1 -1
- package/styles/components/menu/menu.min.css +1 -1
- package/styles/components/message/message.css +2 -2
- package/styles/components/message/message.min.css +1 -1
- package/styles/components/modal/modal.min.css +1 -1
- package/styles/components/nav-link/nav-link.min.css +1 -1
- package/styles/components/number-input/number-input.min.css +1 -1
- package/styles/components/pagination/development/styles.min.css +1 -1
- package/styles/components/pagination/pagination.min.css +1 -1
- package/styles/components/popover/popover.min.css +1 -1
- package/styles/components/progress-bar/progress-bar.css +1 -1
- package/styles/components/progress-bar/progress-bar.min.css +1 -1
- package/styles/components/radio-button/radio-button.min.css +1 -1
- package/styles/components/radio-panel/development/styles.min.css +1 -1
- package/styles/components/radio-panel/radio-panel.min.css +1 -1
- package/styles/components/search/search-with-submit-button.min.css +1 -1
- package/styles/components/search/search.min.css +1 -1
- package/styles/components/segmented-control/segmented-control.css +3 -3
- package/styles/components/segmented-control/segmented-control.min.css +1 -1
- package/styles/components/select/_index.scss +5 -0
- package/styles/components/select/option.css +73 -0
- package/styles/components/select/option.min.css +1 -0
- package/styles/components/select/option.scss +74 -0
- package/styles/components/select/select.css +84 -264
- package/styles/components/select/select.min.css +1 -1
- package/styles/components/select/select.scss +79 -328
- package/styles/components/summary-table/summary-table.min.css +1 -1
- package/styles/components/system-message/system-message.css +2 -2
- package/styles/components/system-message/system-message.min.css +1 -1
- package/styles/components/table/table.min.css +3 -1
- package/styles/components/table-of-contents/table-of-contents.min.css +1 -1
- package/styles/components/tabs/tabs.min.css +1 -1
- package/styles/components/tag/tag.min.css +1 -1
- package/styles/components/text-area/text-area.min.css +1 -1
- package/styles/components/text-input/text-input.min.css +1 -1
- package/styles/components/toast/toast.css +4 -4
- package/styles/components/toast/toast.min.css +1 -1
- package/styles/components/toggle-switch/toggle-switch.min.css +1 -1
- package/styles/components/tooltip/tooltip.min.css +1 -1
- package/styles/components/typography/title.min.css +1 -1
- package/styles/components.css +4391 -4612
- package/styles/components.min.css +3 -1
- package/styles/components.scss +2 -3
- package/styles/jkl/_shadows.scss +0 -12
- package/styles/theme/_fonts.scss +1 -1
- package/styles/utility/_index.scss +2 -1
- package/styles/utility/_lists.scss +7 -0
- package/build/_commonjsHelpers-C37NGDzP.cjs +0 -2
- package/build/_commonjsHelpers-C37NGDzP.cjs.map +0 -1
- package/build/_commonjsHelpers-CXUWDbkB.js +0 -2
- package/build/_commonjsHelpers-CXUWDbkB.js.map +0 -1
- package/build/cjs/components/beta/select/Select.cjs +0 -2
- package/build/cjs/components/beta/select/Select.cjs.map +0 -1
- package/build/cjs/components/beta/select/Select.d.cts +0 -3
- package/build/cjs/components/beta/select/index.cjs +0 -2
- package/build/cjs/components/beta/select/index.d.cts +0 -2
- package/build/cjs/components/beta/select/types.d.cts +0 -10
- package/build/cjs/components/datepicker/DatePicker.cjs +0 -2
- package/build/cjs/components/datepicker/DatePicker.cjs.map +0 -1
- package/build/cjs/components/datepicker/DatePicker.d.cts +0 -3
- package/build/cjs/components/datepicker/index.cjs +0 -2
- package/build/cjs/components/datepicker/index.cjs.map +0 -1
- package/build/cjs/components/datepicker/index.d.cts +0 -4
- package/build/cjs/components/datepicker/internal/Calendar.cjs +0 -2
- package/build/cjs/components/datepicker/internal/Calendar.cjs.map +0 -1
- package/build/cjs/components/datepicker/internal/Calendar.d.cts +0 -15
- package/build/cjs/components/datepicker/internal/calendarReducer.cjs +0 -2
- package/build/cjs/components/datepicker/internal/calendarReducer.cjs.map +0 -1
- package/build/cjs/components/datepicker/internal/calendarReducer.d.cts +0 -18
- package/build/cjs/components/datepicker/internal/useCalendar.cjs +0 -2
- package/build/cjs/components/datepicker/internal/useCalendar.cjs.map +0 -1
- package/build/cjs/components/datepicker/internal/useCalendar.d.cts +0 -59
- package/build/cjs/components/datepicker/internal/utils.cjs +0 -2
- package/build/cjs/components/datepicker/internal/utils.cjs.map +0 -1
- package/build/cjs/components/datepicker/internal/utils.d.cts +0 -167
- package/build/cjs/components/datepicker/types.d.cts +0 -280
- package/build/cjs/components/datepicker/utils.cjs +0 -2
- package/build/cjs/components/datepicker/utils.cjs.map +0 -1
- package/build/cjs/components/datepicker/utils.d.cts +0 -22
- package/build/cjs/components/datepicker/validation.cjs +0 -2
- package/build/cjs/components/datepicker/validation.cjs.map +0 -1
- package/build/cjs/components/datepicker/validation.d.cts +0 -4
- package/build/cjs/components/select/NativeSelect.cjs +0 -2
- package/build/cjs/components/select/NativeSelect.cjs.map +0 -1
- package/build/cjs/components/select/NativeSelect.d.cts +0 -3
- package/build/cjs/components/select/select-utils.cjs +0 -2
- package/build/cjs/components/select/select-utils.cjs.map +0 -1
- package/build/cjs/components/select/select-utils.d.cts +0 -2
- package/build/cjs/components/select/types.cjs +0 -2
- package/build/cjs/components/select/types.cjs.map +0 -1
- package/build/cjs/components/select/types.d.cts +0 -66
- package/build/cjs/hooks/useAnimatedDetails/index.cjs +0 -2
- package/build/cjs/hooks/useAnimatedDetails/index.cjs.map +0 -1
- package/build/cjs/hooks/useAnimatedDetails/index.d.cts +0 -1
- package/build/cjs/hooks/useAnimatedDetails/useAnimatedDetails.cjs +0 -2
- package/build/cjs/hooks/useAnimatedDetails/useAnimatedDetails.cjs.map +0 -1
- package/build/cjs/hooks/useAnimatedDetails/useAnimatedDetails.d.cts +0 -21
- package/build/cjs/utilities/validators/isValidDogId/isValidDogId.cjs +0 -2
- package/build/cjs/utilities/validators/isValidDogId/isValidDogId.cjs.map +0 -1
- package/build/cjs/utilities/validators/isValidDogId/isValidDogId.d.cts +0 -7
- package/build/es/components/beta/select/Select.d.ts +0 -3
- package/build/es/components/beta/select/Select.js +0 -2
- package/build/es/components/beta/select/Select.js.map +0 -1
- package/build/es/components/beta/select/index.d.ts +0 -2
- package/build/es/components/beta/select/index.js +0 -2
- package/build/es/components/beta/select/types.d.ts +0 -10
- package/build/es/components/datepicker/DatePicker.d.ts +0 -3
- package/build/es/components/datepicker/DatePicker.js +0 -2
- package/build/es/components/datepicker/DatePicker.js.map +0 -1
- package/build/es/components/datepicker/index.d.ts +0 -4
- package/build/es/components/datepicker/index.js +0 -2
- package/build/es/components/datepicker/index.js.map +0 -1
- package/build/es/components/datepicker/internal/Calendar.d.ts +0 -15
- package/build/es/components/datepicker/internal/Calendar.js +0 -2
- package/build/es/components/datepicker/internal/Calendar.js.map +0 -1
- package/build/es/components/datepicker/internal/calendarReducer.d.ts +0 -18
- package/build/es/components/datepicker/internal/calendarReducer.js +0 -2
- package/build/es/components/datepicker/internal/calendarReducer.js.map +0 -1
- package/build/es/components/datepicker/internal/useCalendar.d.ts +0 -59
- package/build/es/components/datepicker/internal/useCalendar.js +0 -2
- package/build/es/components/datepicker/internal/useCalendar.js.map +0 -1
- package/build/es/components/datepicker/internal/utils.d.ts +0 -167
- package/build/es/components/datepicker/internal/utils.js +0 -2
- package/build/es/components/datepicker/internal/utils.js.map +0 -1
- package/build/es/components/datepicker/types.d.ts +0 -280
- package/build/es/components/datepicker/utils.d.ts +0 -22
- package/build/es/components/datepicker/utils.js +0 -2
- package/build/es/components/datepicker/utils.js.map +0 -1
- package/build/es/components/datepicker/validation.d.ts +0 -4
- package/build/es/components/datepicker/validation.js +0 -2
- package/build/es/components/datepicker/validation.js.map +0 -1
- package/build/es/components/select/NativeSelect.d.ts +0 -3
- package/build/es/components/select/NativeSelect.js +0 -2
- package/build/es/components/select/NativeSelect.js.map +0 -1
- package/build/es/components/select/select-utils.d.ts +0 -2
- package/build/es/components/select/select-utils.js +0 -2
- package/build/es/components/select/select-utils.js.map +0 -1
- package/build/es/components/select/types.d.ts +0 -66
- package/build/es/components/select/types.js +0 -2
- package/build/es/components/select/types.js.map +0 -1
- package/build/es/hooks/useAnimatedDetails/index.d.ts +0 -1
- package/build/es/hooks/useAnimatedDetails/index.js +0 -2
- package/build/es/hooks/useAnimatedDetails/index.js.map +0 -1
- package/build/es/hooks/useAnimatedDetails/useAnimatedDetails.d.ts +0 -21
- package/build/es/hooks/useAnimatedDetails/useAnimatedDetails.js +0 -2
- package/build/es/hooks/useAnimatedDetails/useAnimatedDetails.js.map +0 -1
- package/build/es/utilities/validators/isValidDogId/isValidDogId.d.ts +0 -7
- package/build/es/utilities/validators/isValidDogId/isValidDogId.js +0 -2
- package/build/es/utilities/validators/isValidDogId/isValidDogId.js.map +0 -1
- package/build/utils-C5AH4j8B.js +0 -2
- package/build/utils-C5AH4j8B.js.map +0 -1
- package/build/utils-CD_aHC6R.cjs +0 -2
- package/build/utils-CD_aHC6R.cjs.map +0 -1
- package/src/fonts/Fremtind-Material-Symbols.woff2 +0 -0
- package/src/fonts/brands/fremtind/Fremtind-Material-Symbols.woff2 +0 -0
- package/styles/components/beta/select/_index.scss +0 -3
- package/styles/components/beta/select/select.css +0 -101
- package/styles/components/beta/select/select.min.css +0 -1
- package/styles/components/beta/select/select.scss +0 -99
- package/styles/components/datepicker/_calendar-date-button.scss +0 -72
- package/styles/components/datepicker/_calendar-navigation-dropdown.scss +0 -55
- package/styles/components/datepicker/_calendar-navigation.scss +0 -14
- package/styles/components/datepicker/_calendar-table.scss +0 -29
- package/styles/components/datepicker/_calendar.scss +0 -28
- package/styles/components/datepicker/_index.scss +0 -6
- package/styles/components/datepicker/datepicker.css +0 -246
- package/styles/components/datepicker/datepicker.min.css +0 -1
- package/styles/components/datepicker/datepicker.scss +0 -49
- /package/build/cjs/components/{beta/select → date-input/calendar}/types.cjs +0 -0
- /package/build/cjs/components/{beta/select → date-input/calendar}/types.cjs.map +0 -0
- /package/build/cjs/components/{beta/select → date-input}/index.cjs.map +0 -0
- /package/build/cjs/components/{datepicker → date-input}/types.cjs +0 -0
- /package/build/cjs/components/{datepicker → date-input}/types.cjs.map +0 -0
- /package/build/es/components/{beta/select → date-input/calendar}/types.js +0 -0
- /package/build/es/components/{beta/select → date-input/calendar}/types.js.map +0 -0
- /package/build/es/components/{beta/select → date-input}/index.js.map +0 -0
- /package/build/es/components/{datepicker → date-input}/types.js +0 -0
- /package/build/es/components/{datepicker → date-input}/types.js.map +0 -0
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{D as a,c as s,j as t,k as e,l as i,h as o,g as n,a as r,f as d,e as l,i as c,b as g,m,s as p}from"../../../../utils-C5AH4j8B.js";import"react";import"../utils.js";export{a as DEFAULT_YEARS_TO_SHOW,s as addMonth,t as composeEventHandlers,e as dateHasChanged,i as dateIsOutsideRange,o as getCalendars,n as getInitialDate,r as getInitialDateShown,d as getMonthSelectOptions,l as getYearSelectOptions,c as isBackDisabled,g as isForwardDisabled,m as isSameDay,p as subtractMonth};
|
|
2
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
import { ButtonHTMLAttributes, ChangeEvent, ComponentProps, FocusEvent, KeyboardEvent } from 'react';
|
|
2
|
-
import { DataTestAutoId } from '../../utilities/types.js';
|
|
3
|
-
import { InputGroupProps, LabelProps } from '../input-group/types.js';
|
|
4
|
-
export type DateValidationError = "WRONG_FORMAT" | "OUTSIDE_LOWER_BOUND" | "OUTSIDE_UPPER_BOUND";
|
|
5
|
-
export type DatePickerChangeEventHandler = (e: ChangeEvent<HTMLInputElement>, date: Date | null, meta: DatePickerMetadata) => void;
|
|
6
|
-
export type DatePickerBlurEventHandler = (e: FocusEvent<HTMLInputElement>, date: Date | null, meta: DatePickerMetadata) => void;
|
|
7
|
-
export type DatePickerFocusEventHandler = DatePickerBlurEventHandler;
|
|
8
|
-
export type DatePickerKeyDownEventHandler = (e: KeyboardEvent<HTMLInputElement>, date: Date | null, meta: DatePickerMetadata) => void;
|
|
9
|
-
export type DatePickerMetadata = {
|
|
10
|
-
error: DateValidationError | null;
|
|
11
|
-
/** Samme som event.target.value */
|
|
12
|
-
value: string;
|
|
13
|
-
};
|
|
14
|
-
export type YearsToShow = number | "all" | {
|
|
15
|
-
previous: number;
|
|
16
|
-
coming: number;
|
|
17
|
-
};
|
|
18
|
-
export interface DatePickerProps extends Omit<InputGroupProps, "label" | "children">, DataTestAutoId {
|
|
19
|
-
/** Settes på rotnivå. */
|
|
20
|
-
id?: string;
|
|
21
|
-
/** Settes på rotnivå. */
|
|
22
|
-
className?: string;
|
|
23
|
-
/**
|
|
24
|
-
* @default "Velg dato"
|
|
25
|
-
*/
|
|
26
|
-
label?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Bruk labelProps for å sette props som `variant` og `srOnly`.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```tsx
|
|
32
|
-
* <DatePicker
|
|
33
|
-
* labelProps={{ srOnly: true }}
|
|
34
|
-
* />
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
labelProps?: Omit<LabelProps, "children">;
|
|
38
|
-
/**
|
|
39
|
-
* dd.mm.åååå
|
|
40
|
-
*
|
|
41
|
-
* Dersom komponenten ikke er _controlled_, send inn ønsket standardverdi her (hvis noen).
|
|
42
|
-
*
|
|
43
|
-
* @default undefined // tomt skjemafelt
|
|
44
|
-
*/
|
|
45
|
-
defaultValue?: string;
|
|
46
|
-
/**
|
|
47
|
-
* Styr om du vil at kalenderen skal starte åpen.
|
|
48
|
-
* @default false
|
|
49
|
-
*/
|
|
50
|
-
defaultShow?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* dd.mm.åååå
|
|
53
|
-
*
|
|
54
|
-
* Verdien til inputfeltet.
|
|
55
|
-
*/
|
|
56
|
-
value?: string;
|
|
57
|
-
/**
|
|
58
|
-
* dd.mm.åååå
|
|
59
|
-
*
|
|
60
|
-
* Skru av knapper i kalenderen før denne datoen,
|
|
61
|
-
* og gi valideringsfeil om dato som har blitt skrevet inn er utenfor.
|
|
62
|
-
*/
|
|
63
|
-
disableBeforeDate?: string;
|
|
64
|
-
/**
|
|
65
|
-
* dd.mm.åååå
|
|
66
|
-
*
|
|
67
|
-
* Skru av knapper i kalenderen etter denne datoen,
|
|
68
|
-
* og gi valideringsfeil om dato som har blitt skrevet inn er utenfor.
|
|
69
|
-
*/
|
|
70
|
-
disableAfterDate?: string;
|
|
71
|
-
/**
|
|
72
|
-
* Angir hvor mange år som skal vises i nedtrekkslisten i kalenderen. Du kan angi samme verdi
|
|
73
|
-
* for kommende og foregående år ved å sende inn et tall, eller sende inn et objekt med separate
|
|
74
|
-
* verdier for kommende og foregående år. Hvis du sender inn "all" vil alle år mellom min. og
|
|
75
|
-
* maks. dato vises i listen (eller default antall år hvis ikke min./maks. dato er angitt).
|
|
76
|
-
* @default 3
|
|
77
|
-
*/
|
|
78
|
-
yearsToShow?: YearsToShow;
|
|
79
|
-
/**
|
|
80
|
-
* Settes på inputfeltet.
|
|
81
|
-
*/
|
|
82
|
-
name?: string;
|
|
83
|
-
/**
|
|
84
|
-
* Hjelpetekst som vises under inputfeltet.
|
|
85
|
-
*/
|
|
86
|
-
helpLabel?: string;
|
|
87
|
-
/**
|
|
88
|
-
* Hvis datovelgeren har valideringsfeil må dette feltet settes. Inputfeltet
|
|
89
|
-
* merkes som ugyldig og teksten erstatter en eventuell hjelpetekst.
|
|
90
|
-
*/
|
|
91
|
-
errorLabel?: string;
|
|
92
|
-
/**
|
|
93
|
-
* Merk som ugyldig uten å sende inn en errorLabel.
|
|
94
|
-
* NB! Brukes kun i tilfeller der valideringsfeil dukker opp andre steder, for eksempel i en FieldGroup.
|
|
95
|
-
*/
|
|
96
|
-
invalid?: boolean;
|
|
97
|
-
/**
|
|
98
|
-
* @deprecated Kalenderen viser nå alltid kontroller for å navigere mellom år og måneder.
|
|
99
|
-
* Denne prop'en gjør ikke lenger noe og kan fjernes.
|
|
100
|
-
*/
|
|
101
|
-
extended?: boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Om du ønsker andre labels for ukedagene kan du gi de her.
|
|
104
|
-
*/
|
|
105
|
-
days?: string[];
|
|
106
|
-
/**
|
|
107
|
-
* Om du ønsker andre labels for måneder kan du gi de her.
|
|
108
|
-
*/
|
|
109
|
-
months?: string[];
|
|
110
|
-
/**
|
|
111
|
-
* Overstyr hvordan vi omtaler "Måned".
|
|
112
|
-
* @default "Måned"
|
|
113
|
-
*/
|
|
114
|
-
monthLabel?: string;
|
|
115
|
-
/**
|
|
116
|
-
* Overstyr hvordan vi omtaler "År".
|
|
117
|
-
* @default "År"
|
|
118
|
-
*/
|
|
119
|
-
yearLabel?: string;
|
|
120
|
-
/**
|
|
121
|
-
* Vises i inputfeltet hvis det ikke har noen input, som hint for datoformat.
|
|
122
|
-
* @default "dd.mm.åååå"
|
|
123
|
-
*/
|
|
124
|
-
placeholder?: string;
|
|
125
|
-
/**
|
|
126
|
-
* Bredden på inputfeltet, tilpasset typisk bredde for en dato i formatet `dd.mm.åååå`.
|
|
127
|
-
* @default "10ch"
|
|
128
|
-
*/
|
|
129
|
-
width?: string;
|
|
130
|
-
/**
|
|
131
|
-
* Kalles ved change-event fra datovelgerens inputfelt. Verdien fra selve eventet vil
|
|
132
|
-
* alltid være teksten fra inputfeltet.
|
|
133
|
-
*
|
|
134
|
-
* Det er _ikke_ garantert at verdien fra `event.target.value` er en
|
|
135
|
-
* gyldig dato, eller i datoformat. Andre parameter vil enten være en gyldig
|
|
136
|
-
* `Date` eller `null`. Tredje parameter har informasjon om validering,
|
|
137
|
-
* men du kan også gjøre validering selv rett på `event.target.value`
|
|
138
|
-
* med utility-funksjoner som eksporteres fra pakka (se eksempel lenger ned).
|
|
139
|
-
*
|
|
140
|
-
* Kalles også når brukeren velger en dato fra kalendervisningen. Kallet
|
|
141
|
-
* prøver å simulere et vanlig change-event så nært som mulig.
|
|
142
|
-
*
|
|
143
|
-
* Bruk meta-objektet for å se om det er valideringsfeil, og i så fal hvilken type feil:
|
|
144
|
-
*
|
|
145
|
-
* - ugyldig format på tekst
|
|
146
|
-
* - dato utenfor minimum tillatte dato (satt med `disableBeforeDate`)
|
|
147
|
-
* - dato utenfor maksimum tillatte dato (satt med `disableAfterDate`)
|
|
148
|
-
*
|
|
149
|
-
* @example
|
|
150
|
-
*
|
|
151
|
-
* ```tsx
|
|
152
|
-
* <DatePicker
|
|
153
|
-
* value={value}
|
|
154
|
-
* onChange={(e, date, meta) => {
|
|
155
|
-
* setValue(e.target.value);
|
|
156
|
-
*
|
|
157
|
-
* console.log("onChange", {
|
|
158
|
-
* event: e,
|
|
159
|
-
* date,
|
|
160
|
-
* meta,
|
|
161
|
-
* });
|
|
162
|
-
* }}
|
|
163
|
-
* />
|
|
164
|
-
* ```
|
|
165
|
-
*
|
|
166
|
-
* @example
|
|
167
|
-
*
|
|
168
|
-
* ```tsx
|
|
169
|
-
* import {
|
|
170
|
-
* DatePicker,
|
|
171
|
-
* formatInput,
|
|
172
|
-
* isCorrectFormat,
|
|
173
|
-
* isWithinUpperBound,
|
|
174
|
-
* isWithinLowerBound,
|
|
175
|
-
* parseDateString
|
|
176
|
-
* } from "@fremtind/jkl-datepicker-react";
|
|
177
|
-
* import { formatDate } from "@fremtind/jkl-formatters-util";
|
|
178
|
-
*
|
|
179
|
-
* <DatePicker
|
|
180
|
-
* label="Fødselsdato"
|
|
181
|
-
* errorLabel={formState.errors.fodselsdato?.message}
|
|
182
|
-
* disableBefore="01.01.1970"
|
|
183
|
-
* disableAfter={formatInput(new Date())}
|
|
184
|
-
* {...register("fodselsdato", {
|
|
185
|
-
* required: "Du må fylle ut fødselsdato",
|
|
186
|
-
* validate: {
|
|
187
|
-
* isCorrectFormat: (v) =>
|
|
188
|
-
* isCorrectFormat(v) ||
|
|
189
|
-
* `Datoen må være skrevet i formen ${formatDate(new Date())} eller kortformat`,
|
|
190
|
-
* withinLowerBound: (v) =>
|
|
191
|
-
* isWithinLowerBound(v, parseDateString("01.01.1970") || "Datoen må være før 01.01.1970"",
|
|
192
|
-
* withinUpperBound: (v) =>
|
|
193
|
-
* isWithinUpperBound(v, new Date()) || `Datoen må være før ${formatDate(new Date())}`,
|
|
194
|
-
* },
|
|
195
|
-
* })}
|
|
196
|
-
* />
|
|
197
|
-
* ```
|
|
198
|
-
*/
|
|
199
|
-
onChange?: DatePickerChangeEventHandler;
|
|
200
|
-
/**
|
|
201
|
-
* Kalles ved focus-event fra datovelgerens inputfelt.
|
|
202
|
-
*
|
|
203
|
-
* @example
|
|
204
|
-
* ```tsx
|
|
205
|
-
* <DatePicker
|
|
206
|
-
* onFocus={(e, date, meta) => {
|
|
207
|
-
* console.log("onFocus", {
|
|
208
|
-
* event: e,
|
|
209
|
-
* date,
|
|
210
|
-
* meta,
|
|
211
|
-
* });
|
|
212
|
-
* }}
|
|
213
|
-
* />
|
|
214
|
-
* ```
|
|
215
|
-
*/
|
|
216
|
-
onFocus?: DatePickerFocusEventHandler;
|
|
217
|
-
/**
|
|
218
|
-
* Kalles ved blur-event fra datovelgerens inputfelt, og kommer når fokus flyttes ut
|
|
219
|
-
* av skjemaelementet.
|
|
220
|
-
*
|
|
221
|
-
* **NB!** Dette inkluderer når fokus flyttes inn i kalenderen, eller til kalenderknappen!
|
|
222
|
-
*
|
|
223
|
-
* Om du ønsker å gjøre ting når brukeren går videre fra hele DatePicker:
|
|
224
|
-
* 1. Ha en onBlur på DatePicker, men ignorere events når fokus er inni DatePicker
|
|
225
|
-
* 2. Ha en onBlur på DatePicker sin action-prop (kalenderknappen), og gjøre det samme
|
|
226
|
-
*
|
|
227
|
-
* Hjelpefunksjonen isBlurTargetOutside hjelper med detaljene.
|
|
228
|
-
*
|
|
229
|
-
* @example
|
|
230
|
-
* ```tsx
|
|
231
|
-
* import { DatePicker, isBlurTargetOutside } from "@fremtind/jkl-datepicker-react";
|
|
232
|
-
*
|
|
233
|
-
* <DatePicker
|
|
234
|
-
* onBlur={(e, date, meta) => {
|
|
235
|
-
* // Ignorer blurs som går til kalenderknapper
|
|
236
|
-
* if (isBlurTargetOutside(e)) {
|
|
237
|
-
* console.log("onBlur");
|
|
238
|
-
* }
|
|
239
|
-
* }}
|
|
240
|
-
* action={{
|
|
241
|
-
* onBlur: (e) => {
|
|
242
|
-
* // Ignorer blurs som går tilbake til inputfeltet
|
|
243
|
-
* if (isBlurTargetOutside(e)) {
|
|
244
|
-
* console.log("action.onBlur");
|
|
245
|
-
* }
|
|
246
|
-
* },
|
|
247
|
-
* }}
|
|
248
|
-
* />
|
|
249
|
-
* ```
|
|
250
|
-
*/
|
|
251
|
-
onBlur?: DatePickerBlurEventHandler;
|
|
252
|
-
/**
|
|
253
|
-
* Kalles ved onKeyDown på datovelgerens inputfelt. Dersom du trenger å fange opp
|
|
254
|
-
* alle tastetrykk, inkludert Tab videre til knappen for å åpne/lukke kalenderen,
|
|
255
|
-
* så kan du bruke dette eventet.
|
|
256
|
-
*
|
|
257
|
-
* @deprecated Eventet har mye overlapp med onChange, men var tidligere eneste metode for å
|
|
258
|
-
* få tilbakemelding ved tastetrykk i inputfeltet. Foretrekk onChange for ny kode.
|
|
259
|
-
*/
|
|
260
|
-
onKeyDown?: DatePickerKeyDownEventHandler;
|
|
261
|
-
/**
|
|
262
|
-
* Lar deg sette lyttere på kalenderknappen i skjemafeltet.
|
|
263
|
-
*/
|
|
264
|
-
action?: DatePickerAction;
|
|
265
|
-
showCalendarLabel?: string;
|
|
266
|
-
hideCalendarLabel?: string;
|
|
267
|
-
/**
|
|
268
|
-
* Props som sendes direkte til komponentens TextInput
|
|
269
|
-
*/
|
|
270
|
-
textInputProps?: Omit<ComponentProps<"input">, "type" | "children" | "className" | "name" | "defaultValue" | "value" | "placeholder" | "width" | "onFocus" | "onBlur" | "onChange">;
|
|
271
|
-
}
|
|
272
|
-
export interface DatePickerAction extends Exclude<ButtonHTMLAttributes<HTMLButtonElement>, "disabled"> {
|
|
273
|
-
}
|
|
274
|
-
export type ComparisonOptions = {
|
|
275
|
-
/**
|
|
276
|
-
* Kontroller om testen skal godkjennes om verdien er lik
|
|
277
|
-
* @default false
|
|
278
|
-
*/
|
|
279
|
-
inclusive: boolean;
|
|
280
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { FocusEvent } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Format a Date object as a string in the format DatePicker expects.
|
|
4
|
-
*
|
|
5
|
-
* @param date the Date object to format
|
|
6
|
-
* @return returns a date string with "dd.mm.yyyy"-format
|
|
7
|
-
*/
|
|
8
|
-
export declare function formatInput(date: Date): string;
|
|
9
|
-
/**
|
|
10
|
-
* Convert a date string to a Date object
|
|
11
|
-
*
|
|
12
|
-
* @param dateString date as string with format dd.mm.yyyy
|
|
13
|
-
* @return a Date object representing the given date
|
|
14
|
-
*/
|
|
15
|
-
export declare function parseDateString(dateString?: string): Date | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Hjelpefunksjon for å se om en onBlur går utenfor DatePicker,
|
|
18
|
-
* eller om den går til et interaktivt element inni DatePickeren.
|
|
19
|
-
* @param {FocusEvent<HTMLButtonElement | HTMLInputElement>} e - Eventet fra onBlur og action.onBlur
|
|
20
|
-
* @returns {boolean} true hvis e.relatedTarget er utenfor DatePicker
|
|
21
|
-
*/
|
|
22
|
-
export declare function isBlurTargetOutside(e: FocusEvent<HTMLButtonElement | HTMLInputElement>): boolean;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=/^(\d\d?)[\W](\d\d?)[\W](\d{4}|\d{2})$/,t=/^(\d{4}|\d{2})[\W](\d\d?)[\W](\d\d?)$/;function r(e){return`${`${e.getDate()}`.padStart(2,"0")}.${`${e.getMonth()+1}`.padStart(2,"0")}.${e.getFullYear()}`}function n(r){if(!r)return;const n=(r=>{const n=e.exec(r);if(n)return n.slice(1,4);const a=t.exec(r);if(!a)return;const s=a.slice(1,4);return s.reverse(),s})(r);if(!n)return;const a=Number.parseInt((new Date).toLocaleString("no-NB",{year:"2-digit"})),s=Number.parseInt(n[0],10),u=Number.parseInt(n[1],10)-1,d=Number.parseInt(n[2],10),i=d>99?d:(c=d)>a?c+1900:c+2e3,o=new Date(i,u,s,0,0,0);var c;return o.getMonth()===u&&o.getFullYear()===i?o:void 0}function a(e){if(!e.relatedTarget)return!0;const t=e.target.closest(".jkl-datepicker__input-wrapper");return e.relatedTarget.closest(".jkl-datepicker__input-wrapper")!==t}export{r as formatInput,a as isBlurTargetOutside,n as parseDateString};
|
|
2
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../src/components/datepicker/utils.ts"],"sourcesContent":["import type { FocusEvent } from \"react\";\n\nconst dayMonthYearRegex = /^(\\d\\d?)[\\W](\\d\\d?)[\\W](\\d{4}|\\d{2})$/;\nconst yearMonthDayRegex = /^(\\d{4}|\\d{2})[\\W](\\d\\d?)[\\W](\\d\\d?)$/;\n\n/**\n * Format a Date object as a string in the format DatePicker expects.\n *\n * @param date the Date object to format\n * @return returns a date string with \"dd.mm.yyyy\"-format\n */\nexport function formatInput(date: Date): string {\n const day = `${date.getDate()}`.padStart(2, \"0\");\n const month = `${date.getMonth() + 1}`.padStart(2, \"0\");\n return `${day}.${month}.${date.getFullYear()}`;\n}\n\n/**\n * Get the date segments from a string of unknown format\n *\n * @param input date as a string with unknown format\n * @returns an array of string elements [day, month, year]\n */\nconst getDateSegmentsFromString = (input: string): string[] | undefined => {\n const dayMonthYear = dayMonthYearRegex.exec(input);\n\n if (dayMonthYear) {\n return dayMonthYear.slice(1, 4);\n }\n\n const yearMonthDay = yearMonthDayRegex.exec(input);\n\n if (!yearMonthDay) {\n return undefined;\n }\n\n // reverse to get the correct ordering\n const slicedDateSegments = yearMonthDay.slice(1, 4);\n slicedDateSegments.reverse();\n\n return slicedDateSegments;\n};\n\n/**\n * Convert a date string to a Date object\n *\n * @param dateString date as string with format dd.mm.yyyy\n * @return a Date object representing the given date\n */\nexport function parseDateString(dateString?: string): Date | undefined {\n if (!dateString) {\n return undefined;\n }\n\n const inputDateSegments = getDateSegmentsFromString(dateString);\n\n if (!inputDateSegments) {\n return undefined;\n }\n\n const currentTwoDigitYear = Number.parseInt(\n new Date().toLocaleString(\"no-NB\", { year: \"2-digit\" }),\n );\n const parseTwoDigitYear = (year: number) =>\n year > currentTwoDigitYear ? year + 1900 : year + 2000;\n\n const day = Number.parseInt(inputDateSegments[0], 10);\n const month = Number.parseInt(inputDateSegments[1], 10) - 1;\n const yearIn = Number.parseInt(inputDateSegments[2], 10);\n const year = yearIn > 99 ? yearIn : parseTwoDigitYear(yearIn);\n\n const generatedDate = new Date(year, month, day, 0, 0, 0);\n // Days can \"overflow\" to next month/year in Date(). Return undefined if it does:\n return generatedDate.getMonth() === month &&\n generatedDate.getFullYear() === year\n ? generatedDate\n : undefined;\n}\n\n/**\n * Hjelpefunksjon for å se om en onBlur går utenfor DatePicker,\n * eller om den går til et interaktivt element inni DatePickeren.\n * @param {FocusEvent<HTMLButtonElement | HTMLInputElement>} e - Eventet fra onBlur og action.onBlur\n * @returns {boolean} true hvis e.relatedTarget er utenfor DatePicker\n */\nexport function isBlurTargetOutside(\n e: FocusEvent<HTMLButtonElement | HTMLInputElement>,\n): boolean {\n if (!e.relatedTarget) {\n return true;\n }\n\n const targetRoot = e.target.closest(\".jkl-datepicker__input-wrapper\");\n const relatedTargetRoot = e.relatedTarget.closest(\n \".jkl-datepicker__input-wrapper\",\n );\n\n return relatedTargetRoot !== targetRoot;\n}\n"],"names":["dayMonthYearRegex","yearMonthDayRegex","formatInput","date","getDate","padStart","getMonth","getFullYear","parseDateString","dateString","inputDateSegments","input","dayMonthYear","exec","slice","yearMonthDay","slicedDateSegments","reverse","getDateSegmentsFromString","currentTwoDigitYear","Number","parseInt","Date","toLocaleString","year","day","month","yearIn","generatedDate","isBlurTargetOutside","e","relatedTarget","targetRoot","target","closest"],"mappings":"AAEA,MAAMA,EAAoB,wCACpBC,EAAoB,wCAQnB,SAASC,EAAYC,GAGxB,MAAO,GAFK,GAAGA,EAAKC,YAAYC,SAAS,EAAG,QAC9B,GAAGF,EAAKG,WAAa,IAAID,SAAS,EAAG,QACzBF,EAAKI,eACnC,CAkCO,SAASC,EAAgBC,GAC5B,IAAKA,EACD,OAGJ,MAAMC,EA/BwB,CAACC,IAC/B,MAAMC,EAAeZ,EAAkBa,KAAKF,GAE5C,GAAIC,EACA,OAAOA,EAAaE,MAAM,EAAG,GAGjC,MAAMC,EAAed,EAAkBY,KAAKF,GAE5C,IAAKI,EACD,OAIJ,MAAMC,EAAqBD,EAAaD,MAAM,EAAG,GACjD,OAAAE,EAAmBC,UAEZD,GAcmBE,CAA0BT,GAEpD,IAAKC,EACD,OAGJ,MAAMS,EAAsBC,OAAOC,UAAA,IAC3BC,MAAOC,eAAe,QAAS,CAAEC,KAAM,aAKzCC,EAAML,OAAOC,SAASX,EAAkB,GAAI,IAC5CgB,EAAQN,OAAOC,SAASX,EAAkB,GAAI,IAAM,EACpDiB,EAASP,OAAOC,SAASX,EAAkB,GAAI,IAC/Cc,EAAOG,EAAS,GAAKA,GANAH,EAM2BG,GAL3CR,EAAsBK,EAAO,KAAOA,EAAO,IAOhDI,EAAgB,IAAIN,KAAKE,EAAME,EAAOD,EAAK,EAAG,EAAG,GAR7B,IAACD,EAU3B,OAAOI,EAActB,aAAeoB,GAChCE,EAAcrB,gBAAkBiB,EAC9BI,OACA,CACV,CAQO,SAASC,EACZC,GAEA,IAAKA,EAAEC,cACH,OAAO,EAGX,MAAMC,EAAaF,EAAEG,OAAOC,QAAQ,kCAKpC,OAJ0BJ,EAAEC,cAAcG,QACtC,oCAGyBF,CACjC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ComparisonOptions } from './types.js';
|
|
2
|
-
export declare function isCorrectFormat(value: string | undefined): boolean;
|
|
3
|
-
export declare function isWithinLowerBound(value: Date | string | undefined, minDate: Date, options?: ComparisonOptions): boolean;
|
|
4
|
-
export declare function isWithinUpperBound(value: Date | string | undefined, maxDate: Date, options?: ComparisonOptions): boolean;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{parseDateString as i}from"./utils.js";function n(n){return!!n&&!!i(n)}function t(n,t,r={inclusive:!1}){const s="string"==typeof n?i(n):n;return!!s&&(r.inclusive?s>=t:s>t)}function r(n,t,r={inclusive:!1}){const s="string"==typeof n?i(n):n;return!!s&&(r.inclusive?s<=t:s<t)}export{n as isCorrectFormat,t as isWithinLowerBound,r as isWithinUpperBound};
|
|
2
|
-
//# sourceMappingURL=validation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sources":["../../../../src/components/datepicker/validation.ts"],"sourcesContent":["import type { ComparisonOptions } from \"./types.js\";\nimport { parseDateString } from \"./utils.js\";\n\nexport function isCorrectFormat(value: string | undefined): boolean {\n if (!value) {\n return false;\n }\n const val = parseDateString(value);\n return Boolean(val);\n}\n\nexport function isWithinLowerBound(\n value: Date | string | undefined,\n minDate: Date,\n options: ComparisonOptions = { inclusive: false },\n): boolean {\n const val = typeof value === \"string\" ? parseDateString(value) : value;\n\n if (!val) {\n return false;\n }\n\n if (options.inclusive) {\n return val >= minDate;\n }\n\n return val > minDate;\n}\n\nexport function isWithinUpperBound(\n value: Date | string | undefined,\n maxDate: Date,\n options: ComparisonOptions = { inclusive: false },\n): boolean {\n const val = typeof value === \"string\" ? parseDateString(value) : value;\n\n if (!val) {\n return false;\n }\n\n if (options.inclusive) {\n return val <= maxDate;\n }\n\n return val < maxDate;\n}\n"],"names":["isCorrectFormat","value","parseDateString","isWithinLowerBound","minDate","options","inclusive","val","isWithinUpperBound","maxDate"],"mappings":"6CAGO,SAASA,EAAgBC,GAC5B,QAAKA,KAGOC,EAAgBD,EAEhC,CAEO,SAASE,EACZF,EACAG,EACAC,EAA6B,CAAEC,WAAW,IAE1C,MAAMC,EAAuB,iBAAVN,EAAqBC,EAAgBD,GAASA,EAEjE,QAAKM,IAIDF,EAAQC,UACDC,GAAOH,EAGXG,EAAMH,EACjB,CAEO,SAASI,EACZP,EACAQ,EACAJ,EAA6B,CAAEC,WAAW,IAE1C,MAAMC,EAAuB,iBAAVN,EAAqBC,EAAgBD,GAASA,EAEjE,QAAKM,IAIDF,EAAQC,UACDC,GAAOE,EAGXF,EAAME,EACjB"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{c as a}from"../../../clsx-BeLtu-UY.js";import{forwardRef as t}from"react";import{getValuePair as s}from"../../utilities/valuePair.js";import{ArrowVerticalAnimated as i}from"../icon/icons/animated/ArrowVerticalAnimated.js";import{InputGroup as r}from"../input-group/InputGroup.js";const o=t((t,o)=>{const{"data-size":c,label:p,className:n,errorLabel:d,helpLabel:m,inline:u,invalid:j,items:v,labelProps:b,placeholder:_="Velg",selectClassName:f,supportLabelProps:k,tooltip:N,value:h,width:w,description:L,...P}=t;return e(r,{label:p,errorLabel:d,helpLabel:m,labelProps:b,inline:u,supportLabelProps:k,tooltip:N,description:L,"data-testid":"jkl-select","data-size":c,className:a("jkl-select",n,{"jkl-select--inline":u,"jkl-select--invalid":!!d||j}),render:t=>l("div",{className:"jkl-select__outer-wrapper",style:{width:w},children:[l("select",{ref:o,className:a("jkl-select__button",f,{"jkl-select__button--active-value":!!h}),defaultValue:h?void 0:"",value:h,...t,...P,children:[_&&!h&&e("option",{disabled:!0,value:"",children:_}),v.map(s).map(l=>e("option",{"data-testid":"jkl-select__option",className:"jkl-select__option",value:l.value,children:l.label},l.value))]}),e(i,{variant:"medium",pointingDown:!0,className:"jkl-select__arrow"})]})})});o.displayName="NativeSelect";export{o as NativeSelect};
|
|
2
|
-
//# sourceMappingURL=NativeSelect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NativeSelect.js","sources":["../../../../src/components/select/NativeSelect.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef } from \"react\";\nimport { getValuePair } from \"../../utilities/valuePair.js\";\nimport { ArrowVerticalAnimated } from \"../icon/icons/animated/ArrowVerticalAnimated.js\";\nimport { InputGroup } from \"../input-group/InputGroup.js\";\nimport type { NativeSelectProps } from \"./types.js\";\n\nexport const NativeSelect = forwardRef<HTMLSelectElement, NativeSelectProps>(\n (props, ref) => {\n const {\n \"data-size\": dataSize,\n label,\n className,\n errorLabel,\n helpLabel,\n inline,\n invalid,\n items,\n labelProps,\n placeholder = \"Velg\",\n selectClassName,\n supportLabelProps,\n tooltip,\n value,\n width,\n description,\n ...rest\n } = props;\n\n const inputGroupProps = {\n label,\n errorLabel,\n helpLabel,\n labelProps,\n inline,\n supportLabelProps,\n tooltip,\n description,\n };\n\n return (\n <InputGroup\n {...inputGroupProps}\n data-testid=\"jkl-select\"\n data-size={dataSize}\n className={clsx(\"jkl-select\", className, {\n \"jkl-select--inline\": inline,\n \"jkl-select--invalid\": !!errorLabel || invalid,\n })}\n render={(inputProps) => (\n <div\n className=\"jkl-select__outer-wrapper\"\n style={{ width }}\n >\n <select\n ref={ref}\n className={clsx(\n \"jkl-select__button\",\n selectClassName,\n {\n \"jkl-select__button--active-value\": !!value,\n },\n )}\n defaultValue={value ? undefined : \"\"}\n value={value}\n {...inputProps}\n {...rest}\n >\n {placeholder && !value && (\n <option disabled value=\"\">\n {placeholder}\n </option>\n )}\n {items.map(getValuePair).map((item) => (\n <option\n data-testid=\"jkl-select__option\"\n className=\"jkl-select__option\"\n key={item.value}\n value={item.value}\n >\n {item.label}\n </option>\n ))}\n </select>\n <ArrowVerticalAnimated\n variant=\"medium\"\n pointingDown\n className=\"jkl-select__arrow\"\n />\n </div>\n )}\n />\n );\n },\n);\n\nNativeSelect.displayName = \"NativeSelect\";\n"],"names":["NativeSelect","forwardRef","props","ref","dataSize","label","className","errorLabel","helpLabel","inline","invalid","items","labelProps","placeholder","selectClassName","supportLabelProps","tooltip","value","width","description","rest","jsx","InputGroup","clsx","render","inputProps","jsxs","style","children","defaultValue","disabled","map","getValuePair","item","ArrowVerticalAnimated","variant","pointingDown","displayName"],"mappings":"iVAOO,MAAMA,EAAeC,EACxB,CAACC,EAAOC,KACJ,MACI,YAAaC,EACbC,MAAAA,EACAC,UAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAC,OAAAA,EACAC,QAAAA,EACAC,MAAAA,EACAC,WAAAA,EACAC,YAAAA,EAAc,OACdC,gBAAAA,EACAC,kBAAAA,EACAC,QAAAA,EACAC,MAAAA,EACAC,MAAAA,EACAC,YAAAA,KACGC,GACHlB,EAaJ,OACImB,EAACC,EAAA,CAXDjB,MAAAA,EACAE,WAAAA,EACAC,UAAAA,EACAI,WAAAA,EACAH,OAAAA,EACAM,kBAAAA,EACAC,QAAAA,EACAG,YAAAA,EAMI,cAAY,aACZ,YAAWf,EACXE,UAAWiB,EAAK,aAAcjB,EAAW,CACrC,qBAAsBG,EACtB,wBAAyBF,GAAcG,IAE3Cc,OAASC,GACLC,EAAC,MAAA,CACGpB,UAAU,4BACVqB,MAAO,CAAET,MAAAA,GAETU,SAAA,CAAAF,EAAC,SAAA,CACGvB,IAAAA,EACAG,UAAWiB,EACP,qBACAT,EACA,CACI,qCAAsCG,IAG9CY,aAAcZ,OAAQ,EAAY,GAClCA,MAAAA,KACIQ,KACAL,EAEHQ,SAAA,CAAAf,IAAgBI,GACbI,EAAC,SAAA,CAAOS,UAAQ,EAACb,MAAM,GAClBW,SAAAf,IAGRF,EAAMoB,IAAIC,GAAcD,IAAKE,GAC1BZ,EAAC,SAAA,CACG,cAAY,qBACZf,UAAU,qBAEVW,MAAOgB,EAAKhB,MAEXW,SAAAK,EAAK5B,OAHD4B,EAAKhB,WAOtBI,EAACa,EAAA,CACGC,QAAQ,SACRC,cAAY,EACZ9B,UAAU,6BAStCN,EAAaqC,YAAc"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function e(e=""){return e.toLowerCase().replace(/[\W_]+/g,"")}function o(e,o){let t=null;o&&(t=e.querySelector('[aria-selected="true"]:not([hidden])')),(!o||!t)&&(t=e.querySelector('[role="option"]')),t?.focus(),e.scrollTop=t?.offsetTop||0}export{o as focusSelected,e as toLower};
|
|
2
|
-
//# sourceMappingURL=select-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"select-utils.js","sources":["../../../../src/components/select/select-utils.ts"],"sourcesContent":["export function toLower(str = \"\") {\n return str.toLowerCase().replace(/[\\W_]+/g, \"\"); // strip all non-alphanumeric chars\n}\n\nexport function focusSelected(\n listEl: HTMLElement,\n selected: string | undefined,\n) {\n let focusedItem: HTMLElement | null = null;\n if (selected) {\n // Move focus to selected option\n focusedItem = listEl.querySelector(\n `[aria-selected=\"true\"]:not([hidden])`,\n );\n }\n if (!selected || !focusedItem) {\n // Move focus to first option if either no selected value or the value could not be found.\n // This may happen with searchable selects if the currently selected value is filtered out.\n focusedItem = listEl.querySelector('[role=\"option\"]');\n }\n focusedItem?.focus();\n // Make sure the selected/focused item is visible in the list if it scrolls\n listEl.scrollTop = focusedItem?.offsetTop || 0;\n}\n"],"names":["toLower","str","toLowerCase","replace","focusSelected","listEl","selected","focusedItem","querySelector","focus","scrollTop","offsetTop"],"mappings":"AAAO,SAASA,EAAQC,EAAM,IAC1B,OAAOA,EAAIC,cAAcC,QAAQ,UAAW,GAChD,CAEO,SAASC,EACZC,EACAC,GAEA,IAAIC,EAAkC,KAClCD,IAEAC,EAAcF,EAAOG,cACjB,2CAGHF,IAAaC,KAGdA,EAAcF,EAAOG,cAAc,oBAEvCD,GAAaE,QAEbJ,EAAOK,UAAYH,GAAaI,WAAa,CACjD"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { ChangeEvent, SelectHTMLAttributes } from 'react';
|
|
2
|
-
import { DataTestAutoId } from '../../utilities/types.js';
|
|
3
|
-
import { ValuePair } from '../../utilities/valuePair.js';
|
|
4
|
-
import { LabelProps, InputGroupProps } from '../input-group/types.js';
|
|
5
|
-
export interface NativeSelectProps extends Omit<InputGroupProps, "children">, SelectHTMLAttributes<HTMLSelectElement> {
|
|
6
|
-
/**
|
|
7
|
-
* Merk som ugyldig uten å sende inn en errorLabel.
|
|
8
|
-
* NB! Brukes kun i tilfeller der valideringsfeil dukker opp andre steder, for eksempel i en FieldGroup.
|
|
9
|
-
*/
|
|
10
|
-
invalid?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Setter inn et placeholderelement som vises når ingenting er valgt i nedtrekkslisten.
|
|
13
|
-
* @default "Velg"
|
|
14
|
-
*/
|
|
15
|
-
placeholder?: string;
|
|
16
|
-
items: Array<string | ValuePair>;
|
|
17
|
-
selectClassName?: string;
|
|
18
|
-
width?: string;
|
|
19
|
-
}
|
|
20
|
-
export interface SelectPartialChangeEvent extends Partial<Omit<ChangeEvent<HTMLSelectElement>, "target">> {
|
|
21
|
-
/** Kreves av react-hook-form, det skjer ulike ting avhengig av om det er blur eller change */
|
|
22
|
-
type: "change" | "blur";
|
|
23
|
-
target: {
|
|
24
|
-
/** Kreves av react-hook-form for å vite hvilket skjemafelt som ble endret */
|
|
25
|
-
name: string;
|
|
26
|
-
value: string;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
export type SelectChangeEventHandler = (event: SelectPartialChangeEvent) => void;
|
|
30
|
-
export interface SelectProps extends Omit<InputGroupProps, "children">, DataTestAutoId {
|
|
31
|
-
id?: string;
|
|
32
|
-
name: string;
|
|
33
|
-
label: string;
|
|
34
|
-
labelProps?: Omit<LabelProps, "children" | "htmlFor" | "standAlone">;
|
|
35
|
-
items: Array<string | ValuePair>;
|
|
36
|
-
/**
|
|
37
|
-
* @default false
|
|
38
|
-
*/
|
|
39
|
-
inline?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* @default "Velg"
|
|
42
|
-
*/
|
|
43
|
-
defaultPrompt?: string;
|
|
44
|
-
className?: string;
|
|
45
|
-
value?: string;
|
|
46
|
-
helpLabel?: string;
|
|
47
|
-
errorLabel?: string;
|
|
48
|
-
/**
|
|
49
|
-
* @default false
|
|
50
|
-
*/
|
|
51
|
-
searchable?: boolean | ((searchValue: string, searchItem: string | ValuePair) => boolean);
|
|
52
|
-
width?: string;
|
|
53
|
-
onChange?: SelectChangeEventHandler;
|
|
54
|
-
onBlur?: SelectChangeEventHandler;
|
|
55
|
-
onFocus?: SelectChangeEventHandler;
|
|
56
|
-
/**
|
|
57
|
-
* Merk som ugyldig uten å sende inn en errorLabel.
|
|
58
|
-
* NB! Brukes kun i tilfeller der valideringsfeil dukker opp andre steder, for eksempel i en FieldGroup.
|
|
59
|
-
*/
|
|
60
|
-
invalid?: boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Hvor mange valg skal vises i listen før den begynner å scrolle.
|
|
63
|
-
* @default 5
|
|
64
|
-
*/
|
|
65
|
-
maxShownOptions?: number;
|
|
66
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useAnimatedDetails } from './useAnimatedDetails.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lar deg animere et HTML details element med en summary trigger og noe innhold.
|
|
3
|
-
* HTML strukturen din bør se ut som omtrent
|
|
4
|
-
* <details ref={detailsRef}>
|
|
5
|
-
* <summary ref={summaryRef} onClick={onSummaryClick}>Trigger for å åpne</summary>
|
|
6
|
-
* <div ref={contentRef}>Ekspanderbart innhold</div>
|
|
7
|
-
* </details>
|
|
8
|
-
*
|
|
9
|
-
* @param onOpenChange Callback med informasjon om når elementet åpner/lukker seg.
|
|
10
|
-
* @param isExpanded Styr åpning/lukking utenfra.
|
|
11
|
-
* @deprecated Bruk heller `useAnimatedHeightBetween` eller lignende på selve innholdet
|
|
12
|
-
*/
|
|
13
|
-
export declare const useAnimatedDetails: ({ onOpenChange, isExpanded, }: {
|
|
14
|
-
onOpenChange: (open: boolean, e: React.MouseEvent<HTMLElement>) => void;
|
|
15
|
-
isExpanded: boolean;
|
|
16
|
-
}) => {
|
|
17
|
-
detailsRef: React.RefObject<HTMLDetailsElement>;
|
|
18
|
-
summaryRef: React.RefObject<HTMLButtonElement>;
|
|
19
|
-
contentRef: React.RefObject<HTMLDivElement>;
|
|
20
|
-
onSummaryClick: React.MouseEventHandler<HTMLElement>;
|
|
21
|
-
};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{useRef as e,useState as r,useEffect as t}from"react";const n=({onOpenChange:n,isExpanded:c})=>{const u=e(null),a=e(null),s=e(null),i=e(null),[o,f]=r(!1),[l,h]=r(!1);t(()=>{p(c)},[c]);const p=e=>{u.current&&a.current&&(u.current.open=e,i.current=null,f(!1),h(!1),u.current.style.overflow="",u.current.style.height="")};return{detailsRef:u,summaryRef:a,contentRef:s,onSummaryClick:e=>{e.preventDefault(),u.current&&a.current&&(u.current.style.overflow="hidden",o||!u.current.open?(e=>{u.current&&a.current&&(u.current.style.height=`${u.current.offsetHeight}px`,u.current.open=!0,requestAnimationFrame(()=>{if(u.current&&a.current&&s.current){h(!0),n(!0,e);const r=u.current.offsetHeight,t=a.current.offsetHeight+s.current.offsetHeight;i.current&&i.current.cancel(),u.current.animate&&(i.current=u.current.animate({height:[`${r}px`,`${t}px`]},{duration:150,easing:"ease"}),i.current.onfinish=()=>p(!0),i.current.oncancel=()=>h(!1))}}))})(e):(l||u.current.open)&&(e=>{if(u.current&&a.current){f(!0),n(!1,e);const r=u.current.offsetHeight,t=a.current.offsetHeight;i.current&&i.current.cancel(),u.current.animate&&(i.current=u.current.animate({height:[`${r}px`,`${t}px`]},{duration:150,easing:"ease"}),i.current.onfinish=()=>p(!1),i.current.oncancel=()=>f(!1))}})(e))}}};export{n as useAnimatedDetails};
|
|
2
|
-
//# sourceMappingURL=useAnimatedDetails.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAnimatedDetails.js","sources":["../../../../src/hooks/useAnimatedDetails/useAnimatedDetails.ts"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\n\n/**\n * Lar deg animere et HTML details element med en summary trigger og noe innhold.\n * HTML strukturen din bør se ut som omtrent\n * <details ref={detailsRef}>\n * <summary ref={summaryRef} onClick={onSummaryClick}>Trigger for å åpne</summary>\n * <div ref={contentRef}>Ekspanderbart innhold</div>\n * </details>\n *\n * @param onOpenChange Callback med informasjon om når elementet åpner/lukker seg.\n * @param isExpanded Styr åpning/lukking utenfra.\n * @deprecated Bruk heller `useAnimatedHeightBetween` eller lignende på selve innholdet\n */\nexport const useAnimatedDetails = ({\n onOpenChange,\n isExpanded,\n}: {\n onOpenChange: (open: boolean, e: React.MouseEvent<HTMLElement>) => void;\n isExpanded: boolean;\n}): {\n detailsRef: React.RefObject<HTMLDetailsElement>;\n summaryRef: React.RefObject<HTMLButtonElement>;\n contentRef: React.RefObject<HTMLDivElement>;\n onSummaryClick: React.MouseEventHandler<HTMLElement>;\n} => {\n const detailsRef = useRef<HTMLDetailsElement>(null);\n const summaryRef = useRef<HTMLButtonElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const animation = useRef<Animation | null>(null);\n\n const [isClosing, setIsClosing] = useState(false);\n const [isExpanding, setIsExpanding] = useState(false);\n\n useEffect(() => {\n onAnimationFinish(isExpanded);\n }, [isExpanded]);\n\n const onAnimationFinish = (open: boolean) => {\n if (detailsRef.current && summaryRef.current) {\n detailsRef.current.open = open;\n animation.current = null;\n setIsClosing(false);\n setIsExpanding(false);\n detailsRef.current.style.overflow = \"\";\n detailsRef.current.style.height = \"\";\n }\n };\n\n const open = (e: React.MouseEvent<HTMLElement>) => {\n if (detailsRef.current && summaryRef.current) {\n detailsRef.current.style.height = `${detailsRef.current.offsetHeight}px`;\n detailsRef.current.open = true;\n requestAnimationFrame(() => {\n if (\n detailsRef.current &&\n summaryRef.current &&\n contentRef.current\n ) {\n setIsExpanding(true);\n onOpenChange(true, e);\n const startHeight = detailsRef.current.offsetHeight;\n const endHeight =\n summaryRef.current.offsetHeight +\n contentRef.current.offsetHeight;\n\n if (animation.current) {\n animation.current.cancel();\n }\n\n if (detailsRef.current.animate) {\n animation.current = detailsRef.current.animate(\n {\n height: [`${startHeight}px`, `${endHeight}px`],\n },\n {\n duration: 150,\n easing: \"ease\",\n },\n );\n animation.current.onfinish = () =>\n onAnimationFinish(true);\n animation.current.oncancel = () =>\n setIsExpanding(false);\n }\n }\n });\n }\n };\n\n const close = (e: React.MouseEvent<HTMLElement>) => {\n if (detailsRef.current && summaryRef.current) {\n setIsClosing(true);\n onOpenChange(false, e);\n const startHeight = detailsRef.current.offsetHeight;\n const endHeight = summaryRef.current.offsetHeight;\n if (animation.current) {\n animation.current.cancel();\n }\n\n if (detailsRef.current.animate) {\n animation.current = detailsRef.current.animate(\n {\n height: [`${startHeight}px`, `${endHeight}px`],\n },\n {\n duration: 150,\n easing: \"ease\",\n },\n );\n animation.current.onfinish = () => onAnimationFinish(false);\n animation.current.oncancel = () => setIsClosing(false);\n }\n }\n };\n\n const onSummaryClick = (e: React.MouseEvent<HTMLElement>) => {\n e.preventDefault();\n if (detailsRef.current && summaryRef.current) {\n detailsRef.current.style.overflow = \"hidden\";\n if (isClosing || !detailsRef.current.open) {\n open(e);\n } else if (isExpanding || detailsRef.current.open) {\n close(e);\n }\n }\n };\n\n return { detailsRef, summaryRef, contentRef, onSummaryClick };\n};\n"],"names":["useAnimatedDetails","onOpenChange","isExpanded","detailsRef","useRef","summaryRef","contentRef","animation","isClosing","setIsClosing","useState","isExpanding","setIsExpanding","useEffect","onAnimationFinish","open","current","style","overflow","height","onSummaryClick","e","preventDefault","offsetHeight","requestAnimationFrame","startHeight","endHeight","cancel","animate","duration","easing","onfinish","oncancel","close"],"mappings":"4DAcO,MAAMA,EAAqB,EAC9BC,aAAAA,EACAC,WAAAA,MAUA,MAAMC,EAAaC,EAA2B,MACxCC,EAAaD,EAA0B,MACvCE,EAAaF,EAAuB,MACpCG,EAAYH,EAAyB,OAEpCI,EAAWC,GAAgBC,GAAS,IACpCC,EAAaC,GAAkBF,GAAS,GAE/CG,EAAU,KACNC,EAAkBZ,IACnB,CAACA,IAEJ,MAAMY,EAAqBC,IACnBZ,EAAWa,SAAWX,EAAWW,UACjCb,EAAWa,QAAQD,KAAOA,EAC1BR,EAAUS,QAAU,KACpBP,GAAa,GACbG,GAAe,GACfT,EAAWa,QAAQC,MAAMC,SAAW,GACpCf,EAAWa,QAAQC,MAAME,OAAS,KAmF1C,MAAO,CAAEhB,WAAAA,EAAYE,WAAAA,EAAYC,WAAAA,EAAYc,eAZrBC,IACpBA,EAAEC,iBACEnB,EAAWa,SAAWX,EAAWW,UACjCb,EAAWa,QAAQC,MAAMC,SAAW,SAChCV,IAAcL,EAAWa,QAAQD,KAvEhC,CAACM,IACNlB,EAAWa,SAAWX,EAAWW,UACjCb,EAAWa,QAAQC,MAAME,OAAS,GAAGhB,EAAWa,QAAQO,iBACxDpB,EAAWa,QAAQD,MAAO,EAC1BS,sBAAsB,KAClB,GACIrB,EAAWa,SACXX,EAAWW,SACXV,EAAWU,QACb,CACEJ,GAAe,GACfX,GAAa,EAAMoB,GACnB,MAAMI,EAActB,EAAWa,QAAQO,aACjCG,EACFrB,EAAWW,QAAQO,aACnBjB,EAAWU,QAAQO,aAEnBhB,EAAUS,SACVT,EAAUS,QAAQW,SAGlBxB,EAAWa,QAAQY,UACnBrB,EAAUS,QAAUb,EAAWa,QAAQY,QACnC,CACIT,OAAQ,CAAC,GAAGM,MAAiB,GAAGC,QAEpC,CACIG,SAAU,IACVC,OAAQ,SAGhBvB,EAAUS,QAAQe,SAAW,IACzBjB,GAAkB,GACtBP,EAAUS,QAAQgB,SAAW,IACzBpB,GAAe,GAE3B,MAoCAG,CAAKM,IACEV,GAAeR,EAAWa,QAAQD,OAhCvC,CAACM,IACX,GAAIlB,EAAWa,SAAWX,EAAWW,QAAS,CAC1CP,GAAa,GACbR,GAAa,EAAOoB,GACpB,MAAMI,EAActB,EAAWa,QAAQO,aACjCG,EAAYrB,EAAWW,QAAQO,aACjChB,EAAUS,SACVT,EAAUS,QAAQW,SAGlBxB,EAAWa,QAAQY,UACnBrB,EAAUS,QAAUb,EAAWa,QAAQY,QACnC,CACIT,OAAQ,CAAC,GAAGM,MAAiB,GAAGC,QAEpC,CACIG,SAAU,IACVC,OAAQ,SAGhBvB,EAAUS,QAAQe,SAAW,IAAMjB,GAAkB,GACrDP,EAAUS,QAAQgB,SAAW,IAAMvB,GAAa,GAExD,GAUQwB,CAAMZ"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const DOGID_REGEX: RegExp;
|
|
2
|
-
/**
|
|
3
|
-
* Validerer at verdien er et gyldig norsk ID-nummer for hund.
|
|
4
|
-
* @deprecated This only validates norwegian id-tags, that is probably more restrictive than you want
|
|
5
|
-
* expect this function to change, use carefully
|
|
6
|
-
*/
|
|
7
|
-
export declare const isValidDogId: (value: string) => boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isValidDogId.js","sources":["../../../../../src/utilities/validators/isValidDogId/isValidDogId.ts"],"sourcesContent":["export const DOGID_REGEX = /^5780[0-9]{11}$/;\n\n/**\n * Validerer at verdien er et gyldig norsk ID-nummer for hund.\n * @deprecated This only validates norwegian id-tags, that is probably more restrictive than you want\n * expect this function to change, use carefully\n */\nexport const isValidDogId = (value: string): boolean => DOGID_REGEX.test(value);\n"],"names":["DOGID_REGEX","isValidDogId","value","test"],"mappings":"AAAO,MAAMA,EAAc,kBAOdC,EAAgBC,GAA2BF,EAAYG,KAAKD"}
|
package/build/utils-C5AH4j8B.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{g as t}from"./_commonjsHelpers-CXUWDbkB.js";import"react";import{parseDateString as e}from"./es/components/datepicker/utils.js";var n,r={exports:{}};const s=t((n||(n=1,r.exports=function(){var t=1e3,e=6e4,n=36e5,r="millisecond",s="second",a="minute",i="hour",u="day",o="week",c="month",f="quarter",h="year",l="date",d="Invalid Date",D=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,m={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},$=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},g={s:$,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),s=n%60;return(e<=0?"+":"-")+$(r,2,"0")+":"+$(s,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),s=e.clone().add(r,c),a=n-s<0,i=e.clone().add(r+(a?-1:1),c);return+(-(r+(n-s)/(a?s-i:i-s))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:c,y:h,w:o,d:u,D:l,h:i,m:a,s:s,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},M="en",p={};p[M]=m;var O="$isDayjsObject",v=function(t){return t instanceof b||!(!t||!t[O])},w=function t(e,n,r){var s;if(!e)return M;if("string"==typeof e){var a=e.toLowerCase();p[a]&&(s=a),n&&(p[a]=n,s=a);var i=e.split("-");if(!s&&i.length>1)return t(i[0])}else{var u=e.name;p[u]=e,s=u}return!r&&s&&(M=s),s||!r&&M},S=function(t,e){if(v(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new b(n)},Y=g;Y.l=w,Y.i=v,Y.w=function(t,e){return S(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var b=function(){function m(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[O]=!0}var $=m.prototype;return $.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(Y.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(D);if(r){var s=r[2]-1||0,a=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(e)}(t),this.init()},$.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},$.$utils=function(){return Y},$.isValid=function(){return this.$d.toString()!==d},$.isSame=function(t,e){var n=S(t);return this.startOf(e)<=n&&n<=this.endOf(e)},$.isAfter=function(t,e){return S(t)<this.startOf(e)},$.isBefore=function(t,e){return this.endOf(e)<S(t)},$.$g=function(t,e,n){return Y.u(t)?this[e]:this.set(n,t)},$.unix=function(){return Math.floor(this.valueOf()/1e3)},$.valueOf=function(){return this.$d.getTime()},$.startOf=function(t,e){var n=this,r=!!Y.u(e)||e,f=Y.p(t),d=function(t,e){var s=Y.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?s:s.endOf(u)},D=function(t,e){return Y.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,m=this.$M,$=this.$D,g="set"+(this.$u?"UTC":"");switch(f){case h:return r?d(1,0):d(31,11);case c:return r?d(1,m):d(0,m+1);case o:var M=this.$locale().weekStart||0,p=(y<M?y+7:y)-M;return d(r?$-p:$+(6-p),m);case u:case l:return D(g+"Hours",0);case i:return D(g+"Minutes",1);case a:return D(g+"Seconds",2);case s:return D(g+"Milliseconds",3);default:return this.clone()}},$.endOf=function(t){return this.startOf(t,!1)},$.$set=function(t,e){var n,o=Y.p(t),f="set"+(this.$u?"UTC":""),d=(n={},n[u]=f+"Date",n[l]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[i]=f+"Hours",n[a]=f+"Minutes",n[s]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],D=o===u?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(l,1);y.$d[d](D),y.init(),this.$d=y.set(l,Math.min(this.$D,y.daysInMonth())).$d}else d&&this.$d[d](D);return this.init(),this},$.set=function(t,e){return this.clone().$set(t,e)},$.get=function(t){return this[Y.p(t)]()},$.add=function(r,f){var l,d=this;r=Number(r);var D=Y.p(f),y=function(t){var e=S(d);return Y.w(e.date(e.date()+Math.round(t*r)),d)};if(D===c)return this.set(c,this.$M+r);if(D===h)return this.set(h,this.$y+r);if(D===u)return y(1);if(D===o)return y(7);var m=(l={},l[a]=e,l[i]=n,l[s]=t,l)[D]||1,$=this.$d.getTime()+r*m;return Y.w($,this)},$.subtract=function(t,e){return this.add(-1*t,e)},$.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||d;var r=t||"YYYY-MM-DDTHH:mm:ssZ",s=Y.z(this),a=this.$H,i=this.$m,u=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,s,a){return t&&(t[n]||t(e,r))||s[n].slice(0,a)},l=function(t){return Y.s(a%12||12,t,"0")},D=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return Y.s(e.$y,4,"0");case"M":return u+1;case"MM":return Y.s(u+1,2,"0");case"MMM":return h(n.monthsShort,u,c,3);case"MMMM":return h(c,u);case"D":return e.$D;case"DD":return Y.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(a);case"HH":return Y.s(a,2,"0");case"h":return l(1);case"hh":return l(2);case"a":return D(a,i,!0);case"A":return D(a,i,!1);case"m":return String(i);case"mm":return Y.s(i,2,"0");case"s":return String(e.$s);case"ss":return Y.s(e.$s,2,"0");case"SSS":return Y.s(e.$ms,3,"0");case"Z":return s}return null}(t)||s.replace(":","")})},$.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},$.diff=function(r,l,d){var D,y=this,m=Y.p(l),$=S(r),g=($.utcOffset()-this.utcOffset())*e,M=this-$,p=function(){return Y.m(y,$)};switch(m){case h:D=p()/12;break;case c:D=p();break;case f:D=p()/3;break;case o:D=(M-g)/6048e5;break;case u:D=(M-g)/864e5;break;case i:D=M/n;break;case a:D=M/e;break;case s:D=M/t;break;default:D=M}return d?D:Y.a(D)},$.daysInMonth=function(){return this.endOf(c).$D},$.$locale=function(){return p[this.$L]},$.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},$.clone=function(){return Y.w(this.$d,this)},$.toDate=function(){return new Date(this.valueOf())},$.toJSON=function(){return this.isValid()?this.toISOString():null},$.toISOString=function(){return this.$d.toISOString()},$.toString=function(){return this.$d.toUTCString()},m}(),x=b.prototype;return S.prototype=x,[["$ms",r],["$s",s],["$m",a],["$H",i],["$W",u],["$M",c],["$y",h],["$D",l]].forEach(function(t){x[t[1]]=function(e){return this.$g(e,t[0],t[1])}}),S.extend=function(t,e){return t.$i||(t(e,b,S),t.$i=!0),S},S.locale=w,S.isDayjs=v,S.unix=function(t){return S(1e3*t)},S.en=p[M],S.Ls=p,S.p={},S}()),r.exports));function a(...t){return e=>t.some(t=>(t?.(e),e.defaultPrevented))}function i({calendars:t,offset:e,minDate:n}){if(e>1&&n){const{firstDayOfMonth:r}=t[0],a=s(n).diff(r,"months");a<e&&(e=a)}return e}const u=3;function o(t,e,n,r){if(e&&e.getFullYear()>t)return[e.getFullYear().toString()];if(n&&n.getFullYear()<t)return[n.getFullYear().toString()];let s,a,i=!1;"all"===r?(i=!0,s=3,a=3):(s="number"==typeof r?r:r.previous,a="number"==typeof r?r:r.coming);let u=t-s;if(e){const t=i?e.getFullYear():u;u=Math.max(e.getFullYear(),t)}let o=t+a;if(n){const t=i?n.getFullYear():o;o=Math.min(n.getFullYear(),t)}const c=Math.max(o-u+1,1);return[...Array(c).keys()].map(t=>t+u).map(t=>t.toString())}function c(t,e,n,r){const s=n?.getFullYear()||t,a=void 0===n?.getMonth()?0:n.getMonth(),i=r?.getFullYear()||t,u=void 0===r?.getMonth()?11:r.getMonth();let o=0,c=11;return s===t&&(o=a),i===t&&(c=u),e.map((t,e)=>({value:e.toString(),label:t})).filter(({value:t})=>Number.parseInt(t)>=o&&Number.parseInt(t)<=c)}function f({calendars:t,offset:e,maxDate:n}){if(e>1&&n){const{lastDayOfMonth:r}=t[t.length-1],a=s(n).diff(r,"months");a<e&&(e=a)}return e}function h({calendars:t,minDate:e}){return!!e&&s(t[0].firstDayOfMonth).subtract(1,"day").isBefore(e)}function l({calendars:t,maxDate:e}){return!!e&&s(t.at(-1)?.lastDayOfMonth).add(1,"day").isAfter(e)}function d({date:t,selected:e,monthsToDisplay:n,offset:r,minDate:a,maxDate:i,firstDayOfWeek:u,showOutsideDays:o}){const c=[],f=function(t,e,n){let r=s(t).startOf("day");if(e){const t=s(e).startOf("day");r.isBefore(t)&&(r=t)}if(n){const t=s(n).startOf("day");r.isAfter(t)&&(r=t)}return r.toDate()}(t,a,i);for(let t=0;t<n;t++){const n=D({month:f.getMonth()+t+r,year:f.getFullYear(),selectedDates:e,minDate:a,maxDate:i,firstDayOfWeek:u,showOutsideDays:o});c.push(n)}return c}function D({month:t,year:e,selectedDates:n,minDate:r,maxDate:a,firstDayOfWeek:i,showOutsideDays:u}){const o=function(t,e){const n=new Date(e,t,1),r=n.getMonth(),s=n.getFullYear();return{daysInMonth:32-new Date(s,r,32).getDate(),month:r,year:s}}(t,e),c=o.daysInMonth;t=o.month,e=o.year;const f=[];for(let i=1;i<=c;i++){const u=new Date(e,t,i),o={date:u,selected:y(n,u),selectable:m(r,a,u),today:s().isSame(u,"day"),prevMonth:!1,nextMonth:!1};f.push(o)}const h=new Date(e,t,1),l=new Date(e,t,c),d=function({firstDayOfMonth:t,minDate:e,maxDate:n,selectedDates:r,firstDayOfWeek:a,showOutsideDays:i}){const u=[];let o=(t.getDay()+7-a)%7;if(i){const a=s(t).subtract(1,"day"),i=a.date(),c=a.month(),f=a.year();let h=0;for(;h<o;){const t=new Date(f,c,i-h),s={date:t,selected:y(r,t),selectable:m(e,n,t),today:!1,prevMonth:!0,nextMonth:!1};u.unshift(s),h++}}else for(;o>0;)u.unshift(""),o--;return u}({firstDayOfMonth:h,minDate:r,maxDate:a,selectedDates:n,firstDayOfWeek:i,showOutsideDays:u}),D=function({lastDayOfMonth:t,minDate:e,maxDate:n,selectedDates:r,firstDayOfWeek:a,showOutsideDays:i}){const u=[];let o=(t.getDay()+7-a)%7;if(i){const a=s(t).add(1,"day"),i=a.month(),c=a.year();let f=0;for(;f<6-o;){const t=new Date(c,i,1+f),s={date:t,selected:y(r,t),selectable:m(e,n,t),today:!1,prevMonth:!1,nextMonth:!0};u.push(s),f++}}else for(;o<6;)u.push(""),o++;return u}({lastDayOfMonth:l,minDate:r,maxDate:a,selectedDates:n,firstDayOfWeek:i,showOutsideDays:u});f.unshift(...d),f.push(...D);const $=function(t){const e=Math.ceil(t.length/7),n=[];for(let r=0;r<e;r++){n[r]=[];for(let e=0;e<7;e++)n[r].push(t[7*r+e])}return n}(f);return{firstDayOfMonth:h,lastDayOfMonth:l,month:t,year:e,weeks:$}}function y(t,e){return!!t&&(Array.isArray(t)?t:[t]).some(t=>t instanceof Date&&s(t).startOf("day").valueOf()===s(e).startOf("day").valueOf())}function m(t,e,n){return!(t&&s(n).isBefore(t)||e&&s(n).isAfter(e))}function $(t,e){return t.getDate()===e.getDate()&&t.getMonth()===e.getMonth()&&t.getFullYear()===e.getFullYear()}function g(t,e){return!t||!$(t,e)}function M(t,e,n){return!!(n&&t>n||e&&t<e)}function p(t,n,r,s){const a=e(t),i=e(n);return a?M(a,r,s)?null:a:i?M(i,r,s)?null:i:null}function O(t,e,n,r){let s=t||e||new Date;return n&&(s=n>s?n:s),r&&(s=r<s?r:s),s}export{u as D,O as a,l as b,f as c,s as d,o as e,c as f,p as g,d as h,h as i,a as j,g as k,M as l,$ as m,i as s};
|
|
2
|
-
//# sourceMappingURL=utils-C5AH4j8B.js.map
|