@digdir/designsystemet-react 1.8.0 → 1.10.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 (48) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/components/Combobox/Combobox.js +3 -1
  3. package/dist/cjs/components/Combobox/Option/useComboboxOption.js +3 -1
  4. package/dist/cjs/components/Combobox/useComboboxKeyboard.js +4 -1
  5. package/dist/cjs/components/details/details.js +1 -1
  6. package/dist/cjs/components/dialog/dialog.js +3 -3
  7. package/dist/cjs/components/field/field-counter.js +3 -1
  8. package/dist/cjs/components/field/field.js +1 -1
  9. package/dist/cjs/components/popover/popover.js +2 -2
  10. package/dist/cjs/components/skeleton/skeleton.js +3 -1
  11. package/dist/cjs/components/spinner/spinner.js +3 -1
  12. package/dist/cjs/components/suggestion/suggestion-clear.js +1 -1
  13. package/dist/cjs/components/suggestion/suggestion-list.js +17 -4
  14. package/dist/cjs/components/suggestion/suggestion.js +1 -1
  15. package/dist/cjs/components/tabs/tabs-list.js +1 -1
  16. package/dist/cjs/components/tabs/tabs-panel.js +1 -1
  17. package/dist/cjs/index.js +87 -86
  18. package/dist/cjs/utilities/roving-focus/roving-focus-item.js +1 -1
  19. package/dist/esm/components/Combobox/Combobox.js +4 -2
  20. package/dist/esm/components/Combobox/ComboboxIdContext.js +1 -1
  21. package/dist/esm/components/Combobox/Option/useComboboxOption.js +3 -1
  22. package/dist/esm/components/Combobox/useComboboxKeyboard.js +4 -1
  23. package/dist/esm/components/chip/index.js +1 -1
  24. package/dist/esm/components/details/details.js +1 -1
  25. package/dist/esm/components/dialog/dialog.js +3 -3
  26. package/dist/esm/components/error-summary/error-summary.js +1 -1
  27. package/dist/esm/components/field/field-counter.js +3 -1
  28. package/dist/esm/components/field/field.js +1 -1
  29. package/dist/esm/components/list/index.js +1 -1
  30. package/dist/esm/components/popover/popover.js +2 -2
  31. package/dist/esm/components/skeleton/skeleton.js +3 -1
  32. package/dist/esm/components/spinner/spinner.js +3 -1
  33. package/dist/esm/components/suggestion/suggestion-clear.js +1 -1
  34. package/dist/esm/components/suggestion/suggestion-list.js +18 -5
  35. package/dist/esm/components/suggestion/suggestion.js +2 -2
  36. package/dist/esm/components/tabs/tabs-list.js +1 -1
  37. package/dist/esm/components/tabs/tabs-panel.js +1 -1
  38. package/dist/esm/components/tabs/tabs.js +1 -1
  39. package/dist/esm/components/toggle-group/toggle-group.js +1 -1
  40. package/dist/esm/index.js +44 -43
  41. package/dist/esm/utilities/roving-focus/roving-focus-item.js +1 -1
  42. package/dist/esm/utilities/roving-focus/roving-focus-root.js +1 -1
  43. package/dist/types/components/dialog/dialog.d.ts +13 -1
  44. package/dist/types/components/dialog/dialog.d.ts.map +1 -1
  45. package/dist/types/components/suggestion/suggestion-clear.d.ts.map +1 -1
  46. package/dist/types/components/suggestion/suggestion-list.d.ts +11 -1
  47. package/dist/types/components/suggestion/suggestion-list.d.ts.map +1 -1
  48. package/package.json +15 -18
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { ChipRemovable, ChipRadio, ChipCheckbox, ChipButton } from './chips.js';
2
+ import { ChipButton, ChipCheckbox, ChipRadio, ChipRemovable } from './chips.js';
3
3
 
