@overdoser/react-toolkit 0.14.0 → 0.15.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/llms.txt CHANGED
@@ -372,6 +372,48 @@ Mode B example:
372
372
  />
373
373
  ```
374
374
 
375
+ ### SplitButton
376
+ Import: `import { SplitButton } from '@overdoser/react-toolkit'`
377
+
378
+ Split button: a primary action button joined to a chevron toggle that opens a menu of secondary actions — the standard "Operations" control for table rows. Takes a **flat `actions` list**; the first entry is the default action exposed as the main button, the rest go into the menu. With a single action no chevron or menu is rendered. Closes on outside click and Escape.
379
+
380
+ Sizing: the control automatically grows to fit its **widest** action label (hidden measurement column), and the open menu sits flush under it at **exactly** the control's width with the meeting corners squared — button + menu always read as one uniform block; menu items never wrap. The main label is left-aligned and menu items share the button's font and per-size padding, so the label and item text form one column. Cap the growth with `maxWidth`; labels then clip with an ellipsis and string labels get a native `title` tooltip with the full text.
381
+
382
+ `SplitButtonAction`:
383
+ - `label: ReactNode`
384
+ - `onClick?: (event: MouseEvent) => void` — JS action.
385
+ - `href?: string` — navigation action; renders a real `<a>` (middle-click / cmd-click work). Can be combined with `onClick` (handler runs before navigation).
386
+ - `target?: string` — anchor target; `'_blank'` gets `rel="noopener noreferrer"` automatically.
387
+ - `disabled?: boolean` — default `false`. A disabled `href` action renders as a disabled `<button>`, not an anchor.
388
+ - `danger?: boolean` — default `false`. Red destructive styling (menu items only).
389
+
390
+ `SplitButtonProps`:
391
+ - `actions: SplitButtonAction[]` — required. First = exposed default action.
392
+ - `variant?: 'primary' | 'secondary' | 'danger' | 'ghost'` — default `'secondary'`. Applied to both segments (same visual scale as `Button`).
393
+ - `size?: 'sm' | 'md' | 'lg'` — default `'md'`
394
+ - `disabled?: boolean` — default `false`. Disables both segments.
395
+ - `align?: 'left' | 'right'` — default `'right'` (split buttons usually sit at the end of a row, where a left-aligned menu would overflow).
396
+ - `portal?: boolean` — default `true`. Same portal behavior as `Dropdown` (`--crk-z-floating`, escapes `overflow: hidden` ancestors).
397
+ - `menuLabel?: string` — default `'More actions'`. Accessible label for the chevron toggle.
398
+ - `maxWidth?: number | string` — caps the control's auto-grow width (numbers are px); the main button label and over-long menu items clip with an ellipsis, and string labels get a native `title` tooltip.
399
+ - `id?: string` — applied to the main button.
400
+ - `onOpen?: () => void` / `onClose?: () => void`
401
+ - `classes?: Partial<SplitButtonClasses>` where `SplitButtonClasses = { root, group, main, toggle, chevron, menu, item }`
402
+
403
+ Example — table row operations:
404
+ ```tsx
405
+ <SplitButton
406
+ size="sm"
407
+ actions={[
408
+ { label: 'Edit', onClick: () => edit(row) },
409
+ { label: 'View', href: `/items/${row.id}` },
410
+ { label: 'Delete', onClick: () => remove(row), danger: true },
411
+ ]}
412
+ />
413
+ ```
414
+
415
+ Use `SplitButton` when one action is the default and the rest are overflow; use `Dropdown` (menu mode) when all actions are equal-weight behind one trigger.
416
+
375
417
  ### Popover
376
418
  Import: `import { Popover } from '@overdoser/react-toolkit'`
377
419
 
package/manifest.json CHANGED
@@ -648,6 +648,89 @@
648
648
  }
649
649
  }
650
650
  },
651
+ "SplitButton": {
652
+ "import": "import { SplitButton, type SplitButtonAction } from '@overdoser/react-toolkit'",
653
+ "element": "div",
654
+ "forwardsRef": true,
655
+ "description": "Primary action button joined to a chevron that opens a menu of secondary actions (the standard table-row 'Operations' control). Flat actions list; first entry is the exposed default action, the rest go in the menu. Single action renders a plain button with no chevron/menu. The control auto-grows to fit its widest action label and the open menu renders flush under it at exactly the control's width (meeting corners squared), so button + menu read as one block.",
656
+ "props": {
657
+ "actions": {
658
+ "type": "SplitButtonAction[]",
659
+ "required": true,
660
+ "notes": "SplitButtonAction = { label: ReactNode; onClick?: (e) => void; href?: string; target?: string; disabled?: boolean; danger?: boolean }. href actions render as real <a> elements; target='_blank' gets rel='noopener noreferrer'; a disabled href action renders as a disabled <button>. danger gives red destructive styling (menu items only)."
661
+ },
662
+ "variant": {
663
+ "type": "enum",
664
+ "values": [
665
+ "primary",
666
+ "secondary",
667
+ "danger",
668
+ "ghost"
669
+ ],
670
+ "default": "secondary",
671
+ "notes": "Applied to both segments; same visual scale as Button."
672
+ },
673
+ "size": {
674
+ "type": "enum",
675
+ "values": [
676
+ "sm",
677
+ "md",
678
+ "lg"
679
+ ],
680
+ "default": "md"
681
+ },
682
+ "disabled": {
683
+ "type": "boolean",
684
+ "default": false,
685
+ "notes": "Disables both segments."
686
+ },
687
+ "align": {
688
+ "type": "enum",
689
+ "values": [
690
+ "left",
691
+ "right"
692
+ ],
693
+ "default": "right",
694
+ "notes": "Defaults right because split buttons usually sit at the end of a row/table."
695
+ },
696
+ "portal": {
697
+ "type": "boolean",
698
+ "default": true,
699
+ "notes": "Same portal behavior as Dropdown (--crk-z-floating, escapes overflow:hidden ancestors)."
700
+ },
701
+ "menuLabel": {
702
+ "type": "string",
703
+ "default": "More actions",
704
+ "notes": "Accessible label for the chevron toggle."
705
+ },
706
+ "maxWidth": {
707
+ "type": "number | string",
708
+ "notes": "Caps the control's auto-grow width (numbers are px); the main button label and over-long menu items clip with an ellipsis, and string labels get a native title tooltip with the full text."
709
+ },
710
+ "id": {
711
+ "type": "string",
712
+ "notes": "Applied to the main button."
713
+ },
714
+ "onOpen": {
715
+ "type": "() => void"
716
+ },
717
+ "onClose": {
718
+ "type": "() => void"
719
+ },
720
+ "classes": {
721
+ "type": "Partial<SplitButtonClasses>",
722
+ "shape": [
723
+ "root",
724
+ "group",
725
+ "main",
726
+ "toggle",
727
+ "chevron",
728
+ "menu",
729
+ "item"
730
+ ]
731
+ }
732
+ }
733
+ },
651
734
  "Popover": {
652
735
  "import": "import { Popover } from '@overdoser/react-toolkit'",
653
736
  "element": "div",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overdoser/react-toolkit",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "homepage": "https://react-toolkit.overdoser.org",
5
5
  "type": "module",
6
6
  "main": "./index.js",