@digdir/designsystemet-react 1.0.0-rc.10 → 1.0.0-rc.12
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/DropdownMenu/DropdownMenuContent.js +1 -1
- package/dist/cjs/components/Modal/ModalDialog.js +8 -7
- package/dist/cjs/components/Modal/ModalHeader.js +2 -2
- package/dist/cjs/components/Modal/ModalRoot.js +7 -1
- package/dist/cjs/components/Modal/index.js +1 -1
- package/dist/cjs/components/Popover/PopoverContent.js +1 -1
- package/dist/cjs/components/Skeleton/Circle/Circle.js +1 -1
- package/dist/cjs/components/Skeleton/Rectangle/Rectangle.js +1 -1
- package/dist/cjs/components/Skeleton/Text/Text.js +1 -1
- package/dist/cjs/components/Spinner/Spinner.js +1 -1
- package/dist/cjs/components/Table/TableHeaderCell.js +1 -1
- package/dist/cjs/components/Typography/Paragraph/Paragraph.js +6 -4
- package/dist/cjs/components/form/Checkbox/Checkbox.js +1 -1
- package/dist/cjs/components/form/Combobox/Combobox.js +3 -0
- package/dist/cjs/components/form/Combobox/Custom.js +2 -2
- package/dist/cjs/components/form/Fieldset/Fieldset.js +1 -1
- package/dist/cjs/components/form/Radio/Radio.js +1 -1
- package/dist/cjs/hooks/{useIsomorphicLayoutEffect.js → useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js} +1 -0
- package/dist/cjs/hooks/useSynchronizedAnimation/useSynchronizedAnimation.js +46 -0
- package/dist/cjs/index.js +4 -0
- package/dist/esm/components/DropdownMenu/DropdownMenuContent.js +1 -1
- package/dist/esm/components/Modal/ModalDialog.js +8 -7
- package/dist/esm/components/Modal/ModalHeader.js +2 -2
- package/dist/esm/components/Modal/ModalRoot.js +8 -2
- package/dist/esm/components/Modal/index.js +1 -1
- package/dist/esm/components/Popover/PopoverContent.js +1 -1
- package/dist/esm/components/Skeleton/Circle/Circle.js +1 -1
- package/dist/esm/components/Skeleton/Rectangle/Rectangle.js +1 -1
- package/dist/esm/components/Skeleton/Text/Text.js +1 -1
- package/dist/esm/components/Spinner/Spinner.js +1 -1
- package/dist/esm/components/Table/TableHeaderCell.js +1 -1
- package/dist/esm/components/Typography/Paragraph/Paragraph.js +6 -4
- package/dist/esm/components/form/Checkbox/Checkbox.js +1 -1
- package/dist/esm/components/form/Combobox/Combobox.js +3 -0
- package/dist/esm/components/form/Combobox/Custom.js +2 -2
- package/dist/esm/components/form/Fieldset/Fieldset.js +1 -1
- package/dist/esm/components/form/Radio/Radio.js +1 -1
- package/dist/esm/hooks/{useIsomorphicLayoutEffect.js → useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js} +1 -0
- package/dist/esm/hooks/useSynchronizedAnimation/useSynchronizedAnimation.js +44 -0
- package/dist/esm/index.js +2 -0
- package/dist/types/components/Box/Box.d.ts +1 -1
- package/dist/types/components/Divider/Divider.d.ts +1 -1
- package/dist/types/components/Modal/ModalRoot.d.ts +1 -0
- package/dist/types/components/Modal/ModalRoot.d.ts.map +1 -1
- package/dist/types/components/Modal/index.d.ts +1 -1
- package/dist/types/components/Modal/index.d.ts.map +1 -1
- package/dist/types/components/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/types/components/Typography/Paragraph/Paragraph.d.ts +10 -4
- package/dist/types/components/Typography/Paragraph/Paragraph.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Combobox.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/ComboboxContext.d.ts +1 -0
- package/dist/types/components/form/Combobox/ComboboxContext.d.ts.map +1 -1
- package/dist/types/components/form/Fieldset/Fieldset.d.ts.map +1 -1
- package/dist/types/hooks/index.d.ts +2 -2
- package/dist/types/hooks/index.d.ts.map +1 -1
- package/dist/types/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts.map +1 -0
- package/dist/types/hooks/useSynchronizedAnimation/useSynchronizedAnimation.d.ts +14 -0
- package/dist/types/hooks/useSynchronizedAnimation/useSynchronizedAnimation.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/utilities/RovingTabIndex/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/cjs/hooks/useSynchronizedAnimation.js +0 -33
- package/dist/esm/hooks/useSynchronizedAnimation.js +0 -31
- package/dist/types/hooks/useIsomorphicLayoutEffect.d.ts.map +0 -1
- package/dist/types/hooks/useSynchronizedAnimation.d.ts +0 -2
- package/dist/types/hooks/useSynchronizedAnimation.d.ts.map +0 -1
- /package/dist/types/hooks/{useIsomorphicLayoutEffect.d.ts → useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts} +0 -0
|
@@ -8,7 +8,7 @@ var lite = require('../../node_modules/clsx/dist/lite.js');
|
|
|
8
8
|
var DropdownMenuRoot = require('./DropdownMenuRoot.js');
|
|
9
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
|
-
var useIsomorphicLayoutEffect = require('../../hooks/useIsomorphicLayoutEffect.js');
|
|
11
|
+
var useIsomorphicLayoutEffect = require('../../hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js');
|
|
12
12
|
|
|
13
13
|
function _interopNamespaceDefault(e) {
|
|
14
14
|
var n = Object.create(null);
|
|
@@ -15,14 +15,15 @@ const ModalDialog = React.forwardRef(({ onInteractOutside, onClose, onBeforeClos
|
|
|
15
15
|
// This local ref is used to make sure the modal works without a ModalRoot
|
|
16
16
|
const modalDialogRef = React.useRef(null);
|
|
17
17
|
const { context } = floatingUi_react.useFloating();
|
|
18
|
-
const
|
|
18
|
+
const { modalRef, setOpen, setCloseModal } = React.useContext(ModalRoot.ModalContext);
|
|
19
19
|
const open = useModalState.useModalState(modalDialogRef);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
React.useEffect(() => {
|
|
21
|
+
setCloseModal?.(() => {
|
|
22
|
+
if (onBeforeClose && onBeforeClose() === false)
|
|
23
|
+
return;
|
|
24
|
+
modalDialogRef.current?.close();
|
|
25
|
+
});
|
|
26
|
+
}, [onBeforeClose, setCloseModal]);
|
|
26
27
|
const mergedRefs = floatingUi_react.useMergeRefs([modalRef, ref, modalDialogRef]);
|
|
27
28
|
useScrollLock.useScrollLock(modalDialogRef, 'ds-modal--lock-scroll');
|
|
28
29
|
React.useEffect(() => {
|
|
@@ -13,8 +13,8 @@ var Heading = require('../Typography/Heading/Heading.js');
|
|
|
13
13
|
|
|
14
14
|
const ModalHeader = React.forwardRef(({ closeButton = true, children, subtitle, asChild, className, ...rest }, ref) => {
|
|
15
15
|
const Component = asChild ? index.Slot : 'div';
|
|
16
|
-
const
|
|
17
|
-
return (jsxRuntime.jsxs(Component, { ref: ref, className: lite.clsx('ds-modal__header', !closeButton && 'ds-modal__header--no-button', className), ...rest, children: [subtitle && (jsxRuntime.jsx(Paragraph.Paragraph, { size: 'sm', variant: 'short', children: subtitle })), jsxRuntime.jsx(Heading.Heading, { level: 2, size: 'xs', children: children }), closeButton && (jsxRuntime.jsx(Button.Button, { name: 'close', variant: 'tertiary', color: 'neutral', size: 'md', onClick:
|
|
16
|
+
const { closeModal } = React.useContext(ModalRoot.ModalContext);
|
|
17
|
+
return (jsxRuntime.jsxs(Component, { ref: ref, className: lite.clsx('ds-modal__header', !closeButton && 'ds-modal__header--no-button', className), ...rest, children: [subtitle && (jsxRuntime.jsx(Paragraph.Paragraph, { size: 'sm', variant: 'short', children: subtitle })), jsxRuntime.jsx(Heading.Heading, { level: 2, size: 'xs', children: children }), closeButton && (jsxRuntime.jsx(Button.Button, { name: 'close', variant: 'tertiary', color: 'neutral', size: 'md', onClick: () => closeModal?.(), autoFocus: true, icon: true, className: 'ds-modal__header__button', children: jsxRuntime.jsx(akselIcons.XMarkIcon, { title: 'close modal', fontSize: '1.5em' }) }))] }));
|
|
18
18
|
});
|
|
19
19
|
ModalHeader.displayName = 'ModalHeader';
|
|
20
20
|
|
|
@@ -5,6 +5,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
|
|
7
7
|
const ModalContext = React.createContext({
|
|
8
|
+
setCloseModal: () => { },
|
|
8
9
|
modalRef: { current: null },
|
|
9
10
|
open: false,
|
|
10
11
|
setOpen: () => { },
|
|
@@ -12,8 +13,13 @@ const ModalContext = React.createContext({
|
|
|
12
13
|
const ModalRoot = ({ children }) => {
|
|
13
14
|
const modalRef = React.useRef(null);
|
|
14
15
|
const [open, setOpen] = React.useState(false);
|
|
16
|
+
const [closeModal, setCloseModal] = React.useState();
|
|
17
|
+
const setCloseModalInContext = React.useCallback((fn) => {
|
|
18
|
+
setCloseModal(() => fn);
|
|
19
|
+
}, []);
|
|
15
20
|
return (jsxRuntime.jsx(ModalContext.Provider, { value: {
|
|
16
|
-
|
|
21
|
+
setCloseModal: setCloseModalInContext,
|
|
22
|
+
closeModal,
|
|
17
23
|
modalRef,
|
|
18
24
|
open,
|
|
19
25
|
setOpen,
|
|
@@ -8,7 +8,7 @@ var ModalFooter = require('./ModalFooter.js');
|
|
|
8
8
|
var ModalHeader = require('./ModalHeader.js');
|
|
9
9
|
var ModalTrigger = require('./ModalTrigger.js');
|
|
10
10
|
|
|
11
|
-
const Modal =
|
|
11
|
+
const Modal = {};
|
|
12
12
|
Modal.Root = ModalRoot.ModalRoot;
|
|
13
13
|
Modal.Content = ModaContent.ModalContent;
|
|
14
14
|
Modal.Footer = ModalFooter.ModalFooter;
|
|
@@ -9,7 +9,7 @@ var PopoverRoot = require('./PopoverRoot.js');
|
|
|
9
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
|
-
var useIsomorphicLayoutEffect = require('../../hooks/useIsomorphicLayoutEffect.js');
|
|
12
|
+
var useIsomorphicLayoutEffect = require('../../hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js');
|
|
13
13
|
var Paragraph = require('../Typography/Paragraph/Paragraph.js');
|
|
14
14
|
|
|
15
15
|
function _interopNamespaceDefault(e) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var lite = require('../../../node_modules/clsx/dist/lite.js');
|
|
6
|
-
var useSynchronizedAnimation = require('../../../hooks/useSynchronizedAnimation.js');
|
|
6
|
+
var useSynchronizedAnimation = require('../../../hooks/useSynchronizedAnimation/useSynchronizedAnimation.js');
|
|
7
7
|
|
|
8
8
|
/** Skeleton component used for indicating loading elements of circular shape */
|
|
9
9
|
const Circle = ({ width, height, className, children, style, ...rest }) => {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var lite = require('../../../node_modules/clsx/dist/lite.js');
|
|
6
|
-
var useSynchronizedAnimation = require('../../../hooks/useSynchronizedAnimation.js');
|
|
6
|
+
var useSynchronizedAnimation = require('../../../hooks/useSynchronizedAnimation/useSynchronizedAnimation.js');
|
|
7
7
|
|
|
8
8
|
/** Skeleton component used for indicating loading elements of rectangle shape */
|
|
9
9
|
const Rectangle = ({ width, height, className, children, style, ...rest }) => {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var lite = require('../../../node_modules/clsx/dist/lite.js');
|
|
6
|
-
var useSynchronizedAnimation = require('../../../hooks/useSynchronizedAnimation.js');
|
|
6
|
+
var useSynchronizedAnimation = require('../../../hooks/useSynchronizedAnimation/useSynchronizedAnimation.js');
|
|
7
7
|
|
|
8
8
|
/** Skeleton component used for indicating loading elements of text */
|
|
9
9
|
const Text = ({ width, height, className, style, children, ...rest }) => {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var lite = require('../../node_modules/clsx/dist/lite.js');
|
|
6
|
-
var useSynchronizedAnimation = require('../../hooks/useSynchronizedAnimation.js');
|
|
6
|
+
var useSynchronizedAnimation = require('../../hooks/useSynchronizedAnimation/useSynchronizedAnimation.js');
|
|
7
7
|
|
|
8
8
|
const sizeMap = {
|
|
9
9
|
'2xs': 13,
|
|
@@ -31,7 +31,7 @@ const SORT_ICON = {
|
|
|
31
31
|
};
|
|
32
32
|
const TableHeaderCell = React__namespace.forwardRef(({ sortable = false, sort, onSortClick, className, children, ...rest }, ref) => {
|
|
33
33
|
const sortIcon = sort === 'ascending' || sort === 'descending' ? (SORT_ICON[sort]) : (jsxRuntime.jsx(akselIcons.ChevronUpDownIcon, {}));
|
|
34
|
-
return (jsxRuntime.jsxs("th", { className: lite.clsx('ds-table__header__cell', sortable && 'ds-table__header__cell--sortable', sort && `ds-table__header__cell--sorted`, className), "aria-sort": sort, ref: ref, ...rest, children: [sortable && (jsxRuntime.jsxs("button", { className:
|
|
34
|
+
return (jsxRuntime.jsxs("th", { className: lite.clsx('ds-table__header__cell', 'ds-font-weight--medium', sortable && 'ds-table__header__cell--sortable', sort && `ds-table__header__cell--sorted`, className), "aria-sort": sort, ref: ref, ...rest, children: [sortable && (jsxRuntime.jsxs("button", { className: 'ds-focus', onClick: onSortClick, children: [children, sortIcon] })), !sortable && children] }));
|
|
35
35
|
});
|
|
36
36
|
TableHeaderCell.displayName = 'TableHeaderCell';
|
|
37
37
|
|
|
@@ -6,13 +6,15 @@ 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 lineHeightMap = {
|
|
10
|
+
short: 'ds-line-height--sm',
|
|
11
|
+
default: 'ds-line-height--md',
|
|
12
|
+
long: 'ds-line-height--lg',
|
|
13
|
+
};
|
|
9
14
|
/** Use `Paragraph` to display text with paragraph text styles. */
|
|
10
15
|
const Paragraph = React.forwardRef(({ className, spacing, size = 'md', asChild, variant, ...rest }, ref) => {
|
|
11
16
|
const Component = asChild ? index.Slot : 'p';
|
|
12
|
-
return (jsxRuntime.jsx(Component, { ref: ref, className: lite.clsx('ds-paragraph', spacing && 'ds-paragraph--spacing', variant
|
|
13
|
-
? `ds-paragraph-${variant}--${size}`
|
|
14
|
-
: `ds-paragraph--${size}`, // TODO find a better solution for this
|
|
15
|
-
className), ...rest }));
|
|
17
|
+
return (jsxRuntime.jsx(Component, { ref: ref, className: lite.clsx('ds-paragraph', spacing && 'ds-paragraph--spacing', `ds-paragraph--${size}`, lineHeightMap[variant ?? 'default'], className), ...rest }));
|
|
16
18
|
});
|
|
17
19
|
Paragraph.displayName = 'Paragraph';
|
|
18
20
|
|
|
@@ -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('ds-checkbox', `ds-checkbox--${size}`, hasError && `ds-checkbox--error`, readOnly && `ds-checkbox--readonly`, className), style: style, children: [jsxRuntime.jsx("input", { className: `ds-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: `ds-checkbox__label
|
|
24
|
+
return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { className: lite.clsx('ds-checkbox', `ds-checkbox--${size}`, hasError && `ds-checkbox--error`, readOnly && `ds-checkbox--readonly`, className), style: style, children: [jsxRuntime.jsx("input", { className: `ds-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: lite.clsx(`ds-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: `ds-checkbox__description`, children: description }) }))] }))] }) }));
|
|
25
25
|
});
|
|
26
26
|
Checkbox.displayName = 'Checkbox';
|
|
27
27
|
|
|
@@ -169,6 +169,9 @@ const ComboboxComponent = React.forwardRef(({ value, initialValue = [], onValueC
|
|
|
169
169
|
chipSrLabel,
|
|
170
170
|
listRef,
|
|
171
171
|
forwareddRef,
|
|
172
|
+
setListRef: (index, node) => {
|
|
173
|
+
listRef.current[index] = node;
|
|
174
|
+
},
|
|
172
175
|
}, children: [jsxRuntime.jsxs(Box.Box, { className: lite.clsx('ds-combobox', `ds-combobox--${size}`, disabled && 'ds-combobox__disabled', className), style: style, ref: portalRef, children: [name && (jsxRuntime.jsx(ComboboxNative.default, { name: name, selectedOptions: selectedOptions, multiple: multiple })), jsxRuntime.jsx(ComboboxLabel.default, { label: label, description: description, size: size, readOnly: readOnly, hideLabel: hideLabel, formFieldProps: formFieldProps }), jsxRuntime.jsx(ComboboxInput.default, { ...objectUtils.omit(['inputValue'], rest), hideClearButton: hideClearButton, listId: listId, error: error, hideChips: hideChips, handleKeyDown: handleKeyDown, "aria-busy": loading }), jsxRuntime.jsx(ComboboxError.default, { size: size, error: error, formFieldProps: formFieldProps })] }), open && (jsxRuntime.jsx(floatingUi_react.FloatingPortal, { root: portal ? null : portalRef, children: jsxRuntime.jsx(floatingUi_react.FloatingFocusManager, { context: context, initialFocus: -1, visuallyHiddenDismiss: true, children: jsxRuntime.jsxs(Box.Box, { id: listId, shadow: 'md', borderRadius: 'md', borderColor: 'default', "aria-labelledby": formFieldProps.inputProps.id, "aria-autocomplete": 'list', tabIndex: -1, ...getFloatingProps({
|
|
173
176
|
ref: refs.setFloating,
|
|
174
177
|
style: {
|
|
@@ -24,11 +24,11 @@ const ComboboxCustom = React.forwardRef(({ asChild, interactive, id, className,
|
|
|
24
24
|
if (!context) {
|
|
25
25
|
throw new Error('ComboboxCustom must be used within a Combobox');
|
|
26
26
|
}
|
|
27
|
-
const { customIds,
|
|
27
|
+
const { customIds, setListRef, getItemProps, size } = context;
|
|
28
28
|
const index$1 = React.useMemo(() => (id && customIds.indexOf(id)) || 0, [id, customIds]);
|
|
29
29
|
const combinedRef = floatingUi_react.useMergeRefs([
|
|
30
30
|
(node) => {
|
|
31
|
-
|
|
31
|
+
setListRef(index$1, node);
|
|
32
32
|
},
|
|
33
33
|
ref,
|
|
34
34
|
]);
|
|
@@ -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('ds-fieldset', !hideLegend && 'ds-fieldset--spacing', readOnly && 'ds-fieldset--readonly', className), disabled: props?.disabled, ref: ref, ...rest, children: [jsxRuntime.jsx(Label.Label, { asChild: true, size: size, children: jsxRuntime.jsx("legend", { className: 'ds-fieldset__legend', children: jsxRuntime.jsxs("span", { className: lite.clsx('ds-fieldset__legend__content', hideLegend && `ds-sr-only`), children: [readOnly && (jsxRuntime.jsx(akselIcons.PadlockLockedFillIcon, { className: 'ds-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('ds-fieldset__description', hideLegend && `ds-sr-only`), children: description }) })), children, jsxRuntime.jsx("div", { id: errorId, "aria-live": 'polite', "aria-relevant": 'additions removals', className: 'ds-fieldset__error-message', children: hasError && jsxRuntime.jsx(ErrorMessage.ErrorMessage, { size: size, children: error }) })] }) }));
|
|
24
|
+
}, children: jsxRuntime.jsxs("fieldset", { ...fieldsetProps, className: lite.clsx('ds-fieldset', !hideLegend && 'ds-fieldset--spacing', readOnly && 'ds-fieldset--readonly', className), disabled: props?.disabled, ref: ref, ...rest, children: [jsxRuntime.jsx(Label.Label, { asChild: true, size: size, children: jsxRuntime.jsx("legend", { className: 'ds-fieldset__legend', children: jsxRuntime.jsxs("span", { className: lite.clsx('ds-fieldset__legend__content', hideLegend && `ds-sr-only`), children: [readOnly && (jsxRuntime.jsx(akselIcons.PadlockLockedFillIcon, { className: 'ds-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('ds-fieldset__description', 'ds-font-weight--regular', hideLegend && `ds-sr-only`), children: description }) })), children, jsxRuntime.jsx("div", { id: errorId, "aria-live": 'polite', "aria-relevant": 'additions removals', className: 'ds-fieldset__error-message', children: hasError && jsxRuntime.jsx(ErrorMessage.ErrorMessage, { size: size, children: error }) })] }) }));
|
|
25
25
|
});
|
|
26
26
|
Fieldset.displayName = 'Fieldset';
|
|
27
27
|
|
|
@@ -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('ds-radio', `ds-radio--${size}`, hasError && `ds-radio--error`, readOnly && `ds-radio--readonly`, className), style: style, children: [jsxRuntime.jsx("input", { className: 'ds-radio__input', disabled: inputProps.disabled, ref: ref, ...objectUtils.omit(['size', 'error'], rest), ...inputProps }), children && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Label.Label, { className: 'ds-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: 'ds-radio__description', children: description }) }))] }))] }) }));
|
|
15
|
+
return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { className: lite.clsx('ds-radio', `ds-radio--${size}`, hasError && `ds-radio--error`, readOnly && `ds-radio--readonly`, className), style: style, children: [jsxRuntime.jsx("input", { className: 'ds-radio__input', disabled: inputProps.disabled, ref: ref, ...objectUtils.omit(['size', 'error'], rest), ...inputProps }), children && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Label.Label, { className: lite.clsx('ds-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: 'ds-radio__description', children: description }) }))] }))] }) }));
|
|
16
16
|
});
|
|
17
17
|
Radio.displayName = 'Radio';
|
|
18
18
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var React = require('react');
|
|
5
5
|
|
|
6
|
+
// https://usehooks-ts.com/react-hook/use-isomorphic-layout-effect
|
|
6
7
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
7
8
|
|
|
8
9
|
exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var useIsomorphicLayoutEffect = require('../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js');
|
|
6
|
+
|
|
7
|
+
// Inspired by Sam Selikoff
|
|
8
|
+
// https://github.com/samselikoff/2022-02-24-use-synchronized-animation/blob/main/src/App.js
|
|
9
|
+
/**
|
|
10
|
+
* Synchronizes the css animation of multiple elements with the same `animationName`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const ref = useSynchronizedAnimation<HTMLDivElement>('spin');
|
|
15
|
+
*
|
|
16
|
+
* <div
|
|
17
|
+
* ref={ref}
|
|
18
|
+
* />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
function useSynchronizedAnimation(animationName) {
|
|
22
|
+
const ref = React.useRef(null);
|
|
23
|
+
useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(() => {
|
|
24
|
+
const animations = document
|
|
25
|
+
.getAnimations()
|
|
26
|
+
.filter((animation) => 'animationName' in animation &&
|
|
27
|
+
animation.animationName === animationName);
|
|
28
|
+
const firstOfType = animations.find((animation) => 'animationName' in animation &&
|
|
29
|
+
animation.animationName === animationName);
|
|
30
|
+
const myAnimation = animations.find((animation) => animation.effect?.target === ref.current);
|
|
31
|
+
if (myAnimation && myAnimation === firstOfType) {
|
|
32
|
+
myAnimation.currentTime = 0;
|
|
33
|
+
}
|
|
34
|
+
if (myAnimation && firstOfType && myAnimation !== firstOfType) {
|
|
35
|
+
myAnimation.currentTime = firstOfType.currentTime;
|
|
36
|
+
}
|
|
37
|
+
return () => {
|
|
38
|
+
if (myAnimation && firstOfType) {
|
|
39
|
+
myAnimation.currentTime = firstOfType.currentTime;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}, [animationName]);
|
|
43
|
+
return ref;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
exports.useSynchronizedAnimation = useSynchronizedAnimation;
|
package/dist/cjs/index.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var ErrorSummaryList = require('./components/ErrorSummary/ErrorSummaryList.js');
|
|
5
|
+
var useSynchronizedAnimation = require('./hooks/useSynchronizedAnimation/useSynchronizedAnimation.js');
|
|
6
|
+
var useIsomorphicLayoutEffect = require('./hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js');
|
|
5
7
|
var Button = require('./components/Button/Button.js');
|
|
6
8
|
var HelpText = require('./components/HelpText/HelpText.js');
|
|
7
9
|
var Spinner = require('./components/Spinner/Spinner.js');
|
|
@@ -99,6 +101,8 @@ var ErrorSummaryHeading = require('./components/ErrorSummary/ErrorSummaryHeading
|
|
|
99
101
|
|
|
100
102
|
|
|
101
103
|
exports.ErrorSummaryList = ErrorSummaryList;
|
|
104
|
+
exports.useSynchronizedAnimation = useSynchronizedAnimation.useSynchronizedAnimation;
|
|
105
|
+
exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect.useIsomorphicLayoutEffect;
|
|
102
106
|
exports.Button = Button.Button;
|
|
103
107
|
exports.HelpText = HelpText.HelpText;
|
|
104
108
|
exports.Spinner = Spinner.Spinner;
|
|
@@ -7,7 +7,7 @@ import { clsx } from '../../node_modules/clsx/dist/lite.js';
|
|
|
7
7
|
import { DropdownMenuContext } from './DropdownMenuRoot.js';
|
|
8
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
|
-
import { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect.js';
|
|
10
|
+
import { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js';
|
|
11
11
|
|
|
12
12
|
const GAP = 4;
|
|
13
13
|
const DropdownMenuContent = forwardRef(({ className, children, ...rest }, ref) => {
|
|
@@ -13,14 +13,15 @@ const ModalDialog = forwardRef(({ onInteractOutside, onClose, onBeforeClose, asC
|
|
|
13
13
|
// This local ref is used to make sure the modal works without a ModalRoot
|
|
14
14
|
const modalDialogRef = useRef(null);
|
|
15
15
|
const { context } = useFloating();
|
|
16
|
-
const
|
|
16
|
+
const { modalRef, setOpen, setCloseModal } = useContext(ModalContext);
|
|
17
17
|
const open = useModalState(modalDialogRef);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
setCloseModal?.(() => {
|
|
20
|
+
if (onBeforeClose && onBeforeClose() === false)
|
|
21
|
+
return;
|
|
22
|
+
modalDialogRef.current?.close();
|
|
23
|
+
});
|
|
24
|
+
}, [onBeforeClose, setCloseModal]);
|
|
24
25
|
const mergedRefs = useMergeRefs([modalRef, ref, modalDialogRef]);
|
|
25
26
|
useScrollLock(modalDialogRef, 'ds-modal--lock-scroll');
|
|
26
27
|
useEffect(() => {
|
|
@@ -11,8 +11,8 @@ import { Heading } from '../Typography/Heading/Heading.js';
|
|
|
11
11
|
|
|
12
12
|
const ModalHeader = forwardRef(({ closeButton = true, children, subtitle, asChild, className, ...rest }, ref) => {
|
|
13
13
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'div';
|
|
14
|
-
const
|
|
15
|
-
return (jsxs(Component, { ref: ref, className: clsx('ds-modal__header', !closeButton && 'ds-modal__header--no-button', className), ...rest, children: [subtitle && (jsx(Paragraph, { size: 'sm', variant: 'short', children: subtitle })), jsx(Heading, { level: 2, size: 'xs', children: children }), closeButton && (jsx(Button, { name: 'close', variant: 'tertiary', color: 'neutral', size: 'md', onClick:
|
|
14
|
+
const { closeModal } = useContext(ModalContext);
|
|
15
|
+
return (jsxs(Component, { ref: ref, className: clsx('ds-modal__header', !closeButton && 'ds-modal__header--no-button', className), ...rest, children: [subtitle && (jsx(Paragraph, { size: 'sm', variant: 'short', children: subtitle })), jsx(Heading, { level: 2, size: 'xs', children: children }), closeButton && (jsx(Button, { name: 'close', variant: 'tertiary', color: 'neutral', size: 'md', onClick: () => closeModal?.(), autoFocus: true, icon: true, className: 'ds-modal__header__button', children: jsx(XMarkIcon, { title: 'close modal', fontSize: '1.5em' }) }))] }));
|
|
16
16
|
});
|
|
17
17
|
ModalHeader.displayName = 'ModalHeader';
|
|
18
18
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { createContext, useRef, useState } from 'react';
|
|
3
|
+
import { createContext, useRef, useState, useCallback } from 'react';
|
|
4
4
|
|
|
5
5
|
const ModalContext = createContext({
|
|
6
|
+
setCloseModal: () => { },
|
|
6
7
|
modalRef: { current: null },
|
|
7
8
|
open: false,
|
|
8
9
|
setOpen: () => { },
|
|
@@ -10,8 +11,13 @@ const ModalContext = createContext({
|
|
|
10
11
|
const ModalRoot = ({ children }) => {
|
|
11
12
|
const modalRef = useRef(null);
|
|
12
13
|
const [open, setOpen] = useState(false);
|
|
14
|
+
const [closeModal, setCloseModal] = useState();
|
|
15
|
+
const setCloseModalInContext = useCallback((fn) => {
|
|
16
|
+
setCloseModal(() => fn);
|
|
17
|
+
}, []);
|
|
13
18
|
return (jsx(ModalContext.Provider, { value: {
|
|
14
|
-
|
|
19
|
+
setCloseModal: setCloseModalInContext,
|
|
20
|
+
closeModal,
|
|
15
21
|
modalRef,
|
|
16
22
|
open,
|
|
17
23
|
setOpen,
|
|
@@ -6,7 +6,7 @@ import { ModalFooter } from './ModalFooter.js';
|
|
|
6
6
|
import { ModalHeader } from './ModalHeader.js';
|
|
7
7
|
import { ModalTrigger } from './ModalTrigger.js';
|
|
8
8
|
|
|
9
|
-
const Modal =
|
|
9
|
+
const Modal = {};
|
|
10
10
|
Modal.Root = ModalRoot;
|
|
11
11
|
Modal.Content = ModalContent;
|
|
12
12
|
Modal.Footer = ModalFooter;
|
|
@@ -8,7 +8,7 @@ import { PopoverContext } from './PopoverRoot.js';
|
|
|
8
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
|
-
import { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect.js';
|
|
11
|
+
import { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js';
|
|
12
12
|
import { Paragraph } from '../Typography/Paragraph/Paragraph.js';
|
|
13
13
|
|
|
14
14
|
const ARROW_HEIGHT = 7;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
4
|
-
import { useSynchronizedAnimation } from '../../../hooks/useSynchronizedAnimation.js';
|
|
4
|
+
import { useSynchronizedAnimation } from '../../../hooks/useSynchronizedAnimation/useSynchronizedAnimation.js';
|
|
5
5
|
|
|
6
6
|
/** Skeleton component used for indicating loading elements of circular shape */
|
|
7
7
|
const Circle = ({ width, height, className, children, style, ...rest }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
4
|
-
import { useSynchronizedAnimation } from '../../../hooks/useSynchronizedAnimation.js';
|
|
4
|
+
import { useSynchronizedAnimation } from '../../../hooks/useSynchronizedAnimation/useSynchronizedAnimation.js';
|
|
5
5
|
|
|
6
6
|
/** Skeleton component used for indicating loading elements of rectangle shape */
|
|
7
7
|
const Rectangle = ({ width, height, className, children, style, ...rest }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { clsx } from '../../../node_modules/clsx/dist/lite.js';
|
|
4
|
-
import { useSynchronizedAnimation } from '../../../hooks/useSynchronizedAnimation.js';
|
|
4
|
+
import { useSynchronizedAnimation } from '../../../hooks/useSynchronizedAnimation/useSynchronizedAnimation.js';
|
|
5
5
|
|
|
6
6
|
/** Skeleton component used for indicating loading elements of text */
|
|
7
7
|
const Text = ({ width, height, className, style, children, ...rest }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
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 { useSynchronizedAnimation } from '../../hooks/useSynchronizedAnimation.js';
|
|
4
|
+
import { useSynchronizedAnimation } from '../../hooks/useSynchronizedAnimation/useSynchronizedAnimation.js';
|
|
5
5
|
|
|
6
6
|
const sizeMap = {
|
|
7
7
|
'2xs': 13,
|
|
@@ -10,7 +10,7 @@ const SORT_ICON = {
|
|
|
10
10
|
};
|
|
11
11
|
const TableHeaderCell = React.forwardRef(({ sortable = false, sort, onSortClick, className, children, ...rest }, ref) => {
|
|
12
12
|
const sortIcon = sort === 'ascending' || sort === 'descending' ? (SORT_ICON[sort]) : (jsx(ChevronUpDownIcon, {}));
|
|
13
|
-
return (jsxs("th", { className: clsx('ds-table__header__cell', sortable && 'ds-table__header__cell--sortable', sort && `ds-table__header__cell--sorted`, className), "aria-sort": sort, ref: ref, ...rest, children: [sortable && (jsxs("button", { className:
|
|
13
|
+
return (jsxs("th", { className: clsx('ds-table__header__cell', 'ds-font-weight--medium', sortable && 'ds-table__header__cell--sortable', sort && `ds-table__header__cell--sorted`, className), "aria-sort": sort, ref: ref, ...rest, children: [sortable && (jsxs("button", { className: 'ds-focus', onClick: onSortClick, children: [children, sortIcon] })), !sortable && children] }));
|
|
14
14
|
});
|
|
15
15
|
TableHeaderCell.displayName = 'TableHeaderCell';
|
|
16
16
|
|
|
@@ -4,13 +4,15 @@ 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 lineHeightMap = {
|
|
8
|
+
short: 'ds-line-height--sm',
|
|
9
|
+
default: 'ds-line-height--md',
|
|
10
|
+
long: 'ds-line-height--lg',
|
|
11
|
+
};
|
|
7
12
|
/** Use `Paragraph` to display text with paragraph text styles. */
|
|
8
13
|
const Paragraph = forwardRef(({ className, spacing, size = 'md', asChild, variant, ...rest }, ref) => {
|
|
9
14
|
const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'p';
|
|
10
|
-
return (jsx(Component, { ref: ref, className: clsx('ds-paragraph', spacing && 'ds-paragraph--spacing', variant
|
|
11
|
-
? `ds-paragraph-${variant}--${size}`
|
|
12
|
-
: `ds-paragraph--${size}`, // TODO find a better solution for this
|
|
13
|
-
className), ...rest }));
|
|
15
|
+
return (jsx(Component, { ref: ref, className: clsx('ds-paragraph', spacing && 'ds-paragraph--spacing', `ds-paragraph--${size}`, lineHeightMap[variant ?? 'default'], className), ...rest }));
|
|
14
16
|
});
|
|
15
17
|
Paragraph.displayName = 'Paragraph';
|
|
16
18
|
|
|
@@ -19,7 +19,7 @@ const Checkbox = forwardRef((props, ref) => {
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
]);
|
|
22
|
-
return (jsx(Paragraph, { asChild: true, size: size, children: jsxs("div", { className: clsx('ds-checkbox', `ds-checkbox--${size}`, hasError && `ds-checkbox--error`, readOnly && `ds-checkbox--readonly`, className), style: style, children: [jsx("input", { className: `ds-checkbox__input`, ref: inputRef, ...omit(['size', 'error', 'indeterminate'], rest), ...inputProps, type: 'checkbox', disabled: inputProps.disabled, "aria-checked": rest.indeterminate ? 'mixed' : inputProps.checked }), children && (jsxs(Fragment, { children: [jsx(Label, { className: `ds-checkbox__label
|
|
22
|
+
return (jsx(Paragraph, { asChild: true, size: size, children: jsxs("div", { className: clsx('ds-checkbox', `ds-checkbox--${size}`, hasError && `ds-checkbox--error`, readOnly && `ds-checkbox--readonly`, className), style: style, children: [jsx("input", { className: `ds-checkbox__input`, ref: inputRef, ...omit(['size', 'error', 'indeterminate'], rest), ...inputProps, type: 'checkbox', disabled: inputProps.disabled, "aria-checked": rest.indeterminate ? 'mixed' : inputProps.checked }), children && (jsxs(Fragment, { children: [jsx(Label, { className: clsx(`ds-checkbox__label`), htmlFor: inputProps.id, size: size, weight: 'regular', children: jsx("span", { children: children }) }), description && (jsx(Paragraph, { asChild: true, size: size, children: jsx("div", { id: descriptionId, className: `ds-checkbox__description`, children: description }) }))] }))] }) }));
|
|
23
23
|
});
|
|
24
24
|
Checkbox.displayName = 'Checkbox';
|
|
25
25
|
|
|
@@ -167,6 +167,9 @@ const ComboboxComponent = forwardRef(({ value, initialValue = [], onValueChange,
|
|
|
167
167
|
chipSrLabel,
|
|
168
168
|
listRef,
|
|
169
169
|
forwareddRef,
|
|
170
|
+
setListRef: (index, node) => {
|
|
171
|
+
listRef.current[index] = node;
|
|
172
|
+
},
|
|
170
173
|
}, children: [jsxs(Box, { className: clsx('ds-combobox', `ds-combobox--${size}`, disabled && 'ds-combobox__disabled', className), style: style, ref: portalRef, children: [name && (jsx(ComboboxNative, { name: name, selectedOptions: selectedOptions, multiple: multiple })), jsx(ComboboxLabel, { label: label, description: description, size: size, readOnly: readOnly, hideLabel: hideLabel, formFieldProps: formFieldProps }), jsx(ComboboxInput, { ...omit(['inputValue'], rest), hideClearButton: hideClearButton, listId: listId, error: error, hideChips: hideChips, handleKeyDown: handleKeyDown, "aria-busy": loading }), jsx(ComboboxError, { size: size, error: error, formFieldProps: formFieldProps })] }), open && (jsx(FloatingPortal, { root: portal ? null : portalRef, children: jsx(FloatingFocusManager, { context: context, initialFocus: -1, visuallyHiddenDismiss: true, children: jsxs(Box, { id: listId, shadow: 'md', borderRadius: 'md', borderColor: 'default', "aria-labelledby": formFieldProps.inputProps.id, "aria-autocomplete": 'list', tabIndex: -1, ...getFloatingProps({
|
|
171
174
|
ref: refs.setFloating,
|
|
172
175
|
style: {
|
|
@@ -20,11 +20,11 @@ const ComboboxCustom = forwardRef(({ asChild, interactive, id, className, ...res
|
|
|
20
20
|
if (!context) {
|
|
21
21
|
throw new Error('ComboboxCustom must be used within a Combobox');
|
|
22
22
|
}
|
|
23
|
-
const { customIds,
|
|
23
|
+
const { customIds, setListRef, getItemProps, size } = context;
|
|
24
24
|
const index = useMemo(() => (id && customIds.indexOf(id)) || 0, [id, customIds]);
|
|
25
25
|
const combinedRef = useMergeRefs([
|
|
26
26
|
(node) => {
|
|
27
|
-
|
|
27
|
+
setListRef(index, node);
|
|
28
28
|
},
|
|
29
29
|
ref,
|
|
30
30
|
]);
|
|
@@ -19,7 +19,7 @@ const Fieldset = forwardRef((props, ref) => {
|
|
|
19
19
|
size,
|
|
20
20
|
disabled: props?.disabled,
|
|
21
21
|
readOnly,
|
|
22
|
-
}, children: jsxs("fieldset", { ...fieldsetProps, className: clsx('ds-fieldset', !hideLegend && 'ds-fieldset--spacing', readOnly && 'ds-fieldset--readonly', className), disabled: props?.disabled, ref: ref, ...rest, children: [jsx(Label, { asChild: true, size: size, children: jsx("legend", { className: 'ds-fieldset__legend', children: jsxs("span", { className: clsx('ds-fieldset__legend__content', hideLegend && `ds-sr-only`), children: [readOnly && (jsx(PadlockLockedFillIcon, { className: 'ds-fieldset__readonly__icon', "aria-hidden": true })), legend] }) }) }), description && (jsx(Paragraph, { size: size, variant: 'short', asChild: true, children: jsx("div", { id: descriptionId, className: clsx('ds-fieldset__description', hideLegend && `ds-sr-only`), children: description }) })), children, jsx("div", { id: errorId, "aria-live": 'polite', "aria-relevant": 'additions removals', className: 'ds-fieldset__error-message', children: hasError && jsx(ErrorMessage, { size: size, children: error }) })] }) }));
|
|
22
|
+
}, children: jsxs("fieldset", { ...fieldsetProps, className: clsx('ds-fieldset', !hideLegend && 'ds-fieldset--spacing', readOnly && 'ds-fieldset--readonly', className), disabled: props?.disabled, ref: ref, ...rest, children: [jsx(Label, { asChild: true, size: size, children: jsx("legend", { className: 'ds-fieldset__legend', children: jsxs("span", { className: clsx('ds-fieldset__legend__content', hideLegend && `ds-sr-only`), children: [readOnly && (jsx(PadlockLockedFillIcon, { className: 'ds-fieldset__readonly__icon', "aria-hidden": true })), legend] }) }) }), description && (jsx(Paragraph, { size: size, variant: 'short', asChild: true, children: jsx("div", { id: descriptionId, className: clsx('ds-fieldset__description', 'ds-font-weight--regular', hideLegend && `ds-sr-only`), children: description }) })), children, jsx("div", { id: errorId, "aria-live": 'polite', "aria-relevant": 'additions removals', className: 'ds-fieldset__error-message', children: hasError && jsx(ErrorMessage, { size: size, children: error }) })] }) }));
|
|
23
23
|
});
|
|
24
24
|
Fieldset.displayName = 'Fieldset';
|
|
25
25
|
|
|
@@ -10,7 +10,7 @@ import { Label } from '../../Typography/Label/Label.js';
|
|
|
10
10
|
const Radio = forwardRef((props, ref) => {
|
|
11
11
|
const { children, description, className, style, ...rest } = props;
|
|
12
12
|
const { inputProps, descriptionId, hasError, size = 'md', readOnly, } = useRadio(props);
|
|
13
|
-
return (jsx(Paragraph, { asChild: true, size: size, children: jsxs("div", { className: clsx('ds-radio', `ds-radio--${size}`, hasError && `ds-radio--error`, readOnly && `ds-radio--readonly`, className), style: style, children: [jsx("input", { className: 'ds-radio__input', disabled: inputProps.disabled, ref: ref, ...omit(['size', 'error'], rest), ...inputProps }), children && (jsxs(Fragment, { children: [jsx(Label, { className: 'ds-radio__label', htmlFor: inputProps.id, size: size, weight: 'regular', children: jsx("span", { children: children }) }), description && (jsx(Paragraph, { asChild: true, size: size, children: jsx("div", { id: descriptionId, className: 'ds-radio__description', children: description }) }))] }))] }) }));
|
|
13
|
+
return (jsx(Paragraph, { asChild: true, size: size, children: jsxs("div", { className: clsx('ds-radio', `ds-radio--${size}`, hasError && `ds-radio--error`, readOnly && `ds-radio--readonly`, className), style: style, children: [jsx("input", { className: 'ds-radio__input', disabled: inputProps.disabled, ref: ref, ...omit(['size', 'error'], rest), ...inputProps }), children && (jsxs(Fragment, { children: [jsx(Label, { className: clsx('ds-radio__label'), htmlFor: inputProps.id, size: size, weight: 'regular', children: jsx("span", { children: children }) }), description && (jsx(Paragraph, { asChild: true, size: size, children: jsx("div", { id: descriptionId, className: 'ds-radio__description', children: description }) }))] }))] }) }));
|
|
14
14
|
});
|
|
15
15
|
Radio.displayName = 'Radio';
|
|
16
16
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useLayoutEffect, useEffect } from 'react';
|
|
3
3
|
|
|
4
|
+
// https://usehooks-ts.com/react-hook/use-isomorphic-layout-effect
|
|
4
5
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
5
6
|
|
|
6
7
|
export { useIsomorphicLayoutEffect };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js';
|
|
4
|
+
|
|
5
|
+
// Inspired by Sam Selikoff
|
|
6
|
+
// https://github.com/samselikoff/2022-02-24-use-synchronized-animation/blob/main/src/App.js
|
|
7
|
+
/**
|
|
8
|
+
* Synchronizes the css animation of multiple elements with the same `animationName`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const ref = useSynchronizedAnimation<HTMLDivElement>('spin');
|
|
13
|
+
*
|
|
14
|
+
* <div
|
|
15
|
+
* ref={ref}
|
|
16
|
+
* />
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
function useSynchronizedAnimation(animationName) {
|
|
20
|
+
const ref = useRef(null);
|
|
21
|
+
useIsomorphicLayoutEffect(() => {
|
|
22
|
+
const animations = document
|
|
23
|
+
.getAnimations()
|
|
24
|
+
.filter((animation) => 'animationName' in animation &&
|
|
25
|
+
animation.animationName === animationName);
|
|
26
|
+
const firstOfType = animations.find((animation) => 'animationName' in animation &&
|
|
27
|
+
animation.animationName === animationName);
|
|
28
|
+
const myAnimation = animations.find((animation) => animation.effect?.target === ref.current);
|
|
29
|
+
if (myAnimation && myAnimation === firstOfType) {
|
|
30
|
+
myAnimation.currentTime = 0;
|
|
31
|
+
}
|
|
32
|
+
if (myAnimation && firstOfType && myAnimation !== firstOfType) {
|
|
33
|
+
myAnimation.currentTime = firstOfType.currentTime;
|
|
34
|
+
}
|
|
35
|
+
return () => {
|
|
36
|
+
if (myAnimation && firstOfType) {
|
|
37
|
+
myAnimation.currentTime = firstOfType.currentTime;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}, [animationName]);
|
|
41
|
+
return ref;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { useSynchronizedAnimation };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
export { default as ErrorSummaryList } from './components/ErrorSummary/ErrorSummaryList.js';
|
|
3
|
+
export { useSynchronizedAnimation } from './hooks/useSynchronizedAnimation/useSynchronizedAnimation.js';
|
|
4
|
+
export { useIsomorphicLayoutEffect } from './hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js';
|
|
3
5
|
export { Button } from './components/Button/Button.js';
|
|
4
6
|
export { HelpText } from './components/HelpText/HelpText.js';
|
|
5
7
|
export { Spinner } from './components/Spinner/Spinner.js';
|
|
@@ -36,7 +36,7 @@ export declare const Box: import("react").ForwardRefExoticComponent<{
|
|
|
36
36
|
* Border color of the box
|
|
37
37
|
* @default undefined
|
|
38
38
|
*/
|
|
39
|
-
borderColor?: "
|
|
39
|
+
borderColor?: "default" | "strong" | "subtle" | undefined;
|
|
40
40
|
/**
|
|
41
41
|
* Border radius of the box
|
|
42
42
|
* @default undefined
|
|
@@ -11,6 +11,6 @@ export declare const Divider: React.ForwardRefExoticComponent<{
|
|
|
11
11
|
* The color of the divider.
|
|
12
12
|
* @default 'default'
|
|
13
13
|
*/
|
|
14
|
-
color?: "
|
|
14
|
+
color?: "default" | "strong" | "subtle" | undefined;
|
|
15
15
|
} & React.HTMLAttributes<HTMLHRElement> & React.RefAttributes<HTMLHRElement>>;
|
|
16
16
|
//# sourceMappingURL=Divider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalRoot.d.ts","sourceRoot":"","sources":["../../../../src/components/Modal/ModalRoot.tsx"],"names":[],"mappings":"AAEA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;IAC7C,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"ModalRoot.d.ts","sourceRoot":"","sources":["../../../../src/components/Modal/ModalRoot.tsx"],"names":[],"mappings":"AAEA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IACxC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;IAC7C,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,YAAY,4CAKvB,CAAC;AAEH,eAAO,MAAM,SAAS;mBAAkB,cAAc;;CAsBrD,CAAC"}
|
|
@@ -10,7 +10,7 @@ export type { ModalContentProps } from './ModaContent';
|
|
|
10
10
|
export type { ModalFooterProps } from './ModalFooter';
|
|
11
11
|
export type { ModalDialogProps } from './ModalDialog';
|
|
12
12
|
export type { ModalTriggerProps } from './ModalTrigger';
|
|
13
|
-
type ModalComponent =
|
|
13
|
+
type ModalComponent = {
|
|
14
14
|
Root: typeof ModalRoot;
|
|
15
15
|
Content: typeof ModalContent;
|
|
16
16
|
Footer: typeof ModalFooter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Modal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,YAAY,EAAE,gBAAgB,EAAE,M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","sourceRoot":"","sources":["../../../../src/components/Table/TableHeaderCell.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;IACnC;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;CAChE,GAAG,KAAK,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;AAEjD,eAAO,MAAM,eAAe;IAjB1B;;;OAGG;;IAEH;;;OAGG;WACI,cAAc,CAAC,WAAW,CAAC;IAClC;;;OAGG;uBACe,gBAAgB,CAAC,iBAAiB,CAAC,KAAK,IAAI;
|
|
1
|
+
{"version":3,"file":"TableHeaderCell.d.ts","sourceRoot":"","sources":["../../../../src/components/Table/TableHeaderCell.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;IACnC;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;CAChE,GAAG,KAAK,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;AAEjD,eAAO,MAAM,eAAe;IAjB1B;;;OAGG;;IAEH;;;OAGG;WACI,cAAc,CAAC,WAAW,CAAC;IAClC;;;OAGG;uBACe,gBAAgB,CAAC,iBAAiB,CAAC,KAAK,IAAI;6FA4C/D,CAAC"}
|
|
@@ -9,8 +9,11 @@ export type ParagraphProps = {
|
|
|
9
9
|
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
10
10
|
/** Adds margin-bottom */
|
|
11
11
|
spacing?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Adjusts styling for paragraph length
|
|
14
|
+
* @default `default`
|
|
15
|
+
*/
|
|
16
|
+
variant?: 'long' | 'default' | 'short';
|
|
14
17
|
/**
|
|
15
18
|
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
16
19
|
* @default false
|
|
@@ -28,8 +31,11 @@ export declare const Paragraph: import("react").ForwardRefExoticComponent<{
|
|
|
28
31
|
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
29
32
|
/** Adds margin-bottom */
|
|
30
33
|
spacing?: boolean | undefined;
|
|
31
|
-
/**
|
|
32
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Adjusts styling for paragraph length
|
|
36
|
+
* @default `default`
|
|
37
|
+
*/
|
|
38
|
+
variant?: "long" | "default" | "short" | undefined;
|
|
33
39
|
/**
|
|
34
40
|
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
35
41
|
* @default false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paragraph.d.ts","sourceRoot":"","sources":["../../../../../src/components/Typography/Paragraph/Paragraph.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAK5C,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC,yBAAyB;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB
|
|
1
|
+
{"version":3,"file":"Paragraph.d.ts","sourceRoot":"","sources":["../../../../../src/components/Typography/Paragraph/Paragraph.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAK5C,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC,yBAAyB;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IACvC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,cAAc,CAAC,oBAAoB,CAAC,CAAC;AAQzC,kEAAkE;AAClE,eAAO,MAAM,SAAS;IA5BpB;;;;;OAKG;;IAEH,yBAAyB;;IAEzB;;;OAGG;;IAEH;;;OAGG;;+FA8BJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/Combobox/Combobox.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAMpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAY5C,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAA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AMG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CAC1C,GAAG,WAAW,GACb,cAAc,GACd,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,CAAC;AAE5D,eAAO,MAAM,iBAAiB;IA5F5B;;OAEG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;6BACqB,MAAM,EAAE,KAAK,IAAI;IACzC;;;OAGG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;;OAIG;;IAEH;;OAEG;;IAEH;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;;;;;OAOG;2BACmB,MAAM,UAAU,MAAM,KAAK,OAAO;IACxD;;;;;;OAMG;4BACoB,MAAM,KAAK,MAAM;;;;;;;;;oKAyWzC,CAAC;AAEF,eAAO,MAAM,QAAQ;IAlcnB;;OAEG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;6BACqB,MAAM,EAAE,KAAK,IAAI;IACzC;;;OAGG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;;OAIG;;IAEH;;OAEG;;IAEH;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;;;;;OAOG;2BACmB,MAAM,UAAU,MAAM,KAAK,OAAO;IACxD;;;;;;OAMG;4BACoB,MAAM,KAAK,MAAM;;;;;;;;;oKAoXzC,CAAC"}
|
|
@@ -36,6 +36,7 @@ export type ComboboxContextType = {
|
|
|
36
36
|
}) => void;
|
|
37
37
|
listRef: UseListNavigationProps['listRef'];
|
|
38
38
|
forwareddRef: React.Ref<HTMLInputElement>;
|
|
39
|
+
setListRef: (index: number, ref: HTMLElement | null) => void;
|
|
39
40
|
};
|
|
40
41
|
export declare const ComboboxContext: import("react").Context<ComboboxContextType | undefined>;
|
|
41
42
|
//# sourceMappingURL=ComboboxContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxContext.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/Combobox/ComboboxContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAE7C,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;IACjD,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;IACjD,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;IACjD,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACpC,gBAAgB,EAAE,WAAW,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACjE,eAAe,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACnE,OAAO,EAAE;QACP,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;IACF,eAAe,EAAE;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;IACF,IAAI,EAAE,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IACzC,cAAc,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IAChD,IAAI,EAAE,iBAAiB,CAAC,MAAM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AAE,OAAO,CAAC;IACnB,qFAAqF;IACrF,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,GAC9B,sBAAsB,CAAC,mBAAmB,CAAC,CAAC;AAE9C,eAAO,MAAM,QAAQ;IAhBnB,wEAAwE;kBAC1D,SAAS;IACvB,8DAA8D;;IAE9D,+EAA+E;YACvE,SAAS;IACjB,kCAAkC;YAC1B,SAAS;IACjB;yEACqE;;IAErE,qFAAqF;;
|
|
1
|
+
{"version":3,"file":"Fieldset.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/Fieldset/Fieldset.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAM/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKtD,MAAM,MAAM,aAAa,GAAG;IAC1B,wEAAwE;IACxE,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+EAA+E;IAC/E,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,kCAAkC;IAClC,MAAM,EAAE,SAAS,CAAC;IAClB;yEACqE;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qFAAqF;IACrF,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,GAC9B,sBAAsB,CAAC,mBAAmB,CAAC,CAAC;AAE9C,eAAO,MAAM,QAAQ;IAhBnB,wEAAwE;kBAC1D,SAAS;IACvB,8DAA8D;;IAE9D,+EAA+E;YACvE,SAAS;IACjB,kCAAkC;YAC1B,SAAS;IACjB;yEACqE;;IAErE,qFAAqF;;oIAgGtF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { useMediaQuery } from './useMediaQuery';
|
|
2
2
|
export { usePrevious } from './usePrevious';
|
|
3
|
-
export { useSynchronizedAnimation } from './useSynchronizedAnimation';
|
|
4
|
-
export { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
|
|
3
|
+
export { useSynchronizedAnimation } from './useSynchronizedAnimation/useSynchronizedAnimation';
|
|
4
|
+
export { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect/useIsomorphicLayoutEffect';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,qDAAqD,CAAC;AAC/F,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsomorphicLayoutEffect.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAmB,MAAM,OAAO,CAAC;AAEnD,eAAO,MAAM,yBAAyB,kBACuB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synchronizes the css animation of multiple elements with the same `animationName`.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```tsx
|
|
6
|
+
* const ref = useSynchronizedAnimation<HTMLDivElement>('spin');
|
|
7
|
+
*
|
|
8
|
+
* <div
|
|
9
|
+
* ref={ref}
|
|
10
|
+
* />
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare function useSynchronizedAnimation<T>(animationName: string): import("react").RefObject<T>;
|
|
14
|
+
//# sourceMappingURL=useSynchronizedAnimation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSynchronizedAnimation.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useSynchronizedAnimation/useSynchronizedAnimation.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,gCAuChE"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utilities/RovingTabIndex/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utilities/RovingTabIndex/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digdir/designsystemet-react",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.12",
|
|
4
4
|
"description": "React components for Designsystemet",
|
|
5
5
|
"author": "Designsystemet team",
|
|
6
6
|
"repository": "https://github.com/digdir/designsystemet",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"rollup": "^4.12.1",
|
|
40
40
|
"typescript": "^5.4.2"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "da315701edbee97727abade0a6ff67619edcf3a7"
|
|
43
43
|
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var React = require('react');
|
|
5
|
-
var useIsomorphicLayoutEffect = require('./useIsomorphicLayoutEffect.js');
|
|
6
|
-
|
|
7
|
-
const stashedTime = {};
|
|
8
|
-
function useSynchronizedAnimation(animationName) {
|
|
9
|
-
const ref = React.useRef(null);
|
|
10
|
-
useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(() => {
|
|
11
|
-
const animations = document
|
|
12
|
-
.getAnimations()
|
|
13
|
-
.filter((animation) => 'animationName' in animation &&
|
|
14
|
-
animation.animationName === animationName);
|
|
15
|
-
const myAnimation = animations.find((animation) => animation.effect?.target === ref.current);
|
|
16
|
-
if (myAnimation &&
|
|
17
|
-
myAnimation === animations[0] &&
|
|
18
|
-
stashedTime[animationName]) {
|
|
19
|
-
myAnimation.currentTime = stashedTime[animationName];
|
|
20
|
-
}
|
|
21
|
-
if (myAnimation && myAnimation !== animations[0]) {
|
|
22
|
-
myAnimation.currentTime = animations[0].currentTime;
|
|
23
|
-
}
|
|
24
|
-
return () => {
|
|
25
|
-
if (myAnimation && myAnimation === animations[0]) {
|
|
26
|
-
stashedTime[animationName] = myAnimation.currentTime;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
}, [animationName]);
|
|
30
|
-
return ref;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
exports.useSynchronizedAnimation = useSynchronizedAnimation;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useRef } from 'react';
|
|
3
|
-
import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect.js';
|
|
4
|
-
|
|
5
|
-
const stashedTime = {};
|
|
6
|
-
function useSynchronizedAnimation(animationName) {
|
|
7
|
-
const ref = useRef(null);
|
|
8
|
-
useIsomorphicLayoutEffect(() => {
|
|
9
|
-
const animations = document
|
|
10
|
-
.getAnimations()
|
|
11
|
-
.filter((animation) => 'animationName' in animation &&
|
|
12
|
-
animation.animationName === animationName);
|
|
13
|
-
const myAnimation = animations.find((animation) => animation.effect?.target === ref.current);
|
|
14
|
-
if (myAnimation &&
|
|
15
|
-
myAnimation === animations[0] &&
|
|
16
|
-
stashedTime[animationName]) {
|
|
17
|
-
myAnimation.currentTime = stashedTime[animationName];
|
|
18
|
-
}
|
|
19
|
-
if (myAnimation && myAnimation !== animations[0]) {
|
|
20
|
-
myAnimation.currentTime = animations[0].currentTime;
|
|
21
|
-
}
|
|
22
|
-
return () => {
|
|
23
|
-
if (myAnimation && myAnimation === animations[0]) {
|
|
24
|
-
stashedTime[animationName] = myAnimation.currentTime;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
}, [animationName]);
|
|
28
|
-
return ref;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { useSynchronizedAnimation };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useIsomorphicLayoutEffect.d.ts","sourceRoot":"","sources":["../../../src/hooks/useIsomorphicLayoutEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,MAAM,OAAO,CAAC;AAEnD,eAAO,MAAM,yBAAyB,kBACuB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSynchronizedAnimation.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSynchronizedAnimation.ts"],"names":[],"mappings":"AAMA,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,gCAqChE"}
|