@fremtind/jokul 5.0.0-next.0 → 5.0.0-next.2
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 +30 -7
- package/bin/jokul.mjs +10 -0
- package/bin/run-jokul-cli.mjs +63 -0
- package/build/build-stats.html +1 -1
- package/build/cjs/components/beta/description-list/DescriptionList.cjs +2 -0
- package/build/cjs/components/beta/description-list/DescriptionList.cjs.map +1 -0
- package/build/cjs/components/beta/description-list/DescriptionListItem.cjs +2 -0
- package/build/cjs/components/beta/description-list/DescriptionListItem.cjs.map +1 -0
- package/build/cjs/{components-beta → components/beta}/description-list/index.d.cts +2 -2
- package/build/cjs/components/beta/nav-link/NavLink.cjs +2 -0
- package/build/cjs/components/beta/nav-link/NavLink.cjs.map +1 -0
- package/build/cjs/components/beta/nav-link/index.d.cts +1 -0
- package/build/cjs/{components-beta → components/beta}/nav-link/types.d.cts +1 -1
- package/build/cjs/components/beta/select/Select.cjs +2 -0
- package/build/cjs/components/beta/select/Select.cjs.map +1 -0
- package/build/cjs/components/beta/select/index.d.cts +2 -0
- package/build/cjs/{components-beta → components/beta}/select/types.d.cts +1 -1
- package/build/cjs/components/breadcrumb/types.d.cts +1 -1
- package/build/cjs/components/card/Card.cjs +1 -1
- package/build/cjs/components/card/Card.cjs.map +1 -1
- package/build/cjs/components/card/types.cjs +1 -1
- package/build/cjs/components/card/types.cjs.map +1 -1
- package/build/cjs/components/card/types.d.cts +2 -2
- package/build/cjs/components/checkbox/Checkbox.cjs +1 -1
- package/build/cjs/components/checkbox/Checkbox.cjs.map +1 -1
- package/build/cjs/components/checkbox/types.d.cts +1 -1
- package/build/cjs/components/cookie-consent/CookieConsent.cjs +1 -1
- package/build/cjs/components/cookie-consent/CookieConsent.cjs.map +1 -1
- package/build/cjs/components/cookie-consent/CookieConsent.d.cts +1 -1
- package/build/cjs/components/cookie-consent/types.d.cts +5 -1
- package/build/cjs/components/datepicker/DatePicker.cjs +1 -1
- package/build/cjs/components/datepicker/DatePicker.cjs.map +1 -1
- package/build/cjs/components/datepicker/types.d.cts +1 -1
- package/build/cjs/components/description-list/index.cjs +1 -1
- package/build/cjs/components/description-list/index.d.cts +3 -3
- package/build/cjs/components/description-list/types.d.cts +1 -1
- package/build/cjs/components/expander/ExpandablePanel.cjs +1 -1
- package/build/cjs/components/expander/ExpandablePanel.cjs.map +1 -1
- package/build/cjs/components/feedback/feedbackContext.cjs.map +1 -1
- package/build/cjs/components/feedback/feedbackContext.d.cts +1 -1
- package/build/cjs/components/feedback/followup/followupContext.cjs.map +1 -1
- package/build/cjs/components/feedback/followup/followupContext.d.cts +1 -1
- package/build/cjs/components/feedback/main-question/mainQuestionContext.cjs.map +1 -1
- package/build/cjs/components/feedback/main-question/mainQuestionContext.d.cts +1 -1
- package/build/cjs/components/feedback/questions/smileyUtils.cjs.map +1 -1
- package/build/cjs/components/file-input/internal/Dropzone.cjs.map +1 -1
- package/build/cjs/components/file-input/internal/Dropzone.d.cts +1 -1
- package/build/cjs/components/file-input/internal/fileInputContext.cjs.map +1 -1
- package/build/cjs/components/file-input/internal/fileInputContext.d.cts +1 -1
- package/build/cjs/components/icon/development/internal/IconsExampleGrid.d.cts +1 -1
- package/build/cjs/components/input-group/InputGroup.d.cts +2 -2
- package/build/cjs/components/input-group/types.d.cts +1 -1
- package/build/cjs/components/link/Link.cjs +1 -1
- package/build/cjs/components/link/Link.cjs.map +1 -1
- package/build/cjs/components/link/Link.d.cts +2 -2
- package/build/cjs/components/link/types.d.cts +1 -4
- package/build/cjs/components/link-list/LinkList.d.cts +1 -1
- package/build/cjs/components/list/ListItem.cjs.map +1 -1
- package/build/cjs/components/list/ListItem.d.cts +1 -1
- package/build/cjs/components/logo/types.d.cts +1 -1
- package/build/cjs/components/menu/types.d.cts +1 -1
- package/build/cjs/components/modal/Modal.cjs +1 -1
- package/build/cjs/components/modal/Modal.cjs.map +1 -1
- package/build/cjs/components/modal/Modal.d.cts +2 -9
- package/build/cjs/components/modal/index.d.cts +1 -1
- package/build/cjs/components/modal/types.d.cts +19 -1
- package/build/cjs/components/nav-link/index.cjs +1 -1
- package/build/cjs/components/nav-link/index.d.cts +2 -2
- package/build/cjs/components/popover/Popover.cjs +1 -1
- package/build/cjs/components/popover/Popover.cjs.map +1 -1
- package/build/cjs/components/radio-button/BaseRadioButton.cjs +1 -1
- package/build/cjs/components/radio-button/BaseRadioButton.cjs.map +1 -1
- package/build/cjs/components/radio-button/radioGroupContext.cjs.map +1 -1
- package/build/cjs/components/radio-button/radioGroupContext.d.cts +1 -1
- package/build/cjs/components/screen-reader-only/types.d.cts +1 -1
- package/build/cjs/components/select/index.cjs +1 -1
- package/build/cjs/components/select/index.d.cts +2 -2
- package/build/cjs/components/select/types.d.cts +1 -1
- package/build/cjs/components/system-message/types.d.cts +1 -1
- package/build/cjs/components/table/types.d.cts +1 -1
- package/build/cjs/components/table-of-contents/TableOfContents.d.cts +1 -1
- package/build/cjs/components/tabs/types.d.cts +1 -1
- package/build/cjs/components/toast/types.d.cts +1 -1
- package/build/cjs/components/toggle-switch/types.d.cts +1 -1
- package/build/cjs/components/tooltip/Tooltip.cjs.map +1 -1
- package/build/cjs/components/tooltip/Tooltip.d.cts +1 -1
- package/build/cjs/hooks/useAnimatedHeight/types.d.cts +1 -1
- package/build/cjs/hooks/useAnimatedHeight/useAnimatedHeight.cjs +1 -1
- package/build/cjs/hooks/useAnimatedHeight/useAnimatedHeight.cjs.map +1 -1
- package/build/cjs/hooks/useAnimatedHeight/useAnimatedHeightBetween.cjs +1 -1
- package/build/cjs/hooks/useAnimatedHeight/useAnimatedHeightBetween.cjs.map +1 -1
- package/build/cjs/hooks/useAnimatedHeight/useAutoAnimateHeight.cjs +1 -1
- package/build/cjs/hooks/useAnimatedHeight/useAutoAnimateHeight.cjs.map +1 -1
- package/build/cjs/hooks/useAnimatedHeight/useAutoAnimateHeight.d.cts +1 -1
- package/build/cjs/hooks/useAriaLiveRegion/useAriaLiveRegion.d.cts +1 -1
- package/build/cjs/hooks/useBrowserPreferences/useBrowserPreferences.cjs.map +1 -1
- package/build/cjs/hooks/useBrowserPreferences/useBrowserPreferences.d.cts +1 -1
- package/build/cjs/hooks/useScreen/useScreen.cjs +1 -1
- package/build/cjs/hooks/useScreen/useScreen.cjs.map +1 -1
- package/build/cjs/tailwind/plugins/jokulTypographyPlugin.cjs +1 -1
- package/build/cjs/tailwind/plugins/jokulTypographyPlugin.cjs.map +1 -1
- package/build/cjs/tailwind/tailwindPreset.cjs +1 -1
- package/build/cjs/tailwind/tailwindPreset.cjs.map +1 -1
- package/build/cjs/tokens.cjs +2 -0
- package/build/cjs/tokens.cjs.map +1 -0
- package/build/cjs/tokens.d.cts +235 -0
- package/build/cjs/utilities/getThemeAndSize.cjs +1 -1
- package/build/cjs/utilities/getThemeAndSize.cjs.map +1 -1
- package/build/cjs/utilities/getThemeAndSize.d.cts +1 -1
- package/build/cjs/utilities/index.d.cts +1 -0
- package/build/cjs/{core → utilities}/types.d.cts +1 -1
- package/build/es/components/beta/description-list/DescriptionList.js +2 -0
- package/build/es/components/beta/description-list/DescriptionList.js.map +1 -0
- package/build/es/components/beta/description-list/DescriptionListItem.js +2 -0
- package/build/es/components/beta/description-list/DescriptionListItem.js.map +1 -0
- package/build/es/{components-beta → components/beta}/description-list/index.d.ts +2 -2
- package/build/es/components/beta/nav-link/NavLink.js +2 -0
- package/build/es/components/beta/nav-link/NavLink.js.map +1 -0
- package/build/es/components/beta/nav-link/index.d.ts +1 -0
- package/build/es/{components-beta → components/beta}/nav-link/types.d.ts +1 -1
- package/build/es/components/beta/select/Select.js +2 -0
- package/build/es/components/beta/select/Select.js.map +1 -0
- package/build/es/components/beta/select/index.d.ts +2 -0
- package/build/es/{components-beta → components/beta}/select/types.d.ts +1 -1
- package/build/es/components/breadcrumb/types.d.ts +1 -1
- package/build/es/components/card/Card.js +1 -1
- package/build/es/components/card/Card.js.map +1 -1
- package/build/es/components/card/types.d.ts +2 -2
- package/build/es/components/card/types.js +1 -1
- package/build/es/components/card/types.js.map +1 -1
- package/build/es/components/checkbox/Checkbox.js +1 -1
- package/build/es/components/checkbox/Checkbox.js.map +1 -1
- package/build/es/components/checkbox/types.d.ts +1 -1
- package/build/es/components/cookie-consent/CookieConsent.d.ts +1 -1
- package/build/es/components/cookie-consent/CookieConsent.js +1 -1
- package/build/es/components/cookie-consent/CookieConsent.js.map +1 -1
- package/build/es/components/cookie-consent/types.d.ts +5 -1
- package/build/es/components/datepicker/DatePicker.js +1 -1
- package/build/es/components/datepicker/DatePicker.js.map +1 -1
- package/build/es/components/datepicker/types.d.ts +1 -1
- package/build/es/components/description-list/index.d.ts +3 -3
- package/build/es/components/description-list/index.js +1 -1
- package/build/es/components/description-list/types.d.ts +1 -1
- package/build/es/components/expander/ExpandablePanel.js +1 -1
- package/build/es/components/expander/ExpandablePanel.js.map +1 -1
- package/build/es/components/feedback/feedbackContext.d.ts +1 -1
- package/build/es/components/feedback/feedbackContext.js.map +1 -1
- package/build/es/components/feedback/followup/followupContext.d.ts +1 -1
- package/build/es/components/feedback/followup/followupContext.js.map +1 -1
- package/build/es/components/feedback/main-question/mainQuestionContext.d.ts +1 -1
- package/build/es/components/feedback/main-question/mainQuestionContext.js.map +1 -1
- package/build/es/components/feedback/questions/smileyUtils.js.map +1 -1
- package/build/es/components/file-input/internal/Dropzone.d.ts +1 -1
- package/build/es/components/file-input/internal/Dropzone.js.map +1 -1
- package/build/es/components/file-input/internal/fileInputContext.d.ts +1 -1
- package/build/es/components/file-input/internal/fileInputContext.js.map +1 -1
- package/build/es/components/icon/development/internal/IconsExampleGrid.d.ts +1 -1
- package/build/es/components/input-group/InputGroup.d.ts +2 -2
- package/build/es/components/input-group/types.d.ts +1 -1
- package/build/es/components/link/Link.d.ts +2 -2
- package/build/es/components/link/Link.js +1 -1
- package/build/es/components/link/Link.js.map +1 -1
- package/build/es/components/link/types.d.ts +1 -4
- package/build/es/components/link-list/LinkList.d.ts +1 -1
- package/build/es/components/list/ListItem.d.ts +1 -1
- package/build/es/components/list/ListItem.js.map +1 -1
- package/build/es/components/logo/types.d.ts +1 -1
- package/build/es/components/menu/types.d.ts +1 -1
- package/build/es/components/modal/Modal.d.ts +2 -9
- package/build/es/components/modal/Modal.js +1 -1
- package/build/es/components/modal/Modal.js.map +1 -1
- package/build/es/components/modal/index.d.ts +1 -1
- package/build/es/components/modal/types.d.ts +19 -1
- package/build/es/components/nav-link/index.d.ts +2 -2
- package/build/es/components/nav-link/index.js +1 -1
- package/build/es/components/popover/Popover.js +1 -1
- package/build/es/components/popover/Popover.js.map +1 -1
- package/build/es/components/radio-button/BaseRadioButton.js +1 -1
- package/build/es/components/radio-button/BaseRadioButton.js.map +1 -1
- package/build/es/components/radio-button/radioGroupContext.d.ts +1 -1
- package/build/es/components/radio-button/radioGroupContext.js.map +1 -1
- package/build/es/components/screen-reader-only/types.d.ts +1 -1
- package/build/es/components/select/index.d.ts +2 -2
- package/build/es/components/select/index.js +1 -1
- package/build/es/components/select/types.d.ts +1 -1
- package/build/es/components/system-message/types.d.ts +1 -1
- package/build/es/components/table/types.d.ts +1 -1
- package/build/es/components/table-of-contents/TableOfContents.d.ts +1 -1
- package/build/es/components/tabs/types.d.ts +1 -1
- package/build/es/components/toast/types.d.ts +1 -1
- package/build/es/components/toggle-switch/types.d.ts +1 -1
- package/build/es/components/tooltip/Tooltip.d.ts +1 -1
- package/build/es/components/tooltip/Tooltip.js.map +1 -1
- package/build/es/hooks/useAnimatedHeight/types.d.ts +1 -1
- package/build/es/hooks/useAnimatedHeight/useAnimatedHeight.js +1 -1
- package/build/es/hooks/useAnimatedHeight/useAnimatedHeight.js.map +1 -1
- package/build/es/hooks/useAnimatedHeight/useAnimatedHeightBetween.js +1 -1
- package/build/es/hooks/useAnimatedHeight/useAnimatedHeightBetween.js.map +1 -1
- package/build/es/hooks/useAnimatedHeight/useAutoAnimateHeight.d.ts +1 -1
- package/build/es/hooks/useAnimatedHeight/useAutoAnimateHeight.js +1 -1
- package/build/es/hooks/useAnimatedHeight/useAutoAnimateHeight.js.map +1 -1
- package/build/es/hooks/useAriaLiveRegion/useAriaLiveRegion.d.ts +1 -1
- package/build/es/hooks/useBrowserPreferences/useBrowserPreferences.d.ts +1 -1
- package/build/es/hooks/useBrowserPreferences/useBrowserPreferences.js.map +1 -1
- package/build/es/hooks/useScreen/useScreen.js +1 -1
- package/build/es/hooks/useScreen/useScreen.js.map +1 -1
- package/build/es/tailwind/plugins/jokulTypographyPlugin.js +1 -1
- package/build/es/tailwind/plugins/jokulTypographyPlugin.js.map +1 -1
- package/build/es/tailwind/tailwindPreset.js +1 -1
- package/build/es/tailwind/tailwindPreset.js.map +1 -1
- package/build/es/tokens.d.ts +235 -0
- package/build/es/tokens.js +2 -0
- package/build/es/tokens.js.map +1 -0
- package/build/es/utilities/getThemeAndSize.d.ts +1 -1
- package/build/es/utilities/getThemeAndSize.js +1 -1
- package/build/es/utilities/getThemeAndSize.js.map +1 -1
- package/build/es/utilities/index.d.ts +1 -0
- package/build/es/{core → utilities}/types.d.ts +1 -1
- package/codemods/__tests__/import-paths.test.mjs +84 -0
- package/codemods/import-paths.mjs +393 -0
- package/package.json +12 -585
- package/styles/base.css +1822 -0
- package/styles/base.min.css +2 -0
- package/styles/components/autosuggest/autosuggest.css +6 -12
- package/styles/components/autosuggest/autosuggest.min.css +1 -1
- package/styles/components/autosuggest/autosuggest.scss +3 -3
- package/styles/{components-beta → components/beta}/description-list/description-list.css +1 -1
- package/styles/{components-beta → components/beta}/description-list/description-list.min.css +1 -1
- package/styles/{components-beta → components/beta}/description-list/description-list.scss +2 -2
- package/styles/{components-beta → components/beta}/nav-link/navlink.css +11 -14
- package/styles/components/beta/nav-link/navlink.min.css +1 -0
- package/styles/{components-beta → components/beta}/nav-link/navlink.scss +4 -4
- package/styles/components/beta/select/_index.scss +3 -0
- package/styles/{components-beta → components/beta}/select/select.css +13 -16
- package/styles/components/beta/select/select.min.css +1 -0
- package/styles/{components-beta → components/beta}/select/select.scss +9 -9
- package/styles/components/breadcrumb/breadcrumb.css +1 -1
- package/styles/components/breadcrumb/breadcrumb.min.css +1 -1
- package/styles/components/breadcrumb/breadcrumb.scss +1 -1
- package/styles/components/button/button.css +15 -14
- package/styles/components/button/button.min.css +1 -1
- package/styles/components/button/button.scss +14 -14
- package/styles/components/card/card.css +8 -11
- package/styles/components/card/card.min.css +1 -1
- package/styles/components/card/card.scss +7 -11
- package/styles/components/checkbox/checkbox.css +55 -42
- package/styles/components/checkbox/checkbox.min.css +1 -1
- package/styles/components/checkbox/checkbox.scss +43 -36
- package/styles/components/checkbox-panel/checkbox-panel.css +84 -72
- package/styles/components/checkbox-panel/checkbox-panel.min.css +1 -1
- package/styles/components/checkbox-panel/checkbox-panel.scss +5 -1
- package/styles/components/checkbox-panel/development/styles.scss +1 -1
- package/styles/components/chip/chip.css +6 -9
- package/styles/components/chip/chip.min.css +1 -1
- package/styles/components/chip/chip.scss +3 -3
- package/styles/components/combobox/combobox.css +30 -39
- package/styles/components/combobox/combobox.min.css +1 -1
- package/styles/components/combobox/combobox.scss +10 -8
- package/styles/components/cookie-consent/cookie-consent.css +1 -5
- package/styles/components/cookie-consent/cookie-consent.min.css +1 -1
- package/styles/components/cookie-consent/cookie-consent.scss +1 -1
- package/styles/components/countdown/countdown.css +4 -4
- package/styles/components/countdown/countdown.min.css +1 -1
- package/styles/components/datepicker/_calendar-date-button.scss +9 -9
- package/styles/components/datepicker/_calendar-navigation-dropdown.scss +3 -3
- package/styles/components/datepicker/_calendar-navigation.scss +1 -1
- package/styles/components/datepicker/_calendar-table.scss +1 -1
- package/styles/components/datepicker/_calendar.scss +7 -8
- package/styles/components/datepicker/datepicker.css +27 -31
- package/styles/components/datepicker/datepicker.min.css +1 -1
- package/styles/components/datepicker/datepicker.scss +1 -1
- package/styles/components/description-list/description-list.css +2 -2
- package/styles/components/description-list/description-list.min.css +1 -1
- package/styles/components/description-list/description-list.scss +3 -3
- package/styles/components/expander/expandable.css +20 -20
- package/styles/components/expander/expandable.min.css +1 -1
- package/styles/components/expander/expandable.scss +16 -20
- package/styles/components/feedback/feedback.css +14 -20
- package/styles/components/feedback/feedback.min.css +1 -1
- package/styles/components/feedback/feedback.scss +5 -10
- package/styles/components/file/file.css +10 -18
- package/styles/components/file/file.min.css +1 -1
- package/styles/components/file/file.scss +7 -7
- package/styles/components/file-input/file-input.css +52 -70
- package/styles/components/file-input/file-input.min.css +1 -1
- package/styles/components/file-input/file-input.scss +4 -4
- package/styles/components/help/help.css +2 -2
- package/styles/components/help/help.min.css +1 -1
- package/styles/components/help/help.scss +3 -3
- package/styles/components/icon/_base-styles.scss +3 -5
- package/styles/components/icon/icon.css +13 -34
- package/styles/components/icon/icon.min.css +1 -1
- package/styles/components/icon/icon.scss +5 -19
- package/styles/components/icon-button/icon-button.css +3 -3
- package/styles/components/icon-button/icon-button.min.css +1 -1
- package/styles/components/icon-button/icon-button.scss +1 -1
- package/styles/components/image/image.css +2 -2
- package/styles/components/image/image.min.css +1 -1
- package/styles/components/image/image.scss +1 -1
- package/styles/components/input-group/_field-group.scss +1 -1
- package/styles/components/input-group/_labels.scss +1 -1
- package/styles/components/input-group/input-group.css +12 -27
- package/styles/components/input-group/input-group.min.css +1 -1
- package/styles/components/input-group/input-group.scss +1 -1
- package/styles/components/input-panel/input-panel.css +26 -30
- package/styles/components/input-panel/input-panel.min.css +1 -1
- package/styles/components/input-panel/input-panel.scss +22 -20
- package/styles/components/link/link.css +7 -8
- package/styles/components/link/link.min.css +1 -1
- package/styles/components/link/link.scss +1 -2
- package/styles/components/link-list/link-list.css +17 -23
- package/styles/components/link-list/link-list.min.css +1 -1
- package/styles/components/link-list/link-list.scss +7 -3
- package/styles/components/list/list.css +6 -27
- package/styles/components/list/list.min.css +1 -1
- package/styles/components/list/list.scss +11 -15
- package/styles/components/loader/loader.css +6 -6
- package/styles/components/loader/loader.min.css +1 -1
- package/styles/components/loader/loader.scss +1 -1
- package/styles/components/loader/skeleton-loader.css +4 -4
- package/styles/components/loader/skeleton-loader.min.css +1 -1
- package/styles/components/loader/skeleton-loader.scss +2 -2
- package/styles/components/logo/logo.css +4 -4
- package/styles/components/logo/logo.min.css +1 -1
- package/styles/components/logo/logo.scss +1 -1
- package/styles/components/menu/_menu-divider.scss +2 -2
- package/styles/components/menu/_menu-item.scss +1 -1
- package/styles/components/menu/menu.css +8 -23
- package/styles/components/menu/menu.min.css +1 -1
- package/styles/components/menu/menu.scss +8 -12
- package/styles/components/message/message.css +25 -27
- package/styles/components/message/message.min.css +1 -1
- package/styles/components/message/message.scss +17 -7
- package/styles/components/modal/_layout.scss +22 -0
- package/styles/components/modal/_modal-base.scss +32 -0
- package/styles/components/modal/_motion.scss +45 -0
- package/styles/components/modal/_overlay.scss +20 -0
- package/styles/components/modal/_parts.scss +33 -0
- package/styles/components/modal/_placement.scss +59 -0
- package/styles/components/modal/modal.css +120 -42
- package/styles/components/modal/modal.min.css +1 -1
- package/styles/components/modal/modal.scss +6 -95
- package/styles/components/nav-link/nav-link.css +5 -5
- package/styles/components/nav-link/nav-link.min.css +1 -1
- package/styles/components/nav-link/nav-link.scss +2 -2
- package/styles/components/pagination/development/styles.scss +1 -1
- package/styles/components/pagination/pagination.css +2 -2
- package/styles/components/pagination/pagination.min.css +1 -1
- package/styles/components/pagination/pagination.scss +1 -1
- package/styles/components/popover/popover.css +17 -18
- package/styles/components/popover/popover.min.css +1 -1
- package/styles/components/popover/popover.scss +21 -11
- package/styles/components/progress-bar/progress-bar.css +29 -5
- package/styles/components/progress-bar/progress-bar.min.css +1 -1
- package/styles/components/progress-bar/progress-bar.scss +6 -1
- package/styles/components/radio-button/radio-button.css +53 -36
- package/styles/components/radio-button/radio-button.min.css +1 -1
- package/styles/components/radio-button/radio-button.scss +40 -31
- package/styles/components/radio-panel/development/styles.scss +1 -1
- package/styles/components/radio-panel/radio-panel.css +29 -30
- package/styles/components/radio-panel/radio-panel.min.css +1 -1
- package/styles/components/radio-panel/radio-panel.scss +5 -1
- package/styles/components/search/search-with-submit-button.css +3 -3
- package/styles/components/search/search-with-submit-button.min.css +1 -1
- package/styles/components/search/search-with-submit-button.scss +2 -2
- package/styles/components/search/search.css +10 -16
- package/styles/components/search/search.min.css +1 -1
- package/styles/components/search/search.scss +2 -2
- package/styles/components/segmented-control/segmented-control.css +91 -114
- package/styles/components/segmented-control/segmented-control.min.css +1 -1
- package/styles/components/segmented-control/segmented-control.scss +5 -5
- package/styles/components/select/select.css +27 -36
- package/styles/components/select/select.min.css +1 -1
- package/styles/components/select/select.scss +13 -14
- package/styles/components/summary-table/development/summary-table-example.scss +1 -1
- package/styles/components/summary-table/summary-table.css +5 -8
- package/styles/components/summary-table/summary-table.min.css +1 -1
- package/styles/components/summary-table/summary-table.scss +5 -5
- package/styles/components/system-message/system-message.css +22 -15
- package/styles/components/system-message/system-message.min.css +1 -1
- package/styles/components/system-message/system-message.scss +18 -9
- package/styles/components/table/_table-caption.scss +1 -1
- package/styles/components/table/_table-cell.scss +1 -1
- package/styles/components/table/_table-head.scss +3 -13
- package/styles/components/table/_table-header.scss +4 -4
- package/styles/components/table/_table-pagination.scss +1 -1
- package/styles/components/table/_table-row.scss +3 -3
- package/styles/components/table/table.css +20 -48
- package/styles/components/table/table.min.css +1 -1
- package/styles/components/table/table.scss +1 -1
- package/styles/components/table-of-contents/table-of-contents.css +4 -8
- package/styles/components/table-of-contents/table-of-contents.min.css +1 -1
- package/styles/components/table-of-contents/table-of-contents.scss +2 -2
- package/styles/components/tabs/tabs.css +9 -12
- package/styles/components/tabs/tabs.min.css +1 -1
- package/styles/components/tabs/tabs.scss +3 -3
- package/styles/components/tag/tag.css +18 -11
- package/styles/components/tag/tag.min.css +1 -1
- package/styles/components/tag/tag.scss +18 -8
- package/styles/components/text-area/text-area.css +17 -26
- package/styles/components/text-area/text-area.min.css +1 -1
- package/styles/components/text-area/text-area.scss +1 -1
- package/styles/components/text-input/text-input.css +12 -18
- package/styles/components/text-input/text-input.min.css +1 -1
- package/styles/components/text-input/text-input.scss +2 -3
- package/styles/components/toast/toast.css +21 -20
- package/styles/components/toast/toast.min.css +1 -1
- package/styles/components/toast/toast.scss +16 -14
- package/styles/components/toggle-switch/_toggle-slider.scss +5 -5
- package/styles/components/toggle-switch/toggle-switch.css +21 -29
- package/styles/components/toggle-switch/toggle-switch.min.css +2 -2
- package/styles/components/toggle-switch/toggle-switch.scss +10 -17
- package/styles/components/tooltip/tooltip.css +7 -11
- package/styles/components/tooltip/tooltip.min.css +1 -1
- package/styles/components/tooltip/tooltip.scss +4 -4
- package/styles/{styles.css → components.css} +801 -872
- package/styles/components.min.css +3 -0
- package/styles/{styles.scss → components.scss} +2 -2
- package/styles/{core/global → global}/_base-class.scss +6 -4
- package/styles/{core/global → global}/_top-layer.scss +1 -1
- package/styles/hooks/stories/styles.scss +7 -9
- package/styles/{core/jkl/_theme.scss → jkl/_forced-colors.scss} +0 -49
- package/styles/{core/jkl → jkl}/_index.scss +3 -6
- package/styles/{core/jkl → jkl}/_motion.scss +8 -26
- package/styles/{core/jkl → jkl}/_ornaments.scss +1 -1
- package/styles/{core/jkl → jkl}/_reset.scss +2 -2
- package/styles/{core/jkl → jkl}/_spacing.scss +1 -6
- package/styles/jkl/_tokens.scss +386 -0
- package/styles/{core/jkl → jkl}/_typography.scss +5 -98
- package/styles/shared/input/shared-input-styles.scss +7 -7
- package/styles/shared/track/track.scss +3 -3
- package/styles/tailwind.css +213 -0
- package/styles/theme/_color-scheme.scss +153 -0
- package/styles/{core/theme → theme}/_dynamic-spacing.scss +9 -5
- package/styles/theme/_fonts.scss +147 -0
- package/styles/theme/_index.scss +8 -0
- package/styles/theme/_size.scss +53 -0
- package/styles/theme/_tokens.scss +94 -0
- package/styles/theme/brands/dnb/_color-scheme.scss +119 -0
- package/styles/theme/brands/eika/_color-scheme.scss +119 -0
- package/styles/theme/brands/sparebank1/_color-scheme.scss +119 -0
- package/styles/{core/utility → utility}/_headings.scss +1 -1
- package/styles/utility/_paragraphs.scss +24 -0
- package/styles/{core/utility → utility}/_screen-reader.scss +1 -1
- package/styles/{core/utility → utility}/_spacing.scss +4 -3
- package/build/cjs/components-beta/description-list/DescriptionList.cjs +0 -2
- package/build/cjs/components-beta/description-list/DescriptionList.cjs.map +0 -1
- package/build/cjs/components-beta/description-list/DescriptionListItem.cjs +0 -2
- package/build/cjs/components-beta/description-list/DescriptionListItem.cjs.map +0 -1
- package/build/cjs/components-beta/nav-link/NavLink.cjs +0 -2
- package/build/cjs/components-beta/nav-link/NavLink.cjs.map +0 -1
- package/build/cjs/components-beta/nav-link/index.d.cts +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/index.d.cts +0 -2
- package/build/cjs/core/index.cjs +0 -2
- package/build/cjs/core/index.cjs.map +0 -1
- package/build/cjs/core/index.d.cts +0 -2
- package/build/cjs/core/tokens/build-tailwind-4.cjs +0 -2
- package/build/cjs/core/tokens/build-tailwind-4.cjs.map +0 -1
- package/build/cjs/core/tokens/build-tailwind-4.d.cts +0 -1
- package/build/cjs/core/tokens/style-dictionary/build.cjs +0 -2
- package/build/cjs/core/tokens/style-dictionary/build.cjs.map +0 -1
- package/build/cjs/core/tokens/style-dictionary/build.d.cts +0 -0
- package/build/cjs/core/tokens/style-dictionary/config.cjs +0 -2
- package/build/cjs/core/tokens/style-dictionary/config.cjs.map +0 -1
- package/build/cjs/core/tokens/style-dictionary/config.d.cts +0 -4
- package/build/cjs/core/tokens/style-dictionary/filters/index.cjs +0 -2
- package/build/cjs/core/tokens/style-dictionary/filters/index.cjs.map +0 -1
- package/build/cjs/core/tokens/style-dictionary/filters/index.d.cts +0 -3
- package/build/cjs/core/tokens/style-dictionary/formats/css-dynamic-color-variables.cjs +0 -2
- package/build/cjs/core/tokens/style-dictionary/formats/css-dynamic-color-variables.cjs.map +0 -1
- package/build/cjs/core/tokens/style-dictionary/formats/css-dynamic-color-variables.d.cts +0 -3
- package/build/cjs/core/tokens/style-dictionary/formats/css-theme-variables.cjs +0 -2
- package/build/cjs/core/tokens/style-dictionary/formats/css-theme-variables.cjs.map +0 -1
- package/build/cjs/core/tokens/style-dictionary/formats/css-theme-variables.d.cts +0 -3
- package/build/cjs/core/tokens/style-dictionary/formats/index.cjs +0 -2
- package/build/cjs/core/tokens/style-dictionary/formats/index.cjs.map +0 -1
- package/build/cjs/core/tokens/style-dictionary/formats/index.d.cts +0 -6
- package/build/cjs/core/tokens/style-dictionary/formats/javascript-esm.cjs +0 -2
- package/build/cjs/core/tokens/style-dictionary/formats/javascript-esm.cjs.map +0 -1
- package/build/cjs/core/tokens/style-dictionary/formats/javascript-esm.d.cts +0 -3
- package/build/cjs/core/tokens/style-dictionary/formats/scss-theme-variables.cjs +0 -2
- package/build/cjs/core/tokens/style-dictionary/formats/scss-theme-variables.cjs.map +0 -1
- package/build/cjs/core/tokens/style-dictionary/formats/scss-theme-variables.d.cts +0 -3
- package/build/cjs/core/tokens/style-dictionary/formats/tailwindcss-colors.cjs +0 -2
- package/build/cjs/core/tokens/style-dictionary/formats/tailwindcss-colors.cjs.map +0 -1
- package/build/cjs/core/tokens/style-dictionary/formats/tailwindcss-colors.d.cts +0 -3
- package/build/cjs/core/tokens/style-dictionary/register.cjs +0 -2
- package/build/cjs/core/tokens/style-dictionary/register.cjs.map +0 -1
- package/build/cjs/core/tokens/style-dictionary/register.d.cts +0 -1
- package/build/cjs/core/tokens/style-dictionary/transforms/index.cjs +0 -2
- package/build/cjs/core/tokens/style-dictionary/transforms/index.cjs.map +0 -1
- package/build/cjs/core/tokens/style-dictionary/transforms/index.d.cts +0 -2
- package/build/cjs/core/tokens/style-dictionary/transforms/strip-light-dark.cjs +0 -2
- package/build/cjs/core/tokens/style-dictionary/transforms/strip-light-dark.cjs.map +0 -1
- package/build/cjs/core/tokens/style-dictionary/transforms/strip-light-dark.d.cts +0 -3
- package/build/cjs/index.cjs +0 -2
- package/build/cjs/index.cjs.map +0 -1
- package/build/cjs/index.d.cts +0 -3
- package/build/es/components-beta/description-list/DescriptionList.js +0 -2
- package/build/es/components-beta/description-list/DescriptionList.js.map +0 -1
- package/build/es/components-beta/description-list/DescriptionListItem.js +0 -2
- package/build/es/components-beta/description-list/DescriptionListItem.js.map +0 -1
- package/build/es/components-beta/nav-link/NavLink.js +0 -2
- package/build/es/components-beta/nav-link/NavLink.js.map +0 -1
- package/build/es/components-beta/nav-link/index.d.ts +0 -1
- 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/core/index.d.ts +0 -2
- package/build/es/core/index.js +0 -2
- package/build/es/core/index.js.map +0 -1
- package/build/es/core/tokens/build-tailwind-4.d.ts +0 -1
- package/build/es/core/tokens/build-tailwind-4.js +0 -2
- package/build/es/core/tokens/build-tailwind-4.js.map +0 -1
- package/build/es/core/tokens/style-dictionary/build.d.ts +0 -0
- package/build/es/core/tokens/style-dictionary/build.js +0 -2
- package/build/es/core/tokens/style-dictionary/build.js.map +0 -1
- package/build/es/core/tokens/style-dictionary/config.d.ts +0 -4
- package/build/es/core/tokens/style-dictionary/config.js +0 -2
- package/build/es/core/tokens/style-dictionary/config.js.map +0 -1
- package/build/es/core/tokens/style-dictionary/filters/index.d.ts +0 -3
- package/build/es/core/tokens/style-dictionary/filters/index.js +0 -2
- package/build/es/core/tokens/style-dictionary/filters/index.js.map +0 -1
- package/build/es/core/tokens/style-dictionary/formats/css-dynamic-color-variables.d.ts +0 -3
- package/build/es/core/tokens/style-dictionary/formats/css-dynamic-color-variables.js +0 -2
- package/build/es/core/tokens/style-dictionary/formats/css-dynamic-color-variables.js.map +0 -1
- package/build/es/core/tokens/style-dictionary/formats/css-theme-variables.d.ts +0 -3
- package/build/es/core/tokens/style-dictionary/formats/css-theme-variables.js +0 -2
- package/build/es/core/tokens/style-dictionary/formats/css-theme-variables.js.map +0 -1
- package/build/es/core/tokens/style-dictionary/formats/index.d.ts +0 -6
- package/build/es/core/tokens/style-dictionary/formats/index.js +0 -2
- package/build/es/core/tokens/style-dictionary/formats/index.js.map +0 -1
- package/build/es/core/tokens/style-dictionary/formats/javascript-esm.d.ts +0 -3
- package/build/es/core/tokens/style-dictionary/formats/javascript-esm.js +0 -2
- package/build/es/core/tokens/style-dictionary/formats/javascript-esm.js.map +0 -1
- package/build/es/core/tokens/style-dictionary/formats/scss-theme-variables.d.ts +0 -3
- package/build/es/core/tokens/style-dictionary/formats/scss-theme-variables.js +0 -2
- package/build/es/core/tokens/style-dictionary/formats/scss-theme-variables.js.map +0 -1
- package/build/es/core/tokens/style-dictionary/formats/tailwindcss-colors.d.ts +0 -3
- package/build/es/core/tokens/style-dictionary/formats/tailwindcss-colors.js +0 -2
- package/build/es/core/tokens/style-dictionary/formats/tailwindcss-colors.js.map +0 -1
- package/build/es/core/tokens/style-dictionary/register.d.ts +0 -1
- package/build/es/core/tokens/style-dictionary/register.js +0 -2
- package/build/es/core/tokens/style-dictionary/register.js.map +0 -1
- package/build/es/core/tokens/style-dictionary/transforms/index.d.ts +0 -2
- package/build/es/core/tokens/style-dictionary/transforms/index.js +0 -2
- package/build/es/core/tokens/style-dictionary/transforms/index.js.map +0 -1
- package/build/es/core/tokens/style-dictionary/transforms/strip-light-dark.d.ts +0 -3
- package/build/es/core/tokens/style-dictionary/transforms/strip-light-dark.js +0 -2
- package/build/es/core/tokens/style-dictionary/transforms/strip-light-dark.js.map +0 -1
- package/build/es/index.d.ts +0 -3
- package/build/es/index.js +0 -2
- package/build/es/index.js.map +0 -1
- package/build/index-Ck94bTpt.cjs +0 -2
- package/build/index-Ck94bTpt.cjs.map +0 -1
- package/build/index-DOHQmuhD.js +0 -2
- package/build/index-DOHQmuhD.js.map +0 -1
- package/src/fonts/styles/_index.scss +0 -1
- package/src/fonts/styles/webfonts.scss +0 -145
- package/src/tailwind/v4/jokul-tailwind.css +0 -266
- package/styles/components-beta/nav-link/navlink.min.css +0 -1
- package/styles/components-beta/select/_index.scss +0 -3
- package/styles/components-beta/select/select.min.css +0 -1
- package/styles/core/core.css +0 -1731
- package/styles/core/core.min.css +0 -2
- package/styles/core/jkl/_colors.scss +0 -26
- package/styles/core/jkl/_helpers.scss +0 -26
- package/styles/core/jkl/legacy/_index.scss +0 -2
- package/styles/core/theme/_index.scss +0 -10
- package/styles/core/theme/_old-vars.scss +0 -21
- package/styles/core/theme/_shape.scss +0 -12
- package/styles/core/theme/_spacing.scss +0 -64
- package/styles/core/theme/_typography.scss +0 -38
- package/styles/core/utility/_paragraphs.scss +0 -29
- package/styles/fonts/_index.scss +0 -1
- package/styles/fonts/webfonts.css +0 -115
- package/styles/fonts/webfonts.min.css +0 -1
- package/styles/fonts/webfonts.scss +0 -145
- package/styles/styles.min.css +0 -3
- /package/build/cjs/{components-beta → components/beta}/description-list/DescriptionList.d.cts +0 -0
- /package/build/cjs/{components-beta → components/beta}/description-list/DescriptionListItem.d.cts +0 -0
- /package/build/cjs/{components-beta → components/beta}/description-list/index.cjs +0 -0
- /package/build/cjs/{components-beta → components/beta}/description-list/index.cjs.map +0 -0
- /package/build/cjs/{components-beta → components/beta}/description-list/types.cjs +0 -0
- /package/build/cjs/{components-beta → components/beta}/description-list/types.cjs.map +0 -0
- /package/build/cjs/{components-beta → components/beta}/description-list/types.d.cts +0 -0
- /package/build/cjs/{components-beta → components/beta}/nav-link/NavLink.d.cts +0 -0
- /package/build/cjs/{components-beta → components/beta}/nav-link/index.cjs +0 -0
- /package/build/cjs/{components-beta → components/beta}/nav-link/index.cjs.map +0 -0
- /package/build/cjs/{components-beta → components/beta}/nav-link/types.cjs +0 -0
- /package/build/cjs/{components-beta → components/beta}/nav-link/types.cjs.map +0 -0
- /package/build/cjs/{components-beta → components/beta}/select/Select.d.cts +0 -0
- /package/build/cjs/{components-beta → components/beta}/select/index.cjs +0 -0
- /package/build/cjs/{components-beta → components/beta}/select/index.cjs.map +0 -0
- /package/build/cjs/{components-beta → components/beta}/select/types.cjs +0 -0
- /package/build/cjs/{components-beta → components/beta}/select/types.cjs.map +0 -0
- /package/build/cjs/{core → utilities}/types.cjs +0 -0
- /package/build/cjs/{core → utilities}/types.cjs.map +0 -0
- /package/build/es/{components-beta → components/beta}/description-list/DescriptionList.d.ts +0 -0
- /package/build/es/{components-beta → components/beta}/description-list/DescriptionListItem.d.ts +0 -0
- /package/build/es/{components-beta → components/beta}/description-list/index.js +0 -0
- /package/build/es/{components-beta → components/beta}/description-list/index.js.map +0 -0
- /package/build/es/{components-beta → components/beta}/description-list/types.d.ts +0 -0
- /package/build/es/{components-beta → components/beta}/description-list/types.js +0 -0
- /package/build/es/{components-beta → components/beta}/description-list/types.js.map +0 -0
- /package/build/es/{components-beta → components/beta}/nav-link/NavLink.d.ts +0 -0
- /package/build/es/{components-beta → components/beta}/nav-link/index.js +0 -0
- /package/build/es/{components-beta → components/beta}/nav-link/index.js.map +0 -0
- /package/build/es/{components-beta → components/beta}/nav-link/types.js +0 -0
- /package/build/es/{components-beta → components/beta}/nav-link/types.js.map +0 -0
- /package/build/es/{components-beta → components/beta}/select/Select.d.ts +0 -0
- /package/build/es/{components-beta → components/beta}/select/index.js +0 -0
- /package/build/es/{components-beta → components/beta}/select/index.js.map +0 -0
- /package/build/es/{components-beta → components/beta}/select/types.js +0 -0
- /package/build/es/{components-beta → components/beta}/select/types.js.map +0 -0
- /package/build/es/{core → utilities}/types.js +0 -0
- /package/build/es/{core → utilities}/types.js.map +0 -0
- /package/styles/{core/_layers.scss → _layers.scss} +0 -0
- /package/styles/{core/core.scss → base.scss} +0 -0
- /package/styles/{components-beta → components/beta}/description-list/_index.scss +0 -0
- /package/styles/{components-beta → components/beta}/nav-link/_index.scss +0 -0
- /package/styles/{core/global → global}/_index.scss +0 -0
- /package/styles/{core/jkl → jkl}/_convert.scss +0 -0
- /package/styles/{core/jkl → jkl}/_navigation.scss +0 -0
- /package/styles/{core/jkl → jkl}/_responsive-units.scss +0 -0
- /package/styles/{core/jkl → jkl}/_screenreader.scss +0 -0
- /package/styles/{core/jkl → jkl}/_screens.scss +0 -0
- /package/styles/{core/jkl → jkl}/_shadows.scss +0 -0
- /package/styles/{core/jkl → jkl}/_underline.scss +0 -0
- /package/styles/{core/jkl → jkl}/_z-index.scss +0 -0
- /package/styles/{core/resets → resets}/_index.scss +0 -0
- /package/styles/{core/resets → resets}/_normalize.scss +0 -0
- /package/styles/{core/resets → resets}/_reset.scss +0 -0
- /package/styles/{core/utility → utility}/_index.scss +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("../../../../clsx-E3yX_9sL.cjs");require("react");const r=require("./DescriptionListItem.cjs"),s=({className:r,alignment:s="horizontal",showSeparators:i=!1,children:a,...c})=>e.jsx("dl",{...c,className:t.clsx("jkl-description-list--beta",r),"data-alignment":s,"data-separators":i,children:a});s.Item=r.DescriptionListItem,exports.DescriptionList=s;
|
|
2
|
+
//# sourceMappingURL=DescriptionList.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DescriptionList.cjs","sources":["../../../../../src/components/beta/description-list/DescriptionList.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React from \"react\";\nimport { DescriptionListItem } from \"./DescriptionListItem.jsx\";\nimport type { DescriptionListProps } from \"./types.js\";\n\n/**\n * @deprecated Bruk heller den stabile komponenten. All funksjonalitet fra Beta-komponenten er tilgjengelige der.\n */\nexport const DescriptionList = ({\n className,\n alignment = \"horizontal\",\n showSeparators = false,\n children,\n ...rest\n}: DescriptionListProps): React.JSX.Element => {\n return (\n <dl\n {...rest}\n className={clsx(\"jkl-description-list--beta\", className)}\n data-alignment={alignment}\n data-separators={showSeparators}\n >\n {children}\n </dl>\n );\n};\n\nDescriptionList.Item = DescriptionListItem;\n"],"names":["DescriptionList","className","alignment","showSeparators","children","rest","jsx","clsx","Item","DescriptionListItem"],"mappings":"8NAQaA,EAAkB,EAC3BC,UAAAA,EACAC,UAAAA,EAAY,aACZC,eAAAA,GAAiB,EACjBC,SAAAA,KACGC,KAGCC,EAAAA,IAAC,KAAA,IACOD,EACJJ,UAAWM,EAAAA,KAAK,6BAA8BN,GAC9C,iBAAgBC,EAChB,kBAAiBC,EAEhBC,SAAAA,IAKbJ,EAAgBQ,KAAOC,EAAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("../../../../clsx-E3yX_9sL.cjs");require("react");exports.DescriptionListItem=({title:t,value:r,supportText:i,className:l,...c})=>e.jsxs("div",{...c,className:s.clsx("jkl-description-list-item--beta",l),children:[e.jsx("dt",{className:"title",children:t}),e.jsx("dd",{className:"value",children:r}),i&&e.jsx("dd",{className:"support-text",children:i})]});
|
|
2
|
+
//# sourceMappingURL=DescriptionListItem.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DescriptionListItem.cjs","sources":["../../../../../src/components/beta/description-list/DescriptionListItem.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport React, { type FC } from \"react\";\nimport type { DescriptionListItemProps } from \"./types.js\";\n\n/**\n * @deprecated Bruk heller den stabile komponenten for DescriptionList sammen med Terms og Details. All funksjonalitet fra Beta-komponenten er tilgjengelige der.\n */\nexport const DescriptionListItem: FC<DescriptionListItemProps> = ({\n title,\n value,\n supportText,\n className,\n ...rest\n}) => {\n return (\n <div\n {...rest}\n className={clsx(\"jkl-description-list-item--beta\", className)}\n >\n <dt className=\"title\">{title}</dt>\n <dd className=\"value\">{value}</dd>\n {supportText && <dd className=\"support-text\">{supportText}</dd>}\n </div>\n );\n};\n"],"names":["title","value","supportText","className","rest","jsxs","clsx","children","jsx"],"mappings":"6MAOiE,EAC7DA,MAAAA,EACAC,MAAAA,EACAC,YAAAA,EACAC,UAAAA,KACGC,KAGCC,EAAAA,KAAC,MAAA,IACOD,EACJD,UAAWG,EAAAA,KAAK,kCAAmCH,GAEnDI,SAAA,CAAAC,EAAAA,IAAC,KAAA,CAAGL,UAAU,QAASI,SAAAP,IACvBQ,EAAAA,IAAC,KAAA,CAAGL,UAAU,QAASI,SAAAN,IACtBC,GAAeM,EAAAA,IAAC,KAAA,CAAGL,UAAU,eAAgBI,SAAAL"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { DescriptionList as BETA_DescriptionList } from './DescriptionList.
|
|
2
|
-
export { DescriptionListItem as BETA_DescriptionListItem } from './DescriptionListItem.
|
|
1
|
+
export { DescriptionList as BETA_DescriptionList } from './DescriptionList.jsx';
|
|
2
|
+
export { DescriptionListItem as BETA_DescriptionListItem } from './DescriptionListItem.jsx';
|
|
3
3
|
export type { DescriptionListProps as BETA_DescriptionListProps, DescriptionListItemProps as BETA_DescriptionListItemProps, } from './types.cjs';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("../../../../clsx-E3yX_9sL.cjs"),r=require("react"),s=r.forwardRef(function(s,t){const{title:a,description:c,className:l,children:n,as:d="a",...o}=s,u=d,p=r.useId();return e.jsxs(u,{...o,ref:t,"aria-labelledby":`${p}-title`,"aria-describedby":`${p}-description`,className:i.clsx("jkl-navlink--beta",l),children:[e.jsx("p",{className:"title",id:`${p}-title`,children:a}),c&&e.jsx("p",{className:"description",id:`${p}-description`,children:c})]})});exports.NavLink=s;
|
|
2
|
+
//# sourceMappingURL=NavLink.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavLink.cjs","sources":["../../../../../src/components/beta/nav-link/NavLink.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { useId } from \"react\";\nimport type { PolymorphicRef } from \"../../../utilities/index.js\";\nimport type { NavLinkProps } from \"./types.js\";\n\ntype NavLinkComponent = <ElementType extends React.ElementType = \"a\">(\n props: NavLinkProps<ElementType>,\n) => React.ReactElement | null;\n\nexport const NavLink = React.forwardRef(function NavLink<\n ElementType extends React.ElementType = \"a\",\n>(props: NavLinkProps<ElementType>, ref?: PolymorphicRef<ElementType>) {\n const {\n title,\n description,\n className,\n children,\n as = \"a\",\n ...rest\n } = props;\n const Component = as;\n const id = useId();\n\n return (\n <Component\n {...rest}\n ref={ref}\n aria-labelledby={`${id}-title`}\n aria-describedby={`${id}-description`}\n className={clsx(\"jkl-navlink--beta\", className)}\n >\n <p className=\"title\" id={`${id}-title`}>\n {title}\n </p>\n {description && (\n <p className=\"description\" id={`${id}-description`}>\n {description}\n </p>\n )}\n </Component>\n );\n}) as NavLinkComponent;\n"],"names":["NavLink","React","forwardRef","props","ref","title","description","className","children","as","rest","Component","id","useId","jsxs","clsx","jsx"],"mappings":"mLASaA,EAAUC,EAAMC,WAAW,SAEtCC,EAAkCC,GAChC,MACIC,MAAAA,EACAC,YAAAA,EACAC,UAAAA,EACAC,SAAAA,EACAC,GAAAA,EAAK,OACFC,GACHP,EACEQ,EAAYF,EACZG,EAAKC,EAAAA,QAEX,OACIC,EAAAA,KAACH,EAAA,IACOD,EACJN,IAAAA,EACA,kBAAiB,GAAGQ,UACpB,mBAAkB,GAAGA,gBACrBL,UAAWQ,EAAAA,KAAK,oBAAqBR,GAErCC,SAAA,CAAAQ,EAAAA,IAAC,KAAET,UAAU,QAAQK,GAAI,GAAGA,UACvBJ,SAAAH,IAEJC,SACI,IAAA,CAAEC,UAAU,cAAcK,GAAI,GAAGA,gBAC7BJ,SAAAF,MAKrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NavLink as BETA_NavLink } from './NavLink.jsx';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { PolymorphicPropsWithRef } from '
|
|
2
|
+
import { PolymorphicPropsWithRef } from '../../../utilities/index.cjs';
|
|
3
3
|
export type NavLinkProps<ElementType extends React.ElementType> = PolymorphicPropsWithRef<ElementType, {
|
|
4
4
|
title: string;
|
|
5
5
|
description?: string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("../../../../clsx-E3yX_9sL.cjs"),o=require("react");require("../../icon/Icon.cjs"),require("../../icon/icons/animated/ArrowVerticalAnimated.cjs"),require("../../icon/icons/animated/ArrowHorizontalAnimated.cjs"),require("../../icon/icons/animated/PlusRemoveAnimated.cjs");const r=require("../../icon/icons/ArrowDownIcon.cjs");require("../../icon/icons/ArrowLeftIcon.cjs"),require("../../icon/icons/ArrowNorthEastIcon.cjs"),require("../../icon/icons/ArrowRightIcon.cjs"),require("../../icon/icons/ArrowUpIcon.cjs"),require("../../icon/icons/CalendarIcon.cjs"),require("../../icon/icons/CheckIcon.cjs"),require("../../icon/icons/ChevronDownIcon.cjs"),require("../../icon/icons/ChevronLeftIcon.cjs"),require("../../icon/icons/ChevronRightIcon.cjs"),require("../../icon/icons/ChevronUpIcon.cjs"),require("../../icon/icons/CloseIcon.cjs"),require("../../icon/icons/CopyIcon.cjs"),require("../../icon/icons/DotsIcon.cjs"),require("../../icon/icons/DragIcon.cjs"),require("../../icon/icons/ErrorIcon.cjs"),require("../../icon/icons/GreenCheckIcon.cjs"),require("../../icon/icons/HamburgerIcon.cjs"),require("../../icon/icons/InfoIcon.cjs"),require("../../icon/icons/LinkIcon.cjs"),require("../../icon/icons/MinusIcon.cjs"),require("../../icon/icons/OpenInNewIcon.cjs"),require("../../icon/icons/PenIcon.cjs"),require("../../icon/icons/PlusIcon.cjs"),require("../../icon/icons/QuestionIcon.cjs"),require("../../icon/icons/RedCrossIcon.cjs"),require("../../icon/icons/SearchIcon.cjs"),require("../../icon/icons/SuccessIcon.cjs"),require("../../icon/icons/ThumbDownIcon.cjs"),require("../../icon/icons/ThumbUpIcon.cjs"),require("../../icon/icons/TrashCanIcon.cjs"),require("../../icon/icons/WarningIcon.cjs");const n=require("../../input-group/InputGroup.cjs"),i=o.forwardRef((o,i)=>{const{label:s,className:u,errorLabel:t,helpLabel:a,labelProps:l,placeholder:j="Velg",supportLabelProps:q,tooltip:I,value:p,description:d,...h}=o,b={label:s,errorLabel:t,helpLabel:a,labelProps:l,supportLabelProps:q,tooltip:I,description:d};return e.jsx(n.InputGroup,{...b,"data-testid":"jkl-select--beta",className:c.clsx("jkl-select--beta",u),render:c=>e.jsxs("div",{className:"jkl-select--beta-wrapper",children:[e.jsxs("select",{ref:i,defaultValue:p?void 0:"",value:p,...c,...h,children:[j&&e.jsx("option",{disabled:!0,selected:!0,value:"",children:j}),o.children]}),e.jsx(r.ArrowDownIcon,{})]})})});exports.Select=i;
|
|
2
|
+
//# sourceMappingURL=Select.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.cjs","sources":["../../../../../src/components/beta/select/Select.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef } from \"react\";\nimport { ArrowDownIcon } from \"../../icon/index.js\";\nimport { InputGroup } from \"../../input-group/InputGroup.jsx\";\nimport type { SelectProps } from \"./types.js\";\n\nexport const Select = forwardRef<HTMLSelectElement, SelectProps>(\n (props, ref) => {\n const {\n label,\n className,\n errorLabel,\n helpLabel,\n labelProps,\n placeholder = \"Velg\",\n supportLabelProps,\n tooltip,\n value,\n description,\n ...rest\n } = props;\n\n const inputGroupProps = {\n label,\n errorLabel,\n helpLabel,\n labelProps,\n supportLabelProps,\n tooltip,\n description,\n };\n\n return (\n <InputGroup\n {...inputGroupProps}\n data-testid=\"jkl-select--beta\"\n className={clsx(\"jkl-select--beta\", className)}\n render={(inputProps) => (\n <div className=\"jkl-select--beta-wrapper\">\n <select\n ref={ref}\n defaultValue={value ? undefined : \"\"}\n value={value}\n {...inputProps}\n {...rest}\n >\n {placeholder && (\n <option disabled selected value=\"\">\n {placeholder}\n </option>\n )}\n {props.children}\n </select>\n <ArrowDownIcon />\n </div>\n )}\n />\n );\n },\n);\n"],"names":["Select","forwardRef","props","ref","label","className","errorLabel","helpLabel","labelProps","placeholder","supportLabelProps","tooltip","value","description","rest","inputGroupProps","jsx","InputGroup","clsx","render","inputProps","jsxs","children","defaultValue","disabled","selected","ArrowDownIcon"],"mappings":"q1DAMaA,EAASC,EAAAA,WAClB,CAACC,EAAOC,KACJ,MACIC,MAAAA,EACAC,UAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAC,WAAAA,EACAC,YAAAA,EAAc,OACdC,kBAAAA,EACAC,QAAAA,EACAC,MAAAA,EACAC,YAAAA,KACGC,GACHZ,EAEEa,EAAkB,CACpBX,MAAAA,EACAE,WAAAA,EACAC,UAAAA,EACAC,WAAAA,EACAE,kBAAAA,EACAC,QAAAA,EACAE,YAAAA,GAGJ,OACIG,EAAAA,IAACC,EAAAA,WAAA,IACOF,EACJ,cAAY,mBACZV,UAAWa,EAAAA,KAAK,mBAAoBb,GACpCc,OAASC,GACLC,EAAAA,KAAC,MAAA,CAAIhB,UAAU,2BACXiB,SAAA,CAAAD,EAAAA,KAAC,SAAA,CACGlB,IAAAA,EACAoB,aAAcX,OAAQ,EAAY,GAClCA,MAAAA,KACIQ,KACAN,EAEHQ,SAAA,CAAAb,GACGO,EAAAA,IAAC,UAAOQ,UAAQ,EAACC,UAAQ,EAACb,MAAM,GAC3BU,SAAAb,IAGRP,EAAMoB,kBAEVI,EAAAA,cAAA,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode, SelectHTMLAttributes } from 'react';
|
|
2
|
-
import { InputGroupProps } from '../../
|
|
2
|
+
import { InputGroupProps } from '../../input-group/types.cjs';
|
|
3
3
|
export interface SelectProps extends Omit<InputGroupProps, "children" | "inline">, SelectHTMLAttributes<HTMLSelectElement> {
|
|
4
4
|
/**
|
|
5
5
|
* Setter inn et placeholderelement som vises når ingenting er valgt i nedtrekkslisten.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("../../../clsx-E3yX_9sL.cjs"),a=require("react"),t=require("../../utilities/polymorphism/SlotComponent.cjs"),i=a.forwardRef(function(a,i){const{className:s,clickable:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("../../../clsx-E3yX_9sL.cjs"),a=require("react"),t=require("../../utilities/polymorphism/SlotComponent.cjs"),i=a.forwardRef(function(a,i){const{className:s,clickable:l=!1,padding:c="s",variant:d="filled",asChild:o,as:n="div",...u}=a,p=o?t.SlotComponent:n;return e.jsx(p,{"data-testid":"jkl-card","data-clickable":l,"data-padding":c,className:r.clsx("jkl-card",`jkl-card--${d}`,s),...u,ref:i})});exports.Card=i;
|
|
2
2
|
//# sourceMappingURL=Card.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.cjs","sources":["../../../../src/components/card/Card.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React from \"react\";\nimport { SlotComponent } from \"../../utilities/polymorphism/SlotComponent.js\";\nimport type { AsChildProps } from \"../../utilities/polymorphism/as-child.js\";\nimport type { PolymorphicRef } from \"../../utilities/polymorphism/polymorphism.js\";\nimport type { CardProps } from \"./types.js\";\n\ntype CardComponent = <ElementType extends React.ElementType = \"div\">(\n props: CardProps<ElementType> & AsChildProps,\n) => React.ReactElement | null;\n\n/**\n * En allsidig kortkomponent som brukes for å gruppere innhold på en side.\n * Komponenten rendres til vanlig som en `<div>`, men du kan velge å rendre\n * den som andre elementer eller komponenter der du trenger annen semantikk\n * eller funksjonalitet.\n */\nexport const Card = React.forwardRef(function Card<\n ElementType extends React.ElementType = \"div\",\n>(props: CardProps<ElementType>, ref?: PolymorphicRef<ElementType>) {\n const {\n className,\n clickable = false,\n padding = \"s\",\n variant = \"
|
|
1
|
+
{"version":3,"file":"Card.cjs","sources":["../../../../src/components/card/Card.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React from \"react\";\nimport { SlotComponent } from \"../../utilities/polymorphism/SlotComponent.js\";\nimport type { AsChildProps } from \"../../utilities/polymorphism/as-child.js\";\nimport type { PolymorphicRef } from \"../../utilities/polymorphism/polymorphism.js\";\nimport type { CardProps } from \"./types.js\";\n\ntype CardComponent = <ElementType extends React.ElementType = \"div\">(\n props: CardProps<ElementType> & AsChildProps,\n) => React.ReactElement | null;\n\n/**\n * En allsidig kortkomponent som brukes for å gruppere innhold på en side.\n * Komponenten rendres til vanlig som en `<div>`, men du kan velge å rendre\n * den som andre elementer eller komponenter der du trenger annen semantikk\n * eller funksjonalitet.\n */\nexport const Card = React.forwardRef(function Card<\n ElementType extends React.ElementType = \"div\",\n>(props: CardProps<ElementType>, ref?: PolymorphicRef<ElementType>) {\n const {\n className,\n clickable = false,\n padding = \"s\",\n variant = \"filled\",\n asChild,\n as = \"div\",\n ...componentProps\n } = props;\n\n const Component = asChild ? SlotComponent : as;\n\n return (\n <Component\n data-testid=\"jkl-card\"\n data-clickable={clickable}\n data-padding={padding}\n className={clsx(\"jkl-card\", `jkl-card--${variant}`, className)}\n {...componentProps}\n ref={ref}\n />\n );\n}) as CardComponent;\n"],"names":["Card","React","forwardRef","props","ref","className","clickable","padding","variant","asChild","as","componentProps","Component","SlotComponent","jsx","clsx"],"mappings":"4OAiBaA,EAAOC,EAAMC,WAAW,SAEnCC,EAA+BC,GAC7B,MACIC,UAAAA,EACAC,UAAAA,GAAY,EACZC,QAAAA,EAAU,IACVC,QAAAA,EAAU,SACVC,QAAAA,EACAC,GAAAA,EAAK,SACFC,GACHR,EAEES,EAAYH,EAAUI,EAAAA,cAAgBH,EAE5C,OACII,EAAAA,IAACF,EAAA,CACG,cAAY,WACZ,iBAAgBN,EAChB,eAAcC,EACdF,UAAWU,EAAAA,KAAK,WAAY,aAAaP,IAAWH,MAChDM,EACJP,IAAAA,GAGZ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.CARD_PADDINGS=["s","m","l","xl"],exports.CARD_VARIANTS=["outlined","
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.CARD_PADDINGS=["s","m","l","xl"],exports.CARD_VARIANTS=["outlined","filled"];
|
|
2
2
|
//# sourceMappingURL=types.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sources":["../../../../src/components/card/types.ts"],"sourcesContent":["import type { PolymorphicPropsWithRef } from \"../../utilities/polymorphism/polymorphism.js\";\n\nexport const CARD_PADDINGS = [\"s\", \"m\", \"l\", \"xl\"] as const;\nexport type CardPadding = (typeof CARD_PADDINGS)[number];\nexport const CARD_VARIANTS = [\"outlined\", \"
|
|
1
|
+
{"version":3,"file":"types.cjs","sources":["../../../../src/components/card/types.ts"],"sourcesContent":["import type { PolymorphicPropsWithRef } from \"../../utilities/polymorphism/polymorphism.js\";\n\nexport const CARD_PADDINGS = [\"s\", \"m\", \"l\", \"xl\"] as const;\nexport type CardPadding = (typeof CARD_PADDINGS)[number];\nexport const CARD_VARIANTS = [\"outlined\", \"filled\"] as const;\nexport type CardVariant = (typeof CARD_VARIANTS)[number];\n\ntype Props = {\n className?: string;\n /**\n * Setter padding på kortet. Tilsvarer samme property i Figma.\n * @default \"s\"\n */\n padding?: CardPadding;\n /**\n * Angir hvilken kortvariant du vil bruke. Velg en variant som gir god kontrast\n * til bakgrunnen på siden, slik at det er enkelt å skille innholdet fra hverandre.\n * @default \"filled\"\n */\n variant?: CardVariant;\n /**\n * Angir om kortet visuelt skal fremstå som klikkbart. Du må selv rendre\n * kortet som et klikkbart element (f.eks. `<a>` eller en `<Link>` fra\n * et ruting-bibliotek) og gi det en `href` eller `onClick`-handler.\n * HUSK: Sett aria-label for at støtteverktøy, som skjermlesere, ikke\n * skal lese alt innholdet i kortet.\n */\n clickable?: boolean;\n};\n\nexport type CardProps<ElementType extends React.ElementType> =\n PolymorphicPropsWithRef<ElementType, Props> & Props;\n"],"names":[],"mappings":"sGAE6B,CAAC,IAAK,IAAK,IAAK,4BAEhB,CAAC,WAAY"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PolymorphicPropsWithRef } from '../../utilities/polymorphism/polymorphism.cjs';
|
|
2
2
|
export declare const CARD_PADDINGS: readonly ["s", "m", "l", "xl"];
|
|
3
3
|
export type CardPadding = (typeof CARD_PADDINGS)[number];
|
|
4
|
-
export declare const CARD_VARIANTS: readonly ["outlined", "
|
|
4
|
+
export declare const CARD_VARIANTS: readonly ["outlined", "filled"];
|
|
5
5
|
export type CardVariant = (typeof CARD_VARIANTS)[number];
|
|
6
6
|
type Props = {
|
|
7
7
|
className?: string;
|
|
@@ -13,7 +13,7 @@ type Props = {
|
|
|
13
13
|
/**
|
|
14
14
|
* Angir hvilken kortvariant du vil bruke. Velg en variant som gir god kontrast
|
|
15
15
|
* til bakgrunnen på siden, slik at det er enkelt å skille innholdet fra hverandre.
|
|
16
|
-
* @default "
|
|
16
|
+
* @default "filled"
|
|
17
17
|
*/
|
|
18
18
|
variant?: CardVariant;
|
|
19
19
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("../../../clsx-E3yX_9sL.cjs"),t=require("react"),r=require("../../hooks/useId/useId.cjs"),a=t.forwardRef((a,i)=>{const{id:n,children:s,invalid:l,className:o,inline:d=!1,"data-testautoid":u,checked:k,indeterminate:h,...x}=a,b=t.useRef(null);t.useImperativeHandle(i,()=>b.current,[]);const j=r.useId(n||"jkl-checkbox",{generateSuffix:!n});return t.useEffect(()=>{!0===k&&!0===h&&"production"!==process.env.NODE_ENV&&console.warn("A Checkbox can not be both checked and indeterminate, and will be treated as checked"),b.current&&(b.current.indeterminate=!k&&!!h)},[k,h]),e.jsxs("div",{className:c.clsx("jkl-checkbox",o,{"jkl-checkbox--inline":d,"jkl-checkbox--error":l}),children:[e.jsx("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("../../../clsx-E3yX_9sL.cjs"),t=require("react"),r=require("../../hooks/useId/useId.cjs"),a=t.forwardRef((a,i)=>{const{id:n,children:s,invalid:l,className:o,inline:d=!1,"data-testautoid":u,checked:k,indeterminate:h,...x}=a,b=t.useRef(null);t.useImperativeHandle(i,()=>b.current,[]);const j=r.useId(n||"jkl-checkbox",{generateSuffix:!n});return t.useEffect(()=>{!0===k&&!0===h&&"production"!==process.env.NODE_ENV&&console.warn("A Checkbox can not be both checked and indeterminate, and will be treated as checked"),b.current&&(b.current.indeterminate=!k&&!!h)},[k,h]),e.jsxs("div",{className:c.clsx("jkl-checkbox",o,{"jkl-checkbox--inline":d,"jkl-checkbox--error":l}),children:[e.jsx("input",{id:j,ref:b,className:"jkl-checkbox__input","data-testid":"jkl-checkbox-input","aria-invalid":l,type:"checkbox","data-testautoid":u,checked:k,...x}),e.jsx("label",{htmlFor:j,className:"jkl-checkbox__label",children:s})]})});a.displayName="Checkbox",exports.Checkbox=a;
|
|
2
2
|
//# sourceMappingURL=Checkbox.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.cjs","sources":["../../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, useEffect, useImperativeHandle, useRef } from \"react\";\nimport { useId } from \"../../hooks/useId/useId.js\";\nimport type { CheckboxProps } from \"./types.js\";\n\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n (props, ref) => {\n const {\n id,\n children,\n invalid,\n className,\n inline = false,\n \"data-testautoid\": testAutoId,\n checked,\n indeterminate,\n ...rest\n } = props;\n\n const inputRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(\n ref,\n () => inputRef.current as HTMLInputElement,\n [],\n );\n\n const inputId = useId(id || \"jkl-checkbox\", { generateSuffix: !id });\n\n useEffect(() => {\n if (\n checked === true &&\n indeterminate === true &&\n process.env.NODE_ENV !== \"production\"\n ) {\n console.warn(\n \"A Checkbox can not be both checked and indeterminate, and will be treated as checked\",\n );\n }\n if (inputRef.current) {\n inputRef.current.indeterminate = !checked && !!indeterminate;\n }\n }, [checked, indeterminate]);\n\n return (\n <div\n className={clsx(\"jkl-checkbox\", className, {\n \"jkl-checkbox--inline\": inline,\n \"jkl-checkbox--error\": invalid,\n })}\n >\n <
|
|
1
|
+
{"version":3,"file":"Checkbox.cjs","sources":["../../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef, useEffect, useImperativeHandle, useRef } from \"react\";\nimport { useId } from \"../../hooks/useId/useId.js\";\nimport type { CheckboxProps } from \"./types.js\";\n\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n (props, ref) => {\n const {\n id,\n children,\n invalid,\n className,\n inline = false,\n \"data-testautoid\": testAutoId,\n checked,\n indeterminate,\n ...rest\n } = props;\n\n const inputRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(\n ref,\n () => inputRef.current as HTMLInputElement,\n [],\n );\n\n const inputId = useId(id || \"jkl-checkbox\", { generateSuffix: !id });\n\n useEffect(() => {\n if (\n checked === true &&\n indeterminate === true &&\n process.env.NODE_ENV !== \"production\"\n ) {\n console.warn(\n \"A Checkbox can not be both checked and indeterminate, and will be treated as checked\",\n );\n }\n if (inputRef.current) {\n inputRef.current.indeterminate = !checked && !!indeterminate;\n }\n }, [checked, indeterminate]);\n\n return (\n <div\n className={clsx(\"jkl-checkbox\", className, {\n \"jkl-checkbox--inline\": inline,\n \"jkl-checkbox--error\": invalid,\n })}\n >\n <input\n id={inputId}\n ref={inputRef}\n className=\"jkl-checkbox__input\"\n data-testid=\"jkl-checkbox-input\"\n aria-invalid={invalid}\n type=\"checkbox\"\n data-testautoid={testAutoId}\n checked={checked}\n {...rest}\n />\n <label htmlFor={inputId} className=\"jkl-checkbox__label\">\n {children}\n </label>\n </div>\n );\n },\n);\n\nCheckbox.displayName = \"Checkbox\";\n"],"names":["Checkbox","forwardRef","props","ref","id","children","invalid","className","inline","testAutoId","checked","indeterminate","rest","inputRef","useRef","useImperativeHandle","current","inputId","useId","generateSuffix","useEffect","process","env","NODE_ENV","console","warn","jsxs","clsx","jsx","type","htmlFor","displayName"],"mappings":"yNAKaA,EAAWC,EAAAA,WACpB,CAACC,EAAOC,KACJ,MACIC,GAAAA,EACAC,SAAAA,EACAC,QAAAA,EACAC,UAAAA,EACAC,OAAAA,GAAS,EACT,kBAAmBC,EACnBC,QAAAA,EACAC,cAAAA,KACGC,GACHV,EAEEW,EAAWC,EAAAA,OAAyB,MAC1CC,EAAAA,oBACIZ,EACA,IAAMU,EAASG,QACf,IAGJ,MAAMC,EAAUC,EAAAA,MAAMd,GAAM,eAAgB,CAAEe,gBAAiBf,IAE/DgB,OAAAA,EAAAA,UAAU,MAEU,IAAZV,IACkB,IAAlBC,GACyB,eAAzBU,QAAQC,IAAIC,UAEZC,QAAQC,KACJ,wFAGJZ,EAASG,UACTH,EAASG,QAAQL,eAAiBD,KAAaC,IAEpD,CAACD,EAASC,IAGTe,EAAAA,KAAC,MAAA,CACGnB,UAAWoB,EAAAA,KAAK,eAAgBpB,EAAW,CACvC,uBAAwBC,EACxB,sBAAuBF,IAG3BD,SAAA,CAAAuB,EAAAA,IAAC,QAAA,CACGxB,GAAIa,EACJd,IAAKU,EACLN,UAAU,sBACV,cAAY,qBACZ,eAAcD,EACduB,KAAK,WACL,kBAAiBpB,EACjBC,QAAAA,KACIE,UAEP,QAAA,CAAMkB,QAASb,EAASV,UAAU,sBAC9BF,SAAAA,SAOrBL,EAAS+B,YAAc"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChangeEventHandler, FocusEventHandler, InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import { DataTestAutoId } from '../../
|
|
2
|
+
import { DataTestAutoId } from '../../utilities/types.cjs';
|
|
3
3
|
export interface CheckboxProps extends DataTestAutoId, InputHTMLAttributes<HTMLInputElement> {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
name: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),t=require("react-dom"),o=require("../button/Button.cjs"),r=require("../flex/Flex.cjs"),i=require("../link/Link.cjs"),s=require("../modal/Modal.cjs"),a=require("../modal/useModal.cjs"),l=require("./CookieConsentContext.cjs"),d=require("./cookieConsentUtils.cjs");exports.CookieConsent=({blocking:c,onAccept:u,aboutPage:k="https://www.fremtind.no/informasjonskapsler",aboutPageLinkText:j="Les mer om hvilke informasjonskapsler vi lagrer her",...m})=>{const{currentConsent:h,cookieName:f,cookieDomain:p,cookiePath:g,isOpen:x,setIsOpen:b,updateCurrentConsents:v}=l.useInternalState(),[C,y]=a.useModal({id:`jkl-cookie-modal-${n.useId()}`,role:c?"alertdialog":"dialog",title:"Informasjonskapsler"});if(n.useEffect(()=>{x?C?.show():C?.hide()},[C,x]),n.useEffect(()=>{const e=()=>b(!1);return C?.on("hide",e),()=>{C?.off("hide",e)}},[C,b]),typeof document>"u")return null;if(typeof navigator<"u"&&!navigator.cookieEnabled)return u?.({functional:"denied",statistics:"denied",marketing:"denied"}),null;const M=e=>{const n={...h,functional:e,statistics:e,marketing:"denied"};d.setConsentCookie({consent:n,name:f,domain:p,path:g}),u?.(n),v(),C?.hide()};return t.createPortal(e.jsxs(s.ModalContainer,{...y.container,...m,"data-cookie-consent-open":x,children:[e.jsx(s.ModalOverlay,{...y.overlay}),e.jsxs(s.Modal,{...y.modal,children:[e.jsx(s.ModalHeader,{children:e.jsx(s.ModalTitle,{...y.title,children:"Får vi bruke valgfrie informasjonskapsler?"})}),e.jsx(s.ModalBody,{children:e.jsxs(r.Flex,{direction:"column",gap:"m",children:[e.jsx("p",{children:"Fremtind ønsker å samle anonym statistikk for å forstå hvordan nettsidene våre brukes. Det hjelper oss til å gjøre innhold og løsninger bedre og mer brukervennlige."}),e.jsxs("p",{children:[e.jsx(i.Link,{href:k,target:"_blank",children:j}),"."]})]})}),e.jsxs(s.ModalActions,{children:[e.jsx(o.Button,{variant:"secondary","data-testid":"jkl-cookie-consent-godta",type:"button",onClick:()=>M("accepted"),children:"Ja, det er greit"}),e.jsx(o.Button,{variant:"secondary","data-testid":"jkl-cookie-consent-nekt",type:"button",onClick:()=>M("denied"),children:"Nei takk"})]})]})]}),document.body)};
|
|
2
2
|
//# sourceMappingURL=CookieConsent.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CookieConsent.cjs","sources":["../../../../src/components/cookie-consent/CookieConsent.tsx"],"sourcesContent":["import React, { useEffect, useId } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { Button } from \"../button/Button.js\";\nimport { Flex } from \"../flex/index.js\";\nimport { Link } from \"../link/index.js\";\nimport {\n Modal,\n ModalActions,\n ModalBody,\n ModalContainer,\n ModalHeader,\n ModalOverlay,\n ModalTitle,\n} from \"../modal/Modal.js\";\nimport { useModal } from \"../modal/useModal.js\";\nimport { useInternalState } from \"./CookieConsentContext.js\";\nimport { setConsentCookie } from \"./cookieConsentUtils.js\";\nimport type { Consent, ConsentState, CookieConsentProps } from \"./types.js\";\n\nexport const CookieConsent = ({\n blocking,\n onAccept,\n aboutPage = \"https://www.fremtind.no/informasjonskapsler\",\n ...rest\n}: CookieConsentProps): JSX.Element | null => {\n const {\n currentConsent,\n cookieName,\n cookieDomain,\n cookiePath,\n isOpen,\n setIsOpen,\n updateCurrentConsents,\n } = useInternalState();\n\n const [instance, modalConfig] = useModal({\n id: `jkl-cookie-modal-${useId()}`,\n // The optional `role` attribute of the dialog element, either `dialog`\n // (default) or `alertdialog` to make it a modal (preventing closing on\n // click outside of ESC key).\n role: blocking ? \"alertdialog\" : \"dialog\",\n // The required dialog title, mandatory in the document\n // to provide context to assistive technology.\n title: \"Informasjonskapsler\",\n });\n useEffect(() => {\n if (isOpen) {\n instance?.show();\n } else {\n instance?.hide();\n }\n }, [instance, isOpen]);\n\n useEffect(() => {\n const onHide = () => setIsOpen(false);\n instance?.on(\"hide\", onHide);\n return () => {\n instance?.off(\"hide\", onHide);\n };\n }, [instance, setIsOpen]);\n\n if (typeof document === \"undefined\") {\n return null;\n }\n\n // Cookies are disabled in the browser\n if (typeof navigator !== \"undefined\" && !navigator.cookieEnabled) {\n onAccept?.({\n functional: \"denied\",\n statistics: \"denied\",\n marketing: \"denied\",\n });\n\n return null;\n }\n\n const updateCookies = (state: ConsentState) => {\n const updatedConsent: Consent = {\n ...currentConsent,\n functional: state,\n statistics: state,\n marketing: \"denied\",\n };\n\n setConsentCookie({\n consent: updatedConsent,\n name: cookieName,\n domain: cookieDomain,\n path: cookiePath,\n });\n\n onAccept?.(updatedConsent);\n\n updateCurrentConsents();\n\n instance?.hide();\n };\n\n return ReactDOM.createPortal(\n <ModalContainer\n {...modalConfig.container}\n {...rest}\n data-cookie-consent-open={isOpen}\n >\n <ModalOverlay {...modalConfig.overlay} />\n <Modal {...modalConfig.modal}>\n <ModalHeader>\n <ModalTitle {...modalConfig.title}>\n Får vi bruke valgfrie
|
|
1
|
+
{"version":3,"file":"CookieConsent.cjs","sources":["../../../../src/components/cookie-consent/CookieConsent.tsx"],"sourcesContent":["import React, { useEffect, useId } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { Button } from \"../button/Button.js\";\nimport { Flex } from \"../flex/index.js\";\nimport { Link } from \"../link/index.js\";\nimport {\n Modal,\n ModalActions,\n ModalBody,\n ModalContainer,\n ModalHeader,\n ModalOverlay,\n ModalTitle,\n} from \"../modal/Modal.js\";\nimport { useModal } from \"../modal/useModal.js\";\nimport { useInternalState } from \"./CookieConsentContext.js\";\nimport { setConsentCookie } from \"./cookieConsentUtils.js\";\nimport type { Consent, ConsentState, CookieConsentProps } from \"./types.js\";\n\nexport const CookieConsent = ({\n blocking,\n onAccept,\n aboutPage = \"https://www.fremtind.no/informasjonskapsler\",\n aboutPageLinkText = \"Les mer om hvilke informasjonskapsler vi lagrer her\",\n ...rest\n}: CookieConsentProps): JSX.Element | null => {\n const {\n currentConsent,\n cookieName,\n cookieDomain,\n cookiePath,\n isOpen,\n setIsOpen,\n updateCurrentConsents,\n } = useInternalState();\n\n const [instance, modalConfig] = useModal({\n id: `jkl-cookie-modal-${useId()}`,\n // The optional `role` attribute of the dialog element, either `dialog`\n // (default) or `alertdialog` to make it a modal (preventing closing on\n // click outside of ESC key).\n role: blocking ? \"alertdialog\" : \"dialog\",\n // The required dialog title, mandatory in the document\n // to provide context to assistive technology.\n title: \"Informasjonskapsler\",\n });\n useEffect(() => {\n if (isOpen) {\n instance?.show();\n } else {\n instance?.hide();\n }\n }, [instance, isOpen]);\n\n useEffect(() => {\n const onHide = () => setIsOpen(false);\n instance?.on(\"hide\", onHide);\n return () => {\n instance?.off(\"hide\", onHide);\n };\n }, [instance, setIsOpen]);\n\n if (typeof document === \"undefined\") {\n return null;\n }\n\n // Cookies are disabled in the browser\n if (typeof navigator !== \"undefined\" && !navigator.cookieEnabled) {\n onAccept?.({\n functional: \"denied\",\n statistics: \"denied\",\n marketing: \"denied\",\n });\n\n return null;\n }\n\n const updateCookies = (state: ConsentState) => {\n const updatedConsent: Consent = {\n ...currentConsent,\n functional: state,\n statistics: state,\n marketing: \"denied\",\n };\n\n setConsentCookie({\n consent: updatedConsent,\n name: cookieName,\n domain: cookieDomain,\n path: cookiePath,\n });\n\n onAccept?.(updatedConsent);\n\n updateCurrentConsents();\n\n instance?.hide();\n };\n\n return ReactDOM.createPortal(\n <ModalContainer\n {...modalConfig.container}\n {...rest}\n data-cookie-consent-open={isOpen}\n >\n <ModalOverlay {...modalConfig.overlay} />\n <Modal {...modalConfig.modal}>\n <ModalHeader>\n <ModalTitle {...modalConfig.title}>\n Får vi bruke valgfrie informasjons­kapsler?\n </ModalTitle>\n </ModalHeader>\n <ModalBody>\n <Flex direction=\"column\" gap=\"m\">\n <p>\n Fremtind ønsker å samle anonym statistikk for å\n forstå hvordan nettsidene våre brukes. Det hjelper\n oss til å gjøre innhold og løsninger bedre og mer\n brukervennlige.\n </p>\n <p>\n <Link href={aboutPage} target=\"_blank\">\n {aboutPageLinkText}\n </Link>\n .\n </p>\n </Flex>\n </ModalBody>\n <ModalActions>\n <Button\n variant=\"secondary\"\n data-testid=\"jkl-cookie-consent-godta\"\n type=\"button\"\n onClick={() => updateCookies(\"accepted\")}\n >\n Ja, det er greit\n </Button>\n <Button\n variant=\"secondary\"\n data-testid=\"jkl-cookie-consent-nekt\"\n type=\"button\"\n onClick={() => updateCookies(\"denied\")}\n >\n Nei takk\n </Button>\n </ModalActions>\n </Modal>\n </ModalContainer>,\n document.body,\n );\n};\n"],"names":["blocking","onAccept","aboutPage","aboutPageLinkText","rest","currentConsent","cookieName","cookieDomain","cookiePath","isOpen","setIsOpen","updateCurrentConsents","useInternalState","instance","modalConfig","useModal","id","useId","role","title","useEffect","show","hide","onHide","on","off","document","navigator","cookieEnabled","functional","statistics","marketing","updateCookies","state","updatedConsent","setConsentCookie","consent","name","domain","path","ReactDOM","createPortal","jsxs","ModalContainer","container","children","jsx","ModalOverlay","overlay","Modal","modal","ModalHeader","ModalTitle","ModalBody","Flex","direction","gap","Link","href","target","ModalActions","Button","variant","type","onClick","body"],"mappings":"oaAmB6B,EACzBA,SAAAA,EACAC,SAAAA,EACAC,UAAAA,EAAY,8CACZC,kBAAAA,EAAoB,0DACjBC,MAEH,MACIC,eAAAA,EACAC,WAAAA,EACAC,aAAAA,EACAC,WAAAA,EACAC,OAAAA,EACAC,UAAAA,EACAC,sBAAAA,GACAC,sBAEGC,EAAUC,GAAeC,WAAS,CACrCC,GAAI,oBAAoBC,EAAAA,UAIxBC,KAAMlB,EAAW,cAAgB,SAGjCmB,MAAO,wBAkBX,GAhBAC,EAAAA,UAAU,KACF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AAA,CACGC,QAAQ,YACR,cAAY,0BACZC,KAAK,SACLC,QAAS,IAAMhC,EAAc,UAChCa,SAAA,sBAMbnB,SAASuC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CookieConsentProps } from './types.cjs';
|
|
2
|
-
export declare const CookieConsent: ({ blocking, onAccept, aboutPage, ...rest }: CookieConsentProps) => JSX.Element | null;
|
|
2
|
+
export declare const CookieConsent: ({ blocking, onAccept, aboutPage, aboutPageLinkText, ...rest }: CookieConsentProps) => JSX.Element | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WithChildren } from '../../
|
|
1
|
+
import { WithChildren } from '../../utilities/types.cjs';
|
|
2
2
|
export type ConsentState = null | "denied" | "accepted";
|
|
3
3
|
export type ConsentRequirement = Partial<Record<keyof Consent, boolean>>;
|
|
4
4
|
export type Consent = {
|
|
@@ -13,6 +13,10 @@ export interface CookieConsentProps {
|
|
|
13
13
|
* Lenke til informasjonssiden til cookiene i løsningen din.
|
|
14
14
|
*/
|
|
15
15
|
aboutPage: string;
|
|
16
|
+
/**
|
|
17
|
+
* Tekst for lenken til informasjonssiden.
|
|
18
|
+
*/
|
|
19
|
+
aboutPageLinkText?: string;
|
|
16
20
|
}
|
|
17
21
|
export type AcceptConsentCallback = (consent: Consent) => void;
|
|
18
22
|
export type ConsentComponentBaseProps = {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("../../../clsx-E3yX_9sL.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("../../../clsx-E3yX_9sL.cjs"),r=require("../../../utils-DxmZDrR9.cjs"),a=require("react"),n=require("react-dom"),o=require("../../utilities/formatters/date/formatDate.cjs"),l=require("../icon-button/IconButton.cjs"),u=require("../icon/icons/CalendarIcon.cjs"),s=require("../input-group/InputGroup.cjs"),i=require("../popover/Popover.cjs"),c=require("../text-input/BaseTextInput.cjs"),d=require("./internal/Calendar.cjs"),p=require("./utils.cjs"),f=require("./validation.cjs"),v=a.forwardRef((v,D)=>{const{"data-testautoid":m,id:b,className:g="",label:j="Velg dato",labelProps:k,defaultValue:h,defaultShow:y=!1,value:x,disableBeforeDate:C,disableAfterDate:S,yearsToShow:L,name:P,helpLabel:q,errorLabel:w,invalid:I,days:O,months:T,monthLabel:B,yearLabel:E,placeholder:_="dd.mm.åååå",width:R="11.25rem",onChange:N,onBlur:U,onFocus:V,onKeyDown:F,action:K,showCalendarLabel:M="Åpne kalender",hideCalendarLabel:W="Lukk kalender",supportLabelProps:A,tooltip:G,textInputProps:H,description:$,...z}=v;"production"!==process.env.NODE_ENV&&x&&h&&console.warn("DatePicker må enten være controlled eller uncontrolled. Hvis du bruker defaultValue og value sammen vil defaultValue bli ignorert.");const J=p.parseDateString(C),Q=J?r.dayjs(J).startOf("day").toDate():void 0,X=p.parseDateString(S),Y=X?r.dayjs(X).startOf("day").toDate():void 0,[Z,ee]=a.useState(r.getInitialDate(x,h,Q,Y)),[te,re]=a.useState(null),[ae,ne]=a.useState(y),oe=a.useRef(null),le=a.useRef(null),ue=a.useRef(null),se=a.useRef(null),ie=a.useRef(!1),ce=a.useCallback(e=>{se.current=e,D&&("function"==typeof D?D(e):D.current=e)},[D]),de=a.useCallback(e=>{V&&le.current&&(le.current.contains(e.relatedTarget)||V(e,Z,{error:te,value:e.target.value}))},[V,Z,te]),pe=a.useCallback(e=>{U&&U(e,Z,{error:te,value:e.target.value})},[U,Z,te]),fe=a.useCallback(e=>{"Escape"===e.key&&(ne(!1),e.preventDefault(),e.stopPropagation()),K?.onKeyDown&&K.onKeyDown(e)},[K]),ve=a.useCallback(e=>{const t=e.currentTarget.value,r=((e,t)=>{const r=e.replace(/\D/g,""),a=o.formatDateString(r,{partial:!0}),n=e.replace(/\D+$/,""),l=8===r.length?o.formatDateString(r):e,u=p.parseDateString(l)?l:null,s=t&&e!==r&&n===a&&void 0===p.parseDateString(e)&&null===u;return u??(s?r:e)})(t,ie.current);r!==t&&((e,t)=>{const r=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set;r?r.call(e,t):e.value=t})(e.currentTarget,r);const a=t.replace(/\D/g,"");ie.current=t===a&&r===o.formatDateString(a)&&r!==t&&void 0!==p.parseDateString(r);const{date:n,error:l}=(({value:e,minDate:t,maxDate:r})=>{if(!e)return{date:null,error:null};const a=p.parseDateString(e);return a?t&&!f.isWithinLowerBound(a,t)?{date:a,error:"OUTSIDE_LOWER_BOUND"}:r&&!f.isWithinUpperBound(a,r)?{date:a,error:"OUTSIDE_UPPER_BOUND"}:{date:a,error:null}:{date:null,error:"WRONG_FORMAT"}})({value:r,minDate:Q,maxDate:Y});n&&!l&&ne(!1),re(l),ee(n),N&&N(e,n,{error:l,value:r})},[N,Q,Y]),De=a.useCallback(e=>{n.flushSync(()=>{ne(!ae)});const t=oe.current,r=t&&t.querySelector('[aria-pressed="true"]');window.requestAnimationFrame(()=>r?.focus()),K?.onClick&&K.onClick(e)},[ae,K]),me=a.useCallback(({date:e})=>{if(ne(!1),ee(e),se.current){const t=se.current;ie.current=!1,t.value=p.formatInput(e);const r=document.createEvent("HTMLEvents");r.initEvent("input",!0,!1),t.dispatchEvent(r),t.focus(),N&&N(r,e,{error:null,value:t.value})}},[N]),be=a.useCallback(e=>{e.preventDefault(),ne(!1),ue.current?.focus()},[]);return e.jsx(s.InputGroup,{id:b,className:t.clsx("jkl-datepicker",g),...z,ref:le,label:j,labelProps:k,helpLabel:q,errorLabel:w,supportLabelProps:A,tooltip:G,description:$,render:t=>e.jsx(c.BaseTextInput,{"data-focused":ae?"true":void 0,ref:ce,"data-testid":"jkl-datepicker__input","data-testautoid":m,className:"jkl-datepicker__input",name:P,defaultValue:h,value:x,type:"text",placeholder:_,width:R,onFocus:de,onBlur:pe,onChange:ve,actionButton:e.jsxs(i.Popover,{positionReference:se,open:ae,onOpenChange:()=>ne(!ae),offset:8,children:[e.jsx(i.Popover.Trigger,{...K,"data-testid":"jkl-datepicker__trigger",className:"jkl-text-input-action-button",title:ae?W:M,tabIndex:0,onClick:De,onKeyDown:fe,asChild:!0,children:e.jsx(l.IconButton,{children:e.jsx(u.CalendarIcon,{})})}),e.jsx(i.Popover.Content,{initialFocus:-1,padding:24,children:e.jsx(d.Calendar,{ref:oe,date:Z,minDate:Q,maxDate:Y,days:O,months:T,monthLabel:B,yearLabel:E,yearsToShow:L,onDateSelected:me,onTabOutside:be})})]}),...H,...t,"aria-invalid":I||!!w})})});v.displayName="DatePicker",exports.DatePicker=v;
|
|
2
2
|
//# sourceMappingURL=DatePicker.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.cjs","sources":["../../../../src/components/datepicker/DatePicker.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport dayjs from \"dayjs\";\nimport React, {\n type ChangeEvent,\n type FocusEvent,\n type KeyboardEvent,\n type MouseEvent,\n forwardRef,\n useCallback,\n useRef,\n useState,\n} from \"react\";\nimport { flushSync } from \"react-dom\";\nimport { IconButton } from \"../icon-button/IconButton.js\";\nimport { CalendarIcon } from \"../icon/icons/CalendarIcon.js\";\nimport { InputGroup } from \"../input-group/InputGroup.js\";\nimport Popover from \"../popover/Popover.js\";\nimport { BaseTextInput } from \"../text-input/BaseTextInput.js\";\nimport { Calendar } from \"./internal/Calendar.js\";\nimport { type DateInfo, getInitialDate } from \"./internal/utils.js\";\nimport type { DatePickerProps, DateValidationError } from \"./types.js\";\nimport { formatInput, parseDateString } from \"./utils.js\";\nimport { isWithinLowerBound, isWithinUpperBound } from \"./validation.js\";\n\nexport const DatePicker = forwardRef<HTMLInputElement, DatePickerProps>(\n (props, forwardedInputRef) => {\n const {\n \"data-testautoid\": testAutoId,\n id,\n className = \"\",\n label = \"Velg dato\",\n labelProps,\n defaultValue,\n defaultShow = false,\n value,\n disableBeforeDate: disableBefore,\n disableAfterDate: disableAfter,\n yearsToShow,\n name,\n helpLabel,\n errorLabel,\n invalid,\n days,\n months,\n monthLabel,\n yearLabel,\n placeholder = \"dd.mm.åååå\",\n width = \"11.25rem\",\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n action,\n showCalendarLabel = \"Åpne kalender\",\n hideCalendarLabel = \"Lukk kalender\",\n supportLabelProps,\n tooltip,\n textInputProps,\n description,\n ...rest\n } = props;\n\n if (process.env.NODE_ENV !== \"production\" && value && defaultValue) {\n console.warn(\n \"DatePicker må enten være controlled eller uncontrolled. Hvis du bruker defaultValue og value sammen vil defaultValue bli ignorert.\",\n );\n }\n /// Input state\n\n const disableBeforeDate = parseDateString(disableBefore);\n const minDate = disableBeforeDate\n ? dayjs(disableBeforeDate).startOf(\"day\").toDate()\n : undefined;\n const disableAfterDate = parseDateString(disableAfter);\n const maxDate = disableAfterDate\n ? dayjs(disableAfterDate).startOf(\"day\").toDate()\n : undefined;\n\n const [date, setDate] = useState(\n getInitialDate(value, defaultValue, minDate, maxDate),\n );\n const [error, setError] = useState<DateValidationError | null>(null);\n\n /// Calendar state\n\n const [showCalendar, setShowCalendar] = useState(defaultShow);\n\n const calendarRef = useRef<HTMLDivElement>(null);\n const datepickerRef = useRef<HTMLDivElement>(null);\n\n /// Input events\n\n const iconButtonRef = useRef<HTMLButtonElement | null>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n // Hjelper for å gjøre det enklere å både forwarde refen men også bruke den selv internt\n const unifiedInputRef = useCallback(\n (instance: HTMLInputElement | null) => {\n inputRef.current = instance;\n if (forwardedInputRef) {\n if (typeof forwardedInputRef === \"function\") {\n forwardedInputRef(instance);\n } else {\n forwardedInputRef.current = instance;\n }\n }\n },\n [forwardedInputRef],\n );\n\n const handleFocus = useCallback(\n (e: FocusEvent<HTMLInputElement>) => {\n if (!onFocus || !datepickerRef.current) {\n return;\n }\n\n const nextFocusIsInside = datepickerRef.current.contains(\n e.relatedTarget as Node,\n );\n if (!nextFocusIsInside) {\n onFocus(e, date, { error, value: e.target.value });\n }\n },\n [onFocus, date, error],\n );\n\n const handleBlur = useCallback(\n (e: FocusEvent<HTMLInputElement>) => {\n if (onBlur) {\n onBlur(e, date, { error, value: e.target.value });\n }\n },\n [onBlur, date, error],\n );\n\n const handleKeyDownAction = useCallback(\n (e: React.KeyboardEvent<HTMLButtonElement>) => {\n if (e.key === \"Escape\") {\n setShowCalendar(false);\n e.preventDefault();\n e.stopPropagation();\n }\n\n if (action?.onKeyDown) {\n action.onKeyDown(e);\n }\n },\n [action],\n );\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n let nextDate: Date | null = null;\n let nextError: DateValidationError | null = null;\n\n if (e.target.value) {\n const val = parseDateString(e.target.value);\n if (!val) {\n nextError = \"WRONG_FORMAT\";\n } else if (minDate && !isWithinLowerBound(val, minDate)) {\n nextError = \"OUTSIDE_LOWER_BOUND\";\n } else if (maxDate && !isWithinUpperBound(val, maxDate)) {\n nextError = \"OUTSIDE_UPPER_BOUND\";\n } else {\n setShowCalendar(false);\n }\n nextDate = val || null;\n }\n\n setError(nextError);\n setDate(nextDate);\n\n if (onChange) {\n onChange(e, nextDate, {\n error: nextError,\n value: e.target.value,\n });\n }\n },\n [onChange, minDate, maxDate],\n );\n\n /// Calendar events\n\n const clickCalendar = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n flushSync(() => {\n setShowCalendar(!showCalendar);\n });\n\n const calendarEl = calendarRef.current;\n const button =\n calendarEl &&\n (calendarEl.querySelector(\n '[aria-pressed=\"true\"]',\n ) as HTMLButtonElement);\n // Make sure the popover-modal is correctly positioned before focusing a button\n // so we avoid accidentally scrolling to the top of the page\n window.requestAnimationFrame(() => button?.focus());\n\n if (action?.onClick) {\n action.onClick(e);\n }\n },\n [showCalendar, action],\n );\n\n const handleClickCalendarDay = useCallback(\n ({ date }: DateInfo) => {\n setShowCalendar(false);\n setDate(date);\n\n if (inputRef.current) {\n const node = inputRef.current;\n\n node.value = formatInput(date);\n\n // Simulér et change-event så APIet blir så likt som mulig en endring av inputfeltet\n const event = document.createEvent(\"HTMLEvents\");\n event.initEvent(\"input\", true, false);\n node.dispatchEvent(event);\n\n node.focus();\n\n if (onChange) {\n // Det er ikke helt sant at dette er et React.SyntheticEvent, men it's fine – probably?\n // Den har tingene man kan forvente, men hvis du gjør serdeles fancy ting med events\n // så kan det hende du må utvide denne for å dekke behovet ditt.\n onChange(\n event as unknown as ChangeEvent<HTMLInputElement>,\n date,\n {\n error: null,\n value: node.value,\n },\n );\n }\n }\n },\n [onChange],\n );\n\n const handleTabOutsideCalendar = useCallback((e: KeyboardEvent) => {\n e.preventDefault();\n setShowCalendar(false);\n iconButtonRef.current?.focus();\n }, []);\n\n return (\n <InputGroup\n id={id}\n className={clsx(\"jkl-datepicker\", className)}\n {...rest}\n ref={datepickerRef}\n label={label}\n labelProps={labelProps}\n helpLabel={helpLabel}\n errorLabel={errorLabel}\n supportLabelProps={supportLabelProps}\n tooltip={tooltip}\n description={description}\n render={(inputProps) => (\n <BaseTextInput\n data-focused={showCalendar ? \"true\" : undefined}\n ref={unifiedInputRef}\n data-testid=\"jkl-datepicker__input\"\n data-testautoid={testAutoId}\n className=\"jkl-datepicker__input\"\n name={name}\n defaultValue={defaultValue}\n value={value}\n type=\"text\"\n placeholder={placeholder}\n width={width}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onChange={handleChange}\n actionButton={\n <Popover\n positionReference={inputRef}\n open={showCalendar}\n onOpenChange={() =>\n setShowCalendar(!showCalendar)\n }\n offset={8}\n >\n <Popover.Trigger\n {...action}\n data-testid=\"jkl-datepicker__trigger\"\n className=\"jkl-text-input-action-button\"\n title={\n showCalendar\n ? hideCalendarLabel\n : showCalendarLabel\n }\n tabIndex={0}\n onClick={clickCalendar}\n onKeyDown={handleKeyDownAction}\n asChild\n >\n <IconButton>\n <CalendarIcon />\n </IconButton>\n </Popover.Trigger>\n <Popover.Content initialFocus={-1} padding={24}>\n <Calendar\n ref={calendarRef}\n date={date}\n minDate={minDate}\n maxDate={maxDate}\n days={days}\n months={months}\n monthLabel={monthLabel}\n yearLabel={yearLabel}\n yearsToShow={yearsToShow}\n onDateSelected={handleClickCalendarDay}\n onTabOutside={handleTabOutsideCalendar}\n />\n </Popover.Content>\n </Popover>\n }\n {...textInputProps}\n {...inputProps}\n aria-invalid={invalid || !!errorLabel}\n />\n )}\n />\n );\n },\n);\n\nDatePicker.displayName = \"DatePicker\";\n"],"names":["DatePicker","forwardRef","props","forwardedInputRef","testAutoId","id","className","label","labelProps","defaultValue","defaultShow","value","disableBeforeDate","disableBefore","disableAfterDate","disableAfter","yearsToShow","name","helpLabel","errorLabel","invalid","days","months","monthLabel","yearLabel","placeholder","width","onChange","onBlur","onFocus","onKeyDown","action","showCalendarLabel","hideCalendarLabel","supportLabelProps","tooltip","textInputProps","description","rest","process","env","NODE_ENV","console","warn","parseDateString","minDate","dayjs","startOf","toDate","maxDate","date","setDate","useState","getInitialDate","error","setError","showCalendar","setShowCalendar","calendarRef","useRef","datepickerRef","iconButtonRef","inputRef","unifiedInputRef","useCallback","instance","current","handleFocus","e","contains","relatedTarget","target","handleBlur","handleKeyDownAction","key","preventDefault","stopPropagation","handleChange","nextDate","nextError","val","isWithinLowerBound","isWithinUpperBound","clickCalendar","flushSync","calendarEl","button","querySelector","window","requestAnimationFrame","focus","onClick","handleClickCalendarDay","node","formatInput","event","document","createEvent","initEvent","dispatchEvent","handleTabOutsideCalendar","jsx","InputGroup","clsx","ref","render","inputProps","BaseTextInput","type","actionButton","jsxs","Popover","positionReference","open","onOpenChange","offset","children","Trigger","title","tabIndex","asChild","IconButton","CalendarIcon","Content","initialFocus","padding","Calendar","onDateSelected","onTabOutside","displayName"],"mappings":"+hBAwBaA,EAAaC,EAAAA,WACtB,CAACC,EAAOC,KACJ,MACI,kBAAmBC,EACnBC,GAAAA,EACAC,UAAAA,EAAY,GACZC,MAAAA,EAAQ,YACRC,WAAAA,EACAC,aAAAA,EACAC,YAAAA,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,KAAAA,EACAL,QAAAA,EACAI,QAAAA,EACA5B,KAAAA,EACAC,OAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAR,YAAAA,EACA+G,eAAgBnC,GAChBoC,aAAc5B,aAK1BhE,KACAsE,EACJ,eAActF,KAAaD,QAQnDnB,EAAWiI,YAAc"}
|
|
1
|
+
{"version":3,"file":"DatePicker.cjs","sources":["../../../../src/components/datepicker/DatePicker.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport dayjs from \"dayjs\";\nimport React, {\n type ChangeEvent,\n type FocusEvent,\n type KeyboardEvent,\n type MouseEvent,\n forwardRef,\n useCallback,\n useRef,\n useState,\n} from \"react\";\nimport { flushSync } from \"react-dom\";\nimport { formatDateString } from \"../../utilities/formatters/date/formatDate.js\";\nimport { IconButton } from \"../icon-button/IconButton.js\";\nimport { CalendarIcon } from \"../icon/icons/CalendarIcon.js\";\nimport { InputGroup } from \"../input-group/InputGroup.js\";\nimport Popover from \"../popover/Popover.js\";\nimport { BaseTextInput } from \"../text-input/BaseTextInput.js\";\nimport { Calendar } from \"./internal/Calendar.js\";\nimport { type DateInfo, getInitialDate } from \"./internal/utils.js\";\nimport type { DatePickerProps, DateValidationError } from \"./types.js\";\nimport { formatInput, parseDateString } from \"./utils.js\";\nimport { isWithinLowerBound, isWithinUpperBound } from \"./validation.js\";\n\nconst setInputValue = (input: HTMLInputElement, value: string) => {\n const nativeSetter = Object.getOwnPropertyDescriptor(\n HTMLInputElement.prototype,\n \"value\",\n )?.set;\n\n if (nativeSetter) {\n nativeSetter.call(input, value);\n } else {\n input.value = value;\n }\n};\n\nconst normalizeInputValue = (\n rawValue: string,\n shouldStripAutoFormatting: boolean,\n) => {\n const digits = rawValue.replace(/\\D/g, \"\");\n const partialCompactDate = formatDateString(digits, {\n partial: true,\n });\n const rawValueWithoutTrailingPunctuation = rawValue.replace(/\\D+$/, \"\");\n const compactDateCandidate =\n digits.length === 8 ? formatDateString(digits) : rawValue;\n const validCompactDate = parseDateString(compactDateCandidate)\n ? compactDateCandidate\n : null;\n const shouldRemoveFormatting =\n shouldStripAutoFormatting &&\n rawValue !== digits &&\n rawValueWithoutTrailingPunctuation === partialCompactDate &&\n parseDateString(rawValue) === undefined &&\n validCompactDate === null;\n\n return validCompactDate ?? (shouldRemoveFormatting ? digits : rawValue);\n};\n\nconst getInputValidationState = ({\n value,\n minDate,\n maxDate,\n}: {\n value: string;\n minDate?: Date;\n maxDate?: Date;\n}): { date: Date | null; error: DateValidationError | null } => {\n if (!value) {\n return { date: null, error: null };\n }\n\n const parsedDate = parseDateString(value);\n\n if (!parsedDate) {\n return { date: null, error: \"WRONG_FORMAT\" };\n }\n\n if (minDate && !isWithinLowerBound(parsedDate, minDate)) {\n return { date: parsedDate, error: \"OUTSIDE_LOWER_BOUND\" };\n }\n\n if (maxDate && !isWithinUpperBound(parsedDate, maxDate)) {\n return { date: parsedDate, error: \"OUTSIDE_UPPER_BOUND\" };\n }\n\n return { date: parsedDate, error: null };\n};\n\nexport const DatePicker = forwardRef<HTMLInputElement, DatePickerProps>(\n (props, forwardedInputRef) => {\n const {\n \"data-testautoid\": testAutoId,\n id,\n className = \"\",\n label = \"Velg dato\",\n labelProps,\n defaultValue,\n defaultShow = false,\n value,\n disableBeforeDate: disableBefore,\n disableAfterDate: disableAfter,\n yearsToShow,\n name,\n helpLabel,\n errorLabel,\n invalid,\n days,\n months,\n monthLabel,\n yearLabel,\n placeholder = \"dd.mm.åååå\",\n width = \"11.25rem\",\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n action,\n showCalendarLabel = \"Åpne kalender\",\n hideCalendarLabel = \"Lukk kalender\",\n supportLabelProps,\n tooltip,\n textInputProps,\n description,\n ...rest\n } = props;\n\n if (process.env.NODE_ENV !== \"production\" && value && defaultValue) {\n console.warn(\n \"DatePicker må enten være controlled eller uncontrolled. Hvis du bruker defaultValue og value sammen vil defaultValue bli ignorert.\",\n );\n }\n /// Input state\n\n const disableBeforeDate = parseDateString(disableBefore);\n const minDate = disableBeforeDate\n ? dayjs(disableBeforeDate).startOf(\"day\").toDate()\n : undefined;\n const disableAfterDate = parseDateString(disableAfter);\n const maxDate = disableAfterDate\n ? dayjs(disableAfterDate).startOf(\"day\").toDate()\n : undefined;\n\n const [date, setDate] = useState(\n getInitialDate(value, defaultValue, minDate, maxDate),\n );\n const [error, setError] = useState<DateValidationError | null>(null);\n\n /// Calendar state\n\n const [showCalendar, setShowCalendar] = useState(defaultShow);\n\n const calendarRef = useRef<HTMLDivElement>(null);\n const datepickerRef = useRef<HTMLDivElement>(null);\n\n /// Input events\n\n const iconButtonRef = useRef<HTMLButtonElement | null>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const didAutoFormatCompactInputRef = useRef(false);\n\n // Hjelper for å gjøre det enklere å både forwarde refen men også bruke den selv internt\n const unifiedInputRef = useCallback(\n (instance: HTMLInputElement | null) => {\n inputRef.current = instance;\n if (forwardedInputRef) {\n if (typeof forwardedInputRef === \"function\") {\n forwardedInputRef(instance);\n } else {\n forwardedInputRef.current = instance;\n }\n }\n },\n [forwardedInputRef],\n );\n\n const handleFocus = useCallback(\n (e: FocusEvent<HTMLInputElement>) => {\n if (!onFocus || !datepickerRef.current) {\n return;\n }\n\n const nextFocusIsInside = datepickerRef.current.contains(\n e.relatedTarget as Node,\n );\n if (!nextFocusIsInside) {\n onFocus(e, date, { error, value: e.target.value });\n }\n },\n [onFocus, date, error],\n );\n\n const handleBlur = useCallback(\n (e: FocusEvent<HTMLInputElement>) => {\n if (onBlur) {\n onBlur(e, date, { error, value: e.target.value });\n }\n },\n [onBlur, date, error],\n );\n\n const handleKeyDownAction = useCallback(\n (e: React.KeyboardEvent<HTMLButtonElement>) => {\n if (e.key === \"Escape\") {\n setShowCalendar(false);\n e.preventDefault();\n e.stopPropagation();\n }\n\n if (action?.onKeyDown) {\n action.onKeyDown(e);\n }\n },\n [action],\n );\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n const rawValue = e.currentTarget.value;\n const formattedValue = normalizeInputValue(\n rawValue,\n didAutoFormatCompactInputRef.current,\n );\n\n if (formattedValue !== rawValue) {\n setInputValue(e.currentTarget, formattedValue);\n }\n\n const digits = rawValue.replace(/\\D/g, \"\");\n didAutoFormatCompactInputRef.current =\n rawValue === digits &&\n formattedValue === formatDateString(digits) &&\n formattedValue !== rawValue &&\n parseDateString(formattedValue) !== undefined;\n\n const { date: nextDate, error: nextError } =\n getInputValidationState({\n value: formattedValue,\n minDate,\n maxDate,\n });\n\n if (nextDate && !nextError) {\n setShowCalendar(false);\n }\n\n setError(nextError);\n setDate(nextDate);\n\n if (onChange) {\n onChange(e, nextDate, {\n error: nextError,\n value: formattedValue,\n });\n }\n },\n [onChange, minDate, maxDate],\n );\n\n /// Calendar events\n\n const clickCalendar = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n flushSync(() => {\n setShowCalendar(!showCalendar);\n });\n\n const calendarEl = calendarRef.current;\n const button =\n calendarEl &&\n (calendarEl.querySelector(\n '[aria-pressed=\"true\"]',\n ) as HTMLButtonElement);\n // Make sure the popover-modal is correctly positioned before focusing a button\n // so we avoid accidentally scrolling to the top of the page\n window.requestAnimationFrame(() => button?.focus());\n\n if (action?.onClick) {\n action.onClick(e);\n }\n },\n [showCalendar, action],\n );\n\n const handleClickCalendarDay = useCallback(\n ({ date }: DateInfo) => {\n setShowCalendar(false);\n setDate(date);\n\n if (inputRef.current) {\n const node = inputRef.current;\n\n didAutoFormatCompactInputRef.current = false;\n node.value = formatInput(date);\n\n // Simulér et change-event så APIet blir så likt som mulig en endring av inputfeltet\n const event = document.createEvent(\"HTMLEvents\");\n event.initEvent(\"input\", true, false);\n node.dispatchEvent(event);\n\n node.focus();\n\n if (onChange) {\n // Det er ikke helt sant at dette er et React.SyntheticEvent, men it's fine – probably?\n // Den har tingene man kan forvente, men hvis du gjør serdeles fancy ting med events\n // så kan det hende du må utvide denne for å dekke behovet ditt.\n onChange(\n event as unknown as ChangeEvent<HTMLInputElement>,\n date,\n {\n error: null,\n value: node.value,\n },\n );\n }\n }\n },\n [onChange],\n );\n\n const handleTabOutsideCalendar = useCallback((e: KeyboardEvent) => {\n e.preventDefault();\n setShowCalendar(false);\n iconButtonRef.current?.focus();\n }, []);\n\n return (\n <InputGroup\n id={id}\n className={clsx(\"jkl-datepicker\", className)}\n {...rest}\n ref={datepickerRef}\n label={label}\n labelProps={labelProps}\n helpLabel={helpLabel}\n errorLabel={errorLabel}\n supportLabelProps={supportLabelProps}\n tooltip={tooltip}\n description={description}\n render={(inputProps) => (\n <BaseTextInput\n data-focused={showCalendar ? \"true\" : undefined}\n ref={unifiedInputRef}\n data-testid=\"jkl-datepicker__input\"\n data-testautoid={testAutoId}\n className=\"jkl-datepicker__input\"\n name={name}\n defaultValue={defaultValue}\n value={value}\n type=\"text\"\n placeholder={placeholder}\n width={width}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onChange={handleChange}\n actionButton={\n <Popover\n positionReference={inputRef}\n open={showCalendar}\n onOpenChange={() =>\n setShowCalendar(!showCalendar)\n }\n offset={8}\n >\n <Popover.Trigger\n {...action}\n data-testid=\"jkl-datepicker__trigger\"\n className=\"jkl-text-input-action-button\"\n title={\n showCalendar\n ? hideCalendarLabel\n : showCalendarLabel\n }\n tabIndex={0}\n onClick={clickCalendar}\n onKeyDown={handleKeyDownAction}\n asChild\n >\n <IconButton>\n <CalendarIcon />\n </IconButton>\n </Popover.Trigger>\n <Popover.Content initialFocus={-1} padding={24}>\n <Calendar\n ref={calendarRef}\n date={date}\n minDate={minDate}\n maxDate={maxDate}\n days={days}\n months={months}\n monthLabel={monthLabel}\n yearLabel={yearLabel}\n yearsToShow={yearsToShow}\n onDateSelected={handleClickCalendarDay}\n onTabOutside={handleTabOutsideCalendar}\n />\n </Popover.Content>\n </Popover>\n }\n {...textInputProps}\n {...inputProps}\n aria-invalid={invalid || !!errorLabel}\n />\n )}\n />\n );\n },\n);\n\nDatePicker.displayName = \"DatePicker\";\n"],"names":["DatePicker","forwardRef","props","forwardedInputRef","testAutoId","id","className","label","labelProps","defaultValue","defaultShow","value","disableBeforeDate","disableBefore","disableAfterDate","disableAfter","yearsToShow","name","helpLabel","errorLabel","invalid","days","months","monthLabel","yearLabel","placeholder","width","onChange","onBlur","onFocus","onKeyDown","action","showCalendarLabel","hideCalendarLabel","supportLabelProps","tooltip","textInputProps","description","rest","process","env","NODE_ENV","console","warn","parseDateString","minDate","dayjs","startOf","toDate","maxDate","date","setDate","useState","getInitialDate","error","setError","showCalendar","setShowCalendar","calendarRef","useRef","datepickerRef","iconButtonRef","inputRef","didAutoFormatCompactInputRef","unifiedInputRef","useCallback","instance","current","handleFocus","e","contains","relatedTarget","target","handleBlur","handleKeyDownAction","key","preventDefault","stopPropagation","handleChange","rawValue","currentTarget","formattedValue","shouldStripAutoFormatting","digits","replace","partialCompactDate","formatDateString","partial","rawValueWithoutTrailingPunctuation","compactDateCandidate","length","validCompactDate","shouldRemoveFormatting","normalizeInputValue","input","nativeSetter","Object","getOwnPropertyDescriptor","HTMLInputElement","prototype","set","call","setInputValue","nextDate","nextError","parsedDate","isWithinLowerBound","isWithinUpperBound","getInputValidationState","clickCalendar","flushSync","calendarEl","button","querySelector","window","requestAnimationFrame","focus","onClick","handleClickCalendarDay","node","formatInput","event","document","createEvent","initEvent","dispatchEvent","handleTabOutsideCalendar","jsx","InputGroup","clsx","ref","render","inputProps","BaseTextInput","type","actionButton","jsxs","Popover","positionReference","open","onOpenChange","offset","children","Trigger","title","tabIndex","asChild","IconButton","CalendarIcon","Content","initialFocus","padding","Calendar","onDateSelected","onTabOutside","displayName"],"mappings":"2lBA4FaA,EAAaC,EAAAA,WACtB,CAACC,EAAOC,KACJ,MACI,kBAAmBC,EACnBC,GAAAA,EACAC,UAAAA,EAAY,GACZC,MAAAA,EAAQ,YACRC,WAAAA,EACAC,aAAAA,EACAC,YAAAA,GAAc,EACdC,MAAAA,EACAC,kBAAmBC,EACnBC,iBAAkBC,EAClBC,YAAAA,EACAC,K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ttributes, ChangeEvent, ComponentProps, FocusEvent, KeyboardEvent } from 'react';
|
|
2
|
-
import { DataTestAutoId } from '../../
|
|
2
|
+
import { DataTestAutoId } from '../../utilities/types.cjs';
|
|
3
3
|
import { InputGroupProps, LabelProps } from '../input-group/types.cjs';
|
|
4
4
|
export type DateValidationError = "WRONG_FORMAT" | "OUTSIDE_LOWER_BOUND" | "OUTSIDE_UPPER_BOUND";
|
|
5
5
|
export type DatePickerChangeEventHandler = (e: ChangeEvent<HTMLInputElement>, date: Date | null, meta: DatePickerMetadata) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./DescriptionList.cjs"),t=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./DescriptionList.cjs"),t=require("../beta/description-list/DescriptionList.cjs"),e=require("../beta/description-list/DescriptionListItem.cjs");exports.DescriptionDetail=i.DescriptionDetail,exports.DescriptionList=i.DescriptionList,exports.DescriptionTerm=i.DescriptionTerm,exports.BETA_DescriptionList=t.DescriptionList,exports.BETA_DescriptionListItem=e.DescriptionListItem;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { DescriptionList, DescriptionTerm, DescriptionDetail, } from './DescriptionList.cjs';
|
|
2
2
|
export type { DescriptionListProps, DescriptionTermProps, DescriptionDetailProps, } from './types.cjs';
|
|
3
|
-
export { DescriptionList as BETA_DescriptionList } from '
|
|
4
|
-
export { DescriptionListItem as BETA_DescriptionListItem } from '
|
|
5
|
-
export type { DescriptionListProps as BETA_DescriptionListProps } from '
|
|
3
|
+
export { DescriptionList as BETA_DescriptionList } from '../beta/description-list/DescriptionList.jsx';
|
|
4
|
+
export { DescriptionListItem as BETA_DescriptionListItem } from '../beta/description-list/DescriptionListItem.jsx';
|
|
5
|
+
export type { DescriptionListProps as BETA_DescriptionListProps } from '../beta/description-list/types.cjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("../../../clsx-E3yX_9sL.cjs"),n=require("react"),a=require("./ExpandablePanelContent.cjs"),r=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("../../../clsx-E3yX_9sL.cjs"),n=require("react"),a=require("./ExpandablePanelContent.cjs"),r=require("./Expander.cjs"),s=require("./context.cjs"),i=Object.assign(n.forwardRef(function(a,r){const{children:i,as:l="details",variant:o="fill",open:d,defaultOpen:c,onOpenChange:u,className:p,...x}=a,[j,f]=n.useState(c||!1),[b,g]=n.useState(!1),[v,E]=n.useState(0),h=n.useRef();n.useImperativeHandle(r,()=>h.current,[]);const m=l,S=typeof d<"u",q=S?d:j;return n.useEffect(()=>{const e=e=>{f("open"===e.newState)},t=h.current;return t?.addEventListener("toggle",e),()=>t?.removeEventListener("toggle",e)},[]),e.jsxs("div",{className:"jkl-expandable__wrapper",children:[e.jsx("div",{ref:e=>e?.setAttribute("inert","true"),className:"jkl-expandable__focus-container",style:{height:v}}),e.jsx(m,{ref:h,"data-testid":"jkl-expand-section",className:t.clsx("jkl-expandable",`jkl-expandable--${o}`,p),open:"details"===l?q||b:void 0,"data-visible-content":q||b,...x,children:e.jsx(s.ExpanderContext.Provider,{value:{open:q,onToggle:()=>{S?u?.(!q):f(e=>(u?.(!e),!e))},onTransitionEnd:g,onTransitionStart:e=>{e&&g(!0)},setExpanderHeight:E},children:i})})]})}),{Content:a.ExpandablePanelContent,Header:r.Expander});exports.ExpandablePanel=i;
|
|
2
2
|
//# sourceMappingURL=ExpandablePanel.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpandablePanel.cjs","sources":["../../../../src/components/expander/ExpandablePanel.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport type { PolymorphicRef } from \"../../utilities/polymorphism/polymorphism.js\";\nimport { ExpandablePanelContent } from \"./ExpandablePanelContent.js\";\nimport { ExpanderContext } from \"./context.js\";\nimport type {\n ExpandablePanelComponent,\n ExpandablePanelProps,\n} from \"./types.js\";\
|
|
1
|
+
{"version":3,"file":"ExpandablePanel.cjs","sources":["../../../../src/components/expander/ExpandablePanel.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport type { PolymorphicRef } from \"../../utilities/polymorphism/polymorphism.js\";\nimport { ExpandablePanelContent } from \"./ExpandablePanelContent.js\";\nimport { Expander } from \"./Expander.jsx\";\nimport { ExpanderContext } from \"./context.js\";\nimport type {\n ExpandablePanelComponent,\n ExpandablePanelProps,\n} from \"./types.js\";\n\nexport const ExpandablePanel = Object.assign(\n React.forwardRef(function ExpandablePanel<\n ElementType extends React.ElementType = \"details\",\n >(\n props: ExpandablePanelProps<ElementType>,\n ref?: PolymorphicRef<ElementType>,\n ) {\n const {\n children,\n as = \"details\",\n variant = \"fill\",\n open: controlledOpen,\n defaultOpen,\n onOpenChange,\n className,\n ...rest\n } = props;\n\n const [uncontrolledOpen, setUncontrolledOpen] = useState(\n defaultOpen || false,\n );\n const [contentIsVisible, setContentIsVisible] = useState(false);\n const [expanderHeight, setExpanderHeight] = useState(0);\n\n const internalRef = useRef<HTMLDetailsElement>();\n useImperativeHandle(ref, () => internalRef.current, []);\n\n const El = as;\n const isControlled = typeof controlledOpen !== \"undefined\";\n const isOpen = isControlled ? controlledOpen : uncontrolledOpen;\n\n const setVisibleIfOpening = (isOpening: boolean) => {\n if (isOpening) {\n setContentIsVisible(true);\n }\n };\n\n const syncUncontrolledState = () => {\n if (isControlled) {\n onOpenChange?.(!isOpen);\n return;\n }\n setUncontrolledOpen((previousValue) => {\n onOpenChange?.(!previousValue);\n return !previousValue;\n });\n };\n\n useEffect(() => {\n const callback = (e: ToggleEvent & { newState: string }) => {\n setUncontrolledOpen(e.newState === \"open\");\n };\n\n const element = internalRef.current;\n\n element?.addEventListener(\"toggle\", callback as EventListener);\n\n return () =>\n element?.removeEventListener(\n \"toggle\",\n callback as EventListener,\n );\n }, []);\n\n return (\n <div className=\"jkl-expandable__wrapper\">\n <div\n /*\n Setter `inert` manuelt for å støtte både React 18 og 19.\n\n Dette unngår typefeil i React 18 og advarsler i React 19.\n Se: https://github.com/WICG/inert/issues/58\n */\n ref={(node) => node?.setAttribute(\"inert\", \"true\")}\n className=\"jkl-expandable__focus-container\"\n style={{ height: expanderHeight }}\n />\n <El\n ref={internalRef}\n data-testid={\"jkl-expand-section\"}\n className={clsx(\n \"jkl-expandable\",\n `jkl-expandable--${variant}`,\n className,\n )}\n open={\n /* for the animation to work in Safari we must ensure that\n * the element is open *before* the transition starts */\n as === \"details\"\n ? isOpen || contentIsVisible\n : undefined\n }\n /* this attribute is used for styling purposes */\n data-visible-content={isOpen || contentIsVisible}\n {...rest}\n >\n <ExpanderContext.Provider\n value={{\n open: isOpen,\n onToggle: syncUncontrolledState,\n onTransitionEnd: setContentIsVisible,\n onTransitionStart: setVisibleIfOpening,\n setExpanderHeight,\n }}\n >\n {children}\n </ExpanderContext.Provider>\n </El>\n </div>\n );\n }),\n { Content: ExpandablePanelContent, Header: Expander },\n) as ExpandablePanelComponent;\n"],"names":["ExpandablePanel","Object","assign","React","forwardRef","props","ref","children","as","variant","open","controlledOpen","defaultOpen","onOpenChange","className","rest","uncontrolledOpen","setUncontrolledOpen","useState","contentIsVisible","setContentIsVisible","expanderHeight","setExpanderHeight","internalRef","useRef","useImperativeHandle","current","El","isControlled","isOpen","useEffect","callback","e","newState","element","addEventListener","removeEventListener","jsxs","jsx","node","setAttribute","style","height","clsx","ExpanderContext","Provider","value","onToggle","previousValue","onTransitionEnd","onTransitionStart","isOpening","Content","ExpandablePanelContent","Header","Expander"],"mappings":"iRAWaA,EAAkBC,OAAOC,OAClCC,EAAMC,WA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EAAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feedbackContext.cjs","sources":["../../../../src/components/feedback/feedbackContext.tsx"],"sourcesContent":["import React, { createContext, type FC, useContext } from \"react\";\nimport type { WithChildren } from \"../../
|
|
1
|
+
{"version":3,"file":"feedbackContext.cjs","sources":["../../../../src/components/feedback/feedbackContext.tsx"],"sourcesContent":["import React, { createContext, type FC, useContext } from \"react\";\nimport type { WithChildren } from \"../../utilities/types.js\";\nimport type { BaseTextAreaProps } from \"../text-area/types.js\";\n\ntype FeedbackContext = {\n feedbackSubmitted: boolean;\n followupStarted: boolean;\n followupSubmitted: boolean;\n contactSubmitted: boolean;\n landmarkLabel?: string;\n setFeedbackSubmitted: (state: boolean) => void;\n setFollowupStarted: (state: boolean) => void;\n setFollowupSubmitted: (state: boolean) => void;\n setContactSubmitted: (state: boolean) => void;\n} & Pick<BaseTextAreaProps, \"counter\">;\n\nconst initialState: FeedbackContext = {\n feedbackSubmitted: false,\n followupStarted: false,\n followupSubmitted: false,\n contactSubmitted: false,\n setFeedbackSubmitted: () => null,\n setFollowupStarted: () => null,\n setFollowupSubmitted: () => null,\n setContactSubmitted: () => null,\n};\n\nconst feedbackContext = createContext(initialState);\n\nexport const useFeedbackContext = (): FeedbackContext =>\n useContext(feedbackContext);\n\ninterface FeedbackContextProviderProps extends WithChildren {\n value: FeedbackContext;\n}\n\nexport const FeedbackContextProvider: FC<FeedbackContextProviderProps> = ({\n value,\n children,\n}) => (\n <feedbackContext.Provider value={value}>\n {children}\n </feedbackContext.Provider>\n);\n"],"names":["feedbackContext","createContext","feedbackSubmitted","followupStarted","followupSubmitted","contactSubmitted","setFeedbackSubmitted","setFollowupStarted","setFollowupSubmitted","setContactSubmitted","value","children","jsx","Provider","useContext"],"mappings":"wIA2BMA,EAAkBC,EAAAA,cAXc,CAClCC,mBAAmB,EACnBC,iBAAiB,EACjBC,mBAAmB,EACnBC,kBAAkB,EAClBC,qBAAsB,IAAM,KAC5BC,mBAAoB,IAAM,KAC1BC,qBAAsB,IAAM,KAC5BC,oBAAqB,IAAM,uCAY0C,EACrEC,MAAAA,EACAC,SAAAA,KAEAC,EAAAA,IAACZ,EAAgBa,SAAhB,CAAyBH,MAAAA,EACrBC,SAAAA,+BAZyB,IAC9BG,EAAAA,WAAWd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"followupContext.cjs","sources":["../../../../../src/components/feedback/followup/followupContext.tsx"],"sourcesContent":["import React, { createContext, useContext } from \"react\";\nimport type { WithChildren } from \"../../../
|
|
1
|
+
{"version":3,"file":"followupContext.cjs","sources":["../../../../../src/components/feedback/followup/followupContext.tsx"],"sourcesContent":["import React, { createContext, useContext } from \"react\";\nimport type { WithChildren } from \"../../../utilities/types.js\";\nimport type { FollowupState } from \"../types.js\";\n\nconst followUpContext = createContext<FollowupState | undefined>(undefined);\n\nexport const useFollowUpContext = (): FollowupState | undefined =>\n useContext(followUpContext);\n\ninterface FollowupContextProviderProps extends WithChildren {\n state: FollowupState;\n}\n\nexport const FollowUpProvider: React.FC<FollowupContextProviderProps> = ({\n state,\n children,\n}) => (\n <followUpContext.Provider value={state}>\n {children}\n </followUpContext.Provider>\n);\n"],"names":["followUpContext","createContext","state","children","Provider","value","useContext"],"mappings":"wIAIMA,EAAkBC,EAAAA,mBAAyC,4BASO,EACpEC,MAAAA,EACAC,SAAAA,WAECH,EAAgBI,SAAhB,CAAyBC,MAAOH,EAC5BC,SAAAA,+BAZyB,IAC9BG,EAAAA,WAAWN"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { WithChildren } from '../../../
|
|
2
|
+
import { WithChildren } from '../../../utilities/types.cjs';
|
|
3
3
|
import { FollowupState } from '../types.cjs';
|
|
4
4
|
export declare const useFollowUpContext: () => FollowupState | undefined;
|
|
5
5
|
interface FollowupContextProviderProps extends WithChildren {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mainQuestionContext.cjs","sources":["../../../../../src/components/feedback/main-question/mainQuestionContext.tsx"],"sourcesContent":["import React, { createContext, useContext } from \"react\";\nimport type { WithChildren } from \"../../../
|
|
1
|
+
{"version":3,"file":"mainQuestionContext.cjs","sources":["../../../../../src/components/feedback/main-question/mainQuestionContext.tsx"],"sourcesContent":["import React, { createContext, useContext } from \"react\";\nimport type { WithChildren } from \"../../../utilities/types.js\";\nimport type { FeedbackState } from \"../types.js\";\n\nconst mainQuestionContext = createContext<FeedbackState | undefined>(undefined);\n\nexport const useMainQuestionContext = (): FeedbackState | undefined =>\n useContext(mainQuestionContext);\n\ninterface Props extends WithChildren {\n state: FeedbackState;\n}\n\nexport const MainQuestionContextProvider: React.FC<Props> = ({\n state,\n children,\n}) => (\n <mainQuestionContext.Provider value={state}>\n {children}\n </mainQuestionContext.Provider>\n);\n"],"names":["mainQuestionContext","createContext","state","children","Provider","value","useContext"],"mappings":"wIAIMA,EAAsBC,EAAAA,mBAAyC,uCAST,EACxDC,MAAAA,EACAC,SAAAA,WAECH,EAAoBI,SAApB,CAA6BC,MAAOH,EAChCC,SAAAA,mCAZ6B,IAClCG,EAAAA,WAAWN"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { WithChildren } from '../../../
|
|
2
|
+
import { WithChildren } from '../../../utilities/types.cjs';
|
|
3
3
|
import { FeedbackState } from '../types.cjs';
|
|
4
4
|
export declare const useMainQuestionContext: () => FeedbackState | undefined;
|
|
5
5
|
interface Props extends WithChildren {
|