fiboui 1.0.2 → 2.0.0
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 +138 -92
- package/dist/FineGrain-kBxv0WeR.js +29 -0
- package/dist/Link-DDzSPY1Q.js +88 -0
- package/dist/PluginManager-D5-ApsSN.js +111 -0
- package/dist/Router-i6Nc6qVs.js +386 -0
- package/dist/builder-DjLYXkXu.js +1842 -0
- package/dist/bundle-mjs-wppB-TKB.js +2760 -0
- package/dist/cli/bin.js +20 -0
- package/dist/cli/commands/generate/component.js +67 -0
- package/dist/cli/commands/generate/index.js +10 -0
- package/dist/cli/commands/generate/module.js +58 -0
- package/dist/cli/commands/generate/plugin.js +67 -0
- package/dist/cli/commands/init.js +58 -0
- package/dist/content.js +17 -0
- package/dist/core.js +33 -0
- package/dist/{effects-D16XdB_d.mjs → effects-CnevV566.js} +1 -0
- package/dist/index-B1av7e36.js +1102 -0
- package/dist/index-BQGRpkzR.js +1024 -0
- package/dist/index-CTRZRn9S.js +90 -0
- package/dist/index-DKFr-sai.js +33 -0
- package/dist/index-Dm4j2mMM.js +1031 -0
- package/dist/index-RbfIZuAo.js +119 -0
- package/dist/index-yeYkDTAx.js +778 -0
- package/dist/index.d.ts +43753 -6
- package/dist/index.js +2054 -0
- package/dist/interactive.js +12 -0
- package/dist/layout.js +18 -0
- package/dist/mount-sAVX_FBU.js +95 -0
- package/dist/navigation.js +13 -0
- package/dist/provider-B0eB-Wy7.js +286 -0
- package/dist/structure.js +15 -0
- package/dist/style.css +1 -1
- package/dist/style.js +1 -0
- package/dist/theme.js +9 -0
- package/package.json +88 -13
- package/dist/content/Alert/index.d.ts +0 -878
- package/dist/content/Avatar/index.d.ts +0 -886
- package/dist/content/Badge/index.d.ts +0 -887
- package/dist/content/Image/index.d.ts +0 -893
- package/dist/content/Label/index.d.ts +0 -879
- package/dist/content/Progress/index.d.ts +0 -898
- package/dist/content/Skeleton/index.d.ts +0 -879
- package/dist/content/Spinner/index.d.ts +0 -880
- package/dist/content/Text/index.d.ts +0 -878
- package/dist/content/index.d.ts +0 -9
- package/dist/core/StateWrapper.d.ts +0 -31
- package/dist/core/builder.d.ts +0 -58
- package/dist/core/component.d.ts +0 -7
- package/dist/core/effects.d.ts +0 -4
- package/dist/core/hooks.d.ts +0 -5
- package/dist/core/icons.d.ts +0 -11
- package/dist/core/index.d.ts +0 -6
- package/dist/core/state.d.ts +0 -86
- package/dist/core/types.d.ts +0 -51
- package/dist/demo.d.ts +0 -7
- package/dist/index.esm.js +0 -4777
- package/dist/index.umd.js +0 -251
- package/dist/interactive/Button/index.d.ts +0 -897
- package/dist/interactive/Checkbox/index.d.ts +0 -884
- package/dist/interactive/Combobox/index.d.ts +0 -898
- package/dist/interactive/RadioGroup/index.d.ts +0 -888
- package/dist/interactive/Select/index.d.ts +0 -895
- package/dist/interactive/Switch/index.d.ts +0 -881
- package/dist/interactive/TextField/index.d.ts +0 -893
- package/dist/interactive/Textarea/index.d.ts +0 -890
- package/dist/interactive/index.d.ts +0 -8
- package/dist/layout/Center/index.d.ts +0 -869
- package/dist/layout/Column/index.d.ts +0 -881
- package/dist/layout/Container/index.d.ts +0 -870
- package/dist/layout/DashboardLayout/index.d.ts +0 -870
- package/dist/layout/Header/index.d.ts +0 -870
- package/dist/layout/Line/index.d.ts +0 -872
- package/dist/layout/Row/index.d.ts +0 -879
- package/dist/layout/Scaffold/index.d.ts +0 -878
- package/dist/layout/ScrollView/index.d.ts +0 -879
- package/dist/layout/Sidebar/index.d.ts +0 -870
- package/dist/layout/Spacer/index.d.ts +0 -875
- package/dist/layout/StakentComponents.d.ts +0 -4
- package/dist/layout/index.d.ts +0 -11
- package/dist/structure/Banner/index.d.ts +0 -879
- package/dist/structure/Box/index.d.ts +0 -869
- package/dist/structure/Card/index.d.ts +0 -881
- package/dist/structure/Collapse/index.d.ts +0 -884
- package/dist/structure/Grid/index.d.ts +0 -1757
- package/dist/structure/List/index.d.ts +0 -888
- package/dist/structure/Table/index.d.ts +0 -895
- package/dist/structure/Tags/index.d.ts +0 -876
- package/dist/structure/cards/AssetCard/index.d.ts +0 -884
- package/dist/structure/cards/CollectionCard/index.d.ts +0 -880
- package/dist/structure/cards/ContentCard/index.d.ts +0 -884
- package/dist/structure/cards/ProfileCard/index.d.ts +0 -892
- package/dist/structure/cards/index.d.ts +0 -5
- package/dist/structure/cards/variants/index.d.ts +0 -3490
- package/dist/structure/index.d.ts +0 -9
- package/dist/theme/cupertino.d.ts +0 -3
- package/dist/theme/index.d.ts +0 -5
- package/dist/theme/material.d.ts +0 -3
- package/dist/theme/provider.d.ts +0 -16
- package/dist/theme/types.d.ts +0 -57
- package/dist/theme/web.d.ts +0 -3
- package/src/content/Alert/index.ts +0 -110
- package/src/content/Avatar/index.ts +0 -116
- package/src/content/Badge/index.ts +0 -162
- package/src/content/Image/index.ts +0 -137
- package/src/content/Label/index.ts +0 -66
- package/src/content/Progress/index.ts +0 -378
- package/src/content/Skeleton/index.ts +0 -71
- package/src/content/Spinner/index.ts +0 -139
- package/src/content/Text/index.ts +0 -74
- package/src/content/index.ts +0 -9
- package/src/core/StateWrapper.tsx +0 -131
- package/src/core/builder.ts +0 -301
- package/src/core/component.ts +0 -49
- package/src/core/effects.ts +0 -27
- package/src/core/hooks.ts +0 -48
- package/src/core/icons.tsx +0 -57
- package/src/core/index.ts +0 -6
- package/src/core/state.ts +0 -297
- package/src/core/types.ts +0 -62
- package/src/demo.tsx +0 -1050
- package/src/index.ts +0 -8
- package/src/interactive/Button/index.ts +0 -219
- package/src/interactive/Checkbox/index.ts +0 -145
- package/src/interactive/Combobox/index.ts +0 -278
- package/src/interactive/RadioGroup/index.ts +0 -124
- package/src/interactive/Select/index.ts +0 -227
- package/src/interactive/Switch/index.ts +0 -123
- package/src/interactive/TextField/index.ts +0 -223
- package/src/interactive/Textarea/index.ts +0 -129
- package/src/interactive/index.ts +0 -8
- package/src/layout/Center/index.ts +0 -34
- package/src/layout/Column/index.ts +0 -101
- package/src/layout/Container/index.ts +0 -28
- package/src/layout/DashboardLayout/index.ts +0 -106
- package/src/layout/Header/index.ts +0 -50
- package/src/layout/Line/index.ts +0 -41
- package/src/layout/Row/index.ts +0 -93
- package/src/layout/Scaffold/index.ts +0 -133
- package/src/layout/ScrollView/index.ts +0 -67
- package/src/layout/Sidebar/index.ts +0 -56
- package/src/layout/Spacer/index.ts +0 -46
- package/src/layout/StakentComponents.tsx +0 -57
- package/src/layout/index.ts +0 -11
- package/src/structure/Banner/index.ts +0 -92
- package/src/structure/Box/index.ts +0 -46
- package/src/structure/Card/index.ts +0 -113
- package/src/structure/Collapse/index.ts +0 -122
- package/src/structure/Grid/index.ts +0 -197
- package/src/structure/List/index.ts +0 -185
- package/src/structure/Table/index.ts +0 -165
- package/src/structure/Tags/index.ts +0 -69
- package/src/structure/cards/AssetCard/index.ts +0 -158
- package/src/structure/cards/CollectionCard/index.ts +0 -95
- package/src/structure/cards/ContentCard/index.ts +0 -127
- package/src/structure/cards/ProfileCard/index.ts +0 -152
- package/src/structure/cards/index.ts +0 -5
- package/src/structure/cards/variants/index.ts +0 -301
- package/src/structure/index.ts +0 -10
- package/src/styles/base.css +0 -186
- package/src/styles/core.css +0 -52
- package/src/styles/themes/cupertino.css +0 -197
- package/src/styles/themes/material.css +0 -322
- package/src/styles/themes/web.css +0 -196
- package/src/theme/cupertino.ts +0 -85
- package/src/theme/index.ts +0 -5
- package/src/theme/material.ts +0 -86
- package/src/theme/provider.tsx +0 -76
- package/src/theme/types.ts +0 -62
- package/src/theme/web.ts +0 -82
|
@@ -0,0 +1,1102 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var O = Object.defineProperty;
|
|
3
|
+
var P = (o, i, e) => i in o ? O(o, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[i] = e;
|
|
4
|
+
var r = (o, i, e) => P(o, typeof i != "symbol" ? i + "" : i, e);
|
|
5
|
+
import t, { useState as T, useEffect as F, useRef as M } from "react";
|
|
6
|
+
import { h as $, F as D, S as q } from "./builder-DjLYXkXu.js";
|
|
7
|
+
import { t as B } from "./bundle-mjs-wppB-TKB.js";
|
|
8
|
+
const V = t.memo((o) => {
|
|
9
|
+
const {
|
|
10
|
+
text: i,
|
|
11
|
+
variant: e,
|
|
12
|
+
size: l,
|
|
13
|
+
onPress: a,
|
|
14
|
+
disabled: s,
|
|
15
|
+
icon: d,
|
|
16
|
+
shape: u,
|
|
17
|
+
shadow: y,
|
|
18
|
+
tone: w,
|
|
19
|
+
motion: x,
|
|
20
|
+
expand: f,
|
|
21
|
+
className: k,
|
|
22
|
+
style: v,
|
|
23
|
+
...g
|
|
24
|
+
} = o, _ = {
|
|
25
|
+
xs: "px-[21px] py-[8px] text-[10px] gap-[6px] h-auto tracking-[0.12em] font-normal",
|
|
26
|
+
sm: "px-[14px] py-[6px] text-[13px] gap-[6px] h-[32px]",
|
|
27
|
+
md: "px-[22px] py-[10px] text-[15px] gap-[8px] h-[44px]",
|
|
28
|
+
lg: "px-[32px] py-[16px] text-[17px] gap-[10px] h-[56px]"
|
|
29
|
+
};
|
|
30
|
+
let m = "rounded-[14px]";
|
|
31
|
+
u === "pill" ? m = "rounded-full" : u === "square" ? m = "rounded-[12px]" : u === "rect" ? m = "rounded-[2px]" : u === "rounded" ? m = "rounded-[8px]" : u === "sharp" && (m = "rounded-none");
|
|
32
|
+
const I = w === "inverse";
|
|
33
|
+
let p = "";
|
|
34
|
+
e === "ghost" ? p = I ? "bg-transparent text-white shadow-none border border-transparent" : "bg-transparent text-gray-600 shadow-none border border-transparent hover:bg-gray-100" : e === "text" ? p = I ? "bg-transparent text-white shadow-none border-none px-2" : "bg-transparent text-gray-600 shadow-none border-none px-2 hover:bg-gray-100" : e === "soft" ? p = "bg-indigo-50 text-indigo-600 shadow-none border-none hover:bg-indigo-100" : e === "outline" || e === "outlined" ? p = I ? "bg-black text-white shadow-none border border-[#3b3b3b]" : "bg-transparent border-[1.5px] border-gray-200 text-gray-700 shadow-none hover:bg-gray-50" : e === "solid" ? p = I ? "bg-[#f2f2f2] text-black shadow-none border border-[#f2f2f2]" : "bg-[var(--fibo-primary)] text-[var(--fibo-on-primary)] shadow-none border-none hover:opacity-90" : e === "filled" || e === "primary" ? p = "bg-[var(--fibo-primary)] text-[var(--fibo-on-primary)] shadow-sm border-none hover:opacity-90 active:opacity-100" : e === "elevated" ? p = "bg-[var(--fibo-surface)] text-[var(--fibo-primary)] shadow-md border-none hover:shadow-lg" : e === "tonal" ? p = "bg-[var(--fibo-secondary-container)] text-[var(--fibo-on-secondary-container)] shadow-sm border-none" : e === "raw" && (p = "bg-transparent border-none shadow-none p-0 h-auto gap-0 text-inherit font-inherit hover:bg-transparent", m = ""), y === "soft" && e !== "raw" && (p += " shadow-[0_8px_20px_-6px_rgba(59,130,246,0.4)]");
|
|
35
|
+
const b = v || {}, L = b.padding !== void 0 || b.paddingTop !== void 0 || b.paddingBottom !== void 0 || b.paddingLeft !== void 0 || b.paddingRight !== void 0 || b.fontSize !== void 0 || b.height !== void 0, N = b.borderRadius !== void 0, E = b.fontWeight !== void 0 || l === "xs" || I, z = e === "raw" || x === "none" || I || l === "xs", n = B(
|
|
36
|
+
"fibo-button",
|
|
37
|
+
"inline-flex items-center justify-center whitespace-nowrap",
|
|
38
|
+
E ? "" : "font-semibold",
|
|
39
|
+
z ? "" : "active:scale-[0.96] transform transition-all duration-200 ease-out",
|
|
40
|
+
s ? "cursor-not-allowed opacity-60" : "cursor-pointer",
|
|
41
|
+
e === "raw" || L ? "" : _[l],
|
|
42
|
+
e === "raw" || N ? "" : m,
|
|
43
|
+
f ? "flex-1 w-full" : "",
|
|
44
|
+
`fibo-button-${e}`,
|
|
45
|
+
p,
|
|
46
|
+
k
|
|
47
|
+
), h = [];
|
|
48
|
+
return d && h.push(d), i && h.push(i), o.children && (Array.isArray(o.children) ? h.push(...o.children) : h.push(o.children)), t.createElement(
|
|
49
|
+
"button",
|
|
50
|
+
{
|
|
51
|
+
className: n,
|
|
52
|
+
onClick: (S) => {
|
|
53
|
+
s || (!z && document.documentElement.classList.contains("fibo-theme-material") && e !== "raw" && import("./effects-CnevV566.js").then(({ createRipple: j }) => {
|
|
54
|
+
j(S, S.currentTarget);
|
|
55
|
+
}), a == null || a());
|
|
56
|
+
},
|
|
57
|
+
disabled: s,
|
|
58
|
+
...g,
|
|
59
|
+
type: g.type ?? "button",
|
|
60
|
+
style: b
|
|
61
|
+
},
|
|
62
|
+
...h
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
class W extends D {
|
|
66
|
+
constructor(e = "") {
|
|
67
|
+
super();
|
|
68
|
+
r(this, "_text", "");
|
|
69
|
+
r(this, "_variant", "elevated");
|
|
70
|
+
r(this, "_size", "md");
|
|
71
|
+
r(this, "_onPress");
|
|
72
|
+
r(this, "_disabled", !1);
|
|
73
|
+
r(this, "_icon");
|
|
74
|
+
r(this, "_shape", "default");
|
|
75
|
+
r(this, "_shadow", "none");
|
|
76
|
+
r(this, "_tone", "default");
|
|
77
|
+
r(this, "_motion", "default");
|
|
78
|
+
r(this, "_expand", !1);
|
|
79
|
+
this.text(e);
|
|
80
|
+
}
|
|
81
|
+
text(e) {
|
|
82
|
+
return this._text = e, typeof e == "function" && this.observer(), this;
|
|
83
|
+
}
|
|
84
|
+
variant(e) {
|
|
85
|
+
return this._variant = e, this;
|
|
86
|
+
}
|
|
87
|
+
clean() {
|
|
88
|
+
return this._variant = "raw", this;
|
|
89
|
+
}
|
|
90
|
+
size(e) {
|
|
91
|
+
return this._size = e, this;
|
|
92
|
+
}
|
|
93
|
+
onPress(e) {
|
|
94
|
+
return this._onPress = e, this;
|
|
95
|
+
}
|
|
96
|
+
disabled(e = !0) {
|
|
97
|
+
return this._disabled = e, this;
|
|
98
|
+
}
|
|
99
|
+
icon(e) {
|
|
100
|
+
return this._icon = e, this;
|
|
101
|
+
}
|
|
102
|
+
shape(e) {
|
|
103
|
+
return this._shape = e, this;
|
|
104
|
+
}
|
|
105
|
+
shadow(e) {
|
|
106
|
+
return this._shadow = e, this;
|
|
107
|
+
}
|
|
108
|
+
tone(e) {
|
|
109
|
+
return this._tone = e, this;
|
|
110
|
+
}
|
|
111
|
+
motion(e) {
|
|
112
|
+
return this._motion = e, this;
|
|
113
|
+
}
|
|
114
|
+
expand(e = !0) {
|
|
115
|
+
return this._expand = e, this;
|
|
116
|
+
}
|
|
117
|
+
build() {
|
|
118
|
+
const e = this.getClassName(), a = {
|
|
119
|
+
text: typeof this._text == "function" ? this._text() : this._text,
|
|
120
|
+
variant: this._variant,
|
|
121
|
+
size: this._size,
|
|
122
|
+
onPress: this._onPress,
|
|
123
|
+
disabled: this._disabled,
|
|
124
|
+
icon: this._icon,
|
|
125
|
+
shape: this._shape,
|
|
126
|
+
shadow: this._shadow,
|
|
127
|
+
tone: this._tone,
|
|
128
|
+
motion: this._motion,
|
|
129
|
+
expand: this._expand,
|
|
130
|
+
className: e,
|
|
131
|
+
style: this.getStyle(),
|
|
132
|
+
children: this.processChildren(),
|
|
133
|
+
...this._props
|
|
134
|
+
};
|
|
135
|
+
return t.createElement(V, a);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const de = $(W), H = (o, i) => {
|
|
139
|
+
let e = 0;
|
|
140
|
+
const l = o.replace(/\D/g, "").split("");
|
|
141
|
+
let a = "";
|
|
142
|
+
for (let s = 0; s < i.length && !(e >= l.length); s++)
|
|
143
|
+
i[s] === "9" ? a += l[e++] : a += i[s];
|
|
144
|
+
return a;
|
|
145
|
+
}, K = t.memo((o) => {
|
|
146
|
+
const i = t.useId(), e = o.id || i, [l, a] = t.useState(!1), {
|
|
147
|
+
containerClass: s,
|
|
148
|
+
containerStyle: d,
|
|
149
|
+
label: u,
|
|
150
|
+
error: y,
|
|
151
|
+
mask: w,
|
|
152
|
+
type: x,
|
|
153
|
+
value: f,
|
|
154
|
+
onChange: k,
|
|
155
|
+
leadingIcon: v,
|
|
156
|
+
trailingIcon: g,
|
|
157
|
+
..._
|
|
158
|
+
} = o, m = f instanceof q, [I, p] = T(m ? f.value : f);
|
|
159
|
+
F(() => {
|
|
160
|
+
if (m)
|
|
161
|
+
return f.subscribe((h) => {
|
|
162
|
+
p(h);
|
|
163
|
+
});
|
|
164
|
+
p(f);
|
|
165
|
+
}, [f, m]);
|
|
166
|
+
const b = x === "password", L = b && l ? "text" : x, N = (n) => {
|
|
167
|
+
let h = n.target.value;
|
|
168
|
+
if (w) {
|
|
169
|
+
h = H(h, w);
|
|
170
|
+
const S = {
|
|
171
|
+
...n,
|
|
172
|
+
target: {
|
|
173
|
+
...n.target,
|
|
174
|
+
value: h
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
m && (f.value = h), k == null || k(S);
|
|
178
|
+
} else
|
|
179
|
+
m && (f.value = h), k == null || k(n);
|
|
180
|
+
}, E = v ? "2.75rem" : "1rem", z = g || b ? "2.75rem" : "1rem";
|
|
181
|
+
return t.createElement(
|
|
182
|
+
"div",
|
|
183
|
+
{ className: s, style: d },
|
|
184
|
+
t.createElement("div", { className: "relative w-full h-full flex items-center" }, [
|
|
185
|
+
v && t.createElement(
|
|
186
|
+
"div",
|
|
187
|
+
{
|
|
188
|
+
key: "leading-icon",
|
|
189
|
+
className: "absolute left-3 top-1/2 transform -translate-y-1/2 flex items-center justify-center pointer-events-none z-10"
|
|
190
|
+
},
|
|
191
|
+
v
|
|
192
|
+
),
|
|
193
|
+
t.createElement("input", {
|
|
194
|
+
key: "input",
|
|
195
|
+
id: e,
|
|
196
|
+
className: "fibo-textfield-input w-full h-full bg-transparent outline-none py-2.5 text-sm",
|
|
197
|
+
style: { paddingLeft: E, paddingRight: z },
|
|
198
|
+
type: L,
|
|
199
|
+
onChange: N,
|
|
200
|
+
value: I,
|
|
201
|
+
..._
|
|
202
|
+
}),
|
|
203
|
+
u && t.createElement(
|
|
204
|
+
"label",
|
|
205
|
+
{
|
|
206
|
+
key: "label",
|
|
207
|
+
htmlFor: e,
|
|
208
|
+
className: "fibo-textfield-label",
|
|
209
|
+
style: { left: v ? "2.75rem" : "1rem" }
|
|
210
|
+
},
|
|
211
|
+
u
|
|
212
|
+
),
|
|
213
|
+
(g || b) && t.createElement(
|
|
214
|
+
"div",
|
|
215
|
+
{
|
|
216
|
+
key: "trailing-icon",
|
|
217
|
+
className: "absolute right-3 top-1/2 transform -translate-y-1/2 flex items-center justify-center z-10"
|
|
218
|
+
},
|
|
219
|
+
b ? t.createElement(
|
|
220
|
+
"button",
|
|
221
|
+
{
|
|
222
|
+
type: "button",
|
|
223
|
+
className: "text-gray-400 hover:text-gray-600 focus:outline-none",
|
|
224
|
+
onClick: () => a(!l),
|
|
225
|
+
tabIndex: -1
|
|
226
|
+
},
|
|
227
|
+
l ? t.createElement(
|
|
228
|
+
"svg",
|
|
229
|
+
{ width: 16, height: 16, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" },
|
|
230
|
+
t.createElement("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" }),
|
|
231
|
+
t.createElement("line", { x1: 1, y1: 1, x2: 23, y2: 23 })
|
|
232
|
+
) : t.createElement(
|
|
233
|
+
"svg",
|
|
234
|
+
{ width: 16, height: 16, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" },
|
|
235
|
+
t.createElement("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
236
|
+
t.createElement("circle", { cx: 12, cy: 12, r: 3 })
|
|
237
|
+
)
|
|
238
|
+
) : g
|
|
239
|
+
)
|
|
240
|
+
]),
|
|
241
|
+
y && t.createElement(
|
|
242
|
+
"span",
|
|
243
|
+
{ className: "text-[var(--fibo-error)] text-xs mt-1 ml-1" },
|
|
244
|
+
y
|
|
245
|
+
)
|
|
246
|
+
);
|
|
247
|
+
});
|
|
248
|
+
class G extends D {
|
|
249
|
+
constructor(e = "") {
|
|
250
|
+
super();
|
|
251
|
+
r(this, "_value", "");
|
|
252
|
+
r(this, "_label", "");
|
|
253
|
+
r(this, "_placeholder", "");
|
|
254
|
+
r(this, "_type", "text");
|
|
255
|
+
r(this, "_disabled", !1);
|
|
256
|
+
r(this, "_error");
|
|
257
|
+
r(this, "_mask");
|
|
258
|
+
r(this, "_onChange");
|
|
259
|
+
r(this, "_leadingIcon");
|
|
260
|
+
r(this, "_trailingIcon");
|
|
261
|
+
r(this, "_variant", "filled");
|
|
262
|
+
this._value = e;
|
|
263
|
+
}
|
|
264
|
+
value(e) {
|
|
265
|
+
return this._value = e, this;
|
|
266
|
+
}
|
|
267
|
+
label(e) {
|
|
268
|
+
return this._label = e, this;
|
|
269
|
+
}
|
|
270
|
+
placeholder(e) {
|
|
271
|
+
return this._placeholder = e, this;
|
|
272
|
+
}
|
|
273
|
+
type(e) {
|
|
274
|
+
return this._type = e, this;
|
|
275
|
+
}
|
|
276
|
+
mask(e) {
|
|
277
|
+
return this._mask = e, this;
|
|
278
|
+
}
|
|
279
|
+
disabled(e = !0) {
|
|
280
|
+
return this._disabled = e, this;
|
|
281
|
+
}
|
|
282
|
+
error(e) {
|
|
283
|
+
return this._error = e, this;
|
|
284
|
+
}
|
|
285
|
+
onChange(e) {
|
|
286
|
+
return this._onChange = e, this;
|
|
287
|
+
}
|
|
288
|
+
leadingIcon(e) {
|
|
289
|
+
return this._leadingIcon = e, this;
|
|
290
|
+
}
|
|
291
|
+
trailingIcon(e) {
|
|
292
|
+
return this._trailingIcon = e, this;
|
|
293
|
+
}
|
|
294
|
+
variant(e) {
|
|
295
|
+
return this._variant = e, this;
|
|
296
|
+
}
|
|
297
|
+
build() {
|
|
298
|
+
let e = "fibo-textfield-container w-full h-14 relative";
|
|
299
|
+
this._variant === "outlined" ? e += " border border-[var(--fibo-outline)] rounded-[4px] bg-transparent" : e += " bg-[var(--fibo-surface-variant)] rounded-t-[4px] border-b border-[var(--fibo-outline)]";
|
|
300
|
+
const a = {
|
|
301
|
+
containerClass: B(e, ...this._classNames),
|
|
302
|
+
containerStyle: this.getStyle(),
|
|
303
|
+
label: this._label,
|
|
304
|
+
error: this._error,
|
|
305
|
+
leadingIcon: this._leadingIcon,
|
|
306
|
+
trailingIcon: this._trailingIcon,
|
|
307
|
+
value: this._value,
|
|
308
|
+
placeholder: this._placeholder || " ",
|
|
309
|
+
type: this._type,
|
|
310
|
+
mask: this._mask,
|
|
311
|
+
disabled: this._disabled,
|
|
312
|
+
onChange: (s) => {
|
|
313
|
+
var d;
|
|
314
|
+
(d = this._onChange) == null || d.call(this, s.target.value);
|
|
315
|
+
},
|
|
316
|
+
...this._props
|
|
317
|
+
};
|
|
318
|
+
return t.createElement(K, a);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
const he = $(G), U = t.memo((o) => {
|
|
322
|
+
const {
|
|
323
|
+
checked: i,
|
|
324
|
+
onChange: e,
|
|
325
|
+
label: l,
|
|
326
|
+
disabled: a,
|
|
327
|
+
className: s,
|
|
328
|
+
style: d,
|
|
329
|
+
id: u
|
|
330
|
+
} = o, y = B(
|
|
331
|
+
"fibo-switch-track w-[44px] h-[24px] rounded-full relative transition-colors duration-200 ease-in-out",
|
|
332
|
+
a ? "cursor-not-allowed opacity-50" : "cursor-pointer",
|
|
333
|
+
i ? "bg-[var(--fibo-primary,#3B82F6)]" : "bg-gray-200"
|
|
334
|
+
), w = B(
|
|
335
|
+
"absolute w-5 h-5 rounded-full bg-white top-[2px] left-[2px] transition-transform duration-200 ease-in-out shadow-sm",
|
|
336
|
+
i ? "translate-x-[20px]" : "translate-x-0"
|
|
337
|
+
);
|
|
338
|
+
return t.createElement(
|
|
339
|
+
"label",
|
|
340
|
+
{
|
|
341
|
+
className: B("fibo-switch flex items-center gap-3", s)
|
|
342
|
+
},
|
|
343
|
+
t.createElement(
|
|
344
|
+
"div",
|
|
345
|
+
{
|
|
346
|
+
className: y,
|
|
347
|
+
style: d,
|
|
348
|
+
"aria-hidden": !0
|
|
349
|
+
},
|
|
350
|
+
t.createElement("div", { className: w })
|
|
351
|
+
),
|
|
352
|
+
l && t.createElement(
|
|
353
|
+
"span",
|
|
354
|
+
{ className: "text-sm font-medium text-gray-700 select-none" },
|
|
355
|
+
l
|
|
356
|
+
),
|
|
357
|
+
t.createElement("input", {
|
|
358
|
+
id: u,
|
|
359
|
+
type: "checkbox",
|
|
360
|
+
role: "switch",
|
|
361
|
+
checked: !!i,
|
|
362
|
+
disabled: a,
|
|
363
|
+
className: "sr-only",
|
|
364
|
+
onChange: (x) => !a && (e == null ? void 0 : e(x.target.checked))
|
|
365
|
+
})
|
|
366
|
+
);
|
|
367
|
+
});
|
|
368
|
+
class J extends D {
|
|
369
|
+
constructor() {
|
|
370
|
+
super(...arguments);
|
|
371
|
+
r(this, "_checked", !1);
|
|
372
|
+
r(this, "_onChange");
|
|
373
|
+
r(this, "_label");
|
|
374
|
+
r(this, "_disabled", !1);
|
|
375
|
+
}
|
|
376
|
+
checked(e) {
|
|
377
|
+
return this._checked = e, this;
|
|
378
|
+
}
|
|
379
|
+
onChange(e) {
|
|
380
|
+
return this._onChange = e, this;
|
|
381
|
+
}
|
|
382
|
+
label(e) {
|
|
383
|
+
return this._label = e, this;
|
|
384
|
+
}
|
|
385
|
+
disabled(e = !0) {
|
|
386
|
+
return this._disabled = e, this;
|
|
387
|
+
}
|
|
388
|
+
build() {
|
|
389
|
+
const e = {
|
|
390
|
+
checked: this._checked,
|
|
391
|
+
onChange: this._onChange,
|
|
392
|
+
label: this._label,
|
|
393
|
+
disabled: this._disabled,
|
|
394
|
+
className: this.getClassName(),
|
|
395
|
+
style: this.getStyle(),
|
|
396
|
+
...this._props
|
|
397
|
+
};
|
|
398
|
+
return t.createElement(U, e);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
const ue = $(J), Q = t.memo((o) => {
|
|
402
|
+
const {
|
|
403
|
+
checked: i,
|
|
404
|
+
onChange: e,
|
|
405
|
+
label: l,
|
|
406
|
+
disabled: a,
|
|
407
|
+
indeterminate: s,
|
|
408
|
+
className: d,
|
|
409
|
+
style: u,
|
|
410
|
+
id: y
|
|
411
|
+
} = o, w = M(null), x = i || s;
|
|
412
|
+
F(() => {
|
|
413
|
+
w.current && (w.current.indeterminate = !!s);
|
|
414
|
+
}, [s]);
|
|
415
|
+
let f = null;
|
|
416
|
+
return s ? f = t.createElement("div", { className: "w-[10px] h-[2px] bg-white rounded-[1px]" }) : i && (f = t.createElement(
|
|
417
|
+
"svg",
|
|
418
|
+
{
|
|
419
|
+
width: "12",
|
|
420
|
+
height: "12",
|
|
421
|
+
viewBox: "0 0 12 12",
|
|
422
|
+
fill: "none",
|
|
423
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
424
|
+
"aria-hidden": !0
|
|
425
|
+
},
|
|
426
|
+
t.createElement("path", {
|
|
427
|
+
d: "M10 3L4.5 8.5L2 6",
|
|
428
|
+
stroke: "white",
|
|
429
|
+
strokeWidth: "2",
|
|
430
|
+
strokeLinecap: "round",
|
|
431
|
+
strokeLinejoin: "round"
|
|
432
|
+
})
|
|
433
|
+
)), t.createElement(
|
|
434
|
+
"label",
|
|
435
|
+
{
|
|
436
|
+
className: B("fibo-checkbox flex items-center gap-2", d)
|
|
437
|
+
},
|
|
438
|
+
t.createElement(
|
|
439
|
+
"div",
|
|
440
|
+
{
|
|
441
|
+
className: B(
|
|
442
|
+
"fibo-checkbox-box w-5 h-5 rounded-[6px] border-2 flex items-center justify-center transition-all duration-200",
|
|
443
|
+
a ? "cursor-not-allowed opacity-50" : "cursor-pointer",
|
|
444
|
+
x ? "border-transparent bg-[var(--fibo-primary,#3B82F6)]" : "border-gray-300 bg-transparent"
|
|
445
|
+
),
|
|
446
|
+
style: u,
|
|
447
|
+
"aria-hidden": !0
|
|
448
|
+
},
|
|
449
|
+
f
|
|
450
|
+
),
|
|
451
|
+
l && t.createElement(
|
|
452
|
+
"span",
|
|
453
|
+
{ className: "text-sm text-gray-700 select-none" },
|
|
454
|
+
l
|
|
455
|
+
),
|
|
456
|
+
t.createElement("input", {
|
|
457
|
+
ref: w,
|
|
458
|
+
id: y,
|
|
459
|
+
type: "checkbox",
|
|
460
|
+
checked: !!i,
|
|
461
|
+
disabled: a,
|
|
462
|
+
className: "sr-only",
|
|
463
|
+
onChange: (k) => !a && (e == null ? void 0 : e(k.target.checked))
|
|
464
|
+
})
|
|
465
|
+
);
|
|
466
|
+
});
|
|
467
|
+
class X extends D {
|
|
468
|
+
constructor() {
|
|
469
|
+
super(...arguments);
|
|
470
|
+
r(this, "_checked", !1);
|
|
471
|
+
r(this, "_onChange");
|
|
472
|
+
r(this, "_label");
|
|
473
|
+
r(this, "_disabled", !1);
|
|
474
|
+
r(this, "_indeterminate", !1);
|
|
475
|
+
}
|
|
476
|
+
checked(e) {
|
|
477
|
+
return this._checked = e, this;
|
|
478
|
+
}
|
|
479
|
+
indeterminate(e) {
|
|
480
|
+
return this._indeterminate = e, this;
|
|
481
|
+
}
|
|
482
|
+
onChange(e) {
|
|
483
|
+
return this._onChange = e, this;
|
|
484
|
+
}
|
|
485
|
+
label(e) {
|
|
486
|
+
return this._label = e, this;
|
|
487
|
+
}
|
|
488
|
+
disabled(e = !0) {
|
|
489
|
+
return this._disabled = e, this;
|
|
490
|
+
}
|
|
491
|
+
build() {
|
|
492
|
+
const e = {
|
|
493
|
+
checked: this._checked,
|
|
494
|
+
onChange: this._onChange,
|
|
495
|
+
label: this._label,
|
|
496
|
+
disabled: this._disabled,
|
|
497
|
+
indeterminate: this._indeterminate,
|
|
498
|
+
className: this.getClassName(),
|
|
499
|
+
style: this.getStyle(),
|
|
500
|
+
...this._props
|
|
501
|
+
};
|
|
502
|
+
return t.createElement(Q, e);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
const pe = $(X), Y = t.memo((o) => {
|
|
506
|
+
const {
|
|
507
|
+
value: i,
|
|
508
|
+
options: e = [],
|
|
509
|
+
onChange: l,
|
|
510
|
+
name: a,
|
|
511
|
+
direction: s,
|
|
512
|
+
className: d,
|
|
513
|
+
style: u
|
|
514
|
+
} = o, y = t.useId(), w = a || y;
|
|
515
|
+
return t.createElement(
|
|
516
|
+
"div",
|
|
517
|
+
{
|
|
518
|
+
role: "radiogroup",
|
|
519
|
+
className: B(`fibo-radio-group flex ${s === "vertical" ? "flex-col gap-2" : "flex-row gap-4"}`, d),
|
|
520
|
+
style: u
|
|
521
|
+
},
|
|
522
|
+
e.map((x) => {
|
|
523
|
+
const f = i === x.value, k = x.disabled, v = B(
|
|
524
|
+
"relative flex items-center justify-center w-[18px] h-[18px] rounded-full transition-all duration-200",
|
|
525
|
+
f ? "border-[5px] border-[var(--fibo-primary,#3B82F6)]" : "border-2 border-gray-300"
|
|
526
|
+
);
|
|
527
|
+
return t.createElement(
|
|
528
|
+
"label",
|
|
529
|
+
{
|
|
530
|
+
key: x.value,
|
|
531
|
+
className: `flex items-center gap-2 cursor-pointer ${k ? "opacity-50 cursor-not-allowed" : ""}`
|
|
532
|
+
},
|
|
533
|
+
t.createElement(
|
|
534
|
+
"div",
|
|
535
|
+
{
|
|
536
|
+
className: v,
|
|
537
|
+
"aria-hidden": !0
|
|
538
|
+
},
|
|
539
|
+
t.createElement("input", {
|
|
540
|
+
type: "radio",
|
|
541
|
+
name: w,
|
|
542
|
+
value: x.value,
|
|
543
|
+
checked: f,
|
|
544
|
+
disabled: k,
|
|
545
|
+
className: "sr-only",
|
|
546
|
+
onChange: () => !k && (l == null ? void 0 : l(x.value))
|
|
547
|
+
})
|
|
548
|
+
),
|
|
549
|
+
t.createElement(
|
|
550
|
+
"span",
|
|
551
|
+
{ className: "text-sm text-gray-700" },
|
|
552
|
+
x.label
|
|
553
|
+
)
|
|
554
|
+
);
|
|
555
|
+
})
|
|
556
|
+
);
|
|
557
|
+
});
|
|
558
|
+
class Z extends D {
|
|
559
|
+
constructor() {
|
|
560
|
+
super(...arguments);
|
|
561
|
+
r(this, "_value", "");
|
|
562
|
+
r(this, "_options", []);
|
|
563
|
+
r(this, "_onChange");
|
|
564
|
+
r(this, "_name");
|
|
565
|
+
r(this, "_direction", "vertical");
|
|
566
|
+
}
|
|
567
|
+
value(e) {
|
|
568
|
+
return this._value = e, this;
|
|
569
|
+
}
|
|
570
|
+
options(e) {
|
|
571
|
+
return this._options = e, this;
|
|
572
|
+
}
|
|
573
|
+
onChange(e) {
|
|
574
|
+
return this._onChange = e, this;
|
|
575
|
+
}
|
|
576
|
+
direction(e) {
|
|
577
|
+
return this._direction = e, this;
|
|
578
|
+
}
|
|
579
|
+
name(e) {
|
|
580
|
+
return this._name = e, this;
|
|
581
|
+
}
|
|
582
|
+
build() {
|
|
583
|
+
const e = {
|
|
584
|
+
value: this._value,
|
|
585
|
+
options: this._options,
|
|
586
|
+
onChange: this._onChange,
|
|
587
|
+
name: this._name,
|
|
588
|
+
direction: this._direction,
|
|
589
|
+
className: this.getClassName(),
|
|
590
|
+
style: this.getStyle()
|
|
591
|
+
};
|
|
592
|
+
return t.createElement(Y, e);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
const me = $(Z), ee = t.memo((o) => {
|
|
596
|
+
const i = t.useId(), e = o.id || i, {
|
|
597
|
+
containerClass: l,
|
|
598
|
+
containerStyle: a,
|
|
599
|
+
label: s,
|
|
600
|
+
error: d,
|
|
601
|
+
...u
|
|
602
|
+
} = o;
|
|
603
|
+
return t.createElement(
|
|
604
|
+
"div",
|
|
605
|
+
{ className: l, style: a },
|
|
606
|
+
t.createElement("textarea", {
|
|
607
|
+
id: e,
|
|
608
|
+
className: "fibo-textarea-input w-full p-4 text-base bg-transparent outline-none relative z-10",
|
|
609
|
+
...u
|
|
610
|
+
}),
|
|
611
|
+
s && t.createElement(
|
|
612
|
+
"label",
|
|
613
|
+
{
|
|
614
|
+
htmlFor: e,
|
|
615
|
+
className: "fibo-textarea-label"
|
|
616
|
+
},
|
|
617
|
+
s
|
|
618
|
+
),
|
|
619
|
+
d && t.createElement(
|
|
620
|
+
"span",
|
|
621
|
+
{ className: "text-[var(--fibo-error)] text-xs mt-1 ml-1" },
|
|
622
|
+
d
|
|
623
|
+
)
|
|
624
|
+
);
|
|
625
|
+
});
|
|
626
|
+
class te extends D {
|
|
627
|
+
constructor() {
|
|
628
|
+
super(...arguments);
|
|
629
|
+
r(this, "_value", "");
|
|
630
|
+
r(this, "_label", "");
|
|
631
|
+
r(this, "_placeholder", "");
|
|
632
|
+
r(this, "_disabled", !1);
|
|
633
|
+
r(this, "_rows", 4);
|
|
634
|
+
r(this, "_error");
|
|
635
|
+
r(this, "_resize", "vertical");
|
|
636
|
+
r(this, "_onChange");
|
|
637
|
+
}
|
|
638
|
+
value(e) {
|
|
639
|
+
return this._value = e, this;
|
|
640
|
+
}
|
|
641
|
+
label(e) {
|
|
642
|
+
return this._label = e, this;
|
|
643
|
+
}
|
|
644
|
+
placeholder(e) {
|
|
645
|
+
return this._placeholder = e, this;
|
|
646
|
+
}
|
|
647
|
+
disabled(e = !0) {
|
|
648
|
+
return this._disabled = e, this;
|
|
649
|
+
}
|
|
650
|
+
rows(e) {
|
|
651
|
+
return this._rows = e, this;
|
|
652
|
+
}
|
|
653
|
+
resize(e) {
|
|
654
|
+
return this._resize = e, this;
|
|
655
|
+
}
|
|
656
|
+
error(e) {
|
|
657
|
+
return this._error = e, this;
|
|
658
|
+
}
|
|
659
|
+
onChange(e) {
|
|
660
|
+
return this._onChange = e, this;
|
|
661
|
+
}
|
|
662
|
+
build() {
|
|
663
|
+
const l = {
|
|
664
|
+
containerClass: B("fibo-textarea-container w-full", ...this._classNames),
|
|
665
|
+
containerStyle: this.getStyle(),
|
|
666
|
+
label: this._label,
|
|
667
|
+
error: this._error,
|
|
668
|
+
rows: this._rows,
|
|
669
|
+
value: this._value,
|
|
670
|
+
placeholder: this._placeholder || " ",
|
|
671
|
+
disabled: this._disabled,
|
|
672
|
+
style: { resize: this._resize },
|
|
673
|
+
onChange: (a) => {
|
|
674
|
+
var s;
|
|
675
|
+
(s = this._onChange) == null || s.call(this, a.target.value);
|
|
676
|
+
},
|
|
677
|
+
...this._props
|
|
678
|
+
};
|
|
679
|
+
return t.createElement(ee, l);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
const be = $(te), re = t.memo((o) => {
|
|
683
|
+
const i = t.useId(), e = o.id || i, l = `${e}-listbox`, [a, s] = T(!1), [d, u] = T(0), y = M(null), {
|
|
684
|
+
containerClass: w,
|
|
685
|
+
containerStyle: x,
|
|
686
|
+
label: f,
|
|
687
|
+
error: k,
|
|
688
|
+
value: v,
|
|
689
|
+
options: g = [],
|
|
690
|
+
placeholder: _,
|
|
691
|
+
onChange: m,
|
|
692
|
+
disabled: I,
|
|
693
|
+
multiple: p
|
|
694
|
+
} = o;
|
|
695
|
+
F(() => {
|
|
696
|
+
const n = (h) => {
|
|
697
|
+
y.current && !y.current.contains(h.target) && s(!1);
|
|
698
|
+
};
|
|
699
|
+
return document.addEventListener("mousedown", n), () => document.removeEventListener("mousedown", n);
|
|
700
|
+
}, []);
|
|
701
|
+
const b = (n) => p ? Array.isArray(v) && v.includes(n) : v === n;
|
|
702
|
+
let L = "";
|
|
703
|
+
if (p)
|
|
704
|
+
Array.isArray(v) && v.length > 0 && (L = g.filter((n) => v.includes(n.value)).map((n) => n.label).join(", "));
|
|
705
|
+
else {
|
|
706
|
+
const n = g.find((h) => h.value === v);
|
|
707
|
+
L = n ? n.label : "";
|
|
708
|
+
}
|
|
709
|
+
const N = (n) => {
|
|
710
|
+
if (!I)
|
|
711
|
+
if (p) {
|
|
712
|
+
const h = Array.isArray(v) ? [...v] : [], S = h.indexOf(n);
|
|
713
|
+
S > -1 ? h.splice(S, 1) : h.push(n), m == null || m(h);
|
|
714
|
+
} else
|
|
715
|
+
m == null || m(n), s(!1);
|
|
716
|
+
}, E = (n) => {
|
|
717
|
+
g.length !== 0 && u((h) => (h + n + g.length) % g.length);
|
|
718
|
+
}, z = (n) => {
|
|
719
|
+
if (!I)
|
|
720
|
+
switch (n.key) {
|
|
721
|
+
case "ArrowDown":
|
|
722
|
+
n.preventDefault(), a ? E(1) : s(!0);
|
|
723
|
+
break;
|
|
724
|
+
case "ArrowUp":
|
|
725
|
+
n.preventDefault(), a ? E(-1) : s(!0);
|
|
726
|
+
break;
|
|
727
|
+
case "Home":
|
|
728
|
+
n.preventDefault(), u(0);
|
|
729
|
+
break;
|
|
730
|
+
case "End":
|
|
731
|
+
n.preventDefault(), u(Math.max(0, g.length - 1));
|
|
732
|
+
break;
|
|
733
|
+
case "Enter":
|
|
734
|
+
case " ":
|
|
735
|
+
n.preventDefault(), a ? g[d] && N(g[d].value) : s(!0);
|
|
736
|
+
break;
|
|
737
|
+
case "Escape":
|
|
738
|
+
n.preventDefault(), s(!1);
|
|
739
|
+
break;
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
return t.createElement(
|
|
743
|
+
"div",
|
|
744
|
+
{
|
|
745
|
+
ref: y,
|
|
746
|
+
className: w,
|
|
747
|
+
style: x
|
|
748
|
+
},
|
|
749
|
+
t.createElement("div", { className: "relative w-full h-full" }, [
|
|
750
|
+
t.createElement("button", {
|
|
751
|
+
key: "trigger",
|
|
752
|
+
id: e,
|
|
753
|
+
type: "button",
|
|
754
|
+
role: "combobox",
|
|
755
|
+
"aria-expanded": a,
|
|
756
|
+
"aria-haspopup": "listbox",
|
|
757
|
+
"aria-controls": l,
|
|
758
|
+
"aria-activedescendant": a && g[d] ? `${l}-opt-${g[d].value}` : void 0,
|
|
759
|
+
disabled: I,
|
|
760
|
+
className: `fibo-textfield-input text-left w-full flex items-center justify-between ${L ? "" : "text-gray-400"}`,
|
|
761
|
+
onClick: () => !I && s(!a),
|
|
762
|
+
onKeyDown: z
|
|
763
|
+
}, [
|
|
764
|
+
t.createElement("span", { key: "text", className: "truncate" }, L || _ || " "),
|
|
765
|
+
t.createElement("svg", {
|
|
766
|
+
key: "icon",
|
|
767
|
+
className: `w-4 h-4 transition-transform ${a ? "rotate-180" : ""}`,
|
|
768
|
+
fill: "none",
|
|
769
|
+
stroke: "currentColor",
|
|
770
|
+
viewBox: "0 0 24 24",
|
|
771
|
+
"aria-hidden": !0
|
|
772
|
+
}, t.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }))
|
|
773
|
+
]),
|
|
774
|
+
f && t.createElement(
|
|
775
|
+
"label",
|
|
776
|
+
{
|
|
777
|
+
key: "label",
|
|
778
|
+
htmlFor: e,
|
|
779
|
+
className: "fibo-textfield-label"
|
|
780
|
+
},
|
|
781
|
+
f
|
|
782
|
+
),
|
|
783
|
+
a && t.createElement("div", {
|
|
784
|
+
key: "dropdown",
|
|
785
|
+
id: l,
|
|
786
|
+
role: "listbox",
|
|
787
|
+
"aria-multiselectable": p || void 0,
|
|
788
|
+
className: "absolute z-50 w-full mt-1 bg-[var(--fibo-surface)] border border-[var(--fibo-outline)] rounded-md shadow-lg max-h-60 overflow-auto focus:outline-none"
|
|
789
|
+
}, g.map((n, h) => {
|
|
790
|
+
const S = b(n.value), j = h === d;
|
|
791
|
+
return t.createElement("div", {
|
|
792
|
+
key: n.value,
|
|
793
|
+
id: `${l}-opt-${n.value}`,
|
|
794
|
+
role: "option",
|
|
795
|
+
"aria-selected": S,
|
|
796
|
+
className: `px-4 py-2 cursor-pointer text-sm hover:bg-[var(--fibo-primary-container)] hover:text-[var(--fibo-on-primary-container)] flex items-center justify-between ${S || j ? "bg-[var(--fibo-primary-container)] text-[var(--fibo-on-primary-container)] font-medium" : "text-[var(--fibo-on-surface)]"}`,
|
|
797
|
+
onClick: () => N(n.value),
|
|
798
|
+
onMouseEnter: () => u(h)
|
|
799
|
+
}, [
|
|
800
|
+
t.createElement("span", { key: "label" }, n.label),
|
|
801
|
+
S && t.createElement("svg", {
|
|
802
|
+
key: "check",
|
|
803
|
+
className: "w-4 h-4 text-[var(--fibo-primary)]",
|
|
804
|
+
viewBox: "0 0 20 20",
|
|
805
|
+
fill: "currentColor",
|
|
806
|
+
"aria-hidden": !0
|
|
807
|
+
}, t.createElement("path", { fillRule: "evenodd", d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z", clipRule: "evenodd" }))
|
|
808
|
+
]);
|
|
809
|
+
}))
|
|
810
|
+
]),
|
|
811
|
+
k && t.createElement(
|
|
812
|
+
"span",
|
|
813
|
+
{ className: "text-[var(--fibo-error)] text-xs mt-1 ml-1", role: "alert" },
|
|
814
|
+
k
|
|
815
|
+
)
|
|
816
|
+
);
|
|
817
|
+
});
|
|
818
|
+
class ae extends D {
|
|
819
|
+
constructor() {
|
|
820
|
+
super(...arguments);
|
|
821
|
+
r(this, "_value", "");
|
|
822
|
+
r(this, "_label", "");
|
|
823
|
+
r(this, "_placeholder", "");
|
|
824
|
+
r(this, "_disabled", !1);
|
|
825
|
+
r(this, "_error");
|
|
826
|
+
r(this, "_multiple", !1);
|
|
827
|
+
r(this, "_options", []);
|
|
828
|
+
r(this, "_onChange");
|
|
829
|
+
}
|
|
830
|
+
value(e) {
|
|
831
|
+
return this._value = e, this;
|
|
832
|
+
}
|
|
833
|
+
label(e) {
|
|
834
|
+
return this._label = e, this;
|
|
835
|
+
}
|
|
836
|
+
placeholder(e) {
|
|
837
|
+
return this._placeholder = e, this;
|
|
838
|
+
}
|
|
839
|
+
options(e) {
|
|
840
|
+
return this._options = e, this;
|
|
841
|
+
}
|
|
842
|
+
multiple(e = !0) {
|
|
843
|
+
return this._multiple = e, this;
|
|
844
|
+
}
|
|
845
|
+
disabled(e = !0) {
|
|
846
|
+
return this._disabled = e, this;
|
|
847
|
+
}
|
|
848
|
+
error(e) {
|
|
849
|
+
return this._error = e, this;
|
|
850
|
+
}
|
|
851
|
+
onChange(e) {
|
|
852
|
+
return this._onChange = e, this;
|
|
853
|
+
}
|
|
854
|
+
build() {
|
|
855
|
+
const l = {
|
|
856
|
+
containerClass: B("fibo-textfield-container relative", ...this._classNames),
|
|
857
|
+
containerStyle: this.getStyle(),
|
|
858
|
+
label: this._label,
|
|
859
|
+
error: this._error,
|
|
860
|
+
value: this._value,
|
|
861
|
+
placeholder: this._placeholder,
|
|
862
|
+
options: this._options,
|
|
863
|
+
disabled: this._disabled,
|
|
864
|
+
multiple: this._multiple,
|
|
865
|
+
onChange: this._onChange,
|
|
866
|
+
...this._props
|
|
867
|
+
};
|
|
868
|
+
return t.createElement(re, l);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
const fe = $(ae), se = t.memo((o) => {
|
|
872
|
+
const i = t.useId(), e = o.id || i, l = `${e}-listbox`, [a, s] = T(!1), [d, u] = T(""), [y, w] = T(0), x = M(null), {
|
|
873
|
+
containerClass: f,
|
|
874
|
+
containerStyle: k,
|
|
875
|
+
label: v,
|
|
876
|
+
error: g,
|
|
877
|
+
value: _,
|
|
878
|
+
options: m = [],
|
|
879
|
+
placeholder: I,
|
|
880
|
+
onChange: p,
|
|
881
|
+
onAdd: b,
|
|
882
|
+
disabled: L,
|
|
883
|
+
multiple: N
|
|
884
|
+
} = o;
|
|
885
|
+
F(() => {
|
|
886
|
+
if (!N) {
|
|
887
|
+
const c = m.find((C) => C.value === _);
|
|
888
|
+
c && !a && d !== c.label && u(c.label);
|
|
889
|
+
}
|
|
890
|
+
}, [_, m, a, N]);
|
|
891
|
+
const E = m.filter(
|
|
892
|
+
(c) => c.label.toLowerCase().includes(d.toLowerCase())
|
|
893
|
+
);
|
|
894
|
+
F(() => {
|
|
895
|
+
w(0);
|
|
896
|
+
}, [d, a]), F(() => {
|
|
897
|
+
const c = (C) => {
|
|
898
|
+
if (x.current && !x.current.contains(C.target))
|
|
899
|
+
if (s(!1), N)
|
|
900
|
+
u("");
|
|
901
|
+
else {
|
|
902
|
+
const A = m.find((R) => R.value === _);
|
|
903
|
+
u(A ? A.label : "");
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
return document.addEventListener("mousedown", c), () => document.removeEventListener("mousedown", c);
|
|
907
|
+
}, [_, m, N]);
|
|
908
|
+
const z = (c) => {
|
|
909
|
+
if (N) {
|
|
910
|
+
const C = Array.isArray(_) ? [..._] : [];
|
|
911
|
+
C.includes(c.value) || (C.push(c.value), p == null || p(C)), u("");
|
|
912
|
+
} else
|
|
913
|
+
u(c.label), p == null || p(c.value), s(!1);
|
|
914
|
+
}, n = (c) => {
|
|
915
|
+
if (N && Array.isArray(_)) {
|
|
916
|
+
const C = _.filter((A) => A !== c);
|
|
917
|
+
p == null || p(C);
|
|
918
|
+
}
|
|
919
|
+
}, h = () => {
|
|
920
|
+
b == null || b(d), N ? u("") : s(!1);
|
|
921
|
+
}, S = (c) => N ? Array.isArray(_) && _.includes(c) : _ === c, j = (c) => {
|
|
922
|
+
if (!L)
|
|
923
|
+
switch (c.key) {
|
|
924
|
+
case "ArrowDown":
|
|
925
|
+
c.preventDefault(), a ? E.length && w((C) => (C + 1) % E.length) : s(!0);
|
|
926
|
+
break;
|
|
927
|
+
case "ArrowUp":
|
|
928
|
+
c.preventDefault(), a ? E.length && w((C) => (C - 1 + E.length) % E.length) : s(!0);
|
|
929
|
+
break;
|
|
930
|
+
case "Enter":
|
|
931
|
+
c.preventDefault(), E[y] ? z(E[y]) : d && b && h();
|
|
932
|
+
break;
|
|
933
|
+
case "Escape":
|
|
934
|
+
c.preventDefault(), s(!1);
|
|
935
|
+
break;
|
|
936
|
+
}
|
|
937
|
+
};
|
|
938
|
+
return t.createElement(
|
|
939
|
+
"div",
|
|
940
|
+
{
|
|
941
|
+
ref: x,
|
|
942
|
+
className: f,
|
|
943
|
+
style: k
|
|
944
|
+
},
|
|
945
|
+
t.createElement("div", { className: "relative w-full h-full" }, [
|
|
946
|
+
t.createElement("div", {
|
|
947
|
+
key: "field",
|
|
948
|
+
className: `fibo-textfield-input flex flex-wrap items-center gap-1 ${a ? "ring-2 ring-[var(--fibo-primary-container)] border-[var(--fibo-primary)]" : ""}`,
|
|
949
|
+
style: { minHeight: "42px", padding: "4px 8px" }
|
|
950
|
+
}, [
|
|
951
|
+
N && Array.isArray(_) && _.map((c) => {
|
|
952
|
+
const C = m.find((R) => R.value === c), A = C ? C.label : c;
|
|
953
|
+
return t.createElement("span", {
|
|
954
|
+
key: c,
|
|
955
|
+
className: "bg-[var(--fibo-primary-container)] text-[var(--fibo-on-primary-container)] text-xs font-medium px-2 py-1 rounded-md flex items-center"
|
|
956
|
+
}, [
|
|
957
|
+
A,
|
|
958
|
+
t.createElement("button", {
|
|
959
|
+
type: "button",
|
|
960
|
+
className: "ml-1 hover:text-[var(--fibo-primary)] focus:outline-none",
|
|
961
|
+
"aria-label": `Remove ${A}`,
|
|
962
|
+
onClick: (R) => {
|
|
963
|
+
R.stopPropagation(), n(c);
|
|
964
|
+
}
|
|
965
|
+
}, "×")
|
|
966
|
+
]);
|
|
967
|
+
}),
|
|
968
|
+
t.createElement("input", {
|
|
969
|
+
key: "input",
|
|
970
|
+
id: e,
|
|
971
|
+
role: "combobox",
|
|
972
|
+
"aria-expanded": a,
|
|
973
|
+
"aria-controls": l,
|
|
974
|
+
"aria-autocomplete": "list",
|
|
975
|
+
"aria-activedescendant": a && E[y] ? `${l}-opt-${E[y].value}` : void 0,
|
|
976
|
+
className: "bg-transparent outline-none flex-1 min-w-[60px] text-sm h-8",
|
|
977
|
+
value: d,
|
|
978
|
+
placeholder: N && Array.isArray(_) && _.length > 0 ? "" : I || " ",
|
|
979
|
+
disabled: L,
|
|
980
|
+
onChange: (c) => {
|
|
981
|
+
u(c.target.value), a || s(!0);
|
|
982
|
+
},
|
|
983
|
+
onFocus: () => s(!0),
|
|
984
|
+
onKeyDown: j
|
|
985
|
+
})
|
|
986
|
+
]),
|
|
987
|
+
v && t.createElement(
|
|
988
|
+
"label",
|
|
989
|
+
{
|
|
990
|
+
key: "label",
|
|
991
|
+
htmlFor: e,
|
|
992
|
+
className: "fibo-textfield-label"
|
|
993
|
+
},
|
|
994
|
+
v
|
|
995
|
+
),
|
|
996
|
+
a && t.createElement("div", {
|
|
997
|
+
key: "dropdown",
|
|
998
|
+
id: l,
|
|
999
|
+
role: "listbox",
|
|
1000
|
+
"aria-multiselectable": N || void 0,
|
|
1001
|
+
className: "absolute z-50 w-full mt-1 bg-[var(--fibo-surface)] border border-[var(--fibo-outline)] rounded-md shadow-lg max-h-60 overflow-auto focus:outline-none left-0"
|
|
1002
|
+
}, [
|
|
1003
|
+
...E.length > 0 ? E.map((c, C) => {
|
|
1004
|
+
const A = S(c.value), R = C === y;
|
|
1005
|
+
return t.createElement("div", {
|
|
1006
|
+
key: c.value,
|
|
1007
|
+
id: `${l}-opt-${c.value}`,
|
|
1008
|
+
role: "option",
|
|
1009
|
+
"aria-selected": A,
|
|
1010
|
+
className: `px-4 py-2 cursor-pointer text-sm hover:bg-[var(--fibo-primary-container)] hover:text-[var(--fibo-on-primary-container)] ${A || R ? "bg-[var(--fibo-primary-container)] text-[var(--fibo-on-primary-container)] font-medium" : "text-[var(--fibo-on-surface)]"} ${A ? "opacity-50" : ""}`,
|
|
1011
|
+
onClick: () => !A && z(c),
|
|
1012
|
+
onMouseEnter: () => w(C)
|
|
1013
|
+
}, c.label);
|
|
1014
|
+
}) : [t.createElement("div", { key: "empty", className: "px-4 py-2 text-sm text-gray-500" }, "No results found.")],
|
|
1015
|
+
d && !E.some((c) => c.label.toLowerCase() === d.toLowerCase()) && b ? t.createElement("div", {
|
|
1016
|
+
key: "add-new",
|
|
1017
|
+
role: "option",
|
|
1018
|
+
"aria-selected": !1,
|
|
1019
|
+
className: "border-t border-[var(--fibo-outline)] px-4 py-2 cursor-pointer text-sm text-[var(--fibo-primary)] hover:bg-[var(--fibo-primary-container)] font-medium flex items-center",
|
|
1020
|
+
onClick: h
|
|
1021
|
+
}, [
|
|
1022
|
+
t.createElement("span", { key: "plus", className: "mr-1" }, "+"),
|
|
1023
|
+
`Add "${d}"`
|
|
1024
|
+
]) : null
|
|
1025
|
+
])
|
|
1026
|
+
]),
|
|
1027
|
+
g && t.createElement(
|
|
1028
|
+
"span",
|
|
1029
|
+
{ className: "text-[var(--fibo-error)] text-xs mt-1 ml-1", role: "alert" },
|
|
1030
|
+
g
|
|
1031
|
+
)
|
|
1032
|
+
);
|
|
1033
|
+
});
|
|
1034
|
+
class ne extends D {
|
|
1035
|
+
constructor() {
|
|
1036
|
+
super(...arguments);
|
|
1037
|
+
r(this, "_value", "");
|
|
1038
|
+
r(this, "_label", "");
|
|
1039
|
+
r(this, "_placeholder", "");
|
|
1040
|
+
r(this, "_disabled", !1);
|
|
1041
|
+
r(this, "_error");
|
|
1042
|
+
r(this, "_multiple", !1);
|
|
1043
|
+
r(this, "_options", []);
|
|
1044
|
+
r(this, "_onChange");
|
|
1045
|
+
r(this, "_onAdd");
|
|
1046
|
+
}
|
|
1047
|
+
value(e) {
|
|
1048
|
+
return this._value = e, this;
|
|
1049
|
+
}
|
|
1050
|
+
label(e) {
|
|
1051
|
+
return this._label = e, this;
|
|
1052
|
+
}
|
|
1053
|
+
placeholder(e) {
|
|
1054
|
+
return this._placeholder = e, this;
|
|
1055
|
+
}
|
|
1056
|
+
options(e) {
|
|
1057
|
+
return this._options = e, this;
|
|
1058
|
+
}
|
|
1059
|
+
multiple(e = !0) {
|
|
1060
|
+
return this._multiple = e, this;
|
|
1061
|
+
}
|
|
1062
|
+
disabled(e = !0) {
|
|
1063
|
+
return this._disabled = e, this;
|
|
1064
|
+
}
|
|
1065
|
+
error(e) {
|
|
1066
|
+
return this._error = e, this;
|
|
1067
|
+
}
|
|
1068
|
+
onChange(e) {
|
|
1069
|
+
return this._onChange = e, this;
|
|
1070
|
+
}
|
|
1071
|
+
onAdd(e) {
|
|
1072
|
+
return this._onAdd = e, this;
|
|
1073
|
+
}
|
|
1074
|
+
build() {
|
|
1075
|
+
const l = {
|
|
1076
|
+
containerClass: B("fibo-textfield-container relative", ...this._classNames),
|
|
1077
|
+
containerStyle: this.getStyle(),
|
|
1078
|
+
label: this._label,
|
|
1079
|
+
error: this._error,
|
|
1080
|
+
value: this._value,
|
|
1081
|
+
placeholder: this._placeholder,
|
|
1082
|
+
options: this._options,
|
|
1083
|
+
disabled: this._disabled,
|
|
1084
|
+
multiple: this._multiple,
|
|
1085
|
+
onChange: this._onChange,
|
|
1086
|
+
onAdd: this._onAdd,
|
|
1087
|
+
...this._props
|
|
1088
|
+
};
|
|
1089
|
+
return t.createElement(se, l);
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
const xe = $(ne);
|
|
1093
|
+
export {
|
|
1094
|
+
de as B,
|
|
1095
|
+
pe as C,
|
|
1096
|
+
me as R,
|
|
1097
|
+
ue as S,
|
|
1098
|
+
he as T,
|
|
1099
|
+
be as a,
|
|
1100
|
+
fe as b,
|
|
1101
|
+
xe as c
|
|
1102
|
+
};
|