@kolkrabbi/kol-component 0.181.0 → 0.182.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolkrabbi/kol-component",
3
- "version": "0.181.0",
3
+ "version": "0.182.0",
4
4
  "description": "KOL design-system components — atoms through organisms, emitting canonical kol-* classes. Pairs with @kolkrabbi/kol-theme for styling.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,10 +1,11 @@
1
1
  import { useState } from 'react'
2
2
  import { Icon } from '@kolkrabbi/kol-icons'
3
3
  import { PopoverPanel, usePopover } from '../utilities/Popover.jsx'
4
+ import { glyphSize } from '../hooks/glyphLadders.js'
4
5
 
5
6
  /**
6
7
  * SplitToolButton — single-trigger split tool button + variant menu (the
7
- * tool-palette idiom: Select · Text · [Shape ◢] · Pattern). A 28×28
8
+ * tool-palette idiom: Select · Text · [Shape ◢] · Pattern). A pinned-square
8
9
  * quiet/pressed trigger shows the current variant while the group is `active`
9
10
  * (else the `lastPicked` variant) plus a corner fold indicator; ONE click both
10
11
  * arms that variant (`onChange`) and opens the variant menu (floating-ui's own
@@ -14,9 +15,17 @@ import { PopoverPanel, usePopover } from '../utilities/Popover.jsx'
14
15
  * The trigger is a plain `kol-btn` element, not DS Button: Button doesn't
15
16
  * forward refs (the popover must anchor on the real button), can't host the
16
17
  * corner fold inside its own box, and `blurOnClick` must blur the button
17
- * itself. The class output — kol-btn kol-btn-ghost + kol-btn-quiet /
18
- * kol-btn-pressed — is exactly what `<Button variant="ghost" quiet pressed>`
19
- * emits, so the visual contract stays Button's.
18
+ * itself. The class output — kol-btn kol-btn-ghost kol-btn-icon kol-btn-{size}
19
+ * + kol-btn-quiet / kol-btn-pressed — is exactly what
20
+ * `<Button variant="ghost" quiet pressed iconOnly>` emits, so the box and the
21
+ * visual contract stay Button's.
22
+ *
23
+ * `size` was a raw px number (28) with a transcribed 14px glyph until 0.182.0:
24
+ * off the 22 · 26 · 32 · 40 ladder in a set whose whole point is that one row
25
+ * is one box, and the glyph pinned where the SOLO ladder should have decided
26
+ * it. kol-fxr's tool rail hand-rolls this trigger at 36/22 rather than
27
+ * importing it (design-editor-set-is-a-half-port, 2026-09-03) — 36 is not a
28
+ * rung either, and the DS answer to a bespoke 36 is `size="lg"`.
20
29
  *
21
30
  * For a text-trigger single-select use `Dropdown`; for the two-button
22
31
  * action-half + chevron-half split use `ShapeDropdown`.
@@ -27,7 +36,7 @@ import { PopoverPanel, usePopover } from '../utilities/Popover.jsx'
27
36
  * @param {Function} props.onChange - Fires with a variant id — on menu pick, and on trigger click while inactive (arming)
28
37
  * @param {string} props.lastPicked - Variant id the trigger shows while the group is inactive (default: variants[0])
29
38
  * @param {boolean} props.active - Whether this tool group is the active tool — lit trigger, `aria-pressed`
30
- * @param {number} props.size - Trigger box in px (default: 28)
39
+ * @param {'xs'|'sm'|'md'|'lg'} props.size - Trigger box on the pinned-square ladder — 22 · 26 · 32 · 40 (default: 'md'). The glyph follows the SOLO ladder; it is never set at the call site
31
40
  * @param {boolean} props.blurOnClick - Blur the trigger after click so a canvas can reclaim focus and refresh its cursor (default: false)
32
41
  * @param {string} props.aria-label - Trigger label fallback when no variant resolves
33
42
  * @param {string} props.className - Additional classes on the trigger
@@ -54,7 +63,7 @@ const SplitToolButton = ({
54
63
  onChange,
55
64
  lastPicked,
56
65
  active = false,
57
- size = 28,
66
+ size = 'md',
58
67
  blurOnClick = false,
59
68
  className = '',
60
69
  'aria-label': ariaLabel,
@@ -91,13 +100,12 @@ const SplitToolButton = ({
91
100
  ref={popover.refs.setReference}
92
101
  {...popover.getReferenceProps({ onClick: handleTriggerClick })}
93
102
  type="button"
94
- className={`relative kol-btn kol-btn-ghost ${active ? 'kol-btn-pressed' : 'kol-btn-quiet'} ${className}`.trim()}
95
- style={{ width: size, height: size, padding: 6 }}
103
+ className={`relative kol-btn kol-btn-ghost kol-btn-icon kol-btn-${size} ${active ? 'kol-btn-pressed' : 'kol-btn-quiet'} ${className}`.trim()}
96
104
  aria-pressed={active}
97
105
  aria-label={label}
98
106
  title={title}
99
107
  >
100
- {triggerVariant && <Icon name={triggerVariant.icon} size={14} />}
108
+ {triggerVariant && <Icon name={triggerVariant.icon} size={glyphSize(size, true)} />}
101
109
  <FoldIndicator />
102
110
  </button>
103
111
  {/* w-max — floats size to content, the menu-family law (2026-08-09). */}