@bcgov-sso/common-react-components 1.6.0 → 1.17.0

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,8 +2,9 @@
2
2
  declare function Accordionpanel({ title, allOpen, setAllOpen, children }: any): JSX.Element;
3
3
  interface Props {
4
4
  children: any;
5
+ open?: boolean;
5
6
  }
6
- declare function Accordion({ children }: Props): JSX.Element;
7
+ declare function Accordion({ children, open }: Props): JSX.Element;
7
8
  declare namespace Accordion {
8
9
  var Panel: typeof Accordionpanel;
9
10
  }
@@ -16,6 +16,7 @@ export declare const styles: {
16
16
  declare type Variant = 'danger' | 'success';
17
17
  interface Props {
18
18
  variant?: Variant;
19
+ content?: string;
19
20
  [key: string]: any;
20
21
  }
21
22
  declare const Alert: (props: Props) => JSX.Element;
@@ -21,9 +21,18 @@ export declare const styles: {
21
21
  primary: {
22
22
  button: string;
23
23
  };
24
+ plainText: {
25
+ button: string;
26
+ };
24
27
  secondary: {
25
28
  button: string;
26
29
  };
30
+ bcPrimary: {
31
+ button: string;
32
+ };
33
+ bcSecondary: {
34
+ button: string;
35
+ };
27
36
  };
28
37
  disabled: string;
29
38
  };
package/dist/esm/index.js CHANGED
@@ -2654,6 +2654,8 @@ var ReactPropTypesSecret$3 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
2654
2654
 
2655
2655
  var ReactPropTypesSecret_1 = ReactPropTypesSecret$3;
2656
2656
 
2657
+ var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
2658
+
2657
2659
  /**
2658
2660
  * Copyright (c) 2013-present, Facebook, Inc.
2659
2661
  *
@@ -2666,7 +2668,7 @@ var printWarning$1 = function() {};
2666
2668
  if (process.env.NODE_ENV !== 'production') {
2667
2669
  var ReactPropTypesSecret$2 = ReactPropTypesSecret_1;
2668
2670
  var loggedTypeFailures = {};
2669
- var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
2671
+ var has$1 = has$2;
2670
2672
 
2671
2673
  printWarning$1 = function(text) {
2672
2674
  var message = 'Warning: ' + text;
@@ -2678,7 +2680,7 @@ if (process.env.NODE_ENV !== 'production') {
2678
2680
  // This error was thrown as a convenience so that you can use this stack
2679
2681
  // to find the callsite that caused this warning to fire.
2680
2682
  throw new Error(message);
2681
- } catch (x) {}
2683
+ } catch (x) { /**/ }
2682
2684
  };
2683
2685
  }
2684
2686
 
