@digdir/designsystemet-react 0.61.0 → 1.0.0-rc.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/cjs/components/Accordion/Accordion.js +6 -2
- package/dist/cjs/components/Accordion/AccordionContent/AccordionContent.js +2 -2
- package/dist/cjs/components/Accordion/AccordionHeader/AccordionHeader.js +2 -2
- package/dist/cjs/components/Accordion/AccordionItem/AccordionItem.js +2 -2
- package/dist/cjs/components/Alert/Alert.js +5 -3
- package/dist/cjs/components/Box/Box.js +4 -1
- package/dist/cjs/components/Button/Button.js +3 -1
- package/dist/cjs/components/Card/Card.js +3 -1
- package/dist/cjs/components/Chip/Group/Group.js +5 -1
- package/dist/cjs/components/Chip/Removable/Removable.js +3 -1
- package/dist/cjs/components/Chip/Toggle/Toggle.js +3 -1
- package/dist/cjs/components/Divider/Divider.js +2 -2
- package/dist/cjs/components/DropdownMenu/DropdownMenu.js +4 -2
- package/dist/cjs/components/DropdownMenu/DropdownMenuContent.js +3 -3
- package/dist/cjs/components/DropdownMenu/DropdownMenuItem.js +2 -2
- package/dist/cjs/components/DropdownMenu/DropdownMenuTrigger.js +1 -1
- package/dist/cjs/components/HelpText/HelpText.js +5 -3
- package/dist/cjs/components/Link/Link.js +1 -1
- package/dist/cjs/components/List/ListHeading.js +3 -3
- package/dist/cjs/components/List/ListItem.js +2 -2
- package/dist/cjs/components/List/ListRoot.js +4 -2
- package/dist/cjs/components/List/Lists.js +3 -3
- package/dist/cjs/components/Modal/ModalDialog.js +1 -1
- package/dist/cjs/components/Modal/ModalHeader.js +1 -1
- package/dist/cjs/components/Pagination/Pagination.js +6 -4
- package/dist/cjs/components/Pagination/PaginationButton.js +1 -1
- package/dist/cjs/components/Pagination/PaginationRoot.js +4 -2
- package/dist/cjs/components/Popover/Popover.js +4 -2
- package/dist/cjs/components/Popover/PopoverContent.js +6 -6
- package/dist/cjs/components/Popover/PopoverTrigger.js +1 -1
- package/dist/cjs/components/Skeleton/Circle/Circle.js +2 -2
- package/dist/cjs/components/Skeleton/Rectangle/Rectangle.js +2 -2
- package/dist/cjs/components/Skeleton/Text/Text.js +2 -2
- package/dist/cjs/components/SkipLink/SkipLink.js +2 -2
- package/dist/cjs/components/Spinner/Spinner.js +9 -7
- package/dist/cjs/components/Table/Table.js +3 -1
- package/dist/cjs/components/Tabs/Tab/Tab.js +3 -3
- package/dist/cjs/components/Tabs/Tab/useTab.js +1 -3
- package/dist/cjs/components/Tabs/TabList/TabList.js +2 -2
- package/dist/cjs/components/Tabs/Tabs.js +5 -2
- package/dist/cjs/components/Tag/Tag.js +5 -1
- package/dist/cjs/components/ToggleGroup/ToggleGroup.js +3 -1
- package/dist/cjs/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.js +3 -3
- package/dist/cjs/components/Tooltip/Tooltip.js +9 -9
- package/dist/cjs/components/Typography/ErrorMessage/ErrorMessage.js +5 -3
- package/dist/cjs/components/Typography/Heading/Heading.js +5 -3
- package/dist/cjs/components/Typography/Ingress/Ingress.js +5 -3
- package/dist/cjs/components/Typography/Label/Label.js +5 -3
- package/dist/cjs/components/Typography/Paragraph/Paragraph.js +5 -3
- package/dist/cjs/components/form/Checkbox/Checkbox.js +2 -2
- package/dist/cjs/components/form/Checkbox/Group/Group.js +1 -1
- package/dist/cjs/components/form/Combobox/Combobox.js +6 -4
- package/dist/cjs/components/form/Combobox/Custom.js +1 -1
- package/dist/cjs/components/form/Combobox/Option/useComboboxOption.js +1 -1
- package/dist/cjs/components/form/Combobox/internal/ComboboxInput.js +2 -2
- package/dist/cjs/components/form/Combobox/useFloatingCombobox.js +3 -3
- package/dist/cjs/components/form/Fieldset/Fieldset.js +2 -2
- package/dist/cjs/components/form/NativeSelect/NativeSelect.js +3 -3
- package/dist/cjs/components/form/NativeSelect/useNativeSelect.js +3 -1
- package/dist/cjs/components/form/Radio/Group/Group.js +3 -3
- package/dist/cjs/components/form/Radio/Radio.js +3 -3
- package/dist/cjs/components/form/Search/Search.js +5 -5
- package/dist/cjs/components/form/Search/useSearch.js +3 -7
- package/dist/cjs/components/form/Switch/Switch.js +1 -1
- package/dist/cjs/components/form/Textarea/Textarea.js +4 -4
- package/dist/cjs/components/form/Textarea/useTextarea.js +3 -1
- package/dist/cjs/components/form/Textfield/Textfield.js +6 -6
- package/dist/cjs/components/form/Textfield/useTextfield.js +3 -1
- package/dist/cjs/components/form/useFormField.js +5 -7
- package/dist/cjs/{packages/react/node_modules → node_modules}/@floating-ui/dom/dist/floating-ui.dom.js +3 -3
- package/dist/cjs/{packages/react/node_modules → node_modules}/@floating-ui/react/dist/floating-ui.react.js +2 -2
- package/dist/cjs/{packages/react/node_modules → node_modules}/@floating-ui/react/dist/floating-ui.react.utils.js +1 -1
- package/dist/cjs/node_modules/@radix-ui/react-slot/dist/index.js +1 -1
- package/dist/cjs/utilities/AnimateHeight/AnimateHeight.js +2 -2
- package/dist/cjs/utilities/RovingTabIndex/RovingTabindexItem.js +1 -1
- package/dist/cjs/utilities/RovingTabIndex/RovingTabindexRoot.js +1 -1
- package/dist/cjs/utilities/getColor.js +27 -0
- package/dist/cjs/utilities/getSize.js +2 -0
- package/dist/esm/components/Accordion/Accordion.js +6 -2
- package/dist/esm/components/Accordion/AccordionContent/AccordionContent.js +2 -2
- package/dist/esm/components/Accordion/AccordionHeader/AccordionHeader.js +2 -2
- package/dist/esm/components/Accordion/AccordionItem/AccordionItem.js +1 -1
- package/dist/esm/components/Alert/Alert.js +4 -2
- package/dist/esm/components/Box/Box.js +4 -1
- package/dist/esm/components/Button/Button.js +3 -1
- package/dist/esm/components/Card/Card.js +3 -1
- package/dist/esm/components/Chip/Group/Group.js +5 -1
- package/dist/esm/components/Chip/Removable/Removable.js +3 -1
- package/dist/esm/components/Chip/Toggle/Toggle.js +3 -1
- package/dist/esm/components/Divider/Divider.js +1 -1
- package/dist/esm/components/DropdownMenu/DropdownMenu.js +4 -2
- package/dist/esm/components/DropdownMenu/DropdownMenuContent.js +3 -3
- package/dist/esm/components/DropdownMenu/DropdownMenuItem.js +2 -2
- package/dist/esm/components/DropdownMenu/DropdownMenuTrigger.js +1 -1
- package/dist/esm/components/HelpText/HelpText.js +4 -2
- package/dist/esm/components/Link/Link.js +1 -1
- package/dist/esm/components/List/ListHeading.js +3 -3
- package/dist/esm/components/List/ListItem.js +1 -1
- package/dist/esm/components/List/ListRoot.js +4 -2
- package/dist/esm/components/List/Lists.js +1 -1
- package/dist/esm/components/Modal/ModalDialog.js +1 -1
- package/dist/esm/components/Modal/ModalHeader.js +1 -1
- package/dist/esm/components/Pagination/Pagination.js +6 -4
- package/dist/esm/components/Pagination/PaginationButton.js +1 -1
- package/dist/esm/components/Pagination/PaginationRoot.js +4 -2
- package/dist/esm/components/Popover/Popover.js +4 -2
- package/dist/esm/components/Popover/PopoverContent.js +4 -4
- package/dist/esm/components/Popover/PopoverTrigger.js +1 -1
- package/dist/esm/components/Skeleton/Circle/Circle.js +1 -1
- package/dist/esm/components/Skeleton/Rectangle/Rectangle.js +1 -1
- package/dist/esm/components/Skeleton/Text/Text.js +1 -1
- package/dist/esm/components/SkipLink/SkipLink.js +1 -1
- package/dist/esm/components/Spinner/Spinner.js +9 -7
- package/dist/esm/components/Table/Table.js +3 -1
- package/dist/esm/components/Tabs/Tab/Tab.js +3 -3
- package/dist/esm/components/Tabs/Tab/useTab.js +1 -3
- package/dist/esm/components/Tabs/TabList/TabList.js +1 -1
- package/dist/esm/components/Tabs/Tabs.js +5 -2
- package/dist/esm/components/Tag/Tag.js +5 -1
- package/dist/esm/components/ToggleGroup/ToggleGroup.js +3 -1
- package/dist/esm/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.js +3 -3
- package/dist/esm/components/Tooltip/Tooltip.js +9 -9
- package/dist/esm/components/Typography/ErrorMessage/ErrorMessage.js +4 -2
- package/dist/esm/components/Typography/Heading/Heading.js +4 -2
- package/dist/esm/components/Typography/Ingress/Ingress.js +4 -2
- package/dist/esm/components/Typography/Label/Label.js +4 -2
- package/dist/esm/components/Typography/Paragraph/Paragraph.js +4 -2
- package/dist/esm/components/form/Checkbox/Checkbox.js +2 -2
- package/dist/esm/components/form/Checkbox/Group/Group.js +1 -1
- package/dist/esm/components/form/Combobox/Combobox.js +6 -4
- package/dist/esm/components/form/Combobox/Custom.js +1 -1
- package/dist/esm/components/form/Combobox/Option/useComboboxOption.js +1 -1
- package/dist/esm/components/form/Combobox/internal/ComboboxInput.js +2 -2
- package/dist/esm/components/form/Combobox/useFloatingCombobox.js +3 -3
- package/dist/esm/components/form/Fieldset/Fieldset.js +1 -1
- package/dist/esm/components/form/NativeSelect/NativeSelect.js +2 -2
- package/dist/esm/components/form/NativeSelect/useNativeSelect.js +3 -1
- package/dist/esm/components/form/Radio/Group/Group.js +2 -2
- package/dist/esm/components/form/Radio/Radio.js +2 -2
- package/dist/esm/components/form/Search/Search.js +3 -3
- package/dist/esm/components/form/Search/useSearch.js +3 -7
- package/dist/esm/components/form/Switch/Switch.js +1 -1
- package/dist/esm/components/form/Textarea/Textarea.js +2 -2
- package/dist/esm/components/form/Textarea/useTextarea.js +3 -1
- package/dist/esm/components/form/Textfield/Textfield.js +3 -3
- package/dist/esm/components/form/Textfield/useTextfield.js +3 -1
- package/dist/esm/components/form/useFormField.js +5 -7
- package/dist/esm/{packages/react/node_modules → node_modules}/@floating-ui/dom/dist/floating-ui.dom.js +4 -4
- package/dist/esm/{packages/react/node_modules → node_modules}/@floating-ui/react/dist/floating-ui.react.js +2 -2
- package/dist/esm/{packages/react/node_modules → node_modules}/@floating-ui/react/dist/floating-ui.react.utils.js +1 -1
- package/dist/esm/node_modules/@radix-ui/react-slot/dist/index.js +1 -1
- package/dist/esm/utilities/AnimateHeight/AnimateHeight.js +1 -1
- package/dist/esm/utilities/RovingTabIndex/RovingTabindexItem.js +1 -1
- package/dist/esm/utilities/RovingTabIndex/RovingTabindexRoot.js +1 -1
- package/dist/esm/utilities/getColor.js +25 -0
- package/dist/esm/utilities/getSize.js +2 -0
- package/dist/types/components/Accordion/Accordion.d.ts +4 -2
- package/dist/types/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/types/components/Alert/Alert.d.ts +13 -6
- package/dist/types/components/Alert/Alert.d.ts.map +1 -1
- package/dist/types/components/Box/Box.d.ts +7 -4
- package/dist/types/components/Box/Box.d.ts.map +1 -1
- package/dist/types/components/Button/Button.d.ts +13 -6
- package/dist/types/components/Button/Button.d.ts.map +1 -1
- package/dist/types/components/Card/Card.d.ts +4 -2
- package/dist/types/components/Card/Card.d.ts.map +1 -1
- package/dist/types/components/Chip/Group/Group.d.ts +9 -3
- package/dist/types/components/Chip/Group/Group.d.ts.map +1 -1
- package/dist/types/components/Chip/Removable/Removable.d.ts +9 -6
- package/dist/types/components/Chip/Removable/Removable.d.ts.map +1 -1
- package/dist/types/components/Chip/Toggle/Toggle.d.ts +9 -6
- package/dist/types/components/Chip/Toggle/Toggle.d.ts.map +1 -1
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +7 -4
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/types/components/DropdownMenu/DropdownMenuTrigger.d.ts +1 -1
- package/dist/types/components/HelpText/HelpText.d.ts +4 -3
- package/dist/types/components/HelpText/HelpText.d.ts.map +1 -1
- package/dist/types/components/Link/Link.d.ts +8 -2
- package/dist/types/components/Link/Link.d.ts.map +1 -1
- package/dist/types/components/List/ListHeading.d.ts +1 -1
- package/dist/types/components/List/ListRoot.d.ts +15 -9
- package/dist/types/components/List/ListRoot.d.ts.map +1 -1
- package/dist/types/components/Modal/ModalTrigger.d.ts +1 -1
- package/dist/types/components/Pagination/Pagination.d.ts +12 -4
- package/dist/types/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/types/components/Pagination/PaginationButton.d.ts.map +1 -1
- package/dist/types/components/Pagination/PaginationNextPrev.d.ts +2 -2
- package/dist/types/components/Pagination/PaginationNextPrev.d.ts.map +1 -1
- package/dist/types/components/Pagination/PaginationRoot.d.ts +7 -4
- package/dist/types/components/Pagination/PaginationRoot.d.ts.map +1 -1
- package/dist/types/components/Popover/Popover.d.ts +8 -4
- package/dist/types/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/components/Popover/PopoverTrigger.d.ts +1 -1
- package/dist/types/components/Spinner/Spinner.d.ts +10 -3
- package/dist/types/components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/types/components/Table/Table.d.ts +8 -4
- package/dist/types/components/Table/Table.d.ts.map +1 -1
- package/dist/types/components/Tabs/Tab/Tab.d.ts.map +1 -1
- package/dist/types/components/Tabs/Tab/useTab.d.ts +1 -3
- package/dist/types/components/Tabs/Tab/useTab.d.ts.map +1 -1
- package/dist/types/components/Tabs/Tabs.d.ts +14 -4
- package/dist/types/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/types/components/Tag/Tag.d.ts +12 -7
- package/dist/types/components/Tag/Tag.d.ts.map +1 -1
- package/dist/types/components/ToggleGroup/ToggleGroup.d.ts +14 -5
- package/dist/types/components/ToggleGroup/ToggleGroup.d.ts.map +1 -1
- package/dist/types/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.d.ts.map +1 -1
- package/dist/types/components/ToggleGroup/ToggleGroupItem/useToggleGroupitem.d.ts +2 -1
- package/dist/types/components/ToggleGroup/ToggleGroupItem/useToggleGroupitem.d.ts.map +1 -1
- package/dist/types/components/Tooltip/Tooltip.d.ts +14 -3
- package/dist/types/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/components/Typography/ErrorMessage/ErrorMessage.d.ts +14 -4
- package/dist/types/components/Typography/ErrorMessage/ErrorMessage.d.ts.map +1 -1
- package/dist/types/components/Typography/Heading/Heading.d.ts +10 -4
- package/dist/types/components/Typography/Heading/Heading.d.ts.map +1 -1
- package/dist/types/components/Typography/Ingress/Ingress.d.ts +8 -4
- package/dist/types/components/Typography/Ingress/Ingress.d.ts.map +1 -1
- package/dist/types/components/Typography/Label/Label.d.ts +15 -4
- package/dist/types/components/Typography/Label/Label.d.ts.map +1 -1
- package/dist/types/components/Typography/Paragraph/Paragraph.d.ts +18 -4
- package/dist/types/components/Typography/Paragraph/Paragraph.d.ts.map +1 -1
- package/dist/types/components/form/CharacterCounter.d.ts +2 -1
- package/dist/types/components/form/CharacterCounter.d.ts.map +1 -1
- package/dist/types/components/form/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/types/components/form/Checkbox/Group/Group.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Combobox.d.ts +2 -2
- package/dist/types/components/form/Combobox/Combobox.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Option/useComboboxOption.d.ts +1 -1
- package/dist/types/components/form/Fieldset/useFieldset.d.ts +1 -1
- package/dist/types/components/form/NativeSelect/NativeSelect.d.ts +10 -6
- package/dist/types/components/form/NativeSelect/NativeSelect.d.ts.map +1 -1
- package/dist/types/components/form/NativeSelect/useNativeSelect.d.ts.map +1 -1
- package/dist/types/components/form/Search/Search.d.ts +12 -6
- package/dist/types/components/form/Search/Search.d.ts.map +1 -1
- package/dist/types/components/form/Search/useSearch.d.ts +1 -3
- package/dist/types/components/form/Search/useSearch.d.ts.map +1 -1
- package/dist/types/components/form/Textarea/Textarea.d.ts +10 -10
- package/dist/types/components/form/Textarea/Textarea.d.ts.map +1 -1
- package/dist/types/components/form/Textarea/useTextarea.d.ts.map +1 -1
- package/dist/types/components/form/Textfield/Textfield.d.ts +14 -4
- package/dist/types/components/form/Textfield/Textfield.d.ts.map +1 -1
- package/dist/types/components/form/Textfield/useTextfield.d.ts.map +1 -1
- package/dist/types/components/form/useFormField.d.ts +8 -2
- package/dist/types/components/form/useFormField.d.ts.map +1 -1
- package/dist/types/utilities/getColor.d.ts +2 -0
- package/dist/types/utilities/getColor.d.ts.map +1 -0
- package/dist/types/utilities/getSize.d.ts +1 -1
- package/dist/types/utilities/getSize.d.ts.map +1 -1
- package/dist/types/utilities/index.d.ts +2 -0
- package/dist/types/utilities/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/cjs/node_modules/clsx/dist/clsx.js +0 -9
- package/dist/esm/node_modules/clsx/dist/clsx.js +0 -4
- /package/dist/cjs/node_modules/{@radix-ui/react-slot/node_modules/@babel → @babel}/runtime/helpers/esm/extends.js +0 -0
- /package/dist/cjs/{packages/react/node_modules → node_modules}/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -0
- /package/dist/cjs/{packages/react/node_modules → node_modules}/tabbable/dist/index.esm.js +0 -0
- /package/dist/esm/node_modules/{@radix-ui/react-slot/node_modules/@babel → @babel}/runtime/helpers/esm/extends.js +0 -0
- /package/dist/esm/{packages/react/node_modules → node_modules}/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -0
- /package/dist/esm/{packages/react/node_modules → node_modules}/tabbable/dist/index.esm.js +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef, useRef, useId, useState, useEffect } from 'react';
|
|
4
|
-
import { FloatingPortal, FloatingFocusManager } from '../../../
|
|
4
|
+
import { FloatingPortal, FloatingFocusManager } from '../../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
5
5
|
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
6
6
|
import { useVirtualizer } from '../../../node_modules/@tanstack/react-virtual/dist/esm/index.js';
|
|
7
7
|
import { useFormField } from '../useFormField.js';
|
|
8
8
|
import useDebounce from '../../../utilities/useDebounce.js';
|
|
9
|
+
import { getSize } from '../../../utilities/getSize.js';
|
|
9
10
|
import useCombobox from './useCombobox.js';
|
|
10
11
|
import ComboboxInput from './internal/ComboboxInput.js';
|
|
11
12
|
import ComboboxLabel from './internal/ComboboxLabel.js';
|
|
@@ -20,7 +21,8 @@ import { Box } from '../../Box/Box.js';
|
|
|
20
21
|
import { Spinner } from '../../Spinner/Spinner.js';
|
|
21
22
|
import { omit } from '../../../utilities/objectUtils.js';
|
|
22
23
|
|
|
23
|
-
const ComboboxComponent = forwardRef(({ value, initialValue = [], onValueChange, label, hideLabel = false, description, multiple = false,
|
|
24
|
+
const ComboboxComponent = forwardRef(({ value, initialValue = [], onValueChange, label, hideLabel = false, description, multiple = false, disabled = false, readOnly = false, hideChips = false, clearButtonLabel = 'Fjern alt', hideClearButton = false, error, errorId, id, name, portal = true, htmlSize = 0, virtual = false, children, style, loading, loadingLabel = 'Laster...', filter, chipSrLabel = (option) => 'Slett ' + option.label, className, ...rest }, forwareddRef) => {
|
|
25
|
+
const size = getSize(rest.size || 'md');
|
|
24
26
|
const inputRef = useRef(null);
|
|
25
27
|
const portalRef = useRef(null);
|
|
26
28
|
const listRef = useRef([]);
|
|
@@ -167,7 +169,7 @@ const ComboboxComponent = forwardRef(({ value, initialValue = [], onValueChange,
|
|
|
167
169
|
chipSrLabel,
|
|
168
170
|
listRef,
|
|
169
171
|
forwareddRef,
|
|
170
|
-
}, children: [jsxs(Box, { className: clsx('fds-combobox', `fds-combobox--${size}`, disabled && 'fds-combobox__disabled', className), style: style, ref: portalRef, children: [name && (jsx(ComboboxNative, { name: name, selectedOptions: selectedOptions, multiple: multiple })), jsx(ComboboxLabel, { label: label, description: description, size: size, readOnly: readOnly, hideLabel: hideLabel, formFieldProps: formFieldProps }), jsx(ComboboxInput, { ...omit(['inputValue'], rest), hideClearButton: hideClearButton, listId: listId, error: error, hideChips: hideChips, handleKeyDown: handleKeyDown, "aria-busy": loading }), jsx(ComboboxError, { size: size, error: error, formFieldProps: formFieldProps })] }), open && (jsx(FloatingPortal, { root: portal ? null : portalRef, children: jsx(FloatingFocusManager, { context: context, initialFocus: -1, visuallyHiddenDismiss: true, children: jsxs(Box, { id: listId, shadow: '
|
|
172
|
+
}, children: [jsxs(Box, { className: clsx('fds-combobox', `fds-combobox--${size}`, disabled && 'fds-combobox__disabled', className), style: style, ref: portalRef, children: [name && (jsx(ComboboxNative, { name: name, selectedOptions: selectedOptions, multiple: multiple })), jsx(ComboboxLabel, { label: label, description: description, size: size, readOnly: readOnly, hideLabel: hideLabel, formFieldProps: formFieldProps }), jsx(ComboboxInput, { ...omit(['inputValue'], rest), hideClearButton: hideClearButton, listId: listId, error: error, hideChips: hideChips, handleKeyDown: handleKeyDown, "aria-busy": loading }), jsx(ComboboxError, { size: size, error: error, formFieldProps: formFieldProps })] }), open && (jsx(FloatingPortal, { root: portal ? null : portalRef, children: jsx(FloatingFocusManager, { context: context, initialFocus: -1, visuallyHiddenDismiss: true, children: jsxs(Box, { id: listId, shadow: 'md', borderRadius: 'md', borderColor: 'default', "aria-labelledby": formFieldProps.inputProps.id, "aria-autocomplete": 'list', tabIndex: -1, ...getFloatingProps({
|
|
171
173
|
ref: refs.setFloating,
|
|
172
174
|
style: {
|
|
173
175
|
...floatingStyles,
|
|
@@ -182,7 +184,7 @@ const ComboboxComponent = forwardRef(({ value, initialValue = [], onValueChange,
|
|
|
182
184
|
left: 0,
|
|
183
185
|
width: '100%',
|
|
184
186
|
transform: `translateY(${virtualRow.start}px)`,
|
|
185
|
-
}, children: filteredOptionsChildren[virtualRow.index] }, virtualRow.index))) })), loading ? (jsxs(ComboboxCustom, { className: 'fds-combobox__loading', children: [jsx(Spinner, { title: 'Laster', size: '
|
|
187
|
+
}, children: filteredOptionsChildren[virtualRow.index] }, virtualRow.index))) })), loading ? (jsxs(ComboboxCustom, { className: 'fds-combobox__loading', children: [jsx(Spinner, { title: 'Laster', size: 'sm' }), loadingLabel] })) : (jsxs(Fragment, { children: [restChildren, !virtual && filteredOptionsChildren] }))] }) }) }))] }));
|
|
186
188
|
});
|
|
187
189
|
const Combobox = forwardRef((props, ref) => (jsx(ComboboxIdProvider, { children: jsx(ComboboxComponent, { ...props, ref: ref }) })));
|
|
188
190
|
Combobox.displayName = 'Combobox';
|
|
@@ -3,7 +3,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef, useId, useContext, useMemo } from 'react';
|
|
4
4
|
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
|
-
import { useMergeRefs } from '../../../
|
|
6
|
+
import { useMergeRefs } from '../../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
7
7
|
import { ComboboxContext } from './ComboboxContext.js';
|
|
8
8
|
import { useComboboxId } from './ComboboxIdContext.js';
|
|
9
9
|
import { omit } from '../../../utilities/objectUtils.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useId, useContext, useMemo, useEffect } from 'react';
|
|
3
|
-
import { useMergeRefs } from '../../../../
|
|
3
|
+
import { useMergeRefs } from '../../../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
4
4
|
import { ComboboxContext } from '../ComboboxContext.js';
|
|
5
5
|
import useDebounce from '../../../../utilities/useDebounce.js';
|
|
6
6
|
import { useComboboxId, useComboboxIdDispatch } from '../ComboboxIdContext.js';
|
|
@@ -3,7 +3,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useContext } from 'react';
|
|
4
4
|
import { clsx } from '../../../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { ChevronUpIcon, ChevronDownIcon } from '@navikt/aksel-icons';
|
|
6
|
-
import { useMergeRefs } from '../../../../
|
|
6
|
+
import { useMergeRefs } from '../../../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
7
7
|
import { ComboboxContext } from '../ComboboxContext.js';
|
|
8
8
|
import { useComboboxIdDispatch } from '../ComboboxIdContext.js';
|
|
9
9
|
import ComboboxChips from './ComboboxChips.js';
|
|
@@ -62,7 +62,7 @@ const ComboboxInput = ({ hideClearButton, listId, error, hideChips, handleKeyDow
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
});
|
|
65
|
-
return (jsxs(Box, { ...props, "aria-disabled": disabled, className: clsx('fds-textfield__input', 'fds-combobox__input__wrapper', readOnly && 'fds-combobox--readonly', error && 'fds-combobox--error'), children: [jsxs("div", { className: 'fds-combobox__chip-and-input', children: [multiple && !hideChips && jsx(ComboboxChips, {}), jsx("input", { ref: mergedRefs, "aria-activedescendant": props['aria-activedescendant'], readOnly: readOnly, "aria-autocomplete": 'list', role: 'combobox', "aria-expanded": open, "aria-controls": listId, autoComplete: 'off', size: htmlSize, value: inputValue, ...omit(['style', 'className'], rest), ...formFieldProps.inputProps, className: 'fds-combobox__input', onChange: (e) => {
|
|
65
|
+
return (jsxs(Box, { ...props, "aria-disabled": disabled ? 'true' : undefined, className: clsx('fds-textfield__input', 'fds-combobox__input__wrapper', readOnly && 'fds-combobox--readonly', error && 'fds-combobox--error'), children: [jsxs("div", { className: 'fds-combobox__chip-and-input', children: [multiple && !hideChips && jsx(ComboboxChips, {}), jsx("input", { ref: mergedRefs, "aria-activedescendant": props['aria-activedescendant'], readOnly: readOnly, "aria-autocomplete": 'list', role: 'combobox', "aria-expanded": open, "aria-controls": listId, autoComplete: 'off', size: htmlSize, value: inputValue, ...omit(['style', 'className'], rest), ...formFieldProps.inputProps, className: 'fds-combobox__input', onChange: (e) => {
|
|
66
66
|
onChange(e);
|
|
67
67
|
!open && setOpen(true);
|
|
68
68
|
rest.onChange && rest.onChange(e);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useFloating, useRole, useDismiss, useListNavigation, useInteractions } from '../../../
|
|
2
|
+
import { useFloating, useRole, useDismiss, useListNavigation, useInteractions } from '../../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { flushSync } from 'react-dom';
|
|
5
5
|
import { useComboboxId, useComboboxIdDispatch } from './ComboboxIdContext.js';
|
|
6
|
-
import { autoUpdate, flip, size } from '../../../
|
|
6
|
+
import { autoUpdate, flip, size } from '../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js';
|
|
7
7
|
import { offset } from '../../../node_modules/@floating-ui/core/dist/floating-ui.core.js';
|
|
8
8
|
|
|
9
9
|
const useFloatingCombobox = ({ listRef }) => {
|
|
@@ -37,7 +37,7 @@ const useFloatingCombobox = ({ listRef }) => {
|
|
|
37
37
|
apply({ rects, elements }) {
|
|
38
38
|
requestAnimationFrame(() => {
|
|
39
39
|
Object.assign(elements.floating.style, {
|
|
40
|
-
width: `calc(${rects.reference.width}px - calc(var(--
|
|
40
|
+
width: `calc(${rects.reference.width}px - calc(var(--ds-spacing-2) * 2))`,
|
|
41
41
|
maxHeight: `200px`,
|
|
42
42
|
});
|
|
43
43
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef, useContext } from 'react';
|
|
4
|
-
import { clsx } from '../../../node_modules/clsx/dist/
|
|
4
|
+
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { PadlockLockedFillIcon } from '@navikt/aksel-icons';
|
|
6
6
|
import { useFieldset } from './useFieldset.js';
|
|
7
7
|
import { FieldsetContext } from './FieldsetContext.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
-
import { clsx } from '../../../node_modules/clsx/dist/
|
|
4
|
+
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { PadlockLockedFillIcon } from '@navikt/aksel-icons';
|
|
6
6
|
import { useNativeSelect } from './useNativeSelect.js';
|
|
7
7
|
import { Label } from '../../Typography/Label/Label.js';
|
|
@@ -11,7 +11,7 @@ import { Paragraph } from '../../Typography/Paragraph/Paragraph.js';
|
|
|
11
11
|
|
|
12
12
|
const NativeSelect = forwardRef((props, ref) => {
|
|
13
13
|
const { children, disabled = false, label, description, hideLabel = false, error, className, htmlSize = 0, ...rest } = props;
|
|
14
|
-
const { selectProps, descriptionId, errorId, readOnly = false, size = '
|
|
14
|
+
const { selectProps, descriptionId, errorId, readOnly = false, size = 'md', } = useNativeSelect(props);
|
|
15
15
|
return (jsx(Paragraph, { asChild: true, size: size, children: jsxs("div", { className: clsx('fds-native-select--container', disabled && 'fds-native-select--disabled', readOnly && 'fds-native-select--readonly', error && 'fds-native-select--error'), children: [label && (jsxs(Label, { weight: 'medium', size: size, htmlFor: selectProps.id, className: clsx('fds-native-select__label', hideLabel && 'fds-sr-only'), children: [readOnly && (jsx(PadlockLockedFillIcon, { "aria-hidden": true, className: 'fds-native-select__readonly__icon' })), label] })), description && (jsx(Paragraph, { asChild: true, size: size, children: jsx("div", { id: descriptionId, className: clsx(`fds-native-select__description`, hideLabel && `fds-sr-only`), children: description }) })), jsx("select", { disabled: disabled || readOnly, ref: ref, size: htmlSize, className: clsx('fds-native-select', `fds-native-select--${size}`, `fds-focus`, props.multiple && 'fds-native-select--multiple', className), ...omit(['size', 'error', 'errorId'], rest), ...omit(['readOnly', 'disabled'], selectProps), children: children }), error && (jsx("div", { id: errorId, className: 'fds-native-select__error-message', "aria-live": 'polite', "aria-relevant": 'additions removals', children: jsx(ErrorMessage, { size: size, children: error }) }))] }) }));
|
|
16
16
|
});
|
|
17
17
|
NativeSelect.displayName = 'NativeSelect';
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
import { useContext } from 'react';
|
|
3
3
|
import { useFormField } from '../useFormField.js';
|
|
4
4
|
import { FieldsetContext } from '../Fieldset/FieldsetContext.js';
|
|
5
|
+
import { getSize } from '../../../utilities/getSize.js';
|
|
5
6
|
|
|
6
7
|
/** Handles props for `NativeSelect` in context with `Fieldset` */
|
|
7
8
|
const useNativeSelect = (props) => {
|
|
8
9
|
const fieldset = useContext(FieldsetContext);
|
|
9
10
|
const { inputProps: selectProps, readOnly, ...rest } = useFormField(props, 'select');
|
|
11
|
+
const size = getSize(fieldset?.size ?? props.size ?? 'md');
|
|
10
12
|
return {
|
|
11
13
|
...rest,
|
|
12
14
|
readOnly,
|
|
13
|
-
size
|
|
15
|
+
size,
|
|
14
16
|
selectProps: {
|
|
15
17
|
...selectProps,
|
|
16
18
|
readOnly,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { createContext, forwardRef, useId } from 'react';
|
|
4
|
-
import { clsx } from '../../../../node_modules/clsx/dist/
|
|
4
|
+
import { clsx } from '../../../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { Fieldset } from '../../Fieldset/Fieldset.js';
|
|
6
6
|
|
|
7
7
|
const RadioGroupContext = createContext(null);
|
|
8
|
-
const RadioGroup = forwardRef(({ onChange, children, value, readOnly, defaultValue, name, size = '
|
|
8
|
+
const RadioGroup = forwardRef(({ onChange, children, value, readOnly, defaultValue, name, size = 'md', required, inline, className, ...rest }, ref) => {
|
|
9
9
|
const nameId = useId();
|
|
10
10
|
return (jsx(Fieldset, { readOnly: readOnly, size: size, className: className, ref: ref, ...rest, children: jsx(RadioGroupContext.Provider, { value: {
|
|
11
11
|
value,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
-
import { clsx } from '../../../node_modules/clsx/dist/
|
|
4
|
+
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { useRadio } from './useRadio.js';
|
|
6
6
|
import { Paragraph } from '../../Typography/Paragraph/Paragraph.js';
|
|
7
7
|
import { omit } from '../../../utilities/objectUtils.js';
|
|
@@ -9,7 +9,7 @@ import { Label } from '../../Typography/Label/Label.js';
|
|
|
9
9
|
|
|
10
10
|
const Radio = forwardRef((props, ref) => {
|
|
11
11
|
const { children, description, className, style, ...rest } = props;
|
|
12
|
-
const { inputProps, descriptionId, hasError, size = '
|
|
12
|
+
const { inputProps, descriptionId, hasError, size = 'md', readOnly, } = useRadio(props);
|
|
13
13
|
return (jsx(Paragraph, { asChild: true, size: size, children: jsxs("div", { className: clsx('fds-radio', `fds-radio--${size}`, inputProps.disabled && `fds-radio--disabled`, hasError && `fds-radio--error`, readOnly && `fds-radio--readonly`, className), style: style, children: [jsx("input", { className: 'fds-radio__input', ref: ref, ...omit(['size', 'error'], rest), ...inputProps }), children && (jsxs(Fragment, { children: [jsx(Label, { className: 'fds-radio__label', htmlFor: inputProps.id, size: size, weight: 'regular', children: jsx("span", { children: children }) }), description && (jsx(Paragraph, { asChild: true, size: size, children: jsx("div", { id: descriptionId, className: 'fds-radio__description', children: description }) }))] }))] }) }));
|
|
14
14
|
});
|
|
15
15
|
Radio.displayName = 'Radio';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef, useRef, useState, useCallback } from 'react';
|
|
4
|
-
import { clsx } from '../../../node_modules/clsx/dist/
|
|
4
|
+
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { MagnifyingGlassIcon, XMarkIcon } from '@navikt/aksel-icons';
|
|
6
|
-
import { useMergeRefs } from '../../../
|
|
6
|
+
import { useMergeRefs } from '../../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
7
7
|
import { useSearch } from './useSearch.js';
|
|
8
8
|
import { Button } from '../../Button/Button.js';
|
|
9
9
|
import { Paragraph } from '../../Typography/Paragraph/Paragraph.js';
|
|
@@ -20,7 +20,7 @@ import { ErrorMessage } from '../../Typography/ErrorMessage/ErrorMessage.js';
|
|
|
20
20
|
*/
|
|
21
21
|
const Search = forwardRef((props, ref) => {
|
|
22
22
|
const { label, style, hideLabel = true, variant = 'simple', searchButtonLabel = 'Søk', clearButtonLabel = 'Tøm', defaultValue, value, onChange, onClear, disabled, onSearchClick, htmlSize = 27, className, ...rest } = props;
|
|
23
|
-
const { inputProps, hasError, errorId, size = '
|
|
23
|
+
const { inputProps, hasError, errorId, size = 'md' } = useSearch(props);
|
|
24
24
|
const inputRef = useRef();
|
|
25
25
|
const mergedRef = useMergeRefs([ref, inputRef]);
|
|
26
26
|
const [internalValue, setInternalValue] = useState(defaultValue ?? '');
|
|
@@ -2,21 +2,17 @@
|
|
|
2
2
|
import { useContext } from 'react';
|
|
3
3
|
import { useFormField } from '../useFormField.js';
|
|
4
4
|
import { FieldsetContext } from '../Fieldset/FieldsetContext.js';
|
|
5
|
+
import { getSize } from '../../../utilities/getSize.js';
|
|
5
6
|
|
|
6
|
-
const sizeMap = {
|
|
7
|
-
small: 'small',
|
|
8
|
-
medium: 'medium',
|
|
9
|
-
large: 'large',
|
|
10
|
-
};
|
|
11
7
|
/** Handles props for `Search` in context with `Fieldset` */
|
|
12
8
|
const useSearch = (props) => {
|
|
13
9
|
const fieldset = useContext(FieldsetContext);
|
|
14
10
|
const { inputProps, readOnly, ...rest } = useFormField(props, 'search');
|
|
15
|
-
const
|
|
11
|
+
const size = fieldset?.size ?? getSize(props.size || 'md');
|
|
16
12
|
return {
|
|
17
13
|
...rest,
|
|
18
14
|
readOnly,
|
|
19
|
-
size
|
|
15
|
+
size,
|
|
20
16
|
inputProps: {
|
|
21
17
|
...inputProps,
|
|
22
18
|
type: 'search',
|
|
@@ -10,7 +10,7 @@ import { Label } from '../../Typography/Label/Label.js';
|
|
|
10
10
|
|
|
11
11
|
const Switch = forwardRef((props, ref) => {
|
|
12
12
|
const { children, description, position = 'left', className, ...rest } = props;
|
|
13
|
-
const { inputProps, descriptionId, size = '
|
|
13
|
+
const { inputProps, descriptionId, size = 'md', readOnly, } = useSwitch(props);
|
|
14
14
|
return (jsx(Paragraph, { asChild: true, size: size, children: jsxs("div", { className: clsx(`fds-switch`, `fds-switch--${size}`, inputProps.disabled && `fds-switch--disabled`, readOnly && `fds-switch--readonly`, className), children: [jsx("input", { className: `fds-switch__input`, ref: ref, ...omit(['size', 'error'], rest), ...inputProps }), jsxs(Label, { className: clsx(`fds-switch__label`, position === 'right' && `fds-switch__label--right`), htmlFor: inputProps.id, size: size, weight: 'regular', children: [jsx("span", { className: `fds-switch__track`, children: jsx("span", { className: `fds-switch__thumb` }) }), readOnly && (jsx(PadlockLockedFillIcon, { "aria-hidden": true, className: `fds-switch__readonly__icon` })), children && jsx("span", { children: children })] }), description && (jsx(Paragraph, { asChild: true, size: size, children: jsx("div", { id: descriptionId, className: `fds-switch__description`, children: description }) }))] }) }));
|
|
15
15
|
});
|
|
16
16
|
Switch.displayName = 'Switch';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef, useState } from 'react';
|
|
4
|
-
import { clsx } from '../../../node_modules/clsx/dist/
|
|
4
|
+
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { PadlockLockedFillIcon } from '@navikt/aksel-icons';
|
|
6
6
|
import { CharacterCounter } from '../CharacterCounter.js';
|
|
7
7
|
import { useTextarea } from './useTextarea.js';
|
|
@@ -19,7 +19,7 @@ import { ErrorMessage } from '../../Typography/ErrorMessage/ErrorMessage.js';
|
|
|
19
19
|
*/
|
|
20
20
|
const Textarea = forwardRef((props, ref) => {
|
|
21
21
|
const { label, description, style, characterLimit, hideLabel, className, ...rest } = props;
|
|
22
|
-
const { textareaProps, descriptionId, hasError, errorId, size = '
|
|
22
|
+
const { textareaProps, descriptionId, hasError, errorId, size = 'md', readOnly, } = useTextarea(props);
|
|
23
23
|
const [value, setValue] = useState(props.defaultValue);
|
|
24
24
|
const characterLimitId = `${textareaProps.id}-charactercount}`;
|
|
25
25
|
const hasCharacterLimit = characterLimit != null;
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
import { useContext } from 'react';
|
|
3
3
|
import { useFormField } from '../useFormField.js';
|
|
4
4
|
import { FieldsetContext } from '../Fieldset/FieldsetContext.js';
|
|
5
|
+
import { getSize } from '../../../utilities/getSize.js';
|
|
5
6
|
|
|
6
7
|
/** Handles props for `Textarea` in context with `Fieldset` */
|
|
7
8
|
const useTextarea = (props) => {
|
|
8
9
|
const fieldset = useContext(FieldsetContext);
|
|
9
10
|
const { inputProps, readOnly, ...rest } = useFormField(props, 'textarea');
|
|
11
|
+
const size = fieldset?.size ?? getSize(props.size ?? 'md');
|
|
10
12
|
return {
|
|
11
13
|
...rest,
|
|
12
14
|
readOnly,
|
|
13
|
-
size
|
|
15
|
+
size,
|
|
14
16
|
textareaProps: {
|
|
15
17
|
...inputProps,
|
|
16
18
|
readOnly,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef, useState, useId } from 'react';
|
|
4
|
-
import { clsx } from '../../../node_modules/clsx/dist/
|
|
4
|
+
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { PadlockLockedFillIcon } from '@navikt/aksel-icons';
|
|
6
6
|
import { CharacterCounter } from '../CharacterCounter.js';
|
|
7
7
|
import { useTextfield } from './useTextfield.js';
|
|
@@ -19,8 +19,8 @@ import { ErrorMessage } from '../../Typography/ErrorMessage/ErrorMessage.js';
|
|
|
19
19
|
*/
|
|
20
20
|
const Textfield = forwardRef((props, ref) => {
|
|
21
21
|
const { label, description, suffix, prefix, style, characterLimit, hideLabel, type = 'text', htmlSize = 20, className, ...rest } = props;
|
|
22
|
-
const { inputProps, descriptionId, hasError, errorId, size = '
|
|
23
|
-
const [inputValue, setInputValue] = useState(props.defaultValue);
|
|
22
|
+
const { inputProps, descriptionId, hasError, errorId, size = 'md', readOnly, } = useTextfield(props);
|
|
23
|
+
const [inputValue, setInputValue] = useState(props.value || props.defaultValue);
|
|
24
24
|
const characterLimitId = `textfield-charactercount-${useId()}`;
|
|
25
25
|
const hasCharacterLimit = characterLimit != null;
|
|
26
26
|
const describedBy = clsx(inputProps['aria-describedby'], hasCharacterLimit && characterLimitId) || undefined;
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
import { useContext } from 'react';
|
|
3
3
|
import { useFormField } from '../useFormField.js';
|
|
4
4
|
import { FieldsetContext } from '../Fieldset/FieldsetContext.js';
|
|
5
|
+
import { getSize } from '../../../utilities/getSize.js';
|
|
5
6
|
|
|
6
7
|
/** Handles props for `Textfield` in context with `Fieldset` */
|
|
7
8
|
const useTextfield = (props) => {
|
|
8
9
|
const fieldset = useContext(FieldsetContext);
|
|
9
10
|
const { inputProps, readOnly, ...rest } = useFormField(props, 'textfield');
|
|
11
|
+
const size = getSize(fieldset?.size ?? props.size ?? 'md');
|
|
10
12
|
return {
|
|
11
13
|
...rest,
|
|
12
14
|
readOnly,
|
|
13
|
-
size
|
|
15
|
+
size,
|
|
14
16
|
inputProps: {
|
|
15
17
|
...inputProps,
|
|
16
18
|
readOnly,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useContext, useId } from 'react';
|
|
3
|
-
import { clsx } from '../../node_modules/clsx/dist/
|
|
3
|
+
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
4
|
+
import { getSize } from '../../utilities/getSize.js';
|
|
4
5
|
import { FieldsetContext } from './Fieldset/FieldsetContext.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -15,21 +16,18 @@ const useFormField = (props, prefix) => {
|
|
|
15
16
|
const disabled = fieldset?.disabled || props?.disabled;
|
|
16
17
|
const readOnly = ((fieldset?.readOnly || props?.readOnly) && !disabled) || undefined;
|
|
17
18
|
const hasError = !disabled && !readOnly && !!(props.error || fieldset?.error);
|
|
19
|
+
const size = getSize(props.size || fieldset?.size || 'md');
|
|
18
20
|
return {
|
|
19
21
|
readOnly,
|
|
20
22
|
hasError,
|
|
21
23
|
errorId,
|
|
22
24
|
descriptionId,
|
|
23
|
-
size
|
|
25
|
+
size,
|
|
24
26
|
inputProps: {
|
|
25
27
|
id,
|
|
26
28
|
disabled,
|
|
27
29
|
'aria-invalid': hasError ? true : undefined,
|
|
28
|
-
'aria-describedby': clsx(props['aria-describedby'],
|
|
29
|
-
[descriptionId]: !!props?.description && typeof props?.description === 'string',
|
|
30
|
-
[errorId]: hasError && !fieldset?.error,
|
|
31
|
-
[fieldset?.errorId ?? '']: hasError && !!fieldset?.error,
|
|
32
|
-
}) || undefined,
|
|
30
|
+
'aria-describedby': clsx(props['aria-describedby'], (!!props?.description && typeof props?.description === 'string') && descriptionId, (hasError && !fieldset?.error) && errorId, (hasError && !!fieldset?.error) && fieldset?.errorId) || undefined,
|
|
33
31
|
},
|
|
34
32
|
};
|
|
35
33
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { shift as shift$1, flip as flip$1, arrow as arrow$1, size as size$1, computePosition as computePosition$1 } from '
|
|
3
|
-
export { detectOverflow, offset } from '
|
|
4
|
-
import { createCoords, rectToClientRect, round, max, min, floor } from '
|
|
5
|
-
import { getOverflowAncestors, isElement, getWindow, getComputedStyle, getDocumentElement, isHTMLElement, isWebKit, getNodeName, isOverflowElement, getNodeScroll, isTableElement, isContainingBlock, getContainingBlock, getParentNode, isLastTraversableNode } from '
|
|
2
|
+
import { shift as shift$1, flip as flip$1, arrow as arrow$1, size as size$1, computePosition as computePosition$1 } from '../../core/dist/floating-ui.core.js';
|
|
3
|
+
export { detectOverflow, offset } from '../../core/dist/floating-ui.core.js';
|
|
4
|
+
import { createCoords, rectToClientRect, round, max, min, floor } from '../../utils/dist/floating-ui.utils.js';
|
|
5
|
+
import { getOverflowAncestors, isElement, getWindow, getComputedStyle, getDocumentElement, isHTMLElement, isWebKit, getNodeName, isOverflowElement, getNodeScroll, isTableElement, isContainingBlock, getContainingBlock, getParentNode, isLastTraversableNode } from '../../utils/dist/floating-ui.utils.dom.js';
|
|
6
6
|
|
|
7
7
|
function getCssDimensions(element) {
|
|
8
8
|
const css = getComputedStyle(element);
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useLayoutEffect, useEffect, useRef } from 'react';
|
|
4
4
|
import { getDocument, isMouseLikePointerType, isTypeableCombobox, activeElement, contains, isVirtualClick, isVirtualPointerEvent, getTarget, isSafari, isMac, isTypeableElement, stopEvent, isReactEvent, isRootElement, isEventTargetWithin } from './floating-ui.react.utils.js';
|
|
5
|
-
import { floor } from '
|
|
5
|
+
import { floor } from '../../utils/dist/floating-ui.utils.js';
|
|
6
6
|
import { useFloating as useFloating$1 } from '../../react-dom/dist/floating-ui.react-dom.js';
|
|
7
7
|
export { arrow } from '../../react-dom/dist/floating-ui.react-dom.js';
|
|
8
|
-
import { isElement, isHTMLElement, getOverflowAncestors, getWindow, getNodeName, isLastTraversableNode, getParentNode, getComputedStyle } from '
|
|
8
|
+
import { isElement, isHTMLElement, getOverflowAncestors, getWindow, getNodeName, isLastTraversableNode, getParentNode, getComputedStyle } from '../../utils/dist/floating-ui.utils.dom.js';
|
|
9
9
|
import { tabbable, isTabbable } from '../../../tabbable/dist/index.esm.js';
|
|
10
10
|
import { createPortal } from 'react-dom';
|
|
11
11
|
import { platform } from '../../dom/dist/floating-ui.dom.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { isShadowRoot, isHTMLElement } from '
|
|
2
|
+
import { isShadowRoot, isHTMLElement } from '../../utils/dist/floating-ui.utils.dom.js';
|
|
3
3
|
|
|
4
4
|
function activeElement(doc) {
|
|
5
5
|
let activeElement = doc.activeElement;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import _extends from '
|
|
2
|
+
import _extends from '../../../@babel/runtime/helpers/esm/extends.js';
|
|
3
3
|
import { forwardRef, Children, isValidElement, createElement, cloneElement, Fragment } from 'react';
|
|
4
4
|
import { composeRefs as $6ed0406888f73fc4$export$43e446d32b3d21af } from '../../react-compose-refs/dist/index.js';
|
|
5
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useState, useRef, useCallback } from 'react';
|
|
4
|
-
import { clsx } from '../../node_modules/clsx/dist/
|
|
4
|
+
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { usePrevious } from '../../hooks/usePrevious.js';
|
|
6
6
|
import { useMediaQuery } from '../../hooks/useMediaQuery.js';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
-
import { useMergeRefs } from '../../
|
|
4
|
+
import { useMergeRefs } from '../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
6
|
import { useRovingTabindex } from './useRovingTabindex.js';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { createContext, forwardRef, useState, useRef } from 'react';
|
|
4
|
-
import { useMergeRefs } from '../../
|
|
4
|
+
import { useMergeRefs } from '../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
6
|
|
|
7
7
|
const RovingTabindexContext = createContext({
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
function getColor(color, type) {
|
|
3
|
+
if (type === 'action') {
|
|
4
|
+
switch (color) {
|
|
5
|
+
case 'first':
|
|
6
|
+
return 'accent';
|
|
7
|
+
case 'second':
|
|
8
|
+
return 'neutral';
|
|
9
|
+
default:
|
|
10
|
+
return color;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
switch (color) {
|
|
14
|
+
case 'first':
|
|
15
|
+
return 'brand1';
|
|
16
|
+
case 'second':
|
|
17
|
+
return 'brand2';
|
|
18
|
+
case 'third':
|
|
19
|
+
return 'brand3';
|
|
20
|
+
default:
|
|
21
|
+
return color;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { getColor };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
type OldColors = 'first' | 'second' | 'third';
|
|
2
3
|
export type AccordionProps = {
|
|
3
4
|
/** Accordion background color */
|
|
4
|
-
color?: '
|
|
5
|
+
color?: 'brand1' | 'brand2' | 'brand3' | 'neutral' | 'subtle' | OldColors;
|
|
5
6
|
/** Show border */
|
|
6
7
|
border?: boolean;
|
|
7
8
|
/** Instances of `Accordion.Item` */
|
|
@@ -9,10 +10,11 @@ export type AccordionProps = {
|
|
|
9
10
|
} & HTMLAttributes<HTMLDivElement>;
|
|
10
11
|
export declare const Accordion: import("react").ForwardRefExoticComponent<{
|
|
11
12
|
/** Accordion background color */
|
|
12
|
-
color?: "
|
|
13
|
+
color?: "neutral" | "brand1" | "brand2" | "brand3" | OldColors | "subtle" | undefined;
|
|
13
14
|
/** Show border */
|
|
14
15
|
border?: boolean | undefined;
|
|
15
16
|
/** Instances of `Accordion.Item` */
|
|
16
17
|
children: ReactNode;
|
|
17
18
|
} & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export {};
|
|
18
20
|
//# sourceMappingURL=Accordion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../../src/components/Accordion/Accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../../src/components/Accordion/Accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAMvD,KAAK,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE9C,MAAM,MAAM,cAAc,GAAG;IAC3B,iCAAiC;IACjC,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC1E,kBAAkB;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oCAAoC;IACpC,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEnC,eAAO,MAAM,SAAS;IARpB,iCAAiC;;IAEjC,kBAAkB;;IAElB,oCAAoC;cAC1B,SAAS;mFAoBpB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'react';
|
|
2
2
|
type Severity = 'info' | 'warning' | 'success' | 'danger';
|
|
3
|
+
type OldAlertSizes = 'small' | 'medium' | 'large';
|
|
3
4
|
export type AlertProps = {
|
|
4
5
|
/** Sets color & icon according to severity */
|
|
5
6
|
severity?: Severity;
|
|
@@ -10,12 +11,15 @@ export type AlertProps = {
|
|
|
10
11
|
* Use this to inform screenreaders of severity.
|
|
11
12
|
* Defaults to Norwegian. */
|
|
12
13
|
iconTitle?: string;
|
|
13
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Sets the size of the alert.
|
|
14
16
|
* Does not affect font size.
|
|
15
17
|
*
|
|
16
|
-
* @default
|
|
18
|
+
* @default md
|
|
19
|
+
*
|
|
20
|
+
* @note `small`, `medium`, `large` is deprecated
|
|
17
21
|
*/
|
|
18
|
-
size?: '
|
|
22
|
+
size?: 'sm' | 'md' | 'lg' | OldAlertSizes;
|
|
19
23
|
} & HTMLAttributes<HTMLDivElement>;
|
|
20
24
|
export declare const Alert: import("react").ForwardRefExoticComponent<{
|
|
21
25
|
/** Sets color & icon according to severity */
|
|
@@ -27,12 +31,15 @@ export declare const Alert: import("react").ForwardRefExoticComponent<{
|
|
|
27
31
|
* Use this to inform screenreaders of severity.
|
|
28
32
|
* Defaults to Norwegian. */
|
|
29
33
|
iconTitle?: string | undefined;
|
|
30
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Sets the size of the alert.
|
|
31
36
|
* Does not affect font size.
|
|
32
37
|
*
|
|
33
|
-
* @default
|
|
38
|
+
* @default md
|
|
39
|
+
*
|
|
40
|
+
* @note `small`, `medium`, `large` is deprecated
|
|
34
41
|
*/
|
|
35
|
-
size?: "
|
|
42
|
+
size?: "sm" | "md" | "lg" | OldAlertSizes | undefined;
|
|
36
43
|
} & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
37
44
|
export {};
|
|
38
45
|
//# sourceMappingURL=Alert.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../../src/components/Alert/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../../src/components/Alert/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AA6B5C,KAAK,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE1D,KAAK,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElD,MAAM,MAAM,UAAU,GAAG;IACvB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;iCAG6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,aAAa,CAAC;CAC3C,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AACnC,eAAO,MAAM,KAAK;IAnBhB,8CAA8C;;IAE9C,6CAA6C;;IAE7C;;;iCAG6B;;IAE7B;;;;;;;OAOG;;mFAuCJ,CAAC"}
|