@digdir/designsystemet-react 0.58.0 → 0.59.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.
Files changed (107) hide show
  1. package/dist/cjs/components/Alert/Alert.js +2 -2
  2. package/dist/cjs/components/Button/Button.js +1 -2
  3. package/dist/cjs/components/DropdownMenu/DropdownMenuContent.js +4 -4
  4. package/dist/cjs/components/DropdownMenu/DropdownMenuTrigger.js +1 -1
  5. package/dist/cjs/components/Modal/ModalDialog.js +1 -1
  6. package/dist/cjs/components/Popover/PopoverContent.js +6 -6
  7. package/dist/cjs/components/Popover/PopoverTrigger.js +1 -1
  8. package/dist/cjs/components/SkipLink/SkipLink.js +1 -2
  9. package/dist/cjs/components/Tooltip/Tooltip.js +6 -6
  10. package/dist/cjs/components/form/Checkbox/Checkbox.js +1 -1
  11. package/dist/cjs/components/form/Combobox/Combobox.js +60 -177
  12. package/dist/cjs/components/form/Combobox/ComboboxContext.js +8 -0
  13. package/dist/cjs/components/form/Combobox/ComboboxIdContext.js +42 -0
  14. package/dist/cjs/components/form/Combobox/Custom/Custom.js +14 -9
  15. package/dist/cjs/components/form/Combobox/Empty/Empty.js +4 -4
  16. package/dist/cjs/components/form/Combobox/Option/Option.js +15 -33
  17. package/dist/cjs/components/form/Combobox/Option/useComboboxOption.js +47 -0
  18. package/dist/cjs/components/form/Combobox/internal/ComboboxChips.js +14 -6
  19. package/dist/cjs/components/form/Combobox/internal/ComboboxClearButton.js +4 -4
  20. package/dist/cjs/components/form/Combobox/internal/ComboboxInput.js +40 -35
  21. package/dist/cjs/components/form/Combobox/internal/ComboboxNative.js +2 -2
  22. package/dist/cjs/components/form/Combobox/useCombobox.js +46 -32
  23. package/dist/cjs/components/form/Combobox/useComboboxKeyboard.js +79 -0
  24. package/dist/cjs/components/form/Combobox/useFloatingCombobox.js +78 -0
  25. package/dist/cjs/components/form/Search/Search.js +1 -1
  26. package/dist/cjs/node_modules/@floating-ui/utils/{dom/dist → dist}/floating-ui.utils.dom.js +7 -4
  27. package/dist/cjs/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +5 -0
  28. package/dist/cjs/{node_modules → packages/react/node_modules}/@floating-ui/core/dist/floating-ui.core.js +40 -16
  29. package/dist/cjs/{node_modules → packages/react/node_modules}/@floating-ui/dom/dist/floating-ui.dom.js +83 -31
  30. package/dist/cjs/{node_modules → packages/react/node_modules}/@floating-ui/react/dist/floating-ui.react.js +307 -157
  31. package/dist/cjs/{node_modules/@floating-ui/react/utils → packages/react/node_modules/@floating-ui/react}/dist/floating-ui.react.utils.js +9 -4
  32. package/dist/cjs/{node_modules → packages/react/node_modules}/@floating-ui/react-dom/dist/floating-ui.react-dom.js +22 -18
  33. package/dist/{esm → cjs/packages/react}/node_modules/tabbable/dist/index.esm.js +59 -13
  34. package/dist/cjs/react-css-modules.css +0 -315
  35. package/dist/cjs/utilities/RovingTabIndex/RovingTabindexItem.js +1 -1
  36. package/dist/cjs/utilities/RovingTabIndex/RovingTabindexRoot.js +1 -1
  37. package/dist/esm/components/Alert/Alert.js +2 -2
  38. package/dist/esm/components/Button/Button.js +1 -2
  39. package/dist/esm/components/DropdownMenu/DropdownMenuContent.js +3 -3
  40. package/dist/esm/components/DropdownMenu/DropdownMenuTrigger.js +1 -1
  41. package/dist/esm/components/Modal/ModalDialog.js +1 -1
  42. package/dist/esm/components/Popover/PopoverContent.js +4 -4
  43. package/dist/esm/components/Popover/PopoverTrigger.js +1 -1
  44. package/dist/esm/components/SkipLink/SkipLink.js +1 -2
  45. package/dist/esm/components/Tooltip/Tooltip.js +4 -4
  46. package/dist/esm/components/form/Checkbox/Checkbox.js +1 -1
  47. package/dist/esm/components/form/Combobox/Combobox.js +65 -182
  48. package/dist/esm/components/form/Combobox/ComboboxContext.js +6 -0
  49. package/dist/esm/components/form/Combobox/ComboboxIdContext.js +35 -0
  50. package/dist/esm/components/form/Combobox/Custom/Custom.js +13 -8
  51. package/dist/esm/components/form/Combobox/Empty/Empty.js +3 -3
  52. package/dist/esm/components/form/Combobox/Option/Option.js +15 -33
  53. package/dist/esm/components/form/Combobox/Option/useComboboxOption.js +45 -0
  54. package/dist/esm/components/form/Combobox/internal/ComboboxChips.js +13 -5
  55. package/dist/esm/components/form/Combobox/internal/ComboboxClearButton.js +3 -3
  56. package/dist/esm/components/form/Combobox/internal/ComboboxInput.js +39 -34
  57. package/dist/esm/components/form/Combobox/internal/ComboboxNative.js +2 -2
  58. package/dist/esm/components/form/Combobox/useCombobox.js +46 -32
  59. package/dist/esm/components/form/Combobox/useComboboxKeyboard.js +77 -0
  60. package/dist/esm/components/form/Combobox/useFloatingCombobox.js +76 -0
  61. package/dist/esm/components/form/Search/Search.js +1 -1
  62. package/dist/esm/node_modules/@floating-ui/utils/{dom/dist → dist}/floating-ui.utils.dom.js +7 -4
  63. package/dist/esm/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +5 -0
  64. package/dist/esm/{node_modules → packages/react/node_modules}/@floating-ui/core/dist/floating-ui.core.js +40 -16
  65. package/dist/esm/{node_modules → packages/react/node_modules}/@floating-ui/dom/dist/floating-ui.dom.js +82 -30
  66. package/dist/esm/{node_modules → packages/react/node_modules}/@floating-ui/react/dist/floating-ui.react.js +282 -135
  67. package/dist/esm/{node_modules/@floating-ui/react/utils → packages/react/node_modules/@floating-ui/react}/dist/floating-ui.react.utils.js +9 -5
  68. package/dist/esm/{node_modules → packages/react/node_modules}/@floating-ui/react-dom/dist/floating-ui.react-dom.js +19 -14
  69. package/dist/{cjs → esm/packages/react}/node_modules/tabbable/dist/index.esm.js +55 -15
  70. package/dist/esm/react-css-modules.css +0 -315
  71. package/dist/esm/utilities/RovingTabIndex/RovingTabindexItem.js +1 -1
  72. package/dist/esm/utilities/RovingTabIndex/RovingTabindexRoot.js +1 -1
  73. package/dist/types/components/Alert/Alert.d.ts +12 -0
  74. package/dist/types/components/Alert/Alert.d.ts.map +1 -1
  75. package/dist/types/components/Button/Button.d.ts.map +1 -1
  76. package/dist/types/components/SkipLink/SkipLink.d.ts.map +1 -1
  77. package/dist/types/components/form/Combobox/Combobox.d.ts +104 -39
  78. package/dist/types/components/form/Combobox/Combobox.d.ts.map +1 -1
  79. package/dist/types/components/form/Combobox/ComboboxContext.d.ts +48 -0
  80. package/dist/types/components/form/Combobox/ComboboxContext.d.ts.map +1 -0
  81. package/dist/types/components/form/Combobox/ComboboxIdContext.d.ts +19 -0
  82. package/dist/types/components/form/Combobox/ComboboxIdContext.d.ts.map +1 -0
  83. package/dist/types/components/form/Combobox/Custom/Custom.d.ts.map +1 -1
  84. package/dist/types/components/form/Combobox/Option/Option.d.ts +2 -2
  85. package/dist/types/components/form/Combobox/Option/Option.d.ts.map +1 -1
  86. package/dist/types/components/form/Combobox/Option/useComboboxOption.d.ts +14 -0
  87. package/dist/types/components/form/Combobox/Option/useComboboxOption.d.ts.map +1 -0
  88. package/dist/types/components/form/Combobox/internal/ComboboxChips.d.ts.map +1 -1
  89. package/dist/types/components/form/Combobox/internal/ComboboxInput.d.ts +0 -1
  90. package/dist/types/components/form/Combobox/internal/ComboboxInput.d.ts.map +1 -1
  91. package/dist/types/components/form/Combobox/internal/ComboboxNative.d.ts +3 -1
  92. package/dist/types/components/form/Combobox/internal/ComboboxNative.d.ts.map +1 -1
  93. package/dist/types/components/form/Combobox/useCombobox.d.ts +13 -5
  94. package/dist/types/components/form/Combobox/useCombobox.d.ts.map +1 -1
  95. package/dist/types/components/form/Combobox/useComboboxKeyboard.d.ts +20 -0
  96. package/dist/types/components/form/Combobox/useComboboxKeyboard.d.ts.map +1 -0
  97. package/dist/types/components/form/Combobox/useFloatingCombobox.d.ts +41 -0
  98. package/dist/types/components/form/Combobox/useFloatingCombobox.d.ts.map +1 -0
  99. package/package.json +3 -3
  100. package/dist/cjs/components/Button/Button.module.css.js +0 -6
  101. package/dist/cjs/components/SkipLink/SkipLink.module.css.js +0 -6
  102. package/dist/cjs/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -6
  103. package/dist/cjs/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dom/dist/floating-ui.utils.dom.js +0 -68
  104. package/dist/esm/components/Button/Button.module.css.js +0 -4
  105. package/dist/esm/components/SkipLink/SkipLink.module.css.js +0 -4
  106. package/dist/esm/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -4
  107. package/dist/esm/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dom/dist/floating-ui.utils.dom.js +0 -57
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { isShadowRoot, isHTMLElement } from '../../node_modules/@floating-ui/utils/dom/dist/floating-ui.utils.dom.js';
2
+ import { isShadowRoot, isHTMLElement } from '../../../../../../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js';
3
3
 