@@ -2707,7 +2709,8 @@ function checkPropTypes$1(typeSpecs, values, location, componentName, getStack)
2707
2709
  if (typeof typeSpecs[typeSpecName] !== 'function') {
2708
2710
  var err = Error(
2709
2711
  (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
2710
- 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
2712
+ 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
2713
+ 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
2711
2714
  );
2712
2715
  err.name = 'Invariant Violation';
2713
2716
  throw err;
@@ -2766,9 +2769,9 @@ var ReactIs$1 = reactIs$1.exports;
2766
2769
  var assign = objectAssign;
2767
2770
 
2768
2771
  var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
2772
+ var has = has$2;
2769
2773
  var checkPropTypes = checkPropTypes_1;
2770
2774
 
2771
- var has = Function.call.bind(Object.prototype.hasOwnProperty);
2772
2775
  var printWarning = function() {};
2773
2776
 
2774
2777
  if (process.env.NODE_ENV !== 'production') {
@@ -2869,6 +2872,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
2869
2872
  // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
2870
2873
  var ReactPropTypes = {
2871
2874
  array: createPrimitiveTypeChecker('array'),
2875
+ bigint: createPrimitiveTypeChecker('bigint'),
2872
2876
  bool: createPrimitiveTypeChecker('boolean'),
2873
2877
  func: createPrimitiveTypeChecker('function'),
2874
2878
  number: createPrimitiveTypeChecker('number'),
@@ -2914,8 +2918,9 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
2914
2918
  * is prohibitively expensive if they are created too often, such as what
2915
2919
  * happens in oneOfType() for any type before the one that matched.
2916
2920
  */
2917
- function PropTypeError(message) {
2921
+ function PropTypeError(message, data) {
2918
2922
  this.message = message;
2923
+ this.data = data && typeof data === 'object' ? data: {};
2919
2924
  this.stack = '';
2920
2925
  }
2921
2926
  // Make `instanceof Error` still work for returned errors.
@@ -2950,7 +2955,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
2950
2955
  ) {
2951
2956
  printWarning(
2952
2957
  'You are manually calling a React.PropTypes validation ' +
2953
- 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
2958
+ 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
2954
2959
  'and will throw in the standalone `prop-types` package. ' +
2955
2960
  'You may be seeing this warning due to a third-party PropTypes ' +
2956
2961
  'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
@@ -2989,7 +2994,10 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
2989
2994
  // 'of type `object`'.
2990
2995
  var preciseType = getPreciseType(propValue);
2991
2996
 
2992
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
2997
+ return new PropTypeError(
2998
+ 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
2999
+ {expectedType: expectedType}
3000
+ );
2993
3001
  }
2994
3002
  return null;
2995
3003
  }
@@ -3133,14 +3141,19 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
3133
3141
  }
3134
3142
 
3135
3143
  function validate(props, propName, componentName, location, propFullName) {
3144
+ var expectedTypes = [];
3136
3145
  for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
3137
3146
  var checker = arrayOfTypeCheckers[i];
3138
- if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret$1) == null) {
3147
+ var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret$1);
3148
+ if (checkerResult == null) {
3139
3149
  return null;
3140
3150
  }
3151
+ if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
3152
+ expectedTypes.push(checkerResult.data.expectedType);
3153
+ }
3141
3154
  }
3142
-
3143
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
3155
+ var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
3156
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
3144
3157
  }
3145
3158
  return createChainableTypeChecker(validate);
3146
3159
  }
@@ -3155,6 +3168,13 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
3155
3168
  return createChainableTypeChecker(validate);
3156
3169
  }
3157
3170
 
