@cloudwick/astral-ui 7.0.1 → 8.1.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 (90) hide show
  1. package/README.md +3 -1
  2. package/dist/components/accordion/accordion.d.ts +5 -1
  3. package/dist/components/breadcrumbs/breadcrumbs.d.ts +5 -6
  4. package/dist/components/button/reloadButton.d.ts +20 -0
  5. package/dist/components/card/card.d.ts +7 -8
  6. package/dist/components/card/cardVariants.d.ts +3 -3
  7. package/dist/components/dropdown/dropdown.d.ts +17 -0
  8. package/dist/components/emptyState/emptyState.d.ts +1 -4
  9. package/dist/components/emptyState/emptyStateVariants.d.ts +3 -3
  10. package/dist/components/modal/modal.d.ts +6 -7
  11. package/dist/components/multiSelectTransfer/index.d.ts +3 -0
  12. package/dist/components/multiSelectTransfer/multiSelectTransfer.d.ts +7 -0
  13. package/dist/components/multiSelectTransfer/multiSelectTransferDropdown.d.ts +50 -0
  14. package/dist/components/multiSelectTransfer/multiSelectTransferModal.d.ts +46 -0
  15. package/dist/components/multiSelectTransfer/multiSelectTransferPill.d.ts +28 -0
  16. package/dist/components/multiSelectTransfer/multiSelectTransferTrigger.d.ts +26 -0
  17. package/dist/components/multiSelectTransfer/multiSelectTransferVariants.d.ts +202 -0
  18. package/dist/components/multiSelectTransfer/types.d.ts +138 -0
  19. package/dist/components/multiSelectTransfer/useMultiSelectTransferDraft.d.ts +24 -0
  20. package/dist/components/multiSelectTransfer/useMultiSelectTransferOptionSource.d.ts +56 -0
  21. package/dist/components/panel/panel.d.ts +1 -2
  22. package/dist/components/radioGroup/index.d.ts +1 -1
  23. package/dist/components/radioGroup/radioGroup.d.ts +76 -12
  24. package/dist/components/radioGroup/radioGroupVariants.d.ts +30 -9
  25. package/dist/components/scrollbar/scrollbar.d.ts +7 -0
  26. package/dist/components/select/index.d.ts +2 -2
  27. package/dist/components/select/select.d.ts +7 -46
  28. package/dist/components/select/selectComponents.d.ts +29 -0
  29. package/dist/components/select/selectMenu.d.ts +12 -0
  30. package/dist/components/select/selectVariants.d.ts +21 -0
  31. package/dist/components/select/types.d.ts +252 -1
  32. package/dist/components/select/useSelectOptionSource.d.ts +39 -0
  33. package/dist/components/select/useSelectOutsideClose.d.ts +16 -0
  34. package/dist/components/select/utils.d.ts +3 -0
  35. package/dist/components/tabs/tabs.d.ts +4 -5
  36. package/dist/components/tabs/tabsVariants.d.ts +12 -0
  37. package/dist/components/tooltip/tooltip.d.ts +17 -6
  38. package/dist/components/tooltip/tooltipVariants.d.ts +6 -6
  39. package/dist/components/transferList/index.d.ts +3 -0
  40. package/dist/components/transferList/transferList.d.ts +9 -0
  41. package/dist/components/transferList/transferListItem.d.ts +35 -0
  42. package/dist/components/transferList/transferListPanel.d.ts +64 -0
  43. package/dist/components/transferList/transferListPanelHeader.d.ts +29 -0
  44. package/dist/components/transferList/transferListVariants.d.ts +211 -0
  45. package/dist/components/transferList/types.d.ts +152 -0
  46. package/dist/components/transferList/useDragAutoScroll.d.ts +13 -0
  47. package/dist/components/transferList/useTransferList.d.ts +28 -0
  48. package/dist/components/transferList/useTransferListPanelKeys.d.ts +28 -0
  49. package/dist/components/transferList/useTransferListSource.d.ts +49 -0
  50. package/dist/css/fonts.min.css +1 -1
  51. package/dist/css/index.min.css +1 -1
  52. package/dist/fonts/NotoSans-Bold.woff2 +0 -0
  53. package/dist/fonts/NotoSans-BoldItalic.woff2 +0 -0
  54. package/dist/fonts/NotoSans-Italic.woff2 +0 -0
  55. package/dist/fonts/NotoSans-Medium.woff2 +0 -0
  56. package/dist/fonts/NotoSans-MediumItalic.woff2 +0 -0
  57. package/dist/fonts/NotoSans-Regular.woff2 +0 -0
  58. package/dist/fonts/NotoSans-SemiBold.woff2 +0 -0
  59. package/dist/fonts/NotoSans-SemiBoldItalic.woff2 +0 -0
  60. package/dist/hooks/index.d.ts +10 -0
  61. package/dist/hooks/useAsyncOptions.d.ts +85 -0
  62. package/dist/hooks/useAsyncOptionsReducer.d.ts +75 -0
  63. package/dist/hooks/useAvailableProjection.d.ts +20 -0
  64. package/dist/hooks/useDebouncedCallback.d.ts +10 -0
  65. package/dist/hooks/useFilterQuery.d.ts +28 -0
  66. package/dist/hooks/useIgnoredPropWarning.d.ts +5 -0
  67. package/dist/hooks/useInfiniteScroll.d.ts +33 -0
  68. package/dist/hooks/useIsTruncated.d.ts +25 -0
  69. package/dist/hooks/useListboxKeyboardNav.d.ts +47 -0
  70. package/dist/hooks/useOnValueChange.d.ts +6 -0
  71. package/dist/hooks/usePrefetchBaseline.d.ts +22 -0
  72. package/dist/index.cjs.js +5 -5
  73. package/dist/index.d.ts +3 -0
  74. package/dist/index.esm.js +5 -5
  75. package/dist/utils/devWarn.d.ts +5 -0
  76. package/dist/utils/elementUtils.d.ts +18 -0
  77. package/dist/utils/index.d.ts +7 -1
  78. package/dist/utils/matchesQuery.d.ts +13 -0
  79. package/dist/utils/mergeUnique.d.ts +6 -0
  80. package/dist/utils/resolveLoadErrors.d.ts +20 -0
  81. package/dist/utils/resolveReloadControls.d.ts +23 -0
  82. package/package.json +3 -3
  83. package/dist/fonts/Inter_18pt-Bold.ttf +0 -0
  84. package/dist/fonts/Inter_18pt-BoldItalic.ttf +0 -0
  85. package/dist/fonts/Inter_18pt-Italic.ttf +0 -0
  86. package/dist/fonts/Inter_18pt-Medium.ttf +0 -0
  87. package/dist/fonts/Inter_18pt-MediumItalic.ttf +0 -0
  88. package/dist/fonts/Inter_18pt-Regular.ttf +0 -0
  89. package/dist/fonts/Inter_18pt-SemiBold.ttf +0 -0
  90. package/dist/fonts/Inter_18pt-SemiBoldItalic.ttf +0 -0
