@fanvue/ui 3.51.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 (165) 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/Drawer/Drawer.cjs +11 -3
  24. package/dist/cjs/components/Drawer/Drawer.cjs.map +1 -1
  25. package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs +33 -10
  26. package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs.map +1 -1
  27. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs +2 -1
  28. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs.map +1 -1
  29. package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs +18 -13
  30. package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs.map +1 -1
  31. package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs +56 -40
  32. package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs.map +1 -1
  33. package/dist/cjs/components/IconButton/IconButton.cjs +5 -2
  34. package/dist/cjs/components/IconButton/IconButton.cjs.map +1 -1
  35. package/dist/cjs/components/Icons/MenuRowIcon.cjs +9 -2
  36. package/dist/cjs/components/Icons/MenuRowIcon.cjs.map +1 -1
  37. package/dist/cjs/components/Icons/VerifiedIcon.cjs +9 -15
  38. package/dist/cjs/components/Icons/VerifiedIcon.cjs.map +1 -1
  39. package/dist/cjs/components/InlineEmptyState/InlineEmptyState.cjs +42 -0
  40. package/dist/cjs/components/InlineEmptyState/InlineEmptyState.cjs.map +1 -0
  41. package/dist/cjs/components/Link/Link.cjs +30 -7
  42. package/dist/cjs/components/Link/Link.cjs.map +1 -1
  43. package/dist/cjs/components/PhoneField/PhoneField.cjs +21 -17
  44. package/dist/cjs/components/PhoneField/PhoneField.cjs.map +1 -1
  45. package/dist/cjs/components/Popover/Popover.cjs +69 -0
  46. package/dist/cjs/components/Popover/Popover.cjs.map +1 -0
  47. package/dist/cjs/components/SegmentedControl/SegmentedControl.cjs +6 -10
  48. package/dist/cjs/components/SegmentedControl/SegmentedControl.cjs.map +1 -1
  49. package/dist/cjs/components/SegmentedControl/segmentedControlClassNames.cjs +54 -0
  50. package/dist/cjs/components/SegmentedControl/segmentedControlClassNames.cjs.map +1 -0
  51. package/dist/cjs/components/Select/Select.cjs +40 -12
  52. package/dist/cjs/components/Select/Select.cjs.map +1 -1
  53. package/dist/cjs/components/Slider/SliderThumb.cjs +3 -2
  54. package/dist/cjs/components/Slider/SliderThumb.cjs.map +1 -1
  55. package/dist/cjs/components/Snackbar/Snackbar.cjs +1 -1
  56. package/dist/cjs/components/Snackbar/Snackbar.cjs.map +1 -1
  57. package/dist/cjs/components/Switch/Switch.cjs +1 -1
  58. package/dist/cjs/components/Switch/Switch.cjs.map +1 -1
  59. package/dist/cjs/components/Table/Table.cjs +77 -7
  60. package/dist/cjs/components/Table/Table.cjs.map +1 -1
  61. package/dist/cjs/components/Table/TableRowLink.cjs +55 -0
  62. package/dist/cjs/components/Table/TableRowLink.cjs.map +1 -0
  63. package/dist/cjs/components/Tag/Tag.cjs +99 -0
  64. package/dist/cjs/components/Tag/Tag.cjs.map +1 -0
  65. package/dist/cjs/components/TextArea/TextArea.cjs +5 -4
  66. package/dist/cjs/components/TextArea/TextArea.cjs.map +1 -1
  67. package/dist/cjs/components/TextField/TextField.cjs +30 -15
  68. package/dist/cjs/components/TextField/TextField.cjs.map +1 -1
  69. package/dist/cjs/index.cjs +12 -0
  70. package/dist/cjs/index.cjs.map +1 -1
  71. package/dist/cjs/utils/floatingContentSurface.cjs +8 -0
  72. package/dist/cjs/utils/floatingContentSurface.cjs.map +1 -0
  73. package/dist/cjs/utils/inputFieldClasses.cjs +8 -0
  74. package/dist/cjs/utils/inputFieldClasses.cjs.map +1 -0
  75. package/dist/cjs/utils/pointerCapture.cjs +20 -0
  76. package/dist/cjs/utils/pointerCapture.cjs.map +1 -0
  77. package/dist/cjs/utils/useDragToDismiss.cjs +3 -2
  78. package/dist/cjs/utils/useDragToDismiss.cjs.map +1 -1
  79. package/dist/cjs/utils/useSuppressClickAfterDrag.cjs +2 -1
  80. package/dist/cjs/utils/useSuppressClickAfterDrag.cjs.map +1 -1
  81. package/dist/components/Autocomplete/Autocomplete.mjs +34 -10
  82. package/dist/components/Autocomplete/Autocomplete.mjs.map +1 -1
  83. package/dist/components/Autocomplete/AutocompleteOptionItem.mjs +13 -1
  84. package/dist/components/Autocomplete/AutocompleteOptionItem.mjs.map +1 -1
  85. package/dist/components/BottomNavigation/BottomNavigation.mjs +2 -2
  86. package/dist/components/BottomNavigation/BottomNavigation.mjs.map +1 -1
  87. package/dist/components/Card/Card.mjs +5 -2
  88. package/dist/components/Card/Card.mjs.map +1 -1
  89. package/dist/components/Chart/ChartCard.mjs +2 -1
  90. package/dist/components/Chart/ChartCard.mjs.map +1 -1
  91. package/dist/components/Chart/ChartLoadingOverlay.mjs +1 -1
  92. package/dist/components/Chart/ChartLoadingOverlay.mjs.map +1 -1
  93. package/dist/components/ChatInput/ChatInput.mjs +2 -2
  94. package/dist/components/ChatInput/ChatInput.mjs.map +1 -1
  95. package/dist/components/ChatMessage/ChatMessage.mjs +1 -1
  96. package/dist/components/ChatMessage/ChatMessage.mjs.map +1 -1
  97. package/dist/components/CreatorCard/CreatorCard.mjs +3 -5
  98. package/dist/components/CreatorCard/CreatorCard.mjs.map +1 -1
  99. package/dist/components/CreatorCover/CreatorCover.mjs +11 -7
  100. package/dist/components/CreatorCover/CreatorCover.mjs.map +1 -1
  101. package/dist/components/DatePicker/DatePicker.mjs +39 -18
  102. package/dist/components/DatePicker/DatePicker.mjs.map +1 -1
  103. package/dist/components/Drawer/Drawer.mjs +11 -3
  104. package/dist/components/Drawer/Drawer.mjs.map +1 -1
  105. package/dist/components/DropdownMenu/DropdownMenuItem.mjs +33 -10
  106. package/dist/components/DropdownMenu/DropdownMenuItem.mjs.map +1 -1
  107. package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs +2 -1
  108. package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs.map +1 -1
  109. package/dist/components/DropdownMenu/DropdownMenuRoot.mjs +18 -13
  110. package/dist/components/DropdownMenu/DropdownMenuRoot.mjs.map +1 -1
  111. package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs +56 -40
  112. package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs.map +1 -1
  113. package/dist/components/IconButton/IconButton.mjs +5 -2
  114. package/dist/components/IconButton/IconButton.mjs.map +1 -1
  115. package/dist/components/Icons/MenuRowIcon.mjs +9 -2
  116. package/dist/components/Icons/MenuRowIcon.mjs.map +1 -1
  117. package/dist/components/Icons/VerifiedIcon.mjs +9 -15
  118. package/dist/components/Icons/VerifiedIcon.mjs.map +1 -1
  119. package/dist/components/InlineEmptyState/InlineEmptyState.mjs +25 -0
  120. package/dist/components/InlineEmptyState/InlineEmptyState.mjs.map +1 -0
  121. package/dist/components/Link/Link.mjs +31 -8
  122. package/dist/components/Link/Link.mjs.map +1 -1
  123. package/dist/components/PhoneField/PhoneField.mjs +21 -17
  124. package/dist/components/PhoneField/PhoneField.mjs.map +1 -1
  125. package/dist/components/Popover/Popover.mjs +51 -0
  126. package/dist/components/Popover/Popover.mjs.map +1 -0
  127. package/dist/components/SegmentedControl/SegmentedControl.mjs +6 -10
  128. package/dist/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
  129. package/dist/components/SegmentedControl/segmentedControlClassNames.mjs +54 -0
  130. package/dist/components/SegmentedControl/segmentedControlClassNames.mjs.map +1 -0
  131. package/dist/components/Select/Select.mjs +40 -12
  132. package/dist/components/Select/Select.mjs.map +1 -1
  133. package/dist/components/Slider/SliderThumb.mjs +3 -2
  134. package/dist/components/Slider/SliderThumb.mjs.map +1 -1
  135. package/dist/components/Snackbar/Snackbar.mjs +1 -1
  136. package/dist/components/Snackbar/Snackbar.mjs.map +1 -1
  137. package/dist/components/Switch/Switch.mjs +1 -1
  138. package/dist/components/Switch/Switch.mjs.map +1 -1
  139. package/dist/components/Table/Table.mjs +77 -7
  140. package/dist/components/Table/Table.mjs.map +1 -1
  141. package/dist/components/Table/TableRowLink.mjs +38 -0
  142. package/dist/components/Table/TableRowLink.mjs.map +1 -0
  143. package/dist/components/Tag/Tag.mjs +82 -0
  144. package/dist/components/Tag/Tag.mjs.map +1 -0
  145. package/dist/components/TextArea/TextArea.mjs +5 -4
  146. package/dist/components/TextArea/TextArea.mjs.map +1 -1
  147. package/dist/components/TextField/TextField.mjs +30 -15
  148. package/dist/components/TextField/TextField.mjs.map +1 -1
  149. package/dist/date-picker.d.ts +9 -0
  150. package/dist/index.d.ts +339 -30
  151. package/dist/index.mjs +12 -0
  152. package/dist/index.mjs.map +1 -1
  153. package/dist/styles/base.css +8 -4
  154. package/dist/styles/theme.css +1217 -1
  155. package/dist/utils/floatingContentSurface.mjs +8 -0
  156. package/dist/utils/floatingContentSurface.mjs.map +1 -0
  157. package/dist/utils/inputFieldClasses.mjs +8 -0
  158. package/dist/utils/inputFieldClasses.mjs.map +1 -0
  159. package/dist/utils/pointerCapture.mjs +20 -0
  160. package/dist/utils/pointerCapture.mjs.map +1 -0
  161. package/dist/utils/useDragToDismiss.mjs +3 -2
  162. package/dist/utils/useDragToDismiss.mjs.map +1 -1
  163. package/dist/utils/useSuppressClickAfterDrag.mjs +2 -1
  164. package/dist/utils/useSuppressClickAfterDrag.mjs.map +1 -1
  165. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.cjs","sources":["../../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { CheckOutlineIcon } from \"../Icons/CheckOutlineIcon\";\nimport { CloseIcon } from \"../Icons/CloseIcon\";\n\n/** Text area height in pixels. */\nexport type TextAreaSize = \"48\" | \"40\" | \"32\";\n\nexport interface TextAreaProps\n extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, \"size\"> {\n /** Label text displayed above the textarea. Also used as the accessible name. */\n label?: string;\n /** Helper text displayed below the textarea. Replaced by `errorMessage` when `error` is `true`. */\n helperText?: string;\n /** Minimum height of the text area in pixels. @default \"48\" */\n size?: TextAreaSize;\n /** Whether the text area is in an error state. @default false */\n error?: boolean;\n /** Error message displayed below the textarea. Shown instead of `helperText` when `error` is `true`. */\n errorMessage?: string;\n /** Whether the text area is validated. @default false */\n validated?: boolean;\n /** Whether the text area stretches to fill its container width. @default false */\n fullWidth?: boolean;\n /** Whether to show a clear button when text is present. @default false */\n showClearButton?: boolean;\n /** Callback fired when the clear button is clicked. Note: `onChange` is also called with an empty value when clearing. */\n onClear?: () => void;\n /** Minimum number of rows (lines) for the textarea. */\n minRows?: number;\n /** Maximum number of rows (lines) for the textarea. */\n maxRows?: number;\n /** Whether the textarea can be resized by the user. @default true */\n resizable?: boolean;\n}\n\nconst CONTAINER_MIN_HEIGHT: Record<TextAreaSize, string> = {\n \"48\": \"min-h-12\",\n \"40\": \"min-h-10\",\n \"32\": \"min-h-8\",\n};\n\nconst TEXTAREA_SIZE_CLASSES: Record<TextAreaSize, string> = {\n \"48\": \"py-3 typography-body-default-16px-regular autofill-body-lg\",\n \"40\": \"py-2 typography-body-default-16px-regular autofill-body-lg\",\n \"32\": \"py-2 typography-body-small-14px-regular autofill-body-md\",\n};\n\nconst PADDING_HORIZONTAL: Record<TextAreaSize, string> = {\n \"48\": \"px-4\",\n \"40\": \"px-4\",\n \"32\": \"px-3\",\n};\n\nconst PADDING_RIGHT_WITH_CLEAR: Record<TextAreaSize, string> = {\n \"48\": \"pr-11\",\n \"40\": \"pr-11\",\n \"32\": \"pr-10\",\n};\n\nconst CLEAR_BUTTON_RIGHT: Record<TextAreaSize, string> = {\n \"48\": \"right-4 top-3\",\n \"40\": \"right-4 top-2\",\n \"32\": \"right-3 top-2\",\n};\n\nfunction getContainerClassName(size: TextAreaSize, error: boolean, disabled?: boolean) {\n return cn(\n \"relative 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 error ? \"border-error-content\" : \"border-border-primary\",\n !disabled && !error && \"hover:border-neutral-alphas-400\",\n CONTAINER_MIN_HEIGHT[size],\n disabled && \"opacity-50\",\n );\n}\n\nfunction getTextareaClassName(\n size: TextAreaSize,\n hasClearButton: boolean,\n hasMinRows: boolean,\n resizable: boolean,\n) {\n return cn(\n \"h-full w-full bg-transparent text-content-primary no-underline placeholder:text-content-tertiary focus:outline-none disabled:cursor-not-allowed\",\n resizable ? \"resize-y\" : \"resize-none\",\n !hasMinRows && \"min-h-[80px]\",\n TEXTAREA_SIZE_CLASSES[size],\n PADDING_HORIZONTAL[size],\n hasClearButton ? PADDING_RIGHT_WITH_CLEAR[size] : \"\",\n );\n}\n\nfunction TextAreaHelperText({\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 \"TextArea: no accessible name provided. Pass a `label`, `aria-label`, or `aria-labelledby` prop.\",\n );\n }\n }\n}\n\nfunction calculateMaxHeight(size: TextAreaSize, maxRows?: number): string | undefined {\n if (!maxRows) return undefined;\n\n // Line height is 24px for body-1 (sizes 48 and 40) and 20px for body-2 (size 32)\n const lineHeight = size === \"32\" ? 20 : 24;\n // py-2 = 8px, py-3 = 12px\n const verticalPadding = size === \"32\" ? 8 : size === \"40\" ? 8 : 12;\n\n return `${lineHeight * maxRows + verticalPadding * 2}px`;\n}\n\nfunction useTextAreaValue(\n value: React.TextareaHTMLAttributes<HTMLTextAreaElement>[\"value\"],\n defaultValue: React.TextareaHTMLAttributes<HTMLTextAreaElement>[\"defaultValue\"],\n showClearButton: boolean,\n onChange?: React.ChangeEventHandler<HTMLTextAreaElement>,\n onClear?: () => void,\n textareaRef?: React.RefObject<HTMLTextAreaElement | null>,\n) {\n const [internalValue, setInternalValue] = React.useState(defaultValue ?? \"\");\n const resolvedValue = value !== undefined ? value : internalValue;\n\n const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setInternalValue(e.target.value);\n onChange?.(e);\n };\n\n const handleClear = () => {\n setInternalValue(\"\");\n\n if (onChange && textareaRef?.current) {\n const syntheticEvent = {\n target: { ...textareaRef.current, value: \"\" },\n currentTarget: { ...textareaRef.current, value: \"\" },\n } as React.ChangeEvent<HTMLTextAreaElement>;\n onChange(syntheticEvent);\n }\n\n onClear?.();\n };\n\n return {\n resolvedValue,\n displayValue: showClearButton ? resolvedValue : value,\n resolvedDefaultValue: showClearButton ? undefined : defaultValue,\n handleChange,\n handleClear,\n };\n}\n\n/**\n * A multi-line text input with optional label, helper/error text, and clear button.\n *\n * Provide at least one of `label`, `aria-label`, or `aria-labelledby` for\n * accessibility — a console warning is emitted in development if none are set.\n *\n * @example\n * ```tsx\n * <TextArea\n * label=\"Description\"\n * placeholder=\"Enter your description...\"\n * showClearButton\n * error={!!descError}\n * errorMessage={descError}\n * />\n * ```\n */\nexport const TextArea = React.forwardRef<HTMLTextAreaElement, TextAreaProps>(\n (\n {\n label,\n helperText,\n size = \"48\",\n error = false,\n errorMessage,\n validated = false,\n className,\n id,\n disabled,\n fullWidth = false,\n showClearButton = false,\n onClear,\n value,\n defaultValue,\n onChange,\n minRows,\n maxRows,\n resizable = false,\n ...props\n },\n ref,\n ) => {\n const generatedId = React.useId();\n const inputId = id || generatedId;\n const helperTextId = `${inputId}-helper`;\n const bottomText = error && errorMessage ? errorMessage : helperText;\n const maxHeight = calculateMaxHeight(size, maxRows);\n\n const internalRef = React.useRef<HTMLTextAreaElement>(null);\n\n const { resolvedValue, displayValue, resolvedDefaultValue, handleChange, handleClear } =\n useTextAreaValue(value, defaultValue, showClearButton, onChange, onClear, internalRef);\n\n const mergedRef = (node: HTMLTextAreaElement | null) => {\n internalRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLTextAreaElement | null>).current = node;\n }\n };\n\n const showClear = showClearButton && resolvedValue !== \"\" && !disabled;\n const showValidated = validated && !showClear;\n const ariaDescribedBy = bottomText ? helperTextId : undefined;\n const textareaStyle = maxHeight ? { maxHeight } : undefined;\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 <div className={getContainerClassName(size, error, disabled)}>\n <textarea\n ref={mergedRef}\n id={inputId}\n disabled={disabled}\n aria-describedby={ariaDescribedBy}\n aria-invalid={error || undefined}\n className={getTextareaClassName(size, showClear, !!minRows, resizable)}\n value={displayValue}\n defaultValue={resolvedDefaultValue}\n onChange={handleChange}\n rows={minRows}\n style={textareaStyle}\n {...props}\n />\n\n {showClear && (\n <IconButton\n variant=\"tertiary\"\n size=\"24\"\n icon={<CloseIcon />}\n aria-label=\"Clear text\"\n onClick={handleClear}\n className={cn(\n \"absolute flex size-5 items-center justify-center self-end\",\n CLEAR_BUTTON_RIGHT[size],\n )}\n />\n )}\n {showValidated && (\n <div\n className={cn(\n \"pointer-events-none absolute flex size-5 items-center justify-center\",\n CLEAR_BUTTON_RIGHT[size],\n )}\n >\n <CheckOutlineIcon className=\"text-success-content\" />\n </div>\n )}\n </div>\n\n {bottomText && (\n <TextAreaHelperText id={helperTextId} error={error}>\n {bottomText}\n </TextAreaHelperText>\n )}\n </div>\n );\n },\n);\n\nTextArea.displayName = \"TextArea\";\n"],"names":["cn","jsx","React","jsxs","IconButton","CloseIcon","CheckOutlineIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAM,uBAAqD;AAAA,EACzD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,wBAAsD;AAAA,EAC1D,MAA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gBACN,OAAO;AAAA,gBACN,GAAG;AAAA,cAAA;AAAA,YAAA;AAAA,YAGL,aACCA,2BAAAA;AAAAA,cAACG,WAAAA;AAAAA,cAAA;AAAA,gBACC,SAAQ;AAAA,gBACR,MAAK;AAAA,gBACL,qCAAOC,UAAAA,WAAA,EAAU;AAAA,gBACjB,cAAW;AAAA,gBACX,SAAS;AAAA,gBACT,WAAWL,GAAAA;AAAAA,kBACT;AAAA,kBACA,mBAAmB,IAAI;AAAA,gBAAA;AAAA,cACzB;AAAA,YAAA;AAAA,YAGH,iBACCC,2BAAAA;AAAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAWD,GAAAA;AAAAA,kBACT;AAAA,kBACA,mBAAmB,IAAI;AAAA,gBAAA;AAAA,gBAGzB,UAAAC,2BAAAA,IAACK,iBAAAA,kBAAA,EAAiB,WAAU,uBAAA,CAAuB;AAAA,cAAA;AAAA,YAAA;AAAA,UACrD,GAEJ;AAAA,UAEC,cACCL,2BAAAA,IAAC,oBAAA,EAAmB,IAAI,cAAc,OACnC,UAAA,WAAA,CACH;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,SAAS,cAAc;;"}
