@tsed/react-formio 1.11.1 → 1.13.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.
Files changed (152) hide show
  1. package/.env +2 -1
  2. package/craco.config.js +11 -1
  3. package/dist/components/alert/alert.component.spec.d.ts +1 -0
  4. package/dist/components/alert/alert.stories.d.ts +15 -0
  5. package/dist/components/card/card.component.d.ts +2 -1
  6. package/dist/components/form/form.component.d.ts +2 -0
  7. package/dist/components/form/form.stories.d.ts +37 -0
  8. package/dist/components/form/useForm.hook.d.ts +1 -0
  9. package/dist/components/form-action/formAction.stories.d.ts +90 -414
  10. package/dist/components/input-text/inputText.component.d.ts +1 -1
  11. package/dist/components/input-text/inputText.component.spec.d.ts +1 -0
  12. package/dist/components/loader/loader.component.d.ts +2 -2
  13. package/dist/components/loader/loader.stories.d.ts +15 -0
  14. package/dist/components/pagination/pagination.component.spec.d.ts +1 -0
  15. package/dist/components/pagination/pagination.stories.d.ts +0 -27
  16. package/dist/components/select/select.component.spec.d.ts +1 -0
  17. package/dist/components/tabs/tabs.component.spec.d.ts +1 -0
  18. package/dist/index.js +114 -35
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.modern.js +86 -34
  21. package/dist/index.modern.js.map +1 -1
  22. package/jest.config.js +1 -1
  23. package/package.json +5 -9
  24. package/readme.md +114 -86
  25. package/src/components/__fixtures__/form-schema.json +10 -42
  26. package/src/components/__fixtures__/form.fixture.json +1 -1
  27. package/src/components/actions-table/actionsTable.component.spec.tsx +4 -13
  28. package/src/components/actions-table/actionsTable.component.tsx +3 -11
  29. package/src/components/alert/alert.component.spec.tsx +97 -0
  30. package/src/components/alert/alert.component.tsx +2 -8
  31. package/src/components/alert/alert.stories.tsx +17 -0
  32. package/src/components/card/card.component.tsx +2 -5
  33. package/src/components/form/form.component.tsx +4 -8
  34. package/src/components/form/form.stories.tsx +66 -2
  35. package/src/components/form/useForm.hook.ts +29 -14
  36. package/src/components/form-access/formAccess.component.tsx +19 -82
  37. package/src/components/form-access/formAccess.schema.ts +7 -23
  38. package/src/components/form-access/formAccess.stories.tsx +2 -9
  39. package/src/components/form-access/formAccess.utils.spec.ts +4 -22
  40. package/src/components/form-access/formAccess.utils.ts +7 -29
  41. package/src/components/form-action/formAction.component.tsx +3 -19
  42. package/src/components/form-action/formAction.stories.tsx +251 -672
  43. package/src/components/form-builder/formBuilder.component.tsx +4 -13
  44. package/src/components/form-builder/formBuilder.stories.tsx +12 -24
  45. package/src/components/form-control/formControl.component.tsx +2 -8
  46. package/src/components/form-edit/formCtas.component.tsx +5 -23
  47. package/src/components/form-edit/formEdit.component.tsx +2 -20
  48. package/src/components/form-edit/formEdit.reducer.ts +2 -8
  49. package/src/components/form-edit/formEdit.stories.tsx +3 -15
  50. package/src/components/form-edit/formParameters.component.tsx +3 -20
  51. package/src/components/form-edit/useFormEdit.hook.ts +2 -9
  52. package/src/components/form-settings/formSettings.component.spec.tsx +2 -9
  53. package/src/components/form-settings/formSettings.component.tsx +6 -34
  54. package/src/components/form-settings/formSettings.stories.tsx +1 -6
  55. package/src/components/form-settings/formSettings.utils.spec.ts +1 -4
  56. package/src/components/form-settings/formSettings.utils.ts +2 -7
  57. package/src/components/forms-table/components/formCell.component.tsx +2 -6
  58. package/src/components/forms-table/formsTable.component.tsx +2 -7
  59. package/src/components/input-tags/inputTags.component.tsx +10 -34
  60. package/src/components/input-tags/inputTags.stories.tsx +4 -14
  61. package/src/components/input-text/inputText.component.spec.tsx +56 -0
  62. package/src/components/input-text/inputText.component.tsx +4 -5
  63. package/src/components/input-text/inputText.stories.tsx +6 -26
  64. package/src/components/loader/loader.component.spec.tsx +7 -6
  65. package/src/components/loader/loader.component.tsx +3 -12
  66. package/src/components/loader/loader.stories.tsx +17 -0
  67. package/src/components/modal/modal.component.spec.tsx +8 -14
  68. package/src/components/modal/modal.component.tsx +6 -27
  69. package/src/components/modal/modal.stories.tsx +1 -5
  70. package/src/components/modal/removeModal.component.tsx +4 -22
  71. package/src/components/pagination/pagination.component.spec.tsx +111 -0
  72. package/src/components/pagination/pagination.component.tsx +10 -42
  73. package/src/components/pagination/pagination.stories.tsx +9 -29
  74. package/src/components/react-component/reactComponent.component.tsx +3 -11
  75. package/src/components/select/select.component.spec.tsx +86 -0
  76. package/src/components/select/select.component.tsx +11 -15
  77. package/src/components/select/select.stories.tsx +6 -26
  78. package/src/components/submissions-table/submissionsTable.component.tsx +1 -3
  79. package/src/components/submissions-table/submissionsTable.stories.tsx +1 -1
  80. package/src/components/table/components/defaultArrowSort.component.tsx +1 -10
  81. package/src/components/table/components/defaultCell.component.tsx +1 -4
  82. package/src/components/table/components/defaultCellHeader.component.tsx +4 -14
  83. package/src/components/table/components/defaultCellOperations.component.tsx +14 -25
  84. package/src/components/table/components/defaultOperationButton.component.tsx +2 -10
  85. package/src/components/table/filters/defaultColumnFilter.component.spec.tsx +1 -1
  86. package/src/components/table/filters/selectColumnFilter.component.spec.tsx +2 -10
  87. package/src/components/table/filters/selectColumnFilter.component.tsx +2 -6
  88. package/src/components/table/table.component.tsx +13 -53
  89. package/src/components/table/table.stories.tsx +1 -1
  90. package/src/components/table/utils/getPageNumbers.ts +3 -11
  91. package/src/components/table/utils/mapFormToColumns.tsx +14 -22
  92. package/src/components/table/utils/useOperations.hook.tsx +2 -12
  93. package/src/components/tabs/tabs.component.spec.tsx +86 -0
  94. package/src/components/tabs/tabs.component.stories.tsx +2 -9
  95. package/src/components/tabs/tabs.component.tsx +9 -43
  96. package/src/interfaces/Operation.ts +1 -4
  97. package/src/react-table.d.ts +9 -28
  98. package/src/stores/action/action.actions.ts +31 -33
  99. package/src/stores/action/action.reducers.spec.ts +1 -8
  100. package/src/stores/action/action.reducers.ts +1 -8
  101. package/src/stores/action/action.selectors.ts +1 -2
  102. package/src/stores/action-info/action-info.actions.spec.ts +1 -5
  103. package/src/stores/action-info/action-info.actions.ts +16 -19
  104. package/src/stores/action-info/action-info.reducers.spec.ts +1 -6
  105. package/src/stores/action-info/action-info.reducers.ts +1 -6
  106. package/src/stores/action-info/action-info.selectors.ts +1 -4
  107. package/src/stores/actions/actions.actions.spec.ts +1 -6
  108. package/src/stores/actions/actions.actions.ts +16 -19
  109. package/src/stores/actions/actions.reducers.spec.ts +1 -6
  110. package/src/stores/actions/actions.reducers.ts +1 -6
  111. package/src/stores/actions/actions.selectors.ts +2 -4
  112. package/src/stores/auth/auth.reducers.ts +1 -4
  113. package/src/stores/auth/auth.selectors.spec.ts +1 -5
  114. package/src/stores/auth/auth.selectors.ts +3 -6
  115. package/src/stores/auth/auth.utils.tsx +2 -8
  116. package/src/stores/auth/getAccess.action.spec.ts +11 -54
  117. package/src/stores/auth/getAccess.action.ts +1 -6
  118. package/src/stores/auth/initAuth.action.ts +15 -17
  119. package/src/stores/form/form.actions.spec.ts +8 -39
  120. package/src/stores/form/form.actions.ts +55 -64
  121. package/src/stores/form/form.reducers.spec.ts +1 -7
  122. package/src/stores/form/form.reducers.ts +1 -8
  123. package/src/stores/form/form.selectors.ts +1 -2
  124. package/src/stores/forms/forms.actions.spec.ts +5 -18
  125. package/src/stores/forms/forms.actions.ts +17 -21
  126. package/src/stores/forms/forms.reducers.spec.ts +1 -6
  127. package/src/stores/forms/forms.reducers.ts +2 -13
  128. package/src/stores/forms/forms.selectors.ts +2 -4
  129. package/src/stores/index.spec.ts +6 -9
  130. package/src/stores/root/root.selectors.spec.ts +1 -6
  131. package/src/stores/root/root.selectors.ts +6 -24
  132. package/src/stores/submission/submission.actions.spec.ts +11 -33
  133. package/src/stores/submission/submission.actions.ts +57 -66
  134. package/src/stores/submission/submission.reducers.spec.ts +17 -27
  135. package/src/stores/submission/submission.reducers.ts +1 -4
  136. package/src/stores/submission/submission.selectors.ts +1 -4
  137. package/src/stores/submissions/submissions.actions.spec.ts +5 -18
  138. package/src/stores/submissions/submissions.actions.ts +17 -26
  139. package/src/stores/submissions/submissions.reducers.spec.ts +3 -12
  140. package/src/stores/submissions/submissions.reducers.ts +3 -17
  141. package/src/stores/submissions/submissions.selectors.spec.ts +1 -4
  142. package/src/stores/submissions/submissions.selectors.ts +2 -4
  143. package/src/utils/getEventValue.ts +1 -4
  144. package/src/utils/iconClass.ts +2 -10
  145. package/src/utils/mapPagination.ts +1 -6
  146. package/src/utils/mapRequestParams.ts +2 -12
  147. package/src/utils/url.test.ts +4 -12
  148. package/src/utils/url.ts +2 -7
  149. package/tsconfig.json +4 -12
  150. package/tsconfig.test.json +1 -1
  151. package/.eslintrc +0 -47
  152. package/.prettierrc +0 -10
