@kolkrabbi/kol-component 0.379.0 → 0.381.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 +4 -4
- package/src/atoms/Badge.jsx +1 -5
- package/src/atoms/Button.jsx +4 -11
- package/src/atoms/Input.jsx +2 -6
- package/src/atoms/Pill.jsx +1 -3
- package/src/atoms/ProgressBar.jsx +3 -6
- package/src/atoms/SectionLabel.jsx +0 -22
- package/src/atoms/Tag.jsx +4 -7
- package/src/atoms/Textarea.jsx +1 -5
- package/src/atoms/ToggleCheckbox.jsx +3 -5
- package/src/atoms/ToggleSwitch.jsx +2 -7
- package/src/atoms/ViewToggle.jsx +0 -27
- package/src/index.js +1 -1
- package/src/molecules/AccountMenu.jsx +2 -2
- package/src/molecules/ButtonGroup.jsx +5 -14
- package/src/molecules/ButtonSplit.jsx +12 -26
- package/src/molecules/ContentRow.jsx +1 -29
- package/src/molecules/ContextMenu.jsx +0 -1
- package/src/molecules/DocsToc.jsx +1 -16
- package/src/molecules/Dropdown.jsx +4 -17
- package/src/molecules/EmptyState.jsx +1 -15
- package/src/molecules/FieldPair.jsx +1 -1
- package/src/molecules/Header.jsx +4 -4
- package/src/molecules/IndexRow.jsx +1 -1
- package/src/molecules/InlineAddRow.jsx +2 -2
- package/src/molecules/LabeledControl.jsx +5 -11
- package/src/molecules/LayerRow.jsx +1 -1
- package/src/molecules/LinkAddRow.jsx +5 -7
- package/src/molecules/Menu.jsx +11 -30
- package/src/molecules/MenuFloat.jsx +6 -12
- package/src/molecules/MenuList.jsx +5 -11
- package/src/molecules/Modal.jsx +16 -48
- package/src/molecules/ModalHeader.jsx +12 -20
- package/src/molecules/ModalShell.jsx +4 -7
- package/src/molecules/NoticeBanner.jsx +1 -1
- package/src/molecules/PanelsMenu.jsx +2 -2
- package/src/molecules/PasswordInput.jsx +1 -1
- package/src/molecules/QuantityInput.jsx +2 -18
- package/src/molecules/QuickLookFrame.jsx +2 -31
- package/src/molecules/RailHeader.jsx +11 -20
- package/src/molecules/ReadingActions.jsx +2 -2
- package/src/molecules/ReadingNotes.jsx +3 -3
- package/src/molecules/ReadingSettings.jsx +8 -8
- package/src/molecules/SearchInput.jsx +4 -5
- package/src/molecules/SectionText.jsx +2 -9
- package/src/molecules/SettingsControls.jsx +23 -23
- package/src/molecules/Slider.jsx +3 -54
- package/src/molecules/SpecList.jsx +1 -21
- package/src/molecules/TabsRow.jsx +6 -50
- package/src/molecules/TaskRow.jsx +2 -2
- package/src/molecules/TocRow.jsx +1 -1
- package/src/molecules/WorkspaceSwitcher.jsx +3 -6
- package/src/organisms/CommandOverlay.jsx +16 -116
- package/src/organisms/ContentFilters.jsx +4 -12
- package/src/organisms/MediaLibrary.jsx +0 -55
- package/src/organisms/NavRail.jsx +1 -4
- package/src/organisms/ReadingContents.jsx +2 -2
- package/src/organisms/ReadingOverview.jsx +5 -5
- package/src/organisms/ReadingPanel.jsx +1 -1
- package/src/organisms/SettingsPanel.jsx +19 -40
- package/src/organisms/Table.jsx +1 -49
- package/src/utilities/Popover.jsx +2 -4
- package/src/utilities/SelectionOverlay.jsx +1 -45
- package/src/molecules/FloatModuleHeader.jsx +0 -11
- package/src/organisms/NavRailFloat.jsx +0 -139
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.381.0",
|
|
4
4
|
"description": "The core component library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"embla-carousel-react": "^8.6.0",
|
|
33
33
|
"pdfjs-dist": "^6.3.289",
|
|
34
34
|
"react-syntax-highlighter": "^16.1.1",
|
|
35
|
-
"@kolkrabbi/kol-
|
|
35
|
+
"@kolkrabbi/kol-tuner": "^0.1.0",
|
|
36
36
|
"@kolkrabbi/kol-markdown": "^0.2.0",
|
|
37
|
-
"@kolkrabbi/kol-
|
|
38
|
-
"@kolkrabbi/kol-
|
|
37
|
+
"@kolkrabbi/kol-search": "^0.3.0",
|
|
38
|
+
"@kolkrabbi/kol-growth": "^0.5.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@kolkrabbi/kol-icons": ">=0.69.0",
|
package/src/atoms/Badge.jsx
CHANGED
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Converted from Badge.tsx (shadcn/CVA) → plain JSX with kol- CSS variables.
|
|
5
5
|
* CSS classes live in components.css under 2-LABELS → Badges.
|
|
6
|
-
*
|
|
7
|
-
* `variant="float"` (float-everything W2 row 18, 2026-11-04): the count capsule — 26 tall, 10 in, Inter 500 on
|
|
8
|
-
* oq-16 — `3 effects`. The status tones keep today's look.
|
|
9
6
|
*/
|
|
10
7
|
|
|
11
8
|
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
@@ -22,8 +19,7 @@ const VARIANT_MAP = {
|
|
|
22
19
|
outline: 'kol-badge-outline',
|
|
23
20
|
success: 'kol-badge-success',
|
|
24
21
|
warning: 'kol-badge-warning',
|
|
25
|
-
info: 'kol-badge-info'
|
|
26
|
-
float: 'kol-badge-float'
|
|
22
|
+
info: 'kol-badge-info'
|
|
27
23
|
}
|
|
28
24
|
|
|
29
25
|
const SIZE_MAP = {
|
package/src/atoms/Button.jsx
CHANGED
|
@@ -15,7 +15,7 @@ import { InTooltipKolbox, Tooltip } from '../utilities/Popover.jsx'
|
|
|
15
15
|
*
|
|
16
16
|
* @param {Object} props
|
|
17
17
|
* @param {ReactNode} props.children - Button content
|
|
18
|
-
* @param {'accent'|'danger'|'nav'|'tab'|'tab-filled'|'bare'} props.variant - `bare` is a pressable surface with no button chrome (a tile, a bar row — the caller draws it). The intent; the GROUND is `tone`. `tab` is the tab chip (2026-10-02): quiet text at rest, a soft filled chip while `pressed`. `tab-filled` (2026-10-29) shows its chip at rest (oq-04), brighter on hover (oq-08) and brightest selected (oq-16). `
|
|
18
|
+
* @param {'accent'|'danger'|'nav'|'tab'|'tab-filled'|'bare'} props.variant - `bare` is a pressable surface with no button chrome (a tile, a bar row — the caller draws it). The intent; the GROUND is `tone`. `tab` is the tab chip (2026-10-02): quiet text at rest, a soft filled chip while `pressed`. `tab-filled` (2026-10-29) shows its chip at rest (oq-04), brighter on hover (oq-08) and brightest selected (oq-16). `primary · secondary · outline · ghost · grey · control` are deprecated aliases of tones (2026-10-01, on the retirement ledger): pass `tone` — `secondary` is `tone="inverted"`, `control` is `tone="ghost"`, the rest keep their name. Visual variant. UNSET (the default) inherits the tone of the nearest `kol-tone-*` wrapper, else renders primary; the five ground variants are aliases of `tone`. `danger` is the destructive treatment (--ui-error fill); `nav` is the chrome rung — transparent, oq-64 ink, one step brighter than `ghost`; `control` is an alias for `ghost` (legacy call-sites).
|
|
19
19
|
* @param {'xs'|'sm'|'md'|'lg'} props.size - Button size (default: 'md'); xs is the panel rung (ControlsXsRung, 2026-09-01) — kol-mono-8 in a 22px shell (20 icon-only), opt-in by prop
|
|
20
20
|
* @param {string} props.iconLeft - Icon name to display on the left
|
|
21
21
|
* @param {string} props.iconRight - Icon name to display on the right
|
|
@@ -41,7 +41,7 @@ import { InTooltipKolbox, Tooltip } from '../utilities/Popover.jsx'
|
|
|
41
41
|
* @param {'kolbox'} props.variant - also `kolbox` (plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18): kolbox's button, `--kol-kolbox-ctl` high (24), 12 in, radius 4, a 1px line, Inter 12 / 16 / 500, one size. Its grounds are tones: `primary` the accent with the on-accent ink (110% brightness on hover), `secondary` (also unset) the oq-16 field with the oq-24 line (the line's oq-24 on hover), `ghost` bare in oq-64 (the field and the ink on hover); `pressed` is its lit look (the accent tint, the accent ink) and sets aria-pressed. `iconLeft` is a 16 glyph 8 off the label. With `iconOnly` it is kolbox's icon button: a 28 box, the glyph in oq-64, the ink on hover over a 28 oq-16 frame drawn centred on the glyph, so a caller may set a 16 or 24 box and the frame still lights 28; `pressed` lights the frame in the accent tint with the accent glyph; `aria-pressed` is always set; `children` stand in for a glyph that is not an icon. The glyph is your icons by the set's name at 16 with the stroke lift (`.kol-kolbox-icon`, KolboxGlyph); `iconComponent` is not read here (C9.2: kolbox's data carries the set's names).
|
|
42
42
|
* @param {'folio'} props.variant - also `folio` (Folio migration batch A, 2026-11-22): Folio's buttons carried class for class, the chrome in kol-theme `.kol-btn--folio` and `.kol-icon-btn--folio`, the colors Folio's (`--kol-folio-*`). `size` picks the shape: `md` (default) Folio's editor tool, 32 high, 10 in, radius 3, Inter 11, a 16 `iconLeft` 8 off the label; `lg` Folio's page action, 42 high, 16 in, radius 3, a 1px line, the label 12 / 600 and its `glyph` (a character, 16) 12 after it. Grounds are tones: `ghost` (md's default) bare in the ink, the surface on hover; `outline` (lg's default) the paper with the rule line; `primary` the accent fill with the paper ink. `pressed` is its lit look (the accent's soft ground and strong ink) and sets aria-pressed. With `iconOnly` it is Folio's tool icon: a 32 square at radius 4, the glyph 20, the paper on hover, lit when `pressed`. A press does not take the focus (`mousedown` is prevented), so the editor's selection stays.
|
|
43
43
|
* @param {string} props.glyph - folio `lg` only: the character after the label (`+`, `⌄`, `→`)
|
|
44
|
-
* @param {string} props.kbd - a key cap after the label, inside the button (float-everything W2 row 12, 2026-11-04): `Kbd size="sm"`, a leading ⌘ drawn as the `command` icon.
|
|
44
|
+
* @param {string} props.kbd - a key cap after the label, inside the button (float-everything W2 row 12, 2026-11-04): `Kbd size="sm"`, a leading ⌘ drawn as the `command` icon.
|
|
45
45
|
*/
|
|
46
46
|
const warned = new Set()
|
|
47
47
|
/* kolbox's grounds, by KOL's tone names; unset is its secondary. `outline` the line with no fill (Figma's browser
|
|
@@ -162,12 +162,7 @@ const Button = ({
|
|
|
162
162
|
// button is a solo glyph in a pinned square, so it takes SOLO (16/20/24) —
|
|
163
163
|
// it took the text-adjacent ladder until component 0.20.0, which put a 14px
|
|
164
164
|
// glyph in a 28px square at `sm`. `iconSize` still overrides either.
|
|
165
|
-
|
|
166
|
-
/* …except a chevron or caret: LAW 9 (the user, 2026-11-12: *"USE 12px chevron"*), the float chevron token per size
|
|
167
|
-
(12 · 12 · 16, touch 14 · 14 · 18), the same as the Dropdown and the fold. Only when every glyph is one. */
|
|
168
|
-
const glyphs = [iconOnly, iconLeft, iconRight].filter(Boolean)
|
|
169
|
-
const chevronOnly = glyphs.length > 0 && glyphs.every((g) => /^(chevron|caret)/.test(g))
|
|
170
|
-
const resolvedIconSize = iconSize ?? (variant === 'float' ? (chevronOnly ? `var(--kol-float-chev-${size === 'lg' ? 'lg' : size === 'md' ? 'md' : 'sm'})` : 'var(--kol-float-ic)') : glyphSize(size, Boolean(iconOnly)))
|
|
165
|
+
const resolvedIconSize = iconSize ?? glyphSize(size, Boolean(iconOnly))
|
|
171
166
|
|
|
172
167
|
// `control` is a legacy alias for `ghost` (kept so web call-sites passing
|
|
173
168
|
// variant="control" keep working post-migration).
|
|
@@ -191,7 +186,7 @@ const Button = ({
|
|
|
191
186
|
warned.add(variant)
|
|
192
187
|
console.warn(`Button: variant="${variant}" is deprecated — use tone="${VARIANT_TONE[variant]}"`)
|
|
193
188
|
}
|
|
194
|
-
const KNOWN = ['primary', 'secondary', 'accent', 'outline', 'ghost', 'nav', 'tab', 'tab-filled', 'danger', 'grey'
|
|
189
|
+
const KNOWN = ['primary', 'secondary', 'accent', 'outline', 'ghost', 'nav', 'tab', 'tab-filled', 'danger', 'grey']
|
|
195
190
|
const known = !resolvedVariant || KNOWN.includes(resolvedVariant)
|
|
196
191
|
if (!known && import.meta.env.DEV) console.warn(`Button: unknown variant "${resolvedVariant}" — rendering the inherited tone (primary)`)
|
|
197
192
|
const variantClass = resolvedVariant && known ? `kol-btn-${resolvedVariant}` : ''
|
|
@@ -226,8 +221,6 @@ const Button = ({
|
|
|
226
221
|
/* `tone="sunken"` (ControlToneSunken, 2026-08-28): the dark well + fg-96 ink of the control set, so an
|
|
227
222
|
* icon-only button beside a sunken Dropdown is declared, not painted (kol-website hand-wrote the fill
|
|
228
223
|
* AND guessed the ink — the secondary's dark ink vanished on the forced dark fill). Theme rules. */
|
|
229
|
-
/* `tone="danger"` is the float's destructive role (W0.5): the danger bundle is a variant's, worn here as a tone so
|
|
230
|
-
* `variant="float"` keeps the shape slot */
|
|
231
224
|
const toneCls = tone === 'danger' ? 'kol-btn-danger' : toneClass(tone)
|
|
232
225
|
const combinedClass = `kol-btn ${variantClass} ${sizeClass} ${animateClass} ${quietClass} ${pressedClass} ${iconOnlyClass} ${radiusClass} ${toneCls} ${className}`.trim().replace(/\s+/g, ' ')
|
|
233
226
|
|
package/src/atoms/Input.jsx
CHANGED
|
@@ -11,9 +11,6 @@ import { glyphSize } from '../hooks/glyphLadders.js'
|
|
|
11
11
|
* variant="outline" — bordered, transparent bg — THE secondary
|
|
12
12
|
* treatment (2026-07-08 chrome law: one
|
|
13
13
|
* secondary, always subordinate to filled)
|
|
14
|
-
* variant="float" — the floating style (round 3, W16 2026-10-31): a capsule on the float's well
|
|
15
|
-
* (`--kol-float-well`), 16 in, sm · md · lg 28 · 36 · 44 (touch 36 · 44 · 52) with
|
|
16
|
-
* 12 · 13 · 14 (13 · 15 · 16) type; AccountForm's box passes it
|
|
17
14
|
* variant="kolbox" — kolbox's field (plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18), carried class
|
|
18
15
|
* for class: the oq-16 fill, no outline. `size` sm (its default) the 28 field, radius 4,
|
|
19
16
|
* 8 in, 4 between, the value JetBrains Mono 12 / 16, the accent line inside the box when
|
|
@@ -83,8 +80,7 @@ import { glyphSize } from '../hooks/glyphLadders.js'
|
|
|
83
80
|
* sat OUTSIDE the field as a second control). Not aria-hidden: it is a control.
|
|
84
81
|
* error — the field's error (float-everything W3 row 36, 2026-11-04): `true` marks it (`aria-invalid`, the
|
|
85
82
|
* alert-triangle in the error ink at the trailing edge); a string is also the message under the field, in
|
|
86
|
-
* the
|
|
87
|
-
* (the 2px ring) and disabled (40%); on the default look the mark and the message are the same.
|
|
83
|
+
* the hint role with the info glyph.
|
|
88
84
|
*
|
|
89
85
|
* Chrome (bg/border/padding/transition/disabled) comes from .kol-control;
|
|
90
86
|
* Input owns prefix/suffix/icon layout + the inner <input> styling.
|
|
@@ -273,7 +269,7 @@ export default function Input({
|
|
|
273
269
|
/* the error: a mark inside, a message under (row 36) */
|
|
274
270
|
const errorMark = error ? <span aria-hidden="true" className="kol-control-error flex items-center shrink-0 pl-2 text-[var(--ui-error)]"><IconLoader name="alert-triangle" size={14} /></span> : null
|
|
275
271
|
const errorText = typeof error === 'string' && error ? (
|
|
276
|
-
<span role="alert" className={`flex items-center gap-1.5
|
|
272
|
+
<span role="alert" className={`flex items-center gap-1.5 kol-mono-10 text-fg-64`}>
|
|
277
273
|
<IconLoader name="info" size={12} />{error}
|
|
278
274
|
</span>
|
|
279
275
|
) : null
|
package/src/atoms/Pill.jsx
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
* @param {Object} props
|
|
20
20
|
* @param {string} props.children - Text content of the pill
|
|
21
|
-
* @param {string} props.variant - Visual variant: 'primary' | 'secondary' | 'inverse' (deprecated aliases: 'subtle' → primary, 'outline' → secondary) (default: 'primary')
|
|
21
|
+
* @param {string} props.variant - Visual variant: 'primary' | 'secondary' | 'inverse' (deprecated aliases: 'subtle' → primary, 'outline' → secondary) (default: 'primary')
|
|
22
22
|
* @param {string} props.size - Size variant: 'sm' | 'md' | 'lg' (default: 'sm')
|
|
23
23
|
* @param {string} props.className - Additional classes for customization
|
|
24
24
|
*/
|
|
@@ -27,12 +27,10 @@ const Pill = ({ children, variant = 'primary', size = 'sm', className = '' }) =>
|
|
|
27
27
|
primary: 'pill-subtle',
|
|
28
28
|
secondary: 'pill-outline',
|
|
29
29
|
inverse: 'pill-inverse',
|
|
30
|
-
float: 'pill-float',
|
|
31
30
|
/* deprecated aliases (pre-2026-07-30 vocabulary) */
|
|
32
31
|
subtle: 'pill-subtle',
|
|
33
32
|
outline: 'pill-outline'
|
|
34
33
|
}
|
|
35
|
-
if (variant === 'float') return <span className={`pill-float ${className}`.trim()}>{children}</span>
|
|
36
34
|
|
|
37
35
|
const sizeClasses = {
|
|
38
36
|
sm: 'pill-sm',
|
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
* @param {number} max default 100
|
|
8
8
|
* @param {boolean|ReactNode|Function} caption `true` → `value/max`; a node; or `(value, max) => node`; omit for none
|
|
9
9
|
* @param {'success'|'warning'|'error'|'info'} tone the fill's colour (default the ink)
|
|
10
|
-
* @param {'float'} variant the float track (float-everything W2 row 31, 2026-11-04): the float slider's 3px capsule,
|
|
11
|
-
* oq-16 under fg-64; the caption in the float label role
|
|
12
10
|
*
|
|
13
11
|
* The track is the Slider's (2026-11-07): `.kol-track` / `.kol-track-run` in kol-theme read the same tokens the range
|
|
14
12
|
* inputs do, so a ProgressBar and a Slider at the same variant draw one track. A tone sets `--kol-track-run`.
|
|
@@ -16,16 +14,15 @@
|
|
|
16
14
|
*/
|
|
17
15
|
const TONE = { success: 'var(--ui-success)', warning: 'var(--ui-warning)', error: 'var(--ui-error)', info: 'var(--ui-info)' }
|
|
18
16
|
|
|
19
|
-
export default function ProgressBar({ value = 0, max = 100, caption, tone,
|
|
17
|
+
export default function ProgressBar({ value = 0, max = 100, caption, tone, ariaLabel, className = '' }) {
|
|
20
18
|
const pct = max > 0 ? Math.max(0, Math.min(100, (value / max) * 100)) : 0
|
|
21
19
|
const text = caption === true ? `${value}/${max}` : typeof caption === 'function' ? caption(value, max) : caption
|
|
22
|
-
const float = variant === 'float'
|
|
23
20
|
return (
|
|
24
21
|
<div className={`flex flex-col gap-1 ${className}`.trim()}>
|
|
25
|
-
<div role="progressbar" aria-valuenow={value} aria-valuemin={0} aria-valuemax={max} aria-label={ariaLabel} className=
|
|
22
|
+
<div role="progressbar" aria-valuenow={value} aria-valuemin={0} aria-valuemax={max} aria-label={ariaLabel} className="kol-track">
|
|
26
23
|
<div className="kol-track-run transition-[width] duration-300" style={{ width: `${pct}%`, ...(TONE[tone] && { '--kol-track-run': TONE[tone] }) }} />
|
|
27
24
|
</div>
|
|
28
|
-
{text != null && text !== false && <span className=
|
|
25
|
+
{text != null && text !== false && <span className="kol-mono-10 text-meta">{text}</span>}
|
|
29
26
|
</div>
|
|
30
27
|
)
|
|
31
28
|
}
|
|
@@ -3,37 +3,15 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
|
3
3
|
/**
|
|
4
4
|
* SectionLabel — A section's name with its arrow.
|
|
5
5
|
*
|
|
6
|
-
* `variant="float"` (float-everything W5 row 68, 2026-11-04 — kol-float--style 46:1976): a rail section's header on the
|
|
7
|
-
* float — the name in `kol-float-label` on fg-64, rendered as authored (`APPEARANCE`), and, when `onAdd` is given, a +
|
|
8
|
-
* at the far end (14, oq-64, bright under the pointer) that adds an item to the section. No arrow, no rule.
|
|
9
|
-
*
|
|
10
6
|
* @param {ReactNode} text
|
|
11
7
|
* @param {'sm'|'md'|'lg'} [size='md'] the default look's size
|
|
12
|
-
* @param {'float'} [variant]
|
|
13
|
-
* @param {Function} [onAdd] float: the + control
|
|
14
|
-
* @param {string} [addLabel] float: the +'s accessible name (default `Add`)
|
|
15
8
|
* @param {string} [className]
|
|
16
9
|
*/
|
|
17
10
|
export default function SectionLabel({
|
|
18
11
|
text,
|
|
19
12
|
size = 'md',
|
|
20
|
-
variant,
|
|
21
|
-
onAdd,
|
|
22
|
-
addLabel = 'Add',
|
|
23
13
|
className = ''
|
|
24
14
|
}) {
|
|
25
|
-
if (variant === 'float') {
|
|
26
|
-
return (
|
|
27
|
-
<div className={`flex h-4 w-full items-center justify-between gap-2 ${className}`.trim()}>
|
|
28
|
-
<span className="kol-float-label truncate text-fg-64">{text}</span>
|
|
29
|
-
{onAdd && (
|
|
30
|
-
<button type="button" aria-label={addLabel} onClick={onAdd} className="inline-flex size-5 shrink-0 items-center justify-center rounded-full text-oq-64 hover:text-oq-96 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] cursor-pointer">
|
|
31
|
-
<IconLoader name="plus" size={14} />
|
|
32
|
-
</button>
|
|
33
|
-
)}
|
|
34
|
-
</div>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
15
|
// Size variants: sm (16px), md (20px), lg (32px).
|
|
38
16
|
// Migrated off the deleted legacy kol-label-* family (2026-07-15): current
|
|
39
17
|
// helper/heading classes, no text-transform — labels render as authored.
|
package/src/atoms/Tag.jsx
CHANGED
|
@@ -35,13 +35,13 @@ const PALETTE = new Set(['blue', 'teal', 'green', 'yellow', 'red', 'orange', 'pu
|
|
|
35
35
|
*
|
|
36
36
|
* @param {ReactNode} children label content
|
|
37
37
|
* @param {string} text content fallback when no children (brand SwatchControls)
|
|
38
|
-
* @param {string} variant 'primary' | 'secondary' | 'inverse' · `tertiary` = secondary's fill, no outline, mono at fg-80 (2026-08-27)
|
|
38
|
+
* @param {string} variant 'primary' | 'secondary' | 'inverse' · `tertiary` = secondary's fill, no outline, mono at fg-80 (2026-08-27)
|
|
39
39
|
* @param {string} size 'xs' | 'sm' | 'md' | 'lg' — `sm` is the default and
|
|
40
40
|
* should stay the answer; `lg` needs a reason
|
|
41
41
|
* @param {boolean} active selected state (filter chips)
|
|
42
|
-
* @param {boolean} hash prepend `#` (default true
|
|
42
|
+
* @param {boolean} hash prepend `#` (default true); false for plain labels
|
|
43
43
|
* @param {string} icon leading icon name
|
|
44
|
-
* @param {number|string} count a count after the label (
|
|
44
|
+
* @param {number|string} count a count after the label (row 56): mono, one step down
|
|
45
45
|
* @param {Function} onRemove renders the dismiss affordance
|
|
46
46
|
* @param {Function} onClick makes it a <button>
|
|
47
47
|
*/
|
|
@@ -80,10 +80,7 @@ export default function Tag({
|
|
|
80
80
|
inverse: 'kol-tag--inverse',
|
|
81
81
|
/* secondary's fill, no outline, the mono voice at fg-80 (TagTertiary, 2026-08-27) */
|
|
82
82
|
tertiary: 'kol-tag--tertiary',
|
|
83
|
-
/* the float capsule (W2 row 17, 2026-11-04) */
|
|
84
|
-
float: 'kol-tag--float',
|
|
85
83
|
}
|
|
86
|
-
const float = variant === 'float'
|
|
87
84
|
|
|
88
85
|
/* TYPE COMES FROM THE HELPER RAMP (user ruling 2026-08-01). The size classes
|
|
89
86
|
* hardcoded font-size + font-weight and set no line-height, so a 10px chip
|
|
@@ -116,7 +113,7 @@ export default function Tag({
|
|
|
116
113
|
onClick={onClick}
|
|
117
114
|
>
|
|
118
115
|
{icon && <IconLoader name={icon} size={iconSize} />}
|
|
119
|
-
<span>{hash
|
|
116
|
+
<span>{hash ? '#' : ''}{content}</span>
|
|
120
117
|
{count != null && <span className="kol-tag-count">{count}</span>}
|
|
121
118
|
{onRemove && (
|
|
122
119
|
<span
|
package/src/atoms/Textarea.jsx
CHANGED
|
@@ -8,9 +8,6 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
|
8
8
|
* variant="filled" (default) — persistent solid bg
|
|
9
9
|
* variant="ghost" — legacy alias, resolves to outline
|
|
10
10
|
* variant="outline" — bordered, transparent bg
|
|
11
|
-
* variant="float" — the note field (float-everything W3 row 42, 2026-11-04): the float well on the
|
|
12
|
-
* sheet radius (`--kol-float-menu-r`), Inter 500 at the md float type, 12 / 16 in;
|
|
13
|
-
* the grip stays, the focus ring is the float's
|
|
14
11
|
* variant="kolbox" — kolbox's field (plan-2026-11-18-kolbox-system W31.2, 2026-11-18), carried class for
|
|
15
12
|
* class: a bare <textarea> filling its row (flex-1), the field's oq-16 fill, an oq-24 line,
|
|
16
13
|
* radius 4, 8 by 4 in, JetBrains Mono 12 / 16 in the ink, the accent line while focused,
|
|
@@ -65,8 +62,7 @@ export default function Textarea({
|
|
|
65
62
|
`kol-control--${resolvedVariant}`,
|
|
66
63
|
'kol-control--textarea',
|
|
67
64
|
`kol-control-${size}`,
|
|
68
|
-
|
|
69
|
-
resolvedVariant !== 'float' && SIZE_TYPE[size],
|
|
65
|
+
SIZE_TYPE[size],
|
|
70
66
|
'relative block w-full',
|
|
71
67
|
className,
|
|
72
68
|
].filter(Boolean).join(' ')
|
|
@@ -5,13 +5,11 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
|
5
5
|
* media frame the unchecked hairline vanished over a photo; this variant's
|
|
6
6
|
* UNCHECKED box carries the media control's solid plate (`--kol-oq-12`) so it
|
|
7
7
|
* reads over any image. Checked stays the white plate + black check.
|
|
8
|
-
* `variant="float"` (float-everything W2 row 22, 2026-11-04): an 18 plate on oq-08 with no hairline; checked is the
|
|
9
|
-
* bare check glyph on nothing; the label is the float panel role (Inter 13/500); focus ring on the plate, disabled 40%.
|
|
10
8
|
* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2, 2026-11-18), carried class for class: a 16 box at radius 4 in a
|
|
11
9
|
* 28 hit box, unchecked the field's oq-16 fill with an oq-24 line, checked the accent fill and line with your icons'
|
|
12
10
|
* `check` at 12 in the on-accent ink; no label of its own (name it with `aria-label`; a row labels it), a role="checkbox"
|
|
13
11
|
* button with aria-checked, the focus ring the accent's. Chrome in kol-theme `.kol-toggle-checkbox--kolbox`. */
|
|
14
|
-
const VARIANT_CLASS = { media: 'toggle-checkbox--media'
|
|
12
|
+
const VARIANT_CLASS = { media: 'toggle-checkbox--media' }
|
|
15
13
|
const ToggleCheckbox = ({
|
|
16
14
|
label,
|
|
17
15
|
checked = false,
|
|
@@ -59,9 +57,9 @@ const ToggleCheckbox = ({
|
|
|
59
57
|
<polyline points="1 5 4 8 11 1" fill="none" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" />
|
|
60
58
|
</svg>
|
|
61
59
|
</span>
|
|
62
|
-
<span className={`toggle-checkbox-label
|
|
60
|
+
<span className={`toggle-checkbox-label kol-helper-12 tracking-[0.08em]`}>
|
|
63
61
|
{label}
|
|
64
|
-
{hint ? <span className={`ml-2 opacity-60 tracking-normal
|
|
62
|
+
{hint ? <span className={`ml-2 opacity-60 tracking-normal kol-helper-10`}>{hint}</span> : null}
|
|
65
63
|
</span>
|
|
66
64
|
</label>
|
|
67
65
|
)
|
|
@@ -6,9 +6,6 @@ import React from 'react'
|
|
|
6
6
|
* variant="bare" (default) — label + track, no box
|
|
7
7
|
* variant="primary" — filled shell (surface-secondary), button geometry
|
|
8
8
|
* variant="outline" — bordered shell (border-oq-16), button geometry
|
|
9
|
-
* variant="float" — the float switch (float-everything W2 row 21, 2026-11-04): a 32 × 20 track with a 14
|
|
10
|
-
* thumb 3 in, off oq-16 / oq-64, on fg-64 / the emphasis ink, the label in Inter 500;
|
|
11
|
-
* one size, the focus ring on the track, disabled 40%
|
|
12
9
|
* variant="kolbox" — kolbox's switch (plan-2026-11-18-kolbox-system W31.2, 2026-11-18), carried class for class:
|
|
13
10
|
* a 28 × 16 track with a 12 knob 2 in, inside a 28-high hit box at radius 4; off the oq-24
|
|
14
11
|
* track and the ink knob, on the accent track and the on-accent knob; one size, no label
|
|
@@ -88,14 +85,12 @@ const ToggleSwitch = ({
|
|
|
88
85
|
}
|
|
89
86
|
|
|
90
87
|
const resolvedVariant = LEGACY_VARIANTS[variant] || variant
|
|
91
|
-
const float = resolvedVariant === 'float'
|
|
92
88
|
|
|
93
89
|
const cls = [
|
|
94
90
|
'toggle-switch',
|
|
95
91
|
`toggle-switch--${resolvedVariant}`,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
!float && SIZE_TYPE[size],
|
|
92
|
+
`toggle-switch--${size}`,
|
|
93
|
+
SIZE_TYPE[size],
|
|
99
94
|
className,
|
|
100
95
|
].filter(Boolean).join(' ')
|
|
101
96
|
|
package/src/atoms/ViewToggle.jsx
CHANGED
|
@@ -15,10 +15,6 @@ import { Tooltip } from '../utilities/Popover.jsx'
|
|
|
15
15
|
* option's label; active = on (kol-control--filled),
|
|
16
16
|
* inactive = off (bare text). Use for compact on/off
|
|
17
17
|
* where a segmented two-button toggle is overkill.
|
|
18
|
-
* variant="float" — the float rounds (float-everything W2 row 35, 2026-11-04): each option a 32 circle, 4 apart,
|
|
19
|
-
* no well; a glyph (`icon`, 16) or a label (Inter 11/500 — a page number); the lit one fg-16
|
|
20
|
-
* on the emphasis ink, the rest fg-64 with an fg-08 hover; the float focus ring. Pagination and
|
|
21
|
-
* the view switch are one shape.
|
|
22
18
|
*
|
|
23
19
|
* Built on the .kol-control shell. Default options use grid / list-bullet
|
|
24
20
|
* icons; consumers can pass `options` to override. `iconVariant` picks the
|
|
@@ -54,29 +50,6 @@ const ViewToggle = ({
|
|
|
54
50
|
const isIconVariant = variant === 'icon'
|
|
55
51
|
const isSingleVariant = variant === 'single'
|
|
56
52
|
|
|
57
|
-
if (variant === 'float') {
|
|
58
|
-
return (
|
|
59
|
-
<div className={`kol-view-toggle--float inline-flex items-center gap-1 ${className}`.trim()}>
|
|
60
|
-
{options.map((option) => {
|
|
61
|
-
const active = option.onClick ? !!option.pressed : viewMode === option.value
|
|
62
|
-
const button = (
|
|
63
|
-
<button
|
|
64
|
-
key={option.value}
|
|
65
|
-
type="button"
|
|
66
|
-
onClick={option.onClick ?? (() => onViewChange(option.value))}
|
|
67
|
-
aria-label={option.icon ? option.label : undefined}
|
|
68
|
-
aria-pressed={option.onClick && option.pressed == null ? undefined : active}
|
|
69
|
-
className={`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-colors cursor-pointer kol-float-label font-medium ${active ? 'bg-fg-16 text-fg-emphasis' : 'text-fg-64 hover:bg-fg-08 hover:text-fg-emphasis'}`}
|
|
70
|
-
>
|
|
71
|
-
{option.icon ? <IconLoader name={option.icon} size={16} variant={iconVariant} /> : option.label}
|
|
72
|
-
</button>
|
|
73
|
-
)
|
|
74
|
-
return option.icon ? <Tooltip key={option.value} label={option.label}>{button}</Tooltip> : button
|
|
75
|
-
})}
|
|
76
|
-
</div>
|
|
77
|
-
)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
53
|
if (isSingleVariant) {
|
|
81
54
|
const [offOpt, onOpt] = options
|
|
82
55
|
const isOn = viewMode === onOpt.value
|
package/src/index.js
CHANGED
|
@@ -58,7 +58,6 @@ export { default as Input } from './atoms/Input.jsx'
|
|
|
58
58
|
export { default as Label } from './atoms/Label.jsx'
|
|
59
59
|
export { default as LabeledControl } from './molecules/LabeledControl.jsx'
|
|
60
60
|
export { default as RailFloat, default as FloatModule } from './molecules/RailFloat.jsx'
|
|
61
|
-
export { default as FloatModuleHeader } from './molecules/FloatModuleHeader.jsx'
|
|
62
61
|
export { default as OverlayGlassPanel } from './utilities/OverlayGlassPanel.jsx'
|
|
63
62
|
export { default as Pill } from './atoms/Pill.jsx'
|
|
64
63
|
export { usePopover, PopoverPanel, PopoverLayer, Tooltip } from './utilities/Popover.jsx'
|
|
@@ -351,6 +350,7 @@ export { nearestRatio, RATIOS } from './utilities/ratios.js'
|
|
|
351
350
|
export { default as useGrabEdge } from './hooks/useGrabEdge.js'
|
|
352
351
|
export { default as markdownToHtml, inlineToHtml } from './utilities/markdownToHtml.js'
|
|
353
352
|
export { default as formatSize } from './utilities/formatSize.js'
|
|
353
|
+
export { default as imageToDataUrl, pickImage } from './utilities/imageToDataUrl.js'
|
|
354
354
|
export { default as RecordManager } from './organisms/RecordManager.jsx'
|
|
355
355
|
export { default as SpectrumGrid } from './organisms/SpectrumGrid.jsx'
|
|
356
356
|
export { default as Table } from './organisms/Table.jsx'
|
|
@@ -32,9 +32,9 @@ export default function AccountMenu({ initial, src, name = 'Account', items = []
|
|
|
32
32
|
}
|
|
33
33
|
const avatar = (initial || src) ? <Avatar initial={initial} src={src} alt="" size="xs" /> : null
|
|
34
34
|
return (
|
|
35
|
-
<Menu align={align} offset={8} minWidth={200} items={items}
|
|
35
|
+
<Menu align={align} offset={8} minWidth={200} items={items} className={className}
|
|
36
36
|
trigger={({ open, props }) => (
|
|
37
|
-
<MenuTrigger
|
|
37
|
+
<MenuTrigger size={size} open={open} iconOnly="user" iconComponent={avatar ?? undefined} aria-label={name} {...props} />
|
|
38
38
|
)} />
|
|
39
39
|
)
|
|
40
40
|
}
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
*
|
|
21
21
|
* row / stack props:
|
|
22
22
|
* @param {'left'|'center'|'right'|'between'} align horizontal alignment + container layout mode (default 'center'); `between`
|
|
23
|
-
* (2026-11-12, plan-2026-11-12-one-header W6.1) sets the first button at the left and the last at the right — a
|
|
24
|
-
*
|
|
23
|
+
* (2026-11-12, plan-2026-11-12-one-header W6.1) sets the first button at the left and the last at the right — a window's
|
|
24
|
+
* Cancel · Export row
|
|
25
25
|
* @param {string} title optional heading rendered above the group, authored at the call site
|
|
26
26
|
* @param {string} className extra container classes (appended) — note this lands on the OUTER
|
|
27
27
|
* container, not the flex row that carries the gap; the gap is responsive by default (8 stacked,
|
|
@@ -57,10 +57,8 @@
|
|
|
57
57
|
* strip (canvas alignment, transform cluster); onChange is the
|
|
58
58
|
* action dispatch.
|
|
59
59
|
* onChange — handler (newValue) => void
|
|
60
|
-
* options — [{ value, label, ariaLabel?, tooltip?, disabled
|
|
60
|
+
* options — [{ value, label, ariaLabel?, tooltip?, disabled? }] — a cell whose label is not a string
|
|
61
61
|
* (a glyph) shows its `ariaLabel` as a KOL Tooltip; `tooltip` overrides it.
|
|
62
|
-
* `count` (float-everything W2 row 26, 2026-11-04): a number after the label, mono one step down,
|
|
63
|
-
* 12 off the label — `Open 5`; drawn on `variant="float"` (`.kol-seg-count`), ignored elsewhere.
|
|
64
62
|
* `disabled` (kol-fxr 2026-10-09): the cell draws the family's disabled ink
|
|
65
63
|
* (`aria-disabled`, not the attribute — the tooltip still gives the reason),
|
|
66
64
|
* refuses the press, and ←/→ step over it. It may still be the current `value`
|
|
@@ -74,8 +72,6 @@
|
|
|
74
72
|
* outline shell; the inset ring marks ONLY the selected cell) |
|
|
75
73
|
* 'tonal' (filled tiles, but the clicked cell marks itself by
|
|
76
74
|
* TONE — surface-tertiary fill, no ring; 2026-08-12).
|
|
77
|
-
* 'float' (W16, round 3 — 2026-10-31): a capsule track 6 in on its `surface`, pills 4 apart at the
|
|
78
|
-
* float heights (28/36/44, touch 36/44/52), the selected pill filled with the ink.
|
|
79
75
|
* Every other variant renders at the SAME pinned button-ladder
|
|
80
76
|
* height (22/26/32/40) — icon or text, the box never moves.
|
|
81
77
|
* size — mirrors Button exactly: 'sm' (26px, mono-12, 4/12 pad) |
|
|
@@ -89,8 +85,6 @@
|
|
|
89
85
|
* selected cell on `--kol-surface-sunken` / `fg-96`, rest cells as the default paints
|
|
90
86
|
* them; `filled` and `tonal` keep their own selected law. Through `toneClass`, so a
|
|
91
87
|
* `kol-tone-sunken` wrapper reaches it too. Unset = inherit.
|
|
92
|
-
* surface — `variant="float"` only: 'solid' (default) | 'glass-dark' | 'glass-light' — the track's material
|
|
93
|
-
* (`floatSurfaceClass`, kol-theme `.kol-float-*`)
|
|
94
88
|
* ariaLabel — accessible name for the group
|
|
95
89
|
* className — additional classes on the outer shell
|
|
96
90
|
* variant="kolbox" — kolbox's icon group (W31.2 batch 3): `options` `[{ icon, ariaLabel, pressed, onPress }]`, each its
|
|
@@ -100,7 +94,7 @@
|
|
|
100
94
|
* `[{ value, label }]`, the picked cell lit, aria-pressed); without, its tool icons joined (`options`
|
|
101
95
|
* `[{ icon, ariaLabel, pressed, onPress }]`)
|
|
102
96
|
*/
|
|
103
|
-
import { toneClass
|
|
97
|
+
import { toneClass } from '../utilities/tone.js'
|
|
104
98
|
import { Tooltip } from '../utilities/Popover.jsx'
|
|
105
99
|
import Button from '../atoms/Button.jsx'
|
|
106
100
|
|
|
@@ -205,10 +199,9 @@ function JoinedKolboxChoice({ value, onChange, options, ariaLabel, className })
|
|
|
205
199
|
|
|
206
200
|
|
|
207
201
|
/* layout="joined" — the segmented control (SegmentedToggle's implementation, moved here 2026-11-06) */
|
|
208
|
-
function Joined({ value, onChange, options = [], variant = 'default', size = 'md', tone = 'default',
|
|
202
|
+
function Joined({ value, onChange, options = [], variant = 'default', size = 'md', tone = 'default', ariaLabel, className = '' }) {
|
|
209
203
|
if (variant === 'kolbox') return value == null ? <JoinedKolbox options={options} tone={tone} className={className} /> : <JoinedKolboxChoice value={value} onChange={onChange} options={options} ariaLabel={ariaLabel} className={className} />
|
|
210
204
|
if (variant === 'folio') return <JoinedFolio value={value} onChange={onChange} options={options} ariaLabel={ariaLabel} className={className} />
|
|
211
|
-
const float = variant === 'float'
|
|
212
205
|
const cellType = { xs: 'kol-mono-8', sm: 'kol-mono-12', md: 'kol-mono-14', lg: 'kol-mono-16' }[size]
|
|
213
206
|
const stateless = value == null
|
|
214
207
|
const focusIdx = Math.max(0, options.findIndex((opt) => opt.value === value))
|
|
@@ -240,7 +233,6 @@ function Joined({ value, onChange, options = [], variant = 'default', size = 'md
|
|
|
240
233
|
(variant === 'filled' || variant === 'tonal') && 'kol-seg--filled',
|
|
241
234
|
variant === 'tonal' && 'kol-seg--tonal',
|
|
242
235
|
size !== 'md' && `kol-seg--${size}`,
|
|
243
|
-
float && `kol-seg--float ${floatSurfaceClass(surface)}`,
|
|
244
236
|
toneClass(resolvedTone),
|
|
245
237
|
className,
|
|
246
238
|
].filter(Boolean).join(' ')}
|
|
@@ -260,7 +252,6 @@ function Joined({ value, onChange, options = [], variant = 'default', size = 'md
|
|
|
260
252
|
className={['kol-seg-cell', cellType, isActive && 'is-active'].filter(Boolean).join(' ')}
|
|
261
253
|
>
|
|
262
254
|
{opt.label}
|
|
263
|
-
{float && opt.count != null && <span className="kol-seg-count">{opt.count}</span>}
|
|
264
255
|
</button>
|
|
265
256
|
</Tooltip>
|
|
266
257
|
)
|
|
@@ -3,42 +3,32 @@ import Button from '../atoms/Button.jsx'
|
|
|
3
3
|
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
4
4
|
import { PopoverPanel, Tooltip, usePopover } from '../utilities/Popover.jsx'
|
|
5
5
|
import KolboxGlyph from '../utilities/kolboxGlyph.jsx'
|
|
6
|
-
import { floatSurfaceClass } from '../utilities/tone.js'
|
|
7
|
-
import MenuFloatRows from './MenuFloat.jsx'
|
|
8
6
|
import { Menu } from './Menu.jsx'
|
|
9
7
|
|
|
10
|
-
/* taxonomy-ok: molecule — two Buttons (atoms) and a divider, the ⌄ opening a PopoverPanel (utility) of rows
|
|
8
|
+
/* taxonomy-ok: molecule — two Buttons (atoms) and a divider, the ⌄ opening a PopoverPanel (utility) of rows */
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
* ButtonSplit — the main action, a 1px divider and a ⌄ that opens a menu of the other actions (plan-2026-11-12-one-header
|
|
14
|
-
* W4.1; the user: *"its basically 4 exports and 1 open, isnt that just 2 buttons with menufloat?"*).
|
|
12
|
+
* W4.1; the user: *"its basically 4 exports and 1 open, isnt that just 2 buttons with menufloat?"*). The app's square Buttons at `size`, the menu a plain list (SplitToolButton's rows).
|
|
15
13
|
*
|
|
16
|
-
*
|
|
17
|
-
* float the float capsule (`variant="float"`, sm), the menu on the float sheet (`kol-more-sheet-float`): `items` drawn
|
|
18
|
-
* by MenuFloatRows — the one float menu, beside it in kol-component since 2026-11-12 (it lived in kol-shell and
|
|
19
|
-
* was redrawn here). `menu(close)` still replaces the rows
|
|
20
|
-
*
|
|
21
|
-
* `tone` is the Buttons' ground (Button's tones); `grey` is the float well on a float (the secondary look).
|
|
22
|
-
* The ⌄ is 12 (`--kol-float-chev-sm` on a float), never the button's glyph.
|
|
14
|
+
* `tone` is the Buttons' ground (Button's tones).
|
|
23
15
|
*
|
|
24
16
|
* @param {ReactNode} children the main action's label
|
|
25
17
|
* @param {string} [icon] the main action's glyph
|
|
26
18
|
* @param {Function} onClick the main action
|
|
27
19
|
* @param {Array} [items] `[{ label, icon?, onPress, disabled? }]` — the menu's rows
|
|
28
|
-
* @param {Function} [menu] `(close) => ReactNode` — the menu's content instead of `items`
|
|
29
|
-
* @param {'default'|'
|
|
20
|
+
* @param {Function} [menu] `(close) => ReactNode` — the menu's content instead of `items`
|
|
21
|
+
* @param {'default'|'kolbox'|'folio'} [variant='default'] `folio`: Folio's split (see its branch), `tone`
|
|
30
22
|
* primary or unset, `items` on Menu folio; `kolbox`: see the branch below; takes `tone` (primary, secondary), `icon`,
|
|
31
23
|
* `onClick`, `onMenu` (the ⌄'s press; the host opens its menu), `menuLabel`; with `iconOnly`
|
|
32
24
|
* (a glyph name) it is the tool dock's slot: `pressed` the armed look, `tooltip` the
|
|
33
25
|
* main half's tooltip label, `aria-label` the main half's name, `menuOpen` the ⌄'s
|
|
34
26
|
* menu is open (its quiet fill)
|
|
35
|
-
* @param {string} [tone] · {'xs'|'sm'|'md'|'lg'} [size='md']
|
|
27
|
+
* @param {string} [tone] · {'xs'|'sm'|'md'|'lg'} [size='md']
|
|
36
28
|
* @param {boolean} [disabled] the main action off; the menu still opens
|
|
37
29
|
* @param {string} [menuLabel='More actions'] the ⌄'s aria-label
|
|
38
30
|
* @param {string} [placement='bottom-end'] · {string} [className]
|
|
39
31
|
*/
|
|
40
|
-
const WELL = { '--kol-tone-bg': 'var(--kol-float-well)', '--kol-tone-fg': 'var(--kol-surface-on-primary)' }
|
|
41
|
-
|
|
42
32
|
export default function ButtonSplit({ children, icon, onClick, items = [], menu, variant = 'default', tone, size = 'md', disabled = false, menuLabel = 'More actions', placement = 'bottom-end', className = '', onMenu, menuOpen, iconOnly, pressed, tooltip, 'aria-label': ariaLabel }) {
|
|
43
33
|
const [open, setOpen] = useState(false)
|
|
44
34
|
const popover = usePopover({ open, onOpenChange: setOpen, placement, offset: 6, role: 'menu' })
|
|
@@ -96,23 +86,19 @@ export default function ButtonSplit({ children, icon, onClick, items = [], menu,
|
|
|
96
86
|
)
|
|
97
87
|
}
|
|
98
88
|
const close = () => setOpen(false)
|
|
99
|
-
const
|
|
100
|
-
const shared = float
|
|
101
|
-
? { variant: 'float', tone: tone === 'grey' ? undefined : tone, size: 'sm', style: tone === 'grey' ? WELL : undefined }
|
|
102
|
-
: { tone, size }
|
|
89
|
+
const shared = { tone, size }
|
|
103
90
|
const pick = (it) => () => { if (it.disabled) return; it.onPress?.(); close() }
|
|
104
91
|
return (
|
|
105
92
|
<div className={`kol-btn-split inline-flex items-stretch ${className}`.trim()}>
|
|
106
|
-
<Button {...shared} iconLeft={icon} iconSize={
|
|
93
|
+
<Button {...shared} iconLeft={icon} iconSize={12} disabled={disabled} onClick={onClick} className="flex-1 min-w-0 rounded-r-none">{children}</Button>
|
|
107
94
|
<span aria-hidden="true" className="w-px shrink-0 bg-oq-16" />
|
|
108
95
|
<span ref={popover.refs.setReference} {...popover.getReferenceProps()} className="inline-flex">
|
|
109
|
-
<Button {...shared} iconOnly="chevron-down" iconSize={
|
|
110
|
-
className=
|
|
96
|
+
<Button {...shared} iconOnly="chevron-down" iconSize={12} pressed={open} aria-label={menuLabel}
|
|
97
|
+
className="rounded-l-none" />
|
|
111
98
|
</span>
|
|
112
99
|
<PopoverPanel popover={popover} panel={false} focus={false}
|
|
113
|
-
className=
|
|
114
|
-
|
|
115
|
-
{menu ? menu(close) : float ? <MenuFloatRows variant="float" actions={items} onPick={close} /> : items.map((it) => (
|
|
100
|
+
className="w-max bg-surface-secondary border border-oq-08 rounded shadow-lg">
|
|
101
|
+
{menu ? menu(close) : items.map((it) => (
|
|
116
102
|
<button key={it.label} type="button" disabled={it.disabled} onClick={pick(it)}
|
|
117
103
|
className="w-full kol-helper-12 px-3 h-8 flex items-center gap-2 text-body hover:text-emphasis disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:text-body text-left">
|
|
118
104
|
<span className="flex-1 truncate">{it.label}</span>
|
|
@@ -13,9 +13,7 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
|
13
13
|
* 36 square thumb when `media` is passed (none without); article rides a 120px 16:9 thumb; work a framed 64px row; typeface a
|
|
14
14
|
* framed no-thumb block.
|
|
15
15
|
*
|
|
16
|
-
* @param {string} variant file | app | catalog | print | article | work | typeface | roster
|
|
17
|
-
* (`float` = the link row: `title` · `url` · ↗, float-everything W8 row 124 — props
|
|
18
|
-
* `title`, `url`, `href`, `external`, `onClick`, `className`)
|
|
16
|
+
* @param {string} variant file | app | catalog | print | article | work | typeface | roster
|
|
19
17
|
* (`app` = the file row with `verbs` · `menuItems` slotted — AppItem.jsx)
|
|
20
18
|
* (`default` is an alias of `file`). `roster` is the pickable
|
|
21
19
|
* row: filled tile, no border or divider, a FIXED 56px height the
|
|
@@ -157,30 +155,6 @@ const BOX = {
|
|
|
157
155
|
const ALIAS = { default: 'file', print: 'catalog', work: 'showcase', typeface: 'showcaseCanvas' }
|
|
158
156
|
const LAYOUT_KEY = { column: 'showcaseCanvas', line: 'showcase' }
|
|
159
157
|
|
|
160
|
-
/* THE LINK ROW (`variant="float"`, float-everything W8 row 124, 2026-11-04 — kol-float--style 48:3922): title · url · ↗.
|
|
161
|
-
* A link to somewhere else, on the float: the well's ground (`--kol-float-well`) on the list radius, 16 in, the title
|
|
162
|
-
* in `kol-float-hint` at 13 on the emphasis ink over the address in mono (`kol-float-timecode` at 11, fg-64), the
|
|
163
|
-
* `arrow-upright` glyph at the right on oq-64 — bright with the row under the pointer, which lifts the ground fg-08.
|
|
164
|
-
* `url` is shown as given (strip the scheme yourself); `href` defaults to it. Opens in a new tab when `external`
|
|
165
|
-
* (default: the href is absolute). Its own path — none of the variants' box table applies. */
|
|
166
|
-
function ContentRowFloat({ title, url, href = url, external, onClick, className = '' }) {
|
|
167
|
-
const ext = external ?? /^https?:/.test(href ?? '')
|
|
168
|
-
return (
|
|
169
|
-
<a
|
|
170
|
-
href={href}
|
|
171
|
-
onClick={onClick}
|
|
172
|
-
{...(ext ? { target: '_blank', rel: 'noreferrer' } : {})}
|
|
173
|
-
className={`group flex w-full items-center gap-4 rounded-[var(--kol-float-list-r)] bg-[var(--kol-float-well)] px-4 py-3 no-underline hover:bg-fg-08 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] ${className}`.trim()}
|
|
174
|
-
>
|
|
175
|
-
<span className="flex min-w-0 flex-1 flex-col gap-1">
|
|
176
|
-
<span className="kol-float-hint truncate text-fg-emphasis" style={{ fontSize: 13 }}>{title}</span>
|
|
177
|
-
{url && <span className="kol-float-timecode truncate text-fg-64" style={{ fontSize: 11 }}>{url}</span>}
|
|
178
|
-
</span>
|
|
179
|
-
<IconLoader name="arrow-upright" size={16} className="shrink-0 text-oq-64 group-hover:text-oq-96" />
|
|
180
|
-
</a>
|
|
181
|
-
)
|
|
182
|
-
}
|
|
183
|
-
|
|
184
158
|
export default function ContentRow({
|
|
185
159
|
variant: variantProp = 'file',
|
|
186
160
|
layout,
|
|
@@ -225,8 +199,6 @@ export default function ContentRow({
|
|
|
225
199
|
* None of them reach ContentText; an app row's `tags` are the rail's, never chips in the row. */
|
|
226
200
|
const app = useAppItem(variantProp, { title: text.title, verbs: text.verbs, download: text.download, menuItems: text.menuItems, date: text.date, size: text.size, media, back: text.back, tone, tags: text.tags, details: text.details, onTags: text.onTags, note: text.note, onNote: text.onNote, mark: text.mark, onCover: text.onCover, onInsert: text.onInsert, images: text.images, onImages: text.onImages, onBack: text.onBack, row: true })
|
|
227
201
|
delete text.verbs; delete text.download; delete text.menuItems; delete text.details; delete text.onTags; delete text.note; delete text.onNote; delete text.mark; delete text.onCover; delete text.onInsert; delete text.back; delete text.images; delete text.onImages; delete text.onBack
|
|
228
|
-
/* `float` is the link row — its own path, after the hook so the hook order never depends on the variant */
|
|
229
|
-
if (variantProp === 'float') return <ContentRowFloat title={text.title} url={text.url} href={href ?? text.url} external={text.external} onClick={onClick} className={className} />
|
|
230
202
|
if (app) {
|
|
231
203
|
delete text.tags
|
|
232
204
|
variantProp = 'file'
|