@kolkrabbi/kol-component 0.32.4 → 0.32.5
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.32.
|
|
3
|
+
"version": "0.32.5",
|
|
4
4
|
"description": "KOL design-system components — atoms through organisms, emitting canonical kol-* classes. Pairs with @kolkrabbi/kol-theme for styling.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -37,8 +37,13 @@ import Dropdown from './Dropdown'
|
|
|
37
37
|
*
|
|
38
38
|
* Options: strings, or { value, label, tone } — tone ∈ success|warning|error|
|
|
39
39
|
* info maps onto the --ui-* ladder (.kol-status-chip--* in kol-theme); the
|
|
40
|
-
* chip wears the ACTIVE option's tone. No tone → the plain Tag look.
|
|
41
|
-
|
|
40
|
+
* chip wears the ACTIVE option's tone. No tone → the plain Tag look.
|
|
41
|
+
*
|
|
42
|
+
* variant="primary" — the toneless pill wears the Dropdown-primary fill
|
|
43
|
+
* instead of the neutral mix (RecordManager's select columns, user frame
|
|
44
|
+
* 2026-08-09: "use status pill, but same look as dropdown primary"). An
|
|
45
|
+
* option's tone always outranks the variant. */
|
|
46
|
+
export function StatusChip({ value, options = [], onChange, variant = 'neutral', size = 'sm' }) {
|
|
42
47
|
const [open, setOpen] = useState(false)
|
|
43
48
|
const popover = usePopover({
|
|
44
49
|
open,
|
|
@@ -49,7 +54,9 @@ export function StatusChip({ value, options = [], onChange, size = 'sm' }) {
|
|
|
49
54
|
})
|
|
50
55
|
const norm = options.map((opt) => (typeof opt === 'object' ? opt : { value: opt, label: opt }))
|
|
51
56
|
const activeOpt = norm.find((o) => o.value === value)
|
|
52
|
-
const toneCls = activeOpt?.tone
|
|
57
|
+
const toneCls = activeOpt?.tone
|
|
58
|
+
? ` kol-status-chip--${activeOpt.tone}`
|
|
59
|
+
: variant === 'primary' ? ' kol-status-chip--primary' : ''
|
|
53
60
|
/* BUILT ON THE COVER-FOCUS SPECS (user ruling 2026-08-09: "same component
|
|
54
61
|
* as cover focus"): the chip wears the Dropdown-sm trigger metrics — the
|
|
55
62
|
* kol-btn-sm box (py-1 px-3) and mono-12 type at its OWN 16px leading, so
|
|
@@ -5,7 +5,6 @@ import Button from '../atoms/Button'
|
|
|
5
5
|
import SearchInput from '../molecules/SearchInput'
|
|
6
6
|
import ToggleCheckbox from '../atoms/ToggleCheckbox'
|
|
7
7
|
import ShellDrawer from '../molecules/ShellDrawer'
|
|
8
|
-
import Dropdown from '../molecules/Dropdown'
|
|
9
8
|
import FieldRow, { StatusChip } from '../molecules/FieldRow'
|
|
10
9
|
import { Tooltip } from '../atoms/Popover'
|
|
11
10
|
import Table from './Table'
|
|
@@ -181,10 +180,15 @@ export default function RecordManager({
|
|
|
181
180
|
if (col.type === 'select') {
|
|
182
181
|
return {
|
|
183
182
|
...col,
|
|
183
|
+
/* the reference's select cell ("Center ▾") is a PILL, not the square
|
|
184
|
+
* Dropdown trigger — the StatusChip apparatus wearing the Dropdown-
|
|
185
|
+
* primary fill (user frame 2026-08-09: "use status pill, but same
|
|
186
|
+
* look as dropdown primary"). Panel select fields stay Dropdown. */
|
|
184
187
|
render: (row) => (
|
|
185
|
-
<
|
|
186
|
-
|
|
188
|
+
<StatusChip
|
|
189
|
+
variant="primary"
|
|
187
190
|
value={row[col.accessor]}
|
|
191
|
+
options={col.options ?? []}
|
|
188
192
|
onChange={(next) => col.onSelectChange?.(row, next)}
|
|
189
193
|
/>
|
|
190
194
|
),
|
|
@@ -196,7 +200,8 @@ export default function RecordManager({
|
|
|
196
200
|
render: (row) => {
|
|
197
201
|
const media = row[col.accessor]
|
|
198
202
|
return media ? (
|
|
199
|
-
|
|
203
|
+
/* 2:1 landscape (user frame 2026-08-09: "more landscape") */
|
|
204
|
+
<img src={media.thumb ?? media.url} alt={media.name ?? ''} className="h-10 w-20 rounded object-cover bg-fg-04" />
|
|
200
205
|
) : (
|
|
201
206
|
<span className="kol-helper-10 text-meta">—</span>
|
|
202
207
|
)
|
|
@@ -292,8 +297,10 @@ export default function RecordManager({
|
|
|
292
297
|
rows={rows}
|
|
293
298
|
width="column"
|
|
294
299
|
compact
|
|
300
|
+
/* align-middle: cell content centres in the row (reference grammar,
|
|
301
|
+
* user frame 2026-08-09) — scoped here; Table's base stays v-top */
|
|
295
302
|
rowClassName={(row, i) =>
|
|
296
|
-
`group${drag && i === drag.from ? ' opacity-40' : ''}${
|
|
303
|
+
`group align-middle${drag && i === drag.from ? ' opacity-40' : ''}${
|
|
297
304
|
drag && i === drag.over && drag.over !== drag.from ? ' bg-fg-04' : ''
|
|
298
305
|
}`
|
|
299
306
|
}
|