@edux-design/buttons 0.0.2 → 0.0.4
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/CHANGELOG.md +15 -0
- package/README.md +110 -0
- package/dist/index.d.mts +159 -0
- package/dist/index.d.ts +159 -0
- package/dist/index.js +425 -26
- package/dist/index.mjs +429 -25
- package/package.json +6 -4
- package/src/demo/Button.stories.jsx +84 -0
- package/src/demo/ButtonGroup.stories.jsx +67 -0
- package/src/elements/Button.jsx +35 -3
- package/src/elements/ButtonGroup.jsx +387 -0
- package/src/elements/ButtonGroup.test.jsx +69 -0
- package/src/elements/ButtonGroupItem.jsx +8 -0
- package/src/elements/IconButton.jsx +104 -0
- package/src/elements/MenuButton.jsx +25 -1
- package/src/index.js +3 -0
- package/tsconfig.json +12 -0
|
@@ -3,6 +3,29 @@ import { MenuButtonContext } from "../util/MenuButtonContext";
|
|
|
3
3
|
import { cx } from "@edux-design/utils";
|
|
4
4
|
import { Chevron } from "@edux-design/icons";
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Props for the MenuButton component.
|
|
8
|
+
*
|
|
9
|
+
* @typedef {Object} MenuButtonProps
|
|
10
|
+
* @property {React.ReactNode} [children] - Content to display inside the button (usually label or icon).
|
|
11
|
+
* @property {"small"|"medium"} [size="medium"] - Size variant controlling button height.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* MenuButton component.
|
|
16
|
+
*
|
|
17
|
+
* Provides a styled menu trigger button with optional sizing.
|
|
18
|
+
* It uses a `MenuButtonContext` provider to share internal state
|
|
19
|
+
* with child menu items.
|
|
20
|
+
*
|
|
21
|
+
* @component
|
|
22
|
+
* @type {React.FC<MenuButtonProps>}
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```jsx
|
|
26
|
+
* <MenuButton size="small">Options</MenuButton>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
6
29
|
export function MenuButton({ children, size }) {
|
|
7
30
|
const SPLIT_BUTTON_STYLES = cx(
|
|
8
31
|
"w-[36px] border-l-[1px] border-l-black flex flex-row justify-center items-center",
|
|
@@ -11,9 +34,10 @@ export function MenuButton({ children, size }) {
|
|
|
11
34
|
"h-[40px] py-2": size === "medium" || size === undefined,
|
|
12
35
|
}
|
|
13
36
|
);
|
|
37
|
+
|
|
14
38
|
return (
|
|
15
39
|
<MenuButtonContext.Provider value>
|
|
16
|
-
<div>{children}</div>
|
|
40
|
+
<div className={SPLIT_BUTTON_STYLES}>{children}</div>
|
|
17
41
|
<Chevron />
|
|
18
42
|
</MenuButtonContext.Provider>
|
|
19
43
|
);
|
package/src/index.js
CHANGED