@nicorp/nui 0.7.0 → 0.9.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/dist/index.cjs.js +10 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +127 -8
- package/dist/index.es.js +4986 -4666
- package/dist/index.es.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
|
|
|
17
17
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
18
18
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
19
19
|
import { Legend } from 'recharts';
|
|
20
|
+
import { LucideIcon } from 'lucide-react';
|
|
20
21
|
import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu';
|
|
21
22
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
22
23
|
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
@@ -218,6 +219,28 @@ export declare const ChartLegend: typeof Legend;
|
|
|
218
219
|
|
|
219
220
|
export declare const ChartTooltip: typeof Tooltip_2;
|
|
220
221
|
|
|
222
|
+
export declare const ChatActionCard: React_2.ForwardRefExoticComponent<ChatActionCardProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
223
|
+
|
|
224
|
+
export declare interface ChatActionCardProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
225
|
+
/** Card variant/type */
|
|
226
|
+
type?: "success" | "info" | "warning";
|
|
227
|
+
/** Main title text */
|
|
228
|
+
title: string;
|
|
229
|
+
/** Subtitle or description */
|
|
230
|
+
description?: string;
|
|
231
|
+
/** Custom icon (overrides type icon) */
|
|
232
|
+
icon?: LucideIcon;
|
|
233
|
+
/** Action button config */
|
|
234
|
+
action?: {
|
|
235
|
+
label: string;
|
|
236
|
+
onClick: () => void;
|
|
237
|
+
};
|
|
238
|
+
/** Allow card dismissal */
|
|
239
|
+
dismissible?: boolean;
|
|
240
|
+
/** Called when card is dismissed */
|
|
241
|
+
onDismiss?: () => void;
|
|
242
|
+
}
|
|
243
|
+
|
|
221
244
|
export declare const ChatBubble: React_2.ForwardRefExoticComponent<ChatBubbleProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
222
245
|
|
|
223
246
|
export declare const ChatBubbleActions: React_2.ForwardRefExoticComponent<ChatBubbleActionsProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
@@ -257,6 +280,27 @@ export declare const ChatContainer: React_2.ForwardRefExoticComponent<ChatContai
|
|
|
257
280
|
export declare interface ChatContainerProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
258
281
|
}
|
|
259
282
|
|
|
283
|
+
export declare const ChatEntityPreview: React_2.ForwardRefExoticComponent<ChatEntityPreviewProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
284
|
+
|
|
285
|
+
export declare interface ChatEntityPreviewProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
286
|
+
/** Entity type */
|
|
287
|
+
type: "task" | "project" | "file" | "custom";
|
|
288
|
+
/** Entity title */
|
|
289
|
+
title: string;
|
|
290
|
+
/** Entity ID or badge text */
|
|
291
|
+
id?: string;
|
|
292
|
+
/** Status text */
|
|
293
|
+
status?: string;
|
|
294
|
+
/** Key-value properties to display */
|
|
295
|
+
properties?: Record<string, string>;
|
|
296
|
+
/** Link URL */
|
|
297
|
+
link?: string;
|
|
298
|
+
/** Custom icon (overrides type icon) */
|
|
299
|
+
icon?: LucideIcon;
|
|
300
|
+
/** Called when card is clicked (if link is not provided) */
|
|
301
|
+
onNavigate?: () => void;
|
|
302
|
+
}
|
|
303
|
+
|
|
260
304
|
export declare const ChatFollowUp: React_2.ForwardRefExoticComponent<ChatFollowUpProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
261
305
|
|
|
262
306
|
export declare interface ChatFollowUpProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'onSelect'> {
|
|
@@ -418,6 +462,35 @@ export declare interface ChatModeSelectorProps extends Omit<React_2.HTMLAttribut
|
|
|
418
462
|
size?: "sm" | "default";
|
|
419
463
|
}
|
|
420
464
|
|
|
465
|
+
export declare const ChatQuestion: React_2.ForwardRefExoticComponent<ChatQuestionProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
466
|
+
|
|
467
|
+
export declare interface ChatQuestionOption {
|
|
468
|
+
id: string;
|
|
469
|
+
label: string;
|
|
470
|
+
description?: string;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
export declare interface ChatQuestionProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'onSelect'> {
|
|
474
|
+
/** Unique identifier for this question widget */
|
|
475
|
+
id?: string;
|
|
476
|
+
/** The question text */
|
|
477
|
+
question: string;
|
|
478
|
+
/** Answer options to display */
|
|
479
|
+
options: ChatQuestionOption[];
|
|
480
|
+
/** Called when user picks an option */
|
|
481
|
+
onSelect?: (optionId: string, label: string) => void;
|
|
482
|
+
/** ID of the currently selected option (for persistence) */
|
|
483
|
+
selectedId?: string;
|
|
484
|
+
/** Disable interaction (shows selection but prevents changes) */
|
|
485
|
+
disabled?: boolean;
|
|
486
|
+
/** Allow user to type a custom answer @default false */
|
|
487
|
+
allowFreeText?: boolean;
|
|
488
|
+
/** Called when user submits free-text answer */
|
|
489
|
+
onFreeTextSubmit?: (text: string) => void;
|
|
490
|
+
/** Grid columns for options @default 1 */
|
|
491
|
+
columns?: 1 | 2;
|
|
492
|
+
}
|
|
493
|
+
|
|
421
494
|
export declare const ChatToolCall: React_2.ForwardRefExoticComponent<ChatToolCallProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
422
495
|
|
|
423
496
|
export declare interface ChatToolCallProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
@@ -910,6 +983,11 @@ export declare interface MessageActionsProps extends React_2.HTMLAttributes<HTML
|
|
|
910
983
|
|
|
911
984
|
export declare type MessageActionType = "copy" | "retry" | "edit" | "like" | "dislike" | "share";
|
|
912
985
|
|
|
986
|
+
/** Recursive JSON dictionary — values are strings or nested objects. */
|
|
987
|
+
export declare type MessageDictionary = {
|
|
988
|
+
[key: string]: string | MessageDictionary;
|
|
989
|
+
};
|
|
990
|
+
|
|
913
991
|
export declare function MetricCard({ title, value, description, trend, trendLabel, icon, className, ...props }: MetricCardProps): JSX_2.Element;
|
|
914
992
|
|
|
915
993
|
declare interface MetricCardProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
@@ -1394,6 +1472,9 @@ export declare const textVariants: (props?: ({
|
|
|
1394
1472
|
leading?: "normal" | "tight" | "relaxed" | null | undefined;
|
|
1395
1473
|
} & ClassProp) | undefined) => string;
|
|
1396
1474
|
|
|
1475
|
+
/** Translation function returned by `useLocale()`. */
|
|
1476
|
+
export declare type TFunction = (key: string, vars?: Record<string, string | number>) => string;
|
|
1477
|
+
|
|
1397
1478
|
export declare type Theme = "dark" | "light" | "system";
|
|
1398
1479
|
|
|
1399
1480
|
export declare function ThemeProvider({ children, defaultTheme, storageKey, attribute, enableSystem, disableTransitionOnChange, forcedTheme, nonce, }: ThemeProviderProps): JSX_2.Element;
|
|
@@ -1493,46 +1574,84 @@ export declare const TooltipTrigger: React_2.ForwardRefExoticComponent<TooltipPr
|
|
|
1493
1574
|
*
|
|
1494
1575
|
* @example
|
|
1495
1576
|
* ```ts
|
|
1496
|
-
*
|
|
1577
|
+
* tpl("Calling {name}...", { name: "search" })
|
|
1497
1578
|
* // → "Calling search..."
|
|
1498
1579
|
* ```
|
|
1499
1580
|
*/
|
|
1500
1581
|
export declare function tpl(template: string, vars: Record<string, string | number>): string;
|
|
1501
1582
|
|
|
1502
1583
|
/**
|
|
1503
|
-
* Provides
|
|
1584
|
+
* Provides i18n for both NUI components **and** your own app strings.
|
|
1504
1585
|
*
|
|
1505
|
-
* @example
|
|
1586
|
+
* @example NUI-only (component translations)
|
|
1506
1587
|
* ```tsx
|
|
1507
1588
|
* <TranslateProvider locale="ru">
|
|
1508
1589
|
* <App />
|
|
1509
1590
|
* </TranslateProvider>
|
|
1510
1591
|
* ```
|
|
1511
1592
|
*
|
|
1512
|
-
* @example
|
|
1593
|
+
* @example With user JSON dictionaries
|
|
1513
1594
|
* ```tsx
|
|
1514
|
-
*
|
|
1595
|
+
* import en from "./locales/en.json"
|
|
1596
|
+
* import ru from "./locales/ru.json"
|
|
1597
|
+
*
|
|
1598
|
+
* <TranslateProvider locale="ru" messages={{ en, ru }}>
|
|
1515
1599
|
* <App />
|
|
1516
1600
|
* </TranslateProvider>
|
|
1517
1601
|
* ```
|
|
1518
1602
|
*/
|
|
1519
|
-
declare function TranslateProvider({ locale, children }: TranslateProviderProps): JSX_2.Element;
|
|
1603
|
+
declare function TranslateProvider({ locale, messages, children }: TranslateProviderProps): JSX_2.Element;
|
|
1520
1604
|
export { TranslateProvider as NUIProvider }
|
|
1521
1605
|
export { TranslateProvider }
|
|
1522
1606
|
|
|
1523
1607
|
export declare interface TranslateProviderProps {
|
|
1524
|
-
/** Built-in locale key ("en" | "ru") or a custom (partial) locale dictionary.
|
|
1608
|
+
/** Built-in locale key ("en" | "ru") or a custom (partial) NUI locale dictionary.
|
|
1525
1609
|
* Missing keys fall back to English. */
|
|
1526
1610
|
locale?: "en" | "ru" | (string & {}) | Partial<NUILocale>;
|
|
1611
|
+
/**
|
|
1612
|
+
* User JSON dictionaries for app-level translations.
|
|
1613
|
+
*
|
|
1614
|
+
* @example
|
|
1615
|
+
* ```tsx
|
|
1616
|
+
* import en from "./locales/en.json"
|
|
1617
|
+
* import ru from "./locales/ru.json"
|
|
1618
|
+
*
|
|
1619
|
+
* <TranslateProvider locale="ru" messages={{ en, ru }}>
|
|
1620
|
+
* <App />
|
|
1621
|
+
* </TranslateProvider>
|
|
1622
|
+
* ```
|
|
1623
|
+
*/
|
|
1624
|
+
messages?: Record<string, MessageDictionary>;
|
|
1527
1625
|
children: React_2.ReactNode;
|
|
1528
1626
|
}
|
|
1529
1627
|
|
|
1530
1628
|
declare type UseCarouselParameters = Parameters<typeof default_2>;
|
|
1531
1629
|
|
|
1630
|
+
/**
|
|
1631
|
+
* Returns `{ t, lang }` for translating your own app strings.
|
|
1632
|
+
*
|
|
1633
|
+
* `t("profile.save")` resolves dot-paths in your JSON dictionaries.
|
|
1634
|
+
* Variables: `t("greeting", { name: "Alex" })` → replaces `{name}`.
|
|
1635
|
+
*
|
|
1636
|
+
* Fallback chain: **active lang → "en" → raw key**.
|
|
1637
|
+
*
|
|
1638
|
+
* @example
|
|
1639
|
+
* ```tsx
|
|
1640
|
+
* function MyButton() {
|
|
1641
|
+
* const { t } = useLocale()
|
|
1642
|
+
* return <button>{t("profile.save")}</button>
|
|
1643
|
+
* }
|
|
1644
|
+
* ```
|
|
1645
|
+
*/
|
|
1646
|
+
export declare function useLocale(): {
|
|
1647
|
+
t: TFunction;
|
|
1648
|
+
lang: string;
|
|
1649
|
+
};
|
|
1650
|
+
|
|
1532
1651
|
export declare function useTheme(): ThemeProviderState;
|
|
1533
1652
|
|
|
1534
1653
|
/**
|
|
1535
|
-
* Returns the current NUI locale dictionary.
|
|
1654
|
+
* Returns the current NUI locale dictionary (built-in component strings).
|
|
1536
1655
|
* Falls back to English when used outside a `<TranslateProvider>`.
|
|
1537
1656
|
*/
|
|
1538
1657
|
declare function useTranslate(): NUILocale;
|