@giddaa-housing/ui 3.4.0 → 3.6.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 (190) hide show
  1. package/css/components.css +13 -0
  2. package/css/generated/shared.css +1 -1
  3. package/dist/accordion.js +1 -1
  4. package/dist/activity-timeline.js +1 -1
  5. package/dist/alert.js +1 -1
  6. package/dist/auth-layout.js +1 -1
  7. package/dist/avatar.js +1 -1
  8. package/dist/badge.d.ts +5 -1
  9. package/dist/badge.js +20 -6
  10. package/dist/bar-chart.d.ts +1 -1
  11. package/dist/bar-chart.js +1 -1
  12. package/dist/breadcrumb.js +1 -1
  13. package/dist/bullet-chart.d.ts +1 -1
  14. package/dist/bullet-chart.js +1 -1
  15. package/dist/button-BS5KCibF.d.ts +33 -0
  16. package/dist/button-group.d.ts +1 -1
  17. package/dist/button-group.js +1 -1
  18. package/dist/button.d.ts +1 -1
  19. package/dist/button.js +50 -22
  20. package/dist/calendar.js +2 -2
  21. package/dist/call-card.js +1 -1
  22. package/dist/card.js +1 -1
  23. package/dist/carousel.d.ts +4 -2
  24. package/dist/carousel.js +13 -16
  25. package/dist/chart.d.ts +1 -1
  26. package/dist/chart.js +1 -1
  27. package/dist/chat.d.ts +1 -1
  28. package/dist/chat.js +1 -1
  29. package/dist/checkbox.d.ts +2 -2
  30. package/dist/checkbox.js +21 -7
  31. package/dist/collapsible.js +1 -1
  32. package/dist/combobox-CACVdp1R.js +430 -0
  33. package/dist/combobox.d.ts +9 -4
  34. package/dist/combobox.js +2 -309
  35. package/dist/cta.d.ts +1 -1
  36. package/dist/cta.js +1 -1
  37. package/dist/currency-selector.js +2 -2
  38. package/dist/data-table.d.ts +2 -2
  39. package/dist/data-table.js +1 -1
  40. package/dist/date-picker.d.ts +6 -5
  41. package/dist/date-picker.js +7 -17
  42. package/dist/details-card.js +1 -1
  43. package/dist/dialog.d.ts +3 -1
  44. package/dist/dialog.js +10 -6
  45. package/dist/dropdown-menu.d.ts +1 -1
  46. package/dist/dropdown-menu.js +1 -1
  47. package/dist/dropzone.js +1 -1
  48. package/dist/editorial-card.js +2 -4
  49. package/dist/empty-state.js +1 -1
  50. package/dist/field.d.ts +4 -1
  51. package/dist/field.js +29 -12
  52. package/dist/file-upload.js +1 -1
  53. package/dist/filter.js +1 -1
  54. package/dist/footer.d.ts +2 -2
  55. package/dist/footer.js +1 -1
  56. package/dist/funnel-chart.d.ts +1 -1
  57. package/dist/funnel-chart.js +1 -1
  58. package/dist/gallery-indicator.js +1 -1
  59. package/dist/heatmap-chart.d.ts +1 -1
  60. package/dist/icons-C9JXR5Xv.d.ts +111 -0
  61. package/dist/icons.d.ts +2 -93
  62. package/dist/icons.js +37 -1
  63. package/dist/image.d.ts +59 -0
  64. package/dist/image.js +53 -0
  65. package/dist/infinite-scroll.js +3 -29
  66. package/dist/infotip.js +1 -1
  67. package/dist/input-group.d.ts +6 -6
  68. package/dist/input-group.js +39 -14
  69. package/dist/input-otp.d.ts +2 -2
  70. package/dist/input-otp.js +32 -15
  71. package/dist/input-size-context-BMhves-J.d.ts +13 -0
  72. package/dist/input-size-context.d.ts +2 -2
  73. package/dist/input-size-context.js +9 -2
  74. package/dist/input.d.ts +20 -2
  75. package/dist/input.js +31 -12
  76. package/dist/item.js +1 -1
  77. package/dist/kpi-card.js +1 -1
  78. package/dist/label.js +1 -1
  79. package/dist/line-chart.d.ts +1 -1
  80. package/dist/line-chart.js +1 -1
  81. package/dist/list-item.js +1 -1
  82. package/dist/map-indicator.js +1 -1
  83. package/dist/mask-input.d.ts +1 -1
  84. package/dist/match.d.ts +5 -2
  85. package/dist/match.js +183 -27
  86. package/dist/media-gallery-hero.js +15 -10
  87. package/dist/media-player.js +5 -13
  88. package/dist/message.js +2 -12
  89. package/dist/mobile-sidebar.js +2 -1
  90. package/dist/multi-step-form.js +2 -2
  91. package/dist/number-input.d.ts +2 -2
  92. package/dist/number-input.js +3 -3
  93. package/dist/page-header.js +1 -1
  94. package/dist/pagination.d.ts +1 -1
  95. package/dist/pagination.js +1 -1
  96. package/dist/password-input.js +1 -1
  97. package/dist/phone-input.d.ts +2 -2
  98. package/dist/phone-input.js +16 -21
  99. package/dist/photo-gallery.js +6 -3
  100. package/dist/picker-BTXBrsl4.js +62 -0
  101. package/dist/picker-j3txxA5t.d.ts +14 -0
  102. package/dist/pie-chart.d.ts +1 -1
  103. package/dist/pie-chart.js +1 -1
  104. package/dist/popover-CNymD33m.d.ts +20 -0
  105. package/dist/popover.d.ts +1 -19
  106. package/dist/popover.js +1 -1
  107. package/dist/price-tag.d.ts +1 -1
  108. package/dist/price-tag.js +50 -22
  109. package/dist/progress.js +1 -1
  110. package/dist/property-listing-card.d.ts +68 -2
  111. package/dist/property-listing-card.js +115 -29
  112. package/dist/purchase-option-card.js +1 -1
  113. package/dist/radar-chart.d.ts +1 -1
  114. package/dist/radar-chart.js +1 -1
  115. package/dist/radio-group.d.ts +2 -2
  116. package/dist/radio-group.js +24 -10
  117. package/dist/review-block.js +1 -1
  118. package/dist/rich-text-editor.d.ts +1 -1
  119. package/dist/rich-text-editor.js +1 -1
  120. package/dist/scatter-chart.d.ts +1 -1
  121. package/dist/scatter-chart.js +1 -1
  122. package/dist/scroll-spy.d.ts +8 -2
  123. package/dist/scroll-spy.js +16 -16
  124. package/dist/search-input.js +1 -1
  125. package/dist/section-jumper.d.ts +31 -0
  126. package/dist/section-jumper.js +276 -0
  127. package/dist/select.d.ts +9 -4
  128. package/dist/select.js +113 -20
  129. package/dist/separator.js +1 -1
  130. package/dist/sheet.d.ts +3 -1
  131. package/dist/sheet.js +10 -6
  132. package/dist/sidebar.d.ts +2 -2
  133. package/dist/sidebar.js +4 -16
  134. package/dist/size-context-BVhHduLi.d.ts +33 -0
  135. package/dist/size-context.d.ts +2 -2
  136. package/dist/size-context.js +30 -1
  137. package/dist/skeleton.js +1 -1
  138. package/dist/slider.d.ts +5 -3
  139. package/dist/slider.js +26 -11
  140. package/dist/sonar.d.ts +1 -1
  141. package/dist/sonar.js +2 -2
  142. package/dist/sparkline.d.ts +1 -1
  143. package/dist/sparkline.js +1 -1
  144. package/dist/stepper.js +1 -1
  145. package/dist/styles.css +1622 -264
  146. package/dist/switch.d.ts +2 -2
  147. package/dist/switch.js +21 -7
  148. package/dist/table-card.js +1 -1
  149. package/dist/table.js +1 -1
  150. package/dist/tabs.d.ts +1 -1
  151. package/dist/tabs.js +1 -1
  152. package/dist/tag.d.ts +1 -1
  153. package/dist/tag.js +1 -1
  154. package/dist/testimonial-block.js +1 -1
  155. package/dist/textarea.d.ts +17 -1
  156. package/dist/textarea.js +24 -10
  157. package/dist/theme-switcher.js +1 -1
  158. package/dist/time-picker.d.ts +5 -4
  159. package/dist/time-picker.js +5 -7
  160. package/dist/toast.js +1 -1
  161. package/dist/tooltip.js +1 -1
  162. package/dist/top-navbar.js +1 -1
  163. package/dist/tree-map.d.ts +1 -1
  164. package/dist/tree-map.js +1 -1
  165. package/dist/utils/cn.d.ts +5 -0
  166. package/dist/utils/cn.js +33 -0
  167. package/dist/utils/format.d.ts +45 -0
  168. package/dist/utils/format.js +70 -0
  169. package/dist/utils/phone.d.ts +98 -0
  170. package/dist/utils/phone.js +93 -0
  171. package/dist/utils/use-intersection.d.ts +9 -0
  172. package/dist/utils/use-intersection.js +29 -0
  173. package/dist/utils/use-is-mobile.d.ts +5 -0
  174. package/dist/utils/use-is-mobile.js +16 -0
  175. package/dist/utils/use-reduced-motion.d.ts +5 -0
  176. package/dist/{use-reduced-motion-BDvOK14x.js → utils/use-reduced-motion.js} +2 -2
  177. package/dist/utils/use-uncontrolled.d.ts +11 -0
  178. package/dist/{use-uncontrolled-CLfM1XbB.js → utils/use-uncontrolled.js} +2 -2
  179. package/dist/video-player-dialog.d.ts +12 -2
  180. package/dist/video-player-dialog.js +50 -9
  181. package/dist/waterfall-chart.d.ts +1 -1
  182. package/dist/waterfall-chart.js +1 -1
  183. package/package.json +13 -1
  184. package/dist/button-DW5OijoR.d.ts +0 -17
  185. package/dist/cn-BI_4DMBf.js +0 -23
  186. package/dist/input-CfoEJ8A6.d.ts +0 -12
  187. package/dist/input-size-context-C-SFx9sx.d.ts +0 -10
  188. package/dist/picker-xSTzeYhc.js +0 -50
  189. package/dist/size-context-BX6kAdVj.d.ts +0 -11
  190. package/dist/textarea-IS_D8pXf.d.ts +0 -11
