@ksojecki/purpose-ui 0.3.2 → 0.4.0-next.20261201202812
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/README.md +4 -0
- package/dist/actions/index.js +3 -40
- package/dist/actions-muI1GKgz.js +40 -0
- package/dist/css-C1oojmN3.js +602 -0
- package/dist/feedback/index.js +1 -1
- package/dist/forms/ColorInput.d.ts +33 -0
- package/dist/forms/FileInput.d.ts +25 -5
- package/dist/forms/index.d.ts +1 -0
- package/dist/forms/index.js +464 -146
- package/dist/hex-BZsMkL37.js +10 -0
- package/dist/internal/FileDropContent.d.ts +15 -0
- package/dist/internal/fileAccept.d.ts +5 -0
- package/dist/internal/fileSize.d.ts +2 -0
- package/dist/internal/hex.d.ts +4 -0
- package/dist/internal/theme-generator/cli.d.ts +16 -0
- package/dist/internal/theme-generator/color.d.ts +13 -0
- package/dist/internal/theme-generator/config.d.ts +51 -0
- package/dist/internal/theme-generator/contrast.d.ts +18 -0
- package/dist/internal/theme-generator/css.d.ts +7 -0
- package/dist/internal/theme-generator/derive.d.ts +20 -0
- package/dist/internal/theme-generator/roles.d.ts +10 -0
- package/dist/internal/theme-generator/tokens.d.ts +7 -0
- package/dist/internal/useFileDrop.d.ts +23 -0
- package/dist/internal/useFileSelection.d.ts +10 -0
- package/dist/internal/useHexDraft.d.ts +12 -0
- package/dist/internal/useInputNode.d.ts +3 -0
- package/dist/theme-generator/cli.d.ts +2 -0
- package/dist/theme-generator/cli.js +128 -0
- package/dist/theme-generator/index.d.ts +9 -0
- package/dist/theme-generator/index.js +3 -0
- package/package.json +15 -4
- package/theme-config.schema.json +124 -0
package/README.md
CHANGED
|
@@ -10,6 +10,8 @@ Documentation, with live examples and props for every component: [sojecki.pl/ui]
|
|
|
10
10
|
pnpm add @ksojecki/purpose-ui react react-dom react-router daisyui tailwindcss
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
Dev builds from the `next` branch are on npmjs too: `pnpm add @ksojecki/purpose-ui@next`.
|
|
14
|
+
|
|
13
15
|
Peer dependencies: `react` and `react-dom` ^19, `react-router` ^8, `daisyui` ^5.6.0, `tailwindcss` ^4. The package is ESM only. `FormField` takes the result of react-hook-form's `register()` but does not depend on that package.
|
|
14
16
|
|
|
15
17
|
## Set up styles
|
|
@@ -27,6 +29,8 @@ Palettes: `generic`, `budget`, `traffic`, `roadsign`. Each defines a light theme
|
|
|
27
29
|
|
|
28
30
|
To compose the pieces yourself, import `@ksojecki/purpose-ui/theme.css` and one `@ksojecki/purpose-ui/themes/<name>.css` after `@plugin 'daisyui' { themes: false; }`, and add `@source '../node_modules/@ksojecki/purpose-ui/dist';`.
|
|
29
31
|
|
|
32
|
+
For your own palette, keep a `purpose-ui.theme.json` in your repository and run `npx purpose-ui-theme build purpose-ui.theme.json -o src/<name>.theme.css`; the [theme generator](https://sojecki.pl/ui/theme-generator/) builds and previews the config.
|
|
33
|
+
|
|
30
34
|
## Use
|
|
31
35
|
|
|
32
36
|
Import from a group subpath, never from the package root.
|
package/dist/actions/index.js
CHANGED
|
@@ -1,41 +1,4 @@
|
|
|
1
1
|
import { a as e, i as t, n, r, s as i, t as a } from "../Button-T8UI5igR.js";
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
|
|
5
|
-
import { Children as l, cloneElement as u, isValidElement as d } from "react";
|
|
6
|
-
import { jsx as f } from "react/jsx-runtime";
|
|
7
|
-
// src/actions/ButtonGroup.tsx
|
|
8
|
-
function p({ children: e, className: t, label: n }) {
|
|
9
|
-
return /* @__PURE__ */ f("div", {
|
|
10
|
-
"aria-label": n,
|
|
11
|
-
className: o("join", t),
|
|
12
|
-
role: n ? "group" : void 0,
|
|
13
|
-
children: l.map(e, (e) => d(e) ? u(e, { className: o("join-item", e.props.className) }) : e)
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
// src/actions/IconActionButtons.tsx
|
|
17
|
-
function m({ tone: e = "neutral", variant: t = e === "ghost" ? "solid" : "soft", ...n }) {
|
|
18
|
-
return /* @__PURE__ */ f(s, {
|
|
19
|
-
...n,
|
|
20
|
-
icon: /* @__PURE__ */ f(c.TbPencil, {}),
|
|
21
|
-
tone: e,
|
|
22
|
-
variant: t
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
function h({ tone: e = "error", variant: t = e === "ghost" ? "solid" : "soft", ...n }) {
|
|
26
|
-
return /* @__PURE__ */ f(s, {
|
|
27
|
-
...n,
|
|
28
|
-
icon: /* @__PURE__ */ f(c.TbTrash, {}),
|
|
29
|
-
tone: e,
|
|
30
|
-
variant: t
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
function g({ tone: e = "primary", variant: t = e === "ghost" ? "solid" : "soft", ...n }) {
|
|
34
|
-
return /* @__PURE__ */ f(s, {
|
|
35
|
-
...n,
|
|
36
|
-
icon: /* @__PURE__ */ f(c.TbPlus, {}),
|
|
37
|
-
tone: e,
|
|
38
|
-
variant: t
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
export { i as ACTION_PURPOSES, a as Button, p as ButtonGroup, n as ButtonSizeProvider, h as DeleteButton, m as EditButton, s as IconButton, g as NewButton, r as buttonClassName, t as resolveButtonStyle, e as useButtonSize };
|
|
2
|
+
import { i as o, n as s, r as c, t as l } from "../actions-muI1GKgz.js";
|
|
3
|
+
import { t as u } from "../IconButton-P7nSooA3.js";
|
|
4
|
+
export { i as ACTION_PURPOSES, a as Button, o as ButtonGroup, n as ButtonSizeProvider, l as DeleteButton, s as EditButton, u as IconButton, c as NewButton, r as buttonClassName, t as resolveButtonStyle, e as useButtonSize };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { t as e } from "./classNames-x6JVYA2t.js";
|
|
2
|
+
import { t } from "./IconButton-P7nSooA3.js";
|
|
3
|
+
import { t as n } from "./icons-CMOARHwx.js";
|
|
4
|
+
import { Children as r, cloneElement as i, isValidElement as a } from "react";
|
|
5
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
6
|
+
// src/actions/ButtonGroup.tsx
|
|
7
|
+
function s({ children: t, className: n, label: s }) {
|
|
8
|
+
return /* @__PURE__ */ o("div", {
|
|
9
|
+
"aria-label": s,
|
|
10
|
+
className: e("join", n),
|
|
11
|
+
role: s ? "group" : void 0,
|
|
12
|
+
children: r.map(t, (t) => a(t) ? i(t, { className: e("join-item", t.props.className) }) : t)
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
// src/actions/IconActionButtons.tsx
|
|
16
|
+
function c({ tone: e = "neutral", variant: r = e === "ghost" ? "solid" : "soft", ...i }) {
|
|
17
|
+
return /* @__PURE__ */ o(t, {
|
|
18
|
+
...i,
|
|
19
|
+
icon: /* @__PURE__ */ o(n.TbPencil, {}),
|
|
20
|
+
tone: e,
|
|
21
|
+
variant: r
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function l({ tone: e = "error", variant: r = e === "ghost" ? "solid" : "soft", ...i }) {
|
|
25
|
+
return /* @__PURE__ */ o(t, {
|
|
26
|
+
...i,
|
|
27
|
+
icon: /* @__PURE__ */ o(n.TbTrash, {}),
|
|
28
|
+
tone: e,
|
|
29
|
+
variant: r
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function u({ tone: e = "primary", variant: r = e === "ghost" ? "solid" : "soft", ...i }) {
|
|
33
|
+
return /* @__PURE__ */ o(t, {
|
|
34
|
+
...i,
|
|
35
|
+
icon: /* @__PURE__ */ o(n.TbPlus, {}),
|
|
36
|
+
tone: e,
|
|
37
|
+
variant: r
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export { s as i, c as n, u as r, l as t };
|
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
import { n as e, t } from "./hex-BZsMkL37.js";
|
|
2
|
+
import { converter as n, formatHex as r, parse as i, wcagContrast as a } from "culori";
|
|
3
|
+
// src/internal/theme-generator/roles.ts
|
|
4
|
+
var o = [
|
|
5
|
+
"primary",
|
|
6
|
+
"secondary",
|
|
7
|
+
"accent",
|
|
8
|
+
"neutral"
|
|
9
|
+
], s = [
|
|
10
|
+
"info",
|
|
11
|
+
"success",
|
|
12
|
+
"warning",
|
|
13
|
+
"error"
|
|
14
|
+
], c = [
|
|
15
|
+
"sharp",
|
|
16
|
+
"soft",
|
|
17
|
+
"round"
|
|
18
|
+
], l = ["light", "dark"], u = [
|
|
19
|
+
...[...o, ...s].flatMap((e) => [`color-${e}`, `color-${e}-content`]),
|
|
20
|
+
"color-base-100",
|
|
21
|
+
"color-base-200",
|
|
22
|
+
"color-base-300",
|
|
23
|
+
"color-base-content",
|
|
24
|
+
"radius-selector",
|
|
25
|
+
"radius-field",
|
|
26
|
+
"radius-box",
|
|
27
|
+
"size-selector",
|
|
28
|
+
"size-field",
|
|
29
|
+
"border",
|
|
30
|
+
"depth",
|
|
31
|
+
"noise",
|
|
32
|
+
"paper-dark",
|
|
33
|
+
"paper-border",
|
|
34
|
+
"ink-muted",
|
|
35
|
+
"navbar-bg",
|
|
36
|
+
"navbar-content",
|
|
37
|
+
"control-border",
|
|
38
|
+
"soft-ink-share",
|
|
39
|
+
"paper-shadow",
|
|
40
|
+
"elevation-1",
|
|
41
|
+
"elevation-2",
|
|
42
|
+
"elevation-3",
|
|
43
|
+
"surface-highlight",
|
|
44
|
+
"overlay-scrim"
|
|
45
|
+
], d = u.filter((e) => e.startsWith("color-") || [
|
|
46
|
+
"paper-dark",
|
|
47
|
+
"paper-border",
|
|
48
|
+
"ink-muted",
|
|
49
|
+
"navbar-bg",
|
|
50
|
+
"navbar-content",
|
|
51
|
+
"control-border"
|
|
52
|
+
].includes(e)), f = 1, p = "https://sojecki.pl/ui/theme-config.schema.json", m = class extends Error {
|
|
53
|
+
issues;
|
|
54
|
+
constructor(e) {
|
|
55
|
+
super(`Invalid theme config:\n${e.map((e) => ` ${e.path || "(root)"}: ${e.message}`).join("\n")}`), this.name = "ThemeConfigError", this.issues = e;
|
|
56
|
+
}
|
|
57
|
+
}, h = {
|
|
58
|
+
$schema: p,
|
|
59
|
+
version: 1,
|
|
60
|
+
name: "custom",
|
|
61
|
+
colors: {
|
|
62
|
+
primary: "#2f6b7a",
|
|
63
|
+
secondary: "#5a5f9a",
|
|
64
|
+
accent: "#a65f33",
|
|
65
|
+
neutral: "#2f3742"
|
|
66
|
+
},
|
|
67
|
+
contrast: "AA",
|
|
68
|
+
shape: {
|
|
69
|
+
radius: "soft",
|
|
70
|
+
border: 1
|
|
71
|
+
}
|
|
72
|
+
}, g = /^[a-z][a-z0-9-]*$/, _ = [
|
|
73
|
+
"$schema",
|
|
74
|
+
"version",
|
|
75
|
+
"name",
|
|
76
|
+
"colors",
|
|
77
|
+
"contrast",
|
|
78
|
+
"shape",
|
|
79
|
+
"overrides"
|
|
80
|
+
], v = [...o, ...s];
|
|
81
|
+
function y(e) {
|
|
82
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
83
|
+
}
|
|
84
|
+
function b(e, t) {
|
|
85
|
+
return e.some((e) => e === t);
|
|
86
|
+
}
|
|
87
|
+
function x(e, t, n, r) {
|
|
88
|
+
for (let i of Object.keys(e).filter((e) => !t.includes(e))) r.push({
|
|
89
|
+
path: n ? `${n}.${i}` : i,
|
|
90
|
+
message: "Unknown field."
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function ee(e, t) {
|
|
94
|
+
return typeof e == "string" && g.test(e) && !e.endsWith("-dark") ? e : (t.push({
|
|
95
|
+
path: "name",
|
|
96
|
+
message: "Expected lowercase letters, digits and hyphens, starting with a letter and not ending in \"-dark\"."
|
|
97
|
+
}), "");
|
|
98
|
+
}
|
|
99
|
+
function S(n, r) {
|
|
100
|
+
if (!y(n)) return r.push({
|
|
101
|
+
path: "colors",
|
|
102
|
+
message: "Expected an object with primary, secondary, accent and neutral."
|
|
103
|
+
}), {};
|
|
104
|
+
x(n, v, "colors", r);
|
|
105
|
+
let i = {};
|
|
106
|
+
for (let a of v) {
|
|
107
|
+
let s = n[a];
|
|
108
|
+
t(s) ? i[a] = e(s) : (s !== void 0 || b(o, a)) && r.push({
|
|
109
|
+
path: `colors.${a}`,
|
|
110
|
+
message: "Expected a hex colour such as #2f6b7a."
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
return i;
|
|
114
|
+
}
|
|
115
|
+
function C(e, t) {
|
|
116
|
+
if (e === void 0 || b(["AA", "AAA"], e)) return e;
|
|
117
|
+
t.push({
|
|
118
|
+
path: "contrast",
|
|
119
|
+
message: "Expected \"AA\" or \"AAA\"."
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function w(e, t, n) {
|
|
123
|
+
return typeof t == "number" && Number.isFinite(t) && t >= 0 && t <= 4 ? t : (n.push({
|
|
124
|
+
path: `shape.radius.${e}`,
|
|
125
|
+
message: "Expected a size in rem from 0 to 4."
|
|
126
|
+
}), 0);
|
|
127
|
+
}
|
|
128
|
+
function T(e, t) {
|
|
129
|
+
if (e === void 0 || b(c, e)) return e;
|
|
130
|
+
if (!y(e)) t.push({
|
|
131
|
+
path: "shape.radius",
|
|
132
|
+
message: "Expected \"sharp\", \"soft\", \"round\" or { selector, field, box } in rem."
|
|
133
|
+
});
|
|
134
|
+
else return x(e, [
|
|
135
|
+
"selector",
|
|
136
|
+
"field",
|
|
137
|
+
"box"
|
|
138
|
+
], "shape.radius", t), {
|
|
139
|
+
selector: w("selector", e.selector, t),
|
|
140
|
+
field: w("field", e.field, t),
|
|
141
|
+
box: w("box", e.box, t)
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function te(e, t) {
|
|
145
|
+
if (e === void 0) return;
|
|
146
|
+
if (!y(e)) {
|
|
147
|
+
t.push({
|
|
148
|
+
path: "shape",
|
|
149
|
+
message: "Expected an object with radius and border."
|
|
150
|
+
});
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
x(e, ["radius", "border"], "shape", t);
|
|
154
|
+
let n = e.border;
|
|
155
|
+
return n !== void 0 && !b([1, 2], n) && t.push({
|
|
156
|
+
path: "shape.border",
|
|
157
|
+
message: "Expected 1 or 2 (px)."
|
|
158
|
+
}), {
|
|
159
|
+
...e.radius === void 0 ? {} : { radius: T(e.radius, t) },
|
|
160
|
+
...b([1, 2], n) ? { border: n } : {}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function ne(e, t, n) {
|
|
164
|
+
if (!y(t)) return n.push({
|
|
165
|
+
path: `overrides.${e}`,
|
|
166
|
+
message: "Expected an object of token values."
|
|
167
|
+
}), {};
|
|
168
|
+
let r = {};
|
|
169
|
+
for (let [i, a] of Object.entries(t)) {
|
|
170
|
+
let t = `overrides.${e}.${i}`;
|
|
171
|
+
b(u, i) ? typeof a != "string" || !a.trim() || /[;{}]/.test(a) ? n.push({
|
|
172
|
+
path: t,
|
|
173
|
+
message: "Expected a CSS value without \";\", \"{\" or \"}\"."
|
|
174
|
+
}) : r[i] = a.trim() : n.push({
|
|
175
|
+
path: t,
|
|
176
|
+
message: "Not a generated token, such as color-primary or navbar-bg."
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
return r;
|
|
180
|
+
}
|
|
181
|
+
function re(e, t) {
|
|
182
|
+
if (e !== void 0) {
|
|
183
|
+
if (!y(e)) t.push({
|
|
184
|
+
path: "overrides",
|
|
185
|
+
message: "Expected an object with light and dark."
|
|
186
|
+
});
|
|
187
|
+
else return x(e, l, "overrides", t), Object.fromEntries(l.filter((t) => e[t] !== void 0).map((n) => [n, ne(n, e[n], t)]));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function ie(e, t) {
|
|
191
|
+
return x(e, _, "", t), e.version !== 1 && t.push({
|
|
192
|
+
path: "version",
|
|
193
|
+
message: "This package version supports config version 1."
|
|
194
|
+
}), e.$schema !== void 0 && typeof e.$schema != "string" && t.push({
|
|
195
|
+
path: "$schema",
|
|
196
|
+
message: "Expected a URL string."
|
|
197
|
+
}), typeof e.$schema == "string" ? { $schema: e.$schema } : {};
|
|
198
|
+
}
|
|
199
|
+
function ae(e) {
|
|
200
|
+
if (!y(e)) throw new m([{
|
|
201
|
+
path: "",
|
|
202
|
+
message: "Expected a JSON object."
|
|
203
|
+
}]);
|
|
204
|
+
let t = [], n = ie(e, t), r = ee(e.name, t), i = S(e.colors, t), a = C(e.contrast, t), o = te(e.shape, t), s = re(e.overrides, t);
|
|
205
|
+
if (t.length > 0) throw new m(t);
|
|
206
|
+
return {
|
|
207
|
+
...n,
|
|
208
|
+
version: 1,
|
|
209
|
+
name: r,
|
|
210
|
+
colors: {
|
|
211
|
+
primary: "",
|
|
212
|
+
secondary: "",
|
|
213
|
+
accent: "",
|
|
214
|
+
neutral: "",
|
|
215
|
+
...i
|
|
216
|
+
},
|
|
217
|
+
...a ? { contrast: a } : {},
|
|
218
|
+
...o ? { shape: o } : {},
|
|
219
|
+
...s ? { overrides: s } : {}
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
// src/internal/theme-generator/color.ts
|
|
223
|
+
var E = n("oklch"), D = n("rgb");
|
|
224
|
+
function O(e) {
|
|
225
|
+
let t = E(i(e));
|
|
226
|
+
if (!t) throw Error(`Not a colour: ${e}`);
|
|
227
|
+
return t;
|
|
228
|
+
}
|
|
229
|
+
function k(e, t, n) {
|
|
230
|
+
let { r, g: i, b: a } = D({
|
|
231
|
+
mode: "oklch",
|
|
232
|
+
l: e,
|
|
233
|
+
c: t,
|
|
234
|
+
h: n
|
|
235
|
+
});
|
|
236
|
+
return [
|
|
237
|
+
r,
|
|
238
|
+
i,
|
|
239
|
+
a
|
|
240
|
+
].every((e) => e >= -1e-6 && e <= 1.000001);
|
|
241
|
+
}
|
|
242
|
+
function A(e, t, n) {
|
|
243
|
+
let i = 0, a = t;
|
|
244
|
+
if (!k(e, t, n)) {
|
|
245
|
+
for (let t = 0; t < 24; t += 1) {
|
|
246
|
+
let t = (i + a) / 2;
|
|
247
|
+
k(e, t, n) ? i = t : a = t;
|
|
248
|
+
}
|
|
249
|
+
a = i;
|
|
250
|
+
}
|
|
251
|
+
return r({
|
|
252
|
+
mode: "oklch",
|
|
253
|
+
l: e,
|
|
254
|
+
c: a,
|
|
255
|
+
h: n
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
function j(e, t) {
|
|
259
|
+
return a(e, t);
|
|
260
|
+
}
|
|
261
|
+
function M(e, t, n) {
|
|
262
|
+
let r = D(i(e)), a = D(i(n));
|
|
263
|
+
if (!r || !a) throw Error(`Not a colour: ${e} or ${n}`);
|
|
264
|
+
return {
|
|
265
|
+
mode: "rgb",
|
|
266
|
+
r: r.r * t + a.r * (1 - t),
|
|
267
|
+
g: r.g * t + a.g * (1 - t),
|
|
268
|
+
b: r.b * t + a.b * (1 - t)
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
function N(e) {
|
|
272
|
+
return Math.round(Math.min(1, Math.max(0, e)) * 255);
|
|
273
|
+
}
|
|
274
|
+
function oe(e, t) {
|
|
275
|
+
let n = D(i(e));
|
|
276
|
+
if (!n) throw Error(`Not a colour: ${e}`);
|
|
277
|
+
return `rgb(${N(n.r)} ${N(n.g)} ${N(n.b)} / ${t})`;
|
|
278
|
+
}
|
|
279
|
+
// src/internal/theme-generator/contrast.ts
|
|
280
|
+
var P = {
|
|
281
|
+
AA: 4.5,
|
|
282
|
+
AAA: 7
|
|
283
|
+
}, F = .7;
|
|
284
|
+
function I(e) {
|
|
285
|
+
if (!e || /^[0-9a-f]{3,8}$/i.test(e)) return !1;
|
|
286
|
+
try {
|
|
287
|
+
let t = O(e);
|
|
288
|
+
return t.alpha === void 0 || t.alpha === 1;
|
|
289
|
+
} catch {
|
|
290
|
+
return !1;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
function L(e, t) {
|
|
294
|
+
return [
|
|
295
|
+
...[...o, ...s].map((n) => [
|
|
296
|
+
`${n}-content on ${n}`,
|
|
297
|
+
e[`color-${n}-content`],
|
|
298
|
+
e[`color-${n}`],
|
|
299
|
+
t,
|
|
300
|
+
"text"
|
|
301
|
+
]),
|
|
302
|
+
...[
|
|
303
|
+
"100",
|
|
304
|
+
"200",
|
|
305
|
+
"300"
|
|
306
|
+
].map((n) => [
|
|
307
|
+
`base-content on base-${n}`,
|
|
308
|
+
e["color-base-content"],
|
|
309
|
+
e[`color-base-${n}`],
|
|
310
|
+
t,
|
|
311
|
+
"text"
|
|
312
|
+
]),
|
|
313
|
+
[
|
|
314
|
+
"ink-muted on base-100",
|
|
315
|
+
e["ink-muted"],
|
|
316
|
+
e["color-base-100"],
|
|
317
|
+
t,
|
|
318
|
+
"text"
|
|
319
|
+
],
|
|
320
|
+
[
|
|
321
|
+
"ink-muted on base-200",
|
|
322
|
+
e["ink-muted"],
|
|
323
|
+
e["color-base-200"],
|
|
324
|
+
t,
|
|
325
|
+
"text"
|
|
326
|
+
],
|
|
327
|
+
[
|
|
328
|
+
"navbar-content on navbar-bg",
|
|
329
|
+
e["navbar-content"],
|
|
330
|
+
e["navbar-bg"],
|
|
331
|
+
t,
|
|
332
|
+
"text"
|
|
333
|
+
],
|
|
334
|
+
[
|
|
335
|
+
"control-border on base-100",
|
|
336
|
+
e["control-border"],
|
|
337
|
+
e["color-base-100"],
|
|
338
|
+
3,
|
|
339
|
+
"boundary"
|
|
340
|
+
]
|
|
341
|
+
];
|
|
342
|
+
}
|
|
343
|
+
function R(e, [t, n, r, i, a]) {
|
|
344
|
+
let o = I(n) && I(r) ? j(n, r) : 0;
|
|
345
|
+
return {
|
|
346
|
+
scheme: e,
|
|
347
|
+
name: t,
|
|
348
|
+
foreground: n ?? "",
|
|
349
|
+
background: r ?? "",
|
|
350
|
+
ratio: o,
|
|
351
|
+
threshold: i,
|
|
352
|
+
pass: o >= i,
|
|
353
|
+
kind: a
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
var z = /^[ \t\n\r\f]*var\([ \t\n\r\f]*--([a-z0-9-]+)[ \t\n\r\f]*\)[ \t\n\r\f]*$/;
|
|
357
|
+
function B(e, t) {
|
|
358
|
+
let n = e;
|
|
359
|
+
for (let e = 0; e < u.length; e += 1) {
|
|
360
|
+
let e = z.exec(n ?? "");
|
|
361
|
+
if (!e) break;
|
|
362
|
+
n = t[e[1]];
|
|
363
|
+
}
|
|
364
|
+
return n;
|
|
365
|
+
}
|
|
366
|
+
function V(e, t, n) {
|
|
367
|
+
let i = L(n, P[e.contrast ?? "AA"]), a = B(n["color-primary"], n), o = B(n["color-base-100"], n), s = i.map(([e, r, i, a, o]) => R(t, [
|
|
368
|
+
e,
|
|
369
|
+
B(r, n),
|
|
370
|
+
B(i, n),
|
|
371
|
+
a,
|
|
372
|
+
o
|
|
373
|
+
]));
|
|
374
|
+
if (!I(a) || !I(o)) return [...s, R(t, [
|
|
375
|
+
"focus ring on base-100",
|
|
376
|
+
void 0,
|
|
377
|
+
o,
|
|
378
|
+
3,
|
|
379
|
+
"boundary"
|
|
380
|
+
])];
|
|
381
|
+
let c = M(a, F, o), l = j(c, o);
|
|
382
|
+
return [...s, {
|
|
383
|
+
scheme: t,
|
|
384
|
+
name: "focus ring on base-100",
|
|
385
|
+
foreground: r(c),
|
|
386
|
+
background: o,
|
|
387
|
+
ratio: l,
|
|
388
|
+
threshold: 3,
|
|
389
|
+
pass: l >= 3,
|
|
390
|
+
kind: "boundary"
|
|
391
|
+
}];
|
|
392
|
+
}
|
|
393
|
+
// src/internal/theme-generator/derive.ts
|
|
394
|
+
var H = .005, U = .1, W = .95, G = .02, K = .75, q = .85, se = {
|
|
395
|
+
info: 250,
|
|
396
|
+
success: 150,
|
|
397
|
+
warning: 75,
|
|
398
|
+
error: 25
|
|
399
|
+
}, ce = {
|
|
400
|
+
sharp: {
|
|
401
|
+
selector: 0,
|
|
402
|
+
field: 0,
|
|
403
|
+
box: 0
|
|
404
|
+
},
|
|
405
|
+
soft: {
|
|
406
|
+
selector: .375,
|
|
407
|
+
field: .375,
|
|
408
|
+
box: .5
|
|
409
|
+
},
|
|
410
|
+
round: {
|
|
411
|
+
selector: 1,
|
|
412
|
+
field: .75,
|
|
413
|
+
box: 1
|
|
414
|
+
}
|
|
415
|
+
}, J = {
|
|
416
|
+
light: {
|
|
417
|
+
100: .99,
|
|
418
|
+
200: .955,
|
|
419
|
+
300: .89,
|
|
420
|
+
content: .24
|
|
421
|
+
},
|
|
422
|
+
dark: {
|
|
423
|
+
100: .24,
|
|
424
|
+
200: .205,
|
|
425
|
+
300: .31,
|
|
426
|
+
content: .93
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
function Y(e) {
|
|
430
|
+
let { l: t, c: n, h: r } = O(e);
|
|
431
|
+
return {
|
|
432
|
+
l: t,
|
|
433
|
+
c: n,
|
|
434
|
+
h: n < G ? r ?? 0 : r
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
function X(e) {
|
|
438
|
+
return e === 0 ? "0rem" : `${e}rem`;
|
|
439
|
+
}
|
|
440
|
+
function le(e, t) {
|
|
441
|
+
let n = Math.ceil(.85 / H);
|
|
442
|
+
for (let r = 0; r <= n; r += 1) for (let n of r === 0 ? [e] : [e - r * H, e + r * H]) if (n >= U && n <= W && t(n)) return n;
|
|
443
|
+
}
|
|
444
|
+
function ue(e, t, n) {
|
|
445
|
+
let r = Math.min(W, Math.max(U, e));
|
|
446
|
+
for (; r >= U && r <= W;) {
|
|
447
|
+
if (n(r)) return r;
|
|
448
|
+
r += t * H;
|
|
449
|
+
}
|
|
450
|
+
return Math.min(W, Math.max(U, r));
|
|
451
|
+
}
|
|
452
|
+
function de(e, t) {
|
|
453
|
+
return {
|
|
454
|
+
lightInk: A(.99, Math.min(t, .01), e),
|
|
455
|
+
darkInk: A(.2, Math.min(t, .02), e)
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
function fe(e, t, n, r = () => !0) {
|
|
459
|
+
let i = e === "light" ? t.c : t.c * q, a = e === "light" ? Math.min(t.l, .62) : K, { lightInk: o, darkInk: s } = de(t.h, i), c = (e) => j(e, o) >= j(e, s) ? o : s, l = A(le(a, (e) => {
|
|
460
|
+
let a = A(e, i, t.h);
|
|
461
|
+
return j(a, c(a)) >= n && r(a);
|
|
462
|
+
}) ?? a, i, t.h);
|
|
463
|
+
return {
|
|
464
|
+
fill: l,
|
|
465
|
+
content: c(l)
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
function pe(e, t) {
|
|
469
|
+
let n = o.filter((e) => e !== "neutral").map((e) => Y(t.colors[e])), r = n.reduce((e, t) => e + t.c, 0) / n.length;
|
|
470
|
+
return {
|
|
471
|
+
l: .55,
|
|
472
|
+
c: Math.max(r, .08),
|
|
473
|
+
h: se[e]
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
function Z(e, t) {
|
|
477
|
+
let n = Y(e.colors.neutral), r = Math.min(n.c, .012), i = J[t];
|
|
478
|
+
return {
|
|
479
|
+
scheme: t,
|
|
480
|
+
threshold: P[e.contrast ?? "AA"],
|
|
481
|
+
neutral: n,
|
|
482
|
+
base100: A(i[100], r, n.h),
|
|
483
|
+
base200: A(i[200], r, n.h),
|
|
484
|
+
base300: A(i[300], r, n.h),
|
|
485
|
+
towardsInk: t === "light" ? -1 : 1
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
function Q(e, t, n, r, i) {
|
|
489
|
+
let a = Math.min(e.neutral.c, t);
|
|
490
|
+
return A(ue(n, e.towardsInk, (t) => i.every((n) => j(A(t, a, e.neutral.h), n) >= r)), a, e.neutral.h);
|
|
491
|
+
}
|
|
492
|
+
function me(e, t) {
|
|
493
|
+
let n = (e) => j(M(e, F, t.base100), t.base100) >= 3, r = {};
|
|
494
|
+
for (let i of [...o, ...s]) {
|
|
495
|
+
let a = e.colors[i], o = a ? Y(a) : pe(i, e), { fill: s, content: c } = fe(t.scheme, o, t.threshold, i === "primary" ? n : void 0);
|
|
496
|
+
r[`color-${i}`] = s, r[`color-${i}-content`] = c;
|
|
497
|
+
}
|
|
498
|
+
return r;
|
|
499
|
+
}
|
|
500
|
+
function he(e) {
|
|
501
|
+
let { base100: t, base200: n, base300: r } = e;
|
|
502
|
+
return {
|
|
503
|
+
"color-base-100": t,
|
|
504
|
+
"color-base-200": n,
|
|
505
|
+
"color-base-300": r,
|
|
506
|
+
"color-base-content": Q(e, .012, J[e.scheme].content, e.threshold, [
|
|
507
|
+
t,
|
|
508
|
+
n,
|
|
509
|
+
r
|
|
510
|
+
])
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
function ge(e) {
|
|
514
|
+
let t = e.shape?.radius ?? "soft", n = typeof t == "string" ? ce[t] : t;
|
|
515
|
+
return {
|
|
516
|
+
"radius-selector": X(n.selector),
|
|
517
|
+
"radius-field": X(n.field),
|
|
518
|
+
"radius-box": X(n.box),
|
|
519
|
+
"size-selector": "0.25rem",
|
|
520
|
+
"size-field": "0.25rem",
|
|
521
|
+
border: `${e.shape?.border ?? 1}px`,
|
|
522
|
+
depth: "0",
|
|
523
|
+
noise: "0"
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
function _e(e, t) {
|
|
527
|
+
let n = t.scheme === "light", { neutral: r } = t, i = Math.min(r.c, .02), a = Y(e.colors.primary);
|
|
528
|
+
return {
|
|
529
|
+
"paper-dark": A(n ? .915 : .35, i, r.h),
|
|
530
|
+
"paper-border": A(n ? .82 : .39, i, r.h),
|
|
531
|
+
"ink-muted": Q(t, .03, J[t.scheme][200], t.threshold, [t.base100, t.base200]),
|
|
532
|
+
"navbar-bg": A(n ? .3 : .17, Math.min(a.c, .05), a.h),
|
|
533
|
+
"navbar-content": A(n ? .97 : .93, Math.min(a.c, .01), a.h),
|
|
534
|
+
"control-border": Q(t, .03, J[t.scheme][300], 3, [t.base100]),
|
|
535
|
+
"soft-ink-share": n ? "85%" : "100%"
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
function ve(e) {
|
|
539
|
+
let t = A(.21, Math.min(e.neutral.c, .04), e.neutral.h), n = (e) => oe(t, e);
|
|
540
|
+
return {
|
|
541
|
+
"paper-shadow": `0 1px 0 ${n(.08)}, 0 3px 10px ${n(.035)}`,
|
|
542
|
+
"elevation-1": `0 1px 2px ${n(.08)}`,
|
|
543
|
+
"elevation-2": `0 2px 4px ${n(.06)}, 0 6px 14px ${n(.08)}`,
|
|
544
|
+
"elevation-3": `0 8px 12px -4px ${n(.1)}, 0 20px 28px -8px ${n(.14)}`,
|
|
545
|
+
"surface-highlight": "rgb(255 255 255 / 0.5)"
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
var ye = {
|
|
549
|
+
"paper-shadow": "0 1px 0 rgb(0 0 0 / 0.2), 0 3px 10px rgb(0 0 0 / 0.088)",
|
|
550
|
+
"elevation-1": "0 1px 2px rgb(0 0 0 / 0.2)",
|
|
551
|
+
"elevation-2": "0 2px 4px rgb(0 0 0 / 0.15), 0 6px 14px rgb(0 0 0 / 0.2)",
|
|
552
|
+
"elevation-3": "0 8px 12px -4px rgb(0 0 0 / 0.25), 0 20px 28px -8px rgb(0 0 0 / 0.35)",
|
|
553
|
+
"surface-highlight": "rgb(255 255 255 / 0.04)",
|
|
554
|
+
"overlay-scrim": "rgb(0 0 0 / 0.5)"
|
|
555
|
+
};
|
|
556
|
+
function be(e, t) {
|
|
557
|
+
let n = Z(e, t);
|
|
558
|
+
return {
|
|
559
|
+
...me(e, n),
|
|
560
|
+
...he(n),
|
|
561
|
+
...ge(e),
|
|
562
|
+
..._e(e, n),
|
|
563
|
+
...t === "light" ? ve(n) : ye,
|
|
564
|
+
...e.overrides?.[t]
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
function xe(e) {
|
|
568
|
+
let [t, n] = l.map((t) => be(e, t));
|
|
569
|
+
return {
|
|
570
|
+
name: e.name,
|
|
571
|
+
light: t,
|
|
572
|
+
dark: n,
|
|
573
|
+
report: [...V(e, "light", t), ...V(e, "dark", n)]
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
// src/internal/theme-generator/css.ts
|
|
577
|
+
function $(e, t) {
|
|
578
|
+
let n = e[t], r = [
|
|
579
|
+
"@plugin \"daisyui/theme\" {",
|
|
580
|
+
` name: '${t === "light" ? e.name : `${e.name}-dark`}';`,
|
|
581
|
+
` default: ${t === "light"};`,
|
|
582
|
+
` prefersdark: ${t === "dark"};`,
|
|
583
|
+
` color-scheme: ${t};`,
|
|
584
|
+
""
|
|
585
|
+
];
|
|
586
|
+
for (let e of u) {
|
|
587
|
+
let t = n[e];
|
|
588
|
+
t !== void 0 && ((e === "radius-selector" || e === "paper-dark") && r.push(""), r.push(` --${e}: ${t};`));
|
|
589
|
+
}
|
|
590
|
+
return r.push("}"), r.join("\n");
|
|
591
|
+
}
|
|
592
|
+
function Se(e, t) {
|
|
593
|
+
return [
|
|
594
|
+
`/* Generated by purpose-ui-theme ${t.version} from the ${e.name} theme config; edit the config and run build, not this file. */`,
|
|
595
|
+
"",
|
|
596
|
+
$(e, "light"),
|
|
597
|
+
"",
|
|
598
|
+
$(e, "dark"),
|
|
599
|
+
""
|
|
600
|
+
].join("\n");
|
|
601
|
+
}
|
|
602
|
+
export { m as a, d as c, l as d, o as f, f as i, u as l, xe as n, h as o, s as p, p as r, ae as s, Se as t, c as u };
|
package/dist/feedback/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { t } from "../classNames-x6JVYA2t.js";
|
|
|
3
3
|
import { t as n } from "../IconButton-P7nSooA3.js";
|
|
4
4
|
import { t as r } from "../icons-CMOARHwx.js";
|
|
5
5
|
import { o as i } from "../Button-T8UI5igR.js";
|
|
6
|
-
import {
|
|
6
|
+
import { t as a } from "../actions-muI1GKgz.js";
|
|
7
7
|
import { t as o } from "../Heading-CWDWXU_n.js";
|
|
8
8
|
import { cloneElement as s, useId as c } from "react";
|
|
9
9
|
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|