periplo-ui 4.16.0 → 4.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/components/data-display/DataTable/components/DataTableCell.js +1 -1
  2. package/dist/components/data-display/DataTable/components/DataTableCell.js.map +1 -1
  3. package/dist/components/data-display/DataTable/components/DataTableGroupRow.js +1 -1
  4. package/dist/components/data-display/DataTable/components/DataTableGroupRow.js.map +1 -1
  5. package/dist/components/data-display/Marquee/Marquee.js +2 -2
  6. package/dist/components/data-display/Marquee/Marquee.js.map +1 -1
  7. package/dist/components/data-display/NotificationBadge/NotificationBadge.js +1 -1
  8. package/dist/components/data-display/NotificationBadge/NotificationBadge.js.map +1 -1
  9. package/dist/components/data-display/Tooltip/Tooltip.js +1 -1
  10. package/dist/components/data-display/Tooltip/Tooltip.js.map +1 -1
  11. package/dist/components/feedback/Dialog/Dialog.js +2 -2
  12. package/dist/components/feedback/Dialog/Dialog.js.map +1 -1
  13. package/dist/components/feedback/Progress/Progress.js +1 -1
  14. package/dist/components/feedback/Progress/Progress.js.map +1 -1
  15. package/dist/components/feedback/Skeleton/Skeleton.js +1 -1
  16. package/dist/components/feedback/Skeleton/Skeleton.js.map +1 -1
  17. package/dist/components/inputs/Button/Button.js +1 -1
  18. package/dist/components/inputs/Button/Button.js.map +1 -1
  19. package/dist/components/inputs/Checkbox/Checkbox.js +1 -1
  20. package/dist/components/inputs/Checkbox/Checkbox.js.map +1 -1
  21. package/dist/components/inputs/Combobox/Combobox.js +2 -1
  22. package/dist/components/inputs/Combobox/Combobox.js.map +1 -1
  23. package/dist/components/inputs/Combobox/StaticComboboxList.js +1 -2
  24. package/dist/components/inputs/Combobox/StaticComboboxList.js.map +1 -1
  25. package/dist/components/inputs/Combobox/VirtualizedComboboxList.js +1 -2
  26. package/dist/components/inputs/Combobox/VirtualizedComboboxList.js.map +1 -1
  27. package/dist/components/inputs/InlineMultiSelect/InlineMultiSelect.js +12 -13
  28. package/dist/components/inputs/InlineMultiSelect/InlineMultiSelect.js.map +1 -1
  29. package/dist/components/inputs/Input/Input.js +1 -1
  30. package/dist/components/inputs/Input/Input.js.map +1 -1
  31. package/dist/components/inputs/InputDate/InputDate.js +1 -1
  32. package/dist/components/inputs/InputDate/InputDate.js.map +1 -1
  33. package/dist/components/inputs/LazyDatePicker/LazyDatePicker.js +1 -1
  34. package/dist/components/inputs/LazyDatePicker/LazyDatePicker.js.map +1 -1
  35. package/dist/components/inputs/MultiSelect/MultiSelect.js +12 -13
  36. package/dist/components/inputs/MultiSelect/MultiSelect.js.map +1 -1
  37. package/dist/components/inputs/PhoneInput/PhoneInput.js +2 -1
  38. package/dist/components/inputs/PhoneInput/PhoneInput.js.map +1 -1
  39. package/dist/components/inputs/RadioGroup/RadioGroup.js +1 -1
  40. package/dist/components/inputs/RadioGroup/RadioGroup.js.map +1 -1
  41. package/dist/components/inputs/Select/Select.js +6 -5
  42. package/dist/components/inputs/Select/Select.js.map +1 -1
  43. package/dist/components/inputs/Textarea/Textarea.js +1 -1
  44. package/dist/components/inputs/Textarea/Textarea.js.map +1 -1
  45. package/dist/components/inputs/Toggle/Toggle.js +1 -1
  46. package/dist/components/inputs/Toggle/Toggle.js.map +1 -1
  47. package/dist/components/navigation/DropdownMenu/DropdownMenu.js +7 -6
  48. package/dist/components/navigation/DropdownMenu/DropdownMenu.js.map +1 -1
  49. package/dist/components/navigation/Sheet/Sheet.js +2 -2
  50. package/dist/components/navigation/Sheet/Sheet.js.map +1 -1
  51. package/dist/components/navigation/Sidebar/Sidebar.js +6 -2
  52. package/dist/components/navigation/Sidebar/Sidebar.js.map +1 -1
  53. package/dist/components/navigation/Sidebar/SidebarMenu.js +29 -55
  54. package/dist/components/navigation/Sidebar/SidebarMenu.js.map +1 -1
  55. package/dist/components/navigation/Sidebar/SidebarUser.d.ts +3 -1
  56. package/dist/components/navigation/Sidebar/SidebarUser.js +18 -5
  57. package/dist/components/navigation/Sidebar/SidebarUser.js.map +1 -1
  58. package/dist/components/navigation/Sidebar/index.js +2 -2
  59. package/dist/components/navigation/Sidebar/styles.d.ts +2 -2
  60. package/dist/components/navigation/Sidebar/styles.js +4 -2
  61. package/dist/components/navigation/Sidebar/styles.js.map +1 -1
  62. package/dist/components/navigation/Tabs/Tabs.js +1 -1
  63. package/dist/components/navigation/Tabs/Tabs.js.map +1 -1
  64. package/dist/components/surface/Accordion/Accordion.js +3 -3
  65. package/dist/components/surface/Accordion/Accordion.js.map +1 -1
  66. package/dist/components/utils/Command/Command.js +8 -7
  67. package/dist/components/utils/Command/Command.js.map +1 -1
  68. package/dist/components/utils/Popover/Popover.js +2 -1
  69. package/dist/components/utils/Popover/Popover.js.map +1 -1
  70. package/dist/index.js +2 -2
  71. package/dist/lib/surface.d.ts +5 -0
  72. package/dist/lib/surface.js +10 -0
  73. package/dist/lib/surface.js.map +1 -0
  74. package/dist/lib/useSlidingIndicator.d.ts +22 -0
  75. package/dist/lib/useSlidingIndicator.js +65 -0
  76. package/dist/lib/useSlidingIndicator.js.map +1 -0
  77. package/dist/theme.css +46 -26
  78. package/package.json +1 -1
@@ -2,6 +2,7 @@
2
2
  "use client";
3
3
  import { cn } from "../../../lib/utils.js";
4
4
  import { Button, buttonVariants } from "../Button/Button.js";
5
+ import { SURFACE_LIST } from "../../../lib/surface.js";
5
6
  import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "../../utils/Command/Command.js";
6
7
  import { PopoverContent, PopoverRoot, PopoverTrigger } from "../../utils/Popover/Popover.js";
7
8
  import * as React$1 from "react";
