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.
Files changed (50) hide show
  1. package/README.md +3 -3
  2. package/package.json +2 -1
  3. package/src/app/App.tsx +4 -4
  4. package/src/button/Button.tsx +1 -1
  5. package/src/button/ButtonCopy.tsx +11 -21
  6. package/src/calendar/Calendar.tsx +1 -1
  7. package/src/chat/AgentPanel.tsx +3 -3
  8. package/src/chat/index.ts +35 -51
  9. package/src/chat/message-ui/ChatError.tsx +2 -4
  10. package/src/chat/message-ui/ChatInput.tsx +5 -9
  11. package/src/chat/message-ui/ChatThinking.tsx +2 -3
  12. package/src/chat/message-ui/ChatUserMessage.tsx +4 -5
  13. package/src/chat/message-ui/ChatWelcome.tsx +3 -8
  14. package/src/chat/message-ui/MermaidBlock.tsx +7 -47
  15. package/src/chat/tool-ui/BackgroundTaskToolUI.tsx +8 -11
  16. package/src/chat/tool-ui/BackgroundTasksBar.tsx +13 -14
  17. package/src/chat/tool-ui/CallAgentToolUI.tsx +10 -4
  18. package/src/chat/tool-ui/ChatToolCall.tsx +11 -17
  19. package/src/chat/tool-ui/GetCurrentTimeToolUI.tsx +2 -2
  20. package/src/chat/tool-ui/ReadSkillToolUI.tsx +3 -3
  21. package/src/chat/tool-ui/RunJsToolUI.tsx +2 -2
  22. package/src/chat/tool-ui/ToolUiTrailing.tsx +3 -7
  23. package/src/chat/tool-ui/WebFetchToolUI.tsx +22 -13
  24. package/src/checkbox/Checkbox.tsx +1 -1
  25. package/src/codeblock/CodeBlock.tsx +17 -19
  26. package/src/colorpicker/ColorPicker.tsx +694 -30
  27. package/src/colorpicker/color.ts +246 -0
  28. package/src/datepicker/DatePicker.tsx +3 -3
  29. package/src/desktop/DesktopHeader.tsx +15 -20
  30. package/src/desktop/DesktopIcon.tsx +1 -1
  31. package/src/desktop/DesktopWindow.tsx +54 -30
  32. package/src/form/Form.tsx +1 -1
  33. package/src/form/FormItem.tsx +2 -2
  34. package/src/form/index.ts +23 -24
  35. package/src/form/variants/FieldColor.tsx +16 -51
  36. package/src/index.ts +167 -196
  37. package/src/input/Input.tsx +14 -12
  38. package/src/input/SearchInput.tsx +5 -2
  39. package/src/lib/sizes.ts +1 -1
  40. package/src/modal/Modal.tsx +3 -0
  41. package/src/pagination/Pagination.tsx +528 -51
  42. package/src/scroll/OverlayScroll.tsx +58 -37
  43. package/src/select/Select.tsx +2 -2
  44. package/src/spin/Spin.tsx +14 -17
  45. package/src/splitter/Splitter.tsx +330 -0
  46. package/src/splitter/sizes.ts +67 -0
  47. package/src/styles.css +28 -3
  48. package/src/switch/Switch.tsx +1 -1
  49. package/src/table/Table.tsx +43 -18
  50. package/src/timepicker/TimePicker.tsx +2 -2
