@thecb/components 10.7.4 → 10.7.5-beta.1
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 +89 -40
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +89 -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 +57 -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.cjs.js
CHANGED
|
@@ -27106,6 +27106,10 @@ var FormInput = function FormInput(_ref15) {
|
|
|
27106
27106
|
_useState2 = _slicedToArray(_useState, 2),
|
|
27107
27107
|
showPassword = _useState2[0],
|
|
27108
27108
|
setShowPassword = _useState2[1];
|
|
27109
|
+
var _useState3 = React.useState(false),
|
|
27110
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
27111
|
+
isFocused = _useState4[0],
|
|
27112
|
+
setIsFocused = _useState4[1];
|
|
27109
27113
|
var _useContext = React.useContext(styled.ThemeContext),
|
|
27110
27114
|
isMobile = _useContext.isMobile;
|
|
27111
27115
|
var setValue = function setValue(value) {
|
|
@@ -27119,6 +27123,7 @@ var FormInput = function FormInput(_ref15) {
|
|
|
27119
27123
|
if (isRequired && value === "") {
|
|
27120
27124
|
setValue("");
|
|
27121
27125
|
}
|
|
27126
|
+
setIsFocused(false);
|
|
27122
27127
|
};
|
|
27123
27128
|
return /*#__PURE__*/React__default.createElement(Stack, {
|
|
27124
27129
|
childGap: "0.25rem"
|
|
@@ -27189,6 +27194,15 @@ var FormInput = function FormInput(_ref15) {
|
|
|
27189
27194
|
"data-qa": dataQa || labelTextWhenNoError,
|
|
27190
27195
|
autoComplete: autocompleteValue,
|
|
27191
27196
|
required: isRequired
|
|
27197
|
+
// Additional handler to detect autofilled values
|
|
27198
|
+
}, autocompleteValue && {
|
|
27199
|
+
onFocus: function onFocus(e) {
|
|
27200
|
+
if (!isFocused) {
|
|
27201
|
+
var _e$target;
|
|
27202
|
+
setValue((_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value);
|
|
27203
|
+
setIsFocused(true);
|
|
27204
|
+
}
|
|
27205
|
+
}
|
|
27192
27206
|
}, props)) : /*#__PURE__*/React__default.createElement(InputField, _extends({
|
|
27193
27207
|
"aria-labelledby": createIdFromString(labelTextWhenNoError),
|
|
27194
27208
|
"aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
|
|
@@ -39263,46 +39277,71 @@ var fallbackValues$y = {
|
|
|
39263
39277
|
var HiddenToggleSwitchBox = styled__default.input.withConfig({
|
|
39264
39278
|
displayName: "ToggleSwitch__HiddenToggleSwitchBox",
|
|
39265
39279
|
componentId: "sc-1t51u6v-0"
|
|
39266
|
-
})(["opacity:0;position:absolute;cursor:", ";height:
|
|
39280
|
+
})(["opacity:0;margin:0;position:absolute;cursor:", ";height:", ";width:", ";"], function (_ref) {
|
|
39267
39281
|
var disabled = _ref.disabled;
|
|
39268
39282
|
return disabled ? "auto" : "pointer";
|
|
39269
39283
|
}, function (_ref2) {
|
|
39270
39284
|
var isMobile = _ref2.isMobile;
|
|
39271
|
-
return isMobile ? "
|
|
39285
|
+
return isMobile ? "22px" : "24px";
|
|
39286
|
+
}, function (_ref3) {
|
|
39287
|
+
var isMobile = _ref3.isMobile;
|
|
39288
|
+
return isMobile ? "40px" : "44px";
|
|
39272
39289
|
});
|
|
39273
|
-
var VisibleSwitchComponent = styled__default.
|
|
39290
|
+
var VisibleSwitchComponent = styled__default.span.withConfig({
|
|
39274
39291
|
displayName: "ToggleSwitch__VisibleSwitchComponent",
|
|
39275
39292
|
componentId: "sc-1t51u6v-1"
|
|
39276
|
-
})(["width:
|
|
39277
|
-
var
|
|
39278
|
-
return
|
|
39279
|
-
}, function (_ref4) {
|
|
39280
|
-
var disabled = _ref4.disabled;
|
|
39281
|
-
return disabled ? "none" : "0px 2px 5px 0px rgba(0, 0, 0, 0.5) !important";
|
|
39293
|
+
})(["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) {
|
|
39294
|
+
var isMobile = _ref4.isMobile;
|
|
39295
|
+
return isMobile ? "40px" : "44px";
|
|
39282
39296
|
}, function (_ref5) {
|
|
39283
39297
|
var isMobile = _ref5.isMobile;
|
|
39284
|
-
return isMobile ? "
|
|
39298
|
+
return isMobile ? "22px" : "24px";
|
|
39299
|
+
}, function (_ref6) {
|
|
39300
|
+
var disabled = _ref6.disabled;
|
|
39301
|
+
return disabled ? "auto" : "pointer";
|
|
39302
|
+
}, function (_ref7) {
|
|
39303
|
+
var disabled = _ref7.disabled;
|
|
39304
|
+
return disabled ? "none" : "0px 2px 5px 0px rgba(0, 0, 0, 0.5) !important";
|
|
39285
39305
|
});
|
|
39286
|
-
var ToggleSwitchRingComponent = styled__default.
|
|
39306
|
+
var ToggleSwitchRingComponent = styled__default.span.withConfig({
|
|
39287
39307
|
displayName: "ToggleSwitch__ToggleSwitchRingComponent",
|
|
39288
39308
|
componentId: "sc-1t51u6v-2"
|
|
39289
|
-
})(["position:absolute;width:
|
|
39290
|
-
var
|
|
39291
|
-
|
|
39292
|
-
|
|
39293
|
-
|
|
39294
|
-
|
|
39295
|
-
|
|
39296
|
-
|
|
39297
|
-
|
|
39298
|
-
|
|
39299
|
-
|
|
39300
|
-
|
|
39301
|
-
|
|
39302
|
-
|
|
39303
|
-
|
|
39304
|
-
|
|
39305
|
-
|
|
39309
|
+
})(["position:absolute;width:", ";height:", ";border:none;border-radius:50%;box-sizing:border-box;"], function (_ref8) {
|
|
39310
|
+
var isMobile = _ref8.isMobile;
|
|
39311
|
+
return isMobile ? "14px" : "16px";
|
|
39312
|
+
}, function (_ref9) {
|
|
39313
|
+
var isMobile = _ref9.isMobile;
|
|
39314
|
+
return isMobile ? "14px" : "16px";
|
|
39315
|
+
});
|
|
39316
|
+
var ToggleSwitch = function ToggleSwitch(_ref10) {
|
|
39317
|
+
var _ref10$ariaDescribedB = _ref10.ariaDescribedBy,
|
|
39318
|
+
ariaDescribedBy = _ref10$ariaDescribedB === void 0 ? "" : _ref10$ariaDescribedB,
|
|
39319
|
+
_ref10$isOn = _ref10.isOn,
|
|
39320
|
+
isOn = _ref10$isOn === void 0 ? false : _ref10$isOn,
|
|
39321
|
+
_ref10$onToggle = _ref10.onToggle,
|
|
39322
|
+
onToggle = _ref10$onToggle === void 0 ? noop : _ref10$onToggle,
|
|
39323
|
+
_ref10$disabled = _ref10.disabled,
|
|
39324
|
+
disabled = _ref10$disabled === void 0 ? false : _ref10$disabled,
|
|
39325
|
+
_ref10$name = _ref10.name,
|
|
39326
|
+
name = _ref10$name === void 0 ? "toggle" : _ref10$name,
|
|
39327
|
+
_ref10$label = _ref10.label,
|
|
39328
|
+
label = _ref10$label === void 0 ? null : _ref10$label,
|
|
39329
|
+
_ref10$labelLeft = _ref10.labelLeft,
|
|
39330
|
+
labelLeft = _ref10$labelLeft === void 0 ? false : _ref10$labelLeft,
|
|
39331
|
+
_ref10$labelStyles = _ref10.labelStyles,
|
|
39332
|
+
labelStyles = _ref10$labelStyles === void 0 ? "" : _ref10$labelStyles,
|
|
39333
|
+
_ref10$labelAs = _ref10.labelAs,
|
|
39334
|
+
labelAs = _ref10$labelAs === void 0 ? "h4" : _ref10$labelAs,
|
|
39335
|
+
_ref10$srOnlyLabel = _ref10.srOnlyLabel,
|
|
39336
|
+
srOnlyLabel = _ref10$srOnlyLabel === void 0 ? "" : _ref10$srOnlyLabel,
|
|
39337
|
+
themeValues = _ref10.themeValues,
|
|
39338
|
+
isMobile = _ref10.isMobile,
|
|
39339
|
+
dataQa = _ref10.dataQa,
|
|
39340
|
+
_ref10$minWidth = _ref10.minWidth,
|
|
39341
|
+
minWidth = _ref10$minWidth === void 0 ? "80px" : _ref10$minWidth,
|
|
39342
|
+
_ref10$extraStyles = _ref10.extraStyles,
|
|
39343
|
+
extraStyles = _ref10$extraStyles === void 0 ? "" : _ref10$extraStyles;
|
|
39344
|
+
var nameId = name.replace(/ /g, "-");
|
|
39306
39345
|
var ToggleSwitchRing = posed(ToggleSwitchRingComponent)({
|
|
39307
39346
|
off: {
|
|
39308
39347
|
backgroundColor: disabled ? themeValues.disabledBackground : themeValues.onBackground,
|
|
@@ -39360,11 +39399,13 @@ var ToggleSwitch = function ToggleSwitch(_ref6) {
|
|
|
39360
39399
|
};
|
|
39361
39400
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
39362
39401
|
padding: "0",
|
|
39363
|
-
extraStyles: labelLeft ? themeValues.leftLabelStyles : themeValues.rightLabelStyles
|
|
39402
|
+
extraStyles: "\n margin: 0 0.5rem;\n ".concat(labelLeft ? themeValues.leftLabelStyles : themeValues.rightLabelStyles).concat(extraStyles)
|
|
39364
39403
|
}, /*#__PURE__*/React__default.createElement(Center, null, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
39365
|
-
justify: "
|
|
39404
|
+
justify: "space-between",
|
|
39366
39405
|
align: "center",
|
|
39367
|
-
overflow: "visible"
|
|
39406
|
+
overflow: "visible",
|
|
39407
|
+
childGap: "0",
|
|
39408
|
+
minWidth: minWidth !== null && minWidth !== void 0 ? minWidth : isMobile ? "75px" : "84px"
|
|
39368
39409
|
}, /*#__PURE__*/React__default.createElement(Cover, {
|
|
39369
39410
|
minHeight: "100%",
|
|
39370
39411
|
singleChild: true
|
|
@@ -39374,27 +39415,34 @@ var ToggleSwitch = function ToggleSwitch(_ref6) {
|
|
|
39374
39415
|
extraStyles: "display: flex; align-items: center;",
|
|
39375
39416
|
dataQa: dataQa
|
|
39376
39417
|
}, /*#__PURE__*/React__default.createElement(HiddenToggleSwitchBox, {
|
|
39418
|
+
type: "checkbox",
|
|
39419
|
+
"aria-checked": isOn,
|
|
39377
39420
|
"aria-label": name,
|
|
39421
|
+
"aria-labelledby": label ? "".concat(nameId, "-label") : null,
|
|
39422
|
+
"aria-describedby": ariaDescribedBy ? ariaDescribedBy : null,
|
|
39378
39423
|
checked: isOn,
|
|
39379
39424
|
onChange: disabled ? noop : onToggle,
|
|
39380
39425
|
disabled: disabled,
|
|
39381
|
-
id: "#
|
|
39426
|
+
id: "#".concat(nameId),
|
|
39382
39427
|
isMobile: isMobile
|
|
39383
39428
|
}), /*#__PURE__*/React__default.createElement(VisibleSwitch, {
|
|
39384
|
-
name: name,
|
|
39385
|
-
htmlFor: "#toggle-".concat(name),
|
|
39386
39429
|
onClick: disabled ? noop : onToggle,
|
|
39387
39430
|
onKeyDown: disabled ? noop : handleKeyDown,
|
|
39388
39431
|
pose: isOn ? "on" : "off",
|
|
39389
39432
|
tabIndex: disabled ? -1 : 0,
|
|
39390
39433
|
disabled: disabled,
|
|
39391
39434
|
isMobile: isMobile
|
|
39392
|
-
}, /*#__PURE__*/React__default.createElement(ToggleSwitchRing,
|
|
39393
|
-
|
|
39394
|
-
|
|
39395
|
-
|
|
39396
|
-
color: CHARADE_GREY
|
|
39397
|
-
|
|
39435
|
+
}, /*#__PURE__*/React__default.createElement(ToggleSwitchRing, {
|
|
39436
|
+
isMobile: isMobile
|
|
39437
|
+
})))), label && /*#__PURE__*/React__default.createElement(Box, {
|
|
39438
|
+
as: labelAs,
|
|
39439
|
+
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),
|
|
39440
|
+
id: "".concat(nameId, "-label"),
|
|
39441
|
+
htmlFor: labelAs === "label" ? nameId : null,
|
|
39442
|
+
padding: "0"
|
|
39443
|
+
}, srOnlyLabel && /*#__PURE__*/React__default.createElement("span", {
|
|
39444
|
+
style: SCREEN_READER_ONLY
|
|
39445
|
+
}, srOnlyLabel), label))));
|
|
39398
39446
|
};
|
|
39399
39447
|
var ToggleSwitch$1 = themeComponent(ToggleSwitch, "ToggleSwitch", fallbackValues$y);
|
|
39400
39448
|
|
|
@@ -48654,6 +48702,7 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
48654
48702
|
},
|
|
48655
48703
|
isNum: true,
|
|
48656
48704
|
autocompleteValue: "cc-number",
|
|
48705
|
+
name: "cc-number",
|
|
48657
48706
|
isRequired: true
|
|
48658
48707
|
}), /*#__PURE__*/React__default.createElement(FormInputRow, {
|
|
48659
48708
|
breakpoint: isMobile ? "1000rem" : "21rem",
|