@norges-domstoler/dds-components 9.3.0 → 9.4.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/dist/_virtual/_rollupPluginBabelHelpers.js +2 -27
- package/dist/cjs/components/InlineEdit/InlineEdit.d.ts +2 -0
- package/dist/cjs/components/InlineEdit/InlineEdit.stories.d.ts +33 -0
- package/dist/cjs/components/InlineEdit/InlineEdit.styles.d.ts +4 -0
- package/dist/cjs/components/InlineEdit/InlineEdit.tokens.d.ts +25 -0
- package/dist/cjs/components/InlineEdit/InlineEdit.types.d.ts +33 -0
- package/dist/cjs/components/InlineEdit/InlineEdit.utils.d.ts +1 -0
- package/dist/cjs/components/InlineEdit/InlineEditInput.d.ts +1 -0
- package/dist/cjs/components/InlineEdit/InlineEditInput.stories.d.ts +36 -0
- package/dist/cjs/components/InlineEdit/InlineEditTextArea.d.ts +1 -0
- package/dist/cjs/components/InlineEdit/InlineEditTextArea.stories.d.ts +36 -0
- package/dist/cjs/components/InlineEdit/InlineInput.d.ts +4 -0
- package/dist/cjs/components/InlineEdit/InlineTextArea.d.ts +4 -0
- package/dist/cjs/components/InlineEdit/index.d.ts +3 -0
- package/dist/cjs/components/SplitButton/SplitButton.d.ts +2 -1
- package/dist/cjs/helpers/Input/Input.styles.d.ts +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1932 -2253
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/cjs/types/utils.d.ts +7 -0
- package/dist/components/Breadcrumbs/Breadcrumb.js +1 -4
- package/dist/components/Breadcrumbs/Breadcrumb.tokens.js +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +7 -8
- package/dist/components/Button/Button.js +24 -27
- package/dist/components/Button/Button.styles.js +15 -19
- package/dist/components/Button/Button.tokens.js +5 -5
- package/dist/components/Card/Card.js +9 -11
- package/dist/components/Card/Card.tokens.js +1 -1
- package/dist/components/Card/CardAccordion/CardAccordion.js +10 -13
- package/dist/components/Card/CardAccordion/CardAccordion.tokens.js +2 -2
- package/dist/components/Card/CardAccordion/CardAccordionBody.js +12 -16
- package/dist/components/Card/CardAccordion/CardAccordionHeader.js +9 -11
- package/dist/components/Checkbox/Checkbox.js +13 -16
- package/dist/components/Checkbox/CheckboxGroup.js +12 -13
- package/dist/components/Chip/Chip.js +10 -14
- package/dist/components/Chip/Chip.tokens.js +2 -2
- package/dist/components/Chip/ChipGroup.js +1 -2
- package/dist/components/Datepicker/Datepicker.js +19 -25
- package/dist/components/Datepicker/Datepicker.tokens.js +2 -2
- package/dist/components/DescriptionList/DescriptionList.js +8 -9
- package/dist/components/DescriptionList/DescriptionList.tokens.js +1 -1
- package/dist/components/DescriptionList/DescriptionListDesc.js +5 -6
- package/dist/components/DescriptionList/DescriptionListGroup.js +5 -6
- package/dist/components/DescriptionList/DescriptionListTerm.js +1 -2
- package/dist/components/Divider/Divider.js +5 -6
- package/dist/components/Divider/Divider.tokens.js +1 -1
- package/dist/components/Drawer/Drawer.js +17 -21
- package/dist/components/Drawer/DrawerGroup.js +6 -12
- package/dist/components/GlobalMessage/GlobalMessage.js +14 -16
- package/dist/components/GlobalMessage/GlobalMessage.tokens.js +1 -1
- package/dist/components/Grid/Grid.js +7 -9
- package/dist/components/Grid/Grid.tokens.js +1 -1
- package/dist/components/Grid/Grid.utils.js +0 -4
- package/dist/components/Grid/GridChild.js +6 -8
- package/dist/components/Icon/Icon.js +11 -17
- package/dist/components/InlineEdit/InlineEdit.d.ts +2 -0
- package/dist/components/InlineEdit/InlineEdit.js +72 -0
- package/dist/components/InlineEdit/InlineEdit.stories.d.ts +33 -0
- package/dist/components/InlineEdit/InlineEdit.styles.d.ts +4 -0
- package/dist/components/InlineEdit/InlineEdit.styles.js +15 -0
- package/dist/components/InlineEdit/InlineEdit.tokens.d.ts +25 -0
- package/dist/components/InlineEdit/InlineEdit.tokens.js +27 -0
- package/dist/components/InlineEdit/InlineEdit.types.d.ts +33 -0
- package/dist/components/InlineEdit/InlineEdit.utils.d.ts +1 -0
- package/dist/components/InlineEdit/InlineEdit.utils.js +13 -0
- package/dist/components/InlineEdit/InlineEditInput.d.ts +1 -0
- package/dist/components/InlineEdit/InlineEditInput.js +36 -0
- package/dist/components/InlineEdit/InlineEditInput.stories.d.ts +36 -0
- package/dist/components/InlineEdit/InlineEditTextArea.d.ts +1 -0
- package/dist/components/InlineEdit/InlineEditTextArea.js +36 -0
- package/dist/components/InlineEdit/InlineEditTextArea.stories.d.ts +36 -0
- package/dist/components/InlineEdit/InlineInput.d.ts +4 -0
- package/dist/components/InlineEdit/InlineInput.js +66 -0
- package/dist/components/InlineEdit/InlineTextArea.d.ts +4 -0
- package/dist/components/InlineEdit/InlineTextArea.js +67 -0
- package/dist/components/InlineEdit/index.d.ts +3 -0
- package/dist/components/InputMessage/InputMessage.js +5 -6
- package/dist/components/InputMessage/InputMessage.tokens.js +1 -1
- package/dist/components/InternalHeader/InternalHeader.js +18 -26
- package/dist/components/InternalHeader/InternalHeader.styles.js +5 -5
- package/dist/components/InternalHeader/InternalHeader.tokens.js +2 -2
- package/dist/components/InternalHeader/InternalHeaderListItem.js +1 -2
- package/dist/components/InternalHeader/NavigationItem.js +2 -3
- package/dist/components/List/List.js +10 -11
- package/dist/components/List/ListItem.js +1 -2
- package/dist/components/LocalMessage/LocalMessage.js +18 -24
- package/dist/components/LocalMessage/LocalMessage.tokens.js +4 -4
- package/dist/components/Modal/Modal.js +12 -16
- package/dist/components/Modal/ModalActions.js +1 -2
- package/dist/components/Modal/ModalBody.js +6 -7
- package/dist/components/OverflowMenu/OverflowMenu.js +31 -42
- package/dist/components/OverflowMenu/OverflowMenu.tokens.js +4 -4
- package/dist/components/OverflowMenu/OverflowMenuGroup.js +7 -14
- package/dist/components/OverflowMenu/OverflowMenuItem.js +10 -24
- package/dist/components/Pagination/Pagination.js +38 -49
- package/dist/components/Pagination/Pagination.tokens.js +1 -1
- package/dist/components/Pagination/paginationGenerator.js +0 -5
- package/dist/components/Popover/Popover.js +29 -32
- package/dist/components/Popover/PopoverGroup.js +8 -16
- package/dist/components/ProgressTracker/ProgressTracker.js +9 -15
- package/dist/components/ProgressTracker/ProgressTracker.tokens.js +2 -2
- package/dist/components/ProgressTracker/ProgressTrackerItem.js +12 -29
- package/dist/components/RadioButton/RadioButton.js +17 -24
- package/dist/components/RadioButton/RadioButtonGroup.js +20 -24
- package/dist/components/ScrollableContainer/ScrollableContainer.js +8 -9
- package/dist/components/ScrollableContainer/ScrollableContainer.tokens.js +1 -1
- package/dist/components/ScrollableContainer/Scrollbar.js +29 -42
- package/dist/components/ScrollableContainer/scrollbarStyling.js +1 -5
- package/dist/components/Search/Search.js +16 -23
- package/dist/components/Search/Search.tokens.js +1 -1
- package/dist/components/Select/Select.js +32 -48
- package/dist/components/Select/Select.styles.js +16 -16
- package/dist/components/Select/Select.tokens.js +6 -6
- package/dist/components/SkipToContent/SkipToContent.js +11 -13
- package/dist/components/SkipToContent/SkipToContent.tokens.js +1 -1
- package/dist/components/Spinner/Spinner.js +7 -8
- package/dist/components/SplitButton/SplitButton.d.ts +2 -1
- package/dist/components/SplitButton/SplitButton.js +7 -9
- package/dist/components/Table/Body.js +1 -2
- package/dist/components/Table/Cell.js +5 -14
- package/dist/components/Table/Foot.js +1 -2
- package/dist/components/Table/Head.js +1 -2
- package/dist/components/Table/Row.js +8 -11
- package/dist/components/Table/SortCell.js +4 -8
- package/dist/components/Table/Table.js +4 -5
- package/dist/components/Table/Table.tokens.js +2 -2
- package/dist/components/Table/TableWrapper.js +7 -13
- package/dist/components/Tabs/Tab.js +15 -23
- package/dist/components/Tabs/TabList.js +13 -20
- package/dist/components/Tabs/TabPanel.js +6 -7
- package/dist/components/Tabs/TabPanels.js +4 -6
- package/dist/components/Tabs/Tabs.js +15 -21
- package/dist/components/Tabs/Tabs.tokens.js +2 -2
- package/dist/components/Tag/Tag.js +6 -7
- package/dist/components/Tag/Tag.tokens.js +2 -2
- package/dist/components/TextArea/TextArea.js +18 -24
- package/dist/components/TextInput/CharCounter.js +5 -7
- package/dist/components/TextInput/TextInput.js +26 -34
- package/dist/components/TextInput/TextInput.styles.js +3 -3
- package/dist/components/TextInput/TextInput.tokens.js +2 -2
- package/dist/components/ToggleBar/ToggleBar.js +14 -17
- package/dist/components/ToggleBar/ToggleBar.tokens.js +4 -4
- package/dist/components/ToggleBar/ToggleRadio.js +9 -17
- package/dist/components/ToggleBar/ToggleRadio.styles.js +2 -2
- package/dist/components/ToggleButton/ToggleButton.js +5 -6
- package/dist/components/ToggleButton/ToggleButton.tokens.js +1 -1
- package/dist/components/ToggleButton/ToggleButtonGroup.js +8 -9
- package/dist/components/Tooltip/Tooltip.js +28 -34
- package/dist/components/Tooltip/Tooltip.tokens.js +1 -1
- package/dist/components/Typography/Caption/Caption.js +4 -5
- package/dist/components/Typography/Heading/Heading.js +6 -15
- package/dist/components/Typography/Label/Label.js +5 -6
- package/dist/components/Typography/Legend/Legend.js +4 -5
- package/dist/components/Typography/Link/Link.js +9 -10
- package/dist/components/Typography/Paragraph/Paragraph.js +6 -7
- package/dist/components/Typography/Typography/Typography.js +17 -24
- package/dist/components/Typography/Typography.tokens.js +2 -2
- package/dist/components/Typography/Typography.utils.js +0 -8
- package/dist/components/VisuallyHidden/VisuallyHidden.js +5 -7
- package/dist/helpers/Backdrop/Backdrop.utils.js +0 -1
- package/dist/helpers/Chevron/AnimatedChevronUpDown.js +4 -4
- package/dist/helpers/Input/Input.styles.d.ts +1 -1
- package/dist/helpers/Input/Input.styles.js +1 -2
- package/dist/helpers/Input/Input.tokens.js +2 -2
- package/dist/helpers/Input/Input.utils.js +0 -4
- package/dist/helpers/Paper/Paper.js +1 -8
- package/dist/helpers/Paper/Paper.tokens.js +2 -2
- package/dist/helpers/SelectionControl/SelectionControl.styles.js +4 -4
- package/dist/helpers/SelectionControl/SelectionControl.tokens.js +2 -2
- package/dist/helpers/styling/focusVisible.js +2 -2
- package/dist/helpers/styling/hover.js +1 -1
- package/dist/hooks/useCombinedRefs.js +0 -2
- package/dist/hooks/useFloatPosition.js +21 -30
- package/dist/hooks/useFocusTrap.js +0 -6
- package/dist/hooks/useMountTransition.js +3 -5
- package/dist/hooks/useOnClickOutside.js +0 -5
- package/dist/hooks/useOnKeyDown.js +0 -3
- package/dist/hooks/useReturnFocusOnBlur.js +0 -5
- package/dist/hooks/useRoveFocus.js +3 -8
- package/dist/hooks/useScreenSize.js +6 -13
- package/dist/icons/tsx/apps.js +1 -2
- package/dist/icons/tsx/archive.js +1 -2
- package/dist/icons/tsx/arrowDown.js +1 -2
- package/dist/icons/tsx/arrowLeft.js +1 -2
- package/dist/icons/tsx/arrowRight.js +1 -2
- package/dist/icons/tsx/arrowUp.js +1 -2
- package/dist/icons/tsx/attachment.js +1 -2
- package/dist/icons/tsx/block.js +1 -2
- package/dist/icons/tsx/book.js +1 -2
- package/dist/icons/tsx/build.js +1 -2
- package/dist/icons/tsx/buildCircled.js +1 -2
- package/dist/icons/tsx/calendar.js +1 -2
- package/dist/icons/tsx/calendarMonth.js +1 -2
- package/dist/icons/tsx/calendarViewDay.js +1 -2
- package/dist/icons/tsx/calendarViewMonth.js +1 -2
- package/dist/icons/tsx/calendarViewWeek.js +1 -2
- package/dist/icons/tsx/call.js +1 -2
- package/dist/icons/tsx/chat.js +1 -2
- package/dist/icons/tsx/check.js +1 -2
- package/dist/icons/tsx/checkCircled.js +1 -2
- package/dist/icons/tsx/checklist.js +1 -2
- package/dist/icons/tsx/chevronDown.js +1 -2
- package/dist/icons/tsx/chevronFirst.js +1 -2
- package/dist/icons/tsx/chevronLargeLeft.js +1 -2
- package/dist/icons/tsx/chevronLargeRight.js +1 -2
- package/dist/icons/tsx/chevronLast.js +1 -2
- package/dist/icons/tsx/chevronLeft.js +1 -2
- package/dist/icons/tsx/chevronRight.js +1 -2
- package/dist/icons/tsx/chevronUp.js +1 -2
- package/dist/icons/tsx/close.js +1 -2
- package/dist/icons/tsx/closeCircled.js +1 -2
- package/dist/icons/tsx/closeSmall.js +1 -2
- package/dist/icons/tsx/cloud.js +1 -2
- package/dist/icons/tsx/collapse.js +1 -2
- package/dist/icons/tsx/comment.js +1 -2
- package/dist/icons/tsx/copy.js +1 -2
- package/dist/icons/tsx/court.js +1 -2
- package/dist/icons/tsx/dateRange.js +1 -2
- package/dist/icons/tsx/deaths.js +1 -2
- package/dist/icons/tsx/download.js +1 -2
- package/dist/icons/tsx/downloadDone.js +1 -2
- package/dist/icons/tsx/dragHandle.js +1 -2
- package/dist/icons/tsx/edit.js +1 -2
- package/dist/icons/tsx/error.js +1 -2
- package/dist/icons/tsx/exclaim.js +1 -2
- package/dist/icons/tsx/expand.js +1 -2
- package/dist/icons/tsx/facebook.js +1 -2
- package/dist/icons/tsx/family.js +1 -2
- package/dist/icons/tsx/feedback.js +1 -2
- package/dist/icons/tsx/file.js +1 -2
- package/dist/icons/tsx/fileAdd.js +1 -2
- package/dist/icons/tsx/fileText.js +1 -2
- package/dist/icons/tsx/filter.js +1 -2
- package/dist/icons/tsx/filterList.js +1 -2
- package/dist/icons/tsx/filterListOff.js +1 -2
- package/dist/icons/tsx/filterOff.js +1 -2
- package/dist/icons/tsx/findInPage.js +1 -2
- package/dist/icons/tsx/folder.js +1 -2
- package/dist/icons/tsx/folderAdd.js +1 -2
- package/dist/icons/tsx/fullsceenExit.js +1 -2
- package/dist/icons/tsx/fullscreen.js +1 -2
- package/dist/icons/tsx/gavel.js +1 -2
- package/dist/icons/tsx/help.js +1 -2
- package/dist/icons/tsx/helpFilled.js +1 -2
- package/dist/icons/tsx/home.js +1 -2
- package/dist/icons/tsx/image.js +1 -2
- package/dist/icons/tsx/info.js +1 -2
- package/dist/icons/tsx/instagram.js +1 -2
- package/dist/icons/tsx/jordskifterett.js +1 -2
- package/dist/icons/tsx/key.js +1 -2
- package/dist/icons/tsx/lagmannsrett.js +1 -2
- package/dist/icons/tsx/language.js +1 -2
- package/dist/icons/tsx/link.js +1 -2
- package/dist/icons/tsx/linkOff.js +1 -2
- package/dist/icons/tsx/linkedIn.js +1 -2
- package/dist/icons/tsx/list.js +1 -2
- package/dist/icons/tsx/listAlt.js +1 -2
- package/dist/icons/tsx/location.js +1 -2
- package/dist/icons/tsx/lock.js +1 -2
- package/dist/icons/tsx/lockOpen.js +1 -2
- package/dist/icons/tsx/login.js +1 -2
- package/dist/icons/tsx/logout.js +1 -2
- package/dist/icons/tsx/mail.js +1 -2
- package/dist/icons/tsx/mailOpen.js +1 -2
- package/dist/icons/tsx/menu.js +1 -2
- package/dist/icons/tsx/minus.js +1 -2
- package/dist/icons/tsx/minusCircled.js +1 -2
- package/dist/icons/tsx/moreHorizontal.js +1 -2
- package/dist/icons/tsx/moreVertical.js +1 -2
- package/dist/icons/tsx/notarial.js +1 -2
- package/dist/icons/tsx/notifications.js +1 -2
- package/dist/icons/tsx/notificationsOff.js +1 -2
- package/dist/icons/tsx/onlineMeeting.js +1 -2
- package/dist/icons/tsx/openExternal.js +1 -2
- package/dist/icons/tsx/pdf.js +1 -2
- package/dist/icons/tsx/person.js +1 -2
- package/dist/icons/tsx/personAdd.js +1 -2
- package/dist/icons/tsx/pin.js +1 -2
- package/dist/icons/tsx/plus.js +1 -2
- package/dist/icons/tsx/plusCircled.js +1 -2
- package/dist/icons/tsx/print.js +1 -2
- package/dist/icons/tsx/property.js +1 -2
- package/dist/icons/tsx/publish.js +1 -2
- package/dist/icons/tsx/questionAnswer.js +1 -2
- package/dist/icons/tsx/receipt.js +1 -2
- package/dist/icons/tsx/redo.js +1 -2
- package/dist/icons/tsx/refresh.js +1 -2
- package/dist/icons/tsx/replay.js +1 -2
- package/dist/icons/tsx/search.js +1 -2
- package/dist/icons/tsx/settings.js +1 -2
- package/dist/icons/tsx/sms.js +1 -2
- package/dist/icons/tsx/star.js +1 -2
- package/dist/icons/tsx/starFilled.js +1 -2
- package/dist/icons/tsx/sync.js +1 -2
- package/dist/icons/tsx/time.js +1 -2
- package/dist/icons/tsx/tingrett.js +1 -2
- package/dist/icons/tsx/tip.js +1 -2
- package/dist/icons/tsx/trash.js +1 -2
- package/dist/icons/tsx/twitter.js +1 -2
- package/dist/icons/tsx/undo.js +1 -2
- package/dist/icons/tsx/unfoldLess.js +1 -2
- package/dist/icons/tsx/unfoldMore.js +1 -2
- package/dist/icons/tsx/upload.js +1 -2
- package/dist/icons/tsx/visibilityOff.js +1 -2
- package/dist/icons/tsx/visibilityOn.js +1 -2
- package/dist/icons/tsx/warning.js +1 -2
- package/dist/icons/tsx/zoomIn.js +1 -2
- package/dist/icons/tsx/zoomOut.js +1 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/types/BaseComponentProps.js +6 -12
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils.d.ts +7 -0
- package/dist/utils/color.js +0 -1
- package/dist/utils/combineHandlers.js +0 -1
- package/package.json +1 -1
|
@@ -16,36 +16,30 @@ var Wrapper = styled.div.withConfig({
|
|
|
16
16
|
}, scrollbarStyling.webkit, scrollbarStyling.firefox);
|
|
17
17
|
var TableWrapper = function TableWrapper(_a) {
|
|
18
18
|
var children = _a.children,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
rest = __rest(_a, ["children"]);
|
|
21
20
|
var _useState = useState(false),
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
22
|
+
overflowX = _useState2[0],
|
|
23
|
+
setOverflowX = _useState2[1];
|
|
26
24
|
var _useState3 = useState(window.innerWidth),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
26
|
+
windowWidth = _useState4[0],
|
|
27
|
+
setWindowWidth = _useState4[1];
|
|
31
28
|
function isOverflowingX(event) {
|
|
32
29
|
return event.offsetWidth < event.scrollWidth;
|
|
33
30
|
}
|
|
34
|
-
|
|
35
31
|
var wrapperRef = useRef(null);
|
|
36
32
|
useEffect(function () {
|
|
37
33
|
if (wrapperRef && wrapperRef.current && isOverflowingX(wrapperRef.current)) {
|
|
38
34
|
setOverflowX(true);
|
|
39
35
|
return;
|
|
40
36
|
}
|
|
41
|
-
|
|
42
37
|
setOverflowX(false);
|
|
43
38
|
}, [windowWidth]);
|
|
44
39
|
useEffect(function () {
|
|
45
40
|
function handleResize() {
|
|
46
41
|
setWindowWidth(window.innerWidth);
|
|
47
42
|
}
|
|
48
|
-
|
|
49
43
|
window.addEventListener('resize', handleResize);
|
|
50
44
|
return function () {
|
|
51
45
|
return window.removeEventListener('resize', handleResize);
|
|
@@ -32,30 +32,26 @@ var Button = styled.button.withConfig({
|
|
|
32
32
|
}, focusVisible, tab.hover.borderColor, tab.hover.color, tab.hover.boxShadow);
|
|
33
33
|
var Tab = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
34
34
|
var _props$active = props.active,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
35
|
+
active = _props$active === void 0 ? false : _props$active,
|
|
36
|
+
icon = props.icon,
|
|
37
|
+
children = props.children,
|
|
38
|
+
focus = props.focus,
|
|
39
|
+
setFocus = props.setFocus,
|
|
40
|
+
index = props.index,
|
|
41
|
+
onClick = props.onClick,
|
|
42
|
+
onKeyDown = props.onKeyDown,
|
|
43
|
+
id = props.id,
|
|
44
|
+
className = props.className,
|
|
45
|
+
htmlProps = props.htmlProps,
|
|
46
|
+
rest = __rest(props, ["active", "icon", "children", "focus", "setFocus", "index", "onClick", "onKeyDown", "id", "className", "htmlProps"]);
|
|
48
47
|
var itemRef = useRef(null);
|
|
49
48
|
var combinedRef = useCombinedRef(ref, itemRef);
|
|
50
|
-
|
|
51
49
|
var _useTabsContext = useTabsContext(),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
tabPanelsRef = _useTabsContext.tabPanelsRef,
|
|
51
|
+
setHasTabFocus = _useTabsContext.setHasTabFocus,
|
|
52
|
+
tabContentDirection = _useTabsContext.tabContentDirection;
|
|
56
53
|
useEffect(function () {
|
|
57
54
|
var _a;
|
|
58
|
-
|
|
59
55
|
if (focus) {
|
|
60
56
|
(_a = itemRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
61
57
|
setHasTabFocus(true);
|
|
@@ -63,7 +59,6 @@ var Tab = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
63
59
|
}, [focus]);
|
|
64
60
|
useOnKeyDown('Tab', function () {
|
|
65
61
|
var _a;
|
|
66
|
-
|
|
67
62
|
setHasTabFocus(false);
|
|
68
63
|
(_a = tabPanelsRef === null || tabPanelsRef === void 0 ? void 0 : tabPanelsRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
69
64
|
});
|
|
@@ -72,17 +67,14 @@ var Tab = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
72
67
|
setFocus(index);
|
|
73
68
|
}
|
|
74
69
|
}, [index, setFocus]);
|
|
75
|
-
|
|
76
70
|
var handleOnClick = function handleOnClick(e) {
|
|
77
71
|
handleSelect();
|
|
78
72
|
onClick && onClick(e);
|
|
79
73
|
};
|
|
80
|
-
|
|
81
74
|
var handleOnKeyDown = function handleOnKeyDown(e) {
|
|
82
75
|
handleSelect();
|
|
83
76
|
onKeyDown && onKeyDown(e);
|
|
84
77
|
};
|
|
85
|
-
|
|
86
78
|
var buttonProps = Object.assign(Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest)), {
|
|
87
79
|
ref: combinedRef,
|
|
88
80
|
'aria-selected': active,
|
|
@@ -28,27 +28,23 @@ var TabRow = styled.div.withConfig({
|
|
|
28
28
|
})(["border-bottom:", ";display:grid;grid-auto-flow:column;grid-auto-columns:1fr;overflow-x:auto;", " ", " scroll-snap-type:x mandatory;@media (prefers-reduced-motion:no-preference){scroll-behavior:smooth;transition:", ";}&:focus-visible{", "}&:focus-visible button{outline:none;}"], tabList.borderBottom, scrollbarStyling.webkit, scrollbarStyling.firefox, focusVisibleTransitionValue, focusVisible);
|
|
29
29
|
var TabList = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
30
30
|
var children = _a.children,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
id = _a.id,
|
|
32
|
+
onFocus = _a.onFocus,
|
|
33
|
+
rest = __rest(_a, ["children", "id", "onFocus"]);
|
|
35
34
|
var _useTabsContext = useTabsContext(),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
activeTab = _useTabsContext.activeTab,
|
|
36
|
+
tabsId = _useTabsContext.tabsId,
|
|
37
|
+
handleTabChange = _useTabsContext.handleTabChange,
|
|
38
|
+
tabListRef = _useTabsContext.tabListRef,
|
|
39
|
+
hasTabFocus = _useTabsContext.hasTabFocus,
|
|
40
|
+
tabPanelsRef = _useTabsContext.tabPanelsRef,
|
|
41
|
+
setHasTabFocus = _useTabsContext.setHasTabFocus;
|
|
44
42
|
var uniqueId = id !== null && id !== void 0 ? id : "".concat(tabsId, "-tablist");
|
|
45
43
|
var childrenArray = Children.toArray(children).length;
|
|
46
|
-
|
|
47
44
|
var _useRoveFocus = useRoveFocus(childrenArray, !hasTabFocus, 'row'),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
_useRoveFocus2 = _slicedToArray(_useRoveFocus, 2),
|
|
46
|
+
focus = _useRoveFocus2[0],
|
|
47
|
+
setFocus = _useRoveFocus2[1];
|
|
52
48
|
var combinedRef = useCombinedRef(ref, tabListRef);
|
|
53
49
|
var tabListChildren = Children.map(children, function (child, index) {
|
|
54
50
|
return /*#__PURE__*/isValidElement(child) && /*#__PURE__*/cloneElement(child, {
|
|
@@ -65,19 +61,16 @@ var TabList = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
65
61
|
});
|
|
66
62
|
useOnKeyDown('Tab', function () {
|
|
67
63
|
var _a;
|
|
68
|
-
|
|
69
64
|
setHasTabFocus(false);
|
|
70
65
|
(_a = tabPanelsRef === null || tabPanelsRef === void 0 ? void 0 : tabPanelsRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
71
66
|
});
|
|
72
67
|
useOnClickOutside((tabListRef === null || tabListRef === void 0 ? void 0 : tabListRef.current) || null, function () {
|
|
73
68
|
setHasTabFocus(false);
|
|
74
69
|
});
|
|
75
|
-
|
|
76
70
|
var handleOnFocus = function handleOnFocus(event) {
|
|
77
71
|
setHasTabFocus(true);
|
|
78
72
|
onFocus && onFocus(event);
|
|
79
73
|
};
|
|
80
|
-
|
|
81
74
|
var tabListProps = Object.assign(Object.assign({}, rest), {
|
|
82
75
|
ref: combinedRef,
|
|
83
76
|
role: 'tablist',
|
|
@@ -20,13 +20,12 @@ var Panel = styled.div.withConfig({
|
|
|
20
20
|
}, focusVisible);
|
|
21
21
|
var TabPanel = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
22
22
|
var _a$active = _a.active,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
active = _a$active === void 0 ? false : _a$active,
|
|
24
|
+
children = _a.children,
|
|
25
|
+
id = _a.id,
|
|
26
|
+
className = _a.className,
|
|
27
|
+
htmlProps = _a.htmlProps,
|
|
28
|
+
rest = __rest(_a, ["active", "children", "id", "className", "htmlProps"]);
|
|
30
29
|
var panelProps = Object.assign(Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest)), {
|
|
31
30
|
ref: ref,
|
|
32
31
|
tabIndex: 0,
|
|
@@ -9,13 +9,11 @@ import { useTabsContext } from './Tabs.context.js';
|
|
|
9
9
|
|
|
10
10
|
var TabPanels = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
11
11
|
var children = _a.children,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
rest = __rest(_a, ["children"]);
|
|
14
13
|
var _useTabsContext = useTabsContext(),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
activeTab = _useTabsContext.activeTab,
|
|
15
|
+
tabsId = _useTabsContext.tabsId,
|
|
16
|
+
tabPanelsRef = _useTabsContext.tabPanelsRef;
|
|
19
17
|
var combinedRef = useCombinedRef(ref, tabPanelsRef);
|
|
20
18
|
var panelChildren = Children.map(children, function (child, index) {
|
|
21
19
|
var active = index === activeTab;
|
|
@@ -15,37 +15,31 @@ var Container = styled.div.withConfig({
|
|
|
15
15
|
});
|
|
16
16
|
var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
17
17
|
var id = props.id,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
activeTab = props.activeTab,
|
|
19
|
+
onChange = props.onChange,
|
|
20
|
+
_props$tabContentDire = props.tabContentDirection,
|
|
21
|
+
tabContentDirection = _props$tabContentDire === void 0 ? 'row' : _props$tabContentDire,
|
|
22
|
+
width = props.width,
|
|
23
|
+
children = props.children,
|
|
24
|
+
className = props.className,
|
|
25
|
+
htmlProps = props.htmlProps,
|
|
26
|
+
rest = __rest(props, ["id", "activeTab", "onChange", "tabContentDirection", "width", "children", "className", "htmlProps"]);
|
|
28
27
|
var generatedId = useId();
|
|
29
28
|
var uniqueId = id !== null && id !== void 0 ? id : "".concat(generatedId, "-tabs");
|
|
30
|
-
|
|
31
29
|
var _useState = useState(activeTab || 0),
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
thisActiveTab = _useState2[0],
|
|
32
|
+
setActiveTab = _useState2[1];
|
|
36
33
|
var _useState3 = useState(false),
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
35
|
+
hasTabFocus = _useState4[0],
|
|
36
|
+
setHasTabFocus = _useState4[1];
|
|
41
37
|
var tabListRef = useRef(null);
|
|
42
38
|
var tabPanelsRef = useRef(null);
|
|
43
|
-
|
|
44
39
|
var handleTabChange = function handleTabChange(index) {
|
|
45
40
|
setActiveTab(index);
|
|
46
41
|
onChange && onChange(index);
|
|
47
42
|
};
|
|
48
|
-
|
|
49
43
|
useEffect(function () {
|
|
50
44
|
if (activeTab !== undefined && activeTab !== thisActiveTab) {
|
|
51
45
|
setActiveTab(activeTab);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ddsBaseTokens } from '@norges-domstoler/dds-design-tokens';
|
|
2
2
|
|
|
3
3
|
var border = ddsBaseTokens.border,
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
spacing = ddsBaseTokens.spacing,
|
|
5
|
+
colors = ddsBaseTokens.colors;
|
|
6
6
|
var tabList = {
|
|
7
7
|
borderBottom: "".concat(border.BordersDdsBorderStyleLightStrokeWeight, " solid ").concat(border.BordersDdsBorderStyleLightStroke)
|
|
8
8
|
};
|
|
@@ -17,13 +17,12 @@ var Wrapper = styled(TextOverflowEllipsisWrapper).withConfig({
|
|
|
17
17
|
});
|
|
18
18
|
var Tag = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
19
19
|
var text = props.text,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
_props$purpose = props.purpose,
|
|
21
|
+
purpose = _props$purpose === void 0 ? 'default' : _props$purpose,
|
|
22
|
+
id = props.id,
|
|
23
|
+
className = props.className,
|
|
24
|
+
htmlProps = props.htmlProps,
|
|
25
|
+
rest = __rest(props, ["text", "purpose", "id", "className", "htmlProps"]);
|
|
27
26
|
return jsx(Wrapper, Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest), {
|
|
28
27
|
ref: ref,
|
|
29
28
|
purpose: purpose
|
|
@@ -2,8 +2,8 @@ import { ddsBaseTokens } from '@norges-domstoler/dds-design-tokens';
|
|
|
2
2
|
import { localMessageTokens } from '../LocalMessage/LocalMessage.tokens.js';
|
|
3
3
|
|
|
4
4
|
var colors = ddsBaseTokens.colors,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
borderRadius = ddsBaseTokens.borderRadius,
|
|
6
|
+
spacing = ddsBaseTokens.spacing;
|
|
7
7
|
var typographyType = 'bodySans01';
|
|
8
8
|
var wrapper = {
|
|
9
9
|
border: '1px solid',
|
|
@@ -28,46 +28,40 @@ var StyledTextArea = styled(StatefulInput).withConfig({
|
|
|
28
28
|
})(["", " ", " height:auto;resize:vertical;vertical-align:bottom;padding-bottom:", ";", ""], scrollbarStyling.webkit, scrollbarStyling.firefox, textarea.paddingBottom, getFontStyling(inputTypographyTypes.medium));
|
|
29
29
|
var TextArea = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
30
30
|
var id = props.id,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
31
|
+
value = props.value,
|
|
32
|
+
defaultValue = props.defaultValue,
|
|
33
|
+
onChange = props.onChange,
|
|
34
|
+
errorMessage = props.errorMessage,
|
|
35
|
+
required = props.required,
|
|
36
|
+
disabled = props.disabled,
|
|
37
|
+
tip = props.tip,
|
|
38
|
+
label = props.label,
|
|
39
|
+
ariaRequired = props['aria-required'],
|
|
40
|
+
ariaDescribedby = props['aria-describedby'],
|
|
41
|
+
className = props.className,
|
|
42
|
+
style = props.style,
|
|
43
|
+
_props$width = props.width,
|
|
44
|
+
width = _props$width === void 0 ? defaultWidth : _props$width,
|
|
45
|
+
rest = __rest(props, ["id", "value", "defaultValue", "onChange", "errorMessage", "required", "disabled", "tip", "label", 'aria-required', 'aria-describedby', "className", "style", "width"]);
|
|
47
46
|
var generatedId = useId();
|
|
48
47
|
var uniqueId = id !== null && id !== void 0 ? id : "".concat(generatedId, "-textArea");
|
|
49
48
|
var textAreaRef = useRef(null);
|
|
50
49
|
var multiRef = useCombinedRef(ref, textAreaRef);
|
|
51
|
-
|
|
52
50
|
var _useState = useState(getDefaultText(value, defaultValue)),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
+
text = _useState2[0],
|
|
53
|
+
setText = _useState2[1];
|
|
57
54
|
useEffect(function () {
|
|
58
55
|
if (textAreaRef && textAreaRef.current) {
|
|
59
56
|
textAreaRef.current.style.height = "".concat(textAreaRef.current.scrollHeight + 2, "px");
|
|
60
57
|
}
|
|
61
58
|
}, [text]);
|
|
62
|
-
|
|
63
59
|
var onChangeHandler = function onChangeHandler(event) {
|
|
64
60
|
setText(event.target.value);
|
|
65
|
-
|
|
66
61
|
if (onChange) {
|
|
67
62
|
onChange(event);
|
|
68
63
|
}
|
|
69
64
|
};
|
|
70
|
-
|
|
71
65
|
var hasErrorMessage = !!errorMessage;
|
|
72
66
|
var hasLabel = !!label;
|
|
73
67
|
var tipId = derivativeIdGenerator(uniqueId, 'tip');
|
|
@@ -18,15 +18,13 @@ var Wrapper = styled(Typography).withConfig({
|
|
|
18
18
|
displayName: "CharCounter__Wrapper",
|
|
19
19
|
componentId: "sc-qty1z2-0"
|
|
20
20
|
})(["margin-left:auto;"]);
|
|
21
|
-
|
|
22
21
|
function CharCounter(props) {
|
|
23
22
|
var current = props.current,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
max = props.max,
|
|
24
|
+
id = props.id,
|
|
25
|
+
className = props.className,
|
|
26
|
+
htmlProps = props.htmlProps,
|
|
27
|
+
rest = __rest(props, ["current", "max", "id", "className", "htmlProps"]);
|
|
30
28
|
var generatedId = useId();
|
|
31
29
|
var uniqueId = id !== null && id !== void 0 ? id : "".concat(generatedId, "-characterCounter");
|
|
32
30
|
return jsxs(Wrapper, Object.assign({}, getBaseHTMLProps(uniqueId, className, htmlProps, rest), {
|
|
@@ -20,56 +20,48 @@ import '../../utils/color.js';
|
|
|
20
20
|
|
|
21
21
|
var defaultWidth = '320px';
|
|
22
22
|
var defaultTinyWidth = '210px';
|
|
23
|
-
|
|
24
23
|
var getWidth = function getWidth(size, width) {
|
|
25
24
|
if (width) return width;
|
|
26
|
-
|
|
27
25
|
if (size === 'tiny') {
|
|
28
26
|
return defaultTinyWidth;
|
|
29
27
|
}
|
|
30
|
-
|
|
31
28
|
return defaultWidth;
|
|
32
29
|
};
|
|
33
|
-
|
|
34
30
|
var TextInput = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
35
31
|
var label = _a.label,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
32
|
+
disabled = _a.disabled,
|
|
33
|
+
readOnly = _a.readOnly,
|
|
34
|
+
errorMessage = _a.errorMessage,
|
|
35
|
+
tip = _a.tip,
|
|
36
|
+
required = _a.required,
|
|
37
|
+
maxLength = _a.maxLength,
|
|
38
|
+
onChange = _a.onChange,
|
|
39
|
+
id = _a.id,
|
|
40
|
+
width = _a.width,
|
|
41
|
+
_a$componentSize = _a.componentSize,
|
|
42
|
+
componentSize = _a$componentSize === void 0 ? 'medium' : _a$componentSize,
|
|
43
|
+
_a$type = _a.type,
|
|
44
|
+
type = _a$type === void 0 ? 'text' : _a$type,
|
|
45
|
+
_a$withCharacterCount = _a.withCharacterCounter,
|
|
46
|
+
withCharacterCounter = _a$withCharacterCount === void 0 ? true : _a$withCharacterCount,
|
|
47
|
+
className = _a.className,
|
|
48
|
+
style = _a.style,
|
|
49
|
+
value = _a.value,
|
|
50
|
+
defaultValue = _a.defaultValue,
|
|
51
|
+
ariaRequired = _a['aria-required'],
|
|
52
|
+
ariaDescribedby = _a['aria-describedby'],
|
|
53
|
+
icon = _a.icon,
|
|
54
|
+
rest = __rest(_a, ["label", "disabled", "readOnly", "errorMessage", "tip", "required", "maxLength", "onChange", "id", "width", "componentSize", "type", "withCharacterCounter", "className", "style", "value", "defaultValue", 'aria-required', 'aria-describedby', "icon"]);
|
|
60
55
|
var _useState = useState(getDefaultText(value, defaultValue)),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
57
|
+
text = _useState2[0],
|
|
58
|
+
setText = _useState2[1];
|
|
65
59
|
var onChangeHandler = function onChangeHandler(event) {
|
|
66
60
|
setText(event.target.value);
|
|
67
|
-
|
|
68
61
|
if (onChange) {
|
|
69
62
|
onChange(event);
|
|
70
63
|
}
|
|
71
64
|
};
|
|
72
|
-
|
|
73
65
|
var generatedId = useId();
|
|
74
66
|
var uniqueId = id !== null && id !== void 0 ? id : "".concat(generatedId, "-textInput");
|
|
75
67
|
var hasErrorMessage = !!errorMessage;
|
|
@@ -14,7 +14,7 @@ import { ddsBaseTokens } from '@norges-domstoler/dds-design-tokens';
|
|
|
14
14
|
|
|
15
15
|
var iconSizes = ddsBaseTokens.iconSizes;
|
|
16
16
|
var input = textInputTokens.input,
|
|
17
|
-
|
|
17
|
+
icon = textInputTokens.icon;
|
|
18
18
|
var MessageContainer = styled.div.withConfig({
|
|
19
19
|
displayName: "TextInputstyles__MessageContainer",
|
|
20
20
|
componentId: "sc-165zflr-0"
|
|
@@ -24,7 +24,7 @@ var StyledIcon = styled(Icon).withConfig({
|
|
|
24
24
|
componentId: "sc-165zflr-1"
|
|
25
25
|
})(["position:absolute;color:", ";", " z-index:1;"], icon.color, function (_ref) {
|
|
26
26
|
var size = _ref.size,
|
|
27
|
-
|
|
27
|
+
iconSize = _ref.iconSize;
|
|
28
28
|
return css(["left:", ";", ""], icon.sizes[size].left, iconSize === 'small' ? css(["top:", ";"], "calc(50% - ".concat(iconSizes.DdsIconsizeSmallNumberPx / 2, "px)")) : css(["top:", ";;"], "calc(50% - ".concat(iconSizes.DdsIconsizeMediumNumberPx / 2, "px)")));
|
|
29
29
|
});
|
|
30
30
|
var StyledInput = styled(StatefulInput).withConfig({
|
|
@@ -32,7 +32,7 @@ var StyledInput = styled(StatefulInput).withConfig({
|
|
|
32
32
|
componentId: "sc-165zflr-2"
|
|
33
33
|
})(["", ""], function (_ref2) {
|
|
34
34
|
var componentSize = _ref2.componentSize,
|
|
35
|
-
|
|
35
|
+
hasIcon = _ref2.hasIcon;
|
|
36
36
|
return hasIcon && componentSize && css(["padding-left:", ";"], input.withIcon[componentSize].paddingLeft);
|
|
37
37
|
});
|
|
38
38
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ddsBaseTokens } from '@norges-domstoler/dds-design-tokens';
|
|
2
2
|
|
|
3
3
|
var colors = ddsBaseTokens.colors,
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
spacing = ddsBaseTokens.spacing,
|
|
5
|
+
iconSizes = ddsBaseTokens.iconSizes;
|
|
6
6
|
var input = {
|
|
7
7
|
withIcon: {
|
|
8
8
|
medium: {
|
|
@@ -37,26 +37,23 @@ var Bar = styled.div.withConfig({
|
|
|
37
37
|
})(["display:grid;grid-auto-flow:column;grid-auto-columns:1fr;"]);
|
|
38
38
|
var ToggleBar = function ToggleBar(props) {
|
|
39
39
|
var children = props.children,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
_props$size = props.size,
|
|
41
|
+
size = _props$size === void 0 ? 'medium' : _props$size,
|
|
42
|
+
label = props.label,
|
|
43
|
+
onChange = props.onChange,
|
|
44
|
+
value = props.value,
|
|
45
|
+
name = props.name,
|
|
46
|
+
width = props.width,
|
|
47
|
+
htmlProps = props.htmlProps,
|
|
48
|
+
className = props.className,
|
|
49
|
+
id = props.id,
|
|
50
|
+
rest = __rest(props, ["children", "size", "label", "onChange", "value", "name", "width", "htmlProps", "className", "id"]);
|
|
52
51
|
var generatedId = useId();
|
|
53
52
|
var uniqueId = id !== null && id !== void 0 ? id : "".concat(generatedId, "-ToggleBar");
|
|
54
|
-
|
|
55
53
|
var _useState = useState(value),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
55
|
+
groupValue = _useState2[0],
|
|
56
|
+
setGroupValue = _useState2[1];
|
|
60
57
|
var handleChange = combineHandlers(function (e) {
|
|
61
58
|
return setGroupValue(e.target.value);
|
|
62
59
|
}, function (e) {
|
|
@@ -3,10 +3,10 @@ import { calculateHeightWithLineHeight } from '../../utils/text.js';
|
|
|
3
3
|
import '../../utils/color.js';
|
|
4
4
|
|
|
5
5
|
var colors = ddsBaseTokens.colors,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
spacing = ddsBaseTokens.spacing,
|
|
7
|
+
border = ddsBaseTokens.border,
|
|
8
|
+
borderRadius = ddsBaseTokens.borderRadius,
|
|
9
|
+
fontPackages = ddsBaseTokens.fontPackages;
|
|
10
10
|
var typographyTypes = {
|
|
11
11
|
large: 'bodySans04',
|
|
12
12
|
medium: 'bodySans02',
|
|
@@ -23,42 +23,34 @@ import { Label, Content } from './ToggleRadio.styles.js';
|
|
|
23
23
|
*
|
|
24
24
|
* Returnerer false hvis verdiene er ulike eller hvis verdien i ToggleRadio er falsy.
|
|
25
25
|
*/
|
|
26
|
-
|
|
27
26
|
var calculateChecked = function calculateChecked(value, group, checked) {
|
|
28
27
|
if (typeof checked !== 'undefined') return checked;
|
|
29
|
-
|
|
30
28
|
if (typeof value !== 'undefined' && value !== null && group) {
|
|
31
29
|
if (typeof value === 'number') {
|
|
32
30
|
return value === Number(group === null || group === void 0 ? void 0 : group.value);
|
|
33
31
|
}
|
|
34
|
-
|
|
35
32
|
return value === (group === null || group === void 0 ? void 0 : group.value);
|
|
36
33
|
}
|
|
37
|
-
|
|
38
34
|
return !!value;
|
|
39
35
|
};
|
|
40
|
-
|
|
41
36
|
var ToggleRadio = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
42
37
|
var value = props.value,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
38
|
+
name = props.name,
|
|
39
|
+
onChange = props.onChange,
|
|
40
|
+
checked = props.checked,
|
|
41
|
+
icon = props.icon,
|
|
42
|
+
label = props.label,
|
|
43
|
+
htmlProps = props.htmlProps,
|
|
44
|
+
className = props.className,
|
|
45
|
+
id = props.id,
|
|
46
|
+
rest = __rest(props, ["value", "name", "onChange", "checked", "icon", "label", "htmlProps", "className", "id"]);
|
|
53
47
|
var generatedId = useId();
|
|
54
48
|
var uniqueId = id !== null && id !== void 0 ? id : "".concat(generatedId, "-ToggleRadio");
|
|
55
49
|
var group = useToggleBarContext();
|
|
56
|
-
|
|
57
50
|
var handleChange = function handleChange(event) {
|
|
58
51
|
onChange && onChange(event);
|
|
59
52
|
group && group.onChange && group.onChange(event);
|
|
60
53
|
};
|
|
61
|
-
|
|
62
54
|
return jsxs(Label, Object.assign({
|
|
63
55
|
size: group.size,
|
|
64
56
|
htmlFor: uniqueId
|