@selectwin/kit 0.1.229 → 0.1.231

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.
@@ -3,20 +3,21 @@ import { safeHref as e } from "./internal/safeHref.js";
3
3
  import { formatSelectNumber as t, useSelectLocale as n, useSelectMessages as r } from "./SelectLocale.js";
4
4
  import { useInsideFrame as i } from "./internal/frame.js";
5
5
  import { inertProps as a } from "./internal/inert.js";
6
- import { forwardRef as o, useEffect as s, useRef as c, useState as l } from "react";
7
- import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
8
- import { Link as p } from "react-router-dom";
6
+ import { SelectRing as o } from "./SelectRing.js";
7
+ import { forwardRef as s, useEffect as c, useRef as l, useState as u } from "react";
8
+ import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
9
+ import { Link as m } from "react-router-dom";
9
10
  //#region src/SelectSetupGuide.tsx
10
- function m({ status: e }) {
11
- return /* @__PURE__ */ d("span", {
11
+ function h({ status: e }) {
12
+ return /* @__PURE__ */ f("span", {
12
13
  className: `select-setupguide__icon select-setupguide__icon--${e}`,
13
14
  "aria-hidden": "true",
14
- children: e === "done" && /* @__PURE__ */ d("svg", {
15
+ children: e === "done" && /* @__PURE__ */ f("svg", {
15
16
  viewBox: "0 0 16 16",
16
17
  width: "10",
17
18
  height: "10",
18
19
  fill: "none",
19
- children: /* @__PURE__ */ d("path", {
20
+ children: /* @__PURE__ */ f("path", {
20
21
  d: "M3.5 8.5l3 3 6-7",
21
22
  stroke: "currentColor",
22
23
  strokeWidth: "2",
@@ -26,7 +27,7 @@ function m({ status: e }) {
26
27
  })
27
28
  });
28
29
  }
29
- var h = /* @__PURE__ */ d("svg", {
30
+ var g = /* @__PURE__ */ f("svg", {
30
31
  viewBox: "0 0 20 20",
31
32
  width: "16",
32
33
  height: "16",
@@ -36,70 +37,70 @@ var h = /* @__PURE__ */ d("svg", {
36
37
  strokeLinecap: "round",
37
38
  strokeLinejoin: "round",
38
39
  "aria-hidden": "true",
39
- children: /* @__PURE__ */ d("path", { d: "M8 5l5 5-5 5" })
40
+ children: /* @__PURE__ */ f("path", { d: "M8 5l5 5-5 5" })
40
41
  });
41
- function g({ group: t, justDone: n }) {
42
- let i = r().setupGuide, [o, s] = l(!!(t.collapsible && t.defaultCollapsed)), c = !t.collapsible || !o;
43
- return /* @__PURE__ */ f("div", {
42
+ function _({ group: t, justDone: n }) {
43
+ let i = r().setupGuide, [o, s] = u(!!(t.collapsible && t.defaultCollapsed)), c = !t.collapsible || !o;
44
+ return /* @__PURE__ */ p("div", {
44
45
  className: `select-setupguide__group${c ? "" : " is-collapsed"}`,
45
- children: [t.collapsible ? /* @__PURE__ */ f("button", {
46
+ children: [t.collapsible ? /* @__PURE__ */ p("button", {
46
47
  type: "button",
47
48
  className: "select-setupguide__grouptitle select-setupguide__grouptoggle",
48
49
  "aria-expanded": c,
49
50
  onClick: () => s((e) => !e),
50
- children: [/* @__PURE__ */ d("span", { children: t.title }), h]
51
- }) : /* @__PURE__ */ d("div", {
51
+ children: [/* @__PURE__ */ f("span", { children: t.title }), g]
52
+ }) : /* @__PURE__ */ f("div", {
52
53
  className: "select-setupguide__grouptitle",
53
54
  children: t.title
54
- }), /* @__PURE__ */ d("div", {
55
+ }), /* @__PURE__ */ f("div", {
55
56
  className: "select-setupguide__collapse",
56
57
  ...a(!c),
57
- children: /* @__PURE__ */ d("ul", {
58
+ children: /* @__PURE__ */ f("ul", {
58
59
  className: "select-setupguide__list",
59
60
  children: t.steps.map((t) => {
60
- let r = t.to != null || t.href != null ? e(t.to ?? t.href) : void 0, a = r !== void 0, o = /* @__PURE__ */ f(u, { children: [t.title, /* @__PURE__ */ f("span", {
61
+ let r = t.to != null || t.href != null ? e(t.to ?? t.href) : void 0, a = r !== void 0, o = /* @__PURE__ */ p(d, { children: [t.title, /* @__PURE__ */ p("span", {
61
62
  className: "select-setupguide__sr",
62
63
  children: [" — ", i[t.status]]
63
64
  })] });
64
- return /* @__PURE__ */ f("li", {
65
+ return /* @__PURE__ */ p("li", {
65
66
  className: `select-setupguide__step is-${t.status}${t.onSelect || a ? " is-link" : ""}${n.has(t.id) ? " is-just-done" : ""}`,
66
67
  children: [
67
- /* @__PURE__ */ d(m, { status: t.status }),
68
- /* @__PURE__ */ f("span", {
68
+ /* @__PURE__ */ f(h, { status: t.status }),
69
+ /* @__PURE__ */ p("span", {
69
70
  className: "select-setupguide__text",
70
- children: [a && t.to != null ? /* @__PURE__ */ d(p, {
71
+ children: [a && t.to != null ? /* @__PURE__ */ f(m, {
71
72
  to: r,
72
73
  className: "select-setupguide__steptitle select-setupguide__go",
73
74
  children: o
74
- }) : a ? /* @__PURE__ */ d("a", {
75
+ }) : a ? /* @__PURE__ */ f("a", {
75
76
  href: r,
76
77
  className: "select-setupguide__steptitle select-setupguide__go",
77
78
  children: o
78
- }) : t.onSelect ? /* @__PURE__ */ f("button", {
79
+ }) : t.onSelect ? /* @__PURE__ */ p("button", {
79
80
  type: "button",
80
81
  className: "select-setupguide__steptitle select-setupguide__go",
81
82
  onClick: t.onSelect,
82
- children: [t.title, /* @__PURE__ */ f("span", {
83
+ children: [t.title, /* @__PURE__ */ p("span", {
83
84
  className: "select-setupguide__sr",
84
85
  children: [" — ", i[t.status]]
85
86
  })]
86
- }) : /* @__PURE__ */ f("span", {
87
+ }) : /* @__PURE__ */ p("span", {
87
88
  className: "select-setupguide__steptitle",
88
- children: [t.title, /* @__PURE__ */ f("span", {
89
+ children: [t.title, /* @__PURE__ */ p("span", {
89
90
  className: "select-setupguide__sr",
90
91
  children: [" — ", i[t.status]]
91
92
  })]
92
- }), t.description && /* @__PURE__ */ d("span", {
93
+ }), t.description && /* @__PURE__ */ f("span", {
93
94
  className: "select-setupguide__stepdesc",
94
95
  children: t.description
95
96
  })]
96
97
  }),
97
- t.trailing ? /* @__PURE__ */ d("span", {
98
+ t.trailing ? /* @__PURE__ */ f("span", {
98
99
  className: "select-setupguide__trailing",
99
100
  children: t.trailing
100
- }) : (t.onSelect || a) && t.status !== "done" ? /* @__PURE__ */ d("span", {
101
+ }) : (t.onSelect || a) && t.status !== "done" ? /* @__PURE__ */ f("span", {
101
102
  className: "select-setupguide__chevron",
102
- children: h
103
+ children: g
103
104
  }) : null
104
105
  ]
105
106
  }, t.id);
@@ -108,96 +109,106 @@ function g({ group: t, justDone: n }) {
108
109
  })]
109
110
  });
110
111
  }
111
- var _ = o(function({ title: e, description: o, progress: l, actions: u, next: p, groups: m, minimized: h = !1, tone: _ = "default", className: v, ...y }, b) {
112
- let x = r().setupGuide, S = n(), C = l && l.total > 0 ? Math.round(l.done / l.total * 100) : 0, w = i(), T = c(null), E = /* @__PURE__ */ new Set(), D = m.flatMap((e) => e.steps);
113
- if (T.current) for (let e of D) e.status === "done" && T.current.get(e.id) !== "done" && E.add(e.id);
114
- return s(() => {
115
- T.current = new Map(D.map((e) => [e.id, e.status]));
116
- }), /* @__PURE__ */ f("section", {
117
- ref: b,
118
- ...y,
119
- className: `select-setupguide${w ? " select-setupguide--nested" : ""}${h ? " is-minimized" : ""}${_ === "sandbox" ? " select-setupguide--sandbox" : ""}${v ? " " + v : ""}`,
120
- children: [/* @__PURE__ */ f("div", {
112
+ var v = s(function({ title: e, description: s, progress: u, actions: d, next: m, groups: h, minimized: g = !1, tone: v = "default", variant: y = "default", className: b, ...x }, S) {
113
+ let C = r().setupGuide, w = n(), T = u && u.total > 0 ? Math.round(u.done / u.total * 100) : 0, E = y === "strip", D = i(), O = l(null), k = /* @__PURE__ */ new Set(), A = h.flatMap((e) => e.steps);
114
+ if (O.current) for (let e of A) e.status === "done" && O.current.get(e.id) !== "done" && k.add(e.id);
115
+ return c(() => {
116
+ O.current = new Map(A.map((e) => [e.id, e.status]));
117
+ }), /* @__PURE__ */ p("section", {
118
+ ref: S,
119
+ ...x,
120
+ className: `select-setupguide${D ? " select-setupguide--nested" : ""}${g ? " is-minimized" : ""}${v === "sandbox" ? " select-setupguide--sandbox" : ""}${E ? " select-setupguide--strip" : ""}${b ? " " + b : ""}`,
121
+ children: [/* @__PURE__ */ p("div", {
121
122
  className: "select-setupguide__head",
122
123
  children: [
123
- /* @__PURE__ */ f("div", {
124
+ E && u && /* @__PURE__ */ f(o, {
125
+ className: "select-setupguide__ring",
126
+ value: u.done,
127
+ max: Math.max(u.total, 1),
128
+ size: 40,
129
+ thickness: 4,
130
+ tone: v === "sandbox" ? "brand" : "success",
131
+ label: `${t(u.done, w)}/${t(u.total, w)}`,
132
+ ariaLabel: `${C.progressLabel}: ${typeof u.label == "string" ? u.label : C.progress(t(u.done, w), t(u.total, w))}`
133
+ }),
134
+ /* @__PURE__ */ p("div", {
124
135
  className: "select-setupguide__heading",
125
- children: [/* @__PURE__ */ d("h2", {
136
+ children: [/* @__PURE__ */ f("h2", {
126
137
  className: "select-setupguide__title",
127
138
  children: e
128
- }), o && /* @__PURE__ */ d("p", {
139
+ }), s && /* @__PURE__ */ f("p", {
129
140
  className: "select-setupguide__desc",
130
- children: o
141
+ children: s
131
142
  })]
132
143
  }),
133
- l && /* @__PURE__ */ f("div", {
144
+ u && !E && /* @__PURE__ */ p("div", {
134
145
  className: "select-setupguide__progress",
135
- children: [/* @__PURE__ */ d("div", {
146
+ children: [/* @__PURE__ */ f("div", {
136
147
  className: "select-setupguide__bar",
137
148
  role: "progressbar",
138
149
  "aria-valuemin": 0,
139
- "aria-valuemax": l.total,
140
- "aria-valuenow": l.done,
141
- "aria-label": x.progressLabel,
142
- children: /* @__PURE__ */ d("span", {
150
+ "aria-valuemax": u.total,
151
+ "aria-valuenow": u.done,
152
+ "aria-label": C.progressLabel,
153
+ children: /* @__PURE__ */ f("span", {
143
154
  className: "select-setupguide__fill",
144
- style: { width: `${Math.max(C, 3)}%` }
155
+ style: { width: `${Math.max(T, 3)}%` }
145
156
  })
146
- }), /* @__PURE__ */ d("span", {
157
+ }), /* @__PURE__ */ f("span", {
147
158
  className: "select-setupguide__count",
148
- children: l.label ?? x.progress(t(l.done, S), t(l.total, S))
159
+ children: u.label ?? C.progress(t(u.done, w), t(u.total, w))
149
160
  })]
150
161
  }),
151
- u && /* @__PURE__ */ d("div", {
162
+ d && /* @__PURE__ */ f("div", {
152
163
  className: "select-setupguide__actions",
153
- children: u
164
+ children: d
154
165
  })
155
166
  ]
156
- }), /* @__PURE__ */ d("div", {
167
+ }), /* @__PURE__ */ f("div", {
157
168
  className: "select-setupguide__fold",
158
- ...a(h),
159
- children: /* @__PURE__ */ f("div", {
169
+ ...a(g),
170
+ children: /* @__PURE__ */ p("div", {
160
171
  className: "select-setupguide__body",
161
- children: [p && /* @__PURE__ */ d("div", {
172
+ children: [m && /* @__PURE__ */ f("div", {
162
173
  className: "select-setupguide__next",
163
- children: p
164
- }), /* @__PURE__ */ d("div", {
174
+ children: m
175
+ }), /* @__PURE__ */ f("div", {
165
176
  className: "select-setupguide__steps",
166
- children: m.map((e, t) => /* @__PURE__ */ d(g, {
177
+ children: h.map((e, t) => /* @__PURE__ */ f(_, {
167
178
  group: e,
168
- justDone: E
179
+ justDone: k
169
180
  }, t))
170
181
  })]
171
182
  })
172
183
  })]
173
184
  });
174
185
  });
175
- function v({ eyebrow: e, title: t, children: n, actions: r }) {
176
- return /* @__PURE__ */ f("div", {
186
+ function y({ eyebrow: e, title: t, children: n, actions: r }) {
187
+ return /* @__PURE__ */ p("div", {
177
188
  className: "select-setupnext",
178
- children: [/* @__PURE__ */ f("div", {
189
+ children: [/* @__PURE__ */ p("div", {
179
190
  className: "select-setupnext__text",
180
191
  children: [
181
- e && /* @__PURE__ */ d("div", {
192
+ e && /* @__PURE__ */ f("div", {
182
193
  className: "select-setupnext__eyebrow",
183
194
  children: e
184
195
  }),
185
- /* @__PURE__ */ d("h3", {
196
+ /* @__PURE__ */ f("h3", {
186
197
  className: "select-setupnext__title",
187
198
  children: t
188
199
  }),
189
- n && /* @__PURE__ */ d("div", {
200
+ n && /* @__PURE__ */ f("div", {
190
201
  className: "select-setupnext__body",
191
202
  children: n
192
203
  })
193
204
  ]
194
- }), r && /* @__PURE__ */ d("div", {
205
+ }), r && /* @__PURE__ */ f("div", {
195
206
  className: "select-setupnext__actions",
196
207
  children: r
197
208
  })]
198
209
  });
199
210
  }
200
211
  //#endregion
201
- export { _ as SelectSetupGuide, v as SelectSetupNext };
212
+ export { v as SelectSetupGuide, y as SelectSetupNext };
202
213
 
203
214
  //# sourceMappingURL=SelectSetupGuide.js.map