@abgov/react-components 4.0.0-alpha.69 → 4.0.0-alpha.70

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,8 +1,9 @@
1
1
  import React, { FC } from 'react';
2
- import { IconSize, GoAIconType, IconVariant } from './icon';
2
+ import { IconSize, GoAIconType } from './icon';
3
+ declare type IconVariant = 'color' | 'nocolor';
3
4
  interface WCProps {
4
5
  ref: React.RefObject<HTMLElement>;
5
- type: GoAIconType;
6
+ icon: GoAIconType;
6
7
  size?: IconSize;
7
8
  variant?: IconVariant;
8
9
  title?: string;
@@ -16,13 +17,13 @@ declare global {
16
17
  }
17
18
  }
18
19
  interface Props {
19
- type: GoAIconType;
20
+ icon: GoAIconType;
20
21
  size?: IconSize;
21
22
  variant?: IconVariant;
22
23
  title?: string;
23
24
  disabled?: boolean;
24
25
  children?: React.ReactNode;
25
- onClick: () => void;
26
+ onClick?: () => void;
26
27
  }
27
28
  export declare const GoAIconButton: FC<Props>;
28
29
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/react-components",
3
- "version": "4.0.0-alpha.69",
3
+ "version": "4.0.0-alpha.70",
4
4
  "description": "Government of Alberta - UI components for React",
