@abgov/react-components 3.4.0-alpha.6 → 3.4.0-alpha.62

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.
@@ -15,36 +15,6 @@ const GoAAppHeader = ({
15
15
  }), void 0);
16
16
  };
17
17
 
18
- function styleInject(css, ref) {
19
- if ( ref === void 0 ) ref = {};
20
- var insertAt = ref.insertAt;
21
-
22
- if (!css || typeof document === 'undefined') { return; }
23
-
24
- var head = document.head || document.getElementsByTagName('head')[0];
25
- var style = document.createElement('style');
26
- style.type = 'text/css';
27
-
28
- if (insertAt === 'top') {
29
- if (head.firstChild) {
30
- head.insertBefore(style, head.firstChild);
31
- } else {
32
- head.appendChild(style);
33
- }
34
- } else {
35
- head.appendChild(style);
36
- }
37
-
38
- if (style.styleSheet) {
39
- style.styleSheet.cssText = css;
40
- } else {
41
- style.appendChild(document.createTextNode(css));
42
- }
43
- }
44
-
45
- var css_248z$3 = "goa-badge {\n margin-left: 0.25rem;\n}";
46
- styleInject(css_248z$3);
47
-
48
18
  const GoABadge = ({
49
19
  type,
50
20
  content,
@@ -103,8 +73,35 @@ const GoAEmergencyBadge = ({
103
73
  }, void 0);
104
74
  };
105
75
 
106
- var css_248z$2 = "goa-button + goa-button {\n margin-top: 1.5rem;\n}\n\n/* TODO: these margins need to match UI specs */\n@media (min-width: 480px) {\n goa-button + goa-button {\n margin-left: 1rem;\n }\n}\n";
107
- styleInject(css_248z$2);
76
+ function styleInject(css, ref) {
77
+ if ( ref === void 0 ) ref = {};
78
+ var insertAt = ref.insertAt;
79
+
80
+ if (!css || typeof document === 'undefined') { return; }
81
+
82
+ var head = document.head || document.getElementsByTagName('head')[0];
83
+ var style = document.createElement('style');
84
+ style.type = 'text/css';
85
+
86
+ if (insertAt === 'top') {
87
+ if (head.firstChild) {
88
+ head.insertBefore(style, head.firstChild);
89
+ } else {
90
+ head.appendChild(style);
91
+ }
92
+ } else {
93
+ head.appendChild(style);
94
+ }
95
+
96
+ if (style.styleSheet) {
97
+ style.styleSheet.cssText = css;
98
+ } else {
99
+ style.appendChild(document.createTextNode(css));
100
+ }
101
+ }
102
+
103
+ var css_248z$1 = "goa-button + goa-button {\n margin-top: 1.5rem;\n}\n\n/* TODO: these margins need to match UI specs */\n@media (min-width: 480px) {\n goa-button + goa-button {\n margin-left: 1rem;\n }\n}\n";
104
+ styleInject(css_248z$1);
108
105
 
109
106
  const GoAButton = ({
110
107
  title,
@@ -124,7 +121,7 @@ const GoAButton = ({
124
121
  const current = el.current;
125
122
 
126
123
  const listener = e => {
127
- onClick();
124
+ onClick(e);
128
125
  };
129
126
 
130
127
  current.addEventListener('_click', listener);
@@ -144,8 +141,8 @@ const GoAButton = ({
144
141
  }), void 0);
145
142
  };
146
143
 
147
- var css_248z$1 = "goa-button-group > goa-button ~ goa-button {\n margin: 0;\n margin-top: 0.25rem;\n}\n\n@media (min-width: 320px) {\n goa-button-group > goa-button ~ goa-button {\n margin: 0;\n /* margin-left: 0.25rem; */\n }\n}\n";
148
- styleInject(css_248z$1);
144
+ var css_248z = "goa-button-group > goa-button ~ goa-button {\n margin: 0;\n margin-top: 0.25rem;\n}\n\n@media (min-width: 320px) {\n goa-button-group > goa-button ~ goa-button {\n margin: 0;\n /* margin-left: 0.25rem; */\n }\n}\n";
145
+ styleInject(css_248z);
149
146
 
150
147
  const GoAButtonGroup = ({
151
148
  alignment,
@@ -172,13 +169,13 @@ const GoACallout = ({
172
169
  };
173
170
 
174
171
  const GoACheckbox = ({
172
+ id,
175
173
  name,
176
174
  testId,
177
175
  error,
178
176
  disabled,
179
177
  checked,
180
- indeterminate,
181
- value: _value = true,
178
+ value,
182
179
  text,
183
180
  children,
184
181
  onChange
@@ -203,24 +200,42 @@ const GoACheckbox = ({
203
200
  return jsx("goa-checkbox", Object.assign({
204
201
  "data-testid": testId,
205
202
  ref: el,
203
+ id: id,
206
204
  name: name,
207
205
  error: error,
208
206
  checked: checked,
209
207
  disabled: disabled,
210
- indeterminate: indeterminate,
211
208
  text: text,
212
- value: _value
209
+ value: value
213
210
  }, {
214
211
  children: children
215
212
  }), void 0);
216
213
  };
217
214
 
215
+ const GoACircularProgress = ({
216
+ type,
217
+ visible,
218
+ message,
219
+ progress,
220
+ variant,
221
+ size
222
+ }) => {
223
+ return jsx("goa-circular-progress", {
224
+ type: type,
225
+ visible: visible ? "true" : "false",
226
+ message: message,
227
+ progress: progress,
228
+ variant: variant,
229
+ size: size
230
+ }, void 0);
231
+ };
232
+
218
233
  const GoAContainer = ({
219
234
  headingSize,
220
235
  title,
221
236
  children,
222
237
  actions,
223
- variant: _variant = 'primary'
238
+ variant: _variant = 'default'
224
239
  }) => {
225
240
  return jsxs("goa-container", Object.assign({
226
241
  variant: _variant,
@@ -262,7 +277,7 @@ const GoADropdown = props => {
262
277
  const {
263
278
  name,
264
279
  value
265
- } = state.detail.data;
280
+ } = state.detail;
266
281
  props.onChange(name, value);
267
282
  };
268
283
 
@@ -274,22 +289,20 @@ const GoADropdown = props => {
274
289
  return jsx("goa-dropdown", Object.assign({
275
290
  ref: el,
276
291
  name: props.name,
277
- values: JSON.stringify(props.selectedValues),
292
+ values: JSON.stringify(props.values),
278
293
  leadingicon: props.leadingIcon,
279
294
  maxheight: props.maxHeight,
280
295
  placeholder: props.placeholder,
281
- autocomplete: props.autoComplete,
296
+ filterable: props.filterable,
282
297
  disabled: props.disabled,
283
- multiselect: props.multiSelect,
298
+ multiselect: props.multiselect,
299
+ error: props.error,
284
300
  "data-testid": props.testId
285
301
  }, {
286
302
  children: props.children
287
303
  }), void 0);
288
304
  };
289
305
 
290
- var css_248z = "";
291
- styleInject(css_248z);
292
-
293
306
  const GoAFlexRow = ({
294
307
  gap,
295
308
  minWidth,
@@ -321,22 +334,14 @@ const GoAFlexRow = ({
321
334
  }), void 0);
322
335
  };
323
336
 
324
- var row = /*#__PURE__*/Object.freeze({
325
- __proto__: null,
326
- GoAFlexRow: GoAFlexRow,
327
- 'default': GoAFlexRow
328
- });
329
-
330
337
  const GoAFormItem = ({
331
338
  children,
332
339
  helpText,
333
340
  error,
334
341
  optional,
335
- name,
336
342
  label
337
343
  }) => {
338
344
  return jsx("goa-form-item", Object.assign({
339
- name: name,
340
345
  label: label,
341
346
  error: error,
342
347
  optional: optional,
@@ -346,12 +351,6 @@ const GoAFormItem = ({
346
351
  }), void 0);
347
352
  };
348
353
 
349
- var formItem = /*#__PURE__*/Object.freeze({
350
- __proto__: null,
351
- GoAFormItem: GoAFormItem,
352
- 'default': GoAFormItem
353
- });
354
-
355
354
  const GoAHeroBanner = ({
356
355
  title,
357
356
  backgroundUrl,
@@ -365,16 +364,6 @@ const GoAHeroBanner = ({
365
364
  }), void 0);
366
365
  };
367
366
 
368
- const GoAHeroBannerContent = ({
369
- children
370
- }) => {
371
- return jsx("div", Object.assign({
372
- slot: "content"
373
- }, {
374
- children: children
375
- }), void 0);
376
- };
377
-
378
367
  const GoAHeroBannerActions = ({
379
368
  children
380
369
  }) => {
@@ -475,6 +464,7 @@ const GoAInput = ({
475
464
  value,
476
465
  placeholder,
477
466
  error,
467
+ testId,
478
468
  onTrailingIconClick,
479
469
  onChange
480
470
  }) => {
@@ -490,32 +480,24 @@ const GoAInput = ({
490
480
  const {
491
481
  name,
492
482
  value
493
- } = e.detail.data;
483
+ } = e.detail;
494
484
  onChange(name, value);
495
- }; // TODO: determinw the propery type of the e (CustomEvent does not work)
496
-
485
+ };
497
486
 
498
487
  const clickListener = e => {
499
488
  onTrailingIconClick === null || onTrailingIconClick === void 0 ? void 0 : onTrailingIconClick();
500
489
  };
501
490
 
502
- current.addEventListener('_change', changeListener); // TODO: remove all the `on:` prefixes
503
-
504
- current.addEventListener('_ontrailingiconclick', clickListener);
491
+ current.addEventListener('_change', changeListener);
492
+ current.addEventListener('_trailingIconClick', clickListener);
505
493
  return () => {
506
494
  current.removeEventListener('_change', changeListener);
507
- current.removeEventListener('_ontrailingiconclick', clickListener);
495
+ current.removeEventListener('_trailingIconClick', clickListener);
508
496
  };
509
- }, [ref, onChange, onTrailingIconClick]); // useEffect(() => {
510
- // if (focused) {
511
- // inputRef.current?.focus();
512
- // } else {
513
- // inputRef.current?.blur();
514
- // }
515
- // }, [focused, inputRef]);
516
-
497
+ }, [ref, onChange, onTrailingIconClick]);
517
498
  return jsx("goa-input", {
518
499
  ref: ref,
500
+ focused: focused,
519
501
  type: type,
520
502
  name: name,
521
503
  id: id,
@@ -526,6 +508,7 @@ const GoAInput = ({
526
508
  readonly: readonly,
527
509
  placeholder: placeholder,
528
510
  error: error,
511
+ "data-testid": testId,
529
512
  value: value,
530
513
  handletrailingiconclick: !!onTrailingIconClick
531
514
  }, void 0);
@@ -562,7 +545,7 @@ const GoAInputEmail = props => {
562
545
  };
563
546
  const GoAInputSearch = props => {
564
547
  return jsx(GoAInput, Object.assign({}, props, {
565
- type: "text",
548
+ type: "search",
566
549
  trailingIcon: "search"
567
550
  }), void 0);
568
551
  };
@@ -600,17 +583,29 @@ const GoAInputNumber = props => {
600
583
  const GoAInputRange = _a => {
601
584
  var props = __rest(_a, ["step"]);
602
585
 
603
- return jsx("input", Object.assign({}, props, {
604
- type: "range",
605
- onChange: e => props.onChange(e.target.name, e.target.value)
586
+ return jsx(GoAInput, Object.assign({}, props, {
587
+ type: "range"
606
588
  }), void 0);
607
589
  };
608
590
 
591
+ const GoAMicrositeHeader = ({
592
+ level,
593
+ version,
594
+ feedbackUrl
595
+ }) => {
596
+ return jsx("goa-microsite-header", {
597
+ level: level,
598
+ version: version,
599
+ feedbackurl: feedbackUrl
600
+ }, void 0);
601
+ };
602
+
609
603
  const GoAModal = ({
610
- title,
604
+ heading,
611
605
  children,
612
606
  open,
613
- closable,
607
+ width,
608
+ actions,
614
609
  onClose
615
610
  }) => {
616
611
  const el = useRef(null);
@@ -630,14 +625,19 @@ const GoAModal = ({
630
625
  current.removeEventListener('_close', listener);
631
626
  };
632
627
  }, [el, onClose]);
633
- return jsx("goa-modal", Object.assign({
628
+ return jsxs("goa-modal", Object.assign({
634
629
  ref: el,
635
- title: title,
630
+ heading: heading,
636
631
  open: open,
637
- closable: closable,
638
- scrollable: true
632
+ closable: !!onClose,
633
+ scrollable: true,
634
+ width: width
639
635
  }, {
640
- children: children
636
+ children: [actions && jsx("div", Object.assign({
637
+ slot: "actions"
638
+ }, {
639
+ children: actions
640
+ }), void 0), children]
641
641
  }), void 0);
642
642
  };
643
643
 
@@ -652,23 +652,15 @@ const GoANotification = ({
652
652
  }), void 0);
653
653
  };
654
654
 
655
- const GoAPageLoader = ({
656
- type,
657
- visible,
658
- message,
659
- progress,
660
- variant
655
+ const GoAPageBlock = ({
656
+ children
661
657
  }) => {
662
- return jsx("goa-page-loader", {
663
- type: type,
664
- visible: visible,
665
- message: message,
666
- progress: progress,
667
- variant: variant
658
+ return jsx("goa-page-block", {
659
+ children: children
668
660
  }, void 0);
669
661
  };
670
662
 
671
- const GoARadio = ({
663
+ const GoARadioItem = ({
672
664
  name,
673
665
  label,
674
666
  value,
@@ -696,6 +688,8 @@ const GoARadioGroup = ({
696
688
  value,
697
689
  children,
698
690
  orientation: _orientation = 'vertical',
691
+ disabled: _disabled = false,
692
+ error: _error = false,
699
693
  testId,
700
694
  onChange
701
695
  }) => {
@@ -706,6 +700,11 @@ const GoARadioGroup = ({
706
700
  }
707
701
 
708
702
  const listener = e => {
703
+ if (!onChange) {
704
+ console.warn("Missing onChange function");
705
+ return;
706
+ }
707
+
709
708
  onChange(name, e.detail.value);
710
709
  };
711
710
 
@@ -720,17 +719,37 @@ const GoARadioGroup = ({
720
719
  ref: el,
721
720
  name: name,
722
721
  value: value,
723
- orientation: _orientation
722
+ orientation: _orientation,
723
+ disabled: _disabled,
724
+ error: _error
724
725
  }, {
725
726
  children: children
726
727
  }), void 0);
727
728
  };
728
729
 
729
- const GoAServiceLevelHeader = ({
730
- level
730
+ const GoASkeleton = ({
731
+ type,
732
+ size: _size = 1
731
733
  }) => {
732
- return jsx("goa-service-level-header", {
733
- level: level
734
+ return jsx("goa-skeleton", {
735
+ type: type,
736
+ size: _size
737
+ }, void 0);
738
+ };
739
+
740
+ const GoASpinner = ({
741
+ type,
742
+ size,
743
+ progress,
744
+ invert,
745
+ testId
746
+ }) => {
747
+ return jsx("goa-spinner", {
748
+ type: type,
749
+ size: size,
750
+ progress: progress,
751
+ invert: invert,
752
+ testid: testId
734
753
  }, void 0);
735
754
  };
736
755
 
@@ -740,6 +759,8 @@ const GoATextArea = ({
740
759
  placeholder,
741
760
  rows,
742
761
  disabled,
762
+ testId,
763
+ error,
743
764
  onChange
744
765
  }) => {
745
766
  const el = useRef(null);
@@ -754,7 +775,7 @@ const GoATextArea = ({
754
775
  const {
755
776
  name,
756
777
  value
757
- } = e.detail.data;
778
+ } = e.detail;
758
779
  onChange(name, value);
759
780
  };
760
781
 
@@ -769,8 +790,10 @@ const GoATextArea = ({
769
790
  placeholder: placeholder,
770
791
  value: value,
771
792
  rows: rows,
772
- disabled: disabled
793
+ disabled: disabled,
794
+ error: error,
795
+ "data-testid": testId
773
796
  }, void 0);
774
797
  };
775
798
 
776
- export { GoAAppHeader, GoABadge, GoAButton, GoAButtonGroup, GoACallout, GoACheckbox, GoAContainer, GoADropdown, GoADropdownOption, GoAEmergencyBadge, row as GoAFlexRow, formItem as GoAFormItem, GoAHeroBanner, GoAHeroBannerActions, GoAHeroBannerContent, GoAIcon, GoAIconButton, GoAInfoBadge, GoAInput, GoAInputDate, GoAInputDateTime, GoAInputEmail, GoAInputFile, GoAInputMonth, GoAInputNumber, GoAInputPassword, GoAInputRange, GoAInputSearch, GoAInputTel, GoAInputText, GoAInputTime, GoAInputUrl, GoAModal, GoANotification, GoAPageLoader, GoARadio, GoARadioGroup, GoAServiceLevelHeader, GoASuccessBadge, GoATextArea, GoAWarningBadge };
799
+ export { GoAAppHeader, GoABadge, GoAButton, GoAButtonGroup, GoACallout, GoACheckbox, GoACircularProgress, GoAContainer, GoADropdown, GoADropdownOption, GoAEmergencyBadge, GoAFlexRow, GoAFormItem, GoAHeroBanner, GoAHeroBannerActions, GoAIcon, GoAIconButton, GoAInfoBadge, GoAInput, GoAInputDate, GoAInputDateTime, GoAInputEmail, GoAInputFile, GoAInputMonth, GoAInputNumber, GoAInputPassword, GoAInputRange, GoAInputSearch, GoAInputTel, GoAInputText, GoAInputTime, GoAInputUrl, GoAMicrositeHeader, GoAModal, GoANotification, GoAPageBlock, GoARadioGroup, GoARadioItem, GoASkeleton, GoASpinner, GoASuccessBadge, GoATextArea, GoAWarningBadge };