package/src/index.ts CHANGED
@@ -1,228 +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 { Input, TextArea, InputNumber } from "./input/Input";
10
- export type { InputProps, TextAreaProps, InputNumberProps, InputSize, TextAreaRef, PasswordProps } from "./input/Input";
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 } from "./colorpicker/ColorPicker";
26
- export type { ColorPickerProps } 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 { Table } from "./table/Table";
81
- export type {
82
- TableProps,
83
- ColumnType,
84
- ColumnsType,
85
- TablePaginationConfig,
86
- TableRowSelection,
87
- SortOrder,
88
- } from "./table/Table";
89
-
90
- export { Tag } from "./tag/Tag";
91
- export type { TagProps, TagVariant } from "./tag/Tag";
92
-
93
- export { Pagination } from "./pagination/Pagination";
94
- export type { PaginationProps, PaginationItemType } from "./pagination/Pagination";
95
-
96
- export { Empty } from "./empty/Empty";
97
- export type { EmptyProps } from "./empty/Empty";
98
-
99
- export { Spin } from "./spin/Spin";
100
- export type { SpinProps, SpinVariant } from "./spin/Spin";
101
-
102
- export { Skeleton } from "./skeleton/Skeleton";
103
- export type { SkeletonProps } from "./skeleton/Skeleton";
104
-
105
- export { Shimmer } from "./shimmer/Shimmer";
106
- export type { ShimmerProps } from "./shimmer/Shimmer";
107
-
108
- export { Segmented } from "./segmented/Segmented";
109
- export type { SegmentedProps, SegmentedOption } from "./segmented/Segmented";
110
-
111
- export { DatePicker, RangePicker } from "./datepicker/DatePicker";
112
- export type { DatePickerProps, RangePickerProps, RangeValue } from "./datepicker/DatePicker";
113
-
114
- export { TimePicker } from "./timepicker/TimePicker";
115
- export type { TimePickerProps, TimeValue } from "./timepicker/TimePicker";
116
-
117
- export { Calendar } from "./calendar/Calendar";
15
+ export { Alert } from "./alert/Alert";
118
16
  export type { CalendarProps } from "./calendar/Calendar";
119
-
120
- export { CodeBlock, CodeBlockCopyButton } from "./codeblock/CodeBlock";
121
- export type { CodeBlockProps, CodeBlockCopyButtonProps } from "./codeblock/CodeBlock";
122
-
123
- export { OverlayScroll } from "./scroll/OverlayScroll";
124
- export type { OverlayScrollProps, OverlayScrollVisibility } from "./scroll/OverlayScroll";
125
-
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";
126
47
  export {
127
- ChatThinking,
128
- ChatUserMessage,
48
+ AgentPanel,
49
+ BackgroundTasksBar,
50
+ BackgroundTaskToolUI,
51
+ buildAgentHistory,
52
+ builtinToolUis,
53
+ CallAgentToolUI,
129
54
  ChatAgentMessage,
130
55
  ChatError,
131
- ChatToolCall,
132
56
  ChatInput,
133
- ChatWelcome,
134
- ChatSpinner,
135
57
  ChatMarkdown,
136
- createChatMarkdownComponents,
137
- chatMarkdownComponents,
138
- chatMarkdownClass,
58
+ ChatSpinner,
59
+ ChatThinking,
60
+ ChatToolCall,
61
+ ChatUserMessage,
62
+ ChatWelcome,
139
63
  chatBodyClass,
140
- MermaidBlock,
141
- AgentPanel,
142
- useAgentStream,
143
- buildAgentHistory,
144
- parseSseStream,
64
+ chatMarkdownClass,
65
+ chatMarkdownComponents,
66
+ createChatMarkdownComponents,
67
+ formatBgElapsed,
145
68
  formatToolName,
146
- prettyJson,
69
+ GetCurrentTimeToolUI,
147
70
  isCallAgentToolName,
148
- parseCallAgentToolTargetId,
149
- matchesToolName,
71
+ isToolRunning,
72
+ MermaidBlock,
150
73
  matchesToolHook,
151
- parseBgTaskRef,
152
- formatBgElapsed,
153
- resolveToolUI,
154
- builtinToolUis,
74
+ matchesToolName,
155
75
  matchesToolUIName,
156
- isToolRunning,
157
- CallAgentToolUI,
158
- WebFetchToolUI,
159
- GetCurrentTimeToolUI,
76
+ parseBgTaskRef,
77
+ parseCallAgentToolTargetId,
78
+ parseSseStream,
79
+ prettyJson,
160
80
  ReadSkillToolUI,
161
81
  RunJsToolUI,
162
- BackgroundTaskToolUI,
163
- BackgroundTasksBar,
82
+ resolveToolUI,
164
83
  ToolUiTrailing,
84
+ useAgentStream,
85
+ WebFetchToolUI,
165
86
  } from "./chat";
