@kolkrabbi/kol-component 0.378.0 → 0.379.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 -3
- package/src/atoms/BezierPathEditor.jsx +1 -1
- package/src/atoms/Button.jsx +84 -1
- package/src/atoms/Figure.jsx +19 -1
- package/src/atoms/FunctionPlot.jsx +1 -1
- package/src/atoms/Input.jsx +105 -1
- package/src/atoms/Kbd.jsx +42 -2
- package/src/atoms/Link.jsx +20 -0
- package/src/atoms/OriginPicker.jsx +9 -5
- package/src/atoms/SectionFooter.jsx +22 -0
- package/src/atoms/SectionHeader.jsx +24 -0
- package/src/atoms/SizeOrDownload.jsx +1 -1
- package/src/atoms/Textarea.jsx +11 -2
- package/src/atoms/ToggleCheckbox.jsx +23 -1
- package/src/atoms/ToggleSwitch.jsx +39 -0
- package/src/atoms/ViewToggle.jsx +2 -2
- package/src/atoms/XYPad.jsx +25 -0
- package/src/hooks/useDragResize.js +1 -1
- package/src/index.js +26 -3
- package/src/molecules/AccountMenu.jsx +14 -1
- package/src/molecules/AlignmentGrid.jsx +13 -1
- package/src/molecules/ButtonGroup.jsx +73 -1
- package/src/molecules/ButtonSplit.jsx +64 -3
- 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 +3 -3
- package/src/molecules/DividerLabel.jsx +19 -0
- package/src/molecules/Dropdown.jsx +111 -1
- package/src/molecules/DropdownStepper.jsx +29 -0
- package/src/molecules/FieldPair.jsx +41 -2
- package/src/molecules/LabeledControl.jsx +51 -0
- package/src/molecules/Menu.jsx +239 -3
- package/src/molecules/Modal.jsx +214 -9
- package/src/molecules/ModalShell.jsx +18 -5
- package/src/molecules/OptionRow.jsx +1 -1
- package/src/molecules/ParamBindDot.jsx +29 -2
- package/src/molecules/QuantityInput.jsx +48 -0
- package/src/molecules/RailHeader.jsx +32 -2
- package/src/molecules/SectionText.jsx +54 -1
- package/src/molecules/Slider.jsx +101 -2
- 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 +35 -1
- package/src/molecules/Toast.jsx +55 -0
- package/src/molecules/TreeRow.jsx +87 -1
- 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 +396 -21
- 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 -1
- package/src/organisms/MediaLibraryPages.jsx +1 -1
- package/src/organisms/Rail.jsx +33 -1
- package/src/organisms/RailSwitcher.jsx +62 -0
- package/src/organisms/ReadingContents.jsx +63 -1
- package/src/organisms/SectionSplit.jsx +1 -1
- package/src/organisms/SettingsPanel.jsx +45 -1
- 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 +141 -2
- 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 +298 -2
- package/src/utilities/SelectionOverlay.jsx +74 -1
- package/src/utilities/kolboxGlyph.jsx +10 -0
|
@@ -9,6 +9,17 @@ import React from 'react'
|
|
|
9
9
|
* variant="float" — the float switch (float-everything W2 row 21, 2026-11-04): a 32 × 20 track with a 14
|
|
10
10
|
* thumb 3 in, off oq-16 / oq-64, on fg-64 / the emphasis ink, the label in Inter 500;
|
|
11
11
|
* one size, the focus ring on the track, disabled 40%
|
|
12
|
+
* variant="kolbox" — kolbox's switch (plan-2026-11-18-kolbox-system W31.2, 2026-11-18), carried class for class:
|
|
13
|
+
* a 28 × 16 track with a 12 knob 2 in, inside a 28-high hit box at radius 4; off the oq-24
|
|
14
|
+
* track and the ink knob, on the accent track and the on-accent knob; one size, no label
|
|
15
|
+
* (name it with `aria-label`; a row's LabeledControl gives the words), role="switch" with
|
|
16
|
+
* aria-checked, the focus ring the accent's, disabled 40%. Chrome in kol-theme
|
|
17
|
+
* `.kol-toggle-switch--kolbox`.
|
|
18
|
+
*
|
|
19
|
+
* variant="folio" — Folio's switch (Folio migration batch A, 2026-11-22), carried class for class: a 20 × 12
|
|
20
|
+
* track round an 8 knob that travels 8, the hit box 24 high; off the rule track, on the
|
|
21
|
+
* accent, the knob the paper; one size, no label (`aria-label`), role="switch" with
|
|
22
|
+
* aria-checked. Chrome in kol-theme `.kol-toggle-switch--folio`.
|
|
12
23
|
*
|
|
13
24
|
* size="xs" / "sm" / "md" (default) / "lg" — shells match button heights
|
|
14
25
|
* (22/26/32/40); the track scales with size in all variants. xs is the
|
|
@@ -48,6 +59,34 @@ const ToggleSwitch = ({
|
|
|
48
59
|
console.warn('ToggleSwitch: `label` is deprecated — wrap the switch in <LabeledControl horizontal label="…">')
|
|
49
60
|
}
|
|
50
61
|
|
|
62
|
+
if (variant === 'kolbox') {
|
|
63
|
+
return (
|
|
64
|
+
<button
|
|
65
|
+
type="button"
|
|
66
|
+
role="switch"
|
|
67
|
+
aria-checked={checked}
|
|
68
|
+
onClick={handleClick}
|
|
69
|
+
className={`kol-toggle-switch--kolbox inline-flex h-(--kol-kolbox-ctl) shrink-0 items-center px-1 outline-none focus-visible:outline-solid focus-visible:outline-1 disabled:opacity-40 ${className}`}
|
|
70
|
+
data-state={checked ? 'on' : 'off'}
|
|
71
|
+
{...props}
|
|
72
|
+
>
|
|
73
|
+
<span className="kol-toggle-switch-track flex h-4 w-7 items-center rounded-full p-0.5 transition-colors">
|
|
74
|
+
<span className={`kol-toggle-switch-knob size-3 rounded-full transition-transform${checked ? ' translate-x-3' : ''}`} />
|
|
75
|
+
</span>
|
|
76
|
+
</button>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* folio (Folio migration batch A, 2026-11-22): Folio's Switch carried class for class (apps/folio Chrome.jsx) */
|
|
81
|
+
if (variant === 'folio') {
|
|
82
|
+
return (
|
|
83
|
+
<button type="button" role="switch" aria-checked={checked} onClick={handleClick} {...props}
|
|
84
|
+
className={`kol-toggle-switch--folio relative h-[12px] w-[20px] shrink-0 rounded-full transition-colors before:absolute before:inset-x-0 before:top-1/2 before:h-[24px] before:-translate-y-1/2 before:content-[''] ${className}`}>
|
|
85
|
+
<span className={`kol-toggle-switch-knob absolute left-[2px] top-[2px] size-[8px] rounded-full transition-transform ${checked ? 'translate-x-[8px]' : ''}`} />
|
|
86
|
+
</button>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
51
90
|
const resolvedVariant = LEGACY_VARIANTS[variant] || variant
|
|
52
91
|
const float = resolvedVariant === 'float'
|
|
53
92
|
|
package/src/atoms/ViewToggle.jsx
CHANGED
|
@@ -20,7 +20,7 @@ import { Tooltip } from '../utilities/Popover.jsx'
|
|
|
20
20
|
* on the emphasis ink, the rest fg-64 with an fg-08 hover; the float focus ring. Pagination and
|
|
21
21
|
* the view switch are one shape.
|
|
22
22
|
*
|
|
23
|
-
* Built on the .kol-control shell. Default options use grid /
|
|
23
|
+
* Built on the .kol-control shell. Default options use grid / list-bullet
|
|
24
24
|
* icons; consumers can pass `options` to override. `iconVariant` picks the
|
|
25
25
|
* icon cut for variant="icon" ('stroke' default; 'solid' reads better at
|
|
26
26
|
* 14px). For `variant="single"`, the FIRST option in `options` is the "off"
|
|
@@ -47,7 +47,7 @@ const ViewToggle = ({
|
|
|
47
47
|
tone = 'default',
|
|
48
48
|
options = [
|
|
49
49
|
{ value: 'grid', label: 'Grid view', icon: 'grid' },
|
|
50
|
-
{ value: 'list', label: 'List view', icon: '
|
|
50
|
+
{ value: 'list', label: 'List view', icon: 'list-bullet' }
|
|
51
51
|
],
|
|
52
52
|
className = ''
|
|
53
53
|
}) => {
|
package/src/atoms/XYPad.jsx
CHANGED
|
@@ -29,6 +29,9 @@ import { useRef } from 'react'
|
|
|
29
29
|
* @param {Function} onChange - `(x, y) => void` on pointer down and on every move while a button is held — the caller coalesces if it wants one patch per gesture
|
|
30
30
|
* @param {ReactNode} xLabel - Left label above the pad
|
|
31
31
|
* @param {ReactNode} yLabel - Right label above the pad
|
|
32
|
+
* @param {'default'|'kolbox'} [variant='default'] - The look. `kolbox` (plan-2026-11-18-kolbox-system W31.2, 2026-11-18):
|
|
33
|
+
* kolbox's pad carried class for class: no stroke, the field's oq-16 ground at radius 4, 1px oq-24 guides, the puck in
|
|
34
|
+
* the ink, the labels Inter 11 / 15 in oq-64; it also takes `w-full min-w-0`. Chrome in kol-theme `.kol-xy-pad--kolbox`.
|
|
32
35
|
* @param {string} [className] - Extra classes on the wrapper
|
|
33
36
|
*/
|
|
34
37
|
export default function XYPad({
|
|
@@ -38,6 +41,7 @@ export default function XYPad({
|
|
|
38
41
|
onChange,
|
|
39
42
|
xLabel,
|
|
40
43
|
yLabel,
|
|
44
|
+
variant = 'default',
|
|
41
45
|
className = '',
|
|
42
46
|
}) {
|
|
43
47
|
const ref = useRef(null)
|
|
@@ -66,6 +70,27 @@ export default function XYPad({
|
|
|
66
70
|
const puckX = ((xValue - xMin) / span(xMax, xMin)) * 100
|
|
67
71
|
const puckY = (1 - (yValue - yMin) / span(yMax, yMin)) * 100
|
|
68
72
|
|
|
73
|
+
if (variant === 'kolbox') {
|
|
74
|
+
return (
|
|
75
|
+
<div className={`kol-xy-pad--kolbox flex w-full min-w-0 flex-col gap-1 ${className}`.trim()}>
|
|
76
|
+
<div className="kol-xy-pad-labels flex justify-between">
|
|
77
|
+
<span>{xLabel}</span>
|
|
78
|
+
<span>{yLabel}</span>
|
|
79
|
+
</div>
|
|
80
|
+
<div
|
|
81
|
+
ref={ref}
|
|
82
|
+
onPointerDown={onPointerDown}
|
|
83
|
+
onPointerMove={onPointerMove}
|
|
84
|
+
className="kol-xy-pad relative aspect-square w-full cursor-crosshair touch-none"
|
|
85
|
+
>
|
|
86
|
+
<div className="kol-xy-pad-guide absolute inset-x-0 top-1/2 h-px" />
|
|
87
|
+
<div className="kol-xy-pad-guide absolute inset-y-0 left-1/2 w-px" />
|
|
88
|
+
<div className="kol-xy-pad-puck pointer-events-none absolute -mt-1.5 -ml-1.5 size-3 rounded-full" style={{ left: `${puckX}%`, top: `${puckY}%` }} />
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
69
94
|
return (
|
|
70
95
|
<div className={`flex flex-col gap-1 ${className}`.trim()}>
|
|
71
96
|
<div className="flex justify-between kol-helper-10 tracking-widest text-meta">
|
|
@@ -279,7 +279,7 @@ export default function useDragResize(ref, options = {}) {
|
|
|
279
279
|
/* the grid's grid-template-columns ease would trail the pointer —
|
|
280
280
|
* kol-framework.css suspends it while this attribute is stamped */
|
|
281
281
|
root().setAttribute(names.draggingAttr, '')
|
|
282
|
-
document.body.style.cursor = 'col-resize'
|
|
282
|
+
document.body.style.cursor = vertical ? 'row-resize' : 'col-resize'
|
|
283
283
|
document.body.style.userSelect = 'none'
|
|
284
284
|
}
|
|
285
285
|
|
package/src/index.js
CHANGED
|
@@ -23,6 +23,10 @@ export { default as Avatar } from './atoms/Avatar.jsx'
|
|
|
23
23
|
export { default as Badge } from './atoms/Badge.jsx'
|
|
24
24
|
export { default as Button } from './atoms/Button.jsx'
|
|
25
25
|
export { default as CloseButton } from './molecules/CloseButton.jsx'
|
|
26
|
+
/* the shared parts of the type-ramp plan (6.3, 6.8): a tile with a leading slot, and a section's head and foot */
|
|
27
|
+
export { default as Chip } from './molecules/Chip.jsx'
|
|
28
|
+
export { default as SectionHeader } from './atoms/SectionHeader.jsx'
|
|
29
|
+
export { default as SectionFooter } from './atoms/SectionFooter.jsx'
|
|
26
30
|
export { default as ActionButton } from './molecules/ActionButton.jsx'
|
|
27
31
|
export { default as FileIcon } from './atoms/FileIcon.jsx'
|
|
28
32
|
export { default as SizeOrDownload } from './atoms/SizeOrDownload.jsx'
|
|
@@ -31,6 +35,8 @@ export { default as SortControls } from './molecules/SortControls.jsx'
|
|
|
31
35
|
export { default as CopyButton } from './molecules/CopyButton.jsx'
|
|
32
36
|
export { default as CurveOverlay } from './utilities/CurveOverlay.jsx'
|
|
33
37
|
export { default as Divider } from './atoms/Divider.jsx'
|
|
38
|
+
/* a label then a rule to the row's end (kolbox's GroupLabel, plan-2026-11-18-kolbox-system W31.2, 2026-11-18) */
|
|
39
|
+
export { default as DividerLabel } from './molecules/DividerLabel.jsx'
|
|
34
40
|
export { default as DocsToc } from './molecules/DocsToc.jsx'
|
|
35
41
|
export { default as DropdownTagFilter } from './molecules/DropdownTagFilter.jsx'
|
|
36
42
|
export { default as EmptyState } from './molecules/EmptyState.jsx'
|
|
@@ -55,7 +61,7 @@ export { default as RailFloat, default as FloatModule } from './molecules/RailFl
|
|
|
55
61
|
export { default as FloatModuleHeader } from './molecules/FloatModuleHeader.jsx'
|
|
56
62
|
export { default as OverlayGlassPanel } from './utilities/OverlayGlassPanel.jsx'
|
|
57
63
|
export { default as Pill } from './atoms/Pill.jsx'
|
|
58
|
-
export { usePopover, PopoverPanel, Tooltip } from './utilities/Popover.jsx'
|
|
64
|
+
export { usePopover, PopoverPanel, PopoverLayer, Tooltip } from './utilities/Popover.jsx'
|
|
59
65
|
export { floatSurfaceClass, FLOAT_SURFACES } from './utilities/tone.js'
|
|
60
66
|
export { floatMotion, FLOAT_MOTION } from './utilities/motion.js'
|
|
61
67
|
/* armLongPress — the touch hold the panel value controls report (moved from kol-hardware 2026-10-01) */
|
|
@@ -74,7 +80,9 @@ export { default as SegmentedToggle } from './molecules/SegmentedToggle.jsx'
|
|
|
74
80
|
/* a page's variants — the pinned slider button and its panel of segmented rows (OneVariantsControl, 2026-10-29; catalog's) */
|
|
75
81
|
export { default as VariantsControl } from './molecules/VariantsControl.jsx'
|
|
76
82
|
export { default as Stepper } from './molecules/Stepper.jsx'
|
|
77
|
-
export { default as Kbd } from './atoms/Kbd.jsx'
|
|
83
|
+
export { default as Kbd, KbdKeys } from './atoms/Kbd.jsx'
|
|
84
|
+
/* a text action in the link color (kolbox's Link, plan-2026-11-18-kolbox-system W31.2, 2026-11-18) */
|
|
85
|
+
export { default as Link } from './atoms/Link.jsx'
|
|
78
86
|
/* the float parts (float-everything W2 · W3 · W4, 2026-11-04) */
|
|
79
87
|
export { default as Delta } from './atoms/Delta.jsx'
|
|
80
88
|
export { default as LiveDot } from './atoms/LiveDot.jsx'
|
|
@@ -141,6 +149,9 @@ export { default as LayerStack, AddLayerButton, BLEND_MODES } from './organisms/
|
|
|
141
149
|
export { default as StepList } from './molecules/StepList.jsx'
|
|
142
150
|
export { TYPE_LABELS, BOOL_OP_LABELS, SHAPE_KIND_LABELS, labelForLayer, rowLabelForLayer, findLayerDeep } from './hooks/layerTree.js'
|
|
143
151
|
export { default as TimelineDock, sampleTrack, TIMELINE_EASINGS } from './organisms/TimelineDock.jsx'
|
|
152
|
+
/* a document's find bar and status bar, new 2026-11-22 (Folio on kolbox) */
|
|
153
|
+
export { default as FindBar } from './organisms/FindBar.jsx'
|
|
154
|
+
export { default as StatusBar } from './organisms/StatusBar.jsx'
|
|
144
155
|
export { default as CurveEditor, CURVE_KINDS, defaultCurveFor } from './organisms/CurveEditor.jsx'
|
|
145
156
|
export { default as KeyframeEditor, KEYFRAME_EASES, DEFAULT_KEYFRAMES } from './organisms/KeyframeEditor.jsx'
|
|
146
157
|
export { pathD, pathBounds, shiftNode, normalizePath, scalePathNodes, normalizePathRings, rotatePathNodes, dist, nearestSegmentT, splitSegment, smoothNode } from './hooks/pathMath.js'
|
|
@@ -163,6 +174,10 @@ export { default as ColorSwatch } from './molecules/ColorSwatch.jsx'
|
|
|
163
174
|
export { default as SwatchTile } from './molecules/SwatchTile.jsx'
|
|
164
175
|
export { default as SwatchCaption } from './molecules/SwatchCaption.jsx'
|
|
165
176
|
export { default as Dropdown } from './molecules/Dropdown.jsx'
|
|
177
|
+
/* kolbox's DropdownStepper, Toast and SwatchGrid, new 2026-11-18 (plan-2026-11-18-kolbox-system W31.2 batch 4) */
|
|
178
|
+
export { default as DropdownStepper } from './molecules/DropdownStepper.jsx'
|
|
179
|
+
export { default as Toast, toast, ToastHost } from './molecules/Toast.jsx'
|
|
180
|
+
export { default as SwatchGrid } from './molecules/SwatchGrid.jsx'
|
|
166
181
|
/* MultiSelect — several pick-one settings in one dropdown, a column each (2026-10-01, first cut) */
|
|
167
182
|
export { default as MultiSelect } from './molecules/MultiSelect.jsx'
|
|
168
183
|
export { default as FieldRow, StatusChip } from './molecules/FieldRow.jsx'
|
|
@@ -178,7 +193,7 @@ export { default as ContentRow } from './molecules/ContentRow.jsx'
|
|
|
178
193
|
export { default as ContentItem } from './molecules/ContentItem.jsx'
|
|
179
194
|
export { default as ContentCollection } from './organisms/ContentCollection.jsx'
|
|
180
195
|
export { MenuItem, MenuRow, MenuDivider, MenuFlyout, MenuDropdownItem, MenuDropdownDivider, MenuDropdownNest } from './molecules/MenuItem.jsx'
|
|
181
|
-
export { Menu, MenuTrigger, MenuPanel, MenuLabel, MenuFilter, MenuDatePicker, MenuMore } from './molecules/Menu.jsx'
|
|
196
|
+
export { Menu, MenuTrigger, MenuPanel, MenuLabel, MenuFilter, MenuDatePicker, MenuMore, MenuScroll } from './molecules/Menu.jsx'
|
|
182
197
|
export { MenuList } from './molecules/MenuList.jsx'
|
|
183
198
|
export { ModalProvider, useModal, ModalDialog, ModalDialog as Dialog } from './molecules/Modal.jsx'
|
|
184
199
|
export { default as ModalShell } from './molecules/ModalShell.jsx'
|
|
@@ -195,6 +210,7 @@ export { default as PaletteHarmonyWheel } from './molecules/PaletteHarmonyWheel.
|
|
|
195
210
|
export { default as PropertyInput } from './molecules/PropertyInput.jsx'
|
|
196
211
|
export { default as ShapeDropdown } from './molecules/ShapeDropdown.jsx'
|
|
197
212
|
export { default as Rail, RAIL_ROLES, useRailKey } from './organisms/Rail.jsx'
|
|
213
|
+
export { default as RailSwitcher } from './organisms/RailSwitcher.jsx'
|
|
198
214
|
/** @deprecated 2026-10-17 — alias of Rail */
|
|
199
215
|
export { default as ShellDrawer } from './organisms/ShellDrawer.jsx'
|
|
200
216
|
export { default as CommandOverlay } from './organisms/CommandOverlay.jsx'
|
|
@@ -212,6 +228,8 @@ export { default as SplitToolButton } from './molecules/SplitToolButton.jsx'
|
|
|
212
228
|
export { default as ToolPalette } from './organisms/ToolPalette.jsx'
|
|
213
229
|
export { default as DocumentEditor } from './organisms/DocumentEditor.jsx'
|
|
214
230
|
export { default as SwatchControls, SwatchStack, EyedropPick } from './molecules/SwatchControls.jsx'
|
|
231
|
+
/* the open documents' strip: a tab per document, close, unsaved, a plus (Figma's tab strip in kolbox, 2026-11-22) */
|
|
232
|
+
export { default as TabsDocument } from './molecules/TabsDocument.jsx'
|
|
215
233
|
export { default as TabsRow, TABBAR_H, TABBAR_PILL_H, TABBAR_PILL_INSET, TABBAR_PILL_TAB, TABBAR_PILL_GAP, TABBAR_PILL_LABEL_TAB, TABBAR_PILL_SPLIT_GAP, tabbarPillWidth, tabbarPillSlot } from './molecules/TabsRow.jsx'
|
|
216
234
|
/** @deprecated 2026-10-17 — alias of `TabsRow variant="chip"` */
|
|
217
235
|
export { default as TabChips } from './molecules/TabChips.jsx'
|
|
@@ -260,6 +278,11 @@ export { default as FeaturedCarousel } from './organisms/FeaturedCarousel.jsx'
|
|
|
260
278
|
export { default as FeaturesCardSection } from './organisms/FeaturesCardSection.jsx'
|
|
261
279
|
/* the growing line on @kolkrabbi/kol-growth (GrowthLineStage, kol-atlas 2026-10-30) */
|
|
262
280
|
export { default as GrowthLineStage } from './organisms/GrowthLineStage.jsx'
|
|
281
|
+
/* the form tuner's two boards on @kolkrabbi/kol-tuner (W27.4, 2026-11-19) */
|
|
282
|
+
export { default as LogoSystem } from './organisms/LogoSystem.jsx'
|
|
283
|
+
export { default as LogoTuner } from './organisms/LogoTuner.jsx'
|
|
284
|
+
/* the boards' palettes, for a host drawing beside them (a sheet of rolls) */
|
|
285
|
+
export { inksOf as logoInks } from './organisms/logoBoard.jsx'
|
|
263
286
|
/* the app loader's runtime half and its intro claim (LoaderAppIntro, kol-fxr 2026-11-01) — here because GrowthLineStage
|
|
264
287
|
* claims it; kol-framework re-exports it, which stays its documented home */
|
|
265
288
|
export { hideLoaderApp, claimIntro, introClaimed, endIntro, releaseIntro } from './utilities/loaderApp.js'
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Avatar from '../atoms/Avatar.jsx'
|
|
2
2
|
import { Menu, MenuTrigger } from './Menu.jsx'
|
|
3
|
+
import KolboxGlyph from '../utilities/kolboxGlyph.jsx'
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* AccountMenu — The account's circle and its menu. `(A) ⌄ Profile · Settings · Sign out` (float-everything W4 row 60,
|
|
@@ -15,8 +16,20 @@ import { Menu, MenuTrigger } from './Menu.jsx'
|
|
|
15
16
|
* @param {'start'|'end'} [align] default `end`
|
|
16
17
|
* @param {'sm'|'md'|'lg'} [size] the circle (default md)
|
|
17
18
|
* @param {string} [className]
|
|
19
|
+
* @param {'kolbox'} [variant] `kolbox` (plan-2026-11-18-kolbox-system W31.2 batch 4, 2026-11-18): kolbox's AccountChip, the
|
|
20
|
+
* trigger only: the xs Avatar (20) on oq-16 then the 12 chevron in oq-64, 4 apart, the accent's focus line. No menu yet
|
|
21
|
+
* (kolbox has none to open, its no-function list); `items` and `align` are not read. Other props land on the button.
|
|
18
22
|
*/
|
|
19
|
-
export default function AccountMenu({ initial, src, name = 'Account', items = [], align = 'end', size = 'md', className = '' }) {
|
|
23
|
+
export default function AccountMenu({ initial, src, name = 'Account', items = [], align = 'end', size = 'md', className = '', variant, ...rest }) {
|
|
24
|
+
if (variant === 'kolbox') {
|
|
25
|
+
return (
|
|
26
|
+
<button type="button" aria-label={name} aria-haspopup="menu" data-account-chip
|
|
27
|
+
className={`kol-account-chip--kolbox inline-flex shrink-0 items-center gap-1 rounded-full outline-none focus-visible:outline-solid focus-visible:outline-1 focus-visible:outline-offset-1 ${className}`.trim()} {...rest}>
|
|
28
|
+
<Avatar initial={initial} src={src} size="xs" />
|
|
29
|
+
<KolboxGlyph name="chevron-down" size={12} className="kol-account-chip-caret" />
|
|
30
|
+
</button>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
20
33
|
const avatar = (initial || src) ? <Avatar initial={initial} src={src} alt="" size="xs" /> : null
|
|
21
34
|
return (
|
|
22
35
|
<Menu align={align} offset={8} minWidth={200} items={items} variant="float" className={className}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
2
2
|
import ButtonGroup from './ButtonGroup.jsx'
|
|
3
|
+
import FieldPair from './FieldPair.jsx'
|
|
3
4
|
import { glyphSize } from '../hooks/glyphLadders.js'
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -23,6 +24,8 @@ import { glyphSize } from '../hooks/glyphLadders.js'
|
|
|
23
24
|
* @param {Array} items - `[{ axis, mode, icon, title }]` cells (default the standard 6, three per axis)
|
|
24
25
|
* @param {'xs'|'sm'|'md'|'lg'} size - The strips' rung (default 'sm')
|
|
25
26
|
* @param {string} className - Extra classes on the wrapper
|
|
27
|
+
* @param {'kolbox'} [variant] - `kolbox`: kolbox's align row, the X and Y strips as `ButtonGroup layout="joined" variant="kolbox"`
|
|
28
|
+
* side by side in a `FieldPair variant="kolbox"`; `items` carry the set's glyph names
|
|
26
29
|
*/
|
|
27
30
|
const ALIGN_BUTTONS = [
|
|
28
31
|
{ axis: 'h', mode: 'start', icon: 'align-horizontal-left-solid', title: 'Align left' },
|
|
@@ -33,8 +36,17 @@ const ALIGN_BUTTONS = [
|
|
|
33
36
|
{ axis: 'v', mode: 'end', icon: 'align-vertical-bottom-solid', title: 'Align bottom' },
|
|
34
37
|
]
|
|
35
38
|
|
|
36
|
-
export default function AlignmentGrid({ onAlign, items = ALIGN_BUTTONS, size = 'sm', className = '' }) {
|
|
39
|
+
export default function AlignmentGrid({ onAlign, items = ALIGN_BUTTONS, size = 'sm', className = '', variant }) {
|
|
37
40
|
const strip = (axis) => items.filter((b) => b.axis === axis)
|
|
41
|
+
/* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18): kolbox's AlignmentRow carried, the two
|
|
42
|
+
* strips as kolbox icon groups, each filling its cell of a kolbox FieldPair (two cells 8 apart) */
|
|
43
|
+
if (variant === 'kolbox') {
|
|
44
|
+
const group = (axis) => (
|
|
45
|
+
<ButtonGroup layout="joined" variant="kolbox" className="w-full"
|
|
46
|
+
options={strip(axis).map((b) => ({ icon: b.icon, ariaLabel: b.title, onPress: () => onAlign?.(b.axis, b.mode) }))} />
|
|
47
|
+
)
|
|
48
|
+
return <FieldPair variant="kolbox" first={group('h')} second={group('v')} />
|
|
49
|
+
}
|
|
38
50
|
|
|
39
51
|
return (
|
|
40
52
|
<div className={`kol-alignment-grid flex flex-col gap-1 ${className}`.trim()}>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ButtonGroup — the one component for a group of buttons (plan-2026-11-06-buttons-page 2.7; the user,
|
|
3
3
|
* 2026-11-06: *"button group CAN be segmented toggle … just by the fact it wraps multiple buttons"*).
|
|
4
|
-
*
|
|
4
|
+
* Five layouts:
|
|
5
5
|
*
|
|
6
6
|
* layout="row" (default) — a responsive layout wrapper for a group of Buttons: stacked full-width on
|
|
7
7
|
* mobile, a horizontal row from `sm` up, aligned left / center / right. Pure layout —
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
* layout="stack" — the same wrapper, stacked at every width (the row's 8 stacked gap).
|
|
14
14
|
* layout="joined" — the segmented control (was `SegmentedToggle`, kept as its alias on the retirement
|
|
15
15
|
* ledger): joined cells, no gap, built from `options` instead of children. See below.
|
|
16
|
+
* layout="wrap" — the buttons 8 apart in a row that wraps to the next line when its column runs out, full
|
|
17
|
+
* width (kolbox's rail rows, plan-2026-11-18-kolbox-system W31.2, 2026-11-18).
|
|
18
|
+
* layout="grid" — two equal columns 8 apart, full width, so the longest label fits a narrow rail (kolbox's
|
|
19
|
+
* Rolls and randomise rows). wrap and grid take no `align` or `title`; other props land on the box.
|
|
16
20
|
*
|
|
17
21
|
* row / stack props:
|
|
18
22
|
* @param {'left'|'center'|'right'|'between'} align horizontal alignment + container layout mode (default 'center'); `between`
|
|
@@ -89,9 +93,16 @@
|
|
|
89
93
|
* (`floatSurfaceClass`, kol-theme `.kol-float-*`)
|
|
90
94
|
* ariaLabel — accessible name for the group
|
|
91
95
|
* className — additional classes on the outer shell
|
|
96
|
+
* variant="kolbox" — kolbox's icon group (W31.2 batch 3): `options` `[{ icon, ariaLabel, pressed, onPress }]`, each its
|
|
97
|
+
* own action; `tone` unset (cells) or `sunken` (the track). With `value` (Folio on kolbox, 2026-11-22) kolbox's
|
|
98
|
+
* choice that stays, its tab track: `options` `[{ value, label }]`, the picked cell lit, aria-pressed
|
|
99
|
+
* variant="folio" — Folio's (batch A, 2026-11-22), by the state law: with `value` its segmented choice (`options`
|
|
100
|
+
* `[{ value, label }]`, the picked cell lit, aria-pressed); without, its tool icons joined (`options`
|
|
101
|
+
* `[{ icon, ariaLabel, pressed, onPress }]`)
|
|
92
102
|
*/
|
|
93
103
|
import { toneClass, floatSurfaceClass } from '../utilities/tone.js'
|
|
94
104
|
import { Tooltip } from '../utilities/Popover.jsx'
|
|
105
|
+
import Button from '../atoms/Button.jsx'
|
|
95
106
|
|
|
96
107
|
const CONTAINER = {
|
|
97
108
|
left: 'flex flex-col w-full',
|
|
@@ -109,6 +120,9 @@ const JUSTIFY = {
|
|
|
109
120
|
|
|
110
121
|
export default function ButtonGroup({ layout = 'row', align = 'center', title, className = '', children, ...joined }) {
|
|
111
122
|
if (layout === 'joined') return <Joined className={className} {...joined} />
|
|
123
|
+
if (layout === 'wrap' || layout === 'grid') {
|
|
124
|
+
return <div className={`${layout === 'grid' ? 'grid grid-cols-2' : 'flex flex-wrap items-center'} w-full min-w-0 gap-2 ${className}`.trim()} {...joined}>{children}</div>
|
|
125
|
+
}
|
|
112
126
|
return (
|
|
113
127
|
<div className={[CONTAINER[align] || CONTAINER.center, className].filter(Boolean).join(' ')}>
|
|
114
128
|
{title && <h3 className="kol-sans-heading-05 text-emphasis mb-6">{title}</h3>}
|
|
@@ -134,8 +148,66 @@ export default function ButtonGroup({ layout = 'row', align = 'center', title, c
|
|
|
134
148
|
)
|
|
135
149
|
}
|
|
136
150
|
|
|
151
|
+
/* layout="joined" variant="kolbox" (plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18): kolbox's IconGroup carried
|
|
152
|
+
* class for class. Each option is its own action, a kolbox icon Button (`{ icon, ariaLabel, pressed, onPress }`): no
|
|
153
|
+
* `value`, every option lights by its own `pressed`. Unset tone: each glyph in its own oq-16 cell, 1px apart so the
|
|
154
|
+
* ground shows between them, radius 4 on the group's outer corners only, a pressed cell the accent tint. `tone="sunken"`:
|
|
155
|
+
* Home's view switch, square cells the group's height (24, Figma's view toggles measured, plan-2026-11-23-editor-measured-
|
|
156
|
+
* against-figma W7), side by side on the ground, the pressed cell (aria-pressed only) the oq-16 field
|
|
157
|
+
* with its glyph in the ink, the others bare. Chrome in kol-theme `.kol-btn-group--kolbox`. */
|
|
158
|
+
function JoinedKolbox({ options, tone, className }) {
|
|
159
|
+
const sunken = tone === 'sunken'
|
|
160
|
+
return (
|
|
161
|
+
<div className={`kol-btn-group--kolbox${sunken ? ' kol-btn-group--kolbox-sunken' : ' gap-px overflow-hidden'} inline-flex h-(--kol-kolbox-ctl) shrink-0 ${className}`}>
|
|
162
|
+
{options.map(({ icon, ariaLabel, pressed, onPress }) => (sunken
|
|
163
|
+
? <Button key={ariaLabel} variant="kolbox" iconOnly={icon} aria-label={ariaLabel} aria-pressed={!!pressed} onClick={onPress} className="aspect-square h-full! w-auto!" />
|
|
164
|
+
: <Button key={ariaLabel} variant="kolbox" iconOnly={icon} aria-label={ariaLabel} pressed={pressed} onClick={onPress} className="flex-1 rounded-none" />))}
|
|
165
|
+
</div>
|
|
166
|
+
)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* layout="joined" variant="folio" (Folio migration batch A, 2026-11-22): Folio's two joined parts, split by the segmented
|
|
170
|
+
* state law. With a `value` it is Folio's Seg (apps/folio Chrome.jsx), a choice that stays: 32 high, radius 4, the rule
|
|
171
|
+
* line round equal cells padded 16, the picked one the accent's soft ground and strong ink (aria-pressed, as Folio's),
|
|
172
|
+
* the rest muted, the ink on hover. Stateless it is Folio's ToolGroup (EditorChrome.jsx): Folio's tool icons side by side,
|
|
173
|
+
* no gap, `options` `[{ icon, ariaLabel, pressed, onPress }]`, each its own action. Chrome in kol-theme
|
|
174
|
+
* `.kol-btn-group--folio`. */
|
|
175
|
+
function JoinedFolio({ value, onChange, options, ariaLabel, className }) {
|
|
176
|
+
if (value == null) {
|
|
177
|
+
return (
|
|
178
|
+
<span role="group" aria-label={ariaLabel} className={`flex shrink-0 items-center ${className}`.trim()}>
|
|
179
|
+
{options.map(({ icon, ariaLabel: name, pressed, onPress }) => <Button key={name} variant="folio" iconOnly={icon} aria-label={name} pressed={pressed} onClick={onPress} />)}
|
|
180
|
+
</span>
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
return (
|
|
184
|
+
<div role="group" aria-label={ariaLabel} className={`kol-btn-group--folio flex h-[32px] overflow-hidden rounded-[4px] border ${className}`.trim()}>
|
|
185
|
+
{options.map((opt) => (
|
|
186
|
+
<button key={opt.value} type="button" aria-pressed={value === opt.value} onClick={() => onChange?.(opt.value)} className="kol-btn-group-cell flex-1 whitespace-nowrap px-[16px]">{opt.label}</button>
|
|
187
|
+
))}
|
|
188
|
+
</div>
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
/* layout="joined" variant="kolbox" with a `value` (Folio on kolbox, 2026-11-22): kolbox's choice that stays (Off and On,
|
|
192
|
+
* Miter, Round and Bevel) is its tab track, so this draws TabsRow kolbox sm's track and cells (its chrome,
|
|
193
|
+
* `.kol-tabs--kolbox-sm`, kol-components-molecules.css) as a group: `options` `[{ value, label }]`, the picked cell lit and
|
|
194
|
+
* aria-pressed, `ariaLabel` names it. */
|
|
195
|
+
function JoinedKolboxChoice({ value, onChange, options, ariaLabel, className }) {
|
|
196
|
+
return (
|
|
197
|
+
<div role="group" aria-label={ariaLabel} className={`kol-tabs--kolbox kol-tabs--kolbox-sm inline-flex h-(--kol-kolbox-ctl) items-center gap-px p-0.5 ${className}`.trim()}>
|
|
198
|
+
{options.map((opt) => (
|
|
199
|
+
<button key={opt.value} type="button" aria-pressed={opt.value === value} disabled={opt.disabled} onClick={() => onChange?.(opt.value)}
|
|
200
|
+
className={`kol-tabs-tab${opt.value === value ? ' is-active' : ''} flex h-full min-w-0 flex-1 items-center justify-center px-3 whitespace-nowrap outline-none focus-visible:outline-solid focus-visible:outline-1 disabled:opacity-40`}>{opt.label}</button>
|
|
201
|
+
))}
|
|
202
|
+
</div>
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
|
|
137
207
|
/* layout="joined" — the segmented control (SegmentedToggle's implementation, moved here 2026-11-06) */
|
|
138
208
|
function Joined({ value, onChange, options = [], variant = 'default', size = 'md', tone = 'default', surface = 'solid', ariaLabel, className = '' }) {
|
|
209
|
+
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
|
+
if (variant === 'folio') return <JoinedFolio value={value} onChange={onChange} options={options} ariaLabel={ariaLabel} className={className} />
|
|
139
211
|
const float = variant === 'float'
|
|
140
212
|
const cellType = { xs: 'kol-mono-8', sm: 'kol-mono-12', md: 'kol-mono-14', lg: 'kol-mono-16' }[size]
|
|
141
213
|
const stateless = value == null
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
2
|
import Button from '../atoms/Button.jsx'
|
|
3
|
-
import {
|
|
3
|
+
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
4
|
+
import { PopoverPanel, Tooltip, usePopover } from '../utilities/Popover.jsx'
|
|
5
|
+
import KolboxGlyph from '../utilities/kolboxGlyph.jsx'
|
|
4
6
|
import { floatSurfaceClass } from '../utilities/tone.js'
|
|
5
7
|
import MenuFloatRows from './MenuFloat.jsx'
|
|
8
|
+
import { Menu } from './Menu.jsx'
|
|
6
9
|
|
|
7
10
|
/* taxonomy-ok: molecule — two Buttons (atoms) and a divider, the ⌄ opening a PopoverPanel (utility) of rows (MenuFloatRows on a float) */
|
|
8
11
|
|
|
@@ -23,7 +26,12 @@ import MenuFloatRows from './MenuFloat.jsx'
|
|
|
23
26
|
* @param {Function} onClick the main action
|
|
24
27
|
* @param {Array} [items] `[{ label, icon?, onPress, disabled? }]` — the menu's rows
|
|
25
28
|
* @param {Function} [menu] `(close) => ReactNode` — the menu's content instead of `items` (MenuFloatRows on a float)
|
|
26
|
-
* @param {'default'|'float'} [variant='default']
|
|
29
|
+
* @param {'default'|'float'|'kolbox'|'folio'} [variant='default'] `folio`: Folio's split (see its branch), `tone`
|
|
30
|
+
* primary or unset, `items` on Menu folio; `kolbox`: see the branch below; takes `tone` (primary, secondary), `icon`,
|
|
31
|
+
* `onClick`, `onMenu` (the ⌄'s press; the host opens its menu), `menuLabel`; with `iconOnly`
|
|
32
|
+
* (a glyph name) it is the tool dock's slot: `pressed` the armed look, `tooltip` the
|
|
33
|
+
* main half's tooltip label, `aria-label` the main half's name, `menuOpen` the ⌄'s
|
|
34
|
+
* menu is open (its quiet fill)
|
|
27
35
|
* @param {string} [tone] · {'xs'|'sm'|'md'|'lg'} [size='md'] (default only; a float is sm)
|
|
28
36
|
* @param {boolean} [disabled] the main action off; the menu still opens
|
|
29
37
|
* @param {string} [menuLabel='More actions'] the ⌄'s aria-label
|
|
@@ -31,9 +39,62 @@ import MenuFloatRows from './MenuFloat.jsx'
|
|
|
31
39
|
*/
|
|
32
40
|
const WELL = { '--kol-tone-bg': 'var(--kol-float-well)', '--kol-tone-fg': 'var(--kol-surface-on-primary)' }
|
|
33
41
|
|
|
34
|
-
export default function ButtonSplit({ children, icon, onClick, items = [], menu, variant = 'default', tone, size = 'md', disabled = false, menuLabel = 'More actions', placement = 'bottom-end', className = '' }) {
|
|
42
|
+
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 }) {
|
|
35
43
|
const [open, setOpen] = useState(false)
|
|
36
44
|
const popover = usePopover({ open, onOpenChange: setOpen, placement, offset: 6, role: 'menu' })
|
|
45
|
+
/* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2 batch 3, 2026-11-18): kolbox's SplitButton carried class for
|
|
46
|
+
* class, the action and its ⌄ as two kolbox Buttons of one tone, 1px apart, square where they meet; the hovered half
|
|
47
|
+
* takes the fg-04 hover over its own fill (kol-theme `.kol-btn-split--kolbox`). The host opens its own menu: `onMenu`
|
|
48
|
+
* is the ⌄'s press. */
|
|
49
|
+
if (variant === 'kolbox') {
|
|
50
|
+
/* the icon-only form (the tool dock's slot with a fold), Figma's dock as measured 2026-11-20 (W16.3): two boxes 1
|
|
51
|
+
* apart, no divider and no joined half. The tool a 32 tile with the 22 glyph (Figma's draw 16 to 18, W2), rounded on all four corners, solid
|
|
52
|
+
* accent while `pressed`; the ⌄ its own 16 by 32 button, no fill at rest (pressed or not), the quiet fill on hover
|
|
53
|
+
* and while its menu is open (`menuOpen`); `tooltip` names the main half */
|
|
54
|
+
if (iconOnly) {
|
|
55
|
+
const main = (
|
|
56
|
+
<button type="button" aria-label={ariaLabel} aria-pressed={!!pressed} disabled={disabled} onClick={onClick}
|
|
57
|
+
className="kol-btn-split-main inline-flex size-8 shrink-0 items-center justify-center outline-none focus-visible:outline-solid focus-visible:outline-1">
|
|
58
|
+
<IconLoader name={iconOnly} size={22} className="kol-kolbox-icon shrink-0" />
|
|
59
|
+
</button>
|
|
60
|
+
)
|
|
61
|
+
return (
|
|
62
|
+
<div className={`kol-btn-split--kolbox kol-btn-split--kolbox-icon${pressed ? ' is-pressed' : ''} inline-flex shrink-0 gap-px ${className}`.trim()}>
|
|
63
|
+
{tooltip ? <Tooltip variant="kolbox" label={tooltip}>{main}</Tooltip> : main}
|
|
64
|
+
<Tooltip variant="kolbox" asChild label={menuLabel}>
|
|
65
|
+
<button type="button" aria-label={menuLabel} aria-expanded={!!menuOpen} onClick={onMenu}
|
|
66
|
+
className={`kol-btn-split-menu${menuOpen ? ' is-open' : ''} inline-flex h-8 w-4 shrink-0 items-center justify-center outline-none focus-visible:outline-solid focus-visible:outline-1`}>
|
|
67
|
+
<KolboxGlyph name="chevron-down" />
|
|
68
|
+
</button>
|
|
69
|
+
</Tooltip>
|
|
70
|
+
</div>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
return (
|
|
74
|
+
<div className={`kol-btn-split--kolbox inline-flex shrink-0 gap-px ${className}`}>
|
|
75
|
+
<Button variant="kolbox" tone={tone} iconLeft={icon} onClick={onClick} className="rounded-r-none">{children}</Button>
|
|
76
|
+
<Tooltip variant="kolbox" asChild label={menuLabel}><Button variant="kolbox" tone={tone} iconLeft="chevron-down" onClick={onMenu} aria-label={menuLabel} className="rounded-l-none px-1" /></Tooltip>
|
|
77
|
+
</div>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
/* `variant="folio"` (Folio migration batch B, 2026-11-22): Folio's ActionSplit carried class for class (kol-theme
|
|
81
|
+
* `.kol-btn-split--folio`): two joined 32-high halves at radius 4 inside one line, the label padded 16, the ⌄ a 32
|
|
82
|
+
* square, a hairline in the ink at 20% between; `tone="primary"` the green ground, unset the paper. The ⌄ opens
|
|
83
|
+
* `items` on `Menu variant="folio"` under its right edge, in place (never portalled). Esc or a press outside closes. */
|
|
84
|
+
if (variant === 'folio') {
|
|
85
|
+
return (
|
|
86
|
+
<span className={`kol-btn-split--folio${tone === 'primary' ? ' kol-btn-split--folio-primary' : ''} relative inline-flex ${className}`.trim()}>
|
|
87
|
+
<span className="kol-btn-split-box flex h-[32px] shrink-0 overflow-hidden rounded-[4px] border">
|
|
88
|
+
<button type="button" onClick={onClick} className="kol-btn-split-main whitespace-nowrap px-[16px]">{children}</button>
|
|
89
|
+
<span aria-hidden className="w-px bg-current opacity-20" />
|
|
90
|
+
<button type="button" aria-label={menuLabel} aria-haspopup="menu" aria-expanded={open} onClick={() => setOpen(!open)} className="flex w-[32px] items-center justify-center"><IconLoader name="chevron-down" size={16} /></button>
|
|
91
|
+
</span>
|
|
92
|
+
<Menu variant="folio" open={open} onClose={() => setOpen(false)} aria-label={menuLabel} minWidth={160}
|
|
93
|
+
panelClassName="absolute right-0 top-[calc(100%+4px)] whitespace-nowrap"
|
|
94
|
+
items={items.map((it) => ({ label: it.label, onClick: it.onPress, disabled: it.disabled }))} />
|
|
95
|
+
</span>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
37
98
|
const close = () => setOpen(false)
|
|
38
99
|
const float = variant === 'float'
|
|
39
100
|
const shared = float
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chip — A tile with a leading slot, a title and a meta line.
|
|
3
|
+
*
|
|
4
|
+
* The library master `Chip` (Molecules page, 2167:11003; type-ramp plan 6.3): a 192 × 64 tile on surface-tertiary,
|
|
5
|
+
* the leading slot a 48 square on oq-04 (an `IconFrame` or "Aa" in the Specimen font chips), then the title in sans 14
|
|
6
|
+
* at full ink and the meta in sans 12 at fg-64. A molecule because its slot holds an `IconFrame`, as `CloseButton` does.
|
|
7
|
+
* Not the `chip` icon, not `Tag` (interactive), `Pill` (a static word) or `SizeChip` (one letter).
|
|
8
|
+
*
|
|
9
|
+
* @param {React.ReactNode} [leading] the slot's content; omitted, nothing is drawn in the slot
|
|
10
|
+
* @param {string} title
|
|
11
|
+
* @param {string} [meta]
|
|
12
|
+
* @param {string} [className]
|
|
13
|
+
*/
|
|
14
|
+
export default function Chip({ leading, title, meta, className = '', ...rest }) {
|
|
15
|
+
return (
|
|
16
|
+
<div className={`flex h-16 w-48 items-center gap-3 rounded-lg bg-surface-tertiary p-2 ${className}`.trim()} {...rest}>
|
|
17
|
+
{leading != null && (
|
|
18
|
+
<div className="flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-oq-04">{leading}</div>
|
|
19
|
+
)}
|
|
20
|
+
<div className="flex min-w-0 flex-col items-start gap-1 overflow-hidden whitespace-nowrap font-[family-name:var(--kol-font-family-sans)] font-normal leading-[14px]">
|
|
21
|
+
<p className="text-[14px] text-auto">{title}</p>
|
|
22
|
+
{meta != null && <p className="text-[12px] text-fg-64">{meta}</p>}
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
1
2
|
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
|
|
2
|
-
import { oneDark } from 'react-syntax-highlighter/dist/esm/styles/prism'
|
|
3
|
+
import { oneDark, oneLight } from 'react-syntax-highlighter/dist/esm/styles/prism'
|
|
3
4
|
import CopyButton from './CopyButton.jsx'
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -77,7 +78,7 @@ const syntaxTheme = (foregroundToken = 80) => ({
|
|
|
77
78
|
* for anything else. `md` is those exact values, named; `sm` is one step down
|
|
78
79
|
* on both axes. Size is INDEPENDENT of `bare`: bare removes the frame, size
|
|
79
80
|
* sets the box, and a bare block still has one. */
|
|
80
|
-
|
|
81
|
+
function CodeBlockDefault({ children, code: codeProp, language: languageProp, filename: filenameProp, value, bare = false, size = 'md', copy = true }) {
|
|
81
82
|
const code = String(value?.code ?? codeProp ?? children ?? '')
|
|
82
83
|
const language = value?.language ?? languageProp ?? 'text'
|
|
83
84
|
const filename = value?.filename ?? filenameProp
|
|
@@ -125,3 +126,39 @@ export default function CodeBlock({ children, code: codeProp, language: language
|
|
|
125
126
|
</div>
|
|
126
127
|
)
|
|
127
128
|
}
|
|
129
|
+
|
|
130
|
+
/* ── folio (Folio batch E, 2026-11-22) ─────────────────────────────────────────────────────────────────────────────
|
|
131
|
+
* Folio's fenced code, carried from apps/folio's Fence.jsx: a 36 header naming the language (Folio's names, mono 11
|
|
132
|
+
* capitals, muted) with Copy (Copied for 1.4s), over the code coloured by Prism, oneLight or oneDark flattened onto
|
|
133
|
+
* Folio's code ground (the ink at 4% on the paper), in mono 13 / 1.7, long lines wrapped; a hairline frame at radius 3.
|
|
134
|
+
* CodeBlock's words: `code` (or children) and `language`. Folio's own: `dark` (oneDark for Folio's night; the theme is the
|
|
135
|
+
* caller's, which reads its own reader or canvas). `data-wide` stays on the root: Folio's prose grid runs it full width. */
|
|
136
|
+
const flatFolio = (theme) => ({
|
|
137
|
+
...theme,
|
|
138
|
+
'pre[class*="language-"]': { ...theme['pre[class*="language-"]'], background: 'transparent', margin: 0, padding: 0, textShadow: 'none', fontSize: '13px', lineHeight: '1.7' },
|
|
139
|
+
'code[class*="language-"]': { ...theme['code[class*="language-"]'], background: 'transparent', textShadow: 'none', fontFamily: 'var(--kol-font-family-mono), ui-monospace, monospace', fontSize: '13px' },
|
|
140
|
+
})
|
|
141
|
+
const FOLIO_LIGHT = flatFolio(oneLight)
|
|
142
|
+
const FOLIO_DARK = flatFolio(oneDark)
|
|
143
|
+
const FOLIO_NAME = { js: 'JavaScript', javascript: 'JavaScript', jsx: 'JSX', ts: 'TypeScript', typescript: 'TypeScript', json: 'JSON', css: 'CSS', html: 'HTML', markup: 'HTML', md: 'Markdown', sh: 'Shell', bash: 'Shell', yaml: 'YAML', yml: 'YAML', py: 'Python', python: 'Python' }
|
|
144
|
+
|
|
145
|
+
function CodeBlockFolio({ code: codeProp, children, language, dark = false }) {
|
|
146
|
+
const text = String(codeProp ?? children ?? '')
|
|
147
|
+
const [copied, setCopied] = useState(false)
|
|
148
|
+
const copy = () => navigator.clipboard?.writeText(text).then(() => { setCopied(true); setTimeout(() => setCopied(false), 1400) }).catch(() => {})
|
|
149
|
+
return (
|
|
150
|
+
<div data-wide className="kol-codeblock--folio overflow-hidden rounded-[3px] border">
|
|
151
|
+
<div className="kol-codeblock-head flex h-[36px] items-center justify-between border-b px-[14px]">
|
|
152
|
+
<span className="kol-codeblock-language uppercase">{FOLIO_NAME[language] ?? language}</span>
|
|
153
|
+
<button type="button" onClick={copy} className="kol-folio-meta kol-codeblock-action rounded-[3px] px-[8px] py-[4px]">{copied ? 'Copied' : 'Copy'}</button>
|
|
154
|
+
</div>
|
|
155
|
+
<div className="overflow-x-auto px-[16px] py-[14px]">
|
|
156
|
+
<SyntaxHighlighter language={language} style={dark ? FOLIO_DARK : FOLIO_LIGHT} wrapLongLines>{text}</SyntaxHighlighter>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export default function CodeBlock(props) {
|
|
163
|
+
return props.variant === 'folio' ? <CodeBlockFolio {...props} /> : <CodeBlockDefault {...props} />
|
|
164
|
+
}
|