@mrshmllw/smores-react 10.4.0 → 10.5.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/README.md +0 -4
- package/dist/Toggle/Toggle.d.ts +2 -2
- package/dist/Toggle/Toggle.js +14 -8
- package/dist/Toggle/Toggle.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
@@ -74,10 +74,6 @@ Not too different to your usual workflow!
|
|
74
74
|
7. This can be done multiple times and it will increment your pre-release package version!
|
75
75
|
8. When you're happy with the changes, simply squash and merge the PR and release `main`!
|
76
76
|
|
77
|
-
###### Tokens
|
78
|
-
|
79
|
-
The `MARSHMALLOW_CI_PAT` has been created from the internal @marshmallow-ci GH account, it is due to expire on `9th December 2024` so will need regenerating once it does.
|
80
|
-
|
81
77
|
## Running Smores in dev mode
|
82
78
|
To run Smores in dev mode follow the below instructions on installing and using Yalc to link up your project repo with Smores.
|
83
79
|
|
package/dist/Toggle/Toggle.d.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
import { FC } from 'react';
|
2
2
|
import { MarginProps } from '../utils/space';
|
3
|
-
type Props = {
|
3
|
+
export type Props = {
|
4
4
|
/** unique ID */
|
5
5
|
id?: string;
|
6
6
|
/** checked flag */
|
7
7
|
checked: boolean;
|
8
|
+
disabled?: boolean;
|
8
9
|
/** onToggle listener */
|
9
10
|
onToggle: () => void;
|
10
11
|
} & MarginProps;
|
11
12
|
export declare const Toggle: FC<Props>;
|
12
|
-
export {};
|
package/dist/Toggle/Toggle.js
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import styled from 'styled-components';
|
2
|
+
import styled, { css } from 'styled-components';
|
3
3
|
import { Box } from '../Box';
|
4
4
|
import { theme } from '../theme';
|
5
5
|
import { focusOutline } from '../utils/focusOutline';
|
6
|
-
export const Toggle = ({ id, checked, onToggle, ...marginProps }) => {
|
6
|
+
export const Toggle = ({ id, checked, onToggle, disabled, ...marginProps }) => {
|
7
7
|
return (React.createElement(Switch, { forwardedAs: "label", htmlFor: id, ...marginProps },
|
8
|
-
React.createElement(Checkbox, { id: id, type: "checkbox", checked: checked, onChange: onToggle, onKeyDown: (e) => {
|
8
|
+
React.createElement(Checkbox, { id: id, disabled: disabled, type: "checkbox", checked: checked, onChange: onToggle, onKeyDown: (e) => {
|
9
9
|
if (e.key === 'Enter') {
|
10
10
|
onToggle();
|
11
11
|
}
|
12
12
|
}, "aria-label": "toggle" }),
|
13
|
-
React.createElement(Slider,
|
13
|
+
React.createElement(Slider, { "$disabled": disabled })));
|
14
14
|
};
|
15
15
|
const Switch = styled(Box) `
|
16
16
|
position: relative;
|
@@ -37,10 +37,6 @@ const Slider = styled.span `
|
|
37
37
|
transition: 0.2s background-color;
|
38
38
|
outline: none;
|
39
39
|
|
40
|
-
&:hover {
|
41
|
-
background-color: ${theme.colors.marzipan};
|
42
|
-
}
|
43
|
-
|
44
40
|
&:before {
|
45
41
|
position: absolute;
|
46
42
|
content: '';
|
@@ -52,6 +48,16 @@ const Slider = styled.span `
|
|
52
48
|
transition: 0.2s transform;
|
53
49
|
border-radius: 50%;
|
54
50
|
}
|
51
|
+
|
52
|
+
${({ $disabled }) => $disabled
|
53
|
+
? css `
|
54
|
+
cursor: not-allowed;
|
55
|
+
`
|
56
|
+
: css `
|
57
|
+
&:hover {
|
58
|
+
background-color: ${theme.colors.marzipan};
|
59
|
+
}
|
60
|
+
`}
|
55
61
|
`;
|
56
62
|
const Checkbox = styled.input `
|
57
63
|
${focusOutline({ selector: `&:focus-visible + ${Slider}` })}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Toggle.js","sourceRoot":"","sources":["../../src/Toggle/Toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAA;AACjC,OAAO,MAAM,MAAM,mBAAmB,CAAA;
|
1
|
+
{"version":3,"file":"Toggle.js","sourceRoot":"","sources":["../../src/Toggle/Toggle.tsx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,CAAC,QAAQ;;SAE5C;CACR,CAAA;AAED,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAA;IACzB,YAAY,CAAC,EAAE,QAAQ,EAAE,qBAAqB,MAAM,EAAE,EAAE,CAAC;;gBAE7C,MAAM;wBACE,KAAK,CAAC,MAAM,CAAC,SAAS;;;;gBAI9B,MAAM;;;CAGrB,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@mrshmllw/smores-react",
|
3
|
-
"version": "10.
|
3
|
+
"version": "10.5.0",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"description": "Collection of React components used by Marshmallow Technology",
|
6
6
|
"keywords": [
|
@@ -39,13 +39,13 @@
|
|
39
39
|
"@babel/preset-env": "^7.26.0",
|
40
40
|
"@babel/preset-react": "^7.26.3",
|
41
41
|
"@babel/preset-typescript": "^7.26.0",
|
42
|
-
"@commitlint/cli": "^19.6.
|
42
|
+
"@commitlint/cli": "^19.6.1",
|
43
43
|
"@commitlint/types": "^19.5.0",
|
44
44
|
"@semantic-release/changelog": "^6.0.3",
|
45
45
|
"@semantic-release/git": "^10.0.1",
|
46
46
|
"@semantic-release/github": "^11.0.1",
|
47
47
|
"@semantic-release/npm": "^12.0.0",
|
48
|
-
"@snyk/protect": "^1.1294.
|
48
|
+
"@snyk/protect": "^1.1294.3",
|
49
49
|
"@storybook/addon-a11y": "^8.4.7",
|
50
50
|
"@storybook/addon-coverage": "^1.0.3",
|
51
51
|
"@storybook/addon-essentials": "^8.4.7",
|
@@ -84,14 +84,14 @@
|
|
84
84
|
"vitest": "^2.1.8"
|
85
85
|
},
|
86
86
|
"dependencies": {
|
87
|
-
"@floating-ui/react": "0.27.
|
87
|
+
"@floating-ui/react": "0.27.2",
|
88
88
|
"@lexical/react": "^0.21.0",
|
89
|
+
"@storybook/preview-api": "^8.4.7",
|
89
90
|
"body-scroll-lock": "^4.0.0-beta.0",
|
90
91
|
"date-fns": "^4.1.0",
|
91
92
|
"dompurify": "^3.2.3",
|
92
93
|
"fuse.js": "^7.0.0",
|
93
94
|
"lexical": "^0.21.0",
|
94
|
-
"micromatch": "^4.0.8",
|
95
95
|
"polished": "^4.1.3"
|
96
96
|
},
|
97
97
|
"peerDependencies": {
|