@aircall/ds 0.46.0 → 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 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" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
100
- size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" | 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
  /**
@@ -882,6 +882,10 @@ 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
891
  size?: "default" | "sm" | "lg" | "xs" | "xl" | null | undefined;
@@ -990,8 +994,8 @@ declare namespace CounterBadge {
990
994
  /** `cva` recipe for the Badge/Chip container — drives the `size`, `color`, and `tone` classes. */
991
995
  declare const badgeVariants: (props?: ({
992
996
  size?: "default" | "lg" | null | undefined;
993
- color?: "charcoal" | "red" | "green" | "blue" | "purple" | "yellow" | "pink" | null | undefined;
994
- tone?: "dark" | "medium-dark" | "medium-light" | "light" | null | undefined;
997
+ color?: "blue" | "green" | "pink" | "purple" | "red" | "yellow" | "charcoal" | null | undefined;
998
+ tone?: "dark" | "light" | "medium-dark" | "medium-light" | null | undefined;
995
999
  overflowMode?: "none" | "truncate" | null | undefined;
996
1000
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
997
1001
  type BadgeVariants = VariantProps<typeof badgeVariants>;
@@ -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>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
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>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
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;
@@ -5813,7 +5836,12 @@ interface ScrollAreaProps extends ScrollAreaPrimitive.Root.Props {
5813
5836
  */
5814
5837
  scrollFade?: boolean;
5815
5838
  /**
5816
- * Reserve inline padding for the scrollbar so content does not sit under it.
5839
+ * Shrinks the viewport's content box (via padding-inline-end for vertical overflow,
5840
+ * padding-bottom for horizontal overflow) so the overlaid scrollbar has dedicated empty space
5841
+ * to sit in, instead of floating on top of the last row/column of content. The root's overall
5842
+ * size is unchanged - this trades a bit of the existing content area for the gutter, it does
5843
+ * not add space. Reach for this whenever a fixed-height/width `ScrollArea` (e.g. a 40px chip
5844
+ * row) would otherwise have its scrollbar overlapping content.
5817
5845
  * @default false
5818
5846
  */
5819
5847
  scrollbarGutter?: boolean;
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",
@@ -3137,7 +3141,7 @@ const _excluded$46 = [
3137
3141
  "type",
3138
3142
  "block"
3139
3143
  ];
3140
- const inputVariants = cva("text-foreground file:text-foreground placeholder:text-muted-foreground dark:bg-input/30 border-input flex h-10 w-full min-w-0 rounded-md border bg-background px-3 py-2 text-sm transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 dark:disabled:bg-input/80 md:text-sm 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", { variants: { block: { true: "w-full" } } });
3144
+ const inputVariants = cva("text-foreground file:text-foreground placeholder:text-muted-foreground dark:bg-input/30 border-input flex h-10 w-full min-w-0 rounded-md border bg-background px-3 py-2 text-sm transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 dark:disabled:bg-input/80 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", { variants: { block: { true: "w-full" } } });
3141
3145
  /**
3142
3146
  * Single-line text field styled to the design system.
3143
3147
  *
@@ -4233,7 +4237,7 @@ const Textarea = React.forwardRef((componentProps, forwardRef) => {
4233
4237
  return /* @__PURE__ */ jsx("textarea", _objectSpread2({
4234
4238
  ref: forwardRef,
4235
4239
  "data-slot": "textarea",
4236
- 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)
4240
+ 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-sm shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 dark:disabled:bg-input/80", className)
4237
4241
  }, props));
4238
4242
  });
4239
4243
  Textarea.displayName = "Textarea";
@@ -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 lastQueryRef = React.useRef("");
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
- lastQueryRef.current = value;
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 (!onSearch || lastQueryRef.current === "") return;
5328
- lastQueryRef.current = "";
5329
- onSearch("");
5330
- }, [onSearch])
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,
@@ -10785,7 +10811,7 @@ const NumericInputControl = React.forwardRef((componentProps, forwardRef) => {
10785
10811
  return /* @__PURE__ */ jsx(NumberField.Input, _objectSpread2({
10786
10812
  ref: forwardRef,
10787
10813
  "data-slot": "input-group-control",
10788
- className: cn("text-foreground placeholder:text-muted-foreground min-w-0 flex-1 rounded-none border-0 bg-transparent px-3 py-2 text-base shadow-none outline-none disabled:opacity-100 md:text-sm", className),
10814
+ className: cn("text-foreground placeholder:text-muted-foreground min-w-0 flex-1 rounded-none border-0 bg-transparent px-3 py-2 text-sm shadow-none outline-none disabled:opacity-100", className),
10789
10815
  onChange: handleChange
10790
10816
  }, props));
10791
10817
  });
@@ -12775,7 +12801,7 @@ const RichTextareaContent = React.forwardRef((componentProps, forwardRef) => {
12775
12801
  "data-slot": "rich-textarea",
12776
12802
  "data-test": dataTest,
12777
12803
  "data-multiline": bare ? "true" : void 0,
12778
- className: cn("flex max-h-60 min-h-20 w-full flex-col overflow-y-auto px-3 py-2 text-base transition-[color,box-shadow] md:text-sm", bare ? "flex-1 border-0 bg-transparent shadow-none" : "border-input focus-within:border-ring focus-within:ring-ring/50 dark:bg-input/30 rounded-md border bg-background shadow-xs focus-within:ring-3", disabled && "cursor-not-allowed", disabled && !bare && "opacity-50 bg-input/50 dark:bg-input/80", className),
12804
+ className: cn("flex max-h-60 min-h-20 w-full flex-col overflow-y-auto px-3 py-2 text-sm transition-[color,box-shadow]", bare ? "flex-1 border-0 bg-transparent shadow-none" : "border-input focus-within:border-ring focus-within:ring-ring/50 dark:bg-input/30 rounded-md border bg-background shadow-xs focus-within:ring-3", disabled && "cursor-not-allowed", disabled && !bare && "opacity-50 bg-input/50 dark:bg-input/80", className),
12779
12805
  children: /* @__PURE__ */ jsx(PlateContent, {
12780
12806
  ref: forwardRef,
12781
12807
  "data-slot": bare ? "input-group-control" : void 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aircall/ds",
3
- "version": "0.46.0",
3
+ "version": "0.47.0",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "sideEffects": [
@@ -99,18 +99,18 @@
99
99
  "@tanstack/intent": "0.1.1",
100
100
  "@turbo/gen": "2.4.2",
101
101
  "@types/node": "24",
102
- "@types/react": "19.2.18",
103
- "@types/react-dom": "19.2.5",
102
+ "@types/react": "19.3.0",
103
+ "@types/react-dom": "19.3.0",
104
104
  "@vitest/browser-playwright": "4.0.17",
105
105
  "@vitest/coverage-v8": "4.0.17",
106
106
  "chromatic": "18.5.0",
107
107
  "date-fns": "4.1.0",
108
108
  "i18next": "23.11.5",
109
109
  "playwright": "1.57.0",
110
- "react": "19.2.8",
110
+ "react": "19.3.0",
111
111
  "react-compiler-runtime": "1.0.0",
112
112
  "react-day-picker": "9.14.0",
113
- "react-dom": "19.2.8",
113
+ "react-dom": "19.3.0",
114
114
  "storybook": "10.3.3",
115
115
  "storybook-addon-pseudo-states": "10.3.3",
116
116
  "tailwindcss": "4.1.18",
@@ -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.3"
121
+ "@aircall/hooks": "0.6.4"
122
122
  },
123
123
  "keywords": [
124
124
  "tanstack-intent"