@thecb/components 10.7.3 → 10.7.5-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 CHANGED
@@ -39198,46 +39198,71 @@ var fallbackValues$y = {
39198
39198
  var HiddenToggleSwitchBox = styled__default.input.withConfig({
39199
39199
  displayName: "ToggleSwitch__HiddenToggleSwitchBox",
39200
39200
  componentId: "sc-1t51u6v-0"
39201
- })(["opacity:0;position:absolute;cursor:", ";height:24px;width:50px;", ""], function (_ref) {
39201
+ })(["opacity:0;margin:0;position:absolute;cursor:", ";height:", ";width:", ";"], function (_ref) {
39202
39202
  var disabled = _ref.disabled;
39203
39203
  return disabled ? "auto" : "pointer";
39204
39204
  }, function (_ref2) {
39205
39205
  var isMobile = _ref2.isMobile;
39206
- return isMobile ? "transform: scale(0.75)" : "";
39206
+ return isMobile ? "22px" : "24px";
39207
+ }, function (_ref3) {
39208
+ var isMobile = _ref3.isMobile;
39209
+ return isMobile ? "40px" : "44px";
39207
39210
  });
39208
- var VisibleSwitchComponent = styled__default.label.withConfig({
39211
+ var VisibleSwitchComponent = styled__default.span.withConfig({
39209
39212
  displayName: "ToggleSwitch__VisibleSwitchComponent",
39210
39213
  componentId: "sc-1t51u6v-1"
39211
- })(["width:44px;height:24px;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 (_ref3) {
39212
- var disabled = _ref3.disabled;
39213
- return disabled ? "auto" : "pointer";
39214
- }, function (_ref4) {
39215
- var disabled = _ref4.disabled;
39216
- return disabled ? "none" : "0px 2px 5px 0px rgba(0, 0, 0, 0.5) !important";
39214
+ })(["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) {
39215
+ var isMobile = _ref4.isMobile;
39216
+ return isMobile ? "40px" : "44px";
39217
39217
  }, function (_ref5) {
39218
39218
  var isMobile = _ref5.isMobile;
39219
- return isMobile ? "transform: scale(0.75)" : "";
39219
+ return isMobile ? "22px" : "24px";
39220
+ }, function (_ref6) {
39221
+ var disabled = _ref6.disabled;
39222
+ return disabled ? "auto" : "pointer";
39223
+ }, function (_ref7) {
39224
+ var disabled = _ref7.disabled;
39225
+ return disabled ? "none" : "0px 2px 5px 0px rgba(0, 0, 0, 0.5) !important";
39220
39226
  });
39221
- var ToggleSwitchRingComponent = styled__default.div.withConfig({
39227
+ var ToggleSwitchRingComponent = styled__default.span.withConfig({
39222
39228
  displayName: "ToggleSwitch__ToggleSwitchRingComponent",
39223
39229
  componentId: "sc-1t51u6v-2"
39224
- })(["position:absolute;width:16px;height:16px;border:none;border-radius:50%;box-sizing:border-box;"]);
39225
- var ToggleSwitch = function ToggleSwitch(_ref6) {
39226
- var _ref6$isOn = _ref6.isOn,
39227
- isOn = _ref6$isOn === void 0 ? false : _ref6$isOn,
39228
- _ref6$onToggle = _ref6.onToggle,
39229
- onToggle = _ref6$onToggle === void 0 ? noop : _ref6$onToggle,
39230
- _ref6$disabled = _ref6.disabled,
39231
- disabled = _ref6$disabled === void 0 ? false : _ref6$disabled,
39232
- _ref6$name = _ref6.name,
39233
- name = _ref6$name === void 0 ? "" : _ref6$name,
39234
- _ref6$label = _ref6.label,
39235
- label = _ref6$label === void 0 ? null : _ref6$label,
39236
- _ref6$labelLeft = _ref6.labelLeft,
39237
- labelLeft = _ref6$labelLeft === void 0 ? false : _ref6$labelLeft,
39238
- themeValues = _ref6.themeValues,
39239
- isMobile = _ref6.isMobile,
39240
- dataQa = _ref6.dataQa;
39230
+ })(["position:absolute;width:", ";height:", ";border:none;border-radius:50%;box-sizing:border-box;"], function (_ref8) {
39231
+ var isMobile = _ref8.isMobile;
39232
+ return isMobile ? "14px" : "16px";
39233
+ }, function (_ref9) {
39234
+ var isMobile = _ref9.isMobile;
39235
+ return isMobile ? "14px" : "16px";
39236
+ });
39237
+ var ToggleSwitch = function ToggleSwitch(_ref10) {
39238
+ var _ref10$ariaDescribedB = _ref10.ariaDescribedBy,
39239
+ ariaDescribedBy = _ref10$ariaDescribedB === void 0 ? "" : _ref10$ariaDescribedB,
39240
+ _ref10$isOn = _ref10.isOn,
39241
+ isOn = _ref10$isOn === void 0 ? false : _ref10$isOn,
39242
+ _ref10$onToggle = _ref10.onToggle,
39243
+ onToggle = _ref10$onToggle === void 0 ? noop : _ref10$onToggle,
39244
+ _ref10$disabled = _ref10.disabled,
39245
+ disabled = _ref10$disabled === void 0 ? false : _ref10$disabled,
39246
+ _ref10$name = _ref10.name,
39247
+ name = _ref10$name === void 0 ? "toggle" : _ref10$name,
39248
+ _ref10$label = _ref10.label,
39249
+ label = _ref10$label === void 0 ? null : _ref10$label,
39250
+ _ref10$labelLeft = _ref10.labelLeft,
39251
+ labelLeft = _ref10$labelLeft === void 0 ? false : _ref10$labelLeft,
39252
+ _ref10$labelStyles = _ref10.labelStyles,
39253
+ labelStyles = _ref10$labelStyles === void 0 ? "" : _ref10$labelStyles,
39254
+ _ref10$labelAs = _ref10.labelAs,
39255
+ labelAs = _ref10$labelAs === void 0 ? "h4" : _ref10$labelAs,
39256
+ _ref10$srOnlyLabel = _ref10.srOnlyLabel,
39257
+ srOnlyLabel = _ref10$srOnlyLabel === void 0 ? "" : _ref10$srOnlyLabel,
39258
+ themeValues = _ref10.themeValues,
39259
+ isMobile = _ref10.isMobile,
39260
+ dataQa = _ref10.dataQa,
39261
+ _ref10$minWidth = _ref10.minWidth,
39262
+ minWidth = _ref10$minWidth === void 0 ? "80px" : _ref10$minWidth,
39263
+ _ref10$extraStyles = _ref10.extraStyles,
39264
+ extraStyles = _ref10$extraStyles === void 0 ? "" : _ref10$extraStyles;
39265
+ var nameId = name.replace(/ /g, "-");
39241
39266
  var ToggleSwitchRing = posed(ToggleSwitchRingComponent)({
39242
39267
  off: {
39243
39268
  backgroundColor: disabled ? themeValues.disabledBackground : themeValues.onBackground,
@@ -39295,11 +39320,13 @@ var ToggleSwitch = function ToggleSwitch(_ref6) {
39295
39320
  };
39296
39321
  return /*#__PURE__*/React__default.createElement(Box, {
39297
39322
  padding: "0",
39298
- extraStyles: labelLeft ? themeValues.leftLabelStyles : themeValues.rightLabelStyles
39323
+ extraStyles: "\n margin: 0 0.5rem;\n ".concat(labelLeft ? themeValues.leftLabelStyles : themeValues.rightLabelStyles).concat(extraStyles)
39299
39324
  }, /*#__PURE__*/React__default.createElement(Center, null, /*#__PURE__*/React__default.createElement(Cluster, {
39300
- justify: "stretch",
39325
+ justify: "space-between",
39301
39326
  align: "center",
39302
- overflow: "visible"
39327
+ overflow: "visible",
39328
+ childGap: "0",
39329
+ minWidth: minWidth !== null && minWidth !== void 0 ? minWidth : isMobile ? "75px" : "84px"
39303
39330
  }, /*#__PURE__*/React__default.createElement(Cover, {
39304
39331
  minHeight: "100%",
39305
39332
  singleChild: true
@@ -39309,27 +39336,34 @@ var ToggleSwitch = function ToggleSwitch(_ref6) {
39309
39336
  extraStyles: "display: flex; align-items: center;",
39310
39337
  dataQa: dataQa
39311
39338
  }, /*#__PURE__*/React__default.createElement(HiddenToggleSwitchBox, {
39339
+ type: "checkbox",
39340
+ "aria-checked": isOn,
39312
39341
  "aria-label": name,
39342
+ "aria-labelledby": label ? "".concat(nameId, "-label") : null,
39343
+ "aria-describedby": ariaDescribedBy ? ariaDescribedBy : null,
39313
39344
  checked: isOn,
39314
39345
  onChange: disabled ? noop : onToggle,
39315
39346
  disabled: disabled,
39316
- id: "#toggle-".concat(name),
39347
+ id: "#".concat(nameId),
39317
39348
  isMobile: isMobile
39318
39349
  }), /*#__PURE__*/React__default.createElement(VisibleSwitch, {
39319
- name: name,
39320
- htmlFor: "#toggle-".concat(name),
39321
39350
  onClick: disabled ? noop : onToggle,
39322
39351
  onKeyDown: disabled ? noop : handleKeyDown,
39323
39352
  pose: isOn ? "on" : "off",
39324
39353
  tabIndex: disabled ? -1 : 0,
39325
39354
  disabled: disabled,
39326
39355
  isMobile: isMobile
39327
- }, /*#__PURE__*/React__default.createElement(ToggleSwitchRing, null)))), label && /*#__PURE__*/React__default.createElement(Heading$1, {
39328
- variant: "h4",
39329
- weight: FONT_WEIGHT_SEMIBOLD,
39330
- extraStyles: "margin: 0 0.5rem; position: relative; bottom: 1px; display: inline-block;",
39331
- color: CHARADE_GREY
39332
- }, label))));
39356
+ }, /*#__PURE__*/React__default.createElement(ToggleSwitchRing, {
39357
+ isMobile: isMobile
39358
+ })))), label && /*#__PURE__*/React__default.createElement(Box, {
39359
+ as: labelAs,
39360
+ 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; display: \n inline-block; \n ").concat(labelStyles),
39361
+ id: "".concat(nameId, "-label"),
39362
+ htmlFor: labelAs === "label" ? nameId : null,
39363
+ padding: "0"
39364
+ }, srOnlyLabel && /*#__PURE__*/React__default.createElement("span", {
39365
+ style: SCREEN_READER_ONLY
39366
+ }, srOnlyLabel), label))));
39333
39367
  };
39334
39368
  var ToggleSwitch$1 = themeComponent(ToggleSwitch, "ToggleSwitch", fallbackValues$y);
39335
39369