@@ -0,0 +1,430 @@
1
+ import { Check, ChevronDown, X } from "./icons.js";
2
+ import { cn } from "./utils/cn.js";
3
+ import { SizeProvider, useComponentSize } from "./size-context.js";
4
+ import { Button } from "./button.js";
5
+ import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "./input-group.js";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import { cva } from "class-variance-authority";
8
+ import * as React from "react";
9
+ import { useCallback, useRef, useState } from "react";
10
+ import { Combobox } from "@base-ui/react";
11
+ import { useVirtualizer } from "@tanstack/react-virtual";
12
+ //#region src/lib/use-grown.ts
13
+ /**
14
+ * Tracks whether an element has grown taller than its own `min-height` — a
15
+ * chips field that has wrapped onto a second row, in practice.
16
+ *
17
+ * CSS can ask about a container's width but never its own height, and a radius
18
+ * that reads as a pill on one row reads as a mistake on two, so the height has
19
+ * to be measured. `min-height` is the baseline because it is the height the
20
+ * control lays out at when empty. An element without one has no baseline to
21
+ * have grown past and always reports `false`, which is why the size variants
22
+ * that set a fixed `h-*` set a matching `min-h-*` beside it: a call site that
23
+ * swaps in `h-auto` then keeps both its floor and this measurement.
24
+ */
25
+ function useGrown() {
26
+ const [grown, setGrown] = useState(false);
27
+ const elementRef = useRef(null);
28
+ const observerRef = useRef(null);
29
+ const measure = useCallback(() => {
30
+ const element = elementRef.current;
31
+ if (!element) return;
32
+ const base = Number.parseFloat(getComputedStyle(element).minHeight);
33
+ setGrown(base > 0 && element.offsetHeight > base + 1);
34
+ }, []);
35
+ return {
36
+ ref: useCallback((element) => {
37
+ observerRef.current?.disconnect();
38
+ observerRef.current = null;
39
+ elementRef.current = element;
40
+ if (element === null) {
41
+ setGrown(false);
42
+ return;
43
+ }
44
+ measure();
45
+ if (typeof ResizeObserver === "undefined") return;
46
+ const observer = new ResizeObserver(measure);
47
+ observer.observe(element);
48
+ observerRef.current = observer;
49
+ }, [measure]),
50
+ grown
51
+ };
52
+ }
53
+ //#endregion
54
+ //#region src/combobox.tsx
55
+ const ComboboxSelectionContext = React.createContext({ multiple: false });
56
+ /**
57
+ * True for anything rendered inside `ComboboxContent`. A `ComboboxInput` is
58
+ * either the field that opens the popup or the search box inside it, and the
59
+ * two want opposite treatment — the styling and the anchoring both turn on
60
+ * this, and reading it from the tree beats guessing from CSS state that is
61
+ * true in both places (the popup is, after all, open in both).
62
+ */
63
+ const ComboboxPopupContext = React.createContext(false);
64
+ function Combobox$1({ multiple, children, size, ...props }) {
65
+ return /* @__PURE__ */ jsx(SizeProvider, {
66
+ size,
67
+ children: /* @__PURE__ */ jsx(ComboboxSelectionContext.Provider, {
68
+ value: { multiple: multiple === true },
69
+ children: /* @__PURE__ */ jsx(Combobox.Root, {
70
+ multiple,
71
+ ...props,
72
+ children
73
+ })
74
+ })
75
+ });
76
+ }
77
+ const comboboxTriggerVariants = cva("group/combobox-trigger flex w-fit min-w-0 items-center justify-between rounded-full data-[grown=true]:rounded-2xl border border-line bg-canvas text-left font-normal whitespace-nowrap text-fg-primary shadow-none outline-none transition-[background-color,border-color,border-radius,box-shadow,color] select-none hover:border-line-strong focus-visible:border-line-focus focus-visible:inset-ring-1 focus-visible:inset-ring-line-focus data-focused:border-line-focus data-focused:inset-ring-1 data-focused:inset-ring-line-focus data-popup-open:rounded-2xl data-popup-open:border-line-focus data-popup-open:inset-ring-1 data-popup-open:inset-ring-line-focus disabled:pointer-events-none disabled:cursor-not-allowed disabled:border-line-subtle disabled:bg-surface disabled:text-fg-caption-placeholder data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:border-line-subtle data-disabled:bg-surface data-disabled:text-fg-caption-placeholder data-placeholder:text-fg-caption-placeholder aria-invalid:border-line-danger aria-invalid:text-fg-danger aria-invalid:shadow-none data-[invalid=true]:border-line-danger data-[invalid=true]:text-fg-danger *:data-[slot=combobox-value]:line-clamp-1 *:data-[slot=combobox-value]:flex *:data-[slot=combobox-value]:min-w-0 *:data-[slot=combobox-value]:items-center *:data-[slot=combobox-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0", {
78
+ variants: { size: {
79
+ sm: "h-8 min-h-8 gap-2 px-3 text-gdt-xs [&_svg:not([class*='size-'])]:size-3.5",
80
+ md: "h-10 min-h-10 gap-2 px-3.5 text-gdt-sm [&_svg:not([class*='size-'])]:size-4",
81
+ lg: "h-12 min-h-12 gap-2.5 px-4 pr-5 text-gdt-md [&_svg:not([class*='size-'])]:size-4.5"
82
+ } },
83
+ defaultVariants: { size: "md" }
84
+ });
85
+ const comboboxInputVariants = cva("w-auto data-[grown=true]:rounded-2xl has-data-popup-open:rounded-2xl has-data-popup-open:border-line-focus has-data-popup-open:inset-ring-1 has-data-popup-open:inset-ring-line-focus", {
86
+ variants: { size: {
87
+ sm: "min-h-8",
88
+ md: "min-h-10",
89
+ lg: "min-h-12"
90
+ } },
91
+ defaultVariants: { size: "md" }
92
+ });
93
+ /**
94
+ * The same field, standing in the popup as its search box. It is inside the
95
+ * open popup rather than being the thing that opened it, so none of the
96
+ * trigger's open-state treatment applies: no pill, no focus ring competing
97
+ * with the popup's own border, and a radius that belongs to the list it sits
98
+ * above rather than to a field on the page.
99
+ */
100
+ const comboboxPopupInputVariants = cva("w-auto", {
101
+ variants: { size: {
102
+ sm: "rounded-md",
103
+ md: "rounded-lg",
104
+ lg: "rounded-lg"
105
+ } },
106
+ defaultVariants: { size: "md" }
107
+ });
108
+ 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", {
109
+ variants: { size: {
110
+ sm: "rounded-lg",
111
+ md: "rounded-xl",
112
+ lg: "rounded-[18px]"
113
+ } },
114
+ defaultVariants: { size: "md" }
115
+ });
116
+ const comboboxContentBodyVariants = cva("flex min-h-0 flex-1 flex-col overflow-hidden", {
117
+ variants: { size: {
118
+ sm: "p-1",
119
+ md: "p-1.5",
120
+ lg: "p-2"
121
+ } },
122
+ defaultVariants: { size: "md" }
123
+ });
124
+ const comboboxItemVariants = cva("group/combobox-item relative flex w-full cursor-pointer items-center font-normal text-fg-primary outline-none select-none data-highlighted:bg-surface data-disabled:pointer-events-none data-disabled:text-fg-caption-placeholder [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
125
+ variants: { size: {
126
+ sm: "gap-1.5 rounded-md px-3 py-1.5 text-gdt-xs",
127
+ md: "gap-2 rounded-md px-4 py-2 text-gdt-sm",
128
+ lg: "gap-2.5 rounded-md px-4 py-2.5 text-gdt-md"
129
+ } },
130
+ defaultVariants: { size: "md" }
131
+ });
132
+ const comboboxChipsVariants = cva("flex flex-wrap items-center gap-1 rounded-full data-[grown=true]:rounded-2xl border border-line bg-canvas bg-clip-padding text-fg-primary transition-[background-color,border-color,box-shadow,color] focus-within:border-line-focus focus-within:inset-ring-1 focus-within:inset-ring-line-focus has-aria-invalid:border-line-danger has-aria-invalid:text-fg-danger has-aria-invalid:shadow-none has-data-popup-open:rounded-2xl has-data-popup-open:border-line-focus has-data-popup-open:inset-ring-1 has-data-popup-open:inset-ring-line-focus", {
133
+ variants: { size: {
134
+ sm: "min-h-8 px-2.5 py-1 text-gdt-xs has-data-[slot=combobox-chip]:px-1.5",
135
+ md: "min-h-10 px-3 py-1.5 text-gdt-sm has-data-[slot=combobox-chip]:px-2",
136
+ lg: "min-h-12 px-4 py-2 text-gdt-md has-data-[slot=combobox-chip]:px-2.5"
137
+ } },
138
+ defaultVariants: { size: "md" }
139
+ });
140
+ const comboboxChipVariants = cva("flex w-fit items-center justify-center gap-1 rounded-sm bg-surface font-medium whitespace-nowrap text-fg-primary has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0", {
141
+ variants: { size: {
142
+ sm: "h-5 px-1.5 text-gdt-xs",
143
+ md: "h-[calc(--spacing(5.25))] px-1.5 text-gdt-xs",
144
+ lg: "h-6 px-2 text-gdt-sm"
145
+ } },
146
+ defaultVariants: { size: "md" }
147
+ });
148
+ function ComboboxValue({ ...props }) {
149
+ return /* @__PURE__ */ jsx(Combobox.Value, {
150
+ "data-slot": "combobox-value",
151
+ ...props
152
+ });
153
+ }
154
+ function ComboboxTrigger({ className, children, ...props }) {
155
+ const resolvedSize = useComponentSize();
156
+ const { ref, grown } = useGrown();
157
+ return /* @__PURE__ */ jsxs(Combobox.Trigger, {
158
+ ref,
159
+ "data-slot": "combobox-trigger",
160
+ "data-size": resolvedSize,
161
+ "data-grown": grown ? "true" : void 0,
162
+ className: cn(comboboxTriggerVariants({ size: resolvedSize }), className),
163
+ ...props,
164
+ children: [children, /* @__PURE__ */ jsx(Combobox.Icon, { render: /* @__PURE__ */ jsx(ChevronDown, { className: "text-line-strong transition-transform group-data-disabled/combobox-trigger:text-fg-caption-placeholder group-data-popup-open/combobox-trigger:rotate-180" }) })]
165
+ });
166
+ }
167
+ function ComboboxClear({ className, ...props }) {
168
+ return /* @__PURE__ */ jsx(Combobox.Clear, {
169
+ "data-slot": "combobox-clear",
170
+ className: cn(className),
171
+ ...props,
172
+ render: /* @__PURE__ */ jsx(InputGroupButton, {
173
+ variant: "ghost",
174
+ size: "icon-xs",
175
+ children: /* @__PURE__ */ jsx(X, { className: "pointer-events-none" })
176
+ })
177
+ });
178
+ }
179
+ function ComboboxInput({ className, children, disabled = false, showTrigger = true, showClear = false, ...props }) {
180
+ const resolvedSize = useComponentSize();
181
+ const insidePopup = React.useContext(ComboboxPopupContext);
182
+ const { ref, grown } = useGrown();
183
+ const contents = /* @__PURE__ */ jsxs(Fragment, { children: [
184
+ /* @__PURE__ */ jsx(Combobox.Input, {
185
+ render: /* @__PURE__ */ jsx(InputGroupInput, { disabled }),
186
+ ...props
187
+ }),
188
+ /* @__PURE__ */ jsxs(InputGroupAddon, {
189
+ align: "inline-end",
190
+ children: [showTrigger && /* @__PURE__ */ jsx(InputGroupButton, {
191
+ size: "icon-xs",
192
+ variant: "ghost",
193
+ render: /* @__PURE__ */ jsx(ComboboxTrigger, {}),
194
+ "data-slot": "input-group-button",
195
+ 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",
196
+ disabled
197
+ }), showClear && /* @__PURE__ */ jsx(ComboboxClear, { disabled })]
198
+ }),
199
+ children
200
+ ] });
201
+ if (insidePopup) return /* @__PURE__ */ jsx(InputGroup, {
202
+ className: cn(comboboxPopupInputVariants({ size: resolvedSize }), className),
203
+ children: contents
204
+ });
205
+ return /* @__PURE__ */ jsx(Combobox.InputGroup, {
206
+ ref,
207
+ "data-grown": grown ? "true" : void 0,
208
+ render: /* @__PURE__ */ jsx(InputGroup, { className: cn(comboboxInputVariants({ size: resolvedSize }), className) }),
209
+ children: contents
210
+ });
211
+ }
212
+ function ComboboxContent({ className, side = "bottom", sideOffset = 6, align = "start", alignOffset = 0, anchor, children, header, footer, ...props }) {
213
+ const resolvedSize = useComponentSize();
214
+ return /* @__PURE__ */ jsx(Combobox.Portal, { children: /* @__PURE__ */ jsx(Combobox.Positioner, {
215
+ side,
216
+ sideOffset,
217
+ align,
218
+ alignOffset,
219
+ anchor,
220
+ className: "isolate z-50",
221
+ children: /* @__PURE__ */ jsx(Combobox.Popup, {
222
+ "data-slot": "combobox-content",
223
+ "data-chips": !!anchor,
224
+ className: cn("group/combobox-content flex flex-col", comboboxContentVariants({ size: resolvedSize }), "has-data-[slot=combobox-virtualized]:max-h-none", className),
225
+ ...props,
226
+ children: /* @__PURE__ */ jsxs(ComboboxPopupContext.Provider, {
227
+ value: true,
228
+ children: [
229
+ header,
230
+ /* @__PURE__ */ jsx("div", {
231
+ "data-slot": "combobox-content-body",
232
+ className: comboboxContentBodyVariants({ size: resolvedSize }),
233
+ children
234
+ }),
235
+ footer
236
+ ]
237
+ })
238
+ })
239
+ }) });
240
+ }
241
+ function ComboboxHeader({ className, type = "button", ...props }) {
242
+ return /* @__PURE__ */ jsx("button", {
243
+ type,
244
+ "data-slot": "combobox-header",
245
+ className: cn("relative z-20 flex min-h-9 w-full shrink-0 cursor-pointer items-center gap-2 rounded-none rounded-t-[inherit] border-line-subtle border-b bg-canvas px-3 py-2 text-left text-gdt-sm font-bold text-fg-brand outline-none transition-colors hover:bg-surface-brand-subtle focus-visible:bg-surface-brand-subtle focus-visible:inset-ring-2 focus-visible:inset-ring-line-focus active:bg-surface-brand-subtle disabled:pointer-events-none disabled:text-fg-caption-placeholder", "[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", className),
246
+ ...props
247
+ });
248
+ }
249
+ function ComboboxFooter({ className, type = "button", ...props }) {
250
+ return /* @__PURE__ */ jsx("button", {
251
+ type,
252
+ "data-slot": "combobox-footer",
253
+ className: cn("relative z-20 flex min-h-9 w-full shrink-0 cursor-pointer items-center gap-2 rounded-none rounded-b-[inherit] border-line-subtle border-t bg-canvas px-3 py-2 text-left text-gdt-sm font-semibold text-fg-secondary outline-none transition-colors hover:bg-surface focus-visible:bg-surface focus-visible:inset-ring-2 focus-visible:inset-ring-line-focus active:bg-surface-raised disabled:pointer-events-none disabled:text-fg-caption-placeholder", "[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", className),
254
+ ...props
255
+ });
256
+ }
257
+ function ComboboxList({ className, ...props }) {
258
+ return /* @__PURE__ */ jsx(Combobox.List, {
259
+ "data-slot": "combobox-list",
260
+ className: cn("no-scrollbar min-h-0 max-h-(--available-height) flex-1 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),
261
+ ...props
262
+ });
263
+ }
264
+ function ComboboxItem({ className, children, ...props }) {
265
+ const { multiple } = React.useContext(ComboboxSelectionContext);
266
+ const resolvedSize = useComponentSize();
267
+ return /* @__PURE__ */ jsxs(Combobox.Item, {
268
+ "data-slot": "combobox-item",
269
+ className: cn(comboboxItemVariants({ size: resolvedSize }), !multiple && "data-selected:bg-surface-brand-subtle data-selected:font-medium data-selected:text-fg-brand", className),
270
+ ...props,
271
+ children: [multiple ? /* @__PURE__ */ jsx(Combobox.ItemIndicator, {
272
+ keepMounted: true,
273
+ className: "flex size-5 shrink-0 items-center justify-center rounded-sm border border-line bg-canvas text-transparent transition-[background-color,border-color,color] group-data-selected/combobox-item:border-action-primary group-data-selected/combobox-item:bg-action-primary group-data-selected/combobox-item:text-fg-on-brand group-data-disabled/combobox-item:border-line-subtle group-data-disabled/combobox-item:bg-surface group-data-disabled/combobox-item:text-fg-caption-placeholder [&>svg]:size-3",
274
+ children: /* @__PURE__ */ jsx(Check, {})
275
+ }) : null, /* @__PURE__ */ jsx("span", {
276
+ className: "flex min-w-0 flex-1 shrink-0 items-center gap-2",
277
+ children
278
+ })]
279
+ });
280
+ }
281
+ function ComboboxGroup({ className, ...props }) {
282
+ return /* @__PURE__ */ jsx(Combobox.Group, {
283
+ "data-slot": "combobox-group",
284
+ className: cn("scroll-my-1 space-y-0.5", className),
285
+ ...props
286
+ });
287
+ }
288
+ function ComboboxLabel({ className, ...props }) {
289
+ return /* @__PURE__ */ jsx(Combobox.GroupLabel, {
290
+ "data-slot": "combobox-label",
291
+ className: cn("px-3 py-1 text-gdt-xs text-fg-secondary", className),
292
+ ...props
293
+ });
294
+ }
295
+ function ComboboxCollection({ ...props }) {
296
+ return /* @__PURE__ */ jsx(Combobox.Collection, {
297
+ "data-slot": "combobox-collection",
298
+ ...props
299
+ });
300
+ }
301
+ function ComboboxEmpty({ className, ...props }) {
302
+ return /* @__PURE__ */ jsx(Combobox.Empty, {
303
+ "data-slot": "combobox-empty",
304
+ className: cn("hidden w-full justify-center py-2 text-center text-gdt-sm text-fg-secondary group-data-empty/combobox-content:flex", className),
305
+ ...props
306
+ });
307
+ }
308
+ function ComboboxSeparator({ className, ...props }) {
309
+ return /* @__PURE__ */ jsx(Combobox.Separator, {
310
+ "data-slot": "combobox-separator",
311
+ className: cn("pointer-events-none my-1 h-px bg-line-subtle", className),
312
+ ...props
313
+ });
314
+ }
315
+ function ComboboxChips({ className, ref: refProp, ...props }) {
316
+ const resolvedSize = useComponentSize();
317
+ const { ref, grown } = useGrown();
318
+ return /* @__PURE__ */ jsx(Combobox.Chips, {
319
+ ref: (element) => {
320
+ ref(element);
321
+ if (typeof refProp === "function") refProp(element);
322
+ else if (refProp) refProp.current = element;
323
+ },
324
+ "data-slot": "combobox-chips",
325
+ "data-grown": grown ? "true" : void 0,
326
+ className: cn(comboboxChipsVariants({ size: resolvedSize }), className),
327
+ ...props
328
+ });
329
+ }
330
+ function ComboboxChip({ className, children, showRemove = true, ...props }) {
331
+ const resolvedSize = useComponentSize();
332
+ return /* @__PURE__ */ jsxs(Combobox.Chip, {
333
+ "data-slot": "combobox-chip",
334
+ className: cn(comboboxChipVariants({ size: resolvedSize }), className),
335
+ ...props,
336
+ children: [children, showRemove && /* @__PURE__ */ jsx(Combobox.ChipRemove, {
337
+ className: "-ml-1 opacity-50 hover:opacity-100",
338
+ "data-slot": "combobox-chip-remove",
339
+ render: /* @__PURE__ */ jsx(Button, {
340
+ variant: "ghost",
341
+ size: "icon-xs",
342
+ children: /* @__PURE__ */ jsx(X, { className: "pointer-events-none" })
343
+ })
344
+ })]
345
+ });
346
+ }
347
+ function ComboboxChipsInput({ className, ...props }) {
348
+ return /* @__PURE__ */ jsx(Combobox.Input, {
349
+ "data-slot": "combobox-chip-input",
350
+ className: cn("min-w-16 flex-1 bg-transparent text-fg-primary outline-none placeholder:text-fg-caption-placeholder", className),
351
+ ...props
352
+ });
353
+ }
354
+ function useComboboxAnchor() {
355
+ return React.useRef(null);
356
+ }
357
+ /**
358
+ * Wires up an external virtualizer for a large `Combobox`. Spread the returned
359
+ * `onItemHighlighted` onto `<Combobox virtualized items={...}>` and pass
360
+ * `virtualizerRef` to `<ComboboxVirtualizedList>`. Keeps keyboard navigation in
361
+ * sync by scrolling the highlighted (off-screen) item into view.
362
+ */
363
+ function useComboboxVirtualizer() {
364
+ const virtualizerRef = React.useRef(null);
365
+ return {
366
+ virtualizerRef,
367
+ onItemHighlighted: React.useCallback((item, { reason, index }) => {
368
+ const virtualizer = virtualizerRef.current;
369
+ if (item == null || !virtualizer || index < 0) return;
370
+ const isStart = index === 0;
371
+ const isEnd = index === virtualizer.options.count - 1;
372
+ if (reason === "none" || reason === "keyboard" && (isStart || isEnd)) queueMicrotask(() => {
373
+ virtualizer.scrollToIndex(index, { align: isEnd ? "start" : "end" });
374
+ });
375
+ }, [])
376
+ };
377
+ }
378
+ function ComboboxVirtualizedList({ virtualizerRef, estimateSize = 40, overscan = 20, paddingStart = 4, paddingEnd = 4, maxHeight = "22rem", className, children }) {
379
+ const filteredItems = Combobox.useFilteredItems();
380
+ const scrollElementRef = React.useRef(null);
381
+ const virtualizer = useVirtualizer({
382
+ count: filteredItems.length,
383
+ getScrollElement: () => scrollElementRef.current,
384
+ estimateSize: typeof estimateSize === "function" ? estimateSize : () => estimateSize,
385
+ overscan,
386
+ paddingStart,
387
+ paddingEnd,
388
+ scrollPaddingStart: paddingStart,
389
+ scrollPaddingEnd: paddingEnd
390
+ });
391
+ React.useImperativeHandle(virtualizerRef, () => virtualizer, [virtualizer]);
392
+ const handleScrollElementRef = React.useCallback((element) => {
393
+ scrollElementRef.current = element;
394
+ if (element) virtualizer.measure();
395
+ }, [virtualizer]);
396
+ const totalSize = virtualizer.getTotalSize();
397
+ if (!filteredItems.length) return null;
398
+ return /* @__PURE__ */ jsx("div", {
399
+ role: "presentation",
400
+ ref: handleScrollElementRef,
401
+ "data-slot": "combobox-virtualized",
402
+ style: { maxHeight },
403
+ className: cn("no-scrollbar overflow-y-auto overscroll-contain", className),
404
+ children: /* @__PURE__ */ jsx("div", {
405
+ role: "presentation",
406
+ className: "relative w-full",
407
+ style: { height: totalSize },
408
+ children: virtualizer.getVirtualItems().map((virtualItem) => {
409
+ const item = filteredItems[virtualItem.index];
410
+ if (item == null) return null;
411
+ return /* @__PURE__ */ jsx(React.Fragment, { children: children(item, {
412
+ index: virtualItem.index,
413
+ "data-index": virtualItem.index,
414
+ "aria-setsize": filteredItems.length,
415
+ "aria-posinset": virtualItem.index + 1,
416
+ style: {
417
+ position: "absolute",
418
+ top: 0,
419
+ left: 0,
420
+ width: "100%",
421
+ height: virtualItem.size,
422
+ transform: `translateY(${virtualItem.start}px)`
423
+ }
424
+ }) }, virtualItem.key);
425
+ })
426
+ })
427
+ });
428
+ }
429
+ //#endregion
430
+ export { ComboboxValue as _, ComboboxCollection as a, useComboboxVirtualizer as b, ComboboxFooter as c, ComboboxInput as d, ComboboxItem as f, ComboboxTrigger as g, ComboboxSeparator as h, ComboboxChipsInput as i, ComboboxGroup as l, ComboboxList as m, ComboboxChip as n, ComboboxContent as o, ComboboxLabel as p, ComboboxChips as r, ComboboxEmpty as s, Combobox$1 as t, ComboboxHeader as u, ComboboxVirtualizedList as v, useComboboxAnchor as y };
@@ -1,4 +1,4 @@
1
- import { t as ComponentSize } from "./size-context-BX6kAdVj.js";
1
+ import { t as ComponentSize } from "./size-context-BVhHduLi.js";
2
2
  import * as React from "react";
3
3
  import { Combobox as Combobox$1 } from "@base-ui/react";
4
4
  import { Virtualizer } from "@tanstack/react-virtual";
@@ -13,7 +13,12 @@ declare function ComboboxInput({ className, children, disabled, showTrigger, sho
13
13
  showTrigger?: boolean;
14
14
  showClear?: boolean;
15
15
  }): React.JSX.Element;
16
- declare function ComboboxContent({ className, side, sideOffset, align, alignOffset, anchor, ...props }: Combobox$1.Popup.Props & Pick<Combobox$1.Positioner.Props, "side" | "align" | "sideOffset" | "alignOffset" | "anchor">): React.JSX.Element;
16
+ declare function ComboboxContent({ className, side, sideOffset, align, alignOffset, anchor, children, header, footer, ...props }: Combobox$1.Popup.Props & Pick<Combobox$1.Positioner.Props, "side" | "align" | "sideOffset" | "alignOffset" | "anchor"> & {
17
+ header?: React.ReactNode;
18
+ footer?: React.ReactNode;
19
+ }): React.JSX.Element;
20
+ declare function ComboboxHeader({ className, type, ...props }: React.ComponentProps<"button">): React.JSX.Element;
21
+ declare function ComboboxFooter({ className, type, ...props }: React.ComponentProps<"button">): React.JSX.Element;
17
22
  declare function ComboboxList({ className, ...props }: Combobox$1.List.Props): React.JSX.Element;
18
23
  declare function ComboboxItem({ className, children, ...props }: Combobox$1.Item.Props): React.JSX.Element;
19
24
  declare function ComboboxGroup({ className, ...props }: Combobox$1.Group.Props): React.JSX.Element;
@@ -21,7 +26,7 @@ declare function ComboboxLabel({ className, ...props }: Combobox$1.GroupLabel.Pr
21
26
  declare function ComboboxCollection({ ...props }: Combobox$1.Collection.Props): React.JSX.Element;
22
27
  declare function ComboboxEmpty({ className, ...props }: Combobox$1.Empty.Props): React.JSX.Element;
23
28
  declare function ComboboxSeparator({ className, ...props }: Combobox$1.Separator.Props): React.JSX.Element;
24
- declare function ComboboxChips({ className, ...props }: React.ComponentPropsWithRef<typeof Combobox$1.Chips> & Combobox$1.Chips.Props): React.JSX.Element;
29
+ declare function ComboboxChips({ className, ref: refProp, ...props }: React.ComponentPropsWithRef<typeof Combobox$1.Chips> & Combobox$1.Chips.Props): React.JSX.Element;
25
30
  declare function ComboboxChip({ className, children, showRemove, ...props }: Combobox$1.Chip.Props & {
26
31
  showRemove?: boolean;
27
32
  }): React.JSX.Element;
@@ -74,4 +79,4 @@ declare function ComboboxVirtualizedList<Item>({ virtualizerRef, estimateSize, o
74
79
  children: (item: Item, props: ComboboxVirtualItemProps) => React.ReactNode;
75
80
  }): React.JSX.Element | null;
76
81
  //#endregion
77
- export { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, type ComboboxSize, ComboboxTrigger, ComboboxValue, type ComboboxVirtualItemProps, ComboboxVirtualizedList, type ComboboxVirtualizer, useComboboxAnchor, useComboboxVirtualizer };
82
+ export { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxFooter, ComboboxGroup, ComboboxHeader, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, type ComboboxSize, ComboboxTrigger, ComboboxValue, type ComboboxVirtualItemProps, ComboboxVirtualizedList, type ComboboxVirtualizer, useComboboxAnchor, useComboboxVirtualizer };