@aircall/ds 0.46.2 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +34 -11
- package/dist/index.js +39 -13
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -96,8 +96,8 @@ declare namespace AccordionContent {
|
|
|
96
96
|
//#region src/components/button.d.ts
|
|
97
97
|
/** `cva` variant definitions for {@link Button} — resolves `variant`, `size`, and `block` into class names. */
|
|
98
98
|
declare const buttonVariants: (props?: ({
|
|
99
|
-
variant?: "link" | "default" | "
|
|
100
|
-
size?: "default" | "
|
|
99
|
+
variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
|
|
100
|
+
size?: "default" | "icon" | "sm" | "lg" | "icon-sm" | "icon-lg" | null | undefined;
|
|
101
101
|
block?: boolean | null | undefined;
|
|
102
102
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
103
103
|
/**
|
|
@@ -658,7 +658,7 @@ declare namespace AlertDialogCancel {
|
|
|
658
658
|
* the icon level with the first line when the title wraps.
|
|
659
659
|
*/
|
|
660
660
|
declare const alertVariants: (props?: ({
|
|
661
|
-
variant?: "default" | "
|
|
661
|
+
variant?: "default" | "error" | "info" | "success" | "warning" | null | undefined;
|
|
662
662
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
663
663
|
/**
|
|
664
664
|
* Callout that draws attention to an important, contextual message.
|
|
@@ -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" | "sm" | "lg" | "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.
|
|
@@ -967,7 +971,7 @@ declare namespace AvatarGroupCount {
|
|
|
967
971
|
* (`default` | `secondary` | `ghost`, default `default`) sets the colour scheme.
|
|
968
972
|
*/
|
|
969
973
|
declare const counterBadgeVariants: (props?: ({
|
|
970
|
-
variant?: "default" | "
|
|
974
|
+
variant?: "default" | "secondary" | "ghost" | null | undefined;
|
|
971
975
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
972
976
|
/**
|
|
973
977
|
* Small pill for surfacing a count or short status, e.g. an unread indicator.
|
|
@@ -1069,7 +1073,7 @@ declare namespace BadgeGroupCount {
|
|
|
1069
1073
|
* edge gets the accent border.
|
|
1070
1074
|
*/
|
|
1071
1075
|
declare const bannerVariants: (props?: ({
|
|
1072
|
-
variant?: "default" | "
|
|
1076
|
+
variant?: "default" | "error" | "info" | "success" | "warning" | null | undefined;
|
|
1073
1077
|
borderDirection?: "bottom" | "top" | null | undefined;
|
|
1074
1078
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
1075
1079
|
/**
|
|
@@ -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;
|
|
@@ -5105,8 +5128,8 @@ declare namespace ItemSeparator {
|
|
|
5105
5128
|
type Props = ItemSeparatorProps;
|
|
5106
5129
|
}
|
|
5107
5130
|
declare const itemVariants: (props?: ({
|
|
5108
|
-
variant?: "default" | "
|
|
5109
|
-
size?: "default" | "
|
|
5131
|
+
variant?: "default" | "outline" | "muted" | null | undefined;
|
|
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>`
|
package/dist/index.js
CHANGED
|
@@ -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.0",
|
|
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"
|