5
5
  "bugs": {
6
6
  "url": "https://github.com/GovAlta/ui-components/issues"
@@ -7646,7 +7646,7 @@ function create_fragment$h(ctx) {
7646
7646
  /*title*/
7647
7647
  ctx[3]);
7648
7648
  set_custom_element_data(goa_icon, "type",
7649
- /*type*/
7649
+ /*icon*/
7650
7650
  ctx[0]);
7651
7651
  set_custom_element_data(goa_icon, "size",
7652
7652
  /*size*/
@@ -7694,10 +7694,10 @@ function create_fragment$h(ctx) {
7694
7694
  }
7695
7695
 
7696
7696
  if (dirty &
7697
- /*type*/
7697
+ /*icon*/
7698
7698
  1) {
7699
7699
  set_custom_element_data(goa_icon, "type",
7700
- /*type*/
7700
+ /*icon*/
7701
7701
  ctx[0]);
7702
7702
  }
7703
7703
 
@@ -7795,7 +7795,7 @@ function instance$f($$self, $$props, $$invalidate) {
7795
7795
  let _size;
7796
7796
 
7797
7797
  let {
7798
- type
7798
+ icon
7799
7799
  } = $$props;
7800
7800
  let {
7801
7801
  size = "medium"
@@ -7820,7 +7820,7 @@ function instance$f($$self, $$props, $$invalidate) {
7820
7820
  } = $$props;
7821
7821
 
7822
7822
  $$self.$$set = $$props => {
7823
- if ('type' in $$props) $$invalidate(0, type = $$props.type);
7823
+ if ('icon' in $$props) $$invalidate(0, icon = $$props.icon);
7824
7824
  if ('size' in $$props) $$invalidate(1, size = $$props.size);
7825
7825
  if ('theme' in $$props) $$invalidate(2, theme = $$props.theme);
7826
7826
  if ('variant' in $$props) $$invalidate(9, variant = $$props.variant);
@@ -7861,19 +7861,19 @@ function instance$f($$self, $$props, $$invalidate) {
7861
7861
  }
7862
7862
  };
7863
7863
 
7864
- return [type, size, theme, title, testId, isInverted, _size, isDisabled, css, variant, disabled, inverted];
7864
+ return [icon, size, theme, title, testId, isInverted, _size, isDisabled, css, variant, disabled, inverted];
7865
7865
  }
7866
7866
 
7867
7867
  class IconButton extends SvelteElement {
7868
7868
  constructor(options) {
7869
7869
  super();
7870
- this.shadowRoot.innerHTML = `<style>:host{display:inline-flex;align-items:center;box-sizing:border-box;font-family:var(--font-family)}button,button *{box-sizing:border-box}button{display:inline-flex;align-items:center;justify-content:center;background:transparent;cursor:pointer;border:none}.color{border-radius:0.5rem;padding:calc(var(--size) / 4)}.color{border-radius:0.5rem;color:var(--goa-color-interactive);fill:var(--goa-color-interactive);cursor:pointer;transition:background-color 100ms ease-in, transform 100ms ease-in}.color:active,.nocolor:active{transform:scale(0.9);border:none}.color:hover{background-color:var(--goa-color-primary-light)}.color.inverted:hover{background-color:var(--goa-color-primary-dark)}button:disabled{color:var(--color-gray-200);fill:var(--color-gray-200);transform:none;cursor:default}button:disabled:hover{background-color:transparent}</style>`;
7870
+ this.shadowRoot.innerHTML = `<style>:host{display:inline-flex;align-items:center;box-sizing:border-box;font-family:var(--font-family)}button,button *{box-sizing:border-box}button{display:inline-flex;align-items:center;box-sizing:border-box;justify-content:center;background:transparent;cursor:pointer;border:none;padding:0 0.75rem}.color{border-radius:0.5rem;padding:calc(var(--size) / 4);color:var(--goa-color-interactive);fill:var(--goa-color-interactive);cursor:pointer;transition:background-color 100ms ease-in, transform 100ms ease-in}.nocolor{border-radius:0.5rem;padding:calc(var(--size) / 4)}button:hover{background-color:var(--color-gray-100);border-color:var(--color-gray-100);color:var(--goa-color-interactive--hover);outline:none}button:focus,button:active{background-color:var(--color-gray-100);border-color:var(--goa-color-interactive--active);color:var(--goa-color-interactive--active);box-shadow:0 0 0 3px var(--goa-color-interactive--focus);outline:none}.color.inverted:hover{background-color:var(--goa-color-primary-dark)}button:disabled{pointer-events:none;opacity:0.5;transform:none;cursor:default}button:disabled:hover{background-color:transparent}</style>`;
7871
7871
  init(this, {
7872
7872
  target: this.shadowRoot,
7873
7873
  props: attribute_to_object(this.attributes),
7874
7874
  customElement: true
7875
7875
  }, instance$f, create_fragment$h, safe_not_equal, {
7876
- type: 0,
7876
+ icon: 0,
7877
7877
  size: 1,
7878
7878
  theme: 2,
7879
7879
  variant: 9,
@@ -7896,16 +7896,16 @@ class IconButton extends SvelteElement {
7896
7896
  }
7897
7897
 
7898
7898
  static get observedAttributes() {
7899
- return ["type", "size", "theme", "variant", "title", "testId", "disabled", "inverted"];
7899
+ return ["icon", "size", "theme", "variant", "title", "testId", "disabled", "inverted"];
7900
7900
  }
7901
7901
 
7902
- get type() {
7902
+ get icon() {
7903
7903
  return this.$$.ctx[0];
7904
7904
  }
7905
7905
 
7906
- set type(type) {
7906
+ set icon(icon) {
7907
7907
  this.$$set({
7908
- type
7908
+ icon
7909
7909
  });
7910
7910
  flush();
7911
7911
  }
@@ -8458,7 +8458,7 @@ function create_if_block_4(ctx) {
8458
8458
  ctx[19]);
8459
8459
  set_custom_element_data(goa_icon_button, "variant", "nocolor");
8460
8460
  set_custom_element_data(goa_icon_button, "size", "medium");
8461
- set_custom_element_data(goa_icon_button, "type",
8461
+ set_custom_element_data(goa_icon_button, "icon",
8462
8462
  /*trailingicon*/
8463
8463
  ctx[6]);
8464
8464
  set_custom_element_data(goa_icon_button, "data-testid", "trailing-icon-button");
@@ -8485,7 +8485,7 @@ function create_if_block_4(ctx) {
8485
8485
  if (dirty[0] &
8486
8486
  /*trailingicon*/
8487
8487
  64) {
8488
- set_custom_element_data(goa_icon_button, "type",
8488
+ set_custom_element_data(goa_icon_button, "icon",
8489
8489
  /*trailingicon*/
8490
8490
  ctx[6]);
8491
8491
  }
@@ -10272,7 +10272,7 @@ function create_if_block_2$2(ctx) {
10272
10272
  div = element("div");
10273
10273
  goa_icon_button = element("goa-icon-button");
10274
10274
  set_custom_element_data(goa_icon_button, "data-testid", "modal-close-button");
10275
- set_custom_element_data(goa_icon_button, "type", "close");
10275
+ set_custom_element_data(goa_icon_button, "icon", "close");
10276
10276
  attr(div, "class", "modal-close");
10277
10277
  },
10278
10278
 
@@ -10618,7 +10618,7 @@ function create_if_block$4(ctx) {
10618
10618
  set_custom_element_data(goa_icon, "inverted", "");
10619
10619
  attr(div0, "class", "icon");
10620
10620
  attr(div1, "class", "content");
10621
- set_custom_element_data(goa_icon_button, "type", "close");
10621
+ set_custom_element_data(goa_icon_button, "icon", "close");
10622
10622
  set_custom_element_data(goa_icon_button, "inverted", "");
10623
10623
  attr(div2, "class", "close");
10624
10624
  attr(div3, "class", div3_class_value = "notification " +
@@ -14668,9 +14668,9 @@ function GoAIcon({
14668
14668
  }
14669
14669
 
14670
14670
  const GoAIconButton = ({
14671
- type,
14671
+ icon,
14672
14672
  disabled,
14673
- variant: _variant = 'primary',
14673
+ variant: _variant = 'color',
14674
14674
  onClick,
14675
14675
  size: _size = 'medium',
14676
14676
  title,
@@ -14682,6 +14682,10 @@ const GoAIconButton = ({
14682
14682
  return;
14683
14683
  }
14684
14684
 
14685
+ if (!onClick) {
14686
+ return;
14687
+ }
14688
+
14685
14689
  const current = ref.current;
14686
14690
 
14687
14691
  const listener = e => {
@@ -14695,7 +14699,7 @@ const GoAIconButton = ({
14695
14699
  }, [ref, onClick]);
14696
14700
  return jsx("goa-icon-button", Object.assign({
14697
14701
  ref: ref,
14698
- type: type,
14702
+ icon: icon,
14699
14703
  disabled: disabled,
14700
14704
  variant: _variant,
14701
14705
  size: _size,
@@ -7693,7 +7693,7 @@
7693
7693
  /*title*/
7694
7694
  ctx[3]);
7695
7695
  set_custom_element_data(goa_icon, "type",
7696
- /*type*/
7696
+ /*icon*/
7697
7697
  ctx[0]);
7698
7698
  set_custom_element_data(goa_icon, "size",
7699
7699
  /*size*/
@@ -7741,10 +7741,10 @@
7741
7741
  }
7742
7742
 
7743
7743
  if (dirty &
7744
- /*type*/
7744
+ /*icon*/
7745
7745
  1) {
7746
7746
  set_custom_element_data(goa_icon, "type",
7747
- /*type*/
7747
+ /*icon*/
7748
7748
  ctx[0]);
7749
7749
  }
7750
7750
 
@@ -7842,7 +7842,7 @@
7842
7842
  let _size;
7843
7843
 
7844
7844
  let {
7845
- type
7845
+ icon
7846
7846
  } = $$props;
7847
7847
  let {
7848
7848
  size = "medium"
@@ -7867,7 +7867,7 @@
7867
7867
  } = $$props;
7868
7868
 
7869
7869
  $$self.$$set = $$props => {
7870
- if ('type' in $$props) $$invalidate(0, type = $$props.type);
7870
+ if ('icon' in $$props) $$invalidate(0, icon = $$props.icon);
7871
7871
  if ('size' in $$props) $$invalidate(1, size = $$props.size);
7872
7872
  if ('theme' in $$props) $$invalidate(2, theme = $$props.theme);
7873
7873
  if ('variant' in $$props) $$invalidate(9, variant = $$props.variant);
@@ -7908,19 +7908,19 @@
7908
7908
  }
7909
7909
  };
7910
7910
 
7911
- return [type, size, theme, title, testId, isInverted, _size, isDisabled, css, variant, disabled, inverted];
7911
+ return [icon, size, theme, title, testId, isInverted, _size, isDisabled, css, variant, disabled, inverted];
7912
7912
  }
7913
7913
 
7914
7914
  class IconButton extends SvelteElement {
7915
7915
  constructor(options) {
7916
7916
  super();
7917
- this.shadowRoot.innerHTML = `<style>:host{display:inline-flex;align-items:center;box-sizing:border-box;font-family:var(--font-family)}button,button *{box-sizing:border-box}button{display:inline-flex;align-items:center;justify-content:center;background:transparent;cursor:pointer;border:none}.color{border-radius:0.5rem;padding:calc(var(--size) / 4)}.color{border-radius:0.5rem;color:var(--goa-color-interactive);fill:var(--goa-color-interactive);cursor:pointer;transition:background-color 100ms ease-in, transform 100ms ease-in}.color:active,.nocolor:active{transform:scale(0.9);border:none}.color:hover{background-color:var(--goa-color-primary-light)}.color.inverted:hover{background-color:var(--goa-color-primary-dark)}button:disabled{color:var(--color-gray-200);fill:var(--color-gray-200);transform:none;cursor:default}button:disabled:hover{background-color:transparent}</style>`;
7917
+ this.shadowRoot.innerHTML = `<style>:host{display:inline-flex;align-items:center;box-sizing:border-box;font-family:var(--font-family)}button,button *{box-sizing:border-box}button{display:inline-flex;align-items:center;box-sizing:border-box;justify-content:center;background:transparent;cursor:pointer;border:none;padding:0 0.75rem}.color{border-radius:0.5rem;padding:calc(var(--size) / 4);color:var(--goa-color-interactive);fill:var(--goa-color-interactive);cursor:pointer;transition:background-color 100ms ease-in, transform 100ms ease-in}.nocolor{border-radius:0.5rem;padding:calc(var(--size) / 4)}button:hover{background-color:var(--color-gray-100);border-color:var(--color-gray-100);color:var(--goa-color-interactive--hover);outline:none}button:focus,button:active{background-color:var(--color-gray-100);border-color:var(--goa-color-interactive--active);color:var(--goa-color-interactive--active);box-shadow:0 0 0 3px var(--goa-color-interactive--focus);outline:none}.color.inverted:hover{background-color:var(--goa-color-primary-dark)}button:disabled{pointer-events:none;opacity:0.5;transform:none;cursor:default}button:disabled:hover{background-color:transparent}</style>`;
7918
7918
  init(this, {
7919
7919
  target: this.shadowRoot,
7920
7920
  props: attribute_to_object(this.attributes),
7921
7921
  customElement: true
7922
7922
  }, instance$f, create_fragment$h, safe_not_equal, {
7923
- type: 0,
7923
+ icon: 0,
7924
7924
  size: 1,
7925
7925
  theme: 2,
7926
7926
  variant: 9,
@@ -7943,16 +7943,16 @@
7943
7943
  }
7944
7944
 
7945
7945
  static get observedAttributes() {
7946
- return ["type", "size", "theme", "variant", "title", "testId", "disabled", "inverted"];
7946
+ return ["icon", "size", "theme", "variant", "title", "testId", "disabled", "inverted"];
7947
7947
  }
7948
7948
 
7949
- get type() {
7949
+ get icon() {
7950
7950
  return this.$$.ctx[0];
7951
7951
  }
7952
7952
 
7953
- set type(type) {
7953
+ set icon(icon) {
7954
7954
  this.$$set({
7955
- type
7955
+ icon
7956
7956
  });
7957
7957
  flush();
7958
7958
  }
@@ -8505,7 +8505,7 @@
8505
8505
  ctx[19]);
8506
8506
  set_custom_element_data(goa_icon_button, "variant", "nocolor");
8507
8507
  set_custom_element_data(goa_icon_button, "size", "medium");
8508
- set_custom_element_data(goa_icon_button, "type",
8508
+ set_custom_element_data(goa_icon_button, "icon",
8509
8509
  /*trailingicon*/
8510
8510
  ctx[6]);
8511
8511
  set_custom_element_data(goa_icon_button, "data-testid", "trailing-icon-button");
@@ -8532,7 +8532,7 @@
8532
8532
  if (dirty[0] &
8533
8533
  /*trailingicon*/
8534
8534
  64) {
8535
- set_custom_element_data(goa_icon_button, "type",
8535
+ set_custom_element_data(goa_icon_button, "icon",
8536
8536
  /*trailingicon*/
8537
8537
  ctx[6]);
8538
8538
  }
@@ -10319,7 +10319,7 @@
10319
10319
  div = element("div");
10320
10320
  goa_icon_button = element("goa-icon-button");
10321
10321
  set_custom_element_data(goa_icon_button, "data-testid", "modal-close-button");
10322
- set_custom_element_data(goa_icon_button, "type", "close");
10322
+ set_custom_element_data(goa_icon_button, "icon", "close");
10323
10323
  attr(div, "class", "modal-close");
10324
10324
  },
10325
10325
 
@@ -10665,7 +10665,7 @@
10665
10665
  set_custom_element_data(goa_icon, "inverted", "");
10666
10666
  attr(div0, "class", "icon");
10667
10667
  attr(div1, "class", "content");
10668
- set_custom_element_data(goa_icon_button, "type", "close");
10668
+ set_custom_element_data(goa_icon_button, "icon", "close");
10669
10669
  set_custom_element_data(goa_icon_button, "inverted", "");
10670
10670
  attr(div2, "class", "close");
10671
10671
  attr(div3, "class", div3_class_value = "notification " +
@@ -14741,10 +14741,10 @@
14741
14741
  }
14742
14742
 
14743
14743
  var GoAIconButton = function GoAIconButton(_a) {
14744
- var type = _a.type,
14744
+ var icon = _a.icon,
14745
14745
  disabled = _a.disabled,
14746
14746
  _b = _a.variant,
14747
- variant = _b === void 0 ? 'primary' : _b,
14747
+ variant = _b === void 0 ? 'color' : _b,
14748
14748
  onClick = _a.onClick,
14749
14749
  _c = _a.size,
14750
14750
  size = _c === void 0 ? 'medium' : _c,
@@ -14756,6 +14756,10 @@
14756
14756
  return;
14757
14757
  }
14758
14758
 
14759
+ if (!onClick) {
14760
+ return;
14761
+ }
14762
+
14759
14763
  var current = ref.current;
14760
14764
 
14761
14765
  var listener = function listener(e) {
@@ -14769,7 +14773,7 @@
14769
14773
  }, [ref, onClick]);
14770
14774
  return jsxRuntime.jsx("goa-icon-button", __assign({
14771
14775
  ref: ref,
14772
- type: type,
14776
+ icon: icon,
14773
14777
  disabled: disabled,
14774
14778
  variant: variant,
14775
14779
  size: size,