@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.
package/README.md CHANGED
@@ -6,12 +6,11 @@ See the github pages link for a storybook instance of components.
6
6
  ## Workflow
7
7
 
8
8
  **Storybook**: This repository has branched-based deployments for the storybook instance. To update
9
- storybook, merge in a feature branch to the `dev` branch.
9
+ storybook, merge in a feature branch to the `main` branch.
10
10
 
11
- **NPM**: Components will be published to NPM when creating a new release. To release the components
12
- on the dev branch:
11
+ **NPM**: Components will be published to NPM when creating a new release. To release the components:
13
12
 
14
- 1. Merge `dev` into `main`. This will automatically bump the package version based on the commits and generate a tag for the release.
13
+ 1. Merge your feature branch into `main`. This will automatically bump the package version based on the commits and generate a tag for the release.
15
14
  2. Create a new [release](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository) using the generated tag.
16
15
 
17
16
  ## Adding Components
package/dist/cjs/index.js CHANGED
@@ -2662,6 +2662,8 @@ var ReactPropTypesSecret$3 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
2662
2662
 
2663
2663
  var ReactPropTypesSecret_1 = ReactPropTypesSecret$3;
2664
2664
 
2665
+ var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
2666
+
2665
2667
  /**
2666
2668
  * Copyright (c) 2013-present, Facebook, Inc.
2667
2669
  *
@@ -2674,7 +2676,7 @@ var printWarning$1 = function() {};
2674
2676
  if (process.env.NODE_ENV !== 'production') {
2675
2677
  var ReactPropTypesSecret$2 = ReactPropTypesSecret_1;
2676
2678
  var loggedTypeFailures = {};
2677
- var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
2679
+ var has$1 = has$2;
2678
2680
 
2679
2681
  printWarning$1 = function(text) {
2680
2682
  var message = 'Warning: ' + text;
@@ -2686,7 +2688,7 @@ if (process.env.NODE_ENV !== 'production') {
2686
2688
  // This error was thrown as a convenience so that you can use this stack
2687
2689
  // to find the callsite that caused this warning to fire.
2688
2690
  throw new Error(message);
2689
- } catch (x) {}
2691
+ } catch (x) { /**/ }
2690
2692
  };
2691
2693
  }
2692
2694
 
@@ -2715,7 +2717,8 @@ function checkPropTypes$1(typeSpecs, values, location, componentName, getStack)
2715
2717
  if (typeof typeSpecs[typeSpecName] !== 'function') {
2716
2718
  var err = Error(
2717
2719
  (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
2718
- 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
2720
+ 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
2721
+ 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
2719
2722
  );
2720
2723
  err.name = 'Invariant Violation';
2721
2724
  throw err;
@@ -2774,9 +2777,9 @@ var ReactIs$1 = reactIs$1.exports;
2774
2777
  var assign = objectAssign;
2775
2778
 
2776
2779
  var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
2780
+ var has = has$2;
2777
2781
  var checkPropTypes = checkPropTypes_1;
2778
2782
 
2779
- var has = Function.call.bind(Object.prototype.hasOwnProperty);
2780
2783
  var printWarning = function() {};
2781
2784
 
2782
2785
  if (process.env.NODE_ENV !== 'production') {
@@ -2877,6 +2880,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
2877
2880
  // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
2878
2881
  var ReactPropTypes = {
2879
2882
  array: createPrimitiveTypeChecker('array'),
2883
+ bigint: createPrimitiveTypeChecker('bigint'),
2880
2884
  bool: createPrimitiveTypeChecker('boolean'),
2881
2885
  func: createPrimitiveTypeChecker('function'),
2882
2886
  number: createPrimitiveTypeChecker('number'),
@@ -2922,8 +2926,9 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
2922
2926
  * is prohibitively expensive if they are created too often, such as what
2923
2927
  * happens in oneOfType() for any type before the one that matched.
2924
2928
  */
2925
- function PropTypeError(message) {
2929
+ function PropTypeError(message, data) {
2926
2930
  this.message = message;
2931
+ this.data = data && typeof data === 'object' ? data: {};
2927
2932
  this.stack = '';
2928
2933
  }
2929
2934
  // Make `instanceof Error` still work for returned errors.
@@ -2958,7 +2963,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
2958
2963
  ) {
2959
2964
  printWarning(
2960
2965
  'You are manually calling a React.PropTypes validation ' +
2961
- 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
2966
+ 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
2962
2967
  'and will throw in the standalone `prop-types` package. ' +
2963
2968
  'You may be seeing this warning due to a third-party PropTypes ' +
2964
2969
  'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
@@ -2997,7 +3002,10 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
2997
3002
  // 'of type `object`'.
2998
3003
  var preciseType = getPreciseType(propValue);
2999
3004
 
3000
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
3005
+ return new PropTypeError(
3006
+ 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
3007
+ {expectedType: expectedType}
3008
+ );
3001
3009
  }
3002
3010
  return null;
3003
3011
  }
@@ -3141,14 +3149,19 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
3141
3149
  }
3142
3150
 
3143
3151
  function validate(props, propName, componentName, location, propFullName) {
3152
+ var expectedTypes = [];
3144
3153
  for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
3145
3154
  var checker = arrayOfTypeCheckers[i];
3146
- if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret$1) == null) {
3155
+ var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret$1);
3156
+ if (checkerResult == null) {
3147
3157
  return null;
3148
3158
  }
3159
+ if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
3160
+ expectedTypes.push(checkerResult.data.expectedType);
3161
+ }
3149
3162
  }
