sander-ui 0.1.10 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/index.js +67 -61
  3. package/dist/index10.js +20 -20
  4. package/dist/index11.js +1 -1
  5. package/dist/index12.js +21 -77
  6. package/dist/index13.js +72 -162
  7. package/dist/index14.js +167 -42
  8. package/dist/index15.js +36 -23
  9. package/dist/index16.js +40 -17
  10. package/dist/index17.js +20 -73
  11. package/dist/index18.js +20 -62
  12. package/dist/index19.js +73 -38
  13. package/dist/index20.js +61 -31
  14. package/dist/index21.js +35 -254
  15. package/dist/index22.js +31 -18
  16. package/dist/index23.js +260 -40
  17. package/dist/index24.js +19 -47
  18. package/dist/index25.js +37 -129
  19. package/dist/index26.js +47 -18
  20. package/dist/index27.js +130 -21
  21. package/dist/index28.js +18 -55
  22. package/dist/index29.js +25 -16
  23. package/dist/index3.js +2 -2
  24. package/dist/index30.js +23 -46
  25. package/dist/index31.js +55 -5
  26. package/dist/index32.js +19 -17
  27. package/dist/index33.js +45 -25
  28. package/dist/index34.js +5 -7
  29. package/dist/index35.js +16 -26
  30. package/dist/index36.js +22 -10
  31. package/dist/index37.js +8 -21
  32. package/dist/index38.js +14 -17
  33. package/dist/index39.js +8 -17
  34. package/dist/index4.js +7 -7
  35. package/dist/index40.js +7 -11
  36. package/dist/index41.js +7 -26
  37. package/dist/index42.js +16 -42
  38. package/dist/index43.js +7 -3
  39. package/dist/index44.js +4 -4
  40. package/dist/index45.js +27 -23
  41. package/dist/index46.js +26 -8
  42. package/dist/index47.js +27 -14
  43. package/dist/index48.js +21 -8
  44. package/dist/index49.js +21 -7
  45. package/dist/index5.js +3 -3
  46. package/dist/index50.js +11 -23
  47. package/dist/index51.js +39 -30
  48. package/dist/index52.js +16 -16
  49. package/dist/index53.js +42 -14
  50. package/dist/index54.js +4 -15
  51. package/dist/index55.js +4 -4
  52. package/dist/index56.js +27 -4
  53. package/dist/index58.js +25 -12
  54. package/dist/index59.js +13 -15
  55. package/dist/index6.js +3 -3
  56. package/dist/index60.js +4 -8
  57. package/dist/index61.js +31 -27
  58. package/dist/index62.js +16 -25
  59. package/dist/index63.js +37 -20
  60. package/dist/index64.js +25 -39
  61. package/dist/index65.js +22 -14
  62. package/dist/index66.js +22 -12
  63. package/dist/index67.js +12 -22
  64. package/dist/index68.js +10 -41
  65. package/dist/index69.js +15 -4
  66. package/dist/index7.js +4 -4
  67. package/dist/index70.js +9 -35
  68. package/dist/index71.js +17 -2
  69. package/dist/index72.js +12 -20
  70. package/dist/index73.js +15 -2
  71. package/dist/index74.js +42 -2
  72. package/dist/index75.js +4 -6
  73. package/dist/index76.js +35 -34
  74. package/dist/index77.js +2 -12
  75. package/dist/index78.js +4 -7
  76. package/dist/index79.js +21 -4
  77. package/dist/index8.js +3 -3
  78. package/dist/index80.js +2 -5
  79. package/dist/index81.js +4 -0
  80. package/dist/index82.js +8 -0
  81. package/dist/index83.js +36 -0
  82. package/dist/index84.js +14 -0
  83. package/dist/index85.js +9 -0
  84. package/dist/index86.js +7 -0
  85. package/dist/index9.js +2 -2
  86. package/package.json +1 -1
