@innovaccer/design-system 2.14.1 → 2.15.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/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /**
3
- * Generated on: 1675668316017
3
+ * Generated on: 1678111228905
4
4
  * Package: @innovaccer/design-system
5
- * Version: v2.14.1
5
+ * Version: v2.15.0
6
6
  * License: MIT
7
7
  * Docs: https://innovaccer.github.io/design-system
8
8
  */
@@ -200,64 +200,68 @@
200
200
  return month <= 12 && date <= monthLength[month - 1];
201
201
  };
202
202
 
203
- switch (format) {
204
- case 'dd/mm/yyyy':
205
- {
206
- var p = val.split('/');
207
- var date_1 = +p[0] || 1;
208
- var month = +p[1] || 1;
209
- var year = +p[2] || 1900;
210
- return validate(date_1, month, year);
211
- }
203
+ if (val) {
204
+ switch (format) {
205
+ case 'dd/mm/yyyy':
206
+ {
207
+ var p = val.split('/');
208
+ var date_1 = +p[0] || 1;
209
+ var month = +p[1] || 1;
210
+ var year = +p[2] || 1900;
211
+ return validate(date_1, month, year);
212
+ }
212
213
 
213
- case 'mm/dd/yyyy':
214
- {
215
- var p = val.split('/');
216
- var date_2 = +p[1] || 1;
217
- var month = +p[0] || 1;
218
- var year = +p[2] || 1900;
219
- return validate(date_2, month, year);
220
- }
214
+ case 'mm/dd/yyyy':
215
+ {
216
+ var p = val.split('/');
217
+ var date_2 = +p[1] || 1;
218
+ var month = +p[0] || 1;
219
+ var year = +p[2] || 1900;
220
+ return validate(date_2, month, year);
221
+ }
221
222
 
222
- case 'yyyy/mm/dd':
223
- {
224
- var p = val.split('/');
225
- var date_3 = +p[2] || 1;
226
- var month = +p[1] || 1;
227
- var year = +p[0] || 1900;
228
- return validate(date_3, month, year);
229
- }
223
+ case 'yyyy/mm/dd':
224
+ {
225
+ var p = val.split('/');
226
+ var date_3 = +p[2] || 1;
227
+ var month = +p[1] || 1;
228
+ var year = +p[0] || 1900;
229
+ return validate(date_3, month, year);
230
+ }
230
231
 
231
- case 'dd-mm-yyyy':
232
- {
233
- var p = val.split('-');
234
- var date_4 = +p[0] || 1;
235
- var month = +p[1] || 1;
236
- var year = +p[2] || 1900;
237
- return validate(date_4, month, year);
238
- }
232
+ case 'dd-mm-yyyy':
233
+ {
234
+ var p = val.split('-');
235
+ var date_4 = +p[0] || 1;
236
+ var month = +p[1] || 1;
237
+ var year = +p[2] || 1900;
238
+ return validate(date_4, month, year);
239
+ }
239
240
 
240
- case 'mm-dd-yyyy':
241
- {
242
- var p = val.split('-');
243
- var date_5 = +p[1] || 1;
244
- var month = +p[0] || 1;
245
- var year = +p[2] || 1900;
246
- return validate(date_5, month, year);
247
- }
241
+ case 'mm-dd-yyyy':
242
+ {
243
+ var p = val.split('-');
244
+ var date_5 = +p[1] || 1;
245
+ var month = +p[0] || 1;
246
+ var year = +p[2] || 1900;
247
+ return validate(date_5, month, year);
248
+ }
248
249
 
249
- case 'yyyy-mm-dd':
250
- {
251
- var p = val.split('-');
252
- var date_6 = +p[2] || 1;
253
- var month = +p[1] || 1;
254
- var year = +p[0] || 1900;
255
- return validate(date_6, month, year);
256
- }
250
+ case 'yyyy-mm-dd':
251
+ {
252
+ var p = val.split('-');
253
+ var date_6 = +p[2] || 1;
254
+ var month = +p[1] || 1;
255
+ var year = +p[0] || 1900;
256
+ return validate(date_6, month, year);
257
+ }
257
258
 
258
- default:
259
- return false;
259
+ default:
260
+ return false;
261
+ }
260
262
  }
263
+
264
+ return false;
261
265
  };
262
266
  var time$1 = function time(val, format) {
263
267
  var _a = getTimeObjFromStr(format, val),
@@ -881,7 +885,7 @@
881
885
  var firstSortedList = sortList(firstList);
882
886
  var secondSortedList = sortList(secondList);
883
887
  return firstSortedList.length === secondSortedList.length && firstSortedList.every(function (option, index) {
884
- return option.value === secondSortedList[index].value || option.label === secondSortedList[index].label;
888
+ return option.value === secondSortedList[index].value;
885
889
  });
886
890
  };
887
891
  var _isControlled = function _isControlled(selected) {
@@ -1032,108 +1036,6 @@
1032
1036
  size: 'regular'
1033
1037
  };
1034
1038
 
