@kolkrabbi/kol-component 0.377.0 → 0.378.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolkrabbi/kol-component",
3
- "version": "0.377.0",
3
+ "version": "0.378.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -32,9 +32,9 @@
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-markdown": "^0.2.0",
36
35
  "@kolkrabbi/kol-search": "^0.3.0",
37
- "@kolkrabbi/kol-growth": "^0.5.0"
36
+ "@kolkrabbi/kol-growth": "^0.5.0",
37
+ "@kolkrabbi/kol-markdown": "^0.2.0"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@kolkrabbi/kol-icons": ">=0.69.0",
@@ -29,7 +29,8 @@ import Button from '../atoms/Button.jsx'
29
29
  * @param {'nav'|'property'|'modal'|'settings'} [variant='property']
30
30
  * @param {string} [icon] nav · modal: the lead glyph
31
31
  * @param {ReactNode} [title] the title slot — text, or a node in the title position
32
- * @param {ReactNode} [kind] settings: the line beside the title
32
+ * @param {ReactNode} [kind] settings · property: the quiet second text beside the title (the preset beside the effect —
33
+ * no middot in a title, plan-2026-11-12-one-header W10.1)
33
34
  * @param {Function} [onSwitch] nav: the switcher's press; shows the ⌄
34
35
  * @param {ReactNode} [end] the end slot — before the toggles
35
36
  * @param {Function} [onExpand] · {Function} [onCollapseH] · {boolean} [collapsedV] · {Function} [onCollapseV]
