@thecb/components 10.7.6-beta.0 → 10.7.7
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 +87 -40
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +87 -40
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/form-layouts/FormInput.js +11 -0
- package/src/components/atoms/toggle-switch/ToggleSwitch.js +52 -29
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +1 -0
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/icons/.DS_Store +0 -0
package/dist/index.esm.js
CHANGED
|
@@ -27098,6 +27098,10 @@ var FormInput = function FormInput(_ref15) {
|
|
|
27098
27098
|
_useState2 = _slicedToArray(_useState, 2),
|
|
27099
27099
|
showPassword = _useState2[0],
|
|
27100
27100
|
setShowPassword = _useState2[1];
|
|
27101
|
+
var _useState3 = useState(false),
|
|
27102
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
27103
|
+
isFocused = _useState4[0],
|
|
27104
|
+
setIsFocused = _useState4[1];
|
|
27101
27105
|
var _useContext = useContext(ThemeContext),
|
|
27102
27106
|
isMobile = _useContext.isMobile;
|
|
27103
27107
|
var setValue = function setValue(value) {
|
|
@@ -27111,6 +27115,7 @@ var FormInput = function FormInput(_ref15) {
|
|
|
27111
27115
|
if (isRequired && value === "") {
|
|
27112
27116
|
setValue("");
|
|
27113
27117
|
}
|
|
27118
|
+
setIsFocused(false);
|
|
27114
27119
|
};
|
|
27115
27120
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
27116
27121
|
childGap: "0.25rem"
|
|
@@ -27181,6 +27186,15 @@ var FormInput = function FormInput(_ref15) {
|
|
|
27181
27186
|
"data-qa": dataQa || labelTextWhenNoError,
|
|
27182
27187
|
autoComplete: autocompleteValue,
|
|
27183
27188
|
required: isRequired
|
|
27189
|
+
// Additional handler to detect autofilled values
|
|
27190
|
+
}, autocompleteValue && {
|
|
27191
|
+
onFocus: function onFocus(e) {
|
|
27192
|
+
if (!isFocused) {
|
|
27193
|
+
var _e$target;
|
|
27194
|
+
setValue((_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value);
|
|
27195
|
+
setIsFocused(true);
|
|
27196
|
+
}
|
|
27197
|
+
}
|
|
27184
27198
|
}, props)) : /*#__PURE__*/React.createElement(InputField, _extends({
|
|
27185
27199
|
"aria-labelledby": createIdFromString(labelTextWhenNoError),
|
|
27186
27200
|
"aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
|
|
@@ -39255,46 +39269,69 @@ var fallbackValues$y = {
|
|
|
39255
39269
|
var HiddenToggleSwitchBox = styled.input.withConfig({
|
|
39256
39270
|
displayName: "ToggleSwitch__HiddenToggleSwitchBox",
|
|
39257
39271
|
componentId: "sc-1t51u6v-0"
|
|
39258
|
-
})(["opacity:0;position:absolute;cursor:", ";height:
|
|
39272
|
+
})(["opacity:0;margin:0;position:absolute;cursor:", ";height:", ";width:", ";"], function (_ref) {
|
|
39259
39273
|
var disabled = _ref.disabled;
|
|
39260
39274
|
return disabled ? "auto" : "pointer";
|
|
39261
39275
|
}, function (_ref2) {
|
|
39262
39276
|
var isMobile = _ref2.isMobile;
|
|
39263
|
-
return isMobile ? "
|
|
39277
|
+
return isMobile ? "22px" : "24px";
|
|
39278
|
+
}, function (_ref3) {
|
|
39279
|
+
var isMobile = _ref3.isMobile;
|
|
39280
|
+
return isMobile ? "40px" : "44px";
|
|
39264
39281
|
});
|
|
39265
|
-
var VisibleSwitchComponent = styled.
|
|
39282
|
+
var VisibleSwitchComponent = styled.span.withConfig({
|
|
39266
39283
|
displayName: "ToggleSwitch__VisibleSwitchComponent",
|
|
39267
39284
|
componentId: "sc-1t51u6v-1"
|
|
39268
|
-
})(["width:
|
|
39269
|
-
var
|
|
39270
|
-
return
|
|
39271
|
-
}, function (_ref4) {
|
|
39272
|
-
var disabled = _ref4.disabled;
|
|
39273
|
-
return disabled ? "none" : "0px 2px 5px 0px rgba(0, 0, 0, 0.5) !important";
|
|
39285
|
+
})(["width:", ";height:", ";border-radius:12px;border:none;position:relative;box-sizing:border-box;cursor:", ";display:inline-block;&:hover{box-shadow:", ";}&:focus{box-shadow:0px 2px 5px 0px rgba(0,0,0,0.5);}"], function (_ref4) {
|
|
39286
|
+
var isMobile = _ref4.isMobile;
|
|
39287
|
+
return isMobile ? "40px" : "44px";
|
|
39274
39288
|
}, function (_ref5) {
|
|
39275
39289
|
var isMobile = _ref5.isMobile;
|
|
39276
|
-
return isMobile ? "
|
|
39290
|
+
return isMobile ? "22px" : "24px";
|
|
39291
|
+
}, function (_ref6) {
|
|
39292
|
+
var disabled = _ref6.disabled;
|
|
39293
|
+
return disabled ? "auto" : "pointer";
|
|
39294
|
+
}, function (_ref7) {
|
|
39295
|
+
var disabled = _ref7.disabled;
|
|
39296
|
+
return disabled ? "none" : "0px 2px 5px 0px rgba(0, 0, 0, 0.5) !important";
|
|
39277
39297
|
});
|
|
39278
|
-
var ToggleSwitchRingComponent = styled.
|
|
39298
|
+
var ToggleSwitchRingComponent = styled.span.withConfig({
|
|
39279
39299
|
displayName: "ToggleSwitch__ToggleSwitchRingComponent",
|
|
39280
39300
|
componentId: "sc-1t51u6v-2"
|
|
39281
|
-
})(["position:absolute;width:
|
|
39282
|
-
var
|
|
39283
|
-
|
|
39284
|
-
|
|
39285
|
-
|
|
39286
|
-
|
|
39287
|
-
|
|
39288
|
-
|
|
39289
|
-
|
|
39290
|
-
|
|
39291
|
-
|
|
39292
|
-
|
|
39293
|
-
|
|
39294
|
-
|
|
39295
|
-
|
|
39296
|
-
|
|
39297
|
-
|
|
39301
|
+
})(["position:absolute;width:", ";height:", ";border:none;border-radius:50%;box-sizing:border-box;"], function (_ref8) {
|
|
39302
|
+
var isMobile = _ref8.isMobile;
|
|
39303
|
+
return isMobile ? "14px" : "16px";
|
|
39304
|
+
}, function (_ref9) {
|
|
39305
|
+
var isMobile = _ref9.isMobile;
|
|
39306
|
+
return isMobile ? "14px" : "16px";
|
|
39307
|
+
});
|
|
39308
|
+
var ToggleSwitch = function ToggleSwitch(_ref10) {
|
|
39309
|
+
var _ref10$ariaDescribedB = _ref10.ariaDescribedBy,
|
|
39310
|
+
ariaDescribedBy = _ref10$ariaDescribedB === void 0 ? "" : _ref10$ariaDescribedB,
|
|
39311
|
+
_ref10$isOn = _ref10.isOn,
|
|
39312
|
+
isOn = _ref10$isOn === void 0 ? false : _ref10$isOn,
|
|
39313
|
+
_ref10$onToggle = _ref10.onToggle,
|
|
39314
|
+
onToggle = _ref10$onToggle === void 0 ? noop : _ref10$onToggle,
|
|
39315
|
+
_ref10$disabled = _ref10.disabled,
|
|
39316
|
+
disabled = _ref10$disabled === void 0 ? false : _ref10$disabled,
|
|
39317
|
+
_ref10$name = _ref10.name,
|
|
39318
|
+
name = _ref10$name === void 0 ? "toggle" : _ref10$name,
|
|
39319
|
+
_ref10$label = _ref10.label,
|
|
39320
|
+
label = _ref10$label === void 0 ? null : _ref10$label,
|
|
39321
|
+
_ref10$labelLeft = _ref10.labelLeft,
|
|
39322
|
+
labelLeft = _ref10$labelLeft === void 0 ? false : _ref10$labelLeft,
|
|
39323
|
+
_ref10$labelStyles = _ref10.labelStyles,
|
|
39324
|
+
labelStyles = _ref10$labelStyles === void 0 ? "" : _ref10$labelStyles,
|
|
39325
|
+
_ref10$labelAs = _ref10.labelAs,
|
|
39326
|
+
labelAs = _ref10$labelAs === void 0 ? "label" : _ref10$labelAs,
|
|
39327
|
+
themeValues = _ref10.themeValues,
|
|
39328
|
+
isMobile = _ref10.isMobile,
|
|
39329
|
+
dataQa = _ref10.dataQa,
|
|
39330
|
+
_ref10$minWidth = _ref10.minWidth,
|
|
39331
|
+
minWidth = _ref10$minWidth === void 0 ? "80px" : _ref10$minWidth,
|
|
39332
|
+
_ref10$extraStyles = _ref10.extraStyles,
|
|
39333
|
+
extraStyles = _ref10$extraStyles === void 0 ? "" : _ref10$extraStyles;
|
|
39334
|
+
var nameId = name.replace(/ /g, "-");
|
|
39298
39335
|
var ToggleSwitchRing = posed(ToggleSwitchRingComponent)({
|
|
39299
39336
|
off: {
|
|
39300
39337
|
backgroundColor: disabled ? themeValues.disabledBackground : themeValues.onBackground,
|
|
@@ -39351,12 +39388,14 @@ var ToggleSwitch = function ToggleSwitch(_ref6) {
|
|
|
39351
39388
|
}
|
|
39352
39389
|
};
|
|
39353
39390
|
return /*#__PURE__*/React.createElement(Box, {
|
|
39354
|
-
padding: "0",
|
|
39355
|
-
extraStyles: labelLeft ? themeValues.leftLabelStyles : themeValues.rightLabelStyles
|
|
39391
|
+
padding: "0.5rem",
|
|
39392
|
+
extraStyles: "\n margin: 0 0.5rem;\n ".concat(labelLeft ? themeValues.leftLabelStyles : themeValues.rightLabelStyles).concat(extraStyles)
|
|
39356
39393
|
}, /*#__PURE__*/React.createElement(Center, null, /*#__PURE__*/React.createElement(Cluster, {
|
|
39357
|
-
justify: "
|
|
39394
|
+
justify: "space-between",
|
|
39358
39395
|
align: "center",
|
|
39359
|
-
overflow: "visible"
|
|
39396
|
+
overflow: "visible",
|
|
39397
|
+
childGap: "0",
|
|
39398
|
+
minWidth: minWidth !== null && minWidth !== void 0 ? minWidth : isMobile ? "75px" : "84px"
|
|
39360
39399
|
}, /*#__PURE__*/React.createElement(Cover, {
|
|
39361
39400
|
minHeight: "100%",
|
|
39362
39401
|
singleChild: true
|
|
@@ -39366,26 +39405,33 @@ var ToggleSwitch = function ToggleSwitch(_ref6) {
|
|
|
39366
39405
|
extraStyles: "display: flex; align-items: center;",
|
|
39367
39406
|
dataQa: dataQa
|
|
39368
39407
|
}, /*#__PURE__*/React.createElement(HiddenToggleSwitchBox, {
|
|
39408
|
+
type: "checkbox",
|
|
39409
|
+
"aria-checked": isOn,
|
|
39369
39410
|
"aria-label": name,
|
|
39411
|
+
"aria-labelledby": label ? "".concat(nameId, "-label") : null,
|
|
39412
|
+
"aria-describedby": ariaDescribedBy ? ariaDescribedBy : null,
|
|
39370
39413
|
checked: isOn,
|
|
39371
39414
|
onChange: disabled ? noop : onToggle,
|
|
39372
39415
|
disabled: disabled,
|
|
39373
|
-
id: "#
|
|
39416
|
+
id: "#".concat(nameId),
|
|
39374
39417
|
isMobile: isMobile
|
|
39375
39418
|
}), /*#__PURE__*/React.createElement(VisibleSwitch, {
|
|
39376
|
-
name: name,
|
|
39377
|
-
htmlFor: "#toggle-".concat(name),
|
|
39378
39419
|
onClick: disabled ? noop : onToggle,
|
|
39379
39420
|
onKeyDown: disabled ? noop : handleKeyDown,
|
|
39380
39421
|
pose: isOn ? "on" : "off",
|
|
39381
39422
|
tabIndex: disabled ? -1 : 0,
|
|
39382
39423
|
disabled: disabled,
|
|
39424
|
+
isMobile: isMobile,
|
|
39425
|
+
tabindex: "0"
|
|
39426
|
+
}, /*#__PURE__*/React.createElement(ToggleSwitchRing, {
|
|
39383
39427
|
isMobile: isMobile
|
|
39384
|
-
}
|
|
39385
|
-
|
|
39386
|
-
|
|
39387
|
-
extraStyles: "margin: 0 0.
|
|
39388
|
-
|
|
39428
|
+
})))), label && /*#__PURE__*/React.createElement(Box, {
|
|
39429
|
+
as: labelAs,
|
|
39430
|
+
"aria-label": "".concat(name, ": ").concat(label),
|
|
39431
|
+
extraStyles: "\n font-weight: ".concat(FONT_WEIGHT_SEMIBOLD, ";\n color: ").concat(CHARADE_GREY, ";\n margin: 0 0 0 0.25rem; \n position: relative; \n bottom: 1px; \n display: inline-block; \n ").concat(labelStyles),
|
|
39432
|
+
id: "".concat(nameId, "-label"),
|
|
39433
|
+
htmlFor: labelAs === "label" ? nameId : null,
|
|
39434
|
+
padding: "0"
|
|
39389
39435
|
}, label))));
|
|
39390
39436
|
};
|
|
39391
39437
|
var ToggleSwitch$1 = themeComponent(ToggleSwitch, "ToggleSwitch", fallbackValues$y);
|
|
@@ -48646,6 +48692,7 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
48646
48692
|
},
|
|
48647
48693
|
isNum: true,
|
|
48648
48694
|
autocompleteValue: "cc-number",
|
|
48695
|
+
name: "cc-number",
|
|
48649
48696
|
isRequired: true
|
|
48650
48697
|
}), /*#__PURE__*/React.createElement(FormInputRow, {
|
|
48651
48698
|
breakpoint: isMobile ? "1000rem" : "21rem",
|