1035
- var isSpaceKey = function isSpaceKey(e) {
1036
- return e.key === 'Space';
1037
- };
1038
-
1039
- var allowed = {
1040
- button: new Set(['Enter', 'Space', 'Spacebar', ' ']),
1041
- link: new Set(['Enter']),
1042
- checkbox: new Set([]),
1043
- radio: new Set([])
1044
- };
1045
-
1046
- var isKeyboardInteractionAllowed = function isKeyboardInteractionAllowed(role, key) {
1047
- if (!allowed[role]) {
1048
- return false;
1049
- }
1050
-
1051
- var allowedKeys = allowed[role];
1052
- return allowedKeys.has(key);
1053
- };
1054
-
1055
- var useAccessibilityProps = function useAccessibilityProps(_a) {
1056
- var onClick = _a.onClick,
1057
- _onKeyDown = _a.onKeyDown,
1058
- _b = _a.role,
1059
- role = _b === void 0 ? 'button' : _b,
1060
- rest = __rest(_a, ["onClick", "onKeyDown", "role"]);
1061
-
1062
- return __assign({}, onClick ? {
1063
- onClick: onClick,
1064
- role: role,
1065
- tabIndex: 0,
1066
- 'aria-label': rest['aria-label'],
1067
- onKeyDown: function onKeyDown(e) {
1068
- if (_onKeyDown) {
1069
- _onKeyDown(e);
1070
-
1071
- return;
1072
- }
1073
-
1074
- var key = e.key;
1075
-
1076
- if (isKeyboardInteractionAllowed(role, key)) {
1077
- if (onClick) {
1078
- e.preventDefault();
1079
- onClick(e);
1080
- }
1081
- }
1082
- }
1083
- } : {
1084
- role: role,
1085
- 'aria-label': rest['aria-label']
1086
- });
1087
- };
1088
-
1089
- var Icon = function Icon(props) {
1090
- var _a;
1091
-
1092
- var appearance = props.appearance,
1093
- className = props.className,
1094
- name = props.name,
1095
- size = props.size,
1096
- children = props.children;
1097
- var accessibilityProps = useAccessibilityProps(props);
1098
- var baseProps = extractBaseProps(props);
1099
-
1100
- var mapper = function mapper(val) {
1101
- if (val === 'outline') return 'outlined';
1102
- if (val === 'rounded') return 'round';
1103
- return val;
1104
- };
1105
-
1106
- var type = mapper(props.type);
1107
-
1108
- var getIconAppearance = function getIconAppearance(iconColor) {
1109
- var x = iconColor.indexOf('_');
1110
- return iconColor.slice(0, x) + iconColor.charAt(x + 1).toUpperCase() + iconColor.slice(x + 2);
1111
- };
1112
-
1113
- var color = appearance && appearance.includes('_') ? getIconAppearance(appearance) : appearance;
1114
- var iconClass = classNames__default["default"]((_a = {}, _a['material-icons'] = true, _a["material-icons-" + mapper(type)] = type && type !== 'filled', _a['Icon'] = true, _a["Icon--" + color] = appearance, _a["" + className] = className, _a));
1115
- var styles = {
1116
- fontSize: size + "px",
1117
- width: size + "px"
1118
- };
1119
-
1120
- if (children && /*#__PURE__*/React__namespace.isValidElement(children)) {
1121
- return /*#__PURE__*/React__namespace.createElement("span", __assign({}, baseProps, {
1122
- className: className
1123
- }), children);
1124
- }
1125
-
1126
- return /*#__PURE__*/React__namespace.createElement("i", __assign({}, baseProps, {
1127
- className: iconClass,
1128
- style: styles
1129
- }, accessibilityProps), type ? name + "_" + type : name);
1130
- };
1131
- Icon.displayName = 'Icon';
1132
- Icon.defaultProps = {
1133
- size: 16,
1134
- type: 'round'
1135
- };
1136
-
1137
1039
  var uidGenerator = function uidGenerator() {
1138
1040
  var dt = new Date().getTime();
1139
1041
  var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
@@ -1145,16 +1047,76 @@
1145
1047
  return uuid;
1146
1048
  };
1147
1049
 
