@loomhq/lens 10.63.0 → 10.63.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/README.md
CHANGED
|
@@ -62,7 +62,79 @@ navigate to: http://localhost:3000
|
|
|
62
62
|
|
|
63
63
|
### Use conventional commits
|
|
64
64
|
|
|
65
|
-
Use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) to kick off publishing a new version of Lens when PR is merged.
|
|
65
|
+
Use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) to kick off publishing a new version of Lens when PR is merged.
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Upgrading Lens versions
|
|
69
|
+
|
|
70
|
+
#### loom
|
|
71
|
+
From the root of the [main Loom repo](http://github.com/loomhq/loom)
|
|
72
|
+
|
|
73
|
+
1. Move into the webapp-client directory.
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
cd projects/webapp-client
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
2. Upgrade the Lens package with pnpm (you can ignore the warnings).
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
pnpm up @loomhq/lens
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
3. From the root, fix dependencies and upgrade Lens globally
|
|
86
|
+
```
|
|
87
|
+
cd ... && pnpm deps:fix && pnpm i
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
4. Run changesets so that it generates the necessary `.md` file for release.
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
pnpm changeset
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
5. Follow the prompts. Hit Spacebar to select all changed packages. The checks should turn green. Hit Enter to commit.
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
🦋 Which packages would you like to include?
|
|
100
|
+
✔ changed packages
|
|
101
|
+
✔ @loomhq/web-client
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
6. Skip major bump. Hit Enter to bypass.
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
🦋 Which packages should have a major bump? …
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
7. Skip minor bump. Hit Enter to bypass.
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
🦋 Which packages should have a minor bump? …
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
8. For patch bump, you will be prompted to write a description.
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
The following packages will be patch bumped:
|
|
120
|
+
🦋 @loomhq/web-client@0.0.6
|
|
121
|
+
🦋 Please enter a summary for this change (this will be in the changelogs). Submit empty line to open external editor
|
|
122
|
+
🦋 Summary › [description goes here, enter to complete]
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
9. Write a concise note like `bump Lens v[X.X.X] to add SvgIconName`
|
|
126
|
+
|
|
127
|
+
10. You will be asked asked if this is your desired change. Type 'Y'.
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
All dependents of these packages that will be incompatible with the new version will be patch bumped when this changeset is applied.
|
|
131
|
+
|
|
132
|
+
🦋 Is this your desired changeset? (Y/n) › [type Y]
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
11. A new randomly-named `.md` file should be generated into the changesets directory. Commit this file to your changes.
|
|
136
|
+
|
|
137
|
+
12. For any changes to existing components, do your due diligence and check the component changes locally within the repo.
|
|
66
138
|
|
|
67
139
|
### Add an icon to the icon set
|
|
68
140
|
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
declare const SwitchInput: import("@emotion/styled-base").StyledComponent<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, SwitchInputProps, object>;
|
|
3
|
-
declare const Switch: ({ isActive, isDisabled, onChange, size,
|
|
3
|
+
declare const Switch: ({ isActive, isDisabled, onChange, size, ...props }: SwitchProps & Omit<React.ComponentProps<typeof SwitchInput>, 'size'>) => JSX.Element;
|
|
4
4
|
declare type SwitchProps = {
|
|
5
5
|
isActive?: boolean;
|
|
6
6
|
isDisabled?: boolean;
|
|
7
7
|
onChange?: React.ReactEventHandler;
|
|
8
8
|
size?: 'medium' | 'large';
|
|
9
|
-
ariaLabelledby?: string;
|
|
10
|
-
ariaLabel?: string;
|
|
11
9
|
};
|
|
12
10
|
declare type SwitchInputProps = {
|
|
13
11
|
switchSize?: 'medium' | 'large';
|
|
@@ -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
|
|
13
|
+
import React from 'react';
|
|
14
14
|
import styled from '@emotion/styled';
|
|
15
15
|
const sizes = {
|
|
16
16
|
medium: {
|
|
@@ -53,18 +53,16 @@ const getKnobSize = props => {
|
|
|
53
53
|
return (sizes[props.switchSize].switchHeight -
|
|
54
54
|
sizes[props.switchSize].knobOffset * 2);
|
|
55
55
|
};
|
|
56
|
-
const
|
|
56
|
+
const SwitchLabel = styled.label `
|
|
57
57
|
display: block;
|
|
58
58
|
position: relative;
|
|
59
59
|
`;
|
|
60
60
|
const SwitchInput = styled.input `
|
|
61
61
|
position: absolute;
|
|
62
62
|
opacity: 0;
|
|
63
|
-
|
|
64
63
|
&:focus-visible ~ .SwitchBox {
|
|
65
64
|
${getFocusRing()};
|
|
66
65
|
}
|
|
67
|
-
|
|
68
66
|
&:not(:checked) {
|
|
69
67
|
& + .SwitchBox {
|
|
70
68
|
background-color: ${colorStyles.track.inactive.enabled};
|
|
@@ -73,7 +71,6 @@ const SwitchInput = styled.input `
|
|
|
73
71
|
background-color: ${colorStyles.track.inactive.disabled};
|
|
74
72
|
}
|
|
75
73
|
}
|
|
76
|
-
|
|
77
74
|
&:checked {
|
|
78
75
|
& + .SwitchBox {
|
|
79
76
|
background-color: ${colorStyles.track.active.enabled};
|
|
@@ -85,7 +82,6 @@ const SwitchInput = styled.input `
|
|
|
85
82
|
transform: translateX(${props => getKnobTravel(props)}px);
|
|
86
83
|
}
|
|
87
84
|
}
|
|
88
|
-
|
|
89
85
|
&:disabled {
|
|
90
86
|
pointer-events: none;
|
|
91
87
|
}
|
|
@@ -97,7 +93,6 @@ const SwitchBox = styled.div `
|
|
|
97
93
|
border-radius: var(--lns-radius-full);
|
|
98
94
|
transition: 0.2s;
|
|
99
95
|
cursor: ${props => (props.isDisabled ? 'default' : 'pointer')};
|
|
100
|
-
|
|
101
96
|
&:after {
|
|
102
97
|
content: '';
|
|
103
98
|
position: absolute;
|
|
@@ -113,19 +108,9 @@ const SwitchBox = styled.div `
|
|
|
113
108
|
}
|
|
114
109
|
`;
|
|
115
110
|
const Switch = (_a) => {
|
|
116
|
-
var { isActive, isDisabled, onChange, size = 'medium'
|
|
117
|
-
|
|
118
|
-
|
|
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
|
-
};
|
|
127
|
-
return (React.createElement(SwitchWrapper, null,
|
|
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 })));
|
|
111
|
+
var { isActive, isDisabled, onChange, size = 'medium' } = _a, props = __rest(_a, ["isActive", "isDisabled", "onChange", "size"]);
|
|
112
|
+
return (React.createElement(SwitchLabel, null,
|
|
113
|
+
React.createElement(SwitchInput, Object.assign({}, props, { checked: isActive, disabled: isDisabled, onChange: onChange, type: "checkbox", switchSize: size })),
|
|
114
|
+
React.createElement(SwitchBox, { className: "SwitchBox", isDisabled: isDisabled, isActive: isActive, switchSize: size })));
|
|
130
115
|
};
|
|
131
116
|
export default Switch;
|