@epilot/spark-ui 0.25.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/alert-dialog.cjs +4 -2
- package/dist/components/alert-dialog.cjs.map +1 -1
- package/dist/components/alert-dialog.d.cts +4 -1
- package/dist/components/alert-dialog.d.ts +4 -1
- package/dist/components/alert-dialog.js +4 -2
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/autocomplete.cjs +3 -2
- package/dist/components/autocomplete.cjs.map +1 -1
- package/dist/components/autocomplete.js +3 -2
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.js +1 -1
- package/dist/components/badge.js +1 -1
- package/dist/components/banner.cjs +74 -0
- package/dist/components/banner.cjs.map +1 -0
- package/dist/components/banner.d.cts +27 -0
- package/dist/components/banner.d.ts +27 -0
- package/dist/components/banner.js +72 -0
- package/dist/components/banner.js.map +1 -0
- package/dist/components/box.js +1 -1
- package/dist/components/bubble.d.cts +1 -1
- package/dist/components/bubble.d.ts +1 -1
- package/dist/components/button-group.js +1 -1
- package/dist/components/button.d.cts +3 -3
- package/dist/components/button.d.ts +3 -3
- package/dist/components/button.js +1 -1
- package/dist/components/card.js +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/data-list.cjs +39 -0
- package/dist/components/data-list.cjs.map +1 -0
- package/dist/components/data-list.d.cts +33 -0
- package/dist/components/data-list.d.ts +33 -0
- package/dist/components/data-list.js +35 -0
- package/dist/components/data-list.js.map +1 -0
- package/dist/components/dialog.cjs +4 -2
- package/dist/components/dialog.cjs.map +1 -1
- package/dist/components/dialog.d.cts +4 -1
- package/dist/components/dialog.d.ts +4 -1
- package/dist/components/dialog.js +4 -2
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/drawer.cjs +12 -2
- package/dist/components/drawer.cjs.map +1 -1
- package/dist/components/drawer.d.cts +4 -1
- package/dist/components/drawer.d.ts +4 -1
- package/dist/components/drawer.js +13 -3
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.cjs +5 -3
- package/dist/components/dropdown-menu.cjs.map +1 -1
- package/dist/components/dropdown-menu.d.cts +1 -0
- package/dist/components/dropdown-menu.d.ts +1 -0
- package/dist/components/dropdown-menu.js +5 -3
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/empty-state.cjs +107 -25
- package/dist/components/empty-state.cjs.map +1 -1
- package/dist/components/empty-state.d.cts +28 -11
- package/dist/components/empty-state.d.ts +28 -11
- package/dist/components/empty-state.js +104 -26
- package/dist/components/empty-state.js.map +1 -1
- package/dist/components/field.cjs +1 -1
- package/dist/components/field.js +1 -1
- package/dist/components/icon.js +1 -1
- package/dist/components/info-block.d.cts +1 -1
- package/dist/components/info-block.d.ts +1 -1
- package/dist/components/input-otp.cjs +1 -1
- package/dist/components/input-otp.js +1 -1
- package/dist/components/input.cjs +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/kbd.cjs +14 -0
- package/dist/components/kbd.cjs.map +1 -0
- package/dist/components/kbd.d.cts +13 -0
- package/dist/components/kbd.d.ts +13 -0
- package/dist/components/kbd.js +13 -0
- package/dist/components/kbd.js.map +1 -0
- package/dist/components/list.cjs +5 -4
- package/dist/components/list.cjs.map +1 -1
- package/dist/components/list.d.cts +7 -2
- package/dist/components/list.d.ts +7 -2
- package/dist/components/list.js +5 -4
- package/dist/components/list.js.map +1 -1
- package/dist/components/marker.d.cts +1 -1
- package/dist/components/marker.d.ts +1 -1
- package/dist/components/message-scroller.cjs +1 -1
- package/dist/components/message-scroller.js +1 -1
- package/dist/components/page-header.d.cts +1 -1
- package/dist/components/page-header.d.ts +1 -1
- package/dist/components/pill.js +1 -1
- package/dist/components/popover.cjs +3 -2
- package/dist/components/popover.cjs.map +1 -1
- package/dist/components/popover.js +3 -2
- package/dist/components/popover.js.map +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/select.cjs +4 -3
- package/dist/components/select.cjs.map +1 -1
- package/dist/components/select.js +4 -3
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.cjs +35 -17
- package/dist/components/separator.cjs.map +1 -1
- package/dist/components/separator.d.cts +1 -0
- package/dist/components/separator.d.ts +1 -0
- package/dist/components/separator.js +35 -17
- package/dist/components/separator.js.map +1 -1
- package/dist/components/sheet.cjs +4 -2
- package/dist/components/sheet.cjs.map +1 -1
- package/dist/components/sheet.d.cts +4 -1
- package/dist/components/sheet.d.ts +4 -1
- package/dist/components/sheet.js +4 -2
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/textarea.cjs +1 -1
- package/dist/components/textarea.js +1 -1
- package/dist/components/theme.cjs +118 -24
- package/dist/components/theme.cjs.map +1 -1
- package/dist/components/theme.d.cts +7 -1
- package/dist/components/theme.d.ts +7 -1
- package/dist/components/theme.js +120 -27
- package/dist/components/theme.js.map +1 -1
- package/dist/components/toast.cjs +3 -2
- package/dist/components/toast.cjs.map +1 -1
- package/dist/components/toast.js +3 -2
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/toggle.cjs +1 -1
- package/dist/components/toggle.js +2 -2
- package/dist/components/tooltip.cjs +5 -3
- package/dist/components/tooltip.cjs.map +1 -1
- package/dist/components/tooltip.d.cts +1 -0
- package/dist/components/tooltip.d.ts +1 -0
- package/dist/components/tooltip.js +5 -3
- package/dist/components/tooltip.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.cjs","names":["MenuPrimitive","Check","ChevronRight"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["import { Menu as MenuPrimitive } from '@base-ui/react/menu'\nimport { Check, ChevronRight } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\n\nfunction DropdownMenu({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Root>) {\n return <MenuPrimitive.Root {...props} />\n}\n\nfunction DropdownMenuPortal({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Portal>) {\n return <MenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />\n}\n\nfunction DropdownMenuTrigger({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Trigger>) {\n return <MenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" {...props} />\n}\n\ntype DropdownMenuContentProps = React.ComponentProps<\n typeof MenuPrimitive.Popup\n> &\n Pick<\n MenuPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n > & {\n container?: React.ComponentProps<typeof MenuPrimitive.Portal>['container']\n }\n\nfunction DropdownMenuContent({\n className,\n align = 'start',\n alignOffset,\n side,\n sideOffset = 4,\n container,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <MenuPrimitive.Portal container={container}>\n <MenuPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n className=\"isolate z-50 outline-none\"\n side={side}\n sideOffset={sideOffset}\n >\n <MenuPrimitive.Popup\n data-slot=\"dropdown-menu-content\"\n className={cn(\n 'z-50 max-h-(--available-height) min-w-40 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-gray-a1 bg-gray-1 p-1 text-gray-a12 shadow-lg outline-none dark:bg-gray-3 [[data-high-contrast]_&]:border-gray-a11',\n 'transition-[opacity,scale,translate] duration-100 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none',\n 'data-[side=bottom]:data-starting-style:-translate-y-2 data-[side=left]:data-starting-style:translate-x-2 data-[side=right]:data-starting-style:-translate-x-2 data-[side=top]:data-starting-style:translate-y-2',\n className,\n )}\n {...props}\n />\n </MenuPrimitive.Positioner>\n </MenuPrimitive.Portal>\n )\n}\n\nfunction DropdownMenuGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Group>) {\n return <MenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = 'default',\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Item> & {\n inset?: boolean\n variant?: 'default' | 'destructive'\n}) {\n return (\n <MenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n 'group/dropdown-menu-item relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 data-[variant=destructive]:text-error data-[variant=destructive]:data-highlighted:bg-base-error-soft motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuCheckboxItem({\n className,\n children,\n checked,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.CheckboxItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n checked={checked}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-checkbox-item-indicator\"\n >\n <MenuPrimitive.CheckboxItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.CheckboxItemIndicator>\n </span>\n {children}\n </MenuPrimitive.CheckboxItem>\n )\n}\n\nfunction DropdownMenuRadioGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioGroup>) {\n return (\n <MenuPrimitive.RadioGroup\n data-slot=\"dropdown-menu-radio-group\"\n {...props}\n />\n )\n}\n\nfunction DropdownMenuRadioItem({\n className,\n children,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-radio-item-indicator\"\n >\n <MenuPrimitive.RadioItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.RadioItemIndicator>\n </span>\n {children}\n </MenuPrimitive.RadioItem>\n )\n}\n\n// plain div, not Menu.GroupLabel: Base UI's GroupLabel throws outside a\n// Group, while our labels float freely (radix Label was an unwired div too)\nfunction DropdownMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<'div'> & {\n inset?: boolean\n}) {\n return (\n <div\n data-slot=\"dropdown-menu-label\"\n data-inset={inset}\n className={cn(\n 'px-2 py-1 text-xs text-gray-light data-[inset=true]:pl-7 [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n return (\n <MenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn(\n '-mx-1 my-1 h-px bg-gray-a3 [[data-high-contrast]_&]:bg-gray-a6',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuShortcut({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\n 'ml-auto text-xs tracking-widest text-gray-light [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSub({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>) {\n return <MenuPrimitive.SubmenuRoot data-slot=\"dropdown-menu-sub\" {...props} />\n}\n\nfunction DropdownMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.SubmenuTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n 'flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-highlighted:bg-gray-a3 data-popup-open:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto text-sm text-gray-light\" />\n </MenuPrimitive.SubmenuTrigger>\n )\n}\n\n// composes the public Content; the align/offset defaults visually align the\n// submenu with its parent menu\nfunction DropdownMenuSubContent({\n className,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <DropdownMenuContent\n data-slot=\"dropdown-menu-sub-content\"\n align=\"start\"\n alignOffset={-3}\n side=\"right\"\n sideOffset={0}\n className={cn('w-auto min-w-32', className)}\n {...props}\n />\n )\n}\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\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BAAA,GAAA,kBAAA,KAACD,oBAAAA,KAAc,WAAf;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IACE,kEACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,qBAAqB,EAC5B,WACA,GAAG,SAC4B;CAC/B,OACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IACE,0FACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,gBAAgB,EACvB,GAAG,SACsD;CACzD,OAAO,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,KAAc,aAAf;EAA2B,aAAU;EAAoB,GAAI;CAAQ,CAAA;AAC9E;AAEA,SAAS,uBAAuB,EAC9B,WACA,OACA,UACA,GAAG,SAGF;CACD,OACE,iBAAA,GAAA,kBAAA,MAACA,oBAAAA,KAAc,gBAAf;EACE,aAAU;EACV,cAAY;EACZ,YAAA,GAAA,GAAA,IACE,2UACA,SACF;EACA,GAAI;YAPN,CASG,UACD,iBAAA,GAAA,kBAAA,KAACE,oBAAAA,cAAD,EAAc,WAAU,kCAAmC,CAAA,CAC/B;;AAElC;AAIA,SAAS,uBAAuB,EAC9B,WACA,GAAG,SACwB;CAC3B,OACE,iBAAA,GAAA,kBAAA,KAAC,qBAAD;EACE,aAAU;EACV,OAAM;EACN,aAAa;EACb,MAAK;EACL,YAAY;EACZ,YAAA,GAAA,GAAA,IAAc,mBAAmB,SAAS;EAC1C,GAAI;CACL,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"dropdown-menu.cjs","names":["MenuPrimitive","PortalTheme","Check","ChevronRight"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["import { Menu as MenuPrimitive } from '@base-ui/react/menu'\nimport { Check, ChevronRight } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { PortalTheme } from './theme'\n\nfunction DropdownMenu({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Root>) {\n return <MenuPrimitive.Root {...props} />\n}\n\nfunction DropdownMenuPortal({\n children,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Portal>) {\n return (\n <MenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props}>\n <PortalTheme>{children}</PortalTheme>\n </MenuPrimitive.Portal>\n )\n}\n\nfunction DropdownMenuTrigger({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Trigger>) {\n return <MenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" {...props} />\n}\n\ntype DropdownMenuContentProps = React.ComponentProps<\n typeof MenuPrimitive.Popup\n> &\n Pick<\n MenuPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n > & {\n container?: React.ComponentProps<typeof MenuPrimitive.Portal>['container']\n }\n\nfunction DropdownMenuContent({\n className,\n align = 'start',\n alignOffset,\n side,\n sideOffset = 4,\n container,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <DropdownMenuPortal container={container}>\n <MenuPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n className=\"isolate z-50 outline-none\"\n side={side}\n sideOffset={sideOffset}\n >\n <MenuPrimitive.Popup\n data-slot=\"dropdown-menu-content\"\n className={cn(\n 'z-50 max-h-(--available-height) min-w-40 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-gray-a1 bg-gray-1 p-1 text-gray-a12 shadow-lg outline-none dark:bg-gray-3 [[data-high-contrast]_&]:border-gray-a11',\n 'transition-[opacity,scale,translate] duration-100 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none',\n 'data-[side=bottom]:data-starting-style:-translate-y-2 data-[side=left]:data-starting-style:translate-x-2 data-[side=right]:data-starting-style:-translate-x-2 data-[side=top]:data-starting-style:translate-y-2',\n className,\n )}\n {...props}\n />\n </MenuPrimitive.Positioner>\n </DropdownMenuPortal>\n )\n}\n\nfunction DropdownMenuGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Group>) {\n return <MenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = 'default',\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Item> & {\n inset?: boolean\n variant?: 'default' | 'destructive'\n}) {\n return (\n <MenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n 'group/dropdown-menu-item relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 data-[variant=destructive]:text-error data-[variant=destructive]:data-highlighted:bg-base-error-soft motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuCheckboxItem({\n className,\n children,\n checked,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.CheckboxItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n checked={checked}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-checkbox-item-indicator\"\n >\n <MenuPrimitive.CheckboxItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.CheckboxItemIndicator>\n </span>\n {children}\n </MenuPrimitive.CheckboxItem>\n )\n}\n\nfunction DropdownMenuRadioGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioGroup>) {\n return (\n <MenuPrimitive.RadioGroup\n data-slot=\"dropdown-menu-radio-group\"\n {...props}\n />\n )\n}\n\nfunction DropdownMenuRadioItem({\n className,\n children,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-radio-item-indicator\"\n >\n <MenuPrimitive.RadioItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.RadioItemIndicator>\n </span>\n {children}\n </MenuPrimitive.RadioItem>\n )\n}\n\n// plain div, not Menu.GroupLabel: Base UI's GroupLabel throws outside a\n// Group, while our labels float freely (radix Label was an unwired div too)\nfunction DropdownMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<'div'> & {\n inset?: boolean\n}) {\n return (\n <div\n data-slot=\"dropdown-menu-label\"\n data-inset={inset}\n className={cn(\n 'px-2 py-1 text-xs text-gray-light data-[inset=true]:pl-7 [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n return (\n <MenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn(\n '-mx-1 my-1 h-px bg-gray-a3 [[data-high-contrast]_&]:bg-gray-a6',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuShortcut({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\n 'ml-auto text-xs tracking-widest text-gray-light [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSub({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>) {\n return <MenuPrimitive.SubmenuRoot data-slot=\"dropdown-menu-sub\" {...props} />\n}\n\nfunction DropdownMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.SubmenuTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n 'flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-highlighted:bg-gray-a3 data-popup-open:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto text-sm text-gray-light\" />\n </MenuPrimitive.SubmenuTrigger>\n )\n}\n\n// composes the public Content; the align/offset defaults visually align the\n// submenu with its parent menu\nfunction DropdownMenuSubContent({\n className,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <DropdownMenuContent\n data-slot=\"dropdown-menu-sub-content\"\n align=\"start\"\n alignOffset={-3}\n side=\"right\"\n sideOffset={0}\n className={cn('w-auto min-w-32', className)}\n {...props}\n />\n )\n}\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n}\n"],"mappings":";;;;;;;;;;;AAMA,SAAS,aAAa,EACpB,GAAG,SAC+C;CAClD,OAAO,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,KAAc,MAAf,EAAoB,GAAI,MAAQ,CAAA;AACzC;AAEA,SAAS,mBAAmB,EAC1B,UACA,GAAG,SACiD;CACpD,OACE,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,KAAc,QAAf;EAAsB,aAAU;EAAuB,GAAI;YACzD,iBAAA,GAAA,kBAAA,KAACC,yBAAAA,aAAD,EAAc,SAAsB,CAAA;CAChB,CAAA;AAE1B;AAEA,SAAS,oBAAoB,EAC3B,GAAG,SACkD;CACrD,OAAO,iBAAA,GAAA,kBAAA,KAACD,oBAAAA,KAAc,SAAf;EAAuB,aAAU;EAAwB,GAAI;CAAQ,CAAA;AAC9E;AAYA,SAAS,oBAAoB,EAC3B,WACA,QAAQ,SACR,aACA,MACA,aAAa,GACb,WACA,GAAG,SACwB;CAC3B,OACE,iBAAA,GAAA,kBAAA,KAAC,oBAAD;EAA+B;YAC7B,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,KAAc,YAAf;GACS;GACM;GACb,WAAU;GACJ;GACM;aAEZ,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,KAAc,OAAf;IACE,aAAU;IACV,YAAA,GAAA,GAAA,IACE,sPACA,qMACA,mNACA,SACF;IACA,GAAI;GACL,CAAA;EACuB,CAAA;CACR,CAAA;AAExB;AAEA,SAAS,kBAAkB,EACzB,GAAG,SACgD;CACnD,OAAO,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,KAAc,OAAf;EAAqB,aAAU;EAAsB,GAAI;CAAQ,CAAA;AAC1E;AAEA,SAAS,iBAAiB,EACxB,WACA,OACA,UAAU,WACV,GA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AAC,OAAD;EACE,aAAU;EACV,cAAY;EACZ,YAAA,GAAA,GAAA,IACE,mGACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,sBAAsB,EAC7B,WACA,GAAG,SACoD;CACvD,OACE,iBAAA,GAAA,kBAAA,KAACF,oBAAAA,KAAc,WAAf;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IACE,kEACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,qBAAqB,EAC5B,WACA,GAAG,SAC4B;CAC/B,OACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IACE,0FACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,gBAAgB,EACvB,GAAG,SACsD;CACzD,OAAO,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,KAAc,aAAf;EAA2B,aAAU;EAAoB,GAAI;CAAQ,CAAA;AAC9E;AAEA,SAAS,uBAAuB,EAC9B,WACA,OACA,UACA,GAAG,SAGF;CACD,OACE,iBAAA,GAAA,kBAAA,MAACA,oBAAAA,KAAc,gBAAf;EACE,aAAU;EACV,cAAY;EACZ,YAAA,GAAA,GAAA,IACE,2UACA,SACF;EACA,GAAI;YAPN,CASG,UACD,iBAAA,GAAA,kBAAA,KAACG,oBAAAA,cAAD,EAAc,WAAU,kCAAmC,CAAA,CAC/B;;AAElC;AAIA,SAAS,uBAAuB,EAC9B,WACA,GAAG,SACwB;CAC3B,OACE,iBAAA,GAAA,kBAAA,KAAC,qBAAD;EACE,aAAU;EACV,OAAM;EACN,aAAa;EACb,MAAK;EACL,YAAY;EACZ,YAAA,GAAA,GAAA,IAAc,mBAAmB,SAAS;EAC1C,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -8,6 +8,7 @@ declare function DropdownMenu({
|
|
|
8
8
|
...props
|
|
9
9
|
}: React$1.ComponentProps<typeof Menu.Root>): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
declare function DropdownMenuPortal({
|
|
11
|
+
children,
|
|
11
12
|
...props
|
|
12
13
|
}: React$1.ComponentProps<typeof Menu.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
declare function DropdownMenuTrigger({
|
|
@@ -8,6 +8,7 @@ declare function DropdownMenu({
|
|
|
8
8
|
...props
|
|
9
9
|
}: React$1.ComponentProps<typeof Menu.Root>): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
declare function DropdownMenuPortal({
|
|
11
|
+
children,
|
|
11
12
|
...props
|
|
12
13
|
}: React$1.ComponentProps<typeof Menu.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
declare function DropdownMenuTrigger({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
|
+
import { PortalTheme } from "./theme.js";
|
|
3
4
|
import "react";
|
|
4
5
|
import { Check, ChevronRight } from "@epilot/spark-icons";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -8,10 +9,11 @@ import { Menu } from "@base-ui/react/menu";
|
|
|
8
9
|
function DropdownMenu({ ...props }) {
|
|
9
10
|
return /* @__PURE__ */ jsx(Menu.Root, { ...props });
|
|
10
11
|
}
|
|
11
|
-
function DropdownMenuPortal({ ...props }) {
|
|
12
|
+
function DropdownMenuPortal({ children, ...props }) {
|
|
12
13
|
return /* @__PURE__ */ jsx(Menu.Portal, {
|
|
13
14
|
"data-slot": "dropdown-menu-portal",
|
|
14
|
-
...props
|
|
15
|
+
...props,
|
|
16
|
+
children: /* @__PURE__ */ jsx(PortalTheme, { children })
|
|
15
17
|
});
|
|
16
18
|
}
|
|
17
19
|
function DropdownMenuTrigger({ ...props }) {
|
|
@@ -21,7 +23,7 @@ function DropdownMenuTrigger({ ...props }) {
|
|
|
21
23
|
});
|
|
22
24
|
}
|
|
23
25
|
function DropdownMenuContent({ className, align = "start", alignOffset, side, sideOffset = 4, container, ...props }) {
|
|
24
|
-
return /* @__PURE__ */ jsx(
|
|
26
|
+
return /* @__PURE__ */ jsx(DropdownMenuPortal, {
|
|
25
27
|
container,
|
|
26
28
|
children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
27
29
|
align,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.js","names":["MenuPrimitive"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["import { Menu as MenuPrimitive } from '@base-ui/react/menu'\nimport { Check, ChevronRight } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\n\nfunction DropdownMenu({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Root>) {\n return <MenuPrimitive.Root {...props} />\n}\n\nfunction DropdownMenuPortal({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Portal>) {\n return <MenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />\n}\n\nfunction DropdownMenuTrigger({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Trigger>) {\n return <MenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" {...props} />\n}\n\ntype DropdownMenuContentProps = React.ComponentProps<\n typeof MenuPrimitive.Popup\n> &\n Pick<\n MenuPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n > & {\n container?: React.ComponentProps<typeof MenuPrimitive.Portal>['container']\n }\n\nfunction DropdownMenuContent({\n className,\n align = 'start',\n alignOffset,\n side,\n sideOffset = 4,\n container,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <MenuPrimitive.Portal container={container}>\n <MenuPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n className=\"isolate z-50 outline-none\"\n side={side}\n sideOffset={sideOffset}\n >\n <MenuPrimitive.Popup\n data-slot=\"dropdown-menu-content\"\n className={cn(\n 'z-50 max-h-(--available-height) min-w-40 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-gray-a1 bg-gray-1 p-1 text-gray-a12 shadow-lg outline-none dark:bg-gray-3 [[data-high-contrast]_&]:border-gray-a11',\n 'transition-[opacity,scale,translate] duration-100 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none',\n 'data-[side=bottom]:data-starting-style:-translate-y-2 data-[side=left]:data-starting-style:translate-x-2 data-[side=right]:data-starting-style:-translate-x-2 data-[side=top]:data-starting-style:translate-y-2',\n className,\n )}\n {...props}\n />\n </MenuPrimitive.Positioner>\n </MenuPrimitive.Portal>\n )\n}\n\nfunction DropdownMenuGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Group>) {\n return <MenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = 'default',\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Item> & {\n inset?: boolean\n variant?: 'default' | 'destructive'\n}) {\n return (\n <MenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n 'group/dropdown-menu-item relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 data-[variant=destructive]:text-error data-[variant=destructive]:data-highlighted:bg-base-error-soft motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuCheckboxItem({\n className,\n children,\n checked,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.CheckboxItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n checked={checked}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-checkbox-item-indicator\"\n >\n <MenuPrimitive.CheckboxItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.CheckboxItemIndicator>\n </span>\n {children}\n </MenuPrimitive.CheckboxItem>\n )\n}\n\nfunction DropdownMenuRadioGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioGroup>) {\n return (\n <MenuPrimitive.RadioGroup\n data-slot=\"dropdown-menu-radio-group\"\n {...props}\n />\n )\n}\n\nfunction DropdownMenuRadioItem({\n className,\n children,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-radio-item-indicator\"\n >\n <MenuPrimitive.RadioItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.RadioItemIndicator>\n </span>\n {children}\n </MenuPrimitive.RadioItem>\n )\n}\n\n// plain div, not Menu.GroupLabel: Base UI's GroupLabel throws outside a\n// Group, while our labels float freely (radix Label was an unwired div too)\nfunction DropdownMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<'div'> & {\n inset?: boolean\n}) {\n return (\n <div\n data-slot=\"dropdown-menu-label\"\n data-inset={inset}\n className={cn(\n 'px-2 py-1 text-xs text-gray-light data-[inset=true]:pl-7 [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n return (\n <MenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn(\n '-mx-1 my-1 h-px bg-gray-a3 [[data-high-contrast]_&]:bg-gray-a6',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuShortcut({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\n 'ml-auto text-xs tracking-widest text-gray-light [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSub({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>) {\n return <MenuPrimitive.SubmenuRoot data-slot=\"dropdown-menu-sub\" {...props} />\n}\n\nfunction DropdownMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.SubmenuTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n 'flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-highlighted:bg-gray-a3 data-popup-open:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto text-sm text-gray-light\" />\n </MenuPrimitive.SubmenuTrigger>\n )\n}\n\n// composes the public Content; the align/offset defaults visually align the\n// submenu with its parent menu\nfunction DropdownMenuSubContent({\n className,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <DropdownMenuContent\n data-slot=\"dropdown-menu-sub-content\"\n align=\"start\"\n alignOffset={-3}\n side=\"right\"\n sideOffset={0}\n className={cn('w-auto min-w-32', className)}\n {...props}\n />\n )\n}\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n}\n"],"mappings":";;;;;;;AAKA,SAAS,aAAa,EACpB,GAAG,SAC+C;CAClD,OAAO,oBAACA,KAAc,MAAf,EAAoB,GAAI,MAAQ,CAAA;AACzC;AAEA,SAAS,mBAAmB,EAC1B,GAAG,SACiD;CACpD,OAAO,oBAACA,KAAc,QAAf;EAAsB,aAAU;EAAuB,GAAI;CAAQ,CAAA;AAC5E;AAEA,SAAS,oBAAoB,EAC3B,GAAG,SACkD;CACrD,OAAO,oBAACA,KAAc,SAAf;EAAuB,aAAU;EAAwB,GAAI;CAAQ,CAAA;AAC9E;AAYA,SAAS,oBAAoB,EAC3B,WACA,QAAQ,SACR,aACA,MACA,aAAa,GACb,WACA,GAAG,SACwB;CAC3B,OACE,oBAACA,KAAc,QAAf;EAAiC;YAC/B,oBAACA,KAAc,YAAf;GACS;GACM;GACb,WAAU;GACJ;GACM;aAEZ,oBAACA,KAAc,OAAf;IACE,aAAU;IACV,WAAW,GACT,sPACA,qMACA,mNACA,SACF;IACA,GAAI;GACL,CAAA;EACuB,CAAA;CACN,CAAA;AAE1B;AAEA,SAAS,kBAAkB,EACzB,GAAG,SACgD;CACnD,OAAO,oBAACA,KAA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CACL,CAAA;AAEL;AAEA,SAAS,qBAAqB,EAC5B,WACA,GAAG,SAC4B;CAC/B,OACE,oBAAC,QAAD;EACE,aAAU;EACV,WAAW,GACT,0FACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,gBAAgB,EACvB,GAAG,SACsD;CACzD,OAAO,oBAACA,KAAc,aAAf;EAA2B,aAAU;EAAoB,GAAI;CAAQ,CAAA;AAC9E;AAEA,SAAS,uBAAuB,EAC9B,WACA,OACA,UACA,GAAG,SAGF;CACD,OACE,qBAACA,KAAc,gBAAf;EACE,aAAU;EACV,cAAY;EACZ,WAAW,GACT,2UACA,SACF;EACA,GAAI;YAPN,CASG,UACD,oBAAC,cAAD,EAAc,WAAU,kCAAmC,CAAA,CAC/B;;AAElC;AAIA,SAAS,uBAAuB,EAC9B,WACA,GAAG,SACwB;CAC3B,OACE,oBAAC,qBAAD;EACE,aAAU;EACV,OAAM;EACN,aAAa;EACb,MAAK;EACL,YAAY;EACZ,WAAW,GAAG,mBAAmB,SAAS;EAC1C,GAAI;CACL,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"dropdown-menu.js","names":["MenuPrimitive"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["import { Menu as MenuPrimitive } from '@base-ui/react/menu'\nimport { Check, ChevronRight } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { PortalTheme } from './theme'\n\nfunction DropdownMenu({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Root>) {\n return <MenuPrimitive.Root {...props} />\n}\n\nfunction DropdownMenuPortal({\n children,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Portal>) {\n return (\n <MenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props}>\n <PortalTheme>{children}</PortalTheme>\n </MenuPrimitive.Portal>\n )\n}\n\nfunction DropdownMenuTrigger({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Trigger>) {\n return <MenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" {...props} />\n}\n\ntype DropdownMenuContentProps = React.ComponentProps<\n typeof MenuPrimitive.Popup\n> &\n Pick<\n MenuPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n > & {\n container?: React.ComponentProps<typeof MenuPrimitive.Portal>['container']\n }\n\nfunction DropdownMenuContent({\n className,\n align = 'start',\n alignOffset,\n side,\n sideOffset = 4,\n container,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <DropdownMenuPortal container={container}>\n <MenuPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n className=\"isolate z-50 outline-none\"\n side={side}\n sideOffset={sideOffset}\n >\n <MenuPrimitive.Popup\n data-slot=\"dropdown-menu-content\"\n className={cn(\n 'z-50 max-h-(--available-height) min-w-40 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-gray-a1 bg-gray-1 p-1 text-gray-a12 shadow-lg outline-none dark:bg-gray-3 [[data-high-contrast]_&]:border-gray-a11',\n 'transition-[opacity,scale,translate] duration-100 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none',\n 'data-[side=bottom]:data-starting-style:-translate-y-2 data-[side=left]:data-starting-style:translate-x-2 data-[side=right]:data-starting-style:-translate-x-2 data-[side=top]:data-starting-style:translate-y-2',\n className,\n )}\n {...props}\n />\n </MenuPrimitive.Positioner>\n </DropdownMenuPortal>\n )\n}\n\nfunction DropdownMenuGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Group>) {\n return <MenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = 'default',\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Item> & {\n inset?: boolean\n variant?: 'default' | 'destructive'\n}) {\n return (\n <MenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n 'group/dropdown-menu-item relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 data-[variant=destructive]:text-error data-[variant=destructive]:data-highlighted:bg-base-error-soft motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuCheckboxItem({\n className,\n children,\n checked,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.CheckboxItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n checked={checked}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-checkbox-item-indicator\"\n >\n <MenuPrimitive.CheckboxItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.CheckboxItemIndicator>\n </span>\n {children}\n </MenuPrimitive.CheckboxItem>\n )\n}\n\nfunction DropdownMenuRadioGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioGroup>) {\n return (\n <MenuPrimitive.RadioGroup\n data-slot=\"dropdown-menu-radio-group\"\n {...props}\n />\n )\n}\n\nfunction DropdownMenuRadioItem({\n className,\n children,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-radio-item-indicator\"\n >\n <MenuPrimitive.RadioItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.RadioItemIndicator>\n </span>\n {children}\n </MenuPrimitive.RadioItem>\n )\n}\n\n// plain div, not Menu.GroupLabel: Base UI's GroupLabel throws outside a\n// Group, while our labels float freely (radix Label was an unwired div too)\nfunction DropdownMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<'div'> & {\n inset?: boolean\n}) {\n return (\n <div\n data-slot=\"dropdown-menu-label\"\n data-inset={inset}\n className={cn(\n 'px-2 py-1 text-xs text-gray-light data-[inset=true]:pl-7 [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n return (\n <MenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn(\n '-mx-1 my-1 h-px bg-gray-a3 [[data-high-contrast]_&]:bg-gray-a6',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuShortcut({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\n 'ml-auto text-xs tracking-widest text-gray-light [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSub({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>) {\n return <MenuPrimitive.SubmenuRoot data-slot=\"dropdown-menu-sub\" {...props} />\n}\n\nfunction DropdownMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.SubmenuTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n 'flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-highlighted:bg-gray-a3 data-popup-open:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto text-sm text-gray-light\" />\n </MenuPrimitive.SubmenuTrigger>\n )\n}\n\n// composes the public Content; the align/offset defaults visually align the\n// submenu with its parent menu\nfunction DropdownMenuSubContent({\n className,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <DropdownMenuContent\n data-slot=\"dropdown-menu-sub-content\"\n align=\"start\"\n alignOffset={-3}\n side=\"right\"\n sideOffset={0}\n className={cn('w-auto min-w-32', className)}\n {...props}\n />\n )\n}\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n}\n"],"mappings":";;;;;;;;AAMA,SAAS,aAAa,EACpB,GAAG,SAC+C;CAClD,OAAO,oBAACA,KAAc,MAAf,EAAoB,GAAI,MAAQ,CAAA;AACzC;AAEA,SAAS,mBAAmB,EAC1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,GAAG,mBAAmB,SAAS;EAC1C,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -1,38 +1,120 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_components_icon = require("./icon.cjs");
|
|
4
|
+
let react = require("react");
|
|
4
5
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
let class_variance_authority = require("class-variance-authority");
|
|
7
|
+
let cn = require("cn");
|
|
5
8
|
//#region src/components/empty-state.tsx
|
|
6
|
-
const emptyStateVariants = (0,
|
|
7
|
-
variants: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const emptyStateVariants = (0, class_variance_authority.cva)("flex", {
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
dashed: "rounded-lg border border-dashed border-gray",
|
|
13
|
+
ghost: ""
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
default: "",
|
|
17
|
+
sm: ""
|
|
18
|
+
},
|
|
19
|
+
layout: {
|
|
20
|
+
stacked: "flex-col items-center text-center",
|
|
21
|
+
inline: "flex-row items-start text-left"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
compoundVariants: [
|
|
25
|
+
{
|
|
26
|
+
layout: "stacked",
|
|
27
|
+
size: "default",
|
|
28
|
+
class: "gap-4 px-6 py-12"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
layout: "stacked",
|
|
32
|
+
size: "sm",
|
|
33
|
+
class: "gap-2 px-4 py-5"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
layout: "inline",
|
|
37
|
+
size: "default",
|
|
38
|
+
class: "gap-4 p-6"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
layout: "inline",
|
|
42
|
+
size: "sm",
|
|
43
|
+
class: "gap-3 px-4 py-3"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
defaultVariants: {
|
|
47
|
+
variant: "dashed",
|
|
48
|
+
size: "default",
|
|
49
|
+
layout: "stacked"
|
|
50
|
+
}
|
|
12
51
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
52
|
+
const EmptyStateContext = (0, react.createContext)({
|
|
53
|
+
size: "default",
|
|
54
|
+
layout: "stacked"
|
|
55
|
+
});
|
|
56
|
+
function EmptyStateTitle({ className, ...props }) {
|
|
57
|
+
const { size } = (0, react.useContext)(EmptyStateContext);
|
|
58
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
59
|
+
"data-slot": "empty-state-title",
|
|
60
|
+
className: (0, cn.cn)("text-gray", size === "sm" ? "text-sm font-semibold" : "text-base font-bold", className),
|
|
61
|
+
...props
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function EmptyStateDescription({ className, ...props }) {
|
|
65
|
+
const { size, layout } = (0, react.useContext)(EmptyStateContext);
|
|
66
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
67
|
+
"data-slot": "empty-state-description",
|
|
68
|
+
className: (0, cn.cn)(layout !== "inline" && "mx-auto", "max-w-md text-gray-light", size === "sm" ? "text-xs" : "text-sm", className),
|
|
69
|
+
...props
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
const actionsMargin = {
|
|
73
|
+
stacked: {
|
|
74
|
+
default: "mt-3",
|
|
75
|
+
sm: "mt-1"
|
|
76
|
+
},
|
|
77
|
+
inline: {
|
|
78
|
+
default: "mt-3",
|
|
79
|
+
sm: "mt-2"
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
function EmptyStateActions({ className, ...props }) {
|
|
83
|
+
const { size, layout } = (0, react.useContext)(EmptyStateContext);
|
|
84
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
85
|
+
"data-slot": "empty-state-actions",
|
|
86
|
+
className: (0, cn.cn)("flex flex-wrap gap-2", layout === "stacked" && "justify-center", actionsMargin[layout][size], className),
|
|
87
|
+
...props
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function EmptyState({ children, className, icon: Glyph, layout = "stacked", size = "default", variant, ...props }) {
|
|
91
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EmptyStateContext.Provider, {
|
|
92
|
+
value: {
|
|
93
|
+
size,
|
|
94
|
+
layout
|
|
95
|
+
},
|
|
96
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
97
|
+
"data-slot": "empty-state",
|
|
98
|
+
className: (0, cn.cn)(emptyStateVariants({
|
|
99
|
+
variant,
|
|
100
|
+
size,
|
|
101
|
+
layout
|
|
102
|
+
}), className),
|
|
103
|
+
...props,
|
|
104
|
+
children: [Glyph ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_icon.Icon, {
|
|
105
|
+
size: size === "sm" ? "small" : "xl",
|
|
19
106
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Glyph, {})
|
|
20
|
-
}) : null,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
children: title
|
|
26
|
-
}), description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
27
|
-
className: "mx-auto max-w-md text-sm text-gray-light",
|
|
28
|
-
children: description
|
|
29
|
-
})]
|
|
30
|
-
}),
|
|
31
|
-
action
|
|
32
|
-
]
|
|
107
|
+
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
108
|
+
className: (0, cn.cn)("flex flex-col gap-1", layout === "inline" && "min-w-0 flex-1"),
|
|
109
|
+
children
|
|
110
|
+
})]
|
|
111
|
+
})
|
|
33
112
|
});
|
|
34
113
|
}
|
|
35
114
|
//#endregion
|
|
36
115
|
exports.EmptyState = EmptyState;
|
|
116
|
+
exports.EmptyStateActions = EmptyStateActions;
|
|
117
|
+
exports.EmptyStateDescription = EmptyStateDescription;
|
|
118
|
+
exports.EmptyStateTitle = EmptyStateTitle;
|
|
37
119
|
|
|
38
120
|
//# sourceMappingURL=empty-state.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty-state.cjs","names":["Icon"],"sources":["../../src/components/empty-state.tsx"],"sourcesContent":["import type { SparkIcon } from '@epilot/spark-icons'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport type
|
|
1
|
+
{"version":3,"file":"empty-state.cjs","names":["Icon"],"sources":["../../src/components/empty-state.tsx"],"sourcesContent":["import type { SparkIcon } from '@epilot/spark-icons'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport {\n createContext,\n type HTMLAttributes,\n type ReactNode,\n useContext,\n} from 'react'\nimport { cn } from '../utils/cn'\nimport { Icon } from './icon'\n\nconst emptyStateVariants = cva('flex', {\n variants: {\n variant: {\n dashed: 'rounded-lg border border-dashed border-gray',\n ghost: '',\n },\n size: { default: '', sm: '' },\n layout: {\n stacked: 'flex-col items-center text-center',\n inline: 'flex-row items-start text-left',\n },\n },\n compoundVariants: [\n { layout: 'stacked', size: 'default', class: 'gap-4 px-6 py-12' },\n { layout: 'stacked', size: 'sm', class: 'gap-2 px-4 py-5' },\n { layout: 'inline', size: 'default', class: 'gap-4 p-6' },\n { layout: 'inline', size: 'sm', class: 'gap-3 px-4 py-3' },\n ],\n defaultVariants: {\n variant: 'dashed',\n size: 'default',\n layout: 'stacked',\n },\n})\n\ntype EmptyStateVariants = VariantProps<typeof emptyStateVariants>\n\n// A leftover `title` would otherwise compile and render as a tooltip, not a heading.\ninterface EmptyStateProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'title'>,\n Pick<EmptyStateVariants, 'variant'> {\n // null would switch off the compound cells and drop all padding and gap\n size?: NonNullable<EmptyStateVariants['size']>\n layout?: NonNullable<EmptyStateVariants['layout']>\n icon?: SparkIcon\n children: ReactNode\n}\n\nconst EmptyStateContext = createContext<{\n size: NonNullable<EmptyStateVariants['size']>\n layout: NonNullable<EmptyStateVariants['layout']>\n}>({ size: 'default', layout: 'stacked' })\n\nfunction EmptyStateTitle({\n className,\n ...props\n}: HTMLAttributes<HTMLHeadingElement>) {\n const { size } = useContext(EmptyStateContext)\n return (\n <h3\n data-slot=\"empty-state-title\"\n className={cn(\n 'text-gray',\n size === 'sm' ? 'text-sm font-semibold' : 'text-base font-bold',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyStateDescription({\n className,\n ...props\n}: HTMLAttributes<HTMLParagraphElement>) {\n const { size, layout } = useContext(EmptyStateContext)\n return (\n <p\n data-slot=\"empty-state-description\"\n className={cn(\n layout !== 'inline' && 'mx-auto',\n 'max-w-md text-gray-light',\n size === 'sm' ? 'text-xs' : 'text-sm',\n className,\n )}\n {...props}\n />\n )\n}\n\n// Margins plus the column's gap-1 reproduce the old spacing: 16/8 px stacked, 16/12 px inline.\nconst actionsMargin = {\n stacked: { default: 'mt-3', sm: 'mt-1' },\n inline: { default: 'mt-3', sm: 'mt-2' },\n} as const\n\nfunction EmptyStateActions({\n className,\n ...props\n}: HTMLAttributes<HTMLDivElement>) {\n const { size, layout } = useContext(EmptyStateContext)\n return (\n <div\n data-slot=\"empty-state-actions\"\n className={cn(\n 'flex flex-wrap gap-2',\n layout === 'stacked' && 'justify-center',\n actionsMargin[layout][size],\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyState({\n children,\n className,\n icon: Glyph,\n layout = 'stacked',\n size = 'default',\n variant,\n ...props\n}: EmptyStateProps) {\n return (\n <EmptyStateContext.Provider value={{ size, layout }}>\n <div\n data-slot=\"empty-state\"\n className={cn(emptyStateVariants({ variant, size, layout }), className)}\n {...props}\n >\n {Glyph ? (\n <Icon size={size === 'sm' ? 'small' : 'xl'}>\n <Glyph />\n </Icon>\n ) : null}\n <div\n className={cn(\n 'flex flex-col gap-1',\n layout === 'inline' && 'min-w-0 flex-1',\n )}\n >\n {children}\n </div>\n </div>\n </EmptyStateContext.Provider>\n )\n}\n\nexport { EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateTitle }\nexport type { EmptyStateProps }\n"],"mappings":";;;;;;;;AAWA,MAAM,sBAAA,GAAA,yBAAA,KAAyB,QAAQ;CACrC,UAAU;EACR,SAAS;GACP,QAAQ;GACR,OAAO;EACT;EACA,MAAM;GAAE,SAAS;GAAI,IAAI;EAAG;EAC5B,QAAQ;GACN,SAAS;GACT,QAAQ;EACV;CACF;CACA,kBAAkB;EAChB;GAAE,QAAQ;GAAW,MAAM;GAAW,OAAO;EAAmB;EAChE;GAAE,QAAQ;GAAW,MAAM;GAAM,OAAO;EAAkB;EAC1D;GAAE,QAAQ;GAAU,MAAM;GAAW,OAAO;EAAY;EACxD;GAAE,QAAQ;GAAU,MAAM;GAAM,OAAO;EAAkB;CAC3D;CACA,iBAAiB;EACf,SAAS;EACT,MAAM;EACN,QAAQ;CACV;AACF,CAAC;AAgBD,MAAM,qBAAA,GAAA,MAAA,eAGH;CAAE,MAAM;CAAW,QAAQ;AAAU,CAAC;AAEzC,SAAS,gBAAgB,EACvB,WACA,GAAG,SACkC;CACrC,MAAM,EAAE,UAAA,GAAA,MAAA,YAAoB,iBAAiB;CAC7C,OACE,iBAAA,GAAA,kBAAA,KAAC,MAAD;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IACE,aACA,SAAS,OAAO,0BAA0B,uBAC1C,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,sBAAsB,EAC7B,WACA,GAAG,SACoC;CACvC,MAAM,EAAE,MAAM,YAAA,GAAA,MAAA,YAAsB,iBAAiB;CACrD,OACE,iBAAA,GAAA,kBAAA,KAAC,KAAD;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IACE,WAAW,YAAY,WACvB,4BACA,SAAS,OAAO,YAAY,WAC5B,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAGA,MAAM,gBAAgB;CACpB,SAAS;EAAE,SAAS;EAAQ,IAAI;CAAO;CACvC,QAAQ;EAAE,SAAS;EAAQ,IAAI;CAAO;AACxC;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SAC8B;CACjC,MAAM,EAAE,MAAM,YAAA,GAAA,MAAA,YAAsB,iBAAiB;CACrD,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IACE,wBACA,WAAW,aAAa,kBACxB,cAAc,QAAQ,OACtB,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAClB,UACA,WACA,MAAM,OACN,SAAS,WACT,OAAO,WACP,SACA,GAAG,SACe;CAClB,OACE,iBAAA,GAAA,kBAAA,KAAC,kBAAkB,UAAnB;EAA4B,OAAO;GAAE;GAAM;EAAO;YAChD,iBAAA,GAAA,kBAAA,MAAC,OAAD;GACE,aAAU;GACV,YAAA,GAAA,GAAA,IAAc,mBAAmB;IAAE;IAAS;IAAM;GAAO,CAAC,GAAG,SAAS;GACtE,GAAI;aAHN,CAKG,QACC,iBAAA,GAAA,kBAAA,KAACA,wBAAAA,MAAD;IAAM,MAAM,SAAS,OAAO,UAAU;cACpC,iBAAA,GAAA,kBAAA,KAAC,OAAD,CAAQ,CAAA;GACJ,CAAA,IACJ,MACJ,iBAAA,GAAA,kBAAA,KAAC,OAAD;IACE,YAAA,GAAA,GAAA,IACE,uBACA,WAAW,YAAY,gBACzB;IAEC;GACE,CAAA,CACF;;CACqB,CAAA;AAEhC"}
|
|
@@ -1,26 +1,43 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { ReactNode } from "react";
|
|
3
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
4
4
|
import { VariantProps } from "class-variance-authority";
|
|
5
5
|
import { SparkIcon } from "@epilot/spark-icons";
|
|
6
6
|
|
|
7
7
|
//#region src/components/empty-state.d.ts
|
|
8
8
|
declare const emptyStateVariants: (props?: ({
|
|
9
|
-
variant?: "
|
|
9
|
+
variant?: "ghost" | "dashed" | null | undefined;
|
|
10
|
+
size?: "sm" | "default" | null | undefined;
|
|
11
|
+
layout?: "inline" | "stacked" | null | undefined;
|
|
10
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
type EmptyStateVariants = VariantProps<typeof emptyStateVariants>;
|
|
14
|
+
interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>, Pick<EmptyStateVariants, 'variant'> {
|
|
15
|
+
size?: NonNullable<EmptyStateVariants['size']>;
|
|
16
|
+
layout?: NonNullable<EmptyStateVariants['layout']>;
|
|
14
17
|
icon?: SparkIcon;
|
|
15
|
-
|
|
18
|
+
children: ReactNode;
|
|
16
19
|
}
|
|
20
|
+
declare function EmptyStateTitle({
|
|
21
|
+
className,
|
|
22
|
+
...props
|
|
23
|
+
}: HTMLAttributes<HTMLHeadingElement>): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare function EmptyStateDescription({
|
|
25
|
+
className,
|
|
26
|
+
...props
|
|
27
|
+
}: HTMLAttributes<HTMLParagraphElement>): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
declare function EmptyStateActions({
|
|
29
|
+
className,
|
|
30
|
+
...props
|
|
31
|
+
}: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
17
32
|
declare function EmptyState({
|
|
18
|
-
|
|
19
|
-
|
|
33
|
+
children,
|
|
34
|
+
className,
|
|
20
35
|
icon: Glyph,
|
|
21
|
-
|
|
22
|
-
|
|
36
|
+
layout,
|
|
37
|
+
size,
|
|
38
|
+
variant,
|
|
39
|
+
...props
|
|
23
40
|
}: EmptyStateProps): import("react/jsx-runtime").JSX.Element;
|
|
24
41
|
//#endregion
|
|
25
|
-
export { EmptyState, type EmptyStateProps };
|
|
42
|
+
export { EmptyState, EmptyStateActions, EmptyStateDescription, type EmptyStateProps, EmptyStateTitle };
|
|
26
43
|
//# sourceMappingURL=empty-state.d.cts.map
|
|
@@ -1,26 +1,43 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { ReactNode } from "react";
|
|
3
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
4
4
|
import { SparkIcon } from "@epilot/spark-icons";
|
|
5
5
|
import { VariantProps } from "class-variance-authority";
|
|
6
6
|
|
|
7
7
|
//#region src/components/empty-state.d.ts
|
|
8
8
|
declare const emptyStateVariants: (props?: ({
|
|
9
|
-
variant?: "
|
|
9
|
+
variant?: "ghost" | "dashed" | null | undefined;
|
|
10
|
+
size?: "sm" | "default" | null | undefined;
|
|
11
|
+
layout?: "inline" | "stacked" | null | undefined;
|
|
10
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
type EmptyStateVariants = VariantProps<typeof emptyStateVariants>;
|
|
14
|
+
interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>, Pick<EmptyStateVariants, 'variant'> {
|
|
15
|
+
size?: NonNullable<EmptyStateVariants['size']>;
|
|
16
|
+
layout?: NonNullable<EmptyStateVariants['layout']>;
|
|
14
17
|
icon?: SparkIcon;
|
|
15
|
-
|
|
18
|
+
children: ReactNode;
|
|
16
19
|
}
|
|
20
|
+
declare function EmptyStateTitle({
|
|
21
|
+
className,
|
|
22
|
+
...props
|
|
23
|
+
}: HTMLAttributes<HTMLHeadingElement>): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare function EmptyStateDescription({
|
|
25
|
+
className,
|
|
26
|
+
...props
|
|
27
|
+
}: HTMLAttributes<HTMLParagraphElement>): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
declare function EmptyStateActions({
|
|
29
|
+
className,
|
|
30
|
+
...props
|
|
31
|
+
}: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
17
32
|
declare function EmptyState({
|
|
18
|
-
|
|
19
|
-
|
|
33
|
+
children,
|
|
34
|
+
className,
|
|
20
35
|
icon: Glyph,
|
|
21
|
-
|
|
22
|
-
|
|
36
|
+
layout,
|
|
37
|
+
size,
|
|
38
|
+
variant,
|
|
39
|
+
...props
|
|
23
40
|
}: EmptyStateProps): import("react/jsx-runtime").JSX.Element;
|
|
24
41
|
//#endregion
|
|
25
|
-
export { EmptyState, type EmptyStateProps };
|
|
42
|
+
export { EmptyState, EmptyStateActions, EmptyStateDescription, type EmptyStateProps, EmptyStateTitle };
|
|
26
43
|
//# sourceMappingURL=empty-state.d.ts.map
|
|
@@ -1,38 +1,116 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { cn } from "../utils/cn.js";
|
|
2
3
|
import { Icon } from "./icon.js";
|
|
4
|
+
import { createContext, useContext } from "react";
|
|
3
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
6
|
import { cva } from "class-variance-authority";
|
|
5
7
|
//#region src/components/empty-state.tsx
|
|
6
|
-
const emptyStateVariants = cva("flex
|
|
7
|
-
variants: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const emptyStateVariants = cva("flex", {
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
dashed: "rounded-lg border border-dashed border-gray",
|
|
12
|
+
ghost: ""
|
|
13
|
+
},
|
|
14
|
+
size: {
|
|
15
|
+
default: "",
|
|
16
|
+
sm: ""
|
|
17
|
+
},
|
|
18
|
+
layout: {
|
|
19
|
+
stacked: "flex-col items-center text-center",
|
|
20
|
+
inline: "flex-row items-start text-left"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
compoundVariants: [
|
|
24
|
+
{
|
|
25
|
+
layout: "stacked",
|
|
26
|
+
size: "default",
|
|
27
|
+
class: "gap-4 px-6 py-12"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
layout: "stacked",
|
|
31
|
+
size: "sm",
|
|
32
|
+
class: "gap-2 px-4 py-5"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
layout: "inline",
|
|
36
|
+
size: "default",
|
|
37
|
+
class: "gap-4 p-6"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
layout: "inline",
|
|
41
|
+
size: "sm",
|
|
42
|
+
class: "gap-3 px-4 py-3"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
defaultVariants: {
|
|
46
|
+
variant: "dashed",
|
|
47
|
+
size: "default",
|
|
48
|
+
layout: "stacked"
|
|
49
|
+
}
|
|
12
50
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
51
|
+
const EmptyStateContext = createContext({
|
|
52
|
+
size: "default",
|
|
53
|
+
layout: "stacked"
|
|
54
|
+
});
|
|
55
|
+
function EmptyStateTitle({ className, ...props }) {
|
|
56
|
+
const { size } = useContext(EmptyStateContext);
|
|
57
|
+
return /* @__PURE__ */ jsx("h3", {
|
|
58
|
+
"data-slot": "empty-state-title",
|
|
59
|
+
className: cn("text-gray", size === "sm" ? "text-sm font-semibold" : "text-base font-bold", className),
|
|
60
|
+
...props
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function EmptyStateDescription({ className, ...props }) {
|
|
64
|
+
const { size, layout } = useContext(EmptyStateContext);
|
|
65
|
+
return /* @__PURE__ */ jsx("p", {
|
|
66
|
+
"data-slot": "empty-state-description",
|
|
67
|
+
className: cn(layout !== "inline" && "mx-auto", "max-w-md text-gray-light", size === "sm" ? "text-xs" : "text-sm", className),
|
|
68
|
+
...props
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const actionsMargin = {
|
|
72
|
+
stacked: {
|
|
73
|
+
default: "mt-3",
|
|
74
|
+
sm: "mt-1"
|
|
75
|
+
},
|
|
76
|
+
inline: {
|
|
77
|
+
default: "mt-3",
|
|
78
|
+
sm: "mt-2"
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
function EmptyStateActions({ className, ...props }) {
|
|
82
|
+
const { size, layout } = useContext(EmptyStateContext);
|
|
83
|
+
return /* @__PURE__ */ jsx("div", {
|
|
84
|
+
"data-slot": "empty-state-actions",
|
|
85
|
+
className: cn("flex flex-wrap gap-2", layout === "stacked" && "justify-center", actionsMargin[layout][size], className),
|
|
86
|
+
...props
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function EmptyState({ children, className, icon: Glyph, layout = "stacked", size = "default", variant, ...props }) {
|
|
90
|
+
return /* @__PURE__ */ jsx(EmptyStateContext.Provider, {
|
|
91
|
+
value: {
|
|
92
|
+
size,
|
|
93
|
+
layout
|
|
94
|
+
},
|
|
95
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
96
|
+
"data-slot": "empty-state",
|
|
97
|
+
className: cn(emptyStateVariants({
|
|
98
|
+
variant,
|
|
99
|
+
size,
|
|
100
|
+
layout
|
|
101
|
+
}), className),
|
|
102
|
+
...props,
|
|
103
|
+
children: [Glyph ? /* @__PURE__ */ jsx(Icon, {
|
|
104
|
+
size: size === "sm" ? "small" : "xl",
|
|
19
105
|
children: /* @__PURE__ */ jsx(Glyph, {})
|
|
20
|
-
}) : null,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
children: title
|
|
26
|
-
}), description && /* @__PURE__ */ jsx("p", {
|
|
27
|
-
className: "mx-auto max-w-md text-sm text-gray-light",
|
|
28
|
-
children: description
|
|
29
|
-
})]
|
|
30
|
-
}),
|
|
31
|
-
action
|
|
32
|
-
]
|
|
106
|
+
}) : null, /* @__PURE__ */ jsx("div", {
|
|
107
|
+
className: cn("flex flex-col gap-1", layout === "inline" && "min-w-0 flex-1"),
|
|
108
|
+
children
|
|
109
|
+
})]
|
|
110
|
+
})
|
|
33
111
|
});
|
|
34
112
|
}
|
|
35
113
|
//#endregion
|
|
36
|
-
export { EmptyState };
|
|
114
|
+
export { EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateTitle };
|
|
37
115
|
|
|
38
116
|
//# sourceMappingURL=empty-state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty-state.js","names":[],"sources":["../../src/components/empty-state.tsx"],"sourcesContent":["import type { SparkIcon } from '@epilot/spark-icons'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport type
|
|
1
|
+
{"version":3,"file":"empty-state.js","names":[],"sources":["../../src/components/empty-state.tsx"],"sourcesContent":["import type { SparkIcon } from '@epilot/spark-icons'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport {\n createContext,\n type HTMLAttributes,\n type ReactNode,\n useContext,\n} from 'react'\nimport { cn } from '../utils/cn'\nimport { Icon } from './icon'\n\nconst emptyStateVariants = cva('flex', {\n variants: {\n variant: {\n dashed: 'rounded-lg border border-dashed border-gray',\n ghost: '',\n },\n size: { default: '', sm: '' },\n layout: {\n stacked: 'flex-col items-center text-center',\n inline: 'flex-row items-start text-left',\n },\n },\n compoundVariants: [\n { layout: 'stacked', size: 'default', class: 'gap-4 px-6 py-12' },\n { layout: 'stacked', size: 'sm', class: 'gap-2 px-4 py-5' },\n { layout: 'inline', size: 'default', class: 'gap-4 p-6' },\n { layout: 'inline', size: 'sm', class: 'gap-3 px-4 py-3' },\n ],\n defaultVariants: {\n variant: 'dashed',\n size: 'default',\n layout: 'stacked',\n },\n})\n\ntype EmptyStateVariants = VariantProps<typeof emptyStateVariants>\n\n// A leftover `title` would otherwise compile and render as a tooltip, not a heading.\ninterface EmptyStateProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'title'>,\n Pick<EmptyStateVariants, 'variant'> {\n // null would switch off the compound cells and drop all padding and gap\n size?: NonNullable<EmptyStateVariants['size']>\n layout?: NonNullable<EmptyStateVariants['layout']>\n icon?: SparkIcon\n children: ReactNode\n}\n\nconst EmptyStateContext = createContext<{\n size: NonNullable<EmptyStateVariants['size']>\n layout: NonNullable<EmptyStateVariants['layout']>\n}>({ size: 'default', layout: 'stacked' })\n\nfunction EmptyStateTitle({\n className,\n ...props\n}: HTMLAttributes<HTMLHeadingElement>) {\n const { size } = useContext(EmptyStateContext)\n return (\n <h3\n data-slot=\"empty-state-title\"\n className={cn(\n 'text-gray',\n size === 'sm' ? 'text-sm font-semibold' : 'text-base font-bold',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyStateDescription({\n className,\n ...props\n}: HTMLAttributes<HTMLParagraphElement>) {\n const { size, layout } = useContext(EmptyStateContext)\n return (\n <p\n data-slot=\"empty-state-description\"\n className={cn(\n layout !== 'inline' && 'mx-auto',\n 'max-w-md text-gray-light',\n size === 'sm' ? 'text-xs' : 'text-sm',\n className,\n )}\n {...props}\n />\n )\n}\n\n// Margins plus the column's gap-1 reproduce the old spacing: 16/8 px stacked, 16/12 px inline.\nconst actionsMargin = {\n stacked: { default: 'mt-3', sm: 'mt-1' },\n inline: { default: 'mt-3', sm: 'mt-2' },\n} as const\n\nfunction EmptyStateActions({\n className,\n ...props\n}: HTMLAttributes<HTMLDivElement>) {\n const { size, layout } = useContext(EmptyStateContext)\n return (\n <div\n data-slot=\"empty-state-actions\"\n className={cn(\n 'flex flex-wrap gap-2',\n layout === 'stacked' && 'justify-center',\n actionsMargin[layout][size],\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction EmptyState({\n children,\n className,\n icon: Glyph,\n layout = 'stacked',\n size = 'default',\n variant,\n ...props\n}: EmptyStateProps) {\n return (\n <EmptyStateContext.Provider value={{ size, layout }}>\n <div\n data-slot=\"empty-state\"\n className={cn(emptyStateVariants({ variant, size, layout }), className)}\n {...props}\n >\n {Glyph ? (\n <Icon size={size === 'sm' ? 'small' : 'xl'}>\n <Glyph />\n </Icon>\n ) : null}\n <div\n className={cn(\n 'flex flex-col gap-1',\n layout === 'inline' && 'min-w-0 flex-1',\n )}\n >\n {children}\n </div>\n </div>\n </EmptyStateContext.Provider>\n )\n}\n\nexport { EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateTitle }\nexport type { EmptyStateProps }\n"],"mappings":";;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