1
+ {"version":3,"file":"TextArea.cjs","sources":["../../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport {\n INPUT_FIELD_DISABLED_CLASSES,\n INPUT_FIELD_V2_FOCUS_CLASSES,\n} from \"../../utils/inputFieldClasses\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { CheckOutlineIcon } from \"../Icons/CheckOutlineIcon\";\nimport { CloseIcon } from \"../Icons/CloseIcon\";\n\n/** Text area height in pixels. */\nexport type TextAreaSize = \"48\" | \"40\" | \"32\";\n\nexport interface TextAreaProps\n extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, \"size\"> {\n /** Label text displayed above the textarea. Also used as the accessible name. */\n label?: string;\n /** Helper text displayed below the textarea. Replaced by `errorMessage` when `error` is `true`. */\n helperText?: string;\n /** Minimum height of the text area in pixels. @default \"48\" */\n size?: TextAreaSize;\n /** Whether the text area is in an error state. @default false */\n error?: boolean;\n /** Error message displayed below the textarea. Shown instead of `helperText` when `error` is `true`. */\n errorMessage?: string;\n /** Whether the text area is validated. @default false */\n validated?: boolean;\n /** Whether the text area stretches to fill its container width. @default false */\n fullWidth?: boolean;\n /** Whether to show a clear button when text is present. @default false */\n showClearButton?: boolean;\n /** Callback fired when the clear button is clicked. Note: `onChange` is also called with an empty value when clearing. */\n onClear?: () => void;\n /** Minimum number of rows (lines) for the textarea. */\n minRows?: number;\n /** Maximum number of rows (lines) for the textarea. */\n maxRows?: number;\n /** Whether the textarea can be resized by the user. @default true */\n resizable?: boolean;\n}\n\nconst CONTAINER_MIN_HEIGHT: Record<TextAreaSize, string> = {\n \"48\": \"min-h-12\",\n \"40\": \"min-h-10\",\n \"32\": \"min-h-8\",\n};\n\nconst TEXTAREA_SIZE_CLASSES: Record<TextAreaSize, string> = {\n \"48\": \"py-3 typography-body-default-16px-regular autofill-body-lg\",\n \"40\": \"py-2 typography-body-default-16px-regular autofill-body-lg\",\n \"32\": \"py-2 typography-body-small-14px-regular autofill-body-md\",\n};\n\nconst PADDING_HORIZONTAL: Record<TextAreaSize, string> = {\n \"48\": \"px-4\",\n \"40\": \"px-4\",\n \"32\": \"px-3\",\n};\n\nconst PADDING_RIGHT_WITH_CLEAR: Record<TextAreaSize, string> = {\n \"48\": \"pr-11\",\n \"40\": \"pr-11\",\n \"32\": \"pr-10\",\n};\n\nconst CLEAR_BUTTON_RIGHT: Record<TextAreaSize, string> = {\n \"48\": \"right-4 top-3\",\n \"40\": \"right-4 top-2\",\n \"32\": \"right-3 top-2\",\n};\n\nfunction getContainerClassName(size: TextAreaSize, error: boolean, disabled?: boolean) {\n return cn(\n \"relative 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 error ? \"border-error-content\" : [\"border-border-input\", INPUT_FIELD_V2_FOCUS_CLASSES],\n !disabled && !error && \"hover:border-border-input-hover\",\n CONTAINER_MIN_HEIGHT[size],\n disabled && INPUT_FIELD_DISABLED_CLASSES,\n );\n}\n\nfunction getTextareaClassName(\n size: TextAreaSize,\n hasClearButton: boolean,\n hasMinRows: boolean,\n resizable: boolean,\n) {\n return cn(\n \"h-full w-full 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 resizable ? \"resize-y\" : \"resize-none\",\n !hasMinRows && \"min-h-[80px]\",\n TEXTAREA_SIZE_CLASSES[size],\n PADDING_HORIZONTAL[size],\n hasClearButton ? PADDING_RIGHT_WITH_CLEAR[size] : \"\",\n );\n}\n\nfunction TextAreaHelperText({\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 \"TextArea: no accessible name provided. Pass a `label`, `aria-label`, or `aria-labelledby` prop.\",\n );\n }\n }\n}\n\nfunction calculateMaxHeight(size: TextAreaSize, maxRows?: number): string | undefined {\n if (!maxRows) return undefined;\n\n // Line height is 24px for body-1 (sizes 48 and 40) and 20px for body-2 (size 32)\n const lineHeight = size === \"32\" ? 20 : 24;\n // py-2 = 8px, py-3 = 12px\n const verticalPadding = size === \"32\" ? 8 : size === \"40\" ? 8 : 12;\n\n return `${lineHeight * maxRows + verticalPadding * 2}px`;\n}\n\nfunction useTextAreaValue(\n value: React.TextareaHTMLAttributes<HTMLTextAreaElement>[\"value\"],\n defaultValue: React.TextareaHTMLAttributes<HTMLTextAreaElement>[\"defaultValue\"],\n showClearButton: boolean,\n onChange?: React.ChangeEventHandler<HTMLTextAreaElement>,\n onClear?: () => void,\n textareaRef?: React.RefObject<HTMLTextAreaElement | null>,\n) {\n const [internalValue, setInternalValue] = React.useState(defaultValue ?? \"\");\n const resolvedValue = value !== undefined ? value : internalValue;\n\n const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setInternalValue(e.target.value);\n onChange?.(e);\n };\n\n const handleClear = () => {\n setInternalValue(\"\");\n\n if (onChange && textareaRef?.current) {\n const syntheticEvent = {\n target: { ...textareaRef.current, value: \"\" },\n currentTarget: { ...textareaRef.current, value: \"\" },\n } as React.ChangeEvent<HTMLTextAreaElement>;\n onChange(syntheticEvent);\n }\n\n onClear?.();\n };\n\n return {\n resolvedValue,\n displayValue: showClearButton ? resolvedValue : value,\n resolvedDefaultValue: showClearButton ? undefined : defaultValue,\n handleChange,\n handleClear,\n };\n}\n\n/**\n * A multi-line text input with optional label, helper/error text, and clear button.\n *\n * Provide at least one of `label`, `aria-label`, or `aria-labelledby` for\n * accessibility — a console warning is emitted in development if none are set.\n *\n * @example\n * ```tsx\n * <TextArea\n * label=\"Description\"\n * placeholder=\"Enter your description...\"\n * showClearButton\n * error={!!descError}\n * errorMessage={descError}\n * />\n * ```\n */\nexport const TextArea = React.forwardRef<HTMLTextAreaElement, TextAreaProps>(\n (\n {\n label,\n helperText,\n size = \"48\",\n error = false,\n errorMessage,\n validated = false,\n className,\n id,\n disabled,\n fullWidth = false,\n showClearButton = false,\n onClear,\n value,\n defaultValue,\n onChange,\n minRows,\n maxRows,\n resizable = false,\n ...props\n },\n ref,\n ) => {\n const generatedId = React.useId();\n const inputId = id || generatedId;\n const helperTextId = `${inputId}-helper`;\n const bottomText = error && errorMessage ? errorMessage : helperText;\n const maxHeight = calculateMaxHeight(size, maxRows);\n\n const internalRef = React.useRef<HTMLTextAreaElement>(null);\n\n const { resolvedValue, displayValue, resolvedDefaultValue, handleChange, handleClear } =\n useTextAreaValue(value, defaultValue, showClearButton, onChange, onClear, internalRef);\n\n const mergedRef = (node: HTMLTextAreaElement | null) => {\n internalRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLTextAreaElement | null>).current = node;\n }\n };\n\n const showClear = showClearButton && resolvedValue !== \"\" && !disabled;\n const showValidated = validated && !showClear;\n const ariaDescribedBy = bottomText ? helperTextId : undefined;\n const textareaStyle = maxHeight ? { maxHeight } : undefined;\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 <div className={getContainerClassName(size, error, disabled)}>\n <textarea\n ref={mergedRef}\n id={inputId}\n disabled={disabled}\n aria-describedby={ariaDescribedBy}\n aria-invalid={error || undefined}\n className={getTextareaClassName(size, showClear, !!minRows, resizable)}\n value={displayValue}\n defaultValue={resolvedDefaultValue}\n onChange={handleChange}\n rows={minRows}\n style={textareaStyle}\n {...props}\n />\n\n {showClear && (\n <IconButton\n variant=\"tertiary\"\n size=\"24\"\n icon={<CloseIcon />}\n aria-label=\"Clear text\"\n onClick={handleClear}\n className={cn(\n \"absolute flex size-5 items-center justify-center self-end\",\n CLEAR_BUTTON_RIGHT[size],\n )}\n />\n )}\n {showValidated && (\n <div\n className={cn(\n \"pointer-events-none absolute flex size-5 items-center justify-center\",\n CLEAR_BUTTON_RIGHT[size],\n )}\n >\n <CheckOutlineIcon className=\"text-success-content\" />\n </div>\n )}\n </div>\n\n {bottomText && (\n <TextAreaHelperText id={helperTextId} error={error}>\n {bottomText}\n </TextAreaHelperText>\n )}\n </div>\n );\n },\n);\n\nTextArea.displayName = \"TextArea\";\n"],"names":["cn","INPUT_FIELD_V2_FOCUS_CLASSES","INPUT_FIELD_DISABLED_CLASSES","jsx","React","jsxs","IconButton","CloseIcon","CheckOutlineIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAM,uBAAqD;AAAA,EACzD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,wBAAsD;AAAA,EAC1D,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,qBAAmD;AAAA,EACvD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,2BAAyD;AAAA,EAC7D,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,qBAAmD;AAAA,EACvD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,SAAS,sBAAsB,MAAoB,OAAgB,UAAoB;AACrF,SAAOA,GAAAA;AAAAA,IACL;AAAA,IACA,QAAQ,yBAAyB,CAAC,uBAAuBC,8CAA4B;AAAA,IACrF,CAAC,YAAY,CAAC,SAAS;AAAA,IACvB,qBAAqB,IAAI;AAAA,IACzB,YAAYC,kBAAAA;AAAAA,EAAA;AAEhB;AAEA,SAAS,qBACP,MACA,gBACA,YACA,WACA;AACA,SAAOF,GAAAA;AAAAA,IACL;AAAA,IACA,YAAY,aAAa;AAAA,IACzB,CAAC,cAAc;AAAA,IACf,sBAAsB,IAAI;AAAA,IAC1B,mBAAmB,IAAI;AAAA,IACvB,iBAAiB,yBAAyB,IAAI,IAAI;AAAA,EAAA;AAEtD;AAEA,SAAS,mBAAmB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,SACEG,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAWH,GAAAA;AAAAA,QACT;AAAA,QACA,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AAA,0CAIJ,OAAA,EAAI,WAAW,sBAAsB,MAAM,OAAO,QAAQ,GACzD,UAAA;AAAA,YAAAA,2BAAAA;AAAAA,cAAC;AAAA,cAAA;AAAA,gBACC,KAAK;AAAA,gBACL,IAAI;AAAA,gBACJ;AAAA,gBACA,oBAAkB;AAAA,gBAClB,gBAAc,SAAS;AAAA,gBACvB,WAAW,qBAAqB,MAAM,WAAW,CAAC,CAAC,SAAS,SAAS;AAAA,gBACrE,OAAO;AAAA,gBACP,cAAc;AAAA,gBACd,UAAU;AAAA,gBACV,MAAM;AAAA,gBACN,OAAO;AAAA,gBACN,GAAG;AAAA,cAAA;AAAA,YAAA;AAAA,YAGL,aACCA,2BAAAA;AAAAA,cAACG,WAAAA;AAAAA,cAAA;AAAA,gBACC,SAAQ;AAAA,gBACR,MAAK;AAAA,gBACL,qCAAOC,UAAAA,WAAA,EAAU;AAAA,gBACjB,cAAW;AAAA,gBACX,SAAS;AAAA,gBACT,WAAWP,GAAAA;AAAAA,kBACT;AAAA,kBACA,mBAAmB,IAAI;AAAA,gBAAA;AAAA,cACzB;AAAA,YAAA;AAAA,YAGH,iBACCG,2BAAAA;AAAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAWH,GAAAA;AAAAA,kBACT;AAAA,kBACA,mBAAmB,IAAI;AAAA,gBAAA;AAAA,gBAGzB,UAAAG,2BAAAA,IAACK,iBAAAA,kBAAA,EAAiB,WAAU,uBAAA,CAAuB;AAAA,cAAA;AAAA,YAAA;AAAA,UACrD,GAEJ;AAAA,UAEC,cACCL,2BAAAA,IAAC,oBAAA,EAAmB,IAAI,cAAc,OACnC,UAAA,WAAA,CACH;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,SAAS,cAAc;;"}
@@ -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,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AAA,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;;"}
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\";\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":";;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,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,CAAC,uBAAuBC,8CAA4B;AAAA,IACrF,CAAC,YAAY,CAAC,SAAS;AAAA,IACvB,iBAAiB,IAAI;AAAA,IACrB,YAAYC,kBAAAA;AAAAA,EAAA;AAEhB;AAEA,SAAS,YAAY;AAAA,EACnB,OAAO;AAAA,EACP;AAAA,EACA;AACF,GAIG;AACD,MAAI,CAAC,SAAU,QAAO;AACtB,SACEC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWH,GAAAA;AAAAA,QACT;AAAA,QACA,SAAS,OAAO,WAAW;AAAA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AA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,UAAU,cAAc;;"}
@@ -226,6 +226,7 @@ const WifiOnIcon = require("./components/Icons/WifiOnIcon.cjs");
226
226
  const WrenchIcon = require("./components/Icons/WrenchIcon.cjs");
