@edux-design/buttons 0.0.3 → 0.0.5

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @edux-design/buttons
2
2
 
3
+ ## 0.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Added cursor style
8
+
9
+ ## 0.0.4
10
+
11
+ ### Patch Changes
12
+
13
+ - b9d0d32: Added documentation
14
+ - Updated dependencies [b9d0d32]
15
+ - Updated dependencies
16
+ - @edux-design/utils@0.0.3
17
+
3
18
  ## 0.0.3
4
19
 
5
20
  ### Patch Changes
package/README.md ADDED
@@ -0,0 +1,110 @@
1
+ # @edux-design/buttons
2
+
3
+ Headless-ish button primitives wired to the Edux design tokens. The package ships four components:
4
+
5
+ - `Button` – primary action button with size + variant helpers.
6
+ - `IconButton` – circular/square icon surface that reuses the same states.
7
+ - `MenuButton` – trigger wrapper that pairs nicely with popovers/menus.
8
+ - `ButtonGroup` – segmented control with a sliding active state meant for contextual filters.
9
+
10
+ Everything is built with Tailwind utilities via the shared `cx` helper so styling stays consistent with the rest of the system.
11
+
12
+ ---
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ pnpm add @edux-design/buttons @edux-design/utils
18
+ # or
19
+ npm install @edux-design/buttons @edux-design/utils
20
+ ```
21
+
22
+ Peer deps: `react@^19.1.0`, `react-dom@^19.1.0`.
23
+
24
+ ---
25
+
26
+ ## Usage
27
+
28
+ ```jsx
29
+ import { Button, IconButton, MenuButton } from "@edux-design/buttons";
30
+ import { Close, Chevron } from "@edux-design/icons";
31
+
32
+ export function Actions() {
33
+ return (
34
+ <div className="flex gap-4">
35
+ <Button size="small">Save</Button>
36
+ <Button isSecondary isStretched>
37
+ Cancel
38
+ </Button>
39
+ <Button isDanger disabled>
40
+ Delete
41
+ </Button>
42
+ <IconButton icon={<Close />} aria-label="Close dialog" />
43
+ <MenuButton caret={<Chevron />} onClick={() => null}>
44
+ Options
45
+ </MenuButton>
46
+ </div>
47
+ );
48
+ }
49
+ ```
50
+
51
+ ### ButtonGroup
52
+
53
+ ```jsx
54
+ import React from "react";
55
+ import { ButtonGroup } from "@edux-design/buttons";
56
+ import { Warning } from "@edux-design/icons";
57
+
58
+ export function SegmentedFilter() {
59
+ const [value, setValue] = React.useState("inbox");
60
+
61
+ return (
62
+ <ButtonGroup
63
+ value={value}
64
+ onChange={(nextValue) => setValue(nextValue)}
65
+ options={[
66
+ { value: "inbox", label: "Label (11)" },
67
+ { value: "drafts", label: "Label (11)" },
68
+ {
69
+ value: "alerts",
70
+ label: "Label",
71
+ endAdornment: <Warning className="h-4 w-4 text-warning-600" />,
72
+ },
73
+ ]}
74
+ />
75
+ );
76
+ }
77
+ ```
78
+
79
+ Provide `options` as strings or objects (`{ value, label, startAdornment, endAdornment, disabled }`). The active pill animates over the newly selected option and the group behaves like an accessible radiogroup (arrow keys + home/end). Use `isStretched` when the control should fill the parent width.
80
+
81
+ ### Key props
82
+
83
+ | Component | Important props |
84
+ | ------------- | --------------- |
85
+ | `Button` | `size="small"|"medium"|"large"`, `isSecondary`, `isDanger`, `isBare`, `isStretched`, `disabled` |
86
+ | `IconButton` | `icon`, `size`, `isBare`, `isDanger`, `disabled` |
87
+ | `MenuButton` | Accepts all `Button` props plus caret slot and ARIA attributes for menu triggers |
88
+ | `ButtonGroup` | `options`, `value` / `defaultValue`, `onChange`, `size`, `isStretched`, per-option `startAdornment` / `endAdornment`, `disabled` |
89
+
90
+ Buttons warn in development if you pass conflicting variant booleans so you know which style wins.
91
+
92
+ ---
93
+
94
+ ## Development
95
+
96
+ ```bash
97
+ pnpm --filter @edux-design/buttons lint
98
+ pnpm --filter @edux-design/buttons check-types
99
+ pnpm --filter @edux-design/buttons build
100
+ ```
101
+
102
+ Stories live under `src/demo` (e.g. `Button.stories.jsx`, `ButtonGroup.stories.jsx`) for quick visual verification.
103
+
104
+ ---
105
+
106
+ ## Notes
107
+
108
+ - Variants map directly to the design tokens defined in `@edux-design/tokens`.
109
+ - Hover/focus styles are already applied; avoid overriding unless you have a matching token.
110
+ - If you need new variants (ghost, link, destructive-secondary, etc.), add them in `Button.jsx` and update the stories + README accordingly.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
2
3
 
3
4
  /**
4
5
  * Props for the IconButton component.
@@ -129,4 +130,30 @@ declare function MenuButton({ children, size }: {
129
130
  size: any;
130
131
  }): react_jsx_runtime.JSX.Element;
131
132
 
132
- export { Button, IconButton, MenuButton };
133
+ /**
134
+ * @typedef {Object} ButtonGroupOption
135
+ * @property {React.ReactNode} [label] - Main label for the option.
136
+ * @property {React.ReactNode} [startAdornment] - Optional leading element (icon, badge, etc.).
137
+ * @property {React.ReactNode} [endIcon] - Optional trailing element.
138
+ * @property {string|number} [value] - Unique value used for selection.
139
+ * @property {boolean} [disabled] - Whether the option is disabled.
140
+ */
141
+ /**
142
+ * Segmented button group with animated active state.
143
+ *
144
+ * @typedef {React.HTMLAttributes<HTMLDivElement> & {
145
+ * value?: string|number,
146
+ * defaultValue?: string|number,
147
+ * onChange?: (value: string|number, option: ButtonGroupOption) => void,
148
+ * size?: "small"|"medium"|"large",
149
+ * isStretched?: boolean,
150
+ * }} ButtonGroupProps
151
+ */
152
+ declare const ButtonGroup: react.ForwardRefExoticComponent<react.RefAttributes<any>>;
153
+
154
+ declare function ButtonGroupItem(_props: any): any;
155
+ declare namespace ButtonGroupItem {
156
+ let displayName: string;
157
+ }
158
+
159
+ export { Button, ButtonGroup, ButtonGroupItem, IconButton, MenuButton };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
2
3
 
3
4
  /**
4
5
  * Props for the IconButton component.
@@ -129,4 +130,30 @@ declare function MenuButton({ children, size }: {
129
130
  size: any;
130
131
  }): react_jsx_runtime.JSX.Element;
131
132
 
132
- export { Button, IconButton, MenuButton };
133
+ /**
134
+ * @typedef {Object} ButtonGroupOption
135
+ * @property {React.ReactNode} [label] - Main label for the option.
136
+ * @property {React.ReactNode} [startAdornment] - Optional leading element (icon, badge, etc.).
137
+ * @property {React.ReactNode} [endIcon] - Optional trailing element.
138
+ * @property {string|number} [value] - Unique value used for selection.
139
+ * @property {boolean} [disabled] - Whether the option is disabled.
140
+ */
141
+ /**
142
+ * Segmented button group with animated active state.
143
+ *
144
+ * @typedef {React.HTMLAttributes<HTMLDivElement> & {
145
+ * value?: string|number,
146
+ * defaultValue?: string|number,
147
+ * onChange?: (value: string|number, option: ButtonGroupOption) => void,
148
+ * size?: "small"|"medium"|"large",
149
+ * isStretched?: boolean,
150
+ * }} ButtonGroupProps
151
+ */
152
+ declare const ButtonGroup: react.ForwardRefExoticComponent<react.RefAttributes<any>>;
153
+
154
+ declare function ButtonGroupItem(_props: any): any;
155
+ declare namespace ButtonGroupItem {
156
+ let displayName: string;
157
+ }
158
+
159
+ export { Button, ButtonGroup, ButtonGroupItem, IconButton, MenuButton };