@cognite/aura 1.49109.0 → 1.49232.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/core/accordion/accordion.js +1 -1
- package/dist/components/ui/core/accordion/accordion.js.map +1 -1
- package/dist/components/ui/core/action-toolbar/action-toolbar.js +4 -4
- package/dist/components/ui/core/action-toolbar/action-toolbar.js.map +1 -1
- package/dist/components/ui/core/alert/alert.js +3 -3
- package/dist/components/ui/core/alert/alert.js.map +1 -1
- package/dist/components/ui/core/avatar/avatar.js +2 -2
- package/dist/components/ui/core/avatar/avatar.js.map +1 -1
- package/dist/components/ui/core/badge/badge.js +2 -2
- package/dist/components/ui/core/badge/badge.js.map +1 -1
- package/dist/components/ui/core/banner/banner.js +3 -3
- package/dist/components/ui/core/banner/banner.js.map +1 -1
- package/dist/components/ui/core/breadcrumb/breadcrumb.js +1 -1
- package/dist/components/ui/core/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/ui/core/button/button.gallery.js +1 -1
- package/dist/components/ui/core/button/button.gallery.js.map +1 -1
- package/dist/components/ui/core/button/button.js +1 -1
- package/dist/components/ui/core/button/button.js.map +1 -1
- package/dist/components/ui/core/button-group/button-group.gallery.js +1 -1
- package/dist/components/ui/core/button-group/button-group.gallery.js.map +1 -1
- package/dist/components/ui/core/button-group/button-group.js +2 -2
- package/dist/components/ui/core/button-group/button-group.js.map +1 -1
- package/dist/components/ui/core/calendar/calendar-header.js +3 -3
- package/dist/components/ui/core/calendar/calendar-header.js.map +1 -1
- package/dist/components/ui/core/calendar/calendar.js +1 -1
- package/dist/components/ui/core/calendar/calendar.js.map +1 -1
- package/dist/components/ui/core/card/card.gallery.js +2 -2
- package/dist/components/ui/core/card/card.gallery.js.map +1 -1
- package/dist/components/ui/core/card/card.js +3 -3
- package/dist/components/ui/core/card/card.js.map +1 -1
- package/dist/components/ui/core/chart/chart.js +1 -1
- package/dist/components/ui/core/chart/chart.js.map +1 -1
- package/dist/components/ui/core/checkbox/checkbox.js +1 -1
- package/dist/components/ui/core/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/core/code-block/code-block.js +3 -3
- package/dist/components/ui/core/code-block/code-block.js.map +1 -1
- package/dist/components/ui/core/collapsible/collapsible.gallery.js +2 -2
- package/dist/components/ui/core/collapsible/collapsible.gallery.js.map +1 -1
- package/dist/components/ui/core/collapsible/collapsible.js +1 -1
- package/dist/components/ui/core/collapsible/collapsible.js.map +1 -1
- package/dist/components/ui/core/combobox/combobox.js +4 -4
- package/dist/components/ui/core/combobox/combobox.js.map +1 -1
- package/dist/components/ui/core/command/command.js +4 -4
- package/dist/components/ui/core/command/command.js.map +1 -1
- package/dist/components/ui/core/conversation/conversation.js +2 -2
- package/dist/components/ui/core/conversation/conversation.js.map +1 -1
- package/dist/components/ui/core/count/count.js +1 -1
- package/dist/components/ui/core/count/count.js.map +1 -1
- package/dist/components/ui/core/data-grid/data-grid-cell.js +1 -1
- package/dist/components/ui/core/data-grid/data-grid-cell.js.map +1 -1
- package/dist/components/ui/core/data-grid/data-grid-column-menu.js +4 -4
- package/dist/components/ui/core/data-grid/data-grid-column-menu.js.map +1 -1
- package/dist/components/ui/core/data-grid/data-grid-column-resizer.js +1 -1
- package/dist/components/ui/core/data-grid/data-grid-column-resizer.js.map +1 -1
- package/dist/components/ui/core/data-grid/data-grid-filter-panel.js +4 -4
- package/dist/components/ui/core/data-grid/data-grid-filter-panel.js.map +1 -1
- package/dist/components/ui/core/data-grid/data-grid-footer.js +1 -1
- package/dist/components/ui/core/data-grid/data-grid-footer.js.map +1 -1
- package/dist/components/ui/core/data-grid/data-grid-header-row.js +2 -2
- package/dist/components/ui/core/data-grid/data-grid-header-row.js.map +1 -1
- package/dist/components/ui/core/data-grid/data-grid-header.js +1 -1
- package/dist/components/ui/core/data-grid/data-grid-header.js.map +1 -1
- package/dist/components/ui/core/data-grid/data-grid-pagination.js +3 -3
- package/dist/components/ui/core/data-grid/data-grid-pagination.js.map +1 -1
- package/dist/components/ui/core/data-grid/data-grid-row.js +2 -2
- package/dist/components/ui/core/data-grid/data-grid-row.js.map +1 -1
- package/dist/components/ui/core/data-grid/data-grid-selection-toolbar.js +3 -3
- package/dist/components/ui/core/data-grid/data-grid-selection-toolbar.js.map +1 -1
- package/dist/components/ui/core/data-grid/data-grid.fixtures.js +1 -1
- package/dist/components/ui/core/data-grid/data-grid.fixtures.js.map +1 -1
- package/dist/components/ui/core/data-grid/data-grid.js +7 -7
- package/dist/components/ui/core/data-grid/data-grid.js.map +1 -1
- package/dist/components/ui/core/data-grid/data-grid.utils.js +1 -1
- package/dist/components/ui/core/data-grid/data-grid.utils.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +7 -7
- package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +2 -2
- package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +7 -7
- package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +3 -3
- package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.js +9 -9
- package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.js +4 -4
- package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +10 -10
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +5 -5
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/index.js +7 -7
- package/dist/components/ui/core/date-time-pickers/index.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js +2 -2
- package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +2 -2
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js +1 -1
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js +2 -2
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js +2 -2
- package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +3 -3
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js +4 -4
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +7 -7
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +3 -3
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.js +7 -7
- package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.js.map +1 -1
- package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.js +4 -4
- package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.js.map +1 -1
- package/dist/components/ui/core/dialog/dialog.js +3 -3
- package/dist/components/ui/core/dialog/dialog.js.map +1 -1
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +3 -3
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/ui/core/empty-state/empty-state.js +1 -1
- package/dist/components/ui/core/empty-state/empty-state.js.map +1 -1
- package/dist/components/ui/core/helper-text/helper-text.js +1 -1
- package/dist/components/ui/core/helper-text/helper-text.js.map +1 -1
- package/dist/components/ui/core/hover-card/hover-card.js +2 -2
- package/dist/components/ui/core/hover-card/hover-card.js.map +1 -1
- package/dist/components/ui/core/inline-citation/inline-citation.js +3 -3
- package/dist/components/ui/core/inline-citation/inline-citation.js.map +1 -1
- package/dist/components/ui/core/input/input.gallery.js +2 -2
- package/dist/components/ui/core/input/input.gallery.js.map +1 -1
- package/dist/components/ui/core/input/input.js +1 -1
- package/dist/components/ui/core/input/input.js.map +1 -1
- package/dist/components/ui/core/input-group/input-group.js +4 -4
- package/dist/components/ui/core/input-group/input-group.js.map +1 -1
- package/dist/components/ui/core/item/item.js +2 -2
- package/dist/components/ui/core/item/item.js.map +1 -1
- package/dist/components/ui/core/kbd/kbd.js +1 -1
- package/dist/components/ui/core/kbd/kbd.js.map +1 -1
- package/dist/components/ui/core/label/examples/label.gallery.js +2 -2
- package/dist/components/ui/core/label/examples/label.gallery.js.map +1 -1
- package/dist/components/ui/core/label/label.js +1 -1
- package/dist/components/ui/core/label/label.js.map +1 -1
- package/dist/components/ui/core/loader/loader.js +1 -1
- package/dist/components/ui/core/loader/loader.js.map +1 -1
- package/dist/components/ui/core/message/message-response-table-footer.js +3 -3
- package/dist/components/ui/core/message/message-response-table-footer.js.map +1 -1
- package/dist/components/ui/core/message/message-response-table.js +6 -6
- package/dist/components/ui/core/message/message-response-table.js.map +1 -1
- package/dist/components/ui/core/message/message.js +6 -6
- package/dist/components/ui/core/message/message.js.map +1 -1
- package/dist/components/ui/core/overflow-list/overflow-list.js +2 -2
- package/dist/components/ui/core/overflow-list/overflow-list.js.map +1 -1
- package/dist/components/ui/core/pagination/pagination-teleport.js +2 -2
- package/dist/components/ui/core/pagination/pagination-teleport.js.map +1 -1
- package/dist/components/ui/core/pagination/pagination.js +4 -4
- package/dist/components/ui/core/pagination/pagination.js.map +1 -1
- package/dist/components/ui/core/popover/popover.gallery.js +1 -1
- package/dist/components/ui/core/popover/popover.gallery.js.map +1 -1
- package/dist/components/ui/core/popover/popover.js +3 -3
- package/dist/components/ui/core/popover/popover.js.map +1 -1
- package/dist/components/ui/core/progress/progress.js +1 -1
- package/dist/components/ui/core/progress/progress.js.map +1 -1
- package/dist/components/ui/core/prompt-input/prompt-input.js +7 -7
- package/dist/components/ui/core/prompt-input/prompt-input.js.map +1 -1
- package/dist/components/ui/core/radio-group/radio-group.js +1 -1
- package/dist/components/ui/core/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/core/reasoning/reasoning.js +1 -1
- package/dist/components/ui/core/reasoning/reasoning.js.map +1 -1
- package/dist/components/ui/core/scroll-area/scroll-area.js +1 -1
- package/dist/components/ui/core/scroll-area/scroll-area.js.map +1 -1
- package/dist/components/ui/core/search/search.js +2 -2
- package/dist/components/ui/core/search/search.js.map +1 -1
- package/dist/components/ui/core/segmented-control/segmented-control.js +1 -1
- package/dist/components/ui/core/segmented-control/segmented-control.js.map +1 -1
- package/dist/components/ui/core/select/select.js +4 -4
- package/dist/components/ui/core/select/select.js.map +1 -1
- package/dist/components/ui/core/separator/separator.js +1 -1
- package/dist/components/ui/core/separator/separator.js.map +1 -1
- package/dist/components/ui/core/shimmer/shimmer.js +1 -1
- package/dist/components/ui/core/shimmer/shimmer.js.map +1 -1
- package/dist/components/ui/core/skeleton/skeleton.js +1 -1
- package/dist/components/ui/core/skeleton/skeleton.js.map +1 -1
- package/dist/components/ui/core/slider/slider.gallery.js +1 -1
- package/dist/components/ui/core/slider/slider.gallery.js.map +1 -1
- package/dist/components/ui/core/slider/slider.js +1 -1
- package/dist/components/ui/core/slider/slider.js.map +1 -1
- package/dist/components/ui/core/sonner-toast/sonner-toast.js +1 -1
- package/dist/components/ui/core/sonner-toast/sonner-toast.js.map +1 -1
- package/dist/components/ui/core/sources/sources.js +2 -2
- package/dist/components/ui/core/sources/sources.js.map +1 -1
- package/dist/components/ui/core/status-text/status-text.js +1 -1
- package/dist/components/ui/core/status-text/status-text.js.map +1 -1
- package/dist/components/ui/core/switch/switch.gallery.js +1 -1
- package/dist/components/ui/core/switch/switch.gallery.js.map +1 -1
- package/dist/components/ui/core/switch/switch.js +2 -2
- package/dist/components/ui/core/switch/switch.js.map +1 -1
- package/dist/components/ui/core/tabs/tabs.js +2 -2
- package/dist/components/ui/core/tabs/tabs.js.map +1 -1
- package/dist/components/ui/core/textarea/textarea.gallery.js +2 -2
- package/dist/components/ui/core/textarea/textarea.gallery.js.map +1 -1
- package/dist/components/ui/core/textarea/textarea.js +1 -1
- package/dist/components/ui/core/textarea/textarea.js.map +1 -1
- package/dist/components/ui/core/toggle/count-badge.js +1 -1
- package/dist/components/ui/core/toggle/count-badge.js.map +1 -1
- package/dist/components/ui/core/toggle/toggle.js +1 -1
- package/dist/components/ui/core/toggle/toggle.js.map +1 -1
- package/dist/components/ui/core/tool/tool.js +5 -5
- package/dist/components/ui/core/tool/tool.js.map +1 -1
- package/dist/components/ui/core/toolbar/toolbar.js +3 -3
- package/dist/components/ui/core/toolbar/toolbar.js.map +1 -1
- package/dist/components/ui/core/tooltip/tooltip.gallery.js +1 -1
- package/dist/components/ui/core/tooltip/tooltip.gallery.js.map +1 -1
- package/dist/components/ui/core/tooltip/tooltip.js +2 -2
- package/dist/components/ui/core/tooltip/tooltip.js.map +1 -1
- package/dist/components/ui/core/topbar/topbar.js +5 -5
- package/dist/components/ui/core/topbar/topbar.js.map +1 -1
- package/dist/components/ui/core/tree/tree.js +3 -3
- package/dist/components/ui/core/tree/tree.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/ui/core/scroll-area/scroll-area.tsx"],"sourcesContent":["import {\n type ForwardRefExoticComponent,\n type RefAttributes,\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n type ForwardedRef,\n} from 'react';\n\nimport type {\n ScrollAreaRootProps,\n ScrollAreaScrollbarProps,\n} from '@base-ui/react/scroll-area';\nimport { ScrollArea as ScrollAreaPrimitive } from '@base-ui/react/scroll-area';\n\nimport { cn, focusRing } from '../../../../lib/utils';\n\nconst ScrollArea: ForwardRefExoticComponent<\n Omit<ScrollAreaRootProps, 'ref'> & RefAttributes<HTMLDivElement>\n> = forwardRef<\n ComponentRef<typeof ScrollAreaPrimitive.Root>,\n ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>\n>(\n (\n {\n className,\n children,\n ...props\n }: ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>,\n ref: ForwardedRef<ComponentRef<typeof ScrollAreaPrimitive.Root>>\n ) => {\n return (\n <ScrollAreaPrimitive.Root\n ref={ref}\n data-slot=\"scroll-area\"\n className={cn('relative group/scroll-area', className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport\n data-slot=\"scroll-area-viewport\"\n className={`size-full rounded-[inherit] transition-[color,box-shadow] ${focusRing}`}\n >\n <ScrollAreaPrimitive.Content data-slot=\"scroll-area-content\">\n {children}\n </ScrollAreaPrimitive.Content>\n </ScrollAreaPrimitive.Viewport>\n <ScrollBar orientation=\"vertical\" />\n <ScrollBar orientation=\"horizontal\" />\n <ScrollAreaPrimitive.Corner data-slot=\"scroll-area-corner\" />\n </ScrollAreaPrimitive.Root>\n );\n }\n);\n\nconst ScrollBar: ForwardRefExoticComponent<\n Omit<ScrollAreaScrollbarProps, 'ref'> & RefAttributes<HTMLDivElement>\n> = forwardRef<\n ComponentRef<typeof ScrollAreaPrimitive.Scrollbar>,\n ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Scrollbar>\n>(\n (\n {\n className,\n orientation = 'vertical',\n ...props\n }: ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Scrollbar>,\n ref: ForwardedRef<ComponentRef<typeof ScrollAreaPrimitive.Scrollbar>>\n ) => {\n const isHorizontal = orientation === 'horizontal';\n\n return (\n <ScrollAreaPrimitive.Scrollbar\n ref={ref}\n data-slot=\"scroll-area-scrollbar\"\n data-orientation={orientation}\n orientation={orientation}\n className={cn(\n 'group/scroll-area-scrollbar flex touch-none select-none items-start transition-colors',\n isHorizontal\n ? 'w-full py-0.5 px-3'\n : 'inline-flex self-stretch px-0.5 py-3',\n className\n )}\n {...props}\n >\n <ScrollAreaPrimitive.Thumb\n data-slot=\"scroll-area-thumb\"\n className={cn(\n 'relative rounded-full bg-secondary-background transition-colors group-hover/scroll-area-scrollbar:bg-secondary-background-hover',\n isHorizontal ? 'h-1 min-w-10' : 'w-1 min-h-10'\n )}\n />\n </ScrollAreaPrimitive.Scrollbar>\n );\n }\n);\n\nScrollArea.displayName = 'ScrollArea';\nScrollBar.displayName = 'ScrollBar';\n\nexport { ScrollArea, ScrollBar };\n"],"names":["forwardRef","ScrollArea","ScrollAreaPrimitive","cn","focusRing","className","children","props","ref","Root","data-slot","Viewport","Content","ScrollBar","orientation","Corner","isHorizontal","Scrollbar","data-orientation","Thumb","displayName"],"mappings":";AAAA,SAKEA,UAAU,QAEL,QAAQ;AAMf,SAASC,cAAcC,mBAAmB,QAAQ,6BAA6B;AAE/E,SAASC,EAAE,EAAEC,SAAS,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/scroll-area/scroll-area.tsx"],"sourcesContent":["import {\n type ForwardRefExoticComponent,\n type RefAttributes,\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n type ForwardedRef,\n} from 'react';\n\nimport type {\n ScrollAreaRootProps,\n ScrollAreaScrollbarProps,\n} from '@base-ui/react/scroll-area';\nimport { ScrollArea as ScrollAreaPrimitive } from '@base-ui/react/scroll-area';\n\nimport { cn, focusRing } from '../../../../lib/utils';\n\nconst ScrollArea: ForwardRefExoticComponent<\n Omit<ScrollAreaRootProps, 'ref'> & RefAttributes<HTMLDivElement>\n> = forwardRef<\n ComponentRef<typeof ScrollAreaPrimitive.Root>,\n ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>\n>(\n (\n {\n className,\n children,\n ...props\n }: ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>,\n ref: ForwardedRef<ComponentRef<typeof ScrollAreaPrimitive.Root>>\n ) => {\n return (\n <ScrollAreaPrimitive.Root\n ref={ref}\n data-slot=\"scroll-area\"\n className={cn('relative group/scroll-area', className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport\n data-slot=\"scroll-area-viewport\"\n className={`size-full rounded-[inherit] transition-[color,box-shadow] ${focusRing}`}\n >\n <ScrollAreaPrimitive.Content data-slot=\"scroll-area-content\">\n {children}\n </ScrollAreaPrimitive.Content>\n </ScrollAreaPrimitive.Viewport>\n <ScrollBar orientation=\"vertical\" />\n <ScrollBar orientation=\"horizontal\" />\n <ScrollAreaPrimitive.Corner data-slot=\"scroll-area-corner\" />\n </ScrollAreaPrimitive.Root>\n );\n }\n);\n\nconst ScrollBar: ForwardRefExoticComponent<\n Omit<ScrollAreaScrollbarProps, 'ref'> & RefAttributes<HTMLDivElement>\n> = forwardRef<\n ComponentRef<typeof ScrollAreaPrimitive.Scrollbar>,\n ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Scrollbar>\n>(\n (\n {\n className,\n orientation = 'vertical',\n ...props\n }: ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Scrollbar>,\n ref: ForwardedRef<ComponentRef<typeof ScrollAreaPrimitive.Scrollbar>>\n ) => {\n const isHorizontal = orientation === 'horizontal';\n\n return (\n <ScrollAreaPrimitive.Scrollbar\n ref={ref}\n data-slot=\"scroll-area-scrollbar\"\n data-orientation={orientation}\n orientation={orientation}\n className={cn(\n 'group/scroll-area-scrollbar flex touch-none select-none items-start transition-colors',\n isHorizontal\n ? 'w-full py-0.5 px-3'\n : 'inline-flex self-stretch px-0.5 py-3',\n className\n )}\n {...props}\n >\n <ScrollAreaPrimitive.Thumb\n data-slot=\"scroll-area-thumb\"\n className={cn(\n 'relative rounded-full bg-secondary-background transition-colors group-hover/scroll-area-scrollbar:bg-secondary-background-hover',\n isHorizontal ? 'h-1 min-w-10' : 'w-1 min-h-10'\n )}\n />\n </ScrollAreaPrimitive.Scrollbar>\n );\n }\n);\n\nScrollArea.displayName = 'ScrollArea';\nScrollBar.displayName = 'ScrollBar';\n\nexport { ScrollArea, ScrollBar };\n"],"names":["forwardRef","ScrollArea","ScrollAreaPrimitive","cn","focusRing","className","children","props","ref","Root","data-slot","Viewport","Content","ScrollBar","orientation","Corner","isHorizontal","Scrollbar","data-orientation","Thumb","displayName"],"mappings":";AAAA,SAKEA,UAAU,QAEL,QAAQ;AAMf,SAASC,cAAcC,mBAAmB,QAAQ,6BAA6B;AAE/E,SAASC,EAAE,EAAEC,SAAS,QAAQ,wBAAwB;AAEtD,MAAMH,2BAEFD,WAIF,CACE,EACEK,SAAS,EACTC,QAAQ,EACR,GAAGC,OACuD,EAC5DC;IAEA,qBACE,MAACN,oBAAoBO,IAAI;QACvBD,KAAKA;QACLE,aAAU;QACVL,WAAWF,GAAG,8BAA8BE;QAC3C,GAAGE,KAAK;;0BAET,KAACL,oBAAoBS,QAAQ;gBAC3BD,aAAU;gBACVL,WAAW,CAAC,0DAA0D,EAAED,WAAW;0BAEnF,cAAA,KAACF,oBAAoBU,OAAO;oBAACF,aAAU;8BACpCJ;;;0BAGL,KAACO;gBAAUC,aAAY;;0BACvB,KAACD;gBAAUC,aAAY;;0BACvB,KAACZ,oBAAoBa,MAAM;gBAACL,aAAU;;;;AAG5C;AAGF,MAAMG,0BAEFb,WAIF,CACE,EACEK,SAAS,EACTS,cAAc,UAAU,EACxB,GAAGP,OAC4D,EACjEC;IAEA,MAAMQ,eAAeF,gBAAgB;IAErC,qBACE,KAACZ,oBAAoBe,SAAS;QAC5BT,KAAKA;QACLE,aAAU;QACVQ,oBAAkBJ;QAClBA,aAAaA;QACbT,WAAWF,GACT,yFACAa,eACI,uBACA,wCACJX;QAED,GAAGE,KAAK;kBAET,cAAA,KAACL,oBAAoBiB,KAAK;YACxBT,aAAU;YACVL,WAAWF,GACT,mIACAa,eAAe,iBAAiB;;;AAK1C;AAGFf,WAAWmB,WAAW,GAAG;AACzBP,UAAUO,WAAW,GAAG;AAExB,SAASnB,UAAU,EAAEY,SAAS,GAAG"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useImperativeHandle, useRef, useState } from "react";
|
|
3
3
|
import { IconCircleXFilled, IconSearch } from "@tabler/icons-react";
|
|
4
|
-
import { cn } from "../../../../lib/utils
|
|
5
|
-
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "../input-group/input-group
|
|
4
|
+
import { cn } from "../../../../lib/utils";
|
|
5
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "../input-group/input-group";
|
|
6
6
|
const hasInputValue = (value)=>{
|
|
7
7
|
if (typeof value === 'string') {
|
|
8
8
|
return value.length > 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/ui/core/search/search.tsx"],"sourcesContent":["import {\n type ForwardRefExoticComponent,\n type RefAttributes,\n type ChangeEvent,\n type ComponentProps,\n type ComponentRef,\n type FocusEvent,\n type FormEvent,\n forwardRef,\n type MouseEvent,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\n\nimport { IconCircleXFilled, IconSearch } from '@tabler/icons-react';\n\nimport { cn } from '../../../../lib/utils';\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from '../input-group/input-group';\n\ntype SearchProps = Omit<ComponentProps<'input'>, 'type' | 'className'> & {\n className?: string;\n inputClassName?: string;\n clearLabel?: string;\n onClear?: () => void;\n 'data-slot'?: never;\n};\n\nconst hasInputValue = (value: unknown): boolean => {\n if (typeof value === 'string') {\n return value.length > 0;\n }\n if (typeof value === 'number') {\n return Number.isFinite(value);\n }\n if (Array.isArray(value)) {\n return value.length > 0;\n }\n return false;\n};\n\nconst Search: ForwardRefExoticComponent<\n Omit<SearchProps, 'ref'> & RefAttributes<HTMLInputElement | null>\n> = forwardRef<ComponentRef<'input'> | null, SearchProps>(\n (\n {\n className,\n inputClassName,\n clearLabel = 'Clear search',\n onClear,\n value,\n defaultValue,\n onChange,\n onInput,\n onFocus,\n onBlur,\n disabled,\n readOnly,\n ...props\n },\n ref\n ) => {\n const [hasFocusWithin, setHasFocusWithin] = useState(false);\n const [isUncontrolledInputFilled, setIsUncontrolledInputFilled] =\n useState<boolean>(() => hasInputValue(value ?? defaultValue));\n const inputRef = useRef<ComponentRef<'input'>>(null);\n const isControlled = value != null;\n const isInputFilled = isControlled\n ? hasInputValue(value)\n : isUncontrolledInputFilled;\n\n useImperativeHandle<\n ComponentRef<'input'> | null,\n ComponentRef<'input'> | null\n >(ref, () => inputRef.current, []);\n\n const handleFocusCapture = (): void => {\n setHasFocusWithin(true);\n };\n\n const handleBlurCapture = (event: FocusEvent<HTMLDivElement>): void => {\n if (\n event.relatedTarget instanceof Node &&\n event.currentTarget.contains(event.relatedTarget)\n ) {\n return;\n }\n setHasFocusWithin(false);\n };\n\n const handleClear = (): void => {\n const input = inputRef.current;\n if (input == null) {\n return;\n }\n onClear?.();\n if (!isControlled && input.value !== '') {\n // Use the native setter so React's synthetic event system detects the change.\n Object.getOwnPropertyDescriptor(\n HTMLInputElement.prototype,\n 'value'\n )?.set?.call(input, '');\n input.dispatchEvent(new Event('input', { bubbles: true }));\n input.dispatchEvent(new Event('change', { bubbles: true }));\n }\n input.focus();\n };\n\n const handleInput = (event: FormEvent<HTMLInputElement>): void => {\n if (!isControlled) {\n setIsUncontrolledInputFilled(hasInputValue(event.currentTarget.value));\n }\n onInput?.(event);\n };\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>): void => {\n if (!isControlled) {\n setIsUncontrolledInputFilled(hasInputValue(event.currentTarget.value));\n }\n onChange?.(event);\n };\n\n const canClear = !isControlled || onClear != null;\n const showClearButton =\n hasFocusWithin && isInputFilled && !disabled && !readOnly && canClear;\n\n return (\n <div\n data-slot=\"search\"\n className={cn('w-full cursor-text', className)}\n onFocusCapture={handleFocusCapture}\n onBlurCapture={handleBlurCapture}\n onClick={() => inputRef.current?.focus()}\n >\n <InputGroup className=\"w-full transition-none\">\n <InputGroupAddon\n align=\"inline-start\"\n className=\"[&_svg]:text-muted-foreground group-hover/input-group:[&_svg]:text-muted-foreground group-has-[[data-slot=input-group-control]:enabled:focus-visible:not(:read-only)]/input-group:[&_svg]:text-muted-foreground group-has-[[data-slot=input-group-control]:enabled:not(:placeholder-shown):not(:read-only)]/input-group:[&_svg]:text-muted-foreground\"\n >\n <IconSearch className=\"size-4\" aria-hidden />\n </InputGroupAddon>\n <InputGroupInput\n {...props}\n ref={inputRef}\n type=\"search\"\n value={value}\n defaultValue={defaultValue}\n disabled={disabled}\n readOnly={readOnly}\n onInput={handleInput}\n onChange={handleChange}\n onFocus={onFocus}\n onBlur={onBlur}\n className={cn(\n 'placeholder:text-muted-foreground [&:not(:placeholder-shown):not(:read-only)]:text-base-foreground [&:not(:placeholder-shown):not(:read-only)]:hover:text-base-foreground [&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none',\n inputClassName\n )}\n />\n <InputGroupAddon\n align=\"inline-end\"\n aria-hidden={showClearButton ? undefined : true}\n className={\n showClearButton ? undefined : 'invisible pointer-events-none'\n }\n >\n <InputGroupButton\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={clearLabel}\n onMouseDown={(event: MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n }}\n onClick={handleClear}\n >\n <IconCircleXFilled className=\"size-4\" aria-hidden />\n </InputGroupButton>\n </InputGroupAddon>\n </InputGroup>\n </div>\n );\n }\n);\n\nSearch.displayName = 'Search';\n\nexport { Search };\n"],"names":["forwardRef","useImperativeHandle","useRef","useState","IconCircleXFilled","IconSearch","cn","InputGroup","InputGroupAddon","InputGroupButton","InputGroupInput","hasInputValue","value","length","Number","isFinite","Array","isArray","Search","className","inputClassName","clearLabel","onClear","defaultValue","onChange","onInput","onFocus","onBlur","disabled","readOnly","props","ref","hasFocusWithin","setHasFocusWithin","isUncontrolledInputFilled","setIsUncontrolledInputFilled","inputRef","isControlled","isInputFilled","current","handleFocusCapture","handleBlurCapture","event","relatedTarget","Node","currentTarget","contains","handleClear","input","Object","getOwnPropertyDescriptor","HTMLInputElement","prototype","set","call","dispatchEvent","Event","bubbles","focus","handleInput","handleChange","canClear","showClearButton","div","data-slot","onFocusCapture","onBlurCapture","onClick","align","aria-hidden","type","undefined","variant","size","aria-label","onMouseDown","preventDefault","displayName"],"mappings":";AAAA,SAQEA,UAAU,EAEVC,mBAAmB,EACnBC,MAAM,EACNC,QAAQ,QACH,QAAQ;AAEf,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,sBAAsB;AAEpE,SAASC,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/search/search.tsx"],"sourcesContent":["import {\n type ForwardRefExoticComponent,\n type RefAttributes,\n type ChangeEvent,\n type ComponentProps,\n type ComponentRef,\n type FocusEvent,\n type FormEvent,\n forwardRef,\n type MouseEvent,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\n\nimport { IconCircleXFilled, IconSearch } from '@tabler/icons-react';\n\nimport { cn } from '../../../../lib/utils';\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from '../input-group/input-group';\n\ntype SearchProps = Omit<ComponentProps<'input'>, 'type' | 'className'> & {\n className?: string;\n inputClassName?: string;\n clearLabel?: string;\n onClear?: () => void;\n 'data-slot'?: never;\n};\n\nconst hasInputValue = (value: unknown): boolean => {\n if (typeof value === 'string') {\n return value.length > 0;\n }\n if (typeof value === 'number') {\n return Number.isFinite(value);\n }\n if (Array.isArray(value)) {\n return value.length > 0;\n }\n return false;\n};\n\nconst Search: ForwardRefExoticComponent<\n Omit<SearchProps, 'ref'> & RefAttributes<HTMLInputElement | null>\n> = forwardRef<ComponentRef<'input'> | null, SearchProps>(\n (\n {\n className,\n inputClassName,\n clearLabel = 'Clear search',\n onClear,\n value,\n defaultValue,\n onChange,\n onInput,\n onFocus,\n onBlur,\n disabled,\n readOnly,\n ...props\n },\n ref\n ) => {\n const [hasFocusWithin, setHasFocusWithin] = useState(false);\n const [isUncontrolledInputFilled, setIsUncontrolledInputFilled] =\n useState<boolean>(() => hasInputValue(value ?? defaultValue));\n const inputRef = useRef<ComponentRef<'input'>>(null);\n const isControlled = value != null;\n const isInputFilled = isControlled\n ? hasInputValue(value)\n : isUncontrolledInputFilled;\n\n useImperativeHandle<\n ComponentRef<'input'> | null,\n ComponentRef<'input'> | null\n >(ref, () => inputRef.current, []);\n\n const handleFocusCapture = (): void => {\n setHasFocusWithin(true);\n };\n\n const handleBlurCapture = (event: FocusEvent<HTMLDivElement>): void => {\n if (\n event.relatedTarget instanceof Node &&\n event.currentTarget.contains(event.relatedTarget)\n ) {\n return;\n }\n setHasFocusWithin(false);\n };\n\n const handleClear = (): void => {\n const input = inputRef.current;\n if (input == null) {\n return;\n }\n onClear?.();\n if (!isControlled && input.value !== '') {\n // Use the native setter so React's synthetic event system detects the change.\n Object.getOwnPropertyDescriptor(\n HTMLInputElement.prototype,\n 'value'\n )?.set?.call(input, '');\n input.dispatchEvent(new Event('input', { bubbles: true }));\n input.dispatchEvent(new Event('change', { bubbles: true }));\n }\n input.focus();\n };\n\n const handleInput = (event: FormEvent<HTMLInputElement>): void => {\n if (!isControlled) {\n setIsUncontrolledInputFilled(hasInputValue(event.currentTarget.value));\n }\n onInput?.(event);\n };\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>): void => {\n if (!isControlled) {\n setIsUncontrolledInputFilled(hasInputValue(event.currentTarget.value));\n }\n onChange?.(event);\n };\n\n const canClear = !isControlled || onClear != null;\n const showClearButton =\n hasFocusWithin && isInputFilled && !disabled && !readOnly && canClear;\n\n return (\n <div\n data-slot=\"search\"\n className={cn('w-full cursor-text', className)}\n onFocusCapture={handleFocusCapture}\n onBlurCapture={handleBlurCapture}\n onClick={() => inputRef.current?.focus()}\n >\n <InputGroup className=\"w-full transition-none\">\n <InputGroupAddon\n align=\"inline-start\"\n className=\"[&_svg]:text-muted-foreground group-hover/input-group:[&_svg]:text-muted-foreground group-has-[[data-slot=input-group-control]:enabled:focus-visible:not(:read-only)]/input-group:[&_svg]:text-muted-foreground group-has-[[data-slot=input-group-control]:enabled:not(:placeholder-shown):not(:read-only)]/input-group:[&_svg]:text-muted-foreground\"\n >\n <IconSearch className=\"size-4\" aria-hidden />\n </InputGroupAddon>\n <InputGroupInput\n {...props}\n ref={inputRef}\n type=\"search\"\n value={value}\n defaultValue={defaultValue}\n disabled={disabled}\n readOnly={readOnly}\n onInput={handleInput}\n onChange={handleChange}\n onFocus={onFocus}\n onBlur={onBlur}\n className={cn(\n 'placeholder:text-muted-foreground [&:not(:placeholder-shown):not(:read-only)]:text-base-foreground [&:not(:placeholder-shown):not(:read-only)]:hover:text-base-foreground [&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none',\n inputClassName\n )}\n />\n <InputGroupAddon\n align=\"inline-end\"\n aria-hidden={showClearButton ? undefined : true}\n className={\n showClearButton ? undefined : 'invisible pointer-events-none'\n }\n >\n <InputGroupButton\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={clearLabel}\n onMouseDown={(event: MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n }}\n onClick={handleClear}\n >\n <IconCircleXFilled className=\"size-4\" aria-hidden />\n </InputGroupButton>\n </InputGroupAddon>\n </InputGroup>\n </div>\n );\n }\n);\n\nSearch.displayName = 'Search';\n\nexport { Search };\n"],"names":["forwardRef","useImperativeHandle","useRef","useState","IconCircleXFilled","IconSearch","cn","InputGroup","InputGroupAddon","InputGroupButton","InputGroupInput","hasInputValue","value","length","Number","isFinite","Array","isArray","Search","className","inputClassName","clearLabel","onClear","defaultValue","onChange","onInput","onFocus","onBlur","disabled","readOnly","props","ref","hasFocusWithin","setHasFocusWithin","isUncontrolledInputFilled","setIsUncontrolledInputFilled","inputRef","isControlled","isInputFilled","current","handleFocusCapture","handleBlurCapture","event","relatedTarget","Node","currentTarget","contains","handleClear","input","Object","getOwnPropertyDescriptor","HTMLInputElement","prototype","set","call","dispatchEvent","Event","bubbles","focus","handleInput","handleChange","canClear","showClearButton","div","data-slot","onFocusCapture","onBlurCapture","onClick","align","aria-hidden","type","undefined","variant","size","aria-label","onMouseDown","preventDefault","displayName"],"mappings":";AAAA,SAQEA,UAAU,EAEVC,mBAAmB,EACnBC,MAAM,EACNC,QAAQ,QACH,QAAQ;AAEf,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,sBAAsB;AAEpE,SAASC,EAAE,QAAQ,wBAAwB;AAC3C,SACEC,UAAU,EACVC,eAAe,EACfC,gBAAgB,EAChBC,eAAe,QACV,6BAA6B;AAUpC,MAAMC,gBAAgB,CAACC;IACrB,IAAI,OAAOA,UAAU,UAAU;QAC7B,OAAOA,MAAMC,MAAM,GAAG;IACxB;IACA,IAAI,OAAOD,UAAU,UAAU;QAC7B,OAAOE,OAAOC,QAAQ,CAACH;IACzB;IACA,IAAII,MAAMC,OAAO,CAACL,QAAQ;QACxB,OAAOA,MAAMC,MAAM,GAAG;IACxB;IACA,OAAO;AACT;AAEA,MAAMK,uBAEFlB,WACF,CACE,EACEmB,SAAS,EACTC,cAAc,EACdC,aAAa,cAAc,EAC3BC,OAAO,EACPV,KAAK,EACLW,YAAY,EACZC,QAAQ,EACRC,OAAO,EACPC,OAAO,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B,WAAW,CAACxB,gBAAgBf,WAAW;IAC7C,MAAMwC,kBACJ9B,kBAAkBM,iBAAiB,CAACV,YAAY,CAACC,YAAYgC;IAE/D,qBACE,KAACE;QACCC,aAAU;QACV7C,WAAWb,GAAG,sBAAsBa;QACpC8C,gBAAgBzB;QAChB0B,eAAezB;QACf0B,SAAS,IAAM/B,SAASG,OAAO,EAAEmB;kBAEjC,cAAA,MAACnD;YAAWY,WAAU;;8BACpB,KAACX;oBACC4D,OAAM;oBACNjD,WAAU;8BAEV,cAAA,KAACd;wBAAWc,WAAU;wBAASkD,aAAW;;;8BAE5C,KAAC3D;oBACE,GAAGoB,KAAK;oBACTC,KAAKK;oBACLkC,MAAK;oBACL1D,OAAOA;oBACPW,cAAcA;oBACdK,UAAUA;oBACVC,UAAUA;oBACVJ,SAASkC;oBACTnC,UAAUoC;oBACVlC,SAASA;oBACTC,QAAQA;oBACRR,WAAWb,GACT,8QACAc;;8BAGJ,KAACZ;oBACC4D,OAAM;oBACNC,eAAaP,kBAAkBS,YAAY;oBAC3CpD,WACE2C,kBAAkBS,YAAY;8BAGhC,cAAA,KAAC9D;wBACC6D,MAAK;wBACLE,SAAQ;wBACRC,MAAK;wBACLC,cAAYrD;wBACZsD,aAAa,CAACjC;4BACZA,MAAMkC,cAAc;wBACtB;wBACAT,SAASpB;kCAET,cAAA,KAAC3C;4BAAkBe,WAAU;4BAASkD,aAAW;;;;;;;AAM7D;AAGFnD,OAAO2D,WAAW,GAAG;AAErB,SAAS3D,MAAM,GAAG"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { createContext, useContext, useLayoutEffect, useRef } from "react";
|
|
3
3
|
import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
|
-
import { cn } from "../../../../lib/utils
|
|
5
|
+
import { cn } from "../../../../lib/utils";
|
|
6
6
|
function SegmentedControl({ className, ...props }) {
|
|
7
7
|
return /*#__PURE__*/ _jsx(TabsPrimitive.Root, {
|
|
8
8
|
"data-slot": "segmented-control",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/ui/core/segmented-control/segmented-control.tsx"],"sourcesContent":["import {\n type ComponentProps,\n type Context,\n type ReactNode,\n createContext,\n useContext,\n useLayoutEffect,\n useRef,\n} from 'react';\n\nimport { Tabs as TabsPrimitive } from '@base-ui/react/tabs';\nimport { type VariantProps, cva } from 'class-variance-authority';\nimport type { ClassProp } from 'class-variance-authority/types';\n\nimport { cn } from '../../../../lib/utils';\n\nfunction SegmentedControl({\n className,\n ...props\n}: TabsPrimitive.Root.Props): ReactNode {\n return (\n <TabsPrimitive.Root\n data-slot=\"segmented-control\"\n className={cn('flex flex-col gap-2', className)}\n {...props}\n />\n );\n}\n\ninterface SegmentedControlSizeVariantProps {\n size?: 'small' | 'default' | null;\n}\n\nconst segmentedControlListVariants: (\n props?: (SegmentedControlSizeVariantProps & ClassProp) | undefined\n) => string = cva(\n 'bg-medium-background text-muted-foreground relative isolate inline-flex w-fit items-center justify-center gap-2 p-0.5',\n {\n variants: {\n size: {\n default: 'h-9 rounded-lg',\n small: 'h-7 rounded-md',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\ntype SegmentedControlSize = NonNullable<\n VariantProps<typeof segmentedControlListVariants>['size']\n>;\n\nconst SegmentedControlSizeContext: Context<SegmentedControlSize | undefined> =\n createContext<SegmentedControlSize | undefined>(undefined);\n\nfunction useSegmentedControlSize(\n size?: SegmentedControlSize | null\n): SegmentedControlSize {\n const inherited = useContext(SegmentedControlSizeContext);\n return size ?? inherited ?? 'default';\n}\n\ntype SegmentedControlListProps = TabsPrimitive.List.Props &\n VariantProps<typeof segmentedControlListVariants>;\n\nfunction SegmentedControlList({\n className,\n size,\n children,\n ...props\n}: SegmentedControlListProps): ReactNode {\n const resolvedSize = size ?? 'default';\n\n return (\n <TabsPrimitive.List\n data-slot=\"segmented-control-list\"\n className={cn(segmentedControlListVariants({ size }), className)}\n {...props}\n >\n <SegmentedControlSizeContext.Provider value={resolvedSize}>\n <SegmentedControlIndicator\n size={resolvedSize}\n activeSelector='[aria-selected=\"true\"]'\n />\n {children}\n </SegmentedControlSizeContext.Provider>\n </TabsPrimitive.List>\n );\n}\n\nconst segmentedControlIndicatorVariants: (\n props?: (SegmentedControlSizeVariantProps & ClassProp) | undefined\n) => string = cva(\n 'bg-background shadow-sm pointer-events-none absolute top-(--active-tab-top) left-(--active-tab-left) -z-0 h-(--active-tab-height) w-(--active-tab-width) motion-safe:transition-[top,left,width,height] motion-safe:duration-200 motion-safe:ease-out data-[activation-direction=none]:transition-none',\n {\n variants: {\n size: {\n default: 'rounded-md',\n small: 'rounded-sm',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\ntype SegmentedControlIndicatorProps = ComponentProps<'div'> &\n VariantProps<typeof segmentedControlIndicatorVariants> & {\n activeSelector?: string;\n };\n\nfunction SegmentedControlIndicator({\n className,\n size,\n activeSelector = '[aria-selected=\"true\"],[data-active]',\n style,\n ...props\n}: SegmentedControlIndicatorProps): ReactNode {\n const ref = useRef<HTMLDivElement>(null);\n const previousLeftRef = useRef<number | null>(null);\n\n useLayoutEffect(() => {\n const indicator = ref.current;\n const list = indicator?.parentElement;\n if (!indicator || !list) {\n return undefined;\n }\n\n let currentActive: HTMLElement | null = null;\n const pendingInitialObserve = new Set<Element>();\n\n const observeResize = (element: Element): void => {\n pendingInitialObserve.add(element);\n resizeObserver.observe(element);\n };\n\n const update = (isResize = false): void => {\n const active = list.querySelector<HTMLElement>(activeSelector);\n if (!active) {\n indicator.dataset.visible = 'false';\n return;\n }\n\n if (active !== currentActive) {\n if (currentActive) {\n resizeObserver.unobserve(currentActive);\n }\n observeResize(active);\n currentActive = active;\n }\n\n const left = active.offsetLeft;\n const previousLeft = previousLeftRef.current;\n const direction =\n isResize || previousLeft === null || left === previousLeft\n ? 'none'\n : left > previousLeft\n ? 'right'\n : 'left';\n\n indicator.dataset.activationDirection = direction;\n indicator.dataset.visible = 'true';\n indicator.style.setProperty('--active-tab-left', `${left}px`);\n indicator.style.setProperty('--active-tab-top', `${active.offsetTop}px`);\n indicator.style.setProperty(\n '--active-tab-width',\n `${active.offsetWidth}px`\n );\n indicator.style.setProperty(\n '--active-tab-height',\n `${active.offsetHeight}px`\n );\n\n previousLeftRef.current = left;\n };\n\n const resizeObserver = new ResizeObserver((entries) => {\n const isGenuineResize = entries.some((entry) => {\n if (pendingInitialObserve.has(entry.target)) {\n pendingInitialObserve.delete(entry.target);\n return false;\n }\n return true;\n });\n if (isGenuineResize) {\n update(true);\n }\n });\n observeResize(list);\n\n update();\n\n const mutationObserver = new MutationObserver(() => update(false));\n mutationObserver.observe(list, {\n attributes: true,\n attributeFilter: ['aria-selected', 'data-active', 'class'],\n subtree: true,\n childList: true,\n });\n\n return () => {\n mutationObserver.disconnect();\n resizeObserver.disconnect();\n };\n }, [activeSelector]);\n\n return (\n <div\n ref={ref}\n data-slot=\"segmented-control-indicator\"\n data-activation-direction=\"none\"\n data-visible=\"false\"\n className={cn(\n // A data attribute rather than an inline opacity, so the indicator still shows in apps\n // that import Aura's utilities with `important` (which beat inline styles).\n 'opacity-0 data-[visible=true]:opacity-100',\n segmentedControlIndicatorVariants({ size }),\n className\n )}\n style={style}\n {...props}\n />\n );\n}\n\ninterface SegmentedControlButtonVariantProps extends SegmentedControlSizeVariantProps {\n tabContent?: 'icon-label' | 'label-only' | 'icon-only' | null;\n}\n\nconst segmentedControlButtonVariants: (\n props?: (SegmentedControlButtonVariantProps & ClassProp) | undefined\n) => string = cva(\n 'text-sm leading-4.5 tracking-normal font-medium relative z-10 inline-flex flex-1 items-center justify-center whitespace-nowrap text-muted-foreground dark:text-muted-foreground border border-transparent transition-[color,box-shadow] duration-200 ease-out focus-visible:border-ring focus-visible:ring focus-visible:ring-ring-shadow focus-visible:outline-1 focus-visible:outline-ring [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4 data-disabled:pointer-events-none data-disabled:opacity-50 hover:text-foreground data-active:text-foreground data-active:hover:text-foreground',\n {\n variants: {\n size: {\n default: 'rounded-md',\n small: 'rounded-sm',\n },\n tabContent: {\n 'icon-label': '',\n 'label-only': '',\n 'icon-only': 'px-0',\n },\n },\n compoundVariants: [\n {\n size: 'default',\n tabContent: 'icon-label',\n className: 'h-8 gap-2 px-2 py-0',\n },\n {\n size: 'default',\n tabContent: 'label-only',\n className: 'h-8 gap-0 px-2 py-0',\n },\n {\n size: 'default',\n tabContent: 'icon-only',\n className: 'size-8 gap-0 py-0',\n },\n {\n size: 'small',\n tabContent: 'icon-label',\n className: 'h-6 gap-2 px-2 py-0',\n },\n {\n size: 'small',\n tabContent: 'label-only',\n className: 'h-6 gap-0 px-2 py-0',\n },\n {\n size: 'small',\n tabContent: 'icon-only',\n className: 'size-6 gap-0 py-0',\n },\n ],\n defaultVariants: {\n size: 'default',\n tabContent: 'icon-label',\n },\n }\n);\n\ntype SegmentedControlButtonProps = TabsPrimitive.Tab.Props &\n VariantProps<typeof segmentedControlButtonVariants>;\n\nfunction SegmentedControlButton({\n className,\n size,\n tabContent,\n ...props\n}: SegmentedControlButtonProps): ReactNode {\n const resolvedSize = useSegmentedControlSize(size);\n\n return (\n <TabsPrimitive.Tab\n data-slot=\"segmented-control-trigger\"\n className={cn(\n segmentedControlButtonVariants({ size: resolvedSize, tabContent }),\n className\n )}\n {...props}\n />\n );\n}\n\nfunction SegmentedControlContent({\n className,\n ...props\n}: TabsPrimitive.Panel.Props): ReactNode {\n return (\n <TabsPrimitive.Panel\n data-slot=\"segmented-control-content\"\n className={cn('flex-1 outline-none', className)}\n {...props}\n />\n );\n}\n\nexport {\n SegmentedControl,\n SegmentedControlButton,\n SegmentedControlContent,\n SegmentedControlIndicator,\n SegmentedControlList,\n segmentedControlButtonVariants,\n segmentedControlIndicatorVariants,\n segmentedControlListVariants,\n};\nexport type { SegmentedControlSize };\n"],"names":["createContext","useContext","useLayoutEffect","useRef","Tabs","TabsPrimitive","cva","cn","SegmentedControl","className","props","Root","data-slot","segmentedControlListVariants","variants","size","default","small","defaultVariants","SegmentedControlSizeContext","undefined","useSegmentedControlSize","inherited","SegmentedControlList","children","resolvedSize","List","Provider","value","SegmentedControlIndicator","activeSelector","segmentedControlIndicatorVariants","style","ref","previousLeftRef","indicator","current","list","parentElement","currentActive","pendingInitialObserve","Set","observeResize","element","add","resizeObserver","observe","update","isResize","active","querySelector","dataset","visible","unobserve","left","offsetLeft","previousLeft","direction","activationDirection","setProperty","offsetTop","offsetWidth","offsetHeight","ResizeObserver","entries","isGenuineResize","some","entry","has","target","delete","mutationObserver","MutationObserver","attributes","attributeFilter","subtree","childList","disconnect","div","data-activation-direction","data-visible","segmentedControlButtonVariants","tabContent","compoundVariants","SegmentedControlButton","Tab","SegmentedControlContent","Panel"],"mappings":";AAAA,SAIEA,aAAa,EACbC,UAAU,EACVC,eAAe,EACfC,MAAM,QACD,QAAQ;AAEf,SAASC,QAAQC,aAAa,QAAQ,sBAAsB;AAC5D,SAA4BC,GAAG,QAAQ,2BAA2B;AAGlE,SAASC,EAAE,QAAQ,2BAAwB;AAE3C,SAASC,iBAAiB,EACxBC,SAAS,EACT,GAAGC,OACsB;IACzB,qBACE,KAACL,cAAcM,IAAI;QACjBC,aAAU;QACVH,WAAWF,GAAG,uBAAuBE;QACpC,GAAGC,KAAK;;AAGf;AAMA,MAAMG,+BAEQP,IACZ,yHACA;IACEQ,UAAU;QACRC,MAAM;YACJC,SAAS;YACTC,OAAO;QACT;IACF;IACAC,iBAAiB;QACfH,MAAM;IACR;AACF;AAOF,MAAMI,4CACJnB,cAAgDoB;AAElD,SAASC,wBACPN,IAAkC;IAElC,MAAMO,YAAYrB,WAAWkB;IAC7B,OAAOJ,QAAQO,aAAa;AAC9B;AAKA,SAASC,qBAAqB,EAC5Bd,SAAS,EACTM,IAAI,EACJS,QAAQ,EACR,GAAGd,OAC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K,IACzCN;QAEFuB,OAAOA;QACN,GAAGtB,KAAK;;AAGf;AAMA,MAAMuE,iCAEQ3E,IACZ,+lBACA;IACEQ,UAAU;QACRC,MAAM;YACJC,SAAS;YACTC,OAAO;QACT;QACAiE,YAAY;YACV,cAAc;YACd,cAAc;YACd,aAAa;QACf;IACF;IACAC,kBAAkB;QAChB;YACEpE,MAAM;YACNmE,YAAY;YACZzE,WAAW;QACb;QACA;YACEM,MAAM;YACNmE,YAAY;YACZzE,WAAW;QACb;QACA;YACEM,MAAM;YACNmE,YAAY;YACZzE,WAAW;QACb;QACA;YACEM,MAAM;YACNmE,YAAY;YACZzE,WAAW;QACb;QACA;YACEM,MAAM;YACNmE,YAAY;YACZzE,WAAW;QACb;QACA;YACEM,MAAM;YACNmE,YAAY;YACZzE,WAAW;QACb;KACD;IACDS,iBAAiB;QACfH,MAAM;QACNmE,YAAY;IACd;AACF;AAMF,SAASE,uBAAuB,EAC9B3E,SAAS,EACTM,IAAI,EACJmE,UAAU,EACV,GAAGxE,OACyB;IAC5B,MAAMe,eAAeJ,wBAAwBN;IAE7C,qBACE,KAACV,cAAcgF,GAAG;QAChBzE,aAAU;QACVH,WAAWF,GACT0E,+BAA+B;YAAElE,MAAMU;YAAcyD;QAAW,IAChEzE;QAED,GAAGC,KAAK;;AAGf;AAEA,SAAS4E,wBAAwB,EAC/B7E,SAAS,EACT,GAAGC,OACuB;IAC1B,qBACE,KAACL,cAAckF,KAAK;QAClB3E,aAAU;QACVH,WAAWF,GAAG,uBAAuBE;QACpC,GAAGC,KAAK;;AAGf;AAEA,SACEF,gBAAgB,EAChB4E,sBAAsB,EACtBE,uBAAuB,EACvBzD,yBAAyB,EACzBN,oBAAoB,EACpB0D,8BAA8B,EAC9BlD,iCAAiC,EACjClB,4BAA4B,GAC5B"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/segmented-control/segmented-control.tsx"],"sourcesContent":["import {\n type ComponentProps,\n type Context,\n type ReactNode,\n createContext,\n useContext,\n useLayoutEffect,\n useRef,\n} from 'react';\n\nimport { Tabs as TabsPrimitive } from '@base-ui/react/tabs';\nimport { type VariantProps, cva } from 'class-variance-authority';\nimport type { ClassProp } from 'class-variance-authority/types';\n\nimport { cn } from '../../../../lib/utils';\n\nfunction SegmentedControl({\n className,\n ...props\n}: TabsPrimitive.Root.Props): ReactNode {\n return (\n <TabsPrimitive.Root\n data-slot=\"segmented-control\"\n className={cn('flex flex-col gap-2', className)}\n {...props}\n />\n );\n}\n\ninterface SegmentedControlSizeVariantProps {\n size?: 'small' | 'default' | null;\n}\n\nconst segmentedControlListVariants: (\n props?: (SegmentedControlSizeVariantProps & ClassProp) | undefined\n) => string = cva(\n 'bg-medium-background text-muted-foreground relative isolate inline-flex w-fit items-center justify-center gap-2 p-0.5',\n {\n variants: {\n size: {\n default: 'h-9 rounded-lg',\n small: 'h-7 rounded-md',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\ntype SegmentedControlSize = NonNullable<\n VariantProps<typeof segmentedControlListVariants>['size']\n>;\n\nconst SegmentedControlSizeContext: Context<SegmentedControlSize | undefined> =\n createContext<SegmentedControlSize | undefined>(undefined);\n\nfunction useSegmentedControlSize(\n size?: SegmentedControlSize | null\n): SegmentedControlSize {\n const inherited = useContext(SegmentedControlSizeContext);\n return size ?? inherited ?? 'default';\n}\n\ntype SegmentedControlListProps = TabsPrimitive.List.Props &\n VariantProps<typeof segmentedControlListVariants>;\n\nfunction SegmentedControlList({\n className,\n size,\n children,\n ...props\n}: SegmentedControlListProps): ReactNode {\n const resolvedSize = size ?? 'default';\n\n return (\n <TabsPrimitive.List\n data-slot=\"segmented-control-list\"\n className={cn(segmentedControlListVariants({ size }), className)}\n {...props}\n >\n <SegmentedControlSizeContext.Provider value={resolvedSize}>\n <SegmentedControlIndicator\n size={resolvedSize}\n activeSelector='[aria-selected=\"true\"]'\n />\n {children}\n </SegmentedControlSizeContext.Provider>\n </TabsPrimitive.List>\n );\n}\n\nconst segmentedControlIndicatorVariants: (\n props?: (SegmentedControlSizeVariantProps & ClassProp) | undefined\n) => string = cva(\n 'bg-background shadow-sm pointer-events-none absolute top-(--active-tab-top) left-(--active-tab-left) -z-0 h-(--active-tab-height) w-(--active-tab-width) motion-safe:transition-[top,left,width,height] motion-safe:duration-200 motion-safe:ease-out data-[activation-direction=none]:transition-none',\n {\n variants: {\n size: {\n default: 'rounded-md',\n small: 'rounded-sm',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n);\n\ntype SegmentedControlIndicatorProps = ComponentProps<'div'> &\n VariantProps<typeof segmentedControlIndicatorVariants> & {\n activeSelector?: string;\n };\n\nfunction SegmentedControlIndicator({\n className,\n size,\n activeSelector = '[aria-selected=\"true\"],[data-active]',\n style,\n ...props\n}: SegmentedControlIndicatorProps): ReactNode {\n const ref = useRef<HTMLDivElement>(null);\n const previousLeftRef = useRef<number | null>(null);\n\n useLayoutEffect(() => {\n const indicator = ref.current;\n const list = indicator?.parentElement;\n if (!indicator || !list) {\n return undefined;\n }\n\n let currentActive: HTMLElement | null = null;\n const pendingInitialObserve = new Set<Element>();\n\n const observeResize = (element: Element): void => {\n pendingInitialObserve.add(element);\n resizeObserver.observe(element);\n };\n\n const update = (isResize = false): void => {\n const active = list.querySelector<HTMLElement>(activeSelector);\n if (!active) {\n indicator.dataset.visible = 'false';\n return;\n }\n\n if (active !== currentActive) {\n if (currentActive) {\n resizeObserver.unobserve(currentActive);\n }\n observeResize(active);\n currentActive = active;\n }\n\n const left = active.offsetLeft;\n const previousLeft = previousLeftRef.current;\n const direction =\n isResize || previousLeft === null || left === previousLeft\n ? 'none'\n : left > previousLeft\n ? 'right'\n : 'left';\n\n indicator.dataset.activationDirection = direction;\n indicator.dataset.visible = 'true';\n indicator.style.setProperty('--active-tab-left', `${left}px`);\n indicator.style.setProperty('--active-tab-top', `${active.offsetTop}px`);\n indicator.style.setProperty(\n '--active-tab-width',\n `${active.offsetWidth}px`\n );\n indicator.style.setProperty(\n '--active-tab-height',\n `${active.offsetHeight}px`\n );\n\n previousLeftRef.current = left;\n };\n\n const resizeObserver = new ResizeObserver((entries) => {\n const isGenuineResize = entries.some((entry) => {\n if (pendingInitialObserve.has(entry.target)) {\n pendingInitialObserve.delete(entry.target);\n return false;\n }\n return true;\n });\n if (isGenuineResize) {\n update(true);\n }\n });\n observeResize(list);\n\n update();\n\n const mutationObserver = new MutationObserver(() => update(false));\n mutationObserver.observe(list, {\n attributes: true,\n attributeFilter: ['aria-selected', 'data-active', 'class'],\n subtree: true,\n childList: true,\n });\n\n return () => {\n mutationObserver.disconnect();\n resizeObserver.disconnect();\n };\n }, [activeSelector]);\n\n return (\n <div\n ref={ref}\n data-slot=\"segmented-control-indicator\"\n data-activation-direction=\"none\"\n data-visible=\"false\"\n className={cn(\n // A data attribute rather than an inline opacity, so the indicator still shows in apps\n // that import Aura's utilities with `important` (which beat inline styles).\n 'opacity-0 data-[visible=true]:opacity-100',\n segmentedControlIndicatorVariants({ size }),\n className\n )}\n style={style}\n {...props}\n />\n );\n}\n\ninterface SegmentedControlButtonVariantProps extends SegmentedControlSizeVariantProps {\n tabContent?: 'icon-label' | 'label-only' | 'icon-only' | null;\n}\n\nconst segmentedControlButtonVariants: (\n props?: (SegmentedControlButtonVariantProps & ClassProp) | undefined\n) => string = cva(\n 'text-sm leading-4.5 tracking-normal font-medium relative z-10 inline-flex flex-1 items-center justify-center whitespace-nowrap text-muted-foreground dark:text-muted-foreground border border-transparent transition-[color,box-shadow] duration-200 ease-out focus-visible:border-ring focus-visible:ring focus-visible:ring-ring-shadow focus-visible:outline-1 focus-visible:outline-ring [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4 data-disabled:pointer-events-none data-disabled:opacity-50 hover:text-foreground data-active:text-foreground data-active:hover:text-foreground',\n {\n variants: {\n size: {\n default: 'rounded-md',\n small: 'rounded-sm',\n },\n tabContent: {\n 'icon-label': '',\n 'label-only': '',\n 'icon-only': 'px-0',\n },\n },\n compoundVariants: [\n {\n size: 'default',\n tabContent: 'icon-label',\n className: 'h-8 gap-2 px-2 py-0',\n },\n {\n size: 'default',\n tabContent: 'label-only',\n className: 'h-8 gap-0 px-2 py-0',\n },\n {\n size: 'default',\n tabContent: 'icon-only',\n className: 'size-8 gap-0 py-0',\n },\n {\n size: 'small',\n tabContent: 'icon-label',\n className: 'h-6 gap-2 px-2 py-0',\n },\n {\n size: 'small',\n tabContent: 'label-only',\n className: 'h-6 gap-0 px-2 py-0',\n },\n {\n size: 'small',\n tabContent: 'icon-only',\n className: 'size-6 gap-0 py-0',\n },\n ],\n defaultVariants: {\n size: 'default',\n tabContent: 'icon-label',\n },\n }\n);\n\ntype SegmentedControlButtonProps = TabsPrimitive.Tab.Props &\n VariantProps<typeof segmentedControlButtonVariants>;\n\nfunction SegmentedControlButton({\n className,\n size,\n tabContent,\n ...props\n}: SegmentedControlButtonProps): ReactNode {\n const resolvedSize = useSegmentedControlSize(size);\n\n return (\n <TabsPrimitive.Tab\n data-slot=\"segmented-control-trigger\"\n className={cn(\n segmentedControlButtonVariants({ size: resolvedSize, tabContent }),\n className\n )}\n {...props}\n />\n );\n}\n\nfunction SegmentedControlContent({\n className,\n ...props\n}: TabsPrimitive.Panel.Props): ReactNode {\n return (\n <TabsPrimitive.Panel\n data-slot=\"segmented-control-content\"\n className={cn('flex-1 outline-none', className)}\n {...props}\n />\n );\n}\n\nexport {\n SegmentedControl,\n SegmentedControlButton,\n SegmentedControlContent,\n SegmentedControlIndicator,\n SegmentedControlList,\n segmentedControlButtonVariants,\n segmentedControlIndicatorVariants,\n segmentedControlListVariants,\n};\nexport type { SegmentedControlSize };\n"],"names":["createContext","useContext","useLayoutEffect","useRef","Tabs","TabsPrimitive","cva","cn","SegmentedControl","className","props","Root","data-slot","segmentedControlListVariants","variants","size","default","small","defaultVariants","SegmentedControlSizeContext","undefined","useSegmentedControlSize","inherited","SegmentedControlList","children","resolvedSize","List","Provider","value","SegmentedControlIndicator","activeSelector","segmentedControlIndicatorVariants","style","ref","previousLeftRef","indicator","current","list","parentElement","currentActive","pendingInitialObserve","Set","observeResize","element","add","resizeObserver","observe","update","isResize","active","querySelector","dataset","visible","unobserve","left","offsetLeft","previousLeft","direction","activationDirection","setProperty","offsetTop","offsetWidth","offsetHeight","ResizeObserver","entries","isGenuineResize","some","entry","has","target","delete","mutationObserver","MutationObserver","attributes","attributeFilter","subtree","childList","disconnect","div","data-activation-direction","data-visible","segmentedControlButtonVariants","tabContent","compoundVariants","SegmentedControlButton","Tab","SegmentedControlContent","Panel"],"mappings":";AAAA,SAIEA,aAAa,EACbC,UAAU,EACVC,eAAe,EACfC,MAAM,QACD,QAAQ;AAEf,SAASC,QAAQC,aAAa,QAAQ,sBAAsB;AAC5D,SAA4BC,GAAG,QAAQ,2BAA2B;AAGlE,SAASC,EAAE,QAAQ,wBAAwB;AAE3C,SAASC,iBAAiB,EACxBC,SAAS,EACT,GAAGC,OACsB;IACzB,qBACE,KAACL,cAAcM,IAAI;QACjBC,aAAU;QACVH,WAAWF,GAAG,uBAAuBE;QACpC,GAAGC,KAAK;;AAGf;AAMA,MAAMG,+BAEQP,IACZ,yHACA;IACEQ,UAAU;QACRC,MAAM;YACJC,SAAS;YACTC,OAAO;QACT;IACF;IACAC,iBAAiB;QACfH,MAAM;IACR;AACF;AAOF,MAAMI,4CACJnB,cAAgDoB;AAElD,SAASC,wBACPN,IAAkC;IAElC,MAAMO,YAAYrB,WAAWkB;IAC7B,OAAOJ,QAAQO,aAAa;AAC9B;AAKA,SAASC,qBAAqB,EAC5Bd,SAAS,EACTM,IAAI,EACJS,QAAQ,EACR,GAAGd,OACuB;IAC1B,MAAMe,eAAeV,QAAQ;IAE7B,qBACE,KAACV,cAAcqB,IAAI;QACjBd,aAAU;QACVH,WAAWF,GAAGM,6BAA6B;YAAEE;QAAK,IAAIN;QACrD,GAAGC,KAAK;kBAET,cAAA,MAACS,4BAA4BQ,QAAQ;YAACC,OAAOH;;8BAC3C,KAACI;oBACCd,MAA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pE,MAAM;YACNmE,YAAY;YACZzE,WAAW;QACb;QACA;YACEM,MAAM;YACNmE,YAAY;YACZzE,WAAW;QACb;QACA;YACEM,MAAM;YACNmE,YAAY;YACZzE,WAAW;QACb;QACA;YACEM,MAAM;YACNmE,YAAY;YACZzE,WAAW;QACb;QACA;YACEM,MAAM;YACNmE,YAAY;YACZzE,WAAW;QACb;QACA;YACEM,MAAM;YACNmE,YAAY;YACZzE,WAAW;QACb;KACD;IACDS,iBAAiB;QACfH,MAAM;QACNmE,YAAY;IACd;AACF;AAMF,SAASE,uBAAuB,EAC9B3E,SAAS,EACTM,IAAI,EACJmE,UAAU,EACV,GAAGxE,OACyB;IAC5B,MAAMe,eAAeJ,wBAAwBN;IAE7C,qBACE,KAACV,cAAcgF,GAAG;QAChBzE,aAAU;QACVH,WAAWF,GACT0E,+BAA+B;YAAElE,MAAMU;YAAcyD;QAAW,IAChEzE;QAED,GAAGC,KAAK;;AAGf;AAEA,SAAS4E,wBAAwB,EAC/B7E,SAAS,EACT,GAAGC,OACuB;IAC1B,qBACE,KAACL,cAAckF,KAAK;QAClB3E,aAAU;QACVH,WAAWF,GAAG,uBAAuBE;QACpC,GAAGC,KAAK;;AAGf;AAEA,SACEF,gBAAgB,EAChB4E,sBAAsB,EACtBE,uBAAuB,EACvBzD,yBAAyB,EACzBN,oBAAoB,EACpB0D,8BAA8B,EAC9BlD,iCAAiC,EACjClB,4BAA4B,GAC5B"}
|
|
@@ -2,10 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { createContext, forwardRef, useContext, useId, useMemo } from "react";
|
|
3
3
|
import { Select as SelectPrimitive } from "@base-ui/react/select";
|
|
4
4
|
import { IconCheck, IconChevronDown, IconChevronUp, IconCircleXFilled, IconExclamationCircle } from "@tabler/icons-react";
|
|
5
|
-
import { usePortalContainer } from "../../../../lib/portal-container-context
|
|
6
|
-
import { useControllableState } from "../../../../lib/use-controllable-state
|
|
7
|
-
import { cn, formFieldOpenState, formFieldTriggerClasses, menuContainerPadding, menuItemPadding, menuSectionLabelClasses, menuSectionSeparatorClasses } from "../../../../lib/utils
|
|
8
|
-
import { Button } from "../button/button
|
|
5
|
+
import { usePortalContainer } from "../../../../lib/portal-container-context";
|
|
6
|
+
import { useControllableState } from "../../../../lib/use-controllable-state";
|
|
7
|
+
import { cn, formFieldOpenState, formFieldTriggerClasses, menuContainerPadding, menuItemPadding, menuSectionLabelClasses, menuSectionSeparatorClasses } from "../../../../lib/utils";
|
|
8
|
+
import { Button } from "../button/button";
|
|
9
9
|
const SelectContext = /*#__PURE__*/ createContext(null);
|
|
10
10
|
const useSelect = ()=>{
|
|
11
11
|
const context = useContext(SelectContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/ui/core/select/select.tsx"],"sourcesContent":["import {\n type ForwardRefExoticComponent,\n type RefAttributes,\n type ComponentRef,\n type ReactNode,\n type SyntheticEvent,\n createContext,\n forwardRef,\n useContext,\n useId,\n useMemo,\n} from 'react';\n\nimport type { SelectTriggerProps } from '@base-ui/react/select';\nimport { Select as SelectPrimitive } from '@base-ui/react/select';\nimport {\n IconCheck,\n IconChevronDown,\n IconChevronUp,\n IconCircleXFilled,\n IconExclamationCircle,\n} from '@tabler/icons-react';\n\nimport { usePortalContainer } from '../../../../lib/portal-container-context';\nimport { useControllableState } from '../../../../lib/use-controllable-state';\nimport {\n cn,\n formFieldOpenState,\n formFieldTriggerClasses,\n menuContainerPadding,\n menuItemPadding,\n menuSectionLabelClasses,\n menuSectionSeparatorClasses,\n} from '../../../../lib/utils';\nimport { Button } from '../button/button';\n\ntype SelectContextValue = {\n isOpen: boolean;\n canClear: boolean;\n clear: () => void;\n};\n\nconst SelectContext = createContext<SelectContextValue | null>(null);\n\nconst useSelect = () => {\n const context = useContext(SelectContext);\n if (!context) {\n throw new Error('Select components must be used within Select');\n }\n return context;\n};\n\ntype SelectPropsBase = Omit<\n SelectPrimitive.Root.Props<string>,\n | 'open'\n | 'defaultOpen'\n | 'onOpenChange'\n | 'value'\n | 'defaultValue'\n | 'onValueChange'\n | 'multiple'\n> & {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /**\n * Shows a clear button in the trigger while the select has a value.\n * Ignored when the select is required, disabled or read-only.\n */\n clearable?: boolean;\n};\n\ntype SelectPropsSingle = SelectPropsBase & {\n multiple?: false;\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n};\n\ntype SelectPropsMultiple = SelectPropsBase & {\n multiple: true;\n value?: string[];\n defaultValue?: string[];\n onValueChange?: (value: string[]) => void;\n};\n\ntype SelectProps = SelectPropsSingle | SelectPropsMultiple;\n\nfunction Select(props: SelectPropsSingle): ReactNode;\nfunction Select(props: SelectPropsMultiple): ReactNode;\nfunction Select(props: SelectProps) {\n const [isOpen, setIsOpen] = useControllableState({\n prop: props.open,\n defaultProp: props.defaultOpen ?? false,\n onChange: props.onOpenChange,\n });\n\n const [value, setValue] = useControllableState<string | string[]>({\n prop: props.value,\n defaultProp: props.defaultValue ?? (props.multiple ? [] : ''),\n onChange: (nextValue) => {\n if (props.multiple) {\n props.onValueChange?.(Array.isArray(nextValue) ? nextValue : []);\n } else {\n props.onValueChange?.(typeof nextValue === 'string' ? nextValue : '');\n }\n },\n });\n\n const hasValue = value.length > 0;\n const canClear =\n props.clearable === true &&\n hasValue &&\n !props.required &&\n !props.disabled &&\n !props.readOnly;\n const isMultiple = props.multiple === true;\n\n const selectContext = useMemo(\n () => ({\n isOpen: isOpen ?? false,\n canClear,\n clear: () => setValue(isMultiple ? [] : ''),\n }),\n [isOpen, canClear, isMultiple, setValue]\n );\n\n if (props.multiple) {\n const {\n multiple: _multiple,\n value: _value,\n defaultValue: _defaultValue,\n onValueChange: _onValueChange,\n clearable: _clearable,\n ...rest\n } = props;\n\n return (\n <SelectContext.Provider value={selectContext}>\n <SelectPrimitive.Root\n data-slot=\"select\"\n open={isOpen}\n onOpenChange={(nextOpen) => setIsOpen(nextOpen)}\n value={Array.isArray(value) ? value : []}\n onValueChange={(nextValue, _details) => {\n setValue(nextValue ?? []);\n }}\n multiple\n {...rest}\n />\n </SelectContext.Provider>\n );\n }\n\n const {\n value: _value,\n defaultValue: _defaultValue,\n onValueChange: _onValueChange,\n clearable: _clearable,\n ...rest\n } = props;\n\n return (\n <SelectContext.Provider value={selectContext}>\n <SelectPrimitive.Root\n data-slot=\"select\"\n open={isOpen}\n onOpenChange={(nextOpen) => setIsOpen(nextOpen)}\n value={typeof value === 'string' && value !== '' ? value : null}\n onValueChange={(nextValue, _details) => {\n setValue(typeof nextValue === 'string' ? nextValue : '');\n }}\n {...rest}\n />\n </SelectContext.Provider>\n );\n}\n\nfunction SelectGroup({\n className,\n ...props\n}: SelectPrimitive.Group.Props): ReactNode {\n return (\n <SelectPrimitive.Group\n data-slot=\"select-group\"\n className={cn('scroll-my-1 p-1', className)}\n {...props}\n />\n );\n}\n\nfunction SelectValue({\n icon,\n ...props\n}: SelectPrimitive.Value.Props & {\n icon?: ReactNode;\n}): ReactNode {\n if (icon) {\n return (\n <span className=\"flex flex-1 items-center gap-2 min-w-0 overflow-hidden\">\n {icon}\n <SelectPrimitive.Value\n data-slot=\"select-value\"\n className=\"flex-1 truncate min-w-0 text-base-foreground data-placeholder:text-muted-foreground data-disabled:text-base-foreground-disabled data-readonly:text-muted-foreground\"\n {...props}\n />\n </span>\n );\n }\n return (\n <SelectPrimitive.Value\n data-slot=\"select-value\"\n className=\"flex-1 truncate min-w-0 text-base-foreground data-placeholder:text-muted-foreground data-disabled:text-base-foreground-disabled data-readonly:text-muted-foreground\"\n {...props}\n />\n );\n}\n\nconst stopTriggerEvent = (event: SyntheticEvent) => {\n event.stopPropagation();\n};\n\nfunction SelectClearButton({ label }: { label: string }): ReactNode {\n const { clear } = useSelect();\n\n return (\n <Button\n data-slot=\"select-clear\"\n variant=\"ghost\"\n size=\"icon-sm\"\n render={<span />}\n aria-label={label}\n className=\"rounded-md\"\n onPointerDown={stopTriggerEvent}\n onMouseDown={stopTriggerEvent}\n onKeyDown={stopTriggerEvent}\n onKeyUp={stopTriggerEvent}\n onClick={(event) => {\n event.stopPropagation();\n event.preventDefault();\n const trigger = event.currentTarget.closest<HTMLElement>(\n '[data-slot=\"select-trigger\"]'\n );\n clear();\n trigger?.focus();\n }}\n >\n <IconCircleXFilled\n className=\"size-4 text-medium-foreground\"\n aria-hidden\n />\n </Button>\n );\n}\n\nconst SelectTrigger: ForwardRefExoticComponent<\n Omit<\n SelectTriggerProps & {\n size?: 'sm' | 'default';\n errorMessage?: string;\n clearLabel?: string;\n },\n 'ref'\n > &\n RefAttributes<HTMLButtonElement>\n> = forwardRef<\n ComponentRef<typeof SelectPrimitive.Trigger>,\n SelectPrimitive.Trigger.Props & {\n size?: 'sm' | 'default';\n errorMessage?: string;\n clearLabel?: string;\n }\n>(\n (\n {\n className,\n size = 'default',\n children,\n errorMessage,\n clearLabel = 'Clear selection',\n ...props\n },\n ref\n ) => {\n const { isOpen, canClear } = useSelect();\n const isInvalid = !!errorMessage;\n const errorId = useId();\n const showClear = canClear && !isOpen && !props.disabled;\n\n return (\n <>\n <SelectPrimitive.Trigger\n ref={ref}\n data-slot=\"select-trigger\"\n data-size={size}\n aria-invalid={isInvalid ? true : undefined}\n aria-describedby={isInvalid ? errorId : undefined}\n className={cn(\n 'min-w-50 max-w-[min(100%,420px)]',\n formFieldTriggerClasses,\n isOpen && formFieldOpenState,\n className\n )}\n {...props}\n >\n {children}\n {showClear && <SelectClearButton label={clearLabel} />}\n <SelectPrimitive.Icon\n render={\n <IconChevronDown\n className={cn(\n 'size-4 opacity-50 transition-transform',\n isOpen ? 'rotate-180' : 'rotate-0'\n )}\n />\n }\n />\n </SelectPrimitive.Trigger>\n {errorMessage && (\n <div\n id={errorId}\n className=\"flex flex-row gap-1 justify-start items-center p-1\"\n >\n <IconExclamationCircle className=\"text-destructive-foreground text-sm size-4\" />\n <span className=\"text-destructive-foreground text-sm\">\n {errorMessage}\n </span>\n </div>\n )}\n </>\n );\n }\n);\n\nSelectTrigger.displayName = 'SelectTrigger';\n\nfunction SelectContent({\n className,\n children,\n position: _position = 'popper',\n align = 'start',\n alignOffset = 0,\n side = 'bottom',\n sideOffset = 4,\n ...props\n}: SelectPrimitive.Popup.Props & {\n position?: 'popper' | 'item-aligned';\n align?: SelectPrimitive.Positioner.Props['align'];\n alignOffset?: SelectPrimitive.Positioner.Props['alignOffset'];\n side?: SelectPrimitive.Positioner.Props['side'];\n sideOffset?: SelectPrimitive.Positioner.Props['sideOffset'];\n}): ReactNode {\n const container = usePortalContainer();\n return (\n <SelectPrimitive.Portal container={container}>\n <SelectPrimitive.Positioner\n alignItemWithTrigger={false}\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n collisionPadding={10}\n className=\"isolate z-50\"\n >\n <SelectPrimitive.Popup\n data-slot=\"select-content\"\n className={cn(\n 'bg-popover-background text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--available-height) max-w-[min(100%,420px)] min-w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md border border-default shadow-md outline-none',\n menuContainerPadding,\n _position === 'popper' && 'data-[side=bottom]:translate-y-1',\n className\n )}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.List>{children}</SelectPrimitive.List>\n <SelectScrollDownButton />\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>\n );\n}\n\nfunction SelectLabel({\n className,\n ...props\n}: SelectPrimitive.GroupLabel.Props): ReactNode {\n return (\n <SelectPrimitive.GroupLabel\n data-slot=\"select-label\"\n className={cn(menuSectionLabelClasses, className)}\n {...props}\n />\n );\n}\n\nfunction SelectItem({\n className,\n children,\n icon,\n suffix,\n ...props\n}: SelectPrimitive.Item.Props & {\n icon?: ReactNode;\n suffix?: ReactNode;\n}): ReactNode {\n const title = typeof children === 'string' ? children : undefined;\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cn(\n \"relative flex w-full min-h-9 cursor-default items-center gap-2 rounded-lg pr-8 text-sm leading-4.5 font-medium outline-hidden select-none focus:bg-popover-background-hover focus:text-popover-foreground data-[disabled]:pointer-events-none data-[disabled]:text-base-foreground-disabled data-[disabled]:opacity-100 data-[disabled]:[&_svg]:text-base-foreground-disabled [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground\",\n menuItemPadding,\n className\n )}\n {...props}\n >\n <SelectPrimitive.ItemIndicator\n render={\n <span className=\"absolute right-2 flex size-3.5 items-center justify-center\">\n <IconCheck className=\"size-4 text-popover-foreground\" />\n </span>\n }\n />\n {icon && <span className=\"flex items-center gap-2 mr-1\">{icon}</span>}\n <SelectPrimitive.ItemText\n className=\"flex-1 truncate min-w-0\"\n title={title}\n >\n {children}\n </SelectPrimitive.ItemText>\n {suffix && <span className=\"shrink-0 ml-auto\">{suffix}</span>}\n </SelectPrimitive.Item>\n );\n}\n\nfunction SelectSeparator({\n className,\n ...props\n}: SelectPrimitive.Separator.Props): ReactNode {\n return (\n <SelectPrimitive.Separator\n data-slot=\"select-separator\"\n className={cn(\n menuSectionSeparatorClasses,\n 'pointer-events-none',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: SelectPrimitive.ScrollUpArrow.Props): ReactNode {\n return (\n <SelectPrimitive.ScrollUpArrow\n data-slot=\"select-scroll-up-button\"\n className={cn(\n 'bg-popover-background z-10 flex cursor-default items-center justify-center py-1 top-0 w-full',\n className\n )}\n {...props}\n >\n <IconChevronUp className=\"size-4\" />\n </SelectPrimitive.ScrollUpArrow>\n );\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: SelectPrimitive.ScrollDownArrow.Props): ReactNode {\n return (\n <SelectPrimitive.ScrollDownArrow\n data-slot=\"select-scroll-down-button\"\n className={cn(\n 'bg-popover-background z-10 flex cursor-default items-center justify-center py-1 bottom-0 w-full',\n className\n )}\n {...props}\n >\n <IconChevronDown className=\"size-4\" />\n </SelectPrimitive.ScrollDownArrow>\n );\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n};\n"],"names":["createContext","forwardRef","useContext","useId","useMemo","Select","SelectPrimitive","IconCheck","IconChevronDown","IconChevronUp","IconCircleXFilled","IconExclamationCircle","usePortalContainer","useControllableState","cn","formFieldOpenState","formFieldTriggerClasses","menuContainerPadding","menuItemPadding","menuSectionLabelClasses","menuSectionSeparatorClasses","Button","SelectContext","useSelect","context","Error","props","isOpen","setIsOpen","prop","open","defaultProp","defaultOpen","onChange","onOpenChange","value","setValue","defaultValue","multiple","nextValue","onValueChange","Array","isArray","hasValue","length","canClear","clearable","required","disabled","readOnly","isMultiple","selectContext","clear","_multiple","_value","_defaultValue","_onValueChange","_clearable","rest","Provider","Root","data-slot","nextOpen","_details","SelectGroup","className","Group","SelectValue","icon","span","Value","stopTriggerEvent","event","stopPropagation","SelectClearButton","label","variant","size","render","aria-label","onPointerDown","onMouseDown","onKeyDown","onKeyUp","onClick","preventDefault","trigger","currentTarget","closest","focus","aria-hidden","SelectTrigger","children","errorMessage","clearLabel","ref","isInvalid","errorId","showClear","Trigger","data-size","aria-invalid","undefined","aria-describedby","Icon","div","id","displayName","SelectContent","position","_position","align","alignOffset","side","sideOffset","container","Portal","Positioner","alignItemWithTrigger","collisionPadding","Popup","SelectScrollUpButton","List","SelectScrollDownButton","SelectLabel","GroupLabel","SelectItem","suffix","title","Item","ItemIndicator","ItemText","SelectSepar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AAU;;;AAGjC;AAEA,SACE5D,MAAM,EACNuG,aAAa,EACb5C,WAAW,EACX8D,UAAU,EACVF,WAAW,EACXD,sBAAsB,EACtBF,oBAAoB,EACpBW,eAAe,EACfzC,aAAa,EACbxB,WAAW,GACX"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/select/select.tsx"],"sourcesContent":["import {\n type ForwardRefExoticComponent,\n type RefAttributes,\n type ComponentRef,\n type ReactNode,\n type SyntheticEvent,\n createContext,\n forwardRef,\n useContext,\n useId,\n useMemo,\n} from 'react';\n\nimport type { SelectTriggerProps } from '@base-ui/react/select';\nimport { Select as SelectPrimitive } from '@base-ui/react/select';\nimport {\n IconCheck,\n IconChevronDown,\n IconChevronUp,\n IconCircleXFilled,\n IconExclamationCircle,\n} from '@tabler/icons-react';\n\nimport { usePortalContainer } from '../../../../lib/portal-container-context';\nimport { useControllableState } from '../../../../lib/use-controllable-state';\nimport {\n cn,\n formFieldOpenState,\n formFieldTriggerClasses,\n menuContainerPadding,\n menuItemPadding,\n menuSectionLabelClasses,\n menuSectionSeparatorClasses,\n} from '../../../../lib/utils';\nimport { Button } from '../button/button';\n\ntype SelectContextValue = {\n isOpen: boolean;\n canClear: boolean;\n clear: () => void;\n};\n\nconst SelectContext = createContext<SelectContextValue | null>(null);\n\nconst useSelect = () => {\n const context = useContext(SelectContext);\n if (!context) {\n throw new Error('Select components must be used within Select');\n }\n return context;\n};\n\ntype SelectPropsBase = Omit<\n SelectPrimitive.Root.Props<string>,\n | 'open'\n | 'defaultOpen'\n | 'onOpenChange'\n | 'value'\n | 'defaultValue'\n | 'onValueChange'\n | 'multiple'\n> & {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /**\n * Shows a clear button in the trigger while the select has a value.\n * Ignored when the select is required, disabled or read-only.\n */\n clearable?: boolean;\n};\n\ntype SelectPropsSingle = SelectPropsBase & {\n multiple?: false;\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n};\n\ntype SelectPropsMultiple = SelectPropsBase & {\n multiple: true;\n value?: string[];\n defaultValue?: string[];\n onValueChange?: (value: string[]) => void;\n};\n\ntype SelectProps = SelectPropsSingle | SelectPropsMultiple;\n\nfunction Select(props: SelectPropsSingle): ReactNode;\nfunction Select(props: SelectPropsMultiple): ReactNode;\nfunction Select(props: SelectProps) {\n const [isOpen, setIsOpen] = useControllableState({\n prop: props.open,\n defaultProp: props.defaultOpen ?? false,\n onChange: props.onOpenChange,\n });\n\n const [value, setValue] = useControllableState<string | string[]>({\n prop: props.value,\n defaultProp: props.defaultValue ?? (props.multiple ? [] : ''),\n onChange: (nextValue) => {\n if (props.multiple) {\n props.onValueChange?.(Array.isArray(nextValue) ? nextValue : []);\n } else {\n props.onValueChange?.(typeof nextValue === 'string' ? nextValue : '');\n }\n },\n });\n\n const hasValue = value.length > 0;\n const canClear =\n props.clearable === true &&\n hasValue &&\n !props.required &&\n !props.disabled &&\n !props.readOnly;\n const isMultiple = props.multiple === true;\n\n const selectContext = useMemo(\n () => ({\n isOpen: isOpen ?? false,\n canClear,\n clear: () => setValue(isMultiple ? [] : ''),\n }),\n [isOpen, canClear, isMultiple, setValue]\n );\n\n if (props.multiple) {\n const {\n multiple: _multiple,\n value: _value,\n defaultValue: _defaultValue,\n onValueChange: _onValueChange,\n clearable: _clearable,\n ...rest\n } = props;\n\n return (\n <SelectContext.Provider value={selectContext}>\n <SelectPrimitive.Root\n data-slot=\"select\"\n open={isOpen}\n onOpenChange={(nextOpen) => setIsOpen(nextOpen)}\n value={Array.isArray(value) ? value : []}\n onValueChange={(nextValue, _details) => {\n setValue(nextValue ?? []);\n }}\n multiple\n {...rest}\n />\n </SelectContext.Provider>\n );\n }\n\n const {\n value: _value,\n defaultValue: _defaultValue,\n onValueChange: _onValueChange,\n clearable: _clearable,\n ...rest\n } = props;\n\n return (\n <SelectContext.Provider value={selectContext}>\n <SelectPrimitive.Root\n data-slot=\"select\"\n open={isOpen}\n onOpenChange={(nextOpen) => setIsOpen(nextOpen)}\n value={typeof value === 'string' && value !== '' ? value : null}\n onValueChange={(nextValue, _details) => {\n setValue(typeof nextValue === 'string' ? nextValue : '');\n }}\n {...rest}\n />\n </SelectContext.Provider>\n );\n}\n\nfunction SelectGroup({\n className,\n ...props\n}: SelectPrimitive.Group.Props): ReactNode {\n return (\n <SelectPrimitive.Group\n data-slot=\"select-group\"\n className={cn('scroll-my-1 p-1', className)}\n {...props}\n />\n );\n}\n\nfunction SelectValue({\n icon,\n ...props\n}: SelectPrimitive.Value.Props & {\n icon?: ReactNode;\n}): ReactNode {\n if (icon) {\n return (\n <span className=\"flex flex-1 items-center gap-2 min-w-0 overflow-hidden\">\n {icon}\n <SelectPrimitive.Value\n data-slot=\"select-value\"\n className=\"flex-1 truncate min-w-0 text-base-foreground data-placeholder:text-muted-foreground data-disabled:text-base-foreground-disabled data-readonly:text-muted-foreground\"\n {...props}\n />\n </span>\n );\n }\n return (\n <SelectPrimitive.Value\n data-slot=\"select-value\"\n className=\"flex-1 truncate min-w-0 text-base-foreground data-placeholder:text-muted-foreground data-disabled:text-base-foreground-disabled data-readonly:text-muted-foreground\"\n {...props}\n />\n );\n}\n\nconst stopTriggerEvent = (event: SyntheticEvent) => {\n event.stopPropagation();\n};\n\nfunction SelectClearButton({ label }: { label: string }): ReactNode {\n const { clear } = useSelect();\n\n return (\n <Button\n data-slot=\"select-clear\"\n variant=\"ghost\"\n size=\"icon-sm\"\n render={<span />}\n aria-label={label}\n className=\"rounded-md\"\n onPointerDown={stopTriggerEvent}\n onMouseDown={stopTriggerEvent}\n onKeyDown={stopTriggerEvent}\n onKeyUp={stopTriggerEvent}\n onClick={(event) => {\n event.stopPropagation();\n event.preventDefault();\n const trigger = event.currentTarget.closest<HTMLElement>(\n '[data-slot=\"select-trigger\"]'\n );\n clear();\n trigger?.focus();\n }}\n >\n <IconCircleXFilled\n className=\"size-4 text-medium-foreground\"\n aria-hidden\n />\n </Button>\n );\n}\n\nconst SelectTrigger: ForwardRefExoticComponent<\n Omit<\n SelectTriggerProps & {\n size?: 'sm' | 'default';\n errorMessage?: string;\n clearLabel?: string;\n },\n 'ref'\n > &\n RefAttributes<HTMLButtonElement>\n> = forwardRef<\n ComponentRef<typeof SelectPrimitive.Trigger>,\n SelectPrimitive.Trigger.Props & {\n size?: 'sm' | 'default';\n errorMessage?: string;\n clearLabel?: string;\n }\n>(\n (\n {\n className,\n size = 'default',\n children,\n errorMessage,\n clearLabel = 'Clear selection',\n ...props\n },\n ref\n ) => {\n const { isOpen, canClear } = useSelect();\n const isInvalid = !!errorMessage;\n const errorId = useId();\n const showClear = canClear && !isOpen && !props.disabled;\n\n return (\n <>\n <SelectPrimitive.Trigger\n ref={ref}\n data-slot=\"select-trigger\"\n data-size={size}\n aria-invalid={isInvalid ? true : undefined}\n aria-describedby={isInvalid ? errorId : undefined}\n className={cn(\n 'min-w-50 max-w-[min(100%,420px)]',\n formFieldTriggerClasses,\n isOpen && formFieldOpenState,\n className\n )}\n {...props}\n >\n {children}\n {showClear && <SelectClearButton label={clearLabel} />}\n <SelectPrimitive.Icon\n render={\n <IconChevronDown\n className={cn(\n 'size-4 opacity-50 transition-transform',\n isOpen ? 'rotate-180' : 'rotate-0'\n )}\n />\n }\n />\n </SelectPrimitive.Trigger>\n {errorMessage && (\n <div\n id={errorId}\n className=\"flex flex-row gap-1 justify-start items-center p-1\"\n >\n <IconExclamationCircle className=\"text-destructive-foreground text-sm size-4\" />\n <span className=\"text-destructive-foreground text-sm\">\n {errorMessage}\n </span>\n </div>\n )}\n </>\n );\n }\n);\n\nSelectTrigger.displayName = 'SelectTrigger';\n\nfunction SelectContent({\n className,\n children,\n position: _position = 'popper',\n align = 'start',\n alignOffset = 0,\n side = 'bottom',\n sideOffset = 4,\n ...props\n}: SelectPrimitive.Popup.Props & {\n position?: 'popper' | 'item-aligned';\n align?: SelectPrimitive.Positioner.Props['align'];\n alignOffset?: SelectPrimitive.Positioner.Props['alignOffset'];\n side?: SelectPrimitive.Positioner.Props['side'];\n sideOffset?: SelectPrimitive.Positioner.Props['sideOffset'];\n}): ReactNode {\n const container = usePortalContainer();\n return (\n <SelectPrimitive.Portal container={container}>\n <SelectPrimitive.Positioner\n alignItemWithTrigger={false}\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n collisionPadding={10}\n className=\"isolate z-50\"\n >\n <SelectPrimitive.Popup\n data-slot=\"select-content\"\n className={cn(\n 'bg-popover-background text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--available-height) max-w-[min(100%,420px)] min-w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md border border-default shadow-md outline-none',\n menuContainerPadding,\n _position === 'popper' && 'data-[side=bottom]:translate-y-1',\n className\n )}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.List>{children}</SelectPrimitive.List>\n <SelectScrollDownButton />\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>\n );\n}\n\nfunction SelectLabel({\n className,\n ...props\n}: SelectPrimitive.GroupLabel.Props): ReactNode {\n return (\n <SelectPrimitive.GroupLabel\n data-slot=\"select-label\"\n className={cn(menuSectionLabelClasses, className)}\n {...props}\n />\n );\n}\n\nfunction SelectItem({\n className,\n children,\n icon,\n suffix,\n ...props\n}: SelectPrimitive.Item.Props & {\n icon?: ReactNode;\n suffix?: ReactNode;\n}): ReactNode {\n const title = typeof children === 'string' ? children : undefined;\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cn(\n \"relative flex w-full min-h-9 cursor-default items-center gap-2 rounded-lg pr-8 text-sm leading-4.5 font-medium outline-hidden select-none focus:bg-popover-background-hover focus:text-popover-foreground data-[disabled]:pointer-events-none data-[disabled]:text-base-foreground-disabled data-[disabled]:opacity-100 data-[disabled]:[&_svg]:text-base-foreground-disabled [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground\",\n menuItemPadding,\n className\n )}\n {...props}\n >\n <SelectPrimitive.ItemIndicator\n render={\n <span className=\"absolute right-2 flex size-3.5 items-center justify-center\">\n <IconCheck className=\"size-4 text-popover-foreground\" />\n </span>\n }\n />\n {icon && <span className=\"flex items-center gap-2 mr-1\">{icon}</span>}\n <SelectPrimitive.ItemText\n className=\"flex-1 truncate min-w-0\"\n title={title}\n >\n {children}\n </SelectPrimitive.ItemText>\n {suffix && <span className=\"shrink-0 ml-auto\">{suffix}</span>}\n </SelectPrimitive.Item>\n );\n}\n\nfunction SelectSeparator({\n className,\n ...props\n}: SelectPrimitive.Separator.Props): ReactNode {\n return (\n <SelectPrimitive.Separator\n data-slot=\"select-separator\"\n className={cn(\n menuSectionSeparatorClasses,\n 'pointer-events-none',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: SelectPrimitive.ScrollUpArrow.Props): ReactNode {\n return (\n <SelectPrimitive.ScrollUpArrow\n data-slot=\"select-scroll-up-button\"\n className={cn(\n 'bg-popover-background z-10 flex cursor-default items-center justify-center py-1 top-0 w-full',\n className\n )}\n {...props}\n >\n <IconChevronUp className=\"size-4\" />\n </SelectPrimitive.ScrollUpArrow>\n );\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: SelectPrimitive.ScrollDownArrow.Props): ReactNode {\n return (\n <SelectPrimitive.ScrollDownArrow\n data-slot=\"select-scroll-down-button\"\n className={cn(\n 'bg-popover-background z-10 flex cursor-default items-center justify-center py-1 bottom-0 w-full',\n className\n )}\n {...props}\n >\n <IconChevronDown className=\"size-4\" />\n </SelectPrimitive.ScrollDownArrow>\n );\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n};\n"],"names":["createContext","forwardRef","useContext","useId","useMemo","Select","SelectPrimitive","IconCheck","IconChevronDown","IconChevronUp","IconCircleXFilled","IconExclamationCircle","usePortalContainer","useControllableState","cn","formFieldOpenState","formFieldTriggerClasses","menuContainerPadding","menuItemPadding","menuSectionLabelClasses","menuSectionSeparatorClasses","Button","SelectContext","useSelect","context","Error","props","isOpen","setIsOpen","prop","open","defaultProp","defaultOpen","onChange","onOpenChange","value","setValue","defaultValue","multiple","nextValue","onValueChange","Array","isArray","hasValue","length","canClear","clearable","required","disabled","readOnly","isMultiple","selectContext","clear","_multiple","_value","_defaultValue","_onValueChange","_clearable","rest","Provider","Root","data-slot","nextOpen","_details","SelectGroup","className","Group","SelectValue","icon","span","Value","stopTriggerEvent","event","stopPropagation","SelectClearButton","label","variant","size","render","aria-label","onPointerDown","onMouseDown","onKeyDown","onKeyUp","onClick","preventDefault","trigger","currentTarget","closest","focus","aria-hidden","SelectTrigger","children","errorMessage","clearLabel","ref","isInvalid","errorId","showClear","Trigger","data-size","aria-invalid","undefined","aria-describedby","Icon","div","id","displayName","SelectContent","position","_position","align","alignOffset","side","sideOffset","container","Portal","Positioner","alignItemWithTrigger","collisionPadding","Popup","SelectScrollUpButton","List","SelectScrollDownButton","SelectLabel","GroupLabel","SelectItem","suffix","title","Item","ItemIndicator","ItemText","SelectSeparator","Separator","ScrollUpArrow","ScrollDownArrow"],"mappings":";AAAA,SAMEA,aAAa,EACbC,UAAU,EACVC,UAAU,EACVC,KAAK,EACLC,OAAO,QACF,QAAQ;AAGf,SAASC,UAAUC,eAAe,QAAQ,wBAAwB;AAClE,SACEC,SAAS,EACTC,eAAe,EACfC,aAAa,EACbC,iBAAiB,EACjBC,qBAAqB,QAChB,sBAAsB;AAE7B,SAASC,kBAAkB,QAAQ,2CAA2C;AAC9E,SAASC,oBAAoB,QAAQ,yC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;QACnBpE,aAAU;QACVI,WAAWnD,GACT,ufACAI,iBACA+C;QAED,GAAGvC,KAAK;;0BAET,KAACpB,gBAAgB4H,aAAa;gBAC5BpD,sBACE,KAACT;oBAAKJ,WAAU;8BACd,cAAA,KAAC1D;wBAAU0D,WAAU;;;;YAI1BG,sBAAQ,KAACC;gBAAKJ,WAAU;0BAAgCG;;0BACzD,KAAC9D,gBAAgB6H,QAAQ;gBACvBlE,WAAU;gBACV+D,OAAOA;0BAENpC;;YAEFmC,wBAAU,KAAC1D;gBAAKJ,WAAU;0BAAoB8D;;;;AAGrD;AAEA,SAASK,gBAAgB,EACvBnE,SAAS,EACT,GAAGvC,OAC6B;IAChC,qBACE,KAACpB,gBAAgB+H,SAAS;QACxBxE,aAAU;QACVI,WAAWnD,GACTM,6BACA,uBACA6C;QAED,GAAGvC,KAAK;;AAGf;AAEA,SAAS+F,qBAAqB,EAC5BxD,SAAS,EACT,GAAGvC,OACiC;IACpC,qBACE,KAACpB,gBAAgBgI,aAAa;QAC5BzE,aAAU;QACVI,WAAWnD,GACT,gGACAmD;QAED,GAAGvC,KAAK;kBAET,cAAA,KAACjB;YAAcwD,WAAU;;;AAG/B;AAEA,SAAS0D,uBAAuB,EAC9B1D,SAAS,EACT,GAAGvC,OACmC;IACtC,qBACE,KAACpB,gBAAgBiI,eAAe;QAC9B1E,aAAU;QACVI,WAAWnD,GACT,mGACAmD;QAED,GAAGvC,KAAK;kBAET,cAAA,KAAClB;YAAgByD,WAAU;;;AAGjC;AAEA,SACE5D,MAAM,EACNuG,aAAa,EACb5C,WAAW,EACX8D,UAAU,EACVF,WAAW,EACXD,sBAAsB,EACtBF,oBAAoB,EACpBW,eAAe,EACfzC,aAAa,EACbxB,WAAW,GACX"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
|
|
3
|
-
import { cn } from "../../../../lib/utils
|
|
3
|
+
import { cn } from "../../../../lib/utils";
|
|
4
4
|
function Separator({ className, orientation = 'horizontal', ...props }) {
|
|
5
5
|
return /*#__PURE__*/ _jsx(SeparatorPrimitive, {
|
|
6
6
|
"data-slot": "separator",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/ui/core/separator/separator.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { Separator as SeparatorPrimitive } from '@base-ui/react/separator';\n\nimport { cn } from '../../../../lib/utils';\n\nfunction Separator({\n className,\n orientation = 'horizontal',\n ...props\n}: SeparatorPrimitive.Props): ReactNode {\n return (\n <SeparatorPrimitive\n data-slot=\"separator\"\n orientation={orientation}\n className={cn(\n 'bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px',\n className\n )}\n {...props}\n />\n );\n}\n\nexport { Separator };\n"],"names":["Separator","SeparatorPrimitive","cn","className","orientation","props","data-slot"],"mappings":";AAEA,SAASA,aAAaC,kBAAkB,QAAQ,2BAA2B;AAE3E,SAASC,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/separator/separator.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { Separator as SeparatorPrimitive } from '@base-ui/react/separator';\n\nimport { cn } from '../../../../lib/utils';\n\nfunction Separator({\n className,\n orientation = 'horizontal',\n ...props\n}: SeparatorPrimitive.Props): ReactNode {\n return (\n <SeparatorPrimitive\n data-slot=\"separator\"\n orientation={orientation}\n className={cn(\n 'bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px',\n className\n )}\n {...props}\n />\n );\n}\n\nexport { Separator };\n"],"names":["Separator","SeparatorPrimitive","cn","className","orientation","props","data-slot"],"mappings":";AAEA,SAASA,aAAaC,kBAAkB,QAAQ,2BAA2B;AAE3E,SAASC,EAAE,QAAQ,wBAAwB;AAE3C,SAASF,UAAU,EACjBG,SAAS,EACTC,cAAc,YAAY,EAC1B,GAAGC,OACsB;IACzB,qBACE,KAACJ;QACCK,aAAU;QACVF,aAAaA;QACbD,WAAWD,GACT,kKACAC;QAED,GAAGE,KAAK;;AAGf;AAEA,SAASL,SAAS,GAAG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useMemo } from "react";
|
|
3
3
|
import { motion } from "framer-motion";
|
|
4
|
-
import { cn } from "../../../../lib/utils
|
|
4
|
+
import { cn } from "../../../../lib/utils";
|
|
5
5
|
const gradientMap = {
|
|
6
6
|
nordic: 'var(--gradient-nordic)',
|
|
7
7
|
aurora: 'var(--gradient-aurora)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/ui/core/shimmer/shimmer.tsx"],"sourcesContent":["import {\n type MemoExoticComponent,\n type CSSProperties,\n type ReactNode,\n memo,\n useMemo,\n} from 'react';\n\nimport { motion, type Transition } from 'framer-motion';\n\nimport { cn } from '../../../../lib/utils';\n\ntype TextShimmerProps = {\n children: string;\n as?: 'p' | 'span' | 'div' | 'h1' | 'h2' | 'h3';\n className?: string;\n duration?: number;\n spread?: number;\n variant?:\n | 'default'\n | 'nordic'\n | 'aurora'\n | 'dusk'\n | 'equinox'\n | 'summer'\n | 'spring'\n | 'fall'\n | 'active';\n};\n\ntype ShimmerVariant = NonNullable<TextShimmerProps['variant']>;\n\nconst gradientMap: Record<Exclude<ShimmerVariant, 'default'>, string> = {\n nordic: 'var(--gradient-nordic)',\n aurora: 'var(--gradient-aurora)',\n dusk: 'var(--gradient-dusk)',\n equinox: 'var(--gradient-equinox)',\n summer: 'var(--gradient-summer)',\n spring: 'var(--gradient-spring)',\n fall: 'var(--gradient-fall)',\n active: 'var(--gradient-active)',\n};\n\nconst shimmerAnimate = {\n backgroundPosition: ['100% center, center', '0% center, center'],\n};\n\nconst activeShimmerAnimate = {\n backgroundPosition: ['0% center, 0% center', '-200% center, -200% center'],\n};\n\nfunction ShimmerComponent({\n children,\n as: Tag = 'p',\n className,\n duration = 2,\n spread = 2,\n variant = 'default',\n}: TextShimmerProps): ReactNode {\n const dynamicSpread = useMemo(\n () => (children?.length ?? 0) * spread,\n [children, spread]\n );\n\n const backgroundImage = useMemo(() => {\n const shimmerBg =\n 'linear-gradient(90deg, transparent calc(50% - var(--spread)), rgba(255, 255, 255, 0.4), transparent calc(50% + var(--spread)))';\n\n if (variant === 'default') {\n return `${shimmerBg}, linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))`;\n }\n\n return `${shimmerBg}, ${gradientMap[variant]}`;\n }, [variant]);\n\n const shimmerStyle: CSSProperties & { '--spread': string } = {\n '--spread': `${dynamicSpread}px`,\n backgroundImage,\n backgroundSize:\n variant === 'active' ? '200% 100%, 200% 100%' : '250% 100%, 100% 100%',\n };\n const shimmerTransition: Transition = {\n repeat: Number.POSITIVE_INFINITY,\n duration,\n ease: 'linear',\n };\n\n const MotionTag = motion[Tag];\n\n return (\n <MotionTag\n data-slot=\"shimmer\"\n className={cn(\n 'relative inline-block bg-clip-text text-transparent rounded-md',\n className\n )}\n animate={variant === 'active' ? activeShimmerAnimate : shimmerAnimate}\n style={shimmerStyle}\n transition={shimmerTransition}\n >\n {children}\n </MotionTag>\n );\n}\n\nconst MemoizedShimmer: MemoExoticComponent<typeof ShimmerComponent> =\n memo(ShimmerComponent);\nMemoizedShimmer.displayName = 'Shimmer';\n\nexport { MemoizedShimmer as Shimmer };\n"],"names":["memo","useMemo","motion","cn","gradientMap","nordic","aurora","dusk","equinox","summer","spring","fall","active","shimmerAnimate","backgroundPosition","activeShimmerAnimate","ShimmerComponent","children","as","Tag","className","duration","spread","variant","dynamicSpread","length","backgroundImage","shimmerBg","shimmerStyle","backgroundSize","shimmerTransition","repeat","Number","POSITIVE_INFINITY","ease","MotionTag","data-slot","animate","style","transition","MemoizedShimmer","displayName","Shimmer"],"mappings":";AAAA,SAIEA,IAAI,EACJC,OAAO,QACF,QAAQ;AAEf,SAASC,MAAM,QAAyB,gBAAgB;AAExD,SAASC,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/shimmer/shimmer.tsx"],"sourcesContent":["import {\n type MemoExoticComponent,\n type CSSProperties,\n type ReactNode,\n memo,\n useMemo,\n} from 'react';\n\nimport { motion, type Transition } from 'framer-motion';\n\nimport { cn } from '../../../../lib/utils';\n\ntype TextShimmerProps = {\n children: string;\n as?: 'p' | 'span' | 'div' | 'h1' | 'h2' | 'h3';\n className?: string;\n duration?: number;\n spread?: number;\n variant?:\n | 'default'\n | 'nordic'\n | 'aurora'\n | 'dusk'\n | 'equinox'\n | 'summer'\n | 'spring'\n | 'fall'\n | 'active';\n};\n\ntype ShimmerVariant = NonNullable<TextShimmerProps['variant']>;\n\nconst gradientMap: Record<Exclude<ShimmerVariant, 'default'>, string> = {\n nordic: 'var(--gradient-nordic)',\n aurora: 'var(--gradient-aurora)',\n dusk: 'var(--gradient-dusk)',\n equinox: 'var(--gradient-equinox)',\n summer: 'var(--gradient-summer)',\n spring: 'var(--gradient-spring)',\n fall: 'var(--gradient-fall)',\n active: 'var(--gradient-active)',\n};\n\nconst shimmerAnimate = {\n backgroundPosition: ['100% center, center', '0% center, center'],\n};\n\nconst activeShimmerAnimate = {\n backgroundPosition: ['0% center, 0% center', '-200% center, -200% center'],\n};\n\nfunction ShimmerComponent({\n children,\n as: Tag = 'p',\n className,\n duration = 2,\n spread = 2,\n variant = 'default',\n}: TextShimmerProps): ReactNode {\n const dynamicSpread = useMemo(\n () => (children?.length ?? 0) * spread,\n [children, spread]\n );\n\n const backgroundImage = useMemo(() => {\n const shimmerBg =\n 'linear-gradient(90deg, transparent calc(50% - var(--spread)), rgba(255, 255, 255, 0.4), transparent calc(50% + var(--spread)))';\n\n if (variant === 'default') {\n return `${shimmerBg}, linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))`;\n }\n\n return `${shimmerBg}, ${gradientMap[variant]}`;\n }, [variant]);\n\n const shimmerStyle: CSSProperties & { '--spread': string } = {\n '--spread': `${dynamicSpread}px`,\n backgroundImage,\n backgroundSize:\n variant === 'active' ? '200% 100%, 200% 100%' : '250% 100%, 100% 100%',\n };\n const shimmerTransition: Transition = {\n repeat: Number.POSITIVE_INFINITY,\n duration,\n ease: 'linear',\n };\n\n const MotionTag = motion[Tag];\n\n return (\n <MotionTag\n data-slot=\"shimmer\"\n className={cn(\n 'relative inline-block bg-clip-text text-transparent rounded-md',\n className\n )}\n animate={variant === 'active' ? activeShimmerAnimate : shimmerAnimate}\n style={shimmerStyle}\n transition={shimmerTransition}\n >\n {children}\n </MotionTag>\n );\n}\n\nconst MemoizedShimmer: MemoExoticComponent<typeof ShimmerComponent> =\n memo(ShimmerComponent);\nMemoizedShimmer.displayName = 'Shimmer';\n\nexport { MemoizedShimmer as Shimmer };\n"],"names":["memo","useMemo","motion","cn","gradientMap","nordic","aurora","dusk","equinox","summer","spring","fall","active","shimmerAnimate","backgroundPosition","activeShimmerAnimate","ShimmerComponent","children","as","Tag","className","duration","spread","variant","dynamicSpread","length","backgroundImage","shimmerBg","shimmerStyle","backgroundSize","shimmerTransition","repeat","Number","POSITIVE_INFINITY","ease","MotionTag","data-slot","animate","style","transition","MemoizedShimmer","displayName","Shimmer"],"mappings":";AAAA,SAIEA,IAAI,EACJC,OAAO,QACF,QAAQ;AAEf,SAASC,MAAM,QAAyB,gBAAgB;AAExD,SAASC,EAAE,QAAQ,wBAAwB;AAsB3C,MAAMC,cAAkE;IACtEC,QAAQ;IACRC,QAAQ;IACRC,MAAM;IACNC,SAAS;IACTC,QAAQ;IACRC,QAAQ;IACRC,MAAM;IACNC,QAAQ;AACV;AAEA,MAAMC,iBAAiB;IACrBC,oBAAoB;QAAC;QAAuB;KAAoB;AAClE;AAEA,MAAMC,uBAAuB;IAC3BD,oBAAoB;QAAC;QAAwB;KAA6B;AAC5E;AAEA,SAASE,iBAAiB,EACxBC,QAAQ,EACRC,IAAIC,MAAM,GAAG,EACbC,SAAS,EACTC,WAAW,CAAC,EACZC,SAAS,CAAC,EACVC,UAAU,SAAS,EACF;IACjB,MAAMC,gBAAgBvB,QACpB,IAAM,AAACgB,CAAAA,UAAUQ,UAAU,CAAA,IAAKH,QAChC;QAACL;QAAUK;KAAO;IAGpB,MAAMI,kBAAkBzB,QAAQ;QAC9B,MAAM0B,YACJ;QAEF,IAAIJ,YAAY,WAAW;YACzB,OAAO,GAAGI,UAAU,+EAA+E,CAAC;QACtG;QAEA,OAAO,GAAGA,UAAU,EAAE,EAAEvB,WAAW,CAACmB,QAAQ,EAAE;IAChD,GAAG;QAACA;KAAQ;IAEZ,MAAMK,eAAuD;QAC3D,YAAY,GAAGJ,cAAc,EAAE,CAAC;QAChCE;QACAG,gBACEN,YAAY,WAAW,yBAAyB;IACpD;IACA,MAAMO,oBAAgC;QACpCC,QAAQC,OAAOC,iBAAiB;QAChCZ;QACAa,MAAM;IACR;IAEA,MAAMC,YAAYjC,MAAM,CAACiB,IAAI;IAE7B,qBACE,KAACgB;QACCC,aAAU;QACVhB,WAAWjB,GACT,kEACAiB;QAEFiB,SAASd,YAAY,WAAWR,uBAAuBF;QACvDyB,OAAOV;QACPW,YAAYT;kBAEXb;;AAGP;AAEA,MAAMuB,gCACJxC,KAAKgB;AACPwB,gBAAgBC,WAAW,GAAG;AAE9B,SAASD,mBAAmBE,OAAO,GAAG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { cn } from "../../../../lib/utils
|
|
3
|
+
import { cn } from "../../../../lib/utils";
|
|
4
4
|
const Skeleton = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ _jsx("div", {
|
|
5
5
|
ref: ref,
|
|
6
6
|
"data-slot": "skeleton",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/ui/core/skeleton/skeleton.tsx"],"sourcesContent":["import {\n type ForwardRefExoticComponent,\n type RefAttributes,\n type ComponentProps,\n type ComponentRef,\n forwardRef,\n} from 'react';\n\nimport { cn } from '../../../../lib/utils';\n\nconst Skeleton: ForwardRefExoticComponent<\n ComponentProps<'div'> & RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<'div'>, ComponentProps<'div'>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"skeleton\"\n className={cn('bg-accent-background animate-pulse rounded-md', className)}\n {...props}\n />\n )\n);\n\nSkeleton.displayName = 'Skeleton';\n\nexport { Skeleton };\n"],"names":["forwardRef","cn","Skeleton","className","props","ref","div","data-slot","displayName"],"mappings":";AAAA,SAKEA,UAAU,QACL,QAAQ;AAEf,SAASC,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/skeleton/skeleton.tsx"],"sourcesContent":["import {\n type ForwardRefExoticComponent,\n type RefAttributes,\n type ComponentProps,\n type ComponentRef,\n forwardRef,\n} from 'react';\n\nimport { cn } from '../../../../lib/utils';\n\nconst Skeleton: ForwardRefExoticComponent<\n ComponentProps<'div'> & RefAttributes<HTMLDivElement>\n> = forwardRef<ComponentRef<'div'>, ComponentProps<'div'>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"skeleton\"\n className={cn('bg-accent-background animate-pulse rounded-md', className)}\n {...props}\n />\n )\n);\n\nSkeleton.displayName = 'Skeleton';\n\nexport { Skeleton };\n"],"names":["forwardRef","cn","Skeleton","className","props","ref","div","data-slot","displayName"],"mappings":";AAAA,SAKEA,UAAU,QACL,QAAQ;AAEf,SAASC,EAAE,QAAQ,wBAAwB;AAE3C,MAAMC,yBAEFF,WACF,CAAC,EAAEG,SAAS,EAAE,GAAGC,OAAO,EAAEC,oBACxB,KAACC;QACCD,KAAKA;QACLE,aAAU;QACVJ,WAAWF,GAAG,iDAAiDE;QAC9D,GAAGC,KAAK;;AAKfF,SAASM,WAAW,GAAG;AAEvB,SAASN,QAAQ,GAAG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId } from "react";
|
|
3
|
-
import { Label } from "../label/label
|
|
3
|
+
import { Label } from "../label/label";
|
|
4
4
|
import { Slider } from "./slider.js";
|
|
5
5
|
export function SliderGallery() {
|
|
6
6
|
const id = useId();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/ui/core/slider/slider.gallery.tsx"],"sourcesContent":["import { type ReactElement, useId } from 'react';\n\nimport { Label } from '../label/label';\n\nimport { Slider } from './slider';\n\nexport function SliderGallery(): ReactElement {\n const id = useId();\n\n return (\n <div className=\"w-80 space-y-6\">\n <div className=\"flex flex-col\">\n <Label id={`${id}-volume`}>Volume</Label>\n <Slider defaultValue={[50]} aria-labelledby={`${id}-volume`} />\n </div>\n <div className=\"flex flex-col\">\n <Label id={`${id}-price`}>Price range</Label>\n <Slider defaultValue={[20, 80]} aria-labelledby={`${id}-price`} />\n </div>\n <div className=\"group flex flex-col\" data-disabled=\"true\">\n <Label id={`${id}-brightness`}>Brightness</Label>\n <Slider\n defaultValue={[30]}\n aria-labelledby={`${id}-brightness`}\n disabled\n />\n </div>\n </div>\n );\n}\n"],"names":["useId","Label","Slider","SliderGallery","id","div","className","defaultValue","aria-labelledby","data-disabled","disabled"],"mappings":";AAAA,SAA4BA,KAAK,QAAQ,QAAQ;AAEjD,SAASC,KAAK,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/slider/slider.gallery.tsx"],"sourcesContent":["import { type ReactElement, useId } from 'react';\n\nimport { Label } from '../label/label';\n\nimport { Slider } from './slider';\n\nexport function SliderGallery(): ReactElement {\n const id = useId();\n\n return (\n <div className=\"w-80 space-y-6\">\n <div className=\"flex flex-col\">\n <Label id={`${id}-volume`}>Volume</Label>\n <Slider defaultValue={[50]} aria-labelledby={`${id}-volume`} />\n </div>\n <div className=\"flex flex-col\">\n <Label id={`${id}-price`}>Price range</Label>\n <Slider defaultValue={[20, 80]} aria-labelledby={`${id}-price`} />\n </div>\n <div className=\"group flex flex-col\" data-disabled=\"true\">\n <Label id={`${id}-brightness`}>Brightness</Label>\n <Slider\n defaultValue={[30]}\n aria-labelledby={`${id}-brightness`}\n disabled\n />\n </div>\n </div>\n );\n}\n"],"names":["useId","Label","Slider","SliderGallery","id","div","className","defaultValue","aria-labelledby","data-disabled","disabled"],"mappings":";AAAA,SAA4BA,KAAK,QAAQ,QAAQ;AAEjD,SAASC,KAAK,QAAQ,iBAAiB;AAEvC,SAASC,MAAM,QAAQ,cAAW;AAElC,OAAO,SAASC;IACd,MAAMC,KAAKJ;IAEX,qBACE,MAACK;QAAIC,WAAU;;0BACb,MAACD;gBAAIC,WAAU;;kCACb,KAACL;wBAAMG,IAAI,GAAGA,GAAG,OAAO,CAAC;kCAAE;;kCAC3B,KAACF;wBAAOK,cAAc;4BAAC;yBAAG;wBAAEC,mBAAiB,GAAGJ,GAAG,OAAO,CAAC;;;;0BAE7D,MAACC;gBAAIC,WAAU;;kCACb,KAACL;wBAAMG,IAAI,GAAGA,GAAG,MAAM,CAAC;kCAAE;;kCAC1B,KAACF;wBAAOK,cAAc;4BAAC;4BAAI;yBAAG;wBAAEC,mBAAiB,GAAGJ,GAAG,MAAM,CAAC;;;;0BAEhE,MAACC;gBAAIC,WAAU;gBAAsBG,iBAAc;;kCACjD,KAACR;wBAAMG,IAAI,GAAGA,GAAG,WAAW,CAAC;kCAAE;;kCAC/B,KAACF;wBACCK,cAAc;4BAAC;yBAAG;wBAClBC,mBAAiB,GAAGJ,GAAG,WAAW,CAAC;wBACnCM,QAAQ;;;;;;AAKlB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { Slider as SliderPrimitive } from "@base-ui/react/slider";
|
|
4
|
-
import { cn } from "../../../../lib/utils
|
|
4
|
+
import { cn } from "../../../../lib/utils";
|
|
5
5
|
const Slider = /*#__PURE__*/ forwardRef(({ className, defaultValue, value, min = 0, max = 100, onValueChange, ...props }, ref)=>{
|
|
6
6
|
const thumbValues = Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [
|
|
7
7
|
min
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/ui/core/slider/slider.tsx"],"sourcesContent":["import {\n type ComponentRef,\n type ForwardRefExoticComponent,\n type ReactNode,\n type RefAttributes,\n forwardRef,\n} from 'react';\n\nimport { Slider as SliderPrimitive } from '@base-ui/react/slider';\n\nimport { cn } from '../../../../lib/utils';\n\ntype SliderProps = Omit<\n SliderPrimitive.Root.Props<readonly number[]>,\n 'value' | 'defaultValue' | 'onValueChange'\n> & {\n value?: number[];\n defaultValue?: number[];\n onValueChange?: (value: number[]) => void;\n};\n\nconst Slider: ForwardRefExoticComponent<\n Omit<SliderProps, 'ref'> &\n RefAttributes<ComponentRef<typeof SliderPrimitive.Root>>\n> = forwardRef<ComponentRef<typeof SliderPrimitive.Root>, SliderProps>(\n (\n {\n className,\n defaultValue,\n value,\n min = 0,\n max = 100,\n onValueChange,\n ...props\n },\n ref\n ): ReactNode => {\n const thumbValues = Array.isArray(value)\n ? value\n : Array.isArray(defaultValue)\n ? defaultValue\n : [min];\n\n const handleValueChange = (nextValue: number | readonly number[]) => {\n if (!onValueChange) return;\n const next = Array.isArray(nextValue) ? [...nextValue] : [nextValue];\n onValueChange(next);\n };\n\n return (\n <SliderPrimitive.Root\n ref={ref}\n data-slot=\"slider\"\n data-range={thumbValues.length > 1 ? '' : undefined}\n defaultValue={defaultValue}\n value={value}\n min={min}\n max={max}\n className={cn(\n 'group/slider data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full',\n className\n )}\n thumbAlignment=\"edge\"\n onValueChange={handleValueChange}\n {...props}\n >\n <SliderPrimitive.Control className=\"relative flex w-full touch-none items-center select-none data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col\">\n <SliderPrimitive.Track\n data-slot=\"slider-track\"\n className=\"relative z-0 grow overflow-hidden rounded-full bg-transparent ring-1 ring-border-emphasized ring-inset data-[orientation=horizontal]:h-3 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-3\"\n >\n <SliderPrimitive.Indicator\n data-slot=\"slider-range\"\n className={cn(\n 'relative z-10 bg-transparent select-none',\n 'after:absolute after:rounded-full after:bg-secondary-background',\n 'group-data-[range]/slider:after:rounded-none',\n 'group-data-[range]/slider:group-data-[orientation=horizontal]/slider:after:left-0',\n 'group-data-[range]/slider:group-data-[orientation=vertical]/slider:after:bottom-0',\n 'group-data-[disabled]/slider:after:bg-disabled-background',\n 'group-data-[orientation=horizontal]/slider:after:inset-e-0 group-data-[orientation=horizontal]/slider:after:left-0.5 group-data-[orientation=horizontal]/slider:after:top-1/2 group-data-[orientation=horizontal]/slider:after:h-2 group-data-[orientation=horizontal]/slider:after:-translate-y-1/2',\n 'group-data-[orientation=vertical]/slider:after:inset-bs-0 group-data-[orientation=vertical]/slider:after:bottom-0.5 group-data-[orientation=vertical]/slider:after:left-1/2 group-data-[orientation=vertical]/slider:after:w-2 group-data-[orientation=vertical]/slider:after:-translate-x-1/2'\n )}\n />\n </SliderPrimitive.Track>\n {thumbValues.map((_, index) => (\n <SliderPrimitive.Thumb\n data-slot=\"slider-thumb\"\n // eslint-disable-next-line @eslint-react/no-array-index-key\n key={index}\n className={cn(\n 'relative block size-3 shrink-0 rounded-full outline-none',\n 'before:absolute before:top-1/2 before:left-1/2 before:size-2 before:-translate-x-1/2 before:-translate-y-1/2 before:rounded-full before:bg-foreground before:transition-[width,height]',\n 'hover:before:size-3',\n 'focus-visible:before:size-3 focus-visible:ring-ring-muted focus-visible:ring-4',\n 'active:before:size-3',\n 'data-disabled:pointer-events-none data-disabled:before:bg-disabled-foreground'\n )}\n />\n ))}\n </SliderPrimitive.Control>\n </SliderPrimitive.Root>\n );\n }\n);\nSlider.displayName = 'Slider';\n\nexport { Slider };\n"],"names":["forwardRef","Slider","SliderPrimitive","cn","className","defaultValue","value","min","max","onValueChange","props","ref","thumbValues","Array","isArray","handleValueChange","nextValue","next","Root","data-slot","data-range","length","undefined","thumbAlignment","Control","Track","Indicator","map","_","index","Thumb","displayName"],"mappings":";AAAA,SAKEA,UAAU,QACL,QAAQ;AAEf,SAASC,UAAUC,eAAe,QAAQ,wBAAwB;AAElE,SAASC,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/slider/slider.tsx"],"sourcesContent":["import {\n type ComponentRef,\n type ForwardRefExoticComponent,\n type ReactNode,\n type RefAttributes,\n forwardRef,\n} from 'react';\n\nimport { Slider as SliderPrimitive } from '@base-ui/react/slider';\n\nimport { cn } from '../../../../lib/utils';\n\ntype SliderProps = Omit<\n SliderPrimitive.Root.Props<readonly number[]>,\n 'value' | 'defaultValue' | 'onValueChange'\n> & {\n value?: number[];\n defaultValue?: number[];\n onValueChange?: (value: number[]) => void;\n};\n\nconst Slider: ForwardRefExoticComponent<\n Omit<SliderProps, 'ref'> &\n RefAttributes<ComponentRef<typeof SliderPrimitive.Root>>\n> = forwardRef<ComponentRef<typeof SliderPrimitive.Root>, SliderProps>(\n (\n {\n className,\n defaultValue,\n value,\n min = 0,\n max = 100,\n onValueChange,\n ...props\n },\n ref\n ): ReactNode => {\n const thumbValues = Array.isArray(value)\n ? value\n : Array.isArray(defaultValue)\n ? defaultValue\n : [min];\n\n const handleValueChange = (nextValue: number | readonly number[]) => {\n if (!onValueChange) return;\n const next = Array.isArray(nextValue) ? [...nextValue] : [nextValue];\n onValueChange(next);\n };\n\n return (\n <SliderPrimitive.Root\n ref={ref}\n data-slot=\"slider\"\n data-range={thumbValues.length > 1 ? '' : undefined}\n defaultValue={defaultValue}\n value={value}\n min={min}\n max={max}\n className={cn(\n 'group/slider data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full',\n className\n )}\n thumbAlignment=\"edge\"\n onValueChange={handleValueChange}\n {...props}\n >\n <SliderPrimitive.Control className=\"relative flex w-full touch-none items-center select-none data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col\">\n <SliderPrimitive.Track\n data-slot=\"slider-track\"\n className=\"relative z-0 grow overflow-hidden rounded-full bg-transparent ring-1 ring-border-emphasized ring-inset data-[orientation=horizontal]:h-3 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-3\"\n >\n <SliderPrimitive.Indicator\n data-slot=\"slider-range\"\n className={cn(\n 'relative z-10 bg-transparent select-none',\n 'after:absolute after:rounded-full after:bg-secondary-background',\n 'group-data-[range]/slider:after:rounded-none',\n 'group-data-[range]/slider:group-data-[orientation=horizontal]/slider:after:left-0',\n 'group-data-[range]/slider:group-data-[orientation=vertical]/slider:after:bottom-0',\n 'group-data-[disabled]/slider:after:bg-disabled-background',\n 'group-data-[orientation=horizontal]/slider:after:inset-e-0 group-data-[orientation=horizontal]/slider:after:left-0.5 group-data-[orientation=horizontal]/slider:after:top-1/2 group-data-[orientation=horizontal]/slider:after:h-2 group-data-[orientation=horizontal]/slider:after:-translate-y-1/2',\n 'group-data-[orientation=vertical]/slider:after:inset-bs-0 group-data-[orientation=vertical]/slider:after:bottom-0.5 group-data-[orientation=vertical]/slider:after:left-1/2 group-data-[orientation=vertical]/slider:after:w-2 group-data-[orientation=vertical]/slider:after:-translate-x-1/2'\n )}\n />\n </SliderPrimitive.Track>\n {thumbValues.map((_, index) => (\n <SliderPrimitive.Thumb\n data-slot=\"slider-thumb\"\n // eslint-disable-next-line @eslint-react/no-array-index-key\n key={index}\n className={cn(\n 'relative block size-3 shrink-0 rounded-full outline-none',\n 'before:absolute before:top-1/2 before:left-1/2 before:size-2 before:-translate-x-1/2 before:-translate-y-1/2 before:rounded-full before:bg-foreground before:transition-[width,height]',\n 'hover:before:size-3',\n 'focus-visible:before:size-3 focus-visible:ring-ring-muted focus-visible:ring-4',\n 'active:before:size-3',\n 'data-disabled:pointer-events-none data-disabled:before:bg-disabled-foreground'\n )}\n />\n ))}\n </SliderPrimitive.Control>\n </SliderPrimitive.Root>\n );\n }\n);\nSlider.displayName = 'Slider';\n\nexport { Slider };\n"],"names":["forwardRef","Slider","SliderPrimitive","cn","className","defaultValue","value","min","max","onValueChange","props","ref","thumbValues","Array","isArray","handleValueChange","nextValue","next","Root","data-slot","data-range","length","undefined","thumbAlignment","Control","Track","Indicator","map","_","index","Thumb","displayName"],"mappings":";AAAA,SAKEA,UAAU,QACL,QAAQ;AAEf,SAASC,UAAUC,eAAe,QAAQ,wBAAwB;AAElE,SAASC,EAAE,QAAQ,wBAAwB;AAW3C,MAAMF,uBAGFD,WACF,CACE,EACEI,SAAS,EACTC,YAAY,EACZC,KAAK,EACLC,MAAM,CAAC,EACPC,MAAM,GAAG,EACTC,aAAa,EACb,GAAGC,OACJ,EACDC;IAEA,MAAMC,cAAcC,MAAMC,OAAO,CAACR,SAC9BA,QACAO,MAAMC,OAAO,CAACT,gBACZA,eACA;QAACE;KAAI;IAEX,MAAMQ,oBAAoB,CAACC;QACzB,IAAI,CAACP,eAAe;QACpB,MAAMQ,OAAOJ,MAAMC,OAAO,CAACE,aAAa;eAAIA;SAAU,GAAG;YAACA;SAAU;QACpEP,cAAcQ;IAChB;IAEA,qBACE,KAACf,gBAAgBgB,IAAI;QACnBP,KAAKA;QACLQ,aAAU;QACVC,cAAYR,YAAYS,MAAM,GAAG,IAAI,KAAKC;QAC1CjB,cAAcA;QACdC,OAAOA;QACPC,KAAKA;QACLC,KAAKA;QACLJ,WAAWD,GACT,wFACAC;QAEFmB,gBAAe;QACfd,eAAeM;QACd,GAAGL,KAAK;kBAET,cAAA,MAACR,gBAAgBsB,OAAO;YAACpB,WAAU;;8BACjC,KAACF,gBAAgBuB,KAAK;oBACpBN,aAAU;oBACVf,WAAU;8BAEV,cAAA,KAACF,gBAAgBwB,SAAS;wBACxBP,aAAU;wBACVf,WAAWD,GACT,4CACA,mEACA,gDACA,qFACA,qFACA,6DACA,wSACA;;;gBAILS,YAAYe,GAAG,CAAC,CAACC,GAAGC,sBACnB,KAAC3B,gBAAgB4B,KAAK;wBACpBX,aAAU;wBAGVf,WAAWD,GACT,4DACA,0LACA,uBACA,kFACA,wBACA;uBAPG0B;;;;AAcjB;AAEF5B,OAAO8B,WAAW,GAAG;AAErB,SAAS9B,MAAM,GAAG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { IconAlertOctagonFilled, IconAlertTriangleFilled, IconCircleCheckFilled, IconInfoCircleFilled, IconLoader2, IconX } from "@tabler/icons-react";
|
|
3
3
|
import { Toaster as Sonner, toast } from "sonner";
|
|
4
|
-
import { cn } from "../../../../lib/utils
|
|
4
|
+
import { cn } from "../../../../lib/utils";
|
|
5
5
|
const TOASTER_STYLE = {
|
|
6
6
|
'--normal-bg': 'var(--raised-background)',
|
|
7
7
|
'--normal-text': 'var(--foreground-fixed-light)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/ui/core/sonner-toast/sonner-toast.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from 'react';\n\nimport {\n IconAlertOctagonFilled,\n IconAlertTriangleFilled,\n IconCircleCheckFilled,\n IconInfoCircleFilled,\n IconLoader2,\n IconX,\n} from '@tabler/icons-react';\nimport { Toaster as Sonner, type ToasterProps, toast } from 'sonner';\n\nimport { cn } from '../../../../lib/utils';\n\ntype ToasterStyle = CSSProperties & {\n '--normal-bg': string;\n '--normal-text': string;\n '--normal-border': string;\n '--border-radius': string;\n};\n\nconst TOASTER_STYLE: ToasterStyle = {\n '--normal-bg': 'var(--raised-background)',\n '--normal-text': 'var(--foreground-fixed-light)',\n '--normal-border': 'transparent',\n '--border-radius': 'var(--radius-lg)',\n};\n\nconst Toaster = ({ ...props }: ToasterProps): ReactNode => {\n const statusBadgeClass =\n 'flex h-5 min-w-5 items-center justify-center rounded-md px-1';\n\n return (\n <Sonner\n data-slot=\"sonner-toast\"\n theme=\"system\"\n className=\"toaster group\"\n icons={{\n close: <IconX className=\"size-4 text-foreground-fixed-light\" />,\n success: (\n <span className={cn(statusBadgeClass, 'bg-success-background')}>\n <IconCircleCheckFilled className=\"size-3 text-success-foreground-on-success\" />\n </span>\n ),\n info: (\n <span className={cn(statusBadgeClass, 'bg-info-background')}>\n <IconInfoCircleFilled className=\"size-3 text-info-foreground-on-info\" />\n </span>\n ),\n warning: (\n <span className={cn(statusBadgeClass, 'bg-warning-background')}>\n <IconAlertTriangleFilled className=\"size-3 text-warning-foreground-on-warning\" />\n </span>\n ),\n error: (\n <span className={cn(statusBadgeClass, 'bg-destructive-background')}>\n <IconAlertOctagonFilled className=\"size-3 text-destructive-foreground-on-critical\" />\n </span>\n ),\n loading: <IconLoader2 className=\"size-4 animate-spin\" />,\n }}\n style={TOASTER_STYLE}\n toastOptions={{\n unstyled: true,\n classNames: {\n toast:\n 'flex w-96 min-h-11 items-center gap-2 rounded-lg bg-raised-background p-3 shadow-md has-[[data-description]]:[&_[data-icon]]:hidden',\n icon: 'order-1 m-0 shrink-0 flex items-start',\n content:\n 'order-2 flex min-w-0 flex-1 basis-0 flex-col items-start gap-0.5',\n title:\n 'w-full self-stretch line-clamp-2 text-sm font-medium leading-4.5 tracking-normal text-foreground-fixed-light',\n description:\n 'w-full self-stretch text-sm font-normal leading-4.5 tracking-tight text-muted-foreground-fixed-light',\n actionButton:\n 'order-3 ml-auto inline-flex h-7 shrink-0 items-center justify-center gap-1.5 whitespace-nowrap rounded-md bg-transparent px-2 text-sm font-medium leading-4.5 tracking-normal text-foreground-fixed-light transition-all hover:cursor-pointer',\n cancelButton:\n 'order-3 ml-auto inline-flex h-7 shrink-0 items-center justify-center gap-1.5 whitespace-nowrap rounded-md bg-transparent px-2 text-sm font-medium leading-4.5 tracking-normal text-foreground-fixed-light transition-all hover:cursor-pointer',\n closeButton:\n 'order-4 inline-flex size-7 items-center justify-center rounded-md text-foreground-fixed-light transition-all hover:cursor-pointer hover:text-foreground-fixed-light hover:!bg-transparent',\n },\n }}\n {...props}\n />\n );\n};\n\nexport { Toaster, toast };\n"],"names":["IconAlertOctagonFilled","IconAlertTriangleFilled","IconCircleCheckFilled","IconInfoCircleFilled","IconLoader2","IconX","Toaster","Sonner","toast","cn","TOASTER_STYLE","props","statusBadgeClass","data-slot","theme","className","icons","close","success","span","info","warning","error","loading","style","toastOptions","unstyled","classNames","icon","content","title","description","actionButton","cancelButton","closeButton"],"mappings":";AAEA,SACEA,sBAAsB,EACtBC,uBAAuB,EACvBC,qBAAqB,EACrBC,oBAAoB,EACpBC,WAAW,EACXC,KAAK,QACA,sBAAsB;AAC7B,SAASC,WAAWC,MAAM,EAAqBC,KAAK,QAAQ,SAAS;AAErE,SAASC,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/sonner-toast/sonner-toast.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from 'react';\n\nimport {\n IconAlertOctagonFilled,\n IconAlertTriangleFilled,\n IconCircleCheckFilled,\n IconInfoCircleFilled,\n IconLoader2,\n IconX,\n} from '@tabler/icons-react';\nimport { Toaster as Sonner, type ToasterProps, toast } from 'sonner';\n\nimport { cn } from '../../../../lib/utils';\n\ntype ToasterStyle = CSSProperties & {\n '--normal-bg': string;\n '--normal-text': string;\n '--normal-border': string;\n '--border-radius': string;\n};\n\nconst TOASTER_STYLE: ToasterStyle = {\n '--normal-bg': 'var(--raised-background)',\n '--normal-text': 'var(--foreground-fixed-light)',\n '--normal-border': 'transparent',\n '--border-radius': 'var(--radius-lg)',\n};\n\nconst Toaster = ({ ...props }: ToasterProps): ReactNode => {\n const statusBadgeClass =\n 'flex h-5 min-w-5 items-center justify-center rounded-md px-1';\n\n return (\n <Sonner\n data-slot=\"sonner-toast\"\n theme=\"system\"\n className=\"toaster group\"\n icons={{\n close: <IconX className=\"size-4 text-foreground-fixed-light\" />,\n success: (\n <span className={cn(statusBadgeClass, 'bg-success-background')}>\n <IconCircleCheckFilled className=\"size-3 text-success-foreground-on-success\" />\n </span>\n ),\n info: (\n <span className={cn(statusBadgeClass, 'bg-info-background')}>\n <IconInfoCircleFilled className=\"size-3 text-info-foreground-on-info\" />\n </span>\n ),\n warning: (\n <span className={cn(statusBadgeClass, 'bg-warning-background')}>\n <IconAlertTriangleFilled className=\"size-3 text-warning-foreground-on-warning\" />\n </span>\n ),\n error: (\n <span className={cn(statusBadgeClass, 'bg-destructive-background')}>\n <IconAlertOctagonFilled className=\"size-3 text-destructive-foreground-on-critical\" />\n </span>\n ),\n loading: <IconLoader2 className=\"size-4 animate-spin\" />,\n }}\n style={TOASTER_STYLE}\n toastOptions={{\n unstyled: true,\n classNames: {\n toast:\n 'flex w-96 min-h-11 items-center gap-2 rounded-lg bg-raised-background p-3 shadow-md has-[[data-description]]:[&_[data-icon]]:hidden',\n icon: 'order-1 m-0 shrink-0 flex items-start',\n content:\n 'order-2 flex min-w-0 flex-1 basis-0 flex-col items-start gap-0.5',\n title:\n 'w-full self-stretch line-clamp-2 text-sm font-medium leading-4.5 tracking-normal text-foreground-fixed-light',\n description:\n 'w-full self-stretch text-sm font-normal leading-4.5 tracking-tight text-muted-foreground-fixed-light',\n actionButton:\n 'order-3 ml-auto inline-flex h-7 shrink-0 items-center justify-center gap-1.5 whitespace-nowrap rounded-md bg-transparent px-2 text-sm font-medium leading-4.5 tracking-normal text-foreground-fixed-light transition-all hover:cursor-pointer',\n cancelButton:\n 'order-3 ml-auto inline-flex h-7 shrink-0 items-center justify-center gap-1.5 whitespace-nowrap rounded-md bg-transparent px-2 text-sm font-medium leading-4.5 tracking-normal text-foreground-fixed-light transition-all hover:cursor-pointer',\n closeButton:\n 'order-4 inline-flex size-7 items-center justify-center rounded-md text-foreground-fixed-light transition-all hover:cursor-pointer hover:text-foreground-fixed-light hover:!bg-transparent',\n },\n }}\n {...props}\n />\n );\n};\n\nexport { Toaster, toast };\n"],"names":["IconAlertOctagonFilled","IconAlertTriangleFilled","IconCircleCheckFilled","IconInfoCircleFilled","IconLoader2","IconX","Toaster","Sonner","toast","cn","TOASTER_STYLE","props","statusBadgeClass","data-slot","theme","className","icons","close","success","span","info","warning","error","loading","style","toastOptions","unstyled","classNames","icon","content","title","description","actionButton","cancelButton","closeButton"],"mappings":";AAEA,SACEA,sBAAsB,EACtBC,uBAAuB,EACvBC,qBAAqB,EACrBC,oBAAoB,EACpBC,WAAW,EACXC,KAAK,QACA,sBAAsB;AAC7B,SAASC,WAAWC,MAAM,EAAqBC,KAAK,QAAQ,SAAS;AAErE,SAASC,EAAE,QAAQ,wBAAwB;AAS3C,MAAMC,gBAA8B;IAClC,eAAe;IACf,iBAAiB;IACjB,mBAAmB;IACnB,mBAAmB;AACrB;AAEA,MAAMJ,UAAU,CAAC,EAAE,GAAGK,OAAqB;IACzC,MAAMC,mBACJ;IAEF,qBACE,KAACL;QACCM,aAAU;QACVC,OAAM;QACNC,WAAU;QACVC,OAAO;YACLC,qBAAO,KAACZ;gBAAMU,WAAU;;YACxBG,uBACE,KAACC;gBAAKJ,WAAWN,GAAGG,kBAAkB;0BACpC,cAAA,KAACV;oBAAsBa,WAAU;;;YAGrCK,oBACE,KAACD;gBAAKJ,WAAWN,GAAGG,kBAAkB;0BACpC,cAAA,KAACT;oBAAqBY,WAAU;;;YAGpCM,uBACE,KAACF;gBAAKJ,WAAWN,GAAGG,kBAAkB;0BACpC,cAAA,KAACX;oBAAwBc,WAAU;;;YAGvCO,qBACE,KAACH;gBAAKJ,WAAWN,GAAGG,kBAAkB;0BACpC,cAAA,KAACZ;oBAAuBe,WAAU;;;YAGtCQ,uBAAS,KAACnB;gBAAYW,WAAU;;QAClC;QACAS,OAAOd;QACPe,cAAc;YACZC,UAAU;YACVC,YAAY;gBACVnB,OACE;gBACFoB,MAAM;gBACNC,SACE;gBACFC,OACE;gBACFC,aACE;gBACFC,cACE;gBACFC,cACE;gBACFC,aACE;YACJ;QACF;QACC,GAAGvB,KAAK;;AAGf;AAEA,SAASL,OAAO,EAAEE,KAAK,GAAG"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
|
|
3
3
|
import { IconChevronDown, IconMist } from "@tabler/icons-react";
|
|
4
|
-
import { cn } from "../../../../lib/utils
|
|
5
|
-
import { InlineCitation, InlineCitationLink } from "../inline-citation/inline-citation
|
|
4
|
+
import { cn } from "../../../../lib/utils";
|
|
5
|
+
import { InlineCitation, InlineCitationLink } from "../inline-citation/inline-citation";
|
|
6
6
|
const Sources = ({ className, title, children, collapsible = false, defaultOpen = false, open, onOpenChange, ...props })=>{
|
|
7
7
|
const hideTitle = title === false || title === 'false';
|
|
8
8
|
const titleNode = title === undefined || title === true ? /*#__PURE__*/ _jsx(SourcesTitle, {}) : title;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/ui/core/sources/sources.tsx"],"sourcesContent":["import type { ComponentProps, ReactNode } from 'react';\n\nimport { Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible';\nimport { IconChevronDown, IconMist } from '@tabler/icons-react';\n\nimport { cn } from '../../../../lib/utils';\nimport {\n InlineCitation,\n InlineCitationLink,\n} from '../inline-citation/inline-citation';\n\ntype SourcesProps = Omit<ComponentProps<'div'>, 'title'> & {\n title?: ReactNode | boolean;\n collapsible?: boolean;\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n};\n\nconst Sources = ({\n className,\n title,\n children,\n collapsible = false,\n defaultOpen = false,\n open,\n onOpenChange,\n ...props\n}: SourcesProps): ReactNode => {\n const hideTitle = title === false || title === 'false';\n const titleNode =\n title === undefined || title === true ? <SourcesTitle /> : title;\n\n if (collapsible) {\n return (\n <CollapsiblePrimitive.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n >\n <div\n data-slot=\"sources\"\n className={cn('flex flex-col gap-2 py-2', className)}\n {...props}\n >\n {!hideTitle ? (\n <CollapsiblePrimitive.Trigger\n data-slot=\"sources-trigger\"\n className=\"group/sources-trigger flex w-fit items-center gap-2 outline-none\"\n >\n {titleNode}\n <IconChevronDown className=\"size-4 shrink-0 text-muted-foreground transition-transform duration-200 group-data-panel-open/sources-trigger:rotate-180\" />\n </CollapsiblePrimitive.Trigger>\n ) : null}\n <CollapsiblePrimitive.Panel\n data-slot=\"sources-items\"\n className=\"h-(--collapsible-panel-height) overflow-hidden transition-all duration-200 ease-out data-ending-style:h-0 data-starting-style:h-0\"\n >\n <div className=\"flex flex-wrap gap-2 pt-2 [&>*]:min-w-0\">\n {children}\n </div>\n </CollapsiblePrimitive.Panel>\n </div>\n </CollapsiblePrimitive.Root>\n );\n }\n\n return (\n <div\n data-slot=\"sources\"\n className={cn('flex flex-col gap-2 py-2', className)}\n {...props}\n >\n {!hideTitle ? titleNode : null}\n <div\n data-slot=\"sources-items\"\n className=\"flex flex-wrap gap-2 [&>*]:min-w-0\"\n >\n {children}\n </div>\n </div>\n );\n};\n\ntype SourcesTitleProps = ComponentProps<'div'> & {\n title?: string;\n};\n\nconst SourcesTitle = ({\n className,\n title = 'Sources',\n children,\n ...props\n}: SourcesTitleProps): ReactNode => (\n <div\n data-slot=\"sources-title\"\n className={cn(\n 'flex items-center gap-2 text-base leading-5 tracking-tighter text-muted-foreground',\n className\n )}\n {...props}\n >\n <IconMist className=\"size-4 shrink-0\" />\n {children ?? <span>{title}</span>}\n </div>\n);\n\ntype SourceProps = ComponentProps<typeof InlineCitationLink> & {\n title?: string;\n url?: string;\n};\n\nconst Source = ({\n href,\n url,\n title,\n variant = 'decorative-1',\n target = '_blank',\n icon,\n className,\n children,\n ...props\n}: SourceProps): ReactNode => {\n const sourceHref = href || url;\n\n if (!sourceHref) {\n return null;\n }\n\n return (\n <InlineCitation>\n <InlineCitationLink\n data-slot=\"source\"\n href={sourceHref}\n target={target}\n variant={variant}\n icon={icon}\n className={className}\n {...props}\n >\n {children ?? title}\n </InlineCitationLink>\n </InlineCitation>\n );\n};\n\nexport { Source, Sources, SourcesTitle };\n"],"names":["Collapsible","CollapsiblePrimitive","IconChevronDown","IconMist","cn","InlineCitation","InlineCitationLink","Sources","className","title","children","collapsible","defaultOpen","open","onOpenChange","props","hideTitle","titleNode","undefined","SourcesTitle","Root","div","data-slot","Trigger","Panel","span","Source","href","url","variant","target","icon","sourceHref"],"mappings":";AAEA,SAASA,eAAeC,oBAAoB,QAAQ,6BAA6B;AACjF,SAASC,eAAe,EAAEC,QAAQ,QAAQ,sBAAsB;AAEhE,SAASC,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/sources/sources.tsx"],"sourcesContent":["import type { ComponentProps, ReactNode } from 'react';\n\nimport { Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible';\nimport { IconChevronDown, IconMist } from '@tabler/icons-react';\n\nimport { cn } from '../../../../lib/utils';\nimport {\n InlineCitation,\n InlineCitationLink,\n} from '../inline-citation/inline-citation';\n\ntype SourcesProps = Omit<ComponentProps<'div'>, 'title'> & {\n title?: ReactNode | boolean;\n collapsible?: boolean;\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n};\n\nconst Sources = ({\n className,\n title,\n children,\n collapsible = false,\n defaultOpen = false,\n open,\n onOpenChange,\n ...props\n}: SourcesProps): ReactNode => {\n const hideTitle = title === false || title === 'false';\n const titleNode =\n title === undefined || title === true ? <SourcesTitle /> : title;\n\n if (collapsible) {\n return (\n <CollapsiblePrimitive.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n >\n <div\n data-slot=\"sources\"\n className={cn('flex flex-col gap-2 py-2', className)}\n {...props}\n >\n {!hideTitle ? (\n <CollapsiblePrimitive.Trigger\n data-slot=\"sources-trigger\"\n className=\"group/sources-trigger flex w-fit items-center gap-2 outline-none\"\n >\n {titleNode}\n <IconChevronDown className=\"size-4 shrink-0 text-muted-foreground transition-transform duration-200 group-data-panel-open/sources-trigger:rotate-180\" />\n </CollapsiblePrimitive.Trigger>\n ) : null}\n <CollapsiblePrimitive.Panel\n data-slot=\"sources-items\"\n className=\"h-(--collapsible-panel-height) overflow-hidden transition-all duration-200 ease-out data-ending-style:h-0 data-starting-style:h-0\"\n >\n <div className=\"flex flex-wrap gap-2 pt-2 [&>*]:min-w-0\">\n {children}\n </div>\n </CollapsiblePrimitive.Panel>\n </div>\n </CollapsiblePrimitive.Root>\n );\n }\n\n return (\n <div\n data-slot=\"sources\"\n className={cn('flex flex-col gap-2 py-2', className)}\n {...props}\n >\n {!hideTitle ? titleNode : null}\n <div\n data-slot=\"sources-items\"\n className=\"flex flex-wrap gap-2 [&>*]:min-w-0\"\n >\n {children}\n </div>\n </div>\n );\n};\n\ntype SourcesTitleProps = ComponentProps<'div'> & {\n title?: string;\n};\n\nconst SourcesTitle = ({\n className,\n title = 'Sources',\n children,\n ...props\n}: SourcesTitleProps): ReactNode => (\n <div\n data-slot=\"sources-title\"\n className={cn(\n 'flex items-center gap-2 text-base leading-5 tracking-tighter text-muted-foreground',\n className\n )}\n {...props}\n >\n <IconMist className=\"size-4 shrink-0\" />\n {children ?? <span>{title}</span>}\n </div>\n);\n\ntype SourceProps = ComponentProps<typeof InlineCitationLink> & {\n title?: string;\n url?: string;\n};\n\nconst Source = ({\n href,\n url,\n title,\n variant = 'decorative-1',\n target = '_blank',\n icon,\n className,\n children,\n ...props\n}: SourceProps): ReactNode => {\n const sourceHref = href || url;\n\n if (!sourceHref) {\n return null;\n }\n\n return (\n <InlineCitation>\n <InlineCitationLink\n data-slot=\"source\"\n href={sourceHref}\n target={target}\n variant={variant}\n icon={icon}\n className={className}\n {...props}\n >\n {children ?? title}\n </InlineCitationLink>\n </InlineCitation>\n );\n};\n\nexport { Source, Sources, SourcesTitle };\n"],"names":["Collapsible","CollapsiblePrimitive","IconChevronDown","IconMist","cn","InlineCitation","InlineCitationLink","Sources","className","title","children","collapsible","defaultOpen","open","onOpenChange","props","hideTitle","titleNode","undefined","SourcesTitle","Root","div","data-slot","Trigger","Panel","span","Source","href","url","variant","target","icon","sourceHref"],"mappings":";AAEA,SAASA,eAAeC,oBAAoB,QAAQ,6BAA6B;AACjF,SAASC,eAAe,EAAEC,QAAQ,QAAQ,sBAAsB;AAEhE,SAASC,EAAE,QAAQ,wBAAwB;AAC3C,SACEC,cAAc,EACdC,kBAAkB,QACb,qCAAqC;AAU5C,MAAMC,UAAU,CAAC,EACfC,SAAS,EACTC,KAAK,EACLC,QAAQ,EACRC,cAAc,KAAK,EACnBC,cAAc,KAAK,EACnBC,IAAI,EACJC,YAAY,EACZ,GAAGC,OACU;IACb,MAAMC,YAAYP,UAAU,SAASA,UAAU;IAC/C,MAAMQ,YACJR,UAAUS,aAAaT,UAAU,qBAAO,KAACU,oBAAkBV;IAE7D,IAAIE,aAAa;QACf,qBACE,KAACV,qBAAqBmB,IAAI;YACxBP,MAAMA;YACND,aAAaA;YACbE,cAAcA;sBAEd,cAAA,MAACO;gBACCC,aAAU;gBACVd,WAAWJ,GAAG,4BAA4BI;gBACzC,GAAGO,KAAK;;oBAER,CAACC,0BACA,MAACf,qBAAqBsB,OAAO;wBAC3BD,aAAU;wBACVd,WAAU;;4BAETS;0CACD,KAACf;gCAAgBM,WAAU;;;yBAE3B;kCACJ,KAACP,qBAAqBuB,KAAK;wBACzBF,aAAU;wBACVd,WAAU;kCAEV,cAAA,KAACa;4BAAIb,WAAU;sCACZE;;;;;;IAMb;IAEA,qBACE,MAACW;QACCC,aAAU;QACVd,WAAWJ,GAAG,4BAA4BI;QACzC,GAAGO,KAAK;;YAER,CAACC,YAAYC,YAAY;0BAC1B,KAACI;gBACCC,aAAU;gBACVd,WAAU;0BAETE;;;;AAIT;AAMA,MAAMS,eAAe,CAAC,EACpBX,SAAS,EACTC,QAAQ,SAAS,EACjBC,QAAQ,EACR,GAAGK,OACe,iBAClB,MAACM;QACCC,aAAU;QACVd,WAAWJ,GACT,sFACAI;QAED,GAAGO,KAAK;;0BAET,KAACZ;gBAASK,WAAU;;YACnBE,0BAAY,KAACe;0BAAMhB;;;;AASxB,MAAMiB,SAAS,CAAC,EACdC,IAAI,EACJC,GAAG,EACHnB,KAAK,EACLoB,UAAU,cAAc,EACxBC,SAAS,QAAQ,EACjBC,IAAI,EACJvB,SAAS,EACTE,QAAQ,EACR,GAAGK,OACS;IACZ,MAAMiB,aAAaL,QAAQC;IAE3B,IAAI,CAACI,YAAY;QACf,OAAO;IACT;IAEA,qBACE,KAAC3B;kBACC,cAAA,KAACC;YACCgB,aAAU;YACVK,MAAMK;YACNF,QAAQA;YACRD,SAASA;YACTE,MAAMA;YACNvB,WAAWA;YACV,GAAGO,KAAK;sBAERL,YAAYD;;;AAIrB;AAEA,SAASiB,MAAM,EAAEnB,OAAO,EAAEY,YAAY,GAAG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { cn } from "../../../../lib/utils
|
|
3
|
+
import { cn } from "../../../../lib/utils";
|
|
4
4
|
/** Muted status line, such as "Showing 1–10 of 243". An `<output>`, so changes are announced. */ const StatusText = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>{
|
|
5
5
|
return /*#__PURE__*/ _jsx("output", {
|
|
6
6
|
ref: ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/ui/core/status-text/status-text.tsx"],"sourcesContent":["import {\n type ComponentProps,\n type ComponentRef,\n type ForwardRefExoticComponent,\n type RefAttributes,\n forwardRef,\n} from 'react';\n\nimport { cn } from '../../../../lib/utils';\n\n/** Muted status line, such as \"Showing 1–10 of 243\". An `<output>`, so changes are announced. */\nconst StatusText: ForwardRefExoticComponent<\n ComponentProps<'output'> & RefAttributes<HTMLOutputElement>\n> = forwardRef<ComponentRef<'output'>, ComponentProps<'output'>>(\n ({ className, ...props }, ref) => {\n return (\n <output\n ref={ref}\n className={cn(\n 'flex items-center text-sm leading-4.5 tracking-tight font-normal text-muted-foreground',\n className\n )}\n {...props}\n />\n );\n }\n);\nStatusText.displayName = 'StatusText';\n\nexport { StatusText };\n"],"names":["forwardRef","cn","StatusText","className","props","ref","output","displayName"],"mappings":";AAAA,SAKEA,UAAU,QACL,QAAQ;AAEf,SAASC,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/ui/core/status-text/status-text.tsx"],"sourcesContent":["import {\n type ComponentProps,\n type ComponentRef,\n type ForwardRefExoticComponent,\n type RefAttributes,\n forwardRef,\n} from 'react';\n\nimport { cn } from '../../../../lib/utils';\n\n/** Muted status line, such as \"Showing 1–10 of 243\". An `<output>`, so changes are announced. */\nconst StatusText: ForwardRefExoticComponent<\n ComponentProps<'output'> & RefAttributes<HTMLOutputElement>\n> = forwardRef<ComponentRef<'output'>, ComponentProps<'output'>>(\n ({ className, ...props }, ref) => {\n return (\n <output\n ref={ref}\n className={cn(\n 'flex items-center text-sm leading-4.5 tracking-tight font-normal text-muted-foreground',\n className\n )}\n {...props}\n />\n );\n }\n);\nStatusText.displayName = 'StatusText';\n\nexport { StatusText };\n"],"names":["forwardRef","cn","StatusText","className","props","ref","output","displayName"],"mappings":";AAAA,SAKEA,UAAU,QACL,QAAQ;AAEf,SAASC,EAAE,QAAQ,wBAAwB;AAE3C,+FAA+F,GAC/F,MAAMC,2BAEFF,WACF,CAAC,EAAEG,SAAS,EAAE,GAAGC,OAAO,EAAEC;IACxB,qBACE,KAACC;QACCD,KAAKA;QACLF,WAAWF,GACT,0FACAE;QAED,GAAGC,KAAK;;AAGf;AAEFF,WAAWK,WAAW,GAAG;AAEzB,SAASL,UAAU,GAAG"}
|