hans-ui-design-lib 0.0.50 → 0.0.52

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/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react");var v={exports:{}},a={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react");var h={exports:{}},a={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var p;function R(){if(p)return a;p=1;var i=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function o(u,e,r){var n=null;if(r!==void 0&&(n=""+r),e.key!==void 0&&(n=""+e.key),"key"in e){r={};for(var s in e)s!=="key"&&(r[s]=e[s])}else r=e;return e=r.ref,{$$typeof:i,type:u,key:n,ref:e!==void 0?e:null,props:r}}return a.Fragment=t,a.jsx=o,a.jsxs=o,a}var x;function E(){return x||(x=1,v.exports=R()),v.exports}var m=E();const f=c.memo(i=>{const{label:t="",size:o="medium",color:u="primary",variant:e="default",buttonType:r="button",customClasses:n="",disabled:s=!1,children:d,...l}=i;return m.jsx("button",{type:r,disabled:s,className:`hans-button hans-button-${o} hans-button-${u} hans-button-${e} ${n}`,...l,children:d??(t&&m.jsx("span",{children:t}))})});f.displayName="HansButton";const q={Fa:()=>Promise.resolve().then(()=>require("./index-B8vGj59Y.cjs")),Md:()=>Promise.resolve().then(()=>require("./index-BniI3q7_.cjs")),Bi:()=>Promise.resolve().then(()=>require("./index-CzJEuaAC.cjs")),Ai:()=>Promise.resolve().then(()=>require("./index-DpGEmQKf.cjs")),Bs:()=>Promise.resolve().then(()=>require("./index-DOM24eP1.cjs")),Io:()=>Promise.resolve().then(()=>require("./index-DqJAPiPg.cjs")),Ri:()=>Promise.resolve().then(()=>require("./index-Cg9EwHiA.cjs")),Hi:()=>Promise.resolve().then(()=>require("./index-Cd4f2LU9.cjs")),Pi:()=>Promise.resolve().then(()=>require("./index-DgzbVFqs.cjs")),Tb:()=>Promise.resolve().then(()=>require("./index-BMJKTS9q.cjs")),Lu:()=>Promise.resolve().then(()=>require("./index-CsmLabva.cjs"))},P=c.memo(i=>{const{name:t,size:o="medium",customClasses:u="",...e}=i,[r,n]=c.useState(null);return c.useEffect(()=>{let s=!0;if(!t)return;const d=t.slice(0,2),l=q[d];if(l)return(async()=>{try{const h=await l();if(!s)return;n(()=>h[t]||null)}catch(h){console.warn(`[HansUI] Error loading icon ${t}:`,h),s&&n(()=>null)}})(),()=>{s=!1}},[t]),r?m.jsx(r,{className:`hans-icon hans-icon-${o} ${u}`,...e}):m.jsx("span",{className:"hans-icon-loading"})});P.displayName="HansIcon";exports.DynamicIconImports=q;exports.HansButton=f;exports.HansIcon=P;
9
+ */var v;function R(){if(v)return a;v=1;var o=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function i(u,e,r){var n=null;if(r!==void 0&&(n=""+r),e.key!==void 0&&(n=""+e.key),"key"in e){r={};for(var t in e)t!=="key"&&(r[t]=e[t])}else r=e;return e=r.ref,{$$typeof:o,type:u,key:n,ref:e!==void 0?e:null,props:r}}return a.Fragment=s,a.jsx=i,a.jsxs=i,a}var f;function b(){return f||(f=1,h.exports=R()),h.exports}var m=b();const P=l.memo(o=>{const{label:s="",size:i="medium",color:u="primary",variant:e="default",buttonType:r="button",customClasses:n="",disabled:t=!1,children:p,...c}=o;return m.jsx("button",{type:r,disabled:t,className:`hans-button hans-button-${i} hans-button-${u} hans-button-${e} ${n}`,...c,children:p??(s&&m.jsx("span",{children:s}))})});P.displayName="HansButton";function x(o){return Object.keys(o)}const H={name:"string",size:{type:"custom",ref:{}},customClasses:"string"},I=x(H),q={Fa:()=>Promise.resolve().then(()=>require("./index-B8vGj59Y.cjs")),Md:()=>Promise.resolve().then(()=>require("./index-BniI3q7_.cjs")),Bi:()=>Promise.resolve().then(()=>require("./index-CzJEuaAC.cjs")),Ai:()=>Promise.resolve().then(()=>require("./index-DpGEmQKf.cjs")),Bs:()=>Promise.resolve().then(()=>require("./index-DOM24eP1.cjs")),Io:()=>Promise.resolve().then(()=>require("./index-DqJAPiPg.cjs")),Ri:()=>Promise.resolve().then(()=>require("./index-Cg9EwHiA.cjs")),Hi:()=>Promise.resolve().then(()=>require("./index-Cd4f2LU9.cjs")),Pi:()=>Promise.resolve().then(()=>require("./index-DgzbVFqs.cjs")),Tb:()=>Promise.resolve().then(()=>require("./index-BMJKTS9q.cjs")),Lu:()=>Promise.resolve().then(()=>require("./index-CsmLabva.cjs"))},y=l.memo(o=>{const{name:s,size:i="medium",customClasses:u="",...e}=o,[r,n]=l.useState(null);return l.useEffect(()=>{let t=!0;if(!s)return;const p=s.slice(0,2),c=q[p];if(c)return(async()=>{try{const d=await c();if(!t)return;n(()=>d[s]||null)}catch(d){console.warn(`[HansUI] Error loading icon ${s}:`,d),t&&n(()=>null)}})(),()=>{t=!1}},[s]),r?m.jsx(r,{className:`hans-icon hans-icon-${i} ${u}`,...e}):m.jsx("span",{className:"hans-icon-loading"})});y.displayName="HansIcon";const j={label:"string",size:{type:"custom",ref:{}},color:{type:"custom",ref:{}},variant:{type:"custom",ref:{}},buttonType:{type:"custom",ref:{}},customClasses:"string",disabled:"boolean",children:"node"},E=x(j);exports.DynamicIconImports=q;exports.HansButton=P;exports.HansButtonPropsList=E;exports.HansIcon=y;exports.HansIconPropsList=I;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { default as default_2 } from '../../../../node_modules/react';
2
- import { default as default_3 } from '../../../node_modules/react';
2
+ import { default as default_3 } from '../../node_modules/react';
3
+ import { default as default_4 } from '../../../node_modules/react';
3
4
  import { JSX } from 'react/jsx-runtime';
4
5
 
5
- export declare type ButtonType = 'button' | 'submit' | 'reset';
6
+ declare type ButtonType = 'button' | 'submit' | 'reset';
6
7
 
7
8
  declare type Color = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
8
9
 
@@ -10,24 +11,61 @@ export declare const DynamicIconImports: Record<string, () => Promise<IconLibrar
10
11
 
11
12
  export declare const HansButton: default_2.MemoExoticComponent<(props: HansButtonProps) => JSX.Element>;
12
13
 
13
- export declare interface HansButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
14
- label?: string;
15
- size?: Size;
16
- color?: Color;
17
- variant?: Variant;
18
- buttonType?: ButtonType;
19
- customClasses?: string;
20
- }
14
+ export declare type HansButtonProps = InferPropsFromSchema<typeof HansButtonSchema> & default_2.ButtonHTMLAttributes<HTMLButtonElement>;
21
15
 