@@ -0,0 +1,138 @@
1
+ import type { ReactNode } from "react";
2
+ import type { TLoadOptions, TPrefetch } from "@hooks";
3
+ import type { ITransferListItem } from "../transferList/types";
4
+ export declare enum EMultiSelectTransferSizes {
5
+ MD = "md",
6
+ LG = "lg"
7
+ }
8
+ export type TMultiSelectTransferSize = `${EMultiSelectTransferSizes}`;
9
+ export type TMultiSelectTransferOption = ITransferListItem;
10
+ /**
11
+ * Async option source. Paged: `cursor`, `hasMore` and `total` on the resolved page are all honoured.
12
+ */
13
+ export type TMultiSelectTransferLoadOptions = TLoadOptions<TMultiSelectTransferOption>;
14
+ export interface IMultiSelectTransferProps {
15
+ /** Unique id for the trigger. A generated id is used when omitted. */
16
+ id?: string;
17
+ /** Custom className for the wrapper. */
18
+ className?: string;
19
+ /** Label displayed above the trigger. */
20
+ label?: ReactNode;
21
+ /** Text shown in the trigger while nothing is selected. @default "Select..." */
22
+ placeholder?: string;
23
+ /** Helper text displayed below the trigger. */
24
+ helperText?: ReactNode;
25
+ /** Display error styling. @default false */
26
+ error?: boolean;
27
+ /** Disable all interaction. @default false */
28
+ disabled?: boolean;
29
+ /** Trigger size variant. @default "md" */
30
+ size?: TMultiSelectTransferSize;
31
+ /**
32
+ * Options to choose from; treated as the result for the current query in server mode. Ignored (with
33
+ * a dev warning) when `loadOptions` is set — pass `initialOptions` to seed the list instead.
34
+ */
35
+ options?: TMultiSelectTransferOption[];
36
+ /** Selected options. Passing this makes the component controlled. */
37
+ value?: TMultiSelectTransferOption[];
38
+ /** Fired with the next selection when the dropdown or modal commits. */
39
+ onChange?: (selected: TMultiSelectTransferOption[]) => void;
40
+ /** Seeds/re-syncs dropdown search; semi-controlled — pair with onFilterChange. */
41
+ filterValue?: string;
42
+ /**
43
+ * Debounced search-query callback; also called with "" when the component clears search (dropdown
44
+ * commit/cancel, or opening the transfer list modal).
45
+ *
46
+ * Without `loadOptions`: switches off local filtering — `options` is treated as already filtered
47
+ * for the query — and the fetch, loading state, paging, and response ordering are the consumer's
48
+ * responsibility.
49
+ *
50
+ * With `loadOptions`: notification-only, for analytics or `filterValue` syncing.
51
+ */
52
+ onFilterChange?: (query: string) => void;
53
+ /** Placeholder for the dropdown filter input and the transfer list modal's panel search inputs. @default "Search..." */
54
+ searchPlaceholder?: string;
55
+ /** Debounce for the search query, in both sync and `loadOptions` mode. Set to 0 to disable. @default 300 */
56
+ filterDebounceMs?: number;
57
+ /** Whether more options can be loaded; arms the dropdown's infinite-scroll sentinel. Ignored when `loadOptions` is set. @default false */
58
+ hasMore?: boolean;
59
+ /** Fired when the infinite-scroll sentinel at the bottom of the option list scrolls into view. Ignored when `loadOptions` is set. */
60
+ onLoadMore?: () => void;
61
+ /** Loader replaces rows on search fetch, appends on load-more. OR-ed with the loader's own state, so it still applies in async mode. @default false */
62
+ isLoading?: boolean;
63
+ /** Max pills shown in the trigger before showing "+N More". @default 3 */
64
+ maxVisiblePills?: number;
65
+ /** Title rendered in the transfer list modal header. */
66
+ transferListTitle?: ReactNode;
67
+ /** Subtitle rendered under the modal title. */
68
+ transferListSubtitle?: ReactNode;
69
+ /** Fully custom modal header node; overrides title/subtitle when provided. */
70
+ transferListHeader?: ReactNode;
71
+ /** Called when the transfer list CTA is clicked (before the modal opens). */
72
+ onOpenTransferList?: () => void;
73
+ /** Enable reordering (drag + arrows) of selected items in the transfer list. */
74
+ reorderable?: boolean;
75
+ /** The reload button is shown when this is provided. Fired when the reload button is clicked. */
76
+ onReload?: () => void;
77
+ /** Spins the transfer list reload icon. */
78
+ isReloading?: boolean;
79
+ /** Tooltip for the transfer list reload button. */
80
+ reloadTooltip?: string;
81
+ /** Custom content rendered under the transfer list available panel search. */
82
+ availablePanelHeaderSlot?: ReactNode;
83
+ /** Custom content rendered under the transfer list selected panel search. */
84
+ selectedPanelHeaderSlot?: ReactNode;
85
+ /** Label for the modal cancel button. @default "Cancel" */
86
+ cancelLabel?: ReactNode;
87
+ /** Label for the modal commit button. @default "Done" */
88
+ doneLabel?: ReactNode;
89
+ /**
90
+ * Server-side option source. When provided, the component owns the option list, paging, the request
91
+ * lifecycle and the loading state; `options` / `hasMore` / `onLoadMore` / `isLoading` are ignored and
92
+ * `onFilterChange` becomes notification-only. Responsible for mapping the payload to
93
+ * `TMultiSelectTransferOption` — envelopes and domain filtering are the consumer's business. Options
94
+ * are stored exactly as returned, so extra fields survive. A fresh inline arrow is fine: the loader
95
+ * is read through a ref.
96
+ */
97
+ loadOptions?: TMultiSelectTransferLoadOptions;
98
+ /**
99
+ * Seed rows for a list you already have — an SSR payload, a route loader, a warm cache. They paint on the
100
+ * first frame of both surfaces instead of a loader, and stay put while the baseline fetch revalidates over
101
+ * them (the dropdown's spinner appends below the rows, as it does for any load in flight). They do not
102
+ * suppress that fetch: pair with `prefetch="never"` if the seed is the whole list until the user types.
103
+ * Seed rows carry no cursor, so nothing pages until a real page lands.
104
+ * A *search* replaces them, since seed rows are not results for a query; clearing it brings them back until
105
+ * a fetched baseline does. Async mode only — ignored (dev warning) without `loadOptions`, where the rows
106
+ * belong in `options`.
107
+ */
108
+ initialOptions?: readonly TMultiSelectTransferOption[];
109
+ /**
110
+ * When to fetch the unfiltered first page.
111
+ * - `"open"` — when the dropdown or the transfer-list modal first opens, whichever comes first.
112
+ * - `"mount"` — at render, so the first open shows rows instead of a loader. The trigger renders its
113
+ * committed chips either way, so this buys latency rather than fixing an empty-looking control.
114
+ * - `"never"` — no baseline at all; fetch only once the user types. For heavy lists.
115
+ *
116
+ * Async mode only — ignored (dev warning) without `loadOptions`, where `options` are already on screen
117
+ * and there is nothing to fetch.
118
+ * @default "open"
119
+ */
120
+ prefetch?: TPrefetch;
121
+ /** Clearing the search revalidates the cached baseline instead of just restoring it. @default false */
122
+ refetchOnClear?: boolean;
123
+ /**
124
+ * Identity of the option set, for dependent pickers. When it changes, cached pages are dropped and the
125
+ * list is repopulated. Compose several parents into one scalar. Does NOT clear the selection.
126
+ */
127
+ optionsKey?: string | number;
128
+ /** Shown in place of the rows when `loadOptions` rejects. @default "Couldn't load options." */
129
+ loadErrorMessage?: ReactNode;
130
+ /** Shown under the loaded rows when a page append rejects; a failed page never blanks the list. @default "Couldn't load more." */
131
+ loadMoreErrorMessage?: ReactNode;
132
+ /** Label for the retry button beside `loadMoreErrorMessage`. @default "Retry" */
133
+ retryLabel?: string;
134
+ /** Shows the reload button in async mode, wired to re-run the current query from page one. @default false */
135
+ showReloadButton?: boolean;
136
+ /** Notified when a load rejects (the component renders the message and swallows it). */
137
+ onLoadError?: (error: unknown) => void;
138
+ }
@@ -0,0 +1,24 @@
1
+ import type { TMultiSelectTransferOption } from "./types";
2
+ interface IMultiSelectTransferDraft {
3
+ /** Derived: the loaded pool plus the opening snapshot, minus whatever is in the draft selection. */
4
+ draftAvailable: TMultiSelectTransferOption[];
5
+ /** Owned: the ordered draft selection. Order matters when `reorderable`. */
6
+ draftSelected: TMultiSelectTransferOption[];
7
+ /** Wire to `TransferList`'s onChange; only its second argument is needed. */
8
+ onDraftChange: (nextAvailable: TMultiSelectTransferOption[], nextSelected: TMultiSelectTransferOption[]) => void;
9
+ /** Seed the draft from the committed selection. Call when opening the modal. */
10
+ seedDraft: (committed: TMultiSelectTransferOption[]) => void;
11
+ }
12
+ /**
13
+ * The transfer-list modal's draft, as a **projection** of the loaded option pool rather than a second
14
+ * array kept in sync with it. A paged-in option appears in Available automatically; an option the
15
+ * user moved right is never re-offered; and an `optionsKey` change re-seeds by construction. An
16
+ * option that left Selected but is not in the pool is covered by the opening snapshot, since the
17
+ * only way into the draft is the pool or the committed value.
18
+ *
19
+ * `searchQuery` is the panel's active server query (empty when the search is client-side, where
20
+ * TransferList filters for us); it keeps the snapshot from surfacing an option the server's answer
21
+ * for that query would not have returned.
22
+ */
23
+ export declare function useMultiSelectTransferDraft(pool: readonly TMultiSelectTransferOption[], isOpen: boolean, searchQuery?: string): IMultiSelectTransferDraft;
24
+ export {};
@@ -0,0 +1,56 @@
1
+ import { type ReactNode } from "react";
2
+ import { type TPrefetch } from "@hooks";
3
+ import type { TMultiSelectTransferLoadOptions, TMultiSelectTransferOption } from "./types";
4
+ interface IUseMultiSelectTransferOptionSourceArgs {
5
+ options?: TMultiSelectTransferOption[];
6
+ loadOptions?: TMultiSelectTransferLoadOptions;
7
+ initialOptions?: readonly TMultiSelectTransferOption[];
8
+ prefetch?: TPrefetch;
9
+ refetchOnClear?: boolean;
10
+ optionsKey?: string | number;
11
+ loadErrorMessage?: ReactNode;
12
+ loadMoreErrorMessage?: ReactNode;
13
+ showReloadButton?: boolean;
14
+ onLoadError?: (error: unknown) => void;
15
+ /** Legacy (consumer-driven) paging and loading. Ignored in async mode. */
16
+ hasMore?: boolean;
17
+ onLoadMore?: () => void;
18
+ isLoading?: boolean;
19
+ onReload?: () => void;
20
+ isReloading?: boolean;
21
+ onFilterChange?: (query: string) => void;
22
+ }
23
+ interface IMultiSelectTransferOptionSource {
24
+ options: readonly TMultiSelectTransferOption[];
25
+ /** The mode decision, made once here — the component must never re-test `loadOptions` itself. */
26
+ isAsync: boolean;
27
+ isServerFiltered: boolean;
28
+ /** Any load in flight — feeds aria-busy on the option list. */
29
+ isLoading: boolean;
30
+ /** Loader INSTEAD of rows: a search/reload fetch, not a page append. */
31
+ isSearchFetch: boolean;
32
+ /** Loader BELOW the rows, and the infinite-scroll observer's in-flight gate. */
33
+ isLoadingMore: boolean;
34
+ hasMore: boolean;
35
+ total: number | undefined;
36
+ onLoadMore?: () => void;
37
+ onRetryLoadMore?: () => void;
38
+ isReloading?: boolean;
39
+ onReload?: () => void;
40
+ onFilterQueryChange: (query: string) => void;
41
+ ensureDefaults: () => void;
42
+ /** Set when the whole list failed. Mutually exclusive with `loadMoreError`. */
43
+ loadError?: ReactNode;
44
+ /** Set when a page append failed. The rows the user was reading stay on screen. */
45
+ loadMoreError?: ReactNode;
46
+ /** Ends legacy load-more mode: typing or clearing means the next fetch replaces rows, not appends. */
47
+ clearLoadMoreMode: () => void;
48
+ }
49
+ /**
50
+ * MultiSelectTransfer's option-source policy: async vs legacy `options` / `isLoading` / `hasMore` /
51
+ * `onLoadMore`, the replace-vs-append loader question, and the paging trio. In async mode the hook
52
+ * knows the request *kind* directly; the legacy path still needs a ref latch, since `isLoading` is a
53
+ * bare boolean there and the kind has to be inferred from its edges.
54
+ */
55
+ export declare function useMultiSelectTransferOptionSource({ options, loadOptions, initialOptions, prefetch, refetchOnClear, optionsKey, loadErrorMessage, loadMoreErrorMessage, showReloadButton, onLoadError, hasMore, onLoadMore, isLoading, onReload, isReloading, onFilterChange }: IUseMultiSelectTransferOptionSourceArgs): IMultiSelectTransferOptionSource;
56
+ export {};
@@ -51,8 +51,7 @@ export interface IPanelProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
51
51
  */
