@fremtind/jokul 0.28.0 → 0.29.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/build/build-stats.html +1 -1
- package/build/cjs/components/breadcrumb/index.d.cts +2 -4
- package/build/cjs/components/button/index.d.cts +1 -1
- package/build/cjs/components/button/types.cjs.map +1 -1
- package/build/cjs/components/button/types.d.cts +1 -2
- package/build/cjs/components/card/NavCard.cjs.map +1 -1
- package/build/cjs/components/card/NavCard.d.cts +1 -10
- package/build/cjs/components/card/index.d.cts +2 -2
- package/build/cjs/components/card/types.cjs.map +1 -1
- package/build/cjs/components/card/types.d.cts +8 -0
- package/build/cjs/components/combobox/Combobox.cjs.map +1 -1
- package/build/cjs/components/combobox/Combobox.d.cts +6 -7
- package/build/cjs/components/combobox/index.d.cts +1 -1
- package/build/cjs/components/cookie-consent/index.d.cts +2 -4
- package/build/cjs/components/datepicker/index.cjs +1 -1
- package/build/cjs/components/datepicker/index.d.cts +3 -3
- package/build/cjs/components/datepicker/types.d.cts +7 -0
- package/build/cjs/components/datepicker/utils.cjs +1 -1
- package/build/cjs/components/datepicker/utils.cjs.map +1 -1
- package/build/cjs/components/datepicker/utils.d.cts +0 -1
- package/build/cjs/components/datepicker/validation.cjs.map +1 -1
- package/build/cjs/components/datepicker/validation.d.cts +1 -8
- package/build/cjs/components/description-list/index.d.cts +1 -1
- package/build/cjs/components/expander/Expander.cjs.map +1 -1
- package/build/cjs/components/expander/Expander.d.cts +1 -2
- package/build/cjs/components/expander/index.d.cts +2 -4
- package/build/cjs/components/feedback/Feedback.cjs.map +1 -1
- package/build/cjs/components/feedback/Feedback.d.cts +4 -9
- package/build/cjs/components/feedback/followup/Followup.cjs.map +1 -1
- package/build/cjs/components/feedback/followup/Followup.d.cts +3 -14
- package/build/cjs/components/feedback/index.d.cts +3 -3
- package/build/cjs/components/feedback/presets.cjs.map +1 -1
- package/build/cjs/components/feedback/presets.d.cts +2 -5
- package/build/cjs/components/feedback/questions/ContactQuestion.cjs.map +1 -1
- package/build/cjs/components/feedback/questions/ContactQuestion.d.cts +3 -28
- package/build/cjs/components/feedback/types.d.cts +42 -7
- package/build/cjs/components/icon-button/index.d.cts +1 -2
- package/build/cjs/components/image/index.d.cts +1 -3
- package/build/cjs/components/index.cjs +1 -1
- package/build/cjs/components/index.d.cts +1 -1
- package/build/cjs/components/input-panel/BasePanel.cjs +2 -0
- package/build/cjs/components/input-panel/BasePanel.cjs.map +1 -0
- package/build/cjs/components/input-panel/BasePanel.d.cts +10 -0
- package/build/cjs/components/input-panel/CheckboxPanel.cjs +2 -0
- package/build/cjs/components/input-panel/CheckboxPanel.cjs.map +1 -0
- package/build/cjs/components/input-panel/CheckboxPanel.d.cts +7 -0
- package/build/cjs/components/input-panel/RadioPanel.cjs +2 -0
- package/build/cjs/components/input-panel/RadioPanel.cjs.map +1 -0
- package/build/cjs/components/{radio-panel → input-panel}/RadioPanel.d.cts +2 -4
- package/build/cjs/components/input-panel/RadioPanelGroup.cjs +2 -0
- package/build/cjs/components/input-panel/RadioPanelGroup.cjs.map +1 -0
- package/build/cjs/components/input-panel/RadioPanelGroup.d.cts +4 -0
- package/build/cjs/components/input-panel/documentation/checkbox-panel/ControlledExample.d.cts +4 -0
- package/build/cjs/components/input-panel/documentation/checkbox-panel/UncontrolledExample.d.cts +4 -0
- package/build/cjs/components/input-panel/documentation/radio-panel/ControlledExample.d.cts +4 -0
- package/build/cjs/components/input-panel/documentation/radio-panel/UncontrolledExample.d.cts +4 -0
- package/build/cjs/components/input-panel/index.cjs +2 -0
- package/build/cjs/components/input-panel/index.d.cts +3 -0
- package/build/cjs/components/input-panel/radioPanelContext.cjs +2 -0
- package/build/cjs/components/input-panel/radioPanelContext.cjs.map +1 -0
- package/build/cjs/components/input-panel/radioPanelContext.d.cts +7 -0
- package/build/cjs/components/link-list/LinkList.cjs.map +1 -1
- package/build/cjs/components/link-list/LinkList.d.cts +2 -11
- package/build/cjs/components/link-list/index.d.cts +1 -0
- package/build/cjs/components/link-list/types.cjs +2 -0
- package/build/cjs/components/link-list/types.cjs.map +1 -0
- package/build/cjs/components/link-list/types.d.cts +11 -0
- package/build/cjs/components/list/index.d.cts +2 -3
- package/build/cjs/components/loader/index.d.cts +9 -18
- package/build/cjs/components/logo/index.d.cts +2 -4
- package/build/cjs/components/modal/Modal.cjs.map +1 -1
- package/build/cjs/components/modal/Modal.d.cts +8 -2
- package/build/cjs/components/modal/index.d.cts +2 -4
- package/build/cjs/components/pagination/Pagination.cjs.map +1 -1
- package/build/cjs/components/pagination/Pagination.d.cts +2 -1
- package/build/cjs/components/pagination/index.d.cts +1 -1
- package/build/cjs/components/popover/Popover.cjs.map +1 -1
- package/build/cjs/components/popover/Popover.d.cts +6 -6
- package/build/cjs/components/popover/index.d.cts +1 -1
- package/build/cjs/components/progress-bar/index.d.cts +2 -4
- package/build/cjs/components/radio-button/index.d.cts +3 -6
- package/build/cjs/components/select/Select.cjs +1 -1
- package/build/cjs/components/select/Select.cjs.map +1 -1
- package/build/cjs/components/select/Select.d.cts +5 -6
- package/build/cjs/components/select/index.d.cts +2 -4
- package/build/cjs/components/summary-table/SummaryTable.cjs.map +1 -1
- package/build/cjs/components/summary-table/SummaryTable.d.cts +2 -2
- package/build/cjs/components/summary-table/index.d.cts +2 -2
- package/build/cjs/components/system-message/SystemMessage.cjs.map +1 -1
- package/build/cjs/components/system-message/SystemMessage.d.cts +5 -6
- package/build/cjs/components/system-message/index.d.cts +1 -1
- package/build/cjs/components/tabs/index.d.cts +6 -6
- package/build/cjs/components/tag/index.d.cts +1 -3
- package/build/cjs/components/text-input/BaseTextArea.cjs.map +1 -1
- package/build/cjs/components/text-input/BaseTextArea.d.cts +1 -2
- package/build/cjs/components/text-input/index.d.cts +2 -2
- package/build/cjs/components/toast/index.d.cts +1 -1
- package/build/cjs/components/toast/toastContext.cjs.map +1 -1
- package/build/cjs/components/toast/toastContext.d.cts +1 -13
- package/build/cjs/components/toast/types.d.cts +11 -0
- package/build/cjs/components/toggle-switch/ToggleSlider.cjs.map +1 -1
- package/build/cjs/components/toggle-switch/ToggleSlider.d.cts +2 -3
- package/build/cjs/components/toggle-switch/ToggleSwitch.cjs.map +1 -1
- package/build/cjs/components/toggle-switch/ToggleSwitch.d.cts +1 -1
- package/build/cjs/components/toggle-switch/index.d.cts +2 -2
- package/build/cjs/components/tooltip/Tooltip.cjs +1 -1
- package/build/cjs/components/tooltip/Tooltip.cjs.map +1 -1
- package/build/cjs/components/tooltip/Tooltip.d.cts +1 -1
- package/build/cjs/core/tokens.cjs +1 -1
- package/build/cjs/core/tokens.cjs.map +1 -1
- package/build/cjs/core/tokens.d.cts +5 -1
- package/build/cjs/index.cjs +1 -1
- package/build/es/components/breadcrumb/index.d.ts +2 -4
- package/build/es/components/button/index.d.ts +1 -1
- package/build/es/components/button/types.d.ts +1 -2
- package/build/es/components/button/types.js.map +1 -1
- package/build/es/components/card/NavCard.d.ts +1 -10
- package/build/es/components/card/NavCard.js.map +1 -1
- package/build/es/components/card/index.d.ts +2 -2
- package/build/es/components/card/types.d.ts +8 -0
- package/build/es/components/card/types.js.map +1 -1
- package/build/es/components/combobox/Combobox.d.ts +6 -7
- package/build/es/components/combobox/Combobox.js.map +1 -1
- package/build/es/components/combobox/index.d.ts +1 -1
- package/build/es/components/cookie-consent/index.d.ts +2 -4
- package/build/es/components/datepicker/index.d.ts +3 -3
- package/build/es/components/datepicker/index.js +1 -1
- package/build/es/components/datepicker/types.d.ts +7 -0
- package/build/es/components/datepicker/utils.d.ts +0 -1
- package/build/es/components/datepicker/utils.js +1 -1
- package/build/es/components/datepicker/utils.js.map +1 -1
- package/build/es/components/datepicker/validation.d.ts +1 -8
- package/build/es/components/datepicker/validation.js.map +1 -1
- package/build/es/components/description-list/index.d.ts +1 -1
- package/build/es/components/expander/Expander.d.ts +1 -2
- package/build/es/components/expander/Expander.js.map +1 -1
- package/build/es/components/expander/index.d.ts +2 -4
- package/build/es/components/feedback/Feedback.d.ts +4 -9
- package/build/es/components/feedback/Feedback.js.map +1 -1
- package/build/es/components/feedback/followup/Followup.d.ts +3 -14
- package/build/es/components/feedback/followup/Followup.js.map +1 -1
- package/build/es/components/feedback/index.d.ts +3 -3
- package/build/es/components/feedback/presets.d.ts +2 -5
- package/build/es/components/feedback/presets.js.map +1 -1
- package/build/es/components/feedback/questions/ContactQuestion.d.ts +3 -28
- package/build/es/components/feedback/questions/ContactQuestion.js.map +1 -1
- package/build/es/components/feedback/types.d.ts +42 -7
- package/build/es/components/icon-button/index.d.ts +1 -2
- package/build/es/components/image/index.d.ts +1 -3
- package/build/es/components/index.d.ts +1 -1
- package/build/es/components/index.js +1 -1
- package/build/es/components/input-panel/BasePanel.d.ts +10 -0
- package/build/es/components/input-panel/BasePanel.js +2 -0
- package/build/es/components/input-panel/BasePanel.js.map +1 -0
- package/build/es/components/input-panel/CheckboxPanel.d.ts +7 -0
- package/build/es/components/input-panel/CheckboxPanel.js +2 -0
- package/build/es/components/input-panel/CheckboxPanel.js.map +1 -0
- package/build/es/components/{radio-panel → input-panel}/RadioPanel.d.ts +2 -4
- package/build/es/components/input-panel/RadioPanel.js +2 -0
- package/build/es/components/input-panel/RadioPanel.js.map +1 -0
- package/build/es/components/input-panel/RadioPanelGroup.d.ts +4 -0
- package/build/es/components/input-panel/RadioPanelGroup.js +2 -0
- package/build/es/components/input-panel/RadioPanelGroup.js.map +1 -0
- package/build/es/components/input-panel/documentation/checkbox-panel/ControlledExample.d.ts +4 -0
- package/build/es/components/input-panel/documentation/checkbox-panel/UncontrolledExample.d.ts +4 -0
- package/build/es/components/input-panel/documentation/radio-panel/ControlledExample.d.ts +4 -0
- package/build/es/components/input-panel/documentation/radio-panel/UncontrolledExample.d.ts +4 -0
- package/build/es/components/input-panel/index.d.ts +3 -0
- package/build/es/components/input-panel/index.js +2 -0
- package/build/es/components/input-panel/radioPanelContext.d.ts +7 -0
- package/build/es/components/input-panel/radioPanelContext.js +2 -0
- package/build/es/components/input-panel/radioPanelContext.js.map +1 -0
- package/build/es/components/link-list/LinkList.d.ts +2 -11
- package/build/es/components/link-list/LinkList.js.map +1 -1
- package/build/es/components/link-list/index.d.ts +1 -0
- package/build/es/components/link-list/types.d.ts +11 -0
- package/build/es/components/link-list/types.js +2 -0
- package/build/es/components/link-list/types.js.map +1 -0
- package/build/es/components/list/index.d.ts +2 -3
- package/build/es/components/loader/index.d.ts +9 -18
- package/build/es/components/logo/index.d.ts +2 -4
- package/build/es/components/modal/Modal.d.ts +8 -2
- package/build/es/components/modal/Modal.js.map +1 -1
- package/build/es/components/modal/index.d.ts +2 -4
- package/build/es/components/pagination/Pagination.d.ts +2 -1
- package/build/es/components/pagination/Pagination.js.map +1 -1
- package/build/es/components/pagination/index.d.ts +1 -1
- package/build/es/components/popover/Popover.d.ts +6 -6
- package/build/es/components/popover/Popover.js.map +1 -1
- package/build/es/components/popover/index.d.ts +1 -1
- package/build/es/components/progress-bar/index.d.ts +2 -4
- package/build/es/components/radio-button/index.d.ts +3 -6
- package/build/es/components/select/Select.d.ts +5 -6
- package/build/es/components/select/Select.js +1 -1
- package/build/es/components/select/Select.js.map +1 -1
- package/build/es/components/select/index.d.ts +2 -4
- package/build/es/components/summary-table/SummaryTable.d.ts +2 -2
- package/build/es/components/summary-table/SummaryTable.js.map +1 -1
- package/build/es/components/summary-table/index.d.ts +2 -2
- package/build/es/components/system-message/SystemMessage.d.ts +5 -6
- package/build/es/components/system-message/SystemMessage.js.map +1 -1
- package/build/es/components/system-message/index.d.ts +1 -1
- package/build/es/components/tabs/index.d.ts +6 -6
- package/build/es/components/tag/index.d.ts +1 -3
- package/build/es/components/text-input/BaseTextArea.d.ts +1 -2
- package/build/es/components/text-input/BaseTextArea.js.map +1 -1
- package/build/es/components/text-input/index.d.ts +2 -2
- package/build/es/components/toast/index.d.ts +1 -1
- package/build/es/components/toast/toastContext.d.ts +1 -13
- package/build/es/components/toast/toastContext.js.map +1 -1
- package/build/es/components/toast/types.d.ts +11 -0
- package/build/es/components/toggle-switch/ToggleSlider.d.ts +2 -3
- package/build/es/components/toggle-switch/ToggleSlider.js.map +1 -1
- package/build/es/components/toggle-switch/ToggleSwitch.d.ts +1 -1
- package/build/es/components/toggle-switch/ToggleSwitch.js.map +1 -1
- package/build/es/components/toggle-switch/index.d.ts +2 -2
- package/build/es/components/tooltip/Tooltip.d.ts +1 -1
- package/build/es/components/tooltip/Tooltip.js +1 -1
- package/build/es/components/tooltip/Tooltip.js.map +1 -1
- package/build/es/core/tokens.d.ts +5 -1
- package/build/es/core/tokens.js +1 -1
- package/build/es/core/tokens.js.map +1 -1
- package/build/es/index.js +1 -1
- package/package.json +12 -2
- package/styles/components/accordion/accordion.css +1 -1
- package/styles/components/breadcrumb/breadcrumb.css +1 -1
- package/styles/components/button/button.css +3 -3
- package/styles/components/button/button.min.css +1 -1
- package/styles/components/card/card.css +1 -1
- package/styles/components/checkbox/checkbox.css +5 -5
- package/styles/components/checkbox/checkbox.min.css +1 -1
- package/styles/components/combobox/combobox.css +1 -1
- package/styles/components/cookie-consent/cookie-consent.css +1 -1
- package/styles/components/datepicker/datepicker.css +1 -1
- package/styles/components/description-list/description-list.css +1 -1
- package/styles/components/expander/expander.css +1 -1
- package/styles/components/feedback/feedback.css +3 -3
- package/styles/components/feedback/feedback.min.css +1 -1
- package/styles/components/file-input/file-input.css +1 -1
- package/styles/components/icon/icon.css +1 -1
- package/styles/components/icon-button/icon-button.css +1 -1
- package/styles/components/image/image.css +1 -1
- package/styles/components/input-group/input-group.css +3 -3
- package/styles/components/input-group/input-group.min.css +1 -1
- package/styles/components/input-panel/_index.scss +2 -0
- package/styles/components/input-panel/checkbox-panel.css +132 -0
- package/styles/components/input-panel/checkbox-panel.min.css +1 -0
- package/styles/components/input-panel/checkbox-panel.scss +88 -0
- package/styles/components/{radio-panel → input-panel}/radio-panel.css +68 -57
- package/styles/components/input-panel/radio-panel.min.css +1 -0
- package/styles/components/input-panel/radio-panel.scss +79 -0
- package/styles/components/input-panel/shared.css +61 -0
- package/styles/components/input-panel/shared.min.css +1 -0
- package/styles/components/input-panel/shared.scss +75 -0
- package/styles/components/link/link.css +1 -1
- package/styles/components/link-list/link-list.css +1 -1
- package/styles/components/list/list.css +1 -1
- package/styles/components/loader/loader.css +7 -7
- package/styles/components/loader/loader.min.css +1 -1
- package/styles/components/loader/skeleton-loader.css +6 -6
- package/styles/components/loader/skeleton-loader.min.css +1 -1
- package/styles/components/logo/logo.css +1 -1
- package/styles/components/menu/menu.css +1 -1
- package/styles/components/message/message.css +3 -3
- package/styles/components/message/message.min.css +1 -1
- package/styles/components/modal/modal.css +1 -1
- package/styles/components/pagination/pagination.css +1 -1
- package/styles/components/popover/popover.css +1 -1
- package/styles/components/progress-bar/progress-bar.css +3 -3
- package/styles/components/progress-bar/progress-bar.min.css +1 -1
- package/styles/components/radio-button/radio-button.css +3 -3
- package/styles/components/radio-button/radio-button.min.css +1 -1
- package/styles/components/select/select.css +55 -145
- package/styles/components/select/select.min.css +1 -1
- package/styles/components/select/select.scss +62 -119
- package/styles/components/summary-table/summary-table.css +1 -1
- package/styles/components/system-message/system-message.css +3 -3
- package/styles/components/system-message/system-message.min.css +1 -1
- package/styles/components/table/table.css +1 -1
- package/styles/components/tabs/tabs.css +1 -1
- package/styles/components/tag/tag.css +1 -1
- package/styles/components/text-input/text-input.css +3 -3
- package/styles/components/text-input/text-input.min.css +1 -1
- package/styles/components/text-input/text-input.scss +1 -1
- package/styles/components/toast/toast.css +5 -5
- package/styles/components/toast/toast.min.css +1 -1
- package/styles/components/toggle-switch/toggle-switch.css +1 -1
- package/styles/components/tooltip/tooltip.css +1 -1
- package/styles/core/_color-tokens.scss +3 -1
- package/styles/core/_legacy-tokens.scss +1 -1
- package/styles/core/_tokens.scss +1 -1
- package/styles/core/core.css +8 -4
- package/styles/core/core.min.css +1 -1
- package/styles/core/jkl/_legacy-tokens.scss +1 -1
- package/styles/core/jkl/_tokens.scss +2 -1
- package/styles/styles.css +278 -286
- package/styles/styles.min.css +1 -1
- package/styles/styles.scss +1 -1
- package/styles/vind/vind.css +1 -1
- package/build/cjs/components/radio-panel/RadioPanel.cjs +0 -2
- package/build/cjs/components/radio-panel/RadioPanel.cjs.map +0 -1
- package/build/cjs/components/radio-panel/index.cjs +0 -2
- package/build/cjs/components/radio-panel/index.d.cts +0 -1
- package/build/es/components/radio-panel/RadioPanel.js +0 -2
- package/build/es/components/radio-panel/RadioPanel.js.map +0 -1
- package/build/es/components/radio-panel/index.d.ts +0 -1
- package/build/es/components/radio-panel/index.js +0 -2
- package/styles/components/radio-panel/_index.scss +0 -1
- package/styles/components/radio-panel/radio-panel.min.css +0 -1
- package/styles/components/radio-panel/radio-panel.scss +0 -140
- /package/build/cjs/components/{radio-panel → input-panel}/index.cjs.map +0 -0
- /package/build/es/components/{radio-panel → input-panel}/index.js.map +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { Density, WithChildren } from '../../core/types.js';
|
|
3
|
-
export type ExpandDirection = "up" | "down";
|
|
4
3
|
export interface ExpanderProps extends WithChildren {
|
|
5
4
|
as?: "summary" | "button";
|
|
6
5
|
/** Må settes dersom du ikke bruker CoreToggle. Verdien skal være IDen til innholdet du ekspanderer. */
|
|
@@ -16,7 +15,7 @@ export interface ExpanderProps extends WithChildren {
|
|
|
16
15
|
*/
|
|
17
16
|
isExpanded?: boolean;
|
|
18
17
|
/** @default "down" */
|
|
19
|
-
expandDirection?:
|
|
18
|
+
expandDirection?: "up" | "down";
|
|
20
19
|
density?: Density;
|
|
21
20
|
/**
|
|
22
21
|
* Skjul knappeteksten visuelt.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Expander.js","sources":["../../../../src/components/expander/Expander.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { ForwardedRef } from \"react\";\nimport { Density, WithChildren } from \"../../core/types.js\";\nimport { ArrowVerticalAnimated } from \"../icon/icons/animated/ArrowVerticalAnimated.js\";\nimport { ScreenReaderOnly } from \"../ScreenReaderOnly.js\";\n\nexport
|
|
1
|
+
{"version":3,"file":"Expander.js","sources":["../../../../src/components/expander/Expander.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, { ForwardedRef } from \"react\";\nimport { Density, WithChildren } from \"../../core/types.js\";\nimport { ArrowVerticalAnimated } from \"../icon/icons/animated/ArrowVerticalAnimated.js\";\nimport { ScreenReaderOnly } from \"../ScreenReaderOnly.js\";\n\nexport interface ExpanderProps extends WithChildren {\n as?: \"summary\" | \"button\";\n /** Må settes dersom du ikke bruker CoreToggle. Verdien skal være IDen til innholdet du ekspanderer. */\n \"aria-controls\"?: string;\n /** Må settes dersom du ikke bruker CoreToggle. IDen her skal brukes som verdien til aria-labelledby på innholdet du ekspanderer. */\n id?: string;\n className?: string;\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n onKeyDown?: React.KeyboardEventHandler<HTMLButtonElement>;\n /**\n * Styrer retningen til pila, som animeres ved endring. Styrer også aria-expanded.\n * @default false\n */\n isExpanded?: boolean;\n /** @default \"down\" */\n expandDirection?: \"up\" | \"down\";\n density?: Density;\n /**\n * Skjul knappeteksten visuelt.\n *\n * @default false\n */\n hideLabel?: boolean;\n}\n\nexport const Expander = React.forwardRef(\n (\n {\n as = \"button\",\n className,\n children,\n density,\n expandDirection = \"down\",\n isExpanded = false,\n hideLabel = false,\n ...rest\n }: ExpanderProps,\n ref: ForwardedRef<HTMLButtonElement>,\n ): JSX.Element => {\n const ContentWrapper = hideLabel ? ScreenReaderOnly : React.Fragment;\n const pointingDown =\n expandDirection === \"down\" ? !isExpanded : isExpanded;\n\n const El = as;\n const type = El === \"button\" ? \"button\" : undefined;\n\n return (\n <El\n aria-expanded={isExpanded}\n data-testid=\"jkl-expander\"\n type={type}\n className={clsx(\"jkl-expander\", className, {\n \"jkl-expander--expanded\": isExpanded,\n \"jkl-expander--icon-only\": !children,\n })}\n {...rest}\n data-density={density}\n ref={ref}\n >\n {children && (\n <ContentWrapper>\n <span className=\"jkl-expander__text\">{children}</span>\n </ContentWrapper>\n )}\n <ArrowVerticalAnimated\n className=\"jkl-expander__arrow\"\n pointingDown={pointingDown}\n bold={isExpanded}\n />\n </El>\n );\n },\n);\n\nExpander.displayName = \"Expander\";\n"],"names":["Expander","React","forwardRef","as","className","children","density","expandDirection","isExpanded","hideLabel","rest","ref","ContentWrapper","ScreenReaderOnly","Fragment","pointingDown","jsxs","type","clsx","jsx","ArrowVerticalAnimated","bold","displayName"],"mappings":"uQA+BO,MAAMA,EAAWC,EAAMC,YAC1B,EAEQC,GAAAA,EAAK,SACLC,UAAAA,EACAC,SAAAA,EACAC,QAAAA,EACAC,gBAAAA,EAAkB,OAClBC,WAAAA,GAAa,EACbC,UAAAA,GAAY,KACTC,GAEPC,KAEMC,MAAAA,EAAiBH,EAAYI,EAAmBZ,EAAMa,SACtDC,EACkB,SAApBR,GAA8BC,EAAaA,EAM3C,OAAAQ,EAJOb,EAIN,CACG,gBAAeK,EACf,cAAY,eACZS,KANY,WADTd,EACoB,cAAW,EAOlCC,UAAWc,EAAK,eAAgBd,EAAW,CACvC,yBAA0BI,EAC1B,2BAA4BH,OAE5BK,EACJ,eAAcJ,EACdK,IAAAA,EAECN,SAAA,CAAAA,KACIO,EACG,CAAAP,SAAAc,EAAC,QAAKf,UAAU,qBAAsBC,SAAAA,MAG9Cc,EAACC,EAAA,CACGhB,UAAU,sBACVW,aAAAA,EACAM,KAAMb,MACV,IAMhBR,EAASsB,YAAc"}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export {
|
|
3
|
-
export type { ExpandSectionProps } from './ExpandSection.js';
|
|
4
|
-
export { ExpandSection } from './ExpandSection.js';
|
|
1
|
+
export { Expander, type ExpanderProps } from './Expander.js';
|
|
2
|
+
export { ExpandSection, type ExpandSectionProps } from './ExpandSection.js';
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { BaseTextAreaProps } from '../text-input/BaseTextArea.js';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import { FeedbackOption, FeedbackType } from './types.js';
|
|
6
|
-
type FollowupProps = ComponentProps<typeof Followup>;
|
|
7
|
-
type ContactQuestionProps = ComponentProps<typeof ContactQuestion>;
|
|
8
|
-
type Props = {
|
|
3
|
+
import { ContactQuestionProps, FeedbackOption, FeedbackType, FollowupProps } from './types.js';
|
|
4
|
+
export type FeedbackProps = {
|
|
9
5
|
className?: string;
|
|
10
6
|
/** Velg typen alternativer, Smiley eller RadioButtons. */
|
|
11
7
|
type: "radio" | "smiley";
|
|
@@ -46,5 +42,4 @@ type Props = {
|
|
|
46
42
|
*/
|
|
47
43
|
landmarkLabel?: string;
|
|
48
44
|
} & Pick<BaseTextAreaProps, "counter">;
|
|
49
|
-
export declare const Feedback: ({ className, followup, contactQuestion, counter, landmarkLabel, ...mainQuestionProps }:
|
|
50
|
-
export {};
|
|
45
|
+
export declare const Feedback: ({ className, followup, contactQuestion, counter, landmarkLabel, ...mainQuestionProps }: FeedbackProps) => ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Feedback.js","sources":["../../../../src/components/feedback/Feedback.tsx"],"sourcesContent":["import React, {
|
|
1
|
+
{"version":3,"file":"Feedback.js","sources":["../../../../src/components/feedback/Feedback.tsx"],"sourcesContent":["import React, { ReactElement, ReactNode, useState } from \"react\";\nimport { BaseTextAreaProps } from \"../text-input/BaseTextArea.js\";\nimport { FeedbackContextProvider } from \"./feedbackContext.js\";\nimport { Followup } from \"./followup/Followup.js\";\nimport { MainQuestion } from \"./main-question/MainQuestion.js\";\nimport { ContactQuestion } from \"./questions/ContactQuestion.js\";\nimport {\n ContactQuestionProps,\n FeedbackOption,\n FeedbackType,\n FollowupProps,\n} from \"./types.js\";\n\nexport type FeedbackProps = {\n className?: string;\n /** Velg typen alternativer, Smiley eller RadioButtons. */\n type: \"radio\" | \"smiley\";\n /** Spørsmålet som stilles til brukeren */\n label: string;\n /** Hjelpetekst til hovedspørsmålet */\n helpLabel?: string;\n /** Svaralternativer til spørsmålet */\n options: FeedbackOption[];\n /** Dersom du vil stille et åpent spørsmål i tillegg kan du sette denne til en truthy verdi */\n addOnQuestion?:\n | {\n /** Spørsmålet du vil stille */\n label?: string;\n /** Eventuell hjelpetekst. Om du ikke spesifiserer en vil det vises en påminnelse om å ikke skrive inn personling informasjon. */\n helpLabel?: string;\n }\n | boolean;\n /** Lar deg tilpasse meldingen som kommer når brukeren sender inn tilbakemeldingen. */\n successMessage?: {\n title: string;\n children: ReactNode;\n };\n /**\n * Funksjon for å håndtere innsending av tilbakemelding\n * @param value Verdien av tilbakemeldingen. Dette er et objekt med følgende egenskaper:\n * - `feedbackValue`: Selve verdien av tilbakemeldingen (format varierer etter spørsmålstype)\n * - `intentionalSubmit`: Er `true` hvis brukeren aktivt sendte inn skjemaet, `false` hvis skjemaet ble sendt inn automatisk\n * - `message`: Eventuell utfyllende melding fra bruker. Blir kun sendt inn ved aktiv innsending\n */\n onSubmit: (value: FeedbackType) => void;\n followup?: FollowupProps;\n contactQuestion?: ContactQuestionProps;\n /**\n * Hvis du ønsker at Feedback formen skal eksponeres som et landmark kan du sende inn\n * hva du ønsker at en skjermleser skal kalle den her. Bare eksponer Feedback som et\n * landmark på sider der den er en viktig del av innholdet, feks en kvitteringsside\n * eller et annet sted det å kunne gi tilbakemelding vil føles naturlig eller forventet\n * for brukeren.\n */\n landmarkLabel?: string;\n} & Pick<BaseTextAreaProps, \"counter\">;\n\nexport const Feedback = ({\n className,\n followup,\n contactQuestion,\n counter,\n landmarkLabel,\n ...mainQuestionProps\n}: FeedbackProps): ReactElement => {\n const [feedbackSubmitted, setFeedbackSubmitted] = useState(false);\n const [followupStarted, setFollowupStarted] = useState(false);\n const [followupSubmitted, setFollowupSubmitted] = useState(false);\n const [contactSubmitted, setContactSubmitted] = useState(false);\n\n return (\n <div\n className={`jkl-feedback ${className || \"\"}`}\n data-testid=\"feedback\"\n >\n <FeedbackContextProvider\n value={{\n feedbackSubmitted,\n followupStarted,\n followupSubmitted,\n contactSubmitted,\n counter,\n landmarkLabel,\n setFeedbackSubmitted,\n setFollowupStarted,\n setFollowupSubmitted,\n setContactSubmitted,\n }}\n >\n {!followupStarted && <MainQuestion {...mainQuestionProps} />}\n {feedbackSubmitted && !contactSubmitted && followup && (\n <Followup {...followup} />\n )}\n {contactQuestion && (\n <div aria-live=\"polite\">\n {/* Show contact question after followup, or after feedback if no followup */}\n {((!followup && feedbackSubmitted) ||\n followupSubmitted) && (\n <ContactQuestion {...contactQuestion} />\n )}\n </div>\n )}\n </FeedbackContextProvider>\n </div>\n );\n};\n"],"names":["Feedback","className","followup","contactQuestion","counter","landmarkLabel","mainQuestionProps","feedbackSubmitted","setFeedbackSubmitted","useState","followupStarted","setFollowupStarted","followupSubmitted","setFollowupSubmitted","contactSubmitted","setContactSubmitted","jsx","children","jsxs","FeedbackContextProvider","value","MainQuestion","Followup","ContactQuestion"],"mappings":"oUAyDO,MAAMA,EAAW,EACpBC,UAAAA,EACAC,SAAAA,EACAC,gBAAAA,EACAC,QAAAA,EACAC,cAAAA,KACGC,MAEG,MAACC,EAAmBC,GAAwBC,GAAS,IACpDC,EAAiBC,GAAsBF,GAAS,IAChDG,EAAmBC,GAAwBJ,GAAS,IACpDK,EAAkBC,GAAuBN,GAAS,GAGrD,OAAAO,EAAC,MAAA,CACGf,UAAW,gBAAgBA,GAAa,KACxC,cAAY,WAEZgB,SAAAC,EAACC,EAAA,CACGC,MAAO,CACHb,kBAAAA,EACAG,gBAAAA,EACAE,kBAAAA,EACAE,iBAAAA,EACAV,QAAAA,EACAC,cAAAA,EACAG,qBAAAA,EACAG,mBAAAA,EACAE,qBAAAA,EACAE,oBAAAA,GAGHE,SAAA,EAACP,GAAmBM,EAACK,EAAc,IAAGf,IACtCC,IAAsBO,GAAoBZ,GACtCc,EAAAM,EAAA,IAAapB,IAEjBC,GACGa,EAAC,MAAI,CAAA,YAAU,SAERC,WAACf,GAAYK,GACZK,IACAI,EAACO,EAAiB,IAAGpB,UAIrC"}
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
import { FC
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/** Spørsmålet/ene som skal stilles. Kan være av typen radio, checkbox eller text */
|
|
5
|
-
questions: FollowupQuestion[];
|
|
6
|
-
/** Lar deg tilpasse meldingen som kommer når brukeren har svart på spørsmålene. */
|
|
7
|
-
successMessage?: {
|
|
8
|
-
title: string;
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
};
|
|
11
|
-
onSubmit: (values: FeedbackAnswer[]) => void;
|
|
12
|
-
}
|
|
13
|
-
export declare const Followup: FC<Props>;
|
|
14
|
-
export {};
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FollowupProps } from '../types.js';
|
|
3
|
+
export declare const Followup: FC<FollowupProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Followup.js","sources":["../../../../../src/components/feedback/followup/Followup.tsx"],"sourcesContent":["import React, { FC,
|
|
1
|
+
{"version":3,"file":"Followup.js","sources":["../../../../../src/components/feedback/followup/Followup.tsx"],"sourcesContent":["import React, { FC, useEffect, useRef, useState } from \"react\";\nimport {\n PrimaryButton,\n SecondaryButton,\n TertiaryButton,\n} from \"../../button/Button.js\";\nimport { useFeedbackContext } from \"../feedbackContext.js\";\nimport { FeedbackSuccess } from \"../FeedbackSuccess.js\";\nimport { FollowupProps } from \"../types.js\";\nimport { getQuestionFromType } from \"../utils.js\";\nimport { FollowUpProvider } from \"./followupContext.js\";\nimport { useFollowup } from \"./useFollowup.js\";\n\nconst defaultSuccessMessage = {\n title: \"Takk, igjen!\",\n children:\n \"Vi setter pris på at du tok deg tid til å svare på flere spørsmål. Det hjelper oss med å gjøre nettsidene bedre for deg og alle andre som bruker dem.\",\n};\n\nexport const Followup: FC<FollowupProps> = ({\n questions,\n successMessage = defaultSuccessMessage,\n onSubmit,\n}) => {\n const [noThanks, setNoThanks] = useState(false);\n const focusRef = useRef<HTMLParagraphElement>(null);\n const followupState = useFollowup(questions, onSubmit);\n const { handleAbort, handleNext, step, submitted } = followupState;\n const {\n followupStarted,\n setFollowupStarted,\n setFollowupSubmitted,\n contactSubmitted,\n landmarkLabel,\n } = useFeedbackContext();\n\n useEffect(() => {\n if (step.number === 0) {\n return;\n }\n focusRef.current && focusRef.current.focus();\n }, [step]);\n\n useEffect(() => {\n setFollowupSubmitted(submitted);\n }, [submitted, setFollowupSubmitted]);\n\n const QuestionComponent = getQuestionFromType(questions[step.number].type);\n const Button = step.isLast ? PrimaryButton : SecondaryButton;\n\n if (noThanks) {\n return null;\n }\n\n return (\n <div aria-live=\"polite\">\n <FollowUpProvider state={followupState}>\n {!followupStarted && (\n <div className=\"jkl-feedback__fade-in\">\n <p className=\"jkl-heading-4 jkl-spacing-xl--top jkl-spacing-xs--bottom\">\n Har du tid til å svare på noen flere spørsmål?\n </p>\n <p className=\"jkl-body jkl-spacing-xl--bottom\">\n Det tar kun et minutt, og hjelper oss å lage bedre\n løsninger for deg.\n </p>\n <PrimaryButton\n onClick={() => setFollowupStarted(true)}\n className=\"jkl-spacing-xl--right\"\n >\n Jeg har tid!\n </PrimaryButton>\n <TertiaryButton onClick={() => setNoThanks(true)}>\n Nei takk\n </TertiaryButton>\n </div>\n )}\n {!submitted && followupStarted && (\n <form\n onSubmit={handleNext}\n className=\"jkl-feedback__fade-in\"\n aria-label={landmarkLabel}\n >\n <p\n className=\"jkl-feedback__step-counter\"\n ref={focusRef}\n >\n Steg {step.number + 1} av {questions.length}\n </p>\n <QuestionComponent\n {...questions[step.number]}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus\n key={step.number}\n />\n <div className=\"jkl-spacing-xl--top\" aria-live=\"off\">\n <Button type=\"submit\">\n {step.isLast ? \"Send inn\" : \"Neste\"}\n </Button>\n <TertiaryButton\n onClick={handleAbort}\n className=\"jkl-spacing-xl--left\"\n >\n Avbryt\n </TertiaryButton>\n </div>\n </form>\n )}\n {submitted && !contactSubmitted && (\n <FeedbackSuccess {...successMessage} />\n )}\n </FollowUpProvider>\n </div>\n );\n};\n"],"names":["defaultSuccessMessage","title","children","Followup","questions","successMessage","onSubmit","noThanks","setNoThanks","useState","focusRef","useRef","followupState","useFollowup","handleAbort","handleNext","step","submitted","followupStarted","setFollowupStarted","setFollowupSubmitted","contactSubmitted","landmarkLabel","useFeedbackContext","useEffect","number","current","focus","QuestionComponent","getQuestionFromType","type","Button","isLast","PrimaryButton","SecondaryButton","jsxs","FollowUpProvider","state","className","jsx","onClick","TertiaryButton","ref","length","createElement","autoFocus","key","FeedbackSuccess"],"mappings":"6eAaA,MAAMA,EAAwB,CAC1BC,MAAO,eACPC,SACI,yJAGKC,EAA8B,EACvCC,UAAAA,EACAC,eAAAA,EAAiBL,EACjBM,SAAAA,MAEM,MAACC,EAAUC,GAAeC,GAAS,GACnCC,EAAWC,EAA6B,MACxCC,EAAgBC,EAAYT,EAAWE,IACrCQ,YAAAA,EAAaC,WAAAA,EAAYC,KAAAA,EAAMC,UAAAA,GAAcL,GAEjDM,gBAAAA,EACAC,mBAAAA,EACAC,qBAAAA,EACAC,iBAAAA,EACAC,cAAAA,GACAC,IAEJC,GAAU,KACc,IAAhBR,EAAKS,QAGAf,EAAAgB,SAAWhB,EAASgB,QAAQC,OAAM,GAC5C,CAACX,IAEJQ,GAAU,KACNJ,EAAqBH,EAAS,GAC/B,CAACA,EAAWG,IAETQ,MAAAA,EAAoBC,EAAoBzB,EAAUY,EAAKS,QAAQK,MAC/DC,EAASf,EAAKgB,OAASC,EAAgBC,EAE7C,OAAI3B,EACO,OAIN,MAAI,CAAA,YAAU,SACXL,SAACiC,EAAAC,EAAA,CAAiBC,MAAOzB,EACpBV,SAAA,EAACgB,GACEiB,EAAC,MAAI,CAAAG,UAAU,wBACXpC,SAAA,CAACqC,EAAA,IAAA,CAAED,UAAU,2DAA2DpC,SAExE,mDACCqC,EAAA,IAAA,CAAED,UAAU,kCAAkCpC,SAG/C,0EACAqC,EAACN,EAAA,CACGO,QAAS,IAAMrB,GAAmB,GAClCmB,UAAU,wBACbpC,SAAA,mBAGAuC,EAAe,CAAAD,QAAS,IAAMhC,GAAY,GAAON,SAElD,iBAGNe,GAAaC,GACXiB,EAAC,OAAA,CACG7B,SAAUS,EACVuB,UAAU,wBACV,aAAYhB,EAEZpB,SAAA,CAAAiC,EAAC,IAAA,CACGG,UAAU,6BACVI,IAAKhC,EACRR,SAAA,CAAA,QACSc,EAAKS,OAAS,EAAE,OAAKrB,EAAUuC,UAEzCC,EAAChB,EAAA,IACOxB,EAAUY,EAAKS,QAEnBoB,WAAS,EACTC,IAAK9B,EAAKS,SAEbU,EAAA,MAAA,CAAIG,UAAU,sBAAsB,YAAU,MAC3CpC,SAAA,CAAAqC,EAACR,GAAOD,KAAK,SACR5B,SAAKc,EAAAgB,OAAS,WAAa,UAEhCO,EAACE,EAAA,CACGD,QAAS1B,EACTwB,UAAU,uBACbpC,SAAA,iBAMZe,IAAcI,GACVkB,EAAAQ,EAAA,IAAoB1C,QAGjC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export {
|
|
1
|
+
export { Feedback, type FeedbackProps } from './Feedback.js';
|
|
2
|
+
export { PRESETS, type PresetProperties } from './presets.js';
|
|
3
|
+
export { type FeedbackOption, type FeedbackType, type FollowupProps, type FollowupQuestion, type MainQuestion, type RadioQuestion, type SmileyQuestion, type CheckboxQuestion, type TextQuestion, type ContactQuestionProps, type FeedbackAnswer, type SingleFeedbackAnswer, type MultiFeedbackAnswer, } from './types.js';
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type FeedbackProps = ComponentProps<typeof Feedback>;
|
|
4
|
-
type PresetProperties = Pick<FeedbackProps, "label" | "type" | "options" | "addOnQuestion">;
|
|
1
|
+
import { FeedbackProps } from './Feedback.js';
|
|
2
|
+
export type PresetProperties = Pick<FeedbackProps, "label" | "type" | "options" | "addOnQuestion">;
|
|
5
3
|
export declare const PRESETS: Record<string, PresetProperties>;
|
|
6
|
-
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.js","sources":["../../../../src/components/feedback/presets.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"presets.js","sources":["../../../../src/components/feedback/presets.tsx"],"sourcesContent":["import { 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":"4DAQA,MAAMA,EAAmC,CACrCC,KAAM,SACNC,MAAO,0CACPC,QAASC,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,28 +1,3 @@
|
|
|
1
|
-
import { FC
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Lar deg tilpasse spørsmålsteksten.
|
|
5
|
-
* @default "Kan vi kontakte deg for flere innspill?"
|
|
6
|
-
* */
|
|
7
|
-
label?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Lar deg tilpasse teksten på knappen for innsending.
|
|
10
|
-
* @default "Sett meg på lista!"
|
|
11
|
-
* */
|
|
12
|
-
sendButtonLabel?: string;
|
|
13
|
-
/** Sett til true om du også vil spørre om brukjerens telefonnummer i tillegg til epost */
|
|
14
|
-
withPhone?: boolean;
|
|
15
|
-
/** Her kan du legge inn eventuelt annet innhold du vil ha med. Kommer mellom overskriften og feltene for utfylling */
|
|
16
|
-
children?: ReactNode;
|
|
17
|
-
onSubmit: (values: {
|
|
18
|
-
email: string;
|
|
19
|
-
phone?: string;
|
|
20
|
-
}) => void;
|
|
21
|
-
/** Lar deg tilpasse meldingen som kommer når brukeren sender inn skjemaet. */
|
|
22
|
-
successMessage?: {
|
|
23
|
-
title: string;
|
|
24
|
-
children: ReactNode;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
export declare const ContactQuestion: FC<Props>;
|
|
28
|
-
export {};
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ContactQuestionProps } from '../types.js';
|
|
3
|
+
export declare const ContactQuestion: FC<ContactQuestionProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactQuestion.js","sources":["../../../../../src/components/feedback/questions/ContactQuestion.tsx"],"sourcesContent":["import React, {
|
|
1
|
+
{"version":3,"file":"ContactQuestion.js","sources":["../../../../../src/components/feedback/questions/ContactQuestion.tsx"],"sourcesContent":["import React, { ChangeEvent, FC, useEffect, useRef, useState } 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 { useFeedbackContext } from \"../feedbackContext.js\";\nimport { FeedbackSuccess } from \"../FeedbackSuccess.js\";\nimport { 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 = (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]);\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-xl--top\"\n onSubmit={handleSubmit}\n aria-label={landmarkLabel}\n >\n <p className=\"jkl-heading-4 jkl-spacing-xs--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-l--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-l--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-xl--top\">\n <PrimaryButton type=\"submit\" className=\"jkl-spacing-xl--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","ContactQuestion","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","emailError","isValidEpost","validateEmail","phoneError","isValidTelefonnummer","validatePhone","useEffect","handleChange","consumer","e","target","value","jsx","FeedbackSuccess","jsxs","className","preventDefault","_a","current","focus","_b","TextInput","ref","labelProps","variant","autoComplete","name","onChange","errorLabel","PrimaryButton","type","TertiaryButton","onClick"],"mappings":"kjBASA,MAoBMA,EAAwB,CAC1BC,MAAO,sBACPC,SACI,sLAGKC,EAA4C,EACrDC,MAAAA,EAAQ,0CACRC,gBAAAA,EAAkB,qBAClBC,UAAAA,GAAY,EACZC,SAAAA,EACAC,eAAAA,EAAiBR,EACjBE,SAAAA,MAEA,MAAOO,EAAOC,GAAYC,EAAS,KAC5BC,EAAOC,GAAYF,EAAS,KAC5BG,EAAQC,GAAaJ,EACxB,CAAC,GAECK,EAAWC,EAAyB,MACpCC,EAAWD,EAAyB,OACnCE,EAAgBC,GAAqBT,GAAS,IAE9CU,EAAUC,GAAeX,GAAS,IACjCY,iBAAAA,EAAkBC,oBAAAA,EAAqBC,cAAAA,GAC3CC,IAEEC,EAAsC,iBAAbzB,EAAwB,IAAM,MAEvD0B,EAAW,CAACnB,EAAeG,KACvB,MAAAiB,EAlDQ,CAACpB,GACdA,GAAmB,KAAVA,EAGTqB,EAAarB,QAAd,EACO,oCAHA,uDAgDYsB,CAActB,GAC3BuB,EAzCQ,CAACpB,GACdA,GAAmB,KAAVA,EAGTqB,EAAqBrB,QAAtB,EACO,oCAHA,uDAuCYsB,CAActB,GACjC,OAAAG,EAAU,CAAEN,MAAOoB,EAAYjB,MAAOoB,IAC/B,CAAEH,WAAAA,EAAYG,WAAAA,IAGzBG,GAAU,KACN,GAAIhB,EAAgB,CACV,MAAEU,WAAAA,EAAYG,WAAAA,GAAeJ,EAASnB,EAAOG,IAE9CiB,KAAgBvB,IAAc0B,IAC/BZ,GAAkB,EAE1B,IACD,CAACX,EAAOG,EAAOO,EAAgBb,IAE5B,MAAA8B,EACDC,GACAC,GACGD,EAASC,EAAEC,OAAOC,OAqBtBnB,OAAAA,EACO,KAGPE,EACOkB,EAACC,EAAiB,IAAGlC,IAI5BmC,EAAC,OAAA,CACGC,UAAU,sBACVrC,SA9BsC+B,YAC1CA,EAAEO,iBAEI,MAAEhB,WAAAA,EAAYG,WAAAA,GAAeJ,EAASnB,EAAOG,GACnD,OAAIiB,GACAT,GAAkB,QAClB,OAAA0B,EAAA9B,EAAS+B,UAATD,EAAkBE,UAGlB1C,GAAa0B,GACbZ,GAAkB,QAClB,OAAA6B,EAAA/B,EAAS6B,UAATE,EAAkBD,WAItBzC,EAAS,CAAEE,MAAAA,EAAOG,MAAON,EAAYM,OAAQ,SAC7CY,GAAoB,GAAI,EAepB,aAAYC,EAEZvB,SAAA,CAACuC,EAAA,IAAA,CAAEG,UAAU,uCAAwC1C,SAAME,IAC1DF,GACGuC,EAACd,EAAgB,CAAAiB,UAAU,WACtB1C,SAAAA,IAITuC,EAACS,EAAA,CACGC,IAAKnC,EACL4B,UAAU,qBACVxC,MAAM,SACNgD,WAAY,CAAEC,QAAS,SACvBC,aAAa,QACbC,KAAK,QACLf,MAAO/B,EACP+C,SAAUpB,EAAa1B,GACvB+C,WAAY3C,EAAOL,QAEtBH,GACGmC,EAACS,EAAA,CACGC,IAAKjC,EACL0B,UAAU,qBACVxC,MAAM,gBACNgD,WAAY,CAAEC,QAAS,SACvBC,aAAa,MACbC,KAAK,QACLf,MAAO5B,EACP4C,SAAUpB,EAAavB,GACvB4C,WAAY3C,EAAOF,QAI3B+B,EAAC,MAAI,CAAAC,UAAU,sBACX1C,SAAA,CAAAuC,EAACiB,EAAc,CAAAC,KAAK,SAASf,UAAU,wBAClC1C,SACLG,MACCuD,EAAe,CAAAC,QAAS,IAAMvC,GAAY,GAAOpB,SAElD,kBACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dispatch, FormEvent, FormEventHandler, SetStateAction } from 'react';
|
|
1
|
+
import { Dispatch, FormEvent, FormEventHandler, ReactNode, SetStateAction } from 'react';
|
|
2
2
|
export type FeedbackOption<T = string | number> = {
|
|
3
3
|
/** Teksten som vises ved alternativet */
|
|
4
4
|
label: string;
|
|
@@ -13,19 +13,19 @@ interface BaseQuestion {
|
|
|
13
13
|
helpLabel?: string;
|
|
14
14
|
name?: string;
|
|
15
15
|
}
|
|
16
|
-
interface RadioQuestion extends BaseQuestion {
|
|
16
|
+
export interface RadioQuestion extends BaseQuestion {
|
|
17
17
|
type: "radio";
|
|
18
18
|
options: FeedbackOption[];
|
|
19
19
|
}
|
|
20
|
-
interface CheckboxQuestion extends BaseQuestion {
|
|
20
|
+
export interface CheckboxQuestion extends BaseQuestion {
|
|
21
21
|
type: "checkbox";
|
|
22
22
|
options: FeedbackOption[];
|
|
23
23
|
}
|
|
24
|
-
interface SmileyQuestion extends BaseQuestion {
|
|
24
|
+
export interface SmileyQuestion extends BaseQuestion {
|
|
25
25
|
type: "smiley";
|
|
26
26
|
options: FeedbackOption<number>[];
|
|
27
27
|
}
|
|
28
|
-
interface TextQuestion extends BaseQuestion {
|
|
28
|
+
export interface TextQuestion extends BaseQuestion {
|
|
29
29
|
type: "text";
|
|
30
30
|
}
|
|
31
31
|
export type MainQuestion = RadioQuestion | SmileyQuestion;
|
|
@@ -35,11 +35,11 @@ interface BaseFeedbackAnswer {
|
|
|
35
35
|
name: string;
|
|
36
36
|
type: "radio" | "checkbox" | "text";
|
|
37
37
|
}
|
|
38
|
-
interface MultiFeedbackAnswer extends BaseFeedbackAnswer {
|
|
38
|
+
export interface MultiFeedbackAnswer extends BaseFeedbackAnswer {
|
|
39
39
|
type: "checkbox";
|
|
40
40
|
value: string[];
|
|
41
41
|
}
|
|
42
|
-
interface SingleFeedbackAnswer extends BaseFeedbackAnswer {
|
|
42
|
+
export interface SingleFeedbackAnswer extends BaseFeedbackAnswer {
|
|
43
43
|
type: "radio" | "text";
|
|
44
44
|
value: string;
|
|
45
45
|
}
|
|
@@ -75,6 +75,16 @@ export type FollowupState = {
|
|
|
75
75
|
handleAbort: () => void;
|
|
76
76
|
setCurrentValue: Dispatch<SetStateAction<FeedbackOption | FeedbackOption[] | undefined>>;
|
|
77
77
|
};
|
|
78
|
+
export type FollowupProps = {
|
|
79
|
+
/** Spørsmålet/ene som skal stilles. Kan være av typen radio, checkbox eller text */
|
|
80
|
+
questions: FollowupQuestion[];
|
|
81
|
+
/** Lar deg tilpasse meldingen som kommer når brukeren har svart på spørsmålene. */
|
|
82
|
+
successMessage?: {
|
|
83
|
+
title: string;
|
|
84
|
+
children: ReactNode;
|
|
85
|
+
};
|
|
86
|
+
onSubmit: (values: FeedbackAnswer[]) => void;
|
|
87
|
+
};
|
|
78
88
|
export interface QuestionProps {
|
|
79
89
|
type?: QuestionType;
|
|
80
90
|
label: string;
|
|
@@ -83,4 +93,29 @@ export interface QuestionProps {
|
|
|
83
93
|
options?: FeedbackOption[];
|
|
84
94
|
autoFocus?: boolean;
|
|
85
95
|
}
|
|
96
|
+
export type ContactQuestionProps = {
|
|
97
|
+
/**
|
|
98
|
+
* Lar deg tilpasse spørsmålsteksten.
|
|
99
|
+
* @default "Kan vi kontakte deg for flere innspill?"
|
|
100
|
+
* */
|
|
101
|
+
label?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Lar deg tilpasse teksten på knappen for innsending.
|
|
104
|
+
* @default "Sett meg på lista!"
|
|
105
|
+
* */
|
|
106
|
+
sendButtonLabel?: string;
|
|
107
|
+
/** Sett til true om du også vil spørre om brukjerens telefonnummer i tillegg til epost */
|
|
108
|
+
withPhone?: boolean;
|
|
109
|
+
/** Her kan du legge inn eventuelt annet innhold du vil ha med. Kommer mellom overskriften og feltene for utfylling */
|
|
110
|
+
children?: ReactNode;
|
|
111
|
+
onSubmit: (values: {
|
|
112
|
+
email: string;
|
|
113
|
+
phone?: string;
|
|
114
|
+
}) => void;
|
|
115
|
+
/** Lar deg tilpasse meldingen som kommer når brukeren sender inn skjemaet. */
|
|
116
|
+
successMessage?: {
|
|
117
|
+
title: string;
|
|
118
|
+
children: ReactNode;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
86
121
|
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export type
|
|
2
|
-
export { IconButton } from './IconButton.js';
|
|
1
|
+
export { IconButton, type IconButtonProps } from './IconButton.js';
|
|
@@ -14,6 +14,7 @@ export * from './icon/index.js';
|
|
|
14
14
|
export * from './icon-button/index.js';
|
|
15
15
|
export * from './image/index.js';
|
|
16
16
|
export * from './input-group/index.js';
|
|
17
|
+
export * from './input-panel/index.js';
|
|
17
18
|
export * from './link/index.js';
|
|
18
19
|
export * from './link-list/index.js';
|
|
19
20
|
export * from './list/index.js';
|
|
@@ -26,7 +27,6 @@ export * from './pagination/index.js';
|
|
|
26
27
|
export * from './popover/index.js';
|
|
27
28
|
export * from './progress-bar/index.js';
|
|
28
29
|
export * from './radio-button/index.js';
|
|
29
|
-
export * from './radio-panel/index.js';
|
|
30
30
|
export * from './select/index.js';
|
|
31
31
|
export * from './summary-table/index.js';
|
|
32
32
|
export * from './system-message/index.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Accordion as o}from"./accordion/Accordion.js";import{AccordionItem as a}from"./accordion/AccordionItem.js";import{Breadcrumb as s}from"./breadcrumb/Breadcrumb.js";import{BreadcrumbItem as e}from"./breadcrumb/BreadcrumbItem.js";import{Button as r,PrimaryButton as t,SecondaryButton as n,TertiaryButton as i}from"./button/Button.js";import{Card as m}from"./card/Card.js";import{CardImage as c}from"./card/CardImage.js";import{InfoBlock as l,NavCard as p}from"./card/NavCard.js";import{TaskCard as d}from"./card/TaskCard.js";import{InfoCard as u}from"./card/InfoCard.js";import{Checkbox as b}from"./checkbox/Checkbox.js";import{Combobox as f,getComboboxValuePair as T}from"./combobox/Combobox.js";import{CookieConsent as I}from"./cookie-consent/CookieConsent.js";import{CookieConsentProvider as j,useCookieConsent as g}from"./cookie-consent/CookieConsentContext.js";import{isCorrectFormat as C,isWithinLowerBound as k,isWithinUpperBound as S}from"./datepicker/validation.js";import{dayMonthYearRegex as x,formatInput as h,isBlurTargetOutside as B,parseDateString as L}from"./datepicker/utils.js";import{DatePicker as M}from"./datepicker/DatePicker.js";import{Feedback as v}from"./feedback/Feedback.js";import{PRESETS as w}from"./feedback/presets.js";import{Flex as A}from"./flex/Flex.js";import{DescriptionDetail as R,DescriptionList as P,DescriptionTerm as F}from"./description-list/DescriptionList.js";import{Expander as y}from"./expander/Expander.js";import{ExpandSection as D}from"./expander/ExpandSection.js";import{Icon as E}from"./icon/Icon.js";import{ArrowVerticalAnimated as G}from"./icon/icons/animated/ArrowVerticalAnimated.js";import{ArrowHorizontalAnimated as N}from"./icon/icons/animated/ArrowHorizontalAnimated.js";import{PlusRemoveAnimated as H}from"./icon/icons/animated/PlusRemoveAnimated.js";import{ArrowDownIcon as U}from"./icon/icons/ArrowDownIcon.js";import{ArrowLeftIcon as W}from"./icon/icons/ArrowLeftIcon.js";import{ArrowNorthEastIcon as V}from"./icon/icons/ArrowNorthEastIcon.js";import{ArrowRightIcon as O}from"./icon/icons/ArrowRightIcon.js";import{ArrowUpIcon as z}from"./icon/icons/ArrowUpIcon.js";import{CalendarIcon as Q}from"./icon/icons/CalendarIcon.js";import{CheckIcon as Y}from"./icon/icons/CheckIcon.js";import{ChevronDownIcon as q}from"./icon/icons/ChevronDownIcon.js";import{ChevronLeftIcon as J}from"./icon/icons/ChevronLeftIcon.js";import{ChevronRightIcon as K}from"./icon/icons/ChevronRightIcon.js";import{ChevronUpIcon as X}from"./icon/icons/ChevronUpIcon.js";import{CloseIcon as Z}from"./icon/icons/CloseIcon.js";import{CopyIcon as $}from"./icon/icons/CopyIcon.js";import{DotsIcon as _}from"./icon/icons/DotsIcon.js";import{DragIcon as oo}from"./icon/icons/DragIcon.js";import{ErrorIcon as ao}from"./icon/icons/ErrorIcon.js";import{GreenCheckIcon as so}from"./icon/icons/GreenCheckIcon.js";import{HamburgerIcon as eo}from"./icon/icons/HamburgerIcon.js";import{InfoIcon as ro}from"./icon/icons/InfoIcon.js";import{LinkIcon as to}from"./icon/icons/LinkIcon.js";import{PlusIcon as no}from"./icon/icons/PlusIcon.js";import{QuestionIcon as io}from"./icon/icons/QuestionIcon.js";import{RedCrossIcon as mo}from"./icon/icons/RedCrossIcon.js";import{SearchIcon as co}from"./icon/icons/SearchIcon.js";import{SuccessIcon as lo}from"./icon/icons/SuccessIcon.js";import{WarningIcon as po}from"./icon/icons/WarningIcon.js";import{MinusIcon as uo}from"./icon/icons/MinusIcon.js";import{ThumbDownIcon as bo}from"./icon/icons/ThumbDownIcon.js";import{ThumbUpIcon as fo}from"./icon/icons/ThumbUpIcon.js";import{TrashCanIcon as To}from"./icon/icons/TrashCanIcon.js";import{PenIcon as Io}from"./icon/icons/PenIcon.js";import{IconButton as jo}from"./icon-button/IconButton.js";import{Image as go}from"./image/Image.js";import{FieldGroup as Co}from"./input-group/FieldGroup.js";import{InputGroup as ko}from"./input-group/InputGroup.js";import{Label as So}from"./input-group/Label.js";import{SupportLabel as xo}from"./input-group/SupportLabel.js";import{Link as ho}from"./link/Link.js";import{NavLink as Bo}from"./link/NavLink.js";import{LinkList as Lo}from"./link-list/LinkList.js";import{List as Mo,OrderedList as vo,UnorderedList as wo}from"./list/List.js";import{CheckListItem as Ao,CrossListItem as Ro,ListItem as Po}from"./list/ListItem.js";import{Loader as Fo}from"./loader/Loader.js";import{SkeletonAnimation as yo}from"./loader/skeletons/SkeletonAnimation.js";import{SkeletonButton as Do}from"./loader/skeletons/SkeletonButton.js";import{SkeletonCheckboxGroup as Eo}from"./loader/skeletons/SkeletonCheckboxGroup.js";import{SkeletonElement as Go}from"./loader/skeletons/SkeletonElement.js";import{SkeletonInput as No}from"./loader/skeletons/SkeletonInput.js";import{SkeletonRadioButtonGroup as Ho}from"./loader/skeletons/SkeletonRadioButtonGroup.js";import{SkeletonTable as Uo,SkeletonTableHeader as Wo,SkeletonTableRow as Vo}from"./loader/skeletons/SkeletonTable.js";import{SkeletonTextArea as Oo}from"./loader/skeletons/SkeletonTextArea.js";import{Logo as zo}from"./logo/Logo.js";import{LogoStamp as Qo}from"./logo/LogoStamp.js";import{ForsikringLevertAvFremtind as Yo}from"./logo/text-paths/ForsikringLevertAvFremtind.js";import{FraSB1ogDNB as qo}from"./logo/text-paths/FraSB1ogDNB.js";import{InnovasjonFraFremtind as Jo}from"./logo/text-paths/InnovasjonFraFremtind.js";import{TeknologiFraFremtind as Ko}from"./logo/text-paths/TeknologiFraFremtind.js";import{VartEgetForsikringsselskap as Xo}from"./logo/text-paths/VartEgetForsikringsselskap.js";import{VartForsikringsselskap as Zo}from"./logo/text-paths/VartForsikringsselskap.js";import{Menu as $o}from"./menu/Menu.js";import{MenuItem as _o}from"./menu/MenuItem.js";import{MenuItemCheckbox as oa}from"./menu/MenuItemCheckbox.js";import{MenuDivider as aa}from"./menu/MenuDivider.js";import{ErrorMessage as sa,InfoMessage as ea,SuccessMessage as ra,WarningMessage as ta}from"./message/Message.js";import{FormErrorMessage as na}from"./message/FormErrorMessage.js";import{Modal as ia,ModalActions as ma,ModalBody as ca,ModalCloseButton as la,ModalContainer as pa,ModalHeader as da,ModalOverlay as ua,ModalTitle as ba}from"./modal/Modal.js";import{useModal as fa}from"./modal/useModal.js";import{Pagination as Ta}from"./pagination/Pagination.js";import{Popover as Ia}from"./popover/Popover.js";import{Countdown as ja}from"./progress-bar/Countdown.js";import{ProgressBar as ga}from"./progress-bar/ProgressBar.js";import{RadioButton as Ca}from"./radio-button/RadioButton.js";import{RadioButtonGroup as ka}from"./radio-button/RadioButtonGroup.js";import{BaseRadioButton as Sa}from"./radio-button/BaseRadioButton.js";import{RadioPanel as xa}from"./radio-panel/RadioPanel.js";import{Select as ha}from"./select/Select.js";import{NativeSelect as Ba}from"./select/NativeSelect.js";import{SummaryTable as La}from"./summary-table/SummaryTable.js";import{SummaryTableRow as Ma}from"./summary-table/SummaryTableRow.js";import{ErrorSystemMessage as va,InfoSystemMessage as wa,SuccessSystemMessage as Aa,WarningSystemMessage as Ra}from"./system-message/SystemMessage.js";import{DataTable as Pa}from"./table/DataTable.js";import{Table as Fa}from"./table/Table.js";import{TableBody as ya}from"./table/TableBody.js";import{TableCaption as Da}from"./table/TableCaption.js";import{TableCell as Ea}from"./table/TableCell.js";import{TableColumn as Ga}from"./table/TableColumn.js";import{TableColumnGroup as Na}from"./table/TableColumnGroup.js";import{TableContextProvider as Ha,useTableContext as Ua}from"./table/tableContext.js";import{TableSectionContextProvider as Wa,useTableSectionContext as Va}from"./table/tableSectionContext.js";import{TableFooter as Oa}from"./table/TableFooter.js";import{TableHead as za}from"./table/TableHead.js";import{TableHeader as Qa}from"./table/TableHeader.js";import{TablePagination as Ya}from"./table/TablePagination.js";import{TableRow as qa}from"./table/TableRow.js";import{ExpandableTableRow as Ja}from"./table/ExpandableTableRow.js";import{ExpandableTableRowController as Ka}from"./table/ExpandableTableRowController.js";import{useSortableTableHeader as Xa}from"./table/utils.js";import{NavTab as Za}from"./tabs/NavTab.js";import{NavTabs as $a}from"./tabs/NavTabs.js";import{Tabs as _a}from"./tabs/Tabs.js";import{TabList as os}from"./tabs/TabList.js";import{Tab as as}from"./tabs/Tab.js";import{TabPanel as ss}from"./tabs/TabPanel.js";import{ErrorTag as es,InfoTag as rs,SuccessTag as ts,Tag as ns,WarningTag as is}from"./tag/Tag.js";import{BaseTextArea as ms}from"./text-input/BaseTextArea.js";import{BaseTextInput as cs}from"./text-input/BaseTextInput.js";import{TextArea as ls}from"./text-input/TextArea.js";import{TextInput as ps}from"./text-input/TextInput.js";import{ToastProvider as ds,useToast as us}from"./toast/toastContext.js";import{ToggleSwitch as bs}from"./toggle-switch/ToggleSwitch.js";import{ToggleSlider as fs}from"./toggle-switch/ToggleSlider.js";import{Tooltip as Ts}from"./tooltip/Tooltip.js";import{TooltipContent as Is}from"./tooltip/TooltipContent.js";import{TooltipTrigger as js}from"./tooltip/TooltipTrigger.js";import{PopupTip as gs}from"./tooltip/PopupTip.js";import{ScreenReaderOnly as Cs}from"./ScreenReaderOnly.js";export{o as Accordion,a as AccordionItem,U as ArrowDownIcon,N as ArrowHorizontalAnimated,W as ArrowLeftIcon,V as ArrowNorthEastIcon,O as ArrowRightIcon,z as ArrowUpIcon,G as ArrowVerticalAnimated,Sa as BaseRadioButton,ms as BaseTextArea,cs as BaseTextInput,s as Breadcrumb,e as BreadcrumbItem,r as Button,Q as CalendarIcon,m as Card,c as CardImage,Y as CheckIcon,Ao as CheckListItem,b as Checkbox,q as ChevronDownIcon,J as ChevronLeftIcon,K as ChevronRightIcon,X as ChevronUpIcon,Z as CloseIcon,f as Combobox,I as CookieConsent,j as CookieConsentProvider,$ as CopyIcon,ja as Countdown,Ro as CrossListItem,Pa as DataTable,M as DatePicker,R as DescriptionDetail,P as DescriptionList,F as DescriptionTerm,_ as DotsIcon,oo as DragIcon,ao as ErrorIcon,sa as ErrorMessage,va as ErrorSystemMessage,es as ErrorTag,D as ExpandSection,Ja as ExpandableTableRow,Ka as ExpandableTableRowController,y as Expander,v as Feedback,Co as FieldGroup,A as Flex,na as FormErrorMessage,Yo as ForsikringLevertAvFremtind,qo as FraSB1ogDNB,so as GreenCheckIcon,eo as HamburgerIcon,E as Icon,jo as IconButton,go as Image,l as InfoBlock,u as InfoCard,ro as InfoIcon,ea as InfoMessage,wa as InfoSystemMessage,rs as InfoTag,Jo as InnovasjonFraFremtind,ko as InputGroup,So as Label,ho as Link,to as LinkIcon,Lo as LinkList,Mo as List,Po as ListItem,Fo as Loader,zo as Logo,Qo as LogoStamp,$o as Menu,aa as MenuDivider,_o as MenuItem,oa as MenuItemCheckbox,uo as MinusIcon,ia as Modal,ma as ModalActions,ca as ModalBody,la as ModalCloseButton,pa as ModalContainer,da as ModalHeader,ua as ModalOverlay,ba as ModalTitle,Ba as NativeSelect,p as NavCard,Bo as NavLink,Za as NavTab,$a as NavTabs,vo as OrderedList,w as PRESETS,Ta as Pagination,Io as PenIcon,no as PlusIcon,H as PlusRemoveAnimated,Ia as Popover,gs as PopupTip,t as PrimaryButton,ga as ProgressBar,io as QuestionIcon,Ca as RadioButton,ka as RadioButtonGroup,xa as RadioPanel,mo as RedCrossIcon,Cs as ScreenReaderOnly,co as SearchIcon,n as SecondaryButton,ha as Select,yo as SkeletonAnimation,Do as SkeletonButton,Eo as SkeletonCheckboxGroup,Go as SkeletonElement,No as SkeletonInput,Ho as SkeletonRadioButtonGroup,Uo as SkeletonTable,Wo as SkeletonTableHeader,Vo as SkeletonTableRow,Oo as SkeletonTextArea,lo as SuccessIcon,ra as SuccessMessage,Aa as SuccessSystemMessage,ts as SuccessTag,La as SummaryTable,Ma as SummaryTableRow,xo as SupportLabel,as as Tab,os as TabList,ss as TabPanel,Fa as Table,ya as TableBody,Da as TableCaption,Ea as TableCell,Ga as TableColumn,Na as TableColumnGroup,Ha as TableContextProvider,Oa as TableFooter,za as TableHead,Qa as TableHeader,Ya as TablePagination,qa as TableRow,Wa as TableSectionContextProvider,_a as Tabs,ns as Tag,d as TaskCard,Ko as TeknologiFraFremtind,i as TertiaryButton,ls as TextArea,ps as TextInput,bo as ThumbDownIcon,fo as ThumbUpIcon,ds as ToastProvider,fs as ToggleSlider,bs as ToggleSwitch,Ts as Tooltip,Is as TooltipContent,js as TooltipTrigger,To as TrashCanIcon,wo as UnorderedList,Xo as VartEgetForsikringsselskap,Zo as VartForsikringsselskap,po as WarningIcon,ta as WarningMessage,Ra as WarningSystemMessage,is as WarningTag,x as dayMonthYearRegex,h as formatInput,T as getComboboxValuePair,B as isBlurTargetOutside,C as isCorrectFormat,k as isWithinLowerBound,S as isWithinUpperBound,L as parseDateString,g as useCookieConsent,fa as useModal,Xa as useSortableTableHeader,Ua as useTableContext,Va as useTableSectionContext,us as useToast};
|
|
1
|
+
import{Accordion as o}from"./accordion/Accordion.js";import{AccordionItem as a}from"./accordion/AccordionItem.js";import{Breadcrumb as s}from"./breadcrumb/Breadcrumb.js";import{BreadcrumbItem as e}from"./breadcrumb/BreadcrumbItem.js";import{Button as r,PrimaryButton as t,SecondaryButton as n,TertiaryButton as i}from"./button/Button.js";import{Card as m}from"./card/Card.js";import{CardImage as l}from"./card/CardImage.js";import{InfoBlock as c,NavCard as p}from"./card/NavCard.js";import{TaskCard as d}from"./card/TaskCard.js";import{InfoCard as u}from"./card/InfoCard.js";import{Checkbox as b}from"./checkbox/Checkbox.js";import{Combobox as f,getComboboxValuePair as T}from"./combobox/Combobox.js";import{CookieConsent as I}from"./cookie-consent/CookieConsent.js";import{CookieConsentProvider as j,useCookieConsent as g}from"./cookie-consent/CookieConsentContext.js";import{DatePicker as C}from"./datepicker/DatePicker.js";import{isCorrectFormat as k,isWithinLowerBound as S,isWithinUpperBound as x}from"./datepicker/validation.js";import{formatInput as h,isBlurTargetOutside as B,parseDateString as L}from"./datepicker/utils.js";import{Feedback as v}from"./feedback/Feedback.js";import{PRESETS as M}from"./feedback/presets.js";import{Flex as w}from"./flex/Flex.js";import{DescriptionDetail as A,DescriptionList as P,DescriptionTerm as R}from"./description-list/DescriptionList.js";import{Expander as F}from"./expander/Expander.js";import{ExpandSection as D}from"./expander/ExpandSection.js";import{Icon as y}from"./icon/Icon.js";import{ArrowVerticalAnimated as E}from"./icon/icons/animated/ArrowVerticalAnimated.js";import{ArrowHorizontalAnimated as G}from"./icon/icons/animated/ArrowHorizontalAnimated.js";import{PlusRemoveAnimated as N}from"./icon/icons/animated/PlusRemoveAnimated.js";import{ArrowDownIcon as H}from"./icon/icons/ArrowDownIcon.js";import{ArrowLeftIcon as U}from"./icon/icons/ArrowLeftIcon.js";import{ArrowNorthEastIcon as W}from"./icon/icons/ArrowNorthEastIcon.js";import{ArrowRightIcon as V}from"./icon/icons/ArrowRightIcon.js";import{ArrowUpIcon as O}from"./icon/icons/ArrowUpIcon.js";import{CalendarIcon as z}from"./icon/icons/CalendarIcon.js";import{CheckIcon as Q}from"./icon/icons/CheckIcon.js";import{ChevronDownIcon as q}from"./icon/icons/ChevronDownIcon.js";import{ChevronLeftIcon as J}from"./icon/icons/ChevronLeftIcon.js";import{ChevronRightIcon as K}from"./icon/icons/ChevronRightIcon.js";import{ChevronUpIcon as X}from"./icon/icons/ChevronUpIcon.js";import{CloseIcon as Y}from"./icon/icons/CloseIcon.js";import{CopyIcon as Z}from"./icon/icons/CopyIcon.js";import{DotsIcon as $}from"./icon/icons/DotsIcon.js";import{DragIcon as _}from"./icon/icons/DragIcon.js";import{ErrorIcon as oo}from"./icon/icons/ErrorIcon.js";import{GreenCheckIcon as ao}from"./icon/icons/GreenCheckIcon.js";import{HamburgerIcon as so}from"./icon/icons/HamburgerIcon.js";import{InfoIcon as eo}from"./icon/icons/InfoIcon.js";import{LinkIcon as ro}from"./icon/icons/LinkIcon.js";import{PlusIcon as to}from"./icon/icons/PlusIcon.js";import{QuestionIcon as no}from"./icon/icons/QuestionIcon.js";import{RedCrossIcon as io}from"./icon/icons/RedCrossIcon.js";import{SearchIcon as mo}from"./icon/icons/SearchIcon.js";import{SuccessIcon as lo}from"./icon/icons/SuccessIcon.js";import{WarningIcon as co}from"./icon/icons/WarningIcon.js";import{MinusIcon as po}from"./icon/icons/MinusIcon.js";import{ThumbDownIcon as uo}from"./icon/icons/ThumbDownIcon.js";import{ThumbUpIcon as bo}from"./icon/icons/ThumbUpIcon.js";import{TrashCanIcon as fo}from"./icon/icons/TrashCanIcon.js";import{PenIcon as To}from"./icon/icons/PenIcon.js";import{IconButton as Io}from"./icon-button/IconButton.js";import{Image as jo}from"./image/Image.js";import{FieldGroup as go}from"./input-group/FieldGroup.js";import{InputGroup as Co}from"./input-group/InputGroup.js";import{Label as ko}from"./input-group/Label.js";import{SupportLabel as So}from"./input-group/SupportLabel.js";import{CheckboxPanel as xo}from"./input-panel/CheckboxPanel.js";import{RadioPanel as ho}from"./input-panel/RadioPanel.js";import{RadioPanelGroup as Bo}from"./input-panel/RadioPanelGroup.js";import{Link as Lo}from"./link/Link.js";import{NavLink as vo}from"./link/NavLink.js";import{LinkList as Mo}from"./link-list/LinkList.js";import{List as wo,OrderedList as Ao,UnorderedList as Po}from"./list/List.js";import{CheckListItem as Ro,CrossListItem as Fo,ListItem as Do}from"./list/ListItem.js";import{Loader as yo}from"./loader/Loader.js";import{SkeletonAnimation as Eo}from"./loader/skeletons/SkeletonAnimation.js";import{SkeletonButton as Go}from"./loader/skeletons/SkeletonButton.js";import{SkeletonCheckboxGroup as No}from"./loader/skeletons/SkeletonCheckboxGroup.js";import{SkeletonElement as Ho}from"./loader/skeletons/SkeletonElement.js";import{SkeletonInput as Uo}from"./loader/skeletons/SkeletonInput.js";import{SkeletonRadioButtonGroup as Wo}from"./loader/skeletons/SkeletonRadioButtonGroup.js";import{SkeletonTable as Vo,SkeletonTableHeader as Oo,SkeletonTableRow as zo}from"./loader/skeletons/SkeletonTable.js";import{SkeletonTextArea as Qo}from"./loader/skeletons/SkeletonTextArea.js";import{Logo as qo}from"./logo/Logo.js";import{LogoStamp as Jo}from"./logo/LogoStamp.js";import{ForsikringLevertAvFremtind as Ko}from"./logo/text-paths/ForsikringLevertAvFremtind.js";import{FraSB1ogDNB as Xo}from"./logo/text-paths/FraSB1ogDNB.js";import{InnovasjonFraFremtind as Yo}from"./logo/text-paths/InnovasjonFraFremtind.js";import{TeknologiFraFremtind as Zo}from"./logo/text-paths/TeknologiFraFremtind.js";import{VartEgetForsikringsselskap as $o}from"./logo/text-paths/VartEgetForsikringsselskap.js";import{VartForsikringsselskap as _o}from"./logo/text-paths/VartForsikringsselskap.js";import{Menu as oa}from"./menu/Menu.js";import{MenuItem as aa}from"./menu/MenuItem.js";import{MenuItemCheckbox as sa}from"./menu/MenuItemCheckbox.js";import{MenuDivider as ea}from"./menu/MenuDivider.js";import{ErrorMessage as ra,InfoMessage as ta,SuccessMessage as na,WarningMessage as ia}from"./message/Message.js";import{FormErrorMessage as ma}from"./message/FormErrorMessage.js";import{Modal as la,ModalActions as ca,ModalBody as pa,ModalCloseButton as da,ModalContainer as ua,ModalHeader as ba,ModalOverlay as fa,ModalTitle as Ta}from"./modal/Modal.js";import{useModal as Ia}from"./modal/useModal.js";import{Pagination as ja}from"./pagination/Pagination.js";import{Popover as ga}from"./popover/Popover.js";import{Countdown as Ca}from"./progress-bar/Countdown.js";import{ProgressBar as ka}from"./progress-bar/ProgressBar.js";import{RadioButton as Sa}from"./radio-button/RadioButton.js";import{RadioButtonGroup as xa}from"./radio-button/RadioButtonGroup.js";import{BaseRadioButton as ha}from"./radio-button/BaseRadioButton.js";import{Select as Ba}from"./select/Select.js";import{NativeSelect as La}from"./select/NativeSelect.js";import{SummaryTable as va}from"./summary-table/SummaryTable.js";import{SummaryTableRow as Ma}from"./summary-table/SummaryTableRow.js";import{ErrorSystemMessage as wa,InfoSystemMessage as Aa,SuccessSystemMessage as Pa,WarningSystemMessage as Ra}from"./system-message/SystemMessage.js";import{DataTable as Fa}from"./table/DataTable.js";import{Table as Da}from"./table/Table.js";import{TableBody as ya}from"./table/TableBody.js";import{TableCaption as Ea}from"./table/TableCaption.js";import{TableCell as Ga}from"./table/TableCell.js";import{TableColumn as Na}from"./table/TableColumn.js";import{TableColumnGroup as Ha}from"./table/TableColumnGroup.js";import{TableContextProvider as Ua,useTableContext as Wa}from"./table/tableContext.js";import{TableSectionContextProvider as Va,useTableSectionContext as Oa}from"./table/tableSectionContext.js";import{TableFooter as za}from"./table/TableFooter.js";import{TableHead as Qa}from"./table/TableHead.js";import{TableHeader as qa}from"./table/TableHeader.js";import{TablePagination as Ja}from"./table/TablePagination.js";import{TableRow as Ka}from"./table/TableRow.js";import{ExpandableTableRow as Xa}from"./table/ExpandableTableRow.js";import{ExpandableTableRowController as Ya}from"./table/ExpandableTableRowController.js";import{useSortableTableHeader as Za}from"./table/utils.js";import{NavTab as $a}from"./tabs/NavTab.js";import{NavTabs as _a}from"./tabs/NavTabs.js";import{Tabs as os}from"./tabs/Tabs.js";import{TabList as as}from"./tabs/TabList.js";import{Tab as ss}from"./tabs/Tab.js";import{TabPanel as es}from"./tabs/TabPanel.js";import{ErrorTag as rs,InfoTag as ts,SuccessTag as ns,Tag as is,WarningTag as ms}from"./tag/Tag.js";import{BaseTextArea as ls}from"./text-input/BaseTextArea.js";import{BaseTextInput as cs}from"./text-input/BaseTextInput.js";import{TextArea as ps}from"./text-input/TextArea.js";import{TextInput as ds}from"./text-input/TextInput.js";import{ToastProvider as us,useToast as bs}from"./toast/toastContext.js";import{ToggleSwitch as fs}from"./toggle-switch/ToggleSwitch.js";import{ToggleSlider as Ts}from"./toggle-switch/ToggleSlider.js";import{Tooltip as Is}from"./tooltip/Tooltip.js";import{TooltipContent as js}from"./tooltip/TooltipContent.js";import{TooltipTrigger as gs}from"./tooltip/TooltipTrigger.js";import{PopupTip as Cs}from"./tooltip/PopupTip.js";import{ScreenReaderOnly as ks}from"./ScreenReaderOnly.js";export{o as Accordion,a as AccordionItem,H as ArrowDownIcon,G as ArrowHorizontalAnimated,U as ArrowLeftIcon,W as ArrowNorthEastIcon,V as ArrowRightIcon,O as ArrowUpIcon,E as ArrowVerticalAnimated,ha as BaseRadioButton,ls as BaseTextArea,cs as BaseTextInput,s as Breadcrumb,e as BreadcrumbItem,r as Button,z as CalendarIcon,m as Card,l as CardImage,Q as CheckIcon,Ro as CheckListItem,b as Checkbox,xo as CheckboxPanel,q as ChevronDownIcon,J as ChevronLeftIcon,K as ChevronRightIcon,X as ChevronUpIcon,Y as CloseIcon,f as Combobox,I as CookieConsent,j as CookieConsentProvider,Z as CopyIcon,Ca as Countdown,Fo as CrossListItem,Fa as DataTable,C as DatePicker,A as DescriptionDetail,P as DescriptionList,R as DescriptionTerm,$ as DotsIcon,_ as DragIcon,oo as ErrorIcon,ra as ErrorMessage,wa as ErrorSystemMessage,rs as ErrorTag,D as ExpandSection,Xa as ExpandableTableRow,Ya as ExpandableTableRowController,F as Expander,v as Feedback,go as FieldGroup,w as Flex,ma as FormErrorMessage,Ko as ForsikringLevertAvFremtind,Xo as FraSB1ogDNB,ao as GreenCheckIcon,so as HamburgerIcon,y as Icon,Io as IconButton,jo as Image,c as InfoBlock,u as InfoCard,eo as InfoIcon,ta as InfoMessage,Aa as InfoSystemMessage,ts as InfoTag,Yo as InnovasjonFraFremtind,Co as InputGroup,ko as Label,Lo as Link,ro as LinkIcon,Mo as LinkList,wo as List,Do as ListItem,yo as Loader,qo as Logo,Jo as LogoStamp,oa as Menu,ea as MenuDivider,aa as MenuItem,sa as MenuItemCheckbox,po as MinusIcon,la as Modal,ca as ModalActions,pa as ModalBody,da as ModalCloseButton,ua as ModalContainer,ba as ModalHeader,fa as ModalOverlay,Ta as ModalTitle,La as NativeSelect,p as NavCard,vo as NavLink,$a as NavTab,_a as NavTabs,Ao as OrderedList,M as PRESETS,ja as Pagination,To as PenIcon,to as PlusIcon,N as PlusRemoveAnimated,ga as Popover,Cs as PopupTip,t as PrimaryButton,ka as ProgressBar,no as QuestionIcon,Sa as RadioButton,xa as RadioButtonGroup,ho as RadioPanel,Bo as RadioPanelGroup,io as RedCrossIcon,ks as ScreenReaderOnly,mo as SearchIcon,n as SecondaryButton,Ba as Select,Eo as SkeletonAnimation,Go as SkeletonButton,No as SkeletonCheckboxGroup,Ho as SkeletonElement,Uo as SkeletonInput,Wo as SkeletonRadioButtonGroup,Vo as SkeletonTable,Oo as SkeletonTableHeader,zo as SkeletonTableRow,Qo as SkeletonTextArea,lo as SuccessIcon,na as SuccessMessage,Pa as SuccessSystemMessage,ns as SuccessTag,va as SummaryTable,Ma as SummaryTableRow,So as SupportLabel,ss as Tab,as as TabList,es as TabPanel,Da as Table,ya as TableBody,Ea as TableCaption,Ga as TableCell,Na as TableColumn,Ha as TableColumnGroup,Ua as TableContextProvider,za as TableFooter,Qa as TableHead,qa as TableHeader,Ja as TablePagination,Ka as TableRow,Va as TableSectionContextProvider,os as Tabs,is as Tag,d as TaskCard,Zo as TeknologiFraFremtind,i as TertiaryButton,ps as TextArea,ds as TextInput,uo as ThumbDownIcon,bo as ThumbUpIcon,us as ToastProvider,Ts as ToggleSlider,fs as ToggleSwitch,Is as Tooltip,js as TooltipContent,gs as TooltipTrigger,fo as TrashCanIcon,Po as UnorderedList,$o as VartEgetForsikringsselskap,_o as VartForsikringsselskap,co as WarningIcon,ia as WarningMessage,Ra as WarningSystemMessage,ms as WarningTag,h as formatInput,T as getComboboxValuePair,B as isBlurTargetOutside,k as isCorrectFormat,S as isWithinLowerBound,x as isWithinUpperBound,L as parseDateString,g as useCookieConsent,Ia as useModal,Za as useSortableTableHeader,Wa as useTableContext,Oa as useTableSectionContext,bs as useToast};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React, ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
type Props = ComponentPropsWithRef<"input"> & {
|
|
3
|
+
isChecked: boolean;
|
|
4
|
+
alwaysOpen: boolean;
|
|
5
|
+
label: string;
|
|
6
|
+
extraLabel?: ReactNode;
|
|
7
|
+
type: "radio" | "checkbox";
|
|
8
|
+
};
|
|
9
|
+
export declare const BasePanel: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsxs as a,jsx as e}from"react/jsx-runtime";import{c as l}from"../../../clsx-BeLtu-UY.js";import{forwardRef as n,useId as s,Children as t}from"react";import{useAutoAnimatedHeight as i}from"../../hooks/useAnimatedHeight/useAutoAnimateHeight.js";const r=n((function({className:n,isChecked:r,children:p,alwaysOpen:c,label:o,extraLabel:d,type:m,...u},h){const j=`content-${s()}`,_=t.count(p)>0,k=i(r);return a("div",{className:l("jkl-input-panel",`jkl-${m}-panel`,n),children:[a("label",{className:"jkl-input-panel__label",children:[e("input",{ref:h,className:"jkl-input-panel__input",type:m,"aria-controls":c?void 0:j,"aria-expanded":c?void 0:r,...u}),e("span",{"aria-hidden":"true",className:`jkl-${m}-panel__decorator`}),e("span",{className:"jkl-input-panel__main-label",children:o}),e("span",{className:l("jkl-input-panel__extra-label",{"jkl-input-panel__extra-label--text":"string"==typeof d}),children:d})]}),_&&e("div",{ref:k,"aria-hidden":!r&&!c,children:e("div",{className:"jkl-input-panel__content",id:j,"data-alwaysopen":c,children:p})})]})}));export{r as BasePanel};
|
|
2
|
+
//# sourceMappingURL=BasePanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BasePanel.js","sources":["../../../../src/components/input-panel/BasePanel.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport React, {\n Children,\n ComponentPropsWithRef,\n ForwardedRef,\n forwardRef,\n ReactNode,\n useId,\n} from \"react\";\nimport { useAutoAnimatedHeight } from \"../../hooks/useAnimatedHeight/useAutoAnimateHeight.js\";\n\ntype Props = ComponentPropsWithRef<\"input\"> & {\n isChecked: boolean;\n alwaysOpen: boolean;\n label: string;\n extraLabel?: ReactNode;\n type: \"radio\" | \"checkbox\";\n};\n\nexport const BasePanel = forwardRef(function BasePanel(\n {\n className,\n isChecked,\n children,\n alwaysOpen,\n label,\n extraLabel,\n type,\n ...rest\n }: Props,\n ref: ForwardedRef<HTMLInputElement>,\n) {\n const contentId = `content-${useId()}`;\n const hasChildren = Children.count(children) > 0;\n const animationRef = useAutoAnimatedHeight<HTMLDivElement>(isChecked);\n\n return (\n <div\n className={clsx(\"jkl-input-panel\", `jkl-${type}-panel`, className)}\n >\n <label className=\"jkl-input-panel__label\">\n <input\n ref={ref}\n className=\"jkl-input-panel__input\"\n type={type}\n aria-controls={!alwaysOpen ? contentId : undefined}\n aria-expanded={!alwaysOpen ? isChecked : undefined}\n {...rest}\n />\n <span\n aria-hidden=\"true\"\n className={`jkl-${type}-panel__decorator`}\n />\n <span className=\"jkl-input-panel__main-label\">{label}</span>\n <span\n className={clsx(\"jkl-input-panel__extra-label\", {\n \"jkl-input-panel__extra-label--text\":\n typeof extraLabel === \"string\",\n })}\n >\n {extraLabel}\n </span>\n </label>\n {hasChildren && (\n <div ref={animationRef} aria-hidden={!isChecked && !alwaysOpen}>\n <div\n className=\"jkl-input-panel__content\"\n id={contentId}\n data-alwaysopen={alwaysOpen}\n >\n {children}\n </div>\n </div>\n )}\n </div>\n );\n});\n"],"names":["BasePanel","forwardRef","className","isChecked","children","alwaysOpen","label","extraLabel","type","rest","ref","contentId","useId","hasChildren","Children","count","animationRef","useAutoAnimatedHeight","jsxs","clsx","jsx","id"],"mappings":"0PAmBa,MAAAA,EAAYC,GAAW,UAE5BC,UAAAA,EACAC,UAAAA,EACAC,SAAAA,EACAC,WAAAA,EACAC,MAAAA,EACAC,WAAAA,EACAC,KAAAA,KACGC,GAEPC,GAEM,MAAAC,EAAY,WAAWC,MACvBC,EAAcC,EAASC,MAAMX,GAAY,EACzCY,EAAeC,EAAsCd,GAGvD,OAAAe,EAAC,MAAA,CACGhB,UAAWiB,EAAK,kBAAmB,OAAOX,UAAcN,GAExDE,SAAA,CAACc,EAAA,QAAA,CAAMhB,UAAU,yBACbE,SAAA,CAAAgB,EAAC,QAAA,CACGV,IAAAA,EACAR,UAAU,yBACVM,KAAAA,EACA,gBAAgBH,OAAyB,EAAZM,EAC7B,gBAAgBN,OAAyB,EAAZF,KACzBM,IAERW,EAAC,OAAA,CACG,cAAY,OACZlB,UAAW,OAAOM,uBAErBY,EAAA,OAAA,CAAKlB,UAAU,8BAA+BE,SAAME,IACrDc,EAAC,OAAA,CACGlB,UAAWiB,EAAK,+BAAgC,CAC5C,qCAC0B,iBAAfZ,IAGdH,SAAAG,OAGRM,KACI,MAAI,CAAAH,IAAKM,EAAc,eAAcb,IAAcE,EAChDD,SAAAgB,EAAC,MAAA,CACGlB,UAAU,2BACVmB,GAAIV,EACJ,kBAAiBN,EAEhBD,SAAAA,QAMzB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React, ComponentPropsWithRef } from 'react';
|
|
2
|
+
export type CheckboxPanelProps = Omit<ComponentPropsWithRef<"input">, "type"> & {
|
|
3
|
+
label: string;
|
|
4
|
+
extraLabel?: React.ReactNode;
|
|
5
|
+
alwaysOpen?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const CheckboxPanel: React.ForwardRefExoticComponent<Omit<CheckboxPanelProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{forwardRef as a,useState as t,useCallback as c}from"react";import{BasePanel as r}from"./BasePanel.js";const s=a((function({label:a,extraLabel:s,alwaysOpen:l=!1,checked:o,defaultChecked:n,onChange:d,...f},h){const[k,u]=t(n||!1),p=c((e=>{null==d||d(e),u(e.target.checked)}),[d,u]),b=typeof o<"u";return e(r,{ref:h,type:"checkbox",isChecked:b?o:k,defaultChecked:n,checked:b?o:void 0,onChange:p,alwaysOpen:l,label:a,extraLabel:s,...f})}));export{s as CheckboxPanel};
|
|
2
|
+
//# sourceMappingURL=CheckboxPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxPanel.js","sources":["../../../../src/components/input-panel/CheckboxPanel.tsx"],"sourcesContent":["import React, {\n ChangeEvent,\n ComponentPropsWithRef,\n ForwardedRef,\n forwardRef,\n useCallback,\n useState,\n} from \"react\";\nimport { BasePanel } from \"./BasePanel.js\";\n\nexport type CheckboxPanelProps = Omit<\n ComponentPropsWithRef<\"input\">,\n \"type\"\n> & {\n label: string;\n extraLabel?: React.ReactNode;\n alwaysOpen?: boolean;\n};\n\nexport const CheckboxPanel = forwardRef(function CheckboxPanel(\n {\n label,\n extraLabel,\n alwaysOpen = false,\n checked,\n defaultChecked,\n onChange,\n ...rest\n }: CheckboxPanelProps,\n ref: ForwardedRef<HTMLInputElement>,\n) {\n const [_isChecked, setIsChecked] = useState(defaultChecked || false);\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n onChange?.(e);\n setIsChecked(e.target.checked);\n },\n [onChange, setIsChecked],\n );\n\n const isControlled = typeof checked !== \"undefined\";\n const isChecked = isControlled ? checked : _isChecked;\n\n return (\n <BasePanel\n ref={ref}\n type=\"checkbox\"\n isChecked={isChecked}\n defaultChecked={defaultChecked}\n checked={isControlled ? checked : undefined}\n onChange={handleChange}\n alwaysOpen={alwaysOpen}\n label={label}\n extraLabel={extraLabel}\n {...rest}\n />\n );\n});\n"],"names":["CheckboxPanel","forwardRef","label","extraLabel","alwaysOpen","checked","defaultChecked","onChange","rest","ref","_isChecked","setIsChecked","useState","handleChange","useCallback","e","target","isControlled","jsx","BasePanel","type","isChecked"],"mappings":"qJAmBa,MAAAA,EAAgBC,GAAW,UAEhCC,MAAAA,EACAC,WAAAA,EACAC,WAAAA,GAAa,EACbC,QAAAA,EACAC,eAAAA,EACAC,SAAAA,KACGC,GAEPC,GAEM,MAACC,EAAYC,GAAgBC,EAASN,IAAkB,GAExDO,EAAeC,GAChBC,IACG,MAAAR,GAAAA,EAAWQ,GACEJ,EAAAI,EAAEC,OAAOX,QAAO,GAEjC,CAACE,EAAUI,IAGTM,SAAsBZ,EAAY,IAIpC,OAAAa,EAACC,EAAA,CACGV,IAAAA,EACAW,KAAK,WACLC,UANUJ,EAAeZ,EAAUK,EAOnCJ,eAAAA,EACAD,QAASY,EAAeZ,OAAU,EAClCE,SAAUM,EACVT,WAAAA,EACAF,MAAAA,EACAC,WAAAA,KACIK,GAGhB"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { default as React, ComponentPropsWithRef } from 'react';
|
|
2
|
-
type
|
|
3
|
-
name: string;
|
|
2
|
+
export type RadioPanelProps = Omit<ComponentPropsWithRef<"input">, "type" | "aria-invalid"> & {
|
|
4
3
|
value: string;
|
|
5
4
|
label: string;
|
|
6
5
|
extraLabel?: React.ReactNode;
|
|
7
6
|
alwaysOpen?: boolean;
|
|
8
7
|
};
|
|
9
|
-
export declare const RadioPanel: React.ForwardRefExoticComponent<Omit<
|
|
10
|
-
export {};
|
|
8
|
+
export declare const RadioPanel: React.ForwardRefExoticComponent<Omit<RadioPanelProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{forwardRef as a,useContext as o,useCallback as r,useEffect as n}from"react";import{BasePanel as l}from"./BasePanel.js";import{context as t}from"./radioPanelContext.js";const s=a((function({alwaysOpen:a=!1,label:s,extraLabel:i,checked:d,onChange:u,value:c,defaultChecked:f,...p},h){const{onValueChange:w,checkedValue:k}=o(t),m=r((e=>{if(null==u||u(e),!w)throw new Error("RadioPanel will not work properly when used outside a RadioPanelGroup");w(c)}),[u,w,c]);n((()=>{if(f){if(!w)throw new Error("RadioPanel will not work properly when used outside a RadioPanelGroup");w(c)}}),[]);const C=typeof d<"u";return e(l,{ref:h,type:"radio",value:c,isChecked:C?d:k===c,defaultChecked:f,checked:C?d:void 0,onChange:m,alwaysOpen:a,label:s,extraLabel:i,...p})}));export{s as RadioPanel};
|
|
2
|
+
//# sourceMappingURL=RadioPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioPanel.js","sources":["../../../../src/components/input-panel/RadioPanel.tsx"],"sourcesContent":["import React, {\n ChangeEvent,\n ComponentPropsWithRef,\n ForwardedRef,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n} from \"react\";\nimport { BasePanel } from \"./BasePanel.js\";\nimport { context } from \"./radioPanelContext.js\";\n\n// aria-invalid has been deprecated for the \"radio\" role, it should go on the\n// parent radiogroup\nexport type RadioPanelProps = Omit<\n ComponentPropsWithRef<\"input\">,\n \"type\" | \"aria-invalid\"\n> & {\n value: string;\n label: string;\n extraLabel?: React.ReactNode;\n alwaysOpen?: boolean;\n};\n\nexport const RadioPanel = forwardRef(function RadioPanel(\n {\n alwaysOpen = false,\n label,\n extraLabel,\n checked,\n onChange,\n value,\n defaultChecked,\n ...rest\n }: RadioPanelProps,\n ref: ForwardedRef<HTMLInputElement>,\n) {\n const { onValueChange, checkedValue } = useContext(context);\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n onChange?.(e);\n if (!onValueChange) {\n throw new Error(\n \"RadioPanel will not work properly when used outside a RadioPanelGroup\",\n );\n }\n onValueChange(value);\n },\n [onChange, onValueChange, value],\n );\n\n useEffect(() => {\n if (defaultChecked) {\n if (!onValueChange) {\n throw new Error(\n \"RadioPanel will not work properly when used outside a RadioPanelGroup\",\n );\n }\n onValueChange(value);\n }\n // We never want to rerun this effect. Changing the default value after the\n // input control is first mounted should not cause any updates\n /* eslint-disable-next-line react-hooks/exhaustive-deps */\n }, []);\n\n const isControlled = typeof checked !== \"undefined\";\n const isChecked = isControlled ? checked : checkedValue === value;\n\n return (\n <BasePanel\n ref={ref}\n type=\"radio\"\n value={value}\n isChecked={isChecked}\n defaultChecked={defaultChecked}\n checked={isControlled ? checked : undefined}\n onChange={handleChange}\n alwaysOpen={alwaysOpen}\n label={label}\n extraLabel={extraLabel}\n {...rest}\n />\n );\n});\n"],"names":["RadioPanel","forwardRef","alwaysOpen","label","extraLabel","checked","onChange","value","defaultChecked","rest","ref","onValueChange","checkedValue","useContext","context","handleChange","useCallback","e","Error","useEffect","isControlled","jsx","BasePanel","type","isChecked"],"mappings":"uNAwBa,MAAAA,EAAaC,GAAW,UAE7BC,WAAAA,GAAa,EACbC,MAAAA,EACAC,WAAAA,EACAC,QAAAA,EACAC,SAAAA,EACAC,MAAAA,EACAC,eAAAA,KACGC,GAEPC,GAEM,MAAEC,cAAAA,EAAeC,aAAAA,GAAiBC,EAAWC,GAE7CC,EAAeC,GAChBC,IAEG,GADA,MAAAX,GAAAA,EAAWW,IACNN,EACD,MAAM,IAAIO,MACN,yEAGRP,EAAcJ,EAAK,GAEvB,CAACD,EAAUK,EAAeJ,IAG9BY,GAAU,KACN,GAAIX,EAAgB,CAChB,IAAKG,EACD,MAAM,IAAIO,MACN,yEAGRP,EAAcJ,EAClB,IAID,IAEGa,MAAAA,SAAsBf,EAAY,IAIpC,OAAAgB,EAACC,EAAA,CACGZ,IAAAA,EACAa,KAAK,QACLhB,MAAAA,EACAiB,UAPUJ,EAAef,EAAUO,IAAiBL,EAQpDC,eAAAA,EACAH,QAASe,EAAef,OAAU,EAClCC,SAAUS,EACVb,WAAAA,EACAC,MAAAA,EACAC,WAAAA,KACIK,GAGhB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{useState as e}from"react";import{FieldGroup as a}from"../input-group/FieldGroup.js";import{context as o}from"./radioPanelContext.js";const t=({className:t,...i})=>{const[s,l]=e();return r(o.Provider,{value:{checkedValue:s,onValueChange:r=>{l(r)}},children:r(a,{className:t,role:"radiogroup","aria-invalid":!!i.errorLabel,...i})})};export{t as RadioPanelGroup};
|
|
2
|
+
//# sourceMappingURL=RadioPanelGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioPanelGroup.js","sources":["../../../../src/components/input-panel/RadioPanelGroup.tsx"],"sourcesContent":["import React, { FC, useState } from \"react\";\nimport { FieldGroup, FieldGroupProps } from \"../input-group/FieldGroup.js\";\nimport { context } from \"./radioPanelContext.js\";\n\nexport type RadioPanelGroupProps = FieldGroupProps & {};\n\nexport const RadioPanelGroup: FC<RadioPanelGroupProps> = ({\n className,\n ...rest\n}) => {\n const [checkedValue, setCheckedValue] = useState<string>();\n\n const onChange = (value: string) => {\n setCheckedValue(value);\n };\n\n return (\n <context.Provider value={{ checkedValue, onValueChange: onChange }}>\n <FieldGroup\n className={className}\n role=\"radiogroup\"\n aria-invalid={!!rest.errorLabel}\n {...rest}\n />\n </context.Provider>\n );\n};\n"],"names":["RadioPanelGroup","className","rest","checkedValue","setCheckedValue","useState","jsx","context","Provider","value","onValueChange","children","FieldGroup","role","errorLabel"],"mappings":"oLAMO,MAAMA,EAA4C,EACrDC,UAAAA,KACGC,MAEG,MAACC,EAAcC,GAAmBC,IAOpC,OAAAC,EAACC,EAAQC,SAAR,CAAiBC,MAAO,CAAEN,aAAAA,EAAcO,cAL3BD,IACdL,EAAgBK,EAAK,GAKjBE,SAAAL,EAACM,EAAA,CACGX,UAAAA,EACAY,KAAK,aACL,iBAAgBX,EAAKY,cACjBZ,KAEZ"}
|