@abgov/react-components 3.4.0-alpha.14 → 3.4.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.
@@ -1,6 +1,5 @@
1
1
  import React, { FC } from 'react';
2
2
  import { GoAIconType } from '../icons';
3
- import './badge.scss';
4
3
  export declare type GoABadgeType = 'information' | 'success' | 'warning' | 'emergency' | 'dark' | 'midtone' | 'light' | 'inactive';
5
4
  interface GoABadgeProps {
6
5
  type: GoABadgeType;
package/lib/flex/row.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { FC } from "react";
2
- import './row.scss';
3
2
  interface Props {
4
3
  gap?: 'small' | 'medium' | 'large';
5
4
  minWidth?: number | string;
@@ -13,7 +13,9 @@ interface WCProps {
13
13
  disabled?: boolean;
14
14
  error?: string;
15
15
  readonly?: boolean;
16
+ focused?: boolean;
16
17
  handletrailingiconclick: boolean;
18
+ testid?: string;
17
19
  }
18
20
  declare global {
19
21
  namespace JSX {
@@ -22,7 +24,7 @@ declare global {
22
24
  }
23
25
  }
24
26
  }
25
- interface Props {
27
+ export interface Props {
26
28
  name: string;
27
29
  value: string;
28
30
  onChange: (name: string, value: string) => void;
@@ -36,6 +38,7 @@ interface Props {
36
38
  focused?: boolean;
37
39
  readonly?: boolean;
38
40
  error?: string;
41
+ testId?: string;
39
42
  }
40
43
  export declare const GoAInput: FC<Props & {
41
44
  type: string;
@@ -9,9 +9,11 @@ declare global {
9
9
  export declare type ServiceLevel = 'alpha' | 'beta' | 'live';
10
10
  interface WebComponentProps {
11
11
  level: ServiceLevel;
12
+ version?: string;
12
13
  }
13
14
  export interface HeaderProps {
14
15
  level: ServiceLevel;
16
+ version?: string;
15
17
  }
16
18
  export declare const GoAServiceLevelHeader: FC<HeaderProps>;
17
19
  export default GoAServiceLevelHeader;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/react-components",
3
- "version": "3.4.0-alpha.14",
3
+ "version": "3.4.0-alpha.17",
4
4
  "description": "Government of Alberta - UI components for React",
5
5
  "bugs": {
6
6
  "url": "https://github.com/GovAlta/ui-components/issues"
@@ -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,
@@ -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,
@@ -220,7 +217,7 @@ const GoAContainer = ({
220
217
  title,
221
218
  children,
222
219
  actions,
223
- variant: _variant = 'primary'
220
+ variant: _variant = 'default'
224
221
  }) => {
225
222
  return jsxs("goa-container", Object.assign({
226
223
  variant: _variant,
@@ -287,9 +284,6 @@ const GoADropdown = props => {
287
284
  }), void 0);
288
285
  };
289
286
 
290
- var css_248z = "";
291
- styleInject(css_248z);
292
-
293
287
  const GoAFlexRow = ({
294
288
  gap,
295
289
  minWidth,
@@ -475,6 +469,7 @@ const GoAInput = ({
475
469
  value,
476
470
  placeholder,
477
471
  error,
472
+ testId,
478
473
  onTrailingIconClick,
479
474
  onChange
480
475
  }) => {
@@ -492,8 +487,7 @@ const GoAInput = ({
492
487
  value
493
488
  } = e.detail.data;
494
489
  onChange(name, value);
495
- }; // TODO: determinw the propery type of the e (CustomEvent does not work)
496
-
490
+ };
497
491
 
498
492
  const clickListener = e => {
499
493
  onTrailingIconClick === null || onTrailingIconClick === void 0 ? void 0 : onTrailingIconClick();
@@ -501,21 +495,15 @@ const GoAInput = ({
501
495
 
502
496
  current.addEventListener('_change', changeListener); // TODO: remove all the `on:` prefixes
503
497
 
504
- current.addEventListener('_ontrailingiconclick', clickListener);
498
+ current.addEventListener('_trailingIconClick', clickListener);
505
499
  return () => {
506
500
  current.removeEventListener('_change', changeListener);
507
- current.removeEventListener('_ontrailingiconclick', clickListener);
501
+ current.removeEventListener('_trailingIconClick', clickListener);
508
502
  };
509
- }, [ref, onChange, onTrailingIconClick]); // useEffect(() => {
510
- // if (focused) {
511
- // inputRef.current?.focus();
512
- // } else {
513
- // inputRef.current?.blur();
514
- // }
515
- // }, [focused, inputRef]);
516
-
503
+ }, [ref, onChange, onTrailingIconClick]);
517
504
  return jsx("goa-input", {
518
505
  ref: ref,
506
+ focused: focused,
519
507
  type: type,
520
508
  name: name,
521
509
  id: id,
@@ -526,6 +514,7 @@ const GoAInput = ({
526
514
  readonly: readonly,
527
515
  placeholder: placeholder,
528
516
  error: error,
517
+ "data-testid": testId,
529
518
  value: value,
530
519
  handletrailingiconclick: !!onTrailingIconClick
531
520
  }, void 0);
@@ -600,9 +589,8 @@ const GoAInputNumber = props => {
600
589
  const GoAInputRange = _a => {
601
590
  var props = __rest(_a, ["step"]);
602
591
 
603
- return jsx("input", Object.assign({}, props, {
604
- type: "range",
605
- onChange: e => props.onChange(e.target.name, e.target.value)
592
+ return jsx(GoAInput, Object.assign({}, props, {
593
+ type: "range"
606
594
  }), void 0);
607
595
  };
608
596
 
@@ -727,10 +715,12 @@ const GoARadioGroup = ({
727
715
  };
728
716
 
729
717
  const GoAServiceLevelHeader = ({
730
- level
718
+ level,
719
+ version
731
720
  }) => {
732
721
  return jsx("goa-service-level-header", {
733
- level: level
722
+ level: level,
723
+ version: version
734
724
  }, void 0);
735
725
  };
736
726
 
@@ -58,36 +58,6 @@
58
58
  }), void 0);
59
59
  };
60
60
 
61
- function styleInject(css, ref) {
62
- if ( ref === void 0 ) ref = {};
63
- var insertAt = ref.insertAt;
64
-
65
- if (!css || typeof document === 'undefined') { return; }
66
-
67
- var head = document.head || document.getElementsByTagName('head')[0];
68
- var style = document.createElement('style');
69
- style.type = 'text/css';
70
-
71
- if (insertAt === 'top') {
72
- if (head.firstChild) {
73
- head.insertBefore(style, head.firstChild);
74
- } else {
75
- head.appendChild(style);
76
- }
77
- } else {
78
- head.appendChild(style);
79
- }
80
-
81
- if (style.styleSheet) {
82
- style.styleSheet.cssText = css;
83
- } else {
84
- style.appendChild(document.createTextNode(css));
85
- }
86
- }
87
-
88
- var css_248z$3 = "goa-badge {\n margin-left: 0.25rem;\n}";
89
- styleInject(css_248z$3);
90
-
91
61
  var GoABadge = function GoABadge(_a) {
92
62
  var type = _a.type,
93
63
  content = _a.content,
@@ -141,8 +111,35 @@
141
111
  }, void 0);
142
112
  };
143
113
 
144
- 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";
145
- styleInject(css_248z$2);
114
+ function styleInject(css, ref) {
115
+ if ( ref === void 0 ) ref = {};
116
+ var insertAt = ref.insertAt;
117
+
118
+ if (!css || typeof document === 'undefined') { return; }
119
+
120
+ var head = document.head || document.getElementsByTagName('head')[0];
121
+ var style = document.createElement('style');
122
+ style.type = 'text/css';
123
+
124
+ if (insertAt === 'top') {
125
+ if (head.firstChild) {
126
+ head.insertBefore(style, head.firstChild);
127
+ } else {
128
+ head.appendChild(style);
129
+ }
130
+ } else {
131
+ head.appendChild(style);
132
+ }
133
+
134
+ if (style.styleSheet) {
135
+ style.styleSheet.cssText = css;
136
+ } else {
137
+ style.appendChild(document.createTextNode(css));
138
+ }
139
+ }
140
+
141
+ 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";
142
+ styleInject(css_248z$1);
146
143
 
147
144
  var GoAButton = function GoAButton(_a) {
148
145
  var title = _a.title,
@@ -185,8 +182,8 @@
185
182
  }), void 0);
186
183
  };
187
184
 
188
- 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";
189
- styleInject(css_248z$1);
185
+ 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";
186
+ styleInject(css_248z);
190
187
 
191
188
  var GoAButtonGroup = function GoAButtonGroup(_a) {
192
189
  var alignment = _a.alignment,
@@ -261,7 +258,7 @@
261
258
  children = _a.children,
262
259
  actions = _a.actions,
263
260
  _b = _a.variant,
264
- variant = _b === void 0 ? 'primary' : _b;
261
+ variant = _b === void 0 ? 'default' : _b;
265
262
  return jsxRuntime.jsxs("goa-container", __assign({
266
263
  variant: variant,
267
264
  headingsize: headingSize
@@ -326,9 +323,6 @@
326
323
  }), void 0);
327
324
  };
328
325
 
329
- var css_248z = "";
330
- styleInject(css_248z);
331
-
332
326
  var GoAFlexRow = function GoAFlexRow(_a) {
333
327
  var gap = _a.gap,
334
328
  minWidth = _a.minWidth,
@@ -478,13 +472,14 @@
478
472
  leadingIcon = _a.leadingIcon,
479
473
  trailingIcon = _a.trailingIcon,
480
474
  _b = _a.variant,
481
- variant = _b === void 0 ? 'goa' : _b;
482
- _a.focused;
483
- var disabled = _a.disabled,
475
+ variant = _b === void 0 ? 'goa' : _b,
476
+ focused = _a.focused,
477
+ disabled = _a.disabled,
484
478
  readonly = _a.readonly,
485
479
  value = _a.value,
486
480
  placeholder = _a.placeholder,
487
481
  error = _a.error,
482
+ testId = _a.testId,
488
483
  onTrailingIconClick = _a.onTrailingIconClick,
489
484
  onChange = _a.onChange;
490
485
  var ref = React.useRef(null);
@@ -500,8 +495,7 @@
500
495
  name = _a.name,
501
496
  value = _a.value;
502
497
  onChange(name, value);
503
- }; // TODO: determinw the propery type of the e (CustomEvent does not work)
504
-
498
+ };
505
499
 
506
500
  var clickListener = function clickListener(e) {
507
501
  onTrailingIconClick === null || onTrailingIconClick === void 0 ? void 0 : onTrailingIconClick();
@@ -509,21 +503,15 @@
509
503
 
510
504
  current.addEventListener('_change', changeListener); // TODO: remove all the `on:` prefixes
511
505
 
512
- current.addEventListener('_ontrailingiconclick', clickListener);
506
+ current.addEventListener('_trailingIconClick', clickListener);
513
507
  return function () {
514
508
  current.removeEventListener('_change', changeListener);
515
- current.removeEventListener('_ontrailingiconclick', clickListener);
509
+ current.removeEventListener('_trailingIconClick', clickListener);
516
510
  };
517
- }, [ref, onChange, onTrailingIconClick]); // useEffect(() => {
518
- // if (focused) {
519
- // inputRef.current?.focus();
520
- // } else {
521
- // inputRef.current?.blur();
522
- // }
523
- // }, [focused, inputRef]);
524
-
511
+ }, [ref, onChange, onTrailingIconClick]);
525
512
  return jsxRuntime.jsx("goa-input", {
526
513
  ref: ref,
514
+ focused: focused,
527
515
  type: type,
528
516
  name: name,
529
517
  id: id,
@@ -534,6 +522,7 @@
534
522
  readonly: readonly,
535
523
  placeholder: placeholder,
536
524
  error: error,
525
+ "data-testid": testId,
537
526
  value: value,
538
527
  handletrailingiconclick: !!onTrailingIconClick
539
528
  }, void 0);
@@ -611,11 +600,8 @@
611
600
  _a.step;
612
601
  var props = __rest(_a, ["step"]);
613
602
 
614
- return jsxRuntime.jsx("input", __assign({}, props, {
615
- type: "range",
616
- onChange: function (e) {
617
- return props.onChange(e.target.name, e.target.value);
618
- }
603
+ return jsxRuntime.jsx(GoAInput, __assign({}, props, {
604
+ type: "range"
619
605
  }), void 0);
620
606
  };
621
607
 
@@ -737,9 +723,11 @@
737
723
  };
738
724
 
739
725
  var GoAServiceLevelHeader = function GoAServiceLevelHeader(_a) {
740
- var level = _a.level;
726
+ var level = _a.level,
727
+ version = _a.version;
741
728
  return jsxRuntime.jsx("goa-service-level-header", {
742
- level: level
729
+ level: level,
730
+ version: version
743
731
  }, void 0);
744
732
  };
745
733