@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,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef, useContext } 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 { DropdownMenuContext } from './DropdownMenu.js';
|
|
7
7
|
import { Button } from '../Button/Button.js';
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
import { clsx } from '../../node_modules/clsx/dist/
|
|
4
|
+
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { Popover } from '../Popover/index.js';
|
|
6
|
+
import { getSize } from '../../utilities/getSize.js';
|
|
6
7
|
import { HelpTextIcon } from './HelpTextIcon.js';
|
|
7
8
|
|
|
8
|
-
const HelpText = ({ title, placement = 'right',
|
|
9
|
+
const HelpText = ({ title, placement = 'right', portal, className, children, ...rest }) => {
|
|
10
|
+
const size = getSize(rest.size || 'md');
|
|
9
11
|
const [open, setOpen] = useState(false);
|
|
10
12
|
return (jsx(Fragment, { children: jsxs(Popover, { variant: 'info', placement: placement, size: size, portal: portal, open: open, onClose: () => setOpen(false), children: [jsx(Popover.Trigger, { asChild: true, variant: 'tertiary', children: jsxs("button", { className: clsx(`fds-helptext--${size}`, 'fds-helptext__button', `fds-focus`, className), "aria-expanded": open, onClick: () => setOpen(!open), ...rest, children: [jsx(HelpTextIcon, { filled: true, className: clsx(`fds-helptext__icon`, `fds-helptext__icon--filled`, className), openState: open }), jsx(HelpTextIcon, { className: clsx(`fds-helptext__icon`, className), openState: open }), jsx("span", { className: `fds-sr-only`, children: title })] }) }), jsx(Popover.Content, { className: 'fds-helptext__content', children: children })] }) }));
|
|
11
13
|
};
|
|
@@ -6,7 +6,7 @@ import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_mo
|
|
|
6
6
|
|
|
7
7
|
const Link = forwardRef(({ asChild, children, className, inverted = false, ...rest }, ref) => {
|
|
8
8
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'a';
|
|
9
|
-
return (jsx(Component, { className: clsx('fds-link',
|
|
9
|
+
return (jsx(Component, { className: clsx('fds-link', className), ref: ref, "data-ds-theme": inverted ? 'dark' : undefined, ...rest, children: children }));
|
|
10
10
|
});
|
|
11
11
|
Link.displayName = 'Link';
|
|
12
12
|
|
|
@@ -5,9 +5,9 @@ import { ListContext } from './ListRoot.js';
|
|
|
5
5
|
import { Heading } from '../Typography/Heading/Heading.js';
|
|
6
6
|
|
|
7
7
|
const HEADING_SIZE_MAP = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
sm: '2xs',
|
|
9
|
+
md: 'xs',
|
|
10
|
+
lg: 'sm',
|
|
11
11
|
};
|
|
12
12
|
const ListHeading = forwardRef(({ level = 2, id, ...rest }, ref) => {
|
|
13
13
|
const { size, headingId, setHeadingId } = useContext(ListContext);
|
|
@@ -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 { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
6
|
|
|
7
7
|
const ListItem = forwardRef(({ asChild, className, ...rest }, ref) => {
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
4
4
|
import { createContext, forwardRef, useState } from 'react';
|
|
5
|
+
import { getSize } from '../../utilities/getSize.js';
|
|
5
6
|
|
|
6
7
|
const ListContext = createContext({
|
|
7
|
-
size: '
|
|
8
|
+
size: 'md',
|
|
8
9
|
headingId: 'heading',
|
|
9
10
|
setHeadingId: () => { },
|
|
10
11
|
});
|
|
11
|
-
const ListRoot = forwardRef(({ asChild,
|
|
12
|
+
const ListRoot = forwardRef(({ asChild, ...rest }, ref) => {
|
|
12
13
|
const [headingId, setHeadingId] = useState();
|
|
13
14
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'div';
|
|
15
|
+
const size = getSize(rest.size || 'md');
|
|
14
16
|
return (jsx(ListContext.Provider, { value: { size, headingId, setHeadingId }, children: jsx(Component, { ref: ref, ...rest }) }));
|
|
15
17
|
});
|
|
16
18
|
ListRoot.displayName = 'ListRoot';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } 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 { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
6
|
import { ListContext } from './ListRoot.js';
|
|
7
7
|
import { Paragraph } from '../Typography/Paragraph/Paragraph.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { useFloating, useMergeRefs, FloatingFocusManager } from '../../
|
|
3
|
+
import { useFloating, useMergeRefs, FloatingFocusManager } from '../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
4
4
|
import { forwardRef, useRef, useContext, useEffect } from 'react';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
6
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
@@ -12,7 +12,7 @@ import { Heading } from '../Typography/Heading/Heading.js';
|
|
|
12
12
|
const ModalHeader = forwardRef(({ closeButton = true, children, subtitle, asChild, className, ...rest }, ref) => {
|
|
13
13
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'div';
|
|
14
14
|
const context = useContext(ModalContext);
|
|
15
|
-
return (jsxs(Component, { ref: ref, className: clsx('fds-modal__header', !closeButton && 'fds-modal__header--no-button', className), ...rest, children: [subtitle && (jsx(Paragraph, { size: '
|
|
15
|
+
return (jsxs(Component, { ref: ref, className: clsx('fds-modal__header', !closeButton && 'fds-modal__header--no-button', className), ...rest, children: [subtitle && (jsx(Paragraph, { size: 'sm', variant: 'short', children: subtitle })), jsx(Heading, { level: 2, size: 'xs', children: children }), closeButton && (jsx(Button, { name: 'close', variant: 'tertiary', color: 'neutral', size: 'md', onClick: context?.closeModal, autoFocus: true, icon: true, className: 'fds-modal__header__button', children: jsx(XMarkIcon, { title: 'close modal', fontSize: '1.5em' }) }))] }));
|
|
16
16
|
});
|
|
17
17
|
ModalHeader.displayName = 'ModalHeader';
|
|
18
18
|
|
|
@@ -3,6 +3,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { ChevronLeftIcon, ChevronRightIcon } from '@navikt/aksel-icons';
|
|
6
|
+
import { getSize } from '../../utilities/getSize.js';
|
|
6
7
|
import { PaginationRoot } from './PaginationRoot.js';
|
|
7
8
|
import { PaginationContent } from './PaginationContent.js';
|
|
8
9
|
import { PaginationItem } from './PaginationItem.js';
|
|
@@ -12,16 +13,17 @@ import { PaginationPrevious, PaginationNext } from './PaginationNextPrev.js';
|
|
|
12
13
|
import { usePagination } from './usePagination.js';
|
|
13
14
|
|
|
14
15
|
const iconSize = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
sm: '1rem',
|
|
17
|
+
md: '1.5rem',
|
|
18
|
+
lg: '2rem',
|
|
18
19
|
};
|
|
19
|
-
const Pagination = forwardRef(({ nextLabel = '', previousLabel = '',
|
|
20
|
+
const Pagination = forwardRef(({ nextLabel = '', previousLabel = '', compact = false, hideLabels = false, currentPage = 1, totalPages, onChange, itemLabel = (num) => `Side ${num}`, ...rest }, ref) => {
|
|
20
21
|
const { pages, showNextPage, showPreviousPage } = usePagination({
|
|
21
22
|
compact,
|
|
22
23
|
currentPage,
|
|
23
24
|
totalPages,
|
|
24
25
|
});
|
|
26
|
+
const size = getSize(rest.size || 'md');
|
|
25
27
|
return (jsx(PaginationRoot, { ref: ref, "aria-label": 'Pagination', size: size, compact: compact, ...rest, children: jsxs(PaginationContent, { children: [jsx(PaginationItem, { children: jsxs(PaginationPrevious, { className: clsx(!showPreviousPage && 'fds-pagination--hidden'), onClick: () => {
|
|
26
28
|
onChange(currentPage - 1);
|
|
27
29
|
}, "aria-label": previousLabel, children: [jsx(ChevronLeftIcon, { "aria-hidden": true, fontSize: iconSize[size] }), !hideLabels && previousLabel] }) }), pages.map((page, i) => (jsx(PaginationItem, { children: page === 'ellipsis' ? (jsx(PaginationEllipsis, {})) : (jsx(PaginationButton, { "aria-current": currentPage === page, isActive: currentPage === page, "aria-label": itemLabel(page), onClick: () => {
|
|
@@ -6,7 +6,7 @@ import { Button } from '../Button/Button.js';
|
|
|
6
6
|
|
|
7
7
|
const PaginationButton = forwardRef(({ isActive, ...rest }, ref) => {
|
|
8
8
|
const { size } = useContext(PaginationContext);
|
|
9
|
-
return (jsx(Button, { ref: ref, variant: isActive ? 'primary' : 'tertiary', "aria-current": isActive,
|
|
9
|
+
return (jsx(Button, { ref: ref, variant: isActive ? 'primary' : 'tertiary', "aria-current": isActive, size: size, ...rest }));
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
export { PaginationButton };
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
4
4
|
import { createContext, forwardRef } from 'react';
|
|
5
|
+
import { getSize } from '../../utilities/getSize.js';
|
|
5
6
|
|
|
6
7
|
const PaginationContext = createContext({
|
|
7
|
-
size: '
|
|
8
|
+
size: 'md',
|
|
8
9
|
compact: false,
|
|
9
10
|
});
|
|
10
|
-
const PaginationRoot = forwardRef(({ asChild,
|
|
11
|
+
const PaginationRoot = forwardRef(({ asChild, compact = false, ...rest }, ref) => {
|
|
11
12
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'nav';
|
|
13
|
+
const size = getSize(rest.size || 'md');
|
|
12
14
|
return (jsx(PaginationContext.Provider, { value: { size, compact }, children: jsx(Component, { ref: ref, "aria-label": 'Pagination', ...rest }) }));
|
|
13
15
|
});
|
|
14
16
|
var PaginationRoot$1 = PaginationRoot;
|
|
@@ -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', 'fds-focus', 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,13 @@
|
|
|
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';
|
|
6
|
+
import { getColor } from '../../utilities/getColor.js';
|
|
5
7
|
import { Paragraph } from '../Typography/Paragraph/Paragraph.js';
|
|
6
8
|
|
|
7
|
-
const Tag = forwardRef(({ children,
|
|
9
|
+
const Tag = forwardRef(({ children, className, ...rest }, ref) => {
|
|
10
|
+
const size = getSize(rest.size || 'md');
|
|
11
|
+
const color = getColor(rest.color || 'neutral');
|
|
8
12
|
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
13
|
});
|
|
10
14
|
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,15 +1,15 @@
|
|
|
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 = '
|
|
12
|
-
return (jsx(RovingTabindexItem, { asChild: true, value: rest.value, children: jsx(Button, { className: clsx('fds-togglegroup__item', className), icon: icon,
|
|
11
|
+
const { active, size = 'md', buttonProps } = useToggleGroupItem(props);
|
|
12
|
+
return (jsx(RovingTabindexItem, { asChild: true, value: rest.value, children: jsx(Button, { className: clsx('fds-togglegroup__item', className), icon: icon, variant: active ? 'primary' : 'tertiary', size: size, ref: ref, ...rest, ...buttonProps, children: children }) }));
|
|
13
13
|
});
|
|
14
14
|
ToggleGroupItem.displayName = 'ToggleGroupItem';
|
|
15
15
|
|
|
@@ -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', "data-ds-theme": 'dark', ...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;
|