@adea-ai/ui 0.151.15 → 0.152.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/composites/accent-picker/accent-picker.d.ts +44 -10
- package/dist/components/composites/accent-picker/accent-picker.d.ts.map +1 -1
- package/dist/components/composites/accent-picker/accent-picker.js +155 -58
- package/dist/components/composites/accent-picker/accent-picker.js.map +1 -1
- package/dist/components/composites/accent-picker/color-math.d.ts +13 -0
- package/dist/components/composites/accent-picker/color-math.d.ts.map +1 -0
- package/dist/components/composites/accent-picker/color-math.js +61 -0
- package/dist/components/composites/accent-picker/color-math.js.map +1 -0
- package/dist/components/composites/accent-picker/custom-color-popover.d.ts +18 -0
- package/dist/components/composites/accent-picker/custom-color-popover.d.ts.map +1 -0
- package/dist/components/composites/accent-picker/custom-color-popover.js +248 -0
- package/dist/components/composites/accent-picker/custom-color-popover.js.map +1 -0
- package/dist/components/composites/accent-picker/index.d.ts +1 -1
- package/dist/components/composites/accent-picker/index.d.ts.map +1 -1
- package/dist/components/composites/accent-picker/index.js +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +37 -74
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/r/accent-picker.json +13 -0
- package/dist/r/appearance-editor.json +1 -0
- package/dist/r/registry.json +14 -0
- package/dist/r/src/components/composites/accent-picker/accent-picker.tsx +154 -38
- package/dist/r/src/components/composites/accent-picker/color-math.ts +54 -0
- package/dist/r/src/components/composites/accent-picker/custom-color-popover.tsx +220 -0
- package/dist/r/src/components/composites/accent-picker/index.ts +6 -1
- package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +34 -58
- package/dist/r/src/components/composites/icon-picker/icon-picker.tsx +1 -1
- package/package.json +1 -1
- package/registry.json +14 -0
- package/src/components/composites/accent-picker/accent-picker.tsx +154 -38
- package/src/components/composites/accent-picker/color-math.ts +54 -0
- package/src/components/composites/accent-picker/custom-color-popover.tsx +220 -0
- package/src/components/composites/accent-picker/index.ts +6 -1
- package/src/components/composites/appearance-editor/appearance-choices.tsx +34 -58
- package/src/components/composites/icon-picker/icon-picker.tsx +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-picker.js","names":["RadioGroup","Radio","ChevronDown","ImageUp","Trash2","JSX","For","Show","createSignal","createUniqueId","splitProps","Dynamic","createLatestAction","cn","Button","Popover","PopoverContent","PopoverTrigger","MarkImageError","markImageFromFile","markImageProblemCopy","MARK_IMAGE_MAX_SOURCE_BYTES","resolveShellIcon","shellIconEntries","shellIconLabel","IconPickerProps","label","value","onValueChange","key","defaultKey","image","onImageChange","disabled","class","IconPicker","props","inputId","problem","setProblem","uploads","fileInput","setFileInput","HTMLInputElement","upload","file","File","undefined","outcome","run","status","error","_el$","_tmpl$3","_$insert","_$createComponent","when","children","_el$2","_tmpl$","_el$3","firstChild","_el$4","nextSibling","_el$5","fallback","src","_el$0","_tmpl$4","_$effect","_$setAttribute","addEventListener","event","input","currentTarget","files","_$use","type","variant","size","pending","onClick","click","_$memo","_p$","_v$","_v$2","e","t","message","_el$1","_tmpl$5","_el$6","_tmpl$2","_el$7","_el$9","_el$8","aria-label","onChange","each","entry","Icon","Item","ItemInput","ItemLabel","title","_el$10","_tmpl$6","_$className","IconPickerDropdownProps","trigger","Element","IconPickerDropdown","open","setOpen","local","picker","Current","onOpenChange","placement","as","_el$11","_tmpl$7","component","_el$12","_tmpl$8","_$mergeProps","_$createComponent","_$setAttribute","_$memo","Radio","_$className","_$mergeProps"],"sources":["../../../../src/components/composites/icon-picker/icon-picker.tsx"],"sourcesContent":["import { RadioGroup as Radio } from '@kobalte/core/radio-group'\nimport { ChevronDown, ImageUp, Trash2 } from 'lucide-solid'\nimport type { JSX } from 'solid-js'\nimport { For, Show, createSignal, createUniqueId, splitProps } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { createLatestAction } from '#lib/async-action'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover'\nimport {\n MarkImageError,\n markImageFromFile,\n markImageProblemCopy,\n MARK_IMAGE_MAX_SOURCE_BYTES,\n} from './image-data-url'\nimport { resolveShellIcon, shellIconEntries, shellIconLabel } from './shell-icons'\n\n/**\n * IconPicker.\n *\n * The control behind \"choose an icon\" for a workspace or a project: a grid of\n * curated glyphs, and optionally an uploaded picture in their place.\n *\n * It is a single-choice group. The glyph grid is a Kobalte radio group, so\n * arrow keys move the choice and Tab enters and leaves the grid as one stop,\n * which is the contract a 56-cell grid needs to stay usable from a keyboard. An\n * uploaded image is a separate state, not a 57th cell: while `image` is set no\n * glyph is checked, and choosing a glyph asks the caller to drop the image, so\n * the stored mark is never both.\n *\n * The picker does not persist anything. The caller owns `value` and `image`\n * and saves them with the rest of its form; the image arrives already resized\n * to the stored square (see `markImageFromFile`).\n */\nexport type IconPickerProps = {\n /** The group's accessible name, e.g. \"Workspace icon\". */\n label: string\n /** The checked icon key; ignored while `image` is set. */\n value: string | undefined\n onValueChange(key: string): void\n /** The key the surface treats as unset, labelled \"default\" in the grid. */\n defaultKey?: string\n /** An uploaded mark (a data URL) currently chosen in place of a glyph. */\n image?: string\n /**\n * Called with the resized upload, or `undefined` for Remove. Omit it for a\n * surface that offers glyphs only; the upload row then does not render.\n */\n onImageChange?(image: string | undefined): void\n disabled?: boolean\n class?: string\n}\n\nexport function IconPicker(props: IconPickerProps) {\n const inputId = createUniqueId()\n const [problem, setProblem] = createSignal<string>()\n const uploads = createLatestAction()\n const [fileInput, setFileInput] = createSignal<HTMLInputElement>()\n\n const upload = async (file: File | undefined) => {\n if (!file || !props.onImageChange) return\n setProblem(undefined)\n const outcome = await uploads.run(() => markImageFromFile(file))\n if (outcome.status === 'done') props.onImageChange?.(outcome.value)\n else if (outcome.status === 'failed')\n setProblem(\n markImageProblemCopy[\n outcome.error instanceof MarkImageError ? outcome.error.problem : 'unreadable'\n ]\n )\n }\n\n return (\n <div data-slot=\"icon-picker\" class={cn('flex flex-col gap-3', props.class)}>\n <Show when={props.onImageChange}>\n <div class=\"flex items-center gap-3\" data-slot=\"icon-picker-upload\">\n <span\n aria-hidden=\"true\"\n class=\"flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-muted\"\n >\n <Show\n when={props.image}\n fallback={<ImageUp class=\"size-5 text-muted-foreground\" aria-hidden=\"true\" />}\n >\n {(src) => <img src={src()} alt=\"\" class=\"size-full object-cover\" />}\n </Show>\n </span>\n <div class=\"flex flex-wrap items-center gap-2\">\n <input\n ref={setFileInput}\n id={inputId}\n type=\"file\"\n class=\"sr-only\"\n tabIndex={-1}\n // The visible button drives this input; hide the duplicate from assistive\n // technology but keep a name so the form-label rule is satisfied.\n aria-hidden=\"true\"\n aria-label={props.image ? 'Replace image' : 'Upload image'}\n accept=\"image/png,image/jpeg,image/webp,image/gif\"\n disabled={props.disabled}\n onChange={(event) => {\n const input = event.currentTarget\n void upload(input.files?.[0])\n // Clearing the value lets the same file be chosen again after Remove.\n input.value = ''\n }}\n />\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n disabled={props.disabled || uploads.pending()}\n onClick={() => fileInput()?.click()}\n >\n <ImageUp aria-hidden=\"true\" />\n {props.image ? 'Replace image' : 'Upload image'}\n </Button>\n <Show when={props.image}>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n disabled={props.disabled || uploads.pending()}\n onClick={() => {\n setProblem(undefined)\n props.onImageChange?.(undefined)\n }}\n >\n <Trash2 aria-hidden=\"true\" />\n Remove image\n </Button>\n </Show>\n </div>\n </div>\n <Show when={problem()}>\n {(message) => (\n <p role=\"alert\" class=\"text-sm text-destructive\">\n {message()}\n </p>\n )}\n </Show>\n <p class=\"text-xs text-muted-foreground\">\n PNG, JPEG, WebP or GIF up to {MARK_IMAGE_MAX_SOURCE_BYTES / 1024 / 1024} MB. It is cropped\n to a square.\n </p>\n </Show>\n <Radio\n aria-label={props.label}\n value={props.image ? '' : (props.value ?? '')}\n disabled={props.disabled}\n onChange={(key) => {\n if (key) props.onValueChange(key)\n }}\n class=\"grid grid-cols-[repeat(auto-fill,minmax(2.5rem,1fr))] gap-1.5\"\n >\n <For each={shellIconEntries}>\n {(entry) => {\n const Icon = resolveShellIcon(entry.key)\n return (\n <Radio.Item value={entry.key} class=\"contents\">\n <Radio.ItemInput class=\"peer\" />\n <Radio.ItemLabel\n title={entry.key === props.defaultKey ? `${entry.label} (default)` : entry.label}\n class={cn(\n 'flex size-10 cursor-pointer items-center justify-center rounded-lg border border-border bg-card text-muted-foreground',\n 'transition-colors ease-out',\n 'hover:bg-surface-hover hover:text-foreground',\n 'peer-focus-visible:border-ring peer-focus-visible:ring-3 peer-focus-visible:ring-primary-subtle',\n 'data-[checked]:border-primary data-[checked]:bg-primary-subtle data-[checked]:text-primary',\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50'\n )}\n >\n <Icon class=\"size-5\" aria-hidden=\"true\" />\n <span class=\"sr-only\">\n {entry.label}\n {entry.key === props.defaultKey ? ' (default)' : ''}\n </span>\n </Radio.ItemLabel>\n </Radio.Item>\n )\n }}\n </For>\n </Radio>\n </div>\n )\n}\n\n/**\n * IconPickerDropdown.\n *\n * The compact form of the picker for a settings row: one button showing the\n * current mark, opening the full grid (and the upload row, when the host offers\n * it) in a popover. Choosing a glyph applies it and closes the popover; an\n * upload or Remove leaves it open so the result is visible. The host owns the\n * value exactly as it does for `IconPicker`.\n */\nexport type IconPickerDropdownProps = IconPickerProps & {\n /** The mark shown on the trigger; defaults to the checked glyph or the uploaded image. */\n trigger?: JSX.Element\n}\n\nexport function IconPickerDropdown(props: IconPickerDropdownProps) {\n const [open, setOpen] = createSignal(false)\n const [local, picker] = splitProps(props, ['trigger', 'class'])\n const Current = () => resolveShellIcon(props.value ?? props.defaultKey ?? '')\n return (\n <Popover open={open()} onOpenChange={setOpen} placement=\"bottom-start\">\n <PopoverTrigger\n as={Button}\n type=\"button\"\n variant=\"outline\"\n data-slot=\"icon-picker-trigger\"\n aria-label={`${props.label}: ${props.image ? 'uploaded image' : shellIconLabel(props.value ?? props.defaultKey ?? '')}`}\n disabled={props.disabled}\n class={cn('gap-2', local.class)}\n >\n <span aria-hidden=\"true\" class=\"flex size-5 items-center justify-center overflow-hidden\">\n <Show\n when={local.trigger}\n fallback={\n <Show\n when={props.image}\n fallback={<Dynamic component={Current()} class=\"size-4\" aria-hidden=\"true\" />}\n >\n {(src) => <img src={src()} alt=\"\" class=\"size-full rounded-sm object-cover\" />}\n </Show>\n }\n >\n {local.trigger}\n </Show>\n </span>\n <ChevronDown class=\"size-4 text-muted-foreground\" aria-hidden=\"true\" />\n </PopoverTrigger>\n <PopoverContent class=\"w-[min(22rem,var(--kb-popper-available-width))]\">\n <IconPicker\n {...picker}\n onValueChange={(key) => {\n picker.onValueChange(key)\n setOpen(false)\n }}\n />\n </PopoverContent>\n </Popover>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqDA,SAAgBmC,WAAWC,OAAwB;CACjD,MAAMC,UAAU5B,eAAe;CAC/B,MAAM,CAAC6B,SAASC,cAAc/B,aAAqB;CACnD,MAAMgC,UAAU5B,mBAAmB;CACnC,MAAM,CAAC6B,WAAWC,gBAAgBlC,aAA+B;CAEjE,MAAMoC,SAAS,OAAOC,SAA2B;EAC/C,IAAI,CAACA,QAAQ,CAACT,MAAMJ,eAAe;EACnCO,WAAWQ,KAAAA,CAAS;EACpB,MAAMC,UAAU,MAAMR,QAAQS,UAAU9B,kBAAkB0B,IAAI,CAAC;EAC/D,IAAIG,QAAQE,WAAW,QAAQd,MAAMJ,gBAAgBgB,QAAQrB,KAAK;OAC7D,IAAIqB,QAAQE,WAAW,UAC1BX,WACEnB,qBACE4B,QAA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Ae1D,IAAI,CAAC,CAAA;UAAA,OAAA0D;SAAA,EAAA,CAAA;QAAqD,CAAA;OAAA;OAAA,IAAAnE,WAAA;QAAA,OAIjF0D,MAAML;OAAO;MAAA,CAAA,CAAA;MAAA,OAAAW;KAAA,EAAA,CAAA,GAAAlE,gBAGjBrD,aAAW;MAAA,SAAA;MAAA,eAAA;KAAA,CAAA,CAAA;IAAA;GAAA,CAAA,GAAAqD,gBAEbvC,gBAAc;IAAA,SAAA;IAAA,IAAAyC,WAAA;KAAA,OAAAF,gBACZpB,YAAU2F,WACLV,QAAM,EACVxF,gBAAgBC,QAAQ;MACtBuF,OAAOxF,cAAcC,GAAG;MACxBqF,QAAQ,KAAK;KACf,EAAC,CAAA,CAAA;IAAA;GAAA,CAAA,CAAA;EAAA;CAAA,CAAA;AAKX"}
|
|
1
|
+
{"version":3,"file":"icon-picker.js","names":["RadioGroup","Radio","ChevronDown","ImageUp","Trash2","JSX","For","Show","createSignal","createUniqueId","splitProps","Dynamic","createLatestAction","cn","Button","Popover","PopoverContent","PopoverTrigger","MarkImageError","markImageFromFile","markImageProblemCopy","MARK_IMAGE_MAX_SOURCE_BYTES","resolveShellIcon","shellIconEntries","shellIconLabel","IconPickerProps","label","value","onValueChange","key","defaultKey","image","onImageChange","disabled","class","IconPicker","props","inputId","problem","setProblem","uploads","fileInput","setFileInput","HTMLInputElement","upload","file","File","undefined","outcome","run","status","error","_el$","_tmpl$3","_$insert","_$createComponent","when","children","_el$2","_tmpl$","_el$3","firstChild","_el$4","nextSibling","_el$5","fallback","src","_el$0","_tmpl$4","_$effect","_$setAttribute","addEventListener","event","input","currentTarget","files","_$use","type","variant","size","pending","onClick","click","_$memo","_p$","_v$","_v$2","e","t","message","_el$1","_tmpl$5","_el$6","_tmpl$2","_el$7","_el$9","_el$8","aria-label","onChange","each","entry","Icon","Item","ItemInput","ItemLabel","title","_el$10","_tmpl$6","_$className","IconPickerDropdownProps","trigger","Element","IconPickerDropdown","open","setOpen","local","picker","Current","onOpenChange","placement","as","_el$11","_tmpl$7","component","_el$12","_tmpl$8","_$mergeProps","_$createComponent","_$setAttribute","_$memo","Radio","_$className","_$mergeProps"],"sources":["../../../../src/components/composites/icon-picker/icon-picker.tsx"],"sourcesContent":["import { RadioGroup as Radio } from '@kobalte/core/radio-group'\nimport { ChevronDown, ImageUp, Trash2 } from 'lucide-solid'\nimport type { JSX } from 'solid-js'\nimport { For, Show, createSignal, createUniqueId, splitProps } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { createLatestAction } from '#lib/async-action'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover'\nimport {\n MarkImageError,\n markImageFromFile,\n markImageProblemCopy,\n MARK_IMAGE_MAX_SOURCE_BYTES,\n} from './image-data-url'\nimport { resolveShellIcon, shellIconEntries, shellIconLabel } from './shell-icons'\n\n/**\n * IconPicker.\n *\n * The control behind \"choose an icon\" for a workspace or a project: a grid of\n * curated glyphs, and optionally an uploaded picture in their place.\n *\n * It is a single-choice group. The glyph grid is a Kobalte radio group, so\n * arrow keys move the choice and Tab enters and leaves the grid as one stop,\n * which is the contract a 56-cell grid needs to stay usable from a keyboard. An\n * uploaded image is a separate state, not a 57th cell: while `image` is set no\n * glyph is checked, and choosing a glyph asks the caller to drop the image, so\n * the stored mark is never both.\n *\n * The picker does not persist anything. The caller owns `value` and `image`\n * and saves them with the rest of its form; the image arrives already resized\n * to the stored square (see `markImageFromFile`).\n */\nexport type IconPickerProps = {\n /** The group's accessible name, e.g. \"Workspace icon\". */\n label: string\n /** The checked icon key; ignored while `image` is set. */\n value: string | undefined\n onValueChange(key: string): void\n /** The key the surface treats as unset, labelled \"default\" in the grid. */\n defaultKey?: string\n /** An uploaded mark (a data URL) currently chosen in place of a glyph. */\n image?: string\n /**\n * Called with the resized upload, or `undefined` for Remove. Omit it for a\n * surface that offers glyphs only; the upload row then does not render.\n */\n onImageChange?(image: string | undefined): void\n disabled?: boolean\n class?: string\n}\n\nexport function IconPicker(props: IconPickerProps) {\n const inputId = createUniqueId()\n const [problem, setProblem] = createSignal<string>()\n const uploads = createLatestAction()\n const [fileInput, setFileInput] = createSignal<HTMLInputElement>()\n\n const upload = async (file: File | undefined) => {\n if (!file || !props.onImageChange) return\n setProblem(undefined)\n const outcome = await uploads.run(() => markImageFromFile(file))\n if (outcome.status === 'done') props.onImageChange?.(outcome.value)\n else if (outcome.status === 'failed')\n setProblem(\n markImageProblemCopy[\n outcome.error instanceof MarkImageError ? outcome.error.problem : 'unreadable'\n ]\n )\n }\n\n return (\n <div data-slot=\"icon-picker\" class={cn('flex flex-col gap-3', props.class)}>\n <Show when={props.onImageChange}>\n <div class=\"flex items-center gap-3\" data-slot=\"icon-picker-upload\">\n <span\n aria-hidden=\"true\"\n class=\"flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-muted\"\n >\n <Show\n when={props.image}\n fallback={<ImageUp class=\"size-5 text-muted-foreground\" aria-hidden=\"true\" />}\n >\n {(src) => <img src={src()} alt=\"\" class=\"size-full object-cover\" />}\n </Show>\n </span>\n <div class=\"flex flex-wrap items-center gap-2\">\n <input\n ref={setFileInput}\n id={inputId}\n type=\"file\"\n class=\"sr-only\"\n tabIndex={-1}\n // The visible button drives this input; hide the duplicate from assistive\n // technology but keep a name so the form-label rule is satisfied.\n aria-hidden=\"true\"\n aria-label={props.image ? 'Replace image' : 'Upload image'}\n accept=\"image/png,image/jpeg,image/webp,image/gif\"\n disabled={props.disabled}\n onChange={(event) => {\n const input = event.currentTarget\n void upload(input.files?.[0])\n // Clearing the value lets the same file be chosen again after Remove.\n input.value = ''\n }}\n />\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n disabled={props.disabled || uploads.pending()}\n onClick={() => fileInput()?.click()}\n >\n <ImageUp aria-hidden=\"true\" />\n {props.image ? 'Replace image' : 'Upload image'}\n </Button>\n <Show when={props.image}>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n disabled={props.disabled || uploads.pending()}\n onClick={() => {\n setProblem(undefined)\n props.onImageChange?.(undefined)\n }}\n >\n <Trash2 aria-hidden=\"true\" />\n Remove image\n </Button>\n </Show>\n </div>\n </div>\n <Show when={problem()}>\n {(message) => (\n <p role=\"alert\" class=\"text-sm text-destructive\">\n {message()}\n </p>\n )}\n </Show>\n <p class=\"text-xs text-muted-foreground\">\n PNG, JPEG, WebP or GIF up to {MARK_IMAGE_MAX_SOURCE_BYTES / 1024 / 1024} MB. It is cropped\n to a square.\n </p>\n </Show>\n <Radio\n aria-label={props.label}\n value={props.image ? '' : (props.value ?? '')}\n disabled={props.disabled}\n onChange={(key) => {\n if (key) props.onValueChange(key)\n }}\n class=\"grid grid-cols-[repeat(auto-fill,minmax(2.5rem,1fr))] gap-1.5\"\n >\n <For each={shellIconEntries}>\n {(entry) => {\n const Icon = resolveShellIcon(entry.key)\n return (\n <Radio.Item value={entry.key} class=\"contents\">\n <Radio.ItemInput class=\"peer\" />\n <Radio.ItemLabel\n title={entry.key === props.defaultKey ? `${entry.label} (default)` : entry.label}\n class={cn(\n 'flex size-10 cursor-pointer items-center justify-center rounded-lg border border-border bg-card text-muted-foreground',\n 'transition-colors ease-out',\n 'hover:bg-surface-hover hover:text-foreground',\n 'peer-focus-visible:border-ring peer-focus-visible:ring-3 peer-focus-visible:ring-primary-subtle',\n 'data-[checked]:border-primary data-[checked]:bg-primary-subtle data-[checked]:text-primary',\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50'\n )}\n >\n <Icon class=\"size-5\" aria-hidden=\"true\" />\n <span class=\"sr-only\">\n {entry.label}\n {entry.key === props.defaultKey ? ' (default)' : ''}\n </span>\n </Radio.ItemLabel>\n </Radio.Item>\n )\n }}\n </For>\n </Radio>\n </div>\n )\n}\n\n/**\n * IconPickerDropdown.\n *\n * The compact form of the picker for a settings row: one button showing the\n * current mark, opening the full grid (and the upload row, when the host offers\n * it) in a popover. Choosing a glyph applies it and closes the popover; an\n * upload or Remove leaves it open so the result is visible. The host owns the\n * value exactly as it does for `IconPicker`.\n */\nexport type IconPickerDropdownProps = IconPickerProps & {\n /** The mark shown on the trigger; defaults to the checked glyph or the uploaded image. */\n trigger?: JSX.Element\n}\n\nexport function IconPickerDropdown(props: IconPickerDropdownProps) {\n const [open, setOpen] = createSignal(false)\n const [local, picker] = splitProps(props, ['trigger', 'class'])\n const Current = () => resolveShellIcon(props.value ?? props.defaultKey ?? '')\n return (\n <Popover open={open()} onOpenChange={setOpen} placement=\"bottom-start\">\n <PopoverTrigger\n as={Button}\n type=\"button\"\n variant=\"outline\"\n data-slot=\"icon-picker-trigger\"\n aria-label={`${props.label}: ${props.image ? 'uploaded image' : shellIconLabel(props.value ?? props.defaultKey ?? '')}`}\n disabled={props.disabled}\n class={cn('gap-2', local.class)}\n >\n <span aria-hidden=\"true\" class=\"flex size-5 items-center justify-center overflow-hidden\">\n <Show\n when={local.trigger}\n fallback={\n <Show\n when={props.image}\n fallback={<Dynamic component={Current()} class=\"size-4\" aria-hidden=\"true\" />}\n >\n {(src) => <img src={src()} alt=\"\" class=\"size-full rounded-sm object-cover\" />}\n </Show>\n }\n >\n {local.trigger}\n </Show>\n </span>\n <ChevronDown class=\"size-4 text-muted-foreground\" aria-hidden=\"true\" />\n </PopoverTrigger>\n <PopoverContent class=\"w-88 max-w-(--kb-popper-content-available-width)\">\n <IconPicker\n {...picker}\n onValueChange={(key) => {\n picker.onValueChange(key)\n setOpen(false)\n }}\n />\n </PopoverContent>\n </Popover>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqDA,SAAgBmC,WAAWC,OAAwB;CACjD,MAAMC,UAAU5B,eAAe;CAC/B,MAAM,CAAC6B,SAASC,cAAc/B,aAAqB;CACnD,MAAMgC,UAAU5B,mBAAmB;CACnC,MAAM,CAAC6B,WAAWC,gBAAgBlC,aAA+B;CAEjE,MAAMoC,SAAS,OAAOC,SAA2B;EAC/C,IAAI,CAACA,QAAQ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OAAEpB,MAAML;SAAK;SAAA,IACjBkC,WAAQ;UAAA,OAAAV,gBAAG5C,SAAO;WAAA,IAACgH,YAAS;YAAA,OAAEN,QAAQ;WAAC;WAAA,SAAA;WAAA,eAAA;UAAA,CAAA;SAAA;SAAA5D,WAErCS,eAAG;UAAA,IAAA0D,SAAAC,QAAA;UAAAxD,aAAAC,aAAAsD,QAAA,OAAe1D,IAAI,CAAC,CAAA;UAAA,OAAA0D;SAAA,EAAA,CAAA;QAAqD,CAAA;OAAA;OAAA,IAAAnE,WAAA;QAAA,OAIjF0D,MAAML;OAAO;MAAA,CAAA,CAAA;MAAA,OAAAW;KAAA,EAAA,CAAA,GAAAlE,gBAGjBrD,aAAW;MAAA,SAAA;MAAA,eAAA;KAAA,CAAA,CAAA;IAAA;GAAA,CAAA,GAAAqD,gBAEbvC,gBAAc;IAAA,SAAA;IAAA,IAAAyC,WAAA;KAAA,OAAAF,gBACZpB,YAAU2F,WACLV,QAAM,EACVxF,gBAAgBC,QAAQ;MACtBuF,OAAOxF,cAAcC,GAAG;MACxBqF,QAAQ,KAAK;KACf,EAAC,CAAA,CAAA;IAAA;GAAA,CAAA,CAAA;EAAA;CAAA,CAAA;AAKX"}
|
package/dist/index.js
CHANGED
|
@@ -189,6 +189,7 @@ import { SceneControls } from "./components/composites/scene-controls/scene-cont
|
|
|
189
189
|
import { PropertyList, PropertyRow, PropertyTerm, PropertyValue, Stat, StatGroup } from "./components/composites/stat/stat.js";
|
|
190
190
|
import { PalettePreview, ThemeMiniature, ThemeMiniatureSplit } from "./components/composites/appearance-editor/theme-preview.js";
|
|
191
191
|
import { SettingsRow } from "./components/composites/appearance-editor/appearance-rows.js";
|
|
192
|
+
import { AccentPicker, isCustomAccentValue } from "./components/composites/accent-picker/accent-picker.js";
|
|
192
193
|
import { AppearanceEditor, AppearanceEditorActions, AppearancePopover } from "./components/composites/appearance-editor/appearance-editor.js";
|
|
193
194
|
import { formatBytes, formatReleaseDate, plainTextFromMarkdown } from "./lib/version-notes.js";
|
|
194
195
|
import { UpdateDialog } from "./components/composites/update-dialog/update-dialog.js";
|
|
@@ -202,6 +203,5 @@ import { WorkspaceReorderDialog } from "./components/composites/workspace-switch
|
|
|
202
203
|
import { MARK_IMAGE_MAX_DATA_URL_LENGTH, MARK_IMAGE_MAX_SOURCE_BYTES, MARK_IMAGE_SIZE, MarkImageError, centredSquare, checkMarkImageFile, isMarkImageDataUrl, markImageFromFile, markImageProblemCopy } from "./components/composites/icon-picker/image-data-url.js";
|
|
203
204
|
import { isShellIconKey, resolveShellIcon, shellIconEntries, shellIconLabel } from "./components/composites/icon-picker/shell-icons.js";
|
|
204
205
|
import { IconPicker, IconPickerDropdown } from "./components/composites/icon-picker/icon-picker.js";
|
|
205
|
-
import { AccentPicker } from "./components/composites/accent-picker/accent-picker.js";
|
|
206
206
|
import { allTokens, colorTokens, densityTokens, designTokens, elevationTokens, motionTokens, radiusTokens, typographyTokens, undocumentedTokenAliases, zIndexTokens } from "./lib/tokens.js";
|
|
207
|
-
export { ANSI_MAX_LINE_LENGTH, ANSI_RETAIN_LINES, APPEARANCE_EDITOR_FONT_AXES, APPEARANCE_EDITOR_FONT_SIZE_MAX, APPEARANCE_EDITOR_FONT_SIZE_MIN, AboutDialog, AccentPicker, AccentSwatchGroups, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountMenu, ActionButton, Alert, AlertAction, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AnnotationSurface, AppShell, AppShellBody, AppShellContent, AppShellMain, AppearanceEditor, AppearanceEditorActions, AppearanceFontSettingsGroup, AppearancePanel, AppearancePopover, SettingsRow as AppearanceSettingsRow, AspectRatio, Attachment, AttachmentCard, AttachmentList, Avatar, AvatarFallback, AvatarImage, Badge, Board, BoardCardBody, BoardCardTitle, BoardCardTrigger, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Bubble, BusySendButton, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CHAIN_OF_THOUGHT_STATUS_LABELS, CODE_BLOCK_LINE_LIMIT, CalendarSurface, Callout, CalloutTitle, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CatalogBrowser, CatalogDetail, CatalogDetailSection, ChainOfThought, ChainOfThoughtResult, ChainOfThoughtResults, ChainOfThoughtStep, Chat, ChatComposer, ChatEmpty, ChatHeader, ChatNotice, Checkbox, CheckboxDescription, CheckboxLabel, Checkpoint, CodeBlock, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxClear, ComboboxContent, ComboboxControl, ComboboxInput, ComboboxItem, ComboboxSection, ComboboxTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandHint, CommandInput, CommandItem, CommandList, CommandLoading, CommandSeparator, CommandShortcut, CommandStatus, ComposerAttachmentButton, ComposerHint, ComposerMenu, ComposerMenuItem, Confirmation, Context, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, ContextualSidebar, ConversationAvatar, ConversationPane, ConversationSurface, DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS, DatePicker, DetailPanel, DetailPanelBody, DetailPanelField, DetailPanelHeader, DetailPanelSection, Dialog, DialogClose, DialogCloseButton, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiffBlock, DiffSummary, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, EntityIcon, FILE_CHANGE_LABELS, FILE_TREE_AUTO_EXPAND_LIMIT, FILE_TREE_MAX_DEPTH, FILE_TREE_MAX_ROWS, FLOATING_PREVIEW_CORNER_RADIUS, FLOATING_PREVIEW_EDGE_GAP, Field, FieldDescription, FieldError, FieldGroup, FieldInput, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTextArea, FileTree, FloatingPreview, FormField, Heading, HelpCenter, HoverCard, HoverCardContent, HoverCardTrigger, IconPicker, IconPickerDropdown, InlineCitation, InlineCode, Input, InputControl, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputOtp, InputOtpCaret, Item, ItemDescription, ItemEmpty, ItemGroup, ItemGroupEntry, ItemTitle, Kbd, KbdChord, KbdGroup, Label, ListGroup, ListRow, ListRowControl, MARK_IMAGE_MAX_DATA_URL_LENGTH, MARK_IMAGE_MAX_SOURCE_BYTES, MARK_IMAGE_SIZE, MAX_LAYOUT_DEPTH, MAX_LAYOUT_LEAVES, MAX_SPLIT_RATIO, MIN_SPLIT_RATIO, MODEL_SEARCH_THRESHOLD, MarkImageError, Marker, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Message, MessageActions, MessageBody, MessageComposer, MessageContent, MessageDayDivider, MessageFooter, MessageGroup, MessageHeader, MessageRow, MessageScroller, MessageText, ModalDialog, ModelSelector, Motion, NativeSelect, NavigationMenu, NavigationMenuContent, NavigationMenuGroup, NavigationMenuGroupLabel, NavigationMenuItem, NavigationMenuMenu, NavigationMenuSeparator, NavigationMenuTrigger, NavigationMenuViewport, NumberField, OrbitItem, OrbitLayout, PASTE_THRESHOLD_CHARS, PASTE_THRESHOLD_LINES, PASTE_TOKEN_REGEX, Page, PageHeader, PageHeaderActions, PageHeaderContent, PageHeaderDescription, PageHeaderTitle, PageSection, Pagination, PaginationEllipsis, PaginationItem, PaginationNext, PaginationPrevious, PalettePreview, Panel, PanelActions, PanelBody, PanelCard, PanelDescription, PanelFooter, PanelHeader, PanelPlaceholder, PanelTitle, PanelToolbar, PixelPane, PixelResizeHandle, Plan, Popover, PopoverAnchor, PopoverCloseButton, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, Presence, Progress, PropertyList, PropertyRow, PropertyTerm, PropertyValue, Questionnaire, Queue, QueueFollowUps, REDUCED_TRANSPARENCY_QUERY, RadioGroup, RadioGroupItem, Reasoning, ResizableHandle, ResizablePanel, ResizablePanelGroup, SOURCE_SNIPPET_LIMIT, SOURCE_TITLE_LIMIT, STACK_MAX_LINES, STACK_TRACE_MAX_BLOCKS, SceneControls, ScrollArea, SecretInputGroup, Select, SelectChevronsUpDown, SelectContent, SelectItem, SelectLabel, SelectSection, SelectTrigger, SelectValue, Separator, SettingsField, SettingsLayout, SettingsNavigation, SettingsPage, SettingsRow$1 as SettingsRow, SettingsSection, Sheet, SheetBody, SheetCloseButton, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, ShellRail, ShellTopBar, SideRail, SideRailButton, SideRailContent, SideRailFooter, SideRailHeader, SideRailItem, SideRailSection, SidebarNav, SidebarNavButton, SidebarNavContent, SidebarNavFooter, SidebarNavHeader, SidebarNavItem, SidebarNavLabel, SidebarNavResizeHandle, SidebarNavRow, SidebarNavSection, SidebarNavTitle, Skeleton, SkipLink, Slider, Sources, Spinner, SplitLayout, StackTrace, Stat, StatGroup, StatusBar, StatusBarItem, StatusBarSpacer, StatusChip, StatusList, Subagent, Suggestion, Suggestions, Switch, SwitchDescription, SwitchLabel, TALL_CODE_BLOCK_PX, TASK_ITEM_STATUS_LABELS, TERMINAL_MAX_LINES, TEST_RESULTS_LIST_LIMIT, TOOL_STATUS_LABELS, TOOL_VALUE_MAX_CHARS, TRACE_STATUS_LABELS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableNumericCell, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Task, TaskItemList, TaskItemRow, Terminal, TestResults, Text, TextLink, Textarea, ThemeMiniature, ThemeMiniatureSplit, ThemeModeToggle, ThemePicker, ThemePreview, ThemeProvider, ThemeSwatch, ThemeToggle, ThreadPanel, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tool, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TopBar, TopBarBreadcrumb, TopBarPill, TopBarSearch, TopBarSection, TopBarTitle, Trace, TraceDetail, TraceError, TraceLine, TraceMark, TranscriptComposition, Tree, TreeRow, TreeRowActions, UpdateChannelControl, UpdateDialog, ValueCombobox, VirtualWindow, WORK_STATUS_LABELS, WORK_TRACE_STATUS, WorkspaceMark, WorkspaceReorderDialog, WorkspaceSwitcher, accentPresets, alertVariants, allTokens, ansi256ToColor, ansiLineText, appearancePreviewThemes, applyAppearanceFontSettings, badgeVariants, boardCardTitleVariants, boundText, breakdownRows, bubbleVariants, buildFileTree, builtinThemes, buttonVariants, calloutVariants, captureAnchor, cardVariants, centredSquare, chatNoticeVariants, checkMarkImageFile, checkpointLabel, checkpointStatus, citationLabel, citationName, clampFloatingPreviewPosition, clampSplitRatio, clampWindow, classifyFrame, closePane, cn, colorTokens, computeLayoutFrames, confirmationOutcome, contextLabel, contextLevel, contextLevelWord, contextPercent, contextShort, contrastRatio, controlInteractive, controlSize, controlSizeIcon, controlSizes, countChanges, countLeaves, countLines, createAnsiParser, createAppMenuItems, createLayoutState, createVersionedPersistence, cva, decisionReason, dedentLines, defaultDarkThemeId, defaultLightThemeId, defaultPreferenceStorage, defaultThemeSelection, densityTokens, describeChanges, describeCount, describeFrameGroup, designTokens, diffLineVariants, diffStats, diffTargetPath, editorPaletteFor, elevationTokens, entityIconVariants, expandAll, findModel, findTokenRanges, firstFailureKey, flattenFileTree, focusPane, fontOptions, fontSettingsBootstrapScript, fontZoomShortcut, formatAttachmentSize, formatBytes, formatCost, formatDuration, formatExact, formatReleaseDate, formatDuration$1 as formatTestDuration, formatToken, formatTokens, formatToolValue, frameLocation, groupModels, groupStackEntries, hasContextFigures, headingElement, headingVariants, indexFileTree, initialExpanded, initialsFrom, safeScriptStringLiteral as inlineScriptLiteral, isAwaitingAnswer, isCustomAccent, isFailedExit, isFigure, isMarkImageDataUrl, isPasteBlock, isPlainStyle, isQuestionAnswered, isShellIconKey, isThemeAccentId, itemVariants, kbdChordKeys, kbdGroupVariants, kbdVariants, keyedRows, layoutDepth, listLeaves, listedCounts, localStoragePersistence, markImageFromFile, markImageProblemCopy, markerVariants, messageCitations, modelSearchValue, monogram, motionTokens, movePane, moveTarget, moveWorkspace, nearestAnsiColor, needsSearch, neighborLeaf, nextCitationMode, nextSeq, normalizeAppearanceEditorFontSettings, normalizeAppearanceEditorFontSize, normalizeCustomAccent, normalizeEfforts, normalizeLayout, normalizePath, normalizeSurface, paintAccentRoles, parseAnsi, parseDiff, parseInline, parseMessageText, parseStackTrace, partitionQueue, placeCitationMarkers, plainTextFromMarkdown, platformModifierKey, pruneBlocks, quarantineRecord, radiusTokens, readLegacyValue, readVersionedRecord, reasoningTitle, recollapsePastes, reconcileCounts, recoveryEnvelope, recoveryKeyFor, remapCarriedBlocks, resizeFloatingPreview, resizeSplit, resolveAccentPreset, resolveAccentRoles, resolveColors, resolveEffort, resolveFloatingPreviewFrame, resolveShellIcon, resolveSurface, resolveSurfaceState, resolveVariant, resolvedDensity, restoreAnchor, restoreControl, restoreDialogCopy, revealInWindow, safeHref, safePreviewSrc, safeSourceUrl, searchShortcutKeyshortcuts, searchShortcutLabel, settleDecision, sheetVariants, shellIconEntries, shellIconLabel, shouldCollapse, sidebarNavItemClass, sidebarNavItemStateClass, sourceHost, sourceTitle, sourcesLabel, splitLocation, splitPane, splitPaneBalanced, statusDotVariants, stepAppearanceFontSizes, stepCountLabel, stripTrailingBlankLines, suiteKey, suiteState, surfaceAlpha, surfaceInteractive, swapPanes, taskProgress, taskProgressLabel, terminalCssVariables, terminalStatusLabel, testKey, textElement, textVariants, textareaVariants, themeAccentsFor, themeById, themeCssVariables, themeFamilies, themeRecordById, themeRecords, themeScript, themeSurfaces, themesForAppearance, toast, toaster, toggleVariants, tokenRangeAt, tokensAsHex, transcriptDisclosureKey, typeaheadIndex, typographyTokens, undoClosePane, undocumentedTokenAliases, useOptionalTheme, useSideRail, useTheme, validateTheme, validateThemeRegistry, variantFromRecord, withAccent, wrapIndex, writeClipboardText, writeVersionedRecord, zIndexTokens };
|
|
207
|
+
export { ANSI_MAX_LINE_LENGTH, ANSI_RETAIN_LINES, APPEARANCE_EDITOR_FONT_AXES, APPEARANCE_EDITOR_FONT_SIZE_MAX, APPEARANCE_EDITOR_FONT_SIZE_MIN, AboutDialog, AccentPicker, AccentSwatchGroups, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountMenu, ActionButton, Alert, AlertAction, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AnnotationSurface, AppShell, AppShellBody, AppShellContent, AppShellMain, AppearanceEditor, AppearanceEditorActions, AppearanceFontSettingsGroup, AppearancePanel, AppearancePopover, SettingsRow as AppearanceSettingsRow, AspectRatio, Attachment, AttachmentCard, AttachmentList, Avatar, AvatarFallback, AvatarImage, Badge, Board, BoardCardBody, BoardCardTitle, BoardCardTrigger, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Bubble, BusySendButton, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CHAIN_OF_THOUGHT_STATUS_LABELS, CODE_BLOCK_LINE_LIMIT, CalendarSurface, Callout, CalloutTitle, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CatalogBrowser, CatalogDetail, CatalogDetailSection, ChainOfThought, ChainOfThoughtResult, ChainOfThoughtResults, ChainOfThoughtStep, Chat, ChatComposer, ChatEmpty, ChatHeader, ChatNotice, Checkbox, CheckboxDescription, CheckboxLabel, Checkpoint, CodeBlock, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxClear, ComboboxContent, ComboboxControl, ComboboxInput, ComboboxItem, ComboboxSection, ComboboxTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandHint, CommandInput, CommandItem, CommandList, CommandLoading, CommandSeparator, CommandShortcut, CommandStatus, ComposerAttachmentButton, ComposerHint, ComposerMenu, ComposerMenuItem, Confirmation, Context, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, ContextualSidebar, ConversationAvatar, ConversationPane, ConversationSurface, DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS, DatePicker, DetailPanel, DetailPanelBody, DetailPanelField, DetailPanelHeader, DetailPanelSection, Dialog, DialogClose, DialogCloseButton, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiffBlock, DiffSummary, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, EntityIcon, FILE_CHANGE_LABELS, FILE_TREE_AUTO_EXPAND_LIMIT, FILE_TREE_MAX_DEPTH, FILE_TREE_MAX_ROWS, FLOATING_PREVIEW_CORNER_RADIUS, FLOATING_PREVIEW_EDGE_GAP, Field, FieldDescription, FieldError, FieldGroup, FieldInput, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTextArea, FileTree, FloatingPreview, FormField, Heading, HelpCenter, HoverCard, HoverCardContent, HoverCardTrigger, IconPicker, IconPickerDropdown, InlineCitation, InlineCode, Input, InputControl, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputOtp, InputOtpCaret, Item, ItemDescription, ItemEmpty, ItemGroup, ItemGroupEntry, ItemTitle, Kbd, KbdChord, KbdGroup, Label, ListGroup, ListRow, ListRowControl, MARK_IMAGE_MAX_DATA_URL_LENGTH, MARK_IMAGE_MAX_SOURCE_BYTES, MARK_IMAGE_SIZE, MAX_LAYOUT_DEPTH, MAX_LAYOUT_LEAVES, MAX_SPLIT_RATIO, MIN_SPLIT_RATIO, MODEL_SEARCH_THRESHOLD, MarkImageError, Marker, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Message, MessageActions, MessageBody, MessageComposer, MessageContent, MessageDayDivider, MessageFooter, MessageGroup, MessageHeader, MessageRow, MessageScroller, MessageText, ModalDialog, ModelSelector, Motion, NativeSelect, NavigationMenu, NavigationMenuContent, NavigationMenuGroup, NavigationMenuGroupLabel, NavigationMenuItem, NavigationMenuMenu, NavigationMenuSeparator, NavigationMenuTrigger, NavigationMenuViewport, NumberField, OrbitItem, OrbitLayout, PASTE_THRESHOLD_CHARS, PASTE_THRESHOLD_LINES, PASTE_TOKEN_REGEX, Page, PageHeader, PageHeaderActions, PageHeaderContent, PageHeaderDescription, PageHeaderTitle, PageSection, Pagination, PaginationEllipsis, PaginationItem, PaginationNext, PaginationPrevious, PalettePreview, Panel, PanelActions, PanelBody, PanelCard, PanelDescription, PanelFooter, PanelHeader, PanelPlaceholder, PanelTitle, PanelToolbar, PixelPane, PixelResizeHandle, Plan, Popover, PopoverAnchor, PopoverCloseButton, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, Presence, Progress, PropertyList, PropertyRow, PropertyTerm, PropertyValue, Questionnaire, Queue, QueueFollowUps, REDUCED_TRANSPARENCY_QUERY, RadioGroup, RadioGroupItem, Reasoning, ResizableHandle, ResizablePanel, ResizablePanelGroup, SOURCE_SNIPPET_LIMIT, SOURCE_TITLE_LIMIT, STACK_MAX_LINES, STACK_TRACE_MAX_BLOCKS, SceneControls, ScrollArea, SecretInputGroup, Select, SelectChevronsUpDown, SelectContent, SelectItem, SelectLabel, SelectSection, SelectTrigger, SelectValue, Separator, SettingsField, SettingsLayout, SettingsNavigation, SettingsPage, SettingsRow$1 as SettingsRow, SettingsSection, Sheet, SheetBody, SheetCloseButton, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, ShellRail, ShellTopBar, SideRail, SideRailButton, SideRailContent, SideRailFooter, SideRailHeader, SideRailItem, SideRailSection, SidebarNav, SidebarNavButton, SidebarNavContent, SidebarNavFooter, SidebarNavHeader, SidebarNavItem, SidebarNavLabel, SidebarNavResizeHandle, SidebarNavRow, SidebarNavSection, SidebarNavTitle, Skeleton, SkipLink, Slider, Sources, Spinner, SplitLayout, StackTrace, Stat, StatGroup, StatusBar, StatusBarItem, StatusBarSpacer, StatusChip, StatusList, Subagent, Suggestion, Suggestions, Switch, SwitchDescription, SwitchLabel, TALL_CODE_BLOCK_PX, TASK_ITEM_STATUS_LABELS, TERMINAL_MAX_LINES, TEST_RESULTS_LIST_LIMIT, TOOL_STATUS_LABELS, TOOL_VALUE_MAX_CHARS, TRACE_STATUS_LABELS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableNumericCell, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Task, TaskItemList, TaskItemRow, Terminal, TestResults, Text, TextLink, Textarea, ThemeMiniature, ThemeMiniatureSplit, ThemeModeToggle, ThemePicker, ThemePreview, ThemeProvider, ThemeSwatch, ThemeToggle, ThreadPanel, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tool, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TopBar, TopBarBreadcrumb, TopBarPill, TopBarSearch, TopBarSection, TopBarTitle, Trace, TraceDetail, TraceError, TraceLine, TraceMark, TranscriptComposition, Tree, TreeRow, TreeRowActions, UpdateChannelControl, UpdateDialog, ValueCombobox, VirtualWindow, WORK_STATUS_LABELS, WORK_TRACE_STATUS, WorkspaceMark, WorkspaceReorderDialog, WorkspaceSwitcher, accentPresets, alertVariants, allTokens, ansi256ToColor, ansiLineText, appearancePreviewThemes, applyAppearanceFontSettings, badgeVariants, boardCardTitleVariants, boundText, breakdownRows, bubbleVariants, buildFileTree, builtinThemes, buttonVariants, calloutVariants, captureAnchor, cardVariants, centredSquare, chatNoticeVariants, checkMarkImageFile, checkpointLabel, checkpointStatus, citationLabel, citationName, clampFloatingPreviewPosition, clampSplitRatio, clampWindow, classifyFrame, closePane, cn, colorTokens, computeLayoutFrames, confirmationOutcome, contextLabel, contextLevel, contextLevelWord, contextPercent, contextShort, contrastRatio, controlInteractive, controlSize, controlSizeIcon, controlSizes, countChanges, countLeaves, countLines, createAnsiParser, createAppMenuItems, createLayoutState, createVersionedPersistence, cva, decisionReason, dedentLines, defaultDarkThemeId, defaultLightThemeId, defaultPreferenceStorage, defaultThemeSelection, densityTokens, describeChanges, describeCount, describeFrameGroup, designTokens, diffLineVariants, diffStats, diffTargetPath, editorPaletteFor, elevationTokens, entityIconVariants, expandAll, findModel, findTokenRanges, firstFailureKey, flattenFileTree, focusPane, fontOptions, fontSettingsBootstrapScript, fontZoomShortcut, formatAttachmentSize, formatBytes, formatCost, formatDuration, formatExact, formatReleaseDate, formatDuration$1 as formatTestDuration, formatToken, formatTokens, formatToolValue, frameLocation, groupModels, groupStackEntries, hasContextFigures, headingElement, headingVariants, indexFileTree, initialExpanded, initialsFrom, safeScriptStringLiteral as inlineScriptLiteral, isAwaitingAnswer, isCustomAccent, isCustomAccentValue, isFailedExit, isFigure, isMarkImageDataUrl, isPasteBlock, isPlainStyle, isQuestionAnswered, isShellIconKey, isThemeAccentId, itemVariants, kbdChordKeys, kbdGroupVariants, kbdVariants, keyedRows, layoutDepth, listLeaves, listedCounts, localStoragePersistence, markImageFromFile, markImageProblemCopy, markerVariants, messageCitations, modelSearchValue, monogram, motionTokens, movePane, moveTarget, moveWorkspace, nearestAnsiColor, needsSearch, neighborLeaf, nextCitationMode, nextSeq, normalizeAppearanceEditorFontSettings, normalizeAppearanceEditorFontSize, normalizeCustomAccent, normalizeEfforts, normalizeLayout, normalizePath, normalizeSurface, paintAccentRoles, parseAnsi, parseDiff, parseInline, parseMessageText, parseStackTrace, partitionQueue, placeCitationMarkers, plainTextFromMarkdown, platformModifierKey, pruneBlocks, quarantineRecord, radiusTokens, readLegacyValue, readVersionedRecord, reasoningTitle, recollapsePastes, reconcileCounts, recoveryEnvelope, recoveryKeyFor, remapCarriedBlocks, resizeFloatingPreview, resizeSplit, resolveAccentPreset, resolveAccentRoles, resolveColors, resolveEffort, resolveFloatingPreviewFrame, resolveShellIcon, resolveSurface, resolveSurfaceState, resolveVariant, resolvedDensity, restoreAnchor, restoreControl, restoreDialogCopy, revealInWindow, safeHref, safePreviewSrc, safeSourceUrl, searchShortcutKeyshortcuts, searchShortcutLabel, settleDecision, sheetVariants, shellIconEntries, shellIconLabel, shouldCollapse, sidebarNavItemClass, sidebarNavItemStateClass, sourceHost, sourceTitle, sourcesLabel, splitLocation, splitPane, splitPaneBalanced, statusDotVariants, stepAppearanceFontSizes, stepCountLabel, stripTrailingBlankLines, suiteKey, suiteState, surfaceAlpha, surfaceInteractive, swapPanes, taskProgress, taskProgressLabel, terminalCssVariables, terminalStatusLabel, testKey, textElement, textVariants, textareaVariants, themeAccentsFor, themeById, themeCssVariables, themeFamilies, themeRecordById, themeRecords, themeScript, themeSurfaces, themesForAppearance, toast, toaster, toggleVariants, tokenRangeAt, tokensAsHex, transcriptDisclosureKey, typeaheadIndex, typographyTokens, undoClosePane, undocumentedTokenAliases, useOptionalTheme, useSideRail, useTheme, validateTheme, validateThemeRegistry, variantFromRecord, withAccent, wrapIndex, writeClipboardText, writeVersionedRecord, zIndexTokens };
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
"@kobalte/core@^0.13.14"
|
|
8
8
|
],
|
|
9
9
|
"registryDependencies": [
|
|
10
|
+
"@adea-ai/ui/button",
|
|
11
|
+
"@adea-ai/ui/input",
|
|
12
|
+
"@adea-ai/ui/popover",
|
|
10
13
|
"@adea-ai/ui/tooltip",
|
|
11
14
|
"lib"
|
|
12
15
|
],
|
|
@@ -16,6 +19,16 @@
|
|
|
16
19
|
"type": "registry:ui",
|
|
17
20
|
"target": "components/composites/accent-picker/accent-picker.tsx"
|
|
18
21
|
},
|
|
22
|
+
{
|
|
23
|
+
"path": "src/components/composites/accent-picker/color-math.ts",
|
|
24
|
+
"type": "registry:ui",
|
|
25
|
+
"target": "components/composites/accent-picker/color-math.ts"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"path": "src/components/composites/accent-picker/custom-color-popover.tsx",
|
|
29
|
+
"type": "registry:ui",
|
|
30
|
+
"target": "components/composites/accent-picker/custom-color-popover.tsx"
|
|
31
|
+
},
|
|
19
32
|
{
|
|
20
33
|
"path": "src/components/composites/accent-picker/index.ts",
|
|
21
34
|
"type": "registry:ui",
|
package/dist/r/registry.json
CHANGED
|
@@ -2248,6 +2248,9 @@
|
|
|
2248
2248
|
"@kobalte/core@^0.13.14"
|
|
2249
2249
|
],
|
|
2250
2250
|
"registryDependencies": [
|
|
2251
|
+
"@adea-ai/ui/button",
|
|
2252
|
+
"@adea-ai/ui/input",
|
|
2253
|
+
"@adea-ai/ui/popover",
|
|
2251
2254
|
"@adea-ai/ui/tooltip",
|
|
2252
2255
|
"lib"
|
|
2253
2256
|
],
|
|
@@ -2257,6 +2260,16 @@
|
|
|
2257
2260
|
"type": "registry:ui",
|
|
2258
2261
|
"target": "components/composites/accent-picker/accent-picker.tsx"
|
|
2259
2262
|
},
|
|
2263
|
+
{
|
|
2264
|
+
"path": "src/components/composites/accent-picker/color-math.ts",
|
|
2265
|
+
"type": "registry:ui",
|
|
2266
|
+
"target": "components/composites/accent-picker/color-math.ts"
|
|
2267
|
+
},
|
|
2268
|
+
{
|
|
2269
|
+
"path": "src/components/composites/accent-picker/custom-color-popover.tsx",
|
|
2270
|
+
"type": "registry:ui",
|
|
2271
|
+
"target": "components/composites/accent-picker/custom-color-popover.tsx"
|
|
2272
|
+
},
|
|
2260
2273
|
{
|
|
2261
2274
|
"path": "src/components/composites/accent-picker/index.ts",
|
|
2262
2275
|
"type": "registry:ui",
|
|
@@ -2328,6 +2341,7 @@
|
|
|
2328
2341
|
"lucide-solid@^1.65.0"
|
|
2329
2342
|
],
|
|
2330
2343
|
"registryDependencies": [
|
|
2344
|
+
"@adea-ai/ui/accent-picker",
|
|
2331
2345
|
"@adea-ai/ui/action-button",
|
|
2332
2346
|
"@adea-ai/ui/button",
|
|
2333
2347
|
"@adea-ai/ui/dropdown-menu",
|
|
@@ -1,66 +1,177 @@
|
|
|
1
1
|
import { RadioGroup as Radio } from '@kobalte/core/radio-group'
|
|
2
2
|
import type { JSX } from 'solid-js'
|
|
3
|
-
import { For } from 'solid-js'
|
|
3
|
+
import { For, Show } from 'solid-js'
|
|
4
4
|
import { accents } from '../../../lib/accent-presets'
|
|
5
5
|
import { cn } from '../../../lib/utils'
|
|
6
|
+
import { Input } from '../../ui/input'
|
|
6
7
|
import { Tooltip, TooltipContent, TooltipTrigger } from '../../ui/tooltip'
|
|
8
|
+
import { CustomColorPopover } from './custom-color-popover'
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* AccentPicker.
|
|
10
12
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* workspace's
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* The one accent control every level of the app uses: the app's own appearance,
|
|
14
|
+
* a workspace's accent over the app's, a project's icon colour over its
|
|
15
|
+
* workspace's. It is a row of preset swatches, optionally led by an "inherit"
|
|
16
|
+
* swatch and followed by a Custom button that opens a colour picker anchored
|
|
17
|
+
* under it.
|
|
16
18
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* no
|
|
19
|
+
* - `null` is a real value, not an empty one: it means "do not override", so
|
|
20
|
+
* with `inherit` on the swatch row never has an unchecked state and the
|
|
21
|
+
* control can say what the inherited colour is through `inheritLabel`.
|
|
22
|
+
* - A custom colour is a lowercase `#rrggbb`. While one is set no swatch is
|
|
23
|
+
* checked; the Custom button reads pressed and shows the colour. Opening the
|
|
24
|
+
* picker changes nothing until Apply.
|
|
25
|
+
*
|
|
26
|
+
* Swatches paint each preset's light and dark colour on the `dark` class, so a
|
|
27
|
+
* swatch is the colour the setting produces in whichever appearance is in
|
|
28
|
+
* force and the picker needs no theme provider. A host previewing a different
|
|
29
|
+
* appearance (the appearance editor's draft) pins the side with `appearance`.
|
|
21
30
|
*/
|
|
31
|
+
export type AccentPickerOption = Readonly<{
|
|
32
|
+
id: string
|
|
33
|
+
label: string
|
|
34
|
+
light?: string
|
|
35
|
+
dark?: string
|
|
36
|
+
}>
|
|
37
|
+
|
|
22
38
|
export type AccentPickerProps = {
|
|
23
39
|
/** The group's accessible name, e.g. "Icon colour". */
|
|
24
40
|
label: string
|
|
25
|
-
/**
|
|
41
|
+
/** A preset id, a custom `#rrggbb`, or `null` for no override. */
|
|
26
42
|
value: string | null
|
|
27
43
|
onValueChange(value: string | null): void
|
|
44
|
+
/**
|
|
45
|
+
* Whether the row leads with the "inherit" swatch (`null`). On by default;
|
|
46
|
+
* the app's own appearance, which has nothing above it, turns it off.
|
|
47
|
+
*/
|
|
48
|
+
inherit?: boolean
|
|
28
49
|
/** What `null` means here, e.g. "Inherit workspace accent". Also the first swatch's name and tooltip. */
|
|
29
50
|
inheritLabel?: string
|
|
51
|
+
/** The swatches after the inherit one. Defaults to the six brand presets. */
|
|
52
|
+
options?: readonly AccentPickerOption[]
|
|
53
|
+
/** Whether the Custom button follows the swatches. On by default. */
|
|
54
|
+
custom?: boolean
|
|
55
|
+
/** The colour the Custom picker starts on while no custom colour is set. */
|
|
56
|
+
customSeed?: string
|
|
57
|
+
/** Pins the swatches to one side of each preset pair instead of following the `dark` class. */
|
|
58
|
+
appearance?: 'light' | 'dark'
|
|
59
|
+
/**
|
|
60
|
+
* `wrap` (the default) wraps at the container's edge. `row` keeps every
|
|
61
|
+
* swatch on one line at a smaller size, sharing the width equally, so a
|
|
62
|
+
* narrow panel does not wrap them.
|
|
63
|
+
*/
|
|
64
|
+
layout?: 'wrap' | 'row'
|
|
30
65
|
disabled?: boolean
|
|
31
66
|
class?: string
|
|
32
67
|
}
|
|
33
68
|
|
|
34
69
|
const NONE = '__none__'
|
|
70
|
+
const CUSTOM = '__custom__'
|
|
71
|
+
const HEX = /^#[0-9a-f]{6}$/i
|
|
72
|
+
const DEFAULT_CUSTOM_SEED = '#7c3aed'
|
|
73
|
+
|
|
74
|
+
/** Whether a stored accent is a custom `#rrggbb` colour rather than a preset id or `null`. */
|
|
75
|
+
export function isCustomAccentValue(value: string | null | undefined): value is `#${string}` {
|
|
76
|
+
return typeof value === 'string' && HEX.test(value)
|
|
77
|
+
}
|
|
35
78
|
|
|
36
79
|
export function AccentPicker(props: AccentPickerProps) {
|
|
80
|
+
const customValue = () =>
|
|
81
|
+
isCustomAccentValue(props.value) ? props.value.toLowerCase() : undefined
|
|
82
|
+
const inherit = () => props.inherit ?? true
|
|
83
|
+
const row = () => props.layout === 'row'
|
|
84
|
+
const radioValue = () => (customValue() ? CUSTOM : (props.value ?? NONE))
|
|
85
|
+
|
|
86
|
+
// The native colour field stays in the tree, visually hidden, as the
|
|
87
|
+
// control assistive technology and automation can set directly; people use
|
|
88
|
+
// the anchored picker behind the Custom button.
|
|
89
|
+
const commitCustom = (raw: string) => {
|
|
90
|
+
const value = raw.trim().toLowerCase()
|
|
91
|
+
// Only `#rrggbb` is stored; anything else is ignored rather than saved.
|
|
92
|
+
if (HEX.test(value) && value !== customValue()) props.onValueChange(value)
|
|
93
|
+
}
|
|
94
|
+
|
|
37
95
|
return (
|
|
38
|
-
<
|
|
39
|
-
data-slot="swatch-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
disabled={props.disabled}
|
|
43
|
-
onChange={(id) => props.onValueChange(id === NONE ? null : id)}
|
|
44
|
-
class={cn('flex flex-wrap items-center gap-2', props.class)}
|
|
96
|
+
<div
|
|
97
|
+
data-slot="swatch-row"
|
|
98
|
+
data-accent-choices
|
|
99
|
+
class={cn('flex min-w-0 items-center gap-2', row() ? 'w-full' : 'flex-wrap', props.class)}
|
|
45
100
|
>
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
{(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</SwatchItem>
|
|
101
|
+
<Radio
|
|
102
|
+
data-slot="swatch-picker"
|
|
103
|
+
aria-label={props.label}
|
|
104
|
+
orientation="horizontal"
|
|
105
|
+
value={radioValue()}
|
|
106
|
+
disabled={props.disabled}
|
|
107
|
+
onChange={(id) => {
|
|
108
|
+
if (id === CUSTOM) return
|
|
109
|
+
props.onValueChange(id === NONE ? null : id)
|
|
110
|
+
}}
|
|
111
|
+
class={cn(
|
|
112
|
+
row()
|
|
113
|
+
? 'grid min-w-0 flex-1 auto-cols-fr grid-flow-col'
|
|
114
|
+
: 'flex flex-wrap items-center gap-2'
|
|
61
115
|
)}
|
|
62
|
-
|
|
63
|
-
|
|
116
|
+
>
|
|
117
|
+
<Show when={inherit()}>
|
|
118
|
+
<SwatchItem id={NONE} label={props.inheritLabel ?? 'Inherit (default)'} row={row()}>
|
|
119
|
+
<InheritSwatch />
|
|
120
|
+
</SwatchItem>
|
|
121
|
+
</Show>
|
|
122
|
+
<For each={props.options ?? accents}>
|
|
123
|
+
{(option) => {
|
|
124
|
+
const light = () => option.light ?? ''
|
|
125
|
+
const dark = () => option.dark ?? option.light ?? ''
|
|
126
|
+
return (
|
|
127
|
+
<SwatchItem id={option.id} label={option.label} row={row()}>
|
|
128
|
+
<svg class="size-full" viewBox="0 0 16 16" aria-hidden="true">
|
|
129
|
+
<Show
|
|
130
|
+
when={props.appearance}
|
|
131
|
+
fallback={
|
|
132
|
+
<circle
|
|
133
|
+
cx="8"
|
|
134
|
+
cy="8"
|
|
135
|
+
r="8"
|
|
136
|
+
class="fill-(--swatch-light) dark:fill-(--swatch-dark)"
|
|
137
|
+
style={{ '--swatch-light': light(), '--swatch-dark': dark() }}
|
|
138
|
+
/>
|
|
139
|
+
}
|
|
140
|
+
>
|
|
141
|
+
{(appearance) => (
|
|
142
|
+
<circle
|
|
143
|
+
cx="8"
|
|
144
|
+
cy="8"
|
|
145
|
+
r="8"
|
|
146
|
+
fill={appearance() === 'light' ? light() : dark()}
|
|
147
|
+
/>
|
|
148
|
+
)}
|
|
149
|
+
</Show>
|
|
150
|
+
</svg>
|
|
151
|
+
</SwatchItem>
|
|
152
|
+
)
|
|
153
|
+
}}
|
|
154
|
+
</For>
|
|
155
|
+
</Radio>
|
|
156
|
+
<Show when={props.custom ?? true}>
|
|
157
|
+
<CustomColorPopover
|
|
158
|
+
value={customValue()}
|
|
159
|
+
seed={props.customSeed ?? DEFAULT_CUSTOM_SEED}
|
|
160
|
+
disabled={props.disabled}
|
|
161
|
+
onCommit={commitCustom}
|
|
162
|
+
/>
|
|
163
|
+
<Input
|
|
164
|
+
type="color"
|
|
165
|
+
// `w-px` beats the Input's own `w-full` and keeps the hidden field from sizing a narrow panel's scroll width.
|
|
166
|
+
class="sr-only w-px"
|
|
167
|
+
tabIndex={-1}
|
|
168
|
+
aria-label="Custom accent color"
|
|
169
|
+
value={customValue() ?? props.customSeed ?? DEFAULT_CUSTOM_SEED}
|
|
170
|
+
disabled={props.disabled}
|
|
171
|
+
onChange={(event) => commitCustom(event.currentTarget.value)}
|
|
172
|
+
/>
|
|
173
|
+
</Show>
|
|
174
|
+
</div>
|
|
64
175
|
)
|
|
65
176
|
}
|
|
66
177
|
|
|
@@ -82,15 +193,20 @@ function InheritSwatch() {
|
|
|
82
193
|
)
|
|
83
194
|
}
|
|
84
195
|
|
|
85
|
-
function SwatchItem(props: { id: string; label: string; children: JSX.Element }) {
|
|
196
|
+
function SwatchItem(props: { id: string; label: string; row: boolean; children: JSX.Element }) {
|
|
86
197
|
return (
|
|
87
|
-
<Radio.Item
|
|
198
|
+
<Radio.Item
|
|
199
|
+
value={props.id}
|
|
200
|
+
data-accent-option={props.id}
|
|
201
|
+
class={props.row ? 'flex justify-center' : 'contents'}
|
|
202
|
+
>
|
|
88
203
|
<Radio.ItemInput class="peer" />
|
|
89
204
|
<Tooltip>
|
|
90
205
|
<TooltipTrigger
|
|
91
206
|
as={Radio.ItemLabel}
|
|
92
207
|
class={cn(
|
|
93
|
-
'flex
|
|
208
|
+
'flex cursor-pointer items-center justify-center rounded-full border border-border p-0.5',
|
|
209
|
+
props.row ? 'size-6' : 'size-7',
|
|
94
210
|
'peer-focus-visible:border-ring peer-focus-visible:ring-3 peer-focus-visible:ring-primary-subtle',
|
|
95
211
|
'data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary',
|
|
96
212
|
'data-[disabled]:pointer-events-none data-[disabled]:opacity-50'
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** HSV with hue in degrees [0, 360) and saturation/value in [0, 1]. */
|
|
2
|
+
export type Hsv = Readonly<{ h: number; s: number; v: number }>
|
|
3
|
+
|
|
4
|
+
const clamp = (value: number, min = 0, max = 1) => Math.min(max, Math.max(min, value))
|
|
5
|
+
|
|
6
|
+
/** `#rrggbb` (any case) to HSV; anything else is `undefined`. */
|
|
7
|
+
export function hexToHsv(hex: string): Hsv | undefined {
|
|
8
|
+
const match = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(hex.trim())
|
|
9
|
+
if (!match) return undefined
|
|
10
|
+
const [r, g, b] = match.slice(1).map((part) => Number.parseInt(part, 16) / 255) as [
|
|
11
|
+
number,
|
|
12
|
+
number,
|
|
13
|
+
number,
|
|
14
|
+
]
|
|
15
|
+
const max = Math.max(r, g, b)
|
|
16
|
+
const delta = max - Math.min(r, g, b)
|
|
17
|
+
let h = 0
|
|
18
|
+
if (delta !== 0) {
|
|
19
|
+
if (max === r) h = ((g - b) / delta) % 6
|
|
20
|
+
else if (max === g) h = (b - r) / delta + 2
|
|
21
|
+
else h = (r - g) / delta + 4
|
|
22
|
+
}
|
|
23
|
+
h = (h * 60 + 360) % 360
|
|
24
|
+
return { h, s: max === 0 ? 0 : delta / max, v: max }
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** HSV to lowercase `#rrggbb`. */
|
|
28
|
+
export function hsvToHex(hsv: Hsv): `#${string}` {
|
|
29
|
+
const h = ((hsv.h % 360) + 360) % 360
|
|
30
|
+
const s = clamp(hsv.s)
|
|
31
|
+
const v = clamp(hsv.v)
|
|
32
|
+
const c = v * s
|
|
33
|
+
const x = c * (1 - Math.abs(((h / 60) % 2) - 1))
|
|
34
|
+
const m = v - c
|
|
35
|
+
const [r, g, b] =
|
|
36
|
+
h < 60
|
|
37
|
+
? [c, x, 0]
|
|
38
|
+
: h < 120
|
|
39
|
+
? [x, c, 0]
|
|
40
|
+
: h < 180
|
|
41
|
+
? [0, c, x]
|
|
42
|
+
: h < 240
|
|
43
|
+
? [0, x, c]
|
|
44
|
+
: h < 300
|
|
45
|
+
? [x, 0, c]
|
|
46
|
+
: [c, 0, x]
|
|
47
|
+
const part = (channel: number) =>
|
|
48
|
+
Math.round((channel + m) * 255)
|
|
49
|
+
.toString(16)
|
|
50
|
+
.padStart(2, '0')
|
|
51
|
+
return `#${part(r)}${part(g)}${part(b)}`
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { clamp }
|