@raketa-builder/next-form 0.1.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/index.js ADDED
@@ -0,0 +1,1316 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __objRest = (source, exclude) => {
26
+ var target = {};
27
+ for (var prop in source)
28
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
+ target[prop] = source[prop];
30
+ if (source != null && __getOwnPropSymbols)
31
+ for (var prop of __getOwnPropSymbols(source)) {
32
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
+ target[prop] = source[prop];
34
+ }
35
+ return target;
36
+ };
37
+ var __commonJS = (cb, mod) => function __require() {
38
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
39
+ };
40
+ var __export = (target, all) => {
41
+ for (var name in all)
42
+ __defProp(target, name, { get: all[name], enumerable: true });
43
+ };
44
+ var __copyProps = (to, from, except, desc) => {
45
+ if (from && typeof from === "object" || typeof from === "function") {
46
+ for (let key of __getOwnPropNames(from))
47
+ if (!__hasOwnProp.call(to, key) && key !== except)
48
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
49
+ }
50
+ return to;
51
+ };
52
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
53
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
54
+ mod
55
+ ));
56
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
57
+
58
+ // ../ui/dist/index.js
59
+ var require_dist = __commonJS({
60
+ "../ui/dist/index.js"(exports, module2) {
61
+ "use strict";
62
+ var __create2 = Object.create;
63
+ var __defProp2 = Object.defineProperty;
64
+ var __defProps2 = Object.defineProperties;
65
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
66
+ var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
67
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
68
+ var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
69
+ var __getProtoOf2 = Object.getPrototypeOf;
70
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
71
+ var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
72
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
73
+ var __spreadValues2 = (a, b) => {
74
+ for (var prop in b || (b = {}))
75
+ if (__hasOwnProp2.call(b, prop))
76
+ __defNormalProp2(a, prop, b[prop]);
77
+ if (__getOwnPropSymbols2)
78
+ for (var prop of __getOwnPropSymbols2(b)) {
79
+ if (__propIsEnum2.call(b, prop))
80
+ __defNormalProp2(a, prop, b[prop]);
81
+ }
82
+ return a;
83
+ };
84
+ var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
85
+ var __objRest2 = (source, exclude) => {
86
+ var target = {};
87
+ for (var prop in source)
88
+ if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
89
+ target[prop] = source[prop];
90
+ if (source != null && __getOwnPropSymbols2)
91
+ for (var prop of __getOwnPropSymbols2(source)) {
92
+ if (exclude.indexOf(prop) < 0 && __propIsEnum2.call(source, prop))
93
+ target[prop] = source[prop];
94
+ }
95
+ return target;
96
+ };
97
+ var __export2 = (target, all) => {
98
+ for (var name in all)
99
+ __defProp2(target, name, { get: all[name], enumerable: true });
100
+ };
101
+ var __copyProps2 = (to, from, except, desc) => {
102
+ if (from && typeof from === "object" || typeof from === "function") {
103
+ for (let key of __getOwnPropNames2(from))
104
+ if (!__hasOwnProp2.call(to, key) && key !== except)
105
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
106
+ }
107
+ return to;
108
+ };
109
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
110
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
111
+ mod
112
+ ));
113
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
114
+ var src_exports2 = {};
115
+ __export2(src_exports2, {
116
+ Button: () => Button_default,
117
+ Col: () => Col,
118
+ Container: () => Container_default,
119
+ DataGrid: () => DataGrid_default,
120
+ Field: () => Field_default,
121
+ FormGroup: () => FormGroup_default,
122
+ H: () => H_default,
123
+ Handle: () => Handle_default,
124
+ Hint: () => Hint_default,
125
+ Input: () => Input_default,
126
+ Label: () => Label_default,
127
+ LanguageSwitcher: () => LanguageSwitcher_default,
128
+ Modal: () => Modal_default,
129
+ NavItem: () => NavItem,
130
+ Navigation: () => Navigation,
131
+ P: () => P_default,
132
+ PageTitle: () => PageTitle_default,
133
+ Pagination: () => Pagination_default,
134
+ Panel: () => Panel,
135
+ PanelContent: () => PanelContent,
136
+ PanelTitle: () => PanelTitle,
137
+ Row: () => Row,
138
+ Select: () => Select_default,
139
+ Shift: () => Shift,
140
+ Stack: () => Stack_default,
141
+ Tabs: () => Tabs_default,
142
+ Textarea: () => Textarea_default,
143
+ Toolbar: () => Toolbar_default,
144
+ buttonReset: () => buttonReset_default,
145
+ reset: () => reset_default,
146
+ theme: () => theme_default
147
+ });
148
+ module2.exports = __toCommonJS2(src_exports2);
149
+ var base = 14;
150
+ var fraction = 1.25;
151
+ var small = base / fraction;
152
+ var tiny = small / fraction;
153
+ var medium = base * fraction;
154
+ var large = medium * fraction;
155
+ var xlarge = large * fraction;
156
+ var xxlarge = xlarge * fraction;
157
+ var huge = xxlarge * fraction;
158
+ var theme = {
159
+ font: {
160
+ tiny: `${tiny}px`,
161
+ small: `${small}px`,
162
+ base: `${base}px`,
163
+ medium: `${medium}px`,
164
+ large: `${large}px`,
165
+ xlarge: `${xlarge}px`,
166
+ xxlarge: `${xxlarge}px`,
167
+ huge: `${huge}px`,
168
+ line: 1.5
169
+ },
170
+ colors: {
171
+ trueBlack: "#000",
172
+ black: "#2C2C2C",
173
+ darkerGray: "#4B4B4B",
174
+ darkGray: "#6E6E6E",
175
+ gray: "#B3B3B3",
176
+ lightGray: "#E1E1E1",
177
+ lighterGray: "#F5F5F5",
178
+ white: "#FAFAFA",
179
+ trueWhite: "#fff",
180
+ primaryDarker: "#095aba",
181
+ primaryDark: "#0d66d0",
182
+ primary: "#1473e6",
183
+ primaryRGB06: "rgba(20, 115, 230, 0.6)",
184
+ primaryLight: "#2680eb",
185
+ successDarker: "#107154",
186
+ successDark: "#12805c",
187
+ success: "#268e6c",
188
+ successLight: "#2d9d78",
189
+ dangerDarker: "#bb121a",
190
+ dangerDark: "#c9252d",
191
+ danger: "#d7373f",
192
+ dangerLight: "#e34850"
193
+ }
194
+ };
195
+ var theme_default = theme;
196
+ var import_styled_components3 = require("styled-components");
197
+ var reset3 = import_styled_components3.css`
198
+ box-sizing: border-box;
199
+ color: ${theme_default.colors.black};
200
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
201
+ Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
202
+ font-size: ${theme_default.font.base};
203
+ line-height: ${theme_default.font.line};
204
+ `;
205
+ var reset_default = reset3;
206
+ var import_styled_components22 = require("styled-components");
207
+ var buttonReset = import_styled_components22.css`
208
+ ${reset_default};
209
+ background: none;
210
+ border: 0;
211
+ outline: 0;
212
+ cursor: pointer;
213
+ `;
214
+ var buttonReset_default = buttonReset;
215
+ var import_styled_components32 = __toESM2(require("styled-components"));
216
+ var H_default = import_styled_components32.default.div`
217
+ ${reset_default};
218
+ margin: 0;
219
+ padding: 0;
220
+ font-size: ${(props) => props.theme.font[props.size]};
221
+ padding-bottom: 0.5em;
222
+ `;
223
+ var import_styled_components4 = __toESM2(require("styled-components"));
224
+ var P_default = import_styled_components4.default.p`
225
+ ${reset_default};
226
+ margin: 0;
227
+ padding: 0;
228
+ padding-bottom: 1em;
229
+ `;
230
+ var import_styled_components5 = __toESM2(require("styled-components"));
231
+ var variants = {
232
+ primary: {
233
+ border: "primary",
234
+ background: "primary",
235
+ color: "white",
236
+ hoverBorder: "primaryDark",
237
+ hoverBackground: "primaryDark",
238
+ hoverColor: "white",
239
+ activeBorder: "primaryDarker",
240
+ activeBackground: "primaryDarker",
241
+ activeColor: "white"
242
+ },
243
+ secondary: {
244
+ border: "darkerGray",
245
+ background: "white",
246
+ color: "darkerGray",
247
+ hoverBorder: "darkGray",
248
+ hoverBackground: "darkGray",
249
+ hoverColor: "white",
250
+ activeBorder: "darkerGray",
251
+ activeBackground: "darkerGray",
252
+ activeColor: "white"
253
+ },
254
+ success: {
255
+ border: "success",
256
+ background: "success",
257
+ color: "white",
258
+ hoverBorder: "successDark",
259
+ hoverBackground: "successDark",
260
+ hoverColor: "white",
261
+ activeBorder: "successDarker",
262
+ activeBackground: "successDarker",
263
+ activeColor: "white"
264
+ },
265
+ danger: {
266
+ border: "danger",
267
+ background: "danger",
268
+ color: "white",
269
+ hoverBorder: "dangerDark",
270
+ hoverBackground: "dangerDark",
271
+ hoverColor: "white",
272
+ activeBorder: "dangerDarker",
273
+ activeBackground: "dangerDarker",
274
+ activeColor: "white"
275
+ }
276
+ };
277
+ var getColor = (props, variant, key) => props.theme.colors[variants[variant][key]];
278
+ var Button2 = import_styled_components5.default.button`
279
+ ${buttonReset_default};
280
+ padding: 0.5em 1em;
281
+ margin-right: 0.25em;
282
+ border: 2px solid ${(props) => getColor(props, props.variant, "border")};
283
+ border-radius: 48px;
284
+ background-color: ${(props) => getColor(props, props.variant, "background")};
285
+ color: ${(props) => getColor(props, props.variant, "color")};
286
+ font-size: ${(props) => Button2.sizes[props.size]};
287
+ font-weight: 700;
288
+ line-height: 1;
289
+ transition: 0.2s ease-in-out all;
290
+
291
+ &:focus {
292
+ border-color: ${(props) => getColor(props, props.variant, "activeBorder")};
293
+ }
294
+
295
+ &:hover {
296
+ border-color: ${(props) => getColor(props, props.variant, "hoverBorder")};
297
+ background-color: ${(props) => getColor(props, props.variant, "hoverBackground")};
298
+ color: ${(props) => getColor(props, props.variant, "hoverColor")};
299
+ }
300
+
301
+ &:active {
302
+ border-color: ${(props) => getColor(props, props.variant, "activeBorder")};
303
+ background-color: ${(props) => getColor(props, props.variant, "activeBackground")};
304
+ color: ${(props) => getColor(props, props.variant, "activeColor")};
305
+ }
306
+
307
+ &:last-of-type {
308
+ margin-right: 0;
309
+ }
310
+ `;
311
+ Button2.defaultProps = {
312
+ type: "button",
313
+ size: "md",
314
+ variant: "primary"
315
+ };
316
+ Button2.variants = ["primary", "secondary", "success", "danger"];
317
+ Button2.sizes = {
318
+ sm: theme_default.font.small,
319
+ md: theme_default.font.base,
320
+ lg: theme_default.font.medium
321
+ };
322
+ var Button_default = Button2;
323
+ var import_react7 = __toESM2(require("react"));
324
+ var import_styled_components6 = __toESM2(require("styled-components"));
325
+ var import_jsx_runtime6 = require("react/jsx-runtime");
326
+ var TabsWrapper = import_styled_components6.default.div`
327
+ ${reset_default};
328
+ display: inline-flex;
329
+ margin-bottom: 1em;
330
+ border-bottom: 3px solid ${(props) => props.theme.colors.lightGray};
331
+ `;
332
+ var Tab = import_styled_components6.default.button`
333
+ ${buttonReset_default};
334
+ position: relative;
335
+ top: 3px;
336
+ margin-right: 2em;
337
+ padding: 0 0 0.5em 0;
338
+ border-bottom: 3px solid
339
+ ${(props) => props.active ? props.theme.colors.black : "transparent"};
340
+ color: ${(props) => props.active ? props.theme.colors.black : props.theme.colors.darkGray};
341
+ font-weight: 500;
342
+
343
+ &:hover {
344
+ border-color: ${(props) => props.theme.colors.black};
345
+ }
346
+
347
+ &:last-of-type {
348
+ margin-right: 4em;
349
+ }
350
+ `;
351
+ var Tabs = ({ initial = 0, children }) => {
352
+ const [current, setCurrent] = import_react7.default.useState(initial);
353
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react7.default.Fragment, { children: [
354
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TabsWrapper, { children: children.map((child, idx) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
355
+ Tab,
356
+ {
357
+ type: "button",
358
+ active: idx === current,
359
+ onClick: () => setCurrent(idx),
360
+ children: child.props.title
361
+ },
362
+ idx
363
+ )) }),
364
+ children[current]
365
+ ] });
366
+ };
367
+ var Tabs_default = Tabs;
368
+ var import_styled_components7 = __toESM2(require("styled-components"));
369
+ var Input_default = import_styled_components7.default.input`
370
+ ${reset_default};
371
+ border: 0;
372
+ outline: 0;
373
+ border-radius: 4px;
374
+ border: 0;
375
+ width: 100%;
376
+ padding: 0.5em 0.75em;
377
+ border: 1px solid ${(props) => props.theme.colors.gray};
378
+ background-color: ${(props) => props.theme.colors.trueWhite};
379
+ transition: all 0.2s ease-in-out;
380
+
381
+ &:hover {
382
+ border-color: ${(props) => props.theme.colors.darkGray};
383
+ }
384
+
385
+ &:focus {
386
+ border-color: ${(props) => props.theme.colors.primary};
387
+ }
388
+ `;
389
+ var import_styled_components8 = __toESM2(require("styled-components"));
390
+ var Textarea_default = import_styled_components8.default.textarea`
391
+ ${reset_default};
392
+ border: 0;
393
+ outline: 0;
394
+ border-radius: 4px;
395
+ border: 0;
396
+ width: 100%;
397
+ height: 100px;
398
+ padding: 0.5em 0.75em;
399
+ border: 1px solid ${(props) => props.theme.colors.gray};
400
+ background-color: ${(props) => props.theme.colors.trueWhite};
401
+ transition: all 0.2s ease-in-out;
402
+
403
+ &:hover {
404
+ border-color: ${(props) => props.theme.colors.darkGray};
405
+ }
406
+
407
+ &:focus {
408
+ border-color: ${(props) => props.theme.colors.primary};
409
+ }
410
+ `;
411
+ var import_styled_components9 = __toESM2(require("styled-components"));
412
+ var Select_default = import_styled_components9.default.select`
413
+ ${reset_default};
414
+ -webkit-appearance: none;
415
+ -moz-appearance: none;
416
+ border: 0;
417
+ outline: 0;
418
+ border-radius: 4px;
419
+ border: 0;
420
+ width: 100%;
421
+ padding: 0.5em 0.75em;
422
+ border: 1px solid ${(props) => props.theme.colors.gray};
423
+ background-size: 16px;
424
+ background-repeat: no-repeat;
425
+ background-position: center right 0.25em;
426
+ background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiMwMDAiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0iZmVhdGhlciBmZWF0aGVyLWNoZXZyb24tZG93biI+PHBvbHlsaW5lIHBvaW50cz0iNiA5IDEyIDE1IDE4IDkiPjwvcG9seWxpbmU+PC9zdmc+);
427
+ background-color: ${(props) => props.theme.colors.trueWhite};
428
+ transition: all 0.2s ease-in-out;
429
+
430
+ &:hover {
431
+ border-color: ${(props) => props.theme.colors.darkGray};
432
+ }
433
+
434
+ &:focus {
435
+ border-color: ${(props) => props.theme.colors.primary};
436
+ }
437
+ `;
438
+ var import_styled_components10 = __toESM2(require("styled-components"));
439
+ var FormGroup_default = import_styled_components10.default.div`
440
+ ${reset_default};
441
+ width: 100%;
442
+ margin-bottom: 1em;
443
+ `;
444
+ var import_styled_components11 = __toESM2(require("styled-components"));
445
+ var Label_default = import_styled_components11.default.label`
446
+ ${reset_default};
447
+ display: block;
448
+ margin-bottom: 0.25em;
449
+ color: ${(props) => props.theme.colors.darkerGray};
450
+ font-size: ${(props) => props.theme.font.small};
451
+ font-weight: 600;
452
+ cursor: pointer;
453
+ `;
454
+ var import_react22 = __toESM2(require("react"));
455
+ var import_styled_components12 = __toESM2(require("styled-components"));
456
+ var Hint2 = import_styled_components12.default.div`
457
+ ${reset_default};
458
+
459
+ font-size: ${(props) => props.theme.font.small};
460
+ opacity: 0.7;
461
+ color: ${(props) => props.type === "error" && props.theme.colors.danger};
462
+ `;
463
+ var Hint_default = Hint2;
464
+ var import_jsx_runtime22 = require("react/jsx-runtime");
465
+ var Field2 = (_a) => {
466
+ var _b = _a, {
467
+ as = "input",
468
+ r,
469
+ name,
470
+ label,
471
+ hint = "",
472
+ error = "",
473
+ wrapperProps
474
+ } = _b, props = __objRest2(_b, [
475
+ "as",
476
+ "r",
477
+ "name",
478
+ "label",
479
+ "hint",
480
+ "error",
481
+ "wrapperProps"
482
+ ]);
483
+ const types = {
484
+ input: Input_default,
485
+ select: Select_default,
486
+ textarea: Textarea_default
487
+ };
488
+ const Component = types[as];
489
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(FormGroup_default, __spreadProps2(__spreadValues2({}, wrapperProps), { children: [
490
+ label && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Label_default, { htmlFor: name, children: label }),
491
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Component, __spreadValues2({ ref: r, id: name, name }, props)),
492
+ hint && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Hint_default, { children: hint }),
493
+ error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Hint_default, { type: "error", children: error })
494
+ ] }));
495
+ };
496
+ var Field_default = Field2;
497
+ var import_styled_components13 = __toESM2(require("styled-components"));
498
+ var Toolbar_default = import_styled_components13.default.div`
499
+ ${reset_default};
500
+
501
+ display: flex;
502
+ align-items: center;
503
+ gap: 0.5em;
504
+ margin-bottom: ${(props) => props.mb || 0};
505
+ `;
506
+ var import_styled_components14 = __toESM2(require("styled-components"));
507
+ var Stack_default = import_styled_components14.default.div`
508
+ display: flex;
509
+ justify-content: ${(props) => props.h};
510
+ align-items: ${(props) => props.v};
511
+ gap: ${(props) => props.g};
512
+ `;
513
+ var import_styled_components15 = __toESM2(require("styled-components"));
514
+ var Container_default = import_styled_components15.default.div`
515
+ ${reset_default};
516
+ width: 100%;
517
+ padding: 0 calc(1em / 2);
518
+
519
+ padding-top: ${(props) => props.top && "1em"};
520
+ padding-bottom: ${(props) => props.bottom && "1em"};
521
+
522
+ @media (min-width: 1184px) {
523
+ width: 98%;
524
+ margin: 0 auto;
525
+ }
526
+ `;
527
+ var import_styled_components16 = __toESM2(require("styled-components"));
528
+ var Panel = import_styled_components16.default.div`
529
+ ${reset_default};
530
+ margin-bottom: 0.5em;
531
+ border: 1px solid #ddd;
532
+ border-radius: 3px;
533
+ background-color: #fff;
534
+
535
+ &.sortable-selected {
536
+ background-color: #0a0a;
537
+ }
538
+ `;
539
+ var PanelTitle = import_styled_components16.default.div`
540
+ ${reset_default};
541
+ display: flex;
542
+ justify-content: space-between;
543
+ align-items: center;
544
+ padding: 0.25em 0.25em 0.25em;
545
+ border-bottom: 1px solid #ddd;
546
+ background-color: ${(props) => props.theme.colors.lighterGray};
547
+ font-weight: 700;
548
+ `;
549
+ var PanelContent = import_styled_components16.default.div`
550
+ padding: 1em;
551
+ `;
552
+ var import_styled_components17 = __toESM2(require("styled-components"));
553
+ var Handle_default = import_styled_components17.default.div`
554
+ width: 2em;
555
+ height: 2em;
556
+ background-size: 50%;
557
+ background-repeat: no-repeat;
558
+ background-position: center;
559
+ background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiMwMDAiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0iZmVhdGhlciBmZWF0aGVyLW1vcmUtdmVydGljYWwiPjxjaXJjbGUgY3g9IjEyIiBjeT0iMTIiIHI9IjEiPjwvY2lyY2xlPjxjaXJjbGUgY3g9IjEyIiBjeT0iNSIgcj0iMSI+PC9jaXJjbGU+PGNpcmNsZSBjeD0iMTIiIGN5PSIxOSIgcj0iMSI+PC9jaXJjbGU+PC9zdmc+);
560
+ cursor: grabbing;
561
+ filter: invert(${(props) => props.active ? 1 : 0});
562
+ `;
563
+ var import_react32 = __toESM2(require("react"));
564
+ var import_styled_components18 = __toESM2(require("styled-components"));
565
+ var import_jsx_runtime32 = require("react/jsx-runtime");
566
+ var Overlay = import_styled_components18.default.div`
567
+ ${reset_default};
568
+ position: fixed;
569
+ top: 0;
570
+ right: 0;
571
+ bottom: 0;
572
+ left: 0;
573
+ z-index: 11;
574
+ background-color: rgba(0, 0, 0, 0.6);
575
+ cursor: pointer;
576
+ `;
577
+ var Wrapper3 = import_styled_components18.default.div`
578
+ ${reset_default};
579
+ position: fixed;
580
+ top: 0;
581
+ right: 0;
582
+ bottom: 0;
583
+ left: 0;
584
+ z-index: 12;
585
+ display: flex;
586
+ justify-content: center;
587
+ align-items: center;
588
+ pointer-events: none;
589
+ `;
590
+ var Inner = import_styled_components18.default.div`
591
+ ${reset_default};
592
+ width: 80%;
593
+ border-radius: 5px;
594
+ background-color: ${(props) => props.theme.colors.lighterGray};
595
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
596
+ pointer-events: all;
597
+ `;
598
+ var TitleBar = import_styled_components18.default.div`
599
+ ${reset_default};
600
+ display: flex;
601
+ justify-content: space-between;
602
+ align-items: center;
603
+ padding: 1em;
604
+ border-bottom: 2px solid ${(props) => props.theme.colors.lightGray};
605
+ `;
606
+ var Title = import_styled_components18.default.div`
607
+ ${reset_default};
608
+ font-size: 1.25em;
609
+ font-weight: 500;
610
+ `;
611
+ var CloseButton = import_styled_components18.default.button`
612
+ ${buttonReset_default};
613
+ position: relative;
614
+ right: -4px;
615
+ z-index: 13;
616
+ width: 2em;
617
+ height: 2em;
618
+ margin: 0;
619
+ padding: 0;
620
+ background-repeat: no-repeat;
621
+ background-size: 80%;
622
+ background-position: center;
623
+ background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiMwMDAiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0iZmVhdGhlciBmZWF0aGVyLXgiPjxsaW5lIHgxPSIxOCIgeTE9IjYiIHgyPSI2IiB5Mj0iMTgiPjwvbGluZT48bGluZSB4MT0iNiIgeTE9IjYiIHgyPSIxOCIgeTI9IjE4Ij48L2xpbmU+PC9zdmc+);
624
+ font-size: 1em;
625
+ overflow: hidden;
626
+ text-indent: -9999px;
627
+ `;
628
+ var Content = import_styled_components18.default.div`
629
+ ${reset_default};
630
+ padding: 0.5em 1em 1em 1em;
631
+ `;
632
+ var Modal = ({ title, children, onClose }) => {
633
+ const handleKeyUp = ({ key }) => {
634
+ if (key === "Escape")
635
+ onClose();
636
+ };
637
+ import_react32.default.useEffect(() => {
638
+ document.addEventListener("keyup", handleKeyUp);
639
+ return () => {
640
+ document.removeEventListener("keyup", handleKeyUp);
641
+ };
642
+ });
643
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react32.default.Fragment, { children: [
644
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Overlay, { onClick: onClose }),
645
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Wrapper3, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Inner, { children: [
646
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(TitleBar, { children: [
647
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Title, { children: title }),
648
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CloseButton, { type: "button", onClick: onClose, children: "\xD7" })
649
+ ] }),
650
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Content, { children })
651
+ ] }) })
652
+ ] });
653
+ };
654
+ var Modal_default = Modal;
655
+ var import_react42 = __toESM2(require("react"));
656
+ var import_styled_components19 = __toESM2(require("styled-components"));
657
+ var import_jsx_runtime42 = require("react/jsx-runtime");
658
+ var Wrapper22 = import_styled_components19.default.div`
659
+ ${reset_default}
660
+
661
+ table {
662
+ border-collapse: collapse;
663
+ width: 100%;
664
+ margin-bottom: 1em;
665
+
666
+ th,
667
+ td {
668
+ padding: 0.5em;
669
+ text-align: left;
670
+ }
671
+
672
+ tr {
673
+ border-bottom: 1px solid ${(props) => props.theme.colors.lightGray};
674
+ transition: all 0.3s ease-in-out;
675
+ }
676
+
677
+ a {
678
+ color: ${(props) => props.theme.colors.primary};
679
+ }
680
+
681
+ tbody {
682
+ tr {
683
+ &:hover {
684
+ border-color: ${(props) => props.theme.colors.gray};
685
+
686
+ td {
687
+ background-color: ${(props) => props.theme.colors.lighterGray};
688
+ }
689
+ }
690
+ }
691
+ }
692
+
693
+ .actions {
694
+ width: 50px;
695
+ white-space: nowrap;
696
+
697
+ div:first-of-type {
698
+ display: flex;
699
+ align-items: center;
700
+ }
701
+
702
+ a,
703
+ button {
704
+ margin-left: 0.5em;
705
+ }
706
+ }
707
+ }
708
+ `;
709
+ var DataGrid = ({ list, header, row }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Wrapper22, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("table", { children: [
710
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("tr", { children: header() }) }),
711
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("tbody", { children: list.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("tr", { children: row(item) }, item.id || idx)) })
712
+ ] }) });
713
+ var DataGrid_default = DataGrid;
714
+ var import_styled_components20 = __toESM2(require("styled-components"));
715
+ var Row = import_styled_components20.default.div`
716
+ ${reset_default};
717
+
718
+ @media (min-width: 1184px) {
719
+ display: grid;
720
+ grid-template-columns: repeat(12, 1fr);
721
+ grid-column-gap: ${(props) => props.gutter || "1em"};
722
+ grid-row-gap: ${(props) => props.gutter || "1em"};
723
+ margin: 0;
724
+ }
725
+ `;
726
+ var Col = import_styled_components20.default.div`
727
+ ${reset_default};
728
+
729
+ grid-column: span ${(props) => props.s || 12};
730
+ `;
731
+ var getShift = (s) => {
732
+ const SHIFTS = {
733
+ 1: "2 / span 10",
734
+ 2: "3 / span 8",
735
+ 3: "4 / span 6"
736
+ };
737
+ return SHIFTS[s];
738
+ };
739
+ var Shift = import_styled_components20.default.div`
740
+ ${reset_default};
741
+
742
+ grid-column: ${(props) => getShift(props.s)};
743
+ `;
744
+ var import_styled_components21 = __toESM2(require("styled-components"));
745
+ var Navigation = import_styled_components21.default.div`
746
+ ${reset_default};
747
+
748
+ position: fixed;
749
+ top: 0;
750
+ bottom: 0;
751
+ left: 0;
752
+ display: flex;
753
+ gap: 8px;
754
+ flex-direction: column;
755
+ align-items: center;
756
+ width: 64px;
757
+ padding: 8px 0;
758
+ background-color: ${(props) => props.theme.colors.black};
759
+ `;
760
+ var NavItem = import_styled_components21.default.div`
761
+ ${reset_default};
762
+
763
+ width: 48px;
764
+ height: 48px;
765
+ border-radius: 4px;
766
+ background-color: ${(props) => props.active ? props.theme.colors.darkerGray : "transparent"};
767
+ transition: all 0.2s ease-in-out;
768
+
769
+ &:hover {
770
+ background-color: ${(props) => props.theme.colors.darkerGray};
771
+ }
772
+
773
+ a,
774
+ button {
775
+ display: flex;
776
+ justify-content: center;
777
+ align-items: center;
778
+ width: 100%;
779
+ height: 100%;
780
+ }
781
+ `;
782
+ var import_react52 = __toESM2(require("react"));
783
+ var import_styled_components222 = __toESM2(require("styled-components"));
784
+ var import_jsx_runtime52 = require("react/jsx-runtime");
785
+ var Wrapper32 = import_styled_components222.default.div`
786
+ ${reset_default};
787
+
788
+ margin: 1em 0;
789
+ `;
790
+ var PageTitle = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Wrapper32, { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
791
+ H_default,
792
+ {
793
+ as: "h1",
794
+ size: "xlarge",
795
+ style: { fontFamily: "sans-serif", fontWeight: 700 },
796
+ children
797
+ }
798
+ ) });
799
+ var PageTitle_default = PageTitle;
800
+ var import_react62 = __toESM2(require("react"));
801
+ var import_styled_components23 = __toESM2(require("styled-components"));
802
+ var import_jsx_runtime62 = require("react/jsx-runtime");
803
+ var Wrapper4 = import_styled_components23.default.div`
804
+ ${reset_default}
805
+
806
+ display: flex;
807
+ justify-content: center;
808
+ flex-wrap: wrap;
809
+ gap: 0.25em;
810
+ padding: 1em 0 1em 0;
811
+
812
+ a,
813
+ span {
814
+ display: block;
815
+ min-width: 1.25em;
816
+ padding: 0.5em 0.75em;
817
+ font-weight: 500;
818
+ text-align: center;
819
+ }
820
+
821
+ a {
822
+ color: ${(props) => props.theme.colors.primary};
823
+ border: 1px solid ${(props) => props.theme.colors.lightGray};
824
+ border-radius: 4px;
825
+ transition: all 0.2s ease-in-out;
826
+
827
+ &:hover {
828
+ border-color: ${(props) => props.theme.colors.primary};
829
+ background-color: ${(props) => props.theme.colors.primary};
830
+ color: ${(props) => props.theme.colors.white};
831
+ }
832
+ }
833
+ `;
834
+ var Prev = ({ LinkComponent, router, currentPage }) => {
835
+ if (currentPage === 1) {
836
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { children: "Previous" });
837
+ }
838
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
839
+ LinkComponent,
840
+ {
841
+ href: {
842
+ pathname: router.pathname,
843
+ query: __spreadValues2(__spreadValues2({}, router.query), { page: currentPage - 1 })
844
+ },
845
+ children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("a", { children: "Previous" })
846
+ }
847
+ );
848
+ };
849
+ var Next = ({ currentPage, pagesCount, LinkComponent, router }) => {
850
+ if (currentPage === pagesCount) {
851
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { children: "Next" });
852
+ }
853
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
854
+ LinkComponent,
855
+ {
856
+ href: {
857
+ pathname: router.pathname,
858
+ query: __spreadValues2(__spreadValues2({}, router.query), { page: currentPage + 1 })
859
+ },
860
+ children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("a", { children: "Next" })
861
+ }
862
+ );
863
+ };
864
+ var Pagination = ({ pagination, LinkComponent, router }) => {
865
+ const { currentPage, pagesCount } = pagination;
866
+ const pages = Array(pagesCount).fill(1);
867
+ if (pagesCount <= 1 || router === null) {
868
+ return "";
869
+ }
870
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Wrapper4, { children: [
871
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
872
+ Prev,
873
+ {
874
+ LinkComponent,
875
+ router,
876
+ currentPage
877
+ }
878
+ ),
879
+ pages.map((_, idx) => {
880
+ const pageNum = idx + 1;
881
+ if (pageNum === currentPage) {
882
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { children: pageNum }, pageNum);
883
+ } else {
884
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
885
+ LinkComponent,
886
+ {
887
+ href: {
888
+ pathname: router.pathname,
889
+ query: __spreadValues2(__spreadValues2({}, router.query), { page: pageNum })
890
+ },
891
+ children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("a", { children: pageNum })
892
+ },
893
+ pageNum
894
+ );
895
+ }
896
+ }),
897
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
898
+ Next,
899
+ {
900
+ LinkComponent,
901
+ router,
902
+ currentPage,
903
+ pagesCount
904
+ }
905
+ )
906
+ ] });
907
+ };
908
+ var Pagination_default = Pagination;
909
+ var import_react72 = __toESM2(require("react"));
910
+ var import_styled_components24 = __toESM2(require("styled-components"));
911
+ var import_jsx_runtime7 = require("react/jsx-runtime");
912
+ var LanguageSwitcherWrapper = import_styled_components24.default.div`
913
+ ${reset_default};
914
+ position: relative;
915
+ display: flex;
916
+ flex-wrap: nowrap;
917
+ width: 100%;
918
+ height: 100%;
919
+ color: #fff;
920
+
921
+ &:hover {
922
+ [data-switcher] {
923
+ left: 48px;
924
+ opacity: 1;
925
+ }
926
+ }
927
+ `;
928
+ var LanguageSwitcherMenu = import_styled_components24.default.div`
929
+ ${reset_default};
930
+ position: absolute;
931
+ z-index: 9;
932
+ left: -1000px;
933
+ display: flex;
934
+ flex-wrap: nowrap;
935
+ height: 100%;
936
+ background-color: ${(props) => props.theme.colors.trueBlack};
937
+ opacity: 0;
938
+ transition: all ease-in-out 0.3s;
939
+ `;
940
+ var LanguageSwitcherItem = import_styled_components24.default.div`
941
+ ${reset_default};
942
+ display: flex;
943
+ justify-content: center;
944
+ align-items: center;
945
+ width: 48px;
946
+ height: 48px;
947
+ background-color: ${(props) => props.theme.colors.trueBlack};
948
+ text-transform: uppercase;
949
+
950
+ a {
951
+ color: ${(props) => props.theme.colors.trueWhite};
952
+ font-weight: 500;
953
+ text-decoration: none;
954
+
955
+ :hover {
956
+ background-color: ${(props) => props.theme.colors.primaryRGB06};
957
+ }
958
+ }
959
+ `;
960
+ var LanguageSwitcherNewItem = import_styled_components24.default.div`
961
+ ${reset_default};
962
+ position: relative;
963
+ width: 48px;
964
+ height: 48px;
965
+ background-color: ${(props) => props.theme.colors.trueBlack};
966
+ text-transform: uppercase;
967
+
968
+ span {
969
+ display: flex;
970
+ justify-content: center;
971
+ align-items: center;
972
+ width: 100%;
973
+ height: 100%;
974
+ opacity: 0.6;
975
+
976
+ color: ${(props) => props.theme.colors.trueWhite};
977
+ font-weight: 500;
978
+ text-decoration: none;
979
+ }
980
+
981
+ a {
982
+ position: absolute;
983
+ top: 0;
984
+ bottom: 0;
985
+ left: 0;
986
+ right: 0;
987
+ z-index: 3;
988
+
989
+ color: ${(props) => props.theme.colors.trueWhite};
990
+ font-weight: 700;
991
+ text-decoration: none;
992
+
993
+ :hover {
994
+ background-color: ${(props) => props.theme.colors.primaryRGB06};
995
+ }
996
+ }
997
+ `;
998
+ var LanguageSwitcherCurrent = import_styled_components24.default.div`
999
+ ${reset_default};
1000
+ position: relative;
1001
+ z-index: 10;
1002
+ display: flex;
1003
+ justify-content: center;
1004
+ align-items: center;
1005
+ width: 100%;
1006
+ height: 100%;
1007
+ border-radius: 4px;
1008
+ background-color: ${(props) => props.theme.colors.primary};
1009
+ text-transform: uppercase;
1010
+ cursor: pointer;
1011
+ `;
1012
+ var LanguageSwitcherItemComponent = ({ path, label }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(LanguageSwitcherItem, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("a", { href: path, children: label }) });
1013
+ var LanguageSwitcherNewItemComponent = ({ path, label }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(LanguageSwitcherNewItem, { children: [
1014
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: label }),
1015
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("a", { href: path, children: "+" })
1016
+ ] });
1017
+ var LanguageSwitcher = ({ current, navigation }) => {
1018
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(LanguageSwitcherWrapper, { children: [
1019
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(LanguageSwitcherCurrent, { children: current }),
1020
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(LanguageSwitcherMenu, { "data-switcher": true, children: navigation.map((navItem, idx) => {
1021
+ const LinkComponent = navItem.newItem ? LanguageSwitcherNewItemComponent : LanguageSwitcherItemComponent;
1022
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1023
+ LinkComponent,
1024
+ {
1025
+ path: navItem.path,
1026
+ label: navItem.label
1027
+ },
1028
+ idx
1029
+ );
1030
+ }) })
1031
+ ] });
1032
+ };
1033
+ var LanguageSwitcher_default = LanguageSwitcher;
1034
+ }
1035
+ });
1036
+
1037
+ // src/index.js
1038
+ var src_exports = {};
1039
+ __export(src_exports, {
1040
+ default: () => src_default
1041
+ });
1042
+ module.exports = __toCommonJS(src_exports);
1043
+
1044
+ // src/Form.js
1045
+ var import_react2 = __toESM(require("react"));
1046
+
1047
+ // src/Context.js
1048
+ var import_react = __toESM(require("react"));
1049
+ var Context_default = import_react.default.createContext({});
1050
+
1051
+ // src/Form.js
1052
+ var import_jsx_runtime = require("react/jsx-runtime");
1053
+ var Form = (_a) => {
1054
+ var _b = _a, { children, defaultValues = {}, onSubmit } = _b, rest = __objRest(_b, ["children", "defaultValues", "onSubmit"]);
1055
+ const [state, setState] = import_react2.default.useState({ submitting: false, errors: {} });
1056
+ const setErrors = (errors) => {
1057
+ let newErrors = {};
1058
+ errors.map((error) => newErrors[error.key] = error.message);
1059
+ if (state.submitting) {
1060
+ setState({
1061
+ submitting: false,
1062
+ errors: newErrors
1063
+ });
1064
+ } else {
1065
+ setState({
1066
+ submitting: state.submitting,
1067
+ errors: newErrors
1068
+ });
1069
+ }
1070
+ };
1071
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1072
+ "form",
1073
+ __spreadProps(__spreadValues({
1074
+ onSubmit: (e) => {
1075
+ if (!onSubmit) {
1076
+ return;
1077
+ }
1078
+ e.preventDefault();
1079
+ const formData = new FormData(e.target);
1080
+ setState(__spreadProps(__spreadValues({}, state), { submitting: true }));
1081
+ onSubmit(formData, setErrors);
1082
+ }
1083
+ }, rest), {
1084
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1085
+ Context_default.Provider,
1086
+ {
1087
+ value: {
1088
+ defaultValues,
1089
+ errors: state.errors,
1090
+ submitting: state.submitting
1091
+ },
1092
+ children
1093
+ }
1094
+ )
1095
+ })
1096
+ );
1097
+ };
1098
+ var Form_default = Form;
1099
+
1100
+ // src/Fields.js
1101
+ var import_react3 = __toESM(require("react"));
1102
+ var import_ui = __toESM(require_dist());
1103
+ var import_jsx_runtime2 = require("react/jsx-runtime");
1104
+ var HiddenInput = ({ value, name }) => {
1105
+ if (typeof value === "string") {
1106
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui.Input, { type: "hidden", defaultValue: value, name });
1107
+ } else {
1108
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui.Input, { type: "hidden", defaultValue: JSON.stringify(value), name });
1109
+ }
1110
+ };
1111
+ var CustomField = ({ component, name }) => {
1112
+ const { defaultValues, errors } = import_react3.default.useContext(Context_default);
1113
+ const [value, setValue] = import_react3.default.useState(defaultValues[name]);
1114
+ const Component = component;
1115
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react3.default.Fragment, { children: [
1116
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Component, { onChange: (newValue) => setValue(newValue), value }),
1117
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(HiddenInput, { name, value }),
1118
+ errors[name] && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui.Hint, { type: "error", children: errors[name] })
1119
+ ] });
1120
+ };
1121
+ var CheckboxGroup = ({ name, label, hint = "", entities }) => {
1122
+ const { defaultValues, errors } = import_react3.default.useContext(Context_default);
1123
+ let defaultChecked = [];
1124
+ if (defaultValues[name]) {
1125
+ defaultChecked = Array.isArray(defaultValues[name]) ? defaultValues[name] : [defaultValues[name]];
1126
+ }
1127
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ui.FormGroup, { children: [
1128
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui.Label, { htmlFor: name, children: label }),
1129
+ entities.map((entity, idx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
1130
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1131
+ "input",
1132
+ {
1133
+ type: "checkbox",
1134
+ name,
1135
+ value: `${entity.value}`,
1136
+ defaultChecked: !!defaultChecked.find((dv) => dv === entity.value)
1137
+ }
1138
+ ),
1139
+ "\xA0",
1140
+ entity.label
1141
+ ] }) }, idx)),
1142
+ hint && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui.Hint, { children: hint }),
1143
+ errors[name] && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui.Hint, { type: "error", children: errors[name] })
1144
+ ] });
1145
+ };
1146
+ var Checkbox = (_a) => {
1147
+ var _b = _a, { name, label, hint = "" } = _b, rest = __objRest(_b, ["name", "label", "hint"]);
1148
+ const { defaultValues, errors } = import_react3.default.useContext(Context_default);
1149
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ui.FormGroup, { children: [
1150
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui.Label, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ui.Stack, { v: "center", children: [
1151
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1152
+ "input",
1153
+ __spreadValues({
1154
+ type: "checkbox",
1155
+ name,
1156
+ defaultChecked: defaultValues[name]
1157
+ }, rest)
1158
+ ),
1159
+ "\xA0",
1160
+ label
1161
+ ] }) }),
1162
+ hint && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui.Hint, { children: hint }),
1163
+ errors[name] && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui.Hint, { type: "error", children: errors[name] })
1164
+ ] });
1165
+ };
1166
+ var Field = (_a) => {
1167
+ var _b = _a, {
1168
+ as = "input",
1169
+ hint = "",
1170
+ name,
1171
+ label,
1172
+ children
1173
+ } = _b, props = __objRest(_b, [
1174
+ "as",
1175
+ "hint",
1176
+ "name",
1177
+ "label",
1178
+ "children"
1179
+ ]);
1180
+ const { defaultValues, errors } = import_react3.default.useContext(Context_default);
1181
+ const types = {
1182
+ input: import_ui.Input,
1183
+ select: import_ui.Select,
1184
+ textarea: import_ui.Textarea
1185
+ };
1186
+ const Component = types[as] || import_ui.Input;
1187
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ui.FormGroup, { children: [
1188
+ label && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui.Label, { htmlFor: name, children: label }),
1189
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1190
+ Component,
1191
+ __spreadProps(__spreadValues({
1192
+ id: name,
1193
+ name,
1194
+ defaultValue: defaultValues[name]
1195
+ }, props), {
1196
+ children
1197
+ })
1198
+ ),
1199
+ hint && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui.Hint, { children: hint }),
1200
+ errors[name] && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui.Hint, { type: "error", children: errors[name] })
1201
+ ] });
1202
+ };
1203
+
1204
+ // src/Submit.js
1205
+ var import_react4 = __toESM(require("react"));
1206
+ var import_ui2 = __toESM(require_dist());
1207
+ var import_jsx_runtime3 = require("react/jsx-runtime");
1208
+ var Submit = ({ children }) => {
1209
+ const { submitting } = import_react4.default.useContext(Context_default);
1210
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui2.Button, { disabled: submitting, type: "submit", variant: "primary", children });
1211
+ };
1212
+ var Submit_default = Submit;
1213
+
1214
+ // src/Fieldset.js
1215
+ var import_react5 = __toESM(require("react"));
1216
+ var import_styled_components = __toESM(require("styled-components"));
1217
+ var import_ui3 = __toESM(require_dist());
1218
+
1219
+ // src/utils/slugify.js
1220
+ var slugify = (string) => string.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
1221
+ var slugify_default = slugify;
1222
+
1223
+ // src/Fieldset.js
1224
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1225
+ var Wrapper = import_styled_components.default.fieldset`
1226
+ ${import_ui3.reset};
1227
+ margin: 0;
1228
+ margin-bottom: 2em;
1229
+ padding: 0;
1230
+ border: 0;
1231
+
1232
+ @media (min-width: 1184px) {
1233
+ display: flex;
1234
+ gap: 1em;
1235
+ }
1236
+ `;
1237
+ var LegendWrapper = import_styled_components.default.div`
1238
+ ${import_ui3.reset};
1239
+
1240
+ @media (max-width: 1183px) {
1241
+ margin-bottom: 1em;
1242
+ }
1243
+
1244
+ @media (min-width: 1184px) {
1245
+ width: 250px;
1246
+ }
1247
+ `;
1248
+ var Legend = import_styled_components.default.legend`
1249
+ ${import_ui3.reset};
1250
+ margin-bottom: 1em;
1251
+ font-weight: 700;
1252
+ `;
1253
+ var Description = import_styled_components.default.small`
1254
+ ${import_ui3.reset};
1255
+ opacity: 0.5;
1256
+ `;
1257
+ var FieldWrapper = import_styled_components.default.div`
1258
+ ${import_ui3.reset};
1259
+ width: 100%;
1260
+ `;
1261
+ var Fieldset = ({ label, description, children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Wrapper, { id: slugify_default(label), children: [
1262
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(LegendWrapper, { children: [
1263
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Legend, { children: label }),
1264
+ description && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Description, { dangerouslySetInnerHTML: { __html: description } })
1265
+ ] }),
1266
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FieldWrapper, { children })
1267
+ ] });
1268
+ var Fieldset_default = Fieldset;
1269
+
1270
+ // src/FormNavigation.js
1271
+ var import_react6 = __toESM(require("react"));
1272
+ var import_styled_components2 = __toESM(require("styled-components"));
1273
+ var import_ui4 = __toESM(require_dist());
1274
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1275
+ var Wrapper2 = import_styled_components2.default.div`
1276
+ ${import_ui4.reset};
1277
+ display: flex;
1278
+ gap: 1em;
1279
+ flex-direction: column;
1280
+
1281
+ @media (max-width: 1183px) {
1282
+ margin-bottom: 2em;
1283
+ }
1284
+
1285
+ @media (min-width: 1184px) {
1286
+ position: sticky;
1287
+ top: 80px;
1288
+ }
1289
+ `;
1290
+ var Link = import_styled_components2.default.a`
1291
+ ${import_ui4.reset};
1292
+ color: ${(props) => props.theme.colors.primary};
1293
+ font-weight: 500;
1294
+ text-decoration: none;
1295
+
1296
+ &:hover {
1297
+ text-decoration: underline;
1298
+ }
1299
+ `;
1300
+ var FormNavigation = ({ sections, children }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Wrapper2, { children: [
1301
+ sections.map((section, idx) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Link, { href: `#${slugify_default(section)}`, children: section }, `${section}-${idx}`)),
1302
+ children
1303
+ ] });
1304
+ var FormNavigation_default = FormNavigation;
1305
+
1306
+ // src/index.js
1307
+ Form_default.Field = Field;
1308
+ Form_default.CustomField = CustomField;
1309
+ Form_default.CheckboxGroup = CheckboxGroup;
1310
+ Form_default.Checkbox = Checkbox;
1311
+ Form_default.Submit = Submit_default;
1312
+ Form_default.Fieldset = Fieldset_default;
1313
+ Form_default.FormNavigation = FormNavigation_default;
1314
+ var src_default = Form_default;
1315
+ // Annotate the CommonJS export names for ESM import in node:
1316
+ 0 && (module.exports = {});