52
52
  onClose?: (e: React.MouseEvent<HTMLDivElement> | KeyboardEvent) => void;
53
53
  }
54
- declare const PanelComponent: React.ForwardRefExoticComponent<IPanelProps & React.RefAttributes<HTMLDivElement>>;
55
- type TPanelCompoundComponent = typeof PanelComponent & {
54
+ type TPanelCompoundComponent = React.ForwardRefExoticComponent<React.PropsWithoutRef<IPanelProps> & React.RefAttributes<HTMLDivElement>> & {
56
55
  Header: typeof PanelHeader;
57
56
  Body: typeof PanelBody;
58
57
  Footer: typeof PanelFooter;
@@ -1,2 +1,2 @@
1
- export { RadioGroup, type IRadioGroupProps, type TRadioGroupSize } from "./radioGroup";
1
+ export { RadioGroup, type TRadioGroupProps, type TRadioGroupSize } from "./radioGroup";
2
2
  export { radioGroupVariants } from "./radioGroupVariants";
@@ -3,14 +3,24 @@ import { type ReactElement } from "react";
3
3
  import { type IRadioProps } from "../radio";
4
4
  export type TRadioGroupSize = "sm" | "md" | "lg";
5
5
  /**
6
- * RadioGroup component props
6
+ * Marks a prop as unsupported for the current variant.
7
+ *
8
+ * We encode the reason as the property's *type* (a descriptive string literal)
9
+ * rather than using `never`. With `never`, the compiler can't narrow the
10
+ * discriminated union to the branch you're actually using, so it reports the
11
+ * mismatch against the wrong branch (e.g. `Type 'string' is not assignable to
12
+ * type '"neutral" | "primary"'`) — which never mentions the real problem.
13
+ * A string-literal type keeps the branch narrowable, so the error reads
14
+ * `Type '"primary"' is not assignable to type '<this message>'` instead.
7
15
  */
8
- export interface IRadioGroupProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "onChange"> {
9
- /**
10
- * Size of the Radio group.
11
- * @default md
12
- */
13
- size?: TRadioGroupSize;
16
+ type TUnsupportedProp<TReason extends string> = TReason;
17
+ /**
18
+ * Props common to every RadioGroup variant.
19
+ *
20
+ * `color` is stripped from the inherited HTML attributes so each variant can
21
+ * re-declare it (or forbid it) — see the variant-specific prop types below.
22
+ */
23
+ interface IRadioGroupBaseProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "onChange" | "color"> {
14
24
  /**
15
25
  * Pass space separated class names to override the RadioGroup styling
16
26
  */
@@ -33,21 +43,75 @@ export interface IRadioGroupProps extends Omit<React.InputHTMLAttributes<HTMLInp
33
43
  * A selected value is passed as an argument to the function.
34
44
  */
35
45
  onChange?: (arg: string) => void;
46
+ }
47
+ /**
48
+ * Props for the `outline` and `text` variants: a vertical list of radio
49
+ * options. These support `size` and `radioPlacement`; they do **not** support
50
+ * `color` (setting it is a type error — `color` is `segmented`-only).
51
+ */
52
+ export interface IRadioGroupListProps extends IRadioGroupBaseProps {
53
+ /**
54
+ * Variant of the RadioGroup.
55
+ * - `outline`: each option sits in its own bordered box.
56
+ * - `text`: all options share one bordered container.
57
+ * @default outline
58
+ */
59
+ variant?: "outline" | "text";
60
+ /**
61
+ * Size of the Radio group.
62
+ * @default md
63
+ */
64
+ size?: TRadioGroupSize;
36
65
  /**
37
- * Placement of the radio
66
+ * Placement of the radio relative to its label.
38
67
  * @default "start"
39
68
  */
40
69
  radioPlacement?: "start" | "end";
41
70
  /**
42
- * Variant of the RadioGroup
43
- * @default outline
71
+ * Not supported by the `outline`/`text` variants — `color` only applies to
72
+ * the `segmented` variant.
44
73
  */
45
- variant?: "outline" | "text";
74
+ color?: TUnsupportedProp<"`color` is only supported when `variant` is \"segmented\"">;
75
+ }
76
+ /**
77
+ * Props for the `segmented` variant: a bordered, equal-width pill selector
78
+ * (segmented control) that visually hides the radio dot. It supports `color`;
79
+ * it does **not** support `size` or `radioPlacement` (the pills are a fixed
80
+ * height and the radio dot is hidden, so both are type errors here).
81
+ */
82
+ export interface IRadioGroupSegmentedProps extends IRadioGroupBaseProps {
83
+ variant: "segmented";
84
+ /**
85
+ * Active-pill color. `neutral` gives the active pill a white/dark card;
86
+ * `primary` fills it with the brand color.
87
+ * @default neutral
88
+ */
89
+ color?: "neutral" | "primary";
90
+ /**
91
+ * Not supported by the `segmented` variant — pills have a fixed height.
92
+ */
93
+ size?: TUnsupportedProp<"`size` is not supported by the \"segmented\" variant (pills have a fixed height)">;
94
+ /**
95
+ * Not supported by the `segmented` variant — the radio dot is hidden.
96
+ */
97
+ radioPlacement?: TUnsupportedProp<"`radioPlacement` is not supported by the \"segmented\" variant (the radio dot is hidden)">;
46
98
  }
99
+ /**
100
+ * RadioGroup component props. This is a discriminated union on `variant`, so
101
+ * the compiler only allows the props that apply to the chosen variant:
102
+ *
103
+ * | variant | `size` | `radioPlacement` | `color` |
104
+ * | ------------------- | :----: | :--------------: | :-----: |
105
+ * | `outline` (default) | yes | yes | no |
106
+ * | `text` | yes | yes | no |
107
+ * | `segmented` | no | no | yes |
108
+ */
109
+ export type TRadioGroupProps = IRadioGroupListProps | IRadioGroupSegmentedProps;
47
110
  /**
48
111
  * RadioGroup component for grouping radio button options
49
112
  */
50
113
  export declare const RadioGroup: {
51
- ({ size, options, onChange, className, selectedValue, disabled, radioPlacement, variant }: IRadioGroupProps): ReactElement;
114
+ ({ size, options, onChange, className, selectedValue, disabled, radioPlacement, variant, color, name }: TRadioGroupProps): ReactElement;
52
115
  displayName: string;
53
116
  };
117
+ export {};
@@ -8,6 +8,15 @@ export declare const radioGroupVariants: import("tailwind-variants").TVReturnTyp
8
8
  root: string;
9
9
  item: string;
10
10
  };
11
+ segmented: {
12
+ root: string[];
13
+ item: string[];
14
+ label: string;
15
+ };
16
+ };
17
+ color: {
18
+ neutral: {};
19
+ primary: {};
11
20
  };
12
21
  size: {
13
22
  sm: {
@@ -21,9 +30,7 @@ export declare const radioGroupVariants: import("tailwind-variants").TVReturnTyp
21
30
  };
22
31
  };
23
32
  checked: {
24
- true: {
25
- item: string;
26
- };
33
+ true: {};
27
34
  };
28
35
  disabled: {
29
36
  true: {
@@ -45,6 +52,15 @@ export declare const radioGroupVariants: import("tailwind-variants").TVReturnTyp
45
52
  root: string;
46
53
  item: string;
47
54
  };
55
+ segmented: {
56
+ root: string[];
57
+ item: string[];
58
+ label: string;
59
+ };
60
+ };
61
+ color: {
62
+ neutral: {};
63
+ primary: {};
48
64
  };
49
65
  size: {
50
66
  sm: {
@@ -58,9 +74,7 @@ export declare const radioGroupVariants: import("tailwind-variants").TVReturnTyp
58
74
  };
59
75
  };
60
76
  checked: {
61
- true: {
62
- item: string;
63
- };
77
+ true: {};
64
78
  };
65
79
  disabled: {
66
80
  true: {
@@ -82,6 +96,15 @@ export declare const radioGroupVariants: import("tailwind-variants").TVReturnTyp
82
96
  root: string;
83
97
  item: string;
84
98
  };
99
+ segmented: {
100
+ root: string[];
101
+ item: string[];
102
+ label: string;
103
+ };
104
+ };
105
+ color: {
106
+ neutral: {};
107
+ primary: {};
85
108
  };
86
109
  size: {
87
110
  sm: {
@@ -95,9 +118,7 @@ export declare const radioGroupVariants: import("tailwind-variants").TVReturnTyp
95
118
  };
96
119
  };
97
120
  checked: {
98
- true: {
99
- item: string;
100
- };
121
+ true: {};
101
122
  };
102
123
  disabled: {
103
124
  true: {
@@ -34,6 +34,13 @@ export interface IScrollbarProps extends Omit<React.HTMLAttributes<HTMLElement>,
34
34
  * Optional ID for the scrollbar container
35
35
  */
36
36
  id?: string;
37
+ /**
38
+ * Optional accessible name for the scroll area. When the content overflows the
39
+ * container becomes keyboard-scrollable; providing this label also promotes it
40
+ * to a discoverable `region` landmark. Leave it unset for incidental scroll
41
+ * areas so they don't clutter landmark navigation.
42
+ */
43
+ "aria-label"?: string;
37
44
  }
38
45
  /**
39
46
  * Scrollbar component provides a custom scrollbar with support for both vertical and horizontal scrolling.
@@ -1,3 +1,3 @@
1
- export { Select, type ISelectProps } from "./select";
1
+ export { Select } from "./select";
2
2
  export { selectVariants } from "./selectVariants";
3
- export type { IOption } from "./types";
3
+ export type { IOption, ISelectProps, TSelectLoadOptions } from "./types";
@@ -1,48 +1,9 @@
1
- import { type ReactNode, type ReactElement } from "react";
2
- import { type Props as ReactSelectProps, type GroupBase } from "react-select";
3
- import { type TIconType } from "../adpIcon";
4
- import { type TSelectSize, type IOption } from "./types";
1
+ import { type ReactElement, type RefAttributes } from "react";
2
+ import { type GroupBase } from "react-select";
3
+ import { type IOption, type ISelectProps } from "./types";
5
4
  /**
6
- * Props for the Select component
5
+ * Select component for single or multi selection. The forwarded ref lands on the wrapper `<div>`; the
6
+ * cast is what stops `forwardRef` — whose own signature is not generic — from collapsing `IsMulti` /
7
+ * `Group` to their defaults.
7
8
  */
8
- export interface ISelectProps<IsMulti extends boolean = false, Group extends GroupBase<IOption> = GroupBase<IOption>> extends Omit<ReactSelectProps<IOption, IsMulti, Group>, "options" | "value" | "className"> {
9
- /** Unique id for the select input */
10
- id?: string;
11
- /** Custom className for wrapper */
12
- className?: string;
13
- /** Label displayed above select */
14
- label?: ReactNode;
15
- /** Select size variant */
16
- size?: TSelectSize;
17
- /** Options or groups to render */
18
- options?: ReactSelectProps<IOption, IsMulti, Group>["options"];
19
- /** Current value of the select */
20
- value?: ReactSelectProps<IOption, IsMulti, Group>["value"];
21
- /** Helper text displayed below */
22
- helperText?: ReactNode;
23
- /** Display error styling */
24
- error?: boolean;
25
- /** Disable the select */
26
- disabled?: boolean;
27
- /** Enable creatable select */
28
- creatable?: boolean;
29
- /** Field touched state */
30
- touched?: boolean;
31
- /** Max number of visible values in multi */
32
- maxVisibleValues?: number;
33
- /** Label for truncated values */
34
- maxVisibleValuesMsg?: string;
35
- /** Custom footer in menu */
36
- menuFooter?: ReactNode;
37
- /** Prefix icon for the control */
38
- prefixIcon?: TIconType | ReactNode;
39
- /** Suffix icon for the control */
40
- suffixIcon?: TIconType | ReactNode;
41
- }
42
- /**
43
- * Select component for single or multi selection
44
- */
45
- export declare function Select<IsMulti extends boolean = false, Group extends GroupBase<IOption> = GroupBase<IOption>>(selectProps: ISelectProps<IsMulti, Group>): ReactElement;
46
- export declare namespace Select {
47
- var displayName: string;
48
- }
9
+ export declare const Select: <IsMulti extends boolean = false, Group extends GroupBase<IOption> = GroupBase<IOption>>(props: ISelectProps<IsMulti, Group> & RefAttributes<HTMLDivElement>) => ReactElement;
@@ -0,0 +1,29 @@
1
+ import * as React from "react";
2
+ import { type ReactElement } from "react";
3
+ import { type GroupBase, type OptionProps, type MultiValueProps, type MultiValueRemoveProps, type DropdownIndicatorProps, type ValueContainerProps, type InputProps } from "react-select";
4
+ import { type IOption, type ISelectOptionContext, type ISelectComponentsConfig } from "./types";
5
+ export declare const SelectOptionContext: React.Context<ISelectOptionContext>;
6
+ /**
7
+ * A single dropdown option (handles Select All, multi-select checkboxes, and the selected
8
+ * checkmark). Defined at module level with a stable identity so react-select never remounts it;
9
+ * live selection state arrives via {@link SelectOptionContext}. The label truncates to one line
10
+ * and, only when genuinely clipped (`useIsTruncated`), shows its full text on hover/focus in a
11
+ * `position:fixed` overlay - see {@link OptionLabelOverlay}.
12
+ */
13
+ export declare function SelectOption<IsMulti extends boolean = boolean, Group extends GroupBase<IOption> = GroupBase<IOption>>(props: OptionProps<IOption, IsMulti, Group>): ReactElement;
14
+ export declare namespace SelectOption {
15
+ var displayName: string;
16
+ }
17
+ /**
18
+ * Builds the react-select custom components that are independent of the in-dropdown
19
+ * search/focus machinery (kept in select.tsx) and of per-option selection state (the Option is
20
+ * the stable {@link SelectOption} above). These are stateless, so recreating them per render is
21
+ * harmless - react-select only remounts the focus-sensitive Menu component.
22
+ */
23
+ export declare function createSelectComponents<IsMulti extends boolean = false, Group extends GroupBase<IOption> = GroupBase<IOption>>(config: ISelectComponentsConfig): {
24
+ DropdownIndicator: (props: DropdownIndicatorProps<IOption, IsMulti, Group>) => import("react/jsx-runtime").JSX.Element;
25
+ ValueContainer: ({ children, ...props }: ValueContainerProps<IOption, IsMulti, Group>) => import("react/jsx-runtime").JSX.Element;
26
+ MultiValue: (props: MultiValueProps<IOption>) => import("react/jsx-runtime").JSX.Element | null;
27
+ MultiValueRemove: (props: MultiValueRemoveProps<IOption, IsMulti, Group>) => import("react/jsx-runtime").JSX.Element;
28
+ Input: (props: InputProps<IOption, IsMulti, Group>) => import("react/jsx-runtime").JSX.Element;
29
+ };
@@ -0,0 +1,12 @@
1
+ import { type ReactElement } from "react";
2
+ import { type GroupBase, type MenuProps } from "react-select";
3
+ import { type IOption, type ISelectMenuContext } from "./types";
4
+ export declare const SelectMenuContext: import("react").Context<ISelectMenuContext | null>;
5
+ /**
6
+ * Menu with in-dropdown search. Stable module identity (keeps focus/caret/scroll); search sits
7
+ * outside MenuList to avoid react-select's focus war. Live values via {@link SelectMenuContext}.
8
+ */
9
+ export declare function SelectMenu<IsMulti extends boolean = boolean, Group extends GroupBase<IOption> = GroupBase<IOption>>(props: MenuProps<IOption, IsMulti, Group>): ReactElement;
10
+ export declare namespace SelectMenu {
11
+ var displayName: string;
12
+ }
@@ -11,6 +11,13 @@ export declare const selectVariants: import("tailwind-variants").TVReturnType<{
11
11
  base: string;
12
12
  label: string;
13
13
  helperText: string;
14
+ menuSearchContainer: string;
15
+ menuSearchInput: string;
16
+ menuLoader: string;
17
+ menuError: string;
18
+ optionLabelWrap: string;
19
+ optionLabel: string;
20
+ optionOverlay: string;
14
21
  }, undefined, {
15
22
  error: {
16
23
  true: {
@@ -24,6 +31,13 @@ export declare const selectVariants: import("tailwind-variants").TVReturnType<{
24
31
  base: string;
25
32
  label: string;
26
33
  helperText: string;
34
+ menuSearchContainer: string;
35
+ menuSearchInput: string;
36
+ menuLoader: string;
37
+ menuError: string;
38
+ optionLabelWrap: string;
39
+ optionLabel: string;
40
+ optionOverlay: string;
27
41
  }, import("tailwind-variants").TVReturnType<{
28
42
  error: {
29
43
  true: {
@@ -37,4 +51,11 @@ export declare const selectVariants: import("tailwind-variants").TVReturnType<{
37
51
  base: string;
38
52
  label: string;
39
53
  helperText: string;
54
+ menuSearchContainer: string;
55
+ menuSearchInput: string;
56
+ menuLoader: string;
57
+ menuError: string;
58
+ optionLabelWrap: string;
59
+ optionLabel: string;
60
+ optionOverlay: string;
40
61
  }, undefined, unknown, unknown, undefined>>;