@adea-ai/ui 0.62.0 → 0.63.1

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.
Files changed (49) hide show
  1. package/README.md +50 -0
  2. package/dist/NOTICE +51 -0
  3. package/dist/components/composites/appearance-editor/appearance-choices.d.ts +5 -0
  4. package/dist/components/composites/appearance-editor/appearance-choices.d.ts.map +1 -0
  5. package/dist/components/composites/appearance-editor/appearance-choices.js +211 -0
  6. package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -0
  7. package/dist/components/composites/appearance-editor/appearance-editor.d.ts +15 -0
  8. package/dist/components/composites/appearance-editor/appearance-editor.d.ts.map +1 -0
  9. package/dist/components/composites/appearance-editor/appearance-editor.js +280 -0
  10. package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -0
  11. package/dist/components/composites/appearance-editor/appearance-rows.d.ts +18 -0
  12. package/dist/components/composites/appearance-editor/appearance-rows.d.ts.map +1 -0
  13. package/dist/components/composites/appearance-editor/appearance-rows.js +101 -0
  14. package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -0
  15. package/dist/components/composites/appearance-editor/appearance-types.d.ts +42 -0
  16. package/dist/components/composites/appearance-editor/appearance-types.d.ts.map +1 -0
  17. package/dist/components/composites/appearance-editor/index.d.ts +4 -0
  18. package/dist/components/composites/appearance-editor/index.d.ts.map +1 -0
  19. package/dist/components/composites/appearance-editor/index.js +3 -0
  20. package/dist/components/composites/appearance-editor/theme-preview.d.ts +17 -0
  21. package/dist/components/composites/appearance-editor/theme-preview.d.ts.map +1 -0
  22. package/dist/components/composites/appearance-editor/theme-preview.js +158 -0
  23. package/dist/components/composites/appearance-editor/theme-preview.js.map +1 -0
  24. package/dist/components/ui/select/select.d.ts +5 -1
  25. package/dist/components/ui/select/select.d.ts.map +1 -1
  26. package/dist/components/ui/select/select.js +24 -20
  27. package/dist/components/ui/select/select.js.map +1 -1
  28. package/dist/index.d.ts +1 -0
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +3 -1
  31. package/dist/r/appearance-editor.json +51 -0
  32. package/dist/r/registry.json +51 -0
  33. package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +173 -0
  34. package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +239 -0
  35. package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +122 -0
  36. package/dist/r/src/components/composites/appearance-editor/appearance-types.ts +40 -0
  37. package/dist/r/src/components/composites/appearance-editor/index.ts +12 -0
  38. package/dist/r/src/components/composites/appearance-editor/theme-preview.tsx +128 -0
  39. package/dist/r/src/components/ui/select/select.tsx +8 -3
  40. package/package.json +3 -2
  41. package/registry.json +51 -0
  42. package/src/components/composites/appearance-editor/appearance-choices.tsx +173 -0
  43. package/src/components/composites/appearance-editor/appearance-editor.tsx +239 -0
  44. package/src/components/composites/appearance-editor/appearance-rows.tsx +122 -0
  45. package/src/components/composites/appearance-editor/appearance-types.ts +40 -0
  46. package/src/components/composites/appearance-editor/index.ts +12 -0
  47. package/src/components/composites/appearance-editor/theme-preview.tsx +128 -0
  48. package/src/components/ui/select/select.tsx +8 -3
  49. package/src/index.ts +1 -0