22
- export declare const HansIcon: default_3.FC<HansIconProps>;
16
+ export declare const HansButtonPropsList: ("children" | "label" | "size" | "color" | "variant" | "buttonType" | "customClasses" | "disabled")[];
23
17
 
24
- export declare interface HansIconProps {
25
- name?: string;
26
- size?: Size;
27
- customClasses?: string;
28
- }
18
+ declare const HansButtonSchema: {
19
+ readonly label: "string";
20
+ readonly size: {
21
+ readonly type: "custom";
22
+ readonly ref: Size;
23
+ };
24
+ readonly color: {
25
+ readonly type: "custom";
26
+ readonly ref: Color;
27
+ };
28
+ readonly variant: {
29
+ readonly type: "custom";
30
+ readonly ref: Variant;
31
+ };
32
+ readonly buttonType: {
33
+ readonly type: "custom";
34
+ readonly ref: ButtonType;
35
+ };
36
+ readonly customClasses: "string";
37
+ readonly disabled: "boolean";
38
+ readonly children: "node";
39
+ };
29
40
 
30
- export declare type IconLibrary = Record<string, default_3.ComponentType<default_3.SVGProps<SVGSVGElement>>>;
41
+ export declare const HansIcon: default_4.FC<HansIconProps>;
42
+
43
+ export declare type HansIconProps = InferPropsFromSchema<typeof HansIconSchema>;
44
+
45
+ export declare const HansIconPropsList: ("size" | "customClasses" | "name")[];
46
+
47
+ declare const HansIconSchema: {
48
+ readonly name: "string";
49
+ readonly size: {
50
+ readonly type: "custom";
51
+ readonly ref: Size;
52
+ };
53
+ readonly customClasses: "string";
54
+ };
55
+
56
+ declare type IconLibrary = Record<string, default_4.ComponentType<default_4.SVGProps<SVGSVGElement>>>;
57
+
58
+ declare type InferPropsFromSchema<T extends Record<string, SchemaType>> = {
59
+ [K in keyof T]: T[K] extends 'string' ? string : T[K] extends 'boolean' ? boolean : T[K] extends 'number' ? number : T[K] extends 'node' ? default_3.ReactNode : T[K] extends 'json' ? Record<string, unknown> : T[K] extends {
60
+ type: 'custom';
61
+ ref: infer U;
62
+ } ? U : never;
63
+ };
64
+
65
+ declare type SchemaType = 'string' | 'boolean' | 'number' | 'node' | 'json' | {
66
+ type: 'custom';
67
+ ref: unknown;
68
+ };
31
69
 
