@uselets/ui 2.0.0 → 2.0.2
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/{as-child-Dxg3Xo1G.d.ts → as-child-T9W73ZYU.d.ts} +1 -3
- package/dist/{chart-B_6nC_ih.d.ts → chart-8rgtsk95.d.ts} +1 -3
- package/dist/cli/uselets.mjs.map +1 -1
- package/dist/components/accordion.d.ts +1 -3
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/alert-dialog.d.ts +5 -5
- package/dist/components/alert-dialog.js +1 -1
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.d.ts +0 -2
- package/dist/components/alert.js.map +1 -1
- package/dist/components/anchor.d.ts +1 -3
- package/dist/components/anchor.js.map +1 -1
- package/dist/components/area-chart.d.ts +1 -3
- package/dist/components/area-chart.js.map +1 -1
- package/dist/components/avatar.d.ts +1 -3
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.d.ts +1 -3
- package/dist/components/badge.js.map +1 -1
- package/dist/components/bar-chart.d.ts +1 -3
- package/dist/components/bar-chart.js.map +1 -1
- package/dist/components/bottom-nav.d.ts +1 -3
- package/dist/components/bottom-nav.js.map +1 -1
- package/dist/components/breadcrumb.d.ts +1 -3
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button-group.d.ts +1 -3
- package/dist/components/button-group.js.map +1 -1
- package/dist/components/button.d.ts +1 -3
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar.d.ts +0 -2
- package/dist/components/calendar.js +1 -1
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/card.d.ts +0 -2
- package/dist/components/card.js.map +1 -1
- package/dist/components/carousel.d.ts +0 -2
- package/dist/components/carousel.js.map +1 -1
- package/dist/components/center.d.ts +0 -2
- package/dist/components/center.js.map +1 -1
- package/dist/components/chart.d.ts +1 -1
- package/dist/components/chart.js.map +1 -1
- package/dist/components/checkbox.d.ts +0 -2
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/code.d.ts +0 -2
- package/dist/components/code.js.map +1 -1
- package/dist/components/collapsible.d.ts +1 -3
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.d.ts +1 -3
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.d.ts +0 -2
- package/dist/components/command.js.map +1 -1
- package/dist/components/container.d.ts +0 -2
- package/dist/components/container.js.map +1 -1
- package/dist/components/data-table.d.ts +0 -2
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-range-picker.d.ts +0 -2
- package/dist/components/date-range-picker.js.map +1 -1
- package/dist/components/dialog.d.ts +5 -5
- package/dist/components/dialog.js +1 -1
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/direction.d.ts +0 -2
- package/dist/components/donut-chart.d.ts +0 -2
- package/dist/components/donut-chart.js.map +1 -1
- package/dist/components/drawer.d.ts +2 -4
- package/dist/components/drawer.js +1 -1
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.d.ts +1 -3
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/dropzone.d.ts +0 -2
- package/dist/components/dropzone.js.map +1 -1
- package/dist/components/empty.d.ts +0 -2
- package/dist/components/empty.js.map +1 -1
- package/dist/components/field.d.ts +0 -2
- package/dist/components/field.js.map +1 -1
- package/dist/components/flex.d.ts +0 -2
- package/dist/components/flex.js.map +1 -1
- package/dist/components/grid.d.ts +0 -2
- package/dist/components/grid.js.map +1 -1
- package/dist/components/group.d.ts +0 -2
- package/dist/components/group.js.map +1 -1
- package/dist/components/heading.d.ts +1 -3
- package/dist/components/heading.js.map +1 -1
- package/dist/components/hover-card.d.ts +1 -3
- package/dist/components/hover-card.js.map +1 -1
- package/dist/components/input-group.d.ts +0 -2
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input-otp.d.ts +0 -2
- package/dist/components/input-otp.js.map +1 -1
- package/dist/components/input.d.ts +0 -2
- package/dist/components/input.js.map +1 -1
- package/dist/components/kbd.d.ts +0 -2
- package/dist/components/kbd.js.map +1 -1
- package/dist/components/label.d.ts +1 -3
- package/dist/components/label.js.map +1 -1
- package/dist/components/list.d.ts +1 -3
- package/dist/components/list.js.map +1 -1
- package/dist/components/logo.d.ts +0 -2
- package/dist/components/marker.d.ts +1 -3
- package/dist/components/marker.js.map +1 -1
- package/dist/components/mask-input.d.ts +0 -2
- package/dist/components/mask-input.js.map +1 -1
- package/dist/components/native-select.d.ts +0 -2
- package/dist/components/native-select.js.map +1 -1
- package/dist/components/navigation-menu.d.ts +1 -3
- package/dist/components/navigation-menu.js.map +1 -1
- package/dist/components/number-field.d.ts +1 -3
- package/dist/components/number-field.js.map +1 -1
- package/dist/components/pagination.d.ts +0 -2
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/phone-input.d.ts +0 -2
- package/dist/components/phone-input.js.map +1 -1
- package/dist/components/pie-chart.d.ts +1 -3
- package/dist/components/pie-chart.js.map +1 -1
- package/dist/components/popover.d.ts +1 -3
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress.d.ts +0 -2
- package/dist/components/progress.js.map +1 -1
- package/dist/components/radio-group.d.ts +0 -2
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/resizable.d.ts +0 -2
- package/dist/components/resizable.js.map +1 -1
- package/dist/components/ring-progress.d.ts +0 -2
- package/dist/components/ring-progress.js.map +1 -1
- package/dist/components/scroll-area.d.ts +0 -2
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/select.d.ts +1 -3
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.d.ts +1 -3
- package/dist/components/separator.js.map +1 -1
- package/dist/components/sidebar.d.ts +1 -3
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/simple-grid.d.ts +0 -2
- package/dist/components/simple-grid.js.map +1 -1
- package/dist/components/skeleton.d.ts +0 -2
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/slider.d.ts +0 -2
- package/dist/components/slider.js.map +1 -1
- package/dist/components/sonner.d.ts +0 -2
- package/dist/components/sonner.js.map +1 -1
- package/dist/components/spinner.d.ts +0 -2
- package/dist/components/spinner.js.map +1 -1
- package/dist/components/stack.d.ts +0 -2
- package/dist/components/stack.js.map +1 -1
- package/dist/components/stepper.d.ts +1 -3
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/switch.d.ts +0 -2
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.d.ts +0 -2
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.d.ts +1 -3
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/text.d.ts +1 -3
- package/dist/components/text.js.map +1 -1
- package/dist/components/textarea.d.ts +0 -2
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/theme.d.ts +0 -2
- package/dist/components/theme.js.map +1 -1
- package/dist/components/timeline.d.ts +0 -2
- package/dist/components/timeline.js.map +1 -1
- package/dist/components/toggle-group.d.ts +1 -3
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle.d.ts +1 -3
- package/dist/components/toggle.js.map +1 -1
- package/dist/components/tooltip.d.ts +1 -3
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/unstyled-button.d.ts +1 -3
- package/dist/components/unstyled-button.js.map +1 -1
- package/dist/components/visibility.d.ts +0 -2
- package/dist/components/visibility.js.map +1 -1
- package/dist/hooks/use-breakpoint-value.d.ts +0 -2
- package/dist/hooks/use-breakpoint-value.js.map +1 -1
- package/dist/hooks/use-breakpoint.d.ts +0 -2
- package/dist/hooks/use-breakpoint.js.map +1 -1
- package/dist/hooks/use-disclosure.d.ts +0 -2
- package/dist/hooks/use-disclosure.js.map +1 -1
- package/dist/hooks/use-document-visibility.d.ts +0 -2
- package/dist/hooks/use-document-visibility.js.map +1 -1
- package/dist/hooks/use-hotkeys.d.ts +1 -1
- package/dist/hooks/use-idle.d.ts +0 -2
- package/dist/hooks/use-idle.js.map +1 -1
- package/dist/hooks/use-interval.d.ts +0 -2
- package/dist/hooks/use-interval.js.map +1 -1
- package/dist/hooks/use-local-storage.d.ts +0 -2
- package/dist/hooks/use-local-storage.js.map +1 -1
- package/dist/hooks/use-mask.d.ts +0 -2
- package/dist/hooks/use-mask.js.map +1 -1
- package/dist/hooks/use-mobile.d.ts +0 -2
- package/dist/hooks/use-mobile.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/lib/as-child.d.ts +1 -1
- package/dist/lib/as-child.js.map +1 -1
- package/dist/lib/badge.d.ts +0 -2
- package/dist/lib/badge.js.map +1 -1
- package/dist/lib/button.d.ts +0 -2
- package/dist/lib/button.js.map +1 -1
- package/dist/lib/color.d.ts +0 -2
- package/dist/lib/color.js.map +1 -1
- package/dist/lib/compose-refs.d.ts +0 -2
- package/dist/lib/compose-refs.js.map +1 -1
- package/dist/lib/progress.d.ts +0 -2
- package/dist/lib/progress.js.map +1 -1
- package/dist/lib/utils.d.ts +0 -2
- package/dist/lib/utils.js.map +1 -1
- package/dist/logo--R3_XDgA.js.map +1 -1
- package/dist/postcss.config.js.map +1 -1
- package/dist/resolve-class-name-BurP8ngI.js.map +1 -1
- package/dist/skills/uselets-ui/references/component-catalog.md +3 -3
- package/dist/{use-hotkeys-D1_TEIwN.d.ts → use-hotkeys-BVm0IGb8.d.ts} +1 -5
- package/dist/use-hotkeys-YDJmGWX6.js.map +1 -1
- package/package.json +9 -9
- package/skills/uselets-ui/references/component-catalog.md +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.js","names":["React","RechartsPrimitive","THEMES","CHART_COLOR_KEYS","value","DEFAULT_CHART_PALETTE","ChartContext","context","props","uniqueId","chartId","id","cn","className","colorConfig","config","styles","theme","prefix","key","itemConfig","color","ChartTooltip","tooltipLabel","hideLabel","payload","item","labelKey","label","labelFormatter","labelClassName","active","nestLabel","indicator","nameKey","indicatorColor","formatter","index","Fragment","hideIndicator","ChartLegend","verticalAlign","hideIcon","payloadPayload","configLabelKey"],"sources":["../../src/components/chart.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport * as RechartsPrimitive from 'recharts'\n\nimport { cn } from '../lib/utils'\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: '', dark: '.dark' } as const\n\nexport type ChartColorKey =\n | 'primary'\n | 'brand'\n | 'gray'\n | 'zinc'\n | 'red'\n | 'yellow'\n | 'green'\n | 'blue'\n | 'indigo'\n | 'pink'\n\nconst CHART_COLOR_KEYS: readonly ChartColorKey[] = [\n 'primary',\n 'brand',\n 'gray',\n 'zinc',\n 'red',\n 'yellow',\n 'green',\n 'blue',\n 'indigo',\n 'pink'\n]\n\nexport function resolveChartColor(value: string | undefined): string | undefined {\n if (!value) return undefined\n if ((CHART_COLOR_KEYS as readonly string[]).includes(value)) {\n return `var(--${value})`\n }\n return value\n}\n\nexport const DEFAULT_CHART_PALETTE = [\n 'var(--chart-1)',\n 'var(--chart-2)',\n 'var(--chart-3)',\n 'var(--chart-4)',\n 'var(--chart-5)'\n] as const\n\nexport type ChartConfig = {\n [k in string]: {\n label?: React.ReactNode\n icon?: React.ComponentType\n } & ({ color?: string; theme?: never } | { color?: never; theme: Record<keyof typeof THEMES, string> })\n}\n\ntype ChartContextProps = {\n config: ChartConfig\n}\n\nexport type ChartContainerProps = React.ComponentProps<'div'> & {\n config: ChartConfig\n children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children']\n}\n\nexport type ChartStyleProps = {\n id: string\n config: ChartConfig\n}\n\nexport type ChartTooltipProps = React.ComponentProps<typeof RechartsPrimitive.Tooltip>\n\nexport type ChartTooltipContentProps = Partial<\n RechartsPrimitive.DefaultTooltipContentProps<number | string | Array<number | string>, number | string>\n> &\n Omit<React.ComponentProps<'div'>, 'formatter'> & {\n active?: boolean\n color?: string\n hideLabel?: boolean\n hideIndicator?: boolean\n indicator?: 'line' | 'dot' | 'dashed'\n nameKey?: string\n labelKey?: string\n }\n\nexport type ChartLegendProps = React.ComponentProps<typeof RechartsPrimitive.Legend>\n\nexport type ChartLegendContentProps = React.ComponentProps<'div'> &\n Pick<RechartsPrimitive.DefaultLegendContentProps, 'payload' | 'verticalAlign'> & {\n hideIcon?: boolean\n nameKey?: string\n }\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null)\n\nfunction useChart() {\n const context = React.useContext(ChartContext)\n\n if (!context) {\n throw new Error('useChart must be used within a <ChartContainer />')\n }\n\n return context\n}\n\nfunction ChartContainer({ id, className, children, config, ...props }: ChartContainerProps) {\n const uniqueId = React.useId()\n const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`\n\n return (\n <ChartContext.Provider value={{ config }}>\n <div\n data-slot=\"chart\"\n data-chart={chartId}\n className={cn(\n \"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden\",\n className\n )}\n {...props}\n >\n <RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n )\n}\n\nconst ChartStyle = ({ id, config }: ChartStyleProps) => {\n const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color)\n\n if (!colorConfig.length) {\n return null\n }\n\n const styles = Object.entries(THEMES)\n .map(\n ([theme, prefix]) => `\n${prefix} [data-chart=${id}] {\n${colorConfig\n .map(([key, itemConfig]) => {\n const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || itemConfig.color\n return color ? ` --color-${key}: ${color};` : null\n })\n .join('\\n')}\n}\n`\n )\n .join('\\n')\n\n return <style>{styles}</style>\n}\n\nconst ChartTooltip = RechartsPrimitive.Tooltip\n\nfunction ChartTooltipContent({\n active,\n payload,\n className,\n indicator = 'dot',\n hideLabel = false,\n hideIndicator = false,\n label,\n labelFormatter,\n labelClassName,\n formatter,\n color,\n nameKey,\n labelKey\n}: ChartTooltipContentProps) {\n const { config } = useChart()\n\n const tooltipLabel = React.useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null\n }\n\n const [item] = payload\n const key = `${labelKey || item?.dataKey || item?.name || 'value'}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n const value =\n !labelKey && typeof label === 'string' ? config[label as keyof typeof config]?.label || label : itemConfig?.label\n\n if (labelFormatter) {\n return <div className={cn('font-medium', labelClassName)}>{labelFormatter(value, payload)}</div>\n }\n\n if (!value) {\n return null\n }\n\n return <div className={cn('font-medium', labelClassName)}>{value}</div>\n }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey])\n\n if (!active || !payload?.length) {\n return null\n }\n\n const nestLabel = payload.length === 1 && indicator !== 'dot'\n\n return (\n <div\n className={cn(\n 'grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl',\n className\n )}\n >\n {!nestLabel ? tooltipLabel : null}\n <div className=\"grid gap-1.5\">\n {payload\n .filter((item) => item.type !== 'none')\n .map((item, index) => {\n const key = `${nameKey || item.name || item.dataKey || 'value'}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n const indicatorColor = color || item.payload.fill || item.color\n\n return (\n <div\n key={String(item.dataKey)}\n className={cn(\n 'flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground',\n indicator === 'dot' && 'items-center'\n )}\n >\n {formatter && item?.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, item.payload)\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n <div\n className={cn('shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)', {\n 'h-2.5 w-2.5': indicator === 'dot',\n 'w-1': indicator === 'line',\n 'w-0 border-[1.5px] border-dashed bg-transparent': indicator === 'dashed',\n 'my-0.5': nestLabel && indicator === 'dashed'\n })}\n style={\n {\n '--color-bg': indicatorColor,\n '--color-border': indicatorColor\n } as React.CSSProperties\n }\n />\n )\n )}\n <div\n className={cn(\n 'flex flex-1 justify-between leading-none',\n nestLabel ? 'items-end' : 'items-center'\n )}\n >\n <div className=\"grid gap-1.5\">\n {nestLabel ? tooltipLabel : null}\n <span className=\"text-muted-foreground\">{itemConfig?.label || item.name}</span>\n </div>\n {item.value && (\n <span className=\"font-mono font-medium text-foreground tabular-nums\">\n {item.value.toLocaleString()}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n )\n })}\n </div>\n </div>\n )\n}\n\nconst ChartLegend = RechartsPrimitive.Legend\n\nfunction ChartLegendContent({\n className,\n hideIcon = false,\n payload,\n verticalAlign = 'bottom',\n nameKey\n}: ChartLegendContentProps) {\n const { config } = useChart()\n\n if (!payload?.length) {\n return null\n }\n\n return (\n <div\n className={cn(\n 'flex items-center justify-center flex-wrap gap-2',\n verticalAlign === 'top' ? 'pb-3' : 'pt-3',\n className\n )}\n >\n {payload\n .filter((item) => item.type !== 'none')\n .map((item) => {\n const key = `${nameKey || item.dataKey || 'value'}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n\n return (\n <div\n key={item.value}\n className={cn('flex items-center gap-1 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground')}\n >\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div\n className=\"h-3 w-3 shrink-0 rounded-[2px]\"\n style={{\n backgroundColor: item.color\n }}\n />\n )}\n {itemConfig?.label}\n </div>\n )\n })}\n </div>\n )\n}\n\nfunction getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {\n if (typeof payload !== 'object' || payload === null) {\n return undefined\n }\n\n const payloadPayload =\n 'payload' in payload && typeof payload.payload === 'object' && payload.payload !== null\n ? payload.payload\n : undefined\n\n let configLabelKey: string = key\n\n if (key in payload && typeof payload[key as keyof typeof payload] === 'string') {\n configLabelKey = payload[key as keyof typeof payload] as string\n } else if (\n payloadPayload &&\n key in payloadPayload &&\n typeof payloadPayload[key as keyof typeof payloadPayload] === 'string'\n ) {\n configLabelKey = payloadPayload[key as keyof typeof payloadPayload] as string\n }\n\n return configLabelKey in config ? config[configLabelKey] : config[key as keyof typeof config]\n}\n\nexport {\n CHART_COLOR_KEYS,\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartStyle,\n ChartTooltip,\n ChartTooltipContent\n}\n"],"mappings":"gMAOA,MAAME,EAAS,CAAE,MAAO,GAAI,KAAM,OAAQ,EAcpCC,EAA6C,CACjD,UACA,QACA,OACA,OACA,MACA,SACA,QACA,OACA,SACA,MACF,EAEA,SAAgB,kBAAkB,EAA+C,CAC/E,GAAKC,EAIL,OAHKD,EAAuC,SAASC,CAAK,EACjD,SAASA,EAAM,GAEjBA,CACT,CAEA,MAAaC,EAAwB,CACnC,iBACA,iBACA,iBACA,iBACA,gBACF,EA8CMC,EAAeN,EAAM,cAAwC,IAAI,EAEvE,SAAS,UAAW,CAClB,IAAMO,EAAUP,EAAM,WAAWM,CAAY,EAE7C,GAAI,CAACC,EACH,MAAU,MAAM,mDAAmD,EAGrE,OAAOA,CACT,CAEA,SAAS,eAAe,CAAE,KAAI,YAAW,WAAU,SAAQ,GAAGC,GAA8B,CAC1F,IAAMC,EAAWT,EAAM,MAAM,EACvBU,EAAU,SAASC,GAAMF,EAAS,QAAQ,KAAM,EAAE,IAExD,MACE,kBAACH,EAAa,SAAd,CAAuB,MAAO,CAAE,QAAO,EACrC,SAAA,kBAAC,MAAD,CACE,YAAU,QACV,aAAYI,EACZ,UAAWE,EACT,8pBACAC,CACF,EACA,GAAIL,EAEJ,SAAA,kBAACP,EAAkB,oBAAnB,CAAwC,UAAg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wC,WAE9D,EAAiBwB,EAAexB,IAG3ByB,KAAkB7B,EAASA,EAAO6B,GAAkB7B,EAAOI,EACpE"}
|
|
1
|
+
{"version":3,"file":"chart.js","names":["React","RechartsPrimitive","THEMES","CHART_COLOR_KEYS","value","DEFAULT_CHART_PALETTE","ChartContext","context","props","uniqueId","chartId","id","cn","className","colorConfig","config","styles","theme","prefix","key","itemConfig","color","ChartTooltip","tooltipLabel","hideLabel","payload","item","labelKey","label","labelFormatter","labelClassName","active","nestLabel","indicator","nameKey","indicatorColor","formatter","index","Fragment","hideIndicator","ChartLegend","verticalAlign","hideIcon","payloadPayload","configLabelKey"],"sources":["../../src/components/chart.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport * as RechartsPrimitive from 'recharts'\n\nimport { cn } from '../lib/utils'\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: '', dark: '.dark' } as const\n\nexport type ChartColorKey =\n | 'primary'\n | 'brand'\n | 'gray'\n | 'zinc'\n | 'red'\n | 'yellow'\n | 'green'\n | 'blue'\n | 'indigo'\n | 'pink'\n\nconst CHART_COLOR_KEYS: readonly ChartColorKey[] = [\n 'primary',\n 'brand',\n 'gray',\n 'zinc',\n 'red',\n 'yellow',\n 'green',\n 'blue',\n 'indigo',\n 'pink'\n]\n\nexport function resolveChartColor(value: string | undefined): string | undefined {\n if (!value) return undefined\n if ((CHART_COLOR_KEYS as readonly string[]).includes(value)) {\n return `var(--${value})`\n }\n return value\n}\n\nexport const DEFAULT_CHART_PALETTE = [\n 'var(--chart-1)',\n 'var(--chart-2)',\n 'var(--chart-3)',\n 'var(--chart-4)',\n 'var(--chart-5)'\n] as const\n\nexport type ChartConfig = {\n [k in string]: {\n label?: React.ReactNode\n icon?: React.ComponentType\n } & ({ color?: string; theme?: never } | { color?: never; theme: Record<keyof typeof THEMES, string> })\n}\n\ntype ChartContextProps = {\n config: ChartConfig\n}\n\nexport type ChartContainerProps = React.ComponentProps<'div'> & {\n config: ChartConfig\n children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children']\n}\n\nexport type ChartStyleProps = {\n id: string\n config: ChartConfig\n}\n\nexport type ChartTooltipProps = React.ComponentProps<typeof RechartsPrimitive.Tooltip>\n\nexport type ChartTooltipContentProps = Partial<\n RechartsPrimitive.DefaultTooltipContentProps<number | string | Array<number | string>, number | string>\n> &\n Omit<React.ComponentProps<'div'>, 'formatter'> & {\n active?: boolean\n color?: string\n hideLabel?: boolean\n hideIndicator?: boolean\n indicator?: 'line' | 'dot' | 'dashed'\n nameKey?: string\n labelKey?: string\n }\n\nexport type ChartLegendProps = React.ComponentProps<typeof RechartsPrimitive.Legend>\n\nexport type ChartLegendContentProps = React.ComponentProps<'div'> &\n Pick<RechartsPrimitive.DefaultLegendContentProps, 'payload' | 'verticalAlign'> & {\n hideIcon?: boolean\n nameKey?: string\n }\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null)\n\nfunction useChart() {\n const context = React.useContext(ChartContext)\n\n if (!context) {\n throw new Error('useChart must be used within a <ChartContainer />')\n }\n\n return context\n}\n\nfunction ChartContainer({ id, className, children, config, ...props }: ChartContainerProps) {\n const uniqueId = React.useId()\n const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`\n\n return (\n <ChartContext.Provider value={{ config }}>\n <div\n data-slot=\"chart\"\n data-chart={chartId}\n className={cn(\n \"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden\",\n className\n )}\n {...props}\n >\n <RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n )\n}\n\nconst ChartStyle = ({ id, config }: ChartStyleProps) => {\n const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color)\n\n if (!colorConfig.length) {\n return null\n }\n\n const styles = Object.entries(THEMES)\n .map(\n ([theme, prefix]) => `\n${prefix} [data-chart=${id}] {\n${colorConfig\n .map(([key, itemConfig]) => {\n const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || itemConfig.color\n return color ? ` --color-${key}: ${color};` : null\n })\n .join('\\n')}\n}\n`\n )\n .join('\\n')\n\n return <style>{styles}</style>\n}\n\nconst ChartTooltip = RechartsPrimitive.Tooltip\n\nfunction ChartTooltipContent({\n active,\n payload,\n className,\n indicator = 'dot',\n hideLabel = false,\n hideIndicator = false,\n label,\n labelFormatter,\n labelClassName,\n formatter,\n color,\n nameKey,\n labelKey\n}: ChartTooltipContentProps) {\n const { config } = useChart()\n\n const tooltipLabel = React.useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null\n }\n\n const [item] = payload\n const key = `${labelKey || item?.dataKey || item?.name || 'value'}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n const value =\n !labelKey && typeof label === 'string' ? config[label as keyof typeof config]?.label || label : itemConfig?.label\n\n if (labelFormatter) {\n return <div className={cn('font-medium', labelClassName)}>{labelFormatter(value, payload)}</div>\n }\n\n if (!value) {\n return null\n }\n\n return <div className={cn('font-medium', labelClassName)}>{value}</div>\n }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey])\n\n if (!active || !payload?.length) {\n return null\n }\n\n const nestLabel = payload.length === 1 && indicator !== 'dot'\n\n return (\n <div\n className={cn(\n 'grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl',\n className\n )}\n >\n {!nestLabel ? tooltipLabel : null}\n <div className=\"grid gap-1.5\">\n {payload\n .filter((item) => item.type !== 'none')\n .map((item, index) => {\n const key = `${nameKey || item.name || item.dataKey || 'value'}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n const indicatorColor = color || item.payload.fill || item.color\n\n return (\n <div\n key={String(item.dataKey)}\n className={cn(\n 'flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground',\n indicator === 'dot' && 'items-center'\n )}\n >\n {formatter && item?.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, item.payload)\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n <div\n className={cn('shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)', {\n 'h-2.5 w-2.5': indicator === 'dot',\n 'w-1': indicator === 'line',\n 'w-0 border-[1.5px] border-dashed bg-transparent': indicator === 'dashed',\n 'my-0.5': nestLabel && indicator === 'dashed'\n })}\n style={\n {\n '--color-bg': indicatorColor,\n '--color-border': indicatorColor\n } as React.CSSProperties\n }\n />\n )\n )}\n <div\n className={cn(\n 'flex flex-1 justify-between leading-none',\n nestLabel ? 'items-end' : 'items-center'\n )}\n >\n <div className=\"grid gap-1.5\">\n {nestLabel ? tooltipLabel : null}\n <span className=\"text-muted-foreground\">{itemConfig?.label || item.name}</span>\n </div>\n {item.value && (\n <span className=\"font-mono font-medium text-foreground tabular-nums\">\n {item.value.toLocaleString()}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n )\n })}\n </div>\n </div>\n )\n}\n\nconst ChartLegend = RechartsPrimitive.Legend\n\nfunction ChartLegendContent({\n className,\n hideIcon = false,\n payload,\n verticalAlign = 'bottom',\n nameKey\n}: ChartLegendContentProps) {\n const { config } = useChart()\n\n if (!payload?.length) {\n return null\n }\n\n return (\n <div\n className={cn(\n 'flex items-center justify-center flex-wrap gap-2',\n verticalAlign === 'top' ? 'pb-3' : 'pt-3',\n className\n )}\n >\n {payload\n .filter((item) => item.type !== 'none')\n .map((item) => {\n const key = `${nameKey || item.dataKey || 'value'}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n\n return (\n <div\n key={item.value}\n className={cn('flex items-center gap-1 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground')}\n >\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div\n className=\"h-3 w-3 shrink-0 rounded-[2px]\"\n style={{\n backgroundColor: item.color\n }}\n />\n )}\n {itemConfig?.label}\n </div>\n )\n })}\n </div>\n )\n}\n\nfunction getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {\n if (typeof payload !== 'object' || payload === null) {\n return undefined\n }\n\n const payloadPayload =\n 'payload' in payload && typeof payload.payload === 'object' && payload.payload !== null\n ? payload.payload\n : undefined\n\n let configLabelKey: string = key\n\n if (key in payload && typeof payload[key as keyof typeof payload] === 'string') {\n configLabelKey = payload[key as keyof typeof payload] as string\n } else if (\n payloadPayload &&\n key in payloadPayload &&\n typeof payloadPayload[key as keyof typeof payloadPayload] === 'string'\n ) {\n configLabelKey = payloadPayload[key as keyof typeof payloadPayload] as string\n }\n\n return configLabelKey in config ? config[configLabelKey] : config[key as keyof typeof config]\n}\n\nexport {\n CHART_COLOR_KEYS,\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartStyle,\n ChartTooltip,\n ChartTooltipContent\n}\n"],"mappings":"A,gMAOA,MAAME,EAAS,CAAE,MAAO,GAAI,KAAM,OAAQ,EAcpCC,EAA6C,CACjD,UACA,QACA,OACA,OACA,MACA,SACA,QACA,OACA,SACA,MACF,EAEA,SAAgB,kBAAkB,EAA+C,CAC/E,GAAKC,EAIL,OAHKD,EAAuC,SAASC,CAAK,EACjD,SAASA,EAAM,GAEjBA,CACT,CAEA,MAAaC,EAAwB,CACnC,iBACA,iBACA,iBACA,iBACA,gBACF,EA8CMC,EAAeN,EAAM,cAAwC,IAAI,EAEvE,SAAS,U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ACE,UAAU,iCACV,MAAO,CACL,gBAAiBM,EAAK,KACxB,CACD,CAAA,EAEFN,GAAY,KACV,CAdE,EAAAM,EAAK,KAcP,CAET,CAAC,CACA,CAAA,EApCE,IAsCX,CAEA,SAAS,4BAA4B,EAAqB,EAAkB,EAAa,CACvF,GAAI,OAAOD,GAAY,WAAYA,EACjC,OAGF,IAAMkB,EACJ,YAAalB,GAAW,OAAOA,EAAQ,SAAY,UAAYA,EAAQ,UAAY,KAC/EA,EAAQ,QACR,IAAA,GAEFmB,EAAyBzB,EAY7B,OAVIA,KAAOM,GAAW,OAAOA,EAAQN,IAAiC,SACpE,EAAiBM,EAAQN,GAEzBwB,GACAxB,KAAOwB,GACP,OAAOA,EAAexB,IAAwC,WAE9D,EAAiBwB,EAAexB,IAG3ByB,KAAkB7B,EAASA,EAAO6B,GAAkB7B,EAAOI,EACpE,C"}
|
|
@@ -5,7 +5,6 @@ import * as React from "react";
|
|
|
5
5
|
import { ReactNode } from "react";
|
|
6
6
|
import { VariantProps } from "class-variance-authority";
|
|
7
7
|
import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
|
|
8
|
-
//#region src/components/checkbox.d.ts
|
|
9
8
|
declare const checkboxVariants: (props?: ({
|
|
10
9
|
color?: "blue" | "brand" | "gray" | "green" | "indigo" | "pink" | "primary" | "red" | "yellow" | "zinc" | null | undefined;
|
|
11
10
|
size?: "lg" | "md" | "sm" | null | undefined;
|
|
@@ -26,6 +25,5 @@ export type CheckboxProps = Omit<React.ComponentProps<typeof Checkbox$1.Root>, '
|
|
|
26
25
|
descriptionProps?: Omit<React.ComponentProps<'p'>, 'children'>;
|
|
27
26
|
};
|
|
28
27
|
declare function Checkbox({ className, color, id, label, labelProps, description, descriptionProps, size, 'aria-invalid': ariaInvalid, ...props }: CheckboxProps): React.JSX.Element;
|
|
29
|
-
//#endregion
|
|
30
28
|
export { Checkbox };
|
|
31
29
|
//# sourceMappingURL=checkbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","names":["CheckboxPrimitive","Checkbox$1","checkboxVariants","cva","selectionControlColorVariants","checkboxLabelVariants","checkboxDescriptionVariants","ariaInvalid","props","generatedId","useId","fieldControlId","useFieldControlId","id","invalid","useFieldInvalid","hasLabel","label","resolvedId","labelClassName","labelRootProps","labelProps","descriptionId","hasDescription","description","descriptionClassName","descriptionRootProps","descriptionProps","resolvedDescriptionId","checkbox","color","size","cn","resolveClassName","className","state","IconCheck","IconMinus","Label"],"sources":["../../src/components/checkbox.tsx"],"sourcesContent":["import type * as React from 'react'\nimport { type ReactNode, useId } from 'react'\n\nimport { Checkbox as CheckboxPrimitive } from '@base-ui/react/checkbox'\nimport { IconCheck, IconMinus } from '@tabler/icons-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport type { UIColor } from '../lib/color'\nimport { selectionControlColorVariants } from '../lib/color'\nimport { cn } from '../lib/utils'\nimport { resolveClassName } from '../utils/resolve-class-name'\nimport { useFieldControlId, useFieldInvalid } from './field'\nimport { Label, type LabelProps } from './label'\n\nconst checkboxVariants = cva(\n 'border-input dark:data-unchecked:bg-input/30 data-checked:bg-(--selection-control) data-checked:text-(--selection-control-foreground) data-checked:border-(--selection-control) focus-visible:border-ring focus-visible:ring-ring/50 flex items-center justify-center border transition-colors group-has-disabled/field:opacity-50 focus-visible:ring-3 peer relative shrink-0 outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50',\n {\n variants: {\n color: selectionControlColorVariants,\n size: {\n sm: 'size-3.5 rounded-[3px] [&_[data-slot=checkbox-indicator]>svg]:size-3',\n md: 'size-4 rounded-[4px] [&_[data-slot=checkbox-indicator]>svg]:size-3.5',\n lg: 'size-5 rounded-[5px] [&_[data-slot=checkbox-indicator]>svg]:size-4'\n }\n },\n defaultVariants: {\n color: 'primary',\n size: 'md'\n }\n }\n)\n\nconst checkboxLabelVariants = cva('', {\n variants: {\n size: {\n sm: 'text-xs',\n md: 'text-sm',\n lg: 'text-lg'\n }\n },\n defaultVariants: {\n size: 'md'\n }\n})\n\nconst checkboxDescriptionVariants = cva(\n 'text-muted-foreground text-left leading-normal font-normal [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary',\n {\n variants: {\n size: {\n sm: 'text-xs',\n md: 'text-xs',\n lg: 'text-sm'\n }\n },\n defaultVariants: {\n size: 'md'\n }\n }\n)\n\nexport type CheckboxProps = Omit<React.ComponentProps<typeof CheckboxPrimitive.Root>, 'render'> &\n VariantProps<typeof checkboxVariants> & {\n /**\n * Palette family used when checked.\n * @default 'primary'\n */\n color?: UIColor\n /** Label rendered next to the checkbox and linked to it. */\n label?: ReactNode\n /** Props for the rendered label. */\n labelProps?: Omit<LabelProps, 'children' | 'htmlFor'>\n /** Helper text rendered below the label. */\n description?: ReactNode\n /** Props for the rendered description. */\n descriptionProps?: Omit<React.ComponentProps<'p'>, 'children'>\n }\n\nfunction Checkbox({\n className,\n color = 'primary',\n id,\n label,\n labelProps,\n description,\n descriptionProps,\n size = 'md',\n 'aria-invalid': ariaInvalid,\n ...props\n}: CheckboxProps) {\n const generatedId = useId()\n const fieldControlId = useFieldControlId(id)\n const invalid = useFieldInvalid(ariaInvalid)\n const hasLabel = label !== undefined\n const resolvedId = fieldControlId ?? (hasLabel ? generatedId : undefined)\n const { className: labelClassName, ...labelRootProps } = labelProps ?? {}\n const descriptionId = useId()\n const hasDescription = description !== undefined\n const { className: descriptionClassName, ...descriptionRootProps } = descriptionProps ?? {}\n const resolvedDescriptionId = hasDescription ? (descriptionRootProps.id ?? descriptionId) : undefined\n\n const checkbox = (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n data-color={color}\n data-size={size}\n id={resolvedId}\n aria-describedby={resolvedDescriptionId}\n aria-invalid={invalid}\n className={(state) => cn(checkboxVariants({ color, size }), resolveClassName(className, state))}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n className=\"grid place-content-center text-current transition-none\"\n >\n <IconCheck className=\"block in-data-indeterminate:hidden\" />\n <IconMinus className=\"hidden in-data-indeterminate:block\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n )\n\n if (!hasLabel && !hasDescription) {\n return checkbox\n }\n\n return (\n <div\n data-slot=\"checkbox-field\"\n className=\"grid grid-cols-[auto_1fr] items-center justify-items-start gap-x-2 gap-y-0.5\"\n >\n {checkbox}\n {hasLabel && (\n <Label {...labelRootProps} htmlFor={resolvedId} className={cn(checkboxLabelVariants({ size }), labelClassName)}>\n {label}\n </Label>\n )}\n {hasDescription && (\n <p\n data-slot=\"checkbox-description\"\n {...descriptionRootProps}\n id={resolvedDescriptionId}\n className={cn('col-start-2', checkboxDescriptionVariants({ size }), descriptionClassName)}\n >\n {description}\n </p>\n )}\n </div>\n )\n}\n\nexport { Checkbox }\n"],"mappings":"shBAcA,MAAME,EAAmBC,EACvB,yeACA,CACE,SAAU,CACR,MAAOC,EACP,KAAM,CACJ,GAAI,uEACJ,GAAI,uEACJ,GAAI,oEACN,CACF,EACA,gBAAiB,CACf,MAAO,UACP,KAAM,IACR,CACF,CACF,EAEMC,EAAwBF,EAAI,GAAI,CACpC,SAAU,CACR,KAAM,CACJ,GAAI,UACJ,GAAI,UACJ,GAAI,SACN,CACF,EACA,gBAAiB,CACf,KAAM,IACR,CACF,CAAC,EAEKG,EAA8BH,EAClC,+HACA,CACE,SAAU,CACR,KAAM,CACJ,GAAI,UACJ,GAAI,UACJ,GAAI,SACN,CACF,EACA,gBAAiB,CACf,KAAM,IACR,CACF,CACF,EAmBA,SAAS,SAAS,CAChB,YACA,QAAQ,UACR,KACA,QACA,aACA,cACA,mBACA,OAAO,KACP,eAAgBI,EAChB,GAAGC,GACa,CAChB,IAAMC,EAAcC,EAAM,EACpBC,EAAiBC,EAAkBC,CAAE,EACrCC,EAAUC,EAAgBR,CAAW,EACrCS,EAAWC,IAAU,IAAA,GACrBC,EAAaP,IAAmBK,EAAWP,EAAc,IAAA,IACzD,CAAE,UAAWU,EAAgB,GAAGC,GAAmBC,GAAc,CAAC,EAClEC,EAAgBZ,EAAM,EACtBa,EAAiBC,IAAgB,IAAA,GACjC,CAAE,UAAWC,EAAsB,GAAGC,GAAyBC,GAAoB,CAAC,EACpFC,EAAwBL,EAAkBG,EAAqB,IAAMJ,EAAiB,IAAA,GAEtFO,EACJ,kBAAC7B,EAAkB,KAAnB,CACE,YAAU,WACV,aAAY8B,EACZ,YAAWC,EACX,GAAIb,EACJ,mBAAkBU,EAClB,eAAcd,EACd,UAAY,GAAUkB,EAAG9B,EAAiB,CAAE,QAAO,MAAK,CAAC,EAAG+B,EAAiBC,EAAWC,CAAK,CAAC,EAC9F,GAAI3B,EAEJ,SAAA,kBAACR,EAAkB,UAAnB,CACE,YAAU,qBACV,UAAU,yDAFZ,SAAA,CAIE,kBAACoC,EAAD,CAAW,UAAU,oCAAsC,CAAA,EAC3D,kBAACC,EAAD,CAAW,UAAU,oCAAsC,CAAA,CAChC,
|
|
1
|
+
{"version":3,"file":"checkbox.js","names":["CheckboxPrimitive","Checkbox$1","checkboxVariants","cva","selectionControlColorVariants","checkboxLabelVariants","checkboxDescriptionVariants","ariaInvalid","props","generatedId","useId","fieldControlId","useFieldControlId","id","invalid","useFieldInvalid","hasLabel","label","resolvedId","labelClassName","labelRootProps","labelProps","descriptionId","hasDescription","description","descriptionClassName","descriptionRootProps","descriptionProps","resolvedDescriptionId","checkbox","color","size","cn","resolveClassName","className","state","IconCheck","IconMinus","Label"],"sources":["../../src/components/checkbox.tsx"],"sourcesContent":["import type * as React from 'react'\nimport { type ReactNode, useId } from 'react'\n\nimport { Checkbox as CheckboxPrimitive } from '@base-ui/react/checkbox'\nimport { IconCheck, IconMinus } from '@tabler/icons-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport type { UIColor } from '../lib/color'\nimport { selectionControlColorVariants } from '../lib/color'\nimport { cn } from '../lib/utils'\nimport { resolveClassName } from '../utils/resolve-class-name'\nimport { useFieldControlId, useFieldInvalid } from './field'\nimport { Label, type LabelProps } from './label'\n\nconst checkboxVariants = cva(\n 'border-input dark:data-unchecked:bg-input/30 data-checked:bg-(--selection-control) data-checked:text-(--selection-control-foreground) data-checked:border-(--selection-control) focus-visible:border-ring focus-visible:ring-ring/50 flex items-center justify-center border transition-colors group-has-disabled/field:opacity-50 focus-visible:ring-3 peer relative shrink-0 outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50',\n {\n variants: {\n color: selectionControlColorVariants,\n size: {\n sm: 'size-3.5 rounded-[3px] [&_[data-slot=checkbox-indicator]>svg]:size-3',\n md: 'size-4 rounded-[4px] [&_[data-slot=checkbox-indicator]>svg]:size-3.5',\n lg: 'size-5 rounded-[5px] [&_[data-slot=checkbox-indicator]>svg]:size-4'\n }\n },\n defaultVariants: {\n color: 'primary',\n size: 'md'\n }\n }\n)\n\nconst checkboxLabelVariants = cva('', {\n variants: {\n size: {\n sm: 'text-xs',\n md: 'text-sm',\n lg: 'text-lg'\n }\n },\n defaultVariants: {\n size: 'md'\n }\n})\n\nconst checkboxDescriptionVariants = cva(\n 'text-muted-foreground text-left leading-normal font-normal [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary',\n {\n variants: {\n size: {\n sm: 'text-xs',\n md: 'text-xs',\n lg: 'text-sm'\n }\n },\n defaultVariants: {\n size: 'md'\n }\n }\n)\n\nexport type CheckboxProps = Omit<React.ComponentProps<typeof CheckboxPrimitive.Root>, 'render'> &\n VariantProps<typeof checkboxVariants> & {\n /**\n * Palette family used when checked.\n * @default 'primary'\n */\n color?: UIColor\n /** Label rendered next to the checkbox and linked to it. */\n label?: ReactNode\n /** Props for the rendered label. */\n labelProps?: Omit<LabelProps, 'children' | 'htmlFor'>\n /** Helper text rendered below the label. */\n description?: ReactNode\n /** Props for the rendered description. */\n descriptionProps?: Omit<React.ComponentProps<'p'>, 'children'>\n }\n\nfunction Checkbox({\n className,\n color = 'primary',\n id,\n label,\n labelProps,\n description,\n descriptionProps,\n size = 'md',\n 'aria-invalid': ariaInvalid,\n ...props\n}: CheckboxProps) {\n const generatedId = useId()\n const fieldControlId = useFieldControlId(id)\n const invalid = useFieldInvalid(ariaInvalid)\n const hasLabel = label !== undefined\n const resolvedId = fieldControlId ?? (hasLabel ? generatedId : undefined)\n const { className: labelClassName, ...labelRootProps } = labelProps ?? {}\n const descriptionId = useId()\n const hasDescription = description !== undefined\n const { className: descriptionClassName, ...descriptionRootProps } = descriptionProps ?? {}\n const resolvedDescriptionId = hasDescription ? (descriptionRootProps.id ?? descriptionId) : undefined\n\n const checkbox = (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n data-color={color}\n data-size={size}\n id={resolvedId}\n aria-describedby={resolvedDescriptionId}\n aria-invalid={invalid}\n className={(state) => cn(checkboxVariants({ color, size }), resolveClassName(className, state))}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n className=\"grid place-content-center text-current transition-none\"\n >\n <IconCheck className=\"block in-data-indeterminate:hidden\" />\n <IconMinus className=\"hidden in-data-indeterminate:block\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n )\n\n if (!hasLabel && !hasDescription) {\n return checkbox\n }\n\n return (\n <div\n data-slot=\"checkbox-field\"\n className=\"grid grid-cols-[auto_1fr] items-center justify-items-start gap-x-2 gap-y-0.5\"\n >\n {checkbox}\n {hasLabel && (\n <Label {...labelRootProps} htmlFor={resolvedId} className={cn(checkboxLabelVariants({ size }), labelClassName)}>\n {label}\n </Label>\n )}\n {hasDescription && (\n <p\n data-slot=\"checkbox-description\"\n {...descriptionRootProps}\n id={resolvedDescriptionId}\n className={cn('col-start-2', checkboxDescriptionVariants({ size }), descriptionClassName)}\n >\n {description}\n </p>\n )}\n </div>\n )\n}\n\nexport { Checkbox }\n"],"mappings":"A,shBAcA,MAAME,EAAmBC,EACvB,yeACA,CACE,SAAU,CACR,MA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AU,oCAAsC,CAAA,CAChC,C,EACP,CAAA,EAO1B,MAJI,CAACrB,GAAY,CAACO,EACTM,EAIP,kBAAC,MAAD,CACE,YAAU,iBACV,UAAU,+EAFZ,SAAA,CAIGA,EACAb,GACC,kBAACsB,EAAD,CAAO,GAAIlB,EAAgB,QAASF,EAAY,UAAWc,EAAG3B,EAAsB,CAAE,MAAK,CAAC,EAAGc,CAAc,EAC1G,SAAAF,CACI,CAAA,EAERM,GACC,kBAAC,IAAD,CACE,YAAU,uBACV,GAAIG,EACJ,GAAIE,EACJ,UAAWI,EAAG,cAAe1B,EAA4B,CAAE,MAAK,CAAC,EAAGmB,CAAoB,EAEvF,SAAAD,CACA,CAAA,CAEF,C,EAET,C"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { t as __name } from "../rolldown-runtime-BhWHdk3m.js";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
//#region src/components/code.d.ts
|
|
4
3
|
export type CodeProps = React.ComponentProps<'code'>;
|
|
5
4
|
declare function Code({ className, ...props }: CodeProps): React.JSX.Element;
|
|
6
|
-
//#endregion
|
|
7
5
|
export { Code };
|
|
8
6
|
//# sourceMappingURL=code.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.js","names":["props","cn","className"],"sources":["../../src/components/code.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { cn } from '../lib/utils'\n\nexport type CodeProps = React.ComponentProps<'code'>\n\nfunction Code({ className, ...props }: CodeProps) {\n return (\n <code\n data-slot=\"code\"\n className={cn(\n 'bg-muted text-foreground inline-flex w-fit items-center rounded-md px-1.5 py-0.5 font-mono text-[0.875em] font-medium',\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Code }\n"],"mappings":"qHAMA,SAAS,KAAK,CAAE,YAAW,GAAGA,GAAoB,CAChD,MACE,kBAAC,OAAD,CACE,YAAU,OACV,UAAWC,EACT,wHACAC,CACF,EACA,GAAIF,CACL,CAAA,CAEL"}
|
|
1
|
+
{"version":3,"file":"code.js","names":["props","cn","className"],"sources":["../../src/components/code.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { cn } from '../lib/utils'\n\nexport type CodeProps = React.ComponentProps<'code'>\n\nfunction Code({ className, ...props }: CodeProps) {\n return (\n <code\n data-slot=\"code\"\n className={cn(\n 'bg-muted text-foreground inline-flex w-fit items-center rounded-md px-1.5 py-0.5 font-mono text-[0.875em] font-medium',\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Code }\n"],"mappings":"A,qHAMA,SAAS,KAAK,CAAE,YAAW,GAAGA,GAAoB,CAChD,MACE,kBAAC,OAAD,CACE,YAAU,OACV,UAAWC,EACT,wHACAC,CACF,EACA,GAAIF,CACL,CAAA,CAEL,C"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { t as __name } from "../rolldown-runtime-BhWHdk3m.js";
|
|
2
|
-
import { t as AsChildPrimitiveProps } from "../as-child-
|
|
2
|
+
import { t as AsChildPrimitiveProps } from "../as-child-T9W73ZYU.js";
|
|
3
3
|
import { Collapsible as Collapsible$1 } from "@base-ui/react/collapsible";
|
|
4
|
-
//#region src/components/collapsible.d.ts
|
|
5
4
|
export type CollapsibleProps = AsChildPrimitiveProps<typeof Collapsible$1.Root>;
|
|
6
5
|
export type CollapsibleTriggerProps = AsChildPrimitiveProps<typeof Collapsible$1.Trigger>;
|
|
7
6
|
export type CollapsibleContentProps = AsChildPrimitiveProps<typeof Collapsible$1.Panel>;
|
|
8
7
|
declare function Collapsible({ asChild, children, ...props }: CollapsibleProps): import("react").JSX.Element;
|
|
9
8
|
declare function CollapsibleTrigger({ asChild, children, ...props }: CollapsibleTriggerProps): import("react").JSX.Element;
|
|
10
9
|
declare function CollapsibleContent({ asChild, children, ...props }: CollapsibleContentProps): import("react").JSX.Element;
|
|
11
|
-
//#endregion
|
|
12
10
|
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
13
11
|
//# sourceMappingURL=collapsible.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapsible.js","names":["CollapsiblePrimitive","Collapsible$1","props","toAsChildRenderProps","asChild","children"],"sources":["../../src/components/collapsible.tsx"],"sourcesContent":["import { Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible'\n\nimport { type AsChildPrimitiveProps, toAsChildRenderProps } from '../lib/as-child'\n\nexport type CollapsibleProps = AsChildPrimitiveProps<typeof CollapsiblePrimitive.Root>\n\nexport type CollapsibleTriggerProps = AsChildPrimitiveProps<typeof CollapsiblePrimitive.Trigger>\n\nexport type CollapsibleContentProps = AsChildPrimitiveProps<typeof CollapsiblePrimitive.Panel>\n\nfunction Collapsible({ asChild, children, ...props }: CollapsibleProps) {\n return <CollapsiblePrimitive.Root data-slot=\"collapsible\" {...props} {...toAsChildRenderProps(asChild, children)} />\n}\n\nfunction CollapsibleTrigger({ asChild, children, ...props }: CollapsibleTriggerProps) {\n return (\n <CollapsiblePrimitive.Trigger\n data-slot=\"collapsible-trigger\"\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction CollapsibleContent({ asChild, children, ...props }: CollapsibleContentProps) {\n return (\n <CollapsiblePrimitive.Panel\n data-slot=\"collapsible-content\"\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nexport { Collapsible, CollapsibleContent, CollapsibleTrigger }\n"],"mappings":"mMAUA,SAAS,YAAY,CAAE,UAAS,WAAU,GAAGE,GAA2B,CACtE,MAAO,kBAACF,EAAqB,KAAtB,CAA2B,YAAU,cAAc,GAAIE,EAAO,GAAIC,EAAqBC,EAASC,CAAQ,CAAI,CAAA,CACrH,CAEA,SAAS,mBAAmB,CAAE,UAAS,WAAU,GAAGH,GAAkC,CACpF,MACE,kBAACF,EAAqB,QAAtB,CACE,YAAU,sBACV,GAAIE,EACJ,GAAIC,EAAqBC,EAASC,CAAQ,CAC3C,CAAA,CAEL,CAEA,SAAS,mBAAmB,CAAE,UAAS,WAAU,GAAGH,GAAkC,CACpF,MACE,kBAACF,EAAqB,MAAtB,CACE,YAAU,sBACV,GAAIE,EACJ,GAAIC,EAAqBC,EAASC,CAAQ,CAC3C,CAAA,CAEL"}
|
|
1
|
+
{"version":3,"file":"collapsible.js","names":["CollapsiblePrimitive","Collapsible$1","props","toAsChildRenderProps","asChild","children"],"sources":["../../src/components/collapsible.tsx"],"sourcesContent":["import { Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible'\n\nimport { type AsChildPrimitiveProps, toAsChildRenderProps } from '../lib/as-child'\n\nexport type CollapsibleProps = AsChildPrimitiveProps<typeof CollapsiblePrimitive.Root>\n\nexport type CollapsibleTriggerProps = AsChildPrimitiveProps<typeof CollapsiblePrimitive.Trigger>\n\nexport type CollapsibleContentProps = AsChildPrimitiveProps<typeof CollapsiblePrimitive.Panel>\n\nfunction Collapsible({ asChild, children, ...props }: CollapsibleProps) {\n return <CollapsiblePrimitive.Root data-slot=\"collapsible\" {...props} {...toAsChildRenderProps(asChild, children)} />\n}\n\nfunction CollapsibleTrigger({ asChild, children, ...props }: CollapsibleTriggerProps) {\n return (\n <CollapsiblePrimitive.Trigger\n data-slot=\"collapsible-trigger\"\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction CollapsibleContent({ asChild, children, ...props }: CollapsibleContentProps) {\n return (\n <CollapsiblePrimitive.Panel\n data-slot=\"collapsible-content\"\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nexport { Collapsible, CollapsibleContent, CollapsibleTrigger }\n"],"mappings":"A,mMAUA,SAAS,YAAY,CAAE,UAAS,WAAU,GAAGE,GAA2B,CACtE,MAAO,kBAACF,EAAqB,KAAtB,CAA2B,YAAU,cAAc,GAAIE,EAAO,GAAIC,EAAqBC,EAASC,CAAQ,CAAI,CAAA,CACrH,CAEA,SAAS,mBAAmB,CAAE,UAAS,WAAU,GAAGH,GAAkC,CACpF,MACE,kBAACF,EAAqB,QAAtB,CACE,YAAU,sBACV,GAAIE,EACJ,GAAIC,EAAqBC,EAASC,CAAQ,CAC3C,CAAA,CAEL,CAEA,SAAS,mBAAmB,CAAE,UAAS,WAAU,GAAGH,GAAkC,CACpF,MACE,kBAACF,EAAqB,MAAtB,CACE,YAAU,sBACV,GAAIE,EACJ,GAAIC,EAAqBC,EAASC,CAAQ,CAC3C,CAAA,CAEL,C"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { t as __name } from "../rolldown-runtime-BhWHdk3m.js";
|
|
2
|
-
import { t as AsChildPrimitiveProps } from "../as-child-
|
|
2
|
+
import { t as AsChildPrimitiveProps } from "../as-child-T9W73ZYU.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Combobox as Combobox$1 } from "@base-ui/react/combobox";
|
|
5
|
-
//#region src/components/combobox.d.ts
|
|
6
5
|
export type ComboboxProps<Value = unknown, Multiple extends boolean | undefined = false> = Combobox$1.Root.Props<Value, Multiple>;
|
|
7
6
|
export type ComboboxValueProps = Combobox$1.Value.Props;
|
|
8
7
|
export type ComboboxTriggerProps = AsChildPrimitiveProps<typeof Combobox$1.Trigger> & {
|
|
@@ -68,6 +67,5 @@ declare function ComboboxChips({ className, children, showClear, asChild, ...pro
|
|
|
68
67
|
declare function ComboboxChip({ className, children, showRemove, asChild, ...props }: ComboboxChipProps): React.JSX.Element;
|
|
69
68
|
declare function ComboboxChipsInput({ className, id, 'aria-invalid': ariaInvalid, ...props }: ComboboxChipsInputProps): React.JSX.Element;
|
|
70
69
|
declare function useComboboxAnchor(): React.RefObject<HTMLDivElement | null>;
|
|
71
|
-
//#endregion
|
|
72
70
|
export { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxClear, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, useComboboxAnchor };
|
|
73
71
|
//# sourceMappingURL=combobox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.js","names":["ComboboxPrimitive","resolveClassName","React","Combobox$1","Combobox","props","IconSelector","cn","className","state","toAsChildRenderProps","asChild","children","icon","InputGroupButton","IconX","fieldControlId","useFieldControlId","id","InputGroup","InputGroupAddon","InputGroupInput","showTrigger","triggerIcon","showClear","anchor","IconCheck","Button","showRemove","ariaInvalid","invalid","useFieldInvalid"],"sources":["../../src/components/combobox.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react/combobox'\nimport { IconCheck, IconSelector, IconX } from '@tabler/icons-react'\n\nimport { type AsChildPrimitiveProps, toAsChildRenderProps } from '../lib/as-child'\nimport { cn } from '../lib/utils'\nimport { resolveClassName } from '../utils/resolve-class-name'\nimport { Button } from './button'\nimport { useFieldControlId, useFieldInvalid } from './field'\nimport { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from './input-group'\n\nexport type ComboboxProps<Value = unknown, Multiple extends boolean | undefined = false> = ComboboxPrimitive.Root.Props<\n Value,\n Multiple\n>\n\nexport type ComboboxValueProps = ComboboxPrimitive.Value.Props\n\nexport type ComboboxTriggerProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.Trigger> & {\n /** Icon of the trigger button. Defaults to an up/down chevron. */\n icon?: React.ReactNode\n}\n\nexport type ComboboxClearProps = Omit<ComboboxPrimitive.Clear.Props, 'render'>\n\nexport type ComboboxInputProps = Omit<ComboboxPrimitive.Input.Props, 'render' | 'className'> & {\n /** Classes for the input group that wraps the input and its buttons. */\n className?: string\n /** Icon shown at the start of the input. */\n icon?: React.ReactNode\n /** Replaces the icon of the trigger button. */\n triggerIcon?: React.ReactNode\n /**\n * Shows the button that opens the list.\n * @default true\n */\n showTrigger?: boolean\n /**\n * Shows a button that clears the value.\n * @default false\n */\n showClear?: boolean\n}\n\nexport type ComboboxContentProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.Popup> &\n Pick<\n ComboboxPrimitive.Positioner.Props,\n | 'side'\n | 'align'\n | 'sideOffset'\n | 'alignOffset'\n | 'anchor'\n | 'positionMethod'\n | 'collisionBoundary'\n | 'collisionPadding'\n | 'sticky'\n | 'arrowPadding'\n | 'disableAnchorTracking'\n | 'collisionAvoidance'\n > &\n Pick<ComboboxPrimitive.Portal.Props, 'container' | 'keepMounted'>\n\nexport type ComboboxListProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.List>\n\nexport type ComboboxItemProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.Item>\n\nexport type ComboboxGroupProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.Group>\n\nexport type ComboboxLabelProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.GroupLabel>\n\nexport type ComboboxCollectionProps = ComboboxPrimitive.Collection.Props\n\nexport type ComboboxEmptyProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.Empty>\n\nexport type ComboboxSeparatorProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.Separator>\n\nexport type ComboboxChipsProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.Chips> & {\n /**\n * Shows a button that removes all chips.\n * @default false\n */\n showClear?: boolean\n}\n\nexport type ComboboxChipProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.Chip> & {\n /**\n * Shows the button that removes this chip.\n * @default true\n */\n showRemove?: boolean\n}\n\nexport type ComboboxChipsInputProps = Omit<ComboboxPrimitive.Input.Props, 'render'>\n\nconst Combobox = ComboboxPrimitive.Root\n\nfunction ComboboxValue({ ...props }: ComboboxValueProps) {\n return <ComboboxPrimitive.Value data-slot=\"combobox-value\" {...props} />\n}\n\nfunction ComboboxTrigger({\n className,\n children,\n icon = <IconSelector className=\"pointer-events-none size-4 text-muted-foreground\" />,\n asChild,\n ...props\n}: ComboboxTriggerProps) {\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n className={(state) => cn(\"[&_svg:not([class*='size-'])]:size-4\", resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n >\n {!asChild && children}\n {!asChild && icon}\n </ComboboxPrimitive.Trigger>\n )\n}\n\nfunction ComboboxClear({ className, ...props }: ComboboxClearProps) {\n return (\n <ComboboxPrimitive.Clear\n data-slot=\"combobox-clear\"\n render={<InputGroupButton variant=\"ghost\" size=\"icon-xs\" />}\n className={(state) => cn(resolveClassName(className, state))}\n {...props}\n >\n <IconX className=\"pointer-events-none\" />\n </ComboboxPrimitive.Clear>\n )\n}\n\nfunction ComboboxInput({\n className,\n children,\n disabled = false,\n icon,\n id,\n showTrigger = true,\n showClear = false,\n triggerIcon,\n ...props\n}: ComboboxInputProps) {\n const fieldControlId = useFieldControlId(id)\n\n return (\n <InputGroup className={cn('w-auto', className)}>\n {icon && <InputGroupAddon align=\"inline-start\">{icon}</InputGroupAddon>}\n <ComboboxPrimitive.Input id={fieldControlId} render={<InputGroupInput disabled={disabled} />} {...props} />\n <InputGroupAddon align=\"inline-end\">\n {showTrigger && (\n <InputGroupButton\n size=\"icon-xs\"\n variant=\"ghost\"\n asChild\n data-slot=\"input-group-button\"\n className=\"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent\"\n disabled={disabled}\n >\n <ComboboxTrigger icon={triggerIcon} />\n </InputGroupButton>\n )}\n {showClear && <ComboboxClear disabled={disabled} />}\n </InputGroupAddon>\n {children}\n </InputGroup>\n )\n}\n\nfunction ComboboxContent({\n className,\n asChild,\n children,\n side = 'bottom',\n sideOffset = 6,\n align = 'start',\n alignOffset = 0,\n anchor,\n container,\n keepMounted,\n positionMethod = 'absolute',\n collisionBoundary,\n collisionPadding,\n sticky,\n arrowPadding,\n disableAnchorTracking,\n collisionAvoidance,\n ...props\n}: ComboboxContentProps) {\n return (\n <ComboboxPrimitive.Portal container={container} keepMounted={keepMounted}>\n <ComboboxPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n positionMethod={positionMethod}\n collisionBoundary={collisionBoundary}\n collisionPadding={collisionPadding}\n sticky={sticky}\n arrowPadding={arrowPadding}\n disableAnchorTracking={disableAnchorTracking}\n collisionAvoidance={collisionAvoidance}\n className=\"isolate z-50\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n data-chips={!!anchor}\n className={(state) =>\n cn(\n 'group/combobox-content max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+(--spacing(7)))] origin-(--transform-origin) overflow-hidden rounded-lg text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!',\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n </ComboboxPrimitive.Positioner>\n </ComboboxPrimitive.Portal>\n )\n}\n\nfunction ComboboxList({ className, asChild, children, ...props }: ComboboxListProps) {\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n className={(state) =>\n cn(\n 'no-scrollbar max-h-[min(calc(--spacing(72)-(--spacing(9))),calc(var(--available-height)-(--spacing(9))))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0',\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction ComboboxItem({ className, children, asChild, ...props }: ComboboxItemProps) {\n return (\n <ComboboxPrimitive.Item\n data-slot=\"combobox-item\"\n className={(state) =>\n cn(\n \"relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n >\n {!asChild && children}\n {!asChild && (\n <ComboboxPrimitive.ItemIndicator\n render={<span className=\"pointer-events-none absolute right-2 flex size-4 items-center justify-center\" />}\n >\n <IconCheck className=\"pointer-events-none\" />\n </ComboboxPrimitive.ItemIndicator>\n )}\n </ComboboxPrimitive.Item>\n )\n}\n\nfunction ComboboxGroup({ className, asChild, children, ...props }: ComboboxGroupProps) {\n return (\n <ComboboxPrimitive.Group\n data-slot=\"combobox-group\"\n className={(state) => cn(resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction ComboboxLabel({ className, asChild, children, ...props }: ComboboxLabelProps) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-label\"\n className={(state) => cn('px-2 py-1.5 text-xs text-muted-foreground', resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction ComboboxCollection({ ...props }: ComboboxCollectionProps) {\n return <ComboboxPrimitive.Collection data-slot=\"combobox-collection\" {...props} />\n}\n\nfunction ComboboxEmpty({ className, asChild, children, ...props }: ComboboxEmptyProps) {\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={(state) =>\n cn(\n 'hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex',\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction ComboboxSeparator({ className, asChild, children, ...props }: ComboboxSeparatorProps) {\n return (\n <ComboboxPrimitive.Separator\n data-slot=\"combobox-separator\"\n className={(state) => cn('-mx-1 my-1 h-px bg-border', resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction ComboboxChips({ className, children, showClear = false, asChild, ...props }: ComboboxChipsProps) {\n return (\n <ComboboxPrimitive.Chips\n data-slot=\"combobox-chips\"\n className={(state) =>\n cn(\n 'flex min-h-8 overflow-hidden flex-wrap items-center gap-1 rounded-lg border border-input bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40',\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n >\n {!asChild && children}\n {showClear && !asChild && (\n <ComboboxPrimitive.Clear\n data-slot=\"combobox-chips-clear\"\n render={<Button variant=\"ghost\" color=\"zinc\" size=\"icon-xs\" />}\n className=\"shrink-0 self-center size-5\"\n >\n <IconX className=\"pointer-events-none\" />\n </ComboboxPrimitive.Clear>\n )}\n </ComboboxPrimitive.Chips>\n )\n}\n\nfunction ComboboxChip({ className, children, showRemove = true, asChild, ...props }: ComboboxChipProps) {\n return (\n <ComboboxPrimitive.Chip\n data-slot=\"combobox-chip\"\n className={(state) =>\n cn(\n 'flex h-[calc(--spacing(5.25))] w-fit text-left max-w-full items-center justify-start gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0',\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n >\n {!asChild && <span className=\"flex-1 truncate\">{children}</span>}\n {showRemove && !asChild && (\n <ComboboxPrimitive.ChipRemove\n render={<Button variant=\"ghost\" color=\"zinc\" size=\"icon-xs\" />}\n className=\"-ml-1 opacity-50 shrink-0 hover:opacity-100\"\n data-slot=\"combobox-chip-remove\"\n >\n <IconX className=\"pointer-events-none\" />\n </ComboboxPrimitive.ChipRemove>\n )}\n </ComboboxPrimitive.Chip>\n )\n}\n\nfunction ComboboxChipsInput({ className, id, 'aria-invalid': ariaInvalid, ...props }: ComboboxChipsInputProps) {\n const fieldControlId = useFieldControlId(id)\n const invalid = useFieldInvalid(ariaInvalid)\n\n return (\n <ComboboxPrimitive.Input\n id={fieldControlId}\n aria-invalid={invalid}\n data-slot=\"combobox-chip-input\"\n className={(state) => cn('min-w-16 flex-1 outline-none', resolveClassName(className, state))}\n {...props}\n />\n )\n}\n\nfunction useComboboxAnchor() {\n return React.useRef<HTMLDivElement | null>(null)\n}\n\nexport {\n Combobox,\n ComboboxChip,\n ComboboxChips,\n ComboboxChipsInput,\n ComboboxClear,\n ComboboxCollection,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxGroup,\n ComboboxInput,\n ComboboxItem,\n ComboboxLabel,\n ComboboxList,\n ComboboxSeparator,\n ComboboxTrigger,\n ComboboxValue,\n useComboboxAnchor\n}\n"],"mappings":"8lBA+FA,MAAMI,EAAWJ,EAAkB,KAEnC,SAAS,cAAc,CAAE,GAAGK,GAA6B,CACvD,MAAO,kBAACL,EAAk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CACjD"}
|
|
1
|
+
{"version":3,"file":"combobox.js","names":["ComboboxPrimitive","resolveClassName","React","Combobox$1","Combobox","props","IconSelector","cn","className","state","toAsChildRenderProps","asChild","children","icon","InputGroupButton","IconX","fieldControlId","useFieldControlId","id","InputGroup","InputGroupAddon","InputGroupInput","showTrigger","triggerIcon","showClear","anchor","IconCheck","Button","showRemove","ariaInvalid","invalid","useFieldInvalid"],"sources":["../../src/components/combobox.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react/combobox'\nimport { IconCheck, IconSelector, IconX } from '@tabler/icons-react'\n\nimport { type AsChildPrimitiveProps, toAsChildRenderProps } from '../lib/as-child'\nimport { cn } from '../lib/utils'\nimport { resolveClassName } from '../utils/resolve-class-name'\nimport { Button } from './button'\nimport { useFieldControlId, useFieldInvalid } from './field'\nimport { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from './input-group'\n\nexport type ComboboxProps<Value = unknown, Multiple extends boolean | undefined = false> = ComboboxPrimitive.Root.Props<\n Value,\n Multiple\n>\n\nexport type ComboboxValueProps = ComboboxPrimitive.Value.Props\n\nexport type ComboboxTriggerProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.Trigger> & {\n /** Icon of the trigger button. Defaults to an up/down chevron. */\n icon?: React.ReactNode\n}\n\nexport type ComboboxClearProps = Omit<ComboboxPrimitive.Clear.Props, 'render'>\n\nexport type ComboboxInputProps = Omit<ComboboxPrimitive.Input.Props, 'render' | 'className'> & {\n /** Classes for the input group that wraps the input and its buttons. */\n className?: string\n /** Icon shown at the start of the input. */\n icon?: React.ReactNode\n /** Replaces the icon of the trigger button. */\n triggerIcon?: React.ReactNode\n /**\n * Shows the button that opens the list.\n * @default true\n */\n showTrigger?: boolean\n /**\n * Shows a button that clears the value.\n * @default false\n */\n showClear?: boolean\n}\n\nexport type ComboboxContentProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.Popup> &\n Pick<\n ComboboxPrimitive.Positioner.Props,\n | 'side'\n | 'align'\n | 'sideOffset'\n | 'alignOffset'\n | 'anchor'\n | 'positionMethod'\n | 'collisionBoundary'\n | 'collisionPadding'\n | 'sticky'\n | 'arrowPadding'\n | 'disableAnchorTracking'\n | 'collisionAvoidance'\n > &\n Pick<ComboboxPrimitive.Portal.Props, 'container' | 'keepMounted'>\n\nexport type ComboboxListProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.List>\n\nexport type ComboboxItemProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.Item>\n\nexport type ComboboxGroupProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.Group>\n\nexport type ComboboxLabelProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.GroupLabel>\n\nexport type ComboboxCollectionProps = ComboboxPrimitive.Collection.Props\n\nexport type ComboboxEmptyProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.Empty>\n\nexport type ComboboxSeparatorProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.Separator>\n\nexport type ComboboxChipsProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.Chips> & {\n /**\n * Shows a button that removes all chips.\n * @default false\n */\n showClear?: boolean\n}\n\nexport type ComboboxChipProps = AsChildPrimitiveProps<typeof ComboboxPrimitive.Chip> & {\n /**\n * Shows the button that removes this chip.\n * @default true\n */\n showRemove?: boolean\n}\n\nexport type ComboboxChipsInputProps = Omit<ComboboxPrimitive.Input.Props, 'render'>\n\nconst Combobox = ComboboxPrimitive.Root\n\nfunction ComboboxValue({ ...props }: ComboboxValueProps) {\n return <ComboboxPrimitive.Value data-slot=\"combobox-value\" {...props} />\n}\n\nfunction ComboboxTrigger({\n className,\n children,\n icon = <IconSelector className=\"pointer-events-none size-4 text-muted-foreground\" />,\n asChild,\n ...props\n}: ComboboxTriggerProps) {\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n className={(state) => cn(\"[&_svg:not([class*='size-'])]:size-4\", resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n >\n {!asChild && children}\n {!asChild && icon}\n </ComboboxPrimitive.Trigger>\n )\n}\n\nfunction ComboboxClear({ className, ...props }: ComboboxClearProps) {\n return (\n <ComboboxPrimitive.Clear\n data-slot=\"combobox-clear\"\n render={<InputGroupButton variant=\"ghost\" size=\"icon-xs\" />}\n className={(state) => cn(resolveClassName(className, state))}\n {...props}\n >\n <IconX className=\"pointer-events-none\" />\n </ComboboxPrimitive.Clear>\n )\n}\n\nfunction ComboboxInput({\n className,\n children,\n disabled = false,\n icon,\n id,\n showTrigger = true,\n showClear = false,\n triggerIcon,\n ...props\n}: ComboboxInputProps) {\n const fieldControlId = useFieldControlId(id)\n\n return (\n <InputGroup className={cn('w-auto', className)}>\n {icon && <InputGroupAddon align=\"inline-start\">{icon}</InputGroupAddon>}\n <ComboboxPrimitive.Input id={fieldControlId} render={<InputGroupInput disabled={disabled} />} {...props} />\n <InputGroupAddon align=\"inline-end\">\n {showTrigger && (\n <InputGroupButton\n size=\"icon-xs\"\n variant=\"ghost\"\n asChild\n data-slot=\"input-group-button\"\n className=\"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent\"\n disabled={disabled}\n >\n <ComboboxTrigger icon={triggerIcon} />\n </InputGroupButton>\n )}\n {showClear && <ComboboxClear disabled={disabled} />}\n </InputGroupAddon>\n {children}\n </InputGroup>\n )\n}\n\nfunction ComboboxContent({\n className,\n asChild,\n children,\n side = 'bottom',\n sideOffset = 6,\n align = 'start',\n alignOffset = 0,\n anchor,\n container,\n keepMounted,\n positionMethod = 'absolute',\n collisionBoundary,\n collisionPadding,\n sticky,\n arrowPadding,\n disableAnchorTracking,\n collisionAvoidance,\n ...props\n}: ComboboxContentProps) {\n return (\n <ComboboxPrimitive.Portal container={container} keepMounted={keepMounted}>\n <ComboboxPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n positionMethod={positionMethod}\n collisionBoundary={collisionBoundary}\n collisionPadding={collisionPadding}\n sticky={sticky}\n arrowPadding={arrowPadding}\n disableAnchorTracking={disableAnchorTracking}\n collisionAvoidance={collisionAvoidance}\n className=\"isolate z-50\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n data-chips={!!anchor}\n className={(state) =>\n cn(\n 'group/combobox-content max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+(--spacing(7)))] origin-(--transform-origin) overflow-hidden rounded-lg text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!',\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n </ComboboxPrimitive.Positioner>\n </ComboboxPrimitive.Portal>\n )\n}\n\nfunction ComboboxList({ className, asChild, children, ...props }: ComboboxListProps) {\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n className={(state) =>\n cn(\n 'no-scrollbar max-h-[min(calc(--spacing(72)-(--spacing(9))),calc(var(--available-height)-(--spacing(9))))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0',\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction ComboboxItem({ className, children, asChild, ...props }: ComboboxItemProps) {\n return (\n <ComboboxPrimitive.Item\n data-slot=\"combobox-item\"\n className={(state) =>\n cn(\n \"relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n >\n {!asChild && children}\n {!asChild && (\n <ComboboxPrimitive.ItemIndicator\n render={<span className=\"pointer-events-none absolute right-2 flex size-4 items-center justify-center\" />}\n >\n <IconCheck className=\"pointer-events-none\" />\n </ComboboxPrimitive.ItemIndicator>\n )}\n </ComboboxPrimitive.Item>\n )\n}\n\nfunction ComboboxGroup({ className, asChild, children, ...props }: ComboboxGroupProps) {\n return (\n <ComboboxPrimitive.Group\n data-slot=\"combobox-group\"\n className={(state) => cn(resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction ComboboxLabel({ className, asChild, children, ...props }: ComboboxLabelProps) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-label\"\n className={(state) => cn('px-2 py-1.5 text-xs text-muted-foreground', resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction ComboboxCollection({ ...props }: ComboboxCollectionProps) {\n return <ComboboxPrimitive.Collection data-slot=\"combobox-collection\" {...props} />\n}\n\nfunction ComboboxEmpty({ className, asChild, children, ...props }: ComboboxEmptyProps) {\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={(state) =>\n cn(\n 'hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex',\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction ComboboxSeparator({ className, asChild, children, ...props }: ComboboxSeparatorProps) {\n return (\n <ComboboxPrimitive.Separator\n data-slot=\"combobox-separator\"\n className={(state) => cn('-mx-1 my-1 h-px bg-border', resolveClassName(className, state))}\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n />\n )\n}\n\nfunction ComboboxChips({ className, children, showClear = false, asChild, ...props }: ComboboxChipsProps) {\n return (\n <ComboboxPrimitive.Chips\n data-slot=\"combobox-chips\"\n className={(state) =>\n cn(\n 'flex min-h-8 overflow-hidden flex-wrap items-center gap-1 rounded-lg border border-input bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40',\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n >\n {!asChild && children}\n {showClear && !asChild && (\n <ComboboxPrimitive.Clear\n data-slot=\"combobox-chips-clear\"\n render={<Button variant=\"ghost\" color=\"zinc\" size=\"icon-xs\" />}\n className=\"shrink-0 self-center size-5\"\n >\n <IconX className=\"pointer-events-none\" />\n </ComboboxPrimitive.Clear>\n )}\n </ComboboxPrimitive.Chips>\n )\n}\n\nfunction ComboboxChip({ className, children, showRemove = true, asChild, ...props }: ComboboxChipProps) {\n return (\n <ComboboxPrimitive.Chip\n data-slot=\"combobox-chip\"\n className={(state) =>\n cn(\n 'flex h-[calc(--spacing(5.25))] w-fit text-left max-w-full items-center justify-start gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0',\n resolveClassName(className, state)\n )\n }\n {...props}\n {...toAsChildRenderProps(asChild, children)}\n >\n {!asChild && <span className=\"flex-1 truncate\">{children}</span>}\n {showRemove && !asChild && (\n <ComboboxPrimitive.ChipRemove\n render={<Button variant=\"ghost\" color=\"zinc\" size=\"icon-xs\" />}\n className=\"-ml-1 opacity-50 shrink-0 hover:opacity-100\"\n data-slot=\"combobox-chip-remove\"\n >\n <IconX className=\"pointer-events-none\" />\n </ComboboxPrimitive.ChipRemove>\n )}\n </ComboboxPrimitive.Chip>\n )\n}\n\nfunction ComboboxChipsInput({ className, id, 'aria-invalid': ariaInvalid, ...props }: ComboboxChipsInputProps) {\n const fieldControlId = useFieldControlId(id)\n const invalid = useFieldInvalid(ariaInvalid)\n\n return (\n <ComboboxPrimitive.Input\n id={fieldControlId}\n aria-invalid={invalid}\n data-slot=\"combobox-chip-input\"\n className={(state) => cn('min-w-16 flex-1 outline-none', resolveClassName(className, state))}\n {...props}\n />\n )\n}\n\nfunction useComboboxAnchor() {\n return React.useRef<HTMLDivElement | null>(null)\n}\n\nexport {\n Combobox,\n ComboboxChip,\n ComboboxChips,\n ComboboxChipsInput,\n ComboboxClear,\n ComboboxCollection,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxGroup,\n ComboboxInput,\n ComboboxItem,\n ComboboxLabel,\n ComboboxList,\n ComboboxSeparator,\n ComboboxTrigger,\n ComboboxValue,\n useComboboxAnchor\n}\n"],"mappings":"A,8lBA+FA,MAAMI,EAAWJ,EAAkB,KAEnC,SAAS,cAAc,CAAE,GAAGK,GAA6B,CACvD,MAAO,kBAACL,EAAkB,MAAnB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IAAI,CACjD,C"}
|
|
@@ -2,7 +2,6 @@ import { t as __name } from "../rolldown-runtime-BhWHdk3m.js";
|
|
|
2
2
|
import { Dialog } from "./dialog.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Command as Command$1 } from "cmdk";
|
|
5
|
-
//#region src/components/command.d.ts
|
|
6
5
|
export type CommandProps = React.ComponentProps<typeof Command$1>;
|
|
7
6
|
export type CommandDialogProps = Omit<React.ComponentProps<typeof Dialog>, 'children'> & {
|
|
8
7
|
children?: React.ReactNode;
|
|
@@ -40,6 +39,5 @@ declare function CommandGroup({ className, ...props }: CommandGroupProps): React
|
|
|
40
39
|
declare function CommandSeparator({ className, ...props }: CommandSeparatorProps): React.JSX.Element;
|
|
41
40
|
declare function CommandItem({ className, children, ...props }: CommandItemProps): React.JSX.Element;
|
|
42
41
|
declare function CommandShortcut({ className, ...props }: CommandShortcutProps): React.JSX.Element;
|
|
43
|
-
//#endregion
|
|
44
42
|
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
|
|
45
43
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","names":["CommandPrimitive","Command$1","props","cn","className","Dialog","DialogHeader","DialogTitle","title","DialogDescription","description","DialogContent","fieldControlId","useFieldControlId","id","InputGroup","InputGroupAddon","IconSearch","children","IconCheck"],"sources":["../../src/components/command.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { IconCheck, IconSearch } from '@tabler/icons-react'\nimport { Command as CommandPrimitive } from 'cmdk'\n\nimport { cn } from '../lib/utils'\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from './dialog'\nimport { useFieldControlId } from './field'\nimport { InputGroup, InputGroupAddon } from './input-group'\n\nexport type CommandProps = React.ComponentProps<typeof CommandPrimitive>\n\nexport type CommandDialogProps = Omit<React.ComponentProps<typeof Dialog>, 'children'> & {\n children?: React.ReactNode\n /**\n * Dialog title, read by screen readers only.\n * @default 'Command Palette'\n */\n title?: string\n /**\n * Dialog description, read by screen readers only.\n * @default 'Search for a command to run...'\n */\n description?: string\n /** Classes for the dialog content. */\n className?: string\n /**\n * Shows the X button of the dialog.\n * @default false\n */\n showCloseButton?: boolean\n}\n\nexport type CommandInputProps = React.ComponentProps<typeof CommandPrimitive.Input>\n\nexport type CommandListProps = React.ComponentProps<typeof CommandPrimitive.List>\n\nexport type CommandEmptyProps = React.ComponentProps<typeof CommandPrimitive.Empty>\n\nexport type CommandGroupProps = React.ComponentProps<typeof CommandPrimitive.Group>\n\nexport type CommandSeparatorProps = React.ComponentProps<typeof CommandPrimitive.Separator>\n\nexport type CommandItemProps = React.ComponentProps<typeof CommandPrimitive.Item>\n\nexport type CommandShortcutProps = React.ComponentProps<'span'>\n\nfunction Command({ className, ...props }: CommandProps) {\n return (\n <CommandPrimitive\n data-slot=\"command\"\n className={cn(\n 'flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandDialog({\n title = 'Command Palette',\n description = 'Search for a command to run...',\n children,\n className,\n showCloseButton = false,\n size = 'sm',\n ...props\n}: CommandDialogProps) {\n return (\n <Dialog size={size} {...props}>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent\n className={cn('top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0', className)}\n showCloseButton={showCloseButton}\n >\n {children}\n </DialogContent>\n </Dialog>\n )\n}\n\nfunction CommandInput({ className, id, ...props }: CommandInputProps) {\n const fieldControlId = useFieldControlId(id)\n\n return (\n <div data-slot=\"command-input-wrapper\" className=\"p-1 pb-0\">\n <InputGroup\n className={cn(\n 'h-8! rounded-lg! border-input/30 bg-input/30 shadow-none!',\n '*:data-[slot=input-group-addon]:pl-2!'\n )}\n >\n <CommandPrimitive.Input\n id={fieldControlId}\n data-slot=\"command-input\"\n className={cn('w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50', className)}\n {...props}\n />\n <InputGroupAddon>\n <IconSearch className=\"size-4 shrink-0 opacity-50\" />\n </InputGroupAddon>\n </InputGroup>\n </div>\n )\n}\n\nfunction CommandList({ className, ...props }: CommandListProps) {\n return (\n <CommandPrimitive.List\n data-slot=\"command-list\"\n className={cn('no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none', className)}\n {...props}\n />\n )\n}\n\nfunction CommandEmpty({ className, ...props }: CommandEmptyProps) {\n return (\n <CommandPrimitive.Empty\n data-slot=\"command-empty\"\n className={cn('py-6 text-center text-sm', className)}\n {...props}\n />\n )\n}\n\nfunction CommandGroup({ className, ...props }: CommandGroupProps) {\n return (\n <CommandPrimitive.Group\n data-slot=\"command-group\"\n className={cn(\n 'overflow-hidden p-1 text-foreground',\n '**:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5',\n '**:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium',\n '**:[[cmdk-group-heading]]:text-muted-foreground',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandSeparator({ className, ...props }: CommandSeparatorProps) {\n return (\n <CommandPrimitive.Separator\n data-slot=\"command-separator\"\n className={cn('-mx-1 h-px bg-border', className)}\n {...props}\n />\n )\n}\n\nfunction CommandItem({ className, children, ...props }: CommandItemProps) {\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n className={cn(\n 'group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none',\n 'in-data-[slot=dialog-content]:rounded-lg!',\n 'data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50',\n 'data-selected:bg-muted data-selected:text-foreground data-selected:*:[svg]:text-foreground',\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n {children}\n <IconCheck\n className={cn(\n 'ml-auto opacity-0',\n 'group-has-data-[slot=command-shortcut]/command-item:hidden',\n 'group-data-[checked=true]/command-item:opacity-100'\n )}\n />\n </CommandPrimitive.Item>\n )\n}\n\nfunction CommandShortcut({ className, ...props }: CommandShortcutProps) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn(\n 'ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground',\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut\n}\n"],"mappings":"kcA+CA,SAAS,QAAQ,CAAE,YAAW,GAAGE,GAAuB,CACtD,MACE,kBAACF,EAAD,CACE,YAAU,UACV,UAAWG,EACT,6FACAC,CACF,EACA,GAAIF,CACL,CAAA,CAEL,CAEA,SAAS,cAAc,CACrB,QAAQ,kBACR,cAAc,iCACd,WACA,YACA,kBAAkB,GAClB,OAAO,KACP,GAAGA,GACkB,CACrB,MACE,kBAACG,EAAD,CAAc,OAAM,GAAIH,EAAxB,SAAA,CACE,kBAACI,EAAD,CAAc,UAAU,UAAxB,SAAA,CACE,kBAACC,EAAD,CAAA,SAAcC,CAAmB,CAAA,EACjC,kBAACC,EAAD,CAAA,SAAoBC,CAA+B,CAAA,CACvC,CACd,CAAA,EAAA,kBAACC,EAAD,CACE,UAAWR,EAAG,wDAAyDC,CAAS,EAC/D,kBAEhB,UACY,CAAA,CACT,
|
|
1
|
+
{"version":3,"file":"command.js","names":["CommandPrimitive","Command$1","props","cn","className","Dialog","DialogHeader","DialogTitle","title","DialogDescription","description","DialogContent","fieldControlId","useFieldControlId","id","InputGroup","InputGroupAddon","IconSearch","children","IconCheck"],"sources":["../../src/components/command.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { IconCheck, IconSearch } from '@tabler/icons-react'\nimport { Command as CommandPrimitive } from 'cmdk'\n\nimport { cn } from '../lib/utils'\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from './dialog'\nimport { useFieldControlId } from './field'\nimport { InputGroup, InputGroupAddon } from './input-group'\n\nexport type CommandProps = React.ComponentProps<typeof CommandPrimitive>\n\nexport type CommandDialogProps = Omit<React.ComponentProps<typeof Dialog>, 'children'> & {\n children?: React.ReactNode\n /**\n * Dialog title, read by screen readers only.\n * @default 'Command Palette'\n */\n title?: string\n /**\n * Dialog description, read by screen readers only.\n * @default 'Search for a command to run...'\n */\n description?: string\n /** Classes for the dialog content. */\n className?: string\n /**\n * Shows the X button of the dialog.\n * @default false\n */\n showCloseButton?: boolean\n}\n\nexport type CommandInputProps = React.ComponentProps<typeof CommandPrimitive.Input>\n\nexport type CommandListProps = React.ComponentProps<typeof CommandPrimitive.List>\n\nexport type CommandEmptyProps = React.ComponentProps<typeof CommandPrimitive.Empty>\n\nexport type CommandGroupProps = React.ComponentProps<typeof CommandPrimitive.Group>\n\nexport type CommandSeparatorProps = React.ComponentProps<typeof CommandPrimitive.Separator>\n\nexport type CommandItemProps = React.ComponentProps<typeof CommandPrimitive.Item>\n\nexport type CommandShortcutProps = React.ComponentProps<'span'>\n\nfunction Command({ className, ...props }: CommandProps) {\n return (\n <CommandPrimitive\n data-slot=\"command\"\n className={cn(\n 'flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandDialog({\n title = 'Command Palette',\n description = 'Search for a command to run...',\n children,\n className,\n showCloseButton = false,\n size = 'sm',\n ...props\n}: CommandDialogProps) {\n return (\n <Dialog size={size} {...props}>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent\n className={cn('top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0', className)}\n showCloseButton={showCloseButton}\n >\n {children}\n </DialogContent>\n </Dialog>\n )\n}\n\nfunction CommandInput({ className, id, ...props }: CommandInputProps) {\n const fieldControlId = useFieldControlId(id)\n\n return (\n <div data-slot=\"command-input-wrapper\" className=\"p-1 pb-0\">\n <InputGroup\n className={cn(\n 'h-8! rounded-lg! border-input/30 bg-input/30 shadow-none!',\n '*:data-[slot=input-group-addon]:pl-2!'\n )}\n >\n <CommandPrimitive.Input\n id={fieldControlId}\n data-slot=\"command-input\"\n className={cn('w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50', className)}\n {...props}\n />\n <InputGroupAddon>\n <IconSearch className=\"size-4 shrink-0 opacity-50\" />\n </InputGroupAddon>\n </InputGroup>\n </div>\n )\n}\n\nfunction CommandList({ className, ...props }: CommandListProps) {\n return (\n <CommandPrimitive.List\n data-slot=\"command-list\"\n className={cn('no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none', className)}\n {...props}\n />\n )\n}\n\nfunction CommandEmpty({ className, ...props }: CommandEmptyProps) {\n return (\n <CommandPrimitive.Empty\n data-slot=\"command-empty\"\n className={cn('py-6 text-center text-sm', className)}\n {...props}\n />\n )\n}\n\nfunction CommandGroup({ className, ...props }: CommandGroupProps) {\n return (\n <CommandPrimitive.Group\n data-slot=\"command-group\"\n className={cn(\n 'overflow-hidden p-1 text-foreground',\n '**:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5',\n '**:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium',\n '**:[[cmdk-group-heading]]:text-muted-foreground',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandSeparator({ className, ...props }: CommandSeparatorProps) {\n return (\n <CommandPrimitive.Separator\n data-slot=\"command-separator\"\n className={cn('-mx-1 h-px bg-border', className)}\n {...props}\n />\n )\n}\n\nfunction CommandItem({ className, children, ...props }: CommandItemProps) {\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n className={cn(\n 'group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none',\n 'in-data-[slot=dialog-content]:rounded-lg!',\n 'data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50',\n 'data-selected:bg-muted data-selected:text-foreground data-selected:*:[svg]:text-foreground',\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n {children}\n <IconCheck\n className={cn(\n 'ml-auto opacity-0',\n 'group-has-data-[slot=command-shortcut]/command-item:hidden',\n 'group-data-[checked=true]/command-item:opacity-100'\n )}\n />\n </CommandPrimitive.Item>\n )\n}\n\nfunction CommandShortcut({ className, ...props }: CommandShortcutProps) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn(\n 'ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground',\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut\n}\n"],"mappings":"A,kcA+CA,SAAS,QAAQ,CAAE,YAAW,GAAGE,GAAuB,CACtD,MACE,kBAACF,EAAD,CACE,YAAU,UACV,UAAWG,EACT,6FACAC,CACF,EACA,GAAIF,CACL,CAAA,CAEL,CAEA,SAAS,cAAc,CACrB,QAAQ,kBACR,cAAc,iCACd,WACA,YACA,kBAAkB,GAClB,OAAO,KACP,GAAGA,GACkB,CACrB,MACE,kBAACG,EAAD,CAAc,OAAM,GAAIH,EAAxB,SAAA,CACE,kBAACI,EAAD,CAAc,UAAU,UAAxB,SAAA,CACE,kBAACC,EAAD,CAAA,SAAcC,CAAmB,CAAA,EACjC,kBAACC,EAAD,CAAA,SAAoBC,CAA+B,CAAA,CACvC,CACd,CAAA,EAAA,kBAACC,EAAD,CACE,UAAWR,EAAG,wDAAyDC,CAAS,EAC/D,kBAEhB,UACY,CAAA,CACT,C,EAEZ,CAEA,SAAS,aAAa,CAAE,YAAW,KAAI,GAAGF,GAA4B,CACpE,IAAMU,EA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C,EAE3B,CAEA,SAAS,gBAAgB,CAAE,YAAW,GAAGD,GAA+B,CACtE,MACE,kBAAC,OAAD,CACE,YAAU,mBACV,UAAWC,EACT,yGACAC,CACF,EACA,GAAIF,CACL,CAAA,CAEL,C"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { t as __name } from "../rolldown-runtime-BhWHdk3m.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { VariantProps } from "class-variance-authority";
|
|
4
|
-
//#region src/components/container.d.ts
|
|
5
4
|
declare const containerVariants: (props?: ({
|
|
6
5
|
size?: "full" | "lg" | "md" | "sm" | null | undefined;
|
|
7
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
7
|
export type ContainerProps = React.ComponentProps<'div'> & VariantProps<typeof containerVariants>;
|
|
9
8
|
declare function Container({ className, size, ...props }: ContainerProps): React.JSX.Element;
|
|
10
|
-
//#endregion
|
|
11
9
|
export { Container, containerVariants };
|
|
12
10
|
//# sourceMappingURL=container.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.js","names":["containerVariants","cva","props","size","cn","className"],"sources":["../../src/components/container.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils'\n\nconst containerVariants = cva('mx-auto w-full', {\n variants: {\n size: {\n sm: 'max-w-3xl px-4 sm:px-6',\n md: 'max-w-5xl px-4 sm:px-6 lg:px-8',\n lg: 'max-w-7xl px-4 sm:px-6 lg:px-8',\n full: 'max-w-none px-4 sm:px-6 lg:px-8'\n }\n },\n defaultVariants: {\n size: 'lg'\n }\n})\n\nexport type ContainerProps = React.ComponentProps<'div'> & VariantProps<typeof containerVariants>\n\nfunction Container({ className, size = 'lg', ...props }: ContainerProps) {\n return (\n <div data-slot=\"container\" data-size={size} className={cn(containerVariants({ size }), className)} {...props} />\n )\n}\n\nexport { Container, containerVariants }\n"],"mappings":"oKAMA,MAAMA,EAAoBC,EAAI,iBAAkB,CAC9C,SAAU,CACR,KAAM,CACJ,GAAI,yBACJ,GAAI,iCACJ,GAAI,iCACJ,KAAM,iCACR,CACF,EACA,gBAAiB,CACf,KAAM,IACR,CACF,CAAC,EAID,SAAS,UAAU,CAAE,YAAW,OAAO,KAAM,GAAGC,GAAyB,CACvE,MACE,kBAAC,MAAD,CAAK,YAAU,YAAY,YAAWC,EAAM,UAAWC,EAAGJ,EAAkB,CAAE,MAAK,CAAC,EAAGK,CAAS,EAAG,GAAIH,CAAQ,CAAA,CAEnH"}
|
|
1
|
+
{"version":3,"file":"container.js","names":["containerVariants","cva","props","size","cn","className"],"sources":["../../src/components/container.tsx"],"sourcesContent":["import type * as React from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils'\n\nconst containerVariants = cva('mx-auto w-full', {\n variants: {\n size: {\n sm: 'max-w-3xl px-4 sm:px-6',\n md: 'max-w-5xl px-4 sm:px-6 lg:px-8',\n lg: 'max-w-7xl px-4 sm:px-6 lg:px-8',\n full: 'max-w-none px-4 sm:px-6 lg:px-8'\n }\n },\n defaultVariants: {\n size: 'lg'\n }\n})\n\nexport type ContainerProps = React.ComponentProps<'div'> & VariantProps<typeof containerVariants>\n\nfunction Container({ className, size = 'lg', ...props }: ContainerProps) {\n return (\n <div data-slot=\"container\" data-size={size} className={cn(containerVariants({ size }), className)} {...props} />\n )\n}\n\nexport { Container, containerVariants }\n"],"mappings":"A,oKAMA,MAAMA,EAAoBC,EAAI,iBAAkB,CAC9C,SAAU,CACR,KAAM,CACJ,GAAI,yBACJ,GAAI,iCACJ,GAAI,iCACJ,KAAM,iCACR,CACF,EACA,gBAAiB,CACf,KAAM,IACR,CACF,CAAC,EAID,SAAS,UAAU,CAAE,YAAW,OAAO,KAAM,GAAGC,GAAyB,CACvE,MACE,kBAAC,MAAD,CAAK,YAAU,YAAY,YAAWC,EAAM,UAAWC,EAAGJ,EAAkB,CAAE,MAAK,CAAC,EAAGK,CAAS,EAAG,GAAIH,CAAQ,CAAA,CAEnH,C"}
|
|
@@ -3,7 +3,6 @@ import { Button } from "./button.js";
|
|
|
3
3
|
import { TableProps } from "./table.js";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { Column as Column$1, ColumnDef as ColumnDef$1, ReactTable, RowData, RowData as RowData$1 } from "@tanstack/react-table";
|
|
6
|
-
//#region src/components/data-table.d.ts
|
|
7
6
|
declare const features: {
|
|
8
7
|
columnFilteringFeature: import("@tanstack/react-table").TableFeature;
|
|
9
8
|
rowSortingFeature: import("@tanstack/react-table").TableFeature;
|
|
@@ -172,6 +171,5 @@ declare function createDataTableSelectColumn<TData extends RowData$1>(options?:
|
|
|
172
171
|
labels?: Pick<Partial<DataTableLabels>, 'selectAllRows' | 'selectRow'>;
|
|
173
172
|
}): ColumnDef<TData>;
|
|
174
173
|
declare function DataTable<TData extends RowData$1, TValue = unknown>({ columns, data, getRowId, filterColumns, pageSize, pageSizeOptions, enableRowSelection, enableSorting, showPagination, showColumnVisibility, toolbarActions, labels, className, tableClassName, variant }: DataTableProps<TData, TValue>): React.JSX.Element;
|
|
175
|
-
//#endregion
|
|
176
174
|
export { DataTable, DataTableBody, DataTableColumnHeader, DataTableHeader, DataTablePagination, DataTableRoot, DataTableToolbar, DataTableViewOptions, type RowData, createDataTableSelectColumn };
|
|
177
175
|
//# sourceMappingURL=data-table.d.ts.map
|