166
- export type {
167
- ChatThinkingProps,
168
- ChatUserMessageProps,
169
- ChatAgentMessageProps,
170
- ChatErrorProps,
171
- ChatToolCallProps,
172
- ChatInputProps,
173
- ChatWelcomeProps,
174
- ChatMarkdownProps,
175
- ChatMarkdownStreamState,
176
- MermaidBlockProps,
177
- AgentPanelProps,
178
- AgentMessage,
179
- AgentMessageRole,
180
- AgentHistoryMessage,
181
- AgentStreamRequest,
182
- AgentPanelEndpoint,
183
- AgentToolAction,
184
- AgentToolHook,
185
- AgentToolCallEvent,
186
- AgentToolResultEvent,
187
- AgentToolNameMatch,
188
- ToolUIProps,
189
- ChatToolMessage,
190
- AgentToolUI,
191
- AgentToolUIName,
192
- ChatBgTask,
193
- BackgroundTasksBarProps,
194
- } from "./chat";
195
-
196
- export { cn } from "./lib/cn";
197
- export { glassSurfaceClass, glassOverlayClass, meadowSurfaceClass } from "./lib/surface";
198
- export { CONTROL_SIZES, normalizeSize, getSizeTokens, controlHeightVar, controlRadiusVar, controlStatusClass, useControlSize } from "./lib/sizes";
199
- export type { ControlSize, CanonicalSize, ControlSizeTokens } from "./lib/sizes";
200
- export { placementToRadix } from "./lib/placement";
201
- export type { PopperPlacement } from "./lib/placement";
202
- export { NONLA_THEME_KNOBS, NONLA_THEME_KEYS, applyNonlaTheme, getDesignToken } from "./theme";
203
- 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";
204
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";
205
136
  export { FluentIcon } from "./icon/FluentIcon";
206
137
  export {
207
- ICON_PREFIX,
208
138
  DEFAULT_ICON_NAME,
209
139
  DEFAULT_TOOL_ICON,
210
140
  ensureFluentIcons,
211
- getIconNames,
212
- getFluentImgSrc,
213
- isSvgIcon,
214
- isFluentIcon,
215
141
  fluentIconName,
216
142
  fluentIconRef,
143
+ getFluentImgSrc,
144
+ getIconNames,
145
+ ICON_PREFIX,
146
+ isFluentIcon,
147
+ isSvgIcon,
217
148
  } from "./icon/fluent";
218
-
219
- export { DesktopStage } from "./desktop/DesktopStage";
220
- export { MeadowWallpaper } from "./desktop/MeadowWallpaper";
221
- export { MeadowDesktop } from "./desktop/MeadowDesktop";
222
- export { MeadowShell } from "./desktop/MeadowShell";
223
- export { DesktopHeader, DesktopBarButton, DesktopBarItem, DesktopBarDivider } from "./desktop/DesktopHeader";
224
- export { DesktopIcon } from "./desktop/DesktopIcon";
225
- export { DesktopWindow, WindowHeader } from "./desktop/DesktopWindow";
226
-
227
- export { Menu, MenuTrigger, MenuItem, MenuAction, MenuDivider } from "./menu/Menu";
228
- export type { MenuRootProps, MenuTriggerProps, MenuItemProps } from "./menu/Menu";
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";
@@ -1,4 +1,4 @@
1
- import { type CSSProperties, type InputHTMLAttributes, type KeyboardEvent, type ReactNode, type TextareaHTMLAttributes, forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
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="10" height="10" viewBox="0 0 10 10" fill="none" aria-hidden className="opacity-70">
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="14" height="14" viewBox="0 0 24 24" fill="none" aria-hidden>
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 { TextArea, InputNumber };
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
@@ -1,4 +1,4 @@
1
- import { createContext, useContext, type CSSProperties } from "react";
1
+ import { type CSSProperties, createContext, useContext } from "react";
2
2
 
3
3
  /**
4
4
  * Canonical control sizes for NonlaUI.
@@ -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
  }}