@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","names":["<SelectScopeContext value={scope}>\n <SelectPrimitive<unknown, boolean>\n items={items()}\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 itemToValue={keyOf}\n itemToLabel={textOf}\n isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}\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={props.modal ?? false}\n loop={props.loop}\n >\n {props.children}\n </SelectPrimitive>\n </SelectScopeContext>","value={scope}","<SelectPrimitive<unknown, boolean>\n items={items()}\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 itemToValue={keyOf}\n itemToLabel={textOf}\n isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}\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={props.modal ?? false}\n loop={props.loop}\n >\n {props.children}\n </SelectPrimitive>","onValueChange={(value: unknown) =>\n (props.onChange as ((value: unknown) => void) | undefined)?.(value ?? null)\n }","itemToValue={keyOf}","itemToLabel={textOf}","isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}","onOpenChange={(open: boolean) => props.onOpenChange?.(open)}","<div {...(rest as ComponentProps<'div'>)}>\n <SelectScopeContext value={scope}>\n <SelectPrimitive<unknown, boolean>\n items={items()}\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 itemToValue={keyOf}\n itemToLabel={textOf}\n isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}\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={props.modal ?? false}\n loop={props.loop}\n >\n {props.children}\n </SelectPrimitive>\n </SelectScopeContext>\n </div>","<SelectTriggerPrimitive\n aria-invalid={scope?.invalid() ? 'true' : undefined}\n {...(rest as Record<string, unknown>)}\n // The Kobalte-era state names the classes below and callers key on.\n // Kobalte marked only the value `data-placeholder-shown`, never the\n // trigger, so the trigger's placeholder rule below never matched and a\n // placeholder drew in the foreground colour; the trigger keeps that.\n render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <button {...part} data-slot=\"select-trigger\" data-expanded={state.open ? '' : undefined} />\n )}\n class={cn(\n 'border-input bg-transparent flex w-fit items-center justify-between gap-2 rounded-md border px-control-md',\n 'whitespace-nowrap transition-[color,box-shadow,border-color] ease-out outline-none',\n 'data-[placeholder-shown]:text-muted-foreground',\n 'hover:border-input',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive-subtle',\n 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',\n '*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4',\n {\n 'h-control-sm text-xs': props.size === 'sm',\n 'h-control-md text-sm': props.size === 'md' || props.size === undefined,\n 'h-control-lg text-sm': props.size === 'lg',\n },\n props.class\n )}\n >\n {props.children}\n <Show when={!props.hideIcon}>\n <span aria-hidden=\"true\" class=\"text-muted-foreground\">\n <ChevronDown />\n </span>\n </Show>\n </SelectTriggerPrimitive>","render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <button {...part} data-slot=\"select-trigger\" data-expanded={state.open ? '' : undefined} />\n )}","props.children","<Show when={!props.hideIcon}>\n <span aria-hidden=\"true\" class=\"text-muted-foreground\">\n <ChevronDown />\n </span>\n </Show>","<ChevronDown />","<span aria-hidden=\"true\" class=\"text-muted-foreground\">\n <ChevronDown />\n </span>","<SelectValuePrimitive\n {...(rest as Record<string, unknown>)}\n class={cn('truncate', props.class)}\n render={(part: Record<string, unknown>, state: { placeholder: boolean }) => (\n <span {...part} data-placeholder-shown={state.placeholder ? '' : undefined} />\n )}\n >\n {(state: { value: unknown; placeholder: boolean }) => show(state)}\n </SelectValuePrimitive>","render={(part: Record<string, unknown>, state: { placeholder: boolean }) => (\n <span {...part} data-placeholder-shown={state.placeholder ? '' : undefined} />\n )}","<SelectContentPrimitive\n {...(rest as Record<string, unknown>)}\n side={placement().side}\n align={placement().align}\n // Four pixels is shadcn's `sideOffset`: attached, with room for the\n // trigger's own border.\n sideOffset={scope?.gutter() ?? 4}\n container={props.portalMount}\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-(--available-height) min-w-[8rem] origin-(--transform-origin) overflow-y-auto overflow-x-hidden',\n // The trigger's width, as Kobalte's `sameWidth` default drew the list.\n 'w-(--anchor-width)',\n menuContentPadding,\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 {props.children}\n {/* No arrow: the list is the trigger's own value opened up, attached\n to it, where an arrow would read as a gap. */}\n <SelectList class=\"flex flex-col\">\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 </SelectList>\n </SelectContentPrimitive>","render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <div {...part} data-expanded={state.open ? '' : undefined} />\n )}","<SelectList class=\"flex flex-col\">\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 </SelectList>","class=\"flex flex-col\"","<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}","<SelectItemPrimitive\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 <Show when={props.swatch}>\n <span aria-hidden=\"true\" class={menuSwatchTone({ tone: props.swatch })} />\n </Show>\n <div>{props.children}</div>\n {/* The indicator reads in the accent, like every other selected\n state in the system — the row's own foreground reads as\n decoration. Drawn from the row's `selected` state. */}\n <Show when={state.selected}>\n <span\n data-slot=\"select-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 </SelectItemPrimitive>","<Show when={props.swatch}>\n <span aria-hidden=\"true\" class={menuSwatchTone({ tone: props.swatch })} />\n </Show>","<Show when={state.selected}>\n <span\n data-slot=\"select-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\" />","class=\"size-4\"","role=\"presentation\"","<div role=\"presentation\" class={cn('flex flex-col', props.class)} {...rest} />","<div\n class={cn('text-muted-foreground px-2 py-1.5 text-2xs font-medium uppercase', props.class)}\n {...rest}\n />","<ChevronsUpDown aria-hidden=\"true\" {...(props as Record<string, unknown>)} />","LucideCheck","LucideChevronDown","LucideChevronsUpDown","_$spread","_$insert","_$effect","_$readShallow","_$className"],"sources":["../../../../src/components/ui/select/select.tsx"],"sourcesContent":["import {\n Select as SelectPrimitive,\n SelectContent as SelectContentPrimitive,\n SelectItem as SelectItemPrimitive,\n SelectList,\n SelectTrigger as SelectTriggerPrimitive,\n SelectValue as SelectValuePrimitive,\n} from '@ui-sdk/solid/select'\nimport {\n Check as LucideCheck,\n ChevronDown as LucideChevronDown,\n ChevronsUpDown as LucideChevronsUpDown,\n} 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, menuSwatchTone, type MenuSwatchTone } from '#lib/overlay'\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 ChevronsUpDown = fastIcon(LucideChevronsUpDown)\n\n/**\n * One entry of the list the root builds from `options`: an option, or the\n * section heading of a group. The Kobalte-era `CollectionNode` fields a\n * caller's `itemComponent` reads (`rawValue`, `key`, `textValue`) keep their\n * names.\n */\nexport type SelectCollectionNode<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 SelectBaseProps<Option, OptGroup> = Omit<\n ComponentProps<'div'>,\n 'onChange' | 'children' | 'placeholder'\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 typeahead matches and the trigger shows. */\n optionTextValue?: 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 `SelectItem` with the `item` it receives. */\n itemComponent?: Component<{ item: SelectCollectionNode<Option> }>\n /** Draws a group's heading, before its options. */\n sectionComponent?: Component<{ section: SelectCollectionNode<OptGroup> }>\n /** What the trigger shows while nothing is selected. */\n placeholder?: JSX.Element\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n disabled?: boolean\n required?: boolean\n readOnly?: boolean\n /** The name the value submits under, as the option's `optionValue`. */\n name?: string\n /** `invalid` marks the trigger `aria-invalid`. */\n validationState?: 'valid' | 'invalid'\n /** Where the list opens against the trigger. */\n placement?: `${'top' | 'bottom'}${'' | '-start' | '-end'}`\n /** The gap between the trigger and the list, in pixels. */\n gutter?: number\n /** `true` locks scroll and makes the page inert while open. */\n modal?: boolean\n /** Whether the arrow keys wrap from the last option to the first. */\n loop?: boolean\n children?: JSX.Element\n}\n\n/**\n * The selection: one option, or a list of them with `multiple`. One shape\n * rather than a union, so `options` alone infers `Option` for the callbacks.\n */\ntype SelectionProps<Option, Multiple extends boolean> = {\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}\n\ntype Selection<Option, Multiple extends boolean> = Multiple extends true ? Option[] : Option | null\n\nexport type SelectProps<\n Option,\n OptGroup = never,\n Multiple extends boolean = false,\n> = SelectBaseProps<Option, OptGroup> & SelectionProps<Option, Multiple>\n\ntype SelectScope = {\n nodes: () => SelectCollectionNode<unknown>[]\n itemComponent: () => Component<{ item: SelectCollectionNode<unknown> }> | undefined\n sectionComponent: () => Component<{ section: SelectCollectionNode<unknown> }> | undefined\n placeholder: () => JSX.Element\n placement: () => SelectBaseProps<unknown, unknown>['placement']\n gutter: () => number | undefined\n invalid: () => boolean\n /** The `optionValue` key of an option. */\n keyOf: (option: unknown) => string\n}\n\nconst SelectScopeContext = createContext<SelectScope | 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 * Select.\n *\n * A single choice from a list that is too long to show, or whose options are\n * only known at runtime. The distinction from RadioGroup is disclosure: a\n * Select hides the choices behind a click, which is right above roughly seven\n * options and wrong below it.\n *\n * ui-sdk's Select is the behaviour: the select-only combobox pattern, typeahead\n * on the closed trigger, a listbox with the chosen option focused on open, form\n * submission. This keeps the Kobalte-era collection API on top of it: the\n * root takes `options` with `optionValue`/`optionTextValue`, and draws each\n * one through `itemComponent`, so the value stays the caller's option object.\n *\n * `SelectValue` renders the human-readable label of the selection, not its\n * value, the reason a Select takes both `options` and `optionValue`/`optionText`\n * rather than a bare list of strings, and the reason the trigger never shows a\n * raw id.\n */\nexport function Select<Option, OptGroup = never, Multiple extends boolean = false>(\n props: SelectProps<Option, OptGroup, Multiple>\n) {\n const rest = omit(\n props,\n 'options',\n 'optionValue',\n 'optionTextValue',\n 'optionDisabled',\n 'optionGroupChildren',\n 'itemComponent',\n 'sectionComponent',\n 'placeholder',\n 'open',\n 'defaultOpen',\n 'onOpenChange',\n 'disabled',\n 'required',\n 'readOnly',\n 'name',\n 'validationState',\n 'placement',\n 'gutter',\n 'modal',\n 'loop',\n 'children',\n 'multiple',\n 'value',\n 'defaultValue',\n 'onChange'\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\n // One node per option, reused while the option object is, so an `<For>`\n // over them keeps its rows when `options` is replaced by an equal list.\n const cache = new WeakMap<object, SelectCollectionNode<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' ? textOf(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: SelectCollectionNode<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 // The options as ui-sdk data: the closed trigger's typeahead and labels\n // read them before the list has ever opened.\n const items = createMemo(() =>\n nodes()\n .filter((node) => node.type === 'item')\n .map((node) => ({ value: node.rawValue, label: node.textValue, disabled: node.disabled }))\n )\n\n const scope: SelectScope = {\n nodes,\n itemComponent: () =>\n props.itemComponent as Component<{ item: SelectCollectionNode<unknown> }> | undefined,\n sectionComponent: () =>\n props.sectionComponent as Component<{ section: SelectCollectionNode<unknown> }> | undefined,\n placeholder: () => props.placeholder,\n placement: () => props.placement,\n gutter: () => props.gutter,\n invalid: () => props.validationState === 'invalid',\n keyOf,\n }\n\n // Kobalte's root was an element; the wrapper keeps that box and its props.\n return (\n <div {...(rest as ComponentProps<'div'>)}>\n <SelectScopeContext value={scope}>\n <SelectPrimitive<unknown, boolean>\n items={items()}\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 itemToValue={keyOf}\n itemToLabel={textOf}\n isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}\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={props.modal ?? false}\n loop={props.loop}\n >\n {props.children}\n </SelectPrimitive>\n </SelectScopeContext>\n </div>\n )\n}\n\nexport type SelectTriggerProps = Omit<\n ComponentProps<'button'>,\n 'value' | 'onChange' | 'onSelect'\n> & {\n size?: 'sm' | 'md' | 'lg'\n /** Hide the chevron, e.g. when a caller draws its own affordance. */\n hideIcon?: boolean\n}\n\nexport function SelectTrigger(props: SelectTriggerProps) {\n const scope = useContext(SelectScopeContext)\n const rest = omit(props, 'class', 'size', 'hideIcon', 'children')\n\n return (\n <SelectTriggerPrimitive\n aria-invalid={scope?.invalid() ? 'true' : undefined}\n {...(rest as Record<string, unknown>)}\n // The Kobalte-era state names the classes below and callers key on.\n // Kobalte marked only the value `data-placeholder-shown`, never the\n // trigger, so the trigger's placeholder rule below never matched and a\n // placeholder drew in the foreground colour; the trigger keeps that.\n render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <button {...part} data-slot=\"select-trigger\" data-expanded={state.open ? '' : undefined} />\n )}\n class={cn(\n 'border-input bg-transparent flex w-fit items-center justify-between gap-2 rounded-md border px-control-md',\n 'whitespace-nowrap transition-[color,box-shadow,border-color] ease-out outline-none',\n 'data-[placeholder-shown]:text-muted-foreground',\n 'hover:border-input',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive-subtle',\n 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',\n '*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4',\n {\n 'h-control-sm text-xs': props.size === 'sm',\n 'h-control-md text-sm': props.size === 'md' || props.size === undefined,\n 'h-control-lg text-sm': props.size === 'lg',\n },\n props.class\n )}\n >\n {props.children}\n <Show when={!props.hideIcon}>\n <span aria-hidden=\"true\" class=\"text-muted-foreground\">\n <ChevronDown />\n </span>\n </Show>\n </SelectTriggerPrimitive>\n )\n}\n\n/**\n * What a `SelectValue` render function receives, in the Kobalte-era shape.\n */\nexport type SelectValueState<Option = unknown> = {\n selectedOption: () => Option\n selectedOptions: () => Option[]\n}\n\n/**\n * What the trigger shows for the current selection.\n *\n * The default renderer is the reason a single-select needs no render prop at\n * all. An option is the caller's type, so the label is read from a field by\n * convention: `label`, then `name`, then `textValue`. An option shaped\n * `{ value, label }` therefore needs nothing, and anything else passes\n * `optionLabel`.\n *\n * A multiple-select still supplies its own renderer, because \"3 selected\" is a\n * summary a caller has to phrase, not something a component can guess.\n */\nexport type SelectValueProps = Omit<ComponentProps<'span'>, 'children'> & {\n /**\n * Read the display text from the selected option. Supply this when the option's\n * label does not live in a field called `label`, `name` or `textValue`.\n */\n optionLabel?: (option: unknown) => string\n /** Replace the default readout entirely, for a multiple-select summary. */\n children?: (state: SelectValueState<any>) => JSX.Element\n}\n\n/** Fields a label is read from, in order. See `SelectValueProps.optionLabel`. */\nconst LABEL_FIELDS = ['label', 'name', 'textValue'] as const\n\nfunction labelFromOption(option: unknown): string {\n if (option === null || typeof option !== 'object') {\n return typeof option === 'string' ? option : ''\n }\n\n for (const field of LABEL_FIELDS) {\n const value = (option as Record<string, unknown>)[field]\n if (typeof value === 'string') return value\n }\n\n return ''\n}\n\nexport function SelectValue(props: SelectValueProps) {\n const scope = useContext(SelectScopeContext)\n const rest = omit(props, 'class', 'children', 'optionLabel')\n\n const show = (state: { value: unknown; placeholder: boolean }) => {\n if (state.placeholder) return scope?.placeholder()\n const values = Array.isArray(state.value) ? state.value : [state.value]\n const readout: SelectValueState = {\n selectedOption: () => values[0],\n selectedOptions: () => values,\n }\n if (props.children) return props.children(readout)\n const option = readout.selectedOption()\n return props.optionLabel ? props.optionLabel(option) : labelFromOption(option)\n }\n\n return (\n <SelectValuePrimitive\n {...(rest as Record<string, unknown>)}\n class={cn('truncate', props.class)}\n render={(part: Record<string, unknown>, state: { placeholder: boolean }) => (\n <span {...part} data-placeholder-shown={state.placeholder ? '' : undefined} />\n )}\n >\n {(state: { value: unknown; placeholder: boolean }) => show(state)}\n </SelectValuePrimitive>\n )\n}\n\n/**\n * The option list. The items themselves come from the root's `itemComponent`,\n * which is what makes a Select able to render a typed option rather than a\n * string; `children` here is for content above the list, such as a filter hint.\n */\nexport type SelectContentProps = Omit<ComponentProps<'div'>, 'children'> & {\n children?: JSX.Element\n /** Keep a nested menu inside its enclosing modal's accessible subtree. */\n portalMount?: HTMLElement\n}\n\nexport function SelectContent(props: SelectContentProps) {\n const scope = useContext(SelectScopeContext)\n const rest = omit(props, 'class', 'children', 'portalMount')\n const placement = () => {\n const [side, align] = (scope?.placement() ?? '').split('-')\n return {\n side: (side || undefined) as 'top' | 'bottom' | undefined,\n align: (side ? (align ?? 'center') : undefined) as 'start' | 'center' | 'end' | undefined,\n }\n }\n\n return (\n <SelectContentPrimitive\n {...(rest as Record<string, unknown>)}\n side={placement().side}\n align={placement().align}\n // Four pixels is shadcn's `sideOffset`: attached, with room for the\n // trigger's own border.\n sideOffset={scope?.gutter() ?? 4}\n container={props.portalMount}\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-(--available-height) min-w-[8rem] origin-(--transform-origin) overflow-y-auto overflow-x-hidden',\n // The trigger's width, as Kobalte's `sameWidth` default drew the list.\n 'w-(--anchor-width)',\n menuContentPadding,\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 {props.children}\n {/* No arrow: the list is the trigger's own value opened up, attached\n to it, where an arrow would read as a gap. */}\n <SelectList class=\"flex flex-col\">\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 </SelectList>\n </SelectContentPrimitive>\n )\n}\n\nexport type SelectItemProps = Omit<ComponentProps<'div'>, 'onSelect' | 'onChange'> & {\n /** The node the root's `itemComponent` received. */\n item: SelectCollectionNode<any>\n /** Draw a leading colour dot from the shared tone ladder, the accent or\n * status role the option's card badge carries. `aria-hidden`; the label\n * carries the meaning. */\n swatch?: MenuSwatchTone\n}\n\nexport function SelectItem(props: SelectItemProps) {\n const rest = omit(props, 'class', 'children', 'swatch', 'item')\n\n return (\n <SelectItemPrimitive\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 <Show when={props.swatch}>\n <span aria-hidden=\"true\" class={menuSwatchTone({ tone: props.swatch })} />\n </Show>\n <div>{props.children}</div>\n {/* The indicator reads in the accent, like every other selected\n state in the system — the row's own foreground reads as\n decoration. Drawn from the row's `selected` state. */}\n <Show when={state.selected}>\n <span\n data-slot=\"select-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 </SelectItemPrimitive>\n )\n}\n\n/** A group's wrapper inside the list, for a `sectionComponent`. */\nexport function SelectSection(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/** A group's heading inside the list, for a `sectionComponent`. */\nexport function SelectLabel(props: ComponentProps<'div'>) {\n const rest = omit(props, 'class')\n return (\n <div\n class={cn('text-muted-foreground px-2 py-1.5 text-2xs font-medium uppercase', props.class)}\n {...rest}\n />\n )\n}\n\n/** The chevron pair used when a Select is composed by hand in a field. */\nexport function SelectChevronsUpDown(props: ComponentProps<'svg'>) {\n return <ChevronsUpDown aria-hidden=\"true\" {...(props as Record<string, unknown>)} />\n}\n"],"mappings":";;;;;;;;;;;;;;AAoBA,IAAM,QAAQ,SAASmC,OAAW;AAClC,IAAM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8B;CAC1D,MAAM,OAAO,KAAK,OAAO,OAAO;CACzB,IAAA,QAAA,OAA6E;CAAXQ,OAAA,OAAA,CAAA;EAA7DP,MAAAA;EAAoB,IAAA,UAAA;GAAO,OAAA,GAAG,iBAAiB,MAAM,KAAK;EAAC;CAAU,GAAJ,IAAA,GAAA,KAAA;CAA7E,OAAOC;AACT;;AAGA,SAAgB,YAAY,OAA8B;CACxD,MAAM,OAAO,KAAK,OAAO,OAAO;CAE9B,IAAA,SAAA,OAGC;CADCM,OAAA,QAAA,CAAA,EADA,IAAA,UAAA;EAAO,OAAA,GAAG,oEAAoE,MAAM,KAAK;CAAC,EAClF,GAAJ,IAAA,GAAA,KAAA;CAHR,OACEL;AAKJ;;AAGA,SAAgB,qBAAqB,OAA8B;CACjE,OAAOC,gBAAAA,gBAAAA,WAAAA,EAAgB,eAAY,OAAgD,GAApC,KAAoC,CAAA;AACrF"}
|
|
1
|
+
{"version":3,"file":"select.js","names":["<SelectScopeContext value={scope}>\n <SelectPrimitive<unknown, boolean>\n items={items()}\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 itemToValue={keyOf}\n itemToLabel={textOf}\n isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}\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={props.modal ?? false}\n loop={props.loop}\n >\n {props.children}\n </SelectPrimitive>\n </SelectScopeContext>","value={scope}","<SelectPrimitive<unknown, boolean>\n items={items()}\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 itemToValue={keyOf}\n itemToLabel={textOf}\n isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}\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={props.modal ?? false}\n loop={props.loop}\n >\n {props.children}\n </SelectPrimitive>","onValueChange={(value: unknown) =>\n (props.onChange as ((value: unknown) => void) | undefined)?.(value ?? null)\n }","itemToValue={keyOf}","itemToLabel={textOf}","isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}","onOpenChange={(open: boolean) => props.onOpenChange?.(open)}","<div {...(rest as ComponentProps<'div'>)}>\n <SelectScopeContext value={scope}>\n <SelectPrimitive<unknown, boolean>\n items={items()}\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 itemToValue={keyOf}\n itemToLabel={textOf}\n isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}\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={props.modal ?? false}\n loop={props.loop}\n >\n {props.children}\n </SelectPrimitive>\n </SelectScopeContext>\n </div>","<SelectTriggerPrimitive\n aria-invalid={scope?.invalid() ? 'true' : undefined}\n {...(rest as Record<string, unknown>)}\n // The Kobalte-era state names the classes below and callers key on.\n // Kobalte marked only the value `data-placeholder-shown`, never the\n // trigger, so the trigger's placeholder rule below never matched and a\n // placeholder drew in the foreground colour; the trigger keeps that.\n render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <button {...part} data-slot=\"select-trigger\" data-expanded={state.open ? '' : undefined} />\n )}\n class={cn(\n 'border-input bg-transparent flex w-fit items-center justify-between gap-2 rounded-md border px-control-md',\n 'whitespace-nowrap transition-[color,box-shadow,border-color] ease-out outline-none',\n 'data-[placeholder-shown]:text-muted-foreground',\n 'hover:border-input',\n 'focus-visible:border-ring focus-visible:focus-outline',\n 'aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive-subtle',\n 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',\n '*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4',\n {\n 'h-control-sm text-xs': props.size === 'sm',\n 'h-control-md text-sm': props.size === 'md' || props.size === undefined,\n 'h-control-lg text-sm': props.size === 'lg',\n },\n props.class\n )}\n >\n {props.children}\n <Show when={!props.hideIcon}>\n <span aria-hidden=\"true\" class=\"text-muted-foreground\">\n <ChevronDown />\n </span>\n </Show>\n </SelectTriggerPrimitive>","render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <button {...part} data-slot=\"select-trigger\" data-expanded={state.open ? '' : undefined} />\n )}","props.children","<Show when={!props.hideIcon}>\n <span aria-hidden=\"true\" class=\"text-muted-foreground\">\n <ChevronDown />\n </span>\n </Show>","<ChevronDown />","<span aria-hidden=\"true\" class=\"text-muted-foreground\">\n <ChevronDown />\n </span>","<SelectValuePrimitive\n {...(rest as Record<string, unknown>)}\n class={cn('truncate', props.class)}\n render={(part: Record<string, unknown>, state: { placeholder: boolean }) => (\n <span {...part} data-placeholder-shown={state.placeholder ? '' : undefined} />\n )}\n >\n {(state: { value: unknown; placeholder: boolean }) => show(state)}\n </SelectValuePrimitive>","render={(part: Record<string, unknown>, state: { placeholder: boolean }) => (\n <span {...part} data-placeholder-shown={state.placeholder ? '' : undefined} />\n )}","<SelectContentPrimitive\n {...(rest as Record<string, unknown>)}\n side={placement().side}\n align={placement().align}\n // Four pixels is shadcn's `sideOffset`: attached, with room for the\n // trigger's own border.\n sideOffset={scope?.gutter() ?? 4}\n container={props.portalMount}\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-(--available-height) min-w-[8rem] origin-(--transform-origin) overflow-y-auto overflow-x-hidden',\n // The trigger's width, as Kobalte's `sameWidth` default drew the list.\n 'w-(--anchor-width)',\n menuContentPadding,\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 {props.children}\n {/* No arrow: the list is the trigger's own value opened up, attached\n to it, where an arrow would read as a gap. */}\n <SelectList class=\"flex flex-col\">\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 </SelectList>\n </SelectContentPrimitive>","render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <div {...part} data-expanded={state.open ? '' : undefined} />\n )}","<SelectList class=\"flex flex-col\">\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 </SelectList>","class=\"flex flex-col\"","<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}","<SelectItemPrimitive\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 <Show when={props.swatch}>\n <span aria-hidden=\"true\" class={menuSwatchTone({ tone: props.swatch })} />\n </Show>\n <div>{props.children}</div>\n {/* The indicator reads in the accent, like every other selected\n state in the system — the row's own foreground reads as\n decoration. Drawn from the row's `selected` state. */}\n <Show when={state.selected}>\n <span\n data-slot=\"select-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 </SelectItemPrimitive>","<Show when={props.swatch}>\n <span aria-hidden=\"true\" class={menuSwatchTone({ tone: props.swatch })} />\n </Show>","<Show when={state.selected}>\n <span\n data-slot=\"select-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\" />","class=\"size-4\"","role=\"presentation\"","<div role=\"presentation\" class={cn('flex flex-col', props.class)} {...rest} />","<div\n class={cn('text-muted-foreground px-2 py-1.5 text-2xs font-medium uppercase', props.class)}\n {...rest}\n />","<ChevronsUpDown aria-hidden=\"true\" {...(props as Record<string, unknown>)} />","LucideCheck","LucideChevronDown","LucideChevronsUpDown","_$spread","_$insert","_$effect","_$readShallow","_$className"],"sources":["../../../../src/components/ui/select/select.tsx"],"sourcesContent":["import {\n Select as SelectPrimitive,\n SelectContent as SelectContentPrimitive,\n SelectItem as SelectItemPrimitive,\n SelectList,\n SelectTrigger as SelectTriggerPrimitive,\n SelectValue as SelectValuePrimitive,\n} from '@ui-sdk/solid/select'\nimport {\n Check as LucideCheck,\n ChevronDown as LucideChevronDown,\n ChevronsUpDown as LucideChevronsUpDown,\n} 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, menuSwatchTone, type MenuSwatchTone } from '#lib/overlay'\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 ChevronsUpDown = fastIcon(LucideChevronsUpDown)\n\n/**\n * One entry of the list the root builds from `options`: an option, or the\n * section heading of a group. The Kobalte-era `CollectionNode` fields a\n * caller's `itemComponent` reads (`rawValue`, `key`, `textValue`) keep their\n * names.\n */\nexport type SelectCollectionNode<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 SelectBaseProps<Option, OptGroup> = Omit<\n ComponentProps<'div'>,\n 'onChange' | 'children' | 'placeholder'\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 typeahead matches and the trigger shows. */\n optionTextValue?: 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 `SelectItem` with the `item` it receives. */\n itemComponent?: Component<{ item: SelectCollectionNode<Option> }>\n /** Draws a group's heading, before its options. */\n sectionComponent?: Component<{ section: SelectCollectionNode<OptGroup> }>\n /** What the trigger shows while nothing is selected. */\n placeholder?: JSX.Element\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n disabled?: boolean\n required?: boolean\n readOnly?: boolean\n /** The name the value submits under, as the option's `optionValue`. */\n name?: string\n /** `invalid` marks the trigger `aria-invalid`. */\n validationState?: 'valid' | 'invalid'\n /** Where the list opens against the trigger. */\n placement?: `${'top' | 'bottom'}${'' | '-start' | '-end'}`\n /** The gap between the trigger and the list, in pixels. */\n gutter?: number\n /** `true` locks scroll and makes the page inert while open. */\n modal?: boolean\n /** Whether the arrow keys wrap from the last option to the first. */\n loop?: boolean\n children?: JSX.Element\n}\n\n/**\n * The selection: one option, or a list of them with `multiple`. One shape\n * rather than a union, so `options` alone infers `Option` for the callbacks.\n */\ntype SelectionProps<Option, Multiple extends boolean> = {\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}\n\ntype Selection<Option, Multiple extends boolean> = Multiple extends true ? Option[] : Option | null\n\nexport type SelectProps<\n Option,\n OptGroup = never,\n Multiple extends boolean = false,\n> = SelectBaseProps<Option, OptGroup> & SelectionProps<Option, Multiple>\n\ntype SelectScope = {\n nodes: () => SelectCollectionNode<unknown>[]\n itemComponent: () => Component<{ item: SelectCollectionNode<unknown> }> | undefined\n sectionComponent: () => Component<{ section: SelectCollectionNode<unknown> }> | undefined\n placeholder: () => JSX.Element\n placement: () => SelectBaseProps<unknown, unknown>['placement']\n gutter: () => number | undefined\n invalid: () => boolean\n /** The `optionValue` key of an option. */\n keyOf: (option: unknown) => string\n}\n\nconst SelectScopeContext = createContext<SelectScope | 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 * Select.\n *\n * A single choice from a list that is too long to show, or whose options are\n * only known at runtime. The distinction from RadioGroup is disclosure: a\n * Select hides the choices behind a click, which is right above roughly seven\n * options and wrong below it.\n *\n * ui-sdk's Select is the behaviour: the select-only combobox pattern, typeahead\n * on the closed trigger, a listbox with the chosen option focused on open, form\n * submission. This keeps the Kobalte-era collection API on top of it: the\n * root takes `options` with `optionValue`/`optionTextValue`, and draws each\n * one through `itemComponent`, so the value stays the caller's option object.\n *\n * `SelectValue` renders the human-readable label of the selection, not its\n * value, the reason a Select takes both `options` and `optionValue`/`optionText`\n * rather than a bare list of strings, and the reason the trigger never shows a\n * raw id.\n */\nexport function Select<Option, OptGroup = never, Multiple extends boolean = false>(\n props: SelectProps<Option, OptGroup, Multiple>\n) {\n const rest = omit(\n props,\n 'options',\n 'optionValue',\n 'optionTextValue',\n 'optionDisabled',\n 'optionGroupChildren',\n 'itemComponent',\n 'sectionComponent',\n 'placeholder',\n 'open',\n 'defaultOpen',\n 'onOpenChange',\n 'disabled',\n 'required',\n 'readOnly',\n 'name',\n 'validationState',\n 'placement',\n 'gutter',\n 'modal',\n 'loop',\n 'children',\n 'multiple',\n 'value',\n 'defaultValue',\n 'onChange'\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\n // One node per option, reused while the option object is, so an `<For>`\n // over them keeps its rows when `options` is replaced by an equal list.\n const cache = new WeakMap<object, SelectCollectionNode<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' ? textOf(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: SelectCollectionNode<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 // The options as ui-sdk data: the closed trigger's typeahead and labels\n // read them before the list has ever opened.\n const items = createMemo(() =>\n nodes()\n .filter((node) => node.type === 'item')\n .map((node) => ({ value: node.rawValue, label: node.textValue, disabled: node.disabled }))\n )\n\n const scope: SelectScope = {\n nodes,\n itemComponent: () =>\n props.itemComponent as Component<{ item: SelectCollectionNode<unknown> }> | undefined,\n sectionComponent: () =>\n props.sectionComponent as Component<{ section: SelectCollectionNode<unknown> }> | undefined,\n placeholder: () => props.placeholder,\n placement: () => props.placement,\n gutter: () => props.gutter,\n invalid: () => props.validationState === 'invalid',\n keyOf,\n }\n\n // Kobalte's root was an element; the wrapper keeps that box and its props.\n return (\n <div {...(rest as ComponentProps<'div'>)}>\n <SelectScopeContext value={scope}>\n <SelectPrimitive<unknown, boolean>\n items={items()}\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 itemToValue={keyOf}\n itemToLabel={textOf}\n isItemEqualToValue={(item: unknown, value: unknown) => keyOf(item) === keyOf(value)}\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={props.modal ?? false}\n loop={props.loop}\n >\n {props.children}\n </SelectPrimitive>\n </SelectScopeContext>\n </div>\n )\n}\n\nexport type SelectTriggerProps = Omit<\n ComponentProps<'button'>,\n 'value' | 'onChange' | 'onSelect'\n> & {\n size?: 'sm' | 'md' | 'lg'\n /** Hide the chevron, e.g. when a caller draws its own affordance. */\n hideIcon?: boolean\n}\n\nexport function SelectTrigger(props: SelectTriggerProps) {\n const scope = useContext(SelectScopeContext)\n const rest = omit(props, 'class', 'size', 'hideIcon', 'children')\n\n return (\n <SelectTriggerPrimitive\n aria-invalid={scope?.invalid() ? 'true' : undefined}\n {...(rest as Record<string, unknown>)}\n // The Kobalte-era state names the classes below and callers key on.\n // Kobalte marked only the value `data-placeholder-shown`, never the\n // trigger, so the trigger's placeholder rule below never matched and a\n // placeholder drew in the foreground colour; the trigger keeps that.\n render={(part: Record<string, unknown>, state: { open: boolean }) => (\n <button {...part} data-slot=\"select-trigger\" data-expanded={state.open ? '' : undefined} />\n )}\n class={cn(\n 'border-input bg-transparent flex w-fit items-center justify-between gap-2 rounded-md border px-control-md',\n 'whitespace-nowrap transition-[color,box-shadow,border-color] ease-out outline-none',\n 'data-[placeholder-shown]:text-muted-foreground',\n 'hover:border-input',\n 'focus-visible:border-ring focus-visible:focus-outline',\n 'aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive-subtle',\n 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',\n '*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4',\n {\n 'h-control-sm text-xs': props.size === 'sm',\n 'h-control-md text-sm': props.size === 'md' || props.size === undefined,\n 'h-control-lg text-sm': props.size === 'lg',\n },\n props.class\n )}\n >\n {props.children}\n <Show when={!props.hideIcon}>\n <span aria-hidden=\"true\" class=\"text-muted-foreground\">\n <ChevronDown />\n </span>\n </Show>\n </SelectTriggerPrimitive>\n )\n}\n\n/**\n * What a `SelectValue` render function receives, in the Kobalte-era shape.\n */\nexport type SelectValueState<Option = unknown> = {\n selectedOption: () => Option\n selectedOptions: () => Option[]\n}\n\n/**\n * What the trigger shows for the current selection.\n *\n * The default renderer is the reason a single-select needs no render prop at\n * all. An option is the caller's type, so the label is read from a field by\n * convention: `label`, then `name`, then `textValue`. An option shaped\n * `{ value, label }` therefore needs nothing, and anything else passes\n * `optionLabel`.\n *\n * A multiple-select still supplies its own renderer, because \"3 selected\" is a\n * summary a caller has to phrase, not something a component can guess.\n */\nexport type SelectValueProps = Omit<ComponentProps<'span'>, 'children'> & {\n /**\n * Read the display text from the selected option. Supply this when the option's\n * label does not live in a field called `label`, `name` or `textValue`.\n */\n optionLabel?: (option: unknown) => string\n /** Replace the default readout entirely, for a multiple-select summary. */\n children?: (state: SelectValueState<any>) => JSX.Element\n}\n\n/** Fields a label is read from, in order. See `SelectValueProps.optionLabel`. */\nconst LABEL_FIELDS = ['label', 'name', 'textValue'] as const\n\nfunction labelFromOption(option: unknown): string {\n if (option === null || typeof option !== 'object') {\n return typeof option === 'string' ? option : ''\n }\n\n for (const field of LABEL_FIELDS) {\n const value = (option as Record<string, unknown>)[field]\n if (typeof value === 'string') return value\n }\n\n return ''\n}\n\nexport function SelectValue(props: SelectValueProps) {\n const scope = useContext(SelectScopeContext)\n const rest = omit(props, 'class', 'children', 'optionLabel')\n\n const show = (state: { value: unknown; placeholder: boolean }) => {\n if (state.placeholder) return scope?.placeholder()\n const values = Array.isArray(state.value) ? state.value : [state.value]\n const readout: SelectValueState = {\n selectedOption: () => values[0],\n selectedOptions: () => values,\n }\n if (props.children) return props.children(readout)\n const option = readout.selectedOption()\n return props.optionLabel ? props.optionLabel(option) : labelFromOption(option)\n }\n\n return (\n <SelectValuePrimitive\n {...(rest as Record<string, unknown>)}\n class={cn('truncate', props.class)}\n render={(part: Record<string, unknown>, state: { placeholder: boolean }) => (\n <span {...part} data-placeholder-shown={state.placeholder ? '' : undefined} />\n )}\n >\n {(state: { value: unknown; placeholder: boolean }) => show(state)}\n </SelectValuePrimitive>\n )\n}\n\n/**\n * The option list. The items themselves come from the root's `itemComponent`,\n * which is what makes a Select able to render a typed option rather than a\n * string; `children` here is for content above the list, such as a filter hint.\n */\nexport type SelectContentProps = Omit<ComponentProps<'div'>, 'children'> & {\n children?: JSX.Element\n /** Keep a nested menu inside its enclosing modal's accessible subtree. */\n portalMount?: HTMLElement\n}\n\nexport function SelectContent(props: SelectContentProps) {\n const scope = useContext(SelectScopeContext)\n const rest = omit(props, 'class', 'children', 'portalMount')\n const placement = () => {\n const [side, align] = (scope?.placement() ?? '').split('-')\n return {\n side: (side || undefined) as 'top' | 'bottom' | undefined,\n align: (side ? (align ?? 'center') : undefined) as 'start' | 'center' | 'end' | undefined,\n }\n }\n\n return (\n <SelectContentPrimitive\n {...(rest as Record<string, unknown>)}\n side={placement().side}\n align={placement().align}\n // Four pixels is shadcn's `sideOffset`: attached, with room for the\n // trigger's own border.\n sideOffset={scope?.gutter() ?? 4}\n container={props.portalMount}\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-(--available-height) min-w-[8rem] origin-(--transform-origin) overflow-y-auto overflow-x-hidden',\n // The trigger's width, as Kobalte's `sameWidth` default drew the list.\n 'w-(--anchor-width)',\n menuContentPadding,\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 {props.children}\n {/* No arrow: the list is the trigger's own value opened up, attached\n to it, where an arrow would read as a gap. */}\n <SelectList class=\"flex flex-col\">\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 </SelectList>\n </SelectContentPrimitive>\n )\n}\n\nexport type SelectItemProps = Omit<ComponentProps<'div'>, 'onSelect' | 'onChange'> & {\n /** The node the root's `itemComponent` received. */\n item: SelectCollectionNode<any>\n /** Draw a leading colour dot from the shared tone ladder, the accent or\n * status role the option's card badge carries. `aria-hidden`; the label\n * carries the meaning. */\n swatch?: MenuSwatchTone\n}\n\nexport function SelectItem(props: SelectItemProps) {\n const rest = omit(props, 'class', 'children', 'swatch', 'item')\n\n return (\n <SelectItemPrimitive\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 <Show when={props.swatch}>\n <span aria-hidden=\"true\" class={menuSwatchTone({ tone: props.swatch })} />\n </Show>\n <div>{props.children}</div>\n {/* The indicator reads in the accent, like every other selected\n state in the system — the row's own foreground reads as\n decoration. Drawn from the row's `selected` state. */}\n <Show when={state.selected}>\n <span\n data-slot=\"select-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 </SelectItemPrimitive>\n )\n}\n\n/** A group's wrapper inside the list, for a `sectionComponent`. */\nexport function SelectSection(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/** A group's heading inside the list, for a `sectionComponent`. */\nexport function SelectLabel(props: ComponentProps<'div'>) {\n const rest = omit(props, 'class')\n return (\n <div\n class={cn('text-muted-foreground px-2 py-1.5 text-2xs font-medium uppercase', props.class)}\n {...rest}\n />\n )\n}\n\n/** The chevron pair used when a Select is composed by hand in a field. */\nexport function SelectChevronsUpDown(props: ComponentProps<'svg'>) {\n return <ChevronsUpDown aria-hidden=\"true\" {...(props as Record<string, unknown>)} />\n}\n"],"mappings":";;;;;;;;;;;;;;AAoBA,IAAM,QAAQ,SAASmC,OAAW;AAClC,IAAM,cAAc,SAASC,aAAiB;AAC9C,IAAM,iBAAiB,SAASC,gBAAoB;AA0FpD,IAAM,qBAAqB,cAAkC,IAAI;AAEjE,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,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,KAAK,OAAO,OAAO;CAE9B,IAAA,SAAA,OAGC;CADCM,OAAA,QAAA,CAAA,EADA,IAAA,UAAA;EAAO,OAAA,GAAG,oEAAoE,MAAM,KAAK;CAAC,EAClF,GAAJ,IAAA,GAAA,KAAA;CAHR,OACEL;AAKJ;;AAGA,SAAgB,qBAAqB,OAA8B;CACjE,OAAOC,gBAAAA,gBAAAA,WAAAA,EAAgB,eAAY,OAAgD,GAApC,KAAoC,CAAA;AACrF"}
|
|
@@ -63,7 +63,7 @@ function Slider(props) {
|
|
|
63
63
|
})() ? void 0 : props["aria-labelledby"];
|
|
64
64
|
},
|
|
65
65
|
get "class"() {
|
|
66
|
-
return cn("border-primary bg-background block size-4 shrink-0 rounded-full border-2 shadow-xs", "transition-[color,box-shadow] ease-out outline-none", "hover:ring-4 hover:ring-primary-subtle", "has-[:focus-visible]:
|
|
66
|
+
return cn("border-primary bg-background block size-4 shrink-0 rounded-full border-2 shadow-xs", "transition-[color,box-shadow] ease-out outline-none", "hover:ring-4 hover:ring-primary-subtle", "has-[:focus-visible]:focus-outline", props.thumbClass);
|
|
67
67
|
},
|
|
68
68
|
children: (state) => memo(() => {
|
|
69
69
|
return memo(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider.js","names":["<SdkSlider\n data-slot=\"slider\"\n value={props.value}\n defaultValue={props.defaultValue ?? (props.value ? undefined : [0])}\n min={props.minValue}\n max={props.maxValue}\n onValueChange={(value) => props.onChange?.(toArray(value))}\n onValueCommit={(value) => props.onChangeEnd?.(toArray(value))}\n // A range names its group as well as each thumb; a single thumb is the\n // control, and carries the name itself.\n aria-label={props.thumbLabels ? props['aria-label'] : undefined}\n aria-labelledby={props.thumbLabels ? props['aria-labelledby'] : undefined}\n class={cn(\n 'relative flex touch-none flex-col justify-center select-none',\n 'data-[orientation=vertical]:h-full data-[orientation=vertical]:w-5 data-[orientation=horizontal]:w-full',\n 'data-[disabled]:opacity-50',\n props.class as string\n )}\n {...rest}\n >\n {/* Where presses land: the whole box around the thin track. */}\n <SdkSliderControl class=\"flex grow flex-col justify-center self-stretch\">\n <SdkSliderTrack\n class={cn(\n 'bg-input relative grow rounded-full',\n 'data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full',\n 'data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5',\n props.trackClass\n )}\n >\n <SdkSliderIndicator\n class={cn(\n 'bg-primary absolute rounded-full',\n 'data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full',\n props.rangeClass\n )}\n />\n <For each={thumbs()}>\n {(index) => (\n <SdkSliderThumb\n index={index}\n aria-label={props.thumbLabels?.[index] ?? props['aria-label']}\n aria-labelledby={props.thumbLabels?.[index] ? undefined : props['aria-labelledby']}\n class={cn(\n 'border-primary bg-background block size-4 shrink-0 rounded-full border-2 shadow-xs',\n 'transition-[color,box-shadow] ease-out outline-none',\n 'hover:ring-4 hover:ring-primary-subtle',\n 'has-[:focus-visible]:ring-4 has-[:focus-visible]:ring-primary-subtle',\n props.thumbClass\n )}\n >\n {(state) => (\n <Show when={props.valueLabel}>\n <span class=\"bg-popover text-popover-foreground absolute -top-6 left-1/2 -translate-x-1/2 rounded-sm border border-border px-1 text-2xs tabular-nums\">\n {state.thumbValue}\n </span>\n </Show>\n )}\n </SdkSliderThumb>\n )}\n </For>\n </SdkSliderTrack>\n </SdkSliderControl>\n {props.children}\n </SdkSlider>","onValueChange={(value) => props.onChange?.(toArray(value))}","onValueCommit={(value) => props.onChangeEnd?.(toArray(value))}","props.thumbLabels ? props['aria-label'] : undefined","props.thumbLabels ? props['aria-labelledby'] : undefined","<SdkSliderControl class=\"flex grow flex-col justify-center self-stretch\">\n <SdkSliderTrack\n class={cn(\n 'bg-input relative grow rounded-full',\n 'data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full',\n 'data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5',\n props.trackClass\n )}\n >\n <SdkSliderIndicator\n class={cn(\n 'bg-primary absolute rounded-full',\n 'data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full',\n props.rangeClass\n )}\n />\n <For each={thumbs()}>\n {(index) => (\n <SdkSliderThumb\n index={index}\n aria-label={props.thumbLabels?.[index] ?? props['aria-label']}\n aria-labelledby={props.thumbLabels?.[index] ? undefined : props['aria-labelledby']}\n class={cn(\n 'border-primary bg-background block size-4 shrink-0 rounded-full border-2 shadow-xs',\n 'transition-[color,box-shadow] ease-out outline-none',\n 'hover:ring-4 hover:ring-primary-subtle',\n 'has-[:focus-visible]:ring-4 has-[:focus-visible]:ring-primary-subtle',\n props.thumbClass\n )}\n >\n {(state) => (\n <Show when={props.valueLabel}>\n <span class=\"bg-popover text-popover-foreground absolute -top-6 left-1/2 -translate-x-1/2 rounded-sm border border-border px-1 text-2xs tabular-nums\">\n {state.thumbValue}\n </span>\n </Show>\n )}\n </SdkSliderThumb>\n )}\n </For>\n </SdkSliderTrack>\n </SdkSliderControl>","class=\"flex grow flex-col justify-center self-stretch\"","<SdkSliderTrack\n class={cn(\n 'bg-input relative grow rounded-full',\n 'data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full',\n 'data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5',\n props.trackClass\n )}\n >\n <SdkSliderIndicator\n class={cn(\n 'bg-primary absolute rounded-full',\n 'data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full',\n props.rangeClass\n )}\n />\n <For each={thumbs()}>\n {(index) => (\n <SdkSliderThumb\n index={index}\n aria-label={props.thumbLabels?.[index] ?? props['aria-label']}\n aria-labelledby={props.thumbLabels?.[index] ? undefined : props['aria-labelledby']}\n class={cn(\n 'border-primary bg-background block size-4 shrink-0 rounded-full border-2 shadow-xs',\n 'transition-[color,box-shadow] ease-out outline-none',\n 'hover:ring-4 hover:ring-primary-subtle',\n 'has-[:focus-visible]:ring-4 has-[:focus-visible]:ring-primary-subtle',\n props.thumbClass\n )}\n >\n {(state) => (\n <Show when={props.valueLabel}>\n <span class=\"bg-popover text-popover-foreground absolute -top-6 left-1/2 -translate-x-1/2 rounded-sm border border-border px-1 text-2xs tabular-nums\">\n {state.thumbValue}\n </span>\n </Show>\n )}\n </SdkSliderThumb>\n )}\n </For>\n </SdkSliderTrack>","<SdkSliderIndicator\n class={cn(\n 'bg-primary absolute rounded-full',\n 'data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full',\n props.rangeClass\n )}\n />","<For each={thumbs()}>\n {(index) => (\n <SdkSliderThumb\n index={index}\n aria-label={props.thumbLabels?.[index] ?? props['aria-label']}\n aria-labelledby={props.thumbLabels?.[index] ? undefined : props['aria-labelledby']}\n class={cn(\n 'border-primary bg-background block size-4 shrink-0 rounded-full border-2 shadow-xs',\n 'transition-[color,box-shadow] ease-out outline-none',\n 'hover:ring-4 hover:ring-primary-subtle',\n 'has-[:focus-visible]:ring-4 has-[:focus-visible]:ring-primary-subtle',\n props.thumbClass\n )}\n >\n {(state) => (\n <Show when={props.valueLabel}>\n <span class=\"bg-popover text-popover-foreground absolute -top-6 left-1/2 -translate-x-1/2 rounded-sm border border-border px-1 text-2xs tabular-nums\">\n {state.thumbValue}\n </span>\n </Show>\n )}\n </SdkSliderThumb>\n )}\n </For>","<SdkSliderThumb\n index={index}\n aria-label={props.thumbLabels?.[index] ?? props['aria-label']}\n aria-labelledby={props.thumbLabels?.[index] ? undefined : props['aria-labelledby']}\n class={cn(\n 'border-primary bg-background block size-4 shrink-0 rounded-full border-2 shadow-xs',\n 'transition-[color,box-shadow] ease-out outline-none',\n 'hover:ring-4 hover:ring-primary-subtle',\n 'has-[:focus-visible]:ring-4 has-[:focus-visible]:ring-primary-subtle',\n props.thumbClass\n )}\n >\n {(state) => (\n <Show when={props.valueLabel}>\n <span class=\"bg-popover text-popover-foreground absolute -top-6 left-1/2 -translate-x-1/2 rounded-sm border border-border px-1 text-2xs tabular-nums\">\n {state.thumbValue}\n </span>\n </Show>\n )}\n </SdkSliderThumb>","props.thumbLabels?.[index] ? undefined : props['aria-labelledby']","<Show when={props.valueLabel}>\n <span class=\"bg-popover text-popover-foreground absolute -top-6 left-1/2 -translate-x-1/2 rounded-sm border border-border px-1 text-2xs tabular-nums\">\n {state.thumbValue}\n </span>\n </Show>","props.children","_$insert"],"sources":["../../../../src/components/ui/slider/slider.tsx"],"sourcesContent":["import {\n Slider as SdkSlider,\n SliderControl as SdkSliderControl,\n SliderIndicator as SdkSliderIndicator,\n SliderThumb as SdkSliderThumb,\n SliderTrack as SdkSliderTrack,\n} from '@ui-sdk/solid/slider'\nimport type { ComponentProps, JSX } from '@solidjs/web'\nimport { For, Show, omit } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * Slider.\n *\n * For a value on a continuum where position matters more than precision, a\n * zoom, a volume, a threshold. When the number matters, pass `valueLabel` so\n * the value is both adjustable *and* readable; a bare slider is a control\n * nobody can set exactly.\n *\n * ui-sdk's Slider handles pointer capture, keyboard stepping and the ARIA\n * value wiring: each thumb holds a visually hidden native range input, which\n * is what takes focus, so the ring is drawn from `:has(:focus-visible)`. This\n * paints the track, fill and one thumb per value. The thumbs sit on the track,\n * which ui-sdk places them in, so the track does not clip its children; the\n * fill never leaves it, so nothing is drawn differently.\n *\n * A range submits one form value, `start/end`, under its `name`.\n */\ntype SdkSliderProps = ComponentProps<typeof SdkSlider>\n\n// `onChange` is omitted too: the DOM `onChange` the root's props carry would\n// otherwise intersect with the value callback below, and a plain\n// `(value: number[]) => void` handler would not type-check.\nexport type SliderProps = Omit<\n SdkSliderProps,\n | 'value'\n | 'defaultValue'\n | 'onValueChange'\n | 'onValueCommit'\n | 'onChange'\n | 'min'\n | 'max'\n | 'children'\n> & {\n /** One number per thumb, like `[20, 80]` for a range. Pass it to control the slider. */\n value?: number[]\n /** The values at first, when uncontrolled. A form reset returns to them. */\n defaultValue?: number[]\n /** Called on every step of a drag or a key, with one number per thumb. */\n onChange?: (value: number[]) => void\n /** Called once the interaction that changed the value ends: for saving. */\n onChangeEnd?: (value: number[]) => void\n /** The lowest value; 0 by default. */\n minValue?: number\n /** The highest value; 100 by default. */\n maxValue?: number\n /** Accessible names for individual thumbs, in value order (for example minimum and maximum). */\n thumbLabels?: readonly string[]\n trackClass?: string\n rangeClass?: string\n thumbClass?: string\n /** Show the current value beside the thumb while dragging. */\n valueLabel?: boolean\n children?: JSX.Element\n}\n\nconst toArray = (value: number | number[]) => (Array.isArray(value) ? value : [value])\n\nexport function Slider(props: SliderProps) {\n const rest = omit(\n props,\n 'class',\n 'trackClass',\n 'rangeClass',\n 'thumbClass',\n 'thumbLabels',\n 'valueLabel',\n 'children',\n 'aria-label',\n 'aria-labelledby',\n 'value',\n 'defaultValue',\n 'onChange',\n 'onChangeEnd',\n 'minValue',\n 'maxValue'\n )\n const thumbs = () =>\n Array.from({ length: (props.value ?? props.defaultValue ?? [0]).length }, (_, index) => index)\n\n return (\n <SdkSlider\n data-slot=\"slider\"\n value={props.value}\n defaultValue={props.defaultValue ?? (props.value ? undefined : [0])}\n min={props.minValue}\n max={props.maxValue}\n onValueChange={(value) => props.onChange?.(toArray(value))}\n onValueCommit={(value) => props.onChangeEnd?.(toArray(value))}\n // A range names its group as well as each thumb; a single thumb is the\n // control, and carries the name itself.\n aria-label={props.thumbLabels ? props['aria-label'] : undefined}\n aria-labelledby={props.thumbLabels ? props['aria-labelledby'] : undefined}\n class={cn(\n 'relative flex touch-none flex-col justify-center select-none',\n 'data-[orientation=vertical]:h-full data-[orientation=vertical]:w-5 data-[orientation=horizontal]:w-full',\n 'data-[disabled]:opacity-50',\n props.class as string\n )}\n {...rest}\n >\n {/* Where presses land: the whole box around the thin track. */}\n <SdkSliderControl class=\"flex grow flex-col justify-center self-stretch\">\n <SdkSliderTrack\n class={cn(\n 'bg-input relative grow rounded-full',\n 'data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full',\n 'data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5',\n props.trackClass\n )}\n >\n <SdkSliderIndicator\n class={cn(\n 'bg-primary absolute rounded-full',\n 'data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full',\n props.rangeClass\n )}\n />\n <For each={thumbs()}>\n {(index) => (\n <SdkSliderThumb\n index={index}\n aria-label={props.thumbLabels?.[index] ?? props['aria-label']}\n aria-labelledby={props.thumbLabels?.[index] ? undefined : props['aria-labelledby']}\n class={cn(\n 'border-primary bg-background block size-4 shrink-0 rounded-full border-2 shadow-xs',\n 'transition-[color,box-shadow] ease-out outline-none',\n 'hover:ring-4 hover:ring-primary-subtle',\n 'has-[:focus-visible]:ring-4 has-[:focus-visible]:ring-primary-subtle',\n props.thumbClass\n )}\n >\n {(state) => (\n <Show when={props.valueLabel}>\n <span class=\"bg-popover text-popover-foreground absolute -top-6 left-1/2 -translate-x-1/2 rounded-sm border border-border px-1 text-2xs tabular-nums\">\n {state.thumbValue}\n </span>\n </Show>\n )}\n </SdkSliderThumb>\n )}\n </For>\n </SdkSliderTrack>\n </SdkSliderControl>\n {props.children}\n </SdkSlider>\n )\n}\n"],"mappings":";;;;;;AAkEA,IAAM,WAAW,UAA8B,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK;AAEpF,SAAgB,OAAO,OAAoB;CACzC,MAAM,OAAO,KACX,OACA,SACA,cACA,cACA,cACA,eACA,cACA,YACA,cACA,mBACA,SACA,gBACA,YACA,eACA,YACA,UACF;CACA,MAAM,eACJ,MAAM,KAAK,EAAE,SAAS,MAAM,SAAS,MAAM,gBAAgB,CAAC,CAAC,EAAA,CAAG,OAAO,IAAI,GAAG,UAAU,KAAK;CAE/F,OACEA,gBAAAA,UAAAA,WAAAA;EACE,aAAU;EACV,IAAA,QAAA;GAAO,OAAA,MAAM;EAAK;EAClB,IAAA,eAAA;GAAc,OAAA,MAAM,iBAAiB,MAAM,QAAQ,KAAA,IAAY,CAAC,CAAC;EAAE;EACnE,IAAA,MAAA;GAAK,OAAA,MAAM;EAAQ;EACnB,IAAA,MAAA;GAAK,OAAA,MAAM;EAAQ;EACnBC,gBAAgB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,OAAA,OAAA;UAFNE,OAAA,YACE;WAAC,OAAA,MAAM;UAAU,CACb;UAFN,OAAA;SAEM,EAAA,CAAA,IAHR,KAAA;QAIM,CAAA;OAEM,CAAA;MAEf,CAAA,CA9BN;KA+Be;;GACA;EACjBD,CAAAA,GAAAA,WAAAA;GAAM,OAAA,MAAA;EAAO,CAAA,CA3Cf;CA4CU,EAAA,CAAA,CAAA;AAEf"}
|
|
1
|
+
{"version":3,"file":"slider.js","names":["<SdkSlider\n data-slot=\"slider\"\n value={props.value}\n defaultValue={props.defaultValue ?? (props.value ? undefined : [0])}\n min={props.minValue}\n max={props.maxValue}\n onValueChange={(value) => props.onChange?.(toArray(value))}\n onValueCommit={(value) => props.onChangeEnd?.(toArray(value))}\n // A range names its group as well as each thumb; a single thumb is the\n // control, and carries the name itself.\n aria-label={props.thumbLabels ? props['aria-label'] : undefined}\n aria-labelledby={props.thumbLabels ? props['aria-labelledby'] : undefined}\n class={cn(\n 'relative flex touch-none flex-col justify-center select-none',\n 'data-[orientation=vertical]:h-full data-[orientation=vertical]:w-5 data-[orientation=horizontal]:w-full',\n 'data-[disabled]:opacity-50',\n props.class as string\n )}\n {...rest}\n >\n {/* Where presses land: the whole box around the thin track. */}\n <SdkSliderControl class=\"flex grow flex-col justify-center self-stretch\">\n <SdkSliderTrack\n class={cn(\n 'bg-input relative grow rounded-full',\n 'data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full',\n 'data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5',\n props.trackClass\n )}\n >\n <SdkSliderIndicator\n class={cn(\n 'bg-primary absolute rounded-full',\n 'data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full',\n props.rangeClass\n )}\n />\n <For each={thumbs()}>\n {(index) => (\n <SdkSliderThumb\n index={index}\n aria-label={props.thumbLabels?.[index] ?? props['aria-label']}\n aria-labelledby={props.thumbLabels?.[index] ? undefined : props['aria-labelledby']}\n class={cn(\n 'border-primary bg-background block size-4 shrink-0 rounded-full border-2 shadow-xs',\n 'transition-[color,box-shadow] ease-out outline-none',\n 'hover:ring-4 hover:ring-primary-subtle',\n 'has-[:focus-visible]:focus-outline',\n props.thumbClass\n )}\n >\n {(state) => (\n <Show when={props.valueLabel}>\n <span class=\"bg-popover text-popover-foreground absolute -top-6 left-1/2 -translate-x-1/2 rounded-sm border border-border px-1 text-2xs tabular-nums\">\n {state.thumbValue}\n </span>\n </Show>\n )}\n </SdkSliderThumb>\n )}\n </For>\n </SdkSliderTrack>\n </SdkSliderControl>\n {props.children}\n </SdkSlider>","onValueChange={(value) => props.onChange?.(toArray(value))}","onValueCommit={(value) => props.onChangeEnd?.(toArray(value))}","props.thumbLabels ? props['aria-label'] : undefined","props.thumbLabels ? props['aria-labelledby'] : undefined","<SdkSliderControl class=\"flex grow flex-col justify-center self-stretch\">\n <SdkSliderTrack\n class={cn(\n 'bg-input relative grow rounded-full',\n 'data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full',\n 'data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5',\n props.trackClass\n )}\n >\n <SdkSliderIndicator\n class={cn(\n 'bg-primary absolute rounded-full',\n 'data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full',\n props.rangeClass\n )}\n />\n <For each={thumbs()}>\n {(index) => (\n <SdkSliderThumb\n index={index}\n aria-label={props.thumbLabels?.[index] ?? props['aria-label']}\n aria-labelledby={props.thumbLabels?.[index] ? undefined : props['aria-labelledby']}\n class={cn(\n 'border-primary bg-background block size-4 shrink-0 rounded-full border-2 shadow-xs',\n 'transition-[color,box-shadow] ease-out outline-none',\n 'hover:ring-4 hover:ring-primary-subtle',\n 'has-[:focus-visible]:focus-outline',\n props.thumbClass\n )}\n >\n {(state) => (\n <Show when={props.valueLabel}>\n <span class=\"bg-popover text-popover-foreground absolute -top-6 left-1/2 -translate-x-1/2 rounded-sm border border-border px-1 text-2xs tabular-nums\">\n {state.thumbValue}\n </span>\n </Show>\n )}\n </SdkSliderThumb>\n )}\n </For>\n </SdkSliderTrack>\n </SdkSliderControl>","class=\"flex grow flex-col justify-center self-stretch\"","<SdkSliderTrack\n class={cn(\n 'bg-input relative grow rounded-full',\n 'data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full',\n 'data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5',\n props.trackClass\n )}\n >\n <SdkSliderIndicator\n class={cn(\n 'bg-primary absolute rounded-full',\n 'data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full',\n props.rangeClass\n )}\n />\n <For each={thumbs()}>\n {(index) => (\n <SdkSliderThumb\n index={index}\n aria-label={props.thumbLabels?.[index] ?? props['aria-label']}\n aria-labelledby={props.thumbLabels?.[index] ? undefined : props['aria-labelledby']}\n class={cn(\n 'border-primary bg-background block size-4 shrink-0 rounded-full border-2 shadow-xs',\n 'transition-[color,box-shadow] ease-out outline-none',\n 'hover:ring-4 hover:ring-primary-subtle',\n 'has-[:focus-visible]:focus-outline',\n props.thumbClass\n )}\n >\n {(state) => (\n <Show when={props.valueLabel}>\n <span class=\"bg-popover text-popover-foreground absolute -top-6 left-1/2 -translate-x-1/2 rounded-sm border border-border px-1 text-2xs tabular-nums\">\n {state.thumbValue}\n </span>\n </Show>\n )}\n </SdkSliderThumb>\n )}\n </For>\n </SdkSliderTrack>","<SdkSliderIndicator\n class={cn(\n 'bg-primary absolute rounded-full',\n 'data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full',\n props.rangeClass\n )}\n />","<For each={thumbs()}>\n {(index) => (\n <SdkSliderThumb\n index={index}\n aria-label={props.thumbLabels?.[index] ?? props['aria-label']}\n aria-labelledby={props.thumbLabels?.[index] ? undefined : props['aria-labelledby']}\n class={cn(\n 'border-primary bg-background block size-4 shrink-0 rounded-full border-2 shadow-xs',\n 'transition-[color,box-shadow] ease-out outline-none',\n 'hover:ring-4 hover:ring-primary-subtle',\n 'has-[:focus-visible]:focus-outline',\n props.thumbClass\n )}\n >\n {(state) => (\n <Show when={props.valueLabel}>\n <span class=\"bg-popover text-popover-foreground absolute -top-6 left-1/2 -translate-x-1/2 rounded-sm border border-border px-1 text-2xs tabular-nums\">\n {state.thumbValue}\n </span>\n </Show>\n )}\n </SdkSliderThumb>\n )}\n </For>","<SdkSliderThumb\n index={index}\n aria-label={props.thumbLabels?.[index] ?? props['aria-label']}\n aria-labelledby={props.thumbLabels?.[index] ? undefined : props['aria-labelledby']}\n class={cn(\n 'border-primary bg-background block size-4 shrink-0 rounded-full border-2 shadow-xs',\n 'transition-[color,box-shadow] ease-out outline-none',\n 'hover:ring-4 hover:ring-primary-subtle',\n 'has-[:focus-visible]:focus-outline',\n props.thumbClass\n )}\n >\n {(state) => (\n <Show when={props.valueLabel}>\n <span class=\"bg-popover text-popover-foreground absolute -top-6 left-1/2 -translate-x-1/2 rounded-sm border border-border px-1 text-2xs tabular-nums\">\n {state.thumbValue}\n </span>\n </Show>\n )}\n </SdkSliderThumb>","props.thumbLabels?.[index] ? undefined : props['aria-labelledby']","<Show when={props.valueLabel}>\n <span class=\"bg-popover text-popover-foreground absolute -top-6 left-1/2 -translate-x-1/2 rounded-sm border border-border px-1 text-2xs tabular-nums\">\n {state.thumbValue}\n </span>\n </Show>","props.children","_$insert"],"sources":["../../../../src/components/ui/slider/slider.tsx"],"sourcesContent":["import {\n Slider as SdkSlider,\n SliderControl as SdkSliderControl,\n SliderIndicator as SdkSliderIndicator,\n SliderThumb as SdkSliderThumb,\n SliderTrack as SdkSliderTrack,\n} from '@ui-sdk/solid/slider'\nimport type { ComponentProps, JSX } from '@solidjs/web'\nimport { For, Show, omit } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * Slider.\n *\n * For a value on a continuum where position matters more than precision, a\n * zoom, a volume, a threshold. When the number matters, pass `valueLabel` so\n * the value is both adjustable *and* readable; a bare slider is a control\n * nobody can set exactly.\n *\n * ui-sdk's Slider handles pointer capture, keyboard stepping and the ARIA\n * value wiring: each thumb holds a visually hidden native range input, which\n * is what takes focus, so the ring is drawn from `:has(:focus-visible)`. This\n * paints the track, fill and one thumb per value. The thumbs sit on the track,\n * which ui-sdk places them in, so the track does not clip its children; the\n * fill never leaves it, so nothing is drawn differently.\n *\n * A range submits one form value, `start/end`, under its `name`.\n */\ntype SdkSliderProps = ComponentProps<typeof SdkSlider>\n\n// `onChange` is omitted too: the DOM `onChange` the root's props carry would\n// otherwise intersect with the value callback below, and a plain\n// `(value: number[]) => void` handler would not type-check.\nexport type SliderProps = Omit<\n SdkSliderProps,\n | 'value'\n | 'defaultValue'\n | 'onValueChange'\n | 'onValueCommit'\n | 'onChange'\n | 'min'\n | 'max'\n | 'children'\n> & {\n /** One number per thumb, like `[20, 80]` for a range. Pass it to control the slider. */\n value?: number[]\n /** The values at first, when uncontrolled. A form reset returns to them. */\n defaultValue?: number[]\n /** Called on every step of a drag or a key, with one number per thumb. */\n onChange?: (value: number[]) => void\n /** Called once the interaction that changed the value ends: for saving. */\n onChangeEnd?: (value: number[]) => void\n /** The lowest value; 0 by default. */\n minValue?: number\n /** The highest value; 100 by default. */\n maxValue?: number\n /** Accessible names for individual thumbs, in value order (for example minimum and maximum). */\n thumbLabels?: readonly string[]\n trackClass?: string\n rangeClass?: string\n thumbClass?: string\n /** Show the current value beside the thumb while dragging. */\n valueLabel?: boolean\n children?: JSX.Element\n}\n\nconst toArray = (value: number | number[]) => (Array.isArray(value) ? value : [value])\n\nexport function Slider(props: SliderProps) {\n const rest = omit(\n props,\n 'class',\n 'trackClass',\n 'rangeClass',\n 'thumbClass',\n 'thumbLabels',\n 'valueLabel',\n 'children',\n 'aria-label',\n 'aria-labelledby',\n 'value',\n 'defaultValue',\n 'onChange',\n 'onChangeEnd',\n 'minValue',\n 'maxValue'\n )\n const thumbs = () =>\n Array.from({ length: (props.value ?? props.defaultValue ?? [0]).length }, (_, index) => index)\n\n return (\n <SdkSlider\n data-slot=\"slider\"\n value={props.value}\n defaultValue={props.defaultValue ?? (props.value ? undefined : [0])}\n min={props.minValue}\n max={props.maxValue}\n onValueChange={(value) => props.onChange?.(toArray(value))}\n onValueCommit={(value) => props.onChangeEnd?.(toArray(value))}\n // A range names its group as well as each thumb; a single thumb is the\n // control, and carries the name itself.\n aria-label={props.thumbLabels ? props['aria-label'] : undefined}\n aria-labelledby={props.thumbLabels ? props['aria-labelledby'] : undefined}\n class={cn(\n 'relative flex touch-none flex-col justify-center select-none',\n 'data-[orientation=vertical]:h-full data-[orientation=vertical]:w-5 data-[orientation=horizontal]:w-full',\n 'data-[disabled]:opacity-50',\n props.class as string\n )}\n {...rest}\n >\n {/* Where presses land: the whole box around the thin track. */}\n <SdkSliderControl class=\"flex grow flex-col justify-center self-stretch\">\n <SdkSliderTrack\n class={cn(\n 'bg-input relative grow rounded-full',\n 'data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full',\n 'data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5',\n props.trackClass\n )}\n >\n <SdkSliderIndicator\n class={cn(\n 'bg-primary absolute rounded-full',\n 'data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full',\n props.rangeClass\n )}\n />\n <For each={thumbs()}>\n {(index) => (\n <SdkSliderThumb\n index={index}\n aria-label={props.thumbLabels?.[index] ?? props['aria-label']}\n aria-labelledby={props.thumbLabels?.[index] ? undefined : props['aria-labelledby']}\n class={cn(\n 'border-primary bg-background block size-4 shrink-0 rounded-full border-2 shadow-xs',\n 'transition-[color,box-shadow] ease-out outline-none',\n 'hover:ring-4 hover:ring-primary-subtle',\n 'has-[:focus-visible]:focus-outline',\n props.thumbClass\n )}\n >\n {(state) => (\n <Show when={props.valueLabel}>\n <span class=\"bg-popover text-popover-foreground absolute -top-6 left-1/2 -translate-x-1/2 rounded-sm border border-border px-1 text-2xs tabular-nums\">\n {state.thumbValue}\n </span>\n </Show>\n )}\n </SdkSliderThumb>\n )}\n </For>\n </SdkSliderTrack>\n </SdkSliderControl>\n {props.children}\n </SdkSlider>\n )\n}\n"],"mappings":";;;;;;AAkEA,IAAM,W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MAOC,OAAA,CACCC,gBAAAA,iBAAAA,EACE,IAAA,UAAA;OAAO,OAAA,GACL,oCACA,2EACA,MAAM,UACR;MAAC,EACF,CAAA,GACDC,gBAAAA,KAAAA;OAAK,IAAA,OAAA;QAAM,OAAA,OAAO;OAAC;OAAnBA,WACI,UACAC,gBAAAA,aAAAA;QACS;QACP,IAAA,eAAA;SAAY,OAAA,MAAM,cAAc,UAAU,MAAM;QAAa;QAC7D,IAAA,oBAAA;SAAiBC,OAAAA,WAAAA;UAAM,OAAA,CAAA,CAAA,MAAA,cAAc;SAA4C,CAAA,CAAC,CAAD,IAAnC,KAAA,IAAY,MAAM;QAAkB;QAClF,IAAA,UAAA;SAAO,OAAA,GACL,sFACA,uDACA,0CACA,sCACA,MAAM,UACR;QAAC;QAVHD,WAYI,UACAE,WAAAA;;UAAY,OAAA,CAAA,CAAA,MAAM;SAIZ,CAAA,CAAC,CAAD,WAHJ;UAEM,IAAA,OAAA,OAAA;UAFNE,OAAA,YACE;WAAC,OAAA,MAAM;UAAU,CACb;UAFN,OAAA;SAEM,EAAA,CAAA,IAHR,KAAA;QAIM,CAAA;OAEM,CAAA;MAEf,CAAA,CA9BN;KA+Be;;GACA;EACjBD,CAAAA,GAAAA,WAAAA;GAAM,OAAA,MAAA;EAAO,CAAA,CA3Cf;CA4CU,EAAA,CAAA,CAAA;AAEf"}
|
|
@@ -7,7 +7,7 @@ var _tmpl$ = /* @__PURE__ */ template(`<div><input type=checkbox role=switch cla
|
|
|
7
7
|
var _tmpl$2 = /* @__PURE__ */ template(`<div class="grid gap-0.5"><!><!>`);
|
|
8
8
|
var _tmpl$3 = /* @__PURE__ */ template(`<label>`);
|
|
9
9
|
var _tmpl$4 = /* @__PURE__ */ template(`<div>`);
|
|
10
|
-
var switchControlClass = (className) => cn("bg-input inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent", "transition-colors ease-out outline-none", "peer-focus-visible:border-ring peer-focus-visible:
|
|
10
|
+
var switchControlClass = (className) => cn("bg-input inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent", "transition-colors ease-out outline-none", "peer-focus-visible:border-ring peer-focus-visible:focus-outline", "data-[checked]:bg-primary", "data-[invalid]:border-destructive", "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50", className);
|
|
11
11
|
var switchThumbClass = (className) => cn("bg-background pointer-events-none block size-4 rounded-full shadow-xs", "transition-transform ease-out", "data-[checked]:translate-x-4", className);
|
|
12
12
|
var flag = (on) => on ? "" : void 0;
|
|
13
13
|
var SwitchContext = createContext(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","names":["role=\"group\"","ref={(element) => {\n input = element\n }}","<SwitchContext value={context}>{props.children}</SwitchContext>","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 leading-none 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 leading-none 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 leading-none 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()}","aria-checked={checked() ? 'true' : 'false'}","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={switchControlClass(props.controlClass)}","class={switchThumbClass(props.thumbClass)}","id={inputId()}","<div\n data-slot=\"switch\"\n role=\"group\"\n id={rootId()}\n title={props.title}\n class={cn('group/switch relative flex items-center gap-2.5', props.class)}\n data-checked={dataChecked()}\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 {/* The name belongs on the input; see Checkbox for why. */}\n <input\n ref={(element) => {\n input = element\n }}\n type=\"checkbox\"\n role=\"switch\"\n class=\"peer sr-only\"\n id={inputId()}\n name={props.name ?? rootId()}\n value={props.value ?? 'on'}\n checked={checked()}\n aria-checked={checked() ? 'true' : 'false'}\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 onChange={(event) => {\n event.stopPropagation()\n // Controlled: the switch 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-invalid={dataInvalid()}\n data-disabled={dataDisabled()}\n class={switchControlClass(props.controlClass)}\n onClick={() => {\n setChecked(!checked())\n input?.focus({ preventScroll: true })\n }}\n >\n <div data-checked={dataChecked()} class={switchThumbClass(props.thumbClass)} />\n </div>\n {composed ? (\n <SwitchContext value={context}>{props.children}</SwitchContext>\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 leading-none 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={control.labelId}\n for={control.inputId()}\n data-checked={control.checked()}\n data-disabled={control.disabled()}\n class={cn('text-sm leading-none font-medium', props.class)}\n {...rest}\n />","<div\n id={control.descriptionId}\n data-checked={control.checked()}\n data-disabled={control.disabled()}\n class={cn('text-muted-foreground text-sm', props.class)}\n {...rest}\n />","resolveChildren","_$spread","_$ref","_$insert","_$setAttribute","_$effect","_$readShallow","_$className","_$setProperty"],"sources":["../../../../src/components/ui/switch/switch.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from '@solidjs/web'\nimport {\n children as resolveChildren,\n createContext,\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'\n\n/**\n * Switch.\n *\n * For a setting that takes effect the moment it is flipped. The distinction\n * from Checkbox is behaviour, not looks: a switch applies immediately and\n * belongs in a settings row, while a checkbox is a value the user is still\n * composing and is applied when a form is submitted. A switch inside an unsaved\n * form is the mistake this split exists to prevent.\n *\n * The value is a real hidden `role=\"switch\"` checkbox, so the control is\n * form-native, keyboard-operable, and its `aria-checked` follows the state the\n * user sees.\n */\nexport type SwitchProps = Omit<ComponentProps<'div'>, 'children' | 'onChange'> & {\n /** Whether it is on. Pass it to control the switch. */\n checked?: boolean\n /** Whether it starts on, when uncontrolled. A form reset returns to it. */\n defaultChecked?: boolean\n /** Called with the new state when the user flips it. */\n onChange?: (checked: boolean) => void\n /** The name the input submits under; without one, the root's id. */\n name?: string\n /** What the input submits while on; `on` by default. */\n value?: string\n required?: boolean\n disabled?: boolean\n readOnly?: boolean\n /** `'invalid'` marks the track and its input invalid. */\n validationState?: 'valid' | 'invalid'\n /** ID for the hidden native switch input; useful with an external label. */\n inputId?: string\n controlClass?: string\n thumbClass?: 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 `SwitchLabel` and\n * `SwitchDescription` yourself.\n */\n children?: JSX.Element\n}\n\nconst switchControlClass = (className?: string) =>\n cn(\n 'bg-input inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent',\n 'transition-colors 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',\n 'data-[invalid]:border-destructive',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n className\n )\n\nconst switchThumbClass = (className?: string) =>\n cn(\n 'bg-background pointer-events-none block size-4 rounded-full shadow-xs',\n 'transition-transform ease-out',\n 'data-[checked]:translate-x-4',\n className\n )\n\nconst flag = (on: boolean | undefined) => (on ? '' : undefined)\n\n/** What `SwitchLabel` and `SwitchDescription` need from their switch. */\ntype SwitchParts = {\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 SwitchContext = createContext<SwitchParts | null>(null)\n\n/**\n * Renders a native `role=\"switch\"` checkbox and its painted track directly,\n * for the same reason and with the same contract as `Checkbox`: ui-sdk's\n * Switch measured about 1 ms per instance in the unit DOM, against a few\n * hundredths of a millisecond here, and a settings page holds one per row.\n * `children` replace the label block and may use `SwitchLabel` and\n * `SwitchDescription`, which find the switch through a context.\n */\nexport function Switch(props: SwitchProps) {\n const rest = omit(\n props,\n 'class',\n 'controlClass',\n 'thumbClass',\n 'labelClass',\n 'descriptionClass',\n 'label',\n 'description',\n 'children',\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) ?? `switch-${uid}`\n const inputId = () => field?.id ?? props.inputId ?? `${rootId()}-input`\n const descriptionId = `switch-${uid}-description`\n const labelId = `switch-${uid}-label`\n // Derived from `defaultChecked`, so a new default restarts an uncontrolled switch.\n const [ownChecked, setOwnChecked] = createSignal(() => props.defaultChecked ?? false)\n const checked = () => props.checked ?? ownChecked()\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 ?? false\n const form = input?.form\n if (!form) return\n const reset = () => {\n setChecked(props.defaultChecked ?? false)\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\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 dataInvalid = () => flag(props.validationState === 'invalid')\n const dataDisabled = () => flag(props.disabled)\n const context: SwitchParts = {\n inputId,\n labelId,\n descriptionId,\n checked: dataChecked,\n disabled: dataDisabled,\n mount,\n }\n\n return (\n <div\n data-slot=\"switch\"\n role=\"group\"\n id={rootId()}\n title={props.title}\n class={cn('group/switch relative flex items-center gap-2.5', props.class)}\n data-checked={dataChecked()}\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 {/* The name belongs on the input; see Checkbox for why. */}\n <input\n ref={(element) => {\n input = element\n }}\n type=\"checkbox\"\n role=\"switch\"\n class=\"peer sr-only\"\n id={inputId()}\n name={props.name ?? rootId()}\n value={props.value ?? 'on'}\n checked={checked()}\n aria-checked={checked() ? 'true' : 'false'}\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 onChange={(event) => {\n event.stopPropagation()\n // Controlled: the switch 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-invalid={dataInvalid()}\n data-disabled={dataDisabled()}\n class={switchControlClass(props.controlClass)}\n onClick={() => {\n setChecked(!checked())\n input?.focus({ preventScroll: true })\n }}\n >\n <div data-checked={dataChecked()} class={switchThumbClass(props.thumbClass)} />\n </div>\n {composed ? (\n <SwitchContext value={context}>{props.children}</SwitchContext>\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 leading-none 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 useSwitchPart(name: string, part: 'label' | 'description') {\n const control = useContext(SwitchContext)\n if (!control) throw new Error(`<${name}> must be used inside <Switch>.`)\n onSettled(() => control.mount(part))\n return control\n}\n\n/**\n * The switch's own label. Valid only inside a `<Switch>`: it labels that\n * root's input, and outside one there is nothing to associate with.\n * A label drawn *beside* a switch — a settings row with the control trailing —\n * is plain text, and the switch takes an `aria-label` instead.\n */\nexport function SwitchLabel(props: ComponentProps<'label'>) {\n const control = useSwitchPart('SwitchLabel', 'label')\n const rest = omit(props, 'class')\n return (\n <label\n id={control.labelId}\n for={control.inputId()}\n data-checked={control.checked()}\n data-disabled={control.disabled()}\n class={cn('text-sm leading-none font-medium', props.class)}\n {...rest}\n />\n )\n}\n\nexport function SwitchDescription(props: ComponentProps<'div'>) {\n const control = useSwitchPart('SwitchDescription', 'description')\n const rest = omit(props, 'class')\n return (\n <div\n id={control.descriptionId}\n data-checked={control.checked()}\n data-disabled={control.disabled()}\n class={cn('text-muted-foreground text-sm', props.class)}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;AA4DA,IAAM,sBAAsB,cAC1B,GACE,6FACA,2CACA,mGACA,6BACA,qCACA,iEACA,SACF;AAEF,IAAM,oBAAoB,cACxB,GACE,yEACA,iCACA,gCACA,SACF;AAEF,IAAM,QAAQ,OAA6B,KAAK,KAAK,KAAA;AAarD,IAAM,gBAAgB,cAAkC,IAAI;;;;;;;;;AAU5D,SAAgB,OAAO,OAAoB;CACzC,MAAM,OAAO,KACX,OACA,SACA,gBACA,cACA,cACA,oBACA,SACA,eACA,YACA,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,UAAU;CAC9E,MAAM,gBAAgB,OAAO,MAAM,MAAM,WAAW,GAAG,OA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EAAa;EACzB,IAAA,iBAAA;GAAc,OAAA,QAAQ,QAAQ;EAAC;EAC/B,IAAA,kBAAA;GAAe,OAAA,QAAQ,SAAS;EAAC;EACjC,IAAA,UAAA;GAAO,OAAA,GAAG,iCAAiC,MAAM,KAAK;EAAC;CAC/C,GAAJ,IAAA,GAAA,KAAA;CANR,OACEF;AAQJ"}
|
|
1
|
+
{"version":3,"file":"switch.js","names":["role=\"group\"","ref={(element) => {\n input = element\n }}","<SwitchContext value={context}>{props.children}</SwitchContext>","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 leading-none 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 leading-none 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 leading-none 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()}","aria-checked={checked() ? 'true' : 'false'}","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={switchControlClass(props.controlClass)}","class={switchThumbClass(props.thumbClass)}","id={inputId()}","<div\n data-slot=\"switch\"\n role=\"group\"\n id={rootId()}\n title={props.title}\n class={cn('group/switch relative flex items-center gap-2.5', props.class)}\n data-checked={dataChecked()}\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 {/* The name belongs on the input; see Checkbox for why. */}\n <input\n ref={(element) => {\n input = element\n }}\n type=\"checkbox\"\n role=\"switch\"\n class=\"peer sr-only\"\n id={inputId()}\n name={props.name ?? rootId()}\n value={props.value ?? 'on'}\n checked={checked()}\n aria-checked={checked() ? 'true' : 'false'}\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 onChange={(event) => {\n event.stopPropagation()\n // Controlled: the switch 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-invalid={dataInvalid()}\n data-disabled={dataDisabled()}\n class={switchControlClass(props.controlClass)}\n onClick={() => {\n setChecked(!checked())\n input?.focus({ preventScroll: true })\n }}\n >\n <div data-checked={dataChecked()} class={switchThumbClass(props.thumbClass)} />\n </div>\n {composed ? (\n <SwitchContext value={context}>{props.children}</SwitchContext>\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 leading-none 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={control.labelId}\n for={control.inputId()}\n data-checked={control.checked()}\n data-disabled={control.disabled()}\n class={cn('text-sm leading-none font-medium', props.class)}\n {...rest}\n />","<div\n id={control.descriptionId}\n data-checked={control.checked()}\n data-disabled={control.disabled()}\n class={cn('text-muted-foreground text-sm', props.class)}\n {...rest}\n />","resolveChildren","_$spread","_$ref","_$insert","_$setAttribute","_$effect","_$readShallow","_$className","_$setProperty"],"sources":["../../../../src/components/ui/switch/switch.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from '@solidjs/web'\nimport {\n children as resolveChildren,\n createContext,\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'\n\n/**\n * Switch.\n *\n * For a setting that takes effect the moment it is flipped. The distinction\n * from Checkbox is behaviour, not looks: a switch applies immediately and\n * belongs in a settings row, while a checkbox is a value the user is still\n * composing and is applied when a form is submitted. A switch inside an unsaved\n * form is the mistake this split exists to prevent.\n *\n * The value is a real hidden `role=\"switch\"` checkbox, so the control is\n * form-native, keyboard-operable, and its `aria-checked` follows the state the\n * user sees.\n */\nexport type SwitchProps = Omit<ComponentProps<'div'>, 'children' | 'onChange'> & {\n /** Whether it is on. Pass it to control the switch. */\n checked?: boolean\n /** Whether it starts on, when uncontrolled. A form reset returns to it. */\n defaultChecked?: boolean\n /** Called with the new state when the user flips it. */\n onChange?: (checked: boolean) => void\n /** The name the input submits under; without one, the root's id. */\n name?: string\n /** What the input submits while on; `on` by default. */\n value?: string\n required?: boolean\n disabled?: boolean\n readOnly?: boolean\n /** `'invalid'` marks the track and its input invalid. */\n validationState?: 'valid' | 'invalid'\n /** ID for the hidden native switch input; useful with an external label. */\n inputId?: string\n controlClass?: string\n thumbClass?: 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 `SwitchLabel` and\n * `SwitchDescription` yourself.\n */\n children?: JSX.Element\n}\n\nconst switchControlClass = (className?: string) =>\n cn(\n 'bg-input inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent',\n 'transition-colors ease-out outline-none',\n 'peer-focus-visible:border-ring peer-focus-visible:focus-outline',\n 'data-[checked]:bg-primary',\n 'data-[invalid]:border-destructive',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n className\n )\n\nconst switchThumbClass = (className?: string) =>\n cn(\n 'bg-background pointer-events-none block size-4 rounded-full shadow-xs',\n 'transition-transform ease-out',\n 'data-[checked]:translate-x-4',\n className\n )\n\nconst flag = (on: boolean | undefined) => (on ? '' : undefined)\n\n/** What `SwitchLabel` and `SwitchDescription` need from their switch. */\ntype SwitchParts = {\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 SwitchContext = createContext<SwitchParts | null>(null)\n\n/**\n * Renders a native `role=\"switch\"` checkbox and its painted track directly,\n * for the same reason and with the same contract as `Checkbox`: ui-sdk's\n * Switch measured about 1 ms per instance in the unit DOM, against a few\n * hundredths of a millisecond here, and a settings page holds one per row.\n * `children` replace the label block and may use `SwitchLabel` and\n * `SwitchDescription`, which find the switch through a context.\n */\nexport function Switch(props: SwitchProps) {\n const rest = omit(\n props,\n 'class',\n 'controlClass',\n 'thumbClass',\n 'labelClass',\n 'descriptionClass',\n 'label',\n 'description',\n 'children',\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) ?? `switch-${uid}`\n const inputId = () => field?.id ?? props.inputId ?? `${rootId()}-input`\n const descriptionId = `switch-${uid}-description`\n const labelId = `switch-${uid}-label`\n // Derived from `defaultChecked`, so a new default restarts an uncontrolled switch.\n const [ownChecked, setOwnChecked] = createSignal(() => props.defaultChecked ?? false)\n const checked = () => props.checked ?? ownChecked()\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 ?? false\n const form = input?.form\n if (!form) return\n const reset = () => {\n setChecked(props.defaultChecked ?? false)\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\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 dataInvalid = () => flag(props.validationState === 'invalid')\n const dataDisabled = () => flag(props.disabled)\n const context: SwitchParts = {\n inputId,\n labelId,\n descriptionId,\n checked: dataChecked,\n disabled: dataDisabled,\n mount,\n }\n\n return (\n <div\n data-slot=\"switch\"\n role=\"group\"\n id={rootId()}\n title={props.title}\n class={cn('group/switch relative flex items-center gap-2.5', props.class)}\n data-checked={dataChecked()}\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 {/* The name belongs on the input; see Checkbox for why. */}\n <input\n ref={(element) => {\n input = element\n }}\n type=\"checkbox\"\n role=\"switch\"\n class=\"peer sr-only\"\n id={inputId()}\n name={props.name ?? rootId()}\n value={props.value ?? 'on'}\n checked={checked()}\n aria-checked={checked() ? 'true' : 'false'}\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 onChange={(event) => {\n event.stopPropagation()\n // Controlled: the switch 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-invalid={dataInvalid()}\n data-disabled={dataDisabled()}\n class={switchControlClass(props.controlClass)}\n onClick={() => {\n setChecked(!checked())\n input?.focus({ preventScroll: true })\n }}\n >\n <div data-checked={dataChecked()} class={switchThumbClass(props.thumbClass)} />\n </div>\n {composed ? (\n <SwitchContext value={context}>{props.children}</SwitchContext>\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 leading-none 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 useSwitchPart(name: string, part: 'label' | 'description') {\n const control = useContext(SwitchContext)\n if (!control) throw new Error(`<${name}> must be used inside <Switch>.`)\n onSettled(() => control.mount(part))\n return control\n}\n\n/**\n * The switch's own label. Valid only inside a `<Switch>`: it labels that\n * root's input, and outside one there is nothing to associate with.\n * A label drawn *beside* a switch — a settings row with the control trailing —\n * is plain text, and the switch takes an `aria-label` instead.\n */\nexport function SwitchLabel(props: ComponentProps<'label'>) {\n const control = useSwitchPart('SwitchLabel', 'label')\n const rest = omit(props, 'class')\n return (\n <label\n id={control.labelId}\n for={control.inputId()}\n data-checked={control.checked()}\n data-disabled={control.disabled()}\n class={cn('text-sm leading-none font-medium', props.class)}\n {...rest}\n />\n )\n}\n\nexport function SwitchDescription(props: ComponentProps<'div'>) {\n const control = useSwitchPart('SwitchDescription', 'description')\n const rest = omit(props, 'class')\n return (\n <div\n id={control.descriptionId}\n data-checked={control.checked()}\n data-disabled={control.disabled()}\n class={cn('text-muted-foreground text-sm', props.class)}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;AA4DA,IAAM,sBAAsB,cAC1B,GACE,6FACA,2CACA,mEACA,6BACA,qCACA,iEACA,SACF;AAEF,IAAM,oBAAoB,cACxB,GACE,yEACA,iCACA,gCACA,SACF;AAEF,IAAM,QAAQ,OAA6B,KAAK,KAAK,KAAA;AAarD,IAAM,gBAAgB,cAAkC,IAAI;;;;;;;;;AAU5D,SAAgB,OAAO,OAAoB;CACzC,MAAM,OAAO,KACX,OACA,SACA,gBACA,cACA,cACA,oBACA,SACA,eACA,YACA,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,UAAU;CAC9E,MAAM,gBAAgB,OAAO,MAAM,MAAM,WAAW,GAAG,OAAO,EAAE;CAChE,MAAM,gBAAgB,UAAU,IAAI;CACpC,MAAM,UAAU,UAAU,IAAI;CAE9B,MAAM,CAAC,YAAY,iBAAiB,mBAAmB,MAAM,kBAAkB,KAAK;CACpF,MAAM,gBAAgB,MAAM,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AAK;EAAC;CAC/C,GAAJ,IAAA,GAAA,KAAA;CANR,OACEF;AAQJ"}
|
|
@@ -121,7 +121,7 @@ function TabsTrigger(props) {
|
|
|
121
121
|
return rest.value;
|
|
122
122
|
},
|
|
123
123
|
get "class"() {
|
|
124
|
-
return cn("inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap text-sm font-medium", "transition-colors ease-out outline-none select-none", "focus-visible:border-ring focus-visible:
|
|
124
|
+
return cn("inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap text-sm font-medium", "transition-colors ease-out outline-none select-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", "text-foreground", "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4", local.appearance === "segmented" ? "h-control-sm rounded-md px-control-sm data-[selected]:bg-primary-subtle data-[selected]:text-foreground" : tabs.orientation() === "vertical" ? "h-control-md justify-start rounded-none border-s-2 border-transparent ps-3 pe-2 data-[selected]:border-primary" : "h-control-md -mb-px rounded-none border-b-2 border-transparent px-2 pb-2 data-[selected]:border-primary", local.class);
|
|
125
125
|
}
|
|
126
126
|
}, rest));
|
|
127
127
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","names":["<TabsIdContext value={tabs}>\n <SdkTabs\n data-slot=\"tabs\"\n id={id()}\n value={local.value}\n defaultValue={local.defaultValue}\n onValueChange={(value) => {\n if (value !== null) local.onChange?.(value)\n }}\n activation={local.activationMode}\n class={cn(\n 'flex min-h-0 min-w-0 flex-col gap-2 data-[orientation=vertical]:flex-row',\n local.class as string\n )}\n {...rest}\n />\n </TabsIdContext>","value={tabs}","<SdkTabs\n data-slot=\"tabs\"\n id={id()}\n value={local.value}\n defaultValue={local.defaultValue}\n onValueChange={(value) => {\n if (value !== null) local.onChange?.(value)\n }}\n activation={local.activationMode}\n class={cn(\n 'flex min-h-0 min-w-0 flex-col gap-2 data-[orientation=vertical]:flex-row',\n local.class as string\n )}\n {...rest}\n />","onValueChange={(value) => {\n if (value !== null) local.onChange?.(value)\n }}","<SdkTabsList\n data-slot=\"tabs-list\"\n class={cn(\n 'shrink-0 items-center',\n local.fill || local.scrollable\n ? 'flex w-full justify-start'\n : 'inline-flex w-fit justify-center',\n local.scrollable && 'no-scrollbar overflow-x-auto overflow-y-hidden',\n !underline()\n ? 'gap-0.5 rounded-lg bg-surface-hover p-0.5'\n : local.scrollable\n ? 'gap-1 rounded-none pb-px shadow-[inset_0_-1px_0_var(--border)] data-[orientation=vertical]:pb-0 data-[orientation=vertical]:shadow-none'\n : 'gap-1 rounded-none border-b border-border data-[orientation=vertical]:border-b-0',\n 'data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch',\n local.class as string\n )}\n {...rest}\n />","<SdkTabsTab\n // ui-sdk keeps a part's own `data-slot`; the trigger keeps its public one.\n render={(tabProps) => <button {...tabProps} data-slot=\"tabs-trigger\" />}\n id={triggerId()}\n // The value as a hook for hosts and tests, as Kobalte's tab carried it.\n data-key={rest.value}\n class={cn(\n 'inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap text-sm font-medium',\n 'transition-colors ease-out outline-none select-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'disabled:pointer-events-none disabled:opacity-50',\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n 'text-foreground',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4',\n local.appearance === 'segmented'\n ? 'h-control-sm rounded-md px-control-sm data-[selected]:bg-primary-subtle data-[selected]:text-foreground'\n : tabs.orientation() === 'vertical'\n ? 'h-control-md justify-start rounded-none border-s-2 border-transparent ps-3 pe-2 data-[selected]:border-primary'\n : 'h-control-md -mb-px rounded-none border-b-2 border-transparent px-2 pb-2 data-[selected]:border-primary',\n local.class as string\n )}\n {...rest}\n />","render={(tabProps) => <button {...tabProps} data-slot=\"tabs-trigger\" />}","<SdkTabsPanel\n render={(panelProps) => <div {...panelProps} data-slot=\"tabs-content\" />}\n keepMounted={local.forceMount}\n // Panel ids stay `<tabs id>-content-<value>`, as they were on Kobalte, so a host can\n // point at a panel by its tabs' id. ui-sdk adopts an authored id and points the\n // tab's `aria-controls` at it.\n id={local.id ?? `${tabs.id()}-content-${rest.value}`}\n aria-labelledby={\n local['aria-labelledby'] ??\n tabs.triggerIds().get(rest.value) ??\n `${tabs.id()}-trigger-${rest.value}`\n }\n class={cn('min-h-0 min-w-0 flex-1 outline-none', local.class as string)}\n {...rest}\n />","render={(panelProps) => <div {...panelProps} data-slot=\"tabs-content\" />}","_$spread"],"sources":["../../../../src/components/ui/tabs/tabs.tsx"],"sourcesContent":["import {\n Tabs as SdkTabs,\n TabsList as SdkTabsList,\n TabsPanel as SdkTabsPanel,\n TabsTab as SdkTabsTab,\n} from '@ui-sdk/solid/tabs'\nimport type { Accessor } from 'solid-js'\nimport type { ComponentProps, JSX } from '@solidjs/web'\nimport {\n createContext,\n createRenderEffect,\n createSignal,\n createUniqueId,\n omit,\n useContext,\n} from 'solid-js'\nimport { cn } from '#lib/utils'\n\ntype TabsIdContextValue = {\n id: Accessor<string>\n orientation: Accessor<'horizontal' | 'vertical'>\n triggerIds: Accessor<ReadonlyMap<string, string>>\n registerTriggerId: (value: string, id: string) => void\n unregisterTriggerId: (value: string, id: string) => void\n}\n\nconst TabsIdContext = createContext<TabsIdContextValue>()\n\nfunction useTabsId() {\n const tabs = useContext(TabsIdContext)\n if (!tabs) throw new Error('[adea-ui]: Tabs parts must be used within Tabs.')\n return tabs\n}\n\n/**\n * Tabs.\n *\n * For switching between sibling views of the *same* subject, a file's code,\n * diff and history. Not for moving between pages: a tab is expected to keep\n * its panel and its scroll position, which a route does not.\n *\n * `appearance=\"segmented\"` gives the joined bar KiroCrew uses inside a pane\n * where a full-width underline would collide with the panel's own header rule.\n *\n * Built on ui-sdk's Tabs: one tab stop for the list, arrow keys between tabs\n * (selecting as they move unless `activationMode=\"manual\"`), and the\n * tab/tabpanel ARIA wiring. Trigger ids stay `<tabs id>-trigger-<value>`, so a\n * panel can name its tab even while that tab is not rendered.\n */\nexport type TabsProps = Omit<\n ComponentProps<typeof SdkTabs>,\n 'value' | 'defaultValue' | 'onValueChange' | 'onChange' | 'activation'\n> & {\n /** The selected tab's value. Pass it to control the tabs. */\n value?: string\n /** The tab selected at first; the first enabled tab otherwise. */\n defaultValue?: string\n /** Called with the newly selected tab's value. */\n onChange?: (value: string) => void\n /** `manual` waits for Enter or Space before selecting a focused tab. */\n activationMode?: 'automatic' | 'manual'\n}\n\nexport function Tabs(props: TabsProps) {\n const local = props\n const rest = omit(props, 'class', 'id', 'value', 'defaultValue', 'onChange', 'activationMode')\n const generatedId = `tabs-${createUniqueId()}`\n const id = () => local.id || generatedId\n // `ownedWrite`: each trigger registers its id while it renders (see\n // TabsTrigger), so a panel names its tab in the first render, the server's\n // included. Only the panels' `aria-labelledby` reads it.\n const [triggerIds, setTriggerIds] = createSignal<ReadonlyMap<string, string>>(new Map(), {\n ownedWrite: true,\n })\n const tabs: TabsIdContextValue = {\n id,\n orientation: () => local.orientation ?? 'horizontal',\n triggerIds,\n registerTriggerId: (value, triggerId) => {\n setTriggerIds((current) => new Map(current).set(value, triggerId))\n },\n unregisterTriggerId: (value, triggerId) => {\n setTriggerIds((current) => {\n if (current.get(value) !== triggerId) return current\n const next = new Map(current)\n next.delete(value)\n return next\n })\n },\n }\n\n return (\n <TabsIdContext value={tabs}>\n <SdkTabs\n data-slot=\"tabs\"\n id={id()}\n value={local.value}\n defaultValue={local.defaultValue}\n onValueChange={(value) => {\n if (value !== null) local.onChange?.(value)\n }}\n activation={local.activationMode}\n class={cn(\n 'flex min-h-0 min-w-0 flex-col gap-2 data-[orientation=vertical]:flex-row',\n local.class as string\n )}\n {...rest}\n />\n </TabsIdContext>\n )\n}\n\nexport type TabsListProps = ComponentProps<typeof SdkTabsList> & {\n appearance?: 'underline' | 'segmented'\n /**\n * Span the container, with the triggers at the start. For a row of tabs that\n * heads a pane: the underline's rule then runs the pane's full width, the\n * way the pane's other header rules do, instead of stopping at the last tab.\n */\n fill?: boolean\n /**\n * Scroll sideways when the triggers outgrow the row, with no visible\n * scrollbar, instead of overflowing it. Implies `fill`. The underline's rule\n * is drawn inside the scroller so the selected mark still sits on it.\n */\n scrollable?: boolean\n}\n\n/**\n * The underline appearance's rule is the baseline a horizontal row of tabs sits\n * on. A vertical list has no baseline, its triggers stack, so the rule is\n * dropped there; otherwise it draws as a stray line under the last trigger,\n * spanning only the list's width (the SettingsLayout rail showed exactly that).\n *\n * A scrolling list cannot draw that rule as its border: a scroller clips at its\n * padding edge, and the selected trigger's mark overlaps the border by a pixel\n * (`-mb-px`), so the mark would be cut off and the list would scroll vertically\n * by that pixel. It reserves the pixel as padding instead and paints the rule\n * there with an inset shadow, which lands exactly where the border was.\n */\nexport function TabsList(props: TabsListProps) {\n const local = props\n const rest = omit(props, 'class', 'appearance', 'fill', 'scrollable')\n const underline = () => local.appearance !== 'segmented'\n\n return (\n <SdkTabsList\n data-slot=\"tabs-list\"\n class={cn(\n 'shrink-0 items-center',\n local.fill || local.scrollable\n ? 'flex w-full justify-start'\n : 'inline-flex w-fit justify-center',\n local.scrollable && 'no-scrollbar overflow-x-auto overflow-y-hidden',\n !underline()\n ? 'gap-0.5 rounded-lg bg-surface-hover p-0.5'\n : local.scrollable\n ? 'gap-1 rounded-none pb-px shadow-[inset_0_-1px_0_var(--border)] data-[orientation=vertical]:pb-0 data-[orientation=vertical]:shadow-none'\n : 'gap-1 rounded-none border-b border-border data-[orientation=vertical]:border-b-0',\n 'data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch',\n local.class as string\n )}\n {...rest}\n />\n )\n}\n\nexport type TabsTriggerProps = ComponentProps<typeof SdkTabsTab> & {\n appearance?: 'underline' | 'segmented'\n}\n\n/**\n * The underline appearance marks the selected trigger on the edge it shares\n * with the list's axis. A horizontal row reads left to right along a baseline,\n * so the mark is a bottom bar sitting on the list's rule. A vertical list stacks\n * its triggers, and a bottom bar there underlines one row of a column, it reads\n * as a divider, not a selection, so the mark moves to the inline-start edge,\n * the leading bar a side navigation uses, and the label aligns to that edge.\n *\n * The orientation is read from the root rather than from a `data-orientation`\n * selector so the vertical classes are unprefixed: a composite that replaces the\n * mark (SettingsNavigation's filled row passes `border-0`) then overrides it\n * through the ordinary class merge instead of fighting a variant-scoped border.\n *\n * A disabled tab stays focusable, as the tabs pattern asks, so it is\n * `aria-disabled` rather than `:disabled`; `data-[disabled]` repeats the\n * disabled look for it.\n */\nexport function TabsTrigger(props: TabsTriggerProps) {\n const local = props\n const rest = omit(props, 'class', 'appearance', 'id')\n const tabs = useTabsId()\n const triggerId = () => local.id || `${tabs.id()}-trigger-${rest.value}`\n\n // Register before panels render, including SSR where createEffect is skipped.\n createRenderEffect(\n () => [rest.value, triggerId()] as const,\n ([value, id]) => {\n tabs.registerTriggerId(value, id)\n return () => tabs.unregisterTriggerId(value, id)\n }\n )\n\n return (\n <SdkTabsTab\n // ui-sdk keeps a part's own `data-slot`; the trigger keeps its public one.\n render={(tabProps) => <button {...tabProps} data-slot=\"tabs-trigger\" />}\n id={triggerId()}\n // The value as a hook for hosts and tests, as Kobalte's tab carried it.\n data-key={rest.value}\n class={cn(\n 'inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap text-sm font-medium',\n 'transition-colors ease-out outline-none select-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'disabled:pointer-events-none disabled:opacity-50',\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n 'text-foreground',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4',\n local.appearance === 'segmented'\n ? 'h-control-sm rounded-md px-control-sm data-[selected]:bg-primary-subtle data-[selected]:text-foreground'\n : tabs.orientation() === 'vertical'\n ? 'h-control-md justify-start rounded-none border-s-2 border-transparent ps-3 pe-2 data-[selected]:border-primary'\n : 'h-control-md -mb-px rounded-none border-b-2 border-transparent px-2 pb-2 data-[selected]:border-primary',\n local.class as string\n )}\n {...rest}\n />\n )\n}\n\nexport type TabsContentProps = ComponentProps<typeof SdkTabsPanel> & {\n /** Keeps the panel in the page, hidden, while its tab is not selected. */\n forceMount?: boolean\n children?: JSX.Element\n}\n\nexport function TabsContent(props: TabsContentProps) {\n const local = props\n const rest = omit(props, 'class', 'id', 'aria-labelledby', 'forceMount')\n const tabs = useTabsId()\n return (\n <SdkTabsPanel\n render={(panelProps) => <div {...panelProps} data-slot=\"tabs-content\" />}\n keepMounted={local.forceMount}\n // Panel ids stay `<tabs id>-content-<value>`, as they were on Kobalte, so a host can\n // point at a panel by its tabs' id. ui-sdk adopts an authored id and points the\n // tab's `aria-controls` at it.\n id={local.id ?? `${tabs.id()}-content-${rest.value}`}\n aria-labelledby={\n local['aria-labelledby'] ??\n tabs.triggerIds().get(rest.value) ??\n `${tabs.id()}-trigger-${rest.value}`\n }\n class={cn('min-h-0 min-w-0 flex-1 outline-none', local.class as string)}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;AA0BA,IAAM,gBAAgB,cAAkC;AAExD,SAAS,YAAY;CACnB,MAAM,OAAO,WAAW,aAAa;CACrC,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,iDAAiD;CAC5E,OAAO;AACT;AA+BA,SAAgB,KAAK,OAAkB;CACrC,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,SAAS,MAAM,SAAS,gBAAgB,YAAY,gBAAgB;CAC7F,MAAM,cAAc,QAAQ,eAAe;CAC3C,MAAM,WAAW,MAAM,MAAM;CAI7B,MAAM,CAAC,YAAY,iBAAiB,6BAA0C,IAAI,IAAI,GAAG,EACvF,YAAY,KACd,CAAC;CAkBD,OACEA,gBAAAA,eAAAA;EAAeC,OAAO;GAjBtB;GACA,mBAAmB,MAAM,eAAe;GACxC;GACA,oBAAoB,OAAO,cAAc;IACvC,eAAe,YAAY,I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C;CAExE,GADK,IACL,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"tabs.js","names":["<TabsIdContext value={tabs}>\n <SdkTabs\n data-slot=\"tabs\"\n id={id()}\n value={local.value}\n defaultValue={local.defaultValue}\n onValueChange={(value) => {\n if (value !== null) local.onChange?.(value)\n }}\n activation={local.activationMode}\n class={cn(\n 'flex min-h-0 min-w-0 flex-col gap-2 data-[orientation=vertical]:flex-row',\n local.class as string\n )}\n {...rest}\n />\n </TabsIdContext>","value={tabs}","<SdkTabs\n data-slot=\"tabs\"\n id={id()}\n value={local.value}\n defaultValue={local.defaultValue}\n onValueChange={(value) => {\n if (value !== null) local.onChange?.(value)\n }}\n activation={local.activationMode}\n class={cn(\n 'flex min-h-0 min-w-0 flex-col gap-2 data-[orientation=vertical]:flex-row',\n local.class as string\n )}\n {...rest}\n />","onValueChange={(value) => {\n if (value !== null) local.onChange?.(value)\n }}","<SdkTabsList\n data-slot=\"tabs-list\"\n class={cn(\n 'shrink-0 items-center',\n local.fill || local.scrollable\n ? 'flex w-full justify-start'\n : 'inline-flex w-fit justify-center',\n local.scrollable && 'no-scrollbar overflow-x-auto overflow-y-hidden',\n !underline()\n ? 'gap-0.5 rounded-lg bg-surface-hover p-0.5'\n : local.scrollable\n ? 'gap-1 rounded-none pb-px shadow-[inset_0_-1px_0_var(--border)] data-[orientation=vertical]:pb-0 data-[orientation=vertical]:shadow-none'\n : 'gap-1 rounded-none border-b border-border data-[orientation=vertical]:border-b-0',\n 'data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch',\n local.class as string\n )}\n {...rest}\n />","<SdkTabsTab\n // ui-sdk keeps a part's own `data-slot`; the trigger keeps its public one.\n render={(tabProps) => <button {...tabProps} data-slot=\"tabs-trigger\" />}\n id={triggerId()}\n // The value as a hook for hosts and tests, as Kobalte's tab carried it.\n data-key={rest.value}\n class={cn(\n 'inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap text-sm font-medium',\n 'transition-colors ease-out outline-none select-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 'text-foreground',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4',\n local.appearance === 'segmented'\n ? 'h-control-sm rounded-md px-control-sm data-[selected]:bg-primary-subtle data-[selected]:text-foreground'\n : tabs.orientation() === 'vertical'\n ? 'h-control-md justify-start rounded-none border-s-2 border-transparent ps-3 pe-2 data-[selected]:border-primary'\n : 'h-control-md -mb-px rounded-none border-b-2 border-transparent px-2 pb-2 data-[selected]:border-primary',\n local.class as string\n )}\n {...rest}\n />","render={(tabProps) => <button {...tabProps} data-slot=\"tabs-trigger\" />}","<SdkTabsPanel\n render={(panelProps) => <div {...panelProps} data-slot=\"tabs-content\" />}\n keepMounted={local.forceMount}\n // Panel ids stay `<tabs id>-content-<value>`, as they were on Kobalte, so a host can\n // point at a panel by its tabs' id. ui-sdk adopts an authored id and points the\n // tab's `aria-controls` at it.\n id={local.id ?? `${tabs.id()}-content-${rest.value}`}\n aria-labelledby={\n local['aria-labelledby'] ??\n tabs.triggerIds().get(rest.value) ??\n `${tabs.id()}-trigger-${rest.value}`\n }\n class={cn('min-h-0 min-w-0 flex-1 outline-none', local.class as string)}\n {...rest}\n />","render={(panelProps) => <div {...panelProps} data-slot=\"tabs-content\" />}","_$spread"],"sources":["../../../../src/components/ui/tabs/tabs.tsx"],"sourcesContent":["import {\n Tabs as SdkTabs,\n TabsList as SdkTabsList,\n TabsPanel as SdkTabsPanel,\n TabsTab as SdkTabsTab,\n} from '@ui-sdk/solid/tabs'\nimport type { Accessor } from 'solid-js'\nimport type { ComponentProps, JSX } from '@solidjs/web'\nimport {\n createContext,\n createRenderEffect,\n createSignal,\n createUniqueId,\n omit,\n useContext,\n} from 'solid-js'\nimport { cn } from '#lib/utils'\n\ntype TabsIdContextValue = {\n id: Accessor<string>\n orientation: Accessor<'horizontal' | 'vertical'>\n triggerIds: Accessor<ReadonlyMap<string, string>>\n registerTriggerId: (value: string, id: string) => void\n unregisterTriggerId: (value: string, id: string) => void\n}\n\nconst TabsIdContext = createContext<TabsIdContextValue>()\n\nfunction useTabsId() {\n const tabs = useContext(TabsIdContext)\n if (!tabs) throw new Error('[adea-ui]: Tabs parts must be used within Tabs.')\n return tabs\n}\n\n/**\n * Tabs.\n *\n * For switching between sibling views of the *same* subject, a file's code,\n * diff and history. Not for moving between pages: a tab is expected to keep\n * its panel and its scroll position, which a route does not.\n *\n * `appearance=\"segmented\"` gives the joined bar KiroCrew uses inside a pane\n * where a full-width underline would collide with the panel's own header rule.\n *\n * Built on ui-sdk's Tabs: one tab stop for the list, arrow keys between tabs\n * (selecting as they move unless `activationMode=\"manual\"`), and the\n * tab/tabpanel ARIA wiring. Trigger ids stay `<tabs id>-trigger-<value>`, so a\n * panel can name its tab even while that tab is not rendered.\n */\nexport type TabsProps = Omit<\n ComponentProps<typeof SdkTabs>,\n 'value' | 'defaultValue' | 'onValueChange' | 'onChange' | 'activation'\n> & {\n /** The selected tab's value. Pass it to control the tabs. */\n value?: string\n /** The tab selected at first; the first enabled tab otherwise. */\n defaultValue?: string\n /** Called with the newly selected tab's value. */\n onChange?: (value: string) => void\n /** `manual` waits for Enter or Space before selecting a focused tab. */\n activationMode?: 'automatic' | 'manual'\n}\n\nexport function Tabs(props: TabsProps) {\n const local = props\n const rest = omit(props, 'class', 'id', 'value', 'defaultValue', 'onChange', 'activationMode')\n const generatedId = `tabs-${createUniqueId()}`\n const id = () => local.id || generatedId\n // `ownedWrite`: each trigger registers its id while it renders (see\n // TabsTrigger), so a panel names its tab in the first render, the server's\n // included. Only the panels' `aria-labelledby` reads it.\n const [triggerIds, setTriggerIds] = createSignal<ReadonlyMap<string, string>>(new Map(), {\n ownedWrite: true,\n })\n const tabs: TabsIdContextValue = {\n id,\n orientation: () => local.orientation ?? 'horizontal',\n triggerIds,\n registerTriggerId: (value, triggerId) => {\n setTriggerIds((current) => new Map(current).set(value, triggerId))\n },\n unregisterTriggerId: (value, triggerId) => {\n setTriggerIds((current) => {\n if (current.get(value) !== triggerId) return current\n const next = new Map(current)\n next.delete(value)\n return next\n })\n },\n }\n\n return (\n <TabsIdContext value={tabs}>\n <SdkTabs\n data-slot=\"tabs\"\n id={id()}\n value={local.value}\n defaultValue={local.defaultValue}\n onValueChange={(value) => {\n if (value !== null) local.onChange?.(value)\n }}\n activation={local.activationMode}\n class={cn(\n 'flex min-h-0 min-w-0 flex-col gap-2 data-[orientation=vertical]:flex-row',\n local.class as string\n )}\n {...rest}\n />\n </TabsIdContext>\n )\n}\n\nexport type TabsListProps = ComponentProps<typeof SdkTabsList> & {\n appearance?: 'underline' | 'segmented'\n /**\n * Span the container, with the triggers at the start. For a row of tabs that\n * heads a pane: the underline's rule then runs the pane's full width, the\n * way the pane's other header rules do, instead of stopping at the last tab.\n */\n fill?: boolean\n /**\n * Scroll sideways when the triggers outgrow the row, with no visible\n * scrollbar, instead of overflowing it. Implies `fill`. The underline's rule\n * is drawn inside the scroller so the selected mark still sits on it.\n */\n scrollable?: boolean\n}\n\n/**\n * The underline appearance's rule is the baseline a horizontal row of tabs sits\n * on. A vertical list has no baseline, its triggers stack, so the rule is\n * dropped there; otherwise it draws as a stray line under the last trigger,\n * spanning only the list's width (the SettingsLayout rail showed exactly that).\n *\n * A scrolling list cannot draw that rule as its border: a scroller clips at its\n * padding edge, and the selected trigger's mark overlaps the border by a pixel\n * (`-mb-px`), so the mark would be cut off and the list would scroll vertically\n * by that pixel. It reserves the pixel as padding instead and paints the rule\n * there with an inset shadow, which lands exactly where the border was.\n */\nexport function TabsList(props: TabsListProps) {\n const local = props\n const rest = omit(props, 'class', 'appearance', 'fill', 'scrollable')\n const underline = () => local.appearance !== 'segmented'\n\n return (\n <SdkTabsList\n data-slot=\"tabs-list\"\n class={cn(\n 'shrink-0 items-center',\n local.fill || local.scrollable\n ? 'flex w-full justify-start'\n : 'inline-flex w-fit justify-center',\n local.scrollable && 'no-scrollbar overflow-x-auto overflow-y-hidden',\n !underline()\n ? 'gap-0.5 rounded-lg bg-surface-hover p-0.5'\n : local.scrollable\n ? 'gap-1 rounded-none pb-px shadow-[inset_0_-1px_0_var(--border)] data-[orientation=vertical]:pb-0 data-[orientation=vertical]:shadow-none'\n : 'gap-1 rounded-none border-b border-border data-[orientation=vertical]:border-b-0',\n 'data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch',\n local.class as string\n )}\n {...rest}\n />\n )\n}\n\nexport type TabsTriggerProps = ComponentProps<typeof SdkTabsTab> & {\n appearance?: 'underline' | 'segmented'\n}\n\n/**\n * The underline appearance marks the selected trigger on the edge it shares\n * with the list's axis. A horizontal row reads left to right along a baseline,\n * so the mark is a bottom bar sitting on the list's rule. A vertical list stacks\n * its triggers, and a bottom bar there underlines one row of a column, it reads\n * as a divider, not a selection, so the mark moves to the inline-start edge,\n * the leading bar a side navigation uses, and the label aligns to that edge.\n *\n * The orientation is read from the root rather than from a `data-orientation`\n * selector so the vertical classes are unprefixed: a composite that replaces the\n * mark (SettingsNavigation's filled row passes `border-0`) then overrides it\n * through the ordinary class merge instead of fighting a variant-scoped border.\n *\n * A disabled tab stays focusable, as the tabs pattern asks, so it is\n * `aria-disabled` rather than `:disabled`; `data-[disabled]` repeats the\n * disabled look for it.\n */\nexport function TabsTrigger(props: TabsTriggerProps) {\n const local = props\n const rest = omit(props, 'class', 'appearance', 'id')\n const tabs = useTabsId()\n const triggerId = () => local.id || `${tabs.id()}-trigger-${rest.value}`\n\n // Register before panels render, including SSR where createEffect is skipped.\n createRenderEffect(\n () => [rest.value, triggerId()] as const,\n ([value, id]) => {\n tabs.registerTriggerId(value, id)\n return () => tabs.unregisterTriggerId(value, id)\n }\n )\n\n return (\n <SdkTabsTab\n // ui-sdk keeps a part's own `data-slot`; the trigger keeps its public one.\n render={(tabProps) => <button {...tabProps} data-slot=\"tabs-trigger\" />}\n id={triggerId()}\n // The value as a hook for hosts and tests, as Kobalte's tab carried it.\n data-key={rest.value}\n class={cn(\n 'inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap text-sm font-medium',\n 'transition-colors ease-out outline-none select-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 'text-foreground',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4',\n local.appearance === 'segmented'\n ? 'h-control-sm rounded-md px-control-sm data-[selected]:bg-primary-subtle data-[selected]:text-foreground'\n : tabs.orientation() === 'vertical'\n ? 'h-control-md justify-start rounded-none border-s-2 border-transparent ps-3 pe-2 data-[selected]:border-primary'\n : 'h-control-md -mb-px rounded-none border-b-2 border-transparent px-2 pb-2 data-[selected]:border-primary',\n local.class as string\n )}\n {...rest}\n />\n )\n}\n\nexport type TabsContentProps = ComponentProps<typeof SdkTabsPanel> & {\n /** Keeps the panel in the page, hidden, while its tab is not selected. */\n forceMount?: boolean\n children?: JSX.Element\n}\n\nexport function TabsContent(props: TabsContentProps) {\n const local = props\n const rest = omit(props, 'class', 'id', 'aria-labelledby', 'forceMount')\n const tabs = useTabsId()\n return (\n <SdkTabsPanel\n render={(panelProps) => <div {...panelProps} data-slot=\"tabs-content\" />}\n keepMounted={local.forceMount}\n // Panel ids stay `<tabs id>-content-<value>`, as they were on Kobalte, so a host can\n // point at a panel by its tabs' id. ui-sdk adopts an authored id and points the\n // tab's `aria-controls` at it.\n id={local.id ?? `${tabs.id()}-content-${rest.value}`}\n aria-labelledby={\n local['aria-labelledby'] ??\n tabs.triggerIds().get(rest.value) ??\n `${tabs.id()}-trigger-${rest.value}`\n }\n class={cn('min-h-0 min-w-0 flex-1 outline-none', local.class as string)}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;AA0BA,IAAM,gBAAgB,cAAkC;AAExD,SAAS,YAAY;CACnB,MAAM,OAAO,WAAW,aAAa;CACrC,IAAI,CAAC,MAAM,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A,QAAA,QAAA;GAAtCC,OAAA,OAAA,CAAA,YAAA,EAAY,aAAA,eAAA,CAAA,GAAA,KAAA;GAArB,OAAA;EAA+C,EAAA,CAAA;EACvE,IAAA,cAAA;GAAa,OAAA,MAAM;EAAU;EAI7B,IAAA,KAAA;GAAI,OAAA,MAAM,MAAM,GAAG,KAAK,GAAG,EAAE,WAAW,KAAK;EAAO;EACpD,IAAA,oBAAA;GACE,OAAA,MAAM,sBACN,KAAK,WAAW,CAAC,CAAC,IAAI,KAAK,KAAK,KAChC,GAAG,KAAK,GAAG,EAAE,WAAW,KAAK;EAC/B;EACA,IAAA,UAAA;GAAO,OAAA,GAAG,uCAAuC,MAAM,KAAe;EAAC;CAExE,GADK,IACL,CAAA;AAEL"}
|
|
@@ -16,7 +16,7 @@ function TextLink(props) {
|
|
|
16
16
|
spread(_el$, [{
|
|
17
17
|
"data-slot": "textlink",
|
|
18
18
|
get "class"() {
|
|
19
|
-
return cn("rounded-sm text-foreground underline decoration-primary underline-offset-4", "transition-colors ease-out hover:decoration-foreground outline-none", "focus-visible:border-ring focus-visible:
|
|
19
|
+
return cn("rounded-sm text-foreground underline decoration-primary underline-offset-4", "transition-colors ease-out hover:decoration-foreground outline-none", "focus-visible:border-ring focus-visible:focus-outline", "motion-reduce:transition-none", local.class);
|
|
20
20
|
},
|
|
21
21
|
get tabindex() {
|
|
22
22
|
return local.tabindex ?? 0;
|