@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,607 @@
1
+ import { createContext, useRef, useState, useCallback, useContext, useLayoutEffect } from 'react';
2
+ import { TagList as TagList$1, Label as Label$1, Group, Input, Button, TagGroup as TagGroup$1, Tag as Tag$1, Text, TooltipTrigger as TooltipTrigger$1, Tooltip as Tooltip$1, OverlayArrow } from 'react-aria-components';
3
+ import { extendTailwindMerge } from 'tailwind-merge';
4
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
+ import { EyeIcon } from '@phosphor-icons/react/dist/csr/Eye';
6
+ import { EyeSlashIcon } from '@phosphor-icons/react/dist/csr/EyeSlash';
7
+ import { QuestionIcon } from '@phosphor-icons/react/dist/csr/Question';
8
+ import { InfoIcon } from '@phosphor-icons/react/dist/csr/Info';
9
+ import { UserIcon } from '@phosphor-icons/react/dist/csr/User';
10
+ import { XIcon } from '@phosphor-icons/react/dist/csr/X';
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 inputFocusRingShadow = "border-brand ring-1 ring-inset ring-brand";
139
+ var inputErrorFocusRingShadow = "border-error ring-1 ring-inset ring-error";
140
+ var InputBase = ({
141
+ ref,
142
+ tooltip,
143
+ shortcut,
144
+ groupRef,
145
+ size = "md",
146
+ isInvalid,
147
+ isDisabled,
148
+ isRequired,
149
+ icon: Icon,
150
+ placeholder,
151
+ wrapperClassName,
152
+ tooltipClassName,
153
+ inputClassName,
154
+ iconClassName,
155
+ type = "text",
156
+ ...inputProps
157
+ }) => {
158
+ const [isPasswordVisible, setIsPasswordVisible] = useState(false);
159
+ const hasTrailingIcon = tooltip || isInvalid;
160
+ const hasLeadingIcon = Icon;
161
+ const context = useContext(TextFieldContext);
162
+ const inputSize = context?.size || size;
163
+ const sizes3 = sortCx({
164
+ sm: {
165
+ root: cx("px-3 py-2 text-sm", hasLeadingIcon && "pl-9", hasTrailingIcon && "pr-9"),
166
+ iconLeading: "left-3 size-4 stroke-[2.25px]",
167
+ iconTrailing: "right-3",
168
+ shortcut: "pr-1.5"
169
+ },
170
+ md: {
171
+ root: cx("px-3 py-2 text-md", hasLeadingIcon && "pl-10", hasTrailingIcon && "pr-9"),
172
+ iconLeading: "left-3 size-5",
173
+ iconTrailing: "right-3",
174
+ shortcut: "pr-2"
175
+ },
176
+ lg: {
177
+ root: cx("px-3.5 py-2.5 text-md", hasLeadingIcon && "pl-10.5", hasTrailingIcon && "pr-9.5"),
178
+ iconLeading: "left-3.5 size-5",
179
+ iconTrailing: "right-3.5",
180
+ shortcut: "pr-2.5"
181
+ }
182
+ });
183
+ return /* @__PURE__ */ jsxs(
184
+ Group,
185
+ {
186
+ ...{ isDisabled, isInvalid },
187
+ ref: groupRef,
188
+ className: ({ isFocusWithin, isDisabled: isDisabled2, isInvalid: isInvalid2 }) => cx(
189
+ "group/input relative flex w-full flex-row place-content-center place-items-center rounded-lg border border-solid border-primary bg-primary shadow-xs transition-[border-color,box-shadow] duration-100 ease-linear",
190
+ isFocusWithin && !isDisabled2 && !isInvalid2 && inputFocusRingShadow,
191
+ // Disabled state styles
192
+ isDisabled2 && "cursor-not-allowed opacity-50",
193
+ "group-disabled:cursor-not-allowed group-disabled:opacity-50",
194
+ // Invalid state styles
195
+ isInvalid2 && !isFocusWithin && "border-error_subtle",
196
+ "group-invalid:border-error_subtle",
197
+ "group-invalid:focus-within:border-error group-invalid:focus-within:ring-1 group-invalid:focus-within:ring-inset group-invalid:focus-within:ring-error",
198
+ // Invalid + focus — darker error stroke (not brand)
199
+ isInvalid2 && isFocusWithin && inputErrorFocusRingShadow,
200
+ context?.wrapperClassName,
201
+ wrapperClassName
202
+ ),
203
+ children: [
204
+ Icon && /* @__PURE__ */ jsx(Icon, { className: cx("pointer-events-none absolute text-fg-quaternary", sizes3[inputSize].iconLeading, context?.iconClassName, iconClassName) }),
205
+ /* @__PURE__ */ jsx(
206
+ Input,
207
+ {
208
+ ...inputProps,
209
+ ref,
210
+ required: isRequired,
211
+ type: type === "password" && isPasswordVisible ? "text" : type,
212
+ placeholder,
213
+ className: cx(
214
+ "m-0 w-full bg-transparent text-primary ring-0 outline-hidden placeholder:text-placeholder autofill:rounded-lg autofill:text-primary disabled:cursor-not-allowed",
215
+ sizes3[inputSize].root,
216
+ context?.inputClassName,
217
+ inputClassName
218
+ )
219
+ }
220
+ ),
221
+ tooltip && type !== "password" && /* @__PURE__ */ jsx(Tooltip, { title: tooltip, placement: "top", children: /* @__PURE__ */ jsx(
222
+ TooltipTrigger,
223
+ {
224
+ className: cx(
225
+ "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",
226
+ sizes3[inputSize].iconTrailing,
227
+ context?.tooltipClassName,
228
+ tooltipClassName
229
+ ),
230
+ children: /* @__PURE__ */ jsx(QuestionIcon, { className: "size-4 stroke-[2.25px]" })
231
+ }
232
+ ) }),
233
+ type !== "password" && /* @__PURE__ */ jsx(
234
+ InfoIcon,
235
+ {
236
+ className: cx(
237
+ "pointer-events-none absolute hidden size-4 stroke-[2.25px] text-fg-error-secondary group-invalid/input:block",
238
+ sizes3[inputSize].iconTrailing,
239
+ context?.tooltipClassName,
240
+ tooltipClassName
241
+ )
242
+ }
243
+ ),
244
+ type === "password" && /* @__PURE__ */ jsx(
245
+ Button,
246
+ {
247
+ "aria-label": "Toggle password visibility",
248
+ onClick: () => setIsPasswordVisible(!isPasswordVisible),
249
+ className: cx(
250
+ "absolute flex cursor-pointer items-center justify-center text-fg-quaternary transition duration-100 ease-linear hover:text-fg-quaternary_hover focus:text-fg-quaternary_hover focus:outline-hidden",
251
+ sizes3[inputSize].iconTrailing
252
+ ),
253
+ children: isPasswordVisible ? /* @__PURE__ */ jsx(EyeSlashIcon, { className: "size-4 stroke-[2.25px]" }) : /* @__PURE__ */ jsx(EyeIcon, { className: "size-4 stroke-[2.25px]" })
254
+ }
255
+ ),
256
+ shortcut && /* @__PURE__ */ jsx(
257
+ "div",
258
+ {
259
+ className: cx(
260
+ "pointer-events-none absolute inset-y-0.5 right-0.5 z-10 hidden items-center rounded-r-[inherit] bg-linear-to-r from-transparent to-bg-primary to-40% pl-8 md:flex",
261
+ sizes3[inputSize].shortcut
262
+ ),
263
+ children: /* @__PURE__ */ jsx(
264
+ "span",
265
+ {
266
+ "aria-hidden": "true",
267
+ className: "pointer-events-none rounded px-1 py-px text-xs font-medium text-quaternary ring-1 ring-secondary select-none ring-inset",
268
+ children: typeof shortcut === "string" ? shortcut : "\u2318K"
269
+ }
270
+ )
271
+ }
272
+ )
273
+ ]
274
+ }
275
+ );
276
+ };
277
+ InputBase.displayName = "InputBase";
278
+ var TextFieldContext = createContext({});
279
+ var sizes = {
280
+ sm: {
281
+ wh: 8,
282
+ c: 4,
283
+ r: 2.5
284
+ },
285
+ md: {
286
+ wh: 10,
287
+ c: 5,
288
+ r: 4
289
+ }
290
+ };
291
+ var Dot = ({ size = "md", ...props }) => {
292
+ 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" }) });
293
+ };
294
+ var CHECKBOX_TICK_DELAY_MS = 60;
295
+ var CHECKBOX_TICK_DRAW_MS = 100;
296
+ var focusRingShadow = "outline-none [box-shadow:0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]";
297
+ var sizes2 = {
298
+ sm: { box: "size-3.5 rounded-xs", iconPixelSize: 10 },
299
+ md: { box: "size-4 rounded-xs", iconPixelSize: 12 },
300
+ lg: { box: "size-4.5 rounded-xs", iconPixelSize: 13 }
301
+ };
302
+ function TagCheckboxAnimatedCheckMark({ pixelSize, className }) {
303
+ const pathRef = useRef(null);
304
+ useLayoutEffect(() => {
305
+ const path = pathRef.current;
306
+ if (!path || typeof path.getTotalLength !== "function") return;
307
+ const len = path.getTotalLength();
308
+ if (len <= 0) return;
309
+ path.style.strokeDasharray = `${len}`;
310
+ path.style.strokeDashoffset = `${len}`;
311
+ if (typeof path.animate !== "function") {
312
+ path.style.strokeDashoffset = "0";
313
+ return;
314
+ }
315
+ const anim = path.animate([{ strokeDashoffset: len }, { strokeDashoffset: 0 }], {
316
+ duration: CHECKBOX_TICK_DRAW_MS,
317
+ delay: CHECKBOX_TICK_DELAY_MS,
318
+ easing: "cubic-bezier(0.45, 0, 0.2, 1)",
319
+ fill: "forwards"
320
+ });
321
+ return () => anim.cancel();
322
+ }, []);
323
+ 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(
324
+ "path",
325
+ {
326
+ ref: pathRef,
327
+ d: "M2.33325 7L5.24992 9.91667L11.6666 3.5",
328
+ stroke: "currentColor",
329
+ strokeWidth: "2",
330
+ strokeLinecap: "round",
331
+ strokeLinejoin: "round"
332
+ }
333
+ ) });
334
+ }
335
+ var TagCheckbox = ({ className, isFocused, isSelected, isDisabled, size = "sm" }) => {
336
+ const { box, iconPixelSize } = sizes2[size];
337
+ return /* @__PURE__ */ jsx(
338
+ "div",
339
+ {
340
+ className: cx(
341
+ "relative flex shrink-0 cursor-pointer appearance-none items-center justify-center overflow-clip border border-solid border-primary",
342
+ box,
343
+ isSelected ? "border-transparent bg-brand-solid" : "bg-primary",
344
+ isDisabled && "cursor-not-allowed opacity-50",
345
+ isDisabled && !isSelected && "bg-tertiary",
346
+ isFocused && !isDisabled && focusRingShadow,
347
+ className
348
+ ),
349
+ children: isSelected && /* @__PURE__ */ jsx(TagCheckboxAnimatedCheckMark, { pixelSize: iconPixelSize, className: "pointer-events-none text-fg-white" })
350
+ }
351
+ );
352
+ };
353
+ TagCheckbox.displayName = "TagCheckbox";
354
+ 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)]";
355
+ var styles = {
356
+ sm: { root: "p-0.5", icon: "size-2.5" },
357
+ md: { root: "p-0.5", icon: "size-3" },
358
+ lg: { root: "p-[3px]", icon: "size-3.5" }
359
+ };
360
+ var TagCloseX = ({ size = "md", className, ...otherProps }) => {
361
+ return /* @__PURE__ */ jsx(
362
+ Button,
363
+ {
364
+ slot: "remove",
365
+ "aria-label": "Remove this tag",
366
+ className: cx(
367
+ "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",
368
+ focusShadowPlain,
369
+ styles[size].root,
370
+ className
371
+ ),
372
+ ...otherProps,
373
+ children: /* @__PURE__ */ jsx(XIcon, { className: cx("shrink-0 transition-inherit-all", styles[size].icon) })
374
+ }
375
+ );
376
+ };
377
+ 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)]";
378
+ var TagAvatar = ({ src, alt, contrastBorder = true, className }) => {
379
+ const [isFailed, setIsFailed] = useState(false);
380
+ return /* @__PURE__ */ jsx(
381
+ "div",
382
+ {
383
+ className: cx(
384
+ "relative inline-flex size-4 shrink-0 items-center justify-center overflow-hidden rounded-full bg-tertiary",
385
+ contrastBorder && "outline-[0.5px] -outline-offset-[0.5px] outline-black/16",
386
+ className
387
+ ),
388
+ 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" })
389
+ }
390
+ );
391
+ };
392
+ var TagGroupContext = createContext({
393
+ selectionMode: "none",
394
+ size: "sm"
395
+ });
396
+ var TagGroup = ({ label, selectionMode = "none", size = "sm", children, ...otherProps }) => {
397
+ return /* @__PURE__ */ jsx(TagGroupContext.Provider, { value: { selectionMode, size }, children: /* @__PURE__ */ jsx(TagGroup$1, { "aria-label": label, selectionMode, disallowEmptySelection: selectionMode === "single", ...otherProps, children }) });
398
+ };
399
+ var TagList = TagList$1;
400
+ var styles2 = {
401
+ sm: {
402
+ root: {
403
+ base: "px-2 py-0.75 text-xs font-medium",
404
+ withCheckbox: "pl-1.25",
405
+ withAvatar: "pl-1",
406
+ withDot: "pl-1.5",
407
+ withCount: "pr-1",
408
+ withClose: "pr-1"
409
+ },
410
+ content: "gap-1",
411
+ count: "px-1 text-xs font-medium"
412
+ },
413
+ md: {
414
+ root: {
415
+ base: "px-2.25 py-0.5 text-sm font-medium",
416
+ withCheckbox: "pl-1",
417
+ withAvatar: "pl-1.25",
418
+ withDot: "pl-1.75",
419
+ withCount: "pr-0.75",
420
+ withClose: "pr-1"
421
+ },
422
+ content: "gap-1.25",
423
+ count: "px-1.25 text-xs font-medium"
424
+ },
425
+ lg: {
426
+ root: {
427
+ base: "px-2.5 py-1 text-sm font-medium",
428
+ withCheckbox: "pl-1.25",
429
+ withAvatar: "pl-1.75",
430
+ withDot: "pl-2.25",
431
+ withCount: "pr-1",
432
+ withClose: "pr-1"
433
+ },
434
+ content: "gap-1.5",
435
+ count: "px-1.5 text-sm font-medium"
436
+ }
437
+ };
438
+ var Tag = ({
439
+ id,
440
+ avatarSrc,
441
+ avatarContrastBorder = true,
442
+ dot,
443
+ dotClassName,
444
+ isDisabled,
445
+ count,
446
+ className,
447
+ children,
448
+ onClose
449
+ }) => {
450
+ const context = useContext(TagGroupContext);
451
+ 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;
452
+ return /* @__PURE__ */ jsx(
453
+ Tag$1,
454
+ {
455
+ id,
456
+ isDisabled,
457
+ textValue: typeof children === "string" ? children : void 0,
458
+ className: (state) => cx(
459
+ "flex cursor-default items-center gap-0.75 rounded-md border border-solid border-primary bg-primary text-secondary transition duration-50 ease-linear",
460
+ focusShadowPlain2,
461
+ styles2[context.size].root.base,
462
+ // With avatar
463
+ avatarSrc && styles2[context.size].root.withAvatar,
464
+ // With X button
465
+ (onClose || state.allowsRemoving) && styles2[context.size].root.withClose,
466
+ // With dot
467
+ dot && styles2[context.size].root.withDot,
468
+ // With count
469
+ typeof count === "number" && styles2[context.size].root.withCount,
470
+ // With checkbox
471
+ context.selectionMode !== "none" && cx("cursor-pointer", styles2[context.size].root.withCheckbox),
472
+ // Disabled
473
+ isDisabled && "cursor-not-allowed",
474
+ typeof className === "function" ? className(state) : className
475
+ ),
476
+ children: ({ isSelected, isDisabled: isDisabled2, allowsRemoving }) => /* @__PURE__ */ jsxs(Fragment, { children: [
477
+ /* @__PURE__ */ jsxs("div", { className: cx("flex items-center gap-1", styles2[context.size].content), children: [
478
+ context.selectionMode !== "none" && /* @__PURE__ */ jsx(TagCheckbox, { size: context.size, isSelected, isDisabled: isDisabled2 }),
479
+ leadingContent,
480
+ children,
481
+ 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 })
482
+ ] }),
483
+ (onClose || allowsRemoving) && /* @__PURE__ */ jsx(TagCloseX, { size: context.size, excludeFromTabOrder: allowsRemoving, onPress: () => id && onClose?.(id.toString()) })
484
+ ] })
485
+ }
486
+ );
487
+ };
488
+ var InputTagsOuter = ({
489
+ size = "md",
490
+ label,
491
+ hint,
492
+ tooltip,
493
+ placeholder,
494
+ isRequired,
495
+ isDisabled,
496
+ isInvalid,
497
+ allowDuplicates = false,
498
+ maxTags,
499
+ value,
500
+ defaultValue,
501
+ onChange,
502
+ onTagAdded,
503
+ onTagRemoved,
504
+ validate,
505
+ className,
506
+ hideRequiredIndicator
507
+ }) => {
508
+ const isControlled = value !== void 0;
509
+ const idCounter = useRef(0);
510
+ const nextId = () => `tag-${idCounter.current++}`;
511
+ const [inputValue, setInputValue] = useState("");
512
+ const [internalEntries, setInternalEntries] = useState(() => (defaultValue ?? []).map((label2) => ({ id: nextId(), label: label2 })));
513
+ const prevControlledValue = useRef([]);
514
+ const controlledEntries = useRef([]);
515
+ const entries = (() => {
516
+ if (!isControlled) return internalEntries;
517
+ const prev = prevControlledValue.current;
518
+ if (prev === value) return controlledEntries.current;
519
+ const oldEntries = controlledEntries.current;
520
+ const newEntries = [];
521
+ const usedOldIndices = /* @__PURE__ */ new Set();
522
+ for (const label2 of value) {
523
+ const oldIndex = oldEntries.findIndex((e, i) => e.label === label2 && !usedOldIndices.has(i));
524
+ if (oldIndex !== -1) {
525
+ usedOldIndices.add(oldIndex);
526
+ newEntries.push(oldEntries[oldIndex]);
527
+ } else {
528
+ newEntries.push({ id: nextId(), label: label2 });
529
+ }
530
+ }
531
+ prevControlledValue.current = value;
532
+ controlledEntries.current = newEntries;
533
+ return newEntries;
534
+ })();
535
+ const tags = entries.map((e) => e.label);
536
+ const addTag = useCallback(
537
+ (text) => {
538
+ const trimmed = text.trim();
539
+ if (!trimmed) return false;
540
+ if (!allowDuplicates && tags.includes(trimmed)) return false;
541
+ if (maxTags && tags.length >= maxTags) return false;
542
+ if (validate && !validate(trimmed)) return false;
543
+ const newEntry = { id: nextId(), label: trimmed };
544
+ const newEntries = [...entries, newEntry];
545
+ if (!isControlled) {
546
+ setInternalEntries(newEntries);
547
+ }
548
+ onChange?.(newEntries.map((e) => e.label));
549
+ onTagAdded?.(trimmed);
550
+ return true;
551
+ },
552
+ [tags, entries, isControlled, allowDuplicates, maxTags, validate, onChange, onTagAdded]
553
+ );
554
+ const removeTag = useCallback(
555
+ (id) => {
556
+ const entry = entries.find((e) => e.id === id);
557
+ if (!entry) return;
558
+ const newEntries = entries.filter((e) => e.id !== id);
559
+ if (!isControlled) {
560
+ setInternalEntries(newEntries);
561
+ }
562
+ onChange?.(newEntries.map((e) => e.label));
563
+ onTagRemoved?.(entry.label);
564
+ },
565
+ [entries, isControlled, onChange, onTagRemoved]
566
+ );
567
+ const handleRemove = useCallback(
568
+ (keys) => {
569
+ for (const key of keys) {
570
+ removeTag(key.toString());
571
+ }
572
+ },
573
+ [removeTag]
574
+ );
575
+ const handleInputKeyDown = (event) => {
576
+ if (event.key === "Enter") {
577
+ event.preventDefault();
578
+ if (addTag(inputValue)) {
579
+ setInputValue("");
580
+ }
581
+ }
582
+ };
583
+ return /* @__PURE__ */ jsxs("div", { className: cx("flex flex-col", size === "sm" ? "gap-1.5" : "gap-2", className), children: [
584
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
585
+ label && /* @__PURE__ */ jsx(Label, { isRequired: hideRequiredIndicator ? false : isRequired, children: label }),
586
+ /* @__PURE__ */ jsx(
587
+ InputBase,
588
+ {
589
+ size,
590
+ tooltip,
591
+ placeholder,
592
+ isInvalid,
593
+ isDisabled,
594
+ value: inputValue,
595
+ onChange: (e) => setInputValue(e.currentTarget.value),
596
+ onKeyDown: handleInputKeyDown
597
+ }
598
+ )
599
+ ] }),
600
+ entries.length > 0 && /* @__PURE__ */ jsx(TagGroup, { label: label || "Tags", size: size === "lg" ? "md" : size, onRemove: handleRemove, children: /* @__PURE__ */ jsx(TagList, { className: "flex flex-wrap gap-1.5 focus:outline-hidden", items: entries, children: (item) => /* @__PURE__ */ jsx(Tag, { id: item.id, isDisabled, children: item.label }) }) }),
601
+ hint && tags.length === 0 && /* @__PURE__ */ jsx(HintText, { isInvalid, className: cx(size === "sm" && "text-xs"), children: hint })
602
+ ] });
603
+ };
604
+
605
+ export { InputTagsOuter };
606
+ //# sourceMappingURL=input-tags-outer.js.map
607
+ //# sourceMappingURL=input-tags-outer.js.map