@digdir/designsystemet-react 0.59.0 → 0.59.1-alpha.1
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 -4
- package/dist/cjs/components/Accordion/AccordionContent/AccordionContent.js +1 -2
- package/dist/cjs/components/Accordion/AccordionHeader/AccordionHeader.js +1 -2
- package/dist/cjs/components/Accordion/AccordionItem/AccordionItem.js +1 -4
- package/dist/cjs/components/Button/Button.js +2 -2
- package/dist/cjs/components/DropdownMenu/DropdownMenuContent.js +4 -4
- package/dist/cjs/components/DropdownMenu/DropdownMenuTrigger.js +1 -1
- package/dist/cjs/components/Modal/ModalDialog.js +1 -1
- package/dist/cjs/components/Modal/ModalHeader/ModalHeader.js +1 -1
- package/dist/cjs/components/Modal/ModalHeader/ModalHeader.module.css.js +1 -1
- package/dist/cjs/components/Popover/PopoverContent.js +6 -6
- package/dist/cjs/components/Popover/PopoverTrigger.js +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.js +6 -6
- package/dist/cjs/components/form/Checkbox/Checkbox.js +1 -1
- package/dist/cjs/components/form/Combobox/Combobox.js +72 -199
- package/dist/cjs/components/form/Combobox/Combobox.module.css.js +1 -1
- package/dist/cjs/components/form/Combobox/ComboboxContext.js +8 -0
- package/dist/cjs/components/form/Combobox/ComboboxIdContext.js +42 -0
- package/dist/cjs/components/form/Combobox/Custom/Custom.js +14 -9
- package/dist/cjs/components/form/Combobox/Empty/Empty.js +4 -4
- package/dist/cjs/components/form/Combobox/Option/Option.js +15 -33
- package/dist/cjs/components/form/Combobox/Option/useComboboxOption.js +47 -0
- package/dist/cjs/components/form/Combobox/internal/ComboboxChips.js +13 -10
- package/dist/cjs/components/form/Combobox/internal/ComboboxClearButton.js +5 -8
- package/dist/cjs/components/form/Combobox/internal/ComboboxInput.js +40 -69
- package/dist/cjs/components/form/Combobox/internal/ComboboxNative.js +2 -2
- package/dist/cjs/components/form/Combobox/useCombobox.js +77 -75
- package/dist/cjs/components/form/Combobox/useComboboxKeyboard.js +76 -0
- package/dist/cjs/components/form/Combobox/useFloatingCombobox.js +78 -0
- package/dist/cjs/components/form/Search/Search.js +1 -1
- package/dist/cjs/node_modules/@floating-ui/utils/{dom/dist → dist}/floating-ui.utils.dom.js +7 -4
- package/dist/cjs/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +5 -0
- package/dist/cjs/node_modules/clsx/dist/clsx.js +1 -1
- package/dist/cjs/node_modules/clsx/dist/lite.js +9 -0
- package/dist/cjs/{node_modules → packages/react/node_modules}/@floating-ui/core/dist/floating-ui.core.js +40 -16
- package/dist/cjs/{node_modules → packages/react/node_modules}/@floating-ui/dom/dist/floating-ui.dom.js +83 -31
- package/dist/cjs/{node_modules → packages/react/node_modules}/@floating-ui/react/dist/floating-ui.react.js +307 -157
- package/dist/cjs/{node_modules/@floating-ui/react/utils → packages/react/node_modules/@floating-ui/react}/dist/floating-ui.react.utils.js +9 -4
- package/dist/cjs/{node_modules → packages/react/node_modules}/@floating-ui/react-dom/dist/floating-ui.react-dom.js +22 -18
- package/dist/{esm → cjs/packages/react}/node_modules/tabbable/dist/index.esm.js +59 -13
- package/dist/cjs/react-css-modules.css +2 -136
- package/dist/cjs/utilities/RovingTabIndex/RovingTabindexItem.js +1 -1
- package/dist/cjs/utilities/RovingTabIndex/RovingTabindexRoot.js +1 -1
- package/dist/esm/components/Accordion/Accordion.js +1 -4
- package/dist/esm/components/Accordion/AccordionContent/AccordionContent.js +1 -2
- package/dist/esm/components/Accordion/AccordionHeader/AccordionHeader.js +1 -2
- package/dist/esm/components/Accordion/AccordionItem/AccordionItem.js +1 -4
- package/dist/esm/components/Button/Button.js +2 -2
- package/dist/esm/components/DropdownMenu/DropdownMenuContent.js +3 -3
- package/dist/esm/components/DropdownMenu/DropdownMenuTrigger.js +1 -1
- package/dist/esm/components/Modal/ModalDialog.js +1 -1
- package/dist/esm/components/Modal/ModalHeader/ModalHeader.js +1 -1
- package/dist/esm/components/Modal/ModalHeader/ModalHeader.module.css.js +1 -1
- package/dist/esm/components/Popover/PopoverContent.js +4 -4
- package/dist/esm/components/Popover/PopoverTrigger.js +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js +4 -4
- package/dist/esm/components/form/Checkbox/Checkbox.js +1 -1
- package/dist/esm/components/form/Combobox/Combobox.js +76 -203
- package/dist/esm/components/form/Combobox/Combobox.module.css.js +1 -1
- package/dist/esm/components/form/Combobox/ComboboxContext.js +6 -0
- package/dist/esm/components/form/Combobox/ComboboxIdContext.js +35 -0
- package/dist/esm/components/form/Combobox/Custom/Custom.js +13 -8
- package/dist/esm/components/form/Combobox/Empty/Empty.js +3 -3
- package/dist/esm/components/form/Combobox/Option/Option.js +15 -33
- package/dist/esm/components/form/Combobox/Option/useComboboxOption.js +45 -0
- package/dist/esm/components/form/Combobox/internal/ComboboxChips.js +12 -9
- package/dist/esm/components/form/Combobox/internal/ComboboxClearButton.js +4 -7
- package/dist/esm/components/form/Combobox/internal/ComboboxInput.js +40 -69
- package/dist/esm/components/form/Combobox/internal/ComboboxNative.js +2 -2
- package/dist/esm/components/form/Combobox/useCombobox.js +77 -75
- package/dist/esm/components/form/Combobox/useComboboxKeyboard.js +74 -0
- package/dist/esm/components/form/Combobox/useFloatingCombobox.js +76 -0
- package/dist/esm/components/form/Search/Search.js +1 -1
- package/dist/esm/node_modules/@floating-ui/utils/{dom/dist → dist}/floating-ui.utils.dom.js +7 -4
- package/dist/esm/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +5 -0
- package/dist/esm/node_modules/clsx/dist/clsx.js +1 -1
- package/dist/esm/node_modules/clsx/dist/lite.js +4 -0
- package/dist/esm/{node_modules → packages/react/node_modules}/@floating-ui/core/dist/floating-ui.core.js +40 -16
- package/dist/esm/{node_modules → packages/react/node_modules}/@floating-ui/dom/dist/floating-ui.dom.js +82 -30
- package/dist/esm/{node_modules → packages/react/node_modules}/@floating-ui/react/dist/floating-ui.react.js +282 -135
- package/dist/esm/{node_modules/@floating-ui/react/utils → packages/react/node_modules/@floating-ui/react}/dist/floating-ui.react.utils.js +9 -5
- package/dist/esm/{node_modules → packages/react/node_modules}/@floating-ui/react-dom/dist/floating-ui.react-dom.js +19 -14
- package/dist/{cjs → esm/packages/react}/node_modules/tabbable/dist/index.esm.js +55 -15
- package/dist/esm/react-css-modules.css +2 -136
- package/dist/esm/utilities/RovingTabIndex/RovingTabindexItem.js +1 -1
- package/dist/esm/utilities/RovingTabIndex/RovingTabindexRoot.js +1 -1
- package/dist/types/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/types/components/Accordion/AccordionContent/AccordionContent.d.ts.map +1 -1
- package/dist/types/components/Accordion/AccordionHeader/AccordionHeader.d.ts.map +1 -1
- package/dist/types/components/Accordion/AccordionItem/AccordionItem.d.ts.map +1 -1
- package/dist/types/components/Modal/ModalHeader/ModalHeader.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Combobox.d.ts +95 -48
- package/dist/types/components/form/Combobox/Combobox.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/ComboboxContext.d.ts +41 -0
- package/dist/types/components/form/Combobox/ComboboxContext.d.ts.map +1 -0
- package/dist/types/components/form/Combobox/ComboboxIdContext.d.ts +19 -0
- package/dist/types/components/form/Combobox/ComboboxIdContext.d.ts.map +1 -0
- package/dist/types/components/form/Combobox/Custom/Custom.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Option/Option.d.ts +2 -2
- package/dist/types/components/form/Combobox/Option/Option.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Option/useComboboxOption.d.ts +14 -0
- package/dist/types/components/form/Combobox/Option/useComboboxOption.d.ts.map +1 -0
- package/dist/types/components/form/Combobox/internal/ComboboxChips.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/internal/ComboboxClearButton.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/internal/ComboboxInput.d.ts +9 -2
- package/dist/types/components/form/Combobox/internal/ComboboxInput.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/internal/ComboboxNative.d.ts +3 -1
- package/dist/types/components/form/Combobox/internal/ComboboxNative.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/useCombobox.d.ts +14 -9
- package/dist/types/components/form/Combobox/useCombobox.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/useComboboxKeyboard.d.ts +19 -0
- package/dist/types/components/form/Combobox/useComboboxKeyboard.d.ts.map +1 -0
- package/dist/types/components/form/Combobox/useFloatingCombobox.d.ts +41 -0
- package/dist/types/components/form/Combobox/useFloatingCombobox.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/cjs/components/Accordion/Accordion.module.css.js +0 -6
- package/dist/cjs/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -6
- package/dist/cjs/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dom/dist/floating-ui.utils.dom.js +0 -68
- package/dist/esm/components/Accordion/Accordion.module.css.js +0 -4
- package/dist/esm/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -4
- package/dist/esm/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dom/dist/floating-ui.utils.dom.js +0 -57
|
@@ -4,11 +4,8 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var clsx = require('../../node_modules/clsx/dist/clsx.js');
|
|
7
|
-
var Accordion_module = require('./Accordion.module.css.js');
|
|
8
7
|
|
|
9
|
-
const Accordion = React.forwardRef(({ border = false, color = 'neutral', className, ...rest }, ref) => (jsxRuntime.jsx("div", { className: clsx.clsx(
|
|
10
|
-
[Accordion_module.border]: border,
|
|
11
|
-
}, className), ref: ref, ...rest })));
|
|
8
|
+
const Accordion = React.forwardRef(({ border = false, color = 'neutral', className, ...rest }, ref) => (jsxRuntime.jsx("div", { className: clsx.clsx('fds-accordion', border && 'fds-accordion--border', color && `fds-accordion--${color}`, className), ref: ref, ...rest })));
|
|
12
9
|
Accordion.displayName = 'Accordion';
|
|
13
10
|
|
|
14
11
|
exports.Accordion = Accordion;
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var clsx = require('../../../node_modules/clsx/dist/clsx.js');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var Accordion_module = require('../Accordion.module.css.js');
|
|
8
7
|
var AccordionItem = require('../AccordionItem/AccordionItem.js');
|
|
9
8
|
var AnimateHeight = require('../../../utilities/AnimateHeight/AnimateHeight.js');
|
|
10
9
|
var Paragraph = require('../../Typography/Paragraph/Paragraph.js');
|
|
@@ -15,7 +14,7 @@ const AccordionContent = React.forwardRef(({ children, className, ...rest }, ref
|
|
|
15
14
|
console.error('<Accordion.Content> has to be used within an <Accordion.Item>');
|
|
16
15
|
return null;
|
|
17
16
|
}
|
|
18
|
-
return (jsxRuntime.jsx(AnimateHeight.AnimateHeight, { id: context.contentId, open: context.open, children: jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: 'small', children: jsxRuntime.jsx("div", { ref: ref, className: clsx.clsx(
|
|
17
|
+
return (jsxRuntime.jsx(AnimateHeight.AnimateHeight, { id: context.contentId, open: context.open, children: jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: 'small', children: jsxRuntime.jsx("div", { ref: ref, className: clsx.clsx('fds-accordion__content', className), ...rest, children: children }) }) }));
|
|
19
18
|
});
|
|
20
19
|
AccordionContent.displayName = 'AccordionContent';
|
|
21
20
|
|
|
@@ -5,7 +5,6 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var akselIcons = require('@navikt/aksel-icons');
|
|
6
6
|
var clsx = require('../../../node_modules/clsx/dist/clsx.js');
|
|
7
7
|
var React = require('react');
|
|
8
|
-
var Accordion_module = require('../Accordion.module.css.js');
|
|
9
8
|
var AccordionItem = require('../AccordionItem/AccordionItem.js');
|
|
10
9
|
var Heading = require('../../Typography/Heading/Heading.js');
|
|
11
10
|
var Paragraph = require('../../Typography/Paragraph/Paragraph.js');
|
|
@@ -20,7 +19,7 @@ const AccordionHeader = React.forwardRef(({ level = 1, children, className, onHe
|
|
|
20
19
|
context.toggleOpen();
|
|
21
20
|
onHeaderClick && onHeaderClick(e);
|
|
22
21
|
};
|
|
23
|
-
return (jsxRuntime.jsx(Heading.Heading, { ref: ref, size: 'xsmall', level: level, className: clsx.clsx(
|
|
22
|
+
return (jsxRuntime.jsx(Heading.Heading, { ref: ref, size: 'xsmall', level: level, className: clsx.clsx('fds-accordion__header', className), ...rest, children: jsxRuntime.jsxs("button", { type: 'button', className: clsx.clsx('fds-accordion__button', `fds-focus`), onClick: handleClick, "aria-expanded": context.open, "aria-controls": context.contentId, children: [jsxRuntime.jsx(akselIcons.ChevronDownIcon, { "aria-hidden": true, className: 'fds-accordion__expand-icon', fontSize: '1.5rem' }), jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: 'small', children: jsxRuntime.jsx("span", { children: children }) })] }) }));
|
|
24
23
|
});
|
|
25
24
|
AccordionHeader.displayName = 'AccordionHeader';
|
|
26
25
|
|
|
@@ -4,15 +4,12 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var clsx = require('../../../node_modules/clsx/dist/clsx.js');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var Accordion_module = require('../Accordion.module.css.js');
|
|
8
7
|
|
|
9
8
|
const AccordionItemContext = React.createContext(null);
|
|
10
9
|
const AccordionItem = React.forwardRef(({ children, className, open, defaultOpen = false, ...rest }, ref) => {
|
|
11
10
|
const [internalOpen, setInternalOpen] = React.useState(defaultOpen);
|
|
12
11
|
const contentId = React.useId();
|
|
13
|
-
return (jsxRuntime.jsx("div", { className: clsx.clsx(
|
|
14
|
-
[Accordion_module.open]: open ?? internalOpen,
|
|
15
|
-
}, className), ref: ref, ...rest, children: jsxRuntime.jsx(AccordionItemContext.Provider, { value: {
|
|
12
|
+
return (jsxRuntime.jsx("div", { className: clsx.clsx('fds-accordion__item', (open ?? internalOpen) && 'fds-accordion__item--open', className), ref: ref, ...rest, children: jsxRuntime.jsx(AccordionItemContext.Provider, { value: {
|
|
16
13
|
open: open ?? internalOpen,
|
|
17
14
|
toggleOpen: () => {
|
|
18
15
|
if (open === undefined) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var
|
|
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
9
|
/**
|
|
@@ -11,7 +11,7 @@ var index = require('../../node_modules/@radix-ui/react-slot/dist/index.js');
|
|
|
11
11
|
*/
|
|
12
12
|
const Button = React.forwardRef(({ children, color = 'first', variant = 'primary', size = 'medium', fullWidth = false, icon = false, type = 'button', className, as = 'button', asChild, ...rest }, ref) => {
|
|
13
13
|
const Component = asChild ? index.Slot : as;
|
|
14
|
-
return (jsxRuntime.jsx(Component, { ref: ref, type: type, className:
|
|
14
|
+
return (jsxRuntime.jsx(Component, { ref: ref, type: type, className: lite.clsx('fds-btn', `fds-focus`, `fds-btn--${size}`, `fds-btn--${variant}`, `fds-btn--${color}`, fullWidth && 'fds-btn--full-width', icon && 'fds-btn--icon-only', className), ...rest, children: children }));
|
|
15
15
|
});
|
|
16
16
|
Button.displayName = 'Button';
|
|
17
17
|
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var floatingUi_react = require('../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
6
|
+
var floatingUi_react = require('../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
7
7
|
var clsx = require('../../node_modules/clsx/dist/clsx.js');
|
|
8
8
|
var DropdownMenu_module = require('./DropdownMenu.module.css.js');
|
|
9
9
|
var DropdownMenu = require('./DropdownMenu.js');
|
|
10
|
-
var floatingUi_dom = require('../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
|
|
11
|
-
var floatingUi_core = require('../../node_modules/@floating-ui/core/dist/floating-ui.core.js');
|
|
10
|
+
var floatingUi_dom = require('../../packages/react/node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
|
|
11
|
+
var floatingUi_core = require('../../packages/react/node_modules/@floating-ui/core/dist/floating-ui.core.js');
|
|
12
12
|
var useIsomorphicLayoutEffect = require('../../hooks/useIsomorphicLayoutEffect.js');
|
|
13
13
|
|
|
14
14
|
function _interopNamespaceDefault(e) {
|
|
@@ -49,7 +49,7 @@ const DropdownMenuContent = React.forwardRef(({ className, children, ...rest },
|
|
|
49
49
|
floating: floatingEl.current,
|
|
50
50
|
},
|
|
51
51
|
whileElementsMounted: floatingUi_dom.autoUpdate,
|
|
52
|
-
middleware: [floatingUi_core.offset(GAP),
|
|
52
|
+
middleware: [floatingUi_core.offset(GAP), floatingUi_dom.shift()],
|
|
53
53
|
});
|
|
54
54
|
const { getFloatingProps } = floatingUi_react.useInteractions([
|
|
55
55
|
floatingUi_react.useFocus(context),
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var floatingUi_react = require('../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
6
|
+
var floatingUi_react = require('../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
7
7
|
var index = require('../../node_modules/@radix-ui/react-slot/dist/index.js');
|
|
8
8
|
var DropdownMenu = require('./DropdownMenu.js');
|
|
9
9
|
var Button = require('../Button/Button.js');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var floatingUi_react = require('../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
5
|
+
var floatingUi_react = require('../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var index = require('../../node_modules/@radix-ui/react-slot/dist/index.js');
|
|
8
8
|
var clsx = require('../../node_modules/clsx/dist/clsx.js');
|
|
@@ -15,7 +15,7 @@ var Heading = require('../../Typography/Heading/Heading.js');
|
|
|
15
15
|
const ModalHeader = React.forwardRef(({ closeButton = true, children, subtitle, asChild, className, ...rest }, ref) => {
|
|
16
16
|
const Component = asChild ? index.Slot : 'div';
|
|
17
17
|
const context = React.useContext(ModalRoot.ModalContext);
|
|
18
|
-
return (jsxRuntime.jsxs(Component, { ref: ref, className: clsx.clsx(ModalHeader_module.modalHeader, !closeButton && ModalHeader_module.noCloseButton, className), ...rest, children: [subtitle && (jsxRuntime.jsx(Paragraph.Paragraph, { size: 'small', variant: 'short', children: subtitle })), jsxRuntime.jsx(Heading.Heading, { level: 2, size: 'xsmall', children: children }), closeButton && (jsxRuntime.jsx(Button.Button, { name: 'close', variant: 'tertiary', color: 'second', size: 'medium', onClick: context?.closeModal, autoFocus: true, icon: true, children: jsxRuntime.jsx(akselIcons.XMarkIcon, { title: 'close modal', fontSize: '1.5em' }) }))] }));
|
|
18
|
+
return (jsxRuntime.jsxs(Component, { ref: ref, className: clsx.clsx(ModalHeader_module.modalHeader, !closeButton && ModalHeader_module.noCloseButton, className), ...rest, children: [subtitle && (jsxRuntime.jsx(Paragraph.Paragraph, { size: 'small', variant: 'short', children: subtitle })), jsxRuntime.jsx(Heading.Heading, { level: 2, size: 'xsmall', children: children }), closeButton && (jsxRuntime.jsx(Button.Button, { name: 'close', variant: 'tertiary', color: 'second', size: 'medium', onClick: context?.closeModal, autoFocus: true, icon: true, className: ModalHeader_module.modalHeaderButton, children: jsxRuntime.jsx(akselIcons.XMarkIcon, { title: 'close modal', fontSize: '1.5em' }) }))] }));
|
|
19
19
|
});
|
|
20
20
|
ModalHeader.displayName = 'ModalHeader';
|
|
21
21
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var classes = {"modalHeader":"fds-modalheader-modalHeader-47e4ee5b","noCloseButton":"fds-modalheader-noCloseButton-47e4ee5b"};
|
|
4
|
+
var classes = {"modalHeader":"fds-modalheader-modalHeader-47e4ee5b","modalHeaderButton":"fds-modalheader-modalHeaderButton-47e4ee5b","noCloseButton":"fds-modalheader-noCloseButton-47e4ee5b"};
|
|
5
5
|
|
|
6
6
|
module.exports = classes;
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var floatingUi_react = require('../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
6
|
+
var floatingUi_react = require('../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
7
7
|
var clsx = require('../../node_modules/clsx/dist/clsx.js');
|
|
8
8
|
var Popover = require('./Popover.js');
|
|
9
9
|
var Popover_module = require('./Popover.module.css.js');
|
|
10
|
-
var floatingUi_dom = require('../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
|
|
11
|
-
var floatingUi_core = require('../../node_modules/@floating-ui/core/dist/floating-ui.core.js');
|
|
12
|
-
var floatingUi_reactDom = require('../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js');
|
|
10
|
+
var floatingUi_dom = require('../../packages/react/node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
|
|
11
|
+
var floatingUi_core = require('../../packages/react/node_modules/@floating-ui/core/dist/floating-ui.core.js');
|
|
12
|
+
var floatingUi_reactDom = require('../../packages/react/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js');
|
|
13
13
|
var useIsomorphicLayoutEffect = require('../../hooks/useIsomorphicLayoutEffect.js');
|
|
14
14
|
var Paragraph = require('../Typography/Paragraph/Paragraph.js');
|
|
15
15
|
|
|
@@ -65,10 +65,10 @@ const PopoverContent = React.forwardRef(({ className, children, style, id, ...re
|
|
|
65
65
|
},
|
|
66
66
|
middleware: [
|
|
67
67
|
floatingUi_core.offset(ARROW_HEIGHT + ARROW_GAP),
|
|
68
|
-
|
|
68
|
+
floatingUi_dom.flip({
|
|
69
69
|
fallbackAxisSideDirection: 'start',
|
|
70
70
|
}),
|
|
71
|
-
|
|
71
|
+
floatingUi_dom.shift(),
|
|
72
72
|
floatingUi_reactDom.arrow({
|
|
73
73
|
element: arrowRef,
|
|
74
74
|
}),
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var floatingUi_react = require('../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
6
|
+
var floatingUi_react = require('../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
7
7
|
var index = require('../../node_modules/@radix-ui/react-slot/dist/index.js');
|
|
8
8
|
var Popover = require('./Popover.js');
|
|
9
9
|
var Button = require('../Button/Button.js');
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var clsx = require('../../node_modules/clsx/dist/clsx.js');
|
|
7
|
-
var floatingUi_react = require('../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
7
|
+
var floatingUi_react = require('../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
8
8
|
var Tooltip_module = require('./Tooltip.module.css.js');
|
|
9
|
-
var floatingUi_dom = require('../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
|
|
10
|
-
var floatingUi_core = require('../../node_modules/@floating-ui/core/dist/floating-ui.core.js');
|
|
11
|
-
var floatingUi_reactDom = require('../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js');
|
|
9
|
+
var floatingUi_dom = require('../../packages/react/node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
|
|
10
|
+
var floatingUi_core = require('../../packages/react/node_modules/@floating-ui/core/dist/floating-ui.core.js');
|
|
11
|
+
var floatingUi_reactDom = require('../../packages/react/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js');
|
|
12
12
|
|
|
13
13
|
function _interopNamespaceDefault(e) {
|
|
14
14
|
var n = Object.create(null);
|
|
@@ -43,10 +43,10 @@ const Tooltip = React.forwardRef(({ children, content, placement = 'top', delay
|
|
|
43
43
|
whileElementsMounted: floatingUi_dom.autoUpdate,
|
|
44
44
|
middleware: [
|
|
45
45
|
floatingUi_core.offset(ARROW_HEIGHT + ARROW_GAP),
|
|
46
|
-
|
|
46
|
+
floatingUi_dom.flip({
|
|
47
47
|
fallbackAxisSideDirection: 'start',
|
|
48
48
|
}),
|
|
49
|
-
|
|
49
|
+
floatingUi_dom.shift(),
|
|
50
50
|
floatingUi_reactDom.arrow({
|
|
51
51
|
element: arrowRef,
|
|
52
52
|
}),
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var clsx = require('../../../node_modules/clsx/dist/clsx.js');
|
|
7
|
-
var floatingUi_react = require('../../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
7
|
+
var floatingUi_react = require('../../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
8
8
|
var Checkbox_module = require('./Checkbox.module.css.js');
|
|
9
9
|
var useCheckbox = require('./useCheckbox.js');
|
|
10
10
|
var Paragraph = require('../../Typography/Paragraph/Paragraph.js');
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var floatingUi_react = require('../../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
6
|
+
var floatingUi_react = require('../../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
7
7
|
var clsx = require('../../../node_modules/clsx/dist/clsx.js');
|
|
8
8
|
var index = require('../../../node_modules/@tanstack/react-virtual/dist/esm/index.js');
|
|
9
|
-
var ReactDOM = require('react-dom');
|
|
10
9
|
var useFormField = require('../useFormField.js');
|
|
11
10
|
var useDebounce = require('../../../utilities/useDebounce.js');
|
|
12
11
|
var useCombobox = require('./useCombobox.js');
|
|
@@ -16,34 +15,30 @@ var ComboboxLabel = require('./internal/ComboboxLabel.js');
|
|
|
16
15
|
var ComboboxError = require('./internal/ComboboxError.js');
|
|
17
16
|
var ComboboxNative = require('./internal/ComboboxNative.js');
|
|
18
17
|
var Custom = require('./Custom/Custom.js');
|
|
18
|
+
var useFloatingCombobox = require('./useFloatingCombobox.js');
|
|
19
|
+
var useComboboxKeyboard = require('./useComboboxKeyboard.js');
|
|
20
|
+
var ComboboxIdContext = require('./ComboboxIdContext.js');
|
|
21
|
+
var ComboboxContext = require('./ComboboxContext.js');
|
|
19
22
|
var Box = require('../../Box/Box.js');
|
|
20
23
|
var Spinner = require('../../Spinner/Spinner.js');
|
|
21
|
-
var floatingUi_dom = require('../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
|
|
22
|
-
var floatingUi_core = require('../../../node_modules/@floating-ui/core/dist/floating-ui.core.js');
|
|
23
24
|
var objectUtils = require('../../../utilities/objectUtils.js');
|
|
24
25
|
|
|
25
|
-
const
|
|
26
|
-
return option.label.toLowerCase().startsWith(inputValue.toLowerCase());
|
|
27
|
-
}, chipSrLabel = (option) => 'Slett ' + option.label, className, ...rest }, forwareddRef) => {
|
|
26
|
+
const ComboboxComponent = React.forwardRef(({ value, initialValue = [], onValueChange, label, hideLabel = false, description, multiple = false, size = 'medium', disabled = false, readOnly = false, hideChips = false, clearButtonLabel = 'Fjern alt', hideClearButton = false, error, errorId, id, name, portal = true, htmlSize = 0, virtual = false, children, style, loading, loadingLabel = 'Laster...', filter, chipSrLabel = (option) => 'Slett ' + option.label, className, ...rest }, forwareddRef) => {
|
|
28
27
|
const inputRef = React.useRef(null);
|
|
29
28
|
const portalRef = React.useRef(null);
|
|
29
|
+
const listRef = React.useRef([]);
|
|
30
30
|
const listId = React.useId();
|
|
31
|
-
const [open, setOpen] = React.useState(false);
|
|
32
31
|
const [inputValue, setInputValue] = React.useState(rest.inputValue || '');
|
|
33
|
-
const
|
|
34
|
-
const { selectedOptions, setSelectedOptions, options, optionsChildren, restChildren, optionValues, customIds, prevSelectedHash, setPrevSelectedHash, } = useCombobox.default({
|
|
32
|
+
const { selectedOptions, options, restChildren, interactiveChildren, customIds, filteredOptionsChildren, filteredOptions, setSelectedOptions, } = useCombobox.default({
|
|
35
33
|
children,
|
|
36
34
|
inputValue,
|
|
37
35
|
filter,
|
|
38
36
|
multiple,
|
|
39
37
|
initialValue,
|
|
40
38
|
});
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
setInputValue(rest.inputValue);
|
|
45
|
-
}
|
|
46
|
-
}, [rest.inputValue]);
|
|
39
|
+
const { open, setOpen, refs, floatingStyles, context, getReferenceProps, getFloatingProps, getItemProps, } = useFloatingCombobox.useFloatingCombobox({
|
|
40
|
+
listRef,
|
|
41
|
+
});
|
|
47
42
|
const formFieldProps = useFormField.useFormField({
|
|
48
43
|
disabled,
|
|
49
44
|
readOnly,
|
|
@@ -53,248 +48,126 @@ const Combobox = React.forwardRef(({ value, initialValue = [], onValueChange, la
|
|
|
53
48
|
description,
|
|
54
49
|
id,
|
|
55
50
|
}, 'combobox');
|
|
56
|
-
const listRef = React.useRef([]);
|
|
57
51
|
// if value is set, set input value to the label of the value
|
|
58
52
|
React.useEffect(() => {
|
|
59
53
|
if (value && value.length > 0 && !multiple) {
|
|
60
|
-
const option = options
|
|
54
|
+
const option = options[value[0]];
|
|
61
55
|
setInputValue(option?.label || '');
|
|
62
56
|
}
|
|
63
57
|
}, [multiple, value, options]);
|
|
64
|
-
// floating UI
|
|
65
|
-
const { refs, floatingStyles, context } = floatingUi_react.useFloating({
|
|
66
|
-
open,
|
|
67
|
-
onOpenChange: (newOpen) => {
|
|
68
|
-
ReactDOM.flushSync(() => {
|
|
69
|
-
if (refs.floating.current && !newOpen) {
|
|
70
|
-
refs.floating.current.scrollTop = 0;
|
|
71
|
-
}
|
|
72
|
-
setTimeout(() => {
|
|
73
|
-
setOpen(newOpen);
|
|
74
|
-
}, 1);
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
whileElementsMounted: (reference, floating, update) => {
|
|
78
|
-
floatingUi_dom.autoUpdate(reference, floating, update);
|
|
79
|
-
return () => {
|
|
80
|
-
floating.scrollTop = 0;
|
|
81
|
-
};
|
|
82
|
-
},
|
|
83
|
-
middleware: [
|
|
84
|
-
floatingUi_core.flip({ padding: 10 }),
|
|
85
|
-
floatingUi_core.size({
|
|
86
|
-
apply({ rects, elements }) {
|
|
87
|
-
requestAnimationFrame(() => {
|
|
88
|
-
Object.assign(elements.floating.style, {
|
|
89
|
-
width: `calc(${rects.reference.width}px - calc(var(--fds-spacing-2) * 2))`,
|
|
90
|
-
maxHeight: `200px`,
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
},
|
|
94
|
-
}),
|
|
95
|
-
floatingUi_core.offset(10),
|
|
96
|
-
],
|
|
97
|
-
});
|
|
98
|
-
const role = floatingUi_react.useRole(context, { role: 'listbox' });
|
|
99
|
-
const dismiss = floatingUi_react.useDismiss(context);
|
|
100
|
-
const listNav = floatingUi_react.useListNavigation(context, {
|
|
101
|
-
listRef,
|
|
102
|
-
activeIndex,
|
|
103
|
-
virtual: true,
|
|
104
|
-
scrollItemIntoView: true,
|
|
105
|
-
enabled: open,
|
|
106
|
-
});
|
|
107
|
-
const { getReferenceProps, getFloatingProps } = floatingUi_react.useInteractions([
|
|
108
|
-
role,
|
|
109
|
-
dismiss,
|
|
110
|
-
listNav,
|
|
111
|
-
]);
|
|
112
|
-
// remove active index if combobox is closed
|
|
113
|
-
React.useEffect(() => {
|
|
114
|
-
if (!open) {
|
|
115
|
-
setActiveIndex(null);
|
|
116
|
-
}
|
|
117
|
-
}, [open]);
|
|
118
|
-
// Send new value if option was clicked
|
|
119
|
-
React.useEffect(() => {
|
|
120
|
-
const selectedHash = JSON.stringify(selectedOptions);
|
|
121
|
-
if (prevSelectedHash === selectedHash)
|
|
122
|
-
return;
|
|
123
|
-
const values = selectedOptions.map((option) => option.value);
|
|
124
|
-
onValueChange?.(values);
|
|
125
|
-
setPrevSelectedHash(selectedHash);
|
|
126
|
-
}, [onValueChange, selectedOptions, prevSelectedHash, setPrevSelectedHash]);
|
|
127
58
|
React.useEffect(() => {
|
|
128
|
-
if (value && options.length
|
|
59
|
+
if (value && Object.keys(options).length >= 0) {
|
|
129
60
|
const updatedSelectedOptions = value.map((option) => {
|
|
130
|
-
const value = options
|
|
61
|
+
const value = options[option];
|
|
131
62
|
return value;
|
|
132
63
|
});
|
|
133
|
-
setSelectedOptions(updatedSelectedOptions)
|
|
64
|
+
setSelectedOptions(updatedSelectedOptions.reduce((acc, value) => {
|
|
65
|
+
acc[value.value] = value;
|
|
66
|
+
return acc;
|
|
67
|
+
}, {}));
|
|
134
68
|
}
|
|
135
|
-
}, [multiple,
|
|
69
|
+
}, [multiple, value, options, setSelectedOptions]);
|
|
136
70
|
// handle click on option, either select or deselect - Handles single or multiple
|
|
137
|
-
const handleSelectOption = (
|
|
138
|
-
|
|
139
|
-
if (
|
|
140
|
-
setSelectedOptions(
|
|
71
|
+
const handleSelectOption = (args) => {
|
|
72
|
+
const { option, clear, remove } = args;
|
|
73
|
+
if (clear) {
|
|
74
|
+
setSelectedOptions({});
|
|
75
|
+
setInputValue('');
|
|
76
|
+
onValueChange?.([]);
|
|
141
77
|
return;
|
|
142
78
|
}
|
|
79
|
+
if (!option)
|
|
80
|
+
return;
|
|
81
|
+
if (remove) {
|
|
82
|
+
const newSelectedOptions = { ...selectedOptions };
|
|
83
|
+
delete newSelectedOptions[option.value];
|
|
84
|
+
setSelectedOptions(newSelectedOptions);
|
|
85
|
+
onValueChange?.(Object.keys(newSelectedOptions));
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const newSelectedOptions = { ...selectedOptions };
|
|
143
89
|
if (multiple) {
|
|
144
|
-
|
|
90
|
+
if (newSelectedOptions[option.value]) {
|
|
91
|
+
delete newSelectedOptions[option.value];
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
newSelectedOptions[option.value] = option;
|
|
95
|
+
}
|
|
145
96
|
setInputValue('');
|
|
146
97
|
inputRef.current?.focus();
|
|
147
98
|
}
|
|
148
99
|
else {
|
|
149
|
-
|
|
100
|
+
newSelectedOptions[option.value] = option;
|
|
150
101
|
setInputValue(option?.label || '');
|
|
151
102
|
// move cursor to the end of the input
|
|
152
103
|
setTimeout(() => {
|
|
153
104
|
inputRef.current?.setSelectionRange(option?.label?.length || 0, option?.label?.length || 0);
|
|
154
105
|
}, 0);
|
|
155
106
|
}
|
|
107
|
+
setSelectedOptions(newSelectedOptions);
|
|
108
|
+
console.log('calling new value with: ', Object.keys(newSelectedOptions));
|
|
109
|
+
onValueChange?.(Object.keys(newSelectedOptions));
|
|
156
110
|
!multiple && setOpen(false);
|
|
157
111
|
refs.domReference.current?.focus();
|
|
158
112
|
};
|
|
159
113
|
const debouncedHandleSelectOption = useDebounce(handleSelectOption, 50);
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
return 0;
|
|
175
|
-
}
|
|
176
|
-
return Math.min(prevActiveIndex + 1, navigateable - 1);
|
|
177
|
-
});
|
|
178
|
-
break;
|
|
179
|
-
case 'ArrowUp':
|
|
180
|
-
event.preventDefault();
|
|
181
|
-
/* If we are on the first item, close */
|
|
182
|
-
setActiveIndex((prevActiveIndex) => {
|
|
183
|
-
if (prevActiveIndex === 0) {
|
|
184
|
-
setOpen(false);
|
|
185
|
-
return null;
|
|
186
|
-
}
|
|
187
|
-
if (prevActiveIndex === null) {
|
|
188
|
-
return null;
|
|
189
|
-
}
|
|
190
|
-
return Math.max(prevActiveIndex - 1, 0);
|
|
191
|
-
});
|
|
192
|
-
break;
|
|
193
|
-
case 'Enter':
|
|
194
|
-
event.preventDefault();
|
|
195
|
-
if (activeIndex !== null &&
|
|
196
|
-
(optionsChildren[activeIndex] || customIds.length > 0)) {
|
|
197
|
-
// check if we are in the custom components
|
|
198
|
-
if (activeIndex <= customIds.length) {
|
|
199
|
-
// send `onSelect` event to the custom component
|
|
200
|
-
const selectedId = customIds[activeIndex];
|
|
201
|
-
const selectedComponent = restChildren.find((component) => useCombobox.isInteractiveComboboxCustom(component) &&
|
|
202
|
-
component.props?.id === selectedId);
|
|
203
|
-
if (useCombobox.isInteractiveComboboxCustom(selectedComponent) &&
|
|
204
|
-
selectedComponent.props.onSelect) {
|
|
205
|
-
selectedComponent.props.onSelect();
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
// if we are in the options, find the actual index
|
|
209
|
-
const valueIndex = activeIndex - customIds.length;
|
|
210
|
-
const child = optionsChildren[valueIndex];
|
|
211
|
-
if (useCombobox.isComboboxOption(child)) {
|
|
212
|
-
const props = child.props;
|
|
213
|
-
const option = options.find((option) => option.value === props.value);
|
|
214
|
-
if (!multiple) {
|
|
215
|
-
// check if option is already selected, if so, deselect it
|
|
216
|
-
if (selectedOptions.find((i) => i.value === option?.value)) {
|
|
217
|
-
setSelectedOptions([]);
|
|
218
|
-
setInputValue('');
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
debouncedHandleSelectOption(option);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
break;
|
|
226
|
-
case 'Backspace':
|
|
227
|
-
if (inputValue === '' && multiple && selectedOptions.length > 0) {
|
|
228
|
-
setSelectedOptions((prev) => prev.slice(0, prev.length - 1));
|
|
229
|
-
}
|
|
230
|
-
// if we are in single mode, we need to set activeValue to null
|
|
231
|
-
if (!multiple) {
|
|
232
|
-
setSelectedOptions([]);
|
|
233
|
-
}
|
|
234
|
-
break;
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
const handleKeyDown = useDebounce(handleKeyDownFunc, 20);
|
|
114
|
+
const handleKeyDown = useComboboxKeyboard.useComboboxKeyboard({
|
|
115
|
+
filteredOptions,
|
|
116
|
+
selectedOptions,
|
|
117
|
+
readOnly: formFieldProps.readOnly || false,
|
|
118
|
+
disabled: disabled,
|
|
119
|
+
multiple,
|
|
120
|
+
inputValue,
|
|
121
|
+
options,
|
|
122
|
+
open,
|
|
123
|
+
interactiveChildren,
|
|
124
|
+
setOpen,
|
|
125
|
+
setInputValue,
|
|
126
|
+
handleSelectOption: debouncedHandleSelectOption,
|
|
127
|
+
});
|
|
238
128
|
const rowVirtualizer = index.useVirtualizer({
|
|
239
|
-
count:
|
|
240
|
-
getScrollElement: () => refs.floating.current,
|
|
129
|
+
count: Object.keys(filteredOptionsChildren).length,
|
|
130
|
+
getScrollElement: () => (virtual ? refs.floating.current : null),
|
|
241
131
|
estimateSize: () => 70,
|
|
242
132
|
measureElement: (elem) => {
|
|
243
133
|
return elem.getBoundingClientRect().height;
|
|
244
134
|
},
|
|
245
135
|
overscan: 1,
|
|
246
136
|
});
|
|
247
|
-
return (jsxRuntime.jsxs(ComboboxContext.Provider, { value: {
|
|
137
|
+
return (jsxRuntime.jsxs(ComboboxContext.ComboboxContext.Provider, { value: {
|
|
248
138
|
size,
|
|
249
139
|
options,
|
|
250
140
|
selectedOptions,
|
|
251
141
|
multiple,
|
|
252
|
-
activeIndex,
|
|
253
142
|
disabled,
|
|
254
143
|
readOnly,
|
|
255
144
|
open,
|
|
256
145
|
inputRef,
|
|
257
146
|
refs,
|
|
258
147
|
inputValue,
|
|
259
|
-
activeDescendant,
|
|
260
|
-
error,
|
|
261
148
|
formFieldProps,
|
|
262
|
-
name,
|
|
263
149
|
htmlSize,
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
hideClearButton,
|
|
268
|
-
listId,
|
|
150
|
+
clearButtonLabel,
|
|
151
|
+
customIds,
|
|
152
|
+
filteredOptions,
|
|
269
153
|
setInputValue,
|
|
270
|
-
setActiveIndex,
|
|
271
|
-
handleKeyDown,
|
|
272
154
|
setOpen,
|
|
273
155
|
getReferenceProps,
|
|
274
|
-
|
|
275
|
-
/* Recieves index of option, and the ID of the button element */
|
|
276
|
-
setActiveOption: (index, id) => {
|
|
277
|
-
if (readOnly)
|
|
278
|
-
return;
|
|
279
|
-
if (disabled)
|
|
280
|
-
return;
|
|
281
|
-
setActiveIndex(index);
|
|
282
|
-
setActiveDescendant(id);
|
|
283
|
-
},
|
|
156
|
+
getItemProps,
|
|
284
157
|
/* Recieves the value of the option, and searches for it in our values lookup */
|
|
285
158
|
onOptionClick: (value) => {
|
|
286
159
|
if (readOnly)
|
|
287
160
|
return;
|
|
288
161
|
if (disabled)
|
|
289
162
|
return;
|
|
290
|
-
const option = options
|
|
291
|
-
debouncedHandleSelectOption(option);
|
|
163
|
+
const option = options[value];
|
|
164
|
+
debouncedHandleSelectOption({ option: option });
|
|
292
165
|
},
|
|
293
166
|
handleSelectOption: debouncedHandleSelectOption,
|
|
294
167
|
chipSrLabel,
|
|
295
168
|
listRef,
|
|
296
169
|
forwareddRef,
|
|
297
|
-
}, children: [jsxRuntime.jsxs(Box.Box, { className: clsx.clsx(Combobox_module.combobox, disabled && Combobox_module.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), "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: 'medium', borderRadius: 'medium', borderColor: 'default', "aria-labelledby": formFieldProps.inputProps.id, "aria-autocomplete": 'list', tabIndex: -1, ...getFloatingProps({
|
|
170
|
+
}, children: [jsxRuntime.jsxs(Box.Box, { className: clsx.clsx(Combobox_module.combobox, disabled && Combobox_module.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: 'medium', borderRadius: 'medium', borderColor: 'default', "aria-labelledby": formFieldProps.inputProps.id, "aria-autocomplete": 'list', tabIndex: -1, ...getFloatingProps({
|
|
298
171
|
ref: refs.setFloating,
|
|
299
172
|
style: {
|
|
300
173
|
...floatingStyles,
|
|
@@ -309,10 +182,10 @@ const Combobox = React.forwardRef(({ value, initialValue = [], onValueChange, la
|
|
|
309
182
|
left: 0,
|
|
310
183
|
width: '100%',
|
|
311
184
|
transform: `translateY(${virtualRow.start}px)`,
|
|
312
|
-
}, children:
|
|
185
|
+
}, children: filteredOptionsChildren[virtualRow.index] }, virtualRow.index))) })), loading ? (jsxRuntime.jsxs(Custom.default, { className: Combobox_module.loading, children: [jsxRuntime.jsx(Spinner.Spinner, { title: 'Laster', size: 'small' }), loadingLabel] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [restChildren, !virtual && filteredOptionsChildren] }))] }) }) }))] }));
|
|
313
186
|
});
|
|
314
|
-
const
|
|
187
|
+
const Combobox = React.forwardRef((props, ref) => (jsxRuntime.jsx(ComboboxIdContext.ComboboxIdProvider, { children: jsxRuntime.jsx(ComboboxComponent, { ...props, ref: ref }) })));
|
|
315
188
|
Combobox.displayName = 'Combobox';
|
|
316
189
|
|
|
317
190
|
exports.Combobox = Combobox;
|
|
318
|
-
exports.
|
|
191
|
+
exports.ComboboxComponent = ComboboxComponent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var classes = {"combobox":"fds-combobox-combobox-249a725c","optionsWrapper":"fds-combobox-optionsWrapper-249a725c","readOnly":"fds-combobox-readOnly-249a725c","inputWrapper":"fds-combobox-inputWrapper-249a725c","small":"fds-combobox-small-249a725c","medium":"fds-combobox-medium-249a725c","large":"fds-combobox-large-249a725c","error":"fds-combobox-error-249a725c","chipAndInput":"fds-combobox-chipAndInput-249a725c","chips":"fds-combobox-chips-249a725c","arrow":"fds-combobox-arrow-249a725c","readonly":"fds-combobox-readonly-249a725c","label":"fds-combobox-label-249a725c","description":"fds-combobox-description-249a725c","clearButton":"fds-combobox-clearButton-249a725c","disabled":"fds-combobox-disabled-249a725c","padlock":"fds-combobox-padlock-249a725c","errorMessage":"fds-combobox-errorMessage-249a725c","loading":"fds-combobox-loading-249a725c","
|
|
4
|
+
var classes = {"combobox":"fds-combobox-combobox-249a725c","optionsWrapper":"fds-combobox-optionsWrapper-249a725c","readOnly":"fds-combobox-readOnly-249a725c","inputWrapper":"fds-combobox-inputWrapper-249a725c","small":"fds-combobox-small-249a725c","medium":"fds-combobox-medium-249a725c","large":"fds-combobox-large-249a725c","error":"fds-combobox-error-249a725c","chipAndInput":"fds-combobox-chipAndInput-249a725c","chips":"fds-combobox-chips-249a725c","arrow":"fds-combobox-arrow-249a725c","readonly":"fds-combobox-readonly-249a725c","label":"fds-combobox-label-249a725c","description":"fds-combobox-description-249a725c","clearButton":"fds-combobox-clearButton-249a725c","disabled":"fds-combobox-disabled-249a725c","padlock":"fds-combobox-padlock-249a725c","errorMessage":"fds-combobox-errorMessage-249a725c","loading":"fds-combobox-loading-249a725c","showChecked":"fds-combobox-showChecked-249a725c"};
|
|
5
5
|
|
|
6
6
|
module.exports = classes;
|