@sito/dashboard 0.0.69 → 0.0.71

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 (55) hide show
  1. package/dist/{FiltersProvider-BoCTMqk8.js → FiltersProvider-BV023mmu.js} +1 -1
  2. package/dist/{FiltersProvider-Bxge43VS.cjs → FiltersProvider-DVMj0LV0.cjs} +1 -1
  3. package/dist/FiltersProvider.cjs +1 -1
  4. package/dist/FiltersProvider.js +1 -1
  5. package/dist/Form.cjs +1 -1
  6. package/dist/Form.js +1 -1
  7. package/dist/SelectInput-B0Ffd39D.js +525 -0
  8. package/dist/SelectInput-j7riQ8_P.cjs +1 -0
  9. package/dist/{TextInput.css → SelectInput.css} +1 -1
  10. package/dist/SvgIcons.cjs +1 -1
  11. package/dist/SvgIcons.js +11 -9
  12. package/dist/Table-B_Jbnu1-.js +1184 -0
  13. package/dist/Table-BnZYZLy_.cjs +1 -0
  14. package/dist/Table.cjs +1 -1
  15. package/dist/Table.css +1 -1
  16. package/dist/Table.js +9 -8
  17. package/dist/TableColumns-BjTNomZf.cjs +1 -0
  18. package/dist/{Filters-DL5jd8ps.js → TableColumns-CIddkosX.js} +37 -9
  19. package/dist/TableOptions.cjs +1 -1
  20. package/dist/TableOptions.js +1 -1
  21. package/dist/TableOptionsProvider-BgnISoXx.js +120 -0
  22. package/dist/TableOptionsProvider-i4uVLLwH.cjs +1 -0
  23. package/dist/components/Form/CheckInput/types.d.ts +1 -1
  24. package/dist/components/Form/FileInput/types.d.ts +2 -2
  25. package/dist/components/Form/SelectInput/types.d.ts +2 -1
  26. package/dist/components/Form/TextInput/types.d.ts +1 -1
  27. package/dist/components/Form/types.d.ts +2 -1
  28. package/dist/components/SvgIcons/BarsStaggered.d.ts +7 -0
  29. package/dist/components/SvgIcons/ChevronDown.d.ts +1 -1
  30. package/dist/components/SvgIcons/ChevronLeft.d.ts +1 -1
  31. package/dist/components/SvgIcons/ChevronRight.d.ts +1 -1
  32. package/dist/components/SvgIcons/ChevronUp.d.ts +1 -1
  33. package/dist/components/SvgIcons/Close.d.ts +1 -1
  34. package/dist/components/SvgIcons/Ellipsis.d.ts +1 -1
  35. package/dist/components/SvgIcons/File.d.ts +1 -1
  36. package/dist/components/SvgIcons/Filters.d.ts +1 -1
  37. package/dist/components/SvgIcons/TableColumns.d.ts +7 -0
  38. package/dist/components/SvgIcons/index.d.ts +2 -0
  39. package/dist/components/Table/components/ColumnVisibilityMenu.d.ts +12 -0
  40. package/dist/components/Table/components/TableHeader/types.d.ts +2 -0
  41. package/dist/components/Table/components/index.d.ts +1 -0
  42. package/dist/components/Table/components/types.d.ts +2 -0
  43. package/dist/components/Table/utils.d.ts +2 -1
  44. package/dist/index.cjs +1 -1
  45. package/dist/index.css +1 -1
  46. package/dist/index.js +58 -55
  47. package/dist/providers/TableOptions/types.d.ts +5 -0
  48. package/package.json +1 -1
  49. package/dist/Filters-Dyee8QYH.cjs +0 -1
  50. package/dist/Table-BLhy0EYJ.cjs +0 -1
  51. package/dist/Table-CeD0yXGZ.js +0 -1113
  52. package/dist/TableOptionsProvider-BJdeNIQj.cjs +0 -1
  53. package/dist/TableOptionsProvider-DBr-FW53.js +0 -106
  54. package/dist/TextInput-C27RFuya.cjs +0 -1
  55. package/dist/TextInput-DPYxzgm3.js +0 -335