1050
+ var CheckboxIcon = function CheckboxIcon(props) {
1051
+ switch (props.name) {
1052
+ case 'checked--regular':
1053
+ return /*#__PURE__*/React__default["default"].createElement("svg", {
1054
+ width: "10",
1055
+ height: "8",
1056
+ viewBox: "0 0 10 8",
1057
+ fill: "none",
1058
+ xmlns: "http://www.w3.org/2000/svg"
1059
+ }, /*#__PURE__*/React__default["default"].createElement("path", {
1060
+ fillRule: "evenodd",
1061
+ clipRule: "evenodd",
1062
+ d: "M3.66667 5.56L8.72667 0.5L9.66667 1.44667L3.66667 7.44667L0.333333 4.11333L1.27333 3.17333L3.66667 5.56Z",
1063
+ fill: "white"
1064
+ }));
1065
+
1066
+ case 'checked--tiny':
1067
+ return /*#__PURE__*/React__default["default"].createElement("svg", {
1068
+ width: "10",
1069
+ height: "8",
1070
+ viewBox: "0 0 10 8",
1071
+ fill: "none",
1072
+ xmlns: "http://www.w3.org/2000/svg"
1073
+ }, /*#__PURE__*/React__default["default"].createElement("path", {
1074
+ d: "M0.333344 4L1.27334 3.06L3.66668 5.44667L8.72668 0.386665L9.66668 1.33333L3.66668 7.33333L0.333344 4Z",
1075
+ fill: "white"
1076
+ }));
1077
+
1078
+ case 'indeterminate--regular':
1079
+ return /*#__PURE__*/React__default["default"].createElement("svg", {
1080
+ width: "10",
1081
+ height: "2",
1082
+ viewBox: "0 0 10 2",
1083
+ fill: "none",
1084
+ xmlns: "http://www.w3.org/2000/svg"
1085
+ }, /*#__PURE__*/React__default["default"].createElement("path", {
1086
+ d: "M0 0H10V2H0V0Z",
1087
+ fill: "white"
1088
+ }));
1089
+
1090
+ case 'indeterminate--tiny':
1091
+ return /*#__PURE__*/React__default["default"].createElement("svg", {
1092
+ width: "8",
1093
+ height: "2",
1094
+ viewBox: "0 0 8 2",
1095
+ fill: "none",
1096
+ xmlns: "http://www.w3.org/2000/svg"
1097
+ }, /*#__PURE__*/React__default["default"].createElement("path", {
1098
+ fillRule: "evenodd",
1099
+ clipRule: "evenodd",
1100
+ d: "M8 0H0V2H8V0Z",
1101
+ fill: "white"
1102
+ }));
1103
+
1104
+ default:
1105
+ return null;
1106
+ }
1107
+ };
1108
+
1148
1109
  var Checkbox = /*#__PURE__*/React__namespace.forwardRef(function (props, forwardedRef) {
1149
- var _a, _b, _c, _d, _e;
1110
+ var _a, _b, _c, _d, _e, _f;
1150
1111
 
1151
- var _f = props.size,
1152
- size = _f === void 0 ? 'regular' : _f,
1153
- _g = props.tabIndex,
1154
- tabIndex = _g === void 0 ? 0 : _g,
1112
+ var _g = props.size,
1113
+ size = _g === void 0 ? 'regular' : _g,
1114
+ _h = props.tabIndex,
1115
+ tabIndex = _h === void 0 ? 0 : _h,
1155
1116
  defaultChecked = props.defaultChecked,
1156
1117
  indeterminate = props.indeterminate,
1157
1118
  label = props.label,
1119
+ error = props.error,
1158
1120
  disabled = props.disabled,
1159
1121
  onChange = props.onChange,
1160
1122
  name = props.name,
@@ -1162,18 +1124,18 @@
1162
1124
  className = props.className,
1163
1125
  checkedProp = props.checked,
1164
1126
  helpText = props.helpText,
1165
- _h = props.id,
1166
- id = _h === void 0 ? name + "-" + label + "-" + uidGenerator() : _h,
1167
- rest = __rest(props, ["size", "tabIndex", "defaultChecked", "indeterminate", "label", "disabled", "onChange", "name", "value", "className", "checked", "helpText", "id"]);
1127
+ _j = props.id,
1128
+ id = _j === void 0 ? name + "-" + label + "-" + uidGenerator() : _j,
1129
+ rest = __rest(props, ["size", "tabIndex", "defaultChecked", "indeterminate", "label", "error", "disabled", "onChange", "name", "value", "className", "checked", "helpText", "id"]);
1168
1130
 
1169
1131
  var ref = React__namespace.useRef(null);
1170
1132
  React__namespace.useImperativeHandle(forwardedRef, function () {
1171
1133
  return ref.current;
1172
1134
  });
1173
1135
 
1174
- var _j = React__namespace.useState(checkedProp === undefined ? defaultChecked : checkedProp),
1175
- checked = _j[0],
1176
- setChecked = _j[1];
1136
+ var _k = React__namespace.useState(checkedProp === undefined ? defaultChecked : checkedProp),
1137
+ checked = _k[0],
1138
+ setChecked = _k[1];
1177
1139
 
1178
1140
  React__namespace.useEffect(function () {
1179
1141
  setIndeterminate(indeterminate);
@@ -1186,7 +1148,7 @@
1186
1148
  var CheckboxClass = classNames__default["default"]((_a = {}, _a['Checkbox'] = true, _a['Checkbox--disabled'] = disabled, _a), className);
1187
1149
  var CheckboxOuterWrapper = classNames__default["default"]((_b = {}, _b['Checkbox-outerWrapper'] = true, _b["Checkbox-outerWrapper--" + size] = size, _b));
1188
1150
  var CheckboxInputWrapper = classNames__default["default"]((_c = {}, _c['Checkbox-input'] = true, _c['Checkbox-input--checked'] = checked, _c['Checkbox-input--indeterminate'] = props.indeterminate, _c));
1189
- var CheckboxWrapper = classNames__default["default"]((_d = {}, _d['Checkbox-wrapper'] = true, _d));
1151
+ var CheckboxWrapper = classNames__default["default"]((_d = {}, _d['Checkbox-wrapper'] = true, _d['Checkbox-wrapper--default'] = !error, _d['Checkbox-wrapper--error'] = error, _d));
1190
1152
  var CheckboxLabelClass = classNames__default["default"]((_e = {}, _e['Checkbox-label'] = true, _e));
1191
1153
 
1192
1154
  var setIndeterminate = function setIndeterminate(indeterminateValue) {
@@ -1202,8 +1164,7 @@
1202
1164
  if (onChange) onChange(e);
1203
1165
  };
1204
1166
 
1205
- var IconName = indeterminate ? 'remove' : checked ? 'check' : '';
1206
- var IconSize = size === 'tiny' ? 12 : 16;
1167
+ var IconMapper = classNames__default["default"]((_f = {}, _f['checked--regular'] = checked && size === 'regular', _f['checked--tiny'] = checked && size === 'tiny', _f['indeterminate--regular'] = indeterminate && size === 'regular', _f['indeterminate--tiny'] = indeterminate && size === 'tiny', _f));
1207
1168
  return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement("div", {
1208
1169
  "data-test": "DesignSystem-Checkbox",
1209
1170
  className: CheckboxClass
@@ -1226,10 +1187,8 @@
1226
1187
  })), /*#__PURE__*/React__namespace.createElement("span", {
1227
1188
  className: CheckboxWrapper,
1228
1189
  "data-test": "DesignSystem-Checkbox-Icon"
1229
- }, IconName && /*#__PURE__*/React__namespace.createElement(Icon, {
1230
- name: IconName,
1231
- size: IconSize,
1232
- appearance: 'white'
1190
+ }, IconMapper && /*#__PURE__*/React__namespace.createElement(CheckboxIcon, {
1191
+ name: IconMapper
1233
1192
  }))), /*#__PURE__*/React__namespace.createElement("div", {
1234
1193
  className: "Checkbox-labelWrapper"
1235
1194
  }, label && label.trim() && /*#__PURE__*/React__namespace.createElement("label", {
@@ -1611,12 +1570,15 @@
1611
1570
  };
1612
1571
 
1613
1572
  var Loading = function Loading(props) {
1614
- var loadingType = props.loadingType;
1573
+ var loadingType = props.loadingType,
1574
+ optionIndex = props.optionIndex;
1575
+ var placeholderSizes = ['medium', 'large'];
1576
+ var size = placeholderSizes[(optionIndex + 2) % 2];
1615
1577
 
1616
1578
  switch (loadingType) {
1617
1579
  case 'DEFAULT':
1618
1580
  return /*#__PURE__*/React__namespace.createElement(PlaceholderParagraph, {
1619
- length: 'large',
1581
+ length: size,
1620
1582
  "data-test": "DesignSystem-Dropdown--PlaceholderParagraph"
1621
1583
  });
1622
1584
 
@@ -1953,7 +1915,8 @@
1953
1915
  className: "Option-loading",
1954
1916
  key: option + "-" + ind
1955
1917
  }, /*#__PURE__*/React__namespace.createElement(Loading, {
1956
- loadingType: type
1918
+ loadingType: type,
1919
+ optionIndex: ind
1957
1920
  }));
1958
1921
  });
1959
1922
  };
@@ -3644,6 +3607,13 @@
3644
3607
  'Calendar-value--disabled': disabled,
3645
3608
  'Calendar-yearValue': true
3646
3609
  }, _a["Calendar-yearValue--" + size] = size, _a['Calendar-value--currDateMonthYear'] = isCurrentYear(), _a));
