@burdenoff/fe-libs 2026.1119.5 → 2026.1119.7
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/chrome/HeaderThemeSwitcher.js +1 -1
- package/dist/chrome/PersonaSurfaceControls.js +82 -189
- package/dist/chrome/PersonaViewsList.d.ts +28 -0
- package/dist/chrome/PersonaViewsList.js +139 -0
- package/dist/chrome/ThemePreferences.js +16 -16
- package/dist/chrome/appearance/AppearanceColourSection.d.ts +17 -0
- package/dist/chrome/appearance/AppearanceColourSection.js +337 -0
- package/dist/chrome/appearance/AppearanceDisplaySection.d.ts +7 -0
- package/dist/chrome/appearance/AppearanceDisplaySection.js +137 -0
- package/dist/chrome/appearance/AppearanceModeDepth.d.ts +11 -0
- package/dist/chrome/appearance/AppearanceModeDepth.js +158 -0
- package/dist/chrome/appearance/AppearancePreferences.d.ts +13 -0
- package/dist/chrome/appearance/AppearancePreferences.js +308 -0
- package/dist/chrome/appearance/AppearancePreview.d.ts +23 -0
- package/dist/chrome/appearance/AppearancePreview.js +218 -0
- package/dist/chrome/appearance/AppearanceThemeSection.d.ts +14 -0
- package/dist/chrome/appearance/AppearanceThemeSection.js +162 -0
- package/dist/chrome/appearance/ColourPanel.d.ts +37 -0
- package/dist/chrome/appearance/ColourPanel.js +264 -0
- package/dist/chrome/appearance/ThemeDialog.d.ts +21 -0
- package/dist/chrome/appearance/ThemeDialog.js +378 -0
- package/dist/chrome/appearance/appearanceShared.d.ts +24 -0
- package/dist/chrome/appearance/appearanceShared.js +46 -0
- package/dist/chrome/appearance/appearanceUi.d.ts +49 -0
- package/dist/chrome/appearance/appearanceUi.js +98 -0
- package/dist/chrome/appearance/useAppearanceLabels.d.ts +181 -0
- package/dist/chrome/appearance/useAppearanceLabels.js +259 -0
- package/dist/chrome/index.d.ts +1 -0
- package/dist/chrome/personaViewOptions.d.ts +8 -0
- package/dist/chrome/personaViewOptions.js +14 -0
- package/dist/chrome/shell/NewMenu.d.ts +13 -1
- package/dist/chrome/shell/NewMenu.js +27 -14
- package/dist/chrome/shell/ShellSidebar.js +2 -0
- package/dist/chrome/shell/SidebarProfileMenu.d.ts +36 -4
- package/dist/chrome/shell/SidebarProfileMenu.js +423 -331
- package/dist/chrome/shell/WorkspaceAccountCard.d.ts +22 -0
- package/dist/chrome/shell/WorkspaceAccountCard.js +102 -0
- package/dist/chrome/shell/pageHost.d.ts +19 -0
- package/dist/chrome/shell/pageHost.js +21 -0
- package/dist/chrome/shell/pageWidth.d.ts +39 -0
- package/dist/chrome/shell/pageWidth.js +18 -0
- package/dist/chrome/shellLabelManifest.d.ts +6 -0
- package/dist/chrome.js +26 -25
- package/dist/platform-pages/AppearanceSettingsPage.d.ts +11 -1
- package/dist/platform-pages/AppearanceSettingsPage.js +15 -8
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +346 -345
- package/dist/shared/backgrounds/BackgroundSettingsSection.d.ts +11 -0
- package/dist/shared/backgrounds/BackgroundSettingsSection.js +67 -0
- package/dist/shared/backgrounds/backgroundSectionLabels.d.ts +14 -0
- package/dist/shared/backgrounds/backgroundSectionLabels.js +36 -0
- package/dist/shared/backgrounds/index.d.ts +3 -0
- package/dist/shared/backgrounds/useBackgroundColors.js +3 -2
- package/dist/shared/backgrounds/useStartPageBackground.d.ts +12 -0
- package/dist/shared/backgrounds/useStartPageBackground.js +23 -0
- package/dist/shared/providers/AppShellProvider.d.ts +20 -1
- package/dist/shared/providers/AppShellProvider.js +230 -222
- package/dist/shared/providers/shell/PaletteThemeProvider.d.ts +13 -0
- package/dist/shared/providers/shell/PaletteThemeProvider.js +366 -0
- package/dist/shared/providers/shell/ThemeProvider.d.ts +9 -76
- package/dist/shared/providers/shell/ThemeProvider.js +63 -55
- package/dist/shared/providers/shell/appearance/colour.d.ts +29 -0
- package/dist/shared/providers/shell/appearance/colour.js +79 -0
- package/dist/shared/providers/shell/appearance/contrastFix.d.ts +70 -0
- package/dist/shared/providers/shell/appearance/contrastFix.js +117 -0
- package/dist/shared/providers/shell/appearance/index.d.ts +9 -0
- package/dist/shared/providers/shell/appearance/model.d.ts +68 -0
- package/dist/shared/providers/shell/appearance/model.js +92 -0
- package/dist/shared/providers/shell/appearance/operations.d.ts +70 -0
- package/dist/shared/providers/shell/appearance/operations.js +160 -0
- package/dist/shared/providers/shell/appearance/palettes.d.ts +111 -0
- package/dist/shared/providers/shell/appearance/palettes.js +460 -0
- package/dist/shared/providers/shell/appearance/storage.d.ts +39 -0
- package/dist/shared/providers/shell/appearance/storage.js +186 -0
- package/dist/shared/providers/shell/appearance/tokens.d.ts +5 -0
- package/dist/shared/providers/shell/appearance/tokens.js +43 -0
- package/dist/shared/providers/shell/appearance/types.d.ts +80 -0
- package/dist/shared/providers/shell/appearance/types.js +28 -0
- package/dist/shared/providers/shell/index.d.ts +1 -1
- package/dist/shared/providers/shell/responsiveDisplaySettings.d.ts +27 -0
- package/dist/shared/providers/shell/responsiveDisplaySettings.js +6 -0
- package/dist/shared/providers/shell/themeContext.d.ts +162 -0
- package/dist/shared/providers/shell/themeContext.js +4 -0
- package/dist/shared-backgrounds.js +4 -1
- package/dist/shell-native/system-bars.d.ts +5 -1
- package/dist/shell-native/system-bars.js +1 -1
- package/dist/ui/dropdown-menu.js +2 -0
- package/dist/ui/popover.js +1 -0
- package/dist/ui/select.js +1 -0
- package/package.json +5 -1
- package/src/shared/styles/page-widths.css +38 -0
- package/src/shared/tokens/build/brands/healthybowl.css +25 -3
- package/src/shared/tokens/build/themes.css +266 -0
- package/src/shared/tokens/display-settings.css +569 -0
- package/src/shared/tokens/tokens.css +4 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { hasLightMode as e, lookModeOf as t, resolveAppearance as n } from "../../shared/providers/shell/appearance/model.js";
|
|
2
|
+
import { PALETTE_NAMES as r } from "../../shared/providers/shell/appearance/types.js";
|
|
3
|
+
import { Button as i } from "../../ui/button.js";
|
|
4
|
+
import { DropdownMenu as a, DropdownMenuContent as o, DropdownMenuItem as s, DropdownMenuTrigger as c } from "../../ui/dropdown-menu.js";
|
|
5
|
+
import { MiniShell as l } from "./AppearancePreview.js";
|
|
6
|
+
import { accentNameOf as u } from "./appearanceShared.js";
|
|
7
|
+
import { AppearanceSection as d, SelectedCheck as f, Tag as p, optionClass as m, radioTabIndex as h, useRadioGroupKeys as g } from "./appearanceUi.js";
|
|
8
|
+
import { Check as _, Copy as v, MoreHorizontal as y, Palette as b, Pencil as x, Plus as S, Trash2 as C } from "lucide-react";
|
|
9
|
+
import { jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
10
|
+
// src/chrome/appearance/AppearanceThemeSection.tsx
|
|
11
|
+
function E({ appearance: E, brand: D, labels: O, onChoosePalette: k, onCreate: A, onEdit: j, onDuplicate: M, onDelete: N }) {
|
|
12
|
+
let P = g(), { settings: F, defaults: I, systemDark: L, activeLook: R } = E, z = (e) => n({
|
|
13
|
+
palette: e,
|
|
14
|
+
mode: F.mode,
|
|
15
|
+
darkDepth: F.darkDepth,
|
|
16
|
+
accent: "auto",
|
|
17
|
+
colours: []
|
|
18
|
+
}, {
|
|
19
|
+
systemDark: L,
|
|
20
|
+
brand: D
|
|
21
|
+
}), B = (e) => n({
|
|
22
|
+
palette: e.palette,
|
|
23
|
+
mode: t(e, F.mode),
|
|
24
|
+
darkDepth: F.darkDepth,
|
|
25
|
+
accent: e.accent,
|
|
26
|
+
colours: F.colours
|
|
27
|
+
}, {
|
|
28
|
+
systemDark: L,
|
|
29
|
+
brand: D
|
|
30
|
+
});
|
|
31
|
+
return /* @__PURE__ */ T(d, {
|
|
32
|
+
id: "appearance-theme",
|
|
33
|
+
icon: /* @__PURE__ */ w(b, {}),
|
|
34
|
+
title: O.themeTitle,
|
|
35
|
+
description: O.themeDescription,
|
|
36
|
+
children: [/* @__PURE__ */ T("div", {
|
|
37
|
+
role: "radiogroup",
|
|
38
|
+
"aria-labelledby": "appearance-theme-title",
|
|
39
|
+
onKeyDown: P,
|
|
40
|
+
className: "grid grid-cols-[repeat(auto-fill,minmax(8.5rem,1fr))] gap-3",
|
|
41
|
+
"data-testid": "appearance-theme-cards",
|
|
42
|
+
children: [r.map((t) => {
|
|
43
|
+
let n = !R && F.palette === t, r = !e(t);
|
|
44
|
+
return /* @__PURE__ */ T("button", {
|
|
45
|
+
type: "button",
|
|
46
|
+
role: "radio",
|
|
47
|
+
"aria-checked": n,
|
|
48
|
+
tabIndex: h(n, !1, !0),
|
|
49
|
+
onClick: () => k(t),
|
|
50
|
+
"data-testid": `appearance-theme-${t}`,
|
|
51
|
+
className: m(n, "flex flex-col gap-2 p-1.5 pb-2.5"),
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ w(l, { look: z(t) }),
|
|
54
|
+
/* @__PURE__ */ T("span", {
|
|
55
|
+
className: "flex items-center gap-1.5 px-1 text-sm font-semibold",
|
|
56
|
+
children: [/* @__PURE__ */ w("span", {
|
|
57
|
+
className: "min-w-0 flex-1 truncate",
|
|
58
|
+
children: O.palettes[t].name
|
|
59
|
+
}), /* @__PURE__ */ w(f, { selected: n })]
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ T("span", {
|
|
62
|
+
className: "flex min-h-4 flex-wrap gap-1 px-1",
|
|
63
|
+
children: [
|
|
64
|
+
t === I.palette && /* @__PURE__ */ w(p, {
|
|
65
|
+
tone: "accent",
|
|
66
|
+
children: O.tagDefault
|
|
67
|
+
}),
|
|
68
|
+
t === "fluidgrids" && /* @__PURE__ */ w(p, {
|
|
69
|
+
tone: "success",
|
|
70
|
+
children: O.tagNew
|
|
71
|
+
}),
|
|
72
|
+
r && /* @__PURE__ */ w(p, { children: O.tagDarkOnly })
|
|
73
|
+
]
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ w("span", {
|
|
76
|
+
className: "px-1 text-xs leading-snug text-text-muted",
|
|
77
|
+
children: O.palettes[t].hint
|
|
78
|
+
})
|
|
79
|
+
]
|
|
80
|
+
}, t);
|
|
81
|
+
}), F.looks.map((e) => {
|
|
82
|
+
let t = R?.id === e.id, n = u(e.accent, E, O), r = O.palettes[e.palette].name;
|
|
83
|
+
return /* @__PURE__ */ T("div", {
|
|
84
|
+
className: "relative flex min-w-0",
|
|
85
|
+
children: [/* @__PURE__ */ T("button", {
|
|
86
|
+
type: "button",
|
|
87
|
+
role: "radio",
|
|
88
|
+
"aria-checked": t,
|
|
89
|
+
tabIndex: h(t, !1, !0),
|
|
90
|
+
onClick: () => E.applyLook(e.id),
|
|
91
|
+
"data-testid": `appearance-look-${e.id}`,
|
|
92
|
+
className: m(t, "flex flex-1 flex-col gap-2 p-1.5 pb-2.5"),
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ w(l, { look: B(e) }),
|
|
95
|
+
/* @__PURE__ */ T("span", {
|
|
96
|
+
className: "flex items-center gap-1.5 px-1 pe-9 text-sm font-semibold",
|
|
97
|
+
children: [/* @__PURE__ */ w("span", {
|
|
98
|
+
className: "min-w-0 flex-1 truncate",
|
|
99
|
+
children: e.name
|
|
100
|
+
}), /* @__PURE__ */ w(f, { selected: t })]
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ w("span", {
|
|
103
|
+
className: "flex min-h-4 flex-wrap gap-1 px-1",
|
|
104
|
+
children: /* @__PURE__ */ w(p, { children: O.tagYours })
|
|
105
|
+
}),
|
|
106
|
+
/* @__PURE__ */ w("span", {
|
|
107
|
+
className: "px-1 text-xs leading-snug text-text-muted",
|
|
108
|
+
children: e.mode === "keep" ? O.lookSummary(r, n) : O.lookSummaryMode(r, n, O.schemes[e.mode])
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
}), /* @__PURE__ */ T(a, { children: [/* @__PURE__ */ w(c, {
|
|
112
|
+
asChild: !0,
|
|
113
|
+
children: /* @__PURE__ */ w(i, {
|
|
114
|
+
type: "button",
|
|
115
|
+
variant: "outline",
|
|
116
|
+
size: "icon-sm",
|
|
117
|
+
"aria-label": O.lookMore(e.name),
|
|
118
|
+
className: "absolute end-3 top-3",
|
|
119
|
+
"data-testid": `appearance-look-menu-${e.id}`,
|
|
120
|
+
children: /* @__PURE__ */ w(y, { "aria-hidden": "true" })
|
|
121
|
+
})
|
|
122
|
+
}), /* @__PURE__ */ T(o, {
|
|
123
|
+
align: "end",
|
|
124
|
+
children: [
|
|
125
|
+
/* @__PURE__ */ T(s, {
|
|
126
|
+
onSelect: () => E.applyLook(e.id),
|
|
127
|
+
children: [/* @__PURE__ */ w(_, { "aria-hidden": "true" }), O.lookUse]
|
|
128
|
+
}),
|
|
129
|
+
/* @__PURE__ */ T(s, {
|
|
130
|
+
onSelect: () => j(e),
|
|
131
|
+
children: [/* @__PURE__ */ w(x, { "aria-hidden": "true" }), O.lookEdit]
|
|
132
|
+
}),
|
|
133
|
+
/* @__PURE__ */ T(s, {
|
|
134
|
+
onSelect: () => M(e),
|
|
135
|
+
children: [/* @__PURE__ */ w(v, { "aria-hidden": "true" }), O.lookDuplicate]
|
|
136
|
+
}),
|
|
137
|
+
/* @__PURE__ */ T(s, {
|
|
138
|
+
onSelect: () => N(e),
|
|
139
|
+
className: "text-[var(--color-status-error-text)]",
|
|
140
|
+
children: [/* @__PURE__ */ w(C, { "aria-hidden": "true" }), O.lookDelete]
|
|
141
|
+
})
|
|
142
|
+
]
|
|
143
|
+
})] })]
|
|
144
|
+
}, e.id);
|
|
145
|
+
})]
|
|
146
|
+
}), /* @__PURE__ */ T("div", {
|
|
147
|
+
className: "flex flex-wrap items-center gap-x-3 gap-y-1",
|
|
148
|
+
children: [/* @__PURE__ */ T(i, {
|
|
149
|
+
type: "button",
|
|
150
|
+
variant: "outline",
|
|
151
|
+
size: "sm",
|
|
152
|
+
onClick: A,
|
|
153
|
+
"data-testid": "appearance-theme-create",
|
|
154
|
+
children: [/* @__PURE__ */ w(S, { "aria-hidden": "true" }), O.createTheme]
|
|
155
|
+
}), /* @__PURE__ */ w("span", {
|
|
156
|
+
className: "text-xs text-text-muted",
|
|
157
|
+
children: O.createThemeHint
|
|
158
|
+
})]
|
|
159
|
+
})]
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
export { E as AppearanceThemeSection };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SolvedAccent } from '../../shared/providers/shell/appearance/contrastFix';
|
|
2
|
+
import { SurfaceTokens } from '../../shared/providers/shell/appearance/palettes';
|
|
3
|
+
import { ColorScheme } from '../../shared/providers/shell/appearance/types';
|
|
4
|
+
import { AppearanceLabels } from './useAppearanceLabels';
|
|
5
|
+
/** A ratio as the page prints it: floored, so a pair that fails never reads as passing. */
|
|
6
|
+
export declare const formatRatio: (ratio: number) => string;
|
|
7
|
+
/** The colour checked in one mode of the theme. */
|
|
8
|
+
export interface ModeCheck {
|
|
9
|
+
scheme: ColorScheme;
|
|
10
|
+
surfaces: SurfaceTokens;
|
|
11
|
+
accent: SolvedAccent;
|
|
12
|
+
}
|
|
13
|
+
/** The contrast check of a colour in each mode of the theme. */
|
|
14
|
+
export declare function ContrastCheck({ checks, labels, }: {
|
|
15
|
+
checks: ModeCheck[];
|
|
16
|
+
labels: AppearanceLabels;
|
|
17
|
+
}): import('react').JSX.Element;
|
|
18
|
+
export interface ColourDraft {
|
|
19
|
+
hex: string;
|
|
20
|
+
name: string;
|
|
21
|
+
}
|
|
22
|
+
/** The inline panel to add a colour, or change a saved one. */
|
|
23
|
+
export declare function ColourPanel({ editing, draft, onDraft, onSave, onCancel, checks, quickPicks, labels, }: {
|
|
24
|
+
editing: boolean;
|
|
25
|
+
draft: ColourDraft;
|
|
26
|
+
onDraft: (next: ColourDraft) => void;
|
|
27
|
+
onSave: () => void;
|
|
28
|
+
onCancel: () => void;
|
|
29
|
+
/** The draft colour checked in each mode of the theme (empty while the hex is not valid). */
|
|
30
|
+
checks: ModeCheck[];
|
|
31
|
+
quickPicks: ReadonlyArray<{
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
hex: string;
|
|
35
|
+
}>;
|
|
36
|
+
labels: AppearanceLabels;
|
|
37
|
+
}): import('react').JSX.Element;
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { luminance as e, normalizeHex as t } from "../../shared/providers/shell/appearance/colour.js";
|
|
2
|
+
import "../../shared/providers/shell/appearance/palettes.js";
|
|
3
|
+
import { Button as n } from "../../ui/button.js";
|
|
4
|
+
import { Input as r } from "../../ui/input.js";
|
|
5
|
+
import { Label as i } from "../../ui/label.js";
|
|
6
|
+
import { cn as a } from "../../utils/cn.js";
|
|
7
|
+
import "../../utils/index.js";
|
|
8
|
+
import { Tag as o } from "./appearanceUi.js";
|
|
9
|
+
import { useId as s } from "react";
|
|
10
|
+
import { AlertTriangle as c, Check as l } from "lucide-react";
|
|
11
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
12
|
+
// src/chrome/appearance/ColourPanel.tsx
|
|
13
|
+
var f = (e) => `${(Math.floor(e * 10) / 10).toFixed(1)}:1`, p = (e, t, n) => ({
|
|
14
|
+
"--appearance-swatch": e,
|
|
15
|
+
...t ? { "--appearance-swatch-on": t } : {},
|
|
16
|
+
...n ? { "--appearance-swatch-ring": n } : {}
|
|
17
|
+
});
|
|
18
|
+
function m({ kind: e, check: t, labels: n }) {
|
|
19
|
+
let { accent: r, surfaces: i } = t, a = e === "button" ? !r.adjusted : e === "link" ? !r.inkAdjusted : r.rawFillRatio >= 3, s = e === "button" ? r.onRatio : e === "link" ? r.inkRatio : r.fillRatio, c = e === "button" ? r.rawOnRatio : e === "link" ? r.rawInkRatio : r.rawFillRatio;
|
|
20
|
+
return /* @__PURE__ */ d("span", {
|
|
21
|
+
className: "flex flex-col gap-1",
|
|
22
|
+
children: [/* @__PURE__ */ d("span", {
|
|
23
|
+
className: "flex flex-wrap items-center gap-1.5",
|
|
24
|
+
children: [
|
|
25
|
+
e === "button" && /* @__PURE__ */ u("span", {
|
|
26
|
+
className: "inline-flex h-6 min-w-8 items-center justify-center rounded px-1.5 text-xs font-semibold bg-[var(--appearance-swatch)] text-[var(--appearance-swatch-on)]",
|
|
27
|
+
style: p(r.fill, r.on),
|
|
28
|
+
children: "Aa"
|
|
29
|
+
}),
|
|
30
|
+
e === "link" && /* @__PURE__ */ u("span", {
|
|
31
|
+
className: "inline-flex h-6 items-center rounded border border-border-subtle px-1.5 text-xs font-semibold underline bg-[var(--appearance-swatch)] text-[var(--appearance-swatch-on)]",
|
|
32
|
+
style: p(i.surface, r.ink),
|
|
33
|
+
children: n.contrastLinkSample
|
|
34
|
+
}),
|
|
35
|
+
e === "outline" && /* @__PURE__ */ u("span", {
|
|
36
|
+
className: "inline-block h-6 w-8 rounded bg-[var(--appearance-swatch)] shadow-[inset_0_0_0_2px_var(--appearance-swatch-ring)]",
|
|
37
|
+
style: p(i.canvas, void 0, r.fill)
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ u(o, {
|
|
40
|
+
tone: a ? "success" : "warning",
|
|
41
|
+
children: a ? n.contrastOk : n.adjusted
|
|
42
|
+
}),
|
|
43
|
+
/* @__PURE__ */ u("span", {
|
|
44
|
+
className: "text-xs tabular-nums text-text-secondary",
|
|
45
|
+
children: f(s)
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
}), !a && /* @__PURE__ */ u("span", {
|
|
49
|
+
className: "text-xs text-text-muted",
|
|
50
|
+
children: n.contrastYours(f(c))
|
|
51
|
+
})]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function h({ checks: t, labels: n }) {
|
|
55
|
+
let r = [
|
|
56
|
+
{
|
|
57
|
+
kind: "button",
|
|
58
|
+
name: n.contrastButtons,
|
|
59
|
+
rule: n.contrastButtonsRule
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
kind: "link",
|
|
63
|
+
name: n.contrastLinks,
|
|
64
|
+
rule: n.contrastLinksRule
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
kind: "outline",
|
|
68
|
+
name: n.contrastOutlines,
|
|
69
|
+
rule: n.contrastOutlinesRule
|
|
70
|
+
}
|
|
71
|
+
], i = { gridTemplateColumns: `minmax(0,1.2fr) repeat(${t.length}, minmax(0,1fr))` }, o = t.some((e) => e.accent.adjusted || e.accent.inkAdjusted), s = e(t[0]?.accent.raw ?? "#7C3AED") > .4;
|
|
72
|
+
return /* @__PURE__ */ d("div", {
|
|
73
|
+
className: "flex flex-col gap-2",
|
|
74
|
+
children: [/* @__PURE__ */ d("div", {
|
|
75
|
+
role: "table",
|
|
76
|
+
"aria-label": n.contrastLabel,
|
|
77
|
+
className: "overflow-hidden rounded-card border border-border-subtle",
|
|
78
|
+
children: [/* @__PURE__ */ u("div", {
|
|
79
|
+
role: "rowgroup",
|
|
80
|
+
children: /* @__PURE__ */ d("div", {
|
|
81
|
+
role: "row",
|
|
82
|
+
className: "grid gap-3 bg-bg-sunken px-3 py-2 text-xs font-semibold text-text-secondary",
|
|
83
|
+
style: i,
|
|
84
|
+
children: [/* @__PURE__ */ u("span", {
|
|
85
|
+
role: "columnheader",
|
|
86
|
+
children: n.contrastWhere
|
|
87
|
+
}), t.map((e) => /* @__PURE__ */ u("span", {
|
|
88
|
+
role: "columnheader",
|
|
89
|
+
children: n.contrastIn(n.schemes[e.scheme])
|
|
90
|
+
}, e.scheme))]
|
|
91
|
+
})
|
|
92
|
+
}), /* @__PURE__ */ u("div", {
|
|
93
|
+
role: "rowgroup",
|
|
94
|
+
children: r.map((e) => /* @__PURE__ */ d("div", {
|
|
95
|
+
role: "row",
|
|
96
|
+
className: "grid items-start gap-3 border-t border-border-subtle px-3 py-2",
|
|
97
|
+
style: i,
|
|
98
|
+
children: [/* @__PURE__ */ d("span", {
|
|
99
|
+
role: "rowheader",
|
|
100
|
+
className: "flex flex-col",
|
|
101
|
+
children: [/* @__PURE__ */ u("span", {
|
|
102
|
+
className: "text-sm font-medium text-text-primary",
|
|
103
|
+
children: e.name
|
|
104
|
+
}), /* @__PURE__ */ u("span", {
|
|
105
|
+
className: "text-xs text-text-muted",
|
|
106
|
+
children: e.rule
|
|
107
|
+
})]
|
|
108
|
+
}), t.map((t) => /* @__PURE__ */ u("span", {
|
|
109
|
+
role: "cell",
|
|
110
|
+
children: /* @__PURE__ */ u(m, {
|
|
111
|
+
kind: e.kind,
|
|
112
|
+
check: t,
|
|
113
|
+
labels: n
|
|
114
|
+
})
|
|
115
|
+
}, t.scheme))]
|
|
116
|
+
}, e.kind))
|
|
117
|
+
})]
|
|
118
|
+
}), /* @__PURE__ */ d("p", {
|
|
119
|
+
className: a("flex items-start gap-2 text-sm", o ? "text-text-primary" : "text-text-secondary"),
|
|
120
|
+
"data-testid": "appearance-contrast-summary",
|
|
121
|
+
children: [o ? /* @__PURE__ */ u(c, {
|
|
122
|
+
className: "mt-0.5 size-4 shrink-0 text-[var(--color-status-warning-text)]",
|
|
123
|
+
"aria-hidden": "true"
|
|
124
|
+
}) : /* @__PURE__ */ u(l, {
|
|
125
|
+
className: "mt-0.5 size-4 shrink-0 text-[var(--color-status-success-text)]",
|
|
126
|
+
"aria-hidden": "true"
|
|
127
|
+
}), /* @__PURE__ */ u("span", { children: o ? s ? n.contrastTooLight : n.contrastTooDark : n.contrastReadable })]
|
|
128
|
+
})]
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function g({ editing: e, draft: a, onDraft: o, onSave: c, onCancel: f, checks: m, quickPicks: g, labels: _ }) {
|
|
132
|
+
let v = s(), y = t(a.hex), b = !y && a.hex.replace(/^#/, "").length >= 6, x = (e) => {
|
|
133
|
+
e.key === "Enter" && (e.preventDefault(), c());
|
|
134
|
+
};
|
|
135
|
+
return /* @__PURE__ */ d("div", {
|
|
136
|
+
role: "group",
|
|
137
|
+
"aria-labelledby": `${v}-title`,
|
|
138
|
+
"data-testid": "appearance-colour-panel",
|
|
139
|
+
className: "flex flex-col gap-4 rounded-card border border-action-primary-bg/50 bg-bg-elevated p-4 shadow-elevation-2",
|
|
140
|
+
children: [
|
|
141
|
+
/* @__PURE__ */ d("p", {
|
|
142
|
+
className: "flex flex-wrap items-baseline gap-x-2 text-sm",
|
|
143
|
+
children: [/* @__PURE__ */ u("span", {
|
|
144
|
+
id: `${v}-title`,
|
|
145
|
+
className: "font-semibold text-text-primary",
|
|
146
|
+
children: e ? _.editTitle : _.addTitle
|
|
147
|
+
}), /* @__PURE__ */ u("span", {
|
|
148
|
+
className: "text-text-muted",
|
|
149
|
+
children: _.panelHint
|
|
150
|
+
})]
|
|
151
|
+
}),
|
|
152
|
+
/* @__PURE__ */ d("div", {
|
|
153
|
+
className: "grid grid-cols-[auto_minmax(0,1fr)] gap-3 sm:grid-cols-[auto_minmax(0,1fr)_minmax(0,1fr)]",
|
|
154
|
+
children: [
|
|
155
|
+
/* @__PURE__ */ d("div", {
|
|
156
|
+
className: "flex flex-col gap-1.5",
|
|
157
|
+
children: [/* @__PURE__ */ u(i, {
|
|
158
|
+
htmlFor: `${v}-well`,
|
|
159
|
+
children: _.pick
|
|
160
|
+
}), /* @__PURE__ */ u("input", {
|
|
161
|
+
id: `${v}-well`,
|
|
162
|
+
type: "color",
|
|
163
|
+
value: (y ?? "#7C3AED").toLowerCase(),
|
|
164
|
+
onChange: (e) => o({
|
|
165
|
+
...a,
|
|
166
|
+
hex: e.target.value.toUpperCase()
|
|
167
|
+
}),
|
|
168
|
+
className: "h-9 w-14 cursor-pointer rounded-input border border-border-default bg-bg-surface p-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]"
|
|
169
|
+
})]
|
|
170
|
+
}),
|
|
171
|
+
/* @__PURE__ */ d("div", {
|
|
172
|
+
className: "flex min-w-0 flex-col gap-1.5",
|
|
173
|
+
children: [
|
|
174
|
+
/* @__PURE__ */ u(i, {
|
|
175
|
+
htmlFor: `${v}-hex`,
|
|
176
|
+
children: _.hex
|
|
177
|
+
}),
|
|
178
|
+
/* @__PURE__ */ u(r, {
|
|
179
|
+
type: "text",
|
|
180
|
+
id: `${v}-hex`,
|
|
181
|
+
value: a.hex,
|
|
182
|
+
maxLength: 7,
|
|
183
|
+
spellCheck: !1,
|
|
184
|
+
autoComplete: "off",
|
|
185
|
+
className: "font-mono uppercase",
|
|
186
|
+
"aria-invalid": b || void 0,
|
|
187
|
+
"aria-describedby": b ? `${v}-hex-error` : void 0,
|
|
188
|
+
onChange: (e) => {
|
|
189
|
+
let t = e.target.value.trim();
|
|
190
|
+
o({
|
|
191
|
+
...a,
|
|
192
|
+
hex: t && !t.startsWith("#") ? `#${t}` : t
|
|
193
|
+
});
|
|
194
|
+
},
|
|
195
|
+
onKeyDown: x,
|
|
196
|
+
"data-testid": "appearance-colour-hex"
|
|
197
|
+
}),
|
|
198
|
+
b && /* @__PURE__ */ u("span", {
|
|
199
|
+
id: `${v}-hex-error`,
|
|
200
|
+
className: "text-xs text-[var(--color-status-error-text)]",
|
|
201
|
+
children: _.hexError
|
|
202
|
+
})
|
|
203
|
+
]
|
|
204
|
+
}),
|
|
205
|
+
/* @__PURE__ */ d("div", {
|
|
206
|
+
className: "col-span-2 flex min-w-0 flex-col gap-1.5 sm:col-span-1",
|
|
207
|
+
children: [/* @__PURE__ */ u(i, {
|
|
208
|
+
htmlFor: `${v}-name`,
|
|
209
|
+
children: _.name
|
|
210
|
+
}), /* @__PURE__ */ u(r, {
|
|
211
|
+
type: "text",
|
|
212
|
+
id: `${v}-name`,
|
|
213
|
+
value: a.name,
|
|
214
|
+
maxLength: 24,
|
|
215
|
+
autoComplete: "off",
|
|
216
|
+
onChange: (e) => o({
|
|
217
|
+
...a,
|
|
218
|
+
name: e.target.value
|
|
219
|
+
}),
|
|
220
|
+
onKeyDown: x,
|
|
221
|
+
"data-testid": "appearance-colour-name"
|
|
222
|
+
})]
|
|
223
|
+
})
|
|
224
|
+
]
|
|
225
|
+
}),
|
|
226
|
+
/* @__PURE__ */ d("div", {
|
|
227
|
+
className: "flex flex-wrap items-center gap-2 text-sm text-text-secondary",
|
|
228
|
+
children: [/* @__PURE__ */ u("span", { children: _.fromSite }), g.map((e) => /* @__PURE__ */ d("button", {
|
|
229
|
+
type: "button",
|
|
230
|
+
onClick: () => o({
|
|
231
|
+
hex: e.hex,
|
|
232
|
+
name: e.name
|
|
233
|
+
}),
|
|
234
|
+
className: "inline-flex items-center gap-1.5 rounded-full border border-border-default bg-bg-surface px-2.5 py-1 text-xs text-text-primary transition-colors hover:bg-bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
235
|
+
children: [/* @__PURE__ */ u("span", {
|
|
236
|
+
"aria-hidden": "true",
|
|
237
|
+
className: "size-3 rounded-full bg-[var(--appearance-swatch)]",
|
|
238
|
+
style: p(e.hex)
|
|
239
|
+
}), e.name]
|
|
240
|
+
}, e.id))]
|
|
241
|
+
}),
|
|
242
|
+
y && m.length > 0 && /* @__PURE__ */ u(h, {
|
|
243
|
+
checks: m,
|
|
244
|
+
labels: _
|
|
245
|
+
}),
|
|
246
|
+
/* @__PURE__ */ d("div", {
|
|
247
|
+
className: "flex flex-wrap justify-end gap-2",
|
|
248
|
+
children: [/* @__PURE__ */ u(n, {
|
|
249
|
+
type: "button",
|
|
250
|
+
variant: "ghost",
|
|
251
|
+
onClick: f,
|
|
252
|
+
children: _.cancel
|
|
253
|
+
}), /* @__PURE__ */ d(n, {
|
|
254
|
+
type: "button",
|
|
255
|
+
onClick: c,
|
|
256
|
+
disabled: !y,
|
|
257
|
+
"data-testid": "appearance-colour-save",
|
|
258
|
+
children: [/* @__PURE__ */ u(l, { "aria-hidden": "true" }), e ? _.saveChanges : _.saveColour]
|
|
259
|
+
})]
|
|
260
|
+
})
|
|
261
|
+
]
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
export { g as ColourPanel, h as ContrastCheck, f as formatRatio };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LookMode, PaletteName, SavedLook } from '../../shared/providers/shell/appearance/types';
|
|
2
|
+
import { AppearanceControls } from '../../shared/providers/shell/themeContext';
|
|
3
|
+
import { AppearanceLabels } from './useAppearanceLabels';
|
|
4
|
+
export interface LookDraft {
|
|
5
|
+
name: string;
|
|
6
|
+
palette: PaletteName;
|
|
7
|
+
accent: SavedLook['accent'];
|
|
8
|
+
mode: LookMode;
|
|
9
|
+
}
|
|
10
|
+
export declare function ThemeDialog({ open, editingId, initial, appearance, brand, labels, onClose, onSave, onDelete, }: {
|
|
11
|
+
open: boolean;
|
|
12
|
+
/** The look being edited, or null to create one. */
|
|
13
|
+
editingId: string | null;
|
|
14
|
+
initial: LookDraft;
|
|
15
|
+
appearance: AppearanceControls;
|
|
16
|
+
brand: string;
|
|
17
|
+
labels: AppearanceLabels;
|
|
18
|
+
onClose: () => void;
|
|
19
|
+
onSave: (draft: LookDraft) => void;
|
|
20
|
+
onDelete?: () => void;
|
|
21
|
+
}): import('react').JSX.Element;
|