@digdir/designsystemet-react 1.0.0-rc.2 → 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
|
@@ -13,7 +13,7 @@ var Label = require('../../Typography/Label/Label.js');
|
|
|
13
13
|
const Switch = React.forwardRef((props, ref) => {
|
|
14
14
|
const { children, description, position = 'left', className, ...rest } = props;
|
|
15
15
|
const { inputProps, descriptionId, size = 'md', readOnly, } = useSwitch.useSwitch(props);
|
|
16
|
-
return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { className: lite.clsx(`fds-switch`, `fds-switch--${size}`, inputProps.disabled && `fds-switch--disabled`, readOnly && `fds-switch--readonly`, className), children: [jsxRuntime.jsx("input", { className: `fds-switch__input`, ref: ref, ...objectUtils.omit(['size', 'error'], rest), ...inputProps }), jsxRuntime.jsxs(Label.Label, { className: lite.clsx(`fds-switch__label`, position === 'right' && `fds-switch__label--right`), htmlFor: inputProps.id, size: size, weight: 'regular', children: [jsxRuntime.jsx("span", { className: `fds-switch__track`, children: jsxRuntime.jsx("span", { className: `fds-switch__thumb` }) }), readOnly && (jsxRuntime.jsx(akselIcons.PadlockLockedFillIcon, { "aria-hidden": true, className: `fds-switch__readonly__icon` })), children && jsxRuntime.jsx("span", { children: children })] }), description && (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsx("div", { id: descriptionId, className: `fds-switch__description`, children: description }) }))] }) }));
|
|
16
|
+
return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { className: lite.clsx(`fds-switch`, `fds-switch--${size}`, inputProps.disabled && `fds-switch--disabled`, readOnly && `fds-switch--readonly`, className), children: [jsxRuntime.jsx("input", { className: `fds-switch__input`, disabled: inputProps.disabled, ref: ref, ...objectUtils.omit(['size', 'error'], rest), ...inputProps }), jsxRuntime.jsxs(Label.Label, { className: lite.clsx(`fds-switch__label`, position === 'right' && `fds-switch__label--right`), htmlFor: inputProps.id, size: size, weight: 'regular', children: [jsxRuntime.jsx("span", { className: `fds-switch__track`, children: jsxRuntime.jsx("span", { className: `fds-switch__thumb` }) }), readOnly && (jsxRuntime.jsx(akselIcons.PadlockLockedFillIcon, { "aria-hidden": true, className: `fds-switch__readonly__icon` })), children && jsxRuntime.jsx("span", { children: children })] }), description && (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsx("div", { id: descriptionId, className: `fds-switch__description`, children: description }) }))] }) }));
|
|
17
17
|
});
|
|
18
18
|
Switch.displayName = 'Switch';
|
|
19
19
|
|
|
@@ -26,7 +26,7 @@ const Textarea = React.forwardRef((props, ref) => {
|
|
|
26
26
|
const characterLimitId = `${textareaProps.id}-charactercount}`;
|
|
27
27
|
const hasCharacterLimit = characterLimit != null;
|
|
28
28
|
const describedBy = lite.clsx(textareaProps['aria-describedby'], hasCharacterLimit && characterLimitId) || undefined;
|
|
29
|
-
return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { style: style, className: lite.clsx('fds-textarea', `fds-textarea--${size}`,
|
|
29
|
+
return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { style: style, className: lite.clsx('fds-textarea', `fds-textarea--${size}`, hasError && `fds-textarea--error`, className), children: [label && (jsxRuntime.jsxs(Label.Label, { size: size, weight: 'medium', htmlFor: textareaProps.id, className: lite.clsx('fds-textarea__label', hideLabel && `fds-sr-only`), children: [readOnly && (jsxRuntime.jsx(akselIcons.PadlockLockedFillIcon, { "aria-hidden": true, className: 'fds-textarea__readonly-icon' })), jsxRuntime.jsx("span", { children: label })] })), description && (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsx("div", { id: descriptionId, className: lite.clsx('fds-textarea__description', hideLabel && `fds-sr-only`), children: description }) })), jsxRuntime.jsx("textarea", { className: lite.clsx('fds-textarea__input', `fds-focus`), ref: ref, "aria-describedby": describedBy, disabled: textareaProps.disabled, readOnly: readOnly, ...objectUtils.omit(['size', 'error', 'errorId'], rest), ...textareaProps, onChange: (e) => {
|
|
30
30
|
textareaProps?.onChange?.(e);
|
|
31
31
|
setValue(e.target.value);
|
|
32
32
|
} }), hasCharacterLimit && (jsxRuntime.jsx(CharacterCounter.CharacterCounter, { size: size, value: value ? value.toString() : '', id: characterLimitId, ...characterLimit })), jsxRuntime.jsx("div", { className: 'fds-textarea__error-message', id: errorId, "aria-live": 'polite', "aria-relevant": 'additions removals', children: hasError && jsxRuntime.jsx(ErrorMessage.ErrorMessage, { size: size, children: props.error }) })] }) }));
|
|
@@ -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 `Textarea` in context with `Fieldset` */
|
|
10
9
|
const useTextarea = (props) => {
|
|
11
10
|
const fieldset = React.useContext(FieldsetContext.FieldsetContext);
|
|
12
|
-
const { inputProps, readOnly, ...rest } = useFormField.useFormField(props, 'textarea');
|
|
13
|
-
const size = fieldset?.size ?? getSize.getSize(props.size ?? 'md');
|
|
11
|
+
const { inputProps, readOnly, size = fieldset?.size ?? 'md', ...rest } = useFormField.useFormField(props, 'textarea');
|
|
14
12
|
return {
|
|
15
13
|
...rest,
|
|
16
14
|
readOnly,
|
|
@@ -26,7 +26,7 @@ const Textfield = React.forwardRef((props, ref) => {
|
|
|
26
26
|
const characterLimitId = `textfield-charactercount-${React.useId()}`;
|
|
27
27
|
const hasCharacterLimit = characterLimit != null;
|
|
28
28
|
const describedBy = lite.clsx(inputProps['aria-describedby'], hasCharacterLimit && characterLimitId) || undefined;
|
|
29
|
-
return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { style: style, className: lite.clsx(`fds-textfield`, `fds-textfield--${size}`,
|
|
29
|
+
return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { style: style, className: lite.clsx(`fds-textfield`, `fds-textfield--${size}`, readOnly && `fds-textfield--readonly`, hasError && `fds-textfield--error`, className), children: [label && (jsxRuntime.jsxs(Label.Label, { size: size, weight: 'medium', htmlFor: inputProps.id, className: lite.clsx(`fds-textfield__label`, hideLabel && `fds-sr-only`), children: [readOnly && (jsxRuntime.jsx(akselIcons.PadlockLockedFillIcon, { "aria-hidden": true, className: 'fds-textfield__readonly__icon' })), jsxRuntime.jsx("span", { children: label })] })), description && (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsx("div", { id: descriptionId, className: lite.clsx(`fds-textfield__description`, hideLabel && `fds-sr-only`), children: description }) })), jsxRuntime.jsxs("div", { className: 'fds-textfield__field', children: [prefix && (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, variant: 'short', children: jsxRuntime.jsx("div", { className: lite.clsx(`fds-textfield__adornment`, `fds-textfield__prefix`), "aria-hidden": 'true', children: prefix }) })), jsxRuntime.jsx("input", { className: lite.clsx(`fds-textfield__input`, `fds-focus`, prefix && `fds-textfield__input--with-prefix`, suffix && `fds-textfield__input--with-suffix`), ref: ref, type: type, disabled: inputProps.disabled, "aria-describedby": describedBy, size: htmlSize, ...objectUtils.omit(['size', 'error', 'errorId'], rest), ...inputProps, onChange: (e) => {
|
|
30
30
|
inputProps?.onChange?.(e);
|
|
31
31
|
setInputValue(e.target.value);
|
|
32
32
|
} }), suffix && (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, variant: 'short', children: jsxRuntime.jsx("div", { className: lite.clsx(`fds-textfield__adornment`, `fds-textfield__suffix`), "aria-hidden": 'true', children: suffix }) }))] }), hasCharacterLimit && (jsxRuntime.jsx(CharacterCounter.CharacterCounter, { size: size, value: inputValue ? inputValue.toString() : '', id: characterLimitId, ...characterLimit })), jsxRuntime.jsx("div", { className: 'fds-textfield__error-message', id: errorId, "aria-live": 'polite', "aria-relevant": 'additions removals', children: hasError && jsxRuntime.jsx(ErrorMessage.ErrorMessage, { size: size, children: props.error }) })] }) }));
|
|
@@ -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 `Textfield` in context with `Fieldset` */
|
|
10
9
|
const useTextfield = (props) => {
|
|
11
10
|
const fieldset = React.useContext(FieldsetContext.FieldsetContext);
|
|
12
|
-
const { inputProps, readOnly, ...rest } = useFormField.useFormField(props, 'textfield');
|
|
13
|
-
const size = getSize.getSize(fieldset?.size ?? props.size ?? 'md');
|
|
11
|
+
const { inputProps, readOnly, size = fieldset?.size ?? 'md', ...rest } = useFormField.useFormField(props, 'textfield');
|
|
14
12
|
return {
|
|
15
13
|
...rest,
|
|
16
14
|
readOnly,
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var lite = require('../../node_modules/clsx/dist/lite.js');
|
|
6
|
-
var getSize = require('../../utilities/getSize.js');
|
|
7
6
|
var FieldsetContext = require('./Fieldset/FieldsetContext.js');
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -15,10 +14,10 @@ const useFormField = (props, prefix) => {
|
|
|
15
14
|
const id = props.id ?? `${prefix}-${randomId}`;
|
|
16
15
|
const errorId = props.errorId ?? `${prefix}-error-${randomId}`;
|
|
17
16
|
const descriptionId = `${prefix}-description-${randomId}`;
|
|
17
|
+
const size = props.size ?? fieldset?.size ?? 'md';
|
|
18
18
|
const disabled = fieldset?.disabled || props?.disabled;
|
|
19
19
|
const readOnly = ((fieldset?.readOnly || props?.readOnly) && !disabled) || undefined;
|
|
20
20
|
const hasError = !disabled && !readOnly && !!(props.error || fieldset?.error);
|
|
21
|
-
const size = getSize.getSize(props.size || fieldset?.size || 'md');
|
|
22
21
|
return {
|
|
23
22
|
readOnly,
|
|
24
23
|
hasError,
|
|
@@ -29,7 +28,9 @@ const useFormField = (props, prefix) => {
|
|
|
29
28
|
id,
|
|
30
29
|
disabled,
|
|
31
30
|
'aria-invalid': hasError ? true : undefined,
|
|
32
|
-
'aria-describedby': lite.clsx(props['aria-describedby'],
|
|
31
|
+
'aria-describedby': lite.clsx(props['aria-describedby'], !!props?.description &&
|
|
32
|
+
typeof props?.description === 'string' &&
|
|
33
|
+
descriptionId, hasError && !fieldset?.error && errorId, hasError && !!fieldset?.error && fieldset?.errorId) || undefined,
|
|
33
34
|
},
|
|
34
35
|
};
|
|
35
36
|
};
|
|
@@ -8,7 +8,7 @@ var floatingUi_reactDom = require('../../react-dom/dist/floating-ui.react-dom.js
|
|
|
8
8
|
var floatingUi_utils_dom = require('../../utils/dist/floating-ui.utils.dom.js');
|
|
9
9
|
var index_esm = require('../../../tabbable/dist/index.esm.js');
|
|
10
10
|
var ReactDOM = require('react-dom');
|
|
11
|
-
var floatingUi_dom = require('../../dom/dist/floating-ui.dom.js');
|
|
11
|
+
var floatingUi_dom = require('../../react-dom/node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
|
|
12
12
|
|
|
13
13
|
function _interopNamespaceDefault(e) {
|
|
14
14
|
var n = Object.create(null);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var floatingUi_core = require('
|
|
5
|
-
var floatingUi_utils = require('
|
|
6
|
-
var floatingUi_utils_dom = require('
|
|
4
|
+
var floatingUi_core = require('../../../../../core/dist/floating-ui.core.js');
|
|
5
|
+
var floatingUi_utils = require('../../../../../utils/dist/floating-ui.utils.js');
|
|
6
|
+
var floatingUi_utils_dom = require('../../../../../utils/dist/floating-ui.utils.dom.js');
|
|
7
7
|
|
|
8
8
|
function getCssDimensions(element) {
|
|
9
9
|
const css = floatingUi_utils_dom.getComputedStyle(element);
|
|
@@ -2,10 +2,8 @@
|
|
|
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 { getColor } from '../../utilities/getColor.js';
|
|
6
5
|
|
|
7
|
-
const Accordion = forwardRef(({ border = false, className, ...rest }, ref) => {
|
|
8
|
-
const color = getColor(rest.color || 'neutral');
|
|
6
|
+
const Accordion = forwardRef(({ border = false, color = 'neutral', className, ...rest }, ref) => {
|
|
9
7
|
return (jsx("div", { className: clsx('fds-accordion', border && 'fds-accordion--border', color && `fds-accordion--${color}`, className), ref: ref, ...rest }));
|
|
10
8
|
});
|
|
11
9
|
Accordion.displayName = 'Accordion';
|
|
@@ -3,7 +3,6 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { InformationSquareFillIcon, ExclamationmarkTriangleFillIcon, CheckmarkCircleFillIcon, XMarkOctagonFillIcon } from '@navikt/aksel-icons';
|
|
5
5
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
6
|
-
import { getSize } from '../../utilities/getSize.js';
|
|
7
6
|
import { Paragraph } from '../Typography/Paragraph/Paragraph.js';
|
|
8
7
|
|
|
9
8
|
const icons = {
|
|
@@ -18,8 +17,7 @@ const icons = {
|
|
|
18
17
|
title: 'Feil',
|
|
19
18
|
},
|
|
20
19
|
};
|
|
21
|
-
const Alert = forwardRef(({ severity = 'info', elevated, iconTitle, children, className, ...rest }, ref) => {
|
|
22
|
-
const size = getSize(rest.size || 'md');
|
|
20
|
+
const Alert = forwardRef(({ severity = 'info', elevated, iconTitle, children, size = 'md', className, ...rest }, ref) => {
|
|
23
21
|
const { Icon, title } = icons[severity];
|
|
24
22
|
return (jsx("div", { ref: ref, className: clsx('fds-alert', `fds-alert--${size}`, `fds-alert--${severity}`, elevated && `fds-alert--elevated`, className), ...rest, children: jsxs(Fragment, { children: [jsx(Icon, { title: iconTitle || title, className: 'fds-alert__icon' }), jsx(Paragraph, { asChild: true, size: size, className: 'fds-alert__content', children: jsx("span", { children: children }) })] }) }));
|
|
25
23
|
});
|
|
@@ -3,13 +3,10 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
|
-
import { getSize } from '../../utilities/getSize.js';
|
|
7
6
|
|
|
8
7
|
const Box = forwardRef(({ shadow, borderColor, borderRadius, background = 'default', children, asChild = false, className, ...rest }, ref) => {
|
|
9
8
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'div';
|
|
10
|
-
|
|
11
|
-
const borderRadiusSize = borderRadius && getSize(borderRadius);
|
|
12
|
-
return (jsx(Component, { ref: ref, className: 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 }));
|
|
9
|
+
return (jsx(Component, { ref: ref, className: 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 }));
|
|
13
10
|
});
|
|
14
11
|
Box.displayName = 'Box';
|
|
15
12
|
|
|
@@ -3,15 +3,11 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
|
-
import { getSize } from '../../utilities/getSize.js';
|
|
7
|
-
import { getColor } from '../../utilities/getColor.js';
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* Button used for interaction
|
|
11
9
|
*/
|
|
12
|
-
const Button = forwardRef(({ children, variant = 'primary', fullWidth = false, icon = false, type = 'button',
|
|
13
|
-
const size = getSize(rest.size || 'md');
|
|
14
|
-
const color = getColor(rest.color || 'accent', 'action');
|
|
10
|
+
const Button = forwardRef(({ children, variant = 'primary', color = 'accent', fullWidth = false, icon = false, type = 'button', size = 'md', asChild, className, ...rest }, ref) => {
|
|
15
11
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'button';
|
|
16
12
|
return (jsx(Component, { ref: ref, type: type, className: 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 }));
|
|
17
13
|
});
|
|
@@ -3,11 +3,9 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
|
-
import { getColor } from '../../utilities/getColor.js';
|
|
7
6
|
|
|
8
|
-
const Card = forwardRef(({ isLink = false, asChild = false, className, ...rest }, ref) => {
|
|
7
|
+
const Card = forwardRef(({ isLink = false, asChild = false, color = 'neutral', className, ...rest }, ref) => {
|
|
9
8
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'div';
|
|
10
|
-
const color = getColor(rest.color || 'neutral');
|
|
11
9
|
return (jsx(Component, { ref: ref, className: clsx(`fds-card`, `fds-card--${color}`, isLink && `fds-card--link`, isLink && `fds-focus`, className), ...rest }));
|
|
12
10
|
});
|
|
13
11
|
Card.displayName = 'Card';
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { createContext, forwardRef, Children, isValidElement } from 'react';
|
|
4
4
|
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
5
|
-
import { getSize } from '../../../utilities/getSize.js';
|
|
6
5
|
|
|
7
6
|
const ChipGroupContext = createContext(null);
|
|
8
|
-
const Group = forwardRef(({ children, className, ...rest }, ref) => {
|
|
9
|
-
const size = getSize(rest.size || 'md');
|
|
7
|
+
const Group = forwardRef(({ size = 'md', children, className, ...rest }, ref) => {
|
|
10
8
|
return (jsx("ul", { ref: ref, className: clsx(`fds-chip--group-container`, `fds-chip--${size}`, className), ...rest, children: jsx(ChipGroupContext.Provider, { value: { size }, children: Children.toArray(children).map((child, index) => isValidElement(child) ? (jsx("li", { children: child }, `chip-${index}`)) : null) }) }));
|
|
11
9
|
});
|
|
12
10
|
Group.displayName = 'ChipGroup';
|
|
@@ -4,12 +4,10 @@ import { forwardRef, useContext } from 'react';
|
|
|
4
4
|
import { XMarkIcon } from '@navikt/aksel-icons';
|
|
5
5
|
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
6
6
|
import { ChipGroupContext } from '../Group/Group.js';
|
|
7
|
-
import { getSize } from '../../../utilities/getSize.js';
|
|
8
7
|
import { Paragraph } from '../../Typography/Paragraph/Paragraph.js';
|
|
9
8
|
|
|
10
|
-
const RemovableChip = forwardRef(({ children, className, ...rest }, ref) => {
|
|
9
|
+
const RemovableChip = forwardRef(({ size = 'md', children, className, ...rest }, ref) => {
|
|
11
10
|
const group = useContext(ChipGroupContext);
|
|
12
|
-
const size = getSize(rest.size || 'md');
|
|
13
11
|
return (jsx("button", { type: 'button', ref: ref, className: clsx(`fds-focus`, `fds-chip--button`, `fds-chip--removable`, `fds-chip--${group?.size || size}`, className), ...rest, children: jsx(Paragraph, { asChild: true, size: group?.size || size, variant: 'short', children: jsxs("span", { className: `fds-chip__label`, children: [jsx("span", { children: children }), jsx("span", { className: `fds-chip__x-mark`, "aria-hidden": true, children: jsx(XMarkIcon, { className: `fds-chip__icon` }) })] }) }) }));
|
|
14
12
|
});
|
|
15
13
|
RemovableChip.displayName = 'ChipRemovable';
|
|
@@ -4,13 +4,11 @@ import { forwardRef, useContext } from 'react';
|
|
|
4
4
|
import { CheckmarkIcon } from '@navikt/aksel-icons';
|
|
5
5
|
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
6
6
|
import { ChipGroupContext } from '../Group/Group.js';
|
|
7
|
-
import { getSize } from '../../../utilities/getSize.js';
|
|
8
7
|
import { Paragraph } from '../../Typography/Paragraph/Paragraph.js';
|
|
9
8
|
|
|
10
|
-
const ToggleChip = forwardRef(({ children, selected = false, checkmark = true, className, ...rest }, ref) => {
|
|
9
|
+
const ToggleChip = forwardRef(({ children, selected = false, checkmark = true, size = 'md', className, ...rest }, ref) => {
|
|
11
10
|
const shouldDisplayCheckmark = checkmark && selected;
|
|
12
11
|
const group = useContext(ChipGroupContext);
|
|
13
|
-
const size = getSize(rest.size || 'md');
|
|
14
12
|
return (jsx("button", { ref: ref, type: 'button', "aria-pressed": selected, className: clsx(`fds-focus`, `fds-chip--button`, `fds-chip--${group?.size || size}`, shouldDisplayCheckmark && `fds-chip--spacing`, className), ...rest, children: jsx(Paragraph, { asChild: true, size: group?.size || size, variant: 'short', children: jsxs("span", { className: `fds-chip__label`, children: [shouldDisplayCheckmark && (jsx(CheckmarkIcon, { className: `fds-chip__checkmark-icon`, "aria-hidden": true })), jsx("span", { children: children })] }) }) }));
|
|
15
13
|
});
|
|
16
14
|
ToggleChip.displayName = 'ChipToggle';
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useRef, useState, useEffect, createContext } from 'react';
|
|
4
|
-
import { getSize } from '../../utilities/getSize.js';
|
|
5
4
|
|
|
6
|
-
const DropdownMenu = ({ open, onClose, placement = 'bottom-end', portal, children,
|
|
7
|
-
const size = getSize(rest.size || 'md');
|
|
5
|
+
const DropdownMenu = ({ open, onClose, placement = 'bottom-end', portal, size = 'md', children, }) => {
|
|
8
6
|
const triggerRef = useRef(null);
|
|
9
7
|
const [internalOpen, setInternalOpen] = useState(open ?? false);
|
|
10
8
|
const anchorEl = triggerRef.current;
|
|
@@ -5,7 +5,7 @@ import { forwardRef, useContext, useRef } from 'react';
|
|
|
5
5
|
import { useFloating, useInteractions, useFocus, useClick, useDismiss, useRole, useMergeRefs, FloatingFocusManager, FloatingPortal } from '../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
6
6
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
7
7
|
import { DropdownMenuContext } from './DropdownMenu.js';
|
|
8
|
-
import { autoUpdate, shift } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js';
|
|
8
|
+
import { autoUpdate, shift } from '../../node_modules/@floating-ui/react-dom/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
10
|
import { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect.js';
|
|
11
11
|
|
|
@@ -3,11 +3,9 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
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';
|
|
7
6
|
import { HelpTextIcon } from './HelpTextIcon.js';
|
|
8
7
|
|
|
9
|
-
const HelpText = ({ title, placement = 'right', portal, className, children, ...rest }) => {
|
|
10
|
-
const size = getSize(rest.size || 'md');
|
|
8
|
+
const HelpText = ({ title, placement = 'right', portal, size = 'md', className, children, ...rest }) => {
|
|
11
9
|
const [open, setOpen] = useState(false);
|
|
12
10
|
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 })] }) }));
|
|
13
11
|
};
|
|
@@ -4,9 +4,9 @@ import { forwardRef } from 'react';
|
|
|
4
4
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
6
|
|
|
7
|
-
const Link = forwardRef(({ asChild, children, className,
|
|
7
|
+
const Link = forwardRef(({ asChild, children, className, ...rest }, ref) => {
|
|
8
8
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'a';
|
|
9
|
-
return (jsx(Component, { className: clsx('fds-link', className), ref: ref,
|
|
9
|
+
return (jsx(Component, { className: clsx('fds-link', className), ref: ref, ...rest, children: children }));
|
|
10
10
|
});
|
|
11
11
|
Link.displayName = 'Link';
|
|
12
12
|
|
|
@@ -2,17 +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, useState } from 'react';
|
|
5
|
-
import { getSize } from '../../utilities/getSize.js';
|
|
6
5
|
|
|
7
6
|
const ListContext = createContext({
|
|
8
7
|
size: 'md',
|
|
9
8
|
headingId: 'heading',
|
|
10
9
|
setHeadingId: () => { },
|
|
11
10
|
});
|
|
12
|
-
const ListRoot = forwardRef(({ asChild, ...rest }, ref) => {
|
|
11
|
+
const ListRoot = forwardRef(({ size = 'md', asChild, ...rest }, ref) => {
|
|
13
12
|
const [headingId, setHeadingId] = useState();
|
|
14
13
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'div';
|
|
15
|
-
const size = getSize(rest.size || 'md');
|
|
16
14
|
return (jsx(ListContext.Provider, { value: { size, headingId, setHeadingId }, children: jsx(Component, { ref: ref, ...rest }) }));
|
|
17
15
|
});
|
|
18
16
|
ListRoot.displayName = 'ListRoot';
|
|
@@ -3,7 +3,6 @@ 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';
|
|
7
6
|
import { PaginationRoot } from './PaginationRoot.js';
|
|
8
7
|
import { PaginationContent } from './PaginationContent.js';
|
|
9
8
|
import { PaginationItem } from './PaginationItem.js';
|
|
@@ -17,13 +16,12 @@ const iconSize = {
|
|
|
17
16
|
md: '1.5rem',
|
|
18
17
|
lg: '2rem',
|
|
19
18
|
};
|
|
20
|
-
const Pagination = forwardRef(({ nextLabel = '', previousLabel = '', compact = false, hideLabels = false, currentPage = 1, totalPages, onChange, itemLabel = (num) => `Side ${num}`, ...rest }, ref) => {
|
|
19
|
+
const Pagination = forwardRef(({ nextLabel = '', previousLabel = '', compact = false, hideLabels = false, currentPage = 1, totalPages, size = 'md', onChange, itemLabel = (num) => `Side ${num}`, ...rest }, ref) => {
|
|
21
20
|
const { pages, showNextPage, showPreviousPage } = usePagination({
|
|
22
21
|
compact,
|
|
23
22
|
currentPage,
|
|
24
23
|
totalPages,
|
|
25
24
|
});
|
|
26
|
-
const size = getSize(rest.size || 'md');
|
|
27
25
|
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: () => {
|
|
28
26
|
onChange(currentPage - 1);
|
|
29
27
|
}, "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: () => {
|
|
@@ -2,15 +2,13 @@
|
|
|
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';
|
|
6
5
|
|
|
7
6
|
const PaginationContext = createContext({
|
|
8
7
|
size: 'md',
|
|
9
8
|
compact: false,
|
|
10
9
|
});
|
|
11
|
-
const PaginationRoot = forwardRef(({ asChild, compact = false, ...rest }, ref) => {
|
|
10
|
+
const PaginationRoot = forwardRef(({ asChild, compact = false, size = 'md', ...rest }, ref) => {
|
|
12
11
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'nav';
|
|
13
|
-
const size = getSize(rest.size || 'md');
|
|
14
12
|
return (jsx(PaginationContext.Provider, { value: { size, compact }, children: jsx(Component, { ref: ref, "aria-label": 'Pagination', ...rest }) }));
|
|
15
13
|
});
|
|
16
14
|
var PaginationRoot$1 = PaginationRoot;
|
|
@@ -2,10 +2,8 @@
|
|
|
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';
|
|
6
5
|
|
|
7
|
-
const Popover = ({ children, placement = 'top', open, variant = 'default', portal, onOpenChange, onClose,
|
|
8
|
-
const size = getSize(rest.size || 'md');
|
|
6
|
+
const Popover = ({ children, placement = 'top', open, variant = 'default', portal, size = 'md', onOpenChange, onClose, }) => {
|
|
9
7
|
const triggerRef = useRef(null);
|
|
10
8
|
const [internalOpen, setInternalOpen] = useState(open ?? false);
|
|
11
9
|
const randomPopoverId = useId();
|
|
@@ -5,7 +5,7 @@ import { forwardRef, useContext, useRef, useEffect, useMemo } from 'react';
|
|
|
5
5
|
import { useFloating, useInteractions, useFocus, useClick, useDismiss, useRole, useMergeRefs, FloatingPortal } from '../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
6
6
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
7
7
|
import { PopoverContext } from './Popover.js';
|
|
8
|
-
import { autoUpdate, flip, shift } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js';
|
|
8
|
+
import { autoUpdate, flip, shift } from '../../node_modules/@floating-ui/react-dom/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
10
|
import { arrow } from '../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js';
|
|
11
11
|
import { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
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';
|
|
5
4
|
import { useSynchronizedAnimation } from '../../hooks/useSynchronizedAnimation.js';
|
|
6
5
|
|
|
7
6
|
const sizeMap = {
|
|
@@ -13,13 +12,10 @@ const sizeMap = {
|
|
|
13
12
|
xl: 79,
|
|
14
13
|
};
|
|
15
14
|
/** Spinner component used for indicating busy or indeterminate loading */
|
|
16
|
-
const Spinner = ({ title,
|
|
17
|
-
const size = getSize(rest.size || 'md');
|
|
15
|
+
const Spinner = ({ title, color = 'neutral', size = 'md', className, style, ...rest }) => {
|
|
18
16
|
const svgRef = useSynchronizedAnimation('fds-spinner-rotate-animation');
|
|
19
17
|
const strokeRef = useSynchronizedAnimation('fds-spinner-stroke-animation');
|
|
20
|
-
return (jsxs("svg", { className: clsx('fds-spinner',
|
|
21
|
-
? `fds-spinner--${variant}`
|
|
22
|
-
: 'fds-spinner--default', className), "data-ds-theme": variant === 'inverted' ? 'dark' : undefined, 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 })] }));
|
|
18
|
+
return (jsxs("svg", { className: clsx('fds-spinner', `fds-spinner--${color}`, 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'), 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 })] }));
|
|
23
19
|
};
|
|
24
20
|
Spinner.displayName = 'Spinner';
|
|
25
21
|
|
|
@@ -2,11 +2,9 @@
|
|
|
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';
|
|
6
5
|
import { Paragraph } from '../Typography/Paragraph/Paragraph.js';
|
|
7
6
|
|
|
8
|
-
const Table = React.forwardRef(({ zebra = false, stickyHeader = false, border = false, className, children, ...rest }, ref) => {
|
|
9
|
-
const size = getSize(rest.size || 'md');
|
|
7
|
+
const Table = React.forwardRef(({ zebra = false, stickyHeader = false, border = false, size = 'md', className, children, ...rest }, ref) => {
|
|
10
8
|
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 }) }));
|
|
11
9
|
});
|
|
12
10
|
Table.displayName = 'Table';
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { createContext, forwardRef, useState } from 'react';
|
|
4
4
|
import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
5
|
-
import { getSize } from '../../utilities/getSize.js';
|
|
6
5
|
|
|
7
6
|
const TabsContext = createContext({});
|
|
8
|
-
const Tabs = forwardRef(({ children, value, defaultValue, className, onChange, ...rest }, ref) => {
|
|
9
|
-
const size = getSize(rest.size || 'md');
|
|
7
|
+
const Tabs = forwardRef(({ size = 'md', children, value, defaultValue, className, onChange, ...rest }, ref) => {
|
|
10
8
|
const isControlled = value !== undefined;
|
|
11
9
|
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
|
|
12
10
|
let onValueChange = onChange;
|
|
@@ -2,13 +2,9 @@
|
|
|
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';
|
|
7
5
|
import { Paragraph } from '../Typography/Paragraph/Paragraph.js';
|
|
8
6
|
|
|
9
|
-
const Tag = forwardRef(({ children, className, ...rest }, ref) => {
|
|
10
|
-
const size = getSize(rest.size || 'md');
|
|
11
|
-
const color = getColor(rest.color || 'neutral');
|
|
7
|
+
const Tag = forwardRef(({ size = 'md', color = 'neutral', children, className, ...rest }, ref) => {
|
|
12
8
|
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 }) }));
|
|
13
9
|
});
|
|
14
10
|
Tag.displayName = 'Tag';
|
|
@@ -2,7 +2,6 @@
|
|
|
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';
|
|
6
5
|
import { RovingTabindexRoot } from '../../utilities/RovingTabIndex/RovingTabindexRoot.js';
|
|
7
6
|
|
|
8
7
|
const ToggleGroupContext = createContext({});
|
|
@@ -16,8 +15,7 @@ const ToggleGroupContext = createContext({});
|
|
|
16
15
|
* </ToggleGroup>
|
|
17
16
|
* ```
|
|
18
17
|
*/
|
|
19
|
-
const ToggleGroup = forwardRef(({ children, value, defaultValue, onChange, name, className, ...rest }, ref) => {
|
|
20
|
-
const size = getSize(rest.size || 'md');
|
|
18
|
+
const ToggleGroup = forwardRef(({ size = 'md', children, value, defaultValue, onChange, name, className, ...rest }, ref) => {
|
|
21
19
|
const nameId = useId();
|
|
22
20
|
const isControlled = value !== undefined;
|
|
23
21
|
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
|
|
@@ -4,13 +4,13 @@ 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
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';
|
|
7
|
+
import { autoUpdate, flip, shift } from '../../node_modules/@floating-ui/react-dom/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
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 =
|
|
13
|
+
const Tooltip = forwardRef(({ children, content, placement = 'top', delay = 150, open: userOpen, defaultOpen = false, portal = false, 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,7 +57,7 @@ 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(Container, { children: jsxs("div", { ref: refs.setFloating, style: { ...floatingStyles, ...animationStyles, ...style }, role: 'tooltip',
|
|
60
|
+
})), internalOpen && (jsx(Container, { children: jsxs("div", { ref: refs.setFloating, style: { ...floatingStyles, ...animationStyles, ...style }, role: 'tooltip', ...getFloatingProps({
|
|
61
61
|
className: clsx('fds-tooltip', className),
|
|
62
62
|
ref: mergedRef,
|
|
63
63
|
...rest,
|
|
@@ -3,12 +3,10 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
|
-
import { getSize } from '../../../utilities/getSize.js';
|
|
7
6
|
|
|
8
7
|
/** Use `ErrorMessage` to display text as error message. */
|
|
9
|
-
const ErrorMessage = forwardRef(({ className, spacing, asChild, error = true, ...rest }, ref) => {
|
|
8
|
+
const ErrorMessage = forwardRef(({ size = 'md', className, spacing, asChild, error = true, ...rest }, ref) => {
|
|
10
9
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'div';
|
|
11
|
-
const size = getSize(rest.size || 'md');
|
|
12
10
|
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 }));
|
|
13
11
|
});
|
|
14
12
|
ErrorMessage.displayName = 'ErrorMessage';
|
|
@@ -3,12 +3,10 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
|
-
import { getSize } from '../../../utilities/getSize.js';
|
|
7
6
|
|
|
8
7
|
/** Use `Heading` to render h1-6 elements with heading text styles. */
|
|
9
|
-
const Heading = forwardRef(({ level = 1, spacing = false, className, asChild, ...rest }, ref) => {
|
|
8
|
+
const Heading = forwardRef(({ size = 'xl', level = 1, spacing = false, className, asChild, ...rest }, ref) => {
|
|
10
9
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : `h${level ?? 1}`;
|
|
11
|
-
const size = getSize(rest.size || 'xl');
|
|
12
10
|
return (jsx(Component, { ref: ref, className: clsx('fds-heading', `fds-heading--${size}`, spacing && 'fds-heading--spacing', className), ...rest }));
|
|
13
11
|
});
|
|
14
12
|
Heading.displayName = 'Heading';
|
|
@@ -3,12 +3,10 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
|
-
import { getSize } from '../../../utilities/getSize.js';
|
|
7
6
|
|
|
8
7
|
/** Use `Ingress` to display text as ingress. */
|
|
9
|
-
const Ingress = forwardRef(({ className, spacing, asChild, ...rest }, ref) => {
|
|
8
|
+
const Ingress = forwardRef(({ size = 'md', className, spacing, asChild, ...rest }, ref) => {
|
|
10
9
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'p';
|
|
11
|
-
const size = getSize(rest.size || 'md');
|
|
12
10
|
return (jsx(Component, { ref: ref, className: clsx(`fds-ingress`, `fds-ingress--${size}`, spacing && 'fds-ingress--spacing', className), ...rest }));
|
|
13
11
|
});
|
|
14
12
|
Ingress.displayName = 'Ingress';
|
|
@@ -3,12 +3,10 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
|
-
import { getSize } from '../../../utilities/getSize.js';
|
|
7
6
|
|
|
8
7
|
/** Use `Label` for labels. */
|
|
9
|
-
const Label = forwardRef(({ className, spacing, weight = 'medium', asChild, ...rest }, ref) => {
|
|
8
|
+
const Label = forwardRef(({ className, spacing, size = 'md', weight = 'medium', asChild, ...rest }, ref) => {
|
|
10
9
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'label';
|
|
11
|
-
const size = getSize(rest.size || 'md');
|
|
12
10
|
return (jsx(Component, { ref: ref, className: clsx('fds-label', `fds-label--${size}`, spacing && 'fds-label--spacing', weight && `fds-label--${weight}-weight`, className), ...rest }));
|
|
13
11
|
});
|
|
14
12
|
Label.displayName = 'Label';
|