@thecb/components 5.6.6 → 5.6.10

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/dist/index.cjs.js CHANGED
@@ -6115,6 +6115,16 @@ var checkDeniedCards = function checkDeniedCards(name) {
6115
6115
  return "";
6116
6116
  }
6117
6117
  };
6118
+ /*
6119
+ An optional style for layout atoms that positions the atom completely off screen
6120
+ This will *not* be visible or accessible to sighted users
6121
+ Use to contain text content or a11y interactive content (skip links when not visible)
6122
+ that is only for users of assistive technologies (screen readers)
6123
+
6124
+ Currently implemented on the Box atom via the srOnly prop
6125
+ */
6126
+
6127
+ var screenReaderOnlyStyle = "\n position: absolute;\n left: -10000px;\n top: auto;\n width: 1px;\n height: 1px;\n overflow: hidden;\n";
6118
6128
 
6119
6129
  var general = /*#__PURE__*/Object.freeze({
6120
6130
  __proto__: null,
@@ -6126,7 +6136,8 @@ var general = /*#__PURE__*/Object.freeze({
6126
6136
  generateClickHandler: generateClickHandler,
6127
6137
  checkCardBrand: checkCardBrand,
6128
6138
  displayCardBrand: displayCardBrand,
6129
- checkDeniedCards: checkDeniedCards
6139
+ checkDeniedCards: checkDeniedCards,
6140
+ screenReaderOnlyStyle: screenReaderOnlyStyle
6130
6141
  });
6131
6142
 
6132
6143
  var _excluded$1 = ["themeValues", "weight", "color", "extraStyles", "hoverStyles", "onClick", "onKeyPress", "as", "dataQa", "children"];
@@ -6269,10 +6280,13 @@ var BoxWrapper = styled__default(function (_ref) {
6269
6280
  });
6270
6281
  /* eslint-enable no-unused-vars */
6271
6282
 
6272
- var _excluded$3 = ["padding", "borderSize", "borderColor", "borderRadius", "boxShadow", "background", "color", "minHeight", "width", "minWidth", "maxWidth", "borderWidthOverride", "border", "textAlign", "hoverStyles", "activeStyles", "disabledStyles", "variant", "as", "onClick", "onKeyDown", "onMouseEnter", "onMouseLeave", "onFocus", "onBlur", "onTouchEnd", "theme", "hiddenStyles", "extraStyles", "dataQa", "children"];
6283
+ var _excluded$3 = ["padding", "borderSize", "borderColor", "borderRadius", "boxShadow", "background", "color", "minHeight", "width", "minWidth", "maxWidth", "borderWidthOverride", "border", "textAlign", "hoverStyles", "activeStyles", "disabledStyles", "variant", "as", "onClick", "onKeyDown", "onMouseEnter", "onMouseLeave", "onFocus", "onBlur", "onTouchEnd", "theme", "hiddenStyles", "extraStyles", "srOnly", "dataQa", "children"];
6273
6284
  /*
6274
6285
  Box component to create generic boxes
6275
6286
  Supply padding, border, background, and color values
6287
+
6288
+ srOnly prop enables special screen-reader style that is used to position content
6289
+ completely off screen (only for users of screen readers)
6276
6290
  */
6277
6291
 
6278
6292
  var Box = function Box(_ref) {
@@ -6309,6 +6323,8 @@ var Box = function Box(_ref) {
6309
6323
  theme = _ref.theme,
6310
6324
  hiddenStyles = _ref.hiddenStyles,
6311
6325
  extraStyles = _ref.extraStyles,
6326
+ _ref$srOnly = _ref.srOnly,
6327
+ srOnly = _ref$srOnly === void 0 ? false : _ref$srOnly,
6312
6328
  dataQa = _ref.dataQa,
6313
6329
  children = _ref.children,
6314
6330
  rest = _objectWithoutProperties(_ref, _excluded$3);
@@ -6335,7 +6351,7 @@ var Box = function Box(_ref) {
6335
6351
  onClick: onClick,
6336
6352
  hiddenStyles: hiddenStyles,
6337
6353
  onKeyDown: onKeyDown,
6338
- extraStyles: extraStyles,
6354
+ extraStyles: srOnly ? "".concat(screenReaderOnlyStyle).concat(extraStyles) : extraStyles,
6339
6355
  theme: theme,
6340
6356
  textAlign: textAlign,
6341
6357
  "data-qa": dataQa,
@@ -19376,8 +19392,6 @@ var SearchInput = styled__default.input.withConfig({
19376
19392
  });
19377
19393
 
19378
19394
  var Dropdown = function Dropdown(_ref9) {
19379
- var _options$find;
19380
-
19381
19395
  var placeholder = _ref9.placeholder,
19382
19396
  options = _ref9.options,
19383
19397
  value = _ref9.value,
@@ -19392,7 +19406,9 @@ var Dropdown = function Dropdown(_ref9) {
19392
19406
  maxHeight = _ref9.maxHeight,
19393
19407
  _ref9$widthFitOptions = _ref9.widthFitOptions,
19394
19408
  widthFitOptions = _ref9$widthFitOptions === void 0 ? false : _ref9$widthFitOptions,
19395
- disabled = _ref9.disabled;
19409
+ disabled = _ref9.disabled,
19410
+ _ref9$hasTitles = _ref9.hasTitles,
19411
+ hasTitles = _ref9$hasTitles === void 0 ? false : _ref9$hasTitles;
19396
19412
 
19397
19413
  var _useState = React.useState(""),
19398
19414
  _useState2 = _slicedToArray(_useState, 2),
@@ -19434,6 +19450,14 @@ var Dropdown = function Dropdown(_ref9) {
19434
19450
  }));
19435
19451
  var dropdownRef = React.useRef(null);
19436
19452
 
19453
+ var getSelection = function getSelection() {
19454
+ var _options$find;
19455
+
19456
+ return value ? (_options$find = options.find(function (option) {
19457
+ return option.value === value;
19458
+ })) === null || _options$find === void 0 ? void 0 : _options$find.text : placeholder;
19459
+ };
19460
+
19437
19461
  var onKeyDown = function onKeyDown(e) {
19438
19462
  var key = e.key,
19439
19463
  keyCode = e.keyCode;
@@ -19529,7 +19553,8 @@ var Dropdown = function Dropdown(_ref9) {
19529
19553
  width: "100%",
19530
19554
  hoverStyles: "background-color: ".concat(themeValues.hoverColor, ";"),
19531
19555
  "aria-expanded": isOpen,
19532
- extraStyles: disabled && "color: #6e727e;\n background-color: #f7f7f7;\n pointer-events: none;"
19556
+ extraStyles: disabled && "color: #6e727e;\n background-color: #f7f7f7;\n pointer-events: none;",
19557
+ title: hasTitles ? getSelection() : null
19533
19558
  }, /*#__PURE__*/React__default.createElement(Box, {
19534
19559
  as: "button",
19535
19560
  background: isOpen ? themeValues.hoverColor : WHITE,
@@ -19553,9 +19578,7 @@ var Dropdown = function Dropdown(_ref9) {
19553
19578
  }) : /*#__PURE__*/React__default.createElement(Text$1, {
19554
19579
  variant: "p",
19555
19580
  extraStyles: disabled && "color: #6e727e;\n background-color: #f7f7f7;\n pointer-events: none;"
19556
- }, value ? (_options$find = options.find(function (option) {
19557
- return option.value === value;
19558
- })) === null || _options$find === void 0 ? void 0 : _options$find.text : placeholder), /*#__PURE__*/React__default.createElement(IconWrapper, {
19581
+ }, getSelection()), /*#__PURE__*/React__default.createElement(IconWrapper, {
19559
19582
  open: isOpen
19560
19583
  }, /*#__PURE__*/React__default.createElement(DropdownIcon, null)))), isOpen ? /*#__PURE__*/React__default.createElement(DropdownContentWrapper, {
19561
19584
  maxHeight: maxHeight,
@@ -19579,7 +19602,8 @@ var Dropdown = function Dropdown(_ref9) {
19579
19602
  selected: choice.value === value,
19580
19603
  disabled: disabledValues.includes(choice.value),
19581
19604
  "data-qa": choice.text,
19582
- themeValues: themeValues
19605
+ themeValues: themeValues,
19606
+ title: hasTitles ? choice.text : null
19583
19607
  }, /*#__PURE__*/React__default.createElement(Text$1, {
19584
19608
  variant: "p",
19585
19609
  color: choice.value === value ? WHITE : disabledValues.includes(choice.value) ? STORM_GREY : MINESHAFT_GREY,
@@ -19684,7 +19708,9 @@ var FormSelect = function FormSelect(_ref) {
19684
19708
  dropdownMaxHeight = _ref.dropdownMaxHeight,
19685
19709
  disabledValues = _ref.disabledValues,
19686
19710
  disabled = _ref.disabled,
19687
- themeValues = _ref.themeValues;
19711
+ themeValues = _ref.themeValues,
19712
+ _ref$hasTitles = _ref.hasTitles,
19713
+ hasTitles = _ref$hasTitles === void 0 ? false : _ref$hasTitles;
19688
19714
 
19689
19715
  var _useState = React.useState(false),
19690
19716
  _useState2 = _slicedToArray(_useState, 2),
@@ -19724,6 +19750,7 @@ var FormSelect = function FormSelect(_ref) {
19724
19750
  }, labelTextWhenNoError))), /*#__PURE__*/React__default.createElement(Dropdown$1, {
19725
19751
  "aria-labelledby": labelTextWhenNoError.replace(/\s+/g, "-"),
19726
19752
  maxHeight: dropdownMaxHeight,
19753
+ hasTitles: hasTitles,
19727
19754
  placeholder: options[0] ? options[0].text : "",
19728
19755
  options: options,
19729
19756
  value: field.rawValue,
@@ -33188,25 +33215,37 @@ const validatorToPredicate = (validatorFn, emptyCase) => (
33188
33215
 
33189
33216
  var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
33190
33217
 
33191
- function createCommonjsModule$1(fn, module) {
33192
- return module = { exports: {} }, fn(module, module.exports), module.exports;
33193
- }
33218
+ var dayjs_min = {exports: {}};
33194
33219
 
33195
- var dayjs_min = createCommonjsModule$1(function (module, exports) {
33220
+ (function (module, exports) {
33196
33221
  !function(t,e){module.exports=e();}(commonjsGlobal$1,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",$="Invalid Date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},D="en",v={};v[D]=M;var p=function(t){return t instanceof _},S=function(t,e,n){var r;if(!t)return D;if("string"==typeof t)v[t]&&(r=t),e&&(v[t]=e,r=t);else {var i=t.name;v[i]=t,r=i;}return !n&&r&&(D=r),r||!n&&D},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=g;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(l);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===$)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),$=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},l=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(h){case c:return r?$(1,0):$(31,11);case f:return r?$(1,M):$(0,M+1);case o:var D=this.$locale().weekStart||0,v=(y<D?y+7:y)-D;return $(r?m-v:m+(6-v),M);case a:case d:return l(g+"Hours",0);case u:return l(g+"Minutes",1);case s:return l(g+"Seconds",2);case i:return l(g+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),$=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],l=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[$](l),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else $&&this.$d[$](l);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,$=this;r=Number(r);var l=O.p(h),y=function(t){var e=w($);return O.w(e.date(e.date()+Math.round(t*r)),$)};if(l===f)return this.set(f,this.$M+r);if(l===c)return this.set(c,this.$y+r);if(l===a)return y(1);if(l===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[l]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||$;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].substr(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||l[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,$){var l,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,g=this-M,D=O.m(this,M);return D=(l={},l[c]=D/12,l[f]=D,l[h]=D/3,l[o]=(g-m)/6048e5,l[a]=(g-m)/864e5,l[u]=g/n,l[s]=g/e,l[i]=g/t,l)[y]||g,$?D:O.a(D)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return v[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),b=_.prototype;return w.prototype=b,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){b[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=v[D],w.Ls=v,w.p={},w}));
33197
- });
33222
+ }(dayjs_min));
33223
+
33224
+ var dayjs = dayjs_min.exports;
33225
+
33226
+ var customParseFormat$1 = {exports: {}};
33198
33227
 
33199
- var customParseFormat = createCommonjsModule$1(function (module, exports) {
33228
+ (function (module, exports) {
33200
33229
  !function(t,e){module.exports=e();}(commonjsGlobal$1,(function(){var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-:/.()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d\d/,r=/\d\d?/,i=/\d*[^\s\d-_:/()]+/,o={},s=function(t){return (t=+t)+(t>68?1900:2e3)};var a=function(t){return function(e){this[t]=+e;}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(t){(this.zone||(this.zone={})).offset=function(t){if(!t)return 0;if("Z"===t)return 0;var e=t.match(/([+-]|\d\d)/g),n=60*e[1]+(+e[2]||0);return 0===n?0:"+"===e[0]?-n:n}(t);}],u=function(t){var e=o[t];return e&&(e.indexOf?e:e.s.concat(e.f))},h=function(t,e){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(t.indexOf(r(i,0,e))>-1){n=i>12;break}}else n=t===(e?"pm":"PM");return n},d={A:[i,function(t){this.afternoon=h(t,!1);}],a:[i,function(t){this.afternoon=h(t,!0);}],S:[/\d/,function(t){this.milliseconds=100*+t;}],SS:[n,function(t){this.milliseconds=10*+t;}],SSS:[/\d{3}/,function(t){this.milliseconds=+t;}],s:[r,a("seconds")],ss:[r,a("seconds")],m:[r,a("minutes")],mm:[r,a("minutes")],H:[r,a("hours")],h:[r,a("hours")],HH:[r,a("hours")],hh:[r,a("hours")],D:[r,a("day")],DD:[n,a("day")],Do:[i,function(t){var e=o.ordinal,n=t.match(/\d+/);if(this.day=n[0],e)for(var r=1;r<=31;r+=1)e(r).replace(/\[|\]/g,"")===t&&(this.day=r);}],M:[r,a("month")],MM:[n,a("month")],MMM:[i,function(t){var e=u("months"),n=(u("monthsShort")||e.map((function(t){return t.substr(0,3)}))).indexOf(t)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[i,function(t){var e=u("months").indexOf(t)+1;if(e<1)throw new Error;this.month=e%12||e;}],Y:[/[+-]?\d+/,a("year")],YY:[n,function(t){this.year=s(t);}],YYYY:[/\d{4}/,a("year")],Z:f,ZZ:f};function c(n){var r,i;r=n,i=o&&o.formats;for(var s=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(e,n,r){var o=r&&r.toUpperCase();return n||i[r]||t[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(t,e,n){return e||n.slice(1)}))}))).match(e),a=s.length,f=0;f<a;f+=1){var u=s[f],h=d[u],c=h&&h[0],l=h&&h[1];s[f]=l?{regex:c,parser:l}:u.replace(/^\[|\]$/g,"");}return function(t){for(var e={},n=0,r=0;n<a;n+=1){var i=s[n];if("string"==typeof i)r+=i.length;else {var o=i.regex,f=i.parser,u=t.substr(r),h=o.exec(u)[0];f.call(e,h),t=t.replace(h,"");}}return function(t){var e=t.afternoon;if(void 0!==e){var n=t.hours;e?n<12&&(t.hours+=12):12===n&&(t.hours=0),delete t.afternoon;}}(e),e}}return function(t,e,n){n.p.customParseFormat=!0,t&&t.parseTwoDigitYear&&(s=t.parseTwoDigitYear);var r=e.prototype,i=r.parse;r.parse=function(t){var e=t.date,r=t.utc,s=t.args;this.$u=r;var a=s[1];if("string"==typeof a){var f=!0===s[2],u=!0===s[3],h=f||u,d=s[2];u&&(d=s[2]),o=this.$locale(),!f&&d&&(o=n.Ls[d]),this.$d=function(t,e,n){try{if(["x","X"].indexOf(e)>-1)return new Date(("X"===e?1e3:1)*t);var r=c(e)(t),i=r.year,o=r.month,s=r.day,a=r.hours,f=r.minutes,u=r.seconds,h=r.milliseconds,d=r.zone,l=new Date,m=s||(i||o?1:l.getDate()),M=i||l.getFullYear(),Y=0;i&&!o||(Y=o>0?o-1:l.getMonth());var p=a||0,v=f||0,D=u||0,g=h||0;return d?new Date(Date.UTC(M,Y,m,p,v,D,g+60*d.offset*1e3)):n?new Date(Date.UTC(M,Y,m,p,v,D,g)):new Date(M,Y,m,p,v,D,g)}catch(t){return new Date("")}}(e,a,r),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),h&&e!=this.format(a)&&(this.$d=new Date("")),o={};}else if(a instanceof Array)for(var l=a.length,m=1;m<=l;m+=1){s[1]=a[m-1];var M=n.apply(this,s);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===l&&(this.$d=new Date(""));}else i.call(this,t);};}}));
33201
- });
33230
+ }(customParseFormat$1));
33231
+
33232
+ var customParseFormat = customParseFormat$1.exports;
33202
33233
 
33203
- var isSameOrBefore = createCommonjsModule$1(function (module, exports) {
33234
+ var isSameOrBefore$1 = {exports: {}};
33235
+
33236
+ (function (module, exports) {
33204
33237
  !function(e,i){module.exports=i();}(commonjsGlobal$1,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
33205
- });
33238
+ }(isSameOrBefore$1));
33239
+
33240
+ var isSameOrBefore = isSameOrBefore$1.exports;
33206
33241
 
33207
- var isSameOrAfter = createCommonjsModule$1(function (module, exports) {
33242
+ var isSameOrAfter$1 = {exports: {}};
33243
+
33244
+ (function (module, exports) {
33208
33245
  !function(e,t){module.exports=t();}(commonjsGlobal$1,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
33209
- });
33246
+ }(isSameOrAfter$1));
33247
+
33248
+ var isSameOrAfter = isSameOrAfter$1.exports;
33210
33249
 
33211
33250
  /* eslint-disable no-unused-vars */
33212
33251
 
@@ -33216,9 +33255,9 @@ const createValidator = (type, error) => {
33216
33255
  return validator;
33217
33256
  };
33218
33257
 
33219
- dayjs_min.extend(customParseFormat);
33220
- dayjs_min.extend(isSameOrBefore);
33221
- dayjs_min.extend(isSameOrAfter);
33258
+ dayjs.extend(customParseFormat);
33259
+ dayjs.extend(isSameOrBefore);
33260
+ dayjs.extend(isSameOrAfter);
33222
33261
 
33223
33262
  let validatorFns = {};
33224
33263
 
@@ -33297,15 +33336,14 @@ const MATCHES_FIELD = "validator/MATCHES_FIELD";
33297
33336
  const MATCHES_FIELD_ERROR$1 = "error/MATCHES_FIELD";
33298
33337
  const matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR$1);
33299
33338
  validatorFns[MATCHES_FIELD] = (value, args, form) => {
33300
- if (value === "") {
33301
- return true;
33302
- }
33303
- if (form[args[0]] === undefined) {
33339
+ const dependentField = form[args[0]];
33340
+ if (dependentField === undefined) {
33304
33341
  throw new Error(
33305
33342
  `${args[0]} was passed to matchesField, but that field does not exist in the form`
33306
33343
  );
33307
33344
  }
33308
- return value === form[args[0]].rawValue;
33345
+ const dependentFieldValue = dependentField.rawValue;
33346
+ return value === dependentFieldValue;
33309
33347
  };
33310
33348
 
33311
33349
  const validateWhenErrorMessage = type =>
@@ -33448,8 +33486,8 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
33448
33486
  "Date format and unit need to be defined for dateBeforeToday, one or both are undefined"
33449
33487
  );
33450
33488
  }
33451
- const now = dayjs_min();
33452
- const dateValue = dayjs_min(value, dateFormat);
33489
+ const now = dayjs();
33490
+ const dateValue = dayjs(value, dateFormat);
33453
33491
 
33454
33492
  if (inclusive === true) {
33455
33493
  return dateValue.isSameOrBefore(now, unit);
@@ -33476,8 +33514,8 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
33476
33514
  "Date format and unit need to be defined for dateAfterToday, one or both are undefined"
33477
33515
  );
33478
33516
  }
33479
- const now = dayjs_min();
33480
- const dateValue = dayjs_min(value, dateFormat);
33517
+ const now = dayjs();
33518
+ const dateValue = dayjs(value, dateFormat);
33481
33519
 
33482
33520
  if (inclusive === true) {
33483
33521
  return dateValue.isSameOrAfter(now, unit);
@@ -33861,7 +33899,7 @@ function get(state, prop) {
33861
33899
  return value;
33862
33900
  }
33863
33901
 
33864
- function set(state, prop, value) {
33902
+ function set$1(state, prop, value) {
33865
33903
  assertUnrevoked(state);
33866
33904
  state.assigned[prop] = true;
33867
33905
 
@@ -33912,8 +33950,8 @@ function proxyProperty(draft, prop, enumerable) {
33912
33950
  return get(this[DRAFT_STATE], prop);
33913
33951
  },
33914
33952
 
33915
- set: function set$1(value) {
33916
- set(this[DRAFT_STATE], prop, value);
33953
+ set: function set$1$1(value) {
33954
+ set$1(this[DRAFT_STATE], prop, value);
33917
33955
  }
33918
33956
 
33919
33957
  };
@@ -34094,7 +34132,7 @@ var objectTraps = {
34094
34132
  return Reflect.ownKeys(source$1(target));
34095
34133
  },
34096
34134
 
34097
- set: set$1,
34135
+ set: set$1$1,
34098
34136
  deleteProperty: deleteProperty,
34099
34137
  getOwnPropertyDescriptor: getOwnPropertyDescriptor,
34100
34138
 
@@ -34172,7 +34210,7 @@ function get$1(state, prop) {
34172
34210
  return drafts[prop] = createProxy$1(value, state);
34173
34211
  }
34174
34212
 
34175
- function set$1(state, prop, value) {
34213
+ function set$1$1(state, prop, value) {
34176
34214
  if (!state.modified) {
34177
34215
  var baseValue = peek$1(state.base, prop); // Optimize based on value's truthiness. Truthy values are guaranteed to
34178
34216
  // never be undefined, so we can avoid the `in` operator. Lastly, truthy
@@ -34395,7 +34433,7 @@ var Immer = function Immer(config) {
34395
34433
  };
34396
34434
 
34397
34435
  Immer.prototype.produce = function produce (base, recipe, patchListener) {
34398
- var this$1 = this;
34436
+ var this$1$1 = this;
34399
34437
 
34400
34438
  // curried invocation
34401
34439
  if (typeof base === "function" && typeof recipe !== "function") {
@@ -34403,12 +34441,12 @@ Immer.prototype.produce = function produce (base, recipe, patchListener) {
34403
34441
  recipe = base;
34404
34442
  var self = this;
34405
34443
  return function curriedProduce(base) {
34406
- var this$1 = this;
34444
+ var this$1$1 = this;
34407
34445
  if ( base === void 0 ) base = defaultBase;
34408
34446
  var args = [], len = arguments.length - 1;
34409
34447
  while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
34410
34448
 
34411
- return self.produce(base, function (draft) { return recipe.call.apply(recipe, [ this$1, draft ].concat( args )); }); // prettier-ignore
34449
+ return self.produce(base, function (draft) { return recipe.call.apply(recipe, [ this$1$1, draft ].concat( args )); }); // prettier-ignore
34412
34450
  };
34413
34451
  } // prettier-ignore
34414
34452
 
@@ -34440,7 +34478,7 @@ Immer.prototype.produce = function produce (base, recipe, patchListener) {
34440
34478
  if (result instanceof Promise) {
34441
34479
  return result.then(function (result) {
34442
34480
  scope.usePatches(patchListener);
34443
- return this$1.processResult(result, scope);
34481
+ return this$1$1.processResult(result, scope);
34444
34482
  }, function (error) {
34445
34483
  scope.revoke();
34446
34484
  throw error;
@@ -34457,14 +34495,14 @@ Immer.prototype.produce = function produce (base, recipe, patchListener) {
34457
34495
  };
34458
34496
 
34459
34497
  Immer.prototype.produceWithPatches = function produceWithPatches (arg1, arg2, arg3) {
34460
- var this$1 = this;
34498
+ var this$1$1 = this;
34461
34499
 
34462
34500
  if (typeof arg1 === "function") {
34463
34501
  return function (state) {
34464
34502
  var args = [], len = arguments.length - 1;
34465
34503
  while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
34466
34504
 
34467
- return this$1.produceWithPatches(state, function (draft) { return arg1.apply(void 0, [ draft ].concat( args )); });
34505
+ return this$1$1.produceWithPatches(state, function (draft) { return arg1.apply(void 0, [ draft ].concat( args )); });
34468
34506
  };
34469
34507
  } // non-curried form
34470
34508
 
@@ -34589,7 +34627,7 @@ Immer.prototype.processResult = function processResult (result, scope) {
34589
34627
 
34590
34628
 
34591
34629
  Immer.prototype.finalize = function finalize (draft, path, scope) {
34592
- var this$1 = this;
34630
+ var this$1$1 = this;
34593
34631
 
34594
34632
  var state = draft[DRAFT_STATE];
34595
34633
 
@@ -34623,7 +34661,7 @@ Immer.prototype.finalize = function finalize (draft, path, scope) {
34623
34661
  var base = state.base;
34624
34662
  var copy = state.copy;
34625
34663
  each(base, function (prop) {
34626
- if (!has(copy, prop)) { this$1.onDelete(state, prop); }
34664
+ if (!has(copy, prop)) { this$1$1.onDelete(state, prop); }
34627
34665
  });
34628
34666
  }
34629
34667
  }
@@ -34652,7 +34690,7 @@ Immer.prototype.finalize = function finalize (draft, path, scope) {
34652
34690
 
34653
34691
 
34654
34692
  Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
34655
- var this$1 = this;
34693
+ var this$1$1 = this;
34656
34694
 
34657
34695
  var state = root[DRAFT_STATE];
34658
34696
 
@@ -34678,7 +34716,7 @@ Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
34678
34716
  if (isDraft(value)) {
34679
34717
  var path = isDraftProp && needPatches && !state.assigned[prop] ? rootPath.concat(prop) : null; // Drafts owned by `scope` are finalized here.
34680
34718
 
34681
- value = this$1.finalize(value, path, scope); // Drafts from another scope must prevent auto-freezing.
34719
+ value = this$1$1.finalize(value, path, scope); // Drafts from another scope must prevent auto-freezing.
34682
34720
 
34683
34721
  if (isDraft(value)) {
34684
34722
  scope.canAutoFreeze = false;
@@ -34703,8 +34741,8 @@ Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
34703
34741
  each(value, finalizeProperty);
34704
34742
  }
34705
34743
 
34706
- if (isDraftProp && this$1.onAssign) {
34707
- this$1.onAssign(state, prop, value);
34744
+ if (isDraftProp && this$1$1.onAssign) {
34745
+ this$1$1.onAssign(state, prop, value);
34708
34746
  }
34709
34747
  };
34710
34748
 
@@ -34739,14 +34777,14 @@ var produce = immer.produce;
34739
34777
  * [nextState, patches, inversePatches] (instead of just the next state)
34740
34778
  */
34741
34779
 
34742
- var produceWithPatches = immer.produceWithPatches.bind(immer);
34780
+ immer.produceWithPatches.bind(immer);
34743
34781
  /**
34744
34782
  * Pass true to automatically freeze all copies created by Immer.
34745
34783
  *
34746
34784
  * By default, auto-freezing is disabled in production.
34747
34785
  */
34748
34786
 
34749
- var setAutoFreeze = immer.setAutoFreeze.bind(immer);
34787
+ immer.setAutoFreeze.bind(immer);
34750
34788
  /**
34751
34789
  * Pass true to use the ES2015 `Proxy` class when creating drafts, which is
34752
34790
  * always faster than using ES5 proxies.
@@ -34754,20 +34792,20 @@ var setAutoFreeze = immer.setAutoFreeze.bind(immer);
34754
34792
  * By default, feature detection is used, so calling this is rarely necessary.
34755
34793
  */
34756
34794
 
34757
- var setUseProxies = immer.setUseProxies.bind(immer);
34795
+ immer.setUseProxies.bind(immer);
34758
34796
  /**
34759
34797
  * Apply an array of Immer patches to the first argument.
34760
34798
  *
34761
34799
  * This function is a producer, which means copy-on-write is in effect.
34762
34800
  */
34763
34801
 
34764
- var applyPatches$1 = immer.applyPatches.bind(immer);
34802
+ immer.applyPatches.bind(immer);
34765
34803
  /**
34766
34804
  * Create an Immer draft from the given base state, which may be a draft itself.
34767
34805
  * The draft can be modified until you finalize it with the `finishDraft` function.
34768
34806
  */
34769
34807
 
34770
- var createDraft = immer.createDraft.bind(immer);
34808
+ immer.createDraft.bind(immer);
34771
34809
  /**
34772
34810
  * Finalize an Immer draft from a `createDraft` call, returning the base state
34773
34811
  * (if no changes were made) or a modified copy. The draft must *not* be
@@ -34777,7 +34815,7 @@ var createDraft = immer.createDraft.bind(immer);
34777
34815
  * changes that were made.
34778
34816
  */
34779
34817
 
34780
- var finishDraft = immer.finishDraft.bind(immer);
34818
+ immer.finishDraft.bind(immer);
34781
34819
 
34782
34820
  const createInitialState = formConfig => {
34783
34821
  let initialForm = {};
@@ -34802,7 +34840,7 @@ const createInitialState = formConfig => {
34802
34840
  };
34803
34841
 
34804
34842
  const SET = "field/SET";
34805
- const set$2 = fieldName => value => ({
34843
+ const set = fieldName => value => ({
34806
34844
  type: SET,
34807
34845
  payload: { fieldName, value }
34808
34846
  });
@@ -34882,7 +34920,7 @@ const createMapDispatchToProps = formConfig => {
34882
34920
  const keys = Object.keys(formConfig);
34883
34921
  for (let fieldName of keys) {
34884
34922
  dispatchObj.fields[fieldName] = {
34885
- set: value => dispatch(set$2(fieldName)(value)),
34923
+ set: value => dispatch(set(fieldName)(value)),
34886
34924
  addValidator: validator => dispatch(addValidator(fieldName)(validator))
34887
34925
  };
34888
34926
  }
@@ -41435,6 +41473,119 @@ var WorkflowTile = function WorkflowTile(_ref) {
41435
41473
  }))));
41436
41474
  };
41437
41475
 
41476
+ var DashboardIframe = styled__default.iframe.withConfig({
41477
+ displayName: "PeriscopeDashboardIframestyled__DashboardIframe",
41478
+ componentId: "sc-j0cucj-0"
41479
+ })(["border:none;box-shadow:0 0 5px 0 ", ";display:none;"], ALTO_GREY);
41480
+
41481
+ /**
41482
+ * Component: PeriscopeDashboardIframe
41483
+ *
41484
+ * Used for rendering Citybase's periscope reporting dashboards in iframes.
41485
+ * Receives action props to trigger a request on mount for the iframe's url.
41486
+ * Receives a string prop if/when we receive the url result.
41487
+ * And receives action props to emit errors from failed iframe loading.
41488
+ *
41489
+ * The logic and api client methods to handle requests/response,
41490
+ * store the url, etc. should be provided from the app consuming this library.
41491
+ *
41492
+ * If the url request is pending, render a spinner.
41493
+ * If the url request failed, render a UI error state.
41494
+ **/
41495
+
41496
+ var DASHBOARD_SIZE_MESSAGE_TYPE = "dashboard_resize";
41497
+ var PERISCOPE_ORIGIN = "https://app.periscopedata.com";
41498
+
41499
+ var isValidMessage = function isValidMessage(message) {
41500
+ return message.isTrusted && message.origin === PERISCOPE_ORIGIN && message.data && message.data.event_type === DASHBOARD_SIZE_MESSAGE_TYPE;
41501
+ };
41502
+
41503
+ var PeriscopeDashboardIframe = function PeriscopeDashboardIframe(_ref) {
41504
+ var url = _ref.url,
41505
+ requestDashboardUrl = _ref.requestDashboardUrl,
41506
+ periscopeDataPending = _ref.periscopeDataPending,
41507
+ periscopeDataSuccess = _ref.periscopeDataSuccess,
41508
+ periscopeDataFailure = _ref.periscopeDataFailure,
41509
+ periscopeDataRequestSuccess = _ref.periscopeDataRequestSuccess,
41510
+ periscopeDataRequestFailure = _ref.periscopeDataRequestFailure;
41511
+
41512
+ var _useState = React.useState(0),
41513
+ _useState2 = _slicedToArray(_useState, 2),
41514
+ height = _useState2[0],
41515
+ setHeight = _useState2[1];
41516
+
41517
+ var time = {
41518
+ timer: null
41519
+ };
41520
+ React.useEffect(function () {
41521
+ time.timer = setTimeout(function () {
41522
+ periscopeDataRequestFailure();
41523
+ }, 10000);
41524
+ }, []);
41525
+
41526
+ var Dashboard = function Dashboard(height) {
41527
+ return function (url) {
41528
+ return /*#__PURE__*/React__default.createElement(DashboardIframe, {
41529
+ src: url,
41530
+ width: "100%",
41531
+ height: height,
41532
+ "data-qa": "DashboardIframe",
41533
+ onLoad: function onLoad() {
41534
+ var iframe = document.querySelector("iframe");
41535
+ iframe.style.display = "initial";
41536
+ }
41537
+ });
41538
+ };
41539
+ };
41540
+
41541
+ var validatePeriscope = function validatePeriscope(message) {
41542
+ if (isValidMessage(message)) {
41543
+ setHeight(message.data.dashboard_height + 100);
41544
+ clearTimeout(time.timer);
41545
+ periscopeDataRequestSuccess();
41546
+ }
41547
+ };
41548
+
41549
+ React.useLayoutEffect(function () {
41550
+ window.addEventListener("message", validatePeriscope);
41551
+ requestDashboardUrl();
41552
+ return function () {
41553
+ return window.removeEventListener("message", validatePeriscope);
41554
+ };
41555
+ }, [requestDashboardUrl]);
41556
+ return /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(BoxWithShadow$1, {
41557
+ padding: "0",
41558
+ minWidth: "100%",
41559
+ minHeight: "592px",
41560
+ variant: "baseStandard",
41561
+ background: "#fff",
41562
+ borderRadius: "4px",
41563
+ extraStyles: "display: flex; justify-content: center; align-items: center; flex-direction: column;"
41564
+ }, periscopeDataPending && !periscopeDataSuccess && /*#__PURE__*/React__default.createElement(Cover, {
41565
+ minHeight: "100%",
41566
+ singleChild: true
41567
+ }, /*#__PURE__*/React__default.createElement(Center, {
41568
+ intrinsic: true
41569
+ }, /*#__PURE__*/React__default.createElement(Spinner$2, {
41570
+ size: "100"
41571
+ }))), periscopeDataFailure && !periscopeDataSuccess && /*#__PURE__*/React__default.createElement(Box, {
41572
+ padding: "64px"
41573
+ }, /*#__PURE__*/React__default.createElement(Center, {
41574
+ intrinsic: true
41575
+ }, /*#__PURE__*/React__default.createElement(Box, {
41576
+ padding: "0 0 2rem"
41577
+ }, /*#__PURE__*/React__default.createElement(PeriscopeFailedIcon, null)), /*#__PURE__*/React__default.createElement(Heading$1, {
41578
+ variant: "h3",
41579
+ weight: "700"
41580
+ }, "Something Went Wrong"), /*#__PURE__*/React__default.createElement(Paragraph$1, {
41581
+ variant: "p",
41582
+ extraStyles: "text-align: center;"
41583
+ }, "There was an issue trying to load the dashboard."), /*#__PURE__*/React__default.createElement(Paragraph$1, {
41584
+ variant: "p",
41585
+ extraStyles: "text-align: center;"
41586
+ }, "Your organization may not have a dashboard configured."))), !periscopeDataFailure && url && Dashboard(height)(url)));
41587
+ };
41588
+
41438
41589
  var pageBackground = "#F6F6F9";
41439
41590
  var fallbackValues$H = {
41440
41591
  pageBackground: pageBackground
@@ -41813,6 +41964,7 @@ exports.PaymentMethodIcon = PaymentMethodIcon$1;
41813
41964
  exports.PaymentSearchIcon = PaymentSearchIcon;
41814
41965
  exports.PaymentsIconSmall = PaymentsIconSmall$1;
41815
41966
  exports.PendingIcon = PendingIcon;
41967
+ exports.PeriscopeDashboardIframe = PeriscopeDashboardIframe;
41816
41968
  exports.PeriscopeFailedIcon = PeriscopeFailedIcon;
41817
41969
  exports.PhoneForm = PhoneForm;
41818
41970
  exports.Placeholder = Placeholder$1;