@skiddph/prui 0.7.0 → 0.8.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.
Files changed (77) hide show
  1. package/dist/app/resource.d.ts +44 -1
  2. package/dist/app.js +1 -1
  3. package/dist/chunks/auth-shell-DQJ4UmUv.js +1208 -0
  4. package/dist/chunks/data-table-toolbar-B-5J2Ozl.js +736 -0
  5. package/dist/core/accordion.d.ts +16 -0
  6. package/dist/core/accordion.js +108 -0
  7. package/dist/core/alert.d.ts +20 -0
  8. package/dist/core/alert.js +63 -0
  9. package/dist/core/anchor.d.ts +35 -0
  10. package/dist/core/anchor.js +39 -0
  11. package/dist/core/breadcrumb.d.ts +30 -0
  12. package/dist/core/breadcrumb.js +67 -0
  13. package/dist/core/button.d.ts +8 -1
  14. package/dist/core/button.js +23 -18
  15. package/dist/core/calendar.d.ts +29 -0
  16. package/dist/core/calendar.js +180 -0
  17. package/dist/core/card.d.ts +5 -1
  18. package/dist/core/card.js +33 -29
  19. package/dist/core/checkbox.d.ts +19 -0
  20. package/dist/core/checkbox.js +55 -0
  21. package/dist/core/combobox.d.ts +32 -0
  22. package/dist/core/combobox.js +183 -0
  23. package/dist/core/date-picker.d.ts +41 -0
  24. package/dist/core/date-picker.js +202 -0
  25. package/dist/core/dialog.d.ts +8 -0
  26. package/dist/core/dialog.js +59 -61
  27. package/dist/core/drawer.d.ts +34 -0
  28. package/dist/core/drawer.js +129 -0
  29. package/dist/core/dropdown.d.ts +8 -4
  30. package/dist/core/dropdown.js +136 -51
  31. package/dist/core/file-upload.d.ts +28 -0
  32. package/dist/core/file-upload.js +111 -0
  33. package/dist/core/index.d.ts +21 -0
  34. package/dist/core/list-nav.d.ts +27 -0
  35. package/dist/core/list-nav.js +51 -0
  36. package/dist/core/modal.d.ts +14 -5
  37. package/dist/core/modal.js +163 -156
  38. package/dist/core/overlay.d.ts +93 -0
  39. package/dist/core/overlay.js +189 -0
  40. package/dist/core/popover.d.ts +29 -0
  41. package/dist/core/popover.js +124 -0
  42. package/dist/core/progress.d.ts +21 -0
  43. package/dist/core/progress.js +59 -0
  44. package/dist/core/radio.d.ts +20 -0
  45. package/dist/core/radio.js +115 -0
  46. package/dist/core/select.d.ts +6 -0
  47. package/dist/core/select.js +178 -97
  48. package/dist/core/skeleton.d.ts +20 -0
  49. package/dist/core/skeleton.js +41 -0
  50. package/dist/core/spinner.d.ts +15 -0
  51. package/dist/core/spinner.js +41 -0
  52. package/dist/core/tabs.js +82 -53
  53. package/dist/core/timeline.d.ts +22 -0
  54. package/dist/core/timeline.js +57 -0
  55. package/dist/core/toast.d.ts +36 -0
  56. package/dist/core/toast.js +123 -0
  57. package/dist/core/tooltip.d.ts +23 -0
  58. package/dist/core/tooltip.js +96 -0
  59. package/dist/core/tree-view.d.ts +34 -0
  60. package/dist/core/tree-view.js +133 -0
  61. package/dist/core.js +152 -62
  62. package/dist/data-table/data-table.d.ts +22 -1
  63. package/dist/data-table.js +1 -1
  64. package/dist/forms/form.d.ts +8 -0
  65. package/dist/forms.js +213 -200
  66. package/dist/i18n/index.d.ts +83 -0
  67. package/dist/i18n.js +99 -0
  68. package/dist/index.d.ts +1 -0
  69. package/dist/index.js +256 -156
  70. package/dist/prui-utilities.css +1 -1
  71. package/dist/prui.css +111 -4
  72. package/dist/theme/base.css +110 -3
  73. package/dist/theme/index.d.ts +27 -0
  74. package/dist/theme.js +86 -58
  75. package/package.json +9 -2
  76. package/dist/chunks/auth-shell-BG5vx9eG.js +0 -1054
  77. 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 s(e) {
15
+ function a(e) {
15
16
  return `--prui-${e}`;
16
17
  }
17
18
  function f(e) {
18
19
  const t = [];
19
- for (const [r, n] of Object.entries(e))
20
- n !== void 0 && t.push(` ${s(r)}: ${n};`);
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 E(e, t) {
25
- const r = e.trim().toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, "") || "custom";
26
- if (c.set(r, { ...t }), typeof document < "u") {
27
- let n = document.getElementById(`prui-custom-theme-${r}`);
28
- n || (n = document.createElement("style"), n.id = `prui-custom-theme-${r}`, document.head.appendChild(n)), n.textContent = `.${d}${r} {
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 r;
33
+ return o;
33
34
  }
34
- function v() {
35
+ function x() {
35
36
  return [...u, ...c.keys()];
36
37
  }
37
- function p(e, t = {}) {
38
- const r = t.target ?? (typeof document < "u" ? document.documentElement : null), n = [];
39
- if (r) {
40
- for (const [o, l] of Object.entries(e))
41
- l !== void 0 && (r.style.setProperty(s(o), String(l)), n.push(s(o)));
42
- e.radius !== void 0 && (r.style.setProperty("--prui-radius", String(e.radius)), n.push("--prui-radius")), e["dim-op"] !== void 0 && (r.style.setProperty("--prui-dim-op", String(e["dim-op"])), n.push("--prui-dim-op"));
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 i = t.storageKey === void 0 ? "prui:tokens" : t.storageKey;
45
- return i && typeof localStorage < "u" && localStorage.setItem(i, JSON.stringify(e)), n;
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 $(e = {}) {
48
+ function I(e = {}) {
48
49
  const t = e.target ?? (typeof document < "u" ? document.documentElement : null);
49
50
  if (t) {
50
- for (const n of [...m, "radius", "dim-op"])
51
- t.style.removeProperty(s(n));
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 r = e.storageKey === void 0 ? "prui:tokens" : e.storageKey;
55
- r && typeof localStorage < "u" && localStorage.removeItem(r);
55
+ const o = e.storageKey === void 0 ? "prui:tokens" : e.storageKey;
56
+ o && typeof localStorage < "u" && localStorage.removeItem(o);
56
57
  }
57
- function w(e = {}) {
58
+ function P(e = {}) {
58
59
  if (typeof localStorage > "u") return null;
59
- const t = e.storageKey ?? "prui:tokens", r = localStorage.getItem(t);
60
- if (!r) return null;
60
+ const t = e.storageKey ?? "prui:tokens", o = localStorage.getItem(t);
61
+ if (!o) return null;
61
62
  try {
62
- const n = JSON.parse(r);
63
- return p(n, { target: e.target, storageKey: null }), n;
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 I(e) {
69
+ function b(e) {
69
70
  return e === "dark" ? "control" : e === "light" ? "daylight" : e;
70
71
  }
71
- const h = ["control", "workshop", "ember"], g = ["daylight"];
72
- function y(e) {
73
- return h.includes(e);
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 g.includes(e);
77
+ return y.includes(e);
77
78
  }
78
- function a(e) {
79
+ function p(e) {
79
80
  const t = c.get(e);
80
- return t != null && t.mode ? t.mode : y(e) ? "dark" : "light";
81
+ return t != null && t.mode ? t.mode : w(e) ? "dark" : "light";
81
82
  }
82
- function k(e, t) {
83
+ function S(e, t) {
83
84
  return [`${d}${e}`, "prui-root", `prui-mode-${t}`];
84
85
  }
85
- function S(e) {
86
+ function k(e) {
86
87
  const t = [...e.classList].filter(
87
- (r) => r.startsWith(d) || r === "prui-root" || r.startsWith("prui-mode-")
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 n = t === "dark" ? "control" : t === "light" ? "daylight" : t, i = e.mode ?? a(n), o = e.target ?? (typeof document < "u" ? document.documentElement : null);
96
- o && (S(o), o.classList.add(...k(n, i)), o.dataset.pruiTheme = n, o.dataset.pruiMode = i, o.style.colorScheme = i);
97
- const l = e.storageKey === void 0 ? "prui:theme" : e.storageKey;
98
- return l && typeof localStorage < "u" && localStorage.setItem(l, JSON.stringify({ theme: n, mode: i })), { theme: n, mode: i };
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 P(e = "prui:theme") {
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 r = JSON.parse(t), n = u.find((o) => o === r.theme);
106
- if (!n) return null;
107
- const i = r.mode === "light" || r.mode === "dark" ? r.mode : a(n);
108
- return { theme: n, mode: i };
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 b = {
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
- p as applyThemeTokens,
132
- $ as clearAppliedTokens,
133
- E as defineTheme,
134
- y as isDarkTheme,
158
+ h as applyThemeTokens,
159
+ I as clearAppliedTokens,
160
+ v as defineTheme,
161
+ w as isDarkTheme,
135
162
  K as isLightTheme,
136
- v as listThemes,
163
+ x as listThemes,
137
164
  M as nextTheme,
138
- P as readPersistedTheme,
139
- I as resolveThemeName,
140
- w as restoreAppliedTokens,
141
- b as themeMeta,
142
- a as themeMode
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.7.0",
3
+ "version": "0.8.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",