4
4
  const ChipComponent = {
5
5
  Button: ChipButton,
@@ -2,8 +2,8 @@
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import cl from 'clsx/lite';
4
4
  import { forwardRef, useRef, useEffect } from 'react';
5
- import '@u-elements/u-details';
6
5
  import { useMergeRefs } from '../../utilities/hooks/use-merge-refs/use-merge-refs.js';
6
+ import '@u-elements/u-details';
7
7
 
8
8
  /**
9
9
  * Details component, contains `Details.Summary` and `Details.Content` components.
@@ -3,9 +3,9 @@ import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { Slot } from '@radix-ui/react-slot';
4
4
  import cl from 'clsx/lite';
5
5
  import { forwardRef, useContext, useRef, useEffect } from 'react';
6
+ import { useMergeRefs } from '../../utilities/hooks/use-merge-refs/use-merge-refs.js';
6
7
  import { Button } from '../button/button.js';
7
8
  import { Context } from './dialog-trigger-context.js';
8
- import { useMergeRefs } from '../../utilities/hooks/use-merge-refs/use-merge-refs.js';
9
9
 
10
10
  /**
11
11
  * Dialog component, used to display a dialog dialog.
@@ -30,7 +30,7 @@ import { useMergeRefs } from '../../utilities/hooks/use-merge-refs/use-merge-ref
30
30
  * Content
31
31
  * </Dialog>
32
32
  */
33
- const Dialog = forwardRef(function Dialog({ asChild, children, className, closeButton = 'Lukk dialogvindu', closedby = 'closerequest', modal = true, onClose, open, ...rest }, ref) {
33
+ const Dialog = forwardRef(function Dialog({ asChild, children, className, placement = 'center', closeButton = 'Lukk dialogvindu', closedby = 'closerequest', modal = true, onClose, open, ...rest }, ref) {
34
34
  const contextRef = useContext(Context);
35
35
  const dialogRef = useRef(null); // This local ref is used to make sure the dialog works without a DialogTriggerContext
36
36
  const Component = asChild ? Slot : 'dialog';
@@ -87,7 +87,7 @@ const Dialog = forwardRef(function Dialog({ asChild, children, className, closeB
87
87
  currentRef?.addEventListener('close', handleClose);
88
88
  return () => currentRef?.removeEventListener('close', handleClose);
89
89
  }, [onClose]);
90
- return (jsxs(Component, { className: cl('ds-dialog', className), ref: mergedRefs, "data-modal": modal, closedby: closedby, ...rest, children: [closeButton !== false && (jsx(Button, { "aria-label": closeButton, "data-color": 'neutral', icon: true, variant: 'tertiary', "data-command": 'close' })), children] }));
90
+ return (jsxs(Component, { className: cl('ds-dialog', className), ref: mergedRefs, "data-placement": placement, "data-modal": modal, closedby: closedby, ...rest, children: [closeButton !== false && (jsx(Button, { "aria-label": closeButton, "data-color": 'neutral', icon: true, variant: 'tertiary', "data-command": 'close' })), children] }));
91
91
  });
92
92
 
93
93
  export { Dialog };
@@ -2,7 +2,7 @@
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { Slot } from '@radix-ui/react-slot';
4
4
  import cl from 'clsx/lite';
5
- import { forwardRef, createContext, useId, useState } from 'react';
5
+ import { createContext, forwardRef, useId, useState } from 'react';
6
6
 
7
7
  const ErrorSummaryContext = createContext({
8
8
  headingId: 'heading',
@@ -1,10 +1,12 @@
1
1
  'use client';
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import { forwardRef, useState, useRef, useEffect } from 'react';
4
+ import { useDebounceCallback } from '../../utilities/hooks/deprecated/use-debounce-callback/use-debounce-callback.js';
5
+ import '../../utilities/roving-focus/roving-focus-item.js';
6
+ import '../../utilities/roving-focus/roving-focus-root.js';
4
7
  import { Paragraph } from '../paragraph/paragraph.js';
5
8
  import { ValidationMessage } from '../validation-message/validation-message.js';
6
9
  import { isInputLike } from './field-observer.js';
7
- import { useDebounceCallback } from '../../utilities/hooks/deprecated/use-debounce-callback/use-debounce-callback.js';
8
10
 
9
11
  const label = (text, count) => text.replace('%d', Math.abs(count).toString());
10
12
  /**
@@ -3,8 +3,8 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { Slot } from '@radix-ui/react-slot';
4
4
  import cl from 'clsx/lite';
5
5
  import { forwardRef, useRef, useEffect } from 'react';
6
- import { fieldObserver } from './field-observer.js';
7
6
  import { useMergeRefs } from '../../utilities/hooks/use-merge-refs/use-merge-refs.js';
7
+ import { fieldObserver } from './field-observer.js';
8
8
 
9
9
  /**
10
10
  * Field component, used to wrap a form field.
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { ListItem } from './list-item.js';
3
- import { ListUnordered, ListOrdered } from './lists.js';
3
+ import { ListOrdered, ListUnordered } from './lists.js';
4
4
 
5
5
  const ListComponent = {
6
6
  Item: ListItem,
@@ -4,8 +4,8 @@ import { autoUpdate, computePosition, offset, flip, shift } from '@floating-ui/d
4
4
  import { Slot } from '@radix-ui/react-slot';
5
5
  import cl from 'clsx/lite';
6
6
  import { forwardRef, useRef, useContext, useState, useEffect } from 'react';
7
- import { Context } from './popover-trigger-context.js';
8
7
  import { useMergeRefs } from '../../utilities/hooks/use-merge-refs/use-merge-refs.js';
8
+ import { Context } from './popover-trigger-context.js';
9
9
 
10
10
  /**
11
11
  * Popover component, used to display content in a popover over an element.
@@ -45,7 +45,7 @@ const Popover = forwardRef(function Popover({ id, className, onClose, onOpen, op
45
45
  setInternalOpen(false);
46
46
  onClose?.();
47
47
  }
48
- else if (isTrigger) {
48
+ else if (!controlledOpen && isTrigger) {
49
49
  setInternalOpen(true);
50
50
  onOpen?.();
51
51
  }
@@ -3,8 +3,10 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { Slot } from '@radix-ui/react-slot';
4
4
  import cl from 'clsx/lite';
5
5
  import { forwardRef } from 'react';
6
- import { useSynchronizedAnimation } from '../../utilities/hooks/use-synchronized-animation/use-synchronized-animation.js';
7
6
  import { useMergeRefs } from '../../utilities/hooks/use-merge-refs/use-merge-refs.js';
7
+ import { useSynchronizedAnimation } from '../../utilities/hooks/use-synchronized-animation/use-synchronized-animation.js';
8
+ import '../../utilities/roving-focus/roving-focus-item.js';
9
+ import '../../utilities/roving-focus/roving-focus-root.js';
8
10
 
9
11
  /**
10
12
  * Skeleton is used to represent a draft of page while the content loads.
@@ -2,8 +2,10 @@
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import cl from 'clsx/lite';
4
4
  import { forwardRef } from 'react';
5
- import { useSynchronizedAnimation } from '../../utilities/hooks/use-synchronized-animation/use-synchronized-animation.js';
6
5
  import { useMergeRefs } from '../../utilities/hooks/use-merge-refs/use-merge-refs.js';
6
+ import { useSynchronizedAnimation } from '../../utilities/hooks/use-synchronized-animation/use-synchronized-animation.js';
7
+ import '../../utilities/roving-focus/roving-focus-item.js';
8
+ import '../../utilities/roving-focus/roving-focus-root.js';
7
9
 
8
10
  /**
9
11
  * Spinner component used for indicating busy or indeterminate loading.
@@ -15,7 +15,7 @@ import { Button } from '../button/button.js';
15
15
  * <Suggestion.List />
16
16
  * </Suggestion>
17
17
  */
18
- const SuggestionClear = forwardRef(function SuggestionClear({ 'aria-label': label = 'Tøm', onClick, ...rest }, ref) {
18
+ const SuggestionClear = forwardRef(function SuggestionClear({ 'aria-label': label = 'Tøm', ...rest }, ref) {
19
19
  return (jsx(Button, { "aria-label": label, asChild: true, icon: true, hidden: true, ref: ref, variant: 'tertiary', ...rest, children: jsx("del", {}) }));
20
20
  });
21
21
 
@@ -2,7 +2,7 @@
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { forwardRef, useContext, useEffect } from 'react';
4
4
  import '@u-elements/u-datalist';
5
- import { autoUpdate, computePosition } from '@floating-ui/dom';
5
+ import { autoUpdate, computePosition, flip, shift } from '@floating-ui/dom';
6
6
  import { SuggestionContext } from './suggestion.js';
7
7
 
8
8
  /**
@@ -16,7 +16,7 @@ import { SuggestionContext } from './suggestion.js';
16
16
  * <Suggestion.List />
17
17
  * </Suggestion>
18
18
  */
19
- const SuggestionList = forwardRef(function SuggestionList({ singular = '%d forslag', plural = '%d forslag', className, id, ...rest }, ref) {
19
+ const SuggestionList = forwardRef(function SuggestionList({ singular = '%d forslag', plural = '%d forslag', className, id, autoPlacement = true, ...rest }, ref) {
20
20
  const { handleFilter, uComboboxRef } = useContext(SuggestionContext);
21
21
  useEffect(handleFilter); // Must run on every render
22
22
  // Position with floating-ui
@@ -28,9 +28,22 @@ const SuggestionList = forwardRef(function SuggestionList({ singular = '%d forsl
28
28
  computePosition(trigger, list, {
29
29
  placement: 'bottom',
30
30
  strategy: 'fixed',
31
- middleware: [triggerWidth],
32
- }).then(({ x, y }) => {
33
- list.style.translate = `${Math.round(x)}px calc(${Math.round(y)}px + var(--dsc-suggestion-list-gap))`;
31
+ middleware: [
32
+ ...(autoPlacement
33
+ ? [
34
+ flip({
35
+ fallbackAxisSideDirection: 'start',
36
+ fallbackPlacements: ['top'],
37
+ }),
38
+ shift(),
39
+ ]
40
+ : []),
41
+ undefined,
42
+ triggerWidth,
43
+ ],
44
+ }).then(({ x, y, placement }) => {
45
+ const varOperator = placement.startsWith('top') ? '-' : '+';
46
+ list.style.translate = `${Math.round(x)}px calc(${Math.round(y)}px ${varOperator} var(--dsc-suggestion-list-gap))`;
34
47
  });
35
48
  });
36
49
  }
@@ -1,10 +1,10 @@
1
1
  'use client';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
- import { forwardRef, createContext, useRef, useId, useState, useEffect, useCallback } from 'react';
3
+ import { forwardRef, useRef, useId, useState, useEffect, useCallback, createContext } from 'react';
4
4
  import '@u-elements/u-combobox';
5
5
  import cl from 'clsx/lite';
6
- import { Chip as ChipComponent } from '../chip/index.js';
7
6
  import { useMergeRefs } from '../../utilities/hooks/use-merge-refs/use-merge-refs.js';
7
+ import { Chip as ChipComponent } from '../chip/index.js';
8
8
 
9
9
  const text = (el) => el.textContent?.trim() || '';
10
10
  const sanitizeItems = (values = []) => typeof values === 'string'
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { forwardRef, useContext } from 'react';
4
+ import { useMergeRefs } from '../../utilities/hooks/use-merge-refs/use-merge-refs.js';
4
5
  import { RovingFocusRoot } from '../../utilities/roving-focus/roving-focus-root.js';
5
6
  import { Context } from './tabs.js';
6
- import { useMergeRefs } from '../../utilities/hooks/use-merge-refs/use-merge-refs.js';
7
7
 
8
8
  /**
9
9
  * The container for all `Tab` components.
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { forwardRef, useContext, useId, useState, useRef, useEffect } from 'react';
4
- import { Context } from './tabs.js';
5
4
  import { useMergeRefs } from '../../utilities/hooks/use-merge-refs/use-merge-refs.js';
5
+ import { Context } from './tabs.js';
6
6
 
7
7
  /**
8
8
  * A single content item in a Tabs component.
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import cl from 'clsx/lite';
4
- import { forwardRef, createContext, useRef, useState } from 'react';
4
+ import { createContext, forwardRef, useRef, useState } from 'react';
5
5
 
6
6
  const Context = createContext({});
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import cl from 'clsx/lite';
4
- import { forwardRef, useId, useState, createContext } from 'react';
4
+ import { createContext, forwardRef, useId, useState } from 'react';
5
5
  import { RovingFocusRoot } from '../../utilities/roving-focus/roving-focus-root.js';
6
6
 
7
7
  const ToggleGroupContext = createContext({});
package/dist/esm/index.js CHANGED
@@ -1,106 +1,107 @@
1
1
  'use client';
2
+ export { Alert } from './components/alert/alert.js';
3
+ export { Avatar } from './components/avatar/avatar.js';
4
+ export { Badge } from './components/badge/index.js';
5
+ export { Breadcrumbs } from './components/breadcrumbs/index.js';
6
+ export { Button } from './components/button/button.js';
7
+ export { Combobox } from './components/Combobox/index.js';
8
+ export { Card } from './components/card/index.js';
9
+ export { Checkbox } from './components/checkbox/checkbox.js';
10
+ export { Chip } from './components/chip/index.js';
11
+ export { Details } from './components/details/index.js';
12
+ export { Dialog } from './components/dialog/index.js';
13
+ export { Divider } from './components/divider/divider.js';
14
+ export { Dropdown } from './components/dropdown/index.js';
15
+ export { ErrorSummary } from './components/error-summary/index.js';
16
+ export { Field } from './components/field/index.js';
17
+ export { Fieldset } from './components/fieldset/index.js';
18
+ export { Heading } from './components/heading/heading.js';
19
+ export { Input } from './components/input/input.js';
20
+ export { Label } from './components/label/label.js';
21
+ export { Link } from './components/link/link.js';
22
+ export { List } from './components/list/index.js';
23
+ export { Pagination } from './components/pagination/index.js';
24
+ export { Paragraph } from './components/paragraph/paragraph.js';
25
+ export { Popover } from './components/popover/index.js';
26
+ export { Radio } from './components/radio/radio.js';
27
+ export { Search } from './components/search/index.js';
28
+ export { Select } from './components/select/index.js';
29
+ export { Skeleton } from './components/skeleton/skeleton.js';
30
+ export { SkipLink } from './components/skip-link/skip-link.js';
31
+ export { Spinner } from './components/spinner/spinner.js';
32
+ export { EXPERIMENTAL_Suggestion } from './components/suggestion/index.js';
33
+ export { Switch } from './components/switch/switch.js';
34
+ export { Table } from './components/table/index.js';
35
+ export { Tabs } from './components/tabs/index.js';
36
+ export { Tag } from './components/tag/tag.js';
37
+ export { Textarea } from './components/textarea/textarea.js';
38
+ export { Textfield } from './components/textfield/textfield.js';
39
+ export { ToggleGroup } from './components/toggle-group/index.js';
40
+ export { Tooltip } from './components/tooltip/tooltip.js';
41
+ export { ValidationMessage } from './components/validation-message/validation-message.js';
2
42
  export { omit } from './components/Combobox/omit/omit.js';
3
- export { RovingFocusItem } from './utilities/roving-focus/roving-focus-item.js';
4
- export { RovingFocusRoot } from './utilities/roving-focus/roving-focus-root.js';
5
- export { useCheckboxGroup } from './utilities/hooks/use-checkbox-group/use-checkbox-group.js';
6
43
  export { useDebounceCallback } from './utilities/hooks/deprecated/use-debounce-callback/use-debounce-callback.js';
7
44
  export { useIsomorphicLayoutEffect } from './utilities/hooks/deprecated/use-isomorphic-layout-effect/use-isomorphic-layout-effect.js';
8
45
  export { useMediaQuery } from './utilities/hooks/deprecated/use-media-query/use-media-query.js';
46
+ export { useCheckboxGroup } from './utilities/hooks/use-checkbox-group/use-checkbox-group.js';
47
+ import 'react';
9
48
  export { usePagination } from './utilities/hooks/use-pagination/use-pagination.js';
10
49
  export { useRadioGroup } from './utilities/hooks/use-radio-group/use-radio-group.js';
11
50
  export { useSynchronizedAnimation } from './utilities/hooks/use-synchronized-animation/use-synchronized-animation.js';
12
- export { Alert } from './components/alert/alert.js';
13
- export { Avatar } from './components/avatar/avatar.js';
14
- export { Badge } from './components/badge/index.js';
51
+ export { RovingFocusItem } from './utilities/roving-focus/roving-focus-item.js';
52
+ export { RovingFocusRoot } from './utilities/roving-focus/roving-focus-root.js';
15
53
  export { BadgePosition } from './components/badge/badge-position.js';
16
- export { Breadcrumbs } from './components/breadcrumbs/index.js';
17
54
  export { BreadcrumbsItem } from './components/breadcrumbs/breadcrumbs-item.js';
18
55
  export { BreadcrumbsLink } from './components/breadcrumbs/breadcrumbs-link.js';
19
56
  export { BreadcrumbsList } from './components/breadcrumbs/breadcrumbs-list.js';
20
- export { Button } from './components/button/button.js';
21
- export { Combobox } from './components/Combobox/index.js';
22
57
  export { ComboboxEmpty } from './components/Combobox/Empty.js';
23
58
  export { ComboboxOption } from './components/Combobox/Option/Option.js';
24
- export { Card } from './components/card/index.js';
25
59
  export { CardBlock } from './components/card/card-block.js';
26
- export { Checkbox } from './components/checkbox/checkbox.js';
27
- export { Chip } from './components/chip/index.js';
28
60
  export { ChipButton, ChipCheckbox, ChipRadio, ChipRemovable } from './components/chip/chips.js';
29
- export { Details } from './components/details/index.js';
30
61
  export { DetailsContent } from './components/details/details-content.js';
31
62
  export { DetailsSummary } from './components/details/details-summary.js';
32
- export { Dialog } from './components/dialog/index.js';
33
63
  export { DialogBlock } from './components/dialog/dialog-block.js';
34
64
  export { DialogTrigger } from './components/dialog/dialog-trigger.js';
35
65
  export { DialogTriggerContext } from './components/dialog/dialog-trigger-context.js';
36
- export { Divider } from './components/divider/divider.js';
37
- export { Dropdown } from './components/dropdown/index.js';
38
66
  export { DropdownButton } from './components/dropdown/dropdown-button.js';
39
67
  export { DropdownHeading } from './components/dropdown/dropdown-heading.js';
40
68
  export { DropdownItem } from './components/dropdown/dropdown-item.js';
41
69
  export { DropdownList } from './components/dropdown/dropdown-list.js';
42
70
  export { DropdownTrigger } from './components/dropdown/dropdown-trigger.js';
43
71
  export { DropdownTriggerContext } from './components/dropdown/dropdown-trigger-context.js';
44
- export { ErrorSummary } from './components/error-summary/index.js';
45
72
  export { ErrorSummaryHeading } from './components/error-summary/error-summary-heading.js';
46
73
  export { ErrorSummaryItem } from './components/error-summary/error-summary-item.js';
47
74
  export { ErrorSummaryLink } from './components/error-summary/error-summary-link.js';
48
75
  export { ErrorSummaryList } from './components/error-summary/error-summary-list.js';
49
- export { Field } from './components/field/index.js';
50
76
  export { FieldAffix, FieldAffixes } from './components/field/field-affix.js';
51
77
  export { FieldCounter } from './components/field/field-counter.js';
52
78
  export { FieldDescription } from './components/field/field-description.js';
53
- export { Fieldset } from './components/fieldset/index.js';
54
79
  export { FieldsetDescription } from './components/fieldset/fieldset-description.js';
55
80
  export { FieldsetLegend } from './components/fieldset/fieldset-legend.js';
56
- export { Heading } from './components/heading/heading.js';
57
- export { Input } from './components/input/input.js';
58
- export { Label } from './components/label/label.js';
59
- export { Link } from './components/link/link.js';
60
- export { List } from './components/list/index.js';
61
81
  export { ListItem } from './components/list/list-item.js';
62
82
  export { ListOrdered, ListUnordered } from './components/list/lists.js';
63
- export { Pagination } from './components/pagination/index.js';
64
83
  export { PaginationButton } from './components/pagination/pagination-button.js';
65
84
  export { PaginationItem } from './components/pagination/pagination-item.js';
66
85
  export { PaginationList } from './components/pagination/pagination-list.js';
67
- export { Paragraph } from './components/paragraph/paragraph.js';
68
- export { Popover } from './components/popover/index.js';
69
86
  export { PopoverTrigger } from './components/popover/popover-trigger.js';
70
87
  export { PopoverTriggerContext } from './components/popover/popover-trigger-context.js';
71
- export { Radio } from './components/radio/radio.js';
72
- export { Search } from './components/search/index.js';
73
88
  export { SearchButton } from './components/search/search-button.js';
74
89
  export { SearchClear } from './components/search/search-clear.js';
75
90
  export { SearchInput } from './components/search/search-input.js';
76
- export { Select } from './components/select/index.js';
77
91
  export { SelectOptgroup } from './components/select/select-optgroup.js';
78
92
  export { SelectOption } from './components/select/select-option.js';
79
- export { Skeleton } from './components/skeleton/skeleton.js';
80
- export { SkipLink } from './components/skip-link/skip-link.js';
81
- export { Spinner } from './components/spinner/spinner.js';
82
- export { EXPERIMENTAL_Suggestion } from './components/suggestion/index.js';
83
93
  export { SuggestionClear as EXPERIMENTAL_SuggestionClear } from './components/suggestion/suggestion-clear.js';
84
94
  export { SuggestionEmpty as EXPERIMENTAL_SuggestionEmpty } from './components/suggestion/suggestion-empty.js';
85
95
  export { SuggestionInput as EXPERIMENTAL_SuggestionInput } from './components/suggestion/suggestion-input.js';
86
96
  export { SuggestionList as EXPERIMENTAL_SuggestionList } from './components/suggestion/suggestion-list.js';
87
97
  export { SuggestionOption as EXPERIMENTAL_SuggestionOption } from './components/suggestion/suggestion-option.js';
88
- export { Switch } from './components/switch/switch.js';
89
- export { Table } from './components/table/index.js';
90
98
  export { TableBody } from './components/table/table-body.js';
91
99
  export { TableCell } from './components/table/table-cell.js';
92
100
  export { TableFoot } from './components/table/table-foot.js';
93
101
  export { TableHead } from './components/table/table-head.js';
94
102
  export { TableHeaderCell } from './components/table/table-header-cell.js';
95
103
  export { TableRow } from './components/table/table-row.js';
96
- export { Tabs } from './components/tabs/index.js';
97
104
  export { TabsList } from './components/tabs/tabs-list.js';
98
105
  export { TabsPanel } from './components/tabs/tabs-panel.js';
99
106
  export { TabsTab } from './components/tabs/tabs-tab.js';
100
- export { Tag } from './components/tag/tag.js';
101
- export { Textarea } from './components/textarea/textarea.js';
102
- export { Textfield } from './components/textfield/textfield.js';
103
- export { ToggleGroup } from './components/toggle-group/index.js';
104
107
  export { ToggleGroupItem } from './components/toggle-group/toggle-group-item.js';
105
- export { Tooltip } from './components/tooltip/tooltip.js';
106
- export { ValidationMessage } from './components/validation-message/validation-message.js';
@@ -2,8 +2,8 @@
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { Slot } from '@radix-ui/react-slot';
4
4
  import { forwardRef } from 'react';
5
- import { useRovingFocus } from './use-roving-focus.js';
6
5
  import { useMergeRefs } from '../hooks/use-merge-refs/use-merge-refs.js';
6
+ import { useRovingFocus } from './use-roving-focus.js';
7
7
 
8
8
  /** Get the next focusable RovingFocusItem */
9
9
  function getNextFocusableValue(items, value) {
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { Slot } from '@radix-ui/react-slot';
4
- import { forwardRef, useState, useRef, useEffect, createContext } from 'react';
4
+ import { createContext, forwardRef, useState, useRef, useEffect } from 'react';
5
5
  import { useMergeRefs } from '../hooks/use-merge-refs/use-merge-refs.js';
6
6
 
7
7
  const RovingFocusContext = createContext({
@@ -15,6 +15,12 @@ export type DialogProps = MergeRight<DefaultProps & DialogHTMLAttributes<HTMLDia
15
15
  * @default 'closerequest'
16
16
  */
17
17
  closedby?: 'none' | 'closerequest' | 'any';
18
+ /**
19
+ * When not center, displays dialog as a "drawer" from the specified side.
20
+ *
21
+ * @default 'center'
22
+ */
23
+ placement?: 'center' | 'left' | 'right' | 'top' | 'bottom';
18
24
  /**
19
25
  * Toogle modal and non-modal dialog.
20
26
  *
@@ -62,7 +68,7 @@ export type DialogProps = MergeRight<DefaultProps & DialogHTMLAttributes<HTMLDia
62
68
  * Content
63
69
  * </Dialog>
64
70
  */
65
- export declare const Dialog: import("react").ForwardRefExoticComponent<Omit<DefaultProps & DialogHTMLAttributes<HTMLDialogElement>, "asChild" | "open" | "closedby" | "onClose" | "closeButton" | "modal"> & {
71
+ export declare const Dialog: import("react").ForwardRefExoticComponent<Omit<DefaultProps & DialogHTMLAttributes<HTMLDialogElement>, "asChild" | "open" | "placement" | "closedby" | "onClose" | "closeButton" | "modal"> & {
66
72
  /**
67
73
  * Screen reader label of close button. Set false to hide the close button.
68
74
  * @default 'Lukk dialogvindu'
@@ -76,6 +82,12 @@ export declare const Dialog: import("react").ForwardRefExoticComponent<Omit<Defa
76
82
  * @default 'closerequest'
77
83
  */
78
84
  closedby?: "none" | "closerequest" | "any";
85
+ /**
86
+ * When not center, displays dialog as a "drawer" from the specified side.
87
+ *
88
+ * @default 'center'
89
+ */
90
+ placement?: "center" | "left" | "right" | "top" | "bottom";
79
91
  /**
80
92
  * Toogle modal and non-modal dialog.
81
93
  *
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAKlD,MAAM,MAAM,WAAW,GAAG,UAAU,CAClC,YAAY,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,EACtD;IACE;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC7B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,KAAK,CAAC;IAC3C;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CACF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,MAAM;IA9Df;;;OAGG;kBACW,MAAM,GAAG,KAAK;IAC5B;;;;;;OAMG;eACQ,MAAM,GAAG,cAAc,GAAG,KAAK;IAC1C;;;;;;OAMG;YACK,OAAO;IACf;;OAEG;WACI,OAAO;IACd;;OAEG;cACO,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI;IAChC;;;;;OAKG;cACO,OAAO;qDA8HpB,CAAC"}
1
+ {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAKlD,MAAM,MAAM,WAAW,GAAG,UAAU,CAClC,YAAY,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,EACtD;IACE;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC7B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,KAAK,CAAC;IAC3C;;;;OAIG;IACH,SAAS,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;IAC3D;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CACF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,MAAM;IApEf;;;OAGG;kBACW,MAAM,GAAG,KAAK;IAC5B;;;;;;OAMG;eACQ,MAAM,GAAG,cAAc,GAAG,KAAK;IAC1C;;;;OAIG;gBACS,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ;IAC1D;;;;;;OAMG;YACK,OAAO;IACf;;OAEG;WACI,OAAO;IACd;;OAEG;cACO,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI;IAChC;;;;;OAKG;cACO,OAAO;qDAgIpB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"suggestion-clear.d.ts","sourceRoot":"","sources":["../../../src/components/suggestion/suggestion-clear.tsx"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG5D,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,UAAU,CAAC,GAAG;IAC7E;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe;IAnB1B;;;OAGG;mBACY,MAAM;qDAmCrB,CAAC"}
1
+ {"version":3,"file":"suggestion-clear.d.ts","sourceRoot":"","sources":["../../../src/components/suggestion/suggestion-clear.tsx"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG5D,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,UAAU,CAAC,GAAG;IAC7E;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe;IAnB1B;;;OAGG;mBACY,MAAM;qDAgCrB,CAAC"}
@@ -13,6 +13,11 @@ export type SuggestionListProps = MergeRight<DefaultProps & HTMLAttributes<HTMLD
13
13
  * @default '%d forslag'
14
14
  */
15
15
  plural?: string;
16
+ /**
17
+ * Whether to enable auto placement.
18
+ * @default true
19
+ */
20
+ autoPlacement?: boolean;
16
21
  }>;
17
22
  /**
18
23
  * Component that provides a Suggestion list.
@@ -25,7 +30,7 @@ export type SuggestionListProps = MergeRight<DefaultProps & HTMLAttributes<HTMLD
25
30
  * <Suggestion.List />
26
31
  * </Suggestion>
27
32
  */
28
- export declare const SuggestionList: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDataListElement>, "singular" | "plural"> & {
33
+ export declare const SuggestionList: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLDataListElement>, "autoPlacement" | "singular" | "plural"> & {
29
34
  /**
30
35
  * The screen reader announcement for singular Suggestion, where %d is the number of Suggestions
31
36
  * @default '%d forslag'
@@ -36,5 +41,10 @@ export declare const SuggestionList: import("react").ForwardRefExoticComponent<O
36
41
  * @default '%d forslag'
37
42
  */
38
43
  plural?: string;
44
+ /**
45
+ * Whether to enable auto placement.
46
+ * @default true
47
+ */
48
+ autoPlacement?: boolean;
39
49
  } & import("react").RefAttributes<HTMLDataListElement>>;
40
50
  //# sourceMappingURL=suggestion-list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"suggestion-list.d.ts","sourceRoot":"","sources":["../../../src/components/suggestion/suggestion-list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,wBAAwB,CAAC;AAMhC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAC1C,YAAY,GAAG,cAAc,CAAC,mBAAmB,CAAC,EAClD;IACE;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CACF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc;IAxBvB;;;OAGG;eACQ,MAAM;IACjB;;;OAGG;aACM,MAAM;uDAuDjB,CAAC"}
1
+ {"version":3,"file":"suggestion-list.d.ts","sourceRoot":"","sources":["../../../src/components/suggestion/suggestion-list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,wBAAwB,CAAC;AAQhC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAC1C,YAAY,GAAG,cAAc,CAAC,mBAAmB,CAAC,EAClD;IACE;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CACF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc;IA7BvB;;;OAGG;eACQ,MAAM;IACjB;;;OAGG;aACM,MAAM;IACf;;;OAGG;oBACa,OAAO;uDA2EzB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@digdir/designsystemet-react",
3
3
  "type": "module",
4
- "version": "1.8.0",
4
+ "version": "1.10.0",
5
5
  "description": "React components for Designsystemet",
6
6
  "author": "Designsystemet team",
7
7
  "repository": {
@@ -24,7 +24,6 @@
24
24
  "types": "./dist/react-types.d.ts"
25
25
  }
26
26
  },
27
- "sideEffects": false,
28
27
  "files": [
29
28
  "dist/**"
30
29
  ],
@@ -38,42 +37,40 @@
38
37
  "dependencies": {
39
38
  "@floating-ui/dom": "^1.7.4",
40
39
  "@floating-ui/react": "0.26.23",
41
- "@navikt/aksel-icons": "^7.35.0",
40
+ "@navikt/aksel-icons": "^7.37.0",
42
41
  "@radix-ui/react-slot": "^1.2.4",
43
- "@tanstack/react-virtual": "^3.13.12",
44
- "@u-elements/u-combobox": "^1.0.4",
42
+ "@tanstack/react-virtual": "^3.13.16",
43
+ "@u-elements/u-combobox": "^1.0.5",
45
44
  "@u-elements/u-datalist": "^1.0.14",
46
45
  "@u-elements/u-details": "^0.1.5",
47
46
  "clsx": "^2.1.1",
48
- "@digdir/designsystemet-types": "^1.8.0"
47
+ "@digdir/designsystemet-types": "^1.10.0"
49
48
  },
50
49
  "devDependencies": {
51
50
  "@rollup/plugin-commonjs": "^29.0.0",
52
51
  "@rollup/plugin-node-resolve": "^16.0.3",
53
- "@storybook/addon-docs": "^9.1.16",
54
- "@storybook/addon-vitest": "^9.1.16",
55
- "@storybook/react-vite": "^9.1.16",
56
- "@testing-library/dom": "^10.4.1",
52
+ "@storybook/addon-docs": "^10.1.11",
53
+ "@storybook/addon-vitest": "^10.1.11",
54
+ "@storybook/react-vite": "^10.1.11",
57
55
  "@testing-library/jest-dom": "^6.9.1",
58
- "@testing-library/react": "^16.3.0",
56
+ "@testing-library/react": "^16.3.1",
59
57
  "@testing-library/user-event": "^14.6.1",
60
58
  "@types/react": "^19.2.7",
61
59
  "@types/react-dom": "^19.2.3",
62
- "react": "^19.2.1",
63
- "react-dom": "^19.2.1",
60
+ "react": "^19.2.3",
61
+ "react-dom": "^19.2.3",
64
62
  "rimraf": "^6.1.2",
65
- "rollup": "^4.53.3",
63
+ "rollup": "^4.54.0",
66
64
  "rollup-plugin-copy": "^3.5.0",
67
- "storybook": "^9.1.16",
65
+ "storybook": "^10.1.11",
68
66
  "tsx": "4.21.0",
69
67
  "typescript": "^5.9.3",
70
- "@digdir/designsystemet": "^1.8.0",
71
- "@digdir/designsystemet-css": "^1.8.0"
68
+ "@digdir/designsystemet": "^1.10.0",
69
+ "@digdir/designsystemet-css": "^1.10.0"
72
70
  },
73
71
  "scripts": {
74
72
  "build": "pnpm run clean && tsc -b tsconfig.lib.json --emitDeclarationOnly false && rollup -c --bundleConfigAsCjs",
75
73
  "clean": "rimraf dist && rimraf tsc-build && rimraf --glob \"*.tsbuildinfo\"",
76
- "copy-css-to-build": "copyfiles -u 1 ./src/**/*.css ./tsc-build/",
77
74
  "types": "tsc --noEmit"
78
75
  }
79
76
  }