@adea-ai/ui 0.162.14 → 0.162.15
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/composites/accent-picker/accent-picker.js +1 -1
- package/dist/components/composites/accent-picker/accent-picker.js.map +1 -1
- package/dist/components/composites/accent-picker/custom-color-popover.js +1 -1
- package/dist/components/composites/accent-picker/custom-color-popover.js.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +2 -2
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/confirmation/confirmation.js +1 -1
- package/dist/components/composites/confirmation/confirmation.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/components/composites/list-row/list-row-control.js +1 -1
- package/dist/components/composites/list-row/list-row-control.js.map +1 -1
- package/dist/components/composites/settings/settings.js +1 -1
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.js +1 -1
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
- package/dist/components/composites/tree/tree.js +1 -1
- package/dist/components/composites/tree/tree.js.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.js +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
- package/dist/components/conversation/thread-panel.js +1 -1
- package/dist/components/conversation/thread-panel.js.map +1 -1
- package/dist/components/layout/app-shell/skip-link.js +1 -1
- package/dist/components/layout/app-shell/skip-link.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail.js +1 -1
- package/dist/components/layout/side-rail/side-rail.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav-classes.js +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav-classes.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/layout/top-bar/top-bar.js +2 -2
- package/dist/components/layout/top-bar/top-bar.js.map +1 -1
- package/dist/components/ui/accordion/accordion.js +1 -1
- package/dist/components/ui/accordion/accordion.js.map +1 -1
- package/dist/components/ui/annotation-surface/annotation-surface.js +1 -1
- package/dist/components/ui/annotation-surface/annotation-surface.js.map +1 -1
- package/dist/components/ui/attachment/attachment.js +2 -2
- package/dist/components/ui/attachment/attachment.js.map +1 -1
- package/dist/components/ui/board/board.js +2 -2
- package/dist/components/ui/board/board.js.map +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb.js +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/ui/button/button.js +1 -1
- package/dist/components/ui/button/button.js.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +1 -1
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/collapsible/collapsible.js +1 -1
- package/dist/components/ui/collapsible/collapsible.js.map +1 -1
- package/dist/components/ui/combobox/combobox.js +3 -3
- package/dist/components/ui/combobox/combobox.js.map +1 -1
- package/dist/components/ui/field/field.js +2 -2
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/input/input-control.js +1 -1
- package/dist/components/ui/input/input-control.js.map +1 -1
- package/dist/components/ui/input-group/input-group.js +1 -1
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/input-otp/input-otp.js +1 -1
- package/dist/components/ui/input-otp/input-otp.js.map +1 -1
- package/dist/components/ui/menubar/menubar.js +1 -1
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/native-select/native-select.js +1 -1
- package/dist/components/ui/native-select/native-select.js.map +1 -1
- package/dist/components/ui/pagination/pagination.js +1 -1
- package/dist/components/ui/pagination/pagination.js.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.js +1 -1
- package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js +2 -2
- package/dist/components/ui/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js.map +1 -1
- package/dist/components/ui/select/select.js +1 -1
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/slider/slider.js +1 -1
- package/dist/components/ui/slider/slider.js.map +1 -1
- package/dist/components/ui/switch/switch.js +1 -1
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/tabs/tabs.js +1 -1
- package/dist/components/ui/tabs/tabs.js.map +1 -1
- package/dist/components/ui/text-link/text-link.js +1 -1
- package/dist/components/ui/text-link/text-link.js.map +1 -1
- package/dist/components/ui/textarea/textarea.js +1 -1
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/components/ui/toast/toast.js +1 -1
- package/dist/components/ui/toast/toast.js.map +1 -1
- package/dist/components/ui/trace/trace.js +1 -1
- package/dist/components/ui/trace/trace.js.map +1 -1
- package/dist/lib/overlay.d.ts.map +1 -1
- package/dist/lib/overlay.js +1 -1
- package/dist/lib/overlay.js.map +1 -1
- package/dist/lib/tokens.d.ts.map +1 -1
- package/dist/lib/tokens.js +2 -2
- package/dist/lib/tokens.js.map +1 -1
- package/dist/lib/variants.d.ts +1 -1
- package/dist/lib/variants.d.ts.map +1 -1
- package/dist/lib/variants.js +1 -1
- package/dist/lib/variants.js.map +1 -1
- package/dist/r/src/components/composites/accent-picker/accent-picker.tsx +1 -1
- package/dist/r/src/components/composites/accent-picker/custom-color-popover.tsx +1 -1
- package/dist/r/src/components/composites/appearance-editor/accent-swatch-groups.tsx +1 -1
- package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +2 -5
- package/dist/r/src/components/composites/confirmation/confirmation.tsx +1 -1
- package/dist/r/src/components/composites/icon-picker/icon-picker.tsx +1 -1
- package/dist/r/src/components/composites/list-row/list-row-control.tsx +1 -1
- package/dist/r/src/components/composites/settings/settings.tsx +1 -1
- package/dist/r/src/components/composites/stack-trace/stack-trace.tsx +1 -1
- package/dist/r/src/components/composites/tree/tree.tsx +1 -1
- package/dist/r/src/components/composites/workspace-mark/workspace-mark.tsx +1 -1
- package/dist/r/src/components/conversation/thread-panel.tsx +1 -1
- package/dist/r/src/components/layout/app-shell/skip-link.tsx +1 -1
- package/dist/r/src/components/layout/side-rail/side-rail.tsx +1 -1
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav-classes.ts +1 -1
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +1 -1
- package/dist/r/src/components/layout/top-bar/top-bar.tsx +2 -2
- package/dist/r/src/components/ui/accordion/accordion.tsx +1 -1
- package/dist/r/src/components/ui/annotation-surface/annotation-surface.tsx +1 -1
- package/dist/r/src/components/ui/attachment/attachment.tsx +2 -2
- package/dist/r/src/components/ui/board/board.tsx +2 -2
- package/dist/r/src/components/ui/breadcrumb/breadcrumb.tsx +1 -1
- package/dist/r/src/components/ui/button/button.tsx +1 -1
- package/dist/r/src/components/ui/checkbox/checkbox.tsx +1 -1
- package/dist/r/src/components/ui/collapsible/collapsible.tsx +1 -1
- package/dist/r/src/components/ui/combobox/combobox.tsx +3 -3
- package/dist/r/src/components/ui/field/field.tsx +2 -2
- package/dist/r/src/components/ui/input/input-control.tsx +1 -1
- package/dist/r/src/components/ui/input-group/input-group.tsx +1 -1
- package/dist/r/src/components/ui/input-otp/input-otp.tsx +1 -1
- package/dist/r/src/components/ui/menubar/menubar.tsx +1 -1
- package/dist/r/src/components/ui/native-select/native-select.tsx +1 -1
- package/dist/r/src/components/ui/pagination/pagination.tsx +1 -1
- package/dist/r/src/components/ui/questionnaire/questionnaire.tsx +1 -1
- package/dist/r/src/components/ui/radio-group/radio-group.tsx +2 -2
- package/dist/r/src/components/ui/scroll-area/scroll-area.tsx +1 -1
- package/dist/r/src/components/ui/select/select.tsx +1 -1
- package/dist/r/src/components/ui/slider/slider.tsx +1 -1
- package/dist/r/src/components/ui/switch/switch.tsx +1 -1
- package/dist/r/src/components/ui/tabs/tabs.tsx +1 -1
- package/dist/r/src/components/ui/text-link/text-link.tsx +1 -1
- package/dist/r/src/components/ui/textarea/textarea.tsx +1 -1
- package/dist/r/src/components/ui/toast/toast.tsx +1 -1
- package/dist/r/src/components/ui/trace/trace.tsx +1 -1
- package/dist/r/src/lib/overlay.ts +1 -1
- package/dist/r/src/lib/tokens.ts +4 -2
- package/dist/r/src/lib/variants.ts +1 -1
- package/dist/r/src/styles/base.css +35 -7
- package/package.json +1 -1
- package/src/components/composites/accent-picker/accent-picker.tsx +1 -1
- package/src/components/composites/accent-picker/custom-color-popover.tsx +1 -1
- package/src/components/composites/appearance-editor/accent-swatch-groups.tsx +1 -1
- package/src/components/composites/appearance-editor/appearance-choices.tsx +2 -5
- package/src/components/composites/confirmation/confirmation.tsx +1 -1
- package/src/components/composites/icon-picker/icon-picker.tsx +1 -1
- package/src/components/composites/list-row/list-row-control.tsx +1 -1
- package/src/components/composites/settings/settings.tsx +1 -1
- package/src/components/composites/stack-trace/stack-trace.tsx +1 -1
- package/src/components/composites/tree/tree.tsx +1 -1
- package/src/components/composites/workspace-mark/workspace-mark.tsx +1 -1
- package/src/components/conversation/thread-panel.tsx +1 -1
- package/src/components/layout/app-shell/skip-link.tsx +1 -1
- package/src/components/layout/side-rail/side-rail.tsx +1 -1
- package/src/components/layout/sidebar-nav/sidebar-nav-classes.ts +1 -1
- package/src/components/layout/sidebar-nav/sidebar-nav.tsx +1 -1
- package/src/components/layout/top-bar/top-bar.tsx +2 -2
- package/src/components/ui/accordion/accordion.tsx +1 -1
- package/src/components/ui/annotation-surface/annotation-surface.tsx +1 -1
- package/src/components/ui/attachment/attachment.tsx +2 -2
- package/src/components/ui/board/board.tsx +2 -2
- package/src/components/ui/breadcrumb/breadcrumb.tsx +1 -1
- package/src/components/ui/button/button.tsx +1 -1
- package/src/components/ui/checkbox/checkbox.tsx +1 -1
- package/src/components/ui/collapsible/collapsible.tsx +1 -1
- package/src/components/ui/combobox/combobox.tsx +3 -3
- package/src/components/ui/field/field.tsx +2 -2
- package/src/components/ui/input/input-control.tsx +1 -1
- package/src/components/ui/input-group/input-group.tsx +1 -1
- package/src/components/ui/input-otp/input-otp.tsx +1 -1
- package/src/components/ui/menubar/menubar.tsx +1 -1
- package/src/components/ui/native-select/native-select.tsx +1 -1
- package/src/components/ui/pagination/pagination.tsx +1 -1
- package/src/components/ui/questionnaire/questionnaire.tsx +1 -1
- package/src/components/ui/radio-group/radio-group.tsx +2 -2
- package/src/components/ui/scroll-area/scroll-area.tsx +1 -1
- package/src/components/ui/select/select.tsx +1 -1
- package/src/components/ui/slider/slider.tsx +1 -1
- package/src/components/ui/switch/switch.tsx +1 -1
- package/src/components/ui/tabs/tabs.tsx +1 -1
- package/src/components/ui/text-link/text-link.tsx +1 -1
- package/src/components/ui/textarea/textarea.tsx +1 -1
- package/src/components/ui/toast/toast.tsx +1 -1
- package/src/components/ui/trace/trace.tsx +1 -1
- package/src/lib/overlay.ts +1 -1
- package/src/lib/tokens.ts +4 -2
- package/src/lib/variants.ts +1 -1
- package/src/styles/base.css +35 -7
|
@@ -74,7 +74,7 @@ function BreadcrumbLink(props) {
|
|
|
74
74
|
spread(_el$4, [{
|
|
75
75
|
"data-slot": "breadcrumb-link",
|
|
76
76
|
get "class"() {
|
|
77
|
-
return cn("rounded-sm transition-colors ease-out outline-none hover:text-foreground", "focus-visible:border-ring focus-visible:
|
|
77
|
+
return cn("rounded-sm transition-colors ease-out outline-none hover:text-foreground", "focus-visible:border-ring focus-visible:focus-outline", local.class);
|
|
78
78
|
},
|
|
79
79
|
get href() {
|
|
80
80
|
return local.href;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb.js","names":["<nav\n data-slot=\"breadcrumb\"\n aria-label={local['aria-label'] ?? 'Breadcrumb'}\n class={cn('text-muted-foreground', local.class)}\n {...rest}\n />","<ol\n data-slot=\"breadcrumb-list\"\n class={cn('flex flex-wrap items-center gap-1.5 text-sm break-words', local.class)}\n {...rest}\n />","<li\n data-slot=\"breadcrumb-item\"\n class={cn('inline-flex items-center gap-1.5', local.class)}\n {...rest}\n />","<Show\n when={!local.current}\n // The current page is text, so the link's href stays off it.\n fallback={<BreadcrumbPage class={local.class} {...(rest as ComponentProps<'span'>)} />}\n >\n <a\n data-slot=\"breadcrumb-link\"\n class={cn(\n 'rounded-sm transition-colors ease-out outline-none hover:text-foreground',\n 'focus-visible:border-ring focus-visible:
|
|
1
|
+
{"version":3,"file":"breadcrumb.js","names":["<nav\n data-slot=\"breadcrumb\"\n aria-label={local['aria-label'] ?? 'Breadcrumb'}\n class={cn('text-muted-foreground', local.class)}\n {...rest}\n />","<ol\n data-slot=\"breadcrumb-list\"\n class={cn('flex flex-wrap items-center gap-1.5 text-sm break-words', local.class)}\n {...rest}\n />","<li\n data-slot=\"breadcrumb-item\"\n class={cn('inline-flex items-center gap-1.5', local.class)}\n {...rest}\n />","<Show\n when={!local.current}\n // The current page is text, so the link's href stays off it.\n fallback={<BreadcrumbPage class={local.class} {...(rest as ComponentProps<'span'>)} />}\n >\n <a\n data-slot=\"breadcrumb-link\"\n class={cn(\n 'rounded-sm transition-colors ease-out outline-none hover:text-foreground',\n 'focus-visible:border-ring focus-visible:focus-outline',\n local.class\n )}\n href={local.href}\n {...rest}\n />\n </Show>","<BreadcrumbPage class={local.class} {...(rest as ComponentProps<'span'>)} />","<span\n data-slot=\"breadcrumb-page\"\n aria-current=\"page\"\n class={cn('font-medium text-foreground', local.class)}\n {...rest}\n />","role=\"presentation\"","<ChevronRight />","<li\n data-slot=\"breadcrumb-separator\"\n role=\"presentation\"\n aria-hidden=\"true\"\n class={cn('[&_svg]:size-3.5', local.class)}\n {...rest}\n >\n {local.children ?? <ChevronRight />}\n </li>","<span class=\"visually-hidden\">More</span>","<MoreHorizontal class=\"size-4\" />","class=\"size-4\"","<span\n data-slot=\"breadcrumb-ellipsis\"\n role=\"presentation\"\n aria-hidden=\"true\"\n class={cn('flex size-6 items-center justify-center', local.class)}\n {...rest}\n >\n <MoreHorizontal class=\"size-4\" />\n <span class=\"visually-hidden\">More</span>\n </span>","LucideChevronRight","LucideMoreHorizontal","_$spread","_$insert"],"sources":["../../../../src/components/ui/breadcrumb/breadcrumb.tsx"],"sourcesContent":["import {\n ChevronRight as LucideChevronRight,\n MoreHorizontal as LucideMoreHorizontal,\n} from '@lucide/solid'\nimport type { ComponentProps } from '@solidjs/web'\nimport { Show, omit } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst ChevronRight = fastIcon(LucideChevronRight)\nconst MoreHorizontal = fastIcon(LucideMoreHorizontal)\n\n/**\n * Breadcrumb.\n *\n * The path to the current view, in a real `<nav>` wrapping an ordered list so\n * the structure is announced rather than read as loose text. The final crumb is\n * the current page and is marked `aria-current=\"page\"` instead of being a link\n * to itself.\n *\n * A long path collapses from the middle: the root says where the user started\n * and the last crumbs say what they are looking at, so those are the parts that\n * have to survive.\n */\nexport function Breadcrumb(props: ComponentProps<'nav'>) {\n const local = props\n const rest = omit(props, 'class', 'aria-label')\n\n return (\n <nav\n data-slot=\"breadcrumb\"\n aria-label={local['aria-label'] ?? 'Breadcrumb'}\n class={cn('text-muted-foreground', local.class)}\n {...rest}\n />\n )\n}\n\nexport function BreadcrumbList(props: ComponentProps<'ol'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <ol\n data-slot=\"breadcrumb-list\"\n class={cn('flex flex-wrap items-center gap-1.5 text-sm break-words', local.class)}\n {...rest}\n />\n )\n}\n\nexport function BreadcrumbItem(props: ComponentProps<'li'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <li\n data-slot=\"breadcrumb-item\"\n class={cn('inline-flex items-center gap-1.5', local.class)}\n {...rest}\n />\n )\n}\n\nexport type BreadcrumbLinkProps = ComponentProps<'a'> & {\n /** Render as the current page rather than as a link. */\n current?: boolean\n}\n\nexport function BreadcrumbLink(props: BreadcrumbLinkProps) {\n const local = props\n const rest = omit(props, 'class', 'current', 'href')\n\n return (\n <Show\n when={!local.current}\n // The current page is text, so the link's href stays off it.\n fallback={<BreadcrumbPage class={local.class} {...(rest as ComponentProps<'span'>)} />}\n >\n <a\n data-slot=\"breadcrumb-link\"\n class={cn(\n 'rounded-sm transition-colors ease-out outline-none hover:text-foreground',\n 'focus-visible:border-ring focus-visible:focus-outline',\n local.class\n )}\n href={local.href}\n {...rest}\n />\n </Show>\n )\n}\n\n/**\n * The current page: the last crumb, as text rather than a link to itself, and\n * marked `aria-current=\"page\"`. The same element `BreadcrumbLink current`\n * renders, for a trail whose last crumb is never a link.\n */\nexport function BreadcrumbPage(props: ComponentProps<'span'>) {\n const local = props\n const rest = omit(props, 'class')\n return (\n <span\n data-slot=\"breadcrumb-page\"\n aria-current=\"page\"\n class={cn('font-medium text-foreground', local.class)}\n {...rest}\n />\n )\n}\n\nexport function BreadcrumbSeparator(props: ComponentProps<'li'>) {\n const local = props\n const rest = omit(props, 'class', 'children')\n\n return (\n <li\n data-slot=\"breadcrumb-separator\"\n role=\"presentation\"\n aria-hidden=\"true\"\n class={cn('[&_svg]:size-3.5', local.class)}\n {...rest}\n >\n {local.children ?? <ChevronRight />}\n </li>\n )\n}\n\nexport function BreadcrumbEllipsis(props: ComponentProps<'span'>) {\n const local = props\n const rest = omit(props, 'class')\n\n return (\n <span\n data-slot=\"breadcrumb-ellipsis\"\n role=\"presentation\"\n aria-hidden=\"true\"\n class={cn('flex size-6 items-center justify-center', local.class)}\n {...rest}\n >\n <MoreHorizontal class=\"size-4\" />\n <span class=\"visually-hidden\">More</span>\n </span>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAUA,IAAM,eAAe,SAASa,cAAkB;AAChD,IAAM,iBAAiB,SAASC,gBAAoB;;;;;;;;;;;;;AAcpD,SAAgB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AgB,IAAA,UAAA;GAAO,OAAA,MAAM;EAAK,EAAyC,GAAlC,IAAkC,CAAA;CAYjF,CAAA;AAEV;;;;;;AAOA,SAAgB,eAAe,OAA+B;CAC5D,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,OAAO;CAE9B,IAAA,QAAA,QAKC;CADCW,OAAA,OAAA,CAAA;EAHA,aAAA;EACA,gBAAA;EACA,IAAA,UAAA;GAAO,OAAA,GAAG,+BAA+B,MAAM,KAAK;EAAC;CAC7C,GAAJ,IAAA,GAAA,KAAA;CALR,OACEV;AAOJ;AAEA,SAAgB,oBAAoB,OAA6B;CAC/D,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,SAAS,UAAU;CAG1C,IAAA,QAAA,QAQI;CAHFU,OAAA,OAAA,CAAA;EAJA,aAAA;EACAT,MAAAA;EACA,eAAA;EACA,IAAA,UAAA;GAAO,OAAA,GAAG,oBAAoB,MAAM,KAAK;EAAC;CAClC,GAAJ,IAAA,GAAA,IAAA;CALNU,OAAA,aAOE;EAAC,OAAA,MAAM,YAAYT,gBAAAA,cAAAA,CAAe,CAAA;CAAC,CACjC;CATN,OACEC;AAUJ;AAEA,SAAgB,mBAAmB,OAA+B;CAChE,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,OAAO;CAG9B,IAAA,QAAA,QASM;CATN,IAAA,QAQEC,MAAAA;CAHAM,OAAA,OAAA,CAAA;EAJA,aAAA;EACAT,MAAAA;EACA,eAAA;EACA,IAAA,UAAA;GAAO,OAAA,GAAG,2CAA2C,MAAM,KAAK;EAAC;CACzD,GAAJ,IAAA,GAAA,IAAA;CALNU,OAAA,OAOEN,gBAAAA,gBAAAA,EAAgBC,OAAM,SAAU,CAAA,GAPlCC,KASM;CAVR,OACEA;AAWJ"}
|
|
@@ -34,7 +34,7 @@ var buttonVariants = cva(`${controlInteractive} inline-flex shrink-0 items-cente
|
|
|
34
34
|
default: "bg-primary text-primary-foreground hover:bg-primary-hover",
|
|
35
35
|
secondary: "bg-secondary text-secondary-foreground hover:bg-surface-hover",
|
|
36
36
|
/** For the action that destroys something. Never the default. */
|
|
37
|
-
destructive: "bg-destructive-action text-destructive-action-foreground hover:bg-destructive-action/90
|
|
37
|
+
destructive: "bg-destructive-action text-destructive-action-foreground hover:bg-destructive-action/90",
|
|
38
38
|
/** A bordered button for a surface that already has a fill. */
|
|
39
39
|
outline: "border border-border bg-transparent text-foreground hover:bg-surface-hover hover:border-input",
|
|
40
40
|
/** No chrome until hover. The default for toolbar and row actions. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","names":["<Show\n when={!isServer && !isHydrating() && (local.as === undefined || local.as === 'button')}\n fallback={\n <Dynamic\n component={local.as ?? 'button'}\n type=\"button\"\n data-slot=\"button\"\n {...(rest as ComponentProps<'button'>)}\n class={className()}\n />\n }\n >\n {native()}\n </Show>","!isServer && !isHydrating() && (local.as === undefined || local.as === 'button')","<Dynamic\n component={local.as ?? 'button'}\n type=\"button\"\n data-slot=\"button\"\n {...(rest as ComponentProps<'button'>)}\n class={className()}\n />","type=\"button\""],"sources":["../../../../src/components/ui/button/button.tsx"],"sourcesContent":["import { isHydrating, Show, omit } from 'solid-js'\nimport { Dynamic, isServer, spread } from '@solidjs/web'\nimport { type ComponentProps, type JSX, type ValidComponent } from '@solidjs/web'\nimport { cva, controlInteractive, controlSize, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Button.\n *\n * One appearance ladder shared by every pressable thing in the system: a\n * button, a toolbar control, a dialog action, and a menu row all draw from the\n * same tokens, so a row of them cannot drift apart.\n *\n * The variants answer \"what is this for\", never \"what colour is it\". A caller\n * that wants a red button writes `variant=\"destructive\"`; the red lives here.\n * That is also what lets the design-system linter tell a caller which variant\n * to use instead of only which class was wrong.\n *\n * Polymorphic: pass `as=\"a\"` (or any component) and the button becomes it\n * while keeping the same styling contract. This replaces the React-era\n * `asChild` primitive, which has no Solid equivalent that preserves props.\n *\n * It is deliberately not ui-sdk's `Button` part. Every popup trigger in the\n * system renders this component through a part's `render` prop, and a ui-sdk\n * part keeps its own `data-slot`, `type` and handlers over the props it is\n * given, so a trigger's `data-slot`, ARIA wiring and press handling would be\n * overwritten by a second primitive on the same element. A native button\n * already does what the old Kobalte-era component did (Enter, Space, form\n * submission, `disabled`); the caller's props win over the defaults below.\n */\nexport const buttonVariants = cva(\n `${controlInteractive} inline-flex shrink-0 items-center justify-center rounded-md font-medium whitespace-nowrap select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,\n {\n variants: {\n variant: {\n /** The one primary action in a view. */\n default: 'bg-primary text-primary-foreground hover:bg-primary-hover',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-surface-hover',\n /** For the action that destroys something. Never the default. */\n destructive:\n 'bg-destructive-action text-destructive-action-foreground hover:bg-destructive-action/90
|
|
1
|
+
{"version":3,"file":"button.js","names":["<Show\n when={!isServer && !isHydrating() && (local.as === undefined || local.as === 'button')}\n fallback={\n <Dynamic\n component={local.as ?? 'button'}\n type=\"button\"\n data-slot=\"button\"\n {...(rest as ComponentProps<'button'>)}\n class={className()}\n />\n }\n >\n {native()}\n </Show>","!isServer && !isHydrating() && (local.as === undefined || local.as === 'button')","<Dynamic\n component={local.as ?? 'button'}\n type=\"button\"\n data-slot=\"button\"\n {...(rest as ComponentProps<'button'>)}\n class={className()}\n />","type=\"button\""],"sources":["../../../../src/components/ui/button/button.tsx"],"sourcesContent":["import { isHydrating, Show, omit } from 'solid-js'\nimport { Dynamic, isServer, spread } from '@solidjs/web'\nimport { type ComponentProps, type JSX, type ValidComponent } from '@solidjs/web'\nimport { cva, controlInteractive, controlSize, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Button.\n *\n * One appearance ladder shared by every pressable thing in the system: a\n * button, a toolbar control, a dialog action, and a menu row all draw from the\n * same tokens, so a row of them cannot drift apart.\n *\n * The variants answer \"what is this for\", never \"what colour is it\". A caller\n * that wants a red button writes `variant=\"destructive\"`; the red lives here.\n * That is also what lets the design-system linter tell a caller which variant\n * to use instead of only which class was wrong.\n *\n * Polymorphic: pass `as=\"a\"` (or any component) and the button becomes it\n * while keeping the same styling contract. This replaces the React-era\n * `asChild` primitive, which has no Solid equivalent that preserves props.\n *\n * It is deliberately not ui-sdk's `Button` part. Every popup trigger in the\n * system renders this component through a part's `render` prop, and a ui-sdk\n * part keeps its own `data-slot`, `type` and handlers over the props it is\n * given, so a trigger's `data-slot`, ARIA wiring and press handling would be\n * overwritten by a second primitive on the same element. A native button\n * already does what the old Kobalte-era component did (Enter, Space, form\n * submission, `disabled`); the caller's props win over the defaults below.\n */\nexport const buttonVariants = cva(\n `${controlInteractive} inline-flex shrink-0 items-center justify-center rounded-md font-medium whitespace-nowrap select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,\n {\n variants: {\n variant: {\n /** The one primary action in a view. */\n default: 'bg-primary text-primary-foreground hover:bg-primary-hover',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-surface-hover',\n /** For the action that destroys something. Never the default. */\n destructive:\n 'bg-destructive-action text-destructive-action-foreground hover:bg-destructive-action/90',\n /** A bordered button for a surface that already has a fill. */\n outline:\n 'border border-border bg-transparent text-foreground hover:bg-surface-hover hover:border-input',\n /** No chrome until hover. The default for toolbar and row actions. */\n ghost: 'text-foreground hover:bg-surface-hover',\n /**\n * A ghost that opens something: a sheet, menu or popover trigger in a\n * toolbar. While its surface is open it holds the accent's own tint,\n * the same treatment that drives the side rail's active destination,\n * so the open control never reads identical to its closed neighbours\n * and the app's pressed chrome reads as one accent chroma. The\n * compound hover keeps the tint when an open control is pointed at.\n * ui-sdk marks the trigger of an open popup `data-open`; the\n * `data-expanded` twin covers parts that still write that name.\n */\n toolbar:\n 'text-foreground hover:bg-surface-hover data-[expanded]:bg-primary-subtle data-[expanded]:text-primary data-[expanded]:hover:bg-primary-subtle data-[open]:bg-primary-subtle data-[open]:text-primary data-[open]:hover:bg-primary-subtle',\n /** A tinted primary, for a secondary action inside a primary flow. */\n subtle: 'bg-primary-subtle text-primary hover:bg-primary-subtle/80',\n success: 'bg-success text-success-foreground hover:bg-success/90',\n link: 'text-primary underline-offset-4 hover:underline',\n },\n size: {\n '2xs': `${controlSize['2xs']} [&_svg]:size-3`,\n xs: `${controlSize.xs} [&_svg]:size-3.5`,\n sm: `${controlSize.sm} [&_svg]:size-3.5`,\n md: `${controlSize.md} [&_svg]:size-4`,\n lg: `${controlSize.lg} [&_svg]:size-4`,\n xl: `${controlSize.xl} [&_svg]:size-5`,\n '2xl': `${controlSize['2xl']} [&_svg]:size-6`,\n /* Square, for an icon with no label. The accessible name then has to\n come from `aria-label` or a visually hidden label — an icon-only\n button with neither is the accessibility finding the Storybook lane\n catches on every story. */\n 'icon-2xs': 'size-control-2xs p-0 [&_svg]:size-3',\n 'icon-xs': 'size-control-xs p-0 [&_svg]:size-3.5',\n 'icon-sm': 'size-control-sm p-0 [&_svg]:size-3.5',\n 'icon-md': 'size-control-md p-0 [&_svg]:size-4',\n 'icon-lg': 'size-control-lg p-0 [&_svg]:size-4',\n 'icon-xl': 'size-control-xl p-0 [&_svg]:size-5',\n 'icon-2xl': 'size-control-2xl p-0 [&_svg]:size-6',\n },\n /** Opt in to a stable touch target on devices with any coarse pointer. */\n touchTarget: {\n comfortable: 'touch-target-comfortable',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'md',\n },\n }\n)\n\ntype ButtonVariantProps = VariantProps<typeof buttonVariants>\n\n/**\n * The props of `T` with `Props` laid over them, plus `as`. The shape of the\n * Kobalte `PolymorphicProps` this replaced, so `ButtonProps<'a'>` and friends\n * keep meaning what they meant.\n */\ntype PolymorphicProps<T extends ValidComponent, Props extends object = {}> = Omit<\n ComponentProps<T>,\n keyof Props | 'as'\n> &\n Props & { as?: T | keyof JSX.IntrinsicElements }\n\nexport type ButtonProps<T extends ValidComponent = 'button'> = PolymorphicProps<\n T,\n ButtonVariantProps & {\n class?: string\n }\n>\n\nexport function Button<T extends ValidComponent = 'button'>(props: ButtonProps<T>) {\n const local = props as ButtonProps & { as?: ValidComponent }\n const rest = omit(local, 'as', 'variant', 'size', 'touchTarget', 'class')\n const className = () =>\n cn(\n buttonVariants({\n variant: local.variant,\n size: local.size,\n touchTarget: local.touchTarget,\n }),\n local.class\n )\n\n // A native button, the common case, is written directly: Dynamic goes\n // through a component lookup and a memo per button. It is built with\n // createElement and spread, which is what the compiled JSX would do, so the\n // module holds no template: `buttonVariants` stays importable in plain Node\n // (a server renderer reads the class contract from this entry). A server\n // render has no document, so it takes the Dynamic path. So does a button\n // the client hydrates: a fresh element would not adopt the server's node, and\n // its children would look for server nodes that were never claimed.\n // The sources are layered like JSX spreads: the defaults first, so a\n // caller (a popup trigger's `render`) can replace `type` and `data-slot`.\n const native = () => {\n const element = document.createElement('button')\n spread(element, [\n { type: 'button', 'data-slot': 'button' },\n rest,\n {\n get class() {\n return className()\n },\n },\n ])\n return element\n }\n return (\n <Show\n when={!isServer && !isHydrating() && (local.as === undefined || local.as === 'button')}\n fallback={\n <Dynamic\n component={local.as ?? 'button'}\n type=\"button\"\n data-slot=\"button\"\n {...(rest as ComponentProps<'button'>)}\n class={className()}\n />\n }\n >\n {native()}\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAa,iBAAiB,IAC5B,GAAG,mBAAmB,sJACtB;CACE,UAAU;EACR,SAAS;;GAEP,SAAS;GACT,WAAW;;GAEX,aACE;;GAEF,SACE;;GAEF,OAAO;;;;;;;;;;;GAWP,SACE;;GAEF,QAAQ;GACR,SAAS;GACT,MAAM;EACR;EACA,MAAM;GACJ,OAAO,GAAG,YAAY,OAAO;GAC7B,IAAI,GAAG,YAAY,GAAG;GACtB,IAAI,GAAG,YAAY,GAAG;GACtB,IAAI,GAAG,YAAY,GAAG;GACtB,IAAI,GAAG,YAAY,GAAG;GACtB,IAAI,GAAG,YAAY,GAAG;GACtB,OAAO,GAAG,YAAY,OAAO;GAK7B,YAAY;GACZ,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;GACX,YAAY;EACd;;EAEA,aAAa,EACX,aAAa,2BACf;CACF;CACA,iBAAiB;EACf,SAAS;EACT,MAAM;CACR;AACF,CACF;AAsBA,SAAgB,OAA4C,OAAuB;CACjF,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,MAAM,WAAW,QAAQ,eAAe,OAAO;CACxE,MAAM,kBACJ,GACE,eAAe;EACb,SAAS,MAAM;EACf,MAAM,MAAM;EACZ,aAAa,MAAM;CACrB,CAAC,GACD,MAAM,KACR;CAYF,MAAM,eAAe;EACnB,MAAM,UAAU,SAAS,cAAc,QAAQ;EAC/C,OAAO,SAAS;GACd;IAAE,MAAM;IAAU,aAAa;GAAS;GACxC;GACA,EACE,IAAI,QAAQ;IACV,OAAO,UAAU;GACnB,EACF;EACF,CAAC;EACD,OAAO;CACT;CACA,OACEA,gBAAAA,MAAAA;EACE,IAAA,OAAA;GAAMC,OAAAA,WAAAA;IAAC,OAAA,CAAA,EAAA,CAAA,YAAY,CAAC,YAAY;GAAqD,CAAA,CAAC,CAAD,IAA/C,MAAM,OAAO,KAAA,KAAa,MAAM,OAAO,WAAvE,CAAC,YAAY,CAAC,YAAY;EAAsD;EACtF,IAAA,WAAA;GACEC,OAAAA,gBAAAA,SAAAA,WAAAA;IACE,IAAA,YAAA;KAAW,OAAA,MAAM,MAAM;IAAQ;IAC/BC,MAAK;IACL,aAAU;GAGX,GAFM,MAJP,EAKE,IAAA,UAAA;IAAO,OAAA,UAAU;GAAC,EACnB,CAAA,CAAA;EACH;EAVF,IAAA,WAAA;GAYG,OAAA,OAAO;EACJ;;AAEV"}
|
|
@@ -12,7 +12,7 @@ var _tmpl$4 = /* @__PURE__ */ template(`<label>`);
|
|
|
12
12
|
var _tmpl$5 = /* @__PURE__ */ template(`<div>`);
|
|
13
13
|
var Check = fastIcon(Check$1);
|
|
14
14
|
var Minus = fastIcon(Minus$1);
|
|
15
|
-
var controlClass = (className) => cn("border-input bg-transparent flex size-4 shrink-0 items-center justify-center rounded-sm border", "transition-[color,box-shadow,border-color,background-color] ease-out outline-none", "peer-focus-visible:border-ring peer-focus-visible:
|
|
15
|
+
var controlClass = (className) => cn("border-input bg-transparent flex size-4 shrink-0 items-center justify-center rounded-sm border", "transition-[color,box-shadow,border-color,background-color] ease-out outline-none", "peer-focus-visible:border-ring peer-focus-visible:focus-outline", "data-[checked]:bg-primary data-[checked]:border-primary data-[checked]:text-primary-foreground", "data-[indeterminate]:bg-primary data-[indeterminate]:border-primary data-[indeterminate]:text-primary-foreground", "data-[invalid]:border-destructive data-[invalid]:ring-3 data-[invalid]:ring-destructive-subtle", "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50", className);
|
|
16
16
|
var flag = (on) => on ? "" : void 0;
|
|
17
17
|
var CheckboxContext = createContext(null);
|
|
18
18
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","names":["role=\"group\"","ref={(element) => {\n input = element\n }}","<Minus class=\"size-3\" />","class=\"size-3\"","<Check class=\"size-3\" />","data-indeterminate={dataIndeterminate()}","<CheckboxContext value={context}>{props.children}</CheckboxContext>","value={context}","<Show when={label() || description()}>\n <div class=\"grid gap-0.5\">\n <Show when={label()}>\n <label\n id={labelId}\n for={inputId()}\n class={cn('text-sm font-medium', props.labelClass)}\n data-checked={dataChecked()}\n data-disabled={dataDisabled()}\n >\n {label()}\n </label>\n </Show>\n <Show when={description()}>\n <div\n id={descriptionId}\n class={cn('text-muted-foreground text-sm', props.descriptionClass)}\n data-checked={dataChecked()}\n data-disabled={dataDisabled()}\n >\n {description()}\n </div>\n </Show>\n </div>\n </Show>","class={cn('text-sm font-medium', props.labelClass)}","data-checked={dataChecked()}","data-disabled={dataDisabled()}","<div class=\"grid gap-0.5\">\n <Show when={label()}>\n <label\n id={labelId}\n for={inputId()}\n class={cn('text-sm font-medium', props.labelClass)}\n data-checked={dataChecked()}\n data-disabled={dataDisabled()}\n >\n {label()}\n </label>\n </Show>\n <Show when={description()}>\n <div\n id={descriptionId}\n class={cn('text-muted-foreground text-sm', props.descriptionClass)}\n data-checked={dataChecked()}\n data-disabled={dataDisabled()}\n >\n {description()}\n </div>\n </Show>\n </div>","name={props.name ?? rootId()}","value={props.value ?? 'on'}","checked={checked()}","required={props.required}","disabled={props.disabled}","readonly={props.readOnly}","aria-label={props['aria-label']}","aria-labelledby={labelledBy()}","aria-describedby={describedBy()}","aria-invalid={\n field?.['aria-invalid'] ??\n props['aria-invalid'] ??\n (props.validationState === 'invalid' ? 'true' : undefined)\n }","aria-errormessage={field?.['aria-errormessage'] ?? props['aria-errormessage']}","aria-busy={props['aria-busy']}","aria-required={props.required ? 'true' : undefined}","aria-disabled={props.disabled ? 'true' : undefined}","aria-readonly={props.readOnly ? 'true' : undefined}","title={props.title}","data-invalid={dataInvalid()}","class={controlClass(props.controlClass)}","id={inputId()}","<div\n data-slot=\"checkbox\"\n role=\"group\"\n id={rootId()}\n title={props.title}\n class={cn('group/checkbox relative flex items-start gap-2.5', props.class)}\n data-checked={dataChecked()}\n data-indeterminate={dataIndeterminate()}\n data-invalid={dataInvalid()}\n data-valid={flag(props.validationState === 'valid')}\n data-required={flag(props.required)}\n data-disabled={dataDisabled()}\n data-readonly={flag(props.readOnly)}\n {...(rest as ComponentProps<'div'>)}\n >\n {/*\n * The name goes on the input, which is what carries the value and takes\n * focus. On the root it would land on a plain div and name nothing: the\n * box would announce its state with no subject.\n */}\n <input\n ref={(element) => {\n input = element\n }}\n type=\"checkbox\"\n class=\"peer sr-only\"\n id={inputId()}\n name={props.name ?? rootId()}\n value={props.value ?? 'on'}\n checked={checked()}\n required={props.required}\n disabled={props.disabled}\n readonly={props.readOnly}\n aria-label={props['aria-label']}\n aria-labelledby={labelledBy()}\n aria-describedby={describedBy()}\n aria-invalid={\n field?.['aria-invalid'] ??\n props['aria-invalid'] ??\n (props.validationState === 'invalid' ? 'true' : undefined)\n }\n aria-errormessage={field?.['aria-errormessage'] ?? props['aria-errormessage']}\n aria-busy={props['aria-busy']}\n aria-required={props.required ? 'true' : undefined}\n aria-disabled={props.disabled ? 'true' : undefined}\n aria-readonly={props.readOnly ? 'true' : undefined}\n title={props.title}\n data-checked={dataChecked()}\n data-indeterminate={dataIndeterminate()}\n onChange={(event) => {\n event.stopPropagation()\n // Controlled: the box shows the value the host keeps, not the click.\n event.currentTarget.checked = setChecked(event.currentTarget.checked)\n }}\n />\n <div\n data-checked={dataChecked()}\n data-indeterminate={dataIndeterminate()}\n data-invalid={dataInvalid()}\n data-disabled={dataDisabled()}\n class={controlClass(props.controlClass)}\n onClick={() => {\n setChecked(!checked())\n input?.focus({ preventScroll: true })\n }}\n >\n <Show when={checked() || mixed()}>\n <div\n class=\"flex items-center justify-center\"\n data-checked={dataChecked()}\n data-indeterminate={dataIndeterminate()}\n >\n {mixed() ? <Minus class=\"size-3\" /> : <Check class=\"size-3\" />}\n </div>\n </Show>\n </div>\n {composed ? (\n <CheckboxContext value={context}>{props.children}</CheckboxContext>\n ) : (\n <Show when={label() || description()}>\n <div class=\"grid gap-0.5\">\n <Show when={label()}>\n <label\n id={labelId}\n for={inputId()}\n class={cn('text-sm font-medium', props.labelClass)}\n data-checked={dataChecked()}\n data-disabled={dataDisabled()}\n >\n {label()}\n </label>\n </Show>\n <Show when={description()}>\n <div\n id={descriptionId}\n class={cn('text-muted-foreground text-sm', props.descriptionClass)}\n data-checked={dataChecked()}\n data-disabled={dataDisabled()}\n >\n {description()}\n </div>\n </Show>\n </div>\n </Show>\n )}\n </div>","<label\n id={box.labelId}\n for={box.inputId()}\n data-checked={box.checked()}\n data-disabled={box.disabled()}\n class={cn('text-sm font-medium', props.class)}\n {...rest}\n />","<div\n id={box.descriptionId}\n data-checked={box.checked()}\n data-disabled={box.disabled()}\n class={cn('text-muted-foreground text-sm', props.class)}\n {...rest}\n />","LucideCheck","LucideMinus","resolveChildren","_$spread","_$ref","_$insert","_$effect","_$setAttribute","_$readShallow","_$className","_$setProperty"],"sources":["../../../../src/components/ui/checkbox/checkbox.tsx"],"sourcesContent":["import { Check as LucideCheck, Minus as LucideMinus } from '@lucide/solid'\nimport type { ComponentProps, JSX } from '@solidjs/web'\nimport {\n children as resolveChildren,\n createContext,\n createEffect,\n createSignal,\n createUniqueId,\n merge,\n onSettled,\n Show,\n omit,\n useContext,\n} from 'solid-js'\nimport { useFormFieldControl } from '#lib/form-field'\nimport { cn } from '#lib/utils'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst Check = fastIcon(LucideCheck)\nconst Minus = fastIcon(LucideMinus)\n\n/**\n * Checkbox.\n *\n * Three states: unchecked, checked, and indeterminate. Indeterminate is what a\n * \"select all\" box shows when only some rows are selected; it is its own prop\n * and draws a minus over whatever `checked` says, so there is no way to render\n * a box that shows both glyphs.\n *\n * The paint is the control and the value is a real hidden native checkbox, so\n * the control participates in a form submission and in native validation while\n * looking nothing like a browser checkbox. Focus is taken by the input, which\n * is why the ring lives on the control and reads the input's focus state.\n */\nexport type CheckboxProps = Omit<ComponentProps<'div'>, 'children' | 'onChange'> & {\n /**\n * Whether it is checked. Pass it to control the box. `'indeterminate'` is\n * the same as `indeterminate` with an unchecked box: the minus, and a press\n * checks it.\n */\n checked?: boolean | 'indeterminate'\n /** Whether it starts checked, when uncontrolled. A form reset returns to it. */\n defaultChecked?: boolean | 'indeterminate'\n /** Called with the new checked state when the user toggles it. */\n onChange?: (checked: boolean) => void\n /** Draws the minus glyph: some, not all, of what it stands for is selected. */\n indeterminate?: boolean\n /** The name the input submits under; without one, the root's id. */\n name?: string\n /** What the input submits while checked; `on` by default. */\n value?: string\n required?: boolean\n disabled?: boolean\n readOnly?: boolean\n /** `'invalid'` marks the box and its input invalid. */\n validationState?: 'valid' | 'invalid'\n /** ID for the hidden native checkbox input; useful with an external label. */\n inputId?: string\n controlClass?: string\n labelClass?: string\n descriptionClass?: string\n label?: JSX.Element\n description?: JSX.Element\n /**\n * Replaces the label block. Omit it to get the default control beside\n * `label` and `description`; supply it to compose `CheckboxLabel` and\n * `CheckboxDescription` yourself.\n */\n children?: JSX.Element\n}\n\nconst controlClass = (className?: string) =>\n cn(\n 'border-input bg-transparent flex size-4 shrink-0 items-center justify-center rounded-sm border',\n 'transition-[color,box-shadow,border-color,background-color] ease-out outline-none',\n 'peer-focus-visible:border-ring peer-focus-visible:ring-3 peer-focus-visible:ring-primary-subtle',\n 'data-[checked]:bg-primary data-[checked]:border-primary data-[checked]:text-primary-foreground',\n 'data-[indeterminate]:bg-primary data-[indeterminate]:border-primary data-[indeterminate]:text-primary-foreground',\n 'data-[invalid]:border-destructive data-[invalid]:ring-3 data-[invalid]:ring-destructive-subtle',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n className\n )\n\nconst flag = (on: boolean | undefined) => (on ? '' : undefined)\n\n/** What `CheckboxLabel` and `CheckboxDescription` need from their box. */\ntype CheckboxParts = {\n inputId: () => string\n labelId: string\n descriptionId: string\n checked: () => string | undefined\n disabled: () => string | undefined\n /** Counts a mounted part, so the input only points at ids that exist. */\n mount: (part: 'label' | 'description') => () => void\n}\n\nconst CheckboxContext = createContext<CheckboxParts | null>(null)\n\n/**\n * Checkbox.\n *\n * Renders a native checkbox and its painted control directly, not a headless\n * primitive's parts. ui-sdk's Checkbox (a `role=\"checkbox\"` button over a\n * hidden input) measured about 1 ms per box in the unit DOM against 0.04 ms for\n * this one, and a settings page or a selectable list pays that once per row;\n * Kobalte's Checkbox cost the same, which is why this path predates the port.\n * A native input also gives Space, label clicks, form submission, reset and\n * `:disabled` for free. The contract: `checked`/`defaultChecked`/\n * `onChange(checked)`, `indeterminate`, `name`, `value`, `required`,\n * `disabled`, `readOnly`, `validationState`, and the same `data-*` state\n * attributes on every part. `children` replace the label block and may use\n * `CheckboxLabel` and `CheckboxDescription`, which find the box through a\n * context.\n */\nexport function Checkbox(props: CheckboxProps) {\n const rest = omit(\n props,\n 'class',\n 'controlClass',\n 'labelClass',\n 'descriptionClass',\n 'label',\n 'description',\n 'children',\n 'indeterminate',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-errormessage',\n 'aria-busy',\n 'id',\n 'inputId',\n 'title',\n 'checked',\n 'defaultChecked',\n 'onChange',\n 'name',\n 'value',\n 'required',\n 'disabled',\n 'readOnly',\n 'validationState'\n )\n const field = useFormFieldControl(\n 'control',\n merge(props, {\n get id() {\n return props.inputId ?? props.id\n },\n })\n )\n const uid = createUniqueId()\n // The root names the input and, without a `name`, the form value.\n const rootId = () => (field ? undefined : props.id || undefined) ?? `checkbox-${uid}`\n const inputId = () => field?.id ?? props.inputId ?? `${rootId()}-input`\n const descriptionId = `checkbox-${uid}-description`\n const labelId = `checkbox-${uid}-label`\n // Derived from `defaultChecked`, so a new default restarts an uncontrolled box.\n const [ownChecked, setOwnChecked] = createSignal<boolean | 'indeterminate'>(\n () => props.defaultChecked ?? false\n )\n const state = () => props.checked ?? ownChecked()\n const checked = () => state() === true\n const mixed = () => Boolean(props.indeterminate) || state() === 'indeterminate'\n // Returns what the control shows now. A write is read back only after the\n // next flush, so an event handler that has to put the input right uses this\n // value rather than reading `checked()` straight after the write.\n const setChecked = (next: boolean) => {\n if (props.disabled || props.readOnly || next === checked()) return checked()\n if (props.checked === undefined) setOwnChecked(next)\n props.onChange?.(next)\n return props.checked === undefined ? next : props.checked === true\n }\n let input: HTMLInputElement | undefined\n // A native form reset puts the input back on its default without an input or\n // change event, so the state follows it.\n onSettled(() => {\n // The reset baseline (the `checked` attribute); `checked` below only sets the property.\n if (input) input.defaultChecked = props.defaultChecked === true\n const form = input?.form\n if (!form) return\n const reset = () => {\n if (props.checked === undefined) setOwnChecked(props.defaultChecked ?? false)\n else setChecked(props.defaultChecked === true)\n // The browser resets the input after this event; then the input shows the state.\n setTimeout(() => {\n if (input) input.checked = checked()\n })\n }\n form.addEventListener('reset', reset)\n return () => form.removeEventListener('reset', reset)\n })\n // `indeterminate` is a property with no attribute, so it is set on the node\n // once the node exists, and again whenever the prop changes.\n createEffect(mixed, (on) => {\n if (input) input.indeterminate = on\n })\n\n // Composed parts announce themselves, so the input names and describes\n // itself only with elements that are in the page.\n const [parts, setParts] = createSignal({ label: 0, description: 0 })\n const mount = (part: 'label' | 'description') => {\n setParts((count) => ({ ...count, [part]: count[part] + 1 }))\n return () => setParts((count) => ({ ...count, [part]: count[part] - 1 }))\n }\n\n const composed = 'children' in props\n const label = resolveChildren(() => (composed ? undefined : props.label))\n const description = resolveChildren(() => (composed ? undefined : props.description))\n const hasLabel = () => Boolean(label()) || parts().label > 0\n const hasDescription = () => Boolean(description()) || parts().description > 0\n // Naming: the label element, then the input itself when it also has an\n // aria-label; the description before any caller's description.\n const labelledBy = () => {\n const external = field?.['aria-labelledby'] ?? props['aria-labelledby']\n const own = hasLabel() ? labelId : undefined\n const self = (external || own) && props['aria-label'] ? inputId() : undefined\n return [external, own, self].filter(Boolean).join(' ') || undefined\n }\n const describedBy = () =>\n [\n hasDescription() ? descriptionId : '',\n field?.['aria-describedby'] ?? props['aria-describedby'],\n ]\n .filter(Boolean)\n .join(' ') || undefined\n const dataChecked = () => flag(checked())\n const dataIndeterminate = () => flag(mixed())\n const dataInvalid = () => flag(props.validationState === 'invalid')\n const dataDisabled = () => flag(props.disabled)\n const context: CheckboxParts = {\n inputId,\n labelId,\n descriptionId,\n checked: dataChecked,\n disabled: dataDisabled,\n mount,\n }\n\n return (\n <div\n data-slot=\"checkbox\"\n role=\"group\"\n id={rootId()}\n title={props.title}\n class={cn('group/checkbox relative flex items-start gap-2.5', props.class)}\n data-checked={dataChecked()}\n data-indeterminate={dataIndeterminate()}\n data-invalid={dataInvalid()}\n data-valid={flag(props.validationState === 'valid')}\n data-required={flag(props.required)}\n data-disabled={dataDisabled()}\n data-readonly={flag(props.readOnly)}\n {...(rest as ComponentProps<'div'>)}\n >\n {/*\n * The name goes on the input, which is what carries the value and takes\n * focus. On the root it would land on a plain div and name nothing: the\n * box would announce its state with no subject.\n */}\n <input\n ref={(element) => {\n input = element\n }}\n type=\"checkbox\"\n class=\"peer sr-only\"\n id={inputId()}\n name={props.name ?? rootId()}\n value={props.value ?? 'on'}\n checked={checked()}\n required={props.required}\n disabled={props.disabled}\n readonly={props.readOnly}\n aria-label={props['aria-label']}\n aria-labelledby={labelledBy()}\n aria-describedby={describedBy()}\n aria-invalid={\n field?.['aria-invalid'] ??\n props['aria-invalid'] ??\n (props.validationState === 'invalid' ? 'true' : undefined)\n }\n aria-errormessage={field?.['aria-errormessage'] ?? props['aria-errormessage']}\n aria-busy={props['aria-busy']}\n aria-required={props.required ? 'true' : undefined}\n aria-disabled={props.disabled ? 'true' : undefined}\n aria-readonly={props.readOnly ? 'true' : undefined}\n title={props.title}\n data-checked={dataChecked()}\n data-indeterminate={dataIndeterminate()}\n onChange={(event) => {\n event.stopPropagation()\n // Controlled: the box shows the value the host keeps, not the click.\n event.currentTarget.checked = setChecked(event.currentTarget.checked)\n }}\n />\n <div\n data-checked={dataChecked()}\n data-indeterminate={dataIndeterminate()}\n data-invalid={dataInvalid()}\n data-disabled={dataDisabled()}\n class={controlClass(props.controlClass)}\n onClick={() => {\n setChecked(!checked())\n input?.focus({ preventScroll: true })\n }}\n >\n <Show when={checked() || mixed()}>\n <div\n class=\"flex items-center justify-center\"\n data-checked={dataChecked()}\n data-indeterminate={dataIndeterminate()}\n >\n {mixed() ? <Minus class=\"size-3\" /> : <Check class=\"size-3\" />}\n </div>\n </Show>\n </div>\n {composed ? (\n <CheckboxContext value={context}>{props.children}</CheckboxContext>\n ) : (\n <Show when={label() || description()}>\n <div class=\"grid gap-0.5\">\n <Show when={label()}>\n <label\n id={labelId}\n for={inputId()}\n class={cn('text-sm font-medium', props.labelClass)}\n data-checked={dataChecked()}\n data-disabled={dataDisabled()}\n >\n {label()}\n </label>\n </Show>\n <Show when={description()}>\n <div\n id={descriptionId}\n class={cn('text-muted-foreground text-sm', props.descriptionClass)}\n data-checked={dataChecked()}\n data-disabled={dataDisabled()}\n >\n {description()}\n </div>\n </Show>\n </div>\n </Show>\n )}\n </div>\n )\n}\n\nfunction useCheckboxPart(name: string, part: 'label' | 'description') {\n const box = useContext(CheckboxContext)\n if (!box) throw new Error(`<${name}> must be used inside <Checkbox>.`)\n onSettled(() => box.mount(part))\n return box\n}\n\n/**\n * The box's own label. Valid only inside a `<Checkbox>`, for the same reason as\n * `SwitchLabel`: outside its root there is no control to associate with.\n */\nexport function CheckboxLabel(props: ComponentProps<'label'>) {\n const box = useCheckboxPart('CheckboxLabel', 'label')\n const rest = omit(props, 'class')\n return (\n <label\n id={box.labelId}\n for={box.inputId()}\n data-checked={box.checked()}\n data-disabled={box.disabled()}\n class={cn('text-sm font-medium', props.class)}\n {...rest}\n />\n )\n}\n\nexport function CheckboxDescription(props: ComponentProps<'div'>) {\n const box = useCheckboxPart('CheckboxDescription', 'description')\n const rest = omit(props, 'class')\n return (\n <div\n id={box.descriptionId}\n data-checked={box.checked()}\n data-disabled={box.disabled()}\n class={cn('text-muted-foreground text-sm', props.class)}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,IAAM,QAAQ,SAASmC,OAAW;AAClC,IAAM,QAAQ,SAASC,OAAW;AAoDlC,IAAM,gBAAgB,cACpB,GACE,kGACA,qFACA,mGACA,kGACA,oHACA,kGACA,iEACA,SACF;AAEF,IAAM,QAAQ,OAA6B,KAAK,KAAK,KAAA;AAarD,IAAM,kBAAkB,cAAoC,IAAI;;;;;;;;;;;;;;;;;AAkBhE,SAAgB,SAAS,OAAsB;CAC7C,MAAM,OAAO,KACX,OACA,SACA,gBACA,cACA,oBACA,SACA,eACA,YACA,iBACA,cACA,mBACA,oBACA,gBACA,qBACA,aACA,MACA,WACA,SACA,WACA,kBACA,YACA,QACA,SACA,YACA,YACA,YACA,iBACF;CACA,MAAM,QAAQ,oBACZ,WACA,MAAM,OAAO,EACX,IAAI,KAAK;EACP,OAAO,MAAM,WAA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
|
+
{"version":3,"file":"checkbox.js","names":["role=\"group\"","ref={(element) => {\n input = element\n }}","<Minus class=\"size-3\" />","class=\"size-3\"","<Check class=\"size-3\" />","data-indeterminate={dataIndeterminate()}","<CheckboxContext value={context}>{props.children}</CheckboxContext>","value={context}","<Show when={label() || description()}>\n <div class=\"grid gap-0.5\">\n <Show when={label()}>\n <label\n id={labelId}\n for={inputId()}\n class={cn('text-sm font-medium', props.labelClass)}\n data-checked={dataChecked()}\n data-disabled={dataDisabled()}\n >\n {label()}\n </label>\n </Show>\n <Show when={description()}>\n <div\n id={descriptionId}\n class={cn('text-muted-foreground text-sm', props.descriptionClass)}\n data-checked={dataChecked()}\n data-disabled={dataDisabled()}\n >\n {description()}\n </div>\n </Show>\n </div>\n </Show>","class={cn('text-sm font-medium', props.labelClass)}","data-checked={dataChecked()}","data-disabled={dataDisabled()}","<div class=\"grid gap-0.5\">\n <Show when={label()}>\n <label\n id={labelId}\n for={inputId()}\n class={cn('text-sm font-medium', props.labelClass)}\n data-checked={dataChecked()}\n data-disabled={dataDisabled()}\n >\n {label()}\n </label>\n </Show>\n <Show when={description()}>\n <div\n id={descriptionId}\n class={cn('text-muted-foreground text-sm', props.descriptionClass)}\n data-checked={dataChecked()}\n data-disabled={dataDisabled()}\n >\n {description()}\n </div>\n </Show>\n </div>","name={props.name ?? rootId()}","value={props.value ?? 'on'}","checked={checked()}","required={props.required}","disabled={props.disabled}","readonly={props.readOnly}","aria-label={props['aria-label']}","aria-labelledby={labelledBy()}","aria-describedby={describedBy()}","aria-invalid={\n field?.['aria-invalid'] ??\n props['aria-invalid'] ??\n (props.validationState === 'invalid' ? 'true' : undefined)\n }","aria-errormessage={field?.['aria-errormessage'] ?? props['aria-errormessage']}","aria-busy={props['aria-busy']}","aria-required={props.required ? 'true' : undefined}","aria-disabled={props.disabled ? 'true' : undefined}","aria-readonly={props.readOnly ? 'true' : undefined}","title={props.title}","data-invalid={dataInvalid()}","class={controlClass(props.controlClass)}","id={inputId()}","<div\n data-slot=\"checkbox\"\n role=\"group\"\n id={rootId()}\n title={props.title}\n class={cn('group/checkbox relative flex items-start gap-2.5', props.class)}\n data-checked={dataChecked()}\n data-indeterminate={dataIndeterminate()}\n data-invalid={dataInvalid()}\n data-valid={flag(props.validationState === 'valid')}\n data-required={flag(props.required)}\n data-disabled={dataDisabled()}\n data-readonly={flag(props.readOnly)}\n {...(rest as ComponentProps<'div'>)}\n >\n {/*\n * The name goes on the input, which is what carries the value and takes\n * focus. On the root it would land on a plain div and name nothing: the\n * box would announce its state with no subject.\n */}\n <input\n ref={(element) => {\n input = element\n }}\n type=\"checkbox\"\n class=\"peer sr-only\"\n id={inputId()}\n name={props.name ?? rootId()}\n value={props.value ?? 'on'}\n checked={checked()}\n required={props.required}\n disabled={props.disabled}\n readonly={props.readOnly}\n aria-label={props['aria-label']}\n aria-labelledby={labelledBy()}\n aria-describedby={describedBy()}\n aria-invalid={\n field?.['aria-invalid'] ??\n props['aria-invalid'] ??\n (props.validationState === 'invalid' ? 'true' : undefined)\n }\n aria-errormessage={field?.['aria-errormessage'] ?? props['aria-errormessage']}\n aria-busy={props['aria-busy']}\n aria-required={props.required ? 'true' : undefined}\n aria-disabled={props.disabled ? 'true' : undefined}\n aria-readonly={props.readOnly ? 'true' : undefined}\n title={props.title}\n data-checked={dataChecked()}\n data-indeterminate={dataIndeterminate()}\n onChange={(event) => {\n event.stopPropagation()\n // Controlled: the box shows the value the host keeps, not the click.\n event.currentTarget.checked = setChecked(event.currentTarget.checked)\n }}\n />\n <div\n data-checked={dataChecked()}\n data-indeterminate={dataIndeterminate()}\n data-invalid={dataInvalid()}\n data-disabled={dataDisabled()}\n class={controlClass(props.controlClass)}\n onClick={() => {\n setChecked(!checked())\n input?.focus({ preventScroll: true })\n }}\n >\n <Show when={checked() || mixed()}>\n <div\n class=\"flex items-center justify-center\"\n data-checked={dataChecked()}\n data-indeterminate={dataIndeterminate()}\n >\n {mixed() ? <Minus class=\"size-3\" /> : <Check class=\"size-3\" />}\n </div>\n </Show>\n </div>\n {composed ? (\n <CheckboxContext value={context}>{props.children}</CheckboxContext>\n ) : (\n <Show when={label() || description()}>\n <div class=\"grid gap-0.5\">\n <Show when={label()}>\n <label\n id={labelId}\n for={inputId()}\n class={cn('text-sm font-medium', props.labelClass)}\n data-checked={dataChecked()}\n data-disabled={dataDisabled()}\n >\n {label()}\n </label>\n </Show>\n <Show when={description()}>\n <div\n id={descriptionId}\n class={cn('text-muted-foreground text-sm', props.descriptionClass)}\n data-checked={dataChecked()}\n data-disabled={dataDisabled()}\n >\n {description()}\n </div>\n </Show>\n </div>\n </Show>\n )}\n </div>","<label\n id={box.labelId}\n for={box.inputId()}\n data-checked={box.checked()}\n data-disabled={box.disabled()}\n class={cn('text-sm font-medium', props.class)}\n {...rest}\n />","<div\n id={box.descriptionId}\n data-checked={box.checked()}\n data-disabled={box.disabled()}\n class={cn('text-muted-foreground text-sm', props.class)}\n {...rest}\n />","LucideCheck","LucideMinus","resolveChildren","_$spread","_$ref","_$insert","_$effect","_$setAttribute","_$readShallow","_$className","_$setProperty"],"sources":["../../../../src/components/ui/checkbox/checkbox.tsx"],"sourcesContent":["import { Check as LucideCheck, Minus as LucideMinus } from '@lucide/solid'\nimport type { ComponentProps, JSX } from '@solidjs/web'\nimport {\n children as resolveChildren,\n createContext,\n createEffect,\n createSignal,\n createUniqueId,\n merge,\n onSettled,\n Show,\n omit,\n useContext,\n} from 'solid-js'\nimport { useFormFieldControl } from '#lib/form-field'\nimport { cn } from '#lib/utils'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst Check = fastIcon(LucideCheck)\nconst Minus = fastIcon(LucideMinus)\n\n/**\n * Checkbox.\n *\n * Three states: unchecked, checked, and indeterminate. Indeterminate is what a\n * \"select all\" box shows when only some rows are selected; it is its own prop\n * and draws a minus over whatever `checked` says, so there is no way to render\n * a box that shows both glyphs.\n *\n * The paint is the control and the value is a real hidden native checkbox, so\n * the control participates in a form submission and in native validation while\n * looking nothing like a browser checkbox. Focus is taken by the input, which\n * is why the ring lives on the control and reads the input's focus state.\n */\nexport type CheckboxProps = Omit<ComponentProps<'div'>, 'children' | 'onChange'> & {\n /**\n * Whether it is checked. Pass it to control the box. `'indeterminate'` is\n * the same as `indeterminate` with an unchecked box: the minus, and a press\n * checks it.\n */\n checked?: boolean | 'indeterminate'\n /** Whether it starts checked, when uncontrolled. A form reset returns to it. */\n defaultChecked?: boolean | 'indeterminate'\n /** Called with the new checked state when the user toggles it. */\n onChange?: (checked: boolean) => void\n /** Draws the minus glyph: some, not all, of what it stands for is selected. */\n indeterminate?: boolean\n /** The name the input submits under; without one, the root's id. */\n name?: string\n /** What the input submits while checked; `on` by default. */\n value?: string\n required?: boolean\n disabled?: boolean\n readOnly?: boolean\n /** `'invalid'` marks the box and its input invalid. */\n validationState?: 'valid' | 'invalid'\n /** ID for the hidden native checkbox input; useful with an external label. */\n inputId?: string\n controlClass?: string\n labelClass?: string\n descriptionClass?: string\n label?: JSX.Element\n description?: JSX.Element\n /**\n * Replaces the label block. Omit it to get the default control beside\n * `label` and `description`; supply it to compose `CheckboxLabel` and\n * `CheckboxDescription` yourself.\n */\n children?: JSX.Element\n}\n\nconst controlClass = (className?: string) =>\n cn(\n 'border-input bg-transparent flex size-4 shrink-0 items-center justify-center rounded-sm border',\n 'transition-[color,box-shadow,border-color,background-color] ease-out outline-none',\n 'peer-focus-visible:border-ring peer-focus-visible:focus-outline',\n 'data-[checked]:bg-primary data-[checked]:border-primary data-[checked]:text-primary-foreground',\n 'data-[indeterminate]:bg-primary data-[indeterminate]:border-primary data-[indeterminate]:text-primary-foreground',\n 'data-[invalid]:border-destructive data-[invalid]:ring-3 data-[invalid]:ring-destructive-subtle',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n className\n )\n\nconst flag = (on: boolean | undefined) => (on ? '' : undefined)\n\n/** What `CheckboxLabel` and `CheckboxDescription` need from their box. */\ntype CheckboxParts = {\n inputId: () => string\n labelId: string\n descriptionId: string\n checked: () => string | undefined\n disabled: () => string | undefined\n /** Counts a mounted part, so the input only points at ids that exist. */\n mount: (part: 'label' | 'description') => () => void\n}\n\nconst CheckboxContext = createContext<CheckboxParts | null>(null)\n\n/**\n * Checkbox.\n *\n * Renders a native checkbox and its painted control directly, not a headless\n * primitive's parts. ui-sdk's Checkbox (a `role=\"checkbox\"` button over a\n * hidden input) measured about 1 ms per box in the unit DOM against 0.04 ms for\n * this one, and a settings page or a selectable list pays that once per row;\n * Kobalte's Checkbox cost the same, which is why this path predates the port.\n * A native input also gives Space, label clicks, form submission, reset and\n * `:disabled` for free. The contract: `checked`/`defaultChecked`/\n * `onChange(checked)`, `indeterminate`, `name`, `value`, `required`,\n * `disabled`, `readOnly`, `validationState`, and the same `data-*` state\n * attributes on every part. `children` replace the label block and may use\n * `CheckboxLabel` and `CheckboxDescription`, which find the box through a\n * context.\n */\nexport function Checkbox(props: CheckboxProps) {\n const rest = omit(\n props,\n 'class',\n 'controlClass',\n 'labelClass',\n 'descriptionClass',\n 'label',\n 'description',\n 'children',\n 'indeterminate',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-errormessage',\n 'aria-busy',\n 'id',\n 'inputId',\n 'title',\n 'checked',\n 'defaultChecked',\n 'onChange',\n 'name',\n 'value',\n 'required',\n 'disabled',\n 'readOnly',\n 'validationState'\n )\n const field = useFormFieldControl(\n 'control',\n merge(props, {\n get id() {\n return props.inputId ?? props.id\n },\n })\n )\n const uid = createUniqueId()\n // The root names the input and, without a `name`, the form value.\n const rootId = () => (field ? undefined : props.id || undefined) ?? `checkbox-${uid}`\n const inputId = () => field?.id ?? props.inputId ?? `${rootId()}-input`\n const descriptionId = `checkbox-${uid}-description`\n const labelId = `checkbox-${uid}-label`\n // Derived from `defaultChecked`, so a new default restarts an uncontrolled box.\n const [ownChecked, setOwnChecked] = createSignal<boolean | 'indeterminate'>(\n () => props.defaultChecked ?? false\n )\n const state = () => props.checked ?? ownChecked()\n const checked = () => state() === true\n const mixed = () => Boolean(props.indeterminate) || state() === 'indeterminate'\n // Returns what the control shows now. A write is read back only after the\n // next flush, so an event handler that has to put the input right uses this\n // value rather than reading `checked()` straight after the write.\n const setChecked = (next: boolean) => {\n if (props.disabled || props.readOnly || next === checked()) return checked()\n if (props.checked === undefined) setOwnChecked(next)\n props.onChange?.(next)\n return props.checked === undefined ? next : props.checked === true\n }\n let input: HTMLInputElement | undefined\n // A native form reset puts the input back on its default without an input or\n // change event, so the state follows it.\n onSettled(() => {\n // The reset baseline (the `checked` attribute); `checked` below only sets the property.\n if (input) input.defaultChecked = props.defaultChecked === true\n const form = input?.form\n if (!form) return\n const reset = () => {\n if (props.checked === undefined) setOwnChecked(props.defaultChecked ?? false)\n else setChecked(props.defaultChecked === true)\n // The browser resets the input after this event; then the input shows the state.\n setTimeout(() => {\n if (input) input.checked = checked()\n })\n }\n form.addEventListener('reset', reset)\n return () => form.removeEventListener('reset', reset)\n })\n // `indeterminate` is a property with no attribute, so it is set on the node\n // once the node exists, and again whenever the prop changes.\n createEffect(mixed, (on) => {\n if (input) input.indeterminate = on\n })\n\n // Composed parts announce themselves, so the input names and describes\n // itself only with elements that are in the page.\n const [parts, setParts] = createSignal({ label: 0, description: 0 })\n const mount = (part: 'label' | 'description') => {\n setParts((count) => ({ ...count, [part]: count[part] + 1 }))\n return () => setParts((count) => ({ ...count, [part]: count[part] - 1 }))\n }\n\n const composed = 'children' in props\n const label = resolveChildren(() => (composed ? undefined : props.label))\n const description = resolveChildren(() => (composed ? undefined : props.description))\n const hasLabel = () => Boolean(label()) || parts().label > 0\n const hasDescription = () => Boolean(description()) || parts().description > 0\n // Naming: the label element, then the input itself when it also has an\n // aria-label; the description before any caller's description.\n const labelledBy = () => {\n const external = field?.['aria-labelledby'] ?? props['aria-labelledby']\n const own = hasLabel() ? labelId : undefined\n const self = (external || own) && props['aria-label'] ? inputId() : undefined\n return [external, own, self].filter(Boolean).join(' ') || undefined\n }\n const describedBy = () =>\n [\n hasDescription() ? descriptionId : '',\n field?.['aria-describedby'] ?? props['aria-describedby'],\n ]\n .filter(Boolean)\n .join(' ') || undefined\n const dataChecked = () => flag(checked())\n const dataIndeterminate = () => flag(mixed())\n const dataInvalid = () => flag(props.validationState === 'invalid')\n const dataDisabled = () => flag(props.disabled)\n const context: CheckboxParts = {\n inputId,\n labelId,\n descriptionId,\n checked: dataChecked,\n disabled: dataDisabled,\n mount,\n }\n\n return (\n <div\n data-slot=\"checkbox\"\n role=\"group\"\n id={rootId()}\n title={props.title}\n class={cn('group/checkbox relative flex items-start gap-2.5', props.class)}\n data-checked={dataChecked()}\n data-indeterminate={dataIndeterminate()}\n data-invalid={dataInvalid()}\n data-valid={flag(props.validationState === 'valid')}\n data-required={flag(props.required)}\n data-disabled={dataDisabled()}\n data-readonly={flag(props.readOnly)}\n {...(rest as ComponentProps<'div'>)}\n >\n {/*\n * The name goes on the input, which is what carries the value and takes\n * focus. On the root it would land on a plain div and name nothing: the\n * box would announce its state with no subject.\n */}\n <input\n ref={(element) => {\n input = element\n }}\n type=\"checkbox\"\n class=\"peer sr-only\"\n id={inputId()}\n name={props.name ?? rootId()}\n value={props.value ?? 'on'}\n checked={checked()}\n required={props.required}\n disabled={props.disabled}\n readonly={props.readOnly}\n aria-label={props['aria-label']}\n aria-labelledby={labelledBy()}\n aria-describedby={describedBy()}\n aria-invalid={\n field?.['aria-invalid'] ??\n props['aria-invalid'] ??\n (props.validationState === 'invalid' ? 'true' : undefined)\n }\n aria-errormessage={field?.['aria-errormessage'] ?? props['aria-errormessage']}\n aria-busy={props['aria-busy']}\n aria-required={props.required ? 'true' : undefined}\n aria-disabled={props.disabled ? 'true' : undefined}\n aria-readonly={props.readOnly ? 'true' : undefined}\n title={props.title}\n data-checked={dataChecked()}\n data-indeterminate={dataIndeterminate()}\n onChange={(event) => {\n event.stopPropagation()\n // Controlled: the box shows the value the host keeps, not the click.\n event.currentTarget.checked = setChecked(event.currentTarget.checked)\n }}\n />\n <div\n data-checked={dataChecked()}\n data-indeterminate={dataIndeterminate()}\n data-invalid={dataInvalid()}\n data-disabled={dataDisabled()}\n class={controlClass(props.controlClass)}\n onClick={() => {\n setChecked(!checked())\n input?.focus({ preventScroll: true })\n }}\n >\n <Show when={checked() || mixed()}>\n <div\n class=\"flex items-center justify-center\"\n data-checked={dataChecked()}\n data-indeterminate={dataIndeterminate()}\n >\n {mixed() ? <Minus class=\"size-3\" /> : <Check class=\"size-3\" />}\n </div>\n </Show>\n </div>\n {composed ? (\n <CheckboxContext value={context}>{props.children}</CheckboxContext>\n ) : (\n <Show when={label() || description()}>\n <div class=\"grid gap-0.5\">\n <Show when={label()}>\n <label\n id={labelId}\n for={inputId()}\n class={cn('text-sm font-medium', props.labelClass)}\n data-checked={dataChecked()}\n data-disabled={dataDisabled()}\n >\n {label()}\n </label>\n </Show>\n <Show when={description()}>\n <div\n id={descriptionId}\n class={cn('text-muted-foreground text-sm', props.descriptionClass)}\n data-checked={dataChecked()}\n data-disabled={dataDisabled()}\n >\n {description()}\n </div>\n </Show>\n </div>\n </Show>\n )}\n </div>\n )\n}\n\nfunction useCheckboxPart(name: string, part: 'label' | 'description') {\n const box = useContext(CheckboxContext)\n if (!box) throw new Error(`<${name}> must be used inside <Checkbox>.`)\n onSettled(() => box.mount(part))\n return box\n}\n\n/**\n * The box's own label. Valid only inside a `<Checkbox>`, for the same reason as\n * `SwitchLabel`: outside its root there is no control to associate with.\n */\nexport function CheckboxLabel(props: ComponentProps<'label'>) {\n const box = useCheckboxPart('CheckboxLabel', 'label')\n const rest = omit(props, 'class')\n return (\n <label\n id={box.labelId}\n for={box.inputId()}\n data-checked={box.checked()}\n data-disabled={box.disabled()}\n class={cn('text-sm font-medium', props.class)}\n {...rest}\n />\n )\n}\n\nexport function CheckboxDescription(props: ComponentProps<'div'>) {\n const box = useCheckboxPart('CheckboxDescription', 'description')\n const rest = omit(props, 'class')\n return (\n <div\n id={box.descriptionId}\n data-checked={box.checked()}\n data-disabled={box.disabled()}\n class={cn('text-muted-foreground text-sm', props.class)}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,IAAM,QAAQ,SAASmC,OAAW;AAClC,IAAM,QAAQ,SAASC,OAAW;AAoDlC,IAAM,gBAAgB,cACpB,GACE,kGACA,qFACA,mEACA,kGACA,oHACA,kGACA,iEACA,SACF;AAEF,IAAM,QAAQ,OAA6B,KAAK,KAAK,KAAA;AAarD,IAAM,kBAAkB,cAAoC,IAAI;;;;;;;;;;;;;;;;;AAkBhE,SAAgB,SAAS,OAAsB;CAC7C,MAAM,OAAO,KACX,OACA,SACA,gBACA,cACA,oBACA,SACA,eACA,YACA,iBACA,cACA,mBACA,oBACA,gBACA,qBACA,aACA,MACA,WACA,SACA,WACA,kBACA,YACA,QACA,SACA,YACA,YACA,YACA,iBACF;CACA,MAAM,QAAQ,oBACZ,WACA,MAAM,OAAO,EACX,IAAI,KAAK;EACP,OAAO,MAAM,WAAW,MAAM;CAChC,EACF,CAAC,CACH;CACA,MAAM,MAAM,eAAe;CAE3B,MAAM,gBAAgB,QAAQ,KAAA,IAAY,MAAM,MAAM,KAAA,MAAc,YAAY;CAChF,MAAM,gBAAgB,OAAO,MAAM,MAAM,WAAW,GAAG,OAAO,EAAE;CAChE,MAAM,gBAAgB,YAAY,IAAI;CACtC,MAAM,UAAU,YAAY,IAAI;CAEhC,MAAM,CAAC,YAAY,iBAAiB,mBAC5B,MAAM,kBAAkB,KAChC;CACA,MAAM,cAAc,MAAM,WAAW,WAAW;CAChD,MAAM,gBAAgB,MAAM,MAAM;CAClC,MAAM,cAAc,QAAQ,MAAM,aAAa,KAAK,MAAM,MAAM;CAIhE,MAAM,cAAc,SAAkB;EACpC,IAAI,MAAM,YAAY,MAAM,YAAY,SAAS,QAAQ,GAAG,OAAO,QAAQ;EAC3E,IAAI,MAAM,YAAY,KAAA,GAAW,cAAc,IAAI;EACnD,MAAM,WAAW,IAAI;EACrB,OAAO,MAA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c,OAAA,IAAI,QAAQ;EAAC;EAC3B,IAAA,kBAAA;GAAe,OAAA,IAAI,SAAS;EAAC;EAC7B,IAAA,UAAA;GAAO,OAAA,GAAG,uBAAuB,MAAM,KAAK;EAAC;CACrC,GAAJ,IAAA,GAAA,KAAA;CAPR,OACEL;AASJ;AAEA,SAAgB,oBAAoB,OAA8B;CAChE,MAAM,MAAM,gBAAgB,uBAAuB,aAAa;CAChE,MAAM,OAAO,KAAK,OAAO,OAAO;CAE9B,IAAA,SAAA,QAMC;CADCK,OAAA,QAAA,CAAA;EAJA,IAAA,KAAA;GAAI,OAAA,IAAI;EAAa;EACrB,IAAA,iBAAA;GAAc,OAAA,IAAI,QAAQ;EAAC;EAC3B,IAAA,kBAAA;GAAe,OAAA,IAAI,SAAS;EAAC;EAC7B,IAAA,UAAA;GAAO,OAAA,GAAG,iCAAiC,MAAM,KAAK;EAAC;CAC/C,GAAJ,IAAA,GAAA,KAAA;CANR,OACEJ;AAQJ"}
|
|
@@ -15,7 +15,7 @@ function Collapsible(props) {
|
|
|
15
15
|
function CollapsibleTrigger(props) {
|
|
16
16
|
const rest = omit(props, "class");
|
|
17
17
|
return createComponent(CollapsibleTrigger$1, mergeProps({ get "class"() {
|
|
18
|
-
return cn("flex items-center gap-1.5 text-sm font-medium", "transition-colors ease-out outline-none", "focus-visible:border-ring focus-visible:
|
|
18
|
+
return cn("flex items-center gap-1.5 text-sm font-medium", "transition-colors ease-out outline-none", "focus-visible:border-ring focus-visible:focus-outline", "disabled:pointer-events-none disabled:opacity-50", "data-[disabled]:pointer-events-none data-[disabled]:opacity-50", props.class);
|
|
19
19
|
} }, rest));
|
|
20
20
|
}
|
|
21
21
|
function CollapsibleContent(props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapsible.js","names":["<SdkCollapsible\n class={cn('flex w-full flex-col', props.class as string)}\n onOpenChange={(open) => props.onOpenChange?.(open)}\n {...rest}\n />","onOpenChange={(open) => props.onOpenChange?.(open)}","<SdkCollapsibleTrigger\n class={cn(\n 'flex items-center gap-1.5 text-sm font-medium',\n 'transition-colors ease-out outline-none',\n 'focus-visible:border-ring focus-visible:
|
|
1
|
+
{"version":3,"file":"collapsible.js","names":["<SdkCollapsible\n class={cn('flex w-full flex-col', props.class as string)}\n onOpenChange={(open) => props.onOpenChange?.(open)}\n {...rest}\n />","onOpenChange={(open) => props.onOpenChange?.(open)}","<SdkCollapsibleTrigger\n class={cn(\n 'flex items-center gap-1.5 text-sm font-medium',\n 'transition-colors ease-out outline-none',\n 'focus-visible:border-ring focus-visible:focus-outline',\n 'disabled:pointer-events-none disabled:opacity-50',\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n props.class as string\n )}\n {...rest}\n />","<SdkCollapsiblePanel\n keepMounted={props.forceMount}\n class={cn(\n 'overflow-hidden',\n /* The exit keyframes start with `data-closed`, which ui-sdk sets as the\n panel starts to close and waits out before it unmounts the panel. */\n 'data-[open]:animate-in data-[open]:fade-in-0 data-[open]:slide-in-from-top-1',\n 'data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:slide-out-to-top-1',\n props.class as string\n )}\n {...rest}\n />"],"sources":["../../../../src/components/ui/collapsible/collapsible.tsx"],"sourcesContent":["import {\n Collapsible as SdkCollapsible,\n CollapsiblePanel as SdkCollapsiblePanel,\n CollapsibleTrigger as SdkCollapsibleTrigger,\n} from '@ui-sdk/solid/collapsible'\nimport type { ComponentProps } from '@solidjs/web'\nimport { omit } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * Collapsible.\n *\n * One region that shows and hides. Accordion is this in a list; reach for\n * Collapsible when there is exactly one, so a caller does not have to build a\n * one-item accordion whose semantics say \"list of one\".\n *\n * The content animates rather than appearing, which is what keeps a\n * disclosure from reading as a layout jump. ui-sdk keeps the closing panel\n * mounted until its exit animation ends, and publishes the measured height as\n * `--collapsible-panel-height` for a caller that animates the height.\n *\n * State attributes are ui-sdk's: `data-open` while open, `data-closed` while\n * closed (and while animating closed), on the root, the trigger and the panel.\n */\nexport type CollapsibleProps = Omit<ComponentProps<typeof SdkCollapsible>, 'onOpenChange'> & {\n /** Called with the new open state. */\n onOpenChange?: (open: boolean) => void\n}\n\nexport function Collapsible(props: CollapsibleProps) {\n const rest = omit(props, 'class', 'onOpenChange')\n return (\n <SdkCollapsible\n class={cn('flex w-full flex-col', props.class as string)}\n onOpenChange={(open) => props.onOpenChange?.(open)}\n {...rest}\n />\n )\n}\n\nexport function CollapsibleTrigger(props: ComponentProps<typeof SdkCollapsibleTrigger>) {\n const rest = omit(props, 'class')\n\n return (\n <SdkCollapsibleTrigger\n class={cn(\n 'flex items-center gap-1.5 text-sm font-medium',\n 'transition-colors ease-out outline-none',\n 'focus-visible:border-ring focus-visible:focus-outline',\n 'disabled:pointer-events-none disabled:opacity-50',\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n props.class as string\n )}\n {...rest}\n />\n )\n}\n\nexport type CollapsibleContentProps = ComponentProps<typeof SdkCollapsiblePanel> & {\n /** Keeps the panel in the page, hidden, while closed. */\n forceMount?: boolean\n}\n\nexport function CollapsibleContent(props: CollapsibleContentProps) {\n const rest = omit(props, 'class', 'forceMount')\n return (\n <SdkCollapsiblePanel\n keepMounted={props.forceMount}\n class={cn(\n 'overflow-hidden',\n /* The exit keyframes start with `data-closed`, which ui-sdk sets as the\n panel starts to close and waits out before it unmounts the panel. */\n 'data-[open]:animate-in data-[open]:fade-in-0 data-[open]:slide-in-from-top-1',\n 'data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:slide-out-to-top-1',\n props.class as string\n )}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;AA6BA,SAAgB,YAAY,OAAyB;CACnD,MAAM,OAAO,KAAK,OAAO,SAAS,cAAc;CAChD,OACEA,gBAAAA,eAAAA,WAAAA;EACE,IAAA,UAAA;GAAO,OAAA,GAAG,wBAAwB,MAAM,KAAe;EAAC;EACxDC,eAAe,SAAS,MAAM,eAAe,IAAI;CAElD,GADK,IACL,CAAA;AAEL;AAEA,SAAgB,mBAAmB,OAAqD;CACtF,MAAM,OAAO,KAAK,OAAO,OAAO;CAEhC,OACEC,gBAAAA,sBAAAA,WAAAA,EACE,IAAA,UAAA;EAAO,OAAA,GACL,iDACA,2CACA,yDACA,oDACA,kEACA,MAAM,KACR;CAAC,EAEF,GADK,IACL,CAAA;AAEL;AAOA,SAAgB,mBAAmB,OAAgC;CACjE,MAAM,OAAO,KAAK,OAAO,SAAS,YAAY;CAC9C,OACEC,gBAAAA,kBAAAA,WAAAA;EACE,IAAA,cAAA;GAAa,OAAA,MAAM;EAAU;EAC7B,IAAA,UAAA;GAAO,OAAA,GACL,mBAGA,gFACA,uFACA,MAAM,KACR;EAAC;CAEF,GADK,IACL,CAAA;AAEL"}
|
|
@@ -169,7 +169,7 @@ function ComboboxControl(props) {
|
|
|
169
169
|
return scope?.disabled() ? "" : void 0;
|
|
170
170
|
},
|
|
171
171
|
get "class"() {
|
|
172
|
-
return cn("border-input bg-transparent flex h-control-md w-full items-center gap-1.5 rounded-md border px-control-sm", "transition-[color,box-shadow,border-color] ease-out", "focus-within:border-ring focus-within:
|
|
172
|
+
return cn("border-input bg-transparent flex h-control-md w-full items-center gap-1.5 rounded-md border px-control-sm", "transition-[color,box-shadow,border-color] ease-out", "focus-within:border-ring focus-within:focus-outline", "data-[invalid]:border-destructive data-[invalid]:ring-3 data-[invalid]:ring-destructive-subtle", "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50", props.class);
|
|
173
173
|
}
|
|
174
174
|
}, rest], false);
|
|
175
175
|
ref(() => {
|
|
@@ -222,7 +222,7 @@ function ComboboxTrigger(props) {
|
|
|
222
222
|
return _el$4;
|
|
223
223
|
})(),
|
|
224
224
|
get "class"() {
|
|
225
|
-
return cn("text-muted-foreground flex shrink-0 items-center justify-center rounded-sm outline-none", "transition-colors ease-out hover:text-foreground", "focus-visible:border-ring focus-visible:
|
|
225
|
+
return cn("text-muted-foreground flex shrink-0 items-center justify-center rounded-sm outline-none", "transition-colors ease-out hover:text-foreground", "focus-visible:border-ring focus-visible:focus-outline", "disabled:pointer-events-none disabled:opacity-50", props.class);
|
|
226
226
|
},
|
|
227
227
|
get children() {
|
|
228
228
|
return [memo(() => {
|
|
@@ -332,7 +332,7 @@ function ComboboxClear(props) {
|
|
|
332
332
|
var _el$9 = _tmpl$5();
|
|
333
333
|
_el$9._$$click = () => props.onClear();
|
|
334
334
|
insert(_el$9, createComponent(X, { class: "size-3.5" }));
|
|
335
|
-
effect(() => readShallow(cn("text-muted-foreground flex size-4 shrink-0 items-center justify-center rounded-sm", "transition-colors ease-out outline-none hover:text-foreground", "focus-visible:border-ring focus-visible:
|
|
335
|
+
effect(() => readShallow(cn("text-muted-foreground flex size-4 shrink-0 items-center justify-center rounded-sm", "transition-colors ease-out outline-none hover:text-foreground", "focus-visible:border-ring focus-visible:focus-outline", props.class)), (_v$, _$p) => {
|
|
336
336
|
className(_el$9, _v$, _$p);
|
|
337
337
|
});
|
|
338
338
|
return _el$9;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.js","names":["<ComboboxScopeContext value={scope}>\n <ComboboxPrimitive<unknown, boolean>\n multiple={props.multiple}\n value={props.value as unknown}\n defaultValue={props.defaultValue as unknown}\n onValueChange={(value: unknown) =>\n (props.onChange as ((value: unknown) => void) | undefined)?.(value ?? null)\n }\n query={props.inputValue}\n defaultQuery={props.defaultInputValue}\n onQueryChange={(query: string) => props.onInputChange?.(query)}\n itemToValue={keyOf}\n itemToLabel={labelOf}\n isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}\n filter={filter}\n open={props.open}\n defaultOpen={props.defaultOpen}\n onOpenChange={(open: boolean) => props.onOpenChange?.(open)}\n disabled={props.disabled}\n required={props.required}\n readOnly={props.readOnly}\n name={props.name}\n modal={false}\n >\n {props.children}\n </ComboboxPrimitive>\n </ComboboxScopeContext>","value={scope}","<ComboboxPrimitive<unknown, boolean>\n multiple={props.multiple}\n value={props.value as unknown}\n defaultValue={props.defaultValue as unknown}\n onValueChange={(value: unknown) =>\n (props.onChange as ((value: unknown) => void) | undefined)?.(value ?? null)\n }\n query={props.inputValue}\n defaultQuery={props.defaultInputValue}\n onQueryChange={(query: string) => props.onInputChange?.(query)}\n itemToValue={keyOf}\n itemToLabel={labelOf}\n isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}\n filter={filter}\n open={props.open}\n defaultOpen={props.defaultOpen}\n onOpenChange={(open: boolean) => props.onOpenChange?.(open)}\n disabled={props.disabled}\n required={props.required}\n readOnly={props.readOnly}\n name={props.name}\n modal={false}\n >\n {props.children}\n </ComboboxPrimitive>","onValueChange={(value: unknown) =>\n (props.onChange as ((value: unknown) => void) | undefined)?.(value ?? null)\n }","onQueryChange={(query: string) => props.onInputChange?.(query)}","itemToValue={keyOf}","itemToLabel={labelOf}","isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}","onOpenChange={(open: boolean) => props.onOpenChange?.(open)}","modal={false}","<div {...rest}>\n <ComboboxScopeContext value={scope}>\n <ComboboxPrimitive<unknown, boolean>\n multiple={props.multiple}\n value={props.value as unknown}\n defaultValue={props.defaultValue as unknown}\n onValueChange={(value: unknown) =>\n (props.onChange as ((value: unknown) => void) | undefined)?.(value ?? null)\n }\n query={props.inputValue}\n defaultQuery={props.defaultInputValue}\n onQueryChange={(query: string) => props.onInputChange?.(query)}\n itemToValue={keyOf}\n itemToLabel={labelOf}\n isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}\n filter={filter}\n open={props.open}\n defaultOpen={props.defaultOpen}\n onOpenChange={(open: boolean) => props.onOpenChange?.(open)}\n disabled={props.disabled}\n required={props.required}\n readOnly={props.readOnly}\n name={props.name}\n modal={false}\n >\n {props.children}\n </ComboboxPrimitive>\n </ComboboxScopeContext>\n </div>","ref={(element: HTMLDivElement) => {\n if (scope) scope.control.current = element\n callRef(props.ref, element)\n }}","<div\n ref={(element: HTMLDivElement) => {\n if (scope) scope.control.current = element\n callRef(props.ref, element)\n }}\n data-invalid={scope?.invalid() ? '' : undefined}\n data-disabled={scope?.disabled() ? '' : undefined}\n class={cn(\n 'border-input bg-transparent flex h-control-md w-full items-center gap-1.5 rounded-md border px-control-sm',\n 'transition-[color,box-shadow,border-color] ease-out',\n 'focus-within:border-ring focus-within:ring-3 focus-within:ring-primary-subtle',\n 'data-[invalid]:border-destructive data-[invalid]:ring-3 data-[invalid]:ring-destructive-subtle',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n props.class\n )}\n {...rest}\n />","<ComboboxInputPrimitive\n {...(rest as Record<string, unknown>)}\n id={field?.id ?? props.id}\n placeholder={props.placeholder ?? scope?.placeholder()}\n aria-label={props['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? props['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? props['aria-describedby']}\n aria-invalid={\n field?.['aria-invalid'] ?? props['aria-invalid'] ?? (scope?.invalid() ? 'true' : undefined)\n }\n aria-errormessage={field?.['aria-errormessage'] ?? props['aria-errormessage']}\n class={cn(\n 'h-full flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n props.class\n )}\n />","<ComboboxTriggerPrimitive\n {...(rest as Record<string, unknown>)}\n render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <button {...part} data-expanded={state.open ? '' : undefined} />\n )}\n class={cn(\n 'text-muted-foreground flex shrink-0 items-center justify-center rounded-sm outline-none',\n 'transition-colors ease-out hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'disabled:pointer-events-none disabled:opacity-50',\n props.class\n )}\n >\n {props.children}\n <span aria-hidden=\"true\">\n <ChevronDown class=\"size-4\" />\n </span>\n </ComboboxTriggerPrimitive>","render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <button {...part} data-expanded={state.open ? '' : undefined} />\n )}","props.children","<ChevronDown class=\"size-4\" />","class=\"size-4\"","<ComboboxContentPrimitive\n {...(rest as Record<string, unknown>)}\n // Anchored to the whole control, as Kobalte did, so the list lines up\n // with the bordered row rather than the bare input inside it.\n anchor={{\n getBoundingClientRect: () =>\n (scope?.control.current ?? document.body).getBoundingClientRect(),\n }}\n // Kobalte's listbox popper gap (8 by default) plus half its arrow's box:\n // the Solid 1 content carried a popper arrow, which drew nothing visible\n // but pushed the list 15px further from the control. Kept for parity.\n sideOffset={(scope?.gutter() ?? 8) + 15}\n render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <div {...part} data-expanded={state.open ? '' : undefined} />\n )}\n class={cn(\n 'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg',\n 'z-(--z-menu) max-h-72 min-w-(--anchor-width) origin-(--transform-origin) overflow-hidden',\n 'data-expanded:animate-in data-expanded:fade-in-0 data-expanded:zoom-in-95',\n 'data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n 'data-expanded:duration-150 data-closed:duration-100',\n props.class\n )}\n >\n <ComboboxList class={cn('max-h-72 overflow-y-auto', menuContentPadding)}>\n <For each={scope?.nodes() ?? []}>\n {(node) => {\n if (node.type === 'section') {\n const Section = dynamic(() => scope?.sectionComponent())\n return <Section section={node} />\n }\n const Item = dynamic(() => scope?.itemComponent())\n return <Item item={node} />\n }}\n </For>\n </ComboboxList>\n {props.children}\n </ComboboxContentPrimitive>","anchor={{\n getBoundingClientRect: () =>\n (scope?.control.current ?? document.body).getBoundingClientRect(),\n }}","render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <div {...part} data-expanded={state.open ? '' : undefined} />\n )}","<ComboboxList class={cn('max-h-72 overflow-y-auto', menuContentPadding)}>\n <For each={scope?.nodes() ?? []}>\n {(node) => {\n if (node.type === 'section') {\n const Section = dynamic(() => scope?.sectionComponent())\n return <Section section={node} />\n }\n const Item = dynamic(() => scope?.itemComponent())\n return <Item item={node} />\n }}\n </For>\n </ComboboxList>","<For each={scope?.nodes() ?? []}>\n {(node) => {\n if (node.type === 'section') {\n const Section = dynamic(() => scope?.sectionComponent())\n return <Section section={node} />\n }\n const Item = dynamic(() => scope?.itemComponent())\n return <Item item={node} />\n }}\n </For>","<Section section={node} />","section={node}","<Item item={node} />","item={node}","<ComboboxItemPrimitive\n {...(rest as Record<string, unknown>)}\n value={props.item.rawValue}\n label={props.item.textValue}\n disabled={props.item.disabled}\n class={cn(menuItem, 'pe-8', props.class)}\n >\n {(state: { selected: boolean }) => (\n <>\n <div>{props.children}</div>\n {/* The indicator reads in the accent, like every other selected\n state in the system. Drawn from the row's `selected` state. */}\n <Show when={state.selected}>\n <span\n data-slot=\"combobox-indicator\"\n aria-hidden=\"true\"\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Check class=\"size-4\" />\n </span>\n </Show>\n </>\n )}\n </ComboboxItemPrimitive>","<Show when={state.selected}>\n <span\n data-slot=\"combobox-indicator\"\n aria-hidden=\"true\"\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Check class=\"size-4\" />\n </span>\n </Show>","<Check class=\"size-4\" />","role=\"presentation\"","<div role=\"presentation\" class={cn('flex flex-col', props.class)} {...rest} />","<Show when={props.onClear}>\n <button\n type=\"button\"\n aria-label=\"Clear selection\"\n onClick={() => props.onClear()}\n class={cn(\n 'text-muted-foreground flex size-4 shrink-0 items-center justify-center rounded-sm',\n 'transition-colors ease-out outline-none hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n props.class\n )}\n >\n <X class=\"size-3.5\" />\n </button>\n </Show>","<X class=\"size-3.5\" />","class=\"size-3.5\"","LucideCheck","LucideChevronDown","LucideX","_$spread","_$insert","_$ref","_$effect","_$readShallow","_$className"],"sources":["../../../../src/components/ui/combobox/combobox.tsx"],"sourcesContent":["import {\n Combobox as ComboboxPrimitive,\n ComboboxContent as ComboboxContentPrimitive,\n ComboboxInput as ComboboxInputPrimitive,\n ComboboxItem as ComboboxItemPrimitive,\n ComboboxList,\n ComboboxTrigger as ComboboxTriggerPrimitive,\n} from '@ui-sdk/solid/combobox'\nimport { Check as LucideCheck, ChevronDown as LucideChevronDown, X as LucideX } from '@lucide/solid'\nimport { dynamic, type ComponentProps, type JSX } from '@solidjs/web'\nimport { For, Show, createContext, createMemo, omit, useContext, type Component } from 'solid-js'\nimport { menuContentPadding, menuItem } from '#lib/overlay'\nimport { useFormFieldControl } from '#lib/form-field'\nimport { cn } from '#lib/utils'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst Check = fastIcon(LucideCheck)\nconst ChevronDown = fastIcon(LucideChevronDown)\nconst X = fastIcon(LucideX)\n\n/**\n * One entry of the list the root builds from `options`: an option, or the\n * section heading of a group, with the Kobalte-era `CollectionNode` fields a\n * caller's `itemComponent` reads (`rawValue`, `key`, `textValue`).\n */\nexport type ComboboxCollectionNode<T> = {\n type: 'item' | 'section'\n key: string\n rawValue: T\n textValue: string\n disabled: boolean\n index: number\n}\n\ntype Accessor<T, R> = keyof T | ((option: T) => R)\n\ntype Selection<Option, Multiple extends boolean> = Multiple extends true ? Option[] : Option | null\n\nexport type ComboboxProps<Option, OptGroup = never, Multiple extends boolean = false> = Omit<\n ComponentProps<'div'>,\n 'onChange' | 'children'\n> & {\n options: ReadonlyArray<Option | OptGroup>\n /** The option's identity: a field name or a function. Defaults to the option itself. */\n optionValue?: Accessor<Option, string | number>\n /** The text the input filters by. */\n optionTextValue?: Accessor<Option, string>\n /** The text the input shows once the option is chosen. Defaults to `optionTextValue`. */\n optionLabel?: Accessor<Option, string>\n optionDisabled?: Accessor<Option, boolean>\n /** The field of a group that holds its options. */\n optionGroupChildren?: keyof OptGroup\n /** Draws one option; render a `ComboboxItem` with the `item` it receives. */\n itemComponent?: Component<{ item: ComboboxCollectionNode<Option> }>\n /** Draws a group's heading, before its options. */\n sectionComponent?: Component<{ section: ComboboxCollectionNode<OptGroup> }>\n /** The input's placeholder. */\n placeholder?: string\n multiple?: Multiple\n value?: Selection<Option, Multiple>\n defaultValue?: Selection<Option, Multiple>\n /** The chosen option, `null` for none, or the list with `multiple`. */\n onChange?: (value: Selection<Option, Multiple>) => void\n /** The input's text, which filters the list. Pass it to control the text. */\n inputValue?: string\n /** The input's text at first, when uncontrolled. */\n defaultInputValue?: string\n /** Runs as the input's text changes. */\n onInputChange?: (value: string) => void\n /**\n * How typing narrows the list: `startsWith` (the default, as before),\n * `endsWith`, `contains`, or a function of an option's text and the input.\n */\n defaultFilter?:\n | 'startsWith'\n | 'endsWith'\n | 'contains'\n | ((textValue: string, inputValue: string) => boolean)\n /**\n * Kept from the Kobalte-era API. ui-sdk opens the list with no match too,\n * so the content's own message (or a `ComboboxContent` child) shows.\n */\n allowsEmptyCollection?: boolean\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n disabled?: boolean\n required?: boolean\n readOnly?: boolean\n name?: string\n /** `invalid` marks the control and the input. */\n validationState?: 'valid' | 'invalid'\n /** The gap between the control and the list, in pixels. */\n gutter?: number\n children?: JSX.Element\n}\n\ntype ComboboxScope = {\n nodes: () => ComboboxCollectionNode<unknown>[]\n itemComponent: () => Component<{ item: ComboboxCollectionNode<unknown> }> | undefined\n sectionComponent: () => Component<{ section: ComboboxCollectionNode<unknown> }> | undefined\n placeholder: () => string | undefined\n gutter: () => number | undefined\n invalid: () => boolean\n disabled: () => boolean\n /** The control the list is anchored to, the whole input row. */\n control: { current?: HTMLElement }\n}\n\n/**\n * Calls a caller's `ref`, which Solid 2 hands over as a function or, once\n * merged with another (a tooltip trigger around a menu trigger), an array.\n */\nfunction callRef<T>(ref: unknown, element: T): void {\n if (typeof ref === 'function') ref(element)\n else if (Array.isArray(ref)) for (const each of ref) callRef(each, element)\n}\n\nconst ComboboxScopeContext = createContext<ComboboxScope | null>(null)\n\nfunction read<T, R>(accessor: Accessor<T, R> | undefined, option: T, fallback: R): R {\n if (accessor === undefined) return fallback\n if (typeof accessor === 'function') return accessor(option)\n if (option !== null && typeof option === 'object') return option[accessor] as R\n return fallback\n}\n\n/**\n * Combobox.\n *\n * A Select whose list is filterable by typing. The difference from Select is\n * not cosmetic: a Combobox has a text input, so the user can narrow forty\n * options to one without reading the list. Above roughly ten options the\n * search is the feature; below it, a Select is quieter and a RadioGroup is\n * better still.\n *\n * ui-sdk's Combobox supplies the filtering, the `aria-activedescendant`\n * wiring, the keyboard selection and the multiple-selection mode, which is the\n * part a hand-rolled version reliably gets wrong. This keeps the Kobalte-era\n * collection API on top of it: `options` drawn through `itemComponent`, with\n * the caller's option object as the value.\n */\nexport function Combobox<Option, OptGroup = never, Multiple extends boolean = false>(\n props: ComboboxProps<Option, OptGroup, Multiple>\n) {\n const rest = omit(\n props,\n 'options',\n 'optionValue',\n 'optionTextValue',\n 'optionLabel',\n 'optionDisabled',\n 'optionGroupChildren',\n 'itemComponent',\n 'sectionComponent',\n 'placeholder',\n 'multiple',\n 'value',\n 'defaultValue',\n 'onChange',\n 'inputValue',\n 'defaultInputValue',\n 'onInputChange',\n 'defaultFilter',\n 'allowsEmptyCollection',\n 'open',\n 'defaultOpen',\n 'onOpenChange',\n 'disabled',\n 'required',\n 'readOnly',\n 'name',\n 'validationState',\n 'gutter',\n 'children'\n )\n const keyOf = (option: unknown) =>\n String(read(props.optionValue as Accessor<unknown, string | number>, option, option as string))\n const textOf = (option: unknown) =>\n read(props.optionTextValue as Accessor<unknown, string>, option, keyOf(option))\n const labelOf = (option: unknown) =>\n read(props.optionLabel as Accessor<unknown, string>, option, textOf(option))\n\n // One node per option, reused while the option object is, so the `<For>`\n // over them keeps its rows when `options` is replaced by an equal list.\n const cache = new WeakMap<object, ComboboxCollectionNode<unknown>>()\n const nodeOf = (rawValue: unknown, type: 'item' | 'section', index: number) => {\n const disabled =\n type === 'item' && !!read(props.optionDisabled as Accessor<unknown, boolean>, rawValue, false)\n const key = type === 'item' ? keyOf(rawValue) : `section-${index}`\n const textValue = type === 'item' ? labelOf(rawValue) : ''\n const cached =\n rawValue !== null && typeof rawValue === 'object' ? cache.get(rawValue) : undefined\n if (\n cached &&\n cached.type === type &&\n cached.key === key &&\n cached.textValue === textValue &&\n cached.disabled === disabled &&\n cached.index === index\n ) {\n return cached\n }\n const node = { type, key, rawValue, textValue, disabled, index }\n if (rawValue !== null && typeof rawValue === 'object') cache.set(rawValue, node)\n return node\n }\n\n const nodes = createMemo(() => {\n const children = props.optionGroupChildren\n const list: ComboboxCollectionNode<unknown>[] = []\n let index = 0\n for (const entry of props.options) {\n const groupItems =\n children && entry !== null && typeof entry === 'object'\n ? (entry as Record<PropertyKey, unknown>)[children as PropertyKey]\n : undefined\n if (Array.isArray(groupItems)) {\n list.push(nodeOf(entry, 'section', index++))\n for (const option of groupItems) list.push(nodeOf(option, 'item', index++))\n } else {\n list.push(nodeOf(entry, 'item', index++))\n }\n }\n return list\n })\n\n // Kobalte matched `optionTextValue`; ui-sdk matches an item's label, which\n // here is the chosen text, so a function filter reads the option again.\n const filter = (item: { value: unknown }, query: string) => {\n const text = textOf(item.value)\n const mode = props.defaultFilter ?? 'startsWith'\n if (typeof mode === 'function') return mode(text, query)\n const haystack = text.toLocaleLowerCase()\n const needle = query.toLocaleLowerCase()\n if (mode === 'contains') return haystack.includes(needle)\n if (mode === 'endsWith') return haystack.endsWith(needle)\n return haystack.startsWith(needle)\n }\n\n const scope: ComboboxScope = {\n nodes,\n itemComponent: () =>\n props.itemComponent as Component<{ item: ComboboxCollectionNode<unknown> }> | undefined,\n sectionComponent: () =>\n props.sectionComponent as Component<{ section: ComboboxCollectionNode<unknown> }> | undefined,\n placeholder: () => props.placeholder,\n gutter: () => props.gutter,\n invalid: () => props.validationState === 'invalid',\n disabled: () => !!props.disabled,\n control: {},\n }\n\n // Kobalte's root was an element; the wrapper keeps that box and its props.\n return (\n <div {...rest}>\n <ComboboxScopeContext value={scope}>\n <ComboboxPrimitive<unknown, boolean>\n multiple={props.multiple}\n value={props.value as unknown}\n defaultValue={props.defaultValue as unknown}\n onValueChange={(value: unknown) =>\n (props.onChange as ((value: unknown) => void) | undefined)?.(value ?? null)\n }\n query={props.inputValue}\n defaultQuery={props.defaultInputValue}\n onQueryChange={(query: string) => props.onInputChange?.(query)}\n itemToValue={keyOf}\n itemToLabel={labelOf}\n isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}\n filter={filter}\n open={props.open}\n defaultOpen={props.defaultOpen}\n onOpenChange={(open: boolean) => props.onOpenChange?.(open)}\n disabled={props.disabled}\n required={props.required}\n readOnly={props.readOnly}\n name={props.name}\n modal={false}\n >\n {props.children}\n </ComboboxPrimitive>\n </ComboboxScopeContext>\n </div>\n )\n}\n\n/** The input row: the input, its trigger and any clear button, as one bordered control. */\nexport function ComboboxControl(props: ComponentProps<'div'>) {\n const scope = useContext(ComboboxScopeContext)\n const rest = omit(props, 'class', 'ref')\n\n return (\n <div\n ref={(element: HTMLDivElement) => {\n if (scope) scope.control.current = element\n callRef(props.ref, element)\n }}\n data-invalid={scope?.invalid() ? '' : undefined}\n data-disabled={scope?.disabled() ? '' : undefined}\n class={cn(\n 'border-input bg-transparent flex h-control-md w-full items-center gap-1.5 rounded-md border px-control-sm',\n 'transition-[color,box-shadow,border-color] ease-out',\n 'focus-within:border-ring focus-within:ring-3 focus-within:ring-primary-subtle',\n 'data-[invalid]:border-destructive data-[invalid]:ring-3 data-[invalid]:ring-destructive-subtle',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n props.class\n )}\n {...rest}\n />\n )\n}\n\nexport type ComboboxInputProps = Omit<\n ComponentProps<'input'>,\n 'value' | 'defaultValue' | 'children'\n>\n\nexport function ComboboxInput(props: ComboboxInputProps) {\n const scope = useContext(ComboboxScopeContext)\n const rest = omit(\n props,\n 'class',\n 'id',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-errormessage',\n 'placeholder'\n )\n const field = useFormFieldControl('control', props)\n\n return (\n <ComboboxInputPrimitive\n {...(rest as Record<string, unknown>)}\n id={field?.id ?? props.id}\n placeholder={props.placeholder ?? scope?.placeholder()}\n aria-label={props['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? props['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? props['aria-describedby']}\n aria-invalid={\n field?.['aria-invalid'] ?? props['aria-invalid'] ?? (scope?.invalid() ? 'true' : undefined)\n }\n aria-errormessage={field?.['aria-errormessage'] ?? props['aria-errormessage']}\n class={cn(\n 'h-full flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n props.class\n )}\n />\n )\n}\n\nexport function ComboboxTrigger(props: ComponentProps<'button'>) {\n const rest = omit(props, 'class', 'children')\n\n return (\n <ComboboxTriggerPrimitive\n {...(rest as Record<string, unknown>)}\n render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <button {...part} data-expanded={state.open ? '' : undefined} />\n )}\n class={cn(\n 'text-muted-foreground flex shrink-0 items-center justify-center rounded-sm outline-none',\n 'transition-colors ease-out hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'disabled:pointer-events-none disabled:opacity-50',\n props.class\n )}\n >\n {props.children}\n <span aria-hidden=\"true\">\n <ChevronDown class=\"size-4\" />\n </span>\n </ComboboxTriggerPrimitive>\n )\n}\n\nexport type ComboboxContentProps = Omit<ComponentProps<'div'>, 'children'> & {\n /** Shown under the list, such as an empty-state message. */\n children?: JSX.Element\n}\n\nexport function ComboboxContent(props: ComboboxContentProps) {\n const scope = useContext(ComboboxScopeContext)\n const rest = omit(props, 'class', 'children')\n\n return (\n <ComboboxContentPrimitive\n {...(rest as Record<string, unknown>)}\n // Anchored to the whole control, as Kobalte did, so the list lines up\n // with the bordered row rather than the bare input inside it.\n anchor={{\n getBoundingClientRect: () =>\n (scope?.control.current ?? document.body).getBoundingClientRect(),\n }}\n // Kobalte's listbox popper gap (8 by default) plus half its arrow's box:\n // the Solid 1 content carried a popper arrow, which drew nothing visible\n // but pushed the list 15px further from the control. Kept for parity.\n sideOffset={(scope?.gutter() ?? 8) + 15}\n render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <div {...part} data-expanded={state.open ? '' : undefined} />\n )}\n class={cn(\n 'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg',\n 'z-(--z-menu) max-h-72 min-w-(--anchor-width) origin-(--transform-origin) overflow-hidden',\n 'data-expanded:animate-in data-expanded:fade-in-0 data-expanded:zoom-in-95',\n 'data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n 'data-expanded:duration-150 data-closed:duration-100',\n props.class\n )}\n >\n <ComboboxList class={cn('max-h-72 overflow-y-auto', menuContentPadding)}>\n <For each={scope?.nodes() ?? []}>\n {(node) => {\n if (node.type === 'section') {\n const Section = dynamic(() => scope?.sectionComponent())\n return <Section section={node} />\n }\n const Item = dynamic(() => scope?.itemComponent())\n return <Item item={node} />\n }}\n </For>\n </ComboboxList>\n {props.children}\n </ComboboxContentPrimitive>\n )\n}\n\nexport type ComboboxItemProps = Omit<ComponentProps<'div'>, 'onSelect' | 'onChange'> & {\n /** The node the root's `itemComponent` received. */\n item: ComboboxCollectionNode<any>\n}\n\nexport function ComboboxItem(props: ComboboxItemProps) {\n const rest = omit(props, 'class', 'children', 'item')\n\n return (\n <ComboboxItemPrimitive\n {...(rest as Record<string, unknown>)}\n value={props.item.rawValue}\n label={props.item.textValue}\n disabled={props.item.disabled}\n class={cn(menuItem, 'pe-8', props.class)}\n >\n {(state: { selected: boolean }) => (\n <>\n <div>{props.children}</div>\n {/* The indicator reads in the accent, like every other selected\n state in the system. Drawn from the row's `selected` state. */}\n <Show when={state.selected}>\n <span\n data-slot=\"combobox-indicator\"\n aria-hidden=\"true\"\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Check class=\"size-4\" />\n </span>\n </Show>\n </>\n )}\n </ComboboxItemPrimitive>\n )\n}\n\n/** A group's wrapper inside the list, for a `sectionComponent`. */\nexport function ComboboxSection(props: ComponentProps<'div'>) {\n const rest = omit(props, 'class')\n return <div role=\"presentation\" class={cn('flex flex-col', props.class)} {...rest} />\n}\n\n/** The clear affordance for a single-select Combobox with a value. */\nexport function ComboboxClear(props: { class?: string; onClear: () => void }) {\n return (\n <Show when={props.onClear}>\n <button\n type=\"button\"\n aria-label=\"Clear selection\"\n onClick={() => props.onClear()}\n class={cn(\n 'text-muted-foreground flex size-4 shrink-0 items-center justify-center rounded-sm',\n 'transition-colors ease-out outline-none hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n props.class\n )}\n >\n <X class=\"size-3.5\" />\n </button>\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBA,IAAM,QAAQ,SAASoC,OAAW;AAClC,IAAM,cAAc,SAASC,aAAiB;AAC9C,IAAM,IAAI,SAASC,GAAO;;;;;AA+F1B,SAAS,QAAW,KAAc,SAAkB;CAClD,IAAI,OAAO,QAAQ,YAAY,IAAI,OAAO;MACrC,IAAI,MAAM,QAAQ,GAAG,GAAG,KAAK,MAAM,QAAQ,KAAK,QAAQ,MAAM,OAAO;AAC5E;AAEA,IAAM,uBAAuB,cAAoC,IAAI;AAErE,SAAS,KAAW,UAAsC,QAAW,UAAgB;CACnF,IAAI,aAAa,KAAA,GAAW,OAAO;CACnC,IAAI,OAAO,aAAa,YAAY,OAAO,SAAS,MAAM;CAC1D,IAAI,WAAW,QAAQ,OAAO,WAAW,UAAU,OAAO,OAAO;CACjE,OAAO;AACT;;;;;;;;;;;;;;;;AAiBA,SAAgB,SACd,OACA;CACA,MAAM,OAAO,KACX,OACA,WACA,eACA,mBACA,eACA,kBACA,uBACA,iBACA,oBACA,eACA,YACA,SACA,gBACA,YACA,cACA,qBACA,iBACA,iBACA,yBACA,QACA,eACA,gBACA,YACA,YACA,YACA,QACA,mBACA,UACA,UACF;CACA,MAAM,SAAS,WACb,OAAO,KAAK,MAAM,aAAmD,QAA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M;GAAQ,CAAM;GAA1B,OAAA;EAA0B,EAAA,CAAA,GAG1BX,WAAAA;;IAAY,OAAA,CAAA,CAAA,MAAM;GAQZ,CAAA,CAAC,CAAD,WAPJ;IAMM,IAAA,QAAA,QAAA;IANNW,OAAA,OAKEV,gBAAAA,OAAAA,EAAOZ,OAAM,SAAU,CAAA,CACnB;IANN,OAAA;GAMM,EAAA,CAAA,IAPR,KAAA;EAQM,CAAA,CAXP;CAckB,CAAA,CAAA;AAE3B;;AAGA,SAAgB,gBAAgB,OAA8B;CAC5D,MAAM,OAAO,KAAK,OAAO,OAAO;CACzB,IAAA,QAAA,OAA6E;CAAXqB,OAAA,OAAA,CAAA;EAA7DR,MAAAA;EAAoB,IAAA,UAAA;GAAO,OAAA,GAAG,iBAAiB,MAAM,KAAK;EAAC;CAAU,GAAJ,IAAA,GAAA,KAAA;CAA7E,OAAOC;AACT;;AAGA,SAAgB,cAAc,OAAgD;CAC5E,OACEC,WAAAA;;GAAY,OAAA,CAAA,CAAA,MAAM;EAcZ,CAAA,CAAC,CAAD,WAbJ;GAYQ,IAAA,QAAA,QAAA;GATN,MAAA,iBAAe,MAAM,QAAQ;GAH/BO,OAAA,OAWEN,gBAAAA,GAAAA,EAAGC,OAAM,WAAY,CAAA,CACf;GARNO,aAAAC,YAAO,GACL,qFACA,iEACA,oFACA,MAAM,KACR,CAAC,IALD,KAAA,QAAA;IAKCC,UAAA,OAAA,KAAA,GAAA;;GATH,OAAA;EAYQ,EAAA,CAAA,IAbV,KAAA;CAcM,CAAA;AAEV"}
|
|
1
|
+
{"version":3,"file":"combobox.js","names":["<ComboboxScopeContext value={scope}>\n <ComboboxPrimitive<unknown, boolean>\n multiple={props.multiple}\n value={props.value as unknown}\n defaultValue={props.defaultValue as unknown}\n onValueChange={(value: unknown) =>\n (props.onChange as ((value: unknown) => void) | undefined)?.(value ?? null)\n }\n query={props.inputValue}\n defaultQuery={props.defaultInputValue}\n onQueryChange={(query: string) => props.onInputChange?.(query)}\n itemToValue={keyOf}\n itemToLabel={labelOf}\n isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}\n filter={filter}\n open={props.open}\n defaultOpen={props.defaultOpen}\n onOpenChange={(open: boolean) => props.onOpenChange?.(open)}\n disabled={props.disabled}\n required={props.required}\n readOnly={props.readOnly}\n name={props.name}\n modal={false}\n >\n {props.children}\n </ComboboxPrimitive>\n </ComboboxScopeContext>","value={scope}","<ComboboxPrimitive<unknown, boolean>\n multiple={props.multiple}\n value={props.value as unknown}\n defaultValue={props.defaultValue as unknown}\n onValueChange={(value: unknown) =>\n (props.onChange as ((value: unknown) => void) | undefined)?.(value ?? null)\n }\n query={props.inputValue}\n defaultQuery={props.defaultInputValue}\n onQueryChange={(query: string) => props.onInputChange?.(query)}\n itemToValue={keyOf}\n itemToLabel={labelOf}\n isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}\n filter={filter}\n open={props.open}\n defaultOpen={props.defaultOpen}\n onOpenChange={(open: boolean) => props.onOpenChange?.(open)}\n disabled={props.disabled}\n required={props.required}\n readOnly={props.readOnly}\n name={props.name}\n modal={false}\n >\n {props.children}\n </ComboboxPrimitive>","onValueChange={(value: unknown) =>\n (props.onChange as ((value: unknown) => void) | undefined)?.(value ?? null)\n }","onQueryChange={(query: string) => props.onInputChange?.(query)}","itemToValue={keyOf}","itemToLabel={labelOf}","isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}","onOpenChange={(open: boolean) => props.onOpenChange?.(open)}","modal={false}","<div {...rest}>\n <ComboboxScopeContext value={scope}>\n <ComboboxPrimitive<unknown, boolean>\n multiple={props.multiple}\n value={props.value as unknown}\n defaultValue={props.defaultValue as unknown}\n onValueChange={(value: unknown) =>\n (props.onChange as ((value: unknown) => void) | undefined)?.(value ?? null)\n }\n query={props.inputValue}\n defaultQuery={props.defaultInputValue}\n onQueryChange={(query: string) => props.onInputChange?.(query)}\n itemToValue={keyOf}\n itemToLabel={labelOf}\n isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}\n filter={filter}\n open={props.open}\n defaultOpen={props.defaultOpen}\n onOpenChange={(open: boolean) => props.onOpenChange?.(open)}\n disabled={props.disabled}\n required={props.required}\n readOnly={props.readOnly}\n name={props.name}\n modal={false}\n >\n {props.children}\n </ComboboxPrimitive>\n </ComboboxScopeContext>\n </div>","ref={(element: HTMLDivElement) => {\n if (scope) scope.control.current = element\n callRef(props.ref, element)\n }}","<div\n ref={(element: HTMLDivElement) => {\n if (scope) scope.control.current = element\n callRef(props.ref, element)\n }}\n data-invalid={scope?.invalid() ? '' : undefined}\n data-disabled={scope?.disabled() ? '' : undefined}\n class={cn(\n 'border-input bg-transparent flex h-control-md w-full items-center gap-1.5 rounded-md border px-control-sm',\n 'transition-[color,box-shadow,border-color] ease-out',\n 'focus-within:border-ring focus-within:focus-outline',\n 'data-[invalid]:border-destructive data-[invalid]:ring-3 data-[invalid]:ring-destructive-subtle',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n props.class\n )}\n {...rest}\n />","<ComboboxInputPrimitive\n {...(rest as Record<string, unknown>)}\n id={field?.id ?? props.id}\n placeholder={props.placeholder ?? scope?.placeholder()}\n aria-label={props['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? props['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? props['aria-describedby']}\n aria-invalid={\n field?.['aria-invalid'] ?? props['aria-invalid'] ?? (scope?.invalid() ? 'true' : undefined)\n }\n aria-errormessage={field?.['aria-errormessage'] ?? props['aria-errormessage']}\n class={cn(\n 'h-full flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n props.class\n )}\n />","<ComboboxTriggerPrimitive\n {...(rest as Record<string, unknown>)}\n render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <button {...part} data-expanded={state.open ? '' : undefined} />\n )}\n class={cn(\n 'text-muted-foreground flex shrink-0 items-center justify-center rounded-sm outline-none',\n 'transition-colors ease-out hover:text-foreground',\n 'focus-visible:border-ring focus-visible:focus-outline',\n 'disabled:pointer-events-none disabled:opacity-50',\n props.class\n )}\n >\n {props.children}\n <span aria-hidden=\"true\">\n <ChevronDown class=\"size-4\" />\n </span>\n </ComboboxTriggerPrimitive>","render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <button {...part} data-expanded={state.open ? '' : undefined} />\n )}","props.children","<ChevronDown class=\"size-4\" />","class=\"size-4\"","<ComboboxContentPrimitive\n {...(rest as Record<string, unknown>)}\n // Anchored to the whole control, as Kobalte did, so the list lines up\n // with the bordered row rather than the bare input inside it.\n anchor={{\n getBoundingClientRect: () =>\n (scope?.control.current ?? document.body).getBoundingClientRect(),\n }}\n // Kobalte's listbox popper gap (8 by default) plus half its arrow's box:\n // the Solid 1 content carried a popper arrow, which drew nothing visible\n // but pushed the list 15px further from the control. Kept for parity.\n sideOffset={(scope?.gutter() ?? 8) + 15}\n render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <div {...part} data-expanded={state.open ? '' : undefined} />\n )}\n class={cn(\n 'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg',\n 'z-(--z-menu) max-h-72 min-w-(--anchor-width) origin-(--transform-origin) overflow-hidden',\n 'data-expanded:animate-in data-expanded:fade-in-0 data-expanded:zoom-in-95',\n 'data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n 'data-expanded:duration-150 data-closed:duration-100',\n props.class\n )}\n >\n <ComboboxList class={cn('max-h-72 overflow-y-auto', menuContentPadding)}>\n <For each={scope?.nodes() ?? []}>\n {(node) => {\n if (node.type === 'section') {\n const Section = dynamic(() => scope?.sectionComponent())\n return <Section section={node} />\n }\n const Item = dynamic(() => scope?.itemComponent())\n return <Item item={node} />\n }}\n </For>\n </ComboboxList>\n {props.children}\n </ComboboxContentPrimitive>","anchor={{\n getBoundingClientRect: () =>\n (scope?.control.current ?? document.body).getBoundingClientRect(),\n }}","render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <div {...part} data-expanded={state.open ? '' : undefined} />\n )}","<ComboboxList class={cn('max-h-72 overflow-y-auto', menuContentPadding)}>\n <For each={scope?.nodes() ?? []}>\n {(node) => {\n if (node.type === 'section') {\n const Section = dynamic(() => scope?.sectionComponent())\n return <Section section={node} />\n }\n const Item = dynamic(() => scope?.itemComponent())\n return <Item item={node} />\n }}\n </For>\n </ComboboxList>","<For each={scope?.nodes() ?? []}>\n {(node) => {\n if (node.type === 'section') {\n const Section = dynamic(() => scope?.sectionComponent())\n return <Section section={node} />\n }\n const Item = dynamic(() => scope?.itemComponent())\n return <Item item={node} />\n }}\n </For>","<Section section={node} />","section={node}","<Item item={node} />","item={node}","<ComboboxItemPrimitive\n {...(rest as Record<string, unknown>)}\n value={props.item.rawValue}\n label={props.item.textValue}\n disabled={props.item.disabled}\n class={cn(menuItem, 'pe-8', props.class)}\n >\n {(state: { selected: boolean }) => (\n <>\n <div>{props.children}</div>\n {/* The indicator reads in the accent, like every other selected\n state in the system. Drawn from the row's `selected` state. */}\n <Show when={state.selected}>\n <span\n data-slot=\"combobox-indicator\"\n aria-hidden=\"true\"\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Check class=\"size-4\" />\n </span>\n </Show>\n </>\n )}\n </ComboboxItemPrimitive>","<Show when={state.selected}>\n <span\n data-slot=\"combobox-indicator\"\n aria-hidden=\"true\"\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Check class=\"size-4\" />\n </span>\n </Show>","<Check class=\"size-4\" />","role=\"presentation\"","<div role=\"presentation\" class={cn('flex flex-col', props.class)} {...rest} />","<Show when={props.onClear}>\n <button\n type=\"button\"\n aria-label=\"Clear selection\"\n onClick={() => props.onClear()}\n class={cn(\n 'text-muted-foreground flex size-4 shrink-0 items-center justify-center rounded-sm',\n 'transition-colors ease-out outline-none hover:text-foreground',\n 'focus-visible:border-ring focus-visible:focus-outline',\n props.class\n )}\n >\n <X class=\"size-3.5\" />\n </button>\n </Show>","<X class=\"size-3.5\" />","class=\"size-3.5\"","LucideCheck","LucideChevronDown","LucideX","_$spread","_$insert","_$ref","_$effect","_$readShallow","_$className"],"sources":["../../../../src/components/ui/combobox/combobox.tsx"],"sourcesContent":["import {\n Combobox as ComboboxPrimitive,\n ComboboxContent as ComboboxContentPrimitive,\n ComboboxInput as ComboboxInputPrimitive,\n ComboboxItem as ComboboxItemPrimitive,\n ComboboxList,\n ComboboxTrigger as ComboboxTriggerPrimitive,\n} from '@ui-sdk/solid/combobox'\nimport { Check as LucideCheck, ChevronDown as LucideChevronDown, X as LucideX } from '@lucide/solid'\nimport { dynamic, type ComponentProps, type JSX } from '@solidjs/web'\nimport { For, Show, createContext, createMemo, omit, useContext, type Component } from 'solid-js'\nimport { menuContentPadding, menuItem } from '#lib/overlay'\nimport { useFormFieldControl } from '#lib/form-field'\nimport { cn } from '#lib/utils'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst Check = fastIcon(LucideCheck)\nconst ChevronDown = fastIcon(LucideChevronDown)\nconst X = fastIcon(LucideX)\n\n/**\n * One entry of the list the root builds from `options`: an option, or the\n * section heading of a group, with the Kobalte-era `CollectionNode` fields a\n * caller's `itemComponent` reads (`rawValue`, `key`, `textValue`).\n */\nexport type ComboboxCollectionNode<T> = {\n type: 'item' | 'section'\n key: string\n rawValue: T\n textValue: string\n disabled: boolean\n index: number\n}\n\ntype Accessor<T, R> = keyof T | ((option: T) => R)\n\ntype Selection<Option, Multiple extends boolean> = Multiple extends true ? Option[] : Option | null\n\nexport type ComboboxProps<Option, OptGroup = never, Multiple extends boolean = false> = Omit<\n ComponentProps<'div'>,\n 'onChange' | 'children'\n> & {\n options: ReadonlyArray<Option | OptGroup>\n /** The option's identity: a field name or a function. Defaults to the option itself. */\n optionValue?: Accessor<Option, string | number>\n /** The text the input filters by. */\n optionTextValue?: Accessor<Option, string>\n /** The text the input shows once the option is chosen. Defaults to `optionTextValue`. */\n optionLabel?: Accessor<Option, string>\n optionDisabled?: Accessor<Option, boolean>\n /** The field of a group that holds its options. */\n optionGroupChildren?: keyof OptGroup\n /** Draws one option; render a `ComboboxItem` with the `item` it receives. */\n itemComponent?: Component<{ item: ComboboxCollectionNode<Option> }>\n /** Draws a group's heading, before its options. */\n sectionComponent?: Component<{ section: ComboboxCollectionNode<OptGroup> }>\n /** The input's placeholder. */\n placeholder?: string\n multiple?: Multiple\n value?: Selection<Option, Multiple>\n defaultValue?: Selection<Option, Multiple>\n /** The chosen option, `null` for none, or the list with `multiple`. */\n onChange?: (value: Selection<Option, Multiple>) => void\n /** The input's text, which filters the list. Pass it to control the text. */\n inputValue?: string\n /** The input's text at first, when uncontrolled. */\n defaultInputValue?: string\n /** Runs as the input's text changes. */\n onInputChange?: (value: string) => void\n /**\n * How typing narrows the list: `startsWith` (the default, as before),\n * `endsWith`, `contains`, or a function of an option's text and the input.\n */\n defaultFilter?:\n | 'startsWith'\n | 'endsWith'\n | 'contains'\n | ((textValue: string, inputValue: string) => boolean)\n /**\n * Kept from the Kobalte-era API. ui-sdk opens the list with no match too,\n * so the content's own message (or a `ComboboxContent` child) shows.\n */\n allowsEmptyCollection?: boolean\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n disabled?: boolean\n required?: boolean\n readOnly?: boolean\n name?: string\n /** `invalid` marks the control and the input. */\n validationState?: 'valid' | 'invalid'\n /** The gap between the control and the list, in pixels. */\n gutter?: number\n children?: JSX.Element\n}\n\ntype ComboboxScope = {\n nodes: () => ComboboxCollectionNode<unknown>[]\n itemComponent: () => Component<{ item: ComboboxCollectionNode<unknown> }> | undefined\n sectionComponent: () => Component<{ section: ComboboxCollectionNode<unknown> }> | undefined\n placeholder: () => string | undefined\n gutter: () => number | undefined\n invalid: () => boolean\n disabled: () => boolean\n /** The control the list is anchored to, the whole input row. */\n control: { current?: HTMLElement }\n}\n\n/**\n * Calls a caller's `ref`, which Solid 2 hands over as a function or, once\n * merged with another (a tooltip trigger around a menu trigger), an array.\n */\nfunction callRef<T>(ref: unknown, element: T): void {\n if (typeof ref === 'function') ref(element)\n else if (Array.isArray(ref)) for (const each of ref) callRef(each, element)\n}\n\nconst ComboboxScopeContext = createContext<ComboboxScope | null>(null)\n\nfunction read<T, R>(accessor: Accessor<T, R> | undefined, option: T, fallback: R): R {\n if (accessor === undefined) return fallback\n if (typeof accessor === 'function') return accessor(option)\n if (option !== null && typeof option === 'object') return option[accessor] as R\n return fallback\n}\n\n/**\n * Combobox.\n *\n * A Select whose list is filterable by typing. The difference from Select is\n * not cosmetic: a Combobox has a text input, so the user can narrow forty\n * options to one without reading the list. Above roughly ten options the\n * search is the feature; below it, a Select is quieter and a RadioGroup is\n * better still.\n *\n * ui-sdk's Combobox supplies the filtering, the `aria-activedescendant`\n * wiring, the keyboard selection and the multiple-selection mode, which is the\n * part a hand-rolled version reliably gets wrong. This keeps the Kobalte-era\n * collection API on top of it: `options` drawn through `itemComponent`, with\n * the caller's option object as the value.\n */\nexport function Combobox<Option, OptGroup = never, Multiple extends boolean = false>(\n props: ComboboxProps<Option, OptGroup, Multiple>\n) {\n const rest = omit(\n props,\n 'options',\n 'optionValue',\n 'optionTextValue',\n 'optionLabel',\n 'optionDisabled',\n 'optionGroupChildren',\n 'itemComponent',\n 'sectionComponent',\n 'placeholder',\n 'multiple',\n 'value',\n 'defaultValue',\n 'onChange',\n 'inputValue',\n 'defaultInputValue',\n 'onInputChange',\n 'defaultFilter',\n 'allowsEmptyCollection',\n 'open',\n 'defaultOpen',\n 'onOpenChange',\n 'disabled',\n 'required',\n 'readOnly',\n 'name',\n 'validationState',\n 'gutter',\n 'children'\n )\n const keyOf = (option: unknown) =>\n String(read(props.optionValue as Accessor<unknown, string | number>, option, option as string))\n const textOf = (option: unknown) =>\n read(props.optionTextValue as Accessor<unknown, string>, option, keyOf(option))\n const labelOf = (option: unknown) =>\n read(props.optionLabel as Accessor<unknown, string>, option, textOf(option))\n\n // One node per option, reused while the option object is, so the `<For>`\n // over them keeps its rows when `options` is replaced by an equal list.\n const cache = new WeakMap<object, ComboboxCollectionNode<unknown>>()\n const nodeOf = (rawValue: unknown, type: 'item' | 'section', index: number) => {\n const disabled =\n type === 'item' && !!read(props.optionDisabled as Accessor<unknown, boolean>, rawValue, false)\n const key = type === 'item' ? keyOf(rawValue) : `section-${index}`\n const textValue = type === 'item' ? labelOf(rawValue) : ''\n const cached =\n rawValue !== null && typeof rawValue === 'object' ? cache.get(rawValue) : undefined\n if (\n cached &&\n cached.type === type &&\n cached.key === key &&\n cached.textValue === textValue &&\n cached.disabled === disabled &&\n cached.index === index\n ) {\n return cached\n }\n const node = { type, key, rawValue, textValue, disabled, index }\n if (rawValue !== null && typeof rawValue === 'object') cache.set(rawValue, node)\n return node\n }\n\n const nodes = createMemo(() => {\n const children = props.optionGroupChildren\n const list: ComboboxCollectionNode<unknown>[] = []\n let index = 0\n for (const entry of props.options) {\n const groupItems =\n children && entry !== null && typeof entry === 'object'\n ? (entry as Record<PropertyKey, unknown>)[children as PropertyKey]\n : undefined\n if (Array.isArray(groupItems)) {\n list.push(nodeOf(entry, 'section', index++))\n for (const option of groupItems) list.push(nodeOf(option, 'item', index++))\n } else {\n list.push(nodeOf(entry, 'item', index++))\n }\n }\n return list\n })\n\n // Kobalte matched `optionTextValue`; ui-sdk matches an item's label, which\n // here is the chosen text, so a function filter reads the option again.\n const filter = (item: { value: unknown }, query: string) => {\n const text = textOf(item.value)\n const mode = props.defaultFilter ?? 'startsWith'\n if (typeof mode === 'function') return mode(text, query)\n const haystack = text.toLocaleLowerCase()\n const needle = query.toLocaleLowerCase()\n if (mode === 'contains') return haystack.includes(needle)\n if (mode === 'endsWith') return haystack.endsWith(needle)\n return haystack.startsWith(needle)\n }\n\n const scope: ComboboxScope = {\n nodes,\n itemComponent: () =>\n props.itemComponent as Component<{ item: ComboboxCollectionNode<unknown> }> | undefined,\n sectionComponent: () =>\n props.sectionComponent as Component<{ section: ComboboxCollectionNode<unknown> }> | undefined,\n placeholder: () => props.placeholder,\n gutter: () => props.gutter,\n invalid: () => props.validationState === 'invalid',\n disabled: () => !!props.disabled,\n control: {},\n }\n\n // Kobalte's root was an element; the wrapper keeps that box and its props.\n return (\n <div {...rest}>\n <ComboboxScopeContext value={scope}>\n <ComboboxPrimitive<unknown, boolean>\n multiple={props.multiple}\n value={props.value as unknown}\n defaultValue={props.defaultValue as unknown}\n onValueChange={(value: unknown) =>\n (props.onChange as ((value: unknown) => void) | undefined)?.(value ?? null)\n }\n query={props.inputValue}\n defaultQuery={props.defaultInputValue}\n onQueryChange={(query: string) => props.onInputChange?.(query)}\n itemToValue={keyOf}\n itemToLabel={labelOf}\n isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}\n filter={filter}\n open={props.open}\n defaultOpen={props.defaultOpen}\n onOpenChange={(open: boolean) => props.onOpenChange?.(open)}\n disabled={props.disabled}\n required={props.required}\n readOnly={props.readOnly}\n name={props.name}\n modal={false}\n >\n {props.children}\n </ComboboxPrimitive>\n </ComboboxScopeContext>\n </div>\n )\n}\n\n/** The input row: the input, its trigger and any clear button, as one bordered control. */\nexport function ComboboxControl(props: ComponentProps<'div'>) {\n const scope = useContext(ComboboxScopeContext)\n const rest = omit(props, 'class', 'ref')\n\n return (\n <div\n ref={(element: HTMLDivElement) => {\n if (scope) scope.control.current = element\n callRef(props.ref, element)\n }}\n data-invalid={scope?.invalid() ? '' : undefined}\n data-disabled={scope?.disabled() ? '' : undefined}\n class={cn(\n 'border-input bg-transparent flex h-control-md w-full items-center gap-1.5 rounded-md border px-control-sm',\n 'transition-[color,box-shadow,border-color] ease-out',\n 'focus-within:border-ring focus-within:focus-outline',\n 'data-[invalid]:border-destructive data-[invalid]:ring-3 data-[invalid]:ring-destructive-subtle',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n props.class\n )}\n {...rest}\n />\n )\n}\n\nexport type ComboboxInputProps = Omit<\n ComponentProps<'input'>,\n 'value' | 'defaultValue' | 'children'\n>\n\nexport function ComboboxInput(props: ComboboxInputProps) {\n const scope = useContext(ComboboxScopeContext)\n const rest = omit(\n props,\n 'class',\n 'id',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-errormessage',\n 'placeholder'\n )\n const field = useFormFieldControl('control', props)\n\n return (\n <ComboboxInputPrimitive\n {...(rest as Record<string, unknown>)}\n id={field?.id ?? props.id}\n placeholder={props.placeholder ?? scope?.placeholder()}\n aria-label={props['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? props['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? props['aria-describedby']}\n aria-invalid={\n field?.['aria-invalid'] ?? props['aria-invalid'] ?? (scope?.invalid() ? 'true' : undefined)\n }\n aria-errormessage={field?.['aria-errormessage'] ?? props['aria-errormessage']}\n class={cn(\n 'h-full flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n props.class\n )}\n />\n )\n}\n\nexport function ComboboxTrigger(props: ComponentProps<'button'>) {\n const rest = omit(props, 'class', 'children')\n\n return (\n <ComboboxTriggerPrimitive\n {...(rest as Record<string, unknown>)}\n render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <button {...part} data-expanded={state.open ? '' : undefined} />\n )}\n class={cn(\n 'text-muted-foreground flex shrink-0 items-center justify-center rounded-sm outline-none',\n 'transition-colors ease-out hover:text-foreground',\n 'focus-visible:border-ring focus-visible:focus-outline',\n 'disabled:pointer-events-none disabled:opacity-50',\n props.class\n )}\n >\n {props.children}\n <span aria-hidden=\"true\">\n <ChevronDown class=\"size-4\" />\n </span>\n </ComboboxTriggerPrimitive>\n )\n}\n\nexport type ComboboxContentProps = Omit<ComponentProps<'div'>, 'children'> & {\n /** Shown under the list, such as an empty-state message. */\n children?: JSX.Element\n}\n\nexport function ComboboxContent(props: ComboboxContentProps) {\n const scope = useContext(ComboboxScopeContext)\n const rest = omit(props, 'class', 'children')\n\n return (\n <ComboboxContentPrimitive\n {...(rest as Record<string, unknown>)}\n // Anchored to the whole control, as Kobalte did, so the list lines up\n // with the bordered row rather than the bare input inside it.\n anchor={{\n getBoundingClientRect: () =>\n (scope?.control.current ?? document.body).getBoundingClientRect(),\n }}\n // Kobalte's listbox popper gap (8 by default) plus half its arrow's box:\n // the Solid 1 content carried a popper arrow, which drew nothing visible\n // but pushed the list 15px further from the control. Kept for parity.\n sideOffset={(scope?.gutter() ?? 8) + 15}\n render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <div {...part} data-expanded={state.open ? '' : undefined} />\n )}\n class={cn(\n 'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg',\n 'z-(--z-menu) max-h-72 min-w-(--anchor-width) origin-(--transform-origin) overflow-hidden',\n 'data-expanded:animate-in data-expanded:fade-in-0 data-expanded:zoom-in-95',\n 'data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n 'data-expanded:duration-150 data-closed:duration-100',\n props.class\n )}\n >\n <ComboboxList class={cn('max-h-72 overflow-y-auto', menuContentPadding)}>\n <For each={scope?.nodes() ?? []}>\n {(node) => {\n if (node.type === 'section') {\n const Section = dynamic(() => scope?.sectionComponent())\n return <Section section={node} />\n }\n const Item = dynamic(() => scope?.itemComponent())\n return <Item item={node} />\n }}\n </For>\n </ComboboxList>\n {props.children}\n </ComboboxContentPrimitive>\n )\n}\n\nexport type ComboboxItemProps = Omit<ComponentProps<'div'>, 'onSelect' | 'onChange'> & {\n /** The node the root's `itemComponent` received. */\n item: ComboboxCollectionNode<any>\n}\n\nexport function ComboboxItem(props: ComboboxItemProps) {\n const rest = omit(props, 'class', 'children', 'item')\n\n return (\n <ComboboxItemPrimitive\n {...(rest as Record<string, unknown>)}\n value={props.item.rawValue}\n label={props.item.textValue}\n disabled={props.item.disabled}\n class={cn(menuItem, 'pe-8', props.class)}\n >\n {(state: { selected: boolean }) => (\n <>\n <div>{props.children}</div>\n {/* The indicator reads in the accent, like every other selected\n state in the system. Drawn from the row's `selected` state. */}\n <Show when={state.selected}>\n <span\n data-slot=\"combobox-indicator\"\n aria-hidden=\"true\"\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Check class=\"size-4\" />\n </span>\n </Show>\n </>\n )}\n </ComboboxItemPrimitive>\n )\n}\n\n/** A group's wrapper inside the list, for a `sectionComponent`. */\nexport function ComboboxSection(props: ComponentProps<'div'>) {\n const rest = omit(props, 'class')\n return <div role=\"presentation\" class={cn('flex flex-col', props.class)} {...rest} />\n}\n\n/** The clear affordance for a single-select Combobox with a value. */\nexport function ComboboxClear(props: { class?: string; onClear: () => void }) {\n return (\n <Show when={props.onClear}>\n <button\n type=\"button\"\n aria-label=\"Clear selection\"\n onClick={() => props.onClear()}\n class={cn(\n 'text-muted-foreground flex size-4 shrink-0 items-center justify-center rounded-sm',\n 'transition-colors ease-out outline-none hover:text-foreground',\n 'focus-visible:border-ring focus-visible:focus-outline',\n props.class\n )}\n >\n <X class=\"size-3.5\" />\n </button>\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBA,IAAM,QAAQ,SAASoC,OAAW;AAClC,IAAM,cAAc,SAASC,aAAiB;AAC9C,IAAM,IAAI,SAASC,GAAO;;;;;AA+F1B,SAAS,QAAW,KAAc,SAAkB;CAClD,IAAI,OAAO,QAAQ,YAAY,IAAI,OAAO;MACrC,IAAI,MAAM,QAAQ,GAAG,GAAG,KAAK,MAAM,QAAQ,KAAK,QAAQ,MAAM,OAAO;AAC5E;AAEA,IAAM,uBAAuB,cAAoC,IAAI;AAErE,SAAS,KAAW,UAAsC,QAAW,UAAgB;CACnF,IAAI,aAAa,KAAA,GAAW,OAAO;CACnC,IAAI,OAAO,aAAa,YAAY,OAAO,SAAS,MAAM;CAC1D,IAAI,WAAW,QAAQ,OAAO,WAAW,UAAU,OAAO,OAAO;CACjE,OAAO;AACT;;;;;;;;;;;;;;;;AAiBA,SAAgB,SACd,OACA;CACA,MAAM,OAAO,KACX,OACA,WACA,e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rest = omit(useFieldValue(props), "class");
|
|
229
229
|
return createComponent(Input, mergeProps({ get "class"() {
|
|
230
|
-
return cn("h-control-md w-full min-w-0 rounded-md border border-input bg-transparent px-control-md py-1 text-sm", "transition-[color,box-shadow,border-color] ease-out outline-none", "placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground", "focus-visible:border-ring focus-visible:
|
|
230
|
+
return cn("h-control-md w-full min-w-0 rounded-md border border-input bg-transparent px-control-md py-1 text-sm", "transition-[color,box-shadow,border-color] ease-out outline-none", "placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground", "focus-visible:border-ring focus-visible:focus-outline", "aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive-subtle", "disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50", props.class);
|
|
231
231
|
} }, rest));
|
|
232
232
|
}
|
|
233
233
|
function FieldTextArea(props) {
|
|
234
234
|
const rest = omit(useFieldValue(props), "class");
|
|
235
235
|
return createComponent(Textarea, mergeProps({ get "class"() {
|
|
236
|
-
return cn("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-control-md py-2 text-sm", "transition-[color,box-shadow,border-color] ease-out outline-none resize-y", "placeholder:text-muted-foreground", "focus-visible:border-ring focus-visible:
|
|
236
|
+
return cn("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-control-md py-2 text-sm", "transition-[color,box-shadow,border-color] ease-out outline-none resize-y", "placeholder:text-muted-foreground", "focus-visible:border-ring focus-visible:focus-outline", "aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive-subtle", "disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50", props.class);
|
|
237
237
|
} }, rest));
|
|
238
238
|
}
|
|
239
239
|
/**
|