3171
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
3172
+ return new PropTypeError(
3173
+ (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
3174
+ 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
3175
+ );
3176
+ }
3177
+
3158
3178
  function createShapeTypeChecker(shapeTypes) {
3159
3179
  function validate(props, propName, componentName, location, propFullName) {
3160
3180
  var propValue = props[propName];
@@ -3164,8 +3184,8 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
3164
3184
  }
3165
3185
  for (var key in shapeTypes) {
3166
3186
  var checker = shapeTypes[key];
3167
- if (!checker) {
3168
- continue;
3187
+ if (typeof checker !== 'function') {
3188
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
3169
3189
  }
3170
3190
  var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
3171
3191
  if (error) {
@@ -3184,16 +3204,18 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
3184
3204
  if (propType !== 'object') {
3185
3205
  return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
3186
3206
  }
3187
- // We need to check all keys in case some are required but missing from
3188
- // props.
3207
+ // We need to check all keys in case some are required but missing from props.
3189
3208
  var allKeys = assign({}, props[propName], shapeTypes);
3190
3209
  for (var key in allKeys) {
3191
3210
  var checker = shapeTypes[key];
3211
+ if (has(shapeTypes, key) && typeof checker !== 'function') {
3212
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
3213
+ }
3192
3214
  if (!checker) {
3193
3215
  return new PropTypeError(
3194
3216
  'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
3195
3217
  '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
3196
- '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
3218
+ '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
3197
3219
  );
3198
3220
  }
3199
3221
  var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
@@ -3378,6 +3400,7 @@ var factoryWithThrowingShims = function() {
3378
3400
  // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
3379
3401
  var ReactPropTypes = {
3380
3402
  array: shim,
3403
+ bigint: shim,
3381
3404
  bool: shim,
3382
3405
  func: shim,
3383
3406
  number: shim,
@@ -3884,14 +3907,16 @@ const ActionsContainer = styled.div `
3884
3907
  color: ${SECONDARY_BLUE};
3885
3908
  & span {
3886
3909
  cursor: pointer;
3910
+ text-decoration: underline;
3887
3911
  }
3888
3912
  `;
3889
3913
  const Divider = styled.span `
3890
3914
  border-right: 1px solid black;
3891
- margin: 0 9px;
3915
+ height: 1em;
3916
+ margin: auto 0.5em;
3892
3917
  `;
3893
- function Accordion({ children }) {
3894
- const [allOpen, setAllOpen] = useState(null);
3918
+ function Accordion({ children, open = false }) {
3919
+ const [allOpen, setAllOpen] = useState(open);
3895
3920
  console.log(LANDING_HEADER_FONT);
3896
3921
  const handleClose = () => {
3897
3922
  setAllOpen(false);
@@ -3927,31 +3952,28 @@ const Line = styled.div `
3927
3952
  border-left: 1px solid #bcbcbc;
3928
3953
  margin-left: calc(${(props) => props.circleDiameter} / 2);
3929
3954
  `;
3930
- const ContentContainer = styled.div `
3931
- display: grid;
3932
- grid-template-columns: 50px 1fr;
3955
+ const Title = styled.h2 `
3956
+ margin: auto 0;
3957
+ color: ${(props) => (props.variant === 'primary' ? 'black' : '#777777')};
3958
+ font-size: ${(props) => (props.variant === 'primary' ? '22px' : '18px')};
3933
3959
  `;
3934
- const TitleContainer = styled.div `
3935
- display: flex;
3936
- align-items: center;
3937
- flex-direction: row;
3938
-
3939
- & h2 {
3940
- margin: 0;
3941
- color: ${(props) => (props.variant === 'primary' ? 'black' : '#777777')};
3942
- font-size: ${(props) => (props.variant === 'primary' ? '22px' : '18px')};
3943
- }
3960
+ const Grid = styled.div `
3961
+ display: grid;
3962
+ grid-template-columns: ${(props) => props.numberedSectionWidth} 1fr;
3963
+ grid-template-rows: ${(props) => props.numberedSectionHeight} 1fr;
3944
3964
  `;
3945
- function NumberedContents({ number, title, children, showLine = true, circleDiameter = '40px', circleMargin = '10px', variant = 'primary', }) {
3946
- return (React.createElement("div", null,
3947
- React.createElement(TitleContainer, { variant: variant },
3948
- React.createElement(Circle, { variant: variant, circleDiameter: circleDiameter, circleMargin: circleMargin }, number),
3949
- React.createElement("h2", null,
3950
- title,
3951
- "\u00A0")),
3952
- React.createElement(ContentContainer, null,
3953
- showLine ? React.createElement(Line, { circleDiameter: circleDiameter }) : React.createElement("span", null),
3954
- React.createElement("div", null, children))));
3965
+ function NumberedContents({ number, title, children, showLine = true, circleDiameter = '40px', circleMargin = '5px', variant = 'primary', }) {
3966
+ const circleDiameterInt = Number(circleDiameter.slice(0, -2));
3967
+ const circleMarginInt = Number(circleMargin.slice(0, -2));
3968
+ const numberedSectionWidth = `${circleDiameterInt + circleMarginInt * 2}px`;
3969
+ const numberedSectionHeight = `${circleDiameterInt + circleMarginInt * 2}px`;
3970
+ return (React.createElement(Grid, { numberedSectionWidth: numberedSectionWidth, numberedSectionHeight: numberedSectionHeight },
3971
+ React.createElement(Circle, { variant: variant, circleDiameter: circleDiameter, circleMargin: circleMargin }, number),
3972
+ React.createElement(Title, { variant: variant },
3973
+ title,
3974
+ "\u00A0"),
3975
+ showLine ? React.createElement(Line, { circleDiameter: circleDiameter }) : React.createElement("span", null),
3976
+ React.createElement("div", null, children)));
3955
3977
  }
3956
3978
 
3957
3979
  var Button$2 = {};
@@ -3965,8 +3987,7 @@ function _interopRequireDefault(obj) {
3965
3987
  };
3966
3988
  }
3967
3989
 
3968
- module.exports = _interopRequireDefault;
3969
- module.exports["default"] = module.exports, module.exports.__esModule = true;
3990
+ module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
3970
3991
  }(interopRequireDefault));
3971
3992
 
3972
3993
  function _extends() {
@@ -8341,14 +8362,61 @@ const styles$1 = {
8341
8362
  button: `
8342
8363
  background-color: #1a4dff;
8343
8364
  color: #e8edff;
8365
+ `,
8366
+ },
8367
+ plainText: {
8368
+ button: `
8369
+ background-color: unset;
8370
+ color: #0139ff;
8344
8371
  `,
8345
8372
  },
8346
8373
  secondary: {
8347
8374
  button: `
8348
- border: 3px solid #1a4dff;
8375
+ box-shadow: 0px 0px 0px 3px #1a4dff inset;
8349
8376
  color: #1a4dff;
8350
8377
  background-color: #ffffff;
8351
8378
 
8379
+ `,
8380
+ },
8381
+ bcPrimary: {
8382
+ button: `
8383
+ background-color: #003366;
8384
+ box-shadow: 0px 0px 0px 2px #003366 inset !important;
8385
+ color: #fff;
8386
+ border-radius: 0.222em;
8387
+ &:hover {
8388
+ text-decoration: underline;
8389
+ opacity: 0.80;
8390
+ }
8391
+ &:focus {
8392
+ outline: 4px solid #3B99FC;
8393
+ outline-offset: 1px;
8394
+ }
8395
+ &:active {
8396
+ opacity: 1;
8397
+ }
8398
+ &:disabled {
8399
+ background-color: #003366;
8400
+ box-shadow: 0px 0px 0px 2px #fff inset !important;
8401
+ color: #fff;
8402
+ cursor: not-allowed;
8403
+ opacity: 0.3;
8404
+ &:hover {
8405
+ text-decoration: none;
8406
+ }
8407
+ }
8408
+ `,
8409
+ },
8410
+ bcSecondary: {
8411
+ button: `
8412
+ background-color: #b2b2b2;
8413
+ border-radius: 0.222em;
8414
+ color: white;
8415
+ box-shadow: none !important;
8416
+
8417
+ &:hover {
8418
+ background-color: #b2b2b2;
8419
+ }
8352
8420
  `,
8353
8421
  },
8354
8422
  },
@@ -8375,25 +8443,14 @@ var _typeof = {exports: {}};
8375
8443
  function _typeof(obj) {
8376
8444
  "@babel/helpers - typeof";
8377
8445
 
8378
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
8379
- module.exports = _typeof = function _typeof(obj) {
8380
- return typeof obj;
8381
- };
8382
-
8383
- module.exports["default"] = module.exports, module.exports.__esModule = true;
8384
- } else {
8385
- module.exports = _typeof = function _typeof(obj) {
8386
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
8387
- };
8388
-
8389
- module.exports["default"] = module.exports, module.exports.__esModule = true;
8390
- }
8391
-
8392
- return _typeof(obj);
8446
+ return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
8447
+ return typeof obj;
8448
+ } : function (obj) {
8449
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
8450
+ }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
8393
8451
  }
8394
8452
 
8395
- module.exports = _typeof;
8396
- module.exports["default"] = module.exports, module.exports.__esModule = true;
8453
+ module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
8397
8454
  }(_typeof));
8398
8455
 
8399
8456
  (function (module) {
@@ -8449,8 +8506,7 @@ function _interopRequireWildcard(obj, nodeInterop) {
8449
8506
  return newObj;
8450
8507
  }
8451
8508
 
8452
- module.exports = _interopRequireWildcard;
8453
- module.exports["default"] = module.exports, module.exports.__esModule = true;
8509
+ module.exports = _interopRequireWildcard, module.exports.__esModule = true, module.exports["default"] = module.exports;
8454
8510
  }(interopRequireWildcard));
8455
8511
 
8456
8512
  var _interopRequireDefault = interopRequireDefault.exports;
@@ -8642,12 +8698,12 @@ const styles = {
8642
8698
  variant: {
8643
8699
  danger: {
8644
8700
  container: `
8645
- background-color: #FEE8E6;
8701
+ background-color: #EAC2C1;
8646
8702
  `,
8647
8703
  },
8648
8704
  success: {
8649
8705
  container: `
8650
- background-color: #E5F9E6;
8706
+ background-color: #C4D8CF;
8651
8707
  `,
8652
8708
  },
8653
8709
  },
@@ -8684,6 +8740,7 @@ const Alert = (props) => (React.createElement(DefaultAlert, Object.assign({}, pr
8684
8740
  props.variant === 'success' && SuccessIcon,
8685
8741
  props.variant === 'danger' && DangerIcon,
8686
8742
  props.children,
8743
+ props.content,
8687
8744
  React.createElement(DefaultAlert.Close, null, "X")));
8688
8745
 
8689
8746
  export { Accordion, Alert, Button, NumberedContents };