@@ -1 +0,0 @@
1
- "use strict";const N=require("react/jsx-runtime"),b=require("./query-81BrXp3i.cjs"),e=require("react"),T=[20,50,100],j=e.createContext(void 0),h=s=>{if(s===null||typeof s>"u")return!1;if(typeof s=="string")return s.trim().length>0;if(Array.isArray(s))return s.length>0;if(typeof s=="object"){const o=s;return"start"in o||"end"in o?h(o.start)||h(o.end):!0}return!0},B=s=>{const{children:o}=s,[c,A]=e.useState(0),[i,q]=e.useState(20),[C,a]=e.useState(0),[l,g]=e.useState("id"),[u,p]=e.useState(b.SortOrder.DESC),[d,f]=e.useState({}),S=e.useCallback((t,r)=>r<=0?0:Math.max(0,Math.ceil(t/r)-1),[]),m=e.useCallback(t=>{const r=Number.isFinite(t)?Math.max(0,t):0;A(r),a(n=>Math.min(n,S(r,i)))},[S,i]),M=e.useCallback(t=>{!Number.isFinite(t)||t<=0||(q(t),a(0))},[]),F=e.useCallback(t=>{if(!Number.isFinite(t))return;const r=Math.max(0,Math.floor(t));a(Math.min(r,S(c,i)))},[S,i,c]),x=e.useCallback((t,r)=>{let n=u;l===t&&(u===b.SortOrder.ASC?n=b.SortOrder.DESC:n=b.SortOrder.ASC),g(t),p(n),r&&r(t,n)},[l,u]),y=e.useCallback(t=>{const r=Object.entries(t).reduce((n,[E,O])=>(O&&h(O.value)&&(n[E]=O.value),n),{});f(r),a(0)},[]),k=e.useCallback(t=>{f(t?r=>{const n={...r};return delete n[t],n}:{}),a(0)},[f]),P=e.useMemo(()=>Object.keys(d).length,[d]),w=e.useMemo(()=>({onSort:x,total:c,setTotal:m,sortingBy:l,setSortingBy:g,sortingOrder:u,setSortingOrder:p,pageSize:i,pageSizes:T,setPageSize:M,currentPage:C,setCurrentPage:F,filters:d,onFilterApply:y,clearFilters:k,countOfFilters:P}),[x,c,m,l,g,u,p,i,T,M,C,F,d,y,k,P]);return N.jsx(j.Provider,{value:w,children:o})},D=()=>{const s=e.useContext(j);if(!s)throw new Error("tableOptionsContext must be used within a Provider");return s};exports.TableOptionsProvider=B;exports.useTableOptions=D;
@@ -1,106 +0,0 @@
1
- import { jsx as V } from "react/jsx-runtime";
2
- import { S as g } from "./query-CwuehjY1.js";
3
- import { useState as a, useCallback as s, useMemo as j, createContext as z, useContext as q } from "react";
4
- const w = [20, 50, 100], E = z(
5
- void 0
6
- ), O = (r) => {
7
- if (r === null || typeof r > "u") return !1;
8
- if (typeof r == "string")
9
- return r.trim().length > 0;
10
- if (Array.isArray(r))
11
- return r.length > 0;
12
- if (typeof r == "object") {
13
- const o = r;
14
- return "start" in o || "end" in o ? O(o.start) || O(o.end) : !0;
15
- }
16
- return !0;
17
- }, I = (r) => {
18
- const { children: o } = r, [l, N] = a(0), [i, k] = a(20), [F, c] = a(0), [f, h] = a("id"), [u, S] = a(g.DESC), [d, p] = a({}), m = s(
19
- (t, e) => e <= 0 ? 0 : Math.max(0, Math.ceil(t / e) - 1),
20
- []
21
- ), M = s(
22
- (t) => {
23
- const e = Number.isFinite(t) ? Math.max(0, t) : 0;
24
- N(e), c(
25
- (n) => Math.min(n, m(e, i))
26
- );
27
- },
28
- [m, i]
29
- ), x = s((t) => {
30
- !Number.isFinite(t) || t <= 0 || (k(t), c(0));
31
- }, []), C = s(
32
- (t) => {
33
- if (!Number.isFinite(t)) return;
34
- const e = Math.max(0, Math.floor(t));
35
- c(Math.min(e, m(l, i)));
36
- },
37
- [m, i, l]
38
- ), y = s(
39
- (t, e) => {
40
- let n = u;
41
- f === t && (u === g.ASC ? n = g.DESC : n = g.ASC), h(t), S(n), e && e(t, n);
42
- },
43
- [f, u]
44
- ), P = s((t) => {
45
- const e = Object.entries(t).reduce(
46
- (n, [D, b]) => (b && O(b.value) && (n[D] = b.value), n),
47
- {}
48
- );
49
- p(e), c(0);
50
- }, []), T = s(
51
- (t) => {
52
- p(t ? (e) => {
53
- const n = { ...e };
54
- return delete n[t], n;
55
- } : {}), c(0);
56
- },
57
- [p]
58
- ), A = j(() => Object.keys(d).length, [d]), B = j(
59
- () => ({
60
- onSort: y,
61
- total: l,
62
- setTotal: M,
63
- sortingBy: f,
64
- setSortingBy: h,
65
- sortingOrder: u,
66
- setSortingOrder: S,
67
- pageSize: i,
68
- pageSizes: w,
69
- setPageSize: x,
70
- currentPage: F,
71
- setCurrentPage: C,
72
- filters: d,
73
- onFilterApply: P,
74
- clearFilters: T,
75
- countOfFilters: A
76
- }),
77
- [
78
- y,
79
- l,
80
- M,
81
- f,
82
- h,
83
- u,
84
- S,
85
- i,
86
- w,
87
- x,
88
- F,
89
- C,
90
- d,
91
- P,
92
- T,
93
- A
94
- ]
95
- );
96
- return /* @__PURE__ */ V(E.Provider, { value: B, children: o });
97
- }, J = () => {
98
- const r = q(E);
99
- if (!r)
100
- throw new Error("tableOptionsContext must be used within a Provider");
101
- return r;
102
- };
103
- export {
104
- I as T,
105
- J as u
106
- };
@@ -1 +0,0 @@
1
- var G=require("./TextInput.css");const a=require("react/jsx-runtime"),l=require("react"),L=require("./Chip-D17UJHW6.cjs"),U=require("./IconButton-CVnmT2E9.cjs"),M=require("./Close-O9P7wJGf.cjs"),O=l.forwardRef(function(n,N){const{state:v,value:e,onChange:s,options:p=[],name:g="",id:m="",label:i="",containerClassName:j="",inputContainerClassName:d="",helperText:f="",placeholder:b="",multiple:u=!1,...y}=n,[c,r]=l.useState("");l.useEffect(()=>{if(!u&&e&&!Array.isArray(e)){r(String(e.value??e.name??""));return}r("")},[u,e]);const[T,$]=l.useState(!1),k=l.useMemo(()=>p.filter(t=>{const o=String(t.value??t.name).toLowerCase().includes(c?.toLowerCase());return Array.isArray(e)&&e.length?o&&!e.some(C=>C.id===t.id):e&&!Array.isArray(e)?o&&e.id!==t.id:o}),[p,e,c]),x=l.useRef(null),R=l.useRef(null),[F,E]=l.useState(!1),S=l.useRef(null);l.useEffect(()=>{const t=C=>{x.current&&!x.current.contains(C.target)&&$(!1)},o=C=>{C.key==="Escape"&&$(!1)};return document.addEventListener("mousedown",t),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("keydown",o)}},[]);const B=l.useCallback(t=>{r(t.target.value)},[]),h=l.useCallback(t=>{t?u?(r(""),Array.isArray(e)&&e.length?s([...e,t]):s([t])):(r(String(t.name??t.value??"")),s(t)):s(null),$(!1)},[u,s,e]),D=l.useCallback(t=>{if(!Array.isArray(e)){s(null);return}const o=e.filter((C,H)=>H!==t);o.length?s(o):s(null)},[s,e]),W=l.useCallback(()=>{Array.isArray(e)&&s([e[0]])},[s,e]);return l.useLayoutEffect(()=>{const t=S.current?.offsetWidth??0,o=x.current?.offsetWidth??0;E(t>o*.4)},[e]),a.jsxs("div",{className:`autocomplete-input-container ${j}`,ref:x,children:[a.jsxs("div",{className:"autocomplete-value-input-container",children:[a.jsx(V,{state:v,name:g,id:m,value:c,onChange:B,placeholder:b,helperText:f,onFocus:()=>$(!0),label:i,containerClassName:`autocomplete-text-input ${d}`,ref:N??R,...y,children:!u&&e&&!Array.isArray(e)&&(e.value||e.name)&&a.jsx(U.IconButton,{icon:a.jsx(M.Close,{}),className:"autocomplete-delete-button",onClick:t=>{h(),t.stopPropagation()}})}),u&&Array.isArray(e)&&e.length?a.jsx("ul",{ref:S,className:"autocomplete-value-container",children:F?a.jsxs(a.Fragment,{children:[a.jsx("li",{children:a.jsx(L.Chip,{text:e[0]?.value??e[0]?.name,onDelete:t=>{D(0),t.stopPropagation()}})}),e.length>1&&a.jsx("li",{children:a.jsx(L.Chip,{text:`+${e.length-1}`,onDelete:t=>{W(),t.stopPropagation()}})})]}):e.map((t,o)=>a.jsx("li",{children:a.jsx(L.Chip,{text:String(t.value??t.name),onDelete:C=>{D(o),C.stopPropagation()}})},t.id??t.value??t.name))}):null]}),T&&a.jsx("ul",{className:"autocomplete-suggestions-container",style:{width:x.current?.offsetWidth},children:k.map(t=>a.jsx("li",{className:"autocomplete-suggestion-item",onClick:o=>{h(t),o.stopPropagation()},children:t.value??t.name},t.id??t.value??t.name))})]})});var A=(n=>(n.error="error",n.good="good",n.default="default",n))(A||{});const w=n=>{switch(n){case"error":return"input-error";case"good":return"input-good";default:return"input-normal"}},I=n=>{switch(n){case"error":return"input-label-error";case"good":return"input-label-good";default:return"input-label-normal"}},q=n=>{switch(n){case"error":return"input-helper-text-error";case"good":return"input-helper-text-good";default:return"input-helper-text-normal"}},_=l.forwardRef(function(n,N){const{checked:v,onChange:e,name:s="",id:p="",label:g="",state:m=A.default,containerClassName:i="",inputClassName:j="",labelClassName:d="",...f}=n;return a.jsxs("label",{className:`input-check-container ${i}`,children:[a.jsx("input",{id:p,ref:N,name:s,type:"checkbox",checked:v,onChange:e,className:`input-check ${w(m)} ${j}`,...f}),a.jsx("span",{className:`input-check-label ${I(m)} ${d}`,children:g})]})}),z=l.forwardRef(function(n,N){const{value:v,onChange:e,options:s,containerClassName:p="",inputClassName:g="",labelClassName:m="",helperText:i="",helperTextClassName:j="",label:d="",name:f="",id:b="",state:u=A.default,children:y,...c}=n;return a.jsxs("div",{className:`select-input-container ${p}`,children:[a.jsx("select",{...c,id:b,ref:N,name:f,value:v,onChange:e,className:`select-input ${w(u)} peer ${g}`,children:s?.map(r=>a.jsx("option",{value:r.id,children:r.value??r.name??r.id},r.id))}),a.jsx("label",{htmlFor:b,className:`select-input-label ${I(u)} ${m}`,children:d}),y,i&&a.jsx("p",{className:`select-input-helper-text ${q(u)} ${j}`,children:i})]})}),P=n=>n==null?!1:Array.isArray(n)?n.length>0:`${n}`.length>0,V=l.forwardRef(function(n,N){const{children:v,state:e=A.default,label:s="",containerClassName:p="",inputClassName:g="",labelClassName:m="",helperText:i="",helperTextClassName:j="",value:d,defaultValue:f,onChange:b,onFocus:u,onBlur:y,...c}=n,r=d!==void 0,[T,$]=l.useState(()=>P(f)),[k,x]=l.useState(!1),R=r?P(d):T,F=!!c.placeholder||k,E=h=>{r||$(h.currentTarget.value.length>0),b?.(h)},S=h=>{k||x(!0),u?.(h)},B=h=>{k||x(!0),y?.(h)};return a.jsxs("div",{className:`text-input-container ${p}`,children:[a.jsx("input",{ref:N,defaultValue:f,onChange:E,onFocus:S,onBlur:B,...r?{value:d}:{},className:`text-input ${w(e)} ${g} ${R?"has-value":""} ${c.placeholder?"has-placeholder":""} ${F?"keep-label-up":""}`,...c}),!!s&&a.jsxs("label",{htmlFor:c.id,className:`text-input-label ${I(e)} ${m}`,children:[s,c.required?" *":""]}),v,!!i&&a.jsx("p",{className:`text-input-helper-text ${q(e)} ${j}`,children:i})]})});exports.AutocompleteInput=O;exports.CheckInput=_;exports.SelectInput=z;exports.State=A;exports.TextInput=V;exports.helperTextStateClassName=q;exports.inputStateClassName=w;exports.labelStateClassName=I;
@@ -1,335 +0,0 @@
1
- import "./TextInput.css";
2
- import { jsxs as x, jsx as n, Fragment as z } from "react/jsx-runtime";
3
- import { forwardRef as F, useState as w, useEffect as U, useMemo as G, useRef as R, useCallback as T, useLayoutEffect as J } from "react";
4
- import { C as V } from "./Chip-C5ogKbFn.js";
5
- import { I as K } from "./IconButton-BpsTEj0z.js";
6
- import { C as Q } from "./Close-rKC9AcNX.js";
7
- const le = F(function(a, N) {
8
- const {
9
- state: v,
10
- value: e,
11
- onChange: l,
12
- options: h = [],
13
- name: g = "",
14
- id: m = "",
15
- label: i = "",
16
- containerClassName: $ = "",
17
- inputContainerClassName: u = "",
18
- helperText: p = "",
19
- placeholder: y = "",
20
- multiple: o = !1,
21
- ...A
22
- } = a, [c, r] = w("");
23
- U(() => {
24
- if (!o && e && !Array.isArray(e)) {
25
- r(String(e.value ?? e.name ?? ""));
26
- return;
27
- }
28
- r("");
29
- }, [o, e]);
30
- const [E, b] = w(!1), k = G(
31
- () => h.filter((t) => {
32
- const s = String(t.value ?? t.name).toLowerCase().includes(c?.toLowerCase());
33
- return Array.isArray(e) && e.length ? s && !e.some((C) => C.id === t.id) : e && !Array.isArray(e) ? s && e.id !== t.id : s;
34
- }),
35
- [h, e, c]
36
- ), f = R(null), L = R(null), [B, D] = w(!1), S = R(null);
37
- U(() => {
38
- const t = (C) => {
39
- f.current && !f.current.contains(C.target) && b(!1);
40
- }, s = (C) => {
41
- C.key === "Escape" && b(!1);
42
- };
43
- return document.addEventListener("mousedown", t), document.addEventListener("keydown", s), () => {
44
- document.removeEventListener("mousedown", t), document.removeEventListener("keydown", s);
45
- };
46
- }, []);
47
- const P = T((t) => {
48
- r(t.target.value);
49
- }, []), d = T(
50
- (t) => {
51
- t ? o ? (r(""), Array.isArray(e) && e.length ? l([...e, t]) : l([t])) : (r(String(t.name ?? t.value ?? "")), l(t)) : l(null), b(!1);
52
- },
53
- [o, l, e]
54
- ), j = T(
55
- (t) => {
56
- if (!Array.isArray(e)) {
57
- l(null);
58
- return;
59
- }
60
- const s = e.filter((C, _) => _ !== t);
61
- s.length ? l(s) : l(null);
62
- },
63
- [l, e]
64
- ), O = T(() => {
65
- Array.isArray(e) && l([e[0]]);
66
- }, [l, e]);
67
- return J(() => {
68
- const t = S.current?.offsetWidth ?? 0, s = f.current?.offsetWidth ?? 0;
69
- D(t > s * 0.4);
70
- }, [e]), /* @__PURE__ */ x(
71
- "div",
72
- {
73
- className: `autocomplete-input-container ${$}`,
74
- ref: f,
75
- children: [
76
- /* @__PURE__ */ x("div", { className: "autocomplete-value-input-container", children: [
77
- /* @__PURE__ */ n(
78
- X,
79
- {
80
- state: v,
81
- name: g,
82
- id: m,
83
- value: c,
84
- onChange: P,
85
- placeholder: y,
86
- helperText: p,
87
- onFocus: () => b(!0),
88
- label: i,
89
- containerClassName: `autocomplete-text-input ${u}`,
90
- ref: N ?? L,
91
- ...A,
92
- children: !o && e && !Array.isArray(e) && (e.value || e.name) && /* @__PURE__ */ n(
93
- K,
94
- {
95
- icon: /* @__PURE__ */ n(Q, {}),
96
- className: "autocomplete-delete-button",
97
- onClick: (t) => {
98
- d(), t.stopPropagation();
99
- }
100
- }
101
- )
102
- }
103
- ),
104
- o && Array.isArray(e) && e.length ? /* @__PURE__ */ n("ul", { ref: S, className: "autocomplete-value-container", children: B ? /* @__PURE__ */ x(z, { children: [
105
- /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
106
- V,
107
- {
108
- text: e[0]?.value ?? e[0]?.name,
109
- onDelete: (t) => {
110
- j(0), t.stopPropagation();
111
- }
112
- }
113
- ) }),
114
- e.length > 1 && /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
115
- V,
116
- {
117
- text: `+${e.length - 1}`,
118
- onDelete: (t) => {
119
- O(), t.stopPropagation();
120
- }
121
- }
122
- ) })
123
- ] }) : e.map((t, s) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
124
- V,
125
- {
126
- text: String(t.value ?? t.name),
127
- onDelete: (C) => {
128
- j(s), C.stopPropagation();
129
- }
130
- }
131
- ) }, t.id ?? t.value ?? t.name)) }) : null
132
- ] }),
133
- E && /* @__PURE__ */ n(
134
- "ul",
135
- {
136
- className: "autocomplete-suggestions-container",
137
- style: { width: f.current?.offsetWidth },
138
- children: k.map((t) => /* @__PURE__ */ n(
139
- "li",
140
- {
141
- className: "autocomplete-suggestion-item",
142
- onClick: (s) => {
143
- d(t), s.stopPropagation();
144
- },
145
- children: t.value ?? t.name
146
- },
147
- t.id ?? t.value ?? t.name
148
- ))
149
- }
150
- )
151
- ]
152
- }
153
- );
154
- });
155
- var I = /* @__PURE__ */ ((a) => (a.error = "error", a.good = "good", a.default = "default", a))(I || {});
156
- const W = (a) => {
157
- switch (a) {
158
- case "error":
159
- return "input-error";
160
- case "good":
161
- return "input-good";
162
- default:
163
- return "input-normal";
164
- }
165
- }, H = (a) => {
166
- switch (a) {
167
- case "error":
168
- return "input-label-error";
169
- case "good":
170
- return "input-label-good";
171
- default:
172
- return "input-label-normal";
173
- }
174
- }, M = (a) => {
175
- switch (a) {
176
- case "error":
177
- return "input-helper-text-error";
178
- case "good":
179
- return "input-helper-text-good";
180
- default:
181
- return "input-helper-text-normal";
182
- }
183
- }, re = F(function(a, N) {
184
- const {
185
- checked: v,
186
- onChange: e,
187
- name: l = "",
188
- id: h = "",
189
- label: g = "",
190
- state: m = I.default,
191
- containerClassName: i = "",
192
- inputClassName: $ = "",
193
- labelClassName: u = "",
194
- ...p
195
- } = a;
196
- return /* @__PURE__ */ x("label", { className: `input-check-container ${i}`, children: [
197
- /* @__PURE__ */ n(
198
- "input",
199
- {
200
- id: h,
201
- ref: N,
202
- name: l,
203
- type: "checkbox",
204
- checked: v,
205
- onChange: e,
206
- className: `input-check ${W(m)} ${$}`,
207
- ...p
208
- }
209
- ),
210
- /* @__PURE__ */ n(
211
- "span",
212
- {
213
- className: `input-check-label ${H(m)} ${u}`,
214
- children: g
215
- }
216
- )
217
- ] });
218
- }), se = F(function(a, N) {
219
- const {
220
- value: v,
221
- onChange: e,
222
- options: l,
223
- containerClassName: h = "",
224
- inputClassName: g = "",
225
- labelClassName: m = "",
226
- helperText: i = "",
227
- helperTextClassName: $ = "",
228
- label: u = "",
229
- name: p = "",
230
- id: y = "",
231
- state: o = I.default,
232
- children: A,
233
- ...c
234
- } = a;
235
- return /* @__PURE__ */ x("div", { className: `select-input-container ${h}`, children: [
236
- /* @__PURE__ */ n(
237
- "select",
238
- {
239
- ...c,
240
- id: y,
241
- ref: N,
242
- name: p,
243
- value: v,
244
- onChange: e,
245
- className: `select-input ${W(o)} peer ${g}`,
246
- children: l?.map((r) => /* @__PURE__ */ n("option", { value: r.id, children: r.value ?? r.name ?? r.id }, r.id))
247
- }
248
- ),
249
- /* @__PURE__ */ n(
250
- "label",
251
- {
252
- htmlFor: y,
253
- className: `select-input-label ${H(o)} ${m}`,
254
- children: u
255
- }
256
- ),
257
- A,
258
- i && /* @__PURE__ */ n(
259
- "p",
260
- {
261
- className: `select-input-helper-text ${M(o)} ${$}`,
262
- children: i
263
- }
264
- )
265
- ] });
266
- }), q = (a) => a == null ? !1 : Array.isArray(a) ? a.length > 0 : `${a}`.length > 0, X = F(function(a, N) {
267
- const {
268
- children: v,
269
- state: e = I.default,
270
- label: l = "",
271
- containerClassName: h = "",
272
- inputClassName: g = "",
273
- labelClassName: m = "",
274
- helperText: i = "",
275
- helperTextClassName: $ = "",
276
- value: u,
277
- defaultValue: p,
278
- onChange: y,
279
- onFocus: o,
280
- onBlur: A,
281
- ...c
282
- } = a, r = u !== void 0, [E, b] = w(
283
- () => q(p)
284
- ), [k, f] = w(!1), L = r ? q(u) : E, B = !!c.placeholder || k, D = (d) => {
285
- r || b(d.currentTarget.value.length > 0), y?.(d);
286
- }, S = (d) => {
287
- k || f(!0), o?.(d);
288
- }, P = (d) => {
289
- k || f(!0), A?.(d);
290
- };
291
- return /* @__PURE__ */ x("div", { className: `text-input-container ${h}`, children: [
292
- /* @__PURE__ */ n(
293
- "input",
294
- {
295
- ref: N,
296
- defaultValue: p,
297
- onChange: D,
298
- onFocus: S,
299
- onBlur: P,
300
- ...r ? { value: u } : {},
301
- className: `text-input ${W(e)} ${g} ${L ? "has-value" : ""} ${c.placeholder ? "has-placeholder" : ""} ${B ? "keep-label-up" : ""}`,
302
- ...c
303
- }
304
- ),
305
- !!l && /* @__PURE__ */ x(
306
- "label",
307
- {
308
- htmlFor: c.id,
309
- className: `text-input-label ${H(e)} ${m}`,
310
- children: [
311
- l,
312
- c.required ? " *" : ""
313
- ]
314
- }
315
- ),
316
- v,
317
- !!i && /* @__PURE__ */ n(
318
- "p",
319
- {
320
- className: `text-input-helper-text ${M(e)} ${$}`,
321
- children: i
322
- }
323
- )
324
- ] });
325
- });
326
- export {
327
- le as A,
328
- re as C,
329
- se as S,
330
- X as T,
331
- I as a,
332
- M as h,
333
- W as i,
334
- H as l
335
- };