227
227
  const InfoBox = require("./components/InfoBox/InfoBox.cjs");
228
228
  const InlineEdit = require("./components/InlineEdit/InlineEdit.cjs");
229
+ const InlineEmptyState = require("./components/InlineEmptyState/InlineEmptyState.cjs");
229
230
  const Link = require("./components/Link/Link.cjs");
230
231
  const LiveStatus = require("./components/LiveStatus/LiveStatus.cjs");
231
232
  const Loader = require("./components/Loader/Loader.cjs");
@@ -239,6 +240,7 @@ const Pagination = require("./components/Pagination/Pagination.cjs");
239
240
  const PasswordField = require("./components/PasswordField/PasswordField.cjs");
240
241
  const PhoneField = require("./components/PhoneField/PhoneField.cjs");
241
242
  const Pill = require("./components/Pill/Pill.cjs");
243
+ const Popover = require("./components/Popover/Popover.cjs");
242
244
  const ProfileOnlineStatus = require("./components/ProfileOnlineStatus/ProfileOnlineStatus.cjs");
243
245
  const ProfileStatus = require("./components/ProfileStatus/ProfileStatus.cjs");
244
246
  const ProgressBar = require("./components/ProgressBar/ProgressBar.cjs");
@@ -264,12 +266,14 @@ const SwitchToggle = require("./components/SwitchToggle/SwitchToggle.cjs");
264
266
  const Table = require("./components/Table/Table.cjs");
