@thecb/components 10.7.6 → 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.esm.js CHANGED
@@ -39269,46 +39269,69 @@ var fallbackValues$y = {
39269
39269
  var HiddenToggleSwitchBox = styled.input.withConfig({
39270
39270
  displayName: "ToggleSwitch__HiddenToggleSwitchBox",
39271
39271
  componentId: "sc-1t51u6v-0"
39272
- })(["opacity:0;position:absolute;cursor:", ";height:24px;width:50px;", ""], function (_ref) {
39272
+ })(["opacity:0;margin:0;position:absolute;cursor:", ";height:", ";width:", ";"], function (_ref) {
39273
39273
  var disabled = _ref.disabled;
39274
39274
  return disabled ? "auto" : "pointer";
39275
39275
  }, function (_ref2) {
39276
39276
  var isMobile = _ref2.isMobile;
39277
- return isMobile ? "transform: scale(0.75)" : "";
39277
+ return isMobile ? "22px" : "24px";
39278
+ }, function (_ref3) {
39279
+ var isMobile = _ref3.isMobile;
39280
+ return isMobile ? "40px" : "44px";
39278
39281
  });
39279
- var VisibleSwitchComponent = styled.label.withConfig({
39282
+ var VisibleSwitchComponent = styled.span.withConfig({
39280
39283
  displayName: "ToggleSwitch__VisibleSwitchComponent",
39281
39284
  componentId: "sc-1t51u6v-1"
39282
- })(["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) {
39283
- var disabled = _ref3.disabled;
39284
- return disabled ? "auto" : "pointer";
39285
- }, function (_ref4) {
39286
- var disabled = _ref4.disabled;
39287
- 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";
39288
39288
  }, function (_ref5) {
39289
39289
  var isMobile = _ref5.isMobile;
39290
- return isMobile ? "transform: scale(0.75)" : "";
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";
39291
39297
  });
39292
- var ToggleSwitchRingComponent = styled.div.withConfig({
39298
+ var ToggleSwitchRingComponent = styled.span.withConfig({
39293
39299
  displayName: "ToggleSwitch__ToggleSwitchRingComponent",
39294
39300
  componentId: "sc-1t51u6v-2"
39295
- })(["position:absolute;width:16px;height:16px;border:none;border-radius:50%;box-sizing:border-box;"]);
39296
- var ToggleSwitch = function ToggleSwitch(_ref6) {
39297
- var _ref6$isOn = _ref6.isOn,
39298
- isOn = _ref6$isOn === void 0 ? false : _ref6$isOn,
39299
- _ref6$onToggle = _ref6.onToggle,
39300
- onToggle = _ref6$onToggle === void 0 ? noop : _ref6$onToggle,
39301
- _ref6$disabled = _ref6.disabled,
39302
- disabled = _ref6$disabled === void 0 ? false : _ref6$disabled,
39303
- _ref6$name = _ref6.name,
39304
- name = _ref6$name === void 0 ? "" : _ref6$name,
39305
- _ref6$label = _ref6.label,
39306
- label = _ref6$label === void 0 ? null : _ref6$label,
39307
- _ref6$labelLeft = _ref6.labelLeft,
39308
- labelLeft = _ref6$labelLeft === void 0 ? false : _ref6$labelLeft,
39309
- themeValues = _ref6.themeValues,
39310
- isMobile = _ref6.isMobile,
39311
- dataQa = _ref6.dataQa;
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, "-");
39312
39335
  var ToggleSwitchRing = posed(ToggleSwitchRingComponent)({
39313
39336
  off: {
39314
39337
  backgroundColor: disabled ? themeValues.disabledBackground : themeValues.onBackground,
@@ -39365,12 +39388,14 @@ var ToggleSwitch = function ToggleSwitch(_ref6) {
39365
39388
  }
39366
39389
  };
39367
39390
  return /*#__PURE__*/React.createElement(Box, {
39368
- padding: "0",
39369
- 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)
39370
39393
  }, /*#__PURE__*/React.createElement(Center, null, /*#__PURE__*/React.createElement(Cluster, {
39371
- justify: "stretch",
39394
+ justify: "space-between",
39372
39395
  align: "center",
39373
- overflow: "visible"
39396
+ overflow: "visible",
39397
+ childGap: "0",
39398
+ minWidth: minWidth !== null && minWidth !== void 0 ? minWidth : isMobile ? "75px" : "84px"
39374
39399
  }, /*#__PURE__*/React.createElement(Cover, {
39375
39400
  minHeight: "100%",
39376
39401
  singleChild: true
@@ -39380,26 +39405,33 @@ var ToggleSwitch = function ToggleSwitch(_ref6) {
39380
39405
  extraStyles: "display: flex; align-items: center;",
39381
39406
  dataQa: dataQa
39382
39407
  }, /*#__PURE__*/React.createElement(HiddenToggleSwitchBox, {
39408
+ type: "checkbox",
39409
+ "aria-checked": isOn,
39383
39410
  "aria-label": name,
39411
+ "aria-labelledby": label ? "".concat(nameId, "-label") : null,
39412
+ "aria-describedby": ariaDescribedBy ? ariaDescribedBy : null,
39384
39413
  checked: isOn,
39385
39414
  onChange: disabled ? noop : onToggle,
39386
39415
  disabled: disabled,
39387
- id: "#toggle-".concat(name),
39416
+ id: "#".concat(nameId),
39388
39417
  isMobile: isMobile
39389
39418
  }), /*#__PURE__*/React.createElement(VisibleSwitch, {
39390
- name: name,
39391
- htmlFor: "#toggle-".concat(name),
39392
39419
  onClick: disabled ? noop : onToggle,
39393
39420
  onKeyDown: disabled ? noop : handleKeyDown,
39394
39421
  pose: isOn ? "on" : "off",
39395
39422
  tabIndex: disabled ? -1 : 0,
39396
39423
  disabled: disabled,
39424
+ isMobile: isMobile,
39425
+ tabindex: "0"
39426
+ }, /*#__PURE__*/React.createElement(ToggleSwitchRing, {
39397
39427
  isMobile: isMobile
39398
- }, /*#__PURE__*/React.createElement(ToggleSwitchRing, null)))), label && /*#__PURE__*/React.createElement(Heading$1, {
39399
- variant: "h4",
39400
- weight: FONT_WEIGHT_SEMIBOLD,
39401
- extraStyles: "margin: 0 0.5rem; position: relative; bottom: 1px; display: inline-block;",
39402
- color: CHARADE_GREY
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"
39403
39435
  }, label))));
39404
39436
  };
39405
39437
  var ToggleSwitch$1 = themeComponent(ToggleSwitch, "ToggleSwitch", fallbackValues$y);