@versini/ui-toggle 6.3.0 → 7.0.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 +0 -1
- package/dist/index.d.ts +1 -6
- package/dist/index.js +6 -14
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -139,7 +139,6 @@ function SettingsPanel() {
|
|
|
139
139
|
| `name` | `string` | - | Form field name (required). |
|
|
140
140
|
| `onChange` | `(checked: boolean) => void` | - | Callback fired when checked state changes. |
|
|
141
141
|
| `checked` | `boolean` | `false` | Controlled checked state. |
|
|
142
|
-
| `focusMode` | `"dark" \| "light" \| "system" \| "alt-system"` | `"system"` | Focus ring color mode. |
|
|
143
142
|
| `labelHidden` | `boolean` | `false` | Visually hide the label (still accessible). |
|
|
144
143
|
| `labelPosition` | `"left" \| "right"` | `"right"` | Position of the label relative to the toggle. |
|
|
145
144
|
| `mode` | `"dark" \| "light" \| "system" \| "alt-system"` | `"system"` | Color mode/theme. |
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSX } from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
export declare const Toggle: ({ checked, onChange, label, labelHidden, name, mode,
|
|
3
|
+
export declare const Toggle: ({ checked, onChange, label, labelHidden, name, mode, labelMode, className, noBorder, narrow, noHaptic, labelPosition, subLabel, splitBackground, }: ToggleProps) => JSX.Element;
|
|
4
4
|
|
|
5
5
|
export declare const TOGGLE_CLASSNAME = "av-toggle";
|
|
6
6
|
|
|
@@ -27,11 +27,6 @@ declare type ToggleProps = {
|
|
|
27
27
|
* @default false
|
|
28
28
|
*/
|
|
29
29
|
checked?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* The type of focus for the Button. This will change the color
|
|
32
|
-
* of the focus ring around the Button.
|
|
33
|
-
*/
|
|
34
|
-
focusMode?: "dark" | "light" | "system" | "alt-system";
|
|
35
30
|
/**
|
|
36
31
|
* Whether or not to render the label and sub-label.
|
|
37
32
|
* @default false
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-toggle
|
|
2
|
+
@versini/ui-toggle v7.0.1
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -21,13 +21,8 @@ const getToggleBaseClasses = ({ narrow })=>{
|
|
|
21
21
|
}, // Smooth background/border transition when toggling
|
|
22
22
|
"transition-colors duration-300 ease-in-out motion-reduce:transition-none");
|
|
23
23
|
};
|
|
24
|
-
const getToggleKnobFocusClasses = (
|
|
25
|
-
return clsx("peer-focus:outline", "peer-focus:outline-2", "peer-focus:outline-offset-2",
|
|
26
|
-
"peer-focus:outline-focus-dark": focusMode === "dark",
|
|
27
|
-
"peer-focus:outline-focus-light": focusMode === "light",
|
|
28
|
-
"peer-focus:outline-focus-light dark:peer-focus:outline-focus-dark": focusMode === "alt-system",
|
|
29
|
-
"peer-focus:outline-focus-dark dark:peer-focus:outline-focus-light": focusMode === "system"
|
|
30
|
-
});
|
|
24
|
+
const getToggleKnobFocusClasses = ()=>{
|
|
25
|
+
return clsx("peer-focus:outline", "peer-focus:outline-2", "peer-focus:outline-offset-2", "peer-focus:outline-focus-dark");
|
|
31
26
|
};
|
|
32
27
|
// Aqua-style split background overlay for the toggle knob:
|
|
33
28
|
// - Top half: flat white overlay (light, uniform)
|
|
@@ -84,16 +79,14 @@ const getWrapperClasses = ({ className })=>{
|
|
|
84
79
|
const getToggleWrapperClasses = ()=>{
|
|
85
80
|
return "relative inline-block";
|
|
86
81
|
};
|
|
87
|
-
const getToggleClasses = ({ mode,
|
|
82
|
+
const getToggleClasses = ({ mode, labelHidden, className, noBorder, narrow, labelMode, labelPosition = "right", subLabel, splitBackground })=>{
|
|
88
83
|
return {
|
|
89
84
|
toggle: clsx(getToggleBaseClasses({
|
|
90
85
|
narrow
|
|
91
86
|
}), getToggleColorClasses({
|
|
92
87
|
mode,
|
|
93
88
|
noBorder
|
|
94
|
-
}), getToggleKnobFocusClasses({
|
|
95
|
-
focusMode
|
|
96
|
-
}), getToggleKnobOffClasses({
|
|
89
|
+
}), getToggleKnobFocusClasses(), getToggleKnobOffClasses({
|
|
97
90
|
narrow
|
|
98
91
|
}), getToggleKnobOnClasses({
|
|
99
92
|
narrow,
|
|
@@ -123,11 +116,10 @@ const getToggleClasses = ({ mode, focusMode, labelHidden, className, noBorder, n
|
|
|
123
116
|
|
|
124
117
|
|
|
125
118
|
|
|
126
|
-
const Toggle = ({ checked = false, onChange, label, labelHidden = false, name, mode = "system",
|
|
119
|
+
const Toggle = ({ checked = false, onChange, label, labelHidden = false, name, mode = "system", labelMode, className, noBorder = false, narrow = false, noHaptic = false, labelPosition = "right", subLabel, splitBackground = false })=>{
|
|
127
120
|
const { haptic } = useHaptic();
|
|
128
121
|
const toggleClasses = getToggleClasses({
|
|
129
122
|
mode,
|
|
130
|
-
focusMode,
|
|
131
123
|
labelHidden,
|
|
132
124
|
className,
|
|
133
125
|
noBorder,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-toggle",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"test": "vitest run"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@versini/ui-types": "
|
|
40
|
+
"@versini/ui-types": "9.1.0"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@versini/ui-hooks": "6.1.1",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"sideEffects": [
|
|
48
48
|
"**/*.css"
|
|
49
49
|
],
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "e1d07ef9f8c39af8e1cf471a2d1688f4bca1771c"
|
|
51
51
|
}
|