@digdir/designsystemet-react 0.55.1-alpha.1 → 0.56.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Chip/Chip.module.css.js +1 -1
- package/dist/cjs/components/Popover/Popover.js +2 -2
- package/dist/cjs/components/Popover/PopoverContent.js +2 -2
- package/dist/cjs/components/Tooltip/Tooltip.js +1 -1
- package/dist/cjs/components/form/Combobox/Combobox.js +19 -4
- package/dist/cjs/components/form/Search/Search.js +1 -1
- package/dist/cjs/node_modules/@floating-ui/react/dist/floating-ui.react.js +1 -1
- package/dist/cjs/node_modules/@floating-ui/{react/node_modules/@floating-ui/react-dom → react-dom}/dist/floating-ui.react-dom.js +2 -2
- package/dist/cjs/node_modules/@tanstack/react-virtual/{build/lib → dist/esm}/index.js +18 -32
- package/dist/cjs/node_modules/@tanstack/virtual-core/dist/esm/index.js +606 -0
- package/dist/cjs/node_modules/@tanstack/virtual-core/dist/esm/utils.js +60 -0
- package/dist/cjs/react-css-modules.css +76 -79
- package/dist/esm/components/Chip/Chip.module.css.js +1 -1
- package/dist/esm/components/Popover/Popover.js +2 -2
- package/dist/esm/components/Popover/PopoverContent.js +2 -2
- package/dist/esm/components/Tooltip/Tooltip.js +1 -1
- package/dist/esm/components/form/Combobox/Combobox.js +19 -4
- package/dist/esm/components/form/Search/Search.js +1 -1
- package/dist/esm/node_modules/@floating-ui/react/dist/floating-ui.react.js +2 -2
- package/dist/esm/node_modules/@floating-ui/{react/node_modules/@floating-ui/react-dom → react-dom}/dist/floating-ui.react-dom.js +4 -4
- package/dist/esm/node_modules/@tanstack/react-virtual/dist/esm/index.js +43 -0
- package/dist/esm/node_modules/@tanstack/virtual-core/dist/esm/index.js +595 -0
- package/dist/esm/node_modules/@tanstack/virtual-core/dist/esm/utils.js +56 -0
- package/dist/esm/react-css-modules.css +76 -79
- package/dist/types/components/Popover/Popover.d.ts +1 -6
- package/dist/types/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Combobox.d.ts.map +1 -1
- package/dist/types/components/form/Search/Search.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/cjs/node_modules/@tanstack/react-virtual/build/lib/_virtual/_rollupPluginBabelHelpers.js +0 -29
- package/dist/cjs/node_modules/@tanstack/virtual-core/build/lib/_virtual/_rollupPluginBabelHelpers.js +0 -29
- package/dist/cjs/node_modules/@tanstack/virtual-core/build/lib/index.js +0 -607
- package/dist/cjs/node_modules/@tanstack/virtual-core/build/lib/utils.js +0 -62
- package/dist/esm/node_modules/@tanstack/react-virtual/build/lib/_virtual/_rollupPluginBabelHelpers.js +0 -27
- package/dist/esm/node_modules/@tanstack/react-virtual/build/lib/index.js +0 -57
- package/dist/esm/node_modules/@tanstack/virtual-core/build/lib/_virtual/_rollupPluginBabelHelpers.js +0 -27
- package/dist/esm/node_modules/@tanstack/virtual-core/build/lib/index.js +0 -596
- package/dist/esm/node_modules/@tanstack/virtual-core/build/lib/utils.js +0 -58
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var classes = {"chip":"fds-chip-chip-4563db0f","chipButton":"fds-chip-chipButton-4563db0f","label":"fds-chip-label-4563db0f","removable":"fds-chip-removable-4563db0f","xMark":"fds-chip-xMark-4563db0f","
|
|
4
|
+
var classes = {"chip":"fds-chip-chip-4563db0f","chipButton":"fds-chip-chipButton-4563db0f","label":"fds-chip-label-4563db0f","removable":"fds-chip-removable-4563db0f","xMark":"fds-chip-xMark-4563db0f","small":"fds-chip-small-4563db0f","medium":"fds-chip-medium-4563db0f","large":"fds-chip-large-4563db0f","icon":"fds-chip-icon-4563db0f","spacing":"fds-chip-spacing-4563db0f","checkmarkIcon":"fds-chip-checkmarkIcon-4563db0f","groupContainer":"fds-chip-groupContainer-4563db0f"};
|
|
5
5
|
|
|
6
6
|
module.exports = classes;
|
|
@@ -23,7 +23,7 @@ function _interopNamespaceDefault(e) {
|
|
|
23
23
|
|
|
24
24
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
25
25
|
|
|
26
|
-
const Popover = ({ children, placement = 'top', open, variant = 'default', size = 'medium', portal, onOpenChange, onClose,
|
|
26
|
+
const Popover = ({ children, placement = 'top', open, variant = 'default', size = 'medium', portal, onOpenChange, onClose, }) => {
|
|
27
27
|
const triggerRef = React.useRef(null);
|
|
28
28
|
const [internalOpen, setInternalOpen] = React.useState(open ?? false);
|
|
29
29
|
const randomPopoverId = React.useId();
|
|
@@ -34,7 +34,7 @@ const Popover = ({ children, placement = 'top', open, variant = 'default', size
|
|
|
34
34
|
React__namespace.useEffect(() => {
|
|
35
35
|
setInternalOpen(open ?? false);
|
|
36
36
|
}, [open]);
|
|
37
|
-
const anchorEl =
|
|
37
|
+
const anchorEl = triggerRef.current;
|
|
38
38
|
return (jsxRuntime.jsx(PopoverContext.Provider, { value: {
|
|
39
39
|
triggerRef,
|
|
40
40
|
anchorEl,
|
|
@@ -9,7 +9,7 @@ var Popover = require('./Popover.js');
|
|
|
9
9
|
var Popover_module = require('./Popover.module.css.js');
|
|
10
10
|
var floatingUi_dom = require('../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
|
|
11
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
|
|
12
|
+
var floatingUi_reactDom = require('../../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
|
|
|
@@ -60,7 +60,7 @@ const PopoverContent = React.forwardRef(({ className, children, style, id, ...re
|
|
|
60
60
|
},
|
|
61
61
|
whileElementsMounted: floatingUi_dom.autoUpdate,
|
|
62
62
|
elements: {
|
|
63
|
-
reference: anchorEl,
|
|
63
|
+
reference: anchorEl ?? undefined,
|
|
64
64
|
floating: floatingEl.current,
|
|
65
65
|
},
|
|
66
66
|
middleware: [
|
|
@@ -8,7 +8,7 @@ var floatingUi_react = require('../../node_modules/@floating-ui/react/dist/float
|
|
|
8
8
|
var Tooltip_module = require('./Tooltip.module.css.js');
|
|
9
9
|
var floatingUi_dom = require('../../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 floatingUi_reactDom = require('../../node_modules/@floating-ui/react
|
|
11
|
+
var floatingUi_reactDom = require('../../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);
|
|
@@ -5,7 +5,8 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var floatingUi_react = require('../../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
|
|
7
7
|
var clsx = require('../../../node_modules/clsx/dist/clsx.js');
|
|
8
|
-
var index = require('../../../node_modules/@tanstack/react-virtual/
|
|
8
|
+
var index = require('../../../node_modules/@tanstack/react-virtual/dist/esm/index.js');
|
|
9
|
+
var ReactDOM = require('react-dom');
|
|
9
10
|
var useFormField = require('../useFormField.js');
|
|
10
11
|
var useDebounce = require('../../../utilities/useDebounce.js');
|
|
11
12
|
var useCombobox = require('./useCombobox.js');
|
|
@@ -62,9 +63,23 @@ const Combobox = React.forwardRef(({ value, initialValue = [], onValueChange, la
|
|
|
62
63
|
}, [multiple, value, options]);
|
|
63
64
|
// floating UI
|
|
64
65
|
const { refs, floatingStyles, context } = floatingUi_react.useFloating({
|
|
65
|
-
whileElementsMounted: floatingUi_dom.autoUpdate,
|
|
66
66
|
open,
|
|
67
|
-
onOpenChange:
|
|
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
|
+
},
|
|
68
83
|
middleware: [
|
|
69
84
|
floatingUi_core.flip({ padding: 10 }),
|
|
70
85
|
floatingUi_core.size({
|
|
@@ -223,7 +238,7 @@ const Combobox = React.forwardRef(({ value, initialValue = [], onValueChange, la
|
|
|
223
238
|
const rowVirtualizer = index.useVirtualizer({
|
|
224
239
|
count: optionsChildren.length,
|
|
225
240
|
getScrollElement: () => refs.floating.current,
|
|
226
|
-
estimateSize: () =>
|
|
241
|
+
estimateSize: () => 70,
|
|
227
242
|
measureElement: (elem) => {
|
|
228
243
|
return elem.getBoundingClientRect().height;
|
|
229
244
|
},
|
|
@@ -43,7 +43,7 @@ const Search = React.forwardRef((props, ref) => {
|
|
|
43
43
|
};
|
|
44
44
|
const isSimple = variant === 'simple';
|
|
45
45
|
const showClearButton = Boolean(value ?? internalValue) && !disabled;
|
|
46
|
-
return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { style: style, className: clsx.clsx(Search_module.formField, inputProps.disabled && Search_module.disabled, Search_module[size], className), children: [label && (jsxRuntime.jsx(Label.Label, { size: size, weight: 'medium', htmlFor: inputProps.id, className: clsx.clsx(Search_module.label, hideLabel && utility_module.visuallyHidden), children: jsxRuntime.jsx("span", { children: label }) })), jsxRuntime.jsxs("div", { className: Search_module.field, children: [jsxRuntime.jsxs("div", { className:
|
|
46
|
+
return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { style: style, className: clsx.clsx(Search_module.formField, inputProps.disabled && Search_module.disabled, Search_module[size], className), children: [label && (jsxRuntime.jsx(Label.Label, { size: size, weight: 'medium', htmlFor: inputProps.id, className: clsx.clsx(Search_module.label, hideLabel && utility_module.visuallyHidden), children: jsxRuntime.jsx("span", { children: label }) })), jsxRuntime.jsxs("div", { className: Search_module.field, children: [jsxRuntime.jsxs("div", { className: Search_module.field, children: [isSimple && (jsxRuntime.jsx(akselIcons.MagnifyingGlassIcon, { className: Search_module.icon, "aria-hidden": true })), jsxRuntime.jsx("input", { ref: mergedRef, size: htmlSize, value: value ?? internalValue, disabled: disabled, className: clsx.clsx(Search_module.input, utility_module.focusable, Search_module[size], isSimple && Search_module.simple, !isSimple && Search_module.withSearchButton), ...objectUtils.omit(['size', 'error', 'errorId', 'readOnly'], rest), ...inputProps, onChange: handleChange }), showClearButton && (jsxRuntime.jsxs("button", { className: clsx.clsx(Search_module.clearButton, utility_module.focusable), type: 'button', onClick: handleClear, disabled: disabled, children: [jsxRuntime.jsx("span", { className: utility_module.visuallyHidden, children: clearButtonLabel }), jsxRuntime.jsx(akselIcons.XMarkIcon, { "aria-hidden": true })] }))] }), !isSimple && (jsxRuntime.jsx(Button.Button, { className: Search_module.searchButton, size: size, variant: variant, type: 'submit', onClick: handleSearchClick, disabled: disabled, children: searchButtonLabel }))] }), jsxRuntime.jsx("div", { className: Search_module.errorMessage, id: errorId, "aria-live": 'polite', "aria-relevant": 'additions removals', children: hasError && jsxRuntime.jsx(ErrorMessage.ErrorMessage, { size: size, children: props.error }) })] }) }));
|
|
47
47
|
});
|
|
48
48
|
Search.displayName = 'Search';
|
|
49
49
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var floatingUi_react_utils = require('../utils/dist/floating-ui.react.utils.js');
|
|
6
6
|
var floatingUi_utils = require('../node_modules/@floating-ui/utils/dist/floating-ui.utils.js');
|
|
7
|
-
var floatingUi_reactDom = require('
|
|
7
|
+
var floatingUi_reactDom = require('../../react-dom/dist/floating-ui.react-dom.js');
|
|
8
8
|
var floatingUi_utils_dom$1 = require('../node_modules/@floating-ui/utils/dom/dist/floating-ui.utils.dom.js');
|
|
9
9
|
var index_esm = require('../../../tabbable/dist/index.esm.js');
|
|
10
10
|
var ReactDOM = require('react-dom');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var floatingUi_dom = require('
|
|
4
|
+
var floatingUi_dom = require('../../dom/dist/floating-ui.dom.js');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var ReactDOM = require('react-dom');
|
|
7
|
-
var floatingUi_core = require('
|
|
7
|
+
var floatingUi_core = require('../../core/dist/floating-ui.core.js');
|
|
8
8
|
|
|
9
9
|
function _interopNamespaceDefault(e) {
|
|
10
10
|
var n = Object.create(null);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var _rollupPluginBabelHelpers = require('./_virtual/_rollupPluginBabelHelpers.js');
|
|
5
4
|
var React = require('react');
|
|
6
5
|
var ReactDOM = require('react-dom');
|
|
7
|
-
var index = require('../../../virtual-core/
|
|
6
|
+
var index = require('../../../virtual-core/dist/esm/index.js');
|
|
8
7
|
|
|
9
8
|
function _interopNamespaceDefault(e) {
|
|
10
9
|
var n = Object.create(null);
|
|
@@ -25,53 +24,40 @@ function _interopNamespaceDefault(e) {
|
|
|
25
24
|
|
|
26
25
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
* react-virtual
|
|
30
|
-
*
|
|
31
|
-
* Copyright (c) TanStack
|
|
32
|
-
*
|
|
33
|
-
* This source code is licensed under the MIT license found in the
|
|
34
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
35
|
-
*
|
|
36
|
-
* @license MIT
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
var useIsomorphicLayoutEffect = typeof document !== 'undefined' ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
27
|
+
const useIsomorphicLayoutEffect = typeof document !== "undefined" ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
42
28
|
function useVirtualizerBase(options) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
29
|
+
const rerender = React__namespace.useReducer(() => ({}), {})[1];
|
|
30
|
+
const resolvedOptions = {
|
|
31
|
+
...options,
|
|
32
|
+
onChange: (instance2, sync) => {
|
|
33
|
+
var _a;
|
|
48
34
|
if (sync) {
|
|
49
35
|
ReactDOM.flushSync(rerender);
|
|
50
36
|
} else {
|
|
51
37
|
rerender();
|
|
52
38
|
}
|
|
53
|
-
options.onChange == null
|
|
39
|
+
(_a = options.onChange) == null ? void 0 : _a.call(options, instance2, sync);
|
|
54
40
|
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
instance = _React$useState[0];
|
|
41
|
+
};
|
|
42
|
+
const [instance] = React__namespace.useState(
|
|
43
|
+
() => new index.Virtualizer(resolvedOptions)
|
|
44
|
+
);
|
|
60
45
|
instance.setOptions(resolvedOptions);
|
|
61
|
-
React__namespace.useEffect(
|
|
46
|
+
React__namespace.useEffect(() => {
|
|
62
47
|
return instance._didMount();
|
|
63
48
|
}, []);
|
|
64
|
-
useIsomorphicLayoutEffect(
|
|
49
|
+
useIsomorphicLayoutEffect(() => {
|
|
65
50
|
return instance._willUpdate();
|
|
66
51
|
});
|
|
67
52
|
return instance;
|
|
68
53
|
}
|
|
69
54
|
function useVirtualizer(options) {
|
|
70
|
-
return useVirtualizerBase(
|
|
55
|
+
return useVirtualizerBase({
|
|
71
56
|
observeElementRect: index.observeElementRect,
|
|
72
57
|
observeElementOffset: index.observeElementOffset,
|
|
73
|
-
scrollToFn: index.elementScroll
|
|
74
|
-
|
|
58
|
+
scrollToFn: index.elementScroll,
|
|
59
|
+
...options
|
|
60
|
+
});
|
|
75
61
|
}
|
|
76
62
|
|
|
77
63
|
exports.Virtualizer = index.Virtualizer;
|