@uselets/ui 1.8.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{chart-DHS2QeM8.d.ts → chart-lqgodZYQ.d.ts} +11 -7
- package/dist/cli/uselets.mjs.map +1 -1
- package/dist/components/accordion.d.ts +5 -5
- package/dist/components/accordion.js +1 -1
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/alert-dialog.d.ts +13 -13
- package/dist/components/alert-dialog.js +1 -1
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.d.ts +5 -5
- package/dist/components/alert.js +1 -1
- package/dist/components/alert.js.map +1 -1
- package/dist/components/anchor.d.ts +2 -2
- package/dist/components/anchor.js +1 -1
- package/dist/components/anchor.js.map +1 -1
- package/dist/components/area-chart.d.ts +9 -3
- package/dist/components/area-chart.js +1 -1
- package/dist/components/area-chart.js.map +1 -1
- package/dist/components/avatar.d.ts +7 -7
- package/dist/components/avatar.js +1 -1
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.d.ts +2 -2
- package/dist/components/badge.js +1 -1
- package/dist/components/badge.js.map +1 -1
- package/dist/components/bar-chart.d.ts +15 -5
- package/dist/components/bar-chart.js +1 -1
- package/dist/components/bar-chart.js.map +1 -1
- package/dist/components/breadcrumb.d.ts +8 -8
- package/dist/components/breadcrumb.js +1 -1
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button-group.d.ts +4 -4
- package/dist/components/button-group.js +1 -1
- package/dist/components/button-group.js.map +1 -1
- package/dist/components/button.d.ts +2 -2
- package/dist/components/button.js +1 -1
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar.d.ts +3 -3
- package/dist/components/calendar.js +1 -1
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/card.d.ts +8 -8
- package/dist/components/card.js +1 -1
- package/dist/components/card.js.map +1 -1
- package/dist/components/carousel.d.ts +7 -7
- package/dist/components/carousel.js +1 -1
- package/dist/components/carousel.js.map +1 -1
- package/dist/components/carousel.spec.js +1 -1
- package/dist/components/carousel.spec.js.map +1 -1
- package/dist/components/center.d.ts +2 -2
- package/dist/components/center.js +1 -1
- package/dist/components/center.js.map +1 -1
- package/dist/components/chart.d.ts +2 -2
- package/dist/components/chart.js +2 -2
- package/dist/components/chart.js.map +1 -1
- package/dist/components/checkbox.d.ts +2 -2
- package/dist/components/checkbox.js +1 -1
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/code.d.ts +2 -2
- package/dist/components/code.js +1 -1
- package/dist/components/code.js.map +1 -1
- package/dist/components/collapsible.d.ts +4 -4
- package/dist/components/collapsible.js +1 -1
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.d.ts +16 -16
- package/dist/components/combobox.js +1 -1
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.d.ts +10 -10
- package/dist/components/command.js +1 -1
- package/dist/components/command.js.map +1 -1
- package/dist/components/container.d.ts +2 -2
- package/dist/components/container.js +1 -1
- package/dist/components/container.js.map +1 -1
- package/dist/components/data-table.d.ts +9 -9
- package/dist/components/data-table.js +1 -1
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-range-picker.d.ts +12 -12
- package/dist/components/date-range-picker.js +1 -1
- package/dist/components/date-range-picker.js.map +1 -1
- package/dist/components/dialog.d.ts +12 -12
- package/dist/components/dialog.js +1 -1
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/donut-chart.d.ts +2 -2
- package/dist/components/donut-chart.js +1 -1
- package/dist/components/donut-chart.js.map +1 -1
- package/dist/components/drawer.d.ts +12 -12
- package/dist/components/drawer.js +1 -1
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.d.ts +16 -16
- package/dist/components/dropdown-menu.js +1 -1
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/dropzone.d.ts +2 -2
- package/dist/components/dropzone.js +1 -1
- package/dist/components/dropzone.js.map +1 -1
- package/dist/components/empty.d.ts +7 -7
- package/dist/components/empty.js +1 -1
- package/dist/components/empty.js.map +1 -1
- package/dist/components/field.d.ts +11 -11
- package/dist/components/field.js +1 -1
- package/dist/components/field.js.map +1 -1
- package/dist/components/field.spec.js +1 -1
- package/dist/components/field.spec.js.map +1 -1
- package/dist/components/flex.d.ts +2 -2
- package/dist/components/flex.js +1 -1
- package/dist/components/flex.js.map +1 -1
- package/dist/components/grid.d.ts +3 -3
- package/dist/components/grid.js +1 -1
- package/dist/components/grid.js.map +1 -1
- package/dist/components/group.d.ts +2 -2
- package/dist/components/group.js +1 -1
- package/dist/components/group.js.map +1 -1
- package/dist/components/heading.d.ts +2 -2
- package/dist/components/heading.js +1 -1
- package/dist/components/heading.js.map +1 -1
- package/dist/components/hover-card.d.ts +4 -4
- package/dist/components/hover-card.js +1 -1
- package/dist/components/hover-card.js.map +1 -1
- package/dist/components/input-group.d.ts +7 -7
- package/dist/components/input-group.js +1 -1
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input-otp.d.ts +5 -5
- package/dist/components/input-otp.js +1 -1
- package/dist/components/input-otp.js.map +1 -1
- package/dist/components/input.d.ts +2 -2
- package/dist/components/input.js +1 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/kbd.d.ts +3 -3
- package/dist/components/kbd.js +1 -1
- package/dist/components/kbd.js.map +1 -1
- package/dist/components/label.d.ts +2 -2
- package/dist/components/label.js +1 -1
- package/dist/components/label.js.map +1 -1
- package/dist/components/list.d.ts +4 -4
- package/dist/components/list.js +1 -1
- package/dist/components/list.js.map +1 -1
- package/dist/components/mask-input.d.ts +2 -2
- package/dist/components/mask-input.js +1 -1
- package/dist/components/mask-input.js.map +1 -1
- package/dist/components/native-select.d.ts +4 -4
- package/dist/components/native-select.js +1 -1
- package/dist/components/native-select.js.map +1 -1
- package/dist/components/navigation-menu.d.ts +9 -9
- package/dist/components/navigation-menu.js +1 -1
- package/dist/components/navigation-menu.js.map +1 -1
- package/dist/components/pagination.d.ts +8 -8
- package/dist/components/pagination.js +1 -1
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/pie-chart.d.ts +10 -4
- package/dist/components/pie-chart.js +1 -1
- package/dist/components/pie-chart.js.map +1 -1
- package/dist/components/popover.d.ts +8 -8
- package/dist/components/popover.js +1 -1
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress.d.ts +2 -2
- package/dist/components/progress.js +1 -1
- package/dist/components/progress.js.map +1 -1
- package/dist/components/radio-group.d.ts +3 -3
- package/dist/components/radio-group.js +1 -1
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/resizable.d.ts +4 -4
- package/dist/components/resizable.js +1 -1
- package/dist/components/resizable.js.map +1 -1
- package/dist/components/scroll-area.d.ts +3 -3
- package/dist/components/scroll-area.js +1 -1
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/select.d.ts +11 -11
- package/dist/components/select.js +1 -1
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.d.ts +2 -2
- package/dist/components/separator.js +1 -1
- package/dist/components/separator.js.map +1 -1
- package/dist/components/sidebar.d.ts +24 -24
- package/dist/components/sidebar.js +1 -1
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/simple-grid.d.ts +2 -2
- package/dist/components/simple-grid.js +1 -1
- package/dist/components/simple-grid.js.map +1 -1
- package/dist/components/skeleton.d.ts +2 -2
- package/dist/components/skeleton.js +1 -1
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/skeleton.spec.js +1 -1
- package/dist/components/skeleton.spec.js.map +1 -1
- package/dist/components/slider.d.ts +2 -2
- package/dist/components/slider.js +1 -1
- package/dist/components/slider.js.map +1 -1
- package/dist/components/sonner.d.ts +2 -2
- package/dist/components/sonner.js +1 -1
- package/dist/components/sonner.js.map +1 -1
- package/dist/components/spinner.d.ts +2 -2
- package/dist/components/spinner.js +1 -1
- package/dist/components/spinner.js.map +1 -1
- package/dist/components/stack.d.ts +2 -2
- package/dist/components/stack.js +1 -1
- package/dist/components/stack.js.map +1 -1
- package/dist/components/switch.d.ts +2 -2
- package/dist/components/switch.js +1 -1
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.d.ts +10 -10
- package/dist/components/table.js +1 -1
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.d.ts +5 -5
- package/dist/components/tabs.js +1 -1
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/text.d.ts +2 -2
- package/dist/components/text.js +1 -1
- package/dist/components/text.js.map +1 -1
- package/dist/components/textarea.d.ts +2 -2
- package/dist/components/textarea.js +1 -1
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/theme.d.ts +3 -3
- package/dist/components/theme.js +1 -1
- package/dist/components/theme.js.map +1 -1
- package/dist/components/timeline.d.ts +1 -1
- package/dist/components/timeline.js +1 -1
- package/dist/components/timeline.js.map +1 -1
- package/dist/components/toggle-group.d.ts +3 -3
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle.d.ts +2 -2
- package/dist/components/toggle.js +1 -1
- package/dist/components/toggle.js.map +1 -1
- package/dist/components/tooltip.d.ts +6 -6
- package/dist/components/tooltip.js +1 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/unstyled-button.d.ts +2 -2
- package/dist/components/unstyled-button.js +1 -1
- package/dist/components/unstyled-button.js.map +1 -1
- package/dist/components/visibility.d.ts +3 -3
- package/dist/components/visibility.js +1 -1
- package/dist/components/visibility.js.map +1 -1
- package/dist/{dist-C35vdEt2.js → dist-B-hwiqYg.js} +13 -13
- package/dist/dist-B-hwiqYg.js.map +1 -0
- package/dist/hooks/use-breakpoint-value.d.ts +1 -1
- package/dist/hooks/use-breakpoint-value.js +1 -1
- package/dist/hooks/use-breakpoint-value.js.map +1 -1
- package/dist/hooks/use-breakpoint-value.spec.js +1 -1
- package/dist/hooks/use-breakpoint-value.spec.js.map +1 -1
- package/dist/hooks/use-breakpoint.d.ts +1 -1
- package/dist/hooks/use-breakpoint.js +1 -1
- package/dist/hooks/use-breakpoint.js.map +1 -1
- package/dist/hooks/use-breakpoint.spec.js +1 -1
- package/dist/hooks/use-breakpoint.spec.js.map +1 -1
- package/dist/hooks/use-disclosure.d.ts +1 -1
- package/dist/hooks/use-disclosure.js +1 -1
- package/dist/hooks/use-disclosure.js.map +1 -1
- package/dist/hooks/use-disclosure.spec.js +1 -1
- package/dist/hooks/use-disclosure.spec.js.map +1 -1
- package/dist/hooks/use-document-visibility.d.ts +1 -1
- package/dist/hooks/use-document-visibility.js +1 -1
- package/dist/hooks/use-document-visibility.js.map +1 -1
- package/dist/hooks/use-document-visibility.spec.js +1 -1
- package/dist/hooks/use-document-visibility.spec.js.map +1 -1
- package/dist/hooks/use-idle.d.ts +1 -1
- package/dist/hooks/use-idle.js +1 -1
- package/dist/hooks/use-idle.js.map +1 -1
- package/dist/hooks/use-idle.spec.js +1 -1
- package/dist/hooks/use-idle.spec.js.map +1 -1
- package/dist/hooks/use-interval.d.ts +1 -1
- package/dist/hooks/use-interval.js +1 -1
- package/dist/hooks/use-interval.js.map +1 -1
- package/dist/hooks/use-interval.spec.js +1 -1
- package/dist/hooks/use-interval.spec.js.map +1 -1
- package/dist/hooks/use-local-storage.d.ts +1 -1
- package/dist/hooks/use-local-storage.js +1 -1
- package/dist/hooks/use-local-storage.js.map +1 -1
- package/dist/hooks/use-local-storage.spec.js +1 -1
- package/dist/hooks/use-local-storage.spec.js.map +1 -1
- package/dist/hooks/use-mask.d.ts +1 -1
- package/dist/hooks/use-mask.js +1 -1
- package/dist/hooks/use-mask.js.map +1 -1
- package/dist/hooks/use-mobile.d.ts +1 -1
- package/dist/hooks/use-mobile.js +1 -1
- package/dist/hooks/use-mobile.js.map +1 -1
- package/dist/hooks/use-mobile.spec.js +1 -1
- package/dist/hooks/use-mobile.spec.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/lib/badge.d.ts +1 -1
- package/dist/lib/button.d.ts +1 -1
- package/dist/lib/color.d.ts +1 -1
- package/dist/lib/compose-refs.d.ts +1 -1
- package/dist/lib/compose-refs.js +1 -1
- package/dist/lib/compose-refs.js.map +1 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/{magic-string.es-C-uSEkg2.js → magic-string.es-DbBO8R0S.js} +2 -2
- package/dist/{magic-string.es-C-uSEkg2.js.map → magic-string.es-DbBO8R0S.js.map} +1 -1
- package/dist/{react.esm-BagSCtI3.js → react.esm-D88qr0ij.js} +12 -12
- package/dist/{react.esm-BagSCtI3.js.map → react.esm-D88qr0ij.js.map} +1 -1
- package/dist/skills/uselets-ui/references/component-catalog.md +7 -7
- package/package.json +17 -14
- package/skills/uselets-ui/references/component-catalog.md +7 -7
- package/dist/dist-C35vdEt2.js.map +0 -1
- /package/dist/{chunk-CHh1Zzun.js → rolldown-runtime-Bdj-bS2b.js} +0 -0
package/dist/components/card.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{cn as e}from"../lib/utils.js";import{jsx as t}from"react/jsx-runtime";function Card({className:n,size:r=`md`,...i}){return t(`div`,{"data-slot":`card`,"data-size":r,className:e(`group/card flex flex-col gap-4 overflow-hidden rounded-xl py-4 text-sm bg-card text-card-foreground ring-foreground/10 ring-1`,`has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0`,`data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0`,`data-[size=lg]:gap-6 data-[size=lg]:py-6 data-[size=lg]:has-data-[slot=card-footer]:pb-0`,`*:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,n),...i})}function CardHeader({className:n,...r}){return t(`div`,{"data-slot":`card-header`,className:e(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4`,`group-data-[size=sm]/card:px-3 [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3`,`group-data-[size=lg]/card:px-6`,`has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]`,n),...r})}function CardTitle({className:n,...r}){return t(`div`,{"data-slot":`card-title`,className:e(`text-lg leading-snug font-bold group-data-[size=sm]/card:text-sm group-data-[size=lg]/card:text-xl`,n),...r})}function CardDescription({className:n,...r}){return t(`div`,{"data-slot":`card-description`,className:e(`text-muted-foreground text-sm`,n),...r})}function CardAction({className:n,...r}){return t(`div`,{"data-slot":`card-action`,className:e(`col-start-2 row-span-2 row-start-1 self-start justify-self-end`,n),...r})}function CardContent({className:n,...r}){return t(`div`,{"data-slot":`card-content`,className:e(`px-4 group-data-[size=sm]/card:px-3 group-data-[size=lg]/card:px-6`,n),...r})}function CardFooter({className:n,...r}){return t(`div`,{"data-slot":`card-footer`,className:e(`bg-muted/50 flex items-center rounded-b-xl border-t p-4`,`group-data-[size=sm]/card:p-3 group-data-[size=lg]/card:p-6`,n),...r})}export{Card,CardAction,CardContent,CardDescription,CardFooter,CardHeader,CardTitle};
|
|
2
2
|
//# sourceMappingURL=card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","names":[],"sources":["../../src/components/card.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { cn } from '../lib/utils'\n\nexport type CardProps = React.ComponentProps<'div'> & { size?: 'sm' | 'md' | 'lg' }\n\nexport type CardHeaderProps = React.ComponentProps<'div'>\n\nexport type CardTitleProps = React.ComponentProps<'div'>\n\nexport type CardDescriptionProps = React.ComponentProps<'div'>\n\nexport type CardActionProps = React.ComponentProps<'div'>\n\nexport type CardContentProps = React.ComponentProps<'div'>\n\nexport type CardFooterProps = React.ComponentProps<'div'>\n\nfunction Card({ className, size = 'md', ...props }: CardProps) {\n return (\n <div\n data-slot=\"card\"\n data-size={size}\n className={cn(\n 'group/card flex flex-col gap-4 overflow-hidden rounded-xl py-4 text-sm bg-card text-card-foreground ring-foreground/10 ring-1',\n 'has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0',\n 'data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0',\n 'data-[size=lg]:gap-6 data-[size=lg]:py-6 data-[size=lg]:has-data-[slot=card-footer]:pb-0',\n '*:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardHeader({ className, ...props }: CardHeaderProps) {\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n 'group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4',\n 'group-data-[size=sm]/card:px-3 [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3',\n 'group-data-[size=lg]/card:px-6',\n 'has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardTitle({ className, ...props }: CardTitleProps) {\n return (\n <div\n data-slot=\"card-title\"\n className={cn(\n 'text-lg leading-snug font-bold group-data-[size=sm]/card:text-sm group-data-[size=lg]/card:text-xl',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardDescription({ className, ...props }: CardDescriptionProps) {\n return <div data-slot=\"card-description\" className={cn('text-muted-foreground text-sm', className)} {...props} />\n}\n\nfunction CardAction({ className, ...props }: CardActionProps) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className)}\n {...props}\n />\n )\n}\n\nfunction CardContent({ className, ...props }: CardContentProps) {\n return (\n <div\n data-slot=\"card-content\"\n className={cn('px-4 group-data-[size=sm]/card:px-3 group-data-[size=lg]/card:px-6', className)}\n {...props}\n />\n )\n}\n\nfunction CardFooter({ className, ...props }: CardFooterProps) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn(\n 'bg-muted/50 flex items-center rounded-b-xl border-t p-4',\n 'group-data-[size=sm]/card:p-3 group-data-[size=lg]/card:p-6',\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle }\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"card.js","names":[],"sources":["../../src/components/card.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { cn } from '../lib/utils'\n\nexport type CardProps = React.ComponentProps<'div'> & { size?: 'sm' | 'md' | 'lg' }\n\nexport type CardHeaderProps = React.ComponentProps<'div'>\n\nexport type CardTitleProps = React.ComponentProps<'div'>\n\nexport type CardDescriptionProps = React.ComponentProps<'div'>\n\nexport type CardActionProps = React.ComponentProps<'div'>\n\nexport type CardContentProps = React.ComponentProps<'div'>\n\nexport type CardFooterProps = React.ComponentProps<'div'>\n\nfunction Card({ className, size = 'md', ...props }: CardProps) {\n return (\n <div\n data-slot=\"card\"\n data-size={size}\n className={cn(\n 'group/card flex flex-col gap-4 overflow-hidden rounded-xl py-4 text-sm bg-card text-card-foreground ring-foreground/10 ring-1',\n 'has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0',\n 'data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0',\n 'data-[size=lg]:gap-6 data-[size=lg]:py-6 data-[size=lg]:has-data-[slot=card-footer]:pb-0',\n '*:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardHeader({ className, ...props }: CardHeaderProps) {\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n 'group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4',\n 'group-data-[size=sm]/card:px-3 [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3',\n 'group-data-[size=lg]/card:px-6',\n 'has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardTitle({ className, ...props }: CardTitleProps) {\n return (\n <div\n data-slot=\"card-title\"\n className={cn(\n 'text-lg leading-snug font-bold group-data-[size=sm]/card:text-sm group-data-[size=lg]/card:text-xl',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardDescription({ className, ...props }: CardDescriptionProps) {\n return <div data-slot=\"card-description\" className={cn('text-muted-foreground text-sm', className)} {...props} />\n}\n\nfunction CardAction({ className, ...props }: CardActionProps) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className)}\n {...props}\n />\n )\n}\n\nfunction CardContent({ className, ...props }: CardContentProps) {\n return (\n <div\n data-slot=\"card-content\"\n className={cn('px-4 group-data-[size=sm]/card:px-3 group-data-[size=lg]/card:px-6', className)}\n {...props}\n />\n )\n}\n\nfunction CardFooter({ className, ...props }: CardFooterProps) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn(\n 'bg-muted/50 flex items-center rounded-b-xl border-t p-4',\n 'group-data-[size=sm]/card:p-3 group-data-[size=lg]/card:p-6',\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle }\n"],"mappings":"qHAkBA,SAAS,KAAK,CAAE,YAAW,OAAO,KAAM,GAAG,GAAoB,CAC7D,OACE,EAAC,MAAD,CACE,YAAU,OACV,YAAW,EACX,UAAW,EACT,gIACA,+DACA,2FACA,2FACA,mEACA,CACF,EACA,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,WAAW,CAAE,YAAW,GAAG,GAA0B,CAC5D,OACE,EAAC,MAAD,CACE,YAAU,cACV,UAAW,EACT,kGACA,6FACA,iCACA,0GACA,CACF,EACA,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,UAAU,CAAE,YAAW,GAAG,GAAyB,CAC1D,OACE,EAAC,MAAD,CACE,YAAU,aACV,UAAW,EACT,qGACA,CACF,EACA,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,gBAAgB,CAAE,YAAW,GAAG,GAA+B,CACtE,OAAO,EAAC,MAAD,CAAK,YAAU,mBAAmB,UAAW,EAAG,gCAAiC,CAAS,EAAG,GAAI,CAAQ,CAAA,CAClH,CAEA,SAAS,WAAW,CAAE,YAAW,GAAG,GAA0B,CAC5D,OACE,EAAC,MAAD,CACE,YAAU,cACV,UAAW,EAAG,iEAAkE,CAAS,EACzF,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,YAAY,CAAE,YAAW,GAAG,GAA2B,CAC9D,OACE,EAAC,MAAD,CACE,YAAU,eACV,UAAW,EAAG,qEAAsE,CAAS,EAC7F,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,WAAW,CAAE,YAAW,GAAG,GAA0B,CAC5D,OACE,EAAC,MAAD,CACE,YAAU,cACV,UAAW,EACT,0DACA,8DACA,CACF,EACA,GAAI,CACL,CAAA,CAEL"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as __name } from "../
|
|
1
|
+
import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
|
|
2
2
|
import { Button } from "./button.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import useEmblaCarousel, { UseEmblaCarouselType } from "embla-carousel-react";
|
|
@@ -41,34 +41,34 @@ declare function Carousel({
|
|
|
41
41
|
className,
|
|
42
42
|
children,
|
|
43
43
|
...props
|
|
44
|
-
}: CarouselProps):
|
|
44
|
+
}: CarouselProps): React.JSX.Element;
|
|
45
45
|
declare function CarouselContent({
|
|
46
46
|
className,
|
|
47
47
|
...props
|
|
48
|
-
}: CarouselContentProps):
|
|
48
|
+
}: CarouselContentProps): React.JSX.Element;
|
|
49
49
|
declare function CarouselItem({
|
|
50
50
|
className,
|
|
51
51
|
...props
|
|
52
|
-
}: CarouselItemProps):
|
|
52
|
+
}: CarouselItemProps): React.JSX.Element;
|
|
53
53
|
declare function CarouselPrevious({
|
|
54
54
|
className,
|
|
55
55
|
variant,
|
|
56
56
|
size,
|
|
57
57
|
color,
|
|
58
58
|
...props
|
|
59
|
-
}: CarouselPreviousProps):
|
|
59
|
+
}: CarouselPreviousProps): React.JSX.Element;
|
|
60
60
|
declare function CarouselNext({
|
|
61
61
|
className,
|
|
62
62
|
variant,
|
|
63
63
|
size,
|
|
64
64
|
color,
|
|
65
65
|
...props
|
|
66
|
-
}: CarouselNextProps):
|
|
66
|
+
}: CarouselNextProps): React.JSX.Element;
|
|
67
67
|
declare function CarouselIndicators({
|
|
68
68
|
className,
|
|
69
69
|
getIndicatorProps,
|
|
70
70
|
...props
|
|
71
|
-
}: CarouselIndicatorsProps):
|
|
71
|
+
}: CarouselIndicatorsProps): React.JSX.Element | null;
|
|
72
72
|
//#endregion
|
|
73
73
|
export { Carousel, CarouselApi, CarouselContent, CarouselContentProps, CarouselIndicators, CarouselIndicatorsProps, CarouselItem, CarouselItemProps, CarouselNext, CarouselNextProps, CarouselPrevious, CarouselPreviousProps, CarouselProps, useCarousel };
|
|
74
74
|
//# sourceMappingURL=carousel.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{cn as e}from"../lib/utils.js";import{Button as t}from"./button.js";import{IconChevronLeft as n,IconChevronRight as r}from"@tabler/icons-react";import{jsx as i,jsxs as a}from"react/jsx-runtime";import*as o from"react";import s from"embla-carousel-react";const c=o.createContext(null);function useCarousel(){let e=o.useContext(c);if(!e)throw Error(`useCarousel must be used within a <Carousel />`);return e}function Carousel({orientation:t=`horizontal`,opts:n,setApi:r,plugins:a,className:l,children:u,...d}){let[f,p]=s({...n,axis:t===`horizontal`?`x`:`y`},a),[m,h]=o.useState(!1),[g,_]=o.useState(!1),[v,y]=o.useState(0),[b,x]=o.useState([]),S=o.useCallback(e=>{e&&(h(e.canScrollPrev()),_(e.canScrollNext()),y(e.selectedScrollSnap()),x(e.scrollSnapList()))},[]),C=o.useCallback(()=>{p?.scrollPrev()},[p]),w=o.useCallback(()=>{p?.scrollNext()},[p]),T=o.useCallback(e=>{p?.scrollTo(e)},[p]),E=o.useCallback(e=>{e.key===`ArrowLeft`?(e.preventDefault(),C()):e.key===`ArrowRight`&&(e.preventDefault(),w())},[C,w]);return o.useEffect(()=>{!p||!r||r(p)},[p,r]),o.useEffect(()=>{if(p)return S(p),p.on(`reInit`,S),p.on(`select`,S),()=>{p?.off(`reInit`,S),p?.off(`select`,S)}},[p,S]),i(c.Provider,{value:{carouselRef:f,api:p,opts:n,orientation:t||(n?.axis===`y`?`vertical`:`horizontal`),scrollPrev:C,scrollNext:w,scrollTo:T,canScrollPrev:m,canScrollNext:g,selectedIndex:v,scrollSnaps:b},children:i(`section`,{onKeyDownCapture:E,className:e(`relative`,l),"data-slot":`carousel`,...d,children:u})})}function CarouselContent({className:t,...n}){let{carouselRef:r,orientation:a}=useCarousel();return i(`div`,{ref:r,className:`overflow-hidden`,"data-slot":`carousel-content`,children:i(`div`,{className:e(`flex`,a===`horizontal`?`-ml-4`:`-mt-4 flex-col`,t),...n})})}function CarouselItem({className:t,...n}){let{orientation:r}=useCarousel();return i(`div`,{"data-slot":`carousel-item`,className:e(`min-w-0 shrink-0 grow-0 basis-full`,r===`horizontal`?`pl-4`:`pt-4`,t),...n})}function CarouselPrevious({className:r,variant:o=`outline`,size:s=`icon-sm`,color:c=`zinc`,...l}){let{orientation:u,scrollPrev:d,canScrollPrev:f}=useCarousel();return a(t,{"data-slot":`carousel-previous`,color:c,variant:o,size:s,className:e(`absolute touch-manipulation rounded-full`,u===`horizontal`?`top-1/2 -left-12 -translate-y-1/2`:`-top-12 left-1/2 -translate-x-1/2 rotate-90`,r),disabled:!f,onClick:d,...l,children:[i(n,{}),i(`span`,{className:`sr-only`,children:`Previous slide`})]})}function CarouselNext({className:n,variant:o=`outline`,size:s=`icon-sm`,color:c=`zinc`,...l}){let{orientation:u,scrollNext:d,canScrollNext:f}=useCarousel();return a(t,{"data-slot":`carousel-next`,color:c,variant:o,size:s,className:e(`absolute touch-manipulation rounded-full`,u===`horizontal`?`top-1/2 -right-12 -translate-y-1/2`:`-bottom-12 left-1/2 -translate-x-1/2 rotate-90`,n),disabled:!f,onClick:d,...l,children:[i(r,{}),i(`span`,{className:`sr-only`,children:`Next slide`})]})}function CarouselIndicators({className:t,getIndicatorProps:n,...r}){let{orientation:a,scrollSnaps:o,selectedIndex:s,scrollTo:c}=useCarousel();return o.length===0?null:i(`div`,{"data-slot":`carousel-indicators`,className:e(`pointer-events-none absolute flex justify-center gap-2`,a===`horizontal`?`inset-x-0 bottom-4 flex-row`:`inset-y-0 right-4 flex-col items-center`,t),...r,children:o.map((t,r)=>{let{className:a,onClick:o,...l}=n?.(r)??{};return i(`button`,{...l,type:`button`,"data-slot":`carousel-indicator`,"data-active":s===r?!0:void 0,"aria-label":`Go to slide ${r+1}`,className:e(`pointer-events-auto cursor-pointer size-2.5 touch-manipulation rounded-full bg-background opacity-60 shadow-sm ring-1 ring-border transition-opacity hover:opacity-100 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3 focus-visible:outline-none data-[active=true]:opacity-100`,a),onClick:e=>{c(r),o?.(e)}},t)})})}export{Carousel,CarouselContent,CarouselIndicators,CarouselItem,CarouselNext,CarouselPrevious,useCarousel};
|
|
2
2
|
//# sourceMappingURL=carousel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.js","names":[],"sources":["../../src/components/carousel.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { IconChevronLeft, IconChevronRight } from '@tabler/icons-react'\nimport useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react'\n\nimport { cn } from '../lib/utils'\nimport { Button } from './button'\n\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>\ntype CarouselOptions = UseCarouselParameters[0]\ntype CarouselPlugin = UseCarouselParameters[1]\n\nexport type CarouselApi = UseEmblaCarouselType[1]\n\nexport type CarouselProps = React.ComponentProps<'div'> & {\n opts?: CarouselOptions\n plugins?: CarouselPlugin\n orientation?: 'horizontal' | 'vertical'\n setApi?: (api: CarouselApi) => void\n}\n\nexport type CarouselContentProps = React.ComponentProps<'div'>\n\nexport type CarouselItemProps = React.ComponentProps<'div'>\n\nexport type CarouselPreviousProps = React.ComponentProps<typeof Button>\n\nexport type CarouselNextProps = React.ComponentProps<typeof Button>\n\nexport type CarouselIndicatorsProps = React.ComponentProps<'div'> & {\n getIndicatorProps?: (index: number) => React.ComponentProps<'button'>\n}\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0]\n api: ReturnType<typeof useEmblaCarousel>[1]\n scrollPrev: () => void\n scrollNext: () => void\n scrollTo: (index: number) => void\n canScrollPrev: boolean\n canScrollNext: boolean\n selectedIndex: number\n scrollSnaps: number[]\n} & CarouselProps\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null)\n\nfunction useCarousel() {\n const context = React.useContext(CarouselContext)\n\n if (!context) {\n throw new Error('useCarousel must be used within a <Carousel />')\n }\n\n return context\n}\n\nfunction Carousel({ orientation = 'horizontal', opts, setApi, plugins, className, children, ...props }: CarouselProps) {\n const [carouselRef, api] = useEmblaCarousel(\n {\n ...opts,\n axis: orientation === 'horizontal' ? 'x' : 'y'\n },\n plugins\n )\n const [canScrollPrev, setCanScrollPrev] = React.useState(false)\n const [canScrollNext, setCanScrollNext] = React.useState(false)\n const [selectedIndex, setSelectedIndex] = React.useState(0)\n const [scrollSnaps, setScrollSnaps] = React.useState<number[]>([])\n\n const onSelect = React.useCallback((api: CarouselApi) => {\n if (!api) return\n setCanScrollPrev(api.canScrollPrev())\n setCanScrollNext(api.canScrollNext())\n setSelectedIndex(api.selectedScrollSnap())\n setScrollSnaps(api.scrollSnapList())\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 scrollTo = React.useCallback(\n (index: number) => {\n api?.scrollTo(index)\n },\n [api]\n )\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) return\n setApi(api)\n }, [api, setApi])\n\n React.useEffect(() => {\n if (!api) return\n onSelect(api)\n api.on('reInit', onSelect)\n api.on('select', onSelect)\n\n return () => {\n api?.off('reInit', onSelect)\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 scrollTo,\n canScrollPrev,\n canScrollNext,\n selectedIndex,\n scrollSnaps\n }}\n >\n <section onKeyDownCapture={handleKeyDown} className={cn('relative', className)} data-slot=\"carousel\" {...props}>\n {children}\n </section>\n </CarouselContext.Provider>\n )\n}\n\nfunction CarouselContent({ className, ...props }: CarouselContentProps) {\n const { carouselRef, orientation } = useCarousel()\n\n return (\n <div ref={carouselRef} className=\"overflow-hidden\" data-slot=\"carousel-content\">\n <div className={cn('flex', orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col', className)} {...props} />\n </div>\n )\n}\n\nfunction CarouselItem({ className, ...props }: CarouselItemProps) {\n const { orientation } = useCarousel()\n\n return (\n <div\n data-slot=\"carousel-item\"\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\nfunction CarouselPrevious({\n className,\n variant = 'outline',\n size = 'icon-sm',\n color = 'zinc',\n ...props\n}: CarouselPreviousProps) {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel()\n\n return (\n <Button\n data-slot=\"carousel-previous\"\n color={color}\n variant={variant}\n size={size}\n className={cn(\n 'absolute touch-manipulation 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 <IconChevronLeft />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n )\n}\n\nfunction CarouselNext({\n className,\n variant = 'outline',\n size = 'icon-sm',\n color = 'zinc',\n ...props\n}: CarouselNextProps) {\n const { orientation, scrollNext, canScrollNext } = useCarousel()\n\n return (\n <Button\n data-slot=\"carousel-next\"\n color={color}\n variant={variant}\n size={size}\n className={cn(\n 'absolute touch-manipulation 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 <IconChevronRight />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n )\n}\n\nfunction CarouselIndicators({ className, getIndicatorProps, ...props }: CarouselIndicatorsProps) {\n const { orientation, scrollSnaps, selectedIndex, scrollTo } = useCarousel()\n\n if (scrollSnaps.length === 0) {\n return null\n }\n\n return (\n <div\n data-slot=\"carousel-indicators\"\n className={cn(\n 'pointer-events-none absolute flex justify-center gap-2',\n orientation === 'horizontal' ? 'inset-x-0 bottom-4 flex-row' : 'inset-y-0 right-4 flex-col items-center',\n className\n )}\n {...props}\n >\n {scrollSnaps.map((snap, index) => {\n const { className: indicatorClassName, onClick, ...indicatorProps } = getIndicatorProps?.(index) ?? {}\n\n return (\n <button\n key={snap}\n {...indicatorProps}\n type=\"button\"\n data-slot=\"carousel-indicator\"\n data-active={selectedIndex === index ? true : undefined}\n aria-label={`Go to slide ${index + 1}`}\n className={cn(\n 'pointer-events-auto cursor-pointer size-2.5 touch-manipulation rounded-full bg-background opacity-60 shadow-sm ring-1 ring-border transition-opacity hover:opacity-100 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3 focus-visible:outline-none data-[active=true]:opacity-100',\n indicatorClassName\n )}\n onClick={(event) => {\n scrollTo(index)\n onClick?.(event)\n }}\n />\n )\n })}\n </div>\n )\n}\n\nexport { Carousel, CarouselContent, CarouselIndicators, CarouselItem, CarouselNext, CarouselPrevious, useCarousel }\n"],"mappings":"iSA6CA,MAAM,EAAkB,EAAM,cAA2C,IAAI,EAE7E,SAAS,aAAc,CACrB,IAAM,EAAU,EAAM,WAAW,CAAe,EAEhD,GAAI,CAAC,EACH,MAAU,MAAM,gDAAgD,EAGlE,OAAO,CACT,CAEA,SAAS,SAAS,CAAE,cAAc,aAAc,OAAM,SAAQ,UAAS,YAAW,WAAU,GAAG,GAAwB,CACrH,GAAM,CAAC,EAAa,GAAO,EACzB,CACE,GAAG,EACH,KAAM,IAAgB,aAAe,IAAM,GAC7C,EACA,CACF,EACM,CAAC,EAAe,GAAoB,EAAM,SAAS,EAAK,EACxD,CAAC,EAAe,GAAoB,EAAM,SAAS,EAAK,EACxD,CAAC,EAAe,GAAoB,EAAM,SAAS,CAAC,EACpD,CAAC,EAAa,GAAkB,EAAM,SAAmB,CAAC,CAAC,EAE3D,EAAW,EAAM,YAAa,GAAqB,CAClD,IACL,EAAiB,EAAI,cAAc,CAAC,EACpC,EAAiB,EAAI,cAAc,CAAC,EACpC,EAAiB,EAAI,mBAAmB,CAAC,EACzC,EAAe,EAAI,eAAe,CAAC,EACrC,EAAG,CAAC,CAAC,EAEC,EAAa,EAAM,gBAAkB,CACzC,GAAK,WAAW,CAClB,EAAG,CAAC,CAAG,CAAC,EAEF,EAAa,EAAM,gBAAkB,CACzC,GAAK,WAAW,CAClB,EAAG,CAAC,CAAG,CAAC,EAEF,EAAW,EAAM,YACpB,GAAkB,CACjB,GAAK,SAAS,CAAK,CACrB,EACA,CAAC,CAAG,CACN,EAEM,EAAgB,EAAM,YACzB,GAA+C,CAC1C,EAAM,MAAQ,aAChB,EAAM,eAAe,EACrB,EAAW,GACF,EAAM,MAAQ,eACvB,EAAM,eAAe,EACrB,EAAW,EAEf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,CACE,YAAU,oBACH,QACE,UACH,OACN,UAAW,EACT,2CACA,IAAgB,aACZ,oCACA,8CACJ,CACF,EACA,SAAU,CAAC,EACX,QAAS,EACT,GAAI,WAdN,CAgBE,EAAC,EAAD,CAAkB,CAAA,EAClB,EAAC,OAAD,CAAM,UAAU,mBAAU,gBAAoB,CAAA,CACxC,GAEZ,CAEA,SAAS,aAAa,CACpB,YACA,UAAU,UACV,OAAO,UACP,QAAQ,OACR,GAAG,GACiB,CACpB,GAAM,CAAE,cAAa,aAAY,iBAAkB,YAAY,EAE/D,OACE,EAAC,EAAD,CACE,YAAU,gBACH,QACE,UACH,OACN,UAAW,EACT,2CACA,IAAgB,aACZ,qCACA,iDACJ,CACF,EACA,SAAU,CAAC,EACX,QAAS,EACT,GAAI,WAdN,CAgBE,EAAC,EAAD,CAAmB,CAAA,EACnB,EAAC,OAAD,CAAM,UAAU,mBAAU,YAAgB,CAAA,CACpC,GAEZ,CAEA,SAAS,mBAAmB,CAAE,YAAW,oBAAmB,GAAG,GAAkC,CAC/F,GAAM,CAAE,cAAa,cAAa,gBAAe,YAAa,YAAY,EAM1E,OAJI,EAAY,SAAW,EAClB,KAIP,EAAC,MAAD,CACE,YAAU,sBACV,UAAW,EACT,yDACA,IAAgB,aAAe,8BAAgC,0CAC/D,CACF,EACA,GAAI,WAEH,EAAY,KAAK,EAAM,IAAU,CAChC,GAAM,CAAE,UAAW,EAAoB,UAAS,GAAG,GAAmB,IAAoB,CAAK,GAAK,CAAC,EAErG,OACE,EAAC,SAAD,CAEE,GAAI,EACJ,KAAK,SACL,YAAU,qBACV,cAAa,IAAkB,EAAQ,GAAO,IAAA,GAC9C,aAAY,eAAe,EAAQ,IACnC,UAAW,EACT,6SACA,CACF,EACA,QAAU,GAAU,CAClB,EAAS,CAAK,EACd,IAAU,CAAK,CACjB,CACD,EAdM,CAcN,CAEL,CAAC,CACE,CAAA,CAET"}
|
|
1
|
+
{"version":3,"file":"carousel.js","names":[],"sources":["../../src/components/carousel.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { IconChevronLeft, IconChevronRight } from '@tabler/icons-react'\nimport useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react'\n\nimport { cn } from '../lib/utils'\nimport { Button } from './button'\n\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>\ntype CarouselOptions = UseCarouselParameters[0]\ntype CarouselPlugin = UseCarouselParameters[1]\n\nexport type CarouselApi = UseEmblaCarouselType[1]\n\nexport type CarouselProps = React.ComponentProps<'div'> & {\n opts?: CarouselOptions\n plugins?: CarouselPlugin\n orientation?: 'horizontal' | 'vertical'\n setApi?: (api: CarouselApi) => void\n}\n\nexport type CarouselContentProps = React.ComponentProps<'div'>\n\nexport type CarouselItemProps = React.ComponentProps<'div'>\n\nexport type CarouselPreviousProps = React.ComponentProps<typeof Button>\n\nexport type CarouselNextProps = React.ComponentProps<typeof Button>\n\nexport type CarouselIndicatorsProps = React.ComponentProps<'div'> & {\n getIndicatorProps?: (index: number) => React.ComponentProps<'button'>\n}\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0]\n api: ReturnType<typeof useEmblaCarousel>[1]\n scrollPrev: () => void\n scrollNext: () => void\n scrollTo: (index: number) => void\n canScrollPrev: boolean\n canScrollNext: boolean\n selectedIndex: number\n scrollSnaps: number[]\n} & CarouselProps\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null)\n\nfunction useCarousel() {\n const context = React.useContext(CarouselContext)\n\n if (!context) {\n throw new Error('useCarousel must be used within a <Carousel />')\n }\n\n return context\n}\n\nfunction Carousel({ orientation = 'horizontal', opts, setApi, plugins, className, children, ...props }: CarouselProps) {\n const [carouselRef, api] = useEmblaCarousel(\n {\n ...opts,\n axis: orientation === 'horizontal' ? 'x' : 'y'\n },\n plugins\n )\n const [canScrollPrev, setCanScrollPrev] = React.useState(false)\n const [canScrollNext, setCanScrollNext] = React.useState(false)\n const [selectedIndex, setSelectedIndex] = React.useState(0)\n const [scrollSnaps, setScrollSnaps] = React.useState<number[]>([])\n\n const onSelect = React.useCallback((api: CarouselApi) => {\n if (!api) return\n setCanScrollPrev(api.canScrollPrev())\n setCanScrollNext(api.canScrollNext())\n setSelectedIndex(api.selectedScrollSnap())\n setScrollSnaps(api.scrollSnapList())\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 scrollTo = React.useCallback(\n (index: number) => {\n api?.scrollTo(index)\n },\n [api]\n )\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) return\n setApi(api)\n }, [api, setApi])\n\n React.useEffect(() => {\n if (!api) return\n onSelect(api)\n api.on('reInit', onSelect)\n api.on('select', onSelect)\n\n return () => {\n api?.off('reInit', onSelect)\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 scrollTo,\n canScrollPrev,\n canScrollNext,\n selectedIndex,\n scrollSnaps\n }}\n >\n <section onKeyDownCapture={handleKeyDown} className={cn('relative', className)} data-slot=\"carousel\" {...props}>\n {children}\n </section>\n </CarouselContext.Provider>\n )\n}\n\nfunction CarouselContent({ className, ...props }: CarouselContentProps) {\n const { carouselRef, orientation } = useCarousel()\n\n return (\n <div ref={carouselRef} className=\"overflow-hidden\" data-slot=\"carousel-content\">\n <div className={cn('flex', orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col', className)} {...props} />\n </div>\n )\n}\n\nfunction CarouselItem({ className, ...props }: CarouselItemProps) {\n const { orientation } = useCarousel()\n\n return (\n <div\n data-slot=\"carousel-item\"\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\nfunction CarouselPrevious({\n className,\n variant = 'outline',\n size = 'icon-sm',\n color = 'zinc',\n ...props\n}: CarouselPreviousProps) {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel()\n\n return (\n <Button\n data-slot=\"carousel-previous\"\n color={color}\n variant={variant}\n size={size}\n className={cn(\n 'absolute touch-manipulation 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 <IconChevronLeft />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n )\n}\n\nfunction CarouselNext({\n className,\n variant = 'outline',\n size = 'icon-sm',\n color = 'zinc',\n ...props\n}: CarouselNextProps) {\n const { orientation, scrollNext, canScrollNext } = useCarousel()\n\n return (\n <Button\n data-slot=\"carousel-next\"\n color={color}\n variant={variant}\n size={size}\n className={cn(\n 'absolute touch-manipulation 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 <IconChevronRight />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n )\n}\n\nfunction CarouselIndicators({ className, getIndicatorProps, ...props }: CarouselIndicatorsProps) {\n const { orientation, scrollSnaps, selectedIndex, scrollTo } = useCarousel()\n\n if (scrollSnaps.length === 0) {\n return null\n }\n\n return (\n <div\n data-slot=\"carousel-indicators\"\n className={cn(\n 'pointer-events-none absolute flex justify-center gap-2',\n orientation === 'horizontal' ? 'inset-x-0 bottom-4 flex-row' : 'inset-y-0 right-4 flex-col items-center',\n className\n )}\n {...props}\n >\n {scrollSnaps.map((snap, index) => {\n const { className: indicatorClassName, onClick, ...indicatorProps } = getIndicatorProps?.(index) ?? {}\n\n return (\n <button\n key={snap}\n {...indicatorProps}\n type=\"button\"\n data-slot=\"carousel-indicator\"\n data-active={selectedIndex === index ? true : undefined}\n aria-label={`Go to slide ${index + 1}`}\n className={cn(\n 'pointer-events-auto cursor-pointer size-2.5 touch-manipulation rounded-full bg-background opacity-60 shadow-sm ring-1 ring-border transition-opacity hover:opacity-100 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3 focus-visible:outline-none data-[active=true]:opacity-100',\n indicatorClassName\n )}\n onClick={(event) => {\n scrollTo(index)\n onClick?.(event)\n }}\n />\n )\n })}\n </div>\n )\n}\n\nexport { Carousel, CarouselContent, CarouselIndicators, CarouselItem, CarouselNext, CarouselPrevious, useCarousel }\n"],"mappings":"4SA6CA,MAAM,EAAkB,EAAM,cAA2C,IAAI,EAE7E,SAAS,aAAc,CACrB,IAAM,EAAU,EAAM,WAAW,CAAe,EAEhD,GAAI,CAAC,EACH,MAAU,MAAM,gDAAgD,EAGlE,OAAO,CACT,CAEA,SAAS,SAAS,CAAE,cAAc,aAAc,OAAM,SAAQ,UAAS,YAAW,WAAU,GAAG,GAAwB,CACrH,GAAM,CAAC,EAAa,GAAO,EACzB,CACE,GAAG,EACH,KAAM,IAAgB,aAAe,IAAM,GAC7C,EACA,CACF,EACM,CAAC,EAAe,GAAoB,EAAM,SAAS,EAAK,EACxD,CAAC,EAAe,GAAoB,EAAM,SAAS,EAAK,EACxD,CAAC,EAAe,GAAoB,EAAM,SAAS,CAAC,EACpD,CAAC,EAAa,GAAkB,EAAM,SAAmB,CAAC,CAAC,EAE3D,EAAW,EAAM,YAAa,GAAqB,CAClD,IACL,EAAiB,EAAI,cAAc,CAAC,EACpC,EAAiB,EAAI,cAAc,CAAC,EACpC,EAAiB,EAAI,mBAAmB,CAAC,EACzC,EAAe,EAAI,eAAe,CAAC,EACrC,EAAG,CAAC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AAM,CAAE,UAAW,EAAoB,UAAS,GAAG,GAAmB,IAAoB,CAAK,GAAK,CAAC,EAErG,OACE,EAAC,SAAD,CAEE,GAAI,EACJ,KAAK,SACL,YAAU,qBACV,cAAa,IAAkB,EAAQ,GAAO,IAAA,GAC9C,aAAY,eAAe,EAAQ,IACnC,UAAW,EACT,6SACA,CACF,EACA,QAAU,GAAU,CAClB,EAAS,CAAK,EACd,IAAU,CAAK,CACjB,CACD,EAdM,CAcN,CAEL,CAAC,CACE,CAAA,CAET"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{Carousel as e,CarouselContent as t,CarouselIndicators as n,CarouselItem as r}from"./carousel.js";import{a as i,n as a,r as o}from"../react.esm-D88qr0ij.js";import{n as s}from"../dist-B-hwiqYg.js";import{jsx as c,jsxs as l}from"react/jsx-runtime";const u=s.hoisted(()=>({api:{canScrollPrev:s.fn(),canScrollNext:s.fn(),selectedScrollSnap:s.fn(),scrollSnapList:s.fn(),scrollPrev:s.fn(),scrollNext:s.fn(),scrollTo:s.fn(),on:s.fn(),off:s.fn()}}));s.mock(`embla-carousel-react`,()=>({default:s.fn(()=>[s.fn(),u.api])}));function renderCarousel(){return o(l(e,{children:[l(t,{children:[c(r,{children:`First`}),c(r,{children:`Second`}),c(r,{children:`Third`})]}),c(n,{})]}))}describe(`CarouselIndicators`,()=>{beforeEach(()=>{u.api.canScrollPrev.mockReturnValue(!0),u.api.canScrollNext.mockReturnValue(!0),u.api.selectedScrollSnap.mockReturnValue(1),u.api.scrollSnapList.mockReturnValue([0,1,2])}),it(`renders one indicator button per scroll snap`,async()=>{renderCarousel(),expect(await i.findAllByRole(`button`)).toHaveLength(3)}),it(`marks the selected indicator as active`,async()=>{renderCarousel();let e=await i.findByRole(`button`,{name:`Go to slide 2`});expect(e.getAttribute(`data-active`)).toBe(`true`),expect(i.getByRole(`button`,{name:`Go to slide 1`}).getAttribute(`data-active`)).toBeNull()}),it(`scrolls to the indicator index when clicked`,async()=>{renderCarousel(),a.click(await i.findByRole(`button`,{name:`Go to slide 3`})),expect(u.api.scrollTo).toHaveBeenCalledWith(2)}),it(`does not render indicators when there are no scroll snaps`,()=>{u.api.scrollSnapList.mockReturnValue([]);let{container:e}=renderCarousel();expect(e.querySelector(`[data-slot="carousel-indicators"]`)).toBeNull()})});
|
|
2
2
|
//# sourceMappingURL=carousel.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.spec.js","names":[],"sources":["../../src/components/carousel.spec.tsx"],"sourcesContent":["import { fireEvent, render, screen } from '@testing-library/react'\nimport { vi } from 'vitest'\n\nconst emblaMock = vi.hoisted(() => {\n return {\n api: {\n canScrollPrev: vi.fn(),\n canScrollNext: vi.fn(),\n selectedScrollSnap: vi.fn(),\n scrollSnapList: vi.fn(),\n scrollPrev: vi.fn(),\n scrollNext: vi.fn(),\n scrollTo: vi.fn(),\n on: vi.fn(),\n off: vi.fn()\n }\n }\n})\n\nvi.mock('embla-carousel-react', () => ({\n default: vi.fn(() => [vi.fn(), emblaMock.api])\n}))\n\nimport { Carousel, CarouselContent, CarouselIndicators, CarouselItem } from './carousel'\n\nfunction renderCarousel() {\n return render(\n <Carousel>\n <CarouselContent>\n <CarouselItem>First</CarouselItem>\n <CarouselItem>Second</CarouselItem>\n <CarouselItem>Third</CarouselItem>\n </CarouselContent>\n <CarouselIndicators />\n </Carousel>\n )\n}\n\ndescribe('CarouselIndicators', () => {\n beforeEach(() => {\n emblaMock.api.canScrollPrev.mockReturnValue(true)\n emblaMock.api.canScrollNext.mockReturnValue(true)\n emblaMock.api.selectedScrollSnap.mockReturnValue(1)\n emblaMock.api.scrollSnapList.mockReturnValue([0, 1, 2])\n })\n\n it('renders one indicator button per scroll snap', async () => {\n renderCarousel()\n\n expect(await screen.findAllByRole('button')).toHaveLength(3)\n })\n\n it('marks the selected indicator as active', async () => {\n renderCarousel()\n\n const selectedIndicator = await screen.findByRole('button', { name: 'Go to slide 2' })\n\n expect(selectedIndicator.getAttribute('data-active')).toBe('true')\n expect(screen.getByRole('button', { name: 'Go to slide 1' }).getAttribute('data-active')).toBeNull()\n })\n\n it('scrolls to the indicator index when clicked', async () => {\n renderCarousel()\n\n fireEvent.click(await screen.findByRole('button', { name: 'Go to slide 3' }))\n\n expect(emblaMock.api.scrollTo).toHaveBeenCalledWith(2)\n })\n\n it('does not render indicators when there are no scroll snaps', () => {\n emblaMock.api.scrollSnapList.mockReturnValue([])\n\n const { container } = renderCarousel()\n\n expect(container.querySelector('[data-slot=\"carousel-indicators\"]')).toBeNull()\n })\n})\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"carousel.spec.js","names":[],"sources":["../../src/components/carousel.spec.tsx"],"sourcesContent":["import { fireEvent, render, screen } from '@testing-library/react'\nimport { vi } from 'vitest'\n\nconst emblaMock = vi.hoisted(() => {\n return {\n api: {\n canScrollPrev: vi.fn(),\n canScrollNext: vi.fn(),\n selectedScrollSnap: vi.fn(),\n scrollSnapList: vi.fn(),\n scrollPrev: vi.fn(),\n scrollNext: vi.fn(),\n scrollTo: vi.fn(),\n on: vi.fn(),\n off: vi.fn()\n }\n }\n})\n\nvi.mock('embla-carousel-react', () => ({\n default: vi.fn(() => [vi.fn(), emblaMock.api])\n}))\n\nimport { Carousel, CarouselContent, CarouselIndicators, CarouselItem } from './carousel'\n\nfunction renderCarousel() {\n return render(\n <Carousel>\n <CarouselContent>\n <CarouselItem>First</CarouselItem>\n <CarouselItem>Second</CarouselItem>\n <CarouselItem>Third</CarouselItem>\n </CarouselContent>\n <CarouselIndicators />\n </Carousel>\n )\n}\n\ndescribe('CarouselIndicators', () => {\n beforeEach(() => {\n emblaMock.api.canScrollPrev.mockReturnValue(true)\n emblaMock.api.canScrollNext.mockReturnValue(true)\n emblaMock.api.selectedScrollSnap.mockReturnValue(1)\n emblaMock.api.scrollSnapList.mockReturnValue([0, 1, 2])\n })\n\n it('renders one indicator button per scroll snap', async () => {\n renderCarousel()\n\n expect(await screen.findAllByRole('button')).toHaveLength(3)\n })\n\n it('marks the selected indicator as active', async () => {\n renderCarousel()\n\n const selectedIndicator = await screen.findByRole('button', { name: 'Go to slide 2' })\n\n expect(selectedIndicator.getAttribute('data-active')).toBe('true')\n expect(screen.getByRole('button', { name: 'Go to slide 1' }).getAttribute('data-active')).toBeNull()\n })\n\n it('scrolls to the indicator index when clicked', async () => {\n renderCarousel()\n\n fireEvent.click(await screen.findByRole('button', { name: 'Go to slide 3' }))\n\n expect(emblaMock.api.scrollTo).toHaveBeenCalledWith(2)\n })\n\n it('does not render indicators when there are no scroll snaps', () => {\n emblaMock.api.scrollSnapList.mockReturnValue([])\n\n const { container } = renderCarousel()\n\n expect(container.querySelector('[data-slot=\"carousel-indicators\"]')).toBeNull()\n })\n})\n"],"mappings":"qSAGA,MAAM,EAAY,EAAG,aACZ,CACL,IAAK,CACH,cAAe,EAAG,GAAG,EACrB,cAAe,EAAG,GAAG,EACrB,mBAAoB,EAAG,GAAG,EAC1B,eAAgB,EAAG,GAAG,EACtB,WAAY,EAAG,GAAG,EAClB,WAAY,EAAG,GAAG,EAClB,SAAU,EAAG,GAAG,EAChB,GAAI,EAAG,GAAG,EACV,IAAK,EAAG,GAAG,CACb,CACF,EACD,EAED,EAAG,KAAK,4BAA+B,CACrC,QAAS,EAAG,OAAS,CAAC,EAAG,GAAG,EAAG,EAAU,GAAG,CAAC,CAC/C,EAAE,EAIF,SAAS,gBAAiB,CACxB,OAAO,EACL,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAA,SAAc,OAAmB,CAAA,EACjC,EAAC,EAAD,CAAA,SAAc,QAAoB,CAAA,EAClC,EAAC,EAAD,CAAA,SAAc,OAAmB,CAAA,CAClB,CAAA,CAAA,EACjB,EAAC,EAAD,CAAqB,CAAA,CACb,CAAA,CAAA,CACZ,CACF,CAEA,SAAS,yBAA4B,CACnC,eAAiB,CACf,EAAU,IAAI,cAAc,gBAAgB,EAAI,EAChD,EAAU,IAAI,cAAc,gBAAgB,EAAI,EAChD,EAAU,IAAI,mBAAmB,gBAAgB,CAAC,EAClD,EAAU,IAAI,eAAe,gBAAgB,CAAC,EAAG,EAAG,CAAC,CAAC,CACxD,CAAC,EAED,GAAG,+CAAgD,SAAY,CAC7D,eAAe,EAEf,OAAO,MAAM,EAAO,cAAc,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAC7D,CAAC,EAED,GAAG,yCAA0C,SAAY,CACvD,eAAe,EAEf,IAAM,EAAoB,MAAM,EAAO,WAAW,SAAU,CAAE,KAAM,eAAgB,CAAC,EAErF,OAAO,EAAkB,aAAa,aAAa,CAAC,CAAC,CAAC,KAAK,MAAM,EACjE,OAAO,EAAO,UAAU,SAAU,CAAE,KAAM,eAAgB,CAAC,CAAC,CAAC,aAAa,aAAa,CAAC,CAAC,CAAC,SAAS,CACrG,CAAC,EAED,GAAG,8CAA+C,SAAY,CAC5D,eAAe,EAEf,EAAU,MAAM,MAAM,EAAO,WAAW,SAAU,CAAE,KAAM,eAAgB,CAAC,CAAC,EAE5E,OAAO,EAAU,IAAI,QAAQ,CAAC,CAAC,qBAAqB,CAAC,CACvD,CAAC,EAED,GAAG,gEAAmE,CACpE,EAAU,IAAI,eAAe,gBAAgB,CAAC,CAAC,EAE/C,GAAM,CAAE,aAAc,eAAe,EAErC,OAAO,EAAU,cAAc,mCAAmC,CAAC,CAAC,CAAC,SAAS,CAChF,CAAC,CACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as __name } from "../
|
|
1
|
+
import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
|
|
2
2
|
import { VariantProps } from "class-variance-authority";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
@@ -13,7 +13,7 @@ declare function Center({
|
|
|
13
13
|
direction,
|
|
14
14
|
size,
|
|
15
15
|
...props
|
|
16
|
-
}: CenterProps):
|
|
16
|
+
}: CenterProps): React.JSX.Element;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { Center, CenterProps, centerVariants };
|
|
19
19
|
//# sourceMappingURL=center.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{cn as e}from"../lib/utils.js";import{jsx as t}from"react/jsx-runtime";import{cva as n}from"class-variance-authority";const r=n(`flex items-center justify-center`,{variants:{direction:{horizontal:`flex-row`,vertical:`flex-col`},size:{xs:`gap-1`,sm:`gap-2`,md:`gap-3`,lg:`gap-4`,xl:`gap-6`}},defaultVariants:{direction:`horizontal`,size:`md`}});function Center({className:n,direction:i=`horizontal`,size:a=`md`,...o}){return t(`div`,{"data-slot":`center`,"data-direction":i,"data-size":a,className:e(r({direction:i,size:a}),n),...o})}export{Center,r as centerVariants};
|
|
2
2
|
//# sourceMappingURL=center.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"center.js","names":[],"sources":["../../src/components/center.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils'\n\nconst centerVariants = cva('flex items-center justify-center', {\n variants: {\n direction: {\n horizontal: 'flex-row',\n vertical: 'flex-col'\n },\n size: {\n xs: 'gap-1',\n sm: 'gap-2',\n md: 'gap-3',\n lg: 'gap-4',\n xl: 'gap-6'\n }\n },\n defaultVariants: {\n direction: 'horizontal',\n size: 'md'\n }\n})\n\nexport type CenterProps = React.ComponentProps<'div'> & VariantProps<typeof centerVariants>\n\nfunction Center({ className, direction = 'horizontal', size = 'md', ...props }: CenterProps) {\n return (\n <div\n data-slot=\"center\"\n data-direction={direction}\n data-size={size}\n className={cn(centerVariants({ direction, size }), className)}\n {...props}\n />\n )\n}\n\nexport { Center, centerVariants }\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"center.js","names":[],"sources":["../../src/components/center.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils'\n\nconst centerVariants = cva('flex items-center justify-center', {\n variants: {\n direction: {\n horizontal: 'flex-row',\n vertical: 'flex-col'\n },\n size: {\n xs: 'gap-1',\n sm: 'gap-2',\n md: 'gap-3',\n lg: 'gap-4',\n xl: 'gap-6'\n }\n },\n defaultVariants: {\n direction: 'horizontal',\n size: 'md'\n }\n})\n\nexport type CenterProps = React.ComponentProps<'div'> & VariantProps<typeof centerVariants>\n\nfunction Center({ className, direction = 'horizontal', size = 'md', ...props }: CenterProps) {\n return (\n <div\n data-slot=\"center\"\n data-direction={direction}\n data-size={size}\n className={cn(centerVariants({ direction, size }), className)}\n {...props}\n />\n )\n}\n\nexport { Center, centerVariants }\n"],"mappings":"oKAMA,MAAM,EAAiB,EAAI,mCAAoC,CAC7D,SAAU,CACR,UAAW,CACT,WAAY,WACZ,SAAU,UACZ,EACA,KAAM,CACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,OACN,CACF,EACA,gBAAiB,CACf,UAAW,aACX,KAAM,IACR,CACF,CAAC,EAID,SAAS,OAAO,CAAE,YAAW,YAAY,aAAc,OAAO,KAAM,GAAG,GAAsB,CAC3F,OACE,EAAC,MAAD,CACE,YAAU,SACV,iBAAgB,EAChB,YAAW,EACX,UAAW,EAAG,EAAe,CAAE,YAAW,MAAK,CAAC,EAAG,CAAS,EAC5D,GAAI,CACL,CAAA,CAEL"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { ChartConfig, ChartContainer, ChartContainerProps, ChartLegend, ChartLegendContent, ChartLegendContentProps, ChartLegendProps, ChartStyle, ChartStyleProps, ChartTooltip, ChartTooltipContent, ChartTooltipContentProps, ChartTooltipProps };
|
|
1
|
+
import { _ as resolveChartColor, a as ChartContainerProps, c as ChartLegendContentProps, d as ChartStyleProps, f as ChartTooltip, g as DEFAULT_CHART_PALETTE, h as ChartTooltipProps, i as ChartContainer, l as ChartLegendProps, m as ChartTooltipContentProps, n as ChartColorKey, o as ChartLegend, p as ChartTooltipContent, r as ChartConfig, s as ChartLegendContent, t as CHART_COLOR_KEYS, u as ChartStyle } from "../chart-lqgodZYQ.js";
|
|
2
|
+
export { CHART_COLOR_KEYS, ChartColorKey, ChartConfig, ChartContainer, ChartContainerProps, ChartLegend, ChartLegendContent, ChartLegendContentProps, ChartLegendProps, ChartStyle, ChartStyleProps, ChartTooltip, ChartTooltipContent, ChartTooltipContentProps, ChartTooltipProps, DEFAULT_CHART_PALETTE, resolveChartColor };
|
package/dist/components/chart.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import"../
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{cn as e}from"../lib/utils.js";import{Fragment as t,jsx as n,jsxs as r}from"react/jsx-runtime";import*as i from"react";import*as a from"recharts";const o={light:``,dark:`.dark`},s=[`primary`,`brand`,`gray`,`zinc`,`red`,`yellow`,`green`,`blue`,`indigo`,`pink`];function resolveChartColor(e){if(e)return s.includes(e)?`var(--${e}-500)`:e}const c=[`var(--chart-1)`,`var(--chart-2)`,`var(--chart-3)`,`var(--chart-4)`,`var(--chart-5)`],l=i.createContext(null);function useChart(){let e=i.useContext(l);if(!e)throw Error(`useChart must be used within a <ChartContainer />`);return e}function ChartContainer({id:t,className:r,children:o,config:s,...c}){let u=i.useId(),d=`chart-${t||u.replace(/:/g,``)}`;return n(l.Provider,{value:{config:s},children:n(`div`,{"data-slot":`chart`,"data-chart":d,className:e(`flex aspect-video justify-center text-xs [&_.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-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.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 [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden`,r),...c,children:n(a.ResponsiveContainer,{children:o})})})}const ChartStyle=({id:e,config:t})=>{let r=Object.entries(t).filter(([,e])=>e.theme||e.color);return r.length?n(`style`,{children:Object.entries(o).map(([t,n])=>`
|
|
2
2
|
${n} [data-chart=${e}] {
|
|
3
3
|
${r.map(([e,n])=>{let r=n.theme?.[t]||n.color;return r?` --color-${e}: ${r};`:null}).join(`
|
|
4
4
|
`)}
|
|
5
5
|
}
|
|
6
6
|
`).join(`
|
|
7
|
-
`)}):null},
|
|
7
|
+
`)}):null},u=a.Tooltip;function ChartTooltipContent({active:a,payload:o,className:s,indicator:c=`dot`,hideLabel:l=!1,hideIndicator:u=!1,label:d,labelFormatter:f,labelClassName:p,formatter:m,color:h,nameKey:g,labelKey:_}){let{config:v}=useChart(),y=i.useMemo(()=>{if(l||!o?.length)return null;let[t]=o,r=getPayloadConfigFromPayload(v,t,`${_||t?.dataKey||t?.name||`value`}`),i=!_&&typeof d==`string`?v[d]?.label||d:r?.label;return f?n(`div`,{className:e(`font-medium`,p),children:f(i,o)}):i?n(`div`,{className:e(`font-medium`,p),children:i}):null},[d,f,o,l,p,v,_]);if(!a||!o?.length)return null;let b=o.length===1&&c!==`dot`;return r(`div`,{className:e(`grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl`,s),children:[b?null:y,n(`div`,{className:`grid gap-1.5`,children:o.filter(e=>e.type!==`none`).map((i,a)=>{let o=getPayloadConfigFromPayload(v,i,`${g||i.name||i.dataKey||`value`}`),s=h||i.payload.fill||i.color;return n(`div`,{className:e(`flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground`,c===`dot`&&`items-center`),children:m&&i?.value!==void 0&&i.name?m(i.value,i.name,i,a,i.payload):r(t,{children:[o?.icon?n(o.icon,{}):!u&&n(`div`,{className:e(`shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)`,{"h-2.5 w-2.5":c===`dot`,"w-1":c===`line`,"w-0 border-[1.5px] border-dashed bg-transparent":c===`dashed`,"my-0.5":b&&c===`dashed`}),style:{"--color-bg":s,"--color-border":s}}),r(`div`,{className:e(`flex flex-1 justify-between leading-none`,b?`items-end`:`items-center`),children:[r(`div`,{className:`grid gap-1.5`,children:[b?y:null,n(`span`,{className:`text-muted-foreground`,children:o?.label||i.name})]}),i.value&&n(`span`,{className:`font-mono font-medium text-foreground tabular-nums`,children:i.value.toLocaleString()})]})]})},String(i.dataKey))})})]})}const d=a.Legend;function ChartLegendContent({className:t,hideIcon:i=!1,payload:a,verticalAlign:o=`bottom`,nameKey:s}){let{config:c}=useChart();return a?.length?n(`div`,{className:e(`flex items-center justify-center flex-wrap gap-4`,o===`top`?`pb-3`:`pt-3`,t),children:a.filter(e=>e.type!==`none`).map(t=>{let a=getPayloadConfigFromPayload(c,t,`${s||t.dataKey||`value`}`);return r(`div`,{className:e(`flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground`),children:[a?.icon&&!i?n(a.icon,{}):n(`div`,{className:`h-3 w-3 shrink-0 rounded-[2px]`,style:{backgroundColor:t.color}}),a?.label]},t.value)})}):null}function getPayloadConfigFromPayload(e,t,n){if(typeof t!=`object`||!t)return;let r=`payload`in t&&typeof t.payload==`object`&&t.payload!==null?t.payload:void 0,i=n;return n in t&&typeof t[n]==`string`?i=t[n]:r&&n in r&&typeof r[n]==`string`&&(i=r[n]),i in e?e[i]:e[n]}export{s as CHART_COLOR_KEYS,ChartContainer,d as ChartLegend,ChartLegendContent,ChartStyle,u as ChartTooltip,ChartTooltipContent,c as DEFAULT_CHART_PALETTE,resolveChartColor};
|
|
8
8
|
//# sourceMappingURL=chart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.js","names":[],"sources":["../../src/components/chart.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport * as RechartsPrimitive from 'recharts'\n\nimport { cn } from '../lib/utils'\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: '', dark: '.dark' } as const\n\nexport type ChartConfig = {\n [k in string]: {\n label?: React.ReactNode\n icon?: React.ComponentType\n } & ({ color?: string; theme?: never } | { color?: never; theme: Record<keyof typeof THEMES, string> })\n}\n\ntype ChartContextProps = {\n config: ChartConfig\n}\n\nexport type ChartContainerProps = React.ComponentProps<'div'> & {\n config: ChartConfig\n children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children']\n}\n\nexport type ChartStyleProps = {\n id: string\n config: ChartConfig\n}\n\nexport type ChartTooltipProps = React.ComponentProps<typeof RechartsPrimitive.Tooltip>\n\nexport type ChartTooltipContentProps = Partial<\n RechartsPrimitive.DefaultTooltipContentProps<number | string | Array<number | string>, number | string>\n> &\n Omit<React.ComponentProps<'div'>, 'formatter'> & {\n active?: boolean\n color?: string\n hideLabel?: boolean\n hideIndicator?: boolean\n indicator?: 'line' | 'dot' | 'dashed'\n nameKey?: string\n labelKey?: string\n }\n\nexport type ChartLegendProps = React.ComponentProps<typeof RechartsPrimitive.Legend>\n\nexport type ChartLegendContentProps = React.ComponentProps<'div'> &\n Pick<RechartsPrimitive.DefaultLegendContentProps, 'payload' | 'verticalAlign'> & {\n hideIcon?: boolean\n nameKey?: string\n }\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null)\n\nfunction useChart() {\n const context = React.useContext(ChartContext)\n\n if (!context) {\n throw new Error('useChart must be used within a <ChartContainer />')\n }\n\n return context\n}\n\nfunction ChartContainer({ id, className, children, config, ...props }: ChartContainerProps) {\n const uniqueId = React.useId()\n const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`\n\n return (\n <ChartContext.Provider value={{ config }}>\n <div\n data-slot=\"chart\"\n data-chart={chartId}\n className={cn(\n \"flex aspect-video justify-center text-xs [&_.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-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.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 [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden\",\n className\n )}\n {...props}\n >\n <ChartStyle id={chartId} config={config} />\n <RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n )\n}\n\nconst ChartStyle = ({ id, config }: ChartStyleProps) => {\n const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color)\n\n if (!colorConfig.length) {\n return null\n }\n\n const styles = Object.entries(THEMES)\n .map(\n ([theme, prefix]) => `\n${prefix} [data-chart=${id}] {\n${colorConfig\n .map(([key, itemConfig]) => {\n const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || itemConfig.color\n return color ? ` --color-${key}: ${color};` : null\n })\n .join('\\n')}\n}\n`\n )\n .join('\\n')\n\n return <style>{styles}</style>\n}\n\nconst ChartTooltip = RechartsPrimitive.Tooltip\n\nfunction ChartTooltipContent({\n active,\n payload,\n className,\n indicator = 'dot',\n hideLabel = false,\n hideIndicator = false,\n label,\n labelFormatter,\n labelClassName,\n formatter,\n color,\n nameKey,\n labelKey\n}: ChartTooltipContentProps) {\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' ? config[label as keyof typeof config]?.label || label : itemConfig?.label\n\n if (labelFormatter) {\n return <div className={cn('font-medium', labelClassName)}>{labelFormatter(value, payload)}</div>\n }\n\n if (!value) {\n return null\n }\n\n return <div className={cn('font-medium', labelClassName)}>{value}</div>\n }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey])\n\n if (!active || !payload?.length) {\n return null\n }\n\n const nestLabel = payload.length === 1 && indicator !== 'dot'\n\n return (\n <div\n className={cn(\n 'grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl',\n className\n )}\n >\n {!nestLabel ? tooltipLabel : null}\n <div className=\"grid gap-1.5\">\n {payload\n .filter((item) => item.type !== 'none')\n .map((item, index) => {\n const key = `${nameKey || item.name || item.dataKey || 'value'}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n const indicatorColor = color || item.payload.fill || item.color\n\n return (\n <div\n key={String(item.dataKey)}\n className={cn(\n 'flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground',\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=\"font-mono font-medium text-foreground tabular-nums\">\n {item.value.toLocaleString()}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n )\n })}\n </div>\n </div>\n )\n}\n\nconst ChartLegend = RechartsPrimitive.Legend\n\nfunction ChartLegendContent({\n className,\n hideIcon = false,\n payload,\n verticalAlign = 'bottom',\n nameKey\n}: ChartLegendContentProps) {\n const { config } = useChart()\n\n if (!payload?.length) {\n return null\n }\n\n return (\n <div className={cn('flex items-center justify-center gap-4', verticalAlign === 'top' ? 'pb-3' : 'pt-3', className)}>\n {payload\n .filter((item) => item.type !== 'none')\n .map((item) => {\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('flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground')}\n >\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div\n className=\"h-2 w-2 shrink-0 rounded-[2px]\"\n style={{\n backgroundColor: item.color\n }}\n />\n )}\n {itemConfig?.label}\n </div>\n )\n })}\n </div>\n )\n}\n\nfunction getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {\n if (typeof payload !== 'object' || payload === null) {\n return undefined\n }\n\n const payloadPayload =\n 'payload' in payload && typeof payload.payload === 'object' && payload.payload !== null\n ? payload.payload\n : undefined\n\n let configLabelKey: string = key\n\n if (key in payload && typeof payload[key as keyof typeof payload] === 'string') {\n configLabelKey = payload[key as keyof typeof payload] as string\n } else if (\n payloadPayload &&\n key in payloadPayload &&\n typeof payloadPayload[key as keyof typeof payloadPayload] === 'string'\n ) {\n configLabelKey = payloadPayload[key as keyof typeof payloadPayload] as string\n }\n\n return configLabelKey in config ? config[configLabelKey] : config[key as keyof typeof config]\n}\n\nexport { ChartContainer,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GAAY,WAAY,EACjC,OAGF,IAAM,EACJ,YAAa,GAAW,OAAO,EAAQ,SAAY,UAAY,EAAQ,UAAY,KAC/E,EAAQ,QACR,IAAA,GAEF,EAAyB,EAY7B,OAVI,KAAO,GAAW,OAAO,EAAQ,IAAiC,SACpE,EAAiB,EAAQ,GAEzB,GACA,KAAO,GACP,OAAO,EAAe,IAAwC,WAE9D,EAAiB,EAAe,IAG3B,KAAkB,EAAS,EAAO,GAAkB,EAAO,EACpE"}
|
|
1
|
+
{"version":3,"file":"chart.js","names":[],"sources":["../../src/components/chart.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport * as RechartsPrimitive from 'recharts'\n\nimport { cn } from '../lib/utils'\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: '', dark: '.dark' } as const\n\nexport type ChartColorKey =\n | 'primary'\n | 'brand'\n | 'gray'\n | 'zinc'\n | 'red'\n | 'yellow'\n | 'green'\n | 'blue'\n | 'indigo'\n | 'pink'\n\nconst CHART_COLOR_KEYS: readonly ChartColorKey[] = [\n 'primary',\n 'brand',\n 'gray',\n 'zinc',\n 'red',\n 'yellow',\n 'green',\n 'blue',\n 'indigo',\n 'pink'\n]\n\nexport function resolveChartColor(value: string | undefined): string | undefined {\n if (!value) return undefined\n if ((CHART_COLOR_KEYS as readonly string[]).includes(value)) {\n return `var(--${value}-500)`\n }\n return value\n}\n\nexport const DEFAULT_CHART_PALETTE = [\n 'var(--chart-1)',\n 'var(--chart-2)',\n 'var(--chart-3)',\n 'var(--chart-4)',\n 'var(--chart-5)'\n] as const\n\nexport type ChartConfig = {\n [k in string]: {\n label?: React.ReactNode\n icon?: React.ComponentType\n } & ({ color?: string; theme?: never } | { color?: never; theme: Record<keyof typeof THEMES, string> })\n}\n\ntype ChartContextProps = {\n config: ChartConfig\n}\n\nexport type ChartContainerProps = React.ComponentProps<'div'> & {\n config: ChartConfig\n children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children']\n}\n\nexport type ChartStyleProps = {\n id: string\n config: ChartConfig\n}\n\nexport type ChartTooltipProps = React.ComponentProps<typeof RechartsPrimitive.Tooltip>\n\nexport type ChartTooltipContentProps = Partial<\n RechartsPrimitive.DefaultTooltipContentProps<number | string | Array<number | string>, number | string>\n> &\n Omit<React.ComponentProps<'div'>, 'formatter'> & {\n active?: boolean\n color?: string\n hideLabel?: boolean\n hideIndicator?: boolean\n indicator?: 'line' | 'dot' | 'dashed'\n nameKey?: string\n labelKey?: string\n }\n\nexport type ChartLegendProps = React.ComponentProps<typeof RechartsPrimitive.Legend>\n\nexport type ChartLegendContentProps = React.ComponentProps<'div'> &\n Pick<RechartsPrimitive.DefaultLegendContentProps, 'payload' | 'verticalAlign'> & {\n hideIcon?: boolean\n nameKey?: string\n }\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null)\n\nfunction useChart() {\n const context = React.useContext(ChartContext)\n\n if (!context) {\n throw new Error('useChart must be used within a <ChartContainer />')\n }\n\n return context\n}\n\nfunction ChartContainer({ id, className, children, config, ...props }: ChartContainerProps) {\n const uniqueId = React.useId()\n const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`\n\n return (\n <ChartContext.Provider value={{ config }}>\n <div\n data-slot=\"chart\"\n data-chart={chartId}\n className={cn(\n \"flex aspect-video justify-center text-xs [&_.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-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.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 [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden\",\n className\n )}\n {...props}\n >\n <RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n )\n}\n\nconst ChartStyle = ({ id, config }: ChartStyleProps) => {\n const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color)\n\n if (!colorConfig.length) {\n return null\n }\n\n const styles = Object.entries(THEMES)\n .map(\n ([theme, prefix]) => `\n${prefix} [data-chart=${id}] {\n${colorConfig\n .map(([key, itemConfig]) => {\n const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || itemConfig.color\n return color ? ` --color-${key}: ${color};` : null\n })\n .join('\\n')}\n}\n`\n )\n .join('\\n')\n\n return <style>{styles}</style>\n}\n\nconst ChartTooltip = RechartsPrimitive.Tooltip\n\nfunction ChartTooltipContent({\n active,\n payload,\n className,\n indicator = 'dot',\n hideLabel = false,\n hideIndicator = false,\n label,\n labelFormatter,\n labelClassName,\n formatter,\n color,\n nameKey,\n labelKey\n}: ChartTooltipContentProps) {\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' ? config[label as keyof typeof config]?.label || label : itemConfig?.label\n\n if (labelFormatter) {\n return <div className={cn('font-medium', labelClassName)}>{labelFormatter(value, payload)}</div>\n }\n\n if (!value) {\n return null\n }\n\n return <div className={cn('font-medium', labelClassName)}>{value}</div>\n }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey])\n\n if (!active || !payload?.length) {\n return null\n }\n\n const nestLabel = payload.length === 1 && indicator !== 'dot'\n\n return (\n <div\n className={cn(\n 'grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl',\n className\n )}\n >\n {!nestLabel ? tooltipLabel : null}\n <div className=\"grid gap-1.5\">\n {payload\n .filter((item) => item.type !== 'none')\n .map((item, index) => {\n const key = `${nameKey || item.name || item.dataKey || 'value'}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n const indicatorColor = color || item.payload.fill || item.color\n\n return (\n <div\n key={String(item.dataKey)}\n className={cn(\n 'flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground',\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=\"font-mono font-medium text-foreground tabular-nums\">\n {item.value.toLocaleString()}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n )\n })}\n </div>\n </div>\n )\n}\n\nconst ChartLegend = RechartsPrimitive.Legend\n\nfunction ChartLegendContent({\n className,\n hideIcon = false,\n payload,\n verticalAlign = 'bottom',\n nameKey\n}: ChartLegendContentProps) {\n const { config } = useChart()\n\n if (!payload?.length) {\n return null\n }\n\n return (\n <div\n className={cn(\n 'flex items-center justify-center flex-wrap gap-4',\n verticalAlign === 'top' ? 'pb-3' : 'pt-3',\n className\n )}\n >\n {payload\n .filter((item) => item.type !== 'none')\n .map((item) => {\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('flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground')}\n >\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div\n className=\"h-3 w-3 shrink-0 rounded-[2px]\"\n style={{\n backgroundColor: item.color\n }}\n />\n )}\n {itemConfig?.label}\n </div>\n )\n })}\n </div>\n )\n}\n\nfunction getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {\n if (typeof payload !== 'object' || payload === null) {\n return undefined\n }\n\n const payloadPayload =\n 'payload' in payload && typeof payload.payload === 'object' && payload.payload !== null\n ? payload.payload\n : undefined\n\n let configLabelKey: string = key\n\n if (key in payload && typeof payload[key as keyof typeof payload] === 'string') {\n configLabelKey = payload[key as keyof typeof payload] as string\n } else if (\n payloadPayload &&\n key in payloadPayload &&\n typeof payloadPayload[key as keyof typeof payloadPayload] === 'string'\n ) {\n configLabelKey = payloadPayload[key as keyof typeof payloadPayload] as string\n }\n\n return configLabelKey in config ? config[configLabelKey] : config[key as keyof typeof config]\n}\n\nexport {\n CHART_COLOR_KEYS,\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartStyle,\n ChartTooltip,\n ChartTooltipContent\n}\n"],"mappings":"gMAOA,MAAM,EAAS,CAAE,MAAO,GAAI,KAAM,OAAQ,EAcpC,EAA6C,CACjD,UACA,QACA,OACA,OACA,MACA,SACA,QACA,OACA,SACA,MACF,EAEA,SAAgB,kBAAkB,EAA+C,CAC1E,KAIL,OAHK,EAAuC,SAAS,CAAK,EACjD,SAAS,EAAM,OAEjB,CACT,CAEA,MAAa,EAAwB,CACnC,iBACA,iBACA,iBACA,iBACA,gBACF,EA8CM,EAAe,EAAM,cAAwC,IAAI,EAEvE,SAAS,UAAW,CAClB,IAAM,EAAU,EAAM,WAAW,CAAY,EAE7C,GAAI,CAAC,EACH,MAAU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B,EAAe,IAG3B,KAAkB,EAAS,EAAO,GAAkB,EAAO,EACpE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as __name } from "../
|
|
1
|
+
import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
|
|
2
2
|
import { UIColor } from "../lib/color.js";
|
|
3
3
|
import { LabelProps } from "./label.js";
|
|
4
4
|
import { Checkbox as Checkbox$1 } from "radix-ui";
|
|
@@ -24,7 +24,7 @@ declare function Checkbox({
|
|
|
24
24
|
labelProps,
|
|
25
25
|
size,
|
|
26
26
|
...props
|
|
27
|
-
}: CheckboxProps):
|
|
27
|
+
}: CheckboxProps): React.JSX.Element;
|
|
28
28
|
//#endregion
|
|
29
29
|
export { Checkbox, CheckboxProps };
|
|
30
30
|
//# sourceMappingURL=checkbox.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{cn as e}from"../lib/utils.js";import{selectionControlColorVariants as t}from"../lib/color.js";import{Label as n}from"./label.js";import{useFieldControlId as r}from"./field.js";import{IconCheck as i,IconMinus as a}from"@tabler/icons-react";import{Checkbox as o}from"radix-ui";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{cva as l}from"class-variance-authority";import{useId as u}from"react";const d=l(`border-input dark:bg-input/30 data-checked:bg-(--selection-control) data-checked:text-(--selection-control-foreground) data-checked:border-(--selection-control) aria-invalid:aria-checked:border-(--selection-control) aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 flex items-center justify-center border transition-colors group-has-disabled/field:opacity-50 focus-visible:ring-3 aria-invalid:ring-3 peer relative shrink-0 outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50`,{variants:{color:t,size:{sm:`size-3.5 rounded-[3px] [&_[data-slot=checkbox-indicator]>svg]:size-3`,md:`size-4 rounded-[4px] [&_[data-slot=checkbox-indicator]>svg]:size-3.5`,lg:`size-5 rounded-[5px] [&_[data-slot=checkbox-indicator]>svg]:size-4`}},defaultVariants:{color:`primary`,size:`md`}}),f=l(``,{variants:{size:{sm:`text-xs`,md:`text-sm`,lg:`text-xl`}},defaultVariants:{size:`md`}});function Checkbox({className:t,color:l=`primary`,id:p,label:m,labelProps:h,size:g=`md`,..._}){let v=u(),y=r(p),b=m!==void 0,x=y??(b?v:void 0),{className:S,...C}=h??{},w=s(o.Root,{"data-slot":`checkbox`,"data-color":l,"data-size":g,id:x,className:e(d({color:l,size:g}),t),..._,children:c(o.Indicator,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none`,children:[s(i,{className:`block in-data-[state=indeterminate]:hidden`}),s(a,{className:`hidden in-data-[state=indeterminate]:block`})]})});return b?c(`div`,{"data-slot":`checkbox-field`,className:`flex items-center gap-2`,children:[w,s(n,{...C,htmlFor:x,className:e(f({size:g}),S),children:m})]}):w}export{Checkbox};
|
|
2
2
|
//# sourceMappingURL=checkbox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","names":["CheckboxPrimitive","Label"],"sources":["../../src/components/checkbox.tsx"],"sourcesContent":["import type * as React from 'react'\nimport { type ReactNode, useId } from 'react'\n\nimport { IconCheck, IconMinus } from '@tabler/icons-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { Checkbox as CheckboxPrimitive } from 'radix-ui'\n\nimport type { UIColor } from '../lib/color'\nimport { selectionControlColorVariants } from '../lib/color'\nimport { cn } from '../lib/utils'\nimport { useFieldControlId } from './field'\nimport { Label, type LabelProps } from './label'\n\nconst checkboxVariants = cva(\n 'border-input dark:bg-input/30 data-checked:bg-(--selection-control) data-checked:text-(--selection-control-foreground) data-checked:border-(--selection-control) aria-invalid:aria-checked:border-(--selection-control) aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 flex items-center justify-center border transition-colors group-has-disabled/field:opacity-50 focus-visible:ring-3 aria-invalid:ring-3 peer relative shrink-0 outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50',\n {\n variants: {\n color: selectionControlColorVariants,\n size: {\n sm: 'size-3.5 rounded-[3px] [&_[data-slot=checkbox-indicator]>svg]:size-3',\n md: 'size-4 rounded-[4px] [&_[data-slot=checkbox-indicator]>svg]:size-3.5',\n lg: 'size-5 rounded-[5px] [&_[data-slot=checkbox-indicator]>svg]:size-4'\n }\n },\n defaultVariants: {\n color: 'primary',\n size: 'md'\n }\n }\n)\n\nconst checkboxLabelVariants = cva('', {\n variants: {\n size: {\n sm: 'text-xs',\n md: 'text-sm',\n lg: 'text-xl'\n }\n },\n defaultVariants: {\n size: 'md'\n }\n})\n\nexport type CheckboxProps = React.ComponentProps<typeof CheckboxPrimitive.Root> &\n VariantProps<typeof checkboxVariants> & {\n color?: UIColor\n label?: ReactNode\n labelProps?: Omit<LabelProps, 'children' | 'htmlFor'>\n }\n\nfunction Checkbox({ className, color = 'primary', id, label, labelProps, size = 'md', ...props }: CheckboxProps) {\n const generatedId = useId()\n const fieldControlId = useFieldControlId(id)\n const hasLabel = label !== undefined\n const resolvedId = fieldControlId ?? (hasLabel ? generatedId : undefined)\n const { className: labelClassName, ...labelRootProps } = labelProps ?? {}\n\n const checkbox = (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n data-color={color}\n data-size={size}\n id={resolvedId}\n className={cn(checkboxVariants({ color, size }), className)}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n className=\"grid place-content-center text-current transition-none\"\n >\n <IconCheck className=\"block in-data-[state=indeterminate]:hidden\" />\n <IconMinus className=\"hidden in-data-[state=indeterminate]:block\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n )\n\n if (!hasLabel) {\n return checkbox\n }\n\n return (\n <div data-slot=\"checkbox-field\" className=\"flex items-center gap-2\">\n {checkbox}\n <Label {...labelRootProps} htmlFor={resolvedId} className={cn(checkboxLabelVariants({ size }), labelClassName)}>\n {label}\n </Label>\n </div>\n )\n}\n\nexport { Checkbox }\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkbox.js","names":["CheckboxPrimitive","Label"],"sources":["../../src/components/checkbox.tsx"],"sourcesContent":["import type * as React from 'react'\nimport { type ReactNode, useId } from 'react'\n\nimport { IconCheck, IconMinus } from '@tabler/icons-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { Checkbox as CheckboxPrimitive } from 'radix-ui'\n\nimport type { UIColor } from '../lib/color'\nimport { selectionControlColorVariants } from '../lib/color'\nimport { cn } from '../lib/utils'\nimport { useFieldControlId } from './field'\nimport { Label, type LabelProps } from './label'\n\nconst checkboxVariants = cva(\n 'border-input dark:bg-input/30 data-checked:bg-(--selection-control) data-checked:text-(--selection-control-foreground) data-checked:border-(--selection-control) aria-invalid:aria-checked:border-(--selection-control) aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 flex items-center justify-center border transition-colors group-has-disabled/field:opacity-50 focus-visible:ring-3 aria-invalid:ring-3 peer relative shrink-0 outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50',\n {\n variants: {\n color: selectionControlColorVariants,\n size: {\n sm: 'size-3.5 rounded-[3px] [&_[data-slot=checkbox-indicator]>svg]:size-3',\n md: 'size-4 rounded-[4px] [&_[data-slot=checkbox-indicator]>svg]:size-3.5',\n lg: 'size-5 rounded-[5px] [&_[data-slot=checkbox-indicator]>svg]:size-4'\n }\n },\n defaultVariants: {\n color: 'primary',\n size: 'md'\n }\n }\n)\n\nconst checkboxLabelVariants = cva('', {\n variants: {\n size: {\n sm: 'text-xs',\n md: 'text-sm',\n lg: 'text-xl'\n }\n },\n defaultVariants: {\n size: 'md'\n }\n})\n\nexport type CheckboxProps = React.ComponentProps<typeof CheckboxPrimitive.Root> &\n VariantProps<typeof checkboxVariants> & {\n color?: UIColor\n label?: ReactNode\n labelProps?: Omit<LabelProps, 'children' | 'htmlFor'>\n }\n\nfunction Checkbox({ className, color = 'primary', id, label, labelProps, size = 'md', ...props }: CheckboxProps) {\n const generatedId = useId()\n const fieldControlId = useFieldControlId(id)\n const hasLabel = label !== undefined\n const resolvedId = fieldControlId ?? (hasLabel ? generatedId : undefined)\n const { className: labelClassName, ...labelRootProps } = labelProps ?? {}\n\n const checkbox = (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n data-color={color}\n data-size={size}\n id={resolvedId}\n className={cn(checkboxVariants({ color, size }), className)}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n className=\"grid place-content-center text-current transition-none\"\n >\n <IconCheck className=\"block in-data-[state=indeterminate]:hidden\" />\n <IconMinus className=\"hidden in-data-[state=indeterminate]:block\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n )\n\n if (!hasLabel) {\n return checkbox\n }\n\n return (\n <div data-slot=\"checkbox-field\" className=\"flex items-center gap-2\">\n {checkbox}\n <Label {...labelRootProps} htmlFor={resolvedId} className={cn(checkboxLabelVariants({ size }), labelClassName)}>\n {label}\n </Label>\n </div>\n )\n}\n\nexport { Checkbox }\n"],"mappings":"icAaA,MAAM,EAAmB,EACvB,0qBACA,CACE,SAAU,CACR,MAAO,EACP,KAAM,CACJ,GAAI,uEACJ,GAAI,uEACJ,GAAI,oEACN,CACF,EACA,gBAAiB,CACf,MAAO,UACP,KAAM,IACR,CACF,CACF,EAEM,EAAwB,EAAI,GAAI,CACpC,SAAU,CACR,KAAM,CACJ,GAAI,UACJ,GAAI,UACJ,GAAI,SACN,CACF,EACA,gBAAiB,CACf,KAAM,IACR,CACF,CAAC,EASD,SAAS,SAAS,CAAE,YAAW,QAAQ,UAAW,KAAI,QAAO,aAAY,OAAO,KAAM,GAAG,GAAwB,CAC/G,IAAM,EAAc,EAAM,EACpB,EAAiB,EAAkB,CAAE,EACrC,EAAW,IAAU,IAAA,GACrB,EAAa,IAAmB,EAAW,EAAc,IAAA,IACzD,CAAE,UAAW,EAAgB,GAAG,GAAmB,GAAc,CAAC,EAElE,EACJ,EAACA,EAAkB,KAAnB,CACE,YAAU,WACV,aAAY,EACZ,YAAW,EACX,GAAI,EACJ,UAAW,EAAG,EAAiB,CAAE,QAAO,MAAK,CAAC,EAAG,CAAS,EAC1D,GAAI,WAEJ,EAACA,EAAkB,UAAnB,CACE,YAAU,qBACV,UAAU,kEAFZ,CAIE,EAAC,EAAD,CAAW,UAAU,4CAA8C,CAAA,EACnE,EAAC,EAAD,CAAW,UAAU,4CAA8C,CAAA,CACxC,GACP,CAAA,EAO1B,OAJK,EAKH,EAAC,MAAD,CAAK,YAAU,iBAAiB,UAAU,mCAA1C,CACG,EACD,EAACC,EAAD,CAAO,GAAI,EAAgB,QAAS,EAAY,UAAW,EAAG,EAAsB,CAAE,MAAK,CAAC,EAAG,CAAc,WAC1G,CACI,CAAA,CACJ,IATE,CAWX"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as __name } from "../
|
|
1
|
+
import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/code.d.ts
|
|
@@ -6,7 +6,7 @@ type CodeProps = React.ComponentProps<'code'>;
|
|
|
6
6
|
declare function Code({
|
|
7
7
|
className,
|
|
8
8
|
...props
|
|
9
|
-
}: CodeProps):
|
|
9
|
+
}: CodeProps): React.JSX.Element;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Code, CodeProps };
|
|
12
12
|
//# sourceMappingURL=code.d.ts.map
|
package/dist/components/code.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{cn as e}from"../lib/utils.js";import{jsx as t}from"react/jsx-runtime";function Code({className:n,...r}){return t(`code`,{"data-slot":`code`,className:e(`bg-muted text-foreground inline-flex w-fit items-center rounded-md px-1.5 py-0.5 font-mono text-[0.875em] font-medium`,n),...r})}export{Code};
|
|
2
2
|
//# sourceMappingURL=code.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.js","names":[],"sources":["../../src/components/code.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { cn } from '../lib/utils'\n\nexport type CodeProps = React.ComponentProps<'code'>\n\nfunction Code({ className, ...props }: CodeProps) {\n return (\n <code\n data-slot=\"code\"\n className={cn(\n 'bg-muted text-foreground inline-flex w-fit items-center rounded-md px-1.5 py-0.5 font-mono text-[0.875em] font-medium',\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Code }\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"code.js","names":[],"sources":["../../src/components/code.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { cn } from '../lib/utils'\n\nexport type CodeProps = React.ComponentProps<'code'>\n\nfunction Code({ className, ...props }: CodeProps) {\n return (\n <code\n data-slot=\"code\"\n className={cn(\n 'bg-muted text-foreground inline-flex w-fit items-center rounded-md px-1.5 py-0.5 font-mono text-[0.875em] font-medium',\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Code }\n"],"mappings":"qHAMA,SAAS,KAAK,CAAE,YAAW,GAAG,GAAoB,CAChD,OACE,EAAC,OAAD,CACE,YAAU,OACV,UAAW,EACT,wHACA,CACF,EACA,GAAI,CACL,CAAA,CAEL"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as __name } from "../
|
|
1
|
+
import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
|
|
2
2
|
import { Collapsible as Collapsible$1 } from "radix-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/collapsible.d.ts
|
|
@@ -7,13 +7,13 @@ type CollapsibleTriggerProps = React.ComponentProps<typeof Collapsible$1.Collaps
|
|
|
7
7
|
type CollapsibleContentProps = React.ComponentProps<typeof Collapsible$1.CollapsibleContent>;
|
|
8
8
|
declare function Collapsible({
|
|
9
9
|
...props
|
|
10
|
-
}: CollapsibleProps): import("react
|
|
10
|
+
}: CollapsibleProps): import("react").JSX.Element;
|
|
11
11
|
declare function CollapsibleTrigger({
|
|
12
12
|
...props
|
|
13
|
-
}: CollapsibleTriggerProps): import("react
|
|
13
|
+
}: CollapsibleTriggerProps): import("react").JSX.Element;
|
|
14
14
|
declare function CollapsibleContent({
|
|
15
15
|
...props
|
|
16
|
-
}: CollapsibleContentProps): import("react
|
|
16
|
+
}: CollapsibleContentProps): import("react").JSX.Element;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { Collapsible, CollapsibleContent, CollapsibleContentProps, CollapsibleProps, CollapsibleTrigger, CollapsibleTriggerProps };
|
|
19
19
|
//# sourceMappingURL=collapsible.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{Collapsible as e}from"radix-ui";import{jsx as t}from"react/jsx-runtime";function Collapsible({...n}){return t(e.Root,{"data-slot":`collapsible`,...n})}function CollapsibleTrigger({...n}){return t(e.CollapsibleTrigger,{"data-slot":`collapsible-trigger`,...n})}function CollapsibleContent({...n}){return t(e.CollapsibleContent,{"data-slot":`collapsible-content`,...n})}export{Collapsible,CollapsibleContent,CollapsibleTrigger};
|
|
2
2
|
//# sourceMappingURL=collapsible.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapsible.js","names":["CollapsiblePrimitive"],"sources":["../../src/components/collapsible.tsx"],"sourcesContent":["import { Collapsible as CollapsiblePrimitive } from 'radix-ui'\n\nexport type CollapsibleProps = React.ComponentProps<typeof CollapsiblePrimitive.Root>\n\nexport type CollapsibleTriggerProps = React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>\n\nexport type CollapsibleContentProps = React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>\n\nfunction Collapsible({ ...props }: CollapsibleProps) {\n return <CollapsiblePrimitive.Root data-slot=\"collapsible\" {...props} />\n}\n\nfunction CollapsibleTrigger({ ...props }: CollapsibleTriggerProps) {\n return <CollapsiblePrimitive.CollapsibleTrigger data-slot=\"collapsible-trigger\" {...props} />\n}\n\nfunction CollapsibleContent({ ...props }: CollapsibleContentProps) {\n return <CollapsiblePrimitive.CollapsibleContent data-slot=\"collapsible-content\" {...props} />\n}\n\nexport { Collapsible, CollapsibleContent, CollapsibleTrigger }\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"collapsible.js","names":["CollapsiblePrimitive"],"sources":["../../src/components/collapsible.tsx"],"sourcesContent":["import { Collapsible as CollapsiblePrimitive } from 'radix-ui'\n\nexport type CollapsibleProps = React.ComponentProps<typeof CollapsiblePrimitive.Root>\n\nexport type CollapsibleTriggerProps = React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>\n\nexport type CollapsibleContentProps = React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>\n\nfunction Collapsible({ ...props }: CollapsibleProps) {\n return <CollapsiblePrimitive.Root data-slot=\"collapsible\" {...props} />\n}\n\nfunction CollapsibleTrigger({ ...props }: CollapsibleTriggerProps) {\n return <CollapsiblePrimitive.CollapsibleTrigger data-slot=\"collapsible-trigger\" {...props} />\n}\n\nfunction CollapsibleContent({ ...props }: CollapsibleContentProps) {\n return <CollapsiblePrimitive.CollapsibleContent data-slot=\"collapsible-content\" {...props} />\n}\n\nexport { Collapsible, CollapsibleContent, CollapsibleTrigger }\n"],"mappings":"uHAQA,SAAS,YAAY,CAAE,GAAG,GAA2B,CACnD,OAAO,EAACA,EAAqB,KAAtB,CAA2B,YAAU,cAAc,GAAI,CAAQ,CAAA,CACxE,CAEA,SAAS,mBAAmB,CAAE,GAAG,GAAkC,CACjE,OAAO,EAACA,EAAqB,mBAAtB,CAAyC,YAAU,sBAAsB,GAAI,CAAQ,CAAA,CAC9F,CAEA,SAAS,mBAAmB,CAAE,GAAG,GAAkC,CACjE,OAAO,EAACA,EAAqB,mBAAtB,CAAyC,YAAU,sBAAsB,GAAI,CAAQ,CAAA,CAC9F"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as __name } from "../
|
|
1
|
+
import { n as __name } from "../rolldown-runtime-Bdj-bS2b.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Combobox as Combobox$1 } from "@base-ui/react";
|
|
4
4
|
|
|
@@ -31,17 +31,17 @@ type ComboboxChipsInputProps = Combobox$1.Input.Props;
|
|
|
31
31
|
declare const Combobox: typeof Combobox$1.Root;
|
|
32
32
|
declare function ComboboxValue({
|
|
33
33
|
...props
|
|
34
|
-
}: ComboboxValueProps):
|
|
34
|
+
}: ComboboxValueProps): React.JSX.Element;
|
|
35
35
|
declare function ComboboxTrigger({
|
|
36
36
|
className,
|
|
37
37
|
children,
|
|
38
38
|
icon,
|
|
39
39
|
...props
|
|
40
|
-
}: ComboboxTriggerProps):
|
|
40
|
+
}: ComboboxTriggerProps): React.JSX.Element;
|
|
41
41
|
declare function ComboboxClear({
|
|
42
42
|
className,
|
|
43
43
|
...props
|
|
44
|
-
}: ComboboxClearProps):
|
|
44
|
+
}: ComboboxClearProps): React.JSX.Element;
|
|
45
45
|
declare function ComboboxInput({
|
|
46
46
|
className,
|
|
47
47
|
children,
|
|
@@ -52,7 +52,7 @@ declare function ComboboxInput({
|
|
|
52
52
|
showClear,
|
|
53
53
|
triggerIcon,
|
|
54
54
|
...props
|
|
55
|
-
}: ComboboxInputProps):
|
|
55
|
+
}: ComboboxInputProps): React.JSX.Element;
|
|
56
56
|
declare function ComboboxContent({
|
|
57
57
|
className,
|
|
58
58
|
side,
|
|
@@ -62,50 +62,50 @@ declare function ComboboxContent({
|
|
|
62
62
|
anchor,
|
|
63
63
|
container,
|
|
64
64
|
...props
|
|
65
|
-
}: ComboboxContentProps):
|
|
65
|
+
}: ComboboxContentProps): React.JSX.Element;
|
|
66
66
|
declare function ComboboxList({
|
|
67
67
|
className,
|
|
68
68
|
...props
|
|
69
|
-
}: ComboboxListProps):
|
|
69
|
+
}: ComboboxListProps): React.JSX.Element;
|
|
70
70
|
declare function ComboboxItem({
|
|
71
71
|
className,
|
|
72
72
|
children,
|
|
73
73
|
...props
|
|
74
|
-
}: ComboboxItemProps):
|
|
74
|
+
}: ComboboxItemProps): React.JSX.Element;
|
|
75
75
|
declare function ComboboxGroup({
|
|
76
76
|
className,
|
|
77
77
|
...props
|
|
78
|
-
}: ComboboxGroupProps):
|
|
78
|
+
}: ComboboxGroupProps): React.JSX.Element;
|
|
79
79
|
declare function ComboboxLabel({
|
|
80
80
|
className,
|
|
81
81
|
...props
|
|
82
|
-
}: ComboboxLabelProps):
|
|
82
|
+
}: ComboboxLabelProps): React.JSX.Element;
|
|
83
83
|
declare function ComboboxCollection({
|
|
84
84
|
...props
|
|
85
|
-
}: ComboboxCollectionProps):
|
|
85
|
+
}: ComboboxCollectionProps): React.JSX.Element;
|
|
86
86
|
declare function ComboboxEmpty({
|
|
87
87
|
className,
|
|
88
88
|
...props
|
|
89
|
-
}: ComboboxEmptyProps):
|
|
89
|
+
}: ComboboxEmptyProps): React.JSX.Element;
|
|
90
90
|
declare function ComboboxSeparator({
|
|
91
91
|
className,
|
|
92
92
|
...props
|
|
93
|
-
}: ComboboxSeparatorProps):
|
|
93
|
+
}: ComboboxSeparatorProps): React.JSX.Element;
|
|
94
94
|
declare function ComboboxChips({
|
|
95
95
|
className,
|
|
96
96
|
...props
|
|
97
|
-
}: ComboboxChipsProps):
|
|
97
|
+
}: ComboboxChipsProps): React.JSX.Element;
|
|
98
98
|
declare function ComboboxChip({
|
|
99
99
|
className,
|
|
100
100
|
children,
|
|
101
101
|
showRemove,
|
|
102
102
|
...props
|
|
103
|
-
}: ComboboxChipProps):
|
|
103
|
+
}: ComboboxChipProps): React.JSX.Element;
|
|
104
104
|
declare function ComboboxChipsInput({
|
|
105
105
|
className,
|
|
106
106
|
id,
|
|
107
107
|
...props
|
|
108
|
-
}: ComboboxChipsInputProps):
|
|
108
|
+
}: ComboboxChipsInputProps): React.JSX.Element;
|
|
109
109
|
declare function useComboboxAnchor(): React.RefObject<HTMLDivElement | null>;
|
|
110
110
|
//#endregion
|
|
111
111
|
export { Combobox, ComboboxChip, ComboboxChipProps, ComboboxChips, ComboboxChipsInput, ComboboxChipsInputProps, ComboboxChipsProps, ComboboxClear, ComboboxClearProps, ComboboxCollection, ComboboxCollectionProps, ComboboxContent, ComboboxContentProps, ComboboxEmpty, ComboboxEmptyProps, ComboboxGroup, ComboboxGroupProps, ComboboxInput, ComboboxInputProps, ComboboxItem, ComboboxItemProps, ComboboxLabel, ComboboxLabelProps, ComboboxList, ComboboxListProps, ComboboxProps, ComboboxSeparator, ComboboxSeparatorProps, ComboboxTrigger, ComboboxTriggerProps, ComboboxValue, ComboboxValueProps, useComboboxAnchor };
|