@giddaa-housing/ui 2.0.0 → 3.0.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 (62) hide show
  1. package/css/generated/shared.css +1 -1
  2. package/css/theme.css +24 -0
  3. package/dist/accordion.js +1 -1
  4. package/dist/{button-BZIeyUw6.d.ts → button-DW5OijoR.d.ts} +1 -1
  5. package/dist/button-group.d.ts +1 -1
  6. package/dist/button-group.js +2 -2
  7. package/dist/button.d.ts +1 -1
  8. package/dist/button.js +4 -3
  9. package/dist/call-card.d.ts +131 -0
  10. package/dist/call-card.js +300 -0
  11. package/dist/card.d.ts +4 -2
  12. package/dist/card.js +7 -7
  13. package/dist/carousel.js +12 -9
  14. package/dist/chat.d.ts +208 -0
  15. package/dist/chat.js +528 -0
  16. package/dist/checkbox.js +1 -1
  17. package/dist/combobox.d.ts +48 -1
  18. package/dist/combobox.js +78 -5
  19. package/dist/cta.d.ts +1 -1
  20. package/dist/data-table.d.ts +1 -1
  21. package/dist/data-table.js +1 -1
  22. package/dist/date-picker.d.ts +5 -2
  23. package/dist/date-picker.js +11 -6
  24. package/dist/dialog.js +2 -2
  25. package/dist/dropdown-menu.js +1 -1
  26. package/dist/file-upload.js +3 -3
  27. package/dist/infinite-scroll.d.ts +40 -0
  28. package/dist/infinite-scroll.js +125 -0
  29. package/dist/infotip.js +1 -1
  30. package/dist/input-group.d.ts +1 -1
  31. package/dist/media-player.js +15 -8
  32. package/dist/message.d.ts +263 -0
  33. package/dist/message.js +524 -0
  34. package/dist/multi-step-form.js +10 -6
  35. package/dist/page-header.d.ts +6 -6
  36. package/dist/page-header.js +21 -7
  37. package/dist/pagination.d.ts +1 -1
  38. package/dist/picker-xSTzeYhc.js +50 -0
  39. package/dist/popover.d.ts +2 -2
  40. package/dist/popover.js +3 -2
  41. package/dist/price-tag.js +1 -1
  42. package/dist/property-listing-card.d.ts +1 -1
  43. package/dist/radio-group.js +1 -1
  44. package/dist/rich-text-editor.js +3 -3
  45. package/dist/select.js +1 -1
  46. package/dist/sheet.js +1 -1
  47. package/dist/sidebar.d.ts +1 -1
  48. package/dist/sidebar.js +5 -5
  49. package/dist/skeleton.js +1 -1
  50. package/dist/slider.js +3 -2
  51. package/dist/styles.css +1893 -160
  52. package/dist/switch.js +3 -3
  53. package/dist/table.js +2 -2
  54. package/dist/tabs.js +4 -4
  55. package/dist/time-picker.d.ts +4 -1
  56. package/dist/time-picker.js +93 -12
  57. package/dist/toast.js +1 -1
  58. package/dist/tooltip.d.ts +2 -1
  59. package/dist/tooltip.js +9 -2
  60. package/dist/use-reduced-motion-BDvOK14x.js +17 -0
  61. package/package.json +18 -1
  62. package/dist/picker-lzgmsNfG.js +0 -32
package/dist/combobox.js CHANGED
@@ -8,6 +8,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { cva } from "class-variance-authority";
9
9
  import * as React from "react";
10
10
  import { Combobox as Combobox$1 } from "@base-ui/react";
11
+ import { useVirtualizer } from "@tanstack/react-virtual";
11
12
  //#region src/combobox.tsx
12
13
  const ComboboxSelectionContext = React.createContext({ multiple: false });
13
14
  function Combobox({ multiple, children, size, ...props }) {
@@ -39,7 +40,7 @@ const comboboxInputVariants = cva("w-auto has-data-popup-open:rounded-2xl has-da
39
40
  } },
40
41
  defaultVariants: { size: "md" }
41
42
  });
