@versini/ui-togglegroup 7.0.2 → 8.0.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.
@@ -3,7 +3,7 @@ import type * as ToggleGroupRadix from '@radix-ui/react-toggle-group';
3
3
 
4
4
  declare type Size = "small" | "medium" | "large";
5
5
 
6
- export declare const ToggleGroup: ({ children, value, onValueChange, disabled, size, defaultValue, className, splitBackground, }: ToggleGroupProps) => JSX.Element;
6
+ export declare const ToggleGroup: ({ children, value, onValueChange, disabled, size, defaultValue, className, flat, }: ToggleGroupProps) => JSX.Element;
7
7
 
8
8
  export declare const TOGGLEGROUP_CLASSNAME = "av-togglegroup";
9
9
 
@@ -45,11 +45,11 @@ declare type ToggleGroupProps = {
45
45
  */
46
46
  className?: string;
47
47
  /**
48
- * Whether or not to render the active item with a split background
49
- * gradient overlay (aqua-style).
48
+ * Whether to render the ToggleGroup with a flat solid background
49
+ * instead of the default Aqua-style gradient overlay.
50
50
  * @default false
51
51
  */
52
- splitBackground?: boolean;
52
+ flat?: boolean;
53
53
  };
54
54
 
55
55
  export { }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-togglegroup v7.0.2
2
+ @versini/ui-togglegroup v8.0.0
3
3
  © 2026 gizmette.com
4
4
  */
5
5
 
@@ -18,7 +18,7 @@ const TOGGLEGROUP_ITEM_CLASSNAME = "av-togglegroup-item";
18
18
 
19
19
  const ToggleGroupContext = react.createContext({
20
20
  size: "medium",
21
- splitBackground: false
21
+ flat: false
22
22
  });
23
23
 
24
24
 
@@ -27,12 +27,8 @@ const ToggleGroupContext = react.createContext({
27
27
  const getToggleGroupItemFocusClasses = ()=>{
28
28
  return clsx("focus:outline-none", "focus:ring-2", "focus:ring-inset", "focus:ring-focus-dark");
29
29
  };
30
- // Aqua-style split background overlay:
31
- // - Top half: flat white overlay (light, uniform)
32
- // - Bottom half: starts darker, gradually lightens toward the bottom edge
33
- const BG_SPLIT_OVERLAY = "bg-[linear-gradient(to_bottom,oklch(1_0_0/0.2)_50%,oklch(0_0_0/0.1)_50%,oklch(1_0_0/0.05)_100%)]";
34
- const getToggleGroupItemActiveClasses = ({ splitBackground })=>{
35
- 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", splitBackground && BG_SPLIT_OVERLAY);
30
+ const getToggleGroupItemActiveClasses = ({ flat })=>{
31
+ 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", !flat && "av-bg-split-overlay");
36
32
  };
37
33
  const getToggleGroupItemSizeClasses = ({ size })=>{
38
34
  return clsx({
@@ -51,13 +47,13 @@ const getToggleGroupSizeClasses = ({ size })=>{
51
47
  const getToggleGroupItemWrapperClasses = ()=>{
52
48
  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");
53
49
  };
54
- const getToggleGroupItemClasses = ({ size, splitBackground })=>{
50
+ const getToggleGroupItemClasses = ({ size, flat })=>{
55
51
  return {
56
52
  wrapperClass: getToggleGroupItemWrapperClasses(),
57
53
  itemClass: clsx(TOGGLEGROUP_ITEM_CLASSNAME, "text-sm cursor-pointer", "flex items-center justify-center bg-transparent", "transition duration-200 ease", getToggleGroupItemSizeClasses({
58
54
  size
59
55
  }), getToggleGroupItemFocusClasses(), getToggleGroupItemActiveClasses({
60
- splitBackground
56
+ flat
61
57
  }))
62
58
  };
63
59
  };
@@ -72,14 +68,14 @@ const getToggleGroupClasses = ({ className, size })=>{
72
68
 
73
69
 
74
70
 
75
- const ToggleGroup = ({ children, value, onValueChange, disabled, size = "medium", defaultValue, className, splitBackground = false })=>{
71
+ const ToggleGroup = ({ children, value, onValueChange, disabled, size = "medium", defaultValue, className, flat = false })=>{
76
72
  const toggleGroupClasses = getToggleGroupClasses({
77
73
  className,
78
74
  size
79
75
  });
80
76
  const contextValue = {
81
77
  size,
82
- splitBackground
78
+ flat
83
79
  };
84
80
  return /*#__PURE__*/ jsx(ToggleGroupContext.Provider, {
85
81
  value: contextValue,
@@ -95,10 +91,10 @@ const ToggleGroup = ({ children, value, onValueChange, disabled, size = "medium"
95
91
  });
96
92
  };
97
93
  const ToggleGroupItem = ({ value, disabled, children })=>{
98
- const { size, splitBackground } = useContext(ToggleGroupContext);
94
+ const { size, flat } = useContext(ToggleGroupContext);
99
95
  const { itemClass, wrapperClass } = getToggleGroupItemClasses({
100
96
  size,
101
- splitBackground
97
+ flat
102
98
  });
103
99
  return /*#__PURE__*/ jsx("div", {
104
100
  className: wrapperClass,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/ui-togglegroup",
3
- "version": "7.0.2",
3
+ "version": "8.0.0",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "publishConfig": {
@@ -34,10 +34,14 @@
34
34
  "test:coverage:ui": "vitest --coverage --ui",
35
35
  "test:coverage": "vitest run --coverage",
36
36
  "test:watch": "vitest",
37
- "test": "vitest run"
37
+ "test": "vitest run",
38
+ "test:visual": "playwright test -c playwright-ct.config.ts",
39
+ "test:visual:report": "playwright show-report playwright-report",
40
+ "test:visual:update": "playwright test -c playwright-ct.config.ts --update-snapshots",
41
+ "test:visual:ui": "playwright test -c playwright-ct.config.ts --ui"
38
42
  },
39
43
  "devDependencies": {
40
- "@versini/ui-types": "9.1.0"
44
+ "@versini/ui-types": "10.0.0"
41
45
  },
42
46
  "dependencies": {
43
47
  "@radix-ui/react-toggle-group": "1.1.11",
@@ -47,5 +51,5 @@
47
51
  "sideEffects": [
48
52
  "**/*.css"
49
53
  ],
50
- "gitHead": "7cec17f37e7c539ba81294ec754563b4e5733ce8"
54
+ "gitHead": "0c985a7fdf2ab23b36c43b42663d9625d0ccb4c5"
51
55
  }