package/dist/index20.js CHANGED
@@ -1,34 +1,64 @@
1
- import { jsxs as d, jsx as l } from "react/jsx-runtime";
2
- import c from "./index31.js";
3
- import { forwardRef as h } from "react";
4
- import a from "./index50.js";
5
- const v = h(
6
- ({ label: i, error: s, options: m, value: n, onChange: o, name: r, className: p, ...t }, u) => /* @__PURE__ */ d("fieldset", { className: c(a.fieldset, p), children: [
7
- i && /* @__PURE__ */ l("legend", { className: a.legend, children: i }),
8
- /* @__PURE__ */ l("div", { className: a.options, children: m.map((e) => /* @__PURE__ */ d("label", { className: a.option, children: [
9
- /* @__PURE__ */ l(
10
- "input",
1
+ import { jsxs as f, jsx as e } from "react/jsx-runtime";
2
+ import u from "./index34.js";
3
+ import n from "./index59.js";
4
+ import h from "./index60.js";
5
+ import d from "./index44.js";
6
+ function b(i, r, a) {
7
+ const s = [], c = Math.max(2, i - a), t = Math.min(r - 1, i + a);
8
+ s.push(1), c > 2 && s.push("ellipsis");
9
+ for (let o = c; o <= t; o++)
10
+ s.push(o);
11
+ return t < r - 1 && s.push("ellipsis"), r > 1 && s.push(r), s;
12
+ }
13
+ const j = ({
14
+ page: i,
15
+ totalPages: r,
16
+ onChange: a,
17
+ siblings: s = 1,
18
+ className: c,
19
+ ...t
20
+ }) => {
21
+ if (r <= 1) return null;
22
+ const o = b(i, r, s);
23
+ return /* @__PURE__ */ f("nav", { "aria-label": "Pagination", className: u(n.pagination, c), ...t, children: [
24
+ /* @__PURE__ */ e(
25
+ "button",
26
+ {
27
+ "aria-label": "Previous page",
28
+ disabled: i <= 1,
29
+ onClick: () => a(i - 1),
30
+ className: n.arrow,
31
+ children: /* @__PURE__ */ e(h, { className: n.icon })
32
+ }
33
+ ),
34
+ o.map((l, m) => {
35
+ if (l === "ellipsis")
36
+ return /* @__PURE__ */ e("span", { className: n.ellipsis, children: "..." }, `ellipsis-${m}`);
37
+ const p = l === i;
38
+ return /* @__PURE__ */ e(
39
+ "button",
11
40
  {
12
- ref: u,
13
- type: "radio",
14
- name: r,
15
- value: e.value,
16
- checked: n === e.value,
17
- onChange: () => o?.(e.value),
18
- "aria-describedby": e.description ? `${r}-${e.value}-description` : void 0,
19
- className: c(a.radio, s && a.radioError),
20
- ...t
21
- }
22
- ),
23
- /* @__PURE__ */ d("div", { className: a.labels, children: [
24
- /* @__PURE__ */ l("span", { className: a.label, children: e.label }),
25
- e.description && /* @__PURE__ */ l("span", { id: `${r}-${e.value}-description`, className: a.description, children: e.description })
26
- ] })
27
- ] }, e.value)) }),
28
- s && /* @__PURE__ */ l("p", { role: "alert", className: a.error, children: s })
29
- ] })
30
- );
31
- v.displayName = "RadioGroup";
41
+ "aria-label": `Page ${l}`,
42
+ "aria-current": p ? "page" : void 0,
43
+ onClick: () => a(l),
44
+ className: u(n.page, p && n.active),
45
+ children: l
46
+ },
47
+ l
48
+ );
49
+ }),
50
+ /* @__PURE__ */ e(
51
+ "button",
52
+ {
53
+ "aria-label": "Next page",
54
+ disabled: i >= r,
55
+ onClick: () => a(i + 1),
56
+ className: n.arrow,
57
+ children: /* @__PURE__ */ e(d, { className: n.icon })
58
+ }
59
+ )
60
+ ] });
61
+ };
32
62
  export {
33
- v as RadioGroup
63
+ j as Pagination
34
64
  };
