@pglevy/sailwind 0.4.0 → 0.5.1

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 (64) hide show
  1. package/README.md +19 -2
  2. package/dist/components/Button/Button.stories.d.ts +13 -0
  3. package/dist/components/Button/Button.stories.d.ts.map +1 -1
  4. package/dist/components/Button/ButtonWidget.d.ts.map +1 -1
  5. package/dist/components/Button/ButtonWidget.js +67 -61
  6. package/dist/components/Card/Card.stories.d.ts +30 -0
  7. package/dist/components/Card/Card.stories.d.ts.map +1 -1
  8. package/dist/components/Checkbox/Checkbox.stories.d.ts +22 -0
  9. package/dist/components/Checkbox/Checkbox.stories.d.ts.map +1 -1
  10. package/dist/components/Checkbox/CheckboxField.js +63 -60
  11. package/dist/components/Dialog/Dialog.stories.d.ts +10 -0
  12. package/dist/components/Dialog/Dialog.stories.d.ts.map +1 -1
  13. package/dist/components/Dropdown/Dropdown.stories.d.ts +10 -0
  14. package/dist/components/Dropdown/Dropdown.stories.d.ts.map +1 -1
  15. package/dist/components/Heading/Heading.stories.d.ts +29 -0
  16. package/dist/components/Heading/Heading.stories.d.ts.map +1 -1
  17. package/dist/components/MessageBanner/MessageBanner.stories.d.ts +20 -0
  18. package/dist/components/MessageBanner/MessageBanner.stories.d.ts.map +1 -1
  19. package/dist/components/Milestone/Milestone.stories.d.ts +17 -0
  20. package/dist/components/Milestone/Milestone.stories.d.ts.map +1 -1
  21. package/dist/components/Milestone/MilestoneField.d.ts.map +1 -1
  22. package/dist/components/Milestone/MilestoneField.js +43 -42
  23. package/dist/components/ProgressBar/ProgressBar.d.ts.map +1 -1
  24. package/dist/components/ProgressBar/ProgressBar.js +35 -34
  25. package/dist/components/ProgressBar/ProgressBar.stories.d.ts +13 -0
  26. package/dist/components/ProgressBar/ProgressBar.stories.d.ts.map +1 -1
  27. package/dist/components/RadioButton/RadioButton.stories.d.ts +22 -0
  28. package/dist/components/RadioButton/RadioButton.stories.d.ts.map +1 -1
  29. package/dist/components/ReadOnlyGrid/GridColumn.d.ts +35 -0
  30. package/dist/components/ReadOnlyGrid/GridColumn.d.ts.map +1 -0
  31. package/dist/components/ReadOnlyGrid/GridColumn.js +5 -0
  32. package/dist/components/ReadOnlyGrid/ReadOnlyGrid.d.ts +52 -0
  33. package/dist/components/ReadOnlyGrid/ReadOnlyGrid.d.ts.map +1 -0
  34. package/dist/components/ReadOnlyGrid/ReadOnlyGrid.js +277 -0
  35. package/dist/components/ReadOnlyGrid/ReadOnlyGrid.stories.d.ts +65 -0
  36. package/dist/components/ReadOnlyGrid/ReadOnlyGrid.stories.d.ts.map +1 -0
  37. package/dist/components/ReadOnlyGrid/index.d.ts +5 -0
  38. package/dist/components/ReadOnlyGrid/index.d.ts.map +1 -0
  39. package/dist/components/RichText/RichText.stories.d.ts +18 -0
  40. package/dist/components/RichText/RichText.stories.d.ts.map +1 -1
  41. package/dist/components/Slider/SliderField.d.ts.map +1 -1
  42. package/dist/components/Slider/SliderField.js +69 -68
  43. package/dist/components/Stamp/Stamp.stories.d.ts +24 -0
  44. package/dist/components/Stamp/Stamp.stories.d.ts.map +1 -1
  45. package/dist/components/Stamp/StampField.js +5 -5
  46. package/dist/components/Switch/Switch.stories.d.ts.map +1 -1
  47. package/dist/components/Tabs/Tabs.stories.d.ts +17 -0
  48. package/dist/components/Tabs/Tabs.stories.d.ts.map +1 -1
  49. package/dist/components/Tag/Tag.stories.d.ts +10 -0
  50. package/dist/components/Tag/Tag.stories.d.ts.map +1 -1
  51. package/dist/components/Tag/TagField.d.ts.map +1 -1
  52. package/dist/components/Tag/TagField.js +1 -0
  53. package/dist/components/TextField/TextField.stories.d.ts +10 -0
  54. package/dist/components/TextField/TextField.stories.d.ts.map +1 -1
  55. package/dist/components/Toggle/Toggle.stories.d.ts.map +1 -1
  56. package/dist/components/Toggle/ToggleField.js +20 -20
  57. package/dist/components/index.d.ts +1 -0
  58. package/dist/components/index.d.ts.map +1 -1
  59. package/dist/index.js +40 -36
  60. package/dist/test/setup.d.ts +1 -0
  61. package/dist/test/setup.d.ts.map +1 -0
  62. package/dist/types/sail.d.ts +15 -0
  63. package/dist/types/sail.d.ts.map +1 -1
  64. package/package.json +23 -8
