@thecb/components 4.2.8-beta.4 → 4.2.9

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
@@ -21260,7 +21260,8 @@ var Jumbo = function Jumbo(_ref) {
21260
21260
  CartStatus = _ref.cartStatus,
21261
21261
  total = _ref.total,
21262
21262
  itemsCount = _ref.itemsCount,
21263
- showCartStatus = _ref.showCartStatus,
21263
+ _ref$showCartStatus = _ref.showCartStatus,
21264
+ showCartStatus = _ref$showCartStatus === void 0 ? false : _ref$showCartStatus,
21264
21265
  openCartSlider = _ref.openCartSlider;
21265
21266
 
21266
21267
  var _useContext = React.useContext(styled.ThemeContext),
@@ -21284,12 +21285,14 @@ var Jumbo = function Jumbo(_ref) {
21284
21285
  }, /*#__PURE__*/React__default.createElement(Cluster, {
21285
21286
  minHeight: "100%",
21286
21287
  justify: isMobile && !showCartStatus ? "center" : showButton || showCartStatus ? "space-between" : "left",
21287
- align: "center"
21288
+ align: "center",
21289
+ nowrap: showCartStatus
21288
21290
  }, /*#__PURE__*/React__default.createElement(Heading$1, {
21289
21291
  variant: isMobile ? "h5" : "h3",
21290
21292
  color: "#ffffff",
21291
21293
  className: "themeJumboHeading",
21292
- themeJumboHeading: true
21294
+ themeJumboHeading: true,
21295
+ extraStyles: showCartStatus && isMobile && "max-width: 60%;"
21293
21296
  }, heading), subHeading && /*#__PURE__*/React__default.createElement(Heading$1, {
21294
21297
  variant: isMobile ? "h6" : "h2",
21295
21298
  color: "#ffffff",
@@ -34463,6 +34466,12 @@ const set$2 = fieldName => value => ({
34463
34466
  const CLEAR = "form/CLEAR";
34464
34467
  const clear = () => ({ type: CLEAR });
34465
34468
 
34469
+ const ADD_VALIDATOR = "field/ADD_VALIDATOR";
34470
+ const addValidator = fieldName => validator => ({
34471
+ type: ADD_VALIDATOR,
34472
+ payload: { fieldName, validator }
34473
+ });
34474
+
34466
34475
  const createFormReducer = formConfig => (
34467
34476
  state = createInitialState(formConfig),
34468
34477
  action
@@ -34494,6 +34503,23 @@ const createFormReducer = formConfig => (
34494
34503
  });
34495
34504
  case CLEAR:
34496
34505
  return createInitialState(formConfig);
34506
+ case ADD_VALIDATOR:
34507
+ const fieldWithOverride = action.payload.fieldName;
34508
+ const newValidator = action.payload.validator;
34509
+
34510
+ return produce(state, draftState => {
34511
+ draftState[fieldWithOverride].validators.push(newValidator);
34512
+ const fields = Object.entries(draftState);
34513
+ for (let entry of fields) {
34514
+ let fieldName = entry[0];
34515
+ let field = entry[1];
34516
+ let errors = computeErrors(fieldName, draftState);
34517
+ let dirty = field.dirty;
34518
+ draftState[fieldName].errors = errors;
34519
+ draftState[fieldName].dirty = dirty;
34520
+ draftState[fieldName].hasErrors = errors.length > 0;
34521
+ }
34522
+ });
34497
34523
  default:
34498
34524
  return state;
34499
34525
  }
@@ -34512,7 +34538,8 @@ const createMapDispatchToProps = formConfig => {
34512
34538
  const keys = Object.keys(formConfig);
34513
34539
  for (let fieldName of keys) {
34514
34540
  dispatchObj.fields[fieldName] = {
34515
- set: value => dispatch(set$2(fieldName)(value))
34541
+ set: value => dispatch(set$2(fieldName)(value)),
34542
+ addValidator: validator => dispatch(addValidator(fieldName)(validator))
34516
34543
  };
34517
34544
  }
34518
34545
  dispatchObj.form = { clear: () => dispatch(clear()) };
@@ -39736,11 +39763,11 @@ var formConfig$7 = {
39736
39763
  constraints: [validateWhen(onlyIntegers(), matchesRegex("US"), "country"), validateWhen(hasLength(0, 9), matchesRegex("US"), "country")]
39737
39764
  }
39738
39765
  };
39739
-
39740
- var _createFormState$7 = createFormState(formConfig$7),
39741
- reducer$7 = _createFormState$7.reducer,
39742
- mapStateToProps$8 = _createFormState$7.mapStateToProps,
39743
- mapDispatchToProps$7 = _createFormState$7.mapDispatchToProps;
39766
+ var formState = createFormState(formConfig$7);
39767
+ console.log("form state is", formState);
39768
+ var reducer$7 = formState.reducer,
39769
+ mapStateToProps$8 = formState.mapStateToProps,
39770
+ mapDispatchToProps$7 = formState.mapDispatchToProps;
39744
39771
 
39745
39772
  PaymentFormCard.reducer = reducer$7;
39746
39773
  PaymentFormCard.mapStateToProps = mapStateToProps$8;
@@ -39800,10 +39827,10 @@ var formConfig$8 = {
39800
39827
  }
39801
39828
  };
39802
39829
 
39803
- var _createFormState$8 = createFormState(formConfig$8),
39804
- reducer$8 = _createFormState$8.reducer,
39805
- mapStateToProps$9 = _createFormState$8.mapStateToProps,
39806
- mapDispatchToProps$8 = _createFormState$8.mapDispatchToProps;
39830
+ var _createFormState$7 = createFormState(formConfig$8),
39831
+ reducer$8 = _createFormState$7.reducer,
39832
+ mapStateToProps$9 = _createFormState$7.mapStateToProps,
39833
+ mapDispatchToProps$8 = _createFormState$7.mapDispatchToProps;
39807
39834
 
39808
39835
  PhoneForm.reducer = reducer$8;
39809
39836
  PhoneForm.mapStateToProps = mapStateToProps$9;
@@ -40145,10 +40172,10 @@ var formConfig$9 = {
40145
40172
  }
40146
40173
  };
40147
40174
 
40148
- var _createFormState$9 = createFormState(formConfig$9),
40149
- reducer$9 = _createFormState$9.reducer,
40150
- mapStateToProps$a = _createFormState$9.mapStateToProps,
40151
- mapDispatchToProps$9 = _createFormState$9.mapDispatchToProps;
40175
+ var _createFormState$8 = createFormState(formConfig$9),
40176
+ reducer$9 = _createFormState$8.reducer,
40177
+ mapStateToProps$a = _createFormState$8.mapStateToProps,
40178
+ mapDispatchToProps$9 = _createFormState$8.mapDispatchToProps;
40152
40179
 
40153
40180
  RegistrationForm.reducer = reducer$9;
40154
40181
  RegistrationForm.mapStateToProps = mapStateToProps$a;
@@ -40266,10 +40293,10 @@ var formConfig$a = {
40266
40293
  }
40267
40294
  };
40268
40295
 
40269
- var _createFormState$a = createFormState(formConfig$a),
40270
- reducer$a = _createFormState$a.reducer,
40271
- mapStateToProps$b = _createFormState$a.mapStateToProps,
40272
- mapDispatchToProps$a = _createFormState$a.mapDispatchToProps;
40296
+ var _createFormState$9 = createFormState(formConfig$a),
40297
+ reducer$a = _createFormState$9.reducer,
40298
+ mapStateToProps$b = _createFormState$9.mapStateToProps,
40299
+ mapDispatchToProps$a = _createFormState$9.mapDispatchToProps;
40273
40300
 
40274
40301
  ResetPasswordForm.reducer = reducer$a;
40275
40302
  ResetPasswordForm.mapStateToProps = mapStateToProps$b;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "4.2.8-beta.4",
3
+ "version": "4.2.9",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -80,6 +80,6 @@
80
80
  "ramda": "^0.27.0",
81
81
  "react-aria-modal": "^4.0.0",
82
82
  "react-pose": "^4.0.10",
83
- "redux-freeform": "^5.0.0"
83
+ "redux-freeform": "^5.0.1"
84
84
  }
85
85
  }
