@g4rcez/components 0.0.73 → 0.1.0
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.js +38 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1439 -1395
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +36 -36
- package/dist/index.umd.js.map +1 -1
- package/dist/preset/preset.tailwind.js +1 -1
- package/dist/preset.tailwind.js +1 -1
- package/dist/src/components/display/alert.js +1 -1
- package/dist/src/components/display/calendar.d.ts +6 -5
- package/dist/src/components/display/calendar.d.ts.map +1 -1
- package/dist/src/components/display/calendar.js +20 -13
- package/dist/src/components/floating/menu.d.ts +15 -18
- package/dist/src/components/floating/menu.d.ts.map +1 -1
- package/dist/src/components/floating/menu.js +10 -12
- package/dist/src/components/floating/modal.d.ts +8 -3
- package/dist/src/components/floating/modal.d.ts.map +1 -1
- package/dist/src/components/floating/modal.js +10 -5
- package/dist/src/components/form/date-picker.d.ts +10 -10
- package/dist/src/components/form/input-field.d.ts.map +1 -1
- package/dist/src/components/form/input-field.js +1 -1
- package/dist/src/hooks/use-components-provider.d.ts +2 -0
- package/dist/src/hooks/use-components-provider.d.ts.map +1 -1
- package/dist/src/hooks/use-components-provider.js +1 -0
- package/package.json +1 -1
|
@@ -48,7 +48,7 @@ var config = {
|
|
|
48
48
|
plugin(function (_a) {
|
|
49
49
|
var addVariant = _a.addVariant, theme = _a.theme, matchUtilities = _a.matchUtilities;
|
|
50
50
|
addVariant("link", ["&:hover", "&:active"]);
|
|
51
|
-
addVariant("
|
|
51
|
+
addVariant("hocus", ["&:hover", "&:focus"]);
|
|
52
52
|
addVariant("group-assert", [":merge(.group):valid:has(.input:valid:not(:placeholder-shown)) &"]);
|
|
53
53
|
addVariant("group-error", [
|
|
54
54
|
":merge(.group):invalid:has(.input:not(:focus):invalid[data-initialized=true]) &",
|
package/dist/preset.tailwind.js
CHANGED
|
@@ -36,7 +36,7 @@ const config = {
|
|
|
36
36
|
forms({ strategy: "class" }),
|
|
37
37
|
plugin(function ({ addVariant, theme, matchUtilities }) {
|
|
38
38
|
addVariant("link", ["&:hover", "&:active"]);
|
|
39
|
-
addVariant("
|
|
39
|
+
addVariant("hocus", ["&:hover", "&:focus"]);
|
|
40
40
|
addVariant("group-assert", [`:merge(.group):valid:has(.input:valid:not(:placeholder-shown)) &`]);
|
|
41
41
|
addVariant("group-error", [
|
|
42
42
|
`:merge(.group):invalid:has(.input:not(:focus):invalid[data-initialized=true]) &`,
|
|
@@ -32,5 +32,5 @@ const alertVariants = cva("p-4 w-full block border relative rounded-lg text-sm",
|
|
|
32
32
|
});
|
|
33
33
|
export const Alert = forwardRef(function Alert({ className, theme, Icon, onClose, open = true, ...props }, ref) {
|
|
34
34
|
const close = () => onClose?.(false);
|
|
35
|
-
return (_jsx("div", { "data-open": !!open, "aria-hidden": !open, "data-component": "alert", className: css("isolate w-full", open ? "pointer-events-auto" : "pointer-events-none"), children: _jsx(Collapse, { "data-open": !!open, open: !!open, children: _jsxs(Polymorph, { ...props, ref: ref, role: "alert", "data-theme": theme, as: props.as ?? "div", className: css(alertVariants({ theme }), className), 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] }) }) }));
|
|
35
|
+
return (_jsx("div", { "data-open": !!open, "aria-hidden": !open, "data-component": "alert", className: css("isolate w-full", open ? "pointer-events-auto" : "pointer-events-none"), children: _jsx(Collapse, { "data-open": !!open, open: !!open, children: _jsxs(Polymorph, { ...props, ref: ref, role: "alert", "data-theme": theme, as: props.as ?? "div", className: css(alertVariants({ theme }), className), 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 && open ? (_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] }) }) }));
|
|
36
36
|
});
|
|
@@ -6,12 +6,13 @@ type Range = {
|
|
|
6
6
|
};
|
|
7
7
|
type OnChangeDate = (d: Date | undefined) => void;
|
|
8
8
|
type OnChangeRange = (d: Range | undefined) => void;
|
|
9
|
+
type DateStyle = (d: Date) => string;
|
|
9
10
|
type CalendarStyles = Partial<{
|
|
10
|
-
day: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
calendar: string;
|
|
11
|
+
day: string | DateStyle;
|
|
12
|
+
weekDay: string | DateStyle;
|
|
13
|
+
dayFrame: string | DateStyle;
|
|
14
|
+
week: string | ((week: Date[]) => string);
|
|
15
|
+
calendar: string | ((daysOfMonth: Date[]) => string);
|
|
15
16
|
}>;
|
|
16
17
|
export type CalendarProps<T extends "date" | "range" | undefined = undefined> = Partial<{
|
|
17
18
|
locale: Locales;
|
|
@@ -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,gBAAgB,CAAC;AAqBvD,KAAK,KAAK,GAAG;IAAE,IAAI,CAAC,EAAE,IAAI,CAAC;I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AM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,cAAc,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,YAAY,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,aAAa,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,IAAI,CAAC;IACjC,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;IACtC,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IACtC,UAAU,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C,GAAG,CAAC,CAAC,SAAS,MAAM,GACf;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,GACtC,CAAC,SAAS,OAAO,GACf;IACI,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,aAAa,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;AAwIF,eAAO,MAAM,QAAQ,mKAclB,aAAa,4CAkQf,CAAC"}
|
|
@@ -60,17 +60,21 @@ const inRange = (start, middle, end) => {
|
|
|
60
60
|
};
|
|
61
61
|
const CalendarBody = (props) => {
|
|
62
62
|
const translate = useTranslations();
|
|
63
|
-
return (_jsx(motion.tbody, { layout: true, variants: variants, custom: props.direction, onKeyDown: props.onKeyDown, className: css(props.styles?.week), children: props.zip.map((week, index) =>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
return (_jsx(motion.tbody, { layout: true, variants: variants, custom: props.direction, onKeyDown: props.onKeyDown, className: css(props.styles?.week), children: props.zip.map((week, index) => {
|
|
64
|
+
const weekClassName = Is.function(props.styles?.week) ? props.styles?.week(week) : props.styles?.week;
|
|
65
|
+
return (_jsx("tr", { className: weekClassName, children: week.map((day) => {
|
|
66
|
+
const key = day.toISOString();
|
|
67
|
+
const isSelected = props.rangeMode
|
|
68
|
+
? key === props.range?.to?.toISOString() || key === props.range?.from?.toISOString()
|
|
69
|
+
: key === props.date?.toISOString();
|
|
70
|
+
const today = isToday(day) && props.markToday;
|
|
71
|
+
const disabledByFn = props.disabledDate?.(day) || false;
|
|
72
|
+
const sameMonth = isSameMonth(day, props.stateDate);
|
|
73
|
+
const disableDate = !sameMonth || disabledByFn;
|
|
74
|
+
const isInRange = props.rangeMode ? inRange(props.range?.from, day, props.range?.to) : false;
|
|
75
|
+
return (_jsxs("td", { align: "center", className: css("relative", Is.function(props.styles?.dayFrame) ? props.styles?.dayFrame(day) : props.styles?.dayFrame), children: [_jsxs("button", { type: "button", "data-date": key, disabled: disabledByFn, "data-samemonth": sameMonth, "data-range": props.rangeMode, onClick: props.dispatch.onSelectDate, "data-view": props.stateDate.getMonth().toString(), className: css(`flex size-10 items-center justify-center rounded-full proportional-nums disabled:cursor-not-allowed ${today ? "text-emphasis" : ""} ${disableDate ? "text-disabled" : ""} ${isSelected ? "bg-primary text-primary-foreground" : ""}`, isInRange && props.markRange ? "size-10 border border-dashed border-card-border" : "", Is.function(props.styles?.day) ? props.styles?.day(day) : props.styles?.day), children: [day.getDate(), isSelected && props.stateRange.from?.toISOString() === key ? (_jsx("span", { className: "absolute -top-2 left-0 h-full w-full", children: _jsx("span", { className: "text-xs text-foreground", children: props.labelRange?.from ?? translate.calendarFromDate }) })) : null, isSelected && props.stateRange.to?.toISOString() === key ? (_jsx("span", { className: "absolute -top-2 left-0 h-full w-full", children: _jsx("span", { className: "text-xs text-foreground", children: props.labelRange?.to ?? translate.calendarToDate }) })) : null] }), props.RenderOnDay ? _jsx(props.RenderOnDay, { date: day }) : null] }, key));
|
|
76
|
+
}) }, `week-${week.length}-${index}`));
|
|
77
|
+
}) }));
|
|
74
78
|
};
|
|
75
79
|
export const Calendar = ({ RenderOnDay, changeOnlyOnClick = false, labelRange, disabledDate, locale, markToday = true, onChangeMonth, onChangeYear, rangeMode = false, onChange, styles, markRange = true, ...props }) => {
|
|
76
80
|
const id = useRef(uuid());
|
|
@@ -189,7 +193,8 @@ export const Calendar = ({ RenderOnDay, changeOnlyOnClick = false, labelRange, d
|
|
|
189
193
|
},
|
|
190
194
|
],
|
|
191
195
|
});
|
|
192
|
-
const
|
|
196
|
+
const allDaysOfMonth = createDays(state.date);
|
|
197
|
+
const zip = splitInto(allDaysOfMonth, 7);
|
|
193
198
|
const currentAsString = state.date.toISOString();
|
|
194
199
|
const monthString = formatMonth(state.date, currentLocale);
|
|
195
200
|
useEffect(() => {
|
|
@@ -209,5 +214,7 @@ export const Calendar = ({ RenderOnDay, changeOnlyOnClick = false, labelRange, d
|
|
|
209
214
|
onChangeYear?.(new Date(value));
|
|
210
215
|
defer(value);
|
|
211
216
|
};
|
|
212
|
-
return (_jsx(MotionConfig, { transition: transition, children: _jsxs("div", { "data-component": "calendar", ref: root, className: css("relative overflow-hidden", styles?.calendar), children: [_jsx("div", { className: "flex flex-col justify-center rounded text-center", children: _jsx(AnimatePresence, { initial: false, mode: "popLayout", custom: state.direction, onExitComplete: dispatch.onExitComplete, children: _jsxs(motion.div, { initial: "enter", animate: "middle", exit: "exit", children: [_jsxs("header", { className: "relative flex justify-between", children: [_jsx(motion.button, { layout: true, type: "button", "data-focustrap": "prev", variants: removeImmediately, onClick: dispatch.previousMonth, title: translations.calendarBackMonth, className: "z-calendar rounded-full p-1.5 hover:bg-primary hover:text-primary-foreground", children: _jsx(ChevronLeftIcon, { className: "h-4 w-4" }) }), _jsx(motion.span, { layout: true, variants: variants, custom: state.direction, className: "absolute inset-0 isolate z-normal flex items-center justify-center font-semibold", children: _jsxs("span", { className: "flex w-fit items-center justify-center gap-0.5 py-1", children: [_jsx("select", { value: monthString, onChange: dispatch.onChangeMonth, style: { width: `${monthString.length + 1}ch` }, className: "cursor-pointer appearance-none bg-transparent capitalize proportional-nums hover:text-primary", children: state.months }), _jsx(TheMaskInput, { mask: "int", maxLength: 4, placeholder: "YYYY", value: state.year, onChange: internalOnChangeYear, style: { width: `${state.year.length}ch` }, className: "w-16 cursor-pointer appearance-none bg-transparent hover:text-primary" })] }) }), _jsx(motion.button, { layout: true, type: "button", "data-focustrap": "next", variants: removeImmediately, onClick: dispatch.nextMonth, title: translations.calendarNextMonth, className: "z-calendar rounded-full p-1.5 hover:bg-primary hover:text-primary-foreground", children: _jsx(ChevronRightIcon, { className: "h-4 w-4" }) }), _jsx("div", { className: "absolute inset-0", style: {
|
|
217
|
+
return (_jsx(MotionConfig, { transition: transition, children: _jsxs("div", { "data-component": "calendar", ref: root, className: css("relative overflow-hidden", Is.function(styles?.calendar) ? styles?.calendar(allDaysOfMonth) : styles?.calendar), children: [_jsx("div", { className: "flex flex-col justify-center rounded text-center", children: _jsx(AnimatePresence, { initial: false, mode: "popLayout", custom: state.direction, onExitComplete: dispatch.onExitComplete, children: _jsxs(motion.div, { initial: "enter", animate: "middle", exit: "exit", children: [_jsxs("header", { className: "relative flex justify-between", children: [_jsx(motion.button, { layout: true, type: "button", "data-focustrap": "prev", variants: removeImmediately, onClick: dispatch.previousMonth, title: translations.calendarBackMonth, className: "z-calendar rounded-full p-1.5 hover:bg-primary hover:text-primary-foreground", children: _jsx(ChevronLeftIcon, { className: "h-4 w-4" }) }), _jsx(motion.span, { layout: true, variants: variants, custom: state.direction, className: "absolute inset-0 isolate z-normal flex items-center justify-center font-semibold", children: _jsxs("span", { className: "flex w-fit items-center justify-center gap-0.5 py-1", children: [_jsx("select", { "aria-label": translations.calendarMonthLabel, value: monthString, onChange: dispatch.onChangeMonth, style: { width: `${monthString.length + 1}ch` }, className: "cursor-pointer appearance-none bg-transparent capitalize proportional-nums hover:text-primary", children: state.months }), _jsx(TheMaskInput, { mask: "int", maxLength: 4, placeholder: "YYYY", value: state.year, onChange: internalOnChangeYear, style: { width: `${state.year.length}ch` }, className: "w-16 cursor-pointer appearance-none bg-transparent hover:text-primary" })] }) }), _jsx(motion.button, { layout: true, type: "button", "data-focustrap": "next", variants: removeImmediately, onClick: dispatch.nextMonth, title: translations.calendarNextMonth, className: "z-calendar rounded-full p-1.5 hover:bg-primary hover:text-primary-foreground", children: _jsx(ChevronRightIcon, { className: "h-4 w-4" }) }), _jsx("div", { className: "absolute inset-0", style: {
|
|
218
|
+
backgroundImage: "linear-gradient(to right, hsla(var(--card-background)) 15%, transparent 30%, transparent 70%, hsla(var(--card-background)) 85%)",
|
|
219
|
+
} })] }), _jsxs(motion.table, { className: "mt-2 table min-w-full table-auto border-0", children: [_jsx("thead", { children: _jsx("tr", { children: state.week.map((dayOfWeek) => (_jsx("th", { role: "columnheader", className: css("py-2 text-sm font-medium capitalize", Is.function(styles?.weekDay) ? styles.weekDay(dayOfWeek) : styles?.weekDay), children: dayOfWeek.toLocaleDateString(currentLocale, { weekday: "short" }) }, dayOfWeek.toString()))) }) }), _jsx(CalendarBody, { zip: zip, range: range, styles: styles, date: date || null, dispatch: dispatch, markRange: markRange, markToday: markToday, rangeMode: rangeMode, stateDate: state.date, labelRange: labelRange, stateRange: state.range, RenderOnDay: RenderOnDay, direction: state.direction, disabledDate: disabledDate, onKeyDown: dispatch.onKeyDown })] })] }, 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: translations.calendarToday }) })] }) }));
|
|
213
220
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { LucideProps } from "lucide-react";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { Override } from "../../types";
|
|
4
3
|
export type MenuProps = Partial<{
|
|
5
|
-
FloatingComponent: React.ElementType;
|
|
6
|
-
floatingClassName: string;
|
|
7
4
|
hover: boolean;
|
|
5
|
+
open?: boolean;
|
|
8
6
|
nested: boolean;
|
|
9
|
-
isParent: boolean;
|
|
10
7
|
asChild: boolean;
|
|
8
|
+
isParent: boolean;
|
|
11
9
|
children: React.ReactNode;
|
|
10
|
+
floatingClassName: string;
|
|
11
|
+
FloatingComponent: React.ElementType;
|
|
12
12
|
} & ({
|
|
13
13
|
label: string;
|
|
14
14
|
} | {
|
|
@@ -16,34 +16,31 @@ export type MenuProps = Partial<{
|
|
|
16
16
|
title: string;
|
|
17
17
|
})>;
|
|
18
18
|
type MenuItemProps = {
|
|
19
|
-
label: string;
|
|
20
|
-
disabled?: boolean;
|
|
21
|
-
Right?: React.FC<LucideProps>;
|
|
22
|
-
} | {
|
|
23
|
-
label: React.ReactElement;
|
|
24
19
|
title: string;
|
|
25
20
|
disabled?: boolean;
|
|
26
21
|
Right?: React.FC<LucideProps>;
|
|
27
22
|
};
|
|
28
|
-
export declare const MenuItem: React.ForwardRefExoticComponent<
|
|
29
|
-
export declare const Menu: React.ForwardRefExoticComponent<(Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "label" | "children" | "hover" | "asChild" | "
|
|
30
|
-
FloatingComponent: React.ElementType;
|
|
31
|
-
floatingClassName: string;
|
|
23
|
+
export declare const MenuItem: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, keyof MenuItemProps> & MenuItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
24
|
+
export declare const Menu: React.ForwardRefExoticComponent<(Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "label" | "open" | "children" | "hover" | "asChild" | "nested" | "isParent" | "floatingClassName" | "FloatingComponent"> & Partial<{
|
|
32
25
|
hover: boolean;
|
|
26
|
+
open?: boolean;
|
|
33
27
|
nested: boolean;
|
|
34
|
-
isParent: boolean;
|
|
35
28
|
asChild: boolean;
|
|
29
|
+
isParent: boolean;
|
|
36
30
|
children: React.ReactNode;
|
|
31
|
+
floatingClassName: string;
|
|
32
|
+
FloatingComponent: React.ElementType;
|
|
37
33
|
} & {
|
|
38
34
|
label: string;
|
|
39
|
-
}>, "ref"> | Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "label" | "children" | "hover" | "asChild" | "
|
|
40
|
-
FloatingComponent: React.ElementType;
|
|
41
|
-
floatingClassName: string;
|
|
35
|
+
}>, "ref"> | Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "label" | "open" | "children" | "hover" | "asChild" | "nested" | "isParent" | "floatingClassName" | "FloatingComponent"> & Partial<{
|
|
42
36
|
hover: boolean;
|
|
37
|
+
open?: boolean;
|
|
43
38
|
nested: boolean;
|
|
44
|
-
isParent: boolean;
|
|
45
39
|
asChild: boolean;
|
|
40
|
+
isParent: boolean;
|
|
46
41
|
children: React.ReactNode;
|
|
42
|
+
floatingClassName: string;
|
|
43
|
+
FloatingComponent: React.ElementType;
|
|
47
44
|
} & {
|
|
48
45
|
label: React.ReactElement;
|
|
49
46
|
title: string;
|
|
@@ -1 +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;
|
|
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;AA6BhG,MAAM,MAAM,SAAS,GAAG,OAAO,CAC3B;IACI,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,KAAK,CAAC,WAAW,CAAC;CACxC,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;AA4KF,KAAK,aAAa,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC;AAE1F,eAAO,MAAM,QAAQ,oKAmCpB,CAAC;AAEF,eAAO,MAAM,IAAI;WA5NF,OAAO;WACP,OAAO;YACN,OAAO;aACN,OAAO;cACN,OAAO;cACP,KAAK,CAAC,SAAS;uBACN,MAAM;uBACN,KAAK,CAAC,WAAW;;WAC1B,MAAM;;WART,OAAO;WACP,OAAO;YACN,OAAO;aACN,OAAO;cACN,OAAO;cACP,KAAK,CAAC,SAAS;uBACN,MAAM;uBACN,KAAK,CAAC,WAAW;;WACN,KAAK,CAAC,YAAY;WAAS,MAAM;qDA6NrE,CAAC"}
|
|
@@ -14,8 +14,8 @@ const MenuContext = createContext({
|
|
|
14
14
|
setActiveIndex: () => { },
|
|
15
15
|
setHasFocusInside: () => { },
|
|
16
16
|
});
|
|
17
|
-
const MenuComponent = React.forwardRef(({ children, FloatingComponent = "div", hover = true, isParent, floatingClassName = "", label, ...props }, forwardedRef) => {
|
|
18
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
17
|
+
const MenuComponent = React.forwardRef(({ children, FloatingComponent = "div", hover = true, open, isParent, floatingClassName = "", label, ...props }, forwardedRef) => {
|
|
18
|
+
const [isOpen, setIsOpen] = useState(open ?? false);
|
|
19
19
|
const [hasFocusInside, setHasFocusInside] = useState(false);
|
|
20
20
|
const [activeIndex, setActiveIndex] = useState(null);
|
|
21
21
|
const elementsRef = useRef([]);
|
|
@@ -55,7 +55,7 @@ const MenuComponent = React.forwardRef(({ children, FloatingComponent = "div", h
|
|
|
55
55
|
listRef: elementsRef,
|
|
56
56
|
activeIndex,
|
|
57
57
|
nested: isNested,
|
|
58
|
-
onNavigate: setActiveIndex
|
|
58
|
+
onNavigate: setActiveIndex,
|
|
59
59
|
});
|
|
60
60
|
const typeahead = useTypeahead(context, {
|
|
61
61
|
activeIndex,
|
|
@@ -63,9 +63,7 @@ const MenuComponent = React.forwardRef(({ children, FloatingComponent = "div", h
|
|
|
63
63
|
resetMs: TYPEAHEAD_RESET_DELAY,
|
|
64
64
|
onMatch: isOpen ? setActiveIndex : undefined,
|
|
65
65
|
});
|
|
66
|
-
const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([
|
|
67
|
-
hoverModule, click, role, dismiss, listNavigation, typeahead
|
|
68
|
-
]);
|
|
66
|
+
const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([hoverModule, click, role, dismiss, listNavigation, typeahead]);
|
|
69
67
|
useEffect(() => {
|
|
70
68
|
if (!tree)
|
|
71
69
|
return;
|
|
@@ -90,14 +88,14 @@ const MenuComponent = React.forwardRef(({ children, FloatingComponent = "div", h
|
|
|
90
88
|
}
|
|
91
89
|
}, [tree, isOpen, nodeId, parentId]);
|
|
92
90
|
const className = isParent ? props.className : css(menuItemClassName(props.className));
|
|
93
|
-
return (_jsxs(FloatingNode, { id: nodeId, children: [_jsx(Fragment, { children: props.asChild ? (_jsx(Slot, {
|
|
91
|
+
return (_jsxs(FloatingNode, { id: nodeId, children: [_jsx(Fragment, { children: props.asChild ? (_jsx(Slot, { ...getReferenceProps(parent.getItemProps({
|
|
94
92
|
...props,
|
|
95
93
|
onFocus(event) {
|
|
96
94
|
props.onFocus?.(event);
|
|
97
95
|
setHasFocusInside(false);
|
|
98
96
|
parent.setHasFocusInside(true);
|
|
99
97
|
},
|
|
100
|
-
})) })) : (_jsxs("button", { type: "button", className: className, "data-open": isOpen ? "" : undefined, "data-nested": isNested ? "" : undefined, role: isNested ? "menuitem" : undefined, "data-focus-inside": hasFocusInside ? "" : undefined, ref: useMergeRefs([refs.setReference, item.ref, forwardedRef]), tabIndex: !isNested ? undefined : parent.activeIndex === item.index ? 0 : -1, ...getReferenceProps(parent.getItemProps({
|
|
98
|
+
})), children: label, ref: useMergeRefs([refs.setReference, item.ref, forwardedRef]), tabIndex: !isNested ? undefined : parent.activeIndex === item.index ? 0 : -1, "data-open": isOpen ? "" : undefined, "data-nested": isNested ? "" : undefined, role: isNested ? "menuitem" : undefined, "data-focus-inside": hasFocusInside ? "" : undefined, className: className })) : (_jsxs("button", { type: "button", className: className, "data-open": isOpen ? "" : undefined, "data-nested": isNested ? "" : undefined, role: isNested ? "menuitem" : undefined, "data-focus-inside": hasFocusInside ? "" : undefined, ref: useMergeRefs([refs.setReference, item.ref, forwardedRef]), tabIndex: !isNested ? undefined : parent.activeIndex === item.index ? 0 : -1, ...getReferenceProps(parent.getItemProps({
|
|
101
99
|
...props,
|
|
102
100
|
onFocus(event) {
|
|
103
101
|
props.onFocus?.(event);
|
|
@@ -106,12 +104,12 @@ const MenuComponent = React.forwardRef(({ children, FloatingComponent = "div", h
|
|
|
106
104
|
},
|
|
107
105
|
})), children: [label, isNested && (_jsxs("span", { style: { marginLeft: 10, fontSize: 10 }, children: [_jsx("span", { className: "sr-only", children: "Next menu" }), _jsx(ChevronRightIcon, { size: 14 })] }))] })) }), _jsx(MenuContext.Provider, { value: { activeIndex, setActiveIndex, getItemProps, setHasFocusInside, isOpen }, children: _jsx(FloatingList, { elementsRef: elementsRef, labelsRef: labelsRef, children: isOpen && (_jsx(FloatingPortal, { preserveTabOrder: true, children: _jsx(FloatingFocusManager, { context: context, modal: false, initialFocus: isNested ? -1 : 0, returnFocus: !isNested, children: _jsx(FloatingComponent, { ...getFloatingProps(), ref: refs.setFloating, style: { ...props.style, ...floatingStyles }, className: css("isolate z-tooltip flex flex-col items-start rounded-lg border border-floating-border bg-floating-background text-left shadow-xl outline-none", floatingClassName), children: children }) }) })) }) })] }));
|
|
108
106
|
});
|
|
109
|
-
export const MenuItem = React.forwardRef(({
|
|
107
|
+
export const MenuItem = React.forwardRef(({ title, Right, disabled, children, ...props }, forwardedRef) => {
|
|
110
108
|
const menu = useContext(MenuContext);
|
|
111
|
-
const item = useListItem({ label: disabled ? null :
|
|
109
|
+
const item = useListItem({ label: disabled ? null : title });
|
|
112
110
|
const tree = useFloatingTree();
|
|
113
111
|
const isActive = item.index === menu.activeIndex;
|
|
114
|
-
return (_jsxs("button", { ...props, type: "button", role: "menuitem", disabled: disabled, "data-active": isActive, "data-open": menu.isOpen, tabIndex: isActive ? 0 : -1, ref: useMergeRefs([item.ref, forwardedRef]), className: menuItemClassName(`${props.className ?? ""} ${isActive ? "bg-primary text-primary-foreground" : ""}`), ...menu.getItemProps({
|
|
112
|
+
return (_jsxs("button", { ...props, title: title, type: "button", role: "menuitem", disabled: disabled, "data-active": isActive, "data-open": menu.isOpen, tabIndex: isActive ? 0 : -1, ref: useMergeRefs([item.ref, forwardedRef]), className: menuItemClassName(`${props.className ?? ""} ${isActive ? "bg-primary text-primary-foreground" : ""}`), ...menu.getItemProps({
|
|
115
113
|
onClick(event) {
|
|
116
114
|
props.onClick?.(event);
|
|
117
115
|
tree?.events.emit("click");
|
|
@@ -120,7 +118,7 @@ export const MenuItem = React.forwardRef(({ label, title, Right, disabled, ...pr
|
|
|
120
118
|
props.onFocus?.(event);
|
|
121
119
|
menu.setHasFocusInside(true);
|
|
122
120
|
},
|
|
123
|
-
}), children: [
|
|
121
|
+
}), children: [children, Right ? _jsx(Right, { size: 16 }) : null] }));
|
|
124
122
|
});
|
|
125
123
|
export const Menu = React.forwardRef((props, ref) => {
|
|
126
124
|
const parentId = useFloatingParentNodeId();
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { HTMLMotionProps } from "motion/react";
|
|
2
2
|
import React, { PropsWithChildren } from "react";
|
|
3
3
|
import { Label, Override } from "../../types";
|
|
4
|
-
export type ModalProps = Override<HTMLMotionProps<"div">, {
|
|
5
|
-
|
|
4
|
+
export type ModalProps = Override<HTMLMotionProps<"div">, ({
|
|
5
|
+
title: Label;
|
|
6
|
+
ariaTitle?: string;
|
|
7
|
+
} | {
|
|
8
|
+
ariaTitle: string;
|
|
6
9
|
title?: Label;
|
|
10
|
+
}) & {
|
|
11
|
+
open: boolean;
|
|
7
12
|
footer?: Label;
|
|
8
13
|
asChild?: boolean;
|
|
9
14
|
layoutId?: string;
|
|
@@ -18,5 +23,5 @@ export type ModalProps = Override<HTMLMotionProps<"div">, {
|
|
|
18
23
|
type?: "dialog" | "drawer" | "sheet";
|
|
19
24
|
onChange: (nextState: boolean) => void;
|
|
20
25
|
}>;
|
|
21
|
-
export declare const Modal: ({ open, title, footer, asChild, trigger, children, layoutId, onChange, className, resizer, closable, forceType, overlayClassName, type: _type, position: propsPosition, overlayClickClose, ...props }: PropsWithChildren<ModalProps>) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export declare const Modal: ({ open, title, footer, asChild, trigger, children, layoutId, onChange, className, resizer, closable, forceType, overlayClassName, type: _type, position: propsPosition, overlayClickClose, ariaTitle, ...props }: PropsWithChildren<ModalProps>) => import("react/jsx-runtime").JSX.Element;
|
|
22
27
|
//# sourceMappingURL=modal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../../src/components/floating/modal.tsx"],"names":[],"mappings":"AAcA,OAAO,EAA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,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CACJ,CAAC;AAoEF,eAAO,MAAM,KAAK,qNAmBf,iBAAiB,CAAC,UAAU,CAAC,4CAmH/B,CAAC"}
|
|
@@ -11,9 +11,9 @@ import { useMediaQuery } from "../../hooks/use-media-query";
|
|
|
11
11
|
import { css } from "../../lib/dom";
|
|
12
12
|
const animationDuration = "600ms";
|
|
13
13
|
const drawerLeft = {
|
|
14
|
-
initial: { translateX: ["-30%", "0%"], opacity: 0.8, animationDuration },
|
|
15
|
-
enter: { translateX: ["-30%", "0%"], opacity: 1, animationDuration },
|
|
16
14
|
exit: { translateX: ["0%", "-30%"], opacity: 0, animationDuration },
|
|
15
|
+
enter: { translateX: ["-30%", "0%"], opacity: 1, animationDuration },
|
|
16
|
+
initial: { translateX: ["-30%", "0%"], opacity: 0.8, animationDuration },
|
|
17
17
|
};
|
|
18
18
|
const drawerRight = {
|
|
19
19
|
initial: { translateX: ["30%", "0%"], opacity: 0.8 },
|
|
@@ -33,7 +33,7 @@ const animations = {
|
|
|
33
33
|
exit: { opacity: 0, scale: 0.97, animationDuration },
|
|
34
34
|
},
|
|
35
35
|
};
|
|
36
|
-
const variants = cva("
|
|
36
|
+
const variants = cva("z-floating border border-card-border ring-0 outline-0 appearance-none flex flex-col gap-4 flex-nowrap min-w-xs bg-floating-background", {
|
|
37
37
|
variants: {
|
|
38
38
|
type: {
|
|
39
39
|
drawer: "max-h-screen max-w-[90%] absolute w-fit h-screen min-h-0",
|
|
@@ -78,7 +78,7 @@ const Draggable = (props) => {
|
|
|
78
78
|
: "left-2 top-1/2 h-10 w-2"), children: props.sheet ? _jsx("div", { className: "h-2 w-1/4 rounded-lg bg-floating-border" }) : null }));
|
|
79
79
|
};
|
|
80
80
|
const positions = { drawer: "right", sheet: "none", dialog: "none" };
|
|
81
|
-
export const Modal = ({ open, title, footer, asChild, trigger, children, layoutId, onChange, className, resizer = true, closable = true, forceType = false, overlayClassName = "", type: _type = "dialog", position: propsPosition, overlayClickClose = false, ...props }) => {
|
|
81
|
+
export const Modal = ({ open, title, footer, asChild, trigger, children, layoutId, onChange, className, resizer = true, closable = true, forceType = false, overlayClassName = "", type: _type = "dialog", position: propsPosition, overlayClickClose = false, ariaTitle, ...props }) => {
|
|
82
82
|
const headingId = useId();
|
|
83
83
|
const descriptionId = useId();
|
|
84
84
|
const isDesktop = useMediaQuery("(min-width: 64rem)");
|
|
@@ -97,5 +97,10 @@ export const Modal = ({ open, title, footer, asChild, trigger, children, layoutI
|
|
|
97
97
|
const onClose = () => onChange(false);
|
|
98
98
|
return (_jsxs(Fragment, { children: [trigger ? (_jsx(Fragment, { children: asChild ? (_jsx(Slot, { ref: refs.setReference, ...getReferenceProps({
|
|
99
99
|
layoutId: layoutId,
|
|
100
|
-
}), children: Trigger })) : (_jsx(motion.button, { ref: refs.setReference, ...getReferenceProps(), layoutId: layoutId, type: "button", children: Trigger })) })) : null, _jsx(FloatingPortal, { children: _jsx(AnimatePresence, { mode: "wait", presenceAffectsLayout: true, children: open ? (_jsx(RemoveScroll, { enabled: true, forwardProps: true, removeScrollBar: true, inert: true, noIsolation: true, children: _jsx(FloatingOverlay, { lockScroll: true, className: css(`inset-0 isolate z-overlay h-[100dvh] !overflow-clip bg-floating-overlay/70 ${type === "drawer" ? "" : "flex items-start justify-center p-10"}`, overlayClassName), children: _jsx(FloatingFocusManager, { visuallyHiddenDismiss: true, modal: true, closeOnFocusOut: true, context: context, children: _jsxs(motion.div, { ...props, exit: "exit", animate: "enter", initial: "initial", variants: animation, "data-component": "modal", ref: refs.setFloating, "aria-modal": open, layoutId: layoutId,
|
|
100
|
+
}), children: Trigger })) : (_jsx(motion.button, { ref: refs.setReference, ...getReferenceProps(), layoutId: layoutId, type: "button", children: Trigger })) })) : null, _jsx(FloatingPortal, { children: _jsx(AnimatePresence, { mode: "wait", presenceAffectsLayout: true, children: open ? (_jsx(RemoveScroll, { enabled: true, forwardProps: true, removeScrollBar: true, inert: true, noIsolation: true, children: _jsx(FloatingOverlay, { lockScroll: true, className: css(`inset-0 isolate z-overlay h-[100dvh] !overflow-clip bg-floating-overlay/70 ${type === "drawer" ? "" : "flex items-start justify-center p-10"}`, overlayClassName), children: _jsx(FloatingFocusManager, { visuallyHiddenDismiss: true, modal: true, closeOnFocusOut: true, context: context, children: _jsxs(motion.div, { ...props, exit: "exit", animate: "enter", initial: "initial", variants: animation, "data-component": "modal", ref: refs.setFloating, "aria-modal": open, layoutId: layoutId, className: css(variants({ position, type }), className), style: type === "drawer" ? { width: value } : { height: value }, ...(title
|
|
101
|
+
? {
|
|
102
|
+
"aria-labelledby": headingId,
|
|
103
|
+
"aria-describedby": descriptionId,
|
|
104
|
+
}
|
|
105
|
+
: { "aria-label": ariaTitle }), ...getFloatingProps(), children: [title ? (_jsx("header", { className: "relative w-full", children: title ? (_jsx("h2", { id: headingId, className: "border-b border-floating-border px-8 pb-2 text-3xl font-medium leading-relaxed", children: title })) : null })) : null, _jsx("section", { className: "flex-1 overflow-y-auto px-8 py-1", children: children }), footer ? _jsx("footer", { className: "w-full border-t border-floating-border px-8 pt-4", children: footer }) : null, closable ? (_jsx("nav", { className: "absolute right-4 top-1 z-floating", children: _jsx("button", { type: "button", onClick: onClose, className: "p-1 opacity-70 transition-colors hover:text-danger hover:opacity-100 focus:text-danger", children: _jsx(XIcon, {}) }) })) : null, useResizer && resizer ? (_jsx(Draggable, { onChange: onChange, parent: refs.floating, position: position, sheet: type === "sheet", value: value })) : null] }) }) }) })) : null }) })] }));
|
|
101
106
|
};
|
|
@@ -9,11 +9,11 @@ export declare const DatePicker: React.ForwardRefExoticComponent<(Omit<Omit<Inpu
|
|
|
9
9
|
markToday: boolean;
|
|
10
10
|
rangeMode: boolean;
|
|
11
11
|
styles: Partial<{
|
|
12
|
-
day: string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
calendar: string;
|
|
12
|
+
day: string | ((d: Date) => string);
|
|
13
|
+
weekDay: string | ((d: Date) => string);
|
|
14
|
+
dayFrame: string | ((d: Date) => string);
|
|
15
|
+
week: string | ((week: Date[]) => string);
|
|
16
|
+
calendar: string | ((daysOfMonth: Date[]) => string);
|
|
17
17
|
}>;
|
|
18
18
|
changeOnlyOnClick: boolean;
|
|
19
19
|
onChangeYear: (d: Date) => void;
|
|
@@ -38,11 +38,11 @@ export declare const DatePicker: React.ForwardRefExoticComponent<(Omit<Omit<Inpu
|
|
|
38
38
|
markToday: boolean;
|
|
39
39
|
rangeMode: boolean;
|
|
40
40
|
styles: Partial<{
|
|
41
|
-
day: string;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
calendar: string;
|
|
41
|
+
day: string | ((d: Date) => string);
|
|
42
|
+
weekDay: string | ((d: Date) => string);
|
|
43
|
+
dayFrame: string | ((d: Date) => string);
|
|
44
|
+
week: string | ((week: Date[]) => string);
|
|
45
|
+
calendar: string | ((daysOfMonth: Date[]) => string);
|
|
46
46
|
}>;
|
|
47
47
|
changeOnlyOnClick: boolean;
|
|
48
48
|
onChangeYear: (d: Date) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-field.d.ts","sourceRoot":"","sources":["../../../../src/components/form/input-field.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAwB,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,KAAK,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,iBAAiB,CAC/C,OAAO,CAAC;IACJ,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACn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IAClB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACvB,CACJ,CACJ,EACD,CAAC,CACJ,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,SAAS,OAAO,GAAG,QAAQ,GAAG,UAAU,EAAE,KAAK,EAAE,iBAAiB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,YA6EpH,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { forwardRef, Fragment } from "react";
|
|
|
5
5
|
import { useTranslations, useTweaks } from "../../hooks/use-components-provider";
|
|
6
6
|
import { css } from "../../lib/dom";
|
|
7
7
|
import { Tooltip } from "../floating/tooltip";
|
|
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-disabled:text-disabled group-error:text-danger", children: [title, reportStatus || info ? (_jsxs("span", { className: "flex items-center justify-center gap-1", children: [info ? (_jsx(Tooltip, { as: "button", type: "button", 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: _jsx("div", { className: "w-full max-w-48 whitespace-break-spaces break-words", 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] }));
|
|
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-disabled:text-disabled group-error:text-danger", children: [title, reportStatus || info ? (_jsxs("span", { className: "flex items-center justify-center gap-1", children: [info ? (_jsx(Tooltip, { as: "button", type: "button", "aria-description": info, 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: _jsx("div", { className: "w-full max-w-48 whitespace-break-spaces break-words", 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] }));
|
|
9
9
|
export const InputField = forwardRef(({ optionalText: _optionalText, left, rightLabel, container, feedback, interactive, right, info, children, error, form, id, labelClassName = "", name, title, componentName, placeholder, hideLeft = false, required, disabled, reportStatus, }, ref) => {
|
|
10
10
|
const tweaks = useTweaks();
|
|
11
11
|
const reportStatusDefault = reportStatus !== undefined ? reportStatus : tweaks.input.iconFeedback;
|
|
@@ -53,6 +53,7 @@ declare const defaultTranslations: {
|
|
|
53
53
|
calendarToday: string;
|
|
54
54
|
calendarBackMonth: string;
|
|
55
55
|
calendarNextMonth: string;
|
|
56
|
+
calendarMonthLabel: string;
|
|
56
57
|
multiComboboxSelectedLabel: string;
|
|
57
58
|
multiComboboxInnerPlaceholder: string;
|
|
58
59
|
};
|
|
@@ -122,6 +123,7 @@ export declare const useTranslations: () => {
|
|
|
122
123
|
calendarToday: string;
|
|
123
124
|
calendarBackMonth: string;
|
|
124
125
|
calendarNextMonth: string;
|
|
126
|
+
calendarMonthLabel: string;
|
|
125
127
|
multiComboboxSelectedLabel: string;
|
|
126
128
|
multiComboboxInnerPlaceholder: string;
|
|
127
129
|
};
|
|
@@ -1 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAgDa;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
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAgDa;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,OA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