3610
+ var getTextColor = classNames__default["default"]({
3611
+ inverse: !active && !isCurrentYear() && !disabled,
3612
+ white: active,
3613
+ 'primary-lighter': isCurrentYear() && disabled,
3614
+ primary: isCurrentYear(),
3615
+ 'inverse-lightest': disabled
3616
+ });
3647
3617
  return /*#__PURE__*/React__namespace.createElement("div", {
3648
3618
  key: row + "-" + col,
3649
3619
  "data-test": "DesignSystem-Calendar--yearValue",
@@ -3652,7 +3622,8 @@
3652
3622
  onMouseOver: _this.yearMouseOverHandler.bind(_this, year, isCurrentYear(), disabled)
3653
3623
  }, /*#__PURE__*/React__namespace.createElement(Text, {
3654
3624
  size: size === 'small' ? 'small' : 'regular',
3655
- appearance: active ? 'white' : disabled ? 'disabled' : isCurrentYear() ? 'link' : 'default'
3625
+ color: getTextColor,
3626
+ className: "Calendar-text"
3656
3627
  }, year));
3657
3628
  }));
3658
3629
  });
@@ -3694,9 +3665,16 @@
3694
3665
  var valueClass = classNames__default["default"]((_a = {
3695
3666
  'Calendar-value': true,
3696
3667
  'Calendar-value--active': active,
3697
- 'Calendar-value--dummy': disabled,
3668
+ 'Calendar-value--disabled': disabled,
3698
3669
  'Calendar-monthValue': true
3699
3670
  }, _a["Calendar-monthValue--" + size] = size, _a['Calendar-value--currDateMonthYear'] = isCurrentMonth(), _a));
3671
+ var getTextColor = classNames__default["default"]({
3672
+ inverse: !active && !isCurrentMonth() && !disabled,
3673
+ white: active,
3674
+ 'primary-lighter': isCurrentMonth() && disabled,
3675
+ primary: isCurrentMonth(),
3676
+ 'inverse-lightest': disabled
3677
+ });
3700
3678
  return /*#__PURE__*/React__namespace.createElement("div", {
3701
3679
  key: row + "-" + col,
3702
3680
  "data-test": "DesignSystem-Calendar--monthValue",
@@ -3705,7 +3683,8 @@
3705
3683
  onMouseOver: _this.monthMouseOverHandler.bind(_this, month, isCurrentMonth(), disabled)
3706
3684
  }, /*#__PURE__*/React__namespace.createElement(Text, {
3707
3685
  size: size === 'small' ? 'small' : 'regular',
3708
- appearance: active ? 'white' : disabled ? 'disabled' : isCurrentMonth() ? 'link' : 'default'
3686
+ color: getTextColor,
3687
+ className: "Calendar-text"
3709
3688
  }, months[month]));
3710
3689
  }));
3711
3690
  });
@@ -3920,6 +3899,7 @@
3920
3899
  });
