devnonla-ui 0.2.0 → 0.4.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 +3 -3
- package/package.json +2 -1
- package/src/app/App.tsx +4 -4
- package/src/button/Button.tsx +1 -1
- package/src/button/ButtonCopy.tsx +11 -21
- package/src/calendar/Calendar.tsx +1 -1
- package/src/chat/AgentPanel.tsx +3 -3
- package/src/chat/index.ts +35 -51
- package/src/chat/message-ui/ChatError.tsx +2 -4
- package/src/chat/message-ui/ChatInput.tsx +5 -9
- package/src/chat/message-ui/ChatThinking.tsx +2 -3
- package/src/chat/message-ui/ChatUserMessage.tsx +4 -5
- package/src/chat/message-ui/ChatWelcome.tsx +3 -8
- package/src/chat/message-ui/MermaidBlock.tsx +7 -47
- package/src/chat/tool-ui/BackgroundTaskToolUI.tsx +8 -11
- package/src/chat/tool-ui/BackgroundTasksBar.tsx +13 -14
- package/src/chat/tool-ui/CallAgentToolUI.tsx +10 -4
- package/src/chat/tool-ui/ChatToolCall.tsx +11 -17
- package/src/chat/tool-ui/GetCurrentTimeToolUI.tsx +2 -2
- package/src/chat/tool-ui/ReadSkillToolUI.tsx +3 -3
- package/src/chat/tool-ui/RunJsToolUI.tsx +2 -2
- package/src/chat/tool-ui/ToolUiTrailing.tsx +3 -7
- package/src/chat/tool-ui/WebFetchToolUI.tsx +22 -13
- package/src/checkbox/Checkbox.tsx +1 -1
- package/src/codeblock/CodeBlock.tsx +17 -19
- package/src/colorpicker/ColorPicker.tsx +694 -30
- package/src/colorpicker/color.ts +246 -0
- package/src/datepicker/DatePicker.tsx +3 -3
- package/src/desktop/DesktopHeader.tsx +15 -20
- package/src/desktop/DesktopIcon.tsx +1 -1
- package/src/desktop/DesktopWindow.tsx +54 -30
- package/src/form/Form.tsx +1 -1
- package/src/form/FormItem.tsx +2 -2
- package/src/form/index.ts +23 -24
- package/src/form/variants/FieldColor.tsx +16 -51
- package/src/index.ts +167 -196
- package/src/input/Input.tsx +14 -12
- package/src/input/SearchInput.tsx +5 -2
- package/src/lib/sizes.ts +1 -1
- package/src/modal/Modal.tsx +3 -0
- package/src/pagination/Pagination.tsx +528 -51
- package/src/scroll/OverlayScroll.tsx +58 -37
- package/src/select/Select.tsx +2 -2
- package/src/spin/Spin.tsx +14 -17
- package/src/splitter/Splitter.tsx +330 -0
- package/src/splitter/sizes.ts +67 -0
- package/src/styles.css +28 -3
- package/src/switch/Switch.tsx +1 -1
- package/src/table/Table.tsx +43 -18
- package/src/timepicker/TimePicker.tsx +2 -2
package/src/styles.css
CHANGED
|
@@ -232,6 +232,8 @@
|
|
|
232
232
|
--color-ink-active: var(--ink-active);
|
|
233
233
|
--color-ink-line: var(--ink-line);
|
|
234
234
|
--color-chat: var(--nonla-chat-bg);
|
|
235
|
+
--color-well: color-mix(in oklab, var(--foreground) 5.5%, var(--card));
|
|
236
|
+
--color-well-strong: color-mix(in oklab, var(--foreground) 10%, var(--card));
|
|
235
237
|
|
|
236
238
|
--shadow-card: none;
|
|
237
239
|
--shadow-whisper: none;
|
|
@@ -402,7 +404,7 @@
|
|
|
402
404
|
}
|
|
403
405
|
}
|
|
404
406
|
|
|
405
|
-
/* ── Spin: agent
|
|
407
|
+
/* ── Spin: agent (3×3 random snake) ────────────────────────────────────── */
|
|
406
408
|
.nonla-spin-matrix {
|
|
407
409
|
align-content: center;
|
|
408
410
|
justify-content: center;
|
|
@@ -413,12 +415,12 @@
|
|
|
413
415
|
width: 100%;
|
|
414
416
|
height: 100%;
|
|
415
417
|
border-radius: 999px;
|
|
416
|
-
background: var(--
|
|
418
|
+
background: color-mix(in oklab, var(--brand) 10%, transparent);
|
|
417
419
|
transition: background 120ms linear;
|
|
418
420
|
}
|
|
419
421
|
|
|
420
422
|
.nonla-spin-matrix-cell.is-on {
|
|
421
|
-
background: var(--
|
|
423
|
+
background: var(--brand);
|
|
422
424
|
}
|
|
423
425
|
|
|
424
426
|
@media (prefers-reduced-motion: reduce) {
|
|
@@ -864,6 +866,14 @@
|
|
|
864
866
|
animation: nonla-pop-out 100ms var(--nonla-ease-in);
|
|
865
867
|
}
|
|
866
868
|
|
|
869
|
+
.nonla-chat-tool-result-ok {
|
|
870
|
+
background-image: linear-gradient(
|
|
871
|
+
165deg,
|
|
872
|
+
color-mix(in oklab, var(--success) 14%, var(--card)) 0%,
|
|
873
|
+
color-mix(in oklab, var(--success) 5%, var(--card)) 100%
|
|
874
|
+
);
|
|
875
|
+
}
|
|
876
|
+
|
|
867
877
|
.nonla-codeblock-pre code,
|
|
868
878
|
.nonla-codeblock-pre .hljs {
|
|
869
879
|
color: var(--foreground);
|
|
@@ -949,3 +959,18 @@
|
|
|
949
959
|
.group\/scroll:hover .nonla-overlay-thumb {
|
|
950
960
|
background: var(--nonla-scrollbar-thumb-hover);
|
|
951
961
|
}
|
|
962
|
+
|
|
963
|
+
.nonla-color-checkered {
|
|
964
|
+
background-color: #fff;
|
|
965
|
+
background-image: conic-gradient(#d9d9d9 0.25turn, #fff 0.25turn 0.5turn, #d9d9d9 0.5turn 0.75turn, #fff 0.75turn);
|
|
966
|
+
background-size: 8px 8px;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
.nonla-color-cleared {
|
|
970
|
+
background: linear-gradient(
|
|
971
|
+
to bottom left,
|
|
972
|
+
transparent calc(50% - 1px),
|
|
973
|
+
var(--destructive) calc(50% - 1px) calc(50% + 1px),
|
|
974
|
+
transparent calc(50% + 1px)
|
|
975
|
+
);
|
|
976
|
+
}
|
package/src/switch/Switch.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
2
|
-
import { type
|
|
2
|
+
import { type ComponentPropsWithoutRef, type CSSProperties, forwardRef } from "react";
|
|
3
3
|
import { cn } from "../lib/cn";
|
|
4
4
|
import { type ControlSize, controlRadiusVar, useControlSize } from "../lib/sizes";
|
|
5
5
|
|
package/src/table/Table.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { Checkbox } from "../checkbox/Checkbox";
|
|
|
3
3
|
import { Empty } from "../empty/Empty";
|
|
4
4
|
import { cn } from "../lib/cn";
|
|
5
5
|
import { type CanonicalSize, type ControlSize, useControlSize } from "../lib/sizes";
|
|
6
|
-
import { Pagination } from "../pagination/Pagination";
|
|
6
|
+
import { Pagination, type PaginationProps } from "../pagination/Pagination";
|
|
7
7
|
import { Spin } from "../spin/Spin";
|
|
8
8
|
|
|
9
9
|
export type SortOrder = "ascend" | "descend" | null;
|
|
@@ -29,14 +29,29 @@ export type ColumnType<T> = {
|
|
|
29
29
|
|
|
30
30
|
export type ColumnsType<T> = ColumnType<T>[];
|
|
31
31
|
|
|
32
|
-
export type TablePaginationConfig =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
export type TablePaginationConfig = Pick<
|
|
33
|
+
PaginationProps,
|
|
34
|
+
| "align"
|
|
35
|
+
| "current"
|
|
36
|
+
| "defaultCurrent"
|
|
37
|
+
| "pageSize"
|
|
38
|
+
| "defaultPageSize"
|
|
39
|
+
| "total"
|
|
40
|
+
| "onChange"
|
|
41
|
+
| "onShowSizeChange"
|
|
42
|
+
| "hideOnSinglePage"
|
|
43
|
+
| "className"
|
|
44
|
+
| "showSizeChanger"
|
|
45
|
+
| "showQuickJumper"
|
|
46
|
+
| "showTotal"
|
|
47
|
+
| "simple"
|
|
48
|
+
| "disabled"
|
|
49
|
+
| "size"
|
|
50
|
+
| "pageSizeOptions"
|
|
51
|
+
| "showLessItems"
|
|
52
|
+
| "showTitle"
|
|
53
|
+
| "itemRender"
|
|
54
|
+
>;
|
|
40
55
|
|
|
41
56
|
export type TableRowSelection<T> = {
|
|
42
57
|
selectedRowKeys?: Key[];
|
|
@@ -157,8 +172,8 @@ export function Table<T extends object = Record<string, unknown>>({ columns = []
|
|
|
157
172
|
const [innerSelected, setInnerSelected] = useState<Key[]>(() => rowSelection?.defaultSelectedRowKeys ?? []);
|
|
158
173
|
const selectedKeys = selectionControlled ? (rowSelection?.selectedRowKeys ?? []) : innerSelected;
|
|
159
174
|
|
|
160
|
-
const [innerPage, setInnerPage] = useState(1);
|
|
161
|
-
const [innerPageSize, setInnerPageSize] = useState(10);
|
|
175
|
+
const [innerPage, setInnerPage] = useState(() => (typeof pagination === "object" && pagination?.defaultCurrent) || 1);
|
|
176
|
+
const [innerPageSize, setInnerPageSize] = useState(() => (typeof pagination === "object" && pagination?.defaultPageSize) || 10);
|
|
162
177
|
|
|
163
178
|
const initialSort = useMemo(() => {
|
|
164
179
|
const col = columns.find((c) => c.defaultSortOrder);
|
|
@@ -179,8 +194,9 @@ export function Table<T extends object = Record<string, unknown>>({ columns = []
|
|
|
179
194
|
const paginationOff = pagination === false;
|
|
180
195
|
const pageConfig: TablePaginationConfig = paginationOff ? {} : (pagination ?? {});
|
|
181
196
|
const pageControlled = pageConfig.current !== undefined;
|
|
197
|
+
const pageSizeControlled = pageConfig.pageSize !== undefined;
|
|
182
198
|
const current = pageControlled ? (pageConfig.current ?? 1) : innerPage;
|
|
183
|
-
const pageSize = pageConfig.pageSize ??
|
|
199
|
+
const pageSize = pageSizeControlled ? (pageConfig.pageSize ?? 10) : innerPageSize;
|
|
184
200
|
const serverSide = pageConfig.total !== undefined;
|
|
185
201
|
|
|
186
202
|
const sortedData = useMemo(() => {
|
|
@@ -227,10 +243,8 @@ export function Table<T extends object = Record<string, unknown>>({ columns = []
|
|
|
227
243
|
};
|
|
228
244
|
|
|
229
245
|
const handlePageChange = (page: number, nextSize: number) => {
|
|
230
|
-
if (!pageControlled)
|
|
231
|
-
|
|
232
|
-
setInnerPageSize(nextSize);
|
|
233
|
-
}
|
|
246
|
+
if (!pageControlled) setInnerPage(page);
|
|
247
|
+
if (!pageSizeControlled) setInnerPageSize(nextSize);
|
|
234
248
|
pageConfig.onChange?.(page, nextSize);
|
|
235
249
|
onChange?.({ current: page, pageSize: nextSize, total }, {}, { columnKey: sortState.key ?? undefined, order: sortState.order });
|
|
236
250
|
};
|
|
@@ -377,8 +391,19 @@ export function Table<T extends object = Record<string, unknown>>({ columns = []
|
|
|
377
391
|
</Spin>
|
|
378
392
|
|
|
379
393
|
{showPagination ? (
|
|
380
|
-
<div className={cn("mt-4
|
|
381
|
-
<Pagination
|
|
394
|
+
<div className={cn("mt-4", pageConfig.className)}>
|
|
395
|
+
<Pagination
|
|
396
|
+
{...pageConfig}
|
|
397
|
+
className={undefined}
|
|
398
|
+
hideOnSinglePage={false}
|
|
399
|
+
align={pageConfig.align ?? "end"}
|
|
400
|
+
current={current}
|
|
401
|
+
pageSize={pageSize}
|
|
402
|
+
total={total}
|
|
403
|
+
size={pageConfig.size ?? "small"}
|
|
404
|
+
showSizeChanger={pageConfig.showSizeChanger ?? false}
|
|
405
|
+
onChange={handlePageChange}
|
|
406
|
+
/>
|
|
382
407
|
</div>
|
|
383
408
|
) : null}
|
|
384
409
|
</div>
|
|
@@ -2,11 +2,11 @@ import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
|
2
2
|
import {
|
|
3
3
|
type CSSProperties,
|
|
4
4
|
type FocusEvent,
|
|
5
|
+
Fragment,
|
|
6
|
+
forwardRef,
|
|
5
7
|
type KeyboardEvent,
|
|
6
8
|
type MouseEvent,
|
|
7
9
|
type PointerEvent,
|
|
8
|
-
Fragment,
|
|
9
|
-
forwardRef,
|
|
10
10
|
useCallback,
|
|
11
11
|
useEffect,
|
|
12
12
|
useRef,
|