@betterinternship/components 3.3.9 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +45 -45
  2. package/dist/components/accordion.js.map +1 -1
  3. package/dist/components/animated-count.js.map +1 -1
  4. package/dist/components/animated-shiny-text.js.map +1 -1
  5. package/dist/components/app-header.js.map +1 -1
  6. package/dist/components/autocomplete.js.map +1 -1
  7. package/dist/components/avatar.js.map +1 -1
  8. package/dist/components/badge.js.map +1 -1
  9. package/dist/components/banner.js.map +1 -1
  10. package/dist/components/button.js +1 -1
  11. package/dist/components/button.js.map +1 -1
  12. package/dist/components/calendar.js.map +1 -1
  13. package/dist/components/card.js.map +1 -1
  14. package/dist/components/carousel.js.map +1 -1
  15. package/dist/components/checkbox.js.map +1 -1
  16. package/dist/components/chip-select.js.map +1 -1
  17. package/dist/components/collapsible.js.map +1 -1
  18. package/dist/components/context-menu.js.map +1 -1
  19. package/dist/components/dialog.js.map +1 -1
  20. package/dist/components/divider.js.map +1 -1
  21. package/dist/components/dot-matrix.js.map +1 -1
  22. package/dist/components/dropdown-menu.js.map +1 -1
  23. package/dist/components/dropdown.js.map +1 -1
  24. package/dist/components/error.js.map +1 -1
  25. package/dist/components/fab.js.map +1 -1
  26. package/dist/components/file-upload.js.map +1 -1
  27. package/dist/components/filter-chip.js.map +1 -1
  28. package/dist/components/form-checkbox-group.js.map +1 -1
  29. package/dist/components/form-checkbox.js.map +1 -1
  30. package/dist/components/form-date-picker.js.map +1 -1
  31. package/dist/components/form-field.js.map +1 -1
  32. package/dist/components/form-input.js.map +1 -1
  33. package/dist/components/form-month-picker.js.map +1 -1
  34. package/dist/components/form-radio.js.map +1 -1
  35. package/dist/components/form-textarea.js.map +1 -1
  36. package/dist/components/form.js.map +1 -1
  37. package/dist/components/hover-card.js.map +1 -1
  38. package/dist/components/input-otp.js.map +1 -1
  39. package/dist/components/input.js.map +1 -1
  40. package/dist/components/label.js.map +1 -1
  41. package/dist/components/loader.js.map +1 -1
  42. package/dist/components/magnetic-button.js.map +1 -1
  43. package/dist/components/messages.js.map +1 -1
  44. package/dist/components/mobile-sheet-portal.js.map +1 -1
  45. package/dist/components/option-list.js.map +1 -1
  46. package/dist/components/page-header.js.map +1 -1
  47. package/dist/components/paginator.js.map +1 -1
  48. package/dist/components/popover.js.map +1 -1
  49. package/dist/components/progress.js.map +1 -1
  50. package/dist/components/radio-group.js.map +1 -1
  51. package/dist/components/select.js.map +1 -1
  52. package/dist/components/sheet.js.map +1 -1
  53. package/dist/components/skeleton.js.map +1 -1
  54. package/dist/components/slider.js.map +1 -1
  55. package/dist/components/sonner-toast.js +133 -133
  56. package/dist/components/sonner-toast.js.map +1 -1
  57. package/dist/components/stepper.js.map +1 -1
  58. package/dist/components/switch.js.map +1 -1
  59. package/dist/components/table.js.map +1 -1
  60. package/dist/components/tabs.js.map +1 -1
  61. package/dist/components/textarea.js.map +1 -1
  62. package/dist/components/time-input-native.js.map +1 -1
  63. package/dist/components/timeline.js.map +1 -1
  64. package/dist/components/toggle.js.map +1 -1
  65. package/dist/components/tooltip.js.map +1 -1
  66. package/dist/design-tokens.d.ts +6 -2
  67. package/dist/hooks/use-detect-click-outside.js.map +1 -1
  68. package/dist/hooks/use-field-focus.js.map +1 -1
  69. package/dist/hooks/use-mobile-sheet-viewport.js.map +1 -1
  70. package/dist/hooks/use-mobile.js.map +1 -1
  71. package/dist/hooks/use-resource-table.js.map +1 -1
  72. package/dist/hooks/useMQJob.js.map +1 -1
  73. package/dist/lib/interaction-styles.js.map +1 -1
  74. package/dist/utils.js.map +1 -1
  75. package/package.json +330 -330
  76. package/theme.css +414 -421
  77. package/theme.legacy.css +84 -84
