@human-kit/ui 1.0.0-beta.3 → 1.0.0-beta.4

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 (74) hide show
  1. package/README.md +15 -6
  2. package/dist/FOCUS_STATE_CONTRACT.md +2 -0
  3. package/dist/autocomplete/list/autocomplete-list.svelte.d.ts +3 -1
  4. package/dist/button/root/button-root.svelte +19 -3
  5. package/dist/button/root/button-root.svelte.d.ts +10 -0
  6. package/dist/combobox/list/combobox-listbox.svelte.d.ts +3 -1
  7. package/dist/index.d.ts +2 -0
  8. package/dist/index.js +2 -0
  9. package/dist/internal/environment.d.ts +11 -0
  10. package/dist/internal/environment.js +14 -0
  11. package/dist/internal/localized-strings.d.ts +80 -0
  12. package/dist/internal/localized-strings.js +80 -0
  13. package/dist/listbox/README.md +27 -1
  14. package/dist/listbox/item/listbox-item.svelte +11 -2
  15. package/dist/listbox/root/context.d.ts +25 -0
  16. package/dist/listbox/root/context.js +108 -1
  17. package/dist/listbox/root/listbox.svelte +85 -7
  18. package/dist/listbox/root/listbox.svelte.d.ts +13 -1
  19. package/dist/menu/README.md +46 -0
  20. package/dist/menu/content/menu-content.svelte +16 -5
  21. package/dist/menu/content/menu-content.svelte.d.ts +2 -1
  22. package/dist/menu/context-trigger/menu-context-trigger.svelte +195 -0
  23. package/dist/menu/context-trigger/menu-context-trigger.svelte.d.ts +36 -0
  24. package/dist/menu/index.d.ts +4 -1
  25. package/dist/menu/index.js +1 -0
  26. package/dist/menu/index.parts.d.ts +1 -0
  27. package/dist/menu/index.parts.js +1 -0
  28. package/dist/menu/root/context.d.ts +18 -0
  29. package/dist/menu/root/menu-state.svelte.js +19 -0
  30. package/dist/popover/content/popover-content.svelte +2 -1
  31. package/dist/primitives/floating.d.ts +33 -5
  32. package/dist/primitives/floating.js +25 -0
  33. package/dist/primitives/index.d.ts +1 -0
  34. package/dist/primitives/index.js +1 -0
  35. package/dist/primitives/keyboard-navigation.d.ts +23 -5
  36. package/dist/primitives/keyboard-navigation.js +22 -15
  37. package/dist/primitives/long-press.d.ts +59 -0
  38. package/dist/primitives/long-press.js +142 -0
  39. package/dist/primitives/scroll-lock.d.ts +24 -0
  40. package/dist/primitives/scroll-lock.js +40 -0
  41. package/dist/transfer-list/README.md +121 -0
  42. package/dist/transfer-list/index.d.ts +33 -0
  43. package/dist/transfer-list/index.js +18 -0
  44. package/dist/transfer-list/index.parts.d.ts +9 -0
  45. package/dist/transfer-list/index.parts.js +10 -0
  46. package/dist/transfer-list/item/transfer-list-item.svelte +74 -0
  47. package/dist/transfer-list/item/transfer-list-item.svelte.d.ts +35 -0
  48. package/dist/transfer-list/list/transfer-list-list.svelte +162 -0
  49. package/dist/transfer-list/list/transfer-list-list.svelte.d.ts +56 -0
  50. package/dist/transfer-list/list/transfer-list-source.svelte +13 -0
  51. package/dist/transfer-list/list/transfer-list-source.svelte.d.ts +36 -0
  52. package/dist/transfer-list/list/transfer-list-target.svelte +14 -0
  53. package/dist/transfer-list/list/transfer-list-target.svelte.d.ts +36 -0
  54. package/dist/transfer-list/move/transfer-list-move-all.svelte +14 -0
  55. package/dist/transfer-list/move/transfer-list-move-all.svelte.d.ts +10 -0
  56. package/dist/transfer-list/move/transfer-list-move-button.svelte +103 -0
  57. package/dist/transfer-list/move/transfer-list-move-button.svelte.d.ts +25 -0
  58. package/dist/transfer-list/move/transfer-list-move-down.svelte +14 -0
  59. package/dist/transfer-list/move/transfer-list-move-down.svelte.d.ts +10 -0
  60. package/dist/transfer-list/move/transfer-list-move-selected.svelte +14 -0
  61. package/dist/transfer-list/move/transfer-list-move-selected.svelte.d.ts +10 -0
  62. package/dist/transfer-list/move/transfer-list-move-up.svelte +14 -0
  63. package/dist/transfer-list/move/transfer-list-move-up.svelte.d.ts +10 -0
  64. package/dist/transfer-list/move/transfer-list-reorder-button.svelte +83 -0
  65. package/dist/transfer-list/move/transfer-list-reorder-button.svelte.d.ts +21 -0
  66. package/dist/transfer-list/root/context.d.ts +70 -0
  67. package/dist/transfer-list/root/context.js +24 -0
  68. package/dist/transfer-list/root/transfer-list-root.svelte +342 -0
  69. package/dist/transfer-list/root/transfer-list-root.svelte.d.ts +65 -0
  70. package/dist/transfer-list/root/types.d.ts +22 -0
  71. package/dist/transfer-list/root/types.js +4 -0
  72. package/dist/transfer-list/status/transfer-list-status.svelte +70 -0
  73. package/dist/transfer-list/status/transfer-list-status.svelte.d.ts +15 -0
  74. package/package.json +6 -1
