@aircall/ds 0.24.0 → 0.24.1
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/globals.css +1 -1
- package/dist/index.d.ts +79 -29
- package/dist/index.js +47 -20
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ import { Switch as Switch$1 } from "@base-ui/react/switch";
|
|
|
40
40
|
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
41
41
|
import { Toggle as Toggle$1 } from "@base-ui/react/toggle";
|
|
42
42
|
import { ToggleGroup as ToggleGroup$1 } from "@base-ui/react/toggle-group";
|
|
43
|
-
import * as
|
|
43
|
+
import * as class_variance_authority_types3 from "class-variance-authority/types";
|
|
44
44
|
import { CountryCode } from "@aircall/numbers";
|
|
45
45
|
|
|
46
46
|
//#region src/components/accordion.d.ts
|
|
@@ -68,9 +68,9 @@ declare namespace AccordionContent {
|
|
|
68
68
|
//#region src/components/button.d.ts
|
|
69
69
|
declare const buttonVariants: (props?: ({
|
|
70
70
|
variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
|
|
71
|
-
size?: "default" | "
|
|
71
|
+
size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" | null | undefined;
|
|
72
72
|
block?: boolean | null | undefined;
|
|
73
|
-
} &
|
|
73
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
74
74
|
declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
75
75
|
interface ButtonProps extends Button$1.Props, VariantProps<typeof buttonVariants> {
|
|
76
76
|
children?: React.ReactNode;
|
|
@@ -530,8 +530,8 @@ declare namespace AlertDialogCancel {
|
|
|
530
530
|
//#endregion
|
|
531
531
|
//#region src/components/alert.d.ts
|
|
532
532
|
declare const alertVariants: (props?: ({
|
|
533
|
-
variant?: "default" | "
|
|
534
|
-
} &
|
|
533
|
+
variant?: "default" | "error" | "info" | "success" | "warning" | null | undefined;
|
|
534
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
535
535
|
declare const Alert: React.ForwardRefExoticComponent<Omit<AlertProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
536
536
|
interface AlertProps extends React.ComponentProps<'div'>, VariantProps<typeof alertVariants> {}
|
|
537
537
|
declare namespace Alert {
|
|
@@ -563,7 +563,7 @@ type AttachmentState = 'idle' | 'uploading' | 'processing' | 'error' | 'done';
|
|
|
563
563
|
declare const attachmentVariants: (props?: ({
|
|
564
564
|
size?: "default" | "sm" | "xs" | null | undefined;
|
|
565
565
|
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
566
|
-
} &
|
|
566
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
567
567
|
/**
|
|
568
568
|
* Card displaying a single file or image attachment with its metadata,
|
|
569
569
|
* upload state, and actions. Renders a `<div>`; compose it from
|
|
@@ -601,7 +601,7 @@ declare namespace Attachment {
|
|
|
601
601
|
}
|
|
602
602
|
declare const attachmentMediaVariants: (props?: ({
|
|
603
603
|
variant?: "image" | "icon" | null | undefined;
|
|
604
|
-
} &
|
|
604
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
605
605
|
/**
|
|
606
606
|
* Leading media slot of an `Attachment` — holds an icon (`variant="icon"`)
|
|
607
607
|
* or an image thumbnail (`variant="image"`). Renders a `<div>`.
|
|
@@ -728,7 +728,7 @@ declare namespace AvatarGroupCount {
|
|
|
728
728
|
//#region src/components/counter-badge.d.ts
|
|
729
729
|
declare const counterBadgeVariants: (props?: ({
|
|
730
730
|
variant?: "default" | "secondary" | "ghost" | null | undefined;
|
|
731
|
-
} &
|
|
731
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
732
732
|
declare const CounterBadge: React.ForwardRefExoticComponent<Omit<CounterBadgeProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
733
733
|
type CounterBadgeProps = useRender.ComponentProps<'span'> & VariantProps<typeof counterBadgeVariants>;
|
|
734
734
|
declare namespace CounterBadge {
|
|
@@ -740,7 +740,7 @@ declare const badgeVariants: (props?: ({
|
|
|
740
740
|
size?: "default" | "lg" | null | undefined;
|
|
741
741
|
color?: "blue" | "green" | "pink" | "purple" | "red" | "yellow" | "charcoal" | null | undefined;
|
|
742
742
|
tone?: "dark" | "light" | "medium-dark" | "medium-light" | null | undefined;
|
|
743
|
-
} &
|
|
743
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
744
744
|
type BadgeVariants = VariantProps<typeof badgeVariants>;
|
|
745
745
|
type BadgeColor = NonNullable<BadgeVariants['color']>;
|
|
746
746
|
type BadgeTone = NonNullable<BadgeVariants['tone']>;
|
|
@@ -772,7 +772,7 @@ declare namespace BadgeGroup {
|
|
|
772
772
|
}
|
|
773
773
|
declare const badgeGroupCountVariants: (props?: ({
|
|
774
774
|
size?: "default" | "lg" | null | undefined;
|
|
775
|
-
} &
|
|
775
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
776
776
|
declare const BadgeGroupCount: React.ForwardRefExoticComponent<Omit<BadgeGroupCount.Props, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
777
777
|
declare namespace BadgeGroupCount {
|
|
778
778
|
type Props = Omit<React.ComponentProps<typeof CounterBadge>, 'variant'> & VariantProps<typeof badgeGroupCountVariants>;
|
|
@@ -780,9 +780,9 @@ declare namespace BadgeGroupCount {
|
|
|
780
780
|
//#endregion
|
|
781
781
|
//#region src/components/banner.d.ts
|
|
782
782
|
declare const bannerVariants: (props?: ({
|
|
783
|
-
variant?: "default" | "
|
|
783
|
+
variant?: "default" | "error" | "info" | "success" | "warning" | null | undefined;
|
|
784
784
|
borderDirection?: "bottom" | "top" | null | undefined;
|
|
785
|
-
} &
|
|
785
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
786
786
|
declare const Banner: React.ForwardRefExoticComponent<Omit<BannerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
787
787
|
interface BannerProps extends React.ComponentProps<'div'>, VariantProps<typeof bannerVariants> {}
|
|
788
788
|
declare namespace Banner {
|
|
@@ -863,7 +863,7 @@ declare namespace Separator {
|
|
|
863
863
|
//#region src/components/button-group.d.ts
|
|
864
864
|
declare const buttonGroupVariants: (props?: ({
|
|
865
865
|
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
866
|
-
} &
|
|
866
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
867
867
|
declare const ButtonGroup: React.ForwardRefExoticComponent<Omit<ButtonGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
868
868
|
interface ButtonGroupProps extends React.ComponentProps<'div'>, VariantProps<typeof buttonGroupVariants> {}
|
|
869
869
|
declare namespace ButtonGroup {
|
|
@@ -1288,6 +1288,24 @@ interface DataComboboxProps<T> {
|
|
|
1288
1288
|
getItemLabel: (item: T) => string;
|
|
1289
1289
|
/** Optional rich row content (icon, description, …). Defaults to `getItemLabel`. */
|
|
1290
1290
|
renderItem?: (item: T) => React.ReactNode;
|
|
1291
|
+
/**
|
|
1292
|
+
* Optional custom render for a selected chip (multiple mode). Return the WHOLE
|
|
1293
|
+
* chip — a `ComboboxChip` element — so its appearance (`color`/`tone`, content)
|
|
1294
|
+
* is fully yours, e.g.
|
|
1295
|
+
* `item => <ComboboxChip color="blue" tone="light">{item.label}</ComboboxChip>`.
|
|
1296
|
+
* Defaults to a plain `ComboboxChip` with `getItemLabel`. (Unlike `renderItem`,
|
|
1297
|
+
* which returns only the row's inner content — the DS owns that `ComboboxItem`
|
|
1298
|
+
* for selection/keyboard — the chip is entirely consumer-owned here.)
|
|
1299
|
+
*/
|
|
1300
|
+
renderChip?: (item: T) => React.ReactNode;
|
|
1301
|
+
/**
|
|
1302
|
+
* Groups items under headers. Return the group key an item belongs to; items
|
|
1303
|
+
* are grouped in first-seen order. When provided, the list renders grouped
|
|
1304
|
+
* sections. Pair with `getGroupLabel` for a custom header.
|
|
1305
|
+
*/
|
|
1306
|
+
getGroupKey?: (item: T) => string;
|
|
1307
|
+
/** Maps a group key to its header label. Defaults to the group key. */
|
|
1308
|
+
getGroupLabel?: (groupKey: string) => React.ReactNode;
|
|
1291
1309
|
/**
|
|
1292
1310
|
* `'single'` (default) selects one item; `'multiple'` selects many and renders
|
|
1293
1311
|
* them as removable chips above the input.
|
|
@@ -1299,6 +1317,13 @@ interface DataComboboxProps<T> {
|
|
|
1299
1317
|
defaultSelectedKeys?: Set<string>;
|
|
1300
1318
|
/** Called with the new set of selected keys whenever selection changes. */
|
|
1301
1319
|
onSelectionChange?: (keys: Set<string>) => void;
|
|
1320
|
+
/**
|
|
1321
|
+
* Called when the dropdown opens (`true`) or closes (`false`). Use the
|
|
1322
|
+
* `false` edge to commit a deferred action — e.g. a table filter that should
|
|
1323
|
+
* only run once the user is done picking, not on every checkbox toggle:
|
|
1324
|
+
* keep the live selection in `onSelectionChange` and apply it here on close.
|
|
1325
|
+
*/
|
|
1326
|
+
onOpenChange?: (open: boolean) => void;
|
|
1302
1327
|
/**
|
|
1303
1328
|
* Known selected items used to seed the label cache, so a selected key whose
|
|
1304
1329
|
* item is NOT in the current `items` (e.g. a saved form value not yet fetched,
|
|
@@ -1312,9 +1337,20 @@ interface DataComboboxProps<T> {
|
|
|
1312
1337
|
/** Number of skeleton rows shown while `loadingState` is `'loading'`. */
|
|
1313
1338
|
skeletonCount?: number;
|
|
1314
1339
|
/**
|
|
1315
|
-
*
|
|
1316
|
-
*
|
|
1317
|
-
*
|
|
1340
|
+
* Enables SERVER-side search. When omitted, the combobox filters the provided
|
|
1341
|
+
* `items` client-side as you type (Base UI's built-in filter) — ideal for a
|
|
1342
|
+
* fixed list. When provided, internal filtering is turned off and this is
|
|
1343
|
+
* called (debounce it yourself) with the query: feed the matching `items` and
|
|
1344
|
+
* set `loadingState='filtering'` while the fetch runs.
|
|
1345
|
+
*
|
|
1346
|
+
* Prefer this for any PAGINATED list: while `onFetchMore`+`hasMore` are active
|
|
1347
|
+
* client-side filtering is disabled (it only sees loaded pages and would break
|
|
1348
|
+
* infinite scroll), so a searchable paginated list must search server-side.
|
|
1349
|
+
*
|
|
1350
|
+
* Called with `''` when the query is cleared — including the automatic clear
|
|
1351
|
+
* after a selection (multi keeps the popup open) and the input's clear button.
|
|
1352
|
+
* Treat `''` as "no query": return the initial, unfiltered list. Otherwise the
|
|
1353
|
+
* results stay stuck on the last search with no way back to the full list.
|
|
1318
1354
|
*/
|
|
1319
1355
|
onSearch?: (query: string) => void;
|
|
1320
1356
|
/** Called when the user scrolls near the bottom of the list; fetch the next page. */
|
|
@@ -1331,12 +1367,26 @@ interface DataComboboxProps<T> {
|
|
|
1331
1367
|
* already hold `selectedKeys`), e.g. a count on a "Created by" filter button.
|
|
1332
1368
|
*/
|
|
1333
1369
|
trigger?: React.ReactElement;
|
|
1370
|
+
/**
|
|
1371
|
+
* Whether the dropdown shows a search input. Default `true`. Set `false` for a
|
|
1372
|
+
* short pick-list that doesn't need typeahead (e.g. a "Status" filter): with a
|
|
1373
|
+
* `trigger`, the overlay renders just the list (no search box); keyboard nav
|
|
1374
|
+
* and selection still work. Ignored without a `trigger` (the inline field IS
|
|
1375
|
+
* the input / chips).
|
|
1376
|
+
*/
|
|
1377
|
+
searchable?: boolean;
|
|
1334
1378
|
/** Placeholder for the input (single / overlay search) or chips input (multiple). */
|
|
1335
1379
|
placeholder?: string;
|
|
1336
1380
|
/** Disables the whole combobox. */
|
|
1337
1381
|
disabled?: boolean;
|
|
1338
1382
|
/** Class applied to the visible field (the input, or the chips container). */
|
|
1339
1383
|
className?: string;
|
|
1384
|
+
/**
|
|
1385
|
+
* Class applied to the dropdown popup (`ComboboxContent`). Overrides the default
|
|
1386
|
+
* `min-w-50` (200px) — e.g. `min-w-0` to hug the anchor, or `min-w-80` (320px)
|
|
1387
|
+
* for a wider menu.
|
|
1388
|
+
*/
|
|
1389
|
+
contentClassName?: string;
|
|
1340
1390
|
'aria-label'?: string;
|
|
1341
1391
|
}
|
|
1342
1392
|
declare function DataCombobox<T>(componentProps: DataCombobox.Props<T>): react_jsx_runtime0.JSX.Element;
|
|
@@ -1785,7 +1835,7 @@ declare namespace EmptyHeader {
|
|
|
1785
1835
|
}
|
|
1786
1836
|
declare const emptyMediaVariants: (props?: ({
|
|
1787
1837
|
variant?: "default" | "icon" | null | undefined;
|
|
1788
|
-
} &
|
|
1838
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
1789
1839
|
declare const EmptyMedia: React.ForwardRefExoticComponent<Omit<EmptyMediaProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
1790
1840
|
interface EmptyMediaProps extends React.ComponentProps<'div'>, VariantProps<typeof emptyMediaVariants> {}
|
|
1791
1841
|
declare namespace EmptyMedia {
|
|
@@ -1979,7 +2029,7 @@ declare namespace EmojiPickerContent {
|
|
|
1979
2029
|
declare const fabVariants: (props?: ({
|
|
1980
2030
|
variant?: "default" | "outline" | null | undefined;
|
|
1981
2031
|
size?: "lg" | "icon-lg" | null | undefined;
|
|
1982
|
-
} &
|
|
2032
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
1983
2033
|
declare const FAB: React.ForwardRefExoticComponent<Omit<FABProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
1984
2034
|
interface FABProps extends Button$1.Props, VariantProps<typeof fabVariants> {}
|
|
1985
2035
|
declare namespace FAB {
|
|
@@ -2013,7 +2063,7 @@ declare namespace FieldGroup {
|
|
|
2013
2063
|
}
|
|
2014
2064
|
declare const fieldVariants: (props?: ({
|
|
2015
2065
|
orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
|
|
2016
|
-
} &
|
|
2066
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
2017
2067
|
declare const Field: React.ForwardRefExoticComponent<Omit<FieldProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
2018
2068
|
interface FieldProps extends React.ComponentProps<'div'>, VariantProps<typeof fieldVariants> {}
|
|
2019
2069
|
declare namespace Field {
|
|
@@ -2254,7 +2304,7 @@ declare namespace HoverCardContent {
|
|
|
2254
2304
|
//#region src/components/input.d.ts
|
|
2255
2305
|
declare const inputVariants: (props?: ({
|
|
2256
2306
|
block?: boolean | null | undefined;
|
|
2257
|
-
} &
|
|
2307
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
2258
2308
|
declare const Input: React.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
2259
2309
|
interface InputProps extends React.ComponentProps<'input'>, VariantProps<typeof inputVariants> {}
|
|
2260
2310
|
declare namespace Input {
|
|
@@ -2269,7 +2319,7 @@ declare namespace InputGroup {
|
|
|
2269
2319
|
}
|
|
2270
2320
|
declare const inputGroupAddonVariants: (props?: ({
|
|
2271
2321
|
align?: "block-end" | "block-start" | "inline-end" | "inline-start" | null | undefined;
|
|
2272
|
-
} &
|
|
2322
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
2273
2323
|
declare const InputGroupAddon: React.ForwardRefExoticComponent<Omit<InputGroupAddonProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
2274
2324
|
interface InputGroupAddonProps extends React.ComponentProps<'div'>, VariantProps<typeof inputGroupAddonVariants> {}
|
|
2275
2325
|
declare namespace InputGroupAddon {
|
|
@@ -2383,7 +2433,7 @@ declare namespace NumericInputDecrement {
|
|
|
2383
2433
|
}
|
|
2384
2434
|
//#endregion
|
|
2385
2435
|
//#region src/components/input-otp.d.ts
|
|
2386
|
-
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
2436
|
+
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
2387
2437
|
value?: string;
|
|
2388
2438
|
onChange?: (newValue: string) => unknown;
|
|
2389
2439
|
maxLength: number;
|
|
@@ -2398,7 +2448,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
|
|
|
2398
2448
|
children?: never;
|
|
2399
2449
|
} & React.RefAttributes<HTMLInputElement> & {
|
|
2400
2450
|
containerClassName?: string;
|
|
2401
|
-
}, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
2451
|
+
}, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
2402
2452
|
value?: string;
|
|
2403
2453
|
onChange?: (newValue: string) => unknown;
|
|
2404
2454
|
maxLength: number;
|
|
@@ -2454,7 +2504,7 @@ declare namespace ItemSeparator {
|
|
|
2454
2504
|
declare const itemVariants: (props?: ({
|
|
2455
2505
|
variant?: "default" | "outline" | "muted" | null | undefined;
|
|
2456
2506
|
size?: "default" | "sm" | "xs" | null | undefined;
|
|
2457
|
-
} &
|
|
2507
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
2458
2508
|
declare const Item: React.ForwardRefExoticComponent<Omit<ItemProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
2459
2509
|
interface ItemProps extends useRender.ComponentProps<'div'>, VariantProps<typeof itemVariants> {}
|
|
2460
2510
|
declare namespace Item {
|
|
@@ -2462,7 +2512,7 @@ declare namespace Item {
|
|
|
2462
2512
|
}
|
|
2463
2513
|
declare const itemMediaVariants: (props?: ({
|
|
2464
2514
|
variant?: "image" | "default" | "icon" | null | undefined;
|
|
2465
|
-
} &
|
|
2515
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
2466
2516
|
declare const ItemMedia: React.ForwardRefExoticComponent<Omit<ItemMediaProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
2467
2517
|
interface ItemMediaProps extends React.ComponentProps<'div'>, VariantProps<typeof itemMediaVariants> {}
|
|
2468
2518
|
declare namespace ItemMedia {
|
|
@@ -2651,7 +2701,7 @@ declare namespace ScrollBar {
|
|
|
2651
2701
|
//#region src/components/select.d.ts
|
|
2652
2702
|
declare const selectTriggerVariants: (props?: ({
|
|
2653
2703
|
size?: "default" | "sm" | null | undefined;
|
|
2654
|
-
} &
|
|
2704
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
2655
2705
|
declare const Select: typeof Select$1.Root;
|
|
2656
2706
|
declare const SelectGroup: React.ForwardRefExoticComponent<Omit<SelectGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
2657
2707
|
interface SelectGroupProps extends Select$1.Group.Props {}
|
|
@@ -2876,7 +2926,7 @@ declare namespace SidebarMenuItem {
|
|
|
2876
2926
|
declare const sidebarMenuButtonVariants: (props?: ({
|
|
2877
2927
|
variant?: "default" | "outline" | null | undefined;
|
|
2878
2928
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
2879
|
-
} &
|
|
2929
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
2880
2930
|
declare const SidebarMenuButton: React.ForwardRefExoticComponent<Omit<SidebarMenuButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
2881
2931
|
type SidebarMenuButtonProps = useRender.ComponentProps<'button'> & React.ComponentProps<'button'> & VariantProps<typeof sidebarMenuButtonVariants> & {
|
|
2882
2932
|
isActive?: boolean;
|
|
@@ -2948,7 +2998,7 @@ declare namespace Toaster {
|
|
|
2948
2998
|
//#region src/components/spinner.d.ts
|
|
2949
2999
|
declare const spinnerVariants: (props?: ({
|
|
2950
3000
|
size?: "default" | "sm" | "lg" | "xl" | null | undefined;
|
|
2951
|
-
} &
|
|
3001
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
2952
3002
|
declare const Spinner: React.ForwardRefExoticComponent<Omit<SpinnerProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
2953
3003
|
interface SpinnerProps extends React.ComponentProps<'svg'>, VariantProps<typeof spinnerVariants> {}
|
|
2954
3004
|
declare namespace Spinner {
|
|
@@ -3094,7 +3144,7 @@ declare namespace ThemeProvider {
|
|
|
3094
3144
|
declare const toggleVariants: (props?: ({
|
|
3095
3145
|
variant?: "default" | "outline" | null | undefined;
|
|
3096
3146
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
3097
|
-
} &
|
|
3147
|
+
} & class_variance_authority_types3.ClassProp) | undefined) => string;
|
|
3098
3148
|
declare const Toggle: React.ForwardRefExoticComponent<Omit<ToggleProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
3099
3149
|
interface ToggleProps extends Toggle$1.Props, VariantProps<typeof toggleVariants> {}
|
|
3100
3150
|
declare namespace Toggle {
|
package/dist/index.js
CHANGED
|
@@ -2680,7 +2680,7 @@ const Textarea = React.forwardRef((componentProps, forwardRef) => {
|
|
|
2680
2680
|
return /* @__PURE__ */ jsx("textarea", {
|
|
2681
2681
|
ref: forwardRef,
|
|
2682
2682
|
"data-slot": "textarea",
|
|
2683
|
-
className: cn("border-input text-foreground placeholder:text-muted-foreground hover:
|
|
2683
|
+
className: cn("border-input text-foreground placeholder:text-muted-foreground hover:aria-invalid:border-destructive focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3 aria-invalid:border-destructive focus-visible:aria-invalid:ring-destructive/20 focus-visible:aria-invalid:ring-3 dark:focus-visible:aria-invalid:ring-destructive/40 dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-background px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 dark:disabled:bg-input/80 md:text-sm", className),
|
|
2684
2684
|
...props
|
|
2685
2685
|
});
|
|
2686
2686
|
});
|
|
@@ -3277,7 +3277,7 @@ function useFetchMoreSentinel(onFetchMore, getRoot, resetKey) {
|
|
|
3277
3277
|
const DEFAULT_SKELETON_COUNT$1 = 5;
|
|
3278
3278
|
const EMPTY_KEYS$1 = /* @__PURE__ */ new Set();
|
|
3279
3279
|
function DataCombobox(componentProps) {
|
|
3280
|
-
const { items, getItemValue, getItemLabel, renderItem, selectionMode = "single", selectedKeys, defaultSelectedKeys, onSelectionChange, selectedItems, disabledKeys, loadingState = "idle", skeletonCount = DEFAULT_SKELETON_COUNT$1, onSearch, onFetchMore, hasMore = false, emptyState, trigger, placeholder, disabled = false, className, "aria-label": ariaLabel } = componentProps;
|
|
3280
|
+
const { items, getItemValue, getItemLabel, renderItem, renderChip, getGroupKey, getGroupLabel, selectionMode = "single", selectedKeys, defaultSelectedKeys, onSelectionChange, onOpenChange, selectedItems, disabledKeys, loadingState = "idle", skeletonCount = DEFAULT_SKELETON_COUNT$1, onSearch, onFetchMore, hasMore = false, emptyState, trigger, searchable = true, placeholder, disabled = false, className, contentClassName, "aria-label": ariaLabel } = componentProps;
|
|
3281
3281
|
const t = useDsTranslation("ds");
|
|
3282
3282
|
const multiple = selectionMode === "multiple";
|
|
3283
3283
|
const disabledKeySet = disabledKeys ?? EMPTY_KEYS$1;
|
|
@@ -3298,19 +3298,42 @@ function DataCombobox(componentProps) {
|
|
|
3298
3298
|
}
|
|
3299
3299
|
const commit = React.useCallback((objs) => setSelectionSet(new Set(objs.map(getItemValue))), [setSelectionSet, getItemValue]);
|
|
3300
3300
|
const handleInputValueChange = onSearch ? (value, details) => {
|
|
3301
|
-
if (details.reason === "input-change") onSearch(value);
|
|
3301
|
+
if (details.reason === "input-change" || details.reason === "input-clear" || details.reason === "clear-press") onSearch(value);
|
|
3302
3302
|
} : void 0;
|
|
3303
3303
|
const isInitialLoading = loadingState === "loading";
|
|
3304
3304
|
const isFiltering = loadingState === "filtering";
|
|
3305
3305
|
const isLoadingMore = loadingState === "loadingMore";
|
|
3306
|
+
const groups = React.useMemo(() => {
|
|
3307
|
+
if (!getGroupKey) return null;
|
|
3308
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
3309
|
+
for (const item of items) {
|
|
3310
|
+
const gk = getGroupKey(item);
|
|
3311
|
+
const bucket = byKey.get(gk);
|
|
3312
|
+
if (bucket) bucket.push(item);
|
|
3313
|
+
else byKey.set(gk, [item]);
|
|
3314
|
+
}
|
|
3315
|
+
return Array.from(byKey, ([groupKey, groupItems]) => ({
|
|
3316
|
+
groupKey,
|
|
3317
|
+
label: getGroupLabel ? getGroupLabel(groupKey) : groupKey,
|
|
3318
|
+
items: groupItems
|
|
3319
|
+
}));
|
|
3320
|
+
}, [
|
|
3321
|
+
items,
|
|
3322
|
+
getGroupKey,
|
|
3323
|
+
getGroupLabel
|
|
3324
|
+
]);
|
|
3325
|
+
const isGrouped = groups !== null;
|
|
3306
3326
|
const sentinelRef = useFetchMoreSentinel(onFetchMore, (node) => node.closest("[data-slot=\"combobox-list\"]"), items.length);
|
|
3307
|
-
const
|
|
3327
|
+
const lastRenderedItem = (groups?.at(-1)?.items ?? items).at(-1);
|
|
3328
|
+
const lastItemKey = lastRenderedItem ? getItemValue(lastRenderedItem) : void 0;
|
|
3329
|
+
const renderRow = (item) => {
|
|
3308
3330
|
const key = getItemValue(item);
|
|
3309
|
-
const attachSentinel = !!onFetchMore && hasMore &&
|
|
3331
|
+
const attachSentinel = !!onFetchMore && hasMore && key === lastItemKey;
|
|
3310
3332
|
return /* @__PURE__ */ jsx(ComboboxItem, {
|
|
3311
3333
|
value: item,
|
|
3312
3334
|
disabled: disabledKeySet.has(key),
|
|
3313
3335
|
ref: attachSentinel ? sentinelRef : void 0,
|
|
3336
|
+
"data-test": attachSentinel ? "fetch-sentinel" : void 0,
|
|
3314
3337
|
children: renderItem ? renderItem(item) : getItemLabel(item)
|
|
3315
3338
|
}, key);
|
|
3316
3339
|
};
|
|
@@ -3322,9 +3345,12 @@ function DataCombobox(componentProps) {
|
|
|
3322
3345
|
}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3323
3346
|
/* @__PURE__ */ jsx(ComboboxList, {
|
|
3324
3347
|
"aria-label": ariaLabel,
|
|
3325
|
-
children:
|
|
3348
|
+
children: isGrouped ? (group) => /* @__PURE__ */ jsxs(ComboboxGroup, {
|
|
3349
|
+
items: group.items,
|
|
3350
|
+
children: [/* @__PURE__ */ jsx(ComboboxLabel, { children: group.label }), /* @__PURE__ */ jsx(ComboboxCollection, { children: renderRow })]
|
|
3351
|
+
}, group.groupKey) : renderRow
|
|
3326
3352
|
}),
|
|
3327
|
-
/* @__PURE__ */ jsx(ComboboxEmpty, { children: emptyState ?? t("dataCombobox.noResults") }),
|
|
3353
|
+
isFiltering ? null : /* @__PURE__ */ jsx(ComboboxEmpty, { children: emptyState ?? t("dataCombobox.noResults") }),
|
|
3328
3354
|
isLoadingMore ? /* @__PURE__ */ jsx(SpinnerRow, {}) : null
|
|
3329
3355
|
] }), isFiltering ? /* @__PURE__ */ jsx("div", {
|
|
3330
3356
|
"data-slot": "combobox-loading-overlay",
|
|
@@ -3334,53 +3360,54 @@ function DataCombobox(componentProps) {
|
|
|
3334
3360
|
});
|
|
3335
3361
|
const chipsAnchor = useComboboxAnchor();
|
|
3336
3362
|
const overlayLayout = trigger ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Combobox$1.Trigger, { render: trigger }), /* @__PURE__ */ jsxs(ComboboxContent, {
|
|
3337
|
-
className: "min-w-
|
|
3338
|
-
children: [/* @__PURE__ */ jsx(ComboboxInput, {
|
|
3363
|
+
className: cn("min-w-50", contentClassName),
|
|
3364
|
+
children: [searchable ? /* @__PURE__ */ jsx(ComboboxInput, {
|
|
3339
3365
|
showTrigger: false,
|
|
3340
|
-
placeholder
|
|
3341
|
-
|
|
3342
|
-
}), popupBody]
|
|
3366
|
+
placeholder
|
|
3367
|
+
}) : null, popupBody]
|
|
3343
3368
|
})] }) : null;
|
|
3344
3369
|
if (multiple) return /* @__PURE__ */ jsx(Combobox, {
|
|
3345
3370
|
multiple: true,
|
|
3346
3371
|
autoHighlight: true,
|
|
3347
|
-
items,
|
|
3372
|
+
items: groups ?? items,
|
|
3348
3373
|
disabled,
|
|
3349
|
-
filter: null,
|
|
3374
|
+
filter: onSearch || onFetchMore && hasMore ? null : void 0,
|
|
3350
3375
|
value: selectedObjects,
|
|
3351
3376
|
onValueChange: commit,
|
|
3352
3377
|
itemToStringValue: getItemValue,
|
|
3353
3378
|
itemToStringLabel: getItemLabel,
|
|
3354
3379
|
isItemEqualToValue: (a, b) => getItemValue(a) === getItemValue(b),
|
|
3355
3380
|
onInputValueChange: handleInputValueChange,
|
|
3381
|
+
onOpenChange,
|
|
3356
3382
|
children: trigger ? overlayLayout : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ComboboxChips, {
|
|
3357
3383
|
ref: chipsAnchor,
|
|
3358
3384
|
className,
|
|
3359
|
-
children: /* @__PURE__ */ jsx(ComboboxValue, { children: (values) => /* @__PURE__ */ jsxs(Fragment, { children: [values.map((item) => /* @__PURE__ */ jsx(ComboboxChip, { children: getItemLabel(item) }, getItemValue(item))), /* @__PURE__ */ jsx(ComboboxChipsInput, { placeholder: keys.size === 0 ? placeholder : "" })] }) })
|
|
3385
|
+
children: /* @__PURE__ */ jsx(ComboboxValue, { children: (values) => /* @__PURE__ */ jsxs(Fragment, { children: [values.map((item) => renderChip ? /* @__PURE__ */ jsx(React.Fragment, { children: renderChip(item) }, getItemValue(item)) : /* @__PURE__ */ jsx(ComboboxChip, { children: getItemLabel(item) }, getItemValue(item))), /* @__PURE__ */ jsx(ComboboxChipsInput, { placeholder: keys.size === 0 ? placeholder : "" })] }) })
|
|
3360
3386
|
}), /* @__PURE__ */ jsx(ComboboxContent, {
|
|
3361
3387
|
anchor: chipsAnchor,
|
|
3362
|
-
className: "min-w-
|
|
3388
|
+
className: cn("min-w-50", contentClassName),
|
|
3363
3389
|
children: popupBody
|
|
3364
3390
|
})] })
|
|
3365
3391
|
}, selectionMode);
|
|
3366
3392
|
return /* @__PURE__ */ jsx(Combobox, {
|
|
3367
3393
|
autoHighlight: true,
|
|
3368
|
-
items,
|
|
3394
|
+
items: groups ?? items,
|
|
3369
3395
|
disabled,
|
|
3370
|
-
filter: null,
|
|
3396
|
+
filter: onSearch || onFetchMore && hasMore ? null : void 0,
|
|
3371
3397
|
value: selectedObjects[0] ?? null,
|
|
3372
3398
|
onValueChange: (next) => commit(next == null ? [] : [next]),
|
|
3373
3399
|
itemToStringValue: getItemValue,
|
|
3374
3400
|
itemToStringLabel: getItemLabel,
|
|
3375
3401
|
isItemEqualToValue: (a, b) => getItemValue(a) === getItemValue(b),
|
|
3376
3402
|
onInputValueChange: handleInputValueChange,
|
|
3403
|
+
onOpenChange,
|
|
3377
3404
|
children: trigger ? overlayLayout : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ComboboxInput, {
|
|
3378
3405
|
className,
|
|
3379
3406
|
placeholder,
|
|
3380
3407
|
disabled,
|
|
3381
3408
|
showClear: true
|
|
3382
3409
|
}), /* @__PURE__ */ jsx(ComboboxContent, {
|
|
3383
|
-
className: "min-w-
|
|
3410
|
+
className: cn("min-w-50", contentClassName),
|
|
3384
3411
|
children: popupBody
|
|
3385
3412
|
})] })
|
|
3386
3413
|
}, selectionMode);
|
|
@@ -6130,7 +6157,7 @@ RadioGroupItem.displayName = "RadioGroupItem";
|
|
|
6130
6157
|
|
|
6131
6158
|
//#endregion
|
|
6132
6159
|
//#region src/components/select.tsx
|
|
6133
|
-
const selectTriggerVariants = cva("flex w-fit items-center justify-between rounded-md border border-input bg-transparent py-2 text-sm whitespace-nowrap transition-colors outline-none select-none
|
|
6160
|
+
const selectTriggerVariants = cva("flex w-fit items-center justify-between rounded-md border border-input bg-transparent py-2 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive focus-visible:aria-invalid:ring-3 focus-visible:aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:focus-visible:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
6134
6161
|
variants: { size: {
|
|
6135
6162
|
default: "h-10 gap-2 px-3",
|
|
6136
6163
|
sm: "h-8 gap-1.5 px-2"
|