@kaizen/components 1.70.15 → 1.70.17
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/cjs/ToggleSwitch/ToggleSwitch/ToggleSwitch.cjs +6 -4
- package/dist/cjs/ToggleSwitch/ToggleSwitch/ToggleSwitch.module.scss.cjs +1 -0
- package/dist/esm/ToggleSwitch/ToggleSwitch/ToggleSwitch.mjs +6 -4
- package/dist/esm/ToggleSwitch/ToggleSwitch/ToggleSwitch.module.scss.mjs +1 -0
- package/dist/styles.css +4 -4
- package/dist/types/ToggleSwitch/ToggleSwitch/ToggleSwitch.d.ts +1 -1
- package/package.json +8 -3
- package/src/ToggleSwitch/ToggleSwitch/ToggleSwitch.module.scss +7 -5
- package/src/ToggleSwitch/ToggleSwitch/ToggleSwitch.tsx +4 -2
|
@@ -16,17 +16,19 @@ var ToggleSwitch = function (_a) {
|
|
|
16
16
|
var toggledStatus = _a.toggledStatus,
|
|
17
17
|
onToggle = _a.onToggle,
|
|
18
18
|
reversed = _a.reversed,
|
|
19
|
-
|
|
19
|
+
disabled = _a.disabled,
|
|
20
|
+
restProps = tslib.__rest(_a, ["toggledStatus", "onToggle", "reversed", "disabled"]);
|
|
20
21
|
var isOn = toggledStatus === 'on';
|
|
21
22
|
return React__default.default.createElement("span", {
|
|
22
23
|
className: classnames__default.default(isOn ? ToggleSwitch_module.on : ToggleSwitch_module.off, reversed && ToggleSwitch_module.reversed)
|
|
23
24
|
}, React__default.default.createElement("input", tslib.__assign({
|
|
24
25
|
type: "checkbox",
|
|
25
|
-
className: ToggleSwitch_module.checkbox,
|
|
26
|
+
className: classnames__default.default(ToggleSwitch_module.checkbox, disabled && ToggleSwitch_module.disabled),
|
|
26
27
|
checked: isOn ? true : false,
|
|
27
|
-
onChange: onToggle
|
|
28
|
+
onChange: onToggle,
|
|
29
|
+
disabled: disabled
|
|
28
30
|
}, restProps)), React__default.default.createElement("span", {
|
|
29
|
-
className: ToggleSwitch_module.track
|
|
31
|
+
className: classnames__default.default(ToggleSwitch_module.track, disabled && ToggleSwitch_module.disabled)
|
|
30
32
|
}, React__default.default.createElement("span", {
|
|
31
33
|
className: ToggleSwitch_module.thumb
|
|
32
34
|
}, React__default.default.createElement(Icon.Icon, {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var styles = {
|
|
4
4
|
"checkbox": "ToggleSwitch-module_checkbox__ezWz3",
|
|
5
5
|
"track": "ToggleSwitch-module_track__fcDMP",
|
|
6
|
+
"disabled": "ToggleSwitch-module_disabled__3H-9R",
|
|
6
7
|
"thumb": "ToggleSwitch-module_thumb__8PULV",
|
|
7
8
|
"checkIcon": "ToggleSwitch-module_checkIcon__8iitB",
|
|
8
9
|
"on": "ToggleSwitch-module_on__CQpkh",
|
|
@@ -8,17 +8,19 @@ const ToggleSwitch = /*#__PURE__*/function () {
|
|
|
8
8
|
var toggledStatus = _a.toggledStatus,
|
|
9
9
|
onToggle = _a.onToggle,
|
|
10
10
|
reversed = _a.reversed,
|
|
11
|
-
|
|
11
|
+
disabled = _a.disabled,
|
|
12
|
+
restProps = __rest(_a, ["toggledStatus", "onToggle", "reversed", "disabled"]);
|
|
12
13
|
var isOn = toggledStatus === 'on';
|
|
13
14
|
return /*#__PURE__*/React.createElement("span", {
|
|
14
15
|
className: classnames(isOn ? styles.on : styles.off, reversed && styles.reversed)
|
|
15
16
|
}, /*#__PURE__*/React.createElement("input", __assign({
|
|
16
17
|
type: "checkbox",
|
|
17
|
-
className: styles.checkbox,
|
|
18
|
+
className: classnames(styles.checkbox, disabled && styles.disabled),
|
|
18
19
|
checked: isOn ? true : false,
|
|
19
|
-
onChange: onToggle
|
|
20
|
+
onChange: onToggle,
|
|
21
|
+
disabled: disabled
|
|
20
22
|
}, restProps)), /*#__PURE__*/React.createElement("span", {
|
|
21
|
-
className: styles.track
|
|
23
|
+
className: classnames(styles.track, disabled && styles.disabled)
|
|
22
24
|
}, /*#__PURE__*/React.createElement("span", {
|
|
23
25
|
className: styles.thumb
|
|
24
26
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
var styles = {
|
|
2
2
|
"checkbox": "ToggleSwitch-module_checkbox__ezWz3",
|
|
3
3
|
"track": "ToggleSwitch-module_track__fcDMP",
|
|
4
|
+
"disabled": "ToggleSwitch-module_disabled__3H-9R",
|
|
4
5
|
"thumb": "ToggleSwitch-module_thumb__8PULV",
|
|
5
6
|
"checkIcon": "ToggleSwitch-module_checkIcon__8iitB",
|
|
6
7
|
"on": "ToggleSwitch-module_on__CQpkh",
|
package/dist/styles.css
CHANGED
|
@@ -11538,13 +11538,13 @@ input[type=range].InputRange-module_ratingScaleRange__gI-rs::-ms-thumb:not(:disa
|
|
|
11538
11538
|
/* stylelint-disable no-descending-specificity */
|
|
11539
11539
|
/* stylelint-enable no-descending-specificity */
|
|
11540
11540
|
}
|
|
11541
|
-
.ToggleSwitch-module_checkbox__ezWz3:focus + .ToggleSwitch-module_track__fcDMP, .ToggleSwitch-module_checkbox__ezWz3:hover:focus + .ToggleSwitch-module_track__fcDMP {
|
|
11541
|
+
.ToggleSwitch-module_checkbox__ezWz3:not(.ToggleSwitch-module_disabled__3H-9R):focus + .ToggleSwitch-module_track__fcDMP, .ToggleSwitch-module_checkbox__ezWz3:not(.ToggleSwitch-module_disabled__3H-9R):hover:focus + .ToggleSwitch-module_track__fcDMP {
|
|
11542
11542
|
border-color: transparent;
|
|
11543
11543
|
outline: 2px solid var(--color-blue-500, #0168b3);
|
|
11544
11544
|
outline-offset: 1px;
|
|
11545
11545
|
background-color: var(--color-gray-600, #524e56);
|
|
11546
11546
|
}
|
|
11547
|
-
.ToggleSwitch-module_checkbox__ezWz3 + .ToggleSwitch-module_track__fcDMP:hover, label:hover .ToggleSwitch-module_checkbox__ezWz3 + .ToggleSwitch-module_track__fcDMP {
|
|
11547
|
+
.ToggleSwitch-module_checkbox__ezWz3:not(.ToggleSwitch-module_disabled__3H-9R) + .ToggleSwitch-module_track__fcDMP:hover, label:hover .ToggleSwitch-module_checkbox__ezWz3 + .ToggleSwitch-module_track__fcDMP {
|
|
11548
11548
|
background-color: var(--color-purple-500, #844587);
|
|
11549
11549
|
background-color: var(--color-gray-600, #524e56);
|
|
11550
11550
|
}
|
|
@@ -11584,7 +11584,7 @@ input[type=range].InputRange-module_ratingScaleRange__gI-rs::-ms-thumb:not(:disa
|
|
|
11584
11584
|
transition-delay: var(--animation-duration-immediate, 100ms);
|
|
11585
11585
|
transition-duration: var(--animation-duration-fast, 300ms);
|
|
11586
11586
|
}
|
|
11587
|
-
.ToggleSwitch-module_on__CQpkh .ToggleSwitch-module_checkbox__ezWz3 + .ToggleSwitch-module_track__fcDMP:hover, label:hover .ToggleSwitch-module_on__CQpkh .ToggleSwitch-module_checkbox__ezWz3 + .ToggleSwitch-module_track__fcDMP {
|
|
11587
|
+
.ToggleSwitch-module_on__CQpkh .ToggleSwitch-module_checkbox__ezWz3:not(.ToggleSwitch-module_disabled__3H-9R) + .ToggleSwitch-module_track__fcDMP:hover, label:hover .ToggleSwitch-module_on__CQpkh .ToggleSwitch-module_checkbox__ezWz3 + .ToggleSwitch-module_track__fcDMP {
|
|
11588
11588
|
background-color: var(--color-green-600, #2c7d67);
|
|
11589
11589
|
}
|
|
11590
11590
|
|
|
@@ -11605,7 +11605,7 @@ input[type=range].InputRange-module_ratingScaleRange__gI-rs::-ms-thumb:not(:disa
|
|
|
11605
11605
|
.ToggleSwitch-module_reversed__Q3-iM.ToggleSwitch-module_off__OhSEP .ToggleSwitch-module_checkbox__ezWz3:hover:focus + .ToggleSwitch-module_track__fcDMP {
|
|
11606
11606
|
background-color: rgba(var(--color-white-rgb, 255, 255, 255), 0.65);
|
|
11607
11607
|
}
|
|
11608
|
-
.ToggleSwitch-module_reversed__Q3-iM.ToggleSwitch-module_off__OhSEP .ToggleSwitch-module_checkbox__ezWz3 + .ToggleSwitch-module_track__fcDMP:hover, label:hover .ToggleSwitch-module_reversed__Q3-iM.ToggleSwitch-module_off__OhSEP .ToggleSwitch-module_checkbox__ezWz3 + .ToggleSwitch-module_track__fcDMP {
|
|
11608
|
+
.ToggleSwitch-module_reversed__Q3-iM.ToggleSwitch-module_off__OhSEP .ToggleSwitch-module_checkbox__ezWz3:not(.ToggleSwitch-module_disabled__3H-9R) + .ToggleSwitch-module_track__fcDMP:hover, label:hover .ToggleSwitch-module_reversed__Q3-iM.ToggleSwitch-module_off__OhSEP .ToggleSwitch-module_checkbox__ezWz3 + .ToggleSwitch-module_track__fcDMP {
|
|
11609
11609
|
background-color: rgba(var(--color-white-rgb, 255, 255, 255), 0.65);
|
|
11610
11610
|
}
|
|
11611
11611
|
|
|
@@ -10,6 +10,6 @@ export type ToggleSwitchProps = {
|
|
|
10
10
|
reversed?: boolean;
|
|
11
11
|
} & OverrideClassName<Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'onToggle'>>;
|
|
12
12
|
export declare const ToggleSwitch: {
|
|
13
|
-
({ toggledStatus, onToggle, reversed, ...restProps }: ToggleSwitchProps): JSX.Element;
|
|
13
|
+
({ toggledStatus, onToggle, reversed, disabled, ...restProps }: ToggleSwitchProps): JSX.Element;
|
|
14
14
|
displayName: string;
|
|
15
15
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaizen/components",
|
|
3
|
-
"version": "1.70.
|
|
3
|
+
"version": "1.70.17",
|
|
4
4
|
"description": "Kaizen component library",
|
|
5
5
|
"author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
|
|
6
6
|
"homepage": "https://cultureamp.design",
|
|
@@ -80,6 +80,11 @@
|
|
|
80
80
|
"import": "./dist/esm/reactAriaComponentsV3.mjs",
|
|
81
81
|
"require": "./dist/cjs/reactAriaComponentsV3.cjs",
|
|
82
82
|
"types": "./dist/types/__react-aria-components__/index.d.ts"
|
|
83
|
+
},
|
|
84
|
+
"./dist/styles.css": {
|
|
85
|
+
"import": "./dist/styles.css",
|
|
86
|
+
"require": "./dist/styles.css",
|
|
87
|
+
"style": "./dist/styles.css"
|
|
83
88
|
}
|
|
84
89
|
},
|
|
85
90
|
"bin": {
|
|
@@ -169,8 +174,8 @@
|
|
|
169
174
|
"svgo": "^3.3.2",
|
|
170
175
|
"tslib": "^2.8.1",
|
|
171
176
|
"tsx": "^4.19.2",
|
|
172
|
-
"@kaizen/
|
|
173
|
-
"@kaizen/
|
|
177
|
+
"@kaizen/package-bundler": "2.0.4",
|
|
178
|
+
"@kaizen/design-tokens": "10.8.7"
|
|
174
179
|
},
|
|
175
180
|
"devDependenciesComments": {
|
|
176
181
|
"sass": "Prevent deprecation warnings introduced in 1.80 as we plan to move away from sass",
|
|
@@ -27,19 +27,20 @@ $focus-ring-offset: 1px;
|
|
|
27
27
|
|
|
28
28
|
/* TODO: Fix */
|
|
29
29
|
/* stylelint-disable no-descending-specificity */
|
|
30
|
-
.checkbox:focus + &,
|
|
31
|
-
.checkbox:hover:focus + & {
|
|
30
|
+
.checkbox:not(.disabled):focus + &,
|
|
31
|
+
.checkbox:not(.disabled):hover:focus + & {
|
|
32
32
|
border-color: transparent;
|
|
33
33
|
outline: 2px solid $color-blue-500;
|
|
34
34
|
outline-offset: $focus-ring-offset;
|
|
35
35
|
background-color: $color-gray-600;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
.checkbox + &:hover,
|
|
38
|
+
.checkbox:not(.disabled) + &:hover,
|
|
39
39
|
label:hover .checkbox + & {
|
|
40
40
|
background-color: $color-purple-500;
|
|
41
41
|
background-color: $color-gray-600;
|
|
42
42
|
}
|
|
43
|
+
|
|
43
44
|
/* stylelint-enable no-descending-specificity */
|
|
44
45
|
}
|
|
45
46
|
|
|
@@ -86,7 +87,7 @@ $focus-ring-offset: 1px;
|
|
|
86
87
|
transition-duration: $animation-duration-fast;
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
.checkbox + .track:hover,
|
|
90
|
+
.checkbox:not(.disabled) + .track:hover,
|
|
90
91
|
label:hover & .checkbox + .track {
|
|
91
92
|
background-color: $color-green-600;
|
|
92
93
|
}
|
|
@@ -116,10 +117,11 @@ $focus-ring-offset: 1px;
|
|
|
116
117
|
background-color: rgba($color-white-rgb, 0.65);
|
|
117
118
|
}
|
|
118
119
|
|
|
119
|
-
.checkbox + .track:hover,
|
|
120
|
+
.checkbox:not(.disabled) + .track:hover,
|
|
120
121
|
label:hover & .checkbox + .track {
|
|
121
122
|
background-color: rgba($color-white-rgb, 0.65);
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
}
|
|
126
|
+
|
|
125
127
|
/* stylelint-enable no-descending-specificity */
|
|
@@ -19,6 +19,7 @@ export const ToggleSwitch = ({
|
|
|
19
19
|
toggledStatus,
|
|
20
20
|
onToggle,
|
|
21
21
|
reversed,
|
|
22
|
+
disabled,
|
|
22
23
|
...restProps
|
|
23
24
|
}: ToggleSwitchProps): JSX.Element => {
|
|
24
25
|
const isOn = toggledStatus === 'on'
|
|
@@ -27,12 +28,13 @@ export const ToggleSwitch = ({
|
|
|
27
28
|
<span className={classnames(isOn ? styles.on : styles.off, reversed && styles.reversed)}>
|
|
28
29
|
<input
|
|
29
30
|
type="checkbox"
|
|
30
|
-
className={styles.checkbox}
|
|
31
|
+
className={classnames(styles.checkbox, disabled && styles.disabled)}
|
|
31
32
|
checked={isOn ? true : false}
|
|
32
33
|
onChange={onToggle}
|
|
34
|
+
disabled={disabled}
|
|
33
35
|
{...restProps}
|
|
34
36
|
/>
|
|
35
|
-
<span className={styles.track}>
|
|
37
|
+
<span className={classnames(styles.track, disabled && styles.disabled)}>
|
|
36
38
|
<span className={styles.thumb}>
|
|
37
39
|
<Icon name="check" isPresentational className={styles.checkIcon} />
|
|
38
40
|
</span>
|