@g4rcez/components 0.0.38 → 0.0.39
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.css +1 -1
- package/dist/index.js +201 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3609 -3600
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +40 -40
- package/dist/index.umd.js.map +1 -1
- package/dist/preset.tailwind.d.ts +10 -0
- package/dist/preset.tailwind.d.ts.map +1 -0
- package/dist/preset.tailwind.js +53 -0
- package/dist/src/components/core/button.d.ts +16 -0
- package/dist/src/components/core/button.d.ts.map +1 -0
- package/dist/src/components/core/button.js +43 -0
- package/dist/src/components/core/polymorph.d.ts +10 -0
- package/dist/src/components/core/polymorph.d.ts.map +1 -0
- package/dist/src/components/core/polymorph.js +8 -0
- package/dist/src/components/core/resizable.d.ts +3 -0
- package/dist/src/components/core/resizable.d.ts.map +1 -0
- package/dist/src/components/core/resizable.js +50 -0
- package/dist/src/components/core/tag.d.ts +19 -0
- package/dist/src/components/core/tag.d.ts.map +1 -0
- package/dist/src/components/core/tag.js +45 -0
- package/dist/src/components/display/alert.d.ts +19 -0
- package/dist/src/components/display/alert.d.ts.map +1 -0
- package/dist/src/components/display/alert.js +34 -0
- package/dist/src/components/display/calendar.d.ts +42 -0
- package/dist/src/components/display/calendar.d.ts.map +1 -0
- package/dist/src/components/display/calendar.js +215 -0
- package/dist/src/components/display/card.d.ts +10 -0
- package/dist/src/components/display/card.d.ts.map +1 -0
- package/dist/src/components/display/card.js +8 -0
- package/dist/src/components/display/list.d.ts +16 -0
- package/dist/src/components/display/list.d.ts.map +1 -0
- package/dist/src/components/display/list.js +31 -0
- package/dist/src/components/display/notifications.d.ts +25 -0
- package/dist/src/components/display/notifications.d.ts.map +1 -0
- package/dist/src/components/display/notifications.js +70 -0
- package/dist/src/components/display/stats.d.ts +10 -0
- package/dist/src/components/display/stats.d.ts.map +1 -0
- package/dist/src/components/display/stats.js +5 -0
- package/dist/src/components/display/step.d.ts +14 -0
- package/dist/src/components/display/step.d.ts.map +1 -0
- package/dist/src/components/display/step.js +59 -0
- package/dist/src/components/display/tabs.d.ts +20 -0
- package/dist/src/components/display/tabs.d.ts.map +1 -0
- package/dist/src/components/display/tabs.js +67 -0
- package/dist/src/components/display/timeline.d.ts +32 -0
- package/dist/src/components/display/timeline.d.ts.map +1 -0
- package/dist/src/components/display/timeline.js +21 -0
- package/dist/src/components/floating/dropdown.d.ts +14 -0
- package/dist/src/components/floating/dropdown.d.ts.map +1 -0
- package/dist/src/components/floating/dropdown.js +39 -0
- package/dist/src/components/floating/expand.d.ts +9 -0
- package/dist/src/components/floating/expand.d.ts.map +1 -0
- package/dist/src/components/floating/expand.js +25 -0
- package/dist/src/components/floating/menu.d.ts +52 -0
- package/dist/src/components/floating/menu.d.ts.map +1 -0
- package/dist/src/components/floating/menu.js +126 -0
- package/dist/src/components/floating/modal.d.ts +19 -0
- package/dist/src/components/floating/modal.d.ts.map +1 -0
- package/dist/src/components/floating/modal.js +102 -0
- package/dist/src/components/floating/toolbar.d.ts +6 -0
- package/dist/src/components/floating/toolbar.d.ts.map +1 -0
- package/dist/src/components/floating/toolbar.js +4 -0
- package/dist/src/components/floating/tooltip.d.ts +12 -0
- package/dist/src/components/floating/tooltip.d.ts.map +1 -0
- package/dist/src/components/floating/tooltip.js +28 -0
- package/dist/src/components/form/autocomplete.d.ts +17 -0
- package/dist/src/components/form/autocomplete.d.ts.map +1 -0
- package/dist/src/components/form/autocomplete.js +152 -0
- package/dist/src/components/form/checkbox.d.ts +11 -0
- package/dist/src/components/form/checkbox.d.ts.map +1 -0
- package/dist/src/components/form/checkbox.js +8 -0
- package/dist/src/components/form/date-picker.d.ts +61 -0
- package/dist/src/components/form/date-picker.d.ts.map +1 -0
- package/dist/src/components/form/date-picker.js +78 -0
- package/dist/src/components/form/file-upload.d.ts +12 -0
- package/dist/src/components/form/file-upload.d.ts.map +1 -0
- package/dist/src/components/form/file-upload.js +62 -0
- package/dist/src/components/form/form.d.ts +4 -0
- package/dist/src/components/form/form.d.ts.map +1 -0
- package/dist/src/components/form/form.js +28 -0
- package/dist/src/components/form/input-field.d.ts +30 -0
- package/dist/src/components/form/input-field.d.ts.map +1 -0
- package/dist/src/components/form/input-field.js +14 -0
- package/dist/src/components/form/input.d.ts +9 -0
- package/dist/src/components/form/input.d.ts.map +1 -0
- package/dist/src/components/form/input.js +38 -0
- package/dist/src/components/form/radiobox.d.ts +7 -0
- package/dist/src/components/form/radiobox.d.ts.map +1 -0
- package/dist/src/components/form/radiobox.js +7 -0
- package/dist/src/components/form/select.d.ts +13 -0
- package/dist/src/components/form/select.d.ts.map +1 -0
- package/dist/src/components/form/select.js +33 -0
- package/dist/src/components/form/switch.d.ts +8 -0
- package/dist/src/components/form/switch.d.ts.map +1 -0
- package/dist/src/components/form/switch.js +39 -0
- package/dist/src/components/form/task-list.d.ts +3 -0
- package/dist/src/components/form/task-list.d.ts.map +1 -0
- package/dist/src/components/form/task-list.js +26 -0
- package/dist/src/components/form/transfer-list.d.ts +14 -0
- package/dist/src/components/form/transfer-list.d.ts.map +1 -0
- package/dist/src/components/form/transfer-list.js +21 -0
- package/dist/src/components/index.d.ts +30 -0
- package/dist/src/components/index.d.ts.map +1 -0
- package/dist/src/components/index.js +29 -0
- package/dist/src/components/table/filter.d.ts +41 -0
- package/dist/src/components/table/filter.d.ts.map +1 -0
- package/dist/src/components/table/filter.js +91 -0
- package/dist/src/components/table/group.d.ts +17 -0
- package/dist/src/components/table/group.d.ts.map +1 -0
- package/dist/src/components/table/group.js +43 -0
- package/dist/src/components/table/index.d.ts +38 -0
- package/dist/src/components/table/index.d.ts.map +1 -0
- package/dist/src/components/table/index.js +145 -0
- package/dist/src/components/table/metadata.d.ts +3 -0
- package/dist/src/components/table/metadata.d.ts.map +1 -0
- package/dist/src/components/table/metadata.js +10 -0
- package/dist/src/components/table/pagination.d.ts +3 -0
- package/dist/src/components/table/pagination.d.ts.map +1 -0
- package/dist/src/components/table/pagination.js +43 -0
- package/dist/src/components/table/sort.d.ts +28 -0
- package/dist/src/components/table/sort.d.ts.map +1 -0
- package/dist/src/components/table/sort.js +79 -0
- package/dist/src/components/table/table-lib.d.ts +122 -0
- package/dist/src/components/table/table-lib.d.ts.map +1 -0
- package/dist/src/components/table/table-lib.js +51 -0
- package/dist/src/components/table/thead.d.ts +8 -0
- package/dist/src/components/table/thead.d.ts.map +1 -0
- package/dist/src/components/table/thead.js +29 -0
- package/dist/src/constants.d.ts +3 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +2 -0
- package/dist/src/hooks/use-callback-ref.d.ts +3 -0
- package/dist/src/hooks/use-callback-ref.d.ts.map +1 -0
- package/dist/src/hooks/use-callback-ref.js +8 -0
- package/dist/src/hooks/use-click-outside.d.ts +3 -0
- package/dist/src/hooks/use-click-outside.d.ts.map +1 -0
- package/dist/src/hooks/use-click-outside.js +17 -0
- package/dist/src/hooks/use-debounce.d.ts +4 -0
- package/dist/src/hooks/use-debounce.d.ts.map +1 -0
- package/dist/src/hooks/use-debounce.js +12 -0
- package/dist/src/hooks/use-form.d.ts +41 -0
- package/dist/src/hooks/use-form.d.ts.map +1 -0
- package/dist/src/hooks/use-form.js +169 -0
- package/dist/src/hooks/use-hover.d.ts +3 -0
- package/dist/src/hooks/use-hover.d.ts.map +1 -0
- package/dist/src/hooks/use-hover.js +18 -0
- package/dist/src/hooks/use-media-query.d.ts +2 -0
- package/dist/src/hooks/use-media-query.d.ts.map +1 -0
- package/dist/src/hooks/use-media-query.js +25 -0
- package/dist/src/hooks/use-mutable-state.d.ts +2 -0
- package/dist/src/hooks/use-mutable-state.d.ts.map +1 -0
- package/dist/src/hooks/use-mutable-state.js +8 -0
- package/dist/src/hooks/use-on-event.d.ts +4 -0
- package/dist/src/hooks/use-on-event.d.ts.map +1 -0
- package/dist/src/hooks/use-on-event.js +7 -0
- package/dist/src/hooks/use-parent.d.ts +3 -0
- package/dist/src/hooks/use-parent.d.ts.map +1 -0
- package/dist/src/hooks/use-parent.js +21 -0
- package/dist/src/hooks/use-previous.d.ts +2 -0
- package/dist/src/hooks/use-previous.d.ts.map +1 -0
- package/dist/src/hooks/use-previous.js +8 -0
- package/dist/src/hooks/use-reactive.d.ts +2 -0
- package/dist/src/hooks/use-reactive.d.ts.map +1 -0
- package/dist/src/hooks/use-reactive.js +8 -0
- package/dist/src/hooks/use-stable-ref.d.ts +2 -0
- package/dist/src/hooks/use-stable-ref.d.ts.map +1 -0
- package/dist/src/hooks/use-stable-ref.js +8 -0
- package/dist/src/hooks/use-translate-context.d.ts +103 -0
- package/dist/src/hooks/use-translate-context.d.ts.map +1 -0
- package/dist/src/hooks/use-translate-context.js +63 -0
- package/dist/src/index.d.ts +12 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +10 -0
- package/dist/src/lib/dom.d.ts +9 -0
- package/dist/src/lib/dom.d.ts.map +1 -0
- package/dist/src/lib/dom.js +34 -0
- package/dist/src/lib/fns.d.ts +7 -0
- package/dist/src/lib/fns.d.ts.map +1 -0
- package/dist/src/lib/fns.js +26 -0
- package/dist/src/styles/design-tokens.d.ts +19 -0
- package/dist/src/styles/design-tokens.d.ts.map +1 -0
- package/dist/src/styles/design-tokens.js +52 -0
- package/dist/src/styles/theme.d.ts +4 -0
- package/dist/src/styles/theme.d.ts.map +1 -0
- package/dist/src/styles/theme.js +294 -0
- package/dist/src/styles/theme.types.d.ts +101 -0
- package/dist/src/styles/theme.types.d.ts.map +1 -0
- package/dist/src/styles/theme.types.js +1 -0
- package/dist/src/types.d.ts +10 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../../src/components/display/card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAa,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,MAAM,MAAM,SAAS,GAAG,gBAAgB,CACpC,QAAQ,CACJ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAC3B;IACI,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;CACtC,CACJ,EACD,KAAK,CACR,CAAC;AAEF,eAAO,MAAM,IAAI,oEAA8F,iBAAiB,CAAC,SAAS,CAAC,4CAS1I,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { css } from "../../lib/dom";
|
|
4
|
+
import { Polymorph } from "../core/polymorph";
|
|
5
|
+
export const Card = (_a) => {
|
|
6
|
+
var { children, title, as = "div", container = "", header = null, className = "" } = _a, props = __rest(_a, ["children", "title", "as", "container", "header", "className"]);
|
|
7
|
+
return (_jsxs(Polymorph, Object.assign({}, props, { as: as, className: css("flex flex-col gap-4 rounded-card border border-card-border bg-card-background py-4 pb-8 shadow", container), children: [title ? _jsx("header", { className: "mb-2 w-full border-b border-card-border px-8 pb-4 text-xl font-medium", children: title }) : header, _jsx("div", { className: css("min-w-full px-8", className), children: children })] })));
|
|
8
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
2
|
+
import { Label } from "../../types";
|
|
3
|
+
type AnimatedItemProps = {
|
|
4
|
+
title: Label;
|
|
5
|
+
description: Label;
|
|
6
|
+
children: Label;
|
|
7
|
+
avatar?: Label;
|
|
8
|
+
leading?: React.FC<{
|
|
9
|
+
open: () => void;
|
|
10
|
+
}>;
|
|
11
|
+
};
|
|
12
|
+
type AnimatedListProps = {};
|
|
13
|
+
export declare const AnimatedList: (props: PropsWithChildren<AnimatedListProps>) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const AnimatedListItem: (props: PropsWithChildren<AnimatedItemProps>) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/components/display/list.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,EAAY,iBAAiB,EAAgC,MAAM,OAAO,CAAC;AACzF,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,KAAK,iBAAiB,GAAG;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,KAAK,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,IAAI,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAC;CAC5C,CAAC;AAIF,KAAK,iBAAiB,GAAG,EAAE,CAAC;AA2D5B,eAAO,MAAM,YAAY,UAAW,iBAAiB,CAAC,iBAAiB,CAAC,4CAoEvE,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAAW,iBAAiB,CAAC,iBAAiB,CAAC,4CAA0C,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FloatingFocusManager, FloatingOverlay, FloatingPortal, useClick, useDismiss, useFloating, useInteractions, useRole, } from "@floating-ui/react";
|
|
3
|
+
import { AnimatePresence, motion, MotionConfig } from "framer-motion";
|
|
4
|
+
import { XIcon } from "lucide-react";
|
|
5
|
+
import React, { Fragment, useCallback, useId, useState } from "react";
|
|
6
|
+
const FloatItem = ({ item, context, setter, get, refs }) => (_jsx(FloatingPortal, { children: _jsx(MotionConfig, { reducedMotion: "user", transition: { type: "tween", stiffness: 25, duration: 0.2 }, children: _jsxs(AnimatePresence, { presenceAffectsLayout: true, children: [_jsx(AnimatePresence, { children: item ? (_jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, className: "pointer-events-none fixed inset-0 top-0 z-floating h-screen w-screen bg-floating-overlay/70" })) : null }), _jsx(AnimatePresence, { children: item ? (_jsx(FloatingOverlay, { lockScroll: true, className: "absolute inset-0 z-tooltip flex items-center justify-center", children: _jsx(FloatingFocusManager, { visuallyHiddenDismiss: true, modal: true, closeOnFocusOut: true, context: context, children: _jsxs(motion.div, Object.assign({ layout: true, layoutId: `item-${item.id}`, className: "relative flex h-min w-min min-w-xs flex-col gap-4 rounded-card border border-card-border bg-card-background p-6 py-4 pb-8 shadow", ref: refs.setFloating }, get(), { children: [_jsx("nav", { className: "absolute right-4 top-1 lg:right-2", children: _jsx("button", { type: "button", onClick: setter, className: "p-1 opacity-70 transition-colors hover:text-danger hover:opacity-100 focus:text-danger", children: _jsx(XIcon, {}) }) }), _jsxs("header", { className: "flex w-full flex-wrap items-center justify-between gap-2", children: [_jsx("h3", { className: "min-w-full text-balance text-2xl font-medium", children: item.title }), _jsx("p", { className: "text-sm leading-snug text-secondary", children: item.description })] }), item.children] })) }) })) : null })] }) }) }));
|
|
7
|
+
export const AnimatedList = (props) => {
|
|
8
|
+
const [selected, setSelected] = useState(null);
|
|
9
|
+
const id = useId();
|
|
10
|
+
const { context, refs } = useFloating({
|
|
11
|
+
open: selected !== null,
|
|
12
|
+
transform: true,
|
|
13
|
+
onOpenChange: (open) => (open ? undefined : setSelected(null)),
|
|
14
|
+
});
|
|
15
|
+
const click = useClick(context);
|
|
16
|
+
const role = useRole(context);
|
|
17
|
+
const dismiss = useDismiss(context, { escapeKey: true, referencePress: true, outsidePress: true });
|
|
18
|
+
const { getFloatingProps } = useInteractions([click, role, dismiss]);
|
|
19
|
+
const clear = useCallback(() => {
|
|
20
|
+
setSelected(null);
|
|
21
|
+
}, []);
|
|
22
|
+
const items = React.Children.toArray(props.children);
|
|
23
|
+
return (_jsxs(Fragment, { children: [_jsx(FloatItem, { refs: refs, context: context, get: getFloatingProps, item: selected, setter: clear }), _jsx("ul", { role: "list", children: items.map((x, index) => {
|
|
24
|
+
const item = x.props;
|
|
25
|
+
const innerId = `${id}-${index}`;
|
|
26
|
+
const setter = () => setSelected(Object.assign(Object.assign({}, item), { id: innerId }));
|
|
27
|
+
const Leading = item.leading;
|
|
28
|
+
return (_jsx(motion.li, { layout: true, layoutId: `item-${innerId}`, className: `border-b border-card-border py-2 last:border-transparent`, children: _jsx(motion.div, { layoutId: `toast-${innerId}`, className: "relative", children: _jsx("div", { className: "relative flex items-start space-x-3", children: _jsxs(Fragment, { children: [item.avatar ? (_jsx("div", { children: _jsx("div", { className: "relative px-1", children: _jsx("button", { onClick: setter, className: "flex size-10 items-center justify-center ring-primary", children: item.avatar }) }) })) : null, _jsx("div", { className: "min-w-0 flex-1 py-1 text-foreground", children: _jsxs("div", { className: "flex flex-row flex-nowrap justify-between gap-4", children: [_jsxs("button", { onClick: setter, className: "ease-out cursor-pointer text-left transition-all hover:scale-105 hover:text-primary", children: [_jsx("h3", { children: item.title }), _jsx("p", { className: "text-sm leading-snug text-secondary", children: item.description })] }), Leading ? _jsx(Leading, { open: setter }) : null] }) })] }) }) }) }, innerId));
|
|
29
|
+
}) })] }));
|
|
30
|
+
};
|
|
31
|
+
export const AnimatedListItem = (props) => _jsx(Fragment, { children: props.children });
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
import { type PropsWithChildren } from "react";
|
|
3
|
+
import { Label } from "../../types";
|
|
4
|
+
declare const variants: (props?: ({
|
|
5
|
+
theme?: "default" | "danger" | "info" | "success" | "warn" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
|
+
type NotificationOptions = Partial<{
|
|
8
|
+
title: Label;
|
|
9
|
+
duration: number;
|
|
10
|
+
closable: boolean;
|
|
11
|
+
theme: VariantProps<typeof variants>["theme"];
|
|
12
|
+
}>;
|
|
13
|
+
type NotificationSubscriber = {
|
|
14
|
+
close: () => void;
|
|
15
|
+
clear: () => void;
|
|
16
|
+
};
|
|
17
|
+
type ContextFunction = (text: Label, args?: NotificationOptions) => NotificationSubscriber;
|
|
18
|
+
export declare const useNotification: () => ContextFunction;
|
|
19
|
+
export type NotificationProps = Partial<{
|
|
20
|
+
max: number;
|
|
21
|
+
duration: number;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function Notifications({ children, max, duration }: PropsWithChildren<NotificationProps>): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../../src/components/display/notifications.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAA8C,KAAK,iBAAiB,EAAwD,MAAM,OAAO,CAAC;AAEjJ,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,QAAA,MAAM,QAAQ;;mFAcb,CAAC;AAEF,KAAK,mBAAmB,GAAG,OAAO,CAAC;IAC/B,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,YAAY,CAAC,OAAO,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC;CACjD,CAAC,CAAC;AAEH,KAAK,sBAAsB,GAAG;IAAE,KAAK,EAAE,MAAM,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AAEvE,KAAK,eAAe,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,mBAAmB,KAAK,sBAAsB,CAAC;AAM3F,eAAO,MAAM,eAAe,uBAAwC,CAAC;AAkErE,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE3E,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,GAAO,EAAE,QAAe,EAAE,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,2CAuDzG"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createElement as _createElement } from "react";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
import * as RadixToast from "@radix-ui/react-toast";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { AnimatePresence, motion } from "framer-motion";
|
|
7
|
+
import { XIcon } from "lucide-react";
|
|
8
|
+
import { createContext, forwardRef, useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
9
|
+
import { useHover } from "../../hooks/use-hover";
|
|
10
|
+
const variants = cva("relative isolate z-tooltip flex justify-between overflow-hidden whitespace-nowrap rounded-lg border text-sm shadow-sm supports-[backdrop-filter]:backdrop-blur-xl", {
|
|
11
|
+
variants: {
|
|
12
|
+
theme: {
|
|
13
|
+
warn: "bg-warn-notification/90 text-warn-hover border-warn/50",
|
|
14
|
+
info: "bg-info-notification supports-[backdrop-filter]:bg-info-notification/50 supports-[backdrop-filter]:bg-info/20 text-info border-info/50",
|
|
15
|
+
danger: "bg-danger-notification supports-[backdrop-filter]:bg-danger-notification/60 text-danger border-danger/50",
|
|
16
|
+
success: "bg-success-notification supports-[backdrop-filter]:bg-success-notification/50 text-success border-success/50",
|
|
17
|
+
default: "border-card-border bg-card-background text-foreground",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: { theme: "default" },
|
|
21
|
+
});
|
|
22
|
+
const NotificationContext = createContext(() => {
|
|
23
|
+
throw new Error("Not implemented");
|
|
24
|
+
});
|
|
25
|
+
export const useNotification = () => useContext(NotificationContext);
|
|
26
|
+
const animatedIndex = {
|
|
27
|
+
0: { opacity: 1, y: [10, 15], scale: [1, 0.98] },
|
|
28
|
+
1: { opacity: 1, y: [15, 20], scale: [1, 0.97] },
|
|
29
|
+
2: { opacity: 1, y: [20, 25], scale: [1, 0.96] },
|
|
30
|
+
default: { opacity: 1, y: [25, 30], scale: [1, 0.95] },
|
|
31
|
+
};
|
|
32
|
+
const Notification = forwardRef(function Toast(props, forwardedRef) {
|
|
33
|
+
var _a;
|
|
34
|
+
const closable = (_a = props.closable) !== null && _a !== void 0 ? _a : true;
|
|
35
|
+
const duration = props.duration;
|
|
36
|
+
const variant = props.hover ? "hover" : props.isLast ? "isLast" : "other";
|
|
37
|
+
const className = variants({ theme: props.theme || "default" });
|
|
38
|
+
return (_jsx(RadixToast.Root, { ref: forwardedRef, asChild: true, forceMount: true, onOpenChange: props.onClose, duration: duration, children: _jsx(motion.li, { layout: true, layoutScroll: true, animate: variant, "data-index": props.index, initial: { y: -100, zIndex: -1 }, className: "text-select pointer-events-auto absolute right-0 top-0 w-80", variants: {
|
|
39
|
+
isLast: { y: 10, scale: 1, animationDuration: "300ms", opacity: 1 },
|
|
40
|
+
hover: { y: 0, position: "static", scale: 1, opacity: 1 },
|
|
41
|
+
other: animatedIndex[props.reversedIndex] || animatedIndex.default,
|
|
42
|
+
}, transition: { type: "spring", mass: 1.2, damping: 30, stiffness: 200 }, exit: { opacity: [0.9, 0], transition: { opacity: { bounce: 0.25, duration: 0.3 } } }, children: _jsxs("div", { className: className, children: [_jsxs("div", { className: "flex flex-col p-4", children: [props.title ? (_jsx(RadixToast.Title, { className: "select-text truncate text-lg font-medium leading-relaxed", children: "Title" })) : null, _jsxs(RadixToast.Description, { className: "select-text truncate", children: [props.text, props.index] })] }), closable ? (_jsx(RadixToast.Close, { className: "absolute right-2 top-2 rounded-full p-1 text-foreground transition hover:bg-danger/10 hover:text-danger-hover", children: _jsx(XIcon, { className: "h-5 w-5" }) })) : null] }) }) }));
|
|
43
|
+
});
|
|
44
|
+
export function Notifications({ children, max = 5, duration = 5000 }) {
|
|
45
|
+
const ref = useRef(null);
|
|
46
|
+
const hover = useHover(ref);
|
|
47
|
+
const [messages, setMessages] = useState([]);
|
|
48
|
+
const clear = useCallback(() => setMessages([]), []);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
return () => clear();
|
|
51
|
+
}, [clear]);
|
|
52
|
+
const notify = useCallback((text, args) => {
|
|
53
|
+
const id = window.crypto.randomUUID();
|
|
54
|
+
setMessages((prev) => {
|
|
55
|
+
const newItems = [...prev, Object.assign(Object.assign({}, args), { id, text })];
|
|
56
|
+
if (newItems.length > max)
|
|
57
|
+
return newItems.slice(newItems.length - max, newItems.length + 1);
|
|
58
|
+
return newItems;
|
|
59
|
+
});
|
|
60
|
+
const close = () => setMessages((prev) => prev.filter((x) => x.id !== id));
|
|
61
|
+
return { clear, close };
|
|
62
|
+
}, [max]);
|
|
63
|
+
return (_jsxs(RadixToast.Provider, { duration: duration, swipeThreshold: 150, children: [_jsx(NotificationContext.Provider, { value: notify, children: children }), _jsx(AnimatePresence, { presenceAffectsLayout: true, mode: "popLayout", children: messages.map((toast, index, list) => {
|
|
64
|
+
const close = () => setMessages((prev) => prev.filter((t) => t.id !== toast.id));
|
|
65
|
+
return (_createElement(Notification, Object.assign({}, toast, { key: toast.id, hover: hover, index: index, onClose: close, isLast: list.length - 1 === index, reversedIndex: list.length - (index + 1) })));
|
|
66
|
+
}) }), _jsx(RadixToast.Viewport, { ref: ref, "data-items": messages.length, style: {
|
|
67
|
+
justifyContent: "start",
|
|
68
|
+
height: `${(hover ? messages.length : Math.min(1, messages.length)) * 7}rem`,
|
|
69
|
+
}, className: "fixed right-4 top-10 flex w-80 list-none flex-col-reverse items-end gap-4 overflow-y-clip overflow-x-visible data-[items=true]:pb-8 max-sm:top-20" })] }));
|
|
70
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Label } from "../../types";
|
|
3
|
+
export type StatsProps = {
|
|
4
|
+
title: Label;
|
|
5
|
+
Icon: React.FC<any>;
|
|
6
|
+
iconContainer?: string;
|
|
7
|
+
footer?: React.ReactElement;
|
|
8
|
+
};
|
|
9
|
+
export declare const Stats: (props: React.PropsWithChildren<StatsProps>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=stats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../../src/components/display/stats.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,MAAM,UAAU,GAAG;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,KAAK,UAAW,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,4CAmB/D,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { css } from "../../lib/dom";
|
|
3
|
+
export const Stats = (props) => {
|
|
4
|
+
return (_jsxs("div", { className: "divide-y divide-card-border bg-card-background shadow border border-card-border rounded-card", children: [_jsxs("header", { className: "p-6 items-start flex gap-4", children: [_jsx("div", { className: css("size-10 p-8 rounded-card flex items-center justify-center aspect-square bg-primary", props.iconContainer), children: _jsx("div", { children: _jsx(props.Icon, { className: "size-10 aspect-square text-primary-foreground" }) }) }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("header", { children: _jsx("h3", { className: "text-base leading-none", children: props.title }) }), _jsx("p", { className: "text-4xl font-semibold", children: props.children })] })] }), props.footer ? _jsx("footer", { className: "px-6 py-2", children: props.footer }) : null] }));
|
|
5
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PropsWithChildren } from "react";
|
|
2
|
+
type StepStatus = "active" | "inactive" | "complete" | "error";
|
|
3
|
+
export type StepProps = {
|
|
4
|
+
step: number;
|
|
5
|
+
currentStep: number;
|
|
6
|
+
status?: StepStatus;
|
|
7
|
+
};
|
|
8
|
+
export declare const StepsContainer: (props: PropsWithChildren<{
|
|
9
|
+
steps: number;
|
|
10
|
+
currentStep: number;
|
|
11
|
+
}>) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const Step: (props: StepProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=step.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../../src/components/display/step.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAkB,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAmC1D,KAAK,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;AAE/D,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,UAAU,CAAA;CAAE,CAAC;AAkBnF,eAAO,MAAM,cAAc,UAAW,iBAAiB,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,4CAK9F,CAAC;AAEF,eAAO,MAAM,IAAI,UAAW,SAAS,4CAkDpC,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { motion } from "framer-motion";
|
|
4
|
+
import { useColorParser } from "../../hooks/use-translate-context";
|
|
5
|
+
const iconTransitions = {
|
|
6
|
+
delay: 0.2,
|
|
7
|
+
type: "tween",
|
|
8
|
+
ease: "easeOut",
|
|
9
|
+
duration: 0.3,
|
|
10
|
+
};
|
|
11
|
+
const states = {
|
|
12
|
+
initial: { pathLength: 0, opacity: 0 },
|
|
13
|
+
animate: { pathLength: 1, opacity: 1 },
|
|
14
|
+
};
|
|
15
|
+
const ErrorIcon = (props) => (_jsxs("svg", Object.assign({}, props, { viewBox: "0 0 24 24", fill: "currentColor", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx(motion.path, { className: "currentColor", initial: states.initial, animate: states.animate, transition: iconTransitions, d: "M18 6 6 18" }), _jsx(motion.path, { className: "currentColor", initial: states.initial, animate: states.animate, transition: iconTransitions, d: "m6 6 12 12" })] })));
|
|
16
|
+
const CheckIcon = (props) => (_jsx("svg", Object.assign({}, props, { fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 3, children: _jsx(motion.path, { initial: states.initial, animate: states.animate, transition: iconTransitions, strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" }) })));
|
|
17
|
+
const variants = { complete: { scale: 1.25 }, active: { scale: 1, transition: { delay: 0, duration: 0.2 } } };
|
|
18
|
+
const transitions = {
|
|
19
|
+
duration: 0.6,
|
|
20
|
+
delay: 0.2,
|
|
21
|
+
type: "tween",
|
|
22
|
+
ease: "circOut",
|
|
23
|
+
};
|
|
24
|
+
const getCurrentStatus = (props) => {
|
|
25
|
+
if (props.status === "error")
|
|
26
|
+
return "error";
|
|
27
|
+
if (props.currentStep === props.step)
|
|
28
|
+
return "active";
|
|
29
|
+
if (props.currentStep < props.step)
|
|
30
|
+
return "inactive";
|
|
31
|
+
return "complete";
|
|
32
|
+
};
|
|
33
|
+
export const StepsContainer = (props) => (_jsxs("div", { className: "relative flex justify-between", children: [_jsx("div", { className: "absolute top-1/2 h-1 w-[calc(100%)] bg-card-border" }), props.children] }));
|
|
34
|
+
export const Step = (props) => {
|
|
35
|
+
const parser = useColorParser();
|
|
36
|
+
const status = getCurrentStatus(props);
|
|
37
|
+
return (_jsxs(motion.div, { animate: status, className: "relative", children: [_jsx(motion.div, { variants: variants, transition: transitions, className: `absolute inset-0 rounded-full ${props.status === "error" ? "bg-danger" : ""}` }), _jsx(motion.div, { initial: false, variants: {
|
|
38
|
+
error: {
|
|
39
|
+
backgroundColor: parser("var(--danger-DEFAULT)"),
|
|
40
|
+
borderColor: parser("var(--danger-hover)"),
|
|
41
|
+
color: parser("var(--danger-foreground)"),
|
|
42
|
+
},
|
|
43
|
+
inactive: {
|
|
44
|
+
backgroundColor: parser("var(--background)"),
|
|
45
|
+
borderColor: parser("var(--card-border)"),
|
|
46
|
+
color: parser("var(--disabled)"),
|
|
47
|
+
},
|
|
48
|
+
active: {
|
|
49
|
+
backgroundColor: parser("var(--primary-DEFAULT)"),
|
|
50
|
+
borderColor: parser("var(--primary-DEFAULT)"),
|
|
51
|
+
color: parser("var(--primary-foreground)"),
|
|
52
|
+
},
|
|
53
|
+
complete: {
|
|
54
|
+
backgroundColor: parser("var(--success-DEFAULT)"),
|
|
55
|
+
borderColor: parser("var(--success-DEFAULT)"),
|
|
56
|
+
color: parser("var(--success-DEFAULT)"),
|
|
57
|
+
},
|
|
58
|
+
}, transition: { duration: 0.2 }, className: "relative flex h-10 w-10 items-center justify-center rounded-full font-semibold", children: _jsx("div", { className: "flex items-center justify-center", children: status === "complete" ? (_jsx(CheckIcon, { className: "h-6 w-6 text-primary-foreground" })) : status === "error" ? (_jsx(ErrorIcon, { className: "h-6 w-6 text-danger-foreground" })) : (_jsx("span", { children: props.step })) }) })] }));
|
|
59
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PropsWithChildren } from "react";
|
|
2
|
+
import { Label } from "../../types";
|
|
3
|
+
export type TabsProps = {
|
|
4
|
+
active: string;
|
|
5
|
+
useHash?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
onChange?: (id: string) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const Tabs: (props: PropsWithChildren<TabsProps>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export type TabProps = {
|
|
11
|
+
id: string;
|
|
12
|
+
title: string;
|
|
13
|
+
label?: undefined;
|
|
14
|
+
} | {
|
|
15
|
+
id: string;
|
|
16
|
+
title: Omit<Label, string>;
|
|
17
|
+
label: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const Tab: (props: PropsWithChildren<TabProps>) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../../src/components/display/tabs.tsx"],"names":[],"mappings":"AAEA,OAAc,EAA2B,iBAAiB,EAAkD,MAAM,OAAO,CAAC;AAG1H,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,MAAM,MAAM,SAAS,GAAG;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AAIF,eAAO,MAAM,IAAI,UAAW,iBAAiB,CAAC,SAAS,CAAC,4CA2FvD,CAAC;AAIF,MAAM,MAAM,QAAQ,GACd;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GAChD;IACI,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAER,eAAO,MAAM,GAAG,UAAW,iBAAiB,CAAC,QAAQ,CAAC,4CAGrD,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useMotionValue } from "framer-motion";
|
|
4
|
+
import React, { createContext, Fragment, useContext, useEffect, useLayoutEffect, useRef } from "react";
|
|
5
|
+
import { useReactive } from "../../hooks/use-reactive";
|
|
6
|
+
import { useStableRef } from "../../hooks/use-stable-ref";
|
|
7
|
+
import { Card } from "./card";
|
|
8
|
+
const Context = createContext("");
|
|
9
|
+
export const Tabs = (props) => {
|
|
10
|
+
const [active, setActive] = useReactive(props.active);
|
|
11
|
+
const left = useMotionValue(0);
|
|
12
|
+
const width = useMotionValue(0);
|
|
13
|
+
const ref = useRef(null);
|
|
14
|
+
const Render = props.useHash ? "a" : "button";
|
|
15
|
+
useLayoutEffect(() => {
|
|
16
|
+
const header = ref.current;
|
|
17
|
+
if (header === null)
|
|
18
|
+
return;
|
|
19
|
+
const resize = (element) => {
|
|
20
|
+
if (!element)
|
|
21
|
+
return;
|
|
22
|
+
const rect = element.getBoundingClientRect();
|
|
23
|
+
width.set(rect.width);
|
|
24
|
+
left.set(element.offsetLeft);
|
|
25
|
+
};
|
|
26
|
+
const listener = () => {
|
|
27
|
+
const element = header.querySelector(`li[data-active=true]`);
|
|
28
|
+
return void resize(element);
|
|
29
|
+
};
|
|
30
|
+
window.addEventListener("resize", listener);
|
|
31
|
+
let first = header.querySelector(`li[data-active=true]`);
|
|
32
|
+
const hash = window.location.hash.replace(/^#/, "");
|
|
33
|
+
if (props.active === "" && hash !== "") {
|
|
34
|
+
first = header.querySelector(`li[data-id=${hash}]`);
|
|
35
|
+
setActive(hash);
|
|
36
|
+
}
|
|
37
|
+
if (first === null) {
|
|
38
|
+
first = header.querySelector(`li[data-id]`);
|
|
39
|
+
const id = first.getAttribute("data-id") || "";
|
|
40
|
+
setActive(id);
|
|
41
|
+
}
|
|
42
|
+
resize(first);
|
|
43
|
+
return () => window.removeEventListener("resize", listener);
|
|
44
|
+
}, []);
|
|
45
|
+
const onChangeRef = useStableRef(props.onChange);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (onChangeRef.current)
|
|
48
|
+
onChangeRef.current(active);
|
|
49
|
+
}, [onChangeRef, active]);
|
|
50
|
+
const items = React.Children.toArray(props.children);
|
|
51
|
+
const onClick = (e) => {
|
|
52
|
+
const anchor = e.currentTarget;
|
|
53
|
+
const rect = anchor.getBoundingClientRect();
|
|
54
|
+
width.set(rect.width);
|
|
55
|
+
left.set(anchor.offsetLeft);
|
|
56
|
+
setActive(anchor.dataset.id || "");
|
|
57
|
+
};
|
|
58
|
+
return (_jsx(Context.Provider, { value: active, children: _jsx(Card, { className: props.className, container: "pt-0 max-w-full w-full min-w-0", header: _jsx("header", { ref: ref, className: "relative mb-2 overflow-x-auto border-b border-card-border", children: _jsx("nav", { className: "min-w-0", children: _jsx("ul", { className: "flex w-0 min-w-full flex-1 justify-start overflow-x-auto", children: items.map((x) => {
|
|
59
|
+
const inner = x.props;
|
|
60
|
+
return (_jsx("li", { "data-id": inner.id, "data-active": active === inner.id, className: "w-full border-b-2 border-card-border data-[active=true]:border-primary data-[active=true]:font-bold data-[active=true]:text-primary", children: _jsx(Render, { "data-id": inner.id, onClick: onClick, "aria-current": "page", href: props.useHash ? `#${inner.id}` : undefined, className: "block w-full whitespace-nowrap px-10 py-4", children: inner.title }) }, `tab-header-${inner.id}`));
|
|
61
|
+
}) }) }) }), children: props.children }) }));
|
|
62
|
+
};
|
|
63
|
+
const useTabs = () => useContext(Context);
|
|
64
|
+
export const Tab = (props) => {
|
|
65
|
+
const active = useTabs();
|
|
66
|
+
return _jsx(Fragment, { children: props.id === active ? props.children : null });
|
|
67
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const typeMap: {
|
|
3
|
+
tag: () => null;
|
|
4
|
+
custom: () => null;
|
|
5
|
+
record: ({ item }: {
|
|
6
|
+
item: TimelineItemProps;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
};
|
|
9
|
+
export type TimelineItemType = keyof typeof typeMap;
|
|
10
|
+
export type TimelineItemProps = {
|
|
11
|
+
id: string | number;
|
|
12
|
+
date: Date;
|
|
13
|
+
type: TimelineItemType;
|
|
14
|
+
avatar?: {
|
|
15
|
+
img?: string;
|
|
16
|
+
name: string;
|
|
17
|
+
profile?: string;
|
|
18
|
+
};
|
|
19
|
+
text?: string;
|
|
20
|
+
custom?: React.FC<{
|
|
21
|
+
item: TimelineItemProps;
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
24
|
+
export type TimelineProps = {
|
|
25
|
+
items: TimelineItemProps[];
|
|
26
|
+
Custom?: React.FC<{
|
|
27
|
+
item: TimelineItemProps;
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
30
|
+
export declare const Timeline: (props: TimelineProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=timeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../../../../src/components/display/timeline.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,QAAA,MAAM,OAAO;;;;cA4B+B,iBAAiB;;CAAI,CAAC;AAElE,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,OAAO,CAAC;AAEpD,MAAM,MAAM,iBAAiB,GAAG;IAC5B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,IAAI,EAAE,iBAAiB,CAAA;KAAE,CAAC,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,IAAI,EAAE,iBAAiB,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC;AAE3G,eAAO,MAAM,QAAQ,UAAW,aAAa,4CAyB5C,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { MessagesSquareIcon } from "lucide-react";
|
|
3
|
+
import { Fragment } from "react";
|
|
4
|
+
const typeMap = {
|
|
5
|
+
tag: () => null,
|
|
6
|
+
custom: () => null,
|
|
7
|
+
record: ({ item }) => {
|
|
8
|
+
var _a, _b, _c, _d;
|
|
9
|
+
return (_jsxs(Fragment, { children: [_jsxs("div", { className: "relative", children: [_jsx("img", { src: (_a = item.avatar) === null || _a === void 0 ? void 0 : _a.img, alt: (_b = item.avatar) === null || _b === void 0 ? void 0 : _b.name, className: "flex aspect-square size-12 items-center justify-center rounded-full bg-primary-hover" }), _jsx("span", { className: "absolute -bottom-0.5 -right-1 rounded-full rounded-tl bg-card-background px-0.5 py-px", children: _jsx(MessagesSquareIcon, { "aria-hidden": "true", className: "aspect-square size-5" }) })] }), _jsxs("div", { className: "min-w-0 flex-1 text-foreground", children: [_jsxs("div", { children: [_jsx("a", { href: (_c = item.avatar) === null || _c === void 0 ? void 0 : _c.profile, className: "text-base font-medium text-primary", children: (_d = item.avatar) === null || _d === void 0 ? void 0 : _d.name }), _jsxs("p", { className: "mt-0.5 text-sm", children: ["Commented ", item.date.toISOString()] })] }), _jsx("div", { className: "mt-2 text-wrap text-sm", children: _jsx("p", { children: item.text }) })] })] }));
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export const Timeline = (props) => {
|
|
13
|
+
return (_jsx("div", { className: "flow-root", children: _jsx("ul", { role: "list", className: "-mb-8", children: props.items.map((item, index) => {
|
|
14
|
+
var _a;
|
|
15
|
+
const Render = (_a = typeMap[item.type]) !== null && _a !== void 0 ? _a : null;
|
|
16
|
+
if (Render === null && props.Custom) {
|
|
17
|
+
return _jsx(props.Custom, { item: item });
|
|
18
|
+
}
|
|
19
|
+
return (_jsx("li", { children: _jsxs("div", { className: "relative pb-8", children: [index !== props.items.length - 1 ? (_jsx("span", { "aria-hidden": "true", className: "absolute left-5 top-5 -ml-px h-full w-0.5 bg-card-border" })) : null, _jsx("div", { className: "relative flex items-start space-x-3", children: _jsx(Render, { item: item }) })] }) }, item.id));
|
|
20
|
+
}) }) }));
|
|
21
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
2
|
+
type DropdownProps = {
|
|
3
|
+
open?: boolean;
|
|
4
|
+
arrow?: boolean;
|
|
5
|
+
restoreFocus?: boolean;
|
|
6
|
+
returnFocus?: boolean;
|
|
7
|
+
onChange?: (nextValue: boolean) => void;
|
|
8
|
+
trigger: React.ReactElement | React.ReactNode;
|
|
9
|
+
title?: React.ReactNode | React.ReactElement | string;
|
|
10
|
+
buttonProps?: React.ComponentProps<"button">;
|
|
11
|
+
};
|
|
12
|
+
export declare const Dropdown: (props: PropsWithChildren<DropdownProps>) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=dropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/floating/dropdown.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,EAAY,iBAAiB,EAAoC,MAAM,OAAO,CAAC;AAE7F,KAAK,aAAa,GAAG;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,OAAO,EAAE,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,SAAS,CAAC;IAC9C,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC;IACtD,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,QAAQ,UAAW,iBAAiB,CAAC,aAAa,CAAC,4CAoE/D,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { arrow, autoUpdate, flip, FloatingArrow, FloatingFocusManager, FloatingPortal, offset, shift, useClick, useDismiss, useFloating, useInteractions, useRole, } from "@floating-ui/react";
|
|
4
|
+
import { Fragment, useId, useMemo, useRef, useState } from "react";
|
|
5
|
+
export const Dropdown = (props) => {
|
|
6
|
+
const headingId = useId();
|
|
7
|
+
const [open, setOpen] = useState(props.open);
|
|
8
|
+
const arrowRef = useRef(null);
|
|
9
|
+
const middleware = useMemo(() => [
|
|
10
|
+
offset(10),
|
|
11
|
+
flip({ fallbackAxisSideDirection: "end" }),
|
|
12
|
+
shift(),
|
|
13
|
+
arrow({
|
|
14
|
+
padding: 5,
|
|
15
|
+
element: arrowRef,
|
|
16
|
+
}),
|
|
17
|
+
], [props.arrow]);
|
|
18
|
+
const { refs, floatingStyles, context } = useFloating({
|
|
19
|
+
open,
|
|
20
|
+
middleware,
|
|
21
|
+
transform: true,
|
|
22
|
+
whileElementsMounted: autoUpdate,
|
|
23
|
+
onOpenChange: (nextValue, event) => {
|
|
24
|
+
var _a;
|
|
25
|
+
const element = event === null || event === void 0 ? void 0 : event.relatedTarget;
|
|
26
|
+
if (element) {
|
|
27
|
+
if (element.dataset.floating === "true" && !nextValue)
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
setOpen(nextValue);
|
|
31
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, nextValue);
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
const click = useClick(context);
|
|
35
|
+
const dismiss = useDismiss(context);
|
|
36
|
+
const role = useRole(context);
|
|
37
|
+
const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss, role]);
|
|
38
|
+
return (_jsxs(Fragment, { children: [_jsx("button", Object.assign({ ref: refs.setReference }, getReferenceProps(props.buttonProps), { type: "button", children: props.trigger })), open && (_jsx(FloatingPortal, { preserveTabOrder: true, id: `${headingId}-portal`, children: _jsx(FloatingFocusManager, { guards: true, restoreFocus: true, returnFocus: true, visuallyHiddenDismiss: true, context: context, modal: false, children: _jsxs("div", Object.assign({ className: "relative isolate z-floating min-w-96 rounded-lg border border-floating-border bg-floating-background p-6 shadow-2xl", ref: refs.setFloating, style: floatingStyles, "aria-labelledby": headingId }, getFloatingProps(), { children: [_jsx(FloatingArrow, { ref: arrowRef, context: context, strokeWidth: 0.1, className: "fill-floating-background stroke-floating-border" }), _jsx("header", { className: "mb-2", children: _jsx("h3", { className: "text-left text-2xl font-medium leading-snug tracking-wide", children: props.title }) }), props.children] })) }) }))] }));
|
|
39
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { motion } from "framer-motion";
|
|
2
|
+
import { PropsWithChildren } from "react";
|
|
3
|
+
import { Label, Override } from "../../types";
|
|
4
|
+
import { ButtonProps } from "../core/button";
|
|
5
|
+
export type ExpandProps = Override<ButtonProps<typeof motion.button>, {
|
|
6
|
+
trigger: Label;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const Expand: (props: PropsWithChildren<ExpandProps>) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=expand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expand.d.ts","sourceRoot":"","sources":["../../../../src/components/floating/expand.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAmB,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAA2B,MAAM,OAAO,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAU,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE;IAAE,OAAO,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC;AAE1F,eAAO,MAAM,MAAM,UAAW,iBAAiB,CAAC,WAAW,CAAC,4CA4C3D,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { FloatingFocusManager, FloatingPortal, useClick, useDismiss, useFloating, useInteractions, useRole } from "@floating-ui/react";
|
|
4
|
+
import { AnimatePresence, motion } from "framer-motion";
|
|
5
|
+
import { useId, useRef, useState } from "react";
|
|
6
|
+
import { Button } from "../core/button";
|
|
7
|
+
export const Expand = (props) => {
|
|
8
|
+
const root = useRef(null);
|
|
9
|
+
const id = useId();
|
|
10
|
+
const wrapperId = `${id}:wrapper`;
|
|
11
|
+
const titleId = `${id}:title`;
|
|
12
|
+
const [open, setOpen] = useState(false);
|
|
13
|
+
const { context, refs } = useFloating({
|
|
14
|
+
transform: true,
|
|
15
|
+
open: open !== null,
|
|
16
|
+
nodeId: id,
|
|
17
|
+
onOpenChange: setOpen,
|
|
18
|
+
strategy: "absolute",
|
|
19
|
+
});
|
|
20
|
+
const click = useClick(context);
|
|
21
|
+
const role = useRole(context);
|
|
22
|
+
const dismiss = useDismiss(context, { escapeKey: true, referencePress: true, outsidePress: true });
|
|
23
|
+
const { getFloatingProps, getReferenceProps } = useInteractions([click, role, dismiss]);
|
|
24
|
+
return (_jsxs("div", { className: "relative inline-flex items-center justify-center", ref: root, children: [_jsx(Button, Object.assign({}, getReferenceProps(props), { as: motion.button, layoutId: wrapperId, ref: refs.setReference, size: "small", onClick: () => setOpen(true), children: _jsx(motion.span, { layoutId: titleId, children: props.trigger }) })), _jsx(AnimatePresence, { children: open ? (_jsx(FloatingPortal, { root: root, children: _jsx(FloatingFocusManager, { visuallyHiddenDismiss: true, modal: true, closeOnFocusOut: true, context: context, children: _jsx(motion.div, Object.assign({}, getFloatingProps(), { ref: refs.setFloating, layoutId: wrapperId, className: "absolute -left-1/4 -top-3/4", children: props.children })) }) })) : null })] }));
|
|
25
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { LucideProps } from "lucide-react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Override } from "../../types";
|
|
4
|
+
export type MenuProps = Partial<{
|
|
5
|
+
FloatingComponent: React.ElementType;
|
|
6
|
+
floatingClassName: string;
|
|
7
|
+
hover: boolean;
|
|
8
|
+
nested: boolean;
|
|
9
|
+
isParent: boolean;
|
|
10
|
+
asChild: boolean;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
} & ({
|
|
13
|
+
label: string;
|
|
14
|
+
} | {
|
|
15
|
+
label: React.ReactElement;
|
|
16
|
+
title: string;
|
|
17
|
+
})>;
|
|
18
|
+
type MenuItemProps = {
|
|
19
|
+
label: string;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
Right?: React.FC<LucideProps>;
|
|
22
|
+
} | {
|
|
23
|
+
label: React.ReactElement;
|
|
24
|
+
title: string;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
Right?: React.FC<LucideProps>;
|
|
27
|
+
};
|
|
28
|
+
export declare const MenuItem: React.ForwardRefExoticComponent<Override<React.ButtonHTMLAttributes<HTMLButtonElement>, MenuItemProps> & React.RefAttributes<HTMLButtonElement>>;
|
|
29
|
+
export declare const Menu: React.ForwardRefExoticComponent<(Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "label" | "children" | "hover" | "FloatingComponent" | "floatingClassName" | "nested" | "isParent" | "asChild"> & Partial<{
|
|
30
|
+
FloatingComponent: React.ElementType;
|
|
31
|
+
floatingClassName: string;
|
|
32
|
+
hover: boolean;
|
|
33
|
+
nested: boolean;
|
|
34
|
+
isParent: boolean;
|
|
35
|
+
asChild: boolean;
|
|
36
|
+
children: React.ReactNode;
|
|
37
|
+
} & {
|
|
38
|
+
label: string;
|
|
39
|
+
}>, "ref"> | Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "label" | "children" | "hover" | "FloatingComponent" | "floatingClassName" | "nested" | "isParent" | "asChild"> & Partial<{
|
|
40
|
+
FloatingComponent: React.ElementType;
|
|
41
|
+
floatingClassName: string;
|
|
42
|
+
hover: boolean;
|
|
43
|
+
nested: boolean;
|
|
44
|
+
isParent: boolean;
|
|
45
|
+
asChild: boolean;
|
|
46
|
+
children: React.ReactNode;
|
|
47
|
+
} & {
|
|
48
|
+
label: React.ReactElement;
|
|
49
|
+
title: string;
|
|
50
|
+
}>, "ref">) & React.RefAttributes<HTMLButtonElement>>;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../../src/components/floating/menu.tsx"],"names":[],"mappings":"AA2BA,OAAO,EAAoB,WAAW,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAA2E,MAAM,OAAO,CAAC;AAGhG,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAyBvC,MAAM,MAAM,SAAS,GAAG,OAAO,CAC3B;IACI,iBAAiB,EAAE,KAAK,CAAC,WAAW,CAAC;IACrC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B,GAAG,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CACzE,CAAC;AAkKF,KAAK,aAAa,GACZ;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;CAAE,GACpE;IAAE,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC;AAEtG,eAAO,MAAM,QAAQ,kJAiCpB,CAAC;AAEF,eAAO,MAAM,IAAI;uBAjNU,KAAK,CAAC,WAAW;uBACjB,MAAM;WAClB,OAAO;YACN,OAAO;cACL,OAAO;aACR,OAAO;cACN,KAAK,CAAC,SAAS;;WACf,MAAM;;uBAPG,KAAK,CAAC,WAAW;uBACjB,MAAM;WAClB,OAAO;YACN,OAAO;cACL,OAAO;aACR,OAAO;cACN,KAAK,CAAC,SAAS;;WACK,KAAK,CAAC,YAAY;WAAS,MAAM;qDAmNrE,CAAC"}
|