@nexub/react 2.0.0 → 2.2.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 (73) hide show
  1. package/dist/{chunk-4MEV2WHD.js → chunk-2BAXCPQF.js} +1 -1
  2. package/dist/{chunk-7BAIEYUW.js → chunk-3FX3FBHE.js} +1 -1
  3. package/dist/chunk-4GVGS5N4.js +468 -0
  4. package/dist/{chunk-ZTI4MK3L.js → chunk-5JOKHG4L.js} +1 -1
  5. package/dist/{chunk-HSM7RXUF.js → chunk-5QZVFW4H.js} +1 -1
  6. package/dist/{chunk-UVWQPDOV.js → chunk-6ALDF3XF.js} +2 -2
  7. package/dist/{chunk-V6CMWCJH.js → chunk-6FRG6NMM.js} +2 -2
  8. package/dist/{chunk-ENB7X3W4.js → chunk-7JXJOYM6.js} +1 -1
  9. package/dist/{chunk-JVOSMXD5.js → chunk-AKV4GMIY.js} +1 -1
  10. package/dist/{chunk-FT2S7N64.js → chunk-BSS7QNC5.js} +1 -1
  11. package/dist/{chunk-OS4NOWEI.js → chunk-D6HHYT2S.js} +1 -1
  12. package/dist/{chunk-ESMIBOF5.js → chunk-D7HMUIA5.js} +1 -1
  13. package/dist/{chunk-ETWFHIAE.js → chunk-EA4JBLWK.js} +1 -1
  14. package/dist/{chunk-UAQRQNOB.js → chunk-EILMNNTT.js} +1 -1
  15. package/dist/{chunk-IDIS7Z6H.js → chunk-F3DRJSZL.js} +1 -1
  16. package/dist/{chunk-GSA7NBEG.js → chunk-I6ELDWZE.js} +1 -1
  17. package/dist/{chunk-OTZBGMYH.js → chunk-IPCB5HU7.js} +1 -1
  18. package/dist/{chunk-6U5WQERX.js → chunk-KFU2ENV6.js} +2 -2
  19. package/dist/{chunk-ZRBLASQE.js → chunk-MX6NYEOW.js} +1 -1
  20. package/dist/{chunk-GG5HDX7J.js → chunk-NITVUZ4L.js} +1 -1
  21. package/dist/{chunk-XHLSYHAV.js → chunk-NN7SNECM.js} +1 -1
  22. package/dist/{chunk-BIAYWCDE.js → chunk-O2DSTHXA.js} +1 -1
  23. package/dist/{chunk-L4BSKMLK.js → chunk-P37ABUFD.js} +1 -1
  24. package/dist/{chunk-5GN2GFW3.js → chunk-Q4CEJZY6.js} +1 -1
  25. package/dist/chunk-R3SUPKKI.js +12 -0
  26. package/dist/{chunk-UV5O2BMW.js → chunk-TSBBWYDO.js} +1 -1
  27. package/dist/{chunk-RVWQROFK.js → chunk-TXIJMUD5.js} +1 -1
  28. package/dist/{chunk-O6J6HXVT.js → chunk-VMMZHSZL.js} +1 -1
  29. package/dist/chunk-VMSWIC3O.js +40 -0
  30. package/dist/{chunk-WECNLNIA.js → chunk-WASCNEIQ.js} +1 -1
  31. package/dist/{chunk-RSBJBQPG.js → chunk-WXE6QRHB.js} +1 -1
  32. package/dist/{chunk-KRHD7VI6.js → chunk-ZVQYAIOA.js} +1 -1
  33. package/dist/{chunk-PC7YGDNL.js → chunk-ZYR3R36N.js} +3 -3
  34. package/dist/components/Alert/index.js +2 -2
  35. package/dist/components/Amount/index.js +4 -4
  36. package/dist/components/Autocomplete/index.js +2 -2
  37. package/dist/components/AvatarGroup/index.js +2 -2
  38. package/dist/components/Banner/index.js +2 -2
  39. package/dist/components/Breadcrumb/index.js +2 -2
  40. package/dist/components/Chip/index.js +2 -2
  41. package/dist/components/Citation/index.js +2 -2
  42. package/dist/components/CommandPalette/index.js +2 -2
  43. package/dist/components/DataTable/index.js +2 -2
  44. package/dist/components/DatePicker/index.js +2 -2
  45. package/dist/components/DateRangePicker/index.js +3 -3
  46. package/dist/components/Drawer/index.js +1 -1
  47. package/dist/components/FileUpload/index.js +2 -2
  48. package/dist/components/FilterChip/index.js +2 -2
  49. package/dist/components/FormField/index.js +3 -3
  50. package/dist/components/MessageBubble/index.js +2 -2
  51. package/dist/components/MoneyInput/index.js +3 -3
  52. package/dist/components/Motion/index.js +9 -3
  53. package/dist/components/NavigationRail/index.js +2 -2
  54. package/dist/components/NexubProvider/index.js +1 -1
  55. package/dist/components/NumberInput/index.js +2 -2
  56. package/dist/components/NumberTicker/index.js +2 -2
  57. package/dist/components/Pagination/index.js +2 -2
  58. package/dist/components/PasswordInput/index.js +2 -2
  59. package/dist/components/PromptInput/index.js +2 -2
  60. package/dist/components/Rating/index.js +2 -2
  61. package/dist/components/SearchInput/index.js +2 -2
  62. package/dist/components/Sidebar/index.js +2 -2
  63. package/dist/components/Spinner/index.js +2 -2
  64. package/dist/components/ThinkingIndicator/index.js +2 -2
  65. package/dist/components/Toast/index.js +2 -2
  66. package/dist/components/TopNav/index.js +2 -2
  67. package/dist/index.d.ts +65 -106
  68. package/dist/index.js +67 -75
  69. package/package.json +6 -5
  70. package/dist/chunk-3MSIO7KM.js +0 -129
  71. package/dist/chunk-CIQHFMF6.js +0 -44
  72. package/dist/chunk-FS4XKWFA.js +0 -308
  73. package/dist/{chunk-GLQOEW57.js → chunk-G4RLUGE3.js} +4 -4
