@skiddph/prui 0.7.0 → 0.9.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/app/resource.d.ts +44 -1
- package/dist/app.js +1 -1
- package/dist/chunks/auth-shell-DQJ4UmUv.js +1208 -0
- package/dist/chunks/data-table-toolbar-B-5J2Ozl.js +736 -0
- package/dist/core/accordion.d.ts +16 -0
- package/dist/core/accordion.js +108 -0
- package/dist/core/alert.d.ts +20 -0
- package/dist/core/alert.js +63 -0
- package/dist/core/anchor.d.ts +35 -0
- package/dist/core/anchor.js +39 -0
- package/dist/core/breadcrumb.d.ts +30 -0
- package/dist/core/breadcrumb.js +67 -0
- package/dist/core/button.d.ts +8 -1
- package/dist/core/button.js +23 -18
- package/dist/core/calendar.d.ts +29 -0
- package/dist/core/calendar.js +180 -0
- package/dist/core/card.d.ts +5 -1
- package/dist/core/card.js +33 -29
- package/dist/core/checkbox.d.ts +19 -0
- package/dist/core/checkbox.js +55 -0
- package/dist/core/combobox.d.ts +32 -0
- package/dist/core/combobox.js +193 -0
- package/dist/core/date-picker.d.ts +62 -0
- package/dist/core/date-picker.js +314 -0
- package/dist/core/dialog.d.ts +15 -0
- package/dist/core/dialog.js +77 -60
- package/dist/core/drawer.d.ts +34 -0
- package/dist/core/drawer.js +129 -0
- package/dist/core/dropdown.d.ts +8 -4
- package/dist/core/dropdown.js +136 -51
- package/dist/core/file-upload.d.ts +28 -0
- package/dist/core/file-upload.js +111 -0
- package/dist/core/index.d.ts +23 -1
- package/dist/core/list-nav.d.ts +27 -0
- package/dist/core/list-nav.js +51 -0
- package/dist/core/modal.d.ts +14 -5
- package/dist/core/modal.js +163 -156
- package/dist/core/overlay.d.ts +93 -0
- package/dist/core/overlay.js +189 -0
- package/dist/core/popover.d.ts +29 -0
- package/dist/core/popover.js +124 -0
- package/dist/core/progress.d.ts +21 -0
- package/dist/core/progress.js +59 -0
- package/dist/core/radio.d.ts +20 -0
- package/dist/core/radio.js +115 -0
- package/dist/core/select.d.ts +6 -0
- package/dist/core/select.js +187 -98
- package/dist/core/skeleton.d.ts +20 -0
- package/dist/core/skeleton.js +41 -0
- package/dist/core/spinner.d.ts +15 -0
- package/dist/core/spinner.js +41 -0
- package/dist/core/tabs.js +82 -53
- package/dist/core/time-picker.d.ts +68 -0
- package/dist/core/time-picker.js +305 -0
- package/dist/core/timeline.d.ts +22 -0
- package/dist/core/timeline.js +57 -0
- package/dist/core/toast.d.ts +36 -0
- package/dist/core/toast.js +123 -0
- package/dist/core/tooltip.d.ts +23 -0
- package/dist/core/tooltip.js +96 -0
- package/dist/core/tree-view.d.ts +34 -0
- package/dist/core/tree-view.js +133 -0
- package/dist/core.js +160 -62
- package/dist/data-table/data-table.d.ts +22 -1
- package/dist/data-table.js +1 -1
- package/dist/forms/form.d.ts +8 -0
- package/dist/forms.js +213 -200
- package/dist/i18n/index.d.ts +89 -0
- package/dist/i18n.js +105 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +263 -155
- package/dist/prui-utilities.css +1 -1
- package/dist/prui.css +111 -4
- package/dist/theme/base.css +110 -3
- package/dist/theme/index.d.ts +27 -0
- package/dist/theme.js +86 -58
- package/package.json +9 -2
- package/dist/chunks/auth-shell-BG5vx9eG.js +0 -1054
- package/dist/chunks/data-table-toolbar-BUy2EWPy.js +0 -581
package/dist/theme.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as l from "react";
|
|
1
2
|
const u = ["control", "workshop", "ember", "daylight"], d = "prui-theme-", c = /* @__PURE__ */ new Map(), m = [
|
|
2
3
|
"background",
|
|
3
4
|
"surface",
|
|
@@ -11,80 +12,80 @@ const u = ["control", "workshop", "ember", "daylight"], d = "prui-theme-", c = /
|
|
|
11
12
|
"warn",
|
|
12
13
|
"danger"
|
|
13
14
|
];
|
|
14
|
-
function
|
|
15
|
+
function a(e) {
|
|
15
16
|
return `--prui-${e}`;
|
|
16
17
|
}
|
|
17
18
|
function f(e) {
|
|
18
19
|
const t = [];
|
|
19
|
-
for (const [
|
|
20
|
-
|
|
20
|
+
for (const [o, r] of Object.entries(e))
|
|
21
|
+
r !== void 0 && t.push(` ${a(o)}: ${r};`);
|
|
21
22
|
return t.join(`
|
|
22
23
|
`);
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
-
const
|
|
26
|
-
if (c.set(
|
|
27
|
-
let
|
|
28
|
-
|
|
25
|
+
function v(e, t) {
|
|
26
|
+
const o = e.trim().toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, "") || "custom";
|
|
27
|
+
if (c.set(o, { ...t }), typeof document < "u") {
|
|
28
|
+
let r = document.getElementById(`prui-custom-theme-${o}`);
|
|
29
|
+
r || (r = document.createElement("style"), r.id = `prui-custom-theme-${o}`, document.head.appendChild(r)), r.textContent = `.${d}${o} {
|
|
29
30
|
${f(t)}
|
|
30
31
|
}`;
|
|
31
32
|
}
|
|
32
|
-
return
|
|
33
|
+
return o;
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
+
function x() {
|
|
35
36
|
return [...u, ...c.keys()];
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
for (const [
|
|
41
|
-
|
|
42
|
-
e.radius !== void 0 && (
|
|
38
|
+
function h(e, t = {}) {
|
|
39
|
+
const o = t.target ?? (typeof document < "u" ? document.documentElement : null), r = [];
|
|
40
|
+
if (o) {
|
|
41
|
+
for (const [i, s] of Object.entries(e))
|
|
42
|
+
s !== void 0 && (o.style.setProperty(a(i), String(s)), r.push(a(i)));
|
|
43
|
+
e.radius !== void 0 && (o.style.setProperty("--prui-radius", String(e.radius)), r.push("--prui-radius")), e["dim-op"] !== void 0 && (o.style.setProperty("--prui-dim-op", String(e["dim-op"])), r.push("--prui-dim-op"));
|
|
43
44
|
}
|
|
44
|
-
const
|
|
45
|
-
return
|
|
45
|
+
const n = t.storageKey === void 0 ? "prui:tokens" : t.storageKey;
|
|
46
|
+
return n && typeof localStorage < "u" && localStorage.setItem(n, JSON.stringify(e)), r;
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
+
function I(e = {}) {
|
|
48
49
|
const t = e.target ?? (typeof document < "u" ? document.documentElement : null);
|
|
49
50
|
if (t) {
|
|
50
|
-
for (const
|
|
51
|
-
t.style.removeProperty(
|
|
51
|
+
for (const r of [...m, "radius", "dim-op"])
|
|
52
|
+
t.style.removeProperty(a(r));
|
|
52
53
|
t.style.removeProperty("--prui-radius"), t.style.removeProperty("--prui-dim-op");
|
|
53
54
|
}
|
|
54
|
-
const
|
|
55
|
-
|
|
55
|
+
const o = e.storageKey === void 0 ? "prui:tokens" : e.storageKey;
|
|
56
|
+
o && typeof localStorage < "u" && localStorage.removeItem(o);
|
|
56
57
|
}
|
|
57
|
-
function
|
|
58
|
+
function P(e = {}) {
|
|
58
59
|
if (typeof localStorage > "u") return null;
|
|
59
|
-
const t = e.storageKey ?? "prui:tokens",
|
|
60
|
-
if (!
|
|
60
|
+
const t = e.storageKey ?? "prui:tokens", o = localStorage.getItem(t);
|
|
61
|
+
if (!o) return null;
|
|
61
62
|
try {
|
|
62
|
-
const
|
|
63
|
-
return
|
|
63
|
+
const r = JSON.parse(o);
|
|
64
|
+
return h(r, { target: e.target, storageKey: null }), r;
|
|
64
65
|
} catch {
|
|
65
66
|
return null;
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
|
-
function
|
|
69
|
+
function b(e) {
|
|
69
70
|
return e === "dark" ? "control" : e === "light" ? "daylight" : e;
|
|
70
71
|
}
|
|
71
|
-
const
|
|
72
|
-
function
|
|
73
|
-
return
|
|
72
|
+
const g = ["control", "workshop", "ember"], y = ["daylight"];
|
|
73
|
+
function w(e) {
|
|
74
|
+
return g.includes(e);
|
|
74
75
|
}
|
|
75
76
|
function K(e) {
|
|
76
|
-
return
|
|
77
|
+
return y.includes(e);
|
|
77
78
|
}
|
|
78
|
-
function
|
|
79
|
+
function p(e) {
|
|
79
80
|
const t = c.get(e);
|
|
80
|
-
return t != null && t.mode ? t.mode :
|
|
81
|
+
return t != null && t.mode ? t.mode : w(e) ? "dark" : "light";
|
|
81
82
|
}
|
|
82
|
-
function
|
|
83
|
+
function S(e, t) {
|
|
83
84
|
return [`${d}${e}`, "prui-root", `prui-mode-${t}`];
|
|
84
85
|
}
|
|
85
|
-
function
|
|
86
|
+
function k(e) {
|
|
86
87
|
const t = [...e.classList].filter(
|
|
87
|
-
(
|
|
88
|
+
(o) => o.startsWith(d) || o === "prui-root" || o.startsWith("prui-mode-")
|
|
88
89
|
);
|
|
89
90
|
t.length && e.classList.remove(...t);
|
|
90
91
|
}
|
|
@@ -92,20 +93,20 @@ function T(e = {}) {
|
|
|
92
93
|
const t = e.theme ?? "control";
|
|
93
94
|
if (!(t === "dark" || t === "light" || u.includes(t) || c.has(t)))
|
|
94
95
|
return T({ ...e, theme: "control" });
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
return
|
|
96
|
+
const r = t === "dark" ? "control" : t === "light" ? "daylight" : t, n = e.mode ?? p(r), i = e.target ?? (typeof document < "u" ? document.documentElement : null);
|
|
97
|
+
i && (k(i), i.classList.add(...S(r, n)), i.dataset.pruiTheme = r, i.dataset.pruiMode = n, i.style.colorScheme = n);
|
|
98
|
+
const s = e.storageKey === void 0 ? "prui:theme" : e.storageKey;
|
|
99
|
+
return s && typeof localStorage < "u" && localStorage.setItem(s, JSON.stringify({ theme: r, mode: n })), { theme: r, mode: n };
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
+
function $(e = "prui:theme") {
|
|
101
102
|
if (typeof localStorage > "u") return null;
|
|
102
103
|
const t = localStorage.getItem(e);
|
|
103
104
|
if (!t) return null;
|
|
104
105
|
try {
|
|
105
|
-
const
|
|
106
|
-
if (!
|
|
107
|
-
const
|
|
108
|
-
return { theme:
|
|
106
|
+
const o = JSON.parse(t), r = u.find((i) => i === o.theme);
|
|
107
|
+
if (!r) return null;
|
|
108
|
+
const n = o.mode === "light" || o.mode === "dark" ? o.mode : p(r);
|
|
109
|
+
return { theme: r, mode: n };
|
|
109
110
|
} catch {
|
|
110
111
|
return null;
|
|
111
112
|
}
|
|
@@ -114,7 +115,7 @@ function M(e) {
|
|
|
114
115
|
const t = u.indexOf(e);
|
|
115
116
|
return u[(t + 1) % u.length] ?? "control";
|
|
116
117
|
}
|
|
117
|
-
const
|
|
118
|
+
const z = {
|
|
118
119
|
name: "applyTheme",
|
|
119
120
|
description: "Apply a named PRUI theme and persist the choice.",
|
|
120
121
|
props: [
|
|
@@ -123,21 +124,48 @@ const b = {
|
|
|
123
124
|
{ name: "target", type: "HTMLElement", default: "document.documentElement", control: "none" },
|
|
124
125
|
{ name: "storageKey", type: "string | null", default: "'prui:theme'", control: "text" }
|
|
125
126
|
]
|
|
127
|
+
}, E = {
|
|
128
|
+
sm: 640,
|
|
129
|
+
md: 768,
|
|
130
|
+
lg: 1024,
|
|
131
|
+
xl: 1280,
|
|
132
|
+
"2xl": 1536
|
|
133
|
+
};
|
|
134
|
+
function L(e) {
|
|
135
|
+
const [t, o] = l.useState(!1);
|
|
136
|
+
return l.useEffect(() => {
|
|
137
|
+
if (typeof window > "u" || !window.matchMedia) return;
|
|
138
|
+
const r = window.matchMedia(`(min-width: ${E[e]}px)`), n = () => o(r.matches);
|
|
139
|
+
return n(), r.addEventListener("change", n), () => r.removeEventListener("change", n);
|
|
140
|
+
}, [e]), t;
|
|
141
|
+
}
|
|
142
|
+
const O = {
|
|
143
|
+
radius: ["--prui-radius-1", "--prui-radius-2", "--prui-radius-3", "--prui-radius-full"],
|
|
144
|
+
zIndex: ["--prui-z-header", "--prui-z-drawer", "--prui-z-overlay", "--prui-z-flyout", "--prui-z-tooltip", "--prui-z-modal", "--prui-z-confirm", "--prui-z-toast", "--prui-z-content"],
|
|
145
|
+
motion: ["--prui-duration-fast", "--prui-duration-base", "--prui-duration-slow", "--prui-ease-out", "--prui-ease-in-out", "--prui-ease-spring"],
|
|
146
|
+
spacing: ["--prui-space-1", "--prui-space-2", "--prui-space-3", "--prui-space-4", "--prui-space-5", "--prui-space-6", "--prui-space-8", "--prui-space-10", "--prui-space-12"],
|
|
147
|
+
typography: ["--prui-text-xs", "--prui-text-sm", "--prui-text-base", "--prui-text-lg", "--prui-text-xl", "--prui-text-2xl", "--prui-text-3xl"],
|
|
148
|
+
weight: ["--prui-weight-normal", "--prui-weight-medium", "--prui-weight-semibold", "--prui-weight-bold"],
|
|
149
|
+
elevation: ["--prui-shadow-sm", "--prui-shadow-md", "--prui-shadow-lg", "--prui-shadow-modal"],
|
|
150
|
+
opacity: ["--prui-opacity-disabled", "--prui-opacity-muted", "--prui-opacity-overlay"]
|
|
126
151
|
};
|
|
127
152
|
export {
|
|
153
|
+
E as PRUI_BREAKPOINTS,
|
|
154
|
+
O as PRUI_DESIGN_TOKENS,
|
|
128
155
|
u as PRUI_THEMES,
|
|
129
156
|
m as PRUI_TOKENS,
|
|
130
157
|
T as applyTheme,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
158
|
+
h as applyThemeTokens,
|
|
159
|
+
I as clearAppliedTokens,
|
|
160
|
+
v as defineTheme,
|
|
161
|
+
w as isDarkTheme,
|
|
135
162
|
K as isLightTheme,
|
|
136
|
-
|
|
163
|
+
x as listThemes,
|
|
137
164
|
M as nextTheme,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
165
|
+
$ as readPersistedTheme,
|
|
166
|
+
b as resolveThemeName,
|
|
167
|
+
P as restoreAppliedTokens,
|
|
168
|
+
z as themeMeta,
|
|
169
|
+
p as themeMode,
|
|
170
|
+
L as useBreakpointAtLeast
|
|
143
171
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skiddph/prui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "PRUI component system: primitives, app-layer super-components, pages, and themes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
"types": "./dist/forms/index.d.ts",
|
|
32
32
|
"import": "./dist/forms.js"
|
|
33
33
|
},
|
|
34
|
+
"./i18n": {
|
|
35
|
+
"types": "./dist/i18n/index.d.ts",
|
|
36
|
+
"import": "./dist/i18n.js"
|
|
37
|
+
},
|
|
34
38
|
"./pages": {
|
|
35
39
|
"types": "./dist/pages/index.d.ts",
|
|
36
40
|
"import": "./dist/pages.js"
|
|
@@ -52,6 +56,7 @@
|
|
|
52
56
|
"tailwind-merge": "^3.3.1"
|
|
53
57
|
},
|
|
54
58
|
"devDependencies": {
|
|
59
|
+
"@playwright/test": "^1.63.0",
|
|
55
60
|
"@tailwindcss/cli": "^4.3.3",
|
|
56
61
|
"@testing-library/jest-dom": "^6.6.3",
|
|
57
62
|
"@testing-library/react": "^16.3.0",
|
|
@@ -60,6 +65,7 @@
|
|
|
60
65
|
"@types/react": "^19.1.0",
|
|
61
66
|
"@types/react-dom": "^19.1.0",
|
|
62
67
|
"@vitejs/plugin-react": "^4.5.0",
|
|
68
|
+
"axe-core": "^4.13.0",
|
|
63
69
|
"jsdom": "^26.1.0",
|
|
64
70
|
"lucide-react": "^0.525.0",
|
|
65
71
|
"react": "^19.1.0",
|
|
@@ -68,7 +74,8 @@
|
|
|
68
74
|
"typescript": "^5.9.3",
|
|
69
75
|
"vite": "^6.3.5",
|
|
70
76
|
"vite-plugin-dts": "^4.5.4",
|
|
71
|
-
"vitest": "^3.2.4"
|
|
77
|
+
"vitest": "^3.2.4",
|
|
78
|
+
"vitest-axe": "^0.1.0"
|
|
72
79
|
},
|
|
73
80
|
"repository": {
|
|
74
81
|
"type": "git",
|