@betterinternship/components 3.4.1 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -38
- package/dist/brand-logos.d.ts +4 -0
- package/dist/brand-logos.js +13 -0
- package/dist/brand-logos.js.map +1 -0
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/animated-count.js.map +1 -1
- package/dist/components/animated-shiny-text.js.map +1 -1
- package/dist/components/app-header.js.map +1 -1
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.js.map +1 -1
- package/dist/components/banner.js.map +1 -1
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/card.js.map +1 -1
- package/dist/components/carousel.js.map +1 -1
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/chip-select.js.map +1 -1
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/context-menu.js.map +1 -1
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/divider.js.map +1 -1
- package/dist/components/dot-matrix.js.map +1 -1
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/error.js.map +1 -1
- package/dist/components/fab.js.map +1 -1
- package/dist/components/file-upload.js.map +1 -1
- package/dist/components/filter-chip.js.map +1 -1
- package/dist/components/form-checkbox-group.js.map +1 -1
- package/dist/components/form-checkbox.js.map +1 -1
- package/dist/components/form-date-picker.js.map +1 -1
- package/dist/components/form-field.js.map +1 -1
- package/dist/components/form-input.js.map +1 -1
- package/dist/components/form-month-picker.js.map +1 -1
- package/dist/components/form-radio.js.map +1 -1
- package/dist/components/form-textarea.js.map +1 -1
- package/dist/components/form.js.map +1 -1
- package/dist/components/hover-card.js.map +1 -1
- package/dist/components/input-otp.js.map +1 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/label.js.map +1 -1
- package/dist/components/loader.js.map +1 -1
- package/dist/components/magnetic-button.js.map +1 -1
- package/dist/components/messages.js.map +1 -1
- package/dist/components/mobile-sheet-portal.js.map +1 -1
- package/dist/components/option-list.js.map +1 -1
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/paginator.js.map +1 -1
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress.js.map +1 -1
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/select.js.map +1 -1
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/slider.js.map +1 -1
- package/dist/components/sonner-toast.js +133 -133
- package/dist/components/sonner-toast.js.map +1 -1
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/time-input-native.js.map +1 -1
- package/dist/components/timeline.js.map +1 -1
- package/dist/components/toggle.js.map +1 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/hooks/use-detect-click-outside.js.map +1 -1
- package/dist/hooks/use-field-focus.js.map +1 -1
- package/dist/hooks/use-mobile-sheet-viewport.js.map +1 -1
- package/dist/hooks/use-mobile.js.map +1 -1
- package/dist/hooks/use-resource-table.js.map +1 -1
- package/dist/hooks/useMQJob.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/interaction-styles.js.map +1 -1
- package/dist/logos/base/betterinternship.svg.js +4 -0
- package/dist/logos/base/betterinternship.svg.js.map +1 -0
- package/dist/logos/black_fill/betterinternship_black.svg.js +4 -0
- package/dist/logos/black_fill/betterinternship_black.svg.js.map +1 -0
- package/dist/logos/circle/betterinternship_circle.svg.js +4 -0
- package/dist/logos/circle/betterinternship_circle.svg.js.map +1 -0
- package/dist/logos/white_fill/betterinternship_white.svg.js +4 -0
- package/dist/logos/white_fill/betterinternship_white.svg.js.map +1 -0
- package/dist/utils.js.map +1 -1
- package/package.json +330 -330
- package/theme.css +414 -414
- package/theme.legacy.css +84 -84
|
@@ -1 +1 @@
|
|
|
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
|
+
{"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 +1 @@
|
|
|
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;;;;"}
|
|
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,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;;;;"}
|
|
@@ -1 +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
|
+
{"version":3,"file":"carousel.js","sources":["../../src/components/carousel.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport useEmblaCarousel, {\r\n type UseEmblaCarouselType,\r\n} from \"embla-carousel-react\";\r\nimport { ArrowLeft, ArrowRight } from \"lucide-react\";\r\n\r\nimport { cn } from \"@/utils\";\r\nimport { Button, type ButtonProps } from \"./button\";\r\n\r\ntype CarouselApi = UseEmblaCarouselType[1];\r\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\r\ntype CarouselOptions = UseCarouselParameters[0];\r\ntype CarouselPlugin = UseCarouselParameters[1];\r\n\r\ntype CarouselProps = {\r\n opts?: CarouselOptions;\r\n plugins?: CarouselPlugin;\r\n orientation?: \"horizontal\" | \"vertical\";\r\n setApi?: (api: CarouselApi) => void;\r\n /** Automatically advance slides while the carousel is not hovered or focused. */\r\n autoPlay?: boolean;\r\n /** Delay between automatic advances in milliseconds. */\r\n autoPlayInterval?: number;\r\n};\r\n\r\ntype CarouselContextProps = {\r\n carouselRef: ReturnType<typeof useEmblaCarousel>[0];\r\n api: ReturnType<typeof useEmblaCarousel>[1];\r\n scrollPrev: () => void;\r\n scrollNext: () => void;\r\n canScrollPrev: boolean;\r\n canScrollNext: boolean;\r\n} & CarouselProps;\r\n\r\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null);\r\n\r\nfunction useCarousel() {\r\n const context = React.useContext(CarouselContext);\r\n\r\n if (!context) {\r\n throw new Error(\"useCarousel must be used within a <Carousel />\");\r\n }\r\n\r\n return context;\r\n}\r\n\r\nconst Carousel = React.forwardRef<\r\n HTMLDivElement,\r\n React.HTMLAttributes<HTMLDivElement> & CarouselProps\r\n>(\r\n (\r\n {\r\n orientation = \"horizontal\",\r\n opts,\r\n setApi,\r\n plugins,\r\n autoPlay = false,\r\n autoPlayInterval = 5000,\r\n className,\r\n children,\r\n ...props\r\n },\r\n ref,\r\n ) => {\r\n const [carouselRef, api] = useEmblaCarousel(\r\n {\r\n ...opts,\r\n axis: orientation === \"horizontal\" ? \"x\" : \"y\",\r\n },\r\n plugins,\r\n );\r\n const [canScrollPrev, setCanScrollPrev] = React.useState(false);\r\n const [canScrollNext, setCanScrollNext] = React.useState(false);\r\n const [hovered, setHovered] = React.useState(false);\r\n const [focused, setFocused] = React.useState(false);\r\n const [reducedMotion, setReducedMotion] = React.useState(true);\r\n\r\n React.useEffect(() => {\r\n const media = window.matchMedia('(prefers-reduced-motion: reduce)');\r\n const update = () => setReducedMotion(media.matches);\r\n update();\r\n media.addEventListener('change', update);\r\n return () => media.removeEventListener('change', update);\r\n }, []);\r\n\r\n React.useEffect(() => {\r\n if (!api || !autoPlay || hovered || focused || reducedMotion || autoPlayInterval <= 0) return;\r\n const timer = window.setInterval(() => {\r\n if (api.canScrollNext()) api.scrollNext();\r\n else api.scrollTo(0);\r\n }, autoPlayInterval);\r\n return () => window.clearInterval(timer);\r\n }, [api, autoPlay, hovered, focused, reducedMotion, autoPlayInterval]);\r\n\r\n const onSelect = React.useCallback((api: CarouselApi) => {\r\n if (!api) {\r\n return;\r\n }\r\n\r\n setCanScrollPrev(api.canScrollPrev());\r\n setCanScrollNext(api.canScrollNext());\r\n }, []);\r\n\r\n const scrollPrev = React.useCallback(() => {\r\n api?.scrollPrev();\r\n }, [api]);\r\n\r\n const scrollNext = React.useCallback(() => {\r\n api?.scrollNext();\r\n }, [api]);\r\n\r\n const handleKeyDown = React.useCallback(\r\n (event: React.KeyboardEvent<HTMLDivElement>) => {\r\n if (event.key === \"ArrowLeft\") {\r\n event.preventDefault();\r\n scrollPrev();\r\n } else if (event.key === \"ArrowRight\") {\r\n event.preventDefault();\r\n scrollNext();\r\n }\r\n },\r\n [scrollPrev, scrollNext],\r\n );\r\n\r\n React.useEffect(() => {\r\n if (!api || !setApi) {\r\n return;\r\n }\r\n\r\n setApi(api);\r\n }, [api, setApi]);\r\n\r\n React.useEffect(() => {\r\n if (!api) {\r\n return;\r\n }\r\n\r\n onSelect(api);\r\n api.on(\"reInit\", onSelect);\r\n api.on(\"select\", onSelect);\r\n\r\n return () => {\r\n api?.off(\"select\", onSelect);\r\n };\r\n }, [api, onSelect]);\r\n\r\n return (\r\n <CarouselContext.Provider\r\n value={{\r\n carouselRef,\r\n api: api,\r\n opts,\r\n orientation:\r\n orientation || (opts?.axis === \"y\" ? \"vertical\" : \"horizontal\"),\r\n scrollPrev,\r\n scrollNext,\r\n canScrollPrev,\r\n canScrollNext,\r\n }}\r\n >\r\n <div\r\n ref={ref}\r\n onKeyDownCapture={handleKeyDown}\r\n className={cn(\"relative\", className)}\r\n role=\"region\"\r\n aria-roledescription=\"carousel\"\r\n {...props}\r\n onPointerEnter={(event) => { if (event.pointerType === 'mouse') setHovered(true); props.onPointerEnter?.(event); }}\r\n onPointerLeave={(event) => { if (event.pointerType === 'mouse') setHovered(false); props.onPointerLeave?.(event); }}\r\n onFocusCapture={(event) => { setFocused(true); props.onFocusCapture?.(event); }}\r\n onBlurCapture={(event) => { if (!event.currentTarget.contains(event.relatedTarget)) setFocused(false); props.onBlurCapture?.(event); }}\r\n >\r\n {children}\r\n </div>\r\n </CarouselContext.Provider>\r\n );\r\n },\r\n);\r\nCarousel.displayName = \"Carousel\";\r\n\r\nconst CarouselContent = React.forwardRef<\r\n HTMLDivElement,\r\n React.HTMLAttributes<HTMLDivElement>\r\n>(({ className, ...props }, ref) => {\r\n const { carouselRef, orientation } = useCarousel();\r\n\r\n return (\r\n <div ref={carouselRef} className=\"overflow-hidden\">\r\n <div\r\n ref={ref}\r\n className={cn(\r\n \"flex\",\r\n orientation === \"horizontal\" ? \"-ml-4\" : \"-mt-4 flex-col\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n </div>\r\n );\r\n});\r\nCarouselContent.displayName = \"CarouselContent\";\r\n\r\nconst CarouselItem = React.forwardRef<\r\n HTMLDivElement,\r\n React.HTMLAttributes<HTMLDivElement>\r\n>(({ className, ...props }, ref) => {\r\n const { orientation } = useCarousel();\r\n\r\n return (\r\n <div\r\n ref={ref}\r\n role=\"group\"\r\n aria-roledescription=\"slide\"\r\n className={cn(\r\n \"min-w-0 shrink-0 grow-0 basis-full\",\r\n orientation === \"horizontal\" ? \"pl-4\" : \"pt-4\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n});\r\nCarouselItem.displayName = \"CarouselItem\";\r\n\r\nconst CarouselPrevious = React.forwardRef<\r\n HTMLButtonElement,\r\n ButtonProps\r\n>(({ className, variant = \"outline\", size = \"xs\", ...props }, ref) => {\r\n const { orientation, scrollPrev, canScrollPrev } = useCarousel();\r\n\r\n return (\r\n <Button\r\n ref={ref}\r\n variant={variant}\r\n size={size}\r\n className={cn(\r\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\",\r\n orientation === \"horizontal\"\r\n ? \"-left-12 top-1/2 -translate-y-1/2 motion-safe:pointer-fine:hover:-translate-y-1/2\"\r\n : \"-top-12 left-1/2 -translate-x-1/2 rotate-90\",\r\n className,\r\n )}\r\n disabled={!canScrollPrev}\r\n onClick={scrollPrev}\r\n {...props}\r\n >\r\n <ArrowLeft className=\"h-4 w-4\" />\r\n <span className=\"sr-only\">Previous slide</span>\r\n </Button>\r\n );\r\n});\r\nCarouselPrevious.displayName = \"CarouselPrevious\";\r\n\r\nconst CarouselNext = React.forwardRef<\r\n HTMLButtonElement,\r\n ButtonProps\r\n>(({ className, variant = \"outline\", size = \"xs\", ...props }, ref) => {\r\n const { orientation, scrollNext, canScrollNext } = useCarousel();\r\n\r\n return (\r\n <Button\r\n ref={ref}\r\n variant={variant}\r\n size={size}\r\n className={cn(\r\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\",\r\n orientation === \"horizontal\"\r\n ? \"-right-12 top-1/2 -translate-y-1/2 motion-safe:pointer-fine:hover:-translate-y-1/2\"\r\n : \"-bottom-12 left-1/2 -translate-x-1/2 rotate-90\",\r\n className,\r\n )}\r\n disabled={!canScrollNext}\r\n onClick={scrollNext}\r\n {...props}\r\n >\r\n <ArrowRight className=\"h-4 w-4\" />\r\n <span className=\"sr-only\">Next slide</span>\r\n </Button>\r\n );\r\n});\r\nCarouselNext.displayName = \"CarouselNext\";\r\n\r\nexport {\r\n type CarouselApi,\r\n Carousel,\r\n CarouselContent,\r\n CarouselItem,\r\n CarouselPrevious,\r\n CarouselNext,\r\n};\r\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';\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;;"}
|
|
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 +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;;"}
|
|
1
|
+
{"version":3,"file":"chip-select.js","sources":["../../src/components/chip-select.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from 'react';\r\nimport * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';\r\nimport { CheckboxVisual } from './checkbox';\r\nimport { cn } from '@/utils';\r\n\r\nexport type Option = { value: string; label: string };\r\n\r\nconst chipClassName = (selected: boolean) => cn(\r\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',\r\n selected && 'border-primary bg-primary-tint text-primary enabled:hover:border-primary enabled:hover:bg-primary-tint enabled:hover:text-primary',\r\n);\r\n\r\nconst RadioVisual = ({ checked }: { checked: boolean }) => (\r\n <svg\r\n aria-hidden=\"true\"\r\n data-state={checked ? 'checked' : 'unchecked'}\r\n className=\"size-4 shrink-0\"\r\n viewBox=\"0 0 16 16\"\r\n >\r\n <circle\r\n cx=\"8\"\r\n cy=\"8\"\r\n r=\"7\"\r\n fill={checked ? 'var(--primary)' : 'var(--muted)'}\r\n stroke={checked ? 'var(--primary)' : 'var(--input)'}\r\n strokeWidth=\"1\"\r\n />\r\n {checked && <circle cx=\"8\" cy=\"8\" r=\"4\" fill=\"var(--background)\" />}\r\n </svg>\r\n);\r\n\r\nexport type ChipSelectProps = {\r\n options: Option[];\r\n className?: string;\r\n} & ({\r\n multiple: true;\r\n value: string[];\r\n onChange: (value: string[]) => void;\r\n} | {\r\n multiple?: false;\r\n value: string | null;\r\n onChange: (value: string | null) => void;\r\n});\r\n\r\n/** A compact form choice group supporting single or multiple selection. */\r\nexport function ChipSelect({ value, onChange, options, className, multiple = false }: ChipSelectProps) {\r\n const groupValue = (multiple ? value : value ?? '') as string | string[];\r\n const SelectGroup = ToggleGroupPrimitive.Root as React.ComponentType<any>;\r\n return (\r\n <SelectGroup\r\n type={multiple ? 'multiple' : 'single'}\r\n value={groupValue}\r\n onValueChange={(next: string | string[]) => multiple\r\n ? (onChange as (value: string[]) => void)(next as string[])\r\n : (onChange as (value: string | null) => void)((next as string) || null)}\r\n className={cn('flex flex-wrap justify-start gap-2', className)}\r\n >\r\n {options.map((option) => {\r\n const selected = multiple ? (value as string[]).includes(option.value) : value === option.value;\r\n return <ToggleGroupPrimitive.Item key={option.value} value={option.value} className={chipClassName(selected)}>\r\n {multiple ? <CheckboxVisual checked={selected} /> : <RadioVisual checked={selected} />}\r\n {option.label}\r\n </ToggleGroupPrimitive.Item>;\r\n })}\r\n </SelectGroup>\r\n );\r\n}\r\n"],"names":[],"mappings":";;;;;;AASA;AAKA;AAgCA;AACM;AACJ;AACA;;AAMM;;;;;AAaR;;"}
|
|
@@ -1 +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\";\nimport { interactiveSurfaceClassName } from \"@/lib/interaction-styles\";\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(\n \"w-full overflow-hidden rounded-control-lg border border-input bg-background\",\n // The ready-made panel, closed, answers like an interactive Card (lift,\n // shadow, darker border). Open, it holds content being worked in, so it\n // stays put and only the title row highlights.\n title !== undefined && !open && cn(interactiveSurfaceClassName, \"pointer-fine:hover:border-border-hover focus-within:border-border-hover\"),\n className,\n )} 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-ring\">\n <span>{title}</span>\n <ChevronDown aria-hidden=\"true\" className={cn(\"h-5 w-5 shrink-0 transition-transform duration-state ease-out-strong 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-out-strong 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-out-strong 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":";;;;;;;AAQA;AAEA;;AAEE;AAAc;AACd;AACF;AAEA;AAUE;AACA;;AAEE;;;AAEA;AACF;AAEA;;;;AAMI;AAcN;AAEA;;AAEE;AAAqH;;AAEnH;AACE;AACA;;AAEA;AACD;;AAEH;AACF;AAEA;AACE;AACA;AAQF;;"}
|
|
1
|
+
{"version":3,"file":"collapsible.js","sources":["../../src/components/collapsible.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { ChevronDown } from \"lucide-react\";\r\nimport { cn } from \"@/utils\";\r\nimport { interactiveSurfaceClassName } from \"@/lib/interaction-styles\";\r\n\r\ntype ContextValue = { open: boolean; toggle: () => void };\r\nconst CollapsibleContext = React.createContext<ContextValue | null>(null);\r\n\r\nfunction useCollapsible() {\r\n const context = React.useContext(CollapsibleContext);\r\n if (!context) throw new Error(\"Collapsible parts must be used inside Collapsible\");\r\n return context;\r\n}\r\n\r\nfunction Collapsible({ open: controlledOpen, defaultOpen = false, onOpenChange, className, children, title, divider = false, ...props }: {\r\n open?: boolean;\r\n defaultOpen?: boolean;\r\n onOpenChange?: (open: boolean) => void;\r\n className?: string;\r\n children: React.ReactNode;\r\n /** Optional heading for the ready-to-use collapsible panel. */\r\n title?: string;\r\n divider?: boolean;\r\n} & React.HTMLAttributes<HTMLDivElement>) {\r\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);\r\n const open = controlledOpen ?? uncontrolledOpen;\r\n const toggle = () => {\r\n const next = !open;\r\n if (controlledOpen === undefined) setUncontrolledOpen(next);\r\n onOpenChange?.(next);\r\n };\r\n\r\n return <CollapsibleContext.Provider value={{ open, toggle }}>\r\n <div className={cn(\r\n \"w-full overflow-hidden rounded-control-lg border border-input bg-background\",\r\n // The ready-made panel, closed, answers like an interactive Card (lift,\r\n // shadow, darker border). Open, it holds content being worked in, so it\r\n // stays put and only the title row highlights.\r\n title !== undefined && !open && cn(interactiveSurfaceClassName, \"pointer-fine:hover:border-border-hover focus-within:border-border-hover\"),\r\n className,\r\n )} data-state={open ? \"open\" : \"closed\"} {...props}>\r\n {title !== undefined ? <>\r\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-ring\">\r\n <span>{title}</span>\r\n <ChevronDown aria-hidden=\"true\" className={cn(\"h-5 w-5 shrink-0 transition-transform duration-state ease-out-strong motion-reduce:transition-none\", open && \"rotate-180\")} />\r\n </CollapsibleTrigger>\r\n <CollapsibleContent divider={divider}>\r\n <div className=\"px-4 pb-4 pt-4\">{children}</div>\r\n </CollapsibleContent>\r\n </> : children}\r\n </div>\r\n </CollapsibleContext.Provider>;\r\n}\r\n\r\nfunction CollapsibleTrigger({ asChild, className, children, onClick, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement> & { asChild?: boolean }) {\r\n const { open, toggle } = useCollapsible();\r\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => { onClick?.(event); if (!event.defaultPrevented) toggle(); };\r\n if (asChild && React.isValidElement(children)) {\r\n return React.cloneElement(children as React.ReactElement<any>, {\r\n ...props,\r\n 'aria-expanded': open,\r\n 'data-state': open ? 'open' : 'closed',\r\n onClick: handleClick,\r\n });\r\n }\r\n return <button type=\"button\" {...props} aria-expanded={open} data-state={open ? \"open\" : \"closed\"} className={className} onClick={handleClick}>{children}</button>;\r\n}\r\n\r\nfunction CollapsibleContent({ className, children, divider = false, style, ...props }: React.HTMLAttributes<HTMLDivElement> & { divider?: boolean }) {\r\n const { open } = useCollapsible();\r\n return <div className={cn(\"grid transition-[grid-template-rows] duration-state ease-out-strong motion-reduce:transition-none\", divider && open && \"border-t border-border\", className)} style={{ gridTemplateRows: open ? \"1fr\" : \"0fr\", ...style }} aria-hidden={!open} inert={!open} {...props}>\r\n <div className=\"min-h-0 overflow-hidden\">\r\n <div className={cn(\r\n \"origin-top transition-[opacity,transform,filter] duration-state ease-out-strong motion-reduce:transform-none motion-reduce:filter-none motion-reduce:transition-none\",\r\n open ? \"scale-100 opacity-100 blur-none\" : \"scale-[0.98] opacity-0 blur-sm\",\r\n )}>{children}</div>\r\n </div>\r\n </div>;\r\n}\r\n\r\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent };\r\n"],"names":[],"mappings":";;;;;;;AAQA;AAEA;;AAEE;AAAc;AACd;AACF;AAEA;AAUE;AACA;;AAEE;;;AAEA;AACF;AAEA;;;;AAMI;AAcN;AAEA;;AAEE;AAAqH;;AAEnH;AACE;AACA;;AAEA;AACD;;AAEH;AACF;AAEA;AACE;AACA;AAQF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-menu.js","sources":["../../src/components/context-menu.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as ContextMenuPrimitive from \"@radix-ui/react-context-menu\";\nimport { Check, ChevronRight, Circle } from \"lucide-react\";\n\nimport { cn } from \"@/utils\";\n\nconst ContextMenu = ContextMenuPrimitive.Root;\n\nconst ContextMenuTrigger = ContextMenuPrimitive.Trigger;\n\nconst ContextMenuGroup = ContextMenuPrimitive.Group;\n\nconst ContextMenuPortal = ContextMenuPrimitive.Portal;\n\nconst ContextMenuSub = ContextMenuPrimitive.Sub;\n\nconst ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;\n\nconst ContextMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <ContextMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"flex cursor-pointer select-none items-center min-h-option-row pointer-coarse:min-h-11 rounded-control-sm px-option-x py-2 text-sm outline-none focus:bg-muted focus:text-foreground data-[state=open]:bg-muted data-[state=open]:text-foreground\",\n inset && \"pl-9\",\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto h-4 w-4\" />\n </ContextMenuPrimitive.SubTrigger>\n));\nContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;\n\nconst ContextMenuSubContent = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n \"z-(--z-popover) min-w-[8rem] overflow-hidden rounded-control-lg border border-border bg-popover p-option-inset text-popover-foreground shadow-card data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className,\n )}\n {...props}\n />\n));\nContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;\n\nconst ContextMenuContent = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Portal>\n <ContextMenuPrimitive.Content\n ref={ref}\n className={cn(\n \"z-(--z-popover) min-w-[8rem] overflow-hidden rounded-control-lg border border-border bg-popover p-option-inset text-popover-foreground shadow-card animate-in motion-reduce:animate-none fade-in-80 data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className,\n )}\n {...props}\n />\n </ContextMenuPrimitive.Portal>\n));\nContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;\n\nconst ContextMenuItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-pointer select-none items-center min-h-option-row pointer-coarse:min-h-11 rounded-control-sm px-option-x py-2 text-sm outline-none focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n inset && \"pl-9\",\n className,\n )}\n {...props}\n />\n));\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\n\nconst ContextMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <ContextMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n \"relative flex cursor-pointer select-none items-center min-h-option-row pointer-coarse:min-h-11 rounded-control-sm py-2 pl-9 pr-option-x text-sm outline-none focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className,\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-option-x flex h-3.5 w-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.CheckboxItem>\n));\nContextMenuCheckboxItem.displayName =\n ContextMenuPrimitive.CheckboxItem.displayName;\n\nconst ContextMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <ContextMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n \"relative flex cursor-pointer select-none items-center min-h-option-row pointer-coarse:min-h-11 rounded-control-sm py-2 pl-9 pr-option-x text-sm outline-none focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-option-x flex h-3.5 w-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Circle className=\"h-2 w-2 fill-current\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.RadioItem>\n));\nContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;\n\nconst ContextMenuLabel = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Label\n ref={ref}\n className={cn(\n \"px-2 py-1.5 text-sm font-semibold text-foreground\",\n inset && \"pl-9\",\n className,\n )}\n {...props}\n />\n));\nContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;\n\nconst ContextMenuSeparator = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-option-inset my-1 h-px bg-border\", className)}\n {...props}\n />\n));\nContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;\n\nconst ContextMenuShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground\",\n className,\n )}\n {...props}\n />\n );\n};\nContextMenuShortcut.displayName = \"ContextMenuShortcut\";\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioItem,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuGroup,\n ContextMenuPortal,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuRadioGroup,\n};\n"],"names":[],"mappings":";;;;;;;AAQA;AAEA;AAEA;AAEA;AAEA;AAEA;AAEA;AAmBA;AAEA;AAaA;AAEA;AAeA;AAEA;AAgBA;AAEA;AAqBA;AACE;AAEF;AAoBA;AAEA;AAgBA;AAEA;AAUA;AAEA;AAIE;AASF;AACA;;"}
|
|
1
|
+
{"version":3,"file":"context-menu.js","sources":["../../src/components/context-menu.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport * as ContextMenuPrimitive from \"@radix-ui/react-context-menu\";\r\nimport { Check, ChevronRight, Circle } from \"lucide-react\";\r\n\r\nimport { cn } from \"@/utils\";\r\n\r\nconst ContextMenu = ContextMenuPrimitive.Root;\r\n\r\nconst ContextMenuTrigger = ContextMenuPrimitive.Trigger;\r\n\r\nconst ContextMenuGroup = ContextMenuPrimitive.Group;\r\n\r\nconst ContextMenuPortal = ContextMenuPrimitive.Portal;\r\n\r\nconst ContextMenuSub = ContextMenuPrimitive.Sub;\r\n\r\nconst ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;\r\n\r\nconst ContextMenuSubTrigger = React.forwardRef<\r\n React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,\r\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {\r\n inset?: boolean;\r\n }\r\n>(({ className, inset, children, ...props }, ref) => (\r\n <ContextMenuPrimitive.SubTrigger\r\n ref={ref}\r\n className={cn(\r\n \"flex cursor-pointer select-none items-center min-h-option-row pointer-coarse:min-h-11 rounded-control-sm px-option-x py-2 text-sm outline-none focus:bg-muted focus:text-foreground data-[state=open]:bg-muted data-[state=open]:text-foreground\",\r\n inset && \"pl-9\",\r\n className,\r\n )}\r\n {...props}\r\n >\r\n {children}\r\n <ChevronRight className=\"ml-auto h-4 w-4\" />\r\n </ContextMenuPrimitive.SubTrigger>\r\n));\r\nContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;\r\n\r\nconst ContextMenuSubContent = React.forwardRef<\r\n React.ElementRef<typeof ContextMenuPrimitive.SubContent>,\r\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>\r\n>(({ className, ...props }, ref) => (\r\n <ContextMenuPrimitive.SubContent\r\n ref={ref}\r\n className={cn(\r\n \"z-(--z-popover) min-w-[8rem] overflow-hidden rounded-control-lg border border-border bg-popover p-option-inset text-popover-foreground shadow-card data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n));\r\nContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;\r\n\r\nconst ContextMenuContent = React.forwardRef<\r\n React.ElementRef<typeof ContextMenuPrimitive.Content>,\r\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>\r\n>(({ className, ...props }, ref) => (\r\n <ContextMenuPrimitive.Portal>\r\n <ContextMenuPrimitive.Content\r\n ref={ref}\r\n className={cn(\r\n \"z-(--z-popover) min-w-[8rem] overflow-hidden rounded-control-lg border border-border bg-popover p-option-inset text-popover-foreground shadow-card animate-in motion-reduce:animate-none fade-in-80 data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n </ContextMenuPrimitive.Portal>\r\n));\r\nContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;\r\n\r\nconst ContextMenuItem = React.forwardRef<\r\n React.ElementRef<typeof ContextMenuPrimitive.Item>,\r\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {\r\n inset?: boolean;\r\n }\r\n>(({ className, inset, ...props }, ref) => (\r\n <ContextMenuPrimitive.Item\r\n ref={ref}\r\n className={cn(\r\n \"relative flex cursor-pointer select-none items-center min-h-option-row pointer-coarse:min-h-11 rounded-control-sm px-option-x py-2 text-sm outline-none focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\r\n inset && \"pl-9\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n));\r\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\r\n\r\nconst ContextMenuCheckboxItem = React.forwardRef<\r\n React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,\r\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>\r\n>(({ className, children, checked, ...props }, ref) => (\r\n <ContextMenuPrimitive.CheckboxItem\r\n ref={ref}\r\n className={cn(\r\n \"relative flex cursor-pointer select-none items-center min-h-option-row pointer-coarse:min-h-11 rounded-control-sm py-2 pl-9 pr-option-x text-sm outline-none focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\r\n className,\r\n )}\r\n checked={checked}\r\n {...props}\r\n >\r\n <span className=\"absolute left-option-x flex h-3.5 w-3.5 items-center justify-center\">\r\n <ContextMenuPrimitive.ItemIndicator>\r\n <Check className=\"h-4 w-4\" />\r\n </ContextMenuPrimitive.ItemIndicator>\r\n </span>\r\n {children}\r\n </ContextMenuPrimitive.CheckboxItem>\r\n));\r\nContextMenuCheckboxItem.displayName =\r\n ContextMenuPrimitive.CheckboxItem.displayName;\r\n\r\nconst ContextMenuRadioItem = React.forwardRef<\r\n React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,\r\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>\r\n>(({ className, children, ...props }, ref) => (\r\n <ContextMenuPrimitive.RadioItem\r\n ref={ref}\r\n className={cn(\r\n \"relative flex cursor-pointer select-none items-center min-h-option-row pointer-coarse:min-h-11 rounded-control-sm py-2 pl-9 pr-option-x text-sm outline-none focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\r\n className,\r\n )}\r\n {...props}\r\n >\r\n <span className=\"absolute left-option-x flex h-3.5 w-3.5 items-center justify-center\">\r\n <ContextMenuPrimitive.ItemIndicator>\r\n <Circle className=\"h-2 w-2 fill-current\" />\r\n </ContextMenuPrimitive.ItemIndicator>\r\n </span>\r\n {children}\r\n </ContextMenuPrimitive.RadioItem>\r\n));\r\nContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;\r\n\r\nconst ContextMenuLabel = React.forwardRef<\r\n React.ElementRef<typeof ContextMenuPrimitive.Label>,\r\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {\r\n inset?: boolean;\r\n }\r\n>(({ className, inset, ...props }, ref) => (\r\n <ContextMenuPrimitive.Label\r\n ref={ref}\r\n className={cn(\r\n \"px-2 py-1.5 text-sm font-semibold text-foreground\",\r\n inset && \"pl-9\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n));\r\nContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;\r\n\r\nconst ContextMenuSeparator = React.forwardRef<\r\n React.ElementRef<typeof ContextMenuPrimitive.Separator>,\r\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>\r\n>(({ className, ...props }, ref) => (\r\n <ContextMenuPrimitive.Separator\r\n ref={ref}\r\n className={cn(\"-mx-option-inset my-1 h-px bg-border\", className)}\r\n {...props}\r\n />\r\n));\r\nContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;\r\n\r\nconst ContextMenuShortcut = ({\r\n className,\r\n ...props\r\n}: React.HTMLAttributes<HTMLSpanElement>) => {\r\n return (\r\n <span\r\n className={cn(\r\n \"ml-auto text-xs tracking-widest text-muted-foreground\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n};\r\nContextMenuShortcut.displayName = \"ContextMenuShortcut\";\r\n\r\nexport {\r\n ContextMenu,\r\n ContextMenuTrigger,\r\n ContextMenuContent,\r\n ContextMenuItem,\r\n ContextMenuCheckboxItem,\r\n ContextMenuRadioItem,\r\n ContextMenuLabel,\r\n ContextMenuSeparator,\r\n ContextMenuShortcut,\r\n ContextMenuGroup,\r\n ContextMenuPortal,\r\n ContextMenuSub,\r\n ContextMenuSubContent,\r\n ContextMenuSubTrigger,\r\n ContextMenuRadioGroup,\r\n};\r\n"],"names":[],"mappings":";;;;;;;AAQA;AAEA;AAEA;AAEA;AAEA;AAEA;AAEA;AAmBA;AAEA;AAaA;AAEA;AAeA;AAEA;AAgBA;AAEA;AAqBA;AACE;AAEF;AAoBA;AAEA;AAgBA;AAEA;AAUA;AAEA;AAIE;AASF;AACA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","sources":["../../src/components/dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { XIcon } from 'lucide-react';\n\nimport { cn } from '@/utils';\n\nfunction Dialog({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />;\n}\n\nfunction DialogTrigger({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\n}\n\nfunction DialogPortal({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />;\n}\n\nfunction DialogClose({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\n// Dialogs share the Sheet's layers (overlay 1100, content 1101), so either\n// can open over the other and both sit above app chrome.\nfunction DialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n 'data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-(--z-modal-overlay) bg-black/30',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction DialogContent({\n className,\n children,\n showCloseButton = true,\n overlayClassName,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean;\n /** Classes for the backdrop, e.g. a lighter tint. */\n overlayClassName?: string;\n}) {\n return (\n <DialogPortal data-slot=\"dialog-portal\">\n <DialogOverlay className={overlayClassName} />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n 'bg-background data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-(--z-modal) grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 max-h-[calc(100dvh-2rem)] overflow-y-auto rounded-card border border-border p-6 shadow-card duration-interactive ease-out-strong sm:max-w-lg',\n className,\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className=\"absolute right-4 top-4 flex size-11 items-center justify-center rounded-control-lg text-muted-foreground transition-colors duration-state hover:bg-accent hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none motion-reduce:transition-none [&_svg]:size-4\"\n >\n <XIcon />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nfunction DialogHeader({ className, divider = false, ...props }: React.ComponentProps<'div'> & { divider?: boolean }) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn('flex flex-col gap-2 pr-10 text-left', divider && 'border-b border-border pb-4', className)}\n {...props}\n />\n );\n}\n\nfunction DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction DialogDivider({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-divider\"\n role=\"separator\"\n className={cn('h-px w-full bg-border', className)}\n {...props}\n />\n );\n}\n\nfunction DialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn('text-xl leading-snug font-semibold', className)}\n {...props}\n />\n );\n}\n\nfunction DialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn('text-muted-foreground text-sm', className)}\n {...props}\n />\n );\n}\n\nfunction DialogBottomSheet({\n className,\n children,\n showCloseButton = true,\n overlayClassName,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean;\n /** Classes for the backdrop, e.g. a lighter tint. */\n overlayClassName?: string;\n}) {\n return (\n <DialogPortal data-slot=\"dialog-portal\">\n <DialogOverlay className={overlayClassName} />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n 'bg-background data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom fixed bottom-0 left-0 right-0 z-(--z-modal) w-full max-h-[90dvh] overflow-y-auto rounded-t-card border-t border-border p-6 pb-[max(1.5rem,env(safe-area-inset-bottom))] shadow-card duration-interactive ease-out-strong',\n className,\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className=\"absolute right-4 top-4 flex size-11 items-center justify-center rounded-control-lg text-muted-foreground transition-colors duration-state hover:bg-accent hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none motion-reduce:transition-none [&_svg]:size-4\"\n >\n <XIcon />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nexport {\n Dialog,\n DialogBottomSheet,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogDivider,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n};\n"],"names":["_jsx","DialogPrimitive","_jsxs"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"dialog.js","sources":["../../src/components/dialog.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\r\nimport { XIcon } from 'lucide-react';\r\n\r\nimport { cn } from '@/utils';\r\n\r\nfunction Dialog({\r\n ...props\r\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\r\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />;\r\n}\r\n\r\nfunction DialogTrigger({\r\n ...props\r\n}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\r\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\r\n}\r\n\r\nfunction DialogPortal({\r\n ...props\r\n}: React.ComponentProps<typeof DialogPrimitive.Portal>) {\r\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />;\r\n}\r\n\r\nfunction DialogClose({\r\n ...props\r\n}: React.ComponentProps<typeof DialogPrimitive.Close>) {\r\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\r\n}\r\n\r\n// Dialogs share the Sheet's layers (overlay 1100, content 1101), so either\r\n// can open over the other and both sit above app chrome.\r\nfunction DialogOverlay({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\r\n return (\r\n <DialogPrimitive.Overlay\r\n data-slot=\"dialog-overlay\"\r\n className={cn(\r\n 'data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-(--z-modal-overlay) bg-black/30',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DialogContent({\r\n className,\r\n children,\r\n showCloseButton = true,\r\n overlayClassName,\r\n ...props\r\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\r\n showCloseButton?: boolean;\r\n /** Classes for the backdrop, e.g. a lighter tint. */\r\n overlayClassName?: string;\r\n}) {\r\n return (\r\n <DialogPortal data-slot=\"dialog-portal\">\r\n <DialogOverlay className={overlayClassName} />\r\n <DialogPrimitive.Content\r\n data-slot=\"dialog-content\"\r\n className={cn(\r\n 'bg-background data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-(--z-modal) grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 max-h-[calc(100dvh-2rem)] overflow-y-auto rounded-card border border-border p-6 shadow-card duration-interactive ease-out-strong sm:max-w-lg',\r\n className,\r\n )}\r\n {...props}\r\n >\r\n {children}\r\n {showCloseButton && (\r\n <DialogPrimitive.Close\r\n data-slot=\"dialog-close\"\r\n className=\"absolute right-4 top-4 flex size-11 items-center justify-center rounded-control-lg text-muted-foreground transition-colors duration-state hover:bg-accent hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none motion-reduce:transition-none [&_svg]:size-4\"\r\n >\r\n <XIcon />\r\n <span className=\"sr-only\">Close</span>\r\n </DialogPrimitive.Close>\r\n )}\r\n </DialogPrimitive.Content>\r\n </DialogPortal>\r\n );\r\n}\r\n\r\nfunction DialogHeader({ className, divider = false, ...props }: React.ComponentProps<'div'> & { divider?: boolean }) {\r\n return (\r\n <div\r\n data-slot=\"dialog-header\"\r\n className={cn('flex flex-col gap-2 pr-10 text-left', divider && 'border-b border-border pb-4', className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {\r\n return (\r\n <div\r\n data-slot=\"dialog-footer\"\r\n className={cn(\r\n 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DialogDivider({ className, ...props }: React.ComponentProps<'div'>) {\r\n return (\r\n <div\r\n data-slot=\"dialog-divider\"\r\n role=\"separator\"\r\n className={cn('h-px w-full bg-border', className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DialogTitle({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof DialogPrimitive.Title>) {\r\n return (\r\n <DialogPrimitive.Title\r\n data-slot=\"dialog-title\"\r\n className={cn('text-xl leading-snug font-semibold', className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DialogDescription({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\r\n return (\r\n <DialogPrimitive.Description\r\n data-slot=\"dialog-description\"\r\n className={cn('text-muted-foreground text-sm', className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DialogBottomSheet({\r\n className,\r\n children,\r\n showCloseButton = true,\r\n overlayClassName,\r\n ...props\r\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\r\n showCloseButton?: boolean;\r\n /** Classes for the backdrop, e.g. a lighter tint. */\r\n overlayClassName?: string;\r\n}) {\r\n return (\r\n <DialogPortal data-slot=\"dialog-portal\">\r\n <DialogOverlay className={overlayClassName} />\r\n <DialogPrimitive.Content\r\n data-slot=\"dialog-content\"\r\n className={cn(\r\n 'bg-background data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom fixed bottom-0 left-0 right-0 z-(--z-modal) w-full max-h-[90dvh] overflow-y-auto rounded-t-card border-t border-border p-6 pb-[max(1.5rem,env(safe-area-inset-bottom))] shadow-card duration-interactive ease-out-strong',\r\n className,\r\n )}\r\n {...props}\r\n >\r\n {children}\r\n {showCloseButton && (\r\n <DialogPrimitive.Close\r\n data-slot=\"dialog-close\"\r\n className=\"absolute right-4 top-4 flex size-11 items-center justify-center rounded-control-lg text-muted-foreground transition-colors duration-state hover:bg-accent hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none motion-reduce:transition-none [&_svg]:size-4\"\r\n >\r\n <XIcon />\r\n <span className=\"sr-only\">Close</span>\r\n </DialogPrimitive.Close>\r\n )}\r\n </DialogPrimitive.Content>\r\n </DialogPortal>\r\n );\r\n}\r\n\r\nexport {\r\n Dialog,\r\n DialogBottomSheet,\r\n DialogClose,\r\n DialogContent,\r\n DialogDescription,\r\n DialogDivider,\r\n DialogFooter,\r\n DialogHeader,\r\n DialogOverlay,\r\n DialogPortal,\r\n DialogTitle,\r\n DialogTrigger,\r\n};\r\n"],"names":["_jsx","DialogPrimitive","_jsxs"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divider.js","sources":["../../src/components/divider.tsx"],"sourcesContent":["import type { ComponentProps } from 'react';\nimport * as SeparatorPrimitive from '@radix-ui/react-separator';\nimport { cn } from '@/utils';\n\nexport function Divider({ className, orientation = 'horizontal', decorative = true, ...props }: ComponentProps<typeof SeparatorPrimitive.Root>) {\n return <SeparatorPrimitive.Root {...props} decorative={decorative} orientation={orientation} className={cn('shrink-0 bg-border', orientation === 'horizontal' ? 'my-5 h-px w-full' : 'mx-5 h-full w-px', className)} />;\n}\n"],"names":["_jsx"],"mappings":";;;;SAIgB,OAAO,CAAC,EAAE,SAAS,EAAE,WAAW,GAAG,YAAY,EAAE,UAAU,GAAG,IAAI,EAAE,GAAG,KAAK,EAAkD,EAAA;AAC5I,IAAA,OAAOA,IAAC,kBAAkB,CAAC,IAAI,EAAA,EAAA,GAAK,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,CAAC,oBAAoB,EAAE,WAAW,KAAK,YAAY,GAAG,kBAAkB,GAAG,kBAAkB,EAAE,SAAS,CAAC,GAAI;AACzN;;;;"}
|
|
1
|
+
{"version":3,"file":"divider.js","sources":["../../src/components/divider.tsx"],"sourcesContent":["import type { ComponentProps } from 'react';\r\nimport * as SeparatorPrimitive from '@radix-ui/react-separator';\r\nimport { cn } from '@/utils';\r\n\r\nexport function Divider({ className, orientation = 'horizontal', decorative = true, ...props }: ComponentProps<typeof SeparatorPrimitive.Root>) {\r\n return <SeparatorPrimitive.Root {...props} decorative={decorative} orientation={orientation} className={cn('shrink-0 bg-border', orientation === 'horizontal' ? 'my-5 h-px w-full' : 'mx-5 h-full w-px', className)} />;\r\n}\r\n"],"names":["_jsx"],"mappings":";;;;SAIgB,OAAO,CAAC,EAAE,SAAS,EAAE,WAAW,GAAG,YAAY,EAAE,UAAU,GAAG,IAAI,EAAE,GAAG,KAAK,EAAkD,EAAA;AAC5I,IAAA,OAAOA,IAAC,kBAAkB,CAAC,IAAI,EAAA,EAAA,GAAK,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,CAAC,oBAAoB,EAAE,WAAW,KAAK,YAAY,GAAG,kBAAkB,GAAG,kBAAkB,EAAE,SAAS,CAAC,GAAI;AACzN;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dot-matrix.js","sources":["../../src/components/dot-matrix.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef } from \"react\";\nimport { cn } from \"@/utils\";\n\n/** Pitch between dots and the margin around the grid, in CSS px. */\nconst STEP = 11;\nconst EDGE = 10;\n\n/** Halftone sizing: dots swell under the drifting blobs and shrink between them. */\nconst MIN_RADIUS = 0.8;\nconst MAX_RADIUS = STEP * 0.36;\n\n/** Opacity range; the floor keeps the whole lattice faintly visible. */\nconst MIN_ALPHA = 0.16;\nconst MAX_ALPHA = 0.75;\n\n/** A fixed permutation so every instance shows the same, stable field. */\nconst PERM = (() => {\n const table = Array.from({ length: 256 }, (_, i) => i);\n let seed = 7;\n for (let i = 255; i > 0; i--) {\n seed = (seed * 16807) % 2147483647;\n const j = seed % (i + 1);\n [table[i], table[j]] = [table[j], table[i]];\n }\n return Uint8Array.from([...table, ...table]);\n})();\n\nconst fade = (t: number) => t * t * t * (t * (t * 6 - 15) + 10);\n\n/** 2D Perlin noise, roughly in [-0.7, 0.7]: smooth, organic, never striped. */\nfunction noise(x: number, y: number) {\n const xi = Math.floor(x);\n const yi = Math.floor(y);\n const xf = x - xi;\n const yf = y - yi;\n const X = xi & 255;\n const Y = yi & 255;\n const grad = (hash: number, dx: number, dy: number) => {\n const h = hash & 7;\n const u = h < 4 ? dx : dy;\n const v = h < 4 ? dy : dx;\n return (h & 1 ? -u : u) + (h & 2 ? -2 * v : 2 * v) * 0.5;\n };\n const aa = PERM[PERM[X] + Y];\n const ab = PERM[PERM[X] + Y + 1];\n const ba = PERM[PERM[X + 1] + Y];\n const bb = PERM[PERM[X + 1] + Y + 1];\n const u = fade(xf);\n const v = fade(yf);\n const top = grad(aa, xf, yf) + u * (grad(ba, xf - 1, yf) - grad(aa, xf, yf));\n const bottom =\n grad(ab, xf, yf - 1) + u * (grad(bb, xf - 1, yf - 1) - grad(ab, xf, yf - 1));\n return top + v * (bottom - top);\n}\n\nexport interface DotMatrixProps {\n /**\n * Dot color comes from `currentColor`, so tint with a text token:\n * `text-primary` (default), `text-secondary-foreground`, `text-muted-foreground`.\n */\n className?: string;\n /** Softly fade the lattice into the surrounding surface. Defaults to true. */\n fade?: boolean;\n /** Animation speed multiplier. 1 is the calm default; 0 holds a still frame. */\n speed?: number;\n}\n\n/**\n * A decorative \"still being generated\" surface: a halftone lattice of dots\n * tinted with a theme color. Two layers of smooth noise drift in different\n * directions, so soft blobs of larger, stronger dots swell, merge and fade\n * across the grid.\n *\n * It fills its nearest positioned parent, animates only while on screen and\n * shows a still frame when the user prefers reduced motion.\n */\nexport function DotMatrix({ className, fade: fadeEdges = true, speed = 1 }: DotMatrixProps) {\n const ref = useRef<HTMLCanvasElement>(null);\n\n useEffect(() => {\n const canvas = ref.current;\n const context = canvas?.getContext(\"2d\");\n if (!canvas || !context) return;\n\n const motion = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n const dpr = Math.min(2, window.devicePixelRatio || 1);\n let xs: number[] = [];\n let ys: number[] = [];\n let width = 0;\n let height = 0;\n let frame = 0;\n let visible = false;\n\n const still = () => motion.matches || speed <= 0;\n\n const build = () => {\n width = canvas.clientWidth;\n height = canvas.clientHeight;\n canvas.width = Math.max(1, Math.round(width * dpr));\n canvas.height = Math.max(1, Math.round(height * dpr));\n context.setTransform(dpr, 0, 0, dpr, 0, 0);\n\n const columns = Math.max(1, Math.floor((width - EDGE * 2) / STEP) + 1);\n const rows = Math.max(1, Math.floor((height - EDGE * 2) / STEP) + 1);\n const left = (width - (columns - 1) * STEP) / 2;\n const top = (height - (rows - 1) * STEP) / 2;\n xs = Array.from({ length: columns }, (_, i) => left + i * STEP);\n ys = Array.from({ length: rows }, (_, i) => top + i * STEP);\n };\n\n const paint = (time: number) => {\n if (!xs.length) return;\n // Resolve the token color every frame so theme changes apply at once.\n context.fillStyle = getComputedStyle(canvas).color;\n const t = (time / 1000) * speed;\n context.clearRect(0, 0, width, height);\n for (const y of ys) {\n for (const x of xs) {\n // Broad, slow blobs plus a finer layer drifting the other way,\n // so shapes morph instead of sliding across as a fixed pattern.\n const broad = noise(x * 0.012 + t * 0.18, y * 0.012 - t * 0.12);\n const fine = noise(x * 0.03 - t * 0.3 + 40, y * 0.03 + t * 0.22);\n const field = Math.min(1, Math.max(0, 0.5 + 1.1 * (0.72 * broad + 0.28 * fine)));\n const level = field * field * (3 - 2 * field);\n context.globalAlpha = MIN_ALPHA + (MAX_ALPHA - MIN_ALPHA) * level;\n context.beginPath();\n context.arc(x, y, MIN_RADIUS + (MAX_RADIUS - MIN_RADIUS) * level, 0, Math.PI * 2);\n context.fill();\n }\n }\n context.globalAlpha = 1;\n };\n\n const loop = (time: number) => {\n paint(time);\n frame = requestAnimationFrame(loop);\n };\n\n const stop = () => {\n cancelAnimationFrame(frame);\n frame = 0;\n };\n\n const start = () => {\n if (!xs.length || width !== canvas.clientWidth || height !== canvas.clientHeight) build();\n paint(performance.now());\n if (still() || frame) return;\n frame = requestAnimationFrame(loop);\n };\n\n // Only animate while on screen; off-screen instances hold their last frame.\n const seen = new IntersectionObserver(\n ([entry]) => {\n visible = entry.isIntersecting;\n if (visible) start();\n else stop();\n },\n { rootMargin: \"80px\" },\n );\n seen.observe(canvas);\n\n const resized = new ResizeObserver(() => {\n if (!xs.length) return;\n build();\n paint(performance.now());\n });\n resized.observe(canvas);\n\n // Follow reduced-motion changes made while mounted.\n const motionChanged = () => {\n stop();\n if (visible) start();\n };\n motion.addEventListener(\"change\", motionChanged);\n\n return () => {\n stop();\n seen.disconnect();\n resized.disconnect();\n motion.removeEventListener(\"change\", motionChanged);\n };\n }, [speed]);\n\n return (\n <canvas\n ref={ref}\n aria-hidden\n data-slot=\"dot-matrix\"\n className={cn(\n \"pointer-events-none absolute inset-0 size-full text-primary\",\n fadeEdges &&\n \"[mask-image:radial-gradient(ellipse_at_center,black_55%,transparent_100%)]\",\n className,\n )}\n />\n );\n}\n"],"names":[],"mappings":";;;;;AAKA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;;;AAGE;;;;;AAKA;AACF;AAEA;AAEA;AACA;;;AAGE;AACA;AACA;AACA;;AAEE;AACA;AACA;AACA;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGF;AAcA;;;;;;;;AAQG;AACG;AACJ;;AAGE;;AAEA;;;AAGA;;;;;;;AAQA;;AAGE;AACA;AACA;AACA;AACA;;;AAIA;AACA;;;AAGF;AAEA;;;;;;;AAME;AACE;;;;;AAKE;AACA;AACA;;;;;;AAMJ;AACF;AAEA;;AAEE;AACF;;;;AAKA;;AAGE;AAAkF;AAClF;;;AAEA;AACF;;;AAKI;AACA;AAAa;;AACR;AACP;AAGF;AAEA;;;AAEE;AACA;AACF;AACA;;;AAIE;AACA;AAAa;AACf;AACA;AAEA;AACE;;;AAGA;AACF;AACF;AAEA;AAQQ;AAKV;;"}
|
|
1
|
+
{"version":3,"file":"dot-matrix.js","sources":["../../src/components/dot-matrix.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport { useEffect, useRef } from \"react\";\r\nimport { cn } from \"@/utils\";\r\n\r\n/** Pitch between dots and the margin around the grid, in CSS px. */\r\nconst STEP = 11;\r\nconst EDGE = 10;\r\n\r\n/** Halftone sizing: dots swell under the drifting blobs and shrink between them. */\r\nconst MIN_RADIUS = 0.8;\r\nconst MAX_RADIUS = STEP * 0.36;\r\n\r\n/** Opacity range; the floor keeps the whole lattice faintly visible. */\r\nconst MIN_ALPHA = 0.16;\r\nconst MAX_ALPHA = 0.75;\r\n\r\n/** A fixed permutation so every instance shows the same, stable field. */\r\nconst PERM = (() => {\r\n const table = Array.from({ length: 256 }, (_, i) => i);\r\n let seed = 7;\r\n for (let i = 255; i > 0; i--) {\r\n seed = (seed * 16807) % 2147483647;\r\n const j = seed % (i + 1);\r\n [table[i], table[j]] = [table[j], table[i]];\r\n }\r\n return Uint8Array.from([...table, ...table]);\r\n})();\r\n\r\nconst fade = (t: number) => t * t * t * (t * (t * 6 - 15) + 10);\r\n\r\n/** 2D Perlin noise, roughly in [-0.7, 0.7]: smooth, organic, never striped. */\r\nfunction noise(x: number, y: number) {\r\n const xi = Math.floor(x);\r\n const yi = Math.floor(y);\r\n const xf = x - xi;\r\n const yf = y - yi;\r\n const X = xi & 255;\r\n const Y = yi & 255;\r\n const grad = (hash: number, dx: number, dy: number) => {\r\n const h = hash & 7;\r\n const u = h < 4 ? dx : dy;\r\n const v = h < 4 ? dy : dx;\r\n return (h & 1 ? -u : u) + (h & 2 ? -2 * v : 2 * v) * 0.5;\r\n };\r\n const aa = PERM[PERM[X] + Y];\r\n const ab = PERM[PERM[X] + Y + 1];\r\n const ba = PERM[PERM[X + 1] + Y];\r\n const bb = PERM[PERM[X + 1] + Y + 1];\r\n const u = fade(xf);\r\n const v = fade(yf);\r\n const top = grad(aa, xf, yf) + u * (grad(ba, xf - 1, yf) - grad(aa, xf, yf));\r\n const bottom =\r\n grad(ab, xf, yf - 1) + u * (grad(bb, xf - 1, yf - 1) - grad(ab, xf, yf - 1));\r\n return top + v * (bottom - top);\r\n}\r\n\r\nexport interface DotMatrixProps {\r\n /**\r\n * Dot color comes from `currentColor`, so tint with a text token:\r\n * `text-primary` (default), `text-secondary-foreground`, `text-muted-foreground`.\r\n */\r\n className?: string;\r\n /** Softly fade the lattice into the surrounding surface. Defaults to true. */\r\n fade?: boolean;\r\n /** Animation speed multiplier. 1 is the calm default; 0 holds a still frame. */\r\n speed?: number;\r\n}\r\n\r\n/**\r\n * A decorative \"still being generated\" surface: a halftone lattice of dots\r\n * tinted with a theme color. Two layers of smooth noise drift in different\r\n * directions, so soft blobs of larger, stronger dots swell, merge and fade\r\n * across the grid.\r\n *\r\n * It fills its nearest positioned parent, animates only while on screen and\r\n * shows a still frame when the user prefers reduced motion.\r\n */\r\nexport function DotMatrix({ className, fade: fadeEdges = true, speed = 1 }: DotMatrixProps) {\r\n const ref = useRef<HTMLCanvasElement>(null);\r\n\r\n useEffect(() => {\r\n const canvas = ref.current;\r\n const context = canvas?.getContext(\"2d\");\r\n if (!canvas || !context) return;\r\n\r\n const motion = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\r\n const dpr = Math.min(2, window.devicePixelRatio || 1);\r\n let xs: number[] = [];\r\n let ys: number[] = [];\r\n let width = 0;\r\n let height = 0;\r\n let frame = 0;\r\n let visible = false;\r\n\r\n const still = () => motion.matches || speed <= 0;\r\n\r\n const build = () => {\r\n width = canvas.clientWidth;\r\n height = canvas.clientHeight;\r\n canvas.width = Math.max(1, Math.round(width * dpr));\r\n canvas.height = Math.max(1, Math.round(height * dpr));\r\n context.setTransform(dpr, 0, 0, dpr, 0, 0);\r\n\r\n const columns = Math.max(1, Math.floor((width - EDGE * 2) / STEP) + 1);\r\n const rows = Math.max(1, Math.floor((height - EDGE * 2) / STEP) + 1);\r\n const left = (width - (columns - 1) * STEP) / 2;\r\n const top = (height - (rows - 1) * STEP) / 2;\r\n xs = Array.from({ length: columns }, (_, i) => left + i * STEP);\r\n ys = Array.from({ length: rows }, (_, i) => top + i * STEP);\r\n };\r\n\r\n const paint = (time: number) => {\r\n if (!xs.length) return;\r\n // Resolve the token color every frame so theme changes apply at once.\r\n context.fillStyle = getComputedStyle(canvas).color;\r\n const t = (time / 1000) * speed;\r\n context.clearRect(0, 0, width, height);\r\n for (const y of ys) {\r\n for (const x of xs) {\r\n // Broad, slow blobs plus a finer layer drifting the other way,\r\n // so shapes morph instead of sliding across as a fixed pattern.\r\n const broad = noise(x * 0.012 + t * 0.18, y * 0.012 - t * 0.12);\r\n const fine = noise(x * 0.03 - t * 0.3 + 40, y * 0.03 + t * 0.22);\r\n const field = Math.min(1, Math.max(0, 0.5 + 1.1 * (0.72 * broad + 0.28 * fine)));\r\n const level = field * field * (3 - 2 * field);\r\n context.globalAlpha = MIN_ALPHA + (MAX_ALPHA - MIN_ALPHA) * level;\r\n context.beginPath();\r\n context.arc(x, y, MIN_RADIUS + (MAX_RADIUS - MIN_RADIUS) * level, 0, Math.PI * 2);\r\n context.fill();\r\n }\r\n }\r\n context.globalAlpha = 1;\r\n };\r\n\r\n const loop = (time: number) => {\r\n paint(time);\r\n frame = requestAnimationFrame(loop);\r\n };\r\n\r\n const stop = () => {\r\n cancelAnimationFrame(frame);\r\n frame = 0;\r\n };\r\n\r\n const start = () => {\r\n if (!xs.length || width !== canvas.clientWidth || height !== canvas.clientHeight) build();\r\n paint(performance.now());\r\n if (still() || frame) return;\r\n frame = requestAnimationFrame(loop);\r\n };\r\n\r\n // Only animate while on screen; off-screen instances hold their last frame.\r\n const seen = new IntersectionObserver(\r\n ([entry]) => {\r\n visible = entry.isIntersecting;\r\n if (visible) start();\r\n else stop();\r\n },\r\n { rootMargin: \"80px\" },\r\n );\r\n seen.observe(canvas);\r\n\r\n const resized = new ResizeObserver(() => {\r\n if (!xs.length) return;\r\n build();\r\n paint(performance.now());\r\n });\r\n resized.observe(canvas);\r\n\r\n // Follow reduced-motion changes made while mounted.\r\n const motionChanged = () => {\r\n stop();\r\n if (visible) start();\r\n };\r\n motion.addEventListener(\"change\", motionChanged);\r\n\r\n return () => {\r\n stop();\r\n seen.disconnect();\r\n resized.disconnect();\r\n motion.removeEventListener(\"change\", motionChanged);\r\n };\r\n }, [speed]);\r\n\r\n return (\r\n <canvas\r\n ref={ref}\r\n aria-hidden\r\n data-slot=\"dot-matrix\"\r\n className={cn(\r\n \"pointer-events-none absolute inset-0 size-full text-primary\",\r\n fadeEdges &&\r\n \"[mask-image:radial-gradient(ellipse_at_center,black_55%,transparent_100%)]\",\r\n className,\r\n )}\r\n />\r\n );\r\n}\r\n"],"names":[],"mappings":";;;;;AAKA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;;;AAGE;;;;;AAKA;AACF;AAEA;AAEA;AACA;;;AAGE;AACA;AACA;AACA;;AAEE;AACA;AACA;AACA;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGF;AAcA;;;;;;;;AAQG;AACG;AACJ;;AAGE;;AAEA;;;AAGA;;;;;;;AAQA;;AAGE;AACA;AACA;AACA;AACA;;;AAIA;AACA;;;AAGF;AAEA;;;;;;;AAME;AACE;;;;;AAKE;AACA;AACA;;;;;;AAMJ;AACF;AAEA;;AAEE;AACF;;;;AAKA;;AAGE;AAAkF;AAClF;;;AAEA;AACF;;;AAKI;AACA;AAAa;;AACR;AACP;AAGF;AAEA;;;AAEE;AACA;AACF;AACA;;;AAIE;AACA;AAAa;AACf;AACA;AAEA;AACE;;;AAGA;AACF;AACF;AAEA;AAQQ;AAKV;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.js","sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';\n\nimport { cn } from '@/utils';\n\nfunction DropdownMenu({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {\n return <DropdownMenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />;\n}\n\nfunction DropdownMenuPortal({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {\n return (\n <DropdownMenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />\n );\n}\n\nfunction DropdownMenuTrigger({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {\n return (\n <DropdownMenuPrimitive.Trigger\n data-slot=\"dropdown-menu-trigger\"\n {...props}\n />\n );\n}\n\nfunction DropdownMenuContent({\n className,\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n data-slot=\"dropdown-menu-content\"\n sideOffset={sideOffset}\n className={cn(\n // The popover layer: it portals to document.body beside any\n // Dialog, so it must sit above the modal layer to show over one.\n 'bg-popover text-popover-foreground data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-(--z-popover) max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-control-lg border border-border p-option-inset shadow-card',\n className,\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n}\n\nfunction DropdownMenuGroup({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {\n return (\n <DropdownMenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n );\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = 'default',\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n variant?: 'default' | 'destructive';\n}) {\n return (\n <DropdownMenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n \"focus:bg-muted focus:text-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex min-h-option-row w-full cursor-pointer select-none items-center gap-2 rounded-control-sm px-option-x py-2 pointer-coarse:min-h-11 text-sm text-muted-foreground transition-colors duration-state hover:bg-muted motion-reduce:transition-none outline-hidden data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-9 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction DropdownMenuCheckboxItem({\n className,\n children,\n checked,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n className={cn(\n \"focus:bg-muted focus:text-foreground relative flex min-h-option-row w-full cursor-pointer items-center gap-2 rounded-control-sm py-2 pr-option-x pl-9 pointer-coarse:min-h-11 text-sm text-muted-foreground transition-colors duration-state hover:bg-muted motion-reduce:transition-none outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n checked={checked}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-option-x flex size-4 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n}\n\nfunction DropdownMenuRadioGroup({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {\n return (\n <DropdownMenuPrimitive.RadioGroup\n data-slot=\"dropdown-menu-radio-group\"\n {...props}\n />\n );\n}\n\nfunction DropdownMenuRadioItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {\n return (\n <DropdownMenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n className={cn(\n \"focus:bg-muted focus:text-foreground relative flex min-h-option-row w-full cursor-pointer items-center gap-2 rounded-control-sm py-2 pr-option-x pl-9 pointer-coarse:min-h-11 text-sm text-muted-foreground transition-colors duration-state hover:bg-muted motion-reduce:transition-none outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-option-x flex size-4 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CircleIcon className=\"size-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n );\n}\n\nfunction DropdownMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n}) {\n return (\n <DropdownMenuPrimitive.Label\n data-slot=\"dropdown-menu-label\"\n data-inset={inset}\n className={cn(\n 'px-option-x py-2 text-sm font-semibold text-foreground data-[inset]:pl-9',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction DropdownMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {\n return (\n <DropdownMenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn('bg-border -mx-option-inset my-1 h-px', className)}\n {...props}\n />\n );\n}\n\nfunction DropdownMenuShortcut({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\n 'text-muted-foreground ml-auto text-xs tracking-widest',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction DropdownMenuSub({\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {\n return <DropdownMenuPrimitive.Sub data-slot=\"dropdown-menu-sub\" {...props} />;\n}\n\nfunction DropdownMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n}) {\n return (\n <DropdownMenuPrimitive.SubTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n 'focus:bg-muted focus:text-foreground data-[state=open]:bg-muted data-[state=open]:text-foreground flex min-h-option-row cursor-pointer items-center gap-2 rounded-control-sm px-option-x py-2 pointer-coarse:min-h-11 text-sm text-muted-foreground transition-colors duration-state hover:bg-muted motion-reduce:transition-none outline-hidden select-none data-[inset]:pl-9',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ml-auto size-4 text-muted-foreground\" />\n </DropdownMenuPrimitive.SubTrigger>\n );\n}\n\nfunction DropdownMenuSubContent({\n className,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {\n return (\n <DropdownMenuPrimitive.SubContent\n data-slot=\"dropdown-menu-sub-content\"\n className={cn(\n // The popover layer, like DropdownMenuContent above.\n 'bg-popover text-popover-foreground data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-(--z-popover) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-control-lg border border-border p-option-inset shadow-card',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport {\n DropdownMenu,\n DropdownMenuPortal,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n};\n"],"names":["_jsx","_jsxs"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"dropdown-menu.js","sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\r\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';\r\n\r\nimport { cn } from '@/utils';\r\n\r\nfunction DropdownMenu({\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {\r\n return <DropdownMenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />;\r\n}\r\n\r\nfunction DropdownMenuPortal({\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {\r\n return (\r\n <DropdownMenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />\r\n );\r\n}\r\n\r\nfunction DropdownMenuTrigger({\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {\r\n return (\r\n <DropdownMenuPrimitive.Trigger\r\n data-slot=\"dropdown-menu-trigger\"\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DropdownMenuContent({\r\n className,\r\n sideOffset = 4,\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {\r\n return (\r\n <DropdownMenuPrimitive.Portal>\r\n <DropdownMenuPrimitive.Content\r\n data-slot=\"dropdown-menu-content\"\r\n sideOffset={sideOffset}\r\n className={cn(\r\n // The popover layer: it portals to document.body beside any\r\n // Dialog, so it must sit above the modal layer to show over one.\r\n 'bg-popover text-popover-foreground data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-(--z-popover) max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-control-lg border border-border p-option-inset shadow-card',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n </DropdownMenuPrimitive.Portal>\r\n );\r\n}\r\n\r\nfunction DropdownMenuGroup({\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {\r\n return (\r\n <DropdownMenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\r\n );\r\n}\r\n\r\nfunction DropdownMenuItem({\r\n className,\r\n inset,\r\n variant = 'default',\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {\r\n inset?: boolean;\r\n variant?: 'default' | 'destructive';\r\n}) {\r\n return (\r\n <DropdownMenuPrimitive.Item\r\n data-slot=\"dropdown-menu-item\"\r\n data-inset={inset}\r\n data-variant={variant}\r\n className={cn(\r\n \"focus:bg-muted focus:text-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex min-h-option-row w-full cursor-pointer select-none items-center gap-2 rounded-control-sm px-option-x py-2 pointer-coarse:min-h-11 text-sm text-muted-foreground transition-colors duration-state hover:bg-muted motion-reduce:transition-none outline-hidden data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-9 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DropdownMenuCheckboxItem({\r\n className,\r\n children,\r\n checked,\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {\r\n return (\r\n <DropdownMenuPrimitive.CheckboxItem\r\n data-slot=\"dropdown-menu-checkbox-item\"\r\n className={cn(\r\n \"focus:bg-muted focus:text-foreground relative flex min-h-option-row w-full cursor-pointer items-center gap-2 rounded-control-sm py-2 pr-option-x pl-9 pointer-coarse:min-h-11 text-sm text-muted-foreground transition-colors duration-state hover:bg-muted motion-reduce:transition-none outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\r\n className,\r\n )}\r\n checked={checked}\r\n {...props}\r\n >\r\n <span className=\"pointer-events-none absolute left-option-x flex size-4 items-center justify-center\">\r\n <DropdownMenuPrimitive.ItemIndicator>\r\n <CheckIcon className=\"size-4\" />\r\n </DropdownMenuPrimitive.ItemIndicator>\r\n </span>\r\n {children}\r\n </DropdownMenuPrimitive.CheckboxItem>\r\n );\r\n}\r\n\r\nfunction DropdownMenuRadioGroup({\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {\r\n return (\r\n <DropdownMenuPrimitive.RadioGroup\r\n data-slot=\"dropdown-menu-radio-group\"\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DropdownMenuRadioItem({\r\n className,\r\n children,\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {\r\n return (\r\n <DropdownMenuPrimitive.RadioItem\r\n data-slot=\"dropdown-menu-radio-item\"\r\n className={cn(\r\n \"focus:bg-muted focus:text-foreground relative flex min-h-option-row w-full cursor-pointer items-center gap-2 rounded-control-sm py-2 pr-option-x pl-9 pointer-coarse:min-h-11 text-sm text-muted-foreground transition-colors duration-state hover:bg-muted motion-reduce:transition-none outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\r\n className,\r\n )}\r\n {...props}\r\n >\r\n <span className=\"pointer-events-none absolute left-option-x flex size-4 items-center justify-center\">\r\n <DropdownMenuPrimitive.ItemIndicator>\r\n <CircleIcon className=\"size-2 fill-current\" />\r\n </DropdownMenuPrimitive.ItemIndicator>\r\n </span>\r\n {children}\r\n </DropdownMenuPrimitive.RadioItem>\r\n );\r\n}\r\n\r\nfunction DropdownMenuLabel({\r\n className,\r\n inset,\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {\r\n inset?: boolean;\r\n}) {\r\n return (\r\n <DropdownMenuPrimitive.Label\r\n data-slot=\"dropdown-menu-label\"\r\n data-inset={inset}\r\n className={cn(\r\n 'px-option-x py-2 text-sm font-semibold text-foreground data-[inset]:pl-9',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DropdownMenuSeparator({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {\r\n return (\r\n <DropdownMenuPrimitive.Separator\r\n data-slot=\"dropdown-menu-separator\"\r\n className={cn('bg-border -mx-option-inset my-1 h-px', className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DropdownMenuShortcut({\r\n className,\r\n ...props\r\n}: React.ComponentProps<'span'>) {\r\n return (\r\n <span\r\n data-slot=\"dropdown-menu-shortcut\"\r\n className={cn(\r\n 'text-muted-foreground ml-auto text-xs tracking-widest',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DropdownMenuSub({\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {\r\n return <DropdownMenuPrimitive.Sub data-slot=\"dropdown-menu-sub\" {...props} />;\r\n}\r\n\r\nfunction DropdownMenuSubTrigger({\r\n className,\r\n inset,\r\n children,\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {\r\n inset?: boolean;\r\n}) {\r\n return (\r\n <DropdownMenuPrimitive.SubTrigger\r\n data-slot=\"dropdown-menu-sub-trigger\"\r\n data-inset={inset}\r\n className={cn(\r\n 'focus:bg-muted focus:text-foreground data-[state=open]:bg-muted data-[state=open]:text-foreground flex min-h-option-row cursor-pointer items-center gap-2 rounded-control-sm px-option-x py-2 pointer-coarse:min-h-11 text-sm text-muted-foreground transition-colors duration-state hover:bg-muted motion-reduce:transition-none outline-hidden select-none data-[inset]:pl-9',\r\n className,\r\n )}\r\n {...props}\r\n >\r\n {children}\r\n <ChevronRightIcon className=\"ml-auto size-4 text-muted-foreground\" />\r\n </DropdownMenuPrimitive.SubTrigger>\r\n );\r\n}\r\n\r\nfunction DropdownMenuSubContent({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {\r\n return (\r\n <DropdownMenuPrimitive.SubContent\r\n data-slot=\"dropdown-menu-sub-content\"\r\n className={cn(\r\n // The popover layer, like DropdownMenuContent above.\r\n 'bg-popover text-popover-foreground data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-(--z-popover) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-control-lg border border-border p-option-inset shadow-card',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nexport {\r\n DropdownMenu,\r\n DropdownMenuPortal,\r\n DropdownMenuTrigger,\r\n DropdownMenuContent,\r\n DropdownMenuGroup,\r\n DropdownMenuLabel,\r\n DropdownMenuItem,\r\n DropdownMenuCheckboxItem,\r\n DropdownMenuRadioGroup,\r\n DropdownMenuRadioItem,\r\n DropdownMenuSeparator,\r\n DropdownMenuShortcut,\r\n DropdownMenuSub,\r\n DropdownMenuSubTrigger,\r\n DropdownMenuSubContent,\r\n};\r\n"],"names":["_jsx","_jsxs"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.js","sources":["../../src/components/dropdown.tsx"],"sourcesContent":["'use client';\n\n/**\n * @ Author: BetterInternship\n * @ Create Time: 2025-06-14 23:30:09\n * @ Modified time: 2025-10-31 18:13:16\n * @ Description:\n *\n * Stateful dropdown group component.\n */\n\nimport { Button } from \"./button\";\nimport { useMobile } from \"@/hooks/use-mobile\";\nimport { useMobileSheetViewport } from \"@/hooks/use-mobile-sheet-viewport\";\nimport { MobileSheetPortal } from \"./mobile-sheet-portal\";\nimport { cn } from \"@/utils\";\nimport { fieldTriggerClassName } from \"@/hooks/use-field-focus\";\nimport { ChevronDown, X } from \"lucide-react\";\nimport { useRouter } from \"next/navigation\";\nimport React, {\n Children,\n createContext,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { useDetectClickOutside } from '@/hooks/use-detect-click-outside';\n\n/**\n * The group context interface.\n * What's available in the group context to other components.\n */\ninterface IDropdownGroupContext {\n activeDropdown: string;\n setActiveDropdown: (dropdown: string) => void;\n}\nconst DropdownGroupContext = createContext<IDropdownGroupContext>(\n {} as IDropdownGroupContext,\n);\n\n/**\n * A wrapper around the contents of a dropdown option.\n *\n * @component\n */\ntype IDropdownOptionProps = {\n children?: React.ReactNode;\n highlighted?: boolean;\n disabled?: boolean;\n href?: string;\n on_click?: () => void;\n};\nexport const DropdownOption = ({ children }: IDropdownOptionProps) => {\n return <>{children}</>;\n};\n\n/**\n * Creates a standard button dropdowns must use with mobile optimization.\n * Not meant to be used elsewhere.\n *\n * @component\n */\nconst DropdownOptionButton = ({\n children,\n set_is_open,\n size = \"xs\",\n}: {\n children: React.ReactElement<IDropdownOptionProps>;\n set_is_open: (is_open: boolean) => void;\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\";\n}) => {\n const router = useRouter();\n const is_mobile = useMobile();\n const [scrolling, setScrolling] = useState(false);\n const dropdown_button_ref = useRef<HTMLInputElement>({} as HTMLInputElement);\n\n const handleClick = useCallback(\n (e: React.MouseEvent) => {\n e.stopPropagation();\n set_is_open(false);\n children.props.on_click && children.props.on_click();\n children.props.href && router.push(children.props.href);\n },\n [children.props, router, set_is_open],\n );\n\n const onTouchStart = (e: any) => {\n e.stopPropagation();\n setScrolling(true);\n };\n\n const onTouchEnd = (e: any) => {\n e.stopPropagation();\n setScrolling(false);\n };\n\n useEffect(() => {\n const dropdown_button = dropdown_button_ref.current;\n if (!dropdown_button) return;\n\n // Attach passive touchstart handler\n dropdown_button.addEventListener(\"touchstart\", onTouchStart, {\n passive: true,\n });\n\n dropdown_button.addEventListener(\"touchend\", onTouchEnd, {\n passive: true,\n });\n\n // Cleanup on unmount\n return () => {\n dropdown_button.removeEventListener(\"touchstart\", onTouchStart);\n dropdown_button.removeEventListener(\"touchend\", onTouchEnd);\n };\n }, [onTouchStart]);\n\n return (\n <button\n // @ts-ignore\n ref={dropdown_button_ref}\n className={cn(\n \"flex min-h-option-row w-full cursor-pointer items-center gap-2 rounded-control-sm px-option-x py-2 text-left text-muted-foreground transition-colors hover:bg-muted\",\n is_mobile ? \"min-h-12 py-3 active:bg-muted touch-manipulation\" : \"\",\n `text-${size}`,\n children.props.highlighted ? \"bg-primary-tint\" : \"\",\n )}\n onClick={(e) => !scrolling && handleClick(e)}\n >\n <div className=\"w-full\">{children}</div>\n </button>\n );\n};\n\n/**\n * This component creates a context provider for dropdowns inside it to use.\n * The dropdowns inside can modify the active dropdown when they're clicked.\n * This way, only one dropdown in the group is active at a time.\n *\n * @component\n */\nexport const DropdownGroup = ({ children }: { children: React.ReactNode }) => {\n const [activeDropdown, setActiveDropdown] = useState(\"\");\n const group_dropdown_context: IDropdownGroupContext = {\n activeDropdown,\n setActiveDropdown,\n };\n\n return (\n <DropdownGroupContext value={group_dropdown_context}>\n {children}\n </DropdownGroupContext>\n );\n};\n\ninterface IRadioDropdownOption<ID> {\n id: ID;\n name: string;\n}\n\n/**\n * This represents a single dropdown inside the group with mobile optimization.\n * Inherits the provided context (if there is none, that's fine).\n *\n * @component\n */\nexport const GroupableRadioDropdown = <ID extends number | string>({\n name,\n options,\n onChange,\n disabled,\n defaultValue = null,\n size = \"sm\",\n className = \"\",\n fallback = \"Select option\",\n}: {\n name: string;\n options: IRadioDropdownOption<ID>[];\n onChange: (option: ID) => void;\n defaultValue?: ID | ID[] | null;\n disabled?: boolean | undefined;\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\";\n className?: string;\n fallback?: string;\n}) => {\n const isMobile = useMobile();\n const { activeDropdown, setActiveDropdown } =\n useContext(DropdownGroupContext);\n const [isOpen, setIsOpen] = useState(false);\n const sheetViewport = useMobileSheetViewport(isOpen && isMobile);\n const [value, setValue] = useState(defaultValue);\n const ref = useDetectClickOutside({ onTriggered: () => setIsOpen(false) });\n const triggerRef = useRef<HTMLButtonElement>(null);\n const sheetRef = useRef<HTMLDivElement>(null);\n const sheetCloseRef = useRef<HTMLButtonElement>(null);\n const useSheet = isOpen && isMobile;\n\n const closeSheet = useCallback(() => {\n setIsOpen(false);\n triggerRef.current?.focus();\n }, []);\n\n // While the mobile sheet is open: lock page scroll and move focus into it.\n useEffect(() => {\n if (!useSheet) return;\n const overflow = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n const frame = window.requestAnimationFrame(() =>\n sheetCloseRef.current?.focus(),\n );\n return () => {\n window.cancelAnimationFrame(frame);\n document.body.style.overflow = overflow;\n };\n }, [useSheet]);\n\n // Just so it's not stuck at the first default when the default changes\n useEffect(() => {\n setValue(defaultValue);\n }, [defaultValue]);\n\n /**\n * Activates dropdown\n */\n const handleClick = useCallback(\n (e: React.MouseEvent) => {\n e.stopPropagation();\n setIsOpen(!isOpen);\n setActiveDropdown(name);\n },\n [isOpen, name, setActiveDropdown],\n );\n\n /**\n * Changes dropdown value\n */\n const handleChange = useCallback(\n (option: ID) => {\n setValue(option);\n onChange(option);\n setIsOpen(false);\n },\n [onChange],\n );\n\n // Check if it's still the active dropdown\n useEffect(() => {\n if (activeDropdown !== name) setIsOpen(false);\n }, [activeDropdown, name]);\n\n const selected =\n value || value === 0 ? options.find((o) => o.id === value) : undefined;\n\n return (\n <div\n className={cn(\"relative w-full max-w-svw min-w-0\", className)}\n ref={ref}\n >\n <Button\n ref={triggerRef}\n type=\"button\"\n variant=\"outline\"\n disabled={disabled}\n size={size}\n onClick={handleClick}\n onTouchEnd={(e) => e.stopPropagation()}\n aria-haspopup=\"listbox\"\n aria-expanded={isOpen}\n className={cn(\n \"w-full max-w-full min-w-0\",\n \"h-auto py-1\",\n fieldTriggerClassName,\n \"flex items-center justify-between gap-2\",\n )}\n >\n {/* shrinkable text container */}\n <span className=\"flex-1 min-w-0 text-left pr-2 leading-relaxed\">\n {selected ? (\n <span className=\"block whitespace-normal wrap-break-word\">\n {selected.name}\n </span>\n ) : (\n <span className=\"text-muted-foreground/40 font-normal\">\n {fallback}\n </span>\n )}\n </span>\n\n <ChevronDown\n className={cn(\n \"shrink-0 w-4 h-4 text-muted-foreground transition-transform duration-interactive ease-out-strong motion-reduce:transition-none\",\n isOpen ? \"rotate-180\" : \"\",\n )}\n />\n </Button>\n\n {isOpen && (\n <MobileSheetPortal enabled={isMobile}>\n {isMobile && (\n <button\n type=\"button\"\n aria-label=\"Close options\"\n tabIndex={-1}\n className=\"fixed inset-0 z-(--z-popover-overlay) bg-black/25 backdrop-blur-[1px]\"\n onClick={closeSheet}\n />\n )}\n <div\n ref={isMobile ? sheetRef : undefined}\n role={isMobile ? \"dialog\" : undefined}\n aria-modal={isMobile ? true : undefined}\n aria-label={isMobile ? fallback : undefined}\n onKeyDown={\n isMobile\n ? (event) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n closeSheet();\n }\n if (event.key !== \"Tab\") return;\n const focusable =\n sheetRef.current?.querySelectorAll<HTMLElement>(\n \"button:not([disabled]):not([tabindex='-1'])\",\n );\n if (!focusable?.length) return;\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n if (event.shiftKey && document.activeElement === first) {\n event.preventDefault();\n last.focus();\n } else if (\n !event.shiftKey &&\n document.activeElement === last\n ) {\n event.preventDefault();\n first.focus();\n }\n }\n : undefined\n }\n className={cn(\n \"border border-border bg-background shadow-card\",\n isMobile\n ? \"fixed left-0 right-0 z-(--z-popover) flex flex-col overflow-hidden rounded-t-control-lg border-b-0 pb-[max(0.75rem,env(safe-area-inset-bottom))]\"\n : \"absolute left-0 right-0 top-full z-[9999] mt-1 max-w-full overflow-hidden rounded-control-lg\",\n )}\n style={\n isMobile\n ? {\n bottom: sheetViewport?.bottom ?? 0,\n maxHeight: sheetViewport\n ? Math.min(sheetViewport.height, 640)\n : \"80dvh\",\n }\n : undefined\n }\n >\n {isMobile && (\n <div className=\"flex shrink-0 items-center justify-between gap-4 px-4 pb-2 pt-4\">\n <h2 className=\"text-base font-semibold text-foreground\">\n {fallback}\n </h2>\n <button\n ref={sheetCloseRef}\n type=\"button\"\n aria-label=\"Close options\"\n className=\"-mr-3 flex h-11 w-11 shrink-0 cursor-pointer items-center justify-center rounded-control-lg text-muted-foreground hover:bg-muted\"\n onClick={closeSheet}\n >\n <X className=\"h-5 w-5\" aria-hidden=\"true\" />\n </button>\n </div>\n )}\n <div\n role=\"listbox\"\n className={cn(\n \"relative flex flex-col gap-option-gap overflow-y-auto overscroll-contain p-option-inset touch-pan-y [-webkit-overflow-scrolling:touch] [scrollbar-width:thin] [scrollbar-color:var(--color-border-hover)_var(--muted)]\",\n isMobile ? \"min-h-0 flex-1\" : \"max-h-[400px]\",\n )}\n >\n {options.map((option, index) => (\n <DropdownOptionButton\n key={index}\n set_is_open={setIsOpen}\n size={size}\n >\n <DropdownOption\n highlighted={value === option.id}\n on_click={() => handleChange(option.id)}\n >\n <span className=\"block whitespace-normal wrap-break-word pr-2\">\n {option.name}\n </span>\n </DropdownOption>\n </DropdownOptionButton>\n ))}\n </div>\n </div>\n </MobileSheetPortal>\n )}\n </div>\n );\n};\n\n/**\n * This creates a dropdown menu for navigating with improved mobile support.\n *\n * @component\n */\nexport const GroupableNavDropdown = ({\n display,\n content,\n children,\n className = \"\",\n showArrow = true,\n}: {\n display?: React.ReactNode;\n content?: React.ReactNode;\n children?:\n | React.ReactElement<IDropdownOptionProps>\n | React.ReactElement<IDropdownOptionProps>[];\n className?: string;\n showArrow?: boolean;\n}) => {\n const is_mobile = useMobile();\n const [is_open, set_is_open] = useState(false);\n const dropdownRef = useRef<HTMLDivElement>(null);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const touchStartRef = useRef<{\n x: number;\n y: number;\n target: EventTarget | null;\n } | null>(null);\n\n // Close dropdown handler\n const closeDropdown = useCallback(() => {\n set_is_open(false);\n }, []);\n\n // Handle clicks outside dropdown\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (\n !is_mobile &&\n dropdownRef.current &&\n !dropdownRef.current.contains(event.target as Node) &&\n buttonRef.current &&\n !buttonRef.current.contains(event.target as Node)\n ) {\n closeDropdown();\n }\n };\n\n if (is_open && !is_mobile) {\n document.addEventListener(\"mousedown\", handleClickOutside);\n return () =>\n document.removeEventListener(\"mousedown\", handleClickOutside);\n }\n }, [is_open, is_mobile, closeDropdown]);\n\n // Mobile touch handlers\n const handleTouchStart = useCallback(\n (e: TouchEvent) => {\n if (!is_mobile || !is_open) return;\n\n const touch = e.touches[0];\n touchStartRef.current = {\n x: touch.clientX,\n y: touch.clientY,\n target: e.target,\n };\n },\n [is_mobile, is_open],\n );\n\n const handleTouchEnd = useCallback(\n (e: TouchEvent) => {\n if (!is_mobile || !is_open || !touchStartRef.current) return;\n\n const touch = e.changedTouches[0];\n const startTouch = touchStartRef.current;\n\n // Calculate touch movement\n const deltaX = Math.abs(touch.clientX - startTouch.x);\n const deltaY = Math.abs(touch.clientY - startTouch.y);\n const isSwipe = deltaX > 10 || deltaY > 10;\n\n // Check if touch is outside dropdown area\n const target = e.target as Element;\n const isOutsideDropdown =\n dropdownRef.current &&\n !dropdownRef.current.contains(target) &&\n buttonRef.current &&\n !buttonRef.current.contains(target);\n\n // Close if touch ended outside and wasn't a swipe\n if (!isSwipe && isOutsideDropdown) {\n closeDropdown();\n }\n\n touchStartRef.current = null;\n },\n [is_mobile, is_open, closeDropdown],\n );\n\n // Set up mobile touch listeners\n useEffect(() => {\n if (is_mobile && is_open) {\n document.addEventListener(\"touchstart\", handleTouchStart);\n document.addEventListener(\"touchend\", handleTouchEnd);\n\n return () => {\n document.removeEventListener(\"touchstart\", handleTouchStart);\n document.removeEventListener(\"touchend\", handleTouchEnd);\n };\n }\n }, [is_mobile, is_open, handleTouchStart, handleTouchEnd]);\n\n // Prevent event propagation for dropdown content\n const handleDropdownInteraction = useCallback(\n (e: React.MouseEvent | React.TouchEvent) => {\n e.stopPropagation();\n },\n [],\n );\n\n // Toggle dropdown\n const handleButtonClick = useCallback(\n (e: React.MouseEvent) => {\n e.stopPropagation();\n set_is_open(!is_open);\n },\n [is_open],\n );\n\n return (\n <div className={cn(\"relative z-[100]\", className)} ref={dropdownRef}>\n <Button\n ref={buttonRef}\n type=\"button\"\n variant=\"ghost\"\n className=\"relative flex items-center gap-2 h-12 px-3 z-[1000]\"\n onClick={handleButtonClick}\n onTouchEnd={(e) => e.stopPropagation()}\n >\n {display}\n {showArrow && (\n <ChevronDown\n className={cn(\n \"w-4 h-4 text-muted-foreground transition-transform\",\n is_open ? \"rotate-180\" : \"\",\n )}\n />\n )}\n </Button>\n\n {is_open && (\n <div\n className={cn(\n \"absolute right-0 mt-2 bg-background border border-border rounded-control-lg overflow-hidden shadow-card z-[1000]\",\n is_mobile ? \"w-56\" : \"w-48\", // Slightly wider on mobile for better touch targets\n className,\n )}\n onClick={handleDropdownInteraction}\n onTouchStart={handleDropdownInteraction}\n onTouchEnd={handleDropdownInteraction}\n >\n <div\n className={cn(\n \"relative z-[1000] flex max-h-64 flex-col gap-option-gap overflow-y-auto overscroll-contain p-option-inset [scrollbar-width:thin] [scrollbar-color:var(--color-border-hover)_var(--muted)]\",\n is_mobile ? \"max-h-80\" : \"max-h-64\",\n )}\n >\n {content}\n\n {Children.map(children, (child, index) => {\n return (\n <DropdownOptionButton key={index} set_is_open={set_is_open}>\n {child ? child : <></>}\n </DropdownOptionButton>\n );\n })}\n </div>\n </div>\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAsCA;;;AAkBA;AAEA;;;;;AAKG;AACH;AASE;AACA;;AAEA;AAEA;;;;AAKI;;AAKJ;;;AAGA;AAEA;;;AAGA;;AAGE;AACA;;;AAGA;AACE;AACD;AAED;AACE;AACD;;AAGD;AACE;AACA;AACF;AACF;AAEA;;AAGI;AAYN;AAEA;;;;;;AAMG;;;AAGD;;;;;AAUF;AAOA;;;;;AAKG;AACI;AAmBL;;;;;AAMA;AACA;AACA;AACA;AACA;AAEA;;AAEE;;;;AAKA;;;;AAGA;AAGA;AACE;;AAEF;AACF;;;;AAKA;AAEA;;AAEG;AACH;;AAGI;;;AAMJ;;AAEG;AACH;;;;AAKE;;;;;AAOF;AAEA;;AAgEc;AACI;;AAEE;;AAEF;;;;;AAMA;;;;;;;AAOE;;;;;;AAWN;AACA;AAIA;AACI;AACA;;AAEE;AACH;AACH;AAgDhB;AAEA;;;;AAIG;;AAgBD;;AAEA;AACA;AACA;;AAOA;;;;;AAME;AACE;AAEE;;AAEA;;AAGA;;AAEJ;AAEA;AACE;;;;;AAOJ;AAEI;;;;;;;;AAQF;AAIF;;;;AAKI;;AAGA;AACA;;;AAIA;AACA;AAEE;AACA;;;AAIF;AACE;;AAGF;;;;AAOF;AACE;AACA;AAEA;AACE;AACA;AACF;;;;AAKJ;;;;AAQA;;AAGI;AACF;;;;AAkDQ;AAMZ;;"}
|
|
1
|
+
{"version":3,"file":"dropdown.js","sources":["../../src/components/dropdown.tsx"],"sourcesContent":["'use client';\r\n\r\n/**\r\n * @ Author: BetterInternship\r\n * @ Create Time: 2025-06-14 23:30:09\r\n * @ Modified time: 2025-10-31 18:13:16\r\n * @ Description:\r\n *\r\n * Stateful dropdown group component.\r\n */\r\n\r\nimport { Button } from \"./button\";\r\nimport { useMobile } from \"@/hooks/use-mobile\";\r\nimport { useMobileSheetViewport } from \"@/hooks/use-mobile-sheet-viewport\";\r\nimport { MobileSheetPortal } from \"./mobile-sheet-portal\";\r\nimport { cn } from \"@/utils\";\r\nimport { fieldTriggerClassName } from \"@/hooks/use-field-focus\";\r\nimport { ChevronDown, X } from \"lucide-react\";\r\nimport { useRouter } from \"next/navigation\";\r\nimport React, {\r\n Children,\r\n createContext,\r\n useCallback,\r\n useContext,\r\n useEffect,\r\n useRef,\r\n useState,\r\n} from \"react\";\r\nimport { useDetectClickOutside } from '@/hooks/use-detect-click-outside';\r\n\r\n/**\r\n * The group context interface.\r\n * What's available in the group context to other components.\r\n */\r\ninterface IDropdownGroupContext {\r\n activeDropdown: string;\r\n setActiveDropdown: (dropdown: string) => void;\r\n}\r\nconst DropdownGroupContext = createContext<IDropdownGroupContext>(\r\n {} as IDropdownGroupContext,\r\n);\r\n\r\n/**\r\n * A wrapper around the contents of a dropdown option.\r\n *\r\n * @component\r\n */\r\ntype IDropdownOptionProps = {\r\n children?: React.ReactNode;\r\n highlighted?: boolean;\r\n disabled?: boolean;\r\n href?: string;\r\n on_click?: () => void;\r\n};\r\nexport const DropdownOption = ({ children }: IDropdownOptionProps) => {\r\n return <>{children}</>;\r\n};\r\n\r\n/**\r\n * Creates a standard button dropdowns must use with mobile optimization.\r\n * Not meant to be used elsewhere.\r\n *\r\n * @component\r\n */\r\nconst DropdownOptionButton = ({\r\n children,\r\n set_is_open,\r\n size = \"xs\",\r\n}: {\r\n children: React.ReactElement<IDropdownOptionProps>;\r\n set_is_open: (is_open: boolean) => void;\r\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\";\r\n}) => {\r\n const router = useRouter();\r\n const is_mobile = useMobile();\r\n const [scrolling, setScrolling] = useState(false);\r\n const dropdown_button_ref = useRef<HTMLInputElement>({} as HTMLInputElement);\r\n\r\n const handleClick = useCallback(\r\n (e: React.MouseEvent) => {\r\n e.stopPropagation();\r\n set_is_open(false);\r\n children.props.on_click && children.props.on_click();\r\n children.props.href && router.push(children.props.href);\r\n },\r\n [children.props, router, set_is_open],\r\n );\r\n\r\n const onTouchStart = (e: any) => {\r\n e.stopPropagation();\r\n setScrolling(true);\r\n };\r\n\r\n const onTouchEnd = (e: any) => {\r\n e.stopPropagation();\r\n setScrolling(false);\r\n };\r\n\r\n useEffect(() => {\r\n const dropdown_button = dropdown_button_ref.current;\r\n if (!dropdown_button) return;\r\n\r\n // Attach passive touchstart handler\r\n dropdown_button.addEventListener(\"touchstart\", onTouchStart, {\r\n passive: true,\r\n });\r\n\r\n dropdown_button.addEventListener(\"touchend\", onTouchEnd, {\r\n passive: true,\r\n });\r\n\r\n // Cleanup on unmount\r\n return () => {\r\n dropdown_button.removeEventListener(\"touchstart\", onTouchStart);\r\n dropdown_button.removeEventListener(\"touchend\", onTouchEnd);\r\n };\r\n }, [onTouchStart]);\r\n\r\n return (\r\n <button\r\n // @ts-ignore\r\n ref={dropdown_button_ref}\r\n className={cn(\r\n \"flex min-h-option-row w-full cursor-pointer items-center gap-2 rounded-control-sm px-option-x py-2 text-left text-muted-foreground transition-colors hover:bg-muted\",\r\n is_mobile ? \"min-h-12 py-3 active:bg-muted touch-manipulation\" : \"\",\r\n `text-${size}`,\r\n children.props.highlighted ? \"bg-primary-tint\" : \"\",\r\n )}\r\n onClick={(e) => !scrolling && handleClick(e)}\r\n >\r\n <div className=\"w-full\">{children}</div>\r\n </button>\r\n );\r\n};\r\n\r\n/**\r\n * This component creates a context provider for dropdowns inside it to use.\r\n * The dropdowns inside can modify the active dropdown when they're clicked.\r\n * This way, only one dropdown in the group is active at a time.\r\n *\r\n * @component\r\n */\r\nexport const DropdownGroup = ({ children }: { children: React.ReactNode }) => {\r\n const [activeDropdown, setActiveDropdown] = useState(\"\");\r\n const group_dropdown_context: IDropdownGroupContext = {\r\n activeDropdown,\r\n setActiveDropdown,\r\n };\r\n\r\n return (\r\n <DropdownGroupContext value={group_dropdown_context}>\r\n {children}\r\n </DropdownGroupContext>\r\n );\r\n};\r\n\r\ninterface IRadioDropdownOption<ID> {\r\n id: ID;\r\n name: string;\r\n}\r\n\r\n/**\r\n * This represents a single dropdown inside the group with mobile optimization.\r\n * Inherits the provided context (if there is none, that's fine).\r\n *\r\n * @component\r\n */\r\nexport const GroupableRadioDropdown = <ID extends number | string>({\r\n name,\r\n options,\r\n onChange,\r\n disabled,\r\n defaultValue = null,\r\n size = \"sm\",\r\n className = \"\",\r\n fallback = \"Select option\",\r\n}: {\r\n name: string;\r\n options: IRadioDropdownOption<ID>[];\r\n onChange: (option: ID) => void;\r\n defaultValue?: ID | ID[] | null;\r\n disabled?: boolean | undefined;\r\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\";\r\n className?: string;\r\n fallback?: string;\r\n}) => {\r\n const isMobile = useMobile();\r\n const { activeDropdown, setActiveDropdown } =\r\n useContext(DropdownGroupContext);\r\n const [isOpen, setIsOpen] = useState(false);\r\n const sheetViewport = useMobileSheetViewport(isOpen && isMobile);\r\n const [value, setValue] = useState(defaultValue);\r\n const ref = useDetectClickOutside({ onTriggered: () => setIsOpen(false) });\r\n const triggerRef = useRef<HTMLButtonElement>(null);\r\n const sheetRef = useRef<HTMLDivElement>(null);\r\n const sheetCloseRef = useRef<HTMLButtonElement>(null);\r\n const useSheet = isOpen && isMobile;\r\n\r\n const closeSheet = useCallback(() => {\r\n setIsOpen(false);\r\n triggerRef.current?.focus();\r\n }, []);\r\n\r\n // While the mobile sheet is open: lock page scroll and move focus into it.\r\n useEffect(() => {\r\n if (!useSheet) return;\r\n const overflow = document.body.style.overflow;\r\n document.body.style.overflow = \"hidden\";\r\n const frame = window.requestAnimationFrame(() =>\r\n sheetCloseRef.current?.focus(),\r\n );\r\n return () => {\r\n window.cancelAnimationFrame(frame);\r\n document.body.style.overflow = overflow;\r\n };\r\n }, [useSheet]);\r\n\r\n // Just so it's not stuck at the first default when the default changes\r\n useEffect(() => {\r\n setValue(defaultValue);\r\n }, [defaultValue]);\r\n\r\n /**\r\n * Activates dropdown\r\n */\r\n const handleClick = useCallback(\r\n (e: React.MouseEvent) => {\r\n e.stopPropagation();\r\n setIsOpen(!isOpen);\r\n setActiveDropdown(name);\r\n },\r\n [isOpen, name, setActiveDropdown],\r\n );\r\n\r\n /**\r\n * Changes dropdown value\r\n */\r\n const handleChange = useCallback(\r\n (option: ID) => {\r\n setValue(option);\r\n onChange(option);\r\n setIsOpen(false);\r\n },\r\n [onChange],\r\n );\r\n\r\n // Check if it's still the active dropdown\r\n useEffect(() => {\r\n if (activeDropdown !== name) setIsOpen(false);\r\n }, [activeDropdown, name]);\r\n\r\n const selected =\r\n value || value === 0 ? options.find((o) => o.id === value) : undefined;\r\n\r\n return (\r\n <div\r\n className={cn(\"relative w-full max-w-svw min-w-0\", className)}\r\n ref={ref}\r\n >\r\n <Button\r\n ref={triggerRef}\r\n type=\"button\"\r\n variant=\"outline\"\r\n disabled={disabled}\r\n size={size}\r\n onClick={handleClick}\r\n onTouchEnd={(e) => e.stopPropagation()}\r\n aria-haspopup=\"listbox\"\r\n aria-expanded={isOpen}\r\n className={cn(\r\n \"w-full max-w-full min-w-0\",\r\n \"h-auto py-1\",\r\n fieldTriggerClassName,\r\n \"flex items-center justify-between gap-2\",\r\n )}\r\n >\r\n {/* shrinkable text container */}\r\n <span className=\"flex-1 min-w-0 text-left pr-2 leading-relaxed\">\r\n {selected ? (\r\n <span className=\"block whitespace-normal wrap-break-word\">\r\n {selected.name}\r\n </span>\r\n ) : (\r\n <span className=\"text-muted-foreground/40 font-normal\">\r\n {fallback}\r\n </span>\r\n )}\r\n </span>\r\n\r\n <ChevronDown\r\n className={cn(\r\n \"shrink-0 w-4 h-4 text-muted-foreground transition-transform duration-interactive ease-out-strong motion-reduce:transition-none\",\r\n isOpen ? \"rotate-180\" : \"\",\r\n )}\r\n />\r\n </Button>\r\n\r\n {isOpen && (\r\n <MobileSheetPortal enabled={isMobile}>\r\n {isMobile && (\r\n <button\r\n type=\"button\"\r\n aria-label=\"Close options\"\r\n tabIndex={-1}\r\n className=\"fixed inset-0 z-(--z-popover-overlay) bg-black/25 backdrop-blur-[1px]\"\r\n onClick={closeSheet}\r\n />\r\n )}\r\n <div\r\n ref={isMobile ? sheetRef : undefined}\r\n role={isMobile ? \"dialog\" : undefined}\r\n aria-modal={isMobile ? true : undefined}\r\n aria-label={isMobile ? fallback : undefined}\r\n onKeyDown={\r\n isMobile\r\n ? (event) => {\r\n if (event.key === \"Escape\") {\r\n event.preventDefault();\r\n closeSheet();\r\n }\r\n if (event.key !== \"Tab\") return;\r\n const focusable =\r\n sheetRef.current?.querySelectorAll<HTMLElement>(\r\n \"button:not([disabled]):not([tabindex='-1'])\",\r\n );\r\n if (!focusable?.length) return;\r\n const first = focusable[0];\r\n const last = focusable[focusable.length - 1];\r\n if (event.shiftKey && document.activeElement === first) {\r\n event.preventDefault();\r\n last.focus();\r\n } else if (\r\n !event.shiftKey &&\r\n document.activeElement === last\r\n ) {\r\n event.preventDefault();\r\n first.focus();\r\n }\r\n }\r\n : undefined\r\n }\r\n className={cn(\r\n \"border border-border bg-background shadow-card\",\r\n isMobile\r\n ? \"fixed left-0 right-0 z-(--z-popover) flex flex-col overflow-hidden rounded-t-control-lg border-b-0 pb-[max(0.75rem,env(safe-area-inset-bottom))]\"\r\n : \"absolute left-0 right-0 top-full z-[9999] mt-1 max-w-full overflow-hidden rounded-control-lg\",\r\n )}\r\n style={\r\n isMobile\r\n ? {\r\n bottom: sheetViewport?.bottom ?? 0,\r\n maxHeight: sheetViewport\r\n ? Math.min(sheetViewport.height, 640)\r\n : \"80dvh\",\r\n }\r\n : undefined\r\n }\r\n >\r\n {isMobile && (\r\n <div className=\"flex shrink-0 items-center justify-between gap-4 px-4 pb-2 pt-4\">\r\n <h2 className=\"text-base font-semibold text-foreground\">\r\n {fallback}\r\n </h2>\r\n <button\r\n ref={sheetCloseRef}\r\n type=\"button\"\r\n aria-label=\"Close options\"\r\n className=\"-mr-3 flex h-11 w-11 shrink-0 cursor-pointer items-center justify-center rounded-control-lg text-muted-foreground hover:bg-muted\"\r\n onClick={closeSheet}\r\n >\r\n <X className=\"h-5 w-5\" aria-hidden=\"true\" />\r\n </button>\r\n </div>\r\n )}\r\n <div\r\n role=\"listbox\"\r\n className={cn(\r\n \"relative flex flex-col gap-option-gap overflow-y-auto overscroll-contain p-option-inset touch-pan-y [-webkit-overflow-scrolling:touch] [scrollbar-width:thin] [scrollbar-color:var(--color-border-hover)_var(--muted)]\",\r\n isMobile ? \"min-h-0 flex-1\" : \"max-h-[400px]\",\r\n )}\r\n >\r\n {options.map((option, index) => (\r\n <DropdownOptionButton\r\n key={index}\r\n set_is_open={setIsOpen}\r\n size={size}\r\n >\r\n <DropdownOption\r\n highlighted={value === option.id}\r\n on_click={() => handleChange(option.id)}\r\n >\r\n <span className=\"block whitespace-normal wrap-break-word pr-2\">\r\n {option.name}\r\n </span>\r\n </DropdownOption>\r\n </DropdownOptionButton>\r\n ))}\r\n </div>\r\n </div>\r\n </MobileSheetPortal>\r\n )}\r\n </div>\r\n );\r\n};\r\n\r\n/**\r\n * This creates a dropdown menu for navigating with improved mobile support.\r\n *\r\n * @component\r\n */\r\nexport const GroupableNavDropdown = ({\r\n display,\r\n content,\r\n children,\r\n className = \"\",\r\n showArrow = true,\r\n}: {\r\n display?: React.ReactNode;\r\n content?: React.ReactNode;\r\n children?:\r\n | React.ReactElement<IDropdownOptionProps>\r\n | React.ReactElement<IDropdownOptionProps>[];\r\n className?: string;\r\n showArrow?: boolean;\r\n}) => {\r\n const is_mobile = useMobile();\r\n const [is_open, set_is_open] = useState(false);\r\n const dropdownRef = useRef<HTMLDivElement>(null);\r\n const buttonRef = useRef<HTMLButtonElement>(null);\r\n const touchStartRef = useRef<{\r\n x: number;\r\n y: number;\r\n target: EventTarget | null;\r\n } | null>(null);\r\n\r\n // Close dropdown handler\r\n const closeDropdown = useCallback(() => {\r\n set_is_open(false);\r\n }, []);\r\n\r\n // Handle clicks outside dropdown\r\n useEffect(() => {\r\n const handleClickOutside = (event: MouseEvent) => {\r\n if (\r\n !is_mobile &&\r\n dropdownRef.current &&\r\n !dropdownRef.current.contains(event.target as Node) &&\r\n buttonRef.current &&\r\n !buttonRef.current.contains(event.target as Node)\r\n ) {\r\n closeDropdown();\r\n }\r\n };\r\n\r\n if (is_open && !is_mobile) {\r\n document.addEventListener(\"mousedown\", handleClickOutside);\r\n return () =>\r\n document.removeEventListener(\"mousedown\", handleClickOutside);\r\n }\r\n }, [is_open, is_mobile, closeDropdown]);\r\n\r\n // Mobile touch handlers\r\n const handleTouchStart = useCallback(\r\n (e: TouchEvent) => {\r\n if (!is_mobile || !is_open) return;\r\n\r\n const touch = e.touches[0];\r\n touchStartRef.current = {\r\n x: touch.clientX,\r\n y: touch.clientY,\r\n target: e.target,\r\n };\r\n },\r\n [is_mobile, is_open],\r\n );\r\n\r\n const handleTouchEnd = useCallback(\r\n (e: TouchEvent) => {\r\n if (!is_mobile || !is_open || !touchStartRef.current) return;\r\n\r\n const touch = e.changedTouches[0];\r\n const startTouch = touchStartRef.current;\r\n\r\n // Calculate touch movement\r\n const deltaX = Math.abs(touch.clientX - startTouch.x);\r\n const deltaY = Math.abs(touch.clientY - startTouch.y);\r\n const isSwipe = deltaX > 10 || deltaY > 10;\r\n\r\n // Check if touch is outside dropdown area\r\n const target = e.target as Element;\r\n const isOutsideDropdown =\r\n dropdownRef.current &&\r\n !dropdownRef.current.contains(target) &&\r\n buttonRef.current &&\r\n !buttonRef.current.contains(target);\r\n\r\n // Close if touch ended outside and wasn't a swipe\r\n if (!isSwipe && isOutsideDropdown) {\r\n closeDropdown();\r\n }\r\n\r\n touchStartRef.current = null;\r\n },\r\n [is_mobile, is_open, closeDropdown],\r\n );\r\n\r\n // Set up mobile touch listeners\r\n useEffect(() => {\r\n if (is_mobile && is_open) {\r\n document.addEventListener(\"touchstart\", handleTouchStart);\r\n document.addEventListener(\"touchend\", handleTouchEnd);\r\n\r\n return () => {\r\n document.removeEventListener(\"touchstart\", handleTouchStart);\r\n document.removeEventListener(\"touchend\", handleTouchEnd);\r\n };\r\n }\r\n }, [is_mobile, is_open, handleTouchStart, handleTouchEnd]);\r\n\r\n // Prevent event propagation for dropdown content\r\n const handleDropdownInteraction = useCallback(\r\n (e: React.MouseEvent | React.TouchEvent) => {\r\n e.stopPropagation();\r\n },\r\n [],\r\n );\r\n\r\n // Toggle dropdown\r\n const handleButtonClick = useCallback(\r\n (e: React.MouseEvent) => {\r\n e.stopPropagation();\r\n set_is_open(!is_open);\r\n },\r\n [is_open],\r\n );\r\n\r\n return (\r\n <div className={cn(\"relative z-[100]\", className)} ref={dropdownRef}>\r\n <Button\r\n ref={buttonRef}\r\n type=\"button\"\r\n variant=\"ghost\"\r\n className=\"relative flex items-center gap-2 h-12 px-3 z-[1000]\"\r\n onClick={handleButtonClick}\r\n onTouchEnd={(e) => e.stopPropagation()}\r\n >\r\n {display}\r\n {showArrow && (\r\n <ChevronDown\r\n className={cn(\r\n \"w-4 h-4 text-muted-foreground transition-transform\",\r\n is_open ? \"rotate-180\" : \"\",\r\n )}\r\n />\r\n )}\r\n </Button>\r\n\r\n {is_open && (\r\n <div\r\n className={cn(\r\n \"absolute right-0 mt-2 bg-background border border-border rounded-control-lg overflow-hidden shadow-card z-[1000]\",\r\n is_mobile ? \"w-56\" : \"w-48\", // Slightly wider on mobile for better touch targets\r\n className,\r\n )}\r\n onClick={handleDropdownInteraction}\r\n onTouchStart={handleDropdownInteraction}\r\n onTouchEnd={handleDropdownInteraction}\r\n >\r\n <div\r\n className={cn(\r\n \"relative z-[1000] flex max-h-64 flex-col gap-option-gap overflow-y-auto overscroll-contain p-option-inset [scrollbar-width:thin] [scrollbar-color:var(--color-border-hover)_var(--muted)]\",\r\n is_mobile ? \"max-h-80\" : \"max-h-64\",\r\n )}\r\n >\r\n {content}\r\n\r\n {Children.map(children, (child, index) => {\r\n return (\r\n <DropdownOptionButton key={index} set_is_open={set_is_open}>\r\n {child ? child : <></>}\r\n </DropdownOptionButton>\r\n );\r\n })}\r\n </div>\r\n </div>\r\n )}\r\n </div>\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;;;;;;;;;;AAsCA;;;AAkBA;AAEA;;;;;AAKG;AACH;AASE;AACA;;AAEA;AAEA;;;;AAKI;;AAKJ;;;AAGA;AAEA;;;AAGA;;AAGE;AACA;;;AAGA;AACE;AACD;AAED;AACE;AACD;;AAGD;AACE;AACA;AACF;AACF;AAEA;;AAGI;AAYN;AAEA;;;;;;AAMG;;;AAGD;;;;;AAUF;AAOA;;;;;AAKG;AACI;AAmBL;;;;;AAMA;AACA;AACA;AACA;AACA;AAEA;;AAEE;;;;AAKA;;;;AAGA;AAGA;AACE;;AAEF;AACF;;;;AAKA;AAEA;;AAEG;AACH;;AAGI;;;AAMJ;;AAEG;AACH;;;;AAKE;;;;;AAOF;AAEA;;AAgEc;AACI;;AAEE;;AAEF;;;;;AAMA;;;;;;;AAOE;;;;;;AAWN;AACA;AAIA;AACI;AACA;;AAEE;AACH;AACH;AAgDhB;AAEA;;;;AAIG;;AAgBD;;AAEA;AACA;AACA;;AAOA;;;;;AAME;AACE;AAEE;;AAEA;;AAGA;;AAEJ;AAEA;AACE;;;;;AAOJ;AAEI;;;;;;;;AAQF;AAIF;;;;AAKI;;AAGA;AACA;;;AAIA;AACA;AAEE;AACA;;;AAIF;AACE;;AAGF;;;;AAOF;AACE;AACA;AAEA;AACE;AACA;AACF;;;;AAKJ;;;;AAQA;;AAGI;AACF;;;;AAkDQ;AAMZ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sources":["../../src/components/error.tsx"],"sourcesContent":["import { CircleAlert, RotateCw } from \"lucide-react\";\nimport { cn } from \"@/utils\";\nimport { Card } from \"./card\";\nimport { Button } from \"./button\";\n\nfunction ErrorGraphic() {\n return <img src=\"/error-exclamation-sprite.png\" alt=\"\" className=\"h-32 w-auto object-contain motion-safe:animate-error-bob motion-reduce:animate-none\" />;\n}\n\nexport const PageError = ({\n title,\n description,\n image = false,\n flush = false,\n topAlign = false,\n onRetry,\n}: {\n title: string;\n description: string;\n // Shows /error.png beneath the text.\n image?: boolean;\n // Card fills its container edge-to-edge instead of capping at max-w-md\n // with breathing room around it.\n flush?: boolean;\n // Aligns content to the top of the card instead of vertically centering\n // it (flush mode only).\n topAlign?: boolean;\n // Shows a \"Retry\" button that calls this when clicked.\n onRetry?: () => void;\n}) => {\n return (\n <div\n role=\"alert\"\n className={cn(\n \"animate-in fade-in-0 duration-interactive ease-out-strong motion-reduce:animate-none\",\n flush ? \"h-full\" : \"px-4 py-16\",\n )}\n >\n <Card\n className={cn(\n \"m-auto gap-0 px-6 py-8\",\n flush\n ? cn(\n \"h-full w-full items-start text-left\",\n topAlign ? \"justify-start\" : \"justify-center\",\n )\n : \"max-w-md items-center text-center\",\n )}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n \"mb-4 flex items-center justify-center text-destructive\",\n image\n ? \"h-40 w-32\"\n : \"size-12 rounded-full bg-destructive/10\",\n )}\n >\n {image ? <ErrorGraphic /> : <CircleAlert className=\"size-6\" />}\n </span>\n <h3 className=\"text-lg font-semibold text-foreground\">{title}</h3>\n <p className=\"mt-2 text-base leading-relaxed text-muted-foreground\">\n {description}\n </p>\n {onRetry && (\n <Button variant=\"outline\" className=\"mt-6\" onClick={onRetry}>\n <RotateCw className=\"size-4\" aria-hidden=\"true\" />\n Retry\n </Button>\n )}\n </Card>\n </div>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;AAKA,SAAS,YAAY,GAAA;AACnB,IAAA,OAAOA,GAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAC,+BAA+B,EAAC,GAAG,EAAC,EAAE,EAAC,SAAS,EAAC,qFAAqF,GAAG;AAC3J;AAEO,MAAM,SAAS,GAAG,CAAC,EACxB,KAAK,EACL,WAAW,EACX,KAAK,GAAG,KAAK,EACb,KAAK,GAAG,KAAK,EACb,QAAQ,GAAG,KAAK,EAChB,OAAO,GAcR,KAAI;AACH,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EACE,IAAI,EAAC,OAAO,EACZ,SAAS,EAAE,EAAE,CACX,sFAAsF,EACtF,KAAK,GAAG,QAAQ,GAAG,YAAY,CAChC,YAEDC,IAAA,CAAC,IAAI,EAAA,EACH,SAAS,EAAE,EAAE,CACX,wBAAwB,EACxB;AACE,kBAAE,EAAE,CACA,qCAAqC,EACrC,QAAQ,GAAG,eAAe,GAAG,gBAAgB;AAEjD,kBAAE,mCAAmC,CACxC,EAAA,QAAA,EAAA,CAEDD,GAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EACc,MAAM,EAClB,SAAS,EAAE,EAAE,CACX,wDAAwD,EACxD;AACE,0BAAE;AACF,0BAAE,wCAAwC,CAC7C,EAAA,QAAA,EAEA,KAAK,GAAGA,GAAA,CAAC,YAAY,EAAA,EAAA,CAAG,GAAGA,GAAA,CAAC,WAAW,EAAA,EAAC,SAAS,EAAC,QAAQ,EAAA,CAAG,EAAA,CACzD,EACPA,GAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,uCAAuC,YAAE,KAAK,EAAA,CAAM,EAClEA,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,sDAAsD,EAAA,QAAA,EAChE,WAAW,EAAA,CACV,EACH,OAAO,KACNC,IAAA,CAAC,MAAM,EAAA,EAAC,OAAO,EAAC,SAAS,EAAC,SAAS,EAAC,MAAM,EAAC,OAAO,EAAE,OAAO,EAAA,QAAA,EAAA,CACzDD,GAAA,CAAC,QAAQ,EAAA,EAAC,SAAS,EAAC,QAAQ,EAAA,aAAA,EAAa,MAAM,GAAG,EAAA,OAAA,CAAA,EAAA,CAE3C,CACV,CAAA,EAAA,CACI,EAAA,CACH;AAEV;;;;"}
|
|
1
|
+
{"version":3,"file":"error.js","sources":["../../src/components/error.tsx"],"sourcesContent":["import { CircleAlert, RotateCw } from \"lucide-react\";\r\nimport { cn } from \"@/utils\";\r\nimport { Card } from \"./card\";\r\nimport { Button } from \"./button\";\r\n\r\nfunction ErrorGraphic() {\r\n return <img src=\"/error-exclamation-sprite.png\" alt=\"\" className=\"h-32 w-auto object-contain motion-safe:animate-error-bob motion-reduce:animate-none\" />;\r\n}\r\n\r\nexport const PageError = ({\r\n title,\r\n description,\r\n image = false,\r\n flush = false,\r\n topAlign = false,\r\n onRetry,\r\n}: {\r\n title: string;\r\n description: string;\r\n // Shows /error.png beneath the text.\r\n image?: boolean;\r\n // Card fills its container edge-to-edge instead of capping at max-w-md\r\n // with breathing room around it.\r\n flush?: boolean;\r\n // Aligns content to the top of the card instead of vertically centering\r\n // it (flush mode only).\r\n topAlign?: boolean;\r\n // Shows a \"Retry\" button that calls this when clicked.\r\n onRetry?: () => void;\r\n}) => {\r\n return (\r\n <div\r\n role=\"alert\"\r\n className={cn(\r\n \"animate-in fade-in-0 duration-interactive ease-out-strong motion-reduce:animate-none\",\r\n flush ? \"h-full\" : \"px-4 py-16\",\r\n )}\r\n >\r\n <Card\r\n className={cn(\r\n \"m-auto gap-0 px-6 py-8\",\r\n flush\r\n ? cn(\r\n \"h-full w-full items-start text-left\",\r\n topAlign ? \"justify-start\" : \"justify-center\",\r\n )\r\n : \"max-w-md items-center text-center\",\r\n )}\r\n >\r\n <span\r\n aria-hidden=\"true\"\r\n className={cn(\r\n \"mb-4 flex items-center justify-center text-destructive\",\r\n image\r\n ? \"h-40 w-32\"\r\n : \"size-12 rounded-full bg-destructive/10\",\r\n )}\r\n >\r\n {image ? <ErrorGraphic /> : <CircleAlert className=\"size-6\" />}\r\n </span>\r\n <h3 className=\"text-lg font-semibold text-foreground\">{title}</h3>\r\n <p className=\"mt-2 text-base leading-relaxed text-muted-foreground\">\r\n {description}\r\n </p>\r\n {onRetry && (\r\n <Button variant=\"outline\" className=\"mt-6\" onClick={onRetry}>\r\n <RotateCw className=\"size-4\" aria-hidden=\"true\" />\r\n Retry\r\n </Button>\r\n )}\r\n </Card>\r\n </div>\r\n );\r\n};\r\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;AAKA,SAAS,YAAY,GAAA;AACnB,IAAA,OAAOA,GAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAC,+BAA+B,EAAC,GAAG,EAAC,EAAE,EAAC,SAAS,EAAC,qFAAqF,GAAG;AAC3J;AAEO,MAAM,SAAS,GAAG,CAAC,EACxB,KAAK,EACL,WAAW,EACX,KAAK,GAAG,KAAK,EACb,KAAK,GAAG,KAAK,EACb,QAAQ,GAAG,KAAK,EAChB,OAAO,GAcR,KAAI;AACH,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EACE,IAAI,EAAC,OAAO,EACZ,SAAS,EAAE,EAAE,CACX,sFAAsF,EACtF,KAAK,GAAG,QAAQ,GAAG,YAAY,CAChC,YAEDC,IAAA,CAAC,IAAI,EAAA,EACH,SAAS,EAAE,EAAE,CACX,wBAAwB,EACxB;AACE,kBAAE,EAAE,CACA,qCAAqC,EACrC,QAAQ,GAAG,eAAe,GAAG,gBAAgB;AAEjD,kBAAE,mCAAmC,CACxC,EAAA,QAAA,EAAA,CAEDD,GAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EACc,MAAM,EAClB,SAAS,EAAE,EAAE,CACX,wDAAwD,EACxD;AACE,0BAAE;AACF,0BAAE,wCAAwC,CAC7C,EAAA,QAAA,EAEA,KAAK,GAAGA,GAAA,CAAC,YAAY,EAAA,EAAA,CAAG,GAAGA,GAAA,CAAC,WAAW,EAAA,EAAC,SAAS,EAAC,QAAQ,EAAA,CAAG,EAAA,CACzD,EACPA,GAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,uCAAuC,YAAE,KAAK,EAAA,CAAM,EAClEA,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,sDAAsD,EAAA,QAAA,EAChE,WAAW,EAAA,CACV,EACH,OAAO,KACNC,IAAA,CAAC,MAAM,EAAA,EAAC,OAAO,EAAC,SAAS,EAAC,SAAS,EAAC,MAAM,EAAC,OAAO,EAAE,OAAO,EAAA,QAAA,EAAA,CACzDD,GAAA,CAAC,QAAQ,EAAA,EAAC,SAAS,EAAC,QAAQ,EAAA,aAAA,EAAa,MAAM,GAAG,EAAA,OAAA,CAAA,EAAA,CAE3C,CACV,CAAA,EAAA,CACI,EAAA,CACH;AAEV;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fab.js","sources":["../../src/components/fab.tsx"],"sourcesContent":["import { Button } from \"@/components/button\";\n\nconst FloatingActionButton = ({ onClick, children }: { onClick: () => void; children: React.ReactNode }) => {\n return (\n <Button\n onClick={onClick}\n className=\"fixed bottom-4 right-4 z-50 rounded-full bg-primary p-4 text-primary-foreground shadow-lg transition-[background-color,box-shadow,transform] duration-interactive ease-out-strong hover:bg-primary-hover hover:shadow-interactive motion-safe:pointer-fine:hover:-translate-y-0.5 motion-safe:active:translate-y-0 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary motion-reduce:transition-none\"\n >\n {children}\n </Button>\n );\n}\n\nexport { FloatingActionButton };\n"],"names":["_jsx"],"mappings":";;;AAEA,MAAM,oBAAoB,GAAG,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAsD,KAAI;AACzG,IAAA,QACEA,GAAA,CAAC,MAAM,EAAA,EACL,OAAO,EAAE,OAAO,EAChB,SAAS,EAAC,yZAAyZ,EAAA,QAAA,EAEla,QAAQ,EAAA,CACF;AAEb;;;;"}
|
|
1
|
+
{"version":3,"file":"fab.js","sources":["../../src/components/fab.tsx"],"sourcesContent":["import { Button } from \"@/components/button\";\r\n\r\nconst FloatingActionButton = ({ onClick, children }: { onClick: () => void; children: React.ReactNode }) => {\r\n return (\r\n <Button\r\n onClick={onClick}\r\n className=\"fixed bottom-4 right-4 z-50 rounded-full bg-primary p-4 text-primary-foreground shadow-lg transition-[background-color,box-shadow,transform] duration-interactive ease-out-strong hover:bg-primary-hover hover:shadow-interactive motion-safe:pointer-fine:hover:-translate-y-0.5 motion-safe:active:translate-y-0 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary motion-reduce:transition-none\"\r\n >\r\n {children}\r\n </Button>\r\n );\r\n}\r\n\r\nexport { FloatingActionButton };\r\n"],"names":["_jsx"],"mappings":";;;AAEA,MAAM,oBAAoB,GAAG,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAsD,KAAI;AACzG,IAAA,QACEA,GAAA,CAAC,MAAM,EAAA,EACL,OAAO,EAAE,OAAO,EAChB,SAAS,EAAC,yZAAyZ,EAAA,QAAA,EAEla,QAAQ,EAAA,CACF;AAEb;;;;"}
|