@@ -50,14 +51,14 @@ export default function Header({ variant = 'property', icon, title, kind, onSwit
50
51
  const any = end || onExpand || onCollapseH || onCollapseV
51
52
 
52
53
  if (variant === 'settings') return (
53
- <header className={`flex items-center gap-4 h-[60px] shrink-0 pl-6 pr-[22px] border-b border-oq-16 ${className}`.trim()}>
54
+ <header className={`flex items-center gap-4 h-[60px] shrink-0 pl-6 pr-[15px] border-b border-oq-16 ${className}`.trim()}>
54
55
  <h2 className="text-[14px] font-semibold leading-none">{title}</h2>
55
56
  {kind && <span className="text-[11px] text-oq-64 leading-none mt-px">{kind}</span>}
56
57
  {/* `end`: the header's right side pushed by its own margin, no spacer (LAW 10) */}
57
58
  <div className="ml-auto flex items-center gap-4">
58
59
  {end}{toggles}
59
60
  {onClose && <button type="button" aria-label="Close" onClick={onClose}
60
- className="ml-3 size-7 -mr-[7px] inline-flex items-center justify-center rounded-md text-[20px] leading-none text-oq-64 hover:text-(--kol-fg-96) hover:bg-(--kol-oq-08) focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">×</button>}
61
+ className="ml-3 size-7 inline-flex items-center justify-center rounded-md text-[20px] leading-none text-oq-64 hover:text-(--kol-fg-96) hover:bg-(--kol-oq-08) focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">×</button>}
61
62
  </div>
62
63
  </header>
63
64
  )
@@ -86,7 +87,10 @@ export default function Header({ variant = 'property', icon, title, kind, onSwit
86
87
  <div data-float-module-header="" className={`flex w-full min-w-0 shrink-0 items-center justify-between gap-2 ${className}`.trim()}>
87
88
  {slot != null && slot !== false && (isValidElement(slot)
88
89
  ? <div data-rail-header-title="" className="flex min-w-0 flex-1">{slot}</div>
89
- : <span className="kol-float-panel text-emphasis min-w-0 flex-1 truncate">{slot}</span>)}
90
+ : kind != null && kind !== ''
91
+ /* `kind` — the quiet second text beside the title (W10.1: "Drift" + "Storm", never "Drift · Storm") */
92
+ ? <span className="flex min-w-0 flex-1 items-baseline gap-2"><span className="kol-float-panel text-emphasis min-w-0 shrink truncate">{slot}</span><span className="kol-float-panel text-oq-64 min-w-0 truncate">{kind}</span></span>
93
+ : <span className="kol-float-panel text-emphasis min-w-0 flex-1 truncate">{slot}</span>)}
90
94
  {(any || onClose) && <span className="ml-auto flex shrink-0 items-center gap-1">
91
95
  {end}{toggles}
92
96
  {onClose && <Button variant="float" tone="ghost" size="sm" iconOnly="x" aria-label="Close" onClick={onClose} />}
@@ -352,7 +352,8 @@ export function useModal() {
352
352
  * `[{ key, label, state }]` — the name and a one-line state, 6 apart; the lit one carries its 2px marker and no fill,
353
353
  * hover the only fill (LAW 16, plan-2026-11-12-float-rails-figma W13.1; it sat on oq-12 until then); `section` /
354
354
  * `onSection`), the body (`children`, 24 in, scrolling), an `aside` column 248 wide (the preview), and a 60 `footer`. The
355
- * secondary surface, a 16 round, oq-16 rules between the parts — his frame draws them. `height` (default 656) and
355
+ * secondary surface, a 20 round, no outer border (his mock 143:35343, W8.1), oq-16 rules between the parts; the footer hugs
356
+ * its 60 and the body fills the rest. `height` (default 656) and
356
357
  * `width` (default 880) are its size; both shrink to the viewport.
357
358
  * @param {string} [kind] settings: the line beside the title ("Generate")
358
359
  * @param {ReactNode} [headerEnd] settings: the header's right side, before the × (the preset select)
@@ -14,13 +14,13 @@ import { forwardRef } from 'react'
14
14
  * </ModalShell>
15
15
  *
16
16
  * ONE RADIUS: `--kol-radius-sm` (4px) — the radius Modal's prompts and Dialog wore. The float style's windows keep the
17
- * float window radius (`float`, 28) and the generator settings window its 16 (`settings`); both are the float style's
17
+ * float window radius (`float`, 28) and the generator settings window its 20 (`settings`, no outer border — his mock 143:35343, plan-2026-11-12-one-header W8.1); both are the float style's
18
18
  * own, drawn in its Figma.
19
19
  *
20
20
  * @param {'lift'|'bordered'|'float'|'settings'} [variant='lift']
21
21
  * `lift` — the overlay panel every KOL overlay wears (`.kol-overlay-panel`: oq-04, no border, the scrim is the edge);
22
22
  * `bordered` — the page surface behind an fg-08 hairline (Modal's prompts); `float` — the float window
23
- * (`kol-float-solid`); `settings` — the generator settings window (the secondary surface, oq-16 edge, the float shadow).
23
+ * (`kol-float-solid`); `settings` — the generator settings window (the secondary surface, radius 20, the float shadow, no border).
24
24
  * @param {ReactNode} [header] drawn first
25
25
  * @param {ReactNode} [footer] drawn last
26
26
  * @param {string} [className] the caller's layout: padding, gap, size
@@ -31,7 +31,7 @@ const VARIANTS = {
31
31
  lift: { className: 'kol-overlay-panel rounded-[var(--kol-radius-sm)]', style: {} },
32
32
  bordered: { className: 'border border-fg-08 rounded-[var(--kol-radius-sm)]', style: { background: 'var(--kol-surface-primary)', color: 'var(--kol-surface-on-primary)' } },
33
33
  float: { className: 'kol-float-solid !rounded-[var(--kol-float-window-r)] text-fg-emphasis', style: {} },
34
- settings: { className: 'rounded-2xl border border-oq-16 bg-surface-secondary text-fg-96 font-(family-name:--kol-font-family-float) shadow-[var(--kol-shadow-float)]', style: {} },
34
+ settings: { className: 'rounded-[20px] bg-surface-secondary text-fg-96 font-(family-name:--kol-font-family-float) shadow-[var(--kol-shadow-float)]', style: {} },
35
35
  }
36
36
 
37
37
  const ModalShell = forwardRef(function ModalShell({ variant = 'lift', header, footer, className = '', style, children, ...rest }, ref) {
@@ -26,6 +26,7 @@ import { floatSurfaceClass } from '../utilities/tone.js'
26
26
  * @param {'property'|'nav'} [headerVariant='property'] the Header's variant while open (`nav`: NavRail float's switcher,
27
27
  * with `icon` and `onSwitch`); collapsed-v, the pill is always the plain title
28
28
  * @param {ReactNode} [title] the header's title, and the collapsed pill's
29
+ * @param {ReactNode} [kind] the quiet second text beside the title (the preset beside the effect, W10.1)
29
30
  * @param {ReactNode} [head] replaces the title in the open header (a consumer's own switcher)
30
31
  * @param {ReactNode} [actions] the Header's `end`: before the toggles; not on the collapsed pill
31
32
  * @param {Function} [onExpand] · {Function} [onCollapseH] the Header's expand and collapse-h; not on the collapsed pill
@@ -43,7 +44,7 @@ import { floatSurfaceClass } from '../utilities/tone.js'
43
44
  */
44
45
  const INSET = { md: 'p-4', sm: 'p-3', none: '' }
45
46
 
46
- export default function RailFloat({ header, headerVariant = 'property', icon, onSwitch, title, head, actions, onExpand, onCollapseH, collapsibleV, collapsedV, defaultCollapsedV, onCollapseV, foldable, folded, defaultFolded, onFold, compact = false, wide = false, width, inset = 'md', surface = 'solid', footer, as: Tag = 'section', className = '', bodyClassName = '', style, 'aria-label': ariaLabel, children }) {
47
+ export default function RailFloat({ header, headerVariant = 'property', icon, onSwitch, title, kind, head, actions, onExpand, onCollapseH, collapsibleV, collapsedV, defaultCollapsedV, onCollapseV, foldable, folded, defaultFolded, onFold, compact = false, wide = false, width, inset = 'md', surface = 'solid', footer, as: Tag = 'section', className = '', bodyClassName = '', style, 'aria-label': ariaLabel, children }) {
47
48
  const canV = collapsibleV ?? foldable ?? false
48
49
  const ctlV = collapsedV ?? folded
49
50
  const [ownV, setOwnV] = useState(defaultCollapsedV ?? defaultFolded ?? false)
@@ -53,8 +54,8 @@ export default function RailFloat({ header, headerVariant = 'property', icon, on
53
54
  const label = ariaLabel ?? (typeof title === 'string' ? title : undefined)
54
55
  const gap = compact ? 'gap-2' : 'gap-[var(--kol-float-module-gap)]'
55
56
  const headerSlot = header ?? ((head || title || actions || canV || onExpand || onCollapseH) && (isV
56
- ? <Header variant="property" title={title} collapsedV onCollapseV={toggleV} />
57
- : <Header variant={headerVariant} icon={icon} onSwitch={onSwitch} title={head ?? title} end={actions} onExpand={onExpand} onCollapseH={onCollapseH} onCollapseV={canV ? toggleV : undefined} />
57
+ ? <Header variant="property" title={title} kind={kind} collapsedV onCollapseV={toggleV} />
58
+ : <Header variant={headerVariant} icon={icon} onSwitch={onSwitch} title={head ?? title} kind={head ? undefined : kind} end={actions} onExpand={onExpand} onCollapseH={onCollapseH} onCollapseV={canV ? toggleV : undefined} />
58
59
  ))
59
60
  const shape = isV
60
61
  ? 'flex-row items-center rounded-full pl-4 pr-1.5'
@@ -1,4 +1,4 @@
1
- import { Children } from 'react'
1
+ import { Children, useState } from 'react'
2
2
  import { IconLoader } from '@kolkrabbi/kol-icons'
3
3
  import Button from '../atoms/Button.jsx'
4
4
  import Dropdown from '../molecules/Dropdown.jsx'
@@ -199,7 +199,8 @@ export function SettingsSwitch({ on = false, onChange, disabled = false, disable
199
199
  * (`nav` for a list of links), the rest of the props on it. */
200
200
  const GAP = { 0.5: 'gap-0.5', 1: 'gap-1', 1.5: 'gap-1.5', 2: 'gap-2', 3: 'gap-3', module: 'gap-[var(--kol-float-module-gap)]' }
201
201
  const SETTINGS_GAP = { 3: 'gap-3', 4: 'gap-4', settings: 'gap-[7px]' }
202
- export function LabeledControlSection({ label, end, variant, divided = false, gap, rowGap, as: Tag = 'div', children, className = '', ...rest }) {
202
+ export function LabeledControlSection({ label, end, variant, divided = false, gap, rowGap, collapsible = false, open, defaultOpen = true, onToggle, as: Tag = 'div', children, className = '', ...rest }) {
203
+ const [ownOpen, setOwnOpen] = useState(defaultOpen)
203
204
  /* `variant="settings"` (plan-2026-11-12-float-rails-figma W13.1): the generator settings window's group — the head is
204
205
  * the title (a string in Inter 12 semibold) with `end` (the note) at its right on one baseline, 15 over the items;
205
206
  * `divided` rules it off from the next group (22 under the items, an oq-16 rule, 18 to the next; the last none).
@@ -222,15 +223,28 @@ export function LabeledControlSection({ label, end, variant, divided = false, ga
222
223
  if (variant === 'float') {
223
224
  const items = Children.toArray(children)
224
225
  const hasLabel = label != null && label !== false && label !== ''
226
+ const head = hasLabel && (typeof label === 'string' ? <span className="kol-float-label text-oq-64">{label}</span> : label)
227
+ /* `collapsible` (plan-2026-11-12-one-header W10.1): the head is the toggle, ONE indicator — the 12 chevron at its right
228
+ * end (⌄ open, › closed), the Header's chevron; `open` controlled or `defaultOpen`, `onToggle(open)`. `end` sits before
229
+ * the chevron and must not be interactive. The items hide while closed. */
230
+ const isOpen = !collapsible || (open ?? ownOpen)
231
+ const toggle = () => { const next = !isOpen; if (open === undefined) setOwnOpen(next); onToggle?.(next) }
225
232
  return (
226
- <Tag data-labeled-control-section="" className={`flex flex-col ${GAP[gap ?? 3]} ${className}`.trim()} {...rest}>
227
- {(hasLabel || end) && (
233
+ <Tag data-labeled-control-section="" data-open={collapsible ? String(isOpen) : undefined} className={`flex flex-col ${GAP[gap ?? 3]} ${className}`.trim()} {...rest}>
234
+ {collapsible ? (
235
+ <button type="button" aria-expanded={isOpen} onClick={toggle}
236
+ className="flex w-full items-center gap-2 text-left rounded-sm cursor-pointer focus-visible:outline-none focus-visible:shadow-[var(--kol-float-focus)]">
237
+ <span className="flex min-w-0 flex-1 items-center">{head}</span>
238
+ {end}
239
+ <IconLoader name={isOpen ? 'chevron-down' : 'chevron-right'} size="var(--kol-float-chev-sm)" className="shrink-0 text-oq-64" />
240
+ </button>
241
+ ) : (hasLabel || end) && (
228
242
  <div className="flex items-center justify-between">
229
- {hasLabel && (typeof label === 'string' ? <span className="kol-float-label text-oq-64">{label}</span> : label)}
243
+ {head}
230
244
  {end}
231
245
  </div>
232
246
  )}
233
- {items.length > 0 && <div className={`flex flex-col ${GAP[rowGap ?? 2]}`}>{items}</div>}
247
+ {isOpen && items.length > 0 && <div className={`flex flex-col ${GAP[rowGap ?? 2]}`}>{items}</div>}
234
248
  </Tag>
235
249
  )
236
250
  }