devnonla-ui 0.3.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 +7 -7
- 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/index.ts +167 -199
- 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 +3 -3
- package/src/styles.css +13 -3
- package/src/switch/Switch.tsx +1 -1
- package/src/table/Table.tsx +43 -18
- package/src/timepicker/TimePicker.tsx +2 -2
package/src/index.ts
CHANGED
|
@@ -1,231 +1,199 @@
|
|
|
1
|
-
export { App, useApp, useAppConfig, usePopupContainer, useToken } from "./app/App";
|
|
2
1
|
export type { AppProps, NonlaAppConfig } from "./app/App";
|
|
3
|
-
|
|
2
|
+
export { App, useApp, useAppConfig, usePopupContainer, useToken } from "./app/App";
|
|
3
|
+
export type { ButtonColor, ButtonGroupProps, ButtonProps, ButtonSize, ButtonType, ButtonVariant } from "./button/Button";
|
|
4
4
|
export { Button } from "./button/Button";
|
|
5
|
-
export type { ButtonProps, ButtonGroupProps, ButtonType, ButtonSize, ButtonColor, ButtonVariant } from "./button/Button";
|
|
6
|
-
export { ButtonCopy } from "./button/ButtonCopy";
|
|
7
5
|
export type { ButtonCopyProps } from "./button/ButtonCopy";
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
export
|
|
11
|
-
export { SearchInput } from "./input/SearchInput";
|
|
6
|
+
export { ButtonCopy } from "./button/ButtonCopy";
|
|
7
|
+
export type { InputNumberProps, InputProps, InputSize, PasswordProps, TextAreaProps, TextAreaRef } from "./input/Input";
|
|
8
|
+
export { Input, InputNumber, TextArea } from "./input/Input";
|
|
12
9
|
export type { SearchInputProps } from "./input/SearchInput";
|
|
10
|
+
export { SearchInput } from "./input/SearchInput";
|
|
13
11
|
/** Native input element ref. */
|
|
14
12
|
export type InputRef = HTMLInputElement;
|
|
15
13
|
|
|
16
|
-
export { Select, SelectOption } from "./select/Select";
|
|
17
|
-
export type { SelectProps, SelectOptionConfig, SelectValue } from "./select/Select";
|
|
18
|
-
|
|
19
|
-
export { Switch } from "./switch/Switch";
|
|
20
|
-
export type { SwitchProps, SwitchVariant } from "./switch/Switch";
|
|
21
|
-
|
|
22
|
-
export { Checkbox } from "./checkbox/Checkbox";
|
|
23
|
-
export type { CheckboxProps } from "./checkbox/Checkbox";
|
|
24
|
-
|
|
25
|
-
export { ColorPicker, Color } from "./colorpicker/ColorPicker";
|
|
26
|
-
export type { ColorPickerProps, ColorFormat, ColorType, PresetColorType, ColorPickerSemanticSlot } from "./colorpicker/ColorPicker";
|
|
27
|
-
|
|
28
|
-
export { Tooltip } from "./tooltip/Tooltip";
|
|
29
|
-
export type { TooltipProps, TooltipPlacement } from "./tooltip/Tooltip";
|
|
30
|
-
|
|
31
|
-
export { Modal } from "./modal/Modal";
|
|
32
|
-
export type { ModalProps, ModalConfirmProps } from "./modal/Modal";
|
|
33
|
-
|
|
34
|
-
export { message } from "./message/message";
|
|
35
|
-
export type { MessageType, MessageConfig } from "./message/message";
|
|
36
|
-
|
|
37
|
-
export {
|
|
38
|
-
SchemaForm,
|
|
39
|
-
FormSchema,
|
|
40
|
-
FormItem,
|
|
41
|
-
EFormItemType,
|
|
42
|
-
hydrateRules,
|
|
43
|
-
fieldNameOf,
|
|
44
|
-
isRuleRequired,
|
|
45
|
-
} from "./form";
|
|
46
|
-
export type {
|
|
47
|
-
SchemaFormProps,
|
|
48
|
-
FormItemProps,
|
|
49
|
-
FormFetcher,
|
|
50
|
-
TForm,
|
|
51
|
-
TFormItemProps,
|
|
52
|
-
TFormRule,
|
|
53
|
-
TRuleValueMessage,
|
|
54
|
-
ISelectItemProps,
|
|
55
|
-
IFormItemHelpProps,
|
|
56
|
-
} from "./form";
|
|
57
|
-
|
|
58
|
-
/** Layout-only Form + Form.Item for labeled fields. */
|
|
59
|
-
export { Form } from "./form-layout/FormLayout";
|
|
60
|
-
export type { FormLayoutProps, FormLayoutItemProps } from "./form-layout/FormLayout";
|
|
61
|
-
|
|
62
|
-
export { Alert } from "./alert/Alert";
|
|
63
14
|
export type { AlertProps, AlertType } from "./alert/Alert";
|
|
64
|
-
|
|
65
|
-
export { Popover } from "./popover/Popover";
|
|
66
|
-
export type { PopoverProps } from "./popover/Popover";
|
|
67
|
-
|
|
68
|
-
export { Dropdown } from "./dropdown/Dropdown";
|
|
69
|
-
export type { DropdownProps, MenuItemType, MenuProps } from "./dropdown/Dropdown";
|
|
70
|
-
|
|
71
|
-
export { ContextMenu } from "./dropdown/ContextMenu";
|
|
72
|
-
export type { ContextMenuProps } from "./dropdown/ContextMenu";
|
|
73
|
-
|
|
74
|
-
export { Popconfirm } from "./popconfirm/Popconfirm";
|
|
75
|
-
export type { PopconfirmProps } from "./popconfirm/Popconfirm";
|
|
76
|
-
|
|
77
|
-
export { Drawer } from "./drawer/Drawer";
|
|
78
|
-
export type { DrawerProps, DrawerPlacement } from "./drawer/Drawer";
|
|
79
|
-
|
|
80
|
-
export { Splitter, SplitterPanel } from "./splitter/Splitter";
|
|
81
|
-
export type { SplitterProps, SplitterPanelProps, SplitterOrientation, SplitterSize, SplitterSemanticSlot } from "./splitter/Splitter";
|
|
82
|
-
|
|
83
|
-
export { Table } from "./table/Table";
|
|
84
|
-
export type {
|
|
85
|
-
TableProps,
|
|
86
|
-
ColumnType,
|
|
87
|
-
ColumnsType,
|
|
88
|
-
TablePaginationConfig,
|
|
89
|
-
TableRowSelection,
|
|
90
|
-
SortOrder,
|
|
91
|
-
} from "./table/Table";
|
|
92
|
-
|
|
93
|
-
export { Tag } from "./tag/Tag";
|
|
94
|
-
export type { TagProps, TagVariant } from "./tag/Tag";
|
|
95
|
-
|
|
96
|
-
export { Pagination } from "./pagination/Pagination";
|
|
97
|
-
export type { PaginationProps, PaginationItemType } from "./pagination/Pagination";
|
|
98
|
-
|
|
99
|
-
export { Empty } from "./empty/Empty";
|
|
100
|
-
export type { EmptyProps } from "./empty/Empty";
|
|
101
|
-
|
|
102
|
-
export { Spin } from "./spin/Spin";
|
|
103
|
-
export type { SpinProps, SpinVariant } from "./spin/Spin";
|
|
104
|
-
|
|
105
|
-
export { Skeleton } from "./skeleton/Skeleton";
|
|
106
|
-
export type { SkeletonProps } from "./skeleton/Skeleton";
|
|
107
|
-
|
|
108
|
-
export { Shimmer } from "./shimmer/Shimmer";
|
|
109
|
-
export type { ShimmerProps } from "./shimmer/Shimmer";
|
|
110
|
-
|
|
111
|
-
export { Segmented } from "./segmented/Segmented";
|
|
112
|
-
export type { SegmentedProps, SegmentedOption } from "./segmented/Segmented";
|
|
113
|
-
|
|
114
|
-
export { DatePicker, RangePicker } from "./datepicker/DatePicker";
|
|
115
|
-
export type { DatePickerProps, RangePickerProps, RangeValue } from "./datepicker/DatePicker";
|
|
116
|
-
|
|
117
|
-
export { TimePicker } from "./timepicker/TimePicker";
|
|
118
|
-
export type { TimePickerProps, TimeValue } from "./timepicker/TimePicker";
|
|
119
|
-
|
|
120
|
-
export { Calendar } from "./calendar/Calendar";
|
|
15
|
+
export { Alert } from "./alert/Alert";
|
|
121
16
|
export type { CalendarProps } from "./calendar/Calendar";
|
|
122
|
-
|
|
123
|
-
export {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
17
|
+
export { Calendar } from "./calendar/Calendar";
|
|
18
|
+
export type {
|
|
19
|
+
AgentHistoryMessage,
|
|
20
|
+
AgentMessage,
|
|
21
|
+
AgentMessageRole,
|
|
22
|
+
AgentPanelEndpoint,
|
|
23
|
+
AgentPanelProps,
|
|
24
|
+
AgentStreamRequest,
|
|
25
|
+
AgentToolAction,
|
|
26
|
+
AgentToolCallEvent,
|
|
27
|
+
AgentToolHook,
|
|
28
|
+
AgentToolNameMatch,
|
|
29
|
+
AgentToolResultEvent,
|
|
30
|
+
AgentToolUI,
|
|
31
|
+
AgentToolUIName,
|
|
32
|
+
BackgroundTasksBarProps,
|
|
33
|
+
ChatAgentMessageProps,
|
|
34
|
+
ChatBgTask,
|
|
35
|
+
ChatErrorProps,
|
|
36
|
+
ChatInputProps,
|
|
37
|
+
ChatMarkdownProps,
|
|
38
|
+
ChatMarkdownStreamState,
|
|
39
|
+
ChatThinkingProps,
|
|
40
|
+
ChatToolCallProps,
|
|
41
|
+
ChatToolMessage,
|
|
42
|
+
ChatUserMessageProps,
|
|
43
|
+
ChatWelcomeProps,
|
|
44
|
+
MermaidBlockProps,
|
|
45
|
+
ToolUIProps,
|
|
46
|
+
} from "./chat";
|
|
129
47
|
export {
|
|
130
|
-
|
|
131
|
-
|
|
48
|
+
AgentPanel,
|
|
49
|
+
BackgroundTasksBar,
|
|
50
|
+
BackgroundTaskToolUI,
|
|
51
|
+
buildAgentHistory,
|
|
52
|
+
builtinToolUis,
|
|
53
|
+
CallAgentToolUI,
|
|
132
54
|
ChatAgentMessage,
|
|
133
55
|
ChatError,
|
|
134
|
-
ChatToolCall,
|
|
135
56
|
ChatInput,
|
|
136
|
-
ChatWelcome,
|
|
137
|
-
ChatSpinner,
|
|
138
57
|
ChatMarkdown,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
58
|
+
ChatSpinner,
|
|
59
|
+
ChatThinking,
|
|
60
|
+
ChatToolCall,
|
|
61
|
+
ChatUserMessage,
|
|
62
|
+
ChatWelcome,
|
|
142
63
|
chatBodyClass,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
parseSseStream,
|
|
64
|
+
chatMarkdownClass,
|
|
65
|
+
chatMarkdownComponents,
|
|
66
|
+
createChatMarkdownComponents,
|
|
67
|
+
formatBgElapsed,
|
|
148
68
|
formatToolName,
|
|
149
|
-
|
|
69
|
+
GetCurrentTimeToolUI,
|
|
150
70
|
isCallAgentToolName,
|
|
151
|
-
|
|
152
|
-
|
|
71
|
+
isToolRunning,
|
|
72
|
+
MermaidBlock,
|
|
153
73
|
matchesToolHook,
|
|
154
|
-
|
|
155
|
-
formatBgElapsed,
|
|
156
|
-
resolveToolUI,
|
|
157
|
-
builtinToolUis,
|
|
74
|
+
matchesToolName,
|
|
158
75
|
matchesToolUIName,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
76
|
+
parseBgTaskRef,
|
|
77
|
+
parseCallAgentToolTargetId,
|
|
78
|
+
parseSseStream,
|
|
79
|
+
prettyJson,
|
|
163
80
|
ReadSkillToolUI,
|
|
164
81
|
RunJsToolUI,
|
|
165
|
-
|
|
166
|
-
BackgroundTasksBar,
|
|
82
|
+
resolveToolUI,
|
|
167
83
|
ToolUiTrailing,
|
|
84
|
+
useAgentStream,
|
|
85
|
+
WebFetchToolUI,
|
|
168
86
|
} from "./chat";
|
|
169
|
-
export type {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
AgentToolResultEvent,
|
|
190
|
-
AgentToolNameMatch,
|
|
191
|
-
ToolUIProps,
|
|
192
|
-
ChatToolMessage,
|
|
193
|
-
AgentToolUI,
|
|
194
|
-
AgentToolUIName,
|
|
195
|
-
ChatBgTask,
|
|
196
|
-
BackgroundTasksBarProps,
|
|
197
|
-
} from "./chat";
|
|
198
|
-
|
|
199
|
-
export { cn } from "./lib/cn";
|
|
200
|
-
export { glassSurfaceClass, glassOverlayClass, meadowSurfaceClass } from "./lib/surface";
|
|
201
|
-
export { CONTROL_SIZES, normalizeSize, getSizeTokens, controlHeightVar, controlRadiusVar, controlStatusClass, useControlSize } from "./lib/sizes";
|
|
202
|
-
export type { ControlSize, CanonicalSize, ControlSizeTokens } from "./lib/sizes";
|
|
203
|
-
export { placementToRadix } from "./lib/placement";
|
|
204
|
-
export type { PopperPlacement } from "./lib/placement";
|
|
205
|
-
export { NONLA_THEME_KNOBS, NONLA_THEME_KEYS, applyNonlaTheme, getDesignToken } from "./theme";
|
|
206
|
-
export type { NonlaThemeKnob, NonlaThemeKnobName, NonlaThemeColorName, NonlaThemeColors, NonlaThemeConfig, NonlaTokenSnapshot } from "./theme";
|
|
87
|
+
export type { CheckboxProps } from "./checkbox/Checkbox";
|
|
88
|
+
export { Checkbox } from "./checkbox/Checkbox";
|
|
89
|
+
export type { CodeBlockCopyButtonProps, CodeBlockProps } from "./codeblock/CodeBlock";
|
|
90
|
+
export { CodeBlock, CodeBlockCopyButton } from "./codeblock/CodeBlock";
|
|
91
|
+
export type { ColorFormat, ColorPickerProps, ColorPickerSemanticSlot, ColorType, PresetColorType } from "./colorpicker/ColorPicker";
|
|
92
|
+
export { Color, ColorPicker } from "./colorpicker/ColorPicker";
|
|
93
|
+
export type { DatePickerProps, RangePickerProps, RangeValue } from "./datepicker/DatePicker";
|
|
94
|
+
export { DatePicker, RangePicker } from "./datepicker/DatePicker";
|
|
95
|
+
export type { DesktopHeaderProps } from "./desktop/DesktopHeader";
|
|
96
|
+
export { DesktopBarButton, DesktopBarDivider, DesktopBarItem, DesktopHeader } from "./desktop/DesktopHeader";
|
|
97
|
+
export { DesktopIcon } from "./desktop/DesktopIcon";
|
|
98
|
+
export { DesktopStage } from "./desktop/DesktopStage";
|
|
99
|
+
export type { DesktopWindowProps, WindowHeaderProps } from "./desktop/DesktopWindow";
|
|
100
|
+
export { DesktopWindow, WindowHeader } from "./desktop/DesktopWindow";
|
|
101
|
+
export { MeadowDesktop } from "./desktop/MeadowDesktop";
|
|
102
|
+
export { MeadowShell } from "./desktop/MeadowShell";
|
|
103
|
+
export { MeadowWallpaper } from "./desktop/MeadowWallpaper";
|
|
104
|
+
export type { DrawerPlacement, DrawerProps } from "./drawer/Drawer";
|
|
105
|
+
export { Drawer } from "./drawer/Drawer";
|
|
106
|
+
export type { ContextMenuProps } from "./dropdown/ContextMenu";
|
|
207
107
|
|
|
108
|
+
export { ContextMenu } from "./dropdown/ContextMenu";
|
|
109
|
+
export type { DropdownProps, MenuItemType, MenuProps } from "./dropdown/Dropdown";
|
|
110
|
+
export { Dropdown } from "./dropdown/Dropdown";
|
|
111
|
+
export type { EmptyProps } from "./empty/Empty";
|
|
112
|
+
export { Empty } from "./empty/Empty";
|
|
113
|
+
export type {
|
|
114
|
+
FormFetcher,
|
|
115
|
+
FormItemProps,
|
|
116
|
+
IFormItemHelpProps,
|
|
117
|
+
ISelectItemProps,
|
|
118
|
+
SchemaFormProps,
|
|
119
|
+
TForm,
|
|
120
|
+
TFormItemProps,
|
|
121
|
+
TFormRule,
|
|
122
|
+
TRuleValueMessage,
|
|
123
|
+
} from "./form";
|
|
124
|
+
export {
|
|
125
|
+
EFormItemType,
|
|
126
|
+
FormItem,
|
|
127
|
+
FormSchema,
|
|
128
|
+
fieldNameOf,
|
|
129
|
+
hydrateRules,
|
|
130
|
+
isRuleRequired,
|
|
131
|
+
SchemaForm,
|
|
132
|
+
} from "./form";
|
|
133
|
+
export type { FormLayoutItemProps, FormLayoutProps } from "./form-layout/FormLayout";
|
|
134
|
+
/** Layout-only Form + Form.Item for labeled fields. */
|
|
135
|
+
export { Form } from "./form-layout/FormLayout";
|
|
208
136
|
export { FluentIcon } from "./icon/FluentIcon";
|
|
209
137
|
export {
|
|
210
|
-
ICON_PREFIX,
|
|
211
138
|
DEFAULT_ICON_NAME,
|
|
212
139
|
DEFAULT_TOOL_ICON,
|
|
213
140
|
ensureFluentIcons,
|
|
214
|
-
getIconNames,
|
|
215
|
-
getFluentImgSrc,
|
|
216
|
-
isSvgIcon,
|
|
217
|
-
isFluentIcon,
|
|
218
141
|
fluentIconName,
|
|
219
142
|
fluentIconRef,
|
|
143
|
+
getFluentImgSrc,
|
|
144
|
+
getIconNames,
|
|
145
|
+
ICON_PREFIX,
|
|
146
|
+
isFluentIcon,
|
|
147
|
+
isSvgIcon,
|
|
220
148
|
} from "./icon/fluent";
|
|
221
|
-
|
|
222
|
-
export {
|
|
223
|
-
export {
|
|
224
|
-
export {
|
|
225
|
-
export {
|
|
226
|
-
export {
|
|
227
|
-
export {
|
|
228
|
-
export {
|
|
229
|
-
|
|
230
|
-
export {
|
|
231
|
-
export type {
|
|
149
|
+
export { cn } from "./lib/cn";
|
|
150
|
+
export type { PopperPlacement } from "./lib/placement";
|
|
151
|
+
export { placementToRadix } from "./lib/placement";
|
|
152
|
+
export type { CanonicalSize, ControlSize, ControlSizeTokens } from "./lib/sizes";
|
|
153
|
+
export { CONTROL_SIZES, controlHeightVar, controlRadiusVar, controlStatusClass, getSizeTokens, normalizeSize, useControlSize } from "./lib/sizes";
|
|
154
|
+
export { glassOverlayClass, glassSurfaceClass, meadowSurfaceClass } from "./lib/surface";
|
|
155
|
+
export type { MenuItemProps, MenuRootProps, MenuTriggerProps } from "./menu/Menu";
|
|
156
|
+
export { Menu, MenuAction, MenuDivider, MenuItem, MenuTrigger } from "./menu/Menu";
|
|
157
|
+
export type { MessageConfig, MessageType } from "./message/message";
|
|
158
|
+
export { message } from "./message/message";
|
|
159
|
+
export type { ModalConfirmProps, ModalProps } from "./modal/Modal";
|
|
160
|
+
export { Modal } from "./modal/Modal";
|
|
161
|
+
export type { PaginationAlign, PaginationItemType, PaginationProps, PaginationSemanticSlot, PaginationSizeChangerProps } from "./pagination/Pagination";
|
|
162
|
+
export { Pagination } from "./pagination/Pagination";
|
|
163
|
+
export type { PopconfirmProps } from "./popconfirm/Popconfirm";
|
|
164
|
+
export { Popconfirm } from "./popconfirm/Popconfirm";
|
|
165
|
+
export type { PopoverProps } from "./popover/Popover";
|
|
166
|
+
export { Popover } from "./popover/Popover";
|
|
167
|
+
export type { OverlayScrollProps, OverlayScrollVisibility } from "./scroll/OverlayScroll";
|
|
168
|
+
export { OverlayScroll } from "./scroll/OverlayScroll";
|
|
169
|
+
export type { SegmentedOption, SegmentedProps } from "./segmented/Segmented";
|
|
170
|
+
export { Segmented } from "./segmented/Segmented";
|
|
171
|
+
export type { SelectOptionConfig, SelectProps, SelectValue } from "./select/Select";
|
|
172
|
+
export { Select, SelectOption } from "./select/Select";
|
|
173
|
+
export type { ShimmerProps } from "./shimmer/Shimmer";
|
|
174
|
+
export { Shimmer } from "./shimmer/Shimmer";
|
|
175
|
+
export type { SkeletonProps } from "./skeleton/Skeleton";
|
|
176
|
+
export { Skeleton } from "./skeleton/Skeleton";
|
|
177
|
+
export type { SpinProps, SpinVariant } from "./spin/Spin";
|
|
178
|
+
export { Spin } from "./spin/Spin";
|
|
179
|
+
export type { SplitterOrientation, SplitterPanelProps, SplitterProps, SplitterSemanticSlot, SplitterSize } from "./splitter/Splitter";
|
|
180
|
+
export { Splitter, SplitterPanel } from "./splitter/Splitter";
|
|
181
|
+
export type { SwitchProps, SwitchVariant } from "./switch/Switch";
|
|
182
|
+
export { Switch } from "./switch/Switch";
|
|
183
|
+
export type {
|
|
184
|
+
ColumnsType,
|
|
185
|
+
ColumnType,
|
|
186
|
+
SortOrder,
|
|
187
|
+
TablePaginationConfig,
|
|
188
|
+
TableProps,
|
|
189
|
+
TableRowSelection,
|
|
190
|
+
} from "./table/Table";
|
|
191
|
+
export { Table } from "./table/Table";
|
|
192
|
+
export type { TagProps, TagVariant } from "./tag/Tag";
|
|
193
|
+
export { Tag } from "./tag/Tag";
|
|
194
|
+
export type { NonlaThemeColorName, NonlaThemeColors, NonlaThemeConfig, NonlaThemeKnob, NonlaThemeKnobName, NonlaTokenSnapshot } from "./theme";
|
|
195
|
+
export { applyNonlaTheme, getDesignToken, NONLA_THEME_KEYS, NONLA_THEME_KNOBS } from "./theme";
|
|
196
|
+
export type { TimePickerProps, TimeValue } from "./timepicker/TimePicker";
|
|
197
|
+
export { TimePicker } from "./timepicker/TimePicker";
|
|
198
|
+
export type { TooltipPlacement, TooltipProps } from "./tooltip/Tooltip";
|
|
199
|
+
export { Tooltip } from "./tooltip/Tooltip";
|
package/src/input/Input.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CSSProperties, type InputHTMLAttributes, type KeyboardEvent, type ReactNode, type TextareaHTMLAttributes,
|
|
1
|
+
import { type CSSProperties, forwardRef, type InputHTMLAttributes, type KeyboardEvent, type ReactNode, type TextareaHTMLAttributes, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
2
2
|
import { cn } from "../lib/cn";
|
|
3
3
|
import { type ControlSize, controlFieldFocusBorder, controlFieldStyle, controlFieldSurface, controlFieldTransition, controlHeightVar, controlRadiusVar, controlStatusClass, getSizeTokens, useControlSize } from "../lib/sizes";
|
|
4
4
|
|
|
@@ -160,9 +160,9 @@ function roundTo(n: number, precision?: number) {
|
|
|
160
160
|
return Math.round(n * f) / f;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
function HandlerChevron({ dir }: { dir: "up" | "down" }) {
|
|
163
|
+
function HandlerChevron({ dir, size }: { dir: "up" | "down"; size: number }) {
|
|
164
164
|
return (
|
|
165
|
-
<svg width=
|
|
165
|
+
<svg width={size} height={size} viewBox="0 0 10 10" fill="none" aria-hidden className="opacity-70">
|
|
166
166
|
{dir === "up" ? <path d="M2.5 6.25L5 3.75L7.5 6.25" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" /> : <path d="M2.5 3.75L5 6.25L7.5 3.75" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />}
|
|
167
167
|
</svg>
|
|
168
168
|
);
|
|
@@ -216,7 +216,8 @@ const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(function Inpu
|
|
|
216
216
|
|
|
217
217
|
const atMin = numeric != null && min != null && numeric <= min;
|
|
218
218
|
const atMax = numeric != null && max != null && numeric >= max;
|
|
219
|
-
const handlerW = resolvedSize === "small" ? 18 : 22;
|
|
219
|
+
const handlerW = resolvedSize === "small" ? 18 : resolvedSize === "large" ? 26 : 22;
|
|
220
|
+
const chevronSize = Math.max(8, tok.icon - 4);
|
|
220
221
|
|
|
221
222
|
const setRefs = (node: HTMLInputElement | null) => {
|
|
222
223
|
inputRef.current = node;
|
|
@@ -302,7 +303,7 @@ const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(function Inpu
|
|
|
302
303
|
onMouseDown={(e) => e.preventDefault()}
|
|
303
304
|
onClick={() => stepBy(1)}
|
|
304
305
|
>
|
|
305
|
-
<HandlerChevron dir="up" />
|
|
306
|
+
<HandlerChevron dir="up" size={chevronSize} />
|
|
306
307
|
</button>
|
|
307
308
|
<button
|
|
308
309
|
type="button"
|
|
@@ -313,7 +314,7 @@ const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(function Inpu
|
|
|
313
314
|
onMouseDown={(e) => e.preventDefault()}
|
|
314
315
|
onClick={() => stepBy(-1)}
|
|
315
316
|
>
|
|
316
|
-
<HandlerChevron dir="down" />
|
|
317
|
+
<HandlerChevron dir="down" size={chevronSize} />
|
|
317
318
|
</button>
|
|
318
319
|
</div>
|
|
319
320
|
) : null}
|
|
@@ -325,9 +326,9 @@ export type PasswordProps = InputProps & {
|
|
|
325
326
|
visibilityToggle?: boolean | { visible?: boolean; onVisibleChange?: (visible: boolean) => void };
|
|
326
327
|
};
|
|
327
328
|
|
|
328
|
-
function EyeIcon({ off }: { off?: boolean }) {
|
|
329
|
+
function EyeIcon({ off, size }: { off?: boolean; size: number }) {
|
|
329
330
|
return (
|
|
330
|
-
<svg width=
|
|
331
|
+
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" aria-hidden>
|
|
331
332
|
<path d="M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12Z" stroke="currentColor" strokeWidth="1.75" />
|
|
332
333
|
<circle cx="12" cy="12" r="3" stroke="currentColor" strokeWidth="1.75" />
|
|
333
334
|
{off ? <path d="M4 4L20 20" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" /> : null}
|
|
@@ -335,12 +336,13 @@ function EyeIcon({ off }: { off?: boolean }) {
|
|
|
335
336
|
);
|
|
336
337
|
}
|
|
337
338
|
|
|
338
|
-
const Password = forwardRef<HTMLInputElement, PasswordProps>(function Password({ visibilityToggle = true, suffix, ...props }, ref) {
|
|
339
|
+
const Password = forwardRef<HTMLInputElement, PasswordProps>(function Password({ visibilityToggle = true, suffix, size, ...props }, ref) {
|
|
339
340
|
const toggle = visibilityToggle;
|
|
340
341
|
const enabled = toggle !== false;
|
|
341
342
|
const controlled = typeof toggle === "object" && toggle.visible !== undefined;
|
|
342
343
|
const [inner, setInner] = useState(false);
|
|
343
344
|
const visible = enabled && (controlled ? Boolean((toggle as { visible?: boolean }).visible) : inner);
|
|
345
|
+
const iconSize = getSizeTokens(useControlSize(size)).icon;
|
|
344
346
|
|
|
345
347
|
const setVisible = (v: boolean) => {
|
|
346
348
|
if (!controlled) setInner(v);
|
|
@@ -349,7 +351,7 @@ const Password = forwardRef<HTMLInputElement, PasswordProps>(function Password({
|
|
|
349
351
|
|
|
350
352
|
const eye = enabled ? (
|
|
351
353
|
<button type="button" tabIndex={-1} aria-label={visible ? "Hide password" : "Show password"} className="inline-flex items-center text-muted-foreground hover:text-foreground" onClick={() => setVisible(!visible)}>
|
|
352
|
-
<EyeIcon off={!visible} />
|
|
354
|
+
<EyeIcon size={iconSize} off={!visible} />
|
|
353
355
|
</button>
|
|
354
356
|
) : null;
|
|
355
357
|
|
|
@@ -361,7 +363,7 @@ const Password = forwardRef<HTMLInputElement, PasswordProps>(function Password({
|
|
|
361
363
|
</>
|
|
362
364
|
) : undefined;
|
|
363
365
|
|
|
364
|
-
return <InputRoot ref={ref} type={visible ? "text" : "password"} suffix={mergedSuffix} {...props} />;
|
|
366
|
+
return <InputRoot ref={ref} type={visible ? "text" : "password"} size={size} suffix={mergedSuffix} {...props} />;
|
|
365
367
|
});
|
|
366
368
|
|
|
367
369
|
export const Input = Object.assign(InputRoot, {
|
|
@@ -369,4 +371,4 @@ export const Input = Object.assign(InputRoot, {
|
|
|
369
371
|
Password,
|
|
370
372
|
});
|
|
371
373
|
|
|
372
|
-
export {
|
|
374
|
+
export { InputNumber, TextArea };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ChangeEvent, useEffect, useRef, useState } from "react";
|
|
2
|
+
import { getSizeTokens, useControlSize } from "../lib/sizes";
|
|
2
3
|
import { Input, type InputProps } from "./Input";
|
|
3
4
|
|
|
4
5
|
const DEFAULT_WAIT = 300;
|
|
@@ -20,8 +21,9 @@ function SearchIcon({ size = 14 }: { size?: number }) {
|
|
|
20
21
|
);
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
export function SearchInput({ defaultValue = "", onChange, wait = DEFAULT_WAIT, allowClear = true, className, placeholder = "Search…", onPressEnter, ...rest }: SearchInputProps) {
|
|
24
|
+
export function SearchInput({ defaultValue = "", onChange, wait = DEFAULT_WAIT, allowClear = true, className, placeholder = "Search…", onPressEnter, size, ...rest }: SearchInputProps) {
|
|
24
25
|
const [value, setValue] = useState(defaultValue);
|
|
26
|
+
const iconSize = getSizeTokens(useControlSize(size)).icon;
|
|
25
27
|
const onChangeRef = useRef(onChange);
|
|
26
28
|
onChangeRef.current = onChange;
|
|
27
29
|
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
@@ -63,7 +65,8 @@ export function SearchInput({ defaultValue = "", onChange, wait = DEFAULT_WAIT,
|
|
|
63
65
|
placeholder={placeholder}
|
|
64
66
|
value={value}
|
|
65
67
|
onChange={handleChange}
|
|
66
|
-
prefix={<SearchIcon />}
|
|
68
|
+
prefix={<SearchIcon size={iconSize} />}
|
|
69
|
+
size={size}
|
|
67
70
|
onPressEnter={(e) => {
|
|
68
71
|
flush(value);
|
|
69
72
|
onPressEnter?.(e);
|
package/src/lib/sizes.ts
CHANGED
package/src/modal/Modal.tsx
CHANGED
|
@@ -177,6 +177,9 @@ function ModalView({
|
|
|
177
177
|
data-centered={centered ? "true" : undefined}
|
|
178
178
|
style={{ width, ...style, ...styles?.container, ...styles?.content }}
|
|
179
179
|
onAnimationEnd={onContentAnimationEnd}
|
|
180
|
+
onEscapeKeyDown={(e) => {
|
|
181
|
+
e.stopPropagation();
|
|
182
|
+
}}
|
|
180
183
|
onPointerDownOutside={(e) => {
|
|
181
184
|
if (!maskClosable) e.preventDefault();
|
|
182
185
|
}}
|