@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.cjs
CHANGED
|
@@ -38426,7 +38426,7 @@ function MessageRow({
|
|
|
38426
38426
|
"div",
|
|
38427
38427
|
{ className: "flex items-baseline gap-2" },
|
|
38428
38428
|
h2("span", { className: "text-sm font-semibold" }, message.author.name),
|
|
38429
|
-
h2("span", { className: "text-xs text-muted-foreground", title: message.timestamp.
|
|
38429
|
+
h2("span", { className: "text-xs text-muted-foreground", title: message.timestamp.toISOString() }, formatTimestamp(message.timestamp)),
|
|
38430
38430
|
message.edited ? h2("span", { className: "text-xs text-muted-foreground" }, "(edited)") : null
|
|
38431
38431
|
),
|
|
38432
38432
|
inner
|
|
@@ -38440,7 +38440,7 @@ function MessageRow({
|
|
|
38440
38440
|
"div",
|
|
38441
38441
|
{ className: "flex items-baseline gap-2" },
|
|
38442
38442
|
message.edited ? h2("span", { className: "text-xs text-muted-foreground" }, "(edited)") : null,
|
|
38443
|
-
h2("span", { className: "text-xs text-muted-foreground", title: message.timestamp.
|
|
38443
|
+
h2("span", { className: "text-xs text-muted-foreground", title: message.timestamp.toISOString() }, formatTimestamp(message.timestamp)),
|
|
38444
38444
|
h2("span", { className: "text-sm font-semibold" }, message.author.name)
|
|
38445
38445
|
),
|
|
38446
38446
|
h2("div", { className: "mt-0.5 flex max-w-[80%] flex-col items-end" }, inner)
|
|
@@ -39854,25 +39854,47 @@ function DropdownMenu({
|
|
|
39854
39854
|
}
|
|
39855
39855
|
DropdownMenu.displayName = "DropdownMenu";
|
|
39856
39856
|
var DropdownMenuTrigger = React23__namespace.forwardRef(
|
|
39857
|
-
({ onClick, children, ...props }, ref) => {
|
|
39857
|
+
({ asChild = false, onClick, children, ...props }, ref) => {
|
|
39858
39858
|
const { open, onOpenChange, contentId } = useDropdownMenuContext();
|
|
39859
39859
|
const handleClick = (e2) => {
|
|
39860
39860
|
onOpenChange(!open);
|
|
39861
39861
|
onClick?.(e2);
|
|
39862
39862
|
};
|
|
39863
|
-
|
|
39864
|
-
"button",
|
|
39865
|
-
|
|
39866
|
-
|
|
39867
|
-
|
|
39868
|
-
|
|
39869
|
-
|
|
39870
|
-
|
|
39871
|
-
|
|
39872
|
-
|
|
39873
|
-
|
|
39874
|
-
|
|
39875
|
-
|
|
39863
|
+
const triggerProps = {
|
|
39864
|
+
type: "button",
|
|
39865
|
+
"aria-expanded": open,
|
|
39866
|
+
"aria-controls": contentId,
|
|
39867
|
+
"aria-haspopup": "menu",
|
|
39868
|
+
onClick: handleClick,
|
|
39869
|
+
...props
|
|
39870
|
+
};
|
|
39871
|
+
if (asChild) {
|
|
39872
|
+
if (!React23__namespace.isValidElement(children)) {
|
|
39873
|
+
devWarn(
|
|
39874
|
+
"dropdown-menu-trigger-asChild-child",
|
|
39875
|
+
"DropdownMenuTrigger: `asChild` expects a single React element child; rendering nothing."
|
|
39876
|
+
);
|
|
39877
|
+
return null;
|
|
39878
|
+
}
|
|
39879
|
+
const child = children;
|
|
39880
|
+
const childOnClick = child.props.onClick;
|
|
39881
|
+
const childRef = child.ref;
|
|
39882
|
+
const mergedProps = {
|
|
39883
|
+
...triggerProps,
|
|
39884
|
+
onClick: (e2) => {
|
|
39885
|
+
childOnClick?.(e2);
|
|
39886
|
+
if (!e2.defaultPrevented) handleClick(e2);
|
|
39887
|
+
},
|
|
39888
|
+
ref: (node) => {
|
|
39889
|
+
if (typeof ref === "function") ref(node);
|
|
39890
|
+
else if (ref) ref.current = node;
|
|
39891
|
+
if (typeof childRef === "function") childRef(node);
|
|
39892
|
+
else if (childRef) childRef.current = node;
|
|
39893
|
+
}
|
|
39894
|
+
};
|
|
39895
|
+
return React23__namespace.cloneElement(child, mergedProps);
|
|
39896
|
+
}
|
|
39897
|
+
return React23__namespace.createElement("button", { ref, ...triggerProps }, children);
|
|
39876
39898
|
}
|
|
39877
39899
|
);
|
|
39878
39900
|
DropdownMenuTrigger.displayName = "DropdownMenuTrigger";
|
|
@@ -40066,12 +40088,14 @@ var feedbackDialogVariants = cva({
|
|
|
40066
40088
|
// ../react-feedback-dialog/dist/index.js
|
|
40067
40089
|
function FeedbackDialog({
|
|
40068
40090
|
open: controlledOpen,
|
|
40091
|
+
defaultOpen = false,
|
|
40069
40092
|
onOpenChange,
|
|
40070
40093
|
onSubmit,
|
|
40071
40094
|
type = "general",
|
|
40072
|
-
className
|
|
40095
|
+
className,
|
|
40096
|
+
children
|
|
40073
40097
|
}) {
|
|
40074
|
-
const [open, setOpen] = React23__namespace.useState(controlledOpen ??
|
|
40098
|
+
const [open, setOpen] = React23__namespace.useState(controlledOpen ?? defaultOpen);
|
|
40075
40099
|
const [comment, setComment] = React23__namespace.useState("");
|
|
40076
40100
|
const [email, setEmail] = React23__namespace.useState("");
|
|
40077
40101
|
const [honeypot, setHoneypot] = React23__namespace.useState("");
|
|
@@ -40116,73 +40140,97 @@ function FeedbackDialog({
|
|
|
40116
40140
|
setIsSubmitting(false);
|
|
40117
40141
|
setIsSubmitted(false);
|
|
40118
40142
|
}, []);
|
|
40119
|
-
if (!isOpen) return null;
|
|
40120
40143
|
const api = apiRef.current;
|
|
40144
|
+
const trigger = React23__namespace.isValidElement(children) ? (() => {
|
|
40145
|
+
const child = children;
|
|
40146
|
+
const childOnClick = child.props.onClick;
|
|
40147
|
+
const childRef = child.ref;
|
|
40148
|
+
return React23__namespace.cloneElement(child, {
|
|
40149
|
+
onClick: (e2) => {
|
|
40150
|
+
childOnClick?.(e2);
|
|
40151
|
+
if (!e2.defaultPrevented) handleOpenChange(true);
|
|
40152
|
+
},
|
|
40153
|
+
ref: (node) => {
|
|
40154
|
+
if (typeof childRef === "function") childRef(node);
|
|
40155
|
+
else if (childRef) childRef.current = node;
|
|
40156
|
+
}
|
|
40157
|
+
});
|
|
40158
|
+
})() : children;
|
|
40121
40159
|
if (isSubmitted) {
|
|
40122
40160
|
return React23__namespace.createElement(
|
|
40161
|
+
React23__namespace.Fragment,
|
|
40162
|
+
null,
|
|
40163
|
+
trigger,
|
|
40164
|
+
React23__namespace.createElement(
|
|
40165
|
+
"div",
|
|
40166
|
+
{
|
|
40167
|
+
className: cn(feedbackDialogVariants({ type }), className),
|
|
40168
|
+
...api.ariaProps,
|
|
40169
|
+
"data-state": "submitted"
|
|
40170
|
+
},
|
|
40171
|
+
React23__namespace.createElement("p", { "data-testid": "success-message" }, "Thank you for your feedback!"),
|
|
40172
|
+
React23__namespace.createElement(
|
|
40173
|
+
"button",
|
|
40174
|
+
{
|
|
40175
|
+
type: "button",
|
|
40176
|
+
onClick: () => {
|
|
40177
|
+
handleReset();
|
|
40178
|
+
handleOpenChange(false);
|
|
40179
|
+
}
|
|
40180
|
+
},
|
|
40181
|
+
"Close"
|
|
40182
|
+
)
|
|
40183
|
+
)
|
|
40184
|
+
);
|
|
40185
|
+
}
|
|
40186
|
+
return React23__namespace.createElement(
|
|
40187
|
+
React23__namespace.Fragment,
|
|
40188
|
+
null,
|
|
40189
|
+
trigger,
|
|
40190
|
+
isOpen ? React23__namespace.createElement(
|
|
40123
40191
|
"div",
|
|
40124
40192
|
{
|
|
40125
40193
|
className: cn(feedbackDialogVariants({ type }), className),
|
|
40126
40194
|
...api.ariaProps,
|
|
40127
|
-
"data-state": "
|
|
40195
|
+
"data-state": "open"
|
|
40128
40196
|
},
|
|
40129
|
-
React23__namespace.createElement("
|
|
40197
|
+
React23__namespace.createElement("h2", { id: `${api.ariaProps.id}-title` }, "Send Feedback"),
|
|
40198
|
+
React23__namespace.createElement("textarea", {
|
|
40199
|
+
"aria-label": "Feedback comment",
|
|
40200
|
+
value: comment,
|
|
40201
|
+
onChange: (e2) => setComment(e2.target.value),
|
|
40202
|
+
placeholder: "Your feedback...",
|
|
40203
|
+
disabled: isSubmitting
|
|
40204
|
+
}),
|
|
40205
|
+
React23__namespace.createElement("input", {
|
|
40206
|
+
type: "email",
|
|
40207
|
+
"aria-label": "Email",
|
|
40208
|
+
value: email,
|
|
40209
|
+
onChange: (e2) => setEmail(e2.target.value),
|
|
40210
|
+
placeholder: "Email (optional)",
|
|
40211
|
+
disabled: isSubmitting
|
|
40212
|
+
}),
|
|
40213
|
+
// Honeypot field — hidden from real users
|
|
40214
|
+
React23__namespace.createElement("input", {
|
|
40215
|
+
type: "text",
|
|
40216
|
+
"aria-hidden": true,
|
|
40217
|
+
tabIndex: -1,
|
|
40218
|
+
style: { position: "absolute", left: "-9999px" },
|
|
40219
|
+
value: honeypot,
|
|
40220
|
+
onChange: (e2) => setHoneypot(e2.target.value),
|
|
40221
|
+
autoComplete: "off",
|
|
40222
|
+
name: "website"
|
|
40223
|
+
}),
|
|
40130
40224
|
React23__namespace.createElement(
|
|
40131
40225
|
"button",
|
|
40132
40226
|
{
|
|
40133
40227
|
type: "button",
|
|
40134
|
-
onClick:
|
|
40135
|
-
|
|
40136
|
-
handleOpenChange(false);
|
|
40137
|
-
}
|
|
40228
|
+
onClick: handleSubmit,
|
|
40229
|
+
disabled: isSubmitting || !comment.trim()
|
|
40138
40230
|
},
|
|
40139
|
-
"
|
|
40231
|
+
isSubmitting ? "Submitting..." : "Submit"
|
|
40140
40232
|
)
|
|
40141
|
-
)
|
|
40142
|
-
}
|
|
40143
|
-
return React23__namespace.createElement(
|
|
40144
|
-
"div",
|
|
40145
|
-
{
|
|
40146
|
-
className: cn(feedbackDialogVariants({ type }), className),
|
|
40147
|
-
...api.ariaProps,
|
|
40148
|
-
"data-state": "open"
|
|
40149
|
-
},
|
|
40150
|
-
React23__namespace.createElement("h2", { id: `${api.ariaProps.id}-title` }, "Send Feedback"),
|
|
40151
|
-
React23__namespace.createElement("textarea", {
|
|
40152
|
-
"aria-label": "Feedback comment",
|
|
40153
|
-
value: comment,
|
|
40154
|
-
onChange: (e2) => setComment(e2.target.value),
|
|
40155
|
-
placeholder: "Your feedback...",
|
|
40156
|
-
disabled: isSubmitting
|
|
40157
|
-
}),
|
|
40158
|
-
React23__namespace.createElement("input", {
|
|
40159
|
-
type: "email",
|
|
40160
|
-
"aria-label": "Email",
|
|
40161
|
-
value: email,
|
|
40162
|
-
onChange: (e2) => setEmail(e2.target.value),
|
|
40163
|
-
placeholder: "Email (optional)",
|
|
40164
|
-
disabled: isSubmitting
|
|
40165
|
-
}),
|
|
40166
|
-
// Honeypot field — hidden from real users
|
|
40167
|
-
React23__namespace.createElement("input", {
|
|
40168
|
-
type: "text",
|
|
40169
|
-
"aria-hidden": true,
|
|
40170
|
-
tabIndex: -1,
|
|
40171
|
-
style: { position: "absolute", left: "-9999px" },
|
|
40172
|
-
value: honeypot,
|
|
40173
|
-
onChange: (e2) => setHoneypot(e2.target.value),
|
|
40174
|
-
autoComplete: "off",
|
|
40175
|
-
name: "website"
|
|
40176
|
-
}),
|
|
40177
|
-
React23__namespace.createElement(
|
|
40178
|
-
"button",
|
|
40179
|
-
{
|
|
40180
|
-
type: "button",
|
|
40181
|
-
onClick: handleSubmit,
|
|
40182
|
-
disabled: isSubmitting || !comment.trim()
|
|
40183
|
-
},
|
|
40184
|
-
isSubmitting ? "Submitting..." : "Submit"
|
|
40185
|
-
)
|
|
40233
|
+
) : null
|
|
40186
40234
|
);
|
|
40187
40235
|
}
|
|
40188
40236
|
FeedbackDialog.displayName = "FeedbackDialog";
|
|
@@ -44425,7 +44473,12 @@ var SlideViewer = React23__namespace.forwardRef(
|
|
|
44425
44473
|
const containerClasses = cn(slideViewerVariants({ size }), className);
|
|
44426
44474
|
const currentSlide = slides[api.state.currentSlide];
|
|
44427
44475
|
const slideAriaProps = api.getSlideAriaProps();
|
|
44428
|
-
|
|
44476
|
+
function handleKeyDown(event) {
|
|
44477
|
+
const handler = api.keyboardHandlers[event.key];
|
|
44478
|
+
if (!handler) return;
|
|
44479
|
+
handler(event);
|
|
44480
|
+
rerender();
|
|
44481
|
+
}
|
|
44429
44482
|
function handlePrev() {
|
|
44430
44483
|
api.prev();
|
|
44431
44484
|
rerender();
|