@digdir/designsystemet-react 1.0.0-rc.3 → 1.0.0-rc.4
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 +1 -3
- package/dist/cjs/components/Alert/Alert.js +1 -3
- package/dist/cjs/components/Box/Box.js +1 -4
- package/dist/cjs/components/Button/Button.js +1 -5
- package/dist/cjs/components/Card/Card.js +1 -3
- package/dist/cjs/components/Chip/Group/Group.js +1 -3
- package/dist/cjs/components/Chip/Removable/Removable.js +1 -3
- package/dist/cjs/components/Chip/Toggle/Toggle.js +1 -3
- package/dist/cjs/components/DropdownMenu/DropdownMenu.js +1 -3
- package/dist/cjs/components/DropdownMenu/DropdownMenuContent.js +1 -1
- package/dist/cjs/components/HelpText/HelpText.js +1 -3
- package/dist/cjs/components/Link/Link.js +2 -2
- package/dist/cjs/components/List/ListRoot.js +1 -3
- package/dist/cjs/components/Pagination/Pagination.js +1 -3
- package/dist/cjs/components/Pagination/PaginationRoot.js +1 -3
- package/dist/cjs/components/Popover/Popover.js +1 -3
- package/dist/cjs/components/Popover/PopoverContent.js +1 -1
- package/dist/cjs/components/Spinner/Spinner.js +2 -6
- package/dist/cjs/components/Table/Table.js +1 -3
- package/dist/cjs/components/Tabs/Tabs.js +1 -3
- package/dist/cjs/components/Tag/Tag.js +1 -5
- package/dist/cjs/components/ToggleGroup/ToggleGroup.js +1 -3
- package/dist/cjs/components/Tooltip/Tooltip.js +3 -3
- package/dist/cjs/components/Typography/ErrorMessage/ErrorMessage.js +1 -3
- package/dist/cjs/components/Typography/Heading/Heading.js +1 -3
- package/dist/cjs/components/Typography/Ingress/Ingress.js +1 -3
- package/dist/cjs/components/Typography/Label/Label.js +1 -3
- package/dist/cjs/components/Typography/Paragraph/Paragraph.js +1 -3
- package/dist/cjs/components/form/Checkbox/Checkbox.js +1 -1
- package/dist/cjs/components/form/Combobox/Combobox.js +1 -3
- package/dist/cjs/components/form/Combobox/useFloatingCombobox.js +1 -1
- package/dist/cjs/components/form/Fieldset/Fieldset.js +1 -1
- package/dist/cjs/components/form/NativeSelect/NativeSelect.js +1 -1
- package/dist/cjs/components/form/NativeSelect/useNativeSelect.js +1 -3
- package/dist/cjs/components/form/Radio/Radio.js +1 -1
- package/dist/cjs/components/form/Search/useSearch.js +1 -3
- package/dist/cjs/components/form/Switch/Switch.js +1 -1
- package/dist/cjs/components/form/Textarea/Textarea.js +1 -1
- package/dist/cjs/components/form/Textarea/useTextarea.js +1 -3
- package/dist/cjs/components/form/Textfield/Textfield.js +1 -1
- package/dist/cjs/components/form/Textfield/useTextfield.js +1 -3
- package/dist/cjs/components/form/useFormField.js +4 -3
- package/dist/cjs/node_modules/@floating-ui/react/dist/floating-ui.react.js +1 -1
- package/dist/cjs/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +1 -1
- package/dist/cjs/node_modules/@floating-ui/{dom → react-dom/node_modules/@floating-ui/dom}/dist/floating-ui.dom.js +3 -3
- package/dist/esm/components/Accordion/Accordion.js +1 -3
- package/dist/esm/components/Alert/Alert.js +1 -3
- package/dist/esm/components/Box/Box.js +1 -4
- package/dist/esm/components/Button/Button.js +1 -5
- package/dist/esm/components/Card/Card.js +1 -3
- package/dist/esm/components/Chip/Group/Group.js +1 -3
- package/dist/esm/components/Chip/Removable/Removable.js +1 -3
- package/dist/esm/components/Chip/Toggle/Toggle.js +1 -3
- package/dist/esm/components/DropdownMenu/DropdownMenu.js +1 -3
- package/dist/esm/components/DropdownMenu/DropdownMenuContent.js +1 -1
- package/dist/esm/components/HelpText/HelpText.js +1 -3
- package/dist/esm/components/Link/Link.js +2 -2
- package/dist/esm/components/List/ListRoot.js +1 -3
- package/dist/esm/components/Pagination/Pagination.js +1 -3
- package/dist/esm/components/Pagination/PaginationRoot.js +1 -3
- package/dist/esm/components/Popover/Popover.js +1 -3
- package/dist/esm/components/Popover/PopoverContent.js +1 -1
- package/dist/esm/components/Spinner/Spinner.js +2 -6
- package/dist/esm/components/Table/Table.js +1 -3
- package/dist/esm/components/Tabs/Tabs.js +1 -3
- package/dist/esm/components/Tag/Tag.js +1 -5
- package/dist/esm/components/ToggleGroup/ToggleGroup.js +1 -3
- package/dist/esm/components/Tooltip/Tooltip.js +3 -3
- package/dist/esm/components/Typography/ErrorMessage/ErrorMessage.js +1 -3
- package/dist/esm/components/Typography/Heading/Heading.js +1 -3
- package/dist/esm/components/Typography/Ingress/Ingress.js +1 -3
- package/dist/esm/components/Typography/Label/Label.js +1 -3
- package/dist/esm/components/Typography/Paragraph/Paragraph.js +1 -3
- package/dist/esm/components/form/Checkbox/Checkbox.js +1 -1
- package/dist/esm/components/form/Combobox/Combobox.js +1 -3
- package/dist/esm/components/form/Combobox/useFloatingCombobox.js +1 -1
- package/dist/esm/components/form/Fieldset/Fieldset.js +1 -1
- package/dist/esm/components/form/NativeSelect/NativeSelect.js +1 -1
- package/dist/esm/components/form/NativeSelect/useNativeSelect.js +1 -3
- package/dist/esm/components/form/Radio/Radio.js +1 -1
- package/dist/esm/components/form/Search/useSearch.js +1 -3
- package/dist/esm/components/form/Switch/Switch.js +1 -1
- package/dist/esm/components/form/Textarea/Textarea.js +1 -1
- package/dist/esm/components/form/Textarea/useTextarea.js +1 -3
- package/dist/esm/components/form/Textfield/Textfield.js +1 -1
- package/dist/esm/components/form/Textfield/useTextfield.js +1 -3
- package/dist/esm/components/form/useFormField.js +4 -3
- package/dist/esm/node_modules/@floating-ui/react/dist/floating-ui.react.js +2 -2
- package/dist/esm/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +2 -2
- package/dist/esm/node_modules/@floating-ui/{dom → react-dom/node_modules/@floating-ui/dom}/dist/floating-ui.dom.js +4 -4
- package/dist/types/components/Accordion/Accordion.d.ts +8 -6
- package/dist/types/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/types/components/Alert/Alert.d.ts +2 -7
- package/dist/types/components/Alert/Alert.d.ts.map +1 -1
- package/dist/types/components/Box/Box.d.ts +4 -7
- package/dist/types/components/Box/Box.d.ts.map +1 -1
- package/dist/types/components/Button/Button.d.ts +4 -11
- package/dist/types/components/Button/Button.d.ts.map +1 -1
- package/dist/types/components/Card/Card.d.ts +2 -12
- package/dist/types/components/Card/Card.d.ts.map +1 -1
- package/dist/types/components/Chip/Group/Group.d.ts +1 -5
- package/dist/types/components/Chip/Group/Group.d.ts.map +1 -1
- package/dist/types/components/Chip/Removable/Removable.d.ts +0 -2
- package/dist/types/components/Chip/Removable/Removable.d.ts.map +1 -1
- package/dist/types/components/Chip/Toggle/Toggle.d.ts +0 -2
- package/dist/types/components/Chip/Toggle/Toggle.d.ts.map +1 -1
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +2 -4
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/types/components/DropdownMenu/DropdownMenuTrigger.d.ts +2 -2
- package/dist/types/components/HelpText/HelpText.d.ts +1 -2
- package/dist/types/components/HelpText/HelpText.d.ts.map +1 -1
- package/dist/types/components/Link/Link.d.ts +0 -10
- 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 +2 -5
- package/dist/types/components/List/ListRoot.d.ts.map +1 -1
- package/dist/types/components/Modal/ModalTrigger.d.ts +2 -2
- package/dist/types/components/Pagination/Pagination.d.ts +2 -6
- package/dist/types/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/types/components/Pagination/PaginationRoot.d.ts +0 -2
- package/dist/types/components/Pagination/PaginationRoot.d.ts.map +1 -1
- package/dist/types/components/Popover/Popover.d.ts +2 -5
- package/dist/types/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/components/Popover/PopoverTrigger.d.ts +2 -2
- package/dist/types/components/Spinner/Spinner.d.ts +4 -8
- package/dist/types/components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/types/components/Table/Table.d.ts +2 -6
- package/dist/types/components/Table/Table.d.ts.map +1 -1
- package/dist/types/components/Tabs/Tabs.d.ts +2 -6
- package/dist/types/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/types/components/Tag/Tag.d.ts +3 -6
- package/dist/types/components/Tag/Tag.d.ts.map +1 -1
- package/dist/types/components/ToggleGroup/ToggleGroup.d.ts +0 -2
- package/dist/types/components/ToggleGroup/ToggleGroup.d.ts.map +1 -1
- package/dist/types/components/Tooltip/Tooltip.d.ts +3 -24
- package/dist/types/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/components/Typography/ErrorMessage/ErrorMessage.d.ts +2 -6
- package/dist/types/components/Typography/ErrorMessage/ErrorMessage.d.ts.map +1 -1
- package/dist/types/components/Typography/Heading/Heading.d.ts +2 -6
- package/dist/types/components/Typography/Heading/Heading.d.ts.map +1 -1
- package/dist/types/components/Typography/Ingress/Ingress.d.ts +2 -6
- package/dist/types/components/Typography/Ingress/Ingress.d.ts.map +1 -1
- package/dist/types/components/Typography/Label/Label.d.ts +2 -5
- package/dist/types/components/Typography/Label/Label.d.ts.map +1 -1
- package/dist/types/components/Typography/Paragraph/Paragraph.d.ts +2 -6
- package/dist/types/components/Typography/Paragraph/Paragraph.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/Fieldset/useFieldset.d.ts +1 -1
- package/dist/types/components/form/NativeSelect/NativeSelect.d.ts +2 -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 +2 -6
- package/dist/types/components/form/Search/Search.d.ts.map +1 -1
- package/dist/types/components/form/Search/useSearch.d.ts.map +1 -1
- package/dist/types/components/form/Switch/Switch.d.ts.map +1 -1
- package/dist/types/components/form/Textarea/Textarea.d.ts +1 -1
- package/dist/types/components/form/Textarea/useTextarea.d.ts.map +1 -1
- package/dist/types/components/form/Textfield/Textfield.d.ts +2 -6
- 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 +1 -4
- package/dist/types/components/form/useFormField.d.ts.map +1 -1
- package/dist/types/utilities/index.d.ts +0 -2
- package/dist/types/utilities/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/cjs/utilities/getColor.js +0 -27
- package/dist/cjs/utilities/getSize.js +0 -33
- package/dist/esm/utilities/getColor.js +0 -25
- package/dist/esm/utilities/getSize.js +0 -31
- package/dist/types/utilities/getColor.d.ts +0 -2
- package/dist/types/utilities/getColor.d.ts.map +0 -1
- package/dist/types/utilities/getSize.d.ts +0 -2
- package/dist/types/utilities/getSize.d.ts.map +0 -1
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var lite = require('../../node_modules/clsx/dist/lite.js');
|
|
7
|
-
var getColor = require('../../utilities/getColor.js');
|
|
8
7
|
|
|
9
|
-
const Accordion = React.forwardRef(({ border = false, className, ...rest }, ref) => {
|
|
10
|
-
const color = getColor.getColor(rest.color || 'neutral');
|
|
8
|
+
const Accordion = React.forwardRef(({ border = false, color = 'neutral', className, ...rest }, ref) => {
|
|
11
9
|
return (jsxRuntime.jsx("div", { className: lite.clsx('fds-accordion', border && 'fds-accordion--border', color && `fds-accordion--${color}`, className), ref: ref, ...rest }));
|
|
12
10
|
});
|
|
13
11
|
Accordion.displayName = 'Accordion';
|
|
@@ -5,7 +5,6 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var akselIcons = require('@navikt/aksel-icons');
|
|
7
7
|
var lite = require('../../node_modules/clsx/dist/lite.js');
|
|
8
|
-
var getSize = require('../../utilities/getSize.js');
|
|
9
8
|
var Paragraph = require('../Typography/Paragraph/Paragraph.js');
|
|
10
9
|
|
|
11
10
|
const icons = {
|
|
@@ -20,8 +19,7 @@ const icons = {
|
|
|
20
19
|
title: 'Feil',
|
|
21
20
|
},
|
|
22
21
|
};
|
|
23
|
-
const Alert = React.forwardRef(({ severity = 'info', elevated, iconTitle, children, className, ...rest }, ref) => {
|
|
24
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
22
|
+
const Alert = React.forwardRef(({ severity = 'info', elevated, iconTitle, children, size = 'md', className, ...rest }, ref) => {
|
|
25
23
|
const { Icon, title } = icons[severity];
|
|
26
24
|
return (jsxRuntime.jsx("div", { ref: ref, className: lite.clsx('fds-alert', `fds-alert--${size}`, `fds-alert--${severity}`, elevated && `fds-alert--elevated`, className), ...rest, children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Icon, { title: iconTitle || title, className: 'fds-alert__icon' }), jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, className: 'fds-alert__content', children: jsxRuntime.jsx("span", { children: children }) })] }) }));
|
|
27
25
|
});
|
|
@@ -5,13 +5,10 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var lite = require('../../node_modules/clsx/dist/lite.js');
|
|
7
7
|
var index = require('../../node_modules/@radix-ui/react-slot/dist/index.js');
|
|
8
|
-
var getSize = require('../../utilities/getSize.js');
|
|
9
8
|
|
|
10
9
|
const Box = React.forwardRef(({ shadow, borderColor, borderRadius, background = 'default', children, asChild = false, className, ...rest }, ref) => {
|
|
11
10
|
const Component = asChild ? index.Slot : 'div';
|
|
12
|
-
|
|
13
|
-
const borderRadiusSize = borderRadius && getSize.getSize(borderRadius);
|
|
14
|
-
return (jsxRuntime.jsx(Component, { ref: ref, className: lite.clsx(shadowSize && `fds-box--${shadowSize}-shadow`, borderColor && `fds-box--${borderColor}-border-color`, borderRadiusSize && `fds-box--${borderRadiusSize}-border-radius`, `fds-box--${background}-background`, className), ...rest, children: children }));
|
|
11
|
+
return (jsxRuntime.jsx(Component, { ref: ref, className: lite.clsx(shadow && `fds-box--${shadow}-shadow`, borderColor && `fds-box--${borderColor}-border-color`, borderRadius && `fds-box--${borderRadius}-border-radius`, `fds-box--${background}-background`, className), ...rest, children: children }));
|
|
15
12
|
});
|
|
16
13
|
Box.displayName = 'Box';
|
|
17
14
|
|
|
@@ -5,15 +5,11 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var lite = require('../../node_modules/clsx/dist/lite.js');
|
|
7
7
|
var index = require('../../node_modules/@radix-ui/react-slot/dist/index.js');
|
|
8
|
-
var getSize = require('../../utilities/getSize.js');
|
|
9
|
-
var getColor = require('../../utilities/getColor.js');
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
* Button used for interaction
|
|
13
11
|
*/
|
|
14
|
-
const Button = React.forwardRef(({ children, variant = 'primary', fullWidth = false, icon = false, type = 'button',
|
|
15
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
16
|
-
const color = getColor.getColor(rest.color || 'accent', 'action');
|
|
12
|
+
const Button = React.forwardRef(({ children, variant = 'primary', color = 'accent', fullWidth = false, icon = false, type = 'button', size = 'md', asChild, className, ...rest }, ref) => {
|
|
17
13
|
const Component = asChild ? index.Slot : 'button';
|
|
18
14
|
return (jsxRuntime.jsx(Component, { ref: ref, type: type, className: lite.clsx('fds-btn', `fds-focus`, `fds-btn--${size}`, `fds-btn--${variant}`, `fds-btn--${color}`, fullWidth && 'fds-btn--full-width', icon && 'fds-btn--icon-only', className), ...rest, children: children }));
|
|
19
15
|
});
|
|
@@ -5,11 +5,9 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var lite = require('../../node_modules/clsx/dist/lite.js');
|
|
7
7
|
var index = require('../../node_modules/@radix-ui/react-slot/dist/index.js');
|
|
8
|
-
var getColor = require('../../utilities/getColor.js');
|
|
9
8
|
|
|
10
|
-
const Card = React.forwardRef(({ isLink = false, asChild = false, className, ...rest }, ref) => {
|
|
9
|
+
const Card = React.forwardRef(({ isLink = false, asChild = false, color = 'neutral', className, ...rest }, ref) => {
|
|
11
10
|
const Component = asChild ? index.Slot : 'div';
|
|
12
|
-
const color = getColor.getColor(rest.color || 'neutral');
|
|
13
11
|
return (jsxRuntime.jsx(Component, { ref: ref, className: lite.clsx(`fds-card`, `fds-card--${color}`, isLink && `fds-card--link`, isLink && `fds-focus`, className), ...rest }));
|
|
14
12
|
});
|
|
15
13
|
Card.displayName = 'Card';
|
|
@@ -4,11 +4,9 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var lite = require('../../../node_modules/clsx/dist/lite.js');
|
|
7
|
-
var getSize = require('../../../utilities/getSize.js');
|
|
8
7
|
|
|
9
8
|
const ChipGroupContext = React.createContext(null);
|
|
10
|
-
const Group = React.forwardRef(({ children, className, ...rest }, ref) => {
|
|
11
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
9
|
+
const Group = React.forwardRef(({ size = 'md', children, className, ...rest }, ref) => {
|
|
12
10
|
return (jsxRuntime.jsx("ul", { ref: ref, className: lite.clsx(`fds-chip--group-container`, `fds-chip--${size}`, className), ...rest, children: jsxRuntime.jsx(ChipGroupContext.Provider, { value: { size }, children: React.Children.toArray(children).map((child, index) => React.isValidElement(child) ? (jsxRuntime.jsx("li", { children: child }, `chip-${index}`)) : null) }) }));
|
|
13
11
|
});
|
|
14
12
|
Group.displayName = 'ChipGroup';
|
|
@@ -6,12 +6,10 @@ var React = require('react');
|
|
|
6
6
|
var akselIcons = require('@navikt/aksel-icons');
|
|
7
7
|
var lite = require('../../../node_modules/clsx/dist/lite.js');
|
|
8
8
|
var Group = require('../Group/Group.js');
|
|
9
|
-
var getSize = require('../../../utilities/getSize.js');
|
|
10
9
|
var Paragraph = require('../../Typography/Paragraph/Paragraph.js');
|
|
11
10
|
|
|
12
|
-
const RemovableChip = React.forwardRef(({ children, className, ...rest }, ref) => {
|
|
11
|
+
const RemovableChip = React.forwardRef(({ size = 'md', children, className, ...rest }, ref) => {
|
|
13
12
|
const group = React.useContext(Group.ChipGroupContext);
|
|
14
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
15
13
|
return (jsxRuntime.jsx("button", { type: 'button', ref: ref, className: lite.clsx(`fds-focus`, `fds-chip--button`, `fds-chip--removable`, `fds-chip--${group?.size || size}`, className), ...rest, children: jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: group?.size || size, variant: 'short', children: jsxRuntime.jsxs("span", { className: `fds-chip__label`, children: [jsxRuntime.jsx("span", { children: children }), jsxRuntime.jsx("span", { className: `fds-chip__x-mark`, "aria-hidden": true, children: jsxRuntime.jsx(akselIcons.XMarkIcon, { className: `fds-chip__icon` }) })] }) }) }));
|
|
16
14
|
});
|
|
17
15
|
RemovableChip.displayName = 'ChipRemovable';
|
|
@@ -6,13 +6,11 @@ var React = require('react');
|
|
|
6
6
|
var akselIcons = require('@navikt/aksel-icons');
|
|
7
7
|
var lite = require('../../../node_modules/clsx/dist/lite.js');
|
|
8
8
|
var Group = require('../Group/Group.js');
|
|
9
|
-
var getSize = require('../../../utilities/getSize.js');
|
|
10
9
|
var Paragraph = require('../../Typography/Paragraph/Paragraph.js');
|
|
11
10
|
|
|
12
|
-
const ToggleChip = React.forwardRef(({ children, selected = false, checkmark = true, className, ...rest }, ref) => {
|
|
11
|
+
const ToggleChip = React.forwardRef(({ children, selected = false, checkmark = true, size = 'md', className, ...rest }, ref) => {
|
|
13
12
|
const shouldDisplayCheckmark = checkmark && selected;
|
|
14
13
|
const group = React.useContext(Group.ChipGroupContext);
|
|
15
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
16
14
|
return (jsxRuntime.jsx("button", { ref: ref, type: 'button', "aria-pressed": selected, className: lite.clsx(`fds-focus`, `fds-chip--button`, `fds-chip--${group?.size || size}`, shouldDisplayCheckmark && `fds-chip--spacing`, className), ...rest, children: jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: group?.size || size, variant: 'short', children: jsxRuntime.jsxs("span", { className: `fds-chip__label`, children: [shouldDisplayCheckmark && (jsxRuntime.jsx(akselIcons.CheckmarkIcon, { className: `fds-chip__checkmark-icon`, "aria-hidden": true })), jsxRuntime.jsx("span", { children: children })] }) }) }));
|
|
17
15
|
});
|
|
18
16
|
ToggleChip.displayName = 'ChipToggle';
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var getSize = require('../../utilities/getSize.js');
|
|
7
6
|
|
|
8
|
-
const DropdownMenu = ({ open, onClose, placement = 'bottom-end', portal, children,
|
|
9
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
7
|
+
const DropdownMenu = ({ open, onClose, placement = 'bottom-end', portal, size = 'md', children, }) => {
|
|
10
8
|
const triggerRef = React.useRef(null);
|
|
11
9
|
const [internalOpen, setInternalOpen] = React.useState(open ?? false);
|
|
12
10
|
const anchorEl = triggerRef.current;
|
|
@@ -6,7 +6,7 @@ var React = require('react');
|
|
|
6
6
|
var floatingUi_react = require('../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
7
7
|
var lite = require('../../node_modules/clsx/dist/lite.js');
|
|
8
8
|
var DropdownMenu = require('./DropdownMenu.js');
|
|
9
|
-
var floatingUi_dom = require('../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
|
|
9
|
+
var floatingUi_dom = require('../../node_modules/@floating-ui/react-dom/node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
|
|
10
10
|
var floatingUi_core = require('../../node_modules/@floating-ui/core/dist/floating-ui.core.js');
|
|
11
11
|
var useIsomorphicLayoutEffect = require('../../hooks/useIsomorphicLayoutEffect.js');
|
|
12
12
|
|
|
@@ -5,11 +5,9 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var lite = require('../../node_modules/clsx/dist/lite.js');
|
|
7
7
|
var index = require('../Popover/index.js');
|
|
8
|
-
var getSize = require('../../utilities/getSize.js');
|
|
9
8
|
var HelpTextIcon = require('./HelpTextIcon.js');
|
|
10
9
|
|
|
11
|
-
const HelpText = ({ title, placement = 'right', portal, className, children, ...rest }) => {
|
|
12
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
10
|
+
const HelpText = ({ title, placement = 'right', portal, size = 'md', className, children, ...rest }) => {
|
|
13
11
|
const [open, setOpen] = React.useState(false);
|
|
14
12
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(index.Popover, { variant: 'info', placement: placement, size: size, portal: portal, open: open, onClose: () => setOpen(false), children: [jsxRuntime.jsx(index.Popover.Trigger, { asChild: true, variant: 'tertiary', children: jsxRuntime.jsxs("button", { className: lite.clsx(`fds-helptext--${size}`, 'fds-helptext__button', `fds-focus`, className), "aria-expanded": open, onClick: () => setOpen(!open), ...rest, children: [jsxRuntime.jsx(HelpTextIcon.HelpTextIcon, { filled: true, className: lite.clsx(`fds-helptext__icon`, `fds-helptext__icon--filled`, className), openState: open }), jsxRuntime.jsx(HelpTextIcon.HelpTextIcon, { className: lite.clsx(`fds-helptext__icon`, className), openState: open }), jsxRuntime.jsx("span", { className: `fds-sr-only`, children: title })] }) }), jsxRuntime.jsx(index.Popover.Content, { className: 'fds-helptext__content', children: children })] }) }));
|
|
15
13
|
};
|
|
@@ -6,9 +6,9 @@ var React = require('react');
|
|
|
6
6
|
var lite = require('../../node_modules/clsx/dist/lite.js');
|
|
7
7
|
var index = require('../../node_modules/@radix-ui/react-slot/dist/index.js');
|
|
8
8
|
|
|
9
|
-
const Link = React.forwardRef(({ asChild, children, className,
|
|
9
|
+
const Link = React.forwardRef(({ asChild, children, className, ...rest }, ref) => {
|
|
10
10
|
const Component = asChild ? index.Slot : 'a';
|
|
11
|
-
return (jsxRuntime.jsx(Component, { className: lite.clsx('fds-link', className), ref: ref,
|
|
11
|
+
return (jsxRuntime.jsx(Component, { className: lite.clsx('fds-link', className), ref: ref, ...rest, children: children }));
|
|
12
12
|
});
|
|
13
13
|
Link.displayName = 'Link';
|
|
14
14
|
|
|
@@ -4,17 +4,15 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var index = require('../../node_modules/@radix-ui/react-slot/dist/index.js');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var getSize = require('../../utilities/getSize.js');
|
|
8
7
|
|
|
9
8
|
const ListContext = React.createContext({
|
|
10
9
|
size: 'md',
|
|
11
10
|
headingId: 'heading',
|
|
12
11
|
setHeadingId: () => { },
|
|
13
12
|
});
|
|
14
|
-
const ListRoot = React.forwardRef(({ asChild, ...rest }, ref) => {
|
|
13
|
+
const ListRoot = React.forwardRef(({ size = 'md', asChild, ...rest }, ref) => {
|
|
15
14
|
const [headingId, setHeadingId] = React.useState();
|
|
16
15
|
const Component = asChild ? index.Slot : 'div';
|
|
17
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
18
16
|
return (jsxRuntime.jsx(ListContext.Provider, { value: { size, headingId, setHeadingId }, children: jsxRuntime.jsx(Component, { ref: ref, ...rest }) }));
|
|
19
17
|
});
|
|
20
18
|
ListRoot.displayName = 'ListRoot';
|
|
@@ -5,7 +5,6 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var lite = require('../../node_modules/clsx/dist/lite.js');
|
|
7
7
|
var akselIcons = require('@navikt/aksel-icons');
|
|
8
|
-
var getSize = require('../../utilities/getSize.js');
|
|
9
8
|
var PaginationRoot = require('./PaginationRoot.js');
|
|
10
9
|
var PaginationContent = require('./PaginationContent.js');
|
|
11
10
|
var PaginationItem = require('./PaginationItem.js');
|
|
@@ -19,13 +18,12 @@ const iconSize = {
|
|
|
19
18
|
md: '1.5rem',
|
|
20
19
|
lg: '2rem',
|
|
21
20
|
};
|
|
22
|
-
const Pagination = React.forwardRef(({ nextLabel = '', previousLabel = '', compact = false, hideLabels = false, currentPage = 1, totalPages, onChange, itemLabel = (num) => `Side ${num}`, ...rest }, ref) => {
|
|
21
|
+
const Pagination = React.forwardRef(({ nextLabel = '', previousLabel = '', compact = false, hideLabels = false, currentPage = 1, totalPages, size = 'md', onChange, itemLabel = (num) => `Side ${num}`, ...rest }, ref) => {
|
|
23
22
|
const { pages, showNextPage, showPreviousPage } = usePagination.usePagination({
|
|
24
23
|
compact,
|
|
25
24
|
currentPage,
|
|
26
25
|
totalPages,
|
|
27
26
|
});
|
|
28
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
29
27
|
return (jsxRuntime.jsx(PaginationRoot.PaginationRoot, { ref: ref, "aria-label": 'Pagination', size: size, compact: compact, ...rest, children: jsxRuntime.jsxs(PaginationContent.PaginationContent, { children: [jsxRuntime.jsx(PaginationItem.PaginationItem, { children: jsxRuntime.jsxs(PaginationNextPrev.PaginationPrevious, { className: lite.clsx(!showPreviousPage && 'fds-pagination--hidden'), onClick: () => {
|
|
30
28
|
onChange(currentPage - 1);
|
|
31
29
|
}, "aria-label": previousLabel, children: [jsxRuntime.jsx(akselIcons.ChevronLeftIcon, { "aria-hidden": true, fontSize: iconSize[size] }), !hideLabels && previousLabel] }) }), pages.map((page, i) => (jsxRuntime.jsx(PaginationItem.PaginationItem, { children: page === 'ellipsis' ? (jsxRuntime.jsx(PaginationEllipsis.PaginationEllipsis, {})) : (jsxRuntime.jsx(PaginationButton.PaginationButton, { "aria-current": currentPage === page, isActive: currentPage === page, "aria-label": itemLabel(page), onClick: () => {
|
|
@@ -6,15 +6,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var index = require('../../node_modules/@radix-ui/react-slot/dist/index.js');
|
|
8
8
|
var React = require('react');
|
|
9
|
-
var getSize = require('../../utilities/getSize.js');
|
|
10
9
|
|
|
11
10
|
const PaginationContext = React.createContext({
|
|
12
11
|
size: 'md',
|
|
13
12
|
compact: false,
|
|
14
13
|
});
|
|
15
|
-
const PaginationRoot = React.forwardRef(({ asChild, compact = false, ...rest }, ref) => {
|
|
14
|
+
const PaginationRoot = React.forwardRef(({ asChild, compact = false, size = 'md', ...rest }, ref) => {
|
|
16
15
|
const Component = asChild ? index.Slot : 'nav';
|
|
17
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
18
16
|
return (jsxRuntime.jsx(PaginationContext.Provider, { value: { size, compact }, children: jsxRuntime.jsx(Component, { ref: ref, "aria-label": 'Pagination', ...rest }) }));
|
|
19
17
|
});
|
|
20
18
|
var PaginationRoot$1 = PaginationRoot;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var getSize = require('../../utilities/getSize.js');
|
|
7
6
|
|
|
8
7
|
function _interopNamespaceDefault(e) {
|
|
9
8
|
var n = Object.create(null);
|
|
@@ -24,8 +23,7 @@ function _interopNamespaceDefault(e) {
|
|
|
24
23
|
|
|
25
24
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
26
25
|
|
|
27
|
-
const Popover = ({ children, placement = 'top', open, variant = 'default', portal, onOpenChange, onClose,
|
|
28
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
26
|
+
const Popover = ({ children, placement = 'top', open, variant = 'default', portal, size = 'md', onOpenChange, onClose, }) => {
|
|
29
27
|
const triggerRef = React.useRef(null);
|
|
30
28
|
const [internalOpen, setInternalOpen] = React.useState(open ?? false);
|
|
31
29
|
const randomPopoverId = React.useId();
|
|
@@ -6,7 +6,7 @@ var React = require('react');
|
|
|
6
6
|
var floatingUi_react = require('../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
7
7
|
var lite = require('../../node_modules/clsx/dist/lite.js');
|
|
8
8
|
var Popover = require('./Popover.js');
|
|
9
|
-
var floatingUi_dom = require('../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
|
|
9
|
+
var floatingUi_dom = require('../../node_modules/@floating-ui/react-dom/node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
|
|
10
10
|
var floatingUi_core = require('../../node_modules/@floating-ui/core/dist/floating-ui.core.js');
|
|
11
11
|
var floatingUi_reactDom = require('../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js');
|
|
12
12
|
var useIsomorphicLayoutEffect = require('../../hooks/useIsomorphicLayoutEffect.js');
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var lite = require('../../node_modules/clsx/dist/lite.js');
|
|
6
|
-
var getSize = require('../../utilities/getSize.js');
|
|
7
6
|
var useSynchronizedAnimation = require('../../hooks/useSynchronizedAnimation.js');
|
|
8
7
|
|
|
9
8
|
const sizeMap = {
|
|
@@ -15,13 +14,10 @@ const sizeMap = {
|
|
|
15
14
|
xl: 79,
|
|
16
15
|
};
|
|
17
16
|
/** Spinner component used for indicating busy or indeterminate loading */
|
|
18
|
-
const Spinner = ({ title,
|
|
19
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
17
|
+
const Spinner = ({ title, color = 'neutral', size = 'md', className, style, ...rest }) => {
|
|
20
18
|
const svgRef = useSynchronizedAnimation.useSynchronizedAnimation('fds-spinner-rotate-animation');
|
|
21
19
|
const strokeRef = useSynchronizedAnimation.useSynchronizedAnimation('fds-spinner-stroke-animation');
|
|
22
|
-
return (jsxRuntime.jsxs("svg", { className: lite.clsx('fds-spinner',
|
|
23
|
-
? `fds-spinner--${variant}`
|
|
24
|
-
: 'fds-spinner--default', className), "data-ds-color-mode": variant === 'inverted' ? 'dark' : undefined, style: { width: sizeMap[size], height: sizeMap[size], ...style }, viewBox: '0 0 50 50', ref: svgRef, ...rest, children: [jsxRuntime.jsx("title", { children: title }), jsxRuntime.jsx("circle", { className: lite.clsx('fds-spinner__background', variant === 'inverted' && 'fds-spinner__background--inverted'), cx: '25', cy: '25', r: '20', fill: 'none', strokeWidth: '5' }), jsxRuntime.jsx("circle", { className: lite.clsx(`fds-spinner__circle`), cx: '25', cy: '25', r: '20', fill: 'none', strokeWidth: '5', ref: strokeRef })] }));
|
|
20
|
+
return (jsxRuntime.jsxs("svg", { className: lite.clsx('fds-spinner', `fds-spinner--${color}`, className), style: { width: sizeMap[size], height: sizeMap[size], ...style }, viewBox: '0 0 50 50', ref: svgRef, ...rest, children: [jsxRuntime.jsx("title", { children: title }), jsxRuntime.jsx("circle", { className: lite.clsx('fds-spinner__background'), cx: '25', cy: '25', r: '20', fill: 'none', strokeWidth: '5' }), jsxRuntime.jsx("circle", { className: lite.clsx(`fds-spinner__circle`), cx: '25', cy: '25', r: '20', fill: 'none', strokeWidth: '5', ref: strokeRef })] }));
|
|
25
21
|
};
|
|
26
22
|
Spinner.displayName = 'Spinner';
|
|
27
23
|
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var lite = require('../../node_modules/clsx/dist/lite.js');
|
|
7
|
-
var getSize = require('../../utilities/getSize.js');
|
|
8
7
|
var Paragraph = require('../Typography/Paragraph/Paragraph.js');
|
|
9
8
|
|
|
10
9
|
function _interopNamespaceDefault(e) {
|
|
@@ -26,8 +25,7 @@ function _interopNamespaceDefault(e) {
|
|
|
26
25
|
|
|
27
26
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
28
27
|
|
|
29
|
-
const Table = React__namespace.forwardRef(({ zebra = false, stickyHeader = false, border = false, className, children, ...rest }, ref) => {
|
|
30
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
28
|
+
const Table = React__namespace.forwardRef(({ zebra = false, stickyHeader = false, border = false, size = 'md', className, children, ...rest }, ref) => {
|
|
31
29
|
return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsx("table", { ref: ref, className: lite.clsx('fds-table', `fds-table--${size}`, zebra && 'fds-table--zebra', stickyHeader && 'fds-table--sticky-header', border && 'fds-table--border', className), ...rest, children: children }) }));
|
|
32
30
|
});
|
|
33
31
|
Table.displayName = 'Table';
|
|
@@ -4,11 +4,9 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var lite = require('../../node_modules/clsx/dist/lite.js');
|
|
7
|
-
var getSize = require('../../utilities/getSize.js');
|
|
8
7
|
|
|
9
8
|
const TabsContext = React.createContext({});
|
|
10
|
-
const Tabs = React.forwardRef(({ children, value, defaultValue, className, onChange, ...rest }, ref) => {
|
|
11
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
9
|
+
const Tabs = React.forwardRef(({ size = 'md', children, value, defaultValue, className, onChange, ...rest }, ref) => {
|
|
12
10
|
const isControlled = value !== undefined;
|
|
13
11
|
const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue);
|
|
14
12
|
let onValueChange = onChange;
|
|
@@ -4,13 +4,9 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var lite = require('../../node_modules/clsx/dist/lite.js');
|
|
7
|
-
var getSize = require('../../utilities/getSize.js');
|
|
8
|
-
var getColor = require('../../utilities/getColor.js');
|
|
9
7
|
var Paragraph = require('../Typography/Paragraph/Paragraph.js');
|
|
10
8
|
|
|
11
|
-
const Tag = React.forwardRef(({ children, className, ...rest }, ref) => {
|
|
12
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
13
|
-
const color = getColor.getColor(rest.color || 'neutral');
|
|
9
|
+
const Tag = React.forwardRef(({ size = 'md', color = 'neutral', children, className, ...rest }, ref) => {
|
|
14
10
|
return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsx("span", { className: lite.clsx('fds-tag', `fds-tag--${color}`, `fds-tag--${size}`, className), ref: ref, ...rest, children: children }) }));
|
|
15
11
|
});
|
|
16
12
|
Tag.displayName = 'Tag';
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var lite = require('../../node_modules/clsx/dist/lite.js');
|
|
7
|
-
var getSize = require('../../utilities/getSize.js');
|
|
8
7
|
var RovingTabindexRoot = require('../../utilities/RovingTabIndex/RovingTabindexRoot.js');
|
|
9
8
|
|
|
10
9
|
const ToggleGroupContext = React.createContext({});
|
|
@@ -18,8 +17,7 @@ const ToggleGroupContext = React.createContext({});
|
|
|
18
17
|
* </ToggleGroup>
|
|
19
18
|
* ```
|
|
20
19
|
*/
|
|
21
|
-
const ToggleGroup = React.forwardRef(({ children, value, defaultValue, onChange, name, className, ...rest }, ref) => {
|
|
22
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
20
|
+
const ToggleGroup = React.forwardRef(({ size = 'md', children, value, defaultValue, onChange, name, className, ...rest }, ref) => {
|
|
23
21
|
const nameId = React.useId();
|
|
24
22
|
const isControlled = value !== undefined;
|
|
25
23
|
const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue);
|
|
@@ -5,7 +5,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var lite = require('../../node_modules/clsx/dist/lite.js');
|
|
7
7
|
var floatingUi_react = require('../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
8
|
-
var floatingUi_dom = require('../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
|
|
8
|
+
var floatingUi_dom = require('../../node_modules/@floating-ui/react-dom/node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
|
|
9
9
|
var floatingUi_core = require('../../node_modules/@floating-ui/core/dist/floating-ui.core.js');
|
|
10
10
|
var floatingUi_reactDom = require('../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js');
|
|
11
11
|
|
|
@@ -30,7 +30,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
30
30
|
|
|
31
31
|
const ARROW_HEIGHT = 7;
|
|
32
32
|
const ARROW_GAP = 4;
|
|
33
|
-
const Tooltip = React.forwardRef(({ children, content, placement = 'top', delay = 150, open: userOpen, defaultOpen = false, portal =
|
|
33
|
+
const Tooltip = React.forwardRef(({ children, content, placement = 'top', delay = 150, open: userOpen, defaultOpen = false, portal = false, className, style, ...rest }, ref) => {
|
|
34
34
|
const [isOpen, setIsOpen] = React.useState(defaultOpen);
|
|
35
35
|
const Container = portal ? floatingUi_react.FloatingPortal : React__namespace.Fragment;
|
|
36
36
|
const arrowRef = React__namespace.useRef(null);
|
|
@@ -77,7 +77,7 @@ const Tooltip = React.forwardRef(({ children, content, placement = 'top', delay
|
|
|
77
77
|
}
|
|
78
78
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [React.cloneElement(children, getReferenceProps({
|
|
79
79
|
ref: childMergedRef,
|
|
80
|
-
})), internalOpen && (jsxRuntime.jsx(Container, { children: jsxRuntime.jsxs("div", { ref: refs.setFloating, style: { ...floatingStyles, ...animationStyles, ...style }, role: 'tooltip',
|
|
80
|
+
})), internalOpen && (jsxRuntime.jsx(Container, { children: jsxRuntime.jsxs("div", { ref: refs.setFloating, style: { ...floatingStyles, ...animationStyles, ...style }, role: 'tooltip', ...getFloatingProps({
|
|
81
81
|
className: lite.clsx('fds-tooltip', className),
|
|
82
82
|
ref: mergedRef,
|
|
83
83
|
...rest,
|
|
@@ -5,12 +5,10 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var lite = require('../../../node_modules/clsx/dist/lite.js');
|
|
7
7
|
var index = require('../../../node_modules/@radix-ui/react-slot/dist/index.js');
|
|
8
|
-
var getSize = require('../../../utilities/getSize.js');
|
|
9
8
|
|
|
10
9
|
/** Use `ErrorMessage` to display text as error message. */
|
|
11
|
-
const ErrorMessage = React.forwardRef(({ className, spacing, asChild, error = true, ...rest }, ref) => {
|
|
10
|
+
const ErrorMessage = React.forwardRef(({ size = 'md', className, spacing, asChild, error = true, ...rest }, ref) => {
|
|
12
11
|
const Component = asChild ? index.Slot : 'div';
|
|
13
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
14
12
|
return (jsxRuntime.jsx(Component, { ref: ref, className: lite.clsx('fds-error-message', `fds-error-message--${size}`, spacing && 'fds-error-message--spacing', error && 'fds-error-message--error', className), ...rest }));
|
|
15
13
|
});
|
|
16
14
|
ErrorMessage.displayName = 'ErrorMessage';
|
|
@@ -5,12 +5,10 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var lite = require('../../../node_modules/clsx/dist/lite.js');
|
|
7
7
|
var index = require('../../../node_modules/@radix-ui/react-slot/dist/index.js');
|
|
8
|
-
var getSize = require('../../../utilities/getSize.js');
|
|
9
8
|
|
|
10
9
|
/** Use `Heading` to render h1-6 elements with heading text styles. */
|
|
11
|
-
const Heading = React.forwardRef(({ level = 1, spacing = false, className, asChild, ...rest }, ref) => {
|
|
10
|
+
const Heading = React.forwardRef(({ size = 'xl', level = 1, spacing = false, className, asChild, ...rest }, ref) => {
|
|
12
11
|
const Component = asChild ? index.Slot : `h${level ?? 1}`;
|
|
13
|
-
const size = getSize.getSize(rest.size || 'xl');
|
|
14
12
|
return (jsxRuntime.jsx(Component, { ref: ref, className: lite.clsx('fds-heading', `fds-heading--${size}`, spacing && 'fds-heading--spacing', className), ...rest }));
|
|
15
13
|
});
|
|
16
14
|
Heading.displayName = 'Heading';
|
|
@@ -5,12 +5,10 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var lite = require('../../../node_modules/clsx/dist/lite.js');
|
|
7
7
|
var index = require('../../../node_modules/@radix-ui/react-slot/dist/index.js');
|
|
8
|
-
var getSize = require('../../../utilities/getSize.js');
|
|
9
8
|
|
|
10
9
|
/** Use `Ingress` to display text as ingress. */
|
|
11
|
-
const Ingress = React.forwardRef(({ className, spacing, asChild, ...rest }, ref) => {
|
|
10
|
+
const Ingress = React.forwardRef(({ size = 'md', className, spacing, asChild, ...rest }, ref) => {
|
|
12
11
|
const Component = asChild ? index.Slot : 'p';
|
|
13
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
14
12
|
return (jsxRuntime.jsx(Component, { ref: ref, className: lite.clsx(`fds-ingress`, `fds-ingress--${size}`, spacing && 'fds-ingress--spacing', className), ...rest }));
|
|
15
13
|
});
|
|
16
14
|
Ingress.displayName = 'Ingress';
|
|
@@ -5,12 +5,10 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var lite = require('../../../node_modules/clsx/dist/lite.js');
|
|
7
7
|
var index = require('../../../node_modules/@radix-ui/react-slot/dist/index.js');
|
|
8
|
-
var getSize = require('../../../utilities/getSize.js');
|
|
9
8
|
|
|
10
9
|
/** Use `Label` for labels. */
|
|
11
|
-
const Label = React.forwardRef(({ className, spacing, weight = 'medium', asChild, ...rest }, ref) => {
|
|
10
|
+
const Label = React.forwardRef(({ className, spacing, size = 'md', weight = 'medium', asChild, ...rest }, ref) => {
|
|
12
11
|
const Component = asChild ? index.Slot : 'label';
|
|
13
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
14
12
|
return (jsxRuntime.jsx(Component, { ref: ref, className: lite.clsx('fds-label', `fds-label--${size}`, spacing && 'fds-label--spacing', weight && `fds-label--${weight}-weight`, className), ...rest }));
|
|
15
13
|
});
|
|
16
14
|
Label.displayName = 'Label';
|
|
@@ -5,12 +5,10 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var lite = require('../../../node_modules/clsx/dist/lite.js');
|
|
7
7
|
var index = require('../../../node_modules/@radix-ui/react-slot/dist/index.js');
|
|
8
|
-
var getSize = require('../../../utilities/getSize.js');
|
|
9
8
|
|
|
10
9
|
/** Use `Paragraph` to display text with paragraph text styles. */
|
|
11
|
-
const Paragraph = React.forwardRef(({ className, spacing, asChild, variant, ...rest }, ref) => {
|
|
10
|
+
const Paragraph = React.forwardRef(({ className, spacing, size = 'md', asChild, variant, ...rest }, ref) => {
|
|
12
11
|
const Component = asChild ? index.Slot : 'p';
|
|
13
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
14
12
|
return (jsxRuntime.jsx(Component, { ref: ref, className: lite.clsx('fds-paragraph', `fds-paragraph--${size}`, spacing && 'fds-paragraph--spacing', variant && `fds-paragraph--${variant}`, className), ...rest }));
|
|
15
13
|
});
|
|
16
14
|
Paragraph.displayName = 'Paragraph';
|
|
@@ -21,7 +21,7 @@ const Checkbox = React.forwardRef((props, ref) => {
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
]);
|
|
24
|
-
return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { className: lite.clsx('fds-checkbox', `fds-checkbox--${size}`,
|
|
24
|
+
return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { className: lite.clsx('fds-checkbox', `fds-checkbox--${size}`, hasError && `fds-checkbox--error`, readOnly && `fds-checkbox--readonly`, className), style: style, children: [jsxRuntime.jsx("input", { className: `fds-checkbox__input`, ref: inputRef, ...objectUtils.omit(['size', 'error', 'indeterminate'], rest), ...inputProps, type: 'checkbox', disabled: inputProps.disabled, "aria-checked": rest.indeterminate ? 'mixed' : inputProps.checked }), children && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Label.Label, { className: `fds-checkbox__label`, htmlFor: inputProps.id, size: size, weight: 'regular', children: jsxRuntime.jsx("span", { children: children }) }), description && (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsx("div", { id: descriptionId, className: `fds-checkbox__description`, children: description }) }))] }))] }) }));
|
|
25
25
|
});
|
|
26
26
|
Checkbox.displayName = 'Checkbox';
|
|
27
27
|
|
|
@@ -8,7 +8,6 @@ var lite = require('../../../node_modules/clsx/dist/lite.js');
|
|
|
8
8
|
var index = require('../../../node_modules/@tanstack/react-virtual/dist/esm/index.js');
|
|
9
9
|
var useFormField = require('../useFormField.js');
|
|
10
10
|
var useDebounce = require('../../../utilities/useDebounce.js');
|
|
11
|
-
var getSize = require('../../../utilities/getSize.js');
|
|
12
11
|
var useCombobox = require('./useCombobox.js');
|
|
13
12
|
var ComboboxInput = require('./internal/ComboboxInput.js');
|
|
14
13
|
var ComboboxLabel = require('./internal/ComboboxLabel.js');
|
|
@@ -23,8 +22,7 @@ var Box = require('../../Box/Box.js');
|
|
|
23
22
|
var Spinner = require('../../Spinner/Spinner.js');
|
|
24
23
|
var objectUtils = require('../../../utilities/objectUtils.js');
|
|
25
24
|
|
|
26
|
-
const ComboboxComponent = React.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) => {
|
|
27
|
-
const size = getSize.getSize(rest.size || 'md');
|
|
25
|
+
const ComboboxComponent = React.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, size = 'md', loading, loadingLabel = 'Laster...', filter, chipSrLabel = (option) => 'Slett ' + option.label, className, ...rest }, forwareddRef) => {
|
|
28
26
|
const inputRef = React.useRef(null);
|
|
29
27
|
const portalRef = React.useRef(null);
|
|
30
28
|
const listRef = React.useRef([]);
|
|
@@ -5,7 +5,7 @@ var floatingUi_react = require('../../../node_modules/@floating-ui/react/dist/fl
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var ReactDOM = require('react-dom');
|
|
7
7
|
var ComboboxIdContext = require('./ComboboxIdContext.js');
|
|
8
|
-
var floatingUi_dom = require('../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
|
|
8
|
+
var floatingUi_dom = require('../../../node_modules/@floating-ui/react-dom/node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
|
|
9
9
|
var floatingUi_core = require('../../../node_modules/@floating-ui/core/dist/floating-ui.core.js');
|
|
10
10
|
|
|
11
11
|
const useFloatingCombobox = ({ listRef }) => {
|
|
@@ -21,7 +21,7 @@ const Fieldset = React.forwardRef((props, ref) => {
|
|
|
21
21
|
size,
|
|
22
22
|
disabled: props?.disabled,
|
|
23
23
|
readOnly,
|
|
24
|
-
}, children: jsxRuntime.jsxs("fieldset", { ...fieldsetProps, className: lite.clsx('fds-fieldset', !hideLegend && 'fds-fieldset--spacing', readOnly && 'fds-fieldset--readonly', props?.disabled
|
|
24
|
+
}, children: jsxRuntime.jsxs("fieldset", { ...fieldsetProps, className: lite.clsx('fds-fieldset', !hideLegend && 'fds-fieldset--spacing', readOnly && 'fds-fieldset--readonly', className), disabled: props?.disabled, ref: ref, ...rest, children: [jsxRuntime.jsx(Label.Label, { asChild: true, size: size, children: jsxRuntime.jsx("legend", { className: 'fds-fieldset__legend', children: jsxRuntime.jsxs("span", { className: lite.clsx('fds-fieldset__legend__content', hideLegend && `fds-sr-only`), children: [readOnly && (jsxRuntime.jsx(akselIcons.PadlockLockedFillIcon, { className: 'fds-fieldset__readonly__icon', "aria-hidden": true })), legend] }) }) }), description && (jsxRuntime.jsx(Paragraph.Paragraph, { size: size, variant: 'short', asChild: true, children: jsxRuntime.jsx("div", { id: descriptionId, className: lite.clsx('fds-fieldset__description', hideLegend && `fds-sr-only`), children: description }) })), children, jsxRuntime.jsx("div", { id: errorId, "aria-live": 'polite', "aria-relevant": 'additions removals', className: 'fds-fieldset__error-message', children: hasError && jsxRuntime.jsx(ErrorMessage.ErrorMessage, { size: size, children: error }) })] }) }));
|
|
25
25
|
});
|
|
26
26
|
Fieldset.displayName = 'Fieldset';
|
|
27
27
|
|
|
@@ -14,7 +14,7 @@ var Paragraph = require('../../Typography/Paragraph/Paragraph.js');
|
|
|
14
14
|
const NativeSelect = React.forwardRef((props, ref) => {
|
|
15
15
|
const { children, disabled = false, label, description, hideLabel = false, error, className, htmlSize = 0, ...rest } = props;
|
|
16
16
|
const { selectProps, descriptionId, errorId, readOnly = false, size = 'md', } = useNativeSelect.useNativeSelect(props);
|
|
17
|
-
return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { className: lite.clsx('fds-native-select--container',
|
|
17
|
+
return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { className: lite.clsx('fds-native-select--container', readOnly && 'fds-native-select--readonly', error && 'fds-native-select--error'), children: [label && (jsxRuntime.jsxs(Label.Label, { weight: 'medium', size: size, htmlFor: selectProps.id, className: lite.clsx('fds-native-select__label', hideLabel && 'fds-sr-only'), children: [readOnly && (jsxRuntime.jsx(akselIcons.PadlockLockedFillIcon, { "aria-hidden": true, className: 'fds-native-select__readonly__icon' })), label] })), description && (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsx("div", { id: descriptionId, className: lite.clsx(`fds-native-select__description`, hideLabel && `fds-sr-only`), children: description }) })), jsxRuntime.jsx("div", { className: 'fds-native-select__wrapper', children: jsxRuntime.jsx("select", { disabled: disabled || readOnly, ref: ref, size: htmlSize, className: lite.clsx('fds-native-select', `fds-native-select--${size}`, `fds-focus`, props.multiple && 'fds-native-select--multiple', className), ...objectUtils.omit(['size', 'error', 'errorId'], rest), ...objectUtils.omit(['readOnly', 'disabled'], selectProps), children: children }) }), error && (jsxRuntime.jsx("div", { id: errorId, className: 'fds-native-select__error-message', "aria-live": 'polite', "aria-relevant": 'additions removals', children: jsxRuntime.jsx(ErrorMessage.ErrorMessage, { size: size, children: error }) }))] }) }));
|
|
18
18
|
});
|
|
19
19
|
NativeSelect.displayName = 'NativeSelect';
|
|
20
20
|
|
|
@@ -4,13 +4,11 @@
|
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var useFormField = require('../useFormField.js');
|
|
6
6
|
var FieldsetContext = require('../Fieldset/FieldsetContext.js');
|
|
7
|
-
var getSize = require('../../../utilities/getSize.js');
|
|
8
7
|
|
|
9
8
|
/** Handles props for `NativeSelect` in context with `Fieldset` */
|
|
10
9
|
const useNativeSelect = (props) => {
|
|
11
10
|
const fieldset = React.useContext(FieldsetContext.FieldsetContext);
|
|
12
|
-
const { inputProps: selectProps, readOnly, ...rest } = useFormField.useFormField(props, 'select');
|
|
13
|
-
const size = getSize.getSize(fieldset?.size ?? props.size ?? 'md');
|
|
11
|
+
const { inputProps: selectProps, readOnly, size = fieldset?.size ?? 'md', ...rest } = useFormField.useFormField(props, 'select');
|
|
14
12
|
return {
|
|
15
13
|
...rest,
|
|
16
14
|
readOnly,
|
|
@@ -12,7 +12,7 @@ var Label = require('../../Typography/Label/Label.js');
|
|
|
12
12
|
const Radio = React.forwardRef((props, ref) => {
|
|
13
13
|
const { children, description, className, style, ...rest } = props;
|
|
14
14
|
const { inputProps, descriptionId, hasError, size = 'md', readOnly, } = useRadio.useRadio(props);
|
|
15
|
-
return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { className: lite.clsx('fds-radio', `fds-radio--${size}`,
|
|
15
|
+
return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { className: lite.clsx('fds-radio', `fds-radio--${size}`, hasError && `fds-radio--error`, readOnly && `fds-radio--readonly`, className), style: style, children: [jsxRuntime.jsx("input", { className: 'fds-radio__input', disabled: inputProps.disabled, ref: ref, ...objectUtils.omit(['size', 'error'], rest), ...inputProps }), children && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Label.Label, { className: 'fds-radio__label', htmlFor: inputProps.id, size: size, weight: 'regular', children: jsxRuntime.jsx("span", { children: children }) }), description && (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsx("div", { id: descriptionId, className: 'fds-radio__description', children: description }) }))] }))] }) }));
|
|
16
16
|
});
|
|
17
17
|
Radio.displayName = 'Radio';
|
|
18
18
|
|
|
@@ -4,13 +4,11 @@
|
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var useFormField = require('../useFormField.js');
|
|
6
6
|
var FieldsetContext = require('../Fieldset/FieldsetContext.js');
|
|
7
|
-
var getSize = require('../../../utilities/getSize.js');
|
|
8
7
|
|
|
9
8
|
/** Handles props for `Search` in context with `Fieldset` */
|
|
10
9
|
const useSearch = (props) => {
|
|
11
10
|
const fieldset = React.useContext(FieldsetContext.FieldsetContext);
|
|
12
|
-
const { inputProps, readOnly, ...rest } = useFormField.useFormField(props, 'search');
|
|
13
|
-
const size = fieldset?.size ?? getSize.getSize(props.size || 'md');
|
|
11
|
+
const { inputProps, readOnly, size = fieldset?.size ?? 'md', ...rest } = useFormField.useFormField(props, 'search');
|
|
14
12
|
return {
|
|
15
13
|
...rest,
|
|
16
14
|
readOnly,
|