@@ -57,12 +58,12 @@ var InlineMultiSelect = ({ options, value, onChange, defaultValue = [], placehol
57
58
  children: [/* @__PURE__ */ jsx(PopoverTrigger, {
58
59
  asChild: true,
59
60
  children: /* @__PURE__ */ jsxs(Button, {
60
- variant: "ghost",
61
+ variant: "text",
61
62
  "aria-expanded": open,
62
- className: cn("w-full justify-between bg-[#fff] pr-2 pl-2", fieldState?.invalid ? "border-error-400 focus-within:border-error-700" : "", buttonVariants({
63
- variant: "ghost",
63
+ className: cn(buttonVariants({
64
+ variant: "input",
64
65
  size: "lg"
65
- }), className),
66
+ }), "w-full justify-between", open && "border-neutral-950", fieldState?.invalid && "border-error-400 focus-visible:border-error-700", className),
66
67
  children: [/* @__PURE__ */ jsx("div", {
67
68
  ref: containerRef,
68
69
  className: "flex flex-1 flex-wrap items-center gap-1 overflow-hidden pr-2",
@@ -94,7 +95,7 @@ var InlineMultiSelect = ({ options, value, onChange, defaultValue = [], placehol
94
95
  }), /* @__PURE__ */ jsx(CaretUpDownIcon, { className: "h-4 w-4 opacity-50" })]
95
96
  })
96
97
  }), /* @__PURE__ */ jsxs(PopoverContent, {
97
- className: "px-0 py-0",
98
+ className: cn(SURFACE_LIST, "p-0"),
98
99
  children: [/* @__PURE__ */ jsx(CommandInput, {
99
100
  placeholder: commandInputPlaceholder ?? "Search...",
100
101
  disabled: loading,
@@ -105,7 +106,7 @@ var InlineMultiSelect = ({ options, value, onChange, defaultValue = [], placehol
105
106
  children: loadingPlaceholder
106
107
  }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CommandEmpty, { children: notFoundText ?? "Options not found" }), open && /* @__PURE__ */ jsx(CommandGroup, { children: options.map((item) => {
107
108
  const isSelected = selectedValues.includes(item.value);
108
- return /* @__PURE__ */ jsx(CommandItem, {
109
+ return /* @__PURE__ */ jsxs(CommandItem, {
109
110
  onMouseDown: (event) => {
110
111
  event.preventDefault();
111
112
  event.stopPropagation();
@@ -119,13 +120,11 @@ var InlineMultiSelect = ({ options, value, onChange, defaultValue = [], placehol
119
120
  }
120
121
  if (closeOnSelect) setOpen(false);
121
122
  },
122
- children: /* @__PURE__ */ jsxs("div", {
123
- className: "flex items-center",
124
- children: [/* @__PURE__ */ jsx("div", {
125
- className: "mr-2",
126
- children: isSelected ? /* @__PURE__ */ jsx(CheckIcon, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx("div", { className: "h-4 w-4" })
127
- }), /* @__PURE__ */ jsx("div", { children: item.label })]
128
- })
123
+ children: [/* @__PURE__ */ jsx("span", {
124
+ "aria-hidden": true,
125
+ className: "mr-1 flex size-6 shrink-0 items-center justify-end",
126
+ children: isSelected && /* @__PURE__ */ jsx(CheckIcon, { weight: "bold" })
127
+ }), item.label]
129
128
  }, item.value);
130
129
  }) })] }) })]
131
130
  })]
@@ -1 +1 @@
1
- {"version":3,"file":"InlineMultiSelect.js","names":["React","_Fragment"],"sources":["../../../../src/components/inputs/InlineMultiSelect/InlineMultiSelect.tsx"],"sourcesContent":["'use client'\n\nimport { CaretUpDownIcon } from '@phosphor-icons/react/dist/ssr/CaretUpDown'\nimport { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport { XIcon } from '@phosphor-icons/react/dist/ssr/X'\nimport * as React from 'react'\nimport { ControllerFieldState } from 'react-hook-form'\n\nimport { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from '../../utils/Command'\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from '../../utils/Popover'\nimport { Button, buttonVariants } from '../Button'\n\nimport { cn } from '@/lib/utils'\n\n/** Represents a selectable option in the InlineMultiSelect */\ntype Option = { value: string; label: string }\n\n/** Props for the InlineMultiSelect component */\nexport type InlineMultiSelectProps = {\n /** Array of options to display in the select */\n options: Array<Option>\n /** Currently selected values (controlled) */\n value?: Array<string>\n /** Callback fired when selection changes */\n onChange?: (value: Array<string>) => void\n /** Form field state from react-hook-form */\n fieldState?: ControllerFieldState\n /** Default selected values (uncontrolled) */\n defaultValue?: Array<string>\n /** Placeholder text when no items are selected */\n placeholder?: string\n /** Text to show when no options match the search */\n notFoundText?: string\n /** Placeholder for the search input */\n commandInputPlaceholder?: string\n /** Maximum number of items that can be selected */\n max?: number\n /** Additional CSS classes */\n className?: string\n /** Whether the component is in a loading state */\n loading?: boolean\n /** Message to show when in loading state */\n loadingPlaceholder?: string\n /** Whether the component is in a modal */\n modal?: boolean\n /** Whether to close the dropdown when an option is selected. Defaults to false for multi-select. */\n closeOnSelect?: boolean\n}\n\n/**\n * InlineMultiSelect Component\n *\n * A controlled multi-select component that displays selected items inline with search functionality.\n * Supports keyboard navigation, maximum selection limit, and custom styling.\n */\nexport const InlineMultiSelect = ({\n options,\n value,\n onChange,\n defaultValue = [],\n placeholder,\n notFoundText,\n commandInputPlaceholder,\n max,\n className,\n fieldState,\n loading = false,\n modal = false,\n loadingPlaceholder = 'Cargando...',\n closeOnSelect = false,\n}: InlineMultiSelectProps) => {\n const inputRef = React.useRef<HTMLInputElement>(null)\n const containerRef = React.useRef<HTMLDivElement>(null)\n const [open, setOpen] = React.useState(false)\n const [inputValue, setInputValue] = React.useState('')\n\n const isControlled = value !== undefined\n\n const [internalSelected, setInternalSelected] = React.useState<Array<string>>(() => defaultValue)\n\n const selectedValues = isControlled ? value! : internalSelected\n const selected = React.useMemo(\n () => options.filter((option) => selectedValues.includes(option.value)),\n [options, selectedValues],\n )\n\n const maxVisibleItems = 2\n const visibleCount = Math.min(selected.length, maxVisibleItems)\n const visibleItems = React.useMemo(() => selected.slice(0, visibleCount), [selected, visibleCount])\n const hiddenCount = selected.length - visibleCount\n\n const handleSelectionChange = (newSelected: Array<string>) => {\n if (!isControlled) {\n setInternalSelected(newSelected)\n }\n onChange?.(newSelected)\n }\n\n const removeItem = (itemToRemove?: Option) => {\n const newValues = itemToRemove\n ? selectedValues.filter((val) => val !== itemToRemove.value)\n : selectedValues.slice(0, -1)\n handleSelectionChange(newValues)\n }\n\n const handleUnselect = (item: Option, event: React.MouseEvent | React.KeyboardEvent) => {\n event.stopPropagation()\n event.preventDefault()\n removeItem(item)\n }\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const input = inputRef.current\n if (input) {\n if ((event.key === 'Backspace' || event.key === 'Delete') && input.value === '') {\n removeItem()\n }\n if (event.key === 'Escape') {\n input.blur()\n }\n }\n }\n\n return (\n <PopoverRoot open={open} onOpenChange={setOpen} modal={modal}>\n <Command onKeyDown={handleKeyDown}>\n <PopoverTrigger asChild>\n <Button\n variant=\"ghost\"\n aria-expanded={open}\n className={cn(\n 'w-full justify-between bg-[#fff] pr-2 pl-2',\n fieldState?.invalid ? 'border-error-400 focus-within:border-error-700' : '',\n buttonVariants({ variant: 'ghost', size: 'lg' }),\n className,\n )}\n >\n <div ref={containerRef} className=\"flex flex-1 flex-wrap items-center gap-1 overflow-hidden pr-2\">\n <div className=\"flex items-center whitespace-nowrap\">\n {selected.length > 0 ? (\n <>\n {visibleItems.map((item) => (\n <div key={item.value} className=\"bg-muted flex items-center gap-1 rounded px-1 py-0.5\">\n <span className=\"text-sm\">{item.label}</span>\n <span\n role=\"button\"\n tabIndex={0}\n onClick={(event) => handleUnselect(item, event)}\n onKeyDown={(event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n handleUnselect(item, event)\n }\n }}\n className=\"hover:bg-muted-foreground/20 flex h-4 w-4 items-center justify-center rounded-full\"\n >\n <XIcon className=\"text-muted-foreground h-3 w-3\" />\n </span>\n </div>\n ))}\n {hiddenCount > 0 && <span className=\"text-muted-foreground text-sm\">+{hiddenCount}</span>}\n </>\n ) : (\n <span className=\"text-muted-foreground\">{placeholder}</span>\n )}\n </div>\n </div>\n <CaretUpDownIcon className=\"h-4 w-4 opacity-50\" />\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"px-0 py-0\">\n <CommandInput\n placeholder={commandInputPlaceholder ?? 'Search...'}\n disabled={loading}\n value={inputValue}\n onValueChange={setInputValue}\n />\n <CommandList>\n {loading ? (\n <div className=\"text-muted-foreground flex items-center justify-center py-6 text-sm\">\n {loadingPlaceholder}\n </div>\n ) : (\n <>\n <CommandEmpty>{notFoundText ?? 'Options not found'}</CommandEmpty>\n {open && (\n <CommandGroup>\n {options.map((item) => {\n const isSelected = selectedValues.includes(item.value)\n return (\n <CommandItem\n key={item.value}\n onMouseDown={(event) => {\n event.preventDefault()\n event.stopPropagation()\n }}\n onSelect={() => {\n if (isSelected) {\n handleSelectionChange(selectedValues.filter((val) => val !== item.value))\n } else {\n if (max && selectedValues.length >= max) return\n handleSelectionChange([...selectedValues, item.value])\n setInputValue('')\n }\n\n if (closeOnSelect) {\n setOpen(false)\n }\n }}\n >\n <div className=\"flex items-center\">\n <div className=\"mr-2\">\n {isSelected ? <CheckIcon className=\"h-4 w-4\" /> : <div className=\"h-4 w-4\" />}\n </div>\n <div>{item.label}</div>\n </div>\n </CommandItem>\n )\n })}\n </CommandGroup>\n )}\n </>\n )}\n </CommandList>\n </PopoverContent>\n </Command>\n </PopoverRoot>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuDA,IAAA,qBAAA,EAAA,SAAA,OAAA,UAAA,eAAA,CAAA,GAAA,aAAA,cAAA,yBAAA,KAAA,WAAA,YAAA,UAAA,OAAA,QAAA,OAAA,qBAAA,eAAA,gBAAA,YAAA;CAgBE,MAAA,WAAA,QAAA,OAAA,IAAA;CACA,MAAA,eAAA,QAAA,OAAA,IAAA;CACA,MAAA,CAAA,MAAA,WAAA,QAAA,SAAA,KAAA;CACA,MAAA,CAAA,YAAA,iBAAA,QAAA,SAAA,EAAA;CAEA,MAAA,eAAA,UAAA,KAAA;CAEA,MAAA,CAAA,kBAAA,uBAAA,QAAA,eAAA,YAAA;CAEA,MAAA,iBAAA,eAAA,QAAA;CACA,MAAA,WAAA,QAAA,cAAA,QAAA,QAAA,WAAA,eAAA,SAAA,OAAA,KAAA,CAAA,GAAA,CAAA,SAAA,cAAA,CAAA;CAMA,MAAA,eAAA,KAAA,IAAA,SAAA,QAAA,CAAA;CACA,MAAA,eAAA,QAAA,cAAA,SAAA,MAAA,GAAA,YAAA,GAAA,CAAA,UAAA,YAAA,CAAA;CACA,MAAA,cAAA,SAAA,SAAA;CAEA,MAAA,yBAAA,gBAAA;EACE,IAAA,CAAA,cAAA,oBAAA,WAAA;EAGA,WAAA,WAAA;CACF;CAEA,MAAA,cAAA,iBAAA;EACE,MAAA,YAAA,eAAA,eAA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AA,CAAA,CAAA;GAOL,CAAA,CAAA;;CACE,CAAA;AAEjB"}
1
+ {"version":3,"file":"InlineMultiSelect.js","names":["React","_Fragment"],"sources":["../../../../src/components/inputs/InlineMultiSelect/InlineMultiSelect.tsx"],"sourcesContent":["'use client'\n\nimport { CaretUpDownIcon } from '@phosphor-icons/react/dist/ssr/CaretUpDown'\nimport { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport { XIcon } from '@phosphor-icons/react/dist/ssr/X'\nimport * as React from 'react'\nimport { ControllerFieldState } from 'react-hook-form'\n\nimport { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from '../../utils/Command'\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from '../../utils/Popover'\nimport { Button, buttonVariants } from '../Button'\n\nimport { SURFACE_LIST } from '@/lib/surface'\nimport { cn } from '@/lib/utils'\n\n/** Represents a selectable option in the InlineMultiSelect */\ntype Option = { value: string; label: string }\n\n/** Props for the InlineMultiSelect component */\nexport type InlineMultiSelectProps = {\n /** Array of options to display in the select */\n options: Array<Option>\n /** Currently selected values (controlled) */\n value?: Array<string>\n /** Callback fired when selection changes */\n onChange?: (value: Array<string>) => void\n /** Form field state from react-hook-form */\n fieldState?: ControllerFieldState\n /** Default selected values (uncontrolled) */\n defaultValue?: Array<string>\n /** Placeholder text when no items are selected */\n placeholder?: string\n /** Text to show when no options match the search */\n notFoundText?: string\n /** Placeholder for the search input */\n commandInputPlaceholder?: string\n /** Maximum number of items that can be selected */\n max?: number\n /** Additional CSS classes */\n className?: string\n /** Whether the component is in a loading state */\n loading?: boolean\n /** Message to show when in loading state */\n loadingPlaceholder?: string\n /** Whether the component is in a modal */\n modal?: boolean\n /** Whether to close the dropdown when an option is selected. Defaults to false for multi-select. */\n closeOnSelect?: boolean\n}\n\n/**\n * InlineMultiSelect Component\n *\n * A controlled multi-select component that displays selected items inline with search functionality.\n * Supports keyboard navigation, maximum selection limit, and custom styling.\n */\nexport const InlineMultiSelect = ({\n options,\n value,\n onChange,\n defaultValue = [],\n placeholder,\n notFoundText,\n commandInputPlaceholder,\n max,\n className,\n fieldState,\n loading = false,\n modal = false,\n loadingPlaceholder = 'Cargando...',\n closeOnSelect = false,\n}: InlineMultiSelectProps) => {\n const inputRef = React.useRef<HTMLInputElement>(null)\n const containerRef = React.useRef<HTMLDivElement>(null)\n const [open, setOpen] = React.useState(false)\n const [inputValue, setInputValue] = React.useState('')\n\n const isControlled = value !== undefined\n\n const [internalSelected, setInternalSelected] = React.useState<Array<string>>(() => defaultValue)\n\n const selectedValues = isControlled ? value! : internalSelected\n const selected = React.useMemo(\n () => options.filter((option) => selectedValues.includes(option.value)),\n [options, selectedValues],\n )\n\n const maxVisibleItems = 2\n const visibleCount = Math.min(selected.length, maxVisibleItems)\n const visibleItems = React.useMemo(() => selected.slice(0, visibleCount), [selected, visibleCount])\n const hiddenCount = selected.length - visibleCount\n\n const handleSelectionChange = (newSelected: Array<string>) => {\n if (!isControlled) {\n setInternalSelected(newSelected)\n }\n onChange?.(newSelected)\n }\n\n const removeItem = (itemToRemove?: Option) => {\n const newValues = itemToRemove\n ? selectedValues.filter((val) => val !== itemToRemove.value)\n : selectedValues.slice(0, -1)\n handleSelectionChange(newValues)\n }\n\n const handleUnselect = (item: Option, event: React.MouseEvent | React.KeyboardEvent) => {\n event.stopPropagation()\n event.preventDefault()\n removeItem(item)\n }\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const input = inputRef.current\n if (input) {\n if ((event.key === 'Backspace' || event.key === 'Delete') && input.value === '') {\n removeItem()\n }\n if (event.key === 'Escape') {\n input.blur()\n }\n }\n }\n\n return (\n <PopoverRoot open={open} onOpenChange={setOpen} modal={modal}>\n <Command onKeyDown={handleKeyDown}>\n <PopoverTrigger asChild>\n <Button\n variant=\"text\"\n aria-expanded={open}\n className={cn(\n buttonVariants({ variant: 'input', size: 'lg' }),\n 'w-full justify-between',\n open && 'border-neutral-950',\n fieldState?.invalid && 'border-error-400 focus-visible:border-error-700',\n className,\n )}\n >\n <div ref={containerRef} className=\"flex flex-1 flex-wrap items-center gap-1 overflow-hidden pr-2\">\n <div className=\"flex items-center whitespace-nowrap\">\n {selected.length > 0 ? (\n <>\n {visibleItems.map((item) => (\n <div key={item.value} className=\"bg-muted flex items-center gap-1 rounded px-1 py-0.5\">\n <span className=\"text-sm\">{item.label}</span>\n <span\n role=\"button\"\n tabIndex={0}\n onClick={(event) => handleUnselect(item, event)}\n onKeyDown={(event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n handleUnselect(item, event)\n }\n }}\n className=\"hover:bg-muted-foreground/20 flex h-4 w-4 items-center justify-center rounded-full\"\n >\n <XIcon className=\"text-muted-foreground h-3 w-3\" />\n </span>\n </div>\n ))}\n {hiddenCount > 0 && <span className=\"text-muted-foreground text-sm\">+{hiddenCount}</span>}\n </>\n ) : (\n <span className=\"text-muted-foreground\">{placeholder}</span>\n )}\n </div>\n </div>\n <CaretUpDownIcon className=\"h-4 w-4 opacity-50\" />\n </Button>\n </PopoverTrigger>\n <PopoverContent className={cn(SURFACE_LIST, 'p-0')}>\n <CommandInput\n placeholder={commandInputPlaceholder ?? 'Search...'}\n disabled={loading}\n value={inputValue}\n onValueChange={setInputValue}\n />\n <CommandList>\n {loading ? (\n <div className=\"text-muted-foreground flex items-center justify-center py-6 text-sm\">\n {loadingPlaceholder}\n </div>\n ) : (\n <>\n <CommandEmpty>{notFoundText ?? 'Options not found'}</CommandEmpty>\n {open && (\n <CommandGroup>\n {options.map((item) => {\n const isSelected = selectedValues.includes(item.value)\n return (\n <CommandItem\n key={item.value}\n onMouseDown={(event) => {\n event.preventDefault()\n event.stopPropagation()\n }}\n onSelect={() => {\n if (isSelected) {\n handleSelectionChange(selectedValues.filter((val) => val !== item.value))\n } else {\n if (max && selectedValues.length >= max) return\n handleSelectionChange([...selectedValues, item.value])\n setInputValue('')\n }\n\n if (closeOnSelect) {\n setOpen(false)\n }\n }}\n >\n <span aria-hidden className=\"mr-1 flex size-6 shrink-0 items-center justify-end\">\n {isSelected && <CheckIcon weight=\"bold\" />}\n </span>\n {item.label}\n </CommandItem>\n )\n })}\n </CommandGroup>\n )}\n </>\n )}\n </CommandList>\n </PopoverContent>\n </Command>\n </PopoverRoot>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAwDA,IAAA,qBAAA,EAAA,SAAA,OAAA,UAAA,eAAA,CAAA,GAAA,aAAA,cAAA,yBAAA,KAAA,WAAA,YAAA,UAAA,OAAA,QAAA,OAAA,qBAAA,eAAA,gBAAA,YAAA;CAgBE,MAAA,WAAA,QAAA,OAAA,IAAA;CACA,MAAA,eAAA,QAAA,OAAA,IAAA;CACA,MAAA,CAAA,MAAA,WAAA,QAAA,SAAA,KAAA;CACA,MAAA,CAAA,YAAA,iBAAA,QAAA,SAAA,EAAA;CAEA,MAAA,eAAA,UAAA,KAAA;CAEA,MAAA,CAAA,kBAAA,uBAAA,QAAA,eAAA,YAAA;CAEA,MAAA,iBAAA,eAAA,QAAA;CACA,MAAA,WAAA,QAAA,cAAA,QAAA,QAAA,WAAA,eAAA,SAAA,OAAA,KAAA,CAAA,GAAA,CAAA,SAAA,cAAA,CAAA;CAMA,MAAA,eAAA,KAAA,IAAA,SAAA,QAAA,CAAA;CACA,MAAA,eAAA,QAAA,cAAA,SAAA,MAAA,GAAA,YAAA,GAAA,CAAA,UAAA,YAAA,CAAA;CACA,MAAA,cAAA,SAAA,SAAA;CAEA,MAAA,yBAAA,gBAAA;EACE,IAAA,CAAA,cAAA,oBAAA,WAAA;EAGA,WAAA,WAAA;CACF;CAEA,MAAA,cAAA,iBAAA;EACE,MAAA,YAAA,eAAA,eAAA,QAAA,QAAA,QAAA,aAAA,KAAA,IAAA,eAAA,MAAA,GAAA,EAAA;EAGA,sBAAA,SAAA;CACF;CAEA,MAAA,kBAAA,MAAA,UAAA;EACE,MAAA,gBAAA;EACA,MAAA,eAAA;EACA,WAAA,IAAA;CACF;CAEA,MAAA,iBAAA,UAAA;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CAAA,CAAA;;GAGO,CAAA,GAAA,qBAAA,gBAAA;IACA,WAAA,GAAA,cAAA,KAAA;IAAhB,UAAA,CAAA,oBAAA,cAAA;KAEI,aAAA,2BAAA;KACA,UAAA;KACA,OAAA;KACA,eAAA;IACD,CAAA,GAAA,oBAAA,aAAA,EAAA,UAAA,UAAA,oBAAA,OAAA;KAGQ,WAAA;KACF,UAAA;IACE,CAAA,IAAA,qBAAA,UAAA,EAAA,UAAA,CAAA,oBAAA,cAAA,EAAA,UAAA,gBAAA,oBAAA,CAAA,GAAA,QAAA,oBAAA,cAAA,EAAA,UAAA,QAAA,KAAA,SAAA;KAOG,MAAA,aAAA,eAAA,SAAA,KAAA,KAAA;KACA,OAAA,qBAAA,aAAA;MAGI,cAAA,UAAA;OACE,MAAA,eAAA;OACA,MAAA,gBAAA;MACF;MACA,gBAAA;OACE,IAAA,YAAA,sBAAA,eAAA,QAAA,QAAA,QAAA,KAAA,KAAA,CAAA;YAEO;QACL,IAAA,OAAA,eAAA,UAAA,KAAA;QACA,sBAAA,CAAA,GAAA,gBAAA,KAAA,KAAA,CAAA;QACA,cAAA,EAAA;OACF;OAEA,IAAA,eAAA,QAAA,KAAA;MAGF;MAlBF,UAAA,CAAA,oBAAA,QAAA;OAoBQ,eAAA;OAAY,WAAA;OACf,UAAA,cAAA,oBAAA,WAAA,EAAA,QAAA,OAAA,CAAA;MACG,CAAA,GAAA,KAAA,KAAA;KArBD,GAAA,KAAA,KAAA;IAyBX,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;GAOL,CAAA,CAAA;;CACE,CAAA;AAEjB"}
@@ -143,7 +143,7 @@ var Input = React$1.forwardRef(({ className, htmlType = "text", placeholder, sta
143
143
  ]
144
144
  })]
145
145
  }), typeof error === "string" && /* @__PURE__ */ jsx("span", {
146
- className: "text-error-500 text-sm",
146
+ className: "text-error-500 animate-in fade-in-0 slide-in-from-top-1 ease-out-strong motion-reduce:slide-in-from-top-0 text-sm duration-150",
147
147
  children: error
148
148
  })]
149
149
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","names":["React"],"sources":["../../../../src/components/inputs/Input/Input.tsx"],"sourcesContent":["import { EyeIcon } from '@phosphor-icons/react/dist/ssr/Eye'\nimport { EyeSlashIcon } from '@phosphor-icons/react/dist/ssr/EyeSlash'\nimport { MinusIcon } from '@phosphor-icons/react/dist/ssr/Minus'\nimport { PlusIcon } from '@phosphor-icons/react/dist/ssr/Plus'\nimport { WarningCircleIcon } from '@phosphor-icons/react/dist/ssr/WarningCircle'\nimport { XIcon } from '@phosphor-icons/react/dist/ssr/X'\nimport * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\nexport type InputProps = {\n htmlType?: 'text' | 'tel' | 'email' | 'number' | 'password' | 'url'\n startContent?: React.ReactElement\n endContent?: React.ReactElement\n groupText?: string\n disabled?: boolean\n error?: boolean | string\n stepControls?: boolean\n inputClassName?: string\n /** Callback function executed when the clear button is clicked. When provided, an X button will appear on hover to clear the input. */\n onClear?: boolean | (() => void)\n} & React.InputHTMLAttributes<HTMLInputElement>\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(\n (\n {\n className,\n htmlType = 'text',\n placeholder,\n startContent,\n endContent,\n groupText,\n disabled,\n error,\n stepControls,\n value: controlledValue,\n onChange: controlledOnChange,\n inputClassName,\n onClear = true,\n ...props\n },\n ref,\n ) => {\n const isHtmlTypePassword = htmlType === 'password'\n const isHtmlTypeNumber = htmlType === 'number'\n const hasStepControls = stepControls && isHtmlTypeNumber\n\n const [type, setType] = React.useState(htmlType)\n const [internalValue, setInternalValue] = React.useState(controlledValue)\n const [isHovered, setIsHovered] = React.useState(false)\n\n React.useEffect(() => {\n setInternalValue(controlledValue)\n }, [controlledValue])\n\n const toggleType = () => {\n setType(type === 'password' ? 'text' : 'password')\n }\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n setInternalValue(event.target.value)\n if (controlledOnChange) {\n controlledOnChange(event)\n }\n }\n\n const handleStepChange = (increment: number) => {\n const currentValue = Number(internalValue ?? 0)\n const newValue = currentValue + increment\n if (newValue >= 0) {\n const event = {\n target: { value: newValue.toString() },\n } as React.ChangeEvent<HTMLInputElement>\n handleChange(event)\n }\n }\n\n const handleClear = () => {\n const event = {\n target: { value: '' },\n } as React.ChangeEvent<HTMLInputElement>\n handleChange(event)\n\n if (typeof onClear === 'function') {\n onClear()\n }\n }\n\n const renderPasswordEye = () => {\n if (!isHtmlTypePassword) return null\n\n return (\n <button\n type=\"button\"\n className=\"flex aspect-square items-center justify-center rounded-full p-2 transition-colors hover:bg-neutral-50\"\n onClick={() => toggleType()}\n >\n {type === 'password' ? (\n <EyeSlashIcon size={20} data-testid=\"password-eye-closed\" />\n ) : (\n <EyeIcon size={20} data-testid=\"password-eye-open\" />\n )}\n </button>\n )\n }\n\n const renderErrorIcon = () => {\n if (isHtmlTypePassword || !error || hasStepControls) return null\n return (\n <div>\n <WarningCircleIcon\n data-testid=\"exclaim-icon\"\n className={cn(\n 'text-error-500 transition-opacity duration-150',\n showClearIcon ? 'opacity-0' : 'opacity-100',\n )}\n size={18}\n />\n </div>\n )\n }\n\n const renderStepControlsIncrement = () => {\n if (!hasStepControls) return null\n return (\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => handleStepChange(1)}\n className=\"p-2\"\n aria-label=\"Increment\"\n >\n <PlusIcon data-testid=\"increment-button\" />\n </button>\n )\n }\n\n const renderEndContent = () => {\n if (isHtmlTypePassword || error || hasStepControls || !endContent) return null\n return (\n <div\n className={cn(\n 'text-neutral-300 transition-opacity duration-150',\n showClearIcon ? 'opacity-0' : 'opacity-100',\n )}\n >\n {endContent}\n </div>\n )\n }\n\n const renderClearIcon = () => {\n if (disabled || hasStepControls || isHtmlTypePassword || !onClear) return null\n\n return (\n <div\n className={cn(\n 'absolute right-3 z-10 flex h-full w-10 items-center justify-end rounded-r-lg',\n !endContent && !error\n ? 'bg-linear-to-l from-white from-60% via-white/80 via-80% to-transparent transition-opacity duration-150'\n : 'bg-transparent',\n showClearIcon ? 'opacity-100' : 'opacity-0',\n )}\n >\n <XIcon\n data-testid=\"clear-button\"\n className={cn(\n 'h-4 w-4 shrink-0 cursor-pointer transition-opacity duration-150',\n showClearIcon ? 'opacity-100 hover:opacity-70' : 'opacity-0',\n )}\n onClick={handleClear}\n />\n </div>\n )\n }\n\n const renderStartContent = () => {\n if (!startContent) return null\n return <div className=\"text-neutral-300\">{startContent}</div>\n }\n\n const renderStepControlsDecrement = () => {\n if (!hasStepControls) return null\n return (\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => handleStepChange(-1)}\n className=\"p-2\"\n aria-label=\"Decrement\"\n >\n <MinusIcon data-testid=\"decrement-button\" />\n </button>\n )\n }\n\n const hasValue = Boolean(internalValue && String(internalValue).trim() !== '')\n const showClearIcon = onClear && hasValue && isHovered && !disabled && !isHtmlTypePassword && !hasStepControls\n\n return (\n <div className=\"flex w-full flex-col gap-1\">\n <div className=\"flex w-full items-center\">\n {groupText && (\n <div\n className={cn(\n 'flex h-12 items-center rounded-l-lg border-y border-l border-neutral-200 bg-neutral-50 pr-2 pl-4 text-neutral-300',\n )}\n >\n {groupText}\n </div>\n )}\n <div\n className={cn(\n 'relative flex h-12 w-full items-center rounded-lg border border-neutral-200 bg-white px-3 transition-colors focus-within:border-neutral-950',\n groupText && 'rounded-l-none',\n disabled && 'bg-neutral-50',\n error && 'border-error-400 focus-within:border-error-700',\n className,\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n {renderStartContent()}\n {renderStepControlsDecrement()}\n <input\n type={type}\n className={cn(\n 'w-full bg-transparent px-2 outline-0 transition-colors placeholder:text-neutral-300 disabled:cursor-not-allowed disabled:opacity-50',\n hasStepControls && 'text-center',\n inputClassName,\n )}\n ref={ref}\n onChange={handleChange}\n placeholder={placeholder}\n disabled={disabled}\n value={internalValue}\n onKeyDown={(event) => {\n if (isHtmlTypeNumber && (event.key === 'e' || event.key === 'E' || event.key === '-')) {\n event.preventDefault()\n }\n }}\n {...props}\n />\n {renderPasswordEye()}\n {renderClearIcon()}\n {renderErrorIcon()}\n {renderStepControlsIncrement()}\n {renderEndContent()}\n </div>\n </div>\n {typeof error === 'string' && <span className=\"text-error-500 text-sm\">{error}</span>}\n </div>\n )\n },\n)\nInput.displayName = 'Input'\n\nexport { Input }\n"],"mappings":";;;;;;;;;;AAuBA,IAAM,QAAQA,QAAM,YAEhB,EACE,WACA,WAAW,QACX,aACA,cACA,YACA,WACA,UACA,OACA,cACA,OAAO,iBACP,UAAU,oBACV,gBACA,UAAU,MACV,GAAG,SAEL,QACG;CACH,MAAM,qBAAqB,aAAa;CACxC,MAAM,mBAAmB,aAAa;CACtC,MAAM,kBAAkB,gBAAgB;CAExC,MAAM,CAAC,MAAM,WAAWA,QAAM,SAAS,QAAQ;CAC/C,MAAM,CAAC,eAAe,oBAAoBA,QAAM,SAAS,eAAe;CACxE,MAAM,CAAC,WAAW,gBAAgBA,QAAM,SAAS,KAAK;CAEtD,QAAM,gBAAgB;EACpB,iBAAiB,eAAe;CAClC,GAAG,CAAC,eAAe,CAAC;CAEpB,MAAM,mBAAmB;EACvB,QAAQ,SAAS,aAAa,SAAS,UAAU;CACnD;CAEA,MAAM,gBAAgB,UAA+C;EACnE,iBAAiB,MAAM,OAAO,KAAK;EACnC,IAAI,oBACF,mBAAmB,KAAK;CAE5B;CAEA,MAAM,oBAAoB,cAAsB;EAE9C,MAAM,WADe,OAAO,iBAAiB,CAC5B,IAAe;EAChC,IAAI,YAAY,GAAG;GACjB,MAAM,QAAQ,EACZ,QAAQ,EAAE,OAAO,SAAS,SAAS,EAAE,EACvC;GACA,aAAa,KAAK;EACpB;CACF;CAEA,MAAM,oBAAoB;EAIxB,aAAa,EAFX,QAAQ,EAAE,OAAO,GAAG,EAET,CAAK;EAElB,IAAI,OAAO,YAAY,YACrB,QAAQ;CAEZ;CAEA,MAAM,0BAA0B;EAC9B,IAAI,CAAC,oBA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CAAA;CAC9D;CAEA,MAAM,oCAAoC;EACxC,IAAI,CAAC,iBAAiB,OAAO;EAC7B,OACE,oBAAC,UAAD;GACE,MAAK;GACK;GACV,eAAe,iBAAiB,EAAE;GAClC,WAAU;GACV,cAAW;GAEX,UAAA,oBAAC,WAAD,EAAW,eAAY,mBAAoB,CAAA;EACrC,CAAA;CAEZ;CAEA,MAAM,WAAW,QAAQ,iBAAiB,OAAO,aAAa,CAAC,CAAC,KAAK,MAAM,EAAE;CAC7E,MAAM,gBAAgB,WAAW,YAAY,aAAa,CAAC,YAAY,CAAC,sBAAsB,CAAC;CAE/F,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACG,aACC,oBAAC,OAAD;IACE,WAAW,GACT,mHACF;IAEC,UAAA;GACE,CAAA,GAEP,qBAAC,OAAD;IACE,WAAW,GACT,+IACA,aAAa,kBACb,YAAY,iBACZ,SAAS,kDACT,SACF;IACA,oBAAoB,aAAa,IAAI;IACrC,oBAAoB,aAAa,KAAK;IATxC,UAAA;KAWG,mBAAmB;KACnB,4BAA4B;KAC7B,oBAAC,SAAD;MACQ;MACN,WAAW,GACT,uIACA,mBAAmB,eACnB,cACF;MACK;MACL,UAAU;MACG;MACH;MACV,OAAO;MACP,YAAY,UAAU;OACpB,IAAI,qBAAqB,MAAM,QAAQ,OAAO,MAAM,QAAQ,OAAO,MAAM,QAAQ,MAC/E,MAAM,eAAe;MAEzB;MACA,GAAI;KACL,CAAA;KACA,kBAAkB;KAClB,gBAAgB;KAChB,gBAAgB;KAChB,4BAA4B;KAC5B,iBAAiB;IACf;GACF,CAAA,CAAA;EACJ,CAAA,GAAA,OAAO,UAAU,YAAY,oBAAC,QAAD;GAAM,WAAU;GAA0B,UAAA;EAAY,CAAA,CACjF;;AAET,CACF;AACA,MAAM,cAAc"}
1
+ {"version":3,"file":"Input.js","names":["React"],"sources":["../../../../src/components/inputs/Input/Input.tsx"],"sourcesContent":["import { EyeIcon } from '@phosphor-icons/react/dist/ssr/Eye'\nimport { EyeSlashIcon } from '@phosphor-icons/react/dist/ssr/EyeSlash'\nimport { MinusIcon } from '@phosphor-icons/react/dist/ssr/Minus'\nimport { PlusIcon } from '@phosphor-icons/react/dist/ssr/Plus'\nimport { WarningCircleIcon } from '@phosphor-icons/react/dist/ssr/WarningCircle'\nimport { XIcon } from '@phosphor-icons/react/dist/ssr/X'\nimport * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\nexport type InputProps = {\n htmlType?: 'text' | 'tel' | 'email' | 'number' | 'password' | 'url'\n startContent?: React.ReactElement\n endContent?: React.ReactElement\n groupText?: string\n disabled?: boolean\n error?: boolean | string\n stepControls?: boolean\n inputClassName?: string\n /** Callback function executed when the clear button is clicked. When provided, an X button will appear on hover to clear the input. */\n onClear?: boolean | (() => void)\n} & React.InputHTMLAttributes<HTMLInputElement>\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(\n (\n {\n className,\n htmlType = 'text',\n placeholder,\n startContent,\n endContent,\n groupText,\n disabled,\n error,\n stepControls,\n value: controlledValue,\n onChange: controlledOnChange,\n inputClassName,\n onClear = true,\n ...props\n },\n ref,\n ) => {\n const isHtmlTypePassword = htmlType === 'password'\n const isHtmlTypeNumber = htmlType === 'number'\n const hasStepControls = stepControls && isHtmlTypeNumber\n\n const [type, setType] = React.useState(htmlType)\n const [internalValue, setInternalValue] = React.useState(controlledValue)\n const [isHovered, setIsHovered] = React.useState(false)\n\n React.useEffect(() => {\n setInternalValue(controlledValue)\n }, [controlledValue])\n\n const toggleType = () => {\n setType(type === 'password' ? 'text' : 'password')\n }\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n setInternalValue(event.target.value)\n if (controlledOnChange) {\n controlledOnChange(event)\n }\n }\n\n const handleStepChange = (increment: number) => {\n const currentValue = Number(internalValue ?? 0)\n const newValue = currentValue + increment\n if (newValue >= 0) {\n const event = {\n target: { value: newValue.toString() },\n } as React.ChangeEvent<HTMLInputElement>\n handleChange(event)\n }\n }\n\n const handleClear = () => {\n const event = {\n target: { value: '' },\n } as React.ChangeEvent<HTMLInputElement>\n handleChange(event)\n\n if (typeof onClear === 'function') {\n onClear()\n }\n }\n\n const renderPasswordEye = () => {\n if (!isHtmlTypePassword) return null\n\n return (\n <button\n type=\"button\"\n className=\"flex aspect-square items-center justify-center rounded-full p-2 transition-colors hover:bg-neutral-50\"\n onClick={() => toggleType()}\n >\n {type === 'password' ? (\n <EyeSlashIcon size={20} data-testid=\"password-eye-closed\" />\n ) : (\n <EyeIcon size={20} data-testid=\"password-eye-open\" />\n )}\n </button>\n )\n }\n\n const renderErrorIcon = () => {\n if (isHtmlTypePassword || !error || hasStepControls) return null\n return (\n <div>\n <WarningCircleIcon\n data-testid=\"exclaim-icon\"\n className={cn(\n 'text-error-500 transition-opacity duration-150',\n showClearIcon ? 'opacity-0' : 'opacity-100',\n )}\n size={18}\n />\n </div>\n )\n }\n\n const renderStepControlsIncrement = () => {\n if (!hasStepControls) return null\n return (\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => handleStepChange(1)}\n className=\"p-2\"\n aria-label=\"Increment\"\n >\n <PlusIcon data-testid=\"increment-button\" />\n </button>\n )\n }\n\n const renderEndContent = () => {\n if (isHtmlTypePassword || error || hasStepControls || !endContent) return null\n return (\n <div\n className={cn(\n 'text-neutral-300 transition-opacity duration-150',\n showClearIcon ? 'opacity-0' : 'opacity-100',\n )}\n >\n {endContent}\n </div>\n )\n }\n\n const renderClearIcon = () => {\n if (disabled || hasStepControls || isHtmlTypePassword || !onClear) return null\n\n return (\n <div\n className={cn(\n 'absolute right-3 z-10 flex h-full w-10 items-center justify-end rounded-r-lg',\n !endContent && !error\n ? 'bg-linear-to-l from-white from-60% via-white/80 via-80% to-transparent transition-opacity duration-150'\n : 'bg-transparent',\n showClearIcon ? 'opacity-100' : 'opacity-0',\n )}\n >\n <XIcon\n data-testid=\"clear-button\"\n className={cn(\n 'h-4 w-4 shrink-0 cursor-pointer transition-opacity duration-150',\n showClearIcon ? 'opacity-100 hover:opacity-70' : 'opacity-0',\n )}\n onClick={handleClear}\n />\n </div>\n )\n }\n\n const renderStartContent = () => {\n if (!startContent) return null\n return <div className=\"text-neutral-300\">{startContent}</div>\n }\n\n const renderStepControlsDecrement = () => {\n if (!hasStepControls) return null\n return (\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => handleStepChange(-1)}\n className=\"p-2\"\n aria-label=\"Decrement\"\n >\n <MinusIcon data-testid=\"decrement-button\" />\n </button>\n )\n }\n\n const hasValue = Boolean(internalValue && String(internalValue).trim() !== '')\n const showClearIcon = onClear && hasValue && isHovered && !disabled && !isHtmlTypePassword && !hasStepControls\n\n return (\n <div className=\"flex w-full flex-col gap-1\">\n <div className=\"flex w-full items-center\">\n {groupText && (\n <div\n className={cn(\n 'flex h-12 items-center rounded-l-lg border-y border-l border-neutral-200 bg-neutral-50 pr-2 pl-4 text-neutral-300',\n )}\n >\n {groupText}\n </div>\n )}\n <div\n className={cn(\n 'relative flex h-12 w-full items-center rounded-lg border border-neutral-200 bg-white px-3 transition-colors focus-within:border-neutral-950',\n groupText && 'rounded-l-none',\n disabled && 'bg-neutral-50',\n error && 'border-error-400 focus-within:border-error-700',\n className,\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n {renderStartContent()}\n {renderStepControlsDecrement()}\n <input\n type={type}\n className={cn(\n 'w-full bg-transparent px-2 outline-0 transition-colors placeholder:text-neutral-300 disabled:cursor-not-allowed disabled:opacity-50',\n hasStepControls && 'text-center',\n inputClassName,\n )}\n ref={ref}\n onChange={handleChange}\n placeholder={placeholder}\n disabled={disabled}\n value={internalValue}\n onKeyDown={(event) => {\n if (isHtmlTypeNumber && (event.key === 'e' || event.key === 'E' || event.key === '-')) {\n event.preventDefault()\n }\n }}\n {...props}\n />\n {renderPasswordEye()}\n {renderClearIcon()}\n {renderErrorIcon()}\n {renderStepControlsIncrement()}\n {renderEndContent()}\n </div>\n </div>\n {typeof error === 'string' && (\n <span className=\"text-error-500 animate-in fade-in-0 slide-in-from-top-1 ease-out-strong motion-reduce:slide-in-from-top-0 text-sm duration-150\">\n {error}\n </span>\n )}\n </div>\n )\n },\n)\nInput.displayName = 'Input'\n\nexport { Input }\n"],"mappings":";;;;;;;;;;AAuBA,IAAM,QAAQA,QAAM,YAEhB,EACE,WACA,WAAW,QACX,aACA,cACA,YACA,WACA,UACA,OACA,cACA,OAAO,iBACP,UAAU,oBACV,gBACA,UAAU,MACV,GAAG,SAEL,QACG;CACH,MAAM,qBAAqB,aAAa;CACxC,MAAM,mBAAmB,aAAa;CACtC,MAAM,kBAAkB,gBAAgB;CAExC,MAAM,CAAC,MAAM,WAAWA,QAAM,SAAS,QAAQ;CAC/C,MAAM,CAAC,eAAe,oBAAoBA,QAAM,SAAS,eAAe;CACxE,MAAM,CAAC,WAAW,gBAAgBA,QAAM,SAAS,KAAK;CAEtD,QAAM,gBAAgB;EACpB,iBAAiB,eAAe;CAClC,GAAG,CAAC,eAAe,CAAC;CAEpB,MAAM,mBAAmB;EACvB,QAAQ,SAAS,aAAa,SAAS,UAAU;CACnD;CAEA,MAAM,gBAAgB,UAA+C;EACnE,iBAAiB,MAAM,OAAO,KAAK;EACnC,IAAI,oBACF,mBAAmB,KAAK;CAE5B;CAEA,MAAM,oBAAoB,cAAsB;EAE9C,MAAM,WADe,OAAO,iBAAiB,CAC5B,IAAe;EAChC,IAAI,YAAY,GAAG;GACjB,MAAM,QAAQ,EACZ,QAAQ,EAAE,OAAO,SAAS,SAAS,EAAE,EACvC;GACA,aAAa,KAAK;EACpB;CACF;CAEA,MAAM,oBAAoB;EAIxB,aAAa,EAFX,QAAQ,EAAE,OAAO,GAAG,EAET,CAAK;EAElB,IAAI,OAAO,YAAY,YACrB,QAAQ;CAEZ;CAEA,MAAM,0BAA0B;EAC9B,IAAI,CAAC,oBAAoB,OAAO;EAEhC,OACE,oBAAC,UAAD;GACE,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AAI,CAAC,iBAAiB,OAAO;EAC7B,OACE,oBAAC,UAAD;GACE,MAAK;GACK;GACV,eAAe,iBAAiB,EAAE;GAClC,WAAU;GACV,cAAW;GAEX,UAAA,oBAAC,WAAD,EAAW,eAAY,mBAAoB,CAAA;EACrC,CAAA;CAEZ;CAEA,MAAM,WAAW,QAAQ,iBAAiB,OAAO,aAAa,CAAC,CAAC,KAAK,MAAM,EAAE;CAC7E,MAAM,gBAAgB,WAAW,YAAY,aAAa,CAAC,YAAY,CAAC,sBAAsB,CAAC;CAE/F,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACG,aACC,oBAAC,OAAD;IACE,WAAW,GACT,mHACF;IAEC,UAAA;GACE,CAAA,GAEP,qBAAC,OAAD;IACE,WAAW,GACT,+IACA,aAAa,kBACb,YAAY,iBACZ,SAAS,kDACT,SACF;IACA,oBAAoB,aAAa,IAAI;IACrC,oBAAoB,aAAa,KAAK;IATxC,UAAA;KAWG,mBAAmB;KACnB,4BAA4B;KAC7B,oBAAC,SAAD;MACQ;MACN,WAAW,GACT,uIACA,mBAAmB,eACnB,cACF;MACK;MACL,UAAU;MACG;MACH;MACV,OAAO;MACP,YAAY,UAAU;OACpB,IAAI,qBAAqB,MAAM,QAAQ,OAAO,MAAM,QAAQ,OAAO,MAAM,QAAQ,MAC/E,MAAM,eAAe;MAEzB;MACA,GAAI;KACL,CAAA;KACA,kBAAkB;KAClB,gBAAgB;KAChB,gBAAgB;KAChB,4BAA4B;KAC5B,iBAAiB;IACf;GACF,CAAA,CAAA;EACJ,CAAA,GAAA,OAAO,UAAU,YAChB,oBAAC,QAAD;GAAM,WAAU;GACb,UAAA;EACG,CAAA,CAEL;;AAET,CACF;AACA,MAAM,cAAc"}
@@ -79,7 +79,7 @@ var InputDate = React$1.forwardRef(({ className, disabled, error, errorMessage,
79
79
  })
80
80
  })
81
81
  }), resolvedErrorMessage && /* @__PURE__ */ jsx("span", {
82
- className: "text-error-500 text-sm",
82
+ className: "text-error-500 animate-in fade-in-0 slide-in-from-top-1 ease-out-strong motion-reduce:slide-in-from-top-0 text-sm duration-150",
83
83
  children: resolvedErrorMessage
84
84
  })]