265
267
  const TableMobileRow = require("./components/Table/TableMobileRow.cjs");
266
268
  const TablePagination = require("./components/Table/TablePagination.cjs");
269
+ const TableRowLink = require("./components/Table/TableRowLink.cjs");
267
270
  const Tabs = require("./components/Tabs/Tabs.cjs");
268
271
  const TabsContent = require("./components/Tabs/TabsContent.cjs");
269
272
  const TabsList = require("./components/Tabs/TabsList.cjs");
270
273
  const TabsListSkeleton = require("./components/Tabs/TabsListSkeleton.cjs");
271
274
  const TabsOverflow = require("./components/Tabs/TabsOverflow.cjs");
272
275
  const TabsTrigger = require("./components/Tabs/TabsTrigger.cjs");
276
+ const Tag = require("./components/Tag/Tag.cjs");
273
277
  const TextArea = require("./components/TextArea/TextArea.cjs");
274
278
  const TextField = require("./components/TextField/TextField.cjs");
275
279
  const Toast = require("./components/Toast/Toast.cjs");
@@ -559,6 +563,7 @@ exports.InfoBox = InfoBox.InfoBox;
559
563
  exports.InfoBoxContent = InfoBox.InfoBoxContent;
560
564
  exports.InfoBoxTrigger = InfoBox.InfoBoxTrigger;
