@betterinternship/components 3.0.4 → 3.1.1

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 (114) 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 +12 -0
  5. package/dist/components/animated-shiny-text.js.map +1 -0
  6. package/dist/components/app-header.js.map +1 -1
  7. package/dist/components/autocomplete.js +335 -0
  8. package/dist/components/autocomplete.js.map +1 -0
  9. package/dist/components/avatar.js.map +1 -1
  10. package/dist/components/badge.js.map +1 -1
  11. package/dist/components/banner.js.map +1 -1
  12. package/dist/components/button.js.map +1 -1
  13. package/dist/components/calendar.js.map +1 -1
  14. package/dist/components/card.js.map +1 -1
  15. package/dist/components/carousel.js +126 -0
  16. package/dist/components/carousel.js.map +1 -0
  17. package/dist/components/checkbox.js.map +1 -1
  18. package/dist/components/chip-select.js +22 -0
  19. package/dist/components/chip-select.js.map +1 -0
  20. package/dist/components/collapsible.js +45 -0
  21. package/dist/components/collapsible.js.map +1 -0
  22. package/dist/components/context-menu.js +37 -0
  23. package/dist/components/context-menu.js.map +1 -0
  24. package/dist/components/dialog.js +10 -10
  25. package/dist/components/dialog.js.map +1 -1
  26. package/dist/components/divider.js.map +1 -1
  27. package/dist/components/dot-matrix.js +163 -0
  28. package/dist/components/dot-matrix.js.map +1 -0
  29. package/dist/components/dropdown-menu.js.map +1 -1
  30. package/dist/components/dropdown.js +262 -0
  31. package/dist/components/dropdown.js.map +1 -0
  32. package/dist/components/error.js +19 -0
  33. package/dist/components/error.js.map +1 -0
  34. package/dist/components/fab.js +9 -0
  35. package/dist/components/fab.js.map +1 -0
  36. package/dist/components/file-upload.js.map +1 -1
  37. package/dist/components/filter-chip.js.map +1 -1
  38. package/dist/components/form-checkbox-group.js.map +1 -1
  39. package/dist/components/form-checkbox.js.map +1 -1
  40. package/dist/components/form-date-picker.js.map +1 -1
  41. package/dist/components/form-field.js.map +1 -1
  42. package/dist/components/form-input.js.map +1 -1
  43. package/dist/components/form-month-picker.js.map +1 -1
  44. package/dist/components/form-radio.js.map +1 -1
  45. package/dist/components/form-textarea.js.map +1 -1
  46. package/dist/components/form.js +71 -0
  47. package/dist/components/form.js.map +1 -0
  48. package/dist/components/hover-card.js +13 -0
  49. package/dist/components/hover-card.js.map +1 -0
  50. package/dist/components/input-otp.js +24 -0
  51. package/dist/components/input-otp.js.map +1 -0
  52. package/dist/components/input.js.map +1 -1
  53. package/dist/components/label.js.map +1 -1
  54. package/dist/components/loader.js.map +1 -1
  55. package/dist/components/magnetic-button.js +32 -0
  56. package/dist/components/magnetic-button.js.map +1 -0
  57. package/dist/components/messages.js +9 -0
  58. package/dist/components/messages.js.map +1 -0
  59. package/dist/components/mobile-sheet-portal.js +17 -0
  60. package/dist/components/mobile-sheet-portal.js.map +1 -0
  61. package/dist/components/page-header.d.ts +7 -1
  62. package/dist/components/page-header.js +2 -2
  63. package/dist/components/page-header.js.map +1 -1
  64. package/dist/components/paginator.js +44 -0
  65. package/dist/components/paginator.js.map +1 -0
  66. package/dist/components/popover.js.map +1 -1
  67. package/dist/components/progress.js +11 -0
  68. package/dist/components/progress.js.map +1 -0
  69. package/dist/components/radio-group.js.map +1 -1
  70. package/dist/components/select.js.map +1 -1
  71. package/dist/components/sheet.d.ts +1 -1
  72. package/dist/components/sheet.js +40 -0
  73. package/dist/components/sheet.js.map +1 -0
  74. package/dist/components/skeleton.js.map +1 -1
  75. package/dist/components/slider.js +11 -0
  76. package/dist/components/slider.js.map +1 -0
  77. package/dist/components/sonner-toast.js +78 -0
  78. package/dist/components/sonner-toast.js.map +1 -0
  79. package/dist/components/stepper.js.map +1 -1
  80. package/dist/components/switch.js.map +1 -1
  81. package/dist/components/table.js.map +1 -1
  82. package/dist/components/tabs.js.map +1 -1
  83. package/dist/components/textarea.js.map +1 -1
  84. package/dist/components/time-input-native.js.map +1 -1
  85. package/dist/components/timeline.js +16 -0
  86. package/dist/components/timeline.js.map +1 -0
  87. package/dist/components/toggle.js +15 -0
  88. package/dist/components/toggle.js.map +1 -0
  89. package/dist/components/tooltip.js.map +1 -1
  90. package/dist/hooks/use-detect-click-outside.js +29 -0
  91. package/dist/hooks/use-detect-click-outside.js.map +1 -0
  92. package/dist/hooks/use-field-focus.js.map +1 -1
  93. package/dist/hooks/use-mobile-sheet-viewport.js.map +1 -1
  94. package/dist/hooks/use-mobile.js.map +1 -1
  95. package/dist/hooks/use-resource-table.js.map +1 -1
  96. package/dist/hooks/useMQJob.js.map +1 -1
  97. package/dist/index.d.ts +34 -3
  98. package/dist/index.js +30 -0
  99. package/dist/index.js.map +1 -1
  100. package/dist/lib/interaction-styles.js.map +1 -1
  101. package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js +1670 -0
  102. package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js.map +1 -0
  103. package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +38 -0
  104. package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js.map +1 -0
  105. package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +39 -0
  106. package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js.map +1 -0
  107. package/dist/node_modules/input-otp/dist/index.js +25 -0
  108. package/dist/node_modules/input-otp/dist/index.js.map +1 -0
  109. package/dist/node_modules/react-hook-form/dist/index.esm.js +706 -0
  110. package/dist/node_modules/react-hook-form/dist/index.esm.js.map +1 -0
  111. package/dist/utils.js.map +1 -1
  112. package/package.json +326 -291
  113. package/theme.css +360 -355
  114. package/theme.legacy.css +84 -84
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autocomplete.js","sources":["../../src/components/autocomplete.tsx"],"sourcesContent":["\"use client\";\n\nimport { Fragment, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport { Input } from \"./input\";\nimport { useDetectClickOutside } from '@/hooks/use-detect-click-outside';\nimport { cn } from \"@/utils\";\nimport { ChevronDown, PlusCircleIcon, Search, X } from \"lucide-react\";\nimport { Label } from \"./label\";\nimport { Button } from \"./button\";\nimport { CheckboxVisual } from \"./checkbox\";\nimport { Sheet, SheetContent, SheetTitle } from \"./sheet\";\nimport { useMobile } from \"@/hooks/use-mobile\";\nimport { useMobileSheetViewport } from \"@/hooks/use-mobile-sheet-viewport\";\nimport {\n FieldChromeContext,\n fieldFocusOutlineClassName,\n fieldInteractionClassName,\n useFieldFocus,\n} from \"@/hooks/use-field-focus\";\n\nexport interface IAutocompleteOption<ID extends number | string> {\n id: ID;\n name: string;\n keywords?: string[];\n /** Child options; in multiple mode the group can select all its children. */\n children?: IAutocompleteOption<ID>[];\n}\n\ntype MobileDropdownMode = \"sheet\" | \"inline\";\ntype InputIcons = boolean | \"search\" | \"dropdown\";\n\n/* -------------------------------------------------------\n * Base component (array-based). Single uses length 0..1.\n * -----------------------------------------------------*/\nfunction AutocompleteBase<ID extends number | string>({\n required,\n options,\n value = [],\n setter,\n placeholder,\n className,\n multiple = true,\n label,\n labelAddon,\n allowCustomValue = false,\n preserveOptionOrder = false,\n emptyText = \"No matching options\",\n mobileDropdownMode = \"sheet\",\n inputIcons = false,\n ...props\n}: {\n required?: boolean;\n options: IAutocompleteOption<ID>[];\n value?: ID[]; // single => 0..1 items, multi => any length\n setter: (next: ID[]) => void; // set the whole selection\n placeholder?: string;\n className?: string;\n multiple?: boolean;\n label?: React.ReactNode;\n labelAddon?: React.ReactNode;\n allowCustomValue?: boolean;\n preserveOptionOrder?: boolean;\n emptyText?: string;\n mobileDropdownMode?: MobileDropdownMode;\n inputIcons?: InputIcons;\n}) {\n const [query, setQuery] = useState(\"\");\n const [isOpen, setIsOpen] = useState(false);\n const [dropdownMaxHeight, setDropdownMaxHeight] = useState<number>();\n const isMobile = useMobile();\n const clickOutsideRef = useDetectClickOutside({\n onTriggered: () => {\n // Radix owns outside dismissal for the portalled modal sheet.\n if (isMobile && mobileDropdownMode === 'sheet') return;\n setIsOpen(false);\n },\n });\n const rootRef = useRef<HTMLDivElement | null>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const sheetInputRef = useRef<HTMLInputElement | null>(null);\n const sheetRef = useRef<HTMLDivElement | null>(null);\n const sheetCloseRef = useRef<HTMLButtonElement | null>(null);\n const lastSelectionRef = useRef(0);\n // Show the Button focus outline only for keyboard focus, not clicks.\n const { keyboardFocus, focusProps: fieldFocusProps } = useFieldFocus();\n\n const inputId = useId();\n const flatOptions = useMemo(\n () => options.flatMap((option) => option.children?.length ? option.children : [option]),\n [options],\n );\n\n const findExactOption = (value: string) => {\n const normalizedValue = value.trim().toLowerCase();\n return flatOptions.find(\n (o) =>\n o.name?.trim().toLowerCase() === normalizedValue ||\n o.keywords?.some((k) => k === normalizedValue),\n );\n };\n\n const resolveQuerySelection = (nextQuery: string, matchKeywords = true) => {\n const text = nextQuery.trim();\n if (!text) return false;\n\n const exact = matchKeywords\n ? findExactOption(text)\n : flatOptions.find(\n (o) => o.name?.trim().toLowerCase() === text.toLowerCase(),\n );\n if (exact) {\n setter([exact.id]);\n setQuery(\"\");\n return true;\n }\n\n if (allowCustomValue) {\n setter([text as unknown as ID]);\n setQuery(\"\");\n return true;\n }\n\n return false;\n };\n\n const selectedSet = useMemo(() => new Set(value ?? []), [value]);\n\n const filtered = useMemo(() => {\n const q = query.trim().toLowerCase();\n const base = q\n ? flatOptions.filter(\n (o) =>\n o.name?.toLowerCase().includes(q) ||\n options.some((group) => group.children?.some((child) => child.id === o.id) && group.name.toLowerCase().includes(q)) ||\n o.keywords?.some((k) => k.includes(q)),\n )\n : flatOptions;\n return preserveOptionOrder || options.some((option) => option.children?.length)\n ? base\n : base.slice().sort((a, b) => a.name.localeCompare(b.name));\n }, [query, flatOptions, options, preserveOptionOrder]);\n\n const toggle = (id: ID) => {\n lastSelectionRef.current = Date.now();\n if (!multiple) {\n setter([id]); // single-select\n setIsOpen(false);\n setQuery(\"\");\n return;\n }\n const set = new Set(value ?? []);\n if (set.has(id)) set.delete(id);\n else set.add(id);\n setter(Array.from(set));\n };\n\n const removeAt = (id: ID) => {\n const set = new Set(value ?? []);\n set.delete(id);\n setter(Array.from(set));\n };\n\n const selectedLabels = useMemo(\n () =>\n (value ?? [])\n .map((id) => {\n const label = flatOptions.find((o) => o.id === id)?.name;\n return label ?? (allowCustomValue ? String(id) : undefined);\n })\n .filter(Boolean) as string[],\n [value, flatOptions, allowCustomValue],\n );\n\n const singleDisplay = !multiple && (selectedLabels[0] ?? \"\");\n const useMobileSheet = isMobile && mobileDropdownMode === \"sheet\";\n const sheetViewport = useMobileSheetViewport(isOpen && useMobileSheet);\n const useInlineMobileDropdown = isMobile && mobileDropdownMode === \"inline\";\n\n\n useEffect(() => {\n if (!isOpen || !useInlineMobileDropdown) {\n setDropdownMaxHeight(undefined);\n return;\n }\n\n const updateDropdownMaxHeight = () => {\n const rootRect = rootRef.current?.getBoundingClientRect();\n if (!rootRect) return;\n\n const viewportHeight =\n window.visualViewport?.height ?? window.innerHeight;\n const gap = 8;\n const availableHeight = viewportHeight - rootRect.bottom - gap;\n setDropdownMaxHeight(Math.max(0, Math.min(400, availableHeight)));\n };\n\n updateDropdownMaxHeight();\n window.addEventListener(\"resize\", updateDropdownMaxHeight);\n window.visualViewport?.addEventListener(\"resize\", updateDropdownMaxHeight);\n window.visualViewport?.addEventListener(\"scroll\", updateDropdownMaxHeight);\n\n return () => {\n window.removeEventListener(\"resize\", updateDropdownMaxHeight);\n window.visualViewport?.removeEventListener(\n \"resize\",\n updateDropdownMaxHeight,\n );\n window.visualViewport?.removeEventListener(\n \"scroll\",\n updateDropdownMaxHeight,\n );\n };\n }, [isOpen, useInlineMobileDropdown]);\n\n const suppressMobileKeyboard =\n isMobile && (useMobileSheet || (mobileDropdownMode === \"inline\" && !allowCustomValue));\n\n // --- keyboard helpers for multi\n const onMultiKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (!multiple) return;\n if (allowCustomValue && e.key === \"Enter\" && query.trim().length > 0 && !findExactOption(query)) {\n const text = query.trim();\n const exact = findExactOption(text);\n const nextId = exact ? exact.id : (text as unknown as ID);\n const set = new Set(value ?? []);\n set.add(nextId);\n setter(Array.from(set));\n setQuery(\"\");\n setIsOpen(true);\n e.preventDefault();\n return;\n }\n if (\n e.key === \"Backspace\" &&\n query.length === 0 &&\n (value?.length ?? 0) > 0\n ) {\n const last = value[value.length - 1];\n removeAt(last);\n e.preventDefault();\n }\n if (e.key === \"Enter\") {\n const first = filtered[0];\n if (first) {\n toggle(first.id);\n setQuery(\"\");\n setIsOpen(true);\n e.preventDefault();\n }\n }\n if (e.key === \"ArrowDown\") setIsOpen(true);\n if (e.key === \"Escape\") setIsOpen(false);\n };\n\n // Same hover lift and press feedback as the Dropdown trigger.\n const fieldClassName = cn(\n fieldInteractionClassName,\n keyboardFocus && fieldFocusOutlineClassName,\n );\n\n const decorateSingleInput = (input: React.ReactNode) =>\n inputIcons ? (\n <div className={cn(\"relative min-w-0 flex-1\", fieldClassName)} {...fieldFocusProps}>\n {inputIcons !== \"search\" && inputIcons !== \"dropdown\" && (\n <Search\n className=\"pointer-events-none absolute left-3 top-1/2 z-20 h-4 w-4 -translate-y-1/2 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n )}\n <FieldChromeContext value={true}>{input}</FieldChromeContext>\n {inputIcons === \"search\" ? (\n <Search\n className=\"pointer-events-none absolute right-3 top-1/2 z-20 h-4 w-4 -translate-y-1/2 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n ) : (\n <ChevronDown\n className={cn(\n \"pointer-events-none absolute right-3 top-1/2 z-20 h-4 w-4 -translate-y-1/2 text-muted-foreground transition-transform duration-interactive ease-out-strong motion-reduce:transition-none\",\n isOpen && \"rotate-180\",\n )}\n aria-hidden=\"true\"\n />\n )}\n </div>\n ) : (\n <div className={cn(\"relative min-w-0 flex-1\", fieldClassName)} {...fieldFocusProps}>\n <FieldChromeContext value={true}>{input}</FieldChromeContext>\n </div>\n );\n\n const OptionsSurface = useMobileSheet ? SheetContent : 'div';\n const sheetProps = useMobileSheet ? {\n side: 'bottom' as const,\n showCloseButton: false,\n overlayClassName: 'z-[1090] bg-black/25 backdrop-blur-[1px]',\n 'aria-describedby': undefined,\n onOpenAutoFocus: (event: Event) => { event.preventDefault(); sheetCloseRef.current?.focus(); },\n onCloseAutoFocus: (event: Event) => { event.preventDefault(); inputRef.current?.focus(); },\n } : {};\n return (\n <div\n className={cn(\"relative w-full overflow-visible\", className)}\n ref={(node) => {\n rootRef.current = node;\n (\n clickOutsideRef as React.MutableRefObject<HTMLDivElement | null>\n ).current = node;\n }}\n >\n {label ? (\n <Label\n label={label}\n required={required}\n labelAddon={labelAddon}\n />\n ) : null}\n\n {multiple ? (\n // ---------- MULTI: chips inline inside the box ----------\n <div\n className={cn(\n \"relative flex min-h-form-control w-full flex-wrap items-center gap-1 rounded-control-lg border border-input bg-background px-[0.75em] pr-10 hover:border-input-hover\",\n fieldClassName,\n )}\n {...fieldFocusProps}\n onClick={() => {\n setIsOpen(true);\n if (!suppressMobileKeyboard) {\n inputRef.current?.focus();\n }\n }}\n >\n {(value ?? []).map((id) => {\n const label = flatOptions.find((o) => o.id === id)?.name ?? String(id);\n return (\n <span\n key={String(id)}\n className=\"my-0.5 flex items-center gap-1 rounded-control-sm border border-input bg-muted px-2 text-xs\"\n >\n {label}\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"xs\"\n className=\"ml-1 h-5 min-h-0 w-5 p-0 hover:bg-muted\"\n onClick={(event) => { event.stopPropagation(); removeAt(id); }}\n aria-label={`Remove ${label}`}\n >\n <X className=\"h-3.5 w-3.5\" />\n </Button>\n </span>\n );\n })}\n <input\n id={inputId}\n ref={inputRef}\n value={query}\n onChange={(e) => {\n setQuery(e.target.value);\n setIsOpen(true);\n }}\n onBlur={() => {\n if (useMobileSheet) return;\n // Delay slightly to let dropdown option clicks register first\n setTimeout(() => {\n if (Date.now() - lastSelectionRef.current < 250) {\n return;\n }\n if (allowCustomValue && query.trim().length > 0) {\n const text = query.trim();\n const exact = findExactOption(text);\n const nextId = exact ? exact.id : (text as unknown as ID);\n setter(Array.from(new Set([...(value ?? []), nextId])));\n setQuery(\"\");\n }\n }, 150);\n }}\n onKeyDown={onMultiKeyDown}\n onFocus={() => { if (!useMobileSheet) setIsOpen(true); }}\n readOnly={suppressMobileKeyboard}\n placeholder={(value?.length ?? 0) === 0 ? placeholder : \"\"}\n className={cn(\n \"h-[calc(var(--spacing-form-control)-2px)] min-w-[8ch] flex-1 border-none bg-transparent p-0 text-base outline-none focus:ring-0\",\n \"placeholder:text-muted-foreground/40\",\n )}\n {...props}\n />\n <ChevronDown\n className={cn(\n \"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground transition-transform duration-interactive ease-out-strong motion-reduce:transition-none\",\n isOpen && \"rotate-180\",\n )}\n aria-hidden=\"true\"\n />\n </div>\n ) : (\n // ---------- SINGLE: regular input ----------\n decorateSingleInput(\n <Input\n id={inputId}\n value={singleDisplay || query}\n className={cn(\n \"border-input\",\n inputIcons === \"search\" || inputIcons === \"dropdown\" ? \"pr-10\" : inputIcons && \"px-10\",\n )}\n placeholder={placeholder}\n readOnly={suppressMobileKeyboard}\n onChange={(e) => {\n const nextQuery = e.target.value;\n\n if ((value?.length ?? 0) > 0) {\n setter([]);\n }\n\n const exact = findExactOption(nextQuery);\n // Only auto-fill on an exact NAME match; keyword/acronym matches\n // (e.g. \"dlsu\") require an explicit Enter, blur, or click.\n if (\n exact &&\n exact.name.trim().toLowerCase() ===\n nextQuery.trim().toLowerCase()\n ) {\n setter([exact.id]);\n setQuery(\"\");\n } else {\n setQuery(nextQuery);\n }\n\n setIsOpen(true);\n }}\n onFocus={() => { if (!useMobileSheet) setIsOpen(true); }}\n onClick={(e) => {\n setIsOpen(true);\n if (suppressMobileKeyboard) {\n e.currentTarget.blur();\n }\n }}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" && resolveQuerySelection(query, true)) {\n setIsOpen(false);\n e.preventDefault();\n }\n }}\n onBlur={() => {\n if (useMobileSheet) return;\n // slight delay to let dropdown option clicks register first\n setTimeout(() => {\n if (Date.now() - lastSelectionRef.current < 250) {\n return;\n }\n if (!resolveQuerySelection(query, false)) setQuery(\"\");\n }, 150);\n }}\n />,\n )\n )}\n\n {isOpen && (\n <Sheet open={useMobileSheet && isOpen} onOpenChange={next => { if (!next) { setQuery(''); setIsOpen(false); } }}>\n <OptionsSurface\n {...sheetProps}\n ref={useMobileSheet ? sheetRef : undefined}\n role={useMobileSheet ? \"dialog\" : undefined}\n aria-modal={useMobileSheet ? true : undefined}\n aria-label={useMobileSheet ? (typeof label === \"string\" ? label : \"Choose options\") : undefined}\n className={cn(\n \"bg-background text-sm shadow-card border border-border\",\n useMobileSheet\n ? \"fixed left-0 right-0 z-[1100] flex flex-col gap-0 overflow-hidden rounded-t-control-lg border-b-0 p-0\"\n : \"absolute left-0 right-0 z-50 mt-1 max-h-[400px] overflow-y-auto overscroll-contain rounded-control-lg\",\n )}\n style={\n useMobileSheet\n ? {\n bottom: sheetViewport?.bottom ?? 0,\n maxHeight: sheetViewport ? Math.min(sheetViewport.height, 640) : \"80dvh\",\n }\n : undefined\n }\n >\n {useMobileSheet && (\n <div className=\"shrink-0 px-4 pb-3 pt-4\">\n <div className=\"mb-3 flex items-center justify-between gap-4\">\n <SheetTitle className=\"text-base font-semibold text-foreground\">{label || \"Choose options\"}</SheetTitle>\n <button ref={sheetCloseRef} type=\"button\" aria-label=\"Close options\" className=\"-mr-3 flex h-11 w-11 shrink-0 items-center justify-center rounded-control-lg text-muted-foreground hover:bg-muted\" onClick={() => { setQuery(\"\"); setIsOpen(false); }}>\n <X className=\"h-5 w-5\" aria-hidden=\"true\" />\n </button>\n </div>\n <Input\n ref={sheetInputRef}\n aria-label={typeof label === \"string\" ? `Search ${label}` : \"Search options\"}\n value={query}\n placeholder={placeholder ?? \"Search\"}\n className=\"h-10 min-h-10 max-h-none text-base\"\n onChange={(e) => {\n setQuery(e.target.value);\n setIsOpen(true);\n if ((value?.length ?? 0) > 0 && !multiple) {\n setter([]);\n }\n }}\n onKeyDown={(e) => {\n if (multiple) {\n onMultiKeyDown(e);\n return;\n }\n\n if (e.key === \"Enter\" && resolveQuerySelection(query)) {\n setIsOpen(false);\n e.preventDefault();\n }\n\n if (e.key === \"Escape\") {\n setIsOpen(false);\n }\n }}\n />\n </div>\n )}\n <ul className={cn(useMobileSheet && \"min-h-0 flex-1 overflow-y-auto overscroll-contain\")}>\n {allowCustomValue && (\n <li className=\"w-full text-left px-4 py-2 text-sm text-muted-foreground bg-muted pointer-events-none\">\n Suggestions\n </li>\n )}\n {filtered.length ? (\n filtered.map((option, index) => {\n const active = selectedSet.has(option.id);\n const group = options.find((item) => item.children?.some((child) => child.id === option.id));\n const firstInGroup = group && !filtered.slice(0, index).some((item) => group.children?.some((child) => child.id === item.id));\n return (\n <Fragment key={String(option.id)}>\n {firstInGroup && group && (\n <li>\n {multiple ? (\n <button type=\"button\" aria-pressed={group.children!.every((child) => selectedSet.has(child.id))} className=\"flex min-h-11 w-full items-center gap-2 px-4 py-2 text-left text-sm font-medium text-foreground hover:bg-muted\" onClick={() => {\n const ids = group.children!.map((child) => child.id);\n const next = new Set(value ?? []);\n const allSelected = ids.every((id) => next.has(id));\n ids.forEach((id) => allSelected ? next.delete(id) : next.add(id));\n setter(Array.from(next));\n }}>\n <CheckboxVisual checked={group.children!.every((child) => selectedSet.has(child.id)) ? true : group.children!.some((child) => selectedSet.has(child.id)) ? 'indeterminate' : false} />\n {group.name}\n </button>\n ) : <div className=\"px-4 py-2 text-sm font-medium text-foreground\">{group.name}</div>}\n </li>\n )}\n <li>\n <button\n type=\"button\"\n aria-pressed={multiple ? active : undefined}\n onClick={() => {\n toggle(option.id);\n if (multiple) {\n // keep open for rapid multi-pick\n setQuery(\"\");\n if (!useMobileSheet) {\n inputRef.current?.focus();\n }\n } else {\n setQuery(\"\");\n setIsOpen(false);\n }\n }}\n className={cn(\n \"w-full text-left px-4 py-2 text-sm text-muted-foreground transition-colors flex items-center gap-2 cursor-pointer hover:bg-muted\",\n useMobileSheet && \"min-h-12\",\n group && \"pl-8\",\n active && \"bg-primary-tint\",\n )}\n >\n {multiple ? (\n <CheckboxVisual checked={active} />\n ) : null}\n {option.name}\n </button>\n </li>\n </Fragment>\n );\n })\n ) : (\n !allowCustomValue || !query.trim() ? (\n <li className=\"w-full text-left px-4 py-2 text-sm text-muted-foreground\">\n {emptyText}\n </li>\n ) : null\n )}\n {allowCustomValue && query.trim() && !findExactOption(query) && (\n <li>\n <button\n type=\"button\"\n className=\"flex min-h-11 w-full items-center gap-2 px-4 py-2 text-left text-sm text-primary hover:bg-muted focus-visible:outline-2 focus-visible:outline-primary\"\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => {\n const text = query.trim();\n if (multiple) {\n setter(Array.from(new Set([...(value ?? []), text as unknown as ID])));\n setQuery(\"\");\n } else {\n resolveQuerySelection(text);\n setIsOpen(false);\n }\n }}\n >\n <PlusCircleIcon className=\"h-4 w-4\" aria-hidden=\"true\" />\n Add “{query.trim()}”\n </button>\n </li>\n )}\n </ul>\n {useMobileSheet && multiple && (\n <div className=\"shrink-0 border-t border-border bg-background px-4 pt-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]\">\n <Button\n type=\"button\"\n variant=\"outline\"\n className=\"min-h-11 w-full\"\n onClick={() => {\n setQuery(\"\");\n setIsOpen(false);\n }}\n >\n Done\n </Button>\n </div>\n )}\n </OptionsSurface>\n </Sheet>\n )}\n </div>\n );\n}\n\ntype AutocompleteCommonProps<ID extends number | string> = {\n required?: boolean;\n options: IAutocompleteOption<ID>[];\n placeholder?: string;\n className?: string;\n label?: React.ReactNode;\n props?: any[];\n /** Allow a user to add their own text. Custom values are strings. */\n allowCustomValue?: boolean;\n preserveOptionOrder?: boolean;\n emptyText?: string;\n mobileDropdownMode?: MobileDropdownMode;\n inputIcons?: InputIcons;\n};\n\nexport type AutocompleteProps<ID extends number | string> = AutocompleteCommonProps<ID> & (\n | { multiple?: false; value?: ID | null; setter: (value?: ID | null) => void }\n | { multiple: true; value?: ID[]; setter: (value: ID[]) => void }\n);\n\nexport const Autocomplete = <ID extends number | string>(config: AutocompleteProps<ID>) => {\n const { required, options, placeholder, className, label, props, allowCustomValue = false,\n preserveOptionOrder = false, emptyText, mobileDropdownMode, inputIcons } = config;\n return (\n <AutocompleteBase<ID>\n required={required}\n options={options}\n multiple={config.multiple === true}\n value={config.multiple === true ? config.value ?? [] : config.value != null ? [config.value] : []}\n setter={(arr) => {\n if (config.multiple === true) config.setter(arr);\n else config.setter(arr[0] ?? null);\n }}\n placeholder={placeholder}\n className={className}\n label={label}\n allowCustomValue={allowCustomValue}\n preserveOptionOrder={preserveOptionOrder}\n emptyText={emptyText}\n mobileDropdownMode={mobileDropdownMode}\n inputIcons={inputIcons}\n {...props}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA+BA;;AAE0D;AAC1D;;;;AAmCE;;;;AAII;;;;AAGH;AACD;AACA;AACA;AACA;AACA;AACA;;;AAIA;AACA;AAKA;;AAEE;AAGI;AAEN;;AAGE;AACA;AAAW;;AAGT;;;AAKA;;AAEA;;;AAIA;;AAEA;;AAGF;AACF;AAEA;AAEA;;;;AAMY;AACA;;AAGV;AACE;;;AAIJ;AACE;;AAEE;;;;;;AAMF;AAAiB;;AACZ;;AAEP;AAEA;;AAEE;;AAEF;;AAKO;AACC;AACA;AACF;AACC;AAIP;AACA;;AAEA;;AAIE;;;;;;AAOE;;;;;AAMA;AACF;AAEA;AACA;;;AAIA;AACE;;;AASF;AACF;AAEA;;AAIA;AACE;;;AAEE;AACA;AACA;;AAEA;;;;;;;AAOF;;;;;;;AASA;AACE;;AAEE;;;;;;AAMJ;;AACA;;AACF;;;;;AAwCA;AACE;AACA;AACA;AACA;;;;AAIF;AAIM;AAEE;AAEJ;;AAYE;;;AASM;;AAEJ;;AAIE;;AAwBE;;AAEF;AAEE;;;;;;;;AAOI;AACA;AACA;;;;;AAKN;AAEsC;;;AA8BpC;;;;AAMA;;;AAGA;AAEE;AACE;AAEF;;;;;;;;AAQkC;;;AAIlC;;AAEJ;AAEE;;;;AAIF;AAEE;;;;;;;AAME;;;;;;AAQoG;AAUnG;AACA;AAID;AACI;AACA;AACD;;AAmBC;;AAEA;;;AAGF;;;;;;;;;AAYE;;;AAGF;;AAaF;AACA;;AAOU;;AAEA;AACA;;;AAcJ;;;;;AAKI;;;;;;;;AAsBZ;AAeM;;;;;;;;;;;;;AAoCpB;AAsBO;AACL;AAEA;AAOM;AAA8B;;;AAEhC;AAYN;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"avatar.js","sources":["../../src/components/avatar.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as AvatarPrimitive from '@radix-ui/react-avatar';\r\n\r\nimport { cn } from '@/utils';\r\n\r\nfunction Avatar({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof AvatarPrimitive.Root>) {\r\n return (\r\n <AvatarPrimitive.Root\r\n data-slot=\"avatar\"\r\n className={cn(\r\n 'relative flex size-8 shrink-0 overflow-hidden rounded-full',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction AvatarImage({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof AvatarPrimitive.Image>) {\r\n return (\r\n <AvatarPrimitive.Image\r\n data-slot=\"avatar-image\"\r\n className={cn('aspect-square size-full', className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction AvatarFallback({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {\r\n return (\r\n <AvatarPrimitive.Fallback\r\n data-slot=\"avatar-fallback\"\r\n className={cn(\r\n 'bg-muted flex size-full items-center justify-center rounded-full',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nexport { Avatar, AvatarImage, AvatarFallback };\r\n"],"names":["_jsx"],"mappings":";;;;AAKA,SAAS,MAAM,CAAC,EACd,SAAS,EACT,GAAG,KAAK,EAC0C,EAAA;IAClD,QACEA,IAAC,eAAe,CAAC,IAAI,EAAA,EAAA,WAAA,EACT,QAAQ,EAClB,SAAS,EAAE,EAAE,CACX,4DAA4D,EAC5D,SAAS,CACV,KACG,KAAK,EAAA,CACT;AAEN;AAEA,SAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EAC2C,EAAA;IACnD,QACEA,IAAC,eAAe,CAAC,KAAK,EAAA,EAAA,WAAA,EACV,cAAc,EACxB,SAAS,EAAE,EAAE,CAAC,yBAAyB,EAAE,SAAS,CAAC,KAC/C,KAAK,EAAA,CACT;AAEN;AAEA,SAAS,cAAc,CAAC,EACtB,SAAS,EACT,GAAG,KAAK,EAC8C,EAAA;IACtD,QACEA,IAAC,eAAe,CAAC,QAAQ,EAAA,EAAA,WAAA,EACb,iBAAiB,EAC3B,SAAS,EAAE,EAAE,CACX,kEAAkE,EAClE,SAAS,CACV,KACG,KAAK,EAAA,CACT;AAEN;;;;"}
1
+ {"version":3,"file":"avatar.js","sources":["../../src/components/avatar.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as AvatarPrimitive from '@radix-ui/react-avatar';\n\nimport { cn } from '@/utils';\n\nfunction Avatar({\n className,\n ...props\n}: React.ComponentProps<typeof AvatarPrimitive.Root>) {\n return (\n <AvatarPrimitive.Root\n data-slot=\"avatar\"\n className={cn(\n 'relative flex size-8 shrink-0 overflow-hidden rounded-full',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction AvatarImage({\n className,\n ...props\n}: React.ComponentProps<typeof AvatarPrimitive.Image>) {\n return (\n <AvatarPrimitive.Image\n data-slot=\"avatar-image\"\n className={cn('aspect-square size-full', className)}\n {...props}\n />\n );\n}\n\nfunction AvatarFallback({\n className,\n ...props\n}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {\n return (\n <AvatarPrimitive.Fallback\n data-slot=\"avatar-fallback\"\n className={cn(\n 'bg-muted flex size-full items-center justify-center rounded-full',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Avatar, AvatarImage, AvatarFallback };\n"],"names":["_jsx"],"mappings":";;;;AAKA,SAAS,MAAM,CAAC,EACd,SAAS,EACT,GAAG,KAAK,EAC0C,EAAA;IAClD,QACEA,IAAC,eAAe,CAAC,IAAI,EAAA,EAAA,WAAA,EACT,QAAQ,EAClB,SAAS,EAAE,EAAE,CACX,4DAA4D,EAC5D,SAAS,CACV,KACG,KAAK,EAAA,CACT;AAEN;AAEA,SAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EAC2C,EAAA;IACnD,QACEA,IAAC,eAAe,CAAC,KAAK,EAAA,EAAA,WAAA,EACV,cAAc,EACxB,SAAS,EAAE,EAAE,CAAC,yBAAyB,EAAE,SAAS,CAAC,KAC/C,KAAK,EAAA,CACT;AAEN;AAEA,SAAS,cAAc,CAAC,EACtB,SAAS,EACT,GAAG,KAAK,EAC8C,EAAA;IACtD,QACEA,IAAC,eAAe,CAAC,QAAQ,EAAA,EAAA,WAAA,EACb,iBAAiB,EAC3B,SAAS,EAAE,EAAE,CACX,kEAAkE,EAClE,SAAS,CACV,KACG,KAAK,EAAA,CACT;AAEN;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"badge.js","sources":["../../src/components/badge.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport { cva, type VariantProps } from 'class-variance-authority';\r\n\r\nimport { cn } from '@/utils';\r\n\r\nconst badgeVariants = cva(\r\n [\r\n 'border',\r\n 'cursor-default',\r\n 'font-semibold',\r\n 'inline-flex',\r\n 'items-center',\r\n 'px-[0.75em]',\r\n 'py-[0.25em]',\r\n 'rounded-full',\r\n 'select-none',\r\n 'text-xs',\r\n 'transition-colors duration-state ease-out-strong motion-reduce:transition-none',\r\n 'whitespace-nowrap',\r\n ],\r\n {\r\n variants: {\r\n variant: {\r\n outline: ['bg-transparent', 'border-opacity-70'],\r\n solid: ['border-transparent'],\r\n // Tinted pill: the landing's tag/work-mode style.\r\n soft: ['border-transparent', 'font-medium'],\r\n },\r\n type: {\r\n default: [],\r\n primary: [],\r\n secondary: [],\r\n supportive: [],\r\n warning: [],\r\n destructive: [],\r\n },\r\n },\r\n compoundVariants: [\r\n {\r\n variant: 'outline',\r\n type: 'default',\r\n class: 'border-border-hover text-muted-foreground',\r\n },\r\n {\r\n variant: 'outline',\r\n type: 'secondary',\r\n class: 'border-secondary-border text-secondary-foreground',\r\n },\r\n {\r\n variant: 'soft',\r\n type: 'default',\r\n class: 'bg-muted text-muted-foreground',\r\n },\r\n {\r\n variant: 'soft',\r\n type: 'primary',\r\n class: 'bg-primary-tint text-primary',\r\n },\r\n {\r\n variant: 'soft',\r\n type: 'secondary',\r\n class: 'bg-secondary text-secondary-foreground',\r\n },\r\n // Status colours are mid-tones, too light as text on their own tint\r\n // (supportive 2.7:1, warning 2.3:1), so those two are darkened.\r\n {\r\n variant: 'soft',\r\n type: 'supportive',\r\n class:\r\n 'bg-supportive/10 text-[color-mix(in_oklab,var(--color-supportive),black_25%)]',\r\n },\r\n {\r\n variant: 'soft',\r\n type: 'warning',\r\n class:\r\n 'bg-warning/10 text-[color-mix(in_oklab,var(--color-warning),black_30%)]',\r\n },\r\n {\r\n variant: 'soft',\r\n type: 'destructive',\r\n class: 'bg-destructive/10 text-destructive',\r\n },\r\n {\r\n variant: 'solid',\r\n type: 'secondary',\r\n class: 'bg-landing-secondary-border text-landing-navy',\r\n },\r\n {\r\n variant: 'outline',\r\n type: 'primary',\r\n class: 'border-primary/80 text-primary',\r\n },\r\n {\r\n variant: 'outline',\r\n type: 'supportive',\r\n class: 'border-supportive/80 text-supportive',\r\n },\r\n {\r\n variant: 'outline',\r\n type: 'warning',\r\n class: 'border-warning/80 text-warning',\r\n },\r\n {\r\n variant: 'outline',\r\n type: 'destructive',\r\n class: 'border-destructive/80 text-destructive',\r\n },\r\n { variant: 'solid', type: 'default', class: 'bg-muted text-foreground' },\r\n {\r\n variant: 'solid',\r\n type: 'primary',\r\n class: 'bg-primary text-primary-foreground',\r\n },\r\n {\r\n variant: 'solid',\r\n type: 'supportive',\r\n class: 'bg-supportive text-supportive-foreground',\r\n },\r\n {\r\n variant: 'solid',\r\n type: 'warning',\r\n class: 'bg-warning text-warning-foreground',\r\n },\r\n {\r\n variant: 'solid',\r\n type: 'destructive',\r\n class: 'bg-destructive text-destructive-foreground',\r\n },\r\n ],\r\n defaultVariants: {\r\n variant: 'soft',\r\n type: 'default',\r\n },\r\n },\r\n);\r\n\r\nexport interface BadgeProps\r\n extends\r\n React.HTMLAttributes<HTMLDivElement>,\r\n VariantProps<typeof badgeVariants> {}\r\n\r\nexport function Badge({\r\n className,\r\n variant,\r\n type,\r\n ...props\r\n}: BadgeProps) {\r\n return (\r\n <div\r\n className={cn(badgeVariants({ variant, type }), className)}\r\n {...props}\r\n />\r\n );\r\n}\r\nBadge.displayName = 'Badge';\r\n"],"names":["_jsx"],"mappings":";;;;AAKA,MAAM,aAAa,GAAG,GAAG,CACvB;IACE,QAAQ;IACR,gBAAgB;IAChB,eAAe;IACf,aAAa;IACb,cAAc;IACd,aAAa;IACb,aAAa;IACb,cAAc;IACd,aAAa;IACb,SAAS;IACT,gFAAgF;IAChF,mBAAmB;CACpB,EACD;AACE,IAAA,QAAQ,EAAE;AACR,QAAA,OAAO,EAAE;AACP,YAAA,OAAO,EAAE,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;YAChD,KAAK,EAAE,CAAC,oBAAoB,CAAC;;AAE7B,YAAA,IAAI,EAAE,CAAC,oBAAoB,EAAE,aAAa,CAAC;AAC5C,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,OAAO,EAAE,EAAE;AACX,YAAA,OAAO,EAAE,EAAE;AACX,YAAA,SAAS,EAAE,EAAE;AACb,YAAA,UAAU,EAAE,EAAE;AACd,YAAA,OAAO,EAAE,EAAE;AACX,YAAA,WAAW,EAAE,EAAE;AAChB,SAAA;AACF,KAAA;AACD,IAAA,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tsx"],"sourcesContent":["import * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '@/utils';\n\nconst badgeVariants = cva(\n [\n 'border',\n 'cursor-default',\n 'font-semibold',\n 'inline-flex',\n 'items-center',\n 'px-[0.75em]',\n 'py-[0.25em]',\n 'rounded-full',\n 'select-none',\n 'text-xs',\n 'transition-colors duration-state ease-out-strong motion-reduce:transition-none',\n 'whitespace-nowrap',\n ],\n {\n variants: {\n variant: {\n outline: ['bg-transparent', 'border-opacity-70'],\n solid: ['border-transparent'],\n // Tinted pill: the landing's tag/work-mode style.\n soft: ['border-transparent', 'font-medium'],\n },\n type: {\n default: [],\n primary: [],\n secondary: [],\n supportive: [],\n warning: [],\n destructive: [],\n },\n },\n compoundVariants: [\n {\n variant: 'outline',\n type: 'default',\n class: 'border-border-hover text-muted-foreground',\n },\n {\n variant: 'outline',\n type: 'secondary',\n class: 'border-secondary-border text-secondary-foreground',\n },\n {\n variant: 'soft',\n type: 'default',\n class: 'bg-muted text-muted-foreground',\n },\n {\n variant: 'soft',\n type: 'primary',\n class: 'bg-primary-tint text-primary',\n },\n {\n variant: 'soft',\n type: 'secondary',\n class: 'bg-secondary text-secondary-foreground',\n },\n // Status colours are mid-tones, too light as text on their own tint\n // (supportive 2.7:1, warning 2.3:1), so those two are darkened.\n {\n variant: 'soft',\n type: 'supportive',\n class:\n 'bg-supportive/10 text-[color-mix(in_oklab,var(--color-supportive),black_25%)]',\n },\n {\n variant: 'soft',\n type: 'warning',\n class:\n 'bg-warning/10 text-[color-mix(in_oklab,var(--color-warning),black_30%)]',\n },\n {\n variant: 'soft',\n type: 'destructive',\n class: 'bg-destructive/10 text-destructive',\n },\n {\n variant: 'solid',\n type: 'secondary',\n class: 'bg-landing-secondary-border text-landing-navy',\n },\n {\n variant: 'outline',\n type: 'primary',\n class: 'border-primary/80 text-primary',\n },\n {\n variant: 'outline',\n type: 'supportive',\n class: 'border-supportive/80 text-supportive',\n },\n {\n variant: 'outline',\n type: 'warning',\n class: 'border-warning/80 text-warning',\n },\n {\n variant: 'outline',\n type: 'destructive',\n class: 'border-destructive/80 text-destructive',\n },\n { variant: 'solid', type: 'default', class: 'bg-muted text-foreground' },\n {\n variant: 'solid',\n type: 'primary',\n class: 'bg-primary text-primary-foreground',\n },\n {\n variant: 'solid',\n type: 'supportive',\n class: 'bg-supportive text-supportive-foreground',\n },\n {\n variant: 'solid',\n type: 'warning',\n class: 'bg-warning text-warning-foreground',\n },\n {\n variant: 'solid',\n type: 'destructive',\n class: 'bg-destructive text-destructive-foreground',\n },\n ],\n defaultVariants: {\n variant: 'soft',\n type: 'default',\n },\n },\n);\n\nexport interface BadgeProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof badgeVariants> {}\n\nexport function Badge({\n className,\n variant,\n type,\n ...props\n}: BadgeProps) {\n return (\n <div\n className={cn(badgeVariants({ variant, type }), className)}\n {...props}\n />\n );\n}\nBadge.displayName = 'Badge';\n"],"names":["_jsx"],"mappings":";;;;AAKA,MAAM,aAAa,GAAG,GAAG,CACvB;IACE,QAAQ;IACR,gBAAgB;IAChB,eAAe;IACf,aAAa;IACb,cAAc;IACd,aAAa;IACb,aAAa;IACb,cAAc;IACd,aAAa;IACb,SAAS;IACT,gFAAgF;IAChF,mBAAmB;CACpB,EACD;AACE,IAAA,QAAQ,EAAE;AACR,QAAA,OAAO,EAAE;AACP,YAAA,OAAO,EAAE,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;YAChD,KAAK,EAAE,CAAC,oBAAoB,CAAC;;AAE7B,YAAA,IAAI,EAAE,CAAC,oBAAoB,EAAE,aAAa,CAAC;AAC5C,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,OAAO,EAAE,EAAE;AACX,YAAA,OAAO,EAAE,EAAE;AACX,YAAA,SAAS,EAAE,EAAE;AACb,YAAA,UAAU,EAAE,EAAE;AACd,YAAA,OAAO,EAAE,EAAE;AACX,YAAA,WAAW,EAAE,EAAE;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1 +1 @@
1
- {"version":3,"file":"banner.js","sources":["../../src/components/banner.tsx"],"sourcesContent":["import { isValidElement, type ComponentProps, type ReactNode } from \"react\";\r\nimport type { LucideIcon } from \"lucide-react\";\r\nimport { cn } from \"@/utils\";\r\n\r\ntype BannerVariant = \"neutral\" | \"primary\" | \"warning\" | \"destructive\" | \"banner\";\r\n\r\nconst variantClasses: Record<\r\n BannerVariant,\r\n { container: string; icon: string }\r\n> = {\r\n banner: {\r\n container: 'border-secondary-border bg-secondary text-secondary-foreground',\r\n icon: 'bg-secondary text-secondary-foreground',\r\n },\r\n neutral: {\r\n container: 'border-landing-control bg-background text-landing-nav',\r\n icon: 'bg-v2-surface-subtle text-landing-nav',\r\n },\r\n primary: {\r\n container:\r\n \"border-primary/25 bg-primary/[0.035] transition-colors duration-state ease-out-strong hover:bg-primary/[0.06] motion-reduce:transition-none\",\r\n icon: \"bg-primary/5 text-primary\",\r\n },\r\n warning: {\r\n container:\r\n \"border-warning/30 bg-warning/10 transition-colors duration-state ease-out-strong hover:bg-warning/15 motion-reduce:transition-none\",\r\n icon: \"bg-warning/10 text-warning\",\r\n },\r\n destructive: {\r\n container:\r\n \"border-destructive/30 bg-destructive/5 transition-colors duration-state ease-out-strong hover:bg-destructive/10 motion-reduce:transition-none\",\r\n icon: \"bg-destructive/10 text-destructive\",\r\n },\r\n};\r\n\r\nfunction Banner({\r\n icon: Icon,\r\n media,\r\n visual,\r\n visualClassName,\r\n title,\r\n description,\r\n action,\r\n actionClassName,\r\n variant = \"primary\",\r\n compact = false,\r\n className,\r\n ...props\r\n}: ComponentProps<\"div\"> & {\r\n /** Accepts a Lucide icon component or any custom React node. */\r\n icon?: LucideIcon | ReactNode;\r\n media?: ReactNode;\r\n visual?: ReactNode;\r\n visualClassName?: string;\r\n title: ReactNode;\r\n description?: ReactNode;\r\n action?: ReactNode;\r\n actionClassName?: string;\r\n variant?: BannerVariant;\r\n compact?: boolean;\r\n}) {\r\n const styles = variantClasses[variant];\r\n // The icon is optional: without one (or a custom media node) the slot is\r\n // dropped entirely rather than leaving an empty tinted square.\r\n const IconComponent = typeof Icon === 'function' || (Icon && typeof Icon === 'object' && !isValidElement(Icon)) ? Icon as LucideIcon : undefined;\r\n const leadingVisual = visual ?? media;\r\n const hasIconSlot = Boolean(leadingVisual || Icon);\r\n\r\n return (\r\n <div\r\n data-slot=\"banner\"\r\n className={cn(\r\n \"group/banner flex flex-col rounded-control-lg border\",\r\n compact\r\n ? \"items-start gap-3 p-3 sm:flex-row sm:items-start sm:gap-2\"\r\n : \"gap-4 px-4 py-4 sm:flex-row sm:items-stretch sm:gap-3 sm:px-5\",\r\n styles.container,\r\n className,\r\n )}\r\n {...props}\r\n >\r\n <div\r\n className={cn(\r\n \"flex min-w-0 flex-1 items-start gap-3 sm:items-stretch sm:gap-3\",\r\n compact && \"gap-2 sm:items-start sm:gap-2\",\r\n )}\r\n >\r\n {hasIconSlot && (\r\n <span\r\n className={cn(\r\n \"flex shrink-0 items-center justify-center rounded-control-lg\",\r\n compact ? \"size-8\" : \"size-10 sm:self-center\",\r\n styles.icon,\r\n visualClassName,\r\n )}\r\n >\r\n {leadingVisual ??\r\n (IconComponent ? (\r\n <IconComponent\r\n className={compact ? \"size-4\" : \"size-5\"}\r\n aria-hidden=\"true\"\r\n />\r\n ) : isValidElement(Icon) ? Icon : (Icon as ReactNode))}\r\n </span>\r\n )}\r\n <div\r\n className={cn(\r\n \"min-w-0 flex-1\",\r\n description ? \"space-y-0.5\" : \"flex flex-col justify-center\",\r\n )}\r\n >\r\n <p className={cn(\"text-sm font-medium\", variant === 'banner' ? 'text-secondary-foreground' : 'text-foreground')}>{title}</p>\r\n {description && (\r\n <div className={cn(\"text-sm\", variant === 'banner' ? 'text-secondary-foreground' : 'text-muted-foreground')}>{description}</div>\r\n )}\r\n </div>\r\n </div>\r\n {action && (\r\n <div\r\n className={cn(\r\n \"w-full shrink-0 sm:w-auto sm:self-center\",\r\n actionClassName,\r\n )}\r\n >\r\n {action}\r\n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e,CAChB,EAAA,QAAA,EAEA,MAAM,EAAA,CACH,CACP,CAAA,EAAA,CACG;AAEV;;;;"}
1
+ {"version":3,"file":"banner.js","sources":["../../src/components/banner.tsx"],"sourcesContent":["import { isValidElement, type ComponentProps, type ReactNode } from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\nimport { cn } from \"@/utils\";\n\ntype BannerVariant = \"neutral\" | \"primary\" | \"warning\" | \"destructive\" | \"banner\";\n\nconst variantClasses: Record<\n BannerVariant,\n { container: string; icon: string }\n> = {\n banner: {\n container: 'border-secondary-border bg-secondary text-secondary-foreground',\n icon: 'bg-secondary text-secondary-foreground',\n },\n neutral: {\n container: 'border-landing-control bg-background text-landing-nav',\n icon: 'bg-v2-surface-subtle text-landing-nav',\n },\n primary: {\n container:\n \"border-primary/25 bg-primary/[0.035] transition-colors duration-state ease-out-strong hover:bg-primary/[0.06] motion-reduce:transition-none\",\n icon: \"bg-primary/5 text-primary\",\n },\n warning: {\n container:\n \"border-warning/30 bg-warning/10 transition-colors duration-state ease-out-strong hover:bg-warning/15 motion-reduce:transition-none\",\n icon: \"bg-warning/10 text-warning\",\n },\n destructive: {\n container:\n \"border-destructive/30 bg-destructive/5 transition-colors duration-state ease-out-strong hover:bg-destructive/10 motion-reduce:transition-none\",\n icon: \"bg-destructive/10 text-destructive\",\n },\n};\n\nfunction Banner({\n icon: Icon,\n media,\n visual,\n visualClassName,\n title,\n description,\n action,\n actionClassName,\n variant = \"primary\",\n compact = false,\n className,\n ...props\n}: ComponentProps<\"div\"> & {\n /** Accepts a Lucide icon component or any custom React node. */\n icon?: LucideIcon | ReactNode;\n media?: ReactNode;\n visual?: ReactNode;\n visualClassName?: string;\n title: ReactNode;\n description?: ReactNode;\n action?: ReactNode;\n actionClassName?: string;\n variant?: BannerVariant;\n compact?: boolean;\n}) {\n const styles = variantClasses[variant];\n // The icon is optional: without one (or a custom media node) the slot is\n // dropped entirely rather than leaving an empty tinted square.\n const IconComponent = typeof Icon === 'function' || (Icon && typeof Icon === 'object' && !isValidElement(Icon)) ? Icon as LucideIcon : undefined;\n const leadingVisual = visual ?? media;\n const hasIconSlot = Boolean(leadingVisual || Icon);\n\n return (\n <div\n data-slot=\"banner\"\n className={cn(\n \"group/banner flex flex-col rounded-control-lg border\",\n compact\n ? \"items-start gap-3 p-3 sm:flex-row sm:items-start sm:gap-2\"\n : \"gap-4 px-4 py-4 sm:flex-row sm:items-stretch sm:gap-3 sm:px-5\",\n styles.container,\n className,\n )}\n {...props}\n >\n <div\n className={cn(\n \"flex min-w-0 flex-1 items-start gap-3 sm:items-stretch sm:gap-3\",\n compact && \"gap-2 sm:items-start sm:gap-2\",\n )}\n >\n {hasIconSlot && (\n <span\n className={cn(\n \"flex shrink-0 items-center justify-center rounded-control-lg\",\n compact ? \"size-8\" : \"size-10 sm:self-center\",\n styles.icon,\n visualClassName,\n )}\n >\n {leadingVisual ??\n (IconComponent ? (\n <IconComponent\n className={compact ? \"size-4\" : \"size-5\"}\n aria-hidden=\"true\"\n />\n ) : isValidElement(Icon) ? Icon : (Icon as ReactNode))}\n </span>\n )}\n <div\n className={cn(\n \"min-w-0 flex-1\",\n description ? \"space-y-0.5\" : \"flex flex-col justify-center\",\n )}\n >\n <p className={cn(\"text-sm font-medium\", variant === 'banner' ? 'text-secondary-foreground' : 'text-foreground')}>{title}</p>\n {description && (\n <div className={cn(\"text-sm\", variant === 'banner' ? 'text-secondary-foreground' : 'text-muted-foreground')}>{description}</div>\n )}\n </div>\n </div>\n {action && (\n <div\n className={cn(\n \"w-full shrink-0 sm:w-auto sm:self-center\",\n actionClassName,\n )}\n >\n {action}\n </div>\n )}\n </div>\n );\n}\n\nexport { Banner, type BannerVariant };\n"],"names":["_jsxs","_jsx"],"mappings":";;;;AAMA,MAAM,cAAc,GAGhB;AACF,IAAA,MAAM,EAAE;AACN,QAAA,SAAS,EAAE,gEAAgE;AAC3E,QAAA,IAAI,EAAE,wCAAwC;AAC/C,KAAA;AACD,IAAA,OAAO,EAAE;AAC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VC,GAAA,CAAA,MAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,8DAA8D,EAC9D,OAAO,GAAG,QAAQ,GAAG,wBAAwB,EAC7C,MAAM,CAAC,IAAI,EACX,eAAe,CAChB,EAAA,QAAA,EAEA,aAAa;AACZ,6BAAC,aAAa,IACZA,GAAA,CAAC,aAAa,EAAA,EACZ,SAAS,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,EAAA,aAAA,EAC5B,MAAM,EAAA,CAClB,IACA,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,GAAI,IAAkB,CAAC,EAAA,CACnD,CACR,EACDD,IAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,gBAAgB,EAChB,WAAW,GAAG,aAAa,GAAG,8BAA8B,CAC7D,EAAA,QAAA,EAAA,CAEDC,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAE,EAAE,CAAC,qBAAqB,EAAE,OAAO,KAAK,QAAQ,GAAG,2BAA2B,GAAG,iBAAiB,CAAC,EAAA,QAAA,EAAG,KAAK,EAAA,CAAK,EAC3H,WAAW,KACVA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,QAAQ,GAAG,2BAA2B,GAAG,uBAAuB,CAAC,EAAA,QAAA,EAAG,WAAW,EAAA,CAAO,CACjI,CAAA,EAAA,CACG,CAAA,EAAA,CACF,EACL,MAAM,KACLA,GAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,0CAA0C,EAC1C,eAAe,CAChB,EAAA,QAAA,EAEA,MAAM,EAAA,CACH,CACP,CAAA,EAAA,CACG;AAEV;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","sources":["../../src/components/button.tsx"],"sourcesContent":["import Link from 'next/link';\r\nimport type { ComponentPropsWithRef, ReactNode } from 'react';\r\nimport { cn } from '@/utils';\r\nimport { Spinner } from './loader';\r\nimport { interactiveControlClassName, interactiveControlTransitionClassName } from '@/lib/interaction-styles';\r\n\r\nexport type ButtonVariant = 'solid' | 'outline' | 'ghost' | 'link';\r\nexport type ButtonScheme = 'primary' | 'secondary' | 'neutral' | 'destructive' | 'success';\r\nexport type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\r\nexport type ButtonShape = 'rounded' | 'pill';\r\n\r\ntype ButtonAppearance = {\r\n /** Visual treatment. */\r\n variant?: ButtonVariant;\r\n /** Semantic color, independent of the fill treatment. Defaults to primary, or neutral for outline/ghost. */\r\n scheme?: ButtonScheme;\r\n /** Standard control size: 32px, 36px, 44px, 48px, 52px, or 56px minimum height. */\r\n size?: ButtonSize;\r\n /** Corner treatment. Landing presets keep their original shape when omitted. */\r\n shape?: ButtonShape;\r\n /** Additional classes, merged after the component's appearance classes. */\r\n className?: string;\r\n};\r\n\r\nconst schemes: Record<ButtonScheme, string> = {\r\n primary: '[--btn-fill:var(--color-landing-blue)] [--btn-on:white] [--btn-hover:var(--color-landing-blue-hover)] [--btn-ink:var(--color-landing-blue-hover)] [--btn-soft:var(--color-landing-tint)] [--btn-border:var(--color-landing-blue)]',\r\n secondary: '[--btn-fill:var(--color-landing-secondary-tint)] [--btn-on:var(--color-landing-secondary-deep)] [--btn-hover:var(--color-brand-secondary-hover)] [--btn-ink:var(--color-landing-secondary-deep)] [--btn-soft:var(--color-landing-secondary-tint)] [--btn-border:var(--color-landing-secondary-border)]',\r\n neutral: '[--btn-fill:var(--color-v2-surface-subtle)] [--btn-on:var(--color-landing-nav)] [--btn-hover:var(--color-landing-border)] [--btn-ink:var(--color-landing-nav)] [--btn-soft:rgb(55_65_81_/_6%)] [--btn-border:var(--color-landing-control)]',\r\n destructive: '[--btn-fill:var(--color-v2-destructive)] [--btn-on:white] [--btn-hover:var(--color-brand-destructive-hover)] [--btn-ink:var(--color-brand-destructive-hover)] [--btn-soft:var(--color-brand-destructive-soft)] [--btn-border:var(--color-v2-destructive)]',\r\n success: '[--btn-fill:var(--color-brand-success)] [--btn-on:white] [--btn-hover:var(--color-brand-success-hover)] [--btn-ink:var(--color-brand-success)] [--btn-soft:var(--color-brand-success-soft)] [--btn-border:var(--color-brand-success)]',\r\n};\r\nconst treatments: Record<ButtonVariant, string> = {\r\n solid: cn('border border-[var(--btn-border)] bg-[var(--btn-fill)] font-semibold text-[var(--btn-on)] enabled:pointer-fine:hover:border-[var(--btn-hover)] enabled:pointer-fine:hover:bg-[var(--btn-hover)] [&:is(a):hover]:bg-[var(--btn-hover)]', interactiveControlClassName),\r\n outline: cn('border border-[var(--btn-border)] bg-transparent text-[var(--btn-ink)] enabled:hover:bg-[var(--btn-soft)] [&:is(a):hover]:bg-[var(--btn-soft)]', interactiveControlClassName),\r\n ghost: 'border border-transparent bg-transparent text-[var(--btn-ink)] enabled:hover:bg-[var(--btn-soft)] [&:is(a):hover]:bg-[var(--btn-soft)]',\r\n link: 'border-0 bg-transparent text-[var(--btn-ink)] underline-offset-4 enabled:hover:underline [&:is(a):hover]:underline',\r\n};\r\nconst sizes: Record<ButtonSize, string> = {\r\n xs: 'min-h-8 px-2 text-xs leading-[1.5]',\r\n sm: 'min-h-9 px-3 text-sm leading-[1.5]',\r\n md: 'min-h-11 px-5 text-sm leading-[1.5]',\r\n lg: 'min-h-12 px-6 text-base leading-[1.5]',\r\n xl: 'min-h-13 px-7 text-base leading-[1.5]',\r\n '2xl': 'min-h-14 px-8 text-lg leading-[1.5]',\r\n};\r\n\r\n/** Shared styling for action and navigation controls. Colors never change the fill treatment. */\r\nexport function buttonClassName({variant = 'solid', scheme, size = 'md', shape, className}: ButtonAppearance = {}) {\r\n return cn(\r\n 'group group/button inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-control-lg font-[550] focus-visible:outline-3 focus-visible:outline-offset-4 focus-visible:outline-landing-blue disabled:pointer-events-none disabled:opacity-50 aria-disabled:cursor-default aria-busy:cursor-wait [&_svg]:shrink-0',\r\n interactiveControlTransitionClassName,\r\n schemes[scheme ?? (['outline', 'ghost'].includes(variant) ? 'neutral' : 'primary')],\r\n treatments[variant], sizes[size],\r\n variant === 'outline' && (scheme === undefined || scheme === 'neutral') && 'enabled:hover:border-landing-control-hover enabled:hover:text-landing-nav-hover [&:is(a):hover]:border-landing-control-hover',\r\n variant === 'outline' && scheme === 'secondary' && 'bg-[var(--btn-soft)]',\r\n shape === 'pill' && 'rounded-full', shape === 'rounded' && 'rounded-control-lg', className,\r\n );\r\n}\r\n\r\ntype IconOnlyProps = { iconOnly?: false } | { iconOnly: true; 'aria-label': string };\r\ntype ActionButtonProps = ComponentPropsWithRef<'button'> & ButtonAppearance & {\r\n href?: never;\r\n /** Shows a progress indicator, exposes aria-busy, and disables the action while work is pending. */\r\n loading?: boolean;\r\n};\r\ntype NavigationButtonProps = Omit<ComponentPropsWithRef<typeof Link>, 'className'> & ButtonAppearance & {\r\n loading?: never;\r\n disabled?: never;\r\n};\r\nexport type ButtonProps = ActionButtonProps;\r\nexport type UnifiedButtonProps = (ActionButtonProps | NavigationButtonProps) & IconOnlyProps;\r\n\r\nexport function Button({variant = 'solid', scheme, size = 'md', shape, className, iconOnly = false, children, ...props}: UnifiedButtonProps) {\r\n const classes = buttonClassName({variant, scheme, size, shape, className: cn(iconOnly && [iconSizes[size], 'gap-0 p-0'], className)});\r\n const content = iconOnly ? <span aria-hidden=\"true\" className=\"inline-flex\">{children}</span> : children;\r\n if (props.href !== undefined) {\r\n const { loading: _loading, disabled: _disabled, ...linkProps } = props as NavigationButtonProps;\r\n return <Link {...linkProps} className={classes}>{content}</Link>;\r\n }\r\n const {type = 'button', disabled, loading = false, href: _href, ...buttonProps} = props as ActionButtonProps;\r\n return <button {...buttonProps} type={type} className={classes} disabled={disabled || loading} aria-busy={loading || buttonProps['aria-busy']}>\r\n {loading && <Spinner decorative />}{(!iconOnly || !loading) && content}\r\n </button>;\r\n}\r\n\r\n\r\ntype IconSize = ButtonSize;\r\nconst iconSizes: Record<IconSize, string> = {\r\n xs: 'size-8', sm: 'size-9', md: 'size-11', lg: 'size-12', xl: 'size-13', '2xl': 'size-14',\r\n};\r\n\r\nexport type ExpandingButtonProps = Omit<ActionButtonProps, 'children' | 'size'> & {\r\n /** Leading icon. */\r\n icon: ReactNode;\r\n /** Action label, revealed on hover/focus and always visible on touch screens. */\r\n label: string;\r\n /** Standard control size. */\r\n size?: IconSize;\r\n};\r\nexport function ExpandingButton({icon, label, size = 'md', loading, ...props}: ExpandingButtonProps) {\r\n return <Button aria-label={label} {...props} size={size} loading={loading} className={cn('gap-0 px-3', props.className)}>\r\n {!loading && <span aria-hidden=\"true\" className=\"inline-flex\">{icon}</span>}\r\n <span className=\"pointer-fine:ml-0 pointer-fine:max-w-0 pointer-fine:overflow-hidden pointer-fine:whitespace-nowrap pointer-fine:opacity-0 pointer-fine:group-hover/button:ml-2 pointer-fine:group-hover/button:max-w-40 pointer-fine:group-hover/button:opacity-100 pointer-fine:group-focus-visible/button:ml-2 pointer-fine:group-focus-visible/button:max-w-40 pointer-fine:group-focus-visible/button:opacity-100 pointer-fine:group-aria-busy/button:ml-2 pointer-fine:group-aria-busy/button:max-w-40 pointer-fine:group-aria-busy/button:opacity-100 motion-safe:transition-[max-width,margin,opacity] motion-safe:duration-interactive motion-safe:ease-out-strong motion-reduce:transition-none\">{label}</span>\r\n </Button>;\r\n}\r\n\r\nexport type FilterChipProps = Omit<ActionButtonProps, 'variant' | 'scheme' | 'size' | 'shape' | 'aria-pressed'> & {\r\n /** Controlled selection state; onClick belongs to the caller. */\r\n selected?: boolean;\r\n /** Optional leading icon. */\r\n icon?: ReactNode;\r\n};\r\nexport function FilterChip({selected = false, icon, children, loading, ...props}: FilterChipProps) {\r\n return <Button {...props} variant=\"outline\" scheme={selected ? 'secondary' : 'neutral'} size=\"md\" shape=\"pill\" aria-pressed={selected} loading={loading} className={cn('w-max max-w-full gap-2.5 px-5 py-3 text-base leading-[1.4]', selected && 'font-semibold')}>\r\n {!loading && icon}{children}\r\n </Button>;\r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C9P,CAAC,OAAO,IAAI,IAAI,EAAE,QAAQ,CAAA,EAAA,CACpB;AACX;;;;"}
1
+ {"version":3,"file":"button.js","sources":["../../src/components/button.tsx"],"sourcesContent":["import Link from 'next/link';\nimport type { ComponentPropsWithRef, ReactNode } from 'react';\nimport { cn } from '@/utils';\nimport { Spinner } from './loader';\nimport { interactiveControlClassName, interactiveControlTransitionClassName } from '@/lib/interaction-styles';\n\nexport type ButtonVariant = 'solid' | 'outline' | 'ghost' | 'link';\nexport type ButtonScheme = 'primary' | 'secondary' | 'neutral' | 'destructive' | 'success';\nexport type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\nexport type ButtonShape = 'rounded' | 'pill';\n\ntype ButtonAppearance = {\n /** Visual treatment. */\n variant?: ButtonVariant;\n /** Semantic color, independent of the fill treatment. Defaults to primary, or neutral for outline/ghost. */\n scheme?: ButtonScheme;\n /** Standard control size: 32px, 36px, 44px, 48px, 52px, or 56px minimum height. */\n size?: ButtonSize;\n /** Corner treatment. Landing presets keep their original shape when omitted. */\n shape?: ButtonShape;\n /** Additional classes, merged after the component's appearance classes. */\n className?: string;\n};\n\nconst schemes: Record<ButtonScheme, string> = {\n primary: '[--btn-fill:var(--color-landing-blue)] [--btn-on:white] [--btn-hover:var(--color-landing-blue-hover)] [--btn-ink:var(--color-landing-blue-hover)] [--btn-soft:var(--color-landing-tint)] [--btn-border:var(--color-landing-blue)]',\n secondary: '[--btn-fill:var(--color-landing-secondary-tint)] [--btn-on:var(--color-landing-secondary-deep)] [--btn-hover:var(--color-brand-secondary-hover)] [--btn-ink:var(--color-landing-secondary-deep)] [--btn-soft:var(--color-landing-secondary-tint)] [--btn-border:var(--color-landing-secondary-border)]',\n neutral: '[--btn-fill:var(--color-v2-surface-subtle)] [--btn-on:var(--color-landing-nav)] [--btn-hover:var(--color-landing-border)] [--btn-ink:var(--color-landing-nav)] [--btn-soft:rgb(55_65_81_/_6%)] [--btn-border:var(--color-landing-control)]',\n destructive: '[--btn-fill:var(--color-v2-destructive)] [--btn-on:white] [--btn-hover:var(--color-brand-destructive-hover)] [--btn-ink:var(--color-brand-destructive-hover)] [--btn-soft:var(--color-brand-destructive-soft)] [--btn-border:var(--color-v2-destructive)]',\n success: '[--btn-fill:var(--color-brand-success)] [--btn-on:white] [--btn-hover:var(--color-brand-success-hover)] [--btn-ink:var(--color-brand-success)] [--btn-soft:var(--color-brand-success-soft)] [--btn-border:var(--color-brand-success)]',\n};\nconst treatments: Record<ButtonVariant, string> = {\n solid: cn('border border-[var(--btn-border)] bg-[var(--btn-fill)] font-semibold text-[var(--btn-on)] enabled:pointer-fine:hover:border-[var(--btn-hover)] enabled:pointer-fine:hover:bg-[var(--btn-hover)] [&:is(a):hover]:bg-[var(--btn-hover)]', interactiveControlClassName),\n outline: cn('border border-[var(--btn-border)] bg-transparent text-[var(--btn-ink)] enabled:hover:bg-[var(--btn-soft)] [&:is(a):hover]:bg-[var(--btn-soft)]', interactiveControlClassName),\n ghost: 'border border-transparent bg-transparent text-[var(--btn-ink)] enabled:hover:bg-[var(--btn-soft)] [&:is(a):hover]:bg-[var(--btn-soft)]',\n link: 'border-0 bg-transparent text-[var(--btn-ink)] underline-offset-4 enabled:hover:underline [&:is(a):hover]:underline',\n};\nconst sizes: Record<ButtonSize, string> = {\n xs: 'min-h-8 px-2 text-xs leading-[1.5]',\n sm: 'min-h-9 px-3 text-sm leading-[1.5]',\n md: 'min-h-11 px-5 text-sm leading-[1.5]',\n lg: 'min-h-12 px-6 text-base leading-[1.5]',\n xl: 'min-h-13 px-7 text-base leading-[1.5]',\n '2xl': 'min-h-14 px-8 text-lg leading-[1.5]',\n};\n\n/** Shared styling for action and navigation controls. Colors never change the fill treatment. */\nexport function buttonClassName({variant = 'solid', scheme, size = 'md', shape, className}: ButtonAppearance = {}) {\n return cn(\n 'group group/button inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-control-lg font-[550] focus-visible:outline-3 focus-visible:outline-offset-4 focus-visible:outline-landing-blue disabled:pointer-events-none disabled:opacity-50 aria-disabled:cursor-default aria-busy:cursor-wait [&_svg]:shrink-0',\n interactiveControlTransitionClassName,\n schemes[scheme ?? (['outline', 'ghost'].includes(variant) ? 'neutral' : 'primary')],\n treatments[variant], sizes[size],\n variant === 'outline' && (scheme === undefined || scheme === 'neutral') && 'enabled:hover:border-landing-control-hover enabled:hover:text-landing-nav-hover [&:is(a):hover]:border-landing-control-hover',\n variant === 'outline' && scheme === 'secondary' && 'bg-[var(--btn-soft)]',\n shape === 'pill' && 'rounded-full', shape === 'rounded' && 'rounded-control-lg', className,\n );\n}\n\ntype IconOnlyProps = { iconOnly?: false } | { iconOnly: true; 'aria-label': string };\ntype ActionButtonProps = ComponentPropsWithRef<'button'> & ButtonAppearance & {\n href?: never;\n /** Shows a progress indicator, exposes aria-busy, and disables the action while work is pending. */\n loading?: boolean;\n};\ntype NavigationButtonProps = Omit<ComponentPropsWithRef<typeof Link>, 'className'> & ButtonAppearance & {\n loading?: never;\n disabled?: never;\n};\nexport type ButtonProps = ActionButtonProps;\nexport type UnifiedButtonProps = (ActionButtonProps | NavigationButtonProps) & IconOnlyProps;\n\nexport function Button({variant = 'solid', scheme, size = 'md', shape, className, iconOnly = false, children, ...props}: UnifiedButtonProps) {\n const classes = buttonClassName({variant, scheme, size, shape, className: cn(iconOnly && [iconSizes[size], 'gap-0 p-0'], className)});\n const content = iconOnly ? <span aria-hidden=\"true\" className=\"inline-flex\">{children}</span> : children;\n if (props.href !== undefined) {\n const { loading: _loading, disabled: _disabled, ...linkProps } = props as NavigationButtonProps;\n return <Link {...linkProps} className={classes}>{content}</Link>;\n }\n const {type = 'button', disabled, loading = false, href: _href, ...buttonProps} = props as ActionButtonProps;\n return <button {...buttonProps} type={type} className={classes} disabled={disabled || loading} aria-busy={loading || buttonProps['aria-busy']}>\n {loading && <Spinner decorative />}{(!iconOnly || !loading) && content}\n </button>;\n}\n\n\ntype IconSize = ButtonSize;\nconst iconSizes: Record<IconSize, string> = {\n xs: 'size-8', sm: 'size-9', md: 'size-11', lg: 'size-12', xl: 'size-13', '2xl': 'size-14',\n};\n\nexport type ExpandingButtonProps = Omit<ActionButtonProps, 'children' | 'size'> & {\n /** Leading icon. */\n icon: ReactNode;\n /** Action label, revealed on hover/focus and always visible on touch screens. */\n label: string;\n /** Standard control size. */\n size?: IconSize;\n};\nexport function ExpandingButton({icon, label, size = 'md', loading, ...props}: ExpandingButtonProps) {\n return <Button aria-label={label} {...props} size={size} loading={loading} className={cn('gap-0 px-3', props.className)}>\n {!loading && <span aria-hidden=\"true\" className=\"inline-flex\">{icon}</span>}\n <span className=\"pointer-fine:ml-0 pointer-fine:max-w-0 pointer-fine:overflow-hidden pointer-fine:whitespace-nowrap pointer-fine:opacity-0 pointer-fine:group-hover/button:ml-2 pointer-fine:group-hover/button:max-w-40 pointer-fine:group-hover/button:opacity-100 pointer-fine:group-focus-visible/button:ml-2 pointer-fine:group-focus-visible/button:max-w-40 pointer-fine:group-focus-visible/button:opacity-100 pointer-fine:group-aria-busy/button:ml-2 pointer-fine:group-aria-busy/button:max-w-40 pointer-fine:group-aria-busy/button:opacity-100 motion-safe:transition-[max-width,margin,opacity] motion-safe:duration-interactive motion-safe:ease-out-strong motion-reduce:transition-none\">{label}</span>\n </Button>;\n}\n\nexport type FilterChipProps = Omit<ActionButtonProps, 'variant' | 'scheme' | 'size' | 'shape' | 'aria-pressed'> & {\n /** Controlled selection state; onClick belongs to the caller. */\n selected?: boolean;\n /** Optional leading icon. */\n icon?: ReactNode;\n};\nexport function FilterChip({selected = false, icon, children, loading, ...props}: FilterChipProps) {\n return <Button {...props} variant=\"outline\" scheme={selected ? 'secondary' : 'neutral'} size=\"md\" shape=\"pill\" aria-pressed={selected} loading={loading} className={cn('w-max max-w-full gap-2.5 px-5 py-3 text-base leading-[1.4]', selected && 'font-semibold')}>\n {!loading && icon}{children}\n </Button>;\n}\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;AAwBA,MA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,CACpB;AACX;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"calendar.js","sources":["../../src/components/calendar.tsx"],"sourcesContent":["'use client';\r\n\r\nimport * as React from 'react';\r\nimport {\r\n DayPicker,\r\n getDefaultClassNames,\r\n type DayButton,\r\n type Matcher,\r\n} from '@daypicker/react';\r\nimport { ChevronDown, ChevronLeft, ChevronRight } from 'lucide-react';\r\n\r\nimport { cn } from '@/utils';\r\nimport { Button, buttonClassName } from './button';\r\n\r\nfunction Calendar({\r\n className,\r\n classNames,\r\n showOutsideDays = true,\r\n captionLayout = 'label',\r\n components,\r\n allowedDates,\r\n disabled,\r\n ...props\r\n}: React.ComponentProps<typeof DayPicker> & {\r\n /** Restrict selection to these local calendar dates. Omit to allow all dates. */\r\n allowedDates?: Date[];\r\n}) {\r\n const defaultClassNames = getDefaultClassNames();\r\n const allowedKeys = React.useMemo(() => allowedDates && new Set(allowedDates.map((date) => `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`)), [allowedDates]);\r\n const disabledMatchers: Matcher[] = disabled ? (Array.isArray(disabled) ? [...disabled] : [disabled]) : [];\r\n if (allowedKeys) disabledMatchers.push((date) => !allowedKeys.has(`${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`));\r\n\r\n return (\r\n <DayPicker\r\n showOutsideDays={showOutsideDays}\r\n captionLayout={captionLayout}\r\n disabled={disabledMatchers}\r\n className={cn(\r\n 'group/calendar bg-background p-3 [--cell-size:2.25rem]',\r\n className,\r\n )}\r\n classNames={{\r\n root: cn('w-fit', defaultClassNames.root),\r\n months: cn(\r\n 'relative flex flex-col gap-4 sm:flex-row',\r\n defaultClassNames.months,\r\n ),\r\n month: cn('flex w-full flex-col gap-4', defaultClassNames.month),\r\n nav: cn(\r\n 'pointer-events-none absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1',\r\n defaultClassNames.nav,\r\n ),\r\n button_previous: cn(\r\n buttonClassName({ variant: 'ghost' }),\r\n 'pointer-events-auto h-8 min-h-0 w-8 bg-transparent p-0 opacity-50 hover:opacity-100',\r\n defaultClassNames.button_previous,\r\n ),\r\n button_next: cn(\r\n buttonClassName({ variant: 'ghost' }),\r\n 'pointer-events-auto h-8 min-h-0 w-8 bg-transparent p-0 opacity-50 hover:opacity-100',\r\n defaultClassNames.button_next,\r\n ),\r\n month_caption: cn(\r\n 'flex h-8 w-full items-center justify-center px-8',\r\n defaultClassNames.month_caption,\r\n ),\r\n dropdowns: cn(\r\n 'flex h-8 w-full items-center justify-center gap-1.5 text-sm font-medium',\r\n defaultClassNames.dropdowns,\r\n ),\r\n dropdown_root: cn(\r\n 'relative rounded-control-lg border border-input bg-background transition-colors duration-interactive ease-out-strong hover:border-input-hover has-[select:focus-visible]:outline-3 has-[select:focus-visible]:outline-offset-4 has-[select:focus-visible]:outline-landing-blue motion-reduce:transition-none',\r\n defaultClassNames.dropdown_root,\r\n ),\r\n dropdown: cn(\r\n 'bg-popover absolute inset-0 cursor-pointer opacity-0',\r\n defaultClassNames.dropdown,\r\n ),\r\n caption_label: cn(\r\n 'flex h-8 items-center rounded-control-lg px-3 text-sm font-normal [&>svg]:ml-1 [&>svg]:h-4 [&>svg]:w-4 [&>svg]:text-muted-foreground',\r\n defaultClassNames.caption_label,\r\n ),\r\n month_grid: cn('w-full border-collapse', defaultClassNames.month_grid),\r\n weekdays: cn('flex justify-center', defaultClassNames.weekdays),\r\n weekday: cn(\r\n 'text-muted-foreground w-9 rounded-md text-[0.8rem] font-normal',\r\n defaultClassNames.weekday,\r\n ),\r\n week: cn('mt-2 flex w-full justify-center', defaultClassNames.week),\r\n day: cn(\r\n 'relative h-9 w-9 p-0 text-center text-sm',\r\n defaultClassNames.day,\r\n ),\r\n day_button: cn(\r\n defaultClassNames.day_button,\r\n ),\r\n today: cn(\r\n 'font-semibold text-secondary-foreground',\r\n defaultClassNames.today,\r\n ),\r\n outside: cn(\r\n 'text-muted-foreground opacity-50',\r\n defaultClassNames.outside,\r\n ),\r\n disabled: cn(\r\n 'text-muted-foreground opacity-50',\r\n defaultClassNames.disabled,\r\n ),\r\n hidden: cn('invisible', defaultClassNames.hidden),\r\n ...classNames,\r\n }}\r\n components={{\r\n Chevron: ({ className, orientation, ...iconProps }) => {\r\n const Icon =\r\n orientation === 'left'\r\n ? ChevronLeft\r\n : orientation === 'right'\r\n ? ChevronRight\r\n : ChevronDown;\r\n return <Icon className={cn('h-4 w-4', className)} {...iconProps} />;\r\n },\r\n DayButton: CalendarDayButton,\r\n ...components,\r\n }}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction CalendarDayButton({\r\n className,\r\n day,\r\n modifiers,\r\n ...props\r\n}: React.ComponentProps<typeof DayButton>) {\r\n return (\r\n <Button\r\n variant=\"ghost\"\r\n className={cn(\r\n 'h-9 min-h-0 w-9 rounded-control-md p-0 font-normal aria-selected:opacity-100 data-[today=true]:border data-[today=true]:border-secondary-border data-[today=true]:bg-secondary data-[today=true]:text-secondary-foreground data-[today=true]:font-semibold data-[selected-single=true]:border-primary data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[selected-single=true]:hover:bg-primary data-[selected-single=true]:hover:text-primary-foreground',\r\n className,\r\n )}\r\n data-day={day.date.toLocaleDateString()}\r\n data-today={modifiers.today || undefined}\r\n data-selected-single={modifiers.selected}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nCalendar.displayName = 'Calendar';\r\n\r\nexport { Calendar };\r\n"],"names":[],"mappings":";;;;;;;;AAcA;AAaE;;AAEA;AACA;AAAiB;;;;;;AAsBX;AAKA;;;;;;;;;;;AAoCA;;;;;AAgBA;AACD;;AAGG;AAEI;;AAEE;;AAEN;;AAEF;AACA;;AAKR;AAEA;AAME;AAaF;AAEA;;"}
1
+ {"version":3,"file":"calendar.js","sources":["../../src/components/calendar.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n DayPicker,\n getDefaultClassNames,\n type DayButton,\n type Matcher,\n} from '@daypicker/react';\nimport { ChevronDown, ChevronLeft, ChevronRight } from 'lucide-react';\n\nimport { cn } from '@/utils';\nimport { Button, buttonClassName } from './button';\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = 'label',\n components,\n allowedDates,\n disabled,\n ...props\n}: React.ComponentProps<typeof DayPicker> & {\n /** Restrict selection to these local calendar dates. Omit to allow all dates. */\n allowedDates?: Date[];\n}) {\n const defaultClassNames = getDefaultClassNames();\n const allowedKeys = React.useMemo(() => allowedDates && new Set(allowedDates.map((date) => `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`)), [allowedDates]);\n const disabledMatchers: Matcher[] = disabled ? (Array.isArray(disabled) ? [...disabled] : [disabled]) : [];\n if (allowedKeys) disabledMatchers.push((date) => !allowedKeys.has(`${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`));\n\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n captionLayout={captionLayout}\n disabled={disabledMatchers}\n className={cn(\n 'group/calendar bg-background p-3 [--cell-size:2.25rem]',\n className,\n )}\n classNames={{\n root: cn('w-fit', defaultClassNames.root),\n months: cn(\n 'relative flex flex-col gap-4 sm:flex-row',\n defaultClassNames.months,\n ),\n month: cn('flex w-full flex-col gap-4', defaultClassNames.month),\n nav: cn(\n 'pointer-events-none absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1',\n defaultClassNames.nav,\n ),\n button_previous: cn(\n buttonClassName({ variant: 'ghost' }),\n 'pointer-events-auto h-8 min-h-0 w-8 bg-transparent p-0 opacity-50 hover:opacity-100',\n defaultClassNames.button_previous,\n ),\n button_next: cn(\n buttonClassName({ variant: 'ghost' }),\n 'pointer-events-auto h-8 min-h-0 w-8 bg-transparent p-0 opacity-50 hover:opacity-100',\n defaultClassNames.button_next,\n ),\n month_caption: cn(\n 'flex h-8 w-full items-center justify-center px-8',\n defaultClassNames.month_caption,\n ),\n dropdowns: cn(\n 'flex h-8 w-full items-center justify-center gap-1.5 text-sm font-medium',\n defaultClassNames.dropdowns,\n ),\n dropdown_root: cn(\n 'relative rounded-control-lg border border-input bg-background transition-colors duration-interactive ease-out-strong hover:border-input-hover has-[select:focus-visible]:outline-3 has-[select:focus-visible]:outline-offset-4 has-[select:focus-visible]:outline-landing-blue motion-reduce:transition-none',\n defaultClassNames.dropdown_root,\n ),\n dropdown: cn(\n 'bg-popover absolute inset-0 cursor-pointer opacity-0',\n defaultClassNames.dropdown,\n ),\n caption_label: cn(\n 'flex h-8 items-center rounded-control-lg px-3 text-sm font-normal [&>svg]:ml-1 [&>svg]:h-4 [&>svg]:w-4 [&>svg]:text-muted-foreground',\n defaultClassNames.caption_label,\n ),\n month_grid: cn('w-full border-collapse', defaultClassNames.month_grid),\n weekdays: cn('flex justify-center', defaultClassNames.weekdays),\n weekday: cn(\n 'text-muted-foreground w-9 rounded-md text-[0.8rem] font-normal',\n defaultClassNames.weekday,\n ),\n week: cn('mt-2 flex w-full justify-center', defaultClassNames.week),\n day: cn(\n 'relative h-9 w-9 p-0 text-center text-sm',\n defaultClassNames.day,\n ),\n day_button: cn(\n defaultClassNames.day_button,\n ),\n today: cn(\n 'font-semibold text-secondary-foreground',\n defaultClassNames.today,\n ),\n outside: cn(\n 'text-muted-foreground opacity-50',\n defaultClassNames.outside,\n ),\n disabled: cn(\n 'text-muted-foreground opacity-50',\n defaultClassNames.disabled,\n ),\n hidden: cn('invisible', defaultClassNames.hidden),\n ...classNames,\n }}\n components={{\n Chevron: ({ className, orientation, ...iconProps }) => {\n const Icon =\n orientation === 'left'\n ? ChevronLeft\n : orientation === 'right'\n ? ChevronRight\n : ChevronDown;\n return <Icon className={cn('h-4 w-4', className)} {...iconProps} />;\n },\n DayButton: CalendarDayButton,\n ...components,\n }}\n {...props}\n />\n );\n}\n\nfunction CalendarDayButton({\n className,\n day,\n modifiers,\n ...props\n}: React.ComponentProps<typeof DayButton>) {\n return (\n <Button\n variant=\"ghost\"\n className={cn(\n 'h-9 min-h-0 w-9 rounded-control-md p-0 font-normal aria-selected:opacity-100 data-[today=true]:border data-[today=true]:border-secondary-border data-[today=true]:bg-secondary data-[today=true]:text-secondary-foreground data-[today=true]:font-semibold data-[selected-single=true]:border-primary data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[selected-single=true]:hover:bg-primary data-[selected-single=true]:hover:text-primary-foreground',\n className,\n )}\n data-day={day.date.toLocaleDateString()}\n data-today={modifiers.today || undefined}\n data-selected-single={modifiers.selected}\n {...props}\n />\n );\n}\n\nCalendar.displayName = 'Calendar';\n\nexport { Calendar };\n"],"names":[],"mappings":";;;;;;;;AAcA;AAaE;;AAEA;AACA;AAAiB;;;;;;AAsBX;AAKA;;;;;;;;;;;AAoCA;;;;;AAgBA;AACD;;AAGG;AAEI;;AAEE;;AAEN;;AAEF;AACA;;AAKR;AAEA;AAME;AAaF;AAEA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"card.js","sources":["../../src/components/card.tsx"],"sourcesContent":["import * as React from 'react';\r\n\r\nimport { cn } from '@/utils';\r\nimport { interactiveSurfaceClassName } from '@/lib/interaction-styles';\r\n\r\nconst cardVariants = {\r\n surface: '',\r\n // For a whole-card link or action; the caller supplies the semantic element.\r\n interactive:\r\n cn('cursor-pointer', interactiveSurfaceClassName, 'pointer-fine:hover:border-border-hover focus-within:border-border-hover'),\r\n};\r\n\r\nfunction Card({\r\n className,\r\n variant = 'surface',\r\n ...props\r\n}: React.ComponentProps<'div'> & { variant?: keyof typeof cardVariants }) {\r\n return (\r\n <div\r\n data-slot=\"card\"\r\n className={cn(\r\n 'bg-card text-card-foreground flex flex-col gap-6 rounded-card border border-border py-4',\r\n cardVariants[variant],\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction CardHeader({ className, ...props }: React.ComponentProps<'div'>) {\r\n return (\r\n <div\r\n data-slot=\"card-header\"\r\n className={cn(\r\n '@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction CardTitle({ className, ...props }: React.ComponentProps<'div'>) {\r\n return (\r\n <div\r\n data-slot=\"card-title\"\r\n className={cn('text-lg leading-snug font-semibold', className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction CardDescription({ className, ...props }: React.ComponentProps<'div'>) {\r\n return (\r\n <div\r\n data-slot=\"card-description\"\r\n className={cn('text-muted-foreground text-sm', className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction CardAction({ className, ...props }: React.ComponentProps<'div'>) {\r\n return (\r\n <div\r\n data-slot=\"card-action\"\r\n className={cn(\r\n 'col-start-2 row-span-2 row-start-1 self-start justify-self-end',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction CardContent({ className, ...props }: React.ComponentProps<'div'>) {\r\n return (\r\n <div\r\n data-slot=\"card-content\"\r\n className={cn('px-6', className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction CardFooter({ className, ...props }: React.ComponentProps<'div'>) {\r\n return (\r\n <div\r\n data-slot=\"card-footer\"\r\n className={cn('flex items-center px-6 [.border-t]:pt-6', className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nexport {\r\n Card,\r\n CardHeader,\r\n CardFooter,\r\n CardTitle,\r\n CardAction,\r\n CardDescription,\r\n CardContent,\r\n};\r\n"],"names":["_jsx"],"mappings":";;;;AAKA,MAAM,YAAY,GAAG;AACnB,IAAA,OAAO,EAAE,EAAE;;IAEX,WAAW,EACT,EAAE,CAAC,gBAAgB,EAAE,2BAA2B,EAAE,yEAAyE,CAAC;CAC/H;AAED,SAAS,IAAI,CAAC,EACZ,SAAS,EACT,OAAO,GAAG,SAAS,EACnB,GAAG,KAAK,EAC8D,EAAA;IACtE,QACEA,0BACY,MAAM,EAChB,SAAS,EAAE,EAAE,CACX,yFAAyF,EACzF,YAAY,CAAC,OAAO,CAAC,EACrB,SAAS,CACV,E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EA,GAAA,CAAA,KAAA,EAAA,EAAA,WAAA,EACY,aAAa,EACvB,SAAS,EAAE,EAAE,CAAC,yCAAyC,EAAE,SAAS,CAAC,EAAA,GAC/D,KAAK,EAAA,CACT;AAEN;;;;"}
1
+ {"version":3,"file":"card.js","sources":["../../src/components/card.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '@/utils';\nimport { interactiveSurfaceClassName } from '@/lib/interaction-styles';\n\nconst cardVariants = {\n surface: '',\n // For a whole-card link or action; the caller supplies the semantic element.\n interactive:\n cn('cursor-pointer', interactiveSurfaceClassName, 'pointer-fine:hover:border-border-hover focus-within:border-border-hover'),\n};\n\nfunction Card({\n className,\n variant = 'surface',\n ...props\n}: React.ComponentProps<'div'> & { variant?: keyof typeof cardVariants }) {\n return (\n <div\n data-slot=\"card\"\n className={cn(\n 'bg-card text-card-foreground flex flex-col gap-6 rounded-card border border-border py-4',\n cardVariants[variant],\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n '@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-title\"\n className={cn('text-lg leading-snug font-semibold', className)}\n {...props}\n />\n );\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-description\"\n className={cn('text-muted-foreground text-sm', className)}\n {...props}\n />\n );\n}\n\nfunction CardAction({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn(\n 'col-start-2 row-span-2 row-start-1 self-start justify-self-end',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-content\"\n className={cn('px-6', className)}\n {...props}\n />\n );\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn('flex items-center px-6 [.border-t]:pt-6', className)}\n {...props}\n />\n );\n}\n\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n};\n"],"names":["_jsx"],"mappings":";;;;AAKA,MAAM,YAAY,GAAG;AACnB,IAAA,OAAO,EAAE,EAAE;;IAEX,WAAW,EACT,EAAE,CAAC,gBAAgB,EAAE,2BAA2B,EAAE,yEAAyE,CAAC;CAC/H;AAED,SAAS,IAAI,CAAC,EACZ,SAAS,EACT,OAAO,GAAG,SAAS,EACnB,GAAG,KAAK,EAC8D,EAAA;IACtE,QACEA,0BACY,MAAM,EAChB,SAAS,EAAE,EAAE,CACX,yFAAyF,EACzF,YAAY,CAAC,OAAO,CAAC,EACrB,SAAS,CACV,EAAA,GACG,KAAK,EAAA,CACT;AAEN;AAEA,SAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B,EAAA;AACtE,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EAAA,WAAA,EACY,aAAa,EACvB,SAAS,EAAE,EAAE,CACX,4JAA4J,EAC5J,SAAS,CACV,EAAA,GACG,KAAK,EAAA,CACT;AAEN;AAEA,SAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B,EAAA;AACrE,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EAAA,WAAA,EACY,YAAY,EACtB,SAAS,EAAE,EAAE,CAAC,oCAAoC,EAAE,SAAS,CAAC,EAAA,GAC1D,KAAK,EAAA,CACT;AAEN;AAEA,SAAS,eAAe,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B,EAAA;AAC3E,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EAAA,WAAA,EACY,kBAAkB,EAC5B,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE,SAAS,CAAC,EAAA,GACrD,KAAK,EAAA,CACT;AAEN;AAEA,SAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B,EAAA;AACtE,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EAAA,WAAA,EACY,aAAa,EACvB,SAAS,EAAE,EAAE,CACX,gEAAgE,EAChE,SAAS,CACV,EAAA,GACG,KAAK,EAAA,CACT;AAEN;AAEA,SAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B,EAAA;AACvE,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EAAA,WAAA,EACY,cAAc,EACxB,SAAS,EAAE,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,EAAA,GAC5B,KAAK,EAAA,CACT;AAEN;AAEA,SAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B,EAAA;AACtE,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EAAA,WAAA,EACY,aAAa,EACvB,SAAS,EAAE,EAAE,CAAC,yCAAyC,EAAE,SAAS,CAAC,EAAA,GAC/D,KAAK,EAAA,CACT;AAEN;;;;"}
@@ -0,0 +1,126 @@
1
+ "use client";
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import * as React from 'react';
4
+ import useEmblaCarousel from '../node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js';
5
+ import { ArrowLeft, ArrowRight } from 'lucide-react';
6
+ import { cn } from '../utils.js';
7
+ import { Button } from './button.js';
8
+
9
+ const CarouselContext = React.createContext(null);
10
+ function useCarousel() {
11
+ const context = React.useContext(CarouselContext);
12
+ if (!context) {
13
+ throw new Error("useCarousel must be used within a <Carousel />");
14
+ }
15
+ return context;
16
+ }
17
+ const Carousel = React.forwardRef(({ orientation = "horizontal", opts, setApi, plugins, autoPlay = false, autoPlayInterval = 5000, className, children, ...props }, ref) => {
18
+ const [carouselRef, api] = useEmblaCarousel({
19
+ ...opts,
20
+ axis: orientation === "horizontal" ? "x" : "y",
21
+ }, plugins);
22
+ const [canScrollPrev, setCanScrollPrev] = React.useState(false);
23
+ const [canScrollNext, setCanScrollNext] = React.useState(false);
24
+ const [hovered, setHovered] = React.useState(false);
25
+ const [focused, setFocused] = React.useState(false);
26
+ const [reducedMotion, setReducedMotion] = React.useState(true);
27
+ React.useEffect(() => {
28
+ const media = window.matchMedia('(prefers-reduced-motion: reduce)');
29
+ const update = () => setReducedMotion(media.matches);
30
+ update();
31
+ media.addEventListener('change', update);
32
+ return () => media.removeEventListener('change', update);
33
+ }, []);
34
+ React.useEffect(() => {
35
+ if (!api || !autoPlay || hovered || focused || reducedMotion || autoPlayInterval <= 0)
36
+ return;
37
+ const timer = window.setInterval(() => {
38
+ if (api.canScrollNext())
39
+ api.scrollNext();
40
+ else
41
+ api.scrollTo(0);
42
+ }, autoPlayInterval);
43
+ return () => window.clearInterval(timer);
44
+ }, [api, autoPlay, hovered, focused, reducedMotion, autoPlayInterval]);
45
+ const onSelect = React.useCallback((api) => {
46
+ if (!api) {
47
+ return;
48
+ }
49
+ setCanScrollPrev(api.canScrollPrev());
50
+ setCanScrollNext(api.canScrollNext());
51
+ }, []);
52
+ const scrollPrev = React.useCallback(() => {
53
+ api?.scrollPrev();
54
+ }, [api]);
55
+ const scrollNext = React.useCallback(() => {
56
+ api?.scrollNext();
57
+ }, [api]);
58
+ const handleKeyDown = React.useCallback((event) => {
59
+ if (event.key === "ArrowLeft") {
60
+ event.preventDefault();
61
+ scrollPrev();
62
+ }
63
+ else if (event.key === "ArrowRight") {
64
+ event.preventDefault();
65
+ scrollNext();
66
+ }
67
+ }, [scrollPrev, scrollNext]);
68
+ React.useEffect(() => {
69
+ if (!api || !setApi) {
70
+ return;
71
+ }
72
+ setApi(api);
73
+ }, [api, setApi]);
74
+ React.useEffect(() => {
75
+ if (!api) {
76
+ return;
77
+ }
78
+ onSelect(api);
79
+ api.on("reInit", onSelect);
80
+ api.on("select", onSelect);
81
+ return () => {
82
+ api?.off("select", onSelect);
83
+ };
84
+ }, [api, onSelect]);
85
+ return (jsx(CarouselContext.Provider, { value: {
86
+ carouselRef,
87
+ api: api,
88
+ opts,
89
+ orientation: orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
90
+ scrollPrev,
91
+ scrollNext,
92
+ canScrollPrev,
93
+ canScrollNext,
94
+ }, children: jsx("div", { ref: ref, onKeyDownCapture: handleKeyDown, className: cn("relative", className), role: "region", "aria-roledescription": "carousel", ...props, onPointerEnter: (event) => { if (event.pointerType === 'mouse')
95
+ setHovered(true); props.onPointerEnter?.(event); }, onPointerLeave: (event) => { if (event.pointerType === 'mouse')
96
+ setHovered(false); props.onPointerLeave?.(event); }, onFocusCapture: (event) => { setFocused(true); props.onFocusCapture?.(event); }, onBlurCapture: (event) => { if (!event.currentTarget.contains(event.relatedTarget))
97
+ setFocused(false); props.onBlurCapture?.(event); }, children: children }) }));
98
+ });
99
+ Carousel.displayName = "Carousel";
100
+ const CarouselContent = React.forwardRef(({ className, ...props }, ref) => {
101
+ const { carouselRef, orientation } = useCarousel();
102
+ return (jsx("div", { ref: carouselRef, className: "overflow-hidden", children: jsx("div", { ref: ref, className: cn("flex", orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className), ...props }) }));
103
+ });
104
+ CarouselContent.displayName = "CarouselContent";
105
+ const CarouselItem = React.forwardRef(({ className, ...props }, ref) => {
106
+ const { orientation } = useCarousel();
107
+ return (jsx("div", { ref: ref, role: "group", "aria-roledescription": "slide", className: cn("min-w-0 shrink-0 grow-0 basis-full", orientation === "horizontal" ? "pl-4" : "pt-4", className), ...props }));
108
+ });
109
+ CarouselItem.displayName = "CarouselItem";
110
+ const CarouselPrevious = React.forwardRef(({ className, variant = "outline", size = "xs", ...props }, ref) => {
111
+ const { orientation, scrollPrev, canScrollPrev } = useCarousel();
112
+ return (jsxs(Button, { ref: ref, variant: variant, size: size, className: cn("absolute h-8 w-8 min-h-0 rounded-full border-input bg-background p-0 text-foreground enabled:hover:border-primary/20 enabled:hover:bg-primary-tint enabled:hover:text-primary pointer-fine:hover:shadow-none motion-safe:pointer-fine:hover:translate-y-0 motion-safe:active:scale-100", orientation === "horizontal"
113
+ ? "-left-12 top-1/2 -translate-y-1/2 motion-safe:pointer-fine:hover:-translate-y-1/2"
114
+ : "-top-12 left-1/2 -translate-x-1/2 rotate-90", className), disabled: !canScrollPrev, onClick: scrollPrev, ...props, children: [jsx(ArrowLeft, { className: "h-4 w-4" }), jsx("span", { className: "sr-only", children: "Previous slide" })] }));
115
+ });
116
+ CarouselPrevious.displayName = "CarouselPrevious";
117
+ const CarouselNext = React.forwardRef(({ className, variant = "outline", size = "xs", ...props }, ref) => {
118
+ const { orientation, scrollNext, canScrollNext } = useCarousel();
119
+ return (jsxs(Button, { ref: ref, variant: variant, size: size, className: cn("absolute h-8 w-8 min-h-0 rounded-full border-input bg-background p-0 text-foreground enabled:hover:border-primary/20 enabled:hover:bg-primary-tint enabled:hover:text-primary pointer-fine:hover:shadow-none motion-safe:pointer-fine:hover:translate-y-0 motion-safe:active:scale-100", orientation === "horizontal"
120
+ ? "-right-12 top-1/2 -translate-y-1/2 motion-safe:pointer-fine:hover:-translate-y-1/2"
121
+ : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", className), disabled: !canScrollNext, onClick: scrollNext, ...props, children: [jsx(ArrowRight, { className: "h-4 w-4" }), jsx("span", { className: "sr-only", children: "Next slide" })] }));
122
+ });
123
+ CarouselNext.displayName = "CarouselNext";
124
+
125
+ export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious };
126
+ //# sourceMappingURL=carousel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"carousel.js","sources":["../../src/components/carousel.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport useEmblaCarousel, {\n type UseEmblaCarouselType,\n} from \"embla-carousel-react\";\nimport { ArrowLeft, ArrowRight } from \"lucide-react\";\n\nimport { cn } from \"@/utils\";\nimport { Button, type ButtonProps } from \"./button\";\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\n\ntype CarouselProps = {\n opts?: CarouselOptions;\n plugins?: CarouselPlugin;\n orientation?: \"horizontal\" | \"vertical\";\n setApi?: (api: CarouselApi) => void;\n /** Automatically advance slides while the carousel is not hovered or focused. */\n autoPlay?: boolean;\n /** Delay between automatic advances in milliseconds. */\n autoPlayInterval?: number;\n};\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0];\n api: ReturnType<typeof useEmblaCarousel>[1];\n scrollPrev: () => void;\n scrollNext: () => void;\n canScrollPrev: boolean;\n canScrollNext: boolean;\n} & CarouselProps;\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null);\n\nfunction useCarousel() {\n const context = React.useContext(CarouselContext);\n\n if (!context) {\n throw new Error(\"useCarousel must be used within a <Carousel />\");\n }\n\n return context;\n}\n\nconst Carousel = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & CarouselProps\n>(\n (\n {\n orientation = \"horizontal\",\n opts,\n setApi,\n plugins,\n autoPlay = false,\n autoPlayInterval = 5000,\n className,\n children,\n ...props\n },\n ref,\n ) => {\n const [carouselRef, api] = useEmblaCarousel(\n {\n ...opts,\n axis: orientation === \"horizontal\" ? \"x\" : \"y\",\n },\n plugins,\n );\n const [canScrollPrev, setCanScrollPrev] = React.useState(false);\n const [canScrollNext, setCanScrollNext] = React.useState(false);\n const [hovered, setHovered] = React.useState(false);\n const [focused, setFocused] = React.useState(false);\n const [reducedMotion, setReducedMotion] = React.useState(true);\n\n React.useEffect(() => {\n const media = window.matchMedia('(prefers-reduced-motion: reduce)');\n const update = () => setReducedMotion(media.matches);\n update();\n media.addEventListener('change', update);\n return () => media.removeEventListener('change', update);\n }, []);\n\n React.useEffect(() => {\n if (!api || !autoPlay || hovered || focused || reducedMotion || autoPlayInterval <= 0) return;\n const timer = window.setInterval(() => {\n if (api.canScrollNext()) api.scrollNext();\n else api.scrollTo(0);\n }, autoPlayInterval);\n return () => window.clearInterval(timer);\n }, [api, autoPlay, hovered, focused, reducedMotion, autoPlayInterval]);\n\n const onSelect = React.useCallback((api: CarouselApi) => {\n if (!api) {\n return;\n }\n\n setCanScrollPrev(api.canScrollPrev());\n setCanScrollNext(api.canScrollNext());\n }, []);\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev();\n }, [api]);\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext();\n }, [api]);\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n scrollPrev();\n } else if (event.key === \"ArrowRight\") {\n event.preventDefault();\n scrollNext();\n }\n },\n [scrollPrev, scrollNext],\n );\n\n React.useEffect(() => {\n if (!api || !setApi) {\n return;\n }\n\n setApi(api);\n }, [api, setApi]);\n\n React.useEffect(() => {\n if (!api) {\n return;\n }\n\n onSelect(api);\n api.on(\"reInit\", onSelect);\n api.on(\"select\", onSelect);\n\n return () => {\n api?.off(\"select\", onSelect);\n };\n }, [api, onSelect]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api: api,\n opts,\n orientation:\n orientation || (opts?.axis === \"y\" ? \"vertical\" : \"horizontal\"),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <div\n ref={ref}\n onKeyDownCapture={handleKeyDown}\n className={cn(\"relative\", className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n {...props}\n onPointerEnter={(event) => { if (event.pointerType === 'mouse') setHovered(true); props.onPointerEnter?.(event); }}\n onPointerLeave={(event) => { if (event.pointerType === 'mouse') setHovered(false); props.onPointerLeave?.(event); }}\n onFocusCapture={(event) => { setFocused(true); props.onFocusCapture?.(event); }}\n onBlurCapture={(event) => { if (!event.currentTarget.contains(event.relatedTarget)) setFocused(false); props.onBlurCapture?.(event); }}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n );\n },\n);\nCarousel.displayName = \"Carousel\";\n\nconst CarouselContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => {\n const { carouselRef, orientation } = useCarousel();\n\n return (\n <div ref={carouselRef} className=\"overflow-hidden\">\n <div\n ref={ref}\n className={cn(\n \"flex\",\n orientation === \"horizontal\" ? \"-ml-4\" : \"-mt-4 flex-col\",\n className,\n )}\n {...props}\n />\n </div>\n );\n});\nCarouselContent.displayName = \"CarouselContent\";\n\nconst CarouselItem = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => {\n const { orientation } = useCarousel();\n\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-roledescription=\"slide\"\n className={cn(\n \"min-w-0 shrink-0 grow-0 basis-full\",\n orientation === \"horizontal\" ? \"pl-4\" : \"pt-4\",\n className,\n )}\n {...props}\n />\n );\n});\nCarouselItem.displayName = \"CarouselItem\";\n\nconst CarouselPrevious = React.forwardRef<\n HTMLButtonElement,\n ButtonProps\n>(({ className, variant = \"outline\", size = \"xs\", ...props }, ref) => {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel();\n\n return (\n <Button\n ref={ref}\n variant={variant}\n size={size}\n className={cn(\n \"absolute h-8 w-8 min-h-0 rounded-full border-input bg-background p-0 text-foreground enabled:hover:border-primary/20 enabled:hover:bg-primary-tint enabled:hover:text-primary pointer-fine:hover:shadow-none motion-safe:pointer-fine:hover:translate-y-0 motion-safe:active:scale-100\",\n orientation === \"horizontal\"\n ? \"-left-12 top-1/2 -translate-y-1/2 motion-safe:pointer-fine:hover:-translate-y-1/2\"\n : \"-top-12 left-1/2 -translate-x-1/2 rotate-90\",\n className,\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n <ArrowLeft className=\"h-4 w-4\" />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n );\n});\nCarouselPrevious.displayName = \"CarouselPrevious\";\n\nconst CarouselNext = React.forwardRef<\n HTMLButtonElement,\n ButtonProps\n>(({ className, variant = \"outline\", size = \"xs\", ...props }, ref) => {\n const { orientation, scrollNext, canScrollNext } = useCarousel();\n\n return (\n <Button\n ref={ref}\n variant={variant}\n size={size}\n className={cn(\n \"absolute h-8 w-8 min-h-0 rounded-full border-input bg-background p-0 text-foreground enabled:hover:border-primary/20 enabled:hover:bg-primary-tint enabled:hover:text-primary pointer-fine:hover:shadow-none motion-safe:pointer-fine:hover:translate-y-0 motion-safe:active:scale-100\",\n orientation === \"horizontal\"\n ? \"-right-12 top-1/2 -translate-y-1/2 motion-safe:pointer-fine:hover:-translate-y-1/2\"\n : \"-bottom-12 left-1/2 -translate-x-1/2 rotate-90\",\n className,\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n <ArrowRight className=\"h-4 w-4\" />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n );\n});\nCarouselNext.displayName = \"CarouselNext\";\n\nexport {\n type CarouselApi,\n Carousel,\n CarouselContent,\n CarouselItem,\n CarouselPrevious,\n CarouselNext,\n};\n"],"names":[],"mappings":";;;;;;;;AAoCA;AAEA;;;AAII;;AAGF;AACF;AAEA;AAkBI;AAEI;;;AAKJ;AACA;AACA;AACA;AACA;AAEA;;;AAGE;AACA;;;AAIF;AACE;;AACA;;;;AAEO;;;AAGT;;;;;AAOE;AACA;;AAGF;;AAEA;AAEA;;AAEA;;AAII;;AAEE;;AACK;;AAEL;;AAEJ;AAIF;AACE;;;;AAKF;AAEA;;;;;AAME;AACA;AAEA;AACE;AACF;AACF;AAEA;;AAIM;;AAEA;;;;;AAMD;AASiE;;;AASxE;AAEF;AAEA;;AAME;AAaF;AACA;AAEA;AAIE;AAEA;AAaF;AACA;AAEA;;;AAcU;AACA;AAWV;AACA;AAEA;;;AAcU;AACA;AAWV;AACA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.js","sources":["../../src/components/checkbox.tsx"],"sourcesContent":["'use client';\r\n\r\nimport * as React from 'react';\r\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\r\nimport { CheckIcon, MinusIcon } from 'lucide-react';\r\n\r\nimport { cn } from '@/utils';\r\n\r\nconst checkboxClassName = 'peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground data-[state=indeterminate]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 cursor-pointer rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50';\r\n\r\nfunction CheckboxIndicatorIcons() {\r\n return <>\r\n <CheckIcon className=\"animate-in zoom-in-50 fade-in-0 size-3.5 stroke-3 duration-150 group-data-[state=indeterminate]/indicator:hidden motion-reduce:animate-none\" />\r\n <MinusIcon className=\"animate-in zoom-in-50 fade-in-0 hidden size-3.5 stroke-3 duration-150 group-data-[state=indeterminate]/indicator:block motion-reduce:animate-none\" />\r\n </>;\r\n}\r\n\r\n/** Non-interactive checkbox appearance for a control that owns its selection state. */\r\nfunction CheckboxVisual({ checked }: { checked: boolean | 'indeterminate' }) {\r\n const state = checked === 'indeterminate' ? 'indeterminate' : checked ? 'checked' : 'unchecked';\r\n return (\r\n <span aria-hidden=\"true\" data-state={state} className={cn(checkboxClassName, 'pointer-events-none')}>\r\n {checked && <span data-state={state} className=\"group/indicator flex items-center justify-center text-current transition-none\"><CheckboxIndicatorIcons /></span>}\r\n </span>\r\n );\r\n}\r\n\r\nfunction Checkbox({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof CheckboxPrimitive.Root>) {\r\n return (\r\n <CheckboxPrimitive.Root\r\n data-slot=\"checkbox\"\r\n onClick={(e) => e.stopPropagation()}\r\n className={cn(\r\n checkboxClassName,\r\n className,\r\n )}\r\n {...props}\r\n >\r\n <CheckboxPrimitive.Indicator\r\n data-slot=\"checkbox-indicator\"\r\n className=\"group/indicator flex items-center justify-center text-current transition-none\"\r\n >\r\n <CheckboxIndicatorIcons />\r\n </CheckboxPrimitive.Indicator>\r\n </CheckboxPrimitive.Root>\r\n );\r\n}\r\n\r\nexport { Checkbox, CheckboxVisual };\r\n"],"names":[],"mappings":";;;;;;AAQA;AAEA;AACE;AAIF;AAEA;AACA;;AAEE;AAKF;AAEA;;AAsBA;;"}
1
+ {"version":3,"file":"checkbox.js","sources":["../../src/components/checkbox.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { CheckIcon, MinusIcon } from 'lucide-react';\n\nimport { cn } from '@/utils';\n\nconst checkboxClassName = 'peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground data-[state=indeterminate]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 cursor-pointer rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50';\n\nfunction CheckboxIndicatorIcons() {\n return <>\n <CheckIcon className=\"animate-in zoom-in-50 fade-in-0 size-3.5 stroke-3 duration-150 group-data-[state=indeterminate]/indicator:hidden motion-reduce:animate-none\" />\n <MinusIcon className=\"animate-in zoom-in-50 fade-in-0 hidden size-3.5 stroke-3 duration-150 group-data-[state=indeterminate]/indicator:block motion-reduce:animate-none\" />\n </>;\n}\n\n/** Non-interactive checkbox appearance for a control that owns its selection state. */\nfunction CheckboxVisual({ checked }: { checked: boolean | 'indeterminate' }) {\n const state = checked === 'indeterminate' ? 'indeterminate' : checked ? 'checked' : 'unchecked';\n return (\n <span aria-hidden=\"true\" data-state={state} className={cn(checkboxClassName, 'pointer-events-none')}>\n {checked && <span data-state={state} className=\"group/indicator flex items-center justify-center text-current transition-none\"><CheckboxIndicatorIcons /></span>}\n </span>\n );\n}\n\nfunction Checkbox({\n className,\n ...props\n}: React.ComponentProps<typeof CheckboxPrimitive.Root>) {\n return (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n onClick={(e) => e.stopPropagation()}\n className={cn(\n checkboxClassName,\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n className=\"group/indicator flex items-center justify-center text-current transition-none\"\n >\n <CheckboxIndicatorIcons />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n}\n\nexport { Checkbox, CheckboxVisual };\n"],"names":[],"mappings":";;;;;;AAQA;AAEA;AACE;AAIF;AAEA;AACA;;AAEE;AAKF;AAEA;;AAsBA;;"}
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
4
+ import { CheckboxVisual } from './checkbox.js';
5
+ import { cn } from '../utils.js';
6
+
7
+ const chipClassName = (selected) => cn('inline-flex min-h-11 w-max max-w-full items-center gap-2 rounded-full border border-landing-control bg-background px-3 py-2 text-sm font-medium text-landing-nav transition-colors duration-state enabled:hover:border-landing-control-hover enabled:hover:bg-[rgb(55_65_81_/_6%)] enabled:hover:text-landing-nav-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring motion-reduce:transition-none', selected && 'border-primary bg-primary-tint text-primary enabled:hover:border-primary enabled:hover:bg-primary-tint enabled:hover:text-primary');
8
+ const RadioVisual = ({ checked }) => (jsxs("svg", { "aria-hidden": "true", "data-state": checked ? 'checked' : 'unchecked', className: "size-4 shrink-0", viewBox: "0 0 16 16", children: [jsx("circle", { cx: "8", cy: "8", r: "7", fill: checked ? 'var(--primary)' : 'var(--muted)', stroke: checked ? 'var(--primary)' : 'var(--input)', strokeWidth: "1" }), checked && jsx("circle", { cx: "8", cy: "8", r: "4", fill: "var(--background)" })] }));
9
+ /** A compact form choice group supporting single or multiple selection. */
10
+ function ChipSelect({ value, onChange, options, className, multiple = false }) {
11
+ const groupValue = (multiple ? value : value ?? '');
12
+ const SelectGroup = ToggleGroupPrimitive.Root;
13
+ return (jsx(SelectGroup, { type: multiple ? 'multiple' : 'single', value: groupValue, onValueChange: (next) => multiple
14
+ ? onChange(next)
15
+ : onChange(next || null), className: cn('flex flex-wrap justify-start gap-2', className), children: options.map((option) => {
16
+ const selected = multiple ? value.includes(option.value) : value === option.value;
17
+ return jsxs(ToggleGroupPrimitive.Item, { value: option.value, className: chipClassName(selected), children: [multiple ? jsx(CheckboxVisual, { checked: selected }) : jsx(RadioVisual, { checked: selected }), option.label] }, option.value);
18
+ }) }));
19
+ }
20
+
21
+ export { ChipSelect };
22
+ //# sourceMappingURL=chip-select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chip-select.js","sources":["../../src/components/chip-select.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from 'react';\nimport * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';\nimport { CheckboxVisual } from './checkbox';\nimport { cn } from '@/utils';\n\nexport type Option = { value: string; label: string };\n\nconst chipClassName = (selected: boolean) => cn(\n 'inline-flex min-h-11 w-max max-w-full items-center gap-2 rounded-full border border-landing-control bg-background px-3 py-2 text-sm font-medium text-landing-nav transition-colors duration-state enabled:hover:border-landing-control-hover enabled:hover:bg-[rgb(55_65_81_/_6%)] enabled:hover:text-landing-nav-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring motion-reduce:transition-none',\n selected && 'border-primary bg-primary-tint text-primary enabled:hover:border-primary enabled:hover:bg-primary-tint enabled:hover:text-primary',\n);\n\nconst RadioVisual = ({ checked }: { checked: boolean }) => (\n <svg\n aria-hidden=\"true\"\n data-state={checked ? 'checked' : 'unchecked'}\n className=\"size-4 shrink-0\"\n viewBox=\"0 0 16 16\"\n >\n <circle\n cx=\"8\"\n cy=\"8\"\n r=\"7\"\n fill={checked ? 'var(--primary)' : 'var(--muted)'}\n stroke={checked ? 'var(--primary)' : 'var(--input)'}\n strokeWidth=\"1\"\n />\n {checked && <circle cx=\"8\" cy=\"8\" r=\"4\" fill=\"var(--background)\" />}\n </svg>\n);\n\nexport type ChipSelectProps = {\n options: Option[];\n className?: string;\n} & ({\n multiple: true;\n value: string[];\n onChange: (value: string[]) => void;\n} | {\n multiple?: false;\n value: string | null;\n onChange: (value: string | null) => void;\n});\n\n/** A compact form choice group supporting single or multiple selection. */\nexport function ChipSelect({ value, onChange, options, className, multiple = false }: ChipSelectProps) {\n const groupValue = (multiple ? value : value ?? '') as string | string[];\n const SelectGroup = ToggleGroupPrimitive.Root as React.ComponentType<any>;\n return (\n <SelectGroup\n type={multiple ? 'multiple' : 'single'}\n value={groupValue}\n onValueChange={(next: string | string[]) => multiple\n ? (onChange as (value: string[]) => void)(next as string[])\n : (onChange as (value: string | null) => void)((next as string) || null)}\n className={cn('flex flex-wrap justify-start gap-2', className)}\n >\n {options.map((option) => {\n const selected = multiple ? (value as string[]).includes(option.value) : value === option.value;\n return <ToggleGroupPrimitive.Item key={option.value} value={option.value} className={chipClassName(selected)}>\n {multiple ? <CheckboxVisual checked={selected} /> : <RadioVisual checked={selected} />}\n {option.label}\n </ToggleGroupPrimitive.Item>;\n })}\n </SelectGroup>\n );\n}\n"],"names":[],"mappings":";;;;;;AASA;AAKA;AAgCA;AACM;AACJ;AACA;;AAMM;;;;;AAaR;;"}
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import * as React from 'react';
4
+ import { ChevronDown } from 'lucide-react';
5
+ import { cn } from '../utils.js';
6
+
7
+ const CollapsibleContext = React.createContext(null);
8
+ function useCollapsible() {
9
+ const context = React.useContext(CollapsibleContext);
10
+ if (!context)
11
+ throw new Error("Collapsible parts must be used inside Collapsible");
12
+ return context;
13
+ }
14
+ function Collapsible({ open: controlledOpen, defaultOpen = false, onOpenChange, className, children, title, divider = false, ...props }) {
15
+ const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);
16
+ const open = controlledOpen ?? uncontrolledOpen;
17
+ const toggle = () => {
18
+ const next = !open;
19
+ if (controlledOpen === undefined)
20
+ setUncontrolledOpen(next);
21
+ onOpenChange?.(next);
22
+ };
23
+ return jsx(CollapsibleContext.Provider, { value: { open, toggle }, children: jsx("div", { className: cn("w-full overflow-hidden rounded-control-lg border border-input bg-background", className), "data-state": open ? "open" : "closed", ...props, children: title !== undefined ? jsxs(Fragment, { children: [jsxs(CollapsibleTrigger, { className: "flex w-full items-center justify-between gap-2 p-4 text-left text-sm font-semibold transition-colors duration-state hover:bg-muted motion-reduce:transition-none focus-visible:outline-3 focus-visible:-outline-offset-4 focus-visible:outline-landing-blue", children: [jsx("span", { children: title }), jsx(ChevronDown, { "aria-hidden": "true", className: cn("h-5 w-5 shrink-0 transition-transform duration-state ease-landing-out motion-reduce:transition-none", open && "rotate-180") })] }), jsx(CollapsibleContent, { divider: divider, children: jsx("div", { className: "px-4 pb-4 pt-4", children: children }) })] }) : children }) });
24
+ }
25
+ function CollapsibleTrigger({ asChild, className, children, onClick, ...props }) {
26
+ const { open, toggle } = useCollapsible();
27
+ const handleClick = (event) => { onClick?.(event); if (!event.defaultPrevented)
28
+ toggle(); };
29
+ if (asChild && React.isValidElement(children)) {
30
+ return React.cloneElement(children, {
31
+ ...props,
32
+ 'aria-expanded': open,
33
+ 'data-state': open ? 'open' : 'closed',
34
+ onClick: handleClick,
35
+ });
36
+ }
37
+ return jsx("button", { type: "button", ...props, "aria-expanded": open, "data-state": open ? "open" : "closed", className: className, onClick: handleClick, children: children });
38
+ }
39
+ function CollapsibleContent({ className, children, divider = false, style, ...props }) {
40
+ const { open } = useCollapsible();
41
+ return jsx("div", { className: cn("grid transition-[grid-template-rows] duration-state ease-landing-out motion-reduce:transition-none", divider && open && "border-t border-border", className), style: { gridTemplateRows: open ? "1fr" : "0fr", ...style }, "aria-hidden": !open, inert: !open, ...props, children: jsx("div", { className: "min-h-0 overflow-hidden", children: jsx("div", { className: cn("origin-top transition-[opacity,transform,filter] duration-state ease-landing-out motion-reduce:transform-none motion-reduce:filter-none motion-reduce:transition-none", open ? "scale-100 opacity-100 blur-none" : "scale-[0.98] opacity-0 blur-sm"), children: children }) }) });
42
+ }
43
+
44
+ export { Collapsible, CollapsibleContent, CollapsibleTrigger };
45
+ //# sourceMappingURL=collapsible.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collapsible.js","sources":["../../src/components/collapsible.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { ChevronDown } from \"lucide-react\";\nimport { cn } from \"@/utils\";\n\ntype ContextValue = { open: boolean; toggle: () => void };\nconst CollapsibleContext = React.createContext<ContextValue | null>(null);\n\nfunction useCollapsible() {\n const context = React.useContext(CollapsibleContext);\n if (!context) throw new Error(\"Collapsible parts must be used inside Collapsible\");\n return context;\n}\n\nfunction Collapsible({ open: controlledOpen, defaultOpen = false, onOpenChange, className, children, title, divider = false, ...props }: {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n className?: string;\n children: React.ReactNode;\n /** Optional heading for the ready-to-use collapsible panel. */\n title?: string;\n divider?: boolean;\n} & React.HTMLAttributes<HTMLDivElement>) {\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);\n const open = controlledOpen ?? uncontrolledOpen;\n const toggle = () => {\n const next = !open;\n if (controlledOpen === undefined) setUncontrolledOpen(next);\n onOpenChange?.(next);\n };\n\n return <CollapsibleContext.Provider value={{ open, toggle }}>\n <div className={cn(\"w-full overflow-hidden rounded-control-lg border border-input bg-background\", className)} data-state={open ? \"open\" : \"closed\"} {...props}>\n {title !== undefined ? <>\n <CollapsibleTrigger className=\"flex w-full items-center justify-between gap-2 p-4 text-left text-sm font-semibold transition-colors duration-state hover:bg-muted motion-reduce:transition-none focus-visible:outline-3 focus-visible:-outline-offset-4 focus-visible:outline-landing-blue\">\n <span>{title}</span>\n <ChevronDown aria-hidden=\"true\" className={cn(\"h-5 w-5 shrink-0 transition-transform duration-state ease-landing-out motion-reduce:transition-none\", open && \"rotate-180\")} />\n </CollapsibleTrigger>\n <CollapsibleContent divider={divider}>\n <div className=\"px-4 pb-4 pt-4\">{children}</div>\n </CollapsibleContent>\n </> : children}\n </div>\n </CollapsibleContext.Provider>;\n}\n\nfunction CollapsibleTrigger({ asChild, className, children, onClick, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement> & { asChild?: boolean }) {\n const { open, toggle } = useCollapsible();\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => { onClick?.(event); if (!event.defaultPrevented) toggle(); };\n if (asChild && React.isValidElement(children)) {\n return React.cloneElement(children as React.ReactElement<any>, {\n ...props,\n 'aria-expanded': open,\n 'data-state': open ? 'open' : 'closed',\n onClick: handleClick,\n });\n }\n return <button type=\"button\" {...props} aria-expanded={open} data-state={open ? \"open\" : \"closed\"} className={className} onClick={handleClick}>{children}</button>;\n}\n\nfunction CollapsibleContent({ className, children, divider = false, style, ...props }: React.HTMLAttributes<HTMLDivElement> & { divider?: boolean }) {\n const { open } = useCollapsible();\n return <div className={cn(\"grid transition-[grid-template-rows] duration-state ease-landing-out motion-reduce:transition-none\", divider && open && \"border-t border-border\", className)} style={{ gridTemplateRows: open ? \"1fr\" : \"0fr\", ...style }} aria-hidden={!open} inert={!open} {...props}>\n <div className=\"min-h-0 overflow-hidden\">\n <div className={cn(\n \"origin-top transition-[opacity,transform,filter] duration-state ease-landing-out motion-reduce:transform-none motion-reduce:filter-none motion-reduce:transition-none\",\n open ? \"scale-100 opacity-100 blur-none\" : \"scale-[0.98] opacity-0 blur-sm\",\n )}>{children}</div>\n </div>\n </div>;\n}\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent };\n"],"names":[],"mappings":";;;;;;AAOA;AAEA;;AAEE;AAAc;AACd;AACF;AAEA;AAUE;AACA;;AAEE;;;AAEA;AACF;;AAeF;AAEA;;AAEE;AAAqH;;AAEnH;AACE;AACA;;AAEA;AACD;;AAEH;AACF;AAEA;AACE;AACA;AAQF;;"}