@edux-design/buttons 0.1.3 → 0.2.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.
@@ -0,0 +1,244 @@
1
+ import * as react from 'react';
2
+
3
+ /**
4
+ * Props for the IconButton component.
5
+ *
6
+ * Extends all native HTML `<button>` attributes and accepts an icon prop.
7
+ * Designed for circular icon-only buttons that follow the same
8
+ * design-system patterns as the regular Button.
9
+ *
10
+ * Provide an accessible name with `aria-label` or `aria-labelledby`.
11
+ *
12
+ * @typedef {React.ButtonHTMLAttributes<HTMLButtonElement> & {
13
+ * icon: React.ReactNode,
14
+ * size?: "small"|"medium"|"large",
15
+ * isSecondary?: boolean,
16
+ * isDanger?: boolean,
17
+ * isBare?: boolean,
18
+ * disabled?: boolean,
19
+ * className?: string
20
+ * }} IconButtonProps
21
+ */
22
+ /**
23
+ * IconButton component.
24
+ *
25
+ * Provides a circular button used for icon-only actions, matching
26
+ * the design-system variants and states of the main Button component.
27
+ *
28
+ * @component
29
+ * @type {React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>}
30
+ *
31
+ * @example
32
+ * ```jsx
33
+ * <IconButton icon={<XIcon />} aria-label="Close" />
34
+ * <IconButton icon={<EditIcon />} isSecondary aria-label="Edit" />
35
+ * <IconButton icon={<TrashIcon />} isDanger disabled aria-label="Delete" />
36
+ * ```
37
+ */
38
+ declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
39
+ /**
40
+ * Props for the IconButton component.
41
+ *
42
+ * Extends all native HTML `<button>` attributes and accepts an icon prop.
43
+ * Designed for circular icon-only buttons that follow the same
44
+ * design-system patterns as the regular Button.
45
+ *
46
+ * Provide an accessible name with `aria-label` or `aria-labelledby`.
47
+ */
48
+ type IconButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
49
+ icon: React.ReactNode;
50
+ size?: "small" | "medium" | "large";
51
+ isSecondary?: boolean;
52
+ isDanger?: boolean;
53
+ isBare?: boolean;
54
+ disabled?: boolean;
55
+ className?: string;
56
+ };
57
+
58
+ /**
59
+ * Props for the Button component.
60
+ *
61
+ * Extends all native HTML `<button>` attributes, while adding
62
+ * design-system variants and state controls.
63
+ *
64
+ * @typedef {React.ButtonHTMLAttributes<HTMLButtonElement> & {
65
+ * children?: React.ReactNode,
66
+ * startIcon?: React.ReactNode,
67
+ * endIcon?: React.ReactNode,
68
+ * size?: "small"|"medium"|"large",
69
+ * isSecondary?: boolean,
70
+ * isDanger?: boolean,
71
+ * isBare?: boolean,
72
+ * isStretched?: boolean,
73
+ * disabled?: boolean,
74
+ * className?: string
75
+ * }} ButtonProps
76
+ */
77
+ /**
78
+ * Button component.
79
+ *
80
+ * Provides design-system styled button with support for
81
+ * multiple visual variants, sizing, and states.
82
+ *
83
+ * @component
84
+ * @type {React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>}
85
+ *
86
+ * @example
87
+ * ```jsx
88
+ * <Button size="small">Save</Button>
89
+ * <Button isSecondary>Cancel</Button>
90
+ * <Button isDanger disabled>Delete</Button>
91
+ * ```
92
+ */
93
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
94
+ /**
95
+ * Props for the Button component.
96
+ *
97
+ * Extends all native HTML `<button>` attributes, while adding
98
+ * design-system variants and state controls.
99
+ */
100
+ type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
101
+ children?: React.ReactNode;
102
+ startIcon?: React.ReactNode;
103
+ endIcon?: React.ReactNode;
104
+ size?: "small" | "medium" | "large";
105
+ isSecondary?: boolean;
106
+ isDanger?: boolean;
107
+ isBare?: boolean;
108
+ isStretched?: boolean;
109
+ disabled?: boolean;
110
+ className?: string;
111
+ };
112
+
113
+ /**
114
+ * Props for the MenuButton component.
115
+ *
116
+ * @typedef {React.ButtonHTMLAttributes<HTMLButtonElement> & {
117
+ * children?: React.ReactNode,
118
+ * caret?: React.ReactNode,
119
+ * size?: "small"|"medium",
120
+ * className?: string,
121
+ * }} MenuButtonProps
122
+ */
123
+ /**
124
+ * MenuButton component.
125
+ *
126
+ * Provides a styled button intended for menu triggers.
127
+ * Consumers should pass `aria-expanded`, `aria-controls`, and any
128
+ * custom labeling they need. `aria-haspopup="menu"` is applied by default.
129
+ *
130
+ * @component
131
+ * @type {React.ForwardRefExoticComponent<MenuButtonProps & React.RefAttributes<HTMLButtonElement>>}
132
+ *
133
+ * @example
134
+ * ```jsx
135
+ * <MenuButton aria-expanded={open} onClick={() => setOpen((prev) => !prev)}>
136
+ * Options
137
+ * </MenuButton>
138
+ * ```
139
+ */
140
+ declare const MenuButton: React.ForwardRefExoticComponent<MenuButtonProps & React.RefAttributes<HTMLButtonElement>>;
141
+ /**
142
+ * Props for the MenuButton component.
143
+ */
144
+ type MenuButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
145
+ children?: React.ReactNode;
146
+ caret?: React.ReactNode;
147
+ size?: "small" | "medium";
148
+ className?: string;
149
+ };
150
+
151
+ /**
152
+ * @typedef {Object} ButtonGroupOption
153
+ * @property {React.ReactNode} [label] - Main label for the option.
154
+ * @property {React.ReactNode} [startAdornment] - Optional leading element (icon, badge, etc.).
155
+ * @property {React.ReactNode} [endIcon] - Optional trailing element (legacy alias).
156
+ * @property {React.ReactNode} [endAdornment] - Optional trailing element.
157
+ * @property {string|number} [value] - Unique value used for selection.
158
+ * @property {boolean} [disabled] - Whether the option is disabled.
159
+ */
160
+ /**
161
+ * Segmented button group with animated active state.
162
+ *
163
+ * @typedef {React.HTMLAttributes<HTMLDivElement> & {
164
+ * value?: string|number,
165
+ * defaultValue?: string|number,
166
+ * onChange?: (value: string|number, option: ButtonGroupOption) => void,
167
+ * size?: "small"|"medium"|"large",
168
+ * isStretched?: boolean,
169
+ * }} ButtonGroupProps
170
+ */
171
+ declare const ButtonGroup: react.ForwardRefExoticComponent<react.RefAttributes<any>>;
172
+
173
+ declare function ButtonGroupItem(_props: any): any;
174
+ declare namespace ButtonGroupItem {
175
+ let displayName: string;
176
+ }
177
+
178
+ /**
179
+ * ButtonCounter (stepper) component.
180
+ *
181
+ * Renders decrement/increment buttons with a central value display.
182
+ * Supports the same size + variant flags as the main Button.
183
+ *
184
+ * @typedef {React.HTMLAttributes<HTMLDivElement> & {
185
+ * value?: number,
186
+ * defaultValue?: number,
187
+ * onChange?: (value: number) => void,
188
+ * min?: number,
189
+ * max?: number,
190
+ * step?: number,
191
+ * children?: React.ReactNode,
192
+ * size?: "small"|"medium"|"large",
193
+ * isSecondary?: boolean,
194
+ * isDanger?: boolean,
195
+ * isBare?: boolean,
196
+ * isStretched?: boolean,
197
+ * disabled?: boolean,
198
+ * isEditable?: boolean,
199
+ * inputProps?: Omit<React.InputHTMLAttributes<HTMLInputElement>, "value"|"defaultValue"|"onChange"|"type">,
200
+ * decrementIcon?: React.ReactNode,
201
+ * incrementIcon?: React.ReactNode,
202
+ * startIcon?: React.ReactNode,
203
+ * endIcon?: React.ReactNode,
204
+ * decrementButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>,
205
+ * incrementButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>,
206
+ * className?: string,
207
+ * }} ButtonCounterProps
208
+ */
209
+ /**
210
+ * @type {React.ForwardRefExoticComponent<ButtonCounterProps & React.RefAttributes<HTMLDivElement>>}
211
+ */
212
+ declare const ButtonCounter: React.ForwardRefExoticComponent<ButtonCounterProps & React.RefAttributes<HTMLDivElement>>;
213
+ /**
214
+ * ButtonCounter (stepper) component.
215
+ *
216
+ * Renders decrement/increment buttons with a central value display.
217
+ * Supports the same size + variant flags as the main Button.
218
+ */
219
+ type ButtonCounterProps = React.HTMLAttributes<HTMLDivElement> & {
220
+ value?: number;
221
+ defaultValue?: number;
222
+ onChange?: (value: number) => void;
223
+ min?: number;
224
+ max?: number;
225
+ step?: number;
226
+ children?: React.ReactNode;
227
+ size?: "small" | "medium" | "large";
228
+ isSecondary?: boolean;
229
+ isDanger?: boolean;
230
+ isBare?: boolean;
231
+ isStretched?: boolean;
232
+ disabled?: boolean;
233
+ isEditable?: boolean;
234
+ inputProps?: Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "defaultValue" | "onChange" | "type">;
235
+ decrementIcon?: React.ReactNode;
236
+ incrementIcon?: React.ReactNode;
237
+ startIcon?: React.ReactNode;
238
+ endIcon?: React.ReactNode;
239
+ decrementButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;
240
+ incrementButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;
241
+ className?: string;
242
+ };
243
+
244
+ export { Button, ButtonCounter, ButtonGroup, ButtonGroupItem, IconButton, MenuButton };