@mindlogic-ai/logician-ui 3.1.0-alpha.5 → 3.1.0-alpha.7
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/dist/components/Card/Card.d.ts.map +1 -1
- package/dist/components/Card/Card.js +6 -1
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Card/Card.mjs +6 -1
- package/dist/components/Card/Card.mjs.map +1 -1
- package/dist/components/Table/ExpandingTr/ExpandingTr.types.d.ts +1 -1
- package/dist/components/Table/ExpandingTr/ExpandingTr.types.d.ts.map +1 -1
- package/dist/components/Table/Table.styles.d.ts +1 -1
- package/dist/components/Table/Table.styles.d.ts.map +1 -1
- package/dist/components/Table/Table.styles.js +5 -2
- package/dist/components/Table/Table.styles.js.map +1 -1
- package/dist/components/Table/Table.styles.mjs +5 -2
- package/dist/components/Table/Table.styles.mjs.map +1 -1
- package/dist/components/Table/Table.types.d.ts +13 -0
- package/dist/components/Table/Table.types.d.ts.map +1 -1
- package/dist/components/Table/Tbody.d.ts.map +1 -1
- package/dist/components/Table/Tbody.js +2 -8
- package/dist/components/Table/Tbody.js.map +1 -1
- package/dist/components/Table/Tbody.mjs +2 -8
- package/dist/components/Table/Tbody.mjs.map +1 -1
- package/dist/components/Table/Th.d.ts.map +1 -1
- package/dist/components/Table/Th.js +1 -1
- package/dist/components/Table/Th.js.map +1 -1
- package/dist/components/Table/Th.mjs +1 -1
- package/dist/components/Table/Th.mjs.map +1 -1
- package/dist/components/Table/Thead.d.ts +2 -2
- package/dist/components/Table/Thead.d.ts.map +1 -1
- package/dist/components/Table/Thead.js +2 -2
- package/dist/components/Table/Thead.js.map +1 -1
- package/dist/components/Table/Thead.mjs +2 -2
- package/dist/components/Table/Thead.mjs.map +1 -1
- package/dist/components/Table/Tr.d.ts +10 -2
- package/dist/components/Table/Tr.d.ts.map +1 -1
- package/dist/components/Table/Tr.js +14 -3
- package/dist/components/Table/Tr.js.map +1 -1
- package/dist/components/Table/Tr.mjs +14 -3
- package/dist/components/Table/Tr.mjs.map +1 -1
- package/dist/theme/colors.d.ts +32 -2
- package/dist/theme/colors.d.ts.map +1 -1
- package/dist/theme/colors.js +26 -5
- package/dist/theme/colors.js.map +1 -1
- package/dist/theme/colors.mjs +26 -5
- package/dist/theme/colors.mjs.map +1 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +4 -0
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/index.mjs +4 -0
- package/dist/theme/index.mjs.map +1 -1
- package/dist/theme/recipes/table.d.ts +19 -0
- package/dist/theme/recipes/table.d.ts.map +1 -0
- package/dist/theme/recipes/table.js +97 -0
- package/dist/theme/recipes/table.js.map +1 -0
- package/dist/theme/recipes/table.mjs +95 -0
- package/dist/theme/recipes/table.mjs.map +1 -0
- package/package.json +1 -1
- package/src/components/Card/Card.tsx +5 -1
- package/src/components/Table/ExpandingTr/ExpandingTr.types.ts +1 -1
- package/src/components/Table/Table.stories.tsx +104 -0
- package/src/components/Table/Table.styles.ts +5 -2
- package/src/components/Table/Table.types.ts +16 -0
- package/src/components/Table/Tbody.tsx +2 -20
- package/src/components/Table/Th.tsx +2 -1
- package/src/components/Table/Thead.tsx +4 -2
- package/src/components/Table/Tr.tsx +31 -3
- package/src/components/Textarea/Textarea.stories.tsx +1 -1
- package/src/theme/Palette.stories.tsx +1 -1
- package/src/theme/SemanticTokens.mdx +3 -0
- package/src/theme/claude.md +4 -4
- package/src/theme/colors.ts +35 -6
- package/src/theme/index.ts +4 -0
- package/src/theme/recipes/table.ts +91 -0
|
@@ -1,27 +1,9 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import { Table } from '@chakra-ui/react';
|
|
3
3
|
|
|
4
|
-
import { mergeCss } from '@/utils/mergeCss';
|
|
5
|
-
|
|
6
4
|
export const Tbody = forwardRef<HTMLTableSectionElement, Table.BodyProps>(
|
|
7
|
-
(
|
|
8
|
-
return
|
|
9
|
-
<Table.Body
|
|
10
|
-
ref={ref}
|
|
11
|
-
color="fg.default"
|
|
12
|
-
fontWeight="medium"
|
|
13
|
-
{...props}
|
|
14
|
-
css={mergeCss(
|
|
15
|
-
{
|
|
16
|
-
// Remove bottom border from last row to prevent overlap with container border
|
|
17
|
-
'& > tr:last-of-type > td': {
|
|
18
|
-
borderBottom: 'none',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
css
|
|
22
|
-
)}
|
|
23
|
-
/>
|
|
24
|
-
);
|
|
5
|
+
(props, ref) => {
|
|
6
|
+
return <Table.Body ref={ref} {...props} />;
|
|
25
7
|
}
|
|
26
8
|
);
|
|
27
9
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Table } from '@chakra-ui/react';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { TableHeaderProps } from './Table.types';
|
|
4
|
+
|
|
5
|
+
export const Thead = ({ sticky, ...rest }: TableHeaderProps) => {
|
|
6
|
+
return <Table.Header data-sticky={sticky ? '' : undefined} {...rest} />;
|
|
5
7
|
};
|
|
@@ -1,5 +1,33 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
1
2
|
import { Table } from '@chakra-ui/react';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { TableRowProps } from './Table.types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Table row.
|
|
8
|
+
*
|
|
9
|
+
* Sets `data-interactive` automatically when the row is clickable (onClick,
|
|
10
|
+
* role="button", or tabIndex), which keys the hover/cursor/focus styling in
|
|
11
|
+
* the table recipe — static rows never highlight. The ref is forwarded so
|
|
12
|
+
* drag-and-drop rows (e.g. dnd-kit) can attach directly.
|
|
13
|
+
*/
|
|
14
|
+
export const Tr = forwardRef<HTMLTableRowElement, TableRowProps>(
|
|
15
|
+
({ state, ...rest }, ref) => {
|
|
16
|
+
const isInteractive =
|
|
17
|
+
rest.onClick != null || rest.role === 'button' || rest.tabIndex != null;
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Table.Row
|
|
21
|
+
ref={ref}
|
|
22
|
+
h={12}
|
|
23
|
+
data-interactive={isInteractive ? '' : undefined}
|
|
24
|
+
data-selected={state === 'selected' ? '' : undefined}
|
|
25
|
+
data-invalid={state === 'invalid' ? '' : undefined}
|
|
26
|
+
data-highlighted={state === 'highlighted' ? '' : undefined}
|
|
27
|
+
{...rest}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
Tr.displayName = 'Tr';
|
|
@@ -65,7 +65,7 @@ export const Invalid: Story = {
|
|
|
65
65
|
value={value}
|
|
66
66
|
onChange={(e) => setValue(e.target.value)}
|
|
67
67
|
/>
|
|
68
|
-
<span style={{ color: '#
|
|
68
|
+
<span style={{ color: '#C1232C', fontSize: '14px' }}>
|
|
69
69
|
This field contains an error. Please fix it.
|
|
70
70
|
</span>
|
|
71
71
|
</div>
|
|
@@ -67,6 +67,9 @@ between a light and a dark value.
|
|
|
67
67
|
| `bg.subtle` | `gray.50` | `gray.1300` | Subtle fill, hover background, secondary surface |
|
|
68
68
|
| `bg.muted` | `gray.100` | `gray.1200` | Muted fill, tertiary surface, neutral chips |
|
|
69
69
|
| `bg.inverse` | `gray.1300` | `gray.50` | High-contrast/inverse surface (flips with mode) |
|
|
70
|
+
| `bg.selected` | `blue.25` | `blue.900` | Selected rows/items (mirrors `primary.lightest`) |
|
|
71
|
+
| `bg.invalid.subtle` | `rose.25` | `rose.900` | Validation-error rows/fields (mirrors `danger.lightest`) |
|
|
72
|
+
| `bg.highlighted` | `gold.25` | `gold.900` | Transient highlights, scroll-to emphasis (mirrors `warning.lightest`) |
|
|
70
73
|
|
|
71
74
|
### Border — `border.*` (borders & dividers)
|
|
72
75
|
|
package/src/theme/claude.md
CHANGED
|
@@ -54,8 +54,8 @@ Error and destructive action states.
|
|
|
54
54
|
| `rose.100` | `#F3B9BD` | Light error fills |
|
|
55
55
|
| `rose.200` | `#E87D84` | Error borders, icons |
|
|
56
56
|
| `rose.300` | `#DC4A53` | Error accents |
|
|
57
|
-
| `rose.500` | `#
|
|
58
|
-
| `rose.600` | `#
|
|
57
|
+
| `rose.500` | `#C1232C` | **Danger main** - error states |
|
|
58
|
+
| `rose.600` | `#9C1C23` | Hover on main |
|
|
59
59
|
| `rose.700` | `#7D0D14` | Error text |
|
|
60
60
|
| `rose.800` | `#53090D` | Dark emphasis |
|
|
61
61
|
| `rose.900` | `#2A0407` | Darkest, high contrast |
|
|
@@ -161,7 +161,7 @@ semanticTokens: {
|
|
|
161
161
|
extralight: 'rose.50', // #FBE8E9 - Extra-light backgrounds
|
|
162
162
|
lighter: 'rose.100', // #F3B9BD - Light error fills
|
|
163
163
|
light: 'rose.200', // #E87D84 - Error borders
|
|
164
|
-
main: 'rose.500', // #
|
|
164
|
+
main: 'rose.500', // #C1232C - Error states
|
|
165
165
|
dark: 'rose.700', // #7D0D14 - Error text on light bg
|
|
166
166
|
darker: 'rose.900', // #2A0407 - High contrast error text
|
|
167
167
|
},
|
|
@@ -249,7 +249,7 @@ All semantic color combinations meet WCAG 2.1 accessibility standards:
|
|
|
249
249
|
| `primary.lightest` + `primary.dark` | 7.2:1 | AAA |
|
|
250
250
|
| `primary.main` + white | 5.9:1 | AA |
|
|
251
251
|
| `danger.lightest` + `danger.dark` | 7.4:1 | AAA |
|
|
252
|
-
| `danger.main` + white | 5.
|
|
252
|
+
| `danger.main` + white | 5.9:1 | AA |
|
|
253
253
|
| `success.lightest` + `success.dark` | 6.1:1 | AA |
|
|
254
254
|
| `warning.lightest` + `warning.dark` | 5.8:1 | AA |
|
|
255
255
|
| `gray.0` + `gray.1300` | 11.2:1 | AAA |
|
package/src/theme/colors.ts
CHANGED
|
@@ -140,7 +140,7 @@ export const semanticTokens = {
|
|
|
140
140
|
* Use for: Error states, destructive actions, validation errors
|
|
141
141
|
*
|
|
142
142
|
* Light contrast ratios (on white):
|
|
143
|
-
* - main (#
|
|
143
|
+
* - main (#C1232C): 5.9:1 ✓ AA
|
|
144
144
|
* - dark (#7D0D14): 9.6:1 ✓ AAA
|
|
145
145
|
*/
|
|
146
146
|
danger: {
|
|
@@ -268,6 +268,27 @@ export const semanticTokens = {
|
|
|
268
268
|
panel: {
|
|
269
269
|
value: { base: '{colors.white}', _dark: '{colors.gray.1400}' },
|
|
270
270
|
},
|
|
271
|
+
/**
|
|
272
|
+
* Row/selection state tints. Use these for selected rows,
|
|
273
|
+
* validation-error rows, and transient highlights instead of
|
|
274
|
+
* hand-picking `primary.*`/`danger.*` tints at the call site.
|
|
275
|
+
*
|
|
276
|
+
* Values mirror `primary.lightest` / `danger.lightest` /
|
|
277
|
+
* `warning.lightest` (this Chakra version doesn't resolve
|
|
278
|
+
* semantic→semantic token references, so the primitive pairs are
|
|
279
|
+
* repeated here — keep them in sync with the brand ramps above).
|
|
280
|
+
*/
|
|
281
|
+
selected: {
|
|
282
|
+
value: { base: '{colors.blue.25}', _dark: '{colors.blue.900}' },
|
|
283
|
+
},
|
|
284
|
+
invalid: {
|
|
285
|
+
subtle: {
|
|
286
|
+
value: { base: '{colors.rose.25}', _dark: '{colors.rose.900}' },
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
highlighted: {
|
|
290
|
+
value: { base: '{colors.gold.25}', _dark: '{colors.gold.900}' },
|
|
291
|
+
},
|
|
271
292
|
},
|
|
272
293
|
|
|
273
294
|
/**
|
|
@@ -336,7 +357,15 @@ export const semanticTokens = {
|
|
|
336
357
|
* contract. App code should use `bg.surface`/`bg.canvas`.
|
|
337
358
|
*/
|
|
338
359
|
export type SemanticColorToken =
|
|
339
|
-
| `bg.${
|
|
360
|
+
| `bg.${
|
|
361
|
+
| 'canvas'
|
|
362
|
+
| 'surface'
|
|
363
|
+
| 'subtle'
|
|
364
|
+
| 'muted'
|
|
365
|
+
| 'inverse'
|
|
366
|
+
| 'selected'
|
|
367
|
+
| 'highlighted'}`
|
|
368
|
+
| 'bg.invalid.subtle'
|
|
340
369
|
| `fg.${'default' | 'muted' | 'subtle' | 'inverse'}`
|
|
341
370
|
| `border.${'default' | 'subtle' | 'strong'}`
|
|
342
371
|
| `${'primary' | 'secondary' | 'danger' | 'success' | 'warning'}.${
|
|
@@ -409,8 +438,8 @@ export const colors = {
|
|
|
409
438
|
100: { value: '#F3B9BD' }, // Lighter - subtle error fills
|
|
410
439
|
200: { value: '#E87D84' }, // Light - error borders
|
|
411
440
|
300: { value: '#DC4A53' }, // Medium - error accents
|
|
412
|
-
500: { value: '#
|
|
413
|
-
600: { value: '#
|
|
441
|
+
500: { value: '#C1232C' }, // Base - danger.main (desaturated ~1 notch from #D01721)
|
|
442
|
+
600: { value: '#9C1C23' }, // Dark - hover on main (desaturated to match .500)
|
|
414
443
|
700: { value: '#7D0D14' }, // Darker - error text
|
|
415
444
|
800: { value: '#53090D' }, // Very dark - emphasis
|
|
416
445
|
900: { value: '#2A0407' }, // Darkest - high contrast
|
|
@@ -523,8 +552,8 @@ export const colors = {
|
|
|
523
552
|
100: { value: '#F3B9BD' },
|
|
524
553
|
200: { value: '#E87D84' },
|
|
525
554
|
300: { value: '#DC4A53' },
|
|
526
|
-
500: { value: '#
|
|
527
|
-
600: { value: '#
|
|
555
|
+
500: { value: '#C1232C' }, // kept in sync with rose.500 (deprecated alias)
|
|
556
|
+
600: { value: '#9C1C23' }, // kept in sync with rose.600 (deprecated alias)
|
|
528
557
|
700: { value: '#7D0D14' },
|
|
529
558
|
800: { value: '#53090D' },
|
|
530
559
|
900: { value: '#2A0407' },
|
package/src/theme/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
|
|
8
8
|
import { colors, semanticTokens } from './colors';
|
|
9
9
|
import { globalCss } from './global';
|
|
10
|
+
import { tableSlotRecipe } from './recipes/table';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Shared textStyle value objects for DRY principle
|
|
@@ -243,6 +244,9 @@ const config = defineConfig({
|
|
|
243
244
|
colors: semanticTokens.colors,
|
|
244
245
|
},
|
|
245
246
|
textStyles,
|
|
247
|
+
slotRecipes: {
|
|
248
|
+
table: tableSlotRecipe,
|
|
249
|
+
},
|
|
246
250
|
},
|
|
247
251
|
});
|
|
248
252
|
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { defineSlotRecipe } from '@chakra-ui/react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Logician overrides for Chakra's `table` slot recipe.
|
|
5
|
+
*
|
|
6
|
+
* Merged on top of Chakra's default table recipe by `createSystem`, so only
|
|
7
|
+
* the deltas live here. Everything uses semantic (mode-aware) tokens so a
|
|
8
|
+
* no-prop <Table> renders the correct header/border/text/hover in both light
|
|
9
|
+
* and dark mode — consumers should only override for genuine per-row state
|
|
10
|
+
* or layout.
|
|
11
|
+
*/
|
|
12
|
+
export const tableSlotRecipe = defineSlotRecipe({
|
|
13
|
+
slots: ['root', 'header', 'body', 'row', 'columnHeader', 'cell'],
|
|
14
|
+
base: {
|
|
15
|
+
root: {
|
|
16
|
+
color: 'fg.default',
|
|
17
|
+
},
|
|
18
|
+
header: {
|
|
19
|
+
color: 'fg.muted',
|
|
20
|
+
fontWeight: 'medium',
|
|
21
|
+
// Opt-in sticky header affordance: <Thead sticky>
|
|
22
|
+
'&[data-sticky]': {
|
|
23
|
+
position: 'sticky',
|
|
24
|
+
top: 0,
|
|
25
|
+
// Above sticky-column cells (zIndex 2 in Table.styles.ts)
|
|
26
|
+
zIndex: 'docked',
|
|
27
|
+
bg: 'bg.surface',
|
|
28
|
+
// border-collapse leaves cell borders behind when the header sticks;
|
|
29
|
+
// the shadow keeps the bottom hairline visible while scrolled
|
|
30
|
+
boxShadow: '0 1px 0 0 {colors.border.subtle}',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
body: {
|
|
34
|
+
fontWeight: 'medium',
|
|
35
|
+
// Remove the last row's bottom border so it doesn't double up with
|
|
36
|
+
// TableContainer's border. Both rules are needed under border-collapse:
|
|
37
|
+
// the row border comes from base.row, the cell border from Chakra's
|
|
38
|
+
// line variant.
|
|
39
|
+
'& > tr:last-of-type': {
|
|
40
|
+
borderBottom: 'none',
|
|
41
|
+
},
|
|
42
|
+
'& > tr:last-of-type > td': {
|
|
43
|
+
borderBottom: 'none',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
row: {
|
|
47
|
+
borderBottomWidth: '1px',
|
|
48
|
+
borderBottomColor: 'border.subtle',
|
|
49
|
+
// Interactive styling is keyed off data-interactive, which <Tr> sets
|
|
50
|
+
// automatically when it receives onClick / role="button" / tabIndex —
|
|
51
|
+
// static tables never pick up hover/cursor styling.
|
|
52
|
+
'&[data-interactive]': {
|
|
53
|
+
cursor: 'pointer',
|
|
54
|
+
_hover: { bg: 'bg.muted' },
|
|
55
|
+
// Inset outline instead of the shared focusRing util (boxShadow
|
|
56
|
+
// ring): rows are clipped by TableContainer's rounded overflow,
|
|
57
|
+
// which would crop an outer ring.
|
|
58
|
+
_focusVisible: {
|
|
59
|
+
outline: '2px solid',
|
|
60
|
+
outlineColor: 'primary.main',
|
|
61
|
+
outlineOffset: '-2px',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
// Row-state tints: set via <Tr state="..."> (data-selected /
|
|
65
|
+
// data-invalid / data-highlighted)
|
|
66
|
+
_selected: { bg: 'bg.selected' },
|
|
67
|
+
_invalid: { bg: 'bg.invalid.subtle' },
|
|
68
|
+
_highlighted: { bg: 'bg.highlighted' },
|
|
69
|
+
},
|
|
70
|
+
columnHeader: {
|
|
71
|
+
color: 'fg.muted',
|
|
72
|
+
fontWeight: 'medium',
|
|
73
|
+
bg: 'bg.subtle',
|
|
74
|
+
borderBottomWidth: '1px',
|
|
75
|
+
borderBottomColor: 'border.subtle',
|
|
76
|
+
},
|
|
77
|
+
cell: {
|
|
78
|
+
borderBottomColor: 'border.subtle',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
variants: {
|
|
82
|
+
variant: {
|
|
83
|
+
line: {
|
|
84
|
+
// Chakra's line variant paints rows with the raw `bg` token (pure
|
|
85
|
+
// black in dark mode); keep rows transparent so the surface behind
|
|
86
|
+
// the table shows through and state tints/hover sit on top.
|
|
87
|
+
row: { bg: 'transparent' },
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
});
|