3150
-
3151
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
3163
+ var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
3164
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
3152
3165
  }
3153
3166
  return createChainableTypeChecker(validate);
3154
3167
  }
@@ -3163,6 +3176,13 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
3163
3176
  return createChainableTypeChecker(validate);
3164
3177
  }
3165
3178
 
3179
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
3180
+ return new PropTypeError(
3181
+ (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
3182
+ 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
3183
+ );
3184
+ }
3185
+
3166
3186
  function createShapeTypeChecker(shapeTypes) {
3167
3187
  function validate(props, propName, componentName, location, propFullName) {
3168
3188
  var propValue = props[propName];
@@ -3172,8 +3192,8 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
3172
3192
  }
3173
3193
  for (var key in shapeTypes) {
3174
3194
  var checker = shapeTypes[key];
3175
- if (!checker) {
3176
- continue;
3195
+ if (typeof checker !== 'function') {
3196
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
3177
3197
  }
3178
3198
  var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
3179
3199
  if (error) {
@@ -3192,16 +3212,18 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
3192
3212
  if (propType !== 'object') {
3193
3213
  return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
3194
3214
  }
3195
- // We need to check all keys in case some are required but missing from
3196
- // props.
3215
+ // We need to check all keys in case some are required but missing from props.
3197
3216
  var allKeys = assign({}, props[propName], shapeTypes);
3198
3217
  for (var key in allKeys) {
3199
3218
  var checker = shapeTypes[key];
3219
+ if (has(shapeTypes, key) && typeof checker !== 'function') {
3220
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
3221
+ }
3200
3222
  if (!checker) {
3201
3223
  return new PropTypeError(
3202
3224
  'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
3203
3225
  '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
3204
- '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
3226
+ '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
3205
3227
  );
3206
3228
  }
3207
3229
  var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$1);
@@ -3386,6 +3408,7 @@ var factoryWithThrowingShims = function() {
3386
3408
  // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
3387
3409
  var ReactPropTypes = {
3388
3410
  array: shim,
3411
+ bigint: shim,
3389
3412
  bool: shim,
3390
3413
  func: shim,
3391
3414
  number: shim,
@@ -3892,14 +3915,16 @@ const ActionsContainer = styled.div `
3892
3915
  color: ${SECONDARY_BLUE};
3893
3916
  & span {
3894
3917
  cursor: pointer;
3918
+ text-decoration: underline;
3895
3919
  }
3896
3920
  `;
3897
3921
  const Divider = styled.span `
3898
3922
  border-right: 1px solid black;
3899
- margin: 0 9px;
3923
+ height: 1em;
3924
+ margin: auto 0.5em;
3900
3925
  `;
3901
- function Accordion({ children }) {
3902
- const [allOpen, setAllOpen] = React.useState(null);
3926
+ function Accordion({ children, open = false }) {
3927
+ const [allOpen, setAllOpen] = React.useState(open);
3903
3928
  console.log(LANDING_HEADER_FONT);
3904
3929
  const handleClose = () => {
3905
3930
  setAllOpen(false);
@@ -3935,31 +3960,28 @@ const Line = styled.div `
3935
3960
  border-left: 1px solid #bcbcbc;
3936
3961
  margin-left: calc(${(props) => props.circleDiameter} / 2);
3937
3962
  `;
3938
- const ContentContainer = styled.div `
3939
- display: grid;
3940
- grid-template-columns: 50px 1fr;
3963
+ const Title = styled.h2 `
3964
+ margin: auto 0;
3965
+ color: ${(props) => (props.variant === 'primary' ? 'black' : '#777777')};
3966
+ font-size: ${(props) => (props.variant === 'primary' ? '22px' : '18px')};
3941
3967
  `;
3942
- const TitleContainer = styled.div `
3943
- display: flex;
3944
- align-items: center;
3945
- flex-direction: row;
3946
-
3947
- & h2 {
3948
- margin: 0;
3949
- color: ${(props) => (props.variant === 'primary' ? 'black' : '#777777')};
3950
- font-size: ${(props) => (props.variant === 'primary' ? '22px' : '18px')};
3951
- }
3968
+ const Grid = styled.div `
3969
+ display: grid;
3970
+ grid-template-columns: ${(props) => props.numberedSectionWidth} 1fr;
3971
+ grid-template-rows: ${(props) => props.numberedSectionHeight} 1fr;
3952
3972
  `;
3953
- function NumberedContents({ number, title, children, showLine = true, circleDiameter = '40px', circleMargin = '10px', variant = 'primary', }) {
3954
- return (React__default["default"].createElement("div", null,
3955
- React__default["default"].createElement(TitleContainer, { variant: variant },
3956
- React__default["default"].createElement(Circle, { variant: variant, circleDiameter: circleDiameter, circleMargin: circleMargin }, number),
3957
- React__default["default"].createElement("h2", null,
3958
- title,
3959
- "\u00A0")),
3960
- React__default["default"].createElement(ContentContainer, null,
3961
- showLine ? React__default["default"].createElement(Line, { circleDiameter: circleDiameter }) : React__default["default"].createElement("span", null),
3962
- React__default["default"].createElement("div", null, children))));
3973
+ function NumberedContents({ number, title, children, showLine = true, circleDiameter = '40px', circleMargin = '5px', variant = 'primary', }) {
3974
+ const circleDiameterInt = Number(circleDiameter.slice(0, -2));
3975
+ const circleMarginInt = Number(circleMargin.slice(0, -2));
3976
+ const numberedSectionWidth = `${circleDiameterInt + circleMarginInt * 2}px`;
3977
+ const numberedSectionHeight = `${circleDiameterInt + circleMarginInt * 2}px`;
3978
+ return (React__default["default"].createElement(Grid, { numberedSectionWidth: numberedSectionWidth, numberedSectionHeight: numberedSectionHeight },
3979
+ React__default["default"].createElement(Circle, { variant: variant, circleDiameter: circleDiameter, circleMargin: circleMargin }, number),
3980
+ React__default["default"].createElement(Title, { variant: variant },
3981
+ title,
3982
+ "\u00A0"),
3983
+ showLine ? React__default["default"].createElement(Line, { circleDiameter: circleDiameter }) : React__default["default"].createElement("span", null),
3984
+ React__default["default"].createElement("div", null, children)));
3963
3985
  }
3964
3986
 
3965
3987
  var Button$2 = {};
@@ -3973,8 +3995,7 @@ function _interopRequireDefault(obj) {
3973
3995
  };
3974
3996
  }
3975
3997
 
3976
- module.exports = _interopRequireDefault;
3977
- module.exports["default"] = module.exports, module.exports.__esModule = true;
3998
+ module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
3978
3999
  }(interopRequireDefault));
3979
4000
 
3980
4001
  function _extends() {
@@ -8349,14 +8370,61 @@ const styles$1 = {
8349
8370
  button: `
8350
8371
  background-color: #1a4dff;
8351
8372
  color: #e8edff;
8373
+ `,
8374
+ },
8375
+ plainText: {
8376
+ button: `
8377
+ background-color: unset;
8378
+ color: #0139ff;
8352
8379
  `,
8353
8380
  },
8354
8381
  secondary: {
8355
8382
  button: `
8356
- border: 3px solid #1a4dff;
8383
+ box-shadow: 0px 0px 0px 3px #1a4dff inset;
8357
8384
  color: #1a4dff;
8358
8385
  background-color: #ffffff;
8359
8386
 
8387
+ `,
8388
+ },
8389
+ bcPrimary: {
8390
+ button: `
8391
+ background-color: #003366;
8392
+ box-shadow: 0px 0px 0px 2px #003366 inset !important;
8393
+ color: #fff;
8394
+ border-radius: 0.222em;
8395
+ &:hover {
8396
+ text-decoration: underline;
8397
+ opacity: 0.80;
8398
+ }
8399
+ &:focus {
8400
+ outline: 4px solid #3B99FC;
8401
+ outline-offset: 1px;
8402
+ }
8403
+ &:active {
8404
+ opacity: 1;
8405
+ }
8406
+ &:disabled {
8407
+ background-color: #003366;
8408
+ box-shadow: 0px 0px 0px 2px #fff inset !important;
8409
+ color: #fff;
8410
+ cursor: not-allowed;
8411
+ opacity: 0.3;
8412
+ &:hover {
8413
+ text-decoration: none;
8414
+ }
8415
+ }
8416
+ `,
8417
+ },
8418
+ bcSecondary: {
8419
+ button: `
8420
+ background-color: #b2b2b2;
8421
+ border-radius: 0.222em;
8422
+ color: white;
8423
+ box-shadow: none !important;
8424
+
8425
+ &:hover {
8426
+ background-color: #b2b2b2;
8427
+ }
8360
8428
  `,
8361
8429
  },
8362
8430
  },
@@ -8383,25 +8451,14 @@ var _typeof = {exports: {}};
8383
8451
  function _typeof(obj) {
8384
8452
  "@babel/helpers - typeof";
8385
8453
 
8386
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
8387
- module.exports = _typeof = function _typeof(obj) {
8388
- return typeof obj;
8389
- };
8390
-
8391
- module.exports["default"] = module.exports, module.exports.__esModule = true;
8392
- } else {
8393
- module.exports = _typeof = function _typeof(obj) {
8394
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
8395
- };
8396
-
8397
- module.exports["default"] = module.exports, module.exports.__esModule = true;
8398
- }
8399
-
8400
- return _typeof(obj);
8454
+ return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
8455
+ return typeof obj;
8456
+ } : function (obj) {
8457
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
8458
+ }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
8401
8459
  }
8402
8460
 
8403
- module.exports = _typeof;
8404
- module.exports["default"] = module.exports, module.exports.__esModule = true;
8461
+ module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
8405
8462
  }(_typeof));
8406
8463
 
8407
8464
  (function (module) {
@@ -8457,8 +8514,7 @@ function _interopRequireWildcard(obj, nodeInterop) {
8457
8514
  return newObj;
8458
8515
  }
8459
8516
 
8460
- module.exports = _interopRequireWildcard;
8461
- module.exports["default"] = module.exports, module.exports.__esModule = true;
8517
+ module.exports = _interopRequireWildcard, module.exports.__esModule = true, module.exports["default"] = module.exports;
8462
8518
  }(interopRequireWildcard));
8463
8519
 
8464
8520
  var _interopRequireDefault = interopRequireDefault.exports;
@@ -8650,12 +8706,12 @@ const styles = {
8650
8706
  variant: {
8651
8707
  danger: {
8652
8708
  container: `
8653
- background-color: #FEE8E6;
8709
+ background-color: #EAC2C1;
8654
8710
  `,
8655
8711
  },
8656
8712
  success: {
8657
8713
  container: `
8658
- background-color: #E5F9E6;
8714
+ background-color: #C4D8CF;
8659
8715
  `,
8660
8716
  },
8661
8717
  },
@@ -8692,6 +8748,7 @@ const Alert = (props) => (React__default["default"].createElement(DefaultAlert,
8692
8748
  props.variant === 'success' && SuccessIcon,
8693
8749
  props.variant === 'danger' && DangerIcon,
8694
8750
  props.children,
8751
+ props.content,
8695
8752
  React__default["default"].createElement(DefaultAlert.Close, null, "X")));
8696
8753
 
8697
8754
  exports.Accordion = Accordion;