@nexub/react 1.5.1 → 1.7.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/chunk-24ZFAXB2.js +101 -0
- package/dist/{chunk-XR4NBY54.js → chunk-2DYKENBM.js} +10 -10
- package/dist/{chunk-SVQCINRE.js → chunk-2I7FIU6R.js} +5 -2
- package/dist/{chunk-S46W2QER.js → chunk-37L5ERUJ.js} +17 -11
- package/dist/{chunk-CWS37T3K.js → chunk-3E7X3YK3.js} +4 -2
- package/dist/{chunk-EZ23IA3H.js → chunk-3LTB6TGN.js} +4 -4
- package/dist/chunk-3QD76BKT.js +80 -0
- package/dist/{chunk-PQ6GU7SG.js → chunk-4HQFOIZW.js} +20 -14
- package/dist/{chunk-RLE5RN3T.js → chunk-4NFUBFYK.js} +15 -11
- package/dist/{chunk-B54WADL4.js → chunk-4P2JJ2FH.js} +12 -12
- package/dist/{chunk-I4BHRVRL.js → chunk-4UBVU53C.js} +9 -5
- package/dist/chunk-52ZVJPF7.js +1 -0
- package/dist/chunk-5QEARXY3.js +55 -0
- package/dist/chunk-643EYCLL.js +54 -0
- package/dist/{chunk-CNNJFWFA.js → chunk-6BGUZQAX.js} +4 -4
- package/dist/{chunk-LDYD7WL3.js → chunk-6ECOCGZG.js} +4 -3
- package/dist/{chunk-3AXIMXDU.js → chunk-6JBQAJJD.js} +6 -12
- package/dist/{chunk-YRDCY6BI.js → chunk-6UKNUI46.js} +0 -19
- package/dist/chunk-77LYWSJW.js +85 -0
- package/dist/{chunk-NCRFKPA4.js → chunk-7MSIOYJZ.js} +6 -8
- package/dist/{chunk-GIGOTRXX.js → chunk-7VJABRKB.js} +3 -10
- package/dist/{chunk-6QLLH6ID.js → chunk-7XWJCFWI.js} +8 -17
- package/dist/chunk-A3O23F2B.js +1 -0
- package/dist/chunk-AGYGWU6C.js +88 -0
- package/dist/chunk-AT2DSFP3.js +47 -0
- package/dist/{chunk-IIPYF6ZQ.js → chunk-B254JXS7.js} +16 -13
- package/dist/{chunk-GRB6T2TT.js → chunk-BSL62LBX.js} +19 -13
- package/dist/{chunk-GHCV6UXG.js → chunk-BTYDDKRQ.js} +5 -5
- package/dist/chunk-C6JRJ6JW.js +167 -0
- package/dist/chunk-CAOLGXA5.js +1 -0
- package/dist/{chunk-OJ2TLWYD.js → chunk-CKFRMCZ7.js} +5 -3
- package/dist/{chunk-LZB3KTSH.js → chunk-CQWYZPPJ.js} +1 -1
- package/dist/{chunk-6RBNM5RO.js → chunk-CUOASXI7.js} +10 -10
- package/dist/{chunk-HG6HTUWU.js → chunk-CV5ZKED7.js} +2 -2
- package/dist/{chunk-HJERFB7J.js → chunk-DDRYT3SY.js} +2 -2
- package/dist/chunk-DGCAM2UJ.js +60 -0
- package/dist/{chunk-FD7YU53N.js → chunk-DT3QGFXB.js} +4 -4
- package/dist/chunk-F73DTG2V.js +123 -0
- package/dist/{chunk-Z3IG5WRA.js → chunk-FJUVYRNT.js} +3 -3
- package/dist/{chunk-KQPLFVFR.js → chunk-FLZD7HQY.js} +0 -2
- package/dist/chunk-GG54WBLA.js +134 -0
- package/dist/{chunk-64JDZWCV.js → chunk-GRKCUQG4.js} +6 -5
- package/dist/{chunk-YPHNHQYQ.js → chunk-GWDEKW7P.js} +6 -2
- package/dist/{chunk-4I5ULCYG.js → chunk-HFTS5AN7.js} +3 -3
- package/dist/{chunk-GUB7YKG2.js → chunk-I4U36P54.js} +6 -3
- package/dist/{chunk-BTRTORKU.js → chunk-I6CAF7C5.js} +6 -7
- package/dist/{chunk-TJCHA3OI.js → chunk-J65MK3N4.js} +7 -4
- package/dist/{chunk-IK23Q2OF.js → chunk-JHVYI5GK.js} +3 -3
- package/dist/{chunk-J6TU45KP.js → chunk-JSBNYRO4.js} +26 -12
- package/dist/chunk-K5FKEAAK.js +94 -0
- package/dist/{chunk-5URGARPH.js → chunk-KE4YVG5Q.js} +6 -10
- package/dist/{chunk-QCNLE27O.js → chunk-KRCLK5O4.js} +11 -7
- package/dist/{chunk-A4IMFAZX.js → chunk-LESI7J7B.js} +3 -3
- package/dist/chunk-MLT7SA3T.js +171 -0
- package/dist/chunk-MNEXMMLM.js +23 -0
- package/dist/{chunk-PVTACENM.js → chunk-MTK3GHDQ.js} +2 -2
- package/dist/chunk-MYP5ZTC3.js +169 -0
- package/dist/chunk-NA5UMOE5.js +55 -0
- package/dist/chunk-NAJKIBU2.js +163 -0
- package/dist/{chunk-WESZPFBZ.js → chunk-NERAWEIQ.js} +7 -4
- package/dist/{chunk-YJ3JQYAN.js → chunk-NGQKBDHA.js} +5 -13
- package/dist/{chunk-7Q7ZF6BY.js → chunk-NNIFOMIH.js} +18 -8
- package/dist/{chunk-7L3CGIRA.js → chunk-NQPGELMP.js} +8 -19
- package/dist/{chunk-5O34ZNC3.js → chunk-NYWD5SI4.js} +19 -13
- package/dist/chunk-NZR4UGUZ.js +143 -0
- package/dist/{chunk-6J3QTWKC.js → chunk-NZT4TTNV.js} +18 -9
- package/dist/{chunk-JSD3H7WV.js → chunk-OYCK6BRG.js} +6 -6
- package/dist/{chunk-2555JXCP.js → chunk-PBPUSRTJ.js} +19 -11
- package/dist/{chunk-QD7H3WV3.js → chunk-PGDXFBKT.js} +8 -8
- package/dist/{chunk-NIX4SEKM.js → chunk-PREMZMLU.js} +7 -4
- package/dist/{chunk-4SSUM4CL.js → chunk-QUNH4BFR.js} +9 -6
- package/dist/{chunk-FHFVBOF3.js → chunk-QUYOV2ZJ.js} +6 -4
- package/dist/{chunk-KM6Z3VTI.js → chunk-QVTVDL6Y.js} +1 -1
- package/dist/{chunk-XI63BK3S.js → chunk-RATKKN3F.js} +3 -3
- package/dist/chunk-RM7MTOT5.js +339 -0
- package/dist/{chunk-DJZZ3FIP.js → chunk-RUR57JZQ.js} +5 -14
- package/dist/{chunk-ZV3AF5CL.js → chunk-S2CTBFLN.js} +13 -2
- package/dist/{chunk-72I7EVOL.js → chunk-SYZADSLI.js} +10 -6
- package/dist/{chunk-W2NEXOTG.js → chunk-T7RLPFGX.js} +2 -2
- package/dist/chunk-TAVVXXGO.js +131 -0
- package/dist/{chunk-BFRX6X4O.js → chunk-TZ6KJIR4.js} +23 -17
- package/dist/{chunk-V3TETH4J.js → chunk-U2ZYPPRG.js} +17 -16
- package/dist/{chunk-AHT35UWY.js → chunk-UTLKZPKJ.js} +10 -6
- package/dist/{chunk-OJRSPDNJ.js → chunk-VD4RFTNV.js} +8 -14
- package/dist/chunk-VLQGQFW7.js +110 -0
- package/dist/{chunk-RTDUTWJ4.js → chunk-VMT7Y3AT.js} +5 -8
- package/dist/{chunk-AXOKFS4K.js → chunk-W3KO3JNZ.js} +20 -4
- package/dist/{chunk-LGQ737BP.js → chunk-WHTLXQB6.js} +1 -1
- package/dist/chunk-WLRRMT6W.js +1 -0
- package/dist/{chunk-2FCSWBSM.js → chunk-WMWX6DPB.js} +3 -3
- package/dist/{chunk-UMC64NCT.js → chunk-WVBGQCYC.js} +6 -3
- package/dist/{chunk-TEOLG3N2.js → chunk-X4BQHXLB.js} +10 -6
- package/dist/{chunk-SY6V3HAK.js → chunk-XDU27NRX.js} +3 -3
- package/dist/{chunk-KA2J5OBA.js → chunk-XQDD76EF.js} +4 -7
- package/dist/chunk-XTATJMY6.js +64 -0
- package/dist/chunk-XYXMPHND.js +1 -0
- package/dist/{chunk-7ZWBHHRK.js → chunk-YNU6VRD5.js} +23 -32
- package/dist/{chunk-6SJPVQQW.js → chunk-Z3HF6XJ3.js} +1 -1
- package/dist/{chunk-I4URNMI7.js → chunk-ZC4MZAEX.js} +9 -7
- package/dist/{chunk-PWBPHGM3.js → chunk-ZCEUVK2R.js} +2 -2
- package/dist/{chunk-NQVRF4RB.js → chunk-ZMJ54TG6.js} +16 -13
- package/dist/chunk-ZT3NWE5U.js +1 -0
- package/dist/{chunk-RHOYF7MO.js → chunk-ZTLALVWA.js} +6 -15
- package/dist/components/Accordion/index.js +1 -1
- package/dist/components/Alert/index.js +2 -1
- package/dist/components/AlertDialog/index.js +3 -3
- package/dist/components/Amount/index.js +3 -1
- package/dist/components/AspectRatio/index.js +1 -1
- package/dist/components/Autocomplete/index.js +3 -2
- package/dist/components/Avatar/index.js +1 -1
- package/dist/components/AvatarGroup/index.js +3 -2
- package/dist/components/Badge/index.js +1 -1
- package/dist/components/Banner/index.js +2 -1
- package/dist/components/Breadcrumb/index.js +2 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/ButtonGroup/index.js +1 -1
- package/dist/components/Callout/index.js +1 -1
- package/dist/components/Card/index.js +3 -1
- package/dist/components/CheckList/index.js +1 -1
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/CheckboxCard/index.js +9 -0
- package/dist/components/Chip/index.js +2 -1
- package/dist/components/Citation/index.js +17 -0
- package/dist/components/Code/index.js +1 -1
- package/dist/components/Combobox/index.js +1 -1
- package/dist/components/CommandPalette/index.js +3 -2
- package/dist/components/ContextMenu/index.js +2 -2
- package/dist/components/CountryBadge/index.js +1 -1
- package/dist/components/DataTable/index.js +2 -1
- package/dist/components/DatePicker/index.js +5 -1
- package/dist/components/DateRangePicker/index.js +5 -1
- package/dist/components/Dialog/index.js +2 -2
- package/dist/components/Drawer/index.js +2 -2
- package/dist/components/DropdownMenu/index.js +2 -2
- package/dist/components/EmptyState/index.js +1 -1
- package/dist/components/ErrorState/index.js +2 -1
- package/dist/components/EyebrowChip/index.js +4 -1
- package/dist/components/FileUpload/index.js +2 -1
- package/dist/components/FilterChip/index.js +3 -1
- package/dist/components/Flex/index.js +2 -1
- package/dist/components/FormError/index.js +1 -1
- package/dist/components/FormField/index.js +7 -4
- package/dist/components/GradientDivider/index.js +1 -1
- package/dist/components/Grid/index.js +2 -1
- package/dist/components/Heading/index.js +4 -1
- package/dist/components/HelperText/index.js +4 -1
- package/dist/components/HoverCard/index.js +3 -2
- package/dist/components/IconButton/index.js +2 -1
- package/dist/components/Input/index.js +1 -1
- package/dist/components/Kbd/index.js +1 -1
- package/dist/components/KeyboardShortcut/index.js +2 -2
- package/dist/components/Label/index.js +4 -1
- package/dist/components/Link/index.js +1 -1
- package/dist/components/Logo/index.js +1 -1
- package/dist/components/MediaCard/index.js +9 -0
- package/dist/components/Menubar/index.js +2 -2
- package/dist/components/MessageBubble/index.js +18 -0
- package/dist/components/MoneyInput/index.js +3 -2
- package/dist/components/NavigationMenu/index.js +2 -2
- package/dist/components/NavigationRail/index.js +2 -1
- package/dist/components/NexubProvider/index.js +14 -0
- package/dist/components/NumberInput/index.js +3 -2
- package/dist/components/NumberTicker/index.js +10 -0
- package/dist/components/PageHeader/index.js +1 -1
- package/dist/components/Pagination/index.js +3 -1
- package/dist/components/PasswordInput/index.js +3 -2
- package/dist/components/Popover/index.js +2 -2
- package/dist/components/Progress/index.js +2 -1
- package/dist/components/PromptInput/index.js +15 -0
- package/dist/components/RadioCard/index.js +11 -0
- package/dist/components/RadioGroup/index.js +1 -1
- package/dist/components/Rating/index.js +2 -1
- package/dist/components/ScrollArea/index.js +1 -1
- package/dist/components/SearchInput/index.js +3 -2
- package/dist/components/Section/index.js +1 -1
- package/dist/components/SegmentedControl/index.js +3 -2
- package/dist/components/Select/index.js +2 -2
- package/dist/components/Separator/index.js +1 -1
- package/dist/components/Sidebar/index.js +2 -1
- package/dist/components/Skeleton/index.js +1 -1
- package/dist/components/Spinner/index.js +2 -1
- package/dist/components/SplitButton/index.js +5 -5
- package/dist/components/Stack/index.js +2 -1
- package/dist/components/StatusPill/index.js +1 -1
- package/dist/components/StreamingText/index.js +8 -0
- package/dist/components/Switch/index.js +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/Tabs/index.js +3 -2
- package/dist/components/Tag/index.js +1 -1
- package/dist/components/Text/index.js +1 -1
- package/dist/components/Textarea/index.js +1 -1
- package/dist/components/ThinkingIndicator/index.js +9 -0
- package/dist/components/Toast/index.js +3 -1
- package/dist/components/Tooltip/index.js +2 -1
- package/dist/components/TopNav/index.js +2 -1
- package/dist/index.d.ts +440 -24
- package/dist/index.js +225 -146
- package/package.json +52 -50
- package/dist/chunk-63DPMUMR.js +0 -67
- package/dist/chunk-CHGPGRML.js +0 -115
- package/dist/chunk-H2W7IYVY.js +0 -155
- package/dist/chunk-J2T4GFFS.js +0 -85
- package/dist/chunk-LH3BSAIS.js +0 -119
- package/dist/chunk-LMPGHWUA.js +0 -114
- package/dist/chunk-NMH5WSZG.js +0 -72
- package/dist/chunk-P44EROBX.js +0 -55
- package/dist/chunk-TYTW4F3B.js +0 -178
|
@@ -0,0 +1,101 @@
|
|
|
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
|
+
};
|
|
65
|
+
var NexubContext = React.createContext({
|
|
66
|
+
locale: void 0,
|
|
67
|
+
dir: "ltr",
|
|
68
|
+
dateLocale: void 0,
|
|
69
|
+
messages: defaultMessages
|
|
70
|
+
});
|
|
71
|
+
var RTL_LANGUAGES = /* @__PURE__ */ new Set(["ar", "he", "fa", "ur"]);
|
|
72
|
+
function directionOf(locale) {
|
|
73
|
+
return RTL_LANGUAGES.has(locale.toLowerCase().split(/[-_]/)[0]) ? "rtl" : "ltr";
|
|
74
|
+
}
|
|
75
|
+
function NexubProvider({ locale = "en", dir, dateLocale, messages, children }) {
|
|
76
|
+
const resolvedDir = dir ?? directionOf(locale);
|
|
77
|
+
const value = React.useMemo(
|
|
78
|
+
() => ({ locale, dir: resolvedDir, dateLocale, messages: { ...defaultMessages, ...messages } }),
|
|
79
|
+
[locale, resolvedDir, dateLocale, messages]
|
|
80
|
+
);
|
|
81
|
+
return /* @__PURE__ */ jsx(NexubContext.Provider, { value, children: /* @__PURE__ */ jsx(DirectionProvider, { dir: resolvedDir, children }) });
|
|
82
|
+
}
|
|
83
|
+
function useNexubMessages() {
|
|
84
|
+
return React.useContext(NexubContext).messages;
|
|
85
|
+
}
|
|
86
|
+
function useLocale() {
|
|
87
|
+
const { locale = "en", dir, dateLocale } = React.useContext(NexubContext);
|
|
88
|
+
return { locale, dir, dateLocale };
|
|
89
|
+
}
|
|
90
|
+
function useIntlLocale(explicit) {
|
|
91
|
+
const ctx = React.useContext(NexubContext).locale;
|
|
92
|
+
return explicit ?? ctx;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export {
|
|
96
|
+
defaultMessages,
|
|
97
|
+
NexubProvider,
|
|
98
|
+
useNexubMessages,
|
|
99
|
+
useLocale,
|
|
100
|
+
useIntlLocale
|
|
101
|
+
};
|
|
@@ -8,19 +8,19 @@ import * as React from "react";
|
|
|
8
8
|
import { cva } from "class-variance-authority";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
var calloutVariants = cva(
|
|
11
|
-
"flex gap-2.5 rounded-
|
|
11
|
+
"flex gap-2.5 rounded-shape-container px-3 py-2.5 text-sm",
|
|
12
12
|
{
|
|
13
13
|
variants: {
|
|
14
14
|
tone: {
|
|
15
|
-
neutral: "bg-[var(--color-
|
|
16
|
-
info: "bg-[var(--color-
|
|
17
|
-
success: "bg-[var(--color-
|
|
18
|
-
warning: "bg-[var(--color-
|
|
19
|
-
danger: "bg-[var(--color-
|
|
20
|
-
leap: "bg-[var(--color-leap-
|
|
21
|
-
bookub: "bg-[var(--color-bookub-
|
|
22
|
-
payub: "bg-[var(--color-payub-
|
|
23
|
-
founderub: "bg-[var(--color-founderub-
|
|
15
|
+
neutral: "bg-[var(--color-surface-container-low)] text-[var(--color-on-surface)]",
|
|
16
|
+
info: "bg-[var(--color-info-container)] text-[var(--color-on-info-container)]",
|
|
17
|
+
success: "bg-[var(--color-success-container)] text-[var(--color-on-success-container)]",
|
|
18
|
+
warning: "bg-[var(--color-warning-container)] text-[var(--color-on-warning-container)]",
|
|
19
|
+
danger: "bg-[var(--color-error-container)] text-[var(--color-on-error-container)]",
|
|
20
|
+
leap: "bg-[var(--color-leap-container)] text-[var(--color-on-leap-container)]",
|
|
21
|
+
bookub: "bg-[var(--color-bookub-container)] text-[var(--color-on-bookub-container)]",
|
|
22
|
+
payub: "bg-[var(--color-payub-container)] text-[var(--color-on-payub-container)]",
|
|
23
|
+
founderub: "bg-[var(--color-founderub-container)] text-[var(--color-on-founderub-container)]"
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
defaultVariants: {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import {
|
|
3
|
+
toneTextClasses
|
|
4
|
+
} from "./chunk-C6JRJ6JW.js";
|
|
2
5
|
import {
|
|
3
6
|
cn
|
|
4
7
|
} from "./chunk-Q7G5WGYV.js";
|
|
@@ -51,16 +54,16 @@ var Heading = React.forwardRef(
|
|
|
51
54
|
const resolvedSize = size ?? levelSizeMap[level];
|
|
52
55
|
const Tag = `h${level}`;
|
|
53
56
|
const Comp = asChild ? Slot : Tag;
|
|
54
|
-
const toneStyle = tone && tone !== "default" ? { color: `var(--color-text-${tone})` } : {};
|
|
55
57
|
return /* @__PURE__ */ jsx(
|
|
56
58
|
Comp,
|
|
57
59
|
{
|
|
58
60
|
ref,
|
|
59
61
|
className: cn(
|
|
60
62
|
headingVariants({ size: resolvedSize, weight }),
|
|
63
|
+
tone && tone !== "default" && toneTextClasses[tone],
|
|
61
64
|
className
|
|
62
65
|
),
|
|
63
|
-
style
|
|
66
|
+
style,
|
|
64
67
|
"data-tone": tone,
|
|
65
68
|
...rest,
|
|
66
69
|
children
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import {
|
|
3
|
+
disabledText
|
|
4
|
+
} from "./chunk-7SXR4PGO.js";
|
|
5
|
+
import {
|
|
6
|
+
useNexubMessages
|
|
7
|
+
} from "./chunk-24ZFAXB2.js";
|
|
2
8
|
import {
|
|
3
9
|
cn
|
|
4
10
|
} from "./chunk-Q7G5WGYV.js";
|
|
@@ -8,12 +14,14 @@ import * as React from "react";
|
|
|
8
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
15
|
var FilterChip = React.forwardRef(
|
|
10
16
|
({ className, selected = false, count, onRemove, children, ...props }, ref) => {
|
|
17
|
+
const messages = useNexubMessages();
|
|
11
18
|
return /* @__PURE__ */ jsxs(
|
|
12
19
|
"span",
|
|
13
20
|
{
|
|
14
21
|
className: cn(
|
|
15
|
-
|
|
16
|
-
|
|
22
|
+
// Matches Chip; hover/press come from the state layer.
|
|
23
|
+
"nx-state-layer inline-flex items-center gap-1 rounded-shape-control border h-8 px-3 text-label-lg select-none",
|
|
24
|
+
selected ? "bg-[var(--color-secondary-container)] text-[var(--color-on-secondary-container)] border-transparent" : "bg-[var(--color-surface-container-low)] text-[var(--color-on-surface-variant)] border-[var(--color-outline-variant)]"
|
|
17
25
|
),
|
|
18
26
|
children: [
|
|
19
27
|
/* @__PURE__ */ jsxs(
|
|
@@ -22,9 +30,8 @@ var FilterChip = React.forwardRef(
|
|
|
22
30
|
ref,
|
|
23
31
|
type: "button",
|
|
24
32
|
className: cn(
|
|
25
|
-
"inline-flex items-center gap-1 bg-transparent border-0 p-0 m-0 cursor-pointer",
|
|
26
|
-
|
|
27
|
-
selected ? "text-white" : "text-[var(--color-text-primary)]",
|
|
33
|
+
"inline-flex items-center gap-1 bg-transparent border-0 p-0 m-0 cursor-pointer rounded-shape-control text-current",
|
|
34
|
+
disabledText,
|
|
28
35
|
className
|
|
29
36
|
),
|
|
30
37
|
"aria-pressed": selected,
|
|
@@ -35,8 +42,8 @@ var FilterChip = React.forwardRef(
|
|
|
35
42
|
"span",
|
|
36
43
|
{
|
|
37
44
|
className: cn(
|
|
38
|
-
"inline-flex items-center justify-center rounded-full text-
|
|
39
|
-
selected ? "bg-
|
|
45
|
+
"inline-flex items-center justify-center rounded-full text-label-sm px-1.5 min-w-[1.25rem] h-5",
|
|
46
|
+
selected ? "bg-[var(--color-on-secondary-container)] text-[var(--color-secondary-container)]" : "bg-[var(--color-surface-container-high)] text-[var(--color-on-surface-variant)]"
|
|
40
47
|
),
|
|
41
48
|
children: count
|
|
42
49
|
}
|
|
@@ -48,15 +55,14 @@ var FilterChip = React.forwardRef(
|
|
|
48
55
|
"button",
|
|
49
56
|
{
|
|
50
57
|
type: "button",
|
|
51
|
-
"aria-label":
|
|
58
|
+
"aria-label": messages.removeFilter,
|
|
52
59
|
onClick: (e) => {
|
|
53
60
|
e.stopPropagation();
|
|
54
61
|
onRemove();
|
|
55
62
|
},
|
|
56
63
|
className: cn(
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
selected ? "text-white hover:bg-white/20" : "text-[var(--color-text-muted)] hover:bg-[var(--color-bg-muted)] hover:text-[var(--color-text-primary)]"
|
|
64
|
+
// State layer for hover/press; focus = the global ring.
|
|
65
|
+
"nx-state-layer inline-flex items-center justify-center rounded-full w-5 h-5 -me-1 text-current"
|
|
60
66
|
),
|
|
61
67
|
children: /* @__PURE__ */ jsx(
|
|
62
68
|
"svg",
|
|
@@ -9,13 +9,13 @@ import * as RadixScrollArea from "@radix-ui/react-scroll-area";
|
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
var ScrollArea = React.forwardRef(
|
|
11
11
|
({ className, children, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsxs(RadixScrollArea.Root, { ref, className: cn("relative overflow-hidden", className), ...props, children: [
|
|
12
|
-
/* @__PURE__ */ jsx(RadixScrollArea.Viewport, { className: "h-full w-full rounded-[inherit]", children }),
|
|
12
|
+
/* @__PURE__ */ jsx(RadixScrollArea.Viewport, { tabIndex: 0, className: "h-full w-full rounded-[inherit]", children }),
|
|
13
13
|
(orientation === "vertical" || orientation === "both") && /* @__PURE__ */ jsx(
|
|
14
14
|
RadixScrollArea.Scrollbar,
|
|
15
15
|
{
|
|
16
|
-
className: "flex touch-none select-none transition-colors h-full w-2.5 border-
|
|
16
|
+
className: "flex touch-none select-none transition-colors h-full w-2.5 border-s border-s-transparent p-[1px]",
|
|
17
17
|
orientation: "vertical",
|
|
18
|
-
children: /* @__PURE__ */ jsx(RadixScrollArea.Thumb, { className: "relative flex-1 rounded-full bg-[var(--color-
|
|
18
|
+
children: /* @__PURE__ */ jsx(RadixScrollArea.Thumb, { className: "relative flex-1 rounded-full bg-[var(--color-outline-variant)]" })
|
|
19
19
|
}
|
|
20
20
|
),
|
|
21
21
|
(orientation === "horizontal" || orientation === "both") && /* @__PURE__ */ jsx(
|
|
@@ -23,7 +23,7 @@ var ScrollArea = React.forwardRef(
|
|
|
23
23
|
{
|
|
24
24
|
className: "flex touch-none select-none transition-colors flex-col h-2.5 border-t border-t-transparent p-[1px]",
|
|
25
25
|
orientation: "horizontal",
|
|
26
|
-
children: /* @__PURE__ */ jsx(RadixScrollArea.Thumb, { className: "relative flex-1 rounded-full bg-[var(--color-
|
|
26
|
+
children: /* @__PURE__ */ jsx(RadixScrollArea.Thumb, { className: "relative flex-1 rounded-full bg-[var(--color-outline-variant)]" })
|
|
27
27
|
}
|
|
28
28
|
),
|
|
29
29
|
/* @__PURE__ */ jsx(RadixScrollArea.Corner, {})
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
glassSurfaceClass
|
|
4
|
+
} from "./chunk-DEIBF3P7.js";
|
|
5
|
+
import {
|
|
6
|
+
cn
|
|
7
|
+
} from "./chunk-Q7G5WGYV.js";
|
|
8
|
+
|
|
9
|
+
// src/components/MediaCard/MediaCard.tsx
|
|
10
|
+
import * as React from "react";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
var ratioClass = {
|
|
13
|
+
"16/9": "aspect-video",
|
|
14
|
+
"4/3": "aspect-[4/3]",
|
|
15
|
+
"1/1": "aspect-square",
|
|
16
|
+
"3/4": "aspect-[3/4]"
|
|
17
|
+
};
|
|
18
|
+
var MediaCard = React.forwardRef(
|
|
19
|
+
({ src, alt, ratio = "16/9", title, description, eyebrow, href, className, children, ...props }, ref) => {
|
|
20
|
+
const hasCaption = title != null || description != null || eyebrow != null || children != null;
|
|
21
|
+
return /* @__PURE__ */ jsxs(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
ref,
|
|
25
|
+
className: cn(
|
|
26
|
+
"group relative grid overflow-hidden rounded-shape-container border border-[color-mix(in_srgb,var(--color-outline-variant)_60%,transparent)] bg-[var(--color-surface-container-high)]",
|
|
27
|
+
href && "shadow-elevation-1 transition-[box-shadow,transform] duration-effects-fast ease-effects-fast hover:shadow-elevation-2 hover:duration-spatial-default hover:ease-spatial-default motion-safe:hover:-translate-y-0.5 has-[a:focus-visible]:outline has-[a:focus-visible]:outline-[3px] has-[a:focus-visible]:outline-offset-2 has-[a:focus-visible]:outline-[var(--color-primary)]",
|
|
28
|
+
className
|
|
29
|
+
),
|
|
30
|
+
...props,
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsx("div", { className: cn("relative [grid-area:1/1]", ratioClass[ratio]), children: /* @__PURE__ */ jsx(
|
|
33
|
+
"img",
|
|
34
|
+
{
|
|
35
|
+
src,
|
|
36
|
+
alt,
|
|
37
|
+
loading: "lazy",
|
|
38
|
+
decoding: "async",
|
|
39
|
+
className: cn(
|
|
40
|
+
"absolute inset-0 h-full w-full object-cover",
|
|
41
|
+
href && "transition-transform duration-effects-fast ease-effects-fast motion-safe:group-hover:scale-[1.03] group-hover:duration-spatial-default group-hover:ease-spatial-default"
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
) }),
|
|
45
|
+
hasCaption && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
"aria-hidden": "true",
|
|
50
|
+
className: "pointer-events-none h-2/3 self-end bg-gradient-to-t from-[color-mix(in_srgb,var(--color-scrim,black)_45%,transparent)] to-transparent [grid-area:1/1]"
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
/* @__PURE__ */ jsxs("div", { className: "m-1 grid self-end [grid-area:1/1]", children: [
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
"aria-hidden": "true",
|
|
58
|
+
"data-material": "glass",
|
|
59
|
+
"data-glass-thickness": "thin",
|
|
60
|
+
className: cn("rounded-shape-field [grid-area:1/1]", glassSurfaceClass)
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
/* @__PURE__ */ jsxs("div", { className: "z-[1] flex flex-col gap-0.5 px-3 py-2.5 [grid-area:1/1]", children: [
|
|
64
|
+
eyebrow != null && /* @__PURE__ */ jsx("span", { className: "text-label-sm text-[var(--color-on-surface-variant)]", children: eyebrow }),
|
|
65
|
+
title != null && /* @__PURE__ */ jsx("h3", { className: "text-title-sm text-[var(--color-on-surface)]", children: href ? /* @__PURE__ */ jsx("a", { href, className: "after:absolute after:inset-0 after:content-[''] focus-visible:outline-none", children: title }) : title }),
|
|
66
|
+
description != null && /* @__PURE__ */ jsx("p", { className: "text-body-sm text-[var(--color-on-surface-variant)]", children: description }),
|
|
67
|
+
children != null && /* @__PURE__ */ jsx("div", { className: "relative z-[1] mt-2 flex flex-wrap gap-2", children })
|
|
68
|
+
] })
|
|
69
|
+
] })
|
|
70
|
+
] })
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
MediaCard.displayName = "MediaCard";
|
|
77
|
+
|
|
78
|
+
export {
|
|
79
|
+
MediaCard
|
|
80
|
+
};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
inputWrapperVariants
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JHVYI5GK.js";
|
|
5
|
+
import {
|
|
6
|
+
disabledText
|
|
7
|
+
} from "./chunk-7SXR4PGO.js";
|
|
8
|
+
import {
|
|
9
|
+
useNexubMessages
|
|
10
|
+
} from "./chunk-24ZFAXB2.js";
|
|
5
11
|
import {
|
|
6
12
|
cn
|
|
7
13
|
} from "./chunk-Q7G5WGYV.js";
|
|
@@ -36,6 +42,7 @@ var NumberInput = React.forwardRef(
|
|
|
36
42
|
...props
|
|
37
43
|
}, ref) => {
|
|
38
44
|
const [internalValue, setInternalValue] = React.useState(defaultValue);
|
|
45
|
+
const messages = useNexubMessages();
|
|
39
46
|
const controlled = value !== void 0;
|
|
40
47
|
const currentValue = controlled ? value : internalValue;
|
|
41
48
|
const commit = (next) => {
|
|
@@ -51,12 +58,11 @@ var NumberInput = React.forwardRef(
|
|
|
51
58
|
const decrement = () => commit(currentValue - step);
|
|
52
59
|
const stepperButtonClass = cn(
|
|
53
60
|
"flex items-center justify-center px-2 self-stretch shrink-0",
|
|
54
|
-
|
|
55
|
-
"hover:
|
|
56
|
-
|
|
57
|
-
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[var(--color-ring-default)]"
|
|
61
|
+
// State layer for hover/press; tabIndex -1, so no focus styling needed.
|
|
62
|
+
"nx-state-layer text-[var(--color-on-surface-muted)] hover:text-[var(--color-on-surface)]",
|
|
63
|
+
disabledText
|
|
58
64
|
);
|
|
59
|
-
return /* @__PURE__ */ jsxs("div", { className: cn(inputWrapperVariants({ size, invalid }), "
|
|
65
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(inputWrapperVariants({ size, invalid }), "pe-0 gap-0 overflow-hidden", className), children: [
|
|
60
66
|
/* @__PURE__ */ jsx(
|
|
61
67
|
"input",
|
|
62
68
|
{
|
|
@@ -71,19 +77,19 @@ var NumberInput = React.forwardRef(
|
|
|
71
77
|
"aria-invalid": invalid ?? void 0,
|
|
72
78
|
className: cn(
|
|
73
79
|
// Wrapper owns ALL focus styling — strip every indicator from the inner input.
|
|
74
|
-
"flex-1 min-w-0 bg-transparent text-[var(--color-
|
|
80
|
+
"flex-1 min-w-0 bg-transparent text-[var(--color-on-surface)]",
|
|
75
81
|
"border-0 shadow-none",
|
|
76
82
|
"outline-none focus:outline-none focus-visible:outline-none",
|
|
77
83
|
"ring-0 focus:ring-0 focus-visible:ring-0",
|
|
78
|
-
"placeholder:text-[var(--color-
|
|
79
|
-
"disabled:
|
|
84
|
+
"placeholder:text-[var(--color-on-surface-muted)]",
|
|
85
|
+
"disabled:cursor-not-allowed disabled:text-[var(--color-text-disabled)]",
|
|
80
86
|
"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",
|
|
81
|
-
size === "sm" ? "text-sm" :
|
|
87
|
+
size === "sm" ? "text-body-sm" : "text-body-md"
|
|
82
88
|
),
|
|
83
89
|
...props
|
|
84
90
|
}
|
|
85
91
|
),
|
|
86
|
-
showSteppers && /* @__PURE__ */ jsxs("div", { className: "flex flex-col border-
|
|
92
|
+
showSteppers && /* @__PURE__ */ jsxs("div", { className: "flex flex-col border-s border-[var(--color-outline-variant)] self-stretch", children: [
|
|
87
93
|
/* @__PURE__ */ jsx(
|
|
88
94
|
"button",
|
|
89
95
|
{
|
|
@@ -91,8 +97,8 @@ var NumberInput = React.forwardRef(
|
|
|
91
97
|
tabIndex: -1,
|
|
92
98
|
onClick: increment,
|
|
93
99
|
disabled: disabled || max !== void 0 && currentValue >= max,
|
|
94
|
-
className: cn(stepperButtonClass, "border-b border-[var(--color-
|
|
95
|
-
"aria-label":
|
|
100
|
+
className: cn(stepperButtonClass, "border-b border-[var(--color-outline-variant)] text-xs leading-none flex-1"),
|
|
101
|
+
"aria-label": messages.increment,
|
|
96
102
|
children: "\u25B2"
|
|
97
103
|
}
|
|
98
104
|
),
|
|
@@ -104,7 +110,7 @@ var NumberInput = React.forwardRef(
|
|
|
104
110
|
onClick: decrement,
|
|
105
111
|
disabled: disabled || min !== void 0 && currentValue <= min,
|
|
106
112
|
className: cn(stepperButtonClass, "text-xs leading-none flex-1"),
|
|
107
|
-
"aria-label":
|
|
113
|
+
"aria-label": messages.decrement,
|
|
108
114
|
children: "\u25BC"
|
|
109
115
|
}
|
|
110
116
|
)
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import {
|
|
3
|
+
useNexubMessages
|
|
4
|
+
} from "./chunk-24ZFAXB2.js";
|
|
2
5
|
import {
|
|
3
6
|
cn
|
|
4
7
|
} from "./chunk-Q7G5WGYV.js";
|
|
@@ -24,15 +27,15 @@ var spinnerVariants = cva(
|
|
|
24
27
|
xl: "h-10 w-10 border-4"
|
|
25
28
|
},
|
|
26
29
|
tone: {
|
|
27
|
-
neutral: "border-[var(--color-
|
|
28
|
-
info: "border-[var(--color-
|
|
29
|
-
success: "border-[var(--color-
|
|
30
|
-
warning: "border-[var(--color-
|
|
31
|
-
danger: "border-[var(--color-
|
|
32
|
-
leap: "border-[var(--color-leap
|
|
33
|
-
bookub: "border-[var(--color-bookub
|
|
34
|
-
payub: "border-[var(--color-payub
|
|
35
|
-
founderub: "border-[var(--color-founderub
|
|
30
|
+
neutral: "border-[var(--color-on-surface-variant)]",
|
|
31
|
+
info: "border-[var(--color-info)]",
|
|
32
|
+
success: "border-[var(--color-success)]",
|
|
33
|
+
warning: "border-[var(--color-warning)]",
|
|
34
|
+
danger: "border-[var(--color-error)]",
|
|
35
|
+
leap: "border-[var(--color-leap)]",
|
|
36
|
+
bookub: "border-[var(--color-bookub)]",
|
|
37
|
+
payub: "border-[var(--color-payub)]",
|
|
38
|
+
founderub: "border-[var(--color-founderub)]"
|
|
36
39
|
}
|
|
37
40
|
},
|
|
38
41
|
defaultVariants: {
|
|
@@ -42,13 +45,14 @@ var spinnerVariants = cva(
|
|
|
42
45
|
}
|
|
43
46
|
);
|
|
44
47
|
var Spinner = React.forwardRef(
|
|
45
|
-
({ className, size, tone = "neutral", label
|
|
48
|
+
({ className, size, tone = "neutral", label, ...props }, ref) => {
|
|
49
|
+
const messages = useNexubMessages();
|
|
46
50
|
return /* @__PURE__ */ jsx(
|
|
47
51
|
"span",
|
|
48
52
|
{
|
|
49
53
|
ref,
|
|
50
54
|
role: "status",
|
|
51
|
-
"aria-label": label,
|
|
55
|
+
"aria-label": label ?? messages.loading,
|
|
52
56
|
className: cn("inline-flex items-center justify-center", className),
|
|
53
57
|
...props,
|
|
54
58
|
children: /* @__PURE__ */ jsx(
|
|
@@ -57,24 +57,24 @@ var toneClasses = {
|
|
|
57
57
|
outline: "border-[color-mix(in_srgb,var(--color-error)_50%,transparent)] text-[var(--color-error)]"
|
|
58
58
|
},
|
|
59
59
|
leap: {
|
|
60
|
-
solid: "bg-[
|
|
61
|
-
soft: "bg-[
|
|
62
|
-
outline: "border-[color:light-dark(var(--color-palette-leap-80),var(--color-palette-leap-40))] text-[
|
|
60
|
+
solid: "bg-[var(--color-leap)] text-[var(--color-on-leap)]",
|
|
61
|
+
soft: "bg-[var(--color-leap-container)] text-[var(--color-on-leap-container)]",
|
|
62
|
+
outline: "border-[color:light-dark(var(--color-palette-leap-80),var(--color-palette-leap-40))] text-[var(--color-leap)]"
|
|
63
63
|
},
|
|
64
64
|
bookub: {
|
|
65
|
-
solid: "bg-[
|
|
66
|
-
soft: "bg-[
|
|
67
|
-
outline: "border-[color:light-dark(var(--color-palette-bookub-80),var(--color-palette-bookub-40))] text-[
|
|
65
|
+
solid: "bg-[var(--color-bookub)] text-[var(--color-on-bookub)]",
|
|
66
|
+
soft: "bg-[var(--color-bookub-container)] text-[var(--color-on-bookub-container)]",
|
|
67
|
+
outline: "border-[color:light-dark(var(--color-palette-bookub-80),var(--color-palette-bookub-40))] text-[var(--color-bookub)]"
|
|
68
68
|
},
|
|
69
69
|
payub: {
|
|
70
|
-
solid: "bg-[
|
|
71
|
-
soft: "bg-[
|
|
72
|
-
outline: "border-[color:light-dark(var(--color-palette-payub-80),var(--color-palette-payub-40))] text-[
|
|
70
|
+
solid: "bg-[var(--color-payub)] text-[var(--color-on-payub)]",
|
|
71
|
+
soft: "bg-[var(--color-payub-container)] text-[var(--color-on-payub-container)]",
|
|
72
|
+
outline: "border-[color:light-dark(var(--color-palette-payub-80),var(--color-palette-payub-40))] text-[var(--color-payub)]"
|
|
73
73
|
},
|
|
74
74
|
founderub: {
|
|
75
|
-
solid: "bg-[
|
|
76
|
-
soft: "bg-[
|
|
77
|
-
outline: "border-[color:light-dark(var(--color-palette-founderub-80),var(--color-palette-founderub-40))] text-[
|
|
75
|
+
solid: "bg-[var(--color-founderub)] text-[var(--color-on-founderub)]",
|
|
76
|
+
soft: "bg-[var(--color-founderub-container)] text-[var(--color-on-founderub-container)]",
|
|
77
|
+
outline: "border-[color:light-dark(var(--color-palette-founderub-80),var(--color-palette-founderub-40))] text-[var(--color-founderub)]"
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
var Badge = React.forwardRef(
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
useControllableState
|
|
4
4
|
} from "./chunk-JLUCMNVS.js";
|
|
5
|
+
import {
|
|
6
|
+
useNexubMessages
|
|
7
|
+
} from "./chunk-24ZFAXB2.js";
|
|
5
8
|
import {
|
|
6
9
|
cn
|
|
7
10
|
} from "./chunk-Q7G5WGYV.js";
|
|
@@ -38,6 +41,7 @@ var Rating = React.forwardRef(
|
|
|
38
41
|
onChange: onValueChange
|
|
39
42
|
});
|
|
40
43
|
const [hovered, setHovered] = React.useState(null);
|
|
44
|
+
const messages = useNexubMessages();
|
|
41
45
|
const displayValue = hovered ?? value ?? 0;
|
|
42
46
|
const starRefs = React.useRef([]);
|
|
43
47
|
const tabStop = value && value > 0 ? value : 1;
|
|
@@ -54,7 +58,7 @@ var Rating = React.forwardRef(
|
|
|
54
58
|
ref,
|
|
55
59
|
className: cn(ratingVariants({ size }), className),
|
|
56
60
|
role: "radiogroup",
|
|
57
|
-
"aria-label":
|
|
61
|
+
"aria-label": messages.rating,
|
|
58
62
|
"aria-readonly": readOnly || void 0,
|
|
59
63
|
...props,
|
|
60
64
|
children: Array.from({ length: max }, (_, i) => {
|
|
@@ -70,7 +74,7 @@ var Rating = React.forwardRef(
|
|
|
70
74
|
role: "radio",
|
|
71
75
|
tabIndex: starValue === tabStop ? 0 : -1,
|
|
72
76
|
"aria-checked": starValue === (value ?? 0),
|
|
73
|
-
"aria-label":
|
|
77
|
+
"aria-label": messages.ratingStars(starValue),
|
|
74
78
|
disabled: readOnly,
|
|
75
79
|
onClick: () => !readOnly && setValue(starValue),
|
|
76
80
|
onKeyDown: (e) => !readOnly && handleKeyDown(e, starValue),
|
|
@@ -80,7 +84,7 @@ var Rating = React.forwardRef(
|
|
|
80
84
|
"bg-transparent border-0 p-0 m-0 inline-flex items-center justify-center transition-transform",
|
|
81
85
|
!readOnly && "cursor-pointer hover:scale-110",
|
|
82
86
|
readOnly && "cursor-default",
|
|
83
|
-
"
|
|
87
|
+
"rounded-shape-min",
|
|
84
88
|
"disabled:pointer-events-none"
|
|
85
89
|
),
|
|
86
90
|
children: /* @__PURE__ */ jsx(
|
|
@@ -104,8 +108,8 @@ function StarIcon({ filled, ...props }) {
|
|
|
104
108
|
"svg",
|
|
105
109
|
{
|
|
106
110
|
viewBox: "0 0 20 20",
|
|
107
|
-
fill: filled ? "var(--color-
|
|
108
|
-
stroke: filled ? "var(--color-
|
|
111
|
+
fill: filled ? "var(--color-palette-warning-72)" : "none",
|
|
112
|
+
stroke: filled ? "var(--color-warning)" : "var(--color-outline-variant)",
|
|
109
113
|
strokeWidth: "1.5",
|
|
110
114
|
xmlns: "http://www.w3.org/2000/svg",
|
|
111
115
|
...props,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use client';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
cn
|
|
4
|
+
} from "./chunk-Q7G5WGYV.js";
|
|
5
|
+
|
|
6
|
+
// src/components/StreamingText/StreamingText.tsx
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
var MAX_ANIMATED = 3;
|
|
10
|
+
function next(prev, text, streaming) {
|
|
11
|
+
if (!text.startsWith(prev.source) || !streaming) {
|
|
12
|
+
return { source: text, settled: text, chunks: [], nextId: prev.nextId };
|
|
13
|
+
}
|
|
14
|
+
const chunks = [...prev.chunks, { id: prev.nextId, text: text.slice(prev.source.length) }];
|
|
15
|
+
let settled = prev.settled;
|
|
16
|
+
while (chunks.length > MAX_ANIMATED) settled += chunks.shift().text;
|
|
17
|
+
return { source: text, settled, chunks, nextId: prev.nextId + 1 };
|
|
18
|
+
}
|
|
19
|
+
var StreamingText = React.forwardRef(
|
|
20
|
+
({ text, streaming = false, as: Comp = "div", className, "aria-live": ariaLive = "off", ...props }, ref) => {
|
|
21
|
+
const [state, setState] = React.useState(() => ({ source: text, settled: text, chunks: [], nextId: 0 }));
|
|
22
|
+
let current = state;
|
|
23
|
+
if (text !== state.source || !streaming && state.chunks.length > 0) {
|
|
24
|
+
current = next(state, text, streaming);
|
|
25
|
+
setState(current);
|
|
26
|
+
}
|
|
27
|
+
return /* @__PURE__ */ jsxs(
|
|
28
|
+
Comp,
|
|
29
|
+
{
|
|
30
|
+
ref,
|
|
31
|
+
"aria-busy": streaming,
|
|
32
|
+
"aria-live": ariaLive,
|
|
33
|
+
className: cn("whitespace-pre-wrap break-words", className),
|
|
34
|
+
...props,
|
|
35
|
+
children: [
|
|
36
|
+
current.settled,
|
|
37
|
+
current.chunks.map((c) => /* @__PURE__ */ jsx("span", { className: "nx-reveal motion-reduce:animate-none", children: c.text }, c.id)),
|
|
38
|
+
streaming && /* @__PURE__ */ jsx(
|
|
39
|
+
"span",
|
|
40
|
+
{
|
|
41
|
+
"aria-hidden": "true",
|
|
42
|
+
"data-caret": "",
|
|
43
|
+
className: "nx-caret ms-0.5 inline-block h-[1em] w-[2px] align-text-bottom rounded-full bg-[var(--color-primary)] motion-reduce:animate-none"
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
StreamingText.displayName = "StreamingText";
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
StreamingText
|
|
55
|
+
};
|