@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/AGENTS.md CHANGED
@@ -53,6 +53,8 @@ For exhaustive component reference (every prop, every variant, every signature),
53
53
 
54
54
  - **Need a menu (Edit / Delete / Archive)?** → `<Dropdown trigger={...}>` with `<DropdownItem>` children.
55
55
 
56
+ - **Need row actions with one default exposed (table "Operations" column)?** → `<SplitButton actions={[...]} />` — flat list of `{ label, onClick?, href?, danger?, disabled? }`; the first action is the visible button, the rest live behind the chevron. `href` actions render as real anchors. Use `Dropdown` menu mode instead when all actions are equal-weight.
57
+
56
58
  - **Need a copy-to-clipboard button?** → `<CopyButton value={text} />` (icon + "Copy"→"Copied" morph), or `<CopyButton value={text} iconOnly aria-label="Copy" />` for icon-only. **Other one-shot actions with success feedback (send, download, delete-with-confirm)?** → `<ActionButton icon label successLabel onAction />` — async `onAction` gets a pending spinner; call `context.setProgress(0–100)` inside it for a determinate % + fill bar (downloads); `confirmLabel` adds a two-step confirm for destructive actions. Use plain `Button` when no phase feedback is needed.
57
59
 
58
60
  - **Need a like/save/bookmark toggle?** → `<ToggleIconButton icon={<HeartIcon />} aria-label="Like" />` — round icon-only toggle with `aria-pressed`, fill + pop on toggle, optional `burst` ring, `activeColor` for semantic colors. Controlled (`pressed` + `onPressedChange`, optimistic) or uncontrolled (`defaultPressed`). Not for text toggles — it's icon-only by design.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,37 @@ All notable changes to `@overdoser/react-toolkit` are documented here.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/), and this
5
5
  project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [0.15.0]
8
+
9
+ A split button for grouped row actions, and a Dropdown positioning fix.
10
+
11
+ ### Added
12
+
13
+ - **`SplitButton`** — a primary action button joined to a chevron that opens
14
+ a menu of secondary actions (the classic table-row "Operations" control).
15
+ Takes a flat `actions` list (`{ label, onClick?, href?, target?,
16
+ disabled?, danger? }`); the first entry is the exposed default action, the
17
+ rest live behind the chevron, and a single action renders as a plain
18
+ button with no chevron. `href` actions render as real anchors
19
+ (middle-click / cmd-click work; `_blank` gets `rel="noopener noreferrer"`).
20
+ Segments share `Button`'s variants (`variant`, default `secondary`) and
21
+ sizes. The control sizes itself to its widest action label and the open
22
+ menu sits flush under it at exactly the control's width with the meeting
23
+ corners squared, so button and menu read as one block; the left-aligned
24
+ main label and the menu items share the button's font and per-size
25
+ padding, forming one text column. `maxWidth` caps the growth and clips
26
+ labels with an ellipsis (string labels then get a native `title` tooltip
27
+ with the full text). Menu behavior (portal by default, outside-click/
28
+ Escape dismissal, focus management, `menu`/`menuitem` roles) matches
29
+ `Dropdown`, with `align` defaulting to `right` for end-of-row placement.
30
+
31
+ ### Fixed
32
+
33
+ - **Dropdown** — an `align="right"` portaled menu computed its `right`
34
+ offset from `window.innerWidth`, which includes the scrollbar; the menu
35
+ shifted left by the scrollbar width whenever the page had one. Now
36
+ measured against `document.documentElement.clientWidth`.
37
+
7
38
  ## [0.14.0]
8
39
 
9
40
  Buttons floated over content no longer let it show through their fills.