@@ -18,7 +18,7 @@ const Jumbo = ({
18
18
  cartStatus: CartStatus,
19
19
  total,
20
20
  itemsCount,
21
- showCartStatus,
21
+ showCartStatus = false,
22
22
  openCartSlider
23
23
  }) => {
24
24
  const { isMobile } = useContext(ThemeContext);
@@ -47,12 +47,14 @@ const Jumbo = ({
47
47
  : `left`
48
48
  }
49
49
  align="center"
50
+ nowrap={showCartStatus}
50
51
  >
51
52
  <Heading
52
53
  variant={isMobile ? "h5" : "h3"}
53
54
  color="#ffffff"
54
55
  className="themeJumboHeading"
55
56
  themeJumboHeading
57
+ extraStyles={showCartStatus && isMobile && `max-width: 60%;`}
56
58
  >
57
59
  {heading}
58
60
  </Heading>
@@ -54,6 +54,7 @@ const formConfig = {
54
54
  }
55
55
  };
56
56
 
57
- export const { reducer, mapStateToProps, mapDispatchToProps } = createFormState(
58
- formConfig
59
- );
57
+ const formState = createFormState(formConfig);
58
+ console.log("form state is", formState);
59
+
60
+ export const { reducer, mapStateToProps, mapDispatchToProps } = formState;