561
565
  exports.InlineEdit = InlineEdit.InlineEdit;
566
+ exports.InlineEmptyState = InlineEmptyState.InlineEmptyState;
562
567
  exports.Link = Link.Link;
563
568
  exports.LiveStatus = LiveStatus.LiveStatus;
564
569
  exports.Loader = Loader.Loader;
@@ -573,6 +578,11 @@ exports.Pagination = Pagination.Pagination;
573
578
  exports.PasswordField = PasswordField.PasswordField;
574
579
  exports.PhoneField = PhoneField.PhoneField;
575
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;
576
586
  exports.ProfileOnlineStatus = ProfileOnlineStatus.ProfileOnlineStatus;
577
587
  exports.ProfileStatus = ProfileStatus.ProfileStatus;
578
588
  exports.ProgressBar = ProgressBar.ProgressBar;
@@ -627,6 +637,7 @@ exports.TableToolbarSearch = Table.TableToolbarSearch;
627
637
  exports.TableTruncatedText = Table.TableTruncatedText;
628
638
  exports.TableMobileRow = TableMobileRow.TableMobileRow;
629
639
  exports.TableCardPagination = TablePagination.TableCardPagination;
640
+ exports.TableRowLink = TableRowLink.TableRowLink;
630
641
  exports.Tabs = Tabs.Tabs;