@@ -0,0 +1,103 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { HTMLButtonAttributes } from 'svelte/elements';
4
+ import { readable } from 'svelte/store';
5
+ import { ButtonRoot } from '../../button';
6
+ import { resolveLocalizedString } from '../../internal/localized-strings';
7
+ import { useLocaleContextOptional } from '../../locale-provider/context';
8
+ import { useTransferListContext } from '../root/context';
9
+ import { oppositeSide, type TransferListKey, type TransferListSide } from '../root/types';
10
+
11
+ /**
12
+ * The button behind TransferList.MoveSelected and TransferList.MoveAll.
13
+ *
14
+ * The two differ only in which keys they hand to `move` and in when they run out of
15
+ * work, so the shared parts — the accessible name, the disabled state and the focus
16
+ * hand-off — live here once.
17
+ */
18
+ type MoveButtonProps = Omit<
19
+ HTMLButtonAttributes,
20
+ 'children' | 'class' | 'disabled' | 'aria-disabled' | 'type'
21
+ > & {
22
+ /** Which list the items go to. */
23
+ to: TransferListSide;
24
+ /** Whether it moves the selection or everything movable. */
25
+ scope: 'selected' | 'all';
26
+ /** Button content — an arrow, a label, whatever the layout calls for. */
27
+ children?: Snippet;
28
+ /** CSS class for the button. */
29
+ class?: string;
30
+ /** Bindable reference to the rendered button element. */
31
+ element?: HTMLButtonElement | null;
32
+ };
33
+
34
+ let {
35
+ to,
36
+ scope,
37
+ children,
38
+ 'aria-label': ariaLabelExternal,
39
+ onclick: onClickExternal,
40
+ element = $bindable<HTMLButtonElement | null>(null),
41
+ ...restProps
42
+ }: MoveButtonProps = $props();
43
+
44
+ const ctx = useTransferListContext('TransferList.MoveSelected / TransferList.MoveAll');
45
+
46
+ const localeContext = useLocaleContextOptional();
47
+ const emptyLocaleStore = readable<string | undefined>(undefined);
48
+ const localeStore = localeContext?.locale ?? emptyLocaleStore;
49
+
50
+ const from = $derived(oppositeSide(to));
51
+ const keys = $derived<TransferListKey[]>(
52
+ scope === 'selected' ? ctx.getMovableSelection(from) : ctx.getMovableKeys(from)
53
+ );
54
+ const disabled = $derived(keys.length === 0);
55
+
56
+ // Named after the destination list rather than after a direction: an arrow glyph says
57
+ // nothing on its own, and "move right" is wrong the moment the layout is mirrored.
58
+ //
59
+ // Undefined until that list has registered its name, which on the server means until it
60
+ // has rendered — a button that precedes its destination in the markup would otherwise
61
+ // ship "Move selected to " and only become meaningful after hydration. With no
62
+ // `aria-label` the button is named by its own content instead, which is at least true.
63
+ const destinationLabel = $derived(ctx.getLabel(to));
64
+ const defaultLabel = $derived(
65
+ destinationLabel
66
+ ? resolveLocalizedString(
67
+ $localeStore,
68
+ scope === 'selected' ? 'transferList.moveSelectedTo' : 'transferList.moveAllTo',
69
+ { label: destinationLabel }
70
+ )
71
+ : undefined
72
+ );
73
+
74
+ let buttonRef = $state<HTMLButtonElement | null>(null);
75
+
76
+ function handleClick(event: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }) {
77
+ // Focus stays on the button, as it does for any button press. Nothing has to be handed
78
+ // off, because `aria-disabled` leaves it focusable.
79
+ if (!disabled) ctx.move(keys, to);
80
+ onClickExternal?.(event);
81
+ }
82
+
83
+ $effect(() => {
84
+ element = buttonRef;
85
+ });
86
+ </script>
87
+
88
+ <!-- `aria-disabled` rather than the native attribute: a move button spends most of its life
89
+ unavailable, and a natively disabled one leaves the tab order entirely. Half the actions
90
+ would be undiscoverable to someone exploring with a keyboard, and the tab order would
91
+ shift under them as they work. -->
92
+ <ButtonRoot
93
+ bind:element={buttonRef}
94
+ {disabled}
95
+ focusableWhenDisabled
96
+ aria-label={ariaLabelExternal ?? defaultLabel}
97
+ data-transfer-move={scope}
98
+ data-direction={to === 'target' ? 'to-target' : 'to-source'}
99
+ onclick={handleClick}
100
+ {...restProps}
101
+ >
102
+ {@render children?.()}
103
+ </ButtonRoot>
@@ -0,0 +1,25 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLButtonAttributes } from 'svelte/elements';
3
+ import { type TransferListSide } from '../root/types';
4
+ /**
5
+ * The button behind TransferList.MoveSelected and TransferList.MoveAll.
6
+ *
7
+ * The two differ only in which keys they hand to `move` and in when they run out of
8
+ * work, so the shared parts — the accessible name, the disabled state and the focus
9
+ * hand-off — live here once.
10
+ */
11
+ type MoveButtonProps = Omit<HTMLButtonAttributes, 'children' | 'class' | 'disabled' | 'aria-disabled' | 'type'> & {
12
+ /** Which list the items go to. */
13
+ to: TransferListSide;
14
+ /** Whether it moves the selection or everything movable. */
15
+ scope: 'selected' | 'all';
16
+ /** Button content — an arrow, a label, whatever the layout calls for. */
17
+ children?: Snippet;
18
+ /** CSS class for the button. */
19
+ class?: string;
20
+ /** Bindable reference to the rendered button element. */
21
+ element?: HTMLButtonElement | null;
22
+ };
23
+ declare const TransferListMoveButton: import("svelte").Component<MoveButtonProps, {}, "element">;
24
+ type TransferListMoveButton = ReturnType<typeof TransferListMoveButton>;
25
+ export default TransferListMoveButton;
@@ -0,0 +1,14 @@
1
+ <script lang="ts">
2
+ import type { ComponentProps } from 'svelte';
3
+ import ReorderButton from './transfer-list-reorder-button.svelte';
4
+
5
+ /**
6
+ * TransferList.MoveDown - Shifts the right-hand selection one position later in `value`.
7
+ * Disabled while nothing is selected there, or while the selection already ends the list.
8
+ */
9
+ type TransferListMoveDownProps = Omit<ComponentProps<typeof ReorderButton>, 'direction'>;
10
+
11
+ let props: TransferListMoveDownProps = $props();
12
+ </script>
13
+
14
+ <ReorderButton direction="down" {...props} />
@@ -0,0 +1,10 @@
1
+ import type { ComponentProps } from 'svelte';
2
+ import ReorderButton from './transfer-list-reorder-button.svelte';
3
+ /**
4
+ * TransferList.MoveDown - Shifts the right-hand selection one position later in `value`.
5
+ * Disabled while nothing is selected there, or while the selection already ends the list.
6
+ */
7
+ type TransferListMoveDownProps = Omit<ComponentProps<typeof ReorderButton>, 'direction'>;
8
+ declare const TransferListMoveDown: import("svelte").Component<TransferListMoveDownProps, {}, "">;
9
+ type TransferListMoveDown = ReturnType<typeof TransferListMoveDown>;
10
+ export default TransferListMoveDown;
@@ -0,0 +1,14 @@
1
+ <script lang="ts">
2
+ import type { ComponentProps } from 'svelte';
3
+ import MoveButton from './transfer-list-move-button.svelte';
4
+
5
+ /**
6
+ * TransferList.MoveSelected - Moves the selected items of the opposite list to `to`.
7
+ * Disabled while that list has nothing movable selected.
8
+ */
9
+ type TransferListMoveSelectedProps = Omit<ComponentProps<typeof MoveButton>, 'scope'>;
10
+
11
+ let props: TransferListMoveSelectedProps = $props();
12
+ </script>
13
+
14
+ <MoveButton scope="selected" {...props} />
@@ -0,0 +1,10 @@
1
+ import type { ComponentProps } from 'svelte';
2
+ import MoveButton from './transfer-list-move-button.svelte';
3
+ /**
4
+ * TransferList.MoveSelected - Moves the selected items of the opposite list to `to`.
5
+ * Disabled while that list has nothing movable selected.
6
+ */
7
+ type TransferListMoveSelectedProps = Omit<ComponentProps<typeof MoveButton>, 'scope'>;
8
+ declare const TransferListMoveSelected: import("svelte").Component<TransferListMoveSelectedProps, {}, "">;
9
+ type TransferListMoveSelected = ReturnType<typeof TransferListMoveSelected>;
10
+ export default TransferListMoveSelected;
@@ -0,0 +1,14 @@
1
+ <script lang="ts">
2
+ import type { ComponentProps } from 'svelte';
3
+ import ReorderButton from './transfer-list-reorder-button.svelte';
4
+
5
+ /**
6
+ * TransferList.MoveUp - Shifts the right-hand selection one position earlier in `value`.
7
+ * Disabled while nothing is selected there, or while the selection already starts the list.
8
+ */
9
+ type TransferListMoveUpProps = Omit<ComponentProps<typeof ReorderButton>, 'direction'>;
10
+
11
+ let props: TransferListMoveUpProps = $props();
12
+ </script>
13
+
14
+ <ReorderButton direction="up" {...props} />
@@ -0,0 +1,10 @@
1
+ import type { ComponentProps } from 'svelte';
2
+ import ReorderButton from './transfer-list-reorder-button.svelte';
3
+ /**
4
+ * TransferList.MoveUp - Shifts the right-hand selection one position earlier in `value`.
5
+ * Disabled while nothing is selected there, or while the selection already starts the list.
6
+ */
7
+ type TransferListMoveUpProps = Omit<ComponentProps<typeof ReorderButton>, 'direction'>;
8
+ declare const TransferListMoveUp: import("svelte").Component<TransferListMoveUpProps, {}, "">;
9
+ type TransferListMoveUp = ReturnType<typeof TransferListMoveUp>;
10
+ export default TransferListMoveUp;
@@ -0,0 +1,83 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { HTMLButtonAttributes } from 'svelte/elements';
4
+ import { readable } from 'svelte/store';
5
+ import { ButtonRoot } from '../../button';
6
+ import { resolveLocalizedString } from '../../internal/localized-strings';
7
+ import { useLocaleContextOptional } from '../../locale-provider/context';
8
+ import { useTransferListContext } from '../root/context';
9
+
10
+ /**
11
+ * The button behind TransferList.MoveUp and TransferList.MoveDown.
12
+ *
13
+ * Reordering only makes sense on the right: the left-hand order is the order `items`
14
+ * were given in, while the right-hand one is state the user is building.
15
+ */
16
+ type ReorderButtonProps = Omit<
17
+ HTMLButtonAttributes,
18
+ 'children' | 'class' | 'disabled' | 'aria-disabled' | 'type'
19
+ > & {
20
+ /** Which way the selection moves. */
21
+ direction: 'up' | 'down';
22
+ /** Button content — an arrow, a label, whatever the layout calls for. */
23
+ children?: Snippet;
24
+ /** CSS class for the button. */
25
+ class?: string;
26
+ /** Bindable reference to the rendered button element. */
27
+ element?: HTMLButtonElement | null;
28
+ };
29
+
30
+ let {
31
+ direction,
32
+ children,
33
+ 'aria-label': ariaLabelExternal,
34
+ onclick: onClickExternal,
35
+ element = $bindable<HTMLButtonElement | null>(null),
36
+ ...restProps
37
+ }: ReorderButtonProps = $props();
38
+
39
+ const ctx = useTransferListContext('TransferList.MoveUp / TransferList.MoveDown');
40
+
41
+ const localeContext = useLocaleContextOptional();
42
+ const emptyLocaleStore = readable<string | undefined>(undefined);
43
+ const localeStore = localeContext?.locale ?? emptyLocaleStore;
44
+
45
+ // Disabled both when nothing is selected and when the selection is already flush against
46
+ // that end — a button that does nothing when pressed is worse than one that says so.
47
+ const disabled = $derived(!ctx.canReorder(direction));
48
+
49
+ const defaultLabel = $derived(
50
+ resolveLocalizedString(
51
+ $localeStore,
52
+ direction === 'up' ? 'transferList.moveUp' : 'transferList.moveDown'
53
+ )
54
+ );
55
+
56
+ let buttonRef = $state<HTMLButtonElement | null>(null);
57
+
58
+ function handleClick(event: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }) {
59
+ // The selection survives a reorder — unlike a move, the items are still there — so the
60
+ // button keeps its work and focus has nowhere else it should go.
61
+ if (!disabled) ctx.reorder(direction);
62
+ onClickExternal?.(event);
63
+ }
64
+
65
+ $effect(() => {
66
+ element = buttonRef;
67
+ });
68
+ </script>
69
+
70
+ <!-- `aria-disabled` rather than the native attribute, for the same reason as the move buttons:
71
+ these are unavailable more often than not, and dropping out of the tab order each time
72
+ would move the ground under a keyboard user. -->
73
+ <ButtonRoot
74
+ bind:element={buttonRef}
75
+ {disabled}
76
+ focusableWhenDisabled
77
+ aria-label={ariaLabelExternal ?? defaultLabel}
78
+ data-transfer-reorder={direction}
79
+ onclick={handleClick}
80
+ {...restProps}
81
+ >
82
+ {@render children?.()}
83
+ </ButtonRoot>
@@ -0,0 +1,21 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLButtonAttributes } from 'svelte/elements';
3
+ /**
4
+ * The button behind TransferList.MoveUp and TransferList.MoveDown.
5
+ *
6
+ * Reordering only makes sense on the right: the left-hand order is the order `items`
7
+ * were given in, while the right-hand one is state the user is building.
8
+ */
9
+ type ReorderButtonProps = Omit<HTMLButtonAttributes, 'children' | 'class' | 'disabled' | 'aria-disabled' | 'type'> & {
10
+ /** Which way the selection moves. */
11
+ direction: 'up' | 'down';
12
+ /** Button content — an arrow, a label, whatever the layout calls for. */
13
+ children?: Snippet;
14
+ /** CSS class for the button. */
15
+ class?: string;
16
+ /** Bindable reference to the rendered button element. */
17
+ element?: HTMLButtonElement | null;
18
+ };
19
+ declare const TransferListReorderButton: import("svelte").Component<ReorderButtonProps, {}, "element">;
20
+ type TransferListReorderButton = ReturnType<typeof TransferListReorderButton>;
21
+ export default TransferListReorderButton;
@@ -0,0 +1,70 @@
1
+ import type { ListBoxContext } from '../../listbox/root/context';
2
+ import type { TransferListKey, TransferListMoveDetails, TransferListSide } from './types';
3
+ /**
4
+ * Shared state for the two lists and the move buttons.
5
+ *
6
+ * The Root owns the single source of truth — which side each item is on — and every
7
+ * part reads its slice of it from here. Nothing else writes: a move goes through
8
+ * `move()` so the selection reset, the focus hand-off and the announcement all
9
+ * happen in one place.
10
+ */
11
+ export type TransferListContext<T = unknown> = {
12
+ /** Identity of an item. */
13
+ getKey: (item: T) => TransferListKey;
14
+ /** Items currently on the left, in the order they were given to the Root. */
15
+ sourceItems: T[];
16
+ /** Items currently on the right, in the order they were moved there. */
17
+ targetItems: T[];
18
+ /** Whether an item is pinned to its side. */
19
+ isDisabled: (key: TransferListKey) => boolean;
20
+ /** Items of one side. */
21
+ getItems: (side: TransferListSide) => T[];
22
+ /** Keys of one side that are allowed to move. */
23
+ getMovableKeys: (side: TransferListSide) => TransferListKey[];
24
+ /** Selected keys of one side that are allowed to move. */
25
+ getMovableSelection: (side: TransferListSide) => TransferListKey[];
26
+ /** Current selection of one side. */
27
+ getSelection: (side: TransferListSide) => TransferListKey[];
28
+ /** Replaces the selection of one side (called by that side's ListBox). */
29
+ setSelection: (side: TransferListSide, keys: TransferListKey[]) => void;
30
+ /** Accessible name of one side, used by the buttons and the live region too. */
31
+ getLabel: (side: TransferListSide) => string;
32
+ /** Registered by each list from its `label` prop. */
33
+ setLabel: (side: TransferListSide, label: string) => void;
34
+ /**
35
+ * The inner ListBox's context, kept so a move can put keyboard focus on a specific
36
+ * row of the destination — the same handle `ComboBox` takes to drive its list.
37
+ */
38
+ getListContext: (side: TransferListSide) => ListBoxContext | null;
39
+ setListContext: (side: TransferListSide, ctx: ListBoxContext | null) => void;
40
+ /** The list's own element, for when focus has to land on the list rather than a row. */
41
+ getListElement: (side: TransferListSide) => HTMLElement | null;
42
+ setListElement: (side: TransferListSide, element: HTMLElement | null) => void;
43
+ /**
44
+ * Moves items to `to`. Keys that are disabled, or that are not on the originating
45
+ * side, are dropped rather than moved.
46
+ */
47
+ move: (keys: Iterable<TransferListKey>, to: TransferListSide) => void;
48
+ /** Registers the keys a list is showing once its `filter` has run. */
49
+ setVisibleKeys: (side: TransferListSide, keys: TransferListKey[] | null) => void;
50
+ /** Shifts the right-hand selection one position within `value`. */
51
+ reorder: (direction: 'up' | 'down') => void;
52
+ /** Whether a reorder in that direction would change anything. */
53
+ canReorder: (direction: 'up' | 'down') => boolean;
54
+ /** Whether Ctrl/Cmd+Enter inside a list sends its selection to the other one. */
55
+ moveShortcut: boolean;
56
+ /** The last completed move, or `null` before the first one. Drives the live region. */
57
+ lastMove: TransferListMoveDetails | null;
58
+ /**
59
+ * Focuses the row at `index` on `side`, clamped to the last one. Returns `false` when
60
+ * that side has no rows left, which is the caller's cue to send focus somewhere else
61
+ * rather than leave it on the `<body>`.
62
+ */
63
+ focusItemAt: (side: TransferListSide, index: number) => boolean;
64
+ /** Focuses the list itself. */
65
+ focusList: (side: TransferListSide) => void;
66
+ };
67
+ export declare function setTransferListSide(side: TransferListSide): void;
68
+ export declare function useTransferListSide(part: string): TransferListSide;
69
+ export declare function setTransferListContext<T>(ctx: TransferListContext<T>): void;
70
+ export declare function useTransferListContext<T = unknown>(part: string): TransferListContext<T>;
@@ -0,0 +1,24 @@
1
+ import { getContext, setContext } from 'svelte';
2
+ /** Which list a part belongs to. Set by each list, read by the items inside it. */
3
+ const SIDE_KEY = Symbol('transfer-list-side');
4
+ export function setTransferListSide(side) {
5
+ setContext(SIDE_KEY, side);
6
+ }
7
+ export function useTransferListSide(part) {
8
+ const side = getContext(SIDE_KEY);
9
+ if (!side) {
10
+ throw new Error(`${part} must be used inside a TransferList.Source or TransferList.Target`);
11
+ }
12
+ return side;
13
+ }
14
+ const KEY = Symbol('transfer-list');
15
+ export function setTransferListContext(ctx) {
16
+ setContext(KEY, ctx);
17
+ }
18
+ export function useTransferListContext(part) {
19
+ const ctx = getContext(KEY);
20
+ if (!ctx) {
21
+ throw new Error(`${part} must be used inside a TransferList.Root`);
22
+ }
23
+ return ctx;
24
+ }