@avenue-ticketing/ui 0.11.0 → 0.12.0-beta.2

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 (226) hide show
  1. package/README.md +47 -0
  2. package/dist/badge-types-B67wcd4m.d.ts +22 -0
  3. package/dist/react/app-store-buttons-outline.d.ts +17 -0
  4. package/dist/react/app-store-buttons-outline.js +582 -0
  5. package/dist/react/app-store-buttons-outline.js.map +1 -0
  6. package/dist/react/app-store-buttons.d.ts +20 -0
  7. package/dist/react/app-store-buttons.js +817 -0
  8. package/dist/react/app-store-buttons.js.map +1 -0
  9. package/dist/react/avatar-label-group.d.ts +14 -0
  10. package/dist/react/avatar-label-group.js +183 -0
  11. package/dist/react/avatar-label-group.js.map +1 -0
  12. package/dist/react/avatar-profile-photo.d.ts +9 -0
  13. package/dist/react/avatar-profile-photo.js +202 -0
  14. package/dist/react/avatar-profile-photo.js.map +1 -0
  15. package/dist/react/avatar.d.ts +66 -40
  16. package/dist/react/avatar.js +159 -149
  17. package/dist/react/avatar.js.map +1 -1
  18. package/dist/react/badge-groups.d.ts +25 -0
  19. package/dist/react/badge-groups.js +162 -0
  20. package/dist/react/badge-groups.js.map +1 -0
  21. package/dist/react/badge.d.ts +123 -59
  22. package/dist/react/badge.js +314 -86
  23. package/dist/react/badge.js.map +1 -1
  24. package/dist/react/button-group.d.ts +43 -0
  25. package/dist/react/button-group.js +108 -0
  26. package/dist/react/button-group.js.map +1 -0
  27. package/dist/react/button-utility.d.ts +47 -0
  28. package/dist/react/button-utility.js +158 -0
  29. package/dist/react/button-utility.js.map +1 -0
  30. package/dist/react/button.d.ts +112 -37
  31. package/dist/react/button.js +270 -55
  32. package/dist/react/button.js.map +1 -1
  33. package/dist/react/checkbox.d.ts +25 -8
  34. package/dist/react/checkbox.js +115 -110
  35. package/dist/react/checkbox.js.map +1 -1
  36. package/dist/react/close-button.d.ts +25 -0
  37. package/dist/react/close-button.js +54 -0
  38. package/dist/react/close-button.js.map +1 -0
  39. package/dist/react/combobox.d.ts +18 -0
  40. package/dist/react/combobox.js +574 -0
  41. package/dist/react/combobox.js.map +1 -0
  42. package/dist/react/dialog.d.ts +15 -15
  43. package/dist/react/dialog.js +43 -108
  44. package/dist/react/dialog.js.map +1 -1
  45. package/dist/react/dropdown-account-breadcrumb.d.ts +5 -0
  46. package/dist/react/dropdown-account-breadcrumb.js +481 -0
  47. package/dist/react/dropdown-account-breadcrumb.js.map +1 -0
  48. package/dist/react/dropdown-account-button.d.ts +5 -0
  49. package/dist/react/dropdown-account-button.js +938 -0
  50. package/dist/react/dropdown-account-button.js.map +1 -0
  51. package/dist/react/dropdown-account-card-md.d.ts +5 -0
  52. package/dist/react/dropdown-account-card-md.js +714 -0
  53. package/dist/react/dropdown-account-card-md.js.map +1 -0
  54. package/dist/react/dropdown-account-card-sm.d.ts +5 -0
  55. package/dist/react/dropdown-account-card-sm.js +692 -0
  56. package/dist/react/dropdown-account-card-sm.js.map +1 -0
  57. package/dist/react/dropdown-account-card-xs.d.ts +5 -0
  58. package/dist/react/dropdown-account-card-xs.js +672 -0
  59. package/dist/react/dropdown-account-card-xs.js.map +1 -0
  60. package/dist/react/dropdown-avatar.d.ts +5 -0
  61. package/dist/react/dropdown-avatar.js +955 -0
  62. package/dist/react/dropdown-avatar.js.map +1 -0
  63. package/dist/react/dropdown-button-advanced.d.ts +5 -0
  64. package/dist/react/dropdown-button-advanced.js +964 -0
  65. package/dist/react/dropdown-button-advanced.js.map +1 -0
  66. package/dist/react/dropdown-button-link.d.ts +5 -0
  67. package/dist/react/dropdown-button-link.js +666 -0
  68. package/dist/react/dropdown-button-link.js.map +1 -0
  69. package/dist/react/dropdown-button-simple.d.ts +5 -0
  70. package/dist/react/dropdown-button-simple.js +919 -0
  71. package/dist/react/dropdown-button-simple.js.map +1 -0
  72. package/dist/react/dropdown-icon-advanced.d.ts +5 -0
  73. package/dist/react/dropdown-icon-advanced.js +708 -0
  74. package/dist/react/dropdown-icon-advanced.js.map +1 -0
  75. package/dist/react/dropdown-icon-simple.d.ts +5 -0
  76. package/dist/react/dropdown-icon-simple.js +670 -0
  77. package/dist/react/dropdown-icon-simple.js.map +1 -0
  78. package/dist/react/dropdown-integration.d.ts +5 -0
  79. package/dist/react/dropdown-integration.js +1490 -0
  80. package/dist/react/dropdown-integration.js.map +1 -0
  81. package/dist/react/dropdown-search-advanced.d.ts +5 -0
  82. package/dist/react/dropdown-search-advanced.js +1163 -0
  83. package/dist/react/dropdown-search-advanced.js.map +1 -0
  84. package/dist/react/dropdown-search-simple.d.ts +5 -0
  85. package/dist/react/dropdown-search-simple.js +1125 -0
  86. package/dist/react/dropdown-search-simple.js.map +1 -0
  87. package/dist/react/dropdown.d.ts +35 -133
  88. package/dist/react/dropdown.js +536 -1318
  89. package/dist/react/dropdown.js.map +1 -1
  90. package/dist/react/file-upload-trigger.d.ts +34 -0
  91. package/dist/react/file-upload-trigger.js +39 -0
  92. package/dist/react/file-upload-trigger.js.map +1 -0
  93. package/dist/react/form.d.ts +10 -0
  94. package/dist/react/form.js +11 -0
  95. package/dist/react/form.js.map +1 -0
  96. package/dist/react/hint-text.d.ts +17 -0
  97. package/dist/react/hint-text.js +36 -0
  98. package/dist/react/hint-text.js.map +1 -0
  99. package/dist/react/hook-form.d.ts +35 -0
  100. package/dist/react/hook-form.js +50 -0
  101. package/dist/react/hook-form.js.map +1 -0
  102. package/dist/react/input-date.d.ts +43 -0
  103. package/dist/react/input-date.js +306 -0
  104. package/dist/react/input-date.js.map +1 -0
  105. package/dist/react/input-file.d.ts +45 -0
  106. package/dist/react/input-file.js +748 -0
  107. package/dist/react/input-file.js.map +1 -0
  108. package/dist/react/input-group.d.ts +37 -0
  109. package/dist/react/input-group.js +251 -0
  110. package/dist/react/input-group.js.map +1 -0
  111. package/dist/react/input-number.d.ts +32 -0
  112. package/dist/react/input-number.js +553 -0
  113. package/dist/react/input-number.js.map +1 -0
  114. package/dist/react/input-payment.d.ts +16 -0
  115. package/dist/react/input-payment.js +593 -0
  116. package/dist/react/input-payment.js.map +1 -0
  117. package/dist/react/input-tags-outer.d.ts +53 -0
  118. package/dist/react/input-tags-outer.js +607 -0
  119. package/dist/react/input-tags-outer.js.map +1 -0
  120. package/dist/react/input-tags.d.ts +53 -0
  121. package/dist/react/input-tags.js +565 -0
  122. package/dist/react/input-tags.js.map +1 -0
  123. package/dist/react/input.d.ts +71 -22
  124. package/dist/react/input.js +332 -45
  125. package/dist/react/input.js.map +1 -1
  126. package/dist/react/label.d.ts +18 -0
  127. package/dist/react/label.js +112 -0
  128. package/dist/react/label.js.map +1 -0
  129. package/dist/react/multi-select.d.ts +90 -0
  130. package/dist/react/multi-select.js +1237 -0
  131. package/dist/react/multi-select.js.map +1 -0
  132. package/dist/react/pin-input.d.ts +59 -0
  133. package/dist/react/pin-input.js +229 -0
  134. package/dist/react/pin-input.js.map +1 -0
  135. package/dist/react/popover.d.ts +14 -71
  136. package/dist/react/popover.js +171 -540
  137. package/dist/react/popover.js.map +1 -1
  138. package/dist/react/progress-circle.d.ts +9 -0
  139. package/dist/react/progress-circle.js +36 -0
  140. package/dist/react/progress-circle.js.map +1 -0
  141. package/dist/react/progress-circles.d.ts +14 -0
  142. package/dist/react/progress-circles.js +160 -0
  143. package/dist/react/progress-circles.js.map +1 -0
  144. package/dist/react/progress-indicators.d.ts +52 -0
  145. package/dist/react/progress-indicators.js +78 -0
  146. package/dist/react/progress-indicators.js.map +1 -0
  147. package/dist/react/radio-buttons.d.ts +35 -0
  148. package/dist/react/radio-buttons.js +117 -0
  149. package/dist/react/radio-buttons.js.map +1 -0
  150. package/dist/react/scroll-header.d.ts +6 -0
  151. package/dist/react/scroll-header.js +42 -61
  152. package/dist/react/scroll-header.js.map +1 -1
  153. package/dist/react/scroll-wheel.d.ts +4 -5
  154. package/dist/react/scroll-wheel.js +19 -15
  155. package/dist/react/scroll-wheel.js.map +1 -1
  156. package/dist/react/select-item.d.ts +14 -0
  157. package/dist/react/select-item.js +340 -0
  158. package/dist/react/select-item.js.map +1 -0
  159. package/dist/react/select-native.d.ts +17 -0
  160. package/dist/react/select-native.js +203 -0
  161. package/dist/react/select-native.js.map +1 -0
  162. package/dist/react/select.d.ts +19 -61
  163. package/dist/react/select.js +866 -908
  164. package/dist/react/select.js.map +1 -1
  165. package/dist/react/sheet.d.ts +19 -19
  166. package/dist/react/sheet.js +97 -219
  167. package/dist/react/sheet.js.map +1 -1
  168. package/dist/react/slider.d.ts +15 -0
  169. package/dist/react/slider.js +66 -0
  170. package/dist/react/slider.js.map +1 -0
  171. package/dist/react/social-button.d.ts +55 -0
  172. package/dist/react/social-button.js +263 -0
  173. package/dist/react/social-button.js.map +1 -0
  174. package/dist/react/social-logos.d.ts +20 -0
  175. package/dist/react/social-logos.js +131 -0
  176. package/dist/react/social-logos.js.map +1 -0
  177. package/dist/react/switch.d.ts +21 -36
  178. package/dist/react/switch.js +121 -109
  179. package/dist/react/switch.js.map +1 -1
  180. package/dist/react/tag-select.d.ts +47 -0
  181. package/dist/react/tag-select.js +1252 -0
  182. package/dist/react/tag-select.js.map +1 -0
  183. package/dist/react/tags.d.ts +30 -0
  184. package/dist/react/tags.js +228 -0
  185. package/dist/react/tags.js.map +1 -0
  186. package/dist/react/textarea.d.ts +40 -4
  187. package/dist/react/textarea.js +193 -27
  188. package/dist/react/textarea.js.map +1 -1
  189. package/dist/react/tooltip.d.ts +30 -43
  190. package/dist/react/tooltip.js +65 -521
  191. package/dist/react/tooltip.js.map +1 -1
  192. package/dist/select-mobile-sheet-CB2ptDTJ.d.ts +12 -0
  193. package/dist/select-shared-oJEeJxeB.d.ts +68 -0
  194. package/package.json +28 -21
  195. package/source.css +2 -13
  196. package/theme.css +883 -79
  197. package/dist/react/calendar.d.ts +0 -13
  198. package/dist/react/calendar.js +0 -4639
  199. package/dist/react/calendar.js.map +0 -1
  200. package/dist/react/card.d.ts +0 -11
  201. package/dist/react/card.js +0 -113
  202. package/dist/react/card.js.map +0 -1
  203. package/dist/react/datetime-picker.d.ts +0 -21
  204. package/dist/react/datetime-picker.js +0 -6142
  205. package/dist/react/datetime-picker.js.map +0 -1
  206. package/dist/react/pagination.d.ts +0 -28
  207. package/dist/react/pagination.js +0 -262
  208. package/dist/react/pagination.js.map +0 -1
  209. package/dist/react/table-pagination.d.ts +0 -15
  210. package/dist/react/table-pagination.js +0 -1247
  211. package/dist/react/table-pagination.js.map +0 -1
  212. package/dist/react/table-view/column-menu.d.ts +0 -15
  213. package/dist/react/table-view/column-menu.js +0 -1049
  214. package/dist/react/table-view/column-menu.js.map +0 -1
  215. package/dist/react/table-view/index.d.ts +0 -70
  216. package/dist/react/table-view/index.js +0 -2284
  217. package/dist/react/table-view/index.js.map +0 -1
  218. package/dist/react/table.d.ts +0 -86
  219. package/dist/react/table.js +0 -414
  220. package/dist/react/table.js.map +0 -1
  221. package/dist/react/tabs.d.ts +0 -34
  222. package/dist/react/tabs.js +0 -423
  223. package/dist/react/tabs.js.map +0 -1
  224. package/dist/react/time-picker.d.ts +0 -22
  225. package/dist/react/time-picker.js +0 -856
  226. package/dist/react/time-picker.js.map +0 -1