631
642
  exports.TabsContent = TabsContent.TabsContent;
632
643
  exports.TabsList = TabsList.TabsList;
@@ -634,6 +645,7 @@ exports.TabsListSkeleton = TabsListSkeleton.TabsListSkeleton;
634
645
  exports.TabsOverflow = TabsOverflow.TabsOverflow;
635
646
  exports.TabsOverflowItem = TabsOverflow.TabsOverflowItem;
636
647
  exports.TabsTrigger = TabsTrigger.TabsTrigger;
648
+ exports.Tag = Tag.Tag;
637
649
  exports.TextArea = TextArea.TextArea;
638
650
  exports.TextField = TextField.TextField;
639
651
  exports.Toast = Toast.Toast;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -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,eA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AO;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;;;"}
1
+ {"version":3,"file":"useDragToDismiss.cjs","sources":["../../../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;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eAAe,KAAK,SAAS,MAAM,SAAS;AAC5C,aAAK,QAAQ,MAAM,aAAa;AAAA,MAClC;AACA,YAAM,UAAU,MAAM,YAAY,KAAK;AACvC,UAAI,UAAU,EAAG,MAAK,YAAY,MAAM,UAAU,KAAK,SAAS;AAChE,WAAK,QAAQ,MAAM;AACnB,WAAK,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",