@adea-ai/ui 0.118.1 → 0.118.3
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/ui/combobox/combobox.d.ts.map +1 -1
- package/dist/components/ui/combobox/combobox.js +1 -0
- package/dist/components/ui/combobox/combobox.js.map +1 -1
- package/dist/components/ui/context-menu/context-menu.d.ts.map +1 -1
- package/dist/components/ui/context-menu/context-menu.js +2 -0
- package/dist/components/ui/context-menu/context-menu.js.map +1 -1
- package/dist/components/ui/menubar/menubar.d.ts.map +1 -1
- package/dist/components/ui/menubar/menubar.js +2 -0
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/select/select.d.ts.map +1 -1
- package/dist/components/ui/select/select.js +1 -0
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/toggle/toggle.d.ts +1 -1
- package/dist/components/ui/toggle/toggle.js +2 -2
- package/dist/components/ui/toggle/toggle.js.map +1 -1
- package/dist/lib/overlay.d.ts +6 -0
- package/dist/lib/overlay.d.ts.map +1 -1
- package/dist/lib/overlay.js +9 -2
- package/dist/lib/overlay.js.map +1 -1
- package/dist/r/src/components/ui/combobox/combobox.tsx +4 -1
- package/dist/r/src/components/ui/context-menu/context-menu.tsx +8 -2
- package/dist/r/src/components/ui/menubar/menubar.tsx +8 -2
- package/dist/r/src/components/ui/select/select.tsx +4 -1
- package/dist/r/src/components/ui/toggle/toggle.tsx +2 -2
- package/dist/r/src/lib/overlay.ts +9 -2
- package/package.json +1 -1
- package/src/components/ui/combobox/combobox.tsx +4 -1
- package/src/components/ui/context-menu/context-menu.tsx +8 -2
- package/src/components/ui/menubar/menubar.tsx +8 -2
- package/src/components/ui/select/select.tsx +4 -1
- package/src/components/ui/toggle/toggle.tsx +2 -2
- package/src/lib/overlay.ts +9 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/combobox/combobox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gB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,kCAmChF;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,kCAoBpF;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,kCAuBpF;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,kCAgB9E;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,kCAGpF;AAED,sEAAsE;AACtE,wBAAgB,aAAa,CAAC,KAAK,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,kCAkB3E"}
|
|
@@ -108,6 +108,7 @@ function ComboboxItem(props) {
|
|
|
108
108
|
return [createComponent(Combobox.ItemLabel, { get children() {
|
|
109
109
|
return local.children;
|
|
110
110
|
} }), createComponent(Combobox.ItemIndicator, {
|
|
111
|
+
"data-slot": "combobox-indicator",
|
|
111
112
|
"class": "absolute end-2 flex size-4 items-center justify-center text-primary",
|
|
112
113
|
get children() {
|
|
113
114
|
return createComponent(Check, { "class": "size-4" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.js","names":["Combobox","KobalteCombobox","Check","ChevronDown","X","ComponentProps","Show","splitProps","menuContentPadding","menuItem","popoverArrow","topLayerProps","useFormFieldControl","cn","props","Option","OptGroup","_$createComponent","ComboboxControl","Control","local","rest","_$mergeProps","class","ComboboxInput","Input","field","id","aria-label","aria-labelledby","aria-describedby","aria-invalid","aria-errormessage","ComboboxTrigger","Trigger","children","_$memo","Icon","ComboboxContent","Content","Portal","Listbox","Arrow","ComboboxItem","Item","ItemLabel","ItemIndicator","ComboboxSection","Section","ComboboxClear","onClear","when","_el$","_tmpl$","$$click","_$insert","_$effect","_$className","_$delegateEvents","Combobox","_$createComponent","KobalteCombobox","_$mergeProps","_$memo","_$className","_$delegateEvents"],"sources":["../../../../src/components/ui/combobox/combobox.tsx"],"sourcesContent":["import { Combobox as KobalteCombobox } from '@kobalte/core/combobox'\nimport { Check, ChevronDown, X } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport { menuContentPadding, menuItem, popoverArrow, topLayerProps } from '#lib/overlay'\nimport { useFormFieldControl } from '#lib/form-field'\nimport { cn } from '#lib/utils'\n\n/**\n * Combobox.\n *\n * A Select whose list is filterable by typing. The difference from Select is\n * not cosmetic: a Combobox has a text input, so the user can narrow forty\n * options to one without reading the list. Above roughly ten options the\n * search is the feature; below it, a Select is quieter and a RadioGroup is\n * better still.\n *\n * Kobalte supplies the filtering, the `aria-activedescendant` wiring, the\n * keyboard selection and the multiple-selection mode, which is the part a\n * hand-rolled version reliably gets wrong.\n */\nexport function Combobox<Option, OptGroup = never>(\n props: ComponentProps<typeof KobalteCombobox<Option, OptGroup>>\n) {\n return <KobalteCombobox {...props} />\n}\n\nexport function ComboboxControl(props: ComponentProps<typeof KobalteCombobox.Control>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <KobalteCombobox.Control\n class={cn(\n 'border-input bg-transparent flex h-control-md w-full items-center gap-1.5 rounded-md border px-control-sm',\n 'transition-[color,box-shadow,border-color] ease-out',\n 'focus-within:border-ring focus-within:ring-3 focus-within:ring-primary-subtle',\n 'data-[invalid]:border-destructive data-[invalid]:ring-3 data-[invalid]:ring-destructive-subtle',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function ComboboxInput(props: ComponentProps<typeof KobalteCombobox.Input>) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'id',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-errormessage',\n ])\n const field = useFormFieldControl('control', {\n id: local.id,\n 'aria-label': local['aria-label'],\n 'aria-labelledby': local['aria-labelledby'],\n 'aria-describedby': local['aria-describedby'],\n 'aria-invalid': local['aria-invalid'],\n 'aria-errormessage': local['aria-errormessage'],\n })\n\n return (\n <KobalteCombobox.Input\n id={field?.id ?? local.id}\n aria-label={local['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}\n aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}\n aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}\n class={cn(\n 'h-full flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function ComboboxTrigger(props: ComponentProps<typeof KobalteCombobox.Trigger>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteCombobox.Trigger\n class={cn(\n 'text-muted-foreground flex shrink-0 items-center justify-center rounded-sm outline-none',\n 'transition-colors ease-out hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'disabled:pointer-events-none disabled:opacity-50',\n local.class\n )}\n {...rest}\n >\n {local.children}\n <KobalteCombobox.Icon>\n <ChevronDown class=\"size-4\" />\n </KobalteCombobox.Icon>\n </KobalteCombobox.Trigger>\n )\n}\n\nexport function ComboboxContent(props: ComponentProps<typeof KobalteCombobox.Content>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteCombobox.Portal>\n <KobalteCombobox.Content\n {...topLayerProps}\n class={cn(\n 'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg',\n 'z-(--z-menu) max-h-72 min-w-(--kb-popper-anchor-width) origin-(--kb-combobox-content-transform-origin) overflow-hidden',\n 'data-expanded:animate-in data-expanded:fade-in-0 data-expanded:zoom-in-95',\n 'data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n 'data-expanded:duration-150 data-closed:duration-100',\n local.class\n )}\n {...rest}\n >\n <KobalteCombobox.Listbox class={cn('max-h-72 overflow-y-auto', menuContentPadding)} />\n {local.children}\n <KobalteCombobox.Arrow aria-hidden=\"true\" class={popoverArrow} />\n </KobalteCombobox.Content>\n </KobalteCombobox.Portal>\n )\n}\n\nexport function ComboboxItem(props: ComponentProps<typeof KobalteCombobox.Item>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteCombobox.Item class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n <KobalteCombobox.ItemLabel>{local.children}</KobalteCombobox.ItemLabel>\n {/* The indicator reads in the accent, like every other selected state in\n the system. */}\n <KobalteCombobox.ItemIndicator class=\"absolute end-2 flex size-4 items-center justify-center text-primary\">\n <Check class=\"size-4\" />\n </KobalteCombobox.ItemIndicator>\n </KobalteCombobox.Item>\n )\n}\n\nexport function ComboboxSection(props: ComponentProps<typeof KobalteCombobox.Section>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteCombobox.Section class={cn('flex flex-col', local.class)} {...rest} />\n}\n\n/** The clear affordance for a single-select Combobox with a value. */\nexport function ComboboxClear(props: { class?: string; onClear: () => void }) {\n return (\n <Show when={props.onClear}>\n <button\n type=\"button\"\n aria-label=\"Clear selection\"\n onClick={() => props.onClear()}\n class={cn(\n 'text-muted-foreground flex size-4 shrink-0 items-center justify-center rounded-sm',\n 'transition-colors ease-out outline-none hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n props.class\n )}\n >\n <X class=\"size-3.5\" />\n </button>\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgBA,WACdc,OACA;CACA,OAAAG,gBAAQhB,UAAoBa,KAAK;AACnC;AAEA,SAAgBI,gBAAgBJ,OAAuD;CACrF,MAAM,CAACM,OAAOC,QAAQd,WAAWO,OAAO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AA,IAAAX,WAAA;IAAA,OAAAlB,gBAC3Bf,OAAK,EAAA,SAAA,SAAA,CAAA;GAAA;EAAA,CAAA,CAAA;CAAA,EAAA,CAAA,CAAA;AAId;AAEA,SAAgB6C,gBAAgBjC,OAAuD;CACrF,MAAM,CAACM,OAAOC,QAAQd,WAAWO,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBAAQhB,SAAgB+C,SAAO1B,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQT,GAAG,iBAAiBO,MAAMG,KAAK;CAAC,EAAA,GAAMF,IAAI,CAAA;AACnF;;AAGA,SAAgB4B,cAAcnC,OAAgD;CAC5E,OAAAG,gBACGX,MAAI;EAAA,IAAC6C,OAAI;GAAA,OAAErC,MAAMoC;EAAO;EAAA,IAAAf,WAAA;GAAA,IAAAiB,OAAAC,OAAA;GAAAD,KAAAE,gBAINxC,MAAMoC,QAAQ;GAACK,OAAAH,MAAAnC,gBAQ7Bb,GAAC,EAAA,SAAA,WAAA,CAAA,CAAA;GAAAoD,aAAAC,UAAAL,MAPKvC,GACL,qFACA,iEACA,oFACAC,MAAMS,KACR,CAAC,CAAA;GAAA,OAAA6B;EAAA;CAAA,CAAA;AAMT;AAACM,eAAA,CAAA,OAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"combobox.js","names":["Combobox","KobalteCombobox","Check","ChevronDown","X","ComponentProps","Show","splitProps","menuContentPadding","menuItem","popoverArrow","topLayerProps","useFormFieldControl","cn","props","Option","OptGroup","_$createComponent","ComboboxControl","Control","local","rest","_$mergeProps","class","ComboboxInput","Input","field","id","aria-label","aria-labelledby","aria-describedby","aria-invalid","aria-errormessage","ComboboxTrigger","Trigger","children","_$memo","Icon","ComboboxContent","Content","Portal","Listbox","Arrow","ComboboxItem","Item","ItemLabel","ItemIndicator","ComboboxSection","Section","ComboboxClear","onClear","when","_el$","_tmpl$","$$click","_$insert","_$effect","_$className","_$delegateEvents","Combobox","_$createComponent","KobalteCombobox","_$mergeProps","_$memo","_$className","_$delegateEvents"],"sources":["../../../../src/components/ui/combobox/combobox.tsx"],"sourcesContent":["import { Combobox as KobalteCombobox } from '@kobalte/core/combobox'\nimport { Check, ChevronDown, X } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport { menuContentPadding, menuItem, popoverArrow, topLayerProps } from '#lib/overlay'\nimport { useFormFieldControl } from '#lib/form-field'\nimport { cn } from '#lib/utils'\n\n/**\n * Combobox.\n *\n * A Select whose list is filterable by typing. The difference from Select is\n * not cosmetic: a Combobox has a text input, so the user can narrow forty\n * options to one without reading the list. Above roughly ten options the\n * search is the feature; below it, a Select is quieter and a RadioGroup is\n * better still.\n *\n * Kobalte supplies the filtering, the `aria-activedescendant` wiring, the\n * keyboard selection and the multiple-selection mode, which is the part a\n * hand-rolled version reliably gets wrong.\n */\nexport function Combobox<Option, OptGroup = never>(\n props: ComponentProps<typeof KobalteCombobox<Option, OptGroup>>\n) {\n return <KobalteCombobox {...props} />\n}\n\nexport function ComboboxControl(props: ComponentProps<typeof KobalteCombobox.Control>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <KobalteCombobox.Control\n class={cn(\n 'border-input bg-transparent flex h-control-md w-full items-center gap-1.5 rounded-md border px-control-sm',\n 'transition-[color,box-shadow,border-color] ease-out',\n 'focus-within:border-ring focus-within:ring-3 focus-within:ring-primary-subtle',\n 'data-[invalid]:border-destructive data-[invalid]:ring-3 data-[invalid]:ring-destructive-subtle',\n 'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function ComboboxInput(props: ComponentProps<typeof KobalteCombobox.Input>) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'id',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-errormessage',\n ])\n const field = useFormFieldControl('control', {\n id: local.id,\n 'aria-label': local['aria-label'],\n 'aria-labelledby': local['aria-labelledby'],\n 'aria-describedby': local['aria-describedby'],\n 'aria-invalid': local['aria-invalid'],\n 'aria-errormessage': local['aria-errormessage'],\n })\n\n return (\n <KobalteCombobox.Input\n id={field?.id ?? local.id}\n aria-label={local['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}\n aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}\n aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}\n class={cn(\n 'h-full flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function ComboboxTrigger(props: ComponentProps<typeof KobalteCombobox.Trigger>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteCombobox.Trigger\n class={cn(\n 'text-muted-foreground flex shrink-0 items-center justify-center rounded-sm outline-none',\n 'transition-colors ease-out hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'disabled:pointer-events-none disabled:opacity-50',\n local.class\n )}\n {...rest}\n >\n {local.children}\n <KobalteCombobox.Icon>\n <ChevronDown class=\"size-4\" />\n </KobalteCombobox.Icon>\n </KobalteCombobox.Trigger>\n )\n}\n\nexport function ComboboxContent(props: ComponentProps<typeof KobalteCombobox.Content>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteCombobox.Portal>\n <KobalteCombobox.Content\n {...topLayerProps}\n class={cn(\n 'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg',\n 'z-(--z-menu) max-h-72 min-w-(--kb-popper-anchor-width) origin-(--kb-combobox-content-transform-origin) overflow-hidden',\n 'data-expanded:animate-in data-expanded:fade-in-0 data-expanded:zoom-in-95',\n 'data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n 'data-expanded:duration-150 data-closed:duration-100',\n local.class\n )}\n {...rest}\n >\n <KobalteCombobox.Listbox class={cn('max-h-72 overflow-y-auto', menuContentPadding)} />\n {local.children}\n <KobalteCombobox.Arrow aria-hidden=\"true\" class={popoverArrow} />\n </KobalteCombobox.Content>\n </KobalteCombobox.Portal>\n )\n}\n\nexport function ComboboxItem(props: ComponentProps<typeof KobalteCombobox.Item>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteCombobox.Item class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n <KobalteCombobox.ItemLabel>{local.children}</KobalteCombobox.ItemLabel>\n {/* The indicator reads in the accent, like every other selected state in\n the system. */}\n <KobalteCombobox.ItemIndicator\n data-slot=\"combobox-indicator\"\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Check class=\"size-4\" />\n </KobalteCombobox.ItemIndicator>\n </KobalteCombobox.Item>\n )\n}\n\nexport function ComboboxSection(props: ComponentProps<typeof KobalteCombobox.Section>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteCombobox.Section class={cn('flex flex-col', local.class)} {...rest} />\n}\n\n/** The clear affordance for a single-select Combobox with a value. */\nexport function ComboboxClear(props: { class?: string; onClear: () => void }) {\n return (\n <Show when={props.onClear}>\n <button\n type=\"button\"\n aria-label=\"Clear selection\"\n onClick={() => props.onClear()}\n class={cn(\n 'text-muted-foreground flex size-4 shrink-0 items-center justify-center rounded-sm',\n 'transition-colors ease-out outline-none hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n props.class\n )}\n >\n <X class=\"size-3.5\" />\n </button>\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgBA,WACdc,OACA;CACA,OAAAG,gBAAQhB,UAAoBa,KAAK;AACnC;AAEA,SAAgBI,gBAAgBJ,OAAuD;CACrF,MAAM,CAACM,OAAOC,QAAQd,WAAWO,OAAO,CAAC,OAAO,CAAC;CAEjD,OAAAG,gBACGhB,SAAgBkB,SAAOG,WAAA,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,cAAc,CAAC,OAAO,kBAAkB,CAAC,UAAU,CAAC,kCAEhG;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,SAAS,CAAC,kCAgB9F;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,UAAU,CAAC,kCAG3F;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,KAAK,CAAC,kCAEtF;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,SAAS,CAAC,kCAG9F;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,GAAG,CAAC,kCAElF;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,UAAU,CAAC,kCAShG;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,UAAU,CAAC,kCAkBhG"}
|
|
@@ -62,6 +62,7 @@ function ContextMenuCheckboxItem(props) {
|
|
|
62
62
|
return cn(menuItem, "pe-8", local.class);
|
|
63
63
|
} }, rest, { get children() {
|
|
64
64
|
return [memo(() => local.children), createComponent(ContextMenu.ItemIndicator, {
|
|
65
|
+
"data-slot": "context-menu-indicator",
|
|
65
66
|
"class": "absolute end-2 flex size-4 items-center justify-center text-primary",
|
|
66
67
|
get children() {
|
|
67
68
|
return createComponent(Check, { "class": "size-4" });
|
|
@@ -78,6 +79,7 @@ function ContextMenuRadioItem(props) {
|
|
|
78
79
|
return cn(menuItem, "pe-8", local.class);
|
|
79
80
|
} }, rest, { get children() {
|
|
80
81
|
return [memo(() => local.children), createComponent(ContextMenu.ItemIndicator, {
|
|
82
|
+
"data-slot": "context-menu-indicator",
|
|
81
83
|
"class": "absolute end-2 flex size-4 items-center justify-center text-primary",
|
|
82
84
|
get children() {
|
|
83
85
|
return createComponent(Circle, { "class": "size-2 fill-current" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-menu.js","names":["ContextMenu","KobalteContextMenu","Check","ChevronRight","Circle","ComponentProps","splitProps","menuContentPadding","destructiveMenuItem","menuItem","menuLabel","menuSeparator","overlayMotion","overlaySurface","topLayerProps","cn","props","_$createComponent","ContextMenuTrigger","Trigger","ContextMenuContent","Content","local","rest","Portal","children","_$mergeProps","class","ContextMenuItem","Item","variant","shortcut","keyshortcuts","aria-keyshortcuts","_$memo","_el$","_tmpl$","_$insert","ContextMenuCheckboxItem","CheckboxItem","ItemIndicator","ContextMenuRadioGroup","RadioGroup","ContextMenuRadioItem","RadioItem","ContextMenuLabel","GroupLabel","ContextMenuGroup","Group","ContextMenuSeparator","Separator","ContextMenuSub","Sub","ContextMenuSubTrigger","SubTrigger","ContextMenuSubContent","SubContent","ContextMenu","_$createComponent","KobalteContextMenu","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/context-menu/context-menu.tsx"],"sourcesContent":["import { ContextMenu as KobalteContextMenu } from '@kobalte/core/context-menu'\nimport { Check, ChevronRight, Circle } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport {\n menuContentPadding,\n destructiveMenuItem,\n menuItem,\n menuLabel,\n menuSeparator,\n overlayMotion,\n overlaySurface,\n topLayerProps,\n} from '#lib/overlay'\nimport { cn } from '#lib/utils'\n\n/**\n * ContextMenu.\n *\n * The same actions as DropdownMenu, opened by right-click. The trigger is the\n * region the menu belongs to — a file row, a canvas, a code block — and the\n * menu opens at the pointer.\n *\n * The accessibility rule for this component is not about its own markup: a\n * context menu must never hold the *only* route to an action, because a\n * right-click is unavailable on touch and undiscoverable on a trackpad. Every\n * item here should also appear somewhere reachable, usually a DropdownMenu on\n * the same row.\n */\nexport function ContextMenu(props: ComponentProps<typeof KobalteContextMenu>) {\n return <KobalteContextMenu {...props} />\n}\n\nexport function ContextMenuTrigger(props: ComponentProps<typeof KobalteContextMenu.Trigger>) {\n return <KobalteContextMenu.Trigger {...props} />\n}\n\nexport function ContextMenuContent(props: ComponentProps<typeof KobalteContextMenu.Content>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <KobalteContextMenu.Portal>\n <KobalteContextMenu.Content\n {...topLayerProps}\n class={cn(\n overlaySurface,\n overlayMotion,\n 'z-(--z-menu) min-w-[10rem] origin-(--kb-menu-content-transform-origin) overflow-hidden',\n menuContentPadding,\n local.class\n )}\n {...rest}\n />\n </KobalteContextMenu.Portal>\n )\n}\n\nexport function ContextMenuItem(\n props: ComponentProps<typeof KobalteContextMenu.Item> & {\n variant?: 'default' | 'destructive'\n shortcut?: string\n /**\n * The parseable chord behind `shortcut`, e.g. `Meta+C`. The drawn glyph is\n * `aria-hidden` — reading it out would pollute the item's accessible name —\n * so this is what assistive technology announces instead. Supply it\n * whenever `shortcut` is drawn.\n */\n keyshortcuts?: string\n }\n) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'variant',\n 'shortcut',\n 'keyshortcuts',\n 'children',\n ])\n\n return (\n <KobalteContextMenu.Item\n class={cn(\n menuItem,\n {\n [destructiveMenuItem]: local.variant === 'destructive',\n },\n local.class\n )}\n aria-keyshortcuts={local.keyshortcuts}\n {...rest}\n >\n {local.children}\n {local.shortcut ? (\n <span\n aria-hidden=\"true\"\n class=\"text-muted-foreground ms-auto font-code text-code tracking-widest\"\n >\n {local.shortcut}\n </span>\n ) : null}\n </KobalteContextMenu.Item>\n )\n}\n\nexport function ContextMenuCheckboxItem(\n props: ComponentProps<typeof KobalteContextMenu.CheckboxItem>\n) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteContextMenu.CheckboxItem class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n {local.children}\n {/* The indicator reads in the accent, like every other selected state in\n the system. */}\n <KobalteContextMenu.ItemIndicator class=\"absolute end-2 flex size-4 items-center justify-center text-primary\">\n <Check class=\"size-4\" />\n </KobalteContextMenu.ItemIndicator>\n </KobalteContextMenu.CheckboxItem>\n )\n}\n\nexport function ContextMenuRadioGroup(props: ComponentProps<typeof KobalteContextMenu.RadioGroup>) {\n return <KobalteContextMenu.RadioGroup {...props} />\n}\n\nexport function ContextMenuRadioItem(props: ComponentProps<typeof KobalteContextMenu.RadioItem>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteContextMenu.RadioItem class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n {local.children}\n {/* The indicator reads in the accent, like every other selected state in\n the system. */}\n <KobalteContextMenu.ItemIndicator class=\"absolute end-2 flex size-4 items-center justify-center text-primary\">\n <Circle class=\"size-2 fill-current\" />\n </KobalteContextMenu.ItemIndicator>\n </KobalteContextMenu.RadioItem>\n )\n}\n\n/**\n * The caption of a `ContextMenuGroup`, and that group's accessible name. It must be a\n * child of the group it names: Kobalte reads the group from context, so a label\n * placed directly in the content throws `useMenuGroupContext must be used within\n * a Menu.Group` the moment the menu opens. For an ungrouped caption, wrap the\n * label and its items in a group anyway — the grouping is what a screen reader\n * announces.\n */\nexport function ContextMenuLabel(props: ComponentProps<typeof KobalteContextMenu.GroupLabel>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteContextMenu.GroupLabel class={cn(menuLabel, local.class)} {...rest} />\n}\n\nexport function ContextMenuGroup(props: ComponentProps<typeof KobalteContextMenu.Group>) {\n return <KobalteContextMenu.Group {...props} />\n}\n\nexport function ContextMenuSeparator(props: ComponentProps<typeof KobalteContextMenu.Separator>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteContextMenu.Separator class={cn(menuSeparator, local.class)} {...rest} />\n}\n\nexport function ContextMenuSub(props: ComponentProps<typeof KobalteContextMenu.Sub>) {\n return <KobalteContextMenu.Sub {...props} />\n}\n\nexport function ContextMenuSubTrigger(props: ComponentProps<typeof KobalteContextMenu.SubTrigger>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteContextMenu.SubTrigger class={cn(menuItem, local.class)} {...rest}>\n {local.children}\n <ChevronRight class=\"ms-auto size-4\" />\n </KobalteContextMenu.SubTrigger>\n )\n}\n\nexport function ContextMenuSubContent(props: ComponentProps<typeof KobalteContextMenu.SubContent>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <KobalteContextMenu.Portal>\n <KobalteContextMenu.SubContent\n {...topLayerProps}\n class={cn(\n overlaySurface,\n overlayMotion,\n 'z-(--z-menu) min-w-[8rem] origin-(--kb-menu-content-transform-origin) overflow-hidden',\n menuContentPadding,\n local.class\n )}\n {...rest}\n />\n </KobalteContextMenu.Portal>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgBA,cAAYgB,OAAkD;CAC5E,OAAAC,gBAAQhB,aAAuBe,KAAK;AACtC;AAEA,SAAgBE,mBAAmBF,OAA0D;CAC3F,OAAAC,gBAAQhB,YAAmBkB,SAAYH,KAAK;AAC9C;AAEA,SAAgBI,mBAAmBJ,OAA0D;CAC3F,MAAM,CAACM,OAAOC,QAAQjB,WAAWU,OAAO,CAAC,OAAO,CAAC;CAEjD,OAAAC,gBACGhB,YAAmBuB,QAAM,EAAA,IAAAC,WAAA;EAAA,OAAAR,gBACvBhB,YAAmBoB,SAAOK,WACrBZ,eAAa,EAAA,KAAA,WAAA;GAAA,OACVC,GACLF,gBACAD,eACA,0FAAA,OAEAU,MAAMK,KACR;EAAC,EAAA,GACGJ,IAAI,CAAA;CAAA,EAAA,CAAA;AAIhB;AAEA,SAAgBK,gBACdZ,OAWA;CACA,MAAM,CAACM,OAAOC,QAAQjB,WAAWU,OAAO;EACtC;EACA;EACA;EACA;EACA;CAAU,CACX;CAED,OAAAC,gBACGhB,YAAmB4B,MAAIH,WAAA;EAAA,KAAA,WAAA;GAAA,OACfX,GACLN,UACA,GACGD,sBAAsBc,MAAMQ,YAAY,cAC3C,GACAR,MAAM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ACjG,MAAM,CAACM,OAAOC,QAAQjB,WAAWU,OAAO,CAAC,OAAO,CAAC;CAEjD,OAAAC,gBACGhB,YAAmBuB,QAAM,EAAA,IAAAC,WAAA;EAAA,OAAAR,gBACvBhB,YAAmBuD,YAAU9B,WACxBZ,eAAa,EAAA,KAAA,WAAA;GAAA,OACVC,GACLF,gBACAD,eACA,yFAAA,OAEAU,MAAMK,KACR;EAAC,EAAA,GACGJ,IAAI,CAAA;CAAA,EAAA,CAAA;AAIhB"}
|
|
1
|
+
{"version":3,"file":"context-menu.js","names":["ContextMenu","KobalteContextMenu","Check","ChevronRight","Circle","ComponentProps","splitProps","menuContentPadding","destructiveMenuItem","menuItem","menuLabel","menuSeparator","overlayMotion","overlaySurface","topLayerProps","cn","props","_$createComponent","ContextMenuTrigger","Trigger","ContextMenuContent","Content","local","rest","Portal","children","_$mergeProps","class","ContextMenuItem","Item","variant","shortcut","keyshortcuts","aria-keyshortcuts","_$memo","_el$","_tmpl$","_$insert","ContextMenuCheckboxItem","CheckboxItem","ItemIndicator","ContextMenuRadioGroup","RadioGroup","ContextMenuRadioItem","RadioItem","ContextMenuLabel","GroupLabel","ContextMenuGroup","Group","ContextMenuSeparator","Separator","ContextMenuSub","Sub","ContextMenuSubTrigger","SubTrigger","ContextMenuSubContent","SubContent","ContextMenu","_$createComponent","KobalteContextMenu","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/context-menu/context-menu.tsx"],"sourcesContent":["import { ContextMenu as KobalteContextMenu } from '@kobalte/core/context-menu'\nimport { Check, ChevronRight, Circle } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport {\n menuContentPadding,\n destructiveMenuItem,\n menuItem,\n menuLabel,\n menuSeparator,\n overlayMotion,\n overlaySurface,\n topLayerProps,\n} from '#lib/overlay'\nimport { cn } from '#lib/utils'\n\n/**\n * ContextMenu.\n *\n * The same actions as DropdownMenu, opened by right-click. The trigger is the\n * region the menu belongs to — a file row, a canvas, a code block — and the\n * menu opens at the pointer.\n *\n * The accessibility rule for this component is not about its own markup: a\n * context menu must never hold the *only* route to an action, because a\n * right-click is unavailable on touch and undiscoverable on a trackpad. Every\n * item here should also appear somewhere reachable, usually a DropdownMenu on\n * the same row.\n */\nexport function ContextMenu(props: ComponentProps<typeof KobalteContextMenu>) {\n return <KobalteContextMenu {...props} />\n}\n\nexport function ContextMenuTrigger(props: ComponentProps<typeof KobalteContextMenu.Trigger>) {\n return <KobalteContextMenu.Trigger {...props} />\n}\n\nexport function ContextMenuContent(props: ComponentProps<typeof KobalteContextMenu.Content>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <KobalteContextMenu.Portal>\n <KobalteContextMenu.Content\n {...topLayerProps}\n class={cn(\n overlaySurface,\n overlayMotion,\n 'z-(--z-menu) min-w-[10rem] origin-(--kb-menu-content-transform-origin) overflow-hidden',\n menuContentPadding,\n local.class\n )}\n {...rest}\n />\n </KobalteContextMenu.Portal>\n )\n}\n\nexport function ContextMenuItem(\n props: ComponentProps<typeof KobalteContextMenu.Item> & {\n variant?: 'default' | 'destructive'\n shortcut?: string\n /**\n * The parseable chord behind `shortcut`, e.g. `Meta+C`. The drawn glyph is\n * `aria-hidden` — reading it out would pollute the item's accessible name —\n * so this is what assistive technology announces instead. Supply it\n * whenever `shortcut` is drawn.\n */\n keyshortcuts?: string\n }\n) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'variant',\n 'shortcut',\n 'keyshortcuts',\n 'children',\n ])\n\n return (\n <KobalteContextMenu.Item\n class={cn(\n menuItem,\n {\n [destructiveMenuItem]: local.variant === 'destructive',\n },\n local.class\n )}\n aria-keyshortcuts={local.keyshortcuts}\n {...rest}\n >\n {local.children}\n {local.shortcut ? (\n <span\n aria-hidden=\"true\"\n class=\"text-muted-foreground ms-auto font-code text-code tracking-widest\"\n >\n {local.shortcut}\n </span>\n ) : null}\n </KobalteContextMenu.Item>\n )\n}\n\nexport function ContextMenuCheckboxItem(\n props: ComponentProps<typeof KobalteContextMenu.CheckboxItem>\n) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteContextMenu.CheckboxItem class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n {local.children}\n {/* The indicator reads in the accent, like every other selected state in\n the system. */}\n <KobalteContextMenu.ItemIndicator\n data-slot=\"context-menu-indicator\"\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Check class=\"size-4\" />\n </KobalteContextMenu.ItemIndicator>\n </KobalteContextMenu.CheckboxItem>\n )\n}\n\nexport function ContextMenuRadioGroup(props: ComponentProps<typeof KobalteContextMenu.RadioGroup>) {\n return <KobalteContextMenu.RadioGroup {...props} />\n}\n\nexport function ContextMenuRadioItem(props: ComponentProps<typeof KobalteContextMenu.RadioItem>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteContextMenu.RadioItem class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n {local.children}\n {/* The indicator reads in the accent, like every other selected state in\n the system. */}\n <KobalteContextMenu.ItemIndicator\n data-slot=\"context-menu-indicator\"\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Circle class=\"size-2 fill-current\" />\n </KobalteContextMenu.ItemIndicator>\n </KobalteContextMenu.RadioItem>\n )\n}\n\n/**\n * The caption of a `ContextMenuGroup`, and that group's accessible name. It must be a\n * child of the group it names: Kobalte reads the group from context, so a label\n * placed directly in the content throws `useMenuGroupContext must be used within\n * a Menu.Group` the moment the menu opens. For an ungrouped caption, wrap the\n * label and its items in a group anyway — the grouping is what a screen reader\n * announces.\n */\nexport function ContextMenuLabel(props: ComponentProps<typeof KobalteContextMenu.GroupLabel>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteContextMenu.GroupLabel class={cn(menuLabel, local.class)} {...rest} />\n}\n\nexport function ContextMenuGroup(props: ComponentProps<typeof KobalteContextMenu.Group>) {\n return <KobalteContextMenu.Group {...props} />\n}\n\nexport function ContextMenuSeparator(props: ComponentProps<typeof KobalteContextMenu.Separator>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteContextMenu.Separator class={cn(menuSeparator, local.class)} {...rest} />\n}\n\nexport function ContextMenuSub(props: ComponentProps<typeof KobalteContextMenu.Sub>) {\n return <KobalteContextMenu.Sub {...props} />\n}\n\nexport function ContextMenuSubTrigger(props: ComponentProps<typeof KobalteContextMenu.SubTrigger>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <KobalteContextMenu.SubTrigger class={cn(menuItem, local.class)} {...rest}>\n {local.children}\n <ChevronRight class=\"ms-auto size-4\" />\n </KobalteContextMenu.SubTrigger>\n )\n}\n\nexport function ContextMenuSubContent(props: ComponentProps<typeof KobalteContextMenu.SubContent>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <KobalteContextMenu.Portal>\n <KobalteContextMenu.SubContent\n {...topLayerProps}\n class={cn(\n overlaySurface,\n overlayMotion,\n 'z-(--z-menu) min-w-[8rem] origin-(--kb-menu-content-transform-origin) overflow-hidden',\n menuContentPadding,\n local.class\n )}\n {...rest}\n />\n </KobalteContextMenu.Portal>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgBA,cAAYgB,OAAkD;CAC5E,OAAAC,gBAAQhB,aAAuBe,KAAK;AACtC;AAEA,SAAgBE,mBAAmBF,OAA0D;CAC3F,OAAAC,gBAAQhB,YAAmBkB,SAAYH,KAAK;AAC9C;AAEA,SAAgBI,mBAAmBJ,OAA0D;CAC3F,MAAM,CAACM,OAAOC,QAAQjB,WAAWU,OAAO,CAAC,OAAO,CAAC;CAEjD,OAAAC,gBACGhB,YAAmBuB,QAAM,EAAA,IAAAC,WAAA;EAAA,OAAAR,gBACvBhB,YAAmBoB,SAAOK,WACrBZ,eAAa,EAAA,KAAA,WAAA;GAAA,OACVC,GACLF,gBACAD,eACA,0FAAA,OAEAU,MAAMK,KACR;EAAC,EAAA,GACGJ,IAAI,CAAA;CAAA,EAAA,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AAC,KAAK,EAAE,cAAc,CAAC,OAAO,cAAc,CAAC,UAAU,CAAC,kCAExF;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,cAAc,CAAC,SAAS,CAAC,kCAetF;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,cAAc,CAAC,UAAU,CAAC,kCAGnF;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,kCAE9E;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,cAAc,CAAC,SAAS,CAAC,kCAGtF;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,cAAc,CAAC,GAAG,CAAC,kCAE1E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,cAAc,CAAC,UAAU,CAAC,kCAQxF;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,cAAc,CAAC,UAAU,CAAC,kCAiBxF"}
|
|
@@ -81,6 +81,7 @@ function MenubarCheckboxItem(props) {
|
|
|
81
81
|
return cn(menuItem, "pe-8", local.class);
|
|
82
82
|
} }, rest, { get children() {
|
|
83
83
|
return [memo(() => local.children), createComponent(Menubar.ItemIndicator, {
|
|
84
|
+
"data-slot": "menubar-indicator",
|
|
84
85
|
"class": "absolute end-2 flex size-4 items-center justify-center text-primary",
|
|
85
86
|
get children() {
|
|
86
87
|
return createComponent(Check, { "class": "size-4" });
|
|
@@ -97,6 +98,7 @@ function MenubarRadioItem(props) {
|
|
|
97
98
|
return cn(menuItem, "pe-8", local.class);
|
|
98
99
|
} }, rest, { get children() {
|
|
99
100
|
return [memo(() => local.children), createComponent(Menubar.ItemIndicator, {
|
|
101
|
+
"data-slot": "menubar-indicator",
|
|
100
102
|
"class": "absolute end-2 flex size-4 items-center justify-center text-primary",
|
|
101
103
|
get children() {
|
|
102
104
|
return createComponent(Circle, { "class": "size-2 fill-current" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menubar.js","names":["Menubar","KobalteMenubar","Check","ChevronRight","Circle","ComponentProps","splitProps","menuContentPadding","destructiveMenuItem","menuItem","menuLabel","menuSeparator","overlayMotion","overlaySurface","popoverArrow","topLayerProps","cn","props","local","rest","_$createComponent","_$mergeProps","class","MenubarMenu","Menu","MenubarTrigger","Trigger","MenubarContent","Content","Portal","children","Arrow","_$memo","MenubarItem","Item","variant","shortcut","keyshortcuts","aria-keyshortcuts","_el$","_tmpl$","_$insert","MenubarCheckboxItem","CheckboxItem","ItemIndicator","MenubarRadioGroup","RadioGroup","MenubarRadioItem","RadioItem","MenubarLabel","GroupLabel","MenubarGroup","Group","MenubarSeparator","Separator","MenubarSub","Sub","MenubarSubTrigger","SubTrigger","MenubarSubContent","SubContent","Menubar","_$createComponent","KobalteMenubar","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/menubar/menubar.tsx"],"sourcesContent":["import { Menubar as KobalteMenubar } from '@kobalte/core/menubar'\nimport { Check, ChevronRight, Circle } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport {\n menuContentPadding,\n destructiveMenuItem,\n menuItem,\n menuLabel,\n menuSeparator,\n overlayMotion,\n overlaySurface,\n popoverArrow,\n topLayerProps,\n} from '#lib/overlay'\nimport { cn } from '#lib/utils'\n\n/**\n * Menubar.\n *\n * A persistent row of menus at the top of a surface — the desktop application\n * pattern. Each trigger opens its own menu, and the arrow keys move *between*\n * menus once one is open, which is what makes a menubar a single control rather\n * than five menus that happen to be adjacent.\n *\n * This is for a window-level command surface. For actions on one thing, use\n * DropdownMenu; a menubar on a row would be a menu pretending to be chrome.\n */\nexport function Menubar(props: ComponentProps<typeof KobalteMenubar>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteMenubar\n class={cn(\n 'flex items-center gap-0.5 rounded-md border border-border bg-card p-0.5',\n local.class\n )}\n {...rest}\n />\n )\n}\n\n/**\n * One top-level menu: a trigger and the panel it opens.\n *\n * Required, and the reason the component is not just a row of triggers — the\n * menubar's arrow keys move *between* menus, which only works when each trigger\n * belongs to a menu the bar knows about. `value` names it.\n */\nexport function MenubarMenu(props: ComponentProps<typeof KobalteMenubar.Menu>) {\n return <KobalteMenubar.Menu {...props} />\n}\n\nexport function MenubarTrigger(props: ComponentProps<typeof KobalteMenubar.Trigger>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteMenubar.Trigger\n class={cn(\n 'flex items-center rounded-sm px-2 py-1 text-sm font-medium select-none',\n 'transition-colors ease-out outline-none',\n 'data-[expanded]:bg-surface-active',\n 'data-[highlighted]:bg-surface-hover',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function MenubarContent(props: ComponentProps<typeof KobalteMenubar.Content>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <KobalteMenubar.Portal>\n <KobalteMenubar.Content\n {...topLayerProps}\n class={cn(\n overlaySurface,\n overlayMotion,\n 'z-(--z-menu) min-w-[10rem] origin-(--kb-menu-content-transform-origin) overflow-hidden',\n menuContentPadding,\n local.class\n )}\n {...rest}\n >\n <KobalteMenubar.Arrow aria-hidden=\"true\" class={popoverArrow} />\n {local.children}\n </KobalteMenubar.Content>\n </KobalteMenubar.Portal>\n )\n}\n\nexport function MenubarItem(\n props: ComponentProps<typeof KobalteMenubar.Item> & {\n variant?: 'default' | 'destructive'\n shortcut?: string\n /**\n * The parseable chord behind `shortcut`, e.g. `Meta+N`. The drawn glyph is\n * `aria-hidden` — reading it out would pollute the item's accessible name —\n * so this is what assistive technology announces instead. Supply it\n * whenever `shortcut` is drawn.\n */\n keyshortcuts?: string\n }\n) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'variant',\n 'shortcut',\n 'keyshortcuts',\n 'children',\n ])\n return (\n <KobalteMenubar.Item\n class={cn(\n menuItem,\n {\n [destructiveMenuItem]: local.variant === 'destructive',\n },\n local.class\n )}\n aria-keyshortcuts={local.keyshortcuts}\n {...rest}\n >\n {local.children}\n {local.shortcut ? (\n <span\n aria-hidden=\"true\"\n class=\"text-muted-foreground ms-auto font-code text-code tracking-widest\"\n >\n {local.shortcut}\n </span>\n ) : null}\n </KobalteMenubar.Item>\n )\n}\n\nexport function MenubarCheckboxItem(props: ComponentProps<typeof KobalteMenubar.CheckboxItem>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <KobalteMenubar.CheckboxItem class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n {local.children}\n {/* The indicator reads in the accent, like every other selected state in\n the system. */}\n <KobalteMenubar.ItemIndicator class=\"absolute end-2 flex size-4 items-center justify-center text-primary\">\n <Check class=\"size-4\" />\n </KobalteMenubar.ItemIndicator>\n </KobalteMenubar.CheckboxItem>\n )\n}\n\nexport function MenubarRadioGroup(props: ComponentProps<typeof KobalteMenubar.RadioGroup>) {\n return <KobalteMenubar.RadioGroup {...props} />\n}\n\nexport function MenubarRadioItem(props: ComponentProps<typeof KobalteMenubar.RadioItem>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <KobalteMenubar.RadioItem class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n {local.children}\n {/* The indicator reads in the accent, like every other selected state in\n the system. */}\n <KobalteMenubar.ItemIndicator class=\"absolute end-2 flex size-4 items-center justify-center text-primary\">\n <Circle class=\"size-2 fill-current\" />\n </KobalteMenubar.ItemIndicator>\n </KobalteMenubar.RadioItem>\n )\n}\n\n/**\n * The caption of a `MenubarGroup`, and that group's accessible name. It must be a\n * child of the group it names: Kobalte reads the group from context, so a label\n * placed directly in the content throws `useMenuGroupContext must be used within\n * a Menu.Group` the moment the menu opens. For an ungrouped caption, wrap the\n * label and its items in a group anyway — the grouping is what a screen reader\n * announces.\n */\nexport function MenubarLabel(props: ComponentProps<typeof KobalteMenubar.GroupLabel>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteMenubar.GroupLabel class={cn(menuLabel, local.class)} {...rest} />\n}\n\nexport function MenubarGroup(props: ComponentProps<typeof KobalteMenubar.Group>) {\n return <KobalteMenubar.Group {...props} />\n}\n\nexport function MenubarSeparator(props: ComponentProps<typeof KobalteMenubar.Separator>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteMenubar.Separator class={cn(menuSeparator, local.class)} {...rest} />\n}\n\nexport function MenubarSub(props: ComponentProps<typeof KobalteMenubar.Sub>) {\n return <KobalteMenubar.Sub {...props} />\n}\n\nexport function MenubarSubTrigger(props: ComponentProps<typeof KobalteMenubar.SubTrigger>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <KobalteMenubar.SubTrigger class={cn(menuItem, local.class)} {...rest}>\n {local.children}\n <ChevronRight class=\"ms-auto size-4\" />\n </KobalteMenubar.SubTrigger>\n )\n}\n\nexport function MenubarSubContent(props: ComponentProps<typeof KobalteMenubar.SubContent>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteMenubar.Portal>\n <KobalteMenubar.SubContent\n {...topLayerProps}\n class={cn(\n overlaySurface,\n overlayMotion,\n 'z-(--z-menu) min-w-[8rem] origin-(--kb-menu-content-transform-origin) overflow-hidden',\n menuContentPadding,\n local.class\n )}\n {...rest}\n />\n </KobalteMenubar.Portal>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4BA,SAAgBA,UAAQiB,OAA8C;CACpE,MAAM,CAACC,OAAOC,QAAQb,WAAWW,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBACGnB,SAAcoB,WAAA,EAAA,KAAA,WAAA;EAAA,OACNL,GACL,2EACAE,MAAMI,KACR;CAAC,EAAA,GACGH,IAAI,CAAA;AAGd;;;;;;;;AASA,SAAgBI,YAAYN,OAAmD;CAC7E,OAAAG,gBAAQnB,QAAeuB,MAASP,KAAK;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A,GACGH,IAAI,CAAA;CAAA,EAAA,CAAA;AAIhB"}
|
|
1
|
+
{"version":3,"file":"menubar.js","names":["Menubar","KobalteMenubar","Check","ChevronRight","Circle","ComponentProps","splitProps","menuContentPadding","destructiveMenuItem","menuItem","menuLabel","menuSeparator","overlayMotion","overlaySurface","popoverArrow","topLayerProps","cn","props","local","rest","_$createComponent","_$mergeProps","class","MenubarMenu","Menu","MenubarTrigger","Trigger","MenubarContent","Content","Portal","children","Arrow","_$memo","MenubarItem","Item","variant","shortcut","keyshortcuts","aria-keyshortcuts","_el$","_tmpl$","_$insert","MenubarCheckboxItem","CheckboxItem","ItemIndicator","MenubarRadioGroup","RadioGroup","MenubarRadioItem","RadioItem","MenubarLabel","GroupLabel","MenubarGroup","Group","MenubarSeparator","Separator","MenubarSub","Sub","MenubarSubTrigger","SubTrigger","MenubarSubContent","SubContent","Menubar","_$createComponent","KobalteMenubar","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/menubar/menubar.tsx"],"sourcesContent":["import { Menubar as KobalteMenubar } from '@kobalte/core/menubar'\nimport { Check, ChevronRight, Circle } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport {\n menuContentPadding,\n destructiveMenuItem,\n menuItem,\n menuLabel,\n menuSeparator,\n overlayMotion,\n overlaySurface,\n popoverArrow,\n topLayerProps,\n} from '#lib/overlay'\nimport { cn } from '#lib/utils'\n\n/**\n * Menubar.\n *\n * A persistent row of menus at the top of a surface — the desktop application\n * pattern. Each trigger opens its own menu, and the arrow keys move *between*\n * menus once one is open, which is what makes a menubar a single control rather\n * than five menus that happen to be adjacent.\n *\n * This is for a window-level command surface. For actions on one thing, use\n * DropdownMenu; a menubar on a row would be a menu pretending to be chrome.\n */\nexport function Menubar(props: ComponentProps<typeof KobalteMenubar>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteMenubar\n class={cn(\n 'flex items-center gap-0.5 rounded-md border border-border bg-card p-0.5',\n local.class\n )}\n {...rest}\n />\n )\n}\n\n/**\n * One top-level menu: a trigger and the panel it opens.\n *\n * Required, and the reason the component is not just a row of triggers — the\n * menubar's arrow keys move *between* menus, which only works when each trigger\n * belongs to a menu the bar knows about. `value` names it.\n */\nexport function MenubarMenu(props: ComponentProps<typeof KobalteMenubar.Menu>) {\n return <KobalteMenubar.Menu {...props} />\n}\n\nexport function MenubarTrigger(props: ComponentProps<typeof KobalteMenubar.Trigger>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteMenubar.Trigger\n class={cn(\n 'flex items-center rounded-sm px-2 py-1 text-sm font-medium select-none',\n 'transition-colors ease-out outline-none',\n 'data-[expanded]:bg-surface-active',\n 'data-[highlighted]:bg-surface-hover',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function MenubarContent(props: ComponentProps<typeof KobalteMenubar.Content>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <KobalteMenubar.Portal>\n <KobalteMenubar.Content\n {...topLayerProps}\n class={cn(\n overlaySurface,\n overlayMotion,\n 'z-(--z-menu) min-w-[10rem] origin-(--kb-menu-content-transform-origin) overflow-hidden',\n menuContentPadding,\n local.class\n )}\n {...rest}\n >\n <KobalteMenubar.Arrow aria-hidden=\"true\" class={popoverArrow} />\n {local.children}\n </KobalteMenubar.Content>\n </KobalteMenubar.Portal>\n )\n}\n\nexport function MenubarItem(\n props: ComponentProps<typeof KobalteMenubar.Item> & {\n variant?: 'default' | 'destructive'\n shortcut?: string\n /**\n * The parseable chord behind `shortcut`, e.g. `Meta+N`. The drawn glyph is\n * `aria-hidden` — reading it out would pollute the item's accessible name —\n * so this is what assistive technology announces instead. Supply it\n * whenever `shortcut` is drawn.\n */\n keyshortcuts?: string\n }\n) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'variant',\n 'shortcut',\n 'keyshortcuts',\n 'children',\n ])\n return (\n <KobalteMenubar.Item\n class={cn(\n menuItem,\n {\n [destructiveMenuItem]: local.variant === 'destructive',\n },\n local.class\n )}\n aria-keyshortcuts={local.keyshortcuts}\n {...rest}\n >\n {local.children}\n {local.shortcut ? (\n <span\n aria-hidden=\"true\"\n class=\"text-muted-foreground ms-auto font-code text-code tracking-widest\"\n >\n {local.shortcut}\n </span>\n ) : null}\n </KobalteMenubar.Item>\n )\n}\n\nexport function MenubarCheckboxItem(props: ComponentProps<typeof KobalteMenubar.CheckboxItem>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <KobalteMenubar.CheckboxItem class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n {local.children}\n {/* The indicator reads in the accent, like every other selected state in\n the system. */}\n <KobalteMenubar.ItemIndicator\n data-slot=\"menubar-indicator\"\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Check class=\"size-4\" />\n </KobalteMenubar.ItemIndicator>\n </KobalteMenubar.CheckboxItem>\n )\n}\n\nexport function MenubarRadioGroup(props: ComponentProps<typeof KobalteMenubar.RadioGroup>) {\n return <KobalteMenubar.RadioGroup {...props} />\n}\n\nexport function MenubarRadioItem(props: ComponentProps<typeof KobalteMenubar.RadioItem>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <KobalteMenubar.RadioItem class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n {local.children}\n {/* The indicator reads in the accent, like every other selected state in\n the system. */}\n <KobalteMenubar.ItemIndicator\n data-slot=\"menubar-indicator\"\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Circle class=\"size-2 fill-current\" />\n </KobalteMenubar.ItemIndicator>\n </KobalteMenubar.RadioItem>\n )\n}\n\n/**\n * The caption of a `MenubarGroup`, and that group's accessible name. It must be a\n * child of the group it names: Kobalte reads the group from context, so a label\n * placed directly in the content throws `useMenuGroupContext must be used within\n * a Menu.Group` the moment the menu opens. For an ungrouped caption, wrap the\n * label and its items in a group anyway — the grouping is what a screen reader\n * announces.\n */\nexport function MenubarLabel(props: ComponentProps<typeof KobalteMenubar.GroupLabel>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteMenubar.GroupLabel class={cn(menuLabel, local.class)} {...rest} />\n}\n\nexport function MenubarGroup(props: ComponentProps<typeof KobalteMenubar.Group>) {\n return <KobalteMenubar.Group {...props} />\n}\n\nexport function MenubarSeparator(props: ComponentProps<typeof KobalteMenubar.Separator>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteMenubar.Separator class={cn(menuSeparator, local.class)} {...rest} />\n}\n\nexport function MenubarSub(props: ComponentProps<typeof KobalteMenubar.Sub>) {\n return <KobalteMenubar.Sub {...props} />\n}\n\nexport function MenubarSubTrigger(props: ComponentProps<typeof KobalteMenubar.SubTrigger>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <KobalteMenubar.SubTrigger class={cn(menuItem, local.class)} {...rest}>\n {local.children}\n <ChevronRight class=\"ms-auto size-4\" />\n </KobalteMenubar.SubTrigger>\n )\n}\n\nexport function MenubarSubContent(props: ComponentProps<typeof KobalteMenubar.SubContent>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteMenubar.Portal>\n <KobalteMenubar.SubContent\n {...topLayerProps}\n class={cn(\n overlaySurface,\n overlayMotion,\n 'z-(--z-menu) min-w-[8rem] origin-(--kb-menu-content-transform-origin) overflow-hidden',\n menuContentPadding,\n local.class\n )}\n {...rest}\n />\n </KobalteMenubar.Portal>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4BA,SAAgBA,UAAQiB,OAA8C;CACpE,MAAM,CAACC,OAAOC,QAAQb,WAAWW,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAG,gBACGnB,SAAcoB,WAAA,EAAA,KAAA,WAAA;EAAA,OACNL,GACL,2EACAE,MAAMI,KACR;CAAC,EAAA,GACGH,IAAI,CAAA;AAGd;;;;;;;;AASA,SAAgBI,YAAYN,OAAmD;CAC7E,OAAAG,gBAAQnB,QAAeuB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;IAC1E;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,MAAM,CAAA;IACzC,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,mBAAmB,CAAA;CAC/B,CAAA;AAkBD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,kCAalD;AAED;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,OAAO,aAAa,CAAC,OAAO,CAAC,GAAG;IAC9E,0EAA0E;IAC1E,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B,CAAA;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,kCA0BtD;AAED,wBAAgB,UAAU,CACxB,KAAK,EAAE,cAAc,CAAC,OAAO,aAAa,CAAC,IAAI,CAAC,GAAG;IACjD;;8BAE0B;IAC1B,MAAM,CAAC,EAAE,cAAc,CAAA;CACxB,kCAoBF;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,aAAa,CAAC,OAAO,CAAC,kCAGhF;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,aAAa,CAAC,KAAK,CAAC,kCAQ5E;AAED,0EAA0E;AAC1E,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,kCAEhE"}
|
|
@@ -133,6 +133,7 @@ function SelectItem(props) {
|
|
|
133
133
|
return local.children;
|
|
134
134
|
} }),
|
|
135
135
|
createComponent(Select.ItemIndicator, {
|
|
136
|
+
"data-slot": "select-indicator",
|
|
136
137
|
"class": "absolute end-2 flex size-4 items-center justify-center text-primary",
|
|
137
138
|
get children() {
|
|
138
139
|
return createComponent(Check, { "class": "size-4" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","names":["Select","KobalteSelect","Check","ChevronDown","ChevronsUpDown","ComponentProps","Show","splitProps","menuContentPadding","menuItem","menuSwatchTone","MenuSwatchTone","topLayerProps","cn","props","Option","OptGroup","local","rest","_$createComponent","_$mergeProps","gutter","SelectTriggerProps","Trigger","size","hideIcon","SelectTrigger","class","undefined","children","_$memo","when","Icon","SelectValueChildren","Value","SelectValueProps","optionLabel","option","LABEL_FIELDS","const","labelFromOption","field","value","Record","SelectValue","readLabel","state","selectedOption","SelectContentProps","Content","portalMount","HTMLElement","SelectContent","Portal","mount","Listbox","SelectItem","Item","swatch","_el$","_tmpl$","_$effect","_$className","tone","ItemLabel","ItemIndicator","SelectSection","Section","SelectLabel","Label","SelectChevronsUpDown","Select","_$createComponent","KobalteSelect","_$mergeProps","_$memo","_$className"],"sources":["../../../../src/components/ui/select/select.tsx"],"sourcesContent":["import { Select as KobalteSelect } from '@kobalte/core/select'\nimport { Check, ChevronDown, ChevronsUpDown } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport {\n menuContentPadding,\n menuItem,\n menuSwatchTone,\n type MenuSwatchTone,\n topLayerProps,\n} from '#lib/overlay'\nimport { cn } from '#lib/utils'\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 * `Select.Value` 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>(\n props: ComponentProps<typeof KobalteSelect<Option, OptGroup>>\n) {\n // Kobalte's own default gutter is 8px; without the arrow (removed below) the\n // popper no longer folds half an arrow box into that offset, and 8px read as\n // a detached list. Four pixels is shadcn's `sideOffset` — attached, with\n // room for the trigger's own border.\n const [local, rest] = splitProps(props, ['gutter'])\n return <KobalteSelect gutter={local.gutter ?? 4} {...rest} />\n}\n\nexport type SelectTriggerProps = ComponentProps<typeof KobalteSelect.Trigger> & {\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 [local, rest] = splitProps(props, ['class', 'size', 'hideIcon', 'children'])\n\n return (\n <KobalteSelect.Trigger\n data-slot=\"select-trigger\"\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': local.size === 'sm',\n 'h-control-md text-sm': local.size === 'md' || local.size === undefined,\n 'h-control-lg text-sm': local.size === 'lg',\n },\n local.class\n )}\n {...rest}\n >\n {local.children}\n <Show when={!local.hideIcon}>\n <KobalteSelect.Icon class=\"text-muted-foreground\">\n <ChevronDown />\n </KobalteSelect.Icon>\n </Show>\n </KobalteSelect.Trigger>\n )\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 all.\n * Kobalte's own `Value` draws *only* its children, so a bare `<SelectValue />`\n * shows the placeholder and then goes blank the moment something is chosen: the\n * value is there, nothing paints it.\n *\n * Kobalte cannot supply a default itself, because an option is the caller's type\n * — it has no way to know which field is the label. So this reads 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 */\ntype SelectValueChildren = ComponentProps<typeof KobalteSelect.Value>['children']\n\nexport type SelectValueProps = ComponentProps<typeof KobalteSelect.Value> & {\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?: SelectValueChildren\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 [local, rest] = splitProps(props, ['class', 'children', 'optionLabel'])\n\n const readLabel = (state: { selectedOption: () => unknown }): string => {\n const option = state.selectedOption()\n return local.optionLabel ? local.optionLabel(option) : labelFromOption(option)\n }\n\n return (\n <KobalteSelect.Value data-slot=\"select-value\" class={cn('truncate', local.class)} {...rest}>\n {local.children ?? (readLabel as unknown as SelectValueChildren)}\n </KobalteSelect.Value>\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 = ComponentProps<typeof KobalteSelect.Content> & {\n /** Keep a nested menu inside its enclosing modal's accessible subtree. */\n portalMount?: HTMLElement\n}\n\nexport function SelectContent(props: SelectContentProps) {\n const [local, rest] = splitProps(props, ['class', 'children', 'portalMount'])\n\n return (\n <KobalteSelect.Portal mount={local.portalMount}>\n <KobalteSelect.Content\n {...topLayerProps}\n class={cn(\n 'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg',\n 'z-(--z-menu) max-h-(--kb-popper-content-available-height) min-w-[8rem] origin-(--kb-select-content-transform-origin) overflow-y-auto overflow-x-hidden',\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 local.class\n )}\n {...rest}\n >\n {local.children}\n {/* No arrow: the list is the trigger's own value opened up, and Kobalte\n reserves half the arrow's 30px box as popper gutter, which is where\n the reported gap between a form trigger and its options came from. */}\n <KobalteSelect.Listbox class=\"flex flex-col\" />\n </KobalteSelect.Content>\n </KobalteSelect.Portal>\n )\n}\n\nexport function SelectItem(\n props: ComponentProps<typeof KobalteSelect.Item> & {\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) {\n const [local, rest] = splitProps(props, ['class', 'children', 'swatch'])\n\n return (\n <KobalteSelect.Item class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n <Show when={local.swatch}>\n <span aria-hidden=\"true\" class={menuSwatchTone({ tone: local.swatch })} />\n </Show>\n <KobalteSelect.ItemLabel>{local.children}</KobalteSelect.ItemLabel>\n {/* The indicator reads in the accent, like every other selected state in\n the system — the row's own foreground reads as decoration. */}\n <KobalteSelect.ItemIndicator class=\"absolute end-2 flex size-4 items-center justify-center text-primary\">\n <Check class=\"size-4\" />\n </KobalteSelect.ItemIndicator>\n </KobalteSelect.Item>\n )\n}\n\nexport function SelectSection(props: ComponentProps<typeof KobalteSelect.Section>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteSelect.Section class={cn('flex flex-col', local.class)} {...rest} />\n}\n\nexport function SelectLabel(props: ComponentProps<typeof KobalteSelect.Label>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteSelect.Label\n class={cn('text-muted-foreground px-2 py-1.5 text-2xs font-medium uppercase', local.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 <ChevronsUpD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"version":3,"file":"select.js","names":["Select","KobalteSelect","Check","ChevronDown","ChevronsUpDown","ComponentProps","Show","splitProps","menuContentPadding","menuItem","menuSwatchTone","MenuSwatchTone","topLayerProps","cn","props","Option","OptGroup","local","rest","_$createComponent","_$mergeProps","gutter","SelectTriggerProps","Trigger","size","hideIcon","SelectTrigger","class","undefined","children","_$memo","when","Icon","SelectValueChildren","Value","SelectValueProps","optionLabel","option","LABEL_FIELDS","const","labelFromOption","field","value","Record","SelectValue","readLabel","state","selectedOption","SelectContentProps","Content","portalMount","HTMLElement","SelectContent","Portal","mount","Listbox","SelectItem","Item","swatch","_el$","_tmpl$","_$effect","_$className","tone","ItemLabel","ItemIndicator","SelectSection","Section","SelectLabel","Label","SelectChevronsUpDown","Select","_$createComponent","KobalteSelect","_$mergeProps","_$memo","_$className"],"sources":["../../../../src/components/ui/select/select.tsx"],"sourcesContent":["import { Select as KobalteSelect } from '@kobalte/core/select'\nimport { Check, ChevronDown, ChevronsUpDown } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport {\n menuContentPadding,\n menuItem,\n menuSwatchTone,\n type MenuSwatchTone,\n topLayerProps,\n} from '#lib/overlay'\nimport { cn } from '#lib/utils'\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 * `Select.Value` 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>(\n props: ComponentProps<typeof KobalteSelect<Option, OptGroup>>\n) {\n // Kobalte's own default gutter is 8px; without the arrow (removed below) the\n // popper no longer folds half an arrow box into that offset, and 8px read as\n // a detached list. Four pixels is shadcn's `sideOffset` — attached, with\n // room for the trigger's own border.\n const [local, rest] = splitProps(props, ['gutter'])\n return <KobalteSelect gutter={local.gutter ?? 4} {...rest} />\n}\n\nexport type SelectTriggerProps = ComponentProps<typeof KobalteSelect.Trigger> & {\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 [local, rest] = splitProps(props, ['class', 'size', 'hideIcon', 'children'])\n\n return (\n <KobalteSelect.Trigger\n data-slot=\"select-trigger\"\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': local.size === 'sm',\n 'h-control-md text-sm': local.size === 'md' || local.size === undefined,\n 'h-control-lg text-sm': local.size === 'lg',\n },\n local.class\n )}\n {...rest}\n >\n {local.children}\n <Show when={!local.hideIcon}>\n <KobalteSelect.Icon class=\"text-muted-foreground\">\n <ChevronDown />\n </KobalteSelect.Icon>\n </Show>\n </KobalteSelect.Trigger>\n )\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 all.\n * Kobalte's own `Value` draws *only* its children, so a bare `<SelectValue />`\n * shows the placeholder and then goes blank the moment something is chosen: the\n * value is there, nothing paints it.\n *\n * Kobalte cannot supply a default itself, because an option is the caller's type\n * — it has no way to know which field is the label. So this reads 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 */\ntype SelectValueChildren = ComponentProps<typeof KobalteSelect.Value>['children']\n\nexport type SelectValueProps = ComponentProps<typeof KobalteSelect.Value> & {\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?: SelectValueChildren\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 [local, rest] = splitProps(props, ['class', 'children', 'optionLabel'])\n\n const readLabel = (state: { selectedOption: () => unknown }): string => {\n const option = state.selectedOption()\n return local.optionLabel ? local.optionLabel(option) : labelFromOption(option)\n }\n\n return (\n <KobalteSelect.Value data-slot=\"select-value\" class={cn('truncate', local.class)} {...rest}>\n {local.children ?? (readLabel as unknown as SelectValueChildren)}\n </KobalteSelect.Value>\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 = ComponentProps<typeof KobalteSelect.Content> & {\n /** Keep a nested menu inside its enclosing modal's accessible subtree. */\n portalMount?: HTMLElement\n}\n\nexport function SelectContent(props: SelectContentProps) {\n const [local, rest] = splitProps(props, ['class', 'children', 'portalMount'])\n\n return (\n <KobalteSelect.Portal mount={local.portalMount}>\n <KobalteSelect.Content\n {...topLayerProps}\n class={cn(\n 'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg',\n 'z-(--z-menu) max-h-(--kb-popper-content-available-height) min-w-[8rem] origin-(--kb-select-content-transform-origin) overflow-y-auto overflow-x-hidden',\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 local.class\n )}\n {...rest}\n >\n {local.children}\n {/* No arrow: the list is the trigger's own value opened up, and Kobalte\n reserves half the arrow's 30px box as popper gutter, which is where\n the reported gap between a form trigger and its options came from. */}\n <KobalteSelect.Listbox class=\"flex flex-col\" />\n </KobalteSelect.Content>\n </KobalteSelect.Portal>\n )\n}\n\nexport function SelectItem(\n props: ComponentProps<typeof KobalteSelect.Item> & {\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) {\n const [local, rest] = splitProps(props, ['class', 'children', 'swatch'])\n\n return (\n <KobalteSelect.Item class={cn(menuItem, 'pe-8', local.class)} {...rest}>\n <Show when={local.swatch}>\n <span aria-hidden=\"true\" class={menuSwatchTone({ tone: local.swatch })} />\n </Show>\n <KobalteSelect.ItemLabel>{local.children}</KobalteSelect.ItemLabel>\n {/* The indicator reads in the accent, like every other selected state in\n the system — the row's own foreground reads as decoration. */}\n <KobalteSelect.ItemIndicator\n data-slot=\"select-indicator\"\n class=\"absolute end-2 flex size-4 items-center justify-center text-primary\"\n >\n <Check class=\"size-4\" />\n </KobalteSelect.ItemIndicator>\n </KobalteSelect.Item>\n )\n}\n\nexport function SelectSection(props: ComponentProps<typeof KobalteSelect.Section>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteSelect.Section class={cn('flex flex-col', local.class)} {...rest} />\n}\n\nexport function SelectLabel(props: ComponentProps<typeof KobalteSelect.Label>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteSelect.Label\n class={cn('text-muted-foreground px-2 py-1.5 text-2xs font-medium uppercase', local.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} />\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0BA,SAAgBA,SACdc,OACA;CAKA,MAAM,CAACG,OAAOC,QAAQX,WAAWO,OAAO,CAAC,QAAQ,CAAC;CAClD,OAAAK,gBAAQlB,QAAamB,WAAA,EAAA,IAACC,SAAM;EAAA,OAAEJ,MAAMI,UAAU;CAAC,EAAA,GAAMH,IAAI,CAAA;AAC3D;AAQA,SAAgBQ,cAAcZ,OAA2B;CACvD,MAAM,CAACG,OAAOC,QAAQX,WAAWO,OAAO;EAAC;EAAS;EAAQ;EAAY;CAAU,CAAC;CAEjF,OAAAK,gBACGlB,OAAcsB,SAAOH,WAAA;EAAA,aAAA;EAAA,KAAA,WAAA;GAAA,OAEbP,GACL,6GACA,sFACA,kDACA,sBACA,oFACA,4FACA,gFACA,oJACA,+DACA;IACE,wBAAwBI,MAAMO,SAAS;IACvC,wBAAwBP,MAAMO,SAAS,QAAQP,MAAMO,SAASI,KAAAA;IAC9D,wBAAwBX,MAAMO,SAAS;GACzC,GACAP,MAAMU,KACR;EAAC;CAAA,GACGT,MAAI,EAAA,IAAAW,WAAA;EAAA,OAAA,CAAAC,WAEPb,MAAMY,QAAQ,GAAAV,gBACdb,MAAI;GAAA,IAACyB,OAAI;IAAA,OAAE,CAACd,MAAMQ;GAAQ;GAAA,IAAAI,WAAA;IAAA,OAAAV,gBACxBlB,OAAc+B,MAAI;KAAA,SAAA;KAAA,IAAAH,WAAA;MAAA,OAAAV,gBAChBhB,aAAW,CAAA,CAAA;KAAA;IAAA,CAAA;GAAA;EAAA,CAAA,CAAA;CAAA,EAAA,CAAA,CAAA;AAKtB;;AAgCA,IAAMmC,eAAe;CAAC;CAAS;CAAQ;AAAW;AAElD,SAASE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FT,IAAI,CAAA;AAGd;;AAGA,SAAgBoD,qBAAqBxD,OAA8B;CACjE,OAAAK,gBAAQf,gBAAcgB,WAAA,EAAA,eAAA,OAAA,GAAwBN,KAAK,CAAA;AACrD"}
|
|
@@ -12,7 +12,7 @@ import { type VariantProps } from '#lib/variants';
|
|
|
12
12
|
* Kobalte supplies the pressed state and the keyboard behaviour; the styling
|
|
13
13
|
* adds the one thing a headless primitive cannot know — that a pressed toggle
|
|
14
14
|
* in a toolbar should read as *filled*, not merely outlined. Pressed reads on
|
|
15
|
-
* the accent rung (`primary-subtle
|
|
15
|
+
* the accent rung (`primary-subtle`, foreground text, accent glyph): pressed is the
|
|
16
16
|
* control's on state, the same family the checked checkbox and switch own, so
|
|
17
17
|
* it keeps a touch of the user's accent instead of a neutral fill.
|
|
18
18
|
*/
|
|
@@ -15,11 +15,11 @@ import { ToggleButton } from "@kobalte/core/toggle-button";
|
|
|
15
15
|
* Kobalte supplies the pressed state and the keyboard behaviour; the styling
|
|
16
16
|
* adds the one thing a headless primitive cannot know — that a pressed toggle
|
|
17
17
|
* in a toolbar should read as *filled*, not merely outlined. Pressed reads on
|
|
18
|
-
* the accent rung (`primary-subtle
|
|
18
|
+
* the accent rung (`primary-subtle`, foreground text, accent glyph): pressed is the
|
|
19
19
|
* control's on state, the same family the checked checkbox and switch own, so
|
|
20
20
|
* it keeps a touch of the user's accent instead of a neutral fill.
|
|
21
21
|
*/
|
|
22
|
-
var toggleVariants = cva(`${controlInteractive} inline-flex items-center justify-center rounded-md font-medium whitespace-nowrap select-none hover:bg-surface-hover hover:text-foreground data-[pressed]:bg-primary-subtle data-[pressed]:text-primary disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`, {
|
|
22
|
+
var toggleVariants = cva(`${controlInteractive} inline-flex items-center justify-center rounded-md font-medium whitespace-nowrap select-none hover:bg-surface-hover hover:text-foreground data-[pressed]:bg-primary-subtle data-[pressed]:text-foreground data-[pressed]:[&_svg]:text-primary disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`, {
|
|
23
23
|
variants: {
|
|
24
24
|
variant: {
|
|
25
25
|
default: "bg-transparent",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.js","names":["ToggleButton","ComponentProps","splitProps","cva","controlInteractive","controlSize","VariantProps","cn","toggleVariants","variants","variant","default","outline","subtle","size","xs","sm","md","lg","xl","defaultVariants","ToggleProps","Toggle","props","local","rest","_$createComponent","_$mergeProps","class","_$createComponent","_$mergeProps"],"sources":["../../../../src/components/ui/toggle/toggle.tsx"],"sourcesContent":["import { ToggleButton } from '@kobalte/core/toggle-button'\nimport type { ComponentProps } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { cva, controlInteractive, controlSize, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Toggle.\n *\n * A button that stays pressed. The difference from Button is state, not looks:\n * a Toggle reports `aria-pressed` and holds its pressed appearance until\n * released, which is what makes it right for a formatting control and wrong\n * for a command.\n *\n * Kobalte supplies the pressed state and the keyboard behaviour; the styling\n * adds the one thing a headless primitive cannot know — that a pressed toggle\n * in a toolbar should read as *filled*, not merely outlined. Pressed reads on\n * the accent rung (`primary-subtle
|
|
1
|
+
{"version":3,"file":"toggle.js","names":["ToggleButton","ComponentProps","splitProps","cva","controlInteractive","controlSize","VariantProps","cn","toggleVariants","variants","variant","default","outline","subtle","size","xs","sm","md","lg","xl","defaultVariants","ToggleProps","Toggle","props","local","rest","_$createComponent","_$mergeProps","class","_$createComponent","_$mergeProps"],"sources":["../../../../src/components/ui/toggle/toggle.tsx"],"sourcesContent":["import { ToggleButton } from '@kobalte/core/toggle-button'\nimport type { ComponentProps } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { cva, controlInteractive, controlSize, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Toggle.\n *\n * A button that stays pressed. The difference from Button is state, not looks:\n * a Toggle reports `aria-pressed` and holds its pressed appearance until\n * released, which is what makes it right for a formatting control and wrong\n * for a command.\n *\n * Kobalte supplies the pressed state and the keyboard behaviour; the styling\n * adds the one thing a headless primitive cannot know — that a pressed toggle\n * in a toolbar should read as *filled*, not merely outlined. Pressed reads on\n * the accent rung (`primary-subtle`, foreground text, accent glyph): pressed is the\n * control's on state, the same family the checked checkbox and switch own, so\n * it keeps a touch of the user's accent instead of a neutral fill.\n */\nexport const toggleVariants = cva(\n `${controlInteractive} inline-flex items-center justify-center rounded-md font-medium whitespace-nowrap select-none hover:bg-surface-hover hover:text-foreground data-[pressed]:bg-primary-subtle data-[pressed]:text-foreground data-[pressed]:[&_svg]:text-primary disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,\n {\n variants: {\n variant: {\n default: 'bg-transparent',\n /** Sits inside a field or toolbar that already has a fill. */\n outline: 'border border-border bg-transparent',\n /** Filled even when unpressed, for a segmented control's idle item. */\n subtle: 'bg-surface-hover',\n },\n size: {\n '2xs': `${controlSize['2xs']} [&_svg]:size-3`,\n xs: `${controlSize.xs} [&_svg]:size-3.5`,\n sm: `${controlSize.sm} [&_svg]:size-3.5`,\n md: `${controlSize.md} [&_svg]:size-4`,\n lg: `${controlSize.lg} [&_svg]:size-4`,\n xl: `${controlSize.xl} [&_svg]:size-5`,\n '2xl': `${controlSize['2xl']} [&_svg]:size-6`,\n 'icon-2xs': 'size-control-2xs p-0 [&_svg]:size-3',\n 'icon-xs': 'size-control-xs p-0 [&_svg]:size-3.5',\n 'icon-sm': 'size-control-sm p-0 [&_svg]:size-3.5',\n 'icon-md': 'size-control-md p-0 [&_svg]:size-4',\n 'icon-lg': 'size-control-lg p-0 [&_svg]:size-4',\n 'icon-xl': 'size-control-xl p-0 [&_svg]:size-5',\n 'icon-2xl': 'size-control-2xl p-0 [&_svg]:size-6',\n },\n },\n defaultVariants: { variant: 'default', size: 'md' },\n }\n)\n\nexport type ToggleProps = ComponentProps<typeof ToggleButton> & VariantProps<typeof toggleVariants>\n\nexport function Toggle(props: ToggleProps) {\n const [local, rest] = splitProps(props, ['variant', 'size', 'class'])\n\n return (\n <ToggleButton\n data-slot=\"toggle\"\n class={cn(toggleVariants({ variant: local.variant, size: local.size }), local.class)}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,IAAaQ,iBAAiBL,IAC5B,GAAGC,mBAAkB,+UACrB;CACEK,UAAU;EACRC,SAAS;GACPC,SAAS;;GAETC,SAAS;;GAETC,QAAQ;EACV;EACAC,MAAM;GACJ,OAAO,GAAGT,YAAY,OAAM;GAC5BU,IAAI,GAAGV,YAAYU,GAAE;GACrBC,IAAI,GAAGX,YAAYW,GAAE;GACrBC,IAAI,GAAGZ,YAAYY,GAAE;GACrBC,IAAI,GAAGb,YAAYa,GAAE;GACrBC,IAAI,GAAGd,YAAYc,GAAE;GACrB,OAAO,GAAGd,YAAY,OAAM;GAC5B,YAAY;GACZ,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;GACX,YAAY;EACd;CACF;CACAe,iBAAiB;EAAEV,SAAS;EAAWI,MAAM;CAAK;AACpD,CACF;AAIA,SAAgBQ,OAAOC,OAAoB;CACzC,MAAM,CAACC,OAAOC,QAAQvB,WAAWqB,OAAO;EAAC;EAAW;EAAQ;CAAO,CAAC;CAEpE,OAAAG,gBACG1B,cAAY2B,WAAA;EAAA,aAAA;EAAA,KAAA,WAAA;GAAA,OAEJpB,GAAGC,eAAe;IAAEE,SAASc,MAAMd;IAASI,MAAMU,MAAMV;GAAK,CAAC,GAAGU,MAAMI,KAAK;EAAC;CAAA,GAChFH,IAAI,CAAA;AAGd"}
|
package/dist/lib/overlay.d.ts
CHANGED
|
@@ -61,6 +61,12 @@ export declare const popoverArrow = "fill-popover stroke-border";
|
|
|
61
61
|
/**
|
|
62
62
|
* A menu row: the shared height, radius, hover fill and focus treatment for
|
|
63
63
|
* every item inside a menu, listbox or command list.
|
|
64
|
+
*
|
|
65
|
+
* The row sizes and dims the icons a caller puts in it, but not the glyph of
|
|
66
|
+
* its selection indicator (any `[data-slot$=-indicator]`): a descendant `svg`
|
|
67
|
+
* rule outranks a single utility on the glyph, so without the exclusion a
|
|
68
|
+
* radio item's `size-2` dot drew as a 16px muted disc and every check lost the
|
|
69
|
+
* indicator's accent.
|
|
64
70
|
*/
|
|
65
71
|
export declare const menuItem: string;
|
|
66
72
|
/** A destructive action keeps readable text and marks its row with a status edge. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../src/lib/overlay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAEtD;+EAC+E;AAC/E,eAAO,MAAM,cAAc,iFACqD,CAAA;AAEhF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,4EACiD,CAAA;AAE3E;;;GAGG;AACH,eAAO,MAAM,YAAY,wDAAwD,CAAA;AAEjF,yEAAyE;AACzE,eAAO,MAAM,iBAAiB,6DAA6D,CAAA;AAE3F,gDAAgD;AAChD,eAAO,MAAM,YAAY,yFAC+D,CAAA;AAExF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,+FACuE,CAAA;AAE9F;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,QAIf,CAAA;AAEX;qCACqC;AACrC,eAAO,MAAM,aAAa,QAGf,CAAA;AAEX,+DAA+D;AAC/D,eAAO,MAAM,YAAY,+BAA+B,CAAA;AAExD
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../src/lib/overlay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAEtD;+EAC+E;AAC/E,eAAO,MAAM,cAAc,iFACqD,CAAA;AAEhF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,4EACiD,CAAA;AAE3E;;;GAGG;AACH,eAAO,MAAM,YAAY,wDAAwD,CAAA;AAEjF,yEAAyE;AACzE,eAAO,MAAM,iBAAiB,6DAA6D,CAAA;AAE3F,gDAAgD;AAChD,eAAO,MAAM,YAAY,yFAC+D,CAAA;AAExF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,+FACuE,CAAA;AAE9F;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,QAIf,CAAA;AAEX;qCACqC;AACrC,eAAO,MAAM,aAAa,QAGf,CAAA;AAEX,+DAA+D;AAC/D,eAAO,MAAM,YAAY,+BAA+B,CAAA;AAExD;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,QAQV,CAAA;AAEX,qFAAqF;AACrF,eAAO,MAAM,mBAAmB,kGACiE,CAAA;AAEjG,4CAA4C;AAC5C,eAAO,MAAM,SAAS,mFAC4D,CAAA;AAElF,oCAAoC;AACpC,eAAO,MAAM,aAAa,8BAA8B,CAAA;AAExD;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;;8EAYzB,CAAA;AAEF,8CAA8C;AAC9C,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAErF,iDAAiD;AACjD,eAAO,MAAM,kBAAkB,QAAQ,CAAA;AAEvC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa;;CAAuC,CAAA"}
|
package/dist/lib/overlay.js
CHANGED
|
@@ -66,14 +66,21 @@ var popoverArrow = "fill-popover stroke-border";
|
|
|
66
66
|
/**
|
|
67
67
|
* A menu row: the shared height, radius, hover fill and focus treatment for
|
|
68
68
|
* every item inside a menu, listbox or command list.
|
|
69
|
+
*
|
|
70
|
+
* The row sizes and dims the icons a caller puts in it, but not the glyph of
|
|
71
|
+
* its selection indicator (any `[data-slot$=-indicator]`): a descendant `svg`
|
|
72
|
+
* rule outranks a single utility on the glyph, so without the exclusion a
|
|
73
|
+
* radio item's `size-2` dot drew as a 16px muted disc and every check lost the
|
|
74
|
+
* indicator's accent.
|
|
69
75
|
*/
|
|
70
76
|
var menuItem = [
|
|
71
77
|
"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none",
|
|
72
78
|
"transition-colors ease-out",
|
|
73
79
|
"data-[highlighted]:bg-surface-hover data-[highlighted]:text-foreground",
|
|
74
80
|
"data-[disabled]:pointer-events-none data-[disabled]:text-muted-foreground",
|
|
75
|
-
"[&_svg]:pointer-events-none [&_svg]:shrink-0
|
|
76
|
-
"[&_svg:not([
|
|
81
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
82
|
+
"[&_svg:not([data-slot$=-indicator]_*)]:size-4",
|
|
83
|
+
"[&_svg:not([class*=text-]):not([data-slot$=-indicator]_*)]:text-muted-foreground"
|
|
77
84
|
].join(" ");
|
|
78
85
|
/** A destructive action keeps readable text and marks its row with a status edge. */
|
|
79
86
|
var destructiveMenuItem = "border-s-2 border-destructive ps-1.5 text-foreground data-[highlighted]:bg-destructive-subtle";
|
package/dist/lib/overlay.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.js","names":[],"sources":["../../src/lib/overlay.ts"],"sourcesContent":["/**\n * Shared strings for the overlay layer: dialogs, sheets, menus, popovers,\n * tooltips and the command palette.\n *\n * These live here rather than in each component because the overlay family is\n * where consistency is most visible and least likely to survive duplication.\n * A dialog, a sheet and a dropdown that disagree about their border, radius,\n * motion or shadow read as three different apps — and an app that adopts this\n * library would inherit all three. Declaring the surface once is what makes\n * \"an overlay looks like this\" a fact rather than a convention.\n */\n\nimport { cva, type VariantProps } from '#lib/variants'\n\n/** The panel itself: fill, hairline edge, radius, elevation. Menus, popovers\n * and the command palette float on the elevated overlay rung (`--popover`). */\nexport const overlaySurface =\n 'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg'\n\n/**\n * The modal panel: the same hairline edge, radius and elevation, painted on the\n * *neutral* theme surface instead of the elevated overlay rung.\n *\n * `--popover` is the catalogue's `surfaceElevated`, whose derivation amplifies\n * the canvas hue's chroma on the elevated step. On the dark default's violet\n * canvas that makes the dialog the most chromatic surface in the ladder —\n * `oklch(0.2406 0.0088 300.91)`, red above green in sRGB — and on a full dialog\n * panel that cast reads as a warm tint the canvas never has. shadcn's own\n * convention already splits the two: a Dialog paints `bg-background`, menus and\n * popovers paint `bg-popover`. The veil, the hairline and the elevation shadow\n * carry the separation the lighter fill no longer provides.\n */\nexport const dialogSurface =\n 'bg-background text-foreground rounded-xl border border-border shadow-lg'\n\n/**\n * Overlay titles have one fixed typography role. Keep this small recipe shared\n * without loading the configurable Heading component into every dialog.\n */\nexport const overlayTitle = 'font-semibold text-base tracking-tight leading-none'\n\n/** The span of the portal wrapper that centres a dialog-like overlay. */\nexport const overlayPositioner = 'fixed inset-0 z-(--z-dialog) grid place-items-center p-4'\n\n/** The dimming layer behind a modal overlay. */\nexport const overlayScrim =\n 'fixed inset-0 z-(--z-dialog) bg-scrim/50 supports-[backdrop-filter]:backdrop-blur-xs'\n\n/**\n * The tip: the card-toned bubble an explanation shows in. The side rail draws\n * it flush to a collapsed row and every floating tooltip composes the same\n * fill, edge, and type, so a control never explains itself in two visual\n * languages.\n */\nexport const tooltipTip =\n 'bg-card text-card-foreground rounded-md border border-border text-sm font-medium shadow-lg'\n\n/**\n * Entrance and exit motion, expressed as data-state classes.\n *\n * `data-expanded` / `data-closed` are Kobalte's; `data-side-*` come from its\n * popper positioning and let a menu slide in from the edge it is anchored to,\n * which is what makes a dropdown feel attached to its trigger rather than\n * dropped on the screen. Exit motion is shorter than entry, because a\n * dismissal should feel immediate while an arrival benefits from being seen.\n */\nexport const overlayMotion = [\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-200 data-closed:duration-150',\n].join(' ')\n\n/** Popover-style motion: no zoom, so a panel anchored to a control does not\n * appear to breathe away from it. */\nexport const popoverMotion = [\n 'data-expanded:animate-in data-expanded:fade-in-0 data-closed:animate-out data-closed:fade-out-0',\n 'data-expanded:duration-150 data-closed:duration-100',\n].join(' ')\n\n/** The popper arrow. Sized in the component; coloured here. */\nexport const popoverArrow = 'fill-popover stroke-border'\n\n/**\n * A menu row: the shared height, radius, hover fill and focus treatment for\n * every item inside a menu, listbox or command list.\n */\nexport const menuItem = [\n 'relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none',\n 'transition-colors ease-out',\n 'data-[highlighted]:bg-surface-hover data-[highlighted]:text-foreground',\n 'data-[disabled]:pointer-events-none data-[disabled]:text-muted-foreground',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0
|
|
1
|
+
{"version":3,"file":"overlay.js","names":[],"sources":["../../src/lib/overlay.ts"],"sourcesContent":["/**\n * Shared strings for the overlay layer: dialogs, sheets, menus, popovers,\n * tooltips and the command palette.\n *\n * These live here rather than in each component because the overlay family is\n * where consistency is most visible and least likely to survive duplication.\n * A dialog, a sheet and a dropdown that disagree about their border, radius,\n * motion or shadow read as three different apps — and an app that adopts this\n * library would inherit all three. Declaring the surface once is what makes\n * \"an overlay looks like this\" a fact rather than a convention.\n */\n\nimport { cva, type VariantProps } from '#lib/variants'\n\n/** The panel itself: fill, hairline edge, radius, elevation. Menus, popovers\n * and the command palette float on the elevated overlay rung (`--popover`). */\nexport const overlaySurface =\n 'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg'\n\n/**\n * The modal panel: the same hairline edge, radius and elevation, painted on the\n * *neutral* theme surface instead of the elevated overlay rung.\n *\n * `--popover` is the catalogue's `surfaceElevated`, whose derivation amplifies\n * the canvas hue's chroma on the elevated step. On the dark default's violet\n * canvas that makes the dialog the most chromatic surface in the ladder —\n * `oklch(0.2406 0.0088 300.91)`, red above green in sRGB — and on a full dialog\n * panel that cast reads as a warm tint the canvas never has. shadcn's own\n * convention already splits the two: a Dialog paints `bg-background`, menus and\n * popovers paint `bg-popover`. The veil, the hairline and the elevation shadow\n * carry the separation the lighter fill no longer provides.\n */\nexport const dialogSurface =\n 'bg-background text-foreground rounded-xl border border-border shadow-lg'\n\n/**\n * Overlay titles have one fixed typography role. Keep this small recipe shared\n * without loading the configurable Heading component into every dialog.\n */\nexport const overlayTitle = 'font-semibold text-base tracking-tight leading-none'\n\n/** The span of the portal wrapper that centres a dialog-like overlay. */\nexport const overlayPositioner = 'fixed inset-0 z-(--z-dialog) grid place-items-center p-4'\n\n/** The dimming layer behind a modal overlay. */\nexport const overlayScrim =\n 'fixed inset-0 z-(--z-dialog) bg-scrim/50 supports-[backdrop-filter]:backdrop-blur-xs'\n\n/**\n * The tip: the card-toned bubble an explanation shows in. The side rail draws\n * it flush to a collapsed row and every floating tooltip composes the same\n * fill, edge, and type, so a control never explains itself in two visual\n * languages.\n */\nexport const tooltipTip =\n 'bg-card text-card-foreground rounded-md border border-border text-sm font-medium shadow-lg'\n\n/**\n * Entrance and exit motion, expressed as data-state classes.\n *\n * `data-expanded` / `data-closed` are Kobalte's; `data-side-*` come from its\n * popper positioning and let a menu slide in from the edge it is anchored to,\n * which is what makes a dropdown feel attached to its trigger rather than\n * dropped on the screen. Exit motion is shorter than entry, because a\n * dismissal should feel immediate while an arrival benefits from being seen.\n */\nexport const overlayMotion = [\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-200 data-closed:duration-150',\n].join(' ')\n\n/** Popover-style motion: no zoom, so a panel anchored to a control does not\n * appear to breathe away from it. */\nexport const popoverMotion = [\n 'data-expanded:animate-in data-expanded:fade-in-0 data-closed:animate-out data-closed:fade-out-0',\n 'data-expanded:duration-150 data-closed:duration-100',\n].join(' ')\n\n/** The popper arrow. Sized in the component; coloured here. */\nexport const popoverArrow = 'fill-popover stroke-border'\n\n/**\n * A menu row: the shared height, radius, hover fill and focus treatment for\n * every item inside a menu, listbox or command list.\n *\n * The row sizes and dims the icons a caller puts in it, but not the glyph of\n * its selection indicator (any `[data-slot$=-indicator]`): a descendant `svg`\n * rule outranks a single utility on the glyph, so without the exclusion a\n * radio item's `size-2` dot drew as a 16px muted disc and every check lost the\n * indicator's accent.\n */\nexport const menuItem = [\n 'relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none',\n 'transition-colors ease-out',\n 'data-[highlighted]:bg-surface-hover data-[highlighted]:text-foreground',\n 'data-[disabled]:pointer-events-none data-[disabled]:text-muted-foreground',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0',\n '[&_svg:not([data-slot$=-indicator]_*)]:size-4',\n '[&_svg:not([class*=text-]):not([data-slot$=-indicator]_*)]:text-muted-foreground',\n].join(' ')\n\n/** A destructive action keeps readable text and marks its row with a status edge. */\nexport const destructiveMenuItem =\n 'border-s-2 border-destructive ps-1.5 text-foreground data-[highlighted]:bg-destructive-subtle'\n\n/** The label above a group of menu rows. */\nexport const menuLabel =\n 'px-2 py-1.5 text-2xs font-medium tracking-wide text-muted-foreground uppercase'\n\n/** The rule between menu groups. */\nexport const menuSeparator = 'bg-border -mx-1 my-1 h-px'\n\n/**\n * A leading colour swatch on a menu or select row: the sanctioned way to carry\n * a card-tone colour into a list of options. The tones are the system's accent\n * and status roles — the vocabulary a Badge already speaks — so the colour an\n * option shows in a menu is the colour its badge carries on a card, and a\n * caller never passes a raw colour into a list. The dot is `aria-hidden`; the\n * label carries the meaning, so a tone is never the only signal.\n */\nexport const menuSwatchTone = cva('size-2 shrink-0 rounded-full', {\n variants: {\n tone: {\n neutral: 'bg-muted-foreground',\n primary: 'bg-primary',\n success: 'bg-success',\n warning: 'bg-warning',\n destructive: 'bg-destructive',\n info: 'bg-info',\n },\n },\n defaultVariants: { tone: 'neutral' },\n})\n\n/** The tones a menu row's swatch can take. */\nexport type MenuSwatchTone = NonNullable<VariantProps<typeof menuSwatchTone>['tone']>\n\n/** Padding shared by every menu-list surface. */\nexport const menuContentPadding = 'p-1'\n\n/**\n * Marks a floating layer — a menu, a listbox, a popover — as part of the top\n * layer.\n *\n * A modal dialog hides everything outside itself from assistive technology\n * (`aria-hidden` on its siblings) and keeps watching `<body>` for new nodes.\n * A menu or select opened from inside the dialog portals to `<body>`, so the\n * dialog hid it too: the list was on screen, focused, and invisible to a\n * screen reader, and an outside-click check could treat a click on it as a\n * click away from the dialog. Kobalte exempts nodes carrying this attribute\n * from both, so every floating layer carries it.\n */\nexport const topLayerProps = { 'data-kb-top-layer': '' } as const\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,IAAa,iBACX;;;;;;;;;;;;;;AAeF,IAAa,gBACX;;;;;AAMF,IAAa,eAAe;;AAG5B,IAAa,oBAAoB;;AAGjC,IAAa,eACX;;;;;;;AAQF,IAAa,aACX;;;;;;;;;;AAWF,IAAa,gBAAgB;CAC3B;CACA;CACA;AACF,CAAC,CAAC,KAAK,GAAG;;;AAIV,IAAa,gBAAgB,CAC3B,mGACA,qDACF,CAAC,CAAC,KAAK,GAAG;;AAGV,IAAa,eAAe;;;;;;;;;;;AAY5B,IAAa,WAAW;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,GAAG;;AAGV,IAAa,sBACX;;AAGF,IAAa,YACX;;AAGF,IAAa,gBAAgB;;;;;;;;;AAU7B,IAAa,iBAAiB,IAAI,gCAAgC;CAChE,UAAU,EACR,MAAM;EACJ,SAAS;EACT,SAAS;EACT,SAAS;EACT,SAAS;EACT,aAAa;EACb,MAAM;CACR,EACF;CACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;;;;;;;;;;;;;AAoBD,IAAa,gBAAgB,EAAE,qBAAqB,GAAG"}
|
|
@@ -135,7 +135,10 @@ export function ComboboxItem(props: ComponentProps<typeof KobalteCombobox.Item>)
|
|
|
135
135
|
<KobalteCombobox.ItemLabel>{local.children}</KobalteCombobox.ItemLabel>
|
|
136
136
|
{/* The indicator reads in the accent, like every other selected state in
|
|
137
137
|
the system. */}
|
|
138
|
-
<KobalteCombobox.ItemIndicator
|
|
138
|
+
<KobalteCombobox.ItemIndicator
|
|
139
|
+
data-slot="combobox-indicator"
|
|
140
|
+
class="absolute end-2 flex size-4 items-center justify-center text-primary"
|
|
141
|
+
>
|
|
139
142
|
<Check class="size-4" />
|
|
140
143
|
</KobalteCombobox.ItemIndicator>
|
|
141
144
|
</KobalteCombobox.Item>
|
|
@@ -111,7 +111,10 @@ export function ContextMenuCheckboxItem(
|
|
|
111
111
|
{local.children}
|
|
112
112
|
{/* The indicator reads in the accent, like every other selected state in
|
|
113
113
|
the system. */}
|
|
114
|
-
<KobalteContextMenu.ItemIndicator
|
|
114
|
+
<KobalteContextMenu.ItemIndicator
|
|
115
|
+
data-slot="context-menu-indicator"
|
|
116
|
+
class="absolute end-2 flex size-4 items-center justify-center text-primary"
|
|
117
|
+
>
|
|
115
118
|
<Check class="size-4" />
|
|
116
119
|
</KobalteContextMenu.ItemIndicator>
|
|
117
120
|
</KobalteContextMenu.CheckboxItem>
|
|
@@ -130,7 +133,10 @@ export function ContextMenuRadioItem(props: ComponentProps<typeof KobalteContext
|
|
|
130
133
|
{local.children}
|
|
131
134
|
{/* The indicator reads in the accent, like every other selected state in
|
|
132
135
|
the system. */}
|
|
133
|
-
<KobalteContextMenu.ItemIndicator
|
|
136
|
+
<KobalteContextMenu.ItemIndicator
|
|
137
|
+
data-slot="context-menu-indicator"
|
|
138
|
+
class="absolute end-2 flex size-4 items-center justify-center text-primary"
|
|
139
|
+
>
|
|
134
140
|
<Circle class="size-2 fill-current" />
|
|
135
141
|
</KobalteContextMenu.ItemIndicator>
|
|
136
142
|
</KobalteContextMenu.RadioItem>
|
|
@@ -141,7 +141,10 @@ export function MenubarCheckboxItem(props: ComponentProps<typeof KobalteMenubar.
|
|
|
141
141
|
{local.children}
|
|
142
142
|
{/* The indicator reads in the accent, like every other selected state in
|
|
143
143
|
the system. */}
|
|
144
|
-
<KobalteMenubar.ItemIndicator
|
|
144
|
+
<KobalteMenubar.ItemIndicator
|
|
145
|
+
data-slot="menubar-indicator"
|
|
146
|
+
class="absolute end-2 flex size-4 items-center justify-center text-primary"
|
|
147
|
+
>
|
|
145
148
|
<Check class="size-4" />
|
|
146
149
|
</KobalteMenubar.ItemIndicator>
|
|
147
150
|
</KobalteMenubar.CheckboxItem>
|
|
@@ -159,7 +162,10 @@ export function MenubarRadioItem(props: ComponentProps<typeof KobalteMenubar.Rad
|
|
|
159
162
|
{local.children}
|
|
160
163
|
{/* The indicator reads in the accent, like every other selected state in
|
|
161
164
|
the system. */}
|
|
162
|
-
<KobalteMenubar.ItemIndicator
|
|
165
|
+
<KobalteMenubar.ItemIndicator
|
|
166
|
+
data-slot="menubar-indicator"
|
|
167
|
+
class="absolute end-2 flex size-4 items-center justify-center text-primary"
|
|
168
|
+
>
|
|
163
169
|
<Circle class="size-2 fill-current" />
|
|
164
170
|
</KobalteMenubar.ItemIndicator>
|
|
165
171
|
</KobalteMenubar.RadioItem>
|
|
@@ -192,7 +192,10 @@ export function SelectItem(
|
|
|
192
192
|
<KobalteSelect.ItemLabel>{local.children}</KobalteSelect.ItemLabel>
|
|
193
193
|
{/* The indicator reads in the accent, like every other selected state in
|
|
194
194
|
the system — the row's own foreground reads as decoration. */}
|
|
195
|
-
<KobalteSelect.ItemIndicator
|
|
195
|
+
<KobalteSelect.ItemIndicator
|
|
196
|
+
data-slot="select-indicator"
|
|
197
|
+
class="absolute end-2 flex size-4 items-center justify-center text-primary"
|
|
198
|
+
>
|
|
196
199
|
<Check class="size-4" />
|
|
197
200
|
</KobalteSelect.ItemIndicator>
|
|
198
201
|
</KobalteSelect.Item>
|
|
@@ -15,12 +15,12 @@ import { cn } from '../../../lib/utils'
|
|
|
15
15
|
* Kobalte supplies the pressed state and the keyboard behaviour; the styling
|
|
16
16
|
* adds the one thing a headless primitive cannot know — that a pressed toggle
|
|
17
17
|
* in a toolbar should read as *filled*, not merely outlined. Pressed reads on
|
|
18
|
-
* the accent rung (`primary-subtle
|
|
18
|
+
* the accent rung (`primary-subtle`, foreground text, accent glyph): pressed is the
|
|
19
19
|
* control's on state, the same family the checked checkbox and switch own, so
|
|
20
20
|
* it keeps a touch of the user's accent instead of a neutral fill.
|
|
21
21
|
*/
|
|
22
22
|
export const toggleVariants = cva(
|
|
23
|
-
`${controlInteractive} inline-flex items-center justify-center rounded-md font-medium whitespace-nowrap select-none hover:bg-surface-hover hover:text-foreground data-[pressed]:bg-primary-subtle data-[pressed]:text-primary disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,
|
|
23
|
+
`${controlInteractive} inline-flex items-center justify-center rounded-md font-medium whitespace-nowrap select-none hover:bg-surface-hover hover:text-foreground data-[pressed]:bg-primary-subtle data-[pressed]:text-foreground data-[pressed]:[&_svg]:text-primary disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,
|
|
24
24
|
{
|
|
25
25
|
variants: {
|
|
26
26
|
variant: {
|
|
@@ -83,14 +83,21 @@ export const popoverArrow = 'fill-popover stroke-border'
|
|
|
83
83
|
/**
|
|
84
84
|
* A menu row: the shared height, radius, hover fill and focus treatment for
|
|
85
85
|
* every item inside a menu, listbox or command list.
|
|
86
|
+
*
|
|
87
|
+
* The row sizes and dims the icons a caller puts in it, but not the glyph of
|
|
88
|
+
* its selection indicator (any `[data-slot$=-indicator]`): a descendant `svg`
|
|
89
|
+
* rule outranks a single utility on the glyph, so without the exclusion a
|
|
90
|
+
* radio item's `size-2` dot drew as a 16px muted disc and every check lost the
|
|
91
|
+
* indicator's accent.
|
|
86
92
|
*/
|
|
87
93
|
export const menuItem = [
|
|
88
94
|
'relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none',
|
|
89
95
|
'transition-colors ease-out',
|
|
90
96
|
'data-[highlighted]:bg-surface-hover data-[highlighted]:text-foreground',
|
|
91
97
|
'data-[disabled]:pointer-events-none data-[disabled]:text-muted-foreground',
|
|
92
|
-
'[&_svg]:pointer-events-none [&_svg]:shrink-0
|
|
93
|
-
'[&_svg:not([
|
|
98
|
+
'[&_svg]:pointer-events-none [&_svg]:shrink-0',
|
|
99
|
+
'[&_svg:not([data-slot$=-indicator]_*)]:size-4',
|
|
100
|
+
'[&_svg:not([class*=text-]):not([data-slot$=-indicator]_*)]:text-muted-foreground',
|
|
94
101
|
].join(' ')
|
|
95
102
|
|
|
96
103
|
/** A destructive action keeps readable text and marks its row with a status edge. */
|
package/package.json
CHANGED
|
@@ -135,7 +135,10 @@ export function ComboboxItem(props: ComponentProps<typeof KobalteCombobox.Item>)
|
|
|
135
135
|
<KobalteCombobox.ItemLabel>{local.children}</KobalteCombobox.ItemLabel>
|
|
136
136
|
{/* The indicator reads in the accent, like every other selected state in
|
|
137
137
|
the system. */}
|
|
138
|
-
<KobalteCombobox.ItemIndicator
|
|
138
|
+
<KobalteCombobox.ItemIndicator
|
|
139
|
+
data-slot="combobox-indicator"
|
|
140
|
+
class="absolute end-2 flex size-4 items-center justify-center text-primary"
|
|
141
|
+
>
|
|
139
142
|
<Check class="size-4" />
|
|
140
143
|
</KobalteCombobox.ItemIndicator>
|
|
141
144
|
</KobalteCombobox.Item>
|
|
@@ -111,7 +111,10 @@ export function ContextMenuCheckboxItem(
|
|
|
111
111
|
{local.children}
|
|
112
112
|
{/* The indicator reads in the accent, like every other selected state in
|
|
113
113
|
the system. */}
|
|
114
|
-
<KobalteContextMenu.ItemIndicator
|
|
114
|
+
<KobalteContextMenu.ItemIndicator
|
|
115
|
+
data-slot="context-menu-indicator"
|
|
116
|
+
class="absolute end-2 flex size-4 items-center justify-center text-primary"
|
|
117
|
+
>
|
|
115
118
|
<Check class="size-4" />
|
|
116
119
|
</KobalteContextMenu.ItemIndicator>
|
|
117
120
|
</KobalteContextMenu.CheckboxItem>
|
|
@@ -130,7 +133,10 @@ export function ContextMenuRadioItem(props: ComponentProps<typeof KobalteContext
|
|
|
130
133
|
{local.children}
|
|
131
134
|
{/* The indicator reads in the accent, like every other selected state in
|
|
132
135
|
the system. */}
|
|
133
|
-
<KobalteContextMenu.ItemIndicator
|
|
136
|
+
<KobalteContextMenu.ItemIndicator
|
|
137
|
+
data-slot="context-menu-indicator"
|
|
138
|
+
class="absolute end-2 flex size-4 items-center justify-center text-primary"
|
|
139
|
+
>
|
|
134
140
|
<Circle class="size-2 fill-current" />
|
|
135
141
|
</KobalteContextMenu.ItemIndicator>
|
|
136
142
|
</KobalteContextMenu.RadioItem>
|
|
@@ -141,7 +141,10 @@ export function MenubarCheckboxItem(props: ComponentProps<typeof KobalteMenubar.
|
|
|
141
141
|
{local.children}
|
|
142
142
|
{/* The indicator reads in the accent, like every other selected state in
|
|
143
143
|
the system. */}
|
|
144
|
-
<KobalteMenubar.ItemIndicator
|
|
144
|
+
<KobalteMenubar.ItemIndicator
|
|
145
|
+
data-slot="menubar-indicator"
|
|
146
|
+
class="absolute end-2 flex size-4 items-center justify-center text-primary"
|
|
147
|
+
>
|
|
145
148
|
<Check class="size-4" />
|
|
146
149
|
</KobalteMenubar.ItemIndicator>
|
|
147
150
|
</KobalteMenubar.CheckboxItem>
|
|
@@ -159,7 +162,10 @@ export function MenubarRadioItem(props: ComponentProps<typeof KobalteMenubar.Rad
|
|
|
159
162
|
{local.children}
|
|
160
163
|
{/* The indicator reads in the accent, like every other selected state in
|
|
161
164
|
the system. */}
|
|
162
|
-
<KobalteMenubar.ItemIndicator
|
|
165
|
+
<KobalteMenubar.ItemIndicator
|
|
166
|
+
data-slot="menubar-indicator"
|
|
167
|
+
class="absolute end-2 flex size-4 items-center justify-center text-primary"
|
|
168
|
+
>
|
|
163
169
|
<Circle class="size-2 fill-current" />
|
|
164
170
|
</KobalteMenubar.ItemIndicator>
|
|
165
171
|
</KobalteMenubar.RadioItem>
|
|
@@ -192,7 +192,10 @@ export function SelectItem(
|
|
|
192
192
|
<KobalteSelect.ItemLabel>{local.children}</KobalteSelect.ItemLabel>
|
|
193
193
|
{/* The indicator reads in the accent, like every other selected state in
|
|
194
194
|
the system — the row's own foreground reads as decoration. */}
|
|
195
|
-
<KobalteSelect.ItemIndicator
|
|
195
|
+
<KobalteSelect.ItemIndicator
|
|
196
|
+
data-slot="select-indicator"
|
|
197
|
+
class="absolute end-2 flex size-4 items-center justify-center text-primary"
|
|
198
|
+
>
|
|
196
199
|
<Check class="size-4" />
|
|
197
200
|
</KobalteSelect.ItemIndicator>
|
|
198
201
|
</KobalteSelect.Item>
|
|
@@ -15,12 +15,12 @@ import { cn } from '#lib/utils'
|
|
|
15
15
|
* Kobalte supplies the pressed state and the keyboard behaviour; the styling
|
|
16
16
|
* adds the one thing a headless primitive cannot know — that a pressed toggle
|
|
17
17
|
* in a toolbar should read as *filled*, not merely outlined. Pressed reads on
|
|
18
|
-
* the accent rung (`primary-subtle
|
|
18
|
+
* the accent rung (`primary-subtle`, foreground text, accent glyph): pressed is the
|
|
19
19
|
* control's on state, the same family the checked checkbox and switch own, so
|
|
20
20
|
* it keeps a touch of the user's accent instead of a neutral fill.
|
|
21
21
|
*/
|
|
22
22
|
export const toggleVariants = cva(
|
|
23
|
-
`${controlInteractive} inline-flex items-center justify-center rounded-md font-medium whitespace-nowrap select-none hover:bg-surface-hover hover:text-foreground data-[pressed]:bg-primary-subtle data-[pressed]:text-primary disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,
|
|
23
|
+
`${controlInteractive} inline-flex items-center justify-center rounded-md font-medium whitespace-nowrap select-none hover:bg-surface-hover hover:text-foreground data-[pressed]:bg-primary-subtle data-[pressed]:text-foreground data-[pressed]:[&_svg]:text-primary disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,
|
|
24
24
|
{
|
|
25
25
|
variants: {
|
|
26
26
|
variant: {
|
package/src/lib/overlay.ts
CHANGED
|
@@ -83,14 +83,21 @@ export const popoverArrow = 'fill-popover stroke-border'
|
|
|
83
83
|
/**
|
|
84
84
|
* A menu row: the shared height, radius, hover fill and focus treatment for
|
|
85
85
|
* every item inside a menu, listbox or command list.
|
|
86
|
+
*
|
|
87
|
+
* The row sizes and dims the icons a caller puts in it, but not the glyph of
|
|
88
|
+
* its selection indicator (any `[data-slot$=-indicator]`): a descendant `svg`
|
|
89
|
+
* rule outranks a single utility on the glyph, so without the exclusion a
|
|
90
|
+
* radio item's `size-2` dot drew as a 16px muted disc and every check lost the
|
|
91
|
+
* indicator's accent.
|
|
86
92
|
*/
|
|
87
93
|
export const menuItem = [
|
|
88
94
|
'relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none',
|
|
89
95
|
'transition-colors ease-out',
|
|
90
96
|
'data-[highlighted]:bg-surface-hover data-[highlighted]:text-foreground',
|
|
91
97
|
'data-[disabled]:pointer-events-none data-[disabled]:text-muted-foreground',
|
|
92
|
-
'[&_svg]:pointer-events-none [&_svg]:shrink-0
|
|
93
|
-
'[&_svg:not([
|
|
98
|
+
'[&_svg]:pointer-events-none [&_svg]:shrink-0',
|
|
99
|
+
'[&_svg:not([data-slot$=-indicator]_*)]:size-4',
|
|
100
|
+
'[&_svg:not([class*=text-]):not([data-slot$=-indicator]_*)]:text-muted-foreground',
|
|
94
101
|
].join(' ')
|
|
95
102
|
|
|
96
103
|
/** A destructive action keeps readable text and marks its row with a status edge. */
|