@@ -11,34 +11,34 @@ const b = {
11
11
  variant: s = "primary",
12
12
  size: e = "md",
13
13
  loading: d = !1,
14
- loadingStyle: i = "dots",
15
- fullWidth: n = !1,
14
+ loadingStyle: n = "dots",
15
+ fullWidth: i = !1,
16
16
  iconOnly: l = !1,
17
17
  disabled: p,
18
18
  classes: t,
19
19
  className: f,
20
20
  style: c,
21
21
  children: h,
22
- ...N
23
- }, u) => /* @__PURE__ */ m(
22
+ ...u
23
+ }, N) => /* @__PURE__ */ m(
24
24
  "button",
25
25
  {
26
- ref: u,
26
+ ref: N,
27
27
  className: r(
28
28
  o.root,
29
29
  o[s],
30
30
  o[e],
31
- n && o.fullWidth,
31
+ i && o.fullWidth,
32
32
  l && o.iconOnly,
33
33
  d && o.loading,
34
- d && b[i],
34
+ d && b[n],
35
35
  t?.root,
36
36
  f
37
37
  ),
38
38
  style: c,
39
39
  disabled: p || d,
40
40
  "aria-busy": d || void 0,
41
- ...N,
41
+ ...u,
42
42
  children: [
43
43
  /* @__PURE__ */ a("div", { className: r(o.shimmer, t?.shimmer) }),
44
44
  /* @__PURE__ */ a("span", { className: r(o.content, t?.content), children: h }),
@@ -1,4 +1,4 @@
1
- const o = "crk-root-8RX49", n = "crk-loading-QfItr", r = "crk-primary-st6yY", c = "crk-secondary-j-3rj", t = "crk-danger-Hxs5n", s = "crk-ghost-kQ0A8", d = "crk-sm-RXFPY", e = "crk-md-nDnOD", i = "crk-lg-qD-Qh", l = "crk-fullWidth-AHpSl", m = "crk-iconOnly-FNrSu", a = "crk-content-PpYVU", k = "crk-shimmer-8iQSU", g = "crk-loadingShimmer-BVvFw", h = "crk-shimmerSweep-uiZ01", p = "crk-dots-U8wss", S = "crk-loadingDots-eKv64", y = "crk-dot-Owuk1", u = "crk-dotBounce-FwdcC", w = "crk-loadingBorder-9ULFw", B = "crk-borderSpin-EJ2gW", D = {
1
+ const o = "crk-root-8RX49", n = "crk-loading-QfItr", r = "crk-primary-st6yY", c = "crk-secondary-j-3rj", t = "crk-danger-Hxs5n", s = "crk-ghost-kQ0A8", d = "crk-sm-RXFPY", e = "crk-md-nDnOD", i = "crk-lg-qD-Qh", l = "crk-fullWidth-AHpSl", m = "crk-iconOnly-FNrSu", a = "crk-content-PpYVU", k = "crk-shimmer-8iQSU", g = "crk-loadingShimmer-BVvFw", h = "crk-shimmerSweep-uiZ01", S = "crk-dots-U8wss", p = "crk-loadingDots-eKv64", u = "crk-dot-Owuk1", y = "crk-dotBounce-FwdcC", w = "crk-loadingBorder-9ULFw", B = "crk-borderSpin-EJ2gW", D = {
2
2
  root: o,
3
3
  loading: n,
4
4
  primary: r,
@@ -14,10 +14,10 @@ const o = "crk-root-8RX49", n = "crk-loading-QfItr", r = "crk-primary-st6yY", c
14
14
  shimmer: k,
15
15
  loadingShimmer: g,
16
16
  shimmerSweep: h,
17
- dots: p,
18
- loadingDots: S,
19
- dot: y,
20
- dotBounce: u,
17
+ dots: S,
18
+ loadingDots: p,
19
+ dot: u,
20
+ dotBounce: y,
21
21
  loadingBorder: w,
22
22
  borderSpin: B
23
23
  };
@@ -26,16 +26,16 @@ export {
26
26
  a as content,
27
27
  t as danger,
28
28
  D as default,
29
- y as dot,
30
- u as dotBounce,
31
- p as dots,
29
+ u as dot,
30
+ y as dotBounce,
31
+ S as dots,
32
32
  l as fullWidth,
33
33
  s as ghost,
34
34
  m as iconOnly,
35
35
  i as lg,
36
36
  n as loading,
37
37
  w as loadingBorder,
38
- S as loadingDots,
38
+ p as loadingDots,
39
39
  g as loadingShimmer,
40
40
  e as md,
41
41
  r as primary,
@@ -1,7 +1,7 @@
1
1
  import { jsx as f, jsxs as p } from "react/jsx-runtime";
2
2
  import { forwardRef as G, useState as H, useRef as b, useId as J, useEffect as S, useCallback as v } from "react";
3
3
  import { createPortal as Q } from "react-dom";
4
- import i from "clsx";
4
+ import o from "clsx";
5
5
  import t from "./Dropdown.module.scss.js";
6
6
  import { useKeyboard as T } from "../../hooks/useKeyboard.js";
7
7
  import { usePortalPosition as U } from "../../hooks/usePortalPosition.js";
@@ -13,56 +13,56 @@ const V = G(
13
13
  className: j,
14
14
  style: z,
15
15
  id: O,
16
- onOpen: w,
16
+ onOpen: y,
17
17
  onClose: c,
18
- options: o,
18
+ options: i,
19
19
  placeholder: W = "Select...",
20
- value: y,
20
+ value: w,
21
21
  onChange: x,
22
22
  error: q = !1,
23
23
  fullWidth: s = !0,
24
- portal: a = !0,
24
+ portal: u = !0,
25
25
  classes: n
26
26
  }, K) => {
27
- const [r, N] = H(!1), I = b(null), u = b(null), h = b(null), L = J();
27
+ const [r, N] = H(!1), E = b(null), a = b(null), h = b(null), I = J();
28
28
  S(() => {
29
- r && u.current && u.current.querySelector('[role="menuitem"]:not(:disabled)')?.focus();
29
+ r && a.current && a.current.querySelector('[role="menuitem"]:not(:disabled)')?.focus();
30
30
  }, [r]);
31
- const d = v(() => {
31
+ const l = v(() => {
32
32
  N(!1), c?.(), h.current?.focus();
33
33
  }, [c]), M = v(() => {
34
34
  N((e) => {
35
35
  const m = !e;
36
- return m ? w?.() : c?.(), m;
36
+ return m ? y?.() : c?.(), m;
37
37
  });
38
- }, [w, c]), A = v(
38
+ }, [y, c]), A = v(
39
39
  (e) => {
40
- x?.(e), d();
40
+ x?.(e), l();
41
41
  },
42
- [x, d]
42
+ [x, l]
43
43
  );
44
44
  S(() => {
45
45
  if (!r) return;
46
46
  const e = (m) => {
47
47
  const P = m.target;
48
- I.current?.contains(P) || u.current?.contains(P) || d();
48
+ E.current?.contains(P) || a.current?.contains(P) || l();
49
49
  };
50
50
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
51
- }, [r, d]), T(
51
+ }, [r, l]), T(
52
52
  {
53
- Escape: () => d()
53
+ Escape: () => l()
54
54
  },
55
55
  r
56
56
  );
57
- const l = U(h, r && a), R = o?.find((e) => e.value === y)?.label, B = o ? R || W : k, C = o && !R, F = o ? o.map((e) => /* @__PURE__ */ f(
57
+ const d = U(h, r && u), L = i?.find((e) => e.value === w)?.label, B = i ? L || W : k, C = i && !L, F = i ? i.map((e) => /* @__PURE__ */ f(
58
58
  "button",
59
59
  {
60
60
  type: "button",
61
61
  role: "menuitem",
62
- className: i(
62
+ className: o(
63
63
  t.item,
64
64
  e.disabled && t.itemDisabled,
65
- e.value === y && t.itemSelected,
65
+ e.value === w && t.itemSelected,
66
66
  n?.item
67
67
  ),
68
68
  disabled: e.disabled,
@@ -70,16 +70,16 @@ const V = G(
70
70
  children: e.label
71
71
  },
72
72
  e.value
73
- )) : D, E = (e) => /* @__PURE__ */ f(
73
+ )) : D, R = (e) => /* @__PURE__ */ f(
74
74
  "div",
75
75
  {
76
- ref: u,
77
- id: L,
78
- className: i(
76
+ ref: a,
77
+ id: I,
78
+ className: o(
79
79
  t.menu,
80
80
  r && t.menuOpen,
81
81
  g === "left" ? t.alignLeft : t.alignRight,
82
- !a && s && t.fullWidth,
82
+ !u && s && t.fullWidth,
83
83
  n?.menu
84
84
  ),
85
85
  style: e,
@@ -91,17 +91,17 @@ const V = G(
91
91
  "div",
92
92
  {
93
93
  ref: K,
94
- className: i(t.root, s && t.fullWidth, n?.root, j),
94
+ className: o(t.root, s && t.fullWidth, n?.root, j),
95
95
  style: z,
96
96
  children: [
97
- /* @__PURE__ */ p("div", { ref: I, style: s ? { width: "100%" } : void 0, children: [
97
+ /* @__PURE__ */ p("div", { ref: E, style: s ? { width: "100%" } : void 0, children: [
98
98
  /* @__PURE__ */ p(
99
99
  "button",
100
100
  {
101
101
  ref: h,
102
102
  id: O,
103
103
  type: "button",
104
- className: i(
104
+ className: o(
105
105
  t.trigger,
106
106
  r && t.triggerOpen,
107
107
  q && t.triggerError,
@@ -111,22 +111,26 @@ const V = G(
111
111
  onClick: M,
112
112
  "aria-expanded": r,
113
113
  "aria-haspopup": "menu",
114
- "aria-controls": r ? L : void 0,
114
+ "aria-controls": r ? I : void 0,
115
115
  children: [
116
- /* @__PURE__ */ f("span", { className: i(t.triggerLabel, C && t.placeholder, n?.triggerLabel), children: B }),
117
- /* @__PURE__ */ f("span", { className: i(t.chevron, n?.chevron), "aria-hidden": "true" })
116
+ /* @__PURE__ */ f("span", { className: o(t.triggerLabel, C && t.placeholder, n?.triggerLabel), children: B }),
117
+ /* @__PURE__ */ f("span", { className: o(t.chevron, n?.chevron), "aria-hidden": "true" })
118
118
  ]
119
119
  }
120
120
  ),
121
- !a && E()
121
+ !u && R()
122
122
  ] }),
123
- a && r && typeof document < "u" && Q(
124
- E({
123
+ u && r && typeof document < "u" && Q(
124
+ R({
125
125
  position: "fixed",
126
- top: l.top + 4,
127
- left: g === "right" ? void 0 : l.left,
128
- right: g === "right" ? window.innerWidth - (l.left + l.width) : void 0,
129
- minWidth: l.width,
126
+ top: d.top + 4,
127
+ left: g === "right" ? void 0 : d.left,
128
+ // clientWidth, not innerWidth: `right` on a fixed element is
129
+ // measured from the viewport edge inside the scrollbar, while
130
+ // innerWidth includes it — the menu would shift left by the
131
+ // scrollbar width whenever the page scrolls.
132
+ right: g === "right" ? document.documentElement.clientWidth - (d.left + d.width) : void 0,
133
+ minWidth: d.width,
130
134
  zIndex: "var(--crk-z-floating)"
131
135
  }),
132
136
  document.body
@@ -0,0 +1,88 @@
1
+ import { CSSProperties } from 'react';
2
+ export interface SplitButtonAction {
3
+ /** Visible label (main button for the first action, menu item for the rest). */
4
+ label: React.ReactNode;
5
+ /** Click handler. Runs before navigation when `href` is also set. */
6
+ onClick?: (event: React.MouseEvent<HTMLElement>) => void;
7
+ /** Navigation action: renders as a real `<a>` so middle-click/cmd-click work. */
8
+ href?: string;
9
+ /** Anchor target for `href` actions. `_blank` gets `rel="noopener noreferrer"` automatically. */
10
+ target?: React.HTMLAttributeAnchorTarget;
11
+ /** Non-interactive when true. @default false */
12
+ disabled?: boolean;
13
+ /** Destructive styling — red menu item (only meaningful for menu actions). @default false */
14
+ danger?: boolean;
15
+ }
16
+ export interface SplitButtonClasses {
17
+ root: string;
18
+ group: string;
19
+ main: string;
20
+ toggle: string;
21
+ chevron: string;
22
+ menu: string;
23
+ item: string;
24
+ }
25
+ export interface SplitButtonProps {
26
+ /**
27
+ * Actions, in display order. The **first** action is the default action,
28
+ * exposed as the main button; the rest collapse into the chevron menu.
29
+ * With a single action no chevron or menu is rendered.
30
+ */
31
+ actions: SplitButtonAction[];
32
+ /** Visual style of both button segments. @default 'secondary' */
33
+ variant?: 'primary' | 'secondary' | 'danger' | 'ghost';
34
+ /** Button size. @default 'md' */
35
+ size?: 'sm' | 'md' | 'lg';
36
+ /** Disables both segments (the menu can no longer be opened). @default false */
37
+ disabled?: boolean;
38
+ /**
39
+ * Menu alignment relative to the control. Defaults to `'right'` because
40
+ * split buttons usually sit at the end of a row/table where a left-aligned
41
+ * menu would overflow.
42
+ * @default 'right'
43
+ */
44
+ align?: 'left' | 'right';
45
+ /**
46
+ * Render the open menu in a portal at `document.body` so it escapes any
47
+ * `overflow: hidden` ancestor (Modal body, scrollable tables, etc.).
48
+ * @default true
49
+ */
50
+ portal?: boolean;
51
+ /** Accessible label for the chevron toggle. @default 'More actions' */
52
+ menuLabel?: string;
53
+ /**
54
+ * Maximum width of the control (CSS value; numbers are px). By default the
55
+ * control grows to fit its **widest** action label so the button and the
56
+ * open menu form one equal-width block; past `maxWidth` the main button's
57
+ * label — and any menu item that no longer fits — is clipped with an
58
+ * ellipsis instead.
59
+ */
60
+ maxWidth?: number | string;
61
+ className?: string;
62
+ style?: CSSProperties;
63
+ /** `id` applied to the main button. */
64
+ id?: string;
65
+ /** Called when the menu opens. */
66
+ onOpen?: () => void;
67
+ /** Called when the menu closes (outside click, Escape, or selection). */
68
+ onClose?: () => void;
69
+ /** Override class names on internal elements. */
70
+ classes?: Partial<SplitButtonClasses>;
71
+ }
72
+ /**
73
+ * Split button: a primary action button joined to a chevron that opens a menu
74
+ * of secondary actions — the standard "Operations" control for table rows.
75
+ * Takes a flat `actions` list; the first entry is the exposed default action.
76
+ * Actions can be JS handlers (`onClick`) or navigations (`href`, rendered as
77
+ * real anchors). Closes on outside click and Escape.
78
+ *
79
+ * @example
80
+ * <SplitButton
81
+ * actions={[
82
+ * { label: 'Edit', onClick: () => edit(row) },
83
+ * { label: 'View', href: `/items/${row.id}` },
84
+ * { label: 'Delete', onClick: () => remove(row), danger: true },
85
+ * ]}
86
+ * />
87
+ */
88
+ export declare const SplitButton: import('react').ForwardRefExoticComponent<SplitButtonProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,201 @@
1
+ import { jsxs as N, jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as X, useState as Y, useRef as S, useId as Z, useEffect as q, useCallback as F } from "react";
3
+ import { createPortal as $ } from "react-dom";
4
+ import i from "clsx";
5
+ import t from "./SplitButton.module.scss.js";
6
+ import h from "../Button/Button.module.scss.js";
7
+ import { useKeyboard as ee } from "../../hooks/useKeyboard.js";
8
+ import { usePortalPosition as te } from "../../hooks/usePortalPosition.js";
9
+ const ne = X(
10
+ ({
11
+ actions: g,
12
+ variant: b = "secondary",
13
+ size: O = "md",
14
+ disabled: w = !1,
15
+ align: v = "right",
16
+ portal: k = !0,
17
+ menuLabel: K = "More actions",
18
+ maxWidth: y,
19
+ className: G,
20
+ style: x,
21
+ id: I,
22
+ onOpen: L,
23
+ onClose: c,
24
+ classes: s
25
+ }, H) => {
26
+ const [n, R] = Y(!1), C = S(null), u = S(null), E = S(null), M = Z();
27
+ q(() => {
28
+ n && u.current && u.current.querySelector('[role="menuitem"]:not([disabled])')?.focus();
29
+ }, [n]);
30
+ const f = F(() => {
31
+ R(!1), c?.(), E.current?.focus();
32
+ }, [c]), J = F(() => {
33
+ R((e) => {
34
+ const l = !e;
35
+ return l ? L?.() : c?.(), l;
36
+ });
37
+ }, [L, c]);
38
+ q(() => {
39
+ if (!n) return;
40
+ const e = (l) => {
41
+ const m = l.target;
42
+ C.current?.contains(m) || u.current?.contains(m) || f();
43
+ };
44
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
45
+ }, [n, f]), ee(
46
+ {
47
+ Escape: () => f()
48
+ },
49
+ n
50
+ );
51
+ const d = te(C, n && k);
52
+ if (g.length === 0) return null;
53
+ const [o, ...z] = g, a = z.length > 0, B = w || o.disabled, P = i(h.root, h[b], h[O]), Q = b === "secondary" ? t.overlapOutline : b === "ghost" ? t.dividerSubtle : t.dividerOnFill, j = i(
54
+ P,
55
+ t.main,
56
+ a && t.mainAttached,
57
+ a && n && t.mainOpen,
58
+ s?.main
59
+ ), p = (e) => y !== void 0 && (typeof e == "string" || typeof e == "number") ? String(e) : void 0, D = /* @__PURE__ */ N("span", { className: t.mainContent, children: [
60
+ /* @__PURE__ */ r("span", { className: t.mainLabel, children: o.label }),
61
+ a && /* @__PURE__ */ r("span", { className: t.sizer, "aria-hidden": "true", children: g.map((e, l) => /* @__PURE__ */ r("span", { className: t.sizerItem, children: e.label }, l)) })
62
+ ] }), T = o.href && !B ? /* @__PURE__ */ r(
63
+ "a",
64
+ {
65
+ id: I,
66
+ className: j,
67
+ href: o.href,
68
+ target: o.target,
69
+ rel: o.target === "_blank" ? "noopener noreferrer" : void 0,
70
+ title: p(o.label),
71
+ onClick: o.onClick,
72
+ children: D
73
+ }
74
+ ) : /* @__PURE__ */ r(
75
+ "button",
76
+ {
77
+ id: I,
78
+ type: "button",
79
+ className: j,
80
+ disabled: B,
81
+ title: p(o.label),
82
+ onClick: o.onClick,
83
+ children: D
84
+ }
85
+ ), U = z.map((e, l) => {
86
+ const m = i(
87
+ t.item,
88
+ e.disabled && t.itemDisabled,
89
+ e.danger && t.itemDanger,
90
+ s?.item
91
+ ), _ = (W) => {
92
+ e.onClick?.(W), f();
93
+ };
94
+ return e.href && !e.disabled ? /* @__PURE__ */ r(
95
+ "a",
96
+ {
97
+ role: "menuitem",
98
+ className: m,
99
+ href: e.href,
100
+ target: e.target,
101
+ rel: e.target === "_blank" ? "noopener noreferrer" : void 0,
102
+ title: p(e.label),
103
+ onClick: _,
104
+ children: e.label
105
+ },
106
+ l
107
+ ) : /* @__PURE__ */ r(
108
+ "button",
109
+ {
110
+ type: "button",
111
+ role: "menuitem",
112
+ className: m,
113
+ disabled: e.disabled,
114
+ title: p(e.label),
115
+ onClick: _,
116
+ children: e.label
117
+ },
118
+ l
119
+ );
120
+ }), V = { sm: t.menuSm, md: t.menuMd, lg: t.menuLg }[O], A = (e) => /* @__PURE__ */ r(
121
+ "div",
122
+ {
123
+ ref: u,
124
+ id: M,
125
+ className: i(
126
+ t.menu,
127
+ V,
128
+ n && t.menuOpen,
129
+ v === "left" ? t.alignLeft : t.alignRight,
130
+ s?.menu
131
+ ),
132
+ style: e,
133
+ role: "menu",
134
+ children: U
135
+ }
136
+ );
137
+ return /* @__PURE__ */ N(
138
+ "div",
139
+ {
140
+ ref: H,
141
+ className: i(t.root, s?.root, G),
142
+ style: y !== void 0 ? { maxWidth: y, ...x } : x,
143
+ children: [
144
+ /* @__PURE__ */ N("div", { ref: C, className: i(t.group, s?.group), children: [
145
+ T,
146
+ a && /* @__PURE__ */ r(
147
+ "button",
148
+ {
149
+ ref: E,
150
+ type: "button",
151
+ className: i(
152
+ P,
153
+ h.iconOnly,
154
+ t.toggle,
155
+ n && t.toggleOpen,
156
+ Q,
157
+ s?.toggle
158
+ ),
159
+ disabled: w,
160
+ onClick: J,
161
+ "aria-haspopup": "menu",
162
+ "aria-expanded": n,
163
+ "aria-controls": n ? M : void 0,
164
+ "aria-label": K,
165
+ children: /* @__PURE__ */ r(
166
+ "svg",
167
+ {
168
+ className: i(t.chevron, n && t.chevronOpen, s?.chevron),
169
+ viewBox: "0 0 10 6",
170
+ "aria-hidden": "true",
171
+ children: /* @__PURE__ */ r("path", { d: "M1 1l4 4 4-4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
172
+ }
173
+ )
174
+ }
175
+ )
176
+ ] }),
177
+ a && !k && A(),
178
+ a && k && n && typeof document < "u" && $(
179
+ A({
180
+ position: "fixed",
181
+ top: d.top,
182
+ left: v === "right" ? void 0 : d.left,
183
+ // clientWidth, not innerWidth: `right` on a fixed element is
184
+ // measured from the viewport edge inside the scrollbar, while
185
+ // innerWidth includes it — the menu would shift left by the
186
+ // scrollbar width whenever the page scrolls.
187
+ right: v === "right" ? document.documentElement.clientWidth - (d.left + d.width) : void 0,
188
+ width: d.width,
189
+ zIndex: "var(--crk-z-floating)"
190
+ }),
191
+ document.body
192
+ )
193
+ ]
194
+ }
195
+ );
196
+ }
197
+ );
198
+ ne.displayName = "SplitButton";
199
+ export {
200
+ ne as SplitButton
201
+ };
@@ -0,0 +1,57 @@
1
+ const n = "crk-root-WQNOC", e = "crk-group-vpjIZ", t = "crk-main-rC6D1", i = "crk-mainContent-ztmsF", c = "crk-mainLabel-nGrtw", r = "crk-sizer-PLveG", o = "crk-sizerItem-dwWwd", m = "crk-mainAttached-AhE-l", s = "crk-toggle-yVTi-", a = "crk-mainOpen-7hEXl", l = "crk-toggleOpen-56O29", g = "crk-dividerOnFill-HLKeu", k = "crk-dividerSubtle-g-TfH", u = "crk-overlapOutline-yWbkD", d = "crk-chevron-4zed5", O = "crk-chevronOpen-7vOPn", p = "crk-menu-2ijiM", v = "crk-menuOpen-hANn0", h = "crk-menuSm-WBQSi", L = "crk-menuMd-xjRTT", b = "crk-menuLg-rXDWh", D = "crk-alignLeft-aXK9A", z = "crk-alignRight-ANsBn", A = "crk-item-rolo0", S = "crk-itemDisabled-A7T-8", f = "crk-itemDanger-g19Qe", C = {
2
+ root: n,
3
+ group: e,
4
+ main: t,
5
+ mainContent: i,
6
+ mainLabel: c,
7
+ sizer: r,
8
+ sizerItem: o,
9
+ mainAttached: m,
10
+ toggle: s,
11
+ mainOpen: a,
12
+ toggleOpen: l,
13
+ dividerOnFill: g,
14
+ dividerSubtle: k,
15
+ overlapOutline: u,
16
+ chevron: d,
17
+ chevronOpen: O,
18
+ menu: p,
19
+ menuOpen: v,
20
+ menuSm: h,
21
+ menuMd: L,
22
+ menuLg: b,
23
+ alignLeft: D,
24
+ alignRight: z,
25
+ item: A,
26
+ itemDisabled: S,
27
+ itemDanger: f
28
+ };
29
+ export {
30
+ D as alignLeft,
31
+ z as alignRight,
32
+ d as chevron,
33
+ O as chevronOpen,
34
+ C as default,
35
+ g as dividerOnFill,
36
+ k as dividerSubtle,
37
+ e as group,
38
+ A as item,
39
+ f as itemDanger,
40
+ S as itemDisabled,
41
+ t as main,
42
+ m as mainAttached,
43
+ i as mainContent,
44
+ c as mainLabel,
45
+ a as mainOpen,
46
+ p as menu,
47
+ b as menuLg,
48
+ L as menuMd,
49
+ v as menuOpen,
50
+ h as menuSm,
51
+ u as overlapOutline,
52
+ n as root,
53
+ r as sizer,
54
+ o as sizerItem,
55
+ s as toggle,
56
+ l as toggleOpen
57
+ };
@@ -0,0 +1,2 @@
1
+ export { SplitButton } from './SplitButton';
2
+ export type { SplitButtonProps, SplitButtonClasses, SplitButtonAction } from './SplitButton';