@refraction-ui/react 0.18.1 → 0.18.3
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 +125 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +125 -72
- package/dist/index.js.map +1 -1
- package/dist/internal/react-dropdown-menu/index.d.cts +5 -0
- package/dist/internal/react-dropdown-menu/index.d.ts +5 -0
- package/dist/internal/react-feedback-dialog/index.d.cts +5 -19
- package/dist/internal/react-feedback-dialog/index.d.ts +5 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8358,7 +8358,7 @@ function MessageRow({
|
|
|
8358
8358
|
"div",
|
|
8359
8359
|
{ className: "flex items-baseline gap-2" },
|
|
8360
8360
|
h2("span", { className: "text-sm font-semibold" }, message.author.name),
|
|
8361
|
-
h2("span", { className: "text-xs text-muted-foreground", title: message.timestamp.
|
|
8361
|
+
h2("span", { className: "text-xs text-muted-foreground", title: message.timestamp.toISOString() }, formatTimestamp(message.timestamp)),
|
|
8362
8362
|
message.edited ? h2("span", { className: "text-xs text-muted-foreground" }, "(edited)") : null
|
|
8363
8363
|
),
|
|
8364
8364
|
inner
|
|
@@ -8372,7 +8372,7 @@ function MessageRow({
|
|
|
8372
8372
|
"div",
|
|
8373
8373
|
{ className: "flex items-baseline gap-2" },
|
|
8374
8374
|
message.edited ? h2("span", { className: "text-xs text-muted-foreground" }, "(edited)") : null,
|
|
8375
|
-
h2("span", { className: "text-xs text-muted-foreground", title: message.timestamp.
|
|
8375
|
+
h2("span", { className: "text-xs text-muted-foreground", title: message.timestamp.toISOString() }, formatTimestamp(message.timestamp)),
|
|
8376
8376
|
h2("span", { className: "text-sm font-semibold" }, message.author.name)
|
|
8377
8377
|
),
|
|
8378
8378
|
h2("div", { className: "mt-0.5 flex max-w-[80%] flex-col items-end" }, inner)
|
|
@@ -9786,25 +9786,47 @@ function DropdownMenu({
|
|
|
9786
9786
|
}
|
|
9787
9787
|
DropdownMenu.displayName = "DropdownMenu";
|
|
9788
9788
|
var DropdownMenuTrigger = React23.forwardRef(
|
|
9789
|
-
({ onClick, children, ...props }, ref) => {
|
|
9789
|
+
({ asChild = false, onClick, children, ...props }, ref) => {
|
|
9790
9790
|
const { open, onOpenChange, contentId } = useDropdownMenuContext();
|
|
9791
9791
|
const handleClick = (e) => {
|
|
9792
9792
|
onOpenChange(!open);
|
|
9793
9793
|
onClick?.(e);
|
|
9794
9794
|
};
|
|
9795
|
-
|
|
9796
|
-
"button",
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9795
|
+
const triggerProps = {
|
|
9796
|
+
type: "button",
|
|
9797
|
+
"aria-expanded": open,
|
|
9798
|
+
"aria-controls": contentId,
|
|
9799
|
+
"aria-haspopup": "menu",
|
|
9800
|
+
onClick: handleClick,
|
|
9801
|
+
...props
|
|
9802
|
+
};
|
|
9803
|
+
if (asChild) {
|
|
9804
|
+
if (!React23.isValidElement(children)) {
|
|
9805
|
+
devWarn(
|
|
9806
|
+
"dropdown-menu-trigger-asChild-child",
|
|
9807
|
+
"DropdownMenuTrigger: `asChild` expects a single React element child; rendering nothing."
|
|
9808
|
+
);
|
|
9809
|
+
return null;
|
|
9810
|
+
}
|
|
9811
|
+
const child = children;
|
|
9812
|
+
const childOnClick = child.props.onClick;
|
|
9813
|
+
const childRef = child.ref;
|
|
9814
|
+
const mergedProps = {
|
|
9815
|
+
...triggerProps,
|
|
9816
|
+
onClick: (e) => {
|
|
9817
|
+
childOnClick?.(e);
|
|
9818
|
+
if (!e.defaultPrevented) handleClick(e);
|
|
9819
|
+
},
|
|
9820
|
+
ref: (node) => {
|
|
9821
|
+
if (typeof ref === "function") ref(node);
|
|
9822
|
+
else if (ref) ref.current = node;
|
|
9823
|
+
if (typeof childRef === "function") childRef(node);
|
|
9824
|
+
else if (childRef) childRef.current = node;
|
|
9825
|
+
}
|
|
9826
|
+
};
|
|
9827
|
+
return React23.cloneElement(child, mergedProps);
|
|
9828
|
+
}
|
|
9829
|
+
return React23.createElement("button", { ref, ...triggerProps }, children);
|
|
9808
9830
|
}
|
|
9809
9831
|
);
|
|
9810
9832
|
DropdownMenuTrigger.displayName = "DropdownMenuTrigger";
|
|
@@ -9998,12 +10020,14 @@ var feedbackDialogVariants = cva({
|
|
|
9998
10020
|
// ../react-feedback-dialog/dist/index.js
|
|
9999
10021
|
function FeedbackDialog({
|
|
10000
10022
|
open: controlledOpen,
|
|
10023
|
+
defaultOpen = false,
|
|
10001
10024
|
onOpenChange,
|
|
10002
10025
|
onSubmit,
|
|
10003
10026
|
type = "general",
|
|
10004
|
-
className
|
|
10027
|
+
className,
|
|
10028
|
+
children
|
|
10005
10029
|
}) {
|
|
10006
|
-
const [open, setOpen] = React23.useState(controlledOpen ??
|
|
10030
|
+
const [open, setOpen] = React23.useState(controlledOpen ?? defaultOpen);
|
|
10007
10031
|
const [comment, setComment] = React23.useState("");
|
|
10008
10032
|
const [email, setEmail] = React23.useState("");
|
|
10009
10033
|
const [honeypot, setHoneypot] = React23.useState("");
|
|
@@ -10048,73 +10072,97 @@ function FeedbackDialog({
|
|
|
10048
10072
|
setIsSubmitting(false);
|
|
10049
10073
|
setIsSubmitted(false);
|
|
10050
10074
|
}, []);
|
|
10051
|
-
if (!isOpen) return null;
|
|
10052
10075
|
const api = apiRef.current;
|
|
10076
|
+
const trigger = React23.isValidElement(children) ? (() => {
|
|
10077
|
+
const child = children;
|
|
10078
|
+
const childOnClick = child.props.onClick;
|
|
10079
|
+
const childRef = child.ref;
|
|
10080
|
+
return React23.cloneElement(child, {
|
|
10081
|
+
onClick: (e) => {
|
|
10082
|
+
childOnClick?.(e);
|
|
10083
|
+
if (!e.defaultPrevented) handleOpenChange(true);
|
|
10084
|
+
},
|
|
10085
|
+
ref: (node) => {
|
|
10086
|
+
if (typeof childRef === "function") childRef(node);
|
|
10087
|
+
else if (childRef) childRef.current = node;
|
|
10088
|
+
}
|
|
10089
|
+
});
|
|
10090
|
+
})() : children;
|
|
10053
10091
|
if (isSubmitted) {
|
|
10054
10092
|
return React23.createElement(
|
|
10093
|
+
React23.Fragment,
|
|
10094
|
+
null,
|
|
10095
|
+
trigger,
|
|
10096
|
+
React23.createElement(
|
|
10097
|
+
"div",
|
|
10098
|
+
{
|
|
10099
|
+
className: cn(feedbackDialogVariants({ type }), className),
|
|
10100
|
+
...api.ariaProps,
|
|
10101
|
+
"data-state": "submitted"
|
|
10102
|
+
},
|
|
10103
|
+
React23.createElement("p", { "data-testid": "success-message" }, "Thank you for your feedback!"),
|
|
10104
|
+
React23.createElement(
|
|
10105
|
+
"button",
|
|
10106
|
+
{
|
|
10107
|
+
type: "button",
|
|
10108
|
+
onClick: () => {
|
|
10109
|
+
handleReset();
|
|
10110
|
+
handleOpenChange(false);
|
|
10111
|
+
}
|
|
10112
|
+
},
|
|
10113
|
+
"Close"
|
|
10114
|
+
)
|
|
10115
|
+
)
|
|
10116
|
+
);
|
|
10117
|
+
}
|
|
10118
|
+
return React23.createElement(
|
|
10119
|
+
React23.Fragment,
|
|
10120
|
+
null,
|
|
10121
|
+
trigger,
|
|
10122
|
+
isOpen ? React23.createElement(
|
|
10055
10123
|
"div",
|
|
10056
10124
|
{
|
|
10057
10125
|
className: cn(feedbackDialogVariants({ type }), className),
|
|
10058
10126
|
...api.ariaProps,
|
|
10059
|
-
"data-state": "
|
|
10127
|
+
"data-state": "open"
|
|
10060
10128
|
},
|
|
10061
|
-
React23.createElement("
|
|
10129
|
+
React23.createElement("h2", { id: `${api.ariaProps.id}-title` }, "Send Feedback"),
|
|
10130
|
+
React23.createElement("textarea", {
|
|
10131
|
+
"aria-label": "Feedback comment",
|
|
10132
|
+
value: comment,
|
|
10133
|
+
onChange: (e) => setComment(e.target.value),
|
|
10134
|
+
placeholder: "Your feedback...",
|
|
10135
|
+
disabled: isSubmitting
|
|
10136
|
+
}),
|
|
10137
|
+
React23.createElement("input", {
|
|
10138
|
+
type: "email",
|
|
10139
|
+
"aria-label": "Email",
|
|
10140
|
+
value: email,
|
|
10141
|
+
onChange: (e) => setEmail(e.target.value),
|
|
10142
|
+
placeholder: "Email (optional)",
|
|
10143
|
+
disabled: isSubmitting
|
|
10144
|
+
}),
|
|
10145
|
+
// Honeypot field — hidden from real users
|
|
10146
|
+
React23.createElement("input", {
|
|
10147
|
+
type: "text",
|
|
10148
|
+
"aria-hidden": true,
|
|
10149
|
+
tabIndex: -1,
|
|
10150
|
+
style: { position: "absolute", left: "-9999px" },
|
|
10151
|
+
value: honeypot,
|
|
10152
|
+
onChange: (e) => setHoneypot(e.target.value),
|
|
10153
|
+
autoComplete: "off",
|
|
10154
|
+
name: "website"
|
|
10155
|
+
}),
|
|
10062
10156
|
React23.createElement(
|
|
10063
10157
|
"button",
|
|
10064
10158
|
{
|
|
10065
10159
|
type: "button",
|
|
10066
|
-
onClick:
|
|
10067
|
-
|
|
10068
|
-
handleOpenChange(false);
|
|
10069
|
-
}
|
|
10160
|
+
onClick: handleSubmit,
|
|
10161
|
+
disabled: isSubmitting || !comment.trim()
|
|
10070
10162
|
},
|
|
10071
|
-
"
|
|
10163
|
+
isSubmitting ? "Submitting..." : "Submit"
|
|
10072
10164
|
)
|
|
10073
|
-
)
|
|
10074
|
-
}
|
|
10075
|
-
return React23.createElement(
|
|
10076
|
-
"div",
|
|
10077
|
-
{
|
|
10078
|
-
className: cn(feedbackDialogVariants({ type }), className),
|
|
10079
|
-
...api.ariaProps,
|
|
10080
|
-
"data-state": "open"
|
|
10081
|
-
},
|
|
10082
|
-
React23.createElement("h2", { id: `${api.ariaProps.id}-title` }, "Send Feedback"),
|
|
10083
|
-
React23.createElement("textarea", {
|
|
10084
|
-
"aria-label": "Feedback comment",
|
|
10085
|
-
value: comment,
|
|
10086
|
-
onChange: (e) => setComment(e.target.value),
|
|
10087
|
-
placeholder: "Your feedback...",
|
|
10088
|
-
disabled: isSubmitting
|
|
10089
|
-
}),
|
|
10090
|
-
React23.createElement("input", {
|
|
10091
|
-
type: "email",
|
|
10092
|
-
"aria-label": "Email",
|
|
10093
|
-
value: email,
|
|
10094
|
-
onChange: (e) => setEmail(e.target.value),
|
|
10095
|
-
placeholder: "Email (optional)",
|
|
10096
|
-
disabled: isSubmitting
|
|
10097
|
-
}),
|
|
10098
|
-
// Honeypot field — hidden from real users
|
|
10099
|
-
React23.createElement("input", {
|
|
10100
|
-
type: "text",
|
|
10101
|
-
"aria-hidden": true,
|
|
10102
|
-
tabIndex: -1,
|
|
10103
|
-
style: { position: "absolute", left: "-9999px" },
|
|
10104
|
-
value: honeypot,
|
|
10105
|
-
onChange: (e) => setHoneypot(e.target.value),
|
|
10106
|
-
autoComplete: "off",
|
|
10107
|
-
name: "website"
|
|
10108
|
-
}),
|
|
10109
|
-
React23.createElement(
|
|
10110
|
-
"button",
|
|
10111
|
-
{
|
|
10112
|
-
type: "button",
|
|
10113
|
-
onClick: handleSubmit,
|
|
10114
|
-
disabled: isSubmitting || !comment.trim()
|
|
10115
|
-
},
|
|
10116
|
-
isSubmitting ? "Submitting..." : "Submit"
|
|
10117
|
-
)
|
|
10165
|
+
) : null
|
|
10118
10166
|
);
|
|
10119
10167
|
}
|
|
10120
10168
|
FeedbackDialog.displayName = "FeedbackDialog";
|
|
@@ -14357,7 +14405,12 @@ var SlideViewer = React23.forwardRef(
|
|
|
14357
14405
|
const containerClasses = cn(slideViewerVariants({ size }), className);
|
|
14358
14406
|
const currentSlide = slides[api.state.currentSlide];
|
|
14359
14407
|
const slideAriaProps = api.getSlideAriaProps();
|
|
14360
|
-
|
|
14408
|
+
function handleKeyDown(event) {
|
|
14409
|
+
const handler = api.keyboardHandlers[event.key];
|
|
14410
|
+
if (!handler) return;
|
|
14411
|
+
handler(event);
|
|
14412
|
+
rerender();
|
|
14413
|
+
}
|
|
14361
14414
|
function handlePrev() {
|
|
14362
14415
|
api.prev();
|
|
14363
14416
|
rerender();
|