@@ -0,0 +1,565 @@
1
+ import { createContext, useRef, useState, useCallback, useContext, useLayoutEffect } from 'react';
2
+ import { QuestionIcon } from '@phosphor-icons/react/dist/csr/Question';
3
+ import { InfoIcon } from '@phosphor-icons/react/dist/csr/Info';
4
+ import { Group, TagList as TagList$1, Input, Label as Label$1, TagGroup as TagGroup$1, Tag as Tag$1, TooltipTrigger as TooltipTrigger$1, Tooltip as Tooltip$1, OverlayArrow, Button, Text } from 'react-aria-components';
5
+ import { extendTailwindMerge } from 'tailwind-merge';
6
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
7
+ import { UserIcon } from '@phosphor-icons/react/dist/csr/User';
8
+ import { XIcon } from '@phosphor-icons/react/dist/csr/X';
9
+ import '@phosphor-icons/react/dist/csr/Eye';
10
+ import '@phosphor-icons/react/dist/csr/EyeSlash';
11
+
12
+ var twMerge = extendTailwindMerge({
13
+ extend: {
14
+ theme: {
15
+ text: ["display-xs", "display-sm", "display-md", "display-lg", "display-xl", "display-2xl"]
16
+ }
17
+ }
18
+ });
19
+ var cx = twMerge;
20
+ function sortCx(classes) {
21
+ return classes;
22
+ }
23
+ var HintText = ({ isInvalid, className, size = "md", ...props }) => {
24
+ return /* @__PURE__ */ jsx(
25
+ Text,
26
+ {
27
+ ...props,
28
+ slot: isInvalid ? "errorMessage" : "description",
29
+ className: cx(
30
+ "text-sm text-tertiary",
31
+ // Size
32
+ size === "sm" && "text-xs",
33
+ "in-data-[input-size=sm]:text-xs",
34
+ // Invalid state
35
+ isInvalid && "text-error-primary",
36
+ "group-invalid:text-error-primary",
37
+ className
38
+ )
39
+ }
40
+ );
41
+ };
42
+ HintText.displayName = "HintText";
43
+ var Tooltip = ({
44
+ title,
45
+ description,
46
+ children,
47
+ arrow = false,
48
+ delay = 100,
49
+ closeDelay = 0,
50
+ trigger,
51
+ isDisabled,
52
+ isOpen,
53
+ defaultOpen,
54
+ offset = 6,
55
+ crossOffset,
56
+ placement = "top",
57
+ onOpenChange,
58
+ ...tooltipProps
59
+ }) => {
60
+ const isTopOrBottomLeft = ["top left", "top end", "bottom left", "bottom end"].includes(placement);
61
+ const isTopOrBottomRight = ["top right", "top start", "bottom right", "bottom start"].includes(placement);
62
+ const calculatedCrossOffset = isTopOrBottomLeft ? -12 : isTopOrBottomRight ? 12 : 0;
63
+ return /* @__PURE__ */ jsxs(TooltipTrigger$1, { ...{ trigger, delay, closeDelay, isDisabled, isOpen, defaultOpen, onOpenChange }, children: [
64
+ children,
65
+ /* @__PURE__ */ jsx(
66
+ Tooltip$1,
67
+ {
68
+ ...tooltipProps,
69
+ offset,
70
+ placement,
71
+ crossOffset: crossOffset ?? calculatedCrossOffset,
72
+ className: ({ isEntering, isExiting }) => cx(isEntering && "ease-out animate-in", isExiting && "ease-in animate-out"),
73
+ children: ({ isEntering, isExiting }) => /* @__PURE__ */ jsxs(
74
+ "div",
75
+ {
76
+ className: cx(
77
+ "z-50 flex max-w-xs origin-(--trigger-anchor-point) flex-col items-start gap-1 rounded-lg bg-primary-solid px-3 shadow-lg will-change-transform",
78
+ description ? "py-3" : "py-2",
79
+ isEntering && "ease-out animate-in fade-in zoom-in-95 in-placement-left:slide-in-from-right-0.5 in-placement-right:slide-in-from-left-0.5 in-placement-top:slide-in-from-bottom-0.5 in-placement-bottom:slide-in-from-top-0.5",
80
+ isExiting && "ease-in animate-out fade-out zoom-out-95 in-placement-left:slide-out-to-right-0.5 in-placement-right:slide-out-to-left-0.5 in-placement-top:slide-out-to-bottom-0.5 in-placement-bottom:slide-out-to-top-0.5"
81
+ ),
82
+ children: [
83
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold text-white", children: title }),
84
+ description && /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-tooltip-supporting-text", children: description }),
85
+ arrow && /* @__PURE__ */ jsx(OverlayArrow, { children: /* @__PURE__ */ jsx(
86
+ "svg",
87
+ {
88
+ viewBox: "0 0 100 100",
89
+ className: "size-2.5 fill-bg-primary-solid in-placement-left:-rotate-90 in-placement-right:rotate-90 in-placement-top:rotate-0 in-placement-bottom:rotate-180",
90
+ children: /* @__PURE__ */ jsx("path", { d: "M0,0 L35.858,35.858 Q50,50 64.142,35.858 L100,0 Z" })
91
+ }
92
+ ) })
93
+ ]
94
+ }
95
+ )
96
+ }
97
+ )
98
+ ] });
99
+ };
100
+ var TooltipTrigger = ({ children, className, ...buttonProps }) => {
101
+ return /* @__PURE__ */ jsx(Button, { ...buttonProps, className: (values) => cx("h-max w-max outline-hidden", typeof className === "function" ? className(values) : className), children });
102
+ };
103
+ var Label = ({ isInvalid, isRequired, tooltip, tooltipDescription, className, ...props }) => {
104
+ return /* @__PURE__ */ jsxs(
105
+ Label$1,
106
+ {
107
+ "data-label": "true",
108
+ ...props,
109
+ className: cx("flex cursor-default items-center gap-0.5 text-sm font-medium text-secondary", className),
110
+ children: [
111
+ props.children,
112
+ /* @__PURE__ */ jsx(
113
+ "span",
114
+ {
115
+ className: cx(
116
+ "hidden text-brand-tertiary",
117
+ isRequired && "block",
118
+ typeof isRequired === "undefined" && "group-required:block",
119
+ isInvalid && "text-error-primary",
120
+ typeof isInvalid === "undefined" && "group-invalid:text-error-primary"
121
+ ),
122
+ children: "*"
123
+ }
124
+ ),
125
+ tooltip && /* @__PURE__ */ jsx(Tooltip, { title: tooltip, description: tooltipDescription, placement: "top", children: /* @__PURE__ */ jsx(
126
+ TooltipTrigger,
127
+ {
128
+ isDisabled: false,
129
+ className: "cursor-pointer text-fg-quaternary transition duration-200 hover:text-fg-quaternary_hover focus:text-fg-quaternary_hover",
130
+ children: /* @__PURE__ */ jsx(QuestionIcon, { className: "size-4" })
131
+ }
132
+ ) })
133
+ ]
134
+ }
135
+ );
136
+ };
137
+ Label.displayName = "Label";
138
+ var sizes = {
139
+ sm: {
140
+ wh: 8,
141
+ c: 4,
142
+ r: 2.5
143
+ },
144
+ md: {
145
+ wh: 10,
146
+ c: 5,
147
+ r: 4
148
+ }
149
+ };
150
+ var Dot = ({ size = "md", ...props }) => {
151
+ return /* @__PURE__ */ jsx("svg", { width: sizes[size].wh, height: sizes[size].wh, viewBox: `0 0 ${sizes[size].wh} ${sizes[size].wh}`, fill: "none", ...props, children: /* @__PURE__ */ jsx("circle", { cx: sizes[size].c, cy: sizes[size].c, r: sizes[size].r, fill: "currentColor", stroke: "currentColor" }) });
152
+ };
153
+ var CHECKBOX_TICK_DELAY_MS = 60;
154
+ var CHECKBOX_TICK_DRAW_MS = 100;
155
+ var focusRingShadow = "outline-none [box-shadow:0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]";
156
+ var sizes2 = {
157
+ sm: { box: "size-3.5 rounded-xs", iconPixelSize: 10 },
158
+ md: { box: "size-4 rounded-xs", iconPixelSize: 12 },
159
+ lg: { box: "size-4.5 rounded-xs", iconPixelSize: 13 }
160
+ };
161
+ function TagCheckboxAnimatedCheckMark({ pixelSize, className }) {
162
+ const pathRef = useRef(null);
163
+ useLayoutEffect(() => {
164
+ const path = pathRef.current;
165
+ if (!path || typeof path.getTotalLength !== "function") return;
166
+ const len = path.getTotalLength();
167
+ if (len <= 0) return;
168
+ path.style.strokeDasharray = `${len}`;
169
+ path.style.strokeDashoffset = `${len}`;
170
+ if (typeof path.animate !== "function") {
171
+ path.style.strokeDashoffset = "0";
172
+ return;
173
+ }
174
+ const anim = path.animate([{ strokeDashoffset: len }, { strokeDashoffset: 0 }], {
175
+ duration: CHECKBOX_TICK_DRAW_MS,
176
+ delay: CHECKBOX_TICK_DELAY_MS,
177
+ easing: "cubic-bezier(0.45, 0, 0.2, 1)",
178
+ fill: "forwards"
179
+ });
180
+ return () => anim.cancel();
181
+ }, []);
182
+ return /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", width: pixelSize, height: pixelSize, viewBox: "0 0 14 14", fill: "none", className: cx("block", className), children: /* @__PURE__ */ jsx(
183
+ "path",
184
+ {
185
+ ref: pathRef,
186
+ d: "M2.33325 7L5.24992 9.91667L11.6666 3.5",
187
+ stroke: "currentColor",
188
+ strokeWidth: "2",
189
+ strokeLinecap: "round",
190
+ strokeLinejoin: "round"
191
+ }
192
+ ) });
193
+ }
194
+ var TagCheckbox = ({ className, isFocused, isSelected, isDisabled, size = "sm" }) => {
195
+ const { box, iconPixelSize } = sizes2[size];
196
+ return /* @__PURE__ */ jsx(
197
+ "div",
198
+ {
199
+ className: cx(
200
+ "relative flex shrink-0 cursor-pointer appearance-none items-center justify-center overflow-clip border border-solid border-primary",
201
+ box,
202
+ isSelected ? "border-transparent bg-brand-solid" : "bg-primary",
203
+ isDisabled && "cursor-not-allowed opacity-50",
204
+ isDisabled && !isSelected && "bg-tertiary",
205
+ isFocused && !isDisabled && focusRingShadow,
206
+ className
207
+ ),
208
+ children: isSelected && /* @__PURE__ */ jsx(TagCheckboxAnimatedCheckMark, { pixelSize: iconPixelSize, className: "pointer-events-none text-fg-white" })
209
+ }
210
+ );
211
+ };
212
+ TagCheckbox.displayName = "TagCheckbox";
213
+ var focusShadowPlain = "focus-visible:outline-none focus-visible:[box-shadow:0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]";
214
+ var styles = {
215
+ sm: { root: "p-0.5", icon: "size-2.5" },
216
+ md: { root: "p-0.5", icon: "size-3" },
217
+ lg: { root: "p-[3px]", icon: "size-3.5" }
218
+ };
219
+ var TagCloseX = ({ size = "md", className, ...otherProps }) => {
220
+ return /* @__PURE__ */ jsx(
221
+ Button,
222
+ {
223
+ slot: "remove",
224
+ "aria-label": "Remove this tag",
225
+ className: cx(
226
+ "flex cursor-pointer rounded-[3px] text-fg-quaternary outline-transparent transition duration-100 ease-linear hover:bg-primary_hover focus-visible:rounded-[3px] disabled:cursor-not-allowed disabled:opacity-50",
227
+ focusShadowPlain,
228
+ styles[size].root,
229
+ className
230
+ ),
231
+ ...otherProps,
232
+ children: /* @__PURE__ */ jsx(XIcon, { className: cx("shrink-0 transition-inherit-all", styles[size].icon) })
233
+ }
234
+ );
235
+ };
236
+ var focusShadowPlain2 = "focus-visible:outline-none focus-visible:[box-shadow:0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]";
237
+ var TagAvatar = ({ src, alt, contrastBorder = true, className }) => {
238
+ const [isFailed, setIsFailed] = useState(false);
239
+ return /* @__PURE__ */ jsx(
240
+ "div",
241
+ {
242
+ className: cx(
243
+ "relative inline-flex size-4 shrink-0 items-center justify-center overflow-hidden rounded-full bg-tertiary",
244
+ contrastBorder && "outline-[0.5px] -outline-offset-[0.5px] outline-black/16",
245
+ className
246
+ ),
247
+ children: src && !isFailed ? /* @__PURE__ */ jsx("img", { "data-avatar-img": true, className: "size-full object-cover", src, alt, onError: () => setIsFailed(true) }) : /* @__PURE__ */ jsx(UserIcon, { className: "size-3 stroke-[2.25px] text-fg-quaternary" })
248
+ }
249
+ );
250
+ };
251
+ var TagGroupContext = createContext({
252
+ selectionMode: "none",
253
+ size: "sm"
254
+ });
255
+ var TagGroup = ({ label, selectionMode = "none", size = "sm", children, ...otherProps }) => {
256
+ return /* @__PURE__ */ jsx(TagGroupContext.Provider, { value: { selectionMode, size }, children: /* @__PURE__ */ jsx(TagGroup$1, { "aria-label": label, selectionMode, disallowEmptySelection: selectionMode === "single", ...otherProps, children }) });
257
+ };
258
+ var TagList = TagList$1;
259
+ var styles2 = {
260
+ sm: {
261
+ root: {
262
+ base: "px-2 py-0.75 text-xs font-medium",
263
+ withCheckbox: "pl-1.25",
264
+ withAvatar: "pl-1",
265
+ withDot: "pl-1.5",
266
+ withCount: "pr-1",
267
+ withClose: "pr-1"
268
+ },
269
+ content: "gap-1",
270
+ count: "px-1 text-xs font-medium"
271
+ },
272
+ md: {
273
+ root: {
274
+ base: "px-2.25 py-0.5 text-sm font-medium",
275
+ withCheckbox: "pl-1",
276
+ withAvatar: "pl-1.25",
277
+ withDot: "pl-1.75",
278
+ withCount: "pr-0.75",
279
+ withClose: "pr-1"
280
+ },
281
+ content: "gap-1.25",
282
+ count: "px-1.25 text-xs font-medium"
283
+ },
284
+ lg: {
285
+ root: {
286
+ base: "px-2.5 py-1 text-sm font-medium",
287
+ withCheckbox: "pl-1.25",
288
+ withAvatar: "pl-1.75",
289
+ withDot: "pl-2.25",
290
+ withCount: "pr-1",
291
+ withClose: "pr-1"
292
+ },
293
+ content: "gap-1.5",
294
+ count: "px-1.5 text-sm font-medium"
295
+ }
296
+ };
297
+ var Tag = ({
298
+ id,
299
+ avatarSrc,
300
+ avatarContrastBorder = true,
301
+ dot,
302
+ dotClassName,
303
+ isDisabled,
304
+ count,
305
+ className,
306
+ children,
307
+ onClose
308
+ }) => {
309
+ const context = useContext(TagGroupContext);
310
+ const leadingContent = avatarSrc ? /* @__PURE__ */ jsx(TagAvatar, { src: avatarSrc, alt: "Avatar", contrastBorder: avatarContrastBorder }) : dot ? /* @__PURE__ */ jsx(Dot, { className: cx("text-fg-success-secondary", dotClassName), size: "sm" }) : null;
311
+ return /* @__PURE__ */ jsx(
312
+ Tag$1,
313
+ {
314
+ id,
315
+ isDisabled,
316
+ textValue: typeof children === "string" ? children : void 0,
317
+ className: (state) => cx(
318
+ "flex cursor-default items-center gap-0.75 rounded-md border border-solid border-primary bg-primary text-secondary transition duration-50 ease-linear",
319
+ focusShadowPlain2,
320
+ styles2[context.size].root.base,
321
+ // With avatar
322
+ avatarSrc && styles2[context.size].root.withAvatar,
323
+ // With X button
324
+ (onClose || state.allowsRemoving) && styles2[context.size].root.withClose,
325
+ // With dot
326
+ dot && styles2[context.size].root.withDot,
327
+ // With count
328
+ typeof count === "number" && styles2[context.size].root.withCount,
329
+ // With checkbox
330
+ context.selectionMode !== "none" && cx("cursor-pointer", styles2[context.size].root.withCheckbox),
331
+ // Disabled
332
+ isDisabled && "cursor-not-allowed",
333
+ typeof className === "function" ? className(state) : className
334
+ ),
335
+ children: ({ isSelected, isDisabled: isDisabled2, allowsRemoving }) => /* @__PURE__ */ jsxs(Fragment, { children: [
336
+ /* @__PURE__ */ jsxs("div", { className: cx("flex items-center gap-1", styles2[context.size].content), children: [
337
+ context.selectionMode !== "none" && /* @__PURE__ */ jsx(TagCheckbox, { size: context.size, isSelected, isDisabled: isDisabled2 }),
338
+ leadingContent,
339
+ children,
340
+ typeof count === "number" && /* @__PURE__ */ jsx("span", { className: cx("flex items-center justify-center rounded-[3px] bg-tertiary text-center", styles2[context.size].count), children: count })
341
+ ] }),
342
+ (onClose || allowsRemoving) && /* @__PURE__ */ jsx(TagCloseX, { size: context.size, excludeFromTabOrder: allowsRemoving, onPress: () => id && onClose?.(id.toString()) })
343
+ ] })
344
+ }
345
+ );
346
+ };
347
+ var inputFocusRingShadow = "border-brand ring-1 ring-inset ring-brand";
348
+ var inputErrorFocusRingShadow = "border-error ring-1 ring-inset ring-error";
349
+ createContext({});
350
+ var InputTags = ({
351
+ size = "md",
352
+ label,
353
+ hint,
354
+ tooltip,
355
+ placeholder,
356
+ isRequired,
357
+ isDisabled,
358
+ isInvalid,
359
+ allowDuplicates = false,
360
+ maxTags,
361
+ value,
362
+ defaultValue,
363
+ onChange,
364
+ onTagAdded,
365
+ onTagRemoved,
366
+ validate,
367
+ className,
368
+ hideRequiredIndicator
369
+ }) => {
370
+ const isControlled = value !== void 0;
371
+ const idCounter = useRef(0);
372
+ const nextId = () => idCounter.current++;
373
+ const inputRef = useRef(null);
374
+ const tagGroupRef = useRef(null);
375
+ const [inputValue, setInputValue] = useState("");
376
+ const [internalEntries, setInternalEntries] = useState(() => (defaultValue ?? []).map((label2) => ({ id: nextId(), label: label2 })));
377
+ const prevControlledValue = useRef([]);
378
+ const controlledEntries = useRef([]);
379
+ const entries = (() => {
380
+ if (!isControlled) return internalEntries;
381
+ const prev = prevControlledValue.current;
382
+ if (prev === value) return controlledEntries.current;
383
+ const oldEntries = controlledEntries.current;
384
+ const newEntries = [];
385
+ const usedOldIndices = /* @__PURE__ */ new Set();
386
+ for (const label2 of value) {
387
+ const oldIndex = oldEntries.findIndex((e, i) => e.label === label2 && !usedOldIndices.has(i));
388
+ if (oldIndex !== -1) {
389
+ usedOldIndices.add(oldIndex);
390
+ newEntries.push(oldEntries[oldIndex]);
391
+ } else {
392
+ newEntries.push({ id: nextId(), label: label2 });
393
+ }
394
+ }
395
+ prevControlledValue.current = value;
396
+ controlledEntries.current = newEntries;
397
+ return newEntries;
398
+ })();
399
+ const tags = entries.map((e) => e.label);
400
+ const addTag = useCallback(
401
+ (text) => {
402
+ const trimmed = text.trim();
403
+ if (!trimmed) return false;
404
+ if (!allowDuplicates && tags.includes(trimmed)) return false;
405
+ if (maxTags && tags.length >= maxTags) return false;
406
+ if (validate && !validate(trimmed)) return false;
407
+ const newEntry = { id: nextId(), label: trimmed };
408
+ const newEntries = [...entries, newEntry];
409
+ if (!isControlled) {
410
+ setInternalEntries(newEntries);
411
+ }
412
+ onChange?.(newEntries.map((e) => e.label));
413
+ onTagAdded?.(trimmed);
414
+ return true;
415
+ },
416
+ [tags, entries, isControlled, allowDuplicates, maxTags, validate, onChange, onTagAdded]
417
+ );
418
+ const removeTag = useCallback(
419
+ (id) => {
420
+ const entry = entries.find((e) => e.id === id);
421
+ if (!entry) return;
422
+ const newEntries = entries.filter((e) => e.id !== id);
423
+ if (!isControlled) {
424
+ setInternalEntries(newEntries);
425
+ }
426
+ onChange?.(newEntries.map((e) => e.label));
427
+ onTagRemoved?.(entry.label);
428
+ },
429
+ [entries, isControlled, onChange, onTagRemoved]
430
+ );
431
+ const handleRemove = useCallback(
432
+ (keys) => {
433
+ for (const key of keys) {
434
+ removeTag(key);
435
+ }
436
+ if (entries.length - keys.size <= 0) {
437
+ setTimeout(() => inputRef.current?.focus(), 0);
438
+ }
439
+ },
440
+ [removeTag, entries.length]
441
+ );
442
+ const focusLastTag = useCallback(() => {
443
+ const tagEls = tagGroupRef.current?.querySelectorAll('[role="row"]');
444
+ if (tagEls && tagEls.length > 0) {
445
+ tagEls[tagEls.length - 1].focus();
446
+ }
447
+ }, []);
448
+ const handleInputKeyDown = (event) => {
449
+ const input = event.currentTarget;
450
+ const isCaretAtStart = input.selectionStart === 0 && input.selectionEnd === 0;
451
+ switch (event.key) {
452
+ case "Enter":
453
+ event.preventDefault();
454
+ if (addTag(inputValue)) {
455
+ setInputValue("");
456
+ }
457
+ break;
458
+ case "Backspace":
459
+ if (isCaretAtStart && inputValue === "") {
460
+ focusLastTag();
461
+ }
462
+ break;
463
+ case "ArrowLeft":
464
+ if (isCaretAtStart) {
465
+ focusLastTag();
466
+ }
467
+ break;
468
+ }
469
+ };
470
+ const handleTagGroupKeyDown = (event) => {
471
+ if (event.key === "ArrowRight") {
472
+ const tagEls = tagGroupRef.current?.querySelectorAll('[role="row"]');
473
+ if (tagEls && tagEls.length > 0) {
474
+ const lastTag = tagEls[tagEls.length - 1];
475
+ if (document.activeElement === lastTag || lastTag.contains(document.activeElement)) {
476
+ inputRef.current?.focus();
477
+ }
478
+ }
479
+ }
480
+ };
481
+ const isEmpty = entries.length === 0;
482
+ const hasTrailingIcon = tooltip || isInvalid;
483
+ const sizes3 = sortCx({
484
+ sm: {
485
+ root: cx("gap-2 px-3 py-2 text-sm", !isEmpty && "py-1.5 pl-2", hasTrailingIcon && "pr-9"),
486
+ iconTrailing: "right-3"
487
+ },
488
+ md: {
489
+ root: cx("gap-2 px-3 py-2 text-md", !isEmpty && "pl-2", hasTrailingIcon && "pr-9"),
490
+ iconTrailing: "right-3"
491
+ },
492
+ lg: {
493
+ root: cx("gap-2 px-3.5 py-2.5 text-md", !isEmpty && "pl-2.5", hasTrailingIcon && "pr-9.5"),
494
+ iconTrailing: "right-3.5"
495
+ }
496
+ });
497
+ return /* @__PURE__ */ jsxs("div", { className: cx("flex flex-col gap-1.5", className), children: [
498
+ label && /* @__PURE__ */ jsx(Label, { isRequired: hideRequiredIndicator ? false : isRequired, children: label }),
499
+ /* @__PURE__ */ jsx(
500
+ Group,
501
+ {
502
+ isDisabled,
503
+ isInvalid,
504
+ className: ({ isFocusWithin, isDisabled: isDisabled2, isInvalid: isInvalid2 }) => cx(
505
+ "group/input relative flex w-full items-center rounded-lg border border-solid border-primary bg-primary shadow-xs outline-hidden transition-[border-color,box-shadow] duration-100 ease-linear",
506
+ isDisabled2 && "cursor-not-allowed opacity-50",
507
+ isFocusWithin && !isDisabled2 && !isInvalid2 && inputFocusRingShadow,
508
+ isInvalid2 && !isFocusWithin && "border-error_subtle",
509
+ isInvalid2 && isFocusWithin && inputErrorFocusRingShadow,
510
+ sizes3[size].root
511
+ ),
512
+ children: ({ isDisabled: isDisabled2 }) => /* @__PURE__ */ jsxs(Fragment, { children: [
513
+ /* @__PURE__ */ jsxs("div", { className: cx("relative flex w-full flex-1 flex-row flex-wrap items-center justify-start", size === "sm" ? "gap-1.5" : "gap-2"), children: [
514
+ !isEmpty && /* @__PURE__ */ jsx("div", { ref: tagGroupRef, onKeyDown: handleTagGroupKeyDown, className: "contents", children: /* @__PURE__ */ jsx(TagGroup, { label: label || "Tags", size: size === "lg" ? "md" : size, onRemove: handleRemove, className: "contents", children: /* @__PURE__ */ jsx(TagList, { className: "flex flex-wrap gap-1.5 focus:outline-hidden", items: entries, children: (item) => /* @__PURE__ */ jsx(
515
+ Tag,
516
+ {
517
+ id: item.id,
518
+ isDisabled: isDisabled2,
519
+ className: "focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:ring-offset-[-2px] focus-visible:outline-hidden",
520
+ children: item.label
521
+ }
522
+ ) }) }) }),
523
+ /* @__PURE__ */ jsx("div", { className: "relative flex min-w-[20%] flex-1 flex-row items-center", children: /* @__PURE__ */ jsx(
524
+ Input,
525
+ {
526
+ ref: inputRef,
527
+ type: "text",
528
+ value: inputValue,
529
+ disabled: isDisabled2,
530
+ placeholder: isEmpty ? placeholder : void 0,
531
+ onChange: (e) => setInputValue(e.target.value),
532
+ onKeyDown: handleInputKeyDown,
533
+ className: "w-full flex-[1_0_0] appearance-none bg-transparent text-ellipsis text-primary caret-alpha-black/90 outline-hidden placeholder:text-placeholder focus:outline-hidden disabled:cursor-not-allowed"
534
+ }
535
+ ) })
536
+ ] }),
537
+ tooltip && /* @__PURE__ */ jsx(Tooltip, { title: tooltip, placement: "top", children: /* @__PURE__ */ jsx(
538
+ TooltipTrigger,
539
+ {
540
+ className: cx(
541
+ "absolute cursor-pointer text-fg-quaternary transition duration-100 ease-linear group-invalid/input:hidden hover:text-fg-quaternary_hover focus:text-fg-quaternary_hover",
542
+ sizes3[size].iconTrailing
543
+ ),
544
+ children: /* @__PURE__ */ jsx(QuestionIcon, { className: "size-4 stroke-[2.25px]" })
545
+ }
546
+ ) }),
547
+ /* @__PURE__ */ jsx(
548
+ InfoIcon,
549
+ {
550
+ className: cx(
551
+ "pointer-events-none absolute hidden size-4 stroke-[2.25px] text-fg-error-secondary group-invalid/input:block",
552
+ sizes3[size].iconTrailing
553
+ )
554
+ }
555
+ )
556
+ ] })
557
+ }
558
+ ),
559
+ hint && /* @__PURE__ */ jsx(HintText, { isInvalid, className: cx(size === "sm" && "text-xs"), children: hint })
560
+ ] });
561
+ };
562
+
563
+ export { InputTags };
564
+ //# sourceMappingURL=input-tags.js.map
565
+ //# sourceMappingURL=input-tags.js.map