package/dist/index21.js CHANGED
@@ -1,262 +1,43 @@
1
- import { jsx as l, jsxs as y } from "react/jsx-runtime";
2
- import k from "./index31.js";
3
- import { createPortal as ue } from "react-dom";
4
- import { useId as pe, useState as h, useRef as D, useCallback as C, useLayoutEffect as fe, useEffect as J } from "react";
5
- import r from "./index42.js";
6
- import be from "./index43.js";
7
- import he from "./index44.js";
8
- function Q(v) {
9
- return "options" in v;
10
- }
11
- function ve(v) {
12
- const b = [];
13
- for (const c of v)
14
- Q(c) ? b.push(...c.options) : b.push(c);
15
- return b;
16
- }
17
- const me = ({
18
- id: v,
19
- name: b,
20
- label: c,
21
- error: m,
22
- options: z,
23
- placeholder: X,
24
- value: K,
25
- defaultValue: Y,
26
- onChange: P,
27
- disabled: I = !1,
28
- required: V = !1,
29
- className: Z
1
+ import { jsxs as i, jsx as n } from "react/jsx-runtime";
2
+ import o from "./index34.js";
3
+ import r from "./index66.js";
4
+ const N = ({
5
+ value: e,
6
+ max: d = 100,
7
+ label: s,
8
+ size: c = "md",
9
+ className: l,
10
+ ...m
30
11
  }) => {
31
- const _ = pe(), d = v ?? _, F = `${d}-listbox`, j = `${d}-error`, $ = `${d}-label`, u = ve(z), o = u.map((e, t) => ({ ...e, index: t })).filter((e) => !e.disabled), A = K !== void 0, [ee, te] = h(Y ?? ""), p = A ? K : ee, [s, E] = h(!1), [a, i] = h(-1), [ne, B] = h(""), O = D(null), [re, oe] = h(!1), [T, se] = h({ top: 0, left: 0, width: 0 }), x = D(null), w = D(null), R = D(null), M = D([]), S = u.find((e) => e.value === p), U = C(
32
- (e) => {
33
- A || te(e), P?.(e);
34
- },
35
- [A, P]
36
- ), H = C(
37
- (e) => {
38
- if (I) return;
39
- const t = e ?? (p ? u.findIndex((n) => n.value === p) : o[0]?.index ?? 0);
40
- i(t), E(!0);
41
- },
42
- [I, p, u, o]
43
- ), L = C(() => {
44
- E(!1), i(-1), x.current?.focus();
45
- }, []), G = typeof document < "u" ? x.current?.closest("dialog") ?? document.body : null;
46
- fe(() => {
47
- if (!s || !x.current) return;
48
- const e = () => {
49
- const t = x.current.getBoundingClientRect(), n = window.innerHeight - t.bottom, f = t.top, g = w.current?.offsetHeight ?? 240, q = n < g && f > n;
50
- oe(q), se({
51
- top: q ? t.top - (w.current?.offsetHeight ?? 0) - 4 : t.bottom + 4,
52
- left: t.left,
53
- width: t.width
54
- });
55
- };
56
- return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
57
- window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
58
- };
59
- }, [s]), J(() => {
60
- !s || a < 0 || M.current[a]?.scrollIntoView({ block: "nearest" });
61
- }, [a, s]), J(() => {
62
- if (!s) return;
63
- function e(t) {
64
- const n = t.target;
65
- R.current && !R.current.contains(n) && w.current && !w.current.contains(n) && (E(!1), i(-1));
66
- }
67
- return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
68
- }, [s]);
69
- const N = C(
70
- (e, t) => {
71
- if (o.length === 0) return -1;
72
- const n = o.findIndex((f) => f.index === t);
73
- switch (e) {
74
- case "next":
75
- return n < 0 || n >= o.length - 1 ? o[0].index : o[n + 1].index;
76
- case "prev":
77
- return n <= 0 ? o[o.length - 1].index : o[n - 1].index;
78
- case "first":
79
- return o[0].index;
80
- case "last":
81
- return o[o.length - 1].index;
82
- }
83
- },
84
- [o]
85
- ), ae = (e) => {
86
- O.current && clearTimeout(O.current);
87
- const t = ne + e.toLowerCase();
88
- B(t), O.current = setTimeout(() => B(""), 500);
89
- const n = o.find(
90
- (f) => f.label.toLowerCase().startsWith(t)
91
- );
92
- n && i(n.index);
93
- }, le = (e) => {
94
- if (!s) {
95
- switch (e.key) {
96
- case "ArrowDown":
97
- case "Enter":
98
- case " ":
99
- e.preventDefault(), H();
100
- break;
101
- case "ArrowUp":
102
- e.preventDefault(), H(o[o.length - 1]?.index);
103
- break;
104
- }
105
- return;
106
- }
107
- switch (e.key) {
108
- case "ArrowDown":
109
- e.preventDefault(), i((t) => N("next", t));
110
- break;
111
- case "ArrowUp":
112
- e.preventDefault(), i((t) => N("prev", t));
113
- break;
114
- case "Home":
115
- e.preventDefault(), i(N("first", a));
116
- break;
117
- case "End":
118
- e.preventDefault(), i(N("last", a));
119
- break;
120
- case "Enter":
121
- case " ":
122
- e.preventDefault(), a >= 0 && !u[a]?.disabled && (U(u[a].value), L());
123
- break;
124
- case "Escape":
125
- e.preventDefault(), L();
126
- break;
127
- case "Tab":
128
- E(!1), i(-1);
129
- break;
130
- default:
131
- e.key.length === 1 && !e.ctrlKey && !e.metaKey && (e.preventDefault(), ae(e.key));
132
- }
133
- }, ie = s && a >= 0 ? `${d}-option-${a}` : void 0;
134
- let ce = 0;
135
- const W = (e) => {
136
- const t = ce++, n = e.value === p, f = t === a;
137
- return /* @__PURE__ */ y(
138
- "li",
12
+ const a = e === void 0, t = a ? 0 : Math.round(e / d * 100);
13
+ return /* @__PURE__ */ i("div", { className: o(r.wrapper, l), ...m, children: [
14
+ s && /* @__PURE__ */ i("div", { className: r.header, children: [
15
+ /* @__PURE__ */ n("span", { className: r.label, children: s }),
16
+ !a && /* @__PURE__ */ i("span", { className: r.value, children: [
17
+ t,
18
+ "%"
19
+ ] })
20
+ ] }),
21
+ /* @__PURE__ */ n(
22
+ "div",
139
23
  {
140
- ref: (g) => {
141
- M.current[t] = g;
142
- },
143
- id: `${d}-option-${t}`,
144
- role: "option",
145
- "aria-selected": n,
146
- "aria-disabled": e.disabled || void 0,
147
- className: k(
148
- r.option,
149
- f && r.optionActive,
150
- n && r.optionSelected,
151
- e.disabled && r.optionDisabled
152
- ),
153
- onMouseEnter: () => {
154
- e.disabled || i(t);
155
- },
156
- onMouseDown: (g) => g.preventDefault(),
157
- onClick: () => {
158
- e.disabled || (U(e.value), L());
159
- },
160
- children: [
161
- /* @__PURE__ */ l("span", { className: r.optionLabel, children: e.label }),
162
- n && /* @__PURE__ */ l(he, { size: 16, className: r.checkIcon, "aria-hidden": !0 })
163
- ]
164
- },
165
- e.value
166
- );
167
- }, de = s && G ? ue(
168
- /* @__PURE__ */ l(
169
- "ul",
170
- {
171
- ref: w,
172
- id: F,
173
- role: "listbox",
174
- "aria-labelledby": c ? $ : d,
175
- className: k(r.listbox, re && r.flipped),
176
- style: {
177
- top: T.top,
178
- left: T.left,
179
- width: T.width
180
- },
181
- children: z.map((e) => {
182
- if (Q(e)) {
183
- const t = `${d}-group-${e.label.replace(/\s+/g, "-").toLowerCase()}`;
184
- return /* @__PURE__ */ y("li", { role: "presentation", children: [
185
- /* @__PURE__ */ l(
186
- "div",
187
- {
188
- id: t,
189
- role: "presentation",
190
- className: r.groupLabel,
191
- children: e.label
192
- }
193
- ),
194
- /* @__PURE__ */ l("ul", { role: "group", "aria-labelledby": t, className: r.group, children: e.options.map(W) })
195
- ] }, e.label);
24
+ role: "progressbar",
25
+ "aria-valuenow": a ? void 0 : e,
26
+ "aria-valuemin": 0,
27
+ "aria-valuemax": d,
28
+ "aria-label": s || "Progress",
29
+ className: o(r.track, r[c]),
30
+ children: /* @__PURE__ */ n(
31
+ "div",
32
+ {
33
+ className: o(r.bar, a && r.indeterminate),
34
+ style: a ? void 0 : { width: `${t}%` }
196
35
  }
197
- return W(e);
198
- })
199
- }
200
- ),
201
- G
202
- ) : null;
203
- return /* @__PURE__ */ y("div", { ref: R, className: r.wrapper, children: [
204
- c && /* @__PURE__ */ l("label", { id: $, className: r.label, children: c }),
205
- /* @__PURE__ */ y(
206
- "button",
207
- {
208
- ref: x,
209
- type: "button",
210
- id: d,
211
- role: "combobox",
212
- "aria-haspopup": "listbox",
213
- "aria-expanded": s,
214
- "aria-controls": s ? F : void 0,
215
- "aria-labelledby": c ? $ : void 0,
216
- "aria-activedescendant": ie,
217
- "aria-invalid": m ? !0 : void 0,
218
- "aria-describedby": m ? j : void 0,
219
- "aria-required": V,
220
- disabled: I,
221
- className: k(r.trigger, m && r.triggerError, Z),
222
- onClick: () => s ? L() : H(),
223
- onKeyDown: le,
224
- children: [
225
- /* @__PURE__ */ l("span", { className: k(r.triggerText, !S && r.placeholder), children: S ? S.label : X ?? " " }),
226
- /* @__PURE__ */ l(
227
- be,
228
- {
229
- size: 16,
230
- className: k(r.chevron, s && r.chevronOpen),
231
- "aria-hidden": !0
232
- }
233
- )
234
- ]
235
- }
236
- ),
237
- b && /* @__PURE__ */ y(
238
- "select",
239
- {
240
- name: b,
241
- value: p,
242
- required: V,
243
- disabled: I,
244
- tabIndex: -1,
245
- "aria-hidden": !0,
246
- className: r.hiddenSelect,
247
- onChange: () => {
248
- },
249
- children: [
250
- !p && /* @__PURE__ */ l("option", { value: "" }),
251
- u.map((e) => /* @__PURE__ */ l("option", { value: e.value, children: e.label }, e.value))
252
- ]
36
+ )
253
37
  }
254
- ),
255
- de,
256
- m && /* @__PURE__ */ l("p", { id: j, role: "alert", className: r.error, children: m })
38
+ )
257
39
  ] });
258
40
  };
259
- me.displayName = "Select";
260
41
  export {
261
- me as Select
42
+ N as Progress
262
43
  };
package/dist/index22.js CHANGED
@@ -1,21 +1,34 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import n from "./index31.js";
3
- import t from "./index66.js";
4
- const c = ({
5
- width: e,
6
- height: r,
7
- variant: o = "text",
8
- className: s,
9
- ...m
10
- }) => /* @__PURE__ */ i(
11
- "div",
12
- {
13
- "aria-hidden": "true",
14
- className: n(t.skeleton, t[o], s),
15
- style: { width: e, height: r },
16
- ...m
17
- }
1
+ import { jsxs as d, jsx as l } from "react/jsx-runtime";
2
+ import c from "./index34.js";
3
+ import { forwardRef as h } from "react";
4
+ import a from "./index65.js";
5
+ const v = h(
6
+ ({ label: i, error: s, options: m, value: n, onChange: o, name: r, className: p, ...t }, u) => /* @__PURE__ */ d("fieldset", { className: c(a.fieldset, p), children: [
7
+ i && /* @__PURE__ */ l("legend", { className: a.legend, children: i }),
8
+ /* @__PURE__ */ l("div", { className: a.options, children: m.map((e) => /* @__PURE__ */ d("label", { className: a.option, children: [
9
+ /* @__PURE__ */ l(
10
+ "input",
11
+ {
12
+ ref: u,
13
+ type: "radio",
14
+ name: r,
15
+ value: e.value,
16
+ checked: n === e.value,
17
+ onChange: () => o?.(e.value),
18
+ "aria-describedby": e.description ? `${r}-${e.value}-description` : void 0,
19
+ className: c(a.radio, s && a.radioError),
20
+ ...t
21
+ }
22
+ ),
23
+ /* @__PURE__ */ d("div", { className: a.labels, children: [
24
+ /* @__PURE__ */ l("span", { className: a.label, children: e.label }),
25
+ e.description && /* @__PURE__ */ l("span", { id: `${r}-${e.value}-description`, className: a.description, children: e.description })
26
+ ] })
27
+ ] }, e.value)) }),
28
+ s && /* @__PURE__ */ l("p", { role: "alert", className: a.error, children: s })
29
+ ] })
18
30
  );
31
+ v.displayName = "RadioGroup";
19
32
  export {
20
- c as Skeleton
33
+ v as RadioGroup
21
34
  };