@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
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SectionFooter — A section's foot: the rule above, then a leading slot, the label and a trailing slot.
|
|
3
|
+
*
|
|
4
|
+
* The library master `SectionFooter` (Atoms page, 2169:1251; type-ramp plan 6.8): `SectionHeader`'s partner, the same
|
|
5
|
+
* row with the fg-08 rule drawn on top, 13 above the row.
|
|
6
|
+
*
|
|
7
|
+
* @param {React.ReactNode} [leading] the start slot (an `IconFrame`); omitted, nothing is drawn
|
|
8
|
+
* @param {string} label
|
|
9
|
+
* @param {React.ReactNode} [trailing] the end slot
|
|
10
|
+
* @param {string} [className]
|
|
11
|
+
*/
|
|
12
|
+
export default function SectionFooter({ leading, label, trailing, className = '', ...rest }) {
|
|
13
|
+
return (
|
|
14
|
+
<div className={`flex w-full flex-row flex-wrap items-end justify-between gap-4 border-t border-fg-08 pt-[13px] ${className}`.trim()} {...rest}>
|
|
15
|
+
<div className="flex items-center gap-3 md:gap-4">
|
|
16
|
+
{leading}
|
|
17
|
+
<span className="kol-btn kol-btn-md kol-helper-16">{label}</span>
|
|
18
|
+
</div>
|
|
19
|
+
{trailing != null && <div className="flex flex-wrap items-center gap-4">{trailing}</div>}
|
|
20
|
+
</div>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SectionHeader — A section's head: a leading slot, the label, a trailing slot and the rule beneath.
|
|
3
|
+
*
|
|
4
|
+
* The library master `SectionHeader` (Atoms page, 2169:1239; type-ramp plan 6.8), copied from kol-foundry's
|
|
5
|
+
* `SpecimenSectionHeader` at size md: the label in the text-button shell at helper-16, the two ends apart, the rule an
|
|
6
|
+
* fg-08 line 13 below the row. The component draws the rule itself (no nested `Divider`), which keeps it an atom.
|
|
7
|
+
* `SectionFooter` is its partner with the rule above. Not kol-dashboards' `SectionHead` (the float card's section head).
|
|
8
|
+
*
|
|
9
|
+
* @param {React.ReactNode} [leading] the start slot (an `IconFrame`); omitted, nothing is drawn
|
|
10
|
+
* @param {string} label
|
|
11
|
+
* @param {React.ReactNode} [trailing] the end slot (page number, section name, controls)
|
|
12
|
+
* @param {string} [className]
|
|
13
|
+
*/
|
|
14
|
+
export default function SectionHeader({ leading, label, trailing, className = '', ...rest }) {
|
|
15
|
+
return (
|
|
16
|
+
<div className={`flex w-full flex-row flex-wrap items-end justify-between gap-4 border-b border-fg-08 pb-[13px] ${className}`.trim()} {...rest}>
|
|
17
|
+
<div className="flex items-center gap-3 md:gap-4">
|
|
18
|
+
{leading}
|
|
19
|
+
<span className="kol-btn kol-btn-md kol-helper-16">{label}</span>
|
|
20
|
+
</div>
|
|
21
|
+
{trailing != null && <div className="flex flex-wrap items-center gap-4">{trailing}</div>}
|
|
22
|
+
</div>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -3,37 +3,15 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
|
3
3
|
/**
|
|
4
4
|
* SectionLabel — A section's name with its arrow.
|
|
5
5
|
*
|
|
6
|
-
* `variant="float"` (float-everything W5 row 68, 2026-11-04 — kol-float--style 46:1976): a rail section's header on the
|
|
7
|
-
* float — the name in `kol-float-label` on fg-64, rendered as authored (`APPEARANCE`), and, when `onAdd` is given, a +
|
|
8
|
-
* at the far end (14, oq-64, bright under the pointer) that adds an item to the section. No arrow, no rule.
|
|
9
|
-
*
|
|
10
6
|
* @param {ReactNode} text
|
|
11
7
|
* @param {'sm'|'md'|'lg'} [size='md'] the default look's size
|
|
12
|
-
* @param {'float'} [variant]
|
|
13
|
-
* @param {Function} [onAdd] float: the + control
|
|
14
|
-
* @param {string} [addLabel] float: the +'s accessible name (default `Add`)
|
|
15
8
|
* @param {string} [className]
|
|
16
9
|
*/
|
|
17
10
|
export default function SectionLabel({
|
|
18
11
|
text,
|
|
19
12
|
size = 'md',
|
|
20
|
-
variant,
|
|
21
|
-
onAdd,
|
|
22
|
-
addLabel = 'Add',
|
|
23
13
|
className = ''
|
|
24
14
|
}) {
|
|
25
|
-
if (variant === 'float') {
|
|
26
|
-
return (
|
|
27
|
-
<div className={`flex h-4 w-full items-center justify-between gap-2 ${className}`.trim()}>
|
|
28
|
-
<span className="kol-float-label truncate text-fg-64">{text}</span>
|
|
29
|
-
{onAdd && (
|
|
30
|
-
<button type="button" aria-label={addLabel} onClick={onAdd} className="inline-flex size-5 shrink-0 items-center justify-center rounded-full text-oq-64 hover:text-oq-96 focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)] cursor-pointer">
|
|
31
|
-
<IconLoader name="plus" size={14} />
|
|
32
|
-
</button>
|
|
33
|
-
)}
|
|
34
|
-
</div>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
15
|
// Size variants: sm (16px), md (20px), lg (32px).
|
|
38
16
|
// Migrated off the deleted legacy kol-label-* family (2026-07-15): current
|
|
39
17
|
// helper/heading classes, no text-transform — labels render as authored.
|
|
@@ -54,7 +54,7 @@ export default function SizeOrDownload({
|
|
|
54
54
|
href={href ?? '#'}
|
|
55
55
|
onClick={click}
|
|
56
56
|
aria-label={done ? confirmLabel : label}
|
|
57
|
-
className="group/size -mx-1 inline-grid items-end justify-items-start rounded-[var(--kol-radius-
|
|
57
|
+
className="group/size -mx-1 inline-grid items-end justify-items-start rounded-[var(--kol-radius-4)] px-1 transition-colors duration-500 ease-[var(--kol-ease-house)] hover:bg-oq-04 active:bg-oq-08"
|
|
58
58
|
>
|
|
59
59
|
<span
|
|
60
60
|
className="kol-mono-12 text-oq-80 group-hover/size:opacity-0"
|
package/src/atoms/Tag.jsx
CHANGED
|
@@ -35,13 +35,13 @@ const PALETTE = new Set(['blue', 'teal', 'green', 'yellow', 'red', 'orange', 'pu
|
|
|
35
35
|
*
|
|
36
36
|
* @param {ReactNode} children label content
|
|
37
37
|
* @param {string} text content fallback when no children (brand SwatchControls)
|
|
38
|
-
* @param {string} variant 'primary' | 'secondary' | 'inverse' · `tertiary` = secondary's fill, no outline, mono at fg-80 (2026-08-27)
|
|
38
|
+
* @param {string} variant 'primary' | 'secondary' | 'inverse' · `tertiary` = secondary's fill, no outline, mono at fg-80 (2026-08-27)
|
|
39
39
|
* @param {string} size 'xs' | 'sm' | 'md' | 'lg' — `sm` is the default and
|
|
40
40
|
* should stay the answer; `lg` needs a reason
|
|
41
41
|
* @param {boolean} active selected state (filter chips)
|
|
42
|
-
* @param {boolean} hash prepend `#` (default true
|
|
42
|
+
* @param {boolean} hash prepend `#` (default true); false for plain labels
|
|
43
43
|
* @param {string} icon leading icon name
|
|
44
|
-
* @param {number|string} count a count after the label (
|
|
44
|
+
* @param {number|string} count a count after the label (row 56): mono, one step down
|
|
45
45
|
* @param {Function} onRemove renders the dismiss affordance
|
|
46
46
|
* @param {Function} onClick makes it a <button>
|
|
47
47
|
*/
|
|
@@ -80,10 +80,7 @@ export default function Tag({
|
|
|
80
80
|
inverse: 'kol-tag--inverse',
|
|
81
81
|
/* secondary's fill, no outline, the mono voice at fg-80 (TagTertiary, 2026-08-27) */
|
|
82
82
|
tertiary: 'kol-tag--tertiary',
|
|
83
|
-
/* the float capsule (W2 row 17, 2026-11-04) */
|
|
84
|
-
float: 'kol-tag--float',
|
|
85
83
|
}
|
|
86
|
-
const float = variant === 'float'
|
|
87
84
|
|
|
88
85
|
/* TYPE COMES FROM THE HELPER RAMP (user ruling 2026-08-01). The size classes
|
|
89
86
|
* hardcoded font-size + font-weight and set no line-height, so a 10px chip
|
|
@@ -116,7 +113,7 @@ export default function Tag({
|
|
|
116
113
|
onClick={onClick}
|
|
117
114
|
>
|
|
118
115
|
{icon && <IconLoader name={icon} size={iconSize} />}
|
|
119
|
-
<span>{hash
|
|
116
|
+
<span>{hash ? '#' : ''}{content}</span>
|
|
120
117
|
{count != null && <span className="kol-tag-count">{count}</span>}
|
|
121
118
|
{onRemove && (
|
|
122
119
|
<span
|
package/src/atoms/Textarea.jsx
CHANGED
|
@@ -8,9 +8,11 @@ import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
|
8
8
|
* variant="filled" (default) — persistent solid bg
|
|
9
9
|
* variant="ghost" — legacy alias, resolves to outline
|
|
10
10
|
* variant="outline" — bordered, transparent bg
|
|
11
|
-
* variant="
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* variant="kolbox" — kolbox's field (plan-2026-11-18-kolbox-system W31.2, 2026-11-18), carried class for
|
|
12
|
+
* class: a bare <textarea> filling its row (flex-1), the field's oq-16 fill, an oq-24 line,
|
|
13
|
+
* radius 4, 8 by 4 in, JetBrains Mono 12 / 16 in the ink, the accent line while focused,
|
|
14
|
+
* native vertical resize, the browser's own rows unless `rows` is given. No size, no grip.
|
|
15
|
+
* Chrome in kol-theme `.kol-textarea--kolbox`.
|
|
14
16
|
*
|
|
15
17
|
* size="sm" / "md" (default) / "lg" — padding + type class
|
|
16
18
|
*
|
|
@@ -41,13 +43,17 @@ export default function Textarea({
|
|
|
41
43
|
onChange,
|
|
42
44
|
variant = 'filled',
|
|
43
45
|
size = 'md',
|
|
44
|
-
rows
|
|
46
|
+
rows,
|
|
45
47
|
axis = 'both',
|
|
46
48
|
placeholder,
|
|
47
49
|
disabled = false,
|
|
48
50
|
className = '',
|
|
49
51
|
...props
|
|
50
52
|
}) {
|
|
53
|
+
if (variant === 'kolbox') {
|
|
54
|
+
return <textarea value={value} onChange={onChange} rows={rows} placeholder={placeholder} disabled={disabled} className={`kol-textarea--kolbox min-w-0 flex-1 resize-y border px-2 py-1 outline-none ${className}`} {...props} />
|
|
55
|
+
}
|
|
56
|
+
|
|
51
57
|
// ghost folds into outline (2026-07-08 chrome law): one secondary treatment.
|
|
52
58
|
const resolvedVariant = variant === 'ghost' ? 'outline' : variant
|
|
53
59
|
|
|
@@ -56,8 +62,7 @@ export default function Textarea({
|
|
|
56
62
|
`kol-control--${resolvedVariant}`,
|
|
57
63
|
'kol-control--textarea',
|
|
58
64
|
`kol-control-${size}`,
|
|
59
|
-
|
|
60
|
-
resolvedVariant !== 'float' && SIZE_TYPE[size],
|
|
65
|
+
SIZE_TYPE[size],
|
|
61
66
|
'relative block w-full',
|
|
62
67
|
className,
|
|
63
68
|
].filter(Boolean).join(' ')
|
|
@@ -72,7 +77,7 @@ export default function Textarea({
|
|
|
72
77
|
<label className={wrapperCls} aria-disabled={disabled || undefined}>
|
|
73
78
|
<textarea
|
|
74
79
|
{...valueProps}
|
|
75
|
-
rows={rows}
|
|
80
|
+
rows={rows ?? 3}
|
|
76
81
|
placeholder={placeholder}
|
|
77
82
|
disabled={disabled}
|
|
78
83
|
spellCheck={false}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
+
import { IconLoader } from '@kolkrabbi/kol-icons'
|
|
2
3
|
|
|
3
4
|
/* `variant="media"` (ContentFiltersCollection, kol-r2b2 2026-08-27): inside a
|
|
4
5
|
* media frame the unchecked hairline vanished over a photo; this variant's
|
|
5
6
|
* UNCHECKED box carries the media control's solid plate (`--kol-oq-12`) so it
|
|
6
7
|
* reads over any image. Checked stays the white plate + black check.
|
|
7
|
-
* `variant="
|
|
8
|
-
*
|
|
9
|
-
|
|
8
|
+
* `variant="kolbox"` (plan-2026-11-18-kolbox-system W31.2, 2026-11-18), carried class for class: a 16 box at radius 4 in a
|
|
9
|
+
* 28 hit box, unchecked the field's oq-16 fill with an oq-24 line, checked the accent fill and line with your icons'
|
|
10
|
+
* `check` at 12 in the on-accent ink; no label of its own (name it with `aria-label`; a row labels it), a role="checkbox"
|
|
11
|
+
* button with aria-checked, the focus ring the accent's. Chrome in kol-theme `.kol-toggle-checkbox--kolbox`. */
|
|
12
|
+
const VARIANT_CLASS = { media: 'toggle-checkbox--media' }
|
|
10
13
|
const ToggleCheckbox = ({
|
|
11
14
|
label,
|
|
12
15
|
checked = false,
|
|
@@ -16,6 +19,23 @@ const ToggleCheckbox = ({
|
|
|
16
19
|
hint,
|
|
17
20
|
...props
|
|
18
21
|
}) => {
|
|
22
|
+
if (variant === 'kolbox') {
|
|
23
|
+
return (
|
|
24
|
+
<button
|
|
25
|
+
type="button"
|
|
26
|
+
role="checkbox"
|
|
27
|
+
aria-checked={checked}
|
|
28
|
+
onClick={() => onChange?.(!checked)}
|
|
29
|
+
className={`kol-toggle-checkbox--kolbox${checked ? ' is-active' : ''} inline-flex size-(--kol-kolbox-ctl) shrink-0 items-center justify-center outline-none focus-visible:outline-solid focus-visible:outline-1 ${className}`}
|
|
30
|
+
{...props}
|
|
31
|
+
>
|
|
32
|
+
<span className="kol-toggle-checkbox-box flex size-4 items-center justify-center border">
|
|
33
|
+
{checked && <IconLoader name="check" size={12} className="kol-kolbox-icon shrink-0" />}
|
|
34
|
+
</span>
|
|
35
|
+
</button>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
19
39
|
const handleChange = (event) => {
|
|
20
40
|
const next = event.target.checked
|
|
21
41
|
if (onChange) onChange(next)
|
|
@@ -37,9 +57,9 @@ const ToggleCheckbox = ({
|
|
|
37
57
|
<polyline points="1 5 4 8 11 1" fill="none" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" />
|
|
38
58
|
</svg>
|
|
39
59
|
</span>
|
|
40
|
-
<span className={`toggle-checkbox-label
|
|
60
|
+
<span className={`toggle-checkbox-label kol-helper-12 tracking-[0.08em]`}>
|
|
41
61
|
{label}
|
|
42
|
-
{hint ? <span className={`ml-2 opacity-60 tracking-normal
|
|
62
|
+
{hint ? <span className={`ml-2 opacity-60 tracking-normal kol-helper-10`}>{hint}</span> : null}
|
|
43
63
|
</span>
|
|
44
64
|
</label>
|
|
45
65
|
)
|
|
@@ -6,9 +6,17 @@ import React from 'react'
|
|
|
6
6
|
* variant="bare" (default) — label + track, no box
|
|
7
7
|
* variant="primary" — filled shell (surface-secondary), button geometry
|
|
8
8
|
* variant="outline" — bordered shell (border-oq-16), button geometry
|
|
9
|
-
* variant="
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* variant="kolbox" — kolbox's switch (plan-2026-11-18-kolbox-system W31.2, 2026-11-18), carried class for class:
|
|
10
|
+
* a 28 × 16 track with a 12 knob 2 in, inside a 28-high hit box at radius 4; off the oq-24
|
|
11
|
+
* track and the ink knob, on the accent track and the on-accent knob; one size, no label
|
|
12
|
+
* (name it with `aria-label`; a row's LabeledControl gives the words), role="switch" with
|
|
13
|
+
* aria-checked, the focus ring the accent's, disabled 40%. Chrome in kol-theme
|
|
14
|
+
* `.kol-toggle-switch--kolbox`.
|
|
15
|
+
*
|
|
16
|
+
* variant="folio" — Folio's switch (Folio migration batch A, 2026-11-22), carried class for class: a 20 × 12
|
|
17
|
+
* track round an 8 knob that travels 8, the hit box 24 high; off the rule track, on the
|
|
18
|
+
* accent, the knob the paper; one size, no label (`aria-label`), role="switch" with
|
|
19
|
+
* aria-checked. Chrome in kol-theme `.kol-toggle-switch--folio`.
|
|
12
20
|
*
|
|
13
21
|
* size="xs" / "sm" / "md" (default) / "lg" — shells match button heights
|
|
14
22
|
* (22/26/32/40); the track scales with size in all variants. xs is the
|
|
@@ -48,15 +56,41 @@ const ToggleSwitch = ({
|
|
|
48
56
|
console.warn('ToggleSwitch: `label` is deprecated — wrap the switch in <LabeledControl horizontal label="…">')
|
|
49
57
|
}
|
|
50
58
|
|
|
59
|
+
if (variant === 'kolbox') {
|
|
60
|
+
return (
|
|
61
|
+
<button
|
|
62
|
+
type="button"
|
|
63
|
+
role="switch"
|
|
64
|
+
aria-checked={checked}
|
|
65
|
+
onClick={handleClick}
|
|
66
|
+
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}`}
|
|
67
|
+
data-state={checked ? 'on' : 'off'}
|
|
68
|
+
{...props}
|
|
69
|
+
>
|
|
70
|
+
<span className="kol-toggle-switch-track flex h-4 w-7 items-center rounded-full p-0.5 transition-colors">
|
|
71
|
+
<span className={`kol-toggle-switch-knob size-3 rounded-full transition-transform${checked ? ' translate-x-3' : ''}`} />
|
|
72
|
+
</span>
|
|
73
|
+
</button>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* folio (Folio migration batch A, 2026-11-22): Folio's Switch carried class for class (apps/folio Chrome.jsx) */
|
|
78
|
+
if (variant === 'folio') {
|
|
79
|
+
return (
|
|
80
|
+
<button type="button" role="switch" aria-checked={checked} onClick={handleClick} {...props}
|
|
81
|
+
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}`}>
|
|
82
|
+
<span className={`kol-toggle-switch-knob absolute left-[2px] top-[2px] size-[8px] rounded-full transition-transform ${checked ? 'translate-x-[8px]' : ''}`} />
|
|
83
|
+
</button>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
51
87
|
const resolvedVariant = LEGACY_VARIANTS[variant] || variant
|
|
52
|
-
const float = resolvedVariant === 'float'
|
|
53
88
|
|
|
54
89
|
const cls = [
|
|
55
90
|
'toggle-switch',
|
|
56
91
|
`toggle-switch--${resolvedVariant}`,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
!float && SIZE_TYPE[size],
|
|
92
|
+
`toggle-switch--${size}`,
|
|
93
|
+
SIZE_TYPE[size],
|
|
60
94
|
className,
|
|
61
95
|
].filter(Boolean).join(' ')
|
|
62
96
|
|
package/src/atoms/ViewToggle.jsx
CHANGED
|
@@ -15,12 +15,8 @@ import { Tooltip } from '../utilities/Popover.jsx'
|
|
|
15
15
|
* option's label; active = on (kol-control--filled),
|
|
16
16
|
* inactive = off (bare text). Use for compact on/off
|
|
17
17
|
* where a segmented two-button toggle is overkill.
|
|
18
|
-
* variant="float" — the float rounds (float-everything W2 row 35, 2026-11-04): each option a 32 circle, 4 apart,
|
|
19
|
-
* no well; a glyph (`icon`, 16) or a label (Inter 11/500 — a page number); the lit one fg-16
|
|
20
|
-
* on the emphasis ink, the rest fg-64 with an fg-08 hover; the float focus ring. Pagination and
|
|
21
|
-
* the view switch are one shape.
|
|
22
18
|
*
|
|
23
|
-
* Built on the .kol-control shell. Default options use grid /
|
|
19
|
+
* Built on the .kol-control shell. Default options use grid / list-bullet
|
|
24
20
|
* icons; consumers can pass `options` to override. `iconVariant` picks the
|
|
25
21
|
* icon cut for variant="icon" ('stroke' default; 'solid' reads better at
|
|
26
22
|
* 14px). For `variant="single"`, the FIRST option in `options` is the "off"
|
|
@@ -47,36 +43,13 @@ const ViewToggle = ({
|
|
|
47
43
|
tone = 'default',
|
|
48
44
|
options = [
|
|
49
45
|
{ value: 'grid', label: 'Grid view', icon: 'grid' },
|
|
50
|
-
{ value: 'list', label: 'List view', icon: '
|
|
46
|
+
{ value: 'list', label: 'List view', icon: 'list-bullet' }
|
|
51
47
|
],
|
|
52
48
|
className = ''
|
|
53
49
|
}) => {
|
|
54
50
|
const isIconVariant = variant === 'icon'
|
|
55
51
|
const isSingleVariant = variant === 'single'
|
|
56
52
|
|
|
57
|
-
if (variant === 'float') {
|
|
58
|
-
return (
|
|
59
|
-
<div className={`kol-view-toggle--float inline-flex items-center gap-1 ${className}`.trim()}>
|
|
60
|
-
{options.map((option) => {
|
|
61
|
-
const active = option.onClick ? !!option.pressed : viewMode === option.value
|
|
62
|
-
const button = (
|
|
63
|
-
<button
|
|
64
|
-
key={option.value}
|
|
65
|
-
type="button"
|
|
66
|
-
onClick={option.onClick ?? (() => onViewChange(option.value))}
|
|
67
|
-
aria-label={option.icon ? option.label : undefined}
|
|
68
|
-
aria-pressed={option.onClick && option.pressed == null ? undefined : active}
|
|
69
|
-
className={`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-colors cursor-pointer kol-float-label font-medium ${active ? 'bg-fg-16 text-fg-emphasis' : 'text-fg-64 hover:bg-fg-08 hover:text-fg-emphasis'}`}
|
|
70
|
-
>
|
|
71
|
-
{option.icon ? <IconLoader name={option.icon} size={16} variant={iconVariant} /> : option.label}
|
|
72
|
-
</button>
|
|
73
|
-
)
|
|
74
|
-
return option.icon ? <Tooltip key={option.value} label={option.label}>{button}</Tooltip> : button
|
|
75
|
-
})}
|
|
76
|
-
</div>
|
|
77
|
-
)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
53
|
if (isSingleVariant) {
|
|
81
54
|
const [offOpt, onOpt] = options
|
|
82
55
|
const isOn = viewMode === onOpt.value
|
package/src/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'
|
|
@@ -52,10 +58,9 @@ export { default as Input } from './atoms/Input.jsx'
|
|
|
52
58
|
export { default as Label } from './atoms/Label.jsx'
|
|
53
59
|
export { default as LabeledControl } from './molecules/LabeledControl.jsx'
|
|
54
60
|
export { default as RailFloat, default as FloatModule } from './molecules/RailFloat.jsx'
|
|
55
|
-
export { default as FloatModuleHeader } from './molecules/FloatModuleHeader.jsx'
|
|
56
61
|
export { default as OverlayGlassPanel } from './utilities/OverlayGlassPanel.jsx'
|
|
57
62
|
export { default as Pill } from './atoms/Pill.jsx'
|
|
58
|
-
export { usePopover, PopoverPanel, Tooltip } from './utilities/Popover.jsx'
|
|
63
|
+
export { usePopover, PopoverPanel, PopoverLayer, Tooltip } from './utilities/Popover.jsx'
|
|
59
64
|
export { floatSurfaceClass, FLOAT_SURFACES } from './utilities/tone.js'
|
|
60
65
|
export { floatMotion, FLOAT_MOTION } from './utilities/motion.js'
|
|
61
66
|
/* armLongPress — the touch hold the panel value controls report (moved from kol-hardware 2026-10-01) */
|
|
@@ -74,7 +79,9 @@ export { default as SegmentedToggle } from './molecules/SegmentedToggle.jsx'
|
|
|
74
79
|
/* a page's variants — the pinned slider button and its panel of segmented rows (OneVariantsControl, 2026-10-29; catalog's) */
|
|
75
80
|
export { default as VariantsControl } from './molecules/VariantsControl.jsx'
|
|
76
81
|
export { default as Stepper } from './molecules/Stepper.jsx'
|
|
77
|
-
export { default as Kbd } from './atoms/Kbd.jsx'
|
|
82
|
+
export { default as Kbd, KbdKeys } from './atoms/Kbd.jsx'
|
|
83
|
+
/* a text action in the link color (kolbox's Link, plan-2026-11-18-kolbox-system W31.2, 2026-11-18) */
|
|
84
|
+
export { default as Link } from './atoms/Link.jsx'
|
|
78
85
|
/* the float parts (float-everything W2 · W3 · W4, 2026-11-04) */
|
|
79
86
|
export { default as Delta } from './atoms/Delta.jsx'
|
|
80
87
|
export { default as LiveDot } from './atoms/LiveDot.jsx'
|
|
@@ -141,6 +148,9 @@ export { default as LayerStack, AddLayerButton, BLEND_MODES } from './organisms/
|
|
|
141
148
|
export { default as StepList } from './molecules/StepList.jsx'
|
|
142
149
|
export { TYPE_LABELS, BOOL_OP_LABELS, SHAPE_KIND_LABELS, labelForLayer, rowLabelForLayer, findLayerDeep } from './hooks/layerTree.js'
|
|
143
150
|
export { default as TimelineDock, sampleTrack, TIMELINE_EASINGS } from './organisms/TimelineDock.jsx'
|
|
151
|
+
/* a document's find bar and status bar, new 2026-11-22 (Folio on kolbox) */
|
|
152
|
+
export { default as FindBar } from './organisms/FindBar.jsx'
|
|
153
|
+
export { default as StatusBar } from './organisms/StatusBar.jsx'
|
|
144
154
|
export { default as CurveEditor, CURVE_KINDS, defaultCurveFor } from './organisms/CurveEditor.jsx'
|
|
145
155
|
export { default as KeyframeEditor, KEYFRAME_EASES, DEFAULT_KEYFRAMES } from './organisms/KeyframeEditor.jsx'
|
|
146
156
|
export { pathD, pathBounds, shiftNode, normalizePath, scalePathNodes, normalizePathRings, rotatePathNodes, dist, nearestSegmentT, splitSegment, smoothNode } from './hooks/pathMath.js'
|
|
@@ -163,6 +173,10 @@ export { default as ColorSwatch } from './molecules/ColorSwatch.jsx'
|
|
|
163
173
|
export { default as SwatchTile } from './molecules/SwatchTile.jsx'
|
|
164
174
|
export { default as SwatchCaption } from './molecules/SwatchCaption.jsx'
|
|
165
175
|
export { default as Dropdown } from './molecules/Dropdown.jsx'
|
|
176
|
+
/* kolbox's DropdownStepper, Toast and SwatchGrid, new 2026-11-18 (plan-2026-11-18-kolbox-system W31.2 batch 4) */
|
|
177
|
+
export { default as DropdownStepper } from './molecules/DropdownStepper.jsx'
|
|
178
|
+
export { default as Toast, toast, ToastHost } from './molecules/Toast.jsx'
|
|
179
|
+
export { default as SwatchGrid } from './molecules/SwatchGrid.jsx'
|
|
166
180
|
/* MultiSelect — several pick-one settings in one dropdown, a column each (2026-10-01, first cut) */
|
|
167
181
|
export { default as MultiSelect } from './molecules/MultiSelect.jsx'
|
|
168
182
|
export { default as FieldRow, StatusChip } from './molecules/FieldRow.jsx'
|
|
@@ -178,7 +192,7 @@ export { default as ContentRow } from './molecules/ContentRow.jsx'
|
|
|
178
192
|
export { default as ContentItem } from './molecules/ContentItem.jsx'
|
|
179
193
|
export { default as ContentCollection } from './organisms/ContentCollection.jsx'
|
|
180
194
|
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'
|
|
195
|
+
export { Menu, MenuTrigger, MenuPanel, MenuLabel, MenuFilter, MenuDatePicker, MenuMore, MenuScroll } from './molecules/Menu.jsx'
|
|
182
196
|
export { MenuList } from './molecules/MenuList.jsx'
|
|
183
197
|
export { ModalProvider, useModal, ModalDialog, ModalDialog as Dialog } from './molecules/Modal.jsx'
|
|
184
198
|
export { default as ModalShell } from './molecules/ModalShell.jsx'
|
|
@@ -195,6 +209,7 @@ export { default as PaletteHarmonyWheel } from './molecules/PaletteHarmonyWheel.
|
|
|
195
209
|
export { default as PropertyInput } from './molecules/PropertyInput.jsx'
|
|
196
210
|
export { default as ShapeDropdown } from './molecules/ShapeDropdown.jsx'
|
|
197
211
|
export { default as Rail, RAIL_ROLES, useRailKey } from './organisms/Rail.jsx'
|
|
212
|
+
export { default as RailSwitcher } from './organisms/RailSwitcher.jsx'
|
|
198
213
|
/** @deprecated 2026-10-17 — alias of Rail */
|
|
199
214
|
export { default as ShellDrawer } from './organisms/ShellDrawer.jsx'
|
|
200
215
|
export { default as CommandOverlay } from './organisms/CommandOverlay.jsx'
|
|
@@ -212,6 +227,8 @@ export { default as SplitToolButton } from './molecules/SplitToolButton.jsx'
|
|
|
212
227
|
export { default as ToolPalette } from './organisms/ToolPalette.jsx'
|
|
213
228
|
export { default as DocumentEditor } from './organisms/DocumentEditor.jsx'
|
|
214
229
|
export { default as SwatchControls, SwatchStack, EyedropPick } from './molecules/SwatchControls.jsx'
|
|
230
|
+
/* the open documents' strip: a tab per document, close, unsaved, a plus (Figma's tab strip in kolbox, 2026-11-22) */
|
|
231
|
+
export { default as TabsDocument } from './molecules/TabsDocument.jsx'
|
|
215
232
|
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
233
|
/** @deprecated 2026-10-17 — alias of `TabsRow variant="chip"` */
|
|
217
234
|
export { default as TabChips } from './molecules/TabChips.jsx'
|
|
@@ -260,6 +277,11 @@ export { default as FeaturedCarousel } from './organisms/FeaturedCarousel.jsx'
|
|
|
260
277
|
export { default as FeaturesCardSection } from './organisms/FeaturesCardSection.jsx'
|
|
261
278
|
/* the growing line on @kolkrabbi/kol-growth (GrowthLineStage, kol-atlas 2026-10-30) */
|
|
262
279
|
export { default as GrowthLineStage } from './organisms/GrowthLineStage.jsx'
|
|
280
|
+
/* the form tuner's two boards on @kolkrabbi/kol-tuner (W27.4, 2026-11-19) */
|
|
281
|
+
export { default as LogoSystem } from './organisms/LogoSystem.jsx'
|
|
282
|
+
export { default as LogoTuner } from './organisms/LogoTuner.jsx'
|
|
283
|
+
/* the boards' palettes, for a host drawing beside them (a sheet of rolls) */
|
|
284
|
+
export { inksOf as logoInks } from './organisms/logoBoard.jsx'
|
|
263
285
|
/* the app loader's runtime half and its intro claim (LoaderAppIntro, kol-fxr 2026-11-01) — here because GrowthLineStage
|
|
264
286
|
* claims it; kol-framework re-exports it, which stays its documented home */
|
|
265
287
|
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,13 +16,25 @@ 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
|
-
<Menu align={align} offset={8} minWidth={200} items={items}
|
|
35
|
+
<Menu align={align} offset={8} minWidth={200} items={items} className={className}
|
|
23
36
|
trigger={({ open, props }) => (
|
|
24
|
-
<MenuTrigger
|
|
37
|
+
<MenuTrigger size={size} open={open} iconOnly="user" iconComponent={avatar ?? undefined} aria-label={name} {...props} />
|
|
25
38
|
)} />
|
|
26
39
|
)
|
|
27
40
|
}
|
|
@@ -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()}>
|