@@ -12,7 +12,7 @@ export interface InputTextProps<T = any> extends FormControlProps {
12
12
  placeholder?: string;
13
13
  [key: string]: any;
14
14
  }
15
- export declare function InputText<T = any>({ name, value, label, onChange, required, size, type, prefix, suffix, description, className, ...props }: InputTextProps<T>): JSX.Element;
15
+ export declare function InputText<T = any>({ name, value, label, onChange, required, size, type, prefix, suffix, description, className, placeholder, ...props }: InputTextProps<T>): JSX.Element;
16
16
  export declare namespace InputText {
17
17
  var propTypes: {
18
18
  label: PropTypes.Requireable<string>;
@@ -1,12 +1,12 @@
1
- /// <reference types="react" />
2
1
  import PropTypes from "prop-types";
2
+ import { PropsWithChildren } from "react";
3
3
  export interface LoaderProps {
4
4
  isActive?: boolean;
5
5
  color?: string;
6
6
  icon?: string;
7
7
  className?: string;
8
8
  }
9
- export declare function Loader({ isActive, color, icon, className }: LoaderProps): JSX.Element;
9
+ export declare function Loader({ isActive, color, icon, className }: PropsWithChildren<LoaderProps>): JSX.Element;
10
10
  export declare namespace Loader {
11
11
  var propTypes: {
12
12
  isActive: PropTypes.Requireable<boolean>;
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { Loader } from "./loader.component";
3
+ declare const _default: {
4
+ title: string;
5
+ component: typeof Loader;
6
+ argTypes: {};
7
+ parameters: {};
8
+ };
9
+ export default _default;
10
+ export declare const Sandbox: {
11
+ (args: any): JSX.Element;
12
+ args: {
13
+ isActive: boolean;
14
+ };
15
+ };
@@ -3,33 +3,6 @@ import { Pagination } from "./pagination.component";
3
3
  declare const _default: {
4
4
  title: string;
5
5
  component: typeof Pagination;
6
- argTypes: {
7
- pageSizes: {
8
- control: {
9
- type: string;
10
- };
11
- };
12
- pageCount: {
13
- control: {
14
- type: string;
15
- };
16
- };
17
- pageIndex: {
18
- control: {
19
- type: string;
20
- };
21
- };
22
- canPreviousPage: {
23
- control: {
24
- type: string;
25
- };
26
- };
27
- canNextPage: {
28
- control: {
29
- type: string;
30
- };
31
- };
32
- };
33
6
  parameters: {};
34
7
  };
35
8
  export default _default;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.js CHANGED
@@ -130,6 +130,9 @@ function _defineProperties(target, props) {
130
130
  function _createClass(Constructor, protoProps, staticProps) {
131
131
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
132
132
  if (staticProps) _defineProperties(Constructor, staticProps);
133
+ Object.defineProperty(Constructor, "prototype", {
134
+ writable: false
135
+ });
133
136
  return Constructor;
134
137
  }
135
138
 
@@ -1725,8 +1728,7 @@ function Select(_ref) {
1725
1728
  _onChange = _ref.onChange,
1726
1729
  required = _ref.required,
1727
1730
  value = _ref.value,
1728
- _ref$choices = _ref.choices,
1729
- choices = _ref$choices === void 0 ? [] : _ref$choices,
1731
+ choices = _ref.choices,
1730
1732
  description = _ref.description,
1731
1733
  placeholder = _ref.placeholder,
1732
1734
  prefix = _ref.prefix,
@@ -1857,6 +1859,7 @@ function PaginationButton(props) {
1857
1859
  otherProps = _objectWithoutPropertiesLoose(props, ["component", "children", "disabled", "active"]);
1858
1860
 
1859
1861
  return React__default['default'].createElement(Component, Object.assign({}, otherProps, {
1862
+ "data-testid": 'pagination-button',
1860
1863
  disabled: disabled,
1861
1864
  className: classnames("page-link", disabled ? "disabled" : "", active ? "" : "", props.className)
1862
1865
  }), children);
@@ -1872,7 +1875,8 @@ function Pagination(props) {
1872
1875
  nextPage = props.nextPage,
1873
1876
  canNextPage = props.canNextPage,
1874
1877
  pageCount = props.pageCount,
1875
- pageIndex = props.pageIndex,
1878
+ _props$pageIndex = props.pageIndex,
1879
+ pageIndex = _props$pageIndex === void 0 ? 1 : _props$pageIndex,
1876
1880
  pageOptions = props.pageOptions,
1877
1881
  pageSize = props.pageSize,
1878
1882
  setPageSize = props.setPageSize,
@@ -1999,7 +2003,8 @@ function InputText(_ref) {
1999
2003
  suffix = _ref.suffix,
2000
2004
  description = _ref.description,
2001
2005
  className = _ref.className,
2002
- props = _objectWithoutPropertiesLoose(_ref, ["name", "value", "label", "onChange", "required", "size", "type", "prefix", "suffix", "description", "className"]);
2006
+ placeholder = _ref.placeholder,
2007
+ props = _objectWithoutPropertiesLoose(_ref, ["name", "value", "label", "onChange", "required", "size", "type", "prefix", "suffix", "description", "className", "placeholder"]);
2003
2008
 
2004
2009
  var _useState = React.useState(value),
2005
2010
  localValue = _useState[0],
@@ -2026,7 +2031,8 @@ function InputText(_ref) {
2026
2031
  className: classnames("form-control", size && "form-control-" + size),
2027
2032
  id: name,
2028
2033
  required: required,
2029
- value: localValue || "",
2034
+ value: localValue || placeholder || "",
2035
+ placeholder: placeholder,
2030
2036
  onChange: function onChange(event) {
2031
2037
  var value = getEventValue(event);
2032
2038
  setValue(value);
@@ -2475,7 +2481,43 @@ function Card(_ref) {
2475
2481
  }, children));
2476
2482
  }
2477
2483
 
2484
+ function _catch$a(body, recover) {
2485
+ try {
2486
+ var result = body();
2487
+ } catch (e) {
2488
+ return recover(e);
2489
+ }
2490
+
2491
+ if (result && result.then) {
2492
+ return result.then(void 0, recover);
2493
+ }
2494
+
2495
+ return result;
2496
+ }
2497
+
2478
2498
  function useForm(props) {
2499
+ var customValidation = function customValidation(submission, callback) {
2500
+ try {
2501
+ var _temp3 = function () {
2502
+ if (events.current.has("onAsyncSubmit")) {
2503
+ var _temp4 = _catch$a(function () {
2504
+ return Promise.resolve(events.current.get("onAsyncSubmit")(submission)).then(function () {});
2505
+ }, function (err) {
2506
+ callback((err == null ? void 0 : err.errors) || err);
2507
+ });
2508
+
2509
+ if (_temp4 && _temp4.then) return _temp4.then(function () {});
2510
+ } else {
2511
+ callback(null);
2512
+ }
2513
+ }();
2514
+
2515
+ return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
2516
+ } catch (e) {
2517
+ return Promise.reject(e);
2518
+ }
2519
+ };
2520
+
2479
2521
  var src = props.src,
2480
2522
  form = props.form,
2481
2523
  _props$options = props.options,
@@ -2494,7 +2536,12 @@ function useForm(props) {
2494
2536
  srcOrForm = typeof srcOrForm === "string" ? srcOrForm : cloneDeep__default['default'](srcOrForm);
2495
2537
 
2496
2538
  if (!instance.current) {
2539
+ var _options, _options$hooks;
2540
+
2497
2541
  isLoaded.current = false;
2542
+ options.hooks = _extends({}, options.hooks || {}, {
2543
+ customValidation: ((_options = options) == null ? void 0 : (_options$hooks = _options.hooks) == null ? void 0 : _options$hooks.customValidation) || customValidation
2544
+ });
2498
2545
  instance.current = new formiojs.Form(element.current, srcOrForm, options);
2499
2546
  instance.current.onAny(function (event) {
2500
2547
  var args = [].slice.call(arguments, 1);
@@ -2519,7 +2566,8 @@ function useForm(props) {
2519
2566
  events.current.set(funcName, fn);
2520
2567
  }
2521
2568
 
2522
- events.current.get(funcName).apply(void 0, args);
2569
+ instance.current.instance.setAlert("success", "");
2570
+ events.current.get(funcName).apply(void 0, args.concat([instance.current]));
2523
2571
  }
2524
2572
  }
2525
2573
  });
@@ -2578,6 +2626,9 @@ function useForm(props) {
2578
2626
  React.useEffect(function () {
2579
2627
  props.onSubmit && events.current.set("onSubmit", props.onSubmit);
2580
2628
  }, [props.onSubmit, events]);
2629
+ React.useEffect(function () {
2630
+ props.onAsyncSubmit && events.current.set("onAsyncSubmit", props.onAsyncSubmit);
2631
+ }, [props.onAsyncSubmit, events]);
2581
2632
  React.useEffect(function () {
2582
2633
  props.onSubmitDone && events.current.set("onSubmitDone", props.onSubmitDone);
2583
2634
  }, [props.onSubmitDone, events]);
@@ -2629,7 +2680,8 @@ Form.propTypes = {
2629
2680
  noAlerts: PropTypes__default['default'].bool,
2630
2681
  i18n: PropTypes__default['default'].any,
2631
2682
  template: PropTypes__default['default'].string,
2632
- saveDraft: PropTypes__default['default'].bool
2683
+ saveDraft: PropTypes__default['default'].bool,
2684
+ hooks: PropTypes__default['default'].any
2633
2685
  }),
2634
2686
  onPrevPage: PropTypes__default['default'].func,
2635
2687
  onNextPage: PropTypes__default['default'].func,
@@ -2638,6 +2690,7 @@ Form.propTypes = {
2638
2690
  onCustomEvent: PropTypes__default['default'].func,
2639
2691
  onComponentChange: PropTypes__default['default'].func,
2640
2692
  onSubmit: PropTypes__default['default'].func,
2693
+ onAsyncSubmit: PropTypes__default['default'].func,
2641
2694
  onSubmitDone: PropTypes__default['default'].func,
2642
2695
  onFormLoad: PropTypes__default['default'].func,
2643
2696
  onError: PropTypes__default['default'].func,
@@ -3060,7 +3113,7 @@ function FormAction(_ref2) {
3060
3113
  }), children);
3061
3114
  }
3062
3115
 
3063
- function _catch$a(body, recover) {
3116
+ function _catch$b(body, recover) {
3064
3117
  try {
3065
3118
  var result = body();
3066
3119
  } catch (e) {
@@ -3088,7 +3141,7 @@ var createBuilder = function createBuilder(el, _ref2) {
3088
3141
  display: display,
3089
3142
  components: [].concat(components)
3090
3143
  };
3091
- return Promise.resolve(_catch$a(function () {
3144
+ return Promise.resolve(_catch$b(function () {
3092
3145
  return Promise.resolve(new FormioFormBuilder__default['default'](el, form, _extends({}, options)).ready).then(function (builder) {
3093
3146
  var handleEvent = function handleEvent(event) {
3094
3147
  return function () {
@@ -3190,7 +3243,8 @@ var FormBuilder = /*#__PURE__*/function (_React$Component) {
3190
3243
  var _this$builderRef;
3191
3244
 
3192
3245
  (_this$builderRef = this.builderRef) == null ? void 0 : _this$builderRef.destroy();
3193
- };
3246
+ } // eslint-disable-next-line react/no-deprecated
3247
+ ;
3194
3248
 
3195
3249
  _proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
3196
3250
  try {
@@ -3984,9 +4038,10 @@ var moment = createCommonjsModule(function (module, exports) {
3984
4038
 
3985
4039
  function map(arr, fn) {
3986
4040
  var res = [],
3987
- i;
4041
+ i,
4042
+ arrLen = arr.length;
3988
4043
 
3989
- for (i = 0; i < arr.length; ++i) {
4044
+ for (i = 0; i < arrLen; ++i) {
3990
4045
  res.push(fn(arr[i], i));
3991
4046
  }
3992
4047
 
@@ -4105,7 +4160,10 @@ var moment = createCommonjsModule(function (module, exports) {
4105
4160
  updateInProgress = false;
4106
4161
 
4107
4162
  function copyConfig(to, from) {
4108
- var i, prop, val;
4163
+ var i,
4164
+ prop,
4165
+ val,
4166
+ momentPropertiesLen = momentProperties.length;
4109
4167
 
4110
4168
  if (!isUndefined(from._isAMomentObject)) {
4111
4169
  to._isAMomentObject = from._isAMomentObject;
@@ -4147,8 +4205,8 @@ var moment = createCommonjsModule(function (module, exports) {
4147
4205
  to._locale = from._locale;
4148
4206
  }
4149
4207
 
4150
- if (momentProperties.length > 0) {
4151
- for (i = 0; i < momentProperties.length; i++) {
4208
+ if (momentPropertiesLen > 0) {
4209
+ for (i = 0; i < momentPropertiesLen; i++) {
4152
4210
  prop = momentProperties[i];
4153
4211
  val = from[prop];
4154
4212
 
@@ -4200,9 +4258,10 @@ var moment = createCommonjsModule(function (module, exports) {
4200
4258
  var args = [],
4201
4259
  arg,
4202
4260
  i,
4203
- key;
4261
+ key,
4262
+ argLen = arguments.length;
4204
4263
 
4205
- for (i = 0; i < arguments.length; i++) {
4264
+ for (i = 0; i < argLen; i++) {
4206
4265
  arg = '';
4207
4266
 
4208
4267
  if (typeof arguments[i] === 'object') {
@@ -4632,9 +4691,10 @@ var moment = createCommonjsModule(function (module, exports) {
4632
4691
  if (typeof units === 'object') {
4633
4692
  units = normalizeObjectUnits(units);
4634
4693
  var prioritized = getPrioritizedUnits(units),
4635
- i;
4694
+ i,
4695
+ prioritizedLen = prioritized.length;
4636
4696
 
4637
- for (i = 0; i < prioritized.length; i++) {
4697
+ for (i = 0; i < prioritizedLen; i++) {
4638
4698
  this[prioritized[i].unit](units[prioritized[i].unit]);
4639
4699
  }
4640
4700
  } else {
@@ -4715,7 +4775,8 @@ var moment = createCommonjsModule(function (module, exports) {
4715
4775
 
4716
4776
  function addParseToken(token, callback) {
4717
4777
  var i,
4718
- func = callback;
4778
+ func = callback,
4779
+ tokenLen;
4719
4780
 
4720
4781
  if (typeof token === 'string') {
4721
4782
  token = [token];
@@ -4727,7 +4788,9 @@ var moment = createCommonjsModule(function (module, exports) {
4727
4788
  };
4728
4789
  }
4729
4790
 
4730
- for (i = 0; i < token.length; i++) {
4791
+ tokenLen = token.length;
4792
+
4793
+ for (i = 0; i < tokenLen; i++) {
4731
4794
  tokens[token[i]] = func;
4732
4795
  }
4733
4796
  }
@@ -5813,11 +5876,16 @@ var moment = createCommonjsModule(function (module, exports) {
5813
5876
  return globalLocale;
5814
5877
  }
5815
5878
 
5879
+ function isLocaleNameSane(name) {
5880
+ // Prevent names that look like filesystem paths, i.e contain '/' or '\'
5881
+ return name.match('^[^/\\\\]*$') != null;
5882
+ }
5883
+
5816
5884
  function loadLocale(name) {
5817
5885
  var oldLocale = null,
5818
5886
  aliasedRequire; // TODO: Find a better way to register and load all the locales in Node
5819
5887
 
5820
- if (locales[name] === undefined && 'object' !== 'undefined' && module && module.exports) {
5888
+ if (locales[name] === undefined && 'object' !== 'undefined' && module && module.exports && isLocaleNameSane(name)) {
5821
5889
  try {
5822
5890
  oldLocale = globalLocale._abbr;
5823
5891
  aliasedRequire = commonjsRequire;
@@ -6049,12 +6117,14 @@ var moment = createCommonjsModule(function (module, exports) {
6049
6117
  allowTime,
6050
6118
  dateFormat,
6051
6119
  timeFormat,
6052
- tzFormat;
6120
+ tzFormat,
6121
+ isoDatesLen = isoDates.length,
6122
+ isoTimesLen = isoTimes.length;
6053
6123
 
6054
6124
  if (match) {
6055
6125
  getParsingFlags(config).iso = true;
6056
6126
 
6057
- for (i = 0, l = isoDates.length; i < l; i++) {
6127
+ for (i = 0, l = isoDatesLen; i < l; i++) {
6058
6128
  if (isoDates[i][1].exec(match[1])) {
6059
6129
  dateFormat = isoDates[i][0];
6060
6130
  allowTime = isoDates[i][2] !== false;
@@ -6068,7 +6138,7 @@ var moment = createCommonjsModule(function (module, exports) {
6068
6138
  }
6069
6139
 
6070
6140
  if (match[3]) {
6071
- for (i = 0, l = isoTimes.length; i < l; i++) {
6141
+ for (i = 0, l = isoTimesLen; i < l; i++) {
6072
6142
  if (isoTimes[i][1].exec(match[3])) {
6073
6143
  // match[2] should be 'T' or space
6074
6144
  timeFormat = (match[2] || ' ') + isoTimes[i][0];
@@ -6404,10 +6474,12 @@ var moment = createCommonjsModule(function (module, exports) {
6404
6474
  skipped,
6405
6475
  stringLength = string.length,
6406
6476
  totalParsedInputLength = 0,
6407
- era;
6477
+ era,
6478
+ tokenLen;
6408
6479
  tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
6480
+ tokenLen = tokens.length;
6409
6481
 
6410
- for (i = 0; i < tokens.length; i++) {
6482
+ for (i = 0; i < tokenLen; i++) {
6411
6483
  token = tokens[i];
6412
6484
  parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
6413
6485
 
@@ -6500,15 +6572,16 @@ var moment = createCommonjsModule(function (module, exports) {
6500
6572
  i,
6501
6573
  currentScore,
6502
6574
  validFormatFound,
6503
- bestFormatIsValid = false;
6575
+ bestFormatIsValid = false,
6576
+ configfLen = config._f.length;
6504
6577
 
6505
- if (config._f.length === 0) {
6578
+ if (configfLen === 0) {
6506
6579
  getParsingFlags(config).invalidFormat = true;
6507
6580
  config._d = new Date(NaN);
6508
6581
  return;
6509
6582
  }
6510
6583
 
6511
- for (i = 0; i < config._f.length; i++) {
6584
+ for (i = 0; i < configfLen; i++) {
6512
6585
  currentScore = 0;
6513
6586
  validFormatFound = false;
6514
6587
  tempConfig = copyConfig({}, config);
@@ -6730,7 +6803,8 @@ var moment = createCommonjsModule(function (module, exports) {
6730
6803
  function isDurationValid(m) {
6731
6804
  var key,
6732
6805
  unitHasDecimal = false,
6733
- i;
6806
+ i,
6807
+ orderLen = ordering.length;
6734
6808
 
6735
6809
  for (key in m) {
6736
6810
  if (hasOwnProp(m, key) && !(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
@@ -6738,7 +6812,7 @@ var moment = createCommonjsModule(function (module, exports) {
6738
6812
  }
6739
6813
  }
6740
6814
 
6741
- for (i = 0; i < ordering.length; ++i) {
6815
+ for (i = 0; i < orderLen; ++i) {
6742
6816
  if (m[ordering[i]]) {
6743
6817
  if (unitHasDecimal) {
6744
6818
  return false; // only allow non-integers for smallest unit
@@ -7226,9 +7300,10 @@ var moment = createCommonjsModule(function (module, exports) {
7226
7300
  propertyTest = false,
7227
7301
  properties = ['years', 'year', 'y', 'months', 'month', 'M', 'days', 'day', 'd', 'dates', 'date', 'D', 'hours', 'hour', 'h', 'minutes', 'minute', 'm', 'seconds', 'second', 's', 'milliseconds', 'millisecond', 'ms'],
7228
7302
  i,
7229
- property;
7303
+ property,
7304
+ propertyLen = properties.length;
7230
7305
 
7231
- for (i = 0; i < properties.length; i += 1) {
7306
+ for (i = 0; i < propertyLen; i += 1) {
7232
7307
  property = properties[i];
7233
7308
  propertyTest = propertyTest || hasOwnProp(input, property);
7234
7309
  }
@@ -8970,7 +9045,7 @@ var moment = createCommonjsModule(function (module, exports) {
8970
9045
  config._d = new Date(toInt(input));
8971
9046
  }); //! moment.js
8972
9047
 
8973
- hooks.version = '2.29.1';
9048
+ hooks.version = '2.29.3';
8974
9049
  setHookCallback(createLocal);
8975
9050
  hooks.fn = proto;
8976
9051
  hooks.min = min;
@@ -9584,8 +9659,10 @@ function ButtonTab(_ref) {
9584
9659
  className = _ref.className,
9585
9660
  after = _ref.after;
9586
9661
  return React__default['default'].createElement("div", {
9662
+ title: 'button-wrapper',
9587
9663
  className: classnames("tw-tabs__button-wrapper", isActive ? "-active" : "", back ? "-back" : "", className)
9588
9664
  }, React__default['default'].createElement("button", {
9665
+ title: 'button-tab',
9589
9666
  className: classnames("tw-tabs__button", reverse ? "-reverse" : "", isActive ? "-active" : "", back ? "-back" : ""),
9590
9667
  onClick: onClick
9591
9668
  }, icon && React__default['default'].createElement("i", {
@@ -9615,6 +9692,7 @@ function Tabs(_ref2) {
9615
9692
  additionalProps = _objectWithoutPropertiesLoose(_ref2, ["style", "current", "items", "children", "HeaderChildren", "AddButton", "Button", "className", "onClick", "i18n"]);
9616
9693
 
9617
9694
  return React__default['default'].createElement("div", {
9695
+ "data-testid": 'tabs-comp',
9618
9696
  className: "tw-tabs " + className,
9619
9697
  style: style
9620
9698
  }, React__default['default'].createElement("div", null, React__default['default'].createElement("nav", {
@@ -9640,6 +9718,7 @@ function Tabs(_ref2) {
9640
9718
  })))), HeaderChildren && React__default['default'].createElement(HeaderChildren, Object.assign({}, additionalProps, {
9641
9719
  current: current
9642
9720
  }))), React__default['default'].createElement("div", {
9721
+ title: "tab-body",
9643
9722
  className: "tw-tabs__body"
9644
9723
  }, children));
9645
9724
  }