@g4rcez/components 0.0.47 → 0.0.49
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 +46 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9543 -8612
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +46 -46
- package/dist/index.umd.js.map +1 -1
- package/dist/src/components/core/render-on-view.d.ts +7 -0
- package/dist/src/components/core/render-on-view.d.ts.map +1 -0
- package/dist/src/components/core/render-on-view.js +29 -0
- package/dist/src/components/display/alert.d.ts.map +1 -1
- package/dist/src/components/display/alert.js +3 -2
- package/dist/src/components/display/calendar.d.ts +6 -1
- package/dist/src/components/display/calendar.d.ts.map +1 -1
- package/dist/src/components/display/calendar.js +4 -4
- package/dist/src/components/display/notifications.d.ts.map +1 -1
- package/dist/src/components/display/notifications.js +1 -1
- package/dist/src/components/display/step.d.ts.map +1 -1
- package/dist/src/components/display/step.js +23 -4
- package/dist/src/components/floating/menu.d.ts +2 -2
- package/dist/src/components/form/autocomplete.js +1 -1
- package/dist/src/components/form/date-picker.d.ts +12 -2
- package/dist/src/components/form/date-picker.d.ts.map +1 -1
- package/dist/src/components/form/date-picker.js +4 -2
- package/dist/src/components/form/input-field.js +1 -1
- package/dist/src/components/form/select.js +1 -1
- package/dist/src/components/index.d.ts +2 -1
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +2 -1
- package/dist/src/components/table/filter.js +1 -1
- package/dist/src/components/table/group.js +1 -1
- package/dist/src/components/table/pagination.js +1 -1
- package/dist/src/components/table/sort.js +1 -1
- package/dist/src/components/table/thead.js +1 -1
- package/dist/src/hooks/{use-translate-context.d.ts → use-components-provider.d.ts} +8 -5
- package/dist/src/hooks/use-components-provider.d.ts.map +1 -0
- package/dist/src/hooks/{use-translate-context.js → use-components-provider.js} +14 -2
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/types.d.ts +1 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/src/hooks/use-translate-context.d.ts.map +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
2
|
+
import { PolymorphicProps } from "./polymorph";
|
|
3
|
+
export type RenderOnViewProps<T extends React.ElementType = "div"> = PolymorphicProps<{
|
|
4
|
+
onIntersection?: () => void;
|
|
5
|
+
}, T>;
|
|
6
|
+
export declare const RenderOnView: ({ children, ...props }: PropsWithChildren<RenderOnViewProps>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=render-on-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-on-view.d.ts","sourceRoot":"","sources":["../../../../src/components/core/render-on-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAqC,MAAM,OAAO,CAAC;AAEpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,IAAI,gBAAgB,CAAC;IAAE,cAAc,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,EAAE,CAAC,CAAC,CAAC;AAY1H,eAAO,MAAM,YAAY,2BAA4B,iBAAiB,CAAC,iBAAiB,CAAC,4CAsBxF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { useStableRef } from "../../hooks/use-stable-ref";
|
|
4
|
+
function isInViewport(el) {
|
|
5
|
+
const rect = el.getBoundingClientRect();
|
|
6
|
+
return (rect.top >= 0 &&
|
|
7
|
+
rect.left >= 0 &&
|
|
8
|
+
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
|
|
9
|
+
rect.right <= (window.innerWidth || document.documentElement.clientWidth) /* or $(window).width() */);
|
|
10
|
+
}
|
|
11
|
+
export const RenderOnView = ({ children, ...props }) => {
|
|
12
|
+
const onIntersect = useStableRef(props.onIntersection);
|
|
13
|
+
const ref = useRef(null);
|
|
14
|
+
const [shouldRender, setShouldRender] = useState(() => (ref.current === null ? false : isInViewport(ref.current)));
|
|
15
|
+
useLayoutEffect(() => {
|
|
16
|
+
const div = ref.current;
|
|
17
|
+
if (div === null)
|
|
18
|
+
return;
|
|
19
|
+
const observer = new IntersectionObserver((args) => {
|
|
20
|
+
const first = args[0];
|
|
21
|
+
if (first.isIntersecting)
|
|
22
|
+
onIntersect.current?.();
|
|
23
|
+
return setShouldRender((prev) => (first.isIntersecting ? true : prev));
|
|
24
|
+
});
|
|
25
|
+
observer.observe(div);
|
|
26
|
+
return () => observer.disconnect();
|
|
27
|
+
}, []);
|
|
28
|
+
return (_jsx("div", { ...props, ref: ref, children: shouldRender ? children : null }));
|
|
29
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../../src/components/display/alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAU,MAAM,eAAe,CAAC;AAExD,OAAO,KAAK,EAAE,EAAc,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,EAAa,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAahE,KAAK,aAAa,GAAG,eAAe,CAAC,SAAS,CAAC,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpE,eAAO,MAAM,QAAQ,UAAW,iBAAiB,CAAC,aAAa,CAAC,4CAgB/D,CAAC;AAEF,QAAA,MAAM,aAAa;;mFAajB,CAAC;AAEH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,KAAK,C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AAK,IAAI,CAAC;CACzC,CAAC,EACN,CAAC,CACJ,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,GAyCxE,CAAC"}
|
|
@@ -14,7 +14,7 @@ const transition = {
|
|
|
14
14
|
duration: 0.7,
|
|
15
15
|
ease: [0.04, 0.62, 0.23, 0.98],
|
|
16
16
|
};
|
|
17
|
-
export const Collapse = (props) => (_jsx(motion.div, { ...props, layout: true, layoutRoot: true, layoutScroll: true, initial: false,
|
|
17
|
+
export const Collapse = (props) => (_jsx(motion.div, { ...props, layout: true, layoutRoot: true, layoutScroll: true, initial: false, variants: variants, exit: variants.false, transition: transition, "aria-hidden": !props.open, animate: props.open.toString(), className: css("aria-hidden:pointer-events-none", props.className), children: props.children }));
|
|
18
18
|
const alertVariants = cva("p-4 w-full block border relative rounded-lg text-sm", {
|
|
19
19
|
variants: {
|
|
20
20
|
theme: {
|
|
@@ -30,5 +30,6 @@ const alertVariants = cva("p-4 w-full block border relative rounded-lg text-sm",
|
|
|
30
30
|
defaultVariants: { theme: "neutral" },
|
|
31
31
|
});
|
|
32
32
|
export const Alert = forwardRef(function Alert({ className, theme, Icon, onClose, open = true, ...props }, ref) {
|
|
33
|
-
|
|
33
|
+
const close = () => onClose?.(false);
|
|
34
|
+
return (_jsx("div", { "data-open": !!open, "aria-hidden": !open, className: "pointer-events-none w-full isolate aria-hidden:pointer-events-auto", children: _jsx(Collapse, { "data-open": !!open, open: !!open, children: _jsxs(Polymorph, { ...props, className: css(alertVariants({ theme }), className), ref: ref, "data-theme": theme, role: "alert", as: props.as ?? "div", children: [_jsxs("h4", { className: "mb-2 flex items-center gap-2", children: [!Icon && theme === "success" ? _jsx(CheckCircleIcon, { size: 20 }) : null, !Icon && theme === "info" ? _jsx(InfoIcon, { size: 20 }) : null, !Icon && theme === "danger" ? _jsx(TriangleAlertIcon, { size: 20 }) : null, Icon, _jsx("span", { className: "tracking-3 text-balance text-lg font-semibold", children: props.title })] }), props.children, onClose !== undefined ? (_jsx("button", { type: "button", onClick: close, className: "absolute right-3 top-3 text-foreground transition-colors duration-300 ease-in-out hover:text-danger", children: _jsx(XIcon, { size: 20 }) })) : null] }) }) }));
|
|
34
35
|
});
|
|
@@ -7,7 +7,12 @@ type Range = {
|
|
|
7
7
|
type OnChangeDate = (d: Date | undefined) => void;
|
|
8
8
|
type OnChangeRange = (d: Range | undefined) => void;
|
|
9
9
|
export type CalendarProps<T extends "date" | "range" | undefined = undefined> = Partial<{
|
|
10
|
+
labelRange: {
|
|
11
|
+
to: string;
|
|
12
|
+
from: string;
|
|
13
|
+
};
|
|
10
14
|
locale: Locales;
|
|
15
|
+
markRange: boolean;
|
|
11
16
|
markToday: boolean;
|
|
12
17
|
rangeMode: boolean;
|
|
13
18
|
changeOnlyOnClick: boolean;
|
|
@@ -37,6 +42,6 @@ export type CalendarProps<T extends "date" | "range" | undefined = undefined> =
|
|
|
37
42
|
range: Range;
|
|
38
43
|
onChange: OnChangeRange;
|
|
39
44
|
})>;
|
|
40
|
-
export declare const Calendar: ({ RenderOnDay, changeOnlyOnClick, disabledDate, locale, markToday, onChangeMonth, onChangeYear, rangeMode, onChange, styles, ...props }: CalendarProps) => import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export declare const Calendar: ({ RenderOnDay, changeOnlyOnClick, labelRange, disabledDate, locale, markToday, onChangeMonth, onChangeYear, rangeMode, onChange, styles, markRange, ...props }: CalendarProps) => import("react/jsx-runtime").JSX.Element;
|
|
41
46
|
export {};
|
|
42
47
|
//# sourceMappingURL=calendar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../../src/components/display/calendar.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAE5D,OAAqB,EAAE,OAAO,EAAE,MAAM,g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CAAC;CAC3B,GACD,EAAE,CAAC,GACP,CAAC;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,aAAa,CAAA;CAAE,CAAC,CAC3F,CAAC;AAoDF,eAAO,MAAM,QAAQ,mKAclB,aAAa,4CAgRf,CAAC"}
|
|
@@ -8,7 +8,7 @@ import { Is } from "sidekicker";
|
|
|
8
8
|
import TheMaskInput from "the-mask-input";
|
|
9
9
|
import { useReducer } from "use-typed-reducer";
|
|
10
10
|
import { useDebounce } from "../../hooks/use-debounce";
|
|
11
|
-
import { useTranslations } from "../../hooks/use-
|
|
11
|
+
import { useTranslations } from "../../hooks/use-components-provider";
|
|
12
12
|
import { css } from "../../lib/dom";
|
|
13
13
|
import { splitInto } from "../../lib/fns";
|
|
14
14
|
const transition = { type: "spring", bounce: 0.3, duration: 0.6 };
|
|
@@ -58,7 +58,7 @@ const inRange = (start, middle, end) => {
|
|
|
58
58
|
return false;
|
|
59
59
|
return isAfter(middle, start) && isBefore(middle, end);
|
|
60
60
|
};
|
|
61
|
-
export const Calendar = ({ RenderOnDay, changeOnlyOnClick = false, disabledDate, locale, markToday = true, onChangeMonth, onChangeYear, rangeMode = false, onChange, styles, ...props }) => {
|
|
61
|
+
export const Calendar = ({ RenderOnDay, changeOnlyOnClick = false, labelRange, disabledDate, locale, markToday = true, onChangeMonth, onChangeYear, rangeMode = false, onChange, styles, markRange = true, ...props }) => {
|
|
62
62
|
const translate = useTranslations();
|
|
63
63
|
const root = useRef(null);
|
|
64
64
|
const { date, range } = props;
|
|
@@ -204,6 +204,6 @@ export const Calendar = ({ RenderOnDay, changeOnlyOnClick = false, disabledDate,
|
|
|
204
204
|
const disabledByFn = disabledDate?.(day) || false;
|
|
205
205
|
const disableDate = !isSameMonth(day, state.date) || disabledByFn;
|
|
206
206
|
const isInRange = rangeMode ? inRange(range?.from, day, range?.to) : false;
|
|
207
|
-
return (_jsxs("td", { align: "center", className: css("relative", styles?.dayFrame), children: [_jsxs("button", { type: "button", "data-date": key, disabled: disabledByFn, "data-range": rangeMode, onClick: dispatch.onSelectDate, "data-view": state.date.getMonth().toString(), className: css(`flex size-10 items-center justify-center rounded-full font-semibold proportional-nums disabled:cursor-not-allowed ${today ? "text-primary" : ""} ${disableDate ? "text-disabled" : ""} ${isSelected ? "bg-primary text-primary-foreground" : ""}`, styles?.day, isInRange ? "size-10 border border-dashed border-card-border" : ""), children: [day.getDate(), isSelected && state.range.from?.toISOString() === key ? (_jsx("span", { className: "absolute -top-2 left-0 h-full w-full", children: _jsx("span", { className: "text-xs", children: translate.calendarFromDate }) })) : null, isSelected && state.range.to?.toISOString() === key ? (_jsx("span", { className: "absolute -top-2 left-0 h-full w-full", children: _jsx("span", { className: "text-xs", children: translate.calendarToDate }) })) : null] }), RenderOnDay ? _jsx(RenderOnDay, { date: day }) : null] }, key));
|
|
208
|
-
}) }, `week-${week.length}-${index}`))) })] })] }, monthString) }) }), _jsx("footer", { className: "mt-2 text-center text-primary", children: _jsx("button", { className: "duration-300
|
|
207
|
+
return (_jsxs("td", { align: "center", className: css("relative", styles?.dayFrame), children: [_jsxs("button", { type: "button", "data-date": key, disabled: disabledByFn, "data-range": rangeMode, onClick: dispatch.onSelectDate, "data-view": state.date.getMonth().toString(), className: css(`flex size-10 items-center justify-center rounded-full font-semibold proportional-nums disabled:cursor-not-allowed ${today ? "text-primary" : ""} ${disableDate ? "text-disabled" : ""} ${isSelected ? "bg-primary text-primary-foreground" : ""}`, styles?.day, isInRange && markRange ? "size-10 border border-dashed border-card-border" : ""), children: [day.getDate(), isSelected && state.range.from?.toISOString() === key ? (_jsx("span", { className: "absolute -top-2 left-0 h-full w-full", children: _jsx("span", { className: "text-xs text-foreground", children: labelRange?.from ?? translate.calendarFromDate }) })) : null, isSelected && state.range.to?.toISOString() === key ? (_jsx("span", { className: "absolute -top-2 left-0 h-full w-full", children: _jsx("span", { className: "text-xs text-foreground", children: labelRange?.to ?? translate.calendarToDate }) })) : null] }), RenderOnDay ? _jsx(RenderOnDay, { date: day }) : null] }, key));
|
|
208
|
+
}) }, `week-${week.length}-${index}`))) })] })] }, monthString) }) }), _jsx("footer", { className: "mt-2 text-center text-primary", children: _jsx("button", { className: "transition-transform duration-300 hover:scale-105", type: "button", onClick: dispatch.setToday, children: "Today" }) })] }) }));
|
|
209
209
|
};
|
|
@@ -1 +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;
|
|
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;AAiErE,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"}
|
|
@@ -38,7 +38,7 @@ const Notification = forwardRef(function Toast(props, forwardedRef) {
|
|
|
38
38
|
isLast: { y: 10, scale: 1, animationDuration: "300ms", opacity: 1 },
|
|
39
39
|
hover: { y: 0, position: "static", scale: 1, opacity: 1 },
|
|
40
40
|
other: animatedIndex[props.reversedIndex] || animatedIndex.default,
|
|
41
|
-
}, 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,
|
|
41
|
+
}, 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, _jsx(RadixToast.Description, { className: "select-text truncate", children: props.text })] }), 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] }) }) }));
|
|
42
42
|
});
|
|
43
43
|
export function Notifications({ children, max = 5, duration = 5000 }) {
|
|
44
44
|
const ref = useRef(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../../src/components/display/step.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAkB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../../src/components/display/step.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAkB,iBAAiB,EAAa,MAAM,OAAO,CAAC;AAmCrE,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,4CA2B9F,CAAC;AAEF,eAAO,MAAM,IAAI,UAAW,SAAS,4CAkDpC,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { motion } from "framer-motion";
|
|
4
|
-
import {
|
|
3
|
+
import { motion, stagger, useAnimate } from "framer-motion";
|
|
4
|
+
import { useEffect } from "react";
|
|
5
|
+
import { useColorParser } from "../../hooks/use-components-provider";
|
|
5
6
|
const iconTransitions = {
|
|
6
7
|
delay: 0.2,
|
|
7
8
|
type: "tween",
|
|
@@ -30,11 +31,29 @@ const getCurrentStatus = (props) => {
|
|
|
30
31
|
return "inactive";
|
|
31
32
|
return "complete";
|
|
32
33
|
};
|
|
33
|
-
export const StepsContainer = (props) =>
|
|
34
|
+
export const StepsContainer = (props) => {
|
|
35
|
+
const [ref, animate] = useAnimate();
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (props.currentStep === 0)
|
|
38
|
+
return;
|
|
39
|
+
const container = ref.current;
|
|
40
|
+
const first = container.querySelectorAll(`div[data-step]`)[0];
|
|
41
|
+
const step = container.querySelector(`div[data-step="${props.currentStep}"]`);
|
|
42
|
+
if (first && step) {
|
|
43
|
+
const diff = step.getBoundingClientRect().left - first.getBoundingClientRect().left;
|
|
44
|
+
animate("div[data-name='progress']", { width: `${Math.max(0, diff)}px` }, {
|
|
45
|
+
type: "spring",
|
|
46
|
+
duration: 0.5,
|
|
47
|
+
delay: stagger(0.075),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}, [props.currentStep]);
|
|
51
|
+
return (_jsxs("div", { className: "relative flex 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 h-1 w-0 bg-success" }), props.children] }));
|
|
52
|
+
};
|
|
34
53
|
export const Step = (props) => {
|
|
35
54
|
const parser = useColorParser();
|
|
36
55
|
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: {
|
|
56
|
+
return (_jsxs(motion.div, { "data-step": props.step, 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
57
|
error: {
|
|
39
58
|
backgroundColor: parser("var(--danger-DEFAULT)"),
|
|
40
59
|
borderColor: parser("var(--danger-hover)"),
|
|
@@ -26,7 +26,7 @@ type MenuItemProps = {
|
|
|
26
26
|
Right?: React.FC<LucideProps>;
|
|
27
27
|
};
|
|
28
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" | "
|
|
29
|
+
export declare const Menu: React.ForwardRefExoticComponent<(Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "label" | "children" | "hover" | "asChild" | "FloatingComponent" | "floatingClassName" | "nested" | "isParent"> & Partial<{
|
|
30
30
|
FloatingComponent: React.ElementType;
|
|
31
31
|
floatingClassName: string;
|
|
32
32
|
hover: boolean;
|
|
@@ -36,7 +36,7 @@ export declare const Menu: React.ForwardRefExoticComponent<(Omit<Omit<React.Deta
|
|
|
36
36
|
children: React.ReactNode;
|
|
37
37
|
} & {
|
|
38
38
|
label: string;
|
|
39
|
-
}>, "ref"> | Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "label" | "children" | "hover" | "
|
|
39
|
+
}>, "ref"> | Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "label" | "children" | "hover" | "asChild" | "FloatingComponent" | "floatingClassName" | "nested" | "isParent"> & Partial<{
|
|
40
40
|
FloatingComponent: React.ElementType;
|
|
41
41
|
floatingClassName: string;
|
|
42
42
|
hover: boolean;
|
|
@@ -5,7 +5,7 @@ import { autoUpdate, FloatingFocusManager, FloatingPortal, offset, size, useDism
|
|
|
5
5
|
import Fuzzy from "fuzzy-search";
|
|
6
6
|
import { CheckIcon, ChevronDown } from "lucide-react";
|
|
7
7
|
import { forwardRef, Fragment, useEffect, useRef, useState } from "react";
|
|
8
|
-
import { useTranslations } from "../../hooks/use-
|
|
8
|
+
import { useTranslations } from "../../hooks/use-components-provider";
|
|
9
9
|
import { css, dispatchInput, initializeInputDataset } from "../../lib/dom";
|
|
10
10
|
import { safeRegex } from "../../lib/fns";
|
|
11
11
|
import { InputField } from "./input-field";
|
|
@@ -3,8 +3,13 @@ import { Override } from "../../types";
|
|
|
3
3
|
import { CalendarProps } from "../display/calendar";
|
|
4
4
|
import { InputProps } from "./input";
|
|
5
5
|
export type DatePickerProps = Override<InputProps, CalendarProps<"date">>;
|
|
6
|
-
export declare const DatePicker: React.ForwardRefExoticComponent<(Omit<Omit<InputProps, "onChange" | "date" | "locale" | "markToday" | "rangeMode" | "changeOnlyOnClick" | "onChangeMonth" | "onChangeYear" | "RenderOnDay" | "disabledDate" | "styles"> & Partial<{
|
|
6
|
+
export declare const DatePicker: React.ForwardRefExoticComponent<(Omit<Omit<InputProps, "onChange" | "date" | "locale" | "labelRange" | "markRange" | "markToday" | "rangeMode" | "changeOnlyOnClick" | "onChangeMonth" | "onChangeYear" | "RenderOnDay" | "disabledDate" | "styles"> & Partial<{
|
|
7
|
+
labelRange: {
|
|
8
|
+
to: string;
|
|
9
|
+
from: string;
|
|
10
|
+
};
|
|
7
11
|
locale: import("the-mask-input").Locales;
|
|
12
|
+
markRange: boolean;
|
|
8
13
|
markToday: boolean;
|
|
9
14
|
rangeMode: boolean;
|
|
10
15
|
changeOnlyOnClick: boolean;
|
|
@@ -27,8 +32,13 @@ export declare const DatePicker: React.ForwardRefExoticComponent<(Omit<Omit<Inpu
|
|
|
27
32
|
} & {
|
|
28
33
|
date: Date;
|
|
29
34
|
onChange: (d: Date | undefined) => void;
|
|
30
|
-
}>, "ref"> | Omit<Omit<InputProps, "onChange" | "date" | "locale" | "markToday" | "rangeMode" | "changeOnlyOnClick" | "onChangeMonth" | "onChangeYear" | "RenderOnDay" | "disabledDate" | "styles"> & Partial<{
|
|
35
|
+
}>, "ref"> | Omit<Omit<InputProps, "onChange" | "date" | "locale" | "labelRange" | "markRange" | "markToday" | "rangeMode" | "changeOnlyOnClick" | "onChangeMonth" | "onChangeYear" | "RenderOnDay" | "disabledDate" | "styles"> & Partial<{
|
|
36
|
+
labelRange: {
|
|
37
|
+
to: string;
|
|
38
|
+
from: string;
|
|
39
|
+
};
|
|
31
40
|
locale: import("the-mask-input").Locales;
|
|
41
|
+
markRange: boolean;
|
|
32
42
|
markToday: boolean;
|
|
33
43
|
rangeMode: boolean;
|
|
34
44
|
changeOnlyOnClick: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../../src/components/form/date-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAG9E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAY,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAS,UAAU,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AAmC1E,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../../src/components/form/date-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAG9E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAY,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAS,UAAU,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AAmC1E,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDA4GtB,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { format, isValid, parse, startOfDay } from "date-fns";
|
|
|
3
3
|
import { CalendarIcon } from "lucide-react";
|
|
4
4
|
import { forwardRef, Fragment, useId, useMemo, useState } from "react";
|
|
5
5
|
import { Is } from "sidekicker";
|
|
6
|
-
import { useTranslations } from "../../hooks/use-
|
|
6
|
+
import { useLocale, useTranslations } from "../../hooks/use-components-provider";
|
|
7
7
|
import { Calendar } from "../display/calendar";
|
|
8
8
|
import { Dropdown } from "../floating/dropdown";
|
|
9
9
|
import { Input } from "./input";
|
|
@@ -34,7 +34,8 @@ const formatParts = (datetimeFormat, date) => {
|
|
|
34
34
|
return [];
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
export const DatePicker = forwardRef(({ date, locale, disabledDate, onChange, markToday, ...props }, externalRef) => {
|
|
37
|
+
export const DatePicker = forwardRef(({ date, locale: inputLocal, disabledDate, onChange, markToday, ...props }, externalRef) => {
|
|
38
|
+
const locale = inputLocal || useLocale();
|
|
38
39
|
const labelId = useId();
|
|
39
40
|
const translation = useTranslations();
|
|
40
41
|
const datetimeFormat = useMemo(() => new Intl.DateTimeFormat(locale), [locale]);
|
|
@@ -42,6 +43,7 @@ export const DatePicker = forwardRef(({ date, locale, disabledDate, onChange, ma
|
|
|
42
43
|
const [open, setOpen] = useState(false);
|
|
43
44
|
const mask = formatParts(datetimeFormat, fixedDate).flatMap((x) => (Is.keyof(parts, x.type) ? parts[x.type](x.value) : []));
|
|
44
45
|
const placeholder = formatParts(datetimeFormat, fixedDate).reduce((acc, x) => acc + (Is.keyof(placeholders, x.type) ? placeholders[x.type](x.value) : ""), "");
|
|
46
|
+
console.log({ locale, datetimeFormat, placeholder });
|
|
45
47
|
const [value, setValue] = useState(!innerDate
|
|
46
48
|
? ""
|
|
47
49
|
: formatParts(datetimeFormat, innerDate).reduce((acc, x) => acc + (Is.keyof(parts, x.type) ? partValues[x.type](innerDate, x.value) : ""), ""));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { CheckCircle, InfoIcon, XCircle } from "lucide-react";
|
|
4
4
|
import { Fragment } from "react";
|
|
5
|
-
import { useTranslations } from "../../hooks/use-
|
|
5
|
+
import { useTranslations } from "../../hooks/use-components-provider";
|
|
6
6
|
import { css } from "../../lib/dom";
|
|
7
7
|
import { Tooltip } from "../floating/tooltip";
|
|
8
8
|
export const InputFeedback = ({ reportStatus, hideLeft = false, className, info, children, title }) => (_jsxs("div", { className: css("w-full justify-between", hideLeft && children === null ? "hidden" : "flex", className), children: [hideLeft ? null : (_jsxs("span", { className: "flex items-center gap-1 transition-colors group-focus-within:text-primary group-hover:text-primary group-error:text-danger", children: [title, reportStatus || info ? (_jsxs("span", { className: "flex items-center justify-center gap-1", children: [info ? (_jsx(Tooltip, { title: _jsxs("span", { className: "cursor-help", children: [_jsx("span", { className: "sr-only", children: info }), _jsx(InfoIcon, { className: "aspect-square size-3", "aria-hidden": "true", size: 16, strokeWidth: 1, absoluteStrokeWidth: true })] }), children: info })) : null, reportStatus ? (_jsxs(Fragment, { children: [_jsx(CheckCircle, { className: "hidden aspect-square size-3 opacity-0 transition-opacity group-assert:block group-assert:text-success group-assert:opacity-100", "aria-hidden": "true", size: 16, strokeWidth: 1, absoluteStrokeWidth: true }), _jsx(XCircle, { className: "hidden aspect-square size-3 opacity-0 transition-opacity group-error:block group-error:opacity-100", "aria-hidden": "true", size: 16, strokeWidth: 1, absoluteStrokeWidth: true })] })) : null] })) : null] })), children] }));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { ChevronDownIcon } from "lucide-react";
|
|
4
4
|
import { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
|
|
5
|
-
import { useTranslations } from "../../hooks/use-
|
|
5
|
+
import { useTranslations } from "../../hooks/use-components-provider";
|
|
6
6
|
import { css, initializeInputDataset, mergeRefs } from "../../lib/dom";
|
|
7
7
|
import { InputField } from "./input-field";
|
|
8
8
|
export const Select = forwardRef(({ required = true, options, info, selectContainer = "", feedback = null, labelClassName, interactive, rightLabel, optionalText, container, hideLeft = false, right, left, error, ...props }, ref) => {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from "./core/button";
|
|
2
2
|
export * from "./core/polymorph";
|
|
3
|
+
export * from "./core/render-on-view";
|
|
3
4
|
export * from "./core/tag";
|
|
4
5
|
export * from "./display/alert";
|
|
5
6
|
export * from "./display/calendar";
|
|
6
7
|
export * from "./display/card";
|
|
8
|
+
export * from "./display/notifications";
|
|
7
9
|
export * from "./display/stats";
|
|
8
10
|
export * from "./display/tabs";
|
|
9
11
|
export * from "./floating/dropdown";
|
|
@@ -21,7 +23,6 @@ export * from "./form/input";
|
|
|
21
23
|
export * from "./form/input-field";
|
|
22
24
|
export * from "./form/radiobox";
|
|
23
25
|
export * from "./form/select";
|
|
24
|
-
export * from "./form/select";
|
|
25
26
|
export * from "./form/switch";
|
|
26
27
|
export * from "./form/task-list";
|
|
27
28
|
export * from "./form/transfer-list";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAk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AC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,OAAO,EAAE,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from "./core/button";
|
|
2
2
|
export * from "./core/polymorph";
|
|
3
|
+
export * from "./core/render-on-view";
|
|
3
4
|
export * from "./core/tag";
|
|
4
5
|
export * from "./display/alert";
|
|
5
6
|
export * from "./display/calendar";
|
|
6
7
|
export * from "./display/card";
|
|
8
|
+
export * from "./display/notifications";
|
|
7
9
|
export * from "./display/stats";
|
|
8
10
|
export * from "./display/tabs";
|
|
9
11
|
export * from "./floating/dropdown";
|
|
@@ -21,7 +23,6 @@ export * from "./form/input";
|
|
|
21
23
|
export * from "./form/input-field";
|
|
22
24
|
export * from "./form/radiobox";
|
|
23
25
|
export * from "./form/select";
|
|
24
|
-
export * from "./form/select";
|
|
25
26
|
export * from "./form/switch";
|
|
26
27
|
export * from "./form/task-list";
|
|
27
28
|
export * from "./form/transfer-list";
|
|
@@ -6,7 +6,7 @@ import { Dropdown } from "../floating/dropdown";
|
|
|
6
6
|
import { Input } from "../form/input";
|
|
7
7
|
import { Select } from "../form/select";
|
|
8
8
|
import { ColType, getLabel, valueFromType } from "./table-lib";
|
|
9
|
-
import { useTranslations } from "../../hooks/use-
|
|
9
|
+
import { useTranslations } from "../../hooks/use-components-provider";
|
|
10
10
|
export const createFilterFromCol = (f, options, operations, rest = {}) => {
|
|
11
11
|
const name = f.id;
|
|
12
12
|
const type = f.type ?? ColType.Text;
|
|
@@ -5,7 +5,7 @@ import Linq from "linq-arrays";
|
|
|
5
5
|
import { GripVerticalIcon, Trash2Icon, UngroupIcon } from "lucide-react";
|
|
6
6
|
import { Fragment, useState } from "react";
|
|
7
7
|
import { keys } from "sidekicker";
|
|
8
|
-
import { useTranslations } from "../../hooks/use-
|
|
8
|
+
import { useTranslations } from "../../hooks/use-components-provider";
|
|
9
9
|
import { uuid } from "../../lib/fns";
|
|
10
10
|
import { Button } from "../core/button";
|
|
11
11
|
import { Dropdown } from "../floating/dropdown";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment, useId, useMemo } from "react";
|
|
3
|
-
import { useTranslations } from "../../hooks/use-
|
|
3
|
+
import { useTranslations } from "../../hooks/use-components-provider";
|
|
4
4
|
function createPaginationItems(current, max) {
|
|
5
5
|
if (!current || !max)
|
|
6
6
|
return [];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { ArrowDown01Icon, ArrowUp01Icon, ArrowUpDownIcon, PlusIcon, Trash2Icon } from "lucide-react";
|
|
4
4
|
import { Fragment, useEffect, useState } from "react";
|
|
5
|
-
import { useTranslations } from "../../hooks/use-
|
|
5
|
+
import { useTranslations } from "../../hooks/use-components-provider";
|
|
6
6
|
import { uuid } from "../../lib/fns";
|
|
7
7
|
import { Dropdown } from "../floating/dropdown";
|
|
8
8
|
import { Select } from "../form/select";
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { AnimatePresence, Reorder } from "framer-motion";
|
|
3
3
|
import { Order } from "linq-arrays";
|
|
4
4
|
import { PlusIcon, SearchCheckIcon, SearchXIcon } from "lucide-react";
|
|
5
|
-
import { useTranslations } from "../../hooks/use-
|
|
5
|
+
import { useTranslations } from "../../hooks/use-components-provider";
|
|
6
6
|
import { Dropdown } from "../floating/dropdown";
|
|
7
7
|
import { ColumnHeaderFilter, createFilterFromCol, useOperators } from "./filter";
|
|
8
8
|
import { SorterHead } from "./sort";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from "react";
|
|
2
2
|
import { parsers } from "../../preset.tailwind";
|
|
3
|
+
import { Locales } from "the-mask-input";
|
|
3
4
|
declare const defaultTranslations: {
|
|
4
5
|
inputCaretDown: string;
|
|
5
6
|
datePickerCalendarButtonLabel: string;
|
|
@@ -47,11 +48,13 @@ declare const defaultTranslations: {
|
|
|
47
48
|
calendarToDate: string;
|
|
48
49
|
};
|
|
49
50
|
type Translations = typeof defaultTranslations;
|
|
50
|
-
type ContextProps = {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
type ContextProps = Partial<{
|
|
52
|
+
map: Partial<Translations>;
|
|
53
|
+
locale: Locales | undefined;
|
|
54
|
+
parser: typeof parsers.hsla;
|
|
55
|
+
}>;
|
|
54
56
|
export declare const ComponentsProvider: (props: PropsWithChildren<ContextProps>) => import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
export declare const useLocale: () => Locales | undefined;
|
|
55
58
|
export declare const useTranslations: () => {
|
|
56
59
|
inputCaretDown: string;
|
|
57
60
|
datePickerCalendarButtonLabel: string;
|
|
@@ -100,4 +103,4 @@ export declare const useTranslations: () => {
|
|
|
100
103
|
};
|
|
101
104
|
export declare const useColorParser: () => (v: string) => `hsla(${string})`;
|
|
102
105
|
export {};
|
|
103
|
-
//# sourceMappingURL=use-
|
|
106
|
+
//# sourceMappingURL=use-components-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-components-provider.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-components-provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAA2B,iBAAiB,EAAuB,MAAM,OAAO,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCA4Ce;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;;;CASxI,CAAC;AAEF,KAAK,YAAY,GAAG,OAAO,mBAAmB,CAAC;AAQ/C,KAAK,YAAY,GAAG,OAAO,CAAC;IACxB,GAAG,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC3B,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,OAAO,OAAO,CAAC,IAAI,CAAC;CAC/B,CAAC,CAAC;AAEH,eAAO,MAAM,kBAAkB,UAAW,iBAAiB,CAAC,YAAY,CAAC,4CAUxE,CAAC;AAEF,eAAO,MAAM,SAAS,QAAO,OAAO,GAAG,SAItC,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCA3CY;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;;;CA+CxI,CAAC;AAEF,eAAO,MAAM,cAAc,wCAI1B,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { createContext, Fragment, useContext, useMemo } from "react";
|
|
3
4
|
import { parsers } from "../../preset.tailwind";
|
|
@@ -41,14 +42,25 @@ const defaultTranslations = {
|
|
|
41
42
|
calendarFromDate: "From",
|
|
42
43
|
calendarToDate: "To",
|
|
43
44
|
};
|
|
44
|
-
const Context = createContext({
|
|
45
|
+
const Context = createContext({
|
|
46
|
+
colorTokenParser: parsers.hsla,
|
|
47
|
+
translations: defaultTranslations,
|
|
48
|
+
locale: undefined,
|
|
49
|
+
});
|
|
45
50
|
export const ComponentsProvider = (props) => {
|
|
46
51
|
const memoMap = useMemo(() => ({
|
|
52
|
+
locale: props.locale,
|
|
47
53
|
translations: { ...defaultTranslations, ...props.map },
|
|
48
54
|
colorTokenParser: props.parser || parsers.hsla,
|
|
49
|
-
}), [props
|
|
55
|
+
}), [props]);
|
|
50
56
|
return _jsx(Context.Provider, { value: memoMap, children: props.children });
|
|
51
57
|
};
|
|
58
|
+
export const useLocale = () => {
|
|
59
|
+
const ctx = useContext(Context);
|
|
60
|
+
if (!ctx)
|
|
61
|
+
return undefined;
|
|
62
|
+
return ctx.locale;
|
|
63
|
+
};
|
|
52
64
|
export const useTranslations = () => {
|
|
53
65
|
const ctx = useContext(Context);
|
|
54
66
|
if (!ctx)
|
package/dist/src/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export * from "./components";
|
|
|
2
2
|
export * from "./hooks/use-form";
|
|
3
3
|
export * from "./hooks/use-previous";
|
|
4
4
|
export * from "./hooks/use-reactive";
|
|
5
|
-
export { ComponentsProvider, useTranslations } from "./hooks/use-
|
|
5
|
+
export { ComponentsProvider, useTranslations } from "./hooks/use-components-provider";
|
|
6
6
|
export * from "./lib/dom";
|
|
7
7
|
export * from "./lib/fns";
|
|
8
8
|
export * from "./styles/theme";
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACtF,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,mBAAmB,SAAS,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export * from "./components";
|
|
|
2
2
|
export * from "./hooks/use-form";
|
|
3
3
|
export * from "./hooks/use-previous";
|
|
4
4
|
export * from "./hooks/use-reactive";
|
|
5
|
-
export { ComponentsProvider, useTranslations } from "./hooks/use-
|
|
5
|
+
export { ComponentsProvider, useTranslations } from "./hooks/use-components-provider";
|
|
6
6
|
export * from "./lib/dom";
|
|
7
7
|
export * from "./lib/fns";
|
|
8
8
|
export * from "./styles/theme";
|
package/dist/src/types.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ export type Override<Source, New> = Omit<Source, keyof New> & New;
|
|
|
7
7
|
export type SetState<T> = Dispatch<SetStateAction<T>>;
|
|
8
8
|
export type POJO = {};
|
|
9
9
|
export type ComponentLike = keyof JSX.IntrinsicElements | JSXElementConstructor<any>;
|
|
10
|
+
export type Any = Record<string, any>;
|
|
10
11
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,E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