@uselets/ui 1.18.3 → 1.18.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{combobox-oMHLoLqV.js → combobox-ITDBYTtM.js} +2 -2
- package/dist/{combobox-oMHLoLqV.js.map → combobox-ITDBYTtM.js.map} +1 -1
- package/dist/{command-Ce8Ojl-B.js → command-BxkAy8PP.js} +2 -2
- package/dist/{command-Ce8Ojl-B.js.map → command-BxkAy8PP.js.map} +1 -1
- package/dist/components/accordion.spec.js +1 -1
- package/dist/components/alert-dialog.spec.js +1 -1
- package/dist/components/alert.spec.js +1 -1
- package/dist/components/anchor.spec.js +1 -1
- package/dist/components/area-chart.spec.js +1 -1
- package/dist/components/avatar.spec.js +1 -1
- package/dist/components/badge.spec.js +1 -1
- package/dist/components/bar-chart.spec.js +1 -1
- package/dist/components/breadcrumb.spec.js +1 -1
- package/dist/components/button-group.spec.js +1 -1
- package/dist/components/button.spec.js +1 -1
- package/dist/components/calendar.spec.js +1 -1
- package/dist/components/card.spec.js +1 -1
- package/dist/components/carousel.spec.js +1 -1
- package/dist/components/center.spec.js +1 -1
- package/dist/components/chart.spec.js +1 -1
- package/dist/components/checkbox.spec.js +1 -1
- package/dist/components/code.spec.js +1 -1
- package/dist/components/collapsible.spec.js +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/combobox.spec.js +1 -1
- package/dist/components/command.js +1 -1
- package/dist/components/command.spec.js +1 -1
- package/dist/components/container.spec.js +1 -1
- package/dist/components/data-table.js +1 -1
- package/dist/components/data-table.spec.js +1 -1
- package/dist/components/date-range-picker.js +1 -1
- package/dist/components/date-range-picker.spec.js +1 -1
- package/dist/components/dialog.spec.js +1 -1
- package/dist/components/donut-chart.spec.js +1 -1
- package/dist/components/drawer.spec.js +1 -1
- package/dist/components/dropdown-menu.spec.js +1 -1
- package/dist/components/dropzone.spec.js +1 -1
- package/dist/components/empty.spec.js +1 -1
- package/dist/components/field.spec.js +1 -1
- package/dist/components/flex.spec.js +1 -1
- package/dist/components/grid.spec.js +1 -1
- package/dist/components/group.spec.js +1 -1
- package/dist/components/heading.spec.js +1 -1
- package/dist/components/hover-card.spec.js +1 -1
- package/dist/components/input-group.js +1 -1
- package/dist/components/input-group.spec.js +1 -1
- package/dist/components/input-otp.spec.js +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/input.spec.js +1 -1
- package/dist/components/input.spec.js.map +1 -1
- package/dist/components/kbd.spec.js +1 -1
- package/dist/components/label.spec.js +1 -1
- package/dist/components/list.spec.js +1 -1
- package/dist/components/logo.spec.js +1 -1
- package/dist/components/marker.spec.js +1 -1
- package/dist/components/mask-input.js +1 -1
- package/dist/components/mask-input.spec.js +1 -1
- package/dist/components/native-select.js +1 -1
- package/dist/components/native-select.spec.js +1 -1
- package/dist/components/navigation-menu.spec.js +1 -1
- package/dist/components/number-field.spec.js +1 -1
- package/dist/components/pagination.spec.js +1 -1
- package/dist/components/phone-input.js +1 -1
- package/dist/components/phone-input.spec.js +1 -1
- package/dist/components/pie-chart.spec.js +1 -1
- package/dist/components/popover.spec.js +1 -1
- package/dist/components/progress.spec.js +1 -1
- package/dist/components/radio-group.spec.js +1 -1
- package/dist/components/resizable.spec.js +1 -1
- package/dist/components/ring-progress.spec.js +1 -1
- package/dist/components/scroll-area.spec.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/select.spec.js +1 -1
- package/dist/components/separator.spec.js +1 -1
- package/dist/components/sidebar.js +1 -1
- package/dist/components/sidebar.spec.js +1 -1
- package/dist/components/simple-grid.spec.js +1 -1
- package/dist/components/skeleton.spec.js +1 -1
- package/dist/components/slider.spec.js +1 -1
- package/dist/components/sonner.spec.js +1 -1
- package/dist/components/spinner.spec.js +1 -1
- package/dist/components/stack.spec.js +1 -1
- package/dist/components/stepper.spec.js +1 -1
- package/dist/components/switch.spec.js +1 -1
- package/dist/components/table.spec.js +1 -1
- package/dist/components/tabs.spec.js +1 -1
- package/dist/components/text.spec.js +1 -1
- package/dist/components/textarea.js +1 -1
- package/dist/components/textarea.spec.js +1 -1
- package/dist/components/theme.spec.js +1 -1
- package/dist/components/timeline.spec.js +1 -1
- package/dist/components/toggle-group.spec.js +1 -1
- package/dist/components/toggle.spec.js +1 -1
- package/dist/components/tooltip.spec.js +1 -1
- package/dist/components/unstyled-button.spec.js +1 -1
- package/dist/components/visibility.spec.js +1 -1
- package/dist/{data-table-tnfPcXqc.js → data-table-BGfSiHDT.js} +2 -2
- package/dist/{data-table-tnfPcXqc.js.map → data-table-BGfSiHDT.js.map} +1 -1
- package/dist/{date-range-picker-w3ZVRIII.js → date-range-picker-BjkVzFWQ.js} +2 -2
- package/dist/{date-range-picker-w3ZVRIII.js.map → date-range-picker-BjkVzFWQ.js.map} +1 -1
- package/dist/hooks/use-breakpoint-value.spec.js +1 -1
- package/dist/hooks/use-breakpoint-value.spec.js.map +1 -1
- package/dist/hooks/use-breakpoint.spec.js +1 -1
- package/dist/hooks/use-disclosure.spec.js +1 -1
- package/dist/hooks/use-document-visibility.spec.js +1 -1
- package/dist/hooks/use-hotkeys.spec.js +1 -1
- package/dist/hooks/use-idle.spec.js +1 -1
- package/dist/hooks/use-interval.spec.js +1 -1
- package/dist/hooks/use-local-storage.spec.js +1 -1
- package/dist/hooks/use-mask.spec.js +1 -1
- package/dist/hooks/use-mobile.spec.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{input-BhEEV_nn.js → input-CJLsPlXh.js} +2 -2
- package/dist/{input-BhEEV_nn.js.map → input-CJLsPlXh.js.map} +1 -1
- package/dist/{input-group-BUTp8vYe.js → input-group-mcar-tED.js} +2 -2
- package/dist/{input-group-BUTp8vYe.js.map → input-group-mcar-tED.js.map} +1 -1
- package/dist/{mask-input-BnifHAsJ.js → mask-input-cCmVKrHj.js} +2 -2
- package/dist/{mask-input-BnifHAsJ.js.map → mask-input-cCmVKrHj.js.map} +1 -1
- package/dist/{native-select-DZW3Y7nq.js → native-select-Iq25QUH-.js} +2 -2
- package/dist/native-select-Iq25QUH-.js.map +1 -0
- package/dist/{phone-input-ambhiSLO.js → phone-input-DqgYa1un.js} +2 -2
- package/dist/{phone-input-ambhiSLO.js.map → phone-input-DqgYa1un.js.map} +1 -1
- package/dist/{react.esm-BkhVXJ8s.js → react.esm-dE9nuHcL.js} +2 -2
- package/dist/{react.esm-BkhVXJ8s.js.map → react.esm-dE9nuHcL.js.map} +1 -1
- package/dist/select-CVwVLyWt.js +2 -0
- package/dist/select-CVwVLyWt.js.map +1 -0
- package/dist/{sidebar-f9maf3VF.js → sidebar-CJriMotD.js} +2 -2
- package/dist/{sidebar-f9maf3VF.js.map → sidebar-CJriMotD.js.map} +1 -1
- package/dist/skills/uselets-ui/references/package-guide.md +1 -1
- package/dist/styles/gomax.css +2 -0
- package/dist/styles/max.css +2 -0
- package/dist/styles/theme.css +1 -0
- package/dist/textarea-eJQTMC_d.js +2 -0
- package/dist/textarea-eJQTMC_d.js.map +1 -0
- package/package.json +13 -13
- package/skills/uselets-ui/references/package-guide.md +1 -1
- package/dist/native-select-DZW3Y7nq.js.map +0 -1
- package/dist/select-C3QYNv4t.js +0 -2
- package/dist/select-C3QYNv4t.js.map +0 -1
- package/dist/textarea-C8zrf9Rz.js +0 -2
- package/dist/textarea-C8zrf9Rz.js.map +0 -1
package/README.md
CHANGED
|
@@ -309,7 +309,7 @@ Use semantic tokens for application UI instead of hardcoding palette steps in co
|
|
|
309
309
|
|
|
310
310
|
- Surfaces and text: `background`, `foreground`, `card`, `popover`
|
|
311
311
|
- Actions and emphasis: `primary`, `secondary`, `accent`, `destructive`
|
|
312
|
-
- Supporting tokens: `border`, `input`, `ring`
|
|
312
|
+
- Supporting tokens: `border`, `input`, `ring`, `placeholder`
|
|
313
313
|
- Sidebar tokens: `sidebar`, `sidebar-primary`, `sidebar-accent`, `sidebar-border`, `sidebar-ring`
|
|
314
314
|
- Data viz tokens: `chart-1` to `chart-5`
|
|
315
315
|
- Component-scoped tokens: `--logo-foreground` (used by the Intelitrack, Neutra, Kovra, and Fibonash logos' `color` tone so they stay legible in dark mode) and `--rd-logo-foreground` (used by the RD logo's wordmark for the same reason)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./rolldown-runtime-Bdj-bS2b.js";import{t as e}from"./utils-DP9KtG7I.js";import{t}from"./button-oI3hbOgp.js";import{d as n}from"./field-DzR-XrO7.js";import{i as r,n as i,r as a,t as o}from"./input-group-
|
|
2
|
-
//# sourceMappingURL=combobox-
|
|
1
|
+
import"./rolldown-runtime-Bdj-bS2b.js";import{t as e}from"./utils-DP9KtG7I.js";import{t}from"./button-oI3hbOgp.js";import{d as n}from"./field-DzR-XrO7.js";import{i as r,n as i,r as a,t as o}from"./input-group-mcar-tED.js";import{IconCheck as s,IconSelector as c,IconX as l}from"@tabler/icons-react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import*as f from"react";import{Combobox as p}from"@base-ui/react";const m=p.Root;function ComboboxValue({...e}){return u(p.Value,{"data-slot":`combobox-value`,...e})}function ComboboxTrigger({className:t,children:n,icon:r=u(c,{className:`pointer-events-none size-4 text-muted-foreground`}),...i}){return d(p.Trigger,{"data-slot":`combobox-trigger`,className:e(`[&_svg:not([class*='size-'])]:size-4`,t),...i,children:[n,r]})}function ComboboxClear({className:t,...n}){return u(p.Clear,{"data-slot":`combobox-clear`,render:u(a,{variant:`ghost`,size:`icon-xs`}),className:e(t),...n,children:u(l,{className:`pointer-events-none`})})}function ComboboxInput({className:t,children:s,disabled:c=!1,icon:l,id:f,showTrigger:m=!0,showClear:h=!1,triggerIcon:g,..._}){let v=n(f);return d(o,{className:e(`w-auto`,t),children:[l&&u(i,{align:`inline-start`,children:l}),u(p.Input,{id:v,render:u(r,{disabled:c}),..._}),d(i,{align:`inline-end`,children:[m&&u(a,{size:`icon-xs`,variant:`ghost`,asChild:!0,"data-slot":`input-group-button`,className:`group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent`,disabled:c,children:u(ComboboxTrigger,{icon:g})}),h&&u(ComboboxClear,{disabled:c})]}),s]})}function ComboboxContent({className:t,side:n=`bottom`,sideOffset:r=6,align:i=`start`,alignOffset:a=0,anchor:o,container:s,...c}){return u(p.Portal,{container:s,className:`absolute`,children:u(p.Positioner,{side:n,sideOffset:r,align:i,alignOffset:a,anchor:o,className:`isolate z-50`,children:u(p.Popup,{"data-slot":`combobox-content`,"data-chips":!!o,className:e(`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!`,t),...c})})})}function ComboboxList({className:t,...n}){return u(p.List,{"data-slot":`combobox-list`,className:e(`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`,t),...n})}function ComboboxItem({className:t,children:n,...r}){return d(p.Item,{"data-slot":`combobox-item`,className:e(`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`,t),...r,children:[n,u(p.ItemIndicator,{render:u(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:u(s,{className:`pointer-events-none`})})]})}function ComboboxGroup({className:t,...n}){return u(p.Group,{"data-slot":`combobox-group`,className:e(t),...n})}function ComboboxLabel({className:t,...n}){return u(p.GroupLabel,{"data-slot":`combobox-label`,className:e(`px-2 py-1.5 text-xs text-muted-foreground`,t),...n})}function ComboboxCollection({...e}){return u(p.Collection,{"data-slot":`combobox-collection`,...e})}function ComboboxEmpty({className:t,...n}){return u(p.Empty,{"data-slot":`combobox-empty`,className:e(`hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex`,t),...n})}function ComboboxSeparator({className:t,...n}){return u(p.Separator,{"data-slot":`combobox-separator`,className:e(`-mx-1 my-1 h-px bg-border`,t),...n})}function ComboboxChips({className:n,children:r,showClear:i=!1,...a}){return d(p.Chips,{"data-slot":`combobox-chips`,className:e(`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),...a,children:[r,i&&u(p.Clear,{"data-slot":`combobox-chips-clear`,render:u(t,{variant:`ghost`,color:`zinc`,size:`icon-xs`}),className:`shrink-0 self-center size-5`,children:u(l,{className:`pointer-events-none`})})]})}function ComboboxChip({className:n,children:r,showRemove:i=!0,...a}){return d(p.Chip,{"data-slot":`combobox-chip`,className:e(`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),...a,children:[u(`span`,{className:`flex-1 truncate`,children:r}),i&&u(p.ChipRemove,{render:u(t,{variant:`ghost`,color:`zinc`,size:`icon-xs`}),className:`-ml-1 opacity-50 shrink-0 hover:opacity-100`,"data-slot":`combobox-chip-remove`,children:u(l,{className:`pointer-events-none`})})]})}function ComboboxChipsInput({className:t,id:r,...i}){let a=n(r);return u(p.Input,{id:a,"data-slot":`combobox-chip-input`,className:e(`min-w-16 flex-1 outline-none`,t),...i})}function useComboboxAnchor(){return f.useRef(null)}export{useComboboxAnchor as _,ComboboxClear as a,ComboboxEmpty as c,ComboboxItem as d,ComboboxLabel as f,ComboboxValue as g,ComboboxTrigger as h,ComboboxChipsInput as i,ComboboxGroup as l,ComboboxSeparator as m,ComboboxChip as n,ComboboxCollection as o,ComboboxList as p,ComboboxChips as r,ComboboxContent as s,m as t,ComboboxInput as u};
|
|
2
|
+
//# sourceMappingURL=combobox-ITDBYTtM.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox-oMHLoLqV.js","names":["Combobox","ComboboxPrimitive"],"sources":["../src/components/combobox.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react'\nimport { IconCheck, IconSelector, IconX } from '@tabler/icons-react'\n\nimport { cn } from '../lib/utils'\nimport { Button } from './button'\nimport { useFieldControlId } from './field'\nimport { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from './input-group'\n\nexport type ComboboxProps = React.ComponentProps<typeof ComboboxPrimitive.Root>\n\nexport type ComboboxValueProps = ComboboxPrimitive.Value.Props\n\nexport type ComboboxTriggerProps = ComboboxPrimitive.Trigger.Props & {\n icon?: React.ReactNode\n}\n\nexport type ComboboxClearProps = ComboboxPrimitive.Clear.Props\n\nexport type ComboboxInputProps = ComboboxPrimitive.Input.Props & {\n icon?: React.ReactNode\n triggerIcon?: React.ReactNode\n showTrigger?: boolean\n showClear?: boolean\n}\n\nexport type ComboboxContentProps = ComboboxPrimitive.Popup.Props &\n Pick<ComboboxPrimitive.Positioner.Props, 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor'> &\n Pick<ComboboxPrimitive.Portal.Props, 'container'>\n\nexport type ComboboxListProps = ComboboxPrimitive.List.Props\n\nexport type ComboboxItemProps = ComboboxPrimitive.Item.Props\n\nexport type ComboboxGroupProps = ComboboxPrimitive.Group.Props\n\nexport type ComboboxLabelProps = ComboboxPrimitive.GroupLabel.Props\n\nexport type ComboboxCollectionProps = ComboboxPrimitive.Collection.Props\n\nexport type ComboboxEmptyProps = ComboboxPrimitive.Empty.Props\n\nexport type ComboboxSeparatorProps = ComboboxPrimitive.Separator.Props\n\nexport type ComboboxChipsProps = React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> &\n ComboboxPrimitive.Chips.Props & {\n showClear?: boolean\n }\n\nexport type ComboboxChipProps = ComboboxPrimitive.Chip.Props & {\n showRemove?: boolean\n}\n\nexport type ComboboxChipsInputProps = ComboboxPrimitive.Input.Props\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 ...props\n}: ComboboxTriggerProps) {\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n className={cn(\"[&_svg:not([class*='size-'])]:size-4\", className)}\n {...props}\n >\n {children}\n {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={cn(className)}\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 side = 'bottom',\n sideOffset = 6,\n align = 'start',\n alignOffset = 0,\n anchor,\n container,\n ...props\n}: ComboboxContentProps) {\n return (\n <ComboboxPrimitive.Portal container={container} className=\"absolute\">\n <ComboboxPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className=\"isolate z-50\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n data-chips={!!anchor}\n className={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 className\n )}\n {...props}\n />\n </ComboboxPrimitive.Positioner>\n </ComboboxPrimitive.Portal>\n )\n}\n\nfunction ComboboxList({ className, ...props }: ComboboxListProps) {\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n className={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 className\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxItem({ className, children, ...props }: ComboboxItemProps) {\n return (\n <ComboboxPrimitive.Item\n data-slot=\"combobox-item\"\n className={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 className\n )}\n {...props}\n >\n {children}\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 </ComboboxPrimitive.Item>\n )\n}\n\nfunction ComboboxGroup({ className, ...props }: ComboboxGroupProps) {\n return <ComboboxPrimitive.Group data-slot=\"combobox-group\" className={cn(className)} {...props} />\n}\n\nfunction ComboboxLabel({ className, ...props }: ComboboxLabelProps) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-label\"\n className={cn('px-2 py-1.5 text-xs text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxCollection({ ...props }: ComboboxCollectionProps) {\n return <ComboboxPrimitive.Collection data-slot=\"combobox-collection\" {...props} />\n}\n\nfunction ComboboxEmpty({ className, ...props }: ComboboxEmptyProps) {\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={cn(\n 'hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxSeparator({ className, ...props }: ComboboxSeparatorProps) {\n return (\n <ComboboxPrimitive.Separator\n data-slot=\"combobox-separator\"\n className={cn('-mx-1 my-1 h-px bg-border', className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxChips({ className, children, showClear = false, ...props }: ComboboxChipsProps) {\n return (\n <ComboboxPrimitive.Chips\n data-slot=\"combobox-chips\"\n className={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 className\n )}\n {...props}\n >\n {children}\n {showClear && (\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, ...props }: ComboboxChipProps) {\n return (\n <ComboboxPrimitive.Chip\n data-slot=\"combobox-chip\"\n className={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 className\n )}\n {...props}\n >\n <span className=\"flex-1 truncate\">{children}</span>\n {showRemove && (\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, ...props }: ComboboxChipsInputProps) {\n const fieldControlId = useFieldControlId(id)\n\n return (\n <ComboboxPrimitive.Input\n id={fieldControlId}\n data-slot=\"combobox-chip-input\"\n className={cn('min-w-16 flex-1 outline-none', className)}\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":"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"}
|
|
1
|
+
{"version":3,"file":"combobox-ITDBYTtM.js","names":["Combobox","ComboboxPrimitive"],"sources":["../src/components/combobox.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react'\nimport { IconCheck, IconSelector, IconX } from '@tabler/icons-react'\n\nimport { cn } from '../lib/utils'\nimport { Button } from './button'\nimport { useFieldControlId } from './field'\nimport { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from './input-group'\n\nexport type ComboboxProps = React.ComponentProps<typeof ComboboxPrimitive.Root>\n\nexport type ComboboxValueProps = ComboboxPrimitive.Value.Props\n\nexport type ComboboxTriggerProps = ComboboxPrimitive.Trigger.Props & {\n icon?: React.ReactNode\n}\n\nexport type ComboboxClearProps = ComboboxPrimitive.Clear.Props\n\nexport type ComboboxInputProps = ComboboxPrimitive.Input.Props & {\n icon?: React.ReactNode\n triggerIcon?: React.ReactNode\n showTrigger?: boolean\n showClear?: boolean\n}\n\nexport type ComboboxContentProps = ComboboxPrimitive.Popup.Props &\n Pick<ComboboxPrimitive.Positioner.Props, 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor'> &\n Pick<ComboboxPrimitive.Portal.Props, 'container'>\n\nexport type ComboboxListProps = ComboboxPrimitive.List.Props\n\nexport type ComboboxItemProps = ComboboxPrimitive.Item.Props\n\nexport type ComboboxGroupProps = ComboboxPrimitive.Group.Props\n\nexport type ComboboxLabelProps = ComboboxPrimitive.GroupLabel.Props\n\nexport type ComboboxCollectionProps = ComboboxPrimitive.Collection.Props\n\nexport type ComboboxEmptyProps = ComboboxPrimitive.Empty.Props\n\nexport type ComboboxSeparatorProps = ComboboxPrimitive.Separator.Props\n\nexport type ComboboxChipsProps = React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> &\n ComboboxPrimitive.Chips.Props & {\n showClear?: boolean\n }\n\nexport type ComboboxChipProps = ComboboxPrimitive.Chip.Props & {\n showRemove?: boolean\n}\n\nexport type ComboboxChipsInputProps = ComboboxPrimitive.Input.Props\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 ...props\n}: ComboboxTriggerProps) {\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n className={cn(\"[&_svg:not([class*='size-'])]:size-4\", className)}\n {...props}\n >\n {children}\n {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={cn(className)}\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 side = 'bottom',\n sideOffset = 6,\n align = 'start',\n alignOffset = 0,\n anchor,\n container,\n ...props\n}: ComboboxContentProps) {\n return (\n <ComboboxPrimitive.Portal container={container} className=\"absolute\">\n <ComboboxPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className=\"isolate z-50\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n data-chips={!!anchor}\n className={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 className\n )}\n {...props}\n />\n </ComboboxPrimitive.Positioner>\n </ComboboxPrimitive.Portal>\n )\n}\n\nfunction ComboboxList({ className, ...props }: ComboboxListProps) {\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n className={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 className\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxItem({ className, children, ...props }: ComboboxItemProps) {\n return (\n <ComboboxPrimitive.Item\n data-slot=\"combobox-item\"\n className={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 className\n )}\n {...props}\n >\n {children}\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 </ComboboxPrimitive.Item>\n )\n}\n\nfunction ComboboxGroup({ className, ...props }: ComboboxGroupProps) {\n return <ComboboxPrimitive.Group data-slot=\"combobox-group\" className={cn(className)} {...props} />\n}\n\nfunction ComboboxLabel({ className, ...props }: ComboboxLabelProps) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-label\"\n className={cn('px-2 py-1.5 text-xs text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxCollection({ ...props }: ComboboxCollectionProps) {\n return <ComboboxPrimitive.Collection data-slot=\"combobox-collection\" {...props} />\n}\n\nfunction ComboboxEmpty({ className, ...props }: ComboboxEmptyProps) {\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={cn(\n 'hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxSeparator({ className, ...props }: ComboboxSeparatorProps) {\n return (\n <ComboboxPrimitive.Separator\n data-slot=\"combobox-separator\"\n className={cn('-mx-1 my-1 h-px bg-border', className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxChips({ className, children, showClear = false, ...props }: ComboboxChipsProps) {\n return (\n <ComboboxPrimitive.Chips\n data-slot=\"combobox-chips\"\n className={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 className\n )}\n {...props}\n >\n {children}\n {showClear && (\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, ...props }: ComboboxChipProps) {\n return (\n <ComboboxPrimitive.Chip\n data-slot=\"combobox-chip\"\n className={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 className\n )}\n {...props}\n >\n <span className=\"flex-1 truncate\">{children}</span>\n {showRemove && (\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, ...props }: ComboboxChipsInputProps) {\n const fieldControlId = useFieldControlId(id)\n\n return (\n <ComboboxPrimitive.Input\n id={fieldControlId}\n data-slot=\"combobox-chip-input\"\n className={cn('min-w-16 flex-1 outline-none', className)}\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":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-Bdj-bS2b.js";import{t}from"./utils-DP9KtG7I.js";import{d as n}from"./field-DzR-XrO7.js";import{n as r,t as i}from"./input-group-
|
|
2
|
-
//# sourceMappingURL=command-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-Bdj-bS2b.js";import{t}from"./utils-DP9KtG7I.js";import{d as n}from"./field-DzR-XrO7.js";import{n as r,t as i}from"./input-group-mcar-tED.js";import{a,i as o,s,t as c,u as l}from"./dialog-B7I4Ky1i.js";import{IconCheck as u,IconSearch as d}from"@tabler/icons-react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{Command as m}from"cmdk";function Command$1({className:e,...n}){return f(m,{"data-slot":`command`,className:t(`flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground`,e),...n})}e(Command$1,`Command`);function CommandDialog({title:e=`Command Palette`,description:n=`Search for a command to run...`,children:r,className:i,showCloseButton:u=!1,...d}){return p(c,{...d,children:[p(s,{className:`sr-only`,children:[f(l,{children:e}),f(a,{children:n})]}),f(o,{className:t(`top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0`,i),showCloseButton:u,children:r})]})}function CommandInput({className:e,id:a,...o}){let s=n(a);return f(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:p(i,{className:t(`h-8! rounded-lg! border-input/30 bg-input/30 shadow-none!`,`*:data-[slot=input-group-addon]:pl-2!`),children:[f(m.Input,{id:s,"data-slot":`command-input`,className:t(`w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...o}),f(r,{children:f(d,{className:`size-4 shrink-0 opacity-50`})})]})})}function CommandList({className:e,...n}){return f(m.List,{"data-slot":`command-list`,className:t(`no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none`,e),...n})}function CommandEmpty({className:e,...n}){return f(m.Empty,{"data-slot":`command-empty`,className:t(`py-6 text-center text-sm`,e),...n})}function CommandGroup({className:e,...n}){return f(m.Group,{"data-slot":`command-group`,className:t(`overflow-hidden p-1 text-foreground`,`**:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5`,`**:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium`,`**:[[cmdk-group-heading]]:text-muted-foreground`,e),...n})}function CommandSeparator({className:e,...n}){return f(m.Separator,{"data-slot":`command-separator`,className:t(`-mx-1 h-px bg-border`,e),...n})}function CommandItem({className:e,children:n,...r}){return p(m.Item,{"data-slot":`command-item`,className:t(`group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none`,`in-data-[slot=dialog-content]:rounded-lg!`,`data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`,`data-selected:bg-muted data-selected:text-foreground data-selected:*:[svg]:text-foreground`,`[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,f(u,{className:t(`ml-auto opacity-0`,`group-has-data-[slot=command-shortcut]/command-item:hidden`,`group-data-[checked=true]/command-item:opacity-100`)})]})}function CommandShortcut({className:e,...n}){return f(`span`,{"data-slot":`command-shortcut`,className:t(`ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground`,e),...n})}export{CommandInput as a,CommandSeparator as c,CommandGroup as i,CommandShortcut as l,CommandDialog as n,CommandItem as o,CommandEmpty as r,CommandList as s,Command$1 as t};
|
|
2
|
+
//# sourceMappingURL=command-BxkAy8PP.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-
|
|
1
|
+
{"version":3,"file":"command-BxkAy8PP.js","names":["Command","CommandPrimitive"],"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 = React.ComponentProps<typeof Dialog> & {\n title?: string\n description?: string\n className?: string\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 ...props\n}: CommandDialogProps) {\n return (\n <Dialog {...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":"+XAiCA,SAASA,UAAQ,CAAE,YAAW,GAAG,GAAuB,CACtD,OACE,EAACC,EAAD,CACE,YAAU,UACV,UAAW,EACT,6FACA,CACF,EACA,GAAI,CACL,CAAA,CAEL,wBAEA,SAAS,cAAc,CACrB,QAAQ,kBACR,cAAc,iCACd,WACA,YACA,kBAAkB,GAClB,GAAG,GACkB,CACrB,OACE,EAAC,EAAD,CAAQ,GAAI,EAAZ,SAAA,CACE,EAAC,EAAD,CAAc,UAAU,UAAxB,SAAA,CACE,EAAC,EAAD,CAAA,SAAc,CAAmB,CAAA,EACjC,EAAC,EAAD,CAAA,SAAoB,CAA+B,CAAA,CACvC,CACd,CAAA,EAAA,EAAC,EAAD,CACE,UAAW,EAAG,wDAAyD,CAAS,EAC/D,kBAEhB,UACY,CAAA,CACT,GAEZ,CAEA,SAAS,aAAa,CAAE,YAAW,KAAI,GAAG,GAA4B,CACpE,IAAM,EAAiB,EAAkB,CAAE,EAE3C,OACE,EAAC,MAAD,CAAK,YAAU,wBAAwB,UAAU,WAC/C,SAAA,EAAC,EAAD,CACE,UAAW,EACT,4DACA,uCACF,EAJF,SAAA,CAME,EAACA,EAAiB,MAAlB,CACE,GAAI,EACJ,YAAU,gBACV,UAAW,EAAG,gFAAiF,CAAS,EACxG,GAAI,CACL,CAAA,EACD,EAAC,EAAD,CAAA,SACE,EAAC,EAAD,CAAY,UAAU,4BAA8B,CAAA,CACrC,CAAA,CACP,GACT,CAAA,CAET,CAEA,SAAS,YAAY,CAAE,YAAW,GAAG,GAA2B,CAC9D,OACE,EAACA,EAAiB,KAAlB,CACE,YAAU,eACV,UAAW,EAAG,mFAAoF,CAAS,EAC3G,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,aAAa,CAAE,YAAW,GAAG,GAA4B,CAChE,OACE,EAACA,EAAiB,MAAlB,CACE,YAAU,gBACV,UAAW,EAAG,2BAA4B,CAAS,EACnD,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,aAAa,CAAE,YAAW,GAAG,GAA4B,CAChE,OACE,EAACA,EAAiB,MAAlB,CACE,YAAU,gBACV,UAAW,EACT,sCACA,kEACA,0EACA,kDACA,CACF,EACA,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,iBAAiB,CAAE,YAAW,GAAG,GAAgC,CACxE,OACE,EAACA,EAAiB,UAAlB,CACE,YAAU,oBACV,UAAW,EAAG,uBAAwB,CAAS,EAC/C,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,YAAY,CAAE,YAAW,WAAU,GAAG,GAA2B,CACxE,OACE,EAACA,EAAiB,KAAlB,CACE,YAAU,eACV,UAAW,EACT,+HACA,4CACA,2EACA,6FACA,oFACA,CACF,EACA,GAAI,EAVN,SAAA,CAYG,EACD,EAAC,EAAD,CACE,UAAW,EACT,oBACA,6DACA,oDACF,CACD,CAAA,CACoB,GAE3B,CAEA,SAAS,gBAAgB,CAAE,YAAW,GAAG,GAA+B,CACtE,OACE,EAAC,OAAD,CACE,YAAU,mBACV,UAAW,EACT,yGACA,CACF,EACA,GAAI,CACL,CAAA,CAEL"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{i as e,n as t,r as n,t as r}from"../accordion-BCo2odjy.js";import{a as i,n as a,r as o}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{i as e,n as t,r as n,t as r}from"../accordion-BCo2odjy.js";import{a as i,n as a,r as o}from"../react.esm-dE9nuHcL.js";import{jsx as s,jsxs as c}from"react/jsx-runtime";describe(`Accordion`,()=>{it(`renders the root with the default border classes and merges a custom className`,()=>{let{container:i}=o(s(r,{type:`single`,collapsible:!0,className:`custom-accordion`,children:c(n,{value:`item-1`,children:[s(e,{children:`Trigger 1`}),s(t,{children:`Content 1`})]})})),a=i.querySelector(`[data-slot="accordion"]`);expect(a?.className).toContain(`border`),expect(a?.className).toContain(`custom-accordion`)}),it(`expands and collapses an item when its trigger is clicked (single, collapsible)`,()=>{o(s(r,{type:`single`,collapsible:!0,children:c(n,{value:`item-1`,children:[s(e,{children:`Trigger 1`}),s(t,{children:`Content 1`})]})}));let l=i.getByRole(`button`,{name:`Trigger 1`});expect(l.getAttribute(`aria-expanded`)).toBe(`false`),a.click(l),expect(l.getAttribute(`aria-expanded`)).toBe(`true`),expect(i.getByText(`Content 1`)).not.toBeNull(),a.click(l),expect(l.getAttribute(`aria-expanded`)).toBe(`false`)}),it(`allows multiple items to stay expanded at once when type is multiple`,()=>{o(c(r,{type:`multiple`,children:[c(n,{value:`item-1`,children:[s(e,{children:`Trigger 1`}),s(t,{children:`Content 1`})]}),c(n,{value:`item-2`,children:[s(e,{children:`Trigger 2`}),s(t,{children:`Content 2`})]})]})),a.click(i.getByRole(`button`,{name:`Trigger 1`})),a.click(i.getByRole(`button`,{name:`Trigger 2`})),expect(i.getByRole(`button`,{name:`Trigger 1`}).getAttribute(`aria-expanded`)).toBe(`true`),expect(i.getByRole(`button`,{name:`Trigger 2`}).getAttribute(`aria-expanded`)).toBe(`true`)}),describe(`AccordionItem`,()=>{it(`disables the trigger and marks the item disabled when disabled is set`,()=>{let{container:l}=o(s(r,{type:`single`,collapsible:!0,children:c(n,{value:`item-1`,disabled:!0,children:[s(e,{children:`Trigger 1`}),s(t,{children:`Content 1`})]})})),u=i.getByRole(`button`,{name:`Trigger 1`}),d=l.querySelector(`[data-slot="accordion-item"]`);expect(u.disabled).toBe(!0),expect(d?.getAttribute(`data-disabled`)).toBe(``),a.click(u),expect(u.getAttribute(`aria-expanded`)).toBe(`false`)})}),describe(`AccordionTrigger`,()=>{it(`renders both chevron icons with data-slot="accordion-trigger-icon"`,()=>{let{container:i}=o(s(r,{type:`single`,collapsible:!0,children:c(n,{value:`item-1`,children:[s(e,{children:`Trigger 1`}),s(t,{children:`Content 1`})]})}));expect(i.querySelectorAll(`[data-slot="accordion-trigger-icon"]`)).toHaveLength(2)})}),describe(`AccordionContent`,()=>{it(`merges a custom className onto the inner content wrapper`,()=>{o(s(r,{type:`single`,collapsible:!0,defaultValue:`item-1`,children:c(n,{value:`item-1`,children:[s(e,{children:`Trigger 1`}),s(t,{className:`custom-content`,children:`Content 1`})]})})),expect(i.getByText(`Content 1`).className).toContain(`custom-content`)})})});
|
|
2
2
|
//# sourceMappingURL=accordion.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,c as t,d as n,f as r,i,n as a,o,r as s,s as c,t as l}from"../alert-dialog-B_nAiD4Y.js";import{a as u,n as d,o as f,r as p}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,c as t,d as n,f as r,i,n as a,o,r as s,s as c,t as l}from"../alert-dialog-B_nAiD4Y.js";import{a as u,n as d,o as f,r as p}from"../react.esm-dE9nuHcL.js";import{jsx as m,jsxs as h}from"react/jsx-runtime";function renderAlertDialog(u,d){return p(h(l,{children:[m(r,{children:`Delete account`}),h(i,{children:[m(t,{children:`Icon`}),h(c,{children:[m(n,{children:`Are you sure?`}),m(e,{children:`This action cannot be undone.`})]}),h(o,{children:[m(s,{onClick:d,children:`Cancel`}),m(a,{onClick:u,children:`Continue`})]})]})]}))}describe(`AlertDialog`,()=>{it(`is closed until the trigger is clicked, then renders its content in a portal`,async()=>{renderAlertDialog(),expect(u.queryByRole(`alertdialog`)).toBeNull(),d.click(u.getByRole(`button`,{name:`Delete account`})),expect(await u.findByRole(`alertdialog`)).not.toBeNull(),expect(u.getByText(`Are you sure?`)).not.toBeNull(),expect(u.getByText(`This action cannot be undone.`)).not.toBeNull()}),it(`closes and calls the handler when Cancel is clicked`,async()=>{let e=vi.fn();renderAlertDialog(void 0,e),d.click(u.getByRole(`button`,{name:`Delete account`})),await u.findByRole(`alertdialog`),d.click(u.getByRole(`button`,{name:`Cancel`})),expect(e).toHaveBeenCalledTimes(1),await f(()=>expect(u.queryByRole(`alertdialog`)).toBeNull())}),it(`closes and calls the handler when Action is clicked`,async()=>{let e=vi.fn();renderAlertDialog(e),d.click(u.getByRole(`button`,{name:`Delete account`})),await u.findByRole(`alertdialog`),d.click(u.getByRole(`button`,{name:`Continue`})),expect(e).toHaveBeenCalledTimes(1),await f(()=>expect(u.queryByRole(`alertdialog`)).toBeNull())}),describe(`AlertDialogContent`,()=>{it(`defaults to the md size and switches data-size when size="sm" is used`,async()=>{let{unmount:e}=p(m(l,{defaultOpen:!0,children:m(i,{children:m(n,{children:`Title`})})})),t=await u.findByRole(`alertdialog`);expect(t.getAttribute(`data-size`)).toBe(`md`),e(),p(m(l,{defaultOpen:!0,children:m(i,{size:`sm`,children:m(n,{children:`Title`})})}));let r=await u.findByRole(`alertdialog`);expect(r.getAttribute(`data-size`)).toBe(`sm`)})}),describe(`AlertDialogAction and AlertDialogCancel`,()=>{it(`apply Button-derived classes and default variant/color to Action and Cancel`,async()=>{p(m(l,{defaultOpen:!0,children:h(i,{children:[m(n,{children:`Title`}),h(o,{children:[m(s,{children:`Cancel`}),m(a,{children:`Continue`})]})]})}));let e=await u.findByRole(`button`,{name:`Continue`}),t=u.getByRole(`button`,{name:`Cancel`});expect(e.getAttribute(`data-variant`)).toBe(`solid`),expect(e.getAttribute(`data-color`)).toBe(`primary`),expect(t.getAttribute(`data-variant`)).toBe(`outline`),expect(e.className).toContain(`rounded-full`)})})});
|
|
2
2
|
//# sourceMappingURL=alert-dialog.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{i as e,n as t,r as n,t as r}from"../alert-CJRgRQVF.js";import{a as i,r as a}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{i as e,n as t,r as n,t as r}from"../alert-CJRgRQVF.js";import{a as i,r as a}from"../react.esm-dE9nuHcL.js";import{jsx as o,jsxs as s}from"react/jsx-runtime";describe(`Alert`,()=>{it(`renders with role alert and the default variant classes`,()=>{let{container:e}=a(o(r,{children:`Heads up`})),t=e.querySelector(`[data-slot="alert"]`);expect(t).not.toBeNull(),expect(i.getByRole(`alert`).textContent).toBe(`Heads up`),expect(t?.className).toContain(`bg-card`),expect(t?.className).toContain(`text-card-foreground`)}),it(`applies destructive variant classes when variant is destructive`,()=>{let{container:e}=a(o(r,{variant:`destructive`,children:`Danger`}));expect(e.querySelector(`[data-slot="alert"]`)?.className).toContain(`text-destructive`)}),it(`merges a custom className with the variant classes`,()=>{let{container:e}=a(o(r,{className:`custom-alert`,children:`Content`}));expect(e.querySelector(`[data-slot="alert"]`)?.className).toContain(`custom-alert`)}),it(`renders AlertTitle, AlertDescription and AlertAction with their data-slots`,()=>{let{container:c}=a(s(r,{children:[o(e,{children:`Title text`}),o(n,{children:`Description text`}),o(t,{children:o(`button`,{type:`button`,children:`Undo`})})]}));expect(c.querySelector(`[data-slot="alert-title"]`)?.textContent).toBe(`Title text`),expect(c.querySelector(`[data-slot="alert-description"]`)?.textContent).toBe(`Description text`),expect(c.querySelector(`[data-slot="alert-action"]`)?.className).toContain(`absolute`),expect(i.getByRole(`button`,{name:`Undo`})).not.toBeNull()})});
|
|
2
2
|
//# sourceMappingURL=alert.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../anchor-srhmShjN.js";import{a as t,r as n}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../anchor-srhmShjN.js";import{a as t,r as n}from"../react.esm-dE9nuHcL.js";import{jsx as r}from"react/jsx-runtime";describe(`Anchor`,()=>{it(`renders an anchor tag with default variants and data-slot`,()=>{let{container:t}=n(r(e,{href:`/home`,children:`Home`})),i=t.querySelector(`[data-slot="anchor"]`);expect(i).not.toBeNull(),expect(i?.tagName).toBe(`A`),expect(i?.getAttribute(`href`)).toBe(`/home`),expect(i?.getAttribute(`data-size`)).toBe(`md`),expect(i?.getAttribute(`data-underline`)).toBe(`hover`),expect(i?.className).toContain(`text-primary`),expect(i?.className).toContain(`no-underline`)}),it(`applies the requested size variant`,()=>{let{container:t}=n(r(e,{size:`xl`,children:`Large link`})),i=t.querySelector(`[data-slot="anchor"]`);expect(i?.getAttribute(`data-size`)).toBe(`xl`),expect(i?.className).toContain(`text-xl`)}),it(`applies the requested underline variant`,()=>{let{container:t}=n(r(e,{underline:`always`,children:`Always underlined`})),i=t.querySelector(`[data-slot="anchor"]`);expect(i?.getAttribute(`data-underline`)).toBe(`always`),expect(i?.className).toContain(`underline`)}),it(`renders the child element directly when asChild is set`,()=>{n(r(e,{asChild:!0,size:`sm`,underline:`never`,children:r(`a`,{href:`/child`,children:`Child link`})}));let i=t.getByRole(`link`,{name:`Child link`});expect(i.getAttribute(`data-slot`)).toBe(`anchor`),expect(i.getAttribute(`href`)).toBe(`/child`),expect(i.className).toContain(`no-underline`)}),it(`forwards the ref to the underlying anchor element`,()=>{let t={current:null};n(r(e,{ref:t,children:`Ref link`})),expect(t.current).not.toBeNull(),expect(t.current?.tagName).toBe(`A`)})});
|
|
2
2
|
//# sourceMappingURL=anchor.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../area-chart-DdDy8Vm3.js";import{a as t,r as n}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../area-chart-DdDy8Vm3.js";import{a as t,r as n}from"../react.esm-dE9nuHcL.js";import{jsx as r}from"react/jsx-runtime";beforeAll(()=>{vi.stubGlobal(`ResizeObserver`,class{observe(){}unobserve(){}disconnect(){}}),Object.defineProperty(HTMLElement.prototype,"offsetWidth",{configurable:!0,value:500}),Object.defineProperty(HTMLElement.prototype,"offsetHeight",{configurable:!0,value:300}),HTMLElement.prototype.getBoundingClientRect=()=>({width:500,height:300,top:0,left:0,right:500,bottom:300,x:0,y:0,toJSON(){}})});const i=[{month:`January`,desktop:186,mobile:80},{month:`February`,desktop:305,mobile:200},{month:`March`,desktop:237,mobile:120}],a=[{name:`desktop`,label:`Desktop`},{name:`mobile`,label:`Mobile`}];describe(`AreaChart`,()=>{it(`renders with data-slot="area-chart" on the chart wrapper`,()=>{let{container:t}=n(r(e,{data:i,series:a,dataKey:`month`}));expect(t.querySelector(`[data-slot="area-chart"]`)).not.toBeNull()}),it(`accepts a data array and series list without throwing`,()=>{expect(()=>n(r(e,{data:i,series:a,dataKey:`month`}))).not.toThrow()}),it(`renders one recharts area per series entry`,()=>{let{container:t}=n(r(e,{data:i,series:a,dataKey:`month`}));expect(t.querySelectorAll(`.recharts-area`).length).toBe(a.length)}),it(`merges a custom className with the base width class`,()=>{let{container:t}=n(r(e,{data:i,series:a,dataKey:`month`,className:`custom-area`})),o=t.querySelector(`[data-slot="area-chart"]`);expect(o?.className).toContain(`custom-area`),expect(o?.className).toContain(`w-full`)}),it(`renders a tooltip cursor by default and omits it when withTooltip is false`,()=>{let{container:t}=n(r(e,{data:i,series:a,dataKey:`month`}));expect(t.querySelectorAll(`.recharts-tooltip-wrapper`).length).toBe(1);let{container:o}=n(r(e,{data:i,series:a,dataKey:`month`,withTooltip:!1}));expect(o.querySelectorAll(`.recharts-tooltip-wrapper`).length).toBe(0)}),it(`omits the legend by default and renders it when withLegend is true`,()=>{let{container:o}=n(r(e,{data:i,series:a,dataKey:`month`}));expect(o.querySelectorAll(`.recharts-legend-wrapper`).length).toBe(0);let{container:s}=n(r(e,{data:i,series:a,dataKey:`month`,withLegend:!0}));expect(s.querySelectorAll(`.recharts-legend-wrapper`).length).toBe(1),expect(t.getAllByText(`Desktop`).length).toBeGreaterThan(0)}),it(`renders an x-axis and y-axis by default and omits them when disabled`,()=>{let{container:t}=n(r(e,{data:i,series:a,dataKey:`month`}));expect(t.querySelectorAll(`.recharts-xAxis`).length).toBe(1),expect(t.querySelectorAll(`.recharts-yAxis`).length).toBe(1);let{container:o}=n(r(e,{data:i,series:a,dataKey:`month`,withXAxis:!1,withYAxis:!1}));expect(o.querySelectorAll(`.recharts-xAxis`).length).toBe(0),expect(o.querySelectorAll(`.recharts-yAxis`).length).toBe(0)}),it(`omits the cartesian grid when gridAxis is "none"`,()=>{let{container:t}=n(r(e,{data:i,series:a,dataKey:`month`}));expect(t.querySelectorAll(`.recharts-cartesian-grid`).length).toBe(1);let{container:o}=n(r(e,{data:i,series:a,dataKey:`month`,gridAxis:`none`}));expect(o.querySelectorAll(`.recharts-cartesian-grid`).length).toBe(0)}),it(`renders dot markers on the area when withDots is true`,()=>{let{container:t}=n(r(e,{data:i,series:[{name:`desktop`,label:`Desktop`}],dataKey:`month`,withDots:!0}));expect(t.querySelectorAll(`.recharts-area-dots .recharts-dot`).length).toBe(i.length)})});
|
|
2
2
|
//# sourceMappingURL=area-chart.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,i as t,n,o as r,r as i,t as a}from"../avatar-CFUwrOwG.js";import{r as o}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,i as t,n,o as r,r as i,t as a}from"../avatar-CFUwrOwG.js";import{r as o}from"../react.esm-dE9nuHcL.js";import{jsx as s,jsxs as c}from"react/jsx-runtime";describe(`Avatar`,()=>{it(`defaults to the md size and exposes data-size on the root`,()=>{let{container:e}=o(s(a,{children:s(i,{children:`JD`})})),t=e.querySelector(`[data-slot="avatar"]`);expect(t?.getAttribute(`data-size`)).toBe(`md`),expect(t?.className).toContain(`size-8`)}),it(`applies the size-specific data attribute for sm and lg`,()=>{let{container:e,rerender:t}=o(s(a,{size:`sm`,children:s(i,{children:`JD`})}));expect(e.querySelector(`[data-slot="avatar"]`)?.getAttribute(`data-size`)).toBe(`sm`),t(s(a,{size:`lg`,children:s(i,{children:`JD`})})),expect(e.querySelector(`[data-slot="avatar"]`)?.getAttribute(`data-size`)).toBe(`lg`)}),describe(`AvatarImage and AvatarFallback`,()=>{it(`renders the fallback and does not render the image before it has finished loading`,()=>{let{container:e}=o(c(a,{children:[s(r,{src:`https://example.com/avatar.png`,alt:`Jane Doe`}),s(i,{children:`JD`})]}));expect(e.querySelector(`[data-slot="avatar-fallback"]`)?.textContent).toBe(`JD`),expect(e.querySelector(`[data-slot="avatar-image"]`)).toBeNull()}),it(`renders the image and hides the fallback once the image reports a successful load`,()=>{let e=Object.getOwnPropertyDescriptor(HTMLImageElement.prototype,`complete`),t=Object.getOwnPropertyDescriptor(HTMLImageElement.prototype,`naturalWidth`);Object.defineProperty(HTMLImageElement.prototype,"complete",{configurable:!0,get:()=>!0}),Object.defineProperty(HTMLImageElement.prototype,"naturalWidth",{configurable:!0,get:()=>100});try{let{container:e}=o(c(a,{children:[s(r,{src:`https://example.com/avatar.png`,alt:`Jane Doe`}),s(i,{children:`JD`})]}));expect(e.querySelector(`[data-slot="avatar-image"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="avatar-fallback"]`)).toBeNull()}finally{e&&Object.defineProperty(HTMLImageElement.prototype,"complete",e),t&&Object.defineProperty(HTMLImageElement.prototype,"naturalWidth",t)}})}),it(`renders AvatarBadge with the expected classes`,()=>{let{container:e}=o(c(a,{children:[s(i,{children:`JD`}),s(n,{children:`online`})]}));expect(e.querySelector(`[data-slot="avatar-badge"]`)?.className).toContain(`absolute`)}),it(`renders AvatarGroup and AvatarGroupCount composition`,()=>{let{container:n}=o(c(t,{children:[s(a,{children:s(i,{children:`A`})}),s(a,{children:s(i,{children:`B`})}),s(e,{children:`+3`})]}));expect(n.querySelector(`[data-slot="avatar-group"]`)?.className).toContain(`-space-x-2`),expect(n.querySelector(`[data-slot="avatar-group-count"]`)?.textContent).toBe(`+3`)})});
|
|
2
2
|
//# sourceMappingURL=avatar.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../badge-Cuq_DqRS.js";import{a as t,r as n}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../badge-Cuq_DqRS.js";import{a as t,r as n}from"../react.esm-dE9nuHcL.js";import{jsx as r}from"react/jsx-runtime";describe(`Badge`,()=>{it(`renders a span with default variants and data-slot`,()=>{let{container:t}=n(r(e,{children:`New`})),i=t.querySelector(`[data-slot="badge"]`);expect(i).not.toBeNull(),expect(i?.tagName).toBe(`SPAN`),expect(i?.getAttribute(`data-size`)).toBe(`md`),expect(i?.getAttribute(`data-variant`)).toBe(`solid`),expect(i?.getAttribute(`data-color`)).toBe(`primary`),expect(i?.className).toContain(`bg-(--badge-solid)`)}),it(`applies the requested size variant`,()=>{let{container:t}=n(r(e,{size:`xl`,children:`Large`})),i=t.querySelector(`[data-slot="badge"]`);expect(i?.getAttribute(`data-size`)).toBe(`xl`),expect(i?.className).toContain(`h-7`)}),it(`applies the requested variant style`,()=>{let{container:t}=n(r(e,{variant:`outline`,children:`Outline`})),i=t.querySelector(`[data-slot="badge"]`);expect(i?.getAttribute(`data-variant`)).toBe(`outline`),expect(i?.className).toContain(`border-(--badge-outline-border)`)}),it(`applies the requested color token`,()=>{let{container:t}=n(r(e,{color:`red`,children:`Danger`})),i=t.querySelector(`[data-slot="badge"]`);expect(i?.getAttribute(`data-color`)).toBe(`red`),expect(i?.className).toContain(`[--badge-solid:var(--red)]`)}),it(`renders the child element directly when asChild is set`,()=>{n(r(e,{asChild:!0,variant:`subtle`,color:`green`,children:r(`a`,{href:`/status`,children:`Status`})}));let i=t.getByRole(`link`,{name:`Status`});expect(i.getAttribute(`data-slot`)).toBe(`badge`),expect(i.tagName).toBe(`A`)}),it(`forwards the ref to the underlying span element`,()=>{let t={current:null};n(r(e,{ref:t,children:`Ref badge`})),expect(t.current).not.toBeNull(),expect(t.current?.tagName).toBe(`SPAN`)})});
|
|
2
2
|
//# sourceMappingURL=badge.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../bar-chart-DIgSnh_j.js";import{a as t,r as n}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../bar-chart-DIgSnh_j.js";import{a as t,r as n}from"../react.esm-dE9nuHcL.js";import{jsx as r}from"react/jsx-runtime";beforeAll(()=>{vi.stubGlobal(`ResizeObserver`,class{observe(){}unobserve(){}disconnect(){}}),Object.defineProperty(HTMLElement.prototype,"offsetWidth",{configurable:!0,value:500}),Object.defineProperty(HTMLElement.prototype,"offsetHeight",{configurable:!0,value:300}),HTMLElement.prototype.getBoundingClientRect=()=>({width:500,height:300,top:0,left:0,right:500,bottom:300,x:0,y:0,toJSON(){}})});const i=[{month:`January`,desktop:186,mobile:80},{month:`February`,desktop:305,mobile:200},{month:`March`,desktop:237,mobile:120}],a=[{name:`desktop`,label:`Desktop`},{name:`mobile`,label:`Mobile`}];describe(`BarChart`,()=>{it(`renders with data-slot="bar-chart" on the chart wrapper`,()=>{let{container:t}=n(r(e,{data:i,series:a,dataKey:`month`}));expect(t.querySelector(`[data-slot="bar-chart"]`)).not.toBeNull()}),it(`accepts a data array and series list without throwing`,()=>{expect(()=>n(r(e,{data:i,series:a,dataKey:`month`}))).not.toThrow()}),it(`renders one recharts bar group per series entry`,()=>{let{container:t}=n(r(e,{data:i,series:a,dataKey:`month`}));expect(t.querySelectorAll(`.recharts-bar`).length).toBe(a.length)}),it(`renders one rectangle per data point for each series`,()=>{let{container:t}=n(r(e,{data:i,series:a,dataKey:`month`,animationDuration:0}));expect(t.querySelectorAll(`.recharts-rectangle`).length).toBe(i.length*a.length)}),it(`merges a custom className with the base width class`,()=>{let{container:t}=n(r(e,{data:i,series:a,dataKey:`month`,className:`custom-bar`})),o=t.querySelector(`[data-slot="bar-chart"]`);expect(o?.className).toContain(`custom-bar`),expect(o?.className).toContain(`w-full`)}),it(`renders a tooltip cursor by default and omits it when withTooltip is false`,()=>{let{container:t}=n(r(e,{data:i,series:a,dataKey:`month`}));expect(t.querySelectorAll(`.recharts-tooltip-wrapper`).length).toBe(1);let{container:o}=n(r(e,{data:i,series:a,dataKey:`month`,withTooltip:!1}));expect(o.querySelectorAll(`.recharts-tooltip-wrapper`).length).toBe(0)}),it(`omits the legend by default and renders it when withLegend is true`,()=>{let{container:o}=n(r(e,{data:i,series:a,dataKey:`month`}));expect(o.querySelectorAll(`.recharts-legend-wrapper`).length).toBe(0);let{container:s}=n(r(e,{data:i,series:a,dataKey:`month`,withLegend:!0}));expect(s.querySelectorAll(`.recharts-legend-wrapper`).length).toBe(1),expect(t.getAllByText(`Desktop`).length).toBeGreaterThan(0)}),it(`renders an x-axis and y-axis by default and omits them when disabled`,()=>{let{container:t}=n(r(e,{data:i,series:a,dataKey:`month`}));expect(t.querySelectorAll(`.recharts-xAxis`).length).toBe(1),expect(t.querySelectorAll(`.recharts-yAxis`).length).toBe(1);let{container:o}=n(r(e,{data:i,series:a,dataKey:`month`,withXAxis:!1,withYAxis:!1}));expect(o.querySelectorAll(`.recharts-xAxis`).length).toBe(0),expect(o.querySelectorAll(`.recharts-yAxis`).length).toBe(0)}),it(`omits the cartesian grid when gridAxis is "none"`,()=>{let{container:t}=n(r(e,{data:i,series:a,dataKey:`month`}));expect(t.querySelectorAll(`.recharts-cartesian-grid`).length).toBe(1);let{container:o}=n(r(e,{data:i,series:a,dataKey:`month`,gridAxis:`none`}));expect(o.querySelectorAll(`.recharts-cartesian-grid`).length).toBe(0)}),it(`swaps the category axis from x to y when orientation is "horizontal"`,()=>{let{container:t}=n(r(e,{data:i,series:a,dataKey:`month`,orientation:`vertical`}));expect(t.querySelector(`.recharts-xAxis-tick-labels`)?.textContent).toMatch(/[A-Za-z]/),expect(t.querySelector(`.recharts-yAxis-tick-labels`)?.textContent).not.toMatch(/[A-Za-z]/);let{container:o}=n(r(e,{data:i,series:a,dataKey:`month`,orientation:`horizontal`}));expect(o.querySelector(`.recharts-yAxis-tick-labels`)?.textContent).toMatch(/[A-Za-z]/),expect(o.querySelector(`.recharts-xAxis-tick-labels`)?.textContent).not.toMatch(/[A-Za-z]/),expect(o.querySelectorAll(`.recharts-bar`).length).toBe(a.length)}),it(`colors each bar rectangle using a per-row color override when present`,()=>{let{container:t}=n(r(e,{data:[{month:`January`,desktop:186,color:`#ff0000`},{month:`February`,desktop:305}],series:[{name:`desktop`,label:`Desktop`}],dataKey:`month`,animationDuration:0})),i=t.querySelectorAll(`.recharts-rectangle`);expect(i[0]?.getAttribute(`fill`)).toBe(`#ff0000`),expect(i[1]?.getAttribute(`fill`)).not.toBe(`#ff0000`)})});
|
|
2
2
|
//# sourceMappingURL=bar-chart.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"../breadcrumb-CqNDAI8V.js";import{a as s,r as c}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"../breadcrumb-CqNDAI8V.js";import{a as s,r as c}from"../react.esm-dE9nuHcL.js";import{jsx as l,jsxs as u}from"react/jsx-runtime";describe(`Breadcrumb`,()=>{it(`renders a nav element with the breadcrumb aria-label`,()=>{let{container:t}=c(l(o,{children:l(e,{})})),n=t.querySelector(`[data-slot="breadcrumb"]`);expect(n?.tagName).toBe(`NAV`),expect(n?.getAttribute(`aria-label`)).toBe(`breadcrumb`)}),it(`renders a full trail with links, separators and the current page`,()=>{let{container:n}=c(l(o,{children:u(e,{children:[l(i,{children:l(t,{href:`/`,children:`Home`})}),l(a,{}),l(i,{children:l(t,{href:`/library`,children:`Library`})}),l(a,{}),l(i,{children:l(r,{children:`Data`})})]})})),d=s.getByRole(`link`,{name:`Home`});expect(d.getAttribute(`href`)).toBe(`/`);let f=s.getByText(`Data`);expect(f.getAttribute(`aria-current`)).toBe(`page`),expect(n.querySelectorAll(`[data-slot="breadcrumb-separator"]`)).toHaveLength(2)}),describe(`BreadcrumbLink`,()=>{it(`renders as the child element instead of an anchor when asChild is used`,()=>{let{container:e}=c(l(t,{asChild:!0,className:`custom-link`,children:l(`button`,{type:`button`,children:`Go home`})})),n=e.querySelector(`[data-slot="breadcrumb-link"]`);expect(n?.tagName).toBe(`BUTTON`),expect(n?.className).toContain(`custom-link`)})}),describe(`BreadcrumbEllipsis`,()=>{it(`renders a screen-reader-only label and hides itself from the accessibility tree`,()=>{let{container:e}=c(l(n,{})),t=e.querySelector(`[data-slot="breadcrumb-ellipsis"]`);expect(t?.getAttribute(`aria-hidden`)).toBe(`true`),expect(t?.getAttribute(`role`)).toBe(`presentation`),expect(s.getByText(`More`)).not.toBeNull()})}),describe(`BreadcrumbSeparator`,()=>{it(`renders the default chevron icon when no children are provided`,()=>{let{container:e}=c(l(a,{})),t=e.querySelector(`[data-slot="breadcrumb-separator"]`);expect(t?.getAttribute(`role`)).toBe(`presentation`),expect(t?.querySelector(`svg`)).not.toBeNull()}),it(`renders custom separator content instead of the default chevron`,()=>{let{container:e}=c(l(a,{children:`/`}));expect(e.querySelector(`[data-slot="breadcrumb-separator"]`)?.textContent).toBe(`/`)})})});
|
|
2
2
|
//# sourceMappingURL=breadcrumb.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../button-oI3hbOgp.js";import{n as t,r as n,t as r}from"../button-group-WJ5LeouK.js";import{r as i}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../button-oI3hbOgp.js";import{n as t,r as n,t as r}from"../button-group-WJ5LeouK.js";import{r as i}from"../react.esm-dE9nuHcL.js";import{jsx as a,jsxs as o}from"react/jsx-runtime";describe(`ButtonGroup`,()=>{it(`applies the horizontal orientation classes by default without setting data-orientation`,()=>{let{container:t}=i(o(r,{children:[a(e,{children:`One`}),a(e,{children:`Two`})]})),n=t.querySelector(`[data-slot="button-group"]`);expect(n?.getAttribute(`data-orientation`)).toBeNull(),expect(n?.className).toContain(`rounded-l-none`)}),it(`applies vertical orientation classes and sets data-orientation when orientation="vertical"`,()=>{let{container:t}=i(o(r,{orientation:`vertical`,children:[a(e,{children:`One`}),a(e,{children:`Two`})]})),n=t.querySelector(`[data-slot="button-group"]`);expect(n?.getAttribute(`data-orientation`)).toBe(`vertical`),expect(n?.className).toContain(`flex-col`)}),it(`merges a custom className onto the root`,()=>{let{container:t}=i(a(r,{className:`custom-group`,children:a(e,{children:`One`})}));expect(t.querySelector(`[data-slot="button-group"]`)?.className).toContain(`custom-group`)}),describe(`ButtonGroupText`,()=>{it(`renders as a div by default with the expected classes`,()=>{let{container:e}=i(a(n,{children:`Label`})),t=e.querySelector(`div`);expect(t?.textContent).toBe(`Label`),expect(t?.className).toContain(`rounded-lg`)}),it(`renders as the child element when asChild is used`,()=>{let{container:e}=i(a(n,{asChild:!0,children:a(`span`,{children:`Custom`})}));expect(e.querySelector(`span`)?.textContent).toBe(`Custom`),expect(e.querySelector(`div`)).toBeNull()})}),describe(`ButtonGroupSeparator`,()=>{it(`renders with data-slot="button-group-separator" and a vertical orientation by default`,()=>{let{container:e}=i(a(t,{})),n=e.querySelector(`[data-slot="button-group-separator"]`);expect(n?.getAttribute(`data-orientation`)).toBe(`vertical`),expect(n?.className).toContain(`bg-input`)}),it(`supports switching to a horizontal orientation`,()=>{let{container:e}=i(a(t,{orientation:`horizontal`}));expect(e.querySelector(`[data-slot="button-group-separator"]`)?.getAttribute(`data-orientation`)).toBe(`horizontal`)})}),it(`composes buttons and a separator inside a group`,()=>{let{container:n}=i(o(r,{children:[a(e,{children:`One`}),a(t,{}),a(e,{children:`Two`})]})),s=n.querySelector(`[data-slot="button-group"]`);expect(s?.querySelectorAll(`[data-slot="button"]`)).toHaveLength(2),expect(s?.querySelector(`[data-slot="button-group-separator"]`)).not.toBeNull()})});
|
|
2
2
|
//# sourceMappingURL=button-group.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../button-oI3hbOgp.js";import{a as t,n,r}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../button-oI3hbOgp.js";import{a as t,n,r}from"../react.esm-dE9nuHcL.js";import{jsx as i}from"react/jsx-runtime";describe(`Button`,()=>{it(`renders a native button with default variants and data-slot`,()=>{let{container:t}=r(i(e,{children:`Save`})),n=t.querySelector(`[data-slot="button"]`);expect(n).not.toBeNull(),expect(n?.tagName).toBe(`BUTTON`),expect(n?.getAttribute(`type`)).toBe(`button`),expect(n?.getAttribute(`data-variant`)).toBe(`solid`),expect(n?.getAttribute(`data-color`)).toBe(`primary`),expect(n?.getAttribute(`data-size`)).toBe(`md`),expect(n?.getAttribute(`data-loading`)).toBe(`false`),expect(n?.className).toContain(`rounded-full`)}),it(`applies the requested variant, color and size`,()=>{let{container:t}=r(i(e,{variant:`outline`,color:`red`,size:`lg`,children:`Delete`})),n=t.querySelector(`[data-slot="button"]`);expect(n?.getAttribute(`data-variant`)).toBe(`outline`),expect(n?.getAttribute(`data-color`)).toBe(`red`),expect(n?.getAttribute(`data-size`)).toBe(`lg`),expect(n?.className).toContain(`border-(--button-outline-border)`)}),it(`disables the button and blocks clicks when disabled`,()=>{let a=vi.fn();r(i(e,{disabled:!0,onClick:a,children:`Disabled`}));let o=t.getByRole(`button`,{name:`Disabled`});expect(o).toHaveProperty(`disabled`,!0),n.click(o),expect(a).not.toHaveBeenCalled()}),it(`fires onClick when enabled`,()=>{let a=vi.fn();r(i(e,{onClick:a,children:`Submit`})),n.click(t.getByRole(`button`,{name:`Submit`})),expect(a).toHaveBeenCalledTimes(1)}),it(`hides the children and shows a spinner when loading`,()=>{let{container:n}=r(i(e,{loading:!0,children:`Submit`})),a=n.querySelector(`[data-slot="button"]`),o=n.querySelector(`[data-slot="spinner"]`);expect(a?.getAttribute(`data-loading`)).toBe(`true`),expect(a?.getAttribute(`aria-busy`)).toBe(`true`),expect(a).toHaveProperty(`disabled`,!0),expect(o).not.toBeNull(),expect(t.getByText(`Submit`).className).toContain(`invisible`)}),it(`renders the child element directly when asChild is set`,()=>{r(i(e,{asChild:!0,children:i(`a`,{href:`/somewhere`,children:`Go`})}));let n=t.getByRole(`link`,{name:`Go`});expect(n.getAttribute(`data-slot`)).toBe(`button`),expect(n.getAttribute(`type`)).toBeNull()})});
|
|
2
2
|
//# sourceMappingURL=button.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../calendar-CW1kGXom.js";import{a as t,n,r}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../calendar-CW1kGXom.js";import{a as t,n,r}from"../react.esm-dE9nuHcL.js";import{jsx as i}from"react/jsx-runtime";function getCalendarRoot(e){return e.querySelector(`[data-slot="calendar"]`)}function findDayButton(e,t){return Array.from(e.querySelectorAll(`button`)).find(e=>e.textContent?.trim()===t)}describe(`Calendar`,()=>{it(`renders the current month by default`,()=>{let{container:t}=r(i(e,{})),n=t.querySelector(`[data-today="true"]`);expect(n).not.toBeNull(),expect(n?.textContent?.trim()).toBe(String(new Date().getDate()))}),it(`fires onSelect with the clicked date and focuses the day button`,()=>{let t=vi.fn(),{container:a}=r(i(e,{mode:`single`,onSelect:t,defaultMonth:new Date(2024,5,1)})),o=findDayButton(getCalendarRoot(a),`15`);expect(o).toBeDefined(),n.click(o),expect(t).toHaveBeenCalledTimes(1);let s=t.mock.calls[0]?.[0];expect(s.getFullYear()).toBe(2024),expect(s.getMonth()).toBe(5),expect(s.getDate()).toBe(15),expect(document.activeElement).toBe(o)}),it(`moves DOM focus to the adjacent day when navigating with the keyboard`,()=>{let{container:t}=r(i(e,{mode:`single`,defaultMonth:new Date(2024,5,1)})),a=getCalendarRoot(t),o=findDayButton(a,`15`),s=findDayButton(a,`16`);n.click(o),expect(document.activeElement).toBe(o),n.keyDown(o,{key:`ArrowRight`}),expect(document.activeElement).toBe(s)}),it(`navigates to the next and previous month using the nav buttons`,()=>{r(i(e,{defaultMonth:new Date(2024,5,1)})),expect(t.getByText(`June 2024`)).toBeTruthy(),n.click(t.getByRole(`button`,{name:`Go to the Next Month`})),expect(t.getByText(`July 2024`)).toBeTruthy(),n.click(t.getByRole(`button`,{name:`Go to the Previous Month`})),expect(t.getByText(`June 2024`)).toBeTruthy()}),it(`defaults the navigation buttons to the ghost button variant`,()=>{r(i(e,{defaultMonth:new Date(2024,5,1)}));let n=t.getByRole(`button`,{name:`Go to the Previous Month`});expect(n.className).toContain(`button-ghost-hover`)}),it(`applies the buttonVariant prop to the navigation buttons`,()=>{r(i(e,{buttonVariant:`outline`,defaultMonth:new Date(2024,5,1)}));let n=t.getByRole(`button`,{name:`Go to the Previous Month`});expect(n.className).toContain(`button-outline-border`)})});
|
|
2
2
|
//# sourceMappingURL=calendar.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"../card-Bx6iiocl.js";import{r as s}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"../card-Bx6iiocl.js";import{r as s}from"../react.esm-dE9nuHcL.js";import{jsx as c,jsxs as l}from"react/jsx-runtime";describe(`Card`,()=>{it(`defaults to the md size and renders all subcomponent slots`,()=>{let{container:u}=s(l(o,{children:[l(r,{children:[c(a,{children:`Title`}),c(t,{children:`Description`}),c(n,{children:`Action`})]}),c(i,{children:`Content`}),c(e,{children:`Footer`})]}));expect(u.querySelector(`[data-slot="card"]`)?.getAttribute(`data-size`)).toBe(`md`),expect(u.querySelector(`[data-slot="card-header"]`)).not.toBeNull(),expect(u.querySelector(`[data-slot="card-title"]`)?.textContent).toBe(`Title`),expect(u.querySelector(`[data-slot="card-description"]`)?.textContent).toBe(`Description`),expect(u.querySelector(`[data-slot="card-action"]`)?.textContent).toBe(`Action`),expect(u.querySelector(`[data-slot="card-content"]`)?.textContent).toBe(`Content`),expect(u.querySelector(`[data-slot="card-footer"]`)?.textContent).toBe(`Footer`)}),it(`applies size-specific data attribute and classes for sm and lg`,()=>{let{container:e,rerender:t}=s(c(o,{size:`sm`,children:`Body`})),n=e.querySelector(`[data-slot="card"]`);expect(n?.getAttribute(`data-size`)).toBe(`sm`),expect(n?.className).toContain(`data-[size=sm]:py-3`),t(c(o,{size:`lg`,children:`Body`})),n=e.querySelector(`[data-slot="card"]`),expect(n?.getAttribute(`data-size`)).toBe(`lg`),expect(n?.className).toContain(`data-[size=lg]:py-6`)}),it(`merges a custom className onto the root`,()=>{let{container:e}=s(c(o,{className:`custom-card`,children:`Body`}));expect(e.querySelector(`[data-slot="card"]`)?.className).toContain(`custom-card`)}),it(`merges custom classNames onto each subcomponent`,()=>{let{container:u}=s(l(o,{children:[l(r,{className:`custom-header`,children:[c(a,{className:`custom-title`,children:`Title`}),c(t,{className:`custom-description`,children:`Description`}),c(n,{className:`custom-action`,children:`Action`})]}),c(i,{className:`custom-content`,children:`Content`}),c(e,{className:`custom-footer`,children:`Footer`})]}));expect(u.querySelector(`[data-slot="card-header"]`)?.className).toContain(`custom-header`),expect(u.querySelector(`[data-slot="card-title"]`)?.className).toContain(`custom-title`),expect(u.querySelector(`[data-slot="card-description"]`)?.className).toContain(`custom-description`),expect(u.querySelector(`[data-slot="card-action"]`)?.className).toContain(`custom-action`),expect(u.querySelector(`[data-slot="card-content"]`)?.className).toContain(`custom-content`),expect(u.querySelector(`[data-slot="card-footer"]`)?.className).toContain(`custom-footer`)})});
|
|
2
2
|
//# sourceMappingURL=card.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,i as t,n,r,t as i}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,i as t,n,r,t as i}from"../react.esm-dE9nuHcL.js";import{jsx as a,jsxs as o}from"react/jsx-runtime";const{emblaMock:s,useEmblaCarouselMock:c}=vi.hoisted(()=>{let e={canScrollPrev:vi.fn(),canScrollNext:vi.fn(),selectedScrollSnap:vi.fn(),scrollSnapList:vi.fn(),scrollPrev:vi.fn(),scrollNext:vi.fn(),scrollTo:vi.fn(),on:vi.fn(),off:vi.fn()},t=vi.fn((...t)=>[vi.fn(),e]);return{emblaMock:{api:e},useEmblaCarouselMock:t}});vi.mock(`embla-carousel-react`,()=>({default:c}));const{Carousel:l,CarouselContent:u,CarouselIndicators:d,CarouselItem:f,CarouselNext:p,CarouselPrevious:m,useCarousel:h}=await import(`./carousel.js`);function triggerSelect(){let e=s.api.on.mock.calls.find(([e])=>e===`select`)?.[1];i(()=>e?.(s.api))}function renderCarousel(e={}){return r(o(l,{...e,children:[o(u,{children:[a(f,{children:`First`}),a(f,{children:`Second`}),a(f,{children:`Third`})]}),a(m,{}),a(p,{}),a(d,{})]}))}describe(`Carousel`,()=>{beforeEach(()=>{s.api.canScrollPrev.mockReturnValue(!1),s.api.canScrollNext.mockReturnValue(!1),s.api.selectedScrollSnap.mockReturnValue(0),s.api.scrollSnapList.mockReturnValue([])}),it(`throws when used outside a <Carousel />`,()=>{expect(()=>t(()=>h())).toThrow(`useCarousel must be used within a <Carousel />`)}),it(`renders the section with the carousel data-slot and merges a custom className`,()=>{let{container:e}=renderCarousel({className:`custom-carousel`}),t=e.querySelector(`[data-slot="carousel"]`);expect(t?.tagName).toBe(`SECTION`),expect(t?.className).toContain(`custom-carousel`)}),it(`defaults to the horizontal axis`,()=>{renderCarousel();let e=c.mock.calls.at(-1)?.[0];expect(e?.axis).toBe(`x`)}),it(`maps the vertical orientation to the y axis`,()=>{renderCarousel({orientation:`vertical`});let e=c.mock.calls.at(-1)?.[0];expect(e?.axis).toBe(`y`)}),it(`calls setApi with the embla api once mounted`,()=>{let e=vi.fn();renderCarousel({setApi:e}),expect(e).toHaveBeenCalledWith(s.api)}),it(`subscribes to reInit/select on mount and unsubscribes on unmount`,()=>{let{unmount:e}=renderCarousel();expect(s.api.on).toHaveBeenCalledWith(`reInit`,expect.any(Function)),expect(s.api.on).toHaveBeenCalledWith(`select`,expect.any(Function)),e(),expect(s.api.off).toHaveBeenCalledWith(`reInit`,expect.any(Function)),expect(s.api.off).toHaveBeenCalledWith(`select`,expect.any(Function))}),it(`scrolls to the previous slide on ArrowLeft and prevents the default action`,()=>{let{container:e}=renderCarousel(),t=e.querySelector(`[data-slot="carousel"]`),r=n.keyDown(t,{key:`ArrowLeft`});expect(r).toBe(!1),expect(s.api.scrollPrev).toHaveBeenCalledTimes(1)}),it(`scrolls to the next slide on ArrowRight and prevents the default action`,()=>{let{container:e}=renderCarousel(),t=e.querySelector(`[data-slot="carousel"]`),r=n.keyDown(t,{key:`ArrowRight`});expect(r).toBe(!1),expect(s.api.scrollNext).toHaveBeenCalledTimes(1)}),it(`ignores unrelated keys`,()=>{let{container:e}=renderCarousel(),t=e.querySelector(`[data-slot="carousel"]`);n.keyDown(t,{key:`Enter`}),expect(s.api.scrollPrev).not.toHaveBeenCalled(),expect(s.api.scrollNext).not.toHaveBeenCalled()}),describe(`CarouselContent`,()=>{it(`uses the horizontal offset classes by default`,()=>{let{container:e}=renderCarousel(),t=e.querySelector(`[data-slot="carousel-content"]`).firstElementChild;expect(t.className).toContain(`-ml-4`)}),it(`uses the vertical offset classes when the carousel is vertical`,()=>{let{container:e}=renderCarousel({orientation:`vertical`}),t=e.querySelector(`[data-slot="carousel-content"]`).firstElementChild;expect(t.className).toContain(`-mt-4`),expect(t.className).toContain(`flex-col`)})}),describe(`CarouselItem`,()=>{it(`uses the horizontal padding class by default`,()=>{let{container:e}=renderCarousel();expect(e.querySelector(`[data-slot="carousel-item"]`)?.className).toContain(`pl-4`)}),it(`uses the vertical padding class when the carousel is vertical`,()=>{let{container:e}=renderCarousel({orientation:`vertical`});expect(e.querySelector(`[data-slot="carousel-item"]`)?.className).toContain(`pt-4`)})}),describe(`CarouselPrevious`,()=>{it(`is disabled when the carousel cannot scroll back and enabled once the api reports it can`,()=>{s.api.canScrollPrev.mockReturnValue(!1),renderCarousel();let t=e.getByRole(`button`,{name:`Previous slide`});expect(t.hasAttribute(`disabled`)).toBe(!0),s.api.canScrollPrev.mockReturnValue(!0),triggerSelect(),expect(t.hasAttribute(`disabled`)).toBe(!1)}),it(`calls scrollPrev when clicked`,()=>{s.api.canScrollPrev.mockReturnValue(!0),renderCarousel(),n.click(e.getByRole(`button`,{name:`Previous slide`})),expect(s.api.scrollPrev).toHaveBeenCalledTimes(1)})}),describe(`CarouselNext`,()=>{it(`is disabled when the carousel cannot scroll forward and enabled once the api reports it can`,()=>{s.api.canScrollNext.mockReturnValue(!1),renderCarousel();let t=e.getByRole(`button`,{name:`Next slide`});expect(t.hasAttribute(`disabled`)).toBe(!0),s.api.canScrollNext.mockReturnValue(!0),triggerSelect(),expect(t.hasAttribute(`disabled`)).toBe(!1)}),it(`calls scrollNext when clicked`,()=>{s.api.canScrollNext.mockReturnValue(!0),renderCarousel(),n.click(e.getByRole(`button`,{name:`Next slide`})),expect(s.api.scrollNext).toHaveBeenCalledTimes(1)})}),describe(`CarouselIndicators`,()=>{beforeEach(()=>{s.api.canScrollPrev.mockReturnValue(!0),s.api.canScrollNext.mockReturnValue(!0),s.api.selectedScrollSnap.mockReturnValue(1),s.api.scrollSnapList.mockReturnValue([0,1,2])}),it(`renders one indicator button per scroll snap`,async()=>{renderCarousel(),expect(await e.findAllByRole(`button`,{name:/Go to slide/})).toHaveLength(3)}),it(`marks the selected indicator as active`,async()=>{renderCarousel();let t=await e.findByRole(`button`,{name:`Go to slide 2`});expect(t.getAttribute(`data-active`)).toBe(`true`),expect(e.getByRole(`button`,{name:`Go to slide 1`}).getAttribute(`data-active`)).toBeNull()}),it(`scrolls to the indicator index when clicked`,async()=>{renderCarousel(),n.click(await e.findByRole(`button`,{name:`Go to slide 3`})),expect(s.api.scrollTo).toHaveBeenCalledWith(2)}),it(`does not render indicators when there are no scroll snaps`,()=>{s.api.scrollSnapList.mockReturnValue([]);let{container:e}=renderCarousel();expect(e.querySelector(`[data-slot="carousel-indicators"]`)).toBeNull()})})});
|
|
2
2
|
//# sourceMappingURL=carousel.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../center-Dl1rnq7S.js";import{r as t}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../center-Dl1rnq7S.js";import{r as t}from"../react.esm-dE9nuHcL.js";import{jsx as n}from"react/jsx-runtime";describe(`Center`,()=>{it(`renders a div with default variants and data-slot`,()=>{let{container:r}=t(n(e,{children:`Content`})),i=r.querySelector(`[data-slot="center"]`);expect(i).not.toBeNull(),expect(i?.tagName).toBe(`DIV`),expect(i?.getAttribute(`data-direction`)).toBe(`horizontal`),expect(i?.getAttribute(`data-size`)).toBe(`md`),expect(i?.className).toContain(`items-center`),expect(i?.className).toContain(`justify-center`),expect(i?.className).toContain(`flex-row`),expect(i?.className).toContain(`gap-3`)}),it(`applies the vertical direction variant`,()=>{let{container:r}=t(n(e,{direction:`vertical`,children:`Content`})),i=r.querySelector(`[data-slot="center"]`);expect(i?.getAttribute(`data-direction`)).toBe(`vertical`),expect(i?.className).toContain(`flex-col`)}),it(`applies the requested size variant`,()=>{let{container:r}=t(n(e,{size:`xl`,children:`Content`})),i=r.querySelector(`[data-slot="center"]`);expect(i?.getAttribute(`data-size`)).toBe(`xl`),expect(i?.className).toContain(`gap-6`)}),it(`renders children and merges a custom className`,()=>{let{container:r,getByText:i}=t(n(e,{className:`custom-class`,children:`Hello`})),a=r.querySelector(`[data-slot="center"]`);expect(i(`Hello`)).not.toBeNull(),expect(a?.className).toContain(`custom-class`)}),it(`forwards the ref to the underlying div element`,()=>{let r={current:null};t(n(e,{ref:r,children:`Content`})),expect(r.current).not.toBeNull(),expect(r.current?.getAttribute(`data-slot`)).toBe(`center`)})});
|
|
2
2
|
//# sourceMappingURL=center.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{c as e,i as t,l as n,n as r,s as i,t as a}from"../chart-Ci4V8B8v.js";import{a as o,r as s}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{c as e,i as t,l as n,n as r,s as i,t as a}from"../chart-Ci4V8B8v.js";import{a as o,r as s}from"../react.esm-dE9nuHcL.js";import{jsx as c}from"react/jsx-runtime";beforeAll(()=>{vi.stubGlobal(`ResizeObserver`,class{observe(){}unobserve(){}disconnect(){}}),Object.defineProperty(HTMLElement.prototype,"offsetWidth",{configurable:!0,value:500}),Object.defineProperty(HTMLElement.prototype,"offsetHeight",{configurable:!0,value:300}),HTMLElement.prototype.getBoundingClientRect=()=>({width:500,height:300,top:0,left:0,right:500,bottom:300,x:0,y:0,toJSON(){}})});const l={desktop:{label:`Desktop`,color:`#3b82f6`},mobile:{label:`Mobile`,color:`#22c55e`}};describe(`ChartContainer`,()=>{it(`renders its children inside a data-slot="chart" wrapper with a derived data-chart id`,()=>{let{container:e}=s(c(r,{config:l,children:c(`div`,{children:`content`})})),t=e.querySelector(`[data-slot="chart"]`);expect(t).not.toBeNull(),expect(t?.getAttribute(`data-chart`)).toMatch(/^chart-/)}),it(`derives the data-chart attribute from an explicit id prop`,()=>{let{container:e}=s(c(r,{id:`revenue`,config:l,children:c(`div`,{children:`content`})}));expect(e.querySelector(`[data-slot="chart"]`)?.getAttribute(`data-chart`)).toBe(`chart-revenue`)}),it(`merges a custom className with the base chart classes`,()=>{let{container:e}=s(c(r,{config:l,className:`custom-chart`,children:c(`div`,{children:`content`})})),t=e.querySelector(`[data-slot="chart"]`);expect(t?.className).toContain(`custom-chart`),expect(t?.className).toContain(`aspect-video`)}),it(`spreads additional props onto the wrapper div`,()=>{let{container:e}=s(c(r,{config:l,"data-testid":`my-chart`,children:c(`div`,{children:`content`})}));expect(e.querySelector(`[data-testid="my-chart"]`)).not.toBeNull()}),describe(`ChartTooltipContent`,()=>{it(`throws when rendered outside of a ChartContainer`,()=>{expect(()=>s(c(i,{active:!0,payload:[]}))).toThrow(`useChart must be used within a <ChartContainer />`)}),it(`returns null when active is false`,()=>{let{container:e}=s(c(r,{config:l,children:c(i,{active:!1,payload:[{dataKey:`desktop`,name:`desktop`,value:186,payload:{}}]})}));expect(e.querySelector(`.shadow-xl`)).toBeNull()}),it(`returns null when the payload is empty`,()=>{let{container:e}=s(c(r,{config:l,children:c(i,{active:!0,payload:[]})}));expect(e.querySelector(`.shadow-xl`)).toBeNull()}),it(`renders the resolved config label above the item rows`,()=>{let{container:e}=s(c(r,{config:l,children:c(i,{active:!0,payload:[{dataKey:`desktop`,name:`desktop`,value:186,color:`#3b82f6`,payload:{fill:`#3b82f6`}}]})}));expect(e.querySelector(`div.font-medium`)?.textContent).toBe(`Desktop`),expect(o.getByText(`186`)).not.toBeNull()}),it(`hides the label row when hideLabel is set`,()=>{let{container:e}=s(c(r,{config:l,children:c(i,{active:!0,hideLabel:!0,payload:[{dataKey:`desktop`,name:`desktop`,value:186,payload:{}}]})}));expect(e.querySelector(`div.font-medium`)).toBeNull()}),it(`filters out payload items whose type is "none"`,()=>{s(c(r,{config:l,children:c(i,{active:!0,hideLabel:!0,payload:[{dataKey:`desktop`,name:`desktop`,value:186,type:`none`,payload:{}},{dataKey:`mobile`,name:`mobile`,value:305,payload:{}}]})})),expect(o.queryByText(`186`)).toBeNull(),expect(o.getByText(`305`)).not.toBeNull()}),it(`delegates cell rendering to a custom formatter when provided`,()=>{let e=vi.fn(()=>c(`span`,{children:`custom-cell`}));s(c(r,{config:l,children:c(i,{active:!0,hideLabel:!0,formatter:e,payload:[{dataKey:`desktop`,name:`desktop`,value:186,payload:{}}]})})),expect(e).toHaveBeenCalledWith(186,`desktop`,expect.anything(),0,{}),expect(o.getByText(`custom-cell`)).not.toBeNull()})}),describe(`ChartLegendContent`,()=>{it(`throws when rendered outside of a ChartContainer`,()=>{expect(()=>s(c(t,{payload:[]}))).toThrow(`useChart must be used within a <ChartContainer />`)}),it(`returns null when the payload is empty`,()=>{let{container:e}=s(c(r,{config:l,children:c(t,{payload:[]})}));expect(e.querySelector(`[data-slot="chart"]`)?.textContent).toBe(``)}),it(`renders one entry per payload item using the config label`,()=>{s(c(r,{config:l,children:c(t,{payload:[{value:`desktop`,dataKey:`desktop`,color:`#3b82f6`,type:`rect`},{value:`mobile`,dataKey:`mobile`,color:`#22c55e`,type:`rect`}]})})),expect(o.getByText(`Desktop`)).not.toBeNull(),expect(o.getByText(`Mobile`)).not.toBeNull()}),it(`filters out payload items whose type is "none"`,()=>{s(c(r,{config:l,children:c(t,{payload:[{value:`desktop`,dataKey:`desktop`,color:`#3b82f6`,type:`none`},{value:`mobile`,dataKey:`mobile`,color:`#22c55e`}]})})),expect(o.queryByText(`Desktop`)).toBeNull(),expect(o.getByText(`Mobile`)).not.toBeNull()}),it(`applies bottom padding by default and top padding for verticalAlign="top"`,()=>{let{container:e}=s(c(r,{config:l,children:c(t,{payload:[{value:`desktop`,dataKey:`desktop`,color:`#3b82f6`}]})}));expect(e.querySelector(`.flex.items-center.justify-center`)?.className).toContain(`pt-3`);let{container:n}=s(c(r,{config:l,children:c(t,{verticalAlign:`top`,payload:[{value:`desktop`,dataKey:`desktop`,color:`#3b82f6`}]})}));expect(n.querySelector(`.flex.items-center.justify-center`)?.className).toContain(`pb-3`)})})}),describe(`resolveChartColor`,()=>{it(`returns undefined for a falsy value`,()=>{expect(n(void 0)).toBeUndefined(),expect(n(``)).toBeUndefined()}),it.each(a)(`maps the known color key "%s" to its CSS variable`,e=>{expect(n(e)).toBe(`var(--${e})`)}),it(`passes through arbitrary values unchanged`,()=>{expect(n(`#3b82f6`)).toBe(`#3b82f6`)})}),describe(`DEFAULT_CHART_PALETTE`,()=>{it(`exposes five chart color variables in order`,()=>{expect(e).toEqual([`var(--chart-1)`,`var(--chart-2)`,`var(--chart-3)`,`var(--chart-4)`,`var(--chart-5)`])})});
|
|
2
2
|
//# sourceMappingURL=chart.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../field-DzR-XrO7.js";import{t}from"../checkbox-DPvW_m7k.js";import{a as n,n as r,r as i}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../field-DzR-XrO7.js";import{t}from"../checkbox-DPvW_m7k.js";import{a as n,n as r,r as i}from"../react.esm-dE9nuHcL.js";import{jsx as a}from"react/jsx-runtime";describe(`Checkbox`,()=>{it(`renders a standalone checkbox without a wrapping field when no label is given`,()=>{let{container:e}=i(a(t,{}));expect(e.querySelector(`[data-slot="checkbox-field"]`)).toBeNull();let n=e.querySelector(`[data-slot="checkbox"]`);expect(n).not.toBeNull(),expect(n?.getAttribute(`role`)).toBe(`checkbox`),expect(n?.getAttribute(`data-color`)).toBe(`primary`),expect(n?.getAttribute(`data-size`)).toBe(`md`),expect(n?.getAttribute(`id`)).toBeNull()}),it(`wraps the checkbox with a generated label when label is provided`,()=>{i(a(t,{label:`Accept terms`}));let e=n.getByRole(`checkbox`,{name:`Accept terms`}),r=n.getByText(`Accept terms`);expect(e.getAttribute(`id`)).toBeTruthy(),expect(r.getAttribute(`for`)).toBe(e.getAttribute(`id`))}),it(`preserves an explicit id over the generated one`,()=>{i(a(t,{id:`terms-checkbox`,label:`Accept terms`})),expect(document.getElementById(`terms-checkbox`)).not.toBeNull(),expect(n.getByText(`Accept terms`).getAttribute(`for`)).toBe(`terms-checkbox`)}),it(`resolves the id from a surrounding Field when id is omitted`,()=>{i(a(e,{children:a(t,{label:`Subscribe`})}));let r=n.getByRole(`checkbox`,{name:`Subscribe`});expect(r.getAttribute(`id`)).toBeTruthy(),expect(n.getByText(`Subscribe`).getAttribute(`for`)).toBe(r.getAttribute(`id`))}),it(`toggles the checked state when clicked`,()=>{let{container:e}=i(a(t,{})),n=e.querySelector(`[data-slot="checkbox"]`);expect(n.getAttribute(`data-state`)).toBe(`unchecked`),r.click(n),expect(n.getAttribute(`data-state`)).toBe(`checked`)}),it(`applies the requested color and size variants`,()=>{let{container:e}=i(a(t,{color:`blue`,size:`lg`})),n=e.querySelector(`[data-slot="checkbox"]`);expect(n?.getAttribute(`data-color`)).toBe(`blue`),expect(n?.getAttribute(`data-size`)).toBe(`lg`),expect(n?.className).toContain(`size-5`)})});
|
|
2
2
|
//# sourceMappingURL=checkbox.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../code-A6JERAsm.js";import{a as t,r as n}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../code-A6JERAsm.js";import{a as t,r as n}from"../react.esm-dE9nuHcL.js";import{jsx as r}from"react/jsx-runtime";describe(`Code`,()=>{it(`renders a code element with data-slot and the default styling`,()=>{let{container:i}=n(r(e,{children:`const x = 1`})),a=i.querySelector(`[data-slot="code"]`);expect(a).not.toBeNull(),expect(a?.tagName).toBe(`CODE`),expect(t.getByText(`const x = 1`)).not.toBeNull(),expect(a?.className).toContain(`bg-muted`),expect(a?.className).toContain(`font-mono`),expect(a?.className).toContain(`rounded-md`)}),it(`merges a custom className with the base styling`,()=>{let{container:t}=n(r(e,{className:`custom-code`,children:`snippet`})),i=t.querySelector(`[data-slot="code"]`);expect(i?.className).toContain(`custom-code`),expect(i?.className).toContain(`bg-muted`)}),it(`forwards the ref to the underlying code element`,()=>{let t={current:null};n(r(e,{ref:t,children:`ref snippet`})),expect(t.current).not.toBeNull(),expect(t.current?.tagName).toBe(`CODE`)})});
|
|
2
2
|
//# sourceMappingURL=code.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,r as t,t as n}from"../collapsible-BH8BqfTd.js";import{a as r,n as i,r as a}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,r as t,t as n}from"../collapsible-BH8BqfTd.js";import{a as r,n as i,r as a}from"../react.esm-dE9nuHcL.js";import{jsx as o,jsxs as s}from"react/jsx-runtime";describe(`Collapsible`,()=>{it(`renders closed by default and hides the content`,()=>{let{container:i}=a(s(n,{children:[o(t,{children:`Toggle`}),o(e,{children:`Panel content`})]})),c=i.querySelector(`[data-slot="collapsible"]`),l=r.getByRole(`button`,{name:`Toggle`}),u=i.querySelector(`[data-slot="collapsible-content"]`);expect(c?.getAttribute(`data-state`)).toBe(`closed`),expect(l.getAttribute(`aria-expanded`)).toBe(`false`),expect(u?.getAttribute(`data-state`)).toBe(`closed`),expect(u).toHaveProperty(`hidden`,!0),expect(r.queryByText(`Panel content`)).toBeNull()}),it(`opens the content when the trigger is clicked`,()=>{let{container:c}=a(s(n,{children:[o(t,{children:`Toggle`}),o(e,{children:`Panel content`})]}));i.click(r.getByRole(`button`,{name:`Toggle`}));let l=c.querySelector(`[data-slot="collapsible"]`),u=c.querySelector(`[data-slot="collapsible-content"]`);expect(l?.getAttribute(`data-state`)).toBe(`open`),expect(r.getByRole(`button`,{name:`Toggle`}).getAttribute(`aria-expanded`)).toBe(`true`),expect(u).not.toBeNull(),expect(r.getByText(`Panel content`)).not.toBeNull()}),it(`supports a controlled open state with onOpenChange`,()=>{let c=vi.fn();a(s(n,{open:!1,onOpenChange:c,children:[o(t,{children:`Toggle`}),o(e,{children:`Panel content`})]})),i.click(r.getByRole(`button`,{name:`Toggle`})),expect(c).toHaveBeenCalledWith(!0),expect(r.queryByText(`Panel content`)).toBeNull()}),it(`does not toggle when disabled`,()=>{let{container:c}=a(s(n,{disabled:!0,children:[o(t,{children:`Toggle`}),o(e,{children:`Panel content`})]})),l=r.getByRole(`button`,{name:`Toggle`});expect(l).toHaveProperty(`disabled`,!0),i.click(l),expect(c.querySelector(`[data-slot="collapsible"]`)?.getAttribute(`data-state`)).toBe(`closed`)})});
|
|
2
2
|
//# sourceMappingURL=collapsible.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"../combobox-
|
|
1
|
+
import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"../combobox-ITDBYTtM.js";export{h as Combobox,u as ComboboxChip,p as ComboboxChips,s as ComboboxChipsInput,t as ComboboxClear,d as ComboboxCollection,m as ComboboxContent,n as ComboboxEmpty,c as ComboboxGroup,g as ComboboxInput,r as ComboboxItem,i as ComboboxLabel,f as ComboboxList,l as ComboboxSeparator,o as ComboboxTrigger,a as ComboboxValue,e as useComboboxAnchor};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{c as e,d as t,h as n,i as r,n as i,o as a,p as o,r as s,s as c,t as l,u}from"../combobox-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{c as e,d as t,h as n,i as r,n as i,o as a,p as o,r as s,s as c,t as l,u}from"../combobox-ITDBYTtM.js";import{a as d,n as f,o as p,r as m}from"../react.esm-dE9nuHcL.js";import{jsx as h,jsxs as g}from"react/jsx-runtime";import{useState as _}from"react";const v=[{value:`react`,label:`React`},{value:`vue`,label:`Vue`},{value:`svelte`,label:`Svelte`}];function SingleCombobox(){let[n,r]=_(null);return g(l,{items:v,value:n,onValueChange:r,children:[h(u,{placeholder:`Select a framework`,showClear:!0}),h(c,{children:g(o,{children:[h(e,{children:`No results found.`}),h(a,{children:e=>h(t,{value:e,children:e.label},e.value)})]})})]})}function MultipleCombobox(){let[n,u]=_([v[0]]);return g(l,{multiple:!0,items:v,value:n,onValueChange:u,children:[g(s,{showClear:!0,children:[n.map(e=>h(i,{children:e.label},e.value)),h(r,{placeholder:`Add a framework`})]}),h(c,{children:g(o,{children:[h(e,{children:`No results found.`}),h(a,{children:e=>h(t,{value:e,children:e.label},e.value)})]})})]})}describe(`Combobox`,()=>{describe(`ComboboxTrigger`,()=>{it(`renders with data-slot="combobox-trigger" and a default select icon when used standalone`,()=>{let{container:e}=m(h(l,{items:v,children:h(n,{})})),t=e.querySelector(`[data-slot="combobox-trigger"]`);expect(t).not.toBeNull(),expect(t?.querySelector(`svg`)).not.toBeNull()})}),it(`renders a trigger button and the placeholder text inside the input group`,()=>{m(h(SingleCombobox,{})),expect(d.getByRole(`button`)).not.toBeNull(),expect(d.getByPlaceholderText(`Select a framework`)).not.toBeNull()}),it(`opens the popup and lists every item when the trigger is clicked`,async()=>{m(h(SingleCombobox,{})),f.click(d.getByRole(`button`)),expect(await d.findByText(`React`)).not.toBeNull(),expect(d.getByText(`Vue`)).not.toBeNull(),expect(d.getByText(`Svelte`)).not.toBeNull()}),it(`selects an item on click and fills the input with its label`,async()=>{m(h(SingleCombobox,{}));let e=d.getByPlaceholderText(`Select a framework`);f.click(d.getByRole(`button`)),f.click(await d.findByText(`Vue`)),await p(()=>expect(e.value).toBe(`Vue`))}),it(`shows the clear button once a value is selected and clears it when clicked`,async()=>{let{container:e}=m(h(SingleCombobox,{}));expect(e.querySelector(`[data-slot="combobox-clear"]`)).toBeNull();let t=d.getByPlaceholderText(`Select a framework`);f.click(d.getByRole(`button`)),f.click(await d.findByText(`React`)),await p(()=>expect(t.value).toBe(`React`));let n=await p(()=>{let t=e.querySelector(`[data-slot="combobox-clear"]`);return expect(t).not.toBeNull(),t});f.click(n),await p(()=>expect(t.value).toBe(``))}),it(`shows the empty state when the filter query matches nothing`,async()=>{m(h(SingleCombobox,{}));let e=d.getByPlaceholderText(`Select a framework`);f.click(d.getByRole(`button`)),f.change(e,{target:{value:`nonexistent framework`}}),expect(await d.findByText(`No results found.`)).not.toBeNull()}),describe(`multiple selection`,()=>{it(`renders a chip per selected value and an input for adding more`,()=>{let{container:e}=m(h(MultipleCombobox,{}));expect(e.querySelector(`[data-slot="combobox-chips"]`)).not.toBeNull(),expect(e.querySelectorAll(`[data-slot="combobox-chip"]`)).toHaveLength(1),expect(d.getByText(`React`)).not.toBeNull(),expect(d.getByPlaceholderText(`Add a framework`)).not.toBeNull()}),it(`removes a chip when its remove button is clicked`,()=>{let{container:e}=m(h(MultipleCombobox,{})),t=e.querySelector(`[data-slot="combobox-chip"]`).querySelector(`[data-slot="combobox-chip-remove"]`);f.click(t),expect(e.querySelectorAll(`[data-slot="combobox-chip"]`)).toHaveLength(0)})})});
|
|
2
2
|
//# sourceMappingURL=combobox.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"../command-
|
|
1
|
+
import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"../command-BxkAy8PP.js";export{c as Command,i as CommandDialog,o as CommandEmpty,n as CommandGroup,e as CommandInput,a as CommandItem,s as CommandList,t as CommandSeparator,r as CommandShortcut};
|