@@ -0,0 +1,239 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2026 Wing
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ /*
25
+ * Composition substantially translated from Zeron settings/appearance.rs and
26
+ * settings/widgets.rs, pinned at 30a9a9537c5ec96226c87f4bf349b6f77c5dfb59,
27
+ * preserving Adea's existing appearance-surface.tsx port: System/Light/Dark
28
+ * miniatures, compact independent theme rows, accent swatches and helper copy,
29
+ * glass chips, and theme library affordance. Kobalte replaces the port's manual
30
+ * radio keyboard model. The controlled draft and explicit action ports replace
31
+ * GPUI globals and app-specific storage/native authority. Save/Cancel/Reset and
32
+ * custom accent/reduced-transparency are accepted Adea divergences (#425).
33
+ */
34
+ import { EyeOff, Palette, PanelsTopLeft, SlidersHorizontal } from 'lucide-solid'
35
+ import { Show, createUniqueId } from 'solid-js'
36
+ import { cn } from '#lib/utils'
37
+ import { Button } from '../../ui/button/button'
38
+ import { Input } from '../../ui/input/input'
39
+
40
+ import { Switch } from '../../ui/switch/switch'
41
+ import {
42
+ Popover,
43
+ PopoverContent,
44
+ PopoverDescription,
45
+ PopoverTitle,
46
+ PopoverTrigger,
47
+ } from '../../ui/popover/popover'
48
+ import type { AppearanceEditorProps, AppearancePopoverProps } from './appearance-types'
49
+ import { ModeChoices, AccentChoices, GlassChoices } from './appearance-choices'
50
+ import { SettingsRow, ThemeRow } from './appearance-rows'
51
+
52
+ /**
53
+ * A live editor whose persistence and preview authority belong to its host.
54
+ * No ThemeProvider is required, and no catalogue, renderer engine or storage is
55
+ * imported. Hosts normalize unknown IDs and custom colors, report recovery,
56
+ * snapshot on open, preview on changes, commit on Save, and restore on dismissal.
57
+ * Both theme rows remain mounted when mode changes. Typeface/density axes are
58
+ * deliberately absent from Adea #425's accepted surface.
59
+ */
60
+ export function AppearanceEditor(props: AppearanceEditorProps) {
61
+ const errorId = createUniqueId()
62
+ const saveReasonId = createUniqueId()
63
+ const custom = () =>
64
+ props.draft.accent !== 'theme' &&
65
+ !props.accentOptions.some((option) => option.id === props.draft.accent)
66
+ const accentDescription = () => {
67
+ if (props.draft.accent === 'theme') return "Theme default · Uses the palette's intended color."
68
+ const name = props.accentOptions.find((option) => option.id === props.draft.accent)?.label
69
+ return `${name ?? 'Custom'} · Controls, glyphs, selections, code, and activity.`
70
+ }
71
+ const glassDescription = () =>
72
+ props.draft.surface === 'opaque'
73
+ ? 'Solid surfaces for every theme.'
74
+ : props.draft.surface === 'frosted'
75
+ ? 'Theme-colored glass where supported.'
76
+ : (props.surfaceCapability.themeDefaultDescription ?? "Uses this theme's default surface.")
77
+ return (
78
+ <div data-appearance-editor class={cn('min-w-0', props.class)}>
79
+ <Show when={props.recoveryNotice}>
80
+ <p role="status" class="px-4 py-2 text-sm text-muted-foreground">
81
+ {props.recoveryNotice}
82
+ </p>
83
+ </Show>
84
+ <ModeChoices {...props} />
85
+ <div class="divide-y divide-border rounded-lg border">
86
+ <ThemeRow
87
+ appearance="light"
88
+ selectedId={props.draft.lightThemeId}
89
+ preview={props.lightTheme}
90
+ themes={props.themes}
91
+ disabled={props.saving}
92
+ onSelect={(lightThemeId) => props.onChange({ lightThemeId })}
93
+ />
94
+ <ThemeRow
95
+ appearance="dark"
96
+ selectedId={props.draft.darkThemeId}
97
+ preview={props.darkTheme}
98
+ themes={props.themes}
99
+ disabled={props.saving}
100
+ onSelect={(darkThemeId) => props.onChange({ darkThemeId })}
101
+ />
102
+ <SettingsRow
103
+ stacked
104
+ title="Accent"
105
+ icon={<SlidersHorizontal />}
106
+ description={accentDescription()}
107
+ >
108
+ <AccentChoices {...props} />
109
+ </SettingsRow>
110
+ <Show when={custom()}>
111
+ <div class="px-4 py-3">
112
+ <label class="mb-2 block text-xs font-medium" for={`${errorId}-input`}>
113
+ Custom accent
114
+ </label>
115
+ <Input
116
+ id={`${errorId}-input`}
117
+ value={props.draft.accent}
118
+ disabled={props.saving}
119
+ aria-invalid={!!props.customAccentError}
120
+ aria-describedby={props.customAccentError ? errorId : undefined}
121
+ onInput={(event) => props.onChange({ accent: event.currentTarget.value })}
122
+ />
123
+ <Show when={props.customAccentError}>
124
+ <p id={errorId} role="alert" class="mt-1 text-xs text-destructive">
125
+ {props.customAccentError}
126
+ </p>
127
+ </Show>
128
+ </div>
129
+ </Show>
130
+ <SettingsRow title="Glass" icon={<PanelsTopLeft />} description={glassDescription()}>
131
+ <GlassChoices {...props} />
132
+ </SettingsRow>
133
+ <Show when={!props.surfaceCapability.frosted && props.surfaceCapability.reason}>
134
+ <p role="status" class="px-4 py-2 text-xs text-muted-foreground">
135
+ {props.surfaceCapability.reason}
136
+ </p>
137
+ </Show>
138
+ <SettingsRow
139
+ title="Reduce transparency"
140
+ icon={<EyeOff />}
141
+ description="Prefer solid surfaces, including during live preview."
142
+ >
143
+ <Switch
144
+ checked={props.draft.reduceTransparency}
145
+ disabled={props.saving}
146
+ onChange={(reduceTransparency: boolean) => props.onChange({ reduceTransparency })}
147
+ aria-label="Reduce transparency"
148
+ />
149
+ </SettingsRow>
150
+ <SettingsRow
151
+ title="Theme library"
152
+ icon={<Palette />}
153
+ description={
154
+ props.onManageThemes
155
+ ? 'Manage themes through the application.'
156
+ : 'Theme import is unavailable.'
157
+ }
158
+ >
159
+ <Button
160
+ type="button"
161
+ size="sm"
162
+ variant="outline"
163
+ disabled={!props.onManageThemes || props.saving}
164
+ onClick={() => props.onManageThemes?.()}
165
+ >
166
+ Manage themes
167
+ </Button>
168
+ </SettingsRow>
169
+ </div>
170
+ <Show when={props.saveDisabledReason}>
171
+ <p id={saveReasonId} role="status" class="px-4 pt-3 text-xs text-muted-foreground">
172
+ {props.saveDisabledReason}
173
+ </p>
174
+ </Show>
175
+ <div class="flex flex-wrap items-center gap-2 px-4 py-4">
176
+ <Button
177
+ type="button"
178
+ size="sm"
179
+ variant="ghost"
180
+ disabled={props.saving}
181
+ onClick={() => props.onReset()}
182
+ >
183
+ Reset
184
+ </Button>
185
+ <div class="ml-auto flex gap-2">
186
+ <Button
187
+ type="button"
188
+ size="sm"
189
+ variant="outline"
190
+ disabled={props.saving}
191
+ onClick={() => props.onCancel()}
192
+ >
193
+ Cancel
194
+ </Button>
195
+ <Button
196
+ type="button"
197
+ size="sm"
198
+ disabled={props.saving || !!props.customAccentError || !!props.saveDisabledReason}
199
+ aria-busy={props.saving}
200
+ aria-describedby={props.saveDisabledReason ? saveReasonId : undefined}
201
+ onClick={() => props.onSave()}
202
+ >
203
+ {props.saving ? 'Saving…' : 'Save'}
204
+ </Button>
205
+ </div>
206
+ </div>
207
+ </div>
208
+ )
209
+ }
210
+
211
+ /** Modal anchoring/dismissal and nested-listbox behavior come from Kobalte.
212
+ * Its measured available height also bounds scrolling, keeping footer actions
213
+ * reachable when a narrow popup begins below its trigger. */
214
+ export function AppearancePopover(props: AppearancePopoverProps) {
215
+ return (
216
+ <Popover
217
+ open={props.open}
218
+ modal
219
+ onOpenChange={(open) => (open ? props.onOpen() : props.onDismiss())}
220
+ >
221
+ <PopoverTrigger
222
+ as={Button}
223
+ type="button"
224
+ variant="ghost"
225
+ size="icon-sm"
226
+ aria-label="Appearance settings"
227
+ >
228
+ <Palette />
229
+ </PopoverTrigger>
230
+ <PopoverContent class="w-lg max-w-[calc(100vw-2rem)] max-h-(--kb-popper-content-available-height) overflow-y-auto">
231
+ <PopoverTitle>Appearance</PopoverTitle>
232
+ <PopoverDescription>
233
+ Changes preview immediately. Save keeps them; Cancel restores the previous appearance.
234
+ </PopoverDescription>
235
+ <AppearanceEditor {...props} />
236
+ </PopoverContent>
237
+ </Popover>
238
+ )
239
+ }
@@ -0,0 +1,122 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2026 Wing
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ // Retains the compact divided row and palette-preview selector from the pinned
25
+ // Zeron/Adea composition; Kobalte owns option navigation and nested dismissal.
26
+ import type { AdeaTheme, AdeaThemeRecord } from '@adea-ai/themes'
27
+ import { Show, createMemo, createSignal, type JSX } from 'solid-js'
28
+ import { Palette } from 'lucide-solid'
29
+ import { cn } from '#lib/utils'
30
+ import {
31
+ Select,
32
+ SelectContent,
33
+ SelectItem,
34
+ SelectTrigger,
35
+ SelectValue,
36
+ } from '../../ui/select/select'
37
+ import { PalettePreview } from './theme-preview'
38
+
39
+ export function SettingsRow(props: {
40
+ title: string
41
+ icon: JSX.Element
42
+ description?: JSX.Element
43
+ stacked?: boolean
44
+ children: JSX.Element
45
+ }) {
46
+ return (
47
+ <section
48
+ class={cn('flex flex-col gap-3 px-4 py-4', { 'sm:flex-row sm:items-center': !props.stacked })}
49
+ >
50
+ <div class="flex min-w-0 flex-1 items-center gap-3">
51
+ <span
52
+ class="flex size-9 shrink-0 items-center justify-center rounded-lg border bg-foreground/5 text-muted-foreground [&_svg]:size-4"
53
+ aria-hidden="true"
54
+ >
55
+ {props.icon}
56
+ </span>
57
+ <div class="min-w-0">
58
+ <h3 class="text-sm font-medium">{props.title}</h3>
59
+ <Show when={props.description}>
60
+ <div class="mt-0.5 text-xs text-muted-foreground">{props.description}</div>
61
+ </Show>
62
+ </div>
63
+ </div>
64
+ <div class="min-w-0 shrink-0">{props.children}</div>
65
+ </section>
66
+ )
67
+ }
68
+
69
+ export function ThemeRow(props: {
70
+ appearance: 'light' | 'dark'
71
+ selectedId: string
72
+ preview: AdeaTheme
73
+ themes: readonly AdeaThemeRecord[]
74
+ disabled?: boolean
75
+ onSelect: (id: string) => void
76
+ }) {
77
+ const [portalMount, setPortalMount] = createSignal<HTMLDivElement>()
78
+ const options = createMemo(() =>
79
+ props.themes.filter((theme) => theme.appearance === props.appearance)
80
+ )
81
+ const selected = createMemo(
82
+ () =>
83
+ options().find((theme) => theme.id === props.selectedId) ??
84
+ options().find((theme) => theme.id === props.preview.id)
85
+ )
86
+ const label = () => (props.appearance === 'light' ? 'Light theme' : 'Dark theme')
87
+ return (
88
+ <SettingsRow title={label()} icon={<Palette />}>
89
+ <div ref={setPortalMount}>
90
+ <Select
91
+ modal={false}
92
+ options={options()}
93
+ value={selected()}
94
+ optionValue="id"
95
+ optionTextValue="name"
96
+ disabled={props.disabled || options().length === 0}
97
+ onChange={(theme) => {
98
+ if (theme) props.onSelect(theme.id)
99
+ }}
100
+ itemComponent={(item) => (
101
+ <SelectItem item={item.item}>
102
+ <PalettePreview theme={item.item.rawValue} />
103
+ {item.item.rawValue.name}
104
+ </SelectItem>
105
+ )}
106
+ >
107
+ <SelectTrigger size="sm" aria-label={label()} class="w-full sm:w-52">
108
+ <SelectValue>
109
+ {() => (
110
+ <>
111
+ <PalettePreview theme={props.preview} />
112
+ <span>{selected()?.name ?? props.preview.name}</span>
113
+ </>
114
+ )}
115
+ </SelectValue>
116
+ </SelectTrigger>
117
+ <SelectContent portalMount={portalMount()} />
118
+ </Select>
119
+ </div>
120
+ </SettingsRow>
121
+ )
122
+ }
@@ -0,0 +1,40 @@
1
+ import type { AccentPreset, AdeaTheme, AdeaThemeRecord } from '@adea-ai/themes'
2
+
3
+ export type AppearanceDraft = Readonly<{
4
+ mode: 'system' | 'light' | 'dark'
5
+ lightThemeId: string
6
+ darkThemeId: string
7
+ /** Theme default, a canonical preset id, or the host's custom accent draft. */
8
+ accent: string
9
+ surface: 'theme' | 'frosted' | 'opaque'
10
+ reduceTransparency: boolean
11
+ }>
12
+
13
+ export type AppearanceEditorProps = {
14
+ draft: AppearanceDraft
15
+ /** Resolved preview themes, including the host's validated accent overlay. */
16
+ lightTheme: AdeaTheme
17
+ darkTheme: AdeaTheme
18
+ resolvedAppearance: 'light' | 'dark'
19
+ themes: readonly AdeaThemeRecord[]
20
+ accentOptions: readonly AccentPreset[]
21
+ onChange: (patch: Partial<AppearanceDraft>) => void
22
+ onSave: () => void
23
+ onCancel: () => void
24
+ onReset: () => void
25
+ customAccentError?: string
26
+ customAccentValue?: string
27
+ saveDisabledReason?: string
28
+ saving?: boolean
29
+ recoveryNotice?: string
30
+ surfaceCapability: { frosted: boolean; reason?: string; themeDefaultDescription?: string }
31
+ /** Undefined means theme import is unavailable, never a working-looking action. */
32
+ onManageThemes?: () => void
33
+ class?: string
34
+ }
35
+
36
+ export type AppearancePopoverProps = AppearanceEditorProps & {
37
+ open: boolean
38
+ onOpen: () => void
39
+ onDismiss: () => void
40
+ }
@@ -0,0 +1,12 @@
1
+ export { AppearanceEditor, AppearancePopover } from './appearance-editor'
2
+ export type {
3
+ AppearanceDraft,
4
+ AppearanceEditorProps,
5
+ AppearancePopoverProps,
6
+ } from './appearance-types'
7
+ export {
8
+ ThemeMiniature,
9
+ ThemeMiniatureSplit,
10
+ PalettePreview,
11
+ type ThemeMiniatureProps,
12
+ } from './theme-preview'
@@ -0,0 +1,128 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2026 Wing
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ /*
25
+ * Substantially translated from Zeron crates/ui/src/settings/appearance.rs
26
+ * `bar`, `miniature`, `miniature_split`, and `palette_preview`, revision
27
+ * 30a9a9537c5ec96226c87f4bf349b6f77c5dfb59, via Adea's existing
28
+ * packages/ui/src/components/theme-preview.tsx adaptation.
29
+ * Retains the sidebar/pane decomposition, exact bar fractions and opacity,
30
+ * split outer corners, and three-band palette strip. GPUI and Adea's local
31
+ * ThemeVariant are replaced by Solid and the canonical AdeaTheme schema.
32
+ * Dynamic inline colors are theme data; no palette is authored here.
33
+ */
34
+ import type { AdeaTheme } from '@adea-ai/themes'
35
+ import { For } from 'solid-js'
36
+ import { cn } from '#lib/utils'
37
+
38
+ export type ThemeMiniatureProps = {
39
+ theme: AdeaTheme
40
+ corners?: 'all' | 'left' | 'right'
41
+ class?: string
42
+ }
43
+
44
+ function Bar(props: { fraction: number; opacity: number; color: string }) {
45
+ return (
46
+ <span
47
+ class="h-[5px] rounded-[3px]"
48
+ style={{
49
+ width: `${Math.round(props.fraction * 100)}%`,
50
+ 'background-color': props.color,
51
+ opacity: props.opacity,
52
+ }}
53
+ />
54
+ )
55
+ }
56
+
57
+ export function ThemeMiniature(props: ThemeMiniatureProps) {
58
+ return (
59
+ <span
60
+ data-theme-miniature
61
+ aria-hidden="true"
62
+ class={cn(
63
+ 'flex size-full overflow-hidden',
64
+ {
65
+ 'rounded-md': !props.corners || props.corners === 'all',
66
+ 'rounded-l-md': props.corners === 'left',
67
+ 'rounded-r-md': props.corners === 'right',
68
+ },
69
+ props.class
70
+ )}
71
+ style={{ 'background-color': props.theme.colors.surface }}
72
+ >
73
+ <span class="flex h-full w-11 shrink-0 flex-col gap-[7px] overflow-hidden px-2 pt-3.5">
74
+ <Bar fraction={0.7} opacity={0.34} color={props.theme.colors.foreground} />
75
+ <Bar fraction={1} opacity={0.22} color={props.theme.colors.foreground} />
76
+ <Bar fraction={0.85} opacity={0.22} color={props.theme.colors.foreground} />
77
+ <Bar fraction={1} opacity={0.22} color={props.theme.colors.foreground} />
78
+ </span>
79
+ <span
80
+ class="my-2 mr-2 flex min-w-0 flex-1 flex-col gap-[7px] overflow-hidden rounded-md border border-(--appearance-preview-border) p-2.5"
81
+ style={{
82
+ 'background-color': props.theme.colors.background,
83
+ '--appearance-preview-border': props.theme.colors.border,
84
+ }}
85
+ >
86
+ <Bar fraction={0.62} opacity={0.34} color={props.theme.colors.foreground} />
87
+ <Bar fraction={0.88} opacity={0.22} color={props.theme.colors.foreground} />
88
+ <Bar fraction={0.76} opacity={0.22} color={props.theme.colors.foreground} />
89
+ <Bar fraction={0.52} opacity={0.22} color={props.theme.colors.foreground} />
90
+ </span>
91
+ </span>
92
+ )
93
+ }
94
+
95
+ export function ThemeMiniatureSplit(props: { light: AdeaTheme; dark: AdeaTheme; class?: string }) {
96
+ return (
97
+ <span class={cn('flex size-full', props.class)} aria-hidden="true">
98
+ <span class="h-full w-1/2 overflow-hidden">
99
+ <ThemeMiniature theme={props.light} corners="left" />
100
+ </span>
101
+ <span class="h-full w-1/2 overflow-hidden">
102
+ <ThemeMiniature theme={props.dark} corners="right" />
103
+ </span>
104
+ </span>
105
+ )
106
+ }
107
+
108
+ export function PalettePreview(props: { theme: AdeaTheme; class?: string }) {
109
+ const bands = () => [
110
+ props.theme.colors.surface,
111
+ props.theme.colors.background,
112
+ props.theme.colors.accent,
113
+ ]
114
+ return (
115
+ <span
116
+ class={cn(
117
+ 'flex h-[18px] w-[30px] shrink-0 overflow-hidden rounded-[5px] border border-(--appearance-preview-border)',
118
+ props.class
119
+ )}
120
+ aria-hidden="true"
121
+ style={{ '--appearance-preview-border': props.theme.colors.border }}
122
+ >
123
+ <For each={bands()}>
124
+ {(band) => <span class="h-full w-1/3" style={{ 'background-color': band }} />}
125
+ </For>
126
+ </span>
127
+ )
128
+ }
@@ -129,11 +129,16 @@ export function SelectValue(props: SelectValueProps) {
129
129
  * which is what makes a Select able to render a typed option rather than a
130
130
  * string; `children` here is for content above the list, such as a filter hint.
131
131
  */
132
- export function SelectContent(props: ComponentProps<typeof KobalteSelect.Content>) {
133
- const [local, rest] = splitProps(props, ['class', 'children'])
132
+ export type SelectContentProps = ComponentProps<typeof KobalteSelect.Content> & {
133
+ /** Keep a nested menu inside its enclosing modal's accessible subtree. */
134
+ portalMount?: HTMLElement
135
+ }
136
+
137
+ export function SelectContent(props: SelectContentProps) {
138
+ const [local, rest] = splitProps(props, ['class', 'children', 'portalMount'])
134
139
 
135
140
  return (
136
- <KobalteSelect.Portal>
141
+ <KobalteSelect.Portal mount={local.portalMount}>
137
142
  <KobalteSelect.Content
138
143
  class={cn(
139
144
  'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg',
package/src/index.ts CHANGED
@@ -96,6 +96,7 @@ export * from './components/composites/account-menu'
96
96
  export * from './components/composites/list-row'
97
97
  export * from './components/composites/settings'
98
98
  export * from './components/composites/stat'
99
+ export * from './components/composites/appearance-editor'
99
100
  export * from './components/composites/update-dialog'
100
101
  export * from './components/composites/workspace-mark'
101
102