@floegence/floe-webapp-core 0.50.6 → 0.51.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/dist/components/chat/input/ChatInput.js +8 -8
- package/dist/components/ui/Button.js +16 -13
- package/dist/components/ui/Card.js +125 -119
- package/dist/components/ui/Checkbox.js +178 -132
- package/dist/components/ui/CommandPalette.js +10 -10
- package/dist/components/ui/Dialog.js +1 -1
- package/dist/components/ui/DirectoryInput.js +5 -5
- package/dist/components/ui/Dropdown.d.ts +2 -0
- package/dist/components/ui/Dropdown.js +119 -114
- package/dist/components/ui/FloatingWindow.js +211 -199
- package/dist/components/ui/HighlightBlock.js +8 -8
- package/dist/components/ui/Input.js +40 -40
- package/dist/components/ui/Pagination.js +90 -88
- package/dist/components/ui/ProcessingIndicator.js +1 -1
- package/dist/components/ui/Progress.js +99 -88
- package/dist/components/ui/QuoteBlock.js +9 -9
- package/dist/components/ui/Radio.js +151 -127
- package/dist/components/ui/SegmentedControl.js +26 -25
- package/dist/components/ui/Stepper.js +114 -112
- package/dist/components/ui/Switch.js +34 -33
- package/dist/components/ui/Tabs.js +153 -150
- package/dist/components/ui/Tag.js +24 -21
- package/dist/components/ui/Tooltip.js +10 -10
- package/dist/components/ui/floatingPresence.js +40 -30
- package/dist/components/workbench/WorkbenchHud.js +9 -9
- package/dist/components/workbench/WorkbenchLockButton.js +4 -4
- package/dist/components/workbench/WorkbenchWidget.js +46 -43
- package/dist/context/FloeConfigContext.d.ts +5 -1
- package/dist/context/FloeConfigContext.js +10 -9
- package/dist/context/ThemeContext.d.ts +3 -1
- package/dist/context/ThemeContext.js +78 -71
- package/dist/floe.css +1 -0
- package/dist/full.js +839 -836
- package/dist/index.js +150 -147
- package/dist/input-focus.css +0 -1
- package/dist/styles/themes/index.d.ts +3 -0
- package/dist/styles/themes/index.js +40 -31
- package/dist/styles/tokens.d.ts +36 -0
- package/dist/styles/tokens.js +12 -5
- package/dist/styles.css +1 -1
- package/dist/surface.css +467 -0
- package/dist/themes.d.ts +1 -1
- package/dist/ui.css +9 -0
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import { splitProps as
|
|
3
|
-
import { cn as
|
|
4
|
-
var H = /* @__PURE__ */ m("<div role=radiogroup>"), U = /* @__PURE__ */ m("<input type=radio>"), V = /* @__PURE__ */ m("<div><div>"),
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
const
|
|
8
|
-
if (!
|
|
1
|
+
import { createComponent as l, spread as G, mergeProps as I, insert as a, effect as g, className as f, setAttribute as p, template as m } from "solid-js/web";
|
|
2
|
+
import { splitProps as j, createUniqueId as M, For as A, Switch as B, Match as R, Show as x, createContext as D, useContext as F } from "solid-js";
|
|
3
|
+
import { cn as c } from "../../utils/cn.js";
|
|
4
|
+
var H = /* @__PURE__ */ m("<div role=radiogroup>"), U = /* @__PURE__ */ m("<input data-floe-choice-input type=radio>"), V = /* @__PURE__ */ m("<div data-floe-surface=inset data-floe-surface-part=indicator><div data-floe-surface=flat data-floe-surface-part=radio-dot>"), $ = /* @__PURE__ */ m("<span>"), J = /* @__PURE__ */ m('<div class="flex flex-col">'), K = /* @__PURE__ */ m('<label><div class="relative flex items-center justify-center pt-0.5">'), Q = /* @__PURE__ */ m("<label data-floe-surface-part=choice><span class=font-medium>"), T = /* @__PURE__ */ m('<div class="absolute top-2 right-2"><svg class="w-4 h-4 text-primary"fill=currentColor viewBox="0 0 20 20"><path fill-rule=evenodd d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"clip-rule=evenodd>'), W = /* @__PURE__ */ m('<label data-floe-surface-part=choice><div class="flex items-start gap-3"><div class="flex items-center justify-center pt-0.5"></div><div class="flex flex-col flex-1 min-w-0">'), X = /* @__PURE__ */ m('<div class="absolute top-1.5 right-1.5"><div class="w-2 h-2 rounded-full bg-primary">'), Y = /* @__PURE__ */ m("<label data-floe-surface-part=choice>"), Z = /* @__PURE__ */ m("<div>");
|
|
5
|
+
const O = D();
|
|
6
|
+
function ee() {
|
|
7
|
+
const y = F(O);
|
|
8
|
+
if (!y)
|
|
9
9
|
throw new Error("RadioOption must be used within a RadioGroup");
|
|
10
|
-
return
|
|
10
|
+
return y;
|
|
11
11
|
}
|
|
12
|
-
const
|
|
12
|
+
const C = {
|
|
13
13
|
sm: {
|
|
14
14
|
outer: "w-3.5 h-3.5",
|
|
15
15
|
inner: "w-1.5 h-1.5",
|
|
@@ -28,15 +28,15 @@ const v = {
|
|
|
28
28
|
label: "text-sm",
|
|
29
29
|
description: "text-xs"
|
|
30
30
|
}
|
|
31
|
-
},
|
|
31
|
+
}, re = {
|
|
32
32
|
sm: "px-2.5 py-1 text-xs",
|
|
33
33
|
md: "px-3 py-1.5 text-xs",
|
|
34
34
|
lg: "px-4 py-2 text-sm"
|
|
35
|
-
},
|
|
35
|
+
}, te = {
|
|
36
36
|
sm: "p-2.5",
|
|
37
37
|
md: "p-3",
|
|
38
38
|
lg: "p-4"
|
|
39
|
-
},
|
|
39
|
+
}, E = {
|
|
40
40
|
sm: {
|
|
41
41
|
container: "p-3 min-w-[80px]",
|
|
42
42
|
icon: "w-5 h-5"
|
|
@@ -50,222 +50,246 @@ const v = {
|
|
|
50
50
|
icon: "w-8 h-8"
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
-
function
|
|
54
|
-
const [
|
|
55
|
-
value: () =>
|
|
56
|
-
onChange: (
|
|
57
|
-
size: () =>
|
|
53
|
+
function ne(y) {
|
|
54
|
+
const [s, t] = j(y, ["value", "onChange", "size", "orientation", "variant", "disabled", "name", "class", "children"]), w = M(), k = () => s.name ?? w, _ = () => s.variant ?? "default", v = {
|
|
55
|
+
value: () => s.value,
|
|
56
|
+
onChange: (u) => s.onChange?.(u),
|
|
57
|
+
size: () => s.size ?? "md",
|
|
58
58
|
variant: _,
|
|
59
|
-
disabled: () =>
|
|
60
|
-
name:
|
|
61
|
-
},
|
|
62
|
-
const
|
|
63
|
-
return
|
|
59
|
+
disabled: () => s.disabled ?? !1,
|
|
60
|
+
name: k
|
|
61
|
+
}, h = () => {
|
|
62
|
+
const u = _(), d = s.orientation === "horizontal";
|
|
63
|
+
return u === "button" ? c("inline-flex rounded-md border border-border overflow-hidden", d ? "flex-row" : "flex-col") : u === "card" || u === "tile" ? c("grid gap-2", d ? "grid-flow-col auto-cols-fr" : "grid-cols-1") : c("flex", d ? "flex-row flex-wrap gap-4" : "flex-col gap-2");
|
|
64
64
|
};
|
|
65
|
-
return
|
|
66
|
-
value:
|
|
65
|
+
return l(O.Provider, {
|
|
66
|
+
value: v,
|
|
67
67
|
get children() {
|
|
68
|
-
var
|
|
69
|
-
return
|
|
68
|
+
var u = H();
|
|
69
|
+
return G(u, I({
|
|
70
|
+
get "data-floe-surface"() {
|
|
71
|
+
return _() === "button" ? "inset" : void 0;
|
|
72
|
+
},
|
|
73
|
+
get "data-floe-surface-part"() {
|
|
74
|
+
return _() === "button" ? "rail" : void 0;
|
|
75
|
+
},
|
|
70
76
|
get class() {
|
|
71
|
-
return
|
|
77
|
+
return c(h(), s.class);
|
|
72
78
|
}
|
|
73
|
-
},
|
|
79
|
+
}, t), !1, !0), a(u, () => s.children), u;
|
|
74
80
|
}
|
|
75
81
|
});
|
|
76
82
|
}
|
|
77
|
-
function
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
var
|
|
82
|
-
return
|
|
83
|
+
function oe(y) {
|
|
84
|
+
const s = ee(), [t, w] = j(y, ["value", "label", "description", "icon", "size", "class", "disabled", "id"]), k = M(), _ = () => t.id ?? k, v = () => t.size ?? s.size(), h = () => s.variant(), u = () => t.disabled ?? s.disabled(), d = () => s.value() === t.value, q = () => {
|
|
85
|
+
u() || s.onChange(t.value);
|
|
86
|
+
}, S = (e) => (() => {
|
|
87
|
+
var r = U();
|
|
88
|
+
return r.addEventListener("change", q), G(r, I({
|
|
83
89
|
get id() {
|
|
84
90
|
return _();
|
|
85
91
|
},
|
|
86
92
|
get name() {
|
|
87
|
-
return
|
|
93
|
+
return s.name();
|
|
88
94
|
},
|
|
89
95
|
get value() {
|
|
90
|
-
return
|
|
96
|
+
return t.value;
|
|
91
97
|
},
|
|
92
98
|
get checked() {
|
|
93
|
-
return
|
|
99
|
+
return d();
|
|
94
100
|
},
|
|
95
101
|
get disabled() {
|
|
96
|
-
return
|
|
102
|
+
return u();
|
|
97
103
|
},
|
|
98
104
|
get class() {
|
|
99
|
-
return
|
|
105
|
+
return e.class ?? "sr-only peer";
|
|
100
106
|
}
|
|
101
|
-
},
|
|
102
|
-
})(),
|
|
103
|
-
var
|
|
104
|
-
return
|
|
105
|
-
var
|
|
106
|
-
return
|
|
107
|
+
}, w), !1, !1), r;
|
|
108
|
+
})(), L = () => (() => {
|
|
109
|
+
var e = V(), r = e.firstChild;
|
|
110
|
+
return g((n) => {
|
|
111
|
+
var i = d() ? "true" : void 0, o = c("rounded-full border-2 transition-colors duration-150", "flex items-center justify-center", C[v()].outer, d() ? "border-primary bg-primary" : c("border-input bg-background", h() === "default" && "hover:border-primary/50"), u() && "cursor-not-allowed", "peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-focus-visible:ring-offset-2"), b = c("rounded-full bg-primary-foreground transition-transform duration-150", C[v()].inner, d() ? "scale-100" : "scale-0");
|
|
112
|
+
return i !== n.e && p(e, "data-floe-selected", n.e = i), o !== n.t && f(e, n.t = o), b !== n.a && f(r, n.a = b), n;
|
|
107
113
|
}, {
|
|
108
114
|
e: void 0,
|
|
109
|
-
t: void 0
|
|
110
|
-
|
|
115
|
+
t: void 0,
|
|
116
|
+
a: void 0
|
|
117
|
+
}), e;
|
|
111
118
|
})();
|
|
112
|
-
return
|
|
119
|
+
return l(B, {
|
|
113
120
|
get children() {
|
|
114
|
-
return [
|
|
121
|
+
return [l(R, {
|
|
115
122
|
get when() {
|
|
116
|
-
return
|
|
123
|
+
return h() === "default";
|
|
117
124
|
},
|
|
118
125
|
get children() {
|
|
119
|
-
var
|
|
120
|
-
return
|
|
126
|
+
var e = K(), r = e.firstChild;
|
|
127
|
+
return a(r, l(S, {}), null), a(r, l(L, {}), null), a(e, l(x, {
|
|
121
128
|
get when() {
|
|
122
|
-
return
|
|
129
|
+
return t.label || t.description;
|
|
123
130
|
},
|
|
124
131
|
get children() {
|
|
125
|
-
var
|
|
126
|
-
return
|
|
132
|
+
var n = J();
|
|
133
|
+
return a(n, l(x, {
|
|
127
134
|
get when() {
|
|
128
|
-
return
|
|
135
|
+
return t.label;
|
|
129
136
|
},
|
|
130
137
|
get children() {
|
|
131
|
-
var
|
|
132
|
-
return
|
|
138
|
+
var i = $();
|
|
139
|
+
return a(i, () => t.label), g(() => f(i, c("text-foreground", C[v()].label))), i;
|
|
133
140
|
}
|
|
134
|
-
}), null),
|
|
141
|
+
}), null), a(n, l(x, {
|
|
135
142
|
get when() {
|
|
136
|
-
return
|
|
143
|
+
return t.description;
|
|
137
144
|
},
|
|
138
145
|
get children() {
|
|
139
|
-
var
|
|
140
|
-
return
|
|
146
|
+
var i = $();
|
|
147
|
+
return a(i, () => t.description), g(() => f(i, c("text-muted-foreground", C[v()].description))), i;
|
|
141
148
|
}
|
|
142
|
-
}), null),
|
|
149
|
+
}), null), n;
|
|
143
150
|
}
|
|
144
|
-
}), null),
|
|
151
|
+
}), null), g(() => f(e, c("inline-flex items-start gap-2 cursor-pointer select-none", u() && "opacity-50 cursor-not-allowed", t.class))), e;
|
|
145
152
|
}
|
|
146
|
-
}),
|
|
153
|
+
}), l(R, {
|
|
147
154
|
get when() {
|
|
148
|
-
return
|
|
155
|
+
return h() === "button";
|
|
149
156
|
},
|
|
150
157
|
get children() {
|
|
151
|
-
var
|
|
152
|
-
return
|
|
158
|
+
var e = Q(), r = e.firstChild;
|
|
159
|
+
return a(e, l(S, {
|
|
153
160
|
class: "sr-only"
|
|
154
|
-
}),
|
|
161
|
+
}), r), a(r, () => t.label), g((n) => {
|
|
162
|
+
var i = d() ? "inset" : "raised", o = d() ? "true" : void 0, b = h(), z = c("cursor-pointer select-none transition-colors duration-150", "border-r border-border last:border-r-0", re[v()], d() ? "bg-primary text-primary-foreground" : "bg-background text-foreground hover:bg-muted", u() && "opacity-50 cursor-not-allowed", t.class);
|
|
163
|
+
return i !== n.e && p(e, "data-floe-surface", n.e = i), o !== n.t && p(e, "data-floe-selected", n.t = o), b !== n.a && p(e, "data-floe-choice-variant", n.a = b), z !== n.o && f(e, n.o = z), n;
|
|
164
|
+
}, {
|
|
165
|
+
e: void 0,
|
|
166
|
+
t: void 0,
|
|
167
|
+
a: void 0,
|
|
168
|
+
o: void 0
|
|
169
|
+
}), e;
|
|
155
170
|
}
|
|
156
|
-
}),
|
|
171
|
+
}), l(R, {
|
|
157
172
|
get when() {
|
|
158
|
-
return
|
|
173
|
+
return h() === "card";
|
|
159
174
|
},
|
|
160
175
|
get children() {
|
|
161
|
-
var
|
|
162
|
-
return
|
|
176
|
+
var e = W(), r = e.firstChild, n = r.firstChild, i = n.nextSibling;
|
|
177
|
+
return a(e, l(S, {}), r), a(n, l(L, {})), a(i, l(x, {
|
|
163
178
|
get when() {
|
|
164
|
-
return
|
|
179
|
+
return t.label;
|
|
165
180
|
},
|
|
166
181
|
get children() {
|
|
167
|
-
var
|
|
168
|
-
return
|
|
182
|
+
var o = $();
|
|
183
|
+
return a(o, () => t.label), g(() => f(o, c("font-medium text-foreground", C[v()].label))), o;
|
|
169
184
|
}
|
|
170
|
-
}), null),
|
|
185
|
+
}), null), a(i, l(x, {
|
|
171
186
|
get when() {
|
|
172
|
-
return
|
|
187
|
+
return t.description;
|
|
173
188
|
},
|
|
174
189
|
get children() {
|
|
175
|
-
var
|
|
176
|
-
return
|
|
190
|
+
var o = $();
|
|
191
|
+
return a(o, () => t.description), g(() => f(o, c("text-muted-foreground mt-0.5", C[v()].description))), o;
|
|
177
192
|
}
|
|
178
|
-
}), null),
|
|
193
|
+
}), null), a(e, l(x, {
|
|
179
194
|
get when() {
|
|
180
|
-
return
|
|
195
|
+
return d();
|
|
181
196
|
},
|
|
182
197
|
get children() {
|
|
183
|
-
return
|
|
198
|
+
return T();
|
|
184
199
|
}
|
|
185
|
-
}), null),
|
|
186
|
-
var
|
|
187
|
-
return
|
|
200
|
+
}), null), g((o) => {
|
|
201
|
+
var b = d() ? "inset" : "raised", z = d() ? "true" : void 0, N = h(), P = c("relative cursor-pointer select-none rounded-lg border-2 transition-all duration-150", te[v()], d() ? "border-primary bg-primary/5" : "border-border bg-background hover:border-primary/50 hover:bg-muted/50", u() && "opacity-50 cursor-not-allowed", t.class);
|
|
202
|
+
return b !== o.e && p(e, "data-floe-surface", o.e = b), z !== o.t && p(e, "data-floe-selected", o.t = z), N !== o.a && p(e, "data-floe-choice-variant", o.a = N), P !== o.o && f(e, o.o = P), o;
|
|
188
203
|
}, {
|
|
189
204
|
e: void 0,
|
|
190
205
|
t: void 0,
|
|
191
|
-
a: void 0
|
|
192
|
-
|
|
206
|
+
a: void 0,
|
|
207
|
+
o: void 0
|
|
208
|
+
}), e;
|
|
193
209
|
}
|
|
194
|
-
}),
|
|
210
|
+
}), l(R, {
|
|
195
211
|
get when() {
|
|
196
|
-
return
|
|
212
|
+
return h() === "tile";
|
|
197
213
|
},
|
|
198
214
|
get children() {
|
|
199
|
-
var
|
|
200
|
-
return
|
|
215
|
+
var e = Y();
|
|
216
|
+
return a(e, l(S, {
|
|
201
217
|
class: "sr-only"
|
|
202
|
-
}), null),
|
|
218
|
+
}), null), a(e, l(x, {
|
|
203
219
|
get when() {
|
|
204
|
-
return
|
|
220
|
+
return t.icon;
|
|
205
221
|
},
|
|
206
|
-
children: (
|
|
207
|
-
const
|
|
222
|
+
children: (r) => {
|
|
223
|
+
const n = r();
|
|
208
224
|
return (() => {
|
|
209
|
-
var
|
|
210
|
-
return
|
|
225
|
+
var i = Z();
|
|
226
|
+
return a(i, l(n, {
|
|
211
227
|
get class() {
|
|
212
|
-
return
|
|
228
|
+
return E[v()].icon;
|
|
213
229
|
}
|
|
214
|
-
})),
|
|
230
|
+
})), g(() => f(i, c("mb-2 transition-colors duration-150", d() ? "text-primary" : "text-muted-foreground"))), i;
|
|
215
231
|
})();
|
|
216
232
|
}
|
|
217
|
-
}), null),
|
|
233
|
+
}), null), a(e, l(x, {
|
|
218
234
|
get when() {
|
|
219
|
-
return
|
|
235
|
+
return t.label;
|
|
220
236
|
},
|
|
221
237
|
get children() {
|
|
222
|
-
var
|
|
223
|
-
return
|
|
238
|
+
var r = $();
|
|
239
|
+
return a(r, () => t.label), g(() => f(r, c("font-medium transition-colors duration-150", C[v()].label, d() ? "text-primary" : "text-foreground"))), r;
|
|
224
240
|
}
|
|
225
|
-
}), null),
|
|
241
|
+
}), null), a(e, l(x, {
|
|
226
242
|
get when() {
|
|
227
|
-
return
|
|
243
|
+
return t.description;
|
|
228
244
|
},
|
|
229
245
|
get children() {
|
|
230
|
-
var
|
|
231
|
-
return
|
|
246
|
+
var r = $();
|
|
247
|
+
return a(r, () => t.description), g(() => f(r, c("text-muted-foreground mt-0.5", C[v()].description))), r;
|
|
232
248
|
}
|
|
233
|
-
}), null),
|
|
249
|
+
}), null), a(e, l(x, {
|
|
234
250
|
get when() {
|
|
235
|
-
return
|
|
251
|
+
return d();
|
|
236
252
|
},
|
|
237
253
|
get children() {
|
|
238
|
-
return
|
|
254
|
+
return X();
|
|
239
255
|
}
|
|
240
|
-
}), null),
|
|
256
|
+
}), null), g((r) => {
|
|
257
|
+
var n = d() ? "inset" : "raised", i = d() ? "true" : void 0, o = h(), b = c("relative flex flex-col items-center justify-center cursor-pointer select-none", "rounded-lg border-2 transition-all duration-150 text-center", E[v()].container, d() ? "border-primary bg-primary/5" : "border-border bg-background hover:border-primary/50 hover:bg-muted/50", u() && "opacity-50 cursor-not-allowed", t.class);
|
|
258
|
+
return n !== r.e && p(e, "data-floe-surface", r.e = n), i !== r.t && p(e, "data-floe-selected", r.t = i), o !== r.a && p(e, "data-floe-choice-variant", r.a = o), b !== r.o && f(e, r.o = b), r;
|
|
259
|
+
}, {
|
|
260
|
+
e: void 0,
|
|
261
|
+
t: void 0,
|
|
262
|
+
a: void 0,
|
|
263
|
+
o: void 0
|
|
264
|
+
}), e;
|
|
241
265
|
}
|
|
242
266
|
})];
|
|
243
267
|
}
|
|
244
268
|
});
|
|
245
269
|
}
|
|
246
|
-
function
|
|
247
|
-
const [
|
|
248
|
-
return
|
|
270
|
+
function de(y) {
|
|
271
|
+
const [s, t] = j(y, ["options"]);
|
|
272
|
+
return l(ne, I(t, {
|
|
249
273
|
get children() {
|
|
250
|
-
return
|
|
274
|
+
return l(A, {
|
|
251
275
|
get each() {
|
|
252
|
-
return
|
|
276
|
+
return s.options;
|
|
253
277
|
},
|
|
254
|
-
children: (
|
|
278
|
+
children: (w) => l(oe, {
|
|
255
279
|
get value() {
|
|
256
|
-
return
|
|
280
|
+
return w.value;
|
|
257
281
|
},
|
|
258
282
|
get label() {
|
|
259
|
-
return
|
|
283
|
+
return w.label;
|
|
260
284
|
},
|
|
261
285
|
get description() {
|
|
262
|
-
return
|
|
286
|
+
return w.description;
|
|
263
287
|
},
|
|
264
288
|
get icon() {
|
|
265
|
-
return
|
|
289
|
+
return w.icon;
|
|
266
290
|
},
|
|
267
291
|
get disabled() {
|
|
268
|
-
return
|
|
292
|
+
return w.disabled;
|
|
269
293
|
}
|
|
270
294
|
})
|
|
271
295
|
});
|
|
@@ -273,7 +297,7 @@ function ae(x) {
|
|
|
273
297
|
}));
|
|
274
298
|
}
|
|
275
299
|
export {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
300
|
+
ne as RadioGroup,
|
|
301
|
+
de as RadioList,
|
|
302
|
+
oe as RadioOption
|
|
279
303
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { spread as
|
|
2
|
-
import { splitProps as
|
|
3
|
-
import { cn as
|
|
4
|
-
var
|
|
5
|
-
const
|
|
1
|
+
import { spread as _, mergeProps as k, insert as l, createComponent as v, memo as w, effect as z, setAttribute as b, className as $, template as p, delegateEvents as S } from "solid-js/web";
|
|
2
|
+
import { splitProps as P, For as A } from "solid-js";
|
|
3
|
+
import { cn as g } from "../../utils/cn.js";
|
|
4
|
+
var D = /* @__PURE__ */ p("<div role=group data-floe-surface=inset data-floe-surface-part=rail>"), E = /* @__PURE__ */ p('<button type=button role=radio data-floe-surface-part=segment><span class="inline-flex items-center gap-1.5">');
|
|
5
|
+
const F = {
|
|
6
6
|
sm: {
|
|
7
7
|
container: "p-0.5 gap-0.5",
|
|
8
8
|
button: "px-2 py-1 text-[11px]",
|
|
@@ -19,45 +19,46 @@ const E = {
|
|
|
19
19
|
icon: "w-4 h-4"
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
function
|
|
23
|
-
const [
|
|
24
|
-
|
|
22
|
+
function B(x) {
|
|
23
|
+
const [t, h] = P(x, ["value", "onChange", "options", "size", "disabled", "class"]), y = () => t.size ?? "md", s = () => F[y()], C = (n, r) => {
|
|
24
|
+
t.disabled || r || n !== t.value && t.onChange(n);
|
|
25
25
|
};
|
|
26
26
|
return (() => {
|
|
27
|
-
var n =
|
|
28
|
-
return
|
|
27
|
+
var n = D();
|
|
28
|
+
return _(n, k({
|
|
29
29
|
get class() {
|
|
30
|
-
return
|
|
30
|
+
return g("floe-segmented-control inline-flex items-center rounded-lg border", s().container, t.disabled && "opacity-50 pointer-events-none", t.class);
|
|
31
31
|
}
|
|
32
|
-
},
|
|
32
|
+
}, h), !1, !0), l(n, v(A, {
|
|
33
33
|
get each() {
|
|
34
|
-
return
|
|
34
|
+
return t.options;
|
|
35
35
|
},
|
|
36
|
-
children: (
|
|
37
|
-
const
|
|
36
|
+
children: (r) => {
|
|
37
|
+
const a = () => t.value === r.value, i = () => t.disabled || r.disabled;
|
|
38
38
|
return (() => {
|
|
39
|
-
var o =
|
|
40
|
-
return o.$$click = () =>
|
|
41
|
-
var
|
|
42
|
-
return () =>
|
|
39
|
+
var o = E(), c = o.firstChild;
|
|
40
|
+
return o.$$click = () => C(r.value, r.disabled), l(c, (() => {
|
|
41
|
+
var e = w(() => !!r.icon);
|
|
42
|
+
return () => e() && v(r.icon, {
|
|
43
43
|
get class() {
|
|
44
44
|
return s().icon;
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
|
-
})(), null),
|
|
48
|
-
var d =
|
|
49
|
-
return d !==
|
|
47
|
+
})(), null), l(c, () => r.label, null), z((e) => {
|
|
48
|
+
var d = a() ? "raised" : "flat", u = a(), f = i(), m = g("floe-segmented-control__item font-medium rounded-md transition-[background-color,border-color,color,box-shadow] duration-150 cursor-pointer", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1", s().button, "border", a() && "floe-segmented-control__item--active", i() && "cursor-not-allowed opacity-50");
|
|
49
|
+
return d !== e.e && b(o, "data-floe-surface", e.e = d), u !== e.t && b(o, "aria-checked", e.t = u), f !== e.a && (o.disabled = e.a = f), m !== e.o && $(o, e.o = m), e;
|
|
50
50
|
}, {
|
|
51
51
|
e: void 0,
|
|
52
52
|
t: void 0,
|
|
53
|
-
a: void 0
|
|
53
|
+
a: void 0,
|
|
54
|
+
o: void 0
|
|
54
55
|
}), o;
|
|
55
56
|
})();
|
|
56
57
|
}
|
|
57
58
|
})), n;
|
|
58
59
|
})();
|
|
59
60
|
}
|
|
60
|
-
|
|
61
|
+
S(["click"]);
|
|
61
62
|
export {
|
|
62
|
-
|
|
63
|
+
B as SegmentedControl
|
|
63
64
|
};
|