@abgov/react-components 4.0.0-alpha.14 → 4.0.0-alpha.17

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.
@@ -2,6 +2,235 @@ import '@abgov/web-components';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { useRef, useEffect } from 'react';
4
4
 
5
+ const GoABadge = ({
6
+ type,
7
+ content,
8
+ icon,
9
+ testId
10
+ }) => {
11
+ return jsx("goa-badge", {
12
+ type: type,
13
+ content: content,
14
+ icon: icon,
15
+ testid: testId
16
+ }, void 0);
17
+ };
18
+ const GoAInfoBadge = ({
19
+ content,
20
+ testId
21
+ }) => {
22
+ return jsx(GoABadge, {
23
+ type: "information",
24
+ icon: "information-circle",
25
+ content: content,
26
+ testId: testId
27
+ }, void 0);
28
+ };
29
+ const GoASuccessBadge = ({
30
+ content,
31
+ testId
32
+ }) => {
33
+ return jsx(GoABadge, {
34
+ type: "success",
35
+ icon: "checkmark-circle",
36
+ content: content,
37
+ testId: testId
38
+ }, void 0);
39
+ };
40
+ const GoAWarningBadge = ({
41
+ content,
42
+ testId
43
+ }) => {
44
+ return jsx(GoABadge, {
45
+ type: "warning",
46
+ icon: "warning",
47
+ content: content,
48
+ testId: testId
49
+ }, void 0);
50
+ };
51
+ const GoAEmergencyBadge = ({
52
+ content,
53
+ testId
54
+ }) => {
55
+ return jsx(GoABadge, {
56
+ type: "emergency",
57
+ icon: "alert-circle",
58
+ content: content,
59
+ testId: testId
60
+ }, void 0);
61
+ };
62
+
63
+ /*! *****************************************************************************
64
+ Copyright (c) Microsoft Corporation.
65
+
66
+ Permission to use, copy, modify, and/or distribute this software for any
67
+ purpose with or without fee is hereby granted.
68
+
69
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
70
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
71
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
72
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
73
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
74
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
75
+ PERFORMANCE OF THIS SOFTWARE.
76
+ ***************************************************************************** */
77
+
78
+ function __rest(s, e) {
79
+ var t = {};
80
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
81
+ t[p] = s[p];
82
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
83
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
84
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
85
+ t[p[i]] = s[p[i]];
86
+ }
87
+ return t;
88
+ }
89
+
90
+ const GoAInput = ({
91
+ id,
92
+ name,
93
+ type,
94
+ leadingIcon,
95
+ trailingIcon,
96
+ variant: _variant = 'goa',
97
+ focused,
98
+ disabled,
99
+ readonly,
100
+ value,
101
+ placeholder,
102
+ error,
103
+ width,
104
+ showCounter,
105
+ maxCharCount,
106
+ testId,
107
+ onTrailingIconClick,
108
+ onChange
109
+ }) => {
110
+ const ref = useRef(null);
111
+ useEffect(() => {
112
+ if (!ref.current) {
113
+ return;
114
+ }
115
+
116
+ const current = ref.current;
117
+
118
+ const changeListener = e => {
119
+ const {
120
+ name,
121
+ value
122
+ } = e.detail;
123
+ onChange(name, value);
124
+ };
125
+
126
+ const clickListener = e => {
127
+ onTrailingIconClick === null || onTrailingIconClick === void 0 ? void 0 : onTrailingIconClick();
128
+ };
129
+
130
+ current.addEventListener('_change', changeListener);
131
+ current.addEventListener('_trailingIconClick', clickListener);
132
+ return () => {
133
+ current.removeEventListener('_change', changeListener);
134
+ current.removeEventListener('_trailingIconClick', clickListener);
135
+ };
136
+ }, [ref, onChange, onTrailingIconClick]);
137
+ return jsx("goa-input", {
138
+ ref: ref,
139
+ focused: focused,
140
+ type: type,
141
+ name: name,
142
+ id: id,
143
+ leadingicon: leadingIcon,
144
+ trailingicon: trailingIcon,
145
+ variant: _variant,
146
+ disabled: disabled,
147
+ readonly: readonly,
148
+ placeholder: placeholder,
149
+ error: error,
150
+ "data-testid": testId,
151
+ value: value,
152
+ width: width,
153
+ showcounter: showCounter,
154
+ maxcharcount: maxCharCount,
155
+ handletrailingiconclick: !!onTrailingIconClick
156
+ }, void 0);
157
+ };
158
+ const GoAInputText = props => {
159
+ return jsx(GoAInput, Object.assign({}, props, {
160
+ type: "text"
161
+ }), void 0);
162
+ };
163
+ const GoAInputPassword = props => {
164
+ return jsx(GoAInput, Object.assign({}, props, {
165
+ type: "password"
166
+ }), void 0);
167
+ };
168
+ const GoAInputDate = props => {
169
+ return jsx(GoAInput, Object.assign({}, props, {
170
+ type: "date"
171
+ }), void 0);
172
+ };
173
+ const GoAInputTime = props => {
174
+ return jsx(GoAInput, Object.assign({}, props, {
175
+ type: "time"
176
+ }), void 0);
177
+ };
178
+ const GoAInputDateTime = props => {
179
+ return jsx(GoAInput, Object.assign({}, props, {
180
+ type: "datetime-local"
181
+ }), void 0);
182
+ };
183
+ const GoAInputEmail = props => {
184
+ return jsx(GoAInput, Object.assign({}, props, {
185
+ type: "email"
186
+ }), void 0);
187
+ };
188
+ const GoAInputSearch = props => {
189
+ return jsx(GoAInput, Object.assign({}, props, {
190
+ type: "search",
191
+ trailingIcon: "search"
192
+ }), void 0);
193
+ };
194
+ const GoAInputUrl = props => {
195
+ return jsx(GoAInput, Object.assign({}, props, {
196
+ type: "url"
197
+ }), void 0);
198
+ };
199
+ const GoAInputTel = props => {
200
+ return jsx(GoAInput, Object.assign({}, props, {
201
+ type: "tel"
202
+ }), void 0);
203
+ };
204
+ const GoAInputFile = props => {
205
+ return jsx("input", {
206
+ id: props.id,
207
+ name: props.name,
208
+ type: "file",
209
+ onChange: e => props.onChange(e.target.name, e.target.value),
210
+ style: {
211
+ backgroundColor: 'revert'
212
+ }
213
+ }, void 0);
214
+ };
215
+ const GoAInputMonth = props => {
216
+ return jsx(GoAInput, Object.assign({}, props, {
217
+ type: "month"
218
+ }), void 0);
219
+ };
220
+ const GoAInputNumber = props => {
221
+ return jsx(GoAInput, Object.assign({}, props, {
222
+ value: props.value.toString(),
223
+ type: "number"
224
+ }), void 0);
225
+ };
226
+ const GoAInputRange = _a => {
227
+ var props = __rest(_a, ["step"]);
228
+
229
+ return jsx(GoAInput, Object.assign({}, props, {
230
+ type: "range"
231
+ }), void 0);
232
+ };
233
+
5
234
  const GoAAppHeader = ({
6
235
  title,
7
236
  url,
@@ -68,64 +297,6 @@ const GoANavigationLink = ({
68
297
  }), void 0);
69
298
  };