@@ -0,0 +1,277 @@
1
+ import { jsx as t, jsxs as h, Fragment as we } from "react/jsx-runtime";
2
+ import o from "react";
3
+ import { ChevronsLeft as Re, ChevronLeft as $e, ChevronRight as ve, ChevronsRight as Se, MoveUp as Ee, MoveDown as Le } from "lucide-react";
4
+ import { FieldWrapper as Ae } from "../shared/FieldWrapper.js";
5
+ import { GridColumn as Oe } from "./GridColumn.js";
6
+ function Te(s) {
7
+ const i = [];
8
+ return o.Children.forEach(s, (l) => {
9
+ o.isValidElement(l) && l.type === Oe && i.push(l.props);
10
+ }), i;
11
+ }
12
+ function Me(s, i, l) {
13
+ if (s == null)
14
+ return null;
15
+ if (typeof s == "string")
16
+ return i[s] ?? null;
17
+ if (typeof s == "function")
18
+ try {
19
+ return s(i, l);
20
+ } catch (L) {
21
+ return console.warn("GridColumn value accessor threw an error:", L), null;
22
+ }
23
+ return null;
24
+ }
25
+ function He(s, i) {
26
+ if (!s) return {};
27
+ const l = typeof s == "function" ? s(i) : s;
28
+ return !l || l === "NONE" ? {} : X[l] !== void 0 ? X[l] ? { className: X[l] } : {} : l.startsWith("#") ? { style: { backgroundColor: l } } : {};
29
+ }
30
+ const Ue = {
31
+ SHORT: "max-h-40",
32
+ SHORT_PLUS: "max-h-52",
33
+ MEDIUM: "max-h-64",
34
+ MEDIUM_PLUS: "max-h-80",
35
+ TALL: "max-h-96",
36
+ TALL_PLUS: "max-h-[28rem]",
37
+ EXTRA_TALL: "max-h-[36rem]",
38
+ AUTO: ""
39
+ }, se = {
40
+ AUTO: "",
41
+ ICON: "w-10",
42
+ ICON_PLUS: "w-14",
43
+ NARROW: "w-24",
44
+ NARROW_PLUS: "w-32",
45
+ MEDIUM: "w-40",
46
+ MEDIUM_PLUS: "w-48",
47
+ WIDE: "w-64",
48
+ "1X": "flex-1",
49
+ "2X": "flex-[2]",
50
+ "3X": "flex-[3]",
51
+ "4X": "flex-[4]",
52
+ "5X": "flex-[5]",
53
+ "6X": "flex-[6]",
54
+ "7X": "flex-[7]",
55
+ "8X": "flex-[8]",
56
+ "9X": "flex-[9]",
57
+ "10X": "flex-[10]"
58
+ }, ne = {
59
+ START: "text-left",
60
+ CENTER: "text-center",
61
+ END: "text-right"
62
+ }, X = {
63
+ NONE: "",
64
+ ACCENT: "bg-blue-50",
65
+ SUCCESS: "bg-green-50",
66
+ INFO: "bg-sky-50",
67
+ WARN: "bg-yellow-50",
68
+ ERROR: "bg-red-50"
69
+ }, We = ({
70
+ label: s,
71
+ labelPosition: i,
72
+ instructions: l,
73
+ helpTooltip: L,
74
+ emptyGridMessage: le = "No items available",
75
+ data: D,
76
+ children: ae,
77
+ pageSize: k = 10,
78
+ initialSorts: x,
79
+ selectable: d,
80
+ selectionStyle: m = "CHECKBOX",
81
+ selectionValue: g = [],
82
+ selectionSaveInto: b,
83
+ validations: A,
84
+ showWhen: oe = !0,
85
+ borderStyle: ie = "LIGHT",
86
+ shadeAlternateRows: de = !1,
87
+ spacing: ce = "STANDARD",
88
+ height: F = "AUTO",
89
+ accessibilityText: O,
90
+ marginAbove: ue,
91
+ marginBelow: he
92
+ }) => {
93
+ const ge = o.useId(), T = k > 0 ? k : 10, C = Array.isArray(D) ? D : [], [M, f] = o.useState(1), [p, W] = o.useState(null), [c, H] = o.useState(!0);
94
+ o.useEffect(() => {
95
+ x && x.length > 0 && (W(x[0].field), H(x[0].ascending));
96
+ }, []), o.useEffect(() => {
97
+ f(1);
98
+ }, [C.length]);
99
+ const pe = (e) => {
100
+ p === e ? H((r) => !r) : (W(e), H(!0)), f(1);
101
+ }, U = o.useMemo(
102
+ () => C.map((e, r) => ({ ...e, __originalIndex: r })),
103
+ [C]
104
+ ), N = o.useMemo(() => p ? [...U].sort((e, r) => {
105
+ const n = e[p], a = r[p];
106
+ return n == null && a == null ? 0 : n == null ? c ? -1 : 1 : a == null ? c ? 1 : -1 : typeof n == "string" && typeof a == "string" ? c ? n.localeCompare(a) : a.localeCompare(n) : n < a ? c ? -1 : 1 : n > a ? c ? 1 : -1 : 0;
107
+ }) : U, [U, p, c]);
108
+ if (!oe)
109
+ return null;
110
+ const y = Te(ae).filter((e) => e.showWhen !== !1), w = ie === "STANDARD", fe = w ? "border border-gray-300" : "", me = w ? "border-b border-gray-300" : "border-b border-gray-200", be = w ? "border-b border-gray-300" : "border-b border-gray-200", u = w ? "border-r border-gray-300" : "", R = ce === "DENSE" ? "px-2 py-1" : "px-3 py-2", G = Ue[F] || "", z = F !== "AUTO" && G !== "", _ = Math.ceil(N.length / T), $ = (M - 1) * T, B = Math.min($ + T, N.length), j = M > 1, K = M < _, q = N.slice($, B), J = (e) => e.id !== void 0 ? e.id : e.__originalIndex, Q = (e) => {
111
+ if (!b) return;
112
+ const n = g.includes(e) ? g.filter((a) => a !== e) : [...g, e];
113
+ b(n);
114
+ }, v = d ? q.map((e) => J(e)) : [], Y = d && v.length > 0 && v.every((e) => g.includes(e)), xe = () => {
115
+ if (b)
116
+ if (Y)
117
+ b(g.filter((e) => !v.includes(e)));
118
+ else {
119
+ const e = [...g];
120
+ v.forEach((r) => {
121
+ e.includes(r) || e.push(r);
122
+ }), b(e);
123
+ }
124
+ }, Ce = A && A.length > 0 ? /* @__PURE__ */ t("div", { children: A.map((e, r) => /* @__PURE__ */ t("p", { className: "text-red-600 text-sm mt-1", children: e }, r)) }) : void 0, Z = (e) => e.width && se[e.width] ? se[e.width] : "", V = (e) => e.align && ne[e.align] ? ne[e.align] : "text-left", ee = () => /* @__PURE__ */ h(
125
+ "table",
126
+ {
127
+ className: `w-full border-collapse ${fe}`,
128
+ "aria-label": O,
129
+ children: [
130
+ /* @__PURE__ */ t("thead", { className: z ? "sticky top-0 bg-white z-10" : void 0, children: /* @__PURE__ */ h("tr", { className: me, children: [
131
+ d && m === "CHECKBOX" && /* @__PURE__ */ t("th", { className: `${R} w-10${u ? ` ${u}` : ""}`, children: /* @__PURE__ */ t(
132
+ "input",
133
+ {
134
+ type: "checkbox",
135
+ checked: Y,
136
+ onChange: xe,
137
+ "aria-label": "Select all rows"
138
+ }
139
+ ) }),
140
+ y.map((e, r) => {
141
+ const n = Z(e), a = V(e), S = !(r === y.length - 1) && u ? ` ${u}` : "";
142
+ return /* @__PURE__ */ t(
143
+ "th",
144
+ {
145
+ className: `${R} ${a} text-sm font-semibold text-base${n ? ` ${n}` : ""}${S}`,
146
+ "aria-sort": p === e.sortField ? c ? "ascending" : "descending" : void 0,
147
+ children: e.sortField ? /* @__PURE__ */ h(
148
+ "button",
149
+ {
150
+ type: "button",
151
+ onClick: () => pe(e.sortField),
152
+ className: "flex items-center gap-1 hover:text-gray-900 cursor-pointer",
153
+ children: [
154
+ e.label ?? "",
155
+ p === e.sortField && /* @__PURE__ */ t("span", { "aria-hidden": "true", children: c ? /* @__PURE__ */ t(Ee, { size: 14 }) : /* @__PURE__ */ t(Le, { size: 14 }) })
156
+ ]
157
+ }
158
+ ) : e.label ?? ""
159
+ },
160
+ r
161
+ );
162
+ })
163
+ ] }) }),
164
+ /* @__PURE__ */ t("tbody", { children: q.map((e, r) => {
165
+ const n = J(e), a = d && g.includes(n), I = d && m === "ROW_HIGHLIGHT" && a, S = de && r % 2 === 0 && !I ? "bg-gray-50" : "";
166
+ return /* @__PURE__ */ h(
167
+ "tr",
168
+ {
169
+ className: `${be}${d && m === "ROW_HIGHLIGHT" ? " cursor-pointer" : ""}${I ? " bg-blue-50" : ""}${S ? ` ${S}` : ""}`,
170
+ onClick: d && m === "ROW_HIGHLIGHT" ? () => Q(n) : void 0,
171
+ children: [
172
+ d && m === "CHECKBOX" && /* @__PURE__ */ t("td", { className: `${R} w-10${u ? ` ${u}` : ""}`, children: /* @__PURE__ */ t(
173
+ "input",
174
+ {
175
+ type: "checkbox",
176
+ checked: a || !1,
177
+ onChange: () => Q(n),
178
+ "aria-label": `Select row ${r + 1}`
179
+ }
180
+ ) }),
181
+ y.map((E, te) => {
182
+ const re = Z(E), Ne = V(E), P = He(E.backgroundColor, e), ye = !(te === y.length - 1) && u ? ` ${u}` : "";
183
+ return /* @__PURE__ */ t(
184
+ "td",
185
+ {
186
+ className: `${R} ${Ne} text-sm text-gray-900${re ? ` ${re}` : ""}${P.className ? ` ${P.className}` : ""}${ye}`,
187
+ style: P.style,
188
+ children: Me(E.value, e, $ + r)
189
+ },
190
+ te
191
+ );
192
+ })
193
+ ]
194
+ },
195
+ r
196
+ );
197
+ }) })
198
+ ]
199
+ }
200
+ );
201
+ return /* @__PURE__ */ t(
202
+ Ae,
203
+ {
204
+ label: s,
205
+ labelPosition: i,
206
+ instructions: l,
207
+ helpTooltip: L,
208
+ accessibilityText: O,
209
+ inputId: ge,
210
+ marginAbove: ue,
211
+ marginBelow: he,
212
+ footer: Ce,
213
+ children: C.length === 0 ? /* @__PURE__ */ t("div", { className: "text-gray-500 py-4 text-center", children: le }) : /* @__PURE__ */ h(we, { children: [
214
+ z ? /* @__PURE__ */ t("div", { className: `${G} overflow-y-auto`, tabIndex: 0, role: "region", "aria-label": O || s || "Scrollable grid", children: ee() }) : ee(),
215
+ _ > 1 && /* @__PURE__ */ h("div", { className: "flex items-center justify-end gap-2 px-3 py-2 text-sm text-gray-700", children: [
216
+ /* @__PURE__ */ t(
217
+ "button",
218
+ {
219
+ onClick: () => f(1),
220
+ disabled: !j,
221
+ "aria-label": "First page",
222
+ title: "First page",
223
+ className: "px-1 py-1 disabled:text-gray-300 disabled:cursor-not-allowed text-blue-700 hover:text-blue-900 cursor-pointer",
224
+ children: /* @__PURE__ */ t(Re, { size: 18 })
225
+ }
226
+ ),
227
+ /* @__PURE__ */ t(
228
+ "button",
229
+ {
230
+ onClick: () => f((e) => e - 1),
231
+ disabled: !j,
232
+ "aria-label": "Previous page",
233
+ title: "Previous page",
234
+ className: "px-1 py-1 disabled:text-gray-300 disabled:cursor-not-allowed text-blue-700 hover:text-blue-900 cursor-pointer",
235
+ children: /* @__PURE__ */ t($e, { size: 18 })
236
+ }
237
+ ),
238
+ /* @__PURE__ */ h("span", { children: [
239
+ /* @__PURE__ */ h("span", { className: "font-bold", children: [
240
+ $ + 1,
241
+ " – ",
242
+ B
243
+ ] }),
244
+ " ",
245
+ "of ",
246
+ N.length
247
+ ] }),
248
+ /* @__PURE__ */ t(
249
+ "button",
250
+ {
251
+ onClick: () => f((e) => e + 1),
252
+ disabled: !K,
253
+ "aria-label": "Next page",
254
+ title: "Next page",
255
+ className: "px-1 py-1 disabled:text-gray-300 disabled:cursor-not-allowed text-blue-700 hover:text-blue-900 cursor-pointer",
256
+ children: /* @__PURE__ */ t(ve, { size: 18 })
257
+ }
258
+ ),
259
+ /* @__PURE__ */ t(
260
+ "button",
261
+ {
262
+ onClick: () => f(_),
263
+ disabled: !K,
264
+ "aria-label": "Last page",
265
+ title: "Last page",
266
+ className: "px-1 py-1 disabled:text-gray-300 disabled:cursor-not-allowed text-blue-700 hover:text-blue-900 cursor-pointer",
267
+ children: /* @__PURE__ */ t(Se, { size: 18 })
268
+ }
269
+ )
270
+ ] })
271
+ ] })
272
+ }
273
+ );
274
+ };
275
+ export {
276
+ We as ReadOnlyGrid
277
+ };
@@ -0,0 +1,65 @@
1
+ import { default as React } from 'react';
2
+ import { StoryObj } from '@storybook/react-vite';
3
+ declare const meta: {
4
+ title: string;
5
+ component: React.FC<import('./ReadOnlyGrid').ReadOnlyGridProps>;
6
+ tags: string[];
7
+ parameters: {
8
+ layout: string;
9
+ };
10
+ argTypes: {
11
+ borderStyle: {
12
+ control: "select";
13
+ options: string[];
14
+ };
15
+ spacing: {
16
+ control: "select";
17
+ options: string[];
18
+ };
19
+ height: {
20
+ control: "select";
21
+ options: string[];
22
+ };
23
+ selectionStyle: {
24
+ control: "select";
25
+ options: string[];
26
+ };
27
+ labelPosition: {
28
+ control: "select";
29
+ options: string[];
30
+ };
31
+ marginAbove: {
32
+ control: "select";
33
+ options: string[];
34
+ };
35
+ marginBelow: {
36
+ control: "select";
37
+ options: string[];
38
+ };
39
+ };
40
+ };
41
+ export default meta;
42
+ type Story = StoryObj<typeof meta>;
43
+ /** 1. Default — Basic grid with employee data */
44
+ export declare const Default: Story;
45
+ /** 2. EmptyState — Empty data with custom message */
46
+ export declare const EmptyState: Story;
47
+ /** 3. WithPaging — Full dataset with pageSize=5 showing paging controls */
48
+ export declare const WithPaging: Story;
49
+ /** 4. WithSorting — Sortable columns with initial sort on salary descending */
50
+ export declare const WithSorting: Story;
51
+ /** 5. WithCheckboxSelection — Selectable grid with checkbox style */
52
+ export declare const WithCheckboxSelection: Story;
53
+ /** 6. WithRowHighlightSelection — ROW_HIGHLIGHT selection style */
54
+ export declare const WithRowHighlightSelection: Story;
55
+ /** 7. StyledGrid — borderStyle, shadeAlternateRows, dense spacing */
56
+ export declare const StyledGrid: Story;
57
+ /** 8. FixedHeight — MEDIUM height to show scrolling behavior */
58
+ export declare const FixedHeight: Story;
59
+ /** 9. WithLabelAndValidations — label, instructions, validations, helpTooltip */
60
+ export declare const WithLabelAndValidations: Story;
61
+ /** 10. ColumnWidthsAndAlignment — Various column widths and alignments */
62
+ export declare const ColumnWidthsAndAlignment: Story;
63
+ /** 11. FunctionAccessor — Using function value accessors for computed columns */
64
+ export declare const FunctionAccessor: Story;
65
+ //# sourceMappingURL=ReadOnlyGrid.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadOnlyGrid.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ReadOnlyGrid/ReadOnlyGrid.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAoB3D,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAc2B,CAAA;AAErC,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAElC,iDAAiD;AACjD,eAAO,MAAM,OAAO,EAAE,KAarB,CAAA;AAED,qDAAqD;AACrD,eAAO,MAAM,UAAU,EAAE,KAYxB,CAAA;AAED,2EAA2E;AAC3E,eAAO,MAAM,UAAU,EAAE,KAuBxB,CAAA;AAED,+EAA+E;AAC/E,eAAO,MAAM,WAAW,EAAE,KAczB,CAAA;AAED,qEAAqE;AACrE,eAAO,MAAM,qBAAqB,EAAE,KAgBnC,CAAA;AAED,mEAAmE;AACnE,eAAO,MAAM,yBAAyB,EAAE,KAgBvC,CAAA;AAED,qEAAqE;AACrE,eAAO,MAAM,UAAU,EAAE,KAexB,CAAA;AAED,gEAAgE;AAChE,eAAO,MAAM,WAAW,EAAE,KAazB,CAAA;AAED,iFAAiF;AACjF,eAAO,MAAM,uBAAuB,EAAE,KAerC,CAAA;AAED,0EAA0E;AAC1E,eAAO,MAAM,wBAAwB,EAAE,KAYtC,CAAA;AAED,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,EAAE,KA2B9B,CAAA"}
@@ -0,0 +1,5 @@
1
+ export { ReadOnlyGrid } from './ReadOnlyGrid';
2
+ export type { ReadOnlyGridProps } from './ReadOnlyGrid';
3
+ export { GridColumn } from './GridColumn';
4
+ export type { GridColumnProps } from './GridColumn';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ReadOnlyGrid/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA"}
@@ -6,6 +6,24 @@ declare const meta: {
6
6
  parameters: {
7
7
  layout: string;
8
8
  };
9
+ argTypes: {
10
+ align: {
11
+ control: "select";
12
+ options: string[];
13
+ };
14
+ labelPosition: {
15
+ control: "select";
16
+ options: string[];
17
+ };
18
+ marginAbove: {
19
+ control: "select";
20
+ options: string[];
21
+ };
22
+ marginBelow: {
23
+ control: "select";
24
+ options: string[];
25
+ };
26
+ };
9
27
  };
