@yuhuanowo/yunui 0.2.17 → 0.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/README.zh-CN.md +5 -1
- package/README.zh-TW.md +5 -1
- package/dist/ai.d.ts +99 -3
- package/dist/ai.js +212 -104
- package/dist/ai.js.map +1 -1
- package/dist/chat.d.ts +10 -3
- package/dist/chat.js +12 -7
- package/dist/chat.js.map +1 -1
- package/dist/{chunk-HH3JBHRP.js → chunk-AFVENY4D.js} +286 -31
- package/dist/chunk-AFVENY4D.js.map +1 -0
- package/dist/{chunk-F2HG4TOQ.js → chunk-GAXVET76.js} +13 -19
- package/dist/chunk-GAXVET76.js.map +1 -0
- package/dist/{chunk-DDUP7GAX.js → chunk-LEBQPP4B.js} +69 -3
- package/dist/chunk-LEBQPP4B.js.map +1 -0
- package/dist/chunk-ST6TSBVQ.js +208 -0
- package/dist/chunk-ST6TSBVQ.js.map +1 -0
- package/dist/chunk-V7VJKZ5Q.js +254 -0
- package/dist/chunk-V7VJKZ5Q.js.map +1 -0
- package/dist/{chunk-BCOKFWXC.js → chunk-YKWRCA2S.js} +80 -156
- package/dist/chunk-YKWRCA2S.js.map +1 -0
- package/dist/content.d.ts +10 -2
- package/dist/content.js +50 -40
- package/dist/content.js.map +1 -1
- package/dist/index.d.ts +266 -16
- package/dist/index.js +4 -4
- package/dist/patterns.d.ts +471 -22
- package/dist/patterns.js +783 -131
- package/dist/patterns.js.map +1 -1
- package/icons/providers/gmi.svg +5 -0
- package/package.json +3 -4
- package/styles/content.css +3 -1
- package/styles/yunui.css +197 -84
- package/dist/chunk-BCOKFWXC.js.map +0 -1
- package/dist/chunk-DDUP7GAX.js.map +0 -1
- package/dist/chunk-F2HG4TOQ.js.map +0 -1
- package/dist/chunk-HH3JBHRP.js.map +0 -1
- package/dist/chunk-N4QO7RN5.js +0 -98
- package/dist/chunk-N4QO7RN5.js.map +0 -1
- package/dist/chunk-QEIBYOG2.js +0 -188
- package/dist/chunk-QEIBYOG2.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -145,15 +145,18 @@ interface SheetProps {
|
|
|
145
145
|
children: React.ReactNode;
|
|
146
146
|
/** Optional header title. */
|
|
147
147
|
title?: string;
|
|
148
|
+
/** Accessible name for the close button. The library ships no copy of its
|
|
149
|
+
* own; the English default only keeps it usable untranslated. */
|
|
150
|
+
closeLabel?: string;
|
|
148
151
|
/** Hide on large screens (`lg`+) — for mobile-only drawers (e.g. a sidebar
|
|
149
152
|
* that's permanent on desktop). @defaultValue false (shows on all sizes). */
|
|
150
153
|
mobileOnly?: boolean;
|
|
151
154
|
}
|
|
152
155
|
/** Slide-in panel from the right with a backdrop. By default it shows on every
|
|
153
156
|
* screen size; set `mobileOnly` to hide it on `lg`+ (a mobile-only drawer). */
|
|
154
|
-
declare function Sheet({ open, onClose, children, title, mobileOnly }: SheetProps): React$1.ReactPortal | null;
|
|
157
|
+
declare function Sheet({ open, onClose, children, title, closeLabel, mobileOnly }: SheetProps): React$1.ReactPortal | null;
|
|
155
158
|
|
|
156
|
-
interface CheckboxProps {
|
|
159
|
+
interface CheckboxProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "checked" | "onChange" | "type" | "role" | "disabled" | "id" | "className"> {
|
|
157
160
|
/** Whether the box is checked. `"indeterminate"` shows a dash — for a
|
|
158
161
|
* select-all that's only partially selected. Defaults to `false`. */
|
|
159
162
|
checked?: boolean | "indeterminate";
|
|
@@ -163,7 +166,14 @@ interface CheckboxProps {
|
|
|
163
166
|
/** Disable interaction and dim the control. */
|
|
164
167
|
disabled?: boolean;
|
|
165
168
|
className?: string;
|
|
166
|
-
/**
|
|
169
|
+
/**
|
|
170
|
+
* Element id.
|
|
171
|
+
*
|
|
172
|
+
* NOTE: this renders a `<button role="checkbox">`, and `<label>` — whether
|
|
173
|
+
* wrapping or via `htmlFor` — only names real form controls. It does
|
|
174
|
+
* nothing for a button. Name it with `aria-label`, or point
|
|
175
|
+
* `aria-labelledby` at the text beside it.
|
|
176
|
+
*/
|
|
167
177
|
id?: string;
|
|
168
178
|
}
|
|
169
179
|
/** Controlled checkbox rendered as an accessible toggle button. Supports an
|
|
@@ -199,6 +209,12 @@ interface ComboboxProps {
|
|
|
199
209
|
onChange: (value: string) => void;
|
|
200
210
|
/** Placeholder for the input (falls back to i18n default). */
|
|
201
211
|
placeholder?: string;
|
|
212
|
+
/** Accessible names for the clear / toggle affordances. The library ships no
|
|
213
|
+
* copy of its own; the English defaults only keep it usable untranslated. */
|
|
214
|
+
labels?: {
|
|
215
|
+
clear?: string;
|
|
216
|
+
toggle?: string;
|
|
217
|
+
};
|
|
202
218
|
className?: string;
|
|
203
219
|
/** Disable interaction and dim the control. */
|
|
204
220
|
disabled?: boolean;
|
|
@@ -215,7 +231,7 @@ interface ComboboxProps {
|
|
|
215
231
|
}
|
|
216
232
|
/** Searchable, optionally creatable combobox — type to filter, Enter to pick or create.
|
|
217
233
|
* For long lists where users type to narrow; see `Select`'s doc for "which select do I use". */
|
|
218
|
-
declare function Combobox({ options, value, onChange, placeholder, className, disabled, clearable, allowCustom, creatableText, creatableFilter, creatableIcon, }: ComboboxProps): React$1.JSX.Element;
|
|
234
|
+
declare function Combobox({ options, value, onChange, placeholder, labels, className, disabled, clearable, allowCustom, creatableText, creatableFilter, creatableIcon, }: ComboboxProps): React$1.JSX.Element;
|
|
219
235
|
|
|
220
236
|
/**
|
|
221
237
|
* Radix Accordion root — a vertically stacked set of collapsible sections.
|
|
@@ -347,6 +363,13 @@ declare const Stack: React$1.ForwardRefExoticComponent<Omit<FlexProps, "directio
|
|
|
347
363
|
declare const Table: React$1.ForwardRefExoticComponent<React$1.TableHTMLAttributes<HTMLTableElement> & {
|
|
348
364
|
/** Class applied to the outer scroll/overflow wrapper. */
|
|
349
365
|
containerClassName?: string;
|
|
366
|
+
/**
|
|
367
|
+
* Accessible name for the scroll region, used only when the table is
|
|
368
|
+
* actually overflowing and therefore focusable (e.g. "Transactions,
|
|
369
|
+
* scrollable"). The library ships no copy, so without it the region is
|
|
370
|
+
* focusable but unnamed.
|
|
371
|
+
*/
|
|
372
|
+
scrollLabel?: string;
|
|
350
373
|
/**
|
|
351
374
|
* Stack each row into a labelled card below the `md` breakpoint, so dense
|
|
352
375
|
* many-column tables stay readable on narrow screens instead of forcing a
|
|
@@ -441,12 +464,26 @@ interface PaginationProps extends Omit<React$1.HTMLAttributes<HTMLElement>, "onC
|
|
|
441
464
|
* @defaultValue 1
|
|
442
465
|
*/
|
|
443
466
|
siblingCount?: number;
|
|
444
|
-
/** Accessible label for the previous-page button. @defaultValue "Go to previous page" */
|
|
445
|
-
previousLabel?: string;
|
|
446
|
-
/** Accessible label for the next-page button. @defaultValue "Go to next page" */
|
|
447
|
-
nextLabel?: string;
|
|
448
467
|
/** Accessible name for the wrapping nav landmark. @defaultValue "Pagination" */
|
|
449
468
|
ariaLabel?: string;
|
|
469
|
+
/** @deprecated Use labels.previous. Retained for 0.2.17 compatibility. */
|
|
470
|
+
previousLabel?: string;
|
|
471
|
+
/** @deprecated Use labels.next. Retained for 0.2.17 compatibility. */
|
|
472
|
+
nextLabel?: string;
|
|
473
|
+
/** Every string the control announces. Matches `BlogPagination.labels`. */
|
|
474
|
+
labels?: {
|
|
475
|
+
/** Previous-page button. @defaultValue "Go to previous page" */
|
|
476
|
+
previous?: string;
|
|
477
|
+
/** Next-page button. @defaultValue "Go to next page" */
|
|
478
|
+
next?: string;
|
|
479
|
+
/**
|
|
480
|
+
* Names a numbered page button. The number alone is not a usable name
|
|
481
|
+
* — this used to be a hardcoded `Go to page N`, in English, with no way
|
|
482
|
+
* for the host to translate it.
|
|
483
|
+
* @defaultValue (n) => `Go to page ${n}`
|
|
484
|
+
*/
|
|
485
|
+
page?: (page: number) => string;
|
|
486
|
+
};
|
|
450
487
|
}
|
|
451
488
|
/**
|
|
452
489
|
* Controlled pagination control. Renders previous/next arrows plus numbered
|
|
@@ -609,10 +646,13 @@ declare function InlineStatus({ status, label, progress, size, className }: Inli
|
|
|
609
646
|
/** Inline `<code>` styling for code spans in prose or chat. Use `Kbd` for keys. */
|
|
610
647
|
declare function InlineCode({ className, ...props }: React$1.HTMLAttributes<HTMLElement>): React$1.JSX.Element;
|
|
611
648
|
interface Step {
|
|
649
|
+
/** The milestone's label. */
|
|
612
650
|
title: React$1.ReactNode;
|
|
651
|
+
/** Optional second line under the title. */
|
|
613
652
|
description?: React$1.ReactNode;
|
|
614
653
|
}
|
|
615
654
|
interface StepsProps extends Omit<React$1.HTMLAttributes<HTMLOListElement>, "children"> {
|
|
655
|
+
/** The milestones, in order, from first to last. */
|
|
616
656
|
steps: Step[];
|
|
617
657
|
/** Zero-based index of the active step; earlier steps render as completed. */
|
|
618
658
|
current?: number;
|
|
@@ -637,7 +677,11 @@ declare const DialogClose: React$1.ForwardRefExoticComponent<DialogPrimitive.Dia
|
|
|
637
677
|
/** Dimmed, blurred backdrop behind the dialog content. */
|
|
638
678
|
declare const DialogOverlay: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
639
679
|
/** Centered, animated dialog panel (includes the overlay and a built-in close button). */
|
|
640
|
-
declare const DialogContent: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> &
|
|
680
|
+
declare const DialogContent: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
681
|
+
/** Accessible name for the built-in close button. The library ships no
|
|
682
|
+
* copy of its own; the English default only keeps it usable untranslated. */
|
|
683
|
+
closeLabel?: string;
|
|
684
|
+
} & React$1.RefAttributes<HTMLDivElement>>;
|
|
641
685
|
/** Header layout block for the dialog title/description. */
|
|
642
686
|
declare function DialogHeader({ className, ...props }: React$1.HTMLAttributes<HTMLDivElement>): React$1.JSX.Element;
|
|
643
687
|
/** Accessible dialog title (labels the dialog for screen readers). */
|
|
@@ -679,11 +723,24 @@ declare const SelectScrollUpButton: React$1.ForwardRefExoticComponent<Omit<Selec
|
|
|
679
723
|
/** Auto-scroll affordance shown at the bottom of a long, scrollable list. */
|
|
680
724
|
declare const SelectScrollDownButton: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollDownButtonProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
681
725
|
/** Range slider with a track, filled range, and draggable thumb. */
|
|
682
|
-
declare const Slider: React$1.ForwardRefExoticComponent<Omit<SliderPrimitive.SliderProps & React$1.RefAttributes<HTMLSpanElement>, "ref"> &
|
|
726
|
+
declare const Slider: React$1.ForwardRefExoticComponent<Omit<SliderPrimitive.SliderProps & React$1.RefAttributes<HTMLSpanElement>, "ref"> & {
|
|
727
|
+
/**
|
|
728
|
+
* Accessible name for the thumb. Radix gives it `role="slider"`, and a
|
|
729
|
+
* slider with no name is announced as an unlabelled one — the value
|
|
730
|
+
* without any idea what it sets.
|
|
731
|
+
*/
|
|
732
|
+
label?: string;
|
|
733
|
+
} & React$1.RefAttributes<HTMLSpanElement>>;
|
|
683
734
|
/** Horizontal progress bar; `value` is the percent complete (0–100). */
|
|
684
735
|
declare const Progress: React$1.ForwardRefExoticComponent<Omit<ProgressPrimitive.ProgressProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
685
736
|
/** Percent complete, 0–100. */
|
|
686
737
|
value?: number;
|
|
738
|
+
/**
|
|
739
|
+
* Accessible name, e.g. "Upload progress". Radix gives the root
|
|
740
|
+
* `role="progressbar"`, and a progressbar with no name is announced as
|
|
741
|
+
* an unlabelled one — the percentage without any idea what it measures.
|
|
742
|
+
*/
|
|
743
|
+
label?: string;
|
|
687
744
|
} & React$1.RefAttributes<HTMLDivElement>>;
|
|
688
745
|
/** Radix Tabs root — manages the active tab. Compose with TabsList/TabsTrigger/TabsContent. */
|
|
689
746
|
declare const Tabs: React$1.ForwardRefExoticComponent<TabsPrimitive.TabsProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
@@ -785,8 +842,17 @@ interface IconButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement
|
|
|
785
842
|
}
|
|
786
843
|
/** Icon-only button with a built-in tooltip (uses `label` for both a11y and the tooltip text). */
|
|
787
844
|
declare const IconButton: React$1.ForwardRefExoticComponent<IconButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
845
|
+
interface LabelProps extends React$1.LabelHTMLAttributes<HTMLLabelElement> {
|
|
846
|
+
/**
|
|
847
|
+
* `xs` (default) is the compact 11px label; `sm` is 12px, for denser forms
|
|
848
|
+
* where the label sits directly above a full-height input and 11px reads as
|
|
849
|
+
* an afterthought.
|
|
850
|
+
* @defaultValue "xs"
|
|
851
|
+
*/
|
|
852
|
+
size?: "xs" | "sm";
|
|
853
|
+
}
|
|
788
854
|
/** Uppercase, muted form-field label. */
|
|
789
|
-
declare function Label({ className, ...props }:
|
|
855
|
+
declare function Label({ className, size, ...props }: LabelProps): React$1.JSX.Element;
|
|
790
856
|
/** Radix DropdownMenu root — a contextual actions menu. Compose with DropdownMenu* parts. */
|
|
791
857
|
declare const DropdownMenu: React$1.FC<DropdownMenuPrimitive.DropdownMenuProps>;
|
|
792
858
|
/** Element that opens the dropdown menu. */
|
|
@@ -1034,6 +1100,12 @@ interface SwitchProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onC
|
|
|
1034
1100
|
/** Checked-state color: `default`, `success`, `warning`, or `danger`. */
|
|
1035
1101
|
variant?: "default" | "success" | "warning" | "danger";
|
|
1036
1102
|
className?: string;
|
|
1103
|
+
/**
|
|
1104
|
+
* Accessible name. A `role="switch"` with no name is announced as an
|
|
1105
|
+
* unlabelled control, and this one has no text of its own — so either pass
|
|
1106
|
+
* this or pair the switch with a `<Label htmlFor>` via `id`.
|
|
1107
|
+
*/
|
|
1108
|
+
label?: string;
|
|
1037
1109
|
/** Element id (e.g. to pair with a `<label htmlFor>`). */
|
|
1038
1110
|
id?: string;
|
|
1039
1111
|
}
|
|
@@ -1045,12 +1117,23 @@ interface AnimatedNumberProps {
|
|
|
1045
1117
|
suffix?: string;
|
|
1046
1118
|
/** Decimal places; trailing zeros are stripped (100.00 → 100). */
|
|
1047
1119
|
decimals?: number;
|
|
1120
|
+
/**
|
|
1121
|
+
* Skip the animation and print `value` immediately.
|
|
1122
|
+
*
|
|
1123
|
+
* Left undefined, this turns itself on in the two cases where a spring is
|
|
1124
|
+
* wrong rather than merely unwanted: when the reader has asked for reduced
|
|
1125
|
+
* motion, and under a test runner. In jsdom nothing drives the animation
|
|
1126
|
+
* frame, so a spring never leaves 0 — a component that counted up would
|
|
1127
|
+
* assert as `"0"` forever, which is why Yunxin's copy of this carried its own
|
|
1128
|
+
* `NODE_ENV === "test"` escape hatch. Pass an explicit boolean to override.
|
|
1129
|
+
*/
|
|
1130
|
+
immediate?: boolean;
|
|
1048
1131
|
}
|
|
1049
1132
|
/**
|
|
1050
1133
|
* A number that springs from 0 up to `value` on mount / when `value` changes.
|
|
1051
1134
|
* Starts at 0 on both server and client, so it is SSR-hydration safe.
|
|
1052
1135
|
*/
|
|
1053
|
-
declare function AnimatedNumber({ value, suffix, decimals }: AnimatedNumberProps): React$1.JSX.Element;
|
|
1136
|
+
declare function AnimatedNumber({ value, suffix, decimals, immediate, }: AnimatedNumberProps): React$1.JSX.Element;
|
|
1054
1137
|
|
|
1055
1138
|
type SparklineTone = "accent" | "success" | "warning" | "error" | "info" | "neutral";
|
|
1056
1139
|
interface SparklineProps extends Omit<React.SVGProps<SVGSVGElement>, "color"> {
|
|
@@ -1072,13 +1155,20 @@ interface SparklineProps extends Omit<React.SVGProps<SVGSVGElement>, "color"> {
|
|
|
1072
1155
|
min?: number;
|
|
1073
1156
|
/** Upper bound of the value axis. Defaults to the data maximum. */
|
|
1074
1157
|
max?: number;
|
|
1158
|
+
/**
|
|
1159
|
+
* Accessible name for the whole graphic, e.g. "Storage used: 62%".
|
|
1160
|
+
* Without it the element is treated as decoration rather than being
|
|
1161
|
+
* announced as an anonymous image — an unnamed `role="img"` tells a screen
|
|
1162
|
+
* reader there is a picture here and nothing about it.
|
|
1163
|
+
*/
|
|
1164
|
+
label?: string;
|
|
1075
1165
|
className?: string;
|
|
1076
1166
|
}
|
|
1077
1167
|
/**
|
|
1078
1168
|
* A minimal inline line chart. Give it a rolling window of numbers and it draws
|
|
1079
1169
|
* a smooth, container-width sparkline; set `area` for a gradient fill.
|
|
1080
1170
|
*/
|
|
1081
|
-
declare function Sparkline({ data, width, height, tone, color, strokeWidth, area, min, max, className, ...props }: SparklineProps): React$1.JSX.Element;
|
|
1171
|
+
declare function Sparkline({ data, width, height, tone, color, strokeWidth, area, min, max, label, className, ...props }: SparklineProps): React$1.JSX.Element;
|
|
1082
1172
|
|
|
1083
1173
|
type GaugeTone = "accent" | "success" | "warning" | "error" | "info" | "neutral";
|
|
1084
1174
|
interface GaugeProps {
|
|
@@ -1094,6 +1184,11 @@ interface GaugeProps {
|
|
|
1094
1184
|
color?: string;
|
|
1095
1185
|
/** Center content. Defaults to the rounded percentage; pass `null` to hide. */
|
|
1096
1186
|
label?: ReactNode;
|
|
1187
|
+
/**
|
|
1188
|
+
* Accessible name, when `label` is a node rather than a string. Radix aside,
|
|
1189
|
+
* a `role="progressbar"` with no name announces a bare percentage.
|
|
1190
|
+
*/
|
|
1191
|
+
ariaLabel?: string;
|
|
1097
1192
|
/** Start the arc from the top and sweep clockwise (default) or counter-clockwise. */
|
|
1098
1193
|
counterClockwise?: boolean;
|
|
1099
1194
|
className?: string;
|
|
@@ -1102,7 +1197,7 @@ interface GaugeProps {
|
|
|
1102
1197
|
* A circular percentage gauge. Feed it a `value` (0–100) and it fills the ring
|
|
1103
1198
|
* proportionally; the center renders the value unless you pass a custom `label`.
|
|
1104
1199
|
*/
|
|
1105
|
-
declare function Gauge({ value, size, thickness, tone, color, label, counterClockwise, className, }: GaugeProps): React$1.JSX.Element;
|
|
1200
|
+
declare function Gauge({ value, size, thickness, tone, color, label, ariaLabel, counterClockwise, className, }: GaugeProps): React$1.JSX.Element;
|
|
1106
1201
|
|
|
1107
1202
|
type SegmentTone = "accent" | "success" | "warning" | "error" | "info" | "neutral";
|
|
1108
1203
|
interface BarSegment {
|
|
@@ -1126,13 +1221,20 @@ interface SegmentedBarProps {
|
|
|
1126
1221
|
legend?: boolean;
|
|
1127
1222
|
/** Format a segment value for the legend (e.g. bytes → "1.2 GB"). */
|
|
1128
1223
|
formatValue?: (value: number) => ReactNode;
|
|
1224
|
+
/**
|
|
1225
|
+
* Accessible name for the whole graphic, e.g. "Storage used: 62%".
|
|
1226
|
+
* Without it the element is treated as decoration rather than being
|
|
1227
|
+
* announced as an anonymous image — an unnamed `role="img"` tells a screen
|
|
1228
|
+
* reader there is a picture here and nothing about it.
|
|
1229
|
+
*/
|
|
1230
|
+
label?: string;
|
|
1129
1231
|
className?: string;
|
|
1130
1232
|
}
|
|
1131
1233
|
/**
|
|
1132
1234
|
* A proportional multi-segment bar. Give it segments and (optionally) a `total`;
|
|
1133
1235
|
* each segment takes a slice of the width, with any leftover shown as track.
|
|
1134
1236
|
*/
|
|
1135
|
-
declare function SegmentedBar({ segments, total, height, legend, formatValue, className, }: SegmentedBarProps): React$1.JSX.Element;
|
|
1237
|
+
declare function SegmentedBar({ segments, total, height, legend, formatValue, label, className, }: SegmentedBarProps): React$1.JSX.Element;
|
|
1136
1238
|
|
|
1137
1239
|
interface FileDropzoneProps {
|
|
1138
1240
|
/** Called with the selected/dropped files (already filtered to a File[]). */
|
|
@@ -1258,6 +1360,88 @@ declare function useBodyScrollLock(locked?: boolean): void;
|
|
|
1258
1360
|
*/
|
|
1259
1361
|
declare function useModalBehavior(isOpen: boolean, onClose: () => void): void;
|
|
1260
1362
|
declare function useFocusTrap(containerRef: RefObject<HTMLElement | null>, enabled?: boolean): void;
|
|
1363
|
+
/**
|
|
1364
|
+
* Dismiss a floating panel when the pointer goes down outside it.
|
|
1365
|
+
*
|
|
1366
|
+
* Six components in this library hand-rolled this, and no two agreed:
|
|
1367
|
+
* `CustomSelect`, `Combobox`, `ThemeToggle` and `LanguageSwitcher` registered
|
|
1368
|
+
* the listener permanently (it ran on every click in the app, open or not) and
|
|
1369
|
+
* listened for `mousedown` only — so on a touch device, tapping away did not
|
|
1370
|
+
* reliably close them. `ModelSelect` added `touchstart` but still never
|
|
1371
|
+
* unregistered while closed. `AccountMenu` gated on open and handled Escape.
|
|
1372
|
+
*
|
|
1373
|
+
* This is the union of the correct halves: the listeners exist only while
|
|
1374
|
+
* `open`, cover both mouse and touch, and optionally close on Escape.
|
|
1375
|
+
*
|
|
1376
|
+
* @param open Whether the panel is currently showing.
|
|
1377
|
+
* @param onDismiss Called on an outside press (and on Escape, if enabled).
|
|
1378
|
+
* @param ref The panel's outermost element — a press inside it is ignored.
|
|
1379
|
+
* @param options.escape Also dismiss on Escape. @defaultValue true
|
|
1380
|
+
* @param options.extraRefs Further elements to treat as "inside" — for a panel
|
|
1381
|
+
* rendered through a portal, whose DOM is not a descendant of the trigger.
|
|
1382
|
+
*
|
|
1383
|
+
* @example
|
|
1384
|
+
* ```tsx
|
|
1385
|
+
* const ref = useRef<HTMLDivElement>(null);
|
|
1386
|
+
* const [open, setOpen] = useState(false);
|
|
1387
|
+
* useDismissOnOutside(open, () => setOpen(false), ref);
|
|
1388
|
+
* ```
|
|
1389
|
+
*/
|
|
1390
|
+
declare function useDismissOnOutside(open: boolean, onDismiss: () => void, ref: RefObject<HTMLElement | null>, options?: {
|
|
1391
|
+
escape?: boolean;
|
|
1392
|
+
extraRefs?: RefObject<HTMLElement | null>[];
|
|
1393
|
+
}): void;
|
|
1394
|
+
/**
|
|
1395
|
+
* Make a scroll container keyboard-reachable, but only while it actually
|
|
1396
|
+
* scrolls.
|
|
1397
|
+
*
|
|
1398
|
+
* Chrome quietly makes overflowing scroll containers focusable; Safari and
|
|
1399
|
+
* Firefox do not. So a wide `<table>` of plain cells — no links, no buttons —
|
|
1400
|
+
* has *no* keyboard route to the columns past the right edge in those engines:
|
|
1401
|
+
* the content is simply unreachable. The usual fix is a permanent
|
|
1402
|
+
* `tabIndex={0}`, which then adds a dead tab stop to every table that fits.
|
|
1403
|
+
*
|
|
1404
|
+
* This measures instead. It returns `0` while the element overflows and
|
|
1405
|
+
* `undefined` when it does not, re-checking on resize and on content changes.
|
|
1406
|
+
*
|
|
1407
|
+
* @param ref The scrolling element.
|
|
1408
|
+
* @param axis Which overflow to watch. @defaultValue "x"
|
|
1409
|
+
*
|
|
1410
|
+
* @example
|
|
1411
|
+
* ```tsx
|
|
1412
|
+
* const ref = useRef<HTMLDivElement>(null);
|
|
1413
|
+
* const tabIndex = useScrollableTabStop(ref);
|
|
1414
|
+
* return <div ref={ref} tabIndex={tabIndex} className="overflow-x-auto">…</div>;
|
|
1415
|
+
* ```
|
|
1416
|
+
*/
|
|
1417
|
+
declare function useScrollableTabStop(ref: RefObject<HTMLElement | null>, axis?: "x" | "y"): 0 | undefined;
|
|
1418
|
+
|
|
1419
|
+
interface AnchoredPosition {
|
|
1420
|
+
/** Horizontal nudge (px) to keep the panel on-screen. Apply as `marginLeft`
|
|
1421
|
+
* — it never collides with `transform` (framer-motion / `animate-in`) or the
|
|
1422
|
+
* panel's left/right anchor. */
|
|
1423
|
+
shift: number;
|
|
1424
|
+
/** Cap (px) so the panel can't run off the edge; pair with an internal scroll
|
|
1425
|
+
* region (`flex-1 min-h-0` / `overflow-y-auto`). */
|
|
1426
|
+
maxHeight?: number;
|
|
1427
|
+
/** Which side of the trigger to render on. `"top"` when there isn't room
|
|
1428
|
+
* below but there is above — the consumer flips `top-full mt-*` to
|
|
1429
|
+
* `bottom-full mb-*`. Defaults to `"bottom"`. */
|
|
1430
|
+
placement: "top" | "bottom";
|
|
1431
|
+
}
|
|
1432
|
+
/**
|
|
1433
|
+
* Viewport-collision for HAND-ROLLED floating panels (the Radix ones flip/shift
|
|
1434
|
+
* on their own). Given the open state and a ref to the absolutely-positioned
|
|
1435
|
+
* panel, returns a horizontal `shift`, a `maxHeight`, and a `placement` that keep
|
|
1436
|
+
* it inside the viewport and any scroll/clipping ancestor — flipping above the
|
|
1437
|
+
* trigger when the usable space below is too small and there's more room above.
|
|
1438
|
+
* Measures via untransformed `offset*` / `getBoundingClientRect` so an in-flight
|
|
1439
|
+
* scale/translate animation doesn't skew it.
|
|
1440
|
+
*/
|
|
1441
|
+
declare function useAnchoredPosition(open: boolean, panelRef: React.RefObject<HTMLElement | null>, opts?: {
|
|
1442
|
+
gutter?: number;
|
|
1443
|
+
minHeight?: number;
|
|
1444
|
+
}): AnchoredPosition;
|
|
1261
1445
|
|
|
1262
1446
|
/**
|
|
1263
1447
|
* Runtime theming for YunUI's token system.
|
|
@@ -1406,4 +1590,70 @@ declare function readTheme(el?: HTMLElement | null): YunUITheme;
|
|
|
1406
1590
|
*/
|
|
1407
1591
|
declare function useYunUITheme(defaults?: YunUITheme): [YunUITheme, (patch: YunUITheme) => void];
|
|
1408
1592
|
|
|
1409
|
-
|
|
1593
|
+
interface CommandPaletteItem {
|
|
1594
|
+
id: string;
|
|
1595
|
+
/** Primary line. */
|
|
1596
|
+
title: ReactNode;
|
|
1597
|
+
/** Secondary line under the title. */
|
|
1598
|
+
description?: ReactNode;
|
|
1599
|
+
/** Leading glyph. */
|
|
1600
|
+
icon?: ReactNode;
|
|
1601
|
+
/** Group heading this item sits under. */
|
|
1602
|
+
group?: string;
|
|
1603
|
+
/** Run on select. */
|
|
1604
|
+
onSelect?: () => void;
|
|
1605
|
+
/**
|
|
1606
|
+
* Navigate here on select. When set, the row renders as a real anchor
|
|
1607
|
+
* (through the adapter's `Link`) rather than a button — so ⌘-click,
|
|
1608
|
+
* middle-click and "open in new tab" work, and the destination shows in the
|
|
1609
|
+
* status bar. A search result is a link; a command is a button.
|
|
1610
|
+
*/
|
|
1611
|
+
href?: string;
|
|
1612
|
+
}
|
|
1613
|
+
interface CommandPaletteProps {
|
|
1614
|
+
open: boolean;
|
|
1615
|
+
onClose: () => void;
|
|
1616
|
+
/** Current query — controlled, so the host can drive a remote search. */
|
|
1617
|
+
query: string;
|
|
1618
|
+
onQueryChange: (query: string) => void;
|
|
1619
|
+
/** Results to show. */
|
|
1620
|
+
items?: CommandPaletteItem[];
|
|
1621
|
+
/** Show a spinner in place of the list. */
|
|
1622
|
+
loading?: boolean;
|
|
1623
|
+
/** Rendered when there is a query but no results. */
|
|
1624
|
+
empty?: ReactNode;
|
|
1625
|
+
/** Rendered before anything is typed — recents, shortcuts, tips. */
|
|
1626
|
+
initial?: ReactNode;
|
|
1627
|
+
/**
|
|
1628
|
+
* A hint bar under the list — result counts, keyboard legends. Omit it and
|
|
1629
|
+
* the bar is not rendered at all.
|
|
1630
|
+
*/
|
|
1631
|
+
footer?: ReactNode;
|
|
1632
|
+
/** Every string this renders. */
|
|
1633
|
+
labels?: {
|
|
1634
|
+
placeholder?: string;
|
|
1635
|
+
title?: string;
|
|
1636
|
+
close?: string;
|
|
1637
|
+
};
|
|
1638
|
+
className?: string;
|
|
1639
|
+
}
|
|
1640
|
+
/**
|
|
1641
|
+
* The ⌘K command palette: a centered overlay with one input, a keyboard-driven
|
|
1642
|
+
* result list, and Escape to leave.
|
|
1643
|
+
*
|
|
1644
|
+
* Controlled on purpose — `query` and `items` live with the host, so the same
|
|
1645
|
+
* component covers a local fuzzy filter and a debounced server search without
|
|
1646
|
+
* knowing which it is. Pair it with {@link useCommandPaletteShortcut}.
|
|
1647
|
+
*
|
|
1648
|
+
* Arrow keys move the cursor and Enter selects, so the list is reachable
|
|
1649
|
+
* without touching the mouse; the cursor resets whenever the results change so
|
|
1650
|
+
* it never points at a row that has scrolled out from under it.
|
|
1651
|
+
*/
|
|
1652
|
+
declare function CommandPalette({ open, onClose, query, onQueryChange, items, loading, empty, initial, footer, labels, className, }: CommandPaletteProps): React$1.ReactPortal | null;
|
|
1653
|
+
/**
|
|
1654
|
+
* Opens the palette on ⌘K / Ctrl-K. Kept separate so a host that already owns a
|
|
1655
|
+
* shortcut layer can skip it.
|
|
1656
|
+
*/
|
|
1657
|
+
declare function useCommandPaletteShortcut(onOpen: () => void): void;
|
|
1658
|
+
|
|
1659
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AnimatedNumber, type AnimatedNumberProps, AreaChart, type AreaChartPoint, type AreaChartProps, type AreaChartTone, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, type BarSegment, BentoCard, BentoGrid, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, type CheckboxProps, Collapsible, CollapsibleContent, type CollapsibleContentProps, type CollapsibleProps, CollapsibleTrigger, type CollapsibleTriggerProps, Column, Combobox, type ComboboxOption, CommandPalette, type CommandPaletteItem, type CommandPaletteProps, ConfirmModal, type ConfirmModalVariant, CustomSelect, DeleteConfirmModal, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, FileDropzone, type FileDropzoneProps, Flex, type FlexProps, Gauge, type GaugeProps, type GaugeTone, Grid, type GridCount, type GridProps, IconButton, InlineCode, InlineStatus, type InlineStatusKind, Input, Kbd, Label, type LabelProps, Marquee, Modal, MotionDiv, MotionSpan, type NavTab, NavTabs, NumberInput, PageLoader, Pagination, type PaginationProps, PasswordInput, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, RegenerateConfirmModal, Row, ScrollArea, ScrollBar, SearchInput, type SegmentTone, SegmentedBar, type SegmentedBarProps, type SegmentedOption, SegmentedSelect, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectOption, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, ShinyButton, Skeleton, Slider, type SpacingScale, Sparkline, type SparklineProps, type SparklineTone, Spinner, Stack, StatusIndicator, Steps, Switch, type SwitchProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TableBody as Tbody, TableCell as Td, TextShimmer, type TextShimmerProps, Textarea, TableFooter as Tfoot, TableHead as Th, TableHeader as Thead, ThemeToggle, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TableRow as Tr, YUNUI_PALETTES, YUNUI_THEME_PRESETS, type YunUIAccentSource, type YunUIColorScheme, type YunUIPalette, type YunUISolid, type YunUISurface, type YunUITheme, type YunUIThemePreset, type YunUIThemePresetName, applyTheme, cn, fadeIn, readTheme, staggerContainer, staggerItem, toast, useAnchoredPosition, useBodyScrollLock, useCommandPaletteShortcut, useDismissOnOutside, useEscapeKey, useFocusTrap, useModalBehavior, useScrollableTabStop, useYunUITheme };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { AnimatedNumber, AreaChart, BentoCard, BentoGrid, Collapsible, CollapsibleContent, CollapsibleTrigger, CustomSelect, FileDropzone, Gauge, Marquee, NavTabs, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, ScrollArea, ScrollBar, SegmentedBar, SegmentedSelect, ShinyButton, Sparkline, Switch, Toaster, YUNUI_PALETTES, YUNUI_THEME_PRESETS, applyTheme, readTheme, toast, useYunUITheme } from './chunk-
|
|
3
|
-
export { TextShimmer, ThemeToggle } from './chunk-
|
|
4
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Column, Combobox, ConfirmModal, DeleteConfirmModal, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, Flex, Grid, IconButton, InlineCode, InlineStatus, Input, Kbd, Label, Modal, MotionDiv, MotionSpan, NumberInput, PageLoader, Pagination, PasswordInput, Progress, RadioGroup, RadioGroupItem, RegenerateConfirmModal, Row, SearchInput, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, Skeleton, Slider, Spinner, Stack, StatusIndicator, Steps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TableBody as Tbody, TableCell as Td, Textarea, TableFooter as Tfoot, TableHead as Th, TableHeader as Thead, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TableRow as Tr, fadeIn, staggerContainer, staggerItem
|
|
5
|
-
export { cn } from './chunk-
|
|
2
|
+
export { AnimatedNumber, AreaChart, BentoCard, BentoGrid, Collapsible, CollapsibleContent, CollapsibleTrigger, CommandPalette, CustomSelect, FileDropzone, Gauge, Marquee, NavTabs, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, ScrollArea, ScrollBar, SegmentedBar, SegmentedSelect, ShinyButton, Sparkline, Switch, Toaster, YUNUI_PALETTES, YUNUI_THEME_PRESETS, applyTheme, readTheme, toast, useCommandPaletteShortcut, useYunUITheme } from './chunk-AFVENY4D.js';
|
|
3
|
+
export { TextShimmer, ThemeToggle } from './chunk-GAXVET76.js';
|
|
4
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Column, Combobox, ConfirmModal, DeleteConfirmModal, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, Flex, Grid, IconButton, InlineCode, InlineStatus, Input, Kbd, Label, Modal, MotionDiv, MotionSpan, NumberInput, PageLoader, Pagination, PasswordInput, Progress, RadioGroup, RadioGroupItem, RegenerateConfirmModal, Row, SearchInput, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, Skeleton, Slider, Spinner, Stack, StatusIndicator, Steps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TableBody as Tbody, TableCell as Td, Textarea, TableFooter as Tfoot, TableHead as Th, TableHeader as Thead, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TableRow as Tr, fadeIn, staggerContainer, staggerItem } from './chunk-YKWRCA2S.js';
|
|
5
|
+
export { cn, useAnchoredPosition, useBodyScrollLock, useDismissOnOutside, useEscapeKey, useFocusTrap, useModalBehavior, useScrollableTabStop } from './chunk-V7VJKZ5Q.js';
|
|
6
6
|
import './chunk-3RT24MSH.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
8
8
|
//# sourceMappingURL=index.js.map
|