@gv-tech/design-system 2.29.1 → 2.29.3
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 +1 -1
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.cjs.map +1 -1
- package/dist/accordion.mjs +2 -3
- package/dist/accordion.mjs.map +1 -1
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.cjs.map +1 -1
- package/dist/alert-dialog.mjs +2 -3
- package/dist/alert-dialog.mjs.map +1 -1
- package/dist/alert.cjs +1 -1
- package/dist/alert.cjs.map +1 -1
- package/dist/alert.mjs +2 -3
- package/dist/alert.mjs.map +1 -1
- package/dist/aspect-ratio.cjs +1 -1
- package/dist/aspect-ratio.cjs.map +1 -1
- package/dist/aspect-ratio.mjs +2 -3
- package/dist/aspect-ratio.mjs.map +1 -1
- package/dist/attachment.cjs +1 -1
- package/dist/attachment.cjs.map +1 -1
- package/dist/attachment.mjs +4 -4
- package/dist/attachment.mjs.map +1 -1
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.cjs.map +1 -1
- package/dist/avatar.mjs +3 -4
- package/dist/avatar.mjs.map +1 -1
- package/dist/badge.cjs +1 -1
- package/dist/badge.cjs.map +1 -1
- package/dist/badge.mjs +5 -5
- package/dist/badge.mjs.map +1 -1
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.cjs.map +1 -1
- package/dist/breadcrumb.mjs +4 -4
- package/dist/breadcrumb.mjs.map +1 -1
- package/dist/bubble.cjs +1 -1
- package/dist/bubble.cjs.map +1 -1
- package/dist/bubble.mjs +4 -4
- package/dist/bubble.mjs.map +1 -1
- package/dist/button-group.cjs +1 -1
- package/dist/button-group.cjs.map +1 -1
- package/dist/button-group.mjs +4 -4
- package/dist/button-group.mjs.map +1 -1
- package/dist/button.cjs +1 -1
- package/dist/button.cjs.map +1 -1
- package/dist/button.mjs +4 -4
- package/dist/button.mjs.map +1 -1
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.cjs.map +1 -1
- package/dist/calendar.mjs +2 -3
- package/dist/calendar.mjs.map +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.cjs.map +1 -1
- package/dist/card.mjs +2 -3
- package/dist/card.mjs.map +1 -1
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.cjs.map +1 -1
- package/dist/carousel.mjs +3 -4
- package/dist/carousel.mjs.map +1 -1
- package/dist/chart.cjs +2 -2
- package/dist/chart.cjs.map +1 -1
- package/dist/chart.mjs +14 -15
- package/dist/chart.mjs.map +1 -1
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.cjs.map +1 -1
- package/dist/checkbox.mjs +2 -3
- package/dist/checkbox.mjs.map +1 -1
- package/dist/collapsible.cjs +1 -1
- package/dist/collapsible.cjs.map +1 -1
- package/dist/collapsible.mjs +2 -3
- package/dist/collapsible.mjs.map +1 -1
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.cjs.map +1 -1
- package/dist/combobox.mjs +2 -3
- package/dist/combobox.mjs.map +1 -1
- package/dist/command.cjs +1 -1
- package/dist/command.cjs.map +1 -1
- package/dist/command.mjs +2 -3
- package/dist/command.mjs.map +1 -1
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.cjs.map +1 -1
- package/dist/context-menu.mjs +2 -3
- package/dist/context-menu.mjs.map +1 -1
- package/dist/design-system.css +2 -2
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.cjs.map +1 -1
- package/dist/dialog.mjs +2 -3
- package/dist/dialog.mjs.map +1 -1
- package/dist/direction.cjs +1 -1
- package/dist/direction.cjs.map +1 -1
- package/dist/direction.mjs +2 -3
- package/dist/direction.mjs.map +1 -1
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.cjs.map +1 -1
- package/dist/drawer.mjs +2 -3
- package/dist/drawer.mjs.map +1 -1
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.cjs.map +1 -1
- package/dist/dropdown-menu.mjs +2 -3
- package/dist/dropdown-menu.mjs.map +1 -1
- package/dist/empty.cjs +1 -1
- package/dist/empty.cjs.map +1 -1
- package/dist/empty.mjs +2 -3
- package/dist/empty.mjs.map +1 -1
- package/dist/field.cjs +1 -1
- package/dist/field.cjs.map +1 -1
- package/dist/field.mjs +2 -3
- package/dist/field.mjs.map +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.cjs.map +1 -1
- package/dist/form.mjs +11 -12
- package/dist/form.mjs.map +1 -1
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.cjs.map +1 -1
- package/dist/hover-card.mjs +2 -3
- package/dist/hover-card.mjs.map +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +260 -74
- package/dist/index.mjs.map +1 -0
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.cjs.map +1 -1
- package/dist/input-group.mjs +2 -3
- package/dist/input-group.mjs.map +1 -1
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.cjs.map +1 -1
- package/dist/input-otp.mjs +2 -3
- package/dist/input-otp.mjs.map +1 -1
- package/dist/input.cjs +1 -1
- package/dist/input.cjs.map +1 -1
- package/dist/input.mjs +2 -3
- package/dist/input.mjs.map +1 -1
- package/dist/item.cjs +1 -1
- package/dist/item.cjs.map +1 -1
- package/dist/item.mjs +4 -4
- package/dist/item.mjs.map +1 -1
- package/dist/kbd.cjs +1 -1
- package/dist/kbd.cjs.map +1 -1
- package/dist/kbd.mjs +2 -3
- package/dist/kbd.mjs.map +1 -1
- package/dist/label.cjs +1 -1
- package/dist/label.cjs.map +1 -1
- package/dist/label.mjs +2 -3
- package/dist/label.mjs.map +1 -1
- package/dist/marker.cjs +1 -1
- package/dist/marker.cjs.map +1 -1
- package/dist/marker.mjs +4 -4
- package/dist/marker.mjs.map +1 -1
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.cjs.map +1 -1
- package/dist/menubar.mjs +2 -3
- package/dist/menubar.mjs.map +1 -1
- package/dist/message-scroller.cjs +1 -1
- package/dist/message-scroller.cjs.map +1 -1
- package/dist/message-scroller.mjs +2 -3
- package/dist/message-scroller.mjs.map +1 -1
- package/dist/message.cjs +1 -1
- package/dist/message.cjs.map +1 -1
- package/dist/message.mjs +2 -3
- package/dist/message.mjs.map +1 -1
- package/dist/native-select.cjs +1 -1
- package/dist/native-select.cjs.map +1 -1
- package/dist/native-select.mjs +2 -3
- package/dist/native-select.mjs.map +1 -1
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.cjs.map +1 -1
- package/dist/navigation-menu.mjs +2 -3
- package/dist/navigation-menu.mjs.map +1 -1
- package/dist/packages/design-tokens/src/index.d.ts +75 -69
- package/dist/packages/design-tokens/src/palette.d.ts +23 -17
- package/dist/packages/design-tokens/src/preset.d.ts +6 -0
- package/dist/packages/design-tokens/src/theme.d.ts +52 -52
- package/dist/packages/ui-web/src/hooks/use-theme.d.ts +52 -52
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.cjs.map +1 -1
- package/dist/pagination.mjs +2 -3
- package/dist/pagination.mjs.map +1 -1
- package/dist/popover.cjs +1 -1
- package/dist/popover.cjs.map +1 -1
- package/dist/popover.mjs +2 -3
- package/dist/popover.mjs.map +1 -1
- package/dist/progress.cjs +1 -1
- package/dist/progress.cjs.map +1 -1
- package/dist/progress.mjs +2 -3
- package/dist/progress.mjs.map +1 -1
- package/dist/questionnaire.cjs +1 -1
- package/dist/questionnaire.cjs.map +1 -1
- package/dist/questionnaire.mjs +2 -3
- package/dist/questionnaire.mjs.map +1 -1
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.cjs.map +1 -1
- package/dist/radio-group.mjs +2 -3
- package/dist/radio-group.mjs.map +1 -1
- package/dist/resizable.cjs +1 -1
- package/dist/resizable.cjs.map +1 -1
- package/dist/resizable.mjs +2 -3
- package/dist/resizable.mjs.map +1 -1
- package/dist/rolldown-runtime-DbbDpzbe.js +1 -0
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.cjs.map +1 -1
- package/dist/scroll-area.mjs +2 -3
- package/dist/scroll-area.mjs.map +1 -1
- package/dist/scroll-to-top.cjs +1 -1
- package/dist/scroll-to-top.cjs.map +1 -1
- package/dist/scroll-to-top.mjs +7 -12
- package/dist/scroll-to-top.mjs.map +1 -1
- package/dist/search.cjs +1 -1
- package/dist/search.cjs.map +1 -1
- package/dist/search.mjs +14 -15
- package/dist/search.mjs.map +1 -1
- package/dist/select.cjs +1 -1
- package/dist/select.cjs.map +1 -1
- package/dist/select.mjs +2 -3
- package/dist/select.mjs.map +1 -1
- package/dist/separator.cjs +1 -1
- package/dist/separator.cjs.map +1 -1
- package/dist/separator.mjs +2 -3
- package/dist/separator.mjs.map +1 -1
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.cjs.map +1 -1
- package/dist/sheet.mjs +2 -3
- package/dist/sheet.mjs.map +1 -1
- package/dist/{sidebar-Cl3zXgaX.mjs → sidebar-BY-0Gann.mjs} +14 -12
- package/dist/sidebar-BY-0Gann.mjs.map +1 -0
- package/dist/sidebar-BwaRpzdR.js +2 -0
- package/dist/sidebar-BwaRpzdR.js.map +1 -0
- package/dist/sidebar.cjs +1 -1
- package/dist/sidebar.mjs +1 -2
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.cjs.map +1 -1
- package/dist/skeleton.mjs +2 -3
- package/dist/skeleton.mjs.map +1 -1
- package/dist/slider.cjs +1 -1
- package/dist/slider.cjs.map +1 -1
- package/dist/slider.mjs +2 -3
- package/dist/slider.mjs.map +1 -1
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.cjs.map +1 -1
- package/dist/sonner.mjs +2 -3
- package/dist/sonner.mjs.map +1 -1
- package/dist/spinner.cjs +1 -1
- package/dist/spinner.cjs.map +1 -1
- package/dist/spinner.mjs +2 -3
- package/dist/spinner.mjs.map +1 -1
- package/dist/support-fab.cjs +1 -1
- package/dist/support-fab.cjs.map +1 -1
- package/dist/support-fab.mjs +22 -23
- package/dist/support-fab.mjs.map +1 -1
- package/dist/switch.cjs +1 -1
- package/dist/switch.cjs.map +1 -1
- package/dist/switch.mjs +2 -3
- package/dist/switch.mjs.map +1 -1
- package/dist/table-of-contents.cjs +1 -1
- package/dist/table-of-contents.cjs.map +1 -1
- package/dist/table-of-contents.mjs +28 -29
- package/dist/table-of-contents.mjs.map +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.cjs.map +1 -1
- package/dist/table.mjs +2 -3
- package/dist/table.mjs.map +1 -1
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.cjs.map +1 -1
- package/dist/tabs.mjs +2 -3
- package/dist/tabs.mjs.map +1 -1
- package/dist/text.cjs +1 -1
- package/dist/text.cjs.map +1 -1
- package/dist/text.mjs +15 -13
- package/dist/text.mjs.map +1 -1
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.cjs.map +1 -1
- package/dist/textarea.mjs +2 -3
- package/dist/textarea.mjs.map +1 -1
- package/dist/theme-provider.cjs +1 -1
- package/dist/theme-provider.cjs.map +1 -1
- package/dist/theme-provider.mjs +2 -3
- package/dist/theme-provider.mjs.map +1 -1
- package/dist/theme-toggle-B7jIk1EJ.mjs +173 -0
- package/dist/theme-toggle-B7jIk1EJ.mjs.map +1 -0
- package/dist/theme-toggle-CsR6DVEV.js +2 -0
- package/dist/theme-toggle-CsR6DVEV.js.map +1 -0
- package/dist/theme-toggle.cjs +1 -1
- package/dist/theme-toggle.mjs +1 -2
- package/dist/toast.cjs +1 -1
- package/dist/toast.cjs.map +1 -1
- package/dist/toast.mjs +3 -4
- package/dist/toast.mjs.map +1 -1
- package/dist/{toaster-_FgrA-3c.mjs → toaster-Cr-qFHE_.mjs} +15 -17
- package/dist/toaster-Cr-qFHE_.mjs.map +1 -0
- package/dist/{toaster-BRNNfjp9.js → toaster-CsRfPupI.js} +2 -2
- package/dist/toaster-CsRfPupI.js.map +1 -0
- package/dist/toaster.cjs +1 -1
- package/dist/toaster.mjs +1 -2
- package/dist/toggle-group.cjs +1 -1
- package/dist/toggle-group.cjs.map +1 -1
- package/dist/toggle-group.mjs +2 -3
- package/dist/toggle-group.mjs.map +1 -1
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.cjs.map +1 -1
- package/dist/toggle.mjs +2 -3
- package/dist/toggle.mjs.map +1 -1
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.cjs.map +1 -1
- package/dist/tooltip.mjs +2 -3
- package/dist/tooltip.mjs.map +1 -1
- package/dist/{utils-BROwqSso.js → utils-BKlmn6yB.js} +2 -2
- package/dist/{utils-BROwqSso.js.map → utils-BKlmn6yB.js.map} +1 -1
- package/dist/{utils-BurmJD8d.mjs → utils-MPB0bG0d.mjs} +3 -4
- package/dist/utils-MPB0bG0d.mjs.map +1 -0
- package/dist/vendor-Ceu--gxM.js +113 -0
- package/dist/vendor-Ceu--gxM.js.map +1 -0
- package/dist/{vendor-0E4gGRxj.mjs → vendor-PEVwmg1D.mjs} +14614 -15619
- package/dist/vendor-PEVwmg1D.mjs.map +1 -0
- package/package.json +35 -38
- package/dist/rolldown-runtime-CWhphoD1.mjs +0 -23
- package/dist/rolldown-runtime-mLOUI7ql.js +0 -1
- package/dist/sidebar-Cl3zXgaX.mjs.map +0 -1
- package/dist/sidebar-DQzY8XPP.js +0 -2
- package/dist/sidebar-DQzY8XPP.js.map +0 -1
- package/dist/theme-toggle-ldAbIn1Q.mjs +0 -346
- package/dist/theme-toggle-ldAbIn1Q.mjs.map +0 -1
- package/dist/theme-toggle-nNtzABo6.js +0 -2
- package/dist/theme-toggle-nNtzABo6.js.map +0 -1
- package/dist/toaster-BRNNfjp9.js.map +0 -1
- package/dist/toaster-_FgrA-3c.mjs.map +0 -1
- package/dist/utils-BurmJD8d.mjs.map +0 -1
- package/dist/vendor-0E4gGRxj.mjs.map +0 -1
- package/dist/vendor-Bz5F_va8.js +0 -101
- package/dist/vendor-Bz5F_va8.js.map +0 -1
package/dist/calendar.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.cjs","names":[],"sources":["../packages/ui-web/src/calendar.tsx"],"sourcesContent":["'use client';\n\nimport type { CalendarBaseProps } from '@gv-tech/ui-core';\nimport { cn } from 'cn';\nimport { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport * as React from 'react';\nimport { DayPicker, getDefaultClassNames, type DayButton, type Locale } from 'react-day-picker';\n\nimport { Button, buttonVariants } from '@/./button';\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = 'label',\n buttonVariant = 'ghost',\n locale,\n formatters,\n components,\n ...props\n}: React.ComponentProps<typeof DayPicker> & {\n buttonVariant?: React.ComponentProps<typeof Button>['variant'];\n}) {\n const defaultClassNames = getDefaultClassNames();\n\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n className={cn(\n 'group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent',\n String.raw`rtl:**:[.rdp-button\\_next>svg]:rotate-180`,\n String.raw`rtl:**:[.rdp-button\\_previous>svg]:rotate-180`,\n className,\n )}\n captionLayout={captionLayout}\n locale={locale}\n formatters={{\n formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: 'short' }),\n ...formatters,\n }}\n classNames={{\n root: cn('w-fit', defaultClassNames.root),\n months: cn('relative flex flex-col gap-4 md:flex-row', defaultClassNames.months),\n month: cn('flex w-full flex-col gap-4', defaultClassNames.month),\n nav: cn('absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1', defaultClassNames.nav),\n button_previous: cn(\n buttonVariants({ variant: buttonVariant }),\n 'size-(--cell-size) p-0 select-none aria-disabled:opacity-50',\n defaultClassNames.button_previous,\n ),\n button_next: cn(\n buttonVariants({ variant: buttonVariant }),\n 'size-(--cell-size) p-0 select-none aria-disabled:opacity-50',\n defaultClassNames.button_next,\n ),\n month_caption: cn(\n 'flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)',\n defaultClassNames.month_caption,\n ),\n dropdowns: cn(\n 'flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium',\n defaultClassNames.dropdowns,\n ),\n dropdown_root: cn('relative rounded-(--cell-radius)', defaultClassNames.dropdown_root),\n dropdown: cn('bg-popover absolute inset-0 opacity-0', defaultClassNames.dropdown),\n caption_label: cn(\n 'font-medium select-none',\n captionLayout === 'label'\n ? 'text-sm'\n : '[&>svg]:text-muted-foreground flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5',\n defaultClassNames.caption_label,\n ),\n month_grid: cn('w-full border-collapse', defaultClassNames.month_grid),\n weekdays: cn('flex', defaultClassNames.weekdays),\n weekday: cn(\n 'text-muted-foreground flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal select-none',\n defaultClassNames.weekday,\n ),\n week: cn('mt-2 flex w-full', defaultClassNames.week),\n week_number_header: cn('w-(--cell-size) select-none', defaultClassNames.week_number_header),\n week_number: cn('text-muted-foreground text-[0.8rem] select-none', defaultClassNames.week_number),\n day: cn(\n 'group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-e-(--cell-radius)',\n props.showWeekNumber\n ? '[&:nth-child(2)[data-selected=true]_button]:rounded-s-(--cell-radius)'\n : '[&:first-child[data-selected=true]_button]:rounded-s-(--cell-radius)',\n defaultClassNames.day,\n ),\n range_start: cn(\n 'bg-muted after:bg-muted relative isolate z-0 rounded-s-(--cell-radius) after:absolute after:inset-y-0 after:end-0 after:w-4',\n defaultClassNames.range_start,\n ),\n range_middle: cn('rounded-none', defaultClassNames.range_middle),\n range_end: cn(\n 'bg-muted after:bg-muted relative isolate z-0 rounded-e-(--cell-radius) after:absolute after:inset-y-0 after:start-0 after:w-4',\n defaultClassNames.range_end,\n ),\n today: cn(\n 'bg-muted text-foreground rounded-(--cell-radius) data-[selected=true]:rounded-none',\n defaultClassNames.today,\n ),\n outside: cn('text-muted-foreground aria-selected:text-muted-foreground', defaultClassNames.outside),\n disabled: cn('text-muted-foreground opacity-50', defaultClassNames.disabled),\n hidden: cn('invisible', defaultClassNames.hidden),\n ...classNames,\n }}\n components={{\n Root: ({ className, rootRef, ...props }) => {\n return <div data-slot=\"calendar\" ref={rootRef} className={cn(className)} {...props} />;\n },\n Chevron: ({ className, orientation, ...props }) => {\n if (orientation === 'left') {\n return <ChevronLeftIcon className={cn('size-4 rtl:rotate-180', className)} {...props} />;\n }\n\n if (orientation === 'right') {\n return <ChevronRightIcon className={cn('size-4 rtl:rotate-180', className)} {...props} />;\n }\n\n return <ChevronDownIcon className={cn('size-4', className)} {...props} />;\n },\n DayButton: ({ ...props }) => <CalendarDayButton locale={locale} {...props} />,\n WeekNumber: ({ children, ...props }) => {\n return (\n <td {...props}>\n <div className=\"flex size-(--cell-size) items-center justify-center text-center\">{children}</div>\n </td>\n );\n },\n ...components,\n }}\n {...props}\n />\n );\n}\n\nfunction CalendarDayButton({\n className,\n day,\n modifiers,\n locale,\n ...props\n}: React.ComponentProps<typeof DayButton> & { locale?: Partial<Locale> }) {\n const defaultClassNames = getDefaultClassNames();\n\n const ref = React.useRef<HTMLButtonElement>(null);\n React.useEffect(() => {\n if (modifiers.focused) {\n ref.current?.focus();\n }\n }, [modifiers.focused]);\n\n return (\n <Button\n ref={ref}\n variant=\"ghost\"\n size=\"icon\"\n data-day={day.date.toLocaleDateString(locale?.code)}\n data-selected-single={\n modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle\n }\n data-range-start={modifiers.range_start}\n data-range-end={modifiers.range_end}\n data-range-middle={modifiers.range_middle}\n className={cn(\n 'group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-e-(--cell-radius) data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-s-(--cell-radius) [&>span]:text-xs [&>span]:opacity-70',\n defaultClassNames.day,\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Calendar, CalendarDayButton };\n\n// Verify that the component satisfies the ui-core contract\nexport type ___verifyCalendarContract = React.ComponentProps<typeof Calendar> extends CalendarBaseProps ? true : false;\n"],"mappings":"wPAUA,SAAS,EAAS,CAChB,YACA,aACA,kBAAkB,GAClB,gBAAgB,QAChB,gBAAgB,QAChB,SACA,aACA,aACA,GAAG,GAGF,CACD,IAAM,EAAoB,EAAA,EAAqB,EAE/C,OACE,EAAA,EAAA,KAAC,EAAA,EAAD,CACmB,kBACjB,UAAW,EAAA,GACT,wLACA,OAAO,GAAG,4CACV,OAAO,GAAG,gDACV,CACF,EACe,gBACP,SACR,WAAY,CACV,oBAAsB,GAAS,EAAK,eAAe,GAAQ,KAAM,CAAE,MAAO,OAAQ,CAAC,EACnF,GAAG,CACL,EACA,WAAY,CACV,KAAM,EAAA,GAAG,QAAS,EAAkB,IAAI,EACxC,OAAQ,EAAA,GAAG,2CAA4C,EAAkB,MAAM,EAC/E,MAAO,EAAA,GAAG,6BAA8B,EAAkB,KAAK,EAC/D,IAAK,EAAA,GAAG,0EAA2E,EAAkB,GAAG,EACxG,gBAAiB,EAAA,GACf,EAAA,eAAe,CAAE,QAAS,CAAc,CAAC,EACzC,8DACA,EAAkB,eACpB,EACA,YAAa,EAAA,GACX,EAAA,eAAe,CAAE,QAAS,CAAc,CAAC,EACzC,8DACA,EAAkB,WACpB,EACA,cAAe,EAAA,GACb,2EACA,EAAkB,aACpB,EAC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A,GAAG,wBAAyB,CAAS,EAAG,GAAI,CAAQ,CAAA,GAGnF,EAAA,EAAA,KAAC,EAAA,GAAD,CAAiB,UAAW,EAAA,GAAG,SAAU,CAAS,EAAG,GAAI,CAAQ,CAAA,EAE1E,WAAY,CAAE,GAAG,MAAY,EAAA,EAAA,KAAC,EAAD,CAA2B,SAAQ,GAAI,CAAQ,CAAA,EAC5E,YAAa,CAAE,WAAU,GAAG,MAExB,EAAA,EAAA,KAAC,KAAD,CAAI,GAAI,YACN,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,kEAAmE,UAAc,CAAA,CAC9F,CAAA,EAGR,GAAG,CACL,EACA,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,EAAkB,CACzB,YACA,MACA,YACA,SACA,GAAG,GACqE,CACxE,IAAM,EAAoB,EAAA,EAAqB,EAEzC,EAAM,EAAM,OAA0B,IAAI,EAOhD,OANA,EAAM,cAAgB,CAChB,EAAU,SACZ,EAAI,SAAS,MAAM,CAEvB,EAAG,CAAC,EAAU,OAAO,CAAC,GAGpB,EAAA,EAAA,KAAC,EAAA,OAAD,CACO,MACL,QAAQ,QACR,KAAK,OACL,WAAU,EAAI,KAAK,mBAAmB,GAAQ,IAAI,EAClD,uBACE,EAAU,UAAY,CAAC,EAAU,aAAe,CAAC,EAAU,WAAa,CAAC,EAAU,aAErF,mBAAkB,EAAU,YAC5B,iBAAgB,EAAU,UAC1B,oBAAmB,EAAU,aAC7B,UAAW,EAAA,GACT,u7BACA,EAAkB,IAClB,CACF,EACA,GAAI,CACL,CAAA,CAEL"}
|
|
1
|
+
{"version":3,"file":"calendar.cjs","names":["getDefaultClassNames","DayPicker","cn","buttonVariants","ChevronLeftIcon","ChevronRightIcon","ChevronDownIcon","React","Button","require_rolldown_runtime","require_vendor","require_button","react","import_jsx_runtime","Calendar","props","defaultClassNames","className","date","locale","formatters","buttonVariant","captionLayout","classNames","rootRef","orientation","CalendarDayButton","components","ref","modifiers","day"],"sources":["../packages/ui-web/src/calendar.tsx"],"sourcesContent":["'use client';\n\nimport type { CalendarBaseProps } from '@gv-tech/ui-core';\nimport { cn } from 'cn';\nimport { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport * as React from 'react';\nimport { DayPicker, getDefaultClassNames, type DayButton, type Locale } from 'react-day-picker';\n\nimport { Button, buttonVariants } from '@/./button';\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = 'label',\n buttonVariant = 'ghost',\n locale,\n formatters,\n components,\n ...props\n}: React.ComponentProps<typeof DayPicker> & {\n buttonVariant?: React.ComponentProps<typeof Button>['variant'];\n}) {\n const defaultClassNames = getDefaultClassNames();\n\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n className={cn(\n 'group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent',\n String.raw`rtl:**:[.rdp-button\\_next>svg]:rotate-180`,\n String.raw`rtl:**:[.rdp-button\\_previous>svg]:rotate-180`,\n className,\n )}\n captionLayout={captionLayout}\n locale={locale}\n formatters={{\n formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: 'short' }),\n ...formatters,\n }}\n classNames={{\n root: cn('w-fit', defaultClassNames.root),\n months: cn('relative flex flex-col gap-4 md:flex-row', defaultClassNames.months),\n month: cn('flex w-full flex-col gap-4', defaultClassNames.month),\n nav: cn('absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1', defaultClassNames.nav),\n button_previous: cn(\n buttonVariants({ variant: buttonVariant }),\n 'size-(--cell-size) p-0 select-none aria-disabled:opacity-50',\n defaultClassNames.button_previous,\n ),\n button_next: cn(\n buttonVariants({ variant: buttonVariant }),\n 'size-(--cell-size) p-0 select-none aria-disabled:opacity-50',\n defaultClassNames.button_next,\n ),\n month_caption: cn(\n 'flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)',\n defaultClassNames.month_caption,\n ),\n dropdowns: cn(\n 'flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium',\n defaultClassNames.dropdowns,\n ),\n dropdown_root: cn('relative rounded-(--cell-radius)', defaultClassNames.dropdown_root),\n dropdown: cn('bg-popover absolute inset-0 opacity-0', defaultClassNames.dropdown),\n caption_label: cn(\n 'font-medium select-none',\n captionLayout === 'label'\n ? 'text-sm'\n : '[&>svg]:text-muted-foreground flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5',\n defaultClassNames.caption_label,\n ),\n month_grid: cn('w-full border-collapse', defaultClassNames.month_grid),\n weekdays: cn('flex', defaultClassNames.weekdays),\n weekday: cn(\n 'text-muted-foreground flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal select-none',\n defaultClassNames.weekday,\n ),\n week: cn('mt-2 flex w-full', defaultClassNames.week),\n week_number_header: cn('w-(--cell-size) select-none', defaultClassNames.week_number_header),\n week_number: cn('text-muted-foreground text-[0.8rem] select-none', defaultClassNames.week_number),\n day: cn(\n 'group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-e-(--cell-radius)',\n props.showWeekNumber\n ? '[&:nth-child(2)[data-selected=true]_button]:rounded-s-(--cell-radius)'\n : '[&:first-child[data-selected=true]_button]:rounded-s-(--cell-radius)',\n defaultClassNames.day,\n ),\n range_start: cn(\n 'bg-muted after:bg-muted relative isolate z-0 rounded-s-(--cell-radius) after:absolute after:inset-y-0 after:end-0 after:w-4',\n defaultClassNames.range_start,\n ),\n range_middle: cn('rounded-none', defaultClassNames.range_middle),\n range_end: cn(\n 'bg-muted after:bg-muted relative isolate z-0 rounded-e-(--cell-radius) after:absolute after:inset-y-0 after:start-0 after:w-4',\n defaultClassNames.range_end,\n ),\n today: cn(\n 'bg-muted text-foreground rounded-(--cell-radius) data-[selected=true]:rounded-none',\n defaultClassNames.today,\n ),\n outside: cn('text-muted-foreground aria-selected:text-muted-foreground', defaultClassNames.outside),\n disabled: cn('text-muted-foreground opacity-50', defaultClassNames.disabled),\n hidden: cn('invisible', defaultClassNames.hidden),\n ...classNames,\n }}\n components={{\n Root: ({ className, rootRef, ...props }) => {\n return <div data-slot=\"calendar\" ref={rootRef} className={cn(className)} {...props} />;\n },\n Chevron: ({ className, orientation, ...props }) => {\n if (orientation === 'left') {\n return <ChevronLeftIcon className={cn('size-4 rtl:rotate-180', className)} {...props} />;\n }\n\n if (orientation === 'right') {\n return <ChevronRightIcon className={cn('size-4 rtl:rotate-180', className)} {...props} />;\n }\n\n return <ChevronDownIcon className={cn('size-4', className)} {...props} />;\n },\n DayButton: ({ ...props }) => <CalendarDayButton locale={locale} {...props} />,\n WeekNumber: ({ children, ...props }) => {\n return (\n <td {...props}>\n <div className=\"flex size-(--cell-size) items-center justify-center text-center\">{children}</div>\n </td>\n );\n },\n ...components,\n }}\n {...props}\n />\n );\n}\n\nfunction CalendarDayButton({\n className,\n day,\n modifiers,\n locale,\n ...props\n}: React.ComponentProps<typeof DayButton> & { locale?: Partial<Locale> }) {\n const defaultClassNames = getDefaultClassNames();\n\n const ref = React.useRef<HTMLButtonElement>(null);\n React.useEffect(() => {\n if (modifiers.focused) {\n ref.current?.focus();\n }\n }, [modifiers.focused]);\n\n return (\n <Button\n ref={ref}\n variant=\"ghost\"\n size=\"icon\"\n data-day={day.date.toLocaleDateString(locale?.code)}\n data-selected-single={\n modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle\n }\n data-range-start={modifiers.range_start}\n data-range-end={modifiers.range_end}\n data-range-middle={modifiers.range_middle}\n className={cn(\n 'group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-e-(--cell-radius) data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-s-(--cell-radius) [&>span]:text-xs [&>span]:opacity-70',\n defaultClassNames.day,\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Calendar, CalendarDayButton };\n\n// Verify that the component satisfies the ui-core contract\nexport type ___verifyCalendarContract = React.ComponentProps<typeof Calendar> extends CalendarBaseProps ? true : false;\n"],"mappings":"A,wPAUA,SAASc,EAAS,CAChB,YACA,aACA,kBAAkB,GAClB,gBAAgB,QAChB,gBAAgB,QAChB,SACA,aACA,aACA,GAAGC,GAGF,CACD,IAAMC,EAAoBhB,EAAAA,EAAqB,EAE/C,OACE,EAAAa,EAAA,IAAA,CAACZ,EAAAA,EAAD,CACmB,kBACjB,UAAWC,EAAAA,GACT,wLACA,OAAO,GAAG,4CACV,OAAO,GAAG,gDACVe,CACF,EACe,gBACP,SACR,WAAY,CACV,oBAAsB,GAASC,EAAK,eAAeC,GAAQ,KAAM,CAAE,MAAO,OAAQ,CAAC,EACnF,GAAGC,CACL,EACA,WAAY,CACV,KAAMlB,EAAAA,GAAG,QAASc,EAAkB,IAAI,EACxC,OAAQd,EAAAA,GAAG,2CAA4Cc,EAAkB,MAAM,EAC/E,MAAOd,EAAAA,GAAG,6BAA8Bc,EAAkB,KAAK,EAC/D,IAAKd,EAAAA,GAAG,0EAA2Ec,EAAkB,GAAG,EACxG,gBAAiBd,EAAAA,GACfC,EAAAA,eAAe,CAAE,QAASkB,CAAc,CAAC,EACzC,8DACAL,EAAkB,eACpB,EACA,YAAad,EAAAA,GACXC,EAAAA,eAAe,CAAE,QAASkB,CAAc,CAAC,EACzC,8DACAL,EAAkB,WACpB,EACA,cAAed,EAAAA,GACb,2EAC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+1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { Ar as e, B as t, Jr as n, V as r, Xr as i, Yr as a, ei as o } from "./vendor-
|
|
3
|
+
import { Ar as e, B as t, Jr as n, V as r, Xr as i, Yr as a, ei as o } from "./vendor-PEVwmg1D.mjs";
|
|
4
4
|
import { Button as s, buttonVariants as c } from "./button.mjs";
|
|
5
5
|
import * as l from "react";
|
|
6
|
-
|
|
6
|
+
// packages/ui-web/src/calendar.tsx
|
|
7
7
|
var u = e();
|
|
8
8
|
function d({ className: e, classNames: s, showOutsideDays: l = !0, captionLayout: d = "label", buttonVariant: p = "ghost", locale: m, formatters: h, components: g, ..._ }) {
|
|
9
9
|
let v = r();
|
|
@@ -94,7 +94,6 @@ function f({ className: e, day: t, modifiers: n, locale: i, ...a }) {
|
|
|
94
94
|
...a
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
//#endregion
|
|
98
97
|
export { d as Calendar, f as CalendarDayButton };
|
|
99
98
|
|
|
100
99
|
//# sourceMappingURL=calendar.mjs.map
|
package/dist/calendar.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.mjs","names":[],"sources":["../packages/ui-web/src/calendar.tsx"],"sourcesContent":["'use client';\n\nimport type { CalendarBaseProps } from '@gv-tech/ui-core';\nimport { cn } from 'cn';\nimport { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport * as React from 'react';\nimport { DayPicker, getDefaultClassNames, type DayButton, type Locale } from 'react-day-picker';\n\nimport { Button, buttonVariants } from '@/./button';\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = 'label',\n buttonVariant = 'ghost',\n locale,\n formatters,\n components,\n ...props\n}: React.ComponentProps<typeof DayPicker> & {\n buttonVariant?: React.ComponentProps<typeof Button>['variant'];\n}) {\n const defaultClassNames = getDefaultClassNames();\n\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n className={cn(\n 'group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent',\n String.raw`rtl:**:[.rdp-button\\_next>svg]:rotate-180`,\n String.raw`rtl:**:[.rdp-button\\_previous>svg]:rotate-180`,\n className,\n )}\n captionLayout={captionLayout}\n locale={locale}\n formatters={{\n formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: 'short' }),\n ...formatters,\n }}\n classNames={{\n root: cn('w-fit', defaultClassNames.root),\n months: cn('relative flex flex-col gap-4 md:flex-row', defaultClassNames.months),\n month: cn('flex w-full flex-col gap-4', defaultClassNames.month),\n nav: cn('absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1', defaultClassNames.nav),\n button_previous: cn(\n buttonVariants({ variant: buttonVariant }),\n 'size-(--cell-size) p-0 select-none aria-disabled:opacity-50',\n defaultClassNames.button_previous,\n ),\n button_next: cn(\n buttonVariants({ variant: buttonVariant }),\n 'size-(--cell-size) p-0 select-none aria-disabled:opacity-50',\n defaultClassNames.button_next,\n ),\n month_caption: cn(\n 'flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)',\n defaultClassNames.month_caption,\n ),\n dropdowns: cn(\n 'flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium',\n defaultClassNames.dropdowns,\n ),\n dropdown_root: cn('relative rounded-(--cell-radius)', defaultClassNames.dropdown_root),\n dropdown: cn('bg-popover absolute inset-0 opacity-0', defaultClassNames.dropdown),\n caption_label: cn(\n 'font-medium select-none',\n captionLayout === 'label'\n ? 'text-sm'\n : '[&>svg]:text-muted-foreground flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5',\n defaultClassNames.caption_label,\n ),\n month_grid: cn('w-full border-collapse', defaultClassNames.month_grid),\n weekdays: cn('flex', defaultClassNames.weekdays),\n weekday: cn(\n 'text-muted-foreground flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal select-none',\n defaultClassNames.weekday,\n ),\n week: cn('mt-2 flex w-full', defaultClassNames.week),\n week_number_header: cn('w-(--cell-size) select-none', defaultClassNames.week_number_header),\n week_number: cn('text-muted-foreground text-[0.8rem] select-none', defaultClassNames.week_number),\n day: cn(\n 'group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-e-(--cell-radius)',\n props.showWeekNumber\n ? '[&:nth-child(2)[data-selected=true]_button]:rounded-s-(--cell-radius)'\n : '[&:first-child[data-selected=true]_button]:rounded-s-(--cell-radius)',\n defaultClassNames.day,\n ),\n range_start: cn(\n 'bg-muted after:bg-muted relative isolate z-0 rounded-s-(--cell-radius) after:absolute after:inset-y-0 after:end-0 after:w-4',\n defaultClassNames.range_start,\n ),\n range_middle: cn('rounded-none', defaultClassNames.range_middle),\n range_end: cn(\n 'bg-muted after:bg-muted relative isolate z-0 rounded-e-(--cell-radius) after:absolute after:inset-y-0 after:start-0 after:w-4',\n defaultClassNames.range_end,\n ),\n today: cn(\n 'bg-muted text-foreground rounded-(--cell-radius) data-[selected=true]:rounded-none',\n defaultClassNames.today,\n ),\n outside: cn('text-muted-foreground aria-selected:text-muted-foreground', defaultClassNames.outside),\n disabled: cn('text-muted-foreground opacity-50', defaultClassNames.disabled),\n hidden: cn('invisible', defaultClassNames.hidden),\n ...classNames,\n }}\n components={{\n Root: ({ className, rootRef, ...props }) => {\n return <div data-slot=\"calendar\" ref={rootRef} className={cn(className)} {...props} />;\n },\n Chevron: ({ className, orientation, ...props }) => {\n if (orientation === 'left') {\n return <ChevronLeftIcon className={cn('size-4 rtl:rotate-180', className)} {...props} />;\n }\n\n if (orientation === 'right') {\n return <ChevronRightIcon className={cn('size-4 rtl:rotate-180', className)} {...props} />;\n }\n\n return <ChevronDownIcon className={cn('size-4', className)} {...props} />;\n },\n DayButton: ({ ...props }) => <CalendarDayButton locale={locale} {...props} />,\n WeekNumber: ({ children, ...props }) => {\n return (\n <td {...props}>\n <div className=\"flex size-(--cell-size) items-center justify-center text-center\">{children}</div>\n </td>\n );\n },\n ...components,\n }}\n {...props}\n />\n );\n}\n\nfunction CalendarDayButton({\n className,\n day,\n modifiers,\n locale,\n ...props\n}: React.ComponentProps<typeof DayButton> & { locale?: Partial<Locale> }) {\n const defaultClassNames = getDefaultClassNames();\n\n const ref = React.useRef<HTMLButtonElement>(null);\n React.useEffect(() => {\n if (modifiers.focused) {\n ref.current?.focus();\n }\n }, [modifiers.focused]);\n\n return (\n <Button\n ref={ref}\n variant=\"ghost\"\n size=\"icon\"\n data-day={day.date.toLocaleDateString(locale?.code)}\n data-selected-single={\n modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle\n }\n data-range-start={modifiers.range_start}\n data-range-end={modifiers.range_end}\n data-range-middle={modifiers.range_middle}\n className={cn(\n 'group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-e-(--cell-radius) data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-s-(--cell-radius) [&>span]:text-xs [&>span]:opacity-70',\n defaultClassNames.day,\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Calendar, CalendarDayButton };\n\n// Verify that the component satisfies the ui-core contract\nexport type ___verifyCalendarContract = React.ComponentProps<typeof Calendar> extends CalendarBaseProps ? true : false;\n"],"mappings":";;;;;;;AAUA,SAAS,EAAS,EAChB,cACA,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,iBAAA,GAAA,EAAA,KAAC,GAAD;EACO;EACL,SAAQ;EACR,MAAK;EACL,YAAU,EAAI,KAAK,mBAAmB,GAAQ,IAAI;EAClD,wBACE,EAAU,YAAY,CAAC,EAAU,eAAe,CAAC,EAAU,aAAa,CAAC,EAAU;EAErF,oBAAkB,EAAU;EAC5B,kBAAgB,EAAU;EAC1B,qBAAmB,EAAU;EAC7B,WAAW,EACT,w7BACA,EAAkB,KAClB,CACF;EACA,GAAI;CACL,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"calendar.mjs","names":["ChevronLeftIcon","ChevronRightIcon","ChevronDownIcon","React","require_jsx_runtime","DayPicker","ChevronRight","getDefaultClassNames","ChevronDown","ChevronLeft","cn","React$1","import_jsx_runtime","Calendar","props","defaultClassNames","className","date","locale","formatters","buttonVariants","buttonVariant","captionLayout","classNames","rootRef","orientation","CalendarDayButton","components","ref","modifiers","Button","day"],"sources":["../packages/ui-web/src/calendar.tsx"],"sourcesContent":["'use client';\n\nimport type { CalendarBaseProps } from '@gv-tech/ui-core';\nimport { cn } from 'cn';\nimport { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport * as React from 'react';\nimport { DayPicker, getDefaultClassNames, type DayButton, type Locale } from 'react-day-picker';\n\nimport { Button, buttonVariants } from '@/./button';\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = 'label',\n buttonVariant = 'ghost',\n locale,\n formatters,\n components,\n ...props\n}: React.ComponentProps<typeof DayPicker> & {\n buttonVariant?: React.ComponentProps<typeof Button>['variant'];\n}) {\n const defaultClassNames = getDefaultClassNames();\n\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n className={cn(\n 'group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent',\n String.raw`rtl:**:[.rdp-button\\_next>svg]:rotate-180`,\n String.raw`rtl:**:[.rdp-button\\_previous>svg]:rotate-180`,\n className,\n )}\n captionLayout={captionLayout}\n locale={locale}\n formatters={{\n formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: 'short' }),\n ...formatters,\n }}\n classNames={{\n root: cn('w-fit', defaultClassNames.root),\n months: cn('relative flex flex-col gap-4 md:flex-row', defaultClassNames.months),\n month: cn('flex w-full flex-col gap-4', defaultClassNames.month),\n nav: cn('absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1', defaultClassNames.nav),\n button_previous: cn(\n buttonVariants({ variant: buttonVariant }),\n 'size-(--cell-size) p-0 select-none aria-disabled:opacity-50',\n defaultClassNames.button_previous,\n ),\n button_next: cn(\n buttonVariants({ variant: buttonVariant }),\n 'size-(--cell-size) p-0 select-none aria-disabled:opacity-50',\n defaultClassNames.button_next,\n ),\n month_caption: cn(\n 'flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)',\n defaultClassNames.month_caption,\n ),\n dropdowns: cn(\n 'flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium',\n defaultClassNames.dropdowns,\n ),\n dropdown_root: cn('relative rounded-(--cell-radius)', defaultClassNames.dropdown_root),\n dropdown: cn('bg-popover absolute inset-0 opacity-0', defaultClassNames.dropdown),\n caption_label: cn(\n 'font-medium select-none',\n captionLayout === 'label'\n ? 'text-sm'\n : '[&>svg]:text-muted-foreground flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5',\n defaultClassNames.caption_label,\n ),\n month_grid: cn('w-full border-collapse', defaultClassNames.month_grid),\n weekdays: cn('flex', defaultClassNames.weekdays),\n weekday: cn(\n 'text-muted-foreground flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal select-none',\n defaultClassNames.weekday,\n ),\n week: cn('mt-2 flex w-full', defaultClassNames.week),\n week_number_header: cn('w-(--cell-size) select-none', defaultClassNames.week_number_header),\n week_number: cn('text-muted-foreground text-[0.8rem] select-none', defaultClassNames.week_number),\n day: cn(\n 'group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-e-(--cell-radius)',\n props.showWeekNumber\n ? '[&:nth-child(2)[data-selected=true]_button]:rounded-s-(--cell-radius)'\n : '[&:first-child[data-selected=true]_button]:rounded-s-(--cell-radius)',\n defaultClassNames.day,\n ),\n range_start: cn(\n 'bg-muted after:bg-muted relative isolate z-0 rounded-s-(--cell-radius) after:absolute after:inset-y-0 after:end-0 after:w-4',\n defaultClassNames.range_start,\n ),\n range_middle: cn('rounded-none', defaultClassNames.range_middle),\n range_end: cn(\n 'bg-muted after:bg-muted relative isolate z-0 rounded-e-(--cell-radius) after:absolute after:inset-y-0 after:start-0 after:w-4',\n defaultClassNames.range_end,\n ),\n today: cn(\n 'bg-muted text-foreground rounded-(--cell-radius) data-[selected=true]:rounded-none',\n defaultClassNames.today,\n ),\n outside: cn('text-muted-foreground aria-selected:text-muted-foreground', defaultClassNames.outside),\n disabled: cn('text-muted-foreground opacity-50', defaultClassNames.disabled),\n hidden: cn('invisible', defaultClassNames.hidden),\n ...classNames,\n }}\n components={{\n Root: ({ className, rootRef, ...props }) => {\n return <div data-slot=\"calendar\" ref={rootRef} className={cn(className)} {...props} />;\n },\n Chevron: ({ className, orientation, ...props }) => {\n if (orientation === 'left') {\n return <ChevronLeftIcon className={cn('size-4 rtl:rotate-180', className)} {...props} />;\n }\n\n if (orientation === 'right') {\n return <ChevronRightIcon className={cn('size-4 rtl:rotate-180', className)} {...props} />;\n }\n\n return <ChevronDownIcon className={cn('size-4', className)} {...props} />;\n },\n DayButton: ({ ...props }) => <CalendarDayButton locale={locale} {...props} />,\n WeekNumber: ({ children, ...props }) => {\n return (\n <td {...props}>\n <div className=\"flex size-(--cell-size) items-center justify-center text-center\">{children}</div>\n </td>\n );\n },\n ...components,\n }}\n {...props}\n />\n );\n}\n\nfunction CalendarDayButton({\n className,\n day,\n modifiers,\n locale,\n ...props\n}: React.ComponentProps<typeof DayButton> & { locale?: Partial<Locale> }) {\n const defaultClassNames = getDefaultClassNames();\n\n const ref = React.useRef<HTMLButtonElement>(null);\n React.useEffect(() => {\n if (modifiers.focused) {\n ref.current?.focus();\n }\n }, [modifiers.focused]);\n\n return (\n <Button\n ref={ref}\n variant=\"ghost\"\n size=\"icon\"\n data-day={day.date.toLocaleDateString(locale?.code)}\n data-selected-single={\n modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle\n }\n data-range-start={modifiers.range_start}\n data-range-end={modifiers.range_end}\n data-range-middle={modifiers.range_middle}\n className={cn(\n 'group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-e-(--cell-radius) data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-s-(--cell-radius) [&>span]:text-xs [&>span]:opacity-70',\n defaultClassNames.day,\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Calendar, CalendarDayButton };\n\n// Verify that the component satisfies the ui-core contract\nexport type ___verifyCalendarContract = React.ComponentProps<typeof Calendar> extends CalendarBaseProps ? true : false;\n"],"mappings":";;;;;;;AAUA,SAASa,EAAS,EAChB,cACA,eACA,qBAAkB,IAClB,mBAAgB,SAChB,mBAAgB,SAChB,WACA,eACA,eACA,GAAGC,KAGF;CACD,IAAMC,IAAoBR,EAAqB;CAE/C,OACE,iBAAA,GAAAK,EAAA,IAAA,CAACP,GAAD;EACmB;EACjB,WAAWK,EACT,yLACA,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AAAjB,EAAA,IAAA,CAACkB,GAAD;EACO;EACL,SAAQ;EACR,MAAK;EACL,YAAUC,EAAI,KAAK,mBAAmBb,GAAQ,IAAI;EAClD,wBACEW,EAAU,YAAY,CAACA,EAAU,eAAe,CAACA,EAAU,aAAa,CAACA,EAAU;EAErF,oBAAkBA,EAAU;EAC5B,kBAAgBA,EAAU;EAC1B,qBAAmBA,EAAU;EAC7B,WAAWnB,EACT,w7BACAK,EAAkB,KAClBC,CACF;EACA,GAAIF;CACL,CAAA;AAEL"}
|
package/dist/card.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-DbbDpzbe.js"),t=require("./vendor-Ceu--gxM.js");let n=require("react");n=e.r(n);var r=t.Ar();function i({className:e,size:n=`default`,...i}){return(0,r.jsx)(`div`,{"data-slot":`card`,"data-size":n,className:t.ei(`group/card bg-card text-card-foreground ring-foreground/10 flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl py-(--card-spacing) text-sm ring-1 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...i})}function a({className:e,...n}){return(0,r.jsx)(`div`,{"data-slot":`card-header`,className:t.ei(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)`,e),...n})}function o({className:e,...n}){return(0,r.jsx)(`div`,{"data-slot":`card-title`,className:t.ei(`text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...n})}function s({className:e,...n}){return(0,r.jsx)(`div`,{"data-slot":`card-description`,className:t.ei(`text-muted-foreground text-sm`,e),...n})}function c({className:e,...n}){return(0,r.jsx)(`div`,{"data-slot":`card-action`,className:t.ei(`col-start-2 row-span-2 row-start-1 self-start justify-self-end`,e),...n})}function l({className:e,...n}){return(0,r.jsx)(`div`,{"data-slot":`card-content`,className:t.ei(`px-(--card-spacing)`,e),...n})}function u({className:e,...n}){return(0,r.jsx)(`div`,{"data-slot":`card-footer`,className:t.ei(`bg-muted/50 flex items-center rounded-b-xl border-t p-(--card-spacing)`,e),...n})}exports.Card=i,exports.CardAction=c,exports.CardContent=l,exports.CardDescription=s,exports.CardFooter=u,exports.CardHeader=a,exports.CardTitle=o;
|
|
2
2
|
//# sourceMappingURL=card.cjs.map
|
package/dist/card.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.cjs","names":[],"sources":["../packages/ui-web/src/card.tsx"],"sourcesContent":["import type { CardBaseProps } from '@gv-tech/ui-core';\nimport { cn } from 'cn';\nimport * as React from 'react';\n\nfunction Card({ className, size = 'default', ...props }: React.ComponentProps<'div'> & { size?: 'default' | 'sm' }) {\n return (\n <div\n data-slot=\"card\"\n data-size={size}\n className={cn(\n 'group/card bg-card text-card-foreground ring-foreground/10 flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl py-(--card-spacing) text-sm ring-1 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n 'group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-title\"\n className={cn('text-base leading-snug font-medium group-data-[size=sm]/card:text-sm', className)}\n {...props}\n />\n );\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"card-description\" className={cn('text-muted-foreground text-sm', className)} {...props} />;\n}\n\nfunction CardAction({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className)}\n {...props}\n />\n );\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"card-content\" className={cn('px-(--card-spacing)', className)} {...props} />;\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn('bg-muted/50 flex items-center rounded-b-xl border-t p-(--card-spacing)', className)}\n {...props}\n />\n );\n}\n\nexport { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };\nexport type ___verifyContract = React.ComponentProps<typeof Card> extends CardBaseProps ? true : false;\n"],"mappings":"iNAIA,
|
|
1
|
+
{"version":3,"file":"card.cjs","names":["cn","require_rolldown_runtime","require_vendor","react","import_jsx_runtime","Card","props","size","className","CardHeader","CardTitle","CardDescription","CardAction","CardContent","CardFooter"],"sources":["../packages/ui-web/src/card.tsx"],"sourcesContent":["import type { CardBaseProps } from '@gv-tech/ui-core';\nimport { cn } from 'cn';\nimport * as React from 'react';\n\nfunction Card({ className, size = 'default', ...props }: React.ComponentProps<'div'> & { size?: 'default' | 'sm' }) {\n return (\n <div\n data-slot=\"card\"\n data-size={size}\n className={cn(\n 'group/card bg-card text-card-foreground ring-foreground/10 flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl py-(--card-spacing) text-sm ring-1 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n 'group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-title\"\n className={cn('text-base leading-snug font-medium group-data-[size=sm]/card:text-sm', className)}\n {...props}\n />\n );\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"card-description\" className={cn('text-muted-foreground text-sm', className)} {...props} />;\n}\n\nfunction CardAction({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className)}\n {...props}\n />\n );\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"card-content\" className={cn('px-(--card-spacing)', className)} {...props} />;\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn('bg-muted/50 flex items-center rounded-b-xl border-t p-(--card-spacing)', className)}\n {...props}\n />\n );\n}\n\nexport { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };\nexport type ___verifyContract = React.ComponentProps<typeof Card> extends CardBaseProps ? true : false;\n"],"mappings":"A,iNAIA,SAASK,EAAK,CAAE,YAAW,OAAO,UAAW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@@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Ar as e, ei as t } from "./vendor-
|
|
2
|
+
import { Ar as e, ei as t } from "./vendor-PEVwmg1D.mjs";
|
|
3
3
|
import "react";
|
|
4
|
-
|
|
4
|
+
// packages/ui-web/src/card.tsx
|
|
5
5
|
var n = e();
|
|
6
6
|
function r({ className: e, size: r = "default", ...i }) {
|
|
7
7
|
return /* @__PURE__ */ (0, n.jsx)("div", {
|
|
@@ -53,7 +53,6 @@ function l({ className: e, ...r }) {
|
|
|
53
53
|
...r
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
//#endregion
|
|
57
56
|
export { r as Card, s as CardAction, c as CardContent, o as CardDescription, l as CardFooter, i as CardHeader, a as CardTitle };
|
|
58
57
|
|
|
59
58
|
//# sourceMappingURL=card.mjs.map
|
package/dist/card.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.mjs","names":[],"sources":["../packages/ui-web/src/card.tsx"],"sourcesContent":["import type { CardBaseProps } from '@gv-tech/ui-core';\nimport { cn } from 'cn';\nimport * as React from 'react';\n\nfunction Card({ className, size = 'default', ...props }: React.ComponentProps<'div'> & { size?: 'default' | 'sm' }) {\n return (\n <div\n data-slot=\"card\"\n data-size={size}\n className={cn(\n 'group/card bg-card text-card-foreground ring-foreground/10 flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl py-(--card-spacing) text-sm ring-1 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n 'group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-title\"\n className={cn('text-base leading-snug font-medium group-data-[size=sm]/card:text-sm', className)}\n {...props}\n />\n );\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"card-description\" className={cn('text-muted-foreground text-sm', className)} {...props} />;\n}\n\nfunction CardAction({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className)}\n {...props}\n />\n );\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"card-content\" className={cn('px-(--card-spacing)', className)} {...props} />;\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn('bg-muted/50 flex items-center rounded-b-xl border-t p-(--card-spacing)', className)}\n {...props}\n />\n );\n}\n\nexport { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };\nexport type ___verifyContract = React.ComponentProps<typeof Card> extends CardBaseProps ? true : false;\n"],"mappings":";;;;;AAIA,
|
|
1
|
+
{"version":3,"file":"card.mjs","names":["require_jsx_runtime","cn","import_jsx_runtime","Card","props","size","className","CardHeader","CardTitle","CardDescription","CardAction","CardContent","CardFooter"],"sources":["../packages/ui-web/src/card.tsx"],"sourcesContent":["import type { CardBaseProps } from '@gv-tech/ui-core';\nimport { cn } from 'cn';\nimport * as React from 'react';\n\nfunction Card({ className, size = 'default', ...props }: React.ComponentProps<'div'> & { size?: 'default' | 'sm' }) {\n return (\n <div\n data-slot=\"card\"\n data-size={size}\n className={cn(\n 'group/card bg-card text-card-foreground ring-foreground/10 flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl py-(--card-spacing) text-sm ring-1 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n 'group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-title\"\n className={cn('text-base leading-snug font-medium group-data-[size=sm]/card:text-sm', className)}\n {...props}\n />\n );\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"card-description\" className={cn('text-muted-foreground text-sm', className)} {...props} />;\n}\n\nfunction CardAction({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className)}\n {...props}\n />\n );\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"card-content\" className={cn('px-(--card-spacing)', className)} {...props} />;\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn('bg-muted/50 flex items-center rounded-b-xl border-t p-(--card-spacing)', className)}\n {...props}\n />\n );\n}\n\nexport { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };\nexport type ___verifyContract = React.ComponentProps<typeof Card> extends CardBaseProps ? true : false;\n"],"mappings":";;;;;AAIA,SAASG,EAAK,EAAE,c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@@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-DbbDpzbe.js"),t=require("./vendor-Ceu--gxM.js"),n=require("./button.cjs");let r=require("react");r=e.r(r);var i=t.Ar(),a=r.createContext(null);function o(){let e=r.useContext(a);if(!e)throw Error(`useCarousel must be used within a <Carousel />`);return e}function s({orientation:e=`horizontal`,opts:n,setApi:o,plugins:s,className:c,children:l,...u}){let[d,f]=t.z({...n,axis:e===`horizontal`?`x`:`y`},s),[p,m]=r.useState(!1),[h,g]=r.useState(!1),_=r.useCallback(e=>{e&&(m(e.canScrollPrev()),g(e.canScrollNext()))},[]),v=r.useCallback(()=>{f?.scrollPrev()},[f]),y=r.useCallback(()=>{f?.scrollNext()},[f]),b=r.useCallback(e=>{e.key===`ArrowLeft`?(e.preventDefault(),v()):e.key===`ArrowRight`&&(e.preventDefault(),y())},[v,y]);return r.useEffect(()=>{f&&o&&o(f)},[f,o]),r.useEffect(()=>{if(f)return _(f),f.on(`reInit`,_),f.on(`select`,_),()=>{f?.off(`select`,_)}},[f,_]),(0,i.jsx)(a.Provider,{value:{carouselRef:d,api:f,opts:n,orientation:e||(n?.axis===`y`?`vertical`:`horizontal`),scrollPrev:v,scrollNext:y,canScrollPrev:p,canScrollNext:h},children:(0,i.jsx)(`section`,{onKeyDownCapture:b,className:t.ei(`relative`,c),"aria-roledescription":`carousel`,"data-slot":`carousel`,...u,children:l})})}function c({className:e,...n}){let{carouselRef:r,orientation:a}=o();return(0,i.jsx)(`div`,{ref:r,className:`overflow-hidden`,"data-slot":`carousel-content`,children:(0,i.jsx)(`div`,{className:t.ei(`flex`,a===`horizontal`?`-ms-4`:`-mt-4 flex-col`,e),...n})})}function l({className:e,...n}){let{orientation:r}=o();return(0,i.jsx)(`fieldset`,{"aria-roledescription":`slide`,"data-slot":`carousel-item`,className:t.ei(`min-w-0 shrink-0 grow-0 basis-full`,r===`horizontal`?`ps-4`:`pt-4`,e),...n})}function u({className:e,variant:r=`outline`,size:a=`icon-sm`,...s}){let{orientation:c,scrollPrev:l,canScrollPrev:u}=o();return(0,i.jsxs)(n.Button,{"data-slot":`carousel-previous`,variant:r,size:a,className:t.ei(`absolute touch-manipulation rounded-full`,c===`horizontal`?`inset-y-0 -start-12 my-auto`:`start-1/2 -top-12 -translate-x-1/2 rotate-90 rtl:translate-x-1/2`,e),disabled:!u,onClick:l,...s,children:[(0,i.jsx)(t.Yr,{className:`rtl:rotate-180`}),(0,i.jsx)(`span`,{className:`sr-only`,children:`Previous slide`})]})}function d({className:e,variant:r=`outline`,size:a=`icon-sm`,...s}){let{orientation:c,scrollNext:l,canScrollNext:u}=o();return(0,i.jsxs)(n.Button,{"data-slot":`carousel-next`,variant:r,size:a,className:t.ei(`absolute touch-manipulation rounded-full`,c===`horizontal`?`inset-y-0 -end-12 my-auto`:`start-1/2 -bottom-12 -translate-x-1/2 rotate-90 rtl:translate-x-1/2`,e),disabled:!u,onClick:l,...s,children:[(0,i.jsx)(t.Jr,{className:`rtl:rotate-180`}),(0,i.jsx)(`span`,{className:`sr-only`,children:`Next slide`})]})}exports.Carousel=s,exports.CarouselContent=c,exports.CarouselItem=l,exports.CarouselNext=d,exports.CarouselPrevious=u,exports.useCarousel=o;
|
|
2
2
|
//# sourceMappingURL=carousel.cjs.map
|
package/dist/carousel.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.cjs","names":[],"sources":["../packages/ui-web/src/carousel.tsx"],"sourcesContent":["import type { CarouselBaseProps } from '@gv-tech/ui-core';\nimport { cn } from 'cn';\nimport useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';\nimport { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport * as React from 'react';\n\nimport { Button } from '@/./button';\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\n\ntype CarouselProps = {\n opts?: CarouselOptions;\n plugins?: CarouselPlugin;\n orientation?: 'horizontal' | 'vertical';\n setApi?: (api: CarouselApi) => void;\n};\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0];\n api: ReturnType<typeof useEmblaCarousel>[1];\n scrollPrev: () => void;\n scrollNext: () => void;\n canScrollPrev: boolean;\n canScrollNext: boolean;\n} & CarouselProps;\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null);\n\nfunction useCarousel() {\n const context = React.useContext(CarouselContext);\n\n if (!context) {\n throw new Error('useCarousel must be used within a <Carousel />');\n }\n\n return context;\n}\n\nfunction Carousel({\n orientation = 'horizontal',\n opts,\n setApi,\n plugins,\n className,\n children,\n ...props\n}: React.ComponentProps<'section'> & CarouselProps) {\n const [carouselRef, api] = useEmblaCarousel(\n {\n ...opts,\n axis: orientation === 'horizontal' ? 'x' : 'y',\n },\n plugins,\n );\n const [canScrollPrev, setCanScrollPrev] = React.useState(false);\n const [canScrollNext, setCanScrollNext] = React.useState(false);\n\n const onSelect = React.useCallback((api: CarouselApi) => {\n if (!api) {\n return;\n }\n setCanScrollPrev(api.canScrollPrev());\n setCanScrollNext(api.canScrollNext());\n }, []);\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev();\n }, [api]);\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext();\n }, [api]);\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLElement>) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n scrollPrev();\n } else if (event.key === 'ArrowRight') {\n event.preventDefault();\n scrollNext();\n }\n },\n [scrollPrev, scrollNext],\n );\n\n React.useEffect(() => {\n if (!api || !setApi) {\n return;\n }\n setApi(api);\n }, [api, setApi]);\n\n React.useEffect(() => {\n if (!api) {\n return;\n }\n // Sync parent with the initial selection on subscribe (external store sync)\n // eslint-disable-next-line react/set-state-in-effect\n onSelect(api);\n api.on('reInit', onSelect);\n api.on('select', onSelect);\n\n return () => {\n api?.off('select', onSelect);\n };\n }, [api, onSelect]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api: api,\n opts,\n orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <section\n onKeyDownCapture={handleKeyDown}\n className={cn('relative', className)}\n aria-roledescription=\"carousel\"\n data-slot=\"carousel\"\n {...props}\n >\n {children}\n </section>\n </CarouselContext.Provider>\n );\n}\n\nfunction CarouselContent({ className, ...props }: React.ComponentProps<'div'>) {\n const { carouselRef, orientation } = useCarousel();\n\n return (\n <div ref={carouselRef} className=\"overflow-hidden\" data-slot=\"carousel-content\">\n <div className={cn('flex', orientation === 'horizontal' ? '-ms-4' : '-mt-4 flex-col', className)} {...props} />\n </div>\n );\n}\n\nfunction CarouselItem({ className, ...props }: React.ComponentProps<'fieldset'>) {\n const { orientation } = useCarousel();\n\n return (\n <fieldset\n aria-roledescription=\"slide\"\n data-slot=\"carousel-item\"\n className={cn('min-w-0 shrink-0 grow-0 basis-full', orientation === 'horizontal' ? 'ps-4' : 'pt-4', className)}\n {...props}\n />\n );\n}\n\nfunction CarouselPrevious({\n className,\n variant = 'outline',\n size = 'icon-sm',\n ...props\n}: React.ComponentProps<typeof Button>) {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel();\n\n return (\n <Button\n data-slot=\"carousel-previous\"\n variant={variant}\n size={size}\n className={cn(\n 'absolute touch-manipulation rounded-full',\n orientation === 'horizontal'\n ? 'inset-y-0 -start-12 my-auto'\n : 'start-1/2 -top-12 -translate-x-1/2 rotate-90 rtl:translate-x-1/2',\n className,\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n <ChevronLeftIcon className=\"rtl:rotate-180\" />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n );\n}\n\nfunction CarouselNext({\n className,\n variant = 'outline',\n size = 'icon-sm',\n ...props\n}: React.ComponentProps<typeof Button>) {\n const { orientation, scrollNext, canScrollNext } = useCarousel();\n\n return (\n <Button\n data-slot=\"carousel-next\"\n variant={variant}\n size={size}\n className={cn(\n 'absolute touch-manipulation rounded-full',\n orientation === 'horizontal'\n ? 'inset-y-0 -end-12 my-auto'\n : 'start-1/2 -bottom-12 -translate-x-1/2 rotate-90 rtl:translate-x-1/2',\n className,\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n <ChevronRightIcon className=\"rtl:rotate-180\" />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n );\n}\n\nexport { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel, type CarouselApi };\n\n// Verify that the component satisfies the ui-core contract\nexport type ___verifyCarouselContract = React.ComponentProps<typeof Carousel> extends CarouselBaseProps ? true : false;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"carousel.cjs","names":["React","useEmblaCarousel","cn","Button","ChevronLeftIcon","ChevronRightIcon","require_rolldown_runtime","require_vendor","require_button","react","import_jsx_runtime","CarouselContext","useCarousel","context","Carousel","props","carouselRef","api","opts","orientation","plugins","canScrollPrev","setCanScrollPrev","canScrollNext","setCanScrollNext","onSelect","scrollPrev","scrollNext","handleKeyDown","event","setApi","className","CarouselContent","CarouselItem","CarouselPrevious","CarouselNext"],"sources":["../packages/ui-web/src/carousel.tsx"],"sourcesContent":["import type { CarouselBaseProps } from '@gv-tech/ui-core';\nimport { cn } from 'cn';\nimport useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';\nimport { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport * as React from 'react';\n\nimport { Button } from '@/./button';\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\n\ntype CarouselProps = {\n opts?: CarouselOptions;\n plugins?: CarouselPlugin;\n orientation?: 'horizontal' | 'vertical';\n setApi?: (api: CarouselApi) => void;\n};\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0];\n api: ReturnType<typeof useEmblaCarousel>[1];\n scrollPrev: () => void;\n scrollNext: () => void;\n canScrollPrev: boolean;\n canScrollNext: boolean;\n} & CarouselProps;\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null);\n\nfunction useCarousel() {\n const context = React.useContext(CarouselContext);\n\n if (!context) {\n throw new Error('useCarousel must be used within a <Carousel />');\n }\n\n return context;\n}\n\nfunction Carousel({\n orientation = 'horizontal',\n opts,\n setApi,\n plugins,\n className,\n children,\n ...props\n}: React.ComponentProps<'section'> & CarouselProps) {\n const [carouselRef, api] = useEmblaCarousel(\n {\n ...opts,\n axis: orientation === 'horizontal' ? 'x' : 'y',\n },\n plugins,\n );\n const [canScrollPrev, setCanScrollPrev] = React.useState(false);\n const [canScrollNext, setCanScrollNext] = React.useState(false);\n\n const onSelect = React.useCallback((api: CarouselApi) => {\n if (!api) {\n return;\n }\n setCanScrollPrev(api.canScrollPrev());\n setCanScrollNext(api.canScrollNext());\n }, []);\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev();\n }, [api]);\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext();\n }, [api]);\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLElement>) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n scrollPrev();\n } else if (event.key === 'ArrowRight') {\n event.preventDefault();\n scrollNext();\n }\n },\n [scrollPrev, scrollNext],\n );\n\n React.useEffect(() => {\n if (!api || !setApi) {\n return;\n }\n setApi(api);\n }, [api, setApi]);\n\n React.useEffect(() => {\n if (!api) {\n return;\n }\n // Sync parent with the initial selection on subscribe (external store sync)\n // eslint-disable-next-line react/set-state-in-effect\n onSelect(api);\n api.on('reInit', onSelect);\n api.on('select', onSelect);\n\n return () => {\n api?.off('select', onSelect);\n };\n }, [api, onSelect]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api: api,\n opts,\n orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <section\n onKeyDownCapture={handleKeyDown}\n className={cn('relative', className)}\n aria-roledescription=\"carousel\"\n data-slot=\"carousel\"\n {...props}\n >\n {children}\n </section>\n </CarouselContext.Provider>\n );\n}\n\nfunction CarouselContent({ className, ...props }: React.ComponentProps<'div'>) {\n const { carouselRef, orientation } = useCarousel();\n\n return (\n <div ref={carouselRef} className=\"overflow-hidden\" data-slot=\"carousel-content\">\n <div className={cn('flex', orientation === 'horizontal' ? '-ms-4' : '-mt-4 flex-col', className)} {...props} />\n </div>\n );\n}\n\nfunction CarouselItem({ className, ...props }: React.ComponentProps<'fieldset'>) {\n const { orientation } = useCarousel();\n\n return (\n <fieldset\n aria-roledescription=\"slide\"\n data-slot=\"carousel-item\"\n className={cn('min-w-0 shrink-0 grow-0 basis-full', orientation === 'horizontal' ? 'ps-4' : 'pt-4', className)}\n {...props}\n />\n );\n}\n\nfunction CarouselPrevious({\n className,\n variant = 'outline',\n size = 'icon-sm',\n ...props\n}: React.ComponentProps<typeof Button>) {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel();\n\n return (\n <Button\n data-slot=\"carousel-previous\"\n variant={variant}\n size={size}\n className={cn(\n 'absolute touch-manipulation rounded-full',\n orientation === 'horizontal'\n ? 'inset-y-0 -start-12 my-auto'\n : 'start-1/2 -top-12 -translate-x-1/2 rotate-90 rtl:translate-x-1/2',\n className,\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n <ChevronLeftIcon className=\"rtl:rotate-180\" />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n );\n}\n\nfunction CarouselNext({\n className,\n variant = 'outline',\n size = 'icon-sm',\n ...props\n}: React.ComponentProps<typeof Button>) {\n const { orientation, scrollNext, canScrollNext } = useCarousel();\n\n return (\n <Button\n data-slot=\"carousel-next\"\n variant={variant}\n size={size}\n className={cn(\n 'absolute touch-manipulation rounded-full',\n orientation === 'horizontal'\n ? 'inset-y-0 -end-12 my-auto'\n : 'start-1/2 -bottom-12 -translate-x-1/2 rotate-90 rtl:translate-x-1/2',\n className,\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n <ChevronRightIcon className=\"rtl:rotate-180\" />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n );\n}\n\nexport { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel, type CarouselApi };\n\n// Verify that the component satisfies the ui-core contract\nexport type ___verifyCarouselContract = React.ComponentProps<typeof Carousel> extends CarouselBaseProps ? true : false;\n"],"mappings":"A,2OA6BMW,EAAkBX,EAAM,cAA2C,IAAI,EAE7E,SAASY,GAAc,CACrB,IAAMC,EAAUb,EAAM,WAAWW,CAAe,EAEhD,GAAI,CAACE,EACH,MAAU,MAAM,gDAAgD,EAGlE,OAAOA,CACT,CAEA,SAASC,EAAS,CAChB,cAAc,aACd,OACA,SACA,UACA,YACA,WACA,GAAGC,GAC+C,CAClD,GAAM,CAACC,EAAaC,GAAOhB,EAAAA,EACzB,CACE,GAAGiB,EACH,KAAMC,IAAgB,aAAe,IAAM,GAC7C,EACAC,CACF,EACM,CAACC,EAAeC,GAAoBtB,EAAM,SAAS,EAAK,EACxD,CAACuB,EAAeC,GAAoBxB,EAAM,SAAS,EAAK,EAExDyB,EAAWzB,EAAM,YAAa,GAAqB,CAClDiB,IAGLK,EAAiBL,EAAI,cAAc,CAAC,EACpCO,EAAiBP,EAAI,cAAc,CAAC,EACtC,EAAG,CAAC,CAAC,EAECS,EAAa1B,EAAM,gBAAkB,CACzCiB,GAAK,WAAW,CAClB,EAAG,CAACA,CAAG,CAAC,EAEFU,EAA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1
|
"use client";
|
|
2
|
-
import { Ar as e, Jr as t, Yr as n, ei as r, z as i } from "./vendor-
|
|
2
|
+
import { Ar as e, Jr as t, Yr as n, ei as r, z as i } from "./vendor-PEVwmg1D.mjs";
|
|
3
3
|
import { Button as a } from "./button.mjs";
|
|
4
4
|
import * as o from "react";
|
|
5
|
-
|
|
5
|
+
// packages/ui-web/src/carousel.tsx
|
|
6
6
|
var s = e(), c = o.createContext(null);
|
|
7
7
|
function l() {
|
|
8
8
|
let e = o.useContext(c);
|
|
@@ -23,7 +23,7 @@ function u({ orientation: e = "horizontal", opts: t, setApi: n, plugins: a, clas
|
|
|
23
23
|
e.key === "ArrowLeft" ? (e.preventDefault(), y()) : e.key === "ArrowRight" && (e.preventDefault(), b());
|
|
24
24
|
}, [y, b]);
|
|
25
25
|
return o.useEffect(() => {
|
|
26
|
-
|
|
26
|
+
p && n && n(p);
|
|
27
27
|
}, [p, n]), o.useEffect(() => {
|
|
28
28
|
if (p) return v(p), p.on("reInit", v), p.on("select", v), () => {
|
|
29
29
|
p?.off("select", v);
|
|
@@ -102,7 +102,6 @@ function m({ className: e, variant: n = "outline", size: i = "icon-sm", ...o })
|
|
|
102
102
|
})]
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
//#endregion
|
|
106
105
|
export { u as Carousel, d as CarouselContent, f as CarouselItem, m as CarouselNext, p as CarouselPrevious, l as useCarousel };
|
|
107
106
|
|
|
108
107
|
//# sourceMappingURL=carousel.mjs.map
|
package/dist/carousel.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.mjs","names":[],"sources":["../packages/ui-web/src/carousel.tsx"],"sourcesContent":["import type { CarouselBaseProps } from '@gv-tech/ui-core';\nimport { cn } from 'cn';\nimport useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';\nimport { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport * as React from 'react';\n\nimport { Button } from '@/./button';\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\n\ntype CarouselProps = {\n opts?: CarouselOptions;\n plugins?: CarouselPlugin;\n orientation?: 'horizontal' | 'vertical';\n setApi?: (api: CarouselApi) => void;\n};\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0];\n api: ReturnType<typeof useEmblaCarousel>[1];\n scrollPrev: () => void;\n scrollNext: () => void;\n canScrollPrev: boolean;\n canScrollNext: boolean;\n} & CarouselProps;\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null);\n\nfunction useCarousel() {\n const context = React.useContext(CarouselContext);\n\n if (!context) {\n throw new Error('useCarousel must be used within a <Carousel />');\n }\n\n return context;\n}\n\nfunction Carousel({\n orientation = 'horizontal',\n opts,\n setApi,\n plugins,\n className,\n children,\n ...props\n}: React.ComponentProps<'section'> & CarouselProps) {\n const [carouselRef, api] = useEmblaCarousel(\n {\n ...opts,\n axis: orientation === 'horizontal' ? 'x' : 'y',\n },\n plugins,\n );\n const [canScrollPrev, setCanScrollPrev] = React.useState(false);\n const [canScrollNext, setCanScrollNext] = React.useState(false);\n\n const onSelect = React.useCallback((api: CarouselApi) => {\n if (!api) {\n return;\n }\n setCanScrollPrev(api.canScrollPrev());\n setCanScrollNext(api.canScrollNext());\n }, []);\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev();\n }, [api]);\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext();\n }, [api]);\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLElement>) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n scrollPrev();\n } else if (event.key === 'ArrowRight') {\n event.preventDefault();\n scrollNext();\n }\n },\n [scrollPrev, scrollNext],\n );\n\n React.useEffect(() => {\n if (!api || !setApi) {\n return;\n }\n setApi(api);\n }, [api, setApi]);\n\n React.useEffect(() => {\n if (!api) {\n return;\n }\n // Sync parent with the initial selection on subscribe (external store sync)\n // eslint-disable-next-line react/set-state-in-effect\n onSelect(api);\n api.on('reInit', onSelect);\n api.on('select', onSelect);\n\n return () => {\n api?.off('select', onSelect);\n };\n }, [api, onSelect]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api: api,\n opts,\n orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <section\n onKeyDownCapture={handleKeyDown}\n className={cn('relative', className)}\n aria-roledescription=\"carousel\"\n data-slot=\"carousel\"\n {...props}\n >\n {children}\n </section>\n </CarouselContext.Provider>\n );\n}\n\nfunction CarouselContent({ className, ...props }: React.ComponentProps<'div'>) {\n const { carouselRef, orientation } = useCarousel();\n\n return (\n <div ref={carouselRef} className=\"overflow-hidden\" data-slot=\"carousel-content\">\n <div className={cn('flex', orientation === 'horizontal' ? '-ms-4' : '-mt-4 flex-col', className)} {...props} />\n </div>\n );\n}\n\nfunction CarouselItem({ className, ...props }: React.ComponentProps<'fieldset'>) {\n const { orientation } = useCarousel();\n\n return (\n <fieldset\n aria-roledescription=\"slide\"\n data-slot=\"carousel-item\"\n className={cn('min-w-0 shrink-0 grow-0 basis-full', orientation === 'horizontal' ? 'ps-4' : 'pt-4', className)}\n {...props}\n />\n );\n}\n\nfunction CarouselPrevious({\n className,\n variant = 'outline',\n size = 'icon-sm',\n ...props\n}: React.ComponentProps<typeof Button>) {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel();\n\n return (\n <Button\n data-slot=\"carousel-previous\"\n variant={variant}\n size={size}\n className={cn(\n 'absolute touch-manipulation rounded-full',\n orientation === 'horizontal'\n ? 'inset-y-0 -start-12 my-auto'\n : 'start-1/2 -top-12 -translate-x-1/2 rotate-90 rtl:translate-x-1/2',\n className,\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n <ChevronLeftIcon className=\"rtl:rotate-180\" />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n );\n}\n\nfunction CarouselNext({\n className,\n variant = 'outline',\n size = 'icon-sm',\n ...props\n}: React.ComponentProps<typeof Button>) {\n const { orientation, scrollNext, canScrollNext } = useCarousel();\n\n return (\n <Button\n data-slot=\"carousel-next\"\n variant={variant}\n size={size}\n className={cn(\n 'absolute touch-manipulation rounded-full',\n orientation === 'horizontal'\n ? 'inset-y-0 -end-12 my-auto'\n : 'start-1/2 -bottom-12 -translate-x-1/2 rotate-90 rtl:translate-x-1/2',\n className,\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n <ChevronRightIcon className=\"rtl:rotate-180\" />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n );\n}\n\nexport { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel, type CarouselApi };\n\n// Verify that the component satisfies the ui-core contract\nexport type ___verifyCarouselContract = React.ComponentProps<typeof Carousel> extends CarouselBaseProps ? true : false;\n"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"carousel.mjs","names":["React","ChevronLeftIcon","ChevronRightIcon","require_jsx_runtime","ChevronRight","ChevronLeft","cn","useEmblaCarousel","React$1","import_jsx_runtime","CarouselContext","useCarousel","context","Carousel","props","carouselRef","api","opts","orientation","plugins","canScrollPrev","setCanScrollPrev","canScrollNext","setCanScrollNext","onSelect","scrollPrev","scrollNext","handleKeyDown","event","setApi","className","CarouselContent","CarouselItem","CarouselPrevious","Button","CarouselNext"],"sources":["../packages/ui-web/src/carousel.tsx"],"sourcesContent":["import type { CarouselBaseProps } from '@gv-tech/ui-core';\nimport { cn } from 'cn';\nimport useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';\nimport { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport * as React from 'react';\n\nimport { Button } from '@/./button';\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\n\ntype CarouselProps = {\n opts?: CarouselOptions;\n plugins?: CarouselPlugin;\n orientation?: 'horizontal' | 'vertical';\n setApi?: (api: CarouselApi) => void;\n};\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0];\n api: ReturnType<typeof useEmblaCarousel>[1];\n scrollPrev: () => void;\n scrollNext: () => void;\n canScrollPrev: boolean;\n canScrollNext: boolean;\n} & CarouselProps;\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null);\n\nfunction useCarousel() {\n const context = React.useContext(CarouselContext);\n\n if (!context) {\n throw new Error('useCarousel must be used within a <Carousel />');\n }\n\n return context;\n}\n\nfunction Carousel({\n orientation = 'horizontal',\n opts,\n setApi,\n plugins,\n className,\n children,\n ...props\n}: React.ComponentProps<'section'> & CarouselProps) {\n const [carouselRef, api] = useEmblaCarousel(\n {\n ...opts,\n axis: orientation === 'horizontal' ? 'x' : 'y',\n },\n plugins,\n );\n const [canScrollPrev, setCanScrollPrev] = React.useState(false);\n const [canScrollNext, setCanScrollNext] = React.useState(false);\n\n const onSelect = React.useCallback((api: CarouselApi) => {\n if (!api) {\n return;\n }\n setCanScrollPrev(api.canScrollPrev());\n setCanScrollNext(api.canScrollNext());\n }, []);\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev();\n }, [api]);\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext();\n }, [api]);\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLElement>) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n scrollPrev();\n } else if (event.key === 'ArrowRight') {\n event.preventDefault();\n scrollNext();\n }\n },\n [scrollPrev, scrollNext],\n );\n\n React.useEffect(() => {\n if (!api || !setApi) {\n return;\n }\n setApi(api);\n }, [api, setApi]);\n\n React.useEffect(() => {\n if (!api) {\n return;\n }\n // Sync parent with the initial selection on subscribe (external store sync)\n // eslint-disable-next-line react/set-state-in-effect\n onSelect(api);\n api.on('reInit', onSelect);\n api.on('select', onSelect);\n\n return () => {\n api?.off('select', onSelect);\n };\n }, [api, onSelect]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api: api,\n opts,\n orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <section\n onKeyDownCapture={handleKeyDown}\n className={cn('relative', className)}\n aria-roledescription=\"carousel\"\n data-slot=\"carousel\"\n {...props}\n >\n {children}\n </section>\n </CarouselContext.Provider>\n );\n}\n\nfunction CarouselContent({ className, ...props }: React.ComponentProps<'div'>) {\n const { carouselRef, orientation } = useCarousel();\n\n return (\n <div ref={carouselRef} className=\"overflow-hidden\" data-slot=\"carousel-content\">\n <div className={cn('flex', orientation === 'horizontal' ? '-ms-4' : '-mt-4 flex-col', className)} {...props} />\n </div>\n );\n}\n\nfunction CarouselItem({ className, ...props }: React.ComponentProps<'fieldset'>) {\n const { orientation } = useCarousel();\n\n return (\n <fieldset\n aria-roledescription=\"slide\"\n data-slot=\"carousel-item\"\n className={cn('min-w-0 shrink-0 grow-0 basis-full', orientation === 'horizontal' ? 'ps-4' : 'pt-4', className)}\n {...props}\n />\n );\n}\n\nfunction CarouselPrevious({\n className,\n variant = 'outline',\n size = 'icon-sm',\n ...props\n}: React.ComponentProps<typeof Button>) {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel();\n\n return (\n <Button\n data-slot=\"carousel-previous\"\n variant={variant}\n size={size}\n className={cn(\n 'absolute touch-manipulation rounded-full',\n orientation === 'horizontal'\n ? 'inset-y-0 -start-12 my-auto'\n : 'start-1/2 -top-12 -translate-x-1/2 rotate-90 rtl:translate-x-1/2',\n className,\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n <ChevronLeftIcon className=\"rtl:rotate-180\" />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n );\n}\n\nfunction CarouselNext({\n className,\n variant = 'outline',\n size = 'icon-sm',\n ...props\n}: React.ComponentProps<typeof Button>) {\n const { orientation, scrollNext, canScrollNext } = useCarousel();\n\n return (\n <Button\n data-slot=\"carousel-next\"\n variant={variant}\n size={size}\n className={cn(\n 'absolute touch-manipulation rounded-full',\n orientation === 'horizontal'\n ? 'inset-y-0 -end-12 my-auto'\n : 'start-1/2 -bottom-12 -translate-x-1/2 rotate-90 rtl:translate-x-1/2',\n className,\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n <ChevronRightIcon className=\"rtl:rotate-180\" />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n );\n}\n\nexport { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel, type CarouselApi };\n\n// Verify that the component satisfies the ui-core contract\nexport type ___verifyCarouselContract = React.ComponentProps<typeof Carousel> extends CarouselBaseProps ? true : false;\n"],"mappings":";;;;;A,aA6BMU,IAAkBV,EAAM,cAA2C,IAAI;AAE7E,SAASW,IAAc;CACrB,IAAMC,IAAUZ,EAAM,WAAWU,CAAe;CAEhD,IAAI,CAACE,GACH,MAAU,MAAM,gDAAgD;CAGlE,OAAOA;AACT;AAEA,SAASC,EAAS,EAChB,iBAAc,cACd,SACA,WACA,YACA,cACA,aACA,GAAGC,KAC+C;CAClD,IAAM,CAACC,GAAaC,KAAOT,EACzB;EACE,GAAGU;EACH,MAAMC,MAAgB,eAAe,MAAM;CAC7C,GACAC,CACF,GACM,CAACC,GAAeC,KAAoBrB,EAAM,SAAS,EAAK,GACxD,CAACsB,GAAeC,KAAoBvB,EAAM,SAAS,EAAK,GAExDwB,IAAWxB,EAAM,aAAa,MAAqB;EACvD,AAAKgB,MAGLK,EAAiBL,EAAI,cAAc,CAAC,GACpCO,EAAiBP,EAAI,cAAc,CAAC;CACtC,GAAG,CAAC,CAAC,GAECS,IAAazB,EAAM,kBAAkB;EACzC,GAAK,WAAW;CA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EZ"}
|
package/dist/chart.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-
|
|
1
|
+
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-DbbDpzbe.js"),t=require("./vendor-Ceu--gxM.js");let n=require("react");n=e.r(n);var r=t.Ar(),i={light:``,dark:`.dark`},a={width:320,height:200},o=n.createContext(null);function s(){let e=n.useContext(o);if(!e)throw Error(`useChart must be used within a <ChartContainer />`);return e}function c({id:e,className:i,children:s,config:c,initialDimension:u=a,...d}){let f=n.useId(),p=`chart-${e??f.replace(/:/g,``)}`;return(0,r.jsx)(o.Provider,{value:{config:c},children:(0,r.jsxs)(`div`,{"data-slot":`chart`,"data-chart":p,className:t.ei(`[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden`,i),...d,children:[(0,r.jsx)(l,{id:p,config:c}),(0,r.jsx)(t.R,{initialDimension:u,children:s})]})})}var l=({id:e,config:t})=>{let n=Object.entries(t).filter(([,e])=>e.theme??e.color);return n.length?(0,r.jsx)(`style`,{dangerouslySetInnerHTML:{__html:Object.entries(i).map(([t,r])=>`
|
|
2
2
|
${r} [data-chart=${e}] {
|
|
3
3
|
${n.map(([e,n])=>{let r=n.theme?.[t]??n.color;return r?` --color-${e}: ${r};`:null}).join(`
|
|
4
4
|
`)}
|
|
5
5
|
}
|
|
6
6
|
`).join(`
|
|
7
|
-
`)}}):null},u=t.I;function d({active:e,payload:i,className:a,indicator:o=`dot`,hideLabel:c=!1,hideIndicator:l=!1,label:u,labelFormatter:d,labelClassName:f,formatter:p,color:h,nameKey:g,labelKey:_}){let{config:v}=s(),y=n.useMemo(()=>{if(c||!i?.length)return null;let[e]=i,n
|
|
7
|
+
`)}}):null},u=t.I;function d({active:e,payload:i,className:a,indicator:o=`dot`,hideLabel:c=!1,hideIndicator:l=!1,label:u,labelFormatter:d,labelClassName:f,formatter:p,color:h,nameKey:g,labelKey:_}){let{config:v}=s(),y=n.useMemo(()=>{if(c||!i?.length)return null;let[e]=i,n=`${_??e?.dataKey??e?.name??`value`}`,a=m(v,e,n),o=!_&&typeof u==`string`?v[u]?.label??u:a?.label;return d?(0,r.jsx)(`div`,{className:t.ei(`font-medium`,f),children:d(o,i)}):o?(0,r.jsx)(`div`,{className:t.ei(`font-medium`,f),children:o}):null},[u,d,i,c,f,v,_]);if(!e||!i?.length)return null;let b=i.length===1&&o!==`dot`;return(0,r.jsxs)(`div`,{className:t.ei(`border-border/50 bg-background grid min-w-32 items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl`,a),children:[b?null:y,(0,r.jsx)(`div`,{className:`grid gap-1.5`,children:i.filter(e=>e.type!==`none`).map((e,n)=>{let i=`${g??e.name??e.dataKey??`value`}`,a=m(v,e,i),s=h??e.payload?.fill??e.color;return(0,r.jsx)(`div`,{className:t.ei(`[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5`,o===`dot`&&`items-center`),children:p&&e?.value!==void 0&&e.name?p(e.value,e.name,e,n,e.payload):(0,r.jsxs)(r.Fragment,{children:[a?.icon?(0,r.jsx)(a.icon,{}):!l&&(0,r.jsx)(`div`,{className:t.ei(`shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)`,{"h-2.5 w-2.5":o===`dot`,"w-1":o===`line`,"w-0 border-[1.5px] border-dashed bg-transparent":o===`dashed`,"my-0.5":b&&o===`dashed`}),style:{"--color-bg":s,"--color-border":s}}),(0,r.jsxs)(`div`,{className:t.ei(`flex flex-1 justify-between leading-none`,b?`items-end`:`items-center`),children:[(0,r.jsxs)(`div`,{className:`grid gap-1.5`,children:[b?y:null,(0,r.jsx)(`span`,{className:`text-muted-foreground`,children:a?.label??e.name})]}),e.value!=null&&(0,r.jsx)(`span`,{className:`text-foreground font-mono font-medium tabular-nums`,children:typeof e.value==`number`?e.value.toLocaleString():String(e.value)})]})]})},n)})})]})}var f=t.L;function p({className:e,hideIcon:n=!1,payload:i,verticalAlign:a=`bottom`,nameKey:o}){let{config:c}=s();return i?.length?(0,r.jsx)(`div`,{className:t.ei(`flex items-center justify-center gap-4`,a===`top`?`pb-3`:`pt-3`,e),children:i.filter(e=>e.type!==`none`).map((e,i)=>{let a=`${o??e.dataKey??`value`}`,s=m(c,e,a);return(0,r.jsxs)(`div`,{className:t.ei(`[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3`),children:[s?.icon&&!n?(0,r.jsx)(s.icon,{}):(0,r.jsx)(`div`,{className:`h-2 w-2 shrink-0 rounded-[2px]`,style:{backgroundColor:e.color}}),s?.label]},i)})}):null}function m(e,t,n){if(typeof t!=`object`||!t)return;let r=`payload`in t&&typeof t.payload==`object`&&t.payload!==null?t.payload:void 0,i=n;return n in t&&typeof t[n]==`string`?i=t[n]:r&&n in r&&typeof r[n]==`string`&&(i=r[n]),i in e?e[i]:e[n]}exports.ChartContainer=c,exports.ChartLegend=f,exports.ChartLegendContent=p,exports.ChartStyle=l,exports.ChartTooltip=u,exports.ChartTooltipContent=d;
|
|
8
8
|
//# sourceMappingURL=chart.cjs.map
|
package/dist/chart.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.cjs","names":[],"sources":["../packages/ui-web/src/chart.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from 'cn';\nimport * as React from 'react';\nimport type { TooltipValueType } from 'recharts';\nimport * as RechartsPrimitive from 'recharts';\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: '', dark: '.dark' } as const;\n\nconst INITIAL_DIMENSION = { width: 320, height: 200 } as const;\ntype TooltipNameType = number | string;\n\nexport type ChartConfig = Record<\n string,\n {\n label?: React.ReactNode;\n icon?: React.ComponentType;\n } & ({ color?: string; theme?: never } | { color?: never; theme: Record<keyof typeof THEMES, string> })\n>;\n\ntype ChartContextProps = {\n config: ChartConfig;\n};\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null);\n\nfunction useChart() {\n const context = React.useContext(ChartContext);\n\n if (!context) {\n throw new Error('useChart must be used within a <ChartContainer />');\n }\n\n return context;\n}\n\nfunction ChartContainer({\n id,\n className,\n children,\n config,\n initialDimension = INITIAL_DIMENSION,\n ...props\n}: React.ComponentProps<'div'> & {\n config: ChartConfig;\n children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];\n initialDimension?: {\n width: number;\n height: number;\n };\n}) {\n const uniqueId = React.useId();\n const chartId = `chart-${id ?? uniqueId.replace(/:/g, '')}`;\n\n return (\n <ChartContext.Provider value={{ config }}>\n <div\n data-slot=\"chart\"\n data-chart={chartId}\n className={cn(\n \"[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden\",\n className,\n )}\n {...props}\n >\n <ChartStyle id={chartId} config={config} />\n <RechartsPrimitive.ResponsiveContainer initialDimension={initialDimension}>\n {children}\n </RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n );\n}\n\nconst ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {\n const colorConfig = Object.entries(config).filter(([, config]) => config.theme ?? config.color);\n\n if (!colorConfig.length) {\n return null;\n }\n\n return (\n <style\n dangerouslySetInnerHTML={{\n __html: Object.entries(THEMES)\n .map(\n ([theme, prefix]) => `\n${prefix} [data-chart=${id}] {\n${colorConfig\n .map(([key, itemConfig]) => {\n const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ?? itemConfig.color;\n return color ? ` --color-${key}: ${color};` : null;\n })\n .join('\\n')}\n}\n`,\n )\n .join('\\n'),\n }}\n />\n );\n};\n\nconst ChartTooltip = RechartsPrimitive.Tooltip;\n\nfunction ChartTooltipContent({\n active,\n payload,\n className,\n indicator = 'dot',\n hideLabel = false,\n hideIndicator = false,\n label,\n labelFormatter,\n labelClassName,\n formatter,\n color,\n nameKey,\n labelKey,\n}: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &\n React.ComponentProps<'div'> & {\n hideLabel?: boolean;\n hideIndicator?: boolean;\n indicator?: 'line' | 'dot' | 'dashed';\n nameKey?: string;\n labelKey?: string;\n } & Omit<RechartsPrimitive.DefaultTooltipContentProps<TooltipValueType, TooltipNameType>, 'accessibilityLayer'>) {\n const { config } = useChart();\n\n const tooltipLabel = React.useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null;\n }\n\n const [item] = payload;\n const key = `${labelKey ?? item?.dataKey ?? item?.name ?? 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const value = !labelKey && typeof label === 'string' ? (config[label]?.label ?? label) : itemConfig?.label;\n\n if (labelFormatter) {\n return <div className={cn('font-medium', labelClassName)}>{labelFormatter(value, payload)}</div>;\n }\n\n if (!value) {\n return null;\n }\n\n return <div className={cn('font-medium', labelClassName)}>{value}</div>;\n }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);\n\n if (!active || !payload?.length) {\n return null;\n }\n\n const nestLabel = payload.length === 1 && indicator !== 'dot';\n\n return (\n <div\n className={cn(\n 'border-border/50 bg-background grid min-w-32 items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl',\n className,\n )}\n >\n {!nestLabel ? tooltipLabel : null}\n <div className=\"grid gap-1.5\">\n {payload\n .filter((item) => item.type !== 'none')\n .map((item, index) => {\n const key = `${nameKey ?? item.name ?? item.dataKey ?? 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const indicatorColor = color ?? item.payload?.fill ?? item.color;\n\n return (\n <div\n key={index}\n className={cn(\n '[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5',\n indicator === 'dot' && 'items-center',\n )}\n >\n {formatter && item?.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, item.payload)\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n <div\n className={cn('shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)', {\n 'h-2.5 w-2.5': indicator === 'dot',\n 'w-1': indicator === 'line',\n 'w-0 border-[1.5px] border-dashed bg-transparent': indicator === 'dashed',\n 'my-0.5': nestLabel && indicator === 'dashed',\n })}\n style={\n {\n '--color-bg': indicatorColor,\n '--color-border': indicatorColor,\n } as React.CSSProperties\n }\n />\n )\n )}\n <div\n className={cn(\n 'flex flex-1 justify-between leading-none',\n nestLabel ? 'items-end' : 'items-center',\n )}\n >\n <div className=\"grid gap-1.5\">\n {nestLabel ? tooltipLabel : null}\n <span className=\"text-muted-foreground\">{itemConfig?.label ?? item.name}</span>\n </div>\n {item.value != null && (\n <span className=\"text-foreground font-mono font-medium tabular-nums\">\n {typeof item.value === 'number' ? item.value.toLocaleString() : String(item.value)}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n\nconst ChartLegend = RechartsPrimitive.Legend;\n\nfunction ChartLegendContent({\n className,\n hideIcon = false,\n payload,\n verticalAlign = 'bottom',\n nameKey,\n}: React.ComponentProps<'div'> & {\n hideIcon?: boolean;\n nameKey?: string;\n} & RechartsPrimitive.DefaultLegendContentProps) {\n const { config } = useChart();\n\n if (!payload?.length) {\n return null;\n }\n\n return (\n <div className={cn('flex items-center justify-center gap-4', verticalAlign === 'top' ? 'pb-3' : 'pt-3', className)}>\n {payload\n .filter((item) => item.type !== 'none')\n .map((item, index) => {\n const key = `${nameKey ?? item.dataKey ?? 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n\n return (\n <div\n key={index}\n className={cn('[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3')}\n >\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div\n className=\"h-2 w-2 shrink-0 rounded-[2px]\"\n style={{\n backgroundColor: item.color,\n }}\n />\n )}\n {itemConfig?.label}\n </div>\n );\n })}\n </div>\n );\n}\n\nfunction getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {\n if (typeof payload !== 'object' || payload === null) {\n return undefined;\n }\n\n const payloadPayload =\n 'payload' in payload && typeof payload.payload === 'object' && payload.payload !== null\n ? payload.payload\n : undefined;\n\n let configLabelKey: string = key;\n\n if (key in payload && typeof payload[key as keyof typeof payload] === 'string') {\n configLabelKey = payload[key as keyof typeof payload] as string;\n } else if (\n payloadPayload &&\n key in payloadPayload &&\n typeof payloadPayload[key as keyof typeof payloadPayload] === 'string'\n ) {\n configLabelKey = payloadPayload[key as keyof typeof payloadPayload] as string;\n }\n\n return configLabelKey in config ? config[configLabelKey] : config[key];\n}\n\nexport { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, 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sB,EAEhE,OACE,EAAA,EAAA,MAAC,MAAD,CAEE,UAAW,EAAA,GAAG,iFAAiF,WAFjG,CAIG,GAAY,MAAQ,CAAC,GACpB,EAAA,EAAA,KAAC,EAAW,KAAZ,CAAkB,CAAA,GAElB,EAAA,EAAA,KAAC,MAAD,CACE,UAAU,iCACV,MAAO,CACL,gBAAiB,EAAK,KACxB,CACD,CAAA,EAEF,GAAY,KACV,GAdE,CAcF,CAET,CAAC,CACA,CAAA,EA9BE,IAgCX,CAEA,SAAS,EAA4B,EAAqB,EAAkB,EAAa,CACvF,GAAI,OAAO,GAAY,WAAY,EACjC,OAGF,IAAM,EACJ,YAAa,GAAW,OAAO,EAAQ,SAAY,UAAY,EAAQ,UAAY,KAC/E,EAAQ,QACR,IAAA,GAEF,EAAyB,EAY7B,OAVI,KAAO,GAAW,OAAO,EAAQ,IAAiC,SACpE,EAAiB,EAAQ,GAEzB,GACA,KAAO,GACP,OAAO,EAAe,IAAwC,WAE9D,EAAiB,EAAe,IAG3B,KAAkB,EAAS,EAAO,GAAkB,EAAO,EACpE"}
|
|
1
|
+
{"version":3,"file":"chart.cjs","names":["React","cn","_Fragment","require_rolldown_runtime","require_vendor","react","import_jsx_runtime","THEMES","INITIAL_DIMENSION","ChartContext","useChart","context","ChartContainer","props","uniqueId","chartId","id","className","ChartStyle","colorConfig","config","theme","prefix","key","itemConfig","color","ChartTooltip","ChartTooltipContent","tooltipLabel","hideLabel","payload","item","labelKey","getPayloadConfigFromPayload","value","label","labelFormatter","labelClassName","active","nestLabel","indicator","nameKey","indicatorColor","formatter","index","hideIndicator","ChartLegend","ChartLegendContent","verticalAlign","hideIcon","payloadPayload","configLabelKey"],"sources":["../packages/ui-web/src/chart.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from 'cn';\nimport * as React from 'react';\nimport type { TooltipValueType } from 'recharts';\nimport * as RechartsPrimitive from 'recharts';\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: '', dark: '.dark' } as const;\n\nconst INITIAL_DIMENSION = { width: 320, height: 200 } as const;\ntype TooltipNameType = number | string;\n\nexport type ChartConfig = Record<\n string,\n {\n label?: React.ReactNode;\n icon?: React.ComponentType;\n } & ({ color?: string; theme?: never } | { color?: never; theme: Record<keyof typeof THEMES, string> })\n>;\n\ntype ChartContextProps = {\n config: ChartConfig;\n};\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null);\n\nfunction useChart() {\n const context = React.useContext(ChartContext);\n\n if (!context) {\n throw new Error('useChart must be used within a <ChartContainer />');\n }\n\n return context;\n}\n\nfunction ChartContainer({\n id,\n className,\n children,\n config,\n initialDimension = INITIAL_DIMENSION,\n ...props\n}: React.ComponentProps<'div'> & {\n config: ChartConfig;\n children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];\n initialDimension?: {\n width: number;\n height: number;\n };\n}) {\n const uniqueId = React.useId();\n const chartId = `chart-${id ?? uniqueId.replace(/:/g, '')}`;\n\n return (\n <ChartContext.Provider value={{ config }}>\n <div\n data-slot=\"chart\"\n data-chart={chartId}\n className={cn(\n \"[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden\",\n className,\n )}\n {...props}\n >\n <ChartStyle id={chartId} config={config} />\n <RechartsPrimitive.ResponsiveContainer initialDimension={initialDimension}>\n {children}\n </RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n );\n}\n\nconst ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {\n const colorConfig = Object.entries(config).filter(([, config]) => config.theme ?? config.color);\n\n if (!colorConfig.length) {\n return null;\n }\n\n return (\n <style\n dangerouslySetInnerHTML={{\n __html: Object.entries(THEMES)\n .map(\n ([theme, prefix]) => `\n${prefix} [data-chart=${id}] {\n${colorConfig\n .map(([key, itemConfig]) => {\n const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ?? itemConfig.color;\n return color ? ` --color-${key}: ${color};` : null;\n })\n .join('\\n')}\n}\n`,\n )\n .join('\\n'),\n }}\n />\n );\n};\n\nconst ChartTooltip = RechartsPrimitive.Tooltip;\n\nfunction ChartTooltipContent({\n active,\n payload,\n className,\n indicator = 'dot',\n hideLabel = false,\n hideIndicator = false,\n label,\n labelFormatter,\n labelClassName,\n formatter,\n color,\n nameKey,\n labelKey,\n}: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &\n React.ComponentProps<'div'> & {\n hideLabel?: boolean;\n hideIndicator?: boolean;\n indicator?: 'line' | 'dot' | 'dashed';\n nameKey?: string;\n labelKey?: string;\n } & Omit<RechartsPrimitive.DefaultTooltipContentProps<TooltipValueType, TooltipNameType>, 'accessibilityLayer'>) {\n const { config } = useChart();\n\n const tooltipLabel = React.useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null;\n }\n\n const [item] = payload;\n const key = `${labelKey ?? item?.dataKey ?? item?.name ?? 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const value = !labelKey && typeof label === 'string' ? (config[label]?.label ?? label) : itemConfig?.label;\n\n if (labelFormatter) {\n return <div className={cn('font-medium', labelClassName)}>{labelFormatter(value, payload)}</div>;\n }\n\n if (!value) {\n return null;\n }\n\n return <div className={cn('font-medium', labelClassName)}>{value}</div>;\n }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);\n\n if (!active || !payload?.length) {\n return null;\n }\n\n const nestLabel = payload.length === 1 && indicator !== 'dot';\n\n return (\n <div\n className={cn(\n 'border-border/50 bg-background grid min-w-32 items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl',\n className,\n )}\n >\n {!nestLabel ? tooltipLabel : null}\n <div className=\"grid gap-1.5\">\n {payload\n .filter((item) => item.type !== 'none')\n .map((item, index) => {\n const key = `${nameKey ?? item.name ?? item.dataKey ?? 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const indicatorColor = color ?? item.payload?.fill ?? item.color;\n\n return (\n <div\n key={index}\n className={cn(\n '[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5',\n indicator === 'dot' && 'items-center',\n )}\n >\n {formatter && item?.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, item.payload)\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n <div\n className={cn('shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)', {\n 'h-2.5 w-2.5': indicator === 'dot',\n 'w-1': indicator === 'line',\n 'w-0 border-[1.5px] border-dashed bg-transparent': indicator === 'dashed',\n 'my-0.5': nestLabel && indicator === 'dashed',\n })}\n style={\n {\n '--color-bg': indicatorColor,\n '--color-border': indicatorColor,\n } as React.CSSProperties\n }\n />\n )\n )}\n <div\n className={cn(\n 'flex flex-1 justify-between leading-none',\n nestLabel ? 'items-end' : 'items-center',\n )}\n >\n <div className=\"grid gap-1.5\">\n {nestLabel ? tooltipLabel : null}\n <span className=\"text-muted-foreground\">{itemConfig?.label ?? item.name}</span>\n </div>\n {item.value != null && (\n <span className=\"text-foreground font-mono font-medium tabular-nums\">\n {typeof item.value === 'number' ? item.value.toLocaleString() : String(item.value)}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n\nconst ChartLegend = RechartsPrimitive.Legend;\n\nfunction ChartLegendContent({\n className,\n hideIcon = false,\n payload,\n verticalAlign = 'bottom',\n nameKey,\n}: React.ComponentProps<'div'> & {\n hideIcon?: boolean;\n nameKey?: string;\n} & RechartsPrimitive.DefaultLegendContentProps) {\n const { config } = useChart();\n\n if (!payload?.length) {\n return null;\n }\n\n return (\n <div className={cn('flex items-center justify-center gap-4', verticalAlign === 'top' ? 'pb-3' : 'pt-3', className)}>\n {payload\n .filter((item) => item.type !== 'none')\n .map((item, index) => {\n const key = `${nameKey ?? item.dataKey ?? 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n\n return (\n <div\n key={index}\n className={cn('[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3')}\n >\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div\n className=\"h-2 w-2 shrink-0 rounded-[2px]\"\n style={{\n backgroundColor: item.color,\n }}\n />\n )}\n {itemConfig?.label}\n </div>\n );\n })}\n </div>\n );\n}\n\nfunction getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {\n if (typeof payload !== 'object' || payload === null) {\n return undefined;\n }\n\n const payloadPayload =\n 'payload' in payload && typeof payload.payload === 'object' && payload.payload !== null\n ? payload.payload\n : undefined;\n\n let configLabelKey: string = key;\n\n if (key in payload && typeof payload[key as keyof typeof payload] === 'string') {\n configLabelKey = payload[key as keyof typeof payload] as string;\n } else if (\n payloadPayload &&\n key in payloadPayload &&\n typeof payloadPayload[key as keyof typeof payloadPayload] === 'string'\n ) {\n configLabelKey = payloadPayload[key as keyof typeof payloadPayload] as string;\n }\n\n return configLabelKey in config ? config[configLabelKey] : config[key];\n}\n\nexport { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent };\n"],"mappings":"A,8NAQMO,EAAS,CAAE,MAAO,GAAI,KAAM,OAAQ,EAEpCC,EAAoB,CAAE,MAAO,IAAK,OAAQ,GAAI,EAe9CC,EAAeT,EAAM,cAAwC,IAAI,EAEvE,SAASU,GAAW,CAClB,IAA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ei as i } from "./vendor-
|
|
3
|
+
import { Ar as e, I as t, L as n, R as r, ei as i } from "./vendor-PEVwmg1D.mjs";
|
|
4
4
|
import * as a from "react";
|
|
5
|
-
|
|
5
|
+
// packages/ui-web/src/chart.tsx
|
|
6
6
|
var o = e(), s = {
|
|
7
7
|
light: "",
|
|
8
8
|
dark: ".dark"
|
|
@@ -48,13 +48,13 @@ ${n.map(([e, n]) => {
|
|
|
48
48
|
function m({ active: e, payload: t, className: n, indicator: r = "dot", hideLabel: s = !1, hideIndicator: c = !1, label: l, labelFormatter: d, labelClassName: f, formatter: p, color: m, nameKey: h, labelKey: g }) {
|
|
49
49
|
let { config: v } = u(), y = a.useMemo(() => {
|
|
50
50
|
if (s || !t?.length) return null;
|
|
51
|
-
let [e] = t, n =
|
|
51
|
+
let [e] = t, n = `${g ?? e?.dataKey ?? e?.name ?? "value"}`, r = _(v, e, n), a = !g && typeof l == "string" ? v[l]?.label ?? l : r?.label;
|
|
52
52
|
return d ? /* @__PURE__ */ (0, o.jsx)("div", {
|
|
53
53
|
className: i("font-medium", f),
|
|
54
|
-
children: d(
|
|
55
|
-
}) :
|
|
54
|
+
children: d(a, t)
|
|
55
|
+
}) : a ? /* @__PURE__ */ (0, o.jsx)("div", {
|
|
56
56
|
className: i("font-medium", f),
|
|
57
|
-
children:
|
|
57
|
+
children: a
|
|
58
58
|
}) : null;
|
|
59
59
|
}, [
|
|
60
60
|
l,
|
|
@@ -72,10 +72,10 @@ function m({ active: e, payload: t, className: n, indicator: r = "dot", hideLabe
|
|
|
72
72
|
children: [b ? null : y, /* @__PURE__ */ (0, o.jsx)("div", {
|
|
73
73
|
className: "grid gap-1.5",
|
|
74
74
|
children: t.filter((e) => e.type !== "none").map((e, t) => {
|
|
75
|
-
let n =
|
|
75
|
+
let n = `${h ?? e.name ?? e.dataKey ?? "value"}`, a = _(v, e, n), s = m ?? e.payload?.fill ?? e.color;
|
|
76
76
|
return /* @__PURE__ */ (0, o.jsx)("div", {
|
|
77
77
|
className: i("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5", r === "dot" && "items-center"),
|
|
78
|
-
children: p && e?.value !== void 0 && e.name ? p(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ (0, o.jsxs)(o.Fragment, { children: [
|
|
78
|
+
children: p && e?.value !== void 0 && e.name ? p(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ (0, o.jsxs)(o.Fragment, { children: [a?.icon ? /* @__PURE__ */ (0, o.jsx)(a.icon, {}) : !c && /* @__PURE__ */ (0, o.jsx)("div", {
|
|
79
79
|
className: i("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", {
|
|
80
80
|
"h-2.5 w-2.5": r === "dot",
|
|
81
81
|
"w-1": r === "line",
|
|
@@ -83,8 +83,8 @@ function m({ active: e, payload: t, className: n, indicator: r = "dot", hideLabe
|
|
|
83
83
|
"my-0.5": b && r === "dashed"
|
|
84
84
|
}),
|
|
85
85
|
style: {
|
|
86
|
-
"--color-bg":
|
|
87
|
-
"--color-border":
|
|
86
|
+
"--color-bg": s,
|
|
87
|
+
"--color-border": s
|
|
88
88
|
}
|
|
89
89
|
}), /* @__PURE__ */ (0, o.jsxs)("div", {
|
|
90
90
|
className: i("flex flex-1 justify-between leading-none", b ? "items-end" : "items-center"),
|
|
@@ -92,7 +92,7 @@ function m({ active: e, payload: t, className: n, indicator: r = "dot", hideLabe
|
|
|
92
92
|
className: "grid gap-1.5",
|
|
93
93
|
children: [b ? y : null, /* @__PURE__ */ (0, o.jsx)("span", {
|
|
94
94
|
className: "text-muted-foreground",
|
|
95
|
-
children:
|
|
95
|
+
children: a?.label ?? e.name
|
|
96
96
|
})]
|
|
97
97
|
}), e.value != null && /* @__PURE__ */ (0, o.jsx)("span", {
|
|
98
98
|
className: "text-foreground font-mono font-medium tabular-nums",
|
|
@@ -110,13 +110,13 @@ function g({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bot
|
|
|
110
110
|
return n?.length ? /* @__PURE__ */ (0, o.jsx)("div", {
|
|
111
111
|
className: i("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
|
|
112
112
|
children: n.filter((e) => e.type !== "none").map((e, n) => {
|
|
113
|
-
let r =
|
|
113
|
+
let r = `${a ?? e.dataKey ?? "value"}`, c = _(s, e, r);
|
|
114
114
|
return /* @__PURE__ */ (0, o.jsxs)("div", {
|
|
115
115
|
className: i("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
|
|
116
|
-
children: [
|
|
116
|
+
children: [c?.icon && !t ? /* @__PURE__ */ (0, o.jsx)(c.icon, {}) : /* @__PURE__ */ (0, o.jsx)("div", {
|
|
117
117
|
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
118
118
|
style: { backgroundColor: e.color }
|
|
119
|
-
}),
|
|
119
|
+
}), c?.label]
|
|
120
120
|
}, n);
|
|
121
121
|
})
|
|
122
122
|
}) : null;
|
|
@@ -126,7 +126,6 @@ function _(e, t, n) {
|
|
|
126
126
|
let r = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, i = n;
|
|
127
127
|
return n in t && typeof t[n] == "string" ? i = t[n] : r && n in r && typeof r[n] == "string" && (i = r[n]), i in e ? e[i] : e[n];
|
|
128
128
|
}
|
|
129
|
-
//#endregion
|
|
130
129
|
export { d as ChartContainer, h as ChartLegend, g as ChartLegendContent, f as ChartStyle, p as ChartTooltip, m as ChartTooltipContent };
|
|
131
130
|
|
|
132
131
|
//# sourceMappingURL=chart.mjs.map
|