@abgov/react-components 6.11.0 → 7.0.0-dev.2

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/index.d.ts +5 -0
  2. package/index.js +3084 -1074
  3. package/index.js.map +1 -1
  4. package/index.mjs +3680 -1670
  5. package/index.mjs.map +1 -1
  6. package/lib/app-header/app-header.d.ts +5 -2
  7. package/lib/app-header-menu/app-header-menu.d.ts +8 -7
  8. package/lib/badge/badge.d.ts +23 -18
  9. package/lib/button/button.d.ts +23 -0
  10. package/lib/calendar/calendar.d.ts +17 -0
  11. package/lib/callout/callout.d.ts +21 -2
  12. package/lib/checkbox/checkbox.d.ts +30 -2
  13. package/lib/checkbox-list/checkbox-list.d.ts +11 -8
  14. package/lib/date-picker/date-picker.d.ts +22 -0
  15. package/lib/drawer/drawer.d.ts +16 -0
  16. package/lib/dropdown/dropdown-item.d.ts +15 -0
  17. package/lib/dropdown/dropdown.d.ts +34 -2
  18. package/lib/file-upload-card/file-upload-card.d.ts +18 -0
  19. package/lib/file-upload-input/file-upload-input.d.ts +16 -0
  20. package/lib/filter-chip/filter-chip.d.ts +21 -1
  21. package/lib/footer/footer.d.ts +13 -1
  22. package/lib/footer-meta-section/footer-meta-section.d.ts +10 -0
  23. package/lib/footer-nav-section/footer-nav-section.d.ts +12 -0
  24. package/lib/form-item/form-item.d.ts +24 -2
  25. package/lib/input/input.d.ts +43 -2
  26. package/lib/link/link.d.ts +22 -3
  27. package/lib/menu-button/menu-button.d.ts +9 -52
  28. package/lib/modal/modal.d.ts +24 -1
  29. package/lib/notification/notification.d.ts +21 -2
  30. package/lib/pagination/pagination.d.ts +16 -0
  31. package/lib/push-drawer/push-drawer.d.ts +7 -6
  32. package/lib/radio-group/radio-group.d.ts +24 -2
  33. package/lib/radio-group/radio.d.ts +24 -1
  34. package/lib/side-menu/side-menu.d.ts +12 -1
  35. package/lib/side-menu-group/side-menu-group.d.ts +14 -1
  36. package/lib/side-menu-heading/side-menu-heading.d.ts +13 -1
  37. package/lib/table/table-sort-header.d.ts +15 -2
  38. package/lib/table/table.d.ts +22 -2
  39. package/lib/tabs/tabs.d.ts +22 -2
  40. package/lib/textarea/textarea.d.ts +29 -1
  41. package/{experimental → lib}/work-side-menu/work-side-menu.d.ts +3 -2
  42. package/{experimental → lib}/work-side-menu-group/work-side-menu-group.d.ts +6 -4
  43. package/{experimental → lib}/work-side-menu-item/work-side-menu-item.d.ts +5 -4
  44. package/lib/work-side-notification-item/work-side-notification-item.d.ts +31 -0
  45. package/lib/work-side-notification-panel/work-side-notification-panel.d.ts +25 -0
  46. package/package.json +1 -6
  47. package/experimental/badge/badge.d.ts +0 -33
  48. package/experimental/button/button.d.ts +0 -43
  49. package/experimental/calendar/calendar.d.ts +0 -30
  50. package/experimental/callout/callout.d.ts +0 -33
  51. package/experimental/checkbox/checkbox.d.ts +0 -52
  52. package/experimental/date-picker/date-picker.d.ts +0 -43
  53. package/experimental/drawer/drawer.d.ts +0 -31
  54. package/experimental/dropdown/dropdown-item.d.ts +0 -26
  55. package/experimental/dropdown/dropdown.d.ts +0 -62
  56. package/experimental/file-upload-card/file-upload-card.d.ts +0 -32
  57. package/experimental/file-upload-input/file-upload-input.d.ts +0 -27
  58. package/experimental/filter-chip/filter-chip.d.ts +0 -31
  59. package/experimental/footer/footer.d.ts +0 -24
  60. package/experimental/footer-meta-section/footer-meta-section.d.ts +0 -18
  61. package/experimental/footer-nav-section/footer-nav-section.d.ts +0 -22
  62. package/experimental/form-hook.d.ts +0 -8
  63. package/experimental/form-item/form-item.d.ts +0 -46
  64. package/experimental/index.d.ts +0 -32
  65. package/experimental/input/input.d.ts +0 -124
  66. package/experimental/link/link.d.ts +0 -32
  67. package/experimental/modal/modal.d.ts +0 -44
  68. package/experimental/notification/notification.d.ts +0 -31
  69. package/experimental/pagination/pagination.d.ts +0 -29
  70. package/experimental/radio-group/radio-group.d.ts +0 -40
  71. package/experimental/radio-group/radio.d.ts +0 -42
  72. package/experimental/side-menu/side-menu.d.ts +0 -19
  73. package/experimental/side-menu-group/side-menu-group.d.ts +0 -24
  74. package/experimental/side-menu-heading/side-menu-heading.d.ts +0 -23
  75. package/experimental/table/table-sort-header.d.ts +0 -20
  76. package/experimental/table/table.d.ts +0 -30
  77. package/experimental/tabs/tabs.d.ts +0 -27
  78. package/experimental/textarea/textarea.d.ts +0 -53
  79. package/experimental.js +0 -1245
  80. package/experimental.js.map +0 -1
  81. package/experimental.mjs +0 -1245
  82. package/experimental.mjs.map +0 -1
  83. package/parseISO-BHUUf1QW.mjs +0 -1693
  84. package/parseISO-BHUUf1QW.mjs.map +0 -1
  85. package/parseISO-Dj57mwuH.js +0 -1692
  86. package/parseISO-Dj57mwuH.js.map +0 -1
package/index.js CHANGED
@@ -12,7 +12,20 @@ var _PublicFormController_instances, updateObjectListState_fn, dispatchError_fn;
12
12
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
13
13
  const jsxRuntime = require("react/jsx-runtime");
14
14
  const react = require("react");
