@aircall/ds 0.46.2 → 0.47.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/index.d.ts +33 -10
- package/dist/index.js +40 -14
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -97,7 +97,7 @@ declare namespace AccordionContent {
|
|
|
97
97
|
/** `cva` variant definitions for {@link Button} — resolves `variant`, `size`, and `block` into class names. */
|
|
98
98
|
declare const buttonVariants: (props?: ({
|
|
99
99
|
variant?: "link" | "default" | "ghost" | "secondary" | "destructive" | "outline" | null | undefined;
|
|
100
|
-
size?: "default" | "
|
|
100
|
+
size?: "default" | "icon" | "lg" | "sm" | "icon-sm" | "icon-lg" | null | undefined;
|
|
101
101
|
block?: boolean | null | undefined;
|
|
102
102
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
103
103
|
/**
|
|
@@ -742,7 +742,7 @@ declare namespace AlertAction {
|
|
|
742
742
|
*/
|
|
743
743
|
type AttachmentState = 'idle' | 'uploading' | 'processing' | 'error' | 'done';
|
|
744
744
|
declare const attachmentVariants: (props?: ({
|
|
745
|
-
size?: "default" | "
|
|
745
|
+
size?: "default" | "sm" | "xs" | null | undefined;
|
|
746
746
|
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
747
747
|
block?: boolean | null | undefined;
|
|
748
748
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -882,9 +882,13 @@ declare namespace AttachmentGroup {
|
|
|
882
882
|
/**
|
|
883
883
|
* `class-variance-authority` config for {@link Avatar}. `size`
|
|
884
884
|
* (`xs` | `sm` | `default` | `lg` | `xl`, default `default`) sets the avatar's diameter.
|
|
885
|
+
*
|
|
886
|
+
* `isolate` makes the root a stacking context, so `AvatarBadge`'s `z-10` only lifts it above the
|
|
887
|
+
* avatar's own picture. Without it the badge competed with the page: inside a `DataTable` it was drawn
|
|
888
|
+
* over the sticky header (also `z-10`) while the rows scrolled under it.
|
|
885
889
|
*/
|
|
886
890
|
declare const avatarVariants: (props?: ({
|
|
887
|
-
size?: "default" | "
|
|
891
|
+
size?: "default" | "lg" | "sm" | "xs" | "xl" | null | undefined;
|
|
888
892
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
889
893
|
/**
|
|
890
894
|
* Circular container that displays a user or entity image with a text/icon fallback.
|
|
@@ -1380,7 +1384,7 @@ declare namespace CalendarDayButton {
|
|
|
1380
1384
|
* child parts read the same size back off `data-size` via `group-data-[size=x]/card`.
|
|
1381
1385
|
*/
|
|
1382
1386
|
declare const cardVariants: (props?: ({
|
|
1383
|
-
size?: "default" | "
|
|
1387
|
+
size?: "default" | "lg" | "sm" | null | undefined;
|
|
1384
1388
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
1385
1389
|
/**
|
|
1386
1390
|
* Root container for a card. Renders a `<div data-slot="card">` with border, background, and
|
|
@@ -1748,7 +1752,7 @@ declare namespace PopoverDescription {
|
|
|
1748
1752
|
*/
|
|
1749
1753
|
declare const toggleVariants: (props?: ({
|
|
1750
1754
|
variant?: "default" | "outline" | null | undefined;
|
|
1751
|
-
size?: "default" | "
|
|
1755
|
+
size?: "default" | "lg" | "sm" | null | undefined;
|
|
1752
1756
|
pressedColor?: "highContrast" | "lowContrast" | null | undefined;
|
|
1753
1757
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
1754
1758
|
/**
|
|
@@ -2765,6 +2769,25 @@ interface DataComboboxProps<T> {
|
|
|
2765
2769
|
* @default 36
|
|
2766
2770
|
*/
|
|
2767
2771
|
estimateRowHeight?: number;
|
|
2772
|
+
/**
|
|
2773
|
+
* Keeps the search query on screen when the user picks an item WHILE the query is still
|
|
2774
|
+
* filtering the list, in `'multiple'` mode with the input inside the popup (a `trigger`, or the
|
|
2775
|
+
* chips field). Off by default, matching Base UI's own behaviour: picking a row while filtering
|
|
2776
|
+
* clears the box so the next pick starts from the full list — a reasonable default for a plain
|
|
2777
|
+
* tag picker, but the wrong one for a filter chip whose consumer wants to keep narrowing the same
|
|
2778
|
+
* search across several picks.
|
|
2779
|
+
*
|
|
2780
|
+
* Scoped to exactly that one moment. Base UI's `'input-clear'` reason fires for several reasons —
|
|
2781
|
+
* closing, reopening, the clear button — and every one of those OTHER than this fires alongside
|
|
2782
|
+
* an open/close transition; this is the only `'input-clear'` that happens while the popup stays
|
|
2783
|
+
* open. Detecting that (rather than gating on `multiple` alone) is what lets closing still clear
|
|
2784
|
+
* the query normally even with this prop on.
|
|
2785
|
+
*
|
|
2786
|
+
* No effect outside that moment: typing, the clear button, and every close-time reset behave
|
|
2787
|
+
* exactly as they do when this is left off.
|
|
2788
|
+
* @default false
|
|
2789
|
+
*/
|
|
2790
|
+
preserveSearchOnSelect?: boolean;
|
|
2768
2791
|
}
|
|
2769
2792
|
/**
|
|
2770
2793
|
* Searchable dropdown built on the DS Combobox primitives, driven by an `items`
|
|
@@ -5012,7 +5035,7 @@ declare namespace NumericInputDecrement {
|
|
|
5012
5035
|
* )} />
|
|
5013
5036
|
* ```
|
|
5014
5037
|
*/
|
|
5015
|
-
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
5038
|
+
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
5016
5039
|
value?: string;
|
|
5017
5040
|
onChange?: (newValue: string) => unknown;
|
|
5018
5041
|
maxLength: number;
|
|
@@ -5027,7 +5050,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
|
|
|
5027
5050
|
children?: never;
|
|
5028
5051
|
} & React.RefAttributes<HTMLInputElement> & {
|
|
5029
5052
|
containerClassName?: string;
|
|
5030
|
-
}, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
5053
|
+
}, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
5031
5054
|
value?: string;
|
|
5032
5055
|
onChange?: (newValue: string) => unknown;
|
|
5033
5056
|
maxLength: number;
|
|
@@ -5106,7 +5129,7 @@ declare namespace ItemSeparator {
|
|
|
5106
5129
|
}
|
|
5107
5130
|
declare const itemVariants: (props?: ({
|
|
5108
5131
|
variant?: "default" | "muted" | "outline" | null | undefined;
|
|
5109
|
-
size?: "default" | "
|
|
5132
|
+
size?: "default" | "sm" | "xs" | null | undefined;
|
|
5110
5133
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
5111
5134
|
/**
|
|
5112
5135
|
* Flexible list-item container laying out media, content, and actions on one row. Renders a `<div>`
|
|
@@ -6347,7 +6370,7 @@ declare namespace SidebarMenuItem {
|
|
|
6347
6370
|
}
|
|
6348
6371
|
declare const sidebarMenuButtonVariants: (props?: ({
|
|
6349
6372
|
variant?: "default" | "outline" | null | undefined;
|
|
6350
|
-
size?: "default" | "
|
|
6373
|
+
size?: "default" | "lg" | "sm" | null | undefined;
|
|
6351
6374
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6352
6375
|
/**
|
|
6353
6376
|
* Primary clickable row inside a menu item, with variant/size styles and an
|
|
@@ -6508,7 +6531,7 @@ declare namespace Toaster {
|
|
|
6508
6531
|
//#region src/components/spinner.d.ts
|
|
6509
6532
|
/** Class variants for `Spinner`, controlling its `size` (`default`, `sm`, `lg`, `xl`). */
|
|
6510
6533
|
declare const spinnerVariants: (props?: ({
|
|
6511
|
-
size?: "default" | "
|
|
6534
|
+
size?: "default" | "lg" | "sm" | "xl" | null | undefined;
|
|
6512
6535
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6513
6536
|
/**
|
|
6514
6537
|
* Animated loading indicator. Renders a spinning `<svg>` (Loader icon) with
|
package/dist/index.js
CHANGED
|
@@ -115,7 +115,7 @@ const AccordionTrigger = React.forwardRef((componentProps, forwardRef) => {
|
|
|
115
115
|
children: /* @__PURE__ */ jsxs(Accordion$1.Trigger, _objectSpread2(_objectSpread2({
|
|
116
116
|
ref: forwardRef,
|
|
117
117
|
"data-slot": "accordion-trigger",
|
|
118
|
-
className: cn("group/accordion-trigger relative flex flex-1 items-start justify-between rounded-md border border-transparent py-4 text-left text-sm font-medium transition-all outline-none
|
|
118
|
+
className: cn("group/accordion-trigger relative flex flex-1 items-start justify-between rounded-md border border-transparent py-4 text-left text-sm font-medium transition-all outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground", className)
|
|
119
119
|
}, props), {}, { children: [
|
|
120
120
|
children,
|
|
121
121
|
/* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
@@ -1347,8 +1347,12 @@ const _excluded6$17 = ["className"];
|
|
|
1347
1347
|
/**
|
|
1348
1348
|
* `class-variance-authority` config for {@link Avatar}. `size`
|
|
1349
1349
|
* (`xs` | `sm` | `default` | `lg` | `xl`, default `default`) sets the avatar's diameter.
|
|
1350
|
+
*
|
|
1351
|
+
* `isolate` makes the root a stacking context, so `AvatarBadge`'s `z-10` only lifts it above the
|
|
1352
|
+
* avatar's own picture. Without it the badge competed with the page: inside a `DataTable` it was drawn
|
|
1353
|
+
* over the sticky header (also `z-10`) while the rows scrolled under it.
|
|
1350
1354
|
*/
|
|
1351
|
-
const avatarVariants = cva("group/avatar relative flex shrink-0 rounded-full select-none", {
|
|
1355
|
+
const avatarVariants = cva("group/avatar relative isolate flex shrink-0 rounded-full select-none", {
|
|
1352
1356
|
variants: { size: {
|
|
1353
1357
|
xs: "size-5",
|
|
1354
1358
|
sm: "size-6",
|
|
@@ -5288,7 +5292,7 @@ const SEARCH_TRIGGER_REASONS = /* @__PURE__ */ new Set([
|
|
|
5288
5292
|
* ```
|
|
5289
5293
|
*/
|
|
5290
5294
|
function useComboboxItemSelection(options) {
|
|
5291
|
-
const { items, getItemValue, selectedItems, selectedKeys, defaultSelectedKeys, onSelectionChange, onSearch } = options;
|
|
5295
|
+
const { items, getItemValue, selectedItems, selectedKeys, defaultSelectedKeys, onSelectionChange, onSearch, preserveSearchOnSelect = false, open } = options;
|
|
5292
5296
|
const itemCacheRef = React.useRef(/* @__PURE__ */ new Map());
|
|
5293
5297
|
if (selectedItems) for (const item of selectedItems) itemCacheRef.current.set(getItemValue(item), item);
|
|
5294
5298
|
for (const item of items) itemCacheRef.current.set(getItemValue(item), item);
|
|
@@ -5312,22 +5316,40 @@ function useComboboxItemSelection(options) {
|
|
|
5312
5316
|
getItemValue,
|
|
5313
5317
|
onSelectionChange
|
|
5314
5318
|
]);
|
|
5315
|
-
const
|
|
5319
|
+
const queryRef = React.useRef("");
|
|
5320
|
+
const [displayQuery, setDisplayQuery] = React.useState("");
|
|
5321
|
+
const setCurrentQuery = React.useCallback((value) => {
|
|
5322
|
+
if (preserveSearchOnSelect) setDisplayQuery(value);
|
|
5323
|
+
else queryRef.current = value;
|
|
5324
|
+
}, [preserveSearchOnSelect]);
|
|
5325
|
+
const openRef = React.useRef(false);
|
|
5326
|
+
const notifyOpenChange = React.useCallback((nextOpen) => {
|
|
5327
|
+
openRef.current = nextOpen;
|
|
5328
|
+
}, []);
|
|
5329
|
+
if (open !== void 0) openRef.current = open;
|
|
5316
5330
|
return {
|
|
5317
5331
|
keys,
|
|
5318
5332
|
selectedObjects,
|
|
5319
5333
|
commit,
|
|
5320
|
-
handleInputValueChange: onSearch ? (value, details) => {
|
|
5334
|
+
handleInputValueChange: onSearch || preserveSearchOnSelect ? (value, details) => {
|
|
5335
|
+
if (preserveSearchOnSelect && details.reason === "input-clear" && openRef.current) return;
|
|
5321
5336
|
if (SEARCH_TRIGGER_REASONS.has(details.reason)) {
|
|
5322
|
-
|
|
5323
|
-
onSearch(value);
|
|
5337
|
+
setCurrentQuery(value);
|
|
5338
|
+
onSearch === null || onSearch === void 0 || onSearch(value);
|
|
5324
5339
|
}
|
|
5325
5340
|
} : void 0,
|
|
5326
5341
|
resetSearch: React.useCallback(() => {
|
|
5327
|
-
if (
|
|
5328
|
-
|
|
5329
|
-
onSearch("");
|
|
5330
|
-
}, [
|
|
5342
|
+
if ((preserveSearchOnSelect ? displayQuery : queryRef.current) === "") return;
|
|
5343
|
+
setCurrentQuery("");
|
|
5344
|
+
onSearch === null || onSearch === void 0 || onSearch("");
|
|
5345
|
+
}, [
|
|
5346
|
+
onSearch,
|
|
5347
|
+
preserveSearchOnSelect,
|
|
5348
|
+
displayQuery,
|
|
5349
|
+
setCurrentQuery
|
|
5350
|
+
]),
|
|
5351
|
+
inputValue: preserveSearchOnSelect ? displayQuery : void 0,
|
|
5352
|
+
notifyOpenChange
|
|
5331
5353
|
};
|
|
5332
5354
|
}
|
|
5333
5355
|
//#endregion
|
|
@@ -5441,7 +5463,7 @@ function scrollHighlightedRowIntoView(scrollRowIntoViewRef, index, reason) {
|
|
|
5441
5463
|
*/
|
|
5442
5464
|
function DataCombobox(componentProps) {
|
|
5443
5465
|
var _selectedObjects$;
|
|
5444
|
-
const { items, getItemValue, getItemLabel, renderItem, renderChip, getGroupKey, getGroupLabel, selectionMode = "single", selectedKeys, defaultSelectedKeys, onSelectionChange, onOpenChange, open, selectedItems, disabledKeys, loadingState, skeletonCount, onSearch, onFetchMore, hasMore = false, emptyState, trigger, searchable = true, placeholder, disabled = false, className, contentClassName, anchor, "aria-label": ariaLabel, listAriaLabel, showClear = true, estimateRowHeight, "data-test": dataTest = "data-combobox" } = componentProps;
|
|
5466
|
+
const { items, getItemValue, getItemLabel, renderItem, renderChip, getGroupKey, getGroupLabel, selectionMode = "single", selectedKeys, defaultSelectedKeys, onSelectionChange, onOpenChange, open, selectedItems, disabledKeys, loadingState, skeletonCount, onSearch, onFetchMore, hasMore = false, emptyState, trigger, searchable = true, placeholder, disabled = false, className, contentClassName, anchor, "aria-label": ariaLabel, listAriaLabel, showClear = true, estimateRowHeight, "data-test": dataTest = "data-combobox", preserveSearchOnSelect = false } = componentProps;
|
|
5445
5467
|
const multiple = selectionMode === "multiple";
|
|
5446
5468
|
const isSearchable = resolveSearchable(searchable, !!onSearch, items.length);
|
|
5447
5469
|
const clientFilter = !isSearchable || onSearch || onFetchMore && hasMore ? null : void 0;
|
|
@@ -5449,16 +5471,19 @@ function DataCombobox(componentProps) {
|
|
|
5449
5471
|
if (!autoVirtualizeLatch.current) autoVirtualizeLatch.current = shouldAutoVirtualize(!!onFetchMore, items.length);
|
|
5450
5472
|
const virtualizeRows = resolveVirtualizeRows(componentProps.virtualizeRows, autoVirtualizeLatch.current, !!getGroupKey);
|
|
5451
5473
|
const scrollRowIntoViewRef = React.useRef(null);
|
|
5452
|
-
const { keys, selectedObjects, commit, handleInputValueChange, resetSearch } = useComboboxItemSelection({
|
|
5474
|
+
const { keys, selectedObjects, commit, handleInputValueChange, resetSearch, inputValue, notifyOpenChange } = useComboboxItemSelection({
|
|
5453
5475
|
items,
|
|
5454
5476
|
getItemValue,
|
|
5455
5477
|
selectedItems,
|
|
5456
5478
|
selectedKeys,
|
|
5457
5479
|
defaultSelectedKeys,
|
|
5458
5480
|
onSelectionChange,
|
|
5459
|
-
onSearch
|
|
5481
|
+
onSearch,
|
|
5482
|
+
preserveSearchOnSelect,
|
|
5483
|
+
open
|
|
5460
5484
|
});
|
|
5461
5485
|
const handleOpenChange = (nextOpen, details) => {
|
|
5486
|
+
notifyOpenChange(nextOpen);
|
|
5462
5487
|
if (!nextOpen) resetSearch();
|
|
5463
5488
|
onOpenChange === null || onOpenChange === void 0 || onOpenChange(nextOpen, details);
|
|
5464
5489
|
};
|
|
@@ -5508,6 +5533,7 @@ function DataCombobox(componentProps) {
|
|
|
5508
5533
|
itemToStringValue: getItemValue,
|
|
5509
5534
|
itemToStringLabel: getItemLabel,
|
|
5510
5535
|
isItemEqualToValue: (a, b) => getItemValue(a) === getItemValue(b),
|
|
5536
|
+
inputValue,
|
|
5511
5537
|
onInputValueChange: handleInputValueChange,
|
|
5512
5538
|
open,
|
|
5513
5539
|
onOpenChange: handleOpenChange,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aircall/ds",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": [
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"typescript": "6.0.3",
|
|
119
119
|
"vite": "7.3.1",
|
|
120
120
|
"vitest": "4.0.17",
|
|
121
|
-
"@aircall/hooks": "0.6.
|
|
121
|
+
"@aircall/hooks": "0.6.4"
|
|
122
122
|
},
|
|
123
123
|
"keywords": [
|
|
124
124
|
"tanstack-intent"
|