32
70
  declare type Size = 'small' | 'medium' | 'large';
33
71
 
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import m from "react";
2
- var x = { exports: {} }, u = {};
2
+ var f = { exports: {} }, u = {};
3
3
  /**
4
4
  * @license React
5
5
  * react-jsx-runtime.production.js
@@ -9,58 +9,65 @@ var x = { exports: {} }, u = {};
9
9
  * This source code is licensed under the MIT license found in the
10
10
  * LICENSE file in the root directory of this source tree.
11
11
  */
12
- var f;
13
- function h() {
14
- if (f) return u;
15
- f = 1;
16
- var i = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
17
- function o(a, t, r) {
18
- var s = null;
19
- if (r !== void 0 && (s = "" + r), t.key !== void 0 && (s = "" + t.key), "key" in t) {
20
- r = {};
21
- for (var e in t)
22
- e !== "key" && (r[e] = t[e]);
23
- } else r = t;
24
- return t = r.ref, {
25
- $$typeof: i,
12
+ var x;
13
+ function v() {
14
+ if (x) return u;
15
+ x = 1;
16
+ var o = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
17
+ function i(a, t, s) {
18
+ var e = null;
19
+ if (s !== void 0 && (e = "" + s), t.key !== void 0 && (e = "" + t.key), "key" in t) {
20
+ s = {};
21
+ for (var r in t)
22
+ r !== "key" && (s[r] = t[r]);
23
+ } else s = t;
24
+ return t = s.ref, {
25
+ $$typeof: o,
26
26
  type: a,
27
- key: s,
27
+ key: e,
28
28
  ref: t !== void 0 ? t : null,
29
- props: r
29
+ props: s
30
30
  };
31
31
  }
32
- return u.Fragment = n, u.jsx = o, u.jsxs = o, u;
32
+ return u.Fragment = n, u.jsx = i, u.jsxs = i, u;
33
33
  }
34
- var R;
35
- function v() {
36
- return R || (R = 1, x.exports = h()), x.exports;
34
+ var h;
35
+ function y() {
36
+ return h || (h = 1, f.exports = v()), f.exports;
37
37
  }
38
- var c = v();
39
- const E = m.memo((i) => {
38
+ var l = y();
39
+ const b = m.memo((o) => {
40
40
  const {
41
41
  label: n = "",
42
- size: o = "medium",
42
+ size: i = "medium",
43
43
  color: a = "primary",
44
44
  variant: t = "default",
45
- buttonType: r = "button",
46
- customClasses: s = "",
47
- disabled: e = !1,
45
+ buttonType: s = "button",
46
+ customClasses: e = "",
47
+ disabled: r = !1,
48
48
  children: p,
49
- ...l
50
- } = i;
51
- return /* @__PURE__ */ c.jsx(
49
+ ...c
50
+ } = o;
51
+ return /* @__PURE__ */ l.jsx(
52
52
  "button",
53
53
  {
54
- type: r,
55
- disabled: e,
56
- className: `hans-button hans-button-${o} hans-button-${a} hans-button-${t} ${s}`,
57
- ...l,
58
- children: p ?? (n && /* @__PURE__ */ c.jsx("span", { children: n }))
54
+ type: s,
55
+ disabled: r,
56
+ className: `hans-button hans-button-${i} hans-button-${a} hans-button-${t} ${e}`,
57
+ ...c,
58
+ children: p ?? (n && /* @__PURE__ */ l.jsx("span", { children: n }))
59
59
  }
60
60
  );
61
61
  });
62
- E.displayName = "HansButton";
63
- const j = {
62
+ b.displayName = "HansButton";
63
+ function R(o) {
64
+ return Object.keys(o);
65
+ }
66
+ const E = {
67
+ name: "string",
68
+ size: { type: "custom", ref: {} },
69
+ customClasses: "string"
70
+ }, $ = R(E), j = {
64
71
  Fa: () => import("./index-CuLnU-aI.js"),
65
72
  Md: () => import("./index-D5QBazti.js"),
66
73
  Bi: () => import("./index-Cru_aeJC.js"),
@@ -72,37 +79,49 @@ const j = {
72
79
  Pi: () => import("./index-CraOMhSg.js"),
73
80
  Tb: () => import("./index-C_w14lJB.js"),
74
81
  Lu: () => import("./index-HCQwBvMc.js")
75
- }, $ = m.memo(
76
- (i) => {
77
- const { name: n, size: o = "medium", customClasses: a = "", ...t } = i, [r, s] = m.useState(null);
82
+ }, H = m.memo(
83
+ (o) => {
84
+ const { name: n, size: i = "medium", customClasses: a = "", ...t } = o, [s, e] = m.useState(null);
78
85
  return m.useEffect(() => {
79
- let e = !0;
86
+ let r = !0;
80
87
  if (!n) return;
81
- const p = n.slice(0, 2), l = j[p];
82
- if (l)
88
+ const p = n.slice(0, 2), c = j[p];
89
+ if (c)
83
90
  return (async () => {
84
91
  try {
85
- const d = await l();
86
- if (!e) return;
87
- s(() => d[n] || null);
92
+ const d = await c();
93
+ if (!r) return;
94
+ e(() => d[n] || null);
88
95
  } catch (d) {
89
- console.warn(`[HansUI] Error loading icon ${n}:`, d), e && s(() => null);
96
+ console.warn(`[HansUI] Error loading icon ${n}:`, d), r && e(() => null);
90
97
  }
91
98
  })(), () => {
92
- e = !1;
99
+ r = !1;
93
100
  };
94
- }, [n]), r ? /* @__PURE__ */ c.jsx(
95
- r,
101
+ }, [n]), s ? /* @__PURE__ */ l.jsx(
102
+ s,
96
103
  {
97
- className: `hans-icon hans-icon-${o} ${a}`,
104
+ className: `hans-icon hans-icon-${i} ${a}`,
98
105
  ...t
99
106
  }
100
- ) : /* @__PURE__ */ c.jsx("span", { className: "hans-icon-loading" });
107
+ ) : /* @__PURE__ */ l.jsx("span", { className: "hans-icon-loading" });
101
108
  }
102
109
  );
103
- $.displayName = "HansIcon";
110
+ H.displayName = "HansIcon";
111
+ const I = {
112
+ label: "string",
113
+ size: { type: "custom", ref: {} },
114
+ color: { type: "custom", ref: {} },
115
+ variant: { type: "custom", ref: {} },
116
+ buttonType: { type: "custom", ref: {} },
117
+ customClasses: "string",
118
+ disabled: "boolean",
119
+ children: "node"
120
+ }, C = R(I);
104
121
  export {
105
122
  j as DynamicIconImports,
106
- E as HansButton,
107
- $ as HansIcon
123
+ b as HansButton,
124
+ C as HansButtonPropsList,
125
+ H as HansIcon,
126
+ $ as HansIconPropsList
108
127
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "hans-ui-design-lib",
3
3
  "description": "UI Design System Base Lib",
4
4
  "author": "Victor Hanszman",
5
- "version": "0.0.50",
5
+ "version": "0.0.52",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.cjs.js",