@betterinternship/components 3.4.1 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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.d.ts +1 -2
- package/dist/components/autocomplete.js +75 -64
- 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-field.d.ts +18 -0
- package/dist/components/checkbox-field.js +25 -0
- package/dist/components/checkbox-field.js.map +1 -0
- package/dist/components/checkbox-group.d.ts +33 -0
- package/dist/components/checkbox-group.js +43 -0
- package/dist/components/checkbox-group.js.map +1 -0
- package/dist/components/checkbox.d.ts +1 -1
- package/dist/components/checkbox.js +6 -2
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/chip-select.d.ts +11 -2
- package/dist/components/chip-select.js +9 -4
- 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/{form-date-picker.d.ts → date-picker.d.ts} +11 -8
- package/dist/components/date-picker.js +57 -0
- package/dist/components/date-picker.js.map +1 -0
- 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 +7 -2
- 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-field.d.ts +60 -5
- package/dist/components/form-field.js +55 -5
- package/dist/components/form-field.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 +3 -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/{form-month-picker.d.ts → month-picker.d.ts} +6 -6
- package/dist/components/month-picker.js +57 -0
- package/dist/components/month-picker.js.map +1 -0
- 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.d.ts +11 -1
- package/dist/components/radio-group.js +17 -4
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/select.js +38 -2
- package/dist/components/select.js.map +1 -1
- package/dist/components/sheet.d.ts +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.d.ts +1 -1
- package/dist/components/switch.js +4 -1
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.js +5 -5
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/textarea.d.ts +1 -1
- package/dist/components/textarea.js +3 -1
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/time-input.d.ts +9 -0
- package/dist/components/time-input.js +65 -0
- package/dist/components/time-input.js.map +1 -0
- 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.d.ts +1 -1
- package/dist/hooks/use-field-focus.js +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 +9 -12
- package/dist/index.js +8 -11
- 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/node_modules/tailwind-merge/dist/bundle-mjs.js +54 -2
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
- package/dist/utils.js +11 -1
- package/dist/utils.js.map +1 -1
- package/package.json +317 -330
- package/theme.css +414 -414
- package/theme.legacy.css +84 -84
- package/dist/components/form-checkbox-group.d.ts +0 -31
- package/dist/components/form-checkbox-group.js +0 -30
- package/dist/components/form-checkbox-group.js.map +0 -1
- package/dist/components/form-checkbox.d.ts +0 -15
- package/dist/components/form-checkbox.js +0 -15
- package/dist/components/form-checkbox.js.map +0 -1
- package/dist/components/form-date-picker.js +0 -56
- package/dist/components/form-date-picker.js.map +0 -1
- package/dist/components/form-input.d.ts +0 -11
- package/dist/components/form-input.js +0 -13
- package/dist/components/form-input.js.map +0 -1
- package/dist/components/form-month-picker.js +0 -56
- package/dist/components/form-month-picker.js.map +0 -1
- package/dist/components/form-radio.d.ts +0 -15
- package/dist/components/form-radio.js +0 -20
- package/dist/components/form-radio.js.map +0 -1
- package/dist/components/form-textarea.d.ts +0 -11
- package/dist/components/form-textarea.js +0 -12
- package/dist/components/form-textarea.js.map +0 -1
- package/dist/components/form.d.ts +0 -24
- package/dist/components/form.js +0 -71
- package/dist/components/form.js.map +0 -1
- package/dist/components/time-input-native.d.ts +0 -14
- package/dist/components/time-input-native.js +0 -62
- package/dist/components/time-input-native.js.map +0 -1
- package/dist/node_modules/react-hook-form/dist/index.esm.js +0 -706
- package/dist/node_modules/react-hook-form/dist/index.esm.js.map +0 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ChevronDown, ChevronLeft, ChevronRight } from 'lucide-react';
|
|
5
|
+
import { cn } from '../utils.js';
|
|
6
|
+
import { fieldTriggerClassName } from '../hooks/use-field-focus.js';
|
|
7
|
+
import { Button } from './button.js';
|
|
8
|
+
import { Popover, PopoverTrigger, PopoverContent } from './popover.js';
|
|
9
|
+
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from './select.js';
|
|
10
|
+
import { useFormFieldControl, FormFieldReset } from './form-field.js';
|
|
11
|
+
|
|
12
|
+
const MonthPicker = ({ date, setter, className, side = 'bottom', align = 'start', sideOffset = 6, contentClassName, placeholder = 'Select month', format = (d) => d.toLocaleDateString(undefined, { month: 'short', year: 'numeric' }), fromYear = new Date().getFullYear() - 5, toYear = new Date().getFullYear() + 5, autoClose = true, ...ownTriggerProps }) => {
|
|
13
|
+
const triggerProps = useFormFieldControl(ownTriggerProps);
|
|
14
|
+
const [open, setOpen] = React.useState(false);
|
|
15
|
+
// normalize incoming ms -> first day of month
|
|
16
|
+
const selected = React.useMemo(() => {
|
|
17
|
+
if (date == null)
|
|
18
|
+
return undefined;
|
|
19
|
+
const d = new Date(date);
|
|
20
|
+
return new Date(d.getFullYear(), d.getMonth(), 1, 0, 0, 0, 0);
|
|
21
|
+
}, [date]);
|
|
22
|
+
const [viewYear, setViewYear] = React.useState(selected?.getFullYear() ?? new Date().getFullYear());
|
|
23
|
+
React.useEffect(() => {
|
|
24
|
+
if (selected)
|
|
25
|
+
setViewYear(selected.getFullYear());
|
|
26
|
+
}, [selected]);
|
|
27
|
+
const months = React.useMemo(() => Array.from({ length: 12 }, (_, m) => ({
|
|
28
|
+
m,
|
|
29
|
+
label: new Date(2000, m, 1).toLocaleString(undefined, {
|
|
30
|
+
month: 'short',
|
|
31
|
+
}),
|
|
32
|
+
})), []);
|
|
33
|
+
const clampYear = (y) => Math.min(Math.max(y, fromYear), toYear);
|
|
34
|
+
const selectMonth = (monthIndex) => {
|
|
35
|
+
const y = clampYear(viewYear);
|
|
36
|
+
const firstOfMonth = new Date(y, monthIndex, 1, 0, 0, 0, 0).getTime();
|
|
37
|
+
setter?.(firstOfMonth);
|
|
38
|
+
if (autoClose)
|
|
39
|
+
setOpen(false);
|
|
40
|
+
};
|
|
41
|
+
const prevYear = () => setViewYear((y) => clampYear(y - 1));
|
|
42
|
+
const nextYear = () => setViewYear((y) => clampYear(y + 1));
|
|
43
|
+
const isYearMin = viewYear <= fromYear;
|
|
44
|
+
const isYearMax = viewYear >= toYear;
|
|
45
|
+
return (jsx("div", { className: cn('flex flex-col', className), children: jsxs(Popover, { open: open, onOpenChange: setOpen, children: [jsx(PopoverTrigger, { asChild: true, children: jsxs(Button, { variant: "outline", ...triggerProps, className: cn("w-full justify-between px-field-padding-x py-0", fieldTriggerClassName), children: [selected ? format(selected) : jsx("span", { className: "text-muted-foreground/40", children: placeholder }), jsx(ChevronDown, { className: "h-4 w-4 text-muted-foreground" })] }) }), jsx(PopoverContent, { align: align, side: side, sideOffset: sideOffset, className: cn('w-72 p-3', contentClassName), children: jsxs(FormFieldReset, { children: [jsxs("div", { className: "mb-3 flex items-center justify-between", children: [jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "h-8 w-8 p-0", "aria-label": "Previous year", onClick: prevYear, disabled: isYearMin, children: jsx(ChevronLeft, { className: "h-4 w-4" }) }), jsxs(Select, { value: String(viewYear), onValueChange: (val) => setViewYear(clampYear(Number(val))), children: [jsx(SelectTrigger, { className: "w-fit text-sm", children: jsx(SelectValue, {}) }), jsx(SelectContent, { className: "h-fit", children: Array.from({ length: toYear - fromYear + 1 }, (_, i) => fromYear + i).map((y) => (jsx(SelectItem, { value: String(y), children: y }, y))) })] }), jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "h-8 w-8 p-0", "aria-label": "Next year", onClick: nextYear, disabled: isYearMax, children: jsx(ChevronRight, { className: "h-4 w-4" }) })] }), jsx("div", { className: "grid grid-cols-3 gap-2", children: months.map(({ m, label: monthLabel }) => {
|
|
46
|
+
const isActive = selected &&
|
|
47
|
+
selected.getFullYear() === viewYear &&
|
|
48
|
+
selected.getMonth() === m;
|
|
49
|
+
return (jsx(Button, { type: "button", variant: isActive ? 'solid' : 'outline', className: cn('h-9 justify-center rounded-control-lg', isActive ? '' : 'bg-background'), onClick: () => selectMonth(m), children: jsx("span", { className: "text-sm", children: monthLabel }) }, m));
|
|
50
|
+
}) }), jsx("div", { className: "mt-3 flex justify-end", children: jsx(Button, { type: "button", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => {
|
|
51
|
+
setter?.(undefined);
|
|
52
|
+
setOpen(false);
|
|
53
|
+
}, children: "Clear" }) })] }) })] }) }));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export { MonthPicker };
|
|
57
|
+
//# sourceMappingURL=month-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"month-picker.js","sources":["../../src/components/month-picker.tsx"],"sourcesContent":["'use client';\r\n\r\nimport * as React from 'react';\r\nimport { ChevronDown, ChevronLeft, ChevronRight } from 'lucide-react';\r\n\r\nimport { cn } from '@/utils';\r\nimport { fieldTriggerClassName } from '@/hooks/use-field-focus';\r\nimport { Button } from '@/components/button';\r\nimport {\r\n Popover,\r\n PopoverContent,\r\n PopoverTrigger,\r\n} from '@/components/popover';\r\nimport {\r\n Select,\r\n SelectContent,\r\n SelectItem,\r\n SelectTrigger,\r\n SelectValue,\r\n} from '@/components/select';\r\nimport { FormFieldReset, useFormFieldControl } from './form-field';\r\n\r\n/** Props the trigger takes from the caller or the surrounding FormField. */\r\ntype TriggerProps = Pick<\r\n React.ButtonHTMLAttributes<HTMLButtonElement>,\r\n 'id' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-invalid' | 'aria-required' | 'disabled'\r\n>;\r\n\r\n/** A month picker. Unlabelled: put it in a `FormField` for a label. */\r\nexport interface MonthPickerProps extends TriggerProps {\r\n /** ms since epoch; will be normalized to the first day of the month */\r\n date?: number;\r\n /** setter receives ms since epoch (first day of month at local midnight) or undefined when cleared */\r\n setter?: (value?: number) => void;\r\n className?: string;\r\n side?: 'top' | 'right' | 'bottom' | 'left';\r\n align?: 'start' | 'center' | 'end';\r\n sideOffset?: number;\r\n contentClassName?: string;\r\n\r\n /** Placeholder text when no month selected */\r\n placeholder?: string;\r\n\r\n /** Format the button text */\r\n format?: (d: Date) => string;\r\n\r\n /** Year bounds for navigation (inclusive) */\r\n fromYear?: number;\r\n toYear?: number;\r\n\r\n /** Close popover automatically on select (default true) */\r\n autoClose?: boolean;\r\n}\r\n\r\nexport const MonthPicker = ({\r\n date,\r\n setter,\r\n className,\r\n side = 'bottom',\r\n align = 'start',\r\n sideOffset = 6,\r\n contentClassName,\r\n placeholder = 'Select month',\r\n format = (d) =>\r\n d.toLocaleDateString(undefined, { month: 'short', year: 'numeric' }),\r\n fromYear = new Date().getFullYear() - 5,\r\n toYear = new Date().getFullYear() + 5,\r\n autoClose = true,\r\n ...ownTriggerProps\r\n}: MonthPickerProps) => {\r\n const triggerProps = useFormFieldControl(ownTriggerProps);\r\n const [open, setOpen] = React.useState(false);\r\n\r\n // normalize incoming ms -> first day of month\r\n const selected = React.useMemo(() => {\r\n if (date == null) return undefined;\r\n const d = new Date(date);\r\n return new Date(d.getFullYear(), d.getMonth(), 1, 0, 0, 0, 0);\r\n }, [date]);\r\n\r\n const [viewYear, setViewYear] = React.useState<number>(\r\n selected?.getFullYear() ?? new Date().getFullYear(),\r\n );\r\n\r\n React.useEffect(() => {\r\n if (selected) setViewYear(selected.getFullYear());\r\n }, [selected]);\r\n\r\n const months = React.useMemo(\r\n () =>\r\n Array.from({ length: 12 }, (_, m) => ({\r\n m,\r\n label: new Date(2000, m, 1).toLocaleString(undefined, {\r\n month: 'short',\r\n }),\r\n })),\r\n [],\r\n );\r\n\r\n const clampYear = (y: number) => Math.min(Math.max(y, fromYear), toYear);\r\n\r\n const selectMonth = (monthIndex: number) => {\r\n const y = clampYear(viewYear);\r\n const firstOfMonth = new Date(y, monthIndex, 1, 0, 0, 0, 0).getTime();\r\n setter?.(firstOfMonth);\r\n if (autoClose) setOpen(false);\r\n };\r\n\r\n const prevYear = () => setViewYear((y) => clampYear(y - 1));\r\n const nextYear = () => setViewYear((y) => clampYear(y + 1));\r\n\r\n const isYearMin = viewYear <= fromYear;\r\n const isYearMax = viewYear >= toYear;\r\n\r\n return (\r\n <div className={cn('flex flex-col', className)}>\r\n <Popover open={open} onOpenChange={setOpen}>\r\n <PopoverTrigger asChild>\r\n <Button\r\n variant=\"outline\"\r\n {...triggerProps}\r\n className={cn(\"w-full justify-between px-field-padding-x py-0\", fieldTriggerClassName)}\r\n >\r\n {selected ? format(selected) : <span className=\"text-muted-foreground/40\">{placeholder}</span>}\r\n <ChevronDown className=\"h-4 w-4 text-muted-foreground\" />\r\n </Button>\r\n </PopoverTrigger>\r\n\r\n <PopoverContent\r\n align={align}\r\n side={side}\r\n sideOffset={sideOffset}\r\n className={cn('w-72 p-3', contentClassName)}\r\n >\r\n <FormFieldReset>\r\n {/* Header: year controls */}\r\n <div className=\"mb-3 flex items-center justify-between\">\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n size=\"sm\"\r\n className=\"h-8 w-8 p-0\"\r\n aria-label=\"Previous year\"\r\n onClick={prevYear}\r\n disabled={isYearMin}\r\n >\r\n <ChevronLeft className=\"h-4 w-4\" />\r\n </Button>\r\n\r\n <Select\r\n value={String(viewYear)}\r\n onValueChange={(val) => setViewYear(clampYear(Number(val)))}\r\n >\r\n <SelectTrigger className=\"w-fit text-sm\">\r\n <SelectValue />\r\n </SelectTrigger>\r\n <SelectContent className=\"h-fit\">\r\n {Array.from(\r\n { length: toYear - fromYear + 1 },\r\n (_, i) => fromYear + i,\r\n ).map((y) => (\r\n <SelectItem key={y} value={String(y)}>\r\n {y}\r\n </SelectItem>\r\n ))}\r\n </SelectContent>\r\n </Select>\r\n\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n size=\"sm\"\r\n className=\"h-8 w-8 p-0\"\r\n aria-label=\"Next year\"\r\n onClick={nextYear}\r\n disabled={isYearMax}\r\n >\r\n <ChevronRight className=\"h-4 w-4\" />\r\n </Button>\r\n </div>\r\n\r\n {/* Month grid */}\r\n <div className=\"grid grid-cols-3 gap-2\">\r\n {months.map(({ m, label: monthLabel }) => {\r\n const isActive =\r\n selected &&\r\n selected.getFullYear() === viewYear &&\r\n selected.getMonth() === m;\r\n\r\n return (\r\n <Button\r\n key={m}\r\n type=\"button\"\r\n variant={isActive ? 'solid' : 'outline'}\r\n className={cn(\r\n 'h-9 justify-center rounded-control-lg',\r\n isActive ? '' : 'bg-background',\r\n )}\r\n onClick={() => selectMonth(m)}\r\n >\r\n <span className=\"text-sm\">{monthLabel}</span>\r\n </Button>\r\n );\r\n })}\r\n </div>\r\n\r\n {/* Clear (optional) */}\r\n <div className=\"mt-3 flex justify-end\">\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n className=\"h-8 px-2 text-xs\"\r\n onClick={() => {\r\n setter?.(undefined);\r\n setOpen(false);\r\n }}\r\n >\r\n Clear\r\n </Button>\r\n </div>\r\n </FormFieldReset>\r\n </PopoverContent>\r\n </Popover>\r\n </div>\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;;;;;;;;AAsDO;AAgBL;AACA;;AAGA;;AACoB;AAClB;;AAEF;;AAMA;AACE;AAAc;AAChB;;;AAMM;AACE;;AAEH;;AAML;AACE;;AAEA;AACA;;AACF;AAEA;AACA;AAEA;AACA;AAEA;;AAwEc;AACA;;;AA0BA;;AAEF;AAUd;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"option-list.js","sources":["../../src/components/option-list.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { ChevronDown, X } from \"lucide-react\";\n\nimport { cn } from \"@/utils\";\nimport { useMobile } from \"@/hooks/use-mobile\";\nimport { Button } from \"./button\";\nimport { Checkbox } from \"./checkbox\";\nimport { FilterChip } from \"./filter-chip\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\nimport { Sheet, SheetContent, SheetTitle } from \"./sheet\";\n\n/*\n * The shared look for every list of options (menus, selects, dropdowns,\n * autocomplete, filter menus): the list is inset from its container's edge,\n * and each row is its own rounded box with a little space between rows, so\n * hover and selection read as distinct pills rather than full-bleed stripes.\n */\n\n/** Padding + row gap for a list of options inside a popover or sheet. */\nexport const optionListClassName = \"flex flex-col gap-option-gap p-option-inset\";\n\n/** One option row. Pair with a hover/focus or selected state as needed. */\nexport const optionRowClassName =\n \"relative flex min-h-option-row w-full cursor-pointer select-none items-center gap-3 rounded-control-sm px-option-x py-2 text-left text-sm text-foreground outline-none transition-colors duration-state hover:bg-muted focus-visible:bg-muted motion-reduce:transition-none max-md:min-h-11\";\n\nexport type CheckboxListItem = {\n label: React.ReactNode;\n checked: boolean;\n onCheckedChange: (checked: boolean) => void;\n /** Indents the row under a group heading row. */\n indent?: boolean;\n /** Bolder label, e.g. a group's \"All …\" row. */\n strong?: boolean;\n disabled?: boolean;\n};\n\n/** A list of checkbox rows in the shared option style. */\nexport function CheckboxList({\n items,\n className,\n \"aria-label\": label,\n}: {\n items: CheckboxListItem[];\n className?: string;\n \"aria-label\"?: string;\n}) {\n return (\n <ul\n aria-label={label}\n className={cn(\"m-0 list-none\", optionListClassName, className)}\n >\n {items.map((item, index) => (\n <li key={index}>\n <label\n className={cn(\n optionRowClassName,\n item.indent && \"pl-8\",\n item.strong && \"font-medium\",\n item.disabled && \"pointer-events-none opacity-50\",\n )}\n >\n <Checkbox\n checked={item.checked}\n disabled={item.disabled}\n onCheckedChange={(checked) =>\n item.onCheckedChange(checked === true)\n }\n />\n <span className=\"min-w-0 flex-1\">{item.label}</span>\n </label>\n </li>\n ))}\n </ul>\n );\n}\n\nexport type FilterMenuOption = { label: React.ReactNode; value: string };\n\ntype FilterMenuCommon = {\n /** The chip's label (and the sheet title when it's text). */\n label?: React.ReactNode;\n /** Replaces the default chip, e.g. a labelled field button. */\n trigger?: React.ReactElement<React.HTMLAttributes<HTMLElement>>;\n /** Sheet title / list name when `label` isn't plain text. */\n title?: string;\n /** Shows a clear action (popover footer and sheet footer). */\n onClear?: () => void;\n clearLabel?: string;\n /**\n * How the popover's clear looks: a small link (default), or a quiet\n * full-width button with an ✕, e.g. to match a neighbouring picker.\n */\n clearVariant?: \"link\" | \"button\";\n size?: \"xs\" | \"sm\" | \"md\";\n align?: \"start\" | \"center\" | \"end\";\n className?: string;\n contentClassName?: string;\n};\n\n/** Simple filters: options in, selected values out. */\ntype FilterMenuOptionsProps = FilterMenuCommon & {\n options: FilterMenuOption[];\n /** The selected option values. */\n value: string[];\n onValueChange: (value: string[]) => void;\n items?: never;\n};\n\n/** Lists with their own rules (groups, indents): the rows themselves. */\ntype FilterMenuItemsProps = FilterMenuCommon & {\n items: CheckboxListItem[];\n options?: never;\n value?: never;\n onValueChange?: never;\n};\n\nexport type FilterMenuProps = FilterMenuOptionsProps | FilterMenuItemsProps;\n\n/**\n * A checklist behind a trigger: a dropdown on desktop and a bottom sheet\n * (with Clear and Done) on phones. Each tick applies immediately.\n *\n * Feed it either `options` + `value` + `onValueChange` (simple filters; the\n * default trigger is a FilterChip showing the count in the selected,\n * secondary style), or ready-made `items` with your own `trigger`.\n */\nexport function FilterMenu(props: FilterMenuProps) {\n const {\n label,\n trigger: customTrigger,\n title: titleProp,\n onClear,\n clearLabel = \"Clear\",\n clearVariant = \"link\",\n size = \"sm\",\n align = \"start\",\n className,\n contentClassName,\n } = props;\n const isMobile = useMobile();\n const [open, setOpen] = React.useState(false);\n const closeRef = React.useRef<HTMLButtonElement>(null);\n\n // Both ways in become the same rows.\n const items: CheckboxListItem[] =\n props.items ??\n props.options.map((option) => ({\n label: option.label,\n checked: props.value.includes(option.value),\n onCheckedChange: (on) =>\n props.onValueChange(\n on\n ? [...props.value, option.value]\n : props.value.filter((item) => item !== option.value),\n ),\n }));\n const count = props.items\n ? props.items.filter((item) => item.checked).length\n : props.value.length;\n const title = titleProp ?? (typeof label === \"string\" ? label : \"Filter\");\n // The sheet always offers Clear while something's on; the popover only\n // when the caller asks for it.\n const clearInSheet =\n onClear ??\n (!props.items && count > 0 ? () => props.onValueChange([]) : undefined);\n\n const triggerProps = {\n \"aria-haspopup\": \"dialog\" as const,\n \"aria-expanded\": open,\n onClick: isMobile ? () => setOpen(true) : undefined,\n };\n const trigger = customTrigger ? (\n React.cloneElement(customTrigger, {\n ...triggerProps,\n onClick: (event: React.MouseEvent<HTMLElement>) => {\n customTrigger.props.onClick?.(event);\n triggerProps.onClick?.();\n },\n })\n ) : (\n <FilterChip\n size={size}\n selected={count > 0}\n count={count || undefined}\n className={className}\n {...triggerProps}\n >\n {label}\n <ChevronDown size={14} aria-hidden=\"true\" className=\"-mr-1\" />\n </FilterChip>\n );\n\n const list = <CheckboxList aria-label={title} items={items} />;\n\n // Phones: a bottom sheet, like Autocomplete and Select.\n if (isMobile)\n return (\n <>\n {trigger}\n <Sheet open={open} onOpenChange={setOpen}>\n <SheetContent\n side=\"bottom\"\n showCloseButton={false}\n overlayClassName=\"z-(--z-popover-overlay) bg-black/25 backdrop-blur-[1px]\"\n aria-describedby={undefined}\n onOpenAutoFocus={(event) => {\n event.preventDefault();\n closeRef.current?.focus();\n }}\n className=\"z-(--z-popover) flex flex-col gap-0 p-0 pb-[max(0.75rem,env(safe-area-inset-bottom))]\"\n >\n <div className=\"flex shrink-0 items-center justify-between gap-4 px-4 pb-1 pt-4\">\n <SheetTitle className=\"text-base font-semibold text-foreground\">\n {title}\n </SheetTitle>\n <button\n ref={closeRef}\n type=\"button\"\n aria-label=\"Close\"\n className=\"-mr-3 flex h-11 w-11 shrink-0 cursor-pointer items-center justify-center rounded-control-lg text-muted-foreground hover:bg-muted\"\n onClick={() => setOpen(false)}\n >\n <X className=\"h-5 w-5\" aria-hidden=\"true\" />\n </button>\n </div>\n <div className=\"min-h-0 flex-1 overflow-y-auto overscroll-contain px-2\">\n {list}\n </div>\n <div className=\"flex shrink-0 gap-2 border-t border-border px-4 pt-3\">\n {clearInSheet && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n scheme=\"neutral\"\n className=\"flex-1\"\n onClick={clearInSheet}\n >\n {clearLabel}\n </Button>\n )}\n {/* Outline, like Autocomplete's: ticks already applied, so\n Done only closes the sheet. */}\n <Button\n type=\"button\"\n variant=\"outline\"\n className=\"flex-1\"\n onClick={() => setOpen(false)}\n >\n Done\n </Button>\n </div>\n </SheetContent>\n </Sheet>\n </>\n );\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>{trigger}</PopoverTrigger>\n <PopoverContent\n align={align}\n className={cn(\"w-56 p-0\", contentClassName)}\n >\n {list}\n {onClear && (\n <div className=\"border-t border-border p-option-inset\">\n {clearVariant === \"button\" ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n scheme=\"neutral\"\n size=\"sm\"\n className=\"w-full\"\n onClick={onClear}\n >\n <X size={16} aria-hidden=\"true\" />\n {clearLabel}\n </Button>\n ) : (\n <Button\n type=\"button\"\n variant=\"link\"\n scheme=\"primary\"\n size=\"xs\"\n onClick={onClear}\n >\n {clearLabel}\n </Button>\n )}\n </div>\n )}\n </PopoverContent>\n </Popover>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAaA;;;;;AAKG;AAEH;AACO;AAEP;AACO;AAcP;AACM;;AAqCN;AA4CA;;;;;;;AAOG;AACG;AACJ;AAYA;AACA;;;AAIA;;;;;;AASU;AAEP;AACH;AACE;AACA;AACF;;;;;AAOA;AACE;AACA;AACA;;AAEF;AAEI;AACA;;AAEE;;;;;AAmBN;AACE;;AAWU;AACF;AAgDV;AAsCF;;"}
|
|
1
|
+
{"version":3,"file":"option-list.js","sources":["../../src/components/option-list.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { ChevronDown, X } from \"lucide-react\";\r\n\r\nimport { cn } from \"@/utils\";\r\nimport { useMobile } from \"@/hooks/use-mobile\";\r\nimport { Button } from \"./button\";\r\nimport { Checkbox } from \"./checkbox\";\r\nimport { FilterChip } from \"./filter-chip\";\r\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\r\nimport { Sheet, SheetContent, SheetTitle } from \"./sheet\";\r\n\r\n/*\r\n * The shared look for every list of options (menus, selects, dropdowns,\r\n * autocomplete, filter menus): the list is inset from its container's edge,\r\n * and each row is its own rounded box with a little space between rows, so\r\n * hover and selection read as distinct pills rather than full-bleed stripes.\r\n */\r\n\r\n/** Padding + row gap for a list of options inside a popover or sheet. */\r\nexport const optionListClassName = \"flex flex-col gap-option-gap p-option-inset\";\r\n\r\n/** One option row. Pair with a hover/focus or selected state as needed. */\r\nexport const optionRowClassName =\r\n \"relative flex min-h-option-row w-full cursor-pointer select-none items-center gap-3 rounded-control-sm px-option-x py-2 text-left text-sm text-foreground outline-none transition-colors duration-state hover:bg-muted focus-visible:bg-muted motion-reduce:transition-none max-md:min-h-11\";\r\n\r\nexport type CheckboxListItem = {\r\n label: React.ReactNode;\r\n checked: boolean;\r\n onCheckedChange: (checked: boolean) => void;\r\n /** Indents the row under a group heading row. */\r\n indent?: boolean;\r\n /** Bolder label, e.g. a group's \"All …\" row. */\r\n strong?: boolean;\r\n disabled?: boolean;\r\n};\r\n\r\n/** A list of checkbox rows in the shared option style. */\r\nexport function CheckboxList({\r\n items,\r\n className,\r\n \"aria-label\": label,\r\n}: {\r\n items: CheckboxListItem[];\r\n className?: string;\r\n \"aria-label\"?: string;\r\n}) {\r\n return (\r\n <ul\r\n aria-label={label}\r\n className={cn(\"m-0 list-none\", optionListClassName, className)}\r\n >\r\n {items.map((item, index) => (\r\n <li key={index}>\r\n <label\r\n className={cn(\r\n optionRowClassName,\r\n item.indent && \"pl-8\",\r\n item.strong && \"font-medium\",\r\n item.disabled && \"pointer-events-none opacity-50\",\r\n )}\r\n >\r\n <Checkbox\r\n checked={item.checked}\r\n disabled={item.disabled}\r\n onCheckedChange={(checked) =>\r\n item.onCheckedChange(checked === true)\r\n }\r\n />\r\n <span className=\"min-w-0 flex-1\">{item.label}</span>\r\n </label>\r\n </li>\r\n ))}\r\n </ul>\r\n );\r\n}\r\n\r\nexport type FilterMenuOption = { label: React.ReactNode; value: string };\r\n\r\ntype FilterMenuCommon = {\r\n /** The chip's label (and the sheet title when it's text). */\r\n label?: React.ReactNode;\r\n /** Replaces the default chip, e.g. a labelled field button. */\r\n trigger?: React.ReactElement<React.HTMLAttributes<HTMLElement>>;\r\n /** Sheet title / list name when `label` isn't plain text. */\r\n title?: string;\r\n /** Shows a clear action (popover footer and sheet footer). */\r\n onClear?: () => void;\r\n clearLabel?: string;\r\n /**\r\n * How the popover's clear looks: a small link (default), or a quiet\r\n * full-width button with an ✕, e.g. to match a neighbouring picker.\r\n */\r\n clearVariant?: \"link\" | \"button\";\r\n size?: \"xs\" | \"sm\" | \"md\";\r\n align?: \"start\" | \"center\" | \"end\";\r\n className?: string;\r\n contentClassName?: string;\r\n};\r\n\r\n/** Simple filters: options in, selected values out. */\r\ntype FilterMenuOptionsProps = FilterMenuCommon & {\r\n options: FilterMenuOption[];\r\n /** The selected option values. */\r\n value: string[];\r\n onValueChange: (value: string[]) => void;\r\n items?: never;\r\n};\r\n\r\n/** Lists with their own rules (groups, indents): the rows themselves. */\r\ntype FilterMenuItemsProps = FilterMenuCommon & {\r\n items: CheckboxListItem[];\r\n options?: never;\r\n value?: never;\r\n onValueChange?: never;\r\n};\r\n\r\nexport type FilterMenuProps = FilterMenuOptionsProps | FilterMenuItemsProps;\r\n\r\n/**\r\n * A checklist behind a trigger: a dropdown on desktop and a bottom sheet\r\n * (with Clear and Done) on phones. Each tick applies immediately.\r\n *\r\n * Feed it either `options` + `value` + `onValueChange` (simple filters; the\r\n * default trigger is a FilterChip showing the count in the selected,\r\n * secondary style), or ready-made `items` with your own `trigger`.\r\n */\r\nexport function FilterMenu(props: FilterMenuProps) {\r\n const {\r\n label,\r\n trigger: customTrigger,\r\n title: titleProp,\r\n onClear,\r\n clearLabel = \"Clear\",\r\n clearVariant = \"link\",\r\n size = \"sm\",\r\n align = \"start\",\r\n className,\r\n contentClassName,\r\n } = props;\r\n const isMobile = useMobile();\r\n const [open, setOpen] = React.useState(false);\r\n const closeRef = React.useRef<HTMLButtonElement>(null);\r\n\r\n // Both ways in become the same rows.\r\n const items: CheckboxListItem[] =\r\n props.items ??\r\n props.options.map((option) => ({\r\n label: option.label,\r\n checked: props.value.includes(option.value),\r\n onCheckedChange: (on) =>\r\n props.onValueChange(\r\n on\r\n ? [...props.value, option.value]\r\n : props.value.filter((item) => item !== option.value),\r\n ),\r\n }));\r\n const count = props.items\r\n ? props.items.filter((item) => item.checked).length\r\n : props.value.length;\r\n const title = titleProp ?? (typeof label === \"string\" ? label : \"Filter\");\r\n // The sheet always offers Clear while something's on; the popover only\r\n // when the caller asks for it.\r\n const clearInSheet =\r\n onClear ??\r\n (!props.items && count > 0 ? () => props.onValueChange([]) : undefined);\r\n\r\n const triggerProps = {\r\n \"aria-haspopup\": \"dialog\" as const,\r\n \"aria-expanded\": open,\r\n onClick: isMobile ? () => setOpen(true) : undefined,\r\n };\r\n const trigger = customTrigger ? (\r\n React.cloneElement(customTrigger, {\r\n ...triggerProps,\r\n onClick: (event: React.MouseEvent<HTMLElement>) => {\r\n customTrigger.props.onClick?.(event);\r\n triggerProps.onClick?.();\r\n },\r\n })\r\n ) : (\r\n <FilterChip\r\n size={size}\r\n selected={count > 0}\r\n count={count || undefined}\r\n className={className}\r\n {...triggerProps}\r\n >\r\n {label}\r\n <ChevronDown size={14} aria-hidden=\"true\" className=\"-mr-1\" />\r\n </FilterChip>\r\n );\r\n\r\n const list = <CheckboxList aria-label={title} items={items} />;\r\n\r\n // Phones: a bottom sheet, like Autocomplete and Select.\r\n if (isMobile)\r\n return (\r\n <>\r\n {trigger}\r\n <Sheet open={open} onOpenChange={setOpen}>\r\n <SheetContent\r\n side=\"bottom\"\r\n showCloseButton={false}\r\n overlayClassName=\"z-(--z-popover-overlay) bg-black/25 backdrop-blur-[1px]\"\r\n aria-describedby={undefined}\r\n onOpenAutoFocus={(event) => {\r\n event.preventDefault();\r\n closeRef.current?.focus();\r\n }}\r\n className=\"z-(--z-popover) flex flex-col gap-0 p-0 pb-[max(0.75rem,env(safe-area-inset-bottom))]\"\r\n >\r\n <div className=\"flex shrink-0 items-center justify-between gap-4 px-4 pb-1 pt-4\">\r\n <SheetTitle className=\"text-base font-semibold text-foreground\">\r\n {title}\r\n </SheetTitle>\r\n <button\r\n ref={closeRef}\r\n type=\"button\"\r\n aria-label=\"Close\"\r\n className=\"-mr-3 flex h-11 w-11 shrink-0 cursor-pointer items-center justify-center rounded-control-lg text-muted-foreground hover:bg-muted\"\r\n onClick={() => setOpen(false)}\r\n >\r\n <X className=\"h-5 w-5\" aria-hidden=\"true\" />\r\n </button>\r\n </div>\r\n <div className=\"min-h-0 flex-1 overflow-y-auto overscroll-contain px-2\">\r\n {list}\r\n </div>\r\n <div className=\"flex shrink-0 gap-2 border-t border-border px-4 pt-3\">\r\n {clearInSheet && (\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n scheme=\"neutral\"\r\n className=\"flex-1\"\r\n onClick={clearInSheet}\r\n >\r\n {clearLabel}\r\n </Button>\r\n )}\r\n {/* Outline, like Autocomplete's: ticks already applied, so\r\n Done only closes the sheet. */}\r\n <Button\r\n type=\"button\"\r\n variant=\"outline\"\r\n className=\"flex-1\"\r\n onClick={() => setOpen(false)}\r\n >\r\n Done\r\n </Button>\r\n </div>\r\n </SheetContent>\r\n </Sheet>\r\n </>\r\n );\r\n\r\n return (\r\n <Popover open={open} onOpenChange={setOpen}>\r\n <PopoverTrigger asChild>{trigger}</PopoverTrigger>\r\n <PopoverContent\r\n align={align}\r\n className={cn(\"w-56 p-0\", contentClassName)}\r\n >\r\n {list}\r\n {onClear && (\r\n <div className=\"border-t border-border p-option-inset\">\r\n {clearVariant === \"button\" ? (\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n scheme=\"neutral\"\r\n size=\"sm\"\r\n className=\"w-full\"\r\n onClick={onClear}\r\n >\r\n <X size={16} aria-hidden=\"true\" />\r\n {clearLabel}\r\n </Button>\r\n ) : (\r\n <Button\r\n type=\"button\"\r\n variant=\"link\"\r\n scheme=\"primary\"\r\n size=\"xs\"\r\n onClick={onClear}\r\n >\r\n {clearLabel}\r\n </Button>\r\n )}\r\n </div>\r\n )}\r\n </PopoverContent>\r\n </Popover>\r\n );\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;;;;AAaA;;;;;AAKG;AAEH;AACO;AAEP;AACO;AAcP;AACM;;AAqCN;AA4CA;;;;;;;AAOG;AACG;AACJ;AAYA;AACA;;;AAIA;;;;;;AASU;AAEP;AACH;AACE;AACA;AACF;;;;;AAOA;AACE;AACA;AACA;;AAEF;AAEI;AACA;;AAEE;;;;;AAmBN;AACE;;AAWU;AACF;AAgDV;AAsCF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-header.js","sources":["../../src/components/page-header.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '@/utils';\n\n\nexport function PageHeader({\n title,\n description,\n animated = false,\n className,\n}: {\n title: string;\n description?: React.ReactNode;\n /**\n * Fades the header up into place when it mounts (skipped under reduced\n * motion). Give the header a new `key` to play it again, e.g. on tab change.\n * Leave it off in loading skeletons so the effect plays once, on the page.\n */\n animated?: boolean;\n className?: string;\n}) {\n return (\n <header\n className={cn(\n 'text-foreground',\n animated && 'motion-safe:animate-page-enter',\n className,\n )}\n >\n <h1 className=\"text-page-heading font-page-heading\">\n {title}\n </h1>\n {description && (\n <p className=\"mt-page-description-gap max-w-page-description text-muted-foreground text-base leading-page-description\">{description}</p>\n )}\n </header>\n );\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;AAIM,SAAU,UAAU,CAAC,EACzB,KAAK,EACL,WAAW,EACX,QAAQ,GAAG,KAAK,EAChB,SAAS,GAWV,EAAA;AACC,IAAA,QACEA,IAAA,CAAA,QAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,iBAAiB,EACjB,QAAQ,IAAI,gCAAgC,EAC5C,SAAS,CACV,EAAA,QAAA,EAAA,CAECC,YAAI,SAAS,EAAC,qCAAqC,EAAA,QAAA,EAChD,KAAK,EAAA,CACH,EACJ,WAAW,KACVA,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,yGAAyG,YAAE,WAAW,EAAA,CAAK,CACzI,CAAA,EAAA,CACI;AAEb;;;;"}
|
|
1
|
+
{"version":3,"file":"page-header.js","sources":["../../src/components/page-header.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport { cn } from '@/utils';\r\n\r\n\r\nexport function PageHeader({\r\n title,\r\n description,\r\n animated = false,\r\n className,\r\n}: {\r\n title: string;\r\n description?: React.ReactNode;\r\n /**\r\n * Fades the header up into place when it mounts (skipped under reduced\r\n * motion). Give the header a new `key` to play it again, e.g. on tab change.\r\n * Leave it off in loading skeletons so the effect plays once, on the page.\r\n */\r\n animated?: boolean;\r\n className?: string;\r\n}) {\r\n return (\r\n <header\r\n className={cn(\r\n 'text-foreground',\r\n animated && 'motion-safe:animate-page-enter',\r\n className,\r\n )}\r\n >\r\n <h1 className=\"text-page-heading font-page-heading\">\r\n {title}\r\n </h1>\r\n {description && (\r\n <p className=\"mt-page-description-gap max-w-page-description text-muted-foreground text-base leading-page-description\">{description}</p>\r\n )}\r\n </header>\r\n );\r\n}\r\n"],"names":["_jsxs","_jsx"],"mappings":";;;AAIM,SAAU,UAAU,CAAC,EACzB,KAAK,EACL,WAAW,EACX,QAAQ,GAAG,KAAK,EAChB,SAAS,GAWV,EAAA;AACC,IAAA,QACEA,IAAA,CAAA,QAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,iBAAiB,EACjB,QAAQ,IAAI,gCAAgC,EAC5C,SAAS,CACV,EAAA,QAAA,EAAA,CAECC,YAAI,SAAS,EAAC,qCAAqC,EAAA,QAAA,EAChD,KAAK,EAAA,CACH,EACJ,WAAW,KACVA,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,yGAAyG,YAAE,WAAW,EAAA,CAAK,CACzI,CAAA,EAAA,CACI;AAEb;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginator.js","sources":["../../src/components/paginator.tsx"],"sourcesContent":["'use client';\n\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\nimport React, { useState } from \"react\";\nimport { Button } from \"./button\";\n\ninterface PaginatorProps {\n totalItems: number;\n itemsPerPage: number;\n currentPage?: number;\n onPageChange?: (page: number) => void;\n}\n\nexport const Paginator: React.FC<PaginatorProps> = ({\n totalItems,\n itemsPerPage,\n currentPage: controlledPage,\n onPageChange,\n}) => {\n const [internalPage, setInternalPage] = useState(1);\n const isControlled = controlledPage !== undefined;\n const currentPage = isControlled ? controlledPage : internalPage;\n const totalPages = Math.ceil(totalItems / itemsPerPage);\n\n const goToPage = (page: number) => {\n const clamped = Math.max(1, Math.min(page, totalPages));\n if (!isControlled) setInternalPage(clamped);\n if (onPageChange) onPageChange(clamped);\n };\n\n const getDisplayedPages = () => {\n const pages = [];\n\n // Always show first page\n pages.push(1);\n\n const left = Math.max(2, currentPage - 1);\n const right = Math.min(totalPages - 1, currentPage + 1);\n\n if (left > 2) {\n pages.push(\"ellipsis-left\");\n }\n\n for (let i = left; i <= right; i++) {\n pages.push(i);\n }\n\n if (right < totalPages - 1) {\n pages.push(\"ellipsis-right\");\n }\n\n // Always show last page if more than one\n if (totalPages > 1) {\n pages.push(totalPages);\n }\n\n return pages;\n };\n\n return (\n <div className=\"flex justify-center items-center space-x-2 mt-4\">\n <Button\n variant={\"ghost\"}\n iconOnly\n aria-label=\"Previous page\"\n onClick={() => goToPage(currentPage - 1)}\n disabled={currentPage === 1}\n >\n <ChevronLeft></ChevronLeft>\n </Button>\n\n {getDisplayedPages().map((page, idx) =>\n typeof page === \"number\" ? (\n <Button\n key={idx}\n variant={currentPage === page ? \"solid\" : \"ghost\"}\n className=\"size-11 p-0\"\n onClick={() => goToPage(page)}\n >\n {page}\n </Button>\n ) : (\n <span key={idx} className=\"px-2 text-muted-foreground\">\n …\n </span>\n ),\n )}\n\n <Button\n variant={\"ghost\"}\n iconOnly\n aria-label=\"Next page\"\n onClick={() => goToPage(currentPage + 1)}\n disabled={currentPage === totalPages}\n >\n <ChevronRight></ChevronRight>\n </Button>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;AAaO;;AAOL;;;AAIA;AACE;AACA;;AACA;;AACF;;;;AAME;AAEA;AACA;AAEA;AACE;;AAGF;AACE;;AAGF;AACE;;;AAIF;AACE;;AAGF;AACF;AAEA;AAwCF;;"}
|
|
1
|
+
{"version":3,"file":"paginator.js","sources":["../../src/components/paginator.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\r\nimport React, { useState } from \"react\";\r\nimport { Button } from \"./button\";\r\n\r\ninterface PaginatorProps {\r\n totalItems: number;\r\n itemsPerPage: number;\r\n currentPage?: number;\r\n onPageChange?: (page: number) => void;\r\n}\r\n\r\nexport const Paginator: React.FC<PaginatorProps> = ({\r\n totalItems,\r\n itemsPerPage,\r\n currentPage: controlledPage,\r\n onPageChange,\r\n}) => {\r\n const [internalPage, setInternalPage] = useState(1);\r\n const isControlled = controlledPage !== undefined;\r\n const currentPage = isControlled ? controlledPage : internalPage;\r\n const totalPages = Math.ceil(totalItems / itemsPerPage);\r\n\r\n const goToPage = (page: number) => {\r\n const clamped = Math.max(1, Math.min(page, totalPages));\r\n if (!isControlled) setInternalPage(clamped);\r\n if (onPageChange) onPageChange(clamped);\r\n };\r\n\r\n const getDisplayedPages = () => {\r\n const pages = [];\r\n\r\n // Always show first page\r\n pages.push(1);\r\n\r\n const left = Math.max(2, currentPage - 1);\r\n const right = Math.min(totalPages - 1, currentPage + 1);\r\n\r\n if (left > 2) {\r\n pages.push(\"ellipsis-left\");\r\n }\r\n\r\n for (let i = left; i <= right; i++) {\r\n pages.push(i);\r\n }\r\n\r\n if (right < totalPages - 1) {\r\n pages.push(\"ellipsis-right\");\r\n }\r\n\r\n // Always show last page if more than one\r\n if (totalPages > 1) {\r\n pages.push(totalPages);\r\n }\r\n\r\n return pages;\r\n };\r\n\r\n return (\r\n <div className=\"flex justify-center items-center space-x-2 mt-4\">\r\n <Button\r\n variant={\"ghost\"}\r\n iconOnly\r\n aria-label=\"Previous page\"\r\n onClick={() => goToPage(currentPage - 1)}\r\n disabled={currentPage === 1}\r\n >\r\n <ChevronLeft></ChevronLeft>\r\n </Button>\r\n\r\n {getDisplayedPages().map((page, idx) =>\r\n typeof page === \"number\" ? (\r\n <Button\r\n key={idx}\r\n variant={currentPage === page ? \"solid\" : \"ghost\"}\r\n className=\"size-11 p-0\"\r\n onClick={() => goToPage(page)}\r\n >\r\n {page}\r\n </Button>\r\n ) : (\r\n <span key={idx} className=\"px-2 text-muted-foreground\">\r\n …\r\n </span>\r\n ),\r\n )}\r\n\r\n <Button\r\n variant={\"ghost\"}\r\n iconOnly\r\n aria-label=\"Next page\"\r\n onClick={() => goToPage(currentPage + 1)}\r\n disabled={currentPage === totalPages}\r\n >\r\n <ChevronRight></ChevronRight>\r\n </Button>\r\n </div>\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;;;AAaO;;AAOL;;;AAIA;AACE;AACA;;AACA;;AACF;;;;AAME;AAEA;AACA;AAEA;AACE;;AAGF;AACE;;AAGF;AACE;;;AAIF;AACE;;AAGF;AACF;AAEA;AAwCF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","sources":["../../src/components/popover.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nimport { cn } from '@/utils';\n\nfunction Popover({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\n}\n\nconst PopoverTrigger = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Trigger>\n>(({ className, ...props }, ref) => (\n <PopoverPrimitive.Trigger\n ref={ref}\n className={className}\n data-slot=\"popover-trigger\"\n {...props}\n />\n));\nPopoverTrigger.displayName = PopoverPrimitive.Trigger.displayName;\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n data-slot=\"popover-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n 'bg-popover text-popover-foreground data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-(--z-popover) w-72 origin-(--radix-popover-content-transform-origin) rounded-card border border-border p-4 shadow-card outline-hidden',\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n));\nPopoverContent.displayName = PopoverPrimitive.Content.displayName;\n\nconst PopoverAnchor = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Anchor>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Anchor>\n>(({ className, ...props }, ref) => (\n <PopoverPrimitive.Anchor\n ref={ref}\n data-slot=\"popover-anchor\"\n className={className}\n {...props}\n />\n));\nPopoverAnchor.displayName = PopoverPrimitive.Anchor.displayName;\n\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };\n"],"names":["_jsx"],"mappings":";;;;;AAKA,SAAS,OAAO,CAAC,EACf,GAAG,KAAK,EAC2C,EAAA;IACnD,OAAOA,GAAA,CAAC,gBAAgB,CAAC,IAAI,iBAAW,SAAS,EAAA,GAAK,KAAK,EAAA,CAAI;AACjE;AAEA,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAGrC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAC7BA,GAAA,CAAC,gBAAgB,CAAC,OAAO,EAAA,EACvB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,eACV,iBAAiB,EAAA,GACvB,KAAK,EAAA,CACT,CACH;AACD,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,WAAW;AAEjE,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAGrC,CAAC,EAAE,SAAS,EAAE,KAAK,GAAG,QAAQ,EAAE,UAAU,GAAG,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAC/DA,GAAA,CAAC,gBAAgB,CAAC,MAAM,EAAA,EAAA,QAAA,EACtBA,GAAA,CAAC,gBAAgB,CAAC,OAAO,EAAA,EACvB,GAAG,EAAE,GAAG,EAAA,WAAA,EACE,iBAAiB,EAC3B,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,EAAE,CACX,whBAAwhB,EACxhB,SAAS,CACV,EAAA,GACG,KAAK,EAAA,CACT,EAAA,CACsB,CAC3B;AACD,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,WAAW;AAEjE,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAGpC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAC7BA,GAAA,CAAC,gBAAgB,CAAC,MAAM,EAAA,EACtB,GAAG,EAAE,GAAG,EAAA,WAAA,EACE,gBAAgB,EAC1B,SAAS,EAAE,SAAS,EAAA,GAChB,KAAK,EAAA,CACT,CACH;AACD,aAAa,CAAC,WAAW,GAAG,gBAAgB,CAAC,MAAM,CAAC,WAAW;;;;"}
|
|
1
|
+
{"version":3,"file":"popover.js","sources":["../../src/components/popover.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\r\n\r\nimport { cn } from '@/utils';\r\n\r\nfunction Popover({\r\n ...props\r\n}: React.ComponentProps<typeof PopoverPrimitive.Root>) {\r\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\r\n}\r\n\r\nconst PopoverTrigger = React.forwardRef<\r\n React.ElementRef<typeof PopoverPrimitive.Trigger>,\r\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Trigger>\r\n>(({ className, ...props }, ref) => (\r\n <PopoverPrimitive.Trigger\r\n ref={ref}\r\n className={className}\r\n data-slot=\"popover-trigger\"\r\n {...props}\r\n />\r\n));\r\nPopoverTrigger.displayName = PopoverPrimitive.Trigger.displayName;\r\n\r\nconst PopoverContent = React.forwardRef<\r\n React.ElementRef<typeof PopoverPrimitive.Content>,\r\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\r\n>(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (\r\n <PopoverPrimitive.Portal>\r\n <PopoverPrimitive.Content\r\n ref={ref}\r\n data-slot=\"popover-content\"\r\n align={align}\r\n sideOffset={sideOffset}\r\n className={cn(\r\n 'bg-popover text-popover-foreground data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-(--z-popover) w-72 origin-(--radix-popover-content-transform-origin) rounded-card border border-border p-4 shadow-card outline-hidden',\r\n className,\r\n )}\r\n {...props}\r\n />\r\n </PopoverPrimitive.Portal>\r\n));\r\nPopoverContent.displayName = PopoverPrimitive.Content.displayName;\r\n\r\nconst PopoverAnchor = React.forwardRef<\r\n React.ElementRef<typeof PopoverPrimitive.Anchor>,\r\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Anchor>\r\n>(({ className, ...props }, ref) => (\r\n <PopoverPrimitive.Anchor\r\n ref={ref}\r\n data-slot=\"popover-anchor\"\r\n className={className}\r\n {...props}\r\n />\r\n));\r\nPopoverAnchor.displayName = PopoverPrimitive.Anchor.displayName;\r\n\r\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };\r\n"],"names":["_jsx"],"mappings":";;;;;AAKA,SAAS,OAAO,CAAC,EACf,GAAG,KAAK,EAC2C,EAAA;IACnD,OAAOA,GAAA,CAAC,gBAAgB,CAAC,IAAI,iBAAW,SAAS,EAAA,GAAK,KAAK,EAAA,CAAI;AACjE;AAEA,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAGrC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAC7BA,GAAA,CAAC,gBAAgB,CAAC,OAAO,EAAA,EACvB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,eACV,iBAAiB,EAAA,GACvB,KAAK,EAAA,CACT,CACH;AACD,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,WAAW;AAEjE,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAGrC,CAAC,EAAE,SAAS,EAAE,KAAK,GAAG,QAAQ,EAAE,UAAU,GAAG,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAC/DA,GAAA,CAAC,gBAAgB,CAAC,MAAM,EAAA,EAAA,QAAA,EACtBA,GAAA,CAAC,gBAAgB,CAAC,OAAO,EAAA,EACvB,GAAG,EAAE,GAAG,EAAA,WAAA,EACE,iBAAiB,EAC3B,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,EAAE,CACX,whBAAwhB,EACxhB,SAAS,CACV,EAAA,GACG,KAAK,EAAA,CACT,EAAA,CACsB,CAC3B;AACD,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,WAAW;AAEjE,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAGpC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAC7BA,GAAA,CAAC,gBAAgB,CAAC,MAAM,EAAA,EACtB,GAAG,EAAE,GAAG,EAAA,WAAA,EACE,gBAAgB,EAC1B,SAAS,EAAE,SAAS,EAAA,GAChB,KAAK,EAAA,CACT,CACH;AACD,aAAa,CAAC,WAAW,GAAG,gBAAgB,CAAC,MAAM,CAAC,WAAW;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.js","sources":["../../src/components/progress.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as ProgressPrimitive from \"@radix-ui/react-progress\";\n\nimport { cn } from \"@/utils\";\n\nconst Progress = React.forwardRef<\n React.ElementRef<typeof ProgressPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>\n>(({ className, value, ...props }, ref) => (\n <ProgressPrimitive.Root\n ref={ref}\n className={cn(\n \"relative h-2 w-full overflow-hidden rounded-pill bg-muted\",\n className,\n )}\n value={value}\n {...props}\n >\n <ProgressPrimitive.Indicator\n className=\"h-full rounded-pill bg-primary transition-[width] duration-state ease-landing-out motion-reduce:transition-none\"\n style={{ width: `${Math.max(0, Math.min(100, ((value ?? 0) / (props.max ?? 100)) * 100))}%` }}\n />\n </ProgressPrimitive.Root>\n));\nProgress.displayName = ProgressPrimitive.Root.displayName;\n\nexport { Progress };\n"],"names":[],"mappings":";;;;;;AAOA;AAmBA;;"}
|
|
1
|
+
{"version":3,"file":"progress.js","sources":["../../src/components/progress.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport * as ProgressPrimitive from \"@radix-ui/react-progress\";\r\n\r\nimport { cn } from \"@/utils\";\r\n\r\nconst Progress = React.forwardRef<\r\n React.ElementRef<typeof ProgressPrimitive.Root>,\r\n React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>\r\n>(({ className, value, ...props }, ref) => (\r\n <ProgressPrimitive.Root\r\n ref={ref}\r\n className={cn(\r\n \"relative h-2 w-full overflow-hidden rounded-pill bg-muted\",\r\n className,\r\n )}\r\n value={value}\r\n {...props}\r\n >\r\n <ProgressPrimitive.Indicator\r\n className=\"h-full rounded-pill bg-primary transition-[width] duration-state ease-landing-out motion-reduce:transition-none\"\r\n style={{ width: `${Math.max(0, Math.min(100, ((value ?? 0) / (props.max ?? 100)) * 100))}%` }}\r\n />\r\n </ProgressPrimitive.Root>\r\n));\r\nProgress.displayName = ProgressPrimitive.Root.displayName;\r\n\r\nexport { Progress };\r\n"],"names":[],"mappings":";;;;;;AAOA;AAmBA;;"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
3
3
|
declare const RadioGroup: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
/**
|
|
5
|
+
* The radio circle shared by RadioGroup and ChipSelect: one fixed SVG whose
|
|
6
|
+
* colours change with the state, so nothing shifts when it is selected.
|
|
7
|
+
* Pass `checked`, or leave it out inside a `group` element with
|
|
8
|
+
* `data-state="checked"` (as a RadioGroupItem is).
|
|
9
|
+
*/
|
|
10
|
+
declare function RadioVisual({ checked, className }: {
|
|
11
|
+
checked?: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
4
14
|
declare const RadioGroupItem: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
-
export { RadioGroup, RadioGroupItem };
|
|
15
|
+
export { RadioGroup, RadioGroupItem, RadioVisual };
|
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
5
5
|
import { cn } from '../utils.js';
|
|
6
|
+
import { useFormFieldControl } from './form-field.js';
|
|
6
7
|
|
|
7
|
-
const RadioGroup = React.forwardRef(({ className, ...
|
|
8
|
+
const RadioGroup = React.forwardRef(({ className, ...ownProps }, ref) => {
|
|
9
|
+
// Inside a FormField the field's label names the whole group.
|
|
10
|
+
const props = useFormFieldControl(ownProps, "group");
|
|
8
11
|
return (jsx(RadioGroupPrimitive.Root, { className: cn("grid gap-2", className), ...props, ref: ref }));
|
|
9
12
|
});
|
|
10
13
|
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
14
|
+
/**
|
|
15
|
+
* The radio circle shared by RadioGroup and ChipSelect: one fixed SVG whose
|
|
16
|
+
* colours change with the state, so nothing shifts when it is selected.
|
|
17
|
+
* Pass `checked`, or leave it out inside a `group` element with
|
|
18
|
+
* `data-state="checked"` (as a RadioGroupItem is).
|
|
19
|
+
*/
|
|
20
|
+
function RadioVisual({ checked, className }) {
|
|
21
|
+
const state = checked === undefined ? undefined : checked ? "checked" : "unchecked";
|
|
22
|
+
return (jsxs("svg", { "aria-hidden": "true", "data-state": state, viewBox: "0 0 16 16", className: cn("group/radio size-4 shrink-0", className), children: [jsx("circle", { cx: "8", cy: "8", r: "7", strokeWidth: "1", className: cn("fill-muted stroke-input transition-colors duration-state motion-reduce:transition-none", "group-data-[state=checked]/radio:fill-primary group-data-[state=checked]/radio:stroke-primary", checked === undefined && "group-data-[state=checked]:fill-primary group-data-[state=checked]:stroke-primary group-hover:stroke-primary") }), jsx("circle", { cx: "8", cy: "8", r: "4", className: cn("fill-background opacity-0", "group-data-[state=checked]/radio:opacity-100", checked === undefined && "group-data-[state=checked]:opacity-100") })] }));
|
|
23
|
+
}
|
|
11
24
|
const RadioGroupItem = React.forwardRef(({ className, ...props }, ref) => {
|
|
12
|
-
return (jsx(RadioGroupPrimitive.Item, { ref: ref, className: cn("relative aspect-square
|
|
25
|
+
return (jsx(RadioGroupPrimitive.Item, { ref: ref, className: cn("group relative aspect-square size-4 shrink-0 rounded-full focus:outline-none focus-visible:outline-3 focus-visible:outline-offset-4 focus-visible:outline-landing-blue disabled:cursor-not-allowed disabled:opacity-50 after:absolute after:-inset-3 after:content-['']", className), ...props, children: jsx(RadioVisual, {}) }));
|
|
13
26
|
});
|
|
14
27
|
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
15
28
|
|
|
16
|
-
export { RadioGroup, RadioGroupItem };
|
|
29
|
+
export { RadioGroup, RadioGroupItem, RadioVisual };
|
|
17
30
|
//# sourceMappingURL=radio-group.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.js","sources":["../../src/components/radio-group.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\";\n\nimport { cn } from \"@/utils\";\n\nconst RadioGroup = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>\n>(({ className, ...
|
|
1
|
+
{"version":3,"file":"radio-group.js","sources":["../../src/components/radio-group.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\";\r\n\r\nimport { cn } from \"@/utils\";\r\nimport { useFormFieldControl } from \"./form-field\";\r\n\r\nconst RadioGroup = React.forwardRef<\r\n React.ElementRef<typeof RadioGroupPrimitive.Root>,\r\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>\r\n>(({ className, ...ownProps }, ref) => {\r\n // Inside a FormField the field's label names the whole group.\r\n const props = useFormFieldControl(ownProps, \"group\");\r\n return (\r\n <RadioGroupPrimitive.Root\r\n className={cn(\"grid gap-2\", className)}\r\n {...props}\r\n ref={ref}\r\n />\r\n );\r\n});\r\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName;\r\n\r\n/**\r\n * The radio circle shared by RadioGroup and ChipSelect: one fixed SVG whose\r\n * colours change with the state, so nothing shifts when it is selected.\r\n * Pass `checked`, or leave it out inside a `group` element with\r\n * `data-state=\"checked\"` (as a RadioGroupItem is).\r\n */\r\nfunction RadioVisual({ checked, className }: { checked?: boolean; className?: string }) {\r\n const state = checked === undefined ? undefined : checked ? \"checked\" : \"unchecked\";\r\n return (\r\n <svg aria-hidden=\"true\" data-state={state} viewBox=\"0 0 16 16\" className={cn(\"group/radio size-4 shrink-0\", className)}>\r\n <circle\r\n cx=\"8\"\r\n cy=\"8\"\r\n r=\"7\"\r\n strokeWidth=\"1\"\r\n className={cn(\r\n \"fill-muted stroke-input transition-colors duration-state motion-reduce:transition-none\",\r\n \"group-data-[state=checked]/radio:fill-primary group-data-[state=checked]/radio:stroke-primary\",\r\n checked === undefined && \"group-data-[state=checked]:fill-primary group-data-[state=checked]:stroke-primary group-hover:stroke-primary\",\r\n )}\r\n />\r\n <circle\r\n cx=\"8\"\r\n cy=\"8\"\r\n r=\"4\"\r\n className={cn(\r\n \"fill-background opacity-0\",\r\n \"group-data-[state=checked]/radio:opacity-100\",\r\n checked === undefined && \"group-data-[state=checked]:opacity-100\",\r\n )}\r\n />\r\n </svg>\r\n );\r\n}\r\n\r\nconst RadioGroupItem = React.forwardRef<\r\n React.ElementRef<typeof RadioGroupPrimitive.Item>,\r\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>\r\n>(({ className, ...props }, ref) => {\r\n return (\r\n <RadioGroupPrimitive.Item\r\n ref={ref}\r\n className={cn(\r\n \"group relative aspect-square size-4 shrink-0 rounded-full focus:outline-none focus-visible:outline-3 focus-visible:outline-offset-4 focus-visible:outline-landing-blue disabled:cursor-not-allowed disabled:opacity-50 after:absolute after:-inset-3 after:content-['']\",\r\n className,\r\n )}\r\n {...props}\r\n >\r\n <RadioVisual />\r\n </RadioGroupPrimitive.Item>\r\n );\r\n});\r\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;\r\n\r\nexport { RadioGroup, RadioGroupItem, RadioVisual };\r\n"],"names":[],"mappings":";;;;;;;AAQA;;;;AAaA;AACA;AAEA;;;;;AAKG;AACH;;AAEE;AAyBF;AAEA;;AAgBA;AACA;;"}
|
|
@@ -7,6 +7,7 @@ import { cn } from '../utils.js';
|
|
|
7
7
|
import { fieldInteractionClassName } from '../hooks/use-field-focus.js';
|
|
8
8
|
import { useMobile } from '../hooks/use-mobile.js';
|
|
9
9
|
import { useMobileSheetViewport } from '../hooks/use-mobile-sheet-viewport.js';
|
|
10
|
+
import { useFormFieldControl, useFormField } from './form-field.js';
|
|
10
11
|
|
|
11
12
|
const SelectContext = React.createContext({ open: false, setOpen: (_open) => { } });
|
|
12
13
|
function Select({ open: controlledOpen, defaultOpen = false, onOpenChange, children, ...props }) {
|
|
@@ -21,14 +22,49 @@ function Select({ open: controlledOpen, defaultOpen = false, onOpenChange, child
|
|
|
21
22
|
}
|
|
22
23
|
const SelectGroup = SelectPrimitive.Group;
|
|
23
24
|
const SelectValue = SelectPrimitive.Value;
|
|
24
|
-
const SelectTrigger = React.forwardRef(({ className, children, ...
|
|
25
|
+
const SelectTrigger = React.forwardRef(({ className, children, onPointerDown, onClick, ...ownProps }, ref) => {
|
|
26
|
+
const props = useFormFieldControl(ownProps);
|
|
27
|
+
const { open, setOpen } = React.useContext(SelectContext);
|
|
28
|
+
// Radix opens on a mouse press on the trigger itself, so a click that arrives
|
|
29
|
+
// without one (from the field's label) would only focus it. Open it here.
|
|
30
|
+
// A press on the trigger stops counting once anything else is pressed: when
|
|
31
|
+
// Radix opens on the press, the release lands on the menu, not the trigger.
|
|
32
|
+
const pressedRef = React.useRef(false);
|
|
33
|
+
const triggerRef = React.useRef(null);
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
const onPointerDownAnywhere = (event) => {
|
|
36
|
+
if (!(event.target instanceof Node) || !triggerRef.current?.contains(event.target))
|
|
37
|
+
pressedRef.current = false;
|
|
38
|
+
};
|
|
39
|
+
document.addEventListener('pointerdown', onPointerDownAnywhere, true);
|
|
40
|
+
return () => document.removeEventListener('pointerdown', onPointerDownAnywhere, true);
|
|
41
|
+
}, []);
|
|
42
|
+
return (jsxs(SelectPrimitive.Trigger, { ref: (node) => {
|
|
43
|
+
triggerRef.current = node;
|
|
44
|
+
if (typeof ref === 'function')
|
|
45
|
+
ref(node);
|
|
46
|
+
else if (ref)
|
|
47
|
+
ref.current = node;
|
|
48
|
+
}, onPointerDown: (event) => {
|
|
49
|
+
pressedRef.current = true;
|
|
50
|
+
onPointerDown?.(event);
|
|
51
|
+
}, onClick: (event) => {
|
|
52
|
+
onClick?.(event);
|
|
53
|
+
const fromLabel = !pressedRef.current;
|
|
54
|
+
pressedRef.current = false;
|
|
55
|
+
if (fromLabel && !event.defaultPrevented && !open && !props.disabled)
|
|
56
|
+
setOpen(true);
|
|
57
|
+
}, className: cn('group bg-background text-foreground placeholder:text-muted-foreground/40 data-[placeholder]:text-muted-foreground/40 border-input enabled:hover:border-input-hover flex h-form-control min-h-form-control max-h-form-control w-full cursor-pointer items-center justify-between gap-2 rounded-control-lg border px-field-padding-x py-0 text-base font-normal outline-none aria-invalid:border-destructive disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1', 'focus-visible:outline-3 focus-visible:outline-offset-4 focus-visible:outline-landing-blue', fieldInteractionClassName, className), ...props, children: [children, jsx(SelectPrimitive.Icon, { asChild: true, children: jsx(ChevronDown, { className: "h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-interactive ease-out-strong group-data-[state=open]:rotate-180 motion-reduce:transition-none" }) })] }));
|
|
58
|
+
});
|
|
25
59
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
26
60
|
const SelectScrollUpButton = React.forwardRef(({ className, ...props }, ref) => (jsx(SelectPrimitive.ScrollUpButton, { ref: ref, className: cn('flex cursor-default items-center justify-center py-1', className), ...props, children: jsx(ChevronUp, { className: "h-4 w-4" }) })));
|
|
27
61
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
28
62
|
const SelectScrollDownButton = React.forwardRef(({ className, ...props }, ref) => (jsx(SelectPrimitive.ScrollDownButton, { ref: ref, className: cn('flex cursor-default items-center justify-center py-1', className), ...props, children: jsx(ChevronDown, { className: "h-4 w-4" }) })));
|
|
29
63
|
SelectScrollDownButton.displayName =
|
|
30
64
|
SelectPrimitive.ScrollDownButton.displayName;
|
|
31
|
-
const SelectContent = React.forwardRef(({ className, children, position = 'popper', title
|
|
65
|
+
const SelectContent = React.forwardRef(({ className, children, position = 'popper', title: ownTitle, style, ...props }, ref) => {
|
|
66
|
+
// The phone sheet's title: an explicit title, else the field's label.
|
|
67
|
+
const title = ownTitle ?? useFormField()?.labelText ?? 'Choose an option';
|
|
32
68
|
const mobile = useMobile();
|
|
33
69
|
const { open, setOpen } = React.useContext(SelectContext);
|
|
34
70
|
const viewport = useMobileSheetViewport(open && mobile);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sources":["../../src/components/select.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as SelectPrimitive from '@radix-ui/react-select';\nimport { Check, ChevronDown, ChevronUp, X } from 'lucide-react';\n\nimport { cn } from '@/utils';\nimport { fieldInteractionClassName } from '@/hooks/use-field-focus';\nimport { useMobile } from '@/hooks/use-mobile';\nimport { useMobileSheetViewport } from '@/hooks/use-mobile-sheet-viewport';\n\nconst SelectContext = React.createContext({ open: false, setOpen: (_open: boolean) => {} });\n\nfunction Select({ open: controlledOpen, defaultOpen = false, onOpenChange, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {\n const [internalOpen, setInternalOpen] = React.useState(defaultOpen);\n const open = controlledOpen ?? internalOpen;\n const setOpen = (next: boolean) => {\n if (controlledOpen === undefined) setInternalOpen(next);\n onOpenChange?.(next);\n };\n\n return (\n <SelectContext.Provider value={{ open, setOpen }}>\n <SelectPrimitive.Root {...props} open={open} onOpenChange={setOpen}>\n {children}\n </SelectPrimitive.Root>\n </SelectContext.Provider>\n );\n}\n\nconst SelectGroup = SelectPrimitive.Group;\n\nconst SelectValue = SelectPrimitive.Value;\n\nconst SelectTrigger = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n 'group bg-background text-foreground placeholder:text-muted-foreground/40 data-[placeholder]:text-muted-foreground/40 border-input enabled:hover:border-input-hover flex h-form-control min-h-form-control max-h-form-control w-full cursor-pointer items-center justify-between gap-2 rounded-control-lg border px-field-padding-x py-0 text-base font-normal outline-none aria-invalid:border-destructive disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',\n 'focus-visible:outline-3 focus-visible:outline-offset-4 focus-visible:outline-landing-blue',\n fieldInteractionClassName,\n className,\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDown className=\"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-interactive ease-out-strong group-data-[state=open]:rotate-180 motion-reduce:transition-none\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n));\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n\nconst SelectScrollUpButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton\n ref={ref}\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className,\n )}\n {...props}\n >\n <ChevronUp className=\"h-4 w-4\" />\n </SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\n\nconst SelectScrollDownButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton\n ref={ref}\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className,\n )}\n {...props}\n >\n <ChevronDown className=\"h-4 w-4\" />\n </SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName =\n SelectPrimitive.ScrollDownButton.displayName;\n\nconst SelectContent = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> & { title?: string }\n>(({ className, children, position = 'popper', title = 'Choose an option', style, ...props }, ref) => {\n const mobile = useMobile();\n const { open, setOpen } = React.useContext(SelectContext);\n const viewport = useMobileSheetViewport(open && mobile);\n\n return (\n <SelectPrimitive.Portal>\n <div\n className={mobile ? '[&>[data-radix-popper-content-wrapper]]:!fixed [&>[data-radix-popper-content-wrapper]]:!inset-x-0 [&>[data-radix-popper-content-wrapper]]:!top-auto [&>[data-radix-popper-content-wrapper]]:!bottom-[var(--select-sheet-bottom)] [&>[data-radix-popper-content-wrapper]]:!transform-none [&>[data-radix-popper-content-wrapper]]:!z-(--z-popover) [&>[data-radix-popper-content-wrapper]]:!min-w-0' : undefined}\n style={{ '--select-sheet-bottom': `${viewport?.bottom ?? 0}px` } as React.CSSProperties}\n >\n {mobile && open && (\n <div aria-hidden=\"true\" className=\"fixed inset-0 z-(--z-popover-overlay) bg-black/25 backdrop-blur-[1px]\" />\n )}\n <SelectPrimitive.Content\n ref={ref}\n className={cn(\n 'relative flex flex-col overflow-hidden border border-border bg-background text-sm text-foreground shadow-card duration-interactive ease-out-strong motion-reduce:animate-none',\n mobile\n ? 'w-full rounded-t-control-lg border-b-0 pb-[env(safe-area-inset-bottom)]'\n : 'z-(--z-popover) max-h-[400px] min-w-[8rem] rounded-control-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',\n className,\n )}\n position={mobile ? 'popper' : position}\n sideOffset={4}\n style={{\n ...(mobile ? { maxHeight: viewport ? Math.min(viewport.height, 640) : '80dvh' } : {}),\n ...style,\n }}\n {...props}\n >\n {mobile && (\n <div role=\"presentation\" className=\"flex shrink-0 items-center justify-between gap-4 px-4 pb-3 pt-4\">\n <h2 className=\"text-base font-semibold text-foreground\">{title}</h2>\n <button\n type=\"button\"\n aria-label=\"Close options\"\n className=\"-mr-3 flex h-11 w-11 shrink-0 items-center justify-center rounded-control-lg text-muted-foreground hover:bg-muted\"\n onPointerDown={(event) => event.stopPropagation()}\n onClick={() => setOpen(false)}\n >\n <X className=\"h-5 w-5\" aria-hidden=\"true\" />\n </button>\n </div>\n )}\n {!mobile && <SelectScrollUpButton />}\n <SelectPrimitive.Viewport\n className={cn(\n 'flex min-h-0 flex-col gap-option-gap overflow-y-auto overscroll-contain p-option-inset',\n mobile ? 'w-full flex-1' : position === 'popper' && 'w-full min-w-[var(--radix-select-trigger-width)]',\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n {!mobile && <SelectScrollDownButton />}\n </SelectPrimitive.Content>\n </div>\n </SelectPrimitive.Portal>\n );\n});\nSelectContent.displayName = SelectPrimitive.Content.displayName;\n\nconst SelectLabel = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn('px-option-x py-2 text-sm font-semibold text-foreground', className)}\n {...props}\n />\n));\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\n\nconst SelectItem = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex min-h-option-row w-full cursor-pointer items-center gap-2 rounded-control-sm px-option-x py-2 pr-9 text-sm text-muted-foreground outline-none select-none transition-colors duration-interactive ease-out-strong focus:bg-muted data-[state=checked]:bg-primary-tint data-[disabled]:pointer-events-none data-[disabled]:opacity-50 motion-reduce:transition-none max-md:min-h-12',\n className,\n )}\n {...props}\n >\n <span className=\"absolute right-option-x flex h-4 w-4 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n));\nSelectItem.displayName = SelectPrimitive.Item.displayName;\n\nconst SelectSeparator = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn('bg-border h-px', className)}\n {...props}\n />\n));\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\n\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n SelectScrollUpButton,\n SelectScrollDownButton,\n};\n"],"names":[],"mappings":";;;;;;;;;;AAWA;AAEA;AACE;AACA;AACA;;;AAEE;AACF;AAEA;AAOF;AAEA;AAEA;AAEA;AAoBA;AAEA;AAeA;AAEA;AAeA;AACE;AAEF;AAIE;AACA;;AAGA;AAcQ;;AAOF;AACA;;AAgCR;AACA;AAEA;AAUA;AAEA;AAqBA;AAEA;AAUA;;"}
|
|
1
|
+
{"version":3,"file":"select.js","sources":["../../src/components/select.tsx"],"sourcesContent":["'use client';\r\n\r\nimport * as React from 'react';\r\nimport * as SelectPrimitive from '@radix-ui/react-select';\r\nimport { Check, ChevronDown, ChevronUp, X } from 'lucide-react';\r\n\r\nimport { cn } from '@/utils';\r\nimport { fieldInteractionClassName } from '@/hooks/use-field-focus';\r\nimport { useMobile } from '@/hooks/use-mobile';\r\nimport { useMobileSheetViewport } from '@/hooks/use-mobile-sheet-viewport';\r\nimport { useFormField, useFormFieldControl } from './form-field';\r\n\r\nconst SelectContext = React.createContext({ open: false, setOpen: (_open: boolean) => {} });\r\n\r\nfunction Select({ open: controlledOpen, defaultOpen = false, onOpenChange, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {\r\n const [internalOpen, setInternalOpen] = React.useState(defaultOpen);\r\n const open = controlledOpen ?? internalOpen;\r\n const setOpen = (next: boolean) => {\r\n if (controlledOpen === undefined) setInternalOpen(next);\r\n onOpenChange?.(next);\r\n };\r\n\r\n return (\r\n <SelectContext.Provider value={{ open, setOpen }}>\r\n <SelectPrimitive.Root {...props} open={open} onOpenChange={setOpen}>\r\n {children}\r\n </SelectPrimitive.Root>\r\n </SelectContext.Provider>\r\n );\r\n}\r\n\r\nconst SelectGroup = SelectPrimitive.Group;\r\n\r\nconst SelectValue = SelectPrimitive.Value;\r\n\r\nconst SelectTrigger = React.forwardRef<\r\n React.ElementRef<typeof SelectPrimitive.Trigger>,\r\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>\r\n>(({ className, children, onPointerDown, onClick, ...ownProps }, ref) => {\r\n const props = useFormFieldControl(ownProps);\r\n const { open, setOpen } = React.useContext(SelectContext);\r\n // Radix opens on a mouse press on the trigger itself, so a click that arrives\r\n // without one (from the field's label) would only focus it. Open it here.\r\n // A press on the trigger stops counting once anything else is pressed: when\r\n // Radix opens on the press, the release lands on the menu, not the trigger.\r\n const pressedRef = React.useRef(false);\r\n const triggerRef = React.useRef<HTMLButtonElement | null>(null);\r\n React.useEffect(() => {\r\n const onPointerDownAnywhere = (event: PointerEvent) => {\r\n if (!(event.target instanceof Node) || !triggerRef.current?.contains(event.target)) pressedRef.current = false;\r\n };\r\n document.addEventListener('pointerdown', onPointerDownAnywhere, true);\r\n return () => document.removeEventListener('pointerdown', onPointerDownAnywhere, true);\r\n }, []);\r\n return (\r\n <SelectPrimitive.Trigger\r\n ref={(node) => {\r\n triggerRef.current = node;\r\n if (typeof ref === 'function') ref(node);\r\n else if (ref) ref.current = node;\r\n }}\r\n onPointerDown={(event) => {\r\n pressedRef.current = true;\r\n onPointerDown?.(event);\r\n }}\r\n onClick={(event) => {\r\n onClick?.(event);\r\n const fromLabel = !pressedRef.current;\r\n pressedRef.current = false;\r\n if (fromLabel && !event.defaultPrevented && !open && !props.disabled) setOpen(true);\r\n }}\r\n className={cn(\r\n 'group bg-background text-foreground placeholder:text-muted-foreground/40 data-[placeholder]:text-muted-foreground/40 border-input enabled:hover:border-input-hover flex h-form-control min-h-form-control max-h-form-control w-full cursor-pointer items-center justify-between gap-2 rounded-control-lg border px-field-padding-x py-0 text-base font-normal outline-none aria-invalid:border-destructive disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',\r\n 'focus-visible:outline-3 focus-visible:outline-offset-4 focus-visible:outline-landing-blue',\r\n fieldInteractionClassName,\r\n className,\r\n )}\r\n {...props}\r\n >\r\n {children}\r\n <SelectPrimitive.Icon asChild>\r\n <ChevronDown className=\"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-interactive ease-out-strong group-data-[state=open]:rotate-180 motion-reduce:transition-none\" />\r\n </SelectPrimitive.Icon>\r\n </SelectPrimitive.Trigger>\r\n );\r\n});\r\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\r\n\r\nconst SelectScrollUpButton = React.forwardRef<\r\n React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,\r\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\r\n>(({ className, ...props }, ref) => (\r\n <SelectPrimitive.ScrollUpButton\r\n ref={ref}\r\n className={cn(\r\n 'flex cursor-default items-center justify-center py-1',\r\n className,\r\n )}\r\n {...props}\r\n >\r\n <ChevronUp className=\"h-4 w-4\" />\r\n </SelectPrimitive.ScrollUpButton>\r\n));\r\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\r\n\r\nconst SelectScrollDownButton = React.forwardRef<\r\n React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,\r\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\r\n>(({ className, ...props }, ref) => (\r\n <SelectPrimitive.ScrollDownButton\r\n ref={ref}\r\n className={cn(\r\n 'flex cursor-default items-center justify-center py-1',\r\n className,\r\n )}\r\n {...props}\r\n >\r\n <ChevronDown className=\"h-4 w-4\" />\r\n </SelectPrimitive.ScrollDownButton>\r\n));\r\nSelectScrollDownButton.displayName =\r\n SelectPrimitive.ScrollDownButton.displayName;\r\n\r\nconst SelectContent = React.forwardRef<\r\n React.ElementRef<typeof SelectPrimitive.Content>,\r\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> & { title?: string }\r\n>(({ className, children, position = 'popper', title: ownTitle, style, ...props }, ref) => {\r\n // The phone sheet's title: an explicit title, else the field's label.\r\n const title = ownTitle ?? useFormField()?.labelText ?? 'Choose an option';\r\n const mobile = useMobile();\r\n const { open, setOpen } = React.useContext(SelectContext);\r\n const viewport = useMobileSheetViewport(open && mobile);\r\n\r\n return (\r\n <SelectPrimitive.Portal>\r\n <div\r\n className={mobile ? '[&>[data-radix-popper-content-wrapper]]:!fixed [&>[data-radix-popper-content-wrapper]]:!inset-x-0 [&>[data-radix-popper-content-wrapper]]:!top-auto [&>[data-radix-popper-content-wrapper]]:!bottom-[var(--select-sheet-bottom)] [&>[data-radix-popper-content-wrapper]]:!transform-none [&>[data-radix-popper-content-wrapper]]:!z-(--z-popover) [&>[data-radix-popper-content-wrapper]]:!min-w-0' : undefined}\r\n style={{ '--select-sheet-bottom': `${viewport?.bottom ?? 0}px` } as React.CSSProperties}\r\n >\r\n {mobile && open && (\r\n <div aria-hidden=\"true\" className=\"fixed inset-0 z-(--z-popover-overlay) bg-black/25 backdrop-blur-[1px]\" />\r\n )}\r\n <SelectPrimitive.Content\r\n ref={ref}\r\n className={cn(\r\n 'relative flex flex-col overflow-hidden border border-border bg-background text-sm text-foreground shadow-card duration-interactive ease-out-strong motion-reduce:animate-none',\r\n mobile\r\n ? 'w-full rounded-t-control-lg border-b-0 pb-[env(safe-area-inset-bottom)]'\r\n : 'z-(--z-popover) max-h-[400px] min-w-[8rem] rounded-control-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',\r\n className,\r\n )}\r\n position={mobile ? 'popper' : position}\r\n sideOffset={4}\r\n style={{\r\n ...(mobile ? { maxHeight: viewport ? Math.min(viewport.height, 640) : '80dvh' } : {}),\r\n ...style,\r\n }}\r\n {...props}\r\n >\r\n {mobile && (\r\n <div role=\"presentation\" className=\"flex shrink-0 items-center justify-between gap-4 px-4 pb-3 pt-4\">\r\n <h2 className=\"text-base font-semibold text-foreground\">{title}</h2>\r\n <button\r\n type=\"button\"\r\n aria-label=\"Close options\"\r\n className=\"-mr-3 flex h-11 w-11 shrink-0 items-center justify-center rounded-control-lg text-muted-foreground hover:bg-muted\"\r\n onPointerDown={(event) => event.stopPropagation()}\r\n onClick={() => setOpen(false)}\r\n >\r\n <X className=\"h-5 w-5\" aria-hidden=\"true\" />\r\n </button>\r\n </div>\r\n )}\r\n {!mobile && <SelectScrollUpButton />}\r\n <SelectPrimitive.Viewport\r\n className={cn(\r\n 'flex min-h-0 flex-col gap-option-gap overflow-y-auto overscroll-contain p-option-inset',\r\n mobile ? 'w-full flex-1' : position === 'popper' && 'w-full min-w-[var(--radix-select-trigger-width)]',\r\n )}\r\n >\r\n {children}\r\n </SelectPrimitive.Viewport>\r\n {!mobile && <SelectScrollDownButton />}\r\n </SelectPrimitive.Content>\r\n </div>\r\n </SelectPrimitive.Portal>\r\n );\r\n});\r\nSelectContent.displayName = SelectPrimitive.Content.displayName;\r\n\r\nconst SelectLabel = React.forwardRef<\r\n React.ElementRef<typeof SelectPrimitive.Label>,\r\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\r\n>(({ className, ...props }, ref) => (\r\n <SelectPrimitive.Label\r\n ref={ref}\r\n className={cn('px-option-x py-2 text-sm font-semibold text-foreground', className)}\r\n {...props}\r\n />\r\n));\r\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\r\n\r\nconst SelectItem = React.forwardRef<\r\n React.ElementRef<typeof SelectPrimitive.Item>,\r\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\r\n>(({ className, children, ...props }, ref) => (\r\n <SelectPrimitive.Item\r\n ref={ref}\r\n className={cn(\r\n 'relative flex min-h-option-row w-full cursor-pointer items-center gap-2 rounded-control-sm px-option-x py-2 pr-9 text-sm text-muted-foreground outline-none select-none transition-colors duration-interactive ease-out-strong focus:bg-muted data-[state=checked]:bg-primary-tint data-[disabled]:pointer-events-none data-[disabled]:opacity-50 motion-reduce:transition-none max-md:min-h-12',\r\n className,\r\n )}\r\n {...props}\r\n >\r\n <span className=\"absolute right-option-x flex h-4 w-4 items-center justify-center\">\r\n <SelectPrimitive.ItemIndicator>\r\n <Check className=\"h-4 w-4\" />\r\n </SelectPrimitive.ItemIndicator>\r\n </span>\r\n\r\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\r\n </SelectPrimitive.Item>\r\n));\r\nSelectItem.displayName = SelectPrimitive.Item.displayName;\r\n\r\nconst SelectSeparator = React.forwardRef<\r\n React.ElementRef<typeof SelectPrimitive.Separator>,\r\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\r\n>(({ className, ...props }, ref) => (\r\n <SelectPrimitive.Separator\r\n ref={ref}\r\n className={cn('bg-border h-px', className)}\r\n {...props}\r\n />\r\n));\r\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\r\n\r\nexport {\r\n Select,\r\n SelectGroup,\r\n SelectValue,\r\n SelectTrigger,\r\n SelectContent,\r\n SelectLabel,\r\n SelectItem,\r\n SelectSeparator,\r\n SelectScrollUpButton,\r\n SelectScrollDownButton,\r\n};\r\n"],"names":[],"mappings":";;;;;;;;;;;AAYA;AAEA;AACE;AACA;AACA;;;AAEE;AACF;AAEA;AAOF;AAEA;AAEA;AAEA;AAIE;AACA;;;;;;;AAOA;AACE;AACE;AAAoF;AACtF;;AAEA;;;AAKE;;;AAEK;AAAS;AAChB;AAEE;AACA;AACF;AAEE;AACA;AACA;AACA;;AACF;AAeJ;AACA;AAEA;AAeA;AAEA;AAeA;AACE;AAEF;;;AAME;AACA;;AAGA;AAcQ;;AAOF;AACA;;AAgCR;AACA;AAEA;AAUA;AAEA;AAqBA;AAEA;AAUA;;"}
|
|
@@ -7,7 +7,7 @@ declare const SheetClose: React.ForwardRefExoticComponent<SheetPrimitive.DialogC
|
|
|
7
7
|
declare const SheetPortal: React.FC<SheetPrimitive.DialogPortalProps>;
|
|
8
8
|
declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
9
|
declare const sheetVariants: (props?: ({
|
|
10
|
-
side?: "
|
|
10
|
+
side?: "bottom" | "left" | "right" | "top" | null | undefined;
|
|
11
11
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
12
12
|
interface SheetContentProps extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>, VariantProps<typeof sheetVariants> {
|
|
13
13
|
showCloseButton?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sheet.js","sources":["../../src/components/sheet.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as SheetPrimitive from \"@radix-ui/react-dialog\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { X } from \"lucide-react\";\n\nimport { cn } from \"@/utils\";\n\nconst Sheet = SheetPrimitive.Root;\n\nconst SheetTrigger = SheetPrimitive.Trigger;\n\nconst SheetClose = SheetPrimitive.Close;\n\nconst SheetPortal = SheetPrimitive.Portal;\n\nconst SheetOverlay = React.forwardRef<\n React.ElementRef<typeof SheetPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Overlay\n className={cn(\n \"fixed inset-0 z-(--z-modal-overlay) bg-black/30 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\",\n className,\n )}\n {...props}\n ref={ref}\n />\n));\nSheetOverlay.displayName = SheetPrimitive.Overlay.displayName;\n\nconst sheetVariants = cva(\n \"fixed z-(--z-modal) gap-4 overflow-y-auto overscroll-contain border-border bg-background p-6 text-base text-foreground shadow-card transition ease-out-strong data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:duration-200 data-[state=open]:duration-200\",\n {\n variants: {\n side: {\n top: \"inset-x-0 top-0 max-h-[90dvh] rounded-b-control-lg border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top\",\n bottom:\n \"inset-x-0 bottom-0 max-h-[90dvh] rounded-t-control-lg border-t pb-[max(1.5rem,env(safe-area-inset-bottom))] data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom\",\n left: \"inset-y-0 left-0 h-full w-3/4 rounded-r-control-lg border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm\",\n right:\n \"inset-y-0 right-0 h-full w-3/4 rounded-l-control-lg border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm\",\n },\n },\n defaultVariants: {\n side: \"right\",\n },\n },\n);\n\ninterface SheetContentProps\n extends\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,\n VariantProps<typeof sheetVariants> {\n showCloseButton?: boolean;\n overlayClassName?: string;\n}\n\nconst SheetContent = React.forwardRef<\n React.ElementRef<typeof SheetPrimitive.Content>,\n SheetContentProps\n>(({ side = \"right\", className, children, showCloseButton = true, overlayClassName, ...props }, ref) => (\n <SheetPortal>\n <SheetOverlay className={overlayClassName} />\n <SheetPrimitive.Content\n ref={ref}\n className={cn(sheetVariants({ side }), className)}\n {...props}\n >\n {children}\n {showCloseButton && <SheetPrimitive.Close 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 <X className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </SheetPrimitive.Close>}\n </SheetPrimitive.Content>\n </SheetPortal>\n));\nSheetContent.displayName = SheetPrimitive.Content.displayName;\n\nconst SheetHeader = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col space-y-2 pr-10 text-left\",\n className,\n )}\n {...props}\n />\n);\nSheetHeader.displayName = \"SheetHeader\";\n\nconst SheetFooter = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n className,\n )}\n {...props}\n />\n);\nSheetFooter.displayName = \"SheetFooter\";\n\nconst SheetTitle = React.forwardRef<\n React.ElementRef<typeof SheetPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Title\n ref={ref}\n className={cn(\"text-xl font-semibold text-foreground\", className)}\n {...props}\n />\n));\nSheetTitle.displayName = SheetPrimitive.Title.displayName;\n\nconst SheetDescription = React.forwardRef<\n React.ElementRef<typeof SheetPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Description\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nSheetDescription.displayName = SheetPrimitive.Description.displayName;\n\nexport {\n Sheet,\n SheetPortal,\n SheetOverlay,\n SheetTrigger,\n SheetClose,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n};\n"],"names":[],"mappings":";;;;;;;;AASA;AAEA;AAEA;AAEA;AAEA;AAaA;AAEA;AAGI;AACE;AACE;AACA;AAEA;AACA;AAED;AACF;AACD;AACE;AACD;AACF;AAWH;AAmBA;AAEA;AAYA;AAEA;AAYA;AAEA;AAUA;AAEA;AAUA;;"}
|
|
1
|
+
{"version":3,"file":"sheet.js","sources":["../../src/components/sheet.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport * as SheetPrimitive from \"@radix-ui/react-dialog\";\r\nimport { cva, type VariantProps } from \"class-variance-authority\";\r\nimport { X } from \"lucide-react\";\r\n\r\nimport { cn } from \"@/utils\";\r\n\r\nconst Sheet = SheetPrimitive.Root;\r\n\r\nconst SheetTrigger = SheetPrimitive.Trigger;\r\n\r\nconst SheetClose = SheetPrimitive.Close;\r\n\r\nconst SheetPortal = SheetPrimitive.Portal;\r\n\r\nconst SheetOverlay = React.forwardRef<\r\n React.ElementRef<typeof SheetPrimitive.Overlay>,\r\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>\r\n>(({ className, ...props }, ref) => (\r\n <SheetPrimitive.Overlay\r\n className={cn(\r\n \"fixed inset-0 z-(--z-modal-overlay) bg-black/30 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\",\r\n className,\r\n )}\r\n {...props}\r\n ref={ref}\r\n />\r\n));\r\nSheetOverlay.displayName = SheetPrimitive.Overlay.displayName;\r\n\r\nconst sheetVariants = cva(\r\n \"fixed z-(--z-modal) gap-4 overflow-y-auto overscroll-contain border-border bg-background p-6 text-base text-foreground shadow-card transition ease-out-strong data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:duration-200 data-[state=open]:duration-200\",\r\n {\r\n variants: {\r\n side: {\r\n top: \"inset-x-0 top-0 max-h-[90dvh] rounded-b-control-lg border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top\",\r\n bottom:\r\n \"inset-x-0 bottom-0 max-h-[90dvh] rounded-t-control-lg border-t pb-[max(1.5rem,env(safe-area-inset-bottom))] data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom\",\r\n left: \"inset-y-0 left-0 h-full w-3/4 rounded-r-control-lg border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm\",\r\n right:\r\n \"inset-y-0 right-0 h-full w-3/4 rounded-l-control-lg border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm\",\r\n },\r\n },\r\n defaultVariants: {\r\n side: \"right\",\r\n },\r\n },\r\n);\r\n\r\ninterface SheetContentProps\r\n extends\r\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,\r\n VariantProps<typeof sheetVariants> {\r\n showCloseButton?: boolean;\r\n overlayClassName?: string;\r\n}\r\n\r\nconst SheetContent = React.forwardRef<\r\n React.ElementRef<typeof SheetPrimitive.Content>,\r\n SheetContentProps\r\n>(({ side = \"right\", className, children, showCloseButton = true, overlayClassName, ...props }, ref) => (\r\n <SheetPortal>\r\n <SheetOverlay className={overlayClassName} />\r\n <SheetPrimitive.Content\r\n ref={ref}\r\n className={cn(sheetVariants({ side }), className)}\r\n {...props}\r\n >\r\n {children}\r\n {showCloseButton && <SheetPrimitive.Close 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 <X className=\"h-4 w-4\" />\r\n <span className=\"sr-only\">Close</span>\r\n </SheetPrimitive.Close>}\r\n </SheetPrimitive.Content>\r\n </SheetPortal>\r\n));\r\nSheetContent.displayName = SheetPrimitive.Content.displayName;\r\n\r\nconst SheetHeader = ({\r\n className,\r\n ...props\r\n}: React.HTMLAttributes<HTMLDivElement>) => (\r\n <div\r\n className={cn(\r\n \"flex flex-col space-y-2 pr-10 text-left\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n);\r\nSheetHeader.displayName = \"SheetHeader\";\r\n\r\nconst SheetFooter = ({\r\n className,\r\n ...props\r\n}: React.HTMLAttributes<HTMLDivElement>) => (\r\n <div\r\n className={cn(\r\n \"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n);\r\nSheetFooter.displayName = \"SheetFooter\";\r\n\r\nconst SheetTitle = React.forwardRef<\r\n React.ElementRef<typeof SheetPrimitive.Title>,\r\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>\r\n>(({ className, ...props }, ref) => (\r\n <SheetPrimitive.Title\r\n ref={ref}\r\n className={cn(\"text-xl font-semibold text-foreground\", className)}\r\n {...props}\r\n />\r\n));\r\nSheetTitle.displayName = SheetPrimitive.Title.displayName;\r\n\r\nconst SheetDescription = React.forwardRef<\r\n React.ElementRef<typeof SheetPrimitive.Description>,\r\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>\r\n>(({ className, ...props }, ref) => (\r\n <SheetPrimitive.Description\r\n ref={ref}\r\n className={cn(\"text-sm text-muted-foreground\", className)}\r\n {...props}\r\n />\r\n));\r\nSheetDescription.displayName = SheetPrimitive.Description.displayName;\r\n\r\nexport {\r\n Sheet,\r\n SheetPortal,\r\n SheetOverlay,\r\n SheetTrigger,\r\n SheetClose,\r\n SheetContent,\r\n SheetHeader,\r\n SheetFooter,\r\n SheetTitle,\r\n SheetDescription,\r\n};\r\n"],"names":[],"mappings":";;;;;;;;AASA;AAEA;AAEA;AAEA;AAEA;AAaA;AAEA;AAGI;AACE;AACE;AACA;AAEA;AACA;AAED;AACF;AACD;AACE;AACD;AACF;AAWH;AAmBA;AAEA;AAYA;AAEA;AAYA;AAEA;AAUA;AAEA;AAUA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skeleton.js","sources":["../../src/components/skeleton.tsx"],"sourcesContent":["import { cn } from '@/utils';\n\nfunction Skeleton({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"skeleton\"\n className={cn('bg-muted animate-pulse rounded-control-lg motion-reduce:animate-none', className)}\n {...props}\n />\n );\n}\n\nexport { Skeleton };\n"],"names":["_jsx"],"mappings":";;;AAEA,SAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B,EAAA;AACpE,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EAAA,WAAA,EACY,UAAU,EACpB,SAAS,EAAE,EAAE,CAAC,sEAAsE,EAAE,SAAS,CAAC,EAAA,GAC5F,KAAK,EAAA,CACT;AAEN;;;;"}
|
|
1
|
+
{"version":3,"file":"skeleton.js","sources":["../../src/components/skeleton.tsx"],"sourcesContent":["import { cn } from '@/utils';\r\n\r\nfunction Skeleton({ className, ...props }: React.ComponentProps<'div'>) {\r\n return (\r\n <div\r\n data-slot=\"skeleton\"\r\n className={cn('bg-muted animate-pulse rounded-control-lg motion-reduce:animate-none', className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nexport { Skeleton };\r\n"],"names":["_jsx"],"mappings":";;;AAEA,SAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B,EAAA;AACpE,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EAAA,WAAA,EACY,UAAU,EACpB,SAAS,EAAE,EAAE,CAAC,sEAAsE,EAAE,SAAS,CAAC,EAAA,GAC5F,KAAK,EAAA,CACT;AAEN;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider.js","sources":["../../src/components/slider.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as SliderPrimitive from \"@radix-ui/react-slider\";\n\nimport { cn } from \"@/utils\";\n\nconst Slider = React.forwardRef<\n React.ElementRef<typeof SliderPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <SliderPrimitive.Root\n ref={ref}\n className={cn(\n \"group/slider relative flex min-h-11 w-full touch-none select-none items-center data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50\",\n className,\n )}\n {...props}\n >\n <SliderPrimitive.Track className=\"relative h-2 w-full grow overflow-hidden rounded-pill bg-muted\">\n <SliderPrimitive.Range className=\"absolute h-full rounded-pill bg-primary\" />\n </SliderPrimitive.Track>\n <SliderPrimitive.Thumb className=\"relative block size-5 cursor-grab rounded-pill border-2 border-primary bg-background shadow-xs outline-none ring-0 ring-primary/15 transition-[scale,box-shadow,border-color] duration-interactive ease-landing-out after:absolute after:-inset-3 after:content-[''] hover:ring-4 group-active/slider:cursor-grabbing group-active/slider:ring-8 motion-safe:group-active/slider:scale-110 focus-visible:outline-3 focus-visible:outline-offset-4 focus-visible:outline-landing-blue data-[disabled]:pointer-events-none motion-reduce:transition-none\" />\n </SliderPrimitive.Root>\n));\nSlider.displayName = SliderPrimitive.Root.displayName;\n\nexport { Slider };\n"],"names":[],"mappings":";;;;;;AAOA;AAkBA;;"}
|
|
1
|
+
{"version":3,"file":"slider.js","sources":["../../src/components/slider.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport * as SliderPrimitive from \"@radix-ui/react-slider\";\r\n\r\nimport { cn } from \"@/utils\";\r\n\r\nconst Slider = React.forwardRef<\r\n React.ElementRef<typeof SliderPrimitive.Root>,\r\n React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>\r\n>(({ className, ...props }, ref) => (\r\n <SliderPrimitive.Root\r\n ref={ref}\r\n className={cn(\r\n \"group/slider relative flex min-h-11 w-full touch-none select-none items-center data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50\",\r\n className,\r\n )}\r\n {...props}\r\n >\r\n <SliderPrimitive.Track className=\"relative h-2 w-full grow overflow-hidden rounded-pill bg-muted\">\r\n <SliderPrimitive.Range className=\"absolute h-full rounded-pill bg-primary\" />\r\n </SliderPrimitive.Track>\r\n <SliderPrimitive.Thumb className=\"relative block size-5 cursor-grab rounded-pill border-2 border-primary bg-background shadow-xs outline-none ring-0 ring-primary/15 transition-[scale,box-shadow,border-color] duration-interactive ease-landing-out after:absolute after:-inset-3 after:content-[''] hover:ring-4 group-active/slider:cursor-grabbing group-active/slider:ring-8 motion-safe:group-active/slider:scale-110 focus-visible:outline-3 focus-visible:outline-offset-4 focus-visible:outline-landing-blue data-[disabled]:pointer-events-none motion-reduce:transition-none\" />\r\n </SliderPrimitive.Root>\r\n));\r\nSlider.displayName = SliderPrimitive.Root.displayName;\r\n\r\nexport { Slider };\r\n"],"names":[],"mappings":";;;;;;AAOA;AAkBA;;"}
|