@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,167 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { ValuePair } from '../../../utilities/valuePair.cjs';
|
|
3
|
-
import { YearsToShow } from '../types.cjs';
|
|
4
|
-
export declare function composeEventHandlers(...fns: Array<React.MouseEventHandler | undefined>): (event: React.MouseEvent) => boolean;
|
|
5
|
-
/**
|
|
6
|
-
* Takes a calendars array and figures out the number of months to subtract
|
|
7
|
-
* based on the current offset and the minDate allowed.
|
|
8
|
-
* @param {Object} param The param object
|
|
9
|
-
* @param {Array} param.calendars The calendars array created by the getCalendars function
|
|
10
|
-
* @param {Number} param.offset The num of months to be subtracted
|
|
11
|
-
* @param {Date} param.minDate The earliest date we are allow to subtract back to
|
|
12
|
-
* @returns {Number} The number of months to subtract
|
|
13
|
-
*/
|
|
14
|
-
export declare function subtractMonth({ calendars, offset, minDate, }: {
|
|
15
|
-
calendars: CalendarMonth[];
|
|
16
|
-
offset: number;
|
|
17
|
-
minDate?: Date;
|
|
18
|
-
}): number;
|
|
19
|
-
export declare const DEFAULT_YEARS_TO_SHOW = 3;
|
|
20
|
-
/**
|
|
21
|
-
* Generates an array of year strings for a year selector component, with min and max dates taken into account.
|
|
22
|
-
*
|
|
23
|
-
* @param {number} currentYear - The current year to center the list around
|
|
24
|
-
* @param {Date | undefined} [minDate] - The minimum date to include in the list of years
|
|
25
|
-
* @param {Date | undefined} [maxDate] - The maximum date to include in the list of years
|
|
26
|
-
*
|
|
27
|
-
* @returns {string[]} - An array of year strings, starting from the earliest year specified by minDate or currentYear - 3, and ending at the latest year specified by maxDate or currentYear + 3
|
|
28
|
-
*/
|
|
29
|
-
export declare function getYearSelectOptions(currentYear: number, minDate: Date | undefined, maxDate: Date | undefined, yearsToShow: YearsToShow): string[];
|
|
30
|
-
/**
|
|
31
|
-
* Returns an array of months that are allowed for selection in the current year based on the minimum and maximum dates.
|
|
32
|
-
* @param {number} currentYear The current year
|
|
33
|
-
* @param {string[]} monthNames An array of strings representing the month names
|
|
34
|
-
* @param {Date | undefined} minDate The minimum date that is allowed for selection
|
|
35
|
-
* @param {Date | undefined} maxDate The maximum date that is allowed for selection
|
|
36
|
-
* @returns {ValuePair[]} An array of ValuePairs representing the months that are allowed for selection in the current year
|
|
37
|
-
*/
|
|
38
|
-
export declare function getMonthSelectOptions(currentYear: number, monthNames: string[], minDate: Date | undefined, maxDate: Date | undefined): ValuePair[];
|
|
39
|
-
/**s
|
|
40
|
-
* Takes a calendars array and figures out the number of months to add
|
|
41
|
-
* based on the current offset and the maxDate allowed.
|
|
42
|
-
* @param {Object} param The param object
|
|
43
|
-
* @param {Array} param.calendars The calendars array created by the getCalendars function
|
|
44
|
-
* @param {Number} param.offset The num of months to be added
|
|
45
|
-
* @param {Date} param.maxDate The furthest date we are allow to add forward to
|
|
46
|
-
* @returns {Number} The number of months to add
|
|
47
|
-
*/
|
|
48
|
-
export declare function addMonth({ calendars, offset, maxDate, }: {
|
|
49
|
-
calendars: CalendarMonth[];
|
|
50
|
-
offset: number;
|
|
51
|
-
maxDate?: Date;
|
|
52
|
-
}): number;
|
|
53
|
-
/**
|
|
54
|
-
* Takes a calendars array and figures out if the back button should be
|
|
55
|
-
* disabled based on the minDate allowed.
|
|
56
|
-
* @param {Object} param The param object
|
|
57
|
-
* @param {Array} param.calendars The calendars array created by the getCalendars function
|
|
58
|
-
* @param {Date} param.minDate The earliest date available
|
|
59
|
-
* @returns {Boolean} Whether the back button should be disabled.
|
|
60
|
-
*/
|
|
61
|
-
export declare function isBackDisabled({ calendars, minDate, }: {
|
|
62
|
-
calendars: CalendarMonth[];
|
|
63
|
-
minDate?: Date;
|
|
64
|
-
}): boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Takes a calendars array and figures out if the forward button should be
|
|
67
|
-
* disabled based on the maxDate allowed.
|
|
68
|
-
* @param {Object} param The param object
|
|
69
|
-
* @param {Array} param.calendars The calendars array created by the getCalendars function
|
|
70
|
-
* @param {Date} param.maxDate The furthest date available
|
|
71
|
-
* @returns {Boolean} Whether the forward button should be disabled.
|
|
72
|
-
*/
|
|
73
|
-
export declare function isForwardDisabled({ calendars, maxDate, }: {
|
|
74
|
-
calendars: CalendarMonth[];
|
|
75
|
-
maxDate?: Date;
|
|
76
|
-
}): boolean;
|
|
77
|
-
type GetCalendarProps = {
|
|
78
|
-
/** The date to start the calendar at */
|
|
79
|
-
date: Date;
|
|
80
|
-
/** Date or dates currently selected. */
|
|
81
|
-
selected?: Date | Date[];
|
|
82
|
-
/** The earliest date available */
|
|
83
|
-
minDate?: Date;
|
|
84
|
-
/** The earliest date available */
|
|
85
|
-
maxDate?: Date;
|
|
86
|
-
/** The number of months to return in the calendar view */
|
|
87
|
-
monthsToDisplay: number;
|
|
88
|
-
/** The number of months to offset based off the param.date given */
|
|
89
|
-
offset: number;
|
|
90
|
-
/** First day of week, 0-6 (Sunday to Saturday) */
|
|
91
|
-
firstDayOfWeek: number;
|
|
92
|
-
/** Flag to fill front and back weeks with dates from adjacent months */
|
|
93
|
-
showOutsideDays: boolean;
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* Figures out the months data needed based off the number of monthsToDisplay
|
|
97
|
-
* and other options provided.
|
|
98
|
-
* @param {Object} param The param object
|
|
99
|
-
* @param {Date} param.date The date to start the calendar at
|
|
100
|
-
* @param {Array.<Date>} param.selected An array of dates currently selected
|
|
101
|
-
* @param {Number} param.monthsToDisplay The number of months to return in the calendar view
|
|
102
|
-
* @param {Number} param.offset The number of months to offset based off the param.date given
|
|
103
|
-
* @param {Date} param.minDate The earliest date available
|
|
104
|
-
* @param {Date} param.maxDate The furthest date available
|
|
105
|
-
* @param {Number} param.firstDayOfWeek First day of week, 0-6 (Sunday to Saturday)
|
|
106
|
-
* @param {Bool} param.showOutsideDays Flag to fill front and back weeks with dates from adjacent months
|
|
107
|
-
* @returns {Array.<Object>} An array of objects with month data
|
|
108
|
-
*/
|
|
109
|
-
export declare function getCalendars({ date, selected, monthsToDisplay, offset, minDate, maxDate, firstDayOfWeek, showOutsideDays, }: GetCalendarProps): CalendarMonth[];
|
|
110
|
-
export type CalendarMonth = {
|
|
111
|
-
firstDayOfMonth: Date;
|
|
112
|
-
lastDayOfMonth: Date;
|
|
113
|
-
month: number;
|
|
114
|
-
year: number;
|
|
115
|
-
weeks: CalendarWeek[];
|
|
116
|
-
};
|
|
117
|
-
export type CalendarWeek = CalendarDay[];
|
|
118
|
-
export type CalendarDay = DateInfo | string;
|
|
119
|
-
export type DateInfo = {
|
|
120
|
-
date: Date;
|
|
121
|
-
selected: boolean;
|
|
122
|
-
selectable: boolean;
|
|
123
|
-
today: boolean;
|
|
124
|
-
prevMonth: boolean;
|
|
125
|
-
nextMonth: boolean;
|
|
126
|
-
};
|
|
127
|
-
/**
|
|
128
|
-
* Check if two Date objects represent the same day
|
|
129
|
-
*
|
|
130
|
-
* @param date1 first Date to compare
|
|
131
|
-
* @param date2 second Date to compare
|
|
132
|
-
*/
|
|
133
|
-
export declare function isSameDay(date1: Date, date2: Date): boolean;
|
|
134
|
-
/**
|
|
135
|
-
* Check if the date has changed from the previous date
|
|
136
|
-
*
|
|
137
|
-
* @param date First date to compare
|
|
138
|
-
* @param newDate Second date to compare
|
|
139
|
-
*/
|
|
140
|
-
export declare function dateHasChanged(date: Date | undefined, newDate: Date): boolean;
|
|
141
|
-
/**
|
|
142
|
-
* Check if a given date is outside a given range
|
|
143
|
-
*
|
|
144
|
-
* @param date Input date
|
|
145
|
-
* @param rangeStart Dates before this date should be disabled
|
|
146
|
-
* @param rangeEnd Dates after this date should be disabled
|
|
147
|
-
*/
|
|
148
|
-
export declare function dateIsOutsideRange(date: Date, rangeStart: Date | undefined, rangeEnd: Date | undefined): boolean;
|
|
149
|
-
/**
|
|
150
|
-
* Get the correct initial date for initiating the datepicker reducer store
|
|
151
|
-
*
|
|
152
|
-
* @param value Value from props
|
|
153
|
-
* @param initialDate Initial date from porps
|
|
154
|
-
* @param disableDate Function for checking whether the date should be disabled
|
|
155
|
-
*/
|
|
156
|
-
export declare function getInitialDate(value: string | undefined, defaultValue: string | undefined, minDate: Date | undefined, maxDate: Date | undefined): Date | null;
|
|
157
|
-
/**
|
|
158
|
-
* Get the initial date to show in the calendar
|
|
159
|
-
*
|
|
160
|
-
* @param date The date set in the DatePicker (from props)
|
|
161
|
-
* @param defaultSelected The defaultSelected prop from DatePicker
|
|
162
|
-
* @param minDate The earliest selectable date, from props
|
|
163
|
-
* @param maxDate The latest selectable date, from props
|
|
164
|
-
* @returns The date to show in the calendar
|
|
165
|
-
*/
|
|
166
|
-
export declare function getInitialDateShown(date: Date | null, defaultSelected: Date | undefined, minDate: Date | undefined, maxDate: Date | undefined): Date;
|
|
167
|
-
export {};
|
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
import { ButtonHTMLAttributes, ChangeEvent, ComponentProps, FocusEvent, KeyboardEvent } from 'react';
|
|
2
|
-
import { DataTestAutoId } from '../../utilities/types.cjs';
|
|
3
|
-
import { InputGroupProps, LabelProps } from '../input-group/types.cjs';
|
|
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,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=/^(\d\d?)[\W](\d\d?)[\W](\d{4}|\d{2})$/,t=/^(\d{4}|\d{2})[\W](\d\d?)[\W](\d\d?)$/;exports.formatInput=function(e){return`${`${e.getDate()}`.padStart(2,"0")}.${`${e.getMonth()+1}`.padStart(2,"0")}.${e.getFullYear()}`},exports.isBlurTargetOutside=function(e){if(!e.relatedTarget)return!0;const t=e.target.closest(".jkl-datepicker__input-wrapper");return e.relatedTarget.closest(".jkl-datepicker__input-wrapper")!==t},exports.parseDateString=function(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 o=a.slice(1,4);return o.reverse(),o})(r);if(!n)return;const a=Number.parseInt((new Date).toLocaleString("no-NB",{year:"2-digit"})),o=Number.parseInt(n[0],10),s=Number.parseInt(n[1],10)-1,u=Number.parseInt(n[2],10),i=u>99?u:(c=u)>a?c+1900:c+2e3,d=new Date(i,s,o,0,0,0);var c;return d.getMonth()===s&&d.getFullYear()===i?d:void 0};
|
|
2
|
-
//# sourceMappingURL=utils.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","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","date","getDate","padStart","getMonth","getFullYear","e","relatedTarget","targetRoot","target","closest","dateString","inputDateSegments","input","dayMonthYear","exec","slice","yearMonthDay","slicedDateSegments","reverse","getDateSegmentsFromString","currentTwoDigitYear","Number","parseInt","Date","toLocaleString","year","day","month","yearIn","generatedDate"],"mappings":"gFAEA,MAAMA,EAAoB,wCACpBC,EAAoB,4DAQnB,SAAqBC,GAGxB,MAAO,GAFK,GAAGA,EAAKC,YAAYC,SAAS,EAAG,QAC9B,GAAGF,EAAKG,WAAa,IAAID,SAAS,EAAG,QACzBF,EAAKI,eACnC,8BAsEO,SACHC,GAEA,IAAKA,EAAEC,cACH,OAAO,EAGX,MAAMC,EAAaF,EAAEG,OAAOC,QAAQ,kCAKpC,OAJ0BJ,EAAEC,cAAcG,QACtC,oCAGyBF,CACjC,0BAjDO,SAAyBG,GAC5B,IAAKA,EACD,OAGJ,MAAMC,EA/ByBC,KAC/B,MAAMC,EAAef,EAAkBgB,KAAKF,GAE5C,GAAIC,EACA,OAAOA,EAAaE,MAAM,EAAG,GAGjC,MAAMC,EAAejB,EAAkBe,KAAKF,GAE5C,IAAKI,EACD,OAIJ,MAAMC,EAAqBD,EAAaD,MAAM,EAAG,GACjD,OAAAE,EAAmBC,UAEZD,GAcmBE,CAA0BT,GAEpD,IAAKC,EACD,OAGJ,MAAMS,EAAsBC,OAAOC,UAC/B,IAAIC,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,GAR5BD,MAU3B,OAAOI,EAAc1B,aAAewB,GAChCE,EAAczB,gBAAkBqB,EAC9BI,OACA,CACV"}
|
|
@@ -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
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./utils.cjs");exports.isCorrectFormat=function(e){return!!e&&!!t.parseDateString(e)},exports.isWithinLowerBound=function(e,r,i={inclusive:!1}){const n="string"==typeof e?t.parseDateString(e):e;return!!n&&(i.inclusive?n>=r:n>r)},exports.isWithinUpperBound=function(e,r,i={inclusive:!1}){const n="string"==typeof e?t.parseDateString(e):e;return!!n&&(i.inclusive?n<=r:n<r)};
|
|
2
|
-
//# sourceMappingURL=validation.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validation.cjs","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":["value","parseDateString","minDate","options","inclusive","val","maxDate"],"mappings":"uIAGO,SAAyBA,GAC5B,QAAKA,KAGOC,EAAAA,gBAAgBD,EAEhC,6BAEO,SACHA,EACAE,EACAC,EAA6B,CAAEC,WAAW,IAE1C,MAAMC,EAAuB,iBAAVL,EAAqBC,EAAAA,gBAAgBD,GAASA,EAEjE,QAAKK,IAIDF,EAAQC,UACDC,GAAOH,EAGXG,EAAMH,EACjB,6BAEO,SACHF,EACAM,EACAH,EAA6B,CAAEC,WAAW,IAE1C,MAAMC,EAAuB,iBAAVL,EAAqBC,EAAAA,gBAAgBD,GAASA,EAEjE,QAAKK,IAIDF,EAAQC,UACDC,GAAOC,EAGXD,EAAMC,EACjB"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ComparisonOptions } from './types.cjs';
|
|
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
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("../../../clsx-E3yX_9sL.cjs"),t=require("react"),a=require("../../utilities/valuePair.cjs"),s=require("../icon/icons/animated/ArrowVerticalAnimated.cjs"),i=require("../input-group/InputGroup.cjs"),r=t.forwardRef((t,r)=>{const{"data-size":o,label:c,className:n,errorLabel:u,helpLabel:p,inline:d,invalid:j,items:m,labelProps:v,placeholder:b="Velg",selectClassName:x,supportLabelProps:_,tooltip:k,value:N,width:h,description:w,...P}=t,g={label:c,errorLabel:u,helpLabel:p,labelProps:v,inline:d,supportLabelProps:_,tooltip:k,description:w};return e.jsx(i.InputGroup,{...g,"data-testid":"jkl-select","data-size":o,className:l.clsx("jkl-select",n,{"jkl-select--inline":d,"jkl-select--invalid":!!u||j}),render:t=>e.jsxs("div",{className:"jkl-select__outer-wrapper",style:{width:h},children:[e.jsxs("select",{ref:r,className:l.clsx("jkl-select__button",x,{"jkl-select__button--active-value":!!N}),defaultValue:N?void 0:"",value:N,...t,...P,children:[b&&!N&&e.jsx("option",{disabled:!0,value:"",children:b}),m.map(a.getValuePair).map(l=>e.jsx("option",{"data-testid":"jkl-select__option",className:"jkl-select__option",value:l.value,children:l.label},l.value))]}),e.jsx(s.ArrowVerticalAnimated,{variant:"medium",pointingDown:!0,className:"jkl-select__arrow"})]})})});r.displayName="NativeSelect",exports.NativeSelect=r;
|
|
2
|
-
//# sourceMappingURL=NativeSelect.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NativeSelect.cjs","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","inputGroupProps","jsx","InputGroup","clsx","render","inputProps","jsxs","style","children","defaultValue","disabled","map","getValuePair","item","ArrowVerticalAnimated","variant","pointingDown","displayName"],"mappings":"oUAOaA,EAAeC,EAAAA,WACxB,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,EAEEmB,EAAkB,CACpBhB,MAAAA,EACAE,WAAAA,EACAC,UAAAA,EACAI,WAAAA,EACAH,OAAAA,EACAM,kBAAAA,EACAC,QAAAA,EACAG,YAAAA,GAGJ,OACIG,EAAAA,IAACC,EAAAA,WAAA,IACOF,EACJ,cAAY,aACZ,YAAWjB,EACXE,UAAWkB,EAAAA,KAAK,aAAclB,EAAW,CACrC,qBAAsBG,EACtB,wBAAyBF,GAAcG,IAE3Ce,OAASC,GACLC,EAAAA,KAAC,MAAA,CACGrB,UAAU,4BACVsB,MAAO,CAAEV,MAAAA,GAETW,SAAA,CAAAF,EAAAA,KAAC,SAAA,CACGxB,IAAAA,EACAG,UAAWkB,EAAAA,KACP,qBACAV,EACA,CACI,qCAAsCG,IAG9Ca,aAAcb,OAAQ,EAAY,GAClCA,MAAAA,KACIS,KACAN,EAEHS,SAAA,CAAAhB,IAAgBI,GACbK,EAAAA,IAAC,SAAA,CAAOS,UAAQ,EAACd,MAAM,GAClBY,SAAAhB,IAGRF,EAAMqB,IAAIC,EAAAA,cAAcD,IAAKE,GAC1BZ,EAAAA,IAAC,SAAA,CACG,cAAY,qBACZhB,UAAU,qBAEVW,MAAOiB,EAAKjB,MAEXY,SAAAK,EAAK7B,OAHD6B,EAAKjB,WAOtBK,EAAAA,IAACa,EAAAA,sBAAA,CACGC,QAAQ,SACRC,cAAY,EACZ/B,UAAU,6BAStCN,EAAasC,YAAc"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports.focusSelected=function(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},exports.toLower=function(e=""){return e.toLowerCase().replace(/[\W_]+/g,"")};
|
|
2
|
-
//# sourceMappingURL=select-utils.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"select-utils.cjs","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":["listEl","selected","focusedItem","querySelector","focus","scrollTop","offsetTop","str","toLowerCase","replace"],"mappings":"sGAIO,SACHA,EACAC,GAEA,IAAIC,EAAkC,KAClCD,IAEAC,EAAcF,EAAOG,cACjB,2CAGHF,IAAaC,KAGdA,EAAcF,EAAOG,cAAc,oBAEvCD,GAAaE,QAEbJ,EAAOK,UAAYH,GAAaI,WAAa,CACjD,kBAvBO,SAAiBC,EAAM,IAC1B,OAAOA,EAAIC,cAAcC,QAAQ,UAAW,GAChD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { ChangeEvent, SelectHTMLAttributes } from 'react';
|
|
2
|
-
import { DataTestAutoId } from '../../utilities/types.cjs';
|
|
3
|
-
import { ValuePair } from '../../utilities/valuePair.cjs';
|
|
4
|
-
import { LabelProps, InputGroupProps } from '../input-group/types.cjs';
|
|
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":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useAnimatedDetails } from './useAnimatedDetails.cjs';
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");exports.useAnimatedDetails=({onOpenChange:r,isExpanded:t})=>{const n=e.useRef(null),u=e.useRef(null),c=e.useRef(null),s=e.useRef(null),[i,o]=e.useState(!1),[a,f]=e.useState(!1);e.useEffect(()=>{l(t)},[t]);const l=e=>{n.current&&u.current&&(n.current.open=e,s.current=null,o(!1),f(!1),n.current.style.overflow="",n.current.style.height="")};return{detailsRef:n,summaryRef:u,contentRef:c,onSummaryClick:e=>{e.preventDefault(),n.current&&u.current&&(n.current.style.overflow="hidden",i||!n.current.open?(e=>{n.current&&u.current&&(n.current.style.height=`${n.current.offsetHeight}px`,n.current.open=!0,requestAnimationFrame(()=>{if(n.current&&u.current&&c.current){f(!0),r(!0,e);const t=n.current.offsetHeight,i=u.current.offsetHeight+c.current.offsetHeight;s.current&&s.current.cancel(),n.current.animate&&(s.current=n.current.animate({height:[`${t}px`,`${i}px`]},{duration:150,easing:"ease"}),s.current.onfinish=()=>l(!0),s.current.oncancel=()=>f(!1))}}))})(e):(a||n.current.open)&&(e=>{if(n.current&&u.current){o(!0),r(!1,e);const t=n.current.offsetHeight,c=u.current.offsetHeight;s.current&&s.current.cancel(),n.current.animate&&(s.current=n.current.animate({height:[`${t}px`,`${c}px`]},{duration:150,easing:"ease"}),s.current.onfinish=()=>l(!1),s.current.oncancel=()=>o(!1))}})(e))}}};
|
|
2
|
-
//# sourceMappingURL=useAnimatedDetails.cjs.map
|