@digdir/designsystemet-react 0.61.0 → 0.62.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 +2 -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/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/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/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 +3 -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 +1 -1
- package/dist/cjs/components/form/Combobox/useFloatingCombobox.js +2 -2
- 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/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/esm/components/Accordion/Accordion.js +1 -1
- 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/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/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/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 +3 -1
- package/dist/esm/components/ToggleGroup/ToggleGroup.js +3 -1
- package/dist/esm/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.js +2 -2
- 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 +1 -1
- package/dist/esm/components/form/Combobox/useFloatingCombobox.js +2 -2
- 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/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/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/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/HelpText/HelpText.d.ts +4 -3
- package/dist/types/components/HelpText/HelpText.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/Pagination/Pagination.d.ts +12 -4
- package/dist/types/components/Pagination/Pagination.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/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 +9 -5
- 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/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/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/{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/{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
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useRef, useState, useId } from 'react';
|
|
5
|
+
import { getSize } from '../../utilities/getSize.js';
|
|
5
6
|
|
|
6
|
-
const Popover = ({ children, placement = 'top', open, variant = 'default',
|
|
7
|
+
const Popover = ({ children, placement = 'top', open, variant = 'default', portal, onOpenChange, onClose, ...rest }) => {
|
|
8
|
+
const size = getSize(rest.size || 'md');
|
|
7
9
|
const triggerRef = useRef(null);
|
|
8
10
|
const [internalOpen, setInternalOpen] = useState(open ?? false);
|
|
9
11
|
const randomPopoverId = useId();
|
|
@@ -34,7 +36,7 @@ const Popover = ({ children, placement = 'top', open, variant = 'default', size
|
|
|
34
36
|
}, children: children }));
|
|
35
37
|
};
|
|
36
38
|
const PopoverContext = React.createContext({
|
|
37
|
-
size: '
|
|
39
|
+
size: 'sm',
|
|
38
40
|
variant: 'default',
|
|
39
41
|
anchorEl: null,
|
|
40
42
|
placement: 'top',
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { forwardRef, useContext, useRef, useEffect, useMemo } from 'react';
|
|
5
|
-
import { useFloating, useInteractions, useFocus, useClick, useDismiss, useRole, useMergeRefs, FloatingPortal } from '../../
|
|
6
|
-
import { clsx } from '../../node_modules/clsx/dist/
|
|
5
|
+
import { useFloating, useInteractions, useFocus, useClick, useDismiss, useRole, useMergeRefs, FloatingPortal } from '../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
6
|
+
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
7
7
|
import { PopoverContext } from './Popover.js';
|
|
8
|
-
import { autoUpdate, flip, shift } from '../../
|
|
8
|
+
import { autoUpdate, flip, shift } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js';
|
|
9
9
|
import { offset } from '../../node_modules/@floating-ui/core/dist/floating-ui.core.js';
|
|
10
|
-
import { arrow } from '../../
|
|
10
|
+
import { arrow } from '../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js';
|
|
11
11
|
import { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect.js';
|
|
12
12
|
import { Paragraph } from '../Typography/Paragraph/Paragraph.js';
|
|
13
13
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef, useContext, useEffect } 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 { PopoverContext } from './Popover.js';
|
|
7
7
|
import { Button } from '../Button/Button.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { clsx } from '../../../node_modules/clsx/dist/
|
|
3
|
+
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
4
4
|
import { useSynchronizedAnimation } from '../../../hooks/useSynchronizedAnimation.js';
|
|
5
5
|
|
|
6
6
|
/** Skeleton component used for indicating loading elements of circular shape */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { clsx } from '../../../node_modules/clsx/dist/
|
|
3
|
+
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
4
4
|
import { useSynchronizedAnimation } from '../../../hooks/useSynchronizedAnimation.js';
|
|
5
5
|
|
|
6
6
|
/** Skeleton component used for indicating loading elements of rectangle shape */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { clsx } from '../../../node_modules/clsx/dist/
|
|
3
|
+
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
4
4
|
import { useSynchronizedAnimation } from '../../../hooks/useSynchronizedAnimation.js';
|
|
5
5
|
|
|
6
6
|
/** Skeleton component used for indicating loading elements of text */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { clsx } from '../../node_modules/clsx/dist/
|
|
3
|
+
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
4
4
|
|
|
5
5
|
const SkipLink = ({ href, children, className, ...rest }) => {
|
|
6
6
|
return (jsx("a", { href: href, className: clsx(`fds-sr-only`, 'fds-skiplink', className), ...rest, children: children }));
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
4
|
+
import { getSize } from '../../utilities/getSize.js';
|
|
4
5
|
import { useSynchronizedAnimation } from '../../hooks/useSynchronizedAnimation.js';
|
|
5
6
|
|
|
6
7
|
const sizeMap = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
'2xs': 13,
|
|
9
|
+
xs: 20,
|
|
10
|
+
sm: 27,
|
|
11
|
+
md: 40,
|
|
12
|
+
lg: 56,
|
|
13
|
+
xl: 79,
|
|
13
14
|
};
|
|
14
15
|
/** Spinner component used for indicating busy or indeterminate loading */
|
|
15
|
-
const Spinner = ({ title,
|
|
16
|
+
const Spinner = ({ title, variant = 'default', className, style, ...rest }) => {
|
|
17
|
+
const size = getSize(rest.size || 'md');
|
|
16
18
|
const svgRef = useSynchronizedAnimation('fds-spinner-rotate-animation');
|
|
17
19
|
const strokeRef = useSynchronizedAnimation('fds-spinner-stroke-animation');
|
|
18
20
|
return (jsxs("svg", { className: clsx('fds-spinner', `fds-spinner--${variant}`, className), style: { width: sizeMap[size], height: sizeMap[size], ...style }, viewBox: '0 0 50 50', ref: svgRef, ...rest, children: [jsx("title", { children: title }), jsx("circle", { className: clsx('fds-spinner__background', variant === 'inverted' && 'fds-spinner__background--inverted'), cx: '25', cy: '25', r: '20', fill: 'none', strokeWidth: '5' }), jsx("circle", { className: clsx(`fds-spinner__circle`), cx: '25', cy: '25', r: '20', fill: 'none', strokeWidth: '5', ref: strokeRef })] }));
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
5
|
+
import { getSize } from '../../utilities/getSize.js';
|
|
5
6
|
import { Paragraph } from '../Typography/Paragraph/Paragraph.js';
|
|
6
7
|
|
|
7
|
-
const Table = React.forwardRef(({ zebra = false,
|
|
8
|
+
const Table = React.forwardRef(({ zebra = false, stickyHeader = false, border = false, className, children, ...rest }, ref) => {
|
|
9
|
+
const size = getSize(rest.size || 'md');
|
|
8
10
|
return (jsx(Paragraph, { asChild: true, size: size, children: jsx("table", { ref: ref, className: clsx('fds-table', `fds-table--${size}`, zebra && 'fds-table--zebra', stickyHeader && 'fds-table--sticky-header', border && 'fds-table--border', className), ...rest, children: children }) }));
|
|
9
11
|
});
|
|
10
12
|
Table.displayName = 'Table';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } 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 { useTabItem } from './useTab.js';
|
|
6
6
|
import { RovingTabindexItem } from '../../../utilities/RovingTabIndex/RovingTabindexItem.js';
|
|
7
7
|
|
|
8
8
|
const Tab = forwardRef((props, ref) => {
|
|
9
9
|
const { children, className, ...rest } = props;
|
|
10
|
-
const {
|
|
11
|
-
return (jsx(RovingTabindexItem, { ...rest, asChild: true, children: jsx("button", { ...useTabRest, className: clsx('fds-tabs__tab',
|
|
10
|
+
const { ...useTabRest } = useTabItem(props);
|
|
11
|
+
return (jsx(RovingTabindexItem, { ...rest, asChild: true, children: jsx("button", { ...useTabRest, className: clsx('fds-tabs__tab', className), ref: ref, children: children }) }));
|
|
12
12
|
});
|
|
13
13
|
Tab.displayName = 'Tab';
|
|
14
14
|
|
|
@@ -6,13 +6,11 @@ import { TabsContext } from '../Tabs.js';
|
|
|
6
6
|
const useTabItem = (props) => {
|
|
7
7
|
const { value, ...rest } = props;
|
|
8
8
|
const tabs = useContext(TabsContext);
|
|
9
|
-
const active = tabs.value == value;
|
|
10
9
|
const buttonId = `tab-${useId()}`;
|
|
11
10
|
return {
|
|
12
11
|
...rest,
|
|
13
|
-
active: active,
|
|
14
12
|
id: buttonId,
|
|
15
|
-
'aria-selected':
|
|
13
|
+
'aria-selected': tabs.value == value,
|
|
16
14
|
role: 'tab',
|
|
17
15
|
onClick: () => {
|
|
18
16
|
tabs.onChange?.(value);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } 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 { RovingTabindexRoot } from '../../../utilities/RovingTabIndex/RovingTabindexRoot.js';
|
|
6
6
|
|
|
7
7
|
const TabList = forwardRef(({ children, className, ...rest }, ref) => {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { createContext, forwardRef, useState } from 'react';
|
|
4
|
+
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
5
|
+
import { getSize } from '../../utilities/getSize.js';
|
|
4
6
|
|
|
5
7
|
const TabsContext = createContext({});
|
|
6
|
-
const Tabs = forwardRef(({ children, value, defaultValue,
|
|
8
|
+
const Tabs = forwardRef(({ children, value, defaultValue, className, onChange, ...rest }, ref) => {
|
|
9
|
+
const size = getSize(rest.size || 'md');
|
|
7
10
|
const isControlled = value !== undefined;
|
|
8
11
|
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
|
|
9
12
|
let onValueChange = onChange;
|
|
@@ -18,7 +21,7 @@ const Tabs = forwardRef(({ children, value, defaultValue, onChange, size = 'medi
|
|
|
18
21
|
value,
|
|
19
22
|
defaultValue,
|
|
20
23
|
onChange: onValueChange,
|
|
21
|
-
}, children: jsx("div", { className: `fds-tabs--${size}`, ref: ref, ...rest, children: children }) }));
|
|
24
|
+
}, children: jsx("div", { className: clsx(`fds-tabs--${size}`, className), ref: ref, ...rest, children: children }) }));
|
|
22
25
|
});
|
|
23
26
|
Tabs.displayName = 'Tabs';
|
|
24
27
|
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
5
|
+
import { getSize } from '../../utilities/getSize.js';
|
|
5
6
|
import { Paragraph } from '../Typography/Paragraph/Paragraph.js';
|
|
6
7
|
|
|
7
|
-
const Tag = forwardRef(({ children, color = 'neutral',
|
|
8
|
+
const Tag = forwardRef(({ children, color = 'neutral', className, ...rest }, ref) => {
|
|
9
|
+
const size = getSize(rest.size || 'md');
|
|
8
10
|
return (jsx(Paragraph, { asChild: true, size: size, children: jsx("span", { className: clsx('fds-tag', `fds-tag--${color}`, `fds-tag--${size}`, className), ref: ref, ...rest, children: children }) }));
|
|
9
11
|
});
|
|
10
12
|
Tag.displayName = 'Tag';
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { createContext, forwardRef, useId, useState } from 'react';
|
|
4
4
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
5
|
+
import { getSize } from '../../utilities/getSize.js';
|
|
5
6
|
import { RovingTabindexRoot } from '../../utilities/RovingTabIndex/RovingTabindexRoot.js';
|
|
6
7
|
|
|
7
8
|
const ToggleGroupContext = createContext({});
|
|
@@ -15,7 +16,8 @@ const ToggleGroupContext = createContext({});
|
|
|
15
16
|
* </ToggleGroup>
|
|
16
17
|
* ```
|
|
17
18
|
*/
|
|
18
|
-
const ToggleGroup = forwardRef(({ children, value, defaultValue, onChange,
|
|
19
|
+
const ToggleGroup = forwardRef(({ children, value, defaultValue, onChange, name, className, ...rest }, ref) => {
|
|
20
|
+
const size = getSize(rest.size || 'md');
|
|
19
21
|
const nameId = useId();
|
|
20
22
|
const isControlled = value !== undefined;
|
|
21
23
|
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } 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 { useToggleGroupItem } from './useToggleGroupitem.js';
|
|
6
6
|
import { RovingTabindexItem } from '../../../utilities/RovingTabIndex/RovingTabindexItem.js';
|
|
7
7
|
import { Button } from '../../Button/Button.js';
|
|
8
8
|
|
|
9
9
|
const ToggleGroupItem = forwardRef((props, ref) => {
|
|
10
10
|
const { children, icon, className, ...rest } = props;
|
|
11
|
-
const { active, size = '
|
|
11
|
+
const { active, size = 'md', buttonProps } = useToggleGroupItem(props);
|
|
12
12
|
return (jsx(RovingTabindexItem, { asChild: true, value: rest.value, children: jsx(Button, { className: clsx('fds-togglegroup__item', className), icon: icon, color: 'first', variant: active ? 'primary' : 'tertiary', size: size, ref: ref, ...rest, ...buttonProps, children: children }) }));
|
|
13
13
|
});
|
|
14
14
|
ToggleGroupItem.displayName = 'ToggleGroupItem';
|
|
@@ -3,14 +3,14 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { forwardRef, useState, cloneElement } from 'react';
|
|
5
5
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
6
|
-
import { useFloating, useTransitionStyles, useInteractions, useHover, useFocus, useDismiss, useRole, useMergeRefs,
|
|
7
|
-
import { autoUpdate, flip, shift } from '../../
|
|
6
|
+
import { useFloating, useTransitionStyles, useInteractions, useHover, useFocus, useDismiss, useRole, useMergeRefs, FloatingArrow, FloatingPortal } from '../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
7
|
+
import { autoUpdate, flip, shift } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js';
|
|
8
8
|
import { offset } from '../../node_modules/@floating-ui/core/dist/floating-ui.core.js';
|
|
9
|
-
import { arrow } from '../../
|
|
9
|
+
import { arrow } from '../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js';
|
|
10
10
|
|
|
11
11
|
const ARROW_HEIGHT = 7;
|
|
12
12
|
const ARROW_GAP = 4;
|
|
13
|
-
const Tooltip = forwardRef(({ children, content, placement = 'top', delay = 150, open: userOpen, defaultOpen = false, portal, inverted, className, style, ...rest }, ref) => {
|
|
13
|
+
const Tooltip = forwardRef(({ children, content, placement = 'top', delay = 150, open: userOpen, defaultOpen = false, portal = true, inverted, className, style, ...rest }, ref) => {
|
|
14
14
|
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
15
15
|
const Container = portal ? FloatingPortal : React.Fragment;
|
|
16
16
|
const arrowRef = React.useRef(null);
|
|
@@ -57,11 +57,11 @@ const Tooltip = forwardRef(({ children, content, placement = 'top', delay = 150,
|
|
|
57
57
|
}
|
|
58
58
|
return (jsxs(Fragment, { children: [cloneElement(children, getReferenceProps({
|
|
59
59
|
ref: childMergedRef,
|
|
60
|
-
})), internalOpen && (jsx(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
})), internalOpen && (jsx(Container, { children: jsxs("div", { ref: refs.setFloating, style: { ...floatingStyles, ...animationStyles, ...style }, role: 'tooltip', ...getFloatingProps({
|
|
61
|
+
className: clsx('fds-tooltip', inverted && 'fds-tooltip--inverted', className),
|
|
62
|
+
ref: mergedRef,
|
|
63
|
+
...rest,
|
|
64
|
+
}), children: [content, jsx(FloatingArrow, { ref: arrowRef, context: context, className: 'fds-tooltip__arrow', height: ARROW_HEIGHT })] }) }))] }));
|
|
65
65
|
});
|
|
66
66
|
Tooltip.displayName = 'Tooltip';
|
|
67
67
|
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } 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 { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
|
+
import { getSize } from '../../../utilities/getSize.js';
|
|
6
7
|
|
|
7
8
|
/** Use `ErrorMessage` to display text as error message. */
|
|
8
|
-
const ErrorMessage = forwardRef(({ className,
|
|
9
|
+
const ErrorMessage = forwardRef(({ className, spacing, asChild, error = true, ...rest }, ref) => {
|
|
9
10
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'div';
|
|
11
|
+
const size = getSize(rest.size || 'md');
|
|
10
12
|
return (jsx(Component, { ref: ref, className: clsx('fds-error-message', `fds-error-message--${size}`, spacing && 'fds-error-message--spacing', error && 'fds-error-message--error', className), ...rest }));
|
|
11
13
|
});
|
|
12
14
|
ErrorMessage.displayName = 'ErrorMessage';
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } 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 { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
|
+
import { getSize } from '../../../utilities/getSize.js';
|
|
6
7
|
|
|
7
8
|
/** Use `Heading` to render h1-6 elements with heading text styles. */
|
|
8
|
-
const Heading = forwardRef(({ level = 1,
|
|
9
|
+
const Heading = forwardRef(({ level = 1, spacing = false, className, asChild, ...rest }, ref) => {
|
|
9
10
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : `h${level ?? 1}`;
|
|
11
|
+
const size = getSize(rest.size || 'xl');
|
|
10
12
|
return (jsx(Component, { ref: ref, className: clsx('fds-heading', `fds-heading--${size}`, spacing && 'fds-heading--spacing', className), ...rest }));
|
|
11
13
|
});
|
|
12
14
|
Heading.displayName = 'Heading';
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } 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 { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
|
+
import { getSize } from '../../../utilities/getSize.js';
|
|
6
7
|
|
|
7
8
|
/** Use `Ingress` to display text as ingress. */
|
|
8
|
-
const Ingress = forwardRef(({ className,
|
|
9
|
+
const Ingress = forwardRef(({ className, spacing, asChild, ...rest }, ref) => {
|
|
9
10
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'p';
|
|
11
|
+
const size = getSize(rest.size || 'md');
|
|
10
12
|
return (jsx(Component, { ref: ref, className: clsx(`fds-ingress`, `fds-ingress--${size}`, spacing && 'fds-ingress--spacing', className), ...rest }));
|
|
11
13
|
});
|
|
12
14
|
Ingress.displayName = 'Ingress';
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } 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 { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
|
+
import { getSize } from '../../../utilities/getSize.js';
|
|
6
7
|
|
|
7
8
|
/** Use `Label` for labels. */
|
|
8
|
-
const Label = forwardRef(({ className,
|
|
9
|
+
const Label = forwardRef(({ className, spacing, weight = 'medium', asChild, ...rest }, ref) => {
|
|
9
10
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'label';
|
|
11
|
+
const size = getSize(rest.size || 'md');
|
|
10
12
|
return (jsx(Component, { ref: ref, className: clsx('fds-label', `fds-label--${size}`, spacing && 'fds-label--spacing', weight && `fds-label--${weight}-weight`, className), ...rest }));
|
|
11
13
|
});
|
|
12
14
|
Label.displayName = 'Label';
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } 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 { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
|
+
import { getSize } from '../../../utilities/getSize.js';
|
|
6
7
|
|
|
7
8
|
/** Use `Paragraph` to display text with paragraph text styles. */
|
|
8
|
-
const Paragraph = forwardRef(({ className,
|
|
9
|
+
const Paragraph = forwardRef(({ className, spacing, asChild, variant, ...rest }, ref) => {
|
|
9
10
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'p';
|
|
11
|
+
const size = getSize(rest.size || 'md');
|
|
10
12
|
return (jsx(Component, { ref: ref, className: clsx('fds-paragraph', `fds-paragraph--${size}`, spacing && 'fds-paragraph--spacing', variant && `fds-paragraph--${variant}`, className), ...rest }));
|
|
11
13
|
});
|
|
12
14
|
Paragraph.displayName = 'Paragraph';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
5
|
-
import { useMergeRefs } from '../../../
|
|
5
|
+
import { useMergeRefs } from '../../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
6
6
|
import { useCheckbox } from './useCheckbox.js';
|
|
7
7
|
import { Paragraph } from '../../Typography/Paragraph/Paragraph.js';
|
|
8
8
|
import { omit } from '../../../utilities/objectUtils.js';
|
|
@@ -10,7 +10,7 @@ import { Label } from '../../Typography/Label/Label.js';
|
|
|
10
10
|
|
|
11
11
|
const Checkbox = forwardRef((props, ref) => {
|
|
12
12
|
const { children, description, className, style, ...rest } = props;
|
|
13
|
-
const { inputProps, descriptionId, hasError, size = '
|
|
13
|
+
const { inputProps, descriptionId, hasError, size = 'md', readOnly, } = useCheckbox(props);
|
|
14
14
|
const inputRef = useMergeRefs([
|
|
15
15
|
ref,
|
|
16
16
|
(el) => {
|
|
@@ -4,7 +4,7 @@ import { createContext, forwardRef, useState } from 'react';
|
|
|
4
4
|
import { Fieldset } from '../../Fieldset/Fieldset.js';
|
|
5
5
|
|
|
6
6
|
const CheckboxGroupContext = createContext(null);
|
|
7
|
-
const CheckboxGroup = forwardRef(({ onChange, children, value, readOnly, defaultValue, size = '
|
|
7
|
+
const CheckboxGroup = forwardRef(({ onChange, children, value, readOnly, defaultValue, size = 'md', ...rest }, ref) => {
|
|
8
8
|
const [internalValue, setInternalValue] = useState(defaultValue ?? []);
|
|
9
9
|
const toggleValue = (checkboxValue) => {
|
|
10
10
|
const currentValue = value ?? internalValue;
|
|
@@ -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';
|
|
@@ -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 }) => {
|
|
@@ -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';
|