@js-empire/emperor-ui 1.3.0 → 1.3.2

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 CHANGED
@@ -61,6 +61,21 @@ Import the library’s global styles in your app root (e.g. `layout.tsx` or `_ap
61
61
  import "@js-empire/emperor-ui/globals.css";
62
62
  ```
63
63
 
64
+ ### Next.js — avoiding "document is not defined"
65
+
66
+ Emperor UI uses HeroUI, which accesses browser APIs during module load. In Next.js (App Router), this can cause `document is not defined` when components are imported in server-rendered contexts (e.g. error boundaries, layouts, or barrel exports that load on the server).
67
+
68
+ **Fix:** Import `ColorPicker` from the dedicated subpath, which does not load HeroUI until the client:
69
+
70
+ ```tsx
71
+ import {
72
+ ColorPicker,
73
+ ColorPickerProps,
74
+ } from "@js-empire/emperor-ui/color-picker";
75
+ ```
76
+
77
+ Use `@js-empire/emperor-ui/color-picker` instead of `@js-empire/emperor-ui` for ColorPicker in files that may run on the server. Ensure `HeroUIProvider` wraps your app as per [HeroUI's Next.js setup](https://heroui.com/docs/frameworks/nextjs).
78
+
64
79
  ---
65
80
 
66
81
  ## Components
@@ -0,0 +1,280 @@
1
+ "use client";
2
+ import ee, { useState as re, useEffect as te } from "react";
3
+ var p = { exports: {} }, _ = {};
4
+ var I;
5
+ function ne() {
6
+ if (I) return _;
7
+ I = 1;
8
+ var l = /* @__PURE__ */ Symbol.for("react.transitional.element"), u = /* @__PURE__ */ Symbol.for("react.fragment");
9
+ function c(i, o, s) {
10
+ var d = null;
11
+ if (s !== void 0 && (d = "" + s), o.key !== void 0 && (d = "" + o.key), "key" in o) {
12
+ s = {};
13
+ for (var m in o)
14
+ m !== "key" && (s[m] = o[m]);
15
+ } else s = o;
16
+ return o = s.ref, {
17
+ $$typeof: l,
18
+ type: i,
19
+ key: d,
20
+ ref: o !== void 0 ? o : null,
21
+ props: s
22
+ };
23
+ }
24
+ return _.Fragment = u, _.jsx = c, _.jsxs = c, _;
25
+ }
26
+ var E = {};
27
+ var $;
28
+ function ae() {
29
+ return $ || ($ = 1, process.env.NODE_ENV !== "production" && (function() {
30
+ function l(e) {
31
+ if (e == null) return null;
32
+ if (typeof e == "function")
33
+ return e.$$typeof === Z ? null : e.displayName || e.name || null;
34
+ if (typeof e == "string") return e;
35
+ switch (e) {
36
+ case v:
37
+ return "Fragment";
38
+ case J:
39
+ return "Profiler";
40
+ case U:
41
+ return "StrictMode";
42
+ case G:
43
+ return "Suspense";
44
+ case X:
45
+ return "SuspenseList";
46
+ case H:
47
+ return "Activity";
48
+ }
49
+ if (typeof e == "object")
50
+ switch (typeof e.tag == "number" && console.error(
51
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
52
+ ), e.$$typeof) {
53
+ case W:
54
+ return "Portal";
55
+ case q:
56
+ return e.displayName || "Context";
57
+ case V:
58
+ return (e._context.displayName || "Context") + ".Consumer";
59
+ case z:
60
+ var r = e.render;
61
+ return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
62
+ case B:
63
+ return r = e.displayName || null, r !== null ? r : l(e.type) || "Memo";
64
+ case T:
65
+ r = e._payload, e = e._init;
66
+ try {
67
+ return l(e(r));
68
+ } catch {
69
+ }
70
+ }
71
+ return null;
72
+ }
73
+ function u(e) {
74
+ return "" + e;
75
+ }
76
+ function c(e) {
77
+ try {
78
+ u(e);
79
+ var r = !1;
80
+ } catch {
81
+ r = !0;
82
+ }
83
+ if (r) {
84
+ r = console;
85
+ var t = r.error, n = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
86
+ return t.call(
87
+ r,
88
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
89
+ n
90
+ ), u(e);
91
+ }
92
+ }
93
+ function i(e) {
94
+ if (e === v) return "<>";
95
+ if (typeof e == "object" && e !== null && e.$$typeof === T)
96
+ return "<...>";
97
+ try {
98
+ var r = l(e);
99
+ return r ? "<" + r + ">" : "<...>";
100
+ } catch {
101
+ return "<...>";
102
+ }
103
+ }
104
+ function o() {
105
+ var e = k.A;
106
+ return e === null ? null : e.getOwner();
107
+ }
108
+ function s() {
109
+ return Error("react-stack-top-frame");
110
+ }
111
+ function d(e) {
112
+ if (y.call(e, "key")) {
113
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
114
+ if (r && r.isReactWarning) return !1;
115
+ }
116
+ return e.key !== void 0;
117
+ }
118
+ function m(e, r) {
119
+ function t() {
120
+ g || (g = !0, console.error(
121
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
122
+ r
123
+ ));
124
+ }
125
+ t.isReactWarning = !0, Object.defineProperty(e, "key", {
126
+ get: t,
127
+ configurable: !0
128
+ });
129
+ }
130
+ function L() {
131
+ var e = l(this.type);
132
+ return h[e] || (h[e] = !0, console.error(
133
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
134
+ )), e = this.props.ref, e !== void 0 ? e : null;
135
+ }
136
+ function M(e, r, t, n, b, P) {
137
+ var a = t.ref;
138
+ return e = {
139
+ $$typeof: x,
140
+ type: e,
141
+ key: r,
142
+ props: t,
143
+ _owner: n
144
+ }, (a !== void 0 ? a : null) !== null ? Object.defineProperty(e, "ref", {
145
+ enumerable: !1,
146
+ get: L
147
+ }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
148
+ configurable: !1,
149
+ enumerable: !1,
150
+ writable: !0,
151
+ value: 0
152
+ }), Object.defineProperty(e, "_debugInfo", {
153
+ configurable: !1,
154
+ enumerable: !1,
155
+ writable: !0,
156
+ value: null
157
+ }), Object.defineProperty(e, "_debugStack", {
158
+ configurable: !1,
159
+ enumerable: !1,
160
+ writable: !0,
161
+ value: b
162
+ }), Object.defineProperty(e, "_debugTask", {
163
+ configurable: !1,
164
+ enumerable: !1,
165
+ writable: !0,
166
+ value: P
167
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
168
+ }
169
+ function S(e, r, t, n, b, P) {
170
+ var a = r.children;
171
+ if (a !== void 0)
172
+ if (n)
173
+ if (Q(a)) {
174
+ for (n = 0; n < a.length; n++)
175
+ j(a[n]);
176
+ Object.freeze && Object.freeze(a);
177
+ } else
178
+ console.error(
179
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
180
+ );
181
+ else j(a);
182
+ if (y.call(r, "key")) {
183
+ a = l(e);
184
+ var f = Object.keys(r).filter(function(K) {
185
+ return K !== "key";
186
+ });
187
+ n = 0 < f.length ? "{key: someKey, " + f.join(": ..., ") + ": ...}" : "{key: someKey}", Y[a + n] || (f = 0 < f.length ? "{" + f.join(": ..., ") + ": ...}" : "{}", console.error(
188
+ `A props object containing a "key" prop is being spread into JSX:
189
+ let props = %s;
190
+ <%s {...props} />
191
+ React keys must be passed directly to JSX without using spread:
192
+ let props = %s;
193
+ <%s key={someKey} {...props} />`,
194
+ n,
195
+ a,
196
+ f,
197
+ a
198
+ ), Y[a + n] = !0);
199
+ }
200
+ if (a = null, t !== void 0 && (c(t), a = "" + t), d(r) && (c(r.key), a = "" + r.key), "key" in r) {
201
+ t = {};
202
+ for (var A in r)
203
+ A !== "key" && (t[A] = r[A]);
204
+ } else t = r;
205
+ return a && m(
206
+ t,
207
+ typeof e == "function" ? e.displayName || e.name || "Unknown" : e
208
+ ), M(
209
+ e,
210
+ a,
211
+ t,
212
+ o(),
213
+ b,
214
+ P
215
+ );
216
+ }
217
+ function j(e) {
218
+ w(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === T && (e._payload.status === "fulfilled" ? w(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
219
+ }
220
+ function w(e) {
221
+ return typeof e == "object" && e !== null && e.$$typeof === x;
222
+ }
223
+ var R = ee, x = /* @__PURE__ */ Symbol.for("react.transitional.element"), W = /* @__PURE__ */ Symbol.for("react.portal"), v = /* @__PURE__ */ Symbol.for("react.fragment"), U = /* @__PURE__ */ Symbol.for("react.strict_mode"), J = /* @__PURE__ */ Symbol.for("react.profiler"), V = /* @__PURE__ */ Symbol.for("react.consumer"), q = /* @__PURE__ */ Symbol.for("react.context"), z = /* @__PURE__ */ Symbol.for("react.forward_ref"), G = /* @__PURE__ */ Symbol.for("react.suspense"), X = /* @__PURE__ */ Symbol.for("react.suspense_list"), B = /* @__PURE__ */ Symbol.for("react.memo"), T = /* @__PURE__ */ Symbol.for("react.lazy"), H = /* @__PURE__ */ Symbol.for("react.activity"), Z = /* @__PURE__ */ Symbol.for("react.client.reference"), k = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, y = Object.prototype.hasOwnProperty, Q = Array.isArray, O = console.createTask ? console.createTask : function() {
224
+ return null;
225
+ };
226
+ R = {
227
+ react_stack_bottom_frame: function(e) {
228
+ return e();
229
+ }
230
+ };
231
+ var g, h = {}, N = R.react_stack_bottom_frame.bind(
232
+ R,
233
+ s
234
+ )(), C = O(i(s)), Y = {};
235
+ E.Fragment = v, E.jsx = function(e, r, t) {
236
+ var n = 1e4 > k.recentlyCreatedOwnerStacks++;
237
+ return S(
238
+ e,
239
+ r,
240
+ t,
241
+ !1,
242
+ n ? Error("react-stack-top-frame") : N,
243
+ n ? O(i(e)) : C
244
+ );
245
+ }, E.jsxs = function(e, r, t) {
246
+ var n = 1e4 > k.recentlyCreatedOwnerStacks++;
247
+ return S(
248
+ e,
249
+ r,
250
+ t,
251
+ !0,
252
+ n ? Error("react-stack-top-frame") : N,
253
+ n ? O(i(e)) : C
254
+ );
255
+ };
256
+ })()), E;
257
+ }
258
+ var F;
259
+ function oe() {
260
+ return F || (F = 1, process.env.NODE_ENV === "production" ? p.exports = ne() : p.exports = ae()), p.exports;
261
+ }
262
+ var D = oe();
263
+ function le(l) {
264
+ const [u, c] = re(null);
265
+ return te(() => {
266
+ import("./color-picker-impl-DjkdN7hE.js").then(
267
+ (i) => c(() => i.ColorPicker)
268
+ );
269
+ }, []), u ? /* @__PURE__ */ D.jsx(u, { ...l }) : /* @__PURE__ */ D.jsx(
270
+ "div",
271
+ {
272
+ className: "h-12 min-w-52 rounded-lg bg-gray-100 animate-pulse",
273
+ "aria-hidden": !0
274
+ }
275
+ );
276
+ }
277
+ export {
278
+ le as C,
279
+ D as j
280
+ };
@@ -0,0 +1,6 @@
1
+ "use client";"use strict";const S=require("react");var b={exports:{}},E={};var F;function re(){if(F)return E;F=1;var l=Symbol.for("react.transitional.element"),u=Symbol.for("react.fragment");function c(i,o,s){var d=null;if(s!==void 0&&(d=""+s),o.key!==void 0&&(d=""+o.key),"key"in o){s={};for(var m in o)m!=="key"&&(s[m]=o[m])}else s=o;return o=s.ref,{$$typeof:l,type:i,key:d,ref:o!==void 0?o:null,props:s}}return E.Fragment=u,E.jsx=c,E.jsxs=c,E}var _={};var D;function te(){return D||(D=1,process.env.NODE_ENV!=="production"&&(function(){function l(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Q?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case p:return"Fragment";case J:return"Profiler";case q:return"StrictMode";case X:return"Suspense";case B:return"SuspenseList";case Z:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case U:return"Portal";case z:return e.displayName||"Context";case V:return(e._context.displayName||"Context")+".Consumer";case G:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case H:return r=e.displayName||null,r!==null?r:l(e.type)||"Memo";case T:r=e._payload,e=e._init;try{return l(e(r))}catch{}}return null}function u(e){return""+e}function c(e){try{u(e);var r=!1}catch{r=!0}if(r){r=console;var t=r.error,n=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",n),u(e)}}function i(e){if(e===p)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===T)return"<...>";try{var r=l(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function o(){var e=k.A;return e===null?null:e.getOwner()}function s(){return Error("react-stack-top-frame")}function d(e){if(h.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function m(e,r){function t(){N||(N=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}function M(){var e=l(this.type);return C[e]||(C[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function W(e,r,t,n,v,O){var a=t.ref;return e={$$typeof:g,type:e,key:r,props:t,_owner:n},(a!==void 0?a:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:M}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:v}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:O}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function j(e,r,t,n,v,O){var a=r.children;if(a!==void 0)if(n)if(K(a)){for(n=0;n<a.length;n++)w(a[n]);Object.freeze&&Object.freeze(a)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else w(a);if(h.call(r,"key")){a=l(e);var f=Object.keys(r).filter(function(ee){return ee!=="key"});n=0<f.length?"{key: someKey, "+f.join(": ..., ")+": ...}":"{key: someKey}",$[a+n]||(f=0<f.length?"{"+f.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
+ let props = %s;
3
+ <%s {...props} />
4
+ React keys must be passed directly to JSX without using spread:
5
+ let props = %s;
6
+ <%s key={someKey} {...props} />`,n,a,f,a),$[a+n]=!0)}if(a=null,t!==void 0&&(c(t),a=""+t),d(r)&&(c(r.key),a=""+r.key),"key"in r){t={};for(var A in r)A!=="key"&&(t[A]=r[A])}else t=r;return a&&m(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),W(e,a,t,o(),v,O)}function w(e){y(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===T&&(e._payload.status==="fulfilled"?y(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function y(e){return typeof e=="object"&&e!==null&&e.$$typeof===g}var R=S,g=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),J=Symbol.for("react.profiler"),V=Symbol.for("react.consumer"),z=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),Q=Symbol.for("react.client.reference"),k=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,h=Object.prototype.hasOwnProperty,K=Array.isArray,P=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(e){return e()}};var N,C={},Y=R.react_stack_bottom_frame.bind(R,s)(),I=P(i(s)),$={};_.Fragment=p,_.jsx=function(e,r,t){var n=1e4>k.recentlyCreatedOwnerStacks++;return j(e,r,t,!1,n?Error("react-stack-top-frame"):Y,n?P(i(e)):I)},_.jsxs=function(e,r,t){var n=1e4>k.recentlyCreatedOwnerStacks++;return j(e,r,t,!0,n?Error("react-stack-top-frame"):Y,n?P(i(e)):I)}})()),_}var L;function ne(){return L||(L=1,process.env.NODE_ENV==="production"?b.exports=re():b.exports=te()),b.exports}var x=ne();function ae(l){const[u,c]=S.useState(null);return S.useEffect(()=>{Promise.resolve().then(()=>require("./color-picker-impl-DA7UeGtW.cjs")).then(i=>c(()=>i.ColorPicker))},[]),u?x.jsx(u,{...l}):x.jsx("div",{className:"h-12 min-w-52 rounded-lg bg-gray-100 animate-pulse","aria-hidden":!0})}exports.ColorPicker=ae;exports.jsxRuntimeExports=x;
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./color-picker-TyD80Z4B.cjs"),t=require("./header-z5lsi6Rz.cjs");function o({...e}){return e?.inputType==="preset"?r.jsxRuntimeExports.jsx(t.PresetColorPicker,{...e}):r.jsxRuntimeExports.jsx(t.FreeColorPicker,{...e})}exports.ColorPicker=o;
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { j as e } from "./color-picker-BOgYy7CG.js";
3
+ import { P as t, F as o } from "./header-CKvu3NO_.js";
4
+ function n({ ...r }) {
5
+ return r?.inputType === "preset" ? /* @__PURE__ */ e.jsx(t, { ...r }) : /* @__PURE__ */ e.jsx(o, { ...r });
6
+ }
7
+ export {
8
+ n as ColorPicker
9
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./color-picker-TyD80Z4B.cjs");exports.ColorPicker=e.ColorPicker;
@@ -0,0 +1,21 @@
1
+ import { InputProps } from '@heroui/input';
2
+ import { JSX } from 'react/jsx-runtime';
3
+ import { SelectProps } from '@heroui/select';
4
+
5
+ /**
6
+ * ColorPicker wrapper that loads the HeroUI-dependent implementation only on the client.
7
+ * Prevents "document is not defined" during SSR when used in Next.js and similar frameworks.
8
+ */
9
+ export declare function ColorPicker(props: ColorPickerProps): JSX.Element;
10
+
11
+ export declare type ColorPickerInputType = "free" | "preset";
12
+
13
+ export declare type ColorPickerProps = Omit<InputProps & SelectProps, "onChange" | "onValueChange" | "onSelectionChange" | "children" | "selectedKeys" | "defaultSelectedKeys" | "value"> & {
14
+ inputType: ColorPickerInputType;
15
+ presets?: string[];
16
+ onChange?: (value: string) => void;
17
+ value?: string;
18
+ defaultValue?: string;
19
+ };
20
+
21
+ export { }
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ import { C as r } from "./color-picker-BOgYy7CG.js";
3
+ export {
4
+ r as ColorPicker
5
+ };