devnonla-ui 0.19.2 → 0.20.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/README.md +11 -0
- package/package.json +1 -1
- package/src/alert/Alert.tsx +7 -7
- package/src/app/App.tsx +11 -7
- package/src/breadcrumb/Breadcrumb.tsx +80 -0
- package/src/button/Button.tsx +48 -33
- package/src/button/ButtonCopy.tsx +2 -2
- package/src/calendar/Calendar.tsx +12 -12
- package/src/card/Card.tsx +15 -10
- package/src/chat/AgentPanel.tsx +1 -1
- package/src/chat/index.ts +1 -5
- package/src/chat/message-ui/ChatError.tsx +1 -1
- package/src/chat/message-ui/ChatInput.tsx +4 -4
- package/src/chat/message-ui/ChatThinking.tsx +1 -1
- package/src/chat/message-ui/ChatUserMessage.tsx +3 -3
- package/src/chat/message-ui/ChatWelcome.tsx +2 -2
- package/src/chat/tool-ui/BackgroundTasksBar.tsx +6 -6
- package/src/chat/tool-ui/ChatToolCall.tsx +4 -4
- package/src/chat/tool-ui/ToolUiBadge.tsx +1 -1
- package/src/chat/tool-ui/ToolUiTrailing.tsx +1 -1
- package/src/chat/tool-ui/registry.ts +5 -19
- package/src/checkbox/Checkbox.tsx +12 -10
- package/src/colorpicker/ColorPicker.tsx +2 -2
- package/src/command-palette/CommandPalette.tsx +223 -0
- package/src/drawer/Drawer.tsx +1 -1
- package/src/dropdown/Dropdown.tsx +4 -3
- package/src/dropdown/menuClasses.ts +2 -2
- package/src/empty/Empty.tsx +23 -9
- package/src/form/FormItem.tsx +1 -1
- package/src/form/variants/FieldRadio.tsx +2 -2
- package/src/form/variants/FieldRepeaterItem.tsx +1 -1
- package/src/icon/Icon.tsx +14 -4
- package/src/icon/glyphs.ts +47 -38
- package/src/index.ts +8 -2
- package/src/input/EditableInput.tsx +3 -3
- package/src/input/Input.tsx +30 -13
- package/src/kbd/Kbd.tsx +32 -0
- package/src/lib/cn.ts +7 -0
- package/src/lib/markdownScale.ts +7 -5
- package/src/lib/sizes.ts +1 -1
- package/src/lib/surface.ts +2 -2
- package/src/markdown-editor/MarkdownDiff.tsx +4 -4
- package/src/markdown-editor/MarkdownPreview.tsx +1 -1
- package/src/markdown-editor/MarkdownSource.tsx +2 -2
- package/src/markdown-editor/MarkdownTable.tsx +2 -2
- package/src/markdown-editor/MermaidBlock.tsx +5 -5
- package/src/markdown-editor/ReactCodeFrame.tsx +1 -1
- package/src/menu/Menu.tsx +2 -2
- package/src/message/message.tsx +8 -8
- package/src/modal/Modal.tsx +2 -2
- package/src/page-header/PageHeader.tsx +33 -0
- package/src/pagination/Pagination.tsx +3 -3
- package/src/popconfirm/Popconfirm.tsx +3 -3
- package/src/scroll/OverlayScroll.tsx +1 -1
- package/src/segmented/Segmented.tsx +16 -7
- package/src/select/Select.tsx +76 -47
- package/src/sidebar/Sidebar.tsx +15 -4
- package/src/sortable-tree/SortableTree.tsx +1 -1
- package/src/splitter/Splitter.tsx +1 -1
- package/src/styles.css +258 -45
- package/src/switch/Switch.tsx +21 -20
- package/src/table/Table.tsx +32 -18
- package/src/tabs/Tabs.tsx +16 -13
- package/src/tag/Tag.tsx +16 -7
- package/src/theme-switcher/ThemeSwitcher.tsx +1 -1
- package/src/timepicker/TimePicker.tsx +2 -2
- package/src/tooltip/Tooltip.tsx +25 -3
- package/src/blob-shape/BlobShape.tsx +0 -337
- package/src/chat/tool-ui/GetCurrentTimeToolUI.tsx +0 -51
- package/src/chat/tool-ui/ReadSkillToolUI.tsx +0 -82
- package/src/chat/tool-ui/RunJsToolUI.tsx +0 -108
- package/src/chat/tool-ui/WebFetchToolUI.tsx +0 -64
package/src/styles.css
CHANGED
|
@@ -22,24 +22,47 @@
|
|
|
22
22
|
color-scheme: dark;
|
|
23
23
|
|
|
24
24
|
/* ── Config. Set these. `.nonla-ui.light` repeats the same keys. ───── */
|
|
25
|
-
|
|
26
|
-
--nonla-
|
|
27
|
-
--nonla-text-
|
|
28
|
-
--nonla-text-
|
|
29
|
-
|
|
25
|
+
/* Neutral gray, the dark twin of light mode: page darkest, cards and sidebar one step up. */
|
|
26
|
+
--nonla-bg: #141414;
|
|
27
|
+
--nonla-text-main: #fafafa;
|
|
28
|
+
--nonla-text-secondary: #a3a3a3;
|
|
29
|
+
/* Placeholders, metadata, captions. AA on page, cards and wells. */
|
|
30
|
+
--nonla-text-tertiary: #8f8f8f;
|
|
31
|
+
/* Disabled only. */
|
|
32
|
+
--nonla-text-quaternary: #5c5c5c;
|
|
30
33
|
--nonla-text-on-solid: #ffffff;
|
|
31
|
-
|
|
32
|
-
--nonla-
|
|
33
|
-
|
|
34
|
-
--nonla-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
--nonla-
|
|
41
|
-
--nonla-
|
|
42
|
-
--nonla-
|
|
34
|
+
/* Text on brand fills (primary button, solid brand tag). */
|
|
35
|
+
--nonla-text-on-brand: #141414;
|
|
36
|
+
/* Ink. Primary actions are neutral, like Claude desktop. Set a hue here to brand the kit. */
|
|
37
|
+
--nonla-brand: #fafafa;
|
|
38
|
+
/*
|
|
39
|
+
* Status roles. `--nonla-{role}` is text and icons (AA on the page and on its own tint).
|
|
40
|
+
* `-fill` is the solid behind a label, `--nonla-text-on-{role}` is that label.
|
|
41
|
+
* Dark: fills reuse the light role colors and take dark ink.
|
|
42
|
+
*/
|
|
43
|
+
--nonla-danger: #f97066;
|
|
44
|
+
--nonla-success: #4fbf7f;
|
|
45
|
+
--nonla-warn: #f5b74f;
|
|
46
|
+
--nonla-link: #7aa7d9;
|
|
47
|
+
--nonla-danger-fill: var(--nonla-danger);
|
|
48
|
+
--nonla-success-fill: var(--nonla-success);
|
|
49
|
+
--nonla-warn-fill: var(--nonla-warn);
|
|
50
|
+
--nonla-text-on-danger: #141414;
|
|
51
|
+
--nonla-text-on-success: #141414;
|
|
52
|
+
--nonla-text-on-warn: #141414;
|
|
53
|
+
/* Solid fills hover and press toward this. Dark: the page, so ink labels keep contrast. */
|
|
54
|
+
--nonla-fill-shade: var(--nonla-bg);
|
|
55
|
+
/* Brand fill hovers toward this. Ink can't get darker, so it lifts toward the page (#191919 → #353535).
|
|
56
|
+
A saturated brand with white text may want #000 here instead. */
|
|
57
|
+
--nonla-brand-shade: var(--nonla-bg);
|
|
58
|
+
|
|
59
|
+
--nonla-sidebar: #1c1c1c;
|
|
60
|
+
--nonla-surface: #1c1c1c;
|
|
61
|
+
--nonla-bar: #262626;
|
|
62
|
+
/* Alpha hairlines, same rule as light: outer 10%, inside a card 6%. */
|
|
63
|
+
--nonla-border: rgb(255 255 255 / 10%);
|
|
64
|
+
--nonla-border-secondary: rgb(255 255 255 / 6%);
|
|
65
|
+
--nonla-input: rgb(255 255 255 / 14%);
|
|
43
66
|
|
|
44
67
|
--nonla-font: "Inter Variable", ui-sans-serif, -apple-system, system-ui, "Segoe UI Variable Display", "Segoe UI", Helvetica, "Apple Color Emoji", "Noto Sans Arabic", "Noto Sans Hebrew", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
|
|
45
68
|
--nonla-mono-font: "Geist Mono Variable", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
|
|
@@ -49,6 +72,12 @@
|
|
|
49
72
|
--nonla-md-text-size: 16px;
|
|
50
73
|
/* `text-sm`. Composer, tool lines, and errors use this. User bubbles use `text-base`. */
|
|
51
74
|
--nonla-sm-text-size: 14px;
|
|
75
|
+
/* `text-xs`. Badges, tags, captions, line numbers. */
|
|
76
|
+
--nonla-xs-text-size: 12px;
|
|
77
|
+
/* `text-2xs`. Smallest: dense tool badges only. */
|
|
78
|
+
--nonla-2xs-text-size: 11px;
|
|
79
|
+
/* Navigation rows and tooltips (500 weight). Cloudflare uses 13px; set 13px for a denser look. */
|
|
80
|
+
--nonla-nav-text-size: 14px;
|
|
52
81
|
/* Fenced code. Same size as `text-sm`. */
|
|
53
82
|
--nonla-mono-text-size: var(--nonla-sm-text-size);
|
|
54
83
|
--nonla-radius: 8px;
|
|
@@ -64,6 +93,25 @@
|
|
|
64
93
|
/* Hover and pressed/selected. Sidebar, menus, selects, and buttons share these. */
|
|
65
94
|
--nonla-ink-hover: color-mix(in oklab, var(--nonla-text-main) 6%, transparent);
|
|
66
95
|
--nonla-ink-active: color-mix(in oklab, var(--nonla-text-main) 10%, transparent);
|
|
96
|
+
/* Default button fill on hover and press: the surface, one and two steps toward the ink. */
|
|
97
|
+
--nonla-btn-bg-hover: color-mix(in oklab, var(--nonla-surface) 95%, var(--nonla-text-main));
|
|
98
|
+
--nonla-btn-bg-active: color-mix(in oklab, var(--nonla-surface) 91%, var(--nonla-text-main));
|
|
99
|
+
/* Switch (measured on Cloudflare): full-height thumb on a pill track, a 1px ring instead of a border. */
|
|
100
|
+
--nonla-switch-track: color-mix(in oklab, var(--nonla-text-main) 16%, var(--nonla-bg));
|
|
101
|
+
--nonla-switch-ring: color-mix(in oklab, var(--nonla-text-main) 24%, var(--nonla-bg));
|
|
102
|
+
--nonla-switch-thumb: #e5e5e5;
|
|
103
|
+
/* Tooltip bubble: no border (the arrow has none either), a medium drop plus a faint ring for edges on dark. */
|
|
104
|
+
/* Tooltip (Cloudflare): a 1px outline, also drawn along the arrow's edge, plus a medium drop. */
|
|
105
|
+
--nonla-tooltip-border: var(--nonla-border);
|
|
106
|
+
/* The ring reads darker where the drop shadow sits under it (the bottom edge); the arrow edge has no shadow, so it is drawn stronger to match. */
|
|
107
|
+
--nonla-tooltip-arrow-edge: var(--nonla-border);
|
|
108
|
+
--nonla-tooltip-shadow: 0 0 0 1px var(--nonla-tooltip-border), 0 4px 12px rgb(0 0 0 / 40%);
|
|
109
|
+
/* Pill tracks (Segmented, Tabs pill): a faint well; the selected item is a raised surface like the default button. */
|
|
110
|
+
--nonla-pill-track: color-mix(in oklab, var(--nonla-text-main) 7%, var(--nonla-bg));
|
|
111
|
+
--nonla-pill-thumb-shadow: 0 0 0 1px var(--nonla-border), var(--nonla-btn-shadow);
|
|
112
|
+
/* Inline code: a faint wash plus a hairline, so the chip reads on page, card, and bubble without going gray. */
|
|
113
|
+
--nonla-inline-code-bg: color-mix(in oklab, var(--nonla-text-main) 4%, transparent);
|
|
114
|
+
--nonla-inline-code-ring: color-mix(in oklab, var(--nonla-text-main) 6%, transparent);
|
|
67
115
|
--nonla-z-base: 0;
|
|
68
116
|
--nonla-z-popup-base: 1000;
|
|
69
117
|
|
|
@@ -90,6 +138,11 @@
|
|
|
90
138
|
--border-secondary: var(--nonla-border-secondary);
|
|
91
139
|
--input: var(--nonla-input);
|
|
92
140
|
--input-focus: var(--nonla-input-focus);
|
|
141
|
+
/* Keyboard focus ring for buttons, toggles, and icon buttons. Fields use `--input-focus` on the border. */
|
|
142
|
+
--nonla-focus-ring: color-mix(in oklab, var(--nonla-brand) 70%, transparent);
|
|
143
|
+
/* Selected state (checkbox, radio, switch, pagination, tabs, calendar). Ink, not brand: brand stays for primary actions. */
|
|
144
|
+
--nonla-selected: var(--nonla-text-main);
|
|
145
|
+
--nonla-text-on-selected: var(--nonla-bg);
|
|
93
146
|
|
|
94
147
|
/* Brand scale — 500 is the knob. Tints sink into the surface; shades stay with the ink. */
|
|
95
148
|
--brand-50: color-mix(in oklab, var(--nonla-brand) 8%, var(--nonla-surface));
|
|
@@ -101,6 +154,38 @@
|
|
|
101
154
|
--brand-600: color-mix(in oklab, var(--nonla-brand) 82%, var(--nonla-text-main));
|
|
102
155
|
--brand-700: color-mix(in oklab, var(--nonla-brand) 64%, var(--nonla-text-main));
|
|
103
156
|
--brand-800: color-mix(in oklab, var(--nonla-brand) 48%, var(--nonla-text-main));
|
|
157
|
+
/*
|
|
158
|
+
* Role states. One rule for every role:
|
|
159
|
+
* solid fill → hover 10% toward --nonla-fill-shade → press 18%
|
|
160
|
+
* tint bg 10% → hover 16%, border 35%
|
|
161
|
+
*/
|
|
162
|
+
--nonla-brand-fill-hover: color-mix(in oklab, var(--nonla-brand) 86%, var(--nonla-brand-shade));
|
|
163
|
+
--nonla-brand-fill-active: color-mix(in oklab, var(--nonla-brand) 78%, var(--nonla-brand-shade));
|
|
164
|
+
/* Solid buttons (measured on Cloudflare): a same-hue darker edge, a faint top highlight, and a 1px contact shadow. */
|
|
165
|
+
--nonla-brand-ring: color-mix(in oklab, var(--nonla-brand) 78%, #000);
|
|
166
|
+
--nonla-danger-ring: color-mix(in oklab, var(--nonla-danger-fill) 78%, #000);
|
|
167
|
+
--nonla-solid-shadow: inset 0 1px 0 rgb(255 255 255 / 12%), 0 1px 2px rgb(0 0 0 / 12%);
|
|
168
|
+
--nonla-brand-bg: color-mix(in oklab, var(--nonla-brand) 10%, transparent);
|
|
169
|
+
--nonla-brand-bg-hover: color-mix(in oklab, var(--nonla-brand) 16%, transparent);
|
|
170
|
+
--nonla-brand-border: color-mix(in oklab, var(--nonla-brand) 35%, transparent);
|
|
171
|
+
--nonla-danger-fill-hover: color-mix(in oklab, var(--nonla-danger-fill) 90%, var(--nonla-fill-shade));
|
|
172
|
+
--nonla-danger-fill-active: color-mix(in oklab, var(--nonla-danger-fill) 82%, var(--nonla-fill-shade));
|
|
173
|
+
--nonla-danger-bg: color-mix(in oklab, var(--nonla-danger-fill) 10%, transparent);
|
|
174
|
+
--nonla-danger-bg-hover: color-mix(in oklab, var(--nonla-danger-fill) 16%, transparent);
|
|
175
|
+
--nonla-danger-border: color-mix(in oklab, var(--nonla-danger-fill) 35%, transparent);
|
|
176
|
+
--nonla-success-fill-hover: color-mix(in oklab, var(--nonla-success-fill) 90%, var(--nonla-fill-shade));
|
|
177
|
+
--nonla-success-fill-active: color-mix(in oklab, var(--nonla-success-fill) 82%, var(--nonla-fill-shade));
|
|
178
|
+
--nonla-success-bg: color-mix(in oklab, var(--nonla-success-fill) 10%, transparent);
|
|
179
|
+
--nonla-success-bg-hover: color-mix(in oklab, var(--nonla-success-fill) 16%, transparent);
|
|
180
|
+
--nonla-success-border: color-mix(in oklab, var(--nonla-success-fill) 35%, transparent);
|
|
181
|
+
--nonla-warn-fill-hover: color-mix(in oklab, var(--nonla-warn-fill) 90%, var(--nonla-fill-shade));
|
|
182
|
+
--nonla-warn-fill-active: color-mix(in oklab, var(--nonla-warn-fill) 82%, var(--nonla-fill-shade));
|
|
183
|
+
--nonla-warn-bg: color-mix(in oklab, var(--nonla-warn-fill) 10%, transparent);
|
|
184
|
+
--nonla-warn-bg-hover: color-mix(in oklab, var(--nonla-warn-fill) 16%, transparent);
|
|
185
|
+
--nonla-warn-border: color-mix(in oklab, var(--nonla-warn-fill) 35%, transparent);
|
|
186
|
+
--nonla-link-bg: color-mix(in oklab, var(--nonla-link) 10%, transparent);
|
|
187
|
+
--nonla-link-bg-hover: color-mix(in oklab, var(--nonla-link) 16%, transparent);
|
|
188
|
+
--nonla-link-border: color-mix(in oklab, var(--nonla-link) 35%, transparent);
|
|
104
189
|
--brand: var(--nonla-brand);
|
|
105
190
|
--link: var(--nonla-link);
|
|
106
191
|
--success: var(--nonla-success);
|
|
@@ -111,14 +196,31 @@
|
|
|
111
196
|
--nonla-shadow: 0 16px 48px rgb(0 0 0 / 45%);
|
|
112
197
|
/* Card edge. Dark adds a short drop; the ring is the border. */
|
|
113
198
|
--nonla-card-shadow: 0 1px 2px rgb(0 0 0 / 32%), 0 0 0 1px var(--nonla-border);
|
|
199
|
+
/* Default button lift: a 1px contact shadow under a surface-filled button, so it sits a hair above the page. */
|
|
200
|
+
--nonla-btn-shadow: 0 1px 2px rgb(0 0 0 / 30%);
|
|
114
201
|
--mask: rgb(0 0 0 / 56%);
|
|
115
202
|
|
|
116
|
-
/*
|
|
203
|
+
/*
|
|
204
|
+
* Motion. One curve family, four durations.
|
|
205
|
+
* instant 100ms press feedback, popup exit
|
|
206
|
+
* fast 150ms color/opacity (hover, focus), popup enter, modal exit ← default for `transition-*`
|
|
207
|
+
* base 200ms small movement (chevrons, toggles, collapse), modal/toast enter, drawer exit
|
|
208
|
+
* slow 300ms large movement (drawer enter, sliding indicators)
|
|
209
|
+
* Enter and hover use ease-out. Exit uses ease-in and is one step shorter than enter.
|
|
210
|
+
* Sliding indicators (Tabs, Segmented) use the spring curve.
|
|
211
|
+
*/
|
|
117
212
|
--nonla-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
|
|
118
213
|
--nonla-ease-in: cubic-bezier(0.4, 0, 1, 1);
|
|
214
|
+
--nonla-ease-spring: cubic-bezier(0.3, 1.25, 0.5, 1);
|
|
215
|
+
--nonla-dur-instant: 100ms;
|
|
119
216
|
--nonla-dur-fast: 150ms;
|
|
120
217
|
--nonla-dur: 200ms;
|
|
121
218
|
--nonla-dur-slow: 300ms;
|
|
219
|
+
/* Bare Tailwind `transition-*`, `ease-out`, and `ease-in` follow the tokens inside the host. */
|
|
220
|
+
--default-transition-duration: var(--nonla-dur-fast);
|
|
221
|
+
--default-transition-timing-function: var(--nonla-ease-out);
|
|
222
|
+
--ease-out: var(--nonla-ease-out);
|
|
223
|
+
--ease-in: var(--nonla-ease-in);
|
|
122
224
|
|
|
123
225
|
--nonla-scrollbar-size: 6px;
|
|
124
226
|
--nonla-scrollbar-thumb: color-mix(in oklab, var(--nonla-text-main) 22%, var(--nonla-bg));
|
|
@@ -127,6 +229,11 @@
|
|
|
127
229
|
color: var(--foreground);
|
|
128
230
|
font-family: var(--nonla-font);
|
|
129
231
|
font-weight: 400;
|
|
232
|
+
/* Grayscale smoothing (macOS only; other platforms ignore it). Light-on-dark text stops looking bold. */
|
|
233
|
+
/* Slightly tight, like Inter in Claude desktop and Cloudflare. Code resets it below. */
|
|
234
|
+
letter-spacing: -0.01em;
|
|
235
|
+
-webkit-font-smoothing: antialiased;
|
|
236
|
+
-moz-osx-font-smoothing: grayscale;
|
|
130
237
|
/* Size stays on the host, so `1rem` and Tailwind spacing do not shrink globally. */
|
|
131
238
|
font-size: var(--nonla-base-text-size);
|
|
132
239
|
line-height: 1.6;
|
|
@@ -136,29 +243,55 @@
|
|
|
136
243
|
.nonla-ui.light {
|
|
137
244
|
color-scheme: light;
|
|
138
245
|
|
|
139
|
-
/*
|
|
140
|
-
--nonla-bg: #
|
|
141
|
-
--nonla-text-main: #
|
|
142
|
-
--nonla-text-secondary: #
|
|
143
|
-
|
|
144
|
-
--nonla-text-
|
|
145
|
-
|
|
146
|
-
--nonla-
|
|
147
|
-
--nonla-
|
|
148
|
-
--nonla-
|
|
149
|
-
--nonla-
|
|
150
|
-
--nonla-
|
|
151
|
-
|
|
152
|
-
--nonla-
|
|
153
|
-
--nonla-
|
|
154
|
-
--nonla-
|
|
155
|
-
--nonla-
|
|
156
|
-
--nonla-
|
|
246
|
+
/* Neutral gray. Off-white page, white cards and sidebar, so layers separate by fill instead of borders. #f2f2f2 wells. */
|
|
247
|
+
--nonla-bg: #fafafa;
|
|
248
|
+
--nonla-text-main: #191919;
|
|
249
|
+
--nonla-text-secondary: #5e5e5e;
|
|
250
|
+
/* Placeholders, metadata, captions. Keeps 4.5:1 on the page and on #f2f2f2 wells. */
|
|
251
|
+
--nonla-text-tertiary: #6e6e6e;
|
|
252
|
+
/* Disabled only. */
|
|
253
|
+
--nonla-text-quaternary: #a3a3a3;
|
|
254
|
+
--nonla-text-on-solid: #ffffff;
|
|
255
|
+
--nonla-text-on-brand: #ffffff;
|
|
256
|
+
--nonla-brand: #191919;
|
|
257
|
+
--nonla-danger: #b42318;
|
|
258
|
+
--nonla-success: #116b34;
|
|
259
|
+
--nonla-warn: #93540a;
|
|
260
|
+
--nonla-link: #2a64a3;
|
|
261
|
+
--nonla-danger-fill: #d92d20;
|
|
262
|
+
--nonla-success-fill: #15803d;
|
|
263
|
+
--nonla-warn-fill: #f5a524;
|
|
264
|
+
--nonla-text-on-danger: #ffffff;
|
|
265
|
+
--nonla-text-on-success: #ffffff;
|
|
266
|
+
--nonla-text-on-warn: #191919;
|
|
267
|
+
/* Light: black, so white labels gain contrast on hover. */
|
|
268
|
+
--nonla-fill-shade: #000000;
|
|
269
|
+
|
|
270
|
+
--nonla-sidebar: #ffffff;
|
|
271
|
+
--nonla-surface: #ffffff;
|
|
272
|
+
--nonla-bar: #f2f2f2;
|
|
273
|
+
/* Alpha hairlines adapt to whatever they sit on. Outer edges 10%, dividers inside a card 6%. */
|
|
274
|
+
--nonla-border: rgb(0 0 0 / 10%);
|
|
275
|
+
--nonla-border-secondary: rgb(0 0 0 / 6%);
|
|
157
276
|
--nonla-input: rgb(0 0 0 / 11%);
|
|
158
277
|
|
|
159
|
-
|
|
160
|
-
--
|
|
161
|
-
|
|
278
|
+
/* Light: a pale wash (Cloudflare-style) so the page fades instead of going dark; the popup ring carries the edge. */
|
|
279
|
+
--mask: rgb(250 250 250 / 72%);
|
|
280
|
+
/* Popups already draw a 1px border; this is only the soft drop under them. */
|
|
281
|
+
--nonla-shadow: 0 10px 15px -3px rgb(0 0 0 / 10%), 0 4px 6px -4px rgb(0 0 0 / 10%);
|
|
282
|
+
--nonla-tooltip-border: rgb(0 0 0 / 10%);
|
|
283
|
+
--nonla-tooltip-arrow-edge: rgb(0 0 0 / 22%);
|
|
284
|
+
--nonla-tooltip-shadow: 0 0 0 1px var(--nonla-tooltip-border), 0 4px 6px -1px rgb(0 0 0 / 10%), 0 2px 4px -2px rgb(0 0 0 / 10%);
|
|
285
|
+
/* Card: hairline ring plus a 1px contact shadow. */
|
|
286
|
+
--nonla-card-shadow: 0 0 0 1px var(--nonla-border), 0 1px 2px rgb(0 0 0 / 5%);
|
|
287
|
+
--nonla-btn-shadow: 0 1px 2px rgb(0 0 0 / 5%);
|
|
288
|
+
--nonla-pill-track: color-mix(in oklab, var(--nonla-text-main) 4%, var(--nonla-bg));
|
|
289
|
+
--nonla-switch-track: color-mix(in oklab, var(--nonla-text-main) 10%, var(--nonla-bg));
|
|
290
|
+
--nonla-switch-ring: color-mix(in oklab, var(--nonla-text-main) 17%, var(--nonla-bg));
|
|
291
|
+
--nonla-switch-thumb: #ffffff;
|
|
292
|
+
/* Light rows hover and select softly, like Cloudflare (#f5f5f5): 4% and 6% ink instead of dark mode's 6% and 10%. */
|
|
293
|
+
--nonla-ink-hover: color-mix(in oklab, var(--nonla-text-main) 4%, transparent);
|
|
294
|
+
--nonla-ink-active: color-mix(in oklab, var(--nonla-text-main) 6%, transparent);
|
|
162
295
|
}
|
|
163
296
|
|
|
164
297
|
/* Tailwind utility names (`bg-card`, `text-brand`). Not config. */
|
|
@@ -190,6 +323,9 @@
|
|
|
190
323
|
--color-border-secondary: var(--border-secondary);
|
|
191
324
|
--color-input: var(--input);
|
|
192
325
|
--color-input-focus: var(--input-focus);
|
|
326
|
+
--color-focus-ring: var(--nonla-focus-ring);
|
|
327
|
+
--color-selected: var(--nonla-selected);
|
|
328
|
+
--color-on-selected: var(--nonla-text-on-selected);
|
|
193
329
|
--color-brand: var(--brand);
|
|
194
330
|
--color-brand-50: var(--brand-50);
|
|
195
331
|
--color-brand-100: var(--brand-100);
|
|
@@ -203,6 +339,37 @@
|
|
|
203
339
|
--color-link: var(--link);
|
|
204
340
|
--color-success: var(--success);
|
|
205
341
|
--color-warn: var(--warn);
|
|
342
|
+
--color-brand-fill: var(--nonla-brand);
|
|
343
|
+
--color-brand-fill-hover: var(--nonla-brand-fill-hover);
|
|
344
|
+
--color-brand-fill-active: var(--nonla-brand-fill-active);
|
|
345
|
+
--color-on-brand: var(--nonla-text-on-brand);
|
|
346
|
+
--color-brand-bg: var(--nonla-brand-bg);
|
|
347
|
+
--color-brand-bg-hover: var(--nonla-brand-bg-hover);
|
|
348
|
+
--color-brand-border: var(--nonla-brand-border);
|
|
349
|
+
--color-destructive-fill: var(--nonla-danger-fill, var(--destructive));
|
|
350
|
+
--color-destructive-fill-hover: var(--nonla-danger-fill-hover);
|
|
351
|
+
--color-destructive-fill-active: var(--nonla-danger-fill-active);
|
|
352
|
+
--color-on-destructive: var(--nonla-text-on-danger);
|
|
353
|
+
--color-destructive-bg: var(--nonla-danger-bg);
|
|
354
|
+
--color-destructive-bg-hover: var(--nonla-danger-bg-hover);
|
|
355
|
+
--color-destructive-border: var(--nonla-danger-border);
|
|
356
|
+
--color-success-fill: var(--nonla-success-fill, var(--success));
|
|
357
|
+
--color-success-fill-hover: var(--nonla-success-fill-hover);
|
|
358
|
+
--color-success-fill-active: var(--nonla-success-fill-active);
|
|
359
|
+
--color-on-success: var(--nonla-text-on-success);
|
|
360
|
+
--color-success-bg: var(--nonla-success-bg);
|
|
361
|
+
--color-success-bg-hover: var(--nonla-success-bg-hover);
|
|
362
|
+
--color-success-border: var(--nonla-success-border);
|
|
363
|
+
--color-warn-fill: var(--nonla-warn-fill, var(--warn));
|
|
364
|
+
--color-warn-fill-hover: var(--nonla-warn-fill-hover);
|
|
365
|
+
--color-warn-fill-active: var(--nonla-warn-fill-active);
|
|
366
|
+
--color-on-warn: var(--nonla-text-on-warn);
|
|
367
|
+
--color-warn-bg: var(--nonla-warn-bg);
|
|
368
|
+
--color-warn-bg-hover: var(--nonla-warn-bg-hover);
|
|
369
|
+
--color-warn-border: var(--nonla-warn-border);
|
|
370
|
+
--color-link-bg: var(--nonla-link-bg);
|
|
371
|
+
--color-link-bg-hover: var(--nonla-link-bg-hover);
|
|
372
|
+
--color-link-border: var(--nonla-link-border);
|
|
206
373
|
--color-tertiary-foreground: var(--tertiary-foreground);
|
|
207
374
|
--color-quaternary-foreground: var(--quaternary-foreground);
|
|
208
375
|
--color-ink-hover: var(--nonla-ink-hover);
|
|
@@ -219,6 +386,10 @@
|
|
|
219
386
|
--spacing-field-lg: 40px;
|
|
220
387
|
--spacing-field-nav: 32px;
|
|
221
388
|
|
|
389
|
+
--text-2xs: var(--nonla-2xs-text-size);
|
|
390
|
+
--text-2xs--line-height: calc(14 / 11);
|
|
391
|
+
--text-xs: var(--nonla-xs-text-size);
|
|
392
|
+
--text-xs--line-height: calc(16 / 12);
|
|
222
393
|
--text-sm: var(--nonla-sm-text-size);
|
|
223
394
|
--text-base: var(--nonla-base-text-size);
|
|
224
395
|
--text-base--line-height: 1.6;
|
|
@@ -232,7 +403,7 @@
|
|
|
232
403
|
--font-mono: var(--nonla-mono-font);
|
|
233
404
|
--font-family-mono: var(--font-mono);
|
|
234
405
|
|
|
235
|
-
--animate-fadeIn: fadeIn
|
|
406
|
+
--animate-fadeIn: fadeIn var(--nonla-dur) var(--nonla-ease-out) both;
|
|
236
407
|
}
|
|
237
408
|
|
|
238
409
|
@keyframes fadeIn {
|
|
@@ -290,7 +461,7 @@
|
|
|
290
461
|
@keyframes nonla-modal-in {
|
|
291
462
|
from {
|
|
292
463
|
opacity: 0;
|
|
293
|
-
transform: translate(-50%, 0) scale(0.
|
|
464
|
+
transform: translate(-50%, 0) scale(0.96);
|
|
294
465
|
}
|
|
295
466
|
to {
|
|
296
467
|
opacity: 1;
|
|
@@ -305,14 +476,14 @@
|
|
|
305
476
|
}
|
|
306
477
|
to {
|
|
307
478
|
opacity: 0;
|
|
308
|
-
transform: translate(-50%, 0) scale(0.
|
|
479
|
+
transform: translate(-50%, 0) scale(0.96);
|
|
309
480
|
}
|
|
310
481
|
}
|
|
311
482
|
|
|
312
483
|
@keyframes nonla-modal-in-centered {
|
|
313
484
|
from {
|
|
314
485
|
opacity: 0;
|
|
315
|
-
transform: translate(-50%, -50%) scale(0.
|
|
486
|
+
transform: translate(-50%, -50%) scale(0.96);
|
|
316
487
|
}
|
|
317
488
|
to {
|
|
318
489
|
opacity: 1;
|
|
@@ -327,7 +498,7 @@
|
|
|
327
498
|
}
|
|
328
499
|
to {
|
|
329
500
|
opacity: 0;
|
|
330
|
-
transform: translate(-50%, -50%) scale(0.
|
|
501
|
+
transform: translate(-50%, -50%) scale(0.96);
|
|
331
502
|
}
|
|
332
503
|
}
|
|
333
504
|
|
|
@@ -447,6 +618,29 @@
|
|
|
447
618
|
}
|
|
448
619
|
}
|
|
449
620
|
|
|
621
|
+
/* Tooltip: scale from the trigger side and fade, both ways (Cloudflare: 0.9, 150ms). */
|
|
622
|
+
@keyframes nonla-tooltip-in {
|
|
623
|
+
from {
|
|
624
|
+
opacity: 0;
|
|
625
|
+
transform: scale(0.9);
|
|
626
|
+
}
|
|
627
|
+
to {
|
|
628
|
+
opacity: 1;
|
|
629
|
+
transform: scale(1);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
@keyframes nonla-tooltip-out {
|
|
634
|
+
from {
|
|
635
|
+
opacity: 1;
|
|
636
|
+
transform: scale(1);
|
|
637
|
+
}
|
|
638
|
+
to {
|
|
639
|
+
opacity: 0;
|
|
640
|
+
transform: scale(0.9);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
450
644
|
@keyframes nonla-pop-out {
|
|
451
645
|
from {
|
|
452
646
|
opacity: 1;
|
|
@@ -461,7 +655,7 @@
|
|
|
461
655
|
@keyframes nonla-message-in {
|
|
462
656
|
from {
|
|
463
657
|
opacity: 0;
|
|
464
|
-
transform: translateY(-
|
|
658
|
+
transform: translateY(-6px) scale(0.98);
|
|
465
659
|
}
|
|
466
660
|
to {
|
|
467
661
|
opacity: 1;
|
|
@@ -529,6 +723,7 @@
|
|
|
529
723
|
}
|
|
530
724
|
|
|
531
725
|
.nonla-ui :is(pre, code, kbd, samp) {
|
|
726
|
+
letter-spacing: 0;
|
|
532
727
|
font-family: var(--nonla-mono-font);
|
|
533
728
|
}
|
|
534
729
|
|
|
@@ -633,3 +828,21 @@
|
|
|
633
828
|
color: #b31d28;
|
|
634
829
|
background-color: #ffeef0;
|
|
635
830
|
}
|
|
831
|
+
|
|
832
|
+
/* Switch. Track fill comes from `--sw-on` (checked) or `--nonla-switch-track`; the ring is the fill one step darker. */
|
|
833
|
+
.nonla-ui .nonla-switch {
|
|
834
|
+
background-color: var(--nonla-switch-track);
|
|
835
|
+
box-shadow: 0 0 0 1px var(--nonla-switch-ring);
|
|
836
|
+
}
|
|
837
|
+
.nonla-ui .nonla-switch[data-state="checked"] {
|
|
838
|
+
background-color: var(--sw-on);
|
|
839
|
+
box-shadow: 0 0 0 1px color-mix(in oklab, var(--sw-on) 82%, #000);
|
|
840
|
+
}
|
|
841
|
+
.nonla-ui .nonla-switch-thumb {
|
|
842
|
+
background-color: var(--nonla-switch-thumb);
|
|
843
|
+
box-shadow: 0 0 1px 0.5px rgb(0 0 0 / 12%), 0 1px 2px rgb(0 0 0 / 8%);
|
|
844
|
+
}
|
|
845
|
+
.nonla-ui .nonla-switch[data-state="checked"] .nonla-switch-thumb {
|
|
846
|
+
background-color: var(--sw-thumb-on, #ffffff);
|
|
847
|
+
}
|
|
848
|
+
|
package/src/switch/Switch.tsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
2
2
|
import { type ComponentPropsWithoutRef, type CSSProperties, forwardRef } from "react";
|
|
3
|
-
import { cn } from "../lib/cn";
|
|
3
|
+
import { cn, focusRing } from "../lib/cn";
|
|
4
4
|
import { type ControlSize, controlRadiusVar, useControlSize } from "../lib/sizes";
|
|
5
5
|
|
|
6
6
|
export type SwitchVariant = "default" | "square";
|
|
7
7
|
/** Checked track. `white` is the on-state for dark surfaces — thumb stays ink. */
|
|
8
|
-
export type SwitchColor = "brand" | "success" | "white";
|
|
8
|
+
export type SwitchColor = "default" | "brand" | "success" | "white";
|
|
9
9
|
|
|
10
10
|
export type SwitchProps = Omit<ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>, "onCheckedChange" | "checked" | "onChange"> & {
|
|
11
11
|
checked?: boolean;
|
|
@@ -17,21 +17,24 @@ export type SwitchProps = Omit<ComponentPropsWithoutRef<typeof SwitchPrimitive.R
|
|
|
17
17
|
color?: SwitchColor;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
/** Checked fill and thumb per color. `default` is ink, so its thumb takes the page color to stay visible in dark mode. */
|
|
21
|
+
const CHECKED: Record<SwitchColor, { on: string; thumb?: string }> = {
|
|
22
|
+
default: { on: "var(--nonla-selected)", thumb: "var(--nonla-text-on-selected)" },
|
|
23
|
+
brand: { on: "var(--nonla-brand)", thumb: "var(--nonla-text-on-brand)" },
|
|
24
|
+
success: { on: "var(--nonla-success-fill)" },
|
|
25
|
+
white: { on: "#ffffff", thumb: "var(--nonla-bg)" },
|
|
24
26
|
};
|
|
25
27
|
|
|
26
|
-
/** Switch track heights —
|
|
27
|
-
const SWITCH_TRACK_H = { small:
|
|
28
|
+
/** Switch track heights — compact, like Cloudflare (32×16 by default). */
|
|
29
|
+
const SWITCH_TRACK_H = { small: 14, default: 16, large: 20 } as const;
|
|
28
30
|
|
|
29
|
-
export const Switch = forwardRef<HTMLButtonElement, SwitchProps>(function Switch({ className, checked, defaultChecked, onChange, size, variant = "default", color = "
|
|
31
|
+
export const Switch = forwardRef<HTMLButtonElement, SwitchProps>(function Switch({ className, checked, defaultChecked, onChange, size, variant = "default", color = "default", disabled, style, ...rest }, ref) {
|
|
30
32
|
const resolvedSize = useControlSize(size);
|
|
31
33
|
const trackH = SWITCH_TRACK_H[resolvedSize];
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
const
|
|
34
|
+
// Pill track twice as wide as tall; the thumb fills the full height and slides one height across.
|
|
35
|
+
const trackW = trackH * 2;
|
|
36
|
+
const thumb = trackH;
|
|
37
|
+
const travel = trackW - thumb;
|
|
35
38
|
const square = variant === "square";
|
|
36
39
|
const squareRadius = `max(3px, calc(${controlRadiusVar(resolvedSize)} * 0.55))`;
|
|
37
40
|
|
|
@@ -43,27 +46,25 @@ export const Switch = forwardRef<HTMLButtonElement, SwitchProps>(function Switch
|
|
|
43
46
|
disabled={disabled}
|
|
44
47
|
onCheckedChange={onChange}
|
|
45
48
|
className={cn(
|
|
46
|
-
"peer inline-flex shrink-0 cursor-pointer items-center border
|
|
49
|
+
"nonla-switch peer inline-flex shrink-0 cursor-pointer items-center border-0 p-0 transition-[background-color,box-shadow]",
|
|
47
50
|
square ? undefined : "rounded-full",
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"data-[state=unchecked]:border-[color-mix(in_oklab,var(--foreground)_40%,var(--background))] data-[state=unchecked]:bg-[color-mix(in_oklab,var(--foreground)_22%,var(--background))]",
|
|
51
|
+
focusRing,
|
|
52
|
+
"disabled:cursor-not-allowed disabled:opacity-45",
|
|
51
53
|
className,
|
|
52
54
|
)}
|
|
53
|
-
style={{ width: trackW, height: trackH, borderRadius: square ? squareRadius : undefined, ...style }}
|
|
55
|
+
style={{ width: trackW, height: trackH, borderRadius: square ? squareRadius : undefined, ["--sw-on" as string]: CHECKED[color].on, ...(CHECKED[color].thumb ? { ["--sw-thumb-on" as string]: CHECKED[color].thumb } : null), ...style } as CSSProperties}
|
|
54
56
|
{...rest}
|
|
55
57
|
>
|
|
56
58
|
<SwitchPrimitive.Thumb
|
|
57
59
|
className={cn(
|
|
58
|
-
"pointer-events-none block
|
|
59
|
-
color === "white" && "data-[state=checked]:bg-[#141414]",
|
|
60
|
+
"nonla-switch-thumb pointer-events-none block transition-[transform,background-color] duration-(--nonla-dur) data-[state=unchecked]:translate-x-0 data-[state=checked]:translate-x-(--nonla-switch-travel)",
|
|
60
61
|
square ? undefined : "rounded-full",
|
|
61
62
|
)}
|
|
62
63
|
style={
|
|
63
64
|
{
|
|
64
65
|
width: thumb,
|
|
65
66
|
height: thumb,
|
|
66
|
-
borderRadius: square ?
|
|
67
|
+
borderRadius: square ? squareRadius : undefined,
|
|
67
68
|
["--nonla-switch-travel" as string]: `${travel}px`,
|
|
68
69
|
} as CSSProperties
|
|
69
70
|
}
|
package/src/table/Table.tsx
CHANGED
|
@@ -26,6 +26,7 @@ export type ColumnType<T> = {
|
|
|
26
26
|
*/
|
|
27
27
|
flex?: boolean | number;
|
|
28
28
|
ellipsis?: boolean;
|
|
29
|
+
/** @deprecated Not supported yet: columns do not pin. Use `scroll` for long tables. */
|
|
29
30
|
fixed?: "left" | "right";
|
|
30
31
|
/** `true` = default compare on `dataIndex`; or pass a compare fn. */
|
|
31
32
|
sorter?: boolean | ((a: T, b: T) => number);
|
|
@@ -141,10 +142,10 @@ function defaultCompare(a: unknown, b: unknown): number {
|
|
|
141
142
|
function SortIcon({ order }: { order: SortOrder | undefined }) {
|
|
142
143
|
return (
|
|
143
144
|
<span className="ml-1.5 inline-flex shrink-0 flex-col items-center gap-0.5" aria-hidden>
|
|
144
|
-
<svg width="7" height="4" viewBox="0 0 7 4" className={cn(order === "ascend" ? "text-foreground" : "text-
|
|
145
|
+
<svg width="7" height="4" viewBox="0 0 7 4" className={cn(order === "ascend" ? "text-foreground" : "text-quaternary-foreground")}>
|
|
145
146
|
<path d="M3.5 0 7 4H0z" fill="currentColor" />
|
|
146
147
|
</svg>
|
|
147
|
-
<svg width="7" height="4" viewBox="0 0 7 4" className={cn(order === "descend" ? "text-foreground" : "text-
|
|
148
|
+
<svg width="7" height="4" viewBox="0 0 7 4" className={cn(order === "descend" ? "text-foreground" : "text-quaternary-foreground")}>
|
|
148
149
|
<path d="M3.5 4 0 0h7z" fill="currentColor" />
|
|
149
150
|
</svg>
|
|
150
151
|
</span>
|
|
@@ -180,21 +181,21 @@ function TableBodyScroll({ x, y, scrollRef, insetTop = 0, children }: { x?: numb
|
|
|
180
181
|
function sizeClasses(s: CanonicalSize) {
|
|
181
182
|
if (s === "small") {
|
|
182
183
|
return {
|
|
183
|
-
head: "h-8 px-2 text-
|
|
184
|
-
cell: "px-2 py-1 text-
|
|
184
|
+
head: "h-8 px-2 text-sm",
|
|
185
|
+
cell: "px-2 py-1 text-sm",
|
|
185
186
|
check: "w-8 px-2",
|
|
186
187
|
};
|
|
187
188
|
}
|
|
188
189
|
if (s === "large") {
|
|
189
190
|
return {
|
|
190
|
-
head: "h-12 px-4 text-
|
|
191
|
-
cell: "px-4 py-3 text-
|
|
191
|
+
head: "h-12 px-4 text-sm",
|
|
192
|
+
cell: "px-4 py-3 text-sm",
|
|
192
193
|
check: "w-12 px-4",
|
|
193
194
|
};
|
|
194
195
|
}
|
|
195
196
|
return {
|
|
196
|
-
head: "h-10 px-3 text-
|
|
197
|
-
cell: "px-3 py-2 text-
|
|
197
|
+
head: "h-10 px-3 text-sm",
|
|
198
|
+
cell: "px-3 py-2 text-sm",
|
|
198
199
|
check: "w-10 px-3",
|
|
199
200
|
};
|
|
200
201
|
}
|
|
@@ -393,8 +394,8 @@ export function Table<T extends object = Record<string, unknown>>({ columns = []
|
|
|
393
394
|
const next = head ? Math.ceil(head.getBoundingClientRect().height) + 4 : 0;
|
|
394
395
|
setThumbInset((prev) => (prev === next ? prev : next));
|
|
395
396
|
}, [headSticky, showHeader, size, flexLayout]);
|
|
396
|
-
/**
|
|
397
|
-
const headBg: CSSProperties = { backgroundColor: "var(--
|
|
397
|
+
/** Header recedes (Cloudflare-style): page-colored band, muted labels, so the data reads first. Opaque so sticky headers cover rows. */
|
|
398
|
+
const headBg: CSSProperties = { backgroundColor: "var(--background)" };
|
|
398
399
|
|
|
399
400
|
const colStyle = (col: ColumnType<T>, key: string): CSSProperties => {
|
|
400
401
|
const measured = flexLayout?.cols[key];
|
|
@@ -407,10 +408,10 @@ export function Table<T extends object = Record<string, unknown>>({ columns = []
|
|
|
407
408
|
{titleNode != null ? <div className="mb-3 text-sm font-medium text-foreground">{titleNode}</div> : null}
|
|
408
409
|
|
|
409
410
|
<div className={cn(bordered && "overflow-hidden rounded-xl border border-border-secondary")}>
|
|
410
|
-
<Spin spinning={Boolean(loading)}>
|
|
411
|
+
<Spin spinning={Boolean(loading) && pageData.length > 0}>
|
|
411
412
|
<div ref={containerRef} data-slot="table-container" className={cn("relative w-full", flexLayout ? "overflow-x-hidden" : "overflow-x-auto")} style={scroll?.x != null ? { overflowX: "auto" } : undefined}>
|
|
412
413
|
<TableBodyScroll y={scroll?.y} x={scroll?.x} scrollRef={scrollBodyRef} insetTop={thumbInset}>
|
|
413
|
-
<table data-slot="table" className={cn("caption-bottom text-
|
|
414
|
+
<table data-slot="table" className={cn("caption-bottom text-sm", headSticky ? "border-separate border-spacing-0" : "border-collapse", flexLayout ? "w-full table-fixed" : wantsFlex ? "w-max" : "w-full")}>
|
|
414
415
|
{flexLayout ? (
|
|
415
416
|
<colgroup>
|
|
416
417
|
{rowSelection ? <col style={{ width: flexLayout.selection }} /> : null}
|
|
@@ -421,10 +422,10 @@ export function Table<T extends object = Record<string, unknown>>({ columns = []
|
|
|
421
422
|
</colgroup>
|
|
422
423
|
) : null}
|
|
423
424
|
{showHeader ? (
|
|
424
|
-
<thead data-slot="table-header" className={cn("[&_tr]:border-b [&_tr]:border-border
|
|
425
|
+
<thead data-slot="table-header" className={cn("[&_tr]:border-b [&_tr]:border-border", headSticky && "relative z-20")}>
|
|
425
426
|
<tr data-slot="table-row" className="border-b border-border-secondary transition-colors hover:bg-transparent">
|
|
426
427
|
{rowSelection ? (
|
|
427
|
-
<th data-slot="table-head" className={cn(sz.head, sz.check, "align-middle font-medium text-foreground", headSticky && "sticky top-0 z-10 border-b border-border
|
|
428
|
+
<th data-slot="table-head" className={cn(sz.head, sz.check, "align-middle font-medium text-muted-foreground", headSticky && "sticky top-0 z-10 border-b border-border", bordered && "border-b border-border-secondary")} style={{ ...(selectionColWidth != null ? { width: selectionColWidth } : undefined), ...headBg }}>
|
|
428
429
|
<div className="flex items-center justify-center">
|
|
429
430
|
{rowSelection.type === "radio" ? null : (
|
|
430
431
|
<Checkbox
|
|
@@ -449,7 +450,7 @@ export function Table<T extends object = Record<string, unknown>>({ columns = []
|
|
|
449
450
|
<th
|
|
450
451
|
key={key}
|
|
451
452
|
data-slot="table-head"
|
|
452
|
-
className={cn(sz.head, "align-middle font-medium text-foreground", headSticky && "sticky top-0 z-10 border-b border-border
|
|
453
|
+
className={cn(sz.head, "align-middle font-medium text-muted-foreground", headSticky && "sticky top-0 z-10 border-b border-border", flexLayout && flexWeight(col) > 0 ? "min-w-0" : "whitespace-nowrap", alignClass(col.align), bordered && "border-b border-border-secondary", sortable && "cursor-pointer select-none", col.className, headerExtra?.className)}
|
|
453
454
|
style={{
|
|
454
455
|
...colStyle(col, key),
|
|
455
456
|
...headBg,
|
|
@@ -469,10 +470,23 @@ export function Table<T extends object = Record<string, unknown>>({ columns = []
|
|
|
469
470
|
) : null}
|
|
470
471
|
|
|
471
472
|
<tbody data-slot="table-body" className={cn("[&_tr:last-child]:border-0", headSticky && "relative z-0")}>
|
|
472
|
-
{pageData.length === 0 ? (
|
|
473
|
+
{loading && pageData.length === 0 ? (
|
|
474
|
+
// First load: skeleton rows in the real column grid instead of a spinner over "No data".
|
|
475
|
+
Array.from({ length: 5 }, (_, r) => (
|
|
476
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: static placeholder rows
|
|
477
|
+
<tr key={`skeleton-${r}`} data-slot="table-row" className="border-b border-border-secondary">
|
|
478
|
+
{Array.from({ length: colCount }, (_, c) => (
|
|
479
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: static placeholder cells
|
|
480
|
+
<td key={c} data-slot="table-cell" className={cn(sz.cell, "align-middle")}>
|
|
481
|
+
<span aria-hidden className="block h-2.5 animate-pulse rounded-full bg-muted" style={{ width: `${[72, 56, 64, 48, 60][(r + c) % 5]}%` }} />
|
|
482
|
+
</td>
|
|
483
|
+
))}
|
|
484
|
+
</tr>
|
|
485
|
+
))
|
|
486
|
+
) : pageData.length === 0 ? (
|
|
473
487
|
<tr data-slot="table-row" className="border-b border-border-secondary">
|
|
474
488
|
<td data-slot="table-cell" colSpan={colCount} className={cn(sz.cell, "text-center align-middle")}>
|
|
475
|
-
{locale?.emptyText ?? <Empty description="No data" className="py-10" />}
|
|
489
|
+
{locale?.emptyText ?? <Empty bordered={false} icon={null} description="No data" className="py-10" />}
|
|
476
490
|
</td>
|
|
477
491
|
</tr>
|
|
478
492
|
) : (
|
|
@@ -489,7 +503,7 @@ export function Table<T extends object = Record<string, unknown>>({ columns = []
|
|
|
489
503
|
key={key}
|
|
490
504
|
data-slot="table-row"
|
|
491
505
|
data-state={selected ? "selected" : undefined}
|
|
492
|
-
className={cn("border-b border-border-secondary transition-colors hover:bg-
|
|
506
|
+
className={cn("border-b border-border-secondary transition-colors hover:bg-ink-hover data-[state=selected]:bg-ink-active", inSelectionMode && !rowDisabled && "cursor-pointer", rowProps?.className, extraClass)}
|
|
493
507
|
style={rowProps?.style}
|
|
494
508
|
onClick={inSelectionMode ? undefined : rowProps?.onClick}
|
|
495
509
|
onClickCapture={
|