@fanvue/ui 3.52.0 → 3.53.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 (141) hide show
  1. package/dist/cjs/components/Autocomplete/Autocomplete.cjs +34 -10
  2. package/dist/cjs/components/Autocomplete/Autocomplete.cjs.map +1 -1
  3. package/dist/cjs/components/Autocomplete/AutocompleteOptionItem.cjs +13 -1
  4. package/dist/cjs/components/Autocomplete/AutocompleteOptionItem.cjs.map +1 -1
  5. package/dist/cjs/components/BottomNavigation/BottomNavigation.cjs +2 -2
  6. package/dist/cjs/components/BottomNavigation/BottomNavigation.cjs.map +1 -1
  7. package/dist/cjs/components/Card/Card.cjs +5 -2
  8. package/dist/cjs/components/Card/Card.cjs.map +1 -1
  9. package/dist/cjs/components/Chart/ChartCard.cjs +2 -1
  10. package/dist/cjs/components/Chart/ChartCard.cjs.map +1 -1
  11. package/dist/cjs/components/Chart/ChartLoadingOverlay.cjs +1 -1
  12. package/dist/cjs/components/Chart/ChartLoadingOverlay.cjs.map +1 -1
  13. package/dist/cjs/components/ChatInput/ChatInput.cjs +2 -2
  14. package/dist/cjs/components/ChatInput/ChatInput.cjs.map +1 -1
  15. package/dist/cjs/components/ChatMessage/ChatMessage.cjs +1 -1
  16. package/dist/cjs/components/ChatMessage/ChatMessage.cjs.map +1 -1
  17. package/dist/cjs/components/CreatorCard/CreatorCard.cjs +3 -5
  18. package/dist/cjs/components/CreatorCard/CreatorCard.cjs.map +1 -1
  19. package/dist/cjs/components/CreatorCover/CreatorCover.cjs +11 -7
  20. package/dist/cjs/components/CreatorCover/CreatorCover.cjs.map +1 -1
  21. package/dist/cjs/components/DatePicker/DatePicker.cjs +37 -16
  22. package/dist/cjs/components/DatePicker/DatePicker.cjs.map +1 -1
  23. package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs +33 -10
  24. package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs.map +1 -1
  25. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs +2 -1
  26. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs.map +1 -1
  27. package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs +18 -13
  28. package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs.map +1 -1
  29. package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs +56 -40
  30. package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs.map +1 -1
  31. package/dist/cjs/components/IconButton/IconButton.cjs +5 -2
  32. package/dist/cjs/components/IconButton/IconButton.cjs.map +1 -1
  33. package/dist/cjs/components/Icons/MenuRowIcon.cjs +9 -2
  34. package/dist/cjs/components/Icons/MenuRowIcon.cjs.map +1 -1
  35. package/dist/cjs/components/Icons/VerifiedIcon.cjs +9 -15
  36. package/dist/cjs/components/Icons/VerifiedIcon.cjs.map +1 -1
  37. package/dist/cjs/components/PhoneField/PhoneField.cjs +21 -17
  38. package/dist/cjs/components/PhoneField/PhoneField.cjs.map +1 -1
  39. package/dist/cjs/components/Popover/Popover.cjs +69 -0
  40. package/dist/cjs/components/Popover/Popover.cjs.map +1 -0
  41. package/dist/cjs/components/Select/Select.cjs +40 -12
  42. package/dist/cjs/components/Select/Select.cjs.map +1 -1
  43. package/dist/cjs/components/Slider/SliderThumb.cjs +3 -2
  44. package/dist/cjs/components/Slider/SliderThumb.cjs.map +1 -1
  45. package/dist/cjs/components/Snackbar/Snackbar.cjs +1 -1
  46. package/dist/cjs/components/Snackbar/Snackbar.cjs.map +1 -1
  47. package/dist/cjs/components/Switch/Switch.cjs +1 -1
  48. package/dist/cjs/components/Switch/Switch.cjs.map +1 -1
  49. package/dist/cjs/components/Table/Table.cjs +46 -5
  50. package/dist/cjs/components/Table/Table.cjs.map +1 -1
  51. package/dist/cjs/components/Tag/Tag.cjs +99 -0
  52. package/dist/cjs/components/Tag/Tag.cjs.map +1 -0
  53. package/dist/cjs/components/TextArea/TextArea.cjs +5 -4
  54. package/dist/cjs/components/TextArea/TextArea.cjs.map +1 -1
  55. package/dist/cjs/components/TextField/TextField.cjs +30 -15
  56. package/dist/cjs/components/TextField/TextField.cjs.map +1 -1
  57. package/dist/cjs/index.cjs +8 -0
  58. package/dist/cjs/index.cjs.map +1 -1
  59. package/dist/cjs/utils/floatingContentSurface.cjs +8 -0
  60. package/dist/cjs/utils/floatingContentSurface.cjs.map +1 -0
  61. package/dist/cjs/utils/inputFieldClasses.cjs +8 -0
  62. package/dist/cjs/utils/inputFieldClasses.cjs.map +1 -0
  63. package/dist/cjs/utils/pointerCapture.cjs +20 -0
  64. package/dist/cjs/utils/pointerCapture.cjs.map +1 -0
  65. package/dist/cjs/utils/useDragToDismiss.cjs +3 -2
  66. package/dist/cjs/utils/useDragToDismiss.cjs.map +1 -1
  67. package/dist/cjs/utils/useSuppressClickAfterDrag.cjs +2 -1
  68. package/dist/cjs/utils/useSuppressClickAfterDrag.cjs.map +1 -1
  69. package/dist/components/Autocomplete/Autocomplete.mjs +34 -10
  70. package/dist/components/Autocomplete/Autocomplete.mjs.map +1 -1
  71. package/dist/components/Autocomplete/AutocompleteOptionItem.mjs +13 -1
  72. package/dist/components/Autocomplete/AutocompleteOptionItem.mjs.map +1 -1
  73. package/dist/components/BottomNavigation/BottomNavigation.mjs +2 -2
  74. package/dist/components/BottomNavigation/BottomNavigation.mjs.map +1 -1
  75. package/dist/components/Card/Card.mjs +5 -2
  76. package/dist/components/Card/Card.mjs.map +1 -1
  77. package/dist/components/Chart/ChartCard.mjs +2 -1
  78. package/dist/components/Chart/ChartCard.mjs.map +1 -1
  79. package/dist/components/Chart/ChartLoadingOverlay.mjs +1 -1
  80. package/dist/components/Chart/ChartLoadingOverlay.mjs.map +1 -1
  81. package/dist/components/ChatInput/ChatInput.mjs +2 -2
  82. package/dist/components/ChatInput/ChatInput.mjs.map +1 -1
  83. package/dist/components/ChatMessage/ChatMessage.mjs +1 -1
  84. package/dist/components/ChatMessage/ChatMessage.mjs.map +1 -1
  85. package/dist/components/CreatorCard/CreatorCard.mjs +3 -5
  86. package/dist/components/CreatorCard/CreatorCard.mjs.map +1 -1
  87. package/dist/components/CreatorCover/CreatorCover.mjs +11 -7
  88. package/dist/components/CreatorCover/CreatorCover.mjs.map +1 -1
  89. package/dist/components/DatePicker/DatePicker.mjs +39 -18
  90. package/dist/components/DatePicker/DatePicker.mjs.map +1 -1
  91. package/dist/components/DropdownMenu/DropdownMenuItem.mjs +33 -10
  92. package/dist/components/DropdownMenu/DropdownMenuItem.mjs.map +1 -1
  93. package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs +2 -1
  94. package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs.map +1 -1
  95. package/dist/components/DropdownMenu/DropdownMenuRoot.mjs +18 -13
  96. package/dist/components/DropdownMenu/DropdownMenuRoot.mjs.map +1 -1
  97. package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs +56 -40
  98. package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs.map +1 -1
  99. package/dist/components/IconButton/IconButton.mjs +5 -2
  100. package/dist/components/IconButton/IconButton.mjs.map +1 -1
  101. package/dist/components/Icons/MenuRowIcon.mjs +9 -2
  102. package/dist/components/Icons/MenuRowIcon.mjs.map +1 -1
  103. package/dist/components/Icons/VerifiedIcon.mjs +9 -15
  104. package/dist/components/Icons/VerifiedIcon.mjs.map +1 -1
  105. package/dist/components/PhoneField/PhoneField.mjs +21 -17
  106. package/dist/components/PhoneField/PhoneField.mjs.map +1 -1
  107. package/dist/components/Popover/Popover.mjs +51 -0
  108. package/dist/components/Popover/Popover.mjs.map +1 -0
  109. package/dist/components/Select/Select.mjs +40 -12
  110. package/dist/components/Select/Select.mjs.map +1 -1
  111. package/dist/components/Slider/SliderThumb.mjs +3 -2
  112. package/dist/components/Slider/SliderThumb.mjs.map +1 -1
  113. package/dist/components/Snackbar/Snackbar.mjs +1 -1
  114. package/dist/components/Snackbar/Snackbar.mjs.map +1 -1
  115. package/dist/components/Switch/Switch.mjs +1 -1
  116. package/dist/components/Switch/Switch.mjs.map +1 -1
  117. package/dist/components/Table/Table.mjs +46 -5
  118. package/dist/components/Table/Table.mjs.map +1 -1
  119. package/dist/components/Tag/Tag.mjs +82 -0
  120. package/dist/components/Tag/Tag.mjs.map +1 -0
  121. package/dist/components/TextArea/TextArea.mjs +5 -4
  122. package/dist/components/TextArea/TextArea.mjs.map +1 -1
  123. package/dist/components/TextField/TextField.mjs +30 -15
  124. package/dist/components/TextField/TextField.mjs.map +1 -1
  125. package/dist/date-picker.d.ts +9 -0
  126. package/dist/index.d.ts +217 -15
  127. package/dist/index.mjs +8 -0
  128. package/dist/index.mjs.map +1 -1
  129. package/dist/styles/base.css +8 -4
  130. package/dist/styles/theme.css +1217 -1
  131. package/dist/utils/floatingContentSurface.mjs +8 -0
  132. package/dist/utils/floatingContentSurface.mjs.map +1 -0
  133. package/dist/utils/inputFieldClasses.mjs +8 -0
  134. package/dist/utils/inputFieldClasses.mjs.map +1 -0
  135. package/dist/utils/pointerCapture.mjs +20 -0
  136. package/dist/utils/pointerCapture.mjs.map +1 -0
  137. package/dist/utils/useDragToDismiss.mjs +3 -2
  138. package/dist/utils/useDragToDismiss.mjs.map +1 -1
  139. package/dist/utils/useSuppressClickAfterDrag.mjs +2 -1
  140. package/dist/utils/useSuppressClickAfterDrag.mjs.map +1 -1
  141. package/package.json +1 -1
@@ -6,6 +6,7 @@ const React = require("react");
6
6
  require("@radix-ui/react-slot");
7
7
  const CheckOutlineIcon = require("../Icons/CheckOutlineIcon.cjs");
8
8
  const cn = require("../../utils/cn.cjs");
9
+ const inputFieldClasses = require("../../utils/inputFieldClasses.cjs");
9
10
  function _interopNamespaceDefault(e) {
10
11
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
11
12
  if (e) {
@@ -58,14 +59,15 @@ function getContainerClassName(size, error, disabled, hasAction) {
58
59
  "relative flex items-center overflow-hidden rounded-sm border bg-inputs-inputs-primary after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] has-focus-visible:outline-none has-focus-visible:after:shadow-focus-ring motion-safe:transition-colors",
59
60
  hasAction ? CONTAINER_PADDING_X_WITH_ACTION[size] : CONTAINER_PADDING_X[size],
60
61
  CONTAINER_GAP[size],
61
- error ? "border-error-content" : "border-border-primary",
62
- !disabled && !error && "hover:border-neutral-alphas-400",
62
+ error ? "border-error-content" : ["border-border-input", inputFieldClasses.INPUT_FIELD_V2_FOCUS_CLASSES],
63
+ !disabled && !error && "hover:border-border-input-hover",
63
64
  CONTAINER_HEIGHT[size],
64
- disabled && "opacity-50"
65
+ disabled && inputFieldClasses.INPUT_FIELD_DISABLED_CLASSES
65
66
  );
66
67
  }
67
68
  function LeadingIcon({
68
69
  size = "16",
70
+ disabled,
69
71
  children
70
72
  }) {
71
73
  if (!children) return null;
@@ -74,7 +76,8 @@ function LeadingIcon({
74
76
  {
75
77
  className: cn.cn(
76
78
  "pointer-events-none flex shrink-0 items-center justify-center text-content-secondary",
77
- size === "24" ? "size-6" : "size-4"
79
+ size === "24" ? "size-6" : "size-4",
80
+ disabled && "theme-v2:text-icons-disabled"
78
81
  ),
79
82
  children
80
83
  }
@@ -84,6 +87,7 @@ function SideLabel({
84
87
  id,
85
88
  size,
86
89
  align,
90
+ disabled,
87
91
  children
88
92
  }) {
89
93
  if (!children) return null;
@@ -94,7 +98,8 @@ function SideLabel({
94
98
  className: cn.cn(
95
99
  "shrink-0 select-none whitespace-nowrap text-content-tertiary",
96
100
  align === "right" && "text-right",
97
- SIDE_LABEL_TYPOGRAPHY[size]
101
+ SIDE_LABEL_TYPOGRAPHY[size],
102
+ disabled && "theme-v2:text-content-disabled"
98
103
  ),
99
104
  children
100
105
  }
@@ -102,13 +107,23 @@ function SideLabel({
102
107
  }
103
108
  function TrailingAdornment({
104
109
  rightIcon,
105
- validated
110
+ validated,
111
+ disabled
106
112
  }) {
107
113
  if (!rightIcon && !validated) return null;
108
- return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex shrink-0 items-center gap-2 text-content-secondary", children: [
109
- rightIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-tf-interactive": "", className: "flex size-4 shrink-0 items-center justify-center", children: rightIcon }),
110
- validated && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pointer-events-none flex size-4 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(CheckOutlineIcon.CheckOutlineIcon, { className: "text-success-content" }) })
111
- ] });
114
+ return /* @__PURE__ */ jsxRuntime.jsxs(
115
+ "span",
116
+ {
117
+ className: cn.cn(
118
+ "flex shrink-0 items-center gap-2 text-content-secondary",
119
+ disabled && "theme-v2:text-icons-disabled"
120
+ ),
121
+ children: [
122
+ rightIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-tf-interactive": "", className: "flex size-4 shrink-0 items-center justify-center", children: rightIcon }),
123
+ validated && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pointer-events-none flex size-4 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(CheckOutlineIcon.CheckOutlineIcon, { className: "text-success-content" }) })
124
+ ]
125
+ }
126
+ );
112
127
  }
