@abgov/react-components 3.4.0-alpha.15 → 3.4.0-alpha.18

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.
@@ -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.15",
3
+ "version": "3.4.0-alpha.18",
4
4
  "description": "Government of Alberta - UI components for React",
5
5
  "bugs": {
6
6
  "url": "https://github.com/GovAlta/ui-components/issues"
@@ -469,6 +469,7 @@ const GoAInput = ({
469
469
  value,
470
470
  placeholder,
471
471
  error,
472
+ testId,
472
473
  onTrailingIconClick,
473
474
  onChange
474
475
  }) => {
@@ -486,8 +487,7 @@ const GoAInput = ({
486
487
  value
487
488
  } = e.detail.data;
488
489
  onChange(name, value);
489
- }; // TODO: determinw the propery type of the e (CustomEvent does not work)
490
-
490
+ };
491
491
 
492
492
  const clickListener = e => {
493
493
  onTrailingIconClick === null || onTrailingIconClick === void 0 ? void 0 : onTrailingIconClick();
@@ -495,21 +495,15 @@ const GoAInput = ({
495
495
 
496
496
  current.addEventListener('_change', changeListener); // TODO: remove all the `on:` prefixes
497
497
 
498
- current.addEventListener('_ontrailingiconclick', clickListener);
498
+ current.addEventListener('_trailingIconClick', clickListener);
499
499
  return () => {
500
500
  current.removeEventListener('_change', changeListener);
501
- current.removeEventListener('_ontrailingiconclick', clickListener);
501
+ current.removeEventListener('_trailingIconClick', clickListener);
502
502
  };
503
- }, [ref, onChange, onTrailingIconClick]); // useEffect(() => {
504
- // if (focused) {
505
- // inputRef.current?.focus();
506
- // } else {
507
- // inputRef.current?.blur();
508
- // }
509
- // }, [focused, inputRef]);
510
-
503
+ }, [ref, onChange, onTrailingIconClick]);
511
504
  return jsx("goa-input", {
512
505
  ref: ref,
506
+ focused: focused,
513
507
  type: type,
514
508
  name: name,
515
509
  id: id,
@@ -520,6 +514,7 @@ const GoAInput = ({
520
514
  readonly: readonly,
521
515
  placeholder: placeholder,
522
516
  error: error,
517
+ "data-testid": testId,
523
518
  value: value,
524
519
  handletrailingiconclick: !!onTrailingIconClick
525
520
  }, void 0);
@@ -594,9 +589,8 @@ const GoAInputNumber = props => {
594
589
  const GoAInputRange = _a => {
595
590
  var props = __rest(_a, ["step"]);
596
591
 
597
- return jsx("input", Object.assign({}, props, {
598
- type: "range",
599
- onChange: e => props.onChange(e.target.name, e.target.value)
592
+ return jsx(GoAInput, Object.assign({}, props, {
593
+ type: "range"
600
594
  }), void 0);
601
595
  };
602
596
 
@@ -721,10 +715,12 @@ const GoARadioGroup = ({
721
715
  };
722
716
 
723
717
  const GoAServiceLevelHeader = ({
724
- level
718
+ level,
719
+ version
725
720
  }) => {
726
721
  return jsx("goa-service-level-header", {
727
- level: level
722
+ level: level,
723
+ version: version
728
724
  }, void 0);
729
725
  };
730
726
 
@@ -472,13 +472,14 @@
472
472
  leadingIcon = _a.leadingIcon,
473
473
  trailingIcon = _a.trailingIcon,
474
474
  _b = _a.variant,
475
- variant = _b === void 0 ? 'goa' : _b;
476
- _a.focused;
477
- var disabled = _a.disabled,
475
+ variant = _b === void 0 ? 'goa' : _b,
476
+ focused = _a.focused,
477
+ disabled = _a.disabled,
478
478
  readonly = _a.readonly,
479
479
  value = _a.value,
480
480
  placeholder = _a.placeholder,
481
481
  error = _a.error,
482
+ testId = _a.testId,
482
483
  onTrailingIconClick = _a.onTrailingIconClick,
483
484
  onChange = _a.onChange;
484
485
  var ref = React.useRef(null);
@@ -494,8 +495,7 @@
494
495
  name = _a.name,
495
496
  value = _a.value;
496
497
  onChange(name, value);
497
- }; // TODO: determinw the propery type of the e (CustomEvent does not work)
498
-
498
+ };
499
499
 
500
500
  var clickListener = function clickListener(e) {
501
501
  onTrailingIconClick === null || onTrailingIconClick === void 0 ? void 0 : onTrailingIconClick();
@@ -503,21 +503,15 @@
503
503
 
504
504
  current.addEventListener('_change', changeListener); // TODO: remove all the `on:` prefixes
505
505
 
506
- current.addEventListener('_ontrailingiconclick', clickListener);
506
+ current.addEventListener('_trailingIconClick', clickListener);
507
507
  return function () {
508
508
  current.removeEventListener('_change', changeListener);
509
- current.removeEventListener('_ontrailingiconclick', clickListener);
509
+ current.removeEventListener('_trailingIconClick', clickListener);
510
510
  };
511
- }, [ref, onChange, onTrailingIconClick]); // useEffect(() => {
512
- // if (focused) {
513
- // inputRef.current?.focus();
514
- // } else {
515
- // inputRef.current?.blur();
516
- // }
517
- // }, [focused, inputRef]);
518
-
511
+ }, [ref, onChange, onTrailingIconClick]);
519
512
  return jsxRuntime.jsx("goa-input", {
520
513
  ref: ref,
514
+ focused: focused,
521
515
  type: type,
522
516
  name: name,
523
517
  id: id,
@@ -528,6 +522,7 @@
528
522
  readonly: readonly,
529
523
  placeholder: placeholder,
530
524
  error: error,
525
+ "data-testid": testId,
531
526
  value: value,
532
527
  handletrailingiconclick: !!onTrailingIconClick
533
528
  }, void 0);
@@ -605,11 +600,8 @@
605
600
  _a.step;
606
601
  var props = __rest(_a, ["step"]);
607
602
 
608
- return jsxRuntime.jsx("input", __assign({}, props, {
609
- type: "range",
610
- onChange: function (e) {
611
- return props.onChange(e.target.name, e.target.value);
612
- }
603
+ return jsxRuntime.jsx(GoAInput, __assign({}, props, {
604
+ type: "range"
613
605
  }), void 0);
614
606
  };
615
607
 
@@ -731,9 +723,11 @@
731
723
  };
732
724
 
733
725
  var GoAServiceLevelHeader = function GoAServiceLevelHeader(_a) {
734
- var level = _a.level;
726
+ var level = _a.level,
727
+ version = _a.version;
735
728
  return jsxRuntime.jsx("goa-service-level-header", {
736
- level: level
729
+ level: level,
730
+ version: version
737
731
  }, void 0);
738
732
  };
739
733