@versini/ui-button 13.0.0 → 14.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.
- package/README.md +46 -1
- package/dist/{188.js → 277.js} +3 -6
- package/dist/370.js +5 -3
- package/dist/726.js +9 -0
- package/dist/795.js +3 -4
- package/dist/946.js +7 -0
- package/dist/components/Button/Button.js +3 -2
- package/dist/components/Button/ButtonCopy.js +3 -3
- package/dist/components/Button/ButtonGroup.d.ts +2 -0
- package/dist/components/Button/ButtonGroup.js +62 -0
- package/dist/components/Button/ButtonGroupUtilities.d.ts +6 -0
- package/dist/components/Button/ButtonIcon.js +1 -1
- package/dist/components/Button/ButtonLink.js +3 -2
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ The Button package provides a complete set of button components including standa
|
|
|
16
16
|
|
|
17
17
|
## Features
|
|
18
18
|
|
|
19
|
-
- **🎯 Multiple Button Types**: Button, ButtonIcon, ButtonLink, ButtonCopy
|
|
19
|
+
- **🎯 Multiple Button Types**: Button, ButtonIcon, ButtonLink, ButtonCopy, ButtonGroup
|
|
20
20
|
- **♿ Accessible**: WCAG compliant with proper ARIA support and keyboard navigation
|
|
21
21
|
- **🎨 Customizable**: Multiple variants, sizes, and styling options
|
|
22
22
|
- **🌲 Tree-shakeable**: Import only the components you need
|
|
@@ -89,6 +89,39 @@ function App() {
|
|
|
89
89
|
}
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
+
### Button Group
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
import { Button } from "@versini/ui-button/button";
|
|
96
|
+
import { ButtonGroup } from "@versini/ui-button/button-group";
|
|
97
|
+
|
|
98
|
+
function App() {
|
|
99
|
+
return (
|
|
100
|
+
<ButtonGroup gap="medium">
|
|
101
|
+
<Button>OK</Button>
|
|
102
|
+
<Button>Cancel and go back</Button>
|
|
103
|
+
</ButtonGroup>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Vertical Button Group
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
import { Button } from "@versini/ui-button/button";
|
|
112
|
+
import { ButtonGroup } from "@versini/ui-button/button-group";
|
|
113
|
+
|
|
114
|
+
function App() {
|
|
115
|
+
return (
|
|
116
|
+
<ButtonGroup orientation="vertical">
|
|
117
|
+
<Button>Save changes</Button>
|
|
118
|
+
<Button variant="secondary">Cancel</Button>
|
|
119
|
+
<Button variant="danger">Delete account</Button>
|
|
120
|
+
</ButtonGroup>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
92
125
|
### Different Variants
|
|
93
126
|
|
|
94
127
|
```tsx
|
|
@@ -216,3 +249,15 @@ _Inherits all Button props_
|
|
|
216
249
|
| copyToClipboard | `string \| (() => string)` | - | What text to copy to the clipboard |
|
|
217
250
|
|
|
218
251
|
_Inherits all ButtonIcon props except children, align, label, fullWidth, size_
|
|
252
|
+
|
|
253
|
+
### ButtonGroup Props
|
|
254
|
+
|
|
255
|
+
| Prop | Type | Default | Description |
|
|
256
|
+
| ----------- | ---------------------------------- | -------------- | -------------------------------------------------- |
|
|
257
|
+
| children | `React.ReactNode` | - | The buttons to render in the group |
|
|
258
|
+
| gap | `"small" \| "medium" \| "large"` | `"medium"` | The spacing between buttons in the group |
|
|
259
|
+
| orientation | `"horizontal" \| "vertical"` | `"horizontal"` | The layout direction of the button group |
|
|
260
|
+
| className | `string` | - | CSS class(es) to add to the main component wrapper |
|
|
261
|
+
| aria-label | `string` | - | Accessible label for the button group |
|
|
262
|
+
|
|
263
|
+
_Renders with `role="group"`. All buttons share equal width via CSS Grid._
|
package/dist/{188.js → 277.js}
RENAMED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-button
|
|
2
|
+
@versini/ui-button v14.0.0
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import clsx from "
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import { clsx } from "./726.js";
|
|
9
7
|
|
|
10
8
|
const BUTTON_CLASSNAME = "av-button";
|
|
11
9
|
|
|
@@ -452,5 +450,4 @@ const getButtonClasses = ({ type, className, raw, mode, disabled, fullWidth, siz
|
|
|
452
450
|
}), className);
|
|
453
451
|
};
|
|
454
452
|
|
|
455
|
-
export { TYPE_BUTTON, TYPE_ICON, TYPE_LINK,
|
|
456
|
-
export { jsx, jsxs } from "react/jsx-runtime";
|
|
453
|
+
export { TYPE_BUTTON, TYPE_ICON, TYPE_LINK, getBadgeClasses, getButtonClasses, getButtonIconLabelClasses, getIconClasses };
|
package/dist/370.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-button
|
|
2
|
+
@versini/ui-button v14.0.0
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { useMergeRefs } from "@versini/ui-hooks/use-merge-refs";
|
|
7
7
|
import { useResizeObserver } from "@versini/ui-hooks/use-resize-observer";
|
|
8
|
-
import { jsxs,
|
|
9
|
-
import {
|
|
8
|
+
import { jsxs, jsx } from "./726.js";
|
|
9
|
+
import { useRef, useLayoutEffect, useEffect } from "./946.js";
|
|
10
|
+
import { getButtonClasses, getIconClasses, getButtonIconLabelClasses, TYPE_ICON, getBadgeClasses } from "./277.js";
|
|
11
|
+
import { BaseButton_private } from "./795.js";
|
|
10
12
|
|
|
11
13
|
|
|
12
14
|
|
package/dist/726.js
ADDED
package/dist/795.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-button
|
|
2
|
+
@versini/ui-button v14.0.0
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { jsx } from "./
|
|
7
|
-
|
|
6
|
+
import { jsx } from "./726.js";
|
|
7
|
+
import "./946.js";
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -40,4 +40,3 @@ import { jsx } from "./188.js";
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export { BaseButton_private };
|
|
43
|
-
export { useEffect, useLayoutEffect, useRef, useState } from "react";
|
package/dist/946.js
ADDED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-button
|
|
2
|
+
@versini/ui-button v14.0.0
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { jsx } from "../../726.js";
|
|
7
|
+
import { getButtonClasses, TYPE_BUTTON } from "../../277.js";
|
|
7
8
|
import { BaseButton_private } from "../../795.js";
|
|
8
9
|
|
|
9
10
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-button
|
|
2
|
+
@versini/ui-button v14.0.0
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { IconCopied, IconCopy } from "@versini/ui-icons";
|
|
7
|
-
import { jsx } from "../../
|
|
8
|
-
import { useState, useEffect } from "../../
|
|
7
|
+
import { jsx } from "../../726.js";
|
|
8
|
+
import { useState, useEffect } from "../../946.js";
|
|
9
9
|
import { ButtonIcon } from "../../370.js";
|
|
10
10
|
|
|
11
11
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
@versini/ui-button v14.0.0
|
|
3
|
+
© 2026 gizmette.com
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { clsx, jsx } from "../../726.js";
|
|
7
|
+
import { react } from "../../946.js";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const getButtonGroupClasses = ({ gap = "medium", className })=>{
|
|
11
|
+
return clsx("grid", {
|
|
12
|
+
"gap-1": gap === "small",
|
|
13
|
+
"gap-2": gap === "medium",
|
|
14
|
+
"gap-4": gap === "large"
|
|
15
|
+
}, className);
|
|
16
|
+
};
|
|
17
|
+
const getButtonGroupStyle = ({ orientation = "horizontal", childCount })=>{
|
|
18
|
+
if (orientation === "vertical") {
|
|
19
|
+
return {
|
|
20
|
+
gridTemplateColumns: "1fr"
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
gridTemplateColumns: `repeat(${childCount}, minmax(0, 1fr))`
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
const getValidChildCount = (children)=>{
|
|
32
|
+
const flattened = react.Children.toArray(children);
|
|
33
|
+
let count = 0;
|
|
34
|
+
for (const child of flattened){
|
|
35
|
+
if (/*#__PURE__*/ react.isValidElement(child) && child.type === react.Fragment) {
|
|
36
|
+
count += getValidChildCount(child.props.children);
|
|
37
|
+
} else {
|
|
38
|
+
count += 1;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return count;
|
|
42
|
+
};
|
|
43
|
+
function ButtonGroup({ children, gap = "medium", orientation = "horizontal", className, ...otherProps }) {
|
|
44
|
+
const childCount = getValidChildCount(children);
|
|
45
|
+
const groupClass = getButtonGroupClasses({
|
|
46
|
+
gap,
|
|
47
|
+
className
|
|
48
|
+
});
|
|
49
|
+
const groupStyle = getButtonGroupStyle({
|
|
50
|
+
orientation,
|
|
51
|
+
childCount
|
|
52
|
+
});
|
|
53
|
+
return /*#__PURE__*/ jsx("div", {
|
|
54
|
+
role: "group",
|
|
55
|
+
className: groupClass,
|
|
56
|
+
style: groupStyle,
|
|
57
|
+
...otherProps,
|
|
58
|
+
children: children
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { ButtonGroup };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ButtonGroupTypes } from "@versini/ui-types";
|
|
2
|
+
export declare const getButtonGroupClasses: ({ gap, className, }: Pick<ButtonGroupTypes.Props, "gap" | "className">) => string;
|
|
3
|
+
export declare const getButtonGroupStyle: ({ orientation, childCount, }: {
|
|
4
|
+
orientation?: ButtonGroupTypes.Props["orientation"];
|
|
5
|
+
childCount: number;
|
|
6
|
+
}) => React.CSSProperties;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-button
|
|
2
|
+
@versini/ui-button v14.0.0
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { jsxs,
|
|
6
|
+
import { jsxs, clsx, jsx } from "../../726.js";
|
|
7
|
+
import { getButtonClasses, TYPE_LINK } from "../../277.js";
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-button",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -25,6 +25,10 @@
|
|
|
25
25
|
"types": "./dist/components/Button/ButtonIcon.d.ts",
|
|
26
26
|
"import": "./dist/components/Button/ButtonIcon.js"
|
|
27
27
|
},
|
|
28
|
+
"./button-group": {
|
|
29
|
+
"types": "./dist/components/Button/ButtonGroup.d.ts",
|
|
30
|
+
"import": "./dist/components/Button/ButtonGroup.js"
|
|
31
|
+
},
|
|
28
32
|
"./button-link": {
|
|
29
33
|
"types": "./dist/components/Button/ButtonLink.d.ts",
|
|
30
34
|
"import": "./dist/components/Button/ButtonLink.js"
|
|
@@ -59,7 +63,7 @@
|
|
|
59
63
|
},
|
|
60
64
|
"devDependencies": {
|
|
61
65
|
"@testing-library/jest-dom": "6.9.1",
|
|
62
|
-
"@versini/ui-types": "9.
|
|
66
|
+
"@versini/ui-types": "9.1.0"
|
|
63
67
|
},
|
|
64
68
|
"dependencies": {
|
|
65
69
|
"@versini/ui-hooks": "6.1.1",
|
|
@@ -70,5 +74,5 @@
|
|
|
70
74
|
"sideEffects": [
|
|
71
75
|
"**/*.css"
|
|
72
76
|
],
|
|
73
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "0f7cad25854a6216ada805a75f32a3aa1ccc1464"
|
|
74
78
|
}
|