70
299
 
71
- const GoABadge = ({
72
- type,
73
- content,
74
- icon,
75
- testId
76
- }) => {
77
- return jsx("goa-badge", {
78
- type: type,
79
- content: content,
80
- icon: icon,
81
- testid: testId
82
- }, void 0);
83
- };
84
- const GoAInfoBadge = ({
85
- content,
86
- testId
87
- }) => {
88
- return jsx(GoABadge, {
89
- type: "information",
90
- icon: "information-circle",
91
- content: content,
92
- testId: testId
93
- }, void 0);
94
- };
95
- const GoASuccessBadge = ({
96
- content,
97
- testId
98
- }) => {
99
- return jsx(GoABadge, {
100
- type: "success",
101
- icon: "checkmark-circle",
102
- content: content,
103
- testId: testId
104
- }, void 0);
105
- };
106
- const GoAWarningBadge = ({
107
- content,
108
- testId
109
- }) => {
110
- return jsx(GoABadge, {
111
- type: "warning",
112
- icon: "warning",
113
- content: content,
114
- testId: testId
115
- }, void 0);
116
- };
117
- const GoAEmergencyBadge = ({
118
- content,
119
- testId
120
- }) => {
121
- return jsx(GoABadge, {
122
- type: "emergency",
123
- icon: "alert-circle",
124
- content: content,
125
- testId: testId
126
- }, void 0);
127
- };
128
-
129
300
  function styleInject(css, ref) {
130
301
  if ( ref === void 0 ) ref = {};
131
302
  var insertAt = ref.insertAt;
@@ -160,8 +331,8 @@ const GoAButton = ({
160
331
  title,
161
332
  disabled: _disabled = false,
162
333
  type: _type = 'primary',
163
- size: _size = 'normal',
164
- variant: _variant = 'default',
334
+ size: _size = '',
335
+ variant: _variant = '',
165
336
  leadingIcon,
166
337
  trailingIcon,
167
338
  children,
@@ -322,13 +493,15 @@ const GoACircularProgress = ({
322
493
  const GoAContainer = ({
323
494
  headingSize,
324
495
  title,
496
+ colored: _colored = false,
325
497
  children,
326
498
  actions,
327
499
  variant: _variant = 'default'
328
500
  }) => {
329
501
  return jsxs("goa-container", Object.assign({
330
502
  variant: _variant,
331
- headingsize: headingSize
503
+ headingsize: headingSize,
504
+ colored: _colored
332
505
  }, {
333
506
  children: [title && jsx("div", Object.assign({
334
507
  slot: "title"
@@ -365,9 +538,10 @@ const GoADropdown = props => {
365
538
  const handler = state => {
366
539
  const {
367
540
  name,
541
+ value,
368
542
  values
369
543
  } = state.detail;
370
- props.onChange(name, values);
544
+ props.onChange(name, props.multiselect ? values : value);
371
545
  };
372
546
 
373
547
  current.addEventListener('_change', handler);
@@ -494,176 +668,6 @@ const GoAIconButton = ({
494
668
  }), void 0);
495
669
  };
496
670
 
497
- /*! *****************************************************************************
498
- Copyright (c) Microsoft Corporation.
499
-
500
- Permission to use, copy, modify, and/or distribute this software for any
501
- purpose with or without fee is hereby granted.
502
-
503
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
504
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
505
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
506
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
507
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
508
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
509
- PERFORMANCE OF THIS SOFTWARE.
510
- ***************************************************************************** */
511
-
512
- function __rest(s, e) {
513
- var t = {};
514
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
515
- t[p] = s[p];
516
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
517
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
518
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
519
- t[p[i]] = s[p[i]];
520
- }
521
- return t;
522
- }
523
-
524
- const GoAInput = ({
525
- id,
526
- name,
527
- type,
528
- leadingIcon,
529
- trailingIcon,
530
- variant: _variant = 'goa',
531
- focused,
532
- disabled,
533
- readonly,
534
- value,
535
- placeholder,
536
- error,
537
- width,
538
- showCounter,
539
- maxCharCount,
540
- testId,
541
- onTrailingIconClick,
542
- onChange
543
- }) => {
544
- const ref = useRef(null);
545
- useEffect(() => {
546
- if (!ref.current) {
547
- return;
548
- }
549
-
550
- const current = ref.current;
551
-
552
- const changeListener = e => {
553
- const {
554
- name,
555
- value
556
- } = e.detail;
557
- onChange(name, value);
558
- };
559
-
560
- const clickListener = e => {
561
- onTrailingIconClick === null || onTrailingIconClick === void 0 ? void 0 : onTrailingIconClick();
562
- };
563
-
564
- current.addEventListener('_change', changeListener);
565
- current.addEventListener('_trailingIconClick', clickListener);
566
- return () => {
567
- current.removeEventListener('_change', changeListener);
568
- current.removeEventListener('_trailingIconClick', clickListener);
569
- };
570
- }, [ref, onChange, onTrailingIconClick]);
571
- return jsx("goa-input", {
572
- ref: ref,
573
- focused: focused,
574
- type: type,
575
- name: name,
576
- id: id,
577
- leadingicon: leadingIcon,
578
- trailingicon: trailingIcon,
579
- variant: _variant,
580
- disabled: disabled,
581
- readonly: readonly,
582
- placeholder: placeholder,
583
- error: error,
584
- "data-testid": testId,
585
- value: value,
586
- width: width,
587
- showcounter: showCounter,
588
- maxcharcount: maxCharCount,
589
- handletrailingiconclick: !!onTrailingIconClick
590
- }, void 0);
591
- };
592
- const GoAInputText = props => {
593
- return jsx(GoAInput, Object.assign({}, props, {
594
- type: "text"
595
- }), void 0);
596
- };
597
- const GoAInputPassword = props => {
598
- return jsx(GoAInput, Object.assign({}, props, {
599
- type: "password"
600
- }), void 0);
601
- };
602
- const GoAInputDate = props => {
603
- return jsx(GoAInput, Object.assign({}, props, {
604
- type: "date"
605
- }), void 0);
606
- };
607
- const GoAInputTime = props => {
608
- return jsx(GoAInput, Object.assign({}, props, {
609
- type: "time"
610
- }), void 0);
611
- };
612
- const GoAInputDateTime = props => {
613
- return jsx(GoAInput, Object.assign({}, props, {
614
- type: "datetime-local"
615
- }), void 0);
616
- };
617
- const GoAInputEmail = props => {
618
- return jsx(GoAInput, Object.assign({}, props, {
619
- type: "email"
620
- }), void 0);
621
- };
622
- const GoAInputSearch = props => {
623
- return jsx(GoAInput, Object.assign({}, props, {
624
- type: "search",
625
- trailingIcon: "search"
626
- }), void 0);
627
- };
628
- const GoAInputUrl = props => {
629
- return jsx(GoAInput, Object.assign({}, props, {
630
- type: "url"
631
- }), void 0);
632
- };
633
- const GoAInputTel = props => {
634
- return jsx(GoAInput, Object.assign({}, props, {
635
- type: "tel"
636
- }), void 0);
637
- };
638
- const GoAInputFile = props => {
639
- return jsx("input", {
640
- id: props.id,
641
- name: props.name,
642
- type: "file",
643
- onChange: e => props.onChange(e.target.name, e.target.value),
644
- style: {
645
- backgroundColor: 'revert'
646
- }
647
- }, void 0);
648
- };
649
- const GoAInputMonth = props => {
650
- return jsx(GoAInput, Object.assign({}, props, {
651
- type: "month"
652
- }), void 0);
653
- };
654
- const GoAInputNumber = props => {
655
- return jsx(GoAInput, Object.assign({}, props, {
656
- type: "number"
657
- }), void 0);
658
- };
659
- const GoAInputRange = _a => {
660
- var props = __rest(_a, ["step"]);
661
-
662
- return jsx(GoAInput, Object.assign({}, props, {
663
- type: "range"
664
- }), void 0);
665
- };
666
-
667
671
  const GoAMicrositeHeader = ({
668
672
  level,
669
673
  version,
@@ -730,12 +734,12 @@ const GoANotification = ({
730
734
  }), void 0);
731
735
  };
732
736
 
733
- const GoAPageBlock = ({
734
- children
735
- }) => {
736
- return jsx("goa-page-block", {
737
- children: children
738
- }, void 0);
737
+ const GoAPageBlock = props => {
738
+ return jsx("goa-page-block", Object.assign({
739
+ width: props.width
740
+ }, {
741
+ children: props.children
742
+ }), void 0);
739
743
  };
740
744
 
741
745
  const GoARadioItem = ({
@@ -839,6 +843,7 @@ const GoATextArea = ({
839
843
  disabled,
840
844
  showCounter,
841
845
  maxCharCount,
846
+ width,
842
847
  testId,
843
848
  error,
844
849
  onChange
@@ -873,9 +878,33 @@ const GoATextArea = ({
873
878
  disabled: disabled,
874
879
  showcounter: showCounter,
875
880
  maxcharcount: maxCharCount,
881
+ width: width,
876
882
  error: error,
877
883
  "data-testid": testId
878
884
  }, void 0);
879
885
  };
880
886
 
881
- export { GoAAppFooter, GoAAppHeader, GoABadge, GoAButton, GoAButtonGroup, GoACallout, GoACheckbox, GoAChip, 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, GoAMetaLink, GoAMicrositeHeader, GoAModal, GoANavigationLink, GoANotification, GoAPageBlock, GoARadioGroup, GoARadioItem, GoASkeleton, GoASpinner, GoASuccessBadge, GoATextArea, GoAWarningBadge };
887
+ const GoAFlexCol = ({
888
+ gap,
889
+ children
890
+ }) => {
891
+ return jsx("goa-flex-col", Object.assign({
892
+ gap: gap
893
+ }, {
894
+ children: children
895
+ }), void 0);
896
+ };
897
+
898
+ function GoAPage(props) {
899
+ return jsx("goa-page", {
900
+ children: props.children
901
+ }, void 0);
902
+ }
903
+
904
+ function GoADivider(props) {
905
+ return jsx("goa-divider", {
906
+ spacing: props.spacing
907
+ }, void 0);
908
+ }
909
+
910
+ export { GoAAppFooter, GoAAppHeader, GoABadge, GoAButton, GoAButtonGroup, GoACallout, GoACheckbox, GoAChip, GoACircularProgress, GoAContainer, GoADivider, GoADropdown, GoADropdownOption, GoAEmergencyBadge, GoAFlexCol, GoAFlexRow, GoAFormItem, GoAHeroBanner, GoAHeroBannerActions, GoAIcon, GoAIconButton, GoAInfoBadge, GoAInput, GoAInputDate, GoAInputDateTime, GoAInputEmail, GoAInputFile, GoAInputMonth, GoAInputNumber, GoAInputPassword, GoAInputRange, GoAInputSearch, GoAInputTel, GoAInputText, GoAInputTime, GoAInputUrl, GoAMetaLink, GoAMicrositeHeader, GoAModal, GoANavigationLink, GoANotification, GoAPage, GoAPageBlock, GoARadioGroup, GoARadioItem, GoASkeleton, GoASpinner, GoASuccessBadge, GoATextArea, GoAWarningBadge };