10
28
  export default meta;
11
29
  type Story = StoryObj<typeof meta>;
@@ -1 +1 @@
1
- {"version":3,"file":"RichText.stories.d.ts","sourceRoot":"","sources":["../../../src/components/RichText/RichText.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAK3D,QAAA,MAAM,IAAI;;;;;;;CAKmC,CAAA;AAE7C,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAElC,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAA;AAED,eAAO,MAAM,oBAAoB,EAAE,KAuBlC,CAAA;AAGD,eAAO,MAAM,UAAU,EAAE,KAexB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAuB9B,CAAA;AAED,eAAO,MAAM,yBAAyB,EAAE,KAwBvC,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KAgB7B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAoB3B,CAAA"}
1
+ {"version":3,"file":"RichText.stories.d.ts","sourceRoot":"","sources":["../../../src/components/RichText/RichText.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAK3D,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;CAWmC,CAAA;AAE7C,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAElC,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAA;AAED,eAAO,MAAM,oBAAoB,EAAE,KAqBlC,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,K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A;IACnB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;CACxC;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA0NlD,CAAA"}
@@ -3,60 +3,60 @@ import "react";
3
3
  import * as n from "@radix-ui/react-slider";
4
4
  import { FieldWrapper as W } from "../shared/FieldWrapper.js";
5
5
  const Y = ({
6
- label: b,
7
- instructions: m,
8
- required: f = !1,
9
- disabled: d = !1,
10
- value: h = 50,
11
- min: A = 0,
6
+ label: h,
7
+ instructions: f,
8
+ required: A = !1,
9
+ disabled: g = !1,
10
+ value: d = 50,
11
+ min: N = 0,
12
12
  max: v = 100,
13
13
  step: E = 1,
14
- validations: N = [],
14
+ validations: w = [],
15
15
  saveInto: I,
16
16
  onChange: O,
17
17
  validationGroup: F,
18
- requiredMessage: w,
19
- labelPosition: y = "ABOVE",
20
- helpTooltip: L,
21
- accessibilityText: C,
22
- showWhen: x = !0,
18
+ requiredMessage: C,
19
+ labelPosition: L = "ABOVE",
20
+ helpTooltip: y,
21
+ accessibilityText: i,
22
+ showWhen: S = !0,
23
23
  marginAbove: V = "NONE",
24
24
  marginBelow: D = "STANDARD",
25
- size: g = "STANDARD",
26
- color: o = "ACCENT",
27
- orientation: e = "HORIZONTAL",
28
- showValue: S = !1,
29
- formatValue: i = (s) => s.toString()
25
+ size: c = "STANDARD",
26
+ color: l = "ACCENT",
27
+ orientation: r = "HORIZONTAL",
28
+ showValue: k = !1,
29
+ formatValue: u = (o) => o.toString()
30
30
  }) => {
31
- if (!x) return null;
32
- const s = `sliderfield-${Math.random().toString(36).substr(2, 9)}`, a = Array.isArray(h) ? h : [h], R = Array.isArray(h), c = {
31
+ if (!S) return null;
32
+ const o = `sliderfield-${Math.random().toString(36).substr(2, 9)}`, s = Array.isArray(d) ? d : [d], R = Array.isArray(d), b = {
33
33
  SMALL: {
34
- track: e === "HORIZONTAL" ? "h-1" : "w-1",
34
+ track: r === "HORIZONTAL" ? "h-1" : "w-1",
35
35
  thumb: "h-4 w-4",
36
- height: e === "VERTICAL" ? "h-32" : void 0
36
+ height: r === "VERTICAL" ? "h-32" : void 0
37
37
  },
38
38
  STANDARD: {
39
- track: e === "HORIZONTAL" ? "h-2" : "w-2",
39
+ track: r === "HORIZONTAL" ? "h-2" : "w-2",
40
40
  thumb: "h-5 w-5",
41
- height: e === "VERTICAL" ? "h-40" : void 0
41
+ height: r === "VERTICAL" ? "h-40" : void 0
42
42
  },
43
43
  MEDIUM: {
44
- track: e === "HORIZONTAL" ? "h-3" : "w-3",
44
+ track: r === "HORIZONTAL" ? "h-3" : "w-3",
45
45
  thumb: "h-6 w-6",
46
- height: e === "VERTICAL" ? "h-48" : void 0
46
+ height: r === "VERTICAL" ? "h-48" : void 0
47
47
  },
48
48
  LARGE: {
49
- track: e === "HORIZONTAL" ? "h-4" : "w-4",
49
+ track: r === "HORIZONTAL" ? "h-4" : "w-4",
50
50
  thumb: "h-8 w-8",
51
- height: e === "VERTICAL" ? "h-56" : void 0
51
+ height: r === "VERTICAL" ? "h-56" : void 0
52
52
  }
53
53
  }, T = (() => {
54
- if (o.startsWith("#"))
54
+ if (l.startsWith("#"))
55
55
  return {
56
56
  range: "",
57
57
  thumb: "border-2 border-white shadow-lg"
58
58
  };
59
- const r = {
59
+ const e = {
60
60
  ACCENT: {
61
61
  range: "bg-blue-500",
62
62
  thumb: "bg-blue-500 border-2 border-white shadow-lg hover:bg-blue-700 focus:bg-blue-700"
@@ -74,37 +74,37 @@ const Y = ({
74
74
  thumb: "bg-gray-700 border-2 border-white shadow-lg hover:bg-gray-900 focus:bg-gray-900"
75
75
  }
76
76
  };
77
- return r[o] || r.ACCENT;
78
- })(), k = (r) => {
79
- const l = O || I;
80
- l && !d && l(R ? r : r[0]);
81
- }, u = N.length > 0, j = f && a.every((r) => r === A) && w, H = () => R ? `${i(a[0])} - ${i(a[1])}` : i(a[0]), Z = /* @__PURE__ */ t("div", { className: e === "VERTICAL" ? "flex justify-center" : "", children: /* @__PURE__ */ p(
77
+ return e[l] || e.ACCENT;
78
+ })(), x = (e) => {
79
+ const a = O || I;
80
+ a && !g && a(R ? e : e[0]);
81
+ }, m = w.length > 0, j = A && s.every((e) => e === N) && C, $ = () => R ? `${u(s[0])} - ${u(s[1])}` : u(s[0]), H = /* @__PURE__ */ t("div", { className: r === "VERTICAL" ? "flex justify-center" : "", children: /* @__PURE__ */ p(
82
82
  n.Root,
83
83
  {
84
- id: s,
85
- value: a,
86
- onValueChange: k,
87
- min: A,
84
+ id: o,
85
+ value: s,
86
+ onValueChange: x,
87
+ min: N,
88
88
  max: v,
89
89
  step: E,
90
- disabled: d,
91
- orientation: e.toLowerCase(),
90
+ disabled: g,
91
+ orientation: r.toLowerCase(),
92
92
  className: [
93
93
  "relative flex items-center select-none touch-none",
94
- e === "HORIZONTAL" ? "w-full" : c[g].height,
95
- d && "opacity-50 cursor-not-allowed"
94
+ r === "HORIZONTAL" ? "w-full" : b[c].height,
95
+ g && "opacity-50 cursor-not-allowed"
96
96
  ].filter(Boolean).join(" "),
97
- "aria-label": C || b,
98
- "aria-describedby": m ? `${s}-instructions` : void 0,
99
- "aria-invalid": u,
100
- "aria-errormessage": u ? `${s}-error` : void 0,
97
+ "aria-label": i || h,
98
+ "aria-describedby": f ? `${o}-instructions` : void 0,
99
+ "aria-invalid": m,
100
+ "aria-errormessage": m ? `${o}-error` : void 0,
101
101
  children: [
102
102
  /* @__PURE__ */ t(
103
103
  n.Track,
104
104
  {
105
105
  className: [
106
106
  "relative grow rounded-full bg-gray-200",
107
- c[g].track
107
+ b[c].track
108
108
  ].join(" "),
109
109
  children: /* @__PURE__ */ t(
110
110
  n.Range,
@@ -112,50 +112,51 @@ const Y = ({
112
112
  className: [
113
113
  "absolute rounded-full",
114
114
  T.range,
115
- e === "HORIZONTAL" ? "h-full" : "w-full"
115
+ r === "HORIZONTAL" ? "h-full" : "w-full"
116
116
  ].join(" "),
117
- style: o.startsWith("#") ? { backgroundColor: o } : void 0
117
+ style: l.startsWith("#") ? { backgroundColor: l } : void 0
118
118
  }
119
119
  )
120
120
  }
121
121
  ),
122
- a.map((r, l) => /* @__PURE__ */ t(
122
+ s.map((e, a) => /* @__PURE__ */ t(
123
123
  n.Thumb,
124
124
  {
125
125
  className: [
126
126
  "block rounded-full transition-colors",
127
- c[g].thumb,
127
+ b[c].thumb,
128
128
  T.thumb,
129
129
  "focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"
130
130
  ].join(" "),
131
- style: o.startsWith("#") ? { backgroundColor: o } : void 0
131
+ style: l.startsWith("#") ? { backgroundColor: l } : void 0,
132
+ "aria-label": s.length > 1 ? `${h || "Slider"} thumb ${a + 1}` : i || h || "Slider"
132
133
  },
133
- l
134
+ a
134
135
  ))
135
136
  ]
136
137
  }
137
- ) }), M = S && /* @__PURE__ */ t("div", { className: [
138
+ ) }), Z = k && /* @__PURE__ */ t("div", { className: [
138
139
  "text-sm text-gray-700 mt-2",
139
- e === "VERTICAL" ? "text-center" : ""
140
- ].join(" "), children: H() }), $ = /* @__PURE__ */ p(G, { children: [
141
- M,
142
- u && /* @__PURE__ */ t("div", { id: `${s}-error`, className: "mt-2", role: "alert", children: N.map((r, l) => /* @__PURE__ */ t("p", { className: "text-sm text-red-700", children: r }, l)) }),
143
- j && /* @__PURE__ */ t("p", { className: "text-sm text-red-700 mt-2", role: "alert", children: w })
140
+ r === "VERTICAL" ? "text-center" : ""
141
+ ].join(" "), children: $() }), M = /* @__PURE__ */ p(G, { children: [
142
+ Z,
143
+ m && /* @__PURE__ */ t("div", { id: `${o}-error`, className: "mt-2", role: "alert", children: w.map((e, a) => /* @__PURE__ */ t("p", { className: "text-sm text-red-700", children: e }, a)) }),
144
+ j && /* @__PURE__ */ t("p", { className: "text-sm text-red-700 mt-2", role: "alert", children: C })
144
145
  ] });
145
146
  return /* @__PURE__ */ t(
146
147
  W,
147
148
  {
148
- label: b,
149
- labelPosition: y,
150
- required: f,
151
- instructions: m,
152
- helpTooltip: L,
153
- accessibilityText: C,
154
- inputId: s,
149
+ label: h,
150
+ labelPosition: L,
151
+ required: A,
152
+ instructions: f,
153
+ helpTooltip: y,
154
+ accessibilityText: i,
155
+ inputId: o,
155
156
  marginAbove: V,
156
157
  marginBelow: D,
157
- footer: $,
158
- children: Z
158
+ footer: M,
159
+ children: H
159
160
  }
160
161
  );
161
162
  };
@@ -6,6 +6,30 @@ declare const meta: {
6
6
  parameters: {
7
7
  layout: string;
8
8
  };
9
+ argTypes: {
10
+ size: {
11
+ control: "select";
12
+ options: string[];
13
+ };
14
+ shape: {
15
+ control: "select";
16
+ options: string[];
17
+ };
18
+ align: {
19
+ control: "select";
20
+ options: string[];
21
+ };
22
+ labelPosition: {
23
+ control: "select";
24
+ options: string[];
25
+ };
26
+ backgroundColor: {
27
+ control: "text";
28
+ };
29
+ contentColor: {
30
+ control: "text";
31
+ };
32
+ };
9
33
  };
10
34
  export default meta;
11
35
  type Story = StoryObj<typeof meta>;
@@ -1 +1 @@
1
- {"version":3,"file":"Stamp.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Stamp/Stamp.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAG3D,QAAA,MAAM,IAAI;;;;;;;CAKyB,CAAA;AAEnC,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAElC,eAAO,MAAM,OAAO,EAAE,KAOrB,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAQ5B,CAAA;AAED,eAAO,MAAM,qBAAqB,EAAE,KAOnC,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAQxB,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,KASnB,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,KAQpB,CAAA;AAED,eAAO,MAAM,wBAAwB,EAAE,KAWtC,CAAA"}
1
+ {"version":3,"file":"Stamp.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Stamp/Stamp.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAG3D,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAayB,CAAA;AAEnC,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAElC,eAAO,MAAM,OAAO,EAAE,KAOrB,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAQ5B,CAAA;AAED,eAAO,MAAM,qBAAqB,EAAE,KAOnC,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAMxB,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,KASnB,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,KAQpB,CAAA;AAED,eAAO,MAAM,wBAAwB,EAAE,KAWtC,CAAA"}