42
- const comboboxContentVariants = cva("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width))] origin-(--transform-origin) overflow-hidden border border-line-subtle bg-canvas text-fg-primary shadow-(--elevation-e1-shadow) duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:mb-1 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", {
43
+ const comboboxContentVariants = cva("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width))] origin-(--transform-origin) overflow-hidden border border-line-subtle bg-canvas text-fg-primary shadow-(--elevation-e1-shadow) transition-[opacity,scale,translate] duration-[var(--duration-motion-popup)] ease-gdt-out data-[chips=true]:min-w-(--anchor-width) data-starting-style:opacity-0 data-starting-style:scale-95 data-ending-style:opacity-0 data-ending-style:scale-95 data-[side=bottom]:data-starting-style:translate-y-2 data-[side=bottom]:data-ending-style:translate-y-2 data-[side=top]:data-starting-style:-translate-y-2 data-[side=top]:data-ending-style:-translate-y-2 data-[side=left]:data-starting-style:translate-x-2 data-[side=left]:data-ending-style:translate-x-2 data-[side=right]:data-starting-style:-translate-x-2 data-[side=right]:data-ending-style:-translate-x-2 data-[side=inline-end]:data-starting-style:-translate-x-2 data-[side=inline-end]:data-ending-style:-translate-x-2 data-[side=inline-start]:data-starting-style:translate-x-2 data-[side=inline-start]:data-ending-style:translate-x-2 motion-reduce:data-starting-style:scale-100 motion-reduce:data-ending-style:scale-100 motion-reduce:data-[side=bottom]:data-starting-style:translate-y-0 motion-reduce:data-[side=bottom]:data-ending-style:translate-y-0 motion-reduce:data-[side=top]:data-starting-style:translate-y-0 motion-reduce:data-[side=top]:data-ending-style:translate-y-0 motion-reduce:data-[side=left]:data-starting-style:translate-x-0 motion-reduce:data-[side=left]:data-ending-style:translate-x-0 motion-reduce:data-[side=right]:data-starting-style:translate-x-0 motion-reduce:data-[side=right]:data-ending-style:translate-x-0 motion-reduce:data-[side=inline-end]:data-starting-style:translate-x-0 motion-reduce:data-[side=inline-end]:data-ending-style:translate-x-0 motion-reduce:data-[side=inline-start]:data-starting-style:translate-x-0 motion-reduce:data-[side=inline-start]:data-ending-style:translate-x-0 *:data-[slot=input-group]:mb-1", {
43
44
  variants: { size: {
44
45
  sm: "rounded-lg p-1",
45
46
  md: "rounded-xl p-1.5",
@@ -115,7 +116,7 @@ function ComboboxInput({ className, children, disabled = false, showTrigger = tr
115
116
  variant: "ghost",
116
117
  render: /* @__PURE__ */ jsx(ComboboxTrigger, {}),
117
118
  "data-slot": "input-group-button",
118
- className: "h-6 border-0 bg-transparent p-0 shadow-none inset-ring-0 group-has-data-[slot=combobox-clear]/input-group:hidden hover:border-transparent focus-visible:border-transparent focus-visible:inset-ring-0 data-popup-open:border-transparent data-popup-open:bg-transparent data-popup-open:inset-ring-0 data-pressed:bg-transparent",
119
+ className: "border-0 bg-transparent p-0 shadow-none inset-ring-0 group-has-data-[slot=combobox-clear]/input-group:hidden hover:border-transparent focus-visible:border-transparent focus-visible:inset-ring-0 data-popup-open:border-transparent data-popup-open:bg-transparent data-popup-open:inset-ring-0 data-pressed:bg-transparent",
119
120
  disabled
120
121
  }), showClear && /* @__PURE__ */ jsx(ComboboxClear, { disabled })]
121
122
  }),
@@ -135,7 +136,7 @@ function ComboboxContent({ className, side = "bottom", sideOffset = 6, align = "
135
136
  children: /* @__PURE__ */ jsx(Combobox$1.Popup, {
136
137
  "data-slot": "combobox-content",
137
138
  "data-chips": !!anchor,
138
- className: cn("group/combobox-content", comboboxContentVariants({ size: resolvedSize }), className),
139
+ className: cn("group/combobox-content", comboboxContentVariants({ size: resolvedSize }), "has-data-[slot=combobox-virtualized]:max-h-none", className),
139
140
  ...props
140
141
  })
141
142
  }) });
@@ -143,7 +144,7 @@ function ComboboxContent({ className, side = "bottom", sideOffset = 6, align = "
143
144
  function ComboboxList({ className, ...props }) {
144
145
  return /* @__PURE__ */ jsx(Combobox$1.List, {
145
146
  "data-slot": "combobox-list",
146
- className: cn("no-scrollbar max-h-(--available-height) space-y-0.5 scroll-py-1 overflow-y-auto overscroll-contain data-empty:p-0", className),
147
+ className: cn("no-scrollbar max-h-(--available-height) space-y-0.5 scroll-py-1 overflow-y-auto overscroll-contain data-empty:p-0 has-data-[slot=combobox-virtualized]:max-h-none has-data-[slot=combobox-virtualized]:space-y-0 has-data-[slot=combobox-virtualized]:overflow-hidden", className),
147
148
  ...props
148
149
  });
149
150
  }
@@ -233,5 +234,77 @@ function ComboboxChipsInput({ className, ...props }) {
233
234
  function useComboboxAnchor() {
234
235
  return React.useRef(null);
235
236
  }
237
+ /**
238
+ * Wires up an external virtualizer for a large `Combobox`. Spread the returned
239
+ * `onItemHighlighted` onto `<Combobox virtualized items={...}>` and pass
240
+ * `virtualizerRef` to `<ComboboxVirtualizedList>`. Keeps keyboard navigation in
241
+ * sync by scrolling the highlighted (off-screen) item into view.
242
+ */
243
+ function useComboboxVirtualizer() {
244
+ const virtualizerRef = React.useRef(null);
245
+ return {
246
+ virtualizerRef,
247
+ onItemHighlighted: React.useCallback((item, { reason, index }) => {
248
+ const virtualizer = virtualizerRef.current;
249
+ if (item == null || !virtualizer || index < 0) return;
250
+ const isStart = index === 0;
251
+ const isEnd = index === virtualizer.options.count - 1;
252
+ if (reason === "none" || reason === "keyboard" && (isStart || isEnd)) queueMicrotask(() => {
253
+ virtualizer.scrollToIndex(index, { align: isEnd ? "start" : "end" });
254
+ });
255
+ }, [])
256
+ };
257
+ }
258
+ function ComboboxVirtualizedList({ virtualizerRef, estimateSize = 40, overscan = 20, paddingStart = 4, paddingEnd = 4, maxHeight = "22rem", className, children }) {
259
+ const filteredItems = Combobox$1.useFilteredItems();
260
+ const scrollElementRef = React.useRef(null);
261
+ const virtualizer = useVirtualizer({
262
+ count: filteredItems.length,
263
+ getScrollElement: () => scrollElementRef.current,
264
+ estimateSize: typeof estimateSize === "function" ? estimateSize : () => estimateSize,
265
+ overscan,
266
+ paddingStart,
267
+ paddingEnd,
268
+ scrollPaddingStart: paddingStart,
269
+ scrollPaddingEnd: paddingEnd
270
+ });
271
+ React.useImperativeHandle(virtualizerRef, () => virtualizer, [virtualizer]);
272
+ const handleScrollElementRef = React.useCallback((element) => {
273
+ scrollElementRef.current = element;
274
+ if (element) virtualizer.measure();
275
+ }, [virtualizer]);
276
+ const totalSize = virtualizer.getTotalSize();
277
+ if (!filteredItems.length) return null;
278
+ return /* @__PURE__ */ jsx("div", {
279
+ role: "presentation",
280
+ ref: handleScrollElementRef,
281
+ "data-slot": "combobox-virtualized",
282
+ style: { maxHeight },
283
+ className: cn("no-scrollbar overflow-y-auto overscroll-contain", className),
284
+ children: /* @__PURE__ */ jsx("div", {
285
+ role: "presentation",
286
+ className: "relative w-full",
287
+ style: { height: totalSize },
288
+ children: virtualizer.getVirtualItems().map((virtualItem) => {
289
+ const item = filteredItems[virtualItem.index];
290
+ if (item == null) return null;
291
+ return /* @__PURE__ */ jsx(React.Fragment, { children: children(item, {
292
+ index: virtualItem.index,
293
+ "data-index": virtualItem.index,
294
+ "aria-setsize": filteredItems.length,
295
+ "aria-posinset": virtualItem.index + 1,
296
+ style: {
297
+ position: "absolute",
298
+ top: 0,
299
+ left: 0,
300
+ width: "100%",
301
+ height: virtualItem.size,
302
+ transform: `translateY(${virtualItem.start}px)`
303
+ }
304
+ }) }, virtualItem.key);
305
+ })
306
+ })
307
+ });
308
+ }
236
309
  //#endregion
237
- export { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, useComboboxAnchor };
310
+ export { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, ComboboxVirtualizedList, useComboboxAnchor, useComboboxVirtualizer };
package/dist/cta.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as ButtonLink, t as Button } from "./button-BZIeyUw6.js";
1
+ import { n as ButtonLink, t as Button } from "./button-DW5OijoR.js";
2
2
  import { useRender } from "@base-ui/react/use-render";
3
3
  import { VariantProps } from "class-variance-authority";
4
4
  import * as React from "react";
@@ -1,4 +1,4 @@
1
- import { t as Button } from "./button-BZIeyUw6.js";
1
+ import { t as Button } from "./button-DW5OijoR.js";
2
2
  import { Empty } from "./empty-state.js";
3
3
  import { FilterApplyButtonProps, FilterContentProps, FilterProps, FilterResetButtonProps } from "./filter.js";
4
4
  import { Pagination } from "./pagination.js";
@@ -243,7 +243,7 @@ function DataTable({ className, containerClassName, emptyState, interactiveColum
243
243
  pinnedSide,
244
244
  style: getCommonPinningStyles(header.column),
245
245
  children: header.isPlaceholder ? null : /* @__PURE__ */ jsxs("div", {
246
- className: "flex items-center gap-2",
246
+ className: "flex min-w-0 items-center gap-2",
247
247
  children: [
248
248
  flexRender(header.column.columnDef.header, header.getContext()),
249
249
  header.column.getCanSort() ? /* @__PURE__ */ jsx("button", {
@@ -1,9 +1,12 @@
1
+ import { n as InputSize } from "./input-CfoEJ8A6.js";
1
2
  import * as React from "react";
2
3
  import { DateRange, Matcher } from "react-day-picker";
3
4
  //#region src/date-picker.d.ts
4
5
  type CaptionLayout = "label" | "dropdown" | "dropdown-months" | "dropdown-years";
5
6
  interface DatePickerBaseProps {
6
7
  disabled?: boolean;
8
+ /** Controls the trigger size. The calendar panel is not resized. */
9
+ size?: InputSize;
7
10
  placeholder?: string;
8
11
  className?: string;
9
12
  /** Caption style. Defaults to month + year dropdowns for quick navigation. */
@@ -19,11 +22,11 @@ interface DatePickerProps extends DatePickerBaseProps {
19
22
  value?: Date;
20
23
  onChange?: (date: Date | undefined) => void;
21
24
  }
22
- declare function DatePicker({ value, onChange, disabled, placeholder, className, captionLayout, startMonth, endMonth, disabledDates }: DatePickerProps): React.JSX.Element;
25
+ declare function DatePicker({ value, onChange, disabled, size, placeholder, className, captionLayout, startMonth, endMonth, disabledDates }: DatePickerProps): React.JSX.Element;
23
26
  interface DateRangePickerProps extends DatePickerBaseProps {
24
27
  value?: DateRange;
25
28
  onChange?: (range: DateRange | undefined) => void;
26
29
  }
27
- declare function DateRangePicker({ value, onChange, disabled, placeholder, className, captionLayout, startMonth, endMonth, disabledDates }: DateRangePickerProps): React.JSX.Element;
30
+ declare function DateRangePicker({ value, onChange, disabled, size, placeholder, className, captionLayout, startMonth, endMonth, disabledDates }: DateRangePickerProps): React.JSX.Element;
28
31
  //#endregion
29
32
  export { DatePicker, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps };
@@ -2,7 +2,7 @@
2
2
  import { t as cn } from "./cn-BI_4DMBf.js";
3
3
  import { Calendar } from "./calendar.js";
4
4
  import { Popover, PopoverContent } from "./popover.js";
5
- import { n as PickerTrigger, t as PickerFooter } from "./picker-lzgmsNfG.js";
5
+ import { n as PickerFooter, r as PickerTrigger, t as PICKER_COLLISION_AVOIDANCE } from "./picker-xSTzeYhc.js";
6
6
  import { CalendarIcon } from "lucide-react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import * as React from "react";
@@ -14,14 +14,14 @@ function formatDate(date) {
14
14
  year: "numeric"
15
15
  });
16
16
  }
17
- const PANEL_CLASSES = "flex min-w-(--anchor-width) flex-col items-center gap-0 overflow-hidden rounded-2xl p-0";
17
+ const PANEL_CLASSES = "flex min-w-(--anchor-width) flex-col items-center gap-0 overflow-hidden rounded-2xl p-0 border border-line-subtle";
18
18
  function defaultStartMonth() {
19
19
  return new Date((/* @__PURE__ */ new Date()).getFullYear() - 100, 0);
20
20
  }
21
21
  function defaultEndMonth() {
22
22
  return new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 11);
23
23
  }
24
- function DatePicker({ value, onChange, disabled = false, placeholder = "Select date", className, captionLayout = "dropdown", startMonth, endMonth, disabledDates }) {
24
+ function DatePicker({ value, onChange, disabled = false, size, placeholder = "Select date", className, captionLayout = "dropdown", startMonth, endMonth, disabledDates }) {
25
25
  const [open, setOpen] = React.useState(false);
26
26
  const [pending, setPending] = React.useState(value);
27
27
  const [month, setMonth] = React.useState(() => value ?? /* @__PURE__ */ new Date());
@@ -41,11 +41,13 @@ function DatePicker({ value, onChange, disabled = false, placeholder = "Select d
41
41
  placeholder,
42
42
  disabled,
43
43
  open,
44
+ size,
44
45
  className
45
46
  }), /* @__PURE__ */ jsxs(PopoverContent, {
46
47
  showArrow: false,
47
- align: "start",
48
+ align: "center",
48
49
  side: "bottom",
50
+ collisionAvoidance: PICKER_COLLISION_AVOIDANCE,
49
51
  className: PANEL_CLASSES,
50
52
  children: [/* @__PURE__ */ jsx(Calendar, {
51
53
  mode: "single",
@@ -72,7 +74,7 @@ function DatePicker({ value, onChange, disabled = false, placeholder = "Select d
72
74
  })]
73
75
  });
74
76
  }
75
- function DateRangePicker({ value, onChange, disabled = false, placeholder = "Select date range", className, captionLayout = "dropdown", startMonth, endMonth, disabledDates }) {
77
+ function DateRangePicker({ value, onChange, disabled = false, size, placeholder = "Select date range", className, captionLayout = "dropdown", startMonth, endMonth, disabledDates }) {
76
78
  const [open, setOpen] = React.useState(false);
77
79
  const [pending, setPending] = React.useState(value);
78
80
  const [month, setMonth] = React.useState(() => value?.from ?? /* @__PURE__ */ new Date());
@@ -96,10 +98,13 @@ function DateRangePicker({ value, onChange, disabled = false, placeholder = "Sel
96
98
  placeholder,
97
99
  disabled,
98
100
  open,
101
+ size,
99
102
  className
100
103
  }), /* @__PURE__ */ jsxs(PopoverContent, {
101
104
  showArrow: false,
102
- align: "start",
105
+ align: "center",
106
+ side: "bottom",
107
+ collisionAvoidance: PICKER_COLLISION_AVOIDANCE,
103
108
  className: cn(PANEL_CLASSES, "w-auto"),
104
109
  children: [/* @__PURE__ */ jsx(Calendar, {
105
110
  mode: "range",
package/dist/dialog.js CHANGED
@@ -38,11 +38,11 @@ function DialogOverlay({ className, ...props }) {
38
38
  forceRender: true,
39
39
  "data-slot": "dialog-overlay",
40
40
  "data-nested": nested || void 0,
41
- className: cn("fixed inset-0 z-50 transition-opacity duration-150 data-closed:opacity-0 data-open:opacity-100", nested ? "bg-black/25" : "bg-black/55 supports-backdrop-filter:backdrop-blur-xl", className),
41
+ className: cn("fixed inset-0 z-50 transition-opacity duration-150 ease-gdt-out data-closed:opacity-0 data-open:opacity-100", nested ? "bg-black/25" : "bg-black/55 supports-backdrop-filter:backdrop-blur-xl", className),
42
42
  ...props
43
43
  });
44
44
  }
45
- const dialogContentVariants = cva("group/dialog-content fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100dvh-5rem)] w-full max-w-[calc(100vw-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col gap-4 overflow-visible rounded-2xl border border-line-subtle bg-surface-overlay bg-clip-padding p-(--dialog-padding) text-fg-primary shadow-(--elevation-e2-shadow) outline-none [--dialog-padding:1.25rem] transition-[opacity,transform] duration-200 ease-in-out data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 origin-center data-[nested-dialog-open]:scale-[0.96]", {
45
+ const dialogContentVariants = cva("group/dialog-content fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100dvh-5rem)] w-full max-w-[calc(100vw-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col gap-4 overflow-visible rounded-2xl border border-line-subtle bg-surface-overlay bg-clip-padding p-(--dialog-padding) text-fg-primary shadow-(--elevation-e2-shadow) outline-none [--dialog-padding:1.25rem] origin-center transition-[opacity,scale] duration-[var(--duration-motion-popup)] ease-gdt-out data-starting-style:opacity-0 data-starting-style:scale-95 data-ending-style:opacity-0 data-ending-style:scale-95 motion-reduce:data-starting-style:scale-100 motion-reduce:data-ending-style:scale-100 data-[nested-dialog-open]:scale-[0.96]", {
46
46
  variants: { size: {
47
47
  sm: "sm:w-90 sm:[--dialog-padding:1.5rem]",
48
48
  md: "sm:w-105 sm:[--dialog-padding:1.5rem]",
@@ -28,7 +28,7 @@ function DropdownMenuTrigger({ ...props }) {
28
28
  ...props
29
29
  });
30
30
  }
31
- const dropdownMenuContentVariants = cva("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto border border-line-subtle bg-canvas text-fg-primary shadow-(--elevation-e1-shadow) duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95", {
31
+ const dropdownMenuContentVariants = cva("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto border border-line-subtle bg-canvas text-fg-primary shadow-(--elevation-e1-shadow) transition-[opacity,scale,translate] duration-[var(--duration-motion-popup)] ease-gdt-out outline-none data-starting-style:opacity-0 data-starting-style:scale-95 data-ending-style:opacity-0 data-ending-style:scale-95 data-closed:overflow-hidden data-[side=bottom]:data-starting-style:translate-y-2 data-[side=bottom]:data-ending-style:translate-y-2 data-[side=top]:data-starting-style:-translate-y-2 data-[side=top]:data-ending-style:-translate-y-2 data-[side=left]:data-starting-style:translate-x-2 data-[side=left]:data-ending-style:translate-x-2 data-[side=right]:data-starting-style:-translate-x-2 data-[side=right]:data-ending-style:-translate-x-2 data-[side=inline-end]:data-starting-style:-translate-x-2 data-[side=inline-end]:data-ending-style:-translate-x-2 data-[side=inline-start]:data-starting-style:translate-x-2 data-[side=inline-start]:data-ending-style:translate-x-2 motion-reduce:data-starting-style:scale-100 motion-reduce:data-ending-style:scale-100 motion-reduce:data-[side=bottom]:data-starting-style:translate-y-0 motion-reduce:data-[side=bottom]:data-ending-style:translate-y-0 motion-reduce:data-[side=top]:data-starting-style:translate-y-0 motion-reduce:data-[side=top]:data-ending-style:translate-y-0 motion-reduce:data-[side=left]:data-starting-style:translate-x-0 motion-reduce:data-[side=left]:data-ending-style:translate-x-0 motion-reduce:data-[side=right]:data-starting-style:translate-x-0 motion-reduce:data-[side=right]:data-ending-style:translate-x-0 motion-reduce:data-[side=inline-end]:data-starting-style:translate-x-0 motion-reduce:data-[side=inline-end]:data-ending-style:translate-x-0 motion-reduce:data-[side=inline-start]:data-starting-style:translate-x-0 motion-reduce:data-[side=inline-start]:data-ending-style:translate-x-0", {
32
32
  variants: { size: {
33
33
  sm: "rounded-lg p-1",
34
34
  md: "rounded-xl p-1.5",
@@ -27,7 +27,7 @@ function FileUpload({ className, state = "uploading", value, "aria-busy": ariaBu
27
27
  "data-state": state,
28
28
  "data-value": progress,
29
29
  "aria-busy": ariaBusy ?? (state === "uploading" || void 0),
30
- className: cn("group/file-upload relative flex min-w-0 items-start gap-3 rounded-xl border border-line bg-surface p-3", "data-[state=error]:border-line-danger data-[state=error]:bg-surface-danger-subtle", className),
30
+ className: cn("group/file-upload relative flex min-w-0 items-start gap-3 rounded-xl border border-line bg-surface p-3 transition-[background-color,border-color,color] duration-[var(--duration-motion-press)] ease-gdt-out", "data-[state=error]:border-line-danger data-[state=error]:bg-surface-danger-subtle", className),
31
31
  ...props
32
32
  })
33
33
  });
@@ -64,7 +64,7 @@ function FileUploadPreviewAction({ className, ...props }) {
64
64
  function FileUploadIcon({ className, children, ...props }) {
65
65
  return /* @__PURE__ */ jsx("div", {
66
66
  "data-slot": "file-upload-icon",
67
- className: cn("flex size-11 shrink-0 items-center justify-center rounded-lg bg-surface-brand-subtle text-fg-brand", "group-data-[state=error]/file-upload:bg-surface-danger-subtle group-data-[state=error]/file-upload:text-status-danger", className),
67
+ className: cn("flex size-11 shrink-0 items-center justify-center rounded-lg bg-surface-brand-subtle text-fg-brand transition-[background-color,border-color,color] duration-[var(--duration-motion-press)] ease-gdt-out", "group-data-[state=error]/file-upload:bg-surface-danger-subtle group-data-[state=error]/file-upload:text-status-danger", className),
68
68
  ...props,
69
69
  children: children ?? /* @__PURE__ */ jsx(File, {
70
70
  "aria-hidden": "true",
@@ -112,7 +112,7 @@ function FileUploadStatus({ className, children, pendingLabel = "Waiting to uplo
112
112
  return /* @__PURE__ */ jsx("output", {
113
113
  "data-slot": "file-upload-status",
114
114
  "aria-live": "polite",
115
- className: cn("text-gdt-xs leading-snug text-fg-secondary", "group-data-[state=complete]/file-upload:text-status-success group-data-[state=error]/file-upload:text-status-danger", className),
115
+ className: cn("text-gdt-xs leading-snug text-fg-secondary transition-[background-color,border-color,color] duration-[var(--duration-motion-press)] ease-gdt-out", "group-data-[state=complete]/file-upload:text-status-success group-data-[state=error]/file-upload:text-status-danger", className),
116
116
  ...props,
117
117
  children: content
118
118
  });
@@ -0,0 +1,40 @@
1
+ import { ReactNode } from "react";
2
+ //#region src/infinite-scroll.d.ts
3
+ interface InfiniteScrollState {
4
+ /** Initial page load state, usually from useInfiniteQuery. */
5
+ isLoading: boolean;
6
+ /** Whether the flattened list has no items. */
7
+ isEmpty: boolean;
8
+ error?: Error | null;
9
+ hasNextPage: boolean | undefined;
10
+ isFetchingNextPage: boolean;
11
+ fetchNextPage: () => unknown;
12
+ }
13
+ declare function useInfiniteScrollSentinel({ hasNextPage, isFetchingNextPage, fetchNextPage, rootMargin }: Pick<InfiniteScrollState, "hasNextPage" | "isFetchingNextPage" | "fetchNextPage"> & {
14
+ rootMargin?: string;
15
+ }): import("react").RefCallback<HTMLDivElement | null>;
16
+ declare function InfiniteScroll({ children, isLoading, isEmpty, error, hasNextPage, isFetchingNextPage, fetchNextPage }: InfiniteScrollState & {
17
+ children: ReactNode;
18
+ }): import("react").JSX.Element;
19
+ declare function InfiniteScrollLoading({ children }: {
20
+ children?: ReactNode;
21
+ }): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null;
22
+ declare function InfiniteScrollContent({ children }: {
23
+ children: ReactNode;
24
+ }): ReactNode;
25
+ declare function InfiniteScrollEmpty({ children }: {
26
+ children: ReactNode;
27
+ }): ReactNode;
28
+ declare function InfiniteScrollError({ children }: {
29
+ children?: ReactNode;
30
+ }): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null;
31
+ declare function InfiniteScrollEnd({ children }: {
32
+ children: ReactNode;
33
+ }): ReactNode;
34
+ declare function InfiniteScrollSentinel({ rootMargin, className }: {
35
+ /** Distance from the viewport at which the next fetch triggers. */
36
+ rootMargin?: string;
37
+ className?: string;
38
+ }): import("react").JSX.Element | null;
39
+ //#endregion
40
+ export { InfiniteScroll, InfiniteScrollContent, InfiniteScrollEmpty, InfiniteScrollEnd, InfiniteScrollError, InfiniteScrollLoading, InfiniteScrollSentinel, type InfiniteScrollState, useInfiniteScrollSentinel };
@@ -0,0 +1,125 @@
1
+ "use client";
2
+ import { t as cn } from "./cn-BI_4DMBf.js";
3
+ import { Loader2 } from "lucide-react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
6
+ //#region src/lib/use-intersection.ts
7
+ function useIntersection(options) {
8
+ const [entry, setEntry] = useState(null);
9
+ const observer = useRef(null);
10
+ return {
11
+ ref: useCallback((element) => {
12
+ if (observer.current) {
13
+ observer.current.disconnect();
14
+ observer.current = null;
15
+ }
16
+ if (element === null) {
17
+ setEntry(null);
18
+ return;
19
+ }
20
+ if (typeof IntersectionObserver === "undefined") {
21
+ setEntry(null);
22
+ return;
23
+ }
24
+ observer.current = new IntersectionObserver(([_entry]) => {
25
+ setEntry(_entry ?? null);
26
+ }, options);
27
+ observer.current.observe(element);
28
+ }, [options]),
29
+ entry
30
+ };
31
+ }
32
+ //#endregion
33
+ //#region src/infinite-scroll.tsx
34
+ const InfiniteScrollContext = createContext(null);
35
+ function useInfiniteScrollContext(consumer) {
36
+ const context = useContext(InfiniteScrollContext);
37
+ if (!context) throw new Error(`${consumer} must be used within <InfiniteScroll>`);
38
+ return context;
39
+ }
40
+ function useInfiniteScrollSentinel({ hasNextPage, isFetchingNextPage, fetchNextPage, rootMargin = "200px" }) {
41
+ const { ref, entry } = useIntersection(useMemo(() => ({ rootMargin }), [rootMargin]));
42
+ useEffect(() => {
43
+ if (entry?.isIntersecting && hasNextPage && !isFetchingNextPage) fetchNextPage();
44
+ }, [
45
+ entry?.isIntersecting,
46
+ hasNextPage,
47
+ isFetchingNextPage,
48
+ fetchNextPage
49
+ ]);
50
+ return ref;
51
+ }
52
+ function InfiniteScroll({ children, isLoading, isEmpty, error, hasNextPage, isFetchingNextPage, fetchNextPage }) {
53
+ const value = useMemo(() => ({
54
+ isLoading,
55
+ isEmpty,
56
+ error,
57
+ hasNextPage,
58
+ isFetchingNextPage,
59
+ fetchNextPage
60
+ }), [
61
+ isLoading,
62
+ isEmpty,
63
+ error,
64
+ hasNextPage,
65
+ isFetchingNextPage,
66
+ fetchNextPage
67
+ ]);
68
+ return /* @__PURE__ */ jsx(InfiniteScrollContext.Provider, {
69
+ value,
70
+ children
71
+ });
72
+ }
73
+ function DefaultLoader({ label }) {
74
+ return /* @__PURE__ */ jsxs("output", {
75
+ "aria-live": "polite",
76
+ className: "flex items-center justify-center gap-2 px-4 py-6 text-fg-secondary text-gdt-sm",
77
+ children: [/* @__PURE__ */ jsx(Loader2, { className: "animate-spin motion-reduce:animate-none" }), /* @__PURE__ */ jsx("span", { children: label })]
78
+ });
79
+ }
80
+ function InfiniteScrollLoading({ children }) {
81
+ const { isLoading, isFetchingNextPage } = useInfiniteScrollContext("InfiniteScrollLoading");
82
+ if (!isLoading && !isFetchingNextPage) return null;
83
+ return children ?? /* @__PURE__ */ jsx(DefaultLoader, { label: isFetchingNextPage ? "Loading more..." : "Loading..." });
84
+ }
85
+ function InfiniteScrollContent({ children }) {
86
+ const { isLoading, isEmpty } = useInfiniteScrollContext("InfiniteScrollContent");
87
+ if (isLoading || isEmpty) return null;
88
+ return children;
89
+ }
90
+ function InfiniteScrollEmpty({ children }) {
91
+ const { isLoading, isEmpty, error } = useInfiniteScrollContext("InfiniteScrollEmpty");
92
+ if (isLoading || error || !isEmpty) return null;
93
+ return children;
94
+ }
95
+ function InfiniteScrollError({ children }) {
96
+ const { error } = useInfiniteScrollContext("InfiniteScrollError");
97
+ if (!error) return null;
98
+ return children ?? /* @__PURE__ */ jsx("div", {
99
+ role: "alert",
100
+ className: "px-4 py-4 text-center text-fg-danger text-gdt-sm",
101
+ children: error.message || "Something went wrong while loading more items."
102
+ });
103
+ }
104
+ function InfiniteScrollEnd({ children }) {
105
+ const { isLoading, isEmpty, hasNextPage, error } = useInfiniteScrollContext("InfiniteScrollEnd");
106
+ if (isLoading || isEmpty || hasNextPage || error) return null;
107
+ return children;
108
+ }
109
+ function InfiniteScrollSentinel({ rootMargin, className }) {
110
+ const { hasNextPage, isFetchingNextPage, fetchNextPage } = useInfiniteScrollContext("InfiniteScrollSentinel");
111
+ const ref = useInfiniteScrollSentinel({
112
+ hasNextPage,
113
+ isFetchingNextPage,
114
+ fetchNextPage,
115
+ rootMargin
116
+ });
117
+ if (!hasNextPage) return null;
118
+ return /* @__PURE__ */ jsx("div", {
119
+ ref,
120
+ "aria-hidden": "true",
121
+ className: cn("h-px", className)
122
+ });
123
+ }
124
+ //#endregion
125
+ export { InfiniteScroll, InfiniteScrollContent, InfiniteScrollEmpty, InfiniteScrollEnd, InfiniteScrollError, InfiniteScrollLoading, InfiniteScrollSentinel, useInfiniteScrollSentinel };
package/dist/infotip.js CHANGED
@@ -29,7 +29,7 @@ function InfotipContent({ className, container, side = "top", sideOffset = 6, al
29
29
  className: "isolate z-50",
30
30
  children: /* @__PURE__ */ jsxs(Popover.Popup, {
31
31
  "data-slot": "infotip-content",
32
- className: cn("z-50 relative inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-[6px] border border-line bg-surface-overlay px-3 py-2 text-gdt-sm font-medium text-fg-primary shadow-2 duration-100 has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
32
+ className: cn("z-50 relative inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-[6px] border border-line bg-surface-overlay px-3 py-2 text-gdt-sm font-medium text-fg-primary shadow-2 transition-[opacity,scale,translate] duration-[var(--duration-motion-tooltip)] ease-gdt-out has-data-[slot=kbd]:pr-1.5 data-starting-style:opacity-0 data-starting-style:scale-95 data-ending-style:opacity-0 data-ending-style:scale-95 data-[side=bottom]:data-starting-style:translate-y-2 data-[side=bottom]:data-ending-style:translate-y-2 data-[side=top]:data-starting-style:-translate-y-2 data-[side=top]:data-ending-style:-translate-y-2 data-[side=left]:data-starting-style:translate-x-2 data-[side=left]:data-ending-style:translate-x-2 data-[side=right]:data-starting-style:-translate-x-2 data-[side=right]:data-ending-style:-translate-x-2 data-[side=inline-end]:data-starting-style:-translate-x-2 data-[side=inline-end]:data-ending-style:-translate-x-2 data-[side=inline-start]:data-starting-style:translate-x-2 data-[side=inline-start]:data-ending-style:translate-x-2 motion-reduce:data-starting-style:scale-100 motion-reduce:data-ending-style:scale-100 motion-reduce:data-[side=bottom]:data-starting-style:translate-y-0 motion-reduce:data-[side=bottom]:data-ending-style:translate-y-0 motion-reduce:data-[side=top]:data-starting-style:translate-y-0 motion-reduce:data-[side=top]:data-ending-style:translate-y-0 motion-reduce:data-[side=left]:data-starting-style:translate-x-0 motion-reduce:data-[side=left]:data-ending-style:translate-x-0 motion-reduce:data-[side=right]:data-starting-style:translate-x-0 motion-reduce:data-[side=right]:data-ending-style:translate-x-0 motion-reduce:data-[side=inline-end]:data-starting-style:translate-x-0 motion-reduce:data-[side=inline-end]:data-ending-style:translate-x-0 motion-reduce:data-[side=inline-start]:data-starting-style:translate-x-0 motion-reduce:data-[side=inline-start]:data-ending-style:translate-x-0 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm", className),
33
33
  ...props,
34
34
  children: [children, showArrow ? /* @__PURE__ */ jsx(Popover.Arrow, { className: "relative block w-3 h-1.5 overflow-clip data-[side=bottom]:top-[-6px] data-[side=left]:right-[-9px] data-[side=left]:rotate-90 data-[side=right]:left-[-9px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-6px] data-[side=top]:rotate-180 before:content-[''] before:absolute before:bottom-0 before:left-1/2 before:w-[calc(6px*sqrt(2))] before:h-[calc(6px*sqrt(2))] before:bg-surface-overlay before:border before:border-line before:[transform:translate(-50%,50%)_rotate(45deg)]" }) : null]
35
35
  })
@@ -1,4 +1,4 @@
1
- import { t as Button } from "./button-BZIeyUw6.js";
1
+ import { t as Button } from "./button-DW5OijoR.js";
2
2
  import { n as InputSize } from "./input-CfoEJ8A6.js";
3
3
  import { n as TextareaSize } from "./textarea-IS_D8pXf.js";
4
4
  import { VariantProps } from "class-variance-authority";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { t as cn } from "./cn-BI_4DMBf.js";
3
3
  import { DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./dropdown-menu.js";
4
- import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
4
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.js";
5
5
  import { Captions, CaptionsOff, Maximize, Minimize, Pause, PictureInPicture2, Play, RefreshCcw, Repeat2, RotateCcw, RotateCw, Settings, TriangleAlert, Volume1, Volume2, VolumeX } from "lucide-react";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
7
  import * as React from "react";
@@ -83,9 +83,13 @@ function MediaPlayer({ mediaStore, ...props }) {
83
83
  const audio = props.audio ?? (hasAudioChild(props.children) ? true : void 0);
84
84
  return /* @__PURE__ */ jsx(MediaProvider, {
85
85
  mediaStore,
86
- children: /* @__PURE__ */ jsx(MediaPlayerRoot, {
87
- ...props,
88
- audio
86
+ children: /* @__PURE__ */ jsx(TooltipProvider, {
87
+ delay: 300,
88
+ timeout: 400,
89
+ children: /* @__PURE__ */ jsx(MediaPlayerRoot, {
90
+ ...props,
91
+ audio
92
+ })
89
93
  })
90
94
  });
91
95
  }
@@ -311,7 +315,7 @@ function MediaControlButton({ className, shortcut, tooltip, ...props }) {
311
315
  });
312
316
  if (!tooltip) return button;
313
317
  return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
314
- delay: 300,
318
+ delay: void 0,
315
319
  render: button
316
320
  }), /* @__PURE__ */ jsxs(TooltipContent, {
317
321
  className: "border-line-subtle px-2.5 py-1.5 text-gdt-xs font-bold",
@@ -411,6 +415,7 @@ function MediaPlayerVolume({ className, disabled, expandable = false, onClick, r
411
415
  ...props,
412
416
  children: /* @__PURE__ */ jsx(Icon, {})
413
417
  }), /* @__PURE__ */ jsx(Slider.Root, {
418
+ thumbAlignment: "edge",
414
419
  "data-slot": "media-player-volume-slider",
415
420
  className: cn("flex h-8 w-20 min-w-20 touch-none items-center", resolvedDisabled && "pointer-events-none opacity-45", expandable && "pointer-events-none opacity-0 transition-opacity group-hover/volume:pointer-events-auto group-hover/volume:opacity-100 group-focus-within/volume:pointer-events-auto group-focus-within/volume:opacity-100", rangeClassName),
416
421
  disabled: resolvedDisabled,
@@ -660,6 +665,7 @@ function MediaPlayerSeek({ className, disabled, onValueChange, "aria-label": ari
660
665
  end: segmentBounds[index + 1] ?? start
661
666
  }));
662
667
  return /* @__PURE__ */ jsxs(Slider.Root, {
668
+ thumbAlignment: "edge",
663
669
  "data-slot": "media-player-seek",
664
670
  className: cn("relative flex h-8 w-full min-w-0 touch-none items-center", resolvedDisabled && "pointer-events-none opacity-45", className),
665
671
  disabled: resolvedDisabled,
@@ -758,15 +764,16 @@ function MediaPlayerSeek({ className, disabled, onValueChange, "aria-label": ari
758
764
  }
759
765
  }, `${bufferStart}-${bufferEnd}`) : null), /* @__PURE__ */ jsx("span", {
760
766
  "data-slot": "media-player-seek-progress",
761
- className: cn("absolute inset-y-0 left-0 bg-surface-brand", dragValue === null && "transition-[width] duration-200 ease-linear"),
762
- style: { width: `${playedWidth}%` }
767
+ "data-dragging": dragValue !== null || void 0,
768
+ className: "absolute inset-y-0 left-0 w-full origin-left bg-surface-brand transition-transform duration-200 ease-linear data-[dragging=true]:transition-none",
769
+ style: { transform: `scaleX(${playedWidth / 100})` }
763
770
  })]
764
771
  }, start);
765
772
  })
766
773
  }), /* @__PURE__ */ jsx(Slider.Thumb, {
767
774
  getAriaLabel: () => ariaLabel ?? "Media timeline",
768
775
  getAriaValueText: (_formatted, value) => `${formatTime(value)} of ${formatTime(max)}`,
769
- className: cn("size-3.5 -translate-x-1/2 rounded-full bg-surface-overlay shadow-2 ring-2 ring-surface-brand outline-none", "transition-[inset-inline-start,transform] duration-200 ease-linear data-[dragging]:scale-125 data-[dragging]:transition-transform", "focus-visible:[filter:drop-shadow(0_0_0.25rem_var(--color-line-focus))]")
776
+ className: cn("size-3.5 -translate-x-1/2 rounded-full bg-surface-overlay shadow-2 ring-2 ring-surface-brand outline-none", "transition-[scale] duration-[var(--duration-motion-press)] ease-gdt-out data-[dragging]:scale-125 motion-reduce:data-[dragging]:scale-100 data-[dragging]:transition-none", "focus-visible:[filter:drop-shadow(0_0_0.25rem_var(--color-line-focus))]")
770
777
  })]
771
778
  })]
772
779
  });