@edux-design/buttons 0.2.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @edux-design/buttons
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add toolbar controls, toggles, groups and separators with native attributes, labelled keyboard navigation and compact semantic control sizing.
8
+
9
+ Correct primary Button, IconButton and ButtonCounter foregrounds in dark mode using the existing inverse foreground token; geometry and danger colours are unchanged.
10
+
11
+ Retain native ButtonGroup props, refs and typed selection callbacks in generated declarations.
12
+
3
13
  ## 0.2.0
4
14
 
5
15
  ### Minor Changes
package/README.md CHANGED
@@ -120,3 +120,7 @@ pnpm --filter @edux-design/buttons build
120
120
  ```
121
121
 
122
122
  Stories live under `src/demo` (for example `Button.stories.jsx` and `ButtonGroup.stories.jsx`) for quick visual verification.
123
+
124
+ ## Additional components
125
+
126
+ [Toolbar controls](./docs/toolbar.md).
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import * as react from 'react';
1
+ import React from 'react';
2
2
 
3
3
  /**
4
4
  * Props for the IconButton component.
@@ -160,7 +160,7 @@ type MenuButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
160
160
  /**
161
161
  * Segmented button group with animated active state.
162
162
  *
163
- * @typedef {React.HTMLAttributes<HTMLDivElement> & {
163
+ * @typedef {Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"|"defaultValue"> & {
164
164
  * value?: string|number,
165
165
  * defaultValue?: string|number,
166
166
  * onChange?: (value: string|number, option: ButtonGroupOption) => void,
@@ -168,7 +168,44 @@ type MenuButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
168
168
  * isStretched?: boolean,
169
169
  * }} ButtonGroupProps
170
170
  */
171
- declare const ButtonGroup: react.ForwardRefExoticComponent<react.RefAttributes<any>>;
171
+ /** @type {React.ForwardRefExoticComponent<ButtonGroupProps & React.RefAttributes<HTMLDivElement>>} */
172
+ declare const ButtonGroup: React.ForwardRefExoticComponent<ButtonGroupProps & React.RefAttributes<HTMLDivElement>>;
173
+ type ButtonGroupOption = {
174
+ /**
175
+ * - Main label for the option.
176
+ */
177
+ label?: React.ReactNode;
178
+ /**
179
+ * - Optional leading element (icon, badge, etc.).
180
+ */
181
+ startAdornment?: React.ReactNode;
182
+ /**
183
+ * - Optional trailing element (legacy alias).
184
+ */
185
+ endIcon?: React.ReactNode;
186
+ /**
187
+ * - Optional trailing element.
188
+ */
189
+ endAdornment?: React.ReactNode;
190
+ /**
191
+ * - Unique value used for selection.
192
+ */
193
+ value?: string | number;
194
+ /**
195
+ * - Whether the option is disabled.
196
+ */
197
+ disabled?: boolean;
198
+ };
199
+ /**
200
+ * Segmented button group with animated active state.
201
+ */
202
+ type ButtonGroupProps = Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> & {
203
+ value?: string | number;
204
+ defaultValue?: string | number;
205
+ onChange?: (value: string | number, option: ButtonGroupOption) => void;
206
+ size?: "small" | "medium" | "large";
207
+ isStretched?: boolean;
208
+ };
172
209
 
173
210
  declare function ButtonGroupItem(_props: any): any;
174
211
  declare namespace ButtonGroupItem {
@@ -241,4 +278,49 @@ type ButtonCounterProps = React.HTMLAttributes<HTMLDivElement> & {
241
278
  className?: string;
242
279
  };
243
280
 
244
- export { Button, ButtonCounter, ButtonGroup, ButtonGroupItem, IconButton, MenuButton };
281
+ interface ToolbarProps extends React.HTMLAttributes<HTMLDivElement> {
282
+ /** Native Tab order is the default. Adopt roving arrow-key focus explicitly. */
283
+ keyboardNavigation?: "native" | "roving";
284
+ /** Arrow-key navigation follows this axis. It never activates an action. */
285
+ orientation?: "horizontal" | "vertical";
286
+ /** Whether arrow navigation wraps at the first and last enabled action. */
287
+ loop?: boolean;
288
+ }
289
+ /**
290
+ * A labelled action toolbar with native Tab order by default.
291
+ * Opt into roving navigation for one tab stop and arrow-key focus.
292
+ * Place ToolbarButton/ToolbarToggleButton children directly or in ToolbarGroup.
293
+ * Nested toolbars maintain independent focus. Editor command handling stays local.
294
+ */
295
+ declare const Toolbar: React.ForwardRefExoticComponent<ToolbarProps & React.RefAttributes<HTMLDivElement>>;
296
+ interface ToolbarGroupProps extends React.HTMLAttributes<HTMLDivElement> {
297
+ orientation?: "horizontal" | "vertical";
298
+ }
299
+ /** A labelled, non-selecting action group. Selection state belongs to its buttons. */
300
+ declare const ToolbarGroup: React.ForwardRefExoticComponent<ToolbarGroupProps & React.RefAttributes<HTMLDivElement>>;
301
+ interface ToolbarSeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
302
+ /** The separator line's orientation, perpendicular to a horizontal toolbar by default. */
303
+ orientation?: "horizontal" | "vertical";
304
+ }
305
+ declare const ToolbarSeparator: React.ForwardRefExoticComponent<ToolbarSeparatorProps & React.RefAttributes<HTMLDivElement>>;
306
+
307
+ interface ToolbarButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
308
+ /** Compatibility visual state. Defaults aria-pressed to true; explicit native ARIA wins. */
309
+ active?: boolean;
310
+ size?: "small" | "medium" | "large";
311
+ variant?: "neutral" | "primary" | "danger";
312
+ icon?: React.ReactNode;
313
+ /** Square geometry. Provide aria-label or aria-labelledby when there is no visible text. */
314
+ iconOnly?: boolean;
315
+ }
316
+ /** Compact native action button; compose a Tooltip around it when an explanation is needed. */
317
+ declare const ToolbarButton: React.ForwardRefExoticComponent<ToolbarButtonProps & React.RefAttributes<HTMLButtonElement>>;
318
+ interface ToolbarToggleButtonProps extends Omit<ToolbarButtonProps, "aria-pressed" | "active"> {
319
+ pressed?: boolean;
320
+ defaultPressed?: boolean;
321
+ onPressedChange?: (pressed: boolean, event: React.MouseEvent<HTMLButtonElement>) => void;
322
+ }
323
+ /** A controlled or uncontrolled independent toggle, with native button keyboard activation. */
324
+ declare const ToolbarToggleButton: React.ForwardRefExoticComponent<ToolbarToggleButtonProps & React.RefAttributes<HTMLButtonElement>>;
325
+
326
+ export { Button, ButtonCounter, ButtonGroup, ButtonGroupItem, IconButton, MenuButton, Toolbar, ToolbarButton, type ToolbarButtonProps, ToolbarGroup, type ToolbarGroupProps, type ToolbarProps, ToolbarSeparator, type ToolbarSeparatorProps, ToolbarToggleButton, type ToolbarToggleButtonProps };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as react from 'react';
1
+ import React from 'react';
2
2
 
3
3
  /**
4
4
  * Props for the IconButton component.
@@ -160,7 +160,7 @@ type MenuButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
160
160
  /**
161
161
  * Segmented button group with animated active state.
162
162
  *
163
- * @typedef {React.HTMLAttributes<HTMLDivElement> & {
163
+ * @typedef {Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"|"defaultValue"> & {
164
164
  * value?: string|number,
165
165
  * defaultValue?: string|number,
166
166
  * onChange?: (value: string|number, option: ButtonGroupOption) => void,
@@ -168,7 +168,44 @@ type MenuButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
168
168
  * isStretched?: boolean,
169
169
  * }} ButtonGroupProps
170
170
  */
171
- declare const ButtonGroup: react.ForwardRefExoticComponent<react.RefAttributes<any>>;
171
+ /** @type {React.ForwardRefExoticComponent<ButtonGroupProps & React.RefAttributes<HTMLDivElement>>} */
172
+ declare const ButtonGroup: React.ForwardRefExoticComponent<ButtonGroupProps & React.RefAttributes<HTMLDivElement>>;
173
+ type ButtonGroupOption = {
174
+ /**
175
+ * - Main label for the option.
176
+ */
177
+ label?: React.ReactNode;
178
+ /**
179
+ * - Optional leading element (icon, badge, etc.).
180
+ */
181
+ startAdornment?: React.ReactNode;
182
+ /**
183
+ * - Optional trailing element (legacy alias).
184
+ */
185
+ endIcon?: React.ReactNode;
186
+ /**
187
+ * - Optional trailing element.
188
+ */
189
+ endAdornment?: React.ReactNode;
190
+ /**
191
+ * - Unique value used for selection.
192
+ */
193
+ value?: string | number;
194
+ /**
195
+ * - Whether the option is disabled.
196
+ */
197
+ disabled?: boolean;
198
+ };
199
+ /**
200
+ * Segmented button group with animated active state.
201
+ */
202
+ type ButtonGroupProps = Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> & {
203
+ value?: string | number;
204
+ defaultValue?: string | number;
205
+ onChange?: (value: string | number, option: ButtonGroupOption) => void;
206
+ size?: "small" | "medium" | "large";
207
+ isStretched?: boolean;
208
+ };
172
209
 
173
210
  declare function ButtonGroupItem(_props: any): any;
174
211
  declare namespace ButtonGroupItem {
@@ -241,4 +278,49 @@ type ButtonCounterProps = React.HTMLAttributes<HTMLDivElement> & {
241
278
  className?: string;
242
279
  };
243
280
 
244
- export { Button, ButtonCounter, ButtonGroup, ButtonGroupItem, IconButton, MenuButton };
281
+ interface ToolbarProps extends React.HTMLAttributes<HTMLDivElement> {
282
+ /** Native Tab order is the default. Adopt roving arrow-key focus explicitly. */
283
+ keyboardNavigation?: "native" | "roving";
284
+ /** Arrow-key navigation follows this axis. It never activates an action. */
285
+ orientation?: "horizontal" | "vertical";
286
+ /** Whether arrow navigation wraps at the first and last enabled action. */
287
+ loop?: boolean;
288
+ }
289
+ /**
290
+ * A labelled action toolbar with native Tab order by default.
291
+ * Opt into roving navigation for one tab stop and arrow-key focus.
292
+ * Place ToolbarButton/ToolbarToggleButton children directly or in ToolbarGroup.
293
+ * Nested toolbars maintain independent focus. Editor command handling stays local.
294
+ */
295
+ declare const Toolbar: React.ForwardRefExoticComponent<ToolbarProps & React.RefAttributes<HTMLDivElement>>;
296
+ interface ToolbarGroupProps extends React.HTMLAttributes<HTMLDivElement> {
297
+ orientation?: "horizontal" | "vertical";
298
+ }
299
+ /** A labelled, non-selecting action group. Selection state belongs to its buttons. */
300
+ declare const ToolbarGroup: React.ForwardRefExoticComponent<ToolbarGroupProps & React.RefAttributes<HTMLDivElement>>;
301
+ interface ToolbarSeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
302
+ /** The separator line's orientation, perpendicular to a horizontal toolbar by default. */
303
+ orientation?: "horizontal" | "vertical";
304
+ }
305
+ declare const ToolbarSeparator: React.ForwardRefExoticComponent<ToolbarSeparatorProps & React.RefAttributes<HTMLDivElement>>;
306
+
307
+ interface ToolbarButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
308
+ /** Compatibility visual state. Defaults aria-pressed to true; explicit native ARIA wins. */
309
+ active?: boolean;
310
+ size?: "small" | "medium" | "large";
311
+ variant?: "neutral" | "primary" | "danger";
312
+ icon?: React.ReactNode;
313
+ /** Square geometry. Provide aria-label or aria-labelledby when there is no visible text. */
314
+ iconOnly?: boolean;
315
+ }
316
+ /** Compact native action button; compose a Tooltip around it when an explanation is needed. */
317
+ declare const ToolbarButton: React.ForwardRefExoticComponent<ToolbarButtonProps & React.RefAttributes<HTMLButtonElement>>;
318
+ interface ToolbarToggleButtonProps extends Omit<ToolbarButtonProps, "aria-pressed" | "active"> {
319
+ pressed?: boolean;
320
+ defaultPressed?: boolean;
321
+ onPressedChange?: (pressed: boolean, event: React.MouseEvent<HTMLButtonElement>) => void;
322
+ }
323
+ /** A controlled or uncontrolled independent toggle, with native button keyboard activation. */
324
+ declare const ToolbarToggleButton: React.ForwardRefExoticComponent<ToolbarToggleButtonProps & React.RefAttributes<HTMLButtonElement>>;
325
+
326
+ export { Button, ButtonCounter, ButtonGroup, ButtonGroupItem, IconButton, MenuButton, Toolbar, ToolbarButton, type ToolbarButtonProps, ToolbarGroup, type ToolbarGroupProps, type ToolbarProps, ToolbarSeparator, type ToolbarSeparatorProps, ToolbarToggleButton, type ToolbarToggleButtonProps };