4
4
  function activeElement(doc) {
5
5
  let activeElement = doc.activeElement;
@@ -13,7 +13,7 @@ function contains(parent, child) {
13
13
  if (!parent || !child) {
14
14
  return false;
15
15
  }
16
- const rootNode = child.getRootNode && child.getRootNode();
16
+ const rootNode = child.getRootNode == null ? void 0 : child.getRootNode();
17
17
 
18
18
  // First, attempt with faster native method
19
19
  if (parent.contains(child)) {
@@ -70,9 +70,10 @@ function isVirtualClick(event) {
70
70
  return event.detail === 0 && !event.pointerType;
71
71
  }
72
72
  function isVirtualPointerEvent(event) {
73
- return !isAndroid() && event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'mouse' ||
73
+ if (isJSDOM()) return false;
74
+ return !isAndroid() && event.width === 0 && event.height === 0 || isAndroid() && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'mouse' ||
74
75
  // iOS VoiceOver returns 0.333• for width/height.
75
- event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0;
76
+ event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'touch';
76
77
  }
77
78
  function isSafari() {
78
79
  // Chrome DevTools does not complain about navigator.vendor
@@ -85,6 +86,9 @@ function isAndroid() {
85
86
  function isMac() {
86
87
  return getPlatform().toLowerCase().startsWith('mac') && !navigator.maxTouchPoints;
87
88
  }
89
+ function isJSDOM() {
90
+ return getUserAgent().includes('jsdom/');
91
+ }
88
92
  function isMouseLikePointerType(pointerType, strict) {
89
93
  // On some Linux machines with Chromium, mouse inputs return a `pointerType`
90
94
  // of "pen": https://github.com/floating-ui/floating-ui/issues/2015
@@ -137,4 +141,4 @@ function isTypeableCombobox(element) {
137
141
  return element.getAttribute('role') === 'combobox' && isTypeableElement(element);
138
142
  }
139
143
 
140
- export { TYPEABLE_SELECTOR, activeElement, contains, getDocument, getPlatform, getTarget, getUserAgent, isAndroid, isEventTargetWithin, isMac, isMouseLikePointerType, isReactEvent, isRootElement, isSafari, isTypeableCombobox, isTypeableElement, isVirtualClick, isVirtualPointerEvent, stopEvent };
144
+ export { TYPEABLE_SELECTOR, activeElement, contains, getDocument, getPlatform, getTarget, getUserAgent, isAndroid, isEventTargetWithin, isJSDOM, isMac, isMouseLikePointerType, isReactEvent, isRootElement, isSafari, isTypeableCombobox, isTypeableElement, isVirtualClick, isVirtualPointerEvent, stopEvent };
@@ -1,11 +1,9 @@
1
1
  'use client';
2
- import { computePosition } from '../../dom/dist/floating-ui.dom.js';
3
- export { autoUpdate, platform } from '../../dom/dist/floating-ui.dom.js';
2
+ import { arrow as arrow$1, computePosition } from '../../dom/dist/floating-ui.dom.js';
3
+ export { autoUpdate, flip, platform, shift, size } from '../../dom/dist/floating-ui.dom.js';
4
4
  import * as React from 'react';
5
5
  import { useLayoutEffect, useEffect } from 'react';
6
6
  import * as ReactDOM from 'react-dom';
7
- import { arrow as arrow$1 } from '../../core/dist/floating-ui.core.js';
8
- export { detectOverflow, flip, offset, shift, size } from '../../core/dist/floating-ui.core.js';
9
7
 
10
8
  /**
11
9
  * Provides data to position an inner element of the floating element so that it
@@ -33,7 +31,8 @@ const arrow = options => {
33
31
  }).fn(state);
34
32
  }
35
33
  return {};
36
- } else if (element) {
34
+ }
35
+ if (element) {
37
36
  return arrow$1({
38
37
  element,
39
38
  padding
@@ -58,11 +57,13 @@ function deepEqual(a, b) {
58
57
  if (typeof a === 'function' && a.toString() === b.toString()) {
59
58
  return true;
60
59
  }
61
- let length, i, keys;
62
- if (a && b && typeof a == 'object') {
60
+ let length;
61
+ let i;
62
+ let keys;
63
+ if (a && b && typeof a === 'object') {
63
64
  if (Array.isArray(a)) {
64
65
  length = a.length;
65
- if (length != b.length) return false;
66
+ if (length !== b.length) return false;
66
67
  for (i = length; i-- !== 0;) {
67
68
  if (!deepEqual(a[i], b[i])) {
68
69
  return false;
@@ -91,6 +92,8 @@ function deepEqual(a, b) {
91
92
  }
92
93
  return true;
93
94
  }
95
+
96
+ // biome-ignore lint/suspicious/noSelfCompare: in source
94
97
  return a !== a && b !== b;
95
98
  }
96
99
 
@@ -151,22 +154,23 @@ function useFloating(options) {
151
154
  const [_reference, _setReference] = React.useState(null);
152
155
  const [_floating, _setFloating] = React.useState(null);
153
156
  const setReference = React.useCallback(node => {
154
- if (node != referenceRef.current) {
157
+ if (node !== referenceRef.current) {
155
158
  referenceRef.current = node;
156
159
  _setReference(node);
157
160
  }
158
- }, [_setReference]);
161
+ }, []);
159
162
  const setFloating = React.useCallback(node => {
160
163
  if (node !== floatingRef.current) {
161
164
  floatingRef.current = node;
162
165
  _setFloating(node);
163
166
  }
164
- }, [_setFloating]);
167
+ }, []);
165
168
  const referenceEl = externalReference || _reference;
166
169
  const floatingEl = externalFloating || _floating;
167
170
  const referenceRef = React.useRef(null);
168
171
  const floatingRef = React.useRef(null);
169
172
  const dataRef = React.useRef(data);
173
+ const hasWhileElementsMounted = whileElementsMounted != null;
170
174
  const whileElementsMountedRef = useLatestRef(whileElementsMounted);
171
175
  const platformRef = useLatestRef(platform);
172
176
  const update = React.useCallback(() => {
@@ -210,17 +214,18 @@ function useFloating(options) {
210
214
  isMountedRef.current = false;
211
215
  };
212
216
  }, []);
217
+
218
+ // biome-ignore lint/correctness/useExhaustiveDependencies: `hasWhileElementsMounted` is intentionally included.
213
219
  index(() => {
214
220
  if (referenceEl) referenceRef.current = referenceEl;
215
221
  if (floatingEl) floatingRef.current = floatingEl;
216
222
  if (referenceEl && floatingEl) {
217
223
  if (whileElementsMountedRef.current) {
218
224
  return whileElementsMountedRef.current(referenceEl, floatingEl, update);
219
- } else {
220
- update();
221
225
  }
226
+ update();
222
227
  }
223
- }, [referenceEl, floatingEl, update, whileElementsMountedRef]);
228
+ }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
224
229
  const refs = React.useMemo(() => ({
225
230
  reference: referenceRef,
226
231
  floating: floatingRef,
@@ -1,8 +1,6 @@
1
1
  'use client';
2
- 'use strict';
3
-
4
2
  /*!
5
- * tabbable 6.1.1
3
+ * tabbable 6.2.0
6
4
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
7
5
  */
8
6
  // NOTE: separate `:not()` selectors has broader browser support than the newer
@@ -182,7 +180,27 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
182
180
  }
183
181
  return candidates;
184
182
  };
185
- var getTabindex = function getTabindex(node, isScope) {
183
+
184
+ /**
185
+ * @private
186
+ * Determines if the node has an explicitly specified `tabindex` attribute.
187
+ * @param {HTMLElement} node
188
+ * @returns {boolean} True if so; false if not.
189
+ */
190
+ var hasTabIndex = function hasTabIndex(node) {
191
+ return !isNaN(parseInt(node.getAttribute('tabindex'), 10));
192
+ };
193
+
194
+ /**
195
+ * Determine the tab index of a given node.
196
+ * @param {HTMLElement} node
197
+ * @returns {number} Tab order (negative, 0, or positive number).
198
+ * @throws {Error} If `node` is falsy.
199
+ */
200
+ var getTabIndex = function getTabIndex(node) {
201
+ if (!node) {
202
+ throw new Error('No node provided');
203
+ }
186
204
  if (node.tabIndex < 0) {
187
205
  // in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default
188
206
  // `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,
@@ -191,16 +209,28 @@ var getTabindex = function getTabindex(node, isScope) {
191
209
  // order, consider their tab index to be 0.
192
210
  // Also browsers do not return `tabIndex` correctly for contentEditable nodes;
193
211
  // so if they don't have a tabindex attribute specifically set, assume it's 0.
194
- //
195
- // isScope is positive for custom element with shadow root or slot that by default
196
- // have tabIndex -1, but need to be sorted by document order in order for their
197
- // content to be inserted in the correct position
198
- if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
212
+ if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) {
199
213
  return 0;
200
214
  }
201
215
  }
202
216
  return node.tabIndex;
203
217
  };
218
+
219
+ /**
220
+ * Determine the tab index of a given node __for sort order purposes__.
221
+ * @param {HTMLElement} node
222
+ * @param {boolean} [isScope] True for a custom element with shadow root or slot that, by default,
223
+ * has tabIndex -1, but needs to be sorted by document order in order for its content to be
224
+ * inserted into the correct sort position.
225
+ * @returns {number} Tab order (negative, 0, or positive number).
226
+ */
227
+ var getSortOrderTabIndex = function getSortOrderTabIndex(node, isScope) {
228
+ var tabIndex = getTabIndex(node);
229
+ if (tabIndex < 0 && isScope && !hasTabIndex(node)) {
230
+ return 0;
231
+ }
232
+ return tabIndex;
233
+ };
204
234
  var sortOrderedTabbables = function sortOrderedTabbables(a, b) {
205
235
  return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
206
236
  };
@@ -443,7 +473,7 @@ var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(o
443
473
  return true;
444
474
  };
445
475
  var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) {
446
- if (isNonTabbableRadio(node) || getTabindex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
476
+ if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
447
477
  return false;
448
478
  }
449
479
  return true;
@@ -468,7 +498,7 @@ var sortByOrder = function sortByOrder(candidates) {
468
498
  candidates.forEach(function (item, i) {
469
499
  var isScope = !!item.scopeParent;
470
500
  var element = isScope ? item.scopeParent : item;
471
- var candidateTabindex = getTabindex(element, isScope);
501
+ var candidateTabindex = getSortOrderTabIndex(element, isScope);
472
502
  var elements = isScope ? sortByOrder(item.candidates) : element;
473
503
  if (candidateTabindex === 0) {
474
504
  isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
@@ -487,20 +517,30 @@ var sortByOrder = function sortByOrder(candidates) {
487
517
  return acc;
488
518
  }, []).concat(regularTabbables);
489
519
  };
490
- var tabbable = function tabbable(el, options) {
520
+ var tabbable = function tabbable(container, options) {
491
521
  options = options || {};
492
522
  var candidates;
493
523
  if (options.getShadowRoot) {
494
- candidates = getCandidatesIteratively([el], options.includeContainer, {
524
+ candidates = getCandidatesIteratively([container], options.includeContainer, {
495
525
  filter: isNodeMatchingSelectorTabbable.bind(null, options),
496
526
  flatten: false,
497
527
  getShadowRoot: options.getShadowRoot,
498
528
  shadowRootFilter: isValidShadowRootTabbable
499
529
  });
500
530
  } else {
501
- candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
531
+ candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
502
532
  }
503
533
  return sortByOrder(candidates);
504
534
  };
535
+ var isTabbable = function isTabbable(node, options) {
536
+ options = options || {};
537
+ if (!node) {
538
+ throw new Error('No node provided');
539
+ }
540
+ if (matches.call(node, candidateSelector) === false) {
541
+ return false;
542
+ }
543
+ return isNodeMatchingSelectorTabbable(options, node);
544
+ };
505
545
 
506
- exports.tabbable = tabbable;
546
+ export { getTabIndex, isTabbable, tabbable };
@@ -1,297 +1,3 @@
1
- @layer fds.button {
2
- .fds-button-button-8fa00f0f {
3
- --fc-button-padding: 0 var(--fds-spacing-4);
4
- --fc-button-color: var(--fds-semantic-text-action-first-on_action);
5
-
6
- display: flex;
7
- align-items: center;
8
- border: var(--fds-border_width-default) solid transparent;
9
- color: var(--fc-button-color);
10
- fill: var(--fc-button-color);
11
- min-width: 2.5em;
12
- padding: var(--fc-button-padding);
13
- box-sizing: border-box;
14
- cursor: pointer;
15
- font-family: inherit;
16
- justify-content: center;
17
- text-align: center;
18
- text-decoration: none;
19
- position: relative;
20
- border-radius: var(--fds-border_radius-interactive);
21
- min-height: var(--fds-sizing-10);
22
- }
23
-
24
- .fds-button-button-8fa00f0f svg {
25
- overflow: visible;
26
- }
27
-
28
- .fds-button-small-8fa00f0f::before {
29
- position: absolute;
30
- top: 0;
31
- left: 0;
32
- width: auto;
33
- min-height: auto;
34
- content: '';
35
- }
36
-
37
- .fds-button-small-8fa00f0f::after {
38
- position: absolute;
39
- top: -5px;
40
- left: 0;
41
- width: 100%;
42
- height: 44px;
43
- content: '';
44
- }
45
-
46
- .fds-button-button-8fa00f0f:disabled,
47
- .fds-button-button-8fa00f0f[aria-disabled='true'] {
48
- cursor: not-allowed;
49
- opacity: var(--fds-opacity-disabled);
50
- }
51
-
52
- .fds-button-small-8fa00f0f {
53
- --fc-button-padding: 0 var(--fds-spacing-3);
54
-
55
- gap: var(--fds-sizing-1);
56
- font: var(--fds-typography-paragraph-short-small);
57
- font-family: inherit;
58
- min-height: var(--fds-sizing-10);
59
- }
60
-
61
- .fds-button-medium-8fa00f0f {
62
- --fc-button-padding: 0 var(--fds-spacing-4);
63
-
64
- gap: var(--fds-sizing-2);
65
- font: var(--fds-typography-paragraph-short-medium);
66
- font-family: inherit;
67
- min-height: var(--fds-sizing-12);
68
- }
69
-
70
- .fds-button-large-8fa00f0f {
71
- --fc-button-padding: 0 var(--fds-spacing-5);
72
-
73
- gap: var(--fds-sizing-2);
74
- font: var(--fds-typography-paragraph-short-large);
75
- font-family: inherit;
76
- min-height: var(--fds-sizing-14);
77
- }
78
-
79
- .fds-button-fullWidth-8fa00f0f {
80
- width: 100%;
81
- }
82
-
83
- .fds-button-secondary-8fa00f0f,
84
- .fds-button-tertiary-8fa00f0f {
85
- background-color: transparent;
86
- }
87
-
88
- .fds-button-onlyIcon-8fa00f0f {
89
- --fc-button-padding: 0;
90
- }
91
-
92
- /* Only use hover for non-touch devices to prevent sticky-hovering */
93
- @media (hover: hover) and (pointer: fine) {
94
- .fds-button-primary-8fa00f0f:where(.fds-button-first-8fa00f0f):not([aria-disabled='true'], :disabled):hover {
95
- background-color: var(--fds-semantic-surface-action-first-hover);
96
- }
97
-
98
- .fds-button-primary-8fa00f0f:where(.fds-button-second-8fa00f0f):not([aria-disabled='true'], :disabled):hover {
99
- background-color: var(--fds-semantic-surface-action-second-hover);
100
- }
101
-
102
- .fds-button-primary-8fa00f0f:where(.fds-button-success-8fa00f0f):not([aria-disabled='true'], :disabled):hover {
103
- background-color: var(--fds-semantic-surface-success-hover);
104
- }
105
-
106
- .fds-button-primary-8fa00f0f:where(.fds-button-danger-8fa00f0f):not([aria-disabled='true'], :disabled):hover {
107
- background-color: var(--fds-semantic-surface-danger-hover);
108
- }
109
-
110
- .fds-button-secondary-8fa00f0f:where(.fds-button-first-8fa00f0f):not([aria-disabled='true'], :disabled):hover {
111
- --fc-button-color: var(--fds-semantic-text-action-first-hover);
112
-
113
- border-color: var(--fds-semantic-border-action-first-hover);
114
- background-color: var(--fds-semantic-surface-action-first-no_fill-hover);
115
- }
116
-
117
- .fds-button-secondary-8fa00f0f:where(.fds-button-second-8fa00f0f):not([aria-disabled='true'], :disabled):hover {
118
- --fc-button-color: var(--fds-semantic-text-action-second-hover);
119
-
120
- border-color: var(--fds-semantic-border-action-second-hover);
121
- background-color: var(--fds-semantic-surface-action-second-no_fill-hover);
122
- }
123
-
124
- .fds-button-secondary-8fa00f0f:where(.fds-button-success-8fa00f0f):not([aria-disabled='true'], :disabled):hover {
125
- --fc-button-color: var(--fds-semantic-text-success-hover);
126
-
127
- border-color: var(--fds-semantic-border-success-hover);
128
- background-color: var(--fds-semantic-surface-success-no_fill-hover);
129
- }
130
-
131
- .fds-button-secondary-8fa00f0f:where(.fds-button-danger-8fa00f0f):not([aria-disabled='true'], :disabled):hover {
132
- --fc-button-color: var(--fds-semantic-text-danger-hover);
133
-
134
- border-color: var(--fds-semantic-border-danger-hover);
135
- background-color: var(--fds-semantic-surface-danger-no_fill-hover);
136
- }
137
-
138
- .fds-button-tertiary-8fa00f0f:where(.fds-button-first-8fa00f0f):not([aria-disabled='true'], :disabled):hover {
139
- --fc-button-color: var(--fds-semantic-text-action-first-hover);
140
-
141
- background-color: var(--fds-semantic-surface-action-first-no_fill-hover);
142
- }
143
-
144
- .fds-button-tertiary-8fa00f0f:where(.fds-button-second-8fa00f0f):not([aria-disabled='true'], :disabled):hover {
145
- --fc-button-color: var(--fds-semantic-text-action-second-hover);
146
-
147
- background-color: var(--fds-semantic-surface-action-second-no_fill-hover);
148
- }
149
-
150
- .fds-button-tertiary-8fa00f0f:where(.fds-button-success-8fa00f0f):not([aria-disabled='true'], :disabled):hover {
151
- --fc-button-color: var(--fds-semantic-text-success-hover);
152
-
153
- background-color: var(--fds-semantic-surface-success-no_fill-hover);
154
- }
155
-
156
- .fds-button-tertiary-8fa00f0f:where(.fds-button-danger-8fa00f0f):not([aria-disabled='true'], :disabled):hover {
157
- --fc-button-color: var(--fds-semantic-text-danger-hover);
158
-
159
- background-color: var(--fds-semantic-surface-danger-no_fill-hover);
160
- }
161
- }
162
-
163
- /* Primary button colors */
164
- .fds-button-primary-8fa00f0f:where(.fds-button-first-8fa00f0f) {
165
- background-color: var(--fds-semantic-surface-action-first-default);
166
- }
167
-
168
- .fds-button-primary-8fa00f0f:where(.fds-button-second-8fa00f0f) {
169
- background-color: var(--fds-semantic-surface-action-second-default);
170
- }
171
-
172
- .fds-button-primary-8fa00f0f:where(.fds-button-success-8fa00f0f) {
173
- background-color: var(--fds-semantic-surface-success-default);
174
- }
175
-
176
- .fds-button-primary-8fa00f0f:where(.fds-button-danger-8fa00f0f) {
177
- background-color: var(--fds-semantic-surface-danger-default);
178
- }
179
-
180
- .fds-button-primary-8fa00f0f:where(.fds-button-first-8fa00f0f):not([aria-disabled='true'], :disabled):active {
181
- background-color: var(--fds-semantic-surface-action-first-active);
182
- }
183
-
184
- .fds-button-primary-8fa00f0f:where(.fds-button-second-8fa00f0f):not([aria-disabled='true'], :disabled):active {
185
- background-color: var(--fds-semantic-surface-action-second-active);
186
- }
187
-
188
- .fds-button-primary-8fa00f0f:where(.fds-button-success-8fa00f0f):not([aria-disabled='true'], :disabled):active {
189
- background-color: var(--fds-semantic-surface-success-active);
190
- }
191
-
192
- .fds-button-primary-8fa00f0f:where(.fds-button-danger-8fa00f0f):not([aria-disabled='true'], :disabled):active {
193
- background-color: var(--fds-semantic-surface-danger-active);
194
- }
195
-
196
- /* Secondary button colors */
197
- .fds-button-secondary-8fa00f0f:where(.fds-button-first-8fa00f0f) {
198
- --fc-button-color: var(--fds-semantic-text-action-first-default);
199
-
200
- border-color: var(--fds-semantic-border-action-first-default);
201
- background-color: var(--fds-semantic-surface-action-first-no_fill);
202
- }
203
-
204
- .fds-button-secondary-8fa00f0f:where(.fds-button-second-8fa00f0f) {
205
- --fc-button-color: var(--fds-semantic-text-action-second-default);
206
-
207
- border-color: var(--fds-semantic-border-action-second-default);
208
- background-color: var(--fds-semantic-surface-action-second-no_fill);
209
- }
210
-
211
- .fds-button-secondary-8fa00f0f:where(.fds-button-success-8fa00f0f) {
212
- --fc-button-color: var(--fds-semantic-text-success-default);
213
-
214
- border-color: var(--fds-semantic-border-success-default);
215
- background-color: var(--fds-semantic-surface-success-no_fill);
216
- }
217
-
218
- .fds-button-secondary-8fa00f0f:where(.fds-button-danger-8fa00f0f) {
219
- --fc-button-color: var(--fds-semantic-text-danger-default);
220
-
221
- border-color: var(--fds-semantic-border-danger-default);
222
- background-color: var(--fds-semantic-surface-danger-no_fill);
223
- }
224
-
225
- .fds-button-secondary-8fa00f0f:where(.fds-button-first-8fa00f0f):not([aria-disabled='true'], :disabled):active {
226
- --fc-button-color: var(--fds-semantic-text-action-first-active);
227
-
228
- border-color: var(--fds-semantic-border-action-first-active);
229
- background-color: var(--fds-semantic-surface-action-first-no_fill-active);
230
- }
231
-
232
- .fds-button-secondary-8fa00f0f:where(.fds-button-second-8fa00f0f):not([aria-disabled='true'], :disabled):active {
233
- --fc-button-color: var(--fds-semantic-text-action-second-active);
234
-
235
- border-color: var(--fds-semantic-border-action-second-active);
236
- background-color: var(--fds-semantic-surface-action-second-no_fill-active);
237
- }
238
-
239
- .fds-button-secondary-8fa00f0f:where(.fds-button-success-8fa00f0f):not([aria-disabled='true'], :disabled):active {
240
- --fc-button-color: var(--fds-semantic-text-success-active);
241
-
242
- border-color: var(--fds-semantic-border-success-active);
243
- background-color: var(--fds-semantic-surface-success-no_fill-active);
244
- }
245
-
246
- .fds-button-secondary-8fa00f0f:where(.fds-button-danger-8fa00f0f):not([aria-disabled='true'], :disabled):active {
247
- --fc-button-color: var(--fds-semantic-text-danger-active);
248
-
249
- border-color: var(--fds-semantic-border-danger-active);
250
- background-color: var(--fds-semantic-surface-danger-no_fill-active);
251
- }
252
-
253
- /* Tertiary button colors */
254
- .fds-button-tertiary-8fa00f0f:where(.fds-button-first-8fa00f0f) {
255
- --fc-button-color: var(--fds-semantic-text-action-first-default);
256
- }
257
-
258
- .fds-button-tertiary-8fa00f0f:where(.fds-button-second-8fa00f0f) {
259
- --fc-button-color: var(--fds-semantic-text-action-second-default);
260
- }
261
-
262
- .fds-button-tertiary-8fa00f0f:where(.fds-button-success-8fa00f0f) {
263
- --fc-button-color: var(--fds-semantic-text-success-default);
264
- }
265
-
266
- .fds-button-tertiary-8fa00f0f:where(.fds-button-danger-8fa00f0f) {
267
- --fc-button-color: var(--fds-semantic-text-danger-default);
268
- }
269
-
270
- .fds-button-tertiary-8fa00f0f:where(.fds-button-first-8fa00f0f):not([aria-disabled='true'], :disabled):active {
271
- --fc-button-color: var(--fds-semantic-text-action-first-active);
272
-
273
- background-color: var(--fds-semantic-surface-action-first-no_fill-active);
274
- }
275
-
276
- .fds-button-tertiary-8fa00f0f:where(.fds-button-second-8fa00f0f):not([aria-disabled='true'], :disabled):active {
277
- --fc-button-color: var(--fds-semantic-text-action-second-active);
278
-
279
- background-color: var(--fds-semantic-surface-action-second-no_fill-active);
280
- }
281
-
282
- .fds-button-tertiary-8fa00f0f:where(.fds-button-success-8fa00f0f):not([aria-disabled='true'], :disabled):active {
283
- --fc-button-color: var(--fds-semantic-text-success-active);
284
-
285
- background-color: var(--fds-semantic-surface-success-no_fill-active);
286
- }
287
-
288
- .fds-button-tertiary-8fa00f0f:where(.fds-button-danger-8fa00f0f):not([aria-disabled='true'], :disabled):active {
289
- --fc-button-color: var(--fds-semantic-text-danger-active);
290
-
291
- background-color: var(--fds-semantic-surface-danger-no_fill-active);
292
- }
293
- }
294
-
295
1
  @layer fds.paragraph {
296
2
  .fds-paragraph-paragraph-b69df5f3 {
297
3
  --fdsc-bottom-spacing: var(--fds-spacing-5);
@@ -1360,27 +1066,6 @@
1360
1066
  }
1361
1067
  }
1362
1068
 
1363
- @layer fds.skiplink {
1364
- .fds-skiplink-skiplink-d4abeaef:focus {
1365
- display: block;
1366
- outline: 0;
1367
- position: static;
1368
- width: auto;
1369
- height: auto;
1370
- margin: inherit;
1371
- overflow: visible;
1372
- clip: auto;
1373
- clip-path: none;
1374
- white-space: inherit;
1375
- text-decoration: underline;
1376
- text-decoration-thickness: 3px;
1377
- text-underline-offset: 0.3em;
1378
- padding: var(--fds-spacing-3) var(--fds-spacing-4) var(--fds-spacing-3) var(--fds-spacing-6);
1379
- color: var(--fds-semantic-text-neutral-default);
1380
- background: var(--fds-semantic-border-focus-outline);
1381
- }
1382
- }
1383
-
1384
1069
  @layer fds.tooltip {
1385
1070
  .fds-tooltip-wrapper-a3778147 {
1386
1071
  background: var(--fds-semantic-surface-neutral-inverted);
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { forwardRef } from 'react';
4
- import { useMergeRefs } from '../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
4
+ import { useMergeRefs } from '../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js';
5
5
  import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
6
6
  import { useRovingTabindex } from './useRovingTabindex.js';
7
7
 
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { createContext, forwardRef, useState, useRef } from 'react';
4
- import { useMergeRefs } from '../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
4
+ import { useMergeRefs } from '../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js';
5
5
  import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
6
6
 
7
7
  const RovingTabindexContext = createContext({
@@ -10,6 +10,12 @@ export type AlertProps = {
10
10
  * Use this to inform screenreaders of severity.
11
11
  * Defaults to Norwegian. */
12
12
  iconTitle?: string;
13
+ /** Sets the size of the alert.
14
+ * Does not affect font size.
15
+ *
16
+ * @default 'medium'
17
+ */
18
+ size?: 'small' | 'medium' | 'large';
13
19
  } & HTMLAttributes<HTMLDivElement>;
14
20
  export declare const Alert: import("react").ForwardRefExoticComponent<{
15
21
  /** Sets color & icon according to severity */
@@ -21,6 +27,12 @@ export declare const Alert: import("react").ForwardRefExoticComponent<{
21
27
  * Use this to inform screenreaders of severity.
22
28
  * Defaults to Norwegian. */
23
29
  iconTitle?: string | undefined;
30
+ /** Sets the size of the alert.
31
+ * Does not affect font size.
32
+ *
33
+ * @default 'medium'
34
+ */
35
+ size?: "small" | "medium" | "large" | undefined;
24
36
  } & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
25
37
  export {};
26
38
  //# sourceMappingURL=Alert.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../../src/components/Alert/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AA4B5C,KAAK,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE1D,MAAM,MAAM,UAAU,GAAG;IACvB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;iCAG6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEnC,eAAO,MAAM,KAAK;IAXhB,8CAA8C;;IAE9C,6CAA6C;;IAE7C;;;iCAG6B;;mFAqC9B,CAAC"}
1
+ {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../../src/components/Alert/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AA4B5C,KAAK,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE1D,MAAM,MAAM,UAAU,GAAG;IACvB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;iCAG6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;CACrC,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AACnC,eAAO,MAAM,KAAK;IAhBhB,8CAA8C;;IAE9C,6CAA6C;;IAE7C;;;iCAG6B;;IAE7B;;;;OAIG;;mFA8CJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAIlD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAI7E,MAAM,MAAM,WAAW,GAAG;IACxB,mCAAmC;IACnC,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;IAC/C,yCAAyC;IACzC,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;IAClD,WAAW;IACX,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,0DAA0D;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,oBAAoB,CAAC,WAAW,EAAE,iBAAiB,CAwCrE,CAAC"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAIlD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAE7E,MAAM,MAAM,WAAW,GAAG;IACxB,mCAAmC;IACnC,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;IAC/C,yCAAyC;IACzC,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;IAClD,WAAW;IACX,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,0DAA0D;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,oBAAoB,CAAC,WAAW,EAAE,iBAAiB,CAwCrE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SkipLink.d.ts","sourceRoot":"","sources":["../../../../src/components/SkipLink/SkipLink.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAK7D,MAAM,MAAM,aAAa,GAAG;IAC1B,kDAAkD;IAClD,QAAQ,EAAE,SAAS,CAAC;IAEpB,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAE5C,eAAO,MAAM,QAAQ;6CAKlB,aAAa,GAAG,WAAW;;CAU7B,CAAC"}
1
+ {"version":3,"file":"SkipLink.d.ts","sourceRoot":"","sources":["../../../../src/components/SkipLink/SkipLink.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG7D,MAAM,MAAM,aAAa,GAAG;IAC1B,kDAAkD;IAClD,QAAQ,EAAE,SAAS,CAAC;IAEpB,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAE5C,eAAO,MAAM,QAAQ;6CAKlB,aAAa,GAAG,WAAW;;CAU7B,CAAC"}