@editora/ui-react 0.1.14 → 0.1.15
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/Button.cjs.js +1 -1
- package/dist/Button.esm.js +44 -44
- package/dist/Sidebar.cjs.js +105 -1
- package/dist/Sidebar.esm.js +10130 -287
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Sidebar.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/Button.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("react"),T=require("./_internals-a238f8ce.js"),k=u=>u&&u.__esModule?u:{default:u},
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("react"),T=require("./_internals-a238f8ce.js"),k=u=>u&&u.__esModule?u:{default:u},s=k(v);function p(u,n,r){if(r==null||!r){u.removeAttribute(n);return}u.setAttribute(n,"")}function e(u,n,r){if(!r){u.removeAttribute(n);return}u.setAttribute(n,r)}const P=s.default.forwardRef(function({children:n,onClick:r,variant:A,size:o,recipe:_,radius:f,scale:y,icon:B,startIcon:M,endIcon:h,loading:a,loadingLabel:b,state:d,tone:S,block:g,headless:x,disabled:R,animation:w,theme:i,type:l,ariaLabel:m,...q},N){const E=v.useRef(null),j=typeof window<"u"?s.default.useLayoutEffect:s.default.useEffect;v.useImperativeHandle(N,()=>E.current),v.useEffect(()=>{T.warnIfElementNotRegistered("ui-button","Button")},[]),v.useEffect(()=>{const t=E.current;if(!t||!r)return;const c=O=>r(O);return t.addEventListener("click",c),()=>t.removeEventListener("click",c)},[r]),j(()=>{const t=E.current;if(!t)return;e(t,"variant",A),o&&o!=="md"?e(t,"size",o):t.removeAttribute("size"),e(t,"icon",B);const c=d||(a?"loading":"idle");c==="idle"?t.removeAttribute("state"):e(t,"state",c),p(t,"loading",!!a),p(t,"block",!!g),p(t,"headless",!!x),p(t,"disabled",!!R),e(t,"animation",w),i&&i!=="default"?e(t,"theme",i):t.removeAttribute("theme"),e(t,"tone",S),l&&l!=="button"?e(t,"type",l):t.removeAttribute("type"),b!==void 0&&e(t,"loading-label",b),m!==void 0&&e(t,"aria-label",m),e(t,"recipe",_),e(t,"radius",f!=null?String(f):void 0),f==="full"?t.style.setProperty("--ui-btn-radius","999px"):t.style.removeProperty("--ui-btn-radius"),e(t,"scale",y)},[A,o,_,f,y,B,a,d,g,x,R,w,i,S,l,b,m]);const D={ref:E,...q,variant:A,size:o&&o!=="md"?o:void 0,recipe:_,radius:f!=null?String(f):void 0,scale:y,icon:B,animation:w,tone:S,type:l&&l!=="button"?l:void 0,loading:a?"":void 0,block:g?"":void 0,headless:x?"":void 0,disabled:R?"":void 0,theme:i&&i!=="default"?i:void 0,state:d&&d!=="idle"?d:void 0,"loading-label":b,"aria-label":m},H=M==null?null:s.default.createElement("span",{slot:"prefix","aria-hidden":"true"},M),I=h==null?null:s.default.createElement("span",{slot:"suffix","aria-hidden":"true"},h);return s.default.createElement("ui-button",D,H,n,I)});P.displayName="Button";exports.Button=P;exports.default=P;
|
package/dist/Button.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
2
|
+
import s, { useRef as F, useImperativeHandle as G, useEffect as N } from "react";
|
|
3
3
|
import { w as J } from "./_internals-68620b0c.mjs";
|
|
4
|
-
function
|
|
4
|
+
function p(f, u, r) {
|
|
5
5
|
if (r == null || !r) {
|
|
6
6
|
f.removeAttribute(u);
|
|
7
7
|
return;
|
|
@@ -15,69 +15,69 @@ function e(f, u, r) {
|
|
|
15
15
|
}
|
|
16
16
|
f.setAttribute(u, r);
|
|
17
17
|
}
|
|
18
|
-
const K =
|
|
18
|
+
const K = s.forwardRef(function({
|
|
19
19
|
children: u,
|
|
20
20
|
onClick: r,
|
|
21
|
-
variant:
|
|
21
|
+
variant: A,
|
|
22
22
|
size: o,
|
|
23
|
-
recipe:
|
|
24
|
-
radius:
|
|
25
|
-
scale:
|
|
26
|
-
icon:
|
|
27
|
-
startIcon:
|
|
28
|
-
endIcon:
|
|
23
|
+
recipe: E,
|
|
24
|
+
radius: l,
|
|
25
|
+
scale: x,
|
|
26
|
+
icon: w,
|
|
27
|
+
startIcon: P,
|
|
28
|
+
endIcon: h,
|
|
29
29
|
loading: v,
|
|
30
30
|
loadingLabel: m,
|
|
31
|
-
state:
|
|
32
|
-
tone:
|
|
33
|
-
block:
|
|
34
|
-
headless:
|
|
35
|
-
disabled:
|
|
36
|
-
animation:
|
|
37
|
-
theme:
|
|
38
|
-
type:
|
|
31
|
+
state: d,
|
|
32
|
+
tone: y,
|
|
33
|
+
block: B,
|
|
34
|
+
headless: R,
|
|
35
|
+
disabled: S,
|
|
36
|
+
animation: g,
|
|
37
|
+
theme: i,
|
|
38
|
+
type: n,
|
|
39
39
|
ariaLabel: b,
|
|
40
|
-
...
|
|
41
|
-
},
|
|
42
|
-
const a = F(null),
|
|
43
|
-
G(
|
|
40
|
+
..._
|
|
41
|
+
}, H) {
|
|
42
|
+
const a = F(null), I = typeof window < "u" ? s.useLayoutEffect : s.useEffect;
|
|
43
|
+
G(H, () => a.current), N(() => {
|
|
44
44
|
J("ui-button", "Button");
|
|
45
|
-
}, []),
|
|
45
|
+
}, []), N(() => {
|
|
46
46
|
const t = a.current;
|
|
47
47
|
if (!t || !r)
|
|
48
48
|
return;
|
|
49
49
|
const c = (D) => r(D);
|
|
50
50
|
return t.addEventListener("click", c), () => t.removeEventListener("click", c);
|
|
51
|
-
}, [r]),
|
|
51
|
+
}, [r]), I(() => {
|
|
52
52
|
const t = a.current;
|
|
53
53
|
if (!t)
|
|
54
54
|
return;
|
|
55
|
-
e(t, "variant",
|
|
56
|
-
const c =
|
|
57
|
-
c === "idle" ? t.removeAttribute("state") : e(t, "state", c),
|
|
58
|
-
}, [
|
|
55
|
+
e(t, "variant", A), o && o !== "md" ? e(t, "size", o) : t.removeAttribute("size"), e(t, "icon", w);
|
|
56
|
+
const c = d || (v ? "loading" : "idle");
|
|
57
|
+
c === "idle" ? t.removeAttribute("state") : e(t, "state", c), p(t, "loading", !!v), p(t, "block", !!B), p(t, "headless", !!R), p(t, "disabled", !!S), e(t, "animation", g), i && i !== "default" ? e(t, "theme", i) : t.removeAttribute("theme"), e(t, "tone", y), n && n !== "button" ? e(t, "type", n) : t.removeAttribute("type"), m !== void 0 && e(t, "loading-label", m), b !== void 0 && e(t, "aria-label", b), e(t, "recipe", E), e(t, "radius", l != null ? String(l) : void 0), l === "full" ? t.style.setProperty("--ui-btn-radius", "999px") : t.style.removeProperty("--ui-btn-radius"), e(t, "scale", x);
|
|
58
|
+
}, [A, o, E, l, x, w, v, d, B, R, S, g, i, y, n, m, b]);
|
|
59
59
|
const j = {
|
|
60
60
|
ref: a,
|
|
61
|
-
...
|
|
62
|
-
variant:
|
|
61
|
+
..._,
|
|
62
|
+
variant: A,
|
|
63
63
|
size: o && o !== "md" ? o : void 0,
|
|
64
|
-
recipe:
|
|
65
|
-
radius:
|
|
66
|
-
scale:
|
|
67
|
-
icon:
|
|
68
|
-
animation:
|
|
69
|
-
tone:
|
|
70
|
-
type:
|
|
64
|
+
recipe: E,
|
|
65
|
+
radius: l != null ? String(l) : void 0,
|
|
66
|
+
scale: x,
|
|
67
|
+
icon: w,
|
|
68
|
+
animation: g,
|
|
69
|
+
tone: y,
|
|
70
|
+
type: n && n !== "button" ? n : void 0,
|
|
71
71
|
loading: v ? "" : void 0,
|
|
72
|
-
block:
|
|
73
|
-
headless:
|
|
74
|
-
disabled:
|
|
75
|
-
theme:
|
|
76
|
-
state:
|
|
72
|
+
block: B ? "" : void 0,
|
|
73
|
+
headless: R ? "" : void 0,
|
|
74
|
+
disabled: S ? "" : void 0,
|
|
75
|
+
theme: i && i !== "default" ? i : void 0,
|
|
76
|
+
state: d && d !== "idle" ? d : void 0,
|
|
77
77
|
"loading-label": m,
|
|
78
78
|
"aria-label": b
|
|
79
|
-
}, k =
|
|
80
|
-
return
|
|
79
|
+
}, k = P == null ? null : s.createElement("span", { slot: "prefix", "aria-hidden": "true" }, P), q = h == null ? null : s.createElement("span", { slot: "suffix", "aria-hidden": "true" }, h);
|
|
80
|
+
return s.createElement("ui-button", j, k, u, q);
|
|
81
81
|
});
|
|
82
82
|
K.displayName = "Button";
|
|
83
83
|
export {
|