@thecb/components 10.7.6 → 10.7.8-beta.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.cjs.js +78 -41
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +78 -41
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/toggle-switch/ToggleSwitch.js +52 -29
- package/src/components/molecules/modal/ModalControlV2.js +2 -0
- package/src/components/molecules/modal/__private__/CloseButton.js +2 -1
package/dist/index.cjs.js
CHANGED
|
@@ -39277,46 +39277,69 @@ var fallbackValues$y = {
|
|
|
39277
39277
|
var HiddenToggleSwitchBox = styled__default.input.withConfig({
|
|
39278
39278
|
displayName: "ToggleSwitch__HiddenToggleSwitchBox",
|
|
39279
39279
|
componentId: "sc-1t51u6v-0"
|
|
39280
|
-
})(["opacity:0;position:absolute;cursor:", ";height:
|
|
39280
|
+
})(["opacity:0;margin:0;position:absolute;cursor:", ";height:", ";width:", ";"], function (_ref) {
|
|
39281
39281
|
var disabled = _ref.disabled;
|
|
39282
39282
|
return disabled ? "auto" : "pointer";
|
|
39283
39283
|
}, function (_ref2) {
|
|
39284
39284
|
var isMobile = _ref2.isMobile;
|
|
39285
|
-
return isMobile ? "
|
|
39285
|
+
return isMobile ? "22px" : "24px";
|
|
39286
|
+
}, function (_ref3) {
|
|
39287
|
+
var isMobile = _ref3.isMobile;
|
|
39288
|
+
return isMobile ? "40px" : "44px";
|
|
39286
39289
|
});
|
|
39287
|
-
var VisibleSwitchComponent = styled__default.
|
|
39290
|
+
var VisibleSwitchComponent = styled__default.span.withConfig({
|
|
39288
39291
|
displayName: "ToggleSwitch__VisibleSwitchComponent",
|
|
39289
39292
|
componentId: "sc-1t51u6v-1"
|
|
39290
|
-
})(["width:
|
|
39291
|
-
var
|
|
39292
|
-
return
|
|
39293
|
-
}, function (_ref4) {
|
|
39294
|
-
var disabled = _ref4.disabled;
|
|
39295
|
-
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";
|
|
39296
39296
|
}, function (_ref5) {
|
|
39297
39297
|
var isMobile = _ref5.isMobile;
|
|
39298
|
-
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";
|
|
39299
39305
|
});
|
|
39300
|
-
var ToggleSwitchRingComponent = styled__default.
|
|
39306
|
+
var ToggleSwitchRingComponent = styled__default.span.withConfig({
|
|
39301
39307
|
displayName: "ToggleSwitch__ToggleSwitchRingComponent",
|
|
39302
39308
|
componentId: "sc-1t51u6v-2"
|
|
39303
|
-
})(["position:absolute;width:
|
|
39304
|
-
var
|
|
39305
|
-
|
|
39306
|
-
|
|
39307
|
-
|
|
39308
|
-
|
|
39309
|
-
|
|
39310
|
-
|
|
39311
|
-
|
|
39312
|
-
|
|
39313
|
-
|
|
39314
|
-
|
|
39315
|
-
|
|
39316
|
-
|
|
39317
|
-
|
|
39318
|
-
|
|
39319
|
-
|
|
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 ? "label" : _ref10$labelAs,
|
|
39335
|
+
themeValues = _ref10.themeValues,
|
|
39336
|
+
isMobile = _ref10.isMobile,
|
|
39337
|
+
dataQa = _ref10.dataQa,
|
|
39338
|
+
_ref10$minWidth = _ref10.minWidth,
|
|
39339
|
+
minWidth = _ref10$minWidth === void 0 ? "80px" : _ref10$minWidth,
|
|
39340
|
+
_ref10$extraStyles = _ref10.extraStyles,
|
|
39341
|
+
extraStyles = _ref10$extraStyles === void 0 ? "" : _ref10$extraStyles;
|
|
39342
|
+
var nameId = name.replace(/ /g, "-");
|
|
39320
39343
|
var ToggleSwitchRing = posed(ToggleSwitchRingComponent)({
|
|
39321
39344
|
off: {
|
|
39322
39345
|
backgroundColor: disabled ? themeValues.disabledBackground : themeValues.onBackground,
|
|
@@ -39373,12 +39396,14 @@ var ToggleSwitch = function ToggleSwitch(_ref6) {
|
|
|
39373
39396
|
}
|
|
39374
39397
|
};
|
|
39375
39398
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
39376
|
-
padding: "0",
|
|
39377
|
-
extraStyles: labelLeft ? themeValues.leftLabelStyles : themeValues.rightLabelStyles
|
|
39399
|
+
padding: "0.5rem",
|
|
39400
|
+
extraStyles: "\n margin: 0 0.5rem;\n ".concat(labelLeft ? themeValues.leftLabelStyles : themeValues.rightLabelStyles).concat(extraStyles)
|
|
39378
39401
|
}, /*#__PURE__*/React__default.createElement(Center, null, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
39379
|
-
justify: "
|
|
39402
|
+
justify: "space-between",
|
|
39380
39403
|
align: "center",
|
|
39381
|
-
overflow: "visible"
|
|
39404
|
+
overflow: "visible",
|
|
39405
|
+
childGap: "0",
|
|
39406
|
+
minWidth: minWidth !== null && minWidth !== void 0 ? minWidth : isMobile ? "75px" : "84px"
|
|
39382
39407
|
}, /*#__PURE__*/React__default.createElement(Cover, {
|
|
39383
39408
|
minHeight: "100%",
|
|
39384
39409
|
singleChild: true
|
|
@@ -39388,26 +39413,33 @@ var ToggleSwitch = function ToggleSwitch(_ref6) {
|
|
|
39388
39413
|
extraStyles: "display: flex; align-items: center;",
|
|
39389
39414
|
dataQa: dataQa
|
|
39390
39415
|
}, /*#__PURE__*/React__default.createElement(HiddenToggleSwitchBox, {
|
|
39416
|
+
type: "checkbox",
|
|
39417
|
+
"aria-checked": isOn,
|
|
39391
39418
|
"aria-label": name,
|
|
39419
|
+
"aria-labelledby": label ? "".concat(nameId, "-label") : null,
|
|
39420
|
+
"aria-describedby": ariaDescribedBy ? ariaDescribedBy : null,
|
|
39392
39421
|
checked: isOn,
|
|
39393
39422
|
onChange: disabled ? noop : onToggle,
|
|
39394
39423
|
disabled: disabled,
|
|
39395
|
-
id: "#
|
|
39424
|
+
id: "#".concat(nameId),
|
|
39396
39425
|
isMobile: isMobile
|
|
39397
39426
|
}), /*#__PURE__*/React__default.createElement(VisibleSwitch, {
|
|
39398
|
-
name: name,
|
|
39399
|
-
htmlFor: "#toggle-".concat(name),
|
|
39400
39427
|
onClick: disabled ? noop : onToggle,
|
|
39401
39428
|
onKeyDown: disabled ? noop : handleKeyDown,
|
|
39402
39429
|
pose: isOn ? "on" : "off",
|
|
39403
39430
|
tabIndex: disabled ? -1 : 0,
|
|
39404
39431
|
disabled: disabled,
|
|
39432
|
+
isMobile: isMobile,
|
|
39433
|
+
tabindex: "0"
|
|
39434
|
+
}, /*#__PURE__*/React__default.createElement(ToggleSwitchRing, {
|
|
39405
39435
|
isMobile: isMobile
|
|
39406
|
-
}
|
|
39407
|
-
|
|
39408
|
-
|
|
39409
|
-
extraStyles: "margin: 0 0.
|
|
39410
|
-
|
|
39436
|
+
})))), label && /*#__PURE__*/React__default.createElement(Box, {
|
|
39437
|
+
as: labelAs,
|
|
39438
|
+
"aria-label": "".concat(name, ": ").concat(label),
|
|
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"
|
|
39411
39443
|
}, label))));
|
|
39412
39444
|
};
|
|
39413
39445
|
var ToggleSwitch$1 = themeComponent(ToggleSwitch, "ToggleSwitch", fallbackValues$y);
|
|
@@ -46108,6 +46140,8 @@ var CloseButton = function CloseButton(_ref) {
|
|
|
46108
46140
|
buttonExtraStyles = _ref$buttonExtraStyle === void 0 ? "" : _ref$buttonExtraStyle,
|
|
46109
46141
|
_ref$closeButtonText = _ref.closeButtonText,
|
|
46110
46142
|
closeButtonText = _ref$closeButtonText === void 0 ? "" : _ref$closeButtonText,
|
|
46143
|
+
_ref$closeButtonVaria = _ref.closeButtonVariant,
|
|
46144
|
+
closeButtonVariant = _ref$closeButtonVaria === void 0 ? "primary" : _ref$closeButtonVaria,
|
|
46111
46145
|
_ref$hideModal = _ref.hideModal,
|
|
46112
46146
|
hideModal = _ref$hideModal === void 0 ? noop : _ref$hideModal,
|
|
46113
46147
|
_ref$isMobile = _ref.isMobile,
|
|
@@ -46124,7 +46158,7 @@ var CloseButton = function CloseButton(_ref) {
|
|
|
46124
46158
|
role: "button",
|
|
46125
46159
|
text: closeButtonText,
|
|
46126
46160
|
textExtraStyles: "".concat(fontSize),
|
|
46127
|
-
variant:
|
|
46161
|
+
variant: closeButtonVariant
|
|
46128
46162
|
});
|
|
46129
46163
|
};
|
|
46130
46164
|
|
|
@@ -46220,6 +46254,8 @@ var Modal$2 = function Modal(_ref) {
|
|
|
46220
46254
|
children = _ref$children === void 0 ? [] : _ref$children,
|
|
46221
46255
|
_ref$closeButtonText = _ref.closeButtonText,
|
|
46222
46256
|
closeButtonText = _ref$closeButtonText === void 0 ? "Close" : _ref$closeButtonText,
|
|
46257
|
+
_ref$closeButtonVaria = _ref.closeButtonVariant,
|
|
46258
|
+
closeButtonVariant = _ref$closeButtonVaria === void 0 ? "primary" : _ref$closeButtonVaria,
|
|
46223
46259
|
_ref$continueAction = _ref.continueAction,
|
|
46224
46260
|
continueAction = _ref$continueAction === void 0 ? noop : _ref$continueAction,
|
|
46225
46261
|
_ref$continueButtonTe = _ref.continueButtonText,
|
|
@@ -46374,6 +46410,7 @@ var Modal$2 = function Modal(_ref) {
|
|
|
46374
46410
|
}), hasCloseButton && /*#__PURE__*/React__default.createElement(CloseButton, {
|
|
46375
46411
|
buttonExtraStyles: buttonExtraStyles,
|
|
46376
46412
|
closeButtonText: closeButtonText,
|
|
46413
|
+
closeButtonVariant: closeButtonVariant,
|
|
46377
46414
|
hideModal: hideModal,
|
|
46378
46415
|
isMobile: isMobile,
|
|
46379
46416
|
key: "close"
|