@@ -1,129 +0,0 @@
1
- 'use client';
2
-
3
- // src/components/NexubProvider/NexubProvider.tsx
4
- import * as React from "react";
5
- import { DirectionProvider } from "@radix-ui/react-direction";
6
- import { jsx } from "react/jsx-runtime";
7
- var defaultMessages = {
8
- close: "Close",
9
- dismissAlert: "Dismiss alert",
10
- dismissBanner: "Dismiss banner",
11
- remove: "Remove",
12
- removeFilter: "Remove filter",
13
- removeFile: (fileName) => `Remove ${fileName}`,
14
- uploadFiles: "Upload files",
15
- clickToUpload: "Click to upload",
16
- orDragAndDrop: "or drag and drop",
17
- clearSearch: "Clear search",
18
- showPassword: "Show password",
19
- hidePassword: "Hide password",
20
- increment: "Increment",
21
- decrement: "Decrement",
22
- loading: "Loading\u2026",
23
- pagination: "Pagination",
24
- previousPage: "Go to previous page",
25
- nextPage: "Go to next page",
26
- goToPage: (page) => `Go to page ${page}`,
27
- breadcrumb: "breadcrumb",
28
- breadcrumbMore: "More",
29
- moreCount: (count) => `${count} more`,
30
- rating: "Rating",
31
- ratingStars: (stars) => `${stars} star${stars !== 1 ? "s" : ""}`,
32
- mainNavigation: "Main",
33
- sidebar: "Sidebar",
34
- searchPlaceholder: "Search\u2026",
35
- noResults: "No results found.",
36
- pickDate: "Pick a date",
37
- pickDateRange: "Pick a date range",
38
- previousMonth: "Go to previous month",
39
- nextMonth: "Go to next month",
40
- calendarNavigation: "Calendar navigation",
41
- todayDate: (date) => `Today, ${date}`,
42
- selectedDate: (label) => `${label}, selected`,
43
- commandPalette: "Command palette",
44
- notifications: "Notifications ({hotkey})",
45
- undo: "Undo",
46
- promptLabel: "Message",
47
- sendMessage: "Send message",
48
- stopGenerating: "Stop generating",
49
- promptHint: "Press Enter to send, Shift+Enter for a new line",
50
- thinking: "Thinking",
51
- youSaid: "You said",
52
- assistantSaid: "Assistant said",
53
- failedToSend: "Failed to send",
54
- retry: "Retry",
55
- copy: "Copy",
56
- copied: "Copied",
57
- goodResponse: "Good response",
58
- badResponse: "Bad response",
59
- regenerate: "Regenerate",
60
- sources: "Sources",
61
- source: (n) => `Source ${n}`,
62
- jumpToLatest: "Jump to latest",
63
- conversation: "Conversation",
64
- pageOf: (page, total) => `Page ${page} of ${total}`,
65
- previous: "Previous",
66
- next: "Next",
67
- search: "Search",
68
- searchProduct: (productName) => `Search ${productName}`,
69
- keyboardShortcut: (shortcut) => `Keyboard shortcut: ${shortcut}`,
70
- commandKey: "Command",
71
- controlKey: "Control",
72
- searching: "Searching\u2026",
73
- searchFailed: "Search failed. Try again.",
74
- noResultsFor: (query) => `No results for \u201C${query}\u201D`,
75
- typeToSearch: "Type to search",
76
- switchOrganization: (name) => `${name}, switch organization`,
77
- organizations: "Organizations",
78
- switchToLightTheme: "Switch to light theme",
79
- switchToDarkTheme: "Switch to dark theme",
80
- glass: "Glass",
81
- glassClear: "Clear",
82
- glassBalanced: "Balanced",
83
- glassTinted: "Tinted",
84
- glassSolid: "Solid",
85
- accountMenu: (name) => `Account: ${name}`,
86
- manageAccount: "Manage your Nexub Account",
87
- privacyPolicy: "Privacy policy",
88
- termsOfService: "Terms of service",
89
- signOut: "Sign out",
90
- signingOut: "Signing out\u2026",
91
- accountAndApps: "Account and apps"
92
- };
93
- var NexubContext = React.createContext({
94
- locale: void 0,
95
- dir: "ltr",
96
- dateLocale: void 0,
97
- messages: defaultMessages
98
- });
99
- var RTL_LANGUAGES = /* @__PURE__ */ new Set(["ar", "he", "fa", "ur"]);
100
- function directionOf(locale) {
101
- return RTL_LANGUAGES.has(locale.toLowerCase().split(/[-_]/)[0]) ? "rtl" : "ltr";
102
- }
103
- function NexubProvider({ locale = "en", dir, dateLocale, messages, children }) {
104
- const resolvedDir = dir ?? directionOf(locale);
105
- const value = React.useMemo(
106
- () => ({ locale, dir: resolvedDir, dateLocale, messages: { ...defaultMessages, ...messages } }),
107
- [locale, resolvedDir, dateLocale, messages]
108
- );
109
- return /* @__PURE__ */ jsx(NexubContext.Provider, { value, children: /* @__PURE__ */ jsx(DirectionProvider, { dir: resolvedDir, children }) });
110
- }
111
- function useNexubMessages() {
112
- return React.useContext(NexubContext).messages;
113
- }
114
- function useLocale() {
115
- const { locale = "en", dir, dateLocale } = React.useContext(NexubContext);
116
- return { locale, dir, dateLocale };
117
- }
118
- function useIntlLocale(explicit) {
119
- const ctx = React.useContext(NexubContext).locale;
120
- return explicit ?? ctx;
121
- }
122
-
123
- export {
124
- defaultMessages,
125
- NexubProvider,
126
- useNexubMessages,
127
- useLocale,
128
- useIntlLocale
129
- };
@@ -1,44 +0,0 @@
1
- 'use client';
2
-
3
- // src/utils/money.ts
4
- function moneyFormatter(currency, locale, options = {}) {
5
- return new Intl.NumberFormat(locale, { style: "currency", currency, currencyDisplay: "narrowSymbol", ...options });
6
- }
7
- function fractionDigits(currency, locale) {
8
- return moneyFormatter(currency, locale).resolvedOptions().maximumFractionDigits ?? 2;
9
- }
10
- function currencySymbol(currency, locale) {
11
- return moneyFormatter(currency, locale).formatToParts(0).find((p) => p.type === "currency")?.value ?? currency;
12
- }
13
- function formatForEditing(value, currency, locale) {
14
- return new Intl.NumberFormat(locale, {
15
- useGrouping: false,
16
- maximumFractionDigits: fractionDigits(currency, locale)
17
- }).format(value);
18
- }
19
- function formatForDisplay(value, currency, locale) {
20
- const digits = fractionDigits(currency, locale);
21
- return new Intl.NumberFormat(locale, { minimumFractionDigits: digits, maximumFractionDigits: digits }).format(value);
22
- }
23
- function parseMoney(text, currency, locale) {
24
- const decimal = new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
25
- const group = new Intl.NumberFormat(locale).formatToParts(1e4).find((p) => p.type === "group")?.value;
26
- let s = text.trim().replace(/[\s\u00a0\u202f]/g, "");
27
- if (group && group !== decimal) s = s.split(group).join("");
28
- s = s.replace(decimal, ".").replace(/[−–]/g, "-").replace(/[^0-9.-]/g, "");
29
- const negative = s.startsWith("-");
30
- s = s.replace(/-/g, "");
31
- if (!/\d/.test(s) || (s.match(/\./g) ?? []).length > 1) return null;
32
- const n = Number(s);
33
- if (!Number.isFinite(n)) return null;
34
- const f = 10 ** fractionDigits(currency, locale);
35
- return (negative ? -1 : 1) * (Math.round(n * f) / f);
36
- }
37
-
38
- export {
39
- moneyFormatter,
40
- currencySymbol,
41
- formatForEditing,
42
- formatForDisplay,
43
- parseMoney
44
- };
@@ -1,308 +0,0 @@
1
- 'use client';
2
-
3
- // src/components/Motion/Fade.tsx
4
- import * as React2 from "react";
5
-
6
- // src/components/Motion/useMotion.ts
7
- import * as React from "react";
8
- var DURATION_MS = {
9
- instant: 0,
10
- fast: 150,
11
- normal: 200,
12
- slow: 300,
13
- slower: 500
14
- };
15
- var FALLBACK_MARGIN_MS = 50;
16
- function useMotion({
17
- visible,
18
- duration = "normal",
19
- easing = "out",
20
- unmountOnExit = false
21
- }) {
22
- const [phase, setPhase] = React.useState(
23
- visible ? "entered" : "exited"
24
- );
25
- const rafRef = React.useRef(null);
26
- const isMounted = React.useRef(true);
27
- React.useEffect(() => {
28
- isMounted.current = true;
29
- return () => {
30
- isMounted.current = false;
31
- if (rafRef.current !== null) cancelAnimationFrame(rafRef.current);
32
- };
33
- }, []);
34
- const prevVisible = React.useRef(visible);
35
- React.useEffect(() => {
36
- if (prevVisible.current === visible) return;
37
- prevVisible.current = visible;
38
- if (visible) {
39
- setPhase("entering");
40
- rafRef.current = requestAnimationFrame(() => {
41
- rafRef.current = requestAnimationFrame(() => {
42
- if (isMounted.current) setPhase("entered");
43
- });
44
- });
45
- } else {
46
- setPhase("exiting");
47
- }
48
- }, [visible]);
49
- React.useEffect(() => {
50
- if (phase !== "exiting") return;
51
- const t = setTimeout(() => setPhase("exited"), DURATION_MS[duration] + FALLBACK_MARGIN_MS);
52
- return () => clearTimeout(t);
53
- }, [phase, duration]);
54
- const handleTransitionEnd = React.useCallback((e) => {
55
- if (!isMounted.current) return;
56
- if (e && e.target !== e.currentTarget) return;
57
- setPhase((prev) => prev === "exiting" ? "exited" : prev);
58
- }, []);
59
- const mounted = unmountOnExit ? phase !== "exited" : true;
60
- const transitionStyle = {
61
- transitionDuration: `var(--duration-${duration})`,
62
- transitionTimingFunction: `var(--ease-${easing})`,
63
- transitionProperty: "opacity, transform"
64
- };
65
- return { phase, mounted, transitionStyle, handleTransitionEnd };
66
- }
67
-
68
- // src/components/Motion/Fade.tsx
69
- import { jsx } from "react/jsx-runtime";
70
- var Fade = React2.forwardRef(function Fade2({
71
- in: visible,
72
- duration = "normal",
73
- easing = "out",
74
- unmountOnExit = false,
75
- children,
76
- style,
77
- as: Tag = "div",
78
- ...rest
79
- }, ref) {
80
- const { phase, mounted, transitionStyle, handleTransitionEnd } = useMotion({
81
- visible,
82
- duration,
83
- easing,
84
- unmountOnExit
85
- });
86
- if (!mounted) return null;
87
- const opacity = phase === "entered" ? 1 : 0;
88
- return /* @__PURE__ */ jsx(
89
- Tag,
90
- {
91
- ref,
92
- onTransitionEnd: handleTransitionEnd,
93
- style: {
94
- opacity,
95
- willChange: "opacity",
96
- ...transitionStyle,
97
- ...style
98
- },
99
- ...rest,
100
- children
101
- }
102
- );
103
- });
104
- Fade.displayName = "Fade";
105
-
106
- // src/components/Motion/Slide.tsx
107
- import * as React3 from "react";
108
- import { jsx as jsx2 } from "react/jsx-runtime";
109
- var directionTransform = {
110
- up: { from: "translateY(12px)", to: "translateY(0)" },
111
- down: { from: "translateY(-12px)", to: "translateY(0)" },
112
- left: { from: "translateX(12px)", to: "translateX(0)" },
113
- right: { from: "translateX(-12px)", to: "translateX(0)" }
114
- };
115
- var Slide = React3.forwardRef(function Slide2({
116
- in: visible,
117
- duration = "normal",
118
- easing = "out",
119
- unmountOnExit = false,
120
- direction = "up",
121
- distance,
122
- children,
123
- style,
124
- as: Tag = "div",
125
- ...rest
126
- }, ref) {
127
- const { phase, mounted, transitionStyle, handleTransitionEnd } = useMotion({
128
- visible,
129
- duration,
130
- easing,
131
- unmountOnExit
132
- });
133
- if (!mounted) return null;
134
- const isEntered = phase === "entered";
135
- const dt = directionTransform[direction];
136
- let fromTransform = dt.from;
137
- if (distance) {
138
- if (direction === "up") fromTransform = `translateY(${distance})`;
139
- if (direction === "down") fromTransform = `translateY(-${distance})`;
140
- if (direction === "left") fromTransform = `translateX(${distance})`;
141
- if (direction === "right") fromTransform = `translateX(-${distance})`;
142
- }
143
- return /* @__PURE__ */ jsx2(
144
- Tag,
145
- {
146
- ref,
147
- onTransitionEnd: handleTransitionEnd,
148
- style: {
149
- opacity: isEntered ? 1 : 0,
150
- transform: isEntered ? dt.to : fromTransform,
151
- willChange: "opacity, transform",
152
- ...transitionStyle,
153
- ...style
154
- },
155
- ...rest,
156
- children
157
- }
158
- );
159
- });
160
- Slide.displayName = "Slide";
161
-
162
- // src/components/Motion/Scale.tsx
163
- import * as React4 from "react";
164
- import { jsx as jsx3 } from "react/jsx-runtime";
165
- var Scale = React4.forwardRef(function Scale2({
166
- in: visible,
167
- duration = "fast",
168
- easing = "out-expo",
169
- unmountOnExit = false,
170
- initialScale = 0.95,
171
- children,
172
- style,
173
- as: Tag = "div",
174
- ...rest
175
- }, ref) {
176
- const { phase, mounted, transitionStyle, handleTransitionEnd } = useMotion({
177
- visible,
178
- duration,
179
- easing,
180
- unmountOnExit
181
- });
182
- if (!mounted) return null;
183
- const isEntered = phase === "entered";
184
- return /* @__PURE__ */ jsx3(
185
- Tag,
186
- {
187
- ref,
188
- onTransitionEnd: handleTransitionEnd,
189
- style: {
190
- opacity: isEntered ? 1 : 0,
191
- transform: isEntered ? "scale(1)" : `scale(${initialScale})`,
192
- transformOrigin: "top center",
193
- willChange: "opacity, transform",
194
- ...transitionStyle,
195
- ...style
196
- },
197
- ...rest,
198
- children
199
- }
200
- );
201
- });
202
- Scale.displayName = "Scale";
203
-
204
- // src/components/Motion/Collapse.tsx
205
- import * as React5 from "react";
206
- import { jsx as jsx4 } from "react/jsx-runtime";
207
- var Collapse = React5.forwardRef(function Collapse2({
208
- in: visible,
209
- duration = "normal",
210
- easing = "out",
211
- unmountOnExit = false,
212
- collapsedHeight = 0,
213
- children,
214
- style,
215
- as: Tag = "div",
216
- ...rest
217
- }, ref) {
218
- const innerRef = React5.useRef(null);
219
- const [height, setHeight] = React5.useState(visible ? "auto" : 0);
220
- const [overflow, setOverflow] = React5.useState(
221
- visible ? "visible" : "hidden"
222
- );
223
- const [mounted, setMounted] = React5.useState(unmountOnExit ? visible : true);
224
- const prevVisible = React5.useRef(visible);
225
- React5.useEffect(() => {
226
- const changed = prevVisible.current !== visible;
227
- prevVisible.current = visible;
228
- if (!changed) return;
229
- let raf1 = 0;
230
- let raf2 = 0;
231
- if (visible) {
232
- setMounted(true);
233
- raf1 = requestAnimationFrame(() => {
234
- const el = innerRef.current;
235
- if (el) {
236
- setHeight(el.scrollHeight);
237
- setOverflow("hidden");
238
- }
239
- });
240
- } else {
241
- const el = innerRef.current;
242
- if (el) {
243
- setHeight(el.scrollHeight);
244
- setOverflow("hidden");
245
- raf1 = requestAnimationFrame(() => {
246
- raf2 = requestAnimationFrame(() => {
247
- setHeight(typeof collapsedHeight === "number" ? collapsedHeight : 0);
248
- });
249
- });
250
- }
251
- }
252
- return () => {
253
- cancelAnimationFrame(raf1);
254
- cancelAnimationFrame(raf2);
255
- };
256
- }, [visible, collapsedHeight]);
257
- const finish = React5.useCallback(() => {
258
- if (visible) {
259
- setHeight("auto");
260
- setOverflow("visible");
261
- } else if (unmountOnExit) {
262
- setMounted(false);
263
- }
264
- }, [visible, unmountOnExit]);
265
- const handleTransitionEnd = React5.useCallback(
266
- (e) => {
267
- if (e.target !== e.currentTarget || e.propertyName !== "max-height") return;
268
- finish();
269
- },
270
- [finish]
271
- );
272
- const firstRender = React5.useRef(true);
273
- React5.useEffect(() => {
274
- if (firstRender.current) {
275
- firstRender.current = false;
276
- return;
277
- }
278
- const t = setTimeout(finish, DURATION_MS[duration] + 100);
279
- return () => clearTimeout(t);
280
- }, [visible, duration, finish]);
281
- if (!mounted) return null;
282
- const maxHeight = height === "auto" ? "none" : `${height}px`;
283
- return /* @__PURE__ */ jsx4(
284
- Tag,
285
- {
286
- ref,
287
- style: {
288
- maxHeight,
289
- overflow,
290
- transitionProperty: "max-height",
291
- transitionDuration: `var(--duration-${duration})`,
292
- transitionTimingFunction: `var(--ease-${easing})`,
293
- ...style
294
- },
295
- onTransitionEnd: handleTransitionEnd,
296
- ...rest,
297
- children: /* @__PURE__ */ jsx4("div", { ref: innerRef, children })
298
- }
299
- );
300
- });
301
- Collapse.displayName = "Collapse";
302
-
303
- export {
304
- Fade,
305
- Slide,
306
- Scale,
307
- Collapse
308
- };
@@ -1,13 +1,13 @@
1
1
  'use client';
2
2
  import {
3
- FormError
4
- } from "./chunk-QVTVDL6Y.js";
3
+ HelperText
4
+ } from "./chunk-ZLW7IBXK.js";
5
5
  import {
6
6
  Label
7
7
  } from "./chunk-PGD246WD.js";
8
8
  import {
9
- HelperText
10
- } from "./chunk-ZLW7IBXK.js";
9
+ FormError
10
+ } from "./chunk-QVTVDL6Y.js";
11
11
  import {
12
12
  cn
13
13
  } from "./chunk-Q7G5WGYV.js";