@fremtind/jokul 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/build/build-stats.html +1 -1
- package/build/cjs/components/autosuggest/Autosuggest.cjs +1 -1
- package/build/cjs/components/autosuggest/Autosuggest.cjs.map +1 -1
- package/build/cjs/components/autosuggest/BaseAutosuggest.cjs +1 -1
- package/build/cjs/components/autosuggest/BaseAutosuggest.cjs.map +1 -1
- package/build/cjs/components/autosuggest/ControllerButton.cjs.map +1 -1
- package/build/cjs/components/autosuggest/Menu.cjs +1 -1
- package/build/cjs/components/autosuggest/Menu.cjs.map +1 -1
- package/build/cjs/components/autosuggest/utils.cjs.map +1 -1
- package/build/cjs/components/breadcrumb/Breadcrumb.cjs +1 -1
- package/build/cjs/components/breadcrumb/Breadcrumb.cjs.map +1 -1
- package/build/cjs/components/breadcrumb/BreadcrumbItem.cjs +1 -1
- package/build/cjs/components/breadcrumb/BreadcrumbItem.cjs.map +1 -1
- package/build/cjs/components/breadcrumb/documentation/BreadcrumbDocs.cjs.map +1 -1
- package/build/cjs/components/button/Button.cjs +1 -1
- package/build/cjs/components/button/Button.cjs.map +1 -1
- package/build/cjs/components/button/documentation/AnchorDocs.cjs.map +1 -1
- package/build/cjs/components/button/documentation/ButtonDocs.cjs +1 -1
- package/build/cjs/components/button/documentation/ButtonDocs.cjs.map +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/CardImage.cjs +1 -1
- package/build/cjs/components/card/CardImage.cjs.map +1 -1
- package/build/cjs/components/checkbox/Checkbox.cjs +1 -1
- package/build/cjs/components/checkbox/Checkbox.cjs.map +1 -1
- package/build/cjs/components/checkbox-panel/CheckboxPanel.cjs +1 -1
- package/build/cjs/components/checkbox-panel/CheckboxPanel.cjs.map +1 -1
- package/build/cjs/components/checkbox-panel/types.d.cts +12 -0
- package/build/cjs/components/chip/Chip.cjs +1 -1
- package/build/cjs/components/chip/Chip.cjs.map +1 -1
- package/build/cjs/components/combobox/Combobox.cjs +1 -1
- package/build/cjs/components/combobox/Combobox.cjs.map +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/CookieConsentContext.cjs +1 -1
- package/build/cjs/components/cookie-consent/CookieConsentContext.cjs.map +1 -1
- package/build/cjs/components/cookie-consent/cookieConsentUtils.cjs +1 -1
- package/build/cjs/components/cookie-consent/cookieConsentUtils.cjs.map +1 -1
- package/build/cjs/components/countdown/Countdown.cjs +1 -1
- package/build/cjs/components/countdown/Countdown.cjs.map +1 -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/internal/Calendar.cjs +1 -1
- package/build/cjs/components/datepicker/internal/Calendar.cjs.map +1 -1
- package/build/cjs/components/datepicker/internal/calendarReducer.cjs.map +1 -1
- package/build/cjs/components/datepicker/internal/useCalendar.cjs +1 -1
- package/build/cjs/components/datepicker/internal/useCalendar.cjs.map +1 -1
- package/build/cjs/components/datepicker/internal/utils.cjs +1 -1
- package/build/cjs/components/datepicker/internal/utils.cjs.map +1 -1
- package/build/cjs/components/datepicker/utils.cjs.map +1 -1
- package/build/cjs/components/datepicker/validation.cjs.map +1 -1
- package/build/cjs/components/description-list/DescriptionList.cjs.map +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/expander/ExpandablePanelContent.cjs +1 -1
- package/build/cjs/components/expander/ExpandablePanelContent.cjs.map +1 -1
- package/build/cjs/components/expander/Expander.cjs +1 -1
- package/build/cjs/components/expander/Expander.cjs.map +1 -1
- package/build/cjs/components/feedback/Feedback.cjs.map +1 -1
- package/build/cjs/components/feedback/feedbackContext.cjs.map +1 -1
- package/build/cjs/components/feedback/followup/Followup.cjs +1 -1
- package/build/cjs/components/feedback/followup/Followup.cjs.map +1 -1
- package/build/cjs/components/feedback/followup/followupContext.cjs.map +1 -1
- package/build/cjs/components/feedback/followup/useFollowup.cjs +1 -1
- package/build/cjs/components/feedback/followup/useFollowup.cjs.map +1 -1
- package/build/cjs/components/feedback/main-question/MainQuestion.cjs +1 -1
- package/build/cjs/components/feedback/main-question/MainQuestion.cjs.map +1 -1
- package/build/cjs/components/feedback/main-question/mainQuestionContext.cjs.map +1 -1
- package/build/cjs/components/feedback/main-question/useMainQuestion.cjs +1 -1
- package/build/cjs/components/feedback/main-question/useMainQuestion.cjs.map +1 -1
- package/build/cjs/components/feedback/presets.cjs.map +1 -1
- package/build/cjs/components/feedback/questions/AddonQuestion.cjs +1 -1
- package/build/cjs/components/feedback/questions/AddonQuestion.cjs.map +1 -1
- package/build/cjs/components/feedback/questions/CheckboxQuestion.cjs +1 -1
- package/build/cjs/components/feedback/questions/CheckboxQuestion.cjs.map +1 -1
- package/build/cjs/components/feedback/questions/ContactQuestion.cjs +1 -1
- package/build/cjs/components/feedback/questions/ContactQuestion.cjs.map +1 -1
- package/build/cjs/components/feedback/questions/RadioQuestion.cjs +1 -1
- package/build/cjs/components/feedback/questions/RadioQuestion.cjs.map +1 -1
- package/build/cjs/components/feedback/questions/SmileyQuestion.cjs +1 -1
- package/build/cjs/components/feedback/questions/SmileyQuestion.cjs.map +1 -1
- package/build/cjs/components/feedback/questions/TextQuestion.cjs +1 -1
- package/build/cjs/components/feedback/questions/TextQuestion.cjs.map +1 -1
- package/build/cjs/components/feedback/questions/smileyUtils.cjs.map +1 -1
- package/build/cjs/components/feedback/utils.cjs +1 -1
- package/build/cjs/components/feedback/utils.cjs.map +1 -1
- package/build/cjs/components/file/File.cjs.map +1 -1
- package/build/cjs/components/file-input/FileInput.cjs +1 -1
- package/build/cjs/components/file-input/FileInput.cjs.map +1 -1
- package/build/cjs/components/file-input/internal/Dropzone.cjs +1 -1
- package/build/cjs/components/file-input/internal/Dropzone.cjs.map +1 -1
- package/build/cjs/components/file-input/internal/Input.cjs +1 -1
- package/build/cjs/components/file-input/internal/Input.cjs.map +1 -1
- package/build/cjs/components/file-input/internal/MaxSize.cjs.map +1 -1
- package/build/cjs/components/file-input/internal/fileInputContext.cjs.map +1 -1
- package/build/cjs/components/file-input/internal/validateFileInputFiles.cjs +1 -1
- package/build/cjs/components/file-input/internal/validateFileInputFiles.cjs.map +1 -1
- package/build/cjs/components/file-input/utils.cjs +1 -1
- package/build/cjs/components/file-input/utils.cjs.map +1 -1
- package/build/cjs/components/flex/Flex.cjs +1 -1
- package/build/cjs/components/flex/Flex.cjs.map +1 -1
- package/build/cjs/components/help/Help.cjs.map +1 -1
- package/build/cjs/components/icon/Icon.cjs +1 -1
- package/build/cjs/components/icon/Icon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/ArrowDownIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/ArrowLeftIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/ArrowNorthEastIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/ArrowRightIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/ArrowUpIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/CalendarIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/CheckIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/ChevronDownIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/ChevronLeftIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/ChevronRightIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/ChevronUpIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/CloseIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/CopyIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/DotsIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/DragIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/ErrorIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/GreenCheckIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/HamburgerIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/InfoIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/LinkIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/MinusIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/OpenInNewIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/PenIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/PlusIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/QuestionIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/RedCrossIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/SearchIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/SuccessIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/ThumbDownIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/ThumbUpIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/TrashCanIcon.cjs.map +1 -1
- package/build/cjs/components/icon/icons/WarningIcon.cjs.map +1 -1
- package/build/cjs/components/icon-button/IconButton.cjs +1 -1
- package/build/cjs/components/icon-button/IconButton.cjs.map +1 -1
- package/build/cjs/components/image/Image.cjs +1 -1
- package/build/cjs/components/image/Image.cjs.map +1 -1
- package/build/cjs/components/image/useImageLoadingStatus.cjs +1 -1
- package/build/cjs/components/image/useImageLoadingStatus.cjs.map +1 -1
- package/build/cjs/components/input-group/FieldGroup.cjs.map +1 -1
- package/build/cjs/components/input-group/InputGroup.cjs +1 -1
- package/build/cjs/components/input-group/InputGroup.cjs.map +1 -1
- package/build/cjs/components/input-group/Label.cjs.map +1 -1
- package/build/cjs/components/input-group/SupportLabel.cjs.map +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-list/LinkList.cjs +1 -1
- package/build/cjs/components/link-list/LinkList.cjs.map +1 -1
- package/build/cjs/components/list/List.cjs.map +1 -1
- package/build/cjs/components/list/ListItem.cjs.map +1 -1
- package/build/cjs/components/loader/Loader.cjs.map +1 -1
- package/build/cjs/components/loader/skeletons/SkeletonAnimation.cjs.map +1 -1
- package/build/cjs/components/loader/skeletons/SkeletonCheckboxGroup.cjs +1 -1
- package/build/cjs/components/loader/skeletons/SkeletonCheckboxGroup.cjs.map +1 -1
- package/build/cjs/components/loader/skeletons/SkeletonInput.cjs.map +1 -1
- package/build/cjs/components/loader/skeletons/SkeletonLabel.cjs.map +1 -1
- package/build/cjs/components/loader/skeletons/SkeletonRadioButtonGroup.cjs +1 -1
- package/build/cjs/components/loader/skeletons/SkeletonRadioButtonGroup.cjs.map +1 -1
- package/build/cjs/components/loader/skeletons/SkeletonTextArea.cjs.map +1 -1
- package/build/cjs/components/loader/useDelayedRender.cjs +1 -1
- package/build/cjs/components/loader/useDelayedRender.cjs.map +1 -1
- package/build/cjs/components/logo/Logo.cjs.map +1 -1
- package/build/cjs/components/logo/LogoStamp.cjs.map +1 -1
- package/build/cjs/components/logo/useTextSpinner.cjs +1 -1
- package/build/cjs/components/logo/useTextSpinner.cjs.map +1 -1
- package/build/cjs/components/menu/Menu.cjs +1 -1
- package/build/cjs/components/menu/Menu.cjs.map +1 -1
- package/build/cjs/components/menu/MenuDivider.cjs.map +1 -1
- package/build/cjs/components/menu/MenuItem.cjs +1 -1
- package/build/cjs/components/menu/MenuItem.cjs.map +1 -1
- package/build/cjs/components/menu/MenuItemCheckbox.cjs +1 -1
- package/build/cjs/components/menu/MenuItemCheckbox.cjs.map +1 -1
- package/build/cjs/components/menu/useMenuWideEvents.cjs +1 -1
- package/build/cjs/components/menu/useMenuWideEvents.cjs.map +1 -1
- package/build/cjs/components/message/DismissButton.cjs +1 -1
- package/build/cjs/components/message/DismissButton.cjs.map +1 -1
- package/build/cjs/components/message/FormErrorMessage.cjs +1 -1
- package/build/cjs/components/message/FormErrorMessage.cjs.map +1 -1
- package/build/cjs/components/message/Message.cjs +1 -1
- package/build/cjs/components/message/Message.cjs.map +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/useModal.cjs.map +1 -1
- package/build/cjs/components/nav-link/NavLink.cjs +1 -1
- package/build/cjs/components/nav-link/NavLink.cjs.map +1 -1
- package/build/cjs/components/pagination/PageButton.cjs.map +1 -1
- package/build/cjs/components/pagination/Pagination.cjs +1 -1
- package/build/cjs/components/pagination/Pagination.cjs.map +1 -1
- package/build/cjs/components/popover/Popover.cjs +1 -1
- package/build/cjs/components/popover/Popover.cjs.map +1 -1
- package/build/cjs/components/progress-bar/ProgressBar.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/RadioButton.cjs +1 -1
- package/build/cjs/components/radio-button/RadioButton.cjs.map +1 -1
- package/build/cjs/components/radio-button/RadioButtonGroup.cjs.map +1 -1
- package/build/cjs/components/radio-panel/RadioPanel.cjs +1 -1
- package/build/cjs/components/radio-panel/RadioPanel.cjs.map +1 -1
- package/build/cjs/components/radio-panel/RadioPanelGroup.cjs.map +1 -1
- package/build/cjs/components/radio-panel/radioPanelContext.cjs.map +1 -1
- package/build/cjs/components/radio-panel/types.d.cts +12 -0
- package/build/cjs/components/segmented-control/SegmentedControlButton.cjs.map +1 -1
- package/build/cjs/components/select/NativeSelect.cjs +1 -1
- package/build/cjs/components/select/NativeSelect.cjs.map +1 -1
- package/build/cjs/components/select/Select.cjs +1 -1
- package/build/cjs/components/select/Select.cjs.map +1 -1
- package/build/cjs/components/select/select-utils.cjs.map +1 -1
- package/build/cjs/components/summary-table/SummaryTable.cjs +1 -1
- package/build/cjs/components/summary-table/SummaryTable.cjs.map +1 -1
- package/build/cjs/components/summary-table/SummaryTableRow.cjs.map +1 -1
- package/build/cjs/components/summary-table/mocks.cjs.map +1 -1
- package/build/cjs/components/system-message/SystemMessage.cjs.map +1 -1
- package/build/cjs/components/system-message/common/DismissButton.cjs +1 -1
- package/build/cjs/components/system-message/common/DismissButton.cjs.map +1 -1
- package/build/cjs/components/system-message/common/MessageIcon.cjs.map +1 -1
- package/build/cjs/components/table/DataTable.cjs +1 -1
- package/build/cjs/components/table/DataTable.cjs.map +1 -1
- package/build/cjs/components/table/ExpandableTableRow.cjs +1 -1
- package/build/cjs/components/table/ExpandableTableRow.cjs.map +1 -1
- package/build/cjs/components/table/ExpandableTableRowController.cjs +1 -1
- package/build/cjs/components/table/ExpandableTableRowController.cjs.map +1 -1
- package/build/cjs/components/table/Table.cjs +1 -1
- package/build/cjs/components/table/Table.cjs.map +1 -1
- package/build/cjs/components/table/TableBody.cjs +1 -1
- package/build/cjs/components/table/TableBody.cjs.map +1 -1
- package/build/cjs/components/table/TableCaption.cjs +1 -1
- package/build/cjs/components/table/TableCaption.cjs.map +1 -1
- package/build/cjs/components/table/TableCell.cjs +1 -1
- package/build/cjs/components/table/TableCell.cjs.map +1 -1
- package/build/cjs/components/table/TableColumn.cjs +1 -1
- package/build/cjs/components/table/TableColumn.cjs.map +1 -1
- package/build/cjs/components/table/TableColumnGroup.cjs +1 -1
- package/build/cjs/components/table/TableColumnGroup.cjs.map +1 -1
- package/build/cjs/components/table/TableFooter.cjs +1 -1
- package/build/cjs/components/table/TableFooter.cjs.map +1 -1
- package/build/cjs/components/table/TableHead.cjs +1 -1
- package/build/cjs/components/table/TableHead.cjs.map +1 -1
- package/build/cjs/components/table/TableHeader.cjs +1 -1
- package/build/cjs/components/table/TableHeader.cjs.map +1 -1
- package/build/cjs/components/table/TablePagination.cjs +1 -1
- package/build/cjs/components/table/TablePagination.cjs.map +1 -1
- package/build/cjs/components/table/TableRow.cjs +1 -1
- package/build/cjs/components/table/TableRow.cjs.map +1 -1
- package/build/cjs/components/table/tableSectionContext.cjs.map +1 -1
- package/build/cjs/components/table/utils.cjs.map +1 -1
- package/build/cjs/components/tabs/NavTab.cjs +1 -1
- package/build/cjs/components/tabs/NavTab.cjs.map +1 -1
- package/build/cjs/components/tabs/NavTabs.cjs +1 -1
- package/build/cjs/components/tabs/NavTabs.cjs.map +1 -1
- package/build/cjs/components/tabs/Tab.cjs +1 -1
- package/build/cjs/components/tabs/Tab.cjs.map +1 -1
- package/build/cjs/components/tabs/TabList.cjs +1 -1
- package/build/cjs/components/tabs/TabList.cjs.map +1 -1
- package/build/cjs/components/tabs/TabPanel.cjs.map +1 -1
- package/build/cjs/components/tabs/Tabs.cjs +1 -1
- package/build/cjs/components/tabs/Tabs.cjs.map +1 -1
- package/build/cjs/components/tabs/tabsContext.cjs.map +1 -1
- package/build/cjs/components/tag/Tag.cjs.map +1 -1
- package/build/cjs/components/text-area/BaseTextArea.cjs +1 -1
- package/build/cjs/components/text-area/BaseTextArea.cjs.map +1 -1
- package/build/cjs/components/text-area/TextArea.cjs +1 -1
- package/build/cjs/components/text-area/TextArea.cjs.map +1 -1
- package/build/cjs/components/text-input/BaseTextInput.cjs +1 -1
- package/build/cjs/components/text-input/BaseTextInput.cjs.map +1 -1
- package/build/cjs/components/text-input/TextInput.cjs +1 -1
- package/build/cjs/components/text-input/TextInput.cjs.map +1 -1
- package/build/cjs/components/toast/Toast.cjs +1 -1
- package/build/cjs/components/toast/Toast.cjs.map +1 -1
- package/build/cjs/components/toast/ToastRegion.cjs +1 -1
- package/build/cjs/components/toast/ToastRegion.cjs.map +1 -1
- package/build/cjs/components/toast/toastContext.cjs.map +1 -1
- package/build/cjs/components/toggle-switch/ToggleSlider.cjs +1 -1
- package/build/cjs/components/toggle-switch/ToggleSlider.cjs.map +1 -1
- package/build/cjs/components/toggle-switch/ToggleSwitch.cjs +1 -1
- package/build/cjs/components/toggle-switch/ToggleSwitch.cjs.map +1 -1
- package/build/cjs/components/toggle-switch/usePillStyles.cjs +1 -1
- package/build/cjs/components/toggle-switch/usePillStyles.cjs.map +1 -1
- package/build/cjs/components/tooltip/PopupTip.cjs.map +1 -1
- package/build/cjs/components/tooltip/Tooltip.cjs.map +1 -1
- package/build/cjs/components/tooltip/TooltipContent.cjs +1 -1
- package/build/cjs/components/tooltip/TooltipContent.cjs.map +1 -1
- package/build/cjs/components/tooltip/TooltipTrigger.cjs +1 -1
- package/build/cjs/components/tooltip/TooltipTrigger.cjs.map +1 -1
- package/build/cjs/components-beta/select/Select.cjs +1 -1
- package/build/cjs/components-beta/select/Select.cjs.map +1 -1
- package/build/cjs/core/tokens/style-dictionary/config.cjs +1 -1
- package/build/cjs/core/tokens/style-dictionary/config.cjs.map +1 -1
- package/build/cjs/core/tokens/style-dictionary/formats/css-dynamic-color-variables.cjs +1 -1
- package/build/cjs/core/tokens/style-dictionary/formats/css-dynamic-color-variables.cjs.map +1 -1
- package/build/cjs/core/tokens/style-dictionary/formats/javascript-esm.cjs +1 -1
- package/build/cjs/core/tokens/style-dictionary/formats/javascript-esm.cjs.map +1 -1
- package/build/cjs/core/tokens/style-dictionary/formats/scss-theme-variables.cjs +1 -1
- package/build/cjs/core/tokens/style-dictionary/formats/scss-theme-variables.cjs.map +1 -1
- package/build/cjs/core/tokens/style-dictionary/formats/tailwindcss-colors.cjs +1 -1
- package/build/cjs/core/tokens/style-dictionary/formats/tailwindcss-colors.cjs.map +1 -1
- package/build/cjs/core/tokens/style-dictionary/transforms/strip-light-dark.cjs +1 -1
- package/build/cjs/core/tokens/style-dictionary/transforms/strip-light-dark.cjs.map +1 -1
- package/build/cjs/hooks/mediaQueryUtils.cjs.map +1 -1
- package/build/cjs/hooks/stories/content.cjs.map +1 -1
- package/build/cjs/hooks/useAnimatedDetails/useAnimatedDetails.cjs +1 -1
- package/build/cjs/hooks/useAnimatedDetails/useAnimatedDetails.cjs.map +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/useAriaLiveRegion/useAriaLiveRegion.cjs +1 -1
- package/build/cjs/hooks/useAriaLiveRegion/useAriaLiveRegion.cjs.map +1 -1
- package/build/cjs/hooks/useBrowserPreferences/useBrowserPreferences.cjs +1 -1
- package/build/cjs/hooks/useBrowserPreferences/useBrowserPreferences.cjs.map +1 -1
- package/build/cjs/hooks/useClickOutside/useClickOutside.cjs +1 -1
- package/build/cjs/hooks/useClickOutside/useClickOutside.cjs.map +1 -1
- package/build/cjs/hooks/useElementDimensions/useElementDimensions.cjs +1 -1
- package/build/cjs/hooks/useElementDimensions/useElementDimensions.cjs.map +1 -1
- package/build/cjs/hooks/useFocusOutside/useFocusOutside.cjs +1 -1
- package/build/cjs/hooks/useFocusOutside/useFocusOutside.cjs.map +1 -1
- package/build/cjs/hooks/useId/useId.cjs.map +1 -1
- package/build/cjs/hooks/useIntersectionObserver/useIntersectionObserver.cjs +1 -1
- package/build/cjs/hooks/useIntersectionObserver/useIntersectionObserver.cjs.map +1 -1
- package/build/cjs/hooks/useKeyListener/useKeyListener.cjs +1 -1
- package/build/cjs/hooks/useKeyListener/useKeyListener.cjs.map +1 -1
- package/build/cjs/hooks/useListNavigation/useListNavigation.cjs +1 -1
- package/build/cjs/hooks/useListNavigation/useListNavigation.cjs.map +1 -1
- package/build/cjs/hooks/useLocalStorage/useLocalStorage.cjs +1 -1
- package/build/cjs/hooks/useLocalStorage/useLocalStorage.cjs.map +1 -1
- package/build/cjs/hooks/useMutationObserver/useMutationObserver.cjs +1 -1
- package/build/cjs/hooks/useMutationObserver/useMutationObserver.cjs.map +1 -1
- package/build/cjs/hooks/usePreviousValue/usePreviousValue.cjs +1 -1
- package/build/cjs/hooks/usePreviousValue/usePreviousValue.cjs.map +1 -1
- package/build/cjs/hooks/useProgressiveImg/useProgressiveImg.cjs +1 -1
- package/build/cjs/hooks/useProgressiveImg/useProgressiveImg.cjs.map +1 -1
- package/build/cjs/hooks/useScreen/state.cjs.map +1 -1
- package/build/cjs/hooks/useScreen/useScreen.cjs +1 -1
- package/build/cjs/hooks/useScreen/useScreen.cjs.map +1 -1
- package/build/cjs/hooks/useScrollIntoView/useScrollIntoView.cjs +1 -1
- package/build/cjs/hooks/useScrollIntoView/useScrollIntoView.cjs.map +1 -1
- package/build/cjs/hooks/useSwipeGesture/useSwipeGesture.cjs +1 -1
- package/build/cjs/hooks/useSwipeGesture/useSwipeGesture.cjs.map +1 -1
- package/build/cjs/shared/input-panel/BasePanel.cjs +1 -1
- package/build/cjs/shared/input-panel/BasePanel.cjs.map +1 -1
- package/build/cjs/shared/input-panel/BasePanel.d.cts +14 -2
- 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.map +1 -1
- package/build/cjs/utilities/formatters/avstand/formatAvstand.cjs.map +1 -1
- package/build/cjs/utilities/formatters/bytes/formatBytes.cjs.map +1 -1
- package/build/cjs/utilities/formatters/date/formatDate.cjs.map +1 -1
- package/build/cjs/utilities/formatters/fodselsnummer/formatFodselsnummer.cjs.map +1 -1
- package/build/cjs/utilities/formatters/kontonummer/formatKontonummer.cjs.map +1 -1
- package/build/cjs/utilities/formatters/kortnummer/formatKortnummer.cjs.map +1 -1
- package/build/cjs/utilities/formatters/organisasjonsnummer/formatOrganisasjonsnummer.cjs.map +1 -1
- package/build/cjs/utilities/formatters/telefonnummer/formatTelefonnummer.cjs.map +1 -1
- package/build/cjs/utilities/formatters/util/formatNumber.cjs.map +1 -1
- package/build/cjs/utilities/formatters/util/parseNumber.cjs +1 -1
- package/build/cjs/utilities/formatters/util/parseNumber.cjs.map +1 -1
- package/build/cjs/utilities/formatters/util/registerWithMask.cjs.map +1 -1
- package/build/cjs/utilities/formatters/valuta/formatValuta.cjs.map +1 -1
- package/build/cjs/utilities/getThemeAndDensity.cjs.map +1 -1
- package/build/cjs/utilities/polymorphism/SlotComponent.cjs +1 -1
- package/build/cjs/utilities/polymorphism/SlotComponent.cjs.map +1 -1
- package/build/cjs/utilities/polymorphism/mergeProps.cjs.map +1 -1
- package/build/cjs/utilities/polymorphism/mergeRefs.cjs.map +1 -1
- package/build/cjs/utilities/tabListener.cjs +1 -1
- package/build/cjs/utilities/tabListener.cjs.map +1 -1
- package/build/cjs/utilities/validators/hasMinimumWords/hasMinimumWords.cjs +1 -1
- package/build/cjs/utilities/validators/hasMinimumWords/hasMinimumWords.cjs.map +1 -1
- package/build/cjs/utilities/validators/isExactLength/isExactLength.cjs.map +1 -1
- package/build/cjs/utilities/validators/isValidFodselsnummer/isValidFodselsnummer.cjs +1 -1
- package/build/cjs/utilities/validators/isValidFodselsnummer/isValidFodselsnummer.cjs.map +1 -1
- package/build/cjs/utilities/validators/isValidKortnummer/isValidKortnummer.cjs +1 -1
- package/build/cjs/utilities/validators/isValidKortnummer/isValidKortnummer.cjs.map +1 -1
- package/build/cjs/utilities/validators/isValidOrganisasjonsnummer/isValidOrganisasjonsnummer.cjs +1 -1
- package/build/cjs/utilities/validators/isValidOrganisasjonsnummer/isValidOrganisasjonsnummer.cjs.map +1 -1
- package/build/cjs/utilities/valuePair.cjs.map +1 -1
- package/build/clsx-BeLtu-UY.js.map +1 -1
- package/build/clsx-E3yX_9sL.cjs.map +1 -1
- package/build/es/components/autosuggest/Autosuggest.js +1 -1
- package/build/es/components/autosuggest/Autosuggest.js.map +1 -1
- package/build/es/components/autosuggest/BaseAutosuggest.js +1 -1
- package/build/es/components/autosuggest/BaseAutosuggest.js.map +1 -1
- package/build/es/components/autosuggest/ControllerButton.js.map +1 -1
- package/build/es/components/autosuggest/Menu.js +1 -1
- package/build/es/components/autosuggest/Menu.js.map +1 -1
- package/build/es/components/autosuggest/utils.js.map +1 -1
- package/build/es/components/breadcrumb/Breadcrumb.js +1 -1
- package/build/es/components/breadcrumb/Breadcrumb.js.map +1 -1
- package/build/es/components/breadcrumb/BreadcrumbItem.js +1 -1
- package/build/es/components/breadcrumb/BreadcrumbItem.js.map +1 -1
- package/build/es/components/breadcrumb/documentation/BreadcrumbDocs.js.map +1 -1
- package/build/es/components/button/Button.js +1 -1
- package/build/es/components/button/Button.js.map +1 -1
- package/build/es/components/button/documentation/AnchorDocs.js.map +1 -1
- package/build/es/components/button/documentation/ButtonDocs.js +1 -1
- package/build/es/components/button/documentation/ButtonDocs.js.map +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/CardImage.js +1 -1
- package/build/es/components/card/CardImage.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-panel/CheckboxPanel.js +1 -1
- package/build/es/components/checkbox-panel/CheckboxPanel.js.map +1 -1
- package/build/es/components/checkbox-panel/types.d.ts +12 -0
- package/build/es/components/chip/Chip.js +1 -1
- package/build/es/components/chip/Chip.js.map +1 -1
- package/build/es/components/combobox/Combobox.js +1 -1
- package/build/es/components/combobox/Combobox.js.map +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/CookieConsentContext.js +1 -1
- package/build/es/components/cookie-consent/CookieConsentContext.js.map +1 -1
- package/build/es/components/cookie-consent/cookieConsentUtils.js +1 -1
- package/build/es/components/cookie-consent/cookieConsentUtils.js.map +1 -1
- package/build/es/components/countdown/Countdown.js +1 -1
- package/build/es/components/countdown/Countdown.js.map +1 -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/internal/Calendar.js +1 -1
- package/build/es/components/datepicker/internal/Calendar.js.map +1 -1
- package/build/es/components/datepicker/internal/calendarReducer.js.map +1 -1
- package/build/es/components/datepicker/internal/useCalendar.js +1 -1
- package/build/es/components/datepicker/internal/useCalendar.js.map +1 -1
- package/build/es/components/datepicker/internal/utils.js +1 -1
- package/build/es/components/datepicker/internal/utils.js.map +1 -1
- package/build/es/components/datepicker/utils.js.map +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/expander/ExpandablePanelContent.js +1 -1
- package/build/es/components/expander/ExpandablePanelContent.js.map +1 -1
- package/build/es/components/expander/Expander.js +1 -1
- package/build/es/components/expander/Expander.js.map +1 -1
- package/build/es/components/feedback/Feedback.js.map +1 -1
- package/build/es/components/feedback/feedbackContext.js.map +1 -1
- package/build/es/components/feedback/followup/Followup.js +1 -1
- package/build/es/components/feedback/followup/Followup.js.map +1 -1
- package/build/es/components/feedback/followup/useFollowup.js +1 -1
- package/build/es/components/feedback/followup/useFollowup.js.map +1 -1
- package/build/es/components/feedback/main-question/MainQuestion.js +1 -1
- package/build/es/components/feedback/main-question/MainQuestion.js.map +1 -1
- package/build/es/components/feedback/main-question/useMainQuestion.js +1 -1
- package/build/es/components/feedback/main-question/useMainQuestion.js.map +1 -1
- package/build/es/components/feedback/questions/AddonQuestion.js +1 -1
- package/build/es/components/feedback/questions/AddonQuestion.js.map +1 -1
- package/build/es/components/feedback/questions/CheckboxQuestion.js +1 -1
- package/build/es/components/feedback/questions/CheckboxQuestion.js.map +1 -1
- package/build/es/components/feedback/questions/ContactQuestion.js +1 -1
- package/build/es/components/feedback/questions/ContactQuestion.js.map +1 -1
- package/build/es/components/feedback/questions/RadioQuestion.js +1 -1
- package/build/es/components/feedback/questions/RadioQuestion.js.map +1 -1
- package/build/es/components/feedback/questions/SmileyQuestion.js +1 -1
- package/build/es/components/feedback/questions/SmileyQuestion.js.map +1 -1
- package/build/es/components/feedback/questions/TextQuestion.js +1 -1
- package/build/es/components/feedback/questions/TextQuestion.js.map +1 -1
- package/build/es/components/feedback/questions/smileyUtils.js.map +1 -1
- package/build/es/components/feedback/utils.js +1 -1
- package/build/es/components/feedback/utils.js.map +1 -1
- package/build/es/components/file/File.js.map +1 -1
- package/build/es/components/file-input/FileInput.js +1 -1
- package/build/es/components/file-input/FileInput.js.map +1 -1
- package/build/es/components/file-input/internal/Dropzone.js +1 -1
- package/build/es/components/file-input/internal/Dropzone.js.map +1 -1
- package/build/es/components/file-input/internal/Input.js +1 -1
- package/build/es/components/file-input/internal/Input.js.map +1 -1
- package/build/es/components/file-input/internal/MaxSize.js.map +1 -1
- package/build/es/components/file-input/internal/fileInputContext.js.map +1 -1
- package/build/es/components/file-input/internal/validateFileInputFiles.js +1 -1
- package/build/es/components/file-input/internal/validateFileInputFiles.js.map +1 -1
- package/build/es/components/file-input/utils.js +1 -1
- package/build/es/components/file-input/utils.js.map +1 -1
- package/build/es/components/flex/Flex.js +1 -1
- package/build/es/components/flex/Flex.js.map +1 -1
- package/build/es/components/help/Help.js.map +1 -1
- package/build/es/components/icon/Icon.js +1 -1
- package/build/es/components/icon/Icon.js.map +1 -1
- package/build/es/components/icon/icons/ArrowDownIcon.js.map +1 -1
- package/build/es/components/icon/icons/ArrowLeftIcon.js.map +1 -1
- package/build/es/components/icon/icons/ArrowNorthEastIcon.js.map +1 -1
- package/build/es/components/icon/icons/ArrowRightIcon.js.map +1 -1
- package/build/es/components/icon/icons/ArrowUpIcon.js.map +1 -1
- package/build/es/components/icon/icons/CalendarIcon.js.map +1 -1
- package/build/es/components/icon/icons/CheckIcon.js.map +1 -1
- package/build/es/components/icon/icons/ChevronDownIcon.js.map +1 -1
- package/build/es/components/icon/icons/ChevronLeftIcon.js.map +1 -1
- package/build/es/components/icon/icons/ChevronRightIcon.js.map +1 -1
- package/build/es/components/icon/icons/ChevronUpIcon.js.map +1 -1
- package/build/es/components/icon/icons/CloseIcon.js.map +1 -1
- package/build/es/components/icon/icons/CopyIcon.js.map +1 -1
- package/build/es/components/icon/icons/DotsIcon.js.map +1 -1
- package/build/es/components/icon/icons/DragIcon.js.map +1 -1
- package/build/es/components/icon/icons/ErrorIcon.js.map +1 -1
- package/build/es/components/icon/icons/HamburgerIcon.js.map +1 -1
- package/build/es/components/icon/icons/InfoIcon.js.map +1 -1
- package/build/es/components/icon/icons/LinkIcon.js.map +1 -1
- package/build/es/components/icon/icons/MinusIcon.js.map +1 -1
- package/build/es/components/icon/icons/OpenInNewIcon.js.map +1 -1
- package/build/es/components/icon/icons/PenIcon.js.map +1 -1
- package/build/es/components/icon/icons/PlusIcon.js.map +1 -1
- package/build/es/components/icon/icons/QuestionIcon.js.map +1 -1
- package/build/es/components/icon/icons/RedCrossIcon.js.map +1 -1
- package/build/es/components/icon/icons/SearchIcon.js.map +1 -1
- package/build/es/components/icon/icons/SuccessIcon.js.map +1 -1
- package/build/es/components/icon/icons/ThumbDownIcon.js.map +1 -1
- package/build/es/components/icon/icons/ThumbUpIcon.js.map +1 -1
- package/build/es/components/icon/icons/TrashCanIcon.js.map +1 -1
- package/build/es/components/icon/icons/WarningIcon.js.map +1 -1
- package/build/es/components/icon-button/IconButton.js +1 -1
- package/build/es/components/icon-button/IconButton.js.map +1 -1
- package/build/es/components/image/Image.js +1 -1
- package/build/es/components/image/Image.js.map +1 -1
- package/build/es/components/image/useImageLoadingStatus.js +1 -1
- package/build/es/components/image/useImageLoadingStatus.js.map +1 -1
- package/build/es/components/input-group/FieldGroup.js.map +1 -1
- package/build/es/components/input-group/InputGroup.js +1 -1
- package/build/es/components/input-group/InputGroup.js.map +1 -1
- package/build/es/components/input-group/Label.js.map +1 -1
- package/build/es/components/input-group/SupportLabel.js.map +1 -1
- package/build/es/components/link/Link.js +1 -1
- package/build/es/components/link/Link.js.map +1 -1
- package/build/es/components/link-list/LinkList.js +1 -1
- package/build/es/components/link-list/LinkList.js.map +1 -1
- package/build/es/components/list/List.js.map +1 -1
- package/build/es/components/list/ListItem.js.map +1 -1
- package/build/es/components/loader/Loader.js.map +1 -1
- package/build/es/components/loader/skeletons/SkeletonAnimation.js.map +1 -1
- package/build/es/components/loader/skeletons/SkeletonCheckboxGroup.js +1 -1
- package/build/es/components/loader/skeletons/SkeletonCheckboxGroup.js.map +1 -1
- package/build/es/components/loader/skeletons/SkeletonInput.js.map +1 -1
- package/build/es/components/loader/skeletons/SkeletonLabel.js.map +1 -1
- package/build/es/components/loader/skeletons/SkeletonRadioButtonGroup.js +1 -1
- package/build/es/components/loader/skeletons/SkeletonRadioButtonGroup.js.map +1 -1
- package/build/es/components/loader/skeletons/SkeletonTextArea.js.map +1 -1
- package/build/es/components/loader/useDelayedRender.js +1 -1
- package/build/es/components/loader/useDelayedRender.js.map +1 -1
- package/build/es/components/logo/Logo.js.map +1 -1
- package/build/es/components/logo/LogoStamp.js.map +1 -1
- package/build/es/components/logo/useTextSpinner.js +1 -1
- package/build/es/components/logo/useTextSpinner.js.map +1 -1
- package/build/es/components/menu/Menu.js +1 -1
- package/build/es/components/menu/Menu.js.map +1 -1
- package/build/es/components/menu/MenuDivider.js.map +1 -1
- package/build/es/components/menu/MenuItem.js +1 -1
- package/build/es/components/menu/MenuItem.js.map +1 -1
- package/build/es/components/menu/MenuItemCheckbox.js +1 -1
- package/build/es/components/menu/MenuItemCheckbox.js.map +1 -1
- package/build/es/components/menu/useMenuWideEvents.js +1 -1
- package/build/es/components/menu/useMenuWideEvents.js.map +1 -1
- package/build/es/components/message/DismissButton.js +1 -1
- package/build/es/components/message/DismissButton.js.map +1 -1
- package/build/es/components/message/FormErrorMessage.js +1 -1
- package/build/es/components/message/FormErrorMessage.js.map +1 -1
- package/build/es/components/message/Message.js +1 -1
- package/build/es/components/message/Message.js.map +1 -1
- package/build/es/components/modal/Modal.js +1 -1
- package/build/es/components/modal/Modal.js.map +1 -1
- package/build/es/components/modal/useModal.js.map +1 -1
- package/build/es/components/nav-link/NavLink.js +1 -1
- package/build/es/components/nav-link/NavLink.js.map +1 -1
- package/build/es/components/pagination/PageButton.js.map +1 -1
- package/build/es/components/pagination/Pagination.js +1 -1
- package/build/es/components/pagination/Pagination.js.map +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/progress-bar/ProgressBar.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/RadioButton.js +1 -1
- package/build/es/components/radio-button/RadioButton.js.map +1 -1
- package/build/es/components/radio-button/RadioButtonGroup.js.map +1 -1
- package/build/es/components/radio-panel/RadioPanel.js +1 -1
- package/build/es/components/radio-panel/RadioPanel.js.map +1 -1
- package/build/es/components/radio-panel/RadioPanelGroup.js.map +1 -1
- package/build/es/components/radio-panel/radioPanelContext.js.map +1 -1
- package/build/es/components/radio-panel/types.d.ts +12 -0
- package/build/es/components/segmented-control/SegmentedControl.js.map +1 -1
- package/build/es/components/segmented-control/SegmentedControlButton.js.map +1 -1
- package/build/es/components/select/NativeSelect.js +1 -1
- package/build/es/components/select/NativeSelect.js.map +1 -1
- package/build/es/components/select/Select.js +1 -1
- package/build/es/components/select/Select.js.map +1 -1
- package/build/es/components/select/select-utils.js.map +1 -1
- package/build/es/components/summary-table/SummaryTable.js +1 -1
- package/build/es/components/summary-table/SummaryTable.js.map +1 -1
- package/build/es/components/summary-table/SummaryTableRow.js.map +1 -1
- package/build/es/components/summary-table/mocks.js.map +1 -1
- package/build/es/components/system-message/SystemMessage.js.map +1 -1
- package/build/es/components/system-message/common/DismissButton.js +1 -1
- package/build/es/components/system-message/common/DismissButton.js.map +1 -1
- package/build/es/components/system-message/common/MessageIcon.js.map +1 -1
- package/build/es/components/table/DataTable.js +1 -1
- package/build/es/components/table/DataTable.js.map +1 -1
- package/build/es/components/table/ExpandableTableRow.js +1 -1
- package/build/es/components/table/ExpandableTableRow.js.map +1 -1
- package/build/es/components/table/ExpandableTableRowController.js +1 -1
- package/build/es/components/table/ExpandableTableRowController.js.map +1 -1
- package/build/es/components/table/Table.js +1 -1
- package/build/es/components/table/Table.js.map +1 -1
- package/build/es/components/table/TableBody.js +1 -1
- package/build/es/components/table/TableBody.js.map +1 -1
- package/build/es/components/table/TableCaption.js +1 -1
- package/build/es/components/table/TableCaption.js.map +1 -1
- package/build/es/components/table/TableCell.js +1 -1
- package/build/es/components/table/TableCell.js.map +1 -1
- package/build/es/components/table/TableColumn.js +1 -1
- package/build/es/components/table/TableColumn.js.map +1 -1
- package/build/es/components/table/TableColumnGroup.js +1 -1
- package/build/es/components/table/TableColumnGroup.js.map +1 -1
- package/build/es/components/table/TableFooter.js +1 -1
- package/build/es/components/table/TableFooter.js.map +1 -1
- package/build/es/components/table/TableHead.js +1 -1
- package/build/es/components/table/TableHead.js.map +1 -1
- package/build/es/components/table/TableHeader.js +1 -1
- package/build/es/components/table/TableHeader.js.map +1 -1
- package/build/es/components/table/TablePagination.js +1 -1
- package/build/es/components/table/TablePagination.js.map +1 -1
- package/build/es/components/table/TableRow.js +1 -1
- package/build/es/components/table/TableRow.js.map +1 -1
- package/build/es/components/table/tableSectionContext.js.map +1 -1
- package/build/es/components/table/utils.js.map +1 -1
- package/build/es/components/tabs/NavTab.js +1 -1
- package/build/es/components/tabs/NavTab.js.map +1 -1
- package/build/es/components/tabs/NavTabs.js +1 -1
- package/build/es/components/tabs/NavTabs.js.map +1 -1
- package/build/es/components/tabs/Tab.js +1 -1
- package/build/es/components/tabs/Tab.js.map +1 -1
- package/build/es/components/tabs/TabList.js +1 -1
- package/build/es/components/tabs/TabList.js.map +1 -1
- package/build/es/components/tabs/TabPanel.js.map +1 -1
- package/build/es/components/tabs/Tabs.js +1 -1
- package/build/es/components/tabs/Tabs.js.map +1 -1
- package/build/es/components/tabs/tabsContext.js.map +1 -1
- package/build/es/components/tag/Tag.js.map +1 -1
- package/build/es/components/text-area/BaseTextArea.js +1 -1
- package/build/es/components/text-area/BaseTextArea.js.map +1 -1
- package/build/es/components/text-area/TextArea.js +1 -1
- package/build/es/components/text-area/TextArea.js.map +1 -1
- package/build/es/components/text-input/BaseTextInput.js +1 -1
- package/build/es/components/text-input/BaseTextInput.js.map +1 -1
- package/build/es/components/text-input/TextInput.js +1 -1
- package/build/es/components/text-input/TextInput.js.map +1 -1
- package/build/es/components/toast/Toast.js +1 -1
- package/build/es/components/toast/Toast.js.map +1 -1
- package/build/es/components/toast/ToastRegion.js +1 -1
- package/build/es/components/toast/ToastRegion.js.map +1 -1
- package/build/es/components/toast/toastContext.js.map +1 -1
- package/build/es/components/toggle-switch/ToggleSlider.js +1 -1
- package/build/es/components/toggle-switch/ToggleSlider.js.map +1 -1
- package/build/es/components/toggle-switch/ToggleSwitch.js +1 -1
- package/build/es/components/toggle-switch/ToggleSwitch.js.map +1 -1
- package/build/es/components/toggle-switch/usePillStyles.js +1 -1
- package/build/es/components/toggle-switch/usePillStyles.js.map +1 -1
- package/build/es/components/tooltip/PopupTip.js.map +1 -1
- package/build/es/components/tooltip/Tooltip.js.map +1 -1
- package/build/es/components/tooltip/TooltipContent.js +1 -1
- package/build/es/components/tooltip/TooltipContent.js.map +1 -1
- package/build/es/components/tooltip/TooltipTrigger.js +1 -1
- package/build/es/components/tooltip/TooltipTrigger.js.map +1 -1
- package/build/es/components-beta/select/Select.js +1 -1
- package/build/es/components-beta/select/Select.js.map +1 -1
- package/build/es/core/tokens/style-dictionary/config.js +1 -1
- package/build/es/core/tokens/style-dictionary/config.js.map +1 -1
- package/build/es/core/tokens/style-dictionary/formats/css-dynamic-color-variables.js +1 -1
- package/build/es/core/tokens/style-dictionary/formats/css-dynamic-color-variables.js.map +1 -1
- package/build/es/core/tokens/style-dictionary/formats/javascript-esm.js +1 -1
- package/build/es/core/tokens/style-dictionary/formats/javascript-esm.js.map +1 -1
- package/build/es/core/tokens/style-dictionary/formats/scss-theme-variables.js +1 -1
- package/build/es/core/tokens/style-dictionary/formats/scss-theme-variables.js.map +1 -1
- package/build/es/core/tokens/style-dictionary/formats/tailwindcss-colors.js +1 -1
- package/build/es/core/tokens/style-dictionary/formats/tailwindcss-colors.js.map +1 -1
- package/build/es/core/tokens/style-dictionary/transforms/strip-light-dark.js +1 -1
- package/build/es/core/tokens/style-dictionary/transforms/strip-light-dark.js.map +1 -1
- package/build/es/core/tokens.js.map +1 -1
- package/build/es/hooks/mediaQueryUtils.js.map +1 -1
- package/build/es/hooks/stories/content.js.map +1 -1
- package/build/es/hooks/useAnimatedDetails/useAnimatedDetails.js +1 -1
- package/build/es/hooks/useAnimatedDetails/useAnimatedDetails.js.map +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.js +1 -1
- package/build/es/hooks/useAnimatedHeight/useAutoAnimateHeight.js.map +1 -1
- package/build/es/hooks/useAriaLiveRegion/useAriaLiveRegion.js +1 -1
- package/build/es/hooks/useAriaLiveRegion/useAriaLiveRegion.js.map +1 -1
- package/build/es/hooks/useBrowserPreferences/useBrowserPreferences.js +1 -1
- package/build/es/hooks/useBrowserPreferences/useBrowserPreferences.js.map +1 -1
- package/build/es/hooks/useClickOutside/useClickOutside.js +1 -1
- package/build/es/hooks/useClickOutside/useClickOutside.js.map +1 -1
- package/build/es/hooks/useElementDimensions/useElementDimensions.js +1 -1
- package/build/es/hooks/useElementDimensions/useElementDimensions.js.map +1 -1
- package/build/es/hooks/useFocusOutside/useFocusOutside.js +1 -1
- package/build/es/hooks/useFocusOutside/useFocusOutside.js.map +1 -1
- package/build/es/hooks/useId/useId.js.map +1 -1
- package/build/es/hooks/useIntersectionObserver/useIntersectionObserver.js +1 -1
- package/build/es/hooks/useIntersectionObserver/useIntersectionObserver.js.map +1 -1
- package/build/es/hooks/useKeyListener/useKeyListener.js +1 -1
- package/build/es/hooks/useKeyListener/useKeyListener.js.map +1 -1
- package/build/es/hooks/useListNavigation/useListNavigation.js +1 -1
- package/build/es/hooks/useListNavigation/useListNavigation.js.map +1 -1
- package/build/es/hooks/useLocalStorage/useLocalStorage.js +1 -1
- package/build/es/hooks/useLocalStorage/useLocalStorage.js.map +1 -1
- package/build/es/hooks/useMutationObserver/useMutationObserver.js +1 -1
- package/build/es/hooks/useMutationObserver/useMutationObserver.js.map +1 -1
- package/build/es/hooks/usePreviousValue/usePreviousValue.js +1 -1
- package/build/es/hooks/usePreviousValue/usePreviousValue.js.map +1 -1
- package/build/es/hooks/useProgressiveImg/useProgressiveImg.js +1 -1
- package/build/es/hooks/useProgressiveImg/useProgressiveImg.js.map +1 -1
- package/build/es/hooks/useScreen/state.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/hooks/useScrollIntoView/useScrollIntoView.js +1 -1
- package/build/es/hooks/useScrollIntoView/useScrollIntoView.js.map +1 -1
- package/build/es/hooks/useSwipeGesture/useSwipeGesture.js +1 -1
- package/build/es/hooks/useSwipeGesture/useSwipeGesture.js.map +1 -1
- package/build/es/shared/input-panel/BasePanel.d.ts +14 -2
- package/build/es/shared/input-panel/BasePanel.js +1 -1
- package/build/es/shared/input-panel/BasePanel.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/utilities/formatters/avstand/formatAvstand.js.map +1 -1
- package/build/es/utilities/formatters/bytes/formatBytes.js.map +1 -1
- package/build/es/utilities/formatters/date/formatDate.js.map +1 -1
- package/build/es/utilities/formatters/fodselsnummer/formatFodselsnummer.js.map +1 -1
- package/build/es/utilities/formatters/kontonummer/formatKontonummer.js.map +1 -1
- package/build/es/utilities/formatters/kortnummer/formatKortnummer.js.map +1 -1
- package/build/es/utilities/formatters/organisasjonsnummer/formatOrganisasjonsnummer.js.map +1 -1
- package/build/es/utilities/formatters/telefonnummer/formatTelefonnummer.js.map +1 -1
- package/build/es/utilities/formatters/util/formatNumber.js.map +1 -1
- package/build/es/utilities/formatters/util/parseNumber.js +1 -1
- package/build/es/utilities/formatters/util/parseNumber.js.map +1 -1
- package/build/es/utilities/formatters/util/registerWithMask.js.map +1 -1
- package/build/es/utilities/formatters/valuta/formatValuta.js.map +1 -1
- package/build/es/utilities/getThemeAndDensity.js.map +1 -1
- package/build/es/utilities/polymorphism/SlotComponent.js +1 -1
- package/build/es/utilities/polymorphism/SlotComponent.js.map +1 -1
- package/build/es/utilities/polymorphism/mergeProps.js.map +1 -1
- package/build/es/utilities/polymorphism/mergeRefs.js.map +1 -1
- package/build/es/utilities/tabListener.js +1 -1
- package/build/es/utilities/tabListener.js.map +1 -1
- package/build/es/utilities/validators/hasMinimumWords/hasMinimumWords.js +1 -1
- package/build/es/utilities/validators/hasMinimumWords/hasMinimumWords.js.map +1 -1
- package/build/es/utilities/validators/isExactLength/isExactLength.js.map +1 -1
- package/build/es/utilities/validators/isValidFodselsnummer/isValidFodselsnummer.js +1 -1
- package/build/es/utilities/validators/isValidFodselsnummer/isValidFodselsnummer.js.map +1 -1
- package/build/es/utilities/validators/isValidKortnummer/isValidKortnummer.js +1 -1
- package/build/es/utilities/validators/isValidKortnummer/isValidKortnummer.js.map +1 -1
- package/build/es/utilities/validators/isValidOrganisasjonsnummer/isValidOrganisasjonsnummer.js +1 -1
- package/build/es/utilities/validators/isValidOrganisasjonsnummer/isValidOrganisasjonsnummer.js.map +1 -1
- package/build/es/utilities/valuePair.js.map +1 -1
- package/build/index-CWRMnfcx.js.map +1 -1
- package/build/index-CaISwoxr.cjs.map +1 -1
- package/package.json +1 -1
- package/styles/components/checkbox/checkbox.css +4 -4
- package/styles/components/checkbox/checkbox.min.css +1 -1
- package/styles/components/checkbox-panel/checkbox-panel.css +6 -6
- package/styles/components/checkbox-panel/checkbox-panel.min.css +1 -1
- package/styles/components/combobox/combobox.min.css +1 -1
- package/styles/components/countdown/countdown.css +2 -2
- package/styles/components/countdown/countdown.min.css +1 -1
- package/styles/components/feedback/feedback.css +2 -2
- package/styles/components/feedback/feedback.min.css +1 -1
- package/styles/components/file-input/file-input.css +11 -11
- package/styles/components/file-input/file-input.min.css +1 -1
- package/styles/components/input-group/_labels.scss +11 -10
- package/styles/components/input-group/input-group.css +4 -4
- package/styles/components/input-group/input-group.min.css +1 -1
- package/styles/components/loader/loader.css +6 -6
- package/styles/components/loader/loader.min.css +1 -1
- package/styles/components/loader/skeleton-loader.css +5 -5
- package/styles/components/loader/skeleton-loader.min.css +1 -1
- package/styles/components/logo/logo.min.css +1 -1
- package/styles/components/message/message.css +2 -2
- package/styles/components/message/message.min.css +1 -1
- package/styles/components/progress-bar/progress-bar.css +1 -1
- package/styles/components/progress-bar/progress-bar.min.css +1 -1
- package/styles/components/radio-button/radio-button.css +2 -2
- package/styles/components/radio-button/radio-button.min.css +1 -1
- package/styles/components/radio-panel/radio-panel.css +2 -2
- package/styles/components/radio-panel/radio-panel.min.css +1 -1
- package/styles/components/segmented-control/segmented-control.css +6 -6
- package/styles/components/segmented-control/segmented-control.min.css +1 -1
- package/styles/components/select/select.css +5 -3
- package/styles/components/select/select.min.css +1 -1
- package/styles/components/system-message/system-message.css +2 -2
- package/styles/components/system-message/system-message.min.css +1 -1
- package/styles/components/table/_table-pagination.scss +10 -5
- package/styles/components/table/table.css +14 -6
- package/styles/components/table/table.min.css +1 -1
- package/styles/components/tabs/tabs.min.css +1 -1
- package/styles/components/text-area/text-area.css +0 -8
- package/styles/components/text-area/text-area.min.css +1 -1
- package/styles/components/text-area/text-area.scss +2 -13
- package/styles/components/toast/toast.css +4 -4
- package/styles/components/toast/toast.min.css +1 -1
- package/styles/components-beta/select/select.css +7 -5
- package/styles/components-beta/select/select.min.css +1 -1
- package/styles/styles.css +64 -60
- package/styles/styles.min.css +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MainQuestion.cjs","sources":["../../../../../src/components/feedback/main-question/MainQuestion.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, {\n type ComponentProps,\n type FC,\n type ReactNode,\n useEffect,\n} from \"react\";\nimport { useAnimatedHeight } from \"../../../hooks/useAnimatedHeight/useAnimatedHeight.js\";\nimport { PrimaryButton, TertiaryButton } from \"../../button/Button.js\";\nimport type { Feedback } from \"../Feedback.js\";\nimport { FeedbackSuccess } from \"../FeedbackSuccess.js\";\nimport { useFeedbackContext } from \"../feedbackContext.js\";\nimport { AddonQuestion } from \"../questions/AddonQuestion.js\";\nimport type { FeedbackOption, FeedbackType } from \"../types.js\";\nimport { getQuestionFromType } from \"../utils.js\";\nimport { MainQuestionContextProvider } from \"./mainQuestionContext.js\";\nimport { useMainQuestion } from \"./useMainQuestion.js\";\n\nconst defaultSuccessMessage = {\n title: \"Takk for tilbakemeldingen!\",\n children:\n \"Husk at vi ikke kan besvare meldinger fra dette skjemaet. Kontakt gjerne din forsikringsrådgiver om du har flere spørsmål.\",\n};\n\ntype Props = Pick<ComponentProps<typeof Feedback>, \"addOnQuestion\"> & {\n type: \"radio\" | \"smiley\";\n label: string;\n helpLabel?: string;\n options: FeedbackOption[];\n successMessage?: {\n title: string;\n children: ReactNode;\n };\n onSubmit: (value: FeedbackType) => void;\n};\n\nexport const MainQuestion: FC<Props> = ({\n label,\n options,\n type,\n addOnQuestion,\n successMessage = defaultSuccessMessage,\n helpLabel,\n onSubmit,\n}) => {\n const mainQuestionState = useMainQuestion(onSubmit);\n\n const { setFeedbackSubmitted, contactSubmitted, landmarkLabel } =\n useFeedbackContext();\n const { handleSubmit, currentValue, setCurrentValue, submitted } =\n mainQuestionState;\n const [submitWrapperRef] = useAnimatedHeight<HTMLDivElement>(\n currentValue !== undefined,\n );\n\n useEffect(() => {\n setFeedbackSubmitted(submitted);\n }, [submitted, setFeedbackSubmitted]);\n\n const MainQuestionComp = getQuestionFromType(type);\n\n return (\n <>\n {!submitted && (\n <MainQuestionContextProvider state={mainQuestionState}>\n <form onSubmit={handleSubmit} aria-label={landmarkLabel}>\n <MainQuestionComp\n label={label}\n options={options}\n helpLabel={helpLabel}\n />\n <div\n ref={submitWrapperRef}\n className={clsx({\n \"jkl-feedback__submit-wrapper\": true,\n \"jkl-feedback__submit-wrapper--hidden\":\n currentValue === undefined,\n })}\n >\n {addOnQuestion && (\n <AddonQuestion\n helpLabel={\n typeof addOnQuestion === \"object\"\n ? addOnQuestion.helpLabel\n : undefined\n }\n label={\n typeof addOnQuestion === \"object\"\n ? addOnQuestion.label\n : undefined\n }\n />\n )}\n <div className=\"jkl-feedback__buttons jkl-spacing-40--top\">\n <PrimaryButton className=\"jkl-spacing-40--right\">\n Send\n </PrimaryButton>\n <TertiaryButton\n type=\"button\"\n onClick={() => setCurrentValue(undefined)}\n >\n Avbryt\n </TertiaryButton>\n </div>\n </div>\n </form>\n </MainQuestionContextProvider>\n )}\n {submitted && !contactSubmitted && (\n <FeedbackSuccess {...successMessage} />\n )}\n </>\n );\n};\n"],"names":["defaultSuccessMessage","title","children","label","options","type","addOnQuestion","successMessage","helpLabel","onSubmit","mainQuestionState","useMainQuestion","setFeedbackSubmitted","contactSubmitted","landmarkLabel","useFeedbackContext","handleSubmit","currentValue","setCurrentValue","submitted","submitWrapperRef","useAnimatedHeight","useEffect","MainQuestionComp","getQuestionFromType","jsxs","Fragment","jsx","MainQuestionContextProvider","state","ref","className","clsx","AddonQuestion","PrimaryButton","TertiaryButton","onClick","FeedbackSuccess"],"mappings":"ofAkBMA,EAAwB,CAC1BC,MAAO,6BACPC,SACI,mJAe+B,EACnCC,MAAAA,EACAC,QAAAA,EACAC,KAAAA,EACAC,cAAAA,EACAC,eAAAA,EAAiBP,EACjBQ,UAAAA,EACAC,SAAAA,
|
|
1
|
+
{"version":3,"file":"MainQuestion.cjs","sources":["../../../../../src/components/feedback/main-question/MainQuestion.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, {\n type ComponentProps,\n type FC,\n type ReactNode,\n useEffect,\n} from \"react\";\nimport { useAnimatedHeight } from \"../../../hooks/useAnimatedHeight/useAnimatedHeight.js\";\nimport { PrimaryButton, TertiaryButton } from \"../../button/Button.js\";\nimport type { Feedback } from \"../Feedback.js\";\nimport { FeedbackSuccess } from \"../FeedbackSuccess.js\";\nimport { useFeedbackContext } from \"../feedbackContext.js\";\nimport { AddonQuestion } from \"../questions/AddonQuestion.js\";\nimport type { FeedbackOption, FeedbackType } from \"../types.js\";\nimport { getQuestionFromType } from \"../utils.js\";\nimport { MainQuestionContextProvider } from \"./mainQuestionContext.js\";\nimport { useMainQuestion } from \"./useMainQuestion.js\";\n\nconst defaultSuccessMessage = {\n title: \"Takk for tilbakemeldingen!\",\n children:\n \"Husk at vi ikke kan besvare meldinger fra dette skjemaet. Kontakt gjerne din forsikringsrådgiver om du har flere spørsmål.\",\n};\n\ntype Props = Pick<ComponentProps<typeof Feedback>, \"addOnQuestion\"> & {\n type: \"radio\" | \"smiley\";\n label: string;\n helpLabel?: string;\n options: FeedbackOption[];\n successMessage?: {\n title: string;\n children: ReactNode;\n };\n onSubmit: (value: FeedbackType) => void;\n};\n\nexport const MainQuestion: FC<Props> = ({\n label,\n options,\n type,\n addOnQuestion,\n successMessage = defaultSuccessMessage,\n helpLabel,\n onSubmit,\n}) => {\n const mainQuestionState = useMainQuestion(onSubmit);\n\n const { setFeedbackSubmitted, contactSubmitted, landmarkLabel } =\n useFeedbackContext();\n const { handleSubmit, currentValue, setCurrentValue, submitted } =\n mainQuestionState;\n const [submitWrapperRef] = useAnimatedHeight<HTMLDivElement>(\n currentValue !== undefined,\n );\n\n useEffect(() => {\n setFeedbackSubmitted(submitted);\n }, [submitted, setFeedbackSubmitted]);\n\n const MainQuestionComp = getQuestionFromType(type);\n\n return (\n <>\n {!submitted && (\n <MainQuestionContextProvider state={mainQuestionState}>\n <form onSubmit={handleSubmit} aria-label={landmarkLabel}>\n <MainQuestionComp\n label={label}\n options={options}\n helpLabel={helpLabel}\n />\n <div\n ref={submitWrapperRef}\n className={clsx({\n \"jkl-feedback__submit-wrapper\": true,\n \"jkl-feedback__submit-wrapper--hidden\":\n currentValue === undefined,\n })}\n >\n {addOnQuestion && (\n <AddonQuestion\n helpLabel={\n typeof addOnQuestion === \"object\"\n ? addOnQuestion.helpLabel\n : undefined\n }\n label={\n typeof addOnQuestion === \"object\"\n ? addOnQuestion.label\n : undefined\n }\n />\n )}\n <div className=\"jkl-feedback__buttons jkl-spacing-40--top\">\n <PrimaryButton className=\"jkl-spacing-40--right\">\n Send\n </PrimaryButton>\n <TertiaryButton\n type=\"button\"\n onClick={() => setCurrentValue(undefined)}\n >\n Avbryt\n </TertiaryButton>\n </div>\n </div>\n </form>\n </MainQuestionContextProvider>\n )}\n {submitted && !contactSubmitted && (\n <FeedbackSuccess {...successMessage} />\n )}\n </>\n );\n};\n"],"names":["defaultSuccessMessage","title","children","label","options","type","addOnQuestion","successMessage","helpLabel","onSubmit","mainQuestionState","useMainQuestion","setFeedbackSubmitted","contactSubmitted","landmarkLabel","useFeedbackContext","handleSubmit","currentValue","setCurrentValue","submitted","submitWrapperRef","useAnimatedHeight","useEffect","MainQuestionComp","getQuestionFromType","jsxs","Fragment","jsx","MainQuestionContextProvider","state","ref","className","clsx","AddonQuestion","PrimaryButton","TertiaryButton","onClick","FeedbackSuccess"],"mappings":"ofAkBMA,EAAwB,CAC1BC,MAAO,6BACPC,SACI,mJAe+B,EACnCC,MAAAA,EACAC,QAAAA,EACAC,KAAAA,EACAC,cAAAA,EACAC,eAAAA,EAAiBP,EACjBQ,UAAAA,EACAC,SAAAA,MAEA,MAAMC,EAAoBC,EAAAA,gBAAgBF,IAElCG,qBAAAA,EAAsBC,iBAAAA,EAAkBC,cAAAA,GAC5CC,EAAAA,sBACIC,aAAAA,EAAcC,aAAAA,EAAcC,gBAAAA,EAAiBC,UAAAA,GACjDT,GACGU,GAAoBC,EAAAA,uBACN,IAAjBJ,GAGJK,EAAAA,UAAU,KACNV,EAAqBO,IACtB,CAACA,EAAWP,IAEf,MAAMW,EAAmBC,EAAAA,oBAAoBnB,GAE7C,OACIoB,EAAAA,KAAAC,WAAA,CACKxB,SAAA,EAACiB,GACEQ,EAAAA,IAACC,EAAAA,4BAAA,CAA4BC,MAAOnB,EAChCR,gBAAC,OAAA,CAAKO,SAAUO,EAAc,aAAYF,EACtCZ,SAAA,CAAAyB,EAAAA,IAACJ,EAAA,CACGpB,MAAAA,EACAC,QAAAA,EACAI,UAAAA,IAEJiB,EAAAA,KAAC,MAAA,CACGK,IAAKV,EACLW,UAAWC,EAAAA,KAAK,CACZ,gCAAgC,EAChC,4CACqB,IAAjBf,IAGPf,SAAA,CAAAI,GACGqB,EAAAA,IAACM,EAAAA,cAAA,CACGzB,UAC6B,iBAAlBF,EACDA,EAAcE,eACd,EAEVL,MAC6B,iBAAlBG,EACDA,EAAcH,WACd,IAIlBsB,EAAAA,KAAC,MAAA,CAAIM,UAAU,4CACX7B,SAAA,CAAAyB,EAAAA,IAACO,EAAAA,cAAA,CAAcH,UAAU,wBAAwB7B,SAAA,SAGjDyB,EAAAA,IAACQ,EAAAA,eAAA,CACG9B,KAAK,SACL+B,QAAS,IAAMlB,OAAgB,GAClChB,SAAA,sBAQpBiB,IAAcN,GACXc,EAAAA,IAACU,EAAAA,gBAAA,IAAoB9B"}
|
|
@@ -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 \"../../../core/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,
|
|
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 \"../../../core/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,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");exports.useMainQuestion=t=>{const[u,s]=e.useState(),[r,a]=e.useState(),[n,i]=e.useState(!1),o=e.useRef({onSubmit:t,currentValue:u,message:r,submitted:n});e.useEffect((
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");exports.useMainQuestion=t=>{const[u,s]=e.useState(),[r,a]=e.useState(),[n,i]=e.useState(!1),o=e.useRef({onSubmit:t,currentValue:u,message:r,submitted:n});e.useEffect(()=>{o.current={...o.current,onSubmit:t,currentValue:u,message:r,submitted:n}},[t,u,r,n]);const l=e.useCallback((e=!0)=>{const{message:t,currentValue:u,submitted:s,onSubmit:r}=o.current;if(!s&&void 0!==u){r({feedbackValue:Array.isArray(u)?u.map(e=>e.value):u?.value,intentionalSubmit:e,...e&&t?{message:t}:{}})}},[]),c=e.useCallback(()=>l(!1),[l]);return e.useEffect(()=>(typeof window<"u"&&window.addEventListener("beforeunload",c),()=>{c(),window.removeEventListener("beforeunload",c)}),[c]),{currentValue:u,setCurrentValue:s,message:r,setMessage:a,submitted:n,handleSubmit:e=>{e.preventDefault(),l(),i(!0)}}};
|
|
2
2
|
//# sourceMappingURL=useMainQuestion.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMainQuestion.cjs","sources":["../../../../../src/components/feedback/main-question/useMainQuestion.ts"],"sourcesContent":["import {\n type Dispatch,\n type FormEventHandler,\n type SetStateAction,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport type { FeedbackOption, FeedbackType } from \"../types.js\";\n\ntype Value =\n | FeedbackOption<string | number>\n | FeedbackOption<string | number>[]\n | undefined;\n\ntype MainQuestion = {\n currentValue: Value;\n setCurrentValue: Dispatch<SetStateAction<Value>>;\n message: string | undefined;\n setMessage: Dispatch<SetStateAction<string | undefined>>;\n submitted: boolean;\n handleSubmit: FormEventHandler<HTMLFormElement>;\n};\n\nexport const useMainQuestion = (\n onSubmit: (f: FeedbackType) => void,\n): MainQuestion => {\n const [currentValue, setCurrentValue] = useState<\n FeedbackOption | FeedbackOption[]\n >();\n const [message, setMessage] = useState<string>();\n const [submitted, setSubmitted] = useState(false);\n\n const feedbackRef = useRef({\n onSubmit,\n currentValue,\n message,\n submitted,\n });\n\n useEffect(() => {\n feedbackRef.current = {\n ...feedbackRef.current,\n onSubmit,\n currentValue,\n message,\n submitted,\n };\n }, [onSubmit, currentValue, message, submitted]);\n\n const submitHandler = useCallback((intentionalSubmit = true) => {\n const { message, currentValue, submitted, onSubmit } =\n feedbackRef.current;\n\n if (!submitted && currentValue !== undefined) {\n const feedbackValue = Array.isArray(currentValue)\n ? currentValue.map((option) => option.value)\n : currentValue?.value;\n onSubmit({\n feedbackValue,\n intentionalSubmit,\n ...(intentionalSubmit && message ? { message } : {}),\n });\n }\n }, []);\n\n const autoSubmit = useCallback(() => submitHandler(false), [submitHandler]);\n\n useEffect(() => {\n if (typeof window !== \"undefined\") {\n window.addEventListener(\"beforeunload\", autoSubmit);\n }\n return () => {\n autoSubmit();\n window.removeEventListener(\"beforeunload\", autoSubmit);\n };\n }, [autoSubmit]);\n\n const handleSubmit: FormEventHandler<HTMLFormElement> = (e) => {\n e.preventDefault();\n submitHandler();\n setSubmitted(true);\n };\n\n return {\n currentValue,\n setCurrentValue,\n message,\n setMessage,\n submitted,\n handleSubmit,\n };\n};\n"],"names":["onSubmit","currentValue","setCurrentValue","useState","message","setMessage","submitted","setSubmitted","feedbackRef","useRef","useEffect","current","submitHandler","useCallback","intentionalSubmit","feedbackValue","Array","isArray","map","option","value","autoSubmit","window","addEventListener","removeEventListener","handleSubmit","e","preventDefault"],"mappings":"iIA0BIA,IAEA,MAAOC,EAAcC,GAAmBC,cAGjCC,EAASC,GAAcF,cACvBG,EAAWC,GAAgBJ,EAAAA,UAAS,GAErCK,EAAcC,EAAAA,OAAO,CACvBT,SAAAA,EACAC,aAAAA,EACAG,QAAAA,EACAE,UAAAA,IAGJI,EAAAA,
|
|
1
|
+
{"version":3,"file":"useMainQuestion.cjs","sources":["../../../../../src/components/feedback/main-question/useMainQuestion.ts"],"sourcesContent":["import {\n type Dispatch,\n type FormEventHandler,\n type SetStateAction,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport type { FeedbackOption, FeedbackType } from \"../types.js\";\n\ntype Value =\n | FeedbackOption<string | number>\n | FeedbackOption<string | number>[]\n | undefined;\n\ntype MainQuestion = {\n currentValue: Value;\n setCurrentValue: Dispatch<SetStateAction<Value>>;\n message: string | undefined;\n setMessage: Dispatch<SetStateAction<string | undefined>>;\n submitted: boolean;\n handleSubmit: FormEventHandler<HTMLFormElement>;\n};\n\nexport const useMainQuestion = (\n onSubmit: (f: FeedbackType) => void,\n): MainQuestion => {\n const [currentValue, setCurrentValue] = useState<\n FeedbackOption | FeedbackOption[]\n >();\n const [message, setMessage] = useState<string>();\n const [submitted, setSubmitted] = useState(false);\n\n const feedbackRef = useRef({\n onSubmit,\n currentValue,\n message,\n submitted,\n });\n\n useEffect(() => {\n feedbackRef.current = {\n ...feedbackRef.current,\n onSubmit,\n currentValue,\n message,\n submitted,\n };\n }, [onSubmit, currentValue, message, submitted]);\n\n const submitHandler = useCallback((intentionalSubmit = true) => {\n const { message, currentValue, submitted, onSubmit } =\n feedbackRef.current;\n\n if (!submitted && currentValue !== undefined) {\n const feedbackValue = Array.isArray(currentValue)\n ? currentValue.map((option) => option.value)\n : currentValue?.value;\n onSubmit({\n feedbackValue,\n intentionalSubmit,\n ...(intentionalSubmit && message ? { message } : {}),\n });\n }\n }, []);\n\n const autoSubmit = useCallback(() => submitHandler(false), [submitHandler]);\n\n useEffect(() => {\n if (typeof window !== \"undefined\") {\n window.addEventListener(\"beforeunload\", autoSubmit);\n }\n return () => {\n autoSubmit();\n window.removeEventListener(\"beforeunload\", autoSubmit);\n };\n }, [autoSubmit]);\n\n const handleSubmit: FormEventHandler<HTMLFormElement> = (e) => {\n e.preventDefault();\n submitHandler();\n setSubmitted(true);\n };\n\n return {\n currentValue,\n setCurrentValue,\n message,\n setMessage,\n submitted,\n handleSubmit,\n };\n};\n"],"names":["onSubmit","currentValue","setCurrentValue","useState","message","setMessage","submitted","setSubmitted","feedbackRef","useRef","useEffect","current","submitHandler","useCallback","intentionalSubmit","feedbackValue","Array","isArray","map","option","value","autoSubmit","window","addEventListener","removeEventListener","handleSubmit","e","preventDefault"],"mappings":"iIA0BIA,IAEA,MAAOC,EAAcC,GAAmBC,cAGjCC,EAASC,GAAcF,cACvBG,EAAWC,GAAgBJ,EAAAA,UAAS,GAErCK,EAAcC,EAAAA,OAAO,CACvBT,SAAAA,EACAC,aAAAA,EACAG,QAAAA,EACAE,UAAAA,IAGJI,EAAAA,UAAU,KACNF,EAAYG,QAAU,IACfH,EAAYG,QACfX,SAAAA,EACAC,aAAAA,EACAG,QAAAA,EACAE,UAAAA,IAEL,CAACN,EAAUC,EAAcG,EAASE,IAErC,MAAMM,EAAgBC,EAAAA,YAAY,CAACC,GAAoB,KACnD,MAAQV,QAAAA,EAASH,aAAAA,EAAcK,UAAAA,EAAWN,SAAAA,GACtCQ,EAAYG,QAEhB,IAAKL,QAA8B,IAAjBL,EAA4B,CAI1CD,EAAS,CACLe,cAJkBC,MAAMC,QAAQhB,GAC9BA,EAAaiB,IAAKC,GAAWA,EAAOC,OACpCnB,GAAcmB,MAGhBN,kBAAAA,KACIA,GAAqBV,EAAU,CAAEA,QAAAA,GAAY,CAAA,GAEzD,GACD,IAEGiB,EAAaR,EAAAA,YAAY,IAAMD,GAAc,GAAQ,CAACA,IAE5DF,OAAAA,EAAAA,UAAU,YACKY,OAAW,KAClBA,OAAOC,iBAAiB,eAAgBF,GAErC,KACHA,IACAC,OAAOE,oBAAoB,eAAgBH,KAEhD,CAACA,IAQG,CACHpB,aAAAA,EACAC,gBAAAA,EACAE,QAAAA,EACAC,WAAAA,EACAC,UAAAA,EACAmB,aAZqDC,IACrDA,EAAEC,iBACFf,IACAL,GAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.cjs","sources":["../../../../src/components/feedback/presets.tsx"],"sourcesContent":["import type { FeedbackProps } from \"./Feedback.js\";\nimport { defaultOptions as smileyOptions } from \"./questions/smileyUtils.js\";\n\nexport type PresetProperties = Pick<\n FeedbackProps,\n \"label\" | \"type\" | \"options\" | \"addOnQuestion\"\n>;\n\nconst smileyQuestion: PresetProperties = {\n type: \"smiley\",\n label: \"Hvor fornøyd er du med denne nettsiden?\",\n options: smileyOptions,\n addOnQuestion: true,\n};\n\nexport const PRESETS: Record<string, PresetProperties> = {\n \"Fant du\": {\n type: \"radio\",\n label: \"Fant du det du lette etter?\",\n options: [\n {\n label: \"Ja\",\n value: \"ja\",\n textAreaLabel:\n \"Så bra! Har du noen tilbakemeldinger kan du skrive dem her.\",\n },\n {\n label: \"Nei\",\n value: \"nei\",\n textAreaLabel:\n \"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n ],\n addOnQuestion: true,\n },\n \"Fikk du gjort\": {\n type: \"radio\",\n label: \"Fikk du gjort det du skulle?\",\n options: [\n {\n label: \"Ja\",\n value: \"ja\",\n textAreaLabel:\n \"Så bra! Har du noen tilbakemeldinger kan du skrive dem her.\",\n },\n {\n label: \"Nei\",\n value: \"nei\",\n textAreaLabel:\n \"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n ],\n addOnQuestion: true,\n },\n \"Hvor fornøyd 5\": smileyQuestion,\n Smileys: smileyQuestion,\n};\n"],"names":["smileyQuestion","type","label","options","
|
|
1
|
+
{"version":3,"file":"presets.cjs","sources":["../../../../src/components/feedback/presets.tsx"],"sourcesContent":["import type { FeedbackProps } from \"./Feedback.js\";\nimport { defaultOptions as smileyOptions } from \"./questions/smileyUtils.js\";\n\nexport type PresetProperties = Pick<\n FeedbackProps,\n \"label\" | \"type\" | \"options\" | \"addOnQuestion\"\n>;\n\nconst smileyQuestion: PresetProperties = {\n type: \"smiley\",\n label: \"Hvor fornøyd er du med denne nettsiden?\",\n options: smileyOptions,\n addOnQuestion: true,\n};\n\nexport const PRESETS: Record<string, PresetProperties> = {\n \"Fant du\": {\n type: \"radio\",\n label: \"Fant du det du lette etter?\",\n options: [\n {\n label: \"Ja\",\n value: \"ja\",\n textAreaLabel:\n \"Så bra! Har du noen tilbakemeldinger kan du skrive dem her.\",\n },\n {\n label: \"Nei\",\n value: \"nei\",\n textAreaLabel:\n \"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n ],\n addOnQuestion: true,\n },\n \"Fikk du gjort\": {\n type: \"radio\",\n label: \"Fikk du gjort det du skulle?\",\n options: [\n {\n label: \"Ja\",\n value: \"ja\",\n textAreaLabel:\n \"Så bra! Har du noen tilbakemeldinger kan du skrive dem her.\",\n },\n {\n label: \"Nei\",\n value: \"nei\",\n textAreaLabel:\n \"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n ],\n addOnQuestion: true,\n },\n \"Hvor fornøyd 5\": smileyQuestion,\n Smileys: smileyQuestion,\n};\n"],"names":["smileyQuestion","type","label","options","smileyOptions","addOnQuestion","PRESETS","value","textAreaLabel","Smileys"],"mappings":"sFAQMA,EAAmC,CACrCC,KAAM,SACNC,MAAO,0CACPC,+CAASC,eACTC,eAAe,GAGNC,EAA4C,CACrD,UAAW,CACPL,KAAM,QACNC,MAAO,8BACPC,QAAS,CACL,CACID,MAAO,KACPK,MAAO,KACPC,cACI,+DAER,CACIN,MAAO,MACPK,MAAO,MACPC,cACI,uFAGZH,eAAe,GAEnB,gBAAiB,CACbJ,KAAM,QACNC,MAAO,+BACPC,QAAS,CACL,CACID,MAAO,KACPK,MAAO,KACPC,cACI,+DAER,CACIN,MAAO,MACPK,MAAO,MACPC,cACI,uFAGZH,eAAe,GAEnB,iBAAkBL,EAClBS,QAAST"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),t=require("../../text-area/TextArea.cjs"),n=require("../feedbackContext.cjs"),s=require("../main-question/mainQuestionContext.cjs");exports.AddonQuestion=({helpLabel:a="Ikke skriv personlige opplysninger. Tilbakemeldinger som kommer inn her blir ikke besvart, men brukt i videre arbeid med å forbedre tjenestene våre.",label:i})=>{const{counter:o}=n.useFeedbackContext(),l=s.useMainQuestionContext(),[u,c]=r.useState();if(r.useEffect((
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),t=require("../../text-area/TextArea.cjs"),n=require("../feedbackContext.cjs"),s=require("../main-question/mainQuestionContext.cjs");exports.AddonQuestion=({helpLabel:a="Ikke skriv personlige opplysninger. Tilbakemeldinger som kommer inn her blir ikke besvart, men brukt i videre arbeid med å forbedre tjenestene våre.",label:i})=>{const{counter:o}=n.useFeedbackContext(),l=s.useMainQuestionContext(),[u,c]=r.useState();if(r.useEffect(()=>{const e=Array.isArray(l?.currentValue)?l?.currentValue[0].textAreaLabel?.toString():l?.currentValue?.textAreaLabel?.toString();c(e||i)},[l?.currentValue,i]),!l)return console.error("Addon question must be used inside a MainQuestion context provider"),null;const{message:d,setMessage:b}=l;return e.jsxs(e.Fragment,{children:[void 0!==l.currentValue&&e.jsxs("div",{className:"jkl-sr-only","aria-live":"polite",children:[u," ",a]}),e.jsx(t.TextArea,{startOpen:!0,rows:4,"data-testid":"jkl-feedback__open-question",className:"jkl-spacing-40--bottom jkl-spacing-40--top",label:u,labelProps:{srOnly:!0},placeholder:u,helpLabel:a,value:d||"",onChange:e=>b(e.target.value),counter:o})]})};
|
|
2
2
|
//# sourceMappingURL=AddonQuestion.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddonQuestion.cjs","sources":["../../../../../src/components/feedback/questions/AddonQuestion.tsx"],"sourcesContent":["import React, { type ChangeEventHandler, useEffect, useState } from \"react\";\nimport { TextArea } from \"../../text-area/TextArea.js\";\nimport { useFeedbackContext } from \"../feedbackContext.js\";\nimport { useMainQuestionContext } from \"../main-question/mainQuestionContext.js\";\n\ninterface Props {\n label?: string;\n helpLabel?: string;\n}\n\nexport const AddonQuestion: React.FC<Props> = ({\n helpLabel = \"Ikke skriv personlige opplysninger. Tilbakemeldinger som kommer inn her blir ikke besvart, men brukt i videre arbeid med å forbedre tjenestene våre.\",\n label,\n}) => {\n const { counter } = useFeedbackContext();\n const context = useMainQuestionContext();\n const [dynamicLabel, setDynamicLabel] = useState<string>();\n\n useEffect(() => {\n const labelFromValue = Array.isArray(context?.currentValue)\n ? context?.currentValue[0].textAreaLabel?.toString()\n : context?.currentValue?.textAreaLabel?.toString();\n setDynamicLabel(labelFromValue || label);\n }, [context?.currentValue, label]);\n\n if (!context) {\n console.error(\n \"Addon question must be used inside a MainQuestion context provider\",\n );\n return null;\n }\n\n const { message, setMessage } = context;\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = (e) =>\n setMessage(e.target.value);\n\n return (\n <>\n {context.currentValue !== undefined && (\n <div className=\"jkl-sr-only\" aria-live=\"polite\">\n {dynamicLabel} {helpLabel}\n </div>\n )}\n <TextArea\n startOpen\n rows={4}\n data-testid=\"jkl-feedback__open-question\"\n className=\"jkl-spacing-40--bottom jkl-spacing-40--top\"\n label={dynamicLabel}\n labelProps={{ srOnly: true }}\n placeholder={dynamicLabel}\n helpLabel={helpLabel}\n value={message || \"\"}\n onChange={handleChange}\n counter={counter}\n />\n </>\n );\n};\n"],"names":["helpLabel","label","counter","useFeedbackContext","context","useMainQuestionContext","dynamicLabel","setDynamicLabel","useState","useEffect","labelFromValue","Array","isArray","currentValue","textAreaLabel","toString","console","error","message","setMessage","jsxs","Fragment","children","className","jsx","TextArea","startOpen","rows","labelProps","srOnly","placeholder","value","onChange","e","target"],"mappings":"kSAU8C,EAC1CA,UAAAA,EAAY,uJACZC,MAAAA,
|
|
1
|
+
{"version":3,"file":"AddonQuestion.cjs","sources":["../../../../../src/components/feedback/questions/AddonQuestion.tsx"],"sourcesContent":["import React, { type ChangeEventHandler, useEffect, useState } from \"react\";\nimport { TextArea } from \"../../text-area/TextArea.js\";\nimport { useFeedbackContext } from \"../feedbackContext.js\";\nimport { useMainQuestionContext } from \"../main-question/mainQuestionContext.js\";\n\ninterface Props {\n label?: string;\n helpLabel?: string;\n}\n\nexport const AddonQuestion: React.FC<Props> = ({\n helpLabel = \"Ikke skriv personlige opplysninger. Tilbakemeldinger som kommer inn her blir ikke besvart, men brukt i videre arbeid med å forbedre tjenestene våre.\",\n label,\n}) => {\n const { counter } = useFeedbackContext();\n const context = useMainQuestionContext();\n const [dynamicLabel, setDynamicLabel] = useState<string>();\n\n useEffect(() => {\n const labelFromValue = Array.isArray(context?.currentValue)\n ? context?.currentValue[0].textAreaLabel?.toString()\n : context?.currentValue?.textAreaLabel?.toString();\n setDynamicLabel(labelFromValue || label);\n }, [context?.currentValue, label]);\n\n if (!context) {\n console.error(\n \"Addon question must be used inside a MainQuestion context provider\",\n );\n return null;\n }\n\n const { message, setMessage } = context;\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = (e) =>\n setMessage(e.target.value);\n\n return (\n <>\n {context.currentValue !== undefined && (\n <div className=\"jkl-sr-only\" aria-live=\"polite\">\n {dynamicLabel} {helpLabel}\n </div>\n )}\n <TextArea\n startOpen\n rows={4}\n data-testid=\"jkl-feedback__open-question\"\n className=\"jkl-spacing-40--bottom jkl-spacing-40--top\"\n label={dynamicLabel}\n labelProps={{ srOnly: true }}\n placeholder={dynamicLabel}\n helpLabel={helpLabel}\n value={message || \"\"}\n onChange={handleChange}\n counter={counter}\n />\n </>\n );\n};\n"],"names":["helpLabel","label","counter","useFeedbackContext","context","useMainQuestionContext","dynamicLabel","setDynamicLabel","useState","useEffect","labelFromValue","Array","isArray","currentValue","textAreaLabel","toString","console","error","message","setMessage","jsxs","Fragment","children","className","jsx","TextArea","startOpen","rows","labelProps","srOnly","placeholder","value","onChange","e","target"],"mappings":"kSAU8C,EAC1CA,UAAAA,EAAY,uJACZC,MAAAA,MAEA,MAAQC,QAAAA,GAAYC,uBACdC,EAAUC,EAAAA,0BACTC,EAAcC,GAAmBC,aASxC,GAPAC,EAAAA,UAAU,KACN,MAAMC,EAAiBC,MAAMC,QAAQR,GAASS,cACxCT,GAASS,aAAa,GAAGC,eAAeC,WACxCX,GAASS,cAAcC,eAAeC,WAC5CR,EAAgBG,GAAkBT,IACnC,CAACG,GAASS,aAAcZ,KAEtBG,EACD,OAAAY,QAAQC,MACJ,sEAEG,KAGX,MAAQC,QAAAA,EAASC,WAAAA,GAAef,EAIhC,OACIgB,EAAAA,KAAAC,WAAA,CACKC,SAAA,MAAyB,IAAzBlB,EAAQS,cACLO,EAAAA,KAAC,OAAIG,UAAU,cAAc,YAAU,SAClCD,SAAA,CAAAhB,EAAa,IAAEN,KAGxBwB,EAAAA,IAACC,EAAAA,SAAA,CACGC,WAAS,EACTC,KAAM,EACN,cAAY,8BACZJ,UAAU,6CACVtB,MAAOK,EACPsB,WAAY,CAAEC,QAAQ,GACtBC,YAAaxB,EACbN,UAAAA,EACA+B,MAAOb,GAAW,GAClBc,SApBmDC,GAC3Dd,EAAWc,EAAEC,OAAOH,OAoBZ7B,QAAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),t=require("../../checkbox/Checkbox.cjs"),u=require("../../input-group/FieldGroup.cjs"),o=require("../followup/followupContext.cjs"),n=require("../main-question/mainQuestionContext.cjs");exports.CheckboxQuestion=({label:l,name:i,options:s,helpLabel:a,autoFocus:c=!1})=>{const p=o.useFollowUpContext(),d=n.useMainQuestionContext(),f=p||d,x=r.useRef(null);r.useEffect((
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),t=require("../../checkbox/Checkbox.cjs"),u=require("../../input-group/FieldGroup.cjs"),o=require("../followup/followupContext.cjs"),n=require("../main-question/mainQuestionContext.cjs");exports.CheckboxQuestion=({label:l,name:i,options:s,helpLabel:a,autoFocus:c=!1})=>{const p=o.useFollowUpContext(),d=n.useMainQuestionContext(),f=p||d,x=r.useRef(null);r.useEffect(()=>{c&&x.current&&x.current.focus()},[c]);const b=e=>{const{value:r}=e.target,t=s?.find(e=>e.value.toString()===r);if(t){if(!f?.currentValue)return void f?.setCurrentValue([t]);if(Array.isArray(f?.currentValue)){const e=f.currentValue.find(e=>e===t);e?f.setCurrentValue(r=>r.filter(r=>r!==e)):f.setCurrentValue(e=>[...e,t])}}};return f?e.jsx(u.FieldGroup,{labelProps:{variant:"large"},legend:l,helpLabel:a,children:s?.map((r,u)=>e.jsx(t.Checkbox,{name:i||l,value:r.value.toString(),onChange:b,ref:0===u?x:void 0,children:r.label},`${l}-${r.value}`))}):(console.error("Questions must be used inside a Followup or Feedback context provider"),null)};
|
|
2
2
|
//# sourceMappingURL=CheckboxQuestion.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxQuestion.cjs","sources":["../../../../../src/components/feedback/questions/CheckboxQuestion.tsx"],"sourcesContent":["import React, { type ChangeEventHandler, useEffect, useRef } from \"react\";\nimport { Checkbox } from \"../../checkbox/Checkbox.js\";\nimport { FieldGroup } from \"../../input-group/FieldGroup.js\";\nimport { useFollowUpContext } from \"../followup/followupContext.js\";\nimport { useMainQuestionContext } from \"../main-question/mainQuestionContext.js\";\nimport type { FeedbackOption, QuestionProps } from \"../types.js\";\n\nexport const CheckboxQuestion: React.FC<QuestionProps> = ({\n label,\n name,\n options,\n helpLabel,\n autoFocus = false,\n}) => {\n const followupContext = useFollowUpContext();\n const feedbackContext = useMainQuestionContext();\n const context = followupContext || feedbackContext;\n const ref = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (autoFocus && ref.current) {\n ref.current.focus();\n }\n }, [autoFocus]);\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n const { value } = event.target;\n const matchingOption = options?.find(\n (option) => option.value.toString() === value,\n );\n if (!matchingOption) return;\n\n if (!context?.currentValue) {\n context?.setCurrentValue([matchingOption]);\n return;\n }\n\n if (Array.isArray(context?.currentValue)) {\n const found = context.currentValue.find(\n (option) => option === matchingOption,\n );\n if (found) {\n context.setCurrentValue((oldValues) =>\n (oldValues as FeedbackOption[]).filter(\n (option) => option !== found,\n ),\n );\n } else {\n context.setCurrentValue((oldValues) => [\n ...(oldValues as FeedbackOption[]),\n matchingOption,\n ]);\n }\n }\n };\n\n if (!context) {\n console.error(\n \"Questions must be used inside a Followup or Feedback context provider\",\n );\n return null;\n }\n\n return (\n <FieldGroup\n labelProps={{ variant: \"large\" }}\n legend={label}\n helpLabel={helpLabel}\n >\n {options?.map((option, i) => (\n <Checkbox\n key={`${label}-${option.value}`}\n name={name || label}\n value={option.value.toString()}\n onChange={handleChange}\n ref={i === 0 ? ref : undefined}\n >\n {option.label}\n </Checkbox>\n ))}\n </FieldGroup>\n );\n};\n"],"names":["label","name","options","helpLabel","autoFocus","followupContext","useFollowUpContext","feedbackContext","useMainQuestionContext","context","ref","useRef","useEffect","current","focus","handleChange","event","value","target","matchingOption","find","option","toString","currentValue","setCurrentValue","Array","isArray","found","oldValues","filter","jsx","FieldGroup","labelProps","variant","legend","children","map","i","Checkbox","onChange","console","error"],"mappings":"2VAOyD,EACrDA,MAAAA,EACAC,KAAAA,EACAC,QAAAA,EACAC,UAAAA,EACAC,UAAAA,GAAY,MAEZ,MAAMC,EAAkBC,EAAAA,qBAClBC,EAAkBC,EAAAA,yBAClBC,EAAUJ,GAAmBE,EAC7BG,EAAMC,
|
|
1
|
+
{"version":3,"file":"CheckboxQuestion.cjs","sources":["../../../../../src/components/feedback/questions/CheckboxQuestion.tsx"],"sourcesContent":["import React, { type ChangeEventHandler, useEffect, useRef } from \"react\";\nimport { Checkbox } from \"../../checkbox/Checkbox.js\";\nimport { FieldGroup } from \"../../input-group/FieldGroup.js\";\nimport { useFollowUpContext } from \"../followup/followupContext.js\";\nimport { useMainQuestionContext } from \"../main-question/mainQuestionContext.js\";\nimport type { FeedbackOption, QuestionProps } from \"../types.js\";\n\nexport const CheckboxQuestion: React.FC<QuestionProps> = ({\n label,\n name,\n options,\n helpLabel,\n autoFocus = false,\n}) => {\n const followupContext = useFollowUpContext();\n const feedbackContext = useMainQuestionContext();\n const context = followupContext || feedbackContext;\n const ref = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (autoFocus && ref.current) {\n ref.current.focus();\n }\n }, [autoFocus]);\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n const { value } = event.target;\n const matchingOption = options?.find(\n (option) => option.value.toString() === value,\n );\n if (!matchingOption) return;\n\n if (!context?.currentValue) {\n context?.setCurrentValue([matchingOption]);\n return;\n }\n\n if (Array.isArray(context?.currentValue)) {\n const found = context.currentValue.find(\n (option) => option === matchingOption,\n );\n if (found) {\n context.setCurrentValue((oldValues) =>\n (oldValues as FeedbackOption[]).filter(\n (option) => option !== found,\n ),\n );\n } else {\n context.setCurrentValue((oldValues) => [\n ...(oldValues as FeedbackOption[]),\n matchingOption,\n ]);\n }\n }\n };\n\n if (!context) {\n console.error(\n \"Questions must be used inside a Followup or Feedback context provider\",\n );\n return null;\n }\n\n return (\n <FieldGroup\n labelProps={{ variant: \"large\" }}\n legend={label}\n helpLabel={helpLabel}\n >\n {options?.map((option, i) => (\n <Checkbox\n key={`${label}-${option.value}`}\n name={name || label}\n value={option.value.toString()}\n onChange={handleChange}\n ref={i === 0 ? ref : undefined}\n >\n {option.label}\n </Checkbox>\n ))}\n </FieldGroup>\n );\n};\n"],"names":["label","name","options","helpLabel","autoFocus","followupContext","useFollowUpContext","feedbackContext","useMainQuestionContext","context","ref","useRef","useEffect","current","focus","handleChange","event","value","target","matchingOption","find","option","toString","currentValue","setCurrentValue","Array","isArray","found","oldValues","filter","jsx","FieldGroup","labelProps","variant","legend","children","map","i","Checkbox","onChange","console","error"],"mappings":"2VAOyD,EACrDA,MAAAA,EACAC,KAAAA,EACAC,QAAAA,EACAC,UAAAA,EACAC,UAAAA,GAAY,MAEZ,MAAMC,EAAkBC,EAAAA,qBAClBC,EAAkBC,EAAAA,yBAClBC,EAAUJ,GAAmBE,EAC7BG,EAAMC,EAAAA,OAAyB,MAErCC,EAAAA,UAAU,KACFR,GAAaM,EAAIG,SACjBH,EAAIG,QAAQC,SAEjB,CAACV,IAEJ,MAAMW,EAAsDC,IACxD,MAAQC,MAAAA,GAAUD,EAAME,OAClBC,EAAiBjB,GAASkB,KAC3BC,GAAWA,EAAOJ,MAAMK,aAAeL,GAE5C,GAAKE,EAEL,CAAA,IAAKV,GAASc,aAEV,YADAd,GAASe,gBAAgB,CAACL,IAI9B,GAAIM,MAAMC,QAAQjB,GAASc,cAAe,CACtC,MAAMI,EAAQlB,EAAQc,aAAaH,KAC9BC,GAAWA,IAAWF,GAEvBQ,EACAlB,EAAQe,gBAAiBI,GACpBA,EAA+BC,OAC3BR,GAAWA,IAAWM,IAI/BlB,EAAQe,gBAAiBI,GAAc,IAC/BA,EACJT,GAGZ,CAAA,GAGJ,OAAKV,EAQDqB,EAAAA,IAACC,EAAAA,WAAA,CACGC,WAAY,CAAEC,QAAS,SACvBC,OAAQlC,EACRG,UAAAA,EAECgC,SAAAjC,GAASkC,IAAI,CAACf,EAAQgB,IACnBP,EAAAA,IAACQ,EAAAA,SAAA,CAEGrC,KAAMA,GAAQD,EACdiB,MAAOI,EAAOJ,MAAMK,WACpBiB,SAAUxB,EACVL,IAAW,IAAN2B,EAAU3B,OAAM,EAEpByB,SAAAd,EAAOrB,OANH,GAAGA,KAASqB,EAAOJ,aAdpCuB,QAAQC,MACJ,yEAEG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),r=require("../../../utilities/validators/isValidEpost/isValidEpost.cjs"),a=require("../../../utilities/validators/isValidTelefonnummer/isValidTelefonnummer.cjs"),n=require("../../button/Button.cjs"),s=require("../../text-input/TextInput.cjs"),i=require("../FeedbackSuccess.cjs"),l=require("../feedbackContext.cjs"),o={title:"Takk for tiden din!",children:"Neste gang vi gjennomfører intervjuer og tester kan det hende vi tar kontakt med deg. Dine innspill hjelper oss med å gjøre nettsidene bedre for deg og alle andre som bruker dem."};exports.ContactQuestion=({label:u="Kan vi kontakte deg for flere innspill?",sendButtonLabel:c="Sett meg på lista!",withPhone:d=!1,onSubmit:m,successMessage:p=o,children:g})=>{const[k,j]=t.useState(""),[b,f]=t.useState(""),[v,h]=t.useState({}),x=t.useRef(null),S=t.useRef(null),[E,C]=t.useState(!1),[T,y]=t.useState(!1),{contactSubmitted:N,setContactSubmitted:q,landmarkLabel:V}=l.useFeedbackContext(),P="string"==typeof g?"p":"div",B=t.useCallback((
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),r=require("../../../utilities/validators/isValidEpost/isValidEpost.cjs"),a=require("../../../utilities/validators/isValidTelefonnummer/isValidTelefonnummer.cjs"),n=require("../../button/Button.cjs"),s=require("../../text-input/TextInput.cjs"),i=require("../FeedbackSuccess.cjs"),l=require("../feedbackContext.cjs"),o={title:"Takk for tiden din!",children:"Neste gang vi gjennomfører intervjuer og tester kan det hende vi tar kontakt med deg. Dine innspill hjelper oss med å gjøre nettsidene bedre for deg og alle andre som bruker dem."};exports.ContactQuestion=({label:u="Kan vi kontakte deg for flere innspill?",sendButtonLabel:c="Sett meg på lista!",withPhone:d=!1,onSubmit:m,successMessage:p=o,children:g})=>{const[k,j]=t.useState(""),[b,f]=t.useState(""),[v,h]=t.useState({}),x=t.useRef(null),S=t.useRef(null),[E,C]=t.useState(!1),[T,y]=t.useState(!1),{contactSubmitted:N,setContactSubmitted:q,landmarkLabel:V}=l.useFeedbackContext(),P="string"==typeof g?"p":"div",B=t.useCallback((e,t)=>{const n=(e=>e&&""!==e?r.isValidEpost(e)?void 0:"Skriv inn en gyldig e-postadresse":"Du må oppgi e-postadresse for at vi kan kontakte deg")(e),s=(e=>e&&""!==e?a.isValidTelefonnummer(e)?void 0:"Skriv inn et gyldig telefonnummer":"Du må oppgi telefonnummer for at vi kan kontakte deg")(t);return h({email:n,phone:s}),{emailError:n,phoneError:s}},[]);t.useEffect(()=>{if(E){const{emailError:e,phoneError:t}=B(k,b);!e&&(!d||!t)&&C(!1)}},[k,b,E,d,B]);const D=e=>t=>e(t.target.value);return T?null:N?e.jsx(i.FeedbackSuccess,{...p}):e.jsxs("form",{className:"jkl-spacing-40--top",onSubmit:e=>{e.preventDefault();const{emailError:t,phoneError:r}=B(k,b);return t?(C(!0),void x.current?.focus()):d&&r?(C(!0),void S.current?.focus()):(m({email:k,phone:d?b:void 0}),void q(!0))},"aria-label":V,children:[e.jsx("p",{className:"jkl-heading-4 jkl-spacing-8--bottom",children:u}),g&&e.jsx(P,{className:"jkl-body",children:g}),e.jsx(s.TextInput,{ref:x,className:"jkl-spacing-24--top",label:"E-post",labelProps:{variant:"small"},autoComplete:"email",name:"email",value:k,onChange:D(j),errorLabel:v.email}),d&&e.jsx(s.TextInput,{ref:S,className:"jkl-spacing-24--top",label:"Telefonnummer",labelProps:{variant:"small"},autoComplete:"tel",name:"phone",value:b,onChange:D(f),errorLabel:v.phone}),e.jsxs("div",{className:"jkl-spacing-40--top",children:[e.jsx(n.PrimaryButton,{type:"submit",className:"jkl-spacing-40--right",children:c}),e.jsx(n.TertiaryButton,{onClick:()=>y(!0),children:"Nei takk"})]})]})};
|
|
2
2
|
//# sourceMappingURL=ContactQuestion.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactQuestion.cjs","sources":["../../../../../src/components/feedback/questions/ContactQuestion.tsx"],"sourcesContent":["import React, {\n type ChangeEvent,\n type FC,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { isValidEpost } from \"../../../utilities/validators/isValidEpost/isValidEpost.js\";\nimport { isValidTelefonnummer } from \"../../../utilities/validators/isValidTelefonnummer/isValidTelefonnummer.js\";\nimport { PrimaryButton, TertiaryButton } from \"../../button/Button.js\";\nimport { TextInput } from \"../../text-input/TextInput.js\";\nimport { FeedbackSuccess } from \"../FeedbackSuccess.js\";\nimport { useFeedbackContext } from \"../feedbackContext.js\";\nimport type { ContactQuestionProps } from \"../types.js\";\n\nconst validateEmail = (email?: string) => {\n if (!email || email === \"\") {\n return \"Du må oppgi e-postadresse for at vi kan kontakte deg\";\n }\n if (!isValidEpost(email)) {\n return \"Skriv inn en gyldig e-postadresse\";\n }\n return;\n};\n\nconst validatePhone = (phone?: string) => {\n if (!phone || phone === \"\") {\n return \"Du må oppgi telefonnummer for at vi kan kontakte deg\";\n }\n if (!isValidTelefonnummer(phone)) {\n return \"Skriv inn et gyldig telefonnummer\";\n }\n return;\n};\n\nconst defaultSuccessMessage = {\n title: \"Takk for tiden din!\",\n children:\n \"Neste gang vi gjennomfører intervjuer og tester kan det hende vi tar kontakt med deg. Dine innspill hjelper oss med å gjøre nettsidene bedre for deg og alle andre som bruker dem.\",\n};\n\nexport const ContactQuestion: FC<ContactQuestionProps> = ({\n label = \"Kan vi kontakte deg for flere innspill?\",\n sendButtonLabel = \"Sett meg på lista!\",\n withPhone = false,\n onSubmit,\n successMessage = defaultSuccessMessage,\n children,\n}) => {\n const [email, setEmail] = useState(\"\");\n const [phone, setPhone] = useState(\"\");\n const [errors, setErrors] = useState<{ email?: string; phone?: string }>(\n {},\n );\n const emailRef = useRef<HTMLInputElement>(null);\n const phoneRef = useRef<HTMLInputElement>(null);\n const [shouldValidate, setShouldValidate] = useState(false);\n\n const [noThanks, setNoThanks] = useState(false);\n const { contactSubmitted, setContactSubmitted, landmarkLabel } =\n useFeedbackContext();\n\n const ChildrenWrapper = typeof children === \"string\" ? \"p\" : \"div\";\n\n const validate = useCallback((email: string, phone: string) => {\n const emailError = validateEmail(email);\n const phoneError = validatePhone(phone);\n setErrors({ email: emailError, phone: phoneError });\n return { emailError, phoneError };\n }, []);\n\n useEffect(() => {\n if (shouldValidate) {\n const { emailError, phoneError } = validate(email, phone);\n\n if (!emailError && (!withPhone || !phoneError)) {\n setShouldValidate(false);\n }\n }\n }, [email, phone, shouldValidate, withPhone, validate]);\n\n const handleChange =\n (consumer: (value: string) => void) =>\n (e: ChangeEvent<HTMLInputElement>) =>\n consumer(e.target.value);\n\n const handleSubmit: React.FormEventHandler = (e) => {\n e.preventDefault();\n\n const { emailError, phoneError } = validate(email, phone);\n if (emailError) {\n setShouldValidate(true);\n emailRef.current?.focus();\n return;\n }\n if (withPhone && phoneError) {\n setShouldValidate(true);\n phoneRef.current?.focus();\n return;\n }\n\n onSubmit({ email, phone: withPhone ? phone : undefined });\n setContactSubmitted(true);\n };\n\n if (noThanks) {\n return null;\n }\n\n if (contactSubmitted) {\n return <FeedbackSuccess {...successMessage} />;\n }\n\n return (\n <form\n className=\"jkl-spacing-40--top\"\n onSubmit={handleSubmit}\n aria-label={landmarkLabel}\n >\n <p className=\"jkl-heading-4 jkl-spacing-8--bottom\">{label}</p>\n {children && (\n <ChildrenWrapper className=\"jkl-body\">\n {children}\n </ChildrenWrapper>\n )}\n\n <TextInput\n ref={emailRef}\n className=\"jkl-spacing-24--top\"\n label=\"E-post\"\n labelProps={{ variant: \"small\" }}\n autoComplete=\"email\"\n name=\"email\"\n value={email}\n onChange={handleChange(setEmail)}\n errorLabel={errors.email}\n />\n {withPhone && (\n <TextInput\n ref={phoneRef}\n className=\"jkl-spacing-24--top\"\n label=\"Telefonnummer\"\n labelProps={{ variant: \"small\" }}\n autoComplete=\"tel\"\n name=\"phone\"\n value={phone}\n onChange={handleChange(setPhone)}\n errorLabel={errors.phone}\n />\n )}\n\n <div className=\"jkl-spacing-40--top\">\n <PrimaryButton type=\"submit\" className=\"jkl-spacing-40--right\">\n {sendButtonLabel}\n </PrimaryButton>\n <TertiaryButton onClick={() => setNoThanks(true)}>\n Nei takk\n </TertiaryButton>\n </div>\n </form>\n );\n};\n"],"names":["defaultSuccessMessage","title","children","label","sendButtonLabel","withPhone","onSubmit","successMessage","email","setEmail","useState","phone","setPhone","errors","setErrors","emailRef","useRef","phoneRef","shouldValidate","setShouldValidate","noThanks","setNoThanks","contactSubmitted","setContactSubmitted","landmarkLabel","useFeedbackContext","ChildrenWrapper","validate","useCallback","emailError","isValidEpost","validateEmail","phoneError","isValidTelefonnummer","validatePhone","useEffect","handleChange","consumer","e","target","value","jsx","FeedbackSuccess","jsxs","className","preventDefault","current","focus","TextInput","ref","labelProps","variant","autoComplete","name","onChange","errorLabel","PrimaryButton","type","TertiaryButton","onClick"],"mappings":"mcAoCMA,EAAwB,CAC1BC,MAAO,sBACPC,SACI,8MAGiD,EACrDC,MAAAA,EAAQ,0CACRC,gBAAAA,EAAkB,qBAClBC,UAAAA,GAAY,EACZC,SAAAA,EACAC,eAAAA,EAAiBP,EACjBE,SAAAA,MAEA,MAAOM,EAAOC,GAAYC,EAAAA,SAAS,KAC5BC,EAAOC,GAAYF,EAAAA,SAAS,KAC5BG,EAAQC,GAAaJ,EAAAA,SACxB,CAAA,GAEEK,EAAWC,
|
|
1
|
+
{"version":3,"file":"ContactQuestion.cjs","sources":["../../../../../src/components/feedback/questions/ContactQuestion.tsx"],"sourcesContent":["import React, {\n type ChangeEvent,\n type FC,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { isValidEpost } from \"../../../utilities/validators/isValidEpost/isValidEpost.js\";\nimport { isValidTelefonnummer } from \"../../../utilities/validators/isValidTelefonnummer/isValidTelefonnummer.js\";\nimport { PrimaryButton, TertiaryButton } from \"../../button/Button.js\";\nimport { TextInput } from \"../../text-input/TextInput.js\";\nimport { FeedbackSuccess } from \"../FeedbackSuccess.js\";\nimport { useFeedbackContext } from \"../feedbackContext.js\";\nimport type { ContactQuestionProps } from \"../types.js\";\n\nconst validateEmail = (email?: string) => {\n if (!email || email === \"\") {\n return \"Du må oppgi e-postadresse for at vi kan kontakte deg\";\n }\n if (!isValidEpost(email)) {\n return \"Skriv inn en gyldig e-postadresse\";\n }\n return;\n};\n\nconst validatePhone = (phone?: string) => {\n if (!phone || phone === \"\") {\n return \"Du må oppgi telefonnummer for at vi kan kontakte deg\";\n }\n if (!isValidTelefonnummer(phone)) {\n return \"Skriv inn et gyldig telefonnummer\";\n }\n return;\n};\n\nconst defaultSuccessMessage = {\n title: \"Takk for tiden din!\",\n children:\n \"Neste gang vi gjennomfører intervjuer og tester kan det hende vi tar kontakt med deg. Dine innspill hjelper oss med å gjøre nettsidene bedre for deg og alle andre som bruker dem.\",\n};\n\nexport const ContactQuestion: FC<ContactQuestionProps> = ({\n label = \"Kan vi kontakte deg for flere innspill?\",\n sendButtonLabel = \"Sett meg på lista!\",\n withPhone = false,\n onSubmit,\n successMessage = defaultSuccessMessage,\n children,\n}) => {\n const [email, setEmail] = useState(\"\");\n const [phone, setPhone] = useState(\"\");\n const [errors, setErrors] = useState<{ email?: string; phone?: string }>(\n {},\n );\n const emailRef = useRef<HTMLInputElement>(null);\n const phoneRef = useRef<HTMLInputElement>(null);\n const [shouldValidate, setShouldValidate] = useState(false);\n\n const [noThanks, setNoThanks] = useState(false);\n const { contactSubmitted, setContactSubmitted, landmarkLabel } =\n useFeedbackContext();\n\n const ChildrenWrapper = typeof children === \"string\" ? \"p\" : \"div\";\n\n const validate = useCallback((email: string, phone: string) => {\n const emailError = validateEmail(email);\n const phoneError = validatePhone(phone);\n setErrors({ email: emailError, phone: phoneError });\n return { emailError, phoneError };\n }, []);\n\n useEffect(() => {\n if (shouldValidate) {\n const { emailError, phoneError } = validate(email, phone);\n\n if (!emailError && (!withPhone || !phoneError)) {\n setShouldValidate(false);\n }\n }\n }, [email, phone, shouldValidate, withPhone, validate]);\n\n const handleChange =\n (consumer: (value: string) => void) =>\n (e: ChangeEvent<HTMLInputElement>) =>\n consumer(e.target.value);\n\n const handleSubmit: React.FormEventHandler = (e) => {\n e.preventDefault();\n\n const { emailError, phoneError } = validate(email, phone);\n if (emailError) {\n setShouldValidate(true);\n emailRef.current?.focus();\n return;\n }\n if (withPhone && phoneError) {\n setShouldValidate(true);\n phoneRef.current?.focus();\n return;\n }\n\n onSubmit({ email, phone: withPhone ? phone : undefined });\n setContactSubmitted(true);\n };\n\n if (noThanks) {\n return null;\n }\n\n if (contactSubmitted) {\n return <FeedbackSuccess {...successMessage} />;\n }\n\n return (\n <form\n className=\"jkl-spacing-40--top\"\n onSubmit={handleSubmit}\n aria-label={landmarkLabel}\n >\n <p className=\"jkl-heading-4 jkl-spacing-8--bottom\">{label}</p>\n {children && (\n <ChildrenWrapper className=\"jkl-body\">\n {children}\n </ChildrenWrapper>\n )}\n\n <TextInput\n ref={emailRef}\n className=\"jkl-spacing-24--top\"\n label=\"E-post\"\n labelProps={{ variant: \"small\" }}\n autoComplete=\"email\"\n name=\"email\"\n value={email}\n onChange={handleChange(setEmail)}\n errorLabel={errors.email}\n />\n {withPhone && (\n <TextInput\n ref={phoneRef}\n className=\"jkl-spacing-24--top\"\n label=\"Telefonnummer\"\n labelProps={{ variant: \"small\" }}\n autoComplete=\"tel\"\n name=\"phone\"\n value={phone}\n onChange={handleChange(setPhone)}\n errorLabel={errors.phone}\n />\n )}\n\n <div className=\"jkl-spacing-40--top\">\n <PrimaryButton type=\"submit\" className=\"jkl-spacing-40--right\">\n {sendButtonLabel}\n </PrimaryButton>\n <TertiaryButton onClick={() => setNoThanks(true)}>\n Nei takk\n </TertiaryButton>\n </div>\n </form>\n );\n};\n"],"names":["defaultSuccessMessage","title","children","label","sendButtonLabel","withPhone","onSubmit","successMessage","email","setEmail","useState","phone","setPhone","errors","setErrors","emailRef","useRef","phoneRef","shouldValidate","setShouldValidate","noThanks","setNoThanks","contactSubmitted","setContactSubmitted","landmarkLabel","useFeedbackContext","ChildrenWrapper","validate","useCallback","emailError","isValidEpost","validateEmail","phoneError","isValidTelefonnummer","validatePhone","useEffect","handleChange","consumer","e","target","value","jsx","FeedbackSuccess","jsxs","className","preventDefault","current","focus","TextInput","ref","labelProps","variant","autoComplete","name","onChange","errorLabel","PrimaryButton","type","TertiaryButton","onClick"],"mappings":"mcAoCMA,EAAwB,CAC1BC,MAAO,sBACPC,SACI,8MAGiD,EACrDC,MAAAA,EAAQ,0CACRC,gBAAAA,EAAkB,qBAClBC,UAAAA,GAAY,EACZC,SAAAA,EACAC,eAAAA,EAAiBP,EACjBE,SAAAA,MAEA,MAAOM,EAAOC,GAAYC,EAAAA,SAAS,KAC5BC,EAAOC,GAAYF,EAAAA,SAAS,KAC5BG,EAAQC,GAAaJ,EAAAA,SACxB,CAAA,GAEEK,EAAWC,EAAAA,OAAyB,MACpCC,EAAWD,EAAAA,OAAyB,OACnCE,EAAgBC,GAAqBT,EAAAA,UAAS,IAE9CU,EAAUC,GAAeX,EAAAA,UAAS,IACjCY,iBAAAA,EAAkBC,oBAAAA,EAAqBC,cAAAA,GAC3CC,EAAAA,qBAEEC,EAAsC,iBAAbxB,EAAwB,IAAM,MAEvDyB,EAAWC,EAAAA,YAAY,CAACpB,EAAeG,KACzC,MAAMkB,EAlDSrB,IACdA,GAAmB,KAAVA,EAGTsB,EAAAA,aAAatB,QAAlB,EACW,oCAHA,uDAgDYuB,CAAcvB,GAC3BwB,EAzCSrB,IACdA,GAAmB,KAAVA,EAGTsB,EAAAA,qBAAqBtB,QAA1B,EACW,oCAHA,uDAuCYuB,CAAcvB,GACjC,OAAAG,EAAU,CAAEN,MAAOqB,EAAYlB,MAAOqB,IAC/B,CAAEH,WAAAA,EAAYG,WAAAA,IACtB,IAEHG,EAAAA,UAAU,KACN,GAAIjB,EAAgB,CAChB,MAAQW,WAAAA,EAAYG,WAAAA,GAAeL,EAASnB,EAAOG,IAE9CkB,KAAgBxB,IAAc2B,IAC/Bb,GAAkB,EAE1B,GACD,CAACX,EAAOG,EAAOO,EAAgBb,EAAWsB,IAE7C,MAAMS,EACDC,GACAC,GACGD,EAASC,EAAEC,OAAOC,OAqB1B,OAAIpB,EACO,KAGPE,EACOmB,MAACC,EAAAA,gBAAA,IAAoBnC,IAI5BoC,EAAAA,KAAC,OAAA,CACGC,UAAU,sBACVtC,SA9BsCgC,IAC1CA,EAAEO,iBAEF,MAAQhB,WAAAA,EAAYG,WAAAA,GAAeL,EAASnB,EAAOG,GACnD,OAAIkB,GACAV,GAAkB,QAClBJ,EAAS+B,SAASC,SAGlB1C,GAAa2B,GACbb,GAAkB,QAClBF,EAAS6B,SAASC,UAItBzC,EAAS,CAAEE,MAAAA,EAAOG,MAAON,EAAYM,OAAQ,SAC7CY,GAAoB,KAehB,aAAYC,EAEZtB,SAAA,CAAAuC,EAAAA,IAAC,IAAA,CAAEG,UAAU,sCAAuC1C,SAAAC,IACnDD,GACGuC,EAAAA,IAACf,EAAA,CAAgBkB,UAAU,WACtB1C,SAAAA,IAITuC,EAAAA,IAACO,EAAAA,UAAA,CACGC,IAAKlC,EACL6B,UAAU,sBACVzC,MAAM,SACN+C,WAAY,CAAEC,QAAS,SACvBC,aAAa,QACbC,KAAK,QACLb,MAAOhC,EACP8C,SAAUlB,EAAa3B,GACvB8C,WAAY1C,EAAOL,QAEtBH,GACGoC,EAAAA,IAACO,EAAAA,UAAA,CACGC,IAAKhC,EACL2B,UAAU,sBACVzC,MAAM,gBACN+C,WAAY,CAAEC,QAAS,SACvBC,aAAa,MACbC,KAAK,QACLb,MAAO7B,EACP2C,SAAUlB,EAAaxB,GACvB2C,WAAY1C,EAAOF,QAI3BgC,EAAAA,KAAC,MAAA,CAAIC,UAAU,sBACX1C,SAAA,CAAAuC,MAACe,EAAAA,cAAA,CAAcC,KAAK,SAASb,UAAU,wBAClC1C,SAAAE,UAEJsD,EAAAA,eAAA,CAAeC,QAAS,IAAMtC,GAAY,GAAOnB,SAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),r=require("../../radio-button/RadioButton.cjs"),o=require("../../radio-button/RadioButtonGroup.cjs"),u=require("../followup/followupContext.cjs"),n=require("../main-question/mainQuestionContext.cjs");exports.RadioQuestion=({label:a,name:l,options:i,helpLabel:s,autoFocus:c=!1})=>{const d=u.useFollowUpContext(),p=n.useMainQuestionContext(),b=d||p,v=t.useId(),g=i?.length||0,x=t.useRef(null);t.useEffect((
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),r=require("../../radio-button/RadioButton.cjs"),o=require("../../radio-button/RadioButtonGroup.cjs"),u=require("../followup/followupContext.cjs"),n=require("../main-question/mainQuestionContext.cjs");exports.RadioQuestion=({label:a,name:l,options:i,helpLabel:s,autoFocus:c=!1})=>{const d=u.useFollowUpContext(),p=n.useMainQuestionContext(),b=d||p,v=t.useId(),g=i?.length||0,x=t.useRef(null);t.useEffect(()=>{c&&x.current&&x.current.focus()},[c]);const f=t.useMemo(()=>Array.isArray(b?.currentValue)?b?.currentValue[0].value.toString():b?.currentValue?.value.toString(),[b?.currentValue]);return b?e.jsx(o.RadioButtonGroup,{legend:a,labelProps:{variant:"large"},name:`${v}-${l||a}`,inline:g<3,value:f||"",onChange:e=>{const t=i?.find(t=>t.value.toString()===e.target.value);b?.setCurrentValue(t)},helpLabel:s,children:i?.map((t,o)=>e.jsx(r.RadioButton,{ref:0===o?x:void 0,label:t.label,value:String(t.value)},`${v}-${l||a}-${t.value}`))}):(console.error("Questions must be used inside a Followup or Feedback context provider"),null)};
|
|
2
2
|
//# sourceMappingURL=RadioQuestion.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioQuestion.cjs","sources":["../../../../../src/components/feedback/questions/RadioQuestion.tsx"],"sourcesContent":["import React, {\n type ChangeEventHandler,\n useEffect,\n useId,\n useMemo,\n useRef,\n} from \"react\";\nimport { RadioButton } from \"../../radio-button/RadioButton.js\";\nimport { RadioButtonGroup } from \"../../radio-button/RadioButtonGroup.js\";\nimport { useFollowUpContext } from \"../followup/followupContext.js\";\nimport { useMainQuestionContext } from \"../main-question/mainQuestionContext.js\";\nimport type { QuestionProps } from \"../types.js\";\n\nexport const RadioQuestion: React.FC<QuestionProps> = ({\n label,\n name,\n options,\n helpLabel,\n autoFocus = false,\n}) => {\n const followupContext = useFollowUpContext();\n const feedbackContext = useMainQuestionContext();\n const context = followupContext || feedbackContext;\n const id = useId();\n\n const numOptions = options?.length || 0;\n\n const ref = useRef<HTMLInputElement>(null);\n useEffect(() => {\n if (autoFocus && ref.current) {\n ref.current.focus();\n }\n }, [autoFocus]);\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (e) => {\n const option = options?.find(\n (option) => option.value.toString() === e.target.value,\n );\n context?.setCurrentValue(option);\n };\n\n const selectedValue = useMemo(\n () =>\n Array.isArray(context?.currentValue)\n ? context?.currentValue[0].value.toString()\n : context?.currentValue?.value.toString(),\n [context?.currentValue],\n );\n\n if (!context) {\n console.error(\n \"Questions must be used inside a Followup or Feedback context provider\",\n );\n return null;\n }\n\n return (\n <RadioButtonGroup\n legend={label}\n labelProps={{ variant: \"large\" }}\n name={`${id}-${name || label}`}\n inline={numOptions < 3}\n value={selectedValue || \"\"}\n onChange={handleChange}\n helpLabel={helpLabel}\n >\n {options?.map((option, i) => (\n <RadioButton\n ref={i === 0 ? ref : undefined}\n key={`${id}-${name || label}-${option.value}`}\n label={option.label}\n value={String(option.value)}\n />\n ))}\n </RadioButtonGroup>\n );\n};\n"],"names":["label","name","options","helpLabel","autoFocus","followupContext","useFollowUpContext","feedbackContext","useMainQuestionContext","context","id","useId","numOptions","length","ref","useRef","useEffect","current","focus","selectedValue","useMemo","Array","isArray","currentValue","value","toString","jsx","RadioButtonGroup","legend","labelProps","variant","inline","onChange","e","option","find","target","setCurrentValue","children","map","i","RadioButton","String","console","error"],"mappings":"sWAasD,EAClDA,MAAAA,EACAC,KAAAA,EACAC,QAAAA,EACAC,UAAAA,EACAC,UAAAA,GAAY,MAEZ,MAAMC,EAAkBC,EAAAA,qBAClBC,EAAkBC,EAAAA,yBAClBC,EAAUJ,GAAmBE,EAC7BG,EAAKC,EAAAA,QAELC,EAAaV,GAASW,QAAU,EAEhCC,EAAMC,
|
|
1
|
+
{"version":3,"file":"RadioQuestion.cjs","sources":["../../../../../src/components/feedback/questions/RadioQuestion.tsx"],"sourcesContent":["import React, {\n type ChangeEventHandler,\n useEffect,\n useId,\n useMemo,\n useRef,\n} from \"react\";\nimport { RadioButton } from \"../../radio-button/RadioButton.js\";\nimport { RadioButtonGroup } from \"../../radio-button/RadioButtonGroup.js\";\nimport { useFollowUpContext } from \"../followup/followupContext.js\";\nimport { useMainQuestionContext } from \"../main-question/mainQuestionContext.js\";\nimport type { QuestionProps } from \"../types.js\";\n\nexport const RadioQuestion: React.FC<QuestionProps> = ({\n label,\n name,\n options,\n helpLabel,\n autoFocus = false,\n}) => {\n const followupContext = useFollowUpContext();\n const feedbackContext = useMainQuestionContext();\n const context = followupContext || feedbackContext;\n const id = useId();\n\n const numOptions = options?.length || 0;\n\n const ref = useRef<HTMLInputElement>(null);\n useEffect(() => {\n if (autoFocus && ref.current) {\n ref.current.focus();\n }\n }, [autoFocus]);\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (e) => {\n const option = options?.find(\n (option) => option.value.toString() === e.target.value,\n );\n context?.setCurrentValue(option);\n };\n\n const selectedValue = useMemo(\n () =>\n Array.isArray(context?.currentValue)\n ? context?.currentValue[0].value.toString()\n : context?.currentValue?.value.toString(),\n [context?.currentValue],\n );\n\n if (!context) {\n console.error(\n \"Questions must be used inside a Followup or Feedback context provider\",\n );\n return null;\n }\n\n return (\n <RadioButtonGroup\n legend={label}\n labelProps={{ variant: \"large\" }}\n name={`${id}-${name || label}`}\n inline={numOptions < 3}\n value={selectedValue || \"\"}\n onChange={handleChange}\n helpLabel={helpLabel}\n >\n {options?.map((option, i) => (\n <RadioButton\n ref={i === 0 ? ref : undefined}\n key={`${id}-${name || label}-${option.value}`}\n label={option.label}\n value={String(option.value)}\n />\n ))}\n </RadioButtonGroup>\n );\n};\n"],"names":["label","name","options","helpLabel","autoFocus","followupContext","useFollowUpContext","feedbackContext","useMainQuestionContext","context","id","useId","numOptions","length","ref","useRef","useEffect","current","focus","selectedValue","useMemo","Array","isArray","currentValue","value","toString","jsx","RadioButtonGroup","legend","labelProps","variant","inline","onChange","e","option","find","target","setCurrentValue","children","map","i","RadioButton","String","console","error"],"mappings":"sWAasD,EAClDA,MAAAA,EACAC,KAAAA,EACAC,QAAAA,EACAC,UAAAA,EACAC,UAAAA,GAAY,MAEZ,MAAMC,EAAkBC,EAAAA,qBAClBC,EAAkBC,EAAAA,yBAClBC,EAAUJ,GAAmBE,EAC7BG,EAAKC,EAAAA,QAELC,EAAaV,GAASW,QAAU,EAEhCC,EAAMC,EAAAA,OAAyB,MACrCC,EAAAA,UAAU,KACFZ,GAAaU,EAAIG,SACjBH,EAAIG,QAAQC,SAEjB,CAACd,IAEJ,MAOMe,EAAgBC,EAAAA,QAClB,IACIC,MAAMC,QAAQb,GAASc,cACjBd,GAASc,aAAa,GAAGC,MAAMC,WAC/BhB,GAASc,cAAcC,MAAMC,WACvC,CAAChB,GAASc,eAGd,OAAKd,EAQDiB,EAAAA,IAACC,EAAAA,iBAAA,CACGC,OAAQ5B,EACR6B,WAAY,CAAEC,QAAS,SACvB7B,KAAM,GAAGS,KAAMT,GAAQD,IACvB+B,OAAQnB,EAAa,EACrBY,MAAOL,GAAiB,GACxBa,SA7BoDC,IACxD,MAAMC,EAAShC,GAASiC,KACnBD,GAAWA,EAAOV,MAAMC,aAAeQ,EAAEG,OAAOZ,OAErDf,GAAS4B,gBAAgBH,IA0BrB/B,UAAAA,EAECmC,SAAApC,GAASqC,IAAI,CAACL,EAAQM,IACnBd,EAAAA,IAACe,EAAAA,YAAA,CACG3B,IAAW,IAAN0B,EAAU1B,OAAM,EAErBd,MAAOkC,EAAOlC,MACdwB,MAAOkB,OAAOR,EAAOV,QAFhB,GAAGd,KAAMT,GAAQD,KAASkC,EAAOV,aAnBlDmB,QAAQC,MACJ,yEAEG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),r=require("../../input-group/FieldGroup.cjs"),s=require("../followup/followupContext.cjs"),a=require("../main-question/mainQuestionContext.cjs"),u=require("./smileyUtils.cjs"),n=e=>"number"!=typeof e.value||![1,2,3,4,5].includes(e.value);exports.SmileyQuestion=({label:t,name:o="smiley",helpLabel:i,options:c=u.defaultOptions})=>{const m=s.useFollowUpContext(),d=a.useMainQuestionContext(),p=m||d,v=l.useId(),j=e=>{const l=c?.find(
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),r=require("../../input-group/FieldGroup.cjs"),s=require("../followup/followupContext.cjs"),a=require("../main-question/mainQuestionContext.cjs"),u=require("./smileyUtils.cjs"),n=e=>"number"!=typeof e.value||![1,2,3,4,5].includes(e.value);exports.SmileyQuestion=({label:t,name:o="smiley",helpLabel:i,options:c=u.defaultOptions})=>{const m=s.useFollowUpContext(),d=a.useMainQuestionContext(),p=m||d,v=l.useId(),j=e=>{const l=c?.find(l=>l.value.toString()===e.target.value);p?.setCurrentValue(l)},y=l.useMemo(()=>Array.isArray(p?.currentValue)?p?.currentValue[0].value:p?.currentValue?.value,[p?.currentValue]);return c.some(n)?(console.error("SmileyQuestion må ha tallene 1 til 5 som verdier for alternativene sine"),null):p&&c?e.jsx(r.FieldGroup,{labelProps:{variant:"large"},legend:t,helpLabel:i,children:e.jsx("div",{className:"jkl-feedback-smileys",children:c.map(r=>e.jsxs(l.Fragment,{children:[e.jsx("input",{className:"jkl-sr-only",id:`${v}-${o}-${r.value}`,name:`${v}-${o}`,type:"radio",value:r.value,onChange:j,checked:y===r.value}),e.jsxs("label",{className:"jkl-feedback-smiley-option",htmlFor:`${v}-${o}-${r.value}`,children:[e.jsx("span",{className:"jkl-sr-only",children:r.label}),u.getSmiley(Number(r.value))]})]},r.value))})}):(console.error("Questions must be used inside a Followup or Feedback context provider"),null)};
|
|
2
2
|
//# sourceMappingURL=SmileyQuestion.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmileyQuestion.cjs","sources":["../../../../../src/components/feedback/questions/SmileyQuestion.tsx"],"sourcesContent":["import React, {\n type ChangeEventHandler,\n Fragment,\n useId,\n useMemo,\n} from \"react\";\nimport { FieldGroup } from \"../../input-group/FieldGroup.js\";\nimport { useFollowUpContext } from \"../followup/followupContext.js\";\nimport { useMainQuestionContext } from \"../main-question/mainQuestionContext.js\";\nimport type { FeedbackOption, QuestionProps } from \"../types.js\";\nimport { defaultOptions, getSmiley } from \"./smileyUtils.js\";\n\nconst isNotInScale = (option: FeedbackOption) =>\n typeof option.value !== \"number\" || ![1, 2, 3, 4, 5].includes(option.value);\n\nexport const SmileyQuestion: React.FC<QuestionProps> = ({\n label,\n name = \"smiley\",\n helpLabel,\n options = defaultOptions,\n}) => {\n const followupContext = useFollowUpContext();\n const feedbackContext = useMainQuestionContext();\n const context = followupContext || feedbackContext;\n const id = useId();\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (e) => {\n const option = options?.find(\n (option) => option.value.toString() === e.target.value,\n );\n context?.setCurrentValue(option);\n };\n\n const selectedValue = useMemo(\n () =>\n Array.isArray(context?.currentValue)\n ? context?.currentValue[0].value\n : context?.currentValue?.value,\n [context?.currentValue],\n );\n\n if (options.some(isNotInScale)) {\n console.error(\n \"SmileyQuestion må ha tallene 1 til 5 som verdier for alternativene sine\",\n );\n return null;\n }\n\n if (!context || !options) {\n console.error(\n \"Questions must be used inside a Followup or Feedback context provider\",\n );\n return null;\n }\n\n return (\n <FieldGroup\n labelProps={{ variant: \"large\" }}\n legend={label}\n helpLabel={helpLabel}\n >\n <div className=\"jkl-feedback-smileys\">\n {options.map((option) => (\n <Fragment key={option.value}>\n <input\n className=\"jkl-sr-only\"\n id={`${id}-${name}-${option.value}`}\n name={`${id}-${name}`}\n type=\"radio\"\n value={option.value}\n onChange={handleChange}\n checked={selectedValue === option.value}\n />\n <label\n className=\"jkl-feedback-smiley-option\"\n htmlFor={`${id}-${name}-${option.value}`}\n >\n <span className=\"jkl-sr-only\">{option.label}</span>\n {getSmiley(Number(option.value))}\n </label>\n </Fragment>\n ))}\n </div>\n </FieldGroup>\n );\n};\n"],"names":["isNotInScale","option","value","includes","label","name","helpLabel","options","defaultOptions","followupContext","useFollowUpContext","feedbackContext","useMainQuestionContext","context","id","useId","handleChange","e","find","toString","target","setCurrentValue","selectedValue","useMemo","Array","isArray","currentValue","some","console","error","jsx","FieldGroup","labelProps","variant","legend","children","className","map","jsxs","Fragment","type","onChange","checked","htmlFor","getSmiley","Number"],"mappings":"wTAYMA,EAAgBC,GACM,iBAAjBA,EAAOC,QAAuB,CAAC,EAAG,EAAG,EAAG,EAAG,GAAGC,SAASF,EAAOC,8BAElB,EACnDE,MAAAA,EACAC,KAAAA,EAAO,SACPC,UAAAA,EACAC,QAAAA,EAAUC,EAAAA,mBAEV,MAAMC,EAAkBC,EAAAA,qBAClBC,EAAkBC,EAAAA,yBAClBC,EAAUJ,GAAmBE,EAC7BG,EAAKC,EAAAA,QAELC,EAAsDC,IACxD,MAAMhB,EAASM,GAASW,
|
|
1
|
+
{"version":3,"file":"SmileyQuestion.cjs","sources":["../../../../../src/components/feedback/questions/SmileyQuestion.tsx"],"sourcesContent":["import React, {\n type ChangeEventHandler,\n Fragment,\n useId,\n useMemo,\n} from \"react\";\nimport { FieldGroup } from \"../../input-group/FieldGroup.js\";\nimport { useFollowUpContext } from \"../followup/followupContext.js\";\nimport { useMainQuestionContext } from \"../main-question/mainQuestionContext.js\";\nimport type { FeedbackOption, QuestionProps } from \"../types.js\";\nimport { defaultOptions, getSmiley } from \"./smileyUtils.js\";\n\nconst isNotInScale = (option: FeedbackOption) =>\n typeof option.value !== \"number\" || ![1, 2, 3, 4, 5].includes(option.value);\n\nexport const SmileyQuestion: React.FC<QuestionProps> = ({\n label,\n name = \"smiley\",\n helpLabel,\n options = defaultOptions,\n}) => {\n const followupContext = useFollowUpContext();\n const feedbackContext = useMainQuestionContext();\n const context = followupContext || feedbackContext;\n const id = useId();\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (e) => {\n const option = options?.find(\n (option) => option.value.toString() === e.target.value,\n );\n context?.setCurrentValue(option);\n };\n\n const selectedValue = useMemo(\n () =>\n Array.isArray(context?.currentValue)\n ? context?.currentValue[0].value\n : context?.currentValue?.value,\n [context?.currentValue],\n );\n\n if (options.some(isNotInScale)) {\n console.error(\n \"SmileyQuestion må ha tallene 1 til 5 som verdier for alternativene sine\",\n );\n return null;\n }\n\n if (!context || !options) {\n console.error(\n \"Questions must be used inside a Followup or Feedback context provider\",\n );\n return null;\n }\n\n return (\n <FieldGroup\n labelProps={{ variant: \"large\" }}\n legend={label}\n helpLabel={helpLabel}\n >\n <div className=\"jkl-feedback-smileys\">\n {options.map((option) => (\n <Fragment key={option.value}>\n <input\n className=\"jkl-sr-only\"\n id={`${id}-${name}-${option.value}`}\n name={`${id}-${name}`}\n type=\"radio\"\n value={option.value}\n onChange={handleChange}\n checked={selectedValue === option.value}\n />\n <label\n className=\"jkl-feedback-smiley-option\"\n htmlFor={`${id}-${name}-${option.value}`}\n >\n <span className=\"jkl-sr-only\">{option.label}</span>\n {getSmiley(Number(option.value))}\n </label>\n </Fragment>\n ))}\n </div>\n </FieldGroup>\n );\n};\n"],"names":["isNotInScale","option","value","includes","label","name","helpLabel","options","defaultOptions","followupContext","useFollowUpContext","feedbackContext","useMainQuestionContext","context","id","useId","handleChange","e","find","toString","target","setCurrentValue","selectedValue","useMemo","Array","isArray","currentValue","some","console","error","jsx","FieldGroup","labelProps","variant","legend","children","className","map","jsxs","Fragment","type","onChange","checked","htmlFor","getSmiley","Number"],"mappings":"wTAYMA,EAAgBC,GACM,iBAAjBA,EAAOC,QAAuB,CAAC,EAAG,EAAG,EAAG,EAAG,GAAGC,SAASF,EAAOC,8BAElB,EACnDE,MAAAA,EACAC,KAAAA,EAAO,SACPC,UAAAA,EACAC,QAAAA,EAAUC,EAAAA,mBAEV,MAAMC,EAAkBC,EAAAA,qBAClBC,EAAkBC,EAAAA,yBAClBC,EAAUJ,GAAmBE,EAC7BG,EAAKC,EAAAA,QAELC,EAAsDC,IACxD,MAAMhB,EAASM,GAASW,KACnBjB,GAAWA,EAAOC,MAAMiB,aAAeF,EAAEG,OAAOlB,OAErDW,GAASQ,gBAAgBpB,IAGvBqB,EAAgBC,EAAAA,QAClB,IACIC,MAAMC,QAAQZ,GAASa,cACjBb,GAASa,aAAa,GAAGxB,MACzBW,GAASa,cAAcxB,MACjC,CAACW,GAASa,eAGd,OAAInB,EAAQoB,KAAK3B,IACb4B,QAAQC,MACJ,2EAEG,MAGNhB,GAAYN,EAQbuB,EAAAA,IAACC,EAAAA,WAAA,CACGC,WAAY,CAAEC,QAAS,SACvBC,OAAQ9B,EACRE,UAAAA,EAEA6B,SAAAL,EAAAA,IAAC,OAAIM,UAAU,uBACVD,WAAQE,IAAKpC,GACVqC,EAAAA,KAACC,EAAAA,SAAA,CACGJ,SAAA,CAAAL,EAAAA,IAAC,QAAA,CACGM,UAAU,cACVtB,GAAI,GAAGA,KAAMT,KAAQJ,EAAOC,QAC5BG,KAAM,GAAGS,KAAMT,IACfmC,KAAK,QACLtC,MAAOD,EAAOC,MACduC,SAAUzB,EACV0B,QAASpB,IAAkBrB,EAAOC,QAEtCoC,EAAAA,KAAC,QAAA,CACGF,UAAU,6BACVO,QAAS,GAAG7B,KAAMT,KAAQJ,EAAOC,QAEjCiC,SAAA,CAAAL,EAAAA,IAAC,OAAA,CAAKM,UAAU,cAAeD,SAAAlC,EAAOG,QACrCwC,YAAUC,OAAO5C,EAAOC,aAflBD,EAAOC,aAdlC0B,QAAQC,MACJ,yEAEG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),t=require("../../text-area/TextArea.cjs"),n=require("../feedbackContext.cjs"),u=require("../followup/followupContext.cjs"),o=require("../main-question/mainQuestionContext.cjs");exports.TextQuestion=({label:a,name:l,helpLabel:s="Ikke skriv personlige opplysninger. Tilbakemeldinger som kommer inn her blir ikke besvart, men brukt i videre arbeid med å forbedre tjenestene våre.",autoFocus:i=!1})=>{const{counter:c}=n.useFeedbackContext(),b=u.useFollowUpContext(),p=o.useMainQuestionContext(),x=b||p,m=r.useRef(null);r.useEffect((
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),t=require("../../text-area/TextArea.cjs"),n=require("../feedbackContext.cjs"),u=require("../followup/followupContext.cjs"),o=require("../main-question/mainQuestionContext.cjs");exports.TextQuestion=({label:a,name:l,helpLabel:s="Ikke skriv personlige opplysninger. Tilbakemeldinger som kommer inn her blir ikke besvart, men brukt i videre arbeid med å forbedre tjenestene våre.",autoFocus:i=!1})=>{const{counter:c}=n.useFeedbackContext(),b=u.useFollowUpContext(),p=o.useMainQuestionContext(),x=b||p,m=r.useRef(null);r.useEffect(()=>{i&&m.current&&m.current.focus()},[i]);const d=r.useMemo(()=>Array.isArray(x?.currentValue)?x?.currentValue[0].value.toString():x?.currentValue?.value.toString(),[x?.currentValue]);return x?e.jsx(t.TextArea,{ref:m,label:a,labelProps:{variant:"large"},name:l||a,startOpen:!0,rows:5,value:d,onChange:e=>{const r={label:a,name:l||a,type:"text",value:e.target.value};x?.setCurrentValue(r)},helpLabel:s,counter:c}):(console.error("Questions must be used inside a Followup or Feedback context provider"),null)};
|
|
2
2
|
//# sourceMappingURL=TextQuestion.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextQuestion.cjs","sources":["../../../../../src/components/feedback/questions/TextQuestion.tsx"],"sourcesContent":["import React, {\n type ChangeEventHandler,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport { TextArea } from \"../../text-area/TextArea.js\";\nimport { useFeedbackContext } from \"../feedbackContext.js\";\nimport { useFollowUpContext } from \"../followup/followupContext.js\";\nimport { useMainQuestionContext } from \"../main-question/mainQuestionContext.js\";\nimport type { FeedbackAnswer, QuestionProps } from \"../types.js\";\n\nexport const TextQuestion: React.FC<QuestionProps> = ({\n label,\n name,\n helpLabel = \"Ikke skriv personlige opplysninger. Tilbakemeldinger som kommer inn her blir ikke besvart, men brukt i videre arbeid med å forbedre tjenestene våre.\",\n autoFocus = false,\n}) => {\n const { counter } = useFeedbackContext();\n const followupContext = useFollowUpContext();\n const feedbackContext = useMainQuestionContext();\n const context = followupContext || feedbackContext;\n const ref = useRef<HTMLTextAreaElement>(null);\n\n useEffect(() => {\n if (autoFocus && ref.current) {\n ref.current.focus();\n }\n }, [autoFocus]);\n\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = (e) => {\n const value: FeedbackAnswer = {\n label,\n name: name || label,\n type: \"text\",\n value: e.target.value,\n };\n context?.setCurrentValue(value);\n };\n\n const currentValue = useMemo(\n () =>\n Array.isArray(context?.currentValue)\n ? context?.currentValue[0].value.toString()\n : context?.currentValue?.value.toString(),\n [context?.currentValue],\n );\n\n if (!context) {\n console.error(\n \"Questions must be used inside a Followup or Feedback context provider\",\n );\n return null;\n }\n\n return (\n <TextArea\n ref={ref}\n label={label}\n labelProps={{ variant: \"large\" }}\n name={name || label}\n startOpen\n rows={5}\n value={currentValue}\n onChange={handleChange}\n helpLabel={helpLabel}\n counter={counter}\n />\n );\n};\n"],"names":["label","name","helpLabel","autoFocus","counter","useFeedbackContext","followupContext","useFollowUpContext","feedbackContext","useMainQuestionContext","context","ref","useRef","useEffect","current","focus","currentValue","useMemo","Array","isArray","value","toString","jsx","TextArea","labelProps","variant","startOpen","rows","onChange","e","type","target","setCurrentValue","console","error"],"mappings":"8UAYqD,EACjDA,MAAAA,EACAC,KAAAA,EACAC,UAAAA,EAAY,uJACZC,UAAAA,GAAY,
|
|
1
|
+
{"version":3,"file":"TextQuestion.cjs","sources":["../../../../../src/components/feedback/questions/TextQuestion.tsx"],"sourcesContent":["import React, {\n type ChangeEventHandler,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport { TextArea } from \"../../text-area/TextArea.js\";\nimport { useFeedbackContext } from \"../feedbackContext.js\";\nimport { useFollowUpContext } from \"../followup/followupContext.js\";\nimport { useMainQuestionContext } from \"../main-question/mainQuestionContext.js\";\nimport type { FeedbackAnswer, QuestionProps } from \"../types.js\";\n\nexport const TextQuestion: React.FC<QuestionProps> = ({\n label,\n name,\n helpLabel = \"Ikke skriv personlige opplysninger. Tilbakemeldinger som kommer inn her blir ikke besvart, men brukt i videre arbeid med å forbedre tjenestene våre.\",\n autoFocus = false,\n}) => {\n const { counter } = useFeedbackContext();\n const followupContext = useFollowUpContext();\n const feedbackContext = useMainQuestionContext();\n const context = followupContext || feedbackContext;\n const ref = useRef<HTMLTextAreaElement>(null);\n\n useEffect(() => {\n if (autoFocus && ref.current) {\n ref.current.focus();\n }\n }, [autoFocus]);\n\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = (e) => {\n const value: FeedbackAnswer = {\n label,\n name: name || label,\n type: \"text\",\n value: e.target.value,\n };\n context?.setCurrentValue(value);\n };\n\n const currentValue = useMemo(\n () =>\n Array.isArray(context?.currentValue)\n ? context?.currentValue[0].value.toString()\n : context?.currentValue?.value.toString(),\n [context?.currentValue],\n );\n\n if (!context) {\n console.error(\n \"Questions must be used inside a Followup or Feedback context provider\",\n );\n return null;\n }\n\n return (\n <TextArea\n ref={ref}\n label={label}\n labelProps={{ variant: \"large\" }}\n name={name || label}\n startOpen\n rows={5}\n value={currentValue}\n onChange={handleChange}\n helpLabel={helpLabel}\n counter={counter}\n />\n );\n};\n"],"names":["label","name","helpLabel","autoFocus","counter","useFeedbackContext","followupContext","useFollowUpContext","feedbackContext","useMainQuestionContext","context","ref","useRef","useEffect","current","focus","currentValue","useMemo","Array","isArray","value","toString","jsx","TextArea","labelProps","variant","startOpen","rows","onChange","e","type","target","setCurrentValue","console","error"],"mappings":"8UAYqD,EACjDA,MAAAA,EACAC,KAAAA,EACAC,UAAAA,EAAY,uJACZC,UAAAA,GAAY,MAEZ,MAAQC,QAAAA,GAAYC,uBACdC,EAAkBC,EAAAA,qBAClBC,EAAkBC,EAAAA,yBAClBC,EAAUJ,GAAmBE,EAC7BG,EAAMC,EAAAA,OAA4B,MAExCC,EAAAA,UAAU,KACFV,GAAaQ,EAAIG,SACjBH,EAAIG,QAAQC,SAEjB,CAACZ,IAEJ,MAUMa,EAAeC,EAAAA,QACjB,IACIC,MAAMC,QAAQT,GAASM,cACjBN,GAASM,aAAa,GAAGI,MAAMC,WAC/BX,GAASM,cAAcI,MAAMC,WACvC,CAACX,GAASM,eAGd,OAAKN,EAQDY,EAAAA,IAACC,EAAAA,SAAA,CACGZ,IAAAA,EACAX,MAAAA,EACAwB,WAAY,CAAEC,QAAS,SACvBxB,KAAMA,GAAQD,EACd0B,WAAS,EACTC,KAAM,EACNP,MAAOJ,EACPY,SAlCuDC,IAC3D,MAAMT,EAAwB,CAC1BpB,MAAAA,EACAC,KAAMA,GAAQD,EACd8B,KAAM,OACNV,MAAOS,EAAEE,OAAOX,OAEpBV,GAASsB,gBAAgBZ,IA4BrBlB,UAAAA,EACAE,QAAAA,KAjBJ6B,QAAQC,MACJ,yEAEG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smileyUtils.cjs","sources":["../../../../../src/components/feedback/questions/smileyUtils.tsx"],"sourcesContent":["import React, { type FC } from \"react\";\nimport type { WithChildren } from \"../../../core/types.js\";\nimport type { FeedbackOption } from \"../types.js\";\n\nexport const defaultOptions: FeedbackOption<number>[] = [\n {\n label: \"Veldig misfornøyd\",\n value: 1,\n textAreaLabel:\n \"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n {\n label: \"Litt misfornøyd\",\n value: 2,\n textAreaLabel:\n \"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n {\n label: \"Midt på treet\",\n value: 3,\n textAreaLabel:\n \"Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n {\n label: \"Ganske fornøyd\",\n value: 4,\n textAreaLabel:\n \"Så bra! Har du noen tilbakemeldinger kan du skrive dem her.\",\n },\n {\n label: \"Veldig fornøyd\",\n value: 5,\n textAreaLabel:\n \"Så bra! Har du noen tilbakemeldinger kan du skrive dem her.\",\n },\n];\n\nconst Smiley: FC<WithChildren> = ({ children }) => (\n <svg\n className=\"jkl-feedback-smiley-option__icon\"\n aria-hidden\n viewBox=\"0 0 40 40\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"20\" cy=\"20\" r=\"19\" stroke=\"currentColor\" strokeWidth=\"2\" />\n {children}\n </svg>\n);\n\nconst VeldigSurSmiley = () => (\n <Smiley>\n <path\n d=\"M10 30C10 24.4772 14.4772 20 20 20C25.5228 20 30 24.4772 30 30\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <path d=\"M10 13.9865H16.6667\" stroke=\"currentColor\" strokeWidth=\"2\" />\n <path\n d=\"M23.3333 13.9865H29.9999\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n </Smiley>\n);\n\nconst LittSurSmiley = () => (\n <Smiley>\n <path\n d=\"M10 28.75C10 28.75 13.75 23.3334 20 23.3334C26.25 23.3334 30 28.75 30 28.75\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n <circle cx=\"27.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nconst NoytralSmiley = () => (\n <Smiley>\n <path\n d=\"M9.15283 25.6986H30.8477\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n <circle cx=\"27.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nconst LittGladSmiley = () => (\n <Smiley>\n <path\n d=\"M10 23.3334C10 23.3334 12.9167 30 20 30C27.0833 30 30 23.3334 30 23.3334\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n <circle cx=\"27.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nconst VeldigGladSmiley = () => (\n <Smiley>\n <path\n d=\"M30 21C30 26.5228 25.5228 31 20 31C14.4772 31 10 26.5228 10 21\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <path d=\"M24 14.5H29\" stroke=\"currentColor\" strokeWidth=\"2\" />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nexport const getSmiley = (value: number) => {\n switch (value) {\n case 1:\n return <VeldigSurSmiley />;\n case 2:\n return <LittSurSmiley />;\n case 3:\n return <NoytralSmiley />;\n case 4:\n return <LittGladSmiley />;\n case 5:\n return <VeldigGladSmiley />;\n\n default:\n return <NoytralSmiley />;\n }\n};\n"],"names":["Smiley","children","jsxs","className","viewBox","fill","xmlns","jsx","cx","cy","r","stroke","strokeWidth","VeldigSurSmiley","d","LittSurSmiley","NoytralSmiley","LittGladSmiley","VeldigGladSmiley","label","value","textAreaLabel"],"mappings":"sIAIO,MAiCDA,EAA2B,EAAGC,SAAAA,KAChCC,EAAAA,KAAC,MAAA,CACGC,UAAU,mCACV,eAAW,EACXC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENL,SAAA,
|
|
1
|
+
{"version":3,"file":"smileyUtils.cjs","sources":["../../../../../src/components/feedback/questions/smileyUtils.tsx"],"sourcesContent":["import React, { type FC } from \"react\";\nimport type { WithChildren } from \"../../../core/types.js\";\nimport type { FeedbackOption } from \"../types.js\";\n\nexport const defaultOptions: FeedbackOption<number>[] = [\n {\n label: \"Veldig misfornøyd\",\n value: 1,\n textAreaLabel:\n \"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n {\n label: \"Litt misfornøyd\",\n value: 2,\n textAreaLabel:\n \"Det var leit! Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n {\n label: \"Midt på treet\",\n value: 3,\n textAreaLabel:\n \"Fortell oss gjerne hva du savner, så kan vi gjøre sidene våre bedre.\",\n },\n {\n label: \"Ganske fornøyd\",\n value: 4,\n textAreaLabel:\n \"Så bra! Har du noen tilbakemeldinger kan du skrive dem her.\",\n },\n {\n label: \"Veldig fornøyd\",\n value: 5,\n textAreaLabel:\n \"Så bra! Har du noen tilbakemeldinger kan du skrive dem her.\",\n },\n];\n\nconst Smiley: FC<WithChildren> = ({ children }) => (\n <svg\n className=\"jkl-feedback-smiley-option__icon\"\n aria-hidden\n viewBox=\"0 0 40 40\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"20\" cy=\"20\" r=\"19\" stroke=\"currentColor\" strokeWidth=\"2\" />\n {children}\n </svg>\n);\n\nconst VeldigSurSmiley = () => (\n <Smiley>\n <path\n d=\"M10 30C10 24.4772 14.4772 20 20 20C25.5228 20 30 24.4772 30 30\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <path d=\"M10 13.9865H16.6667\" stroke=\"currentColor\" strokeWidth=\"2\" />\n <path\n d=\"M23.3333 13.9865H29.9999\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n </Smiley>\n);\n\nconst LittSurSmiley = () => (\n <Smiley>\n <path\n d=\"M10 28.75C10 28.75 13.75 23.3334 20 23.3334C26.25 23.3334 30 28.75 30 28.75\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n <circle cx=\"27.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nconst NoytralSmiley = () => (\n <Smiley>\n <path\n d=\"M9.15283 25.6986H30.8477\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n <circle cx=\"27.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nconst LittGladSmiley = () => (\n <Smiley>\n <path\n d=\"M10 23.3334C10 23.3334 12.9167 30 20 30C27.0833 30 30 23.3334 30 23.3334\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n <circle cx=\"27.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nconst VeldigGladSmiley = () => (\n <Smiley>\n <path\n d=\"M30 21C30 26.5228 25.5228 31 20 31C14.4772 31 10 26.5228 10 21\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n />\n <path d=\"M24 14.5H29\" stroke=\"currentColor\" strokeWidth=\"2\" />\n <circle cx=\"12.5\" cy=\"14.5\" r=\"1.5\" fill=\"currentColor\" />\n </Smiley>\n);\n\nexport const getSmiley = (value: number) => {\n switch (value) {\n case 1:\n return <VeldigSurSmiley />;\n case 2:\n return <LittSurSmiley />;\n case 3:\n return <NoytralSmiley />;\n case 4:\n return <LittGladSmiley />;\n case 5:\n return <VeldigGladSmiley />;\n\n default:\n return <NoytralSmiley />;\n }\n};\n"],"names":["Smiley","children","jsxs","className","viewBox","fill","xmlns","jsx","cx","cy","r","stroke","strokeWidth","VeldigSurSmiley","d","LittSurSmiley","NoytralSmiley","LittGladSmiley","VeldigGladSmiley","label","value","textAreaLabel"],"mappings":"sIAIO,MAiCDA,EAA2B,EAAGC,SAAAA,KAChCC,EAAAA,KAAC,MAAA,CACGC,UAAU,mCACV,eAAW,EACXC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAENL,SAAA,CAAAM,EAAAA,IAAC,SAAA,CAAOC,GAAG,KAAKC,GAAG,KAAKC,EAAE,KAAKC,OAAO,eAAeC,YAAY,MAChEX,KAIHY,EAAkB,IACpBX,EAAAA,KAACF,EAAA,CACGC,SAAA,CAAAM,EAAAA,IAAC,OAAA,CACGO,EAAE,iEACFH,OAAO,eACPC,YAAY,YAEf,OAAA,CAAKE,EAAE,sBAAsBH,OAAO,eAAeC,YAAY,MAChEL,EAAAA,IAAC,OAAA,CACGO,EAAE,2BACFH,OAAO,eACPC,YAAY,SAKlBG,EAAgB,IAClBb,EAAAA,KAACF,EAAA,CACGC,SAAA,CAAAM,EAAAA,IAAC,OAAA,CACGO,EAAE,8EACFH,OAAO,eACPC,YAAY,MAEhBL,EAAAA,IAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,iBACzCE,EAAAA,IAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,oBAI3CW,EAAgB,IAClBd,EAAAA,KAACF,EAAA,CACGC,SAAA,CAAAM,EAAAA,IAAC,OAAA,CACGO,EAAE,2BACFH,OAAO,eACPC,YAAY,MAEhBL,EAAAA,IAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,iBACzCE,EAAAA,IAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,oBAI3CY,EAAiB,IACnBf,EAAAA,KAACF,EAAA,CACGC,SAAA,CAAAM,EAAAA,IAAC,OAAA,CACGO,EAAE,2EACFH,OAAO,eACPC,YAAY,MAEhBL,EAAAA,IAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,iBACzCE,EAAAA,IAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,oBAI3Ca,EAAmB,IACrBhB,EAAAA,KAACF,EAAA,CACGC,SAAA,CAAAM,EAAAA,IAAC,OAAA,CACGO,EAAE,iEACFH,OAAO,eACPC,YAAY,YAEf,OAAA,CAAKE,EAAE,cAAcH,OAAO,eAAeC,YAAY,MACxDL,EAAAA,IAAC,UAAOC,GAAG,OAAOC,GAAG,OAAOC,EAAE,MAAML,KAAK,2CA1GO,CACpD,CACIc,MAAO,oBACPC,MAAO,EACPC,cACI,sFAER,CACIF,MAAO,kBACPC,MAAO,EACPC,cACI,sFAER,CACIF,MAAO,gBACPC,MAAO,EACPC,cACI,wEAER,CACIF,MAAO,iBACPC,MAAO,EACPC,cACI,+DAER,CACIF,MAAO,iBACPC,MAAO,EACPC,cACI,kFAiFcD,IACtB,OAAQA,GACJ,OACI,aAAQP,EAAA,IACZ,KAAK,EACD,aAAQE,EAAA,IACZ,KAAK,EAOL,QACI,aAAQC,EAAA,IANZ,KAAK,EACD,aAAQC,EAAA,IACZ,OACI,aAAQC,EAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("./questions/CheckboxQuestion.cjs"),r=require("./questions/RadioQuestion.cjs"),i=require("./questions/TextQuestion.cjs"),s=require("./questions/SmileyQuestion.cjs");require("react/jsx-runtime"),require("../text-area/TextArea.cjs"),require("./feedbackContext.cjs"),require("./main-question/mainQuestionContext.cjs"),require("../button/Button.cjs"),require("../text-input/TextInput.cjs"),require("../message/Message.cjs");exports.getChildrenOfType=function(...t){return r=>e.Children.map(r,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("./questions/CheckboxQuestion.cjs"),r=require("./questions/RadioQuestion.cjs"),i=require("./questions/TextQuestion.cjs"),s=require("./questions/SmileyQuestion.cjs");require("react/jsx-runtime"),require("../text-area/TextArea.cjs"),require("./feedbackContext.cjs"),require("./main-question/mainQuestionContext.cjs"),require("../button/Button.cjs"),require("../text-input/TextInput.cjs"),require("../message/Message.cjs");exports.getChildrenOfType=function(...t){return r=>e.Children.map(r,r=>{if(e.isValidElement(r)&&t.includes(r.type))return r})},exports.getQuestionFromType=e=>{switch(e){case"radio":default:return r.RadioQuestion;case"checkbox":return t.CheckboxQuestion;case"text":return i.TextQuestion;case"smiley":return s.SmileyQuestion}};
|
|
2
2
|
//# sourceMappingURL=utils.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","sources":["../../../../src/components/feedback/utils.ts"],"sourcesContent":["import React, { type JSXElementConstructor, type FC } from \"react\";\nimport {\n CheckboxQuestion,\n RadioQuestion,\n SmileyQuestion,\n TextQuestion,\n} from \"./questions/index.js\";\nimport type { QuestionProps, QuestionType } from \"./types.js\";\n\nexport function getChildrenOfType<P>(\n ...allowedTypes: Array<string | JSXElementConstructor<P>>\n) {\n return (\n children: React.ReactNode,\n ):\n | React.ReactElement<P, string | React.JSXElementConstructor<unknown>>[]\n | null\n | undefined =>\n React.Children.map(children, (child) => {\n if (\n React.isValidElement<P>(child) &&\n allowedTypes.includes(child.type)\n ) {\n return child;\n }\n return undefined;\n });\n}\n\nexport const getQuestionFromType = (type: QuestionType): FC<QuestionProps> => {\n switch (type) {\n case \"radio\":\n return RadioQuestion;\n case \"checkbox\":\n return CheckboxQuestion;\n case \"text\":\n return TextQuestion;\n case \"smiley\":\n return SmileyQuestion;\n\n default:\n return RadioQuestion;\n }\n};\n"],"names":["allowedTypes","children","React","Children","map","child","isValidElement","includes","type","RadioQuestion","CheckboxQuestion","TextQuestion","SmileyQuestion"],"mappings":"ijBASO,YACAA,GAEH,OACIC,GAKAC,EAAMC,SAASC,IAAIH,
|
|
1
|
+
{"version":3,"file":"utils.cjs","sources":["../../../../src/components/feedback/utils.ts"],"sourcesContent":["import React, { type JSXElementConstructor, type FC } from \"react\";\nimport {\n CheckboxQuestion,\n RadioQuestion,\n SmileyQuestion,\n TextQuestion,\n} from \"./questions/index.js\";\nimport type { QuestionProps, QuestionType } from \"./types.js\";\n\nexport function getChildrenOfType<P>(\n ...allowedTypes: Array<string | JSXElementConstructor<P>>\n) {\n return (\n children: React.ReactNode,\n ):\n | React.ReactElement<P, string | React.JSXElementConstructor<unknown>>[]\n | null\n | undefined =>\n React.Children.map(children, (child) => {\n if (\n React.isValidElement<P>(child) &&\n allowedTypes.includes(child.type)\n ) {\n return child;\n }\n return undefined;\n });\n}\n\nexport const getQuestionFromType = (type: QuestionType): FC<QuestionProps> => {\n switch (type) {\n case \"radio\":\n return RadioQuestion;\n case \"checkbox\":\n return CheckboxQuestion;\n case \"text\":\n return TextQuestion;\n case \"smiley\":\n return SmileyQuestion;\n\n default:\n return RadioQuestion;\n }\n};\n"],"names":["allowedTypes","children","React","Children","map","child","isValidElement","includes","type","RadioQuestion","CheckboxQuestion","TextQuestion","SmileyQuestion"],"mappings":"ijBASO,YACAA,GAEH,OACIC,GAKAC,EAAMC,SAASC,IAAIH,EAAWI,IAC1B,GACIH,EAAMI,eAAkBD,IACxBL,EAAaO,SAASF,EAAMG,MAE5B,OAAOH,GAIvB,8BAEoCG,IAChC,OAAQA,GACJ,IAAK,QASL,QACI,OAAOC,EAAAA,cARX,IAAK,WACD,OAAOC,EAAAA,iBACX,IAAK,OACD,OAAOC,EAAAA,aACX,IAAK,SACD,OAAOC,EAAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"File.cjs","sources":["../../../../src/components/file/File.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { type ComponentProps, type FC, useId } from \"react\";\nimport { formatBytes } from \"../../utilities/index.js\";\nimport { Button } from \"../button/index.js\";\nimport { useFileInputContext } from \"../file-input/internal/fileInputContext.js\";\nimport { TrashCanIcon } from \"../icon/index.js\";\nimport { SupportLabel } from \"../input-group/index.js\";\nimport { Link } from \"../link/index.js\";\nimport type { FileProps } from \"./types.js\";\n\nexport const File: FC<FileProps & ComponentProps<\"div\">> = (props) => {\n const {\n children,\n className,\n fileName,\n fileType,\n fileSize,\n path,\n file,\n state,\n errorLabel = \"Feil\",\n onRemove,\n variant = \"list\",\n ...rest\n } = props;\n\n const id = `jkl-file-preview-${useId()}`;\n const supportId = `${id}-support`;\n\n const context = useFileInputContext();\n\n const imageSrc =\n fileType.startsWith(\"image/\") &&\n (file ? URL.createObjectURL(file) : path);\n\n const fileComponent = (\n <div\n id={id}\n className={clsx(className, \"jkl-file\", `jkl-file--${variant}`)}\n data-state={state}\n {...rest}\n >\n <div className={\"jkl-file__content\"}>\n <div\n className=\"jkl-file__content__thumbnail\"\n data-filetype={fileType}\n >\n <img src={imageSrc || undefined} alt=\"\" />\n </div>\n {path ? (\n <p className=\"jkl-file__content__name\">\n <Link href={path}>\n {fileName}{\" \"}\n <span className=\"jkl-file__content__name__size\">\n ({formatBytes(fileSize)})\n </span>\n </Link>\n </p>\n ) : (\n <p className=\"jkl-file__content__name\">\n {fileName}{\" \"}\n <span className=\"jkl-file__content__name__size\">\n ({formatBytes(fileSize)})\n </span>\n </p>\n )}\n {onRemove && (\n <Button\n variant={\"ghost\"}\n className=\"jkl-file__content__button\"\n onClick={onRemove}\n title={`Fjern ${fileName}`}\n icon={<TrashCanIcon />}\n />\n )}\n </div>\n\n {state === \"error\" && errorLabel && (\n <SupportLabel\n className=\"jkl-file__support-label\"\n id={supportId}\n label={errorLabel}\n labelType={\"error\"}\n />\n )}\n </div>\n );\n\n return context ? <li>{fileComponent}</li> : fileComponent;\n};\n"],"names":["props","children","className","fileName","fileType","fileSize","path","file","state","errorLabel","onRemove","variant","rest","id","useId","supportId","context","useFileInputContext","imageSrc","startsWith","URL","createObjectURL","fileComponent","jsxs","clsx","jsx","src","alt","Link","href","formatBytes","Button","onClick","title","icon","TrashCanIcon","SupportLabel","label","labelType"],"mappings":"+jEAU4DA,
|
|
1
|
+
{"version":3,"file":"File.cjs","sources":["../../../../src/components/file/File.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { type ComponentProps, type FC, useId } from \"react\";\nimport { formatBytes } from \"../../utilities/index.js\";\nimport { Button } from \"../button/index.js\";\nimport { useFileInputContext } from \"../file-input/internal/fileInputContext.js\";\nimport { TrashCanIcon } from \"../icon/index.js\";\nimport { SupportLabel } from \"../input-group/index.js\";\nimport { Link } from \"../link/index.js\";\nimport type { FileProps } from \"./types.js\";\n\nexport const File: FC<FileProps & ComponentProps<\"div\">> = (props) => {\n const {\n children,\n className,\n fileName,\n fileType,\n fileSize,\n path,\n file,\n state,\n errorLabel = \"Feil\",\n onRemove,\n variant = \"list\",\n ...rest\n } = props;\n\n const id = `jkl-file-preview-${useId()}`;\n const supportId = `${id}-support`;\n\n const context = useFileInputContext();\n\n const imageSrc =\n fileType.startsWith(\"image/\") &&\n (file ? URL.createObjectURL(file) : path);\n\n const fileComponent = (\n <div\n id={id}\n className={clsx(className, \"jkl-file\", `jkl-file--${variant}`)}\n data-state={state}\n {...rest}\n >\n <div className={\"jkl-file__content\"}>\n <div\n className=\"jkl-file__content__thumbnail\"\n data-filetype={fileType}\n >\n <img src={imageSrc || undefined} alt=\"\" />\n </div>\n {path ? (\n <p className=\"jkl-file__content__name\">\n <Link href={path}>\n {fileName}{\" \"}\n <span className=\"jkl-file__content__name__size\">\n ({formatBytes(fileSize)})\n </span>\n </Link>\n </p>\n ) : (\n <p className=\"jkl-file__content__name\">\n {fileName}{\" \"}\n <span className=\"jkl-file__content__name__size\">\n ({formatBytes(fileSize)})\n </span>\n </p>\n )}\n {onRemove && (\n <Button\n variant={\"ghost\"}\n className=\"jkl-file__content__button\"\n onClick={onRemove}\n title={`Fjern ${fileName}`}\n icon={<TrashCanIcon />}\n />\n )}\n </div>\n\n {state === \"error\" && errorLabel && (\n <SupportLabel\n className=\"jkl-file__support-label\"\n id={supportId}\n label={errorLabel}\n labelType={\"error\"}\n />\n )}\n </div>\n );\n\n return context ? <li>{fileComponent}</li> : fileComponent;\n};\n"],"names":["props","children","className","fileName","fileType","fileSize","path","file","state","errorLabel","onRemove","variant","rest","id","useId","supportId","context","useFileInputContext","imageSrc","startsWith","URL","createObjectURL","fileComponent","jsxs","clsx","jsx","src","alt","Link","href","formatBytes","Button","onClick","title","icon","TrashCanIcon","SupportLabel","label","labelType"],"mappings":"+jEAU4DA,IACxD,MACIC,SAAAA,EACAC,UAAAA,EACAC,SAAAA,EACAC,SAAAA,EACAC,SAAAA,EACAC,KAAAA,EACAC,KAAAA,EACAC,MAAAA,EACAC,WAAAA,EAAa,OACbC,SAAAA,EACAC,QAAAA,EAAU,UACPC,GACHZ,EAEEa,EAAK,oBAAoBC,EAAAA,UACzBC,EAAY,GAAGF,YAEfG,EAAUC,EAAAA,sBAEVC,EACFd,EAASe,WAAW,YACnBZ,EAAOa,IAAIC,gBAAgBd,GAAQD,GAElCgB,EACFC,EAAAA,KAAC,MAAA,CACGV,GAAAA,EACAX,UAAWsB,EAAAA,KAAKtB,EAAW,WAAY,aAAaS,KACpD,aAAYH,KACRI,EAEJX,SAAA,CAAAsB,EAAAA,KAAC,MAAA,CAAIrB,UAAW,oBACZD,SAAA,CAAAwB,EAAAA,IAAC,MAAA,CACGvB,UAAU,+BACV,gBAAeE,EAEfH,eAAC,MAAA,CAAIyB,IAAKR,QAAY,EAAWS,IAAI,OAExCrB,QACI,IAAA,CAAEJ,UAAU,0BACTD,SAAAsB,EAAAA,KAACK,EAAAA,KAAA,CAAKC,KAAMvB,EACPL,SAAA,CAAAE,EAAU,IACXoB,EAAAA,KAAC,OAAA,CAAKrB,UAAU,gCAAgCD,SAAA,CAAA,IAC1C6B,EAAAA,YAAYzB,GAAU,YAKpCkB,EAAAA,KAAC,IAAA,CAAErB,UAAU,0BACRD,SAAA,CAAAE,EAAU,IACXoB,EAAAA,KAAC,OAAA,CAAKrB,UAAU,gCAAgCD,SAAA,CAAA,IAC1C6B,EAAAA,YAAYzB,GAAU,UAInCK,GACGe,EAAAA,IAACM,EAAAA,OAAA,CACGpB,QAAS,QACTT,UAAU,4BACV8B,QAAStB,EACTuB,MAAO,SAAS9B,IAChB+B,WAAOC,EAAAA,aAAA,CAAA,QAKR,UAAV3B,GAAqBC,GAClBgB,EAAAA,IAACW,EAAAA,aAAA,CACGlC,UAAU,0BACVW,GAAIE,EACJsB,MAAO5B,EACP6B,UAAW,aAM3B,OAAOtB,EAAUS,EAAAA,IAAC,KAAA,CAAIxB,SAAAqB,IAAsBA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("../../../clsx-E3yX_9sL.cjs"),l=require("react"),t=require("../input-group/FieldGroup.cjs"),s=require("./internal/Dropzone.cjs"),n=require("./internal/Input.cjs"),r=require("./internal/MaxSize.cjs"),a=require("./internal/fileInputContext.cjs"),c=l.forwardRef((
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("../../../clsx-E3yX_9sL.cjs"),l=require("react"),t=require("../input-group/FieldGroup.cjs"),s=require("./internal/Dropzone.cjs"),n=require("./internal/Input.cjs"),r=require("./internal/MaxSize.cjs"),a=require("./internal/fileInputContext.cjs"),c=l.forwardRef((c,u)=>{const{accept:d,className:o,children:p,id:j,value:x,density:f,multiple:h=!0,maxSizeBytes:m,onChange:g,variant:y,...k}=c,z=x.length>0,I=l.useId();return"small"===y?e.jsx(a.FileInputContextProvider,{context:{accept:d,onChange:g,maxSizeBytes:m,files:x},children:e.jsxs(t.FieldGroup,{className:i.clsx("jkl-file-input","jkl-file-input--small",o,{"jkl-file-input--has-files":z}),"data-layout-density":f||"compact",...k,children:[e.jsx(s.Dropzone,{children:e.jsx("div",{className:"jkl-file-input__call-to-action",children:e.jsx(n.Input,{id:j,label:"Legg til fil",multiple:h,ref:u,"aria-describedby":I})})}),e.jsx(r.MaxSize,{id:I}),x.length>0&&e.jsx("ul",{className:"jkl-file-input__files",children:p})]})}):e.jsx(a.FileInputContextProvider,{context:{accept:d,onChange:g,maxSizeBytes:m,files:x},children:e.jsx(t.FieldGroup,{className:i.clsx("jkl-file-input",o,{"jkl-file-input--has-files":z}),"data-layout-density":f,...k,children:e.jsxs(s.Dropzone,{children:[x.length>0&&e.jsx("ul",{className:"jkl-file-input__files",children:p}),e.jsxs("div",{className:"jkl-file-input__call-to-action",children:[e.jsx(n.Input,{id:j,label:h&&z?"Legg til flere filer":"Legg til fil",multiple:h,ref:u,"aria-describedby":I}),e.jsx(r.MaxSize,{id:I})]})]})})})});c.displayName="FileInput",exports.FileInput=c;
|
|
2
2
|
//# sourceMappingURL=FileInput.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileInput.cjs","sources":["../../../../src/components/file-input/FileInput.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef, useId } from \"react\";\nimport { FieldGroup } from \"../../components/input-group/FieldGroup.js\";\nimport { Dropzone } from \"./internal/Dropzone.js\";\nimport { Input } from \"./internal/Input.js\";\nimport { MaxSize } from \"./internal/MaxSize.js\";\nimport { FileInputContextProvider } from \"./internal/fileInputContext.js\";\nimport type { FileInputProps } from \"./types.js\";\n\nexport const FileInput = forwardRef<HTMLInputElement, FileInputProps>(\n (props, ref) => {\n const {\n accept,\n className,\n children,\n id,\n value,\n density,\n multiple = true,\n maxSizeBytes,\n onChange,\n variant,\n ...rest\n } = props;\n\n const hasFiles = value.length > 0;\n\n const maxSizeDescriptionId = useId();\n\n if (variant === \"small\") {\n return (\n <FileInputContextProvider\n context={{ accept, onChange, maxSizeBytes, files: value }}\n >\n <FieldGroup\n className={clsx(\n \"jkl-file-input\",\n \"jkl-file-input--small\",\n className,\n {\n \"jkl-file-input--has-files\": hasFiles,\n },\n )}\n data-layout-density={density ? density : \"compact\"}\n {...rest}\n >\n <Dropzone>\n <div className=\"jkl-file-input__call-to-action\">\n <Input\n id={id}\n label=\"Legg til fil\"\n multiple={multiple}\n ref={ref}\n aria-describedby={maxSizeDescriptionId}\n />\n </div>\n </Dropzone>\n <MaxSize id={maxSizeDescriptionId} />\n {value.length > 0 && (\n <ul className=\"jkl-file-input__files\">\n {children}\n </ul>\n )}\n </FieldGroup>\n </FileInputContextProvider>\n );\n }\n\n return (\n <FileInputContextProvider\n context={{ accept, onChange, maxSizeBytes, files: value }}\n >\n <FieldGroup\n className={clsx(\"jkl-file-input\", className, {\n \"jkl-file-input--has-files\": hasFiles,\n })}\n data-layout-density={density}\n {...rest}\n >\n <Dropzone>\n {value.length > 0 && (\n <ul className=\"jkl-file-input__files\">\n {children}\n </ul>\n )}\n <div className=\"jkl-file-input__call-to-action\">\n <Input\n id={id}\n label={\n multiple && hasFiles\n ? \"Legg til flere filer\"\n : \"Legg til fil\"\n }\n multiple={multiple}\n ref={ref}\n aria-describedby={maxSizeDescriptionId}\n />\n <MaxSize id={maxSizeDescriptionId} />\n </div>\n </Dropzone>\n </FieldGroup>\n </FileInputContextProvider>\n );\n },\n);\n\nFileInput.displayName = \"FileInput\";\n"],"names":["FileInput","forwardRef","props","ref","accept","className","children","id","value","density","multiple","maxSizeBytes","onChange","variant","rest","hasFiles","length","maxSizeDescriptionId","useId","jsx","FileInputContextProvider","context","files","jsxs","FieldGroup","clsx","Dropzone","Input","label","MaxSize","displayName"],"mappings":"mXASaA,EAAYC,EAAAA,
|
|
1
|
+
{"version":3,"file":"FileInput.cjs","sources":["../../../../src/components/file-input/FileInput.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef, useId } from \"react\";\nimport { FieldGroup } from \"../../components/input-group/FieldGroup.js\";\nimport { Dropzone } from \"./internal/Dropzone.js\";\nimport { Input } from \"./internal/Input.js\";\nimport { MaxSize } from \"./internal/MaxSize.js\";\nimport { FileInputContextProvider } from \"./internal/fileInputContext.js\";\nimport type { FileInputProps } from \"./types.js\";\n\nexport const FileInput = forwardRef<HTMLInputElement, FileInputProps>(\n (props, ref) => {\n const {\n accept,\n className,\n children,\n id,\n value,\n density,\n multiple = true,\n maxSizeBytes,\n onChange,\n variant,\n ...rest\n } = props;\n\n const hasFiles = value.length > 0;\n\n const maxSizeDescriptionId = useId();\n\n if (variant === \"small\") {\n return (\n <FileInputContextProvider\n context={{ accept, onChange, maxSizeBytes, files: value }}\n >\n <FieldGroup\n className={clsx(\n \"jkl-file-input\",\n \"jkl-file-input--small\",\n className,\n {\n \"jkl-file-input--has-files\": hasFiles,\n },\n )}\n data-layout-density={density ? density : \"compact\"}\n {...rest}\n >\n <Dropzone>\n <div className=\"jkl-file-input__call-to-action\">\n <Input\n id={id}\n label=\"Legg til fil\"\n multiple={multiple}\n ref={ref}\n aria-describedby={maxSizeDescriptionId}\n />\n </div>\n </Dropzone>\n <MaxSize id={maxSizeDescriptionId} />\n {value.length > 0 && (\n <ul className=\"jkl-file-input__files\">\n {children}\n </ul>\n )}\n </FieldGroup>\n </FileInputContextProvider>\n );\n }\n\n return (\n <FileInputContextProvider\n context={{ accept, onChange, maxSizeBytes, files: value }}\n >\n <FieldGroup\n className={clsx(\"jkl-file-input\", className, {\n \"jkl-file-input--has-files\": hasFiles,\n })}\n data-layout-density={density}\n {...rest}\n >\n <Dropzone>\n {value.length > 0 && (\n <ul className=\"jkl-file-input__files\">\n {children}\n </ul>\n )}\n <div className=\"jkl-file-input__call-to-action\">\n <Input\n id={id}\n label={\n multiple && hasFiles\n ? \"Legg til flere filer\"\n : \"Legg til fil\"\n }\n multiple={multiple}\n ref={ref}\n aria-describedby={maxSizeDescriptionId}\n />\n <MaxSize id={maxSizeDescriptionId} />\n </div>\n </Dropzone>\n </FieldGroup>\n </FileInputContextProvider>\n );\n },\n);\n\nFileInput.displayName = \"FileInput\";\n"],"names":["FileInput","forwardRef","props","ref","accept","className","children","id","value","density","multiple","maxSizeBytes","onChange","variant","rest","hasFiles","length","maxSizeDescriptionId","useId","jsx","FileInputContextProvider","context","files","jsxs","FieldGroup","clsx","Dropzone","Input","label","MaxSize","displayName"],"mappings":"mXASaA,EAAYC,EAAAA,WACrB,CAACC,EAAOC,KACJ,MACIC,OAAAA,EACAC,UAAAA,EACAC,SAAAA,EACAC,GAAAA,EACAC,MAAAA,EACAC,QAAAA,EACAC,SAAAA,GAAW,EACXC,aAAAA,EACAC,SAAAA,EACAC,QAAAA,KACGC,GACHZ,EAEEa,EAAWP,EAAMQ,OAAS,EAE1BC,EAAuBC,EAAAA,QAE7B,MAAgB,UAAZL,EAEIM,EAAAA,IAACC,EAAAA,yBAAA,CACGC,QAAS,CAAEjB,OAAAA,EAAQQ,SAAAA,EAAUD,aAAAA,EAAcW,MAAOd,GAElDF,SAAAiB,EAAAA,KAACC,EAAAA,WAAA,CACGnB,UAAWoB,EAAAA,KACP,iBACA,wBACApB,EACA,CACI,4BAA6BU,IAGrC,sBAAqBN,GAAoB,aACrCK,EAEJR,SAAA,CAAAa,MAACO,EAAAA,SAAA,CACGpB,SAAAa,EAAAA,IAAC,MAAA,CAAId,UAAU,iCACXC,SAAAa,EAAAA,IAACQ,EAAAA,MAAA,CACGpB,GAAAA,EACAqB,MAAM,eACNlB,SAAAA,EACAP,IAAAA,EACA,mBAAkBc,QAI9BE,EAAAA,IAACU,EAAAA,QAAA,CAAQtB,GAAIU,IACZT,EAAMQ,OAAS,SACX,KAAA,CAAGX,UAAU,wBACTC,SAAAA,SASrBa,EAAAA,IAACC,EAAAA,yBAAA,CACGC,QAAS,CAAEjB,OAAAA,EAAQQ,SAAAA,EAAUD,aAAAA,EAAcW,MAAOd,GAElDF,SAAAa,EAAAA,IAACK,EAAAA,WAAA,CACGnB,UAAWoB,EAAAA,KAAK,iBAAkBpB,EAAW,CACzC,4BAA6BU,IAEjC,sBAAqBN,KACjBK,EAEJR,gBAACoB,WAAA,CACIpB,SAAA,CAAAE,EAAMQ,OAAS,GACZG,EAAAA,IAAC,KAAA,CAAGd,UAAU,wBACTC,SAAAA,IAGTiB,EAAAA,KAAC,MAAA,CAAIlB,UAAU,iCACXC,SAAA,CAAAa,EAAAA,IAACQ,EAAAA,MAAA,CACGpB,GAAAA,EACAqB,MACIlB,GAAYK,EACN,uBACA,eAEVL,SAAAA,EACAP,IAAAA,EACA,mBAAkBc,IAEtBE,EAAAA,IAACU,EAAAA,QAAA,CAAQtB,GAAIU,gBASzCjB,EAAU8B,YAAc"}
|
|
@@ -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"),t=require("react"),n=require("./fileInputContext.cjs"),i=require("./validateFileInputFiles.cjs"),a=t.forwardRef((
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("../../../../clsx-E3yX_9sL.cjs"),t=require("react"),n=require("./fileInputContext.cjs"),i=require("./validateFileInputFiles.cjs"),a=t.forwardRef((a,o)=>{const{children:l,...s}=a,[p,u]=t.useState(""),d=n.useFileInputContext();if(!d)return e.jsx("p",{children:"Dropzone must be placed inside a FileInputContextProvider."});const{maxSizeBytes:c,accept:f,onChange:v}=d;return e.jsx("div",{...s,ref:o,className:r.clsx("jkl-file-input__dropzone",p),onDragEnter:e=>{u("jkl-file-input__dropzone--enter"),e.preventDefault()},onDragOver:e=>{u("jkl-file-input__dropzone--enter"),e.preventDefault()},onDrop:e=>{e.preventDefault(),u(""),e.dataTransfer.files&&v(e,[...e.dataTransfer.files].map(e=>({file:e,state:void 0,validation:i.validateFileInputFiles(e,f,c),uploadProgress:0})))},onDragLeave:e=>{u(""),e.preventDefault()},children:l})});a.displayName="Dropzone",exports.Dropzone=a;
|
|
2
2
|
//# sourceMappingURL=Dropzone.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropzone.cjs","sources":["../../../../../src/components/file-input/internal/Dropzone.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef, useState } from \"react\";\nimport type { WithChildren } from \"../../../core/types.js\";\nimport type { UploadedFile } from \"../types.js\";\nimport { useFileInputContext } from \"./fileInputContext.js\";\nimport { validateFileInputFiles } from \"./validateFileInputFiles.js\";\n\ninterface DropzoneProps extends WithChildren {}\n\nexport const Dropzone = forwardRef<HTMLDivElement, DropzoneProps>(\n (props, ref) => {\n const { children, ...rest } = props;\n const [onDragClassName, setOnDragClassName] = useState<string>(\"\");\n\n const context = useFileInputContext();\n if (!context) {\n return (\n <p>\n Dropzone must be placed inside a FileInputContextProvider.\n </p>\n );\n }\n const { maxSizeBytes, accept, onChange } = context;\n\n return (\n <div\n {...rest}\n ref={ref}\n className={clsx(\"jkl-file-input__dropzone\", onDragClassName)}\n onDragEnter={(e) => {\n setOnDragClassName(\"jkl-file-input__dropzone--enter\");\n e.preventDefault();\n }}\n onDragOver={(e) => {\n /* Prevent browser from opening file in a new tab */\n setOnDragClassName(\"jkl-file-input__dropzone--enter\");\n e.preventDefault();\n }}\n onDrop={(e) => {\n e.preventDefault();\n setOnDragClassName(\"\");\n\n if (e.dataTransfer.files) {\n onChange(\n e,\n [...e.dataTransfer.files].map<UploadedFile>(\n (file) => ({\n file,\n state: undefined,\n validation: validateFileInputFiles(\n file,\n accept,\n maxSizeBytes,\n ),\n uploadProgress: 0,\n }),\n ),\n );\n }\n }}\n onDragLeave={(e) => {\n setOnDragClassName(\"\");\n e.preventDefault();\n }}\n >\n {children}\n </div>\n );\n },\n);\n\nDropzone.displayName = \"Dropzone\";\n"],"names":["Dropzone","forwardRef","props","ref","children","rest","onDragClassName","setOnDragClassName","useState","context","useFileInputContext","jsx","maxSizeBytes","accept","onChange","className","clsx","onDragEnter","e","preventDefault","onDragOver","onDrop","dataTransfer","files","map","file","state","validation","validateFileInputFiles","uploadProgress","onDragLeave","displayName"],"mappings":"iQASaA,EAAWC,EAAAA,
|
|
1
|
+
{"version":3,"file":"Dropzone.cjs","sources":["../../../../../src/components/file-input/internal/Dropzone.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { forwardRef, useState } from \"react\";\nimport type { WithChildren } from \"../../../core/types.js\";\nimport type { UploadedFile } from \"../types.js\";\nimport { useFileInputContext } from \"./fileInputContext.js\";\nimport { validateFileInputFiles } from \"./validateFileInputFiles.js\";\n\ninterface DropzoneProps extends WithChildren {}\n\nexport const Dropzone = forwardRef<HTMLDivElement, DropzoneProps>(\n (props, ref) => {\n const { children, ...rest } = props;\n const [onDragClassName, setOnDragClassName] = useState<string>(\"\");\n\n const context = useFileInputContext();\n if (!context) {\n return (\n <p>\n Dropzone must be placed inside a FileInputContextProvider.\n </p>\n );\n }\n const { maxSizeBytes, accept, onChange } = context;\n\n return (\n <div\n {...rest}\n ref={ref}\n className={clsx(\"jkl-file-input__dropzone\", onDragClassName)}\n onDragEnter={(e) => {\n setOnDragClassName(\"jkl-file-input__dropzone--enter\");\n e.preventDefault();\n }}\n onDragOver={(e) => {\n /* Prevent browser from opening file in a new tab */\n setOnDragClassName(\"jkl-file-input__dropzone--enter\");\n e.preventDefault();\n }}\n onDrop={(e) => {\n e.preventDefault();\n setOnDragClassName(\"\");\n\n if (e.dataTransfer.files) {\n onChange(\n e,\n [...e.dataTransfer.files].map<UploadedFile>(\n (file) => ({\n file,\n state: undefined,\n validation: validateFileInputFiles(\n file,\n accept,\n maxSizeBytes,\n ),\n uploadProgress: 0,\n }),\n ),\n );\n }\n }}\n onDragLeave={(e) => {\n setOnDragClassName(\"\");\n e.preventDefault();\n }}\n >\n {children}\n </div>\n );\n },\n);\n\nDropzone.displayName = \"Dropzone\";\n"],"names":["Dropzone","forwardRef","props","ref","children","rest","onDragClassName","setOnDragClassName","useState","context","useFileInputContext","jsx","maxSizeBytes","accept","onChange","className","clsx","onDragEnter","e","preventDefault","onDragOver","onDrop","dataTransfer","files","map","file","state","validation","validateFileInputFiles","uploadProgress","onDragLeave","displayName"],"mappings":"iQASaA,EAAWC,EAAAA,WACpB,CAACC,EAAOC,KACJ,MAAQC,SAAAA,KAAaC,GAASH,GACvBI,EAAiBC,GAAsBC,EAAAA,SAAiB,IAEzDC,EAAUC,EAAAA,sBAChB,IAAKD,EACD,OACIE,EAAAA,IAAC,KAAEP,SAAA,+DAKX,MAAQQ,aAAAA,EAAcC,OAAAA,EAAQC,SAAAA,GAAaL,EAE3C,OACIE,EAAAA,IAAC,MAAA,IACON,EACJF,IAAAA,EACAY,UAAWC,EAAAA,KAAK,2BAA4BV,GAC5CW,YAAcC,IACVX,EAAmB,mCACnBW,EAAEC,kBAENC,WAAaF,IAETX,EAAmB,mCACnBW,EAAEC,kBAENE,OAASH,IACLA,EAAEC,iBACFZ,EAAmB,IAEfW,EAAEI,aAAaC,OACfT,EACII,EACA,IAAIA,EAAEI,aAAaC,OAAOC,IACrBC,IAAAA,CACGA,KAAAA,EACAC,WAAO,EACPC,WAAYC,EAAAA,uBACRH,EACAZ,EACAD,GAEJiB,eAAgB,OAMpCC,YAAcZ,IACVX,EAAmB,IACnBW,EAAEC,kBAGLf,SAAAA,MAMjBJ,EAAS+B,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),i=require("./fileInputContext.cjs"),l=require("./validateFileInputFiles.cjs"),r=t.forwardRef((
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),i=require("./fileInputContext.cjs"),l=require("./validateFileInputFiles.cjs"),r=t.forwardRef((r,s)=>{const{multiple:n,id:a,label:o,...u}=r,d=t.useId(),p=`${a}-description`,c=n?"filer":"fil",f=i.useFileInputContext();if(!f)return e.jsx("p",{children:"Input must be placed inside a FileInputContextProvider."});const{accept:j,maxSizeBytes:m,onChange:x}=f,b=a||d;return e.jsxs(e.Fragment,{children:[e.jsx("label",{className:"jkl-button jkl-button--secondary",htmlFor:b,id:`${b}__add-btn`,children:o}),e.jsx("input",{...u,ref:s,id:b,accept:j,"aria-describedby":m?p:void 0,className:"jkl-sr-only",type:"file",multiple:n,value:"",onChange:e=>{e.target.files&&x(e,[...e.target.files].map(e=>({file:e,state:void 0,validation:l.validateFileInputFiles(e,j,m),uploadProgress:0})))}}),e.jsxs("p",{className:"jkl-file-input__dropzone-hint",children:["eller slipp ",c," her"]})," "]})});r.displayName="Input",exports.Input=r;
|
|
2
2
|
//# sourceMappingURL=Input.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.cjs","sources":["../../../../../src/components/file-input/internal/Input.tsx"],"sourcesContent":["import React, { forwardRef, useId } from \"react\";\nimport type { UploadedFile } from \"../types.js\";\nimport { useFileInputContext } from \"./fileInputContext.js\";\nimport { validateFileInputFiles } from \"./validateFileInputFiles.js\";\n\ninterface FileInputProps {\n id?: string;\n label: string;\n multiple: boolean;\n}\n\nexport const Input = forwardRef<HTMLInputElement, FileInputProps>(\n (props, ref) => {\n const { multiple, id, label, ...rest } = props;\n\n const defaultId = useId();\n\n const maxSizeDescriptionId = `${id}-description`;\n const descriptor = multiple ? \"filer\" : \"fil\";\n\n const context = useFileInputContext();\n if (!context) {\n return (\n <p>Input must be placed inside a FileInputContextProvider.</p>\n );\n }\n const { accept, maxSizeBytes, onChange } = context;\n\n const elementId = id || defaultId;\n\n return (\n <>\n <label\n className=\"jkl-button jkl-button--secondary\"\n htmlFor={elementId}\n id={`${elementId}__add-btn`}\n >\n {label}\n </label>\n <input\n {...rest}\n ref={ref}\n id={elementId}\n accept={accept}\n aria-describedby={\n maxSizeBytes ? maxSizeDescriptionId : undefined\n }\n className=\"jkl-sr-only\"\n type=\"file\"\n multiple={multiple}\n value=\"\"\n onChange={(e) => {\n if (e.target.files) {\n onChange(\n e,\n [...e.target.files].map<UploadedFile>(\n (file) => ({\n file,\n state: undefined,\n validation: validateFileInputFiles(\n file,\n accept,\n maxSizeBytes,\n ),\n uploadProgress: 0,\n }),\n ),\n );\n }\n }}\n />\n <p className=\"jkl-file-input__dropzone-hint\">\n eller slipp {descriptor} her\n </p>{\" \"}\n </>\n );\n },\n);\n\nInput.displayName = \"Input\";\n"],"names":["Input","forwardRef","props","ref","multiple","id","label","rest","defaultId","useId","maxSizeDescriptionId","descriptor","context","useFileInputContext","jsx","children","accept","maxSizeBytes","onChange","elementId","jsxs","Fragment","className","htmlFor","type","value","e","target","files","map","file","state","validation","validateFileInputFiles","uploadProgress","displayName"],"mappings":"sNAWaA,EAAQC,EAAAA,
|
|
1
|
+
{"version":3,"file":"Input.cjs","sources":["../../../../../src/components/file-input/internal/Input.tsx"],"sourcesContent":["import React, { forwardRef, useId } from \"react\";\nimport type { UploadedFile } from \"../types.js\";\nimport { useFileInputContext } from \"./fileInputContext.js\";\nimport { validateFileInputFiles } from \"./validateFileInputFiles.js\";\n\ninterface FileInputProps {\n id?: string;\n label: string;\n multiple: boolean;\n}\n\nexport const Input = forwardRef<HTMLInputElement, FileInputProps>(\n (props, ref) => {\n const { multiple, id, label, ...rest } = props;\n\n const defaultId = useId();\n\n const maxSizeDescriptionId = `${id}-description`;\n const descriptor = multiple ? \"filer\" : \"fil\";\n\n const context = useFileInputContext();\n if (!context) {\n return (\n <p>Input must be placed inside a FileInputContextProvider.</p>\n );\n }\n const { accept, maxSizeBytes, onChange } = context;\n\n const elementId = id || defaultId;\n\n return (\n <>\n <label\n className=\"jkl-button jkl-button--secondary\"\n htmlFor={elementId}\n id={`${elementId}__add-btn`}\n >\n {label}\n </label>\n <input\n {...rest}\n ref={ref}\n id={elementId}\n accept={accept}\n aria-describedby={\n maxSizeBytes ? maxSizeDescriptionId : undefined\n }\n className=\"jkl-sr-only\"\n type=\"file\"\n multiple={multiple}\n value=\"\"\n onChange={(e) => {\n if (e.target.files) {\n onChange(\n e,\n [...e.target.files].map<UploadedFile>(\n (file) => ({\n file,\n state: undefined,\n validation: validateFileInputFiles(\n file,\n accept,\n maxSizeBytes,\n ),\n uploadProgress: 0,\n }),\n ),\n );\n }\n }}\n />\n <p className=\"jkl-file-input__dropzone-hint\">\n eller slipp {descriptor} her\n </p>{\" \"}\n </>\n );\n },\n);\n\nInput.displayName = \"Input\";\n"],"names":["Input","forwardRef","props","ref","multiple","id","label","rest","defaultId","useId","maxSizeDescriptionId","descriptor","context","useFileInputContext","jsx","children","accept","maxSizeBytes","onChange","elementId","jsxs","Fragment","className","htmlFor","type","value","e","target","files","map","file","state","validation","validateFileInputFiles","uploadProgress","displayName"],"mappings":"sNAWaA,EAAQC,EAAAA,WACjB,CAACC,EAAOC,KACJ,MAAQC,SAAAA,EAAUC,GAAAA,EAAIC,MAAAA,KAAUC,GAASL,EAEnCM,EAAYC,EAAAA,QAEZC,EAAuB,GAAGL,gBAC1BM,EAAaP,EAAW,QAAU,MAElCQ,EAAUC,EAAAA,sBAChB,IAAKD,EACD,OACIE,EAAAA,IAAC,KAAEC,SAAA,4DAGX,MAAQC,OAAAA,EAAQC,aAAAA,EAAcC,SAAAA,GAAaN,EAErCO,EAAYd,GAAMG,EAExB,OACIY,EAAAA,KAAAC,WAAA,CACIN,SAAA,CAAAD,EAAAA,IAAC,QAAA,CACGQ,UAAU,mCACVC,QAASJ,EACTd,GAAI,GAAGc,aAENJ,SAAAT,IAELQ,EAAAA,IAAC,QAAA,IACOP,EACJJ,IAAAA,EACAE,GAAIc,EACJH,OAAAA,EACA,mBACIC,EAAeP,OAAuB,EAE1CY,UAAU,cACVE,KAAK,OACLpB,SAAAA,EACAqB,MAAM,GACNP,SAAWQ,IACHA,EAAEC,OAAOC,OACTV,EACIQ,EACA,IAAIA,EAAEC,OAAOC,OAAOC,IACfC,KACGA,KAAAA,EACAC,WAAO,EACPC,WAAYC,EAAAA,uBACRH,EACAd,EACAC,GAEJiB,eAAgB,SAOxCd,EAAAA,KAAC,IAAA,CAAEE,UAAU,gCAAgCP,SAAA,CAAA,eAC5BJ,EAAW,UACvB,SAMrBX,EAAMmC,YAAc"}
|