113
128
  function TextFieldHelperText({
114
129
  id,
@@ -206,8 +221,8 @@ const TextField = React__namespace.forwardRef(
206
221
  className: getContainerClassName(size, error, disabled, action != null),
207
222
  onMouseDown: handleContainerMouseDown,
208
223
  children: [
209
- /* @__PURE__ */ jsxRuntime.jsx(LeadingIcon, { size: leftIconSize, children: leftIcon }),
210
- /* @__PURE__ */ jsxRuntime.jsx(SideLabel, { id: leftLabelId, size, align: "left", children: leftLabel }),
224
+ /* @__PURE__ */ jsxRuntime.jsx(LeadingIcon, { size: leftIconSize, disabled, children: leftIcon }),
225
+ /* @__PURE__ */ jsxRuntime.jsx(SideLabel, { id: leftLabelId, size, align: "left", disabled, children: leftLabel }),
211
226
  /* @__PURE__ */ jsxRuntime.jsx(
212
227
  "input",
213
228
  {
@@ -217,15 +232,15 @@ const TextField = React__namespace.forwardRef(
217
232
  "aria-describedby": describedBy,
218
233
  "aria-invalid": error || void 0,
219
234
  className: cn.cn(
220
- "h-full min-w-0 flex-1 bg-transparent text-content-primary no-underline placeholder:text-content-tertiary focus:outline-none disabled:cursor-not-allowed",
235
+ "h-full min-w-0 flex-1 bg-transparent text-content-primary no-underline placeholder:text-content-tertiary focus:outline-none disabled:cursor-not-allowed theme-v2:disabled:text-content-disabled theme-v2:disabled:placeholder:text-content-disabled",
221
236
  INPUT_TYPOGRAPHY[size],
222
237
  "[&[type='search']::-webkit-search-cancel-button]:hidden [&[type='search']::-webkit-search-cancel-button]:appearance-none"
223
238
  ),
224
239
  ...props
225
240
  }
226
241
  ),
227
- /* @__PURE__ */ jsxRuntime.jsx(SideLabel, { id: rightLabelId, size, align: "right", children: rightLabel }),
228
- /* @__PURE__ */ jsxRuntime.jsx(TrailingAdornment, { rightIcon, validated }),
242
+ /* @__PURE__ */ jsxRuntime.jsx(SideLabel, { id: rightLabelId, size, align: "right", disabled, children: rightLabel }),
243
+ /* @__PURE__ */ jsxRuntime.jsx(TrailingAdornment, { rightIcon, validated, disabled }),
229
244
  action != null && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-tf-interactive": "", className: "flex shrink-0 items-center", children: action })
230
245
  ]
231
246
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.cjs","sources":["../../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { CheckOutlineIcon } from \"@/index\";\nimport { cn } from \"../../utils/cn\";\n\n/** Text field height in pixels. */\nexport type TextFieldSize = \"48\" | \"40\" | \"32\";\n\nexport interface TextFieldProps\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\" | \"prefix\"> {\n /** Label text displayed above the input. Also used as the accessible name. */\n label?: string;\n /** Helper text displayed below the input. Replaced by `errorMessage` when `error` is `true`. */\n helperText?: string;\n /** Height of the text field in pixels. @default \"48\" */\n size?: TextFieldSize;\n /** Whether the text field is in an error state. @default false */\n error?: boolean;\n /** Error message displayed below the input. Shown instead of `helperText` when `error` is `true`. */\n errorMessage?: string;\n /** Whether the text field is validated. @default false */\n validated?: boolean;\n /** Icon element displayed at the left side of the input. */\n leftIcon?: React.ReactNode;\n /** Size in pixels of the slot that holds `leftIcon`. @default \"16\" */\n leftIconSize?: \"16\" | \"24\";\n /** Icon element displayed at the right side of the input. */\n rightIcon?: React.ReactNode;\n /** Fixed, non-editable label pinned inside the left edge of the field — for a prefix such as a currency symbol or country code. */\n leftLabel?: React.ReactNode;\n /** Fixed, non-editable label pinned inside the right edge of the field — for a unit or suffix such as a currency code or domain. */\n rightLabel?: React.ReactNode;\n /**\n * Trailing interactive element pinned to the right edge — typically a `Chip`\n * or `Button` (the \"with button\" field type). Reduces the right padding so the\n * control sits flush, and clicks on it do not steal focus from the input.\n */\n action?: React.ReactNode;\n /** Whether the text field stretches to fill its container width. @default false */\n fullWidth?: boolean;\n}\n\nconst CONTAINER_HEIGHT: Record<TextFieldSize, string> = {\n \"48\": \"h-12\",\n \"40\": \"h-10\",\n \"32\": \"h-8\",\n};\n\nconst CONTAINER_PADDING_X: Record<TextFieldSize, string> = {\n \"48\": \"px-4\",\n \"40\": \"px-4\",\n \"32\": \"px-3\",\n};\n\nconst CONTAINER_PADDING_X_WITH_ACTION: Record<TextFieldSize, string> = {\n \"48\": \"pl-4 pr-2\",\n \"40\": \"pl-4 pr-2\",\n \"32\": \"pl-3 pr-2\",\n};\n\nconst CONTAINER_GAP: Record<TextFieldSize, string> = {\n \"48\": \"gap-2.5\",\n \"40\": \"gap-2.5\",\n \"32\": \"gap-2\",\n};\n\nconst INPUT_TYPOGRAPHY: Record<TextFieldSize, string> = {\n \"48\": \"typography-body-default-16px-regular autofill-body-lg\",\n \"40\": \"typography-body-default-16px-regular autofill-body-lg\",\n \"32\": \"typography-body-small-14px-regular autofill-body-md\",\n};\n\nconst SIDE_LABEL_TYPOGRAPHY: Record<TextFieldSize, string> = {\n \"48\": \"typography-body-default-16px-regular\",\n \"40\": \"typography-body-default-16px-regular\",\n \"32\": \"typography-body-small-14px-regular\",\n};\n\nfunction getContainerClassName(\n size: TextFieldSize,\n error: boolean,\n disabled?: boolean,\n hasAction?: boolean,\n) {\n return cn(\n \"relative flex items-center overflow-hidden rounded-sm border bg-inputs-inputs-primary after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] has-focus-visible:outline-none has-focus-visible:after:shadow-focus-ring motion-safe:transition-colors\",\n hasAction ? CONTAINER_PADDING_X_WITH_ACTION[size] : CONTAINER_PADDING_X[size],\n CONTAINER_GAP[size],\n error ? \"border-error-content\" : \"border-border-primary\",\n !disabled && !error && \"hover:border-neutral-alphas-400\",\n CONTAINER_HEIGHT[size],\n disabled && \"opacity-50\",\n );\n}\n\nfunction LeadingIcon({\n size = \"16\",\n children,\n}: {\n size?: \"16\" | \"24\";\n children?: React.ReactNode;\n}) {\n if (!children) return null;\n return (\n <span\n className={cn(\n \"pointer-events-none flex shrink-0 items-center justify-center text-content-secondary\",\n size === \"24\" ? \"size-6\" : \"size-4\",\n )}\n >\n {children}\n </span>\n );\n}\n\nfunction SideLabel({\n id,\n size,\n align,\n children,\n}: {\n id?: string;\n size: TextFieldSize;\n align: \"left\" | \"right\";\n children?: React.ReactNode;\n}) {\n if (!children) return null;\n return (\n <span\n id={id}\n className={cn(\n \"shrink-0 select-none whitespace-nowrap text-content-tertiary\",\n align === \"right\" && \"text-right\",\n SIDE_LABEL_TYPOGRAPHY[size],\n )}\n >\n {children}\n </span>\n );\n}\n\nfunction TrailingAdornment({\n rightIcon,\n validated,\n}: {\n rightIcon?: React.ReactNode;\n validated: boolean;\n}) {\n if (!rightIcon && !validated) return null;\n return (\n <span className=\"flex shrink-0 items-center gap-2 text-content-secondary\">\n {rightIcon && (\n <span data-tf-interactive=\"\" className=\"flex size-4 shrink-0 items-center justify-center\">\n {rightIcon}\n </span>\n )}\n {validated && (\n <span className=\"pointer-events-none flex size-4 shrink-0 items-center justify-center\">\n <CheckOutlineIcon className=\"text-success-content\" />\n </span>\n )}\n </span>\n );\n}\n\nfunction TextFieldHelperText({\n id,\n error,\n children,\n}: {\n id: string;\n error: boolean;\n children: React.ReactNode;\n}) {\n return (\n <p\n id={id}\n className={cn(\n \"typography-description-12px-regular pt-2\",\n error ? \"text-error-content\" : \"text-content-tertiary\",\n )}\n >\n {children}\n </p>\n );\n}\n\nfunction warnMissingAccessibleName(label?: string, ariaLabel?: string, ariaLabelledBy?: string) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn(\n \"TextField: no accessible name provided. Pass a `label`, `aria-label`, or `aria-labelledby` prop.\",\n );\n }\n }\n}\n\n/**\n * A text input field with optional label, helper/error text, icon slots, and side labels.\n *\n * Use `leftLabel` / `rightLabel` for fixed unit or prefix affordances (currency symbol,\n * country code, domain suffix). Provide at least one of `label`, `aria-label`, or\n * `aria-labelledby` for accessibility — a console warning is emitted in development if none are set.\n *\n * @example\n * ```tsx\n * <TextField\n * label=\"Email\"\n * placeholder=\"you@example.com\"\n * error={!!emailError}\n * errorMessage={emailError}\n * />\n * ```\n *\n * @example\n * ```tsx\n * <TextField label=\"Price\" leftLabel=\"$\" rightLabel=\"USD\" placeholder=\"0.00\" />\n * ```\n *\n * @example\n * ```tsx\n * <TextField\n * label=\"Promo code\"\n * placeholder=\"Enter code\"\n * action={<Chip size=\"32\" onClick={apply}>Apply</Chip>}\n * />\n * ```\n */\nexport const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(\n (\n {\n label,\n helperText,\n size = \"48\",\n error = false,\n errorMessage,\n validated = false,\n leftIcon,\n leftIconSize,\n rightIcon,\n leftLabel,\n rightLabel,\n action,\n className,\n id,\n disabled,\n fullWidth = false,\n ...props\n },\n ref,\n ) => {\n const generatedId = React.useId();\n const inputId = id || generatedId;\n const helperTextId = `${inputId}-helper`;\n const leftLabelId = `${inputId}-left-label`;\n const rightLabelId = `${inputId}-right-label`;\n const bottomText = error && errorMessage ? errorMessage : helperText;\n\n const describedBy =\n [\n leftLabel != null ? leftLabelId : null,\n rightLabel != null ? rightLabelId : null,\n bottomText ? helperTextId : null,\n ]\n .filter(Boolean)\n .join(\" \") || undefined;\n\n const innerRef = React.useRef<HTMLInputElement>(null);\n const setRefs = React.useCallback(\n (node: HTMLInputElement | null) => {\n innerRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLInputElement | null>).current = node;\n },\n [ref],\n );\n\n // Keep clicks on the non-interactive adornments (icons, side labels, padding)\n // focusing the input, matching the old absolute/pointer-events-none layout.\n const handleContainerMouseDown = (event: React.MouseEvent<HTMLDivElement>) => {\n if (disabled) return;\n const target = event.target as HTMLElement;\n if (target === innerRef.current) return;\n if (target.closest(\"[data-tf-interactive]\")) return;\n event.preventDefault();\n innerRef.current?.focus();\n };\n\n warnMissingAccessibleName(label, props[\"aria-label\"], props[\"aria-labelledby\"]);\n\n return (\n <div\n className={cn(\"flex flex-col\", fullWidth && \"w-full\", className)}\n data-disabled={disabled ? \"\" : undefined}\n data-error={error ? \"\" : undefined}\n >\n {label && (\n <label\n htmlFor={inputId}\n className=\"typography-description-12px-semibold pb-2 text-content-primary\"\n >\n {label}\n </label>\n )}\n\n {/* biome-ignore lint/a11y/noStaticElementInteractions: focus bridge delegates pointer clicks on adornments to the input */}\n <div\n className={getContainerClassName(size, error, disabled, action != null)}\n onMouseDown={handleContainerMouseDown}\n >\n <LeadingIcon size={leftIconSize}>{leftIcon}</LeadingIcon>\n <SideLabel id={leftLabelId} size={size} align=\"left\">\n {leftLabel}\n </SideLabel>\n\n <input\n ref={setRefs}\n id={inputId}\n disabled={disabled}\n aria-describedby={describedBy}\n aria-invalid={error || undefined}\n className={cn(\n \"h-full min-w-0 flex-1 bg-transparent text-content-primary no-underline placeholder:text-content-tertiary focus:outline-none disabled:cursor-not-allowed\",\n INPUT_TYPOGRAPHY[size],\n \"[&[type='search']::-webkit-search-cancel-button]:hidden [&[type='search']::-webkit-search-cancel-button]:appearance-none\",\n )}\n {...props}\n />\n\n <SideLabel id={rightLabelId} size={size} align=\"right\">\n {rightLabel}\n </SideLabel>\n <TrailingAdornment rightIcon={rightIcon} validated={validated} />\n {action != null && (\n <span data-tf-interactive=\"\" className=\"flex shrink-0 items-center\">\n {action}\n </span>\n )}\n </div>\n\n {bottomText && (\n <TextFieldHelperText id={helperTextId} error={error}>\n {bottomText}\n </TextFieldHelperText>\n )}\n </div>\n );\n },\n);\n\nTextField.displayName = \"TextField\";\n"],"names":["cn","jsx","jsxs","CheckOutlineIcon","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAM,mBAAkD;AAAA,EACtD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,sBAAqD;AAAA,EACzD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,kCAAiE;AAAA,EACrE,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,gBAA+C;AAAA,EACnD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,mBAAkD;AAAA,EACtD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,wBAAuD;AAAA,EAC3D,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,SAAS,sBACP,MACA,OACA,UACA,WACA;AACA,SAAOA,GAAAA;AAAAA,IACL;AAAA,IACA,YAAY,gCAAgC,IAAI,IAAI,oBAAoB,IAAI;AAAA,IAC5E,cAAc,IAAI;AAAA,IAClB,QAAQ,yBAAyB;AAAA,IACjC,CAAC,YAAY,CAAC,SAAS;AAAA,IACvB,iBAAiB,IAAI;AAAA,IACrB,YAAY;AAAA,EAAA;AAEhB;AAEA,SAAS,YAAY;AAAA,EACnB,OAAO;AAAA,EACP;AACF,GAGG;AACD,MAAI,CAAC,SAAU,QAAO;AACtB,SACEC,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":["../../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { CheckOutlineIcon } from \"@/index\";\nimport { cn } from \"../../utils/cn\";\nimport {\n INPUT_FIELD_DISABLED_CLASSES,\n INPUT_FIELD_V2_FOCUS_CLASSES,\n} from \"../../utils/inputFieldClasses\";\n\n/** Text field height in pixels. */\nexport type TextFieldSize = \"48\" | \"40\" | \"32\";\n\nexport interface TextFieldProps\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\" | \"prefix\"> {\n /** Label text displayed above the input. Also used as the accessible name. */\n label?: string;\n /** Helper text displayed below the input. Replaced by `errorMessage` when `error` is `true`. */\n helperText?: string;\n /** Height of the text field in pixels. @default \"48\" */\n size?: TextFieldSize;\n /** Whether the text field is in an error state. @default false */\n error?: boolean;\n /** Error message displayed below the input. Shown instead of `helperText` when `error` is `true`. */\n errorMessage?: string;\n /** Whether the text field is validated. @default false */\n validated?: boolean;\n /** Icon element displayed at the left side of the input. */\n leftIcon?: React.ReactNode;\n /** Size in pixels of the slot that holds `leftIcon`. @default \"16\" */\n leftIconSize?: \"16\" | \"24\";\n /** Icon element displayed at the right side of the input. */\n rightIcon?: React.ReactNode;\n /** Fixed, non-editable label pinned inside the left edge of the field — for a prefix such as a currency symbol or country code. */\n leftLabel?: React.ReactNode;\n /** Fixed, non-editable label pinned inside the right edge of the field — for a unit or suffix such as a currency code or domain. */\n rightLabel?: React.ReactNode;\n /**\n * Trailing interactive element pinned to the right edge — typically a `Chip`\n * or `Button` (the \"with button\" field type). Reduces the right padding so the\n * control sits flush, and clicks on it do not steal focus from the input.\n */\n action?: React.ReactNode;\n /** Whether the text field stretches to fill its container width. @default false */\n fullWidth?: boolean;\n}\n\nconst CONTAINER_HEIGHT: Record<TextFieldSize, string> = {\n \"48\": \"h-12\",\n \"40\": \"h-10\",\n \"32\": \"h-8\",\n};\n\nconst CONTAINER_PADDING_X: Record<TextFieldSize, string> = {\n \"48\": \"px-4\",\n \"40\": \"px-4\",\n \"32\": \"px-3\",\n};\n\nconst CONTAINER_PADDING_X_WITH_ACTION: Record<TextFieldSize, string> = {\n \"48\": \"pl-4 pr-2\",\n \"40\": \"pl-4 pr-2\",\n \"32\": \"pl-3 pr-2\",\n};\n\nconst CONTAINER_GAP: Record<TextFieldSize, string> = {\n \"48\": \"gap-2.5\",\n \"40\": \"gap-2.5\",\n \"32\": \"gap-2\",\n};\n\nconst INPUT_TYPOGRAPHY: Record<TextFieldSize, string> = {\n \"48\": \"typography-body-default-16px-regular autofill-body-lg\",\n \"40\": \"typography-body-default-16px-regular autofill-body-lg\",\n \"32\": \"typography-body-small-14px-regular autofill-body-md\",\n};\n\nconst SIDE_LABEL_TYPOGRAPHY: Record<TextFieldSize, string> = {\n \"48\": \"typography-body-default-16px-regular\",\n \"40\": \"typography-body-default-16px-regular\",\n \"32\": \"typography-body-small-14px-regular\",\n};\n\nfunction getContainerClassName(\n size: TextFieldSize,\n error: boolean,\n disabled?: boolean,\n hasAction?: boolean,\n) {\n return cn(\n \"relative flex items-center overflow-hidden rounded-sm border bg-inputs-inputs-primary after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] has-focus-visible:outline-none has-focus-visible:after:shadow-focus-ring motion-safe:transition-colors\",\n hasAction ? CONTAINER_PADDING_X_WITH_ACTION[size] : CONTAINER_PADDING_X[size],\n CONTAINER_GAP[size],\n error ? \"border-error-content\" : [\"border-border-input\", INPUT_FIELD_V2_FOCUS_CLASSES],\n !disabled && !error && \"hover:border-border-input-hover\",\n CONTAINER_HEIGHT[size],\n disabled && INPUT_FIELD_DISABLED_CLASSES,\n );\n}\n\nfunction LeadingIcon({\n size = \"16\",\n disabled,\n children,\n}: {\n size?: \"16\" | \"24\";\n disabled?: boolean;\n children?: React.ReactNode;\n}) {\n if (!children) return null;\n return (\n <span\n className={cn(\n \"pointer-events-none flex shrink-0 items-center justify-center text-content-secondary\",\n size === \"24\" ? \"size-6\" : \"size-4\",\n disabled && \"theme-v2:text-icons-disabled\",\n )}\n >\n {children}\n </span>\n );\n}\n\nfunction SideLabel({\n id,\n size,\n align,\n disabled,\n children,\n}: {\n id?: string;\n size: TextFieldSize;\n align: \"left\" | \"right\";\n disabled?: boolean;\n children?: React.ReactNode;\n}) {\n if (!children) return null;\n return (\n <span\n id={id}\n className={cn(\n \"shrink-0 select-none whitespace-nowrap text-content-tertiary\",\n align === \"right\" && \"text-right\",\n SIDE_LABEL_TYPOGRAPHY[size],\n disabled && \"theme-v2:text-content-disabled\",\n )}\n >\n {children}\n </span>\n );\n}\n\nfunction TrailingAdornment({\n rightIcon,\n validated,\n disabled,\n}: {\n rightIcon?: React.ReactNode;\n validated: boolean;\n disabled?: boolean;\n}) {\n if (!rightIcon && !validated) return null;\n return (\n <span\n className={cn(\n \"flex shrink-0 items-center gap-2 text-content-secondary\",\n disabled && \"theme-v2:text-icons-disabled\",\n )}\n >\n {rightIcon && (\n <span data-tf-interactive=\"\" className=\"flex size-4 shrink-0 items-center justify-center\">\n {rightIcon}\n </span>\n )}\n {validated && (\n <span className=\"pointer-events-none flex size-4 shrink-0 items-center justify-center\">\n <CheckOutlineIcon className=\"text-success-content\" />\n </span>\n )}\n </span>\n );\n}\n\nfunction TextFieldHelperText({\n id,\n error,\n children,\n}: {\n id: string;\n error: boolean;\n children: React.ReactNode;\n}) {\n return (\n <p\n id={id}\n className={cn(\n \"typography-description-12px-regular pt-2\",\n error ? \"text-error-content\" : \"text-content-tertiary\",\n )}\n >\n {children}\n </p>\n );\n}\n\nfunction warnMissingAccessibleName(label?: string, ariaLabel?: string, ariaLabelledBy?: string) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn(\n \"TextField: no accessible name provided. Pass a `label`, `aria-label`, or `aria-labelledby` prop.\",\n );\n }\n }\n}\n\n/**\n * A text input field with optional label, helper/error text, icon slots, and side labels.\n *\n * Use `leftLabel` / `rightLabel` for fixed unit or prefix affordances (currency symbol,\n * country code, domain suffix). Provide at least one of `label`, `aria-label`, or\n * `aria-labelledby` for accessibility — a console warning is emitted in development if none are set.\n *\n * @example\n * ```tsx\n * <TextField\n * label=\"Email\"\n * placeholder=\"you@example.com\"\n * error={!!emailError}\n * errorMessage={emailError}\n * />\n * ```\n *\n * @example\n * ```tsx\n * <TextField label=\"Price\" leftLabel=\"$\" rightLabel=\"USD\" placeholder=\"0.00\" />\n * ```\n *\n * @example\n * ```tsx\n * <TextField\n * label=\"Promo code\"\n * placeholder=\"Enter code\"\n * action={<Chip size=\"32\" onClick={apply}>Apply</Chip>}\n * />\n * ```\n */\nexport const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(\n (\n {\n label,\n helperText,\n size = \"48\",\n error = false,\n errorMessage,\n validated = false,\n leftIcon,\n leftIconSize,\n rightIcon,\n leftLabel,\n rightLabel,\n action,\n className,\n id,\n disabled,\n fullWidth = false,\n ...props\n },\n ref,\n ) => {\n const generatedId = React.useId();\n const inputId = id || generatedId;\n const helperTextId = `${inputId}-helper`;\n const leftLabelId = `${inputId}-left-label`;\n const rightLabelId = `${inputId}-right-label`;\n const bottomText = error && errorMessage ? errorMessage : helperText;\n\n const describedBy =\n [\n leftLabel != null ? leftLabelId : null,\n rightLabel != null ? rightLabelId : null,\n bottomText ? helperTextId : null,\n ]\n .filter(Boolean)\n .join(\" \") || undefined;\n\n const innerRef = React.useRef<HTMLInputElement>(null);\n const setRefs = React.useCallback(\n (node: HTMLInputElement | null) => {\n innerRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLInputElement | null>).current = node;\n },\n [ref],\n );\n\n // Keep clicks on the non-interactive adornments (icons, side labels, padding)\n // focusing the input, matching the old absolute/pointer-events-none layout.\n const handleContainerMouseDown = (event: React.MouseEvent<HTMLDivElement>) => {\n if (disabled) return;\n const target = event.target as HTMLElement;\n if (target === innerRef.current) return;\n if (target.closest(\"[data-tf-interactive]\")) return;\n event.preventDefault();\n innerRef.current?.focus();\n };\n\n warnMissingAccessibleName(label, props[\"aria-label\"], props[\"aria-labelledby\"]);\n\n return (\n <div\n className={cn(\"flex flex-col\", fullWidth && \"w-full\", className)}\n data-disabled={disabled ? \"\" : undefined}\n data-error={error ? \"\" : undefined}\n >\n {label && (\n <label\n htmlFor={inputId}\n className=\"typography-description-12px-semibold pb-2 text-content-primary\"\n >\n {label}\n </label>\n )}\n\n {/* biome-ignore lint/a11y/noStaticElementInteractions: focus bridge delegates pointer clicks on adornments to the input */}\n <div\n className={getContainerClassName(size, error, disabled, action != null)}\n onMouseDown={handleContainerMouseDown}\n >\n <LeadingIcon size={leftIconSize} disabled={disabled}>\n {leftIcon}\n </LeadingIcon>\n <SideLabel id={leftLabelId} size={size} align=\"left\" disabled={disabled}>\n {leftLabel}\n </SideLabel>\n\n <input\n ref={setRefs}\n id={inputId}\n disabled={disabled}\n aria-describedby={describedBy}\n aria-invalid={error || undefined}\n className={cn(\n \"h-full min-w-0 flex-1 bg-transparent text-content-primary no-underline placeholder:text-content-tertiary focus:outline-none disabled:cursor-not-allowed theme-v2:disabled:text-content-disabled theme-v2:disabled:placeholder:text-content-disabled\",\n INPUT_TYPOGRAPHY[size],\n \"[&[type='search']::-webkit-search-cancel-button]:hidden [&[type='search']::-webkit-search-cancel-button]:appearance-none\",\n )}\n {...props}\n />\n\n <SideLabel id={rightLabelId} size={size} align=\"right\" disabled={disabled}>\n {rightLabel}\n </SideLabel>\n <TrailingAdornment rightIcon={rightIcon} validated={validated} disabled={disabled} />\n {action != null && (\n <span data-tf-interactive=\"\" className=\"flex shrink-0 items-center\">\n {action}\n </span>\n )}\n </div>\n\n {bottomText && (\n <TextFieldHelperText id={helperTextId} error={error}>\n {bottomText}\n </TextFieldHelperText>\n )}\n </div>\n );\n },\n);\n\nTextField.displayName = \"TextField\";\n"],"names":["cn","INPUT_FIELD_V2_FOCUS_CLASSES","INPUT_FIELD_DISABLED_CLASSES","jsx","jsxs","CheckOutlineIcon","React"],"mappings":";;;;;;;;;;;;;;;;;;;;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AA,cAET,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAKLC,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW,sBAAsB,MAAM,OAAO,UAAU,UAAU,IAAI;AAAA,cACtE,aAAa;AAAA,cAEb,UAAA;AAAA,gBAAAD,2BAAAA,IAAC,aAAA,EAAY,MAAM,cAAc,UAC9B,UAAA,UACH;AAAA,gBACAA,2BAAAA,IAAC,aAAU,IAAI,aAAa,MAAY,OAAM,QAAO,UAClD,UAAA,UAAA,CACH;AAAA,gBAEAA,2BAAAA;AAAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,KAAK;AAAA,oBACL,IAAI;AAAA,oBACJ;AAAA,oBACA,oBAAkB;AAAA,oBAClB,gBAAc,SAAS;AAAA,oBACvB,WAAWH,GAAAA;AAAAA,sBACT;AAAA,sBACA,iBAAiB,IAAI;AAAA,sBACrB;AAAA,oBAAA;AAAA,oBAED,GAAG;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAGNG,2BAAAA,IAAC,aAAU,IAAI,cAAc,MAAY,OAAM,SAAQ,UACpD,UAAA,WAAA,CACH;AAAA,gBACAA,2BAAAA,IAAC,mBAAA,EAAkB,WAAsB,WAAsB,SAAA,CAAoB;AAAA,gBAClF,UAAU,QACTA,+BAAC,QAAA,EAAK,uBAAoB,IAAG,WAAU,8BACpC,UAAA,OAAA,CACH;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAIH,cACCA,2BAAAA,IAAC,qBAAA,EAAoB,IAAI,cAAc,OACpC,UAAA,WAAA,CACH;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,UAAU,cAAc;;"}
@@ -240,6 +240,7 @@ const Pagination = require("./components/Pagination/Pagination.cjs");
240
240
  const PasswordField = require("./components/PasswordField/PasswordField.cjs");
241
241
  const PhoneField = require("./components/PhoneField/PhoneField.cjs");
242
242
  const Pill = require("./components/Pill/Pill.cjs");
243
+ const Popover = require("./components/Popover/Popover.cjs");
243
244
  const ProfileOnlineStatus = require("./components/ProfileOnlineStatus/ProfileOnlineStatus.cjs");
244
245
  const ProfileStatus = require("./components/ProfileStatus/ProfileStatus.cjs");
245
246
  const ProgressBar = require("./components/ProgressBar/ProgressBar.cjs");
@@ -272,6 +273,7 @@ const TabsList = require("./components/Tabs/TabsList.cjs");
272
273
  const TabsListSkeleton = require("./components/Tabs/TabsListSkeleton.cjs");
273
274
  const TabsOverflow = require("./components/Tabs/TabsOverflow.cjs");
274
275
  const TabsTrigger = require("./components/Tabs/TabsTrigger.cjs");
276
+ const Tag = require("./components/Tag/Tag.cjs");
275
277
  const TextArea = require("./components/TextArea/TextArea.cjs");
276
278
  const TextField = require("./components/TextField/TextField.cjs");
277
279
  const Toast = require("./components/Toast/Toast.cjs");
@@ -576,6 +578,11 @@ exports.Pagination = Pagination.Pagination;
576
578
  exports.PasswordField = PasswordField.PasswordField;
577
579
  exports.PhoneField = PhoneField.PhoneField;
578
580
  exports.Pill = Pill.Pill;
581
+ exports.Popover = Popover.Popover;
582
+ exports.PopoverAnchor = Popover.PopoverAnchor;
583
+ exports.PopoverClose = Popover.PopoverClose;
584
+ exports.PopoverContent = Popover.PopoverContent;
585
+ exports.PopoverTrigger = Popover.PopoverTrigger;
579
586
  exports.ProfileOnlineStatus = ProfileOnlineStatus.ProfileOnlineStatus;
580
587
  exports.ProfileStatus = ProfileStatus.ProfileStatus;
581
588
  exports.ProgressBar = ProgressBar.ProgressBar;
@@ -638,6 +645,7 @@ exports.TabsListSkeleton = TabsListSkeleton.TabsListSkeleton;
638
645
  exports.TabsOverflow = TabsOverflow.TabsOverflow;
639
646
  exports.TabsOverflowItem = TabsOverflow.TabsOverflowItem;
640
647
  exports.TabsTrigger = TabsTrigger.TabsTrigger;
648
+ exports.Tag = Tag.Tag;
641
649
  exports.TextArea = TextArea.TextArea;
642
650
  exports.TextField = TextField.TextField;
643
651
  exports.Toast = Toast.Toast;
@@ -1 +1 @@
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const FLOATING_CONTENT_SURFACE_CLASS = "rounded-md border border-border-strong bg-modal-background text-content-primary shadow-blur-menu backdrop-blur-xs theme-v2:border-modal-stroke";
5
+ const FLOATING_CONTENT_Z_INDEX = "var(--fanvue-ui-portal-z-index, 50)";
6
+ exports.FLOATING_CONTENT_SURFACE_CLASS = FLOATING_CONTENT_SURFACE_CLASS;
7
+ exports.FLOATING_CONTENT_Z_INDEX = FLOATING_CONTENT_Z_INDEX;
8
+ //# sourceMappingURL=floatingContentSurface.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"floatingContentSurface.cjs","sources":["../../../src/utils/floatingContentSurface.ts"],"sourcesContent":["/**\n * Surface shared by the floating panels: dropdown menu, select list and popover. Each component\n * keeps its own layout, padding, width and animation; this is only what makes them look like one\n * surface, so a change here reaches all three.\n *\n * The tokens come from `V2 Menu Dropdown` (library node `17245:2317`): `rounded-md` (16px) over\n * `Modal/Background`, a `Border/Strong` stroke (`Modal/Stroke` under the v2 palette), and the\n * `blur + shadow/menu` effect. `Modal/Background` resolves to `Background/Secondary` in the\n * current palette. `backdrop-blur-xs` (4px) is the CSS equivalent of that effect's\n * BACKGROUND_BLUR radius 8, which Figma halves on export. It is not a 4-against-8 mismatch.\n */\nexport const FLOATING_CONTENT_SURFACE_CLASS =\n \"rounded-md border border-border-strong bg-modal-background text-content-primary shadow-blur-menu backdrop-blur-xs theme-v2:border-modal-stroke\";\n\n/** Stacking order for portal-rendered panels. Apps override it with `--fanvue-ui-portal-z-index`. */\nexport const FLOATING_CONTENT_Z_INDEX = \"var(--fanvue-ui-portal-z-index, 50)\";\n"],"names":[],"mappings":";;;AAWO,MAAM,iCACX;AAGK,MAAM,2BAA2B;;;"}
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const INPUT_FIELD_V2_FOCUS_CLASSES = "theme-v2:has-focus-visible:border-border-selected theme-v2:has-focus-visible:after:shadow-none";
5
+ const INPUT_FIELD_DISABLED_CLASSES = "theme-v2:border-transparent theme-v2:bg-inputs-inputs-disabled opacity-50 theme-v2:opacity-100";
6
+ exports.INPUT_FIELD_DISABLED_CLASSES = INPUT_FIELD_DISABLED_CLASSES;
7
+ exports.INPUT_FIELD_V2_FOCUS_CLASSES = INPUT_FIELD_V2_FOCUS_CLASSES;
8
+ //# sourceMappingURL=inputFieldClasses.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inputFieldClasses.cjs","sources":["../../../src/utils/inputFieldClasses.ts"],"sourcesContent":["/**\n * Focus treatment for a text-input container under the v2 palette: a 1px\n * `Border/Selected` stroke in place of the inset focus ring. Shared by TextField,\n * TextArea, PhoneField and Autocomplete so the four containers cannot drift.\n */\nexport const INPUT_FIELD_V2_FOCUS_CLASSES =\n \"theme-v2:has-focus-visible:border-border-selected theme-v2:has-focus-visible:after:shadow-none\";\n\n/**\n * Disabled treatment for a text-input container. The current palette fades the\n * field to 50% opacity; the v2 palette takes the Figma Disabled state instead: no\n * border, `Inputs/Inputs Disabled` fill, full opacity.\n */\nexport const INPUT_FIELD_DISABLED_CLASSES =\n \"theme-v2:border-transparent theme-v2:bg-inputs-inputs-disabled opacity-50 theme-v2:opacity-100\";\n"],"names":[],"mappings":";;;AAKO,MAAM,+BACX;AAOK,MAAM,+BACX;;;"}
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const capturePointer = (element, pointerId) => {
5
+ try {
6
+ element.setPointerCapture?.(pointerId);
7
+ } catch {
8
+ return;
9
+ }
10
+ };
11
+ const releasePointer = (element, pointerId) => {
12
+ try {
13
+ element.releasePointerCapture?.(pointerId);
14
+ } catch {
15
+ return;
16
+ }
17
+ };
18
+ exports.capturePointer = capturePointer;
19
+ exports.releasePointer = releasePointer;
20
+ //# sourceMappingURL=pointerCapture.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pointerCapture.cjs","sources":["../../../src/utils/pointerCapture.ts"],"sourcesContent":["export const capturePointer = (element: Element, pointerId: number) => {\n try {\n element.setPointerCapture?.(pointerId);\n } catch {\n return;\n }\n};\n\nexport const releasePointer = (element: Element, pointerId: number) => {\n try {\n element.releasePointerCapture?.(pointerId);\n } catch {\n return;\n }\n};\n"],"names":[],"mappings":";;;AAAO,MAAM,iBAAiB,CAAC,SAAkB,cAAsB;AACrE,MAAI;AACF,YAAQ,oBAAoB,SAAS;AAAA,EACvC,QAAQ;AACN;AAAA,EACF;AACF;AAEO,MAAM,iBAAiB,CAAC,SAAkB,cAAsB;AACrE,MAAI;AACF,YAAQ,wBAAwB,SAAS;AAAA,EAC3C,QAAQ;AACN;AAAA,EACF;AACF;;;"}
@@ -2,6 +2,7 @@
2
2
  "use strict";
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  const React = require("react");
5
+ const pointerCapture = require("./pointerCapture.cjs");
5
6
  const usePrefersReducedMotion = require("./usePrefersReducedMotion.cjs");
6
7
  function _interopNamespaceDefault(e) {
7
8
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -63,7 +64,7 @@ function useDragToDismiss({ enabled, onDismiss, media }, props) {
63
64
  const release = (drag, dismiss) => {
64
65
  dragRef.current = null;
65
66
  drag.stopBlockingTouchScroll();
66
- drag.element.releasePointerCapture?.(drag.pointerId);
67
+ pointerCapture.releasePointer(drag.element, drag.pointerId);
67
68
  if (!drag.dragging) return;
68
69
  if (!dismiss) {
69
70
  snapBack(drag.element);
@@ -112,7 +113,7 @@ function useDragToDismiss({ enabled, onDismiss, media }, props) {
112
113
  return;
113
114
  }
114
115
  drag.dragging = true;
115
- drag.element.setPointerCapture?.(event.pointerId);
116
+ pointerCapture.capturePointer(drag.element, event.pointerId);
116
117
  drag.element.style.transition = "none";
117
118
  }
118
119
  const elapsed = event.timeStamp - drag.lastTime;
@@ -1 +1 @@
1
- {"version":3,"file":"useDragToDismiss.cjs","sources":["../../../src/utils/useDragToDismiss.ts"],"sourcesContent":["import * as React from \"react\";\nimport { usePrefersReducedMotion } from \"./usePrefersReducedMotion\";\n\nconst DRAG_START_THRESHOLD_PX = 8;\nconst DISMISS_DISTANCE_RATIO = 0.25;\nconst DISMISS_VELOCITY_PX_PER_MS = 0.5;\nconst FLICK_WINDOW_MS = 100;\nconst SNAP_BACK_TRANSITION = \"transform 200ms ease-out\";\nconst NON_DRAGGABLE_TARGETS = \"input, textarea, select, [contenteditable='true']\";\n\n/**\n * Whether a released sheet drag should dismiss the sheet: past a quarter of\n * the sheet's height, or a fast downward flick at any distance.\n */\nexport function shouldDismissDrag({\n offset,\n height,\n velocity,\n}: {\n offset: number;\n height: number;\n velocity: number;\n}): boolean {\n if (offset <= 0) return false;\n return offset >= height * DISMISS_DISTANCE_RATIO || velocity >= DISMISS_VELOCITY_PX_PER_MS;\n}\n\ntype DragHandlers = {\n onPointerDown?: React.PointerEventHandler<HTMLDivElement>;\n onPointerMove?: React.PointerEventHandler<HTMLDivElement>;\n onPointerUp?: React.PointerEventHandler<HTMLDivElement>;\n onPointerCancel?: React.PointerEventHandler<HTMLDivElement>;\n};\n\ntype ActiveDrag = {\n pointerId: number;\n element: HTMLDivElement;\n startY: number;\n startX: number;\n lastY: number;\n lastTime: number;\n velocity: number;\n dragging: boolean;\n stopBlockingTouchScroll: () => void;\n};\n\nexport interface UseDragToDismissOptions {\n /** Whether dragging is active at all. */\n enabled: boolean;\n /** Called once a release passes the dismiss threshold. */\n onDismiss: () => void;\n /** Media query that must match for a drag to start, e.g. to limit it to mobile. */\n media?: string;\n}\n\nfunction isScrolledAwayFromTop(target: EventTarget | null, container: HTMLElement): boolean {\n let node = target instanceof HTMLElement ? target : null;\n while (node && node !== container) {\n if (node.scrollTop > 0) return true;\n node = node.parentElement;\n }\n return container.scrollTop > 0;\n}\n\nfunction blockTouchScrollWhileDragging(\n element: HTMLElement,\n getDrag: () => ActiveDrag | null,\n): () => void {\n const onTouchMove = (event: TouchEvent) => {\n const drag = getDrag();\n const touch = event.touches[0];\n if (!drag || !touch) return;\n const offset = touch.clientY - drag.startY;\n if (drag.dragging || offset > Math.abs(touch.clientX - drag.startX)) event.preventDefault();\n };\n element.addEventListener(\"touchmove\", onTouchMove, { passive: false });\n return () => element.removeEventListener(\"touchmove\", onTouchMove);\n}\n\n/**\n * Composes the consumer's pointer handlers with drag-down-to-dismiss for a\n * bottom sheet. The sheet follows the pointer downwards, and on release either\n * dismisses or snaps back. A drag never starts inside a form field or inside\n * scrollable content that is not scrolled to the top, so it does not fight\n * text selection or scrolling.\n */\nexport function useDragToDismiss<P extends DragHandlers>(\n { enabled, onDismiss, media }: UseDragToDismissOptions,\n props: P,\n): P & Required<DragHandlers> {\n const dragRef = React.useRef<ActiveDrag | null>(null);\n const prefersReducedMotion = usePrefersReducedMotion();\n\n const snapBack = (element: HTMLDivElement) => {\n element.style.transition = prefersReducedMotion ? \"\" : SNAP_BACK_TRANSITION;\n element.style.transform = \"\";\n };\n\n const release = (drag: ActiveDrag, dismiss: boolean) => {\n dragRef.current = null;\n drag.stopBlockingTouchScroll();\n drag.element.releasePointerCapture?.(drag.pointerId);\n if (!drag.dragging) return;\n if (!dismiss) {\n snapBack(drag.element);\n return;\n }\n onDismiss();\n requestAnimationFrame(() => {\n if (drag.element.isConnected && drag.element.dataset.state !== \"closed\") {\n snapBack(drag.element);\n }\n });\n };\n\n return {\n ...props,\n onPointerDown(event) {\n props.onPointerDown?.(event);\n if (!enabled || event.defaultPrevented || event.button !== 0) return;\n if (media && typeof window.matchMedia === \"function\" && !window.matchMedia(media).matches)\n return;\n const target = event.target instanceof Element ? event.target : null;\n if (target?.closest(NON_DRAGGABLE_TARGETS)) return;\n if (isScrolledAwayFromTop(event.target, event.currentTarget)) return;\n const element = event.currentTarget;\n dragRef.current = {\n pointerId: event.pointerId,\n element,\n startY: event.clientY,\n startX: event.clientX,\n lastY: event.clientY,\n lastTime: event.timeStamp,\n velocity: 0,\n dragging: false,\n stopBlockingTouchScroll: blockTouchScrollWhileDragging(element, () => dragRef.current),\n };\n },\n onPointerMove(event) {\n props.onPointerMove?.(event);\n const drag = dragRef.current;\n if (!drag || event.pointerId !== drag.pointerId) return;\n const offset = event.clientY - drag.startY;\n if (!drag.dragging) {\n const dx = Math.abs(event.clientX - drag.startX);\n if (Math.max(Math.abs(offset), dx) < DRAG_START_THRESHOLD_PX) return;\n if (offset <= dx) {\n release(drag, false);\n return;\n }\n drag.dragging = true;\n drag.element.setPointerCapture?.(event.pointerId);\n drag.element.style.transition = \"none\";\n }\n const elapsed = event.timeStamp - drag.lastTime;\n if (elapsed > 0) drag.velocity = (event.clientY - drag.lastY) / elapsed;\n drag.lastY = event.clientY;\n drag.lastTime = event.timeStamp;\n drag.element.style.transform = `translate3d(0, ${Math.max(offset, 0)}px, 0)`;\n },\n onPointerUp(event) {\n props.onPointerUp?.(event);\n const drag = dragRef.current;\n if (!drag || event.pointerId !== drag.pointerId) return;\n const dismiss = shouldDismissDrag({\n offset: event.clientY - drag.startY,\n height: drag.element.getBoundingClientRect().height,\n velocity: event.timeStamp - drag.lastTime > FLICK_WINDOW_MS ? 0 : drag.velocity,\n });\n release(drag, dismiss);\n },\n onPointerCancel(event) {\n props.onPointerCancel?.(event);\n const drag = dragRef.current;\n if (!drag || event.pointerId !== drag.pointerId) return;\n release(drag, false);\n },\n };\n}\n"],"names":["React","usePrefersReducedMotion"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM,0BAA0B;AAChC,MAAM,yBAAyB;AAC/B,MAAM,6BAA6B;AACnC,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;AAC7B,MAAM,wBAAwB;AAMvB,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AACF,GAIY;AACV,MAAI,UAAU,EAAG,QAAO;AACxB,SAAO,UAAU,SAAS,0BAA0B,YAAY;AAClE;AA8BA,SAAS,sBAAsB,QAA4B,WAAiC;AAC1F,MAAI,OAAO,kBAAkB,cAAc,SAAS;AACpD,SAAO,QAAQ,SAAS,WAAW;AACjC,QAAI,KAAK,YAAY,EAAG,QAAO;AAC/B,WAAO,KAAK;AAAA,EACd;AACA,SAAO,UAAU,YAAY;AAC/B;AAEA,SAAS,8BACP,SACA,SACY;AACZ,QAAM,cAAc,CAAC,UAAsB;AACzC,UAAM,OAAO,QAAA;AACb,UAAM,QAAQ,MAAM,QAAQ,CAAC;AAC7B,QAAI,CAAC,QAAQ,CAAC,MAAO;AACrB,UAAM,SAAS,MAAM,UAAU,KAAK;AACpC,QAAI,KAAK,YAAY,SAAS,KAAK,IAAI,MAAM,UAAU,KAAK,MAAM,EAAG,OAAM,eAAA;AAAA,EAC7E;AACA,UAAQ,iBAAiB,aAAa,aAAa,EAAE,SAAS,OAAO;AACrE,SAAO,MAAM,QAAQ,oBAAoB,aAAa,WAAW;AACnE;AASO,SAAS,iBACd,EAAE,SAAS,WAAW,MAAA,GACtB,OAC4B;AAC5B,QAAM,UAAUA,iBAAM,O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ources":["../../../src/utils/useDragToDismiss.ts"],"sourcesContent":["import * as React from \"react\";\nimport { capturePointer, releasePointer } from \"./pointerCapture\";\nimport { usePrefersReducedMotion } from \"./usePrefersReducedMotion\";\n\nconst DRAG_START_THRESHOLD_PX = 8;\nconst DISMISS_DISTANCE_RATIO = 0.25;\nconst DISMISS_VELOCITY_PX_PER_MS = 0.5;\nconst FLICK_WINDOW_MS = 100;\nconst SNAP_BACK_TRANSITION = \"transform 200ms ease-out\";\nconst NON_DRAGGABLE_TARGETS = \"input, textarea, select, [contenteditable='true']\";\n\n/**\n * Whether a released sheet drag should dismiss the sheet: past a quarter of\n * the sheet's height, or a fast downward flick at any distance.\n */\nexport function shouldDismissDrag({\n offset,\n height,\n velocity,\n}: {\n offset: number;\n height: number;\n velocity: number;\n}): boolean {\n if (offset <= 0) return false;\n return offset >= height * DISMISS_DISTANCE_RATIO || velocity >= DISMISS_VELOCITY_PX_PER_MS;\n}\n\ntype DragHandlers = {\n onPointerDown?: React.PointerEventHandler<HTMLDivElement>;\n onPointerMove?: React.PointerEventHandler<HTMLDivElement>;\n onPointerUp?: React.PointerEventHandler<HTMLDivElement>;\n onPointerCancel?: React.PointerEventHandler<HTMLDivElement>;\n};\n\ntype ActiveDrag = {\n pointerId: number;\n element: HTMLDivElement;\n startY: number;\n startX: number;\n lastY: number;\n lastTime: number;\n velocity: number;\n dragging: boolean;\n stopBlockingTouchScroll: () => void;\n};\n\nexport interface UseDragToDismissOptions {\n /** Whether dragging is active at all. */\n enabled: boolean;\n /** Called once a release passes the dismiss threshold. */\n onDismiss: () => void;\n /** Media query that must match for a drag to start, e.g. to limit it to mobile. */\n media?: string;\n}\n\nfunction isScrolledAwayFromTop(target: EventTarget | null, container: HTMLElement): boolean {\n let node = target instanceof HTMLElement ? target : null;\n while (node && node !== container) {\n if (node.scrollTop > 0) return true;\n node = node.parentElement;\n }\n return container.scrollTop > 0;\n}\n\nfunction blockTouchScrollWhileDragging(\n element: HTMLElement,\n getDrag: () => ActiveDrag | null,\n): () => void {\n const onTouchMove = (event: TouchEvent) => {\n const drag = getDrag();\n const touch = event.touches[0];\n if (!drag || !touch) return;\n const offset = touch.clientY - drag.startY;\n if (drag.dragging || offset > Math.abs(touch.clientX - drag.startX)) event.preventDefault();\n };\n element.addEventListener(\"touchmove\", onTouchMove, { passive: false });\n return () => element.removeEventListener(\"touchmove\", onTouchMove);\n}\n\n/**\n * Composes the consumer's pointer handlers with drag-down-to-dismiss for a\n * bottom sheet. The sheet follows the pointer downwards, and on release either\n * dismisses or snaps back. A drag never starts inside a form field or inside\n * scrollable content that is not scrolled to the top, so it does not fight\n * text selection or scrolling.\n */\nexport function useDragToDismiss<P extends DragHandlers>(\n { enabled, onDismiss, media }: UseDragToDismissOptions,\n props: P,\n): P & Required<DragHandlers> {\n const dragRef = React.useRef<ActiveDrag | null>(null);\n const prefersReducedMotion = usePrefersReducedMotion();\n\n const snapBack = (element: HTMLDivElement) => {\n element.style.transition = prefersReducedMotion ? \"\" : SNAP_BACK_TRANSITION;\n element.style.transform = \"\";\n };\n\n const release = (drag: ActiveDrag, dismiss: boolean) => {\n dragRef.current = null;\n drag.stopBlockingTouchScroll();\n releasePointer(drag.element, drag.pointerId);\n if (!drag.dragging) return;\n if (!dismiss) {\n snapBack(drag.element);\n return;\n }\n onDismiss();\n requestAnimationFrame(() => {\n if (drag.element.isConnected && drag.element.dataset.state !== \"closed\") {\n snapBack(drag.element);\n }\n });\n };\n\n return {\n ...props,\n onPointerDown(event) {\n props.onPointerDown?.(event);\n if (!enabled || event.defaultPrevented || event.button !== 0) return;\n if (media && typeof window.matchMedia === \"function\" && !window.matchMedia(media).matches)\n return;\n const target = event.target instanceof Element ? event.target : null;\n if (target?.closest(NON_DRAGGABLE_TARGETS)) return;\n if (isScrolledAwayFromTop(event.target, event.currentTarget)) return;\n const element = event.currentTarget;\n dragRef.current = {\n pointerId: event.pointerId,\n element,\n startY: event.clientY,\n startX: event.clientX,\n lastY: event.clientY,\n lastTime: event.timeStamp,\n velocity: 0,\n dragging: false,\n stopBlockingTouchScroll: blockTouchScrollWhileDragging(element, () => dragRef.current),\n };\n },\n onPointerMove(event) {\n props.onPointerMove?.(event);\n const drag = dragRef.current;\n if (!drag || event.pointerId !== drag.pointerId) return;\n const offset = event.clientY - drag.startY;\n if (!drag.dragging) {\n const dx = Math.abs(event.clientX - drag.startX);\n if (Math.max(Math.abs(offset), dx) < DRAG_START_THRESHOLD_PX) return;\n if (offset <= dx) {\n release(drag, false);\n return;\n }\n drag.dragging = true;\n capturePointer(drag.element, event.pointerId);\n drag.element.style.transition = \"none\";\n }\n const elapsed = event.timeStamp - drag.lastTime;\n if (elapsed > 0) drag.velocity = (event.clientY - drag.lastY) / elapsed;\n drag.lastY = event.clientY;\n drag.lastTime = event.timeStamp;\n drag.element.style.transform = `translate3d(0, ${Math.max(offset, 0)}px, 0)`;\n },\n onPointerUp(event) {\n props.onPointerUp?.(event);\n const drag = dragRef.current;\n if (!drag || event.pointerId !== drag.pointerId) return;\n const dismiss = shouldDismissDrag({\n offset: event.clientY - drag.startY,\n height: drag.element.getBoundingClientRect().height,\n velocity: event.timeStamp - drag.lastTime > FLICK_WINDOW_MS ? 0 : drag.velocity,\n });\n release(drag, dismiss);\n },\n onPointerCancel(event) {\n props.onPointerCancel?.(event);\n const drag = dragRef.current;\n if (!drag || event.pointerId !== drag.pointerId) return;\n release(drag, false);\n },\n };\n}\n"],"names":["React","usePrefersReducedMotion","releasePointer","capturePointer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAM,0BAA0B;AAChC,MAAM,yBAAyB;AAC/B,MAAM,6BAA6B;AACnC,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;AAC7B,MAAM,wBAAwB;AAMvB,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AACF,GAIY;AACV,MAAI,UAAU,EAAG,QAAO;AACxB,SAAO,UAAU,SAAS,0BAA0B,YAAY;AAClE;AA8BA,SAAS,sBAAsB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AAK,WAAW,MAAM;AACtB,WAAK,QAAQ,MAAM,YAAY,kBAAkB,KAAK,IAAI,QAAQ,CAAC,CAAC;AAAA,IACtE;AAAA,IACA,YAAY,OAAO;AACjB,YAAM,cAAc,KAAK;AACzB,YAAM,OAAO,QAAQ;AACrB,UAAI,CAAC,QAAQ,MAAM,cAAc,KAAK,UAAW;AACjD,YAAM,UAAU,kBAAkB;AAAA,QAChC,QAAQ,MAAM,UAAU,KAAK;AAAA,QAC7B,QAAQ,KAAK,QAAQ,sBAAA,EAAwB;AAAA,QAC7C,UAAU,MAAM,YAAY,KAAK,WAAW,kBAAkB,IAAI,KAAK;AAAA,MAAA,CACxE;AACD,cAAQ,MAAM,OAAO;AAAA,IACvB;AAAA,IACA,gBAAgB,OAAO;AACrB,YAAM,kBAAkB,KAAK;AAC7B,YAAM,OAAO,QAAQ;AACrB,UAAI,CAAC,QAAQ,MAAM,cAAc,KAAK,UAAW;AACjD,cAAQ,MAAM,KAAK;AAAA,IACrB;AAAA,EAAA;AAEJ;;;"}
@@ -2,6 +2,7 @@
2
2
  "use strict";
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  const React = require("react");
5
+ const pointerCapture = require("./pointerCapture.cjs");
5
6
  function _interopNamespaceDefault(e) {
6
7
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
7
8
  if (e) {
@@ -31,7 +32,7 @@ function useSuppressClickAfterDrag(props) {
31
32
  tapRef.current = null;
32
33
  return;
33
34
  }
34
- event.currentTarget.setPointerCapture?.(event.pointerId);
35
+ pointerCapture.capturePointer(event.currentTarget, event.pointerId);
35
36
  tapRef.current = {
36
37
  pointerId: event.pointerId,
37
38
  x: event.clientX,
@@ -1 +1 @@
1
- {"version":3,"file":"useSuppressClickAfterDrag.cjs","sources":["../../../src/utils/useSuppressClickAfterDrag.ts"],"sourcesContent":["import * as React from \"react\";\n\nconst TAP_MOVEMENT_THRESHOLD_PX = 10;\n\ntype ActiveTap = {\n pointerId: number;\n x: number;\n y: number;\n movedPastThreshold: boolean;\n};\n\ntype GatedHandlers = {\n onPointerDown?: React.PointerEventHandler;\n onPointerMove?: React.PointerEventHandler;\n onPointerCancel?: React.PointerEventHandler;\n onClick?: React.MouseEventHandler;\n};\n\n/**\n * Composes the consumer's pointer/click handlers with a touch-drag tracker\n * that suppresses the synthetic click an Android Chrome scroll-drag-end can\n * dispatch on a click-based Radix trigger (Popover / Dialog / Drawer).\n *\n * On touch / pen input, if the press-and-release crosses a movement threshold,\n * the subsequent `click` is preventDefault'd — short-circuiting Radix's own\n * `onOpenToggle` via `composeEventHandlers` — and stopPropagation'd so it\n * doesn't bubble to ancestors. Mouse input passes through unchanged because\n * mouse never triggers the Android scroll-drag bug class.\n *\n * Related: radix-ui/primitives#1912 (DropdownMenu pointerdown variant) and\n * #2702 (DismissableLayer touch dismiss). For the DropdownMenu pointerdown\n * variant see `components/DropdownMenu/DropdownMenu.tsx`.\n */\nexport function useSuppressClickAfterDrag<P extends GatedHandlers = GatedHandlers>(\n props?: P,\n): P & Required<GatedHandlers> {\n const tapRef = React.useRef<ActiveTap | null>(null);\n const consumer = props ?? ({} as P);\n\n return {\n ...consumer,\n onPointerDown(event) {\n consumer.onPointerDown?.(event);\n if (event.pointerType === \"mouse\") {\n tapRef.current = null;\n return;\n }\n // Keep pointermove on this element if the finger drifts off.\n // Optional because jsdom (used in tests) doesn't implement it.\n event.currentTarget.setPointerCapture?.(event.pointerId);\n tapRef.current = {\n pointerId: event.pointerId,\n x: event.clientX,\n y: event.clientY,\n movedPastThreshold: false,\n };\n },\n onPointerMove(event) {\n consumer.onPointerMove?.(event);\n const tap = tapRef.current;\n if (tap === null || event.pointerId !== tap.pointerId || tap.movedPastThreshold) return;\n const dx = event.clientX - tap.x;\n const dy = event.clientY - tap.y;\n if (Math.hypot(dx, dy) > TAP_MOVEMENT_THRESHOLD_PX) {\n tap.movedPastThreshold = true;\n }\n },\n onPointerCancel(event) {\n consumer.onPointerCancel?.(event);\n const tap = tapRef.current;\n if (tap !== null && event.pointerId === tap.pointerId) {\n tapRef.current = null;\n }\n },\n onClick(event) {\n const tap = tapRef.current;\n tapRef.current = null;\n if (tap?.movedPastThreshold) {\n // preventDefault stops Radix's onClick → onOpenToggle via\n // composeEventHandlers. stopPropagation prevents the synthetic click\n // from bubbling to ancestor click handlers.\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n consumer.onClick?.(event);\n },\n };\n}\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,4BAA4B;AA+B3B,SAAS,0BACd,OAC6B;AAC7B,QAAM,SAASA,iBAAM,OAAyB,IAAI;AAClD,QAAM,WAAW,SAAU,CAAA;AAE3B,SAAO;AAAA,IACL,GAAG;AAAA,IACH,cAAc,OAAO;AACnB,eAAS,gBAAgB,KAAK;AAC9B,UAAI,MAAM,gBAAgB,SAAS;AACjC,eAAO,UAAU;AACjB;AAAA,MACF;AAGA,YAAM,cAAc,oBAAoB,MAAM,SAAS;AACvD,aAAO,UAAU;AAAA,QACf,WAAW,MAAM;AAAA,QACjB,GAAG,MAAM;AAAA,QACT,GAAG,MAAM;AAAA,QACT,oBAAoB;AAAA,MAAA;AAAA,IAExB;AAAA,IACA,cAAc,OAAO;AACnB,eAAS,gBAAgB,KAAK;AAC9B,YAAM,MAAM,OAAO;AACnB,UAAI,QAAQ,QAAQ,MAAM,cAAc,IAAI,aAAa,IAAI,mBAAoB;AACjF,YAAM,KAAK,MAAM,UAAU,IAAI;AAC/B,YAAM,KAAK,MAAM,UAAU,IAAI;AAC/B,UAAI,KAAK,MAAM,IAAI,EAAE,IAAI,2BAA2B;AAClD,YAAI,qBAAqB;AAAA,MAC3B;AAAA,IACF;AAAA,IACA,gBAAgB,OAAO;AACrB,eAAS,kBAAkB,KAAK;AAChC,YAAM,MAAM,OAAO;AACnB,UAAI,QAAQ,QAAQ,MAAM,cAAc,IAAI,WAAW;AACrD,eAAO,UAAU;AAAA,MACnB;AAAA,IACF;AAAA,IACA,QAAQ,OAAO;AACb,YAAM,MAAM,OAAO;AACnB,aAAO,UAAU;AACjB,UAAI,KAAK,oBAAoB;AAI3B,cAAM,eAAA;AACN,cAAM,gBAAA;AACN;AAAA,MACF;AACA,eAAS,UAAU,KAAK;AAAA,IAC1B;AAAA,EAAA;AAEJ;;"}
1
+ {"version":3,"file":"useSuppressClickAfterDrag.cjs","sources":["../../../src/utils/useSuppressClickAfterDrag.ts"],"sourcesContent":["import * as React from \"react\";\nimport { capturePointer } from \"./pointerCapture\";\n\nconst TAP_MOVEMENT_THRESHOLD_PX = 10;\n\ntype ActiveTap = {\n pointerId: number;\n x: number;\n y: number;\n movedPastThreshold: boolean;\n};\n\ntype GatedHandlers = {\n onPointerDown?: React.PointerEventHandler;\n onPointerMove?: React.PointerEventHandler;\n onPointerCancel?: React.PointerEventHandler;\n onClick?: React.MouseEventHandler;\n};\n\n/**\n * Composes the consumer's pointer/click handlers with a touch-drag tracker\n * that suppresses the synthetic click an Android Chrome scroll-drag-end can\n * dispatch on a click-based Radix trigger (Popover / Dialog / Drawer).\n *\n * On touch / pen input, if the press-and-release crosses a movement threshold,\n * the subsequent `click` is preventDefault'd — short-circuiting Radix's own\n * `onOpenToggle` via `composeEventHandlers` — and stopPropagation'd so it\n * doesn't bubble to ancestors. Mouse input passes through unchanged because\n * mouse never triggers the Android scroll-drag bug class.\n *\n * Related: radix-ui/primitives#1912 (DropdownMenu pointerdown variant) and\n * #2702 (DismissableLayer touch dismiss). For the DropdownMenu pointerdown\n * variant see `components/DropdownMenu/DropdownMenu.tsx`.\n */\nexport function useSuppressClickAfterDrag<P extends GatedHandlers = GatedHandlers>(\n props?: P,\n): P & Required<GatedHandlers> {\n const tapRef = React.useRef<ActiveTap | null>(null);\n const consumer = props ?? ({} as P);\n\n return {\n ...consumer,\n onPointerDown(event) {\n consumer.onPointerDown?.(event);\n if (event.pointerType === \"mouse\") {\n tapRef.current = null;\n return;\n }\n // Keep pointermove on this element if the finger drifts off.\n // Optional because jsdom (used in tests) doesn't implement it.\n capturePointer(event.currentTarget, event.pointerId);\n tapRef.current = {\n pointerId: event.pointerId,\n x: event.clientX,\n y: event.clientY,\n movedPastThreshold: false,\n };\n },\n onPointerMove(event) {\n consumer.onPointerMove?.(event);\n const tap = tapRef.current;\n if (tap === null || event.pointerId !== tap.pointerId || tap.movedPastThreshold) return;\n const dx = event.clientX - tap.x;\n const dy = event.clientY - tap.y;\n if (Math.hypot(dx, dy) > TAP_MOVEMENT_THRESHOLD_PX) {\n tap.movedPastThreshold = true;\n }\n },\n onPointerCancel(event) {\n consumer.onPointerCancel?.(event);\n const tap = tapRef.current;\n if (tap !== null && event.pointerId === tap.pointerId) {\n tapRef.current = null;\n }\n },\n onClick(event) {\n const tap = tapRef.current;\n tapRef.current = null;\n if (tap?.movedPastThreshold) {\n // preventDefault stops Radix's onClick → onOpenToggle via\n // composeEventHandlers. stopPropagation prevents the synthetic click\n // from bubbling to ancestor click handlers.\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n consumer.onClick?.(event);\n },\n };\n}\n"],"names":["React","capturePointer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM,4BAA4B;AA+B3B,SAAS,0BACd,OAC6B;AAC7B,QAAM,SAASA,iBAAM,OAAyB,IAAI;AAClD,QAAM,WAAW,SAAU,CAAA;AAE3B,SAAO;AAAA,IACL,GAAG;AAAA,IACH,cAAc,OAAO;AACnB,eAAS,gBAAgB,KAAK;AAC9B,UAAI,MAAM,gBAAgB,SAAS;AACjC,eAAO,UAAU;AACjB;AAAA,MACF;AAGAC,qBAAAA,eAAe,MAAM,eAAe,MAAM,SAAS;AACnD,aAAO,UAAU;AAAA,QACf,WAAW,MAAM;AAAA,QACjB,GAAG,MAAM;AAAA,QACT,GAAG,MAAM;AAAA,QACT,oBAAoB;AAAA,MAAA;AAAA,IAExB;AAAA,IACA,cAAc,OAAO;AACnB,eAAS,gBAAgB,KAAK;AAC9B,YAAM,MAAM,OAAO;AACnB,UAAI,QAAQ,QAAQ,MAAM,cAAc,IAAI,aAAa,IAAI,mBAAoB;AACjF,YAAM,KAAK,MAAM,UAAU,IAAI;AAC/B,YAAM,KAAK,MAAM,UAAU,IAAI;AAC/B,UAAI,KAAK,MAAM,IAAI,EAAE,IAAI,2BAA2B;AAClD,YAAI,qBAAqB;AAAA,MAC3B;AAAA,IACF;AAAA,IACA,gBAAgB,OAAO;AACrB,eAAS,kBAAkB,KAAK;AAChC,YAAM,MAAM,OAAO;AACnB,UAAI,QAAQ,QAAQ,MAAM,cAAc,IAAI,WAAW;AACrD,eAAO,UAAU;AAAA,MACnB;AAAA,IACF;AAAA,IACA,QAAQ,OAAO;AACb,YAAM,MAAM,OAAO;AACnB,aAAO,UAAU;AACjB,UAAI,KAAK,oBAAoB;AAI3B,cAAM,eAAA;AACN,cAAM,gBAAA;AACN;AAAA,MACF;AACA,eAAS,UAAU,KAAK;AAAA,IAC1B;AAAA,EAAA;AAEJ;;"}
@@ -4,6 +4,7 @@ import * as PopoverPrimitive from "@radix-ui/react-popover";
4
4
  import * as React from "react";
5
5
  import { cn } from "../../utils/cn.mjs";
6
6
  import { FLOATING_CONTENT_COLLISION_PADDING } from "../../utils/floatingContentCollisionPadding.mjs";
7
+ import { INPUT_FIELD_DISABLED_CLASSES, INPUT_FIELD_V2_FOCUS_CLASSES } from "../../utils/inputFieldClasses.mjs";
7
8
  import { ChevronDownIcon } from "../Icons/ChevronDownIcon.mjs";
8
9
  import { CloseIcon } from "../Icons/CloseIcon.mjs";
9
10
  import { SpinnerIcon } from "../Icons/SpinnerIcon.mjs";
@@ -82,16 +83,29 @@ const Autocomplete = React.forwardRef((props, ref) => {
82
83
  {
83
84
  className: cn(
84
85
  "relative flex flex-wrap items-center overflow-hidden rounded-sm border bg-neutral-alphas-100 after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] has-focus-visible:outline-none has-focus-visible:after:shadow-focus-ring motion-safe:transition-colors",
85
- error ? "border-error-content" : "border-transparent",
86
- !disabled && !error && "hover:border-neutral-alphas-400",
87
- ac.isOpen && !error && !disabled && "border-neutral-alphas-400",
86
+ error ? "border-error-content" : cn(
87
+ "border-transparent",
88
+ !disabled && "theme-v2:border-border-input",
89
+ INPUT_FIELD_V2_FOCUS_CLASSES
90
+ ),
91
+ !disabled && !error && "hover:border-border-input-hover",
92
+ ac.isOpen && !error && !disabled && "border-border-input-hover",
88
93
  CONTAINER_HEIGHT[size],
89
94
  PADDING_CLASSES[size],
90
- disabled && "opacity-50"
95
+ disabled && INPUT_FIELD_DISABLED_CLASSES
91
96
  ),
92
97
  onClick: ac.handleContainerClick,
93
98
  children: [
94
- leftIcon && /* @__PURE__ */ jsx("div", { className: "flex size-5 shrink-0 items-center justify-center text-content-secondary", children: leftIcon }),
99
+ leftIcon && /* @__PURE__ */ jsx(
100
+ "div",
101
+ {
102
+ className: cn(
103
+ "flex size-5 shrink-0 items-center justify-center text-content-secondary",
104
+ disabled && "theme-v2:text-icons-disabled"
105
+ ),
106
+ children: leftIcon
107
+ }
108
+ ),
95
109
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-1.5", children: [
96
110
  ac.isMulti && ac.selectedMultiOptions.map((opt) => /* @__PURE__ */ jsx(
97
111
  AutocompleteTag,
@@ -127,7 +141,7 @@ const Autocomplete = React.forwardRef((props, ref) => {
127
141
  onFocus: ac.handleFocus,
128
142
  onBlur: ac.handleBlur,
129
143
  className: cn(
130
- "min-w-[40px] flex-1 truncate bg-transparent text-content-primary no-underline placeholder:text-content-secondary placeholder:opacity-40 focus:outline-none disabled:cursor-not-allowed",
144
+ "min-w-[40px] flex-1 truncate bg-transparent text-content-primary no-underline placeholder:text-content-secondary placeholder:opacity-40 focus:outline-none disabled:cursor-not-allowed theme-v2:disabled:text-content-disabled theme-v2:disabled:placeholder:text-content-disabled theme-v2:disabled:placeholder:opacity-100",
131
145
  INPUT_SIZE_CLASSES[size]
132
146
  )
133
147
  }
@@ -146,12 +160,21 @@ const Autocomplete = React.forwardRef((props, ref) => {
146
160
  children: /* @__PURE__ */ jsx(CloseIcon, { className: "size-4" })
147
161
  }
148
162
  ),
149
- /* @__PURE__ */ jsx("div", { className: "flex size-5 shrink-0 items-center justify-center text-content-secondary", children: /* @__PURE__ */ jsx(
150
- ChevronDownIcon,
163
+ /* @__PURE__ */ jsx(
164
+ "div",
151
165
  {
152
- className: cn("size-5 transition-transform", ac.isOpen && "rotate-180")
166
+ className: cn(
167
+ "flex size-5 shrink-0 items-center justify-center text-content-secondary",
168
+ disabled && "theme-v2:text-icons-disabled"
169
+ ),
170
+ children: /* @__PURE__ */ jsx(
171
+ ChevronDownIcon,
172
+ {
173
+ className: cn("size-5 transition-transform", ac.isOpen && "rotate-180")
174
+ }
175
+ )
153
176
  }
154
- ) })
177
+ )
155
178
  ] })
156
179
  ]
157
180
  }
@@ -166,6 +189,7 @@ const Autocomplete = React.forwardRef((props, ref) => {
166
189
  style: { zIndex: "var(--fanvue-ui-portal-z-index, 50)" },
167
190
  className: cn(
168
191
  "w-max min-w-(--radix-popper-anchor-width) max-w-(--radix-popover-content-available-width) overflow-hidden rounded-sm border border-neutral-alphas-200 bg-background-primary text-content-primary shadow-[0_4px_16px_rgba(0,0,0,0.10)]",
192
+ "theme-v2:border-modal-stroke theme-v2:bg-modal-background",
169
193
  "data-[state=closed]:animate-out data-[state=open]:animate-in",
170
194
  "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
171
195
  "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
@@ -1 +1 @@
1
- {"version":3,"file":"Autocomplete.mjs","sources":["../../../src/components/Autocomplete/Autocomplete.tsx"],"sourcesContent":["import * as Popover from \"@radix-ui/react-popover\";\nimport * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { FLOATING_CONTENT_COLLISION_PADDING } from \"@/utils/floatingContentCollisionPadding\";\nimport { ChevronDownIcon } from \"../Icons/ChevronDownIcon\";\nimport { CloseIcon } from \"../Icons/CloseIcon\";\nimport { SpinnerIcon } from \"../Icons/SpinnerIcon\";\nimport { AutocompleteDropdownContent } from \"./AutocompleteDropdownContent\";\nimport { AutocompleteTag } from \"./AutocompleteTag\";\nimport { useAutocomplete } from \"./useAutocomplete\";\n\nexport type AutocompleteSize = \"48\" | \"40\" | \"32\";\n\nexport interface AutocompleteOption {\n /** Unique value identifying the option. Returned via `onChange`. */\n value: string;\n /** Visible label. Falls back to `value` when omitted. */\n label?: string;\n /** When `true`, the option renders but cannot be selected. @default false */\n disabled?: boolean;\n /**\n * ID of the group this option belongs to. Must match an entry in the\n * component's `groups` prop. Options without a `groupId` render in an\n * implicit \"ungrouped\" bucket above the first declared group.\n */\n groupId?: string;\n /**\n * Pinned options bypass the search filter and stay visible at the top of\n * the list regardless of the current query. Useful for \"+ Create new\"\n * affordances. Pinned options ignore `groupId` and render before any\n * grouped or ungrouped content. @default false\n */\n pinned?: boolean;\n}\n\n/**\n * Describes a single group rendered above its matching options.\n * Indentation of nested rows (e.g. price under product) is not built in —\n * consumers control it via `renderOption` styling.\n */\nexport interface AutocompleteGroup {\n /** Stable identifier referenced by `option.groupId`. */\n id: string;\n /**\n * Group heading text. Used as the group's accessible name and matched\n * against the search query: when the query matches a group's `label`,\n * every option under that group is kept regardless of whether it\n * individually matches the per-option filter. This supports the common\n * \"heading is the searchable label, items are sub-rows\" shape (e.g.\n * heading = product name, items = prices).\n */\n label: string;\n}\n\ninterface AutocompleteBaseProps {\n label?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n helperText?: string;\n /** @default \"48\" */\n size?: AutocompleteSize;\n /** @default false */\n error?: boolean;\n errorMessage?: string;\n placeholder?: string;\n leftIcon?: React.ReactNode;\n /** @default false */\n fullWidth?: boolean;\n /** @default false */\n disabled?: boolean;\n /** @default false */\n clearable?: boolean;\n clearAriaLabel?: string;\n id?: string;\n className?: string;\n options: AutocompleteOption[];\n inputValue?: string;\n onInputChange?: (value: string) => void;\n filterFn?: (option: AutocompleteOption, query: string) => boolean;\n /** @default false */\n creatable?: boolean;\n creatableLabel?: (inputValue: string) => string;\n onCreate?: (inputValue: string) => void;\n /** @default false */\n loading?: boolean;\n loadingText?: string;\n emptyText?: string;\n renderOption?: (\n option: AutocompleteOption,\n state: { selected: boolean; active: boolean },\n ) => React.ReactNode;\n renderTag?: (option: AutocompleteOption, onRemove: () => void) => React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /**\n * Ordered list of groups. When provided, options whose `groupId` matches\n * an entry render under the corresponding heading. Groups with no visible\n * (post-filter) options collapse silently. Pinned options render above\n * everything; ungrouped options render between pinned and the first group.\n * Only one level of grouping is supported.\n */\n groups?: AutocompleteGroup[];\n /**\n * Custom renderer for group headings. The returned node is wrapped by the\n * component in an element carrying the `id` referenced by the surrounding\n * `role=\"group\"` wrapper's `aria-labelledby`, so consumers only need to\n * return visual content.\n */\n renderGroupHeading?: (group: AutocompleteGroup) => React.ReactNode;\n}\n\ninterface AutocompleteSingleProps extends AutocompleteBaseProps {\n multiple?: false;\n value?: string | null;\n defaultValue?: string | null;\n onChange?: (value: string | null) => void;\n}\n\ninterface AutocompleteMultiProps extends AutocompleteBaseProps {\n multiple: true;\n value?: string[];\n defaultValue?: string[];\n onChange?: (values: string[]) => void;\n}\n\nexport type AutocompleteProps = AutocompleteSingleProps | AutocompleteMultiProps;\n\nconst CONTAINER_HEIGHT: Record<AutocompleteSize, string> = {\n \"48\": \"min-h-12\",\n \"40\": \"min-h-10\",\n \"32\": \"min-h-8\",\n};\n\nconst INPUT_SIZE_CLASSES: Record<AutocompleteSize, string> = {\n \"48\": \"typography-body-default-16px-regular\",\n \"40\": \"typography-body-default-16px-regular\",\n \"32\": \"typography-body-small-14px-regular\",\n};\n\nconst PADDING_CLASSES: Record<AutocompleteSize, string> = {\n \"48\": \"px-4 py-1.5 gap-3\",\n \"40\": \"px-4 py-1 gap-3\",\n \"32\": \"px-3 py-1 gap-2\",\n};\n\nfunction warnMissingAccessibleName(label?: string, ariaLabel?: string, ariaLabelledBy?: string) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn(\n \"Autocomplete: no accessible name provided. Pass a `label`, `aria-label`, or `aria-labelledby` prop.\",\n );\n }\n }\n}\n\n/**\n * A combobox input with single- or multi-select, optional async loading, and\n * native support for grouped + pinned options.\n *\n * - Pass `groups` plus an `options` array whose entries reference each group\n * via `groupId` to render hierarchical lists with proper `role=\"group\"` +\n * `aria-labelledby` semantics. Options without a `groupId` render above\n * the first group; options marked `pinned` render above everything and\n * bypass the search filter.\n * - Indentation of nested rows (e.g. price under product) is controlled by\n * the consumer via `renderOption` styling — there is no built-in indent.\n *\n * @example\n * ```tsx\n * <Autocomplete\n * aria-label=\"Choose a product\"\n * options={[\n * { value: \"__new__\", label: \"+ Create new product\", pinned: true },\n * { value: \"product:abc\", label: \"Demo Product\", groupId: \"recent\" },\n * ]}\n * groups={[{ id: \"recent\", label: \"Recent products\" }]}\n * onChange={handleSelect}\n * />\n * ```\n */\n// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: Conditional JSX branches in the render template\nexport const Autocomplete = React.forwardRef<HTMLInputElement, AutocompleteProps>((props, ref) => {\n const {\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n helperText,\n size = \"48\",\n error = false,\n errorMessage,\n placeholder,\n leftIcon,\n fullWidth = false,\n disabled = false,\n clearable = false,\n clearAriaLabel = \"Clear\",\n className,\n loading = false,\n loadingText,\n emptyText = \"No results\",\n renderOption,\n renderTag,\n renderGroupHeading,\n } = props;\n\n const ac = useAutocomplete(props);\n\n React.useImperativeHandle(ref, () => ac.inputRef.current as HTMLInputElement);\n\n warnMissingAccessibleName(label, ariaLabel, ariaLabelledby);\n\n const bottomText = error && errorMessage ? errorMessage : helperText;\n\n return (\n <Popover.Root open={ac.isOpen && !disabled} onOpenChange={ac.handleOpenChange}>\n <div\n className={cn(\"flex flex-col\", fullWidth && \"w-full\", className)}\n data-autocomplete-root=\"\"\n data-disabled={disabled ? \"\" : undefined}\n data-error={error ? \"\" : undefined}\n >\n {label && (\n <label\n htmlFor={ac.inputId}\n className=\"typography-description-12px-semibold px-1 pt-1 pb-2 text-content-primary\"\n >\n {label}\n </label>\n )}\n\n <Popover.Anchor asChild>\n {/* biome-ignore lint/a11y/noStaticElementInteractions: Container delegates click to the inner input */}\n {/* biome-ignore lint/a11y/useKeyWithClickEvents: Keyboard interaction is handled by the inner combobox input */}\n <div\n className={cn(\n \"relative flex flex-wrap items-center overflow-hidden rounded-sm border bg-neutral-alphas-100 after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] has-focus-visible:outline-none has-focus-visible:after:shadow-focus-ring motion-safe:transition-colors\",\n error ? \"border-error-content\" : \"border-transparent\",\n !disabled && !error && \"hover:border-neutral-alphas-400\",\n ac.isOpen && !error && !disabled && \"border-neutral-alphas-400\",\n CONTAINER_HEIGHT[size],\n PADDING_CLASSES[size],\n disabled && \"opacity-50\",\n )}\n onClick={ac.handleContainerClick}\n >\n {leftIcon && (\n <div className=\"flex size-5 shrink-0 items-center justify-center text-content-secondary\">\n {leftIcon}\n </div>\n )}\n\n <div className=\"flex min-w-0 flex-1 flex-wrap items-center gap-1.5\">\n {ac.isMulti &&\n ac.selectedMultiOptions.map((opt) => (\n <AutocompleteTag\n key={opt.value}\n option={opt}\n disabled={disabled}\n onRemove={() => ac.toggleMulti(opt.value)}\n renderTag={renderTag}\n />\n ))}\n\n <input\n ref={ac.inputRef}\n id={ac.inputId}\n role=\"combobox\"\n type=\"text\"\n disabled={disabled}\n aria-expanded={ac.isOpen}\n aria-controls={ac.isOpen ? ac.listboxId : undefined}\n aria-activedescendant={ac.activeDescendantId}\n aria-autocomplete=\"list\"\n aria-describedby={bottomText ? ac.helperTextId : undefined}\n aria-invalid={error || undefined}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n autoComplete=\"off\"\n placeholder={\n ac.isMulti && ac.selectedMultiValues.length > 0 ? undefined : placeholder\n }\n value={ac.displayInputValue}\n onChange={ac.handleInputChange}\n onKeyDown={ac.handleKeyDown}\n onFocus={ac.handleFocus}\n onBlur={ac.handleBlur}\n className={cn(\n \"min-w-[40px] flex-1 truncate bg-transparent text-content-primary no-underline placeholder:text-content-secondary placeholder:opacity-40 focus:outline-none disabled:cursor-not-allowed\",\n INPUT_SIZE_CLASSES[size],\n )}\n />\n </div>\n\n <div className=\"flex shrink-0 items-center gap-1\">\n {loading && <SpinnerIcon size={16} spin className=\"text-content-secondary\" />}\n {clearable && ac.hasClearableValue && !disabled && (\n <button\n type=\"button\"\n tabIndex={-1}\n aria-label={clearAriaLabel}\n className=\"flex size-5 shrink-0 cursor-pointer items-center justify-center text-content-secondary hover:text-content-primary active:scale-95\"\n onClick={ac.handleClear}\n >\n <CloseIcon className=\"size-4\" />\n </button>\n )}\n <div className=\"flex size-5 shrink-0 items-center justify-center text-content-secondary\">\n <ChevronDownIcon\n className={cn(\"size-5 transition-transform\", ac.isOpen && \"rotate-180\")}\n />\n </div>\n </div>\n </div>\n </Popover.Anchor>\n\n <Popover.Portal>\n <Popover.Content\n sideOffset={4}\n collisionPadding={FLOATING_CONTENT_COLLISION_PADDING}\n onOpenAutoFocus={(e) => e.preventDefault()}\n onCloseAutoFocus={(e) => e.preventDefault()}\n style={{ zIndex: \"var(--fanvue-ui-portal-z-index, 50)\" }}\n className={cn(\n \"w-max min-w-(--radix-popper-anchor-width) max-w-(--radix-popover-content-available-width) overflow-hidden rounded-sm border border-neutral-alphas-200 bg-background-primary text-content-primary shadow-[0_4px_16px_rgba(0,0,0,0.10)]\",\n \"data-[state=closed]:animate-out data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n \"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2\",\n )}\n >\n <div\n ref={ac.listRef}\n id={ac.listboxId}\n role=\"listbox\"\n aria-label={label ?? ariaLabel ?? \"Options\"}\n aria-multiselectable={ac.isMulti || undefined}\n className=\"max-h-60 overflow-y-auto p-1\"\n >\n <AutocompleteDropdownContent\n loading={loading}\n loadingText={loadingText}\n emptyText={emptyText}\n visibleOptions={ac.visibleOptions}\n visibleSections={ac.visibleSections}\n createOption={ac.createOption}\n listboxId={ac.listboxId}\n activeIndex={ac.activeIndex}\n isMulti={ac.isMulti}\n selectedMultiValues={ac.selectedMultiValues}\n selectedValue={ac.selectedValue}\n onSelect={ac.handleSelect}\n onMouseEnter={ac.setActiveIndex}\n renderOption={renderOption}\n renderGroupHeading={renderGroupHeading}\n />\n </div>\n </Popover.Content>\n </Popover.Portal>\n\n {bottomText && (\n <p\n id={ac.helperTextId}\n className={cn(\n \"typography-description-12px-regular px-2 pt-1 pb-0.5\",\n error ? \"text-error-content\" : \"text-content-secondary\",\n )}\n >\n {bottomText}\n </p>\n )}\n </div>\n </Popover.Root>\n );\n});\n\nAutocomplete.displayName = \"Autocomplete\";\n"],"names":["Popover"],"mappings":";;;;;;;;;;;;AAgIA,MAAM,mBAAqD;AAAA,EACzD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,qBAAuD;AAAA,EAC3D,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,kBAAoD;AAAA,EACxD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,SAAS,0BAA0B,OAAgB,WAAoB,gBAAyB;AAC9F,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,CAAC,SAAS,CAAC,aAAa,CAAC,gBAAgB;AAC3C,cAAQ;AAAA,QACN;AAAA,MAAA;AAAA,IAEJ;AAAA,EACF;AACF;AA4BO,MAAM,eAAe,MAAM,WAAgD,CAAC,OAAO,QAAQ;AAChG,QAAM;AAAA,IACJ;AAAA,IACA,cAAc;AAAA,IAC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A;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA;AAAA,UACF;AAAA,QAAA,GAEJ;AAAA,QAEC,cACC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAI,GAAG;AAAA,YACP,WAAW;AAAA,cACT;AAAA,cACA,QAAQ,uBAAuB;AAAA,YAAA;AAAA,YAGhC,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ,CAAC;AAED,aAAa,cAAc;"}
1
+ {"version":3,"file":"Autocomplete.mjs","sources":["../../../src/components/Autocomplete/Autocomplete.tsx"],"sourcesContent":["import * as Popover from \"@radix-ui/react-popover\";\nimport * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { FLOATING_CONTENT_COLLISION_PADDING } from \"@/utils/floatingContentCollisionPadding\";\nimport {\n INPUT_FIELD_DISABLED_CLASSES,\n INPUT_FIELD_V2_FOCUS_CLASSES,\n} from \"@/utils/inputFieldClasses\";\nimport { ChevronDownIcon } from \"../Icons/ChevronDownIcon\";\nimport { CloseIcon } from \"../Icons/CloseIcon\";\nimport { SpinnerIcon } from \"../Icons/SpinnerIcon\";\nimport { AutocompleteDropdownContent } from \"./AutocompleteDropdownContent\";\nimport { AutocompleteTag } from \"./AutocompleteTag\";\nimport { useAutocomplete } from \"./useAutocomplete\";\n\nexport type AutocompleteSize = \"48\" | \"40\" | \"32\";\n\nexport interface AutocompleteOption {\n /** Unique value identifying the option. Returned via `onChange`. */\n value: string;\n /** Visible label. Falls back to `value` when omitted. */\n label?: string;\n /** When `true`, the option renders but cannot be selected. @default false */\n disabled?: boolean;\n /**\n * ID of the group this option belongs to. Must match an entry in the\n * component's `groups` prop. Options without a `groupId` render in an\n * implicit \"ungrouped\" bucket above the first declared group.\n */\n groupId?: string;\n /**\n * Pinned options bypass the search filter and stay visible at the top of\n * the list regardless of the current query. Useful for \"+ Create new\"\n * affordances. Pinned options ignore `groupId` and render before any\n * grouped or ungrouped content. @default false\n */\n pinned?: boolean;\n}\n\n/**\n * Describes a single group rendered above its matching options.\n * Indentation of nested rows (e.g. price under product) is not built in —\n * consumers control it via `renderOption` styling.\n */\nexport interface AutocompleteGroup {\n /** Stable identifier referenced by `option.groupId`. */\n id: string;\n /**\n * Group heading text. Used as the group's accessible name and matched\n * against the search query: when the query matches a group's `label`,\n * every option under that group is kept regardless of whether it\n * individually matches the per-option filter. This supports the common\n * \"heading is the searchable label, items are sub-rows\" shape (e.g.\n * heading = product name, items = prices).\n */\n label: string;\n}\n\ninterface AutocompleteBaseProps {\n label?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n helperText?: string;\n /** @default \"48\" */\n size?: AutocompleteSize;\n /** @default false */\n error?: boolean;\n errorMessage?: string;\n placeholder?: string;\n leftIcon?: React.ReactNode;\n /** @default false */\n fullWidth?: boolean;\n /** @default false */\n disabled?: boolean;\n /** @default false */\n clearable?: boolean;\n clearAriaLabel?: string;\n id?: string;\n className?: string;\n options: AutocompleteOption[];\n inputValue?: string;\n onInputChange?: (value: string) => void;\n filterFn?: (option: AutocompleteOption, query: string) => boolean;\n /** @default false */\n creatable?: boolean;\n creatableLabel?: (inputValue: string) => string;\n onCreate?: (inputValue: string) => void;\n /** @default false */\n loading?: boolean;\n loadingText?: string;\n emptyText?: string;\n /**\n * Custom content for each option row. Under the v2 palette a selected row is\n * inverted: the content and icon tokens inside it switch to their inverted values,\n * so text and icons follow. Anything that brings its own surface, such as a `Chip`\n * or `Badge`, keeps its fill and should not rely on the row's text colour.\n */\n renderOption?: (\n option: AutocompleteOption,\n state: { selected: boolean; active: boolean },\n ) => React.ReactNode;\n renderTag?: (option: AutocompleteOption, onRemove: () => void) => React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /**\n * Ordered list of groups. When provided, options whose `groupId` matches\n * an entry render under the corresponding heading. Groups with no visible\n * (post-filter) options collapse silently. Pinned options render above\n * everything; ungrouped options render between pinned and the first group.\n * Only one level of grouping is supported.\n */\n groups?: AutocompleteGroup[];\n /**\n * Custom renderer for group headings. The returned node is wrapped by the\n * component in an element carrying the `id` referenced by the surrounding\n * `role=\"group\"` wrapper's `aria-labelledby`, so consumers only need to\n * return visual content.\n */\n renderGroupHeading?: (group: AutocompleteGroup) => React.ReactNode;\n}\n\ninterface AutocompleteSingleProps extends AutocompleteBaseProps {\n multiple?: false;\n value?: string | null;\n defaultValue?: string | null;\n onChange?: (value: string | null) => void;\n}\n\ninterface AutocompleteMultiProps extends AutocompleteBaseProps {\n multiple: true;\n value?: string[];\n defaultValue?: string[];\n onChange?: (values: string[]) => void;\n}\n\nexport type AutocompleteProps = AutocompleteSingleProps | AutocompleteMultiProps;\n\nconst CONTAINER_HEIGHT: Record<AutocompleteSize, string> = {\n \"48\": \"min-h-12\",\n \"40\": \"min-h-10\",\n \"32\": \"min-h-8\",\n};\n\nconst INPUT_SIZE_CLASSES: Record<AutocompleteSize, string> = {\n \"48\": \"typography-body-default-16px-regular\",\n \"40\": \"typography-body-default-16px-regular\",\n \"32\": \"typography-body-small-14px-regular\",\n};\n\nconst PADDING_CLASSES: Record<AutocompleteSize, string> = {\n \"48\": \"px-4 py-1.5 gap-3\",\n \"40\": \"px-4 py-1 gap-3\",\n \"32\": \"px-3 py-1 gap-2\",\n};\n\nfunction warnMissingAccessibleName(label?: string, ariaLabel?: string, ariaLabelledBy?: string) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn(\n \"Autocomplete: no accessible name provided. Pass a `label`, `aria-label`, or `aria-labelledby` prop.\",\n );\n }\n }\n}\n\n/**\n * A combobox input with single- or multi-select, optional async loading, and\n * native support for grouped + pinned options.\n *\n * - Pass `groups` plus an `options` array whose entries reference each group\n * via `groupId` to render hierarchical lists with proper `role=\"group\"` +\n * `aria-labelledby` semantics. Options without a `groupId` render above\n * the first group; options marked `pinned` render above everything and\n * bypass the search filter.\n * - Indentation of nested rows (e.g. price under product) is controlled by\n * the consumer via `renderOption` styling — there is no built-in indent.\n *\n * @example\n * ```tsx\n * <Autocomplete\n * aria-label=\"Choose a product\"\n * options={[\n * { value: \"__new__\", label: \"+ Create new product\", pinned: true },\n * { value: \"product:abc\", label: \"Demo Product\", groupId: \"recent\" },\n * ]}\n * groups={[{ id: \"recent\", label: \"Recent products\" }]}\n * onChange={handleSelect}\n * />\n * ```\n */\n// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: Conditional JSX branches in the render template\nexport const Autocomplete = React.forwardRef<HTMLInputElement, AutocompleteProps>((props, ref) => {\n const {\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n helperText,\n size = \"48\",\n error = false,\n errorMessage,\n placeholder,\n leftIcon,\n fullWidth = false,\n disabled = false,\n clearable = false,\n clearAriaLabel = \"Clear\",\n className,\n loading = false,\n loadingText,\n emptyText = \"No results\",\n renderOption,\n renderTag,\n renderGroupHeading,\n } = props;\n\n const ac = useAutocomplete(props);\n\n React.useImperativeHandle(ref, () => ac.inputRef.current as HTMLInputElement);\n\n warnMissingAccessibleName(label, ariaLabel, ariaLabelledby);\n\n const bottomText = error && errorMessage ? errorMessage : helperText;\n\n return (\n <Popover.Root open={ac.isOpen && !disabled} onOpenChange={ac.handleOpenChange}>\n <div\n className={cn(\"flex flex-col\", fullWidth && \"w-full\", className)}\n data-autocomplete-root=\"\"\n data-disabled={disabled ? \"\" : undefined}\n data-error={error ? \"\" : undefined}\n >\n {label && (\n <label\n htmlFor={ac.inputId}\n className=\"typography-description-12px-semibold px-1 pt-1 pb-2 text-content-primary\"\n >\n {label}\n </label>\n )}\n\n <Popover.Anchor asChild>\n {/* biome-ignore lint/a11y/noStaticElementInteractions: Container delegates click to the inner input */}\n {/* biome-ignore lint/a11y/useKeyWithClickEvents: Keyboard interaction is handled by the inner combobox input */}\n <div\n className={cn(\n \"relative flex flex-wrap items-center overflow-hidden rounded-sm border bg-neutral-alphas-100 after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] has-focus-visible:outline-none has-focus-visible:after:shadow-focus-ring motion-safe:transition-colors\",\n error\n ? \"border-error-content\"\n : cn(\n \"border-transparent\",\n !disabled && \"theme-v2:border-border-input\",\n INPUT_FIELD_V2_FOCUS_CLASSES,\n ),\n !disabled && !error && \"hover:border-border-input-hover\",\n ac.isOpen && !error && !disabled && \"border-border-input-hover\",\n CONTAINER_HEIGHT[size],\n PADDING_CLASSES[size],\n disabled && INPUT_FIELD_DISABLED_CLASSES,\n )}\n onClick={ac.handleContainerClick}\n >\n {leftIcon && (\n <div\n className={cn(\n \"flex size-5 shrink-0 items-center justify-center text-content-secondary\",\n disabled && \"theme-v2:text-icons-disabled\",\n )}\n >\n {leftIcon}\n </div>\n )}\n\n <div className=\"flex min-w-0 flex-1 flex-wrap items-center gap-1.5\">\n {ac.isMulti &&\n ac.selectedMultiOptions.map((opt) => (\n <AutocompleteTag\n key={opt.value}\n option={opt}\n disabled={disabled}\n onRemove={() => ac.toggleMulti(opt.value)}\n renderTag={renderTag}\n />\n ))}\n\n <input\n ref={ac.inputRef}\n id={ac.inputId}\n role=\"combobox\"\n type=\"text\"\n disabled={disabled}\n aria-expanded={ac.isOpen}\n aria-controls={ac.isOpen ? ac.listboxId : undefined}\n aria-activedescendant={ac.activeDescendantId}\n aria-autocomplete=\"list\"\n aria-describedby={bottomText ? ac.helperTextId : undefined}\n aria-invalid={error || undefined}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n autoComplete=\"off\"\n placeholder={\n ac.isMulti && ac.selectedMultiValues.length > 0 ? undefined : placeholder\n }\n value={ac.displayInputValue}\n onChange={ac.handleInputChange}\n onKeyDown={ac.handleKeyDown}\n onFocus={ac.handleFocus}\n onBlur={ac.handleBlur}\n className={cn(\n \"min-w-[40px] flex-1 truncate bg-transparent text-content-primary no-underline placeholder:text-content-secondary placeholder:opacity-40 focus:outline-none disabled:cursor-not-allowed theme-v2:disabled:text-content-disabled theme-v2:disabled:placeholder:text-content-disabled theme-v2:disabled:placeholder:opacity-100\",\n INPUT_SIZE_CLASSES[size],\n )}\n />\n </div>\n\n <div className=\"flex shrink-0 items-center gap-1\">\n {loading && <SpinnerIcon size={16} spin className=\"text-content-secondary\" />}\n {clearable && ac.hasClearableValue && !disabled && (\n <button\n type=\"button\"\n tabIndex={-1}\n aria-label={clearAriaLabel}\n className=\"flex size-5 shrink-0 cursor-pointer items-center justify-center text-content-secondary hover:text-content-primary active:scale-95\"\n onClick={ac.handleClear}\n >\n <CloseIcon className=\"size-4\" />\n </button>\n )}\n <div\n className={cn(\n \"flex size-5 shrink-0 items-center justify-center text-content-secondary\",\n disabled && \"theme-v2:text-icons-disabled\",\n )}\n >\n <ChevronDownIcon\n className={cn(\"size-5 transition-transform\", ac.isOpen && \"rotate-180\")}\n />\n </div>\n </div>\n </div>\n </Popover.Anchor>\n\n <Popover.Portal>\n <Popover.Content\n sideOffset={4}\n collisionPadding={FLOATING_CONTENT_COLLISION_PADDING}\n onOpenAutoFocus={(e) => e.preventDefault()}\n onCloseAutoFocus={(e) => e.preventDefault()}\n style={{ zIndex: \"var(--fanvue-ui-portal-z-index, 50)\" }}\n className={cn(\n \"w-max min-w-(--radix-popper-anchor-width) max-w-(--radix-popover-content-available-width) overflow-hidden rounded-sm border border-neutral-alphas-200 bg-background-primary text-content-primary shadow-[0_4px_16px_rgba(0,0,0,0.10)]\",\n \"theme-v2:border-modal-stroke theme-v2:bg-modal-background\",\n \"data-[state=closed]:animate-out data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n \"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2\",\n )}\n >\n <div\n ref={ac.listRef}\n id={ac.listboxId}\n role=\"listbox\"\n aria-label={label ?? ariaLabel ?? \"Options\"}\n aria-multiselectable={ac.isMulti || undefined}\n className=\"max-h-60 overflow-y-auto p-1\"\n >\n <AutocompleteDropdownContent\n loading={loading}\n loadingText={loadingText}\n emptyText={emptyText}\n visibleOptions={ac.visibleOptions}\n visibleSections={ac.visibleSections}\n createOption={ac.createOption}\n listboxId={ac.listboxId}\n activeIndex={ac.activeIndex}\n isMulti={ac.isMulti}\n selectedMultiValues={ac.selectedMultiValues}\n selectedValue={ac.selectedValue}\n onSelect={ac.handleSelect}\n onMouseEnter={ac.setActiveIndex}\n renderOption={renderOption}\n renderGroupHeading={renderGroupHeading}\n />\n </div>\n </Popover.Content>\n </Popover.Portal>\n\n {bottomText && (\n <p\n id={ac.helperTextId}\n className={cn(\n \"typography-description-12px-regular px-2 pt-1 pb-0.5\",\n error ? \"text-error-content\" : \"text-content-secondary\",\n )}\n >\n {bottomText}\n </p>\n )}\n </div>\n </Popover.Root>\n );\n});\n\nAutocomplete.displayName = \"Autocomplete\";\n"],"names":["Popover"],"mappings":";;;;;;;;;;;;;AA0IA,MAAM,mBAAqD;AAAA,EACzD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,qBAAuD;AAAA,EAC3D,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,kBAAoD;AAAA,EACxD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,SAAS,0BAA0B,OAAgB,WAAoB,gBAAyB;AAC9F,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,CAAC,SAAS,CAAC,aAAa,CAAC,gBAAgB;AAC3C,cAAQ;AAAA,QACN;AAAA,MAAA;AAAA,IAEJ;AAAA,EACF;AACF;AA4BO,MAAM,eAAe,MAAM,WAAgD,CAAC,OAAO,QAAQ;AAChG,QAAM;AAAA,IACJ;AAAA,IACA,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB;AAAA,IACA,OAAO;AAAA,IACP,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,WAAW;AA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