@g4rcez/components 2.0.30 → 2.0.32
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/components/display/step.d.ts.map +1 -1
- package/dist/components/display/step.js +4 -3
- package/dist/components/floating/wizard.d.ts +26 -0
- package/dist/components/floating/wizard.d.ts.map +1 -0
- package/dist/components/floating/wizard.js +119 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -1
- package/dist/components/table/index.d.ts.map +1 -1
- package/dist/components/table/index.js +4 -1
- package/dist/components/table/inner-table.d.ts +1 -1
- package/dist/components/table/inner-table.d.ts.map +1 -1
- package/dist/components/table/inner-table.js +3 -3
- package/dist/components/table/metadata.d.ts.map +1 -1
- package/dist/components/table/metadata.js +2 -6
- package/dist/components/table/row.d.ts.map +1 -1
- package/dist/components/table/row.js +1 -1
- package/dist/config/default-translations.d.ts +4 -0
- package/dist/config/default-translations.d.ts.map +1 -1
- package/dist/config/default-translations.js +4 -0
- package/dist/hooks/use-resize-observer.d.ts +2 -0
- package/dist/hooks/use-resize-observer.d.ts.map +1 -0
- package/dist/hooks/use-resize-observer.js +17 -0
- package/dist/hooks/use-translations.d.ts +4 -0
- package/dist/hooks/use-translations.d.ts.map +1 -1
- package/dist/hooks/use-window-size.d.ts +5 -0
- package/dist/hooks/use-window-size.d.ts.map +1 -0
- package/dist/hooks/use-window-size.js +14 -0
- package/dist/index.css +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9964 -9811
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +12 -12
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../src/components/display/step.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAA2C,iBAAiB,EAA2C,MAAM,OAAO,CAAC;AAEnI,OAAO,E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CAAC;AAoCF,eAAO,MAAM,cAAc,+BAAgC,CAAC;AAE5D,eAAO,MAAM,IAAI,GAAI,gEAAgE,SAAS,4CAqF7F,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,OAAO,iBAAiB,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,4CA2CrF,CAAC"}
|
|
@@ -64,7 +64,7 @@ export const Step = ({ step, currentStep, status, title, titleClassName, ...prop
|
|
|
64
64
|
return () => clearTimeout(timer);
|
|
65
65
|
}, [currentStep, context, step]);
|
|
66
66
|
const innerStatus = getCurrentStatus(step, visualCurrentStep, status);
|
|
67
|
-
return (_jsxs(motion.button, { ...props, type: "button", "data-step": step, animate: innerStatus, className: "relative
|
|
67
|
+
return (_jsxs(motion.button, { ...props, type: "button", "data-step": step, animate: innerStatus, className: "flex relative justify-center items-center w-auto text-center", children: [_jsx(motion.div, { variants: variants, transition: transitions, className: `hidden lg:block absolute inset-0 rounded-full text-center ${innerStatus === "error" ? "bg-danger" : ""}` }), _jsx(motion.div, { initial: false, animate: innerStatus, transition: transition, className: "flex relative justify-center items-center w-10 h-10 font-semibold rounded-full", variants: {
|
|
68
68
|
error: {
|
|
69
69
|
color: parser("var(--danger-foreground)"),
|
|
70
70
|
borderColor: parser("var(--danger-hover)"),
|
|
@@ -88,7 +88,8 @@ export const Step = ({ step, currentStep, status, title, titleClassName, ...prop
|
|
|
88
88
|
borderColor: parser("var(--success-DEFAULT)"),
|
|
89
89
|
backgroundColor: parser("var(--success-DEFAULT)"),
|
|
90
90
|
},
|
|
91
|
-
}, children: _jsx("div", { className: "flex justify-center items-center", children: innerStatus === "complete" ? (_jsx(CheckIcon, { className: "size-6 text-primary-foreground" })) : innerStatus === "error" ? (_jsx(ErrorIcon, { className: "size-6 text-danger-foreground" })) : (_jsx(Fragment, { children: _jsx("span", { children: step }) })) }) }), title && innerStatus === "active" ? _jsx("span", { className: `h-full flex items-center px-4 ${titleClassName}`, children: title }) :
|
|
91
|
+
}, children: _jsx("div", { className: "flex justify-center items-center", children: innerStatus === "complete" ? (_jsx(CheckIcon, { className: "size-6 text-primary-foreground" })) : innerStatus === "error" ? (_jsx(ErrorIcon, { className: "size-6 text-danger-foreground" })) : (_jsx(Fragment, { children: _jsx("span", { children: step }) })) }) }), title && innerStatus === "active" ? _jsx("span", { className: `h-full flex items-center px-4 ${titleClassName}`, children: title }) :
|
|
92
|
+
_jsx("span", { className: `block lg:hidden h-full items-center px-4 ${titleClassName}`, children: title })] }));
|
|
92
93
|
};
|
|
93
94
|
export const Steps = (props) => {
|
|
94
95
|
const [ref, animate] = useAnimate();
|
|
@@ -117,5 +118,5 @@ export const Steps = (props) => {
|
|
|
117
118
|
previousStep: previousStepRef.current,
|
|
118
119
|
progressBarDuration: PROGRESS_BAR_DURATION,
|
|
119
120
|
};
|
|
120
|
-
return (_jsx(StepContext.Provider, { value: contextValue, children: _jsxs("div", { className: "flex relative justify-between", ref: ref, children: [_jsx("div", { className: "absolute top-1/2 h-1 w-[calc(100%)] bg-card-border" }), _jsx("div", { "data-name": "progress", className: "absolute top-1/2 w-0 h-1 bg-success" }), props.children] }) }));
|
|
121
|
+
return (_jsx(StepContext.Provider, { value: contextValue, children: _jsxs("div", { className: "flex relative flex-col gap-4 justify-center lg:justify-between items-start w-full lg:flex-row lg:items-center", ref: ref, children: [_jsx("div", { className: "hidden lg:block absolute top-1/2 h-1 w-[calc(100%)] bg-card-border" }), _jsx("div", { "data-name": "progress", className: "hidden absolute top-1/2 w-0 h-1 lg:block bg-success" }), props.children] }) }));
|
|
121
122
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Placement } from "@floating-ui/react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export type WizardStep = {
|
|
4
|
+
side?: Placement;
|
|
5
|
+
onNext?: () => void;
|
|
6
|
+
onEnter?: () => void;
|
|
7
|
+
onPrevious?: () => void;
|
|
8
|
+
title?: React.ReactNode;
|
|
9
|
+
description?: React.ReactNode;
|
|
10
|
+
element: string | Element | React.RefObject<Element | null>;
|
|
11
|
+
};
|
|
12
|
+
export type WizardProps = {
|
|
13
|
+
active?: boolean;
|
|
14
|
+
steps: WizardStep[];
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
onFinish?: () => void;
|
|
17
|
+
onChange?: (index: number) => void;
|
|
18
|
+
labels?: {
|
|
19
|
+
next?: string;
|
|
20
|
+
skip?: string;
|
|
21
|
+
finish?: string;
|
|
22
|
+
previous?: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare const Wizard: ({ steps, active, onClose, onFinish, onChange, labels: labelsProp, }: WizardProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
26
|
+
//# sourceMappingURL=wizard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wizard.d.ts","sourceRoot":"","sources":["../../../src/components/floating/wizard.tsx"],"names":[],"mappings":"AACA,OAAO,EAOL,SAAS,EAKV,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAgF,MAAM,OAAO,CAAC;AAOrG,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;CAC7D,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/E,CAAC;AAiBF,eAAO,MAAM,MAAM,GAAI,qEAOpB,WAAW,mDAqLb,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { arrow, autoUpdate, flip, FloatingArrow, FloatingPortal, offset, shift, useFloating, useInteractions, useRole, } from "@floating-ui/react";
|
|
4
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
5
|
+
import { Fragment, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
6
|
+
import { useResizeObserver } from "../../hooks/use-resize-observer";
|
|
7
|
+
import { useTranslations } from "../../hooks/use-translations";
|
|
8
|
+
import { useWindowSize } from "../../hooks/use-window-size";
|
|
9
|
+
import { noop } from "../../lib/fns";
|
|
10
|
+
import { Button } from "../core/button";
|
|
11
|
+
const getRect = (element) => {
|
|
12
|
+
if (!element)
|
|
13
|
+
return { top: 0, left: 0, width: 0, height: 0, bottom: 0, right: 0 };
|
|
14
|
+
return element.getBoundingClientRect();
|
|
15
|
+
};
|
|
16
|
+
const resolveElement = (element) => {
|
|
17
|
+
if (typeof element === 'string') {
|
|
18
|
+
return document.querySelector(element);
|
|
19
|
+
}
|
|
20
|
+
if ('current' in element) {
|
|
21
|
+
return element.current;
|
|
22
|
+
}
|
|
23
|
+
return element;
|
|
24
|
+
};
|
|
25
|
+
export const Wizard = ({ steps, active = false, onClose = noop, onFinish = noop, onChange = noop, labels: labelsProp, }) => {
|
|
26
|
+
const translation = useTranslations();
|
|
27
|
+
const [index, setIndex] = useState(0);
|
|
28
|
+
const currentStep = steps[index];
|
|
29
|
+
const [element, setElement] = useState(null);
|
|
30
|
+
const [rect, setRect] = useState(getRect(null));
|
|
31
|
+
const [isOverlayReady, setIsOverlayReady] = useState(false);
|
|
32
|
+
const arrowRef = useRef(null);
|
|
33
|
+
const { width, height } = useWindowSize();
|
|
34
|
+
const labels = {
|
|
35
|
+
next: labelsProp?.next ?? translation.driverNext,
|
|
36
|
+
previous: labelsProp?.previous ?? translation.driverPrevious,
|
|
37
|
+
finish: labelsProp?.finish ?? translation.driverFinish,
|
|
38
|
+
skip: labelsProp?.skip ?? translation.driverSkip,
|
|
39
|
+
};
|
|
40
|
+
const { refs, floatingStyles, context } = useFloating({
|
|
41
|
+
open: active && isOverlayReady,
|
|
42
|
+
placement: currentStep?.side || "bottom",
|
|
43
|
+
whileElementsMounted: autoUpdate,
|
|
44
|
+
middleware: [
|
|
45
|
+
offset(10),
|
|
46
|
+
flip(),
|
|
47
|
+
shift(),
|
|
48
|
+
arrow({ element: arrowRef }),
|
|
49
|
+
],
|
|
50
|
+
});
|
|
51
|
+
const { getFloatingProps } = useInteractions([useRole(context),]);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (active) {
|
|
54
|
+
setIndex(0);
|
|
55
|
+
}
|
|
56
|
+
}, [active]);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
setIsOverlayReady(false);
|
|
59
|
+
}, [index, active]);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (!active || !currentStep)
|
|
62
|
+
return;
|
|
63
|
+
const el = resolveElement(currentStep.element);
|
|
64
|
+
if (el) {
|
|
65
|
+
setElement(el);
|
|
66
|
+
setRect(el.getBoundingClientRect());
|
|
67
|
+
refs.setReference(el);
|
|
68
|
+
currentStep.onEnter?.();
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
console.warn(`Driver: Element not found:`, currentStep.element);
|
|
72
|
+
setElement(null);
|
|
73
|
+
setRect({ top: 0, left: 0, width: 0, height: 0, bottom: 0, right: 0 });
|
|
74
|
+
}
|
|
75
|
+
}, [index, active, currentStep, refs]);
|
|
76
|
+
useLayoutEffect(() => {
|
|
77
|
+
if (!element)
|
|
78
|
+
return;
|
|
79
|
+
const update = () => setRect(element.getBoundingClientRect());
|
|
80
|
+
update();
|
|
81
|
+
window.addEventListener("scroll", update, { capture: true, passive: true });
|
|
82
|
+
window.addEventListener("resize", update, { capture: true, passive: true });
|
|
83
|
+
return () => {
|
|
84
|
+
window.removeEventListener("scroll", update, { capture: true });
|
|
85
|
+
window.removeEventListener("resize", update, { capture: true });
|
|
86
|
+
};
|
|
87
|
+
}, [element, width, height]);
|
|
88
|
+
useResizeObserver(element, (entry) => {
|
|
89
|
+
setRect(entry.target.getBoundingClientRect());
|
|
90
|
+
});
|
|
91
|
+
const handleNext = () => {
|
|
92
|
+
currentStep.onNext?.();
|
|
93
|
+
if (index < steps.length - 1) {
|
|
94
|
+
setIndex((i) => i + 1);
|
|
95
|
+
onChange(index + 1);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
onFinish();
|
|
99
|
+
onClose();
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
const handlePrevious = () => {
|
|
103
|
+
currentStep.onPrevious?.();
|
|
104
|
+
if (index > 0) {
|
|
105
|
+
setIndex((i) => i - 1);
|
|
106
|
+
onChange(index - 1);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
if (!active)
|
|
110
|
+
return null;
|
|
111
|
+
const hasNext = index < steps.length - 1;
|
|
112
|
+
const hasPrevious = index > 0;
|
|
113
|
+
return (_jsx(FloatingPortal, { children: _jsxs("div", { className: "fixed inset-0 pointer-events-none z-[9999]", children: [_jsxs("svg", { className: "absolute inset-0 w-full h-full fill-current text-floating-overlay/70", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("defs", { children: _jsxs("mask", { id: "driver-mask", children: [_jsx("rect", { x: "0", y: "0", width: "100%", height: "100%", fill: "white" }), _jsx(motion.rect, { rx: "4", fill: "black", initial: false, onAnimationComplete: () => setIsOverlayReady(true), transition: { type: "spring", duration: 0.5, ease: "easeInOut" }, animate: {
|
|
114
|
+
x: rect.left - 5,
|
|
115
|
+
y: rect.top - 5,
|
|
116
|
+
width: rect.width + 10,
|
|
117
|
+
height: rect.height + 10
|
|
118
|
+
} })] }) }), _jsx("rect", { x: "0", y: "0", width: "100%", height: "100%", mask: "url(#driver-mask)", className: "pointer-events-auto" })] }), _jsx(AnimatePresence, { mode: "wait", children: currentStep && element && isOverlayReady && (_jsx("div", { ...getFloatingProps(), ref: refs.setFloating, style: floatingStyles, className: "outline-none pointer-events-auto", children: _jsxs(motion.div, { transition: { duration: 0.2 }, exit: { opacity: 0, scale: 0.9 }, animate: { opacity: 1, scale: 1 }, initial: { opacity: 0, scale: 0.9 }, className: "flex flex-col gap-3 p-4 w-80 max-w-sm rounded-lg border shadow-lg bg-card-background border-card-border", children: [_jsx(FloatingArrow, { ref: arrowRef, context: context, className: "fill-card-background stroke-card-border" }), currentStep.title && (_jsx("h3", { children: currentStep.title })), currentStep.description && (_jsx(Fragment, { children: currentStep.description })), _jsxs("div", { className: "flex justify-between items-center pt-2 mt-2 border-t border-floating-border", children: [_jsx(Button, { theme: "raw", size: "small", onClick: onClose, className: "text-xs text-muted-foreground hover:text-foreground", children: labels.skip }), _jsxs("div", { className: "flex gap-2", children: [hasPrevious && (_jsx(Button, { size: "small", theme: "neutral", onClick: handlePrevious, children: labels.previous })), _jsx(Button, { size: "small", onClick: handleNext, children: hasNext ? labels.next : labels.finish })] })] }), _jsxs("div", { className: "absolute top-2 right-2 text-xs text-muted-foreground", children: [index + 1, " / ", steps.length] })] }) })) })] }) }));
|
|
119
|
+
};
|
|
@@ -8,8 +8,8 @@ export * from "./form/switch";
|
|
|
8
8
|
export * from "./table/index";
|
|
9
9
|
export * from "./display/card";
|
|
10
10
|
export * from "./display/list";
|
|
11
|
-
export * from "./display/tabs";
|
|
12
11
|
export * from "./display/step";
|
|
12
|
+
export * from "./display/tabs";
|
|
13
13
|
export * from "./display/alert";
|
|
14
14
|
export * from "./display/empty";
|
|
15
15
|
export * from "./display/stats";
|
|
@@ -23,6 +23,7 @@ export * from "./form/task-list";
|
|
|
23
23
|
export * from "./core/typography";
|
|
24
24
|
export * from "./display/spinner";
|
|
25
25
|
export * from "./floating/expand";
|
|
26
|
+
export * from "./floating/wizard";
|
|
26
27
|
export * from "./display/calendar";
|
|
27
28
|
export * from "./display/progress";
|
|
28
29
|
export * from "./display/timeline";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;A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oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,OAAO,EAAE,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -8,8 +8,8 @@ export * from "./form/switch";
|
|
|
8
8
|
export * from "./table/index";
|
|
9
9
|
export * from "./display/card";
|
|
10
10
|
export * from "./display/list";
|
|
11
|
-
export * from "./display/tabs";
|
|
12
11
|
export * from "./display/step";
|
|
12
|
+
export * from "./display/tabs";
|
|
13
13
|
export * from "./display/alert";
|
|
14
14
|
export * from "./display/empty";
|
|
15
15
|
export * from "./display/stats";
|
|
@@ -23,6 +23,7 @@ export * from "./form/task-list";
|
|
|
23
23
|
export * from "./core/typography";
|
|
24
24
|
export * from "./display/spinner";
|
|
25
25
|
export * from "./floating/expand";
|
|
26
|
+
export * from "./floating/wizard";
|
|
26
27
|
export * from "./display/calendar";
|
|
27
28
|
export * from "./display/progress";
|
|
28
29
|
export * from "./display/timeline";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/table/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/table/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAsB,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGlC,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAG5D,OAAO,EAAyB,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGzE,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,GAAG,QAAQ,GAAG,OAAO,CAAC,GAAG;IACvH,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CACT,mBAAmB,CAAC,CAAC,CAAC,GAAG;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,WAAW,GAAG,SAAS,CAAC;IAC7C,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,cAAc,CAAC,IAAI,CAAC,CAAC;CAC/C,CACF,CAAC;AASF,eAAO,MAAM,KAAK,GAAI,CAAC,SAAS,GAAG,EAAE,OAAO,UAAU,CAAC,CAAC,CAAC,4CAoHxD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { AnimatePresence } from "motion/react";
|
|
4
|
-
import { useMemo } from "react";
|
|
4
|
+
import { useEffect, useMemo } from "react";
|
|
5
5
|
import { useReducer } from "use-typed-reducer";
|
|
6
6
|
import { useTweaks } from "../../hooks/use-tweaks";
|
|
7
7
|
import { InnerTable } from "./inner-table";
|
|
@@ -45,5 +45,8 @@ export const Table = (props) => {
|
|
|
45
45
|
},
|
|
46
46
|
],
|
|
47
47
|
});
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
dispatch.cols(props.cols);
|
|
50
|
+
}, [props.cols]);
|
|
48
51
|
return (_jsx(TableProvider, { value: contextState, children: _jsxs(AnimatePresence, { initial: false, children: [operations ? (_jsx(Metadata, { cols: state.cols, rows: props.rows, options: optionCols, groups: state.groups, filters: state.filters, setCols: dispatch.cols, sorters: state.sorters, setGroups: dispatch.groups, setFilters: dispatch.filters, setSorters: dispatch.sorters, pagination: props.pagination ?? null, inlineFilter: props.inlineFilter ?? true, inlineSorter: props.inlineSorter ?? true })) : null, state.groups.length === 0 ? (_jsx(InnerTable, { ...props, index: 0, cols: state.cols, options: optionCols, groups: state.groups, filters: state.filters, optionCols: optionCols, setCols: dispatch.cols, sorters: state.sorters, setGroups: dispatch.groups, setFilters: dispatch.filters, setSorters: dispatch.sorters, onScrollEnd: props.onScrollEnd, pagination: props.pagination ?? null, inlineFilter: props.inlineFilter ?? true, inlineSorter: props.inlineSorter ?? true })) : (_jsx("div", { className: "flex flex-wrap gap-4", children: state.groups.map((group, index) => (_jsx("div", { className: "min-w-full", children: _jsx(InnerTable, { ...props, group: group, index: index, cols: state.cols, pagination: null, rows: group.rows, options: optionCols, groups: state.groups, filters: state.filters, optionCols: optionCols, setCols: dispatch.cols, sorters: state.sorters, setGroups: dispatch.groups, setFilters: dispatch.filters, setSorters: dispatch.sorters, onScrollEnd: props.onScrollEnd, inlineFilter: props.inlineFilter ?? true, inlineSorter: props.inlineSorter ?? true }) }, `group-${group.groupId}`))) }))] }) }));
|
|
49
52
|
};
|
|
@@ -25,5 +25,5 @@ export type InnerTableProps<T extends Any> = HTMLAttributes<HTMLTableElement> &
|
|
|
25
25
|
getRowProps?: (_: T) => ComponentProps<"tr">;
|
|
26
26
|
setGroups: React.Dispatch<React.SetStateAction<GroupItem<T>[]>>;
|
|
27
27
|
};
|
|
28
|
-
export declare const InnerTable: <T extends Any>({ cols, filters, setCols, sorters, setFilters, setSorters, onScrollEnd, getScrollRef,
|
|
28
|
+
export declare const InnerTable: <T extends Any>({ cols, filters, setCols, sorters, setFilters, setSorters, onScrollEnd, getScrollRef, pagination, useControl, ...props }: InnerTableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
29
29
|
//# sourceMappingURL=inner-table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inner-table.d.ts","sourceRoot":"","sources":["../../../src/components/table/inner-table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,cAAc,EAA2B,cAAc,EAAwC,MAAM,OAAO,CAAC;AAI7H,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGlC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC,OAAO,EAAa,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,GAAG,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIzE,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,GAAG,IAAI,cAAc,CAAC,gBAAgB,CAAC,GAC3E,mBAAmB,CAAC,CAAC,CAAC,GAAG;IACvB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACrB,UAAU,CAAC,EAAE,O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@ const loadingArray = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
|
46
46
|
const EmptyContent = (props) => (_jsx("div", { className: "flex justify-center items-center px-2 w-full h-48", children: props.loading ? SkeletonCell : _jsx(Empty, {}) }));
|
|
47
47
|
const EmptyCell = () => _jsx(Fragment, {});
|
|
48
48
|
const emptyRows = [];
|
|
49
|
-
export const InnerTable = ({ cols, filters, setCols, sorters, setFilters, setSorters, onScrollEnd, getScrollRef,
|
|
49
|
+
export const InnerTable = ({ cols, filters, setCols, sorters, setFilters, setSorters, onScrollEnd, getScrollRef, pagination = null, useControl = false, ...props }) => {
|
|
50
50
|
const ref = useRef(null);
|
|
51
|
-
const [
|
|
51
|
+
const [, setShowLoadingFooter] = useState(false);
|
|
52
52
|
const onScrollEndRef = useStableRef(onScrollEnd);
|
|
53
53
|
const loadingMoreRef = useStableRef(props.loadingMore);
|
|
54
54
|
const rows = useMemo(() => {
|
|
@@ -88,5 +88,5 @@ export const InnerTable = ({ cols, filters, setCols, sorters, setFilters, setSor
|
|
|
88
88
|
getRowProps: props.getRowProps,
|
|
89
89
|
loadingMore: props.loadingMore,
|
|
90
90
|
};
|
|
91
|
-
return (_jsxs("div", { className: "flex relative flex-col w-full whitespace-nowrap rounded-lg group", children: [_jsx(TableVirtuoso, {
|
|
91
|
+
return (_jsxs("div", { className: "flex relative flex-col w-full whitespace-nowrap rounded-lg group", children: [_jsx(TableVirtuoso, { components: components, context: context, totalCount: rows.length, itemContent: empty ? EmptyCell : Row, data: empty ? emptyRows : rows, useWindowScroll: getScrollRef ? false : true, customScrollParent: getScrollRef ? getScrollRef() : undefined, fixedHeaderContent: () => (_jsx(TableHeader, { headers: cols, filters: filters, setCols: setCols, sorters: sorters, setFilters: setFilters, setSorters: setSorters, loading: !!props.loading, inlineFilter: props.inlineFilter, inlineSorter: props.inlineSorter })) }), empty ? _jsx(EmptyContent, { loading: props.loading }) : null, _jsx("div", { "aria-hidden": "true", ref: ref, className: "w-full h-0.5" }), pagination !== null ? _jsx(Pagination, { ...pagination }) : null] }));
|
|
92
92
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/components/table/metadata.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAIlC,OAAO,EAAE,mBAAmB,EAAiB,MAAM,aAAa,CAAC;AAEjE,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,GAAG,EAAE,OAAO,mBAAmB,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/components/table/metadata.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAIlC,OAAO,EAAE,mBAAmB,EAAiB,MAAM,aAAa,CAAC;AAEjE,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,GAAG,EAAE,OAAO,mBAAmB,CAAC,CAAC,CAAC,4CA6CpE,CAAC"}
|
|
@@ -3,12 +3,8 @@ import { Filter } from "./filter";
|
|
|
3
3
|
import { Group } from "./group";
|
|
4
4
|
import { Sort } from "./sort";
|
|
5
5
|
import { valueFromType } from "./table-lib";
|
|
6
|
-
export const Metadata = (props) => (_jsx("header", { className: "min-w-full
|
|
6
|
+
export const Metadata = (props) => (_jsx("header", { className: "mb-1 min-w-full", children: _jsxs("div", { className: "flex flex-wrap gap-y-1 gap-x-4 justify-between items-center min-w-full", children: [_jsxs("div", { className: "flex gap-4 py-2 whitespace-nowrap w-fit items-centeend", children: [_jsx("span", { children: _jsx(Filter, { cols: props.cols, options: props.options, filters: props.filters, set: props.setFilters }) }), _jsx("span", { children: _jsx(Sort, { options: props.options, cols: props.cols, sorters: props.sorters, set: props.setSorters }) }), _jsx("span", { children: _jsx(Group, { rows: props.rows, groups: props.groups, setGroups: props.setGroups, options: props.options, cols: props.cols }) })] }), _jsx("ul", { className: "flex flex-row flex-wrap flex-1 flex-grow gap-4 items-center w-full md:justify-end", children: props.filters.map((x) => (_jsxs("li", { className: "flex gap-1 items-center py-0.5 px-4 rounded-xl border border-card-border", children: [_jsxs("span", { children: [_jsx("span", { className: "inline-block mr-2 rounded-full size-3 aspect-square bg-primary", "aria-hidden": "true" }), x.label, " ", x.operation.label.toLowerCase(), ":"] }), _jsxs("div", { className: "relative w-min min-w-[1ch]", children: [_jsx("span", { "aria-hidden": "true", className: "invisible p-0 whitespace-pre", children: x.value || " " }), _jsx("input", { type: x.type, value: x.value, className: "absolute left-0 top-0 m-0 inline-block w-full bg-transparent p-0 placeholder-primary/70 outline-none [appearance:textfield] after:empty:text-primary/70 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none", onChange: (e) => {
|
|
7
7
|
const value = valueFromType(e.target);
|
|
8
8
|
props.setFilters((prev) => prev.map((item) => x.id === item.id
|
|
9
|
-
? {
|
|
10
|
-
...item,
|
|
11
|
-
value,
|
|
12
|
-
}
|
|
13
|
-
: item));
|
|
9
|
+
? { ...item, value, } : item));
|
|
14
10
|
} })] })] }, `filter-table-${x.id}`))) })] }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row.d.ts","sourceRoot":"","sources":["../../../src/components/table/row.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmE,MAAM,OAAO,CAAC;AAGxF,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAoB,GAAG,EAAa,MAAM,aAAa,CAAC;AAEjF,KAAK,kBAAkB,GAAG;
|
|
1
|
+
{"version":3,"file":"row.d.ts","sourceRoot":"","sources":["../../../src/components/table/row.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmE,MAAM,OAAO,CAAC;AAGxF,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAoB,GAAG,EAAa,MAAM,aAAa,CAAC;AAEjF,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC;CACzC,CAAC;AA6CF,eAAO,MAAM,GAAG,GAAI,OAAO,MAAM,EAAE,KAAK,GAAG,EAAE,SAAS,kBAAkB,4CAwCvE,CAAC"}
|
|
@@ -42,6 +42,6 @@ export const Row = (index, row, context) => {
|
|
|
42
42
|
return (_createElement("td", { ...col.cellProps, role: "cell", "data-matrix": matrix, key: `accessor-${index}-${colIndex}`, className: `typography group-table-cell p-[var(--table-cell-padding)] whitespace-pre-wrap flex flex-col md:table-cell border-b border md:border-l-transparent md:border-b-0 border-y border-collapse border-table-border md:border-r md:last:border-r-transparent ${className}` },
|
|
43
43
|
exposeAside ? (_jsx(RowAside, { children: _jsx(Aside, { col: col, row: row, rowIndex: index }) })) : null,
|
|
44
44
|
_jsx("span", { className: "block text-sm font-bold leading-tight md:hidden", children: col.thead }),
|
|
45
|
-
_jsx("span", { className: "relative", children: loading ?
|
|
45
|
+
_jsx("span", { className: "relative", children: loading ? SkeletonCell : Component ? (_jsx(Fragment, { children: _jsx(Component, { row: row, matrix: matrix, col: col, rowIndex: index, value: value }) })) : (_jsx(Fragment, { children: Is.nil(value) ? "" : value })) })));
|
|
46
46
|
}) }));
|
|
47
47
|
};
|
|
@@ -15,6 +15,10 @@ export declare const defaultTranslations: {
|
|
|
15
15
|
inputCaretDown: string;
|
|
16
16
|
inputCloseValue: string;
|
|
17
17
|
inputOptionalLabel: string;
|
|
18
|
+
driverNext: string;
|
|
19
|
+
driverPrevious: string;
|
|
20
|
+
driverFinish: string;
|
|
21
|
+
driverSkip: string;
|
|
18
22
|
multiSelectInnerPlaceholder: string;
|
|
19
23
|
multiSelectSelectedLabel: string;
|
|
20
24
|
tableColumnResizer: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-translations.d.ts","sourceRoot":"","sources":["../../src/config/default-translations.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"default-translations.d.ts","sourceRoot":"","sources":["../../src/config/default-translations.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCA2CQ;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;;;;;;;;;;;;;;;4BAqB7G;QAAE,CAAC,EAAE,MAAM,CAAA;KAAE;;+BAGV,MAAM;CACpC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,OAAO,mBAAmB,CAAC"}
|
|
@@ -16,6 +16,10 @@ export const defaultTranslations = {
|
|
|
16
16
|
inputCaretDown: "Click to see all options",
|
|
17
17
|
inputCloseValue: "Click to clear the value",
|
|
18
18
|
inputOptionalLabel: "Optional",
|
|
19
|
+
driverNext: "Next",
|
|
20
|
+
driverPrevious: "Previous",
|
|
21
|
+
driverFinish: "Finish",
|
|
22
|
+
driverSkip: "Skip",
|
|
19
23
|
multiSelectInnerPlaceholder: "Search...",
|
|
20
24
|
multiSelectSelectedLabel: "Selected",
|
|
21
25
|
tableColumnResizer: "Resize column",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-resize-observer.d.ts","sourceRoot":"","sources":["../../src/hooks/use-resize-observer.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,GAC5B,SAAS,WAAW,GAAG,IAAI,EAC3B,UAAU,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,SAe/C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
export const useResizeObserver = (element, onResize) => {
|
|
4
|
+
const onResizeRef = useRef(onResize);
|
|
5
|
+
onResizeRef.current = onResize;
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (!element)
|
|
8
|
+
return;
|
|
9
|
+
const observer = new ResizeObserver((entries) => {
|
|
10
|
+
if (entries[0]) {
|
|
11
|
+
onResizeRef.current(entries[0]);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
observer.observe(element);
|
|
15
|
+
return () => observer.disconnect();
|
|
16
|
+
}, [element]);
|
|
17
|
+
};
|
|
@@ -14,6 +14,10 @@ export declare const useTranslations: () => {
|
|
|
14
14
|
inputCaretDown: string;
|
|
15
15
|
inputCloseValue: string;
|
|
16
16
|
inputOptionalLabel: string;
|
|
17
|
+
driverNext: string;
|
|
18
|
+
driverPrevious: string;
|
|
19
|
+
driverFinish: string;
|
|
20
|
+
driverSkip: string;
|
|
17
21
|
multiSelectInnerPlaceholder: string;
|
|
18
22
|
multiSelectSelectedLabel: string;
|
|
19
23
|
tableColumnResizer: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-translations.d.ts","sourceRoot":"","sources":["../../src/hooks/use-translations.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"use-translations.d.ts","sourceRoot":"","sources":["../../src/hooks/use-translations.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAKq9C,CAAC;;;;;;;;;;;;;;;;;;;;;;;CADj/C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-window-size.d.ts","sourceRoot":"","sources":["../../src/hooks/use-window-size.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa;;;CAYzB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
export const useWindowSize = () => {
|
|
4
|
+
const [size, setSize] = useState({ width: 0, height: 0 });
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
if (typeof window === "undefined")
|
|
7
|
+
return;
|
|
8
|
+
const update = () => setSize({ width: window.innerWidth, height: window.innerHeight });
|
|
9
|
+
update();
|
|
10
|
+
window.addEventListener("resize", update, { passive: true });
|
|
11
|
+
return () => window.removeEventListener("resize", update);
|
|
12
|
+
}, []);
|
|
13
|
+
return size;
|
|
14
|
+
};
|