@digdir/designsystemet-react 1.9.0 → 1.11.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/Combobox/Combobox.js +3 -1
- package/dist/cjs/components/Combobox/Option/useComboboxOption.js +3 -1
- package/dist/cjs/components/Combobox/useComboboxKeyboard.js +4 -1
- package/dist/cjs/components/avatar/avatar.js +3 -2
- package/dist/cjs/components/avatar-stack/avatar-stack.js +33 -0
- package/dist/cjs/components/details/details.js +1 -1
- package/dist/cjs/components/dialog/dialog.js +1 -1
- package/dist/cjs/components/field/field-counter.js +3 -1
- package/dist/cjs/components/field/field.js +1 -1
- package/dist/cjs/components/popover/popover.js +1 -1
- package/dist/cjs/components/skeleton/skeleton.js +3 -1
- package/dist/cjs/components/spinner/spinner.js +3 -1
- package/dist/cjs/components/suggestion/suggestion-list.js +17 -4
- package/dist/cjs/components/suggestion/suggestion.js +9 -6
- package/dist/cjs/components/tabs/tabs-list.js +1 -1
- package/dist/cjs/components/tabs/tabs-panel.js +1 -1
- package/dist/cjs/index.js +89 -86
- package/dist/cjs/utilities/roving-focus/roving-focus-item.js +1 -1
- package/dist/esm/components/Combobox/Combobox.js +4 -2
- package/dist/esm/components/Combobox/ComboboxIdContext.js +1 -1
- package/dist/esm/components/Combobox/Option/useComboboxOption.js +3 -1
- package/dist/esm/components/Combobox/useComboboxKeyboard.js +4 -1
- package/dist/esm/components/avatar/avatar.js +3 -2
- package/dist/esm/components/avatar-stack/avatar-stack.js +31 -0
- package/dist/esm/components/chip/index.js +1 -1
- package/dist/esm/components/details/details.js +1 -1
- package/dist/esm/components/dialog/dialog.js +1 -1
- package/dist/esm/components/error-summary/error-summary.js +1 -1
- package/dist/esm/components/field/field-counter.js +3 -1
- package/dist/esm/components/field/field.js +1 -1
- package/dist/esm/components/list/index.js +1 -1
- package/dist/esm/components/popover/popover.js +1 -1
- package/dist/esm/components/skeleton/skeleton.js +3 -1
- package/dist/esm/components/spinner/spinner.js +3 -1
- package/dist/esm/components/suggestion/suggestion-list.js +18 -5
- package/dist/esm/components/suggestion/suggestion.js +10 -7
- package/dist/esm/components/tabs/tabs-list.js +1 -1
- package/dist/esm/components/tabs/tabs-panel.js +1 -1
- package/dist/esm/components/tabs/tabs.js +1 -1
- package/dist/esm/components/toggle-group/toggle-group.js +1 -1
- package/dist/esm/index.js +45 -43
- package/dist/esm/utilities/roving-focus/roving-focus-item.js +1 -1
- package/dist/esm/utilities/roving-focus/roving-focus-root.js +1 -1
- package/dist/types/components/avatar/avatar.d.ts +5 -0
- package/dist/types/components/avatar/avatar.d.ts.map +1 -1
- package/dist/types/components/avatar-stack/avatar-stack.d.ts +70 -0
- package/dist/types/components/avatar-stack/avatar-stack.d.ts.map +1 -0
- package/dist/types/components/badge/badge-position.d.ts +1 -1
- package/dist/types/components/badge/index.d.ts +1 -1
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/components/suggestion/suggestion-list.d.ts +11 -1
- package/dist/types/components/suggestion/suggestion-list.d.ts.map +1 -1
- package/dist/types/components/suggestion/suggestion.d.ts +2 -2
- package/dist/types/components/suggestion/suggestion.d.ts.map +1 -1
- package/package.json +15 -18
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useMergeRefs } from '@floating-ui/react';
|
|
3
3
|
import { useId, useContext, useMemo, 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 { ComboboxContext } from '../ComboboxContext.js';
|
|
5
8
|
import { useComboboxId, useComboboxIdDispatch } from '../ComboboxIdContext.js';
|
|
6
9
|
import { prefix } from '../utilities.js';
|
|
7
|
-
import { useDebounceCallback } from '../../../utilities/hooks/deprecated/use-debounce-callback/use-debounce-callback.js';
|
|
8
10
|
|
|
9
11
|
const useComboboxOption = ({ id, ref, value, }) => {
|
|
10
12
|
const generatedId = useId();
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useComboboxId } from './ComboboxIdContext.js';
|
|
3
2
|
import { useDebounceCallback } from '../../utilities/hooks/deprecated/use-debounce-callback/use-debounce-callback.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import '../../utilities/roving-focus/roving-focus-item.js';
|
|
5
|
+
import '../../utilities/roving-focus/roving-focus-root.js';
|
|
6
|
+
import { useComboboxId } from './ComboboxIdContext.js';
|
|
4
7
|
|
|
5
8
|
const useComboboxKeyboard = ({ readOnly, disabled, interactiveChildren, filteredOptions, inputValue, selectedOptions, multiple, open, options, setOpen, handleSelectOption, }) => {
|
|
6
9
|
const { activeIndex } = useComboboxId();
|
|
@@ -20,11 +20,12 @@ import { forwardRef, Fragment } from 'react';
|
|
|
20
20
|
* <Icon />
|
|
21
21
|
* </Avatar>
|
|
22
22
|
*/
|
|
23
|
-
const Avatar = forwardRef(function Avatar({ 'aria-label': ariaLabel, variant = 'circle', className, children, initials, ...rest }, ref) {
|
|
23
|
+
const Avatar = forwardRef(function Avatar({ 'aria-label': ariaLabel, variant = 'circle', className, children, initials, asChild, ...rest }, ref) {
|
|
24
|
+
const OuterComponent = asChild ? Slot : 'span';
|
|
24
25
|
const useSlot = children && typeof children !== 'string';
|
|
25
26
|
const textChild = children && typeof children === 'string';
|
|
26
27
|
const Component = useSlot ? Slot : Fragment;
|
|
27
|
-
return (jsx(
|
|
28
|
+
return (jsx(OuterComponent, { ref: ref, className: cl('ds-avatar', className), "data-variant": variant, "data-initials": initials, role: 'img', "aria-label": ariaLabel, ...rest, children: jsx(Component, { ...(useSlot ? { 'aria-hidden': true } : {}), children: textChild ? jsx("span", { children: children }) : children }) }));
|
|
28
29
|
});
|
|
29
30
|
|
|
30
31
|
export { Avatar };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import cl from 'clsx/lite';
|
|
4
|
+
import { forwardRef, Children } from 'react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Use `AvatarStack` to constrain Avatars into a stack.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <EXPERIMENTAL_AvatarStack>
|
|
11
|
+
* <Avatar aria-label='name'>
|
|
12
|
+
* <img src={cat1} alt='' />
|
|
13
|
+
* </Avatar>
|
|
14
|
+
* <Avatar aria-label='name'>
|
|
15
|
+
* <BriefcaseIcon />
|
|
16
|
+
* </Avatar>
|
|
17
|
+
* <Avatar aria-label='name' initials='sm' />
|
|
18
|
+
* </EXPERIMENTAL_AvatarStack>
|
|
19
|
+
*/
|
|
20
|
+
const EXPERIMENTAL_AvatarStack = forwardRef(function AvatarStack({ className, gap, suffix, avatarSize, overlap, expandable, children, ...rest }, ref) {
|
|
21
|
+
const style = {
|
|
22
|
+
...(rest.style || {}),
|
|
23
|
+
'--dsc-avatar-stack-gap': gap !== undefined ? `${gap}` : undefined,
|
|
24
|
+
'--dsc-avatar-stack-size': avatarSize ? `${avatarSize}` : undefined,
|
|
25
|
+
'--dsc-avatar-stack-overlap': overlap !== undefined ? `${overlap}` : undefined,
|
|
26
|
+
'--dsc-avatar-count': expandable === 'fixed' ? Children.count(children) : undefined,
|
|
27
|
+
};
|
|
28
|
+
return (jsx("figure", { tabIndex: rest.tabIndex !== undefined ? rest.tabIndex : expandable ? 0 : -1, ref: ref, className: cl(`ds-avatar-stack`, className), style: style, "data-expandable": expandable, "data-suffix": suffix, ...rest, children: children }));
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export { EXPERIMENTAL_AvatarStack };
|
|
@@ -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.
|
|
@@ -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 {
|
|
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.
|
|
@@ -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.
|
|
@@ -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.
|
|
@@ -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: [
|
|
32
|
-
|
|
33
|
-
|
|
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,
|
|
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'
|
|
@@ -31,10 +31,14 @@ const Suggestion = forwardRef(function Suggestion({ children, className, creatab
|
|
|
31
31
|
const [defaultItems, setDefaultItems] = useState(sanitizeItems(defaultSelected));
|
|
32
32
|
const selectedItems = selected ? sanitizeItems(selected) : defaultItems;
|
|
33
33
|
const onSelectedChangeRef = useRef(onSelectedChange);
|
|
34
|
+
const selectedItemsRef = useRef(selectedItems);
|
|
34
35
|
// Keep the ref updated with the latest callback
|
|
35
36
|
useEffect(() => {
|
|
36
37
|
onSelectedChangeRef.current = onSelectedChange;
|
|
37
38
|
}, [onSelectedChange]);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
selectedItemsRef.current = selectedItems;
|
|
41
|
+
}, [selectedItems]);
|
|
38
42
|
/**
|
|
39
43
|
* Listerners and handling of adding/removing
|
|
40
44
|
*/
|
|
@@ -44,15 +48,14 @@ const Suggestion = forwardRef(function Suggestion({ children, className, creatab
|
|
|
44
48
|
event.preventDefault();
|
|
45
49
|
const multiple = combobox?.multiple;
|
|
46
50
|
const data = event.detail;
|
|
47
|
-
const nextItem = nextItems(data,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
else
|
|
51
|
+
const nextItem = nextItems(data, selectedItemsRef.current, multiple);
|
|
52
|
+
onSelectedChangeRef.current?.(nextItem || null);
|
|
53
|
+
if (!isControlled)
|
|
51
54
|
setDefaultItems(sanitizeItems(nextItem));
|
|
52
55
|
};
|
|
53
56
|
combobox?.addEventListener('comboboxbeforeselect', beforeChange);
|
|
54
57
|
return () => combobox?.removeEventListener('comboboxbeforeselect', beforeChange);
|
|
55
|
-
}, [
|
|
58
|
+
}, [isControlled]);
|
|
56
59
|
// Before match event listener
|
|
57
60
|
useEffect(() => {
|
|
58
61
|
const combobox = uComboboxRef.current;
|
|
@@ -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 {
|
|
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
|
|
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,108 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
export { Alert } from './components/alert/alert.js';
|
|
3
|
+
export { Avatar } from './components/avatar/avatar.js';
|
|
4
|
+
export { EXPERIMENTAL_AvatarStack } from './components/avatar-stack/avatar-stack.js';
|
|
5
|
+
export { Badge } from './components/badge/index.js';
|
|
6
|
+
export { Breadcrumbs } from './components/breadcrumbs/index.js';
|
|
7
|
+
export { Button } from './components/button/button.js';
|
|
8
|
+
export { Combobox } from './components/Combobox/index.js';
|
|
9
|
+
export { Card } from './components/card/index.js';
|
|
10
|
+
export { Checkbox } from './components/checkbox/checkbox.js';
|
|
11
|
+
export { Chip } from './components/chip/index.js';
|
|
12
|
+
export { Details } from './components/details/index.js';
|
|
13
|
+
export { Dialog } from './components/dialog/index.js';
|
|
14
|
+
export { Divider } from './components/divider/divider.js';
|
|
15
|
+
export { Dropdown } from './components/dropdown/index.js';
|
|
16
|
+
export { ErrorSummary } from './components/error-summary/index.js';
|
|
17
|
+
export { Field } from './components/field/index.js';
|
|
18
|
+
export { Fieldset } from './components/fieldset/index.js';
|
|
19
|
+
export { Heading } from './components/heading/heading.js';
|
|
20
|
+
export { Input } from './components/input/input.js';
|
|
21
|
+
export { Label } from './components/label/label.js';
|
|
22
|
+
export { Link } from './components/link/link.js';
|
|
23
|
+
export { List } from './components/list/index.js';
|
|
24
|
+
export { Pagination } from './components/pagination/index.js';
|
|
25
|
+
export { Paragraph } from './components/paragraph/paragraph.js';
|
|
26
|
+
export { Popover } from './components/popover/index.js';
|
|
27
|
+
export { Radio } from './components/radio/radio.js';
|
|
28
|
+
export { Search } from './components/search/index.js';
|
|
29
|
+
export { Select } from './components/select/index.js';
|
|
30
|
+
export { Skeleton } from './components/skeleton/skeleton.js';
|
|
31
|
+
export { SkipLink } from './components/skip-link/skip-link.js';
|
|
32
|
+
export { Spinner } from './components/spinner/spinner.js';
|
|
33
|
+
export { EXPERIMENTAL_Suggestion } from './components/suggestion/index.js';
|
|
34
|
+
export { Switch } from './components/switch/switch.js';
|
|
35
|
+
export { Table } from './components/table/index.js';
|
|
36
|
+
export { Tabs } from './components/tabs/index.js';
|
|
37
|
+
export { Tag } from './components/tag/tag.js';
|
|
38
|
+
export { Textarea } from './components/textarea/textarea.js';
|
|
39
|
+
export { Textfield } from './components/textfield/textfield.js';
|
|
40
|
+
export { ToggleGroup } from './components/toggle-group/index.js';
|
|
41
|
+
export { Tooltip } from './components/tooltip/tooltip.js';
|
|
42
|
+
export { ValidationMessage } from './components/validation-message/validation-message.js';
|
|
2
43
|
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
44
|
export { useDebounceCallback } from './utilities/hooks/deprecated/use-debounce-callback/use-debounce-callback.js';
|
|
7
45
|
export { useIsomorphicLayoutEffect } from './utilities/hooks/deprecated/use-isomorphic-layout-effect/use-isomorphic-layout-effect.js';
|
|
8
46
|
export { useMediaQuery } from './utilities/hooks/deprecated/use-media-query/use-media-query.js';
|
|
47
|
+
export { useCheckboxGroup } from './utilities/hooks/use-checkbox-group/use-checkbox-group.js';
|
|
48
|
+
import 'react';
|
|
9
49
|
export { usePagination } from './utilities/hooks/use-pagination/use-pagination.js';
|
|
10
50
|
export { useRadioGroup } from './utilities/hooks/use-radio-group/use-radio-group.js';
|
|
11
51
|
export { useSynchronizedAnimation } from './utilities/hooks/use-synchronized-animation/use-synchronized-animation.js';
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export { Badge } from './components/badge/index.js';
|
|
52
|
+
export { RovingFocusItem } from './utilities/roving-focus/roving-focus-item.js';
|
|
53
|
+
export { RovingFocusRoot } from './utilities/roving-focus/roving-focus-root.js';
|
|
15
54
|
export { BadgePosition } from './components/badge/badge-position.js';
|
|
16
|
-
export { Breadcrumbs } from './components/breadcrumbs/index.js';
|
|
17
55
|
export { BreadcrumbsItem } from './components/breadcrumbs/breadcrumbs-item.js';
|
|
18
56
|
export { BreadcrumbsLink } from './components/breadcrumbs/breadcrumbs-link.js';
|
|
19
57
|
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
58
|
export { ComboboxEmpty } from './components/Combobox/Empty.js';
|
|
23
59
|
export { ComboboxOption } from './components/Combobox/Option/Option.js';
|
|
24
|
-
export { Card } from './components/card/index.js';
|
|
25
60
|
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
61
|
export { ChipButton, ChipCheckbox, ChipRadio, ChipRemovable } from './components/chip/chips.js';
|
|
29
|
-
export { Details } from './components/details/index.js';
|
|
30
62
|
export { DetailsContent } from './components/details/details-content.js';
|
|
31
63
|
export { DetailsSummary } from './components/details/details-summary.js';
|
|
32
|
-
export { Dialog } from './components/dialog/index.js';
|
|
33
64
|
export { DialogBlock } from './components/dialog/dialog-block.js';
|
|
34
65
|
export { DialogTrigger } from './components/dialog/dialog-trigger.js';
|
|
35
66
|
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
67
|
export { DropdownButton } from './components/dropdown/dropdown-button.js';
|
|
39
68
|
export { DropdownHeading } from './components/dropdown/dropdown-heading.js';
|
|
40
69
|
export { DropdownItem } from './components/dropdown/dropdown-item.js';
|
|
41
70
|
export { DropdownList } from './components/dropdown/dropdown-list.js';
|
|
42
71
|
export { DropdownTrigger } from './components/dropdown/dropdown-trigger.js';
|
|
43
72
|
export { DropdownTriggerContext } from './components/dropdown/dropdown-trigger-context.js';
|
|
44
|
-
export { ErrorSummary } from './components/error-summary/index.js';
|
|
45
73
|
export { ErrorSummaryHeading } from './components/error-summary/error-summary-heading.js';
|
|
46
74
|
export { ErrorSummaryItem } from './components/error-summary/error-summary-item.js';
|
|
47
75
|
export { ErrorSummaryLink } from './components/error-summary/error-summary-link.js';
|
|
48
76
|
export { ErrorSummaryList } from './components/error-summary/error-summary-list.js';
|
|
49
|
-
export { Field } from './components/field/index.js';
|
|
50
77
|
export { FieldAffix, FieldAffixes } from './components/field/field-affix.js';
|
|
51
78
|
export { FieldCounter } from './components/field/field-counter.js';
|
|
52
79
|
export { FieldDescription } from './components/field/field-description.js';
|
|
53
|
-
export { Fieldset } from './components/fieldset/index.js';
|
|
54
80
|
export { FieldsetDescription } from './components/fieldset/fieldset-description.js';
|
|
55
81
|
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
82
|
export { ListItem } from './components/list/list-item.js';
|
|
62
83
|
export { ListOrdered, ListUnordered } from './components/list/lists.js';
|
|
63
|
-
export { Pagination } from './components/pagination/index.js';
|
|
64
84
|
export { PaginationButton } from './components/pagination/pagination-button.js';
|
|
65
85
|
export { PaginationItem } from './components/pagination/pagination-item.js';
|
|
66
86
|
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
87
|
export { PopoverTrigger } from './components/popover/popover-trigger.js';
|
|
70
88
|
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
89
|
export { SearchButton } from './components/search/search-button.js';
|
|
74
90
|
export { SearchClear } from './components/search/search-clear.js';
|
|
75
91
|
export { SearchInput } from './components/search/search-input.js';
|
|
76
|
-
export { Select } from './components/select/index.js';
|
|
77
92
|
export { SelectOptgroup } from './components/select/select-optgroup.js';
|
|
78
93
|
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
94
|
export { SuggestionClear as EXPERIMENTAL_SuggestionClear } from './components/suggestion/suggestion-clear.js';
|
|
84
95
|
export { SuggestionEmpty as EXPERIMENTAL_SuggestionEmpty } from './components/suggestion/suggestion-empty.js';
|
|
85
96
|
export { SuggestionInput as EXPERIMENTAL_SuggestionInput } from './components/suggestion/suggestion-input.js';
|
|
86
97
|
export { SuggestionList as EXPERIMENTAL_SuggestionList } from './components/suggestion/suggestion-list.js';
|
|
87
98
|
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
99
|
export { TableBody } from './components/table/table-body.js';
|
|
91
100
|
export { TableCell } from './components/table/table-cell.js';
|
|
92
101
|
export { TableFoot } from './components/table/table-foot.js';
|
|
93
102
|
export { TableHead } from './components/table/table-head.js';
|
|
94
103
|
export { TableHeaderCell } from './components/table/table-header-cell.js';
|
|
95
104
|
export { TableRow } from './components/table/table-row.js';
|
|
96
|
-
export { Tabs } from './components/tabs/index.js';
|
|
97
105
|
export { TabsList } from './components/tabs/tabs-list.js';
|
|
98
106
|
export { TabsPanel } from './components/tabs/tabs-panel.js';
|
|
99
107
|
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
108
|
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
|
|
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({
|
|
@@ -26,6 +26,11 @@ export type AvatarProps = MergeRight<DefaultProps & HTMLAttributes<HTMLSpanEleme
|
|
|
26
26
|
* Initials to display inside the avatar.
|
|
27
27
|
*/
|
|
28
28
|
initials?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
asChild?: boolean;
|
|
29
34
|
/**
|
|
30
35
|
* Image, icon or initials to display inside the avatar.
|
|
31
36
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../../src/components/avatar/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAGzD,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,KAAK,SAAS,GAAG;IACf;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AACF,KAAK,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG;IAAE,aAAa,EAAE,IAAI,GAAG,MAAM,CAAA;CAAE,CAAC;AAExE,MAAM,MAAM,WAAW,GAAG,UAAU,CAClC,YAAY,GAAG,cAAc,CAAC,eAAe,CAAC,EAC9C,CAAC,SAAS,GAAG,UAAU,CAAC,GAAG;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B;;;;OAIG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC9B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CACF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../../src/components/avatar/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAGzD,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,KAAK,SAAS,GAAG;IACf;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AACF,KAAK,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG;IAAE,aAAa,EAAE,IAAI,GAAG,MAAM,CAAA;CAAE,CAAC;AAExE,MAAM,MAAM,WAAW,GAAG,UAAU,CAClC,YAAY,GAAG,cAAc,CAAC,eAAe,CAAC,EAC9C,CAAC,SAAS,GAAG,UAAU,CAAC,GAAG;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B;;;;OAIG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC9B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CACF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,MAAM,yGAgCjB,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
export type AvatarStackProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Adjusts gap-mask between avatars in the stack. Must be a valid css length value (px, em, rem, var(--ds-size-1) etc.)
|
|
5
|
+
* @default 2px
|
|
6
|
+
*/
|
|
7
|
+
gap?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Control the size of the avatars. Must be a valid css length value (px, em, rem, var(--ds-size-12) etc.)
|
|
10
|
+
* @default 'var(--ds-size-12)'
|
|
11
|
+
*/
|
|
12
|
+
avatarSize?: string;
|
|
13
|
+
/**
|
|
14
|
+
* A number which represents the percentage value of how much avatars should overlap.
|
|
15
|
+
* @default 50
|
|
16
|
+
*/
|
|
17
|
+
overlap?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Text to the right of the avatars to show a number representing additional avatars not shown such as '+5'".
|
|
20
|
+
*/
|
|
21
|
+
suffix?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Expand on hover to show full avatars.
|
|
24
|
+
* 'fixed': AvatarStack physical width does not change when avatars are expanded.
|
|
25
|
+
* @default undefined
|
|
26
|
+
*/
|
|
27
|
+
expandable?: 'fixed' | true;
|
|
28
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
29
|
+
/**
|
|
30
|
+
* Use `AvatarStack` to constrain Avatars into a stack.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* <EXPERIMENTAL_AvatarStack>
|
|
34
|
+
* <Avatar aria-label='name'>
|
|
35
|
+
* <img src={cat1} alt='' />
|
|
36
|
+
* </Avatar>
|
|
37
|
+
* <Avatar aria-label='name'>
|
|
38
|
+
* <BriefcaseIcon />
|
|
39
|
+
* </Avatar>
|
|
40
|
+
* <Avatar aria-label='name' initials='sm' />
|
|
41
|
+
* </EXPERIMENTAL_AvatarStack>
|
|
42
|
+
*/
|
|
43
|
+
export declare const EXPERIMENTAL_AvatarStack: import("react").ForwardRefExoticComponent<{
|
|
44
|
+
/**
|
|
45
|
+
* Adjusts gap-mask between avatars in the stack. Must be a valid css length value (px, em, rem, var(--ds-size-1) etc.)
|
|
46
|
+
* @default 2px
|
|
47
|
+
*/
|
|
48
|
+
gap?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Control the size of the avatars. Must be a valid css length value (px, em, rem, var(--ds-size-12) etc.)
|
|
51
|
+
* @default 'var(--ds-size-12)'
|
|
52
|
+
*/
|
|
53
|
+
avatarSize?: string;
|
|
54
|
+
/**
|
|
55
|
+
* A number which represents the percentage value of how much avatars should overlap.
|
|
56
|
+
* @default 50
|
|
57
|
+
*/
|
|
58
|
+
overlap?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Text to the right of the avatars to show a number representing additional avatars not shown such as '+5'".
|
|
61
|
+
*/
|
|
62
|
+
suffix?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Expand on hover to show full avatars.
|
|
65
|
+
* 'fixed': AvatarStack physical width does not change when avatars are expanded.
|
|
66
|
+
* @default undefined
|
|
67
|
+
*/
|
|
68
|
+
expandable?: "fixed" | true;
|
|
69
|
+
} & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
70
|
+
//# sourceMappingURL=avatar-stack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar-stack.d.ts","sourceRoot":"","sources":["../../../src/components/avatar-stack/avatar-stack.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC7B,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEnC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wBAAwB;IAzCnC;;;OAGG;UACG,MAAM;IACZ;;;OAGG;iBACU,MAAM;IACnB;;;OAGG;cACO,MAAM;IAChB;;OAEG;aACM,MAAM;IACf;;;;OAIG;iBACU,OAAO,GAAG,IAAI;mFAyD3B,CAAC"}
|
|
@@ -24,7 +24,7 @@ export type BadgePositionProps = MergeRight<DefaultProps & HTMLAttributes<HTMLSp
|
|
|
24
24
|
* <Element />
|
|
25
25
|
* </BadgePosition>
|
|
26
26
|
*/
|
|
27
|
-
export declare const BadgePosition: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLSpanElement>, "
|
|
27
|
+
export declare const BadgePosition: import("react").ForwardRefExoticComponent<Omit<DefaultProps & HTMLAttributes<HTMLSpanElement>, "overlap" | "placement"> & {
|
|
28
28
|
/**
|
|
29
29
|
* The placement of the badge
|
|
30
30
|
*
|