@kolkrabbi/kol-component 0.378.0 → 0.380.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 +5 -4
- package/src/atoms/Badge.jsx +1 -5
- package/src/atoms/BezierPathEditor.jsx +1 -1
- package/src/atoms/Button.jsx +88 -12
- package/src/atoms/Figure.jsx +19 -1
- package/src/atoms/FunctionPlot.jsx +1 -1
- package/src/atoms/Input.jsx +107 -7
- package/src/atoms/Kbd.jsx +42 -2
- package/src/atoms/Link.jsx +20 -0
- package/src/atoms/OriginPicker.jsx +9 -5
- package/src/atoms/Pill.jsx +1 -3
- package/src/atoms/ProgressBar.jsx +3 -6
- package/src/atoms/SectionFooter.jsx +22 -0
- package/src/atoms/SectionHeader.jsx +24 -0
- package/src/atoms/SectionLabel.jsx +0 -22
- package/src/atoms/SizeOrDownload.jsx +1 -1
- package/src/atoms/Tag.jsx +4 -7
- package/src/atoms/Textarea.jsx +12 -7
- package/src/atoms/ToggleCheckbox.jsx +25 -5
- package/src/atoms/ToggleSwitch.jsx +41 -7
- package/src/atoms/ViewToggle.jsx +2 -29
- package/src/atoms/XYPad.jsx +25 -0
- package/src/hooks/useDragResize.js +1 -1
- package/src/index.js +26 -4
- package/src/molecules/AccountMenu.jsx +16 -3
- package/src/molecules/AlignmentGrid.jsx +13 -1
- package/src/molecules/ButtonGroup.jsx +78 -15
- package/src/molecules/ButtonSplit.jsx +75 -28
- package/src/molecules/Chip.jsx +26 -0
- package/src/molecules/CodeBlock.jsx +39 -2
- package/src/molecules/ColorInputRow.jsx +125 -4
- package/src/molecules/ColorSwatch.jsx +43 -2
- package/src/molecules/ContentCard.jsx +104 -3
- package/src/molecules/ContentMedia.jsx +1 -1
- package/src/molecules/ContentRow.jsx +4 -32
- package/src/molecules/ContextMenu.jsx +0 -1
- package/src/molecules/DividerLabel.jsx +19 -0
- package/src/molecules/DocsToc.jsx +1 -16
- package/src/molecules/Dropdown.jsx +115 -18
- package/src/molecules/DropdownStepper.jsx +29 -0
- package/src/molecules/EmptyState.jsx +1 -15
- package/src/molecules/FieldPair.jsx +41 -2
- 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 +56 -11
- package/src/molecules/LayerRow.jsx +1 -1
- package/src/molecules/LinkAddRow.jsx +5 -7
- package/src/molecules/Menu.jsx +250 -33
- package/src/molecules/MenuFloat.jsx +6 -12
- package/src/molecules/MenuList.jsx +5 -11
- package/src/molecules/Modal.jsx +228 -55
- package/src/molecules/ModalHeader.jsx +12 -20
- package/src/molecules/ModalShell.jsx +20 -10
- package/src/molecules/NoticeBanner.jsx +1 -1
- package/src/molecules/OptionRow.jsx +1 -1
- package/src/molecules/PanelsMenu.jsx +2 -2
- package/src/molecules/ParamBindDot.jsx +29 -2
- package/src/molecules/PasswordInput.jsx +1 -1
- package/src/molecules/QuantityInput.jsx +45 -13
- package/src/molecules/QuickLookFrame.jsx +2 -31
- package/src/molecules/RailHeader.jsx +37 -16
- 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 +56 -10
- package/src/molecules/SettingsControls.jsx +23 -23
- package/src/molecules/Slider.jsx +103 -55
- package/src/molecules/SpecList.jsx +1 -21
- package/src/molecules/SplitToolButton.jsx +4 -6
- package/src/molecules/SwatchControls.jsx +28 -0
- package/src/molecules/SwatchGrid.jsx +39 -0
- package/src/molecules/TabsDocument.jsx +131 -0
- package/src/molecules/TabsRow.jsx +40 -50
- package/src/molecules/TaskRow.jsx +2 -2
- package/src/molecules/Toast.jsx +55 -0
- package/src/molecules/TocRow.jsx +1 -1
- package/src/molecules/TreeRow.jsx +87 -1
- package/src/molecules/WorkspaceSwitcher.jsx +3 -6
- package/src/organisms/AppItemMenuProvider.jsx +2 -2
- package/src/organisms/ColorPickerPopover.jsx +133 -4
- package/src/organisms/ColumnBrowser.jsx +1 -1
- package/src/organisms/CommandOverlay.jsx +362 -87
- package/src/organisms/ContentFilters.jsx +4 -12
- package/src/organisms/FindBar.jsx +70 -0
- package/src/organisms/FramedMediaBand.jsx +2 -2
- package/src/organisms/GalleryCarousel.jsx +1 -1
- package/src/organisms/LogoSystem.jsx +38 -0
- package/src/organisms/LogoTuner.jsx +32 -0
- package/src/organisms/MediaLibrary.jsx +1 -56
- package/src/organisms/MediaLibraryPages.jsx +1 -1
- package/src/organisms/NavRail.jsx +1 -4
- package/src/organisms/Rail.jsx +33 -1
- package/src/organisms/RailSwitcher.jsx +62 -0
- package/src/organisms/ReadingContents.jsx +65 -3
- package/src/organisms/ReadingOverview.jsx +5 -5
- package/src/organisms/ReadingPanel.jsx +1 -1
- package/src/organisms/SectionSplit.jsx +1 -1
- package/src/organisms/SettingsPanel.jsx +64 -41
- package/src/organisms/ShortcutsOverlay.jsx +46 -2
- package/src/organisms/SpectrumControls.jsx +112 -19
- package/src/organisms/StatusBar.jsx +30 -0
- package/src/organisms/Table.jsx +136 -45
- package/src/organisms/TimelineDock.jsx +281 -1
- package/src/organisms/logoBoard.jsx +61 -0
- package/src/utilities/AssetPlaceholder.jsx +1 -1
- package/src/utilities/EditorShell.jsx +42 -1
- package/src/utilities/OverlayGlassPanel.jsx +1 -1
- package/src/utilities/Popover.jsx +299 -5
- package/src/utilities/SelectionOverlay.jsx +60 -31
- package/src/utilities/kolboxGlyph.jsx +10 -0
- 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.380.0",
|
|
4
4
|
"description": "The core component library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -32,9 +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-tuner": "^0.1.0",
|
|
36
|
+
"@kolkrabbi/kol-markdown": "^0.2.0",
|
|
35
37
|
"@kolkrabbi/kol-search": "^0.3.0",
|
|
36
|
-
"@kolkrabbi/kol-growth": "^0.5.0"
|
|
37
|
-
"@kolkrabbi/kol-markdown": "^0.2.0"
|
|
38
|
+
"@kolkrabbi/kol-growth": "^0.5.0"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
41
|
"@kolkrabbi/kol-icons": ">=0.69.0",
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"react-dom": "^18.3.0 || ^19.0.0"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
|
-
"@kolkrabbi/kol-icons": "^0.
|
|
49
|
+
"@kolkrabbi/kol-icons": "^0.72.0"
|
|
49
50
|
},
|
|
50
51
|
"files": [
|
|
51
52
|
"src",
|
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 = {
|
|
@@ -140,7 +140,7 @@ export default function BezierPathEditor({
|
|
|
140
140
|
ref={ref}
|
|
141
141
|
role="group"
|
|
142
142
|
aria-label={ariaLabel}
|
|
143
|
-
className={`kol-bezier-path-editor relative w-full overflow-hidden touch-none select-none rounded-[var(--kol-radius-
|
|
143
|
+
className={`kol-bezier-path-editor relative w-full overflow-hidden touch-none select-none rounded-[var(--kol-radius-4)] bg-[var(--kol-tone-bg,var(--kol-surface-secondary))] ${className}`.trim()}
|
|
144
144
|
style={{ aspectRatio: String(aspect) }}
|
|
145
145
|
onPointerMove={onMove}
|
|
146
146
|
onPointerUp={onUp}
|
package/src/atoms/Button.jsx
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { isValidElement } from 'react'
|
|
1
|
+
import { isValidElement, useContext } from 'react'
|
|
2
2
|
import { toneClass, VARIANT_TONE } from '../utilities/tone.js'
|
|
3
3
|
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
4
4
|
import { glyphSize } from '../hooks/glyphLadders.js'
|
|
5
5
|
import Kbd from './Kbd.jsx'
|
|
6
|
+
import KolboxGlyph from '../utilities/kolboxGlyph.jsx'
|
|
7
|
+
import { InTooltipKolbox, Tooltip } from '../utilities/Popover.jsx'
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Button — canonical KOL button. Emits kol-btn* classes (CSS in @kol/theme).
|
|
@@ -13,7 +15,7 @@ import Kbd from './Kbd.jsx'
|
|
|
13
15
|
*
|
|
14
16
|
* @param {Object} props
|
|
15
17
|
* @param {ReactNode} props.children - Button content
|
|
16
|
-
* @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).
|
|
17
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
|
|
18
20
|
* @param {string} props.iconLeft - Icon name to display on the left
|
|
19
21
|
* @param {string} props.iconRight - Icon name to display on the right
|
|
@@ -36,9 +38,17 @@ import Kbd from './Kbd.jsx'
|
|
|
36
38
|
* @param {boolean} props.selected - Selected/active state (toggle highlight)
|
|
37
39
|
* @param {ElementType|ReactNode} props.iconComponent - Icon renderer seam — a component that receives `{ name, size, className, style }` in place of the DS Icon (custom icon registries plug in here), or a pre-rendered node dropped in verbatim where the glyph would go. Defaults to DS Icon.
|
|
38
40
|
* @param {boolean} props.pressed - Toggle state — sets `aria-pressed` (true/false) and `kol-btn-pressed`; a `quiet` button drops its dimming while pressed. Leave undefined for non-toggle buttons.
|
|
39
|
-
* @param {
|
|
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
|
+
* @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
|
+
* @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.
|
|
40
45
|
*/
|
|
41
46
|
const warned = new Set()
|
|
47
|
+
/* kolbox's grounds, by KOL's tone names; unset is its secondary. `outline` the line with no fill (Figma's browser
|
|
48
|
+
top bar: Share, the adjust and star boxes, 2026-11-23) */
|
|
49
|
+
const KOLBOX_TONES = ['primary', 'secondary', 'outline', 'ghost']
|
|
50
|
+
/* Folio's three grounds; unset is the shape's own (md ghost, lg outline) */
|
|
51
|
+
const FOLIO_TONES = ['primary', 'outline', 'ghost']
|
|
42
52
|
|
|
43
53
|
const Button = ({
|
|
44
54
|
children,
|
|
@@ -66,8 +76,11 @@ const Button = ({
|
|
|
66
76
|
pressed,
|
|
67
77
|
tone = 'default',
|
|
68
78
|
kbd,
|
|
79
|
+
glyph,
|
|
69
80
|
...props
|
|
70
81
|
}) => {
|
|
82
|
+
/* an icon-only kolbox button names itself in a tooltip unless it already sits in one */
|
|
83
|
+
const inTip = useContext(InTooltipKolbox)
|
|
71
84
|
/* `variant="bare"` (MetricRebuild, 2026-10-31): a pressable SURFACE — a stat tile, a bar row, a column head — that
|
|
72
85
|
* draws itself. No kol-btn chrome (ground, size, type, radius); the button keeps its type, the KOL focus ring
|
|
73
86
|
* (`kol-menu-btn`, as MenuItem's rows) and `disabled`;
|
|
@@ -75,16 +88,81 @@ const Button = ({
|
|
|
75
88
|
if (variant === 'bare') {
|
|
76
89
|
return <button type={type} onClick={onClick} disabled={disabled} className={`kol-menu-btn kol-menu-btn--bare ${className}`.trim()} style={style} {...props}>{children}</button>
|
|
77
90
|
}
|
|
91
|
+
/* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18): kolbox's Button and IconButton carried
|
|
92
|
+
* class for class, the chrome in kol-theme `.kol-btn--kolbox` and `.kol-icon-btn--kolbox`. */
|
|
93
|
+
if (variant === 'kolbox') {
|
|
94
|
+
const on = Boolean(pressed !== undefined ? pressed : selected)
|
|
95
|
+
/* your icons as kolbox draws them (KolboxGlyph: the stroke lift, every chevron 12 at the dock chevron's stroke) */
|
|
96
|
+
const glyph = (name) => <KolboxGlyph name={name} />
|
|
97
|
+
/* IconButton: a box at the kolbox control height (`--kol-kolbox-ctl`, 24) whose hover and pressed fill is its own
|
|
98
|
+
layer (::before) at the same height, centred on the glyph, so a caller's 16 box keeps its size in the layout and
|
|
99
|
+
still lights 24 */
|
|
100
|
+
if (iconOnly) {
|
|
101
|
+
const tip = !inTip && props['aria-label'] && props['aria-hidden'] == null ? props['aria-label'] : null
|
|
102
|
+
const btn = (
|
|
103
|
+
<button
|
|
104
|
+
type={type}
|
|
105
|
+
onClick={onClick}
|
|
106
|
+
disabled={disabled}
|
|
107
|
+
style={style}
|
|
108
|
+
aria-pressed={on}
|
|
109
|
+
className={`kol-icon-btn--kolbox${on ? ' is-pressed' : ''} relative inline-flex size-(--kol-kolbox-ctl) shrink-0 items-center justify-center outline-none focus-visible:outline-solid focus-visible:outline-1 disabled:opacity-40 disabled:pointer-events-none isolate before:absolute before:top-1/2 before:left-1/2 before:-z-10 before:size-(--kol-kolbox-ctl) before:-translate-1/2 before:content-[''] ${className}`}
|
|
110
|
+
{...props}
|
|
111
|
+
>
|
|
112
|
+
{children ?? glyph(iconOnly)}
|
|
113
|
+
</button>
|
|
114
|
+
)
|
|
115
|
+
return tip ? <Tooltip variant="kolbox" asChild label={tip}>{btn}</Tooltip> : btn
|
|
116
|
+
}
|
|
117
|
+
const look = on ? 'lit' : KOLBOX_TONES.includes(tone) ? tone : 'secondary'
|
|
118
|
+
/* the secondary tone is fill only, no border in any state (W15.4, his "I dont like borders with fill") */
|
|
119
|
+
return (
|
|
120
|
+
<button
|
|
121
|
+
type={type}
|
|
122
|
+
onClick={onClick}
|
|
123
|
+
disabled={disabled}
|
|
124
|
+
style={style}
|
|
125
|
+
aria-pressed={pressed}
|
|
126
|
+
className={`kol-btn--kolbox kol-btn--kolbox-${look} inline-flex h-(--kol-kolbox-ctl) shrink-0 items-center justify-center gap-2 ${look === 'secondary' ? 'border-0' : 'border'} px-3 whitespace-nowrap outline-none focus-visible:outline-solid focus-visible:outline-1 focus-visible:outline-offset-1 disabled:opacity-40${look === 'primary' ? ' enabled:hover:brightness-110' : ''} ${className}`}
|
|
127
|
+
{...props}
|
|
128
|
+
>
|
|
129
|
+
{iconLeft && glyph(iconLeft)}
|
|
130
|
+
{children}
|
|
131
|
+
</button>
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
/* `variant="folio"` (Folio migration batch A, 2026-11-22): Folio's Action, Tool and ToolIcon carried class for class
|
|
135
|
+
* (apps/folio parts.jsx, EditorChrome.jsx), the chrome in kol-theme `.kol-btn--folio` and `.kol-icon-btn--folio`. */
|
|
136
|
+
if (variant === 'folio') {
|
|
137
|
+
const on = pressed !== undefined ? pressed : (selected || undefined)
|
|
138
|
+
const keep = (e) => e.preventDefault()
|
|
139
|
+
if (iconOnly) {
|
|
140
|
+
return (
|
|
141
|
+
<button type={type} onMouseDown={keep} onClick={onClick} disabled={disabled} style={style} aria-pressed={on} {...props} className={`kol-icon-btn--folio flex size-[32px] shrink-0 items-center justify-center rounded-[4px] ${className}`}>
|
|
142
|
+
{children ?? <IconLoader name={iconOnly} size={20} />}
|
|
143
|
+
</button>
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
const look = FOLIO_TONES.includes(tone) ? tone : size === 'lg' ? 'outline' : 'ghost'
|
|
147
|
+
if (size === 'lg') {
|
|
148
|
+
return (
|
|
149
|
+
<button type={type} onClick={onClick} disabled={disabled} style={style} aria-pressed={on} {...props} className={`kol-btn--folio kol-btn--folio-lg kol-btn--folio-${look} flex h-[42px] shrink-0 items-center gap-[12px] whitespace-nowrap rounded-[3px] border px-[16px] ${className}`}>
|
|
150
|
+
<span className="kol-btn-label">{children}</span>
|
|
151
|
+
<span className="kol-btn-glyph">{glyph}</span>
|
|
152
|
+
</button>
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
return (
|
|
156
|
+
<button type={type} onMouseDown={keep} onClick={onClick} disabled={disabled} style={style} aria-pressed={on} {...props} className={`kol-btn--folio kol-btn--folio-md kol-btn--folio-${look} flex h-[32px] shrink-0 items-center gap-[8px] whitespace-nowrap rounded-[3px] px-[10px] disabled:opacity-30 ${className}`}>
|
|
157
|
+
{iconLeft && <IconLoader name={iconLeft} size={16} />}{children}
|
|
158
|
+
</button>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
78
161
|
// Two ladders, split on whether a label sits beside the glyph. An icon-only
|
|
79
162
|
// button is a solo glyph in a pinned square, so it takes SOLO (16/20/24) —
|
|
80
163
|
// it took the text-adjacent ladder until component 0.20.0, which put a 14px
|
|
81
164
|
// glyph in a 28px square at `sm`. `iconSize` still overrides either.
|
|
82
|
-
|
|
83
|
-
/* …except a chevron or caret: LAW 9 (the user, 2026-11-12: *"USE 12px chevron"*), the float chevron token per size
|
|
84
|
-
(12 · 12 · 16, touch 14 · 14 · 18), the same as the Dropdown and the fold. Only when every glyph is one. */
|
|
85
|
-
const glyphs = [iconOnly, iconLeft, iconRight].filter(Boolean)
|
|
86
|
-
const chevronOnly = glyphs.length > 0 && glyphs.every((g) => /^(chevron|caret)/.test(g))
|
|
87
|
-
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))
|
|
88
166
|
|
|
89
167
|
// `control` is a legacy alias for `ghost` (kept so web call-sites passing
|
|
90
168
|
// variant="control" keep working post-migration).
|
|
@@ -108,7 +186,7 @@ const Button = ({
|
|
|
108
186
|
warned.add(variant)
|
|
109
187
|
console.warn(`Button: variant="${variant}" is deprecated — use tone="${VARIANT_TONE[variant]}"`)
|
|
110
188
|
}
|
|
111
|
-
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']
|
|
112
190
|
const known = !resolvedVariant || KNOWN.includes(resolvedVariant)
|
|
113
191
|
if (!known && import.meta.env.DEV) console.warn(`Button: unknown variant "${resolvedVariant}" — rendering the inherited tone (primary)`)
|
|
114
192
|
const variantClass = resolvedVariant && known ? `kol-btn-${resolvedVariant}` : ''
|
|
@@ -143,8 +221,6 @@ const Button = ({
|
|
|
143
221
|
/* `tone="sunken"` (ControlToneSunken, 2026-08-28): the dark well + fg-96 ink of the control set, so an
|
|
144
222
|
* icon-only button beside a sunken Dropdown is declared, not painted (kol-website hand-wrote the fill
|
|
145
223
|
* AND guessed the ink — the secondary's dark ink vanished on the forced dark fill). Theme rules. */
|
|
146
|
-
/* `tone="danger"` is the float's destructive role (W0.5): the danger bundle is a variant's, worn here as a tone so
|
|
147
|
-
* `variant="float"` keeps the shape slot */
|
|
148
224
|
const toneCls = tone === 'danger' ? 'kol-btn-danger' : toneClass(tone)
|
|
149
225
|
const combinedClass = `kol-btn ${variantClass} ${sizeClass} ${animateClass} ${quietClass} ${pressedClass} ${iconOnlyClass} ${radiusClass} ${toneCls} ${className}`.trim().replace(/\s+/g, ' ')
|
|
150
226
|
|
package/src/atoms/Figure.jsx
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* @param {string} caption figcaption below the frame
|
|
12
12
|
* @param {string} aspect CSS aspect-ratio value, e.g. '5/3' (default)
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
function FigureDefault({ label, caption, aspect = '5/3', className = '', children }) {
|
|
15
15
|
return (
|
|
16
16
|
<figure className={`kol-prose-figure ${className}`.trim()}>
|
|
17
17
|
{label && <div className="kol-doc-eyebrow mb-2">{label}</div>}
|
|
@@ -25,3 +25,21 @@ export default function Figure({ label, caption, aspect = '5/3', className = '',
|
|
|
25
25
|
</figure>
|
|
26
26
|
)
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
/* folio (Folio batch E, 2026-11-22): Folio's figure, carried from apps/folio's Media.jsx: the image on a hairline at
|
|
30
|
+
* radius 2, as wide as it is or `width` px, its caption 10 under it in Folio's meta type, muted. Spans, not <figure>:
|
|
31
|
+
* an image that shares a line with text sits inside a <p>, where a figure is not allowed. Figure's word: `caption`.
|
|
32
|
+
* Folio's own: `src`, `alt`, `width` (the caller reads them off its Markdown). `data-wide` lets Folio's prose grid run it
|
|
33
|
+
* full width. */
|
|
34
|
+
function FigureFolio({ src, alt, caption, width }) {
|
|
35
|
+
return (
|
|
36
|
+
<span data-wide role="figure" aria-label={caption || undefined} className="kol-figure--folio flex flex-col items-start gap-[10px]">
|
|
37
|
+
<img src={src} alt={alt ?? ''} loading="lazy" className="kol-figure-image max-w-full rounded-[2px] border" style={width ? { width: `${width}px` } : undefined} />
|
|
38
|
+
{caption && <span className="kol-folio-meta kol-figure-caption block">{caption}</span>}
|
|
39
|
+
</span>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default function Figure(props) {
|
|
44
|
+
return props.variant === 'folio' ? <FigureFolio {...props} /> : <FigureDefault {...props} />
|
|
45
|
+
}
|
|
@@ -76,7 +76,7 @@ export default function FunctionPlot({
|
|
|
76
76
|
ref={ref}
|
|
77
77
|
role="img"
|
|
78
78
|
aria-label={ariaLabel}
|
|
79
|
-
className={`kol-function-plot relative w-full overflow-hidden rounded-[var(--kol-radius-
|
|
79
|
+
className={`kol-function-plot relative w-full overflow-hidden rounded-[var(--kol-radius-2)] bg-[var(--kol-oq-04)] ${className}`.trim()}
|
|
80
80
|
style={{ height }}
|
|
81
81
|
>
|
|
82
82
|
{w > 0 && (
|
package/src/atoms/Input.jsx
CHANGED
|
@@ -11,9 +11,23 @@ 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="
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* variant="kolbox" — kolbox's field (plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18), carried class
|
|
15
|
+
* for class: the oq-16 fill, no outline. `size` sm (its default) the 28 field, radius 4,
|
|
16
|
+
* 8 in, 4 between, the value JetBrains Mono 12 / 16, the accent line inside the box when
|
|
17
|
+
* focused; md the rail's search, 32, radius 8, 4 in, 8 between, the value 12 / 16 in the
|
|
18
|
+
* row's family; lg the search modal's field, 44, radius 8, 12 in and between, a 20 glyph,
|
|
19
|
+
* the value Inter 16 / 22 / 500, no ring. `prefix` is the 16 letter slot (mono 12, oq-64),
|
|
20
|
+
* `iconLeft` the glyph, `suffix` a unit (mono 12, oq-64), `slotRight` a node at the right;
|
|
21
|
+
* `hug` sizes the value to its text (a number field, its unit right after it);
|
|
22
|
+
* the glyph is your icons with the stroke lift. The press that focuses the field selects
|
|
23
|
+
* its whole value, a second press places the caret. With `onCommit` (the field's commit,
|
|
24
|
+
* `(text) => void`) it is kolbox's field (`useKolboxField`): Enter or leaving commits a
|
|
25
|
+
* changed value, Escape restores the value from before the edit and leaves, ArrowUp and
|
|
26
|
+
* ArrowDown step a number by 1 (Shift 10) and commit. Chrome in kol-theme `.kol-input--kolbox`.
|
|
27
|
+
* variant="folio" — Folio's field (Folio migration batch A, 2026-11-22), carried class for class: a bare
|
|
28
|
+
* <input> 32 high, 16 in, radius 4, the rule line on the paper, the value JetBrains Mono
|
|
29
|
+
* 12 / 16 in the ink, the accent line focused; no shell, so the slots and `size` are not
|
|
30
|
+
* read and the width is the caller's `className`. Chrome in kol-theme `.kol-input--folio`.
|
|
17
31
|
* tone="inverse" — the dark chip (`fg-ab-24`) for a washed plane
|
|
18
32
|
* (ControlToneInverse, 2026-08-27); same prop on ViewToggle · Dropdown
|
|
19
33
|
* size="xs" — the panel rung (ControlsXsRung, 2026-09-01):
|
|
@@ -66,15 +80,72 @@ import { glyphSize } from '../hooks/glyphLadders.js'
|
|
|
66
80
|
* sat OUTSIDE the field as a second control). Not aria-hidden: it is a control.
|
|
67
81
|
* error — the field's error (float-everything W3 row 36, 2026-11-04): `true` marks it (`aria-invalid`, the
|
|
68
82
|
* alert-triangle in the error ink at the trailing edge); a string is also the message under the field, in
|
|
69
|
-
* the
|
|
70
|
-
* (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.
|
|
71
84
|
*
|
|
72
85
|
* Chrome (bg/border/padding/transition/disabled) comes from .kol-control;
|
|
73
86
|
* Input owns prefix/suffix/icon layout + the inner <input> styling.
|
|
74
87
|
*/
|
|
75
88
|
|
|
89
|
+
/* kolbox: each size's box (radius, fill and type in the theme rule) and its glyph */
|
|
90
|
+
const KOLBOX_SIZE = {
|
|
91
|
+
sm: { box: 'h-(--kol-kolbox-ctl) gap-1 px-2 focus-within:outline-1 focus-within:-outline-offset-1', icon: 16 },
|
|
92
|
+
md: { box: 'h-8 gap-2 px-1 focus-within:outline-1 focus-within:-outline-offset-1', icon: 18 },
|
|
93
|
+
lg: { box: 'h-11 gap-3 px-3', icon: 20 },
|
|
94
|
+
}
|
|
95
|
+
|
|
76
96
|
const SIZE_TYPE = { xs: 'kol-mono-8', sm: 'kol-mono-12', md: 'kol-mono-14', lg: 'kol-mono-16' }
|
|
77
97
|
|
|
98
|
+
/* kolbox's fields: the press that focuses a field selects its whole value; a press in a focused field places the caret.
|
|
99
|
+
A mousedown handler for any kolbox <input> (ColorInputRow's hex and opacity take it too). */
|
|
100
|
+
export function selectOnFirstPress(e) {
|
|
101
|
+
const el = e.currentTarget
|
|
102
|
+
if (e.button !== 0 || document.activeElement === el || el.disabled || el.readOnly) return
|
|
103
|
+
e.preventDefault()
|
|
104
|
+
el.focus()
|
|
105
|
+
el.select()
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* kolbox's arrow step: a number, alone or with a unit after it (12, -4.5, 45°, 50%), moves by `by`; anything else
|
|
109
|
+
(a hex, a word, empty) does not step and gives null */
|
|
110
|
+
const STEPPABLE = /^\s*(-?\d*\.?\d+)\s*(°|%|px|pt|ms|s|x)?\s*$/
|
|
111
|
+
export function stepText(text, by) {
|
|
112
|
+
const m = STEPPABLE.exec(String(text ?? ''))
|
|
113
|
+
if (!m) return null
|
|
114
|
+
const places = (m[1].split('.')[1] ?? '').length
|
|
115
|
+
return `${Number((parseFloat(m[1]) + by).toFixed(places))}${m[2] ?? ''}`
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* kolbox's field behaviour, one place for every kolbox field (Input's own, ColorInputRow's hex and opacity): a draft
|
|
119
|
+
while editing; Enter or leaving commits it, when it differs; Escape puts back the value from before the edit and
|
|
120
|
+
leaves the field; ArrowUp and ArrowDown step a number by 1, with Shift by 10, and commit at once (`step: false`
|
|
121
|
+
for a value that is not a number). `commit(text)` gets the trimmed text. Returns the <input>'s props. */
|
|
122
|
+
export function useKolboxField(value, commit, { step = true } = {}) {
|
|
123
|
+
const shown = value == null ? '' : String(value)
|
|
124
|
+
const [draft, setDraft] = useState(null)
|
|
125
|
+
const live = useRef(null)
|
|
126
|
+
const end = (text) => { live.current = null; setDraft(null); if (text != null && text.trim() !== shown) commit?.(text.trim()) }
|
|
127
|
+
return {
|
|
128
|
+
value: draft ?? shown,
|
|
129
|
+
onChange: (e) => { live.current = e.target.value; setDraft(e.target.value) },
|
|
130
|
+
onBlur: () => end(live.current),
|
|
131
|
+
onKeyDown: (e) => {
|
|
132
|
+
if (e.key === 'Enter') { e.preventDefault(); e.currentTarget.blur() }
|
|
133
|
+
else if (e.key === 'Escape') {
|
|
134
|
+
/* the field takes this Escape: a window or the editor hears the next one */
|
|
135
|
+
e.preventDefault(); e.stopPropagation()
|
|
136
|
+
live.current = null; setDraft(null); e.currentTarget.blur()
|
|
137
|
+
} else if (step && (e.key === 'ArrowUp' || e.key === 'ArrowDown') && !e.metaKey && !e.ctrlKey && !e.altKey) {
|
|
138
|
+
const next = stepText(live.current ?? shown, (e.key === 'ArrowUp' ? 1 : -1) * (e.shiftKey ? 10 : 1))
|
|
139
|
+
if (next == null) return
|
|
140
|
+
e.preventDefault(); e.stopPropagation()
|
|
141
|
+
const el = e.currentTarget
|
|
142
|
+
live.current = null; setDraft(null); commit?.(next)
|
|
143
|
+
requestAnimationFrame(() => { if (document.activeElement === el) el.select() })
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
78
149
|
export default function Input({
|
|
79
150
|
type = 'text',
|
|
80
151
|
value,
|
|
@@ -83,7 +154,7 @@ export default function Input({
|
|
|
83
154
|
variant,
|
|
84
155
|
preset,
|
|
85
156
|
tone = 'default',
|
|
86
|
-
size
|
|
157
|
+
size: sizeProp,
|
|
87
158
|
chars,
|
|
88
159
|
prefix,
|
|
89
160
|
suffix,
|
|
@@ -99,8 +170,11 @@ export default function Input({
|
|
|
99
170
|
width,
|
|
100
171
|
className = '',
|
|
101
172
|
inputClassName = '',
|
|
173
|
+
hug = false,
|
|
102
174
|
...inputProps
|
|
103
175
|
}) {
|
|
176
|
+
/* kolbox's field is its own default size (sm); every other look defaults to md */
|
|
177
|
+
const size = sizeProp ?? (variant === 'kolbox' ? 'sm' : 'md')
|
|
104
178
|
const isNumber = type === 'number'
|
|
105
179
|
const fixedChars = typeof chars === 'number'
|
|
106
180
|
// The text-adjacent ladder — an Input's icon sits in the rung's line box
|
|
@@ -141,6 +215,7 @@ export default function Input({
|
|
|
141
215
|
/* the ref mirrors the draft so a blur that lands in the same tick as the
|
|
142
216
|
* last keystroke commits what was typed, not the last RENDER's draft */
|
|
143
217
|
const draftRef = useRef(value ?? '')
|
|
218
|
+
const kolboxField = useKolboxField(value, onCommit)
|
|
144
219
|
useEffect(() => { if (onCommit) { setDraft(value ?? ''); draftRef.current = value ?? '' } }, [value, onCommit])
|
|
145
220
|
const commitProps = onCommit
|
|
146
221
|
? {
|
|
@@ -164,12 +239,37 @@ export default function Input({
|
|
|
164
239
|
}
|
|
165
240
|
: null
|
|
166
241
|
|
|
242
|
+
/* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18): kolbox's Input carried class for
|
|
243
|
+
* class, the chrome in kol-theme `.kol-input--kolbox`. Its sizes are its three fields: sm the field (`--kol-kolbox-ctl`, 24), md the rail's
|
|
244
|
+
* search (32), lg the search modal's (44). A slot that holds nothing is not drawn, so it takes no space. */
|
|
245
|
+
if (variant === 'kolbox') {
|
|
246
|
+
const k = KOLBOX_SIZE[size] ?? KOLBOX_SIZE.sm
|
|
247
|
+
return (
|
|
248
|
+
<label className={`kol-input--kolbox kol-input--kolbox-${KOLBOX_SIZE[size] ? size : 'sm'} flex min-w-0 items-center has-disabled:opacity-40 ${k.box} ${className}`}>
|
|
249
|
+
{iconLeft && <IconLoader name={iconLeft} size={k.icon} className="kol-input-icon kol-kolbox-icon shrink-0" />}
|
|
250
|
+
{prefix !== undefined && <span className="kol-input-lead w-4 shrink-0">{prefix}</span>}
|
|
251
|
+
<input type={type} value={value} onChange={onChange} placeholder={placeholder} disabled={disabled} className={`kol-input-value min-w-0 ${hug ? 'field-sizing-content' : 'flex-1'} bg-transparent text-left outline-none`} {...inputProps}
|
|
252
|
+
{...(onCommit ? kolboxField : null)}
|
|
253
|
+
onMouseDown={(e) => { inputProps.onMouseDown?.(e); selectOnFirstPress(e) }} />
|
|
254
|
+
{suffix !== undefined && <span className="kol-input-suffix shrink-0">{suffix}</span>}
|
|
255
|
+
{slotRight}
|
|
256
|
+
</label>
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/* `variant="folio"` (Folio migration batch A, 2026-11-22): Folio's text field carried class for class (apps/folio
|
|
261
|
+
* EditorChrome.jsx Input), the bare field with no shell, the chrome in kol-theme `.kol-input--folio`. The width is the
|
|
262
|
+
* caller's `className`. */
|
|
263
|
+
if (variant === 'folio') {
|
|
264
|
+
return <input type={type} value={value} onChange={onChange} placeholder={placeholder} disabled={disabled} {...inputProps} className={`kol-input--folio h-[32px] rounded-[4px] border px-[16px] outline-none ${className}`} />
|
|
265
|
+
}
|
|
266
|
+
|
|
167
267
|
const propertyLen = Math.max(String(value ?? placeholder ?? '').length, 1)
|
|
168
268
|
|
|
169
269
|
/* the error: a mark inside, a message under (row 36) */
|
|
170
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
|
|
171
271
|
const errorText = typeof error === 'string' && error ? (
|
|
172
|
-
<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`}>
|
|
173
273
|
<IconLoader name="info" size={12} />{error}
|
|
174
274
|
</span>
|
|
175
275
|
) : null
|
package/src/atoms/Kbd.jsx
CHANGED
|
@@ -13,6 +13,13 @@
|
|
|
13
13
|
* is a GLYPH, never a typed character in the mono face.
|
|
14
14
|
* It follows the cap: 10 in `sm`, 12 in `md` (2026-10-02 —
|
|
15
15
|
* it was 12 in both, so in the small ⌘K cap the ⌘ outgrew the K)
|
|
16
|
+
* @param {'default'|'kolbox'} variant `kolbox` (plan-2026-11-18-kolbox-system W31.2, 2026-11-18): kolbox's cap carried
|
|
17
|
+
* class for class, the same sizes in kolbox's mono steps (sm 10 / 14, md 12 / 16), no gap; chrome
|
|
18
|
+
* in kol-theme `.kol-kbd--kolbox`.
|
|
19
|
+
* @param {boolean} onAccent kolbox only: on a lit accent row the cap takes the on-accent ink over a 15% wash of it.
|
|
20
|
+
*
|
|
21
|
+
* KbdKeys (a member of Kbd): a drawn shortcut ('⌘⇧S') split into one cap per key, each modifier its own and the rest
|
|
22
|
+
* one key; ⌘ is the `command` glyph. `keys`, `size`, `onAccent`, `variant`, `className`.
|
|
16
23
|
*/
|
|
17
24
|
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
18
25
|
|
|
@@ -21,12 +28,26 @@ const SIZE = {
|
|
|
21
28
|
md: 'h-5 min-w-5 px-1.5 kol-helper-12',
|
|
22
29
|
}
|
|
23
30
|
const GLYPH = { sm: 10, md: 12 }
|
|
31
|
+
/* kolbox: the same boxes, its type in the theme rule */
|
|
32
|
+
const KOLBOX_SIZE = { sm: 'h-4 min-w-4 px-1', md: 'h-5 min-w-5 px-1.5' }
|
|
24
33
|
|
|
25
|
-
export default function Kbd({ size = 'md', icon, className = '', children, ...rest }) {
|
|
34
|
+
export default function Kbd({ size = 'md', icon, variant = 'default', onAccent = false, className = '', children, ...rest }) {
|
|
35
|
+
if (variant === 'kolbox') {
|
|
36
|
+
return (
|
|
37
|
+
<kbd
|
|
38
|
+
aria-hidden="true"
|
|
39
|
+
className={`kol-kbd--kolbox kol-kbd--kolbox-${size}${onAccent ? ' kol-kbd--kolbox-on-accent' : ''} inline-flex shrink-0 items-center justify-center ${KOLBOX_SIZE[size] ?? KOLBOX_SIZE.md} ${className}`.trim()}
|
|
40
|
+
{...rest}
|
|
41
|
+
>
|
|
42
|
+
{icon && <IconLoader name={icon} size={GLYPH[size] ?? GLYPH.md} className="kol-kolbox-icon shrink-0" />}
|
|
43
|
+
{children}
|
|
44
|
+
</kbd>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
26
47
|
return (
|
|
27
48
|
<kbd
|
|
28
49
|
aria-hidden="true"
|
|
29
|
-
className={`inline-flex items-center justify-center gap-0.5 shrink-0 rounded-[var(--kol-radius-
|
|
50
|
+
className={`inline-flex items-center justify-center gap-0.5 shrink-0 rounded-[var(--kol-radius-2)] bg-oq-08 text-oq-64 ${SIZE[size] ?? SIZE.md} ${className}`.trim()}
|
|
30
51
|
{...rest}
|
|
31
52
|
>
|
|
32
53
|
{icon && <IconLoader name={icon} size={GLYPH[size] ?? GLYPH.md} />}
|
|
@@ -34,3 +55,22 @@ export default function Kbd({ size = 'md', icon, className = '', children, ...re
|
|
|
34
55
|
</kbd>
|
|
35
56
|
)
|
|
36
57
|
}
|
|
58
|
+
|
|
59
|
+
/* '⌘⇧S' → ['⌘', '⇧', 'S'] */
|
|
60
|
+
const keysOf = (s) => {
|
|
61
|
+
const m = String(s).match(/^[⌘⇧⌥⌃]*/)[0]
|
|
62
|
+
const rest = String(s).slice(m.length)
|
|
63
|
+
return [...m, ...(rest ? [rest] : [])]
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function KbdKeys({ keys, size, onAccent, variant, className = '' }) {
|
|
67
|
+
return (
|
|
68
|
+
<span aria-hidden className={`inline-flex shrink-0 items-center gap-0.5 ${className}`} data-keys={keys}>
|
|
69
|
+
{keysOf(keys).map((k, i) => (
|
|
70
|
+
k === '⌘'
|
|
71
|
+
? <Kbd key={i} size={size} variant={variant} onAccent={onAccent} icon="command" />
|
|
72
|
+
: <Kbd key={i} size={size} variant={variant} onAccent={onAccent}>{k}</Kbd>
|
|
73
|
+
))}
|
|
74
|
+
</span>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Link — A text action in the link color. a button drawn as a link: a short action inside a line of text, a toast's
|
|
3
|
+
* "Show in …" or a share sheet's "Copy link" (kolbox's Link, Figma 188:20997, carried class for class:
|
|
4
|
+
* plan-2026-11-18-kolbox-system W31.2, 2026-11-18). Size 11 on a 15 line in the link color, no underline until hover,
|
|
5
|
+
* one line; the family and weight are the row's. The focus ring is the accent's. Chrome in kol-theme `.kol-link`.
|
|
6
|
+
*
|
|
7
|
+
* <Link onClick={reveal}>Show in folder</Link>
|
|
8
|
+
*
|
|
9
|
+
* A link that navigates is an <a>; this is an action, so it is a button.
|
|
10
|
+
*
|
|
11
|
+
* @param {ReactNode} children - The words
|
|
12
|
+
* @param {string} [className] - Extra classes on the button
|
|
13
|
+
*/
|
|
14
|
+
export default function Link({ children, className = '', ...rest }) {
|
|
15
|
+
return (
|
|
16
|
+
<button type="button" className={`kol-link shrink-0 whitespace-nowrap outline-none hover:underline focus-visible:outline-solid focus-visible:outline-1 ${className}`} {...rest}>
|
|
17
|
+
{children}
|
|
18
|
+
</button>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
@@ -9,9 +9,12 @@ const pointName = (xi, yi) => (xi === 1 && yi === 1 ? 'center' : `${X_NAME[xi]}
|
|
|
9
9
|
/* box padding + cell + dot per rung: 2·pad + 3·cell = the field's height (22 · 26 · 32; touch 32 · 32 · 36).
|
|
10
10
|
* The xs touch lift skips a hardware panel, as Input's does. */
|
|
11
11
|
const SIZE = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
/* 2xs: the 16 icon slot a rail row's third cell takes (kolbox, plan-2026-11-18-kolbox-system W31.2): nine 4 dots 2 apart,
|
|
13
|
+
* no ground and no touch lift, as an icon has none */
|
|
14
|
+
'2xs': 'gap-0.5 [--op-cell:4px] [--op-dot:4px] [--kol-tone-bg:transparent] rounded-[var(--kol-radius-2)]',
|
|
15
|
+
xs: 'p-[2px] [--op-cell:6px] [--op-dot:4px] rounded-[var(--kol-radius-2)] pointer-coarse:not-[.kol-hw-panel_*]:p-px pointer-coarse:not-[.kol-hw-panel_*]:[--op-cell:10px] pointer-coarse:not-[.kol-hw-panel_*]:[--op-dot:6px]',
|
|
16
|
+
sm: 'p-px [--op-cell:8px] [--op-dot:4px] rounded-[var(--kol-radius-4)] pointer-coarse:[--op-cell:10px] pointer-coarse:[--op-dot:6px]',
|
|
17
|
+
md: 'p-px [--op-cell:10px] [--op-dot:6px] rounded-[var(--kol-radius-4)] pointer-coarse:p-[3px]',
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
/**
|
|
@@ -22,7 +25,8 @@ const SIZE = {
|
|
|
22
25
|
* that fires align actions and holds no value; this holds one.
|
|
23
26
|
*
|
|
24
27
|
* ON THE CONTROL RAMP. The square is exactly a field's height at the same `size`, so it sits beside
|
|
25
|
-
* an `Input` without a step: xs 22 · sm 26 · md 32 (touch 32 · 32 · 36, as the fields grow).
|
|
28
|
+
* an `Input` without a step: xs 22 · sm 26 · md 32 (touch 32 · 32 · 36, as the fields grow). Below the ramp, `2xs` is
|
|
29
|
+
* the 16 icon slot (kolbox's rail row, 2026-11-18): nine 4 dots 2 apart on no ground. The
|
|
26
30
|
* ground is the control's (`--kol-tone-bg`, else surface-secondary), so `tone` and a toned wrapper
|
|
27
31
|
* reach it as they reach an Input. No border — the field family has none.
|
|
28
32
|
*
|
|
@@ -36,7 +40,7 @@ const SIZE = {
|
|
|
36
40
|
*
|
|
37
41
|
* @param {[number, number]} value - The selected point `[x, y]`, each 0 · 0.5 · 1 (0 = left / top)
|
|
38
42
|
* @param {(value:[number, number]) => void} onChange - Fired with the new `[x, y]` on click or arrow key
|
|
39
|
-
* @param {'xs'|'sm'|'md'} [size='sm'] - The control rung — the square matches a field of this size
|
|
43
|
+
* @param {'2xs'|'xs'|'sm'|'md'} [size='sm'] - The control rung — the square matches a field of this size; `2xs` is the 16 icon slot
|
|
40
44
|
* @param {string} [tone='default'] - The control set's tone (the ground); default inherits a wrapper's
|
|
41
45
|
* @param {string} [ariaLabel='Origin'] - The group's accessible name
|
|
42
46
|
* @param {string} [className] - Extra classes on the square
|
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
|
}
|