@sito/dashboard 0.0.73 → 0.0.75

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 (59) hide show
  1. package/dist/Badge-DSSlox-y.cjs +1 -0
  2. package/dist/Badge-DW9i2Rh6.js +10 -0
  3. package/dist/Badge.cjs +1 -1
  4. package/dist/Badge.js +1 -1
  5. package/dist/Button-BxyXUUMe.cjs +1 -0
  6. package/dist/Button-C6icqzyN.js +25 -0
  7. package/dist/Button.cjs +1 -1
  8. package/dist/Button.js +1 -1
  9. package/dist/Chip-6bEZ7uwv.js +43 -0
  10. package/dist/Chip-N4r2Xf9l.cjs +1 -0
  11. package/dist/Chip.cjs +1 -1
  12. package/dist/Chip.js +1 -1
  13. package/dist/FileInput-C7ZYKt_i.js +100 -0
  14. package/dist/FileInput-Cz2R3z3k.cjs +1 -0
  15. package/dist/Form.cjs +1 -1
  16. package/dist/Form.js +2 -2
  17. package/dist/{IconButton-BpsTEj0z.js → IconButton-CqPk_OXG.js} +9 -8
  18. package/dist/IconButton-DVZCHIHB.cjs +1 -0
  19. package/dist/IconButton.cjs +1 -1
  20. package/dist/IconButton.js +1 -1
  21. package/dist/Loading-BTwXNOEv.js +27 -0
  22. package/dist/Loading-C70yH2dC.cjs +1 -0
  23. package/dist/Loading.cjs +1 -1
  24. package/dist/Loading.js +1 -1
  25. package/dist/SelectInput--rJuMO4C.cjs +1 -0
  26. package/dist/SelectInput-2oVsA3EU.js +567 -0
  27. package/dist/{Table-BiqQ3QxX.js → Table-BfD01_pj.js} +311 -281
  28. package/dist/Table-CDjW3u13.cjs +1 -0
  29. package/dist/Table.cjs +1 -1
  30. package/dist/Table.js +1 -1
  31. package/dist/Tooltip-B7LXJBLs.cjs +1 -0
  32. package/dist/Tooltip-p-nQtZ5Y.js +38 -0
  33. package/dist/Tooltip.cjs +1 -1
  34. package/dist/Tooltip.js +1 -1
  35. package/dist/classNames-DDRjbGA1.js +20 -0
  36. package/dist/classNames-DHAzUjfZ.cjs +1 -0
  37. package/dist/index.cjs +1 -1
  38. package/dist/index.js +76 -74
  39. package/dist/lib/classNames.d.ts +7 -0
  40. package/dist/lib/index.d.ts +1 -0
  41. package/dist/lib.cjs +1 -1
  42. package/dist/lib.js +4 -2
  43. package/package.json +1 -1
  44. package/dist/Badge-CIeYthEy.js +0 -9
  45. package/dist/Badge-Z78MlGoQ.cjs +0 -1
  46. package/dist/Button-BlYa3uPc.cjs +0 -1
  47. package/dist/Button-D73-swfo.js +0 -24
  48. package/dist/Chip-C5ogKbFn.js +0 -37
  49. package/dist/Chip-D17UJHW6.cjs +0 -1
  50. package/dist/FileInput-CqzVk1gQ.cjs +0 -1
  51. package/dist/FileInput-Cr4TxWUg.js +0 -93
  52. package/dist/IconButton-CVnmT2E9.cjs +0 -1
  53. package/dist/Loading-B_c_4XLr.js +0 -26
  54. package/dist/Loading-CNECRan-.cjs +0 -1
  55. package/dist/SelectInput-B9EEu-h1.cjs +0 -1
  56. package/dist/SelectInput-H421nC22.js +0 -525
  57. package/dist/Table-Bfq-ASnl.cjs +0 -1
  58. package/dist/Tooltip-B4E-FRwY.js +0 -37
  59. package/dist/Tooltip-BSKAgRkc.cjs +0 -1