3921
3900
  var valueClass = classNames__default["default"]((_a = {
3922
3901
  'Calendar-value': true,
3902
+ 'Calendar-inRangeValue': !isStart && !isEnd,
3923
3903
  'Calendar-value--start': isStart && !isEnd,
3924
3904
  'Calendar-value--end': isEnd && !isStart,
3925
3905
  'Calendar-value--startError': isStart && isRangeError,
@@ -3928,12 +3908,19 @@
3928
3908
  'Calendar-value--disabled': disabled,
3929
3909
  'Calendar-dateValue': true
3930
3910
  }, _a["Calendar-dateValue--" + size] = size, _a['Calendar-value--currDateMonthYear'] = today(), _a));
3911
+ var getTextColor = classNames__default["default"]({
3912
+ inverse: !active && !today() && !disabled,
3913
+ white: active,
3914
+ 'primary-lighter': today() && disabled,
3915
+ primary: today(),
3916
+ 'inverse-lightest': disabled
3917
+ });
3931
3918
  return /*#__PURE__*/React__namespace.createElement("div", {
3932
3919
  key: row + "-" + col,
3933
3920
  className: wrapperClass,
3934
3921
  "data-test": "designSystem-Calendar-WrapperClass"
3935
3922
  }, !dummy && /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(Text, {
3936
- appearance: active ? 'white' : disabled ? 'disabled' : today() ? 'link' : 'default',
3923
+ color: getTextColor,
3937
3924
  size: size === 'small' ? 'small' : 'regular',
3938
3925
  "data-test": "DesignSystem-Calendar--dateValue",
3939
3926
  className: valueClass,
@@ -3960,7 +3947,7 @@
3960
3947
  size = _c.size,
3961
3948
  monthsInView = _c.monthsInView;
3962
3949
  var view = _this.state.view;
3963
- var containerClass = classNames__default["default"]((_a = {}, _a['Calendar'] = true, _a["Calendar--" + view + "--" + size] = view, _a["Calendar--" + size] = size, _a));
3950
+ var containerClass = classNames__default["default"]((_a = {}, _a['Calendar'] = true, _a["Calendar-" + view + "--" + size] = view, _a["Calendar--" + size] = size, _a));
3964
3951
  var headerClass = classNames__default["default"]((_b = {}, _b["Calendar-header--" + size] = size, _b));
3965
3952
  var bodyClass = classNames__default["default"]({
3966
3953
  'Calendar-body': true
@@ -3991,7 +3978,7 @@
3991
3978
  month = _b.month,
3992
3979
  date = _b.date;
3993
3980
 
3994
- var todayCompleteDate = getDateInfo(new Date());
3981
+ var todayCompleteDate = getDateInfo(new Date(Date.now()));
3995
3982
  _this.state = {
3996
3983
  currDate: currDate,
3997
3984
  startDate: startDate,
@@ -4297,6 +4284,108 @@
4297
4284
  withSeperator: true
4298
4285
  };
4299
4286
 
4287
+ var isSpaceKey = function isSpaceKey(e) {
4288
+ return e.key === 'Space';
4289
+ };
4290
+
4291
+ var allowed = {
4292
+ button: new Set(['Enter', 'Space', 'Spacebar', ' ']),
4293
+ link: new Set(['Enter']),
4294
+ checkbox: new Set([]),
4295
+ radio: new Set([])
4296
+ };
4297
+
4298
+ var isKeyboardInteractionAllowed = function isKeyboardInteractionAllowed(role, key) {
4299
+ if (!allowed[role]) {
4300
+ return false;
4301
+ }
4302
+
4303
+ var allowedKeys = allowed[role];
4304
+ return allowedKeys.has(key);
4305
+ };
4306
+
4307
+ var useAccessibilityProps = function useAccessibilityProps(_a) {
4308
+ var onClick = _a.onClick,
4309
+ _onKeyDown = _a.onKeyDown,
4310
+ _b = _a.role,
4311
+ role = _b === void 0 ? 'button' : _b,
4312
+ rest = __rest(_a, ["onClick", "onKeyDown", "role"]);
4313
+
4314
+ return __assign({}, onClick ? {
4315
+ onClick: onClick,
4316
+ role: role,
4317
+ tabIndex: 0,
4318
+ 'aria-label': rest['aria-label'],
4319
+ onKeyDown: function onKeyDown(e) {
4320
+ if (_onKeyDown) {
4321
+ _onKeyDown(e);
4322
+
4323
+ return;
4324
+ }
4325
+
4326
+ var key = e.key;
4327
+
4328
+ if (isKeyboardInteractionAllowed(role, key)) {
4329
+ if (onClick) {
4330
+ e.preventDefault();
4331
+ onClick(e);
4332
+ }
4333
+ }
4334
+ }
4335
+ } : {
4336
+ role: role,
4337
+ 'aria-label': rest['aria-label']
4338
+ });
4339
+ };
4340
+
4341
+ var Icon = function Icon(props) {
4342
+ var _a;
4343
+
4344
+ var appearance = props.appearance,
4345
+ className = props.className,
4346
+ name = props.name,
4347
+ size = props.size,
4348
+ children = props.children;
4349
+ var accessibilityProps = useAccessibilityProps(props);
4350
+ var baseProps = extractBaseProps(props);
4351
+
4352
+ var mapper = function mapper(val) {
4353
+ if (val === 'outline') return 'outlined';
4354
+ if (val === 'rounded') return 'round';
4355
+ return val;
4356
+ };
4357
+
4358
+ var type = mapper(props.type);
4359
+
4360
+ var getIconAppearance = function getIconAppearance(iconColor) {
4361
+ var x = iconColor.indexOf('_');
4362
+ return iconColor.slice(0, x) + iconColor.charAt(x + 1).toUpperCase() + iconColor.slice(x + 2);
4363
+ };
4364
+
4365
+ var color = appearance && appearance.includes('_') ? getIconAppearance(appearance) : appearance;
4366
+ var iconClass = classNames__default["default"]((_a = {}, _a['material-icons'] = true, _a["material-icons-" + mapper(type)] = type && type !== 'filled', _a['Icon'] = true, _a["Icon--" + color] = appearance, _a["" + className] = className, _a));
4367
+ var styles = {
4368
+ fontSize: size + "px",
4369
+ width: size + "px"
4370
+ };
4371
+
4372
+ if (children && /*#__PURE__*/React__namespace.isValidElement(children)) {
4373
+ return /*#__PURE__*/React__namespace.createElement("span", __assign({}, baseProps, {
4374
+ className: className
4375
+ }), children);
4376
+ }
4377
+
4378
+ return /*#__PURE__*/React__namespace.createElement("i", __assign({}, baseProps, {
4379
+ className: iconClass,
4380
+ style: styles
4381
+ }, accessibilityProps), type ? name + "_" + type : name);
4382
+ };
4383
+ Icon.displayName = 'Icon';
4384
+ Icon.defaultProps = {
4385
+ size: 16,
4386
+ type: 'round'
4387
+ };
4388
+
4300
4389
  var GenericChip = function GenericChip(props) {
4301
4390
  var _a;
4302
4391
 
@@ -4502,6 +4591,22 @@
4502
4591
  var _a = inputOptions.placeholderChar,
4503
4592
  placeholderChar = _a === void 0 ? '_' : _a;
4504
4593
 
4594
+ var onPasteHandler = function onPasteHandler(_e, val) {
4595
+ var onPaste = inputOptions.onPaste;
4596
+ setState({
4597
+ open: true
4598
+ });
4599
+
4600
+ if (val && !val.includes(placeholderChar)) {
4601
+ var d = translateToDate(inputFormat, val, validators);
4602
+ setState({
4603
+ date: d
4604
+ });
4605
+ }
4606
+
4607
+ if (onPaste) onPaste(_e, val);
4608
+ };
4609
+
4505
4610
  var onChangeHandler = function onChangeHandler(_e, val) {
4506
4611
  var onChange = inputOptions.onChange;
4507
4612
  setState({
@@ -4563,6 +4668,7 @@
4563
4668
  mask: mask,
4564
4669
  value: date$1 ? translateToString(inputFormat, date$1) : init ? X.utils.getDefaultValue(mask, placeholderChar) : '',
4565
4670
  onChange: onChangeHandler,
4671
+ onPaste: onPasteHandler,
4566
4672
  onBlur: onBlurHandler,
4567
4673
  onClear: onClearHandler,
4568
4674
  caption: showError ? errorMessage : '',
@@ -5489,12 +5595,13 @@
5489
5595
  onClear = props.onClear,
5490
5596
  onBlur = props.onBlur,
5491
5597
  onFocus = props.onFocus,
5598
+ onPaste = props.onPaste,
5492
5599
  actionIcon = props.actionIcon,
5493
5600
  className = props.className,
5494
5601
  autoFocus = props.autoFocus,
5495
5602
  disabled = props.disabled,
5496
5603
  readOnly = props.readOnly,
5497
- rest = __rest(props, ["size", "type", "minWidth", "defaultValue", "name", "placeholder", "value", "icon", "inlineLabel", "required", "error", "info", "onChange", "onClick", "onClear", "onBlur", "onFocus", "actionIcon", "className", "autoFocus", "disabled", "readOnly"]);
5604
+ rest = __rest(props, ["size", "type", "minWidth", "defaultValue", "name", "placeholder", "value", "icon", "inlineLabel", "required", "error", "info", "onChange", "onClick", "onClear", "onBlur", "onFocus", "onPaste", "actionIcon", "className", "autoFocus", "disabled", "readOnly"]);
5498
5605
 
5499
5606
  var ref = React__namespace.useRef(null);
5500
5607
  React__namespace.useImperativeHandle(forwardedRef, function () {
@@ -5557,7 +5664,8 @@
5557
5664
  onChange: onChange,
5558
5665
  onBlur: onBlur,
5559
5666
  onClick: onClick,
5560
- onFocus: onFocus
5667
+ onFocus: onFocus,
5668
+ onPaste: onPaste
5561
5669
  })), disabled ? '' : info ? /*#__PURE__*/React__namespace.createElement(Tooltip, {
5562
5670
  position: "top",
5563
5671
  tooltip: info
@@ -5798,13 +5906,14 @@
5798
5906
  caption = props.caption,
5799
5907
  required = props.required,
5800
5908
  onChange = props.onChange,
5909
+ onPaste = props.onPaste,
5801
5910
  onBlur = props.onBlur,
5802
5911
  onFocus = props.onFocus,
5803
5912
  onClear = props.onClear,
5804
5913
  className = props.className,
5805
5914
  id = props.id,
5806
5915
  helpText = props.helpText,
5807
- rest = __rest(props, ["mask", "value", "placeholderChar", "validators", "clearOnEmptyBlur", "defaultValue", "mask", "error", "caption", "required", "onChange", "onBlur", "onFocus", "onClear", "className", "id", "helpText"]);
5916
+ rest = __rest(props, ["mask", "value", "placeholderChar", "validators", "clearOnEmptyBlur", "defaultValue", "mask", "error", "caption", "required", "onChange", "onPaste", "onBlur", "onFocus", "onClear", "className", "id", "helpText"]);
5808
5917
 
5809
5918
  var isEditable = React__namespace.useCallback(function (pos) {
5810
5919
  return _typeof(mask[pos]) === 'object';
@@ -5937,8 +6046,48 @@
5937
6046
  selectionPos.current = getCurrSelection();
5938
6047
  deferId.current = window.requestAnimationFrame(updateSelection);
5939
6048
  }, [selectionPos.current, getCurrSelection]);
6049
+
6050
+ var matchSeparatorValue = function matchSeparatorValue(currValue) {
6051
+ var separator = props.placeholder || 'dd/mm/yyyy';
6052
+
6053
+ if (separator.substring(0, 4) === 'yyyy') {
6054
+ return currValue && currValue[4] === separator[4] && currValue[7] === separator[7];
6055
+ }
6056
+
6057
+ return currValue && currValue[2] === separator[2] && currValue[5] === separator[5];
6058
+ };
6059
+
6060
+ var isSameFormat = function isSameFormat(currValue, inputLength) {
6061
+ var value = currValue.substring(0, inputLength);
6062
+
6063
+ if (inputLength === 23) {
6064
+ var date = value.split(' - ');
6065
+ var startVal = date[0];
6066
+ var endVal = date[1];
6067
+ return matchSeparatorValue(startVal) && matchSeparatorValue(endVal);
6068
+ }
6069
+
6070
+ return matchSeparatorValue(value);
6071
+ };
6072
+
6073
+ var onPasteHandler = function onPasteHandler(e) {
6074
+ var _a;
6075
+
6076
+ e.preventDefault();
6077
+ var pastedValue = (_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('Text');
6078
+ var sameFormat = isSameFormat(pastedValue, pastedValue.length);
6079
+ var isValidDate = isValid(validators, pastedValue);
6080
+
6081
+ if (sameFormat && onPaste && isValidDate) {
6082
+ onPaste(e, pastedValue);
6083
+ setValue(pastedValue);
6084
+ }
6085
+ };
6086
+
5940
6087
  var onChangeHandler = React__namespace.useCallback(function (e) {
5941
- var inputVal = e.currentTarget.value;
6088
+ var _a;
6089
+
6090
+ var inputVal = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value;
5942
6091
  var currSelection = getCurrSelection();
5943
6092
  var start = Math.min(selectionPos.current.start, currSelection.start);
5944
6093
  var end = currSelection.end;
@@ -6051,6 +6200,7 @@
6051
6200
  onChange: onChangeHandler,
6052
6201
  onClear: onClearHandler,
6053
6202
  onBlur: onBlurHandler,
6203
+ onPaste: onPasteHandler,
6054
6204
  autoComplete: 'off',
6055
6205
  ref: ref
6056
6206
  })), /*#__PURE__*/React__namespace.createElement(HelpText, {
@@ -7680,7 +7830,7 @@
7680
7830
  var iconClass = function iconClass(align) {
7681
7831
  var _a;
7682
7832
 
7683
- return classNames__default["default"]((_a = {}, _a['Toast-icon'] = true, _a["Toast-icon--" + align] = align, _a["Toast-icon--" + appearance] = appearance, _a));
7833
+ return classNames__default["default"]((_a = {}, _a['Toast-icon'] = true, _a["Toast-icon--" + align] = align, _a["Toast-icon--" + appearance] = appearance, _a["Toast-close-icon--" + appearance] = appearance && align === 'right', _a));
7684
7834
  };
7685
7835
 
7686
7836
  var textClass = classNames__default["default"]((_c = {}, _c['Toast-text'] = true, _c["Toast-text--" + appearance] = appearance, _c));
@@ -10484,15 +10634,14 @@
10484
10634
  active = props.active,
10485
10635
  completed = props.completed,
10486
10636
  onChange = props.onChange;
10487
- var StepClass = classNames__default["default"]((_a = {}, _a['Step'] = true, _a['Step--active'] = active, _a['Step--disabled'] = disabled, _a['Stepper-animate'] = true, _a));
10637
+ var StepClass = classNames__default["default"]((_a = {}, _a['Step'] = true, _a['Step--active'] = active, _a['Step--disabled'] = disabled, _a['Stepper-animate'] = true, _a['color-primary-dark'] = active || completed, _a['color-inverse-lightest'] = disabled, _a));
10488
10638
 
10489
10639
  var onClickHandle = function onClickHandle() {
10490
10640
  if (disabled) return;
10491
10641
  if (onChange) onChange(label, value);
10492
10642
  };
10493
10643
 
10494
- var iconAppearance = completed ? 'info' : disabled ? 'disabled' : active ? 'info' : 'default';
10495
- var appearance = active ? 'link' : disabled ? 'disabled' : 'default';
10644
+ var textColor = active ? 'primary-dark' : disabled ? 'inverse-lightest' : 'inverse';
10496
10645
  return /*#__PURE__*/React__namespace.createElement("div", {
10497
10646
  "data-test": "DesignSystem-Step",
10498
10647
  className: StepClass,
@@ -10500,11 +10649,10 @@
10500
10649
  }, /*#__PURE__*/React__namespace.createElement(Icon, {
10501
10650
  "data-test": "DesignSystem-Step--Icon",
10502
10651
  name: completed ? 'check_circle' : 'radio_button_unchecked',
10503
- appearance: iconAppearance,
10504
10652
  className: "mr-3 my-4 Stepper-animate"
10505
10653
  }), label && /*#__PURE__*/React__namespace.createElement(Text, {
10506
10654
  weight: "medium",
10507
- appearance: appearance,
10655
+ color: textColor,
10508
10656
  className: "Stepper-animate"
10509
10657
  }, label));
10510
10658
  };
@@ -10594,6 +10742,56 @@
10594
10742
  }
10595
10743
  };
10596
10744
 
10745
+ var onPasteHandler = function onPasteHandler(_e, val, type) {
10746
+ setState({
10747
+ open: true
10748
+ });
10749
+
10750
+ if (type === 'start') {
10751
+ var placeholderChar = startInputOptions.placeholderChar || '_';
10752
+
10753
+ if (val && !val.includes(placeholderChar)) {
10754
+ var d = translateToDate(inputFormat, val, validators);
10755
+
10756
+ if (d) {
10757
+ setState({
10758
+ startDate: d
10759
+ });
10760
+
10761
+ if (endDate) {
10762
+ var _a = getDateInfo(endDate),
10763
+ eYear = _a.year,
10764
+ eMonth = _a.month,
10765
+ eDate = _a.date;
10766
+
10767
+ if (compareDate(startDate, 'more', eYear, eMonth, eDate)) {
10768
+ setState({
10769
+ endDate: undefined
10770
+ });
10771
+ }
10772
+ }
10773
+
10774
+ if (startInputOptions.onPaste) startInputOptions.onPaste(_e, val);
10775
+ }
10776
+ }
10777
+ }
10778
+
10779
+ if (type === 'end') {
10780
+ var placeholderChar = endInputOptions.placeholderChar ? endInputOptions.placeholderChar : '_';
10781
+
10782
+ if (val && !val.includes(placeholderChar)) {
10783
+ var d = translateToDate(inputFormat, val, validators);
10784
+
10785
+ if (d) {
10786
+ setState({
10787
+ endDate: d
10788
+ });
10789
+ if (endInputOptions.onPaste) endInputOptions.onPaste(_e, val);
10790
+ }
10791
+ }
10792
+ }
10793
+ };
10794
+
10597
10795
  var onChangeHandler = function onChangeHandler(_e, val, type) {
10598
10796
  setState({
10599
10797
  open: true
@@ -10743,6 +10941,9 @@
10743
10941
  onChange: function onChange(e, val) {
10744
10942
  onChangeHandler(e, val || '', 'start');
10745
10943
  },
10944
+ onPaste: function onPaste(e, val) {
10945
+ onPasteHandler(e, val || '', 'start');
10946
+ },
10746
10947
  onBlur: function onBlur(e, val) {
10747
10948
  onBlurHandler(e, val || '', 'start');
10748
10949
  },
@@ -10772,6 +10973,9 @@
10772
10973
  onChange: function onChange(e, val) {
10773
10974
  onChangeHandler(e, val || '', 'end');
10774
10975
  },
10976
+ onPaste: function onPaste(e, val) {
10977
+ onPasteHandler(e, val || '', 'end');
10978
+ },
10775
10979
  onBlur: function onBlur(e, val) {
10776
10980
  onBlurHandler(e, val || '', 'end');
10777
10981
  },
@@ -10819,6 +11023,22 @@
10819
11023
  return isValid(validators, startVal, inputFormat) && isValid(validators, endVal, inputFormat);
10820
11024
  };
10821
11025
 
11026
+ var onPasteHandler = function onPasteHandler(_e, val) {
11027
+ var onPaste = inputOptions.onPaste;
11028
+ var date = val.split(' - ');
11029
+ var startVal = date[0];
11030
+ var endVal = date[1];
11031
+ var endD = translateToDate(inputFormat, endVal, validators);
11032
+ var startD = translateToDate(inputFormat, startVal, validators);
11033
+ setState({
11034
+ startDate: startD,
11035
+ endDate: endD,
11036
+ startValue: startVal,
11037
+ endValue: endVal
11038
+ });
11039
+ if (onPaste) onPaste(_e, val);
11040
+ };
11041
+
10822
11042
  var onChangeHandler = function onChangeHandler(_e, val) {
10823
11043
  var date = val.split(' - ');
10824
11044
  var startVal = date[0];
@@ -10933,6 +11153,9 @@
10933
11153
  onBlur: function onBlur(e, val) {
10934
11154
  onBlurHandler(e, val || '');
10935
11155
  },
11156
+ onPaste: function onPaste(e, val) {
11157
+ onPasteHandler(e, val || '');
11158
+ },
10936
11159
  onClear: onClearHandler,
10937
11160
  error: showError,
10938
11161
  caption: showError ? errorMessage : '',
@@ -15664,7 +15887,7 @@
15664
15887
  };
15665
15888
  HelpText.displayName = 'HelpText';
15666
15889
 
15667
- var version = "2.14.1";
15890
+ var version = "2.15.0";
15668
15891
 
15669
15892
  exports.Avatar = Avatar;
15670
15893
  exports.AvatarGroup = AvatarGroup;