@versini/ui-togglegroup 6.0.0 → 6.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/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +10 -20
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@ import { JSX } from 'react/jsx-runtime';
|
|
|
2
2
|
import type { ToggleGroupItemProps } from './ToggleGroupTypes';
|
|
3
3
|
import type { ToggleGroupProps } from './ToggleGroupTypes';
|
|
4
4
|
|
|
5
|
-
export declare const ToggleGroup: ({ children, value, onValueChange, disabled,
|
|
5
|
+
export declare const ToggleGroup: ({ children, value, onValueChange, disabled, size, defaultValue, className, ...otherProps }: ToggleGroupProps) => JSX.Element;
|
|
6
6
|
|
|
7
7
|
export declare const TOGGLEGROUP_CLASSNAME = "av-togglegroup";
|
|
8
8
|
|
package/dist/components/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-togglegroup v6.0.
|
|
2
|
+
@versini/ui-togglegroup v6.0.1
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -17,23 +17,17 @@ const TOGGLEGROUP_ITEM_CLASSNAME = "av-togglegroup-item";
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
const ToggleGroupContext = react.createContext({
|
|
20
|
-
size: "medium"
|
|
21
|
-
focusMode: "system"
|
|
20
|
+
size: "medium"
|
|
22
21
|
});
|
|
23
22
|
|
|
24
23
|
|
|
25
24
|
|
|
26
25
|
|
|
27
|
-
const getToggleGroupItemFocusClasses = (
|
|
28
|
-
return clsx("focus:outline-none", "focus:ring-2", "focus:ring-inset",
|
|
29
|
-
"focus:ring-focus-light": focusMode === "light",
|
|
30
|
-
"focus:ring-focus-dark": focusMode === "dark",
|
|
31
|
-
"focus:ring-focus-light dark:focus:ring-focus-dark": focusMode === "alt-system",
|
|
32
|
-
"focus:ring-focus-dark dark:focus:ring-focus-light": focusMode === "system"
|
|
33
|
-
});
|
|
26
|
+
const getToggleGroupItemFocusClasses = ()=>{
|
|
27
|
+
return clsx("focus:outline-none", "focus:ring-2", "focus:ring-inset", "focus:ring-focus-dark");
|
|
34
28
|
};
|
|
35
29
|
const getToggleGroupItemActiveClasses = ()=>{
|
|
36
|
-
return clsx("data-[state=on]:bg-surface-lightest data-[state=on]:text-copy-dark dark:data-[state=on]:bg-surface-dark dark:data-[state=on]:text-copy-light");
|
|
30
|
+
return clsx("data-[state=on]:bg-surface-lightest data-[state=on]:text-copy-dark", "dark:data-[state=on]:bg-surface-dark dark:data-[state=on]:text-copy-light");
|
|
37
31
|
};
|
|
38
32
|
const getToggleGroupItemSizeClasses = ({ size })=>{
|
|
39
33
|
return clsx({
|
|
@@ -45,14 +39,12 @@ const getToggleGroupItemSizeClasses = ({ size })=>{
|
|
|
45
39
|
const getToggleGroupItemWrapperClasses = ()=>{
|
|
46
40
|
return clsx(TOGGLEGROUP_ITEM_WRAPPER_CLASSNAME, "relative", "[&>button]:rounded-none", "first:[&>button]:rounded-l-md", "last:[&>button]:rounded-r-md", "border-r border-border-medium last:border-r-0");
|
|
47
41
|
};
|
|
48
|
-
const getToggleGroupItemClasses = ({
|
|
42
|
+
const getToggleGroupItemClasses = ({ size })=>{
|
|
49
43
|
return {
|
|
50
44
|
wrapperClass: getToggleGroupItemWrapperClasses(),
|
|
51
45
|
itemClass: clsx(TOGGLEGROUP_ITEM_CLASSNAME, "flex items-center justify-center bg-transparent", "transition duration-200 ease", getToggleGroupItemSizeClasses({
|
|
52
46
|
size
|
|
53
|
-
}), getToggleGroupItemFocusClasses(
|
|
54
|
-
focusMode
|
|
55
|
-
}), getToggleGroupItemActiveClasses())
|
|
47
|
+
}), getToggleGroupItemFocusClasses(), getToggleGroupItemActiveClasses())
|
|
56
48
|
};
|
|
57
49
|
};
|
|
58
50
|
const getToggleGroupClasses = ({ className })=>{
|
|
@@ -64,13 +56,12 @@ const getToggleGroupClasses = ({ className })=>{
|
|
|
64
56
|
|
|
65
57
|
|
|
66
58
|
|
|
67
|
-
const ToggleGroup = ({ children, value, onValueChange, disabled,
|
|
59
|
+
const ToggleGroup = ({ children, value, onValueChange, disabled, size = "medium", defaultValue, className, ...otherProps })=>{
|
|
68
60
|
const toggleGroupClasses = getToggleGroupClasses({
|
|
69
61
|
className
|
|
70
62
|
});
|
|
71
63
|
const contextValue = {
|
|
72
|
-
size
|
|
73
|
-
focusMode
|
|
64
|
+
size
|
|
74
65
|
};
|
|
75
66
|
return /*#__PURE__*/ jsx(ToggleGroupContext.Provider, {
|
|
76
67
|
value: contextValue,
|
|
@@ -87,9 +78,8 @@ const ToggleGroup = ({ children, value, onValueChange, disabled, focusMode = "sy
|
|
|
87
78
|
});
|
|
88
79
|
};
|
|
89
80
|
const ToggleGroupItem = ({ value, disabled, children })=>{
|
|
90
|
-
const { size
|
|
81
|
+
const { size } = useContext(ToggleGroupContext);
|
|
91
82
|
const { itemClass, wrapperClass } = getToggleGroupItemClasses({
|
|
92
|
-
focusMode,
|
|
93
83
|
size
|
|
94
84
|
});
|
|
95
85
|
return /*#__PURE__*/ jsx("div", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-togglegroup",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"sideEffects": [
|
|
48
48
|
"**/*.css"
|
|
49
49
|
],
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "0ecf008629f4e901563d92884e0663047ea9f964"
|
|
51
51
|
}
|