@@ -0,0 +1 @@
1
+ var r=require("./Badge.css");const c=require("react/jsx-runtime"),n=require("./classNames-DHAzUjfZ.cjs"),t=s=>{const{count:e,className:a=""}=s;return c.jsx("span",{className:n.classNames("badge-main",a),children:e})};exports.Badge=t;
@@ -0,0 +1,10 @@
1
+ import "./Badge.css";
2
+ import { jsx as o } from "react/jsx-runtime";
3
+ import { c as r } from "./classNames-DDRjbGA1.js";
4
+ const n = (s) => {
5
+ const { count: a, className: m = "" } = s;
6
+ return /* @__PURE__ */ o("span", { className: r("badge-main", m), children: a });
7
+ };
8
+ export {
9
+ n as B
10
+ };
package/dist/Badge.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Badge-Z78MlGoQ.cjs");exports.Badge=e.Badge;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Badge-DSSlox-y.cjs");exports.Badge=e.Badge;
package/dist/Badge.js CHANGED
@@ -1,4 +1,4 @@
1
- import { B as o } from "./Badge-CIeYthEy.js";
1
+ import { B as o } from "./Badge-DW9i2Rh6.js";
2
2
  export {
3
3
  o as Badge
4
4
  };
@@ -0,0 +1 @@
1
+ var l=require("./Button.css");const c=require("react/jsx-runtime"),u=require("./classNames-DHAzUjfZ.cjs"),i=t=>{const{children:s,type:e="button",variant:n="text",color:o="default",className:r="",...a}=t;return c.jsx("button",{type:e,className:u.classNames("button",n,o,r),...a,children:s})};exports.Button=i;
@@ -0,0 +1,25 @@
1
+ import "./Button.css";
2
+ import { jsx as c } from "react/jsx-runtime";
3
+ import { c as m } from "./classNames-DDRjbGA1.js";
4
+ const p = (t) => {
5
+ const {
6
+ children: o,
7
+ type: s = "button",
8
+ variant: r = "text",
9
+ color: a = "default",
10
+ className: e = "",
11
+ ...n
12
+ } = t;
13
+ return /* @__PURE__ */ c(
14
+ "button",
15
+ {
16
+ type: s,
17
+ className: m("button", r, a, e),
18
+ ...n,
19
+ children: o
20
+ }
21
+ );
22
+ };
23
+ export {
24
+ p as B
25
+ };
package/dist/Button.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./Button-BlYa3uPc.cjs");exports.Button=t.Button;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./Button-BxyXUUMe.cjs");exports.Button=t.Button;
package/dist/Button.js CHANGED
@@ -1,4 +1,4 @@
1
- import { B as r } from "./Button-D73-swfo.js";
1
+ import { B as r } from "./Button-C6icqzyN.js";
2
2
  export {
3
3
  r as Button
4
4
  };
@@ -0,0 +1,43 @@
1
+ import "./Chip.css";
2
+ import { jsxs as p, jsx as a } from "react/jsx-runtime";
3
+ import { c as s } from "./classNames-DDRjbGA1.js";
4
+ import { C as d } from "./Close-rKC9AcNX.js";
5
+ import { I as h } from "./IconButton-CqPk_OXG.js";
6
+ function b(t) {
7
+ const {
8
+ text: i,
9
+ onDelete: e,
10
+ children: o,
11
+ icon: n,
12
+ variant: c = "default",
13
+ iconClassName: l = "",
14
+ className: m = "",
15
+ textClassName: r = ""
16
+ } = t;
17
+ return /* @__PURE__ */ p(
18
+ "div",
19
+ {
20
+ className: s(
21
+ "chip-main",
22
+ c,
23
+ e ? "deletable" : "",
24
+ m
25
+ ),
26
+ children: [
27
+ /* @__PURE__ */ a("span", { className: s("chip-main-text", r), children: i }),
28
+ o,
29
+ e ? /* @__PURE__ */ a(
30
+ h,
31
+ {
32
+ icon: n ?? /* @__PURE__ */ a(d, {}),
33
+ className: s("chip-delete-button", l),
34
+ onClick: e
35
+ }
36
+ ) : null
37
+ ]
38
+ }
39
+ );
40
+ }
41
+ export {
42
+ b as C
43
+ };
@@ -0,0 +1 @@
1
+ var x=require("./Chip.css");const s=require("react/jsx-runtime"),t=require("./classNames-DHAzUjfZ.cjs"),u=require("./Close-O9P7wJGf.cjs"),N=require("./IconButton-DVZCHIHB.cjs");function h(a){const{text:c,onDelete:e,children:n,icon:i,variant:l="default",iconClassName:o="",className:r="",textClassName:m=""}=a;return s.jsxs("div",{className:t.classNames("chip-main",l,e?"deletable":"",r),children:[s.jsx("span",{className:t.classNames("chip-main-text",m),children:c}),n,e?s.jsx(N.IconButton,{icon:i??s.jsx(u.Close,{}),className:t.classNames("chip-delete-button",o),onClick:e}):null]})}exports.Chip=h;
package/dist/Chip.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Chip-D17UJHW6.cjs");exports.Chip=e.Chip;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Chip-N4r2Xf9l.cjs");exports.Chip=e.Chip;
package/dist/Chip.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as r } from "./Chip-C5ogKbFn.js";
1
+ import { C as r } from "./Chip-6bEZ7uwv.js";
2
2
  export {
3
3
  r as Chip
4
4
  };
