@floegence/floe-webapp-core 0.86.36 → 0.86.38

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.
@@ -0,0 +1,9 @@
1
+ import { type Accessor, type JSX } from 'solid-js';
2
+ export interface KeyedForProps<T, K extends string | number> {
3
+ each: readonly T[] | null | undefined;
4
+ by: (item: T) => K;
5
+ children: (item: Accessor<T>, index: Accessor<number>) => JSX.Element;
6
+ fallback?: JSX.Element;
7
+ }
8
+ /** Retain list owners by semantic identity while observing replacement values. */
9
+ export declare function KeyedFor<T, K extends string | number>(props: KeyedForProps<T, K>): JSX.Element;
@@ -0,0 +1,32 @@
1
+ import { createComponent as a } from "solid-js/web";
2
+ import { createMemo as s, For as u } from "solid-js";
3
+ function h(r) {
4
+ const o = s(() => {
5
+ const e = /* @__PURE__ */ new Map(), t = [];
6
+ for (const c of r.each ?? []) {
7
+ const n = r.by(c);
8
+ if (e.has(n)) throw new Error("KeyedFor requires unique keys");
9
+ e.set(n, c), t.push(n);
10
+ }
11
+ return {
12
+ values: e,
13
+ keys: t
14
+ };
15
+ });
16
+ return a(u, {
17
+ get each() {
18
+ return o().keys;
19
+ },
20
+ get fallback() {
21
+ return r.fallback;
22
+ },
23
+ children: (e, t) => (
24
+ // Render callbacks receive accessors intentionally; the child owns their reads.
25
+ // eslint-disable-next-line solid/reactivity
26
+ r.children(() => o().values.get(e), t)
27
+ )
28
+ });
29
+ }
30
+ export {
31
+ h as KeyedFor
32
+ };
@@ -1,8 +1,9 @@
1
- import { insert as a, createComponent as s, memo as V, effect as b, className as x, mergeProps as A, template as h, setAttribute as z, delegateEvents as D } from "solid-js/web";
2
- import { splitProps as I, createMemo as $, For as N, Show as v, createSignal as O } from "solid-js";
1
+ import { insert as a, createComponent as s, memo as V, effect as b, className as x, mergeProps as A, template as p, setAttribute as z, delegateEvents as D } from "solid-js/web";
2
+ import { splitProps as I, createMemo as $, Show as v, createSignal as K } from "solid-js";
3
+ import { KeyedFor as N } from "./KeyedFor.js";
3
4
  import { cn as m } from "../../utils/cn.js";