@@ -1 +1 @@
1
- {"version":3,"file":"file-upload.js","sources":["../../src/components/file-upload.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { Upload } from \"lucide-react\";\r\nimport { cn } from \"@/utils\";\r\nimport { FieldLabel } from \"./label\";\r\n\r\nexport type FileUploadVariant = \"compact\" | \"dropzone\";\r\nexport type FileRejectReason = \"type\" | \"size\";\r\nexport type FileUploadProps = {\r\n label: string;\r\n name: string;\r\n variant?: FileUploadVariant;\r\n /** Same format as the input's `accept`: extensions (\".pdf\") and/or MIME types (\"image/*\"). Also checked on drop. */\r\n accept?: string;\r\n /** Files larger than this are rejected through `onReject` instead of being selected. */\r\n maxSizeMB?: number;\r\n multiple?: boolean;\r\n required?: boolean;\r\n placeholder?: string;\r\n disabled?: boolean;\r\n className?: string;\r\n /**\r\n * The selected file, when the parent owns it. Pass `null` to clear the field.\r\n * Leave undefined to let the field remember the last pick itself.\r\n */\r\n value?: File | null;\r\n /** Shown under the field and marks it invalid. */\r\n error?: string | null;\r\n onFileSelect?: (file: File | null) => void;\r\n onFilesSelect?: (files: File[]) => void;\r\n /** Called with each file that fails `accept` or `maxSizeMB`. */\r\n onReject?: (file: File, reason: FileRejectReason) => void;\r\n};\r\n\r\n/** True when the file matches one of the `accept` entries (or there are none). */\r\nfunction matchesAccept(file: File, accept?: string) {\r\n if (!accept) return true;\r\n const name = file.name.toLowerCase();\r\n const type = file.type.toLowerCase();\r\n return accept\r\n .split(\",\")\r\n .map((entry) => entry.trim().toLowerCase())\r\n .filter(Boolean)\r\n .some((entry) =>\r\n entry.startsWith(\".\")\r\n ? name.endsWith(entry)\r\n : entry.endsWith(\"/*\")\r\n ? type.startsWith(entry.slice(0, -1))\r\n : type === entry,\r\n );\r\n}\r\n\r\nexport const FileUpload = React.forwardRef<HTMLInputElement, FileUploadProps>(\r\n (\r\n {\r\n label,\r\n name,\r\n variant = \"compact\",\r\n accept,\r\n maxSizeMB,\r\n multiple,\r\n required,\r\n placeholder,\r\n disabled,\r\n className,\r\n value,\r\n error,\r\n onFileSelect,\r\n onFilesSelect,\r\n onReject,\r\n },\r\n ref,\r\n ) => {\r\n const inputRef = React.useRef<HTMLInputElement>(null);\r\n const [pickedName, setPickedName] = React.useState<string | null>(null);\r\n const [dragging, setDragging] = React.useState(false);\r\n const errorId = `${name}-error`;\r\n const controlled = value !== undefined;\r\n const fileName = controlled ? (value?.name ?? null) : pickedName;\r\n\r\n const selectFiles = (files: File[]) => {\r\n const accepted = files.filter((file) => {\r\n if (!matchesAccept(file, accept)) {\r\n onReject?.(file, \"type\");\r\n return false;\r\n }\r\n if (maxSizeMB !== undefined && file.size > maxSizeMB * 1024 * 1024) {\r\n onReject?.(file, \"size\");\r\n return false;\r\n }\r\n return true;\r\n });\r\n // Every file was rejected: keep the current selection as it was.\r\n if (files.length > 0 && accepted.length === 0) return;\r\n\r\n const file = accepted[0] ?? null;\r\n setPickedName(\r\n accepted.length > 1\r\n ? `${accepted.length} files selected`\r\n : (file?.name ?? null),\r\n );\r\n onFileSelect?.(file);\r\n onFilesSelect?.(accepted);\r\n };\r\n const openPicker = () => {\r\n if (!disabled) inputRef.current?.click();\r\n };\r\n\r\n return (\r\n <div className={cn(\"grid gap-field-label-gap\", className)}>\r\n <FieldLabel htmlFor={name}>\r\n {label}\r\n {required && <span className=\"text-destructive\"> *</span>}\r\n </FieldLabel>\r\n <button\r\n type=\"button\"\r\n disabled={disabled}\r\n onClick={openPicker}\r\n aria-invalid={error ? true : undefined}\r\n aria-describedby={error ? errorId : undefined}\r\n onDragEnter={(event) => {\r\n event.preventDefault();\r\n setDragging(true);\r\n }}\r\n onDragOver={(event) => {\r\n event.preventDefault();\r\n if (!disabled) setDragging(true);\r\n }}\r\n onDragLeave={() => setDragging(false)}\r\n onDrop={(event) => {\r\n event.preventDefault();\r\n setDragging(false);\r\n if (disabled) return;\r\n selectFiles(\r\n Array.from(event.dataTransfer.files).slice(\r\n 0,\r\n multiple ? undefined : 1,\r\n ),\r\n );\r\n }}\r\n className={cn(\r\n // min-w-0: as a grid item the button would otherwise refuse to\r\n // shrink below its text, overflowing narrow containers (phones).\r\n \"flex w-full min-w-0 cursor-pointer items-center gap-2 border border-input text-left text-sm text-muted-foreground transition-colors hover:border-input-hover hover:bg-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring motion-reduce:transition-none disabled:cursor-not-allowed disabled:opacity-60\",\r\n variant === \"dropzone\"\r\n ? \"min-h-36 flex-col justify-center rounded-card border-solid border-border px-6 py-6 text-center\"\r\n : \"min-h-11 rounded-control-lg px-4 py-2\",\r\n dragging && \"border-primary bg-primary-tint\",\r\n error && \"border-destructive\",\r\n )}\r\n >\r\n <Upload className=\"size-5 shrink-0 text-primary\" />\r\n <span\r\n className={cn(\r\n \"min-w-0\",\r\n // The dropzone has room to wrap; the compact field truncates.\r\n variant === \"dropzone\"\r\n ? \"max-w-full text-balance [overflow-wrap:anywhere]\"\r\n : \"truncate\",\r\n fileName && \"text-foreground\",\r\n )}\r\n >\r\n {fileName ?? placeholder ?? \"Drop a file here or click to upload\"}\r\n </span>\r\n </button>\r\n <input\r\n ref={(node) => {\r\n inputRef.current = node;\r\n if (typeof ref === \"function\") ref(node);\r\n else if (ref) ref.current = node;\r\n }}\r\n id={name}\r\n type=\"file\"\r\n name={name}\r\n accept={accept}\r\n multiple={multiple}\r\n required={required}\r\n disabled={disabled}\r\n onChange={(event) => {\r\n selectFiles(Array.from(event.target.files ?? []));\r\n // Let the same file be picked again, e.g. after a rejection.\r\n event.target.value = \"\";\r\n }}\r\n className=\"sr-only\"\r\n />\r\n {error && (\r\n <p id={errorId} role=\"alert\" className=\"m-0 text-xs text-destructive\">\r\n {error}\r\n </p>\r\n )}\r\n </div>\r\n );\r\n },\r\n);\r\nFileUpload.displayName = \"FileUpload\";\r\n"],"names":[],"mappings":";;;;;;;AAmCA;AACA;AACE;AAAa;;;AAGb;;AAEG;;;AAIG;AACA;AACE;AACA;AAEV;;;AAwBI;AACA;AACA;AACA;AACA;AAEA;;;AAGM;AACA;;AAEF;AACE;AACA;;AAEF;AACF;;;;;AAKA;AAEI;;AAGJ;AACA;AACF;;AAEE;AAAe;AACjB;AAEA;;;AAeM;;AAGE;;AACF;;;AAKE;;;;;;;AAaE;;;AAWA;AACE;;AAUJ;;;AAEK;AAAS;AAChB;AASE;;AAEA;;AAWV;AAEF;;"}
1
+ {"version":3,"file":"file-upload.js","sources":["../../src/components/file-upload.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Upload } from \"lucide-react\";\nimport { cn } from \"@/utils\";\nimport { FieldLabel } from \"./label\";\n\nexport type FileUploadVariant = \"compact\" | \"dropzone\";\nexport type FileRejectReason = \"type\" | \"size\";\nexport type FileUploadProps = {\n label: string;\n name: string;\n variant?: FileUploadVariant;\n /** Same format as the input's `accept`: extensions (\".pdf\") and/or MIME types (\"image/*\"). Also checked on drop. */\n accept?: string;\n /** Files larger than this are rejected through `onReject` instead of being selected. */\n maxSizeMB?: number;\n multiple?: boolean;\n required?: boolean;\n placeholder?: string;\n disabled?: boolean;\n className?: string;\n /**\n * The selected file, when the parent owns it. Pass `null` to clear the field.\n * Leave undefined to let the field remember the last pick itself.\n */\n value?: File | null;\n /** Shown under the field and marks it invalid. */\n error?: string | null;\n onFileSelect?: (file: File | null) => void;\n onFilesSelect?: (files: File[]) => void;\n /** Called with each file that fails `accept` or `maxSizeMB`. */\n onReject?: (file: File, reason: FileRejectReason) => void;\n};\n\n/** True when the file matches one of the `accept` entries (or there are none). */\nfunction matchesAccept(file: File, accept?: string) {\n if (!accept) return true;\n const name = file.name.toLowerCase();\n const type = file.type.toLowerCase();\n return accept\n .split(\",\")\n .map((entry) => entry.trim().toLowerCase())\n .filter(Boolean)\n .some((entry) =>\n entry.startsWith(\".\")\n ? name.endsWith(entry)\n : entry.endsWith(\"/*\")\n ? type.startsWith(entry.slice(0, -1))\n : type === entry,\n );\n}\n\nexport const FileUpload = React.forwardRef<HTMLInputElement, FileUploadProps>(\n (\n {\n label,\n name,\n variant = \"compact\",\n accept,\n maxSizeMB,\n multiple,\n required,\n placeholder,\n disabled,\n className,\n value,\n error,\n onFileSelect,\n onFilesSelect,\n onReject,\n },\n ref,\n ) => {\n const inputRef = React.useRef<HTMLInputElement>(null);\n const [pickedName, setPickedName] = React.useState<string | null>(null);\n const [dragging, setDragging] = React.useState(false);\n const errorId = `${name}-error`;\n const controlled = value !== undefined;\n const fileName = controlled ? (value?.name ?? null) : pickedName;\n\n const selectFiles = (files: File[]) => {\n const accepted = files.filter((file) => {\n if (!matchesAccept(file, accept)) {\n onReject?.(file, \"type\");\n return false;\n }\n if (maxSizeMB !== undefined && file.size > maxSizeMB * 1024 * 1024) {\n onReject?.(file, \"size\");\n return false;\n }\n return true;\n });\n // Every file was rejected: keep the current selection as it was.\n if (files.length > 0 && accepted.length === 0) return;\n\n const file = accepted[0] ?? null;\n setPickedName(\n accepted.length > 1\n ? `${accepted.length} files selected`\n : (file?.name ?? null),\n );\n onFileSelect?.(file);\n onFilesSelect?.(accepted);\n };\n const openPicker = () => {\n if (!disabled) inputRef.current?.click();\n };\n\n return (\n <div className={cn(\"grid gap-field-label-gap\", className)}>\n <FieldLabel htmlFor={name}>\n {label}\n {required && <span className=\"text-destructive\"> *</span>}\n </FieldLabel>\n <button\n type=\"button\"\n disabled={disabled}\n onClick={openPicker}\n aria-invalid={error ? true : undefined}\n aria-describedby={error ? errorId : undefined}\n onDragEnter={(event) => {\n event.preventDefault();\n setDragging(true);\n }}\n onDragOver={(event) => {\n event.preventDefault();\n if (!disabled) setDragging(true);\n }}\n onDragLeave={() => setDragging(false)}\n onDrop={(event) => {\n event.preventDefault();\n setDragging(false);\n if (disabled) return;\n selectFiles(\n Array.from(event.dataTransfer.files).slice(\n 0,\n multiple ? undefined : 1,\n ),\n );\n }}\n className={cn(\n // min-w-0: as a grid item the button would otherwise refuse to\n // shrink below its text, overflowing narrow containers (phones).\n \"flex w-full min-w-0 cursor-pointer items-center gap-2 border border-input text-left text-sm text-muted-foreground transition-colors hover:border-input-hover hover:bg-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring motion-reduce:transition-none disabled:cursor-not-allowed disabled:opacity-60\",\n variant === \"dropzone\"\n ? \"min-h-36 flex-col justify-center rounded-card border-solid border-border px-6 py-6 text-center\"\n : \"min-h-11 rounded-control-lg px-4 py-2\",\n dragging && \"border-primary bg-primary-tint\",\n error && \"border-destructive\",\n )}\n >\n <Upload className=\"size-5 shrink-0 text-primary\" />\n <span\n className={cn(\n \"min-w-0\",\n // The dropzone has room to wrap; the compact field truncates.\n variant === \"dropzone\"\n ? \"max-w-full text-balance [overflow-wrap:anywhere]\"\n : \"truncate\",\n fileName && \"text-foreground\",\n )}\n >\n {fileName ?? placeholder ?? \"Drop a file here or click to upload\"}\n </span>\n </button>\n <input\n ref={(node) => {\n inputRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n id={name}\n type=\"file\"\n name={name}\n accept={accept}\n multiple={multiple}\n required={required}\n disabled={disabled}\n onChange={(event) => {\n selectFiles(Array.from(event.target.files ?? []));\n // Let the same file be picked again, e.g. after a rejection.\n event.target.value = \"\";\n }}\n className=\"sr-only\"\n />\n {error && (\n <p id={errorId} role=\"alert\" className=\"m-0 text-xs text-destructive\">\n {error}\n </p>\n )}\n </div>\n );\n },\n);\nFileUpload.displayName = \"FileUpload\";\n"],"names":[],"mappings":";;;;;;;AAmCA;AACA;AACE;AAAa;;;AAGb;;AAEG;;;AAIG;AACA;AACE;AACA;AAEV;;;AAwBI;AACA;AACA;AACA;AACA;AAEA;;;AAGM;AACA;;AAEF;AACE;AACA;;AAEF;AACF;;;;;AAKA;AAEI;;AAGJ;AACA;AACF;;AAEE;AAAe;AACjB;AAEA;;;AAeM;;AAGE;;AACF;;;AAKE;;;;;;;AAaE;;;AAWA;AACE;;AAUJ;;;AAEK;AAAS;AAChB;AASE;;AAEA;;AAWV;AAEF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"filter-chip.js","sources":["../../src/components/filter-chip.tsx"],"sourcesContent":["'use client';\r\n\r\nimport * as React from 'react';\r\n\r\nimport { cn } from '@/utils';\r\nimport { Button, type ButtonProps } from './button';\r\nimport type { ButtonScheme, ButtonSize } from './button';\r\n\r\nexport type FilterChipProps = Omit<\r\n ButtonProps,\r\n 'variant' | 'size' | 'scheme' | 'shape' | 'aria-pressed'\r\n> & {\r\n selected?: boolean;\r\n icon?: React.ReactNode;\r\n value?: string;\r\n size?: ButtonSize;\r\n scheme?: ButtonScheme;\r\n count?: number;\r\n};\r\n\r\nconst FilterChipGroupContext = React.createContext<{\r\n value: string | string[];\r\n multiple: boolean;\r\n onChange: (value: string) => void;\r\n} | null>(null);\r\n\r\n/** A toggleable pill for filtering; announces its state via aria-pressed. */\r\nconst FilterChip = React.forwardRef<HTMLButtonElement, FilterChipProps>(\r\n ({ selected, icon, children, className, value: chipValue, size = 'md', scheme, count, ...props }, ref) => {\r\n const group = React.useContext(FilterChipGroupContext);\r\n const isSelected = selected ?? (group && chipValue ? (group.multiple ? group.value.includes(chipValue) : group.value === chipValue) : false);\r\n return (\r\n <Button\r\n ref={ref}\r\n type=\"button\"\r\n variant=\"outline\"\r\n scheme={isSelected ? (scheme ?? 'secondary') : 'neutral'}\r\n size={size}\r\n shape=\"pill\"\r\n aria-pressed={isSelected}\r\n onClick={(event) => {\r\n props.onClick?.(event);\r\n if (!event.defaultPrevented && group && chipValue) group.onChange(chipValue);\r\n }}\r\n className={cn(\r\n 'group w-max max-w-full gap-2.5 font-[550] aria-pressed:font-semibold max-md:gap-2',\r\n !isSelected && '!border-border enabled:hover:!border-input',\r\n isSelected && scheme === 'neutral' && 'border-input-hover bg-accent text-accent-foreground hover:bg-accent',\r\n isSelected && scheme === 'primary' && 'border-primary bg-primary-selected text-primary hover:bg-primary-selected',\r\n className,\r\n )}\r\n {...props}\r\n >\r\n {icon}\r\n {children}\r\n {count !== undefined && <span className=\"inline-flex translate-y-px items-center text-[0.875em] leading-none tabular-nums opacity-75\">({count})</span>}\r\n </Button>\r\n );\r\n },\r\n);\r\nFilterChip.displayName = 'FilterChip';\r\n\r\nexport { FilterChip };\r\n\r\nexport function FilterChipGroup({ value, onChange, multiple = false, children, className }: {\r\n value: string | string[];\r\n onChange: (value: string | string[]) => void;\r\n multiple?: boolean;\r\n children: React.ReactNode;\r\n className?: string;\r\n}) {\r\n return <div className={cn('flex flex-wrap gap-2', className)}>\r\n <FilterChipGroupContext.Provider value={{ value, multiple, onChange: (next) => {\r\n if (!multiple) return onChange(next);\r\n const values = Array.isArray(value) ? value : [];\r\n onChange(values.includes(next) ? values.filter((item) => item !== next) : [...values, next]);\r\n } }}>{children}</FilterChipGroupContext.Provider>\r\n </div>;\r\n}\r\n"],"names":[],"mappings":";;;;;;AAoBA;AAMA;AACA;;AAGI;;AAWI;AACA;AAAmD;;AAgBzD;AAEF;AAIM;;AASA;AAAe;AACf;AACA;AACF;AAEJ;;"}
1
+ {"version":3,"file":"filter-chip.js","sources":["../../src/components/filter-chip.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '@/utils';\nimport { Button, type ButtonProps } from './button';\nimport type { ButtonScheme, ButtonSize } from './button';\n\nexport type FilterChipProps = Omit<\n ButtonProps,\n 'variant' | 'size' | 'scheme' | 'shape' | 'aria-pressed'\n> & {\n selected?: boolean;\n icon?: React.ReactNode;\n value?: string;\n size?: ButtonSize;\n scheme?: ButtonScheme;\n count?: number;\n};\n\nconst FilterChipGroupContext = React.createContext<{\n value: string | string[];\n multiple: boolean;\n onChange: (value: string) => void;\n} | null>(null);\n\n/** A toggleable pill for filtering; announces its state via aria-pressed. */\nconst FilterChip = React.forwardRef<HTMLButtonElement, FilterChipProps>(\n ({ selected, icon, children, className, value: chipValue, size = 'md', scheme, count, ...props }, ref) => {\n const group = React.useContext(FilterChipGroupContext);\n const isSelected = selected ?? (group && chipValue ? (group.multiple ? group.value.includes(chipValue) : group.value === chipValue) : false);\n return (\n <Button\n ref={ref}\n type=\"button\"\n variant=\"outline\"\n scheme={isSelected ? (scheme ?? 'secondary') : 'neutral'}\n size={size}\n shape=\"pill\"\n aria-pressed={isSelected}\n onClick={(event) => {\n props.onClick?.(event);\n if (!event.defaultPrevented && group && chipValue) group.onChange(chipValue);\n }}\n className={cn(\n 'group w-max max-w-full gap-2.5 font-[550] aria-pressed:font-semibold max-md:gap-2',\n !isSelected && '!border-border enabled:hover:!border-input',\n isSelected && scheme === 'neutral' && 'border-input-hover bg-accent text-accent-foreground hover:bg-accent',\n isSelected && scheme === 'primary' && 'border-primary bg-primary-selected text-primary hover:bg-primary-selected',\n className,\n )}\n {...props}\n >\n {icon}\n {children}\n {count !== undefined && <span className=\"inline-flex translate-y-px items-center text-[0.875em] leading-none tabular-nums opacity-75\">({count})</span>}\n </Button>\n );\n },\n);\nFilterChip.displayName = 'FilterChip';\n\nexport { FilterChip };\n\nexport function FilterChipGroup({ value, onChange, multiple = false, children, className }: {\n value: string | string[];\n onChange: (value: string | string[]) => void;\n multiple?: boolean;\n children: React.ReactNode;\n className?: string;\n}) {\n return <div className={cn('flex flex-wrap gap-2', className)}>\n <FilterChipGroupContext.Provider value={{ value, multiple, onChange: (next) => {\n if (!multiple) return onChange(next);\n const values = Array.isArray(value) ? value : [];\n onChange(values.includes(next) ? values.filter((item) => item !== next) : [...values, next]);\n } }}>{children}</FilterChipGroupContext.Provider>\n </div>;\n}\n"],"names":[],"mappings":";;;;;;AAoBA;AAMA;AACA;;AAGI;;AAWI;AACA;AAAmD;;AAgBzD;AAEF;AAIM;;AASA;AAAe;AACf;AACA;AACF;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"form-checkbox-group.js","sources":["../../src/components/form-checkbox-group.tsx"],"sourcesContent":["'use client';\r\n\r\nimport * as React from 'react';\r\n\r\nimport { cn } from '@/utils';\r\nimport { AnimatedCount } from '@/components/animated-count';\r\nimport { FormCheckbox } from './form-checkbox';\r\nimport { FormField } from './form-field';\r\n\r\nexport interface FormCheckBoxGroupProps extends Omit<\r\n React.InputHTMLAttributes<HTMLInputElement>,\r\n 'onToggle'\r\n> {\r\n options: { value: string | number; label: string; description?: string }[];\r\n values: (string | number)[];\r\n setter: (values: (string | number)[]) => void;\r\n label?: string;\r\n required?: boolean;\r\n className?: string;\r\n tooltip?: string;\r\n tooltipId?: string;\r\n /** Multi-select hint shown above the options. Pass `null` to hide it. */\r\n hint?: React.ReactNode;\r\n /**\r\n * Whether the \"N selected\" count renders in its own row above the\r\n * options. Defaults to true. Set to false when the count is shown\r\n * elsewhere instead (e.g. via `labelAddon`) — otherwise selecting the\r\n * first option inserts this row and shifts the options below it.\r\n */\r\n showSelectedCount?: boolean;\r\n /** Rendered to the right of the label, on the label's own row. */\r\n labelAddon?: React.ReactNode;\r\n /** Columns on md+ screens. Defaults to 3. */\r\n columns?: 1 | 2 | 3;\r\n /** Fired when a single option is toggled, before the setter runs. */\r\n onToggle?: (value: string | number, checked: boolean) => void;\r\n}\r\n\r\nconst GRID_COLS: Record<1 | 2 | 3, string> = {\r\n 1: '',\r\n 2: 'md:grid-cols-2',\r\n 3: 'md:grid-cols-3',\r\n};\r\n\r\nexport const FormCheckBoxGroup = ({\r\n options,\r\n values,\r\n setter,\r\n label,\r\n required = false,\r\n className,\r\n tooltip,\r\n tooltipId,\r\n hint = null,\r\n showSelectedCount = true,\r\n labelAddon,\r\n columns = 3,\r\n onToggle,\r\n}: FormCheckBoxGroupProps) => {\r\n const handleValueChange = (optionValue: string | number) => {\r\n const willBeChecked = !values.includes(optionValue);\r\n onToggle?.(optionValue, willBeChecked);\r\n setter(\r\n willBeChecked\r\n ? [...values, optionValue]\r\n : values.filter((v) => v !== optionValue),\r\n );\r\n };\r\n\r\n return (\r\n <FormField\r\n label={label}\r\n required={required}\r\n tooltip={tooltip}\r\n tooltipId={tooltipId}\r\n labelAddon={labelAddon}\r\n className={className}\r\n >\r\n {(hint || (showSelectedCount && values.length > 0)) && (\r\n <div className=\"flex items-center gap-2 text-xs\">\r\n {hint && (\r\n <span className=\"text-muted-foreground text-xs\">{hint}</span>\r\n )}\r\n {showSelectedCount && values.length > 0 && (\r\n <span className=\"text-primary font-medium\">\r\n <AnimatedCount value={values.length} /> selected\r\n </span>\r\n )}\r\n </div>\r\n )}\r\n\r\n <div className={cn('grid grid-cols-1 gap-4', GRID_COLS[columns])}>\r\n {options.map((option) => {\r\n const isChecked = values.includes(option.value);\r\n\r\n return (\r\n <div\r\n key={option.value}\r\n role=\"checkbox\"\r\n aria-checked={isChecked}\r\n onClick={() => handleValueChange(option.value)}\r\n className={cn(\r\n 'group flex h-fit cursor-pointer items-start gap-3 rounded-control-lg border p-3 transition-colors duration-state ease-out-strong focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-ring motion-reduce:transition-none [&>div]:pointer-events-none',\r\n isChecked\r\n ? 'border-primary bg-primary-selected'\r\n : 'border-border hover:border-input hover:bg-muted',\r\n )}\r\n >\r\n <FormCheckbox\r\n className=\"pointer-events-none pt-0.5\"\r\n checked={isChecked ?? false}\r\n />\r\n <div className=\"min-w-0 flex-1 space-y-1 pt-0.5\">\r\n <span className=\"block text-field-label font-field-label text-[color:var(--color-field-label)]\">\r\n {option.label}\r\n </span>\r\n {option.description && (\r\n <p className=\"text-sm text-muted-foreground\">{option.description}</p>\r\n )}\r\n </div>\r\n </div>\r\n );\r\n })}\r\n </div>\r\n </FormField>\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;;;;AAsCA;AACE;AACA;AACA;;AAGK;AAeL;;AAEE;AACA;AAEI;AACA;AAEN;;;;AAqCgB;;AAkBV;AAIR;;"}
1
+ {"version":3,"file":"form-checkbox-group.js","sources":["../../src/components/form-checkbox-group.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '@/utils';\nimport { AnimatedCount } from '@/components/animated-count';\nimport { FormCheckbox } from './form-checkbox';\nimport { FormField } from './form-field';\n\nexport interface FormCheckBoxGroupProps extends Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'onToggle'\n> {\n options: { value: string | number; label: string; description?: string }[];\n values: (string | number)[];\n setter: (values: (string | number)[]) => void;\n label?: string;\n required?: boolean;\n className?: string;\n tooltip?: string;\n tooltipId?: string;\n /** Multi-select hint shown above the options. Pass `null` to hide it. */\n hint?: React.ReactNode;\n /**\n * Whether the \"N selected\" count renders in its own row above the\n * options. Defaults to true. Set to false when the count is shown\n * elsewhere instead (e.g. via `labelAddon`) — otherwise selecting the\n * first option inserts this row and shifts the options below it.\n */\n showSelectedCount?: boolean;\n /** Rendered to the right of the label, on the label's own row. */\n labelAddon?: React.ReactNode;\n /** Columns on md+ screens. Defaults to 3. */\n columns?: 1 | 2 | 3;\n /** Fired when a single option is toggled, before the setter runs. */\n onToggle?: (value: string | number, checked: boolean) => void;\n}\n\nconst GRID_COLS: Record<1 | 2 | 3, string> = {\n 1: '',\n 2: 'md:grid-cols-2',\n 3: 'md:grid-cols-3',\n};\n\nexport const FormCheckBoxGroup = ({\n options,\n values,\n setter,\n label,\n required = false,\n className,\n tooltip,\n tooltipId,\n hint = null,\n showSelectedCount = true,\n labelAddon,\n columns = 3,\n onToggle,\n}: FormCheckBoxGroupProps) => {\n const handleValueChange = (optionValue: string | number) => {\n const willBeChecked = !values.includes(optionValue);\n onToggle?.(optionValue, willBeChecked);\n setter(\n willBeChecked\n ? [...values, optionValue]\n : values.filter((v) => v !== optionValue),\n );\n };\n\n return (\n <FormField\n label={label}\n required={required}\n tooltip={tooltip}\n tooltipId={tooltipId}\n labelAddon={labelAddon}\n className={className}\n >\n {(hint || (showSelectedCount && values.length > 0)) && (\n <div className=\"flex items-center gap-2 text-xs\">\n {hint && (\n <span className=\"text-muted-foreground text-xs\">{hint}</span>\n )}\n {showSelectedCount && values.length > 0 && (\n <span className=\"text-primary font-medium\">\n <AnimatedCount value={values.length} /> selected\n </span>\n )}\n </div>\n )}\n\n <div className={cn('grid grid-cols-1 gap-4', GRID_COLS[columns])}>\n {options.map((option) => {\n const isChecked = values.includes(option.value);\n\n return (\n <div\n key={option.value}\n role=\"checkbox\"\n aria-checked={isChecked}\n onClick={() => handleValueChange(option.value)}\n className={cn(\n 'group flex h-fit cursor-pointer items-start gap-3 rounded-control-lg border p-3 transition-colors duration-state ease-out-strong focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-ring motion-reduce:transition-none [&>div]:pointer-events-none',\n isChecked\n ? 'border-primary bg-primary-selected'\n : 'border-border hover:border-input hover:bg-muted',\n )}\n >\n <FormCheckbox\n className=\"pointer-events-none pt-0.5\"\n checked={isChecked ?? false}\n />\n <div className=\"min-w-0 flex-1 space-y-1 pt-0.5\">\n <span className=\"block text-field-label font-field-label text-[color:var(--color-field-label)]\">\n {option.label}\n </span>\n {option.description && (\n <p className=\"text-sm text-muted-foreground\">{option.description}</p>\n )}\n </div>\n </div>\n );\n })}\n </div>\n </FormField>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAsCA;AACE;AACA;AACA;;AAGK;AAeL;;AAEE;AACA;AAEI;AACA;AAEN;;;;AAqCgB;;AAkBV;AAIR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"form-checkbox.js","sources":["../../src/components/form-checkbox.tsx"],"sourcesContent":["'use client';\r\n\r\nimport * as React from 'react';\r\n\r\nimport { cn } from '@/utils';\r\nimport { Checkbox } from '@/components/checkbox';\r\nimport { FormField } from './form-field';\r\n\r\nexport interface FormCheckboxProps extends React.InputHTMLAttributes<HTMLInputElement> {\r\n checked?: boolean;\r\n indeterminate?: boolean;\r\n label?: string;\r\n setter?: (value: boolean) => void;\r\n className?: string;\r\n sentence?: React.ReactNode;\r\n required?: boolean;\r\n tooltip?: string;\r\n tooltipId?: string;\r\n labelAddon?: React.ReactNode;\r\n}\r\n\r\n/** A labelled Checkbox; the box itself is styled by the Checkbox primitive. */\r\nexport const FormCheckbox = ({\r\n label,\r\n checked,\r\n indeterminate,\r\n setter,\r\n className,\r\n sentence,\r\n required,\r\n tooltip,\r\n tooltipId,\r\n labelAddon,\r\n id,\r\n disabled,\r\n 'aria-label': ariaLabel,\r\n 'aria-describedby': ariaDescribedBy,\r\n}: FormCheckboxProps) => {\r\n return (\r\n <FormField\r\n label={label}\r\n required={required}\r\n tooltip={tooltip}\r\n tooltipId={tooltipId}\r\n labelAddon={labelAddon}\r\n className={className}\r\n >\r\n <div className=\"flex gap-2 sm:items-center\">\r\n <Checkbox\r\n id={id}\r\n disabled={disabled}\r\n aria-label={ariaLabel}\r\n aria-describedby={ariaDescribedBy}\r\n name={label ?? ''}\r\n checked={indeterminate ? 'indeterminate' : checked}\r\n // Larger tap target on mobile.\r\n className={cn('size-6 sm:size-5')}\r\n onCheckedChange={(next) => setter && setter(!!next)}\r\n />\r\n {sentence && (\r\n <div\r\n className=\"text-muted-foreground cursor-pointer text-sm select-none\"\r\n onClick={() => setter?.(!checked)}\r\n role=\"button\"\r\n >\r\n {sentence}\r\n </div>\r\n )}\r\n </div>\r\n </FormField>\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;;;AAqBA;AACO;AAgBL;;;AAiCF;;"}
1
+ {"version":3,"file":"form-checkbox.js","sources":["../../src/components/form-checkbox.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '@/utils';\nimport { Checkbox } from '@/components/checkbox';\nimport { FormField } from './form-field';\n\nexport interface FormCheckboxProps extends React.InputHTMLAttributes<HTMLInputElement> {\n checked?: boolean;\n indeterminate?: boolean;\n label?: string;\n setter?: (value: boolean) => void;\n className?: string;\n sentence?: React.ReactNode;\n required?: boolean;\n tooltip?: string;\n tooltipId?: string;\n labelAddon?: React.ReactNode;\n}\n\n/** A labelled Checkbox; the box itself is styled by the Checkbox primitive. */\nexport const FormCheckbox = ({\n label,\n checked,\n indeterminate,\n setter,\n className,\n sentence,\n required,\n tooltip,\n tooltipId,\n labelAddon,\n id,\n disabled,\n 'aria-label': ariaLabel,\n 'aria-describedby': ariaDescribedBy,\n}: FormCheckboxProps) => {\n return (\n <FormField\n label={label}\n required={required}\n tooltip={tooltip}\n tooltipId={tooltipId}\n labelAddon={labelAddon}\n className={className}\n >\n <div className=\"flex gap-2 sm:items-center\">\n <Checkbox\n id={id}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedBy}\n name={label ?? ''}\n checked={indeterminate ? 'indeterminate' : checked}\n // Larger tap target on mobile.\n className={cn('size-6 sm:size-5')}\n onCheckedChange={(next) => setter && setter(!!next)}\n />\n {sentence && (\n <div\n className=\"text-muted-foreground cursor-pointer text-sm select-none\"\n onClick={() => setter?.(!checked)}\n role=\"button\"\n >\n {sentence}\n </div>\n )}\n </div>\n </FormField>\n );\n};\n"],"names":[],"mappings":";;;;;;AAqBA;AACO;AAgBL;;;AAiCF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"form-date-picker.js","sources":["../../src/components/form-date-picker.tsx"],"sourcesContent":["'use client';\r\n\r\nimport * as React from 'react';\r\nimport type { Matcher } from '@daypicker/react';\r\nimport { CalendarDays, X } from 'lucide-react';\r\n\r\nimport { cn } from '@/utils';\r\nimport { fieldTriggerClassName } from '@/hooks/use-field-focus';\r\nimport { Button } from '@/components/button';\r\nimport { Calendar } from '@/components/calendar';\r\nimport {\r\n Popover,\r\n PopoverContent,\r\n PopoverTrigger,\r\n} from '@/components/popover';\r\nimport { FormField } from './form-field';\r\n\r\n/**\r\n * Accepts/returns a number timestamp (ms) via `date` / `setter`.\r\n */\r\nexport interface FormDatePickerProps extends React.InputHTMLAttributes<HTMLInputElement> {\r\n mode?: 'single' | 'multiple' | 'range';\r\n dates?: number[];\r\n onDatesChange?: (dates: number[]) => void;\r\n range?: { from?: number; to?: number };\r\n onRangeChange?: (range: { from?: number; to?: number } | undefined) => void;\r\n label?: string;\r\n date?: number;\r\n setter?: (value?: number) => void;\r\n className?: string;\r\n side?: 'top' | 'right' | 'bottom' | 'left';\r\n align?: 'start' | 'center' | 'end';\r\n sideOffset?: number;\r\n contentClassName?: string;\r\n /** 'buttons' is the old name for DayPicker's 'label' layout. */\r\n captionLayout?: 'buttons' | 'label' | 'dropdown';\r\n required?: boolean;\r\n tooltip?: string;\r\n tooltipId?: string;\r\n labelAddon?: React.ReactNode;\r\n\r\n /** Optional: disable dates (react-day-picker style) */\r\n disabledDays?:\r\n | Date\r\n | { before?: Date; after?: Date; from?: Date; to?: Date }\r\n | Date[];\r\n /** Only these local calendar dates can be selected. */\r\n allowedDates?: Date[];\r\n\r\n /** Close popover automatically on select (default true) */\r\n autoClose?: boolean;\r\n\r\n /** Placeholder text when no date selected */\r\n placeholder?: string;\r\n\r\n /** Format the button text */\r\n format?: (d: Date) => string;\r\n}\r\n\r\nexport const FormDatePicker = ({\r\n mode = 'single',\r\n dates,\r\n onDatesChange,\r\n range,\r\n onRangeChange,\r\n label,\r\n date,\r\n setter,\r\n className,\r\n side = 'bottom',\r\n align = 'start',\r\n sideOffset = 6,\r\n contentClassName,\r\n captionLayout = 'dropdown',\r\n disabledDays,\r\n allowedDates,\r\n autoClose = true,\r\n placeholder = 'Select date',\r\n format = (d) => d.toLocaleDateString(),\r\n required = false,\r\n tooltip,\r\n tooltipId,\r\n labelAddon,\r\n ...props\r\n}: FormDatePickerProps) => {\r\n const [open, setOpen] = React.useState(false);\r\n const selected = date != null && date > 86400000 ? new Date(date) : undefined;\r\n const selectedRange = range ? { from: range.from != null ? new Date(range.from) : undefined, to: range.to != null ? new Date(range.to) : undefined } : undefined;\r\n\r\n if (mode === 'multiple') return <FormDateMultiPicker label={label} dates={dates} setter={onDatesChange} className={className} contentClassName={contentClassName} required={required} tooltip={tooltip} labelAddon={labelAddon} allowedDates={allowedDates} disabledDays={disabledDays as Matcher | Matcher[]} />;\r\n\r\n return (\r\n <FormField\r\n label={label}\r\n required={required}\r\n tooltip={tooltip}\r\n tooltipId={tooltipId}\r\n labelAddon={labelAddon}\r\n className={cn('flex flex-col', className)}\r\n >\r\n <Popover open={open} onOpenChange={setOpen}>\r\n <PopoverTrigger asChild>\r\n <Button\r\n variant=\"outline\"\r\n id={props.id ?? 'date'}\r\n className={cn(\"w-full justify-between px-field-padding-x py-0\", fieldTriggerClassName)}\r\n >\r\n {mode === 'range' && selectedRange?.from ? `${format(selectedRange.from)}${selectedRange.to ? ` – ${format(selectedRange.to)}` : ' – …'}` : selected ? format(selected) : <span className=\"text-muted-foreground/40\">{placeholder}</span>}\r\n <CalendarDays className=\"h-4 w-4 text-muted-foreground\" />\r\n </Button>\r\n </PopoverTrigger>\r\n\r\n <PopoverContent\r\n align={align}\r\n side={side}\r\n sideOffset={sideOffset}\r\n className={cn(\r\n 'w-auto overflow-hidden p-0',\r\n contentClassName,\r\n )}\r\n >\r\n {mode === 'range' ? <Calendar\r\n mode=\"range\"\r\n selected={selectedRange}\r\n captionLayout={captionLayout === 'buttons' ? 'label' : captionLayout}\r\n disabled={disabledDays as Matcher[]}\r\n allowedDates={allowedDates}\r\n excludeDisabled\r\n onSelect={(next) => {\r\n onRangeChange?.(next ? { from: next.from?.getTime(), to: next.to?.getTime() } : undefined);\r\n // Range selection stays open so the user can adjust both ends,\r\n // matching multiple-date selection behavior.\r\n }}\r\n /> : <Calendar\r\n mode=\"single\"\r\n selected={selected}\r\n captionLayout={\r\n captionLayout === 'buttons' ? 'label' : captionLayout\r\n }\r\n disabled={disabledDays as Matcher[]}\r\n allowedDates={allowedDates}\r\n onSelect={(d) => {\r\n setter?.(d ? d.getTime() : undefined);\r\n if (autoClose) setOpen(false);\r\n }}\r\n />}\r\n </PopoverContent>\r\n </Popover>\r\n </FormField>\r\n );\r\n};\r\n\r\ninterface FormDateMultiPickerProps {\r\n label?: string;\r\n dates?: number[];\r\n setter?: (value: number[]) => void;\r\n className?: string;\r\n contentClassName?: string;\r\n required?: boolean;\r\n tooltip?: string;\r\n labelAddon?: React.ReactNode;\r\n /** Only these local calendar dates can be selected. */\r\n allowedDates?: Date[];\r\n disabledDays?: Matcher | Matcher[];\r\n}\r\n\r\nconst FormDateMultiPicker = ({\r\n label,\r\n dates = [],\r\n setter,\r\n className,\r\n contentClassName,\r\n required = false,\r\n tooltip,\r\n labelAddon,\r\n allowedDates,\r\n disabledDays,\r\n}: FormDateMultiPickerProps) => {\r\n const [open, setOpen] = React.useState(false);\r\n const selected = dates\r\n .filter((value) => Number.isFinite(value))\r\n .map((value) => {\r\n const parts = new Intl.DateTimeFormat('en-US', {\r\n timeZone: 'Asia/Manila',\r\n year: 'numeric',\r\n month: 'numeric',\r\n day: 'numeric',\r\n }).formatToParts(new Date(value));\r\n const get = (type: string) =>\r\n Number(parts.find((part) => part.type === type)?.value);\r\n return new Date(get('year'), get('month') - 1, get('day'));\r\n });\r\n const toManilaTimestamp = (date: Date) =>\r\n Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()) -\r\n 8 * 60 * 60 * 1000;\r\n\r\n return (\r\n <FormField\r\n label={label}\r\n required={required}\r\n tooltip={tooltip}\r\n labelAddon={labelAddon}\r\n className={cn('flex flex-col', className)}\r\n >\r\n <Popover open={open} onOpenChange={setOpen}>\r\n <PopoverTrigger asChild>\r\n <Button\r\n variant=\"outline\"\r\n className={cn(\"w-full justify-between px-field-padding-x py-0\", fieldTriggerClassName)}\r\n >\r\n {selected.length\r\n ? `${selected.length} date${selected.length === 1 ? '' : 's'} selected`\r\n : 'Select dates'}\r\n <CalendarDays className=\"h-4 w-4 text-muted-foreground\" />\r\n </Button>\r\n </PopoverTrigger>\r\n <PopoverContent\r\n align=\"start\"\r\n sideOffset={6}\r\n className={cn(\r\n 'w-auto overflow-hidden p-0',\r\n contentClassName,\r\n )}\r\n >\r\n <Calendar\r\n mode=\"multiple\"\r\n captionLayout=\"label\"\r\n allowedDates={allowedDates}\r\n disabled={disabledDays}\r\n selected={selected}\r\n onSelect={(next) =>\r\n setter?.(\r\n (next ?? []).map(toManilaTimestamp).sort((a, b) => a - b),\r\n )\r\n }\r\n />\r\n </PopoverContent>\r\n </Popover>\r\n {!!selected.length && (\r\n <div className=\"flex flex-wrap gap-1.5\">\r\n {selected.map((date) => (\r\n <Button\r\n key={date.getTime()}\r\n type=\"button\"\r\n variant=\"outline\"\r\n size=\"sm\"\r\n className=\"h-7 gap-1 px-2 text-xs\"\r\n onClick={() =>\r\n setter?.(\r\n selected\r\n .filter(\r\n (selectedDate) =>\r\n selectedDate.getTime() !== date.getTime(),\r\n )\r\n .map(toManilaTimestamp),\r\n )\r\n }\r\n >\r\n {date.toLocaleDateString(undefined, {\r\n month: 'short',\r\n day: 'numeric',\r\n year: 'numeric',\r\n })}\r\n <X className=\"h-3 w-3\" />\r\n <span className=\"sr-only\">\r\n Remove {date.toLocaleDateString()}\r\n </span>\r\n </Button>\r\n ))}\r\n </div>\r\n )}\r\n </FormField>\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;;;;;;;;AA2DO;AA0BL;;;;AAIyB;;AAwCb;;;AAGF;AAUE;AACA;;AACF;AAMZ;AAgBA;AAYE;;AAEG;AACA;;AAEG;AACA;AACA;AACA;;;;AAKJ;;AAGA;AAEF;AAeY;AACC;AAsCM;;AASL;AACA;AACA;AACD;AAWf;;"}
1
+ {"version":3,"file":"form-date-picker.js","sources":["../../src/components/form-date-picker.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { Matcher } from '@daypicker/react';\nimport { CalendarDays, X } from 'lucide-react';\n\nimport { cn } from '@/utils';\nimport { fieldTriggerClassName } from '@/hooks/use-field-focus';\nimport { Button } from '@/components/button';\nimport { Calendar } from '@/components/calendar';\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from '@/components/popover';\nimport { FormField } from './form-field';\n\n/**\n * Accepts/returns a number timestamp (ms) via `date` / `setter`.\n */\nexport interface FormDatePickerProps extends React.InputHTMLAttributes<HTMLInputElement> {\n mode?: 'single' | 'multiple' | 'range';\n dates?: number[];\n onDatesChange?: (dates: number[]) => void;\n range?: { from?: number; to?: number };\n onRangeChange?: (range: { from?: number; to?: number } | undefined) => void;\n label?: string;\n date?: number;\n setter?: (value?: number) => void;\n className?: string;\n side?: 'top' | 'right' | 'bottom' | 'left';\n align?: 'start' | 'center' | 'end';\n sideOffset?: number;\n contentClassName?: string;\n /** 'buttons' is the old name for DayPicker's 'label' layout. */\n captionLayout?: 'buttons' | 'label' | 'dropdown';\n required?: boolean;\n tooltip?: string;\n tooltipId?: string;\n labelAddon?: React.ReactNode;\n\n /** Optional: disable dates (react-day-picker style) */\n disabledDays?:\n | Date\n | { before?: Date; after?: Date; from?: Date; to?: Date }\n | Date[];\n /** Only these local calendar dates can be selected. */\n allowedDates?: Date[];\n\n /** Close popover automatically on select (default true) */\n autoClose?: boolean;\n\n /** Placeholder text when no date selected */\n placeholder?: string;\n\n /** Format the button text */\n format?: (d: Date) => string;\n}\n\nexport const FormDatePicker = ({\n mode = 'single',\n dates,\n onDatesChange,\n range,\n onRangeChange,\n label,\n date,\n setter,\n className,\n side = 'bottom',\n align = 'start',\n sideOffset = 6,\n contentClassName,\n captionLayout = 'dropdown',\n disabledDays,\n allowedDates,\n autoClose = true,\n placeholder = 'Select date',\n format = (d) => d.toLocaleDateString(),\n required = false,\n tooltip,\n tooltipId,\n labelAddon,\n ...props\n}: FormDatePickerProps) => {\n const [open, setOpen] = React.useState(false);\n const selected = date != null && date > 86400000 ? new Date(date) : undefined;\n const selectedRange = range ? { from: range.from != null ? new Date(range.from) : undefined, to: range.to != null ? new Date(range.to) : undefined } : undefined;\n\n if (mode === 'multiple') return <FormDateMultiPicker label={label} dates={dates} setter={onDatesChange} className={className} contentClassName={contentClassName} required={required} tooltip={tooltip} labelAddon={labelAddon} allowedDates={allowedDates} disabledDays={disabledDays as Matcher | Matcher[]} />;\n\n return (\n <FormField\n label={label}\n required={required}\n tooltip={tooltip}\n tooltipId={tooltipId}\n labelAddon={labelAddon}\n className={cn('flex flex-col', className)}\n >\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n id={props.id ?? 'date'}\n className={cn(\"w-full justify-between px-field-padding-x py-0\", fieldTriggerClassName)}\n >\n {mode === 'range' && selectedRange?.from ? `${format(selectedRange.from)}${selectedRange.to ? ` – ${format(selectedRange.to)}` : ' – …'}` : selected ? format(selected) : <span className=\"text-muted-foreground/40\">{placeholder}</span>}\n <CalendarDays className=\"h-4 w-4 text-muted-foreground\" />\n </Button>\n </PopoverTrigger>\n\n <PopoverContent\n align={align}\n side={side}\n sideOffset={sideOffset}\n className={cn(\n 'w-auto overflow-hidden p-0',\n contentClassName,\n )}\n >\n {mode === 'range' ? <Calendar\n mode=\"range\"\n selected={selectedRange}\n captionLayout={captionLayout === 'buttons' ? 'label' : captionLayout}\n disabled={disabledDays as Matcher[]}\n allowedDates={allowedDates}\n excludeDisabled\n onSelect={(next) => {\n onRangeChange?.(next ? { from: next.from?.getTime(), to: next.to?.getTime() } : undefined);\n // Range selection stays open so the user can adjust both ends,\n // matching multiple-date selection behavior.\n }}\n /> : <Calendar\n mode=\"single\"\n selected={selected}\n captionLayout={\n captionLayout === 'buttons' ? 'label' : captionLayout\n }\n disabled={disabledDays as Matcher[]}\n allowedDates={allowedDates}\n onSelect={(d) => {\n setter?.(d ? d.getTime() : undefined);\n if (autoClose) setOpen(false);\n }}\n />}\n </PopoverContent>\n </Popover>\n </FormField>\n );\n};\n\ninterface FormDateMultiPickerProps {\n label?: string;\n dates?: number[];\n setter?: (value: number[]) => void;\n className?: string;\n contentClassName?: string;\n required?: boolean;\n tooltip?: string;\n labelAddon?: React.ReactNode;\n /** Only these local calendar dates can be selected. */\n allowedDates?: Date[];\n disabledDays?: Matcher | Matcher[];\n}\n\nconst FormDateMultiPicker = ({\n label,\n dates = [],\n setter,\n className,\n contentClassName,\n required = false,\n tooltip,\n labelAddon,\n allowedDates,\n disabledDays,\n}: FormDateMultiPickerProps) => {\n const [open, setOpen] = React.useState(false);\n const selected = dates\n .filter((value) => Number.isFinite(value))\n .map((value) => {\n const parts = new Intl.DateTimeFormat('en-US', {\n timeZone: 'Asia/Manila',\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n }).formatToParts(new Date(value));\n const get = (type: string) =>\n Number(parts.find((part) => part.type === type)?.value);\n return new Date(get('year'), get('month') - 1, get('day'));\n });\n const toManilaTimestamp = (date: Date) =>\n Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()) -\n 8 * 60 * 60 * 1000;\n\n return (\n <FormField\n label={label}\n required={required}\n tooltip={tooltip}\n labelAddon={labelAddon}\n className={cn('flex flex-col', className)}\n >\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n className={cn(\"w-full justify-between px-field-padding-x py-0\", fieldTriggerClassName)}\n >\n {selected.length\n ? `${selected.length} date${selected.length === 1 ? '' : 's'} selected`\n : 'Select dates'}\n <CalendarDays className=\"h-4 w-4 text-muted-foreground\" />\n </Button>\n </PopoverTrigger>\n <PopoverContent\n align=\"start\"\n sideOffset={6}\n className={cn(\n 'w-auto overflow-hidden p-0',\n contentClassName,\n )}\n >\n <Calendar\n mode=\"multiple\"\n captionLayout=\"label\"\n allowedDates={allowedDates}\n disabled={disabledDays}\n selected={selected}\n onSelect={(next) =>\n setter?.(\n (next ?? []).map(toManilaTimestamp).sort((a, b) => a - b),\n )\n }\n />\n </PopoverContent>\n </Popover>\n {!!selected.length && (\n <div className=\"flex flex-wrap gap-1.5\">\n {selected.map((date) => (\n <Button\n key={date.getTime()}\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n className=\"h-7 gap-1 px-2 text-xs\"\n onClick={() =>\n setter?.(\n selected\n .filter(\n (selectedDate) =>\n selectedDate.getTime() !== date.getTime(),\n )\n .map(toManilaTimestamp),\n )\n }\n >\n {date.toLocaleDateString(undefined, {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n })}\n <X className=\"h-3 w-3\" />\n <span className=\"sr-only\">\n Remove {date.toLocaleDateString()}\n </span>\n </Button>\n ))}\n </div>\n )}\n </FormField>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA2DO;AA0BL;;;;AAIyB;;AAwCb;;;AAGF;AAUE;AACA;;AACF;AAMZ;AAgBA;AAYE;;AAEG;AACA;;AAEG;AACA;AACA;AACA;;;;AAKJ;;AAGA;AAEF;AAeY;AACC;AAsCM;;AASL;AACA;AACA;AACD;AAWf;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"form-field.js","sources":["../../src/components/form-field.tsx"],"sourcesContent":["import * as React from 'react';\r\n\r\nimport { Label } from './label';\r\n\r\nexport interface FormFieldProps {\r\n label?: string;\r\n required?: boolean;\r\n tooltip?: string;\r\n /** Accepted for compatibility; not used by the Radix tooltip. */\r\n tooltipId?: string;\r\n /** Rendered to the right of the label, on the label's own row. */\r\n labelAddon?: React.ReactNode;\r\n className?: string;\r\n children: React.ReactNode;\r\n}\r\n\r\n/** The shared frame of every form field: optional label row, then the control. */\r\nexport function FormField({\r\n label,\r\n required,\r\n tooltip,\r\n tooltipId,\r\n labelAddon,\r\n className,\r\n children,\r\n}: FormFieldProps) {\r\n return (\r\n <div className={className}>\r\n {label && (\r\n <Label\r\n label={label}\r\n required={required}\r\n tooltip={tooltip}\r\n tooltipId={tooltipId}\r\n labelAddon={labelAddon}\r\n />\r\n )}\r\n {children}\r\n </div>\r\n );\r\n}\r\n"],"names":["_jsxs","_jsx"],"mappings":";;;AAgBA;SACgB,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,OAAO,EACP,SAAS,EACT,UAAU,EACV,SAAS,EACT,QAAQ,GACO,EAAA;AACf,IAAA,QACEA,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,SAAS,aACtB,KAAK,KACJC,GAAA,CAAC,KAAK,EAAA,EACJ,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EAAA,CACtB,CACH,EACA,QAAQ,CAAA,EAAA,CACL;AAEV;;;;"}
1
+ {"version":3,"file":"form-field.js","sources":["../../src/components/form-field.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Label } from './label';\n\nexport interface FormFieldProps {\n label?: string;\n required?: boolean;\n tooltip?: string;\n /** Accepted for compatibility; not used by the Radix tooltip. */\n tooltipId?: string;\n /** Rendered to the right of the label, on the label's own row. */\n labelAddon?: React.ReactNode;\n className?: string;\n children: React.ReactNode;\n}\n\n/** The shared frame of every form field: optional label row, then the control. */\nexport function FormField({\n label,\n required,\n tooltip,\n tooltipId,\n labelAddon,\n className,\n children,\n}: FormFieldProps) {\n return (\n <div className={className}>\n {label && (\n <Label\n label={label}\n required={required}\n tooltip={tooltip}\n tooltipId={tooltipId}\n labelAddon={labelAddon}\n />\n )}\n {children}\n </div>\n );\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;AAgBA;SACgB,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,OAAO,EACP,SAAS,EACT,UAAU,EACV,SAAS,EACT,QAAQ,GACO,EAAA;AACf,IAAA,QACEA,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,SAAS,aACtB,KAAK,KACJC,GAAA,CAAC,KAAK,EAAA,EACJ,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EAAA,CACtB,CACH,EACA,QAAQ,CAAA,EAAA,CACL;AAEV;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"form-input.js","sources":["../../src/components/form-input.tsx"],"sourcesContent":["'use client';\r\n\r\nimport * as React from 'react';\r\n\r\nimport { cn } from '@/utils';\r\nimport { Input } from '@/components/input';\r\nimport { FormField } from './form-field';\r\n\r\nexport interface FormInputProps extends React.InputHTMLAttributes<HTMLInputElement> {\r\n label?: string;\r\n setter?: (value: string) => void;\r\n required?: boolean;\r\n className?: string;\r\n tooltip?: string;\r\n tooltipId?: string;\r\n labelAddon?: React.ReactNode;\r\n}\r\n\r\nexport const FormInput = React.forwardRef<HTMLInputElement, FormInputProps>(\r\n function FormInput(\r\n {\r\n label,\r\n value,\r\n setter,\r\n required = true,\r\n className,\r\n tooltip,\r\n tooltipId,\r\n labelAddon,\r\n ...props\r\n },\r\n ref,\r\n ) {\r\n return (\r\n <FormField\r\n label={label}\r\n required={required}\r\n tooltip={tooltip}\r\n tooltipId={tooltipId}\r\n labelAddon={labelAddon}\r\n >\r\n <Input\r\n ref={ref}\r\n value={value ?? ''}\r\n onChange={(e) => setter && setter(e.target.value)}\r\n className={cn(className)}\r\n {...props}\r\n />\r\n </FormField>\r\n );\r\n },\r\n);\r\n"],"names":[],"mappings":";;;;;;;AAkBO;AAeH;AAiBF;;"}
1
+ {"version":3,"file":"form-input.js","sources":["../../src/components/form-input.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '@/utils';\nimport { Input } from '@/components/input';\nimport { FormField } from './form-field';\n\nexport interface FormInputProps extends React.InputHTMLAttributes<HTMLInputElement> {\n label?: string;\n setter?: (value: string) => void;\n required?: boolean;\n className?: string;\n tooltip?: string;\n tooltipId?: string;\n labelAddon?: React.ReactNode;\n}\n\nexport const FormInput = React.forwardRef<HTMLInputElement, FormInputProps>(\n function FormInput(\n {\n label,\n value,\n setter,\n required = true,\n className,\n tooltip,\n tooltipId,\n labelAddon,\n ...props\n },\n ref,\n ) {\n return (\n <FormField\n label={label}\n required={required}\n tooltip={tooltip}\n tooltipId={tooltipId}\n labelAddon={labelAddon}\n >\n <Input\n ref={ref}\n value={value ?? ''}\n onChange={(e) => setter && setter(e.target.value)}\n className={cn(className)}\n {...props}\n />\n </FormField>\n );\n },\n);\n"],"names":[],"mappings":";;;;;;;AAkBO;AAeH;AAiBF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"form-month-picker.js","sources":["../../src/components/form-month-picker.tsx"],"sourcesContent":["'use client';\r\n\r\nimport * as React from 'react';\r\nimport { ChevronDown, ChevronLeft, ChevronRight } from 'lucide-react';\r\n\r\nimport { cn } from '@/utils';\r\nimport { fieldTriggerClassName } from '@/hooks/use-field-focus';\r\nimport { Button } from '@/components/button';\r\nimport {\r\n Popover,\r\n PopoverContent,\r\n PopoverTrigger,\r\n} from '@/components/popover';\r\nimport {\r\n Select,\r\n SelectContent,\r\n SelectItem,\r\n SelectTrigger,\r\n SelectValue,\r\n} from '@/components/select';\r\nimport { FormField } from './form-field';\r\n\r\nexport interface FormMonthPickerProps extends React.InputHTMLAttributes<HTMLInputElement> {\r\n label?: string;\r\n /** ms since epoch; will be normalized to the first day of the month */\r\n date?: number;\r\n /** setter receives ms since epoch (first day of month at local midnight) or undefined when cleared */\r\n setter?: (value?: number) => void;\r\n className?: string;\r\n side?: 'top' | 'right' | 'bottom' | 'left';\r\n align?: 'start' | 'center' | 'end';\r\n sideOffset?: number;\r\n contentClassName?: string;\r\n tooltip?: string;\r\n tooltipId?: string;\r\n required?: boolean;\r\n\r\n /** Placeholder text when no month selected */\r\n placeholder?: string;\r\n\r\n /** Format the button text */\r\n format?: (d: Date) => string;\r\n\r\n /** Year bounds for navigation (inclusive) */\r\n fromYear?: number;\r\n toYear?: number;\r\n\r\n /** Close popover automatically on select (default true) */\r\n autoClose?: boolean;\r\n}\r\n\r\nexport const FormMonthPicker = ({\r\n label,\r\n date,\r\n setter,\r\n className,\r\n side = 'bottom',\r\n align = 'start',\r\n sideOffset = 6,\r\n contentClassName,\r\n placeholder = 'Select month',\r\n format = (d) =>\r\n d.toLocaleDateString(undefined, { month: 'short', year: 'numeric' }),\r\n fromYear = new Date().getFullYear() - 5,\r\n toYear = new Date().getFullYear() + 5,\r\n autoClose = true,\r\n tooltip,\r\n tooltipId,\r\n required = false,\r\n ...props\r\n}: FormMonthPickerProps) => {\r\n const [open, setOpen] = React.useState(false);\r\n\r\n // normalize incoming ms -> first day of month\r\n const selected = React.useMemo(() => {\r\n if (date == null) return undefined;\r\n const d = new Date(date);\r\n return new Date(d.getFullYear(), d.getMonth(), 1, 0, 0, 0, 0);\r\n }, [date]);\r\n\r\n const [viewYear, setViewYear] = React.useState<number>(\r\n selected?.getFullYear() ?? new Date().getFullYear(),\r\n );\r\n\r\n React.useEffect(() => {\r\n if (selected) setViewYear(selected.getFullYear());\r\n }, [selected]);\r\n\r\n const months = React.useMemo(\r\n () =>\r\n Array.from({ length: 12 }, (_, m) => ({\r\n m,\r\n label: new Date(2000, m, 1).toLocaleString(undefined, {\r\n month: 'short',\r\n }),\r\n })),\r\n [],\r\n );\r\n\r\n const clampYear = (y: number) => Math.min(Math.max(y, fromYear), toYear);\r\n\r\n const selectMonth = (monthIndex: number) => {\r\n const y = clampYear(viewYear);\r\n const firstOfMonth = new Date(y, monthIndex, 1, 0, 0, 0, 0).getTime();\r\n setter?.(firstOfMonth);\r\n if (autoClose) setOpen(false);\r\n };\r\n\r\n const prevYear = () => setViewYear((y) => clampYear(y - 1));\r\n const nextYear = () => setViewYear((y) => clampYear(y + 1));\r\n\r\n const isYearMin = viewYear <= fromYear;\r\n const isYearMax = viewYear >= toYear;\r\n\r\n return (\r\n <FormField\r\n label={label}\r\n required={required}\r\n tooltip={tooltip}\r\n tooltipId={tooltipId}\r\n className={cn('flex flex-col', className)}\r\n >\r\n <Popover open={open} onOpenChange={setOpen}>\r\n <PopoverTrigger asChild>\r\n <Button\r\n variant=\"outline\"\r\n id={props.id ?? 'month'}\r\n className={cn(\"w-full justify-between px-field-padding-x py-0\", fieldTriggerClassName)}\r\n >\r\n {selected ? format(selected) : <span className=\"text-muted-foreground/40\">{placeholder}</span>}\r\n <ChevronDown className=\"h-4 w-4 text-muted-foreground\" />\r\n </Button>\r\n </PopoverTrigger>\r\n\r\n <PopoverContent\r\n align={align}\r\n side={side}\r\n sideOffset={sideOffset}\r\n className={cn('w-72 p-3', contentClassName)}\r\n >\r\n {/* Header: year controls */}\r\n <div className=\"mb-3 flex items-center justify-between\">\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n size=\"sm\"\r\n className=\"h-8 w-8 p-0\"\r\n aria-label=\"Previous year\"\r\n onClick={prevYear}\r\n disabled={isYearMin}\r\n >\r\n <ChevronLeft className=\"h-4 w-4\" />\r\n </Button>\r\n\r\n <Select\r\n value={String(viewYear)}\r\n onValueChange={(val) => setViewYear(clampYear(Number(val)))}\r\n >\r\n <SelectTrigger className=\"w-fit text-sm\">\r\n <SelectValue />\r\n </SelectTrigger>\r\n <SelectContent className=\"h-fit\">\r\n {Array.from(\r\n { length: toYear - fromYear + 1 },\r\n (_, i) => fromYear + i,\r\n ).map((y) => (\r\n <SelectItem key={y} value={String(y)}>\r\n {y}\r\n </SelectItem>\r\n ))}\r\n </SelectContent>\r\n </Select>\r\n\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n size=\"sm\"\r\n className=\"h-8 w-8 p-0\"\r\n aria-label=\"Next year\"\r\n onClick={nextYear}\r\n disabled={isYearMax}\r\n >\r\n <ChevronRight className=\"h-4 w-4\" />\r\n </Button>\r\n </div>\r\n\r\n {/* Month grid */}\r\n <div className=\"grid grid-cols-3 gap-2\">\r\n {months.map(({ m, label: monthLabel }) => {\r\n const isActive =\r\n selected &&\r\n selected.getFullYear() === viewYear &&\r\n selected.getMonth() === m;\r\n\r\n return (\r\n <Button\r\n key={m}\r\n type=\"button\"\r\n variant={isActive ? 'solid' : 'outline'}\r\n className={cn(\r\n 'h-9 justify-center rounded-control-lg',\r\n isActive ? '' : 'bg-background',\r\n )}\r\n onClick={() => selectMonth(m)}\r\n >\r\n <span className=\"text-sm\">{monthLabel}</span>\r\n </Button>\r\n );\r\n })}\r\n </div>\r\n\r\n {/* Clear (optional) */}\r\n <div className=\"mt-3 flex justify-end\">\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n className=\"h-8 px-2 text-xs\"\r\n onClick={() => {\r\n setter?.(undefined);\r\n setOpen(false);\r\n }}\r\n >\r\n Clear\r\n </Button>\r\n </div>\r\n </PopoverContent>\r\n </Popover>\r\n </FormField>\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;;;;;;;;;AAuEE;;AAGA;;AACoB;AAClB;;AAEF;;AAMA;AACE;AAAc;AAChB;;;AAMM;AACE;;AAEH;;AAML;AACE;;AAEA;AACA;;AACF;AAEA;AACA;AAEA;AACA;AAEA;;AA6Ec;AACA;;;AA0BA;;AAEF;AASd;;"}
1
+ {"version":3,"file":"form-month-picker.js","sources":["../../src/components/form-month-picker.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChevronDown, ChevronLeft, ChevronRight } from 'lucide-react';\n\nimport { cn } from '@/utils';\nimport { fieldTriggerClassName } from '@/hooks/use-field-focus';\nimport { Button } from '@/components/button';\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from '@/components/popover';\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@/components/select';\nimport { FormField } from './form-field';\n\nexport interface FormMonthPickerProps extends React.InputHTMLAttributes<HTMLInputElement> {\n label?: string;\n /** ms since epoch; will be normalized to the first day of the month */\n date?: number;\n /** setter receives ms since epoch (first day of month at local midnight) or undefined when cleared */\n setter?: (value?: number) => void;\n className?: string;\n side?: 'top' | 'right' | 'bottom' | 'left';\n align?: 'start' | 'center' | 'end';\n sideOffset?: number;\n contentClassName?: string;\n tooltip?: string;\n tooltipId?: string;\n required?: boolean;\n\n /** Placeholder text when no month selected */\n placeholder?: string;\n\n /** Format the button text */\n format?: (d: Date) => string;\n\n /** Year bounds for navigation (inclusive) */\n fromYear?: number;\n toYear?: number;\n\n /** Close popover automatically on select (default true) */\n autoClose?: boolean;\n}\n\nexport const FormMonthPicker = ({\n label,\n date,\n setter,\n className,\n side = 'bottom',\n align = 'start',\n sideOffset = 6,\n contentClassName,\n placeholder = 'Select month',\n format = (d) =>\n d.toLocaleDateString(undefined, { month: 'short', year: 'numeric' }),\n fromYear = new Date().getFullYear() - 5,\n toYear = new Date().getFullYear() + 5,\n autoClose = true,\n tooltip,\n tooltipId,\n required = false,\n ...props\n}: FormMonthPickerProps) => {\n const [open, setOpen] = React.useState(false);\n\n // normalize incoming ms -> first day of month\n const selected = React.useMemo(() => {\n if (date == null) return undefined;\n const d = new Date(date);\n return new Date(d.getFullYear(), d.getMonth(), 1, 0, 0, 0, 0);\n }, [date]);\n\n const [viewYear, setViewYear] = React.useState<number>(\n selected?.getFullYear() ?? new Date().getFullYear(),\n );\n\n React.useEffect(() => {\n if (selected) setViewYear(selected.getFullYear());\n }, [selected]);\n\n const months = React.useMemo(\n () =>\n Array.from({ length: 12 }, (_, m) => ({\n m,\n label: new Date(2000, m, 1).toLocaleString(undefined, {\n month: 'short',\n }),\n })),\n [],\n );\n\n const clampYear = (y: number) => Math.min(Math.max(y, fromYear), toYear);\n\n const selectMonth = (monthIndex: number) => {\n const y = clampYear(viewYear);\n const firstOfMonth = new Date(y, monthIndex, 1, 0, 0, 0, 0).getTime();\n setter?.(firstOfMonth);\n if (autoClose) setOpen(false);\n };\n\n const prevYear = () => setViewYear((y) => clampYear(y - 1));\n const nextYear = () => setViewYear((y) => clampYear(y + 1));\n\n const isYearMin = viewYear <= fromYear;\n const isYearMax = viewYear >= toYear;\n\n return (\n <FormField\n label={label}\n required={required}\n tooltip={tooltip}\n tooltipId={tooltipId}\n className={cn('flex flex-col', className)}\n >\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n id={props.id ?? 'month'}\n className={cn(\"w-full justify-between px-field-padding-x py-0\", fieldTriggerClassName)}\n >\n {selected ? format(selected) : <span className=\"text-muted-foreground/40\">{placeholder}</span>}\n <ChevronDown className=\"h-4 w-4 text-muted-foreground\" />\n </Button>\n </PopoverTrigger>\n\n <PopoverContent\n align={align}\n side={side}\n sideOffset={sideOffset}\n className={cn('w-72 p-3', contentClassName)}\n >\n {/* Header: year controls */}\n <div className=\"mb-3 flex items-center justify-between\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-8 w-8 p-0\"\n aria-label=\"Previous year\"\n onClick={prevYear}\n disabled={isYearMin}\n >\n <ChevronLeft className=\"h-4 w-4\" />\n </Button>\n\n <Select\n value={String(viewYear)}\n onValueChange={(val) => setViewYear(clampYear(Number(val)))}\n >\n <SelectTrigger className=\"w-fit text-sm\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent className=\"h-fit\">\n {Array.from(\n { length: toYear - fromYear + 1 },\n (_, i) => fromYear + i,\n ).map((y) => (\n <SelectItem key={y} value={String(y)}>\n {y}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-8 w-8 p-0\"\n aria-label=\"Next year\"\n onClick={nextYear}\n disabled={isYearMax}\n >\n <ChevronRight className=\"h-4 w-4\" />\n </Button>\n </div>\n\n {/* Month grid */}\n <div className=\"grid grid-cols-3 gap-2\">\n {months.map(({ m, label: monthLabel }) => {\n const isActive =\n selected &&\n selected.getFullYear() === viewYear &&\n selected.getMonth() === m;\n\n return (\n <Button\n key={m}\n type=\"button\"\n variant={isActive ? 'solid' : 'outline'}\n className={cn(\n 'h-9 justify-center rounded-control-lg',\n isActive ? '' : 'bg-background',\n )}\n onClick={() => selectMonth(m)}\n >\n <span className=\"text-sm\">{monthLabel}</span>\n </Button>\n );\n })}\n </div>\n\n {/* Clear (optional) */}\n <div className=\"mt-3 flex justify-end\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n className=\"h-8 px-2 text-xs\"\n onClick={() => {\n setter?.(undefined);\n setOpen(false);\n }}\n >\n Clear\n </Button>\n </div>\n </PopoverContent>\n </Popover>\n </FormField>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAuEE;;AAGA;;AACoB;AAClB;;AAEF;;AAMA;AACE;AAAc;AAChB;;;AAMM;AACE;;AAEH;;AAML;AACE;;AAEA;AACA;;AACF;AAEA;AACA;AAEA;AACA;AAEA;;AA6Ec;AACA;;;AA0BA;;AAEF;AASd;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"form-radio.js","sources":["../../src/components/form-radio.tsx"],"sourcesContent":["import { RadioGroup, RadioGroupItem } from './radio-group';\r\nimport { FormField } from './form-field';\r\n\r\nexport interface FormRadioProps<T extends string | boolean = string> {\r\n options: { value: T; label: string }[];\r\n value?: T;\r\n setter?: (value: T) => void;\r\n label?: string;\r\n required?: boolean;\r\n className?: string;\r\n name?: string;\r\n tooltip?: string;\r\n tooltipId?: string;\r\n}\r\n\r\nexport const FormRadio = <T extends string | boolean = string>({\r\n label,\r\n value,\r\n options,\r\n setter,\r\n required = false,\r\n className,\r\n tooltip,\r\n tooltipId,\r\n name,\r\n}: FormRadioProps<T>) => {\r\n const stringValue = value?.toString() || '';\r\n\r\n const handleValueChange = (next: string) => {\r\n if (!setter) return;\r\n\r\n // Find the original option to get the correct type\r\n const selectedOption = options.find(\r\n (option) => option.value.toString() === next,\r\n );\r\n if (selectedOption) {\r\n setter(selectedOption.value);\r\n }\r\n };\r\n\r\n return (\r\n <FormField\r\n label={label}\r\n required={required}\r\n tooltip={tooltip}\r\n tooltipId={tooltipId}\r\n className={className}\r\n >\r\n <RadioGroup\r\n value={stringValue}\r\n onValueChange={handleValueChange}\r\n className=\"gap-field-label-gap\"\r\n name={name}\r\n >\r\n {options.map((option) => (\r\n <div\r\n key={option.value.toString()}\r\n className=\"flex items-center space-x-3\"\r\n >\r\n <RadioGroupItem\r\n value={option.value.toString()}\r\n id={`${name}-${option.value.toString()}`}\r\n />\r\n\r\n <label\r\n htmlFor={`${name}-${option.value.toString()}`}\r\n className=\"flex-1 cursor-pointer text-sm font-medium\"\r\n >\r\n {option.label}\r\n </label>\r\n </div>\r\n ))}\r\n </RadioGroup>\r\n </FormField>\r\n );\r\n};\r\n"],"names":["_jsx","_jsxs"],"mappings":";;;;AAeO,MAAM,SAAS,GAAG,CAAsC,EAC7D,KAAK,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,GAAG,KAAK,EAChB,SAAS,EACT,OAAO,EACP,SAAS,EACT,IAAI,GACc,KAAI;IACtB,MAAM,WAAW,GAAG,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;AAE3C,IAAA,MAAM,iBAAiB,GAAG,CAAC,IAAY,KAAI;AACzC,QAAA,IAAI,CAAC,MAAM;YAAE;;QAGb,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,CACjC,CAAC,MAAM,KAAK,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,IAAI,CAC7C;QACD,IAAI,cAAc,EAAE;AAClB,YAAA,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC;QAC9B;AACF,IAAA,CAAC;IAED,QACEA,GAAA,CAAC,SAAS,EAAA,EACR,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EAAA,QAAA,EAEpBA,GAAA,CAAC,UAAU,EAAA,EACT,KAAK,EAAE,WAAW,EAClB,aAAa,EAAE,iBAAiB,EAChC,SAAS,EAAC,qBAAqB,EAC/B,IAAI,EAAE,IAAI,EAAA,QAAA,EAET,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,MAClBC,IAAA,CAAA,KAAA,EAAA,EAEE,SAAS,EAAC,6BAA6B,EAAA,QAAA,EAAA,CAEvCD,GAAA,CAAC,cAAc,EAAA,EACb,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,EAC9B,EAAE,EAAE,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAA,CAAE,EAAA,CACxC,EAEFA,GAAA,CAAA,OAAA,EAAA,EACE,OAAO,EAAE,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAA,CAAE,EAC7C,SAAS,EAAC,2CAA2C,EAAA,QAAA,EAEpD,MAAM,CAAC,KAAK,EAAA,CACP,CAAA,EAAA,EAbH,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAcxB,CACP,CAAC,EAAA,CACS,EAAA,CACH;AAEhB;;;;"}
1
+ {"version":3,"file":"form-radio.js","sources":["../../src/components/form-radio.tsx"],"sourcesContent":["import { RadioGroup, RadioGroupItem } from './radio-group';\nimport { FormField } from './form-field';\n\nexport interface FormRadioProps<T extends string | boolean = string> {\n options: { value: T; label: string }[];\n value?: T;\n setter?: (value: T) => void;\n label?: string;\n required?: boolean;\n className?: string;\n name?: string;\n tooltip?: string;\n tooltipId?: string;\n}\n\nexport const FormRadio = <T extends string | boolean = string>({\n label,\n value,\n options,\n setter,\n required = false,\n className,\n tooltip,\n tooltipId,\n name,\n}: FormRadioProps<T>) => {\n const stringValue = value?.toString() || '';\n\n const handleValueChange = (next: string) => {\n if (!setter) return;\n\n // Find the original option to get the correct type\n const selectedOption = options.find(\n (option) => option.value.toString() === next,\n );\n if (selectedOption) {\n setter(selectedOption.value);\n }\n };\n\n return (\n <FormField\n label={label}\n required={required}\n tooltip={tooltip}\n tooltipId={tooltipId}\n className={className}\n >\n <RadioGroup\n value={stringValue}\n onValueChange={handleValueChange}\n className=\"gap-field-label-gap\"\n name={name}\n >\n {options.map((option) => (\n <div\n key={option.value.toString()}\n className=\"flex items-center space-x-3\"\n >\n <RadioGroupItem\n value={option.value.toString()}\n id={`${name}-${option.value.toString()}`}\n />\n\n <label\n htmlFor={`${name}-${option.value.toString()}`}\n className=\"flex-1 cursor-pointer text-sm font-medium\"\n >\n {option.label}\n </label>\n </div>\n ))}\n </RadioGroup>\n </FormField>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;AAeO,MAAM,SAAS,GAAG,CAAsC,EAC7D,KAAK,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,GAAG,KAAK,EAChB,SAAS,EACT,OAAO,EACP,SAAS,EACT,IAAI,GACc,KAAI;IACtB,MAAM,WAAW,GAAG,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;AAE3C,IAAA,MAAM,iBAAiB,GAAG,CAAC,IAAY,KAAI;AACzC,QAAA,IAAI,CAAC,MAAM;YAAE;;QAGb,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,CACjC,CAAC,MAAM,KAAK,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,IAAI,CAC7C;QACD,IAAI,cAAc,EAAE;AAClB,YAAA,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC;QAC9B;AACF,IAAA,CAAC;IAED,QACEA,GAAA,CAAC,SAAS,EAAA,EACR,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EAAA,QAAA,EAEpBA,GAAA,CAAC,UAAU,EAAA,EACT,KAAK,EAAE,WAAW,EAClB,aAAa,EAAE,iBAAiB,EAChC,SAAS,EAAC,qBAAqB,EAC/B,IAAI,EAAE,IAAI,EAAA,QAAA,EAET,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,MAClBC,IAAA,CAAA,KAAA,EAAA,EAEE,SAAS,EAAC,6BAA6B,EAAA,QAAA,EAAA,CAEvCD,GAAA,CAAC,cAAc,EAAA,EACb,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,EAC9B,EAAE,EAAE,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAA,CAAE,EAAA,CACxC,EAEFA,GAAA,CAAA,OAAA,EAAA,EACE,OAAO,EAAE,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAA,CAAE,EAC7C,SAAS,EAAC,2CAA2C,EAAA,QAAA,EAEpD,MAAM,CAAC,KAAK,EAAA,CACP,CAAA,EAAA,EAbH,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAcxB,CACP,CAAC,EAAA,CACS,EAAA,CACH;AAEhB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"form-textarea.js","sources":["../../src/components/form-textarea.tsx"],"sourcesContent":["'use client';\r\n\r\nimport * as React from 'react';\r\n\r\nimport { cn } from '@/utils';\r\nimport { Textarea } from '@/components/textarea';\r\nimport { FormField } from './form-field';\r\n\r\nexport interface FormTextareaProps extends React.InputHTMLAttributes<HTMLTextAreaElement> {\r\n label?: string;\r\n setter?: (value: string) => void;\r\n required?: boolean;\r\n className?: string;\r\n tooltip?: string;\r\n tooltipId?: string;\r\n labelAddon?: React.ReactNode;\r\n}\r\n\r\nexport const FormTextarea = ({\r\n label,\r\n value,\r\n setter,\r\n required = true,\r\n className,\r\n tooltip,\r\n tooltipId,\r\n labelAddon,\r\n ...props\r\n}: FormTextareaProps) => {\r\n return (\r\n <FormField\r\n label={label}\r\n required={required}\r\n tooltip={tooltip}\r\n tooltipId={tooltipId}\r\n labelAddon={labelAddon}\r\n >\r\n <Textarea\r\n value={value ?? ''}\r\n onChange={(e) => setter && setter(e.target.value)}\r\n className={cn(className)}\r\n {...props}\r\n />\r\n </FormField>\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;;;AAkBO;AAWL;AAgBF;;"}
1
+ {"version":3,"file":"form-textarea.js","sources":["../../src/components/form-textarea.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '@/utils';\nimport { Textarea } from '@/components/textarea';\nimport { FormField } from './form-field';\n\nexport interface FormTextareaProps extends React.InputHTMLAttributes<HTMLTextAreaElement> {\n label?: string;\n setter?: (value: string) => void;\n required?: boolean;\n className?: string;\n tooltip?: string;\n tooltipId?: string;\n labelAddon?: React.ReactNode;\n}\n\nexport const FormTextarea = ({\n label,\n value,\n setter,\n required = true,\n className,\n tooltip,\n tooltipId,\n labelAddon,\n ...props\n}: FormTextareaProps) => {\n return (\n <FormField\n label={label}\n required={required}\n tooltip={tooltip}\n tooltipId={tooltipId}\n labelAddon={labelAddon}\n >\n <Textarea\n value={value ?? ''}\n onChange={(e) => setter && setter(e.target.value)}\n className={cn(className)}\n {...props}\n />\n </FormField>\n );\n};\n"],"names":[],"mappings":";;;;;;AAkBO;AAWL;AAgBF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"form.js","sources":["../../src/components/form.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { Slot } from \"@radix-ui/react-slot\";\r\nimport {\r\n Controller,\r\n ControllerProps,\r\n FieldPath,\r\n FieldValues,\r\n FormProvider,\r\n useFormContext,\r\n} from \"react-hook-form\";\r\n\r\nimport { cn } from \"@/utils\";\r\nimport { Label } from './label';\r\n\r\nconst Form = FormProvider;\r\n\r\ntype FormFieldContextValue<\r\n TFieldValues extends FieldValues = FieldValues,\r\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\r\n> = {\r\n name: TName;\r\n};\r\n\r\nconst FormFieldContext = React.createContext<FormFieldContextValue>(\r\n {} as FormFieldContextValue,\r\n);\r\n\r\nconst FormField = <\r\n TFieldValues extends FieldValues = FieldValues,\r\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\r\n>({\r\n ...props\r\n}: ControllerProps<TFieldValues, TName>) => {\r\n return (\r\n <FormFieldContext.Provider value={{ name: props.name }}>\r\n <Controller {...props} />\r\n </FormFieldContext.Provider>\r\n );\r\n};\r\n\r\nconst useFormField = () => {\r\n const fieldContext = React.useContext(FormFieldContext);\r\n const itemContext = React.useContext(FormItemContext);\r\n const { getFieldState, formState } = useFormContext();\r\n\r\n const fieldState = getFieldState(fieldContext.name, formState);\r\n\r\n if (!fieldContext) {\r\n throw new Error(\"useFormField should be used within <FormField>\");\r\n }\r\n\r\n const { id } = itemContext;\r\n\r\n return {\r\n id,\r\n name: fieldContext.name,\r\n formItemId: `${id}-form-item`,\r\n formDescriptionId: `${id}-form-item-description`,\r\n formMessageId: `${id}-form-item-message`,\r\n ...fieldState,\r\n };\r\n};\r\n\r\ntype FormItemContextValue = {\r\n id: string;\r\n};\r\n\r\nconst FormItemContext = React.createContext<FormItemContextValue>(\r\n {} as FormItemContextValue,\r\n);\r\n\r\nconst FormItem = React.forwardRef<\r\n HTMLDivElement,\r\n React.HTMLAttributes<HTMLDivElement>\r\n>(({ className, ...props }, ref) => {\r\n const id = React.useId();\r\n\r\n return (\r\n <FormItemContext.Provider value={{ id }}>\r\n <div ref={ref} className={cn(\"space-y-field-label-gap\", className)} {...props} />\r\n </FormItemContext.Provider>\r\n );\r\n});\r\nFormItem.displayName = \"FormItem\";\r\n\r\nconst FormLabel = React.forwardRef<\r\n HTMLLabelElement,\r\n React.ComponentPropsWithoutRef<'label'> & { required?: boolean }\r\n>(({ className, required = false, children, ...props }, ref) => {\r\n const { error, formItemId } = useFormField();\r\n\r\n return (\r\n <Label\r\n label={children}\r\n required={required}\r\n className=\"mb-0\"\r\n labelProps={{\r\n ref,\r\n htmlFor: formItemId,\r\n ...props,\r\n className: cn(error && 'text-destructive', className),\r\n }}\r\n />\r\n );\r\n});\r\nFormLabel.displayName = \"FormLabel\";\r\n\r\nconst FormControl = React.forwardRef<\r\n React.ElementRef<typeof Slot>,\r\n React.ComponentPropsWithoutRef<typeof Slot>\r\n>(({ ...props }, ref) => {\r\n const { error, formItemId, formDescriptionId, formMessageId } =\r\n useFormField();\r\n\r\n return (\r\n <Slot\r\n ref={ref}\r\n id={formItemId}\r\n aria-describedby={\r\n !error\r\n ? `${formDescriptionId}`\r\n : `${formDescriptionId} ${formMessageId}`\r\n }\r\n aria-invalid={!!error}\r\n {...props}\r\n />\r\n );\r\n});\r\nFormControl.displayName = \"FormControl\";\r\n\r\nconst FormDescription = React.forwardRef<\r\n HTMLParagraphElement,\r\n React.HTMLAttributes<HTMLParagraphElement>\r\n>(({ className, ...props }, ref) => {\r\n const { formDescriptionId } = useFormField();\r\n\r\n return (\r\n <p\r\n ref={ref}\r\n id={formDescriptionId}\r\n className={cn(\"text-sm leading-normal text-muted-foreground\", className)}\r\n {...props}\r\n />\r\n );\r\n});\r\nFormDescription.displayName = \"FormDescription\";\r\n\r\nconst FormMessage = React.forwardRef<\r\n HTMLParagraphElement,\r\n React.HTMLAttributes<HTMLParagraphElement>\r\n>(({ className, children, ...props }, ref) => {\r\n const { error, formMessageId } = useFormField();\r\n const body = error ? String(error?.message) : children;\r\n\r\n if (!body) {\r\n return null;\r\n }\r\n\r\n return (\r\n <p\r\n ref={ref}\r\n id={formMessageId}\r\n className={cn(\"text-sm leading-normal font-medium text-destructive\", className)}\r\n {...props}\r\n >\r\n {body}\r\n </p>\r\n );\r\n});\r\nFormMessage.displayName = \"FormMessage\";\r\n\r\nexport {\r\n useFormField,\r\n Form,\r\n FormItem,\r\n FormLabel,\r\n FormControl,\r\n FormDescription,\r\n FormMessage,\r\n FormField,\r\n};\r\n"],"names":[],"mappings":";;;;;;;;AAgBA;AASA;AAIA;;AAWA;AAEA;;;;;;AAQI;;AAGF;;;;;;;AAQE;;AAEJ;AAMA;AAIA;AAIE;AAEA;AAKF;AACA;AAEA;;AAME;;AAOM;AACA;;AAED;AAGP;AACA;AAEA;AAIE;AAGA;;AAOQ;AAMV;AACA;AAEA;AAIE;;AAUF;AACA;AAEA;;AAKE;;AAGE;;;AAaJ;AACA;;"}
1
+ {"version":3,"file":"form.js","sources":["../../src/components/form.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n Controller,\n ControllerProps,\n FieldPath,\n FieldValues,\n FormProvider,\n useFormContext,\n} from \"react-hook-form\";\n\nimport { cn } from \"@/utils\";\nimport { Label } from './label';\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n name: TName;\n};\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>(\n {} as FormFieldContextValue,\n);\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext);\n const itemContext = React.useContext(FormItemContext);\n const { getFieldState, formState } = useFormContext();\n\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error(\"useFormField should be used within <FormField>\");\n }\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = React.createContext<FormItemContextValue>(\n {} as FormItemContextValue,\n);\n\nconst FormItem = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => {\n const id = React.useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn(\"space-y-field-label-gap\", className)} {...props} />\n </FormItemContext.Provider>\n );\n});\nFormItem.displayName = \"FormItem\";\n\nconst FormLabel = React.forwardRef<\n HTMLLabelElement,\n React.ComponentPropsWithoutRef<'label'> & { required?: boolean }\n>(({ className, required = false, children, ...props }, ref) => {\n const { error, formItemId } = useFormField();\n\n return (\n <Label\n label={children}\n required={required}\n className=\"mb-0\"\n labelProps={{\n ref,\n htmlFor: formItemId,\n ...props,\n className: cn(error && 'text-destructive', className),\n }}\n />\n );\n});\nFormLabel.displayName = \"FormLabel\";\n\nconst FormControl = React.forwardRef<\n React.ElementRef<typeof Slot>,\n React.ComponentPropsWithoutRef<typeof Slot>\n>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } =\n useFormField();\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={\n !error\n ? `${formDescriptionId}`\n : `${formDescriptionId} ${formMessageId}`\n }\n aria-invalid={!!error}\n {...props}\n />\n );\n});\nFormControl.displayName = \"FormControl\";\n\nconst FormDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField();\n\n return (\n <p\n ref={ref}\n id={formDescriptionId}\n className={cn(\"text-sm leading-normal text-muted-foreground\", className)}\n {...props}\n />\n );\n});\nFormDescription.displayName = \"FormDescription\";\n\nconst FormMessage = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, children, ...props }, ref) => {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error?.message) : children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p\n ref={ref}\n id={formMessageId}\n className={cn(\"text-sm leading-normal font-medium text-destructive\", className)}\n {...props}\n >\n {body}\n </p>\n );\n});\nFormMessage.displayName = \"FormMessage\";\n\nexport {\n useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField,\n};\n"],"names":[],"mappings":";;;;;;;;AAgBA;AASA;AAIA;;AAWA;AAEA;;;;;;AAQI;;AAGF;;;;;;;AAQE;;AAEJ;AAMA;AAIA;AAIE;AAEA;AAKF;AACA;AAEA;;AAME;;AAOM;AACA;;AAED;AAGP;AACA;AAEA;AAIE;AAGA;;AAOQ;AAMV;AACA;AAEA;AAIE;;AAUF;AACA;AAEA;;AAKE;;AAGE;;;AAaJ;AACA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"hover-card.js","sources":["../../src/components/hover-card.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport * as HoverCardPrimitive from \"@radix-ui/react-hover-card\";\r\n\r\nimport { cn } from \"@/utils\";\r\n\r\nconst HoverCard = HoverCardPrimitive.Root;\r\n\r\nconst HoverCardTrigger = HoverCardPrimitive.Trigger;\r\n\r\nconst HoverCardContent = React.forwardRef<\r\n React.ElementRef<typeof HoverCardPrimitive.Content>,\r\n React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>\r\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\r\n <HoverCardPrimitive.Portal>\r\n <HoverCardPrimitive.Content\r\n ref={ref}\r\n align={align}\r\n sideOffset={sideOffset}\r\n className={cn(\r\n \"z-(--z-popover) w-64 max-w-[calc(100vw-2rem)] rounded-card border border-border bg-popover p-4 text-sm text-popover-foreground shadow-card outline-none data-[state=open]:animate-in motion-reduce:animate-none 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\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n </HoverCardPrimitive.Portal>\r\n));\r\nHoverCardContent.displayName = HoverCardPrimitive.Content.displayName;\r\n\r\nexport { HoverCard, HoverCardTrigger, HoverCardContent };\r\n"],"names":[],"mappings":";;;;;;AAOA;AAEA;AAEA;AAiBA;;"}
1
+ {"version":3,"file":"hover-card.js","sources":["../../src/components/hover-card.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as HoverCardPrimitive from \"@radix-ui/react-hover-card\";\n\nimport { cn } from \"@/utils\";\n\nconst HoverCard = HoverCardPrimitive.Root;\n\nconst HoverCardTrigger = HoverCardPrimitive.Trigger;\n\nconst HoverCardContent = React.forwardRef<\n React.ElementRef<typeof HoverCardPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n <HoverCardPrimitive.Portal>\n <HoverCardPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-(--z-popover) w-64 max-w-[calc(100vw-2rem)] rounded-card border border-border bg-popover p-4 text-sm text-popover-foreground shadow-card outline-none data-[state=open]:animate-in motion-reduce:animate-none 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\",\n className,\n )}\n {...props}\n />\n </HoverCardPrimitive.Portal>\n));\nHoverCardContent.displayName = HoverCardPrimitive.Content.displayName;\n\nexport { HoverCard, HoverCardTrigger, HoverCardContent };\n"],"names":[],"mappings":";;;;;;AAOA;AAEA;AAEA;AAiBA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"input-otp.js","sources":["../../src/components/input-otp.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { OTPInput, OTPInputContext } from \"input-otp\";\r\nimport { Dot } from \"lucide-react\";\r\n\r\nimport { cn } from \"@/utils\";\r\n\r\nexport type InputOTPSize = 'md' | 'lg' | 'xl';\r\n\r\nconst InputOTPSizeContext = React.createContext<InputOTPSize>('md');\r\n\r\nconst InputOTP = React.forwardRef<\r\n React.ElementRef<typeof OTPInput>,\r\n React.ComponentPropsWithoutRef<typeof OTPInput>\r\n>(({ className, containerClassName, ...props }, ref) => (\r\n <OTPInput\r\n ref={ref}\r\n containerClassName={cn(\r\n \"flex items-center gap-2 has-[:disabled]:opacity-50\",\r\n containerClassName,\r\n )}\r\n className={cn(\"disabled:cursor-not-allowed\", className)}\r\n {...props}\r\n />\r\n));\r\nInputOTP.displayName = \"InputOTP\";\r\n\r\nconst InputOTPGroup = React.forwardRef<\r\n React.ElementRef<\"div\">,\r\n React.ComponentPropsWithoutRef<\"div\"> & { size?: InputOTPSize }\r\n>(({ className, size = 'md', ...props }, ref) => (\r\n <InputOTPSizeContext.Provider value={size}>\r\n <div ref={ref} className={cn(\"flex items-center\", className)} {...props} />\r\n </InputOTPSizeContext.Provider>\r\n));\r\nInputOTPGroup.displayName = \"InputOTPGroup\";\r\n\r\nconst InputOTPSlot = React.forwardRef<\r\n React.ElementRef<\"div\">,\r\n React.ComponentPropsWithoutRef<\"div\"> & { index: number }\r\n>(({ index, className, ...props }, ref) => {\r\n const inputOTPContext = React.useContext(OTPInputContext);\r\n const size = React.useContext(InputOTPSizeContext);\r\n const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];\r\n\r\n return (\r\n <div\r\n ref={ref}\r\n className={cn(\r\n \"relative flex shrink-0 items-center justify-center border-y border-r border-input bg-background text-foreground transition-colors duration-interactive ease-out-strong motion-reduce:transition-none first:rounded-l-control-lg first:border-l last:rounded-r-control-lg\",\r\n isActive && \"z-10 bg-muted\",\r\n size === 'md' && 'h-form-control min-h-form-control max-h-form-control w-form-control text-base',\r\n size === 'lg' && 'h-16 min-h-16 max-h-16 w-16 text-2xl',\r\n size === 'xl' && 'h-20 min-h-20 max-h-20 w-20 text-3xl',\r\n className,\r\n )}\r\n {...props}\r\n >\r\n {char}\r\n {hasFakeCaret && (\r\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\r\n <div className=\"h-4 w-px animate-caret-blink bg-foreground duration-1000\" />\r\n </div>\r\n )}\r\n </div>\r\n );\r\n});\r\nInputOTPSlot.displayName = \"InputOTPSlot\";\r\n\r\nconst InputOTPSeparator = React.forwardRef<\r\n React.ElementRef<\"div\">,\r\n React.ComponentPropsWithoutRef<\"div\">\r\n>(({ ...props }, ref) => (\r\n <div ref={ref} role=\"separator\" {...props}>\r\n <Dot />\r\n </div>\r\n));\r\nInputOTPSeparator.displayName = \"InputOTPSeparator\";\r\n\r\nexport { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };\r\n"],"names":[],"mappings":";;;;;;;AAUA;AAEA;AAcA;AAEA;AAQA;AAEA;;;AAME;;AAuBF;AACA;AAEA;AAQA;;"}
1
+ {"version":3,"file":"input-otp.js","sources":["../../src/components/input-otp.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { OTPInput, OTPInputContext } from \"input-otp\";\nimport { Dot } from \"lucide-react\";\n\nimport { cn } from \"@/utils\";\n\nexport type InputOTPSize = 'md' | 'lg' | 'xl';\n\nconst InputOTPSizeContext = React.createContext<InputOTPSize>('md');\n\nconst InputOTP = React.forwardRef<\n React.ElementRef<typeof OTPInput>,\n React.ComponentPropsWithoutRef<typeof OTPInput>\n>(({ className, containerClassName, ...props }, ref) => (\n <OTPInput\n ref={ref}\n containerClassName={cn(\n \"flex items-center gap-2 has-[:disabled]:opacity-50\",\n containerClassName,\n )}\n className={cn(\"disabled:cursor-not-allowed\", className)}\n {...props}\n />\n));\nInputOTP.displayName = \"InputOTP\";\n\nconst InputOTPGroup = React.forwardRef<\n React.ElementRef<\"div\">,\n React.ComponentPropsWithoutRef<\"div\"> & { size?: InputOTPSize }\n>(({ className, size = 'md', ...props }, ref) => (\n <InputOTPSizeContext.Provider value={size}>\n <div ref={ref} className={cn(\"flex items-center\", className)} {...props} />\n </InputOTPSizeContext.Provider>\n));\nInputOTPGroup.displayName = \"InputOTPGroup\";\n\nconst InputOTPSlot = React.forwardRef<\n React.ElementRef<\"div\">,\n React.ComponentPropsWithoutRef<\"div\"> & { index: number }\n>(({ index, className, ...props }, ref) => {\n const inputOTPContext = React.useContext(OTPInputContext);\n const size = React.useContext(InputOTPSizeContext);\n const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];\n\n return (\n <div\n ref={ref}\n className={cn(\n \"relative flex shrink-0 items-center justify-center border-y border-r border-input bg-background text-foreground transition-colors duration-interactive ease-out-strong motion-reduce:transition-none first:rounded-l-control-lg first:border-l last:rounded-r-control-lg\",\n isActive && \"z-10 bg-muted\",\n size === 'md' && 'h-form-control min-h-form-control max-h-form-control w-form-control text-base',\n size === 'lg' && 'h-16 min-h-16 max-h-16 w-16 text-2xl',\n size === 'xl' && 'h-20 min-h-20 max-h-20 w-20 text-3xl',\n className,\n )}\n {...props}\n >\n {char}\n {hasFakeCaret && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div className=\"h-4 w-px animate-caret-blink bg-foreground duration-1000\" />\n </div>\n )}\n </div>\n );\n});\nInputOTPSlot.displayName = \"InputOTPSlot\";\n\nconst InputOTPSeparator = React.forwardRef<\n React.ElementRef<\"div\">,\n React.ComponentPropsWithoutRef<\"div\">\n>(({ ...props }, ref) => (\n <div ref={ref} role=\"separator\" {...props}>\n <Dot />\n </div>\n));\nInputOTPSeparator.displayName = \"InputOTPSeparator\";\n\nexport { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };\n"],"names":[],"mappings":";;;;;;;AAUA;AAEA;AAcA;AAEA;AAQA;AAEA;;;AAME;;AAuBF;AACA;AAEA;AAQA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","sources":["../../src/components/input.tsx"],"sourcesContent":["'use client';\r\n\r\nimport * as React from 'react';\r\nimport { Eye, EyeOff } from 'lucide-react';\r\n\r\nimport { cn } from '@/utils';\r\nimport {\r\n chain,\r\n fieldFocusOutlineClassName,\r\n fieldInteractionClassName,\r\n useFieldChromeOwned,\r\n useFieldFocus,\r\n} from '@/hooks/use-field-focus';\r\n\r\nconst fieldClassName =\r\n 'bg-background pointer-events-auto relative z-10 box-border flex h-form-control min-h-form-control max-h-form-control w-full rounded-control-lg border border-input hover:border-input-hover px-[0.75em] py-0 text-base text-foreground ring-0';\r\nconst fieldDetailsClassName =\r\n 'file:text-foreground placeholder:text-muted-foreground/40 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none aria-invalid:border-destructive disabled:cursor-not-allowed disabled:opacity-50';\r\n\r\nconst Input = React.forwardRef<HTMLInputElement, React.ComponentProps<'input'>>(\r\n ({ className, type, disabled, onPointerDown, onFocus, onBlur, ...props }, ref) => {\r\n const [passwordVisible, setPasswordVisible] = React.useState(false);\r\n const chromeOwned = useFieldChromeOwned();\r\n const { keyboardFocus, focusProps } = useFieldFocus();\r\n const handlers = {\r\n onPointerDown: chain(onPointerDown, focusProps.onPointerDown),\r\n onFocus: chain(onFocus, focusProps.onFocus),\r\n onBlur: chain(onBlur, focusProps.onBlur),\r\n };\r\n const chrome = !chromeOwned && !disabled && cn(\r\n fieldInteractionClassName,\r\n keyboardFocus && fieldFocusOutlineClassName,\r\n );\r\n\r\n if (type === 'password') {\r\n const Icon = passwordVisible ? EyeOff : Eye;\r\n\r\n return (\r\n // The wrapper carries the lift and outline so the toggle moves with the field.\r\n <div className={cn('relative', chrome)}>\r\n <input\r\n type={passwordVisible ? 'text' : 'password'}\r\n className={cn(fieldClassName, 'pr-10', fieldDetailsClassName, className)}\r\n ref={ref}\r\n disabled={disabled}\r\n {...handlers}\r\n {...props}\r\n />\r\n <button\r\n type=\"button\"\r\n className=\"text-muted-foreground hover:text-foreground absolute inset-y-0 right-0 z-20 flex w-10 items-center justify-center disabled:cursor-not-allowed disabled:opacity-50\"\r\n onClick={() => setPasswordVisible((current) => !current)}\r\n disabled={disabled}\r\n aria-label={passwordVisible ? 'Hide password' : 'Show password'}\r\n aria-pressed={passwordVisible}\r\n >\r\n <Icon className=\"h-4 w-4\" aria-hidden=\"true\" />\r\n </button>\r\n </div>\r\n );\r\n }\r\n\r\n return (\r\n <input\r\n type={type}\r\n className={cn(fieldClassName, fieldDetailsClassName, chrome, className)}\r\n ref={ref}\r\n disabled={disabled}\r\n {...handlers}\r\n {...props}\r\n />\r\n );\r\n },\r\n);\r\nInput.displayName = 'Input';\r\n\r\nexport { Input };\r\n"],"names":[],"mappings":";;;;;;;AAcA;AAEA;AAGA;AAEI;AACA;;AAEA;;;;;AAKA;AAKA;;;;;;AA4BA;AAUF;AAEF;;"}
1
+ {"version":3,"file":"input.js","sources":["../../src/components/input.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Eye, EyeOff } from 'lucide-react';\n\nimport { cn } from '@/utils';\nimport {\n chain,\n fieldFocusOutlineClassName,\n fieldInteractionClassName,\n useFieldChromeOwned,\n useFieldFocus,\n} from '@/hooks/use-field-focus';\n\nconst fieldClassName =\n 'bg-background pointer-events-auto relative z-10 box-border flex h-form-control min-h-form-control max-h-form-control w-full rounded-control-lg border border-input hover:border-input-hover px-[0.75em] py-0 text-base text-foreground ring-0';\nconst fieldDetailsClassName =\n 'file:text-foreground placeholder:text-muted-foreground/40 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none aria-invalid:border-destructive disabled:cursor-not-allowed disabled:opacity-50';\n\nconst Input = React.forwardRef<HTMLInputElement, React.ComponentProps<'input'>>(\n ({ className, type, disabled, onPointerDown, onFocus, onBlur, ...props }, ref) => {\n const [passwordVisible, setPasswordVisible] = React.useState(false);\n const chromeOwned = useFieldChromeOwned();\n const { keyboardFocus, focusProps } = useFieldFocus();\n const handlers = {\n onPointerDown: chain(onPointerDown, focusProps.onPointerDown),\n onFocus: chain(onFocus, focusProps.onFocus),\n onBlur: chain(onBlur, focusProps.onBlur),\n };\n const chrome = !chromeOwned && !disabled && cn(\n fieldInteractionClassName,\n keyboardFocus && fieldFocusOutlineClassName,\n );\n\n if (type === 'password') {\n const Icon = passwordVisible ? EyeOff : Eye;\n\n return (\n // The wrapper carries the lift and outline so the toggle moves with the field.\n <div className={cn('relative', chrome)}>\n <input\n type={passwordVisible ? 'text' : 'password'}\n className={cn(fieldClassName, 'pr-10', fieldDetailsClassName, className)}\n ref={ref}\n disabled={disabled}\n {...handlers}\n {...props}\n />\n <button\n type=\"button\"\n className=\"text-muted-foreground hover:text-foreground absolute inset-y-0 right-0 z-20 flex w-10 items-center justify-center disabled:cursor-not-allowed disabled:opacity-50\"\n onClick={() => setPasswordVisible((current) => !current)}\n disabled={disabled}\n aria-label={passwordVisible ? 'Hide password' : 'Show password'}\n aria-pressed={passwordVisible}\n >\n <Icon className=\"h-4 w-4\" aria-hidden=\"true\" />\n </button>\n </div>\n );\n }\n\n return (\n <input\n type={type}\n className={cn(fieldClassName, fieldDetailsClassName, chrome, className)}\n ref={ref}\n disabled={disabled}\n {...handlers}\n {...props}\n />\n );\n },\n);\nInput.displayName = 'Input';\n\nexport { Input };\n"],"names":[],"mappings":";;;;;;;AAcA;AAEA;AAGA;AAEI;AACA;;AAEA;;;;;AAKA;AAKA;;;;;;AA4BA;AAUF;AAEF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"label.js","sources":["../../src/components/label.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport { MessageCircleQuestion } from 'lucide-react';\r\n\r\nimport { cn } from '@/utils';\r\nimport {\r\n Tooltip,\r\n TooltipContent,\r\n TooltipTrigger,\r\n} from '@/components/tooltip';\r\n\r\nexport interface LabelProps {\r\n label: React.ReactNode;\r\n required?: boolean;\r\n tooltip?: string;\r\n /** Kept so existing callers still type-check; the Radix tooltip needs no id. */\r\n tooltipId?: string;\r\n labelAddon?: React.ReactNode;\r\n labelProps?: React.ComponentPropsWithRef<'label'>;\r\n className?: string;\r\n}\r\n\r\n/** Shared label typography with native label association and ref support. */\r\nexport const FieldLabel = React.forwardRef<HTMLLabelElement, React.ComponentPropsWithoutRef<'label'>>(\r\n ({ className, ...props }, ref) => (\r\n <label\r\n ref={ref}\r\n className={cn('text-field-label font-field-label text-[color:var(--color-field-label)]', className)}\r\n {...props}\r\n />\r\n ),\r\n);\r\nFieldLabel.displayName = 'FieldLabel';\r\n\r\n/** The label row shared by every form field: label, help tooltip, addon. */\r\nexport function Label({\r\n label,\r\n required,\r\n tooltip,\r\n labelAddon,\r\n labelProps,\r\n className,\r\n}: LabelProps) {\r\n const hasTooltip = !!tooltip?.trim();\r\n\r\n return (\r\n <div className={cn('mb-field-label-gap flex w-full justify-between gap-2 md:items-center', className)}>\r\n <div className=\"flex gap-2 md:items-center\">\r\n <FieldLabel {...labelProps}>\r\n {label} {required && <span className=\"text-destructive\">*</span>}\r\n </FieldLabel>\r\n {hasTooltip ? (\r\n <Tooltip>\r\n <TooltipTrigger asChild>\r\n <button\r\n type=\"button\"\r\n aria-label=\"More information\"\r\n className=\"hover:cursor-help\"\r\n >\r\n <MessageCircleQuestion className=\"text-primary h-3.5 w-3.5\" />\r\n </button>\r\n </TooltipTrigger>\r\n <TooltipContent side=\"bottom\" className=\"z-(--z-tooltip) max-w-[80vw]\">\r\n {tooltip}\r\n </TooltipContent>\r\n </Tooltip>\r\n ) : (\r\n // Reserves the icon's space so labels line up with or without help.\r\n <div aria-hidden=\"true\">\r\n <MessageCircleQuestion className={cn('invisible h-3.5 w-3.5')} />\r\n </div>\r\n )}\r\n </div>\r\n {labelAddon && <div>{labelAddon}</div>}\r\n </div>\r\n );\r\n}\r\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;AAqBA;AACO,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CACxC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAC3BA,eACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,yEAAyE,EAAE,SAAS,CAAC,EAAA,GAC/F,KAAK,EAAA,CACT,CACH;AAEH,UAAU,CAAC,WAAW,GAAG,YAAY;AAErC;AACM,SAAU,KAAK,CAAC,EACpB,KAAK,EACL,QAAQ,EACR,OAAO,EACP,UAAU,EACV,UAAU,EACV,SAAS,GACE,EAAA;IACX,MAAM,UAAU,GAAG,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE;AAEpC,IAAA,QACEC,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,EAAE,CAAC,sEAAsE,EAAE,SAAS,CAAC,aACnGA,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,4BAA4B,EAAA,QAAA,EAAA,CACzCA,KAAC,UAAU,EAAA,EAAA,GAAK,UAAU,EAAA,QAAA,EAAA,CACvB,KAAK,EAAA,GAAA,EAAG,QAAQ,IAAID,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,kBAAkB,EAAA,QAAA,EAAA,GAAA,EAAA,CAAS,CAAA,EAAA,CACrD,EACZ,UAAU,IACTC,IAAA,CAAC,OAAO,EAAA,EAAA,QAAA,EAAA,CACND,GAAA,CAAC,cAAc,EAAA,EAAC,OAAO,EAAA,IAAA,EAAA,QAAA,EACrBA,GAAA,CAAA,QAAA,EAAA,EACE,IAAI,EAAC,QAAQ,gBACF,kBAAkB,EAC7B,SAAS,EAAC,mBAAmB,EAAA,QAAA,EAE7BA,GAAA,CAAC,qBAAqB,EAAA,EAAC,SAAS,EAAC,0BAA0B,EAAA,CAAG,EAAA,CACvD,EAAA,CACM,EACjBA,GAAA,CAAC,cAAc,IAAC,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,8BAA8B,YACnE,OAAO,EAAA,CACO,IACT;;oBAGVA,GAAA,CAAA,KAAA,EAAA,EAAA,aAAA,EAAiB,MAAM,YACrBA,GAAA,CAAC,qBAAqB,IAAC,SAAS,EAAE,EAAE,CAAC,uBAAuB,CAAC,GAAI,EAAA,CAC7D,CACP,CAAA,EAAA,CACG,EACL,UAAU,IAAIA,uBAAM,UAAU,EAAA,CAAO,CAAA,EAAA,CAClC;AAEV;;;;"}
1
+ {"version":3,"file":"label.js","sources":["../../src/components/label.tsx"],"sourcesContent":["import * as React from 'react';\nimport { MessageCircleQuestion } from 'lucide-react';\n\nimport { cn } from '@/utils';\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from '@/components/tooltip';\n\nexport interface LabelProps {\n label: React.ReactNode;\n required?: boolean;\n tooltip?: string;\n /** Kept so existing callers still type-check; the Radix tooltip needs no id. */\n tooltipId?: string;\n labelAddon?: React.ReactNode;\n labelProps?: React.ComponentPropsWithRef<'label'>;\n className?: string;\n}\n\n/** Shared label typography with native label association and ref support. */\nexport const FieldLabel = React.forwardRef<HTMLLabelElement, React.ComponentPropsWithoutRef<'label'>>(\n ({ className, ...props }, ref) => (\n <label\n ref={ref}\n className={cn('text-field-label font-field-label text-[color:var(--color-field-label)]', className)}\n {...props}\n />\n ),\n);\nFieldLabel.displayName = 'FieldLabel';\n\n/** The label row shared by every form field: label, help tooltip, addon. */\nexport function Label({\n label,\n required,\n tooltip,\n labelAddon,\n labelProps,\n className,\n}: LabelProps) {\n const hasTooltip = !!tooltip?.trim();\n\n return (\n <div className={cn('mb-field-label-gap flex w-full justify-between gap-2 md:items-center', className)}>\n <div className=\"flex gap-2 md:items-center\">\n <FieldLabel {...labelProps}>\n {label} {required && <span className=\"text-destructive\">*</span>}\n </FieldLabel>\n {hasTooltip ? (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n aria-label=\"More information\"\n className=\"hover:cursor-help\"\n >\n <MessageCircleQuestion className=\"text-primary h-3.5 w-3.5\" />\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"bottom\" className=\"z-(--z-tooltip) max-w-[80vw]\">\n {tooltip}\n </TooltipContent>\n </Tooltip>\n ) : (\n // Reserves the icon's space so labels line up with or without help.\n <div aria-hidden=\"true\">\n <MessageCircleQuestion className={cn('invisible h-3.5 w-3.5')} />\n </div>\n )}\n </div>\n {labelAddon && <div>{labelAddon}</div>}\n </div>\n );\n}\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;AAqBA;AACO,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CACxC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAC3BA,eACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,yEAAyE,EAAE,SAAS,CAAC,EAAA,GAC/F,KAAK,EAAA,CACT,CACH;AAEH,UAAU,CAAC,WAAW,GAAG,YAAY;AAErC;AACM,SAAU,KAAK,CAAC,EACpB,KAAK,EACL,QAAQ,EACR,OAAO,EACP,UAAU,EACV,UAAU,EACV,SAAS,GACE,EAAA;IACX,MAAM,UAAU,GAAG,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE;AAEpC,IAAA,QACEC,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,EAAE,CAAC,sEAAsE,EAAE,SAAS,CAAC,aACnGA,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,4BAA4B,EAAA,QAAA,EAAA,CACzCA,KAAC,UAAU,EAAA,EAAA,GAAK,UAAU,EAAA,QAAA,EAAA,CACvB,KAAK,EAAA,GAAA,EAAG,QAAQ,IAAID,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,kBAAkB,EAAA,QAAA,EAAA,GAAA,EAAA,CAAS,CAAA,EAAA,CACrD,EACZ,UAAU,IACTC,IAAA,CAAC,OAAO,EAAA,EAAA,QAAA,EAAA,CACND,GAAA,CAAC,cAAc,EAAA,EAAC,OAAO,EAAA,IAAA,EAAA,QAAA,EACrBA,GAAA,CAAA,QAAA,EAAA,EACE,IAAI,EAAC,QAAQ,gBACF,kBAAkB,EAC7B,SAAS,EAAC,mBAAmB,EAAA,QAAA,EAE7BA,GAAA,CAAC,qBAAqB,EAAA,EAAC,SAAS,EAAC,0BAA0B,EAAA,CAAG,EAAA,CACvD,EAAA,CACM,EACjBA,GAAA,CAAC,cAAc,IAAC,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,8BAA8B,YACnE,OAAO,EAAA,CACO,IACT;;oBAGVA,GAAA,CAAA,KAAA,EAAA,EAAA,aAAA,EAAiB,MAAM,YACrBA,GAAA,CAAC,qBAAqB,IAAC,SAAS,EAAE,EAAE,CAAC,uBAAuB,CAAC,GAAI,EAAA,CAC7D,CACP,CAAA,EAAA,CACG,EACL,UAAU,IAAIA,uBAAM,UAAU,EAAA,CAAO,CAAA,EAAA,CAClC;AAEV;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"loader.js","sources":["../../src/components/loader.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\r\nimport { cn } from '@/utils';\r\n\r\nconst sizes = { sm: 'size-4', md: 'size-6', lg: 'size-10' } as const;\r\n\r\nexport type SpinnerProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children'> & {\r\n size?: keyof typeof sizes;\r\n label?: string;\r\n decorative?: boolean;\r\n};\r\n\r\nexport function Spinner({ size = 'sm', label = 'Loading', decorative = false, className, ...props }: SpinnerProps) {\r\n return <span {...props} role={decorative ? undefined : 'status'} aria-hidden={decorative || undefined} className={cn('inline-flex shrink-0 items-center justify-center text-current', className)}>\r\n <span aria-hidden=\"true\" className={cn('block shrink-0 rounded-full border-2 border-current border-r-transparent motion-safe:animate-spin', sizes[size])} />\r\n {!decorative && <span className=\"sr-only\">{label}</span>}\r\n </span>;\r\n}\r\n\r\nexport type LoaderProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {\r\n children?: ReactNode;\r\n label?: string;\r\n size?: SpinnerProps['size'];\r\n};\r\n\r\n/** Centered loading content; the parent owns height and padding. */\r\nexport function Loader({ children, label = 'Loading', size = 'lg', className, ...props }: LoaderProps) {\r\n return <div {...props} role=\"status\" className={cn('flex w-full flex-col items-center justify-center gap-4 text-center text-primary', className)}>\r\n <Spinner size={size} decorative />\r\n {children ? <div className=\"text-sm text-muted-foreground\">{children}</div> : <span className=\"sr-only\">{label}</span>}\r\n </div>;\r\n}\r\n"],"names":["_jsxs","_jsx"],"mappings":";;;AAGA,MAAM,KAAK,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAW;AAQ9D,SAAU,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,KAAK,GAAG,SAAS,EAAE,UAAU,GAAG,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,EAAgB,EAAA;IAC/G,OAAOA,IAAA,CAAA,MAAA,EAAA,EAAA,GAAU,KAAK,EAAE,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,EAAA,aAAA,EAAe,UAAU,IAAI,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,+DAA+D,EAAE,SAAS,CAAC,aAC9LC,GAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EAAkB,MAAM,EAAC,SAAS,EAAE,EAAE,CAAC,mGAAmG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,GAAI,EAC3J,CAAC,UAAU,IAAIA,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,SAAS,EAAA,QAAA,EAAE,KAAK,EAAA,CAAQ,CAAA,EAAA,CACnD;AACT;AAQA;SACgB,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,GAAG,SAAS,EAAE,IAAI,GAAG,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,EAAe,EAAA;IACnG,OAAOD,IAAA,CAAA,KAAA,EAAA,EAAA,GAAS,KAAK,EAAE,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAE,EAAE,CAAC,iFAAiF,EAAE,SAAS,CAAC,EAAA,QAAA,EAAA,CAC9IC,GAAA,CAAC,OAAO,EAAA,EAAC,IAAI,EAAE,IAAI,EAAE,UAAU,SAAG,EACjC,QAAQ,GAAGA,aAAK,SAAS,EAAC,+BAA+B,EAAA,QAAA,EAAE,QAAQ,EAAA,CAAO,GAAGA,cAAM,SAAS,EAAC,SAAS,EAAA,QAAA,EAAE,KAAK,EAAA,CAAQ,CAAA,EAAA,CAClH;AACR;;;;"}
1
+ {"version":3,"file":"loader.js","sources":["../../src/components/loader.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\nimport { cn } from '@/utils';\n\nconst sizes = { sm: 'size-4', md: 'size-6', lg: 'size-10' } as const;\n\nexport type SpinnerProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children'> & {\n size?: keyof typeof sizes;\n label?: string;\n decorative?: boolean;\n};\n\nexport function Spinner({ size = 'sm', label = 'Loading', decorative = false, className, ...props }: SpinnerProps) {\n return <span {...props} role={decorative ? undefined : 'status'} aria-hidden={decorative || undefined} className={cn('inline-flex shrink-0 items-center justify-center text-current', className)}>\n <span aria-hidden=\"true\" className={cn('block shrink-0 rounded-full border-2 border-current border-r-transparent motion-safe:animate-spin', sizes[size])} />\n {!decorative && <span className=\"sr-only\">{label}</span>}\n </span>;\n}\n\nexport type LoaderProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {\n children?: ReactNode;\n label?: string;\n size?: SpinnerProps['size'];\n};\n\n/** Centered loading content; the parent owns height and padding. */\nexport function Loader({ children, label = 'Loading', size = 'lg', className, ...props }: LoaderProps) {\n return <div {...props} role=\"status\" className={cn('flex w-full flex-col items-center justify-center gap-4 text-center text-primary', className)}>\n <Spinner size={size} decorative />\n {children ? <div className=\"text-sm text-muted-foreground\">{children}</div> : <span className=\"sr-only\">{label}</span>}\n </div>;\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;AAGA,MAAM,KAAK,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAW;AAQ9D,SAAU,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,KAAK,GAAG,SAAS,EAAE,UAAU,GAAG,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,EAAgB,EAAA;IAC/G,OAAOA,IAAA,CAAA,MAAA,EAAA,EAAA,GAAU,KAAK,EAAE,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,EAAA,aAAA,EAAe,UAAU,IAAI,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,+DAA+D,EAAE,SAAS,CAAC,aAC9LC,GAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EAAkB,MAAM,EAAC,SAAS,EAAE,EAAE,CAAC,mGAAmG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,GAAI,EAC3J,CAAC,UAAU,IAAIA,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,SAAS,EAAA,QAAA,EAAE,KAAK,EAAA,CAAQ,CAAA,EAAA,CACnD;AACT;AAQA;SACgB,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,GAAG,SAAS,EAAE,IAAI,GAAG,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,EAAe,EAAA;IACnG,OAAOD,IAAA,CAAA,KAAA,EAAA,EAAA,GAAS,KAAK,EAAE,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAE,EAAE,CAAC,iFAAiF,EAAE,SAAS,CAAC,EAAA,QAAA,EAAA,CAC9IC,GAAA,CAAC,OAAO,EAAA,EAAC,IAAI,EAAE,IAAI,EAAE,UAAU,SAAG,EACjC,QAAQ,GAAGA,aAAK,SAAS,EAAC,+BAA+B,EAAA,QAAA,EAAE,QAAQ,EAAA,CAAO,GAAGA,cAAM,SAAS,EAAC,SAAS,EAAA,QAAA,EAAE,KAAK,EAAA,CAAQ,CAAA,EAAA,CAClH;AACR;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"magnetic-button.js","sources":["../../src/components/magnetic-button.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { useReducedMotion, motion } from \"framer-motion\";\r\nimport { useRef, useState } from \"react\";\r\n\r\nexport default function MagneticButton({\r\n children,\r\n className = \"\",\r\n asChild = false,\r\n}: {\r\n children: React.ReactNode;\r\n className?: string;\r\n asChild?: boolean;\r\n}) {\r\n const prefersReduce = useReducedMotion();\r\n const ref = useRef<HTMLDivElement>(null);\r\n const [tx, setTx] = useState(0);\r\n const [ty, setTy] = useState(0);\r\n\r\n const max = 6; // px\r\n function onMove(e: React.MouseEvent) {\r\n if (prefersReduce) return;\r\n const el = ref.current;\r\n if (!el) return;\r\n const r = el.getBoundingClientRect();\r\n const x = (e.clientX - r.left) / r.width - 0.5;\r\n const y = (e.clientY - r.top) / r.height - 0.5;\r\n setTx(x * max * 2);\r\n setTy(y * max * 2);\r\n }\r\n function onLeave() {\r\n setTx(0);\r\n setTy(0);\r\n }\r\n\r\n return (\r\n <motion.div\r\n ref={ref}\r\n onMouseMove={onMove}\r\n onMouseLeave={onLeave}\r\n animate={{ x: tx, y: ty, rotate: tx * 0.3 }}\r\n transition={{ type: \"spring\", stiffness: 200, damping: 15, mass: 0.3 }}\r\n className={className}\r\n >\r\n {children}\r\n </motion.div>\r\n );\r\n}\r\n"],"names":[],"mappings":";;;;;AAKc;AASZ;AACA;;;AAIA;;AAEE;;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;;AAEF;;;;AAKA;AAYF;;"}
1
+ {"version":3,"file":"magnetic-button.js","sources":["../../src/components/magnetic-button.tsx"],"sourcesContent":["'use client';\n\nimport { useReducedMotion, motion } from \"framer-motion\";\nimport { useRef, useState } from \"react\";\n\nexport default function MagneticButton({\n children,\n className = \"\",\n asChild = false,\n}: {\n children: React.ReactNode;\n className?: string;\n asChild?: boolean;\n}) {\n const prefersReduce = useReducedMotion();\n const ref = useRef<HTMLDivElement>(null);\n const [tx, setTx] = useState(0);\n const [ty, setTy] = useState(0);\n\n const max = 6; // px\n function onMove(e: React.MouseEvent) {\n if (prefersReduce) return;\n const el = ref.current;\n if (!el) return;\n const r = el.getBoundingClientRect();\n const x = (e.clientX - r.left) / r.width - 0.5;\n const y = (e.clientY - r.top) / r.height - 0.5;\n setTx(x * max * 2);\n setTy(y * max * 2);\n }\n function onLeave() {\n setTx(0);\n setTy(0);\n }\n\n return (\n <motion.div\n ref={ref}\n onMouseMove={onMove}\n onMouseLeave={onLeave}\n animate={{ x: tx, y: ty, rotate: tx * 0.3 }}\n transition={{ type: \"spring\", stiffness: 200, damping: 15, mass: 0.3 }}\n className={className}\n >\n {children}\n </motion.div>\n );\n}\n"],"names":[],"mappings":";;;;;AAKc;AASZ;AACA;;;AAIA;;AAEE;;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;;AAEF;;;;AAKA;AAYF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"messages.js","sources":["../../src/components/messages.tsx"],"sourcesContent":["import { Card } from \"./card\";\r\n\r\nexport const Message = ({\r\n message,\r\n them,\r\n self,\r\n prevSelf,\r\n}: {\r\n message: string;\r\n them: string;\r\n self: boolean;\r\n prevSelf: boolean;\r\n}) => {\r\n return !self ? (\r\n <div className=\"flex flex-col max-w-[80%]\">\r\n {prevSelf && (\r\n <div className=\"text-xs pl-1 pb-1 text-muted-foreground\">{them}</div>\r\n )}\r\n <Card className=\"py-2 px-4 break-all text-sm w-fit\">\r\n {message}\r\n </Card>\r\n </div>\r\n ) : (\r\n <div className=\"flex flex-col items-end max-w-[80%] ml-auto\">\r\n {!prevSelf && (\r\n <div className=\"text-right text-xs pr-1 pb-1 text-muted-foreground\">You</div>\r\n )}\r\n <Card className=\"py-2 px-4 text-sm break-all bg-primary text-white text-wrap\">\r\n {message}\r\n </Card>\r\n </div>\r\n );\r\n};\r\n"],"names":["_jsxs","_jsx"],"mappings":";;;AAEO,MAAM,OAAO,GAAG,CAAC,EACtB,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,QAAQ,GAMT,KAAI;AACH,IAAA,OAAO,CAAC,IAAI,IACVA,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,2BAA2B,EAAA,QAAA,EAAA,CACvC,QAAQ,KACPC,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,yCAAyC,EAAA,QAAA,EAAE,IAAI,EAAA,CAAO,CACtE,EACDA,GAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,mCAAmC,YAChD,OAAO,EAAA,CACH,CAAA,EAAA,CACH,KAEND,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,6CAA6C,EAAA,QAAA,EAAA,CACzD,CAAC,QAAQ,KACRC,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,oDAAoD,EAAA,QAAA,EAAA,KAAA,EAAA,CAAU,CAC9E,EACDA,GAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,6DAA6D,EAAA,QAAA,EAC1E,OAAO,EAAA,CACH,CAAA,EAAA,CACH,CACP;AACH;;;;"}
1
+ {"version":3,"file":"messages.js","sources":["../../src/components/messages.tsx"],"sourcesContent":["import { Card } from \"./card\";\n\nexport const Message = ({\n message,\n them,\n self,\n prevSelf,\n}: {\n message: string;\n them: string;\n self: boolean;\n prevSelf: boolean;\n}) => {\n return !self ? (\n <div className=\"flex flex-col max-w-[80%]\">\n {prevSelf && (\n <div className=\"text-xs pl-1 pb-1 text-muted-foreground\">{them}</div>\n )}\n <Card className=\"py-2 px-4 break-all text-sm w-fit\">\n {message}\n </Card>\n </div>\n ) : (\n <div className=\"flex flex-col items-end max-w-[80%] ml-auto\">\n {!prevSelf && (\n <div className=\"text-right text-xs pr-1 pb-1 text-muted-foreground\">You</div>\n )}\n <Card className=\"py-2 px-4 text-sm break-all bg-primary text-white text-wrap\">\n {message}\n </Card>\n </div>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;AAEO,MAAM,OAAO,GAAG,CAAC,EACtB,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,QAAQ,GAMT,KAAI;AACH,IAAA,OAAO,CAAC,IAAI,IACVA,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,2BAA2B,EAAA,QAAA,EAAA,CACvC,QAAQ,KACPC,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,yCAAyC,EAAA,QAAA,EAAE,IAAI,EAAA,CAAO,CACtE,EACDA,GAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,mCAAmC,YAChD,OAAO,EAAA,CACH,CAAA,EAAA,CACH,KAEND,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,6CAA6C,EAAA,QAAA,EAAA,CACzD,CAAC,QAAQ,KACRC,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,oDAAoD,EAAA,QAAA,EAAA,KAAA,EAAA,CAAU,CAC9E,EACDA,GAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,6DAA6D,EAAA,QAAA,EAC1E,OAAO,EAAA,CACH,CAAA,EAAA,CACH,CACP;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"mobile-sheet-portal.js","sources":["../../src/components/mobile-sheet-portal.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport { createPortal } from \"react-dom\";\r\n\r\n/**\r\n * Renders a mobile selection sheet at the end of the document so accordions\r\n * and animated panels can't clip it. Interactions inside are kept from reaching\r\n * the document's outside-click handlers, which would otherwise close it.\r\n */\r\nexport function MobileSheetPortal({\r\n enabled,\r\n children,\r\n}: {\r\n enabled: boolean;\r\n children: React.ReactNode;\r\n}) {\r\n if (!enabled) return <>{children}</>;\r\n\r\n return createPortal(\r\n <div\r\n onClick={(event) => event.stopPropagation()}\r\n onTouchStart={(event) => event.stopPropagation()}\r\n >\r\n {children}\r\n </div>,\r\n document.body,\r\n );\r\n}\r\n"],"names":[],"mappings":";;;;AAIA;;;;AAIG;;AAQD;;AAEA;AASF;;"}
1
+ {"version":3,"file":"mobile-sheet-portal.js","sources":["../../src/components/mobile-sheet-portal.tsx"],"sourcesContent":["\"use client\";\n\nimport { createPortal } from \"react-dom\";\n\n/**\n * Renders a mobile selection sheet at the end of the document so accordions\n * and animated panels can't clip it. Interactions inside are kept from reaching\n * the document's outside-click handlers, which would otherwise close it.\n */\nexport function MobileSheetPortal({\n enabled,\n children,\n}: {\n enabled: boolean;\n children: React.ReactNode;\n}) {\n if (!enabled) return <>{children}</>;\n\n return createPortal(\n <div\n onClick={(event) => event.stopPropagation()}\n onTouchStart={(event) => event.stopPropagation()}\n >\n {children}\n </div>,\n document.body,\n );\n}\n"],"names":[],"mappings":";;;;AAIA;;;;AAIG;;AAQD;;AAEA;AASF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"option-list.js","sources":["../../src/components/option-list.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { ChevronDown, X } from \"lucide-react\";\r\n\r\nimport { cn } from \"@/utils\";\r\nimport { useMobile } from \"@/hooks/use-mobile\";\r\nimport { Button } from \"./button\";\r\nimport { Checkbox } from \"./checkbox\";\r\nimport { FilterChip } from \"./filter-chip\";\r\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\r\nimport { Sheet, SheetContent, SheetTitle } from \"./sheet\";\r\n\r\n/*\r\n * The shared look for every list of options (menus, selects, dropdowns,\r\n * autocomplete, filter menus): the list is inset from its container's edge,\r\n * and each row is its own rounded box with a little space between rows, so\r\n * hover and selection read as distinct pills rather than full-bleed stripes.\r\n */\r\n\r\n/** Padding + row gap for a list of options inside a popover or sheet. */\r\nexport const optionListClassName = \"flex flex-col gap-option-gap p-option-inset\";\r\n\r\n/** One option row. Pair with a hover/focus or selected state as needed. */\r\nexport const optionRowClassName =\r\n \"relative flex min-h-option-row w-full cursor-pointer select-none items-center gap-3 rounded-control-sm px-option-x py-2 text-left text-sm text-foreground outline-none transition-colors duration-state hover:bg-muted focus-visible:bg-muted motion-reduce:transition-none max-md:min-h-11\";\r\n\r\nexport type CheckboxListItem = {\r\n label: React.ReactNode;\r\n checked: boolean;\r\n onCheckedChange: (checked: boolean) => void;\r\n /** Indents the row under a group heading row. */\r\n indent?: boolean;\r\n /** Bolder label, e.g. a group's \"All …\" row. */\r\n strong?: boolean;\r\n disabled?: boolean;\r\n};\r\n\r\n/** A list of checkbox rows in the shared option style. */\r\nexport function CheckboxList({\r\n items,\r\n className,\r\n \"aria-label\": label,\r\n}: {\r\n items: CheckboxListItem[];\r\n className?: string;\r\n \"aria-label\"?: string;\r\n}) {\r\n return (\r\n <ul\r\n aria-label={label}\r\n className={cn(\"m-0 list-none\", optionListClassName, className)}\r\n >\r\n {items.map((item, index) => (\r\n <li key={index}>\r\n <label\r\n className={cn(\r\n optionRowClassName,\r\n item.indent && \"pl-8\",\r\n item.strong && \"font-medium\",\r\n item.disabled && \"pointer-events-none opacity-50\",\r\n )}\r\n >\r\n <Checkbox\r\n checked={item.checked}\r\n disabled={item.disabled}\r\n onCheckedChange={(checked) =>\r\n item.onCheckedChange(checked === true)\r\n }\r\n />\r\n <span className=\"min-w-0 flex-1\">{item.label}</span>\r\n </label>\r\n </li>\r\n ))}\r\n </ul>\r\n );\r\n}\r\n\r\nexport type FilterMenuOption = { label: React.ReactNode; value: string };\r\n\r\ntype FilterMenuCommon = {\r\n /** The chip's label (and the sheet title when it's text). */\r\n label?: React.ReactNode;\r\n /** Replaces the default chip, e.g. a labelled field button. */\r\n trigger?: React.ReactElement<React.HTMLAttributes<HTMLElement>>;\r\n /** Sheet title / list name when `label` isn't plain text. */\r\n title?: string;\r\n /** Shows a clear action (popover footer and sheet footer). */\r\n onClear?: () => void;\r\n clearLabel?: string;\r\n /**\r\n * How the popover's clear looks: a small link (default), or a quiet\r\n * full-width button with an ✕, e.g. to match a neighbouring picker.\r\n */\r\n clearVariant?: \"link\" | \"button\";\r\n size?: \"xs\" | \"sm\" | \"md\";\r\n align?: \"start\" | \"center\" | \"end\";\r\n className?: string;\r\n contentClassName?: string;\r\n};\r\n\r\n/** Simple filters: options in, selected values out. */\r\ntype FilterMenuOptionsProps = FilterMenuCommon & {\r\n options: FilterMenuOption[];\r\n /** The selected option values. */\r\n value: string[];\r\n onValueChange: (value: string[]) => void;\r\n items?: never;\r\n};\r\n\r\n/** Lists with their own rules (groups, indents): the rows themselves. */\r\ntype FilterMenuItemsProps = FilterMenuCommon & {\r\n items: CheckboxListItem[];\r\n options?: never;\r\n value?: never;\r\n onValueChange?: never;\r\n};\r\n\r\nexport type FilterMenuProps = FilterMenuOptionsProps | FilterMenuItemsProps;\r\n\r\n/**\r\n * A checklist behind a trigger: a dropdown on desktop and a bottom sheet\r\n * (with Clear and Done) on phones. Each tick applies immediately.\r\n *\r\n * Feed it either `options` + `value` + `onValueChange` (simple filters; the\r\n * default trigger is a FilterChip showing the count in the selected,\r\n * secondary style), or ready-made `items` with your own `trigger`.\r\n */\r\nexport function FilterMenu(props: FilterMenuProps) {\r\n const {\r\n label,\r\n trigger: customTrigger,\r\n title: titleProp,\r\n onClear,\r\n clearLabel = \"Clear\",\r\n clearVariant = \"link\",\r\n size = \"sm\",\r\n align = \"start\",\r\n className,\r\n contentClassName,\r\n } = props;\r\n const isMobile = useMobile();\r\n const [open, setOpen] = React.useState(false);\r\n const closeRef = React.useRef<HTMLButtonElement>(null);\r\n\r\n // Both ways in become the same rows.\r\n const items: CheckboxListItem[] =\r\n props.items ??\r\n props.options.map((option) => ({\r\n label: option.label,\r\n checked: props.value.includes(option.value),\r\n onCheckedChange: (on) =>\r\n props.onValueChange(\r\n on\r\n ? [...props.value, option.value]\r\n : props.value.filter((item) => item !== option.value),\r\n ),\r\n }));\r\n const count = props.items\r\n ? props.items.filter((item) => item.checked).length\r\n : props.value.length;\r\n const title = titleProp ?? (typeof label === \"string\" ? label : \"Filter\");\r\n // The sheet always offers Clear while something's on; the popover only\r\n // when the caller asks for it.\r\n const clearInSheet =\r\n onClear ??\r\n (!props.items && count > 0 ? () => props.onValueChange([]) : undefined);\r\n\r\n const triggerProps = {\r\n \"aria-haspopup\": \"dialog\" as const,\r\n \"aria-expanded\": open,\r\n onClick: isMobile ? () => setOpen(true) : undefined,\r\n };\r\n const trigger = customTrigger ? (\r\n React.cloneElement(customTrigger, {\r\n ...triggerProps,\r\n onClick: (event: React.MouseEvent<HTMLElement>) => {\r\n customTrigger.props.onClick?.(event);\r\n triggerProps.onClick?.();\r\n },\r\n })\r\n ) : (\r\n <FilterChip\r\n size={size}\r\n selected={count > 0}\r\n count={count || undefined}\r\n className={className}\r\n {...triggerProps}\r\n >\r\n {label}\r\n <ChevronDown size={14} aria-hidden=\"true\" className=\"-mr-1\" />\r\n </FilterChip>\r\n );\r\n\r\n const list = <CheckboxList aria-label={title} items={items} />;\r\n\r\n // Phones: a bottom sheet, like Autocomplete and Select.\r\n if (isMobile)\r\n return (\r\n <>\r\n {trigger}\r\n <Sheet open={open} onOpenChange={setOpen}>\r\n <SheetContent\r\n side=\"bottom\"\r\n showCloseButton={false}\r\n overlayClassName=\"z-(--z-popover-overlay) bg-black/25 backdrop-blur-[1px]\"\r\n aria-describedby={undefined}\r\n onOpenAutoFocus={(event) => {\r\n event.preventDefault();\r\n closeRef.current?.focus();\r\n }}\r\n className=\"z-(--z-popover) flex flex-col gap-0 p-0 pb-[max(0.75rem,env(safe-area-inset-bottom))]\"\r\n >\r\n <div className=\"flex shrink-0 items-center justify-between gap-4 px-4 pb-1 pt-4\">\r\n <SheetTitle className=\"text-base font-semibold text-foreground\">\r\n {title}\r\n </SheetTitle>\r\n <button\r\n ref={closeRef}\r\n type=\"button\"\r\n aria-label=\"Close\"\r\n className=\"-mr-3 flex h-11 w-11 shrink-0 cursor-pointer items-center justify-center rounded-control-lg text-muted-foreground hover:bg-muted\"\r\n onClick={() => setOpen(false)}\r\n >\r\n <X className=\"h-5 w-5\" aria-hidden=\"true\" />\r\n </button>\r\n </div>\r\n <div className=\"min-h-0 flex-1 overflow-y-auto overscroll-contain px-2\">\r\n {list}\r\n </div>\r\n <div className=\"flex shrink-0 gap-2 border-t border-border px-4 pt-3\">\r\n {clearInSheet && (\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n scheme=\"neutral\"\r\n className=\"flex-1\"\r\n onClick={clearInSheet}\r\n >\r\n {clearLabel}\r\n </Button>\r\n )}\r\n {/* Outline, like Autocomplete's: ticks already applied, so\r\n Done only closes the sheet. */}\r\n <Button\r\n type=\"button\"\r\n variant=\"outline\"\r\n className=\"flex-1\"\r\n onClick={() => setOpen(false)}\r\n >\r\n Done\r\n </Button>\r\n </div>\r\n </SheetContent>\r\n </Sheet>\r\n </>\r\n );\r\n\r\n return (\r\n <Popover open={open} onOpenChange={setOpen}>\r\n <PopoverTrigger asChild>{trigger}</PopoverTrigger>\r\n <PopoverContent\r\n align={align}\r\n className={cn(\"w-56 p-0\", contentClassName)}\r\n >\r\n {list}\r\n {onClear && (\r\n <div className=\"border-t border-border p-option-inset\">\r\n {clearVariant === \"button\" ? (\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n scheme=\"neutral\"\r\n size=\"sm\"\r\n className=\"w-full\"\r\n onClick={onClear}\r\n >\r\n <X size={16} aria-hidden=\"true\" />\r\n {clearLabel}\r\n </Button>\r\n ) : (\r\n <Button\r\n type=\"button\"\r\n variant=\"link\"\r\n scheme=\"primary\"\r\n size=\"xs\"\r\n onClick={onClear}\r\n >\r\n {clearLabel}\r\n </Button>\r\n )}\r\n </div>\r\n )}\r\n </PopoverContent>\r\n </Popover>\r\n );\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;;;;AAaA;;;;;AAKG;AAEH;AACO;AAEP;AACO;AAcP;AACM;;AAqCN;AA4CA;;;;;;;AAOG;AACG;AACJ;AAYA;AACA;;;AAIA;;;;;;AASU;AAEP;AACH;AACE;AACA;AACF;;;;;AAOA;AACE;AACA;AACA;;AAEF;AAEI;AACA;;AAEE;;;;;AAmBN;AACE;;AAWU;AACF;AAgDV;AAsCF;;"}
1
+ {"version":3,"file":"option-list.js","sources":["../../src/components/option-list.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { ChevronDown, X } from \"lucide-react\";\n\nimport { cn } from \"@/utils\";\nimport { useMobile } from \"@/hooks/use-mobile\";\nimport { Button } from \"./button\";\nimport { Checkbox } from \"./checkbox\";\nimport { FilterChip } from \"./filter-chip\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\nimport { Sheet, SheetContent, SheetTitle } from \"./sheet\";\n\n/*\n * The shared look for every list of options (menus, selects, dropdowns,\n * autocomplete, filter menus): the list is inset from its container's edge,\n * and each row is its own rounded box with a little space between rows, so\n * hover and selection read as distinct pills rather than full-bleed stripes.\n */\n\n/** Padding + row gap for a list of options inside a popover or sheet. */\nexport const optionListClassName = \"flex flex-col gap-option-gap p-option-inset\";\n\n/** One option row. Pair with a hover/focus or selected state as needed. */\nexport const optionRowClassName =\n \"relative flex min-h-option-row w-full cursor-pointer select-none items-center gap-3 rounded-control-sm px-option-x py-2 text-left text-sm text-foreground outline-none transition-colors duration-state hover:bg-muted focus-visible:bg-muted motion-reduce:transition-none max-md:min-h-11\";\n\nexport type CheckboxListItem = {\n label: React.ReactNode;\n checked: boolean;\n onCheckedChange: (checked: boolean) => void;\n /** Indents the row under a group heading row. */\n indent?: boolean;\n /** Bolder label, e.g. a group's \"All …\" row. */\n strong?: boolean;\n disabled?: boolean;\n};\n\n/** A list of checkbox rows in the shared option style. */\nexport function CheckboxList({\n items,\n className,\n \"aria-label\": label,\n}: {\n items: CheckboxListItem[];\n className?: string;\n \"aria-label\"?: string;\n}) {\n return (\n <ul\n aria-label={label}\n className={cn(\"m-0 list-none\", optionListClassName, className)}\n >\n {items.map((item, index) => (\n <li key={index}>\n <label\n className={cn(\n optionRowClassName,\n item.indent && \"pl-8\",\n item.strong && \"font-medium\",\n item.disabled && \"pointer-events-none opacity-50\",\n )}\n >\n <Checkbox\n checked={item.checked}\n disabled={item.disabled}\n onCheckedChange={(checked) =>\n item.onCheckedChange(checked === true)\n }\n />\n <span className=\"min-w-0 flex-1\">{item.label}</span>\n </label>\n </li>\n ))}\n </ul>\n );\n}\n\nexport type FilterMenuOption = { label: React.ReactNode; value: string };\n\ntype FilterMenuCommon = {\n /** The chip's label (and the sheet title when it's text). */\n label?: React.ReactNode;\n /** Replaces the default chip, e.g. a labelled field button. */\n trigger?: React.ReactElement<React.HTMLAttributes<HTMLElement>>;\n /** Sheet title / list name when `label` isn't plain text. */\n title?: string;\n /** Shows a clear action (popover footer and sheet footer). */\n onClear?: () => void;\n clearLabel?: string;\n /**\n * How the popover's clear looks: a small link (default), or a quiet\n * full-width button with an ✕, e.g. to match a neighbouring picker.\n */\n clearVariant?: \"link\" | \"button\";\n size?: \"xs\" | \"sm\" | \"md\";\n align?: \"start\" | \"center\" | \"end\";\n className?: string;\n contentClassName?: string;\n};\n\n/** Simple filters: options in, selected values out. */\ntype FilterMenuOptionsProps = FilterMenuCommon & {\n options: FilterMenuOption[];\n /** The selected option values. */\n value: string[];\n onValueChange: (value: string[]) => void;\n items?: never;\n};\n\n/** Lists with their own rules (groups, indents): the rows themselves. */\ntype FilterMenuItemsProps = FilterMenuCommon & {\n items: CheckboxListItem[];\n options?: never;\n value?: never;\n onValueChange?: never;\n};\n\nexport type FilterMenuProps = FilterMenuOptionsProps | FilterMenuItemsProps;\n\n/**\n * A checklist behind a trigger: a dropdown on desktop and a bottom sheet\n * (with Clear and Done) on phones. Each tick applies immediately.\n *\n * Feed it either `options` + `value` + `onValueChange` (simple filters; the\n * default trigger is a FilterChip showing the count in the selected,\n * secondary style), or ready-made `items` with your own `trigger`.\n */\nexport function FilterMenu(props: FilterMenuProps) {\n const {\n label,\n trigger: customTrigger,\n title: titleProp,\n onClear,\n clearLabel = \"Clear\",\n clearVariant = \"link\",\n size = \"sm\",\n align = \"start\",\n className,\n contentClassName,\n } = props;\n const isMobile = useMobile();\n const [open, setOpen] = React.useState(false);\n const closeRef = React.useRef<HTMLButtonElement>(null);\n\n // Both ways in become the same rows.\n const items: CheckboxListItem[] =\n props.items ??\n props.options.map((option) => ({\n label: option.label,\n checked: props.value.includes(option.value),\n onCheckedChange: (on) =>\n props.onValueChange(\n on\n ? [...props.value, option.value]\n : props.value.filter((item) => item !== option.value),\n ),\n }));\n const count = props.items\n ? props.items.filter((item) => item.checked).length\n : props.value.length;\n const title = titleProp ?? (typeof label === \"string\" ? label : \"Filter\");\n // The sheet always offers Clear while something's on; the popover only\n // when the caller asks for it.\n const clearInSheet =\n onClear ??\n (!props.items && count > 0 ? () => props.onValueChange([]) : undefined);\n\n const triggerProps = {\n \"aria-haspopup\": \"dialog\" as const,\n \"aria-expanded\": open,\n onClick: isMobile ? () => setOpen(true) : undefined,\n };\n const trigger = customTrigger ? (\n React.cloneElement(customTrigger, {\n ...triggerProps,\n onClick: (event: React.MouseEvent<HTMLElement>) => {\n customTrigger.props.onClick?.(event);\n triggerProps.onClick?.();\n },\n })\n ) : (\n <FilterChip\n size={size}\n selected={count > 0}\n count={count || undefined}\n className={className}\n {...triggerProps}\n >\n {label}\n <ChevronDown size={14} aria-hidden=\"true\" className=\"-mr-1\" />\n </FilterChip>\n );\n\n const list = <CheckboxList aria-label={title} items={items} />;\n\n // Phones: a bottom sheet, like Autocomplete and Select.\n if (isMobile)\n return (\n <>\n {trigger}\n <Sheet open={open} onOpenChange={setOpen}>\n <SheetContent\n side=\"bottom\"\n showCloseButton={false}\n overlayClassName=\"z-(--z-popover-overlay) bg-black/25 backdrop-blur-[1px]\"\n aria-describedby={undefined}\n onOpenAutoFocus={(event) => {\n event.preventDefault();\n closeRef.current?.focus();\n }}\n className=\"z-(--z-popover) flex flex-col gap-0 p-0 pb-[max(0.75rem,env(safe-area-inset-bottom))]\"\n >\n <div className=\"flex shrink-0 items-center justify-between gap-4 px-4 pb-1 pt-4\">\n <SheetTitle className=\"text-base font-semibold text-foreground\">\n {title}\n </SheetTitle>\n <button\n ref={closeRef}\n type=\"button\"\n aria-label=\"Close\"\n className=\"-mr-3 flex h-11 w-11 shrink-0 cursor-pointer items-center justify-center rounded-control-lg text-muted-foreground hover:bg-muted\"\n onClick={() => setOpen(false)}\n >\n <X className=\"h-5 w-5\" aria-hidden=\"true\" />\n </button>\n </div>\n <div className=\"min-h-0 flex-1 overflow-y-auto overscroll-contain px-2\">\n {list}\n </div>\n <div className=\"flex shrink-0 gap-2 border-t border-border px-4 pt-3\">\n {clearInSheet && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n scheme=\"neutral\"\n className=\"flex-1\"\n onClick={clearInSheet}\n >\n {clearLabel}\n </Button>\n )}\n {/* Outline, like Autocomplete's: ticks already applied, so\n Done only closes the sheet. */}\n <Button\n type=\"button\"\n variant=\"outline\"\n className=\"flex-1\"\n onClick={() => setOpen(false)}\n >\n Done\n </Button>\n </div>\n </SheetContent>\n </Sheet>\n </>\n );\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>{trigger}</PopoverTrigger>\n <PopoverContent\n align={align}\n className={cn(\"w-56 p-0\", contentClassName)}\n >\n {list}\n {onClear && (\n <div className=\"border-t border-border p-option-inset\">\n {clearVariant === \"button\" ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n scheme=\"neutral\"\n size=\"sm\"\n className=\"w-full\"\n onClick={onClear}\n >\n <X size={16} aria-hidden=\"true\" />\n {clearLabel}\n </Button>\n ) : (\n <Button\n type=\"button\"\n variant=\"link\"\n scheme=\"primary\"\n size=\"xs\"\n onClick={onClear}\n >\n {clearLabel}\n </Button>\n )}\n </div>\n )}\n </PopoverContent>\n </Popover>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAaA;;;;;AAKG;AAEH;AACO;AAEP;AACO;AAcP;AACM;;AAqCN;AA4CA;;;;;;;AAOG;AACG;AACJ;AAYA;AACA;;;AAIA;;;;;;AASU;AAEP;AACH;AACE;AACA;AACF;;;;;AAOA;AACE;AACA;AACA;;AAEF;AAEI;AACA;;AAEE;;;;;AAmBN;AACE;;AAWU;AACF;AAgDV;AAsCF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"page-header.js","sources":["../../src/components/page-header.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport { cn } from '@/utils';\r\n\r\n\r\nexport function PageHeader({\r\n title,\r\n description,\r\n animated = false,\r\n className,\r\n}: {\r\n title: string;\r\n description?: React.ReactNode;\r\n /**\r\n * Fades the header up into place when it mounts (skipped under reduced\r\n * motion). Give the header a new `key` to play it again, e.g. on tab change.\r\n * Leave it off in loading skeletons so the effect plays once, on the page.\r\n */\r\n animated?: boolean;\r\n className?: string;\r\n}) {\r\n return (\r\n <header\r\n className={cn(\r\n 'text-foreground',\r\n animated && 'motion-safe:animate-page-enter',\r\n className,\r\n )}\r\n >\r\n <h1 className=\"text-page-heading font-page-heading\">\r\n {title}\r\n </h1>\r\n {description && (\r\n <p className=\"mt-page-description-gap max-w-page-description text-muted-foreground text-base leading-page-description\">{description}</p>\r\n )}\r\n </header>\r\n );\r\n}\r\n"],"names":["_jsxs","_jsx"],"mappings":";;;AAIM,SAAU,UAAU,CAAC,EACzB,KAAK,EACL,WAAW,EACX,QAAQ,GAAG,KAAK,EAChB,SAAS,GAWV,EAAA;AACC,IAAA,QACEA,IAAA,CAAA,QAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,iBAAiB,EACjB,QAAQ,IAAI,gCAAgC,EAC5C,SAAS,CACV,EAAA,QAAA,EAAA,CAECC,YAAI,SAAS,EAAC,qCAAqC,EAAA,QAAA,EAChD,KAAK,EAAA,CACH,EACJ,WAAW,KACVA,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,yGAAyG,YAAE,WAAW,EAAA,CAAK,CACzI,CAAA,EAAA,CACI;AAEb;;;;"}
1
+ {"version":3,"file":"page-header.js","sources":["../../src/components/page-header.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '@/utils';\n\n\nexport function PageHeader({\n title,\n description,\n animated = false,\n className,\n}: {\n title: string;\n description?: React.ReactNode;\n /**\n * Fades the header up into place when it mounts (skipped under reduced\n * motion). Give the header a new `key` to play it again, e.g. on tab change.\n * Leave it off in loading skeletons so the effect plays once, on the page.\n */\n animated?: boolean;\n className?: string;\n}) {\n return (\n <header\n className={cn(\n 'text-foreground',\n animated && 'motion-safe:animate-page-enter',\n className,\n )}\n >\n <h1 className=\"text-page-heading font-page-heading\">\n {title}\n </h1>\n {description && (\n <p className=\"mt-page-description-gap max-w-page-description text-muted-foreground text-base leading-page-description\">{description}</p>\n )}\n </header>\n );\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;AAIM,SAAU,UAAU,CAAC,EACzB,KAAK,EACL,WAAW,EACX,QAAQ,GAAG,KAAK,EAChB,SAAS,GAWV,EAAA;AACC,IAAA,QACEA,IAAA,CAAA,QAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,iBAAiB,EACjB,QAAQ,IAAI,gCAAgC,EAC5C,SAAS,CACV,EAAA,QAAA,EAAA,CAECC,YAAI,SAAS,EAAC,qCAAqC,EAAA,QAAA,EAChD,KAAK,EAAA,CACH,EACJ,WAAW,KACVA,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,yGAAyG,YAAE,WAAW,EAAA,CAAK,CACzI,CAAA,EAAA,CACI;AAEb;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"paginator.js","sources":["../../src/components/paginator.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\r\nimport React, { useState } from \"react\";\r\nimport { Button } from \"./button\";\r\n\r\ninterface PaginatorProps {\r\n totalItems: number;\r\n itemsPerPage: number;\r\n currentPage?: number;\r\n onPageChange?: (page: number) => void;\r\n}\r\n\r\nexport const Paginator: React.FC<PaginatorProps> = ({\r\n totalItems,\r\n itemsPerPage,\r\n currentPage: controlledPage,\r\n onPageChange,\r\n}) => {\r\n const [internalPage, setInternalPage] = useState(1);\r\n const isControlled = controlledPage !== undefined;\r\n const currentPage = isControlled ? controlledPage : internalPage;\r\n const totalPages = Math.ceil(totalItems / itemsPerPage);\r\n\r\n const goToPage = (page: number) => {\r\n const clamped = Math.max(1, Math.min(page, totalPages));\r\n if (!isControlled) setInternalPage(clamped);\r\n if (onPageChange) onPageChange(clamped);\r\n };\r\n\r\n const getDisplayedPages = () => {\r\n const pages = [];\r\n\r\n // Always show first page\r\n pages.push(1);\r\n\r\n const left = Math.max(2, currentPage - 1);\r\n const right = Math.min(totalPages - 1, currentPage + 1);\r\n\r\n if (left > 2) {\r\n pages.push(\"ellipsis-left\");\r\n }\r\n\r\n for (let i = left; i <= right; i++) {\r\n pages.push(i);\r\n }\r\n\r\n if (right < totalPages - 1) {\r\n pages.push(\"ellipsis-right\");\r\n }\r\n\r\n // Always show last page if more than one\r\n if (totalPages > 1) {\r\n pages.push(totalPages);\r\n }\r\n\r\n return pages;\r\n };\r\n\r\n return (\r\n <div className=\"flex justify-center items-center space-x-2 mt-4\">\r\n <Button\r\n variant={\"ghost\"}\r\n iconOnly\r\n aria-label=\"Previous page\"\r\n onClick={() => goToPage(currentPage - 1)}\r\n disabled={currentPage === 1}\r\n >\r\n <ChevronLeft></ChevronLeft>\r\n </Button>\r\n\r\n {getDisplayedPages().map((page, idx) =>\r\n typeof page === \"number\" ? (\r\n <Button\r\n key={idx}\r\n variant={currentPage === page ? \"solid\" : \"ghost\"}\r\n className=\"size-11 p-0\"\r\n onClick={() => goToPage(page)}\r\n >\r\n {page}\r\n </Button>\r\n ) : (\r\n <span key={idx} className=\"px-2 text-muted-foreground\">\r\n &hellip;\r\n </span>\r\n ),\r\n )}\r\n\r\n <Button\r\n variant={\"ghost\"}\r\n iconOnly\r\n aria-label=\"Next page\"\r\n onClick={() => goToPage(currentPage + 1)}\r\n disabled={currentPage === totalPages}\r\n >\r\n <ChevronRight></ChevronRight>\r\n </Button>\r\n </div>\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;;;AAaO;;AAOL;;;AAIA;AACE;AACA;;AACA;;AACF;;;;AAME;AAEA;AACA;AAEA;AACE;;AAGF;AACE;;AAGF;AACE;;;AAIF;AACE;;AAGF;AACF;AAEA;AAwCF;;"}
1
+ {"version":3,"file":"paginator.js","sources":["../../src/components/paginator.tsx"],"sourcesContent":["'use client';\n\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\nimport React, { useState } from \"react\";\nimport { Button } from \"./button\";\n\ninterface PaginatorProps {\n totalItems: number;\n itemsPerPage: number;\n currentPage?: number;\n onPageChange?: (page: number) => void;\n}\n\nexport const Paginator: React.FC<PaginatorProps> = ({\n totalItems,\n itemsPerPage,\n currentPage: controlledPage,\n onPageChange,\n}) => {\n const [internalPage, setInternalPage] = useState(1);\n const isControlled = controlledPage !== undefined;\n const currentPage = isControlled ? controlledPage : internalPage;\n const totalPages = Math.ceil(totalItems / itemsPerPage);\n\n const goToPage = (page: number) => {\n const clamped = Math.max(1, Math.min(page, totalPages));\n if (!isControlled) setInternalPage(clamped);\n if (onPageChange) onPageChange(clamped);\n };\n\n const getDisplayedPages = () => {\n const pages = [];\n\n // Always show first page\n pages.push(1);\n\n const left = Math.max(2, currentPage - 1);\n const right = Math.min(totalPages - 1, currentPage + 1);\n\n if (left > 2) {\n pages.push(\"ellipsis-left\");\n }\n\n for (let i = left; i <= right; i++) {\n pages.push(i);\n }\n\n if (right < totalPages - 1) {\n pages.push(\"ellipsis-right\");\n }\n\n // Always show last page if more than one\n if (totalPages > 1) {\n pages.push(totalPages);\n }\n\n return pages;\n };\n\n return (\n <div className=\"flex justify-center items-center space-x-2 mt-4\">\n <Button\n variant={\"ghost\"}\n iconOnly\n aria-label=\"Previous page\"\n onClick={() => goToPage(currentPage - 1)}\n disabled={currentPage === 1}\n >\n <ChevronLeft></ChevronLeft>\n </Button>\n\n {getDisplayedPages().map((page, idx) =>\n typeof page === \"number\" ? (\n <Button\n key={idx}\n variant={currentPage === page ? \"solid\" : \"ghost\"}\n className=\"size-11 p-0\"\n onClick={() => goToPage(page)}\n >\n {page}\n </Button>\n ) : (\n <span key={idx} className=\"px-2 text-muted-foreground\">\n &hellip;\n </span>\n ),\n )}\n\n <Button\n variant={\"ghost\"}\n iconOnly\n aria-label=\"Next page\"\n onClick={() => goToPage(currentPage + 1)}\n disabled={currentPage === totalPages}\n >\n <ChevronRight></ChevronRight>\n </Button>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;AAaO;;AAOL;;;AAIA;AACE;AACA;;AACA;;AACF;;;;AAME;AAEA;AACA;AAEA;AACE;;AAGF;AACE;;AAGF;AACE;;;AAIF;AACE;;AAGF;AACF;AAEA;AAwCF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"popover.js","sources":["../../src/components/popover.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\r\n\r\nimport { cn } from '@/utils';\r\n\r\nfunction Popover({\r\n ...props\r\n}: React.ComponentProps<typeof PopoverPrimitive.Root>) {\r\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\r\n}\r\n\r\nconst PopoverTrigger = React.forwardRef<\r\n React.ElementRef<typeof PopoverPrimitive.Trigger>,\r\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Trigger>\r\n>(({ className, ...props }, ref) => (\r\n <PopoverPrimitive.Trigger\r\n ref={ref}\r\n className={className}\r\n data-slot=\"popover-trigger\"\r\n {...props}\r\n />\r\n));\r\nPopoverTrigger.displayName = PopoverPrimitive.Trigger.displayName;\r\n\r\nconst PopoverContent = React.forwardRef<\r\n React.ElementRef<typeof PopoverPrimitive.Content>,\r\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\r\n>(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (\r\n <PopoverPrimitive.Portal>\r\n <PopoverPrimitive.Content\r\n ref={ref}\r\n data-slot=\"popover-content\"\r\n align={align}\r\n sideOffset={sideOffset}\r\n className={cn(\r\n 'bg-popover text-popover-foreground data-[state=open]:animate-in motion-reduce:animate-none 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 z-(--z-popover) w-72 origin-(--radix-popover-content-transform-origin) rounded-card border border-border p-4 shadow-card outline-hidden',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n </PopoverPrimitive.Portal>\r\n));\r\nPopoverContent.displayName = PopoverPrimitive.Content.displayName;\r\n\r\nconst PopoverAnchor = React.forwardRef<\r\n React.ElementRef<typeof PopoverPrimitive.Anchor>,\r\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Anchor>\r\n>(({ className, ...props }, ref) => (\r\n <PopoverPrimitive.Anchor\r\n ref={ref}\r\n data-slot=\"popover-anchor\"\r\n className={className}\r\n {...props}\r\n />\r\n));\r\nPopoverAnchor.displayName = PopoverPrimitive.Anchor.displayName;\r\n\r\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };\r\n"],"names":["_jsx"],"mappings":";;;;;AAKA,SAAS,OAAO,CAAC,EACf,GAAG,KAAK,EAC2C,EAAA;IACnD,OAAOA,GAAA,CAAC,gBAAgB,CAAC,IAAI,iBAAW,SAAS,EAAA,GAAK,KAAK,EAAA,CAAI;AACjE;AAEA,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAGrC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAC7BA,GAAA,CAAC,gBAAgB,CAAC,OAAO,EAAA,EACvB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,eACV,iBAAiB,EAAA,GACvB,KAAK,EAAA,CACT,CACH;AACD,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,WAAW;AAEjE,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAGrC,CAAC,EAAE,SAAS,EAAE,KAAK,GAAG,QAAQ,EAAE,UAAU,GAAG,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAC/DA,GAAA,CAAC,gBAAgB,CAAC,MAAM,EAAA,EAAA,QAAA,EACtBA,GAAA,CAAC,gBAAgB,CAAC,OAAO,EAAA,EACvB,GAAG,EAAE,GAAG,EAAA,WAAA,EACE,iBAAiB,EAC3B,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,EAAE,CACX,whBAAwhB,EACxhB,SAAS,CACV,EAAA,GACG,KAAK,EAAA,CACT,EAAA,CACsB,CAC3B;AACD,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,WAAW;AAEjE,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAGpC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAC7BA,GAAA,CAAC,gBAAgB,CAAC,MAAM,EAAA,EACtB,GAAG,EAAE,GAAG,EAAA,WAAA,EACE,gBAAgB,EAC1B,SAAS,EAAE,SAAS,EAAA,GAChB,KAAK,EAAA,CACT,CACH;AACD,aAAa,CAAC,WAAW,GAAG,gBAAgB,CAAC,MAAM,CAAC,WAAW;;;;"}
1
+ {"version":3,"file":"popover.js","sources":["../../src/components/popover.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nimport { cn } from '@/utils';\n\nfunction Popover({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\n}\n\nconst PopoverTrigger = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Trigger>\n>(({ className, ...props }, ref) => (\n <PopoverPrimitive.Trigger\n ref={ref}\n className={className}\n data-slot=\"popover-trigger\"\n {...props}\n />\n));\nPopoverTrigger.displayName = PopoverPrimitive.Trigger.displayName;\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n data-slot=\"popover-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n 'bg-popover text-popover-foreground data-[state=open]:animate-in motion-reduce:animate-none 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 z-(--z-popover) w-72 origin-(--radix-popover-content-transform-origin) rounded-card border border-border p-4 shadow-card outline-hidden',\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n));\nPopoverContent.displayName = PopoverPrimitive.Content.displayName;\n\nconst PopoverAnchor = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Anchor>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Anchor>\n>(({ className, ...props }, ref) => (\n <PopoverPrimitive.Anchor\n ref={ref}\n data-slot=\"popover-anchor\"\n className={className}\n {...props}\n />\n));\nPopoverAnchor.displayName = PopoverPrimitive.Anchor.displayName;\n\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };\n"],"names":["_jsx"],"mappings":";;;;;AAKA,SAAS,OAAO,CAAC,EACf,GAAG,KAAK,EAC2C,EAAA;IACnD,OAAOA,GAAA,CAAC,gBAAgB,CAAC,IAAI,iBAAW,SAAS,EAAA,GAAK,KAAK,EAAA,CAAI;AACjE;AAEA,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAGrC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAC7BA,GAAA,CAAC,gBAAgB,CAAC,OAAO,EAAA,EACvB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,eACV,iBAAiB,EAAA,GACvB,KAAK,EAAA,CACT,CACH;AACD,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,WAAW;AAEjE,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAGrC,CAAC,EAAE,SAAS,EAAE,KAAK,GAAG,QAAQ,EAAE,UAAU,GAAG,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAC/DA,GAAA,CAAC,gBAAgB,CAAC,MAAM,EAAA,EAAA,QAAA,EACtBA,GAAA,CAAC,gBAAgB,CAAC,OAAO,EAAA,EACvB,GAAG,EAAE,GAAG,EAAA,WAAA,EACE,iBAAiB,EAC3B,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,EAAE,CACX,whBAAwhB,EACxhB,SAAS,CACV,EAAA,GACG,KAAK,EAAA,CACT,EAAA,CACsB,CAC3B;AACD,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,WAAW;AAEjE,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAGpC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAC7BA,GAAA,CAAC,gBAAgB,CAAC,MAAM,EAAA,EACtB,GAAG,EAAE,GAAG,EAAA,WAAA,EACE,gBAAgB,EAC1B,SAAS,EAAE,SAAS,EAAA,GAChB,KAAK,EAAA,CACT,CACH;AACD,aAAa,CAAC,WAAW,GAAG,gBAAgB,CAAC,MAAM,CAAC,WAAW;;;;"}