15
- const parseISO = require("./parseISO-Dj57mwuH.js");
15
+ const lowercase = (input) => input.toLowerCase();
16
+ const kebab = (input) => input.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
17
+ function transformProps(props, transform = lowercase) {
18
+ const result = {};
19
+ for (const [key, value] of Object.entries(props)) {
20
+ if (value === void 0) continue;
21
+ if (key.startsWith("data-")) {
22
+ result[key] = value;
23
+ } else {
24
+ result[transform(key)] = value;
25
+ }
26
+ }
27
+ return result;
28
+ }
16
29
  function GoabAccordion({
17
30
  open,
18
31
  onChange,
@@ -21,7 +34,7 @@ function GoabAccordion({
21
34
  ...rest
22
35
  }) {
23
36
  const ref = react.useRef(null);
24
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
37
+ const _props = transformProps(rest, lowercase);
25
38
  react.useEffect(() => {
26
39
  const element = ref.current;
27
40
  if (element && onChange) {
@@ -51,10 +64,11 @@ function GoabAccordion({
51
64
  function GoabAppHeader({
52
65
  onMenuClick,
53
66
  children,
67
+ secondaryText,
54
68
  ...rest
55
69
  }) {
56
70
  const el = react.useRef(null);
57
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
71
+ const _props = transformProps(rest, lowercase);
58
72
  react.useEffect(() => {
59
73
  if (!el.current) {
60
74
  return;
@@ -76,17 +90,20 @@ function GoabAppHeader({
76
90
  {
77
91
  ref: el,
78
92
  hasmenuclickhandler: onMenuClick ? "true" : "false",
93
+ secondarytext: secondaryText,
79
94
  ..._props,
95
+ version: "2",
80
96
  children
81
97
  }
82
98
  );
83
99
  }
84
100
  function GoabAppHeaderMenu({
85
101
  children,
102
+ slotName,
86
103
  ...rest
87
104
  }) {
88
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
89
- return /* @__PURE__ */ jsxRuntime.jsx("goa-app-header-menu", { ..._props, children });
105
+ const _props = transformProps(rest, lowercase);
106
+ return /* @__PURE__ */ jsxRuntime.jsx("goa-app-header-menu", { slot: slotName, ..._props, children });
90
107
  }
91
108
  function getIconValue(icon, iconType) {
92
109
  if (icon !== void 0) {
@@ -94,114 +111,23 @@ function getIconValue(icon, iconType) {
94
111
  }
95
112
  return iconType ? "true" : "false";
96
113
  }
97
- function GoabBadge({ icon, iconType, ...rest }) {
98
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
114
+ function GoabBadge({
115
+ icon,
116
+ iconType,
117
+ size = "medium",
118
+ emphasis = "strong",
119
+ ...rest
120
+ }) {
121
+ const _props = transformProps({ size, emphasis, ...rest }, lowercase);
99
122
  return /* @__PURE__ */ jsxRuntime.jsx(
100
123
  "goa-badge",
101
124
  {
102
125
  icon: getIconValue(icon, iconType),
103
126
  icontype: iconType,
104
- ..._props
105
- }
106
- );
107
- }
108
- function GoabInfoBadge({
109
- content,
110
- testId,
111
- icon,
112
- mt,
113
- mr,
114
- mb,
115
- ml,
116
- ariaLabel
117
- }) {
118
- return /* @__PURE__ */ jsxRuntime.jsx(
119
- GoabBadge,
120
- {
121
- type: "information",
122
- icon,
123
- content,
124
- testId,
125
- ariaLabel,
126
- mt,
127
- mr,
128
- mb,
129
- ml
130
- }
131
- );
132
- }
133
- function GoabSuccessBadge({
134
- content,
135
- testId,
136
- icon,
137
- mt,
138
- mr,
139
- mb,
140
- ml,
141
- ariaLabel
142
- }) {
143
- return /* @__PURE__ */ jsxRuntime.jsx(
144
- GoabBadge,
145
- {
146
- type: "success",
147
- icon,
148
- content,
149
- ariaLabel,
150
- testId,
151
- mt,
152
- mr,
153
- mb,
154
- ml
155
- }
156
- );
157
- }
158
- function GoabImportantBadge({
159
- content,
160
- testId,
161
- icon,
162
- mt,
163
- mr,
164
- mb,
165
- ml,
166
- ariaLabel
167
- }) {
168
- return /* @__PURE__ */ jsxRuntime.jsx(
169
- GoabBadge,
170
- {
171
- type: "important",
172
- icon,
173
- content,
174
- testId,
175
- ariaLabel,
176
- mt,
177
- mr,
178
- mb,
179
- ml
180
- }
181
- );
182
- }
183
- function GoabEmergencyBadge({
184
- content,
185
- testId,
186
- icon,
187
- mt,
188
- mr,
189
- mb,
190
- ml,
191
- ariaLabel
192
- }) {
193
- return /* @__PURE__ */ jsxRuntime.jsx(
194
- GoabBadge,
195
- {
196
- type: "emergency",
197
- icon,
198
- content,
199
- testId,
200
- ariaLabel,
201
- mt,
202
- mr,
203
- mb,
204
- ml
127
+ ..._props,
128
+ version: "2",
129
+ size,
130
+ emphasis
205
131
  }
206
132
  );
207
133
  }
@@ -210,9 +136,9 @@ function GoabBlock({
210
136
  children,
211
137
  ...rest
212
138
  }) {
213
- const _props = parseISO.transformProps(
139
+ const _props = transformProps(
214
140
  { testid: testId, ...rest },
215
- parseISO.kebab
141
+ kebab
216
142
  );
217
143
  return /* @__PURE__ */ jsxRuntime.jsx("goa-block", { ..._props, children });
218
144
  }
@@ -225,7 +151,7 @@ function GoabButton({
225
151
  ...rest
226
152
  }) {
227
153
  const el = react.useRef(null);
228
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
154
+ const _props = transformProps(rest, lowercase);
229
155
  react.useEffect(() => {
230
156
  if (!el.current) {
231
157
  return;
@@ -250,6 +176,7 @@ function GoabButton({
250
176
  "action-arg": actionArg,
251
177
  "action-args": JSON.stringify(actionArgs),
252
178
  ..._props,
179
+ version: "2",
253
180
  children
254
181
  }
255
182
  );
@@ -258,7 +185,7 @@ function GoabButtonGroup({
258
185
  children,
259
186
  ...rest
260
187
  }) {
261
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
188
+ const _props = transformProps(rest, lowercase);
262
189
  return /* @__PURE__ */ jsxRuntime.jsx("goa-button-group", { ..._props, children });
263
190
  }
264
191
  function GoabCalendar({
@@ -269,7 +196,7 @@ function GoabCalendar({
269
196
  ...rest
270
197
  }) {
271
198
  const ref = react.useRef(null);
272
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
199
+ const _props = transformProps(rest, lowercase);
273
200
  react.useEffect(() => {
274
201
  if (!ref.current) {
275
202
  return;
@@ -293,6 +220,7 @@ function GoabCalendar({
293
220
  name,
294
221
  min: min || void 0,
295
222
  max: max || void 0,
223
+ version: "2",
296
224
  ..._props
297
225
  }
298
226
  );
@@ -302,14 +230,15 @@ const GoabCallout = ({
302
230
  iconTheme = "outline",
303
231
  size = "large",
304
232
  ariaLive = "off",
233
+ emphasis = "medium",
305
234
  children,
306
235
  ...rest
307
236
  }) => {
308
- const _props = parseISO.transformProps(
309
- { type, icontheme: iconTheme, size, arialive: ariaLive, ...rest },
310
- parseISO.lowercase
237
+ const _props = transformProps(
238
+ { type, icontheme: iconTheme, size, arialive: ariaLive, emphasis, ...rest },
239
+ lowercase
311
240
  );
312
- return /* @__PURE__ */ jsxRuntime.jsx("goa-callout", { ..._props, children });
241
+ return /* @__PURE__ */ jsxRuntime.jsx("goa-callout", { ..._props, version: "2", children });
313
242
  };
314
243
  function GoabCheckbox({
315
244
  error,
@@ -322,10 +251,11 @@ function GoabCheckbox({
322
251
  onChange,
323
252
  name,
324
253
  children,
254
+ size = "default",
325
255
  ...rest
326
256
  }) {
327
257
  const el = react.useRef(null);
328
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
258
+ const _props = transformProps({ size, ...rest }, lowercase);
329
259
  react.useEffect(() => {
330
260
  if (!el.current) {
331
261
  return;
@@ -352,6 +282,7 @@ function GoabCheckbox({
352
282
  disabled: disabled ? "true" : void 0,
353
283
  value: typeof value === "boolean" ? value ? "true" : void 0 : value,
354
284
  description: typeof description === "string" ? description : void 0,
285
+ version: "2",
355
286
  children: [
356
287
  children,
357
288
  typeof description !== "string" && description && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "description", children: description }),
@@ -367,6 +298,7 @@ function GoabCheckboxList({
367
298
  error,
368
299
  testId,
369
300
  maxWidth,
301
+ size = "default",
370
302
  children,
371
303
  onChange,
372
304
  mt,
@@ -379,24 +311,12 @@ function GoabCheckboxList({
379
311
  if (!el.current) return;
380
312
  const current = el.current;
381
313
  const listener = (e) => {
382
- try {
383
- const detail = e.detail;
384
- onChange == null ? void 0 : onChange({ ...detail, event: e });
385
- } catch (error2) {
386
- console.error("Error handling checkbox list change:", error2);
387
- }
314
+ const detail = e.detail;
315
+ onChange == null ? void 0 : onChange({ ...detail, event: e });
388
316
  };
389
- try {
390
- current.addEventListener("_change", listener);
391
- } catch (error2) {
392
- console.error("Failed to attach checkbox list listener:", error2);
393
- }
317
+ current.addEventListener("_change", listener);
394
318
  return () => {
395
- try {
396
- current.removeEventListener("_change", listener);
397
- } catch (error2) {
398
- console.error("Failed to remove checkbox list listener:", error2);
399
- }
319
+ current.removeEventListener("_change", listener);
400
320
  };
401
321
  }, [onChange]);
402
322
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -409,6 +329,8 @@ function GoabCheckboxList({
409
329
  error: error ? "true" : void 0,
410
330
  testid: testId,
411
331
  maxwidth: maxWidth,
332
+ version: "2",
333
+ size,
412
334
  mt,
413
335
  mr,
414
336
  mb,
@@ -424,7 +346,7 @@ const GoabChip = ({
424
346
  ...rest
425
347
  }) => {
426
348
  const el = react.useRef(null);
427
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
349
+ const _props = transformProps(rest, lowercase);
428
350
  react.useEffect(() => {
429
351
  if (!el.current) return;
430
352
  if (!onClick) return;
@@ -449,7 +371,7 @@ const GoabChip = ({
449
371
  };
450
372
  const GoabCircularProgress = ({
451
373
  visible,
452
- message,
374
+ message: message2,
453
375
  progress,
454
376
  variant,
455
377
  size,
@@ -459,7 +381,7 @@ const GoabCircularProgress = ({
459
381
  "goa-circular-progress",
460
382
  {
461
383
  visible: visible ? "true" : void 0,
462
- message,
384
+ message: message2,
463
385
  progress,
464
386
  variant,
465
387
  size,
@@ -474,7 +396,7 @@ function GoabContainer({
474
396
  children,
475
397
  ...rest
476
398
  }) {
477
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
399
+ const _props = transformProps(rest, lowercase);
478
400
  const headingContent = heading || title;
479
401
  return /* @__PURE__ */ jsxRuntime.jsxs("goa-container", { ..._props, children: [
480
402
  headingContent && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "title", children: headingContent }),
@@ -498,140 +420,2335 @@ function GoabDataGrid({
498
420
  }
499
421
  );
500
422
  }
501
- function GoabDatePicker({
502
- value,
503
- error,
504
- min,
505
- max,
506
- disabled,
507
- relative,
508
- onChange,
509
- ...rest
510
- }) {
511
- const ref = react.useRef(null);
512
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
513
- react.useEffect(() => {
514
- if (value && typeof value !== "string") {
515
- console.warn("Using a `Date` type for value is deprecated. Instead use a string of the format `yyyy-mm-dd`");
516
- }
517
- }, []);
518
- react.useEffect(() => {
519
- if (!ref.current) {
520
- return;
521
- }
522
- const current = ref.current;
523
- const handleChange = (e) => {
524
- const detail = e.detail;
525
- onChange == null ? void 0 : onChange({ ...detail, event: e });
526
- };
527
- if (onChange) {
528
- current.addEventListener("_change", handleChange);
529
- }
530
- return () => {
531
- if (onChange) {
532
- current.removeEventListener("_change", handleChange);
533
- }
534
- };
535
- }, [onChange]);
536
- const formatValue = (val) => {
537
- if (!val) return "";
538
- if (val instanceof Date) {
539
- return val.toISOString();
540
- }
541
- return val;
542
- };
543
- return /* @__PURE__ */ jsxRuntime.jsx(
544
- "goa-date-picker",
545
- {
546
- ref,
547
- value: formatValue(value) || void 0,
548
- error: error ? "true" : void 0,
549
- disabled: disabled ? "true" : void 0,
550
- min: formatValue(min) || void 0,
551
- max: formatValue(max) || void 0,
552
- relative: relative ? "true" : void 0,
553
- ..._props
554
- }
555
- );
556
- }
557
- function GoabDetails({
558
- open,
559
- children,
560
- ...rest
561
- }) {
562
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
563
- return /* @__PURE__ */ jsxRuntime.jsx(
564
- "goa-details",
565
- {
566
- open: open ? "true" : void 0,
567
- ..._props,
568
- children
569
- }
423
+ function dispatch(el, eventName, detail, opts) {
424
+ if (!el) {
425
+ console.error("dispatch element is null");
426
+ return;
427
+ }
428
+ el.dispatchEvent(
429
+ new CustomEvent(eventName, {
430
+ composed: true,
431
+ bubbles: opts == null ? void 0 : opts.bubbles,
432
+ detail
433
+ })
570
434
  );
571
435
  }
572
- function GoabDivider(props) {
573
- return /* @__PURE__ */ jsxRuntime.jsx(
574
- "goa-divider",
575
- {
576
- mt: props.mt,
577
- mr: props.mr,
578
- mb: props.mb,
579
- ml: props.ml,
580
- testid: props.testId
581
- }
436
+ function relay(el, eventName, data, opts) {
437
+ if (!el) {
438
+ console.error("dispatch element is null");
439
+ return;
440
+ }
441
+ el.dispatchEvent(
442
+ new CustomEvent("msg", {
443
+ composed: true,
444
+ bubbles: opts == null ? void 0 : opts.bubbles,
445
+ detail: {
446
+ action: eventName,
447
+ data
448
+ }
449
+ })
582
450
  );
583
451
  }
584
- function GoabDrawer({
585
- position,
586
- open,
587
- heading,
588
- maxSize,
589
- testId,
590
- actions,
591
- children,
592
- onClose
593
- }) {
594
- const el = react.useRef(null);
595
- react.useEffect(() => {
596
- var _a;
597
- if (!(el == null ? void 0 : el.current) || !onClose) {
452
+ class PublicFormController {
453
+ constructor(type) {
454
+ __privateAdd(this, _PublicFormController_instances);
455
+ __publicField(this, "state");
456
+ __publicField(this, "_formData");
457
+ __publicField(this, "_formRef");
458
+ __publicField(this, "_isCompleting", false);
459
+ this.type = type;
460
+ }
461
+ // Obtain reference to the form element
462
+ init(e) {
463
+ if (this._formRef) {
464
+ console.warn("init: form element has already been set");
598
465
  return;
599
466
  }
600
- (_a = el.current) == null ? void 0 : _a.addEventListener("_close", onClose);
601
- return () => {
602
- var _a2;
603
- (_a2 = el.current) == null ? void 0 : _a2.removeEventListener("_close", onClose);
467
+ this._formRef = e.detail.el;
468
+ this.state = {
469
+ uuid: crypto.randomUUID(),
470
+ form: {},
471
+ history: [],
472
+ editting: "",
473
+ status: "not-started"
604
474
  };
605
- }, [el, onClose]);
606
- return /* @__PURE__ */ jsxRuntime.jsxs(
607
- "goa-drawer",
608
- {
609
- ref: el,
610
- position,
611
- open: open ? true : void 0,
612
- heading: typeof heading === "string" ? heading : void 0,
613
- maxsize: maxSize,
614
- testid: testId,
615
- children: [
616
- heading && typeof heading !== "string" && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "heading", children: heading }),
617
- actions && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "actions", children: actions }),
618
- children
619
- ]
620
- }
621
- );
622
- }
623
- function stringify(value) {
624
- if (typeof value === "undefined") {
625
- return "";
626
475
  }
627
- if (typeof value === "string") {
628
- return value;
476
+ initList(e) {
477
+ this._formRef = e.detail.el;
478
+ this.state = [];
629
479
  }
630
- return JSON.stringify(value);
631
- }
632
- function GoabDropdown({
633
- value,
634
- onChange,
480
+ // Public method to allow for the initialization of the state
481
+ initState(state, callback) {
482
+ relay(this._formRef, "external::init:state", state);
483
+ if (typeof state === "string") {
484
+ this.state = JSON.parse(state);
485
+ } else if (!Array.isArray(state)) {
486
+ this.state = state;
487
+ }
488
+ if (callback) {
489
+ setTimeout(callback, 201);
490
+ }
491
+ }
492
+ updateListState(e) {
493
+ const detail = e.detail;
494
+ if (!Array.isArray(detail.data)) {
495
+ return;
496
+ }
497
+ this.state = detail.data;
498
+ }
499
+ updateObjectState(e) {
500
+ var _a, _b;
501
+ if (Array.isArray(this.state)) {
502
+ return;
503
+ }
504
+ const detail = e.detail;
505
+ if (detail.type === "list") {
506
+ this.state = {
507
+ ...this.state,
508
+ form: { ...((_a = this.state) == null ? void 0 : _a.form) || {}, [detail.id]: detail.data }
509
+ };
510
+ } else {
511
+ this.state = {
512
+ ...this.state,
513
+ ...detail.data,
514
+ form: { ...((_b = this.state) == null ? void 0 : _b.form) || {}, ...detail.data.form },
515
+ history: detail.data.history
516
+ };
517
+ }
518
+ }
519
+ getStateList() {
520
+ if (!this.state) {
521
+ return [];
522
+ }
523
+ if (!Array.isArray(this.state)) {
524
+ console.warn(
525
+ "Utils:getStateList: unable to update the state of a non-multi form type",
526
+ this.state
527
+ );
528
+ return [];
529
+ }
530
+ if (this.state.length === 0) {
531
+ return [];
532
+ }
533
+ return this.state.map((s) => {
534
+ return Object.values(s.form).filter((item) => {
535
+ var _a;
536
+ return ((_a = item == null ? void 0 : item.data) == null ? void 0 : _a.type) === "details";
537
+ }).map((item) => {
538
+ var _a;
539
+ return item.data.type === "details" && ((_a = item.data) == null ? void 0 : _a.fieldsets) || {};
540
+ }).reduce(
541
+ (acc, item) => {
542
+ for (const [key, value] of Object.entries(item)) {
543
+ acc[key] = value.value;
544
+ }
545
+ return acc;
546
+ },
547
+ {}
548
+ );
549
+ });
550
+ }
551
+ // getStateItems(group: string): Record<string, FieldsetItemState>[] {
552
+ // if (Array.isArray(this.state)) {
553
+ // console.error(
554
+ // "Utils:getStateItems: unable to update the state of a multi form type",
555
+ // );
556
+ // return [];
557
+ // }
558
+ // if (!this.state) {
559
+ // console.error("Utils:getStateItems: state has not yet been set");
560
+ // return [];
561
+ // }
562
+ //
563
+ // const data = this.state.form[group].data;
564
+ // if (data.type !== "list") {
565
+ // return [];
566
+ // }
567
+ //
568
+ // return data.items.;
569
+ // }
570
+ // Public method to allow for the retrieval of the state value
571
+ getStateValue(group, key) {
572
+ if (Array.isArray(this.state)) {
573
+ console.error("getStateValue: unable to update the state of a multi form type");
574
+ return "";
575
+ }
576
+ if (!this.state) {
577
+ console.error("getStateValue: state has not yet been set");
578
+ return "";
579
+ }
580
+ const data = this.state.form[group].data;
581
+ if (data.type !== "details") {
582
+ return "";
583
+ }
584
+ return data.fieldsets[key].value;
585
+ }
586
+ // Public method to allow for the continuing to the next page
587
+ continueTo(next) {
588
+ if (!next) {
589
+ console.error("continueTo [name] is undefined");
590
+ return;
591
+ }
592
+ relay(this._formRef, "external::continue", { next });
593
+ }
594
+ // Public method to perform validation and send the appropriate messages to the form elements
595
+ validate(e, field, validators, options) {
596
+ var _a;
597
+ const { el, state, cancelled } = e.detail;
598
+ const value = (_a = state == null ? void 0 : state[field]) == null ? void 0 : _a.value;
599
+ window.scrollTo({ top: 0, behavior: "smooth" });
600
+ if (cancelled) {
601
+ return [true, value];
602
+ }
603
+ for (const validator of validators) {
604
+ const msg = validator(value);
605
+ __privateMethod(this, _PublicFormController_instances, dispatchError_fn).call(this, el, field, msg, options);
606
+ if (msg) {
607
+ return [false, ""];
608
+ }
609
+ }
610
+ return [true, value];
611
+ }
612
+ /**
613
+ * Validates a group of fields ensuring that at least `minPassCount` of the items within the group
614
+ * passes. This is useful in the scenario when n number fields are required out of n+m number of fields.
615
+ *
616
+ * @param {string[]} fields - An array of field names to be validated.
617
+ * @param {Event} e - The event object associated with the validation trigger.
618
+ * @param {FieldValidator[]} validators - An array of validator functions to apply to the fields.
619
+ * @return {[number, Record<string, boolean>]} - Returns back the number of fields that passed and a record of the fields and their pass status.
620
+ */
621
+ validateGroup(e, fields, validators) {
622
+ let passCount = 0;
623
+ const validGroups = {};
624
+ for (const field of fields) {
625
+ const [_valid] = this.validate(e, field, validators, { grouped: true });
626
+ if (_valid) {
627
+ validGroups[field] = true;
628
+ passCount++;
629
+ }
630
+ }
631
+ return [passCount, validGroups];
632
+ }
633
+ edit(index) {
634
+ relay(this._formRef, "external::alter:state", { index, operation: "edit" });
635
+ }
636
+ remove(index) {
637
+ relay(this._formRef, "external::alter:state", {
638
+ index,
639
+ operation: "remove"
640
+ });
641
+ }
642
+ /**
643
+ * Completes the form and triggers the onComplete callback.
644
+ * This method should be used when you want to complete a form without navigating to a summary page.
645
+ *
646
+ * @important Developers must validate the form before calling this method.
647
+ *
648
+ * @example
649
+ * // Validate first, then complete
650
+ * const [isValid] = this.validate(e, "firstName", [
651
+ * requiredValidator("First name is required.")
652
+ * ]);
653
+ * if (isValid) {
654
+ * this.complete();
655
+ * }
656
+ * @returns void
657
+ */
658
+ complete() {
659
+ if (!this._formRef) {
660
+ console.error("complete: form ref is not set");
661
+ return;
662
+ }
663
+ if (this._isCompleting) {
664
+ console.warn("complete: completion already in progress");
665
+ return;
666
+ }
667
+ this._isCompleting = true;
668
+ relay(this._formRef, "fieldset::submit", null, { bubbles: true });
669
+ this._isCompleting = false;
670
+ }
671
+ /**
672
+ * Completes a subform and returns control to the parent form.
673
+ * This method should be used when working with subforms that need to complete without a summary page.
674
+ *
675
+ * @important Developers must validate the subform before calling this method.
676
+ *
677
+ * @example
678
+ * // Validate first, then complete the subform
679
+ * const [isValid] = this._childFormController.validate(e, "fullName", [
680
+ * requiredValidator("Please enter the dependent's full name.")
681
+ * ]);
682
+ * if (isValid) {
683
+ * this._childFormController.completeSubform();
684
+ * }
685
+ * @returns void
686
+ */
687
+ completeSubform() {
688
+ if (!this._formRef) {
689
+ console.error("completeSubform: form ref is not set");
690
+ return;
691
+ }
692
+ if (this._isCompleting) {
693
+ console.warn("completeSubform: completion already in progress");
694
+ return;
695
+ }
696
+ const formRef = this._formRef;
697
+ this._isCompleting = true;
698
+ const stateChangeHandler = (e) => {
699
+ formRef.removeEventListener("_stateChange", stateChangeHandler);
700
+ dispatch(formRef, "_complete", {}, { bubbles: true });
701
+ this._isCompleting = false;
702
+ };
703
+ formRef.addEventListener("_stateChange", stateChangeHandler);
704
+ dispatch(formRef, "_continue", null, { bubbles: true });
705
+ }
706
+ // removes any data collected that doesn't correspond with the final history path
707
+ clean(data) {
708
+ return data.history.reduce((acc, fieldsetId) => {
709
+ acc[fieldsetId] = data.form[fieldsetId];
710
+ return acc;
711
+ }, {});
712
+ }
713
+ }
714
+ _PublicFormController_instances = new WeakSet();
715
+ updateObjectListState_fn = function(detail) {
716
+ var _a;
717
+ if (!Array.isArray(detail.data)) {
718
+ return;
719
+ }
720
+ if (Array.isArray(this.state)) {
721
+ return;
722
+ }
723
+ this.state = {
724
+ ...this.state,
725
+ form: {
726
+ ...((_a = this.state) == null ? void 0 : _a.form) || {},
727
+ [detail.id]: detail.data
728
+ }
729
+ };
730
+ };
731
+ // Private method to dispatch the error message to the form element
732
+ dispatchError_fn = function(el, name, msg, options) {
733
+ el.dispatchEvent(
734
+ new CustomEvent("msg", {
735
+ composed: true,
736
+ detail: {
737
+ action: "external::set:error",
738
+ data: {
739
+ name,
740
+ msg,
741
+ grouped: options == null ? void 0 : options.grouped
742
+ }
743
+ }
744
+ })
745
+ );
746
+ };
747
+ function toDate(argument) {
748
+ const argStr = Object.prototype.toString.call(argument);
749
+ if (argument instanceof Date || typeof argument === "object" && argStr === "[object Date]") {
750
+ return new argument.constructor(+argument);
751
+ } else if (typeof argument === "number" || argStr === "[object Number]" || typeof argument === "string" || argStr === "[object String]") {
752
+ return new Date(argument);
753
+ } else {
754
+ return /* @__PURE__ */ new Date(NaN);
755
+ }
756
+ }
757
+ function constructFrom(date, value) {
758
+ if (date instanceof Date) {
759
+ return new date.constructor(value);
760
+ } else {
761
+ return new Date(value);
762
+ }
763
+ }
764
+ function addDays(date, amount) {
765
+ const _date = toDate(date);
766
+ if (isNaN(amount)) return constructFrom(date, NaN);
767
+ if (!amount) {
768
+ return _date;
769
+ }
770
+ _date.setDate(_date.getDate() + amount);
771
+ return _date;
772
+ }
773
+ function addMonths(date, amount) {
774
+ const _date = toDate(date);
775
+ if (isNaN(amount)) return constructFrom(date, NaN);
776
+ if (!amount) {
777
+ return _date;
778
+ }
779
+ const dayOfMonth = _date.getDate();
780
+ const endOfDesiredMonth = constructFrom(date, _date.getTime());
781
+ endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
782
+ const daysInMonth = endOfDesiredMonth.getDate();
783
+ if (dayOfMonth >= daysInMonth) {
784
+ return endOfDesiredMonth;
785
+ } else {
786
+ _date.setFullYear(
787
+ endOfDesiredMonth.getFullYear(),
788
+ endOfDesiredMonth.getMonth(),
789
+ dayOfMonth
790
+ );
791
+ return _date;
792
+ }
793
+ }
794
+ const millisecondsInWeek = 6048e5;
795
+ const millisecondsInDay = 864e5;
796
+ const millisecondsInMinute = 6e4;
797
+ const millisecondsInHour = 36e5;
798
+ let defaultOptions = {};
799
+ function getDefaultOptions() {
800
+ return defaultOptions;
801
+ }
802
+ function startOfWeek(date, options) {
803
+ var _a, _b, _c, _d;
804
+ const defaultOptions2 = getDefaultOptions();
805
+ const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
806
+ const _date = toDate(date);
807
+ const day = _date.getDay();
808
+ const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
809
+ _date.setDate(_date.getDate() - diff);
810
+ _date.setHours(0, 0, 0, 0);
811
+ return _date;
812
+ }
813
+ function startOfISOWeek(date) {
814
+ return startOfWeek(date, { weekStartsOn: 1 });
815
+ }
816
+ function getISOWeekYear(date) {
817
+ const _date = toDate(date);
818
+ const year = _date.getFullYear();
819
+ const fourthOfJanuaryOfNextYear = constructFrom(date, 0);
820
+ fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
821
+ fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
822
+ const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
823
+ const fourthOfJanuaryOfThisYear = constructFrom(date, 0);
824
+ fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
825
+ fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
826
+ const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
827
+ if (_date.getTime() >= startOfNextYear.getTime()) {
828
+ return year + 1;
829
+ } else if (_date.getTime() >= startOfThisYear.getTime()) {
830
+ return year;
831
+ } else {
832
+ return year - 1;
833
+ }
834
+ }
835
+ function startOfDay(date) {
836
+ const _date = toDate(date);
837
+ _date.setHours(0, 0, 0, 0);
838
+ return _date;
839
+ }
840
+ function getTimezoneOffsetInMilliseconds(date) {
841
+ const _date = toDate(date);
842
+ const utcDate = new Date(
843
+ Date.UTC(
844
+ _date.getFullYear(),
845
+ _date.getMonth(),
846
+ _date.getDate(),
847
+ _date.getHours(),
848
+ _date.getMinutes(),
849
+ _date.getSeconds(),
850
+ _date.getMilliseconds()
851
+ )
852
+ );
853
+ utcDate.setUTCFullYear(_date.getFullYear());
854
+ return +date - +utcDate;
855
+ }
856
+ function differenceInCalendarDays(dateLeft, dateRight) {
857
+ const startOfDayLeft = startOfDay(dateLeft);
858
+ const startOfDayRight = startOfDay(dateRight);
859
+ const timestampLeft = +startOfDayLeft - getTimezoneOffsetInMilliseconds(startOfDayLeft);
860
+ const timestampRight = +startOfDayRight - getTimezoneOffsetInMilliseconds(startOfDayRight);
861
+ return Math.round((timestampLeft - timestampRight) / millisecondsInDay);
862
+ }
863
+ function startOfISOWeekYear(date) {
864
+ const year = getISOWeekYear(date);
865
+ const fourthOfJanuary = constructFrom(date, 0);
866
+ fourthOfJanuary.setFullYear(year, 0, 4);
867
+ fourthOfJanuary.setHours(0, 0, 0, 0);
868
+ return startOfISOWeek(fourthOfJanuary);
869
+ }
870
+ function isSameDay(dateLeft, dateRight) {
871
+ const dateLeftStartOfDay = startOfDay(dateLeft);
872
+ const dateRightStartOfDay = startOfDay(dateRight);
873
+ return +dateLeftStartOfDay === +dateRightStartOfDay;
874
+ }
875
+ function isDate(value) {
876
+ return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
877
+ }
878
+ function isValid(date) {
879
+ if (!isDate(date) && typeof date !== "number") {
880
+ return false;
881
+ }
882
+ const _date = toDate(date);
883
+ return !isNaN(Number(_date));
884
+ }
885
+ function startOfYear(date) {
886
+ const cleanDate = toDate(date);
887
+ const _date = constructFrom(date, 0);
888
+ _date.setFullYear(cleanDate.getFullYear(), 0, 1);
889
+ _date.setHours(0, 0, 0, 0);
890
+ return _date;
891
+ }
892
+ const formatDistanceLocale = {
893
+ lessThanXSeconds: {
894
+ one: "less than a second",
895
+ other: "less than {{count}} seconds"
896
+ },
897
+ xSeconds: {
898
+ one: "1 second",
899
+ other: "{{count}} seconds"
900
+ },
901
+ halfAMinute: "half a minute",
902
+ lessThanXMinutes: {
903
+ one: "less than a minute",
904
+ other: "less than {{count}} minutes"
905
+ },
906
+ xMinutes: {
907
+ one: "1 minute",
908
+ other: "{{count}} minutes"
909
+ },
910
+ aboutXHours: {
911
+ one: "about 1 hour",
912
+ other: "about {{count}} hours"
913
+ },
914
+ xHours: {
915
+ one: "1 hour",
916
+ other: "{{count}} hours"
917
+ },
918
+ xDays: {
919
+ one: "1 day",
920
+ other: "{{count}} days"
921
+ },
922
+ aboutXWeeks: {
923
+ one: "about 1 week",
924
+ other: "about {{count}} weeks"
925
+ },
926
+ xWeeks: {
927
+ one: "1 week",
928
+ other: "{{count}} weeks"
929
+ },
930
+ aboutXMonths: {
931
+ one: "about 1 month",
932
+ other: "about {{count}} months"
933
+ },
934
+ xMonths: {
935
+ one: "1 month",
936
+ other: "{{count}} months"
937
+ },
938
+ aboutXYears: {
939
+ one: "about 1 year",
940
+ other: "about {{count}} years"
941
+ },
942
+ xYears: {
943
+ one: "1 year",
944
+ other: "{{count}} years"
945
+ },
946
+ overXYears: {
947
+ one: "over 1 year",
948
+ other: "over {{count}} years"
949
+ },
950
+ almostXYears: {
951
+ one: "almost 1 year",
952
+ other: "almost {{count}} years"
953
+ }
954
+ };
955
+ const formatDistance = (token, count, options) => {
956
+ let result;
957
+ const tokenValue = formatDistanceLocale[token];
958
+ if (typeof tokenValue === "string") {
959
+ result = tokenValue;
960
+ } else if (count === 1) {
961
+ result = tokenValue.one;
962
+ } else {
963
+ result = tokenValue.other.replace("{{count}}", count.toString());
964
+ }
965
+ if (options == null ? void 0 : options.addSuffix) {
966
+ if (options.comparison && options.comparison > 0) {
967
+ return "in " + result;
968
+ } else {
969
+ return result + " ago";
970
+ }
971
+ }
972
+ return result;
973
+ };
974
+ function buildFormatLongFn(args) {
975
+ return (options = {}) => {
976
+ const width = options.width ? String(options.width) : args.defaultWidth;
977
+ const format2 = args.formats[width] || args.formats[args.defaultWidth];
978
+ return format2;
979
+ };
980
+ }
981
+ const dateFormats = {
982
+ full: "EEEE, MMMM do, y",
983
+ long: "MMMM do, y",
984
+ medium: "MMM d, y",
985
+ short: "MM/dd/yyyy"
986
+ };
987
+ const timeFormats = {
988
+ full: "h:mm:ss a zzzz",
989
+ long: "h:mm:ss a z",
990
+ medium: "h:mm:ss a",
991
+ short: "h:mm a"
992
+ };
993
+ const dateTimeFormats = {
994
+ full: "{{date}} 'at' {{time}}",
995
+ long: "{{date}} 'at' {{time}}",
996
+ medium: "{{date}}, {{time}}",
997
+ short: "{{date}}, {{time}}"
998
+ };
999
+ const formatLong = {
1000
+ date: buildFormatLongFn({
1001
+ formats: dateFormats,
1002
+ defaultWidth: "full"
1003
+ }),
1004
+ time: buildFormatLongFn({
1005
+ formats: timeFormats,
1006
+ defaultWidth: "full"
1007
+ }),
1008
+ dateTime: buildFormatLongFn({
1009
+ formats: dateTimeFormats,
1010
+ defaultWidth: "full"
1011
+ })
1012
+ };
1013
+ const formatRelativeLocale = {
1014
+ lastWeek: "'last' eeee 'at' p",
1015
+ yesterday: "'yesterday at' p",
1016
+ today: "'today at' p",
1017
+ tomorrow: "'tomorrow at' p",
1018
+ nextWeek: "eeee 'at' p",
1019
+ other: "P"
1020
+ };
1021
+ const formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
1022
+ function buildLocalizeFn(args) {
1023
+ return (value, options) => {
1024
+ const context = (options == null ? void 0 : options.context) ? String(options.context) : "standalone";
1025
+ let valuesArray;
1026
+ if (context === "formatting" && args.formattingValues) {
1027
+ const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
1028
+ const width = (options == null ? void 0 : options.width) ? String(options.width) : defaultWidth;
1029
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
1030
+ } else {
1031
+ const defaultWidth = args.defaultWidth;
1032
+ const width = (options == null ? void 0 : options.width) ? String(options.width) : args.defaultWidth;
1033
+ valuesArray = args.values[width] || args.values[defaultWidth];
1034
+ }
1035
+ const index = args.argumentCallback ? args.argumentCallback(value) : value;
1036
+ return valuesArray[index];
1037
+ };
1038
+ }
1039
+ const eraValues = {
1040
+ narrow: ["B", "A"],
1041
+ abbreviated: ["BC", "AD"],
1042
+ wide: ["Before Christ", "Anno Domini"]
1043
+ };
1044
+ const quarterValues = {
1045
+ narrow: ["1", "2", "3", "4"],
1046
+ abbreviated: ["Q1", "Q2", "Q3", "Q4"],
1047
+ wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
1048
+ };
1049
+ const monthValues = {
1050
+ narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
1051
+ abbreviated: [
1052
+ "Jan",
1053
+ "Feb",
1054
+ "Mar",
1055
+ "Apr",
1056
+ "May",
1057
+ "Jun",
1058
+ "Jul",
1059
+ "Aug",
1060
+ "Sep",
1061
+ "Oct",
1062
+ "Nov",
1063
+ "Dec"
1064
+ ],
1065
+ wide: [
1066
+ "January",
1067
+ "February",
1068
+ "March",
1069
+ "April",
1070
+ "May",
1071
+ "June",
1072
+ "July",
1073
+ "August",
1074
+ "September",
1075
+ "October",
1076
+ "November",
1077
+ "December"
1078
+ ]
1079
+ };
1080
+ const dayValues = {
1081
+ narrow: ["S", "M", "T", "W", "T", "F", "S"],
1082
+ short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
1083
+ abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
1084
+ wide: [
1085
+ "Sunday",
1086
+ "Monday",
1087
+ "Tuesday",
1088
+ "Wednesday",
1089
+ "Thursday",
1090
+ "Friday",
1091
+ "Saturday"
1092
+ ]
1093
+ };
1094
+ const dayPeriodValues = {
1095
+ narrow: {
1096
+ am: "a",
1097
+ pm: "p",
1098
+ midnight: "mi",
1099
+ noon: "n",
1100
+ morning: "morning",
1101
+ afternoon: "afternoon",
1102
+ evening: "evening",
1103
+ night: "night"
1104
+ },
1105
+ abbreviated: {
1106
+ am: "AM",
1107
+ pm: "PM",
1108
+ midnight: "midnight",
1109
+ noon: "noon",
1110
+ morning: "morning",
1111
+ afternoon: "afternoon",
1112
+ evening: "evening",
1113
+ night: "night"
1114
+ },
1115
+ wide: {
1116
+ am: "a.m.",
1117
+ pm: "p.m.",
1118
+ midnight: "midnight",
1119
+ noon: "noon",
1120
+ morning: "morning",
1121
+ afternoon: "afternoon",
1122
+ evening: "evening",
1123
+ night: "night"
1124
+ }
1125
+ };
1126
+ const formattingDayPeriodValues = {
1127
+ narrow: {
1128
+ am: "a",
1129
+ pm: "p",
1130
+ midnight: "mi",
1131
+ noon: "n",
1132
+ morning: "in the morning",
1133
+ afternoon: "in the afternoon",
1134
+ evening: "in the evening",
1135
+ night: "at night"
1136
+ },
1137
+ abbreviated: {
1138
+ am: "AM",
1139
+ pm: "PM",
1140
+ midnight: "midnight",
1141
+ noon: "noon",
1142
+ morning: "in the morning",
1143
+ afternoon: "in the afternoon",
1144
+ evening: "in the evening",
1145
+ night: "at night"
1146
+ },
1147
+ wide: {
1148
+ am: "a.m.",
1149
+ pm: "p.m.",
1150
+ midnight: "midnight",
1151
+ noon: "noon",
1152
+ morning: "in the morning",
1153
+ afternoon: "in the afternoon",
1154
+ evening: "in the evening",
1155
+ night: "at night"
1156
+ }
1157
+ };
1158
+ const ordinalNumber = (dirtyNumber, _options) => {
1159
+ const number = Number(dirtyNumber);
1160
+ const rem100 = number % 100;
1161
+ if (rem100 > 20 || rem100 < 10) {
1162
+ switch (rem100 % 10) {
1163
+ case 1:
1164
+ return number + "st";
1165
+ case 2:
1166
+ return number + "nd";
1167
+ case 3:
1168
+ return number + "rd";
1169
+ }
1170
+ }
1171
+ return number + "th";
1172
+ };
1173
+ const localize = {
1174
+ ordinalNumber,
1175
+ era: buildLocalizeFn({
1176
+ values: eraValues,
1177
+ defaultWidth: "wide"
1178
+ }),
1179
+ quarter: buildLocalizeFn({
1180
+ values: quarterValues,
1181
+ defaultWidth: "wide",
1182
+ argumentCallback: (quarter) => quarter - 1
1183
+ }),
1184
+ month: buildLocalizeFn({
1185
+ values: monthValues,
1186
+ defaultWidth: "wide"
1187
+ }),
1188
+ day: buildLocalizeFn({
1189
+ values: dayValues,
1190
+ defaultWidth: "wide"
1191
+ }),
1192
+ dayPeriod: buildLocalizeFn({
1193
+ values: dayPeriodValues,
1194
+ defaultWidth: "wide",
1195
+ formattingValues: formattingDayPeriodValues,
1196
+ defaultFormattingWidth: "wide"
1197
+ })
1198
+ };
1199
+ function buildMatchFn(args) {
1200
+ return (string, options = {}) => {
1201
+ const width = options.width;
1202
+ const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
1203
+ const matchResult = string.match(matchPattern);
1204
+ if (!matchResult) {
1205
+ return null;
1206
+ }
1207
+ const matchedString = matchResult[0];
1208
+ const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
1209
+ const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : (
1210
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
1211
+ findKey(parsePatterns, (pattern) => pattern.test(matchedString))
1212
+ );
1213
+ let value;
1214
+ value = args.valueCallback ? args.valueCallback(key) : key;
1215
+ value = options.valueCallback ? (
1216
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
1217
+ options.valueCallback(value)
1218
+ ) : value;
1219
+ const rest = string.slice(matchedString.length);
1220
+ return { value, rest };
1221
+ };
1222
+ }
1223
+ function findKey(object, predicate) {
1224
+ for (const key in object) {
1225
+ if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
1226
+ return key;
1227
+ }
1228
+ }
1229
+ return void 0;
1230
+ }
1231
+ function findIndex(array, predicate) {
1232
+ for (let key = 0; key < array.length; key++) {
1233
+ if (predicate(array[key])) {
1234
+ return key;
1235
+ }
1236
+ }
1237
+ return void 0;
1238
+ }
1239
+ function buildMatchPatternFn(args) {
1240
+ return (string, options = {}) => {
1241
+ const matchResult = string.match(args.matchPattern);
1242
+ if (!matchResult) return null;
1243
+ const matchedString = matchResult[0];
1244
+ const parseResult = string.match(args.parsePattern);
1245
+ if (!parseResult) return null;
1246
+ let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
1247
+ value = options.valueCallback ? options.valueCallback(value) : value;
1248
+ const rest = string.slice(matchedString.length);
1249
+ return { value, rest };
1250
+ };
1251
+ }
1252
+ const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
1253
+ const parseOrdinalNumberPattern = /\d+/i;
1254
+ const matchEraPatterns = {
1255
+ narrow: /^(b|a)/i,
1256
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
1257
+ wide: /^(before christ|before common era|anno domini|common era)/i
1258
+ };
1259
+ const parseEraPatterns = {
1260
+ any: [/^b/i, /^(a|c)/i]
1261
+ };
1262
+ const matchQuarterPatterns = {
1263
+ narrow: /^[1234]/i,
1264
+ abbreviated: /^q[1234]/i,
1265
+ wide: /^[1234](th|st|nd|rd)? quarter/i
1266
+ };
1267
+ const parseQuarterPatterns = {
1268
+ any: [/1/i, /2/i, /3/i, /4/i]
1269
+ };
1270
+ const matchMonthPatterns = {
1271
+ narrow: /^[jfmasond]/i,
1272
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
1273
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
1274
+ };
1275
+ const parseMonthPatterns = {
1276
+ narrow: [
1277
+ /^j/i,
1278
+ /^f/i,
1279
+ /^m/i,
1280
+ /^a/i,
1281
+ /^m/i,
1282
+ /^j/i,
1283
+ /^j/i,
1284
+ /^a/i,
1285
+ /^s/i,
1286
+ /^o/i,
1287
+ /^n/i,
1288
+ /^d/i
1289
+ ],
1290
+ any: [
1291
+ /^ja/i,
1292
+ /^f/i,
1293
+ /^mar/i,
1294
+ /^ap/i,
1295
+ /^may/i,
1296
+ /^jun/i,
1297
+ /^jul/i,
1298
+ /^au/i,
1299
+ /^s/i,
1300
+ /^o/i,
1301
+ /^n/i,
1302
+ /^d/i
1303
+ ]
1304
+ };
1305
+ const matchDayPatterns = {
1306
+ narrow: /^[smtwf]/i,
1307
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
1308
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
1309
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
1310
+ };
1311
+ const parseDayPatterns = {
1312
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
1313
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
1314
+ };
1315
+ const matchDayPeriodPatterns = {
1316
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
1317
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
1318
+ };
1319
+ const parseDayPeriodPatterns = {
1320
+ any: {
1321
+ am: /^a/i,
1322
+ pm: /^p/i,
1323
+ midnight: /^mi/i,
1324
+ noon: /^no/i,
1325
+ morning: /morning/i,
1326
+ afternoon: /afternoon/i,
1327
+ evening: /evening/i,
1328
+ night: /night/i
1329
+ }
1330
+ };
1331
+ const match = {
1332
+ ordinalNumber: buildMatchPatternFn({
1333
+ matchPattern: matchOrdinalNumberPattern,
1334
+ parsePattern: parseOrdinalNumberPattern,
1335
+ valueCallback: (value) => parseInt(value, 10)
1336
+ }),
1337
+ era: buildMatchFn({
1338
+ matchPatterns: matchEraPatterns,
1339
+ defaultMatchWidth: "wide",
1340
+ parsePatterns: parseEraPatterns,
1341
+ defaultParseWidth: "any"
1342
+ }),
1343
+ quarter: buildMatchFn({
1344
+ matchPatterns: matchQuarterPatterns,
1345
+ defaultMatchWidth: "wide",
1346
+ parsePatterns: parseQuarterPatterns,
1347
+ defaultParseWidth: "any",
1348
+ valueCallback: (index) => index + 1
1349
+ }),
1350
+ month: buildMatchFn({
1351
+ matchPatterns: matchMonthPatterns,
1352
+ defaultMatchWidth: "wide",
1353
+ parsePatterns: parseMonthPatterns,
1354
+ defaultParseWidth: "any"
1355
+ }),
1356
+ day: buildMatchFn({
1357
+ matchPatterns: matchDayPatterns,
1358
+ defaultMatchWidth: "wide",
1359
+ parsePatterns: parseDayPatterns,
1360
+ defaultParseWidth: "any"
1361
+ }),
1362
+ dayPeriod: buildMatchFn({
1363
+ matchPatterns: matchDayPeriodPatterns,
1364
+ defaultMatchWidth: "any",
1365
+ parsePatterns: parseDayPeriodPatterns,
1366
+ defaultParseWidth: "any"
1367
+ })
1368
+ };
1369
+ const enUS = {
1370
+ code: "en-US",
1371
+ formatDistance,
1372
+ formatLong,
1373
+ formatRelative,
1374
+ localize,
1375
+ match,
1376
+ options: {
1377
+ weekStartsOn: 0,
1378
+ firstWeekContainsDate: 1
1379
+ }
1380
+ };
1381
+ function getDayOfYear(date) {
1382
+ const _date = toDate(date);
1383
+ const diff = differenceInCalendarDays(_date, startOfYear(_date));
1384
+ const dayOfYear = diff + 1;
1385
+ return dayOfYear;
1386
+ }
1387
+ function getISOWeek(date) {
1388
+ const _date = toDate(date);
1389
+ const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
1390
+ return Math.round(diff / millisecondsInWeek) + 1;
1391
+ }
1392
+ function getWeekYear(date, options) {
1393
+ var _a, _b, _c, _d;
1394
+ const _date = toDate(date);
1395
+ const year = _date.getFullYear();
1396
+ const defaultOptions2 = getDefaultOptions();
1397
+ const firstWeekContainsDate = (options == null ? void 0 : options.firstWeekContainsDate) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? defaultOptions2.firstWeekContainsDate ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.firstWeekContainsDate) ?? 1;
1398
+ const firstWeekOfNextYear = constructFrom(date, 0);
1399
+ firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
1400
+ firstWeekOfNextYear.setHours(0, 0, 0, 0);
1401
+ const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
1402
+ const firstWeekOfThisYear = constructFrom(date, 0);
1403
+ firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
1404
+ firstWeekOfThisYear.setHours(0, 0, 0, 0);
1405
+ const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
1406
+ if (_date.getTime() >= startOfNextYear.getTime()) {
1407
+ return year + 1;
1408
+ } else if (_date.getTime() >= startOfThisYear.getTime()) {
1409
+ return year;
1410
+ } else {
1411
+ return year - 1;
1412
+ }
1413
+ }
1414
+ function startOfWeekYear(date, options) {
1415
+ var _a, _b, _c, _d;
1416
+ const defaultOptions2 = getDefaultOptions();
1417
+ const firstWeekContainsDate = (options == null ? void 0 : options.firstWeekContainsDate) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? defaultOptions2.firstWeekContainsDate ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.firstWeekContainsDate) ?? 1;
1418
+ const year = getWeekYear(date, options);
1419
+ const firstWeek = constructFrom(date, 0);
1420
+ firstWeek.setFullYear(year, 0, firstWeekContainsDate);
1421
+ firstWeek.setHours(0, 0, 0, 0);
1422
+ const _date = startOfWeek(firstWeek, options);
1423
+ return _date;
1424
+ }
1425
+ function getWeek(date, options) {
1426
+ const _date = toDate(date);
1427
+ const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
1428
+ return Math.round(diff / millisecondsInWeek) + 1;
1429
+ }
1430
+ function addLeadingZeros(number, targetLength) {
1431
+ const sign = number < 0 ? "-" : "";
1432
+ const output = Math.abs(number).toString().padStart(targetLength, "0");
1433
+ return sign + output;
1434
+ }
1435
+ const lightFormatters = {
1436
+ // Year
1437
+ y(date, token) {
1438
+ const signedYear = date.getFullYear();
1439
+ const year = signedYear > 0 ? signedYear : 1 - signedYear;
1440
+ return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
1441
+ },
1442
+ // Month
1443
+ M(date, token) {
1444
+ const month = date.getMonth();
1445
+ return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
1446
+ },
1447
+ // Day of the month
1448
+ d(date, token) {
1449
+ return addLeadingZeros(date.getDate(), token.length);
1450
+ },
1451
+ // AM or PM
1452
+ a(date, token) {
1453
+ const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
1454
+ switch (token) {
1455
+ case "a":
1456
+ case "aa":
1457
+ return dayPeriodEnumValue.toUpperCase();
1458
+ case "aaa":
1459
+ return dayPeriodEnumValue;
1460
+ case "aaaaa":
1461
+ return dayPeriodEnumValue[0];
1462
+ case "aaaa":
1463
+ default:
1464
+ return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
1465
+ }
1466
+ },
1467
+ // Hour [1-12]
1468
+ h(date, token) {
1469
+ return addLeadingZeros(date.getHours() % 12 || 12, token.length);
1470
+ },
1471
+ // Hour [0-23]
1472
+ H(date, token) {
1473
+ return addLeadingZeros(date.getHours(), token.length);
1474
+ },
1475
+ // Minute
1476
+ m(date, token) {
1477
+ return addLeadingZeros(date.getMinutes(), token.length);
1478
+ },
1479
+ // Second
1480
+ s(date, token) {
1481
+ return addLeadingZeros(date.getSeconds(), token.length);
1482
+ },
1483
+ // Fraction of second
1484
+ S(date, token) {
1485
+ const numberOfDigits = token.length;
1486
+ const milliseconds = date.getMilliseconds();
1487
+ const fractionalSeconds = Math.trunc(
1488
+ milliseconds * Math.pow(10, numberOfDigits - 3)
1489
+ );
1490
+ return addLeadingZeros(fractionalSeconds, token.length);
1491
+ }
1492
+ };
1493
+ const dayPeriodEnum = {
1494
+ midnight: "midnight",
1495
+ noon: "noon",
1496
+ morning: "morning",
1497
+ afternoon: "afternoon",
1498
+ evening: "evening",
1499
+ night: "night"
1500
+ };
1501
+ const formatters = {
1502
+ // Era
1503
+ G: function(date, token, localize2) {
1504
+ const era = date.getFullYear() > 0 ? 1 : 0;
1505
+ switch (token) {
1506
+ // AD, BC
1507
+ case "G":
1508
+ case "GG":
1509
+ case "GGG":
1510
+ return localize2.era(era, { width: "abbreviated" });
1511
+ // A, B
1512
+ case "GGGGG":
1513
+ return localize2.era(era, { width: "narrow" });
1514
+ // Anno Domini, Before Christ
1515
+ case "GGGG":
1516
+ default:
1517
+ return localize2.era(era, { width: "wide" });
1518
+ }
1519
+ },
1520
+ // Year
1521
+ y: function(date, token, localize2) {
1522
+ if (token === "yo") {
1523
+ const signedYear = date.getFullYear();
1524
+ const year = signedYear > 0 ? signedYear : 1 - signedYear;
1525
+ return localize2.ordinalNumber(year, { unit: "year" });
1526
+ }
1527
+ return lightFormatters.y(date, token);
1528
+ },
1529
+ // Local week-numbering year
1530
+ Y: function(date, token, localize2, options) {
1531
+ const signedWeekYear = getWeekYear(date, options);
1532
+ const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
1533
+ if (token === "YY") {
1534
+ const twoDigitYear = weekYear % 100;
1535
+ return addLeadingZeros(twoDigitYear, 2);
1536
+ }
1537
+ if (token === "Yo") {
1538
+ return localize2.ordinalNumber(weekYear, { unit: "year" });
1539
+ }
1540
+ return addLeadingZeros(weekYear, token.length);
1541
+ },
1542
+ // ISO week-numbering year
1543
+ R: function(date, token) {
1544
+ const isoWeekYear = getISOWeekYear(date);
1545
+ return addLeadingZeros(isoWeekYear, token.length);
1546
+ },
1547
+ // Extended year. This is a single number designating the year of this calendar system.
1548
+ // The main difference between `y` and `u` localizers are B.C. years:
1549
+ // | Year | `y` | `u` |
1550
+ // |------|-----|-----|
1551
+ // | AC 1 | 1 | 1 |
1552
+ // | BC 1 | 1 | 0 |
1553
+ // | BC 2 | 2 | -1 |
1554
+ // Also `yy` always returns the last two digits of a year,
1555
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
1556
+ u: function(date, token) {
1557
+ const year = date.getFullYear();
1558
+ return addLeadingZeros(year, token.length);
1559
+ },
1560
+ // Quarter
1561
+ Q: function(date, token, localize2) {
1562
+ const quarter = Math.ceil((date.getMonth() + 1) / 3);
1563
+ switch (token) {
1564
+ // 1, 2, 3, 4
1565
+ case "Q":
1566
+ return String(quarter);
1567
+ // 01, 02, 03, 04
1568
+ case "QQ":
1569
+ return addLeadingZeros(quarter, 2);
1570
+ // 1st, 2nd, 3rd, 4th
1571
+ case "Qo":
1572
+ return localize2.ordinalNumber(quarter, { unit: "quarter" });
1573
+ // Q1, Q2, Q3, Q4
1574
+ case "QQQ":
1575
+ return localize2.quarter(quarter, {
1576
+ width: "abbreviated",
1577
+ context: "formatting"
1578
+ });
1579
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1580
+ case "QQQQQ":
1581
+ return localize2.quarter(quarter, {
1582
+ width: "narrow",
1583
+ context: "formatting"
1584
+ });
1585
+ // 1st quarter, 2nd quarter, ...
1586
+ case "QQQQ":
1587
+ default:
1588
+ return localize2.quarter(quarter, {
1589
+ width: "wide",
1590
+ context: "formatting"
1591
+ });
1592
+ }
1593
+ },
1594
+ // Stand-alone quarter
1595
+ q: function(date, token, localize2) {
1596
+ const quarter = Math.ceil((date.getMonth() + 1) / 3);
1597
+ switch (token) {
1598
+ // 1, 2, 3, 4
1599
+ case "q":
1600
+ return String(quarter);
1601
+ // 01, 02, 03, 04
1602
+ case "qq":
1603
+ return addLeadingZeros(quarter, 2);
1604
+ // 1st, 2nd, 3rd, 4th
1605
+ case "qo":
1606
+ return localize2.ordinalNumber(quarter, { unit: "quarter" });
1607
+ // Q1, Q2, Q3, Q4
1608
+ case "qqq":
1609
+ return localize2.quarter(quarter, {
1610
+ width: "abbreviated",
1611
+ context: "standalone"
1612
+ });
1613
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1614
+ case "qqqqq":
1615
+ return localize2.quarter(quarter, {
1616
+ width: "narrow",
1617
+ context: "standalone"
1618
+ });
1619
+ // 1st quarter, 2nd quarter, ...
1620
+ case "qqqq":
1621
+ default:
1622
+ return localize2.quarter(quarter, {
1623
+ width: "wide",
1624
+ context: "standalone"
1625
+ });
1626
+ }
1627
+ },
1628
+ // Month
1629
+ M: function(date, token, localize2) {
1630
+ const month = date.getMonth();
1631
+ switch (token) {
1632
+ case "M":
1633
+ case "MM":
1634
+ return lightFormatters.M(date, token);
1635
+ // 1st, 2nd, ..., 12th
1636
+ case "Mo":
1637
+ return localize2.ordinalNumber(month + 1, { unit: "month" });
1638
+ // Jan, Feb, ..., Dec
1639
+ case "MMM":
1640
+ return localize2.month(month, {
1641
+ width: "abbreviated",
1642
+ context: "formatting"
1643
+ });
1644
+ // J, F, ..., D
1645
+ case "MMMMM":
1646
+ return localize2.month(month, {
1647
+ width: "narrow",
1648
+ context: "formatting"
1649
+ });
1650
+ // January, February, ..., December
1651
+ case "MMMM":
1652
+ default:
1653
+ return localize2.month(month, { width: "wide", context: "formatting" });
1654
+ }
1655
+ },
1656
+ // Stand-alone month
1657
+ L: function(date, token, localize2) {
1658
+ const month = date.getMonth();
1659
+ switch (token) {
1660
+ // 1, 2, ..., 12
1661
+ case "L":
1662
+ return String(month + 1);
1663
+ // 01, 02, ..., 12
1664
+ case "LL":
1665
+ return addLeadingZeros(month + 1, 2);
1666
+ // 1st, 2nd, ..., 12th
1667
+ case "Lo":
1668
+ return localize2.ordinalNumber(month + 1, { unit: "month" });
1669
+ // Jan, Feb, ..., Dec
1670
+ case "LLL":
1671
+ return localize2.month(month, {
1672
+ width: "abbreviated",
1673
+ context: "standalone"
1674
+ });
1675
+ // J, F, ..., D
1676
+ case "LLLLL":
1677
+ return localize2.month(month, {
1678
+ width: "narrow",
1679
+ context: "standalone"
1680
+ });
1681
+ // January, February, ..., December
1682
+ case "LLLL":
1683
+ default:
1684
+ return localize2.month(month, { width: "wide", context: "standalone" });
1685
+ }
1686
+ },
1687
+ // Local week of year
1688
+ w: function(date, token, localize2, options) {
1689
+ const week = getWeek(date, options);
1690
+ if (token === "wo") {
1691
+ return localize2.ordinalNumber(week, { unit: "week" });
1692
+ }
1693
+ return addLeadingZeros(week, token.length);
1694
+ },
1695
+ // ISO week of year
1696
+ I: function(date, token, localize2) {
1697
+ const isoWeek = getISOWeek(date);
1698
+ if (token === "Io") {
1699
+ return localize2.ordinalNumber(isoWeek, { unit: "week" });
1700
+ }
1701
+ return addLeadingZeros(isoWeek, token.length);
1702
+ },
1703
+ // Day of the month
1704
+ d: function(date, token, localize2) {
1705
+ if (token === "do") {
1706
+ return localize2.ordinalNumber(date.getDate(), { unit: "date" });
1707
+ }
1708
+ return lightFormatters.d(date, token);
1709
+ },
1710
+ // Day of year
1711
+ D: function(date, token, localize2) {
1712
+ const dayOfYear = getDayOfYear(date);
1713
+ if (token === "Do") {
1714
+ return localize2.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
1715
+ }
1716
+ return addLeadingZeros(dayOfYear, token.length);
1717
+ },
1718
+ // Day of week
1719
+ E: function(date, token, localize2) {
1720
+ const dayOfWeek = date.getDay();
1721
+ switch (token) {
1722
+ // Tue
1723
+ case "E":
1724
+ case "EE":
1725
+ case "EEE":
1726
+ return localize2.day(dayOfWeek, {
1727
+ width: "abbreviated",
1728
+ context: "formatting"
1729
+ });
1730
+ // T
1731
+ case "EEEEE":
1732
+ return localize2.day(dayOfWeek, {
1733
+ width: "narrow",
1734
+ context: "formatting"
1735
+ });
1736
+ // Tu
1737
+ case "EEEEEE":
1738
+ return localize2.day(dayOfWeek, {
1739
+ width: "short",
1740
+ context: "formatting"
1741
+ });
1742
+ // Tuesday
1743
+ case "EEEE":
1744
+ default:
1745
+ return localize2.day(dayOfWeek, {
1746
+ width: "wide",
1747
+ context: "formatting"
1748
+ });
1749
+ }
1750
+ },
1751
+ // Local day of week
1752
+ e: function(date, token, localize2, options) {
1753
+ const dayOfWeek = date.getDay();
1754
+ const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
1755
+ switch (token) {
1756
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
1757
+ case "e":
1758
+ return String(localDayOfWeek);
1759
+ // Padded numerical value
1760
+ case "ee":
1761
+ return addLeadingZeros(localDayOfWeek, 2);
1762
+ // 1st, 2nd, ..., 7th
1763
+ case "eo":
1764
+ return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
1765
+ case "eee":
1766
+ return localize2.day(dayOfWeek, {
1767
+ width: "abbreviated",
1768
+ context: "formatting"
1769
+ });
1770
+ // T
1771
+ case "eeeee":
1772
+ return localize2.day(dayOfWeek, {
1773
+ width: "narrow",
1774
+ context: "formatting"
1775
+ });
1776
+ // Tu
1777
+ case "eeeeee":
1778
+ return localize2.day(dayOfWeek, {
1779
+ width: "short",
1780
+ context: "formatting"
1781
+ });
1782
+ // Tuesday
1783
+ case "eeee":
1784
+ default:
1785
+ return localize2.day(dayOfWeek, {
1786
+ width: "wide",
1787
+ context: "formatting"
1788
+ });
1789
+ }
1790
+ },
1791
+ // Stand-alone local day of week
1792
+ c: function(date, token, localize2, options) {
1793
+ const dayOfWeek = date.getDay();
1794
+ const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
1795
+ switch (token) {
1796
+ // Numerical value (same as in `e`)
1797
+ case "c":
1798
+ return String(localDayOfWeek);
1799
+ // Padded numerical value
1800
+ case "cc":
1801
+ return addLeadingZeros(localDayOfWeek, token.length);
1802
+ // 1st, 2nd, ..., 7th
1803
+ case "co":
1804
+ return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
1805
+ case "ccc":
1806
+ return localize2.day(dayOfWeek, {
1807
+ width: "abbreviated",
1808
+ context: "standalone"
1809
+ });
1810
+ // T
1811
+ case "ccccc":
1812
+ return localize2.day(dayOfWeek, {
1813
+ width: "narrow",
1814
+ context: "standalone"
1815
+ });
1816
+ // Tu
1817
+ case "cccccc":
1818
+ return localize2.day(dayOfWeek, {
1819
+ width: "short",
1820
+ context: "standalone"
1821
+ });
1822
+ // Tuesday
1823
+ case "cccc":
1824
+ default:
1825
+ return localize2.day(dayOfWeek, {
1826
+ width: "wide",
1827
+ context: "standalone"
1828
+ });
1829
+ }
1830
+ },
1831
+ // ISO day of week
1832
+ i: function(date, token, localize2) {
1833
+ const dayOfWeek = date.getDay();
1834
+ const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
1835
+ switch (token) {
1836
+ // 2
1837
+ case "i":
1838
+ return String(isoDayOfWeek);
1839
+ // 02
1840
+ case "ii":
1841
+ return addLeadingZeros(isoDayOfWeek, token.length);
1842
+ // 2nd
1843
+ case "io":
1844
+ return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" });
1845
+ // Tue
1846
+ case "iii":
1847
+ return localize2.day(dayOfWeek, {
1848
+ width: "abbreviated",
1849
+ context: "formatting"
1850
+ });
1851
+ // T
1852
+ case "iiiii":
1853
+ return localize2.day(dayOfWeek, {
1854
+ width: "narrow",
1855
+ context: "formatting"
1856
+ });
1857
+ // Tu
1858
+ case "iiiiii":
1859
+ return localize2.day(dayOfWeek, {
1860
+ width: "short",
1861
+ context: "formatting"
1862
+ });
1863
+ // Tuesday
1864
+ case "iiii":
1865
+ default:
1866
+ return localize2.day(dayOfWeek, {
1867
+ width: "wide",
1868
+ context: "formatting"
1869
+ });
1870
+ }
1871
+ },
1872
+ // AM or PM
1873
+ a: function(date, token, localize2) {
1874
+ const hours = date.getHours();
1875
+ const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
1876
+ switch (token) {
1877
+ case "a":
1878
+ case "aa":
1879
+ return localize2.dayPeriod(dayPeriodEnumValue, {
1880
+ width: "abbreviated",
1881
+ context: "formatting"
1882
+ });
1883
+ case "aaa":
1884
+ return localize2.dayPeriod(dayPeriodEnumValue, {
1885
+ width: "abbreviated",
1886
+ context: "formatting"
1887
+ }).toLowerCase();
1888
+ case "aaaaa":
1889
+ return localize2.dayPeriod(dayPeriodEnumValue, {
1890
+ width: "narrow",
1891
+ context: "formatting"
1892
+ });
1893
+ case "aaaa":
1894
+ default:
1895
+ return localize2.dayPeriod(dayPeriodEnumValue, {
1896
+ width: "wide",
1897
+ context: "formatting"
1898
+ });
1899
+ }
1900
+ },
1901
+ // AM, PM, midnight, noon
1902
+ b: function(date, token, localize2) {
1903
+ const hours = date.getHours();
1904
+ let dayPeriodEnumValue;
1905
+ if (hours === 12) {
1906
+ dayPeriodEnumValue = dayPeriodEnum.noon;
1907
+ } else if (hours === 0) {
1908
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
1909
+ } else {
1910
+ dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
1911
+ }
1912
+ switch (token) {
1913
+ case "b":
1914
+ case "bb":
1915
+ return localize2.dayPeriod(dayPeriodEnumValue, {
1916
+ width: "abbreviated",
1917
+ context: "formatting"
1918
+ });
1919
+ case "bbb":
1920
+ return localize2.dayPeriod(dayPeriodEnumValue, {
1921
+ width: "abbreviated",
1922
+ context: "formatting"
1923
+ }).toLowerCase();
1924
+ case "bbbbb":
1925
+ return localize2.dayPeriod(dayPeriodEnumValue, {
1926
+ width: "narrow",
1927
+ context: "formatting"
1928
+ });
1929
+ case "bbbb":
1930
+ default:
1931
+ return localize2.dayPeriod(dayPeriodEnumValue, {
1932
+ width: "wide",
1933
+ context: "formatting"
1934
+ });
1935
+ }
1936
+ },
1937
+ // in the morning, in the afternoon, in the evening, at night
1938
+ B: function(date, token, localize2) {
1939
+ const hours = date.getHours();
1940
+ let dayPeriodEnumValue;
1941
+ if (hours >= 17) {
1942
+ dayPeriodEnumValue = dayPeriodEnum.evening;
1943
+ } else if (hours >= 12) {
1944
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
1945
+ } else if (hours >= 4) {
1946
+ dayPeriodEnumValue = dayPeriodEnum.morning;
1947
+ } else {
1948
+ dayPeriodEnumValue = dayPeriodEnum.night;
1949
+ }
1950
+ switch (token) {
1951
+ case "B":
1952
+ case "BB":
1953
+ case "BBB":
1954
+ return localize2.dayPeriod(dayPeriodEnumValue, {
1955
+ width: "abbreviated",
1956
+ context: "formatting"
1957
+ });
1958
+ case "BBBBB":
1959
+ return localize2.dayPeriod(dayPeriodEnumValue, {
1960
+ width: "narrow",
1961
+ context: "formatting"
1962
+ });
1963
+ case "BBBB":
1964
+ default:
1965
+ return localize2.dayPeriod(dayPeriodEnumValue, {
1966
+ width: "wide",
1967
+ context: "formatting"
1968
+ });
1969
+ }
1970
+ },
1971
+ // Hour [1-12]
1972
+ h: function(date, token, localize2) {
1973
+ if (token === "ho") {
1974
+ let hours = date.getHours() % 12;
1975
+ if (hours === 0) hours = 12;
1976
+ return localize2.ordinalNumber(hours, { unit: "hour" });
1977
+ }
1978
+ return lightFormatters.h(date, token);
1979
+ },
1980
+ // Hour [0-23]
1981
+ H: function(date, token, localize2) {
1982
+ if (token === "Ho") {
1983
+ return localize2.ordinalNumber(date.getHours(), { unit: "hour" });
1984
+ }
1985
+ return lightFormatters.H(date, token);
1986
+ },
1987
+ // Hour [0-11]
1988
+ K: function(date, token, localize2) {
1989
+ const hours = date.getHours() % 12;
1990
+ if (token === "Ko") {
1991
+ return localize2.ordinalNumber(hours, { unit: "hour" });
1992
+ }
1993
+ return addLeadingZeros(hours, token.length);
1994
+ },
1995
+ // Hour [1-24]
1996
+ k: function(date, token, localize2) {
1997
+ let hours = date.getHours();
1998
+ if (hours === 0) hours = 24;
1999
+ if (token === "ko") {
2000
+ return localize2.ordinalNumber(hours, { unit: "hour" });
2001
+ }
2002
+ return addLeadingZeros(hours, token.length);
2003
+ },
2004
+ // Minute
2005
+ m: function(date, token, localize2) {
2006
+ if (token === "mo") {
2007
+ return localize2.ordinalNumber(date.getMinutes(), { unit: "minute" });
2008
+ }
2009
+ return lightFormatters.m(date, token);
2010
+ },
2011
+ // Second
2012
+ s: function(date, token, localize2) {
2013
+ if (token === "so") {
2014
+ return localize2.ordinalNumber(date.getSeconds(), { unit: "second" });
2015
+ }
2016
+ return lightFormatters.s(date, token);
2017
+ },
2018
+ // Fraction of second
2019
+ S: function(date, token) {
2020
+ return lightFormatters.S(date, token);
2021
+ },
2022
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
2023
+ X: function(date, token, _localize) {
2024
+ const timezoneOffset = date.getTimezoneOffset();
2025
+ if (timezoneOffset === 0) {
2026
+ return "Z";
2027
+ }
2028
+ switch (token) {
2029
+ // Hours and optional minutes
2030
+ case "X":
2031
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
2032
+ // Hours, minutes and optional seconds without `:` delimiter
2033
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2034
+ // so this token always has the same output as `XX`
2035
+ case "XXXX":
2036
+ case "XX":
2037
+ return formatTimezone(timezoneOffset);
2038
+ // Hours, minutes and optional seconds with `:` delimiter
2039
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2040
+ // so this token always has the same output as `XXX`
2041
+ case "XXXXX":
2042
+ case "XXX":
2043
+ // Hours and minutes with `:` delimiter
2044
+ default:
2045
+ return formatTimezone(timezoneOffset, ":");
2046
+ }
2047
+ },
2048
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
2049
+ x: function(date, token, _localize) {
2050
+ const timezoneOffset = date.getTimezoneOffset();
2051
+ switch (token) {
2052
+ // Hours and optional minutes
2053
+ case "x":
2054
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
2055
+ // Hours, minutes and optional seconds without `:` delimiter
2056
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2057
+ // so this token always has the same output as `xx`
2058
+ case "xxxx":
2059
+ case "xx":
2060
+ return formatTimezone(timezoneOffset);
2061
+ // Hours, minutes and optional seconds with `:` delimiter
2062
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2063
+ // so this token always has the same output as `xxx`
2064
+ case "xxxxx":
2065
+ case "xxx":
2066
+ // Hours and minutes with `:` delimiter
2067
+ default:
2068
+ return formatTimezone(timezoneOffset, ":");
2069
+ }
2070
+ },
2071
+ // Timezone (GMT)
2072
+ O: function(date, token, _localize) {
2073
+ const timezoneOffset = date.getTimezoneOffset();
2074
+ switch (token) {
2075
+ // Short
2076
+ case "O":
2077
+ case "OO":
2078
+ case "OOO":
2079
+ return "GMT" + formatTimezoneShort(timezoneOffset, ":");
2080
+ // Long
2081
+ case "OOOO":
2082
+ default:
2083
+ return "GMT" + formatTimezone(timezoneOffset, ":");
2084
+ }
2085
+ },
2086
+ // Timezone (specific non-location)
2087
+ z: function(date, token, _localize) {
2088
+ const timezoneOffset = date.getTimezoneOffset();
2089
+ switch (token) {
2090
+ // Short
2091
+ case "z":
2092
+ case "zz":
2093
+ case "zzz":
2094
+ return "GMT" + formatTimezoneShort(timezoneOffset, ":");
2095
+ // Long
2096
+ case "zzzz":
2097
+ default:
2098
+ return "GMT" + formatTimezone(timezoneOffset, ":");
2099
+ }
2100
+ },
2101
+ // Seconds timestamp
2102
+ t: function(date, token, _localize) {
2103
+ const timestamp = Math.trunc(date.getTime() / 1e3);
2104
+ return addLeadingZeros(timestamp, token.length);
2105
+ },
2106
+ // Milliseconds timestamp
2107
+ T: function(date, token, _localize) {
2108
+ const timestamp = date.getTime();
2109
+ return addLeadingZeros(timestamp, token.length);
2110
+ }
2111
+ };
2112
+ function formatTimezoneShort(offset, delimiter = "") {
2113
+ const sign = offset > 0 ? "-" : "+";
2114
+ const absOffset = Math.abs(offset);
2115
+ const hours = Math.trunc(absOffset / 60);
2116
+ const minutes = absOffset % 60;
2117
+ if (minutes === 0) {
2118
+ return sign + String(hours);
2119
+ }
2120
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
2121
+ }
2122
+ function formatTimezoneWithOptionalMinutes(offset, delimiter) {
2123
+ if (offset % 60 === 0) {
2124
+ const sign = offset > 0 ? "-" : "+";
2125
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
2126
+ }
2127
+ return formatTimezone(offset, delimiter);
2128
+ }
2129
+ function formatTimezone(offset, delimiter = "") {
2130
+ const sign = offset > 0 ? "-" : "+";
2131
+ const absOffset = Math.abs(offset);
2132
+ const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
2133
+ const minutes = addLeadingZeros(absOffset % 60, 2);
2134
+ return sign + hours + delimiter + minutes;
2135
+ }
2136
+ const dateLongFormatter = (pattern, formatLong2) => {
2137
+ switch (pattern) {
2138
+ case "P":
2139
+ return formatLong2.date({ width: "short" });
2140
+ case "PP":
2141
+ return formatLong2.date({ width: "medium" });
2142
+ case "PPP":
2143
+ return formatLong2.date({ width: "long" });
2144
+ case "PPPP":
2145
+ default:
2146
+ return formatLong2.date({ width: "full" });
2147
+ }
2148
+ };
2149
+ const timeLongFormatter = (pattern, formatLong2) => {
2150
+ switch (pattern) {
2151
+ case "p":
2152
+ return formatLong2.time({ width: "short" });
2153
+ case "pp":
2154
+ return formatLong2.time({ width: "medium" });
2155
+ case "ppp":
2156
+ return formatLong2.time({ width: "long" });
2157
+ case "pppp":
2158
+ default:
2159
+ return formatLong2.time({ width: "full" });
2160
+ }
2161
+ };
2162
+ const dateTimeLongFormatter = (pattern, formatLong2) => {
2163
+ const matchResult = pattern.match(/(P+)(p+)?/) || [];
2164
+ const datePattern = matchResult[1];
2165
+ const timePattern = matchResult[2];
2166
+ if (!timePattern) {
2167
+ return dateLongFormatter(pattern, formatLong2);
2168
+ }
2169
+ let dateTimeFormat;
2170
+ switch (datePattern) {
2171
+ case "P":
2172
+ dateTimeFormat = formatLong2.dateTime({ width: "short" });
2173
+ break;
2174
+ case "PP":
2175
+ dateTimeFormat = formatLong2.dateTime({ width: "medium" });
2176
+ break;
2177
+ case "PPP":
2178
+ dateTimeFormat = formatLong2.dateTime({ width: "long" });
2179
+ break;
2180
+ case "PPPP":
2181
+ default:
2182
+ dateTimeFormat = formatLong2.dateTime({ width: "full" });
2183
+ break;
2184
+ }
2185
+ return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
2186
+ };
2187
+ const longFormatters = {
2188
+ p: timeLongFormatter,
2189
+ P: dateTimeLongFormatter
2190
+ };
2191
+ const dayOfYearTokenRE = /^D+$/;
2192
+ const weekYearTokenRE = /^Y+$/;
2193
+ const throwTokens = ["D", "DD", "YY", "YYYY"];
2194
+ function isProtectedDayOfYearToken(token) {
2195
+ return dayOfYearTokenRE.test(token);
2196
+ }
2197
+ function isProtectedWeekYearToken(token) {
2198
+ return weekYearTokenRE.test(token);
2199
+ }
2200
+ function warnOrThrowProtectedError(token, format2, input) {
2201
+ const _message = message(token, format2, input);
2202
+ console.warn(_message);
2203
+ if (throwTokens.includes(token)) throw new RangeError(_message);
2204
+ }
2205
+ function message(token, format2, input) {
2206
+ const subject = token[0] === "Y" ? "years" : "days of the month";
2207
+ return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format2}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
2208
+ }
2209
+ const formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
2210
+ const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
2211
+ const escapedStringRegExp = /^'([^]*?)'?$/;
2212
+ const doubleQuoteRegExp = /''/g;
2213
+ const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
2214
+ function format(date, formatStr, options) {
2215
+ var _a, _b, _c, _d;
2216
+ const defaultOptions2 = getDefaultOptions();
2217
+ const locale = defaultOptions2.locale ?? enUS;
2218
+ const firstWeekContainsDate = defaultOptions2.firstWeekContainsDate ?? ((_b = (_a = defaultOptions2.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? 1;
2219
+ const weekStartsOn = defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
2220
+ const originalDate = toDate(date);
2221
+ if (!isValid(originalDate)) {
2222
+ throw new RangeError("Invalid time value");
2223
+ }
2224
+ let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
2225
+ const firstCharacter = substring[0];
2226
+ if (firstCharacter === "p" || firstCharacter === "P") {
2227
+ const longFormatter = longFormatters[firstCharacter];
2228
+ return longFormatter(substring, locale.formatLong);
2229
+ }
2230
+ return substring;
2231
+ }).join("").match(formattingTokensRegExp).map((substring) => {
2232
+ if (substring === "''") {
2233
+ return { isToken: false, value: "'" };
2234
+ }
2235
+ const firstCharacter = substring[0];
2236
+ if (firstCharacter === "'") {
2237
+ return { isToken: false, value: cleanEscapedString(substring) };
2238
+ }
2239
+ if (formatters[firstCharacter]) {
2240
+ return { isToken: true, value: substring };
2241
+ }
2242
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2243
+ throw new RangeError(
2244
+ "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
2245
+ );
2246
+ }
2247
+ return { isToken: false, value: substring };
2248
+ });
2249
+ if (locale.localize.preprocessor) {
2250
+ parts = locale.localize.preprocessor(originalDate, parts);
2251
+ }
2252
+ const formatterOptions = {
2253
+ firstWeekContainsDate,
2254
+ weekStartsOn,
2255
+ locale
2256
+ };
2257
+ return parts.map((part) => {
2258
+ if (!part.isToken) return part.value;
2259
+ const token = part.value;
2260
+ if (isProtectedWeekYearToken(token) || isProtectedDayOfYearToken(token)) {
2261
+ warnOrThrowProtectedError(token, formatStr, String(date));
2262
+ }
2263
+ const formatter = formatters[token[0]];
2264
+ return formatter(originalDate, token, locale.localize, formatterOptions);
2265
+ }).join("");
2266
+ }
2267
+ function cleanEscapedString(input) {
2268
+ const matched = input.match(escapedStringRegExp);
2269
+ if (!matched) {
2270
+ return input;
2271
+ }
2272
+ return matched[1].replace(doubleQuoteRegExp, "'");
2273
+ }
2274
+ function getDaysInMonth(date) {
2275
+ const _date = toDate(date);
2276
+ const year = _date.getFullYear();
2277
+ const monthIndex = _date.getMonth();
2278
+ const lastDayOfMonth2 = constructFrom(date, 0);
2279
+ lastDayOfMonth2.setFullYear(year, monthIndex + 1, 0);
2280
+ lastDayOfMonth2.setHours(0, 0, 0, 0);
2281
+ return lastDayOfMonth2.getDate();
2282
+ }
2283
+ function lastDayOfMonth(date) {
2284
+ const _date = toDate(date);
2285
+ const month = _date.getMonth();
2286
+ _date.setFullYear(_date.getFullYear(), month + 1, 0);
2287
+ _date.setHours(0, 0, 0, 0);
2288
+ return _date;
2289
+ }
2290
+ function isAfter(date, dateToCompare) {
2291
+ const _date = toDate(date);
2292
+ const _dateToCompare = toDate(dateToCompare);
2293
+ return _date.getTime() > _dateToCompare.getTime();
2294
+ }
2295
+ function isBefore(date, dateToCompare) {
2296
+ const _date = toDate(date);
2297
+ const _dateToCompare = toDate(dateToCompare);
2298
+ return +_date < +_dateToCompare;
2299
+ }
2300
+ function isSameMonth(dateLeft, dateRight) {
2301
+ const _dateLeft = toDate(dateLeft);
2302
+ const _dateRight = toDate(dateRight);
2303
+ return _dateLeft.getFullYear() === _dateRight.getFullYear() && _dateLeft.getMonth() === _dateRight.getMonth();
2304
+ }
2305
+ function parseISO(argument, options) {
2306
+ const additionalDigits = 2;
2307
+ const dateStrings = splitDateString(argument);
2308
+ let date;
2309
+ if (dateStrings.date) {
2310
+ const parseYearResult = parseYear(dateStrings.date, additionalDigits);
2311
+ date = parseDate(parseYearResult.restDateString, parseYearResult.year);
2312
+ }
2313
+ if (!date || isNaN(date.getTime())) {
2314
+ return /* @__PURE__ */ new Date(NaN);
2315
+ }
2316
+ const timestamp = date.getTime();
2317
+ let time = 0;
2318
+ let offset;
2319
+ if (dateStrings.time) {
2320
+ time = parseTime(dateStrings.time);
2321
+ if (isNaN(time)) {
2322
+ return /* @__PURE__ */ new Date(NaN);
2323
+ }
2324
+ }
2325
+ if (dateStrings.timezone) {
2326
+ offset = parseTimezone(dateStrings.timezone);
2327
+ if (isNaN(offset)) {
2328
+ return /* @__PURE__ */ new Date(NaN);
2329
+ }
2330
+ } else {
2331
+ const dirtyDate = new Date(timestamp + time);
2332
+ const result = /* @__PURE__ */ new Date(0);
2333
+ result.setFullYear(
2334
+ dirtyDate.getUTCFullYear(),
2335
+ dirtyDate.getUTCMonth(),
2336
+ dirtyDate.getUTCDate()
2337
+ );
2338
+ result.setHours(
2339
+ dirtyDate.getUTCHours(),
2340
+ dirtyDate.getUTCMinutes(),
2341
+ dirtyDate.getUTCSeconds(),
2342
+ dirtyDate.getUTCMilliseconds()
2343
+ );
2344
+ return result;
2345
+ }
2346
+ return new Date(timestamp + time + offset);
2347
+ }
2348
+ const patterns = {
2349
+ dateTimeDelimiter: /[T ]/,
2350
+ timeZoneDelimiter: /[Z ]/i,
2351
+ timezone: /([Z+-].*)$/
2352
+ };
2353
+ const dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
2354
+ const timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
2355
+ const timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
2356
+ function splitDateString(dateString) {
2357
+ const dateStrings = {};
2358
+ const array = dateString.split(patterns.dateTimeDelimiter);
2359
+ let timeString;
2360
+ if (array.length > 2) {
2361
+ return dateStrings;
2362
+ }
2363
+ if (/:/.test(array[0])) {
2364
+ timeString = array[0];
2365
+ } else {
2366
+ dateStrings.date = array[0];
2367
+ timeString = array[1];
2368
+ if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
2369
+ dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
2370
+ timeString = dateString.substr(
2371
+ dateStrings.date.length,
2372
+ dateString.length
2373
+ );
2374
+ }
2375
+ }
2376
+ if (timeString) {
2377
+ const token = patterns.timezone.exec(timeString);
2378
+ if (token) {
2379
+ dateStrings.time = timeString.replace(token[1], "");
2380
+ dateStrings.timezone = token[1];
2381
+ } else {
2382
+ dateStrings.time = timeString;
2383
+ }
2384
+ }
2385
+ return dateStrings;
2386
+ }
2387
+ function parseYear(dateString, additionalDigits) {
2388
+ const regex = new RegExp(
2389
+ "^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)"
2390
+ );
2391
+ const captures = dateString.match(regex);
2392
+ if (!captures) return { year: NaN, restDateString: "" };
2393
+ const year = captures[1] ? parseInt(captures[1]) : null;
2394
+ const century = captures[2] ? parseInt(captures[2]) : null;
2395
+ return {
2396
+ year: century === null ? year : century * 100,
2397
+ restDateString: dateString.slice((captures[1] || captures[2]).length)
2398
+ };
2399
+ }
2400
+ function parseDate(dateString, year) {
2401
+ if (year === null) return /* @__PURE__ */ new Date(NaN);
2402
+ const captures = dateString.match(dateRegex);
2403
+ if (!captures) return /* @__PURE__ */ new Date(NaN);
2404
+ const isWeekDate = !!captures[4];
2405
+ const dayOfYear = parseDateUnit(captures[1]);
2406
+ const month = parseDateUnit(captures[2]) - 1;
2407
+ const day = parseDateUnit(captures[3]);
2408
+ const week = parseDateUnit(captures[4]);
2409
+ const dayOfWeek = parseDateUnit(captures[5]) - 1;
2410
+ if (isWeekDate) {
2411
+ if (!validateWeekDate(year, week, dayOfWeek)) {
2412
+ return /* @__PURE__ */ new Date(NaN);
2413
+ }
2414
+ return dayOfISOWeekYear(year, week, dayOfWeek);
2415
+ } else {
2416
+ const date = /* @__PURE__ */ new Date(0);
2417
+ if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
2418
+ return /* @__PURE__ */ new Date(NaN);
2419
+ }
2420
+ date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
2421
+ return date;
2422
+ }
2423
+ }
2424
+ function parseDateUnit(value) {
2425
+ return value ? parseInt(value) : 1;
2426
+ }
2427
+ function parseTime(timeString) {
2428
+ const captures = timeString.match(timeRegex);
2429
+ if (!captures) return NaN;
2430
+ const hours = parseTimeUnit(captures[1]);
2431
+ const minutes = parseTimeUnit(captures[2]);
2432
+ const seconds = parseTimeUnit(captures[3]);
2433
+ if (!validateTime(hours, minutes, seconds)) {
2434
+ return NaN;
2435
+ }
2436
+ return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1e3;
2437
+ }
2438
+ function parseTimeUnit(value) {
2439
+ return value && parseFloat(value.replace(",", ".")) || 0;
2440
+ }
2441
+ function parseTimezone(timezoneString) {
2442
+ if (timezoneString === "Z") return 0;
2443
+ const captures = timezoneString.match(timezoneRegex);
2444
+ if (!captures) return 0;
2445
+ const sign = captures[1] === "+" ? -1 : 1;
2446
+ const hours = parseInt(captures[2]);
2447
+ const minutes = captures[3] && parseInt(captures[3]) || 0;
2448
+ if (!validateTimezone(hours, minutes)) {
2449
+ return NaN;
2450
+ }
2451
+ return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
2452
+ }
2453
+ function dayOfISOWeekYear(isoWeekYear, week, day) {
2454
+ const date = /* @__PURE__ */ new Date(0);
2455
+ date.setUTCFullYear(isoWeekYear, 0, 4);
2456
+ const fourthOfJanuaryDay = date.getUTCDay() || 7;
2457
+ const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
2458
+ date.setUTCDate(date.getUTCDate() + diff);
2459
+ return date;
2460
+ }
2461
+ const daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
2462
+ function isLeapYearIndex(year) {
2463
+ return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
2464
+ }
2465
+ function validateDate(year, month, date) {
2466
+ return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));
2467
+ }
2468
+ function validateDayOfYearDate(year, dayOfYear) {
2469
+ return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);
2470
+ }
2471
+ function validateWeekDate(_year, week, day) {
2472
+ return week >= 1 && week <= 53 && day >= 0 && day <= 6;
2473
+ }
2474
+ function validateTime(hours, minutes, seconds) {
2475
+ if (hours === 24) {
2476
+ return minutes === 0 && seconds === 0;
2477
+ }
2478
+ return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
2479
+ }
2480
+ function validateTimezone(_hours, minutes) {
2481
+ return minutes >= 0 && minutes <= 59;
2482
+ }
2483
+ class CalendarDate {
2484
+ constructor(value) {
2485
+ __publicField(this, "_dateNums");
2486
+ if (value || value === 0) {
2487
+ this._dateNums = CalendarDate.parse(value);
2488
+ } else {
2489
+ this._dateNums = CalendarDate.parse(/* @__PURE__ */ new Date());
2490
+ }
2491
+ }
2492
+ static parse(value) {
2493
+ if (typeof value === "string") {
2494
+ value = value.split("T")[0];
2495
+ return value.split("-").map((v) => +v);
2496
+ } else if (value instanceof Date) {
2497
+ return [value.getFullYear(), value.getMonth() + 1, value.getDate()];
2498
+ } else if (value === 0) {
2499
+ return [0, 0, 0];
2500
+ } else {
2501
+ return [value.year, value.month, value.day];
2502
+ }
2503
+ }
2504
+ static init() {
2505
+ return new CalendarDate(0);
2506
+ }
2507
+ // Used internally to get the date value for the date_fns
2508
+ get date() {
2509
+ return new Date(
2510
+ this._dateNums[0],
2511
+ this._dateNums[1] - 1,
2512
+ this._dateNums[2]
2513
+ );
2514
+ }
2515
+ get year() {
2516
+ return this._dateNums[0];
2517
+ }
2518
+ get month() {
2519
+ return this._dateNums[1];
2520
+ }
2521
+ get day() {
2522
+ return this._dateNums[2];
2523
+ }
2524
+ get dayOfWeek() {
2525
+ return this.date.getDay();
2526
+ }
2527
+ get daysInMonth() {
2528
+ return getDaysInMonth(this.date);
2529
+ }
2530
+ get firstDayOfMonth() {
2531
+ return new CalendarDate({ year: this.year, month: this.month, day: 1 });
2532
+ }
2533
+ get lastDayOfMonth() {
2534
+ return new CalendarDate(lastDayOfMonth(this.date));
2535
+ }
2536
+ get previousDay() {
2537
+ return this.clone().addDays(-1);
2538
+ }
2539
+ get nextDay() {
2540
+ return this.clone().addDays(1);
2541
+ }
2542
+ get previousWeek() {
2543
+ return this.clone().addDays(-7);
2544
+ }
2545
+ get nextWeek() {
2546
+ return this.clone().addDays(7);
2547
+ }
2548
+ get previousMonth() {
2549
+ return this.clone().addMonths(-1);
2550
+ }
2551
+ get nextMonth() {
2552
+ return this.clone().addMonths(1);
2553
+ }
2554
+ clone() {
2555
+ return new CalendarDate(this.toString());
2556
+ }
2557
+ setYear(val) {
2558
+ this._dateNums[0] = val;
2559
+ }
2560
+ setMonth(val) {
2561
+ this._dateNums[1] = val;
2562
+ }
2563
+ setDay(val) {
2564
+ this._dateNums[2] = val;
2565
+ return this;
2566
+ }
2567
+ addYears(count) {
2568
+ this._dateNums[0] += count;
2569
+ return this;
2570
+ }
2571
+ addMonths(count) {
2572
+ this._dateNums = CalendarDate.parse(addMonths(this.date, count));
2573
+ return this;
2574
+ }
2575
+ addDays(count) {
2576
+ this._dateNums = CalendarDate.parse(addDays(this.date, count));
2577
+ return this;
2578
+ }
2579
+ isSameDay(cmp) {
2580
+ return isSameDay(this.date, cmp.date);
2581
+ }
2582
+ isSameMonth(value) {
2583
+ return isSameMonth(this.date, value.date);
2584
+ }
2585
+ isBefore(cmp) {
2586
+ return isBefore(this.date, cmp.date);
2587
+ }
2588
+ isAfter(cmp) {
2589
+ return isAfter(this.date, cmp.date);
2590
+ }
2591
+ isZero() {
2592
+ return this._dateNums[0] === 0 && this._dateNums[1] === 0 && this._dateNums[2] === 0;
2593
+ }
2594
+ isValid() {
2595
+ const comparisonDate = new Date(this.toString());
2596
+ if (isNaN(comparisonDate.getTime()) || this.toString() !== comparisonDate.toISOString().split("T")[0]) {
2597
+ return false;
2598
+ }
2599
+ return true;
2600
+ }
2601
+ format(tmpl) {
2602
+ if (this.isZero()) {
2603
+ return "";
2604
+ }
2605
+ return format(this.date, tmpl);
2606
+ }
2607
+ toString() {
2608
+ if (this.isZero()) {
2609
+ return "";
2610
+ }
2611
+ return this._dateNums.map((num) => `${num}`.length < 2 ? `0${num}` : `${num}`).join("-");
2612
+ }
2613
+ }
2614
+ function GoabDatePicker({
2615
+ value,
2616
+ error,
2617
+ min,
2618
+ max,
2619
+ disabled,
2620
+ relative,
2621
+ onChange,
2622
+ ...rest
2623
+ }) {
2624
+ const ref = react.useRef(null);
2625
+ const _props = transformProps(rest, lowercase);
2626
+ react.useEffect(() => {
2627
+ if (value && typeof value !== "string") {
2628
+ console.warn(
2629
+ "Using a `Date` type for value is deprecated. Instead use a string of the format `yyyy-mm-dd`"
2630
+ );
2631
+ }
2632
+ }, []);
2633
+ react.useEffect(() => {
2634
+ if (!ref.current) {
2635
+ return;
2636
+ }
2637
+ const current = ref.current;
2638
+ const handleChange = (e) => {
2639
+ const detail = e.detail;
2640
+ onChange == null ? void 0 : onChange({ ...detail, event: e });
2641
+ };
2642
+ if (onChange) {
2643
+ current.addEventListener("_change", handleChange);
2644
+ }
2645
+ return () => {
2646
+ if (onChange) {
2647
+ current.removeEventListener("_change", handleChange);
2648
+ }
2649
+ };
2650
+ }, [onChange]);
2651
+ const formatValue = (val) => {
2652
+ if (!val) return "";
2653
+ if (val instanceof Date) {
2654
+ return new CalendarDate(val).toString();
2655
+ }
2656
+ return val;
2657
+ };
2658
+ return /* @__PURE__ */ jsxRuntime.jsx(
2659
+ "goa-date-picker",
2660
+ {
2661
+ ref,
2662
+ value: formatValue(value) || void 0,
2663
+ error: error ? "true" : void 0,
2664
+ disabled: disabled ? "true" : void 0,
2665
+ min: formatValue(min) || void 0,
2666
+ max: formatValue(max) || void 0,
2667
+ relative: relative ? "true" : void 0,
2668
+ version: "2",
2669
+ ..._props
2670
+ }
2671
+ );
2672
+ }
2673
+ function GoabDetails({
2674
+ open,
2675
+ children,
2676
+ ...rest
2677
+ }) {
2678
+ const _props = transformProps(rest, lowercase);
2679
+ return /* @__PURE__ */ jsxRuntime.jsx(
2680
+ "goa-details",
2681
+ {
2682
+ open: open ? "true" : void 0,
2683
+ ..._props,
2684
+ children
2685
+ }
2686
+ );
2687
+ }
2688
+ function GoabDivider(props) {
2689
+ return /* @__PURE__ */ jsxRuntime.jsx(
2690
+ "goa-divider",
2691
+ {
2692
+ mt: props.mt,
2693
+ mr: props.mr,
2694
+ mb: props.mb,
2695
+ ml: props.ml,
2696
+ testid: props.testId
2697
+ }
2698
+ );
2699
+ }
2700
+ function GoabDrawer({
2701
+ position,
2702
+ open,
2703
+ heading,
2704
+ maxSize,
2705
+ testId,
2706
+ actions,
2707
+ children,
2708
+ onClose
2709
+ }) {
2710
+ const el = react.useRef(null);
2711
+ react.useEffect(() => {
2712
+ var _a;
2713
+ if (!(el == null ? void 0 : el.current) || !onClose) {
2714
+ return;
2715
+ }
2716
+ (_a = el.current) == null ? void 0 : _a.addEventListener("_close", onClose);
2717
+ return () => {
2718
+ var _a2;
2719
+ (_a2 = el.current) == null ? void 0 : _a2.removeEventListener("_close", onClose);
2720
+ };
2721
+ }, [el, onClose]);
2722
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2723
+ "goa-drawer",
2724
+ {
2725
+ ref: el,
2726
+ position,
2727
+ open: open ? true : void 0,
2728
+ heading: typeof heading === "string" ? heading : void 0,
2729
+ maxsize: maxSize,
2730
+ testid: testId,
2731
+ version: "2",
2732
+ children: [
2733
+ heading && typeof heading !== "string" && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "heading", children: heading }),
2734
+ actions && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "actions", children: actions }),
2735
+ children
2736
+ ]
2737
+ }
2738
+ );
2739
+ }
2740
+ function stringify(value) {
2741
+ if (typeof value === "undefined") {
2742
+ return "";
2743
+ }
2744
+ if (typeof value === "string") {
2745
+ return value;
2746
+ }
2747
+ return JSON.stringify(value);
2748
+ }
2749
+ function GoabDropdown({
2750
+ value,
2751
+ onChange,
635
2752
  disabled,
636
2753
  error,
637
2754
  filterable,
@@ -639,10 +2756,11 @@ function GoabDropdown({
639
2756
  native,
640
2757
  relative,
641
2758
  children,
2759
+ size = "default",
642
2760
  ...rest
643
2761
  }) {
644
2762
  const el = react.useRef(null);
645
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
2763
+ const _props = transformProps({ size, ...rest }, lowercase);
646
2764
  react.useEffect(() => {
647
2765
  if (!el.current) {
648
2766
  return;
@@ -673,6 +2791,7 @@ function GoabDropdown({
673
2791
  native: native ? "true" : void 0,
674
2792
  relative: relative ? "true" : void 0,
675
2793
  ..._props,
2794
+ version: "2",
676
2795
  children
677
2796
  }
678
2797
  );
@@ -708,7 +2827,7 @@ function GoabFileUploadCard({
708
2827
  ...rest
709
2828
  }) {
710
2829
  const el = react.useRef(null);
711
- const _props = parseISO.transformProps({ filename, ...rest }, parseISO.lowercase);
2830
+ const _props = transformProps({ filename, ...rest }, lowercase);
712
2831
  react.useEffect(() => {
713
2832
  if (!el.current) return;
714
2833
  const current = el.current;
@@ -721,14 +2840,11 @@ function GoabFileUploadCard({
721
2840
  current.removeEventListener("_cancel", cancelHandler);
722
2841
  };
723
2842
  }, [el, onDelete, onCancel, filename]);
724
- return /* @__PURE__ */ jsxRuntime.jsx("goa-file-upload-card", { ref: el, ..._props });
2843
+ return /* @__PURE__ */ jsxRuntime.jsx("goa-file-upload-card", { ref: el, ..._props, version: "2" });
725
2844
  }
726
- function GoabFileUploadInput({
727
- onSelectFile,
728
- ...rest
729
- }) {
2845
+ function GoabFileUploadInput({ onSelectFile, ...rest }) {
730
2846
  const el = react.useRef(null);
731
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
2847
+ const _props = transformProps(rest, lowercase);
732
2848
  react.useEffect(() => {
733
2849
  if (!el.current) return;
734
2850
  const current = el.current;
@@ -741,27 +2857,24 @@ function GoabFileUploadInput({
741
2857
  current.removeEventListener("_selectFile", handler);
742
2858
  };
743
2859
  }, [el, onSelectFile]);
744
- return /* @__PURE__ */ jsxRuntime.jsx("goa-file-upload-input", { ref: el, ..._props });
2860
+ return /* @__PURE__ */ jsxRuntime.jsx("goa-file-upload-input", { ref: el, ..._props, version: "2" });
745
2861
  }
746
- function GoabAppFooter({
747
- children,
748
- ...rest
749
- }) {
750
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
751
- return /* @__PURE__ */ jsxRuntime.jsx("goa-app-footer", { ..._props, children });
2862
+ function GoabAppFooter({ children, ...rest }) {
2863
+ const _props = transformProps(rest, lowercase);
2864
+ return /* @__PURE__ */ jsxRuntime.jsx("goa-app-footer", { ..._props, version: "2", children });
752
2865
  }
753
2866
  function GoabAppFooterMetaSection({
754
2867
  children,
755
2868
  ...rest
756
2869
  }) {
757
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
2870
+ const _props = transformProps(rest, lowercase);
758
2871
  return /* @__PURE__ */ jsxRuntime.jsx("goa-app-footer-meta-section", { slot: "meta", ..._props, children });
759
2872
  }
760
2873
  function GoabAppFooterNavSection({
761
2874
  children,
762
2875
  ...rest
763
2876
  }) {
764
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
2877
+ const _props = transformProps(rest, lowercase);
765
2878
  return /* @__PURE__ */ jsxRuntime.jsx("goa-app-footer-nav-section", { slot: "nav", ..._props, children });
766
2879
  }
767
2880
  function GoabFieldset({
@@ -770,7 +2883,7 @@ function GoabFieldset({
770
2883
  ...rest
771
2884
  }) {
772
2885
  const ref = react.useRef(null);
773
- const _props = parseISO.transformProps(rest, parseISO.kebab);
2886
+ const _props = transformProps(rest, kebab);
774
2887
  react.useEffect(() => {
775
2888
  if (!ref.current) return;
776
2889
  const current = ref.current;
@@ -795,7 +2908,7 @@ function GoabPublicFormPage({
795
2908
  ...rest
796
2909
  }) {
797
2910
  const ref = react.useRef(null);
798
- const _props = parseISO.transformProps(rest, parseISO.kebab);
2911
+ const _props = transformProps(rest, kebab);
799
2912
  react.useEffect(() => {
800
2913
  if (!ref.current) return;
801
2914
  const current = ref.current;
@@ -817,9 +2930,9 @@ function GoabPublicFormSummary({
817
2930
  heading = "",
818
2931
  ...rest
819
2932
  }) {
820
- const _props = parseISO.transformProps(
2933
+ const _props = transformProps(
821
2934
  { heading, ...rest },
822
- parseISO.lowercase
2935
+ lowercase
823
2936
  );
824
2937
  return /* @__PURE__ */ jsxRuntime.jsx("goa-public-form-summary", { ..._props });
825
2938
  }
@@ -832,7 +2945,7 @@ function GoabPublicForm({
832
2945
  }) {
833
2946
  const ref = react.useRef(null);
834
2947
  const initialized = react.useRef(false);
835
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
2948
+ const _props = transformProps(rest, lowercase);
836
2949
  react.useLayoutEffect(() => {
837
2950
  if (!ref.current) return;
838
2951
  const current = ref.current;
@@ -880,9 +2993,9 @@ function GoabPublicSubform({
880
2993
  ...rest
881
2994
  }) {
882
2995
  const ref = react.useRef(null);
883
- const _props = parseISO.transformProps(
2996
+ const _props = transformProps(
884
2997
  { id, name, "continue-msg": continueMsg, ...rest },
885
- parseISO.kebab
2998
+ kebab
886
2999
  );
887
3000
  react.useEffect(() => {
888
3001
  if (!ref.current) return;
@@ -918,9 +3031,9 @@ function GoabPublicSubformIndex({
918
3031
  children,
919
3032
  ...rest
920
3033
  }) {
921
- const _props = parseISO.transformProps(
3034
+ const _props = transformProps(
922
3035
  { heading, "section-title": sectionTitle, "action-button-text": actionButtonText, "button-visibility": buttonVisibility, ...rest },
923
- parseISO.kebab
3036
+ kebab
924
3037
  );
925
3038
  return /* @__PURE__ */ jsxRuntime.jsx("goa-public-subform-index", { slot: "subform-index", ..._props, children });
926
3039
  }
@@ -929,9 +3042,9 @@ function GoabPublicFormTask({
929
3042
  children,
930
3043
  ...rest
931
3044
  }) {
932
- const _props = parseISO.transformProps(
3045
+ const _props = transformProps(
933
3046
  { status, ...rest },
934
- parseISO.lowercase
3047
+ lowercase
935
3048
  );
936
3049
  return /* @__PURE__ */ jsxRuntime.jsx("goa-public-form-task", { ..._props, children });
937
3050
  }
@@ -939,7 +3052,7 @@ function GoabPublicFormTaskList({
939
3052
  children,
940
3053
  ...rest
941
3054
  }) {
942
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
3055
+ const _props = transformProps(rest, lowercase);
943
3056
  return /* @__PURE__ */ jsxRuntime.jsx("goa-public-form-task-list", { ..._props, children });
944
3057
  }
945
3058
  function GoabFormItem({
@@ -947,9 +3060,10 @@ function GoabFormItem({
947
3060
  helpText,
948
3061
  publicFormSummaryOrder,
949
3062
  children,
3063
+ type = "",
950
3064
  ...rest
951
3065
  }) {
952
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
3066
+ const _props = transformProps({ type, ...rest }, lowercase);
953
3067
  return /* @__PURE__ */ jsxRuntime.jsxs(
954
3068
  "goa-form-item",
955
3069
  {
@@ -957,6 +3071,7 @@ function GoabFormItem({
957
3071
  helptext: typeof helpText === "string" ? helpText : void 0,
958
3072
  "public-form-summary-order": publicFormSummaryOrder,
959
3073
  ..._props,
3074
+ version: "2",
960
3075
  children: [
961
3076
  error && typeof error !== "string" && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "error", children: error }),
962
3077
  helpText && typeof helpText !== "string" && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "helptext", children: helpText }),
@@ -1071,9 +3186,9 @@ function GoabIconButton({
1071
3186
  ...rest
1072
3187
  }) {
1073
3188
  const ref = react.useRef(null);
1074
- const _props = parseISO.transformProps(
3189
+ const _props = transformProps(
1075
3190
  { variant, size, ...rest },
1076
- parseISO.lowercase
3191
+ lowercase
1077
3192
  );
1078
3193
  react.useEffect(() => {
1079
3194
  if (!ref.current) {
@@ -1107,7 +3222,7 @@ function GoabIcon({
1107
3222
  inverted,
1108
3223
  ...rest
1109
3224
  }) {
1110
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
3225
+ const _props = transformProps(rest, lowercase);
1111
3226
  return /* @__PURE__ */ jsxRuntime.jsx(
1112
3227
  "goa-icon",
1113
3228
  {
@@ -1119,6 +3234,7 @@ function GoabIcon({
1119
3234
  function GoabInput({
1120
3235
  variant = "goa",
1121
3236
  textAlign = "left",
3237
+ size = "default",
1122
3238
  focused,
1123
3239
  disabled,
1124
3240
  readonly,
@@ -1133,7 +3249,10 @@ function GoabInput({
1133
3249
  ...rest
1134
3250
  }) {
1135
3251
  const ref = react.useRef(null);
1136
- const _props = parseISO.transformProps({ variant, textalign: textAlign, ...rest }, parseISO.lowercase);
3252
+ const _props = transformProps(
3253
+ { variant, textalign: textAlign, size, ...rest },
3254
+ lowercase
3255
+ );
1137
3256
  react.useEffect(() => {
1138
3257
  if (!ref.current) {
1139
3258
  return;
@@ -1181,6 +3300,7 @@ function GoabInput({
1181
3300
  readonly: readonly ? "true" : void 0,
1182
3301
  error: error ? "true" : void 0,
1183
3302
  handletrailingiconclick: onTrailingIconClick ? "true" : "false",
3303
+ version: "2",
1184
3304
  children: [
1185
3305
  leadingContent && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "leadingContent", children: leadingContent }),
1186
3306
  trailingContent && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "trailingContent", children: trailingContent })
@@ -1194,11 +3314,11 @@ const onDateChangeHandler = (onChange) => {
1194
3314
  onChange == null ? void 0 : onChange({ name, value: "", event });
1195
3315
  return;
1196
3316
  }
1197
- if (typeof value === "string" && parseISO.isValid(new Date(value))) {
1198
- onChange == null ? void 0 : onChange({ name, value: parseISO.parseISO(value), event });
3317
+ if (typeof value === "string" && isValid(new Date(value))) {
3318
+ onChange == null ? void 0 : onChange({ name, value: parseISO(value), event });
1199
3319
  return;
1200
3320
  }
1201
- if (parseISO.isValid(value)) {
3321
+ if (isValid(value)) {
1202
3322
  onChange == null ? void 0 : onChange({ name, value, event });
1203
3323
  return;
1204
3324
  }
@@ -1218,12 +3338,12 @@ function toString(value, tmpl = "yyyy-MM-dd") {
1218
3338
  return "";
1219
3339
  }
1220
3340
  if (typeof value === "string") {
1221
- return parseISO.format(parseISO.parseISO(value), tmpl);
3341
+ return format(parseISO(value), tmpl);
1222
3342
  }
1223
3343
  if (value.toISOString() === (/* @__PURE__ */ new Date(0)).toISOString()) {
1224
3344
  return "";
1225
3345
  }
1226
- return parseISO.format(value, tmpl);
3346
+ return format(value, tmpl);
1227
3347
  }
1228
3348
  function GoabInputText(props) {
1229
3349
  return /* @__PURE__ */ jsxRuntime.jsx(GoabInput, { ...props, type: "text" });
@@ -1378,10 +3498,12 @@ const GoabLinearProgress = ({
1378
3498
  function GoabLink({
1379
3499
  actionArgs,
1380
3500
  actionArg,
3501
+ color = "interactive",
3502
+ size = "medium",
1381
3503
  children,
1382
3504
  ...rest
1383
3505
  }) {
1384
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
3506
+ const _props = transformProps({ color, size, ...rest }, lowercase);
1385
3507
  return /* @__PURE__ */ jsxRuntime.jsx(
1386
3508
  "goa-link",
1387
3509
  {
@@ -1397,9 +3519,9 @@ function GoALinkButton({
1397
3519
  children,
1398
3520
  ...rest
1399
3521
  }) {
1400
- const _props = parseISO.transformProps(
3522
+ const _props = transformProps(
1401
3523
  { type, ...rest },
1402
- parseISO.lowercase
3524
+ lowercase
1403
3525
  );
1404
3526
  return /* @__PURE__ */ jsxRuntime.jsx("goa-link-button", { ..._props, children });
1405
3527
  }
@@ -1411,9 +3533,9 @@ function GoabMenuButton({
1411
3533
  ...rest
1412
3534
  }) {
1413
3535
  const el = react.useRef(null);
1414
- const _props = parseISO.transformProps(
3536
+ const _props = transformProps(
1415
3537
  { type, testid: testId, ...rest },
1416
- parseISO.kebab
3538
+ kebab
1417
3539
  );
1418
3540
  react.useEffect(() => {
1419
3541
  if (!el.current) {
@@ -1432,10 +3554,13 @@ function GoabMenuButton({
1432
3554
  current.removeEventListener("_action", listener);
1433
3555
  };
1434
3556
  }, [el, onAction]);
1435
- return /* @__PURE__ */ jsxRuntime.jsx("goa-menu-button", { ..._props, ref: el, children });
3557
+ return (
3558
+ // @ts-expect-error - stable WCProps requires text, but experimental supports icon-only mode
3559
+ /* @__PURE__ */ jsxRuntime.jsx("goa-menu-button", { ..._props, version: "2", ref: el, children })
3560
+ );
1436
3561
  }
1437
3562
  function GoabMenuAction(props) {
1438
- const _props = parseISO.transformProps(props, parseISO.lowercase);
3563
+ const _props = transformProps(props, lowercase);
1439
3564
  return /* @__PURE__ */ jsxRuntime.jsx("goa-menu-action", { ..._props });
1440
3565
  }
1441
3566
  function GoabMicrositeHeader({
@@ -1517,877 +3642,601 @@ function GoabModal({
1517
3642
  transition,
1518
3643
  calloutvariant: calloutVariant,
1519
3644
  testid: testId,
3645
+ version: "2",
1520
3646
  children: [
1521
3647
  heading && typeof heading !== "string" && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "heading", children: heading }),
1522
3648
  actions && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "actions", children: actions }),
1523
3649
  children
1524
3650
  ]
1525
3651
  }
1526
- );
1527
- }
1528
- const GoabNotification = ({
1529
- type = "information",
1530
- ariaLive,
1531
- maxContentWidth,
1532
- children,
1533
- testId,
1534
- onDismiss
1535
- }) => {
1536
- const el = react.useRef(null);
1537
- react.useEffect(() => {
1538
- if (!el.current) {
1539
- return;
1540
- }
1541
- const current = el.current;
1542
- const listener = () => {
1543
- onDismiss == null ? void 0 : onDismiss();
1544
- };
1545
- current.addEventListener("_dismiss", listener);
1546
- return () => {
1547
- current.removeEventListener("_dismiss", listener);
1548
- };
1549
- }, [el, onDismiss]);
1550
- return /* @__PURE__ */ jsxRuntime.jsx(
1551
- "goa-notification",
1552
- {
1553
- ref: el,
1554
- type,
1555
- testid: testId,
1556
- maxcontentwidth: maxContentWidth,
1557
- arialive: ariaLive,
1558
- children
1559
- }
1560
- );
1561
- };
1562
- function GoabOneColumnLayout(props) {
1563
- return /* @__PURE__ */ jsxRuntime.jsx("goa-one-column-layout", { children: props.children });
1564
- }
1565
- function GoabPageBlock(props) {
1566
- return /* @__PURE__ */ jsxRuntime.jsx("goa-page-block", { width: props.width, testid: props.testId, children: props.children });
1567
- }
1568
- function GoabPages(props) {
1569
- return /* @__PURE__ */ jsxRuntime.jsx(
1570
- "goa-pages",
1571
- {
1572
- current: props.current,
1573
- ml: props.ml,
1574
- mr: props.mr,
1575
- mt: props.mt,
1576
- mb: props.mb,
1577
- children: props.children
1578
- }
1579
- );
1580
- }
1581
- function GoabPagination({ onChange, ...props }) {
1582
- const ref = react.useRef(null);
1583
- react.useEffect(() => {
1584
- if (!ref.current) {
1585
- return;
1586
- }
1587
- const current = ref.current;
1588
- const changeListener = (e) => {
1589
- const detail = e.detail;
1590
- onChange(detail);
1591
- };
1592
- current.addEventListener("_change", changeListener);
1593
- return () => {
1594
- current.removeEventListener("_change", changeListener);
1595
- };
1596
- }, [ref, onChange]);
1597
- return /* @__PURE__ */ jsxRuntime.jsx(
1598
- "goa-pagination",
1599
- {
1600
- ref,
1601
- itemcount: props.itemCount,
1602
- perpagecount: props.perPageCount,
1603
- pagenumber: props.pageNumber,
1604
- variant: props.variant,
1605
- mt: props.mt,
1606
- mb: props.mb,
1607
- ml: props.ml,
1608
- mr: props.mr,
1609
- testid: props.testId
1610
- }
1611
- );
1612
- }
1613
- function GoabPopover({
1614
- target,
1615
- padded,
1616
- relative,
1617
- children,
1618
- ...rest
1619
- }) {
1620
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
1621
- return /* @__PURE__ */ jsxRuntime.jsxs(
1622
- "goa-popover",
1623
- {
1624
- padded: typeof padded === "undefined" ? void 0 : padded ? "true" : "false",
1625
- relative: relative ? "true" : void 0,
1626
- ..._props,
1627
- children: [
1628
- children,
1629
- target && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "target", children: target })
1630
- ]
1631
- }
1632
- );
1633
- }
1634
- function GoabPushDrawer({
1635
- testid,
1636
- open,
1637
- heading,
1638
- width,
1639
- actions,
1640
- children,
1641
- onClose
1642
- }) {
1643
- const el = react.useRef(null);
1644
- react.useEffect(() => {
1645
- const elCurrent = el == null ? void 0 : el.current;
1646
- if (!elCurrent || !onClose) {
1647
- return;
1648
- }
1649
- elCurrent.addEventListener("_close", onClose);
1650
- return () => {
1651
- elCurrent.removeEventListener("_close", onClose);
1652
- };
1653
- }, [el, onClose]);
1654
- return /* @__PURE__ */ jsxRuntime.jsxs(
1655
- "goa-push-drawer",
1656
- {
1657
- ref: el,
1658
- testid,
1659
- open: open ?? false,
1660
- heading: typeof heading === "string" ? heading : void 0,
1661
- width,
1662
- children: [
1663
- heading && typeof heading !== "string" && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "heading", children: heading }),
1664
- actions && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "actions", children: actions }),
1665
- children
1666
- ]
1667
- }
1668
- );
1669
- }
1670
- function GoabRadioItem({
1671
- name,
1672
- label,
1673
- value,
1674
- description,
1675
- reveal,
1676
- revealAriaLabel,
1677
- maxWidth,
1678
- disabled,
1679
- checked,
1680
- error,
1681
- ariaLabel,
1682
- children,
1683
- mt,
1684
- mr,
1685
- mb,
1686
- ml
1687
- }) {
1688
- return /* @__PURE__ */ jsxRuntime.jsxs(
1689
- "goa-radio-item",
1690
- {
1691
- name,
1692
- label,
1693
- value,
1694
- description: typeof description === "string" ? description : void 0,
1695
- maxwidth: maxWidth,
1696
- error: error ? "true" : void 0,
1697
- disabled: disabled ? "true" : void 0,
1698
- checked: checked ? "true" : void 0,
1699
- arialabel: ariaLabel,
1700
- revealarialabel: revealAriaLabel,
1701
- mt,
1702
- mr,
1703
- mb,
1704
- ml,
1705
- children: [
1706
- description && typeof description !== "string" && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "description", children: description }),
1707
- reveal && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "reveal", children: reveal }),
1708
- children
1709
- ]
1710
- }
1711
- );
1712
- }
1713
- function GoabRadioGroup({
1714
- disabled,
1715
- error,
1716
- onChange,
1717
- name,
1718
- children,
1719
- ...rest
1720
- }) {
1721
- const el = react.useRef(null);
1722
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
1723
- react.useEffect(() => {
1724
- if (!el.current) return;
1725
- const listener = (e) => {
1726
- const detail = e.detail;
1727
- onChange == null ? void 0 : onChange({ ...detail, event: e });
1728
- };
1729
- const currentEl = el.current;
1730
- if (onChange) {
1731
- currentEl.addEventListener("_change", listener);
1732
- }
1733
- return () => {
1734
- if (onChange) {
1735
- currentEl.removeEventListener("_change", listener);
1736
- }
1737
- };
1738
- }, [name, onChange]);
1739
- return /* @__PURE__ */ jsxRuntime.jsx(
1740
- "goa-radio-group",
1741
- {
1742
- ref: el,
1743
- ..._props,
1744
- name,
1745
- disabled: disabled ? "true" : void 0,
1746
- error: error ? "true" : void 0,
1747
- children
1748
- }
1749
- );
1750
- }
1751
- function GoabSideMenuGroup(props) {
1752
- return /* @__PURE__ */ jsxRuntime.jsx(
1753
- "goa-side-menu-group",
1754
- {
1755
- heading: props.heading,
1756
- icon: props.icon,
1757
- testid: props.testId,
1758
- mt: props.mt,
1759
- mr: props.mr,
1760
- mb: props.mb,
1761
- ml: props.ml,
1762
- children: props.children
1763
- }
1764
- );
1765
- }
1766
- function GoabSideMenuHeading(props) {
1767
- return /* @__PURE__ */ jsxRuntime.jsxs("goa-side-menu-heading", { icon: props.icon, testid: props.testId, children: [
1768
- props.children,
1769
- props.meta && /* @__PURE__ */ jsxRuntime.jsx("span", { slot: "meta", children: props.meta })
1770
- ] });
1771
- }
1772
- function GoabSideMenu(props) {
1773
- return /* @__PURE__ */ jsxRuntime.jsx("goa-side-menu", { testid: props.testId, children: props.children });
3652
+ );
1774
3653
  }
1775
- const GoabSkeleton = ({
1776
- maxWidth,
1777
- size,
1778
- lineCount,
1779
- type,
3654
+ const GoabNotification = ({
3655
+ type = "information",
3656
+ emphasis = "high",
3657
+ compact,
3658
+ ariaLive,
3659
+ maxContentWidth,
3660
+ children,
1780
3661
  testId,
1781
- mt,
1782
- mr,
1783
- mb,
1784
- ml
3662
+ onDismiss
1785
3663
  }) => {
3664
+ const el = react.useRef(null);
3665
+ react.useEffect(() => {
3666
+ if (!el.current) {
3667
+ return;
3668
+ }
3669
+ const current = el.current;
3670
+ const listener = () => {
3671
+ onDismiss == null ? void 0 : onDismiss();
3672
+ };
3673
+ current.addEventListener("_dismiss", listener);
3674
+ return () => {
3675
+ current.removeEventListener("_dismiss", listener);
3676
+ };
3677
+ }, [el, onDismiss]);
1786
3678
  return /* @__PURE__ */ jsxRuntime.jsx(
1787
- "goa-skeleton",
3679
+ "goa-notification",
1788
3680
  {
1789
- maxwidth: maxWidth,
1790
- linecount: lineCount,
3681
+ ref: el,
1791
3682
  type,
1792
- size,
1793
- mt,
1794
- mr,
1795
- mb,
1796
- ml,
1797
- testid: testId
3683
+ testid: testId,
3684
+ maxcontentwidth: maxContentWidth,
3685
+ arialive: ariaLive,
3686
+ emphasis,
3687
+ compact: compact ? "true" : void 0,
3688
+ version: "2",
3689
+ children
1798
3690
  }
1799
3691
  );
1800
3692
  };
1801
- function GoabSpacer(props) {
1802
- return /* @__PURE__ */ jsxRuntime.jsx(
1803
- "goa-spacer",
1804
- {
1805
- hspacing: props.hSpacing,
1806
- vspacing: props.vSpacing,
1807
- testid: props.testId
1808
- }
1809
- );
3693
+ function GoabOneColumnLayout(props) {
3694
+ return /* @__PURE__ */ jsxRuntime.jsx("goa-one-column-layout", { children: props.children });
1810
3695
  }
1811
- function GoabSpinner({
1812
- type,
1813
- size,
1814
- progress,
1815
- invert,
1816
- testId
1817
- }) {
3696
+ function GoabPageBlock(props) {
3697
+ return /* @__PURE__ */ jsxRuntime.jsx("goa-page-block", { width: props.width, testid: props.testId, children: props.children });
3698
+ }
3699
+ function GoabPages(props) {
1818
3700
  return /* @__PURE__ */ jsxRuntime.jsx(
1819
- "goa-spinner",
3701
+ "goa-pages",
1820
3702
  {
1821
- type,
1822
- size,
1823
- progress,
1824
- invert: invert ? "true" : void 0,
1825
- testid: testId
3703
+ current: props.current,
3704
+ ml: props.ml,
3705
+ mr: props.mr,
3706
+ mt: props.mt,
3707
+ mb: props.mb,
3708
+ children: props.children
1826
3709
  }
1827
3710
  );
1828
3711
  }
1829
- function GoabTable({ onSort, ...props }) {
3712
+ function GoabPagination({ onChange, ...props }) {
1830
3713
  const ref = react.useRef(null);
1831
3714
  react.useEffect(() => {
1832
3715
  if (!ref.current) {
1833
3716
  return;
1834
3717
  }
1835
3718
  const current = ref.current;
1836
- const sortListener = (e) => {
3719
+ const changeListener = (e) => {
1837
3720
  const detail = e.detail;
1838
- onSort == null ? void 0 : onSort(detail);
3721
+ onChange(detail);
1839
3722
  };
1840
- current.addEventListener("_sort", sortListener);
3723
+ current.addEventListener("_change", changeListener);
1841
3724
  return () => {
1842
- current.removeEventListener("_sort", sortListener);
3725
+ current.removeEventListener("_change", changeListener);
1843
3726
  };
1844
- }, [ref, onSort]);
3727
+ }, [ref, onChange]);
1845
3728
  return /* @__PURE__ */ jsxRuntime.jsx(
1846
- "goa-table",
3729
+ "goa-pagination",
1847
3730
  {
1848
3731
  ref,
1849
- width: props.width,
3732
+ itemcount: props.itemCount,
3733
+ perpagecount: props.perPageCount,
3734
+ pagenumber: props.pageNumber,
1850
3735
  variant: props.variant,
1851
- testid: props.testId,
1852
3736
  mt: props.mt,
1853
3737
  mb: props.mb,
1854
3738
  ml: props.ml,
1855
3739
  mr: props.mr,
1856
- children: /* @__PURE__ */ jsxRuntime.jsx("table", { style: { width: "100%" }, children: props.children })
3740
+ testid: props.testId,
3741
+ version: "2"
1857
3742
  }
1858
3743
  );
1859
3744
  }
1860
- function GoabTableSortHeader({
3745
+ function GoabPopover({
3746
+ target,
3747
+ padded,
3748
+ relative,
1861
3749
  children,
1862
3750
  ...rest
1863
3751
  }) {
1864
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
1865
- return /* @__PURE__ */ jsxRuntime.jsx("goa-table-sort-header", { ..._props, children });
1866
- }
1867
- function GoabTabs({
1868
- initialTab,
1869
- children,
1870
- testId,
1871
- variant,
1872
- onChange
1873
- }) {
1874
- const ref = react.useRef(null);
1875
- react.useEffect(() => {
1876
- const element = ref.current;
1877
- if (element && onChange) {
1878
- const handler = (event) => {
1879
- const detail = event.detail;
1880
- onChange(detail);
1881
- };
1882
- element.addEventListener("_change", handler);
1883
- return () => {
1884
- element.removeEventListener("_change", handler);
1885
- };
1886
- }
1887
- }, [onChange]);
1888
- return /* @__PURE__ */ jsxRuntime.jsx("goa-tabs", { ref, initialtab: initialTab, testid: testId, variant, children });
1889
- }
1890
- function GoabTab({ heading, disabled, slug, children }) {
3752
+ const _props = transformProps(rest, lowercase);
1891
3753
  return /* @__PURE__ */ jsxRuntime.jsxs(
1892
- "goa-tab",
3754
+ "goa-popover",
1893
3755
  {
1894
- slug,
1895
- disabled: disabled ? "true" : void 0,
1896
- heading: typeof heading === "string" ? heading : void 0,
3756
+ padded: typeof padded === "undefined" ? void 0 : padded ? "true" : "false",
3757
+ relative: relative ? "true" : void 0,
3758
+ ..._props,
1897
3759
  children: [
1898
- typeof heading !== "string" && /* @__PURE__ */ jsxRuntime.jsx("span", { slot: "heading", children: heading }),
1899
- children
3760
+ children,
3761
+ target && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "target", children: target })
1900
3762
  ]
1901
3763
  }
1902
3764
  );
1903
3765
  }
1904
- const GoabTemporaryNotificationCtrl = ({
1905
- verticalPosition = "bottom",
1906
- horizontalPosition = "center",
3766
+ function GoabPushDrawer({
3767
+ open,
3768
+ heading,
3769
+ width,
1907
3770
  testId,
1908
- ...rest
1909
- }) => {
1910
- const el = react.useRef(null);
1911
- const _props = parseISO.transformProps(
1912
- { "vertical-position": verticalPosition, "horizontal-position": horizontalPosition, ...rest },
1913
- parseISO.kebab
1914
- );
1915
- return /* @__PURE__ */ jsxRuntime.jsx(
1916
- "goa-temp-notification-ctrl",
1917
- {
1918
- ref: el,
1919
- ..._props,
1920
- testid: testId
1921
- }
1922
- );
1923
- };
1924
- function GoabText({
1925
- as,
1926
- tag,
3771
+ actions,
1927
3772
  children,
1928
- ...rest
1929
- }) {
1930
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
1931
- return /* @__PURE__ */ jsxRuntime.jsx(
1932
- "goa-text",
1933
- {
1934
- as: tag || as,
1935
- ..._props,
1936
- children
1937
- }
1938
- );
1939
- }
1940
- function GoabTextArea({
1941
- readOnly,
1942
- disabled,
1943
- error,
1944
- onChange,
1945
- onKeyPress,
1946
- onBlur,
1947
- ...rest
3773
+ onClose
1948
3774
  }) {
1949
3775
  const el = react.useRef(null);
1950
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
1951
3776
  react.useEffect(() => {
1952
- if (!el.current) {
3777
+ var _a;
3778
+ if (!(el == null ? void 0 : el.current) || !onClose) {
1953
3779
  return;
1954
3780
  }
1955
- const current = el.current;
1956
- const changeListener = (e) => {
1957
- const detail = e.detail;
1958
- onChange == null ? void 0 : onChange({ ...detail, event: e });
1959
- };
1960
- const keypressListener = (e) => {
1961
- const detail = e.detail;
1962
- onKeyPress == null ? void 0 : onKeyPress({ ...detail, event: e });
1963
- };
1964
- const blurListener = (e) => {
1965
- const detail = e.detail;
1966
- onBlur == null ? void 0 : onBlur({ ...detail, event: e });
1967
- };
1968
- current.addEventListener("_change", changeListener);
1969
- current.addEventListener("_keyPress", keypressListener);
1970
- current.addEventListener("_blur", blurListener);
3781
+ (_a = el.current) == null ? void 0 : _a.addEventListener("_close", onClose);
1971
3782
  return () => {
1972
- current.removeEventListener("_change", changeListener);
1973
- current.removeEventListener("_keyPress", keypressListener);
1974
- current.removeEventListener("_blur", blurListener);
3783
+ var _a2;
3784
+ (_a2 = el.current) == null ? void 0 : _a2.removeEventListener("_close", onClose);
1975
3785
  };
1976
- }, [el, onChange, onKeyPress, onBlur]);
1977
- return /* @__PURE__ */ jsxRuntime.jsx(
1978
- "goa-textarea",
1979
- {
1980
- ref: el,
1981
- readOnly: readOnly ? "true" : void 0,
1982
- disabled: disabled ? "true" : void 0,
1983
- error: error ? "true" : void 0,
1984
- ..._props
1985
- }
1986
- );
1987
- }
1988
- function GoabThreeColumnLayout(props) {
3786
+ }, [el, onClose]);
1989
3787
  return /* @__PURE__ */ jsxRuntime.jsxs(
1990
- "goa-three-column-layout",
3788
+ "goa-push-drawer",
1991
3789
  {
1992
- leftcolumnwidth: props.leftColumnWidth,
1993
- rightcolumnwidth: props.rightColumnWidth,
1994
- maxcontentwidth: props.maxContentWidth,
3790
+ ref: el,
3791
+ open: open ? true : void 0,
3792
+ heading: typeof heading === "string" ? heading : void 0,
3793
+ width,
3794
+ testid: testId,
3795
+ version: "2",
1995
3796
  children: [
1996
- props.header && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "header", children: props.header }),
1997
- props.nav && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "nav", children: props.nav }),
1998
- props.sidebar && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "side-menu", children: props.sidebar }),
1999
- props.sideMenu && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "side-menu", children: props.sideMenu }),
2000
- props.children,
2001
- props.footer && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "footer", children: props.footer })
3797
+ heading && typeof heading !== "string" && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "heading", children: heading }),
3798
+ actions && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "actions", children: actions }),
3799
+ children
2002
3800
  ]
2003
3801
  }
2004
3802
  );
2005
3803
  }
2006
- function GoabTooltip({
2007
- content,
3804
+ function GoabRadioItem({
3805
+ name,
3806
+ label,
3807
+ value,
3808
+ description,
3809
+ reveal,
3810
+ revealAriaLabel,
3811
+ maxWidth,
3812
+ disabled,
3813
+ checked,
3814
+ error,
3815
+ compact,
3816
+ ariaLabel,
2008
3817
  children,
2009
- ...rest
3818
+ mt,
3819
+ mr,
3820
+ mb,
3821
+ ml
2010
3822
  }) {
2011
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
2012
- const isStringContent = typeof content === "string";
2013
3823
  return /* @__PURE__ */ jsxRuntime.jsxs(
2014
- "goa-tooltip",
3824
+ "goa-radio-item",
2015
3825
  {
2016
- content: isStringContent ? content : void 0,
2017
- ..._props,
3826
+ name,
3827
+ label,
3828
+ value,
3829
+ description: typeof description === "string" ? description : void 0,
3830
+ maxwidth: maxWidth,
3831
+ error: error ? "true" : void 0,
3832
+ disabled: disabled ? "true" : void 0,
3833
+ checked: checked ? "true" : void 0,
3834
+ compact: compact ? "true" : void 0,
3835
+ arialabel: ariaLabel,
3836
+ revealarialabel: revealAriaLabel,
3837
+ mt,
3838
+ mr,
3839
+ mb,
3840
+ ml,
3841
+ version: "2",
2018
3842
  children: [
2019
- !isStringContent && content && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "content", children: content }),
3843
+ description && typeof description !== "string" && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "description", children: description }),
3844
+ reveal && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "reveal", children: reveal }),
2020
3845
  children
2021
3846
  ]
2022
3847
  }
2023
3848
  );
2024
3849
  }
2025
- function GoabTwoColumnLayout(props) {
2026
- return /* @__PURE__ */ jsxRuntime.jsxs(
2027
- "goa-two-column-layout",
2028
- {
2029
- navcolumnwidth: props.navColumnWidth,
2030
- maxcontentwidth: props.maxContentWidth,
2031
- children: [
2032
- props.header && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "header", children: props.header }),
2033
- props.nav && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "nav", children: props.nav }),
2034
- props.children,
2035
- props.footer && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "footer", children: props.footer })
2036
- ]
2037
- }
2038
- );
2039
- }
2040
- const GoabFilterChip = ({
2041
- iconTheme = "outline",
3850
+ function GoabRadioGroup({
3851
+ disabled,
2042
3852
  error,
2043
- onClick,
3853
+ onChange,
3854
+ name,
3855
+ children,
3856
+ size = "default",
2044
3857
  ...rest
2045
- }) => {
3858
+ }) {
2046
3859
  const el = react.useRef(null);
2047
- const _props = parseISO.transformProps(
2048
- { icontheme: iconTheme, ...rest },
2049
- parseISO.lowercase
2050
- );
3860
+ const _props = transformProps({ size, ...rest }, lowercase);
2051
3861
  react.useEffect(() => {
2052
3862
  if (!el.current) return;
2053
- if (!onClick) return;
2054
- const current = el.current;
2055
- current.addEventListener("_click", onClick);
3863
+ const listener = (e) => {
3864
+ const detail = e.detail;
3865
+ onChange == null ? void 0 : onChange({ ...detail, event: e });
3866
+ };
3867
+ const currentEl = el.current;
3868
+ if (onChange) {
3869
+ currentEl.addEventListener("_change", listener);
3870
+ }
2056
3871
  return () => {
2057
- current.removeEventListener("_click", onClick);
3872
+ if (onChange) {
3873
+ currentEl.removeEventListener("_change", listener);
3874
+ }
2058
3875
  };
2059
- }, [el, onClick]);
3876
+ }, [name, onChange]);
2060
3877
  return /* @__PURE__ */ jsxRuntime.jsx(
2061
- "goa-filter-chip",
3878
+ "goa-radio-group",
2062
3879
  {
2063
3880
  ref: el,
3881
+ ..._props,
3882
+ name,
3883
+ disabled: disabled ? "true" : void 0,
2064
3884
  error: error ? "true" : void 0,
2065
- ..._props
3885
+ version: "2",
3886
+ children
2066
3887
  }
2067
3888
  );
2068
- };
2069
- function dispatch(el, eventName, detail, opts) {
2070
- if (!el) {
2071
- console.error("dispatch element is null");
2072
- return;
2073
- }
2074
- el.dispatchEvent(
2075
- new CustomEvent(eventName, {
2076
- composed: true,
2077
- bubbles: opts == null ? void 0 : opts.bubbles,
2078
- detail
2079
- })
2080
- );
2081
3889
  }
2082
- function relay(el, eventName, data, opts) {
2083
- if (!el) {
2084
- console.error("dispatch element is null");
2085
- return;
2086
- }
2087
- el.dispatchEvent(
2088
- new CustomEvent("msg", {
2089
- composed: true,
2090
- bubbles: opts == null ? void 0 : opts.bubbles,
2091
- detail: {
2092
- action: eventName,
2093
- data
2094
- }
2095
- })
3890
+ function GoabSideMenuGroup({
3891
+ heading,
3892
+ icon,
3893
+ testId,
3894
+ children,
3895
+ mt,
3896
+ mr,
3897
+ mb,
3898
+ ml
3899
+ }) {
3900
+ return /* @__PURE__ */ jsxRuntime.jsx(
3901
+ "goa-side-menu-group",
3902
+ {
3903
+ heading,
3904
+ icon,
3905
+ testid: testId,
3906
+ mt,
3907
+ mr,
3908
+ mb,
3909
+ ml,
3910
+ version: "2",
3911
+ children
3912
+ }
2096
3913
  );
2097
3914
  }
2098
- class PublicFormController {
2099
- constructor(type) {
2100
- __privateAdd(this, _PublicFormController_instances);
2101
- __publicField(this, "state");
2102
- __publicField(this, "_formData");
2103
- __publicField(this, "_formRef");
2104
- __publicField(this, "_isCompleting", false);
2105
- this.type = type;
2106
- }
2107
- // Obtain reference to the form element
2108
- init(e) {
2109
- if (this._formRef) {
2110
- console.warn("init: form element has already been set");
2111
- return;
2112
- }
2113
- this._formRef = e.detail.el;
2114
- this.state = {
2115
- uuid: crypto.randomUUID(),
2116
- form: {},
2117
- history: [],
2118
- editting: "",
2119
- status: "not-started"
2120
- };
2121
- }
2122
- initList(e) {
2123
- this._formRef = e.detail.el;
2124
- this.state = [];
2125
- }
2126
- // Public method to allow for the initialization of the state
2127
- initState(state, callback) {
2128
- relay(this._formRef, "external::init:state", state);
2129
- if (typeof state === "string") {
2130
- this.state = JSON.parse(state);
2131
- } else if (!Array.isArray(state)) {
2132
- this.state = state;
2133
- }
2134
- if (callback) {
2135
- setTimeout(callback, 200);
2136
- }
2137
- }
2138
- updateListState(e) {
2139
- const detail = e.detail;
2140
- if (!Array.isArray(detail.data)) {
2141
- return;
2142
- }
2143
- this.state = detail.data;
2144
- }
2145
- updateObjectState(e) {
2146
- var _a, _b;
2147
- if (Array.isArray(this.state)) {
2148
- return;
2149
- }
2150
- const detail = e.detail;
2151
- if (detail.type === "list") {
2152
- this.state = {
2153
- ...this.state,
2154
- form: { ...((_a = this.state) == null ? void 0 : _a.form) || {}, [detail.id]: detail.data }
2155
- };
2156
- } else {
2157
- this.state = {
2158
- ...this.state,
2159
- ...detail.data,
2160
- form: { ...((_b = this.state) == null ? void 0 : _b.form) || {}, ...detail.data.form },
2161
- history: detail.data.history
2162
- };
2163
- }
2164
- }
2165
- getStateList() {
2166
- if (!this.state) {
2167
- return [];
2168
- }
2169
- if (!Array.isArray(this.state)) {
2170
- console.warn(
2171
- "Utils:getStateList: unable to update the state of a non-multi form type",
2172
- this.state
2173
- );
2174
- return [];
2175
- }
2176
- if (this.state.length === 0) {
2177
- return [];
2178
- }
2179
- return this.state.map((s) => {
2180
- return Object.values(s.form).filter((item) => {
2181
- var _a;
2182
- return ((_a = item == null ? void 0 : item.data) == null ? void 0 : _a.type) === "details";
2183
- }).map((item) => {
2184
- var _a;
2185
- return item.data.type === "details" && ((_a = item.data) == null ? void 0 : _a.fieldsets) || {};
2186
- }).reduce(
2187
- (acc, item) => {
2188
- for (const [key, value] of Object.entries(item)) {
2189
- acc[key] = value.value;
2190
- }
2191
- return acc;
2192
- },
2193
- {}
2194
- );
2195
- });
2196
- }
2197
- // getStateItems(group: string): Record<string, FieldsetItemState>[] {
2198
- // if (Array.isArray(this.state)) {
2199
- // console.error(
2200
- // "Utils:getStateItems: unable to update the state of a multi form type",
2201
- // );
2202
- // return [];
2203
- // }
2204
- // if (!this.state) {
2205
- // console.error("Utils:getStateItems: state has not yet been set");
2206
- // return [];
2207
- // }
2208
- //
2209
- // const data = this.state.form[group].data;
2210
- // if (data.type !== "list") {
2211
- // return [];
2212
- // }
2213
- //
2214
- // return data.items.;
2215
- // }
2216
- // Public method to allow for the retrieval of the state value
2217
- getStateValue(group, key) {
2218
- if (Array.isArray(this.state)) {
2219
- console.error("getStateValue: unable to update the state of a multi form type");
2220
- return "";
3915
+ function GoabSideMenuHeading({ meta, testId, icon, children }) {
3916
+ return /* @__PURE__ */ jsxRuntime.jsxs("goa-side-menu-heading", { icon, testid: testId, version: "2", children: [
3917
+ children,
3918
+ meta && /* @__PURE__ */ jsxRuntime.jsx("span", { slot: "meta", children: meta })
3919
+ ] });
3920
+ }
3921
+ function GoabSideMenu({ testId, children }) {
3922
+ return /* @__PURE__ */ jsxRuntime.jsx("goa-side-menu", { testid: testId, version: "2", children });
3923
+ }
3924
+ const GoabSkeleton = ({
3925
+ maxWidth,
3926
+ size,
3927
+ lineCount,
3928
+ type,
3929
+ testId,
3930
+ mt,
3931
+ mr,
3932
+ mb,
3933
+ ml
3934
+ }) => {
3935
+ return /* @__PURE__ */ jsxRuntime.jsx(
3936
+ "goa-skeleton",
3937
+ {
3938
+ maxwidth: maxWidth,
3939
+ linecount: lineCount,
3940
+ type,
3941
+ size,
3942
+ mt,
3943
+ mr,
3944
+ mb,
3945
+ ml,
3946
+ testid: testId
2221
3947
  }
2222
- if (!this.state) {
2223
- console.error("getStateValue: state has not yet been set");
2224
- return "";
3948
+ );
3949
+ };
3950
+ function GoabSpacer(props) {
3951
+ return /* @__PURE__ */ jsxRuntime.jsx(
3952
+ "goa-spacer",
3953
+ {
3954
+ hspacing: props.hSpacing,
3955
+ vspacing: props.vSpacing,
3956
+ testid: props.testId
2225
3957
  }
2226
- const data = this.state.form[group].data;
2227
- if (data.type !== "details") {
2228
- return "";
3958
+ );
3959
+ }
3960
+ function GoabSpinner({
3961
+ type,
3962
+ size,
3963
+ progress,
3964
+ invert,
3965
+ testId
3966
+ }) {
3967
+ return /* @__PURE__ */ jsxRuntime.jsx(
3968
+ "goa-spinner",
3969
+ {
3970
+ type,
3971
+ size,
3972
+ progress,
3973
+ invert: invert ? "true" : void 0,
3974
+ testid: testId
2229
3975
  }
2230
- return data.fieldsets[key].value;
2231
- }
2232
- // Public method to allow for the continuing to the next page
2233
- continueTo(next) {
2234
- if (!next) {
2235
- console.error("continueTo [name] is undefined");
3976
+ );
3977
+ }
3978
+ function GoabTable({ onSort, onMultiSort, sortMode, ...props }) {
3979
+ const ref = react.useRef(null);
3980
+ react.useEffect(() => {
3981
+ if (!ref.current) {
2236
3982
  return;
2237
3983
  }
2238
- relay(this._formRef, "external::continue", { next });
2239
- }
2240
- // Public method to perform validation and send the appropriate messages to the form elements
2241
- validate(e, field, validators, options) {
2242
- var _a;
2243
- const { el, state, cancelled } = e.detail;
2244
- const value = (_a = state == null ? void 0 : state[field]) == null ? void 0 : _a.value;
2245
- window.scrollTo({ top: 0, behavior: "smooth" });
2246
- if (cancelled) {
2247
- return [true, value];
3984
+ const current = ref.current;
3985
+ const sortListener = (e) => {
3986
+ const detail = e.detail;
3987
+ onSort == null ? void 0 : onSort(detail);
3988
+ };
3989
+ const multiSortListener = (e) => {
3990
+ const detail = e.detail;
3991
+ onMultiSort == null ? void 0 : onMultiSort(detail);
3992
+ };
3993
+ current.addEventListener("_sort", sortListener);
3994
+ current.addEventListener("_multisort", multiSortListener);
3995
+ return () => {
3996
+ current.removeEventListener("_sort", sortListener);
3997
+ current.removeEventListener("_multisort", multiSortListener);
3998
+ };
3999
+ }, [ref, onSort, onMultiSort]);
4000
+ return /* @__PURE__ */ jsxRuntime.jsx(
4001
+ "goa-table",
4002
+ {
4003
+ ref,
4004
+ width: props.width,
4005
+ variant: props.variant,
4006
+ "sort-mode": sortMode,
4007
+ striped: props.striped ? "true" : void 0,
4008
+ testid: props.testId,
4009
+ mt: props.mt,
4010
+ mb: props.mb,
4011
+ ml: props.ml,
4012
+ mr: props.mr,
4013
+ version: "2",
4014
+ children: /* @__PURE__ */ jsxRuntime.jsx("table", { style: { width: "100%" }, children: props.children })
2248
4015
  }
2249
- for (const validator of validators) {
2250
- const msg = validator(value);
2251
- __privateMethod(this, _PublicFormController_instances, dispatchError_fn).call(this, el, field, msg, options);
2252
- if (msg) {
2253
- return [false, ""];
2254
- }
4016
+ );
4017
+ }
4018
+ function GoabTableSortHeader({
4019
+ name,
4020
+ direction = "none",
4021
+ sortOrder,
4022
+ children,
4023
+ ...rest
4024
+ }) {
4025
+ return /* @__PURE__ */ jsxRuntime.jsx("goa-table-sort-header", { name, direction, "sort-order": sortOrder, ...rest, children });
4026
+ }
4027
+ function GoabTabs({
4028
+ initialTab,
4029
+ children,
4030
+ testId,
4031
+ onChange,
4032
+ variant,
4033
+ orientation,
4034
+ navigation
4035
+ }) {
4036
+ const ref = react.useRef(null);
4037
+ react.useEffect(() => {
4038
+ const element = ref.current;
4039
+ if (element && onChange) {
4040
+ const handler = (event) => {
4041
+ const detail = event.detail;
4042
+ onChange(detail);
4043
+ };
4044
+ element.addEventListener("_change", handler);
4045
+ return () => {
4046
+ element.removeEventListener("_change", handler);
4047
+ };
2255
4048
  }
2256
- return [true, value];
2257
- }
2258
- /**
2259
- * Validates a group of fields ensuring that at least `minPassCount` of the items within the group
2260
- * passes. This is useful in the scenario when n number fields are required out of n+m number of fields.
2261
- *
2262
- * @param {string[]} fields - An array of field names to be validated.
2263
- * @param {Event} e - The event object associated with the validation trigger.
2264
- * @param {FieldValidator[]} validators - An array of validator functions to apply to the fields.
2265
- * @return {[number, Record<string, boolean>]} - Returns back the number of fields that passed and a record of the fields and their pass status.
2266
- */
2267
- validateGroup(e, fields, validators) {
2268
- let passCount = 0;
2269
- const validGroups = {};
2270
- for (const field of fields) {
2271
- const [_valid] = this.validate(e, field, validators, { grouped: true });
2272
- if (_valid) {
2273
- validGroups[field] = true;
2274
- passCount++;
2275
- }
4049
+ }, [onChange]);
4050
+ return /* @__PURE__ */ jsxRuntime.jsx(
4051
+ "goa-tabs",
4052
+ {
4053
+ ref,
4054
+ initialtab: initialTab,
4055
+ testid: testId,
4056
+ variant,
4057
+ version: "2",
4058
+ orientation,
4059
+ navigation,
4060
+ children
2276
4061
  }
2277
- return [passCount, validGroups];
2278
- }
2279
- edit(index) {
2280
- relay(this._formRef, "external::alter:state", { index, operation: "edit" });
2281
- }
2282
- remove(index) {
2283
- relay(this._formRef, "external::alter:state", {
2284
- index,
2285
- operation: "remove"
2286
- });
2287
- }
2288
- /**
2289
- * Completes the form and triggers the onComplete callback.
2290
- * This method should be used when you want to complete a form without navigating to a summary page.
2291
- *
2292
- * @important Developers must validate the form before calling this method.
2293
- *
2294
- * @example
2295
- * // Validate first, then complete
2296
- * const [isValid] = this.validate(e, "firstName", [
2297
- * requiredValidator("First name is required.")
2298
- * ]);
2299
- * if (isValid) {
2300
- * this.complete();
2301
- * }
2302
- * @returns void
2303
- */
2304
- complete() {
2305
- if (!this._formRef) {
2306
- console.error("complete: form ref is not set");
2307
- return;
4062
+ );
4063
+ }
4064
+ function GoabTab({ heading, disabled, slug, children }) {
4065
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4066
+ "goa-tab",
4067
+ {
4068
+ slug,
4069
+ disabled: disabled ? "true" : void 0,
4070
+ heading: typeof heading === "string" ? heading : void 0,
4071
+ children: [
4072
+ typeof heading !== "string" && /* @__PURE__ */ jsxRuntime.jsx("span", { slot: "heading", children: heading }),
4073
+ children
4074
+ ]
2308
4075
  }
2309
- if (this._isCompleting) {
2310
- console.warn("complete: completion already in progress");
2311
- return;
4076
+ );
4077
+ }
4078
+ const GoabTemporaryNotificationCtrl = ({
4079
+ verticalPosition = "bottom",
4080
+ horizontalPosition = "center",
4081
+ testId,
4082
+ ...rest
4083
+ }) => {
4084
+ const el = react.useRef(null);
4085
+ const _props = transformProps(
4086
+ { "vertical-position": verticalPosition, "horizontal-position": horizontalPosition, ...rest },
4087
+ kebab
4088
+ );
4089
+ return /* @__PURE__ */ jsxRuntime.jsx(
4090
+ "goa-temp-notification-ctrl",
4091
+ {
4092
+ ref: el,
4093
+ ..._props,
4094
+ testid: testId
2312
4095
  }
2313
- this._isCompleting = true;
2314
- relay(this._formRef, "fieldset::submit", null, { bubbles: true });
2315
- this._isCompleting = false;
2316
- }
2317
- /**
2318
- * Completes a subform and returns control to the parent form.
2319
- * This method should be used when working with subforms that need to complete without a summary page.
2320
- *
2321
- * @important Developers must validate the subform before calling this method.
2322
- *
2323
- * @example
2324
- * // Validate first, then complete the subform
2325
- * const [isValid] = this._childFormController.validate(e, "fullName", [
2326
- * requiredValidator("Please enter the dependent's full name.")
2327
- * ]);
2328
- * if (isValid) {
2329
- * this._childFormController.completeSubform();
2330
- * }
2331
- * @returns void
2332
- */
2333
- completeSubform() {
2334
- if (!this._formRef) {
2335
- console.error("completeSubform: form ref is not set");
2336
- return;
4096
+ );
4097
+ };
4098
+ function GoabText({
4099
+ as,
4100
+ tag,
4101
+ children,
4102
+ ...rest
4103
+ }) {
4104
+ const _props = transformProps(rest, lowercase);
4105
+ return /* @__PURE__ */ jsxRuntime.jsx(
4106
+ "goa-text",
4107
+ {
4108
+ as: tag || as,
4109
+ ..._props,
4110
+ children
2337
4111
  }
2338
- if (this._isCompleting) {
2339
- console.warn("completeSubform: completion already in progress");
4112
+ );
4113
+ }
4114
+ function GoabTextArea({
4115
+ readOnly,
4116
+ disabled,
4117
+ error,
4118
+ onChange,
4119
+ onKeyPress,
4120
+ onBlur,
4121
+ ...rest
4122
+ }) {
4123
+ const el = react.useRef(null);
4124
+ const _props = transformProps(rest, lowercase);
4125
+ react.useEffect(() => {
4126
+ if (!el.current) {
2340
4127
  return;
2341
4128
  }
2342
- const formRef = this._formRef;
2343
- this._isCompleting = true;
2344
- const stateChangeHandler = (e) => {
2345
- formRef.removeEventListener("_stateChange", stateChangeHandler);
2346
- dispatch(formRef, "_complete", {}, { bubbles: true });
2347
- this._isCompleting = false;
4129
+ const current = el.current;
4130
+ const changeListener = (e) => {
4131
+ const detail = e.detail;
4132
+ onChange == null ? void 0 : onChange({ ...detail, event: e });
2348
4133
  };
2349
- formRef.addEventListener("_stateChange", stateChangeHandler);
2350
- dispatch(formRef, "_continue", null, { bubbles: true });
2351
- }
2352
- // removes any data collected that doesn't correspond with the final history path
2353
- clean(data) {
2354
- return data.history.reduce((acc, fieldsetId) => {
2355
- acc[fieldsetId] = data.form[fieldsetId];
2356
- return acc;
2357
- }, {});
2358
- }
4134
+ const keypressListener = (e) => {
4135
+ const detail = e.detail;
4136
+ onKeyPress == null ? void 0 : onKeyPress({ ...detail, event: e });
4137
+ };
4138
+ const blurListener = (e) => {
4139
+ const detail = e.detail;
4140
+ onBlur == null ? void 0 : onBlur({ ...detail, event: e });
4141
+ };
4142
+ current.addEventListener("_change", changeListener);
4143
+ current.addEventListener("_keyPress", keypressListener);
4144
+ current.addEventListener("_blur", blurListener);
4145
+ return () => {
4146
+ current.removeEventListener("_change", changeListener);
4147
+ current.removeEventListener("_keyPress", keypressListener);
4148
+ current.removeEventListener("_blur", blurListener);
4149
+ };
4150
+ }, [el, onChange, onKeyPress, onBlur]);
4151
+ return /* @__PURE__ */ jsxRuntime.jsx(
4152
+ "goa-textarea",
4153
+ {
4154
+ ref: el,
4155
+ readOnly: readOnly ? "true" : void 0,
4156
+ disabled: disabled ? "true" : void 0,
4157
+ error: error ? "true" : void 0,
4158
+ version: "2",
4159
+ ..._props
4160
+ }
4161
+ );
2359
4162
  }
2360
- _PublicFormController_instances = new WeakSet();
2361
- updateObjectListState_fn = function(detail) {
2362
- var _a;
2363
- if (!Array.isArray(detail.data)) {
2364
- return;
2365
- }
2366
- if (Array.isArray(this.state)) {
2367
- return;
2368
- }
2369
- this.state = {
2370
- ...this.state,
2371
- form: {
2372
- ...((_a = this.state) == null ? void 0 : _a.form) || {},
2373
- [detail.id]: detail.data
4163
+ function GoabThreeColumnLayout(props) {
4164
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4165
+ "goa-three-column-layout",
4166
+ {
4167
+ leftcolumnwidth: props.leftColumnWidth,
4168
+ rightcolumnwidth: props.rightColumnWidth,
4169
+ maxcontentwidth: props.maxContentWidth,
4170
+ children: [
4171
+ props.header && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "header", children: props.header }),
4172
+ props.nav && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "nav", children: props.nav }),
4173
+ props.sidebar && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "side-menu", children: props.sidebar }),
4174
+ props.sideMenu && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "side-menu", children: props.sideMenu }),
4175
+ props.children,
4176
+ props.footer && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "footer", children: props.footer })
4177
+ ]
4178
+ }
4179
+ );
4180
+ }
4181
+ function GoabTooltip({
4182
+ content,
4183
+ children,
4184
+ ...rest
4185
+ }) {
4186
+ const _props = transformProps(rest, lowercase);
4187
+ const isStringContent = typeof content === "string";
4188
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4189
+ "goa-tooltip",
4190
+ {
4191
+ content: isStringContent ? content : void 0,
4192
+ ..._props,
4193
+ children: [
4194
+ !isStringContent && content && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "content", children: content }),
4195
+ children
4196
+ ]
4197
+ }
4198
+ );
4199
+ }
4200
+ function GoabTwoColumnLayout(props) {
4201
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4202
+ "goa-two-column-layout",
4203
+ {
4204
+ navcolumnwidth: props.navColumnWidth,
4205
+ maxcontentwidth: props.maxContentWidth,
4206
+ children: [
4207
+ props.header && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "header", children: props.header }),
4208
+ props.nav && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "nav", children: props.nav }),
4209
+ props.children,
4210
+ props.footer && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "footer", children: props.footer })
4211
+ ]
4212
+ }
4213
+ );
4214
+ }
4215
+ const GoabFilterChip = ({
4216
+ iconTheme = "outline",
4217
+ error,
4218
+ onClick,
4219
+ ...rest
4220
+ }) => {
4221
+ const el = react.useRef(null);
4222
+ const _props = transformProps({ icontheme: iconTheme, ...rest }, lowercase);
4223
+ react.useEffect(() => {
4224
+ if (!el.current) return;
4225
+ if (!onClick) return;
4226
+ const current = el.current;
4227
+ current.addEventListener("_click", onClick);
4228
+ return () => {
4229
+ current.removeEventListener("_click", onClick);
4230
+ };
4231
+ }, [el, onClick]);
4232
+ return /* @__PURE__ */ jsxRuntime.jsx(
4233
+ "goa-filter-chip",
4234
+ {
4235
+ ref: el,
4236
+ error: error ? "true" : void 0,
4237
+ version: "2",
4238
+ ..._props
2374
4239
  }
2375
- };
2376
- };
2377
- // Private method to dispatch the error message to the form element
2378
- dispatchError_fn = function(el, name, msg, options) {
2379
- el.dispatchEvent(
2380
- new CustomEvent("msg", {
2381
- composed: true,
2382
- detail: {
2383
- action: "external::set:error",
2384
- data: {
2385
- name,
2386
- msg,
2387
- grouped: options == null ? void 0 : options.grouped
2388
- }
2389
- }
2390
- })
2391
4240
  );
2392
4241
  };
2393
4242
  function usePublicFormController(type = "details") {
@@ -2472,6 +4321,166 @@ function usePublicFormController(type = "details") {
2472
4321
  controller: controllerRef.current
2473
4322
  };
2474
4323
  }
4324
+ function GoabWorkSideMenu({
4325
+ heading,
4326
+ url,
4327
+ userName,
4328
+ userSecondaryText,
4329
+ testId,
4330
+ primaryContent,
4331
+ secondaryContent,
4332
+ accountContent,
4333
+ open,
4334
+ onToggle,
4335
+ onNavigate
4336
+ }) {
4337
+ const el = react.useRef(null);
4338
+ react.useEffect(() => {
4339
+ var _a;
4340
+ if (!(el == null ? void 0 : el.current) || !onToggle) {
4341
+ return;
4342
+ }
4343
+ (_a = el.current) == null ? void 0 : _a.addEventListener("_toggle", onToggle);
4344
+ return () => {
4345
+ var _a2;
4346
+ (_a2 = el.current) == null ? void 0 : _a2.removeEventListener("_toggle", onToggle);
4347
+ };
4348
+ }, [el, onToggle]);
4349
+ react.useEffect(() => {
4350
+ var _a;
4351
+ if (!(el == null ? void 0 : el.current) || !onNavigate) {
4352
+ return;
4353
+ }
4354
+ const handler = (e) => {
4355
+ onNavigate(e.detail.url);
4356
+ };
4357
+ (_a = el.current) == null ? void 0 : _a.addEventListener("_navigate", handler);
4358
+ return () => {
4359
+ var _a2;
4360
+ (_a2 = el.current) == null ? void 0 : _a2.removeEventListener("_navigate", handler);
4361
+ };
4362
+ }, [el, onNavigate]);
4363
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4364
+ "goa-work-side-menu",
4365
+ {
4366
+ ref: el,
4367
+ heading,
4368
+ url,
4369
+ "user-name": userName,
4370
+ "user-secondary-text": userSecondaryText,
4371
+ open: open ? true : false,
4372
+ testid: testId,
4373
+ children: [
4374
+ primaryContent && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "primary", children: primaryContent }),
4375
+ secondaryContent && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "secondary", children: secondaryContent }),
4376
+ accountContent && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "account", children: accountContent })
4377
+ ]
4378
+ }
4379
+ );
4380
+ }
4381
+ function GoabWorkSideMenuGroup(props) {
4382
+ return /* @__PURE__ */ jsxRuntime.jsx(
4383
+ "goa-work-side-menu-group",
4384
+ {
4385
+ heading: props.heading,
4386
+ icon: props.icon,
4387
+ open: props.open ? true : void 0,
4388
+ testid: props.testId,
4389
+ children: props.children
4390
+ }
4391
+ );
4392
+ }
4393
+ function GoabWorkSideMenuItem(props) {
4394
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4395
+ "goa-work-side-menu-item",
4396
+ {
4397
+ label: props.label,
4398
+ url: props.url,
4399
+ badge: props.badge,
4400
+ current: props.current ? "true" : void 0,
4401
+ divider: props.divider ? "true" : void 0,
4402
+ icon: props.icon,
4403
+ testid: props.testId,
4404
+ type: props.type,
4405
+ children: [
4406
+ props.popoverContent && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "popoverContent", children: props.popoverContent }),
4407
+ props.children
4408
+ ]
4409
+ }
4410
+ );
4411
+ }
4412
+ function GoabWorkSideNotificationItem({
4413
+ type,
4414
+ timestamp,
4415
+ title,
4416
+ description,
4417
+ readStatus,
4418
+ priority,
4419
+ testId,
4420
+ onClick
4421
+ }) {
4422
+ const el = react.useRef(null);
4423
+ react.useEffect(() => {
4424
+ if (!el.current) return;
4425
+ const handleClick = () => {
4426
+ onClick == null ? void 0 : onClick();
4427
+ };
4428
+ el.current.addEventListener("_click", handleClick);
4429
+ return () => {
4430
+ var _a;
4431
+ (_a = el.current) == null ? void 0 : _a.removeEventListener("_click", handleClick);
4432
+ };
4433
+ }, [el, onClick]);
4434
+ return /* @__PURE__ */ jsxRuntime.jsx(
4435
+ "goa-work-side-notification-item",
4436
+ {
4437
+ ref: el,
4438
+ type,
4439
+ timestamp,
4440
+ title,
4441
+ description,
4442
+ "read-status": readStatus,
4443
+ priority,
4444
+ testid: testId
4445
+ }
4446
+ );
4447
+ }
4448
+ function GoabWorkSideNotificationPanel({
4449
+ heading,
4450
+ activeTab,
4451
+ testId,
4452
+ children,
4453
+ onMarkAllRead,
4454
+ onViewAll
4455
+ }) {
4456
+ const el = react.useRef(null);
4457
+ react.useEffect(() => {
4458
+ if (!el.current) return;
4459
+ const handleMarkAllRead = () => {
4460
+ onMarkAllRead == null ? void 0 : onMarkAllRead();
4461
+ };
4462
+ const handleViewAll = () => {
4463
+ onViewAll == null ? void 0 : onViewAll();
4464
+ };
4465
+ el.current.addEventListener("_markAllRead", handleMarkAllRead);
4466
+ el.current.addEventListener("_viewAll", handleViewAll);
4467
+ return () => {
4468
+ var _a, _b;
4469
+ (_a = el.current) == null ? void 0 : _a.removeEventListener("_markAllRead", handleMarkAllRead);
4470
+ (_b = el.current) == null ? void 0 : _b.removeEventListener("_viewAll", handleViewAll);
4471
+ };
4472
+ }, [el, onMarkAllRead, onViewAll]);
4473
+ return /* @__PURE__ */ jsxRuntime.jsx(
4474
+ "goa-work-side-notification-panel",
4475
+ {
4476
+ ref: el,
4477
+ heading,
4478
+ "active-tab": activeTab,
4479
+ testid: testId,
4480
+ children
4481
+ }
4482
+ );
4483
+ }
2475
4484
  exports.GoALinkButton = GoALinkButton;
2476
4485
  exports.GoabAccordion = GoabAccordion;
2477
4486
  exports.GoabAppFooter = GoabAppFooter;
@@ -2498,7 +4507,6 @@ exports.GoabDrawer = GoabDrawer;
2498
4507
  exports.GoabDropdown = GoabDropdown;
2499
4508
  exports.GoabDropdownItem = GoabDropdownItem;
2500
4509
  exports.GoabDropdownOption = GoabDropdownOption;
2501
- exports.GoabEmergencyBadge = GoabEmergencyBadge;
2502
4510
  exports.GoabFieldset = GoabFieldset;
2503
4511
  exports.GoabFileUploadCard = GoabFileUploadCard;
2504
4512
  exports.GoabFileUploadInput = GoabFileUploadInput;
@@ -2511,8 +4519,6 @@ exports.GoabHeroBanner = GoabHeroBanner;
2511
4519
  exports.GoabHeroBannerActions = GoabHeroBannerActions;
2512
4520
  exports.GoabIcon = GoabIcon;
2513
4521
  exports.GoabIconButton = GoabIconButton;
2514
- exports.GoabImportantBadge = GoabImportantBadge;
2515
- exports.GoabInfoBadge = GoabInfoBadge;
2516
4522
  exports.GoabInput = GoabInput;
2517
4523
  exports.GoabInputDate = GoabInputDate;
2518
4524
  exports.GoabInputDateTime = GoabInputDateTime;
@@ -2555,7 +4561,6 @@ exports.GoabSideMenuHeading = GoabSideMenuHeading;
2555
4561
  exports.GoabSkeleton = GoabSkeleton;
2556
4562
  exports.GoabSpacer = GoabSpacer;
2557
4563
  exports.GoabSpinner = GoabSpinner;
2558
- exports.GoabSuccessBadge = GoabSuccessBadge;
2559
4564
  exports.GoabTab = GoabTab;
2560
4565
  exports.GoabTable = GoabTable;
2561
4566
  exports.GoabTableSortHeader = GoabTableSortHeader;
@@ -2567,5 +4572,10 @@ exports.GoabTextarea = GoabTextArea;
2567
4572
  exports.GoabThreeColumnLayout = GoabThreeColumnLayout;
2568
4573
  exports.GoabTooltip = GoabTooltip;
2569
4574
  exports.GoabTwoColumnLayout = GoabTwoColumnLayout;
4575
+ exports.GoabWorkSideMenu = GoabWorkSideMenu;
4576
+ exports.GoabWorkSideMenuGroup = GoabWorkSideMenuGroup;
4577
+ exports.GoabWorkSideMenuItem = GoabWorkSideMenuItem;
4578
+ exports.GoabWorkSideNotificationItem = GoabWorkSideNotificationItem;
4579
+ exports.GoabWorkSideNotificationPanel = GoabWorkSideNotificationPanel;
2570
4580
  exports.usePublicFormController = usePublicFormController;
2571
4581
  //# sourceMappingURL=index.js.map