@kumix/ui 0.3.0 → 0.3.1
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 +14 -1
- package/dist/components/custom/confirm-dialog.d.ts +16 -0
- package/dist/components/custom/confirm-dialog.d.ts.map +1 -0
- package/dist/components/custom/confirm-dialog.js +93 -0
- package/dist/components/custom/confirm-dialog.js.map +1 -0
- package/dist/components/custom/toast.d.ts +20 -0
- package/dist/components/custom/toast.d.ts.map +1 -0
- package/dist/components/custom/toast.js +73 -0
- package/dist/components/custom/toast.js.map +1 -0
- package/dist/components/motion/action-swap.js +1 -1
- package/dist/components/motion/animated-badge.js +2 -2
- package/dist/components/motion/animated-number.js +1 -1
- package/dist/components/motion/animated-sidebar.js +2 -2
- package/dist/components/motion/animated-toast-stack.js +4 -4
- package/dist/components/motion/animated-toast-stack.js.map +1 -1
- package/dist/components/motion/attachment-upload.d.ts +47 -0
- package/dist/components/motion/attachment-upload.d.ts.map +1 -0
- package/dist/components/motion/attachment-upload.js +737 -0
- package/dist/components/motion/attachment-upload.js.map +1 -0
- package/dist/components/motion/availability-scheduler/copy-menu.d.ts +10 -0
- package/dist/components/motion/availability-scheduler/copy-menu.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/copy-menu.js +3 -0
- package/dist/components/motion/availability-scheduler/day-row.d.ts +15 -0
- package/dist/components/motion/availability-scheduler/day-row.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/day-row.js +181 -0
- package/dist/components/motion/availability-scheduler/day-row.js.map +1 -0
- package/dist/components/motion/availability-scheduler/icon-button.d.ts +15 -0
- package/dist/components/motion/availability-scheduler/icon-button.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/icon-button.js +24 -0
- package/dist/components/motion/availability-scheduler/icon-button.js.map +1 -0
- package/dist/components/motion/availability-scheduler/index.d.ts +14 -0
- package/dist/components/motion/availability-scheduler/index.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/index.js +59 -0
- package/dist/components/motion/availability-scheduler/index.js.map +1 -0
- package/dist/components/motion/availability-scheduler/time-select.d.ts +10 -0
- package/dist/components/motion/availability-scheduler/time-select.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/time-select.js +26 -0
- package/dist/components/motion/availability-scheduler/time-select.js.map +1 -0
- package/dist/components/motion/bloom-menu.d.ts +17 -0
- package/dist/components/motion/bloom-menu.d.ts.map +1 -0
- package/dist/components/motion/bloom-menu.js +170 -0
- package/dist/components/motion/bloom-menu.js.map +1 -0
- package/dist/components/motion/bottom-sheet.js +1 -1
- package/dist/components/motion/bounce-sidebar.js +1 -1
- package/dist/components/motion/bouncy-accordion.js +2 -2
- package/dist/components/motion/button/base.js +1 -1
- package/dist/components/motion/button/index.d.ts +4 -0
- package/dist/components/motion/button/index.js +5 -0
- package/dist/components/motion/button/magnetic.js +1 -1
- package/dist/components/motion/button/stateful.js +2 -2
- package/dist/components/motion/center-morph-modal.js +2 -2
- package/dist/components/motion/checkbox.js +1 -1
- package/dist/components/motion/chromatic-text-reveal.js +1 -1
- package/dist/components/motion/command-palette.d.ts +26 -0
- package/dist/components/motion/command-palette.d.ts.map +1 -0
- package/dist/components/motion/command-palette.js +246 -0
- package/dist/components/motion/command-palette.js.map +1 -0
- package/dist/components/motion/context-menu.js +2 -2
- package/dist/components/motion/cylinder-carousel.js +1 -1
- package/dist/components/motion/dock.js +1 -1
- package/dist/components/motion/drawer.js +1 -1
- package/dist/components/motion/dynamic-island.d.ts +22 -0
- package/dist/components/motion/dynamic-island.d.ts.map +1 -0
- package/dist/components/motion/dynamic-island.js +143 -0
- package/dist/components/motion/dynamic-island.js.map +1 -0
- package/dist/components/motion/expandable-action-bar.d.ts +52 -0
- package/dist/components/motion/expandable-action-bar.d.ts.map +1 -0
- package/dist/components/motion/expandable-action-bar.js +191 -0
- package/dist/components/motion/expandable-action-bar.js.map +1 -0
- package/dist/components/motion/expandable-tabs.d.ts +33 -0
- package/dist/components/motion/expandable-tabs.d.ts.map +1 -0
- package/dist/components/motion/expandable-tabs.js +291 -0
- package/dist/components/motion/expandable-tabs.js.map +1 -0
- package/dist/components/motion/feedback-widget.d.ts +18 -0
- package/dist/components/motion/feedback-widget.d.ts.map +1 -0
- package/dist/components/motion/feedback-widget.js +413 -0
- package/dist/components/motion/feedback-widget.js.map +1 -0
- package/dist/components/motion/file-upload.d.ts +48 -0
- package/dist/components/motion/file-upload.d.ts.map +1 -0
- package/dist/components/motion/file-upload.js +382 -0
- package/dist/components/motion/file-upload.js.map +1 -0
- package/dist/components/motion/hold-action-button.js +1 -1
- package/dist/components/motion/infinite-masonry.d.ts +31 -0
- package/dist/components/motion/infinite-masonry.d.ts.map +1 -0
- package/dist/components/motion/infinite-masonry.js +223 -0
- package/dist/components/motion/infinite-masonry.js.map +1 -0
- package/dist/components/motion/input.js +1 -1
- package/dist/components/motion/loader.js +1 -1
- package/dist/components/motion/magnetic.js +1 -1
- package/dist/components/motion/morphing-modal.js +1 -1
- package/dist/components/motion/not-found/glitch.d.ts +6 -0
- package/dist/components/motion/not-found/glitch.d.ts.map +1 -0
- package/dist/components/motion/not-found/glitch.js +90 -0
- package/dist/components/motion/not-found/glitch.js.map +1 -0
- package/dist/components/motion/not-found/magnetic.d.ts +6 -0
- package/dist/components/motion/not-found/magnetic.d.ts.map +1 -0
- package/dist/components/motion/not-found/magnetic.js +47 -0
- package/dist/components/motion/not-found/magnetic.js.map +1 -0
- package/dist/components/motion/not-found/shared.d.ts +32 -0
- package/dist/components/motion/not-found/shared.d.ts.map +1 -0
- package/dist/components/motion/not-found/shared.js +52 -0
- package/dist/components/motion/not-found/shared.js.map +1 -0
- package/dist/components/motion/not-found/spotlight.d.ts +6 -0
- package/dist/components/motion/not-found/spotlight.d.ts.map +1 -0
- package/dist/components/motion/not-found/spotlight.js +70 -0
- package/dist/components/motion/not-found/spotlight.js.map +1 -0
- package/dist/components/motion/not-found/stacked.d.ts +6 -0
- package/dist/components/motion/not-found/stacked.d.ts.map +1 -0
- package/dist/components/motion/not-found/stacked.js +95 -0
- package/dist/components/motion/not-found/stacked.js.map +1 -0
- package/dist/components/motion/not-found/terminal.d.ts +6 -0
- package/dist/components/motion/not-found/terminal.d.ts.map +1 -0
- package/dist/components/motion/not-found/terminal.js +90 -0
- package/dist/components/motion/not-found/terminal.js.map +1 -0
- package/dist/components/motion/notification-stack.d.ts +35 -0
- package/dist/components/motion/notification-stack.d.ts.map +1 -0
- package/dist/components/motion/notification-stack.js +187 -0
- package/dist/components/motion/notification-stack.js.map +1 -0
- package/dist/components/motion/number-ticker.js +1 -1
- package/dist/components/motion/otp-input.d.ts +32 -0
- package/dist/components/motion/otp-input.d.ts.map +1 -0
- package/dist/components/motion/otp-input.js +272 -0
- package/dist/components/motion/otp-input.js.map +1 -0
- package/dist/components/motion/overflow-actions.d.ts +39 -0
- package/dist/components/motion/overflow-actions.d.ts.map +1 -0
- package/dist/components/motion/overflow-actions.js +220 -0
- package/dist/components/motion/overflow-actions.js.map +1 -0
- package/dist/components/motion/parallax.js +1 -1
- package/dist/components/motion/popover-morph.js +2 -2
- package/dist/components/motion/popover-morph.js.map +1 -1
- package/dist/components/motion/popover.js +1 -1
- package/dist/components/motion/preview-rail.js +1 -1
- package/dist/components/motion/pull-to-refresh.js +2 -2
- package/dist/components/motion/pull-to-refresh.js.map +1 -1
- package/dist/components/motion/radio.js +1 -1
- package/dist/components/motion/range-slider-bubble.js +1 -1
- package/dist/components/motion/range-slider-fluid.js +1 -1
- package/dist/components/motion/range-slider-ruler.js +2 -2
- package/dist/components/motion/range-slider-ruler.js.map +1 -1
- package/dist/components/motion/range-slider-wave.js +1 -1
- package/dist/components/motion/range-slider.js +1 -1
- package/dist/components/motion/scroll-progress.js +1 -1
- package/dist/components/motion/scroll-reveal.js +1 -1
- package/dist/components/motion/select-morph.js +2 -2
- package/dist/components/motion/select.js +2 -2
- package/dist/components/motion/shader-background.js +1 -1
- package/dist/components/motion/shared-layout-bg.js +2 -2
- package/dist/components/motion/shared-layout-bg.js.map +1 -1
- package/dist/components/motion/slide-action-button.js +1 -1
- package/dist/components/motion/smooth-scroll.js +1 -1
- package/dist/components/motion/swipeable-list.d.ts +60 -0
- package/dist/components/motion/swipeable-list.d.ts.map +1 -0
- package/dist/components/motion/swipeable-list.js +254 -0
- package/dist/components/motion/swipeable-list.js.map +1 -0
- package/dist/components/motion/switch.js +1 -1
- package/dist/components/motion/table/index.js +1 -1
- package/dist/components/motion/table/row-handle.js +1 -1
- package/dist/components/motion/table/table-header.js +2 -2
- package/dist/components/motion/table/table-menu.js +1 -1
- package/dist/components/motion/tabs.js +1 -1
- package/dist/components/motion/text-reveal.js +1 -1
- package/dist/components/motion/text-shimmer.js +1 -1
- package/dist/components/motion/text-shimmer.js.map +1 -1
- package/dist/components/motion/theme-toggle.js +2 -2
- package/dist/components/motion/tilt-card.js +1 -1
- package/dist/components/motion/tooltip.js +1 -1
- package/dist/components/motion/wheel-picker.js +1 -1
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/alert.js +1 -1
- package/dist/components/reui/autocomplete.js +1 -1
- package/dist/components/reui/badge.d.ts +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.js +2 -2
- package/dist/components/reui/data-grid/data-grid-column-header.js +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.js +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js +1 -1
- package/dist/components/reui/date-selector.js +2 -2
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-event.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-month-view.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
- package/dist/components/reui/filters.js +2 -2
- package/dist/components/reui/frame.d.ts +1 -1
- package/dist/components/reui/frame.js +1 -1
- package/dist/components/reui/gantt/gantt-bar.js +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +1 -1
- package/dist/components/reui/gantt/gantt-view.js +2 -2
- package/dist/components/reui/number-field.js +1 -1
- package/dist/components/reui/phone-input.js +2 -2
- package/dist/components/reui/rating.js +1 -1
- package/dist/components/reui/tree.js +1 -1
- package/dist/components/ui/accordion.js +1 -1
- package/dist/components/ui/alert-dialog.js +1 -1
- package/dist/components/ui/alert.js +1 -1
- package/dist/components/ui/attachment.d.ts +1 -1
- package/dist/components/ui/attachment.js +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/breadcrumb.js +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/bubble.js +1 -1
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button-group.js +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/button.js +2 -2
- package/dist/components/ui/calendar.js +1 -1
- package/dist/components/ui/carousel.js +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/combobox.js +1 -1
- package/dist/components/ui/command.js +1 -1
- package/dist/components/ui/context-menu.js +1 -1
- package/dist/components/ui/dialog.js +1 -1
- package/dist/components/ui/dropdown-menu.js +1 -1
- package/dist/components/ui/empty.js +1 -1
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/field.js +1 -1
- package/dist/components/ui/input-group.js +1 -1
- package/dist/components/ui/input-otp.js +1 -1
- package/dist/components/ui/item.d.ts +2 -2
- package/dist/components/ui/item.js +1 -1
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/marker.js +1 -1
- package/dist/components/ui/menubar.js +1 -1
- package/dist/components/ui/message-scroller.js +1 -1
- package/dist/components/ui/native-select.js +1 -1
- package/dist/components/ui/navigation-menu.js +1 -1
- package/dist/components/ui/pagination.js +1 -1
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/sheet.js +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/sonner.js +1 -1
- package/dist/components/ui/spinner.js +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/components/ui/toast.js +1 -1
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/components/ui/toggle.js +1 -1
- package/dist/copy-menu-BJ-MXnkN.js +201 -0
- package/dist/copy-menu-BJ-MXnkN.js.map +1 -0
- package/dist/types-smkWN_7x.d.ts +20 -0
- package/dist/types-smkWN_7x.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useHoverCapable } from "../../../hooks/use-hover-capable.js";
|
|
3
|
+
import { NOT_FOUND_DEFAULTS, NotFoundActions, NotFoundStage } from "./shared.js";
|
|
4
|
+
import { useRef } from "react";
|
|
5
|
+
import { cn } from "@kumix/utils";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { motion, useMotionTemplate, useMotionValue, useReducedMotion } from "motion/react";
|
|
8
|
+
//#region src/components/motion/not-found/spotlight.tsx
|
|
9
|
+
function NotFoundSpotlight({ className, code = NOT_FOUND_DEFAULTS.code, title = NOT_FOUND_DEFAULTS.title, description = NOT_FOUND_DEFAULTS.description, homeHref, homeLabel, browseHref, browseLabel }) {
|
|
10
|
+
const ref = useRef(null);
|
|
11
|
+
const reduce = useReducedMotion();
|
|
12
|
+
const canHover = useHoverCapable();
|
|
13
|
+
const enabled = !reduce && canHover;
|
|
14
|
+
const mx = useMotionValue(50);
|
|
15
|
+
const my = useMotionValue(50);
|
|
16
|
+
const mask = useMotionTemplate`radial-gradient(220px circle at ${mx}% ${my}%, #000 25%, transparent 72%)`;
|
|
17
|
+
const onMove = (e) => {
|
|
18
|
+
const el = ref.current;
|
|
19
|
+
if (!el || !enabled) return;
|
|
20
|
+
const rect = el.getBoundingClientRect();
|
|
21
|
+
mx.set((e.clientX - rect.left) / rect.width * 100);
|
|
22
|
+
my.set((e.clientY - rect.top) / rect.height * 100);
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ jsxs(NotFoundStage, {
|
|
25
|
+
className,
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsxs(motion.div, {
|
|
28
|
+
ref,
|
|
29
|
+
onMouseMove: onMove,
|
|
30
|
+
className: "relative isolate flex aspect-16/9 w-full max-w-xl items-center justify-center overflow-hidden rounded-3xl border border-border bg-neutral-950",
|
|
31
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
32
|
+
"aria-hidden": true,
|
|
33
|
+
className: "select-none font-bold text-[clamp(5rem,16vw,10rem)] text-white/10 leading-none tracking-tighter",
|
|
34
|
+
children: code
|
|
35
|
+
}), /* @__PURE__ */ jsx(motion.h1, {
|
|
36
|
+
"aria-label": code,
|
|
37
|
+
style: enabled ? {
|
|
38
|
+
WebkitMaskImage: mask,
|
|
39
|
+
maskImage: mask
|
|
40
|
+
} : void 0,
|
|
41
|
+
className: cn("absolute select-none font-bold text-[clamp(5rem,16vw,10rem)] text-white leading-none tracking-tighter", !enabled && "text-white/90"),
|
|
42
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
43
|
+
"aria-hidden": true,
|
|
44
|
+
children: code
|
|
45
|
+
})
|
|
46
|
+
})]
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ jsxs("div", {
|
|
49
|
+
className: "flex flex-col items-center gap-2",
|
|
50
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
51
|
+
className: "font-semibold text-foreground text-lg",
|
|
52
|
+
children: title
|
|
53
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
54
|
+
className: "max-w-sm text-muted-foreground text-sm",
|
|
55
|
+
children: description
|
|
56
|
+
})]
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ jsx(NotFoundActions, {
|
|
59
|
+
homeHref,
|
|
60
|
+
homeLabel,
|
|
61
|
+
browseHref,
|
|
62
|
+
browseLabel
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { NotFoundSpotlight };
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=spotlight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spotlight.js","names":[],"sources":["../../../../src/components/motion/not-found/spotlight.tsx"],"sourcesContent":["\"use client\";\n\nimport { useRef } from \"react\";\nimport { motion, useMotionTemplate, useMotionValue, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useHoverCapable } from \"../../../hooks/use-hover-capable\";\nimport { NOT_FOUND_DEFAULTS, NotFoundActions, type NotFoundProps, NotFoundStage } from \"./shared\";\n\nexport function NotFoundSpotlight({\n className,\n code = NOT_FOUND_DEFAULTS.code,\n title = NOT_FOUND_DEFAULTS.title,\n description = NOT_FOUND_DEFAULTS.description,\n homeHref,\n homeLabel,\n browseHref,\n browseLabel,\n}: NotFoundProps) {\n const ref = useRef<HTMLDivElement>(null);\n const reduce = useReducedMotion();\n const canHover = useHoverCapable();\n const enabled = !reduce && canHover;\n\n const mx = useMotionValue(50);\n const my = useMotionValue(50);\n const mask = useMotionTemplate`radial-gradient(220px circle at ${mx}% ${my}%, #000 25%, transparent 72%)`;\n\n const onMove = (e: React.MouseEvent<HTMLDivElement>) => {\n const el = ref.current;\n if (!el || !enabled) return;\n const rect = el.getBoundingClientRect();\n mx.set(((e.clientX - rect.left) / rect.width) * 100);\n my.set(((e.clientY - rect.top) / rect.height) * 100);\n };\n\n return (\n <NotFoundStage className={className}>\n <motion.div\n ref={ref}\n onMouseMove={onMove}\n className=\"relative isolate flex aspect-16/9 w-full max-w-xl items-center justify-center overflow-hidden rounded-3xl border border-border bg-neutral-950\"\n >\n {/* Dim base layer. */}\n <span\n aria-hidden\n className=\"select-none font-bold text-[clamp(5rem,16vw,10rem)] text-white/10 leading-none tracking-tighter\"\n >\n {code}\n </span>\n {/* Bright layer, revealed only under the spotlight. */}\n <motion.h1\n aria-label={code}\n style={enabled ? { WebkitMaskImage: mask, maskImage: mask } : undefined}\n className={cn(\n \"absolute select-none font-bold text-[clamp(5rem,16vw,10rem)] text-white leading-none tracking-tighter\",\n !enabled && \"text-white/90\",\n )}\n >\n <span aria-hidden>{code}</span>\n </motion.h1>\n </motion.div>\n\n <div className=\"flex flex-col items-center gap-2\">\n <p className=\"font-semibold text-foreground text-lg\">{title}</p>\n <p className=\"max-w-sm text-muted-foreground text-sm\">{description}</p>\n </div>\n\n <NotFoundActions\n homeHref={homeHref}\n homeLabel={homeLabel}\n browseHref={browseHref}\n browseLabel={browseLabel}\n />\n </NotFoundStage>\n );\n}\n"],"mappings":";;;;;;;;AASA,SAAgB,kBAAkB,EAChC,WACA,OAAO,mBAAmB,MAC1B,QAAQ,mBAAmB,OAC3B,cAAc,mBAAmB,aACjC,UACA,WACA,YACA,eACgB;CAChB,MAAM,MAAM,OAAuB,IAAI;CACvC,MAAM,SAAS,iBAAiB;CAChC,MAAM,WAAW,gBAAgB;CACjC,MAAM,UAAU,CAAC,UAAU;CAE3B,MAAM,KAAK,eAAe,EAAE;CAC5B,MAAM,KAAK,eAAe,EAAE;CAC5B,MAAM,OAAO,iBAAiB,mCAAmC,GAAG,IAAI,GAAG;CAE3E,MAAM,UAAU,MAAwC;EACtD,MAAM,KAAK,IAAI;EACf,IAAI,CAAC,MAAM,CAAC,SAAS;EACrB,MAAM,OAAO,GAAG,sBAAsB;EACtC,GAAG,KAAM,EAAE,UAAU,KAAK,QAAQ,KAAK,QAAS,GAAG;EACnD,GAAG,KAAM,EAAE,UAAU,KAAK,OAAO,KAAK,SAAU,GAAG;CACrD;CAEA,OACE,qBAAC,eAAD;EAA0B;EAA1B,UAAA;GACE,qBAAC,OAAO,KAAR;IACO;IACL,aAAa;IACb,WAAU;IAHZ,UAAA,CAME,oBAAC,QAAD;KACE,eAAA;KACA,WAAU;KAET,UAAA;IACG,CAAA,GAEN,oBAAC,OAAO,IAAR;KACE,cAAY;KACZ,OAAO,UAAU;MAAE,iBAAiB;MAAM,WAAW;KAAK,IAAI,KAAA;KAC9D,WAAW,GACT,yGACA,CAAC,WAAW,eACd;KAEA,UAAA,oBAAC,QAAD;MAAM,eAAA;MAAa,UAAA;KAAW,CAAA;IACrB,CAAA,CACD;;GAEZ,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,oBAAC,KAAD;KAAG,WAAU;KAAyC,UAAA;IAAS,CAAA,GAC/D,oBAAC,KAAD;KAAG,WAAU;KAA0C,UAAA;IAAe,CAAA,CACnE;;GAEL,oBAAC,iBAAD;IACY;IACC;IACC;IACC;GACd,CAAA;EACY;;AAEnB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NotFoundProps } from "./shared.js";
|
|
2
|
+
//#region src/components/motion/not-found/stacked.d.ts
|
|
3
|
+
declare function NotFoundStacked({ className, code, title, description, homeHref, homeLabel, browseHref, browseLabel }: NotFoundProps): import("react").JSX.Element;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { NotFoundStacked };
|
|
6
|
+
//# sourceMappingURL=stacked.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stacked.d.ts","names":[],"sources":["../../../../src/components/motion/not-found/stacked.tsx"],"mappings":";;iBAUgB,kBACd,WACA,MACA,OACA,aACA,UACA,WACA,YACA,eACC,gCAAa,IAAA"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useHoverCapable } from "../../../hooks/use-hover-capable.js";
|
|
3
|
+
import { SPRING_PANEL } from "../../../lib/ease.js";
|
|
4
|
+
import { NOT_FOUND_DEFAULTS, NotFoundActions, NotFoundStage } from "./shared.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { motion, useReducedMotion } from "motion/react";
|
|
7
|
+
//#region src/components/motion/not-found/stacked.tsx
|
|
8
|
+
const CARD = "absolute inset-0 rounded-3xl border border-border bg-card shadow-sm";
|
|
9
|
+
function NotFoundStacked({ className, code = NOT_FOUND_DEFAULTS.code, title = NOT_FOUND_DEFAULTS.title, description = NOT_FOUND_DEFAULTS.description, homeHref, homeLabel, browseHref, browseLabel }) {
|
|
10
|
+
const reduce = useReducedMotion();
|
|
11
|
+
const canHover = useHoverCapable();
|
|
12
|
+
const interactive = !reduce && canHover;
|
|
13
|
+
return /* @__PURE__ */ jsxs(NotFoundStage, {
|
|
14
|
+
className,
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ jsxs(motion.div, {
|
|
17
|
+
initial: "rest",
|
|
18
|
+
animate: "rest",
|
|
19
|
+
whileHover: interactive ? "hover" : void 0,
|
|
20
|
+
className: "relative h-44 w-64",
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ jsx(motion.div, {
|
|
23
|
+
"aria-hidden": true,
|
|
24
|
+
variants: {
|
|
25
|
+
rest: {
|
|
26
|
+
rotate: 0,
|
|
27
|
+
x: 0,
|
|
28
|
+
y: 0
|
|
29
|
+
},
|
|
30
|
+
hover: {
|
|
31
|
+
rotate: -9,
|
|
32
|
+
x: -28,
|
|
33
|
+
y: 8
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
transition: SPRING_PANEL,
|
|
37
|
+
className: CARD
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ jsx(motion.div, {
|
|
40
|
+
"aria-hidden": true,
|
|
41
|
+
variants: {
|
|
42
|
+
rest: {
|
|
43
|
+
rotate: 0,
|
|
44
|
+
x: 0,
|
|
45
|
+
y: 0
|
|
46
|
+
},
|
|
47
|
+
hover: {
|
|
48
|
+
rotate: 9,
|
|
49
|
+
x: 28,
|
|
50
|
+
y: 8
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
transition: SPRING_PANEL,
|
|
54
|
+
className: CARD
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ jsxs(motion.div, {
|
|
57
|
+
variants: {
|
|
58
|
+
rest: { y: 0 },
|
|
59
|
+
hover: { y: -6 }
|
|
60
|
+
},
|
|
61
|
+
transition: SPRING_PANEL,
|
|
62
|
+
className: "absolute inset-0 flex flex-col items-center justify-center gap-1 rounded-3xl border border-border bg-card shadow-md",
|
|
63
|
+
children: [/* @__PURE__ */ jsx("h1", {
|
|
64
|
+
className: "select-none font-bold text-[clamp(3.5rem,9vw,5rem)] text-foreground leading-none tracking-tighter",
|
|
65
|
+
children: code
|
|
66
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
67
|
+
className: "font-medium text-muted-foreground text-xs uppercase tracking-wide",
|
|
68
|
+
children: "out of the deck"
|
|
69
|
+
})]
|
|
70
|
+
})
|
|
71
|
+
]
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ jsxs("div", {
|
|
74
|
+
className: "flex flex-col items-center gap-2",
|
|
75
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
76
|
+
className: "font-semibold text-foreground text-lg",
|
|
77
|
+
children: title
|
|
78
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
79
|
+
className: "max-w-sm text-muted-foreground text-sm",
|
|
80
|
+
children: description
|
|
81
|
+
})]
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ jsx(NotFoundActions, {
|
|
84
|
+
homeHref,
|
|
85
|
+
homeLabel,
|
|
86
|
+
browseHref,
|
|
87
|
+
browseLabel
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
export { NotFoundStacked };
|
|
94
|
+
|
|
95
|
+
//# sourceMappingURL=stacked.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stacked.js","names":[],"sources":["../../../../src/components/motion/not-found/stacked.tsx"],"sourcesContent":["\"use client\";\n\nimport { motion, useReducedMotion } from \"motion/react\";\n\nimport { useHoverCapable } from \"../../../hooks/use-hover-capable\";\nimport { SPRING_PANEL } from \"../../../lib/ease\";\nimport { NOT_FOUND_DEFAULTS, NotFoundActions, type NotFoundProps, NotFoundStage } from \"./shared\";\n\nconst CARD = \"absolute inset-0 rounded-3xl border border-border bg-card shadow-sm\";\n\nexport function NotFoundStacked({\n className,\n code = NOT_FOUND_DEFAULTS.code,\n title = NOT_FOUND_DEFAULTS.title,\n description = NOT_FOUND_DEFAULTS.description,\n homeHref,\n homeLabel,\n browseHref,\n browseLabel,\n}: NotFoundProps) {\n const reduce = useReducedMotion();\n const canHover = useHoverCapable();\n const interactive = !reduce && canHover;\n\n return (\n <NotFoundStage className={className}>\n <motion.div\n initial=\"rest\"\n animate=\"rest\"\n whileHover={interactive ? \"hover\" : undefined}\n className=\"relative h-44 w-64\"\n >\n <motion.div\n aria-hidden\n variants={{ rest: { rotate: 0, x: 0, y: 0 }, hover: { rotate: -9, x: -28, y: 8 } }}\n transition={SPRING_PANEL}\n className={CARD}\n />\n <motion.div\n aria-hidden\n variants={{ rest: { rotate: 0, x: 0, y: 0 }, hover: { rotate: 9, x: 28, y: 8 } }}\n transition={SPRING_PANEL}\n className={CARD}\n />\n <motion.div\n variants={{ rest: { y: 0 }, hover: { y: -6 } }}\n transition={SPRING_PANEL}\n className=\"absolute inset-0 flex flex-col items-center justify-center gap-1 rounded-3xl border border-border bg-card shadow-md\"\n >\n <h1 className=\"select-none font-bold text-[clamp(3.5rem,9vw,5rem)] text-foreground leading-none tracking-tighter\">\n {code}\n </h1>\n <span className=\"font-medium text-muted-foreground text-xs uppercase tracking-wide\">\n out of the deck\n </span>\n </motion.div>\n </motion.div>\n\n <div className=\"flex flex-col items-center gap-2\">\n <p className=\"font-semibold text-foreground text-lg\">{title}</p>\n <p className=\"max-w-sm text-muted-foreground text-sm\">{description}</p>\n </div>\n\n <NotFoundActions\n homeHref={homeHref}\n homeLabel={homeLabel}\n browseHref={browseHref}\n browseLabel={browseLabel}\n />\n </NotFoundStage>\n );\n}\n"],"mappings":";;;;;;;AAQA,MAAM,OAAO;AAEb,SAAgB,gBAAgB,EAC9B,WACA,OAAO,mBAAmB,MAC1B,QAAQ,mBAAmB,OAC3B,cAAc,mBAAmB,aACjC,UACA,WACA,YACA,eACgB;CAChB,MAAM,SAAS,iBAAiB;CAChC,MAAM,WAAW,gBAAgB;CACjC,MAAM,cAAc,CAAC,UAAU;CAE/B,OACE,qBAAC,eAAD;EAA0B;EAA1B,UAAA;GACE,qBAAC,OAAO,KAAR;IACE,SAAQ;IACR,SAAQ;IACR,YAAY,cAAc,UAAU,KAAA;IACpC,WAAU;IAJZ,UAAA;KAME,oBAAC,OAAO,KAAR;MACE,eAAA;MACA,UAAU;OAAE,MAAM;QAAE,QAAQ;QAAG,GAAG;QAAG,GAAG;OAAE;OAAG,OAAO;QAAE,QAAQ;QAAI,GAAG;QAAK,GAAG;OAAE;MAAE;MACjF,YAAY;MACZ,WAAW;KACZ,CAAA;KACD,oBAAC,OAAO,KAAR;MACE,eAAA;MACA,UAAU;OAAE,MAAM;QAAE,QAAQ;QAAG,GAAG;QAAG,GAAG;OAAE;OAAG,OAAO;QAAE,QAAQ;QAAG,GAAG;QAAI,GAAG;OAAE;MAAE;MAC/E,YAAY;MACZ,WAAW;KACZ,CAAA;KACD,qBAAC,OAAO,KAAR;MACE,UAAU;OAAE,MAAM,EAAE,GAAG,EAAE;OAAG,OAAO,EAAE,GAAG,GAAG;MAAE;MAC7C,YAAY;MACZ,WAAU;MAHZ,UAAA,CAKE,oBAAC,MAAD;OAAI,WAAU;OACX,UAAA;MACC,CAAA,GACJ,oBAAC,QAAD;OAAM,WAAU;OAAoE,UAAA;MAE9E,CAAA,CACI;;IACF;;GAEZ,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,oBAAC,KAAD;KAAG,WAAU;KAAyC,UAAA;IAAS,CAAA,GAC/D,oBAAC,KAAD;KAAG,WAAU;KAA0C,UAAA;IAAe,CAAA,CACnE;;GAEL,oBAAC,iBAAD;IACY;IACC;IACC;IACC;GACd,CAAA;EACY;;AAEnB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NotFoundProps } from "./shared.js";
|
|
2
|
+
//#region src/components/motion/not-found/terminal.d.ts
|
|
3
|
+
declare function NotFoundTerminal({ className, code, title, description, homeHref, homeLabel, browseHref, browseLabel }: NotFoundProps): import("react").JSX.Element;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { NotFoundTerminal };
|
|
6
|
+
//# sourceMappingURL=terminal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal.d.ts","names":[],"sources":["../../../../src/components/motion/not-found/terminal.tsx"],"mappings":";;iBAOgB,mBACd,WACA,MACA,OACA,aACA,UACA,WACA,YACA,eACC,gCAAa,IAAA"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { TextReveal } from "../text-reveal.js";
|
|
3
|
+
import { NOT_FOUND_DEFAULTS, NotFoundActions, NotFoundStage } from "./shared.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/motion/not-found/terminal.tsx
|
|
6
|
+
const TYPE_SPRING = {
|
|
7
|
+
stiffness: 320,
|
|
8
|
+
damping: 30,
|
|
9
|
+
mass: .6
|
|
10
|
+
};
|
|
11
|
+
function NotFoundTerminal({ className, code = NOT_FOUND_DEFAULTS.code, title = NOT_FOUND_DEFAULTS.title, description = NOT_FOUND_DEFAULTS.description, homeHref, homeLabel, browseHref, browseLabel }) {
|
|
12
|
+
return /* @__PURE__ */ jsxs(NotFoundStage, {
|
|
13
|
+
className,
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ jsxs("div", {
|
|
16
|
+
className: "w-full max-w-md overflow-hidden rounded-xl border border-border bg-neutral-950 text-left shadow-lg",
|
|
17
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
18
|
+
className: "flex items-center gap-1.5 border-white/10 border-b px-4 py-3",
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ jsx("span", { className: "h-3 w-3 rounded-full bg-[#ff5f57]" }),
|
|
21
|
+
/* @__PURE__ */ jsx("span", { className: "h-3 w-3 rounded-full bg-[#febc2e]" }),
|
|
22
|
+
/* @__PURE__ */ jsx("span", { className: "h-3 w-3 rounded-full bg-[#28c840]" }),
|
|
23
|
+
/* @__PURE__ */ jsx("span", {
|
|
24
|
+
className: "ml-2 text-white/40 text-xs",
|
|
25
|
+
children: "~/beui"
|
|
26
|
+
})
|
|
27
|
+
]
|
|
28
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
29
|
+
className: "space-y-1.5 p-4 font-mono text-sm leading-relaxed",
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsx(TextReveal, {
|
|
32
|
+
as: "p",
|
|
33
|
+
split: "char",
|
|
34
|
+
stagger: .018,
|
|
35
|
+
blur: 6,
|
|
36
|
+
yOffset: 0,
|
|
37
|
+
spring: TYPE_SPRING,
|
|
38
|
+
className: "text-white/80",
|
|
39
|
+
text: "$ cd /page"
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ jsx(TextReveal, {
|
|
42
|
+
as: "p",
|
|
43
|
+
split: "char",
|
|
44
|
+
stagger: .012,
|
|
45
|
+
delay: .45,
|
|
46
|
+
blur: 6,
|
|
47
|
+
yOffset: 0,
|
|
48
|
+
spring: TYPE_SPRING,
|
|
49
|
+
className: "text-[#ff5f57]",
|
|
50
|
+
text: "cd: no such file or directory: /page"
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ jsxs("p", {
|
|
53
|
+
className: "flex items-center text-white/80",
|
|
54
|
+
children: [/* @__PURE__ */ jsx(TextReveal, {
|
|
55
|
+
as: "span",
|
|
56
|
+
split: "char",
|
|
57
|
+
stagger: .018,
|
|
58
|
+
delay: 1.1,
|
|
59
|
+
blur: 6,
|
|
60
|
+
yOffset: 0,
|
|
61
|
+
spring: TYPE_SPRING,
|
|
62
|
+
text: `$ status ${code}`
|
|
63
|
+
}), /* @__PURE__ */ jsx("span", { className: "ml-1 inline-block h-[1.1em] w-[0.55ch] translate-y-[0.12em] bg-white/80 motion-safe:animate-pulse" })]
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
})]
|
|
67
|
+
}),
|
|
68
|
+
/* @__PURE__ */ jsxs("div", {
|
|
69
|
+
className: "flex flex-col items-center gap-2",
|
|
70
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
71
|
+
className: "font-semibold text-foreground text-lg",
|
|
72
|
+
children: title
|
|
73
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
74
|
+
className: "max-w-sm text-muted-foreground text-sm",
|
|
75
|
+
children: description
|
|
76
|
+
})]
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ jsx(NotFoundActions, {
|
|
79
|
+
homeHref,
|
|
80
|
+
homeLabel,
|
|
81
|
+
browseHref,
|
|
82
|
+
browseLabel
|
|
83
|
+
})
|
|
84
|
+
]
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
export { NotFoundTerminal };
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=terminal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal.js","names":[],"sources":["../../../../src/components/motion/not-found/terminal.tsx"],"sourcesContent":["\"use client\";\n\nimport { TextReveal } from \"../text-reveal\";\nimport { NOT_FOUND_DEFAULTS, NotFoundActions, type NotFoundProps, NotFoundStage } from \"./shared\";\n\nconst TYPE_SPRING = { stiffness: 320, damping: 30, mass: 0.6 };\n\nexport function NotFoundTerminal({\n className,\n code = NOT_FOUND_DEFAULTS.code,\n title = NOT_FOUND_DEFAULTS.title,\n description = NOT_FOUND_DEFAULTS.description,\n homeHref,\n homeLabel,\n browseHref,\n browseLabel,\n}: NotFoundProps) {\n return (\n <NotFoundStage className={className}>\n <div className=\"w-full max-w-md overflow-hidden rounded-xl border border-border bg-neutral-950 text-left shadow-lg\">\n <div className=\"flex items-center gap-1.5 border-white/10 border-b px-4 py-3\">\n <span className=\"h-3 w-3 rounded-full bg-[#ff5f57]\" />\n <span className=\"h-3 w-3 rounded-full bg-[#febc2e]\" />\n <span className=\"h-3 w-3 rounded-full bg-[#28c840]\" />\n <span className=\"ml-2 text-white/40 text-xs\">~/beui</span>\n </div>\n <div className=\"space-y-1.5 p-4 font-mono text-sm leading-relaxed\">\n <TextReveal\n as=\"p\"\n split=\"char\"\n stagger={0.018}\n blur={6}\n yOffset={0}\n spring={TYPE_SPRING}\n className=\"text-white/80\"\n text=\"$ cd /page\"\n />\n <TextReveal\n as=\"p\"\n split=\"char\"\n stagger={0.012}\n delay={0.45}\n blur={6}\n yOffset={0}\n spring={TYPE_SPRING}\n className=\"text-[#ff5f57]\"\n text=\"cd: no such file or directory: /page\"\n />\n <p className=\"flex items-center text-white/80\">\n <TextReveal\n as=\"span\"\n split=\"char\"\n stagger={0.018}\n delay={1.1}\n blur={6}\n yOffset={0}\n spring={TYPE_SPRING}\n text={`$ status ${code}`}\n />\n <span className=\"ml-1 inline-block h-[1.1em] w-[0.55ch] translate-y-[0.12em] bg-white/80 motion-safe:animate-pulse\" />\n </p>\n </div>\n </div>\n\n <div className=\"flex flex-col items-center gap-2\">\n <p className=\"font-semibold text-foreground text-lg\">{title}</p>\n <p className=\"max-w-sm text-muted-foreground text-sm\">{description}</p>\n </div>\n\n <NotFoundActions\n homeHref={homeHref}\n homeLabel={homeLabel}\n browseHref={browseHref}\n browseLabel={browseLabel}\n />\n </NotFoundStage>\n );\n}\n"],"mappings":";;;;;AAKA,MAAM,cAAc;CAAE,WAAW;CAAK,SAAS;CAAI,MAAM;AAAI;AAE7D,SAAgB,iBAAiB,EAC/B,WACA,OAAO,mBAAmB,MAC1B,QAAQ,mBAAmB,OAC3B,cAAc,mBAAmB,aACjC,UACA,WACA,YACA,eACgB;CAChB,OACE,qBAAC,eAAD;EAA0B;EAA1B,UAAA;GACE,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACE,oBAAC,QAAD,EAAM,WAAU,oCAAqC,CAAA;MACrD,oBAAC,QAAD,EAAM,WAAU,oCAAqC,CAAA;MACrD,oBAAC,QAAD,EAAM,WAAU,oCAAqC,CAAA;MACrD,oBAAC,QAAD;OAAM,WAAU;OAA6B,UAAA;MAAY,CAAA;KACtD;IACL,CAAA,GAAA,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACE,oBAAC,YAAD;OACE,IAAG;OACH,OAAM;OACN,SAAS;OACT,MAAM;OACN,SAAS;OACT,QAAQ;OACR,WAAU;OACV,MAAK;MACN,CAAA;MACD,oBAAC,YAAD;OACE,IAAG;OACH,OAAM;OACN,SAAS;OACT,OAAO;OACP,MAAM;OACN,SAAS;OACT,QAAQ;OACR,WAAU;OACV,MAAK;MACN,CAAA;MACD,qBAAC,KAAD;OAAG,WAAU;OAAb,UAAA,CACE,oBAAC,YAAD;QACE,IAAG;QACH,OAAM;QACN,SAAS;QACT,OAAO;QACP,MAAM;QACN,SAAS;QACT,QAAQ;QACR,MAAM,YAAY;OACnB,CAAA,GACD,oBAAC,QAAD,EAAM,WAAU,oGAAqG,CAAA,CACpH;;KACA;IACF,CAAA,CAAA;;GAEL,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,oBAAC,KAAD;KAAG,WAAU;KAAyC,UAAA;IAAS,CAAA,GAC/D,oBAAC,KAAD;KAAG,WAAU;KAA0C,UAAA;IAAe,CAAA,CACnE;;GAEL,oBAAC,iBAAD;IACY;IACC;IACC;IACC;GACd,CAAA;EACY;;AAEnB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/components/motion/notification-stack.d.ts
|
|
3
|
+
type NotificationStackItem = {
|
|
4
|
+
id: string;
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
trailing?: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
type NotificationStackClassNames = {
|
|
10
|
+
stack?: string;
|
|
11
|
+
card?: string;
|
|
12
|
+
content?: string;
|
|
13
|
+
title?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
trailing?: string;
|
|
16
|
+
footer?: string;
|
|
17
|
+
count?: string;
|
|
18
|
+
};
|
|
19
|
+
interface NotificationStackProps {
|
|
20
|
+
items: NotificationStackItem[];
|
|
21
|
+
expanded?: boolean;
|
|
22
|
+
defaultExpanded?: boolean;
|
|
23
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
24
|
+
onViewAll?: () => void;
|
|
25
|
+
maxVisible?: number;
|
|
26
|
+
collapsedLabel?: string;
|
|
27
|
+
expandedLabel?: string;
|
|
28
|
+
emptyLabel?: string;
|
|
29
|
+
className?: string;
|
|
30
|
+
classNames?: NotificationStackClassNames;
|
|
31
|
+
}
|
|
32
|
+
declare function NotificationStack({ items, expanded, defaultExpanded, onExpandedChange, onViewAll, maxVisible, collapsedLabel, expandedLabel, emptyLabel, className, classNames }: NotificationStackProps): import("react").JSX.Element;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { NotificationStack, NotificationStackClassNames, NotificationStackItem, NotificationStackProps };
|
|
35
|
+
//# sourceMappingURL=notification-stack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-stack.d.ts","names":[],"sources":["../../../src/components/motion/notification-stack.tsx"],"mappings":";;KAkBY;EACV;EACA,OAAO;EACP,cAAc;EACd,WAAW;;KAGD;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf,OAAO;EACP;EACA;EACA,oBAAoB;EACpB;EACA;EACA;EACA;EACA;EACA;EACA,aAAa;;iBA0DC,oBACd,OACA,UACA,iBACA,kBACA,WACA,YACA,gBACA,eACA,YACA,WACA,cACC,yCAAsB,IAAA"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useHoverCapable } from "../../hooks/use-hover-capable.js";
|
|
3
|
+
import { EASE_OUT, SPRING_LAYOUT } from "../../lib/ease.js";
|
|
4
|
+
import { ActionSwapText } from "./action-swap.js";
|
|
5
|
+
import { useCallback, useRef, useState } from "react";
|
|
6
|
+
import { cn } from "@kumix/utils";
|
|
7
|
+
import { ArrowUpRight, BellOff } from "lucide-react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { motion, useReducedMotion } from "motion/react";
|
|
10
|
+
//#region src/components/motion/notification-stack.tsx
|
|
11
|
+
const STACK_PEEK = 8;
|
|
12
|
+
const STACK_INSET = 12;
|
|
13
|
+
function useControllableExpanded({ expanded, defaultExpanded, onExpandedChange }) {
|
|
14
|
+
const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);
|
|
15
|
+
const isControlled = expanded !== void 0;
|
|
16
|
+
return [expanded ?? internalExpanded, useCallback((next) => {
|
|
17
|
+
if (!isControlled) setInternalExpanded(next);
|
|
18
|
+
onExpandedChange?.(next);
|
|
19
|
+
}, [isControlled, onExpandedChange])];
|
|
20
|
+
}
|
|
21
|
+
function NotificationCardContent({ item, classNames }) {
|
|
22
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
23
|
+
className: cn("flex min-w-0 flex-col gap-1.5 py-4", classNames?.content),
|
|
24
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
25
|
+
className: "flex min-w-0 items-start justify-between gap-3",
|
|
26
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
27
|
+
className: cn("min-w-0 font-medium text-sm leading-snug", classNames?.title),
|
|
28
|
+
children: item.title
|
|
29
|
+
}), item.trailing ? /* @__PURE__ */ jsx("span", {
|
|
30
|
+
className: cn("shrink-0 text-xs", classNames?.trailing),
|
|
31
|
+
children: item.trailing
|
|
32
|
+
}) : null]
|
|
33
|
+
}), item.description ? /* @__PURE__ */ jsx("span", {
|
|
34
|
+
className: cn("text-muted-foreground text-xs leading-relaxed", classNames?.description),
|
|
35
|
+
children: item.description
|
|
36
|
+
}) : null]
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function NotificationStack({ items, expanded, defaultExpanded = false, onExpandedChange, onViewAll, maxVisible = 3, collapsedLabel = "Notifications", expandedLabel = "View all", emptyLabel = "All caught up", className, classNames }) {
|
|
40
|
+
const reduce = useReducedMotion();
|
|
41
|
+
const canHover = useHoverCapable();
|
|
42
|
+
const hasFocus = useRef(false);
|
|
43
|
+
const [isExpanded, setIsExpanded] = useControllableExpanded({
|
|
44
|
+
expanded,
|
|
45
|
+
defaultExpanded,
|
|
46
|
+
onExpandedChange
|
|
47
|
+
});
|
|
48
|
+
const visibleItems = items.slice(0, Math.max(1, maxVisible));
|
|
49
|
+
const primaryItem = visibleItems[0];
|
|
50
|
+
const transition = reduce ? { duration: 0 } : SPRING_LAYOUT;
|
|
51
|
+
const cardTransition = reduce ? { duration: 0 } : {
|
|
52
|
+
duration: .32,
|
|
53
|
+
ease: EASE_OUT
|
|
54
|
+
};
|
|
55
|
+
const backgroundTransition = reduce ? { duration: 0 } : {
|
|
56
|
+
duration: .26,
|
|
57
|
+
ease: EASE_OUT
|
|
58
|
+
};
|
|
59
|
+
if (!primaryItem) return /* @__PURE__ */ jsxs("div", {
|
|
60
|
+
className: cn("flex w-full max-w-[22rem] items-center justify-center gap-2 rounded-3xl bg-muted/70 px-5 py-8 font-medium text-muted-foreground text-sm", className),
|
|
61
|
+
children: [/* @__PURE__ */ jsx(BellOff, {
|
|
62
|
+
className: "h-4 w-4",
|
|
63
|
+
"aria-hidden": "true"
|
|
64
|
+
}), emptyLabel]
|
|
65
|
+
});
|
|
66
|
+
const handleBlur = (event) => {
|
|
67
|
+
if (event.currentTarget.contains(event.relatedTarget)) return;
|
|
68
|
+
hasFocus.current = false;
|
|
69
|
+
setIsExpanded(false);
|
|
70
|
+
};
|
|
71
|
+
const handleKeyDown = (event) => {
|
|
72
|
+
if (event.key !== "Escape") return;
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
setIsExpanded(false);
|
|
75
|
+
event.currentTarget.blur();
|
|
76
|
+
};
|
|
77
|
+
const handleClick = () => {
|
|
78
|
+
if (!isExpanded) {
|
|
79
|
+
setIsExpanded(true);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (onViewAll) {
|
|
83
|
+
onViewAll();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
setIsExpanded(false);
|
|
87
|
+
};
|
|
88
|
+
return /* @__PURE__ */ jsxs(motion.button, {
|
|
89
|
+
type: "button",
|
|
90
|
+
initial: false,
|
|
91
|
+
"aria-expanded": isExpanded,
|
|
92
|
+
"aria-label": isExpanded ? `${items.length} notifications. ${expandedLabel}.` : `${items.length} notifications. Expand notifications.`,
|
|
93
|
+
onPointerEnter: () => {
|
|
94
|
+
if (canHover) setIsExpanded(true);
|
|
95
|
+
},
|
|
96
|
+
onPointerLeave: () => {
|
|
97
|
+
if (canHover && !hasFocus.current) setIsExpanded(false);
|
|
98
|
+
},
|
|
99
|
+
onFocus: () => {
|
|
100
|
+
hasFocus.current = true;
|
|
101
|
+
setIsExpanded(true);
|
|
102
|
+
},
|
|
103
|
+
onBlur: handleBlur,
|
|
104
|
+
onKeyDown: handleKeyDown,
|
|
105
|
+
onClick: handleClick,
|
|
106
|
+
className: cn("relative z-10 block w-full max-w-[22rem] cursor-pointer rounded-3xl text-left text-foreground outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", className),
|
|
107
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
108
|
+
"aria-hidden": "true",
|
|
109
|
+
className: "invisible block p-3",
|
|
110
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
111
|
+
className: "block",
|
|
112
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
113
|
+
className: cn("block rounded-2xl border border-transparent px-4", classNames?.card),
|
|
114
|
+
children: /* @__PURE__ */ jsx(NotificationCardContent, {
|
|
115
|
+
item: primaryItem,
|
|
116
|
+
classNames
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
}), /* @__PURE__ */ jsx("span", { className: "mt-2 block h-9" })]
|
|
120
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
121
|
+
className: "absolute inset-x-0 bottom-0 block p-3",
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ jsx(motion.span, {
|
|
124
|
+
"aria-hidden": "true",
|
|
125
|
+
layout: true,
|
|
126
|
+
initial: false,
|
|
127
|
+
transition: backgroundTransition,
|
|
128
|
+
className: "absolute inset-0 rounded-3xl bg-muted"
|
|
129
|
+
}),
|
|
130
|
+
/* @__PURE__ */ jsx("span", {
|
|
131
|
+
className: cn("relative z-10 grid gap-1", !isExpanded && "pb-2", classNames?.stack),
|
|
132
|
+
children: visibleItems.map((item, index) => {
|
|
133
|
+
const isPrimary = index === 0;
|
|
134
|
+
return /* @__PURE__ */ jsx(motion.span, {
|
|
135
|
+
layout: "position",
|
|
136
|
+
initial: false,
|
|
137
|
+
animate: {
|
|
138
|
+
y: isExpanded ? 0 : index * STACK_PEEK,
|
|
139
|
+
clipPath: isExpanded ? "inset(0px 0px round 16px)" : `inset(0px ${index * STACK_INSET}px round 16px)`
|
|
140
|
+
},
|
|
141
|
+
transition: cardTransition,
|
|
142
|
+
className: cn("block rounded-2xl border border-border/60 bg-background px-4", classNames?.card),
|
|
143
|
+
style: {
|
|
144
|
+
zIndex: visibleItems.length - index,
|
|
145
|
+
gridColumn: 1,
|
|
146
|
+
gridRow: isExpanded ? index + 1 : 1
|
|
147
|
+
},
|
|
148
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
149
|
+
className: cn("block", !isPrimary && !isExpanded && "invisible"),
|
|
150
|
+
children: /* @__PURE__ */ jsx(NotificationCardContent, {
|
|
151
|
+
item,
|
|
152
|
+
classNames
|
|
153
|
+
})
|
|
154
|
+
})
|
|
155
|
+
}, item.id);
|
|
156
|
+
})
|
|
157
|
+
}),
|
|
158
|
+
/* @__PURE__ */ jsxs(motion.span, {
|
|
159
|
+
layout: "position",
|
|
160
|
+
transition,
|
|
161
|
+
className: cn("relative z-10 mt-2 flex min-h-9 items-center gap-2 px-1", classNames?.footer),
|
|
162
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
163
|
+
className: cn("grid size-7 shrink-0 place-items-center rounded-full bg-orange-600 font-medium text-white text-xs shadow-[inset_0_1px_2px_rgb(0_0_0/0.2),inset_0_-1px_0_rgb(255_255_255/0.16)] dark:bg-orange-500", classNames?.count),
|
|
164
|
+
children: items.length
|
|
165
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
166
|
+
className: "flex items-center font-medium text-sm",
|
|
167
|
+
children: /* @__PURE__ */ jsx(ActionSwapText, {
|
|
168
|
+
value: isExpanded ? "expanded" : "collapsed",
|
|
169
|
+
animation: "roll",
|
|
170
|
+
children: isExpanded ? /* @__PURE__ */ jsxs("span", {
|
|
171
|
+
className: "inline-flex items-center gap-1",
|
|
172
|
+
children: [expandedLabel, /* @__PURE__ */ jsx(ArrowUpRight, {
|
|
173
|
+
className: "size-4",
|
|
174
|
+
"aria-hidden": "true"
|
|
175
|
+
})]
|
|
176
|
+
}) : collapsedLabel
|
|
177
|
+
})
|
|
178
|
+
})]
|
|
179
|
+
})
|
|
180
|
+
]
|
|
181
|
+
})]
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
//#endregion
|
|
185
|
+
export { NotificationStack };
|
|
186
|
+
|
|
187
|
+
//# sourceMappingURL=notification-stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-stack.js","names":[],"sources":["../../../src/components/motion/notification-stack.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type FocusEvent,\n type KeyboardEvent,\n type ReactNode,\n useCallback,\n useRef,\n useState,\n} from \"react\";\nimport { ArrowUpRight, BellOff } from \"lucide-react\";\nimport { motion, type Transition, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useHoverCapable } from \"../../hooks/use-hover-capable\";\nimport { EASE_OUT, SPRING_LAYOUT } from \"../../lib/ease\";\nimport { ActionSwapText } from \"./action-swap\";\n\nexport type NotificationStackItem = {\n id: string;\n title: ReactNode;\n description?: ReactNode;\n trailing?: ReactNode;\n};\n\nexport type NotificationStackClassNames = {\n stack?: string;\n card?: string;\n content?: string;\n title?: string;\n description?: string;\n trailing?: string;\n footer?: string;\n count?: string;\n};\n\nexport interface NotificationStackProps {\n items: NotificationStackItem[];\n expanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n onViewAll?: () => void;\n maxVisible?: number;\n collapsedLabel?: string;\n expandedLabel?: string;\n emptyLabel?: string;\n className?: string;\n classNames?: NotificationStackClassNames;\n}\n\nconst STACK_PEEK = 8;\nconst STACK_INSET = 12;\n\nfunction useControllableExpanded({\n expanded,\n defaultExpanded,\n onExpandedChange,\n}: {\n expanded?: boolean;\n defaultExpanded: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n}) {\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);\n const isControlled = expanded !== undefined;\n const value = expanded ?? internalExpanded;\n\n const setValue = useCallback(\n (next: boolean) => {\n if (!isControlled) setInternalExpanded(next);\n onExpandedChange?.(next);\n },\n [isControlled, onExpandedChange],\n );\n\n return [value, setValue] as const;\n}\n\nfunction NotificationCardContent({\n item,\n classNames,\n}: {\n item: NotificationStackItem;\n classNames?: NotificationStackClassNames;\n}) {\n return (\n <span className={cn(\"flex min-w-0 flex-col gap-1.5 py-4\", classNames?.content)}>\n <span className=\"flex min-w-0 items-start justify-between gap-3\">\n <span className={cn(\"min-w-0 font-medium text-sm leading-snug\", classNames?.title)}>\n {item.title}\n </span>\n {item.trailing ? (\n <span className={cn(\"shrink-0 text-xs\", classNames?.trailing)}>{item.trailing}</span>\n ) : null}\n </span>\n {item.description ? (\n <span\n className={cn(\"text-muted-foreground text-xs leading-relaxed\", classNames?.description)}\n >\n {item.description}\n </span>\n ) : null}\n </span>\n );\n}\n\nexport function NotificationStack({\n items,\n expanded,\n defaultExpanded = false,\n onExpandedChange,\n onViewAll,\n maxVisible = 3,\n collapsedLabel = \"Notifications\",\n expandedLabel = \"View all\",\n emptyLabel = \"All caught up\",\n className,\n classNames,\n}: NotificationStackProps) {\n const reduce = useReducedMotion();\n const canHover = useHoverCapable();\n const hasFocus = useRef(false);\n const [isExpanded, setIsExpanded] = useControllableExpanded({\n expanded,\n defaultExpanded,\n onExpandedChange,\n });\n\n const visibleItems = items.slice(0, Math.max(1, maxVisible));\n const primaryItem = visibleItems[0];\n const transition: Transition = reduce ? { duration: 0 } : SPRING_LAYOUT;\n const cardTransition: Transition = reduce ? { duration: 0 } : { duration: 0.32, ease: EASE_OUT };\n const backgroundTransition: Transition = reduce\n ? { duration: 0 }\n : { duration: 0.26, ease: EASE_OUT };\n\n if (!primaryItem) {\n return (\n <div\n className={cn(\n \"flex w-full max-w-[22rem] items-center justify-center gap-2 rounded-3xl bg-muted/70 px-5 py-8 font-medium text-muted-foreground text-sm\",\n className,\n )}\n >\n <BellOff className=\"h-4 w-4\" aria-hidden=\"true\" />\n {emptyLabel}\n </div>\n );\n }\n\n const handleBlur = (event: FocusEvent<HTMLButtonElement>) => {\n if (event.currentTarget.contains(event.relatedTarget)) return;\n hasFocus.current = false;\n setIsExpanded(false);\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (event.key !== \"Escape\") return;\n event.preventDefault();\n setIsExpanded(false);\n event.currentTarget.blur();\n };\n\n const handleClick = () => {\n if (!isExpanded) {\n setIsExpanded(true);\n return;\n }\n\n if (onViewAll) {\n onViewAll();\n return;\n }\n\n setIsExpanded(false);\n };\n\n return (\n <motion.button\n type=\"button\"\n initial={false}\n aria-expanded={isExpanded}\n aria-label={\n isExpanded\n ? `${items.length} notifications. ${expandedLabel}.`\n : `${items.length} notifications. Expand notifications.`\n }\n onPointerEnter={() => {\n if (canHover) setIsExpanded(true);\n }}\n onPointerLeave={() => {\n if (canHover && !hasFocus.current) setIsExpanded(false);\n }}\n onFocus={() => {\n hasFocus.current = true;\n setIsExpanded(true);\n }}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n onClick={handleClick}\n className={cn(\n \"relative z-10 block w-full max-w-[22rem] cursor-pointer rounded-3xl text-left text-foreground outline-none\",\n \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n className,\n )}\n >\n {/* This invisible first card gives the button its compact intrinsic footprint. */}\n <span aria-hidden=\"true\" className=\"invisible block p-3\">\n <span className=\"block\">\n <span\n className={cn(\"block rounded-2xl border border-transparent px-4\", classNames?.card)}\n >\n <NotificationCardContent item={primaryItem} classNames={classNames} />\n </span>\n </span>\n <span className=\"mt-2 block h-9\" />\n </span>\n\n <span className=\"absolute inset-x-0 bottom-0 block p-3\">\n <motion.span\n aria-hidden=\"true\"\n layout\n initial={false}\n transition={backgroundTransition}\n className=\"absolute inset-0 rounded-3xl bg-muted\"\n />\n <span className={cn(\"relative z-10 grid gap-1\", !isExpanded && \"pb-2\", classNames?.stack)}>\n {visibleItems.map((item, index) => {\n const isPrimary = index === 0;\n\n return (\n <motion.span\n key={item.id}\n layout=\"position\"\n initial={false}\n animate={{\n y: isExpanded ? 0 : index * STACK_PEEK,\n clipPath: isExpanded\n ? \"inset(0px 0px round 16px)\"\n : `inset(0px ${index * STACK_INSET}px round 16px)`,\n }}\n transition={cardTransition}\n className={cn(\n \"block rounded-2xl border border-border/60 bg-background px-4\",\n classNames?.card,\n )}\n style={{\n zIndex: visibleItems.length - index,\n gridColumn: 1,\n gridRow: isExpanded ? index + 1 : 1,\n }}\n >\n <span className={cn(\"block\", !isPrimary && !isExpanded && \"invisible\")}>\n <NotificationCardContent item={item} classNames={classNames} />\n </span>\n </motion.span>\n );\n })}\n </span>\n\n <motion.span\n layout=\"position\"\n transition={transition}\n className={cn(\n \"relative z-10 mt-2 flex min-h-9 items-center gap-2 px-1\",\n classNames?.footer,\n )}\n >\n <span\n className={cn(\n \"grid size-7 shrink-0 place-items-center rounded-full bg-orange-600 font-medium text-white text-xs shadow-[inset_0_1px_2px_rgb(0_0_0/0.2),inset_0_-1px_0_rgb(255_255_255/0.16)] dark:bg-orange-500\",\n classNames?.count,\n )}\n >\n {items.length}\n </span>\n <span className=\"flex items-center font-medium text-sm\">\n <ActionSwapText value={isExpanded ? \"expanded\" : \"collapsed\"} animation=\"roll\">\n {isExpanded ? (\n <span className=\"inline-flex items-center gap-1\">\n {expandedLabel}\n <ArrowUpRight className=\"size-4\" aria-hidden=\"true\" />\n </span>\n ) : (\n collapsedLabel\n )}\n </ActionSwapText>\n </span>\n </motion.span>\n </span>\n </motion.button>\n );\n}\n"],"mappings":"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"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { EASE_OUT } from "../../lib/ease.js";
|
|
3
3
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { cn } from "@kumix/utils";
|
|
5
|
-
import { animate, motion, useInView, useReducedMotion } from "motion/react";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { animate, motion, useInView, useReducedMotion } from "motion/react";
|
|
7
7
|
//#region src/components/motion/number-ticker.tsx
|
|
8
8
|
const DIGIT_HEIGHT_EM = 1.1;
|
|
9
9
|
const DIGITS = Array.from({ length: 10 }, (_, n) => n);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/components/motion/otp-input.d.ts
|
|
2
|
+
type OTPStatus = "idle" | "error" | "success";
|
|
3
|
+
interface OTPInputProps {
|
|
4
|
+
/** Number of slots. Default 6. */
|
|
5
|
+
length?: number;
|
|
6
|
+
value?: string;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
onChange?: (value: string) => void;
|
|
9
|
+
/** Fires once every slot is filled. */
|
|
10
|
+
onComplete?: (value: string) => void;
|
|
11
|
+
/** Optional label rendered above the slots. */
|
|
12
|
+
label?: string;
|
|
13
|
+
/** Helper text shown below the slots while idle. */
|
|
14
|
+
hint?: string;
|
|
15
|
+
/** Message shown below the slots when status is "success". */
|
|
16
|
+
successMessage?: string;
|
|
17
|
+
/** Message shown below the slots when status is "error". */
|
|
18
|
+
errorMessage?: string;
|
|
19
|
+
/** External validation feedback. "error" shakes, "success" draws a check. */
|
|
20
|
+
status?: OTPStatus;
|
|
21
|
+
/** Render dots instead of the typed digits. */
|
|
22
|
+
mask?: boolean;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
autoFocus?: boolean;
|
|
25
|
+
/** Accessible label for the underlying input. */
|
|
26
|
+
"aria-label"?: string;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
declare function OTPInput({ length, value: controlledValue, defaultValue, onChange, onComplete, label, hint, successMessage, errorMessage, status, mask, disabled, autoFocus, "aria-label": ariaLabel, className }: OTPInputProps): import("react").JSX.Element;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { OTPInput, OTPInputProps, OTPStatus };
|
|
32
|
+
//# sourceMappingURL=otp-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otp-input.d.ts","names":[],"sources":["../../../src/components/motion/otp-input.tsx"],"mappings":";KAQY;UAEK;;EAEf;EACA;EACA;EACA,YAAY;;EAEZ,cAAc;;EAEd;;EAEA;;EAEA;;EAEA;;EAEA,SAAS;;EAET;EACA;EACA;;EAEA;EACA;;iBAGc,WACd,QACA,OAAO,iBACP,cACA,UACA,YACA,OACA,MACA,gBACA,cACA,QACA,MACA,UACA,yBACc,WACd,aACC,gCAAa,IAAA"}
|