@gv-tech/design-system 2.21.0 → 2.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.cjs.map +1 -1
- package/dist/accordion.mjs +2 -2
- 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 -2
- 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 -2
- 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 +1 -1
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.cjs.map +1 -1
- package/dist/avatar.mjs +2 -2
- package/dist/avatar.mjs.map +1 -1
- package/dist/badge.cjs +1 -1
- package/dist/badge.cjs.map +1 -1
- package/dist/badge.mjs +2 -2
- package/dist/badge.mjs.map +1 -1
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.cjs.map +1 -1
- package/dist/breadcrumb.mjs +2 -2
- package/dist/breadcrumb.mjs.map +1 -1
- package/dist/button.cjs +1 -1
- package/dist/button.cjs.map +1 -1
- package/dist/button.mjs +2 -2
- 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 -2
- 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 -2
- package/dist/card.mjs.map +1 -1
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.cjs.map +1 -1
- package/dist/carousel.mjs +2 -2
- package/dist/carousel.mjs.map +1 -1
- package/dist/chart.cjs +3 -3
- package/dist/chart.cjs.map +1 -1
- package/dist/chart.mjs +55 -45
- 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 -2
- package/dist/checkbox.mjs.map +1 -1
- package/dist/collapsible.cjs +1 -1
- package/dist/collapsible.mjs +1 -1
- package/dist/command.cjs +1 -1
- package/dist/command.cjs.map +1 -1
- package/dist/command.mjs +2 -2
- 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 -2
- 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 -2
- package/dist/dialog.mjs.map +1 -1
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.cjs.map +1 -1
- package/dist/drawer.mjs +2 -2
- 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 -2
- package/dist/dropdown-menu.mjs.map +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.cjs.map +1 -1
- package/dist/form.mjs +2 -2
- 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 -2
- package/dist/hover-card.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +4 -4
- package/dist/input.cjs +1 -1
- package/dist/input.cjs.map +1 -1
- package/dist/input.mjs +2 -2
- package/dist/input.mjs.map +1 -1
- package/dist/label.cjs +1 -1
- package/dist/label.cjs.map +1 -1
- package/dist/label.mjs +2 -2
- package/dist/label.mjs.map +1 -1
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.cjs.map +1 -1
- package/dist/menubar.mjs +2 -2
- package/dist/menubar.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 -2
- package/dist/navigation-menu.mjs.map +1 -1
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.cjs.map +1 -1
- package/dist/pagination.mjs +2 -2
- 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 -2
- 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 -2
- package/dist/progress.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 -2
- 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 -2
- package/dist/resizable.mjs.map +1 -1
- package/dist/{rolldown-runtime-C0IHAABJ.mjs → rolldown-runtime-CWhphoD1.mjs} +1 -1
- package/dist/rolldown-runtime-mLOUI7ql.js +1 -0
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.cjs.map +1 -1
- package/dist/scroll-area.mjs +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 -2
- 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 -2
- 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 -2
- package/dist/sheet.mjs.map +1 -1
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.cjs.map +1 -1
- package/dist/skeleton.mjs +2 -2
- 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 -2
- package/dist/slider.mjs.map +1 -1
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.cjs.map +1 -1
- package/dist/sonner.mjs +1 -1
- package/dist/sonner.mjs.map +1 -1
- package/dist/{src-B8AA-nU4.js → src-D3IDWqE2.js} +2 -2
- package/dist/{src-B8AA-nU4.js.map → src-D3IDWqE2.js.map} +1 -1
- package/dist/{src-C65A5RuY.mjs → src-N08I3kfW.mjs} +2 -2
- package/dist/{src-C65A5RuY.mjs.map → src-N08I3kfW.mjs.map} +1 -1
- package/dist/support-fab.cjs +1 -1
- package/dist/support-fab.cjs.map +1 -1
- package/dist/support-fab.mjs +2 -2
- 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 -2
- 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 +2 -2
- 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 -2
- 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 -2
- package/dist/tabs.mjs.map +1 -1
- package/dist/text.cjs +1 -1
- package/dist/text.cjs.map +1 -1
- package/dist/text.mjs +2 -2
- 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 -2
- 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 +1 -1
- package/dist/theme-provider.mjs.map +1 -1
- package/dist/{theme-toggle-DoAVRoyO.mjs → theme-toggle-B6QS2aTS.mjs} +3 -3
- package/dist/{theme-toggle-DoAVRoyO.mjs.map → theme-toggle-B6QS2aTS.mjs.map} +1 -1
- package/dist/theme-toggle-CbtfA8aG.js +2 -0
- package/dist/{theme-toggle-B8UiizQB.js.map → theme-toggle-CbtfA8aG.js.map} +1 -1
- package/dist/theme-toggle.cjs +1 -1
- package/dist/theme-toggle.mjs +1 -1
- package/dist/toast.cjs +1 -1
- package/dist/toast.cjs.map +1 -1
- package/dist/toast.mjs +2 -2
- package/dist/toast.mjs.map +1 -1
- package/dist/{toaster-DnZKPR-G.js → toaster-C-1djNvf.js} +2 -2
- package/dist/{toaster-DnZKPR-G.js.map → toaster-C-1djNvf.js.map} +1 -1
- package/dist/{toaster-BgZxvlTL.mjs → toaster-CEa33QUH.mjs} +2 -2
- package/dist/{toaster-BgZxvlTL.mjs.map → toaster-CEa33QUH.mjs.map} +1 -1
- package/dist/toaster.cjs +1 -1
- package/dist/toaster.mjs +1 -1
- package/dist/toggle-group.cjs +1 -1
- package/dist/toggle-group.cjs.map +1 -1
- package/dist/toggle-group.mjs +3 -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 +3 -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 -2
- package/dist/tooltip.mjs.map +1 -1
- package/dist/{utils-BtI8Nf6i.mjs → utils-BsD1_fYL.mjs} +2 -2
- package/dist/{utils-BtI8Nf6i.mjs.map → utils-BsD1_fYL.mjs.map} +1 -1
- package/dist/utils-DU-Y_pvO.js +2 -0
- package/dist/{utils-CbSX47LV.js.map → utils-DU-Y_pvO.js.map} +1 -1
- package/dist/{vendor-D3ZzLf8D.js → vendor-3cr8xz0x.js} +8 -8
- package/dist/{vendor-D3ZzLf8D.js.map → vendor-3cr8xz0x.js.map} +1 -1
- package/dist/{vendor-Cr0eKZrm.mjs → vendor-ChPUVHXi.mjs} +7 -6
- package/dist/{vendor-Cr0eKZrm.mjs.map → vendor-ChPUVHXi.mjs.map} +1 -1
- package/package.json +22 -22
- package/dist/rolldown-runtime-CacfPODE.js +0 -1
- package/dist/theme-toggle-B8UiizQB.js +0 -2
- package/dist/utils-CbSX47LV.js +0 -2
package/dist/calendar.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { Sn as e, ar as t, ir as n, rr as r, vr as i, xn as a } from "./vendor-
|
|
4
|
-
import { t as o } from "./utils-
|
|
3
|
+
import { Sn as e, ar as t, ir as n, rr as r, vr as i, xn as a } from "./vendor-ChPUVHXi.mjs";
|
|
4
|
+
import { t as o } from "./utils-BsD1_fYL.mjs";
|
|
5
5
|
import { Button as s, buttonVariants as c } from "./button.mjs";
|
|
6
6
|
import * as l from "react";
|
|
7
7
|
//#region packages/ui-web/src/calendar.tsx
|
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';\nimport { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport * as React from 'react';\nimport { DayButton, DayPicker, getDefaultClassNames } from 'react-day-picker';\n\nimport { CalendarBaseProps } from '@gv-tech/ui-core';\nimport { Button, buttonVariants } from './button';\nimport { cn } from './lib/utils';\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = 'label',\n buttonVariant = 'ghost',\n formatters,\n components,\n ...props\n}: React.ComponentProps<typeof DayPicker> &\n CalendarBaseProps & {\n buttonVariant?: React.ComponentProps<typeof Button>['variant'];\n }) {\n const defaultClassNames = getDefaultClassNames();\n\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n className={cn(\n 'bg-background group/calendar p-3 [--cell-size:2.5rem] [[data-slot=card-content]_&]:bg-transparent [[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 'relative',\n className,\n )}\n captionLayout={captionLayout}\n formatters={{\n formatMonthDropdown: (date) => date.toLocaleString('default', { 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(\n 'absolute inset-x-0 top-2 flex items-center justify-between pointer-events-none px-2',\n defaultClassNames.nav,\n ),\n button_previous: cn(\n buttonVariants({ variant: buttonVariant }),\n 'h-7 w-7 select-none p-0 aria-disabled:opacity-50 pointer-events-auto',\n defaultClassNames.button_previous,\n ),\n button_next: cn(\n buttonVariants({ variant: buttonVariant }),\n 'h-7 w-7 select-none p-0 aria-disabled:opacity-50 pointer-events-auto',\n defaultClassNames.button_next,\n ),\n month_caption: cn(\n 'flex h-[--cell-size] w-full items-center justify-center text-sm font-medium',\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(\n 'has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border',\n defaultClassNames.dropdown_root,\n ),\n dropdown: cn('bg-popover absolute inset-0 opacity-0', defaultClassNames.dropdown),\n caption_label: cn(\n 'select-none font-medium',\n captionLayout === 'label'\n ? 'text-sm'\n : '[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5',\n defaultClassNames.caption_label,\n ),\n table: 'w-full border-collapse grow',\n weekdays: cn('flex', defaultClassNames.weekdays),\n weekday: cn(\n 'text-muted-foreground pt-1 flex-1 select-none rounded-md text-[0.8rem] font-normal uppercase',\n defaultClassNames.weekday,\n ),\n week: cn('flex w-full mt-2', defaultClassNames.week),\n week_number_header: cn('w-[--cell-size] select-none', defaultClassNames.week_number_header),\n week_number: cn('text-muted-foreground select-none text-[0.8rem]', defaultClassNames.week_number),\n day: cn(\n 'group/day relative flex aspect-square h-10 w-10 select-none items-center justify-center p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md',\n defaultClassNames.day,\n ),\n range_start: cn('bg-accent rounded-l-md', defaultClassNames.range_start),\n range_middle: cn('rounded-none', defaultClassNames.range_middle),\n range_end: cn('bg-accent rounded-r-md', defaultClassNames.range_end),\n today: cn(\n 'bg-accent text-accent-foreground rounded-md 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', className)} {...props} />;\n }\n\n if (orientation === 'right') {\n return <ChevronRightIcon className={cn('size-4', className)} {...props} />;\n }\n\n return <ChevronDownIcon className={cn('size-4', className)} {...props} />;\n },\n DayButton: CalendarDayButton,\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({ className, day, modifiers, ...props }: React.ComponentProps<typeof DayButton>) {\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()}\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 'data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-full w-full min-w-[--cell-size] items-center justify-center 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-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md [&>span]:text-xs [&>span]:opacity-70',\n defaultClassNames.day,\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Calendar, CalendarDayButton };\nexport type { CalendarBaseProps as CalendarProps };\n"],"mappings":";;;;;;;;AASA,SAAS,EAAS,EAChB,cACA,eACA,qBAAkB,IAClB,mBAAgB,SAChB,mBAAgB,SAChB,eACA,eACA,GAAG,KAIA;CACH,IAAM,IAAoB,
|
|
1
|
+
{"version":3,"file":"calendar.mjs","names":[],"sources":["../packages/ui-web/src/calendar.tsx"],"sourcesContent":["'use client';\nimport { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';\nimport * as React from 'react';\nimport { DayButton, DayPicker, getDefaultClassNames } from 'react-day-picker';\n\nimport { CalendarBaseProps } from '@gv-tech/ui-core';\nimport { Button, buttonVariants } from './button';\nimport { cn } from './lib/utils';\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = 'label',\n buttonVariant = 'ghost',\n formatters,\n components,\n ...props\n}: React.ComponentProps<typeof DayPicker> &\n CalendarBaseProps & {\n buttonVariant?: React.ComponentProps<typeof Button>['variant'];\n }) {\n const defaultClassNames = getDefaultClassNames();\n\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n className={cn(\n 'bg-background group/calendar p-3 [--cell-size:2.5rem] [[data-slot=card-content]_&]:bg-transparent [[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 'relative',\n className,\n )}\n captionLayout={captionLayout}\n formatters={{\n formatMonthDropdown: (date) => date.toLocaleString('default', { 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(\n 'absolute inset-x-0 top-2 flex items-center justify-between pointer-events-none px-2',\n defaultClassNames.nav,\n ),\n button_previous: cn(\n buttonVariants({ variant: buttonVariant }),\n 'h-7 w-7 select-none p-0 aria-disabled:opacity-50 pointer-events-auto',\n defaultClassNames.button_previous,\n ),\n button_next: cn(\n buttonVariants({ variant: buttonVariant }),\n 'h-7 w-7 select-none p-0 aria-disabled:opacity-50 pointer-events-auto',\n defaultClassNames.button_next,\n ),\n month_caption: cn(\n 'flex h-[--cell-size] w-full items-center justify-center text-sm font-medium',\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(\n 'has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border',\n defaultClassNames.dropdown_root,\n ),\n dropdown: cn('bg-popover absolute inset-0 opacity-0', defaultClassNames.dropdown),\n caption_label: cn(\n 'select-none font-medium',\n captionLayout === 'label'\n ? 'text-sm'\n : '[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5',\n defaultClassNames.caption_label,\n ),\n table: 'w-full border-collapse grow',\n weekdays: cn('flex', defaultClassNames.weekdays),\n weekday: cn(\n 'text-muted-foreground pt-1 flex-1 select-none rounded-md text-[0.8rem] font-normal uppercase',\n defaultClassNames.weekday,\n ),\n week: cn('flex w-full mt-2', defaultClassNames.week),\n week_number_header: cn('w-[--cell-size] select-none', defaultClassNames.week_number_header),\n week_number: cn('text-muted-foreground select-none text-[0.8rem]', defaultClassNames.week_number),\n day: cn(\n 'group/day relative flex aspect-square h-10 w-10 select-none items-center justify-center p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md',\n defaultClassNames.day,\n ),\n range_start: cn('bg-accent rounded-l-md', defaultClassNames.range_start),\n range_middle: cn('rounded-none', defaultClassNames.range_middle),\n range_end: cn('bg-accent rounded-r-md', defaultClassNames.range_end),\n today: cn(\n 'bg-accent text-accent-foreground rounded-md 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', className)} {...props} />;\n }\n\n if (orientation === 'right') {\n return <ChevronRightIcon className={cn('size-4', className)} {...props} />;\n }\n\n return <ChevronDownIcon className={cn('size-4', className)} {...props} />;\n },\n DayButton: CalendarDayButton,\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({ className, day, modifiers, ...props }: React.ComponentProps<typeof DayButton>) {\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()}\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 'data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-full w-full min-w-[--cell-size] items-center justify-center 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-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md [&>span]:text-xs [&>span]:opacity-70',\n defaultClassNames.day,\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Calendar, CalendarDayButton };\nexport type { CalendarBaseProps as CalendarProps };\n"],"mappings":";;;;;;;;AASA,SAAS,EAAS,EAChB,cACA,eACA,qBAAkB,IAClB,mBAAgB,SAChB,mBAAgB,SAChB,eACA,eACA,GAAG,KAIA;CACH,IAAM,IAAoB,EAAqB;CAE/C,OACE,iBAAA,GAAA,EAAA,KAAC,GAAD;EACmB;EACjB,WAAW,EACT,oJACA,OAAO,GAAG,6CACV,OAAO,GAAG,iDACV,YACA,CACF;EACe;EACf,YAAY;GACV,sBAAsB,MAAS,EA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});const e=require(
|
|
1
|
+
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-mLOUI7ql.js"),t=require("./vendor-3cr8xz0x.js"),n=require("./utils-DU-Y_pvO.js");let r=require("react");r=e.r(r);var i=t.vr(),a=r.forwardRef(({className:e,...t},r)=>(0,i.jsx)(`div`,{ref:r,className:n.t(`bg-card text-card-foreground rounded-xl border shadow`,e),...t}));a.displayName=`Card`;var o=r.forwardRef(({className:e,...t},r)=>(0,i.jsx)(`div`,{ref:r,className:n.t(`flex flex-col space-y-1.5 p-6`,e),...t}));o.displayName=`CardHeader`;var s=r.forwardRef(({className:e,...t},r)=>(0,i.jsx)(`div`,{ref:r,className:n.t(`leading-none font-semibold tracking-tight`,e),...t}));s.displayName=`CardTitle`;var c=r.forwardRef(({className:e,...t},r)=>(0,i.jsx)(`div`,{ref:r,className:n.t(`text-muted-foreground text-sm`,e),...t}));c.displayName=`CardDescription`;var l=r.forwardRef(({className:e,...t},r)=>(0,i.jsx)(`div`,{ref:r,className:n.t(`p-6 pt-0`,e),...t}));l.displayName=`CardContent`;var u=r.forwardRef(({className:e,...t},r)=>(0,i.jsx)(`div`,{ref:r,className:n.t(`flex items-center p-6 pt-0`,e),...t}));u.displayName=`CardFooter`,exports.Card=a,exports.CardContent=l,exports.CardDescription=c,exports.CardFooter=u,exports.CardHeader=o,exports.CardTitle=s;
|
|
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":["'use client';\nimport * as React from 'react';\n\nimport type { CardBaseProps } from '@gv-tech/ui-core';\nimport { cn } from './lib/utils';\n\nexport interface CardProps extends React.HTMLAttributes<HTMLDivElement>, CardBaseProps {}\n\nconst Card = React.forwardRef<HTMLDivElement, CardProps>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn('bg-card text-card-foreground rounded-xl border shadow', className)} {...props} />\n));\nCard.displayName = 'Card';\n\nconst CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('flex flex-col space-y-1.5 p-6', className)} {...props} />\n ),\n);\nCardHeader.displayName = 'CardHeader';\n\nconst CardTitle = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('leading-none font-semibold tracking-tight', className)} {...props} />\n ),\n);\nCardTitle.displayName = 'CardTitle';\n\nconst CardDescription = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('text-muted-foreground text-sm', className)} {...props} />\n ),\n);\nCardDescription.displayName = 'CardDescription';\n\nconst CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => <div ref={ref} className={cn('p-6 pt-0', className)} {...props} />,\n);\nCardContent.displayName = 'CardContent';\n\nconst CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('flex items-center p-6 pt-0', className)} {...props} />\n ),\n);\nCardFooter.displayName = 'CardFooter';\n\nexport { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };\n"],"mappings":"+PAQM,EAAO,EAAM,YAAuC,CAAE,YAAW,GAAG,GAAS,KACjF,EAAA,EAAA,KAAC,MAAD,CAAU,MAAK,UAAW,EAAA,EAAG,wDAAyD,
|
|
1
|
+
{"version":3,"file":"card.cjs","names":[],"sources":["../packages/ui-web/src/card.tsx"],"sourcesContent":["'use client';\nimport * as React from 'react';\n\nimport type { CardBaseProps } from '@gv-tech/ui-core';\nimport { cn } from './lib/utils';\n\nexport interface CardProps extends React.HTMLAttributes<HTMLDivElement>, CardBaseProps {}\n\nconst Card = React.forwardRef<HTMLDivElement, CardProps>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn('bg-card text-card-foreground rounded-xl border shadow', className)} {...props} />\n));\nCard.displayName = 'Card';\n\nconst CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('flex flex-col space-y-1.5 p-6', className)} {...props} />\n ),\n);\nCardHeader.displayName = 'CardHeader';\n\nconst CardTitle = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('leading-none font-semibold tracking-tight', className)} {...props} />\n ),\n);\nCardTitle.displayName = 'CardTitle';\n\nconst CardDescription = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('text-muted-foreground text-sm', className)} {...props} />\n ),\n);\nCardDescription.displayName = 'CardDescription';\n\nconst CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => <div ref={ref} className={cn('p-6 pt-0', className)} {...props} />,\n);\nCardContent.displayName = 'CardContent';\n\nconst CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('flex items-center p-6 pt-0', className)} {...props} />\n ),\n);\nCardFooter.displayName = 'CardFooter';\n\nexport { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };\n"],"mappings":"+PAQM,EAAO,EAAM,YAAuC,CAAE,YAAW,GAAG,GAAS,KACjF,EAAA,EAAA,KAAC,MAAD,CAAU,MAAK,UAAW,EAAA,EAAG,wDAAyD,CAAS,EAAG,GAAI,CAAQ,CAAA,CAC/G,EACD,EAAK,YAAc,OAEnB,IAAM,EAAa,EAAM,YACtB,CAAE,YAAW,GAAG,GAAS,KACxB,EAAA,EAAA,KAAC,MAAD,CAAU,MAAK,UAAW,EAAA,EAAG,gCAAiC,CAAS,EAAG,GAAI,CAAQ,CAAA,CAE1F,EACA,EAAW,YAAc,aAEzB,IAAM,EAAY,EAAM,YACrB,CAAE,YAAW,GAAG,GAAS,KACxB,EAAA,EAAA,KAAC,MAAD,CAAU,MAAK,UAAW,EAAA,EAAG,4CAA6C,CAAS,EAAG,GAAI,CAAQ,CAAA,CAEtG,EACA,EAAU,YAAc,YAExB,IAAM,EAAkB,EAAM,YAC3B,CAAE,YAAW,GAAG,GAAS,KACxB,EAAA,EAAA,KAAC,MAAD,CAAU,MAAK,UAAW,EAAA,EAAG,gCAAiC,CAAS,EAAG,GAAI,CAAQ,CAAA,CAE1F,EACA,EAAgB,YAAc,kBAE9B,IAAM,EAAc,EAAM,YACvB,CAAE,YAAW,GAAG,GAAS,KAAQ,EAAA,EAAA,KAAC,MAAD,CAAU,MAAK,UAAW,EAAA,EAAG,WAAY,CAAS,EAAG,GAAI,CAAQ,CAAA,CACrG,EACA,EAAY,YAAc,cAE1B,IAAM,EAAa,EAAM,YACtB,CAAE,YAAW,GAAG,GAAS,KACxB,EAAA,EAAA,KAAC,MAAD,CAAU,MAAK,UAAW,EAAA,EAAG,6BAA8B,CAAS,EAAG,GAAI,CAAQ,CAAA,CAEvF,EACA,EAAW,YAAc"}
|
package/dist/card.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { vr as e } from "./vendor-
|
|
4
|
-
import { t } from "./utils-
|
|
3
|
+
import { vr as e } from "./vendor-ChPUVHXi.mjs";
|
|
4
|
+
import { t } from "./utils-BsD1_fYL.mjs";
|
|
5
5
|
import * as n from "react";
|
|
6
6
|
//#region packages/ui-web/src/card.tsx
|
|
7
7
|
var r = e(), i = n.forwardRef(({ className: e, ...n }, i) => /* @__PURE__ */ (0, r.jsx)("div", {
|
package/dist/card.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.mjs","names":[],"sources":["../packages/ui-web/src/card.tsx"],"sourcesContent":["'use client';\nimport * as React from 'react';\n\nimport type { CardBaseProps } from '@gv-tech/ui-core';\nimport { cn } from './lib/utils';\n\nexport interface CardProps extends React.HTMLAttributes<HTMLDivElement>, CardBaseProps {}\n\nconst Card = React.forwardRef<HTMLDivElement, CardProps>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn('bg-card text-card-foreground rounded-xl border shadow', className)} {...props} />\n));\nCard.displayName = 'Card';\n\nconst CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('flex flex-col space-y-1.5 p-6', className)} {...props} />\n ),\n);\nCardHeader.displayName = 'CardHeader';\n\nconst CardTitle = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('leading-none font-semibold tracking-tight', className)} {...props} />\n ),\n);\nCardTitle.displayName = 'CardTitle';\n\nconst CardDescription = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('text-muted-foreground text-sm', className)} {...props} />\n ),\n);\nCardDescription.displayName = 'CardDescription';\n\nconst CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => <div ref={ref} className={cn('p-6 pt-0', className)} {...props} />,\n);\nCardContent.displayName = 'CardContent';\n\nconst CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('flex items-center p-6 pt-0', className)} {...props} />\n ),\n);\nCardFooter.displayName = 'CardFooter';\n\nexport { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };\n"],"mappings":";;;;;;aAQM,IAAO,EAAM,YAAuC,EAAE,cAAW,GAAG,KAAS,MACjF,iBAAA,GAAA,EAAA,KAAC,OAAD;CAAU;CAAK,WAAW,EAAG,yDAAyD,
|
|
1
|
+
{"version":3,"file":"card.mjs","names":[],"sources":["../packages/ui-web/src/card.tsx"],"sourcesContent":["'use client';\nimport * as React from 'react';\n\nimport type { CardBaseProps } from '@gv-tech/ui-core';\nimport { cn } from './lib/utils';\n\nexport interface CardProps extends React.HTMLAttributes<HTMLDivElement>, CardBaseProps {}\n\nconst Card = React.forwardRef<HTMLDivElement, CardProps>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn('bg-card text-card-foreground rounded-xl border shadow', className)} {...props} />\n));\nCard.displayName = 'Card';\n\nconst CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('flex flex-col space-y-1.5 p-6', className)} {...props} />\n ),\n);\nCardHeader.displayName = 'CardHeader';\n\nconst CardTitle = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('leading-none font-semibold tracking-tight', className)} {...props} />\n ),\n);\nCardTitle.displayName = 'CardTitle';\n\nconst CardDescription = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('text-muted-foreground text-sm', className)} {...props} />\n ),\n);\nCardDescription.displayName = 'CardDescription';\n\nconst CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => <div ref={ref} className={cn('p-6 pt-0', className)} {...props} />,\n);\nCardContent.displayName = 'CardContent';\n\nconst CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('flex items-center p-6 pt-0', className)} {...props} />\n ),\n);\nCardFooter.displayName = 'CardFooter';\n\nexport { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };\n"],"mappings":";;;;;;aAQM,IAAO,EAAM,YAAuC,EAAE,cAAW,GAAG,KAAS,MACjF,iBAAA,GAAA,EAAA,KAAC,OAAD;CAAU;CAAK,WAAW,EAAG,yDAAyD,CAAS;CAAG,GAAI;AAAQ,CAAA,CAC/G;AACD,EAAK,cAAc;AAEnB,IAAM,IAAa,EAAM,YACtB,EAAE,cAAW,GAAG,KAAS,MACxB,iBAAA,GAAA,EAAA,KAAC,OAAD;CAAU;CAAK,WAAW,EAAG,iCAAiC,CAAS;CAAG,GAAI;AAAQ,CAAA,CAE1F;AACA,EAAW,cAAc;AAEzB,IAAM,IAAY,EAAM,YACrB,EAAE,cAAW,GAAG,KAAS,MACxB,iBAAA,GAAA,EAAA,KAAC,OAAD;CAAU;CAAK,WAAW,EAAG,6CAA6C,CAAS;CAAG,GAAI;AAAQ,CAAA,CAEtG;AACA,EAAU,cAAc;AAExB,IAAM,IAAkB,EAAM,YAC3B,EAAE,cAAW,GAAG,KAAS,MACxB,iBAAA,GAAA,EAAA,KAAC,OAAD;CAAU;CAAK,WAAW,EAAG,iCAAiC,CAAS;CAAG,GAAI;AAAQ,CAAA,CAE1F;AACA,EAAgB,cAAc;AAE9B,IAAM,IAAc,EAAM,YACvB,EAAE,cAAW,GAAG,KAAS,MAAQ,iBAAA,GAAA,EAAA,KAAC,OAAD;CAAU;CAAK,WAAW,EAAG,YAAY,CAAS;CAAG,GAAI;AAAQ,CAAA,CACrG;AACA,EAAY,cAAc;AAE1B,IAAM,IAAa,EAAM,YACtB,EAAE,cAAW,GAAG,KAAS,MACxB,iBAAA,GAAA,EAAA,KAAC,OAAD;CAAU;CAAK,WAAW,EAAG,8BAA8B,CAAS;CAAG,GAAI;AAAQ,CAAA,CAEvF;AACA,EAAW,cAAc"}
|
package/dist/carousel.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-mLOUI7ql.js"),t=require("./vendor-3cr8xz0x.js"),n=require("./utils-DU-Y_pvO.js"),r=require("./button.cjs");let i=require("react");i=e.r(i);var a=t.vr(),o=i.createContext(null);function s(){let e=i.useContext(o);if(!e)throw Error(`useCarousel must be used within a <Carousel />`);return e}var c=i.forwardRef(({orientation:e=`horizontal`,opts:r,setApi:s,plugins:c,className:l,children:u,...d},f)=>{let[p,m]=t.bn({...r,axis:e===`horizontal`?`x`:`y`},c),[h,g]=i.useState(!1),[_,v]=i.useState(!1),y=i.useCallback(e=>{e&&(g(e.canScrollPrev()),v(e.canScrollNext()))},[]),b=i.useCallback(()=>{m?.scrollPrev()},[m]),x=i.useCallback(()=>{m?.scrollNext()},[m]),S=i.useCallback(e=>{e.key===`ArrowLeft`?(e.preventDefault(),b()):e.key===`ArrowRight`&&(e.preventDefault(),x())},[b,x]);return i.useEffect(()=>{!m||!s||s(m)},[m,s]),i.useEffect(()=>{if(m)return y(m),m.on(`reInit`,y),m.on(`select`,y),()=>{m?.off(`select`,y)}},[m,y]),(0,a.jsx)(o.Provider,{value:{carouselRef:p,api:m,opts:r,orientation:e||(r?.axis===`y`?`vertical`:`horizontal`),scrollPrev:b,scrollNext:x,canScrollPrev:h,canScrollNext:_},children:(0,a.jsx)(`div`,{ref:f,onKeyDownCapture:S,className:n.t(`relative`,l),role:`region`,"aria-roledescription":`carousel`,...d,children:u})})});c.displayName=`Carousel`;var l=i.forwardRef(({className:e,...t},r)=>{let{carouselRef:i,orientation:o}=s();return(0,a.jsx)(`div`,{ref:i,className:`overflow-hidden`,children:(0,a.jsx)(`div`,{ref:r,className:n.t(`flex`,o===`horizontal`?`-ml-4`:`-mt-4 flex-col`,e),...t})})});l.displayName=`CarouselContent`;var u=i.forwardRef(({className:e,...t},r)=>{let{orientation:i}=s();return(0,a.jsx)(`div`,{ref:r,role:`group`,"aria-roledescription":`slide`,className:n.t(`min-w-0 shrink-0 grow-0 basis-full`,i===`horizontal`?`pl-4`:`pt-4`,e),...t})});u.displayName=`CarouselItem`;var d=i.forwardRef(({className:e,variant:i=`outline`,size:o=`icon`,...c},l)=>{let{orientation:u,scrollPrev:d,canScrollPrev:f}=s();return(0,a.jsxs)(r.Button,{ref:l,variant:i,size:o,className:n.t(`absolute h-8 w-8 rounded-full`,u===`horizontal`?`top-1/2 -left-12 -translate-y-1/2`:`-top-12 left-1/2 -translate-x-1/2 rotate-90`,e),disabled:!f,onClick:d,...c,children:[(0,a.jsx)(t.lr,{className:`h-4 w-4`}),(0,a.jsx)(`span`,{className:`sr-only`,children:`Previous slide`})]})});d.displayName=`CarouselPrevious`;var f=i.forwardRef(({className:e,variant:i=`outline`,size:o=`icon`,...c},l)=>{let{orientation:u,scrollNext:d,canScrollNext:f}=s();return(0,a.jsxs)(r.Button,{ref:l,variant:i,size:o,className:n.t(`absolute h-8 w-8 rounded-full`,u===`horizontal`?`top-1/2 -right-12 -translate-y-1/2`:`-bottom-12 left-1/2 -translate-x-1/2 rotate-90`,e),disabled:!f,onClick:d,...c,children:[(0,a.jsx)(t.cr,{className:`h-4 w-4`}),(0,a.jsx)(`span`,{className:`sr-only`,children:`Next slide`})]})});f.displayName=`CarouselNext`,exports.Carousel=c,exports.CarouselContent=l,exports.CarouselItem=u,exports.CarouselNext=f,exports.CarouselPrevious=d;
|
|
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":["'use client';\nimport useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';\nimport { ArrowLeft, ArrowRight } from 'lucide-react';\nimport * as React from 'react';\n\nimport {\n CarouselBaseProps,\n CarouselContentBaseProps,\n CarouselItemBaseProps,\n CarouselNextBaseProps,\n CarouselPreviousBaseProps,\n} from '@gv-tech/ui-core';\nimport { Button } from './button';\nimport { cn } from './lib/utils';\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\n\ntype CarouselProps = React.HTMLAttributes<HTMLDivElement> &\n CarouselBaseProps & {\n opts?: CarouselOptions;\n plugins?: CarouselPlugin;\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\nconst Carousel = React.forwardRef<HTMLDivElement, CarouselProps>(\n ({ orientation = 'horizontal', opts, setApi, plugins, className, children, ...props }, ref) => {\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\n setCanScrollPrev(api.canScrollPrev());\n setCanScrollNext(api.canScrollNext());\n }, []);\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev();\n }, [api]);\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext();\n }, [api]);\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n scrollPrev();\n } else if (event.key === 'ArrowRight') {\n event.preventDefault();\n scrollNext();\n }\n },\n [scrollPrev, scrollNext],\n );\n\n React.useEffect(() => {\n if (!api || !setApi) {\n return;\n }\n\n setApi(api);\n }, [api, setApi]);\n\n React.useEffect(() => {\n if (!api) {\n return;\n }\n\n onSelect(api);\n api.on('reInit', onSelect);\n api.on('select', onSelect);\n\n return () => {\n api?.off('select', onSelect);\n };\n }, [api, onSelect]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api: api,\n opts,\n orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <div\n ref={ref}\n onKeyDownCapture={handleKeyDown}\n className={cn('relative', className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n {...props}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n );\n },\n);\nCarousel.displayName = 'Carousel';\n\nconst CarouselContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & CarouselContentBaseProps\n>(({ className, ...props }, ref) => {\n const { carouselRef, orientation } = useCarousel();\n\n return (\n <div ref={carouselRef} className=\"overflow-hidden\">\n <div\n ref={ref}\n className={cn('flex', orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col', className)}\n {...props}\n />\n </div>\n );\n});\nCarouselContent.displayName = 'CarouselContent';\n\nconst CarouselItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement> & CarouselItemBaseProps>(\n ({ className, ...props }, ref) => {\n const { orientation } = useCarousel();\n\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-roledescription=\"slide\"\n className={cn('min-w-0 shrink-0 grow-0 basis-full', orientation === 'horizontal' ? 'pl-4' : 'pt-4', className)}\n {...props}\n />\n );\n },\n);\nCarouselItem.displayName = 'CarouselItem';\n\nconst CarouselPrevious = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<typeof Button> & CarouselPreviousBaseProps\n>(({ className, variant = 'outline', size = 'icon', ...props }, ref) => {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel();\n\n return (\n <Button\n ref={ref}\n variant={variant}\n size={size}\n className={cn(\n 'absolute h-8 w-8 rounded-full',\n orientation === 'horizontal'\n ? 'top-1/2 -left-12 -translate-y-1/2'\n : '-top-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n <ArrowLeft className=\"h-4 w-4\" />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n );\n});\nCarouselPrevious.displayName = 'CarouselPrevious';\n\nconst CarouselNext = React.forwardRef<HTMLButtonElement, React.ComponentProps<typeof Button> & CarouselNextBaseProps>(\n ({ className, variant = 'outline', size = 'icon', ...props }, ref) => {\n const { orientation, scrollNext, canScrollNext } = useCarousel();\n\n return (\n <Button\n ref={ref}\n variant={variant}\n size={size}\n className={cn(\n 'absolute h-8 w-8 rounded-full',\n orientation === 'horizontal'\n ? 'top-1/2 -right-12 -translate-y-1/2'\n : '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n <ArrowRight className=\"h-4 w-4\" />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n );\n },\n);\nCarouselNext.displayName = 'CarouselNext';\n\nexport { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type CarouselApi };\nexport type { CarouselProps };\n"],"mappings":"yRAoCM,EAAkB,EAAM,cAA2C,
|
|
1
|
+
{"version":3,"file":"carousel.cjs","names":[],"sources":["../packages/ui-web/src/carousel.tsx"],"sourcesContent":["'use client';\nimport useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';\nimport { ArrowLeft, ArrowRight } from 'lucide-react';\nimport * as React from 'react';\n\nimport {\n CarouselBaseProps,\n CarouselContentBaseProps,\n CarouselItemBaseProps,\n CarouselNextBaseProps,\n CarouselPreviousBaseProps,\n} from '@gv-tech/ui-core';\nimport { Button } from './button';\nimport { cn } from './lib/utils';\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\n\ntype CarouselProps = React.HTMLAttributes<HTMLDivElement> &\n CarouselBaseProps & {\n opts?: CarouselOptions;\n plugins?: CarouselPlugin;\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\nconst Carousel = React.forwardRef<HTMLDivElement, CarouselProps>(\n ({ orientation = 'horizontal', opts, setApi, plugins, className, children, ...props }, ref) => {\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\n setCanScrollPrev(api.canScrollPrev());\n setCanScrollNext(api.canScrollNext());\n }, []);\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev();\n }, [api]);\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext();\n }, [api]);\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n scrollPrev();\n } else if (event.key === 'ArrowRight') {\n event.preventDefault();\n scrollNext();\n }\n },\n [scrollPrev, scrollNext],\n );\n\n React.useEffect(() => {\n if (!api || !setApi) {\n return;\n }\n\n setApi(api);\n }, [api, setApi]);\n\n React.useEffect(() => {\n if (!api) {\n return;\n }\n\n onSelect(api);\n api.on('reInit', onSelect);\n api.on('select', onSelect);\n\n return () => {\n api?.off('select', onSelect);\n };\n }, [api, onSelect]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api: api,\n opts,\n orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <div\n ref={ref}\n onKeyDownCapture={handleKeyDown}\n className={cn('relative', className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n {...props}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n );\n },\n);\nCarousel.displayName = 'Carousel';\n\nconst CarouselContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & CarouselContentBaseProps\n>(({ className, ...props }, ref) => {\n const { carouselRef, orientation } = useCarousel();\n\n return (\n <div ref={carouselRef} className=\"overflow-hidden\">\n <div\n ref={ref}\n className={cn('flex', orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col', className)}\n {...props}\n />\n </div>\n );\n});\nCarouselContent.displayName = 'CarouselContent';\n\nconst CarouselItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement> & CarouselItemBaseProps>(\n ({ className, ...props }, ref) => {\n const { orientation } = useCarousel();\n\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-roledescription=\"slide\"\n className={cn('min-w-0 shrink-0 grow-0 basis-full', orientation === 'horizontal' ? 'pl-4' : 'pt-4', className)}\n {...props}\n />\n );\n },\n);\nCarouselItem.displayName = 'CarouselItem';\n\nconst CarouselPrevious = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<typeof Button> & CarouselPreviousBaseProps\n>(({ className, variant = 'outline', size = 'icon', ...props }, ref) => {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel();\n\n return (\n <Button\n ref={ref}\n variant={variant}\n size={size}\n className={cn(\n 'absolute h-8 w-8 rounded-full',\n orientation === 'horizontal'\n ? 'top-1/2 -left-12 -translate-y-1/2'\n : '-top-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n <ArrowLeft className=\"h-4 w-4\" />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n );\n});\nCarouselPrevious.displayName = 'CarouselPrevious';\n\nconst CarouselNext = React.forwardRef<HTMLButtonElement, React.ComponentProps<typeof Button> & CarouselNextBaseProps>(\n ({ className, variant = 'outline', size = 'icon', ...props }, ref) => {\n const { orientation, scrollNext, canScrollNext } = useCarousel();\n\n return (\n <Button\n ref={ref}\n variant={variant}\n size={size}\n className={cn(\n 'absolute h-8 w-8 rounded-full',\n orientation === 'horizontal'\n ? 'top-1/2 -right-12 -translate-y-1/2'\n : '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n <ArrowRight className=\"h-4 w-4\" />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n );\n },\n);\nCarouselNext.displayName = 'CarouselNext';\n\nexport { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type CarouselApi };\nexport type { CarouselProps };\n"],"mappings":"yRAoCM,EAAkB,EAAM,cAA2C,IAAI,EAE7E,SAAS,GAAc,CACrB,IAAM,EAAU,EAAM,WAAW,CAAe,EAEhD,GAAI,CAAC,EACH,MAAU,MAAM,gDAAgD,EAGlE,OAAO,CACT,CAEA,IAAM,EAAW,EAAM,YACpB,CAAE,cAAc,aAAc,OAAM,SAAQ,UAAS,YAAW,WAAU,GAAG,GAAS,IAAQ,CAC7F,GAAM,CAAC,EAAa,GAAO,EAAA,GACzB,CACE,GAAG,EACH,KAAM,IAAgB,aAAe,IAAM,GAC7C,EACA,CACF,EACM,CAAC,EAAe,GAAoB,EAAM,SAAS,EAAK,EACxD,CAAC,EAAe,GAAoB,EAAM,SAAS,EAAK,EAExD,EAAW,EAAM,YAAa,GAAqB,CACl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M,UAAU,mBAAU,YAAgB,CAAA,CACpC,GAEZ,CACF,EACA,EAAa,YAAc"}
|
package/dist/carousel.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { bn as e, cr as t, lr as n, vr as r } from "./vendor-
|
|
4
|
-
import { t as i } from "./utils-
|
|
3
|
+
import { bn as e, cr as t, lr as n, vr as r } from "./vendor-ChPUVHXi.mjs";
|
|
4
|
+
import { t as i } from "./utils-BsD1_fYL.mjs";
|
|
5
5
|
import { Button as a } from "./button.mjs";
|
|
6
6
|
import * as o from "react";
|
|
7
7
|
//#region packages/ui-web/src/carousel.tsx
|
package/dist/carousel.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.mjs","names":[],"sources":["../packages/ui-web/src/carousel.tsx"],"sourcesContent":["'use client';\nimport useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';\nimport { ArrowLeft, ArrowRight } from 'lucide-react';\nimport * as React from 'react';\n\nimport {\n CarouselBaseProps,\n CarouselContentBaseProps,\n CarouselItemBaseProps,\n CarouselNextBaseProps,\n CarouselPreviousBaseProps,\n} from '@gv-tech/ui-core';\nimport { Button } from './button';\nimport { cn } from './lib/utils';\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\n\ntype CarouselProps = React.HTMLAttributes<HTMLDivElement> &\n CarouselBaseProps & {\n opts?: CarouselOptions;\n plugins?: CarouselPlugin;\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\nconst Carousel = React.forwardRef<HTMLDivElement, CarouselProps>(\n ({ orientation = 'horizontal', opts, setApi, plugins, className, children, ...props }, ref) => {\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\n setCanScrollPrev(api.canScrollPrev());\n setCanScrollNext(api.canScrollNext());\n }, []);\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev();\n }, [api]);\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext();\n }, [api]);\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n scrollPrev();\n } else if (event.key === 'ArrowRight') {\n event.preventDefault();\n scrollNext();\n }\n },\n [scrollPrev, scrollNext],\n );\n\n React.useEffect(() => {\n if (!api || !setApi) {\n return;\n }\n\n setApi(api);\n }, [api, setApi]);\n\n React.useEffect(() => {\n if (!api) {\n return;\n }\n\n onSelect(api);\n api.on('reInit', onSelect);\n api.on('select', onSelect);\n\n return () => {\n api?.off('select', onSelect);\n };\n }, [api, onSelect]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api: api,\n opts,\n orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <div\n ref={ref}\n onKeyDownCapture={handleKeyDown}\n className={cn('relative', className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n {...props}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n );\n },\n);\nCarousel.displayName = 'Carousel';\n\nconst CarouselContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & CarouselContentBaseProps\n>(({ className, ...props }, ref) => {\n const { carouselRef, orientation } = useCarousel();\n\n return (\n <div ref={carouselRef} className=\"overflow-hidden\">\n <div\n ref={ref}\n className={cn('flex', orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col', className)}\n {...props}\n />\n </div>\n );\n});\nCarouselContent.displayName = 'CarouselContent';\n\nconst CarouselItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement> & CarouselItemBaseProps>(\n ({ className, ...props }, ref) => {\n const { orientation } = useCarousel();\n\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-roledescription=\"slide\"\n className={cn('min-w-0 shrink-0 grow-0 basis-full', orientation === 'horizontal' ? 'pl-4' : 'pt-4', className)}\n {...props}\n />\n );\n },\n);\nCarouselItem.displayName = 'CarouselItem';\n\nconst CarouselPrevious = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<typeof Button> & CarouselPreviousBaseProps\n>(({ className, variant = 'outline', size = 'icon', ...props }, ref) => {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel();\n\n return (\n <Button\n ref={ref}\n variant={variant}\n size={size}\n className={cn(\n 'absolute h-8 w-8 rounded-full',\n orientation === 'horizontal'\n ? 'top-1/2 -left-12 -translate-y-1/2'\n : '-top-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n <ArrowLeft className=\"h-4 w-4\" />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n );\n});\nCarouselPrevious.displayName = 'CarouselPrevious';\n\nconst CarouselNext = React.forwardRef<HTMLButtonElement, React.ComponentProps<typeof Button> & CarouselNextBaseProps>(\n ({ className, variant = 'outline', size = 'icon', ...props }, ref) => {\n const { orientation, scrollNext, canScrollNext } = useCarousel();\n\n return (\n <Button\n ref={ref}\n variant={variant}\n size={size}\n className={cn(\n 'absolute h-8 w-8 rounded-full',\n orientation === 'horizontal'\n ? 'top-1/2 -right-12 -translate-y-1/2'\n : '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n <ArrowRight className=\"h-4 w-4\" />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n );\n },\n);\nCarouselNext.displayName = 'CarouselNext';\n\nexport { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type CarouselApi };\nexport type { CarouselProps };\n"],"mappings":";;;;;;;aAoCM,IAAkB,EAAM,cAA2C,
|
|
1
|
+
{"version":3,"file":"carousel.mjs","names":[],"sources":["../packages/ui-web/src/carousel.tsx"],"sourcesContent":["'use client';\nimport useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';\nimport { ArrowLeft, ArrowRight } from 'lucide-react';\nimport * as React from 'react';\n\nimport {\n CarouselBaseProps,\n CarouselContentBaseProps,\n CarouselItemBaseProps,\n CarouselNextBaseProps,\n CarouselPreviousBaseProps,\n} from '@gv-tech/ui-core';\nimport { Button } from './button';\nimport { cn } from './lib/utils';\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\n\ntype CarouselProps = React.HTMLAttributes<HTMLDivElement> &\n CarouselBaseProps & {\n opts?: CarouselOptions;\n plugins?: CarouselPlugin;\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\nconst Carousel = React.forwardRef<HTMLDivElement, CarouselProps>(\n ({ orientation = 'horizontal', opts, setApi, plugins, className, children, ...props }, ref) => {\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\n setCanScrollPrev(api.canScrollPrev());\n setCanScrollNext(api.canScrollNext());\n }, []);\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev();\n }, [api]);\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext();\n }, [api]);\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n scrollPrev();\n } else if (event.key === 'ArrowRight') {\n event.preventDefault();\n scrollNext();\n }\n },\n [scrollPrev, scrollNext],\n );\n\n React.useEffect(() => {\n if (!api || !setApi) {\n return;\n }\n\n setApi(api);\n }, [api, setApi]);\n\n React.useEffect(() => {\n if (!api) {\n return;\n }\n\n onSelect(api);\n api.on('reInit', onSelect);\n api.on('select', onSelect);\n\n return () => {\n api?.off('select', onSelect);\n };\n }, [api, onSelect]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api: api,\n opts,\n orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <div\n ref={ref}\n onKeyDownCapture={handleKeyDown}\n className={cn('relative', className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n {...props}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n );\n },\n);\nCarousel.displayName = 'Carousel';\n\nconst CarouselContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & CarouselContentBaseProps\n>(({ className, ...props }, ref) => {\n const { carouselRef, orientation } = useCarousel();\n\n return (\n <div ref={carouselRef} className=\"overflow-hidden\">\n <div\n ref={ref}\n className={cn('flex', orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col', className)}\n {...props}\n />\n </div>\n );\n});\nCarouselContent.displayName = 'CarouselContent';\n\nconst CarouselItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement> & CarouselItemBaseProps>(\n ({ className, ...props }, ref) => {\n const { orientation } = useCarousel();\n\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-roledescription=\"slide\"\n className={cn('min-w-0 shrink-0 grow-0 basis-full', orientation === 'horizontal' ? 'pl-4' : 'pt-4', className)}\n {...props}\n />\n );\n },\n);\nCarouselItem.displayName = 'CarouselItem';\n\nconst CarouselPrevious = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<typeof Button> & CarouselPreviousBaseProps\n>(({ className, variant = 'outline', size = 'icon', ...props }, ref) => {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel();\n\n return (\n <Button\n ref={ref}\n variant={variant}\n size={size}\n className={cn(\n 'absolute h-8 w-8 rounded-full',\n orientation === 'horizontal'\n ? 'top-1/2 -left-12 -translate-y-1/2'\n : '-top-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n <ArrowLeft className=\"h-4 w-4\" />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n );\n});\nCarouselPrevious.displayName = 'CarouselPrevious';\n\nconst CarouselNext = React.forwardRef<HTMLButtonElement, React.ComponentProps<typeof Button> & CarouselNextBaseProps>(\n ({ className, variant = 'outline', size = 'icon', ...props }, ref) => {\n const { orientation, scrollNext, canScrollNext } = useCarousel();\n\n return (\n <Button\n ref={ref}\n variant={variant}\n size={size}\n className={cn(\n 'absolute h-8 w-8 rounded-full',\n orientation === 'horizontal'\n ? 'top-1/2 -right-12 -translate-y-1/2'\n : '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',\n className,\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n <ArrowRight className=\"h-4 w-4\" />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n );\n },\n);\nCarouselNext.displayName = 'CarouselNext';\n\nexport { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type CarouselApi };\nexport type { CarouselProps };\n"],"mappings":";;;;;;;aAoCM,IAAkB,EAAM,cAA2C,IAAI;AAE7E,SAAS,IAAc;CACrB,IAAM,IAAU,EAAM,WAAW,CAAe;CAEhD,IAAI,CAAC,GACH,MAAU,MAAM,gDAAgD;CAGlE,OAAO;AACT;AAEA,IAAM,IAAW,EAAM,YACpB,EAAE,iBAAc,cAAc,SAAM,WAAQ,YAAS,cAAW,aAAU,GAAG,KAAS,MAAQ;CAC7F,IAAM,CAAC,GAAa,KAAO,EACzB;EACE,GAAG;EACH,MAAM,MAAgB,eAAe,MAAM;CAC7C,GACA,CACF,GACM,CAAC,GAAe,KAAoB,EAAM,SAAS,EAAK,GACxD,CAAC,GAAe,KAAoB,EAAM,SAAS,EAAK,GAExD,IAAW,EAAM,aAAa,MAAqB;EAClD,MAIL,EAAiB,EAAI,cAAc,CAAC,GACpC,EAAiB,EAAI,cAAc,CAAC;CACtC,GAAG,CAAC,CAAC,GAEC,IAAa,EAAM,kBAAkB;EACzC,GAAK,WAAW;CAClB,GAAG,CAAC,CAAG,CAAC,GAEF,IAAa,EAAM,kBAAkB;EACzC,GAAK,WAAW;CAClB,GAAG,CAAC,CAAG,CAAC,GAEF,IAAgB,EAAM,aACzB,MAA+C;EAC9C,AAAI,EAAM,QAAQ,eAChB,EAAM,eAAe,GACrB,EAAW,KACF,EAAM,QAAQ,iBACvB,EAAM,eAAe,GACrB,EAAW;CAEf,GACA,CAAC,GAAY,CAAU,CACzB;CAwBA,OAtBA,EAAM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AAmB,EAAM,YAG5B,EAAE,cAAW,aAAU,WAAW,UAAO,QAAQ,GAAG,KAAS,MAAQ;CACtE,IAAM,EAAE,gBAAa,eAAY,qBAAkB,EAAY;CAE/D,OACE,iBAAA,GAAA,EAAA,MAAC,GAAD;EACO;EACI;EACH;EACN,WAAW,EACT,iCACA,MAAgB,eACZ,sCACA,+CACJ,CACF;EACA,UAAU,CAAC;EACX,SAAS;EACT,GAAI;YAbN,CAeE,iBAAA,GAAA,EAAA,KAAC,GAAD,EAAW,WAAU,UAAW,CAAA,GAChC,iBAAA,GAAA,EAAA,KAAC,QAAD;GAAM,WAAU;aAAU;EAAoB,CAAA,CACxC;;AAEZ,CAAC;AACD,EAAiB,cAAc;AAE/B,IAAM,IAAe,EAAM,YACxB,EAAE,cAAW,aAAU,WAAW,UAAO,QAAQ,GAAG,KAAS,MAAQ;CACpE,IAAM,EAAE,gBAAa,eAAY,qBAAkB,EAAY;CAE/D,OACE,iBAAA,GAAA,EAAA,MAAC,GAAD;EACO;EACI;EACH;EACN,WAAW,EACT,iCACA,MAAgB,eACZ,uCACA,kDACJ,CACF;EACA,UAAU,CAAC;EACX,SAAS;EACT,GAAI;YAbN,CAeE,iBAAA,GAAA,EAAA,KAAC,GAAD,EAAY,WAAU,UAAW,CAAA,GACjC,iBAAA,GAAA,EAAA,KAAC,QAAD;GAAM,WAAU;aAAU;EAAgB,CAAA,CACpC;;AAEZ,CACF;AACA,EAAa,cAAc"}
|
package/dist/chart.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-mLOUI7ql.js"),t=require("./vendor-3cr8xz0x.js"),n=require("./utils-DU-Y_pvO.js");let r=require("react");r=e.r(r);var i=t.vr(),a={light:``,dark:`.dark`},o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s=r.createContext(null);function c(){let e=r.useContext(s);if(!e)throw Error(`useChart must be used within a <ChartContainer />`);return e}var l=r.forwardRef(({id:e,className:a,children:o,config:c,style:l,role:d,tabIndex:f,"aria-label":p,"aria-labelledby":m,"aria-describedby":h,onClick:g,onKeyDown:_,onKeyUp:v,onFocus:y,onBlur:b},x)=>{let S=r.useId(),C=`chart-${e||S.replace(/:/g,``)}`;return(0,i.jsx)(s.Provider,{value:{config:c},children:(0,i.jsxs)(`div`,{"data-chart":C,ref:x,className:n.t(`[&_.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-none [&_.recharts-sector]:outline-none [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-none`,a),style:l,role:d,tabIndex:f,"aria-label":p,"aria-labelledby":m,"aria-describedby":h,onClick:g,onKeyDown:_,onKeyUp:v,onFocus:y,onBlur:b,children:[(0,i.jsx)(u,{id:C,config:c}),(0,i.jsx)(t.yn,{children:o})]})})});l.displayName=`Chart`;var u=({id:e,config:t})=>{let n=Object.entries(t).filter(([,e])=>e.theme||e.color);return n.length?(0,i.jsx)(`style`,{children:Object.entries(a).map(([t,r])=>`
|
|
2
2
|
${r} [data-chart=${e}] {
|
|
3
|
-
${n.map(([e,n])=>{let r=n.theme?.[t]||n.color;return r?` --color-${e}: ${r};`:null}).join(`
|
|
3
|
+
${n.map(([e,n])=>{let r=(t in a&&o(a,t)?n.theme?.[t]:void 0)||n.color;return r?` --color-${e}: ${r};`:null}).join(`
|
|
4
4
|
`)}
|
|
5
5
|
}
|
|
6
6
|
`).join(`
|
|
7
|
-
`)}
|
|
7
|
+
`)}):null},d=t._n,f=r.forwardRef(({active:e,payload:t,className:a,indicator:s=`dot`,hideLabel:l=!1,hideIndicator:u=!1,label:d,labelFormatter:f,labelClassName:p,formatter:m,color:g,nameKey:_,labelKey:v},y)=>{let{config:b}=c(),x=r.useMemo(()=>{if(l||!t?.length)return null;let[e]=t,r=h(b,e,`${v||e?.dataKey||e?.name||`value`}`),a=!v&&typeof d==`string`?(o(b,d)?b[d]?.label:void 0)??d:r?.label;return f?(0,i.jsx)(`div`,{className:n.t(`font-medium`,p),children:f(a,t)}):a?(0,i.jsx)(`div`,{className:n.t(`font-medium`,p),children:a}):null},[d,f,t,l,p,b,v]);if(!e||!t?.length)return null;let S=t.length===1&&s!==`dot`;return(0,i.jsxs)(`div`,{ref:y,className:n.t(`border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl`,a),children:[S?null:x,(0,i.jsx)(`div`,{className:`grid gap-1.5`,children:t.filter(e=>e.type!==`none`).map((e,t)=>{let r=h(b,e,`${_||e.name||e.dataKey||`value`}`),a=g||e.payload.fill||e.color;return(0,i.jsx)(`div`,{className:n.t(`[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5`,s===`dot`&&`items-center`),children:m&&e?.value!==void 0&&e.name?m(e.value,e.name,e,t,e.payload):(0,i.jsxs)(i.Fragment,{children:[r?.icon?(0,i.jsx)(r.icon,{}):!u&&(0,i.jsx)(`div`,{className:n.t(`shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]`,{"h-2.5 w-2.5":s===`dot`,"w-1":s===`line`,"w-0 border-[1.5px] border-dashed bg-transparent":s===`dashed`,"my-0.5":S&&s===`dashed`}),style:{"--color-bg":a,"--color-border":a}}),(0,i.jsxs)(`div`,{className:n.t(`flex flex-1 justify-between leading-none`,S?`items-end`:`items-center`),children:[(0,i.jsxs)(`div`,{className:`grid gap-1.5`,children:[S?x:null,(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:r?.label||e.name})]}),e.value&&(0,i.jsx)(`span`,{className:`text-foreground font-mono font-medium tabular-nums`,children:e.value.toLocaleString()})]})]})},typeof e.dataKey==`function`?t:e.dataKey??t)})})]})});f.displayName=`ChartTooltip`;var p=t.vn,m=r.forwardRef(({className:e,hideIcon:t=!1,payload:r,verticalAlign:a=`bottom`,nameKey:o},s)=>{let{config:l}=c();return r?.length?(0,i.jsx)(`div`,{ref:s,className:n.t(`flex items-center justify-center gap-4`,a===`top`?`pb-3`:`pt-3`,e),children:r.filter(e=>e.type!==`none`).map(e=>{let r=h(l,e,`${o||e.dataKey||`value`}`);return(0,i.jsxs)(`div`,{className:n.t(`[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3`),children:[r?.icon&&!t?(0,i.jsx)(r.icon,{}):(0,i.jsx)(`div`,{className:`h-2 w-2 shrink-0 rounded-[2px]`,style:{backgroundColor:e.color}}),r?.label]},e.value)})}):null});m.displayName=`ChartLegend`;function h(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 o(t,n)&&typeof t[n]==`string`?i=t[n]:r&&o(r,n)&&typeof r[n]==`string`&&(i=r[n]),o(e,i)?e[i]:o(e,n)?e[n]:void 0}exports.ChartContainer=l,exports.ChartLegend=p,exports.ChartLegendContent=m,exports.ChartStyle=u,exports.ChartTooltip=d,exports.ChartTooltipContent=f;
|
|
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';\nimport * as React from 'react';\nimport * as RechartsPrimitive from 'recharts';\n\nimport {\n ChartConfig,\n ChartContainerBaseProps,\n ChartLegendContentBaseProps,\n ChartTooltipContentBaseProps,\n} from '@gv-tech/ui-core';\nimport { cn } from './lib/utils';\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: '', dark: '.dark' } as const;\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\nconst ChartContainer = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<'div'> &\n ChartContainerBaseProps & {\n children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];\n }\n>(({ id, className, children, config, ...props }, ref) => {\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-chart={chartId}\n ref={ref}\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-none [&_.recharts-sector]:outline-none [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-none\",\n className,\n )}\n {...props}\n >\n <ChartStyle id={chartId} config={config} />\n <RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n );\n});\nChartContainer.displayName = 'Chart';\n\nconst ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {\n const colorConfig = Object.entries(config).filter(([, itemConfig]) => itemConfig.theme || itemConfig.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 THEMES] || 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\nconst ChartTooltipContent = React.forwardRef<\n HTMLDivElement,\n Partial<RechartsPrimitive.TooltipContentProps> & React.ComponentProps<'div'> & ChartTooltipContentBaseProps\n>(\n (\n {\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 },\n ref,\n ) => {\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 =\n !labelKey && typeof label === 'string'\n ? config[label as keyof typeof config]?.label || label\n : 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 ref={ref}\n className={cn(\n 'border-border/50 bg-background grid min-w-[8rem] 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: RechartsPrimitive.TooltipPayloadEntry) => item.type !== 'none')\n .map((item: RechartsPrimitive.TooltipPayloadEntry, index: number) => {\n const key = `${nameKey || item.name || item.dataKey || 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const indicatorColor = color || ((item.payload as Record<string, unknown>).fill as string) || item.color;\n\n return (\n <div\n key={typeof item.dataKey === 'function' ? index : (item.dataKey ?? 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 && (\n <span className=\"text-foreground font-mono font-medium tabular-nums\">\n {item.value.toLocaleString()}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n },\n);\nChartTooltipContent.displayName = 'ChartTooltip';\n\nconst ChartLegend = RechartsPrimitive.Legend;\n\nconst ChartLegendContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<'div'> &\n Pick<RechartsPrimitive.DefaultLegendContentProps, 'payload' | 'verticalAlign'> &\n ChartLegendContentBaseProps\n>(({ className, hideIcon = false, payload, verticalAlign = 'bottom', nameKey }, ref) => {\n const { config } = useChart();\n\n if (!payload?.length) {\n return null;\n }\n\n return (\n <div\n ref={ref}\n className={cn('flex items-center justify-center gap-4', verticalAlign === 'top' ? 'pb-3' : 'pt-3', className)}\n >\n {payload\n .filter((item: RechartsPrimitive.LegendPayload) => item.type !== 'none')\n .map((item: RechartsPrimitive.LegendPayload) => {\n const key = `${nameKey || item.dataKey || 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n\n return (\n <div\n key={item.value}\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});\nChartLegendContent.displayName = 'ChartLegend';\n\n// Helper to extract item config from a payload.\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 &&\n typeof (payload as { payload: unknown }).payload === 'object' &&\n (payload as { payload: unknown }).payload !== null\n ? ((payload as { payload: unknown }).payload as Record<string, unknown>)\n : undefined;\n\n let configLabelKey: string = key;\n\n if (key in payload && typeof (payload as Record<string, unknown>)[key] === 'string') {\n configLabelKey = (payload as Record<string, unknown>)[key] as string;\n } else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === 'string') {\n configLabelKey = payloadPayload[key] as string;\n }\n\n return configLabelKey in config ? config[configLabelKey] : config[key as keyof typeof config];\n}\n\nexport { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent };\nexport type { ChartConfig };\n"],"mappings":"+PAaM,EAAS,CAAE,MAAO,GAAI,KAAM,QAAS,C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GAAY,MAAQ,CAAC,GACpB,EAAA,EAAA,KAAC,EAAW,KAAZ,EAAmB,CAAA,EAEnB,EAAA,EAAA,KAAC,MAAD,CACE,UAAU,iCACV,MAAO,CACL,gBAAiB,EAAK,MACvB,CACD,CAAA,CAEH,GAAY,MACT,EAdC,EAAK,MAcN,EAER,CACA,CAAA,CAjCC,MAmCT,CACF,EAAmB,YAAc,cAGjC,SAAS,EAA4B,EAAqB,EAAkB,EAAa,CACvF,GAAI,OAAO,GAAY,WAAY,EACjC,OAGF,IAAM,EACJ,YAAa,GACb,OAAQ,EAAiC,SAAY,UACpD,EAAiC,UAAY,KACxC,EAAiC,QACnC,IAAA,GAEF,EAAyB,EAQ7B,OANI,KAAO,GAAW,OAAQ,EAAoC,IAAS,SACzE,EAAkB,EAAoC,GAC7C,GAAkB,KAAO,GAAkB,OAAO,EAAe,IAAS,WACnF,EAAiB,EAAe,IAG3B,KAAkB,EAAS,EAAO,GAAkB,EAAO"}
|
|
1
|
+
{"version":3,"file":"chart.cjs","names":[],"sources":["../packages/ui-web/src/chart.tsx"],"sourcesContent":["'use client';\nimport * as React from 'react';\nimport * as RechartsPrimitive from 'recharts';\n\nimport {\n ChartConfig,\n ChartContainerBaseProps,\n ChartLegendContentBaseProps,\n ChartTooltipContentBaseProps,\n} from '@gv-tech/ui-core';\nimport { cn } from './lib/utils';\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: '', dark: '.dark' } as const;\n\n/** Safe own-property check — prevents prototype-chain traversal via dynamic keys. */\nconst hasOwnProp = (obj: object, key: string): boolean => Object.prototype.hasOwnProperty.call(obj, key);\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\nconst ChartContainer = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<'div'> &\n ChartContainerBaseProps & {\n children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];\n }\n>(\n (\n {\n id,\n className,\n children,\n config,\n style,\n role,\n tabIndex,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n onClick,\n onKeyDown,\n onKeyUp,\n onFocus,\n onBlur,\n },\n ref,\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-chart={chartId}\n ref={ref}\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-none [&_.recharts-sector]:outline-none [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-none\",\n className,\n )}\n style={style}\n role={role}\n tabIndex={tabIndex}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n onClick={onClick}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n onFocus={onFocus}\n onBlur={onBlur}\n >\n <ChartStyle id={chartId} config={config} />\n <RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n );\n },\n);\nChartContainer.displayName = 'Chart';\n\nconst ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {\n const colorConfig = Object.entries(config).filter(([, itemConfig]) => itemConfig.theme || itemConfig.color);\n\n if (!colorConfig.length) {\n return null;\n }\n\n return (\n <style>\n {Object.entries(THEMES)\n .map(\n ([theme, prefix]) => `\n${prefix} [data-chart=${id}] {\n${colorConfig\n .map(([key, itemConfig]) => {\n const color =\n (theme in THEMES && hasOwnProp(THEMES, theme) ? itemConfig.theme?.[theme as keyof typeof THEMES] : undefined) ||\n itemConfig.color;\n return color ? ` --color-${key}: ${color};` : null;\n })\n .join('\\n')}\n}\n`,\n )\n .join('\\n')}\n </style>\n );\n};\n\nconst ChartTooltip = RechartsPrimitive.Tooltip;\n\nconst ChartTooltipContent = React.forwardRef<\n HTMLDivElement,\n Partial<RechartsPrimitive.TooltipContentProps> & React.ComponentProps<'div'> & ChartTooltipContentBaseProps\n>(\n (\n {\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 },\n ref,\n ) => {\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 =\n !labelKey && typeof label === 'string'\n ? ((hasOwnProp(config, label) ? config[label as keyof typeof config]?.label : undefined) ?? label)\n : 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 ref={ref}\n className={cn(\n 'border-border/50 bg-background grid min-w-[8rem] 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: RechartsPrimitive.TooltipPayloadEntry) => item.type !== 'none')\n .map((item: RechartsPrimitive.TooltipPayloadEntry, index: number) => {\n const key = `${nameKey || item.name || item.dataKey || 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const indicatorColor = color || ((item.payload as Record<string, unknown>).fill as string) || item.color;\n\n return (\n <div\n key={typeof item.dataKey === 'function' ? index : (item.dataKey ?? 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 && (\n <span className=\"text-foreground font-mono font-medium tabular-nums\">\n {item.value.toLocaleString()}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n },\n);\nChartTooltipContent.displayName = 'ChartTooltip';\n\nconst ChartLegend = RechartsPrimitive.Legend;\n\nconst ChartLegendContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<'div'> &\n Pick<RechartsPrimitive.DefaultLegendContentProps, 'payload' | 'verticalAlign'> &\n ChartLegendContentBaseProps\n>(({ className, hideIcon = false, payload, verticalAlign = 'bottom', nameKey }, ref) => {\n const { config } = useChart();\n\n if (!payload?.length) {\n return null;\n }\n\n return (\n <div\n ref={ref}\n className={cn('flex items-center justify-center gap-4', verticalAlign === 'top' ? 'pb-3' : 'pt-3', className)}\n >\n {payload\n .filter((item: RechartsPrimitive.LegendPayload) => item.type !== 'none')\n .map((item: RechartsPrimitive.LegendPayload) => {\n const key = `${nameKey || item.dataKey || 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n\n return (\n <div\n key={item.value}\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});\nChartLegendContent.displayName = 'ChartLegend';\n\n// Helper to extract item config from a payload.\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 &&\n typeof (payload as { payload: unknown }).payload === 'object' &&\n (payload as { payload: unknown }).payload !== null\n ? ((payload as { payload: unknown }).payload as Record<string, unknown>)\n : undefined;\n\n let configLabelKey: string = key;\n\n if (hasOwnProp(payload as object, key) && typeof (payload as Record<string, unknown>)[key] === 'string') {\n configLabelKey = (payload as Record<string, unknown>)[key] as string;\n } else if (payloadPayload && hasOwnProp(payloadPayload, key) && typeof payloadPayload[key] === 'string') {\n configLabelKey = payloadPayload[key] as string;\n }\n\n return hasOwnProp(config, configLabelKey)\n ? config[configLabelKey as keyof typeof config]\n : hasOwnProp(config, key)\n ? config[key as keyof typeof config]\n : undefined;\n}\n\nexport { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipCont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AM,CAAE,UAAW,EAAS,EAM5B,OAJK,GAAS,QAKZ,EAAA,EAAA,KAAC,MAAD,CACO,MACL,UAAW,EAAA,EAAG,yCAA0C,IAAkB,MAAQ,OAAS,OAAQ,CAAS,WAE3G,EACE,OAAQ,GAA0C,EAAK,OAAS,MAAM,EACtE,IAAK,GAA0C,CAE9C,IAAM,EAAa,EAA4B,EAAQ,EAAM,GAD9C,GAAW,EAAK,SAAW,SACsB,EAEhE,OACE,EAAA,EAAA,MAAC,MAAD,CAEE,UAAW,EAAA,EAAG,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,EAAK,KAcP,CAET,CAAC,CACA,CAAA,EAjCE,IAmCX,CAAC,EACD,EAAmB,YAAc,cAGjC,SAAS,EAA4B,EAAqB,EAAkB,EAAa,CACvF,GAAI,OAAO,GAAY,WAAY,EACjC,OAGF,IAAM,EACJ,YAAa,GACb,OAAQ,EAAiC,SAAY,UACpD,EAAiC,UAAY,KACxC,EAAiC,QACnC,IAAA,GAEF,EAAyB,EAQ7B,OANI,EAAW,EAAmB,CAAG,GAAK,OAAQ,EAAoC,IAAS,SAC7F,EAAkB,EAAoC,GAC7C,GAAkB,EAAW,EAAgB,CAAG,GAAK,OAAO,EAAe,IAAS,WAC7F,EAAiB,EAAe,IAG3B,EAAW,EAAQ,CAAc,EACpC,EAAO,GACP,EAAW,EAAQ,CAAG,EACpB,EAAO,GACP,IAAA,EACR"}
|
package/dist/chart.mjs
CHANGED
|
@@ -1,92 +1,102 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { _n as e, vn as t, vr as n, yn as r } from "./vendor-
|
|
4
|
-
import { t as i } from "./utils-
|
|
3
|
+
import { _n as e, vn as t, vr as n, yn as r } from "./vendor-ChPUVHXi.mjs";
|
|
4
|
+
import { t as i } from "./utils-BsD1_fYL.mjs";
|
|
5
5
|
import * as a from "react";
|
|
6
6
|
//#region packages/ui-web/src/chart.tsx
|
|
7
7
|
var o = n(), s = {
|
|
8
8
|
light: "",
|
|
9
9
|
dark: ".dark"
|
|
10
|
-
}, c = a.createContext(null);
|
|
11
|
-
function
|
|
12
|
-
let e = a.useContext(
|
|
10
|
+
}, c = (e, t) => Object.prototype.hasOwnProperty.call(e, t), l = a.createContext(null);
|
|
11
|
+
function u() {
|
|
12
|
+
let e = a.useContext(l);
|
|
13
13
|
if (!e) throw Error("useChart must be used within a <ChartContainer />");
|
|
14
14
|
return e;
|
|
15
15
|
}
|
|
16
|
-
var
|
|
17
|
-
let
|
|
18
|
-
return /* @__PURE__ */ (0, o.jsx)(
|
|
16
|
+
var d = a.forwardRef(({ id: e, className: t, children: n, config: s, style: c, role: u, tabIndex: d, "aria-label": p, "aria-labelledby": m, "aria-describedby": h, onClick: g, onKeyDown: _, onKeyUp: v, onFocus: y, onBlur: b }, x) => {
|
|
17
|
+
let S = a.useId(), C = `chart-${e || S.replace(/:/g, "")}`;
|
|
18
|
+
return /* @__PURE__ */ (0, o.jsx)(l.Provider, {
|
|
19
19
|
value: { config: s },
|
|
20
20
|
children: /* @__PURE__ */ (0, o.jsxs)("div", {
|
|
21
|
-
"data-chart":
|
|
22
|
-
ref:
|
|
21
|
+
"data-chart": C,
|
|
22
|
+
ref: x,
|
|
23
23
|
className: i("[&_.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-none [&_.recharts-sector]:outline-none [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-none", t),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
style: c,
|
|
25
|
+
role: u,
|
|
26
|
+
tabIndex: d,
|
|
27
|
+
"aria-label": p,
|
|
28
|
+
"aria-labelledby": m,
|
|
29
|
+
"aria-describedby": h,
|
|
30
|
+
onClick: g,
|
|
31
|
+
onKeyDown: _,
|
|
32
|
+
onKeyUp: v,
|
|
33
|
+
onFocus: y,
|
|
34
|
+
onBlur: b,
|
|
35
|
+
children: [/* @__PURE__ */ (0, o.jsx)(f, {
|
|
36
|
+
id: C,
|
|
27
37
|
config: s
|
|
28
38
|
}), /* @__PURE__ */ (0, o.jsx)(r, { children: n })]
|
|
29
39
|
})
|
|
30
40
|
});
|
|
31
41
|
});
|
|
32
|
-
|
|
33
|
-
var
|
|
42
|
+
d.displayName = "Chart";
|
|
43
|
+
var f = ({ id: e, config: t }) => {
|
|
34
44
|
let n = Object.entries(t).filter(([, e]) => e.theme || e.color);
|
|
35
|
-
return n.length ? /* @__PURE__ */ (0, o.jsx)("style", {
|
|
45
|
+
return n.length ? /* @__PURE__ */ (0, o.jsx)("style", { children: Object.entries(s).map(([t, r]) => `
|
|
36
46
|
${r} [data-chart=${e}] {
|
|
37
47
|
${n.map(([e, n]) => {
|
|
38
|
-
let r = n.theme?.[t] || n.color;
|
|
48
|
+
let r = (t in s && c(s, t) ? n.theme?.[t] : void 0) || n.color;
|
|
39
49
|
return r ? ` --color-${e}: ${r};` : null;
|
|
40
50
|
}).join("\n")}
|
|
41
51
|
}
|
|
42
|
-
`).join("\n") }
|
|
43
|
-
},
|
|
44
|
-
let { config:
|
|
52
|
+
`).join("\n") }) : null;
|
|
53
|
+
}, p = e, m = a.forwardRef(({ active: e, payload: t, className: n, indicator: r = "dot", hideLabel: s = !1, hideIndicator: l = !1, label: d, labelFormatter: f, labelClassName: p, formatter: m, color: h, nameKey: g, labelKey: v }, y) => {
|
|
54
|
+
let { config: b } = u(), x = a.useMemo(() => {
|
|
45
55
|
if (s || !t?.length) return null;
|
|
46
|
-
let [e] = t, n =
|
|
47
|
-
return
|
|
48
|
-
className: i("font-medium",
|
|
49
|
-
children:
|
|
56
|
+
let [e] = t, n = _(b, e, `${v || e?.dataKey || e?.name || "value"}`), r = !v && typeof d == "string" ? (c(b, d) ? b[d]?.label : void 0) ?? d : n?.label;
|
|
57
|
+
return f ? /* @__PURE__ */ (0, o.jsx)("div", {
|
|
58
|
+
className: i("font-medium", p),
|
|
59
|
+
children: f(r, t)
|
|
50
60
|
}) : r ? /* @__PURE__ */ (0, o.jsx)("div", {
|
|
51
|
-
className: i("font-medium",
|
|
61
|
+
className: i("font-medium", p),
|
|
52
62
|
children: r
|
|
53
63
|
}) : null;
|
|
54
64
|
}, [
|
|
55
|
-
u,
|
|
56
65
|
d,
|
|
66
|
+
f,
|
|
57
67
|
t,
|
|
58
68
|
s,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
69
|
+
p,
|
|
70
|
+
b,
|
|
71
|
+
v
|
|
62
72
|
]);
|
|
63
73
|
if (!e || !t?.length) return null;
|
|
64
|
-
let
|
|
74
|
+
let S = t.length === 1 && r !== "dot";
|
|
65
75
|
return /* @__PURE__ */ (0, o.jsxs)("div", {
|
|
66
|
-
ref:
|
|
76
|
+
ref: y,
|
|
67
77
|
className: i("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl", n),
|
|
68
|
-
children: [
|
|
78
|
+
children: [S ? null : x, /* @__PURE__ */ (0, o.jsx)("div", {
|
|
69
79
|
className: "grid gap-1.5",
|
|
70
80
|
children: t.filter((e) => e.type !== "none").map((e, t) => {
|
|
71
|
-
let n =
|
|
81
|
+
let n = _(b, e, `${g || e.name || e.dataKey || "value"}`), a = h || e.payload.fill || e.color;
|
|
72
82
|
return /* @__PURE__ */ (0, o.jsx)("div", {
|
|
73
83
|
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"),
|
|
74
|
-
children:
|
|
84
|
+
children: m && e?.value !== void 0 && e.name ? m(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ (0, o.jsxs)(o.Fragment, { children: [n?.icon ? /* @__PURE__ */ (0, o.jsx)(n.icon, {}) : !l && /* @__PURE__ */ (0, o.jsx)("div", {
|
|
75
85
|
className: i("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]", {
|
|
76
86
|
"h-2.5 w-2.5": r === "dot",
|
|
77
87
|
"w-1": r === "line",
|
|
78
88
|
"w-0 border-[1.5px] border-dashed bg-transparent": r === "dashed",
|
|
79
|
-
"my-0.5":
|
|
89
|
+
"my-0.5": S && r === "dashed"
|
|
80
90
|
}),
|
|
81
91
|
style: {
|
|
82
92
|
"--color-bg": a,
|
|
83
93
|
"--color-border": a
|
|
84
94
|
}
|
|
85
95
|
}), /* @__PURE__ */ (0, o.jsxs)("div", {
|
|
86
|
-
className: i("flex flex-1 justify-between leading-none",
|
|
96
|
+
className: i("flex flex-1 justify-between leading-none", S ? "items-end" : "items-center"),
|
|
87
97
|
children: [/* @__PURE__ */ (0, o.jsxs)("div", {
|
|
88
98
|
className: "grid gap-1.5",
|
|
89
|
-
children: [
|
|
99
|
+
children: [S ? x : null, /* @__PURE__ */ (0, o.jsx)("span", {
|
|
90
100
|
className: "text-muted-foreground",
|
|
91
101
|
children: n?.label || e.name
|
|
92
102
|
})]
|
|
@@ -100,14 +110,14 @@ ${n.map(([e, n]) => {
|
|
|
100
110
|
})]
|
|
101
111
|
});
|
|
102
112
|
});
|
|
103
|
-
|
|
104
|
-
var
|
|
105
|
-
let { config: c } =
|
|
113
|
+
m.displayName = "ChartTooltip";
|
|
114
|
+
var h = t, g = a.forwardRef(({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: a }, s) => {
|
|
115
|
+
let { config: c } = u();
|
|
106
116
|
return n?.length ? /* @__PURE__ */ (0, o.jsx)("div", {
|
|
107
117
|
ref: s,
|
|
108
118
|
className: i("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
|
|
109
119
|
children: n.filter((e) => e.type !== "none").map((e) => {
|
|
110
|
-
let n =
|
|
120
|
+
let n = _(c, e, `${a || e.dataKey || "value"}`);
|
|
111
121
|
return /* @__PURE__ */ (0, o.jsxs)("div", {
|
|
112
122
|
className: i("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
|
|
113
123
|
children: [n?.icon && !t ? /* @__PURE__ */ (0, o.jsx)(n.icon, {}) : /* @__PURE__ */ (0, o.jsx)("div", {
|
|
@@ -118,13 +128,13 @@ var m = t, h = a.forwardRef(({ className: e, hideIcon: t = !1, payload: n, verti
|
|
|
118
128
|
})
|
|
119
129
|
}) : null;
|
|
120
130
|
});
|
|
121
|
-
|
|
122
|
-
function
|
|
131
|
+
g.displayName = "ChartLegend";
|
|
132
|
+
function _(e, t, n) {
|
|
123
133
|
if (typeof t != "object" || !t) return;
|
|
124
134
|
let r = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, i = n;
|
|
125
|
-
return n
|
|
135
|
+
return c(t, n) && typeof t[n] == "string" ? i = t[n] : r && c(r, n) && typeof r[n] == "string" && (i = r[n]), c(e, i) ? e[i] : c(e, n) ? e[n] : void 0;
|
|
126
136
|
}
|
|
127
137
|
//#endregion
|
|
128
|
-
export {
|
|
138
|
+
export { d as ChartContainer, h as ChartLegend, g as ChartLegendContent, f as ChartStyle, p as ChartTooltip, m as ChartTooltipContent };
|
|
129
139
|
|
|
130
140
|
//# sourceMappingURL=chart.mjs.map
|