@loomhq/lens 10.62.0 → 10.62.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.
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { getColorValue, getFocusRing } from '../../utilities';
13
- import React from 'react';
13
+ import React, { useRef } from 'react';
14
14
  import styled from '@emotion/styled';
15
15
  const sizes = {
16
16
  medium: {
@@ -115,10 +115,17 @@ const SwitchBox = styled.div `
115
115
  const Switch = (_a) => {
116
116
  var { isActive, isDisabled, onChange, size = 'medium', ariaLabelledby, ariaLabel } = _a, props = __rest(_a, ["isActive", "isDisabled", "onChange", "size", "ariaLabelledby", "ariaLabel"]);
117
117
  if (ariaLabelledby && ariaLabel) {
118
- throw new Error('ariaLabelledby and ariaLabel serve the same purpose and therefore cannot be used at the same time. Choose the one that best suites your needs. ');
118
+ throw new Error('ariaLabelledby and ariaLabel serve the same purpose and therefore cannot be used at the same time. Choose the one that best suites your needs.');
119
119
  }
120
+ const ref = useRef(null);
121
+ const toggleSwitch = () => {
122
+ if (!ref.current || isActive) {
123
+ return;
124
+ }
125
+ ref.current.checked = !ref.current.checked;
126
+ };
120
127
  return (React.createElement(SwitchWrapper, null,
121
- React.createElement(SwitchInput, Object.assign({}, props, { role: "switch", type: "checkbox", checked: isActive, disabled: isDisabled, onChange: onChange, switchSize: size, "aria-labelledby": ariaLabelledby, "aria-label": ariaLabel, "aria-checked": isActive })),
122
- React.createElement(SwitchBox, { className: "SwitchBox", isDisabled: isDisabled, isActive: isActive, switchSize: size })));
128
+ React.createElement(SwitchInput, Object.assign({}, props, { role: "switch", type: "checkbox", ref: ref, checked: isActive, disabled: isDisabled, onChange: onChange, switchSize: size, "aria-labelledby": ariaLabelledby, "aria-label": ariaLabel, "aria-checked": isActive })),
129
+ React.createElement(SwitchBox, { className: "SwitchBox", isDisabled: isDisabled, isActive: isActive, switchSize: size, onClick: toggleSwitch })));
123
130
  };
124
131
  export default Switch;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomhq/lens",
3
- "version": "10.62.0",
3
+ "version": "10.62.1",
4
4
  "scripts": {
5
5
  "dev": "next",
6
6
  "build:next": "next build",