85
85
  });
@@ -1 +1 @@
1
- {"version":3,"file":"InputDate.js","names":["React"],"sources":["../../../../src/components/inputs/InputDate/InputDate.tsx"],"sourcesContent":["import { CalendarBlankIcon } from '@phosphor-icons/react/dist/ssr/CalendarBlank'\nimport { WarningCircleIcon } from '@phosphor-icons/react/dist/ssr/WarningCircle'\nimport { XIcon } from '@phosphor-icons/react/dist/ssr/X'\nimport * as React from 'react'\nimport { I18nProvider } from 'react-aria'\nimport { DateField, DateInput, DateSegment, Group, type DateValue } from 'react-aria-components'\n\nimport { cn } from '@/lib/utils'\n\nexport type InputDateProps = {\n className?: string\n disabled?: boolean\n error?: boolean | string\n errorMessage?: string\n inputClassName?: string\n locale?: string\n onClear?: boolean | (() => void)\n value?: DateValue | null\n onChange?: (date: DateValue | null) => void\n} & Omit<React.ComponentPropsWithoutRef<typeof DateField<DateValue>>, 'value' | 'onChange'>\n\nconst InputDate = React.forwardRef<HTMLDivElement, InputDateProps>(\n (\n {\n className,\n disabled,\n error,\n errorMessage,\n value: controlledValue,\n onChange: controlledOnChange,\n inputClassName,\n onClear = true,\n locale,\n ...props\n },\n ref,\n ) => {\n const [dateValue, setDateValue] = React.useState<DateValue | null>(() => controlledValue ?? null)\n const [isHovered, setIsHovered] = React.useState(false)\n const internalChange = React.useRef(false)\n\n React.useEffect(() => {\n if (internalChange.current) {\n internalChange.current = false\n return\n }\n setDateValue(controlledValue ?? null)\n }, [controlledValue])\n\n const handleRacChange = (date: DateValue | null) => {\n internalChange.current = true\n setDateValue(date)\n controlledOnChange?.(date)\n }\n\n const handleClear = () => {\n internalChange.current = true\n setDateValue(null)\n controlledOnChange?.(null)\n if (typeof onClear === 'function') onClear()\n }\n\n const hasValue = dateValue !== null\n const showClearIcon = Boolean(onClear && hasValue && isHovered && !disabled)\n const resolvedErrorMessage = typeof error === 'string' ? error : errorMessage\n const hasError = Boolean(error ?? resolvedErrorMessage)\n\n const inner = (\n <div className=\"flex w-full flex-col gap-1\">\n <div className=\"flex w-full items-center\">\n <DateField\n ref={ref}\n value={dateValue}\n onChange={handleRacChange}\n isDisabled={disabled}\n isInvalid={hasError}\n granularity=\"day\"\n className=\"w-full\"\n {...props}\n >\n <Group\n data-testid=\"input-date-mask-control\"\n className={cn(\n 'relative flex h-12 w-full items-center rounded-lg border border-neutral-200 bg-white px-3 transition-colors focus-within:border-neutral-950',\n disabled && 'bg-neutral-50',\n hasError && 'border-error-400 focus-within:border-error-700',\n className,\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n <CalendarBlankIcon size={20} />\n <DateInput className={cn('flex flex-1 items-center justify-center px-2', inputClassName)}>\n {(segment) => (\n <DateSegment\n segment={segment}\n className={cn(\n segment.type === 'literal'\n ? 'text-neutral-400 select-none'\n : cn(\n 'min-w-[1ch] rounded-sm bg-transparent px-0.5 py-px text-center outline-0 transition-colors',\n 'caret-neutral-900',\n 'data-placeholder:text-neutral-300',\n 'data-focused:bg-neutral-100 data-focused:text-neutral-900',\n 'data-disabled:cursor-not-allowed data-disabled:opacity-50',\n ),\n )}\n />\n )}\n </DateInput>\n {hasError && (\n <div>\n <WarningCircleIcon\n data-testid=\"exclaim-icon\"\n className={cn(\n 'text-error-500 transition-opacity duration-150',\n showClearIcon ? 'opacity-0' : 'opacity-100',\n )}\n size={18}\n />\n </div>\n )}\n {onClear && !disabled && (\n <div\n className={cn(\n 'absolute right-3 z-10 flex h-full w-10 items-center justify-end rounded-r-lg',\n hasError\n ? 'bg-transparent'\n : 'bg-linear-to-l from-white from-60% via-white/80 via-80% to-transparent transition-opacity duration-150',\n showClearIcon ? 'opacity-100' : 'opacity-0',\n )}\n >\n <XIcon\n data-testid=\"clear-button\"\n className={cn(\n 'h-4 w-4 shrink-0 cursor-pointer transition-opacity duration-150',\n showClearIcon ? 'opacity-100 hover:opacity-70' : 'opacity-0',\n )}\n onClick={(event) => {\n event.stopPropagation()\n handleClear()\n }}\n />\n </div>\n )}\n </Group>\n </DateField>\n </div>\n {resolvedErrorMessage && <span className=\"text-error-500 text-sm\">{resolvedErrorMessage}</span>}\n </div>\n )\n\n return locale ? <I18nProvider locale={locale}>{inner}</I18nProvider> : inner\n },\n)\n\nInputDate.displayName = 'InputDate'\n\nexport { InputDate }\n"],"mappings":";;;;;;;;;AAqBA,IAAM,YAAYA,QAAM,YAEpB,EACE,WACA,UACA,OACA,cACA,OAAO,iBACP,UAAU,oBACV,gBACA,UAAU,MACV,QACA,GAAG,SAEL,QACG;CACH,MAAM,CAAC,WAAW,gBAAgBA,QAAM,eAAiC,mBAAmB,IAAI;CAChG,MAAM,CAAC,WAAW,gBAAgBA,QAAM,SAAS,KAAK;CACtD,MAAM,iBAAiBA,QAAM,OAAO,KAAK;CAEzC,QAAM,gBAAgB;EACpB,IAAI,eAAe,SAAS;GAC1B,eAAe,UAAU;GACzB;EACF;EACA,aAAa,mBAAmB,IAAI;CACtC,GAAG,CAAC,eAAe,CAAC;CAEpB,MAAM,mBAAmB,SAA2B;EAClD,eAAe,UAAU;EACzB,aAAa,IAAI;EACjB,qBAAqB,IAAI;CAC3B;CAEA,MAAM,oBAAoB;EACxB,eAAe,UAAU;EACzB,aAAa,IAAI;EACjB,qBAAqB,IAAI;EACzB,IAAI,OAAO,YAAY,YAAY,QAAQ;CAC7C;CAGA,MAAM,gBAAgB,QAAQ,WADb,cAAc,QACsB,aAAa,CAAC,QAAQ;CAC3E,MAAM,uBAAuB,OAAO,UAAU,WAAW,QAAQ;CACjE,MAAM,WAAW,QAAQ,SAAS,oBAAoB;CAEtD,MAAM,QACJ,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,OAAD;GAAK,WAAU;GACb,UAAA,oBAAC,WAAD;IACO;IACL,OAAO;IACP,UAAU;IACV,YAAY;IACZ,WAAW;IACX,aAAY;IACZ,WAAU;IACV,GAAI;IAEJ,UAAA,qBAAC,OAAD;KACE,eAAY;KACZ,WAAW,GACT,+IACA,YAAY,iBACZ,YAAY,kDACZ,SACF;KACA,oBAAoB,aAAa,IAAI;KACrC,oBAAoB,aAAa,KAAK;KATxC,UAAA;MAWE,oBAAC,mBAAD,EAAmB,MAAM,GAAK,CAAA;MAC9B,oBAAC,WAAD;OAAW,WAAW,GAAG,gDAAgD,cAAc;OACnF,WAAA,YACA,oBAAC,aAAD;QACW;QACT,WAAW,GACT,QAAQ,SAAS,YACb,iCACA,GACE,8FACA,qBACA,qCACA,6DACA,2DACF,CACN;OACD,CAAA;MAEM,CAAA;MACV,YACC,oBAAC,OAAD,EAAA,UACE,oBAAC,mBAAD;OACE,eAAY;OACZ,WAAW,GACT,kDACA,gBAAgB,cAAc,aAChC;OACA,MAAM;MACP,CAAA,EACE,CAAA;MAEN,WAAW,CAAC,YACX,oBAAC,OAAD;OACE,WAAW,GACT,gFACA,WACI,mBACA,0GACJ,gBAAgB,gBAAgB,WAClC;OAEA,UAAA,oBAAC,OAAD;QACE,eAAY;QACZ,WAAW,GACT,mEACA,gBAAgB,iCAAiC,WACnD;QACA,UAAU,UAAU;SAClB,MAAM,gBAAgB;SACtB,YAAY;QACd;OACD,CAAA;MACE,CAAA;KAEF;;GACE,CAAA;EACR,CAAA,GACJ,wBAAwB,oBAAC,QAAD;GAAM,WAAU;GAA0B,UAAA;EAA2B,CAAA,CAC3F;;CAGP,OAAO,SAAS,oBAAC,cAAD;EAAsB;EAAS,UAAA;CAAoB,CAAA,IAAI;AACzE,CACF;AAEA,UAAU,cAAc"}
1
+ {"version":3,"file":"InputDate.js","names":["React"],"sources":["../../../../src/components/inputs/InputDate/InputDate.tsx"],"sourcesContent":["import { CalendarBlankIcon } from '@phosphor-icons/react/dist/ssr/CalendarBlank'\nimport { WarningCircleIcon } from '@phosphor-icons/react/dist/ssr/WarningCircle'\nimport { XIcon } from '@phosphor-icons/react/dist/ssr/X'\nimport * as React from 'react'\nimport { I18nProvider } from 'react-aria'\nimport { DateField, DateInput, DateSegment, Group, type DateValue } from 'react-aria-components'\n\nimport { cn } from '@/lib/utils'\n\nexport type InputDateProps = {\n className?: string\n disabled?: boolean\n error?: boolean | string\n errorMessage?: string\n inputClassName?: string\n locale?: string\n onClear?: boolean | (() => void)\n value?: DateValue | null\n onChange?: (date: DateValue | null) => void\n} & Omit<React.ComponentPropsWithoutRef<typeof DateField<DateValue>>, 'value' | 'onChange'>\n\nconst InputDate = React.forwardRef<HTMLDivElement, InputDateProps>(\n (\n {\n className,\n disabled,\n error,\n errorMessage,\n value: controlledValue,\n onChange: controlledOnChange,\n inputClassName,\n onClear = true,\n locale,\n ...props\n },\n ref,\n ) => {\n const [dateValue, setDateValue] = React.useState<DateValue | null>(() => controlledValue ?? null)\n const [isHovered, setIsHovered] = React.useState(false)\n const internalChange = React.useRef(false)\n\n React.useEffect(() => {\n if (internalChange.current) {\n internalChange.current = false\n return\n }\n setDateValue(controlledValue ?? null)\n }, [controlledValue])\n\n const handleRacChange = (date: DateValue | null) => {\n internalChange.current = true\n setDateValue(date)\n controlledOnChange?.(date)\n }\n\n const handleClear = () => {\n internalChange.current = true\n setDateValue(null)\n controlledOnChange?.(null)\n if (typeof onClear === 'function') onClear()\n }\n\n const hasValue = dateValue !== null\n const showClearIcon = Boolean(onClear && hasValue && isHovered && !disabled)\n const resolvedErrorMessage = typeof error === 'string' ? error : errorMessage\n const hasError = Boolean(error ?? resolvedErrorMessage)\n\n const inner = (\n <div className=\"flex w-full flex-col gap-1\">\n <div className=\"flex w-full items-center\">\n <DateField\n ref={ref}\n value={dateValue}\n onChange={handleRacChange}\n isDisabled={disabled}\n isInvalid={hasError}\n granularity=\"day\"\n className=\"w-full\"\n {...props}\n >\n <Group\n data-testid=\"input-date-mask-control\"\n className={cn(\n 'relative flex h-12 w-full items-center rounded-lg border border-neutral-200 bg-white px-3 transition-colors focus-within:border-neutral-950',\n disabled && 'bg-neutral-50',\n hasError && 'border-error-400 focus-within:border-error-700',\n className,\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n <CalendarBlankIcon size={20} />\n <DateInput className={cn('flex flex-1 items-center justify-center px-2', inputClassName)}>\n {(segment) => (\n <DateSegment\n segment={segment}\n className={cn(\n segment.type === 'literal'\n ? 'text-neutral-400 select-none'\n : cn(\n 'min-w-[1ch] rounded-sm bg-transparent px-0.5 py-px text-center outline-0 transition-colors',\n 'caret-neutral-900',\n 'data-placeholder:text-neutral-300',\n 'data-focused:bg-neutral-100 data-focused:text-neutral-900',\n 'data-disabled:cursor-not-allowed data-disabled:opacity-50',\n ),\n )}\n />\n )}\n </DateInput>\n {hasError && (\n <div>\n <WarningCircleIcon\n data-testid=\"exclaim-icon\"\n className={cn(\n 'text-error-500 transition-opacity duration-150',\n showClearIcon ? 'opacity-0' : 'opacity-100',\n )}\n size={18}\n />\n </div>\n )}\n {onClear && !disabled && (\n <div\n className={cn(\n 'absolute right-3 z-10 flex h-full w-10 items-center justify-end rounded-r-lg',\n hasError\n ? 'bg-transparent'\n : 'bg-linear-to-l from-white from-60% via-white/80 via-80% to-transparent transition-opacity duration-150',\n showClearIcon ? 'opacity-100' : 'opacity-0',\n )}\n >\n <XIcon\n data-testid=\"clear-button\"\n className={cn(\n 'h-4 w-4 shrink-0 cursor-pointer transition-opacity duration-150',\n showClearIcon ? 'opacity-100 hover:opacity-70' : 'opacity-0',\n )}\n onClick={(event) => {\n event.stopPropagation()\n handleClear()\n }}\n />\n </div>\n )}\n </Group>\n </DateField>\n </div>\n {resolvedErrorMessage && (\n <span className=\"text-error-500 animate-in fade-in-0 slide-in-from-top-1 ease-out-strong motion-reduce:slide-in-from-top-0 text-sm duration-150\">\n {resolvedErrorMessage}\n </span>\n )}\n </div>\n )\n\n return locale ? <I18nProvider locale={locale}>{inner}</I18nProvider> : inner\n },\n)\n\nInputDate.displayName = 'InputDate'\n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G,gDAAgD,cAAc;OACnF,WAAA,YACA,oBAAC,aAAD;QACW;QACT,WAAW,GACT,QAAQ,SAAS,YACb,iCACA,GACE,8FACA,qBACA,qCACA,6DACA,2DACF,CACN;OACD,CAAA;MAEM,CAAA;MACV,YACC,oBAAC,OAAD,EAAA,UACE,oBAAC,mBAAD;OACE,eAAY;OACZ,WAAW,GACT,kDACA,gBAAgB,cAAc,aAChC;OACA,MAAM;MACP,CAAA,EACE,CAAA;MAEN,WAAW,CAAC,YACX,oBAAC,OAAD;OACE,WAAW,GACT,gFACA,WACI,mBACA,0GACJ,gBAAgB,gBAAgB,WAClC;OAEA,UAAA,oBAAC,OAAD;QACE,eAAY;QACZ,WAAW,GACT,mEACA,gBAAgB,iCAAiC,WACnD;QACA,UAAU,UAAU;SAClB,MAAM,gBAAgB;SACtB,YAAY;QACd;OACD,CAAA;MACE,CAAA;KAEF;;GACE,CAAA;EACR,CAAA,GACJ,wBACC,oBAAC,QAAD;GAAM,WAAU;GACb,UAAA;EACG,CAAA,CAEL;;CAGP,OAAO,SAAS,oBAAC,cAAD;EAAsB;EAAS,UAAA;CAAoB,CAAA,IAAI;AACzE,CACF;AAEA,UAAU,cAAc"}
@@ -17,7 +17,7 @@ function LazyDatePicker(props, initialValue, value, onChange) {
17
17
  onMouseEnter: loadDatePicker,
18
18
  onFocus: loadDatePicker,
19
19
  onTouchStart: loadDatePicker,
20
- className: cn("flex h-12 w-full items-center justify-center gap-2 rounded-md border border-neutral-200 bg-white px-6 text-neutral-950 hover:bg-neutral-50 focus-visible:border-neutral-950 focus-visible:ring-0", props.buttonClassName),
20
+ className: cn("flex h-12 w-full items-center justify-center gap-2 rounded-lg border border-neutral-200 bg-white px-6 text-neutral-950 hover:bg-neutral-50 focus-visible:border-neutral-950 focus-visible:ring-0", props.buttonClassName),
21
21
  "aria-label": props.placeholder ?? "Open date picker",
22
22
  children: [/* @__PURE__ */ jsx(CalendarBlankIcon, {
23
23
  size: 16,
@@ -1 +1 @@
1
- {"version":3,"file":"LazyDatePicker.js","names":[],"sources":["../../../../src/components/inputs/LazyDatePicker/LazyDatePicker.tsx"],"sourcesContent":["import { CalendarBlankIcon } from '@phosphor-icons/react/dist/ssr/CalendarBlank'\nimport type { ComponentType } from 'react'\nimport { useState } from 'react'\n\nimport { cn } from '../../../lib/utils'\nimport type { DatePickerInput, DatePickerOutput, DatePickerProps } from '../DatePicker/DatePicker'\n\nimport { ValueFormat } from '@/lib/dateUtils'\n\nfunction LazyDatePicker<V extends 'single' | 'range' = 'single', F extends ValueFormat = 'iso'>(\n props: DatePickerProps<V, F>,\n initialValue?: DatePickerInput<V>,\n value?: DatePickerInput<V>,\n onChange?: (value: DatePickerOutput<V, F>) => void,\n) {\n const [DatePickerComponent, setDatePickerComponent] = useState<ComponentType<DatePickerProps<V, F>> | null>(null)\n\n const loadDatePicker = async () => {\n if (!DatePickerComponent) {\n const { DatePicker } = await import('../DatePicker/DatePicker')\n setDatePickerComponent(() => DatePicker)\n }\n }\n\n const PlaceHolderButton = () => {\n return (\n <button\n type=\"button\"\n onMouseEnter={loadDatePicker}\n onFocus={loadDatePicker}\n onTouchStart={loadDatePicker}\n className={cn(\n 'flex h-12 w-full items-center justify-center gap-2 rounded-md border border-neutral-200 bg-white px-6 text-neutral-950 hover:bg-neutral-50 focus-visible:border-neutral-950 focus-visible:ring-0',\n props.buttonClassName,\n )}\n aria-label={props.placeholder ?? 'Open date picker'}\n >\n <CalendarBlankIcon size={16} aria-hidden=\"true\" className=\"h-4 w-4 shrink-0 transition-opacity duration-150\" />\n <span className=\"text-center tracking-[0.08px]\">{props.placeholder}</span>\n </button>\n )\n }\n\n return DatePickerComponent ? (\n <DatePickerComponent onChange={onChange} initialValue={initialValue} value={value} {...props} />\n ) : (\n <PlaceHolderButton />\n )\n}\n\nexport { LazyDatePicker }\n"],"mappings":";;;;;AASA,SAAS,eACP,OACA,cACA,OACA,UACA;CACA,MAAM,CAAC,qBAAqB,0BAA0B,SAAsD,IAAI;CAEhH,MAAM,iBAAiB,YAAY;EACjC,IAAI,CAAC,qBAAqB;GACxB,MAAM,EAAE,eAAe,MAAM,OAAO;GACpC,6BAA6B,UAAU;EACzC;CACF;CAEA,MAAM,0BAA0B;EAC9B,OACE,qBAAC,UAAD;GACE,MAAK;GACL,cAAc;GACd,SAAS;GACT,cAAc;GACd,WAAW,GACT,oMACA,MAAM,eACR;GACA,cAAY,MAAM,eAAe;GATnC,UAAA,CAWE,oBAAC,mBAAD;IAAmB,MAAM;IAAI,eAAY;IAAO,WAAU;GAAoD,CAAA,GAC9G,oBAAC,QAAD;IAAM,WAAU;IAAiC,UAAA,MAAM;GAAkB,CAAA,CACnE;;CAEZ;CAEA,OAAO,sBACL,oBAAC,qBAAD;EAA+B;EAAwB;EAAqB;EAAO,GAAI;CAAQ,CAAA,IAE/F,oBAAC,mBAAD,CAAoB,CAAA;AAExB"}
1
+ {"version":3,"file":"LazyDatePicker.js","names":[],"sources":["../../../../src/components/inputs/LazyDatePicker/LazyDatePicker.tsx"],"sourcesContent":["import { CalendarBlankIcon } from '@phosphor-icons/react/dist/ssr/CalendarBlank'\nimport type { ComponentType } from 'react'\nimport { useState } from 'react'\n\nimport { cn } from '../../../lib/utils'\nimport type { DatePickerInput, DatePickerOutput, DatePickerProps } from '../DatePicker/DatePicker'\n\nimport { ValueFormat } from '@/lib/dateUtils'\n\nfunction LazyDatePicker<V extends 'single' | 'range' = 'single', F extends ValueFormat = 'iso'>(\n props: DatePickerProps<V, F>,\n initialValue?: DatePickerInput<V>,\n value?: DatePickerInput<V>,\n onChange?: (value: DatePickerOutput<V, F>) => void,\n) {\n const [DatePickerComponent, setDatePickerComponent] = useState<ComponentType<DatePickerProps<V, F>> | null>(null)\n\n const loadDatePicker = async () => {\n if (!DatePickerComponent) {\n const { DatePicker } = await import('../DatePicker/DatePicker')\n setDatePickerComponent(() => DatePicker)\n }\n }\n\n const PlaceHolderButton = () => {\n return (\n <button\n type=\"button\"\n onMouseEnter={loadDatePicker}\n onFocus={loadDatePicker}\n onTouchStart={loadDatePicker}\n className={cn(\n 'flex h-12 w-full items-center justify-center gap-2 rounded-lg border border-neutral-200 bg-white px-6 text-neutral-950 hover:bg-neutral-50 focus-visible:border-neutral-950 focus-visible:ring-0',\n props.buttonClassName,\n )}\n aria-label={props.placeholder ?? 'Open date picker'}\n >\n <CalendarBlankIcon size={16} aria-hidden=\"true\" className=\"h-4 w-4 shrink-0 transition-opacity duration-150\" />\n <span className=\"text-center tracking-[0.08px]\">{props.placeholder}</span>\n </button>\n )\n }\n\n return DatePickerComponent ? (\n <DatePickerComponent onChange={onChange} initialValue={initialValue} value={value} {...props} />\n ) : (\n <PlaceHolderButton />\n )\n}\n\nexport { LazyDatePicker }\n"],"mappings":";;;;;AASA,SAAS,eACP,OACA,cACA,OACA,UACA;CACA,MAAM,CAAC,qBAAqB,0BAA0B,SAAsD,IAAI;CAEhH,MAAM,iBAAiB,YAAY;EACjC,IAAI,CAAC,qBAAqB;GACxB,MAAM,EAAE,eAAe,MAAM,OAAO;GACpC,6BAA6B,UAAU;EACzC;CACF;CAEA,MAAM,0BAA0B;EAC9B,OACE,qBAAC,UAAD;GACE,MAAK;GACL,cAAc;GACd,SAAS;GACT,cAAc;GACd,WAAW,GACT,oMACA,MAAM,eACR;GACA,cAAY,MAAM,eAAe;GATnC,UAAA,CAWE,oBAAC,mBAAD;IAAmB,MAAM;IAAI,eAAY;IAAO,WAAU;GAAoD,CAAA,GAC9G,oBAAC,QAAD;IAAM,WAAU;IAAiC,UAAA,MAAM;GAAkB,CAAA,CACnE;;CAEZ;CAEA,OAAO,sBACL,oBAAC,qBAAD;EAA+B;EAAwB;EAAqB;EAAO,GAAI;CAAQ,CAAA,IAE/F,oBAAC,mBAAD,CAAoB,CAAA;AAExB"}
@@ -2,6 +2,7 @@
2
2
  "use client";
3
3
  import { cn } from "../../../lib/utils.js";
4
4
  import { Button, buttonVariants } from "../Button/Button.js";
5
+ import { SURFACE_LIST } from "../../../lib/surface.js";
5
6
  import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "../../utils/Command/Command.js";
6
7
  import { PopoverContent, PopoverRoot, PopoverTrigger } from "../../utils/Popover/Popover.js";
7
8
  import { Chip } from "../../data-display/Chip/Chip.js";
@@ -75,18 +76,18 @@ var MultiSelect = React$1.forwardRef(({ options, onChange, chipProps, defaultVal
75
76
  asChild: true,
76
77
  children: /* @__PURE__ */ jsxs(Button, {
77
78
  id,
78
- variant: "ghost",
79
+ variant: "text",
79
80
  role: "combobox",
80
81
  "aria-expanded": open,
81
- className: cn(`w-full justify-between bg-white ${fieldState?.invalid ? "border-error-400 focus-within:border-error-700" : ""}`, buttonVariants({
82
- variant: "ghost",
82
+ className: cn(buttonVariants({
83
+ variant: "input",
83
84
  size: "lg"
84
- }), className),
85
+ }), "w-full justify-between", open && "border-neutral-950", fieldState?.invalid && "border-error-400 focus-visible:border-error-700", className),
85
86
  children: [placeholder, /* @__PURE__ */ jsx(CaretUpDownIcon, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })]
86
87
  })
87
88
  }),
88
89
  /* @__PURE__ */ jsxs(PopoverContent, {
89
- className: "px-0 py-0",
90
+ className: cn(SURFACE_LIST, "p-0"),
90
91
  children: [/* @__PURE__ */ jsx(CommandInput, {
91
92
  placeholder: commandInputPlaceholder,
92
93
  ref: inputRef,
@@ -102,7 +103,7 @@ var MultiSelect = React$1.forwardRef(({ options, onChange, chipProps, defaultVal
102
103
  max
103
104
  ]
104
105
  })
105
- }), /* @__PURE__ */ jsxs(CommandList, { children: [/* @__PURE__ */ jsx(CommandEmpty, { children: notFoundText }), open && options.length > 0 && /* @__PURE__ */ jsx(CommandGroup, { children: options.map((item) => /* @__PURE__ */ jsx(CommandItem, {
106
+ }), /* @__PURE__ */ jsxs(CommandList, { children: [/* @__PURE__ */ jsx(CommandEmpty, { children: notFoundText }), open && options.length > 0 && /* @__PURE__ */ jsx(CommandGroup, { children: options.map((item) => /* @__PURE__ */ jsxs(CommandItem, {
106
107
  onMouseDown: (event) => {
107
108
  event.preventDefault();
108
109
  event.stopPropagation();
@@ -115,13 +116,11 @@ var MultiSelect = React$1.forwardRef(({ options, onChange, chipProps, defaultVal
115
116
  setSelected((prev) => [...prev, item]);
116
117
  }
117
118
  },
118
- children: /* @__PURE__ */ jsxs("div", {
119
- className: "flex",
120
- children: [/* @__PURE__ */ jsx("div", {
121
- className: "mr-2",
122
- children: selected.some((selectedOption) => selectedOption.value === item.value) ? /* @__PURE__ */ jsx(CheckIcon, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx("div", { className: "h-4 w-4" })
123
- }), /* @__PURE__ */ jsx("div", { children: item.label })]
124
- })
119
+ children: [/* @__PURE__ */ jsx("span", {
120
+ "aria-hidden": true,
121
+ className: "mr-1 flex size-6 shrink-0 items-center justify-end",
122
+ children: selected.some((selectedOption) => selectedOption.value === item.value) && /* @__PURE__ */ jsx(CheckIcon, { weight: "bold" })
123
+ }), item.label]
125
124
  }, `item-${item.value}`)) })] })]
126
125
  }),
127
126
  selected.length > 0 && /* @__PURE__ */ jsx("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSelect.js","names":["React"],"sources":["../../../../src/components/inputs/MultiSelect/MultiSelect.tsx"],"sourcesContent":["'use client'\n\nimport { CaretUpDownIcon } from '@phosphor-icons/react/dist/ssr/CaretUpDown'\nimport { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport * as React from 'react'\nimport { ControllerFieldState } from 'react-hook-form'\n\nimport { Chip } from '../../data-display/Chip'\nimport { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from '../../utils/Command'\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from '../../utils/Popover'\nimport { Button, buttonVariants } from '../Button'\n\nimport { cn } from '@/lib/utils'\n\n/**\n * Represents a selectable option in the MultiSelect component\n */\ntype Option = {\n /** Unique identifier for the option */\n value: string\n /** Display text for the option */\n label: string\n}\n\nexport type MultiSelectProps = {\n /**\n * Array of options to display in the select menu\n */\n options: Array<Option>\n\n /**\n * Props to be passed to the individual Chip components\n */\n chipProps?: React.ComponentProps<typeof Chip>\n\n /**\n * Callback fired when selected values change\n * @param value Array of selected option values\n */\n onChange?: (value: Array<string>) => void\n\n /**\n * Form field state from react-hook-form\n */\n fieldState?: ControllerFieldState\n\n /**\n * Initially selected option values\n */\n defaultValue?: Array<string>\n\n /**\n * Text shown in the select button when no option is selected\n * @default \"Select your options...\"\n */\n placeholder?: string\n\n /**\n * Text shown when no options match the search query\n * @default \"Options not found\"\n */\n notFoundText?: string\n\n /**\n * Placeholder text for the search input\n * @default \"Search...\"\n */\n commandInputPlaceholder?: string\n\n /**\n * Maximum number of items that can be selected\n * Shows a counter chip when specified\n */\n max?: number\n\n /**\n * Additional class names for the select button component\n */\n className?: string\n\n /**\n * Unique identifier for the select button component\n */\n id?: string\n}\n\n/**\n * A multi-select component with search functionality and chip display for selected items.\n * Supports keyboard navigation, search filtering, and maximum selection limit.\n *\n * @example\n * // Basic usage\n * <MultiSelect\n * options={[\n * { value: '1', label: 'Option 1' },\n * { value: '2', label: 'Option 2' }\n * ]}\n * onChange={(values) => console.log(values)}\n * />\n *\n * // With maximum selection limit\n * <MultiSelect\n * options={options}\n * max={3}\n * placeholder=\"Select up to 3 options\"\n * />\n *\n * // With custom chip styling\n * <MultiSelect\n * options={options}\n * chipProps={{ variant: 'primary' }}\n * />\n */\nexport const MultiSelect = React.forwardRef<HTMLInputElement, MultiSelectProps>(\n ({\n options,\n onChange,\n chipProps,\n defaultValue,\n placeholder = 'Select your options...',\n notFoundText = 'Options not found',\n fieldState,\n commandInputPlaceholder = 'Search...',\n max,\n className,\n id,\n }) => {\n const inputRef = React.useRef<HTMLInputElement>(null)\n const [open, setOpen] = React.useState(false)\n const [selected, setSelected] = React.useState<MultiSelectProps['options']>(\n options.filter((option) => defaultValue?.includes(option.value) ?? []),\n )\n const [inputValue, setInputValue] = React.useState('')\n\n const onChangeRef = React.useRef(onChange)\n React.useEffect(() => {\n onChangeRef.current = onChange\n })\n\n const handleUnselect = React.useCallback((item: Option) => {\n setSelected((prev) => prev.filter((selectedOption) => selectedOption.value !== item.value))\n }, [])\n\n const handleKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLDivElement>) => {\n const input = inputRef.current\n if (input) {\n if (event.key === 'Delete' || event.key === 'Backspace') {\n if (input.value === '') {\n setSelected((prev) => {\n const newSelected = [...prev]\n newSelected.pop()\n return newSelected\n })\n }\n }\n\n if (event.key === 'Escape') {\n input.blur()\n }\n }\n }, [])\n\n React.useEffect(() => {\n onChangeRef.current?.(selected.map((item) => item.value))\n }, [selected])\n\n return (\n <PopoverRoot open={open} onOpenChange={setOpen}>\n <Command onKeyDown={handleKeyDown}>\n <PopoverTrigger asChild>\n <Button\n id={id}\n variant=\"ghost\"\n role=\"combobox\"\n aria-expanded={open}\n className={cn(\n `w-full justify-between bg-white ${\n fieldState?.invalid ? 'border-error-400 focus-within:border-error-700' : ''\n }`,\n buttonVariants({ variant: 'ghost', size: 'lg' }),\n className,\n )}\n >\n {placeholder}\n <CaretUpDownIcon className=\"ml-2 h-4 w-4 shrink-0 opacity-50\" />\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"px-0 py-0\">\n <CommandInput\n placeholder={commandInputPlaceholder}\n ref={inputRef}\n value={inputValue}\n onValueChange={setInputValue}\n >\n {max && (\n <Chip\n variant={selected.length >= max ? 'primary' : 'default'}\n size=\"sm\"\n className=\"my-1 whitespace-nowrap\"\n >\n {selected.length} / {max}\n </Chip>\n )}\n </CommandInput>\n\n <CommandList>\n <CommandEmpty>{notFoundText}</CommandEmpty>\n {open && options.length > 0 && (\n <CommandGroup>\n {options.map((item) => (\n <CommandItem\n key={`item-${item.value}`}\n onMouseDown={(event) => {\n event.preventDefault()\n event.stopPropagation()\n }}\n onSelect={(value) => {\n const isSelected = selected.find((selectedOption) => selectedOption.label === value)\n if (isSelected) {\n handleUnselect(isSelected)\n } else if (!max || selected.length < max) {\n setInputValue('')\n setSelected((prev) => [...prev, item])\n }\n }}\n >\n <div className=\"flex\">\n <div className=\"mr-2\">\n {selected.some((selectedOption) => selectedOption.value === item.value) ? (\n <CheckIcon className=\"h-4 w-4\" />\n ) : (\n <div className=\"h-4 w-4\" />\n )}\n </div>\n <div>{item.label}</div>\n </div>\n </CommandItem>\n ))}\n </CommandGroup>\n )}\n </CommandList>\n </PopoverContent>\n {selected.length > 0 && (\n <div className=\"flex flex-wrap gap-2 pt-2\">\n {selected.map((item) => (\n <Chip key={item.value} {...chipProps} className=\"gap-2 pr-1\" onRemove={() => handleUnselect(item)}>\n {item.label}\n </Chip>\n ))}\n </div>\n )}\n </Command>\n </PopoverRoot>\n )\n },\n)\n\nMultiSelect.displayName = 'MultiSelect'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiHA,IAAA,cAAA,QAAA,YAAA,EAAA,SAAA,UAAA,WAAA,cAAA,cAAA,0BAAA,eAAA,qBAAA,YAAA,0BAAA,aAAA,KAAA,WAAA,SAAA;CAcI,MAAA,WAAA,QAAA,OAAA,IAAA;CACA,MAAA,CAAA,MAAA,WAAA,QAAA,SAAA,KAAA;CACA,MAAA,CAAA,UAAA,eAAA,QAAA,SAAA,QAAA,QAAA,WAAA,cAAA,SAAA,OAAA,KAAA,KAAA,CAAA,CAAA,CAAA;CAGA,MAAA,CAAA,YAAA,iBAAA,QAAA,SAAA,EAAA;CAEA,MAAA,cAAA,QAAA,OAAA,QAAA;CACA,QAAA,gBAAA;EACE,YAAA,UAAA;CACF,CAAA;CAEA,MAAA,iBAAA,QAAA,aAAA,SAAA;EACE,aAAA,SAAA,KAAA,QAAA,mBAAA,eAAA,UAAA,KAAA,KAAA,CAAA;CACF,GAAA,CAAA,CAAA;CAEA,MAAA,gBAAA,QAAA,aAAA,UAAA;EACE,MAAA,QAAA,SAAA;EACA,IAAA,OAAA;GACE,IAAA,MAAA,QAAA,YAAA,MAAA,QAAA,aACM;QAAA,MAAA,UAAA,IAAA,a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AA,OAAA,SAAA,SAAA,KAAA;QACL,cAAA,EAAA;QACA,aAAA,SAAA,CAAA,GAAA,MAAA,IAAA,CAAA;OACF;MACF;MAEA,UAAA,qBAAA,OAAA;OAAK,WAAA;OAAL,UAAA,CAAA,oBAAA,OAAA;QACO,WAAA;QACF,UAAA,SAAA,MAAA,mBAAA,eAAA,UAAA,KAAA,KAAA,IAAA,oBAAA,WAAA,EAAA,WAAA,UAAA,CAAA,IAAA,oBAAA,OAAA,EAAA,WAAA,UAAA,CAAA;OAKE,CAAA,GAAA,oBAAA,OAAA,EAAA,UAAA,KAAA,MAAA,CAAA,CAAA;;KAGI,GAAA,QAAA,KAAA,OAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA;;IAMtB,SAAA,SAAA,KAAA,oBAAA,OAAA;KACM,WAAA;KACF,UAAA,SAAA,KAAA,SAAA,oBAAA,MAAA;MACwB,GAAA;MAAe,WAAA;MAAuB,gBAAA,eAAA,IAAA;MAC1D,UAAA,KAAA;KACG,GAAA,KAAA,KAAA,CAAA;IAEL,CAAA;GAEA;;CACE,CAAA;AAEjB,CAAA;AAGF,YAAA,cAAA"}
1
+ {"version":3,"file":"MultiSelect.js","names":["React"],"sources":["../../../../src/components/inputs/MultiSelect/MultiSelect.tsx"],"sourcesContent":["'use client'\n\nimport { CaretUpDownIcon } from '@phosphor-icons/react/dist/ssr/CaretUpDown'\nimport { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport * as React from 'react'\nimport { ControllerFieldState } from 'react-hook-form'\n\nimport { Chip } from '../../data-display/Chip'\nimport { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from '../../utils/Command'\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from '../../utils/Popover'\nimport { Button, buttonVariants } from '../Button'\n\nimport { SURFACE_LIST } from '@/lib/surface'\nimport { cn } from '@/lib/utils'\n\n/**\n * Represents a selectable option in the MultiSelect component\n */\ntype Option = {\n /** Unique identifier for the option */\n value: string\n /** Display text for the option */\n label: string\n}\n\nexport type MultiSelectProps = {\n /**\n * Array of options to display in the select menu\n */\n options: Array<Option>\n\n /**\n * Props to be passed to the individual Chip components\n */\n chipProps?: React.ComponentProps<typeof Chip>\n\n /**\n * Callback fired when selected values change\n * @param value Array of selected option values\n */\n onChange?: (value: Array<string>) => void\n\n /**\n * Form field state from react-hook-form\n */\n fieldState?: ControllerFieldState\n\n /**\n * Initially selected option values\n */\n defaultValue?: Array<string>\n\n /**\n * Text shown in the select button when no option is selected\n * @default \"Select your options...\"\n */\n placeholder?: string\n\n /**\n * Text shown when no options match the search query\n * @default \"Options not found\"\n */\n notFoundText?: string\n\n /**\n * Placeholder text for the search input\n * @default \"Search...\"\n */\n commandInputPlaceholder?: string\n\n /**\n * Maximum number of items that can be selected\n * Shows a counter chip when specified\n */\n max?: number\n\n /**\n * Additional class names for the select button component\n */\n className?: string\n\n /**\n * Unique identifier for the select button component\n */\n id?: string\n}\n\n/**\n * A multi-select component with search functionality and chip display for selected items.\n * Supports keyboard navigation, search filtering, and maximum selection limit.\n *\n * @example\n * // Basic usage\n * <MultiSelect\n * options={[\n * { value: '1', label: 'Option 1' },\n * { value: '2', label: 'Option 2' }\n * ]}\n * onChange={(values) => console.log(values)}\n * />\n *\n * // With maximum selection limit\n * <MultiSelect\n * options={options}\n * max={3}\n * placeholder=\"Select up to 3 options\"\n * />\n *\n * // With custom chip styling\n * <MultiSelect\n * options={options}\n * chipProps={{ variant: 'primary' }}\n * />\n */\nexport const MultiSelect = React.forwardRef<HTMLInputElement, MultiSelectProps>(\n ({\n options,\n onChange,\n chipProps,\n defaultValue,\n placeholder = 'Select your options...',\n notFoundText = 'Options not found',\n fieldState,\n commandInputPlaceholder = 'Search...',\n max,\n className,\n id,\n }) => {\n const inputRef = React.useRef<HTMLInputElement>(null)\n const [open, setOpen] = React.useState(false)\n const [selected, setSelected] = React.useState<MultiSelectProps['options']>(\n options.filter((option) => defaultValue?.includes(option.value) ?? []),\n )\n const [inputValue, setInputValue] = React.useState('')\n\n const onChangeRef = React.useRef(onChange)\n React.useEffect(() => {\n onChangeRef.current = onChange\n })\n\n const handleUnselect = React.useCallback((item: Option) => {\n setSelected((prev) => prev.filter((selectedOption) => selectedOption.value !== item.value))\n }, [])\n\n const handleKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLDivElement>) => {\n const input = inputRef.current\n if (input) {\n if (event.key === 'Delete' || event.key === 'Backspace') {\n if (input.value === '') {\n setSelected((prev) => {\n const newSelected = [...prev]\n newSelected.pop()\n return newSelected\n })\n }\n }\n\n if (event.key === 'Escape') {\n input.blur()\n }\n }\n }, [])\n\n React.useEffect(() => {\n onChangeRef.current?.(selected.map((item) => item.value))\n }, [selected])\n\n return (\n <PopoverRoot open={open} onOpenChange={setOpen}>\n <Command onKeyDown={handleKeyDown}>\n <PopoverTrigger asChild>\n <Button\n id={id}\n variant=\"text\"\n role=\"combobox\"\n aria-expanded={open}\n className={cn(\n buttonVariants({ variant: 'input', size: 'lg' }),\n 'w-full justify-between',\n open && 'border-neutral-950',\n fieldState?.invalid && 'border-error-400 focus-visible:border-error-700',\n className,\n )}\n >\n {placeholder}\n <CaretUpDownIcon className=\"ml-2 h-4 w-4 shrink-0 opacity-50\" />\n </Button>\n </PopoverTrigger>\n <PopoverContent className={cn(SURFACE_LIST, 'p-0')}>\n <CommandInput\n placeholder={commandInputPlaceholder}\n ref={inputRef}\n value={inputValue}\n onValueChange={setInputValue}\n >\n {max && (\n <Chip\n variant={selected.length >= max ? 'primary' : 'default'}\n size=\"sm\"\n className=\"my-1 whitespace-nowrap\"\n >\n {selected.length} / {max}\n </Chip>\n )}\n </CommandInput>\n\n <CommandList>\n <CommandEmpty>{notFoundText}</CommandEmpty>\n {open && options.length > 0 && (\n <CommandGroup>\n {options.map((item) => (\n <CommandItem\n key={`item-${item.value}`}\n onMouseDown={(event) => {\n event.preventDefault()\n event.stopPropagation()\n }}\n onSelect={(value) => {\n const isSelected = selected.find((selectedOption) => selectedOption.label === value)\n if (isSelected) {\n handleUnselect(isSelected)\n } else if (!max || selected.length < max) {\n setInputValue('')\n setSelected((prev) => [...prev, item])\n }\n }}\n >\n <span aria-hidden className=\"mr-1 flex size-6 shrink-0 items-center justify-end\">\n {selected.some((selectedOption) => selectedOption.value === item.value) && (\n <CheckIcon weight=\"bold\" />\n )}\n </span>\n {item.label}\n </CommandItem>\n ))}\n </CommandGroup>\n )}\n </CommandList>\n </PopoverContent>\n {selected.length > 0 && (\n <div className=\"flex flex-wrap gap-2 pt-2\">\n {selected.map((item) => (\n <Chip key={item.value} {...chipProps} className=\"gap-2 pr-1\" onRemove={() => handleUnselect(item)}>\n {item.label}\n </Chip>\n ))}\n </div>\n )}\n </Command>\n </PopoverRoot>\n )\n },\n)\n\nMultiSelect.displayName = 'MultiSelect'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkHA,IAAA,cAAA,QAAA,YAAA,EAAA,SAAA,UAAA,WAAA,cAAA,cAAA,0BAAA,eAAA,qBAAA,YAAA,0BAAA,aAAA,KAAA,WAAA,SAAA;CAcI,MAAA,WAAA,QAAA,OAAA,IAAA;CACA,MAAA,CAAA,MAAA,WAAA,QAAA,SAAA,KAAA;CACA,MAAA,CAAA,UAAA,eAAA,QAAA,SAAA,QAAA,QAAA,WAAA,cAAA,SAAA,OAAA,KAAA,KAAA,CAAA,CAAA,CAAA;CAGA,MAAA,CAAA,YAAA,iBAAA,QAAA,SAAA,EAAA;CAEA,MAAA,cAAA,QAAA,OAAA,QAAA;CACA,QAAA,gBAAA;EACE,YAAA,UAAA;CACF,CAAA;CAEA,MAAA,iBAAA,QAAA,aAAA,SAAA;EACE,aAAA,SAAA,KAAA,QAAA,mBAAA,eAAA,UAAA,KAAA,KAAA,CAAA;CACF,GAAA,CAAA,CAAA;CAEA,MAAA,gBAAA,QAAA,aAAA,UAAA;EACE,MAAA,QAAA,SAAA;EACA,IAAA,OAAA;GACE,IAAA,MAAA,QAAA,YA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A,mBAAA,eAAA,UAAA,KAAA;OACA,IAAA,YAAA,eAAA,UAAA;YAEO,IAAA,CAAA,OAAA,SAAA,SAAA,KAAA;QACL,cAAA,EAAA;QACA,aAAA,SAAA,CAAA,GAAA,MAAA,IAAA,CAAA;OACF;MACF;MAdF,UAAA,CAAA,oBAAA,QAAA;OAgBQ,eAAA;OAAY,WAAA;OACf,UAAA,SAAA,MAAA,mBAAA,eAAA,UAAA,KAAA,KAAA,KAAA,oBAAA,WAAA,EAAA,QAAA,OAAA,CAAA;MAGG,CAAA,GAAA,KAAA,KAAA;KAnBD,GAAA,QAAA,KAAA,OAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA;;IA2BhB,SAAA,SAAA,KAAA,oBAAA,OAAA;KACM,WAAA;KACF,UAAA,SAAA,KAAA,SAAA,oBAAA,MAAA;MACwB,GAAA;MAAe,WAAA;MAAuB,gBAAA,eAAA,IAAA;MAC1D,UAAA,KAAA;KACG,GAAA,KAAA,KAAA,CAAA;IAEL,CAAA;GAEA;;CACE,CAAA;AAEjB,CAAA;AAGF,YAAA,cAAA"}
@@ -1,4 +1,5 @@
1
1
  import { cn, createSearchMatcher } from "../../../lib/utils.js";
2
+ import { SURFACE_LIST } from "../../../lib/surface.js";
2
3
  import { useListScroll } from "../../../lib/useListScroll.js";
3
4
  import { Command, CommandInput } from "../../utils/Command/Command.js";
4
5
  import { PopoverContent, PopoverRoot, PopoverTrigger } from "../../utils/Popover/Popover.js";
@@ -115,7 +116,7 @@ function PhoneInput(props) {
115
116
  })
116
117
  }), /* @__PURE__ */ jsx(PopoverContent, {
117
118
  align: "start",
118
- className: "w-72 overflow-hidden p-0",
119
+ className: cn(SURFACE_LIST, "w-72 overflow-hidden p-0"),
119
120
  children: /* @__PURE__ */ jsxs(Command, {
120
121
  shouldFilter: false,
121
122
  defaultValue: selectedValue,
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneInput.js","names":["React","_Fragment"],"sources":["../../../../src/components/inputs/PhoneInput/PhoneInput.tsx"],"sourcesContent":["import { CaretDownIcon } from '@phosphor-icons/react/dist/ssr/CaretDown'\nimport { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport { GlobeIcon } from '@phosphor-icons/react/dist/ssr/Globe'\nimport { WarningCircleIcon } from '@phosphor-icons/react/dist/ssr/WarningCircle'\nimport * as React from 'react'\n\nimport { Flag } from '../../data-display/Flag'\nimport { Command, CommandInput } from '../../utils/Command'\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from '../../utils/Popover'\nimport { VirtualizedComboboxList } from '../Combobox'\n\nimport { usePhoneField } from './hooks'\nimport { exampleNational } from './phone'\nimport type { PhoneCountry, PhoneInputCountryAccessors, PhoneValue } from './types'\n\nimport { buildCountries, splitByPriority } from '@/lib/countries'\nimport { useListScroll } from '@/lib/useListScroll'\nimport { cn, createSearchMatcher } from '@/lib/utils'\n\ntype PhoneInputBaseProps = {\n /** Lands on the number input, so `<label htmlFor>` targets it. */\n id?: string\n name?: string\n className?: string\n disabled?: boolean\n error?: boolean\n inputRef?: React.Ref<HTMLInputElement>\n /** Controlled when set, otherwise seeded by `defaultCountry`. */\n country?: string\n /** National digits, no country code or separators. */\n number?: string\n onChange?: (value: PhoneValue) => void\n /** ISO code, used when `country` is uncontrolled. */\n defaultCountry?: string\n /** ISO codes pinned above the list, in order. */\n priorityCountries?: Array<string>\n numberInputProps?: Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'id' | 'name' | 'disabled' | 'value' | 'onChange' | 'onKeyDown' | 'className'\n >\n /** Defaults to the country's example number. */\n placeholder?: string\n countryAriaLabel?: string\n searchPlaceholder?: string\n emptyMessage?: string\n 'aria-describedby'?: string\n 'aria-invalid'?: boolean\n}\n\ntype ResolvedPhoneInputProps<T extends object> = PhoneInputBaseProps &\n Partial<PhoneInputCountryAccessors<T>> & {\n /** Defaults to the generated list. */\n countries?: Array<T>\n /** Names the generated list. Ignored when `countries` is passed. */\n locale?: string\n onChange?: (value: PhoneValue<T>) => void\n }\n\nexport type PhoneInputDefaultProps = ResolvedPhoneInputProps<PhoneCountry>\n\nexport type PhoneInputCustomProps<T extends object> = PhoneInputBaseProps &\n PhoneInputCountryAccessors<T> & {\n countries: Array<T>\n onChange?: (value: PhoneValue<T>) => void\n }\n\nexport type PhoneInputProps<T extends object = PhoneCountry> = PhoneInputDefaultProps | PhoneInputCustomProps<T>\n\nconst defaultAccessors: PhoneInputCountryAccessors<PhoneCountry> = {\n getCountryValue: (country) => country.isoCode,\n getCountryIsoCode: (country) => country.isoCode,\n getCountryDialCode: (country) => country.dialCode,\n getCountryFlag: (country) => country.flag,\n getCountryName: (country) => country.name,\n}\n\nexport function PhoneInput(props: PhoneInputDefaultProps): React.ReactElement\nexport function PhoneInput<T extends object>(props: PhoneInputCustomProps<T>): React.ReactElement\nexport function PhoneInput<T extends object>(props: ResolvedPhoneInputProps<T>): React.ReactElement {\n const {\n id,\n name,\n className,\n disabled = false,\n error = false,\n inputRef: externalInputRef,\n countries,\n country,\n onChange,\n number,\n defaultCountry,\n priorityCountries,\n locale = 'en',\n numberInputProps,\n placeholder,\n countryAriaLabel = 'Select country',\n searchPlaceholder = 'Search...',\n emptyMessage = 'No results found.',\n getCountryValue,\n getCountryIsoCode,\n getCountryDialCode,\n getCountryFlag,\n getCountryName,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n } = props\n\n const defaults = defaultAccessors as unknown as PhoneInputCountryAccessors<T>\n const options = countries ?? (buildCountries(locale) as unknown as Array<T>)\n const resolveValue = getCountryValue ?? defaults.getCountryValue\n const resolveIsoCode = getCountryIsoCode ?? defaults.getCountryIsoCode\n const resolveDialCode = getCountryDialCode ?? defaults.getCountryDialCode\n const resolveFlag = getCountryFlag ?? defaults.getCountryFlag\n const resolveName = getCountryName ?? defaults.getCountryName\n\n const {\n isoOf,\n selectedValue,\n selectedOption,\n selectedIso,\n displayValue,\n inputElRef,\n selectCountry,\n onInputChange,\n onInputKeyDown,\n } = usePhoneField({\n options,\n getCountryValue: resolveValue,\n getCountryDialCode: resolveDialCode,\n getCountryIsoCode: resolveIsoCode,\n country,\n number,\n onChange,\n defaultCountry,\n priorityCountries,\n })\n\n const [open, setOpen] = React.useState(false)\n const [search, setSearch] = React.useState('')\n const listRef = useListScroll({ open, searchTerm: search, selectedValue: undefined })\n\n const renderFlag = (option: T) => {\n const iso = isoOf(option)\n return iso ? <Flag iso={iso} /> : <span className=\"text-lg leading-none\">{resolveFlag(option)}</span>\n }\n\n const prefixDisabled = disabled || options.length <= 1\n\n const matches = createSearchMatcher(search)\n const filteredOptions = search.trim()\n ? options.filter((option) => matches([resolveName(option), resolveDialCode(option), isoOf(option) ?? '']))\n : options\n const { priority: priorityOptions, rest: restOptions } = splitByPriority(filteredOptions, priorityCountries, isoOf)\n\n const handleOpenChange = (next: boolean) => {\n setOpen(next)\n if (!next) setSearch('')\n }\n\n const handleSelect = (value: string) => {\n const option = filteredOptions.find((candidate) => resolveValue(candidate) === value)\n if (option) selectCountry(option)\n handleOpenChange(false)\n }\n\n const renderOption = (option: T, isSelected: boolean) => (\n <>\n {renderFlag(option)}\n <span className=\"shrink-0 text-neutral-500\">{resolveDialCode(option)}</span>\n <span className=\"truncate\">{resolveName(option)}</span>\n {isSelected && (\n <CheckIcon data-testid=\"selected-check\" weight=\"bold\" className=\"ml-auto h-4 w-4 shrink-0 text-neutral-950\" />\n )}\n </>\n )\n\n return (\n <div className={cn('flex w-full flex-col gap-1', className)}>\n <div\n data-testid=\"phone-input-shell\"\n className={cn(\n 'flex h-12 w-full items-stretch overflow-hidden rounded-lg border border-neutral-200 bg-white transition-colors has-[input:focus]:border-neutral-950',\n disabled && 'bg-neutral-50',\n error && 'border-error-400 has-[input:focus]:border-error-700',\n )}\n >\n <PopoverRoot open={open} onOpenChange={handleOpenChange}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n id={id ? `${id}-country` : undefined}\n disabled={prefixDisabled}\n aria-label={selectedOption ? resolveName(selectedOption) : countryAriaLabel}\n className={cn(\n 'flex shrink-0 items-center gap-1.5 border-r border-neutral-200 px-3 text-base text-neutral-950 transition-colors outline-none',\n options.length > 1 && 'w-28',\n !prefixDisabled && 'hover:bg-neutral-50',\n prefixDisabled && 'cursor-not-allowed',\n disabled && 'opacity-50',\n )}\n >\n {selectedOption ? (\n <>\n {renderFlag(selectedOption)}\n <span className=\"tabular-nums\">{resolveDialCode(selectedOption)}</span>\n </>\n ) : (\n <GlobeIcon className=\"h-5 w-5 text-neutral-300\" aria-hidden />\n )}\n {!prefixDisabled && <CaretDownIcon className=\"ml-auto h-4 w-4 shrink-0 opacity-50\" />}\n </button>\n </PopoverTrigger>\n <PopoverContent align=\"start\" className=\"w-72 overflow-hidden p-0\">\n <Command shouldFilter={false} defaultValue={selectedValue}>\n <CommandInput placeholder={searchPlaceholder} value={search} onValueChange={setSearch} />\n <VirtualizedComboboxList\n listRef={listRef}\n localOptions={restOptions}\n specialOptions={priorityOptions}\n loading={false}\n loadingPlaceholder=\"\"\n emptyMessage={emptyMessage}\n value={selectedValue}\n getOptionValue={resolveValue}\n getOptionLabel={resolveName}\n handleSelect={handleSelect}\n renderOption={renderOption}\n maxHeight={300}\n />\n </Command>\n </PopoverContent>\n </PopoverRoot>\n\n <input\n /* eslint-disable react-hooks/immutability -- merging the internal ref with the caller-supplied `inputRef` is the standard ref-forwarding idiom */\n ref={(el) => {\n inputElRef.current = el\n if (typeof externalInputRef === 'function') externalInputRef(el)\n else if (externalInputRef) externalInputRef.current = el\n }}\n /* eslint-enable react-hooks/immutability */\n id={id}\n name={name}\n type=\"tel\"\n inputMode=\"tel\"\n autoComplete=\"tel-national\"\n disabled={disabled}\n value={displayValue}\n onChange={onInputChange}\n onKeyDown={onInputKeyDown}\n placeholder={placeholder ?? exampleNational(selectedIso)}\n aria-invalid={ariaInvalid ?? (error || undefined)}\n aria-describedby={ariaDescribedBy}\n className=\"min-w-0 flex-1 bg-transparent px-3 text-base text-neutral-950 outline-none placeholder:text-neutral-300 disabled:cursor-not-allowed disabled:opacity-50\"\n {...numberInputProps}\n />\n\n {error && (\n <div className=\"flex items-center pr-3\">\n <WarningCircleIcon data-testid=\"exclaim-icon\" className=\"text-error-500\" size={18} />\n </div>\n )}\n </div>\n </div>\n )\n}\n\nPhoneInput.displayName = 'PhoneInput'\n"],"mappings":";;;;;;;;;;;;;;;;AAoEA,IAAM,mBAA6D;CACjE,kBAAkB,YAAY,QAAQ;CACtC,oBAAoB,YAAY,QAAQ;CACxC,qBAAqB,YAAY,QAAQ;CACzC,iBAAiB,YAAY,QAAQ;CACrC,iBAAiB,YAAY,QAAQ;AACvC;AAIA,SAAgB,WAA6B,OAAuD;CAClG,MAAM,EACJ,IACA,MACA,WACA,WAAW,OACX,QAAQ,OACR,UAAU,kBACV,WACA,SACA,UACA,QACA,gBACA,mBACA,SAAS,MACT,kBACA,aACA,mBAAmB,kBACnB,oBAAoB,aACpB,eAAe,qBACf,iBACA,mBACA,oBACA,gBACA,gBACA,oBAAoB,iBACpB,gBAAgB,gBACd;CAEJ,MAAM,WAAW;CACjB,MAAM,UAAU,aAAc,eAAe,MAAM;CACnD,MAAM,eAAe,mBAAmB,SAAS;CACjD,MAAM,iBAAiB,qBAAqB,SAAS;CACrD,MAAM,kBAAkB,sBAAsB,SAAS;CACvD,MAAM,cAAc,kBAAkB,SAAS;CAC/C,MAAM,cAAc,kBAAkB,SAAS;CAE/C,MAAM,EACJ,OACA,eACA,gBACA,aACA,cACA,YACA,eACA,eACA,mBACE,cAAc;EAChB;EACA,iBAAiB;EACjB,oBAAoB;EACpB,mBAAmB;EACnB;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,CAAC,MAAM,WAAWA,QAAM,SAAS,KAAK;CAC5C,MAAM,CAAC,QAAQ,aAAaA,QAAM,SAAS,EAAE;CAC7C,MAAM,UAAU,cAAc;EAAE;EAAM,YAAY;EAAQ,eAAe,KAAA;CAAU,CAAC;CAEpF,MAAM,cAAc,WAAc;EAChC,MAAM,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AD;KAAK,WAAU;KACb,UAAA,oBAAC,mBAAD;MAAmB,eAAY;MAAe,WAAU;MAAiB,MAAM;KAAK,CAAA;IACjF,CAAA;GAEJ;;CACF,CAAA;AAET;AAEA,WAAW,cAAc"}
1
+ {"version":3,"file":"PhoneInput.js","names":["React","_Fragment"],"sources":["../../../../src/components/inputs/PhoneInput/PhoneInput.tsx"],"sourcesContent":["import { CaretDownIcon } from '@phosphor-icons/react/dist/ssr/CaretDown'\nimport { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport { GlobeIcon } from '@phosphor-icons/react/dist/ssr/Globe'\nimport { WarningCircleIcon } from '@phosphor-icons/react/dist/ssr/WarningCircle'\nimport * as React from 'react'\n\nimport { Flag } from '../../data-display/Flag'\nimport { Command, CommandInput } from '../../utils/Command'\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from '../../utils/Popover'\nimport { VirtualizedComboboxList } from '../Combobox'\n\nimport { usePhoneField } from './hooks'\nimport { exampleNational } from './phone'\nimport type { PhoneCountry, PhoneInputCountryAccessors, PhoneValue } from './types'\n\nimport { buildCountries, splitByPriority } from '@/lib/countries'\nimport { SURFACE_LIST } from '@/lib/surface'\nimport { useListScroll } from '@/lib/useListScroll'\nimport { cn, createSearchMatcher } from '@/lib/utils'\n\ntype PhoneInputBaseProps = {\n /** Lands on the number input, so `<label htmlFor>` targets it. */\n id?: string\n name?: string\n className?: string\n disabled?: boolean\n error?: boolean\n inputRef?: React.Ref<HTMLInputElement>\n /** Controlled when set, otherwise seeded by `defaultCountry`. */\n country?: string\n /** National digits, no country code or separators. */\n number?: string\n onChange?: (value: PhoneValue) => void\n /** ISO code, used when `country` is uncontrolled. */\n defaultCountry?: string\n /** ISO codes pinned above the list, in order. */\n priorityCountries?: Array<string>\n numberInputProps?: Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'id' | 'name' | 'disabled' | 'value' | 'onChange' | 'onKeyDown' | 'className'\n >\n /** Defaults to the country's example number. */\n placeholder?: string\n countryAriaLabel?: string\n searchPlaceholder?: string\n emptyMessage?: string\n 'aria-describedby'?: string\n 'aria-invalid'?: boolean\n}\n\ntype ResolvedPhoneInputProps<T extends object> = PhoneInputBaseProps &\n Partial<PhoneInputCountryAccessors<T>> & {\n /** Defaults to the generated list. */\n countries?: Array<T>\n /** Names the generated list. Ignored when `countries` is passed. */\n locale?: string\n onChange?: (value: PhoneValue<T>) => void\n }\n\nexport type PhoneInputDefaultProps = ResolvedPhoneInputProps<PhoneCountry>\n\nexport type PhoneInputCustomProps<T extends object> = PhoneInputBaseProps &\n PhoneInputCountryAccessors<T> & {\n countries: Array<T>\n onChange?: (value: PhoneValue<T>) => void\n }\n\nexport type PhoneInputProps<T extends object = PhoneCountry> = PhoneInputDefaultProps | PhoneInputCustomProps<T>\n\nconst defaultAccessors: PhoneInputCountryAccessors<PhoneCountry> = {\n getCountryValue: (country) => country.isoCode,\n getCountryIsoCode: (country) => country.isoCode,\n getCountryDialCode: (country) => country.dialCode,\n getCountryFlag: (country) => country.flag,\n getCountryName: (country) => country.name,\n}\n\nexport function PhoneInput(props: PhoneInputDefaultProps): React.ReactElement\nexport function PhoneInput<T extends object>(props: PhoneInputCustomProps<T>): React.ReactElement\nexport function PhoneInput<T extends object>(props: ResolvedPhoneInputProps<T>): React.ReactElement {\n const {\n id,\n name,\n className,\n disabled = false,\n error = false,\n inputRef: externalInputRef,\n countries,\n country,\n onChange,\n number,\n defaultCountry,\n priorityCountries,\n locale = 'en',\n numberInputProps,\n placeholder,\n countryAriaLabel = 'Select country',\n searchPlaceholder = 'Search...',\n emptyMessage = 'No results found.',\n getCountryValue,\n getCountryIsoCode,\n getCountryDialCode,\n getCountryFlag,\n getCountryName,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n } = props\n\n const defaults = defaultAccessors as unknown as PhoneInputCountryAccessors<T>\n const options = countries ?? (buildCountries(locale) as unknown as Array<T>)\n const resolveValue = getCountryValue ?? defaults.getCountryValue\n const resolveIsoCode = getCountryIsoCode ?? defaults.getCountryIsoCode\n const resolveDialCode = getCountryDialCode ?? defaults.getCountryDialCode\n const resolveFlag = getCountryFlag ?? defaults.getCountryFlag\n const resolveName = getCountryName ?? defaults.getCountryName\n\n const {\n isoOf,\n selectedValue,\n selectedOption,\n selectedIso,\n displayValue,\n inputElRef,\n selectCountry,\n onInputChange,\n onInputKeyDown,\n } = usePhoneField({\n options,\n getCountryValue: resolveValue,\n getCountryDialCode: resolveDialCode,\n getCountryIsoCode: resolveIsoCode,\n country,\n number,\n onChange,\n defaultCountry,\n priorityCountries,\n })\n\n const [open, setOpen] = React.useState(false)\n const [search, setSearch] = React.useState('')\n const listRef = useListScroll({ open, searchTerm: search, selectedValue: undefined })\n\n const renderFlag = (option: T) => {\n const iso = isoOf(option)\n return iso ? <Flag iso={iso} /> : <span className=\"text-lg leading-none\">{resolveFlag(option)}</span>\n }\n\n const prefixDisabled = disabled || options.length <= 1\n\n const matches = createSearchMatcher(search)\n const filteredOptions = search.trim()\n ? options.filter((option) => matches([resolveName(option), resolveDialCode(option), isoOf(option) ?? '']))\n : options\n const { priority: priorityOptions, rest: restOptions } = splitByPriority(filteredOptions, priorityCountries, isoOf)\n\n const handleOpenChange = (next: boolean) => {\n setOpen(next)\n if (!next) setSearch('')\n }\n\n const handleSelect = (value: string) => {\n const option = filteredOptions.find((candidate) => resolveValue(candidate) === value)\n if (option) selectCountry(option)\n handleOpenChange(false)\n }\n\n const renderOption = (option: T, isSelected: boolean) => (\n <>\n {renderFlag(option)}\n <span className=\"shrink-0 text-neutral-500\">{resolveDialCode(option)}</span>\n <span className=\"truncate\">{resolveName(option)}</span>\n {isSelected && (\n <CheckIcon data-testid=\"selected-check\" weight=\"bold\" className=\"ml-auto h-4 w-4 shrink-0 text-neutral-950\" />\n )}\n </>\n )\n\n return (\n <div className={cn('flex w-full flex-col gap-1', className)}>\n <div\n data-testid=\"phone-input-shell\"\n className={cn(\n 'flex h-12 w-full items-stretch overflow-hidden rounded-lg border border-neutral-200 bg-white transition-colors has-[input:focus]:border-neutral-950',\n disabled && 'bg-neutral-50',\n error && 'border-error-400 has-[input:focus]:border-error-700',\n )}\n >\n <PopoverRoot open={open} onOpenChange={handleOpenChange}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n id={id ? `${id}-country` : undefined}\n disabled={prefixDisabled}\n aria-label={selectedOption ? resolveName(selectedOption) : countryAriaLabel}\n className={cn(\n 'flex shrink-0 items-center gap-1.5 border-r border-neutral-200 px-3 text-base text-neutral-950 transition-colors outline-none',\n options.length > 1 && 'w-28',\n !prefixDisabled && 'hover:bg-neutral-50',\n prefixDisabled && 'cursor-not-allowed',\n disabled && 'opacity-50',\n )}\n >\n {selectedOption ? (\n <>\n {renderFlag(selectedOption)}\n <span className=\"tabular-nums\">{resolveDialCode(selectedOption)}</span>\n </>\n ) : (\n <GlobeIcon className=\"h-5 w-5 text-neutral-300\" aria-hidden />\n )}\n {!prefixDisabled && <CaretDownIcon className=\"ml-auto h-4 w-4 shrink-0 opacity-50\" />}\n </button>\n </PopoverTrigger>\n <PopoverContent align=\"start\" className={cn(SURFACE_LIST, 'w-72 overflow-hidden p-0')}>\n <Command shouldFilter={false} defaultValue={selectedValue}>\n <CommandInput placeholder={searchPlaceholder} value={search} onValueChange={setSearch} />\n <VirtualizedComboboxList\n listRef={listRef}\n localOptions={restOptions}\n specialOptions={priorityOptions}\n loading={false}\n loadingPlaceholder=\"\"\n emptyMessage={emptyMessage}\n value={selectedValue}\n getOptionValue={resolveValue}\n getOptionLabel={resolveName}\n handleSelect={handleSelect}\n renderOption={renderOption}\n maxHeight={300}\n />\n </Command>\n </PopoverContent>\n </PopoverRoot>\n\n <input\n /* eslint-disable react-hooks/immutability -- merging the internal ref with the caller-supplied `inputRef` is the standard ref-forwarding idiom */\n ref={(el) => {\n inputElRef.current = el\n if (typeof externalInputRef === 'function') externalInputRef(el)\n else if (externalInputRef) externalInputRef.current = el\n }}\n /* eslint-enable react-hooks/immutability */\n id={id}\n name={name}\n type=\"tel\"\n inputMode=\"tel\"\n autoComplete=\"tel-national\"\n disabled={disabled}\n value={displayValue}\n onChange={onInputChange}\n onKeyDown={onInputKeyDown}\n placeholder={placeholder ?? exampleNational(selectedIso)}\n aria-invalid={ariaInvalid ?? (error || undefined)}\n aria-describedby={ariaDescribedBy}\n className=\"min-w-0 flex-1 bg-transparent px-3 text-base text-neutral-950 outline-none placeholder:text-neutral-300 disabled:cursor-not-allowed disabled:opacity-50\"\n {...numberInputProps}\n />\n\n {error && (\n <div className=\"flex items-center pr-3\">\n <WarningCircleIcon data-testid=\"exclaim-icon\" className=\"text-error-500\" size={18} />\n </div>\n )}\n </div>\n </div>\n )\n}\n\nPhoneInput.displayName = 'PhoneInput'\n"],"mappings":";;;;;;;;;;;;;;;;;AAqEA,IAAM,mBAA6D;CACjE,kBAAkB,YAAY,QAAQ;CACtC,oBAAoB,YAAY,QAAQ;CACxC,qBAAqB,YAAY,QAAQ;CACzC,iBAAiB,YAAY,QAAQ;CACrC,iBAAiB,YAAY,QAAQ;AACvC;AAIA,SAAgB,WAA6B,OAAuD;CAClG,MAAM,EACJ,IACA,MACA,WACA,WAAW,OACX,QAAQ,OACR,UAAU,kBACV,WACA,SACA,UACA,QACA,gBACA,mBACA,SAAS,MACT,kBACA,aACA,mBAAmB,kBACnB,oBAAoB,aACpB,eAAe,qBACf,iBACA,mBACA,oBACA,gBACA,gBACA,oBAAoB,iBACpB,gBAAgB,gBACd;CAEJ,MAAM,WAAW;CACjB,MAAM,UAAU,aAAc,eAAe,MAAM;CACnD,MAAM,eAAe,mBAAmB,SAAS;CACjD,MAAM,iBAAiB,qBAAqB,SAAS;CACrD,MAAM,kBAAkB,sBAAsB,SAAS;CACvD,MAAM,cAAc,kBAAkB,SAAS;CAC/C,MAAM,cAAc,kBAAkB,SAAS;CAE/C,MAAM,EACJ,OACA,eACA,gBACA,aACA,cACA,YACA,eACA,eACA,mBACE,cAAc;EAChB;EACA,iBAAiB;EACjB,oBAAoB;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AAqB,YAAY,iBAAiB,EAAE;WAC1D,IAAI,kBAAkB,iBAAiB,UAAU;KACxD;KAEI;KACE;KACN,MAAK;KACL,WAAU;KACV,cAAa;KACH;KACV,OAAO;KACP,UAAU;KACV,WAAW;KACX,aAAa,eAAe,gBAAgB,WAAW;KACvD,gBAAc,gBAAgB,SAAS,KAAA;KACvC,oBAAkB;KAClB,WAAU;KACV,GAAI;IACL,CAAA;IAEA,SACC,oBAAC,OAAD;KAAK,WAAU;KACb,UAAA,oBAAC,mBAAD;MAAmB,eAAY;MAAe,WAAU;MAAiB,MAAM;KAAK,CAAA;IACjF,CAAA;GAEJ;;CACF,CAAA;AAET;AAEA,WAAW,cAAc"}
@@ -45,7 +45,7 @@ var RadioGroupItem = React$1.forwardRef(({ className, label, helperText, error,
45
45
  className: cn("group aspect-square h-4 w-4 shrink-0 rounded-full border transition-colors", "focus-visible:ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2", "disabled:cursor-not-allowed", controlColorClasses, className),
46
46
  ...props,
47
47
  children: /* @__PURE__ */ jsx(RadioGroupPrimitive.Indicator, {
48
- className: "flex items-center justify-center",
48
+ className: "animate-in fade-in-0 ease-out-strong motion-reduce:zoom-in-100 zoom-in-50 flex items-center justify-center duration-150",
49
49
  children: /* @__PURE__ */ jsx("span", { className: cn("block h-2 w-2 rounded-full", dotColorClasses) })
50
50
  })
51
51
  });
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.js","names":["React"],"sources":["../../../../src/components/inputs/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import * as RadioGroupPrimitive from '@radix-ui/react-radio-group'\nimport * as React from 'react'\nimport type { ReactNode } from 'react'\n\nimport { cn } from '@/lib/utils'\n\nconst RadioGroup = React.forwardRef<\n React.ComponentRef<typeof RadioGroupPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>\n>(({ className, ...props }, ref) => {\n return <RadioGroupPrimitive.Root className={cn('grid gap-2', className)} {...props} ref={ref} />\n})\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName\n\nconst RADIO_COLOR_CLASSES = {\n default: {\n control: 'border-neutral-500 hover:border-neutral-800 focus-visible:ring-primary',\n dot: 'bg-neutral-500 group-hover:bg-neutral-800',\n },\n error: {\n control: 'border-error-400 hover:border-error-500 focus-visible:ring-error-400',\n dot: 'bg-error-400 group-hover:bg-error-500',\n },\n disabled: {\n control: 'border-neutral-200 bg-neutral-50',\n dot: 'bg-neutral-200',\n },\n} as const\n\nexport type RadioGroupItemProps = React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item> & {\n /** Label displayed next to the radio control. */\n label?: ReactNode\n\n /** Informational text displayed below the label. Not shown while `error` is set. */\n helperText?: ReactNode\n\n /**\n * Marks the item as invalid and applies error styling. Pass a string to\n * also display it as the message below the label, replacing `helperText`.\n */\n error?: boolean | string\n}\n\nconst RadioGroupItem = React.forwardRef<React.ComponentRef<typeof RadioGroupPrimitive.Item>, RadioGroupItemProps>(\n ({ className, label, helperText, error, id, disabled, ...props }, ref) => {\n const generatedId = React.useId()\n const isError = Boolean(error)\n\n let secondaryText: ReactNode\n if (isError) {\n secondaryText = typeof error === 'string' ? error : undefined\n } else {\n secondaryText = helperText\n }\n\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- an explicit empty string must still count as \"no content\"\n const hasContent = Boolean(label || secondaryText)\n const itemId = id ?? (hasContent ? generatedId : undefined)\n const disabledTextClass = disabled ? 'opacity-50' : undefined\n\n let colorState: keyof typeof RADIO_COLOR_CLASSES = 'default'\n if (disabled) {\n colorState = 'disabled'\n } else if (isError) {\n colorState = 'error'\n }\n const { control: controlColorClasses, dot: dotColorClasses } = RADIO_COLOR_CLASSES[colorState]\n\n const item = (\n <RadioGroupPrimitive.Item\n ref={ref}\n id={itemId}\n disabled={disabled}\n className={cn(\n 'group aspect-square h-4 w-4 shrink-0 rounded-full border transition-colors',\n 'focus-visible:ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2',\n 'disabled:cursor-not-allowed',\n controlColorClasses,\n className,\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator className=\"flex items-center justify-center\">\n <span className={cn('block h-2 w-2 rounded-full', dotColorClasses)} />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n )\n\n if (!hasContent) {\n return item\n }\n\n return (\n <div className=\"flex items-start gap-2\">\n <span className=\"mt-0.5 inline-flex\">{item}</span>\n <div className=\"flex flex-col gap-0.5\">\n {label ? (\n <label htmlFor={itemId} className={cn('text-sm text-neutral-950', disabledTextClass)}>\n {label}\n </label>\n ) : null}\n {secondaryText ? (\n <span className={cn('text-xs', isError ? 'text-error-500' : 'text-neutral-500', disabledTextClass)}>\n {secondaryText}\n </span>\n ) : null}\n </div>\n </div>\n )\n },\n)\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName\n\nexport { RadioGroup, RadioGroupItem }\n"],"mappings":";;;;;AAMA,IAAM,aAAaA,QAAM,YAGtB,EAAE,WAAW,GAAG,SAAS,QAAQ;CAClC,OAAO,oBAAC,oBAAoB,MAArB;EAA0B,WAAW,GAAG,cAAc,SAAS;EAAG,GAAI;EAAY;CAAM,CAAA;AACjG,CAAC;AACD,WAAW,cAAc,oBAAoB,KAAK;AAElD,IAAM,sBAAsB;CAC1B,SAAS;EACP,SAAS;EACT,KAAK;CACP;CACA,OAAO;EACL,SAAS;EACT,KAAK;CACP;CACA,UAAU;EACR,SAAS;EACT,KAAK;CACP;AACF;AAgBA,IAAM,iBAAiBA,QAAM,YAC1B,EAAE,WAAW,OAAO,YAAY,OAAO,IAAI,UAAU,GAAG,SAAS,QAAQ;CACxE,MAAM,cAAcA,QAAM,MAAM;CAChC,MAAM,UAAU,QAAQ,KAAK;CAE7B,IAAI;CACJ,IAAI,SACF,gBAAgB,OAAO,UAAU,WAAW,QAAQ,KAAA;MAEpD,gBAAgB;CAIlB,MAAM,aAAa,QAAQ,SAAS,aAAa;CACjD,MAAM,SAAS,OAAO,aAAa,cAAc,KAAA;CACjD,MAAM,oBAAoB,WAAW,eAAe,KAAA;CAEpD,IAAI,aAA+C;CACnD,IAAI,UACF,aAAa;MACR,IAAI,SACT,aAAa;CAEf,MAAM,EAAE,SAAS,qBAAqB,KAAK,oBAAoB,oBAAoB;CAEnF,MAAM,OACJ,oBAAC,oBAAoB,MAArB;EACO;EACL,IAAI;EACM;EACV,WAAW,GACT,8EACA,4GACA,+BACA,qBACA,SACF;EACA,GAAI;EAEJ,UAAA,oBAAC,oBAAoB,WAArB;GAA+B,WAAU;GACvC,UAAA,oBAAC,QAAD,EAAM,WAAW,GAAG,8BAA8B,eAAe,EAAI,CAAA;EACxC,CAAA;CACP,CAAA;CAG5B,IAAI,CAAC,YACH,OAAO;CAGT,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,QAAD;GAAM,WAAU;GAAsB,UAAA;EAAW,CAAA,GACjD,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACG,QACC,oBAAC,SAAD;IAAO,SAAS;IAAQ,WAAW,GAAG,4BAA4B,iBAAiB;IAChF,UAAA;GACI,CAAA,IACL,MACH,gBACC,oBAAC,QAAD;IAAM,WAAW,GAAG,WAAW,UAAU,mBAAmB,oBAAoB,iBAAiB;IAC9F,UAAA;GACG,CAAA,IACJ,IACD;EACF,CAAA,CAAA;;AAET,CACF;AACA,eAAe,cAAc,oBAAoB,KAAK"}
1
+ {"version":3,"file":"RadioGroup.js","names":["React"],"sources":["../../../../src/components/inputs/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import * as RadioGroupPrimitive from '@radix-ui/react-radio-group'\nimport * as React from 'react'\nimport type { ReactNode } from 'react'\n\nimport { cn } from '@/lib/utils'\n\nconst RadioGroup = React.forwardRef<\n React.ComponentRef<typeof RadioGroupPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>\n>(({ className, ...props }, ref) => {\n return <RadioGroupPrimitive.Root className={cn('grid gap-2', className)} {...props} ref={ref} />\n})\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName\n\nconst RADIO_COLOR_CLASSES = {\n default: {\n control: 'border-neutral-500 hover:border-neutral-800 focus-visible:ring-primary',\n dot: 'bg-neutral-500 group-hover:bg-neutral-800',\n },\n error: {\n control: 'border-error-400 hover:border-error-500 focus-visible:ring-error-400',\n dot: 'bg-error-400 group-hover:bg-error-500',\n },\n disabled: {\n control: 'border-neutral-200 bg-neutral-50',\n dot: 'bg-neutral-200',\n },\n} as const\n\nexport type RadioGroupItemProps = React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item> & {\n /** Label displayed next to the radio control. */\n label?: ReactNode\n\n /** Informational text displayed below the label. Not shown while `error` is set. */\n helperText?: ReactNode\n\n /**\n * Marks the item as invalid and applies error styling. Pass a string to\n * also display it as the message below the label, replacing `helperText`.\n */\n error?: boolean | string\n}\n\nconst RadioGroupItem = React.forwardRef<React.ComponentRef<typeof RadioGroupPrimitive.Item>, RadioGroupItemProps>(\n ({ className, label, helperText, error, id, disabled, ...props }, ref) => {\n const generatedId = React.useId()\n const isError = Boolean(error)\n\n let secondaryText: ReactNode\n if (isError) {\n secondaryText = typeof error === 'string' ? error : undefined\n } else {\n secondaryText = helperText\n }\n\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- an explicit empty string must still count as \"no content\"\n const hasContent = Boolean(label || secondaryText)\n const itemId = id ?? (hasContent ? generatedId : undefined)\n const disabledTextClass = disabled ? 'opacity-50' : undefined\n\n let colorState: keyof typeof RADIO_COLOR_CLASSES = 'default'\n if (disabled) {\n colorState = 'disabled'\n } else if (isError) {\n colorState = 'error'\n }\n const { control: controlColorClasses, dot: dotColorClasses } = RADIO_COLOR_CLASSES[colorState]\n\n const item = (\n <RadioGroupPrimitive.Item\n ref={ref}\n id={itemId}\n disabled={disabled}\n className={cn(\n 'group aspect-square h-4 w-4 shrink-0 rounded-full border transition-colors',\n 'focus-visible:ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2',\n 'disabled:cursor-not-allowed',\n controlColorClasses,\n className,\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator className=\"animate-in fade-in-0 ease-out-strong motion-reduce:zoom-in-100 zoom-in-50 flex items-center justify-center duration-150\">\n <span className={cn('block h-2 w-2 rounded-full', dotColorClasses)} />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n )\n\n if (!hasContent) {\n return item\n }\n\n return (\n <div className=\"flex items-start gap-2\">\n <span className=\"mt-0.5 inline-flex\">{item}</span>\n <div className=\"flex flex-col gap-0.5\">\n {label ? (\n <label htmlFor={itemId} className={cn('text-sm text-neutral-950', disabledTextClass)}>\n {label}\n </label>\n ) : null}\n {secondaryText ? (\n <span className={cn('text-xs', isError ? 'text-error-500' : 'text-neutral-500', disabledTextClass)}>\n {secondaryText}\n </span>\n ) : null}\n </div>\n </div>\n )\n },\n)\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName\n\nexport { RadioGroup, RadioGroupItem }\n"],"mappings":";;;;;AAMA,IAAM,aAAaA,QAAM,YAGtB,EAAE,WAAW,GAAG,SAAS,QAAQ;CAClC,OAAO,oBAAC,oBAAoB,MAArB;EAA0B,WAAW,GAAG,cAAc,SAAS;EAAG,GAAI;EAAY;CAAM,CAAA;AACjG,CAAC;AACD,WAAW,cAAc,oBAAoB,KAAK;AAElD,IAAM,sBAAsB;CAC1B,SAAS;EACP,SAAS;EACT,KAAK;CACP;CACA,OAAO;EACL,SAAS;EACT,KAAK;CACP;CACA,UAAU;EACR,SAAS;EACT,KAAK;CACP;AACF;AAgBA,IAAM,iBAAiBA,QAAM,YAC1B,EAAE,WAAW,OAAO,YAAY,OAAO,IAAI,UAAU,GAAG,SAAS,QAAQ;CACxE,MAAM,cAAcA,QAAM,MAAM;CAChC,MAAM,UAAU,QAAQ,KAAK;CAE7B,IAAI;CACJ,IAAI,SACF,gBAAgB,OAAO,UAAU,WAAW,QAAQ,KAAA;MAEpD,gBAAgB;CAIlB,MAAM,aAAa,QAAQ,SAAS,aAAa;CACjD,MAAM,SAAS,OAAO,aAAa,cAAc,KAAA;CACjD,MAAM,oBAAoB,WAAW,eAAe,KAAA;CAEpD,IAAI,aAA+C;CACnD,IAAI,UACF,aAAa;MACR,IAAI,SACT,aAAa;CAEf,MAAM,EAAE,SAAS,qBAAqB,KAAK,oBAAoB,oBAAoB;CAEnF,MAAM,OACJ,oBAAC,oBAAoB,MAArB;EACO;EACL,IAAI;EACM;EACV,WAAW,GACT,8EACA,4GACA,+BACA,qBACA,SACF;EACA,GAAI;EAEJ,UAAA,oBAAC,oBAAoB,WAArB;GAA+B,WAAU;GACvC,UAAA,oBAAC,QAAD,EAAM,WAAW,GAAG,8BAA8B,eAAe,EAAI,CAAA;EACxC,CAAA;CACP,CAAA;CAG5B,IAAI,CAAC,YACH,OAAO;CAGT,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,QAAD;GAAM,WAAU;GAAsB,UAAA;EAAW,CAAA,GACjD,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACG,QACC,oBAAC,SAAD;IAAO,SAAS;IAAQ,WAAW,GAAG,4BAA4B,iBAAiB;IAChF,UAAA;GACI,CAAA,IACL,MACH,gBACC,oBAAC,QAAD;IAAM,WAAW,GAAG,WAAW,UAAU,mBAAmB,oBAAoB,iBAAiB;IAC9F,UAAA;GACG,CAAA,IACJ,IACD;EACF,CAAA,CAAA;;AAET,CACF;AACA,eAAe,cAAc,oBAAoB,KAAK"}
@@ -1,5 +1,6 @@
1
1
  import { cn } from "../../../lib/utils.js";
2
2
  import { buttonVariants } from "../Button/Button.js";
3
+ import { SURFACE_ITEM, SURFACE_LIST } from "../../../lib/surface.js";
3
4
  import * as React$1 from "react";
4
5
  import { jsx, jsxs } from "react/jsx-runtime";
5
6
  import { CheckIcon } from "@phosphor-icons/react/dist/ssr/Check";
@@ -39,13 +40,13 @@ var SelectContent = React$1.forwardRef(({ className, children, position = "poppe
39
40
  children: /* @__PURE__ */ jsxs(SelectPrimitive.Content, {
40
41
  ref,
41
42
  sideOffset: 4,
42
- className: cn("text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height,300px) min-w-32 overflow-hidden rounded-md border bg-[#fff] shadow-md", className),
43
+ className: cn(SURFACE_LIST, "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ease-out-strong motion-reduce:data-[state=closed]:zoom-out-100 motion-reduce:data-[state=open]:zoom-in-100 motion-reduce:data-[side=bottom]:slide-in-from-top-0 motion-reduce:data-[side=left]:slide-in-from-right-0 motion-reduce:data-[side=right]:slide-in-from-left-0 motion-reduce:data-[side=top]:slide-in-from-bottom-0", "text-popover-foreground relative z-50 max-h-(--radix-select-content-available-height,300px) min-w-32 origin-(--radix-select-content-transform-origin) overflow-hidden border bg-[#fff] shadow-md", className),
43
44
  position,
44
45
  ...props,
45
46
  children: [
46
47
  /* @__PURE__ */ jsx(SelectScrollUpButton, {}),
47
48
  /* @__PURE__ */ jsx(SelectPrimitive.Viewport, {
48
- className: cn("p-1", position === "popper" && "w-(--radix-select-trigger-width) md:w-auto md:min-w-(--radix-select-trigger-width)"),
49
+ className: cn("p-(--surface-inset)", position === "popper" && "w-(--radix-select-trigger-width) md:w-auto md:min-w-(--radix-select-trigger-width)"),
49
50
  children
50
51
  }),
51
52
  /* @__PURE__ */ jsx(SelectScrollDownButton, {})
@@ -61,10 +62,10 @@ var SelectLabel = React$1.forwardRef(({ className, ...props }, ref) => /* @__PUR
61
62
  SelectLabel.displayName = SelectPrimitive.Label.displayName;
62
63
  var SelectItem = React$1.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(SelectPrimitive.Item, {
63
64
  ref,
64
- className: cn("focus:text-accent-foreground relative flex w-full items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none focus:bg-neutral-100 data-disabled:pointer-events-none data-disabled:opacity-50", className),
65
+ className: cn(SURFACE_ITEM, "focus:text-accent-foreground relative flex min-h-10 w-full items-center py-2 pr-3 pl-10 text-sm outline-none select-none focus:bg-neutral-100 data-disabled:pointer-events-none data-disabled:opacity-50", className),
65
66
  ...props,
66
67
  children: [/* @__PURE__ */ jsx("span", {
67
- className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
68
+ className: "absolute left-3 flex h-3.5 w-3.5 items-center justify-center",
68
69
  children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "h-4 w-4" }) })
69
70
  }), /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })]
70
71
  }));
@@ -122,7 +123,7 @@ function Select({ onValueChange, defaultValue, value, options, placeholder, clas
122
123
  value: option.value,
123
124
  "data-testid": option.value,
124
125
  textValue: typeof option.label === "string" ? option.label : void 0,
125
- className: "focus:text-accent-foreground relative flex w-full items-start rounded-sm px-2 py-1.5 text-sm outline-none select-none focus:bg-neutral-100 data-disabled:pointer-events-none data-disabled:opacity-50",
126
+ className: cn(SURFACE_ITEM, "focus:text-accent-foreground relative flex min-h-10 w-full items-start px-3 py-2 text-sm outline-none select-none focus:bg-neutral-100 data-disabled:pointer-events-none data-disabled:opacity-50"),
126
127
  children: [/* @__PURE__ */ jsx("span", {
127
128
  className: "hidden",
128
129
  children: /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children: option.label })