@editora/ui-react 0.1.14 → 0.1.16

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
@@ -1,11 +1,16 @@
1
1
  # @editora/ui-react
2
2
 
3
+ [![Version](https://img.shields.io/npm/v/@editora/ui-react)](https://www.npmjs.com/package/@editora/ui-react)
4
+ [![License](https://img.shields.io/npm/l/@editora/ui-react)](https://github.com/ajaykr089/Editora/blob/main/LICENSE)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
6
+ [![Size](https://img.shields.io/bundlephobia/minzip/@editora/ui-react)](https://bundlephobia.com/package/@editora/ui-react)
3
7
 
4
8
  ![Editora UI Components](../../images/editora-ui-components-linkedin-graphic.png)
5
9
 
6
10
  ## Demos
7
11
 
8
- - **CodeSandbox:** https://qjr47y-5173.csb.app/button
12
+ - **CodeSandbox:** https://codesandbox.io/p/github/ajaykr089/editora-codesandbox/main
13
+ - **CodeSandboxUI Components:** https://qjr47y-5173.csb.app/button
9
14
  - **UI Component Catalog:** https://editora-ecosystem.netlify.app/
10
15
  - **Web Demo:** https://editora-free.netlify.app/
11
16
  - **Storybook:** https://editora-ecosystem-storybook.netlify.app/
@@ -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},f=k(v);function A(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 h=f.default.forwardRef(function({children:n,onClick:r,variant:_,size:o,recipe:p,radius:d,scale:B,icon:S,startIcon:q,endIcon:y,loading:a,loadingLabel:b,state:s,tone:g,block:R,headless:w,disabled:x,animation:M,theme:i,type:l,ariaLabel:m,...N},P){const E=v.useRef(null),j=typeof window<"u"?f.default.useLayoutEffect:f.default.useEffect;v.useImperativeHandle(P,()=>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",_),o&&o!=="md"?e(t,"size",o):t.removeAttribute("size"),e(t,"icon",S);const c=s||(a?"loading":"idle");c==="idle"?t.removeAttribute("state"):e(t,"state",c),A(t,"loading",!!a),A(t,"block",!!R),A(t,"headless",!!w),A(t,"disabled",!!x),e(t,"animation",M),i&&i!=="default"?e(t,"theme",i):t.removeAttribute("theme"),e(t,"tone",g),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",p),e(t,"radius",d!=null?String(d):void 0),e(t,"scale",B)},[_,o,p,d,B,S,a,s,R,w,x,M,i,g,l,b,m]);const D={ref:E,...N,variant:_,size:o&&o!=="md"?o:void 0,recipe:p,radius:d!=null?String(d):void 0,scale:B,icon:S,animation:M,tone:g,type:l&&l!=="button"?l:void 0,loading:a?"":void 0,block:R?"":void 0,headless:w?"":void 0,disabled:x?"":void 0,theme:i&&i!=="default"?i:void 0,state:s&&s!=="idle"?s:void 0,"loading-label":b,"aria-label":m},H=q==null?null:f.default.createElement("span",{slot:"prefix","aria-hidden":"true"},q),I=y==null?null:f.default.createElement("span",{slot:"suffix","aria-hidden":"true"},y);return f.default.createElement("ui-button",D,H,n,I)});h.displayName="Button";exports.Button=h;exports.default=h;
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;
@@ -1,7 +1,7 @@
1
1
  'use client';
2
- import l, { useRef as F, useImperativeHandle as G, useEffect as y } from "react";
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 A(f, u, r) {
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 = l.forwardRef(function({
18
+ const K = s.forwardRef(function({
19
19
  children: u,
20
20
  onClick: r,
21
- variant: E,
21
+ variant: A,
22
22
  size: o,
23
- recipe: p,
24
- radius: d,
25
- scale: w,
26
- icon: x,
27
- startIcon: N,
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: s,
32
- tone: B,
33
- block: R,
34
- headless: S,
35
- disabled: g,
36
- animation: h,
37
- theme: n,
38
- type: i,
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
- ...H
41
- }, I) {
42
- const a = F(null), P = typeof window < "u" ? l.useLayoutEffect : l.useEffect;
43
- G(I, () => a.current), y(() => {
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
- }, []), y(() => {
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]), P(() => {
51
+ }, [r]), I(() => {
52
52
  const t = a.current;
53
53
  if (!t)
54
54
  return;
55
- e(t, "variant", E), o && o !== "md" ? e(t, "size", o) : t.removeAttribute("size"), e(t, "icon", x);
56
- const c = s || (v ? "loading" : "idle");
57
- c === "idle" ? t.removeAttribute("state") : e(t, "state", c), A(t, "loading", !!v), A(t, "block", !!R), A(t, "headless", !!S), A(t, "disabled", !!g), e(t, "animation", h), n && n !== "default" ? e(t, "theme", n) : t.removeAttribute("theme"), e(t, "tone", B), i && i !== "button" ? e(t, "type", i) : t.removeAttribute("type"), m !== void 0 && e(t, "loading-label", m), b !== void 0 && e(t, "aria-label", b), e(t, "recipe", p), e(t, "radius", d != null ? String(d) : void 0), e(t, "scale", w);
58
- }, [E, o, p, d, w, x, v, s, R, S, g, h, n, B, i, m, b]);
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
- ...H,
62
- variant: E,
61
+ ..._,
62
+ variant: A,
63
63
  size: o && o !== "md" ? o : void 0,
64
- recipe: p,
65
- radius: d != null ? String(d) : void 0,
66
- scale: w,
67
- icon: x,
68
- animation: h,
69
- tone: B,
70
- type: i && i !== "button" ? i : void 0,
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: R ? "" : void 0,
73
- headless: S ? "" : void 0,
74
- disabled: g ? "" : void 0,
75
- theme: n && n !== "default" ? n : void 0,
76
- state: s && s !== "idle" ? s : void 0,
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 = N == null ? null : l.createElement("span", { slot: "prefix", "aria-hidden": "true" }, N), q = _ == null ? null : l.createElement("span", { slot: "suffix", "aria-hidden": "true" }, _);
80
- return l.createElement("ui-button", j, k, u, q);
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 {