4
- import { Check as T } from "../icons/index.js";
5
- var U = /* @__PURE__ */ h("<div data-floe-surface-part=step>"), L = /* @__PURE__ */ h("<span>"), q = /* @__PURE__ */ h('<span class="text-muted-foreground/60 font-normal">(Optional)'), B = /* @__PURE__ */ h("<p>"), G = /* @__PURE__ */ h("<div><div><span>"), H = /* @__PURE__ */ h("<div data-floe-surface=inset data-floe-surface-part=progress-track>"), J = /* @__PURE__ */ h("<nav aria-label=Progress>"), K = /* @__PURE__ */ h('<div class="flex items-center w-full">'), Q = /* @__PURE__ */ h("<div class=mt-2>"), R = /* @__PURE__ */ h('<div class="flex flex-col items-center">'), X = /* @__PURE__ */ h('<div class="flex-1 pb-4">'), W = /* @__PURE__ */ h("<div>"), Y = /* @__PURE__ */ h('<div class="flex flex-col h-full"><div class="flex-shrink-0 mb-6"></div><div>');
5
+ import { Check as O } from "../icons/index.js";
6
+ var T = /* @__PURE__ */ p("<div data-floe-surface-part=step>"), L = /* @__PURE__ */ p("<span>"), U = /* @__PURE__ */ p('<span class="text-muted-foreground/60 font-normal">(Optional)'), q = /* @__PURE__ */ p("<p>"), B = /* @__PURE__ */ p("<div><div><span>"), G = /* @__PURE__ */ p("<div data-floe-surface=inset data-floe-surface-part=progress-track>"), H = /* @__PURE__ */ p("<nav aria-label=Progress>"), J = /* @__PURE__ */ p('<div class="flex items-center w-full">'), Q = /* @__PURE__ */ p("<div class=mt-2>"), R = /* @__PURE__ */ p('<div class="flex flex-col items-center">'), X = /* @__PURE__ */ p('<div class="flex-1 pb-4">'), W = /* @__PURE__ */ p("<div>"), Y = /* @__PURE__ */ p('<div class="flex flex-col h-full"><div class="flex-shrink-0 mb-6"></div><div>');
6
7
  const F = {
7
8
  sm: {
8
9
  indicator: "w-6 h-6 text-[10px]",
@@ -33,11 +34,11 @@ const F = {
33
34
  }
34
35
  };
35
36
  function M(t) {
36
- const e = () => F[t.size], i = () => t.status === "completed", c = () => t.status === "current", o = () => m("flex items-center justify-center rounded-full transition-all duration-200", "font-medium select-none flex-shrink-0", e().indicator, t.clickable && !t.step.disabled ? "cursor-pointer hover:scale-110" : t.step.disabled ? "cursor-not-allowed opacity-50" : ""), p = () => t.variant === "dots" ? m("w-3 h-3 md:w-4 md:h-4", i() && "bg-primary", c() && "bg-primary ring-4 ring-primary/20", !i() && !c() && "bg-muted") : t.variant === "minimal" ? m("border-2", i() && "border-primary bg-primary text-primary-foreground", c() && "border-primary text-primary bg-transparent", !i() && !c() && "border-muted text-muted-foreground bg-transparent") : m(i() && "bg-primary text-primary-foreground shadow-sm", c() && "bg-primary text-primary-foreground shadow-md ring-4 ring-primary/20", !i() && !c() && "bg-muted text-muted-foreground"), u = () => {
37
+ const e = () => F[t.size], i = () => t.status === "completed", c = () => t.status === "current", o = () => m("flex items-center justify-center rounded-full transition-all duration-200", "font-medium select-none flex-shrink-0", e().indicator, t.clickable && !t.step.disabled ? "cursor-pointer hover:scale-110" : t.step.disabled ? "cursor-not-allowed opacity-50" : ""), h = () => t.variant === "dots" ? m("w-3 h-3 md:w-4 md:h-4", i() && "bg-primary", c() && "bg-primary ring-4 ring-primary/20", !i() && !c() && "bg-muted") : t.variant === "minimal" ? m("border-2", i() && "border-primary bg-primary text-primary-foreground", c() && "border-primary text-primary bg-transparent", !i() && !c() && "border-muted text-muted-foreground bg-transparent") : m(i() && "bg-primary text-primary-foreground shadow-sm", c() && "bg-primary text-primary-foreground shadow-md ring-4 ring-primary/20", !i() && !c() && "bg-muted text-muted-foreground"), u = () => {
37
38
  t.clickable && !t.step.disabled && t.onClick && t.onClick();
38
39
  };
39
40
  return (() => {
40
- var n = U();
41
+ var n = T();
41
42
  return n.$$keydown = (r) => {
42
43
  (r.key === "Enter" || r.key === " ") && (r.preventDefault(), u());
43
44
  }, n.$$click = u, a(n, s(v, {
@@ -67,7 +68,7 @@ function M(t) {
67
68
  });
68
69
  },
69
70
  get children() {
70
- return s(T, {
71
+ return s(O, {
71
72
  get class() {
72
73
  return e().iconSize;
73
74
  }
@@ -76,7 +77,7 @@ function M(t) {
76
77
  });
77
78
  }
78
79
  })), b((r) => {
79
- var g = c() || i() ? "raised" : "inset", C = c() ? "current" : i() ? "completed" : "pending", k = m(o(), p()), d = t.clickable ? "button" : void 0, l = t.clickable && !t.step.disabled ? 0 : void 0;
80
+ var g = c() || i() ? "raised" : "inset", C = c() ? "current" : i() ? "completed" : "pending", k = m(o(), h()), d = t.clickable ? "button" : void 0, l = t.clickable && !t.step.disabled ? 0 : void 0;
80
81
  return g !== r.e && z(n, "data-floe-surface", r.e = g), C !== r.t && z(n, "data-floe-step-state", r.t = C), k !== r.a && x(n, r.a = k), d !== r.o && z(n, "role", r.o = d), l !== r.i && z(n, "tabindex", r.i = l), r;
81
82
  }, {
82
83
  e: void 0,
@@ -90,25 +91,25 @@ function M(t) {
90
91
  function j(t) {
91
92
  const e = () => F[t.size], i = () => t.status === "current", c = () => t.status === "upcoming";
92
93
  return (() => {
93
- var o = G(), p = o.firstChild, u = p.firstChild;
94
- return a(u, () => t.step.label), a(p, s(v, {
94
+ var o = B(), h = o.firstChild, u = h.firstChild;
95
+ return a(u, () => t.step.label), a(h, s(v, {
95
96
  get when() {
96
97
  return t.step.optional;
97
98
  },
98
99
  get children() {
99
- return q();
100
+ return U();
100
101
  }
101
102
  }), null), a(o, s(v, {
102
103
  get when() {
103
104
  return t.step.description;
104
105
  },
105
106
  get children() {
106
- var n = B();
107
+ var n = q();
107
108
  return a(n, () => t.step.description), b(() => x(n, m(e().description, "text-muted-foreground", c() && "opacity-60", t.step.disabled && "opacity-50"))), n;
108
109
  }
109
110
  }), null), b((n) => {
110
111
  var r = m("flex flex-col", e().gap, t.orientation === "horizontal" ? "items-center text-center" : "items-start"), g = m("flex items-center gap-1", e().label, "font-medium transition-colors duration-200", i() && "text-foreground", !i() && "text-muted-foreground", t.step.disabled && "opacity-50");
111
- return r !== n.e && x(o, n.e = r), g !== n.t && x(p, n.t = g), n;
112
+ return r !== n.e && x(o, n.e = r), g !== n.t && x(h, n.t = g), n;
112
113
  }, {
113
114
  e: void 0,
114
115
  t: void 0
@@ -118,12 +119,12 @@ function j(t) {
118
119
  function E(t) {
119
120
  const e = () => F[t.size];
120
121
  return (() => {
121
- var i = H();
122
+ var i = G();
122
123
  return b(() => x(i, m("transition-colors duration-300", t.orientation === "horizontal" ? m("flex-1", e().connector) : m(e().connectorVertical, "mx-auto"), t.completed ? "bg-primary" : "bg-muted"))), i;
123
124
  })();
124
125
  }
125
126
  function Z(t) {
126
- const [e] = I(t, ["steps", "currentStep", "onStepClick", "variant", "orientation", "size", "showConnector", "allowClickCompleted", "allowClickFuture", "class"]), i = () => e.variant ?? "default", c = () => e.orientation ?? "horizontal", o = () => e.size ?? "md", p = () => e.showConnector ?? !0, u = () => e.allowClickCompleted ?? !0, n = () => e.allowClickFuture ?? !1, r = $(() => typeof e.currentStep == "function" ? e.currentStep() : e.currentStep), g = (d) => {
127
+ const [e] = I(t, ["steps", "currentStep", "onStepClick", "variant", "orientation", "size", "showConnector", "allowClickCompleted", "allowClickFuture", "class"]), i = () => e.variant ?? "default", c = () => e.orientation ?? "horizontal", o = () => e.size ?? "md", h = () => e.showConnector ?? !0, u = () => e.allowClickCompleted ?? !0, n = () => e.allowClickFuture ?? !1, r = $(() => typeof e.currentStep == "function" ? e.currentStep() : e.currentStep), g = (d) => {
127
128
  const l = r();
128
129
  return d < l ? "completed" : d === l ? "current" : "upcoming";
129
130
  }, C = (d) => {
@@ -134,11 +135,12 @@ function Z(t) {
134
135
  C(d) && !l.disabled && e.onStepClick?.(d, l);
135
136
  };
136
137
  return (() => {
137
- var d = J();
138
+ var d = H();
138
139
  return a(d, s(N, {
139
140
  get each() {
140
141
  return e.steps;
141
142
  },
143
+ by: (l) => l.id,
142
144
  children: (l, w) => {
143
145
  const S = () => g(w()), P = () => C(w()), _ = () => w() === e.steps.length - 1;
144
146
  return (() => {
@@ -149,9 +151,11 @@ function Z(t) {
149
151
  },
150
152
  get children() {
151
153
  return [(() => {
152
- var f = K();
154
+ var f = J();
153
155
  return a(f, s(M, {
154
- step: l,
156
+ get step() {
157
+ return l();
158
+ },
155
159
  get index() {
156
160
  return w();
157
161
  },
@@ -164,13 +168,13 @@ function Z(t) {
164
168
  get size() {
165
169
  return o();
166
170
  },
167
- onClick: () => k(w(), l),
171
+ onClick: () => k(w(), l()),
168
172
  get clickable() {
169
173
  return P();
170
174
  }
171
175
  }), null), a(f, s(v, {
172
176
  get when() {
173
- return V(() => !!p())() && !_();
177
+ return V(() => !!h())() && !_();
174
178
  },
175
179
  get children() {
176
180
  return s(E, {
@@ -187,7 +191,9 @@ function Z(t) {
187
191
  })(), (() => {
188
192
  var f = Q();
189
193
  return a(f, s(j, {
190
- step: l,
194
+ get step() {
195
+ return l();
196
+ },
191
197
  get status() {
192
198
  return S();
193
199
  },
@@ -206,7 +212,9 @@ function Z(t) {
206
212
  return [(() => {
207
213
  var f = R();
208
214
  return a(f, s(M, {
209
- step: l,
215
+ get step() {
216
+ return l();
217
+ },
210
218
  get index() {
211
219
  return w();
212
220
  },
@@ -219,13 +227,13 @@ function Z(t) {
219
227
  get size() {
220
228
  return o();
221
229
  },
222
- onClick: () => k(w(), l),
230
+ onClick: () => k(w(), l()),
223
231
  get clickable() {
224
232
  return P();
225
233
  }
226
234
  }), null), a(f, s(v, {
227
235
  get when() {
228
- return V(() => !!p())() && !_();
236
+ return V(() => !!h())() && !_();
229
237
  },
230
238
  get children() {
231
239
  return s(E, {
@@ -242,7 +250,9 @@ function Z(t) {
242
250
  })(), (() => {
243
251
  var f = X();
244
252
  return a(f, s(j, {
245
- step: l,
253
+ get step() {
254
+ return l();
255
+ },
246
256
  get status() {
247
257
  return S();
248
258
  },
@@ -259,18 +269,18 @@ function Z(t) {
259
269
  })), b(() => x(d, m("flex", c() === "horizontal" ? "flex-row items-start justify-between" : "flex-col", e.class))), d;
260
270
  })();
261
271
  }
262
- function it(t) {
272
+ function ot(t) {
263
273
  const [e, i] = I(t, ["steps", "footer", "contentClass", "footerClass"]), c = () => e.steps.map(({
264
274
  content: u,
265
275
  ...n
266
- }) => n), o = $(() => typeof t.currentStep == "function" ? t.currentStep() : t.currentStep), p = () => e.steps[o()]?.content;
276
+ }) => n), o = $(() => typeof t.currentStep == "function" ? t.currentStep() : t.currentStep), h = () => e.steps[o()]?.content;
267
277
  return (() => {
268
278
  var u = Y(), n = u.firstChild, r = n.nextSibling;
269
279
  return a(n, s(Z, A(i, {
270
280
  get steps() {
271
281
  return c();
272
282
  }
273
- }))), a(r, p), a(u, s(v, {
283
+ }))), a(r, h), a(u, s(v, {
274
284
  get when() {
275
285
  return e.footer;
276
286
  },
@@ -281,14 +291,14 @@ function it(t) {
281
291
  }), null), b(() => x(r, m("flex-1 min-h-0", e.contentClass))), u;
282
292
  })();
283
293
  }
284
- function ot(t) {
294
+ function lt(t) {
285
295
  const {
286
296
  totalSteps: e,
287
297
  initialStep: i = 0,
288
298
  onStepChange: c
289
- } = t, [o, p] = O(i), u = (d) => {
299
+ } = t, [o, h] = K(i), u = (d) => {
290
300
  const l = Math.max(0, Math.min(d, e - 1));
291
- p(l), c?.(l);
301
+ h(l), c?.(l);
292
302
  }, n = () => {
293
303
  o() < e - 1 && u(o() + 1);
294
304
  }, r = () => {
@@ -309,6 +319,6 @@ function ot(t) {
309
319
  D(["click", "keydown"]);
310
320
  export {
311
321
  Z as Stepper,
312
- it as Wizard,
313
- ot as useWizard
322
+ ot as Wizard,
323
+ lt as useWizard
314
324
  };
@@ -46,3 +46,4 @@ export { LinearProgress, CircularProgress, SegmentedProgress, StepsProgress, typ
46
46
  export { SurfaceAnchoredLayer, type SurfaceAnchoredLayerProps } from './SurfaceAnchoredLayer';
47
47
  export { PersistentHorizontalScrollbar, type PersistentHorizontalScrollbarProps } from './PersistentHorizontalScrollbar';
48
48
  export { SettingsLayout, SettingsNavigation, SettingsSection, SettingsList, SettingRow, type SettingsNavigationItem, type SettingsNavigationGroup, type SettingsNavigationProps, type SettingsSectionProps, type SettingRowProps, } from './Settings';
49
+ export { KeyedFor, type KeyedForProps } from './KeyedFor';