@@ -0,0 +1,100 @@
1
+ import "./FileInput.css";
2
+ import { jsxs as N, jsx as l } from "react/jsx-runtime";
3
+ import { c as r } from "./classNames-DDRjbGA1.js";
4
+ import { forwardRef as $, useState as q, useCallback as p } from "react";
5
+ import { T as v } from "./Tooltip-p-nQtZ5Y.js";
6
+ import { F as A } from "./File-BuJndWMv.js";
7
+ import { C as B } from "./Chip-6bEZ7uwv.js";
8
+ import { I as D } from "./IconButton-CqPk_OXG.js";
9
+ import { C as M } from "./Close-rKC9AcNX.js";
10
+ function F(t, i = 25) {
11
+ if (t.length <= i) return t;
12
+ const a = t.lastIndexOf(".");
13
+ if (a === -1)
14
+ return t.slice(0, i - 3) + "...";
15
+ const f = t.slice(0, a), o = t.slice(a), d = i - o.length - 3;
16
+ return f.slice(0, d) + "..." + o;
17
+ }
18
+ const Q = $(function(t, i) {
19
+ const {
20
+ children: a,
21
+ label: f,
22
+ containerClassName: o = "",
23
+ inputClassName: d = "",
24
+ labelClassName: b = "",
25
+ helperText: g = "",
26
+ helperTextClassName: I = "",
27
+ iconClassName: w = "",
28
+ multiple: h = !1,
29
+ onChange: x,
30
+ onClear: c,
31
+ ...u
32
+ } = t, [n, C] = q([]), T = p(
33
+ (e) => {
34
+ if (e.target.files) {
35
+ const s = Array.from(e.target.files);
36
+ C(
37
+ (m) => h ? [...m, ...s] : s.slice(0, 1)
38
+ );
39
+ }
40
+ x?.(e);
41
+ },
42
+ [h, x]
43
+ ), k = p(
44
+ (e) => {
45
+ C((s) => {
46
+ const m = s.filter((O, R) => R !== e);
47
+ return m.length === 0 && c?.(), m;
48
+ });
49
+ },
50
+ [c]
51
+ ), y = p(() => {
52
+ C([]), c?.();
53
+ }, [c]), j = p(
54
+ (e) => {
55
+ e.currentTarget.value = "";
56
+ },
57
+ []
58
+ );
59
+ return /* @__PURE__ */ N("div", { className: r("file-input-container", o), children: [
60
+ n.length === 0 && /* @__PURE__ */ N("label", { htmlFor: u.id, className: r(b), children: [
61
+ f,
62
+ /* @__PURE__ */ l(
63
+ "input",
64
+ {
65
+ type: "file",
66
+ ref: i,
67
+ multiple: h,
68
+ onClick: j,
69
+ onChange: T,
70
+ className: r("file-input", d),
71
+ ...u
72
+ }
73
+ ),
74
+ u.required ? " *" : ""
75
+ ] }),
76
+ n.length > 1 && /* @__PURE__ */ l("ul", { className: "file-preview-list", children: n.map((e, s) => /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l(v, { content: e.name, children: /* @__PURE__ */ l(
77
+ B,
78
+ {
79
+ text: F(e.name, 25),
80
+ onDelete: () => k(s)
81
+ }
82
+ ) }) }, `${e.name}-${e.lastModified}`)) }),
83
+ n.length === 1 && /* @__PURE__ */ N("div", { className: "file-preview", children: [
84
+ /* @__PURE__ */ l(A, { className: r("file-icon", w) }),
85
+ /* @__PURE__ */ l(v, { content: n[0]?.name ?? "", children: /* @__PURE__ */ l("span", { className: "file-preview-name", children: F(n[0]?.name ?? "", 25) }) }),
86
+ /* @__PURE__ */ l(D, { icon: /* @__PURE__ */ l(M, {}), onClick: y, type: "button" })
87
+ ] }),
88
+ a,
89
+ !!g && /* @__PURE__ */ l(
90
+ "p",
91
+ {
92
+ className: r("file-input-helper-text", I),
93
+ children: g
94
+ }
95
+ )
96
+ ] });
97
+ });
98
+ export {
99
+ Q as F
100
+ };
@@ -0,0 +1 @@
1
+ var M=require("./FileInput.css");const e=require("react/jsx-runtime"),r=require("./classNames-DHAzUjfZ.cjs"),i=require("react"),j=require("./Tooltip-B7LXJBLs.cjs"),y=require("./File-_Hjw2d3F.cjs"),R=require("./Chip-N4r2Xf9l.cjs"),B=require("./IconButton-DVZCHIHB.cjs"),$=require("./Close-O9P7wJGf.cjs");function g(l,a=25){if(l.length<=a)return l;const c=l.lastIndexOf(".");if(c===-1)return l.slice(0,a-3)+"...";const d=l.slice(0,c),o=l.slice(c),m=a-o.length-3;return d.slice(0,m)+"..."+o}const A=i.forwardRef(function(l,a){const{children:c,label:d,containerClassName:o="",inputClassName:m="",labelClassName:b="",helperText:C="",helperTextClassName:q="",iconClassName:k="",multiple:p=!1,onChange:N,onClear:u,...f}=l,[t,x]=i.useState([]),v=i.useCallback(s=>{if(s.target.files){const n=Array.from(s.target.files);x(h=>p?[...h,...n]:n.slice(0,1))}N?.(s)},[p,N]),F=i.useCallback(s=>{x(n=>{const h=n.filter((D,w)=>w!==s);return h.length===0&&u?.(),h})},[u]),I=i.useCallback(()=>{x([]),u?.()},[u]),T=i.useCallback(s=>{s.currentTarget.value=""},[]);return e.jsxs("div",{className:r.classNames("file-input-container",o),children:[t.length===0&&e.jsxs("label",{htmlFor:f.id,className:r.classNames(b),children:[d,e.jsx("input",{type:"file",ref:a,multiple:p,onClick:T,onChange:v,className:r.classNames("file-input",m),...f}),f.required?" *":""]}),t.length>1&&e.jsx("ul",{className:"file-preview-list",children:t.map((s,n)=>e.jsx("li",{children:e.jsx(j.Tooltip,{content:s.name,children:e.jsx(R.Chip,{text:g(s.name,25),onDelete:()=>F(n)})})},`${s.name}-${s.lastModified}`))}),t.length===1&&e.jsxs("div",{className:"file-preview",children:[e.jsx(y.File,{className:r.classNames("file-icon",k)}),e.jsx(j.Tooltip,{content:t[0]?.name??"",children:e.jsx("span",{className:"file-preview-name",children:g(t[0]?.name??"",25)})}),e.jsx(B.IconButton,{icon:e.jsx($.Close,{}),onClick:I,type:"button"})]}),c,!!C&&e.jsx("p",{className:r.classNames("file-input-helper-text",q),children:C})]})});exports.FileInput=A;
package/dist/Form.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./SelectInput-B9EEu-h1.cjs"),t=require("./FileInput-CqzVk1gQ.cjs");exports.AutocompleteInput=e.AutocompleteInput;exports.CheckInput=e.CheckInput;exports.SelectInput=e.SelectInput;exports.State=e.State;exports.TextInput=e.TextInput;exports.helperTextStateClassName=e.helperTextStateClassName;exports.inputStateClassName=e.inputStateClassName;exports.labelStateClassName=e.labelStateClassName;exports.FileInput=t.FileInput;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./SelectInput--rJuMO4C.cjs"),t=require("./FileInput-Cz2R3z3k.cjs");exports.AutocompleteInput=e.AutocompleteInput;exports.CheckInput=e.CheckInput;exports.SelectInput=e.SelectInput;exports.State=e.State;exports.TextInput=e.TextInput;exports.helperTextStateClassName=e.helperTextStateClassName;exports.inputStateClassName=e.inputStateClassName;exports.labelStateClassName=e.labelStateClassName;exports.FileInput=t.FileInput;
package/dist/Form.js CHANGED
@@ -1,5 +1,5 @@
1
- import { A as e, C as s, S as l, a as p, T as u, h as m, i as n, l as o } from "./SelectInput-H421nC22.js";
2
- import { F as r } from "./FileInput-Cr4TxWUg.js";
1
+ import { A as e, C as s, S as l, a as p, T as u, h as m, i as n, l as o } from "./SelectInput-2oVsA3EU.js";
2
+ import { F as r } from "./FileInput-C7ZYKt_i.js";
3
3
  export {
4
4
  e as AutocompleteInput,
5
5
  s as CheckInput,
@@ -1,11 +1,12 @@
1
1
  import "./IconButton.css";
2
2
  import { jsxs as l, jsx as m } from "react/jsx-runtime";
3
- const d = (t) => {
3
+ import { c as p } from "./classNames-DDRjbGA1.js";
4
+ const x = (t) => {
4
5
  const {
5
- children: n,
6
+ children: s,
6
7
  icon: o,
7
- type: s = "button",
8
- className: a = "",
8
+ type: a = "button",
9
+ className: n = "",
9
10
  variant: c = "text",
10
11
  color: e = "default",
11
12
  iconClassName: r = "",
@@ -14,16 +15,16 @@ const d = (t) => {
14
15
  return /* @__PURE__ */ l(
15
16
  "button",
16
17
  {
17
- type: s,
18
- className: `icon-button ${a} ${c} ${e}`,
18
+ type: a,
19
+ className: p("icon-button", n, c, e),
19
20
  ...i,
20
21
  children: [
21
22
  /* @__PURE__ */ m("span", { className: r, children: o }),
22
- n
23
+ s
23
24
  ]
24
25
  }
25
26
  );
26
27
  };
27
28
  export {
28
- d as I
29
+ x as I
29
30
  };
@@ -0,0 +1 @@
1
+ var N=require("./IconButton.css");const s=require("react/jsx-runtime"),u=require("./classNames-DHAzUjfZ.cjs"),m=t=>{const{children:n,icon:e,type:c="button",className:o="",variant:a="text",color:r="default",iconClassName:i="",...l}=t;return s.jsxs("button",{type:c,className:u.classNames("icon-button",o,a,r),...l,children:[s.jsx("span",{className:i,children:e}),n]})};exports.IconButton=m;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./IconButton-CVnmT2E9.cjs");exports.IconButton=t.IconButton;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./IconButton-DVZCHIHB.cjs");exports.IconButton=t.IconButton;
@@ -1,4 +1,4 @@
1
- import { I as n } from "./IconButton-BpsTEj0z.js";
1
+ import { I as n } from "./IconButton-CqPk_OXG.js";
2
2
  export {
3
3
  n as IconButton
4
4
  };
@@ -0,0 +1,27 @@
1
+ import "./Loading.css";
2
+ import { jsx as e } from "react/jsx-runtime";
3
+ import { c as r } from "./classNames-DDRjbGA1.js";
4
+ function m(s) {
5
+ const {
6
+ color: a = "stroke-blue-800",
7
+ className: l = "",
8
+ loaderClass: c = "",
9
+ strokeWidth: i = "4",
10
+ ...o
11
+ } = s;
12
+ return /* @__PURE__ */ e("div", { ...o, className: r("loading", l), children: /* @__PURE__ */ e("div", { className: "loader-container", children: /* @__PURE__ */ e("div", { className: r("loader", c), children: /* @__PURE__ */ e("svg", { className: "circular", viewBox: "25 25 50 50", children: /* @__PURE__ */ e(
13
+ "circle",
14
+ {
15
+ className: r("path", a),
16
+ cx: "50",
17
+ cy: "50",
18
+ r: "20",
19
+ fill: "none",
20
+ strokeWidth: i,
21
+ strokeMiterlimit: "10"
22
+ }
23
+ ) }) }) }) });
24
+ }
25
+ export {
26
+ m as L
27
+ };
@@ -0,0 +1 @@
1
+ var t=require("./Loading.css");const s=require("react/jsx-runtime"),e=require("./classNames-DHAzUjfZ.cjs");function n(a){const{color:c="stroke-blue-800",className:l="",loaderClass:r="",strokeWidth:i="4",...o}=a;return s.jsx("div",{...o,className:e.classNames("loading",l),children:s.jsx("div",{className:"loader-container",children:s.jsx("div",{className:e.classNames("loader",r),children:s.jsx("svg",{className:"circular",viewBox:"25 25 50 50",children:s.jsx("circle",{className:e.classNames("path",c),cx:"50",cy:"50",r:"20",fill:"none",strokeWidth:i,strokeMiterlimit:"10"})})})})})}exports.Loading=n;
package/dist/Loading.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Loading-CNECRan-.cjs");exports.Loading=e.Loading;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Loading-C70yH2dC.cjs");exports.Loading=e.Loading;
package/dist/Loading.js CHANGED
@@ -1,4 +1,4 @@
1
- import { L as r } from "./Loading-B_c_4XLr.js";
1
+ import { L as r } from "./Loading-BTwXNOEv.js";
2
2
  export {
3
3
  r as Loading
4
4
  };
@@ -0,0 +1 @@
1
+ var Y=require("./SelectInput.css");const s=require("react/jsx-runtime"),o=require("./classNames-DHAzUjfZ.cjs"),l=require("react"),U=require("./Chip-N4r2Xf9l.cjs"),z=require("./IconButton-DVZCHIHB.cjs"),G=require("./Close-O9P7wJGf.cjs"),J=l.forwardRef(function(r,f){const{state:g,value:t,onChange:n,options:v=[],name:S="",id:w="",label:y="",containerClassName:A="",inputContainerClassName:b="",helperText:I="",placeholder:T="",multiple:p=!1,...D}=r,[c,x]=l.useState("");l.useEffect(()=>{if(!p&&t&&!Array.isArray(t)){x(String(t.value??t.name??""));return}x("")},[p,t]);const[N,C]=l.useState(!1),[j,k]=l.useState(-1),i=l.useMemo(()=>v.filter(e=>{const a=String(e.value??e.name).toLowerCase().includes(c?.toLowerCase());return Array.isArray(t)&&t.length?a&&!t.some(d=>d.id===e.id):t&&!Array.isArray(t)?a&&t.id!==e.id:a}),[v,t,c]);l.useEffect(()=>{if(!N||!i.length){k(-1);return}k(0)},[N,i]);const u=l.useRef(null),m=l.useRef(null),[L,E]=l.useState(!1),h=l.useRef(null);l.useEffect(()=>{const e=d=>{u.current&&!u.current.contains(d.target)&&C(!1)},a=d=>{d.key==="Escape"&&C(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",a)}},[]);const O=l.useCallback(e=>{x(e.target.value)},[]),R=l.useCallback(e=>{e?p?(x(""),Array.isArray(t)&&t.length?n([...t,e]):n([e])):(x(String(e.name??e.value??"")),n(e)):n(null),C(!1)},[p,n,t]),P=l.useCallback(e=>{if(!i.length){e.key==="Escape"&&C(!1);return}if(e.key==="ArrowDown"||e.key==="ArrowUp"){if(e.preventDefault(),!N){C(!0),k(0);return}k(a=>{const d=a>=0?a:0;return e.key==="ArrowDown"?(d+1+i.length)%i.length:(d-1+i.length)%i.length});return}if(e.key==="Enter"&&N){e.preventDefault();const a=j>=0?j:0;R(i[a]);return}e.key==="Escape"&&N&&(e.preventDefault(),C(!1))},[R,j,N,i]),F=l.useCallback(e=>{if(!Array.isArray(t)){n(null);return}const a=t.filter((d,M)=>M!==e);a.length?n(a):n(null)},[n,t]),K=l.useCallback(()=>{Array.isArray(t)&&n([t[0]])},[n,t]);return l.useLayoutEffect(()=>{const e=h.current?.offsetWidth??0,a=u.current?.offsetWidth??0;E(e>a*.4)},[t]),s.jsxs("div",{className:o.classNames("autocomplete-input-container",A),ref:u,children:[s.jsxs("div",{className:"autocomplete-value-input-container",children:[s.jsx(V,{state:g,name:S,id:w,value:c,onChange:O,placeholder:T,helperText:I,onFocus:()=>C(!0),onKeyDown:P,label:y,containerClassName:o.classNames("autocomplete-text-input",b),ref:f??m,...D,children:!p&&t&&!Array.isArray(t)&&(t.value||t.name)&&s.jsx(z.IconButton,{icon:s.jsx(G.Close,{}),className:"autocomplete-delete-button",onClick:e=>{R(),e.stopPropagation()}})}),p&&Array.isArray(t)&&t.length?s.jsx("ul",{ref:h,className:"autocomplete-value-container",children:L?s.jsxs(s.Fragment,{children:[s.jsx("li",{children:s.jsx(U.Chip,{text:t[0]?.value??t[0]?.name,onDelete:e=>{F(0),e.stopPropagation()}})}),t.length>1&&s.jsx("li",{children:s.jsx(U.Chip,{text:`+${t.length-1}`,onDelete:e=>{K(),e.stopPropagation()}})})]}):t.map((e,a)=>s.jsx("li",{children:s.jsx(U.Chip,{text:String(e.value??e.name),onDelete:d=>{F(a),d.stopPropagation()}})},e.id??e.value??e.name))}):null]}),N&&s.jsx("ul",{className:"autocomplete-suggestions-container",style:{width:u.current?.offsetWidth},children:i.map(e=>s.jsx("li",{className:o.classNames("autocomplete-suggestion-item",e.id===i[j]?.id?"highlighted":""),onMouseEnter:()=>k(i.findIndex(a=>a.id===e.id)),onClick:a=>{R(e),a.stopPropagation()},children:e.value??e.name},e.id??e.value??e.name))})]})});var q=(r=>(r.error="error",r.good="good",r.default="default",r))(q||{});const B=r=>{switch(r){case"error":return"input-error";case"good":return"input-good";default:return"input-normal"}},H=r=>{switch(r){case"error":return"input-label-error";case"good":return"input-label-good";default:return"input-label-normal"}},W=r=>{switch(r){case"error":return"input-helper-text-error";case"good":return"input-helper-text-good";default:return"input-helper-text-normal"}},Q=l.forwardRef(function(r,f){const{checked:g,onChange:t,name:n="",id:v="",label:S="",state:w=q.default,containerClassName:y="",inputClassName:A="",labelClassName:b="",...I}=r;return s.jsxs("label",{className:o.classNames("input-check-container",y),children:[s.jsx("input",{id:v,ref:f,name:n,type:"checkbox",checked:g,onChange:t,className:o.classNames("input-check",B(w),A),...I}),s.jsx("span",{className:o.classNames("input-check-label",H(w),b),children:S})]})}),$=r=>r==null?!1:Array.isArray(r)?r.length>0:`${r}`.length>0,V=l.forwardRef(function(r,f){const{children:g,state:t=q.default,label:n="",containerClassName:v="",inputClassName:S="",labelClassName:w="",helperText:y="",helperTextClassName:A="",value:b,defaultValue:I,onChange:T,onFocus:p,onBlur:D,...c}=r,x=b!==void 0,[N,C]=l.useState(()=>$(I)),j=x?$(b):N,k=c.type==="date",i=!!c.placeholder||k,u=m=>{x||C(m.currentTarget.value.length>0),T?.(m)};return s.jsxs("div",{className:o.classNames("text-input-container",v),children:[s.jsx("input",{ref:f,defaultValue:I,onChange:u,onFocus:p,onBlur:D,...x?{value:b}:{},className:o.classNames("text-input",B(t),S,j?"has-value":"",c.placeholder?"has-placeholder":"",i?"keep-label-up":""),...c}),!!n&&s.jsxs("label",{htmlFor:c.id,className:o.classNames("text-input-label",H(t),w),children:[n,c.required?" *":""]}),g,!!y&&s.jsx("p",{className:o.classNames("text-input-helper-text",W(t),A),children:y})]})}),X=l.forwardRef(function(r,f){const{value:g,onChange:t,options:n,containerClassName:v="",inputClassName:S="",labelClassName:w="",helperText:y="",helperTextClassName:A="",label:b="",placeholder:I="",name:T="",id:p="",state:D=q.default,native:c=!0,disabled:x,required:N,autoFocus:C,children:j,...k}=r,i=l.useRef(null),[u,m]=l.useState(!1),[L,E]=l.useState(-1),h=l.useMemo(()=>n.findIndex(e=>String(e.id)===String(g??n[0]?.id??"")),[n,g]),O=l.useMemo(()=>h>=0?n[h]:void 0,[n,h]);l.useEffect(()=>{if(!(c||!u)){if(!n.length){E(-1);return}E(h>=0?h:0)}},[c,n.length,h,u]),l.useEffect(()=>{if(c)return;const e=a=>{i.current&&!i.current.contains(a.target)&&m(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[c]);const R=l.useCallback(e=>{f&&(typeof f=="function"?f(e):f.current=e)},[f]),P=l.useCallback(e=>{if(!t)return;const a={target:{value:String(e)},currentTarget:{value:String(e)}};t(a)},[t]),F=l.useCallback(e=>{const a=n[e];a&&(P(a.id),m(!1))},[P,n]),K=l.useCallback(e=>{if(n.length){if(e.key==="ArrowDown"||e.key==="ArrowUp"){if(e.preventDefault(),!u){m(!0);const a=h>=0?h:0;E(a);return}E(a=>{const d=a>=0?a:h;return e.key==="ArrowDown"?(d+1+n.length)%n.length:(d-1+n.length)%n.length});return}if(e.key==="Enter"){if(!u){e.preventDefault(),m(!0),E(h>=0?h:0);return}e.preventDefault(),F(L>=0?L:0);return}e.key==="Escape"&&u&&(e.preventDefault(),m(!1))}},[L,n,F,h,u]);return c?s.jsxs("div",{className:o.classNames("select-input-container",v),children:[s.jsx("select",{...k,id:p,ref:R,name:T,value:g,onChange:t,className:o.classNames("select-input",B(D),"peer",S),children:n?.map(e=>s.jsx("option",{value:e.id,children:e.value??e.name??e.id},e.id))}),s.jsx("label",{htmlFor:p,className:o.classNames("select-input-label",H(D),w),children:b}),j,y&&s.jsx("p",{className:o.classNames("select-input-helper-text",W(D),A),children:y})]}):s.jsxs("div",{ref:i,className:o.classNames("select-input-container",v),children:[s.jsx("select",{...k,ref:R,name:T,id:p,value:g,onChange:t,className:"select-input-native-hidden",tabIndex:-1,"aria-hidden":!0,children:n?.map(e=>s.jsx("option",{value:e.id,children:e.value??e.name??e.id},e.id))}),s.jsx(V,{id:p,name:T,state:D,value:String(O?.value??O?.name??""),readOnly:!0,label:b,helperText:y,containerClassName:"select-input-text-container",inputClassName:o.classNames("select-input-text",S),labelClassName:w,helperTextClassName:A,placeholder:I,disabled:x,required:N,autoFocus:C,onClick:()=>m(e=>!e),onKeyDown:K,onFocus:()=>m(!0),role:"combobox","aria-expanded":u,"aria-haspopup":"listbox",children:j}),u&&s.jsx("ul",{className:"select-input-options-container",role:"listbox",children:n.map((e,a)=>{const d=String(e.id)===String(g),M=a===L;return s.jsx("li",{role:"option","aria-selected":d,className:o.classNames("select-input-option-item",M?"highlighted":""),onMouseEnter:()=>E(a),onClick:_=>{F(a),_.stopPropagation()},children:e.value??e.name??e.id},e.id)})})]})});exports.AutocompleteInput=J;exports.CheckInput=Q;exports.SelectInput=X;exports.State=q;exports.TextInput=V;exports.helperTextStateClassName=W;exports.inputStateClassName=B;exports.labelStateClassName=H;