@g4rcez/components 0.0.70 → 0.0.71
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 +51 -56
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7528 -7447
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +47 -52
- package/dist/index.umd.js.map +1 -1
- package/dist/preset/src/styles/dark.d.ts.map +1 -1
- package/dist/preset/src/styles/dark.js +2 -0
- package/dist/preset/src/styles/light.d.ts.map +1 -1
- package/dist/preset/src/styles/light.js +2 -0
- package/dist/preset/src/styles/theme.types.d.ts +1 -0
- package/dist/preset/src/styles/theme.types.d.ts.map +1 -1
- package/dist/src/components/display/calendar.js +1 -1
- package/dist/src/components/floating/modal.js +1 -1
- package/dist/src/components/form/autocomplete.d.ts +1 -7
- package/dist/src/components/form/autocomplete.d.ts.map +1 -1
- package/dist/src/components/form/autocomplete.js +77 -27
- package/dist/src/components/form/free-text.d.ts.map +1 -1
- package/dist/src/components/form/free-text.js +2 -2
- package/dist/src/components/form/input-field.d.ts +5 -5
- package/dist/src/components/form/input-field.d.ts.map +1 -1
- package/dist/src/components/form/input-field.js +5 -3
- package/dist/src/components/form/multi-combobox.d.ts +24 -0
- package/dist/src/components/form/multi-combobox.d.ts.map +1 -0
- package/dist/src/components/form/{virtual-autocomplete.js → multi-combobox.js} +92 -68
- package/dist/src/components/form/select.d.ts.map +1 -1
- package/dist/src/components/form/select.js +1 -1
- package/dist/src/components/index.d.ts +1 -1
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +1 -1
- package/dist/src/components/table/thead.d.ts.map +1 -1
- package/dist/src/components/table/thead.js +1 -1
- package/dist/src/hooks/use-components-provider.d.ts +9 -0
- package/dist/src/hooks/use-components-provider.d.ts.map +1 -1
- package/dist/src/hooks/use-components-provider.js +22 -5
- package/dist/src/lib/dict.d.ts +9 -0
- package/dist/src/lib/dict.d.ts.map +1 -0
- package/dist/src/lib/dict.js +28 -0
- package/dist/src/styles/dark.d.ts.map +1 -1
- package/dist/src/styles/dark.js +2 -0
- package/dist/src/styles/light.d.ts.map +1 -1
- package/dist/src/styles/light.js +2 -0
- package/dist/src/styles/theme.types.d.ts +1 -0
- package/dist/src/styles/theme.types.d.ts.map +1 -1
- package/package.json +1 -2
- package/dist/src/components/form/virtual-autocomplete.d.ts +0 -15
- package/dist/src/components/form/virtual-autocomplete.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dark.d.ts","sourceRoot":"","sources":["../../../../src/styles/dark.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAO,MAAM,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"dark.d.ts","sourceRoot":"","sources":["../../../../src/styles/dark.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAO,MAAM,UAAU,EAAE,YA0LxB,CAAC"}
|
|
@@ -71,12 +71,14 @@ export var DARK_THEME = {
|
|
|
71
71
|
floating: {
|
|
72
72
|
foreground: "hsla(210, 40%, 98%)",
|
|
73
73
|
background: "hsla(0, 0%, 14%)",
|
|
74
|
+
hover: "hsla(221, 10%, 22%)",
|
|
74
75
|
border: "hsla(240, 7%, 27%)",
|
|
75
76
|
overlay: "hsla(0, 0%, 0%)",
|
|
76
77
|
},
|
|
77
78
|
tooltip: {
|
|
78
79
|
foreground: "hsla(210, 40%, 98%)",
|
|
79
80
|
background: "hsla(0, 0%, 8%)",
|
|
81
|
+
hover: "hsla(221, 10%, 35%)",
|
|
80
82
|
border: "hsla(0, 0%, 19%)",
|
|
81
83
|
overlay: "hsla(0, 0%, 0%)",
|
|
82
84
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"light.d.ts","sourceRoot":"","sources":["../../../../src/styles/light.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"light.d.ts","sourceRoot":"","sources":["../../../../src/styles/light.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAO,MAAM,WAAW,EAAE,YA0LzB,CAAC"}
|
|
@@ -71,12 +71,14 @@ export var LIGHT_THEME = {
|
|
|
71
71
|
floating: {
|
|
72
72
|
foreground: "hsla(217, 15%, 20%)",
|
|
73
73
|
background: "hsla(0, 0%, 100%)",
|
|
74
|
+
hover: "hsla(0, 0%, 92%)",
|
|
74
75
|
border: "hsla(210, 25%, 88%)",
|
|
75
76
|
overlay: "hsla(0, 0%, 0%)",
|
|
76
77
|
},
|
|
77
78
|
tooltip: {
|
|
78
79
|
foreground: "hsla(217, 15%, 20%)",
|
|
79
80
|
background: "hsla(210, 25%, 98%)",
|
|
81
|
+
hover: "hsla(210, 25%, 92%)",
|
|
80
82
|
border: "hsla(200, 1%, 80%)",
|
|
81
83
|
overlay: "hsla(0, 0%, 0%)",
|
|
82
84
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.types.d.ts","sourceRoot":"","sources":["../../../../src/styles/theme.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;KAAG,CAAC,IAAI,MAAM,GAAG,MAAM,GAAG,aAAa;CAAE,CAAC;AAEtE,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAEtG,KAAK,WAAW,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,KAAK,cAAc,GAAG;IAClB,MAAM,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KAAK,EAAE;YACH,MAAM,EAAE,MAAM,CAAC;YACf,WAAW,EAAE,MAAM,CAAC;YACpB,YAAY,EAAE,MAAM,CAAC;YACrB,WAAW,EAAE,MAAM,CAAC;YACpB,MAAM,EAAE,MAAM,CAAC;SAClB,CAAC;KACL,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD,MAAM,MAAM,kBAAkB,GACxB,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,GACzD,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;AAEpF,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,KAAK,CAAC;AAEzF,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAE/B,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,aAAa,EAAE,CAAC,SAAS,EAAE,IAAI;KAC1D,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,aAAa,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC;CACnF,CAAC"}
|
|
@@ -209,5 +209,5 @@ export const Calendar = ({ RenderOnDay, changeOnlyOnClick = false, labelRange, d
|
|
|
209
209
|
onChangeYear?.(new Date(value));
|
|
210
210
|
defer(value);
|
|
211
211
|
};
|
|
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, { type: "button", layout: true, "data-focustrap": "prev", variants: removeImmediately, onClick: dispatch.previousMonth, className: "z-calendar rounded-full p-1.5 hover:bg-primary", 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}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, className: "z-calendar rounded-full p-1.5 hover:bg-primary", children: _jsx(ChevronRightIcon, { className: "h-4 w-4" }) }), _jsx("div", { className: "absolute inset-0", style: { backgroundImage: "linear-gradient(to right, hsla(var(--card-background)) 15%, transparent 30%, transparent 70%, hsla(var(--card-background)) 85%)" } })] }), _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", { className: css("py-2 text-sm font-medium capitalize", 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 }) })] }) }));
|
|
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, { type: "button", layout: true, "data-focustrap": "prev", variants: removeImmediately, onClick: dispatch.previousMonth, className: "z-calendar rounded-full p-1.5 hover:bg-primary", 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, className: "z-calendar rounded-full p-1.5 hover:bg-primary", children: _jsx(ChevronRightIcon, { className: "h-4 w-4" }) }), _jsx("div", { className: "absolute inset-0", style: { backgroundImage: "linear-gradient(to right, hsla(var(--card-background)) 15%, transparent 30%, transparent 70%, hsla(var(--card-background)) 85%)" } })] }), _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", { className: css("py-2 text-sm font-medium capitalize", 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
213
|
};
|
|
@@ -97,5 +97,5 @@ export const Modal = ({ type: _type = "dialog", resizer = true, overlayClickClos
|
|
|
97
97
|
const onClose = () => props.onChange(false);
|
|
98
98
|
return (_jsxs(Fragment, { children: [props.trigger ? (_jsx(Fragment, { children: props.asChild ? (_jsx(Slot, { ref: refs.setReference, ...getReferenceProps({
|
|
99
99
|
layoutId: props.layoutId,
|
|
100
|
-
}), children: Trigger })) : (_jsx(motion.button, { ref: refs.setReference, ...getReferenceProps(), layoutId: props.layoutId, type: "button", children: Trigger })) })) : null, _jsx(FloatingPortal, { children: _jsx(AnimatePresence, { mode: "wait", presenceAffectsLayout: true, children: props.open ? (_jsx(RemoveScroll, { forwardProps: true, removeScrollBar: true,
|
|
100
|
+
}), children: Trigger })) : (_jsx(motion.button, { ref: refs.setReference, ...getReferenceProps(), layoutId: props.layoutId, type: "button", children: Trigger })) })) : null, _jsx(FloatingPortal, { children: _jsx(AnimatePresence, { mode: "wait", presenceAffectsLayout: true, children: props.open ? (_jsx(RemoveScroll, { enabled: true, forwardProps: true, removeScrollBar: true, inert: true, noIsolation: true, children: _jsx(FloatingOverlay, { lockScroll: true, className: `inset-0 isolate z-overlay h-[100dvh] !overflow-clip bg-floating-overlay/70 ${type === "drawer" ? "" : "flex items-start justify-center p-10"}`, children: _jsx(FloatingFocusManager, { visuallyHiddenDismiss: true, modal: true, closeOnFocusOut: true, context: context, children: _jsxs(motion.div, { exit: "exit", animate: "enter", initial: "initial", variants: animation, ref: refs.setFloating, "aria-modal": props.open, layoutId: props.layoutId, "aria-labelledby": headingId, "aria-describedby": descriptionId, className: variants({ position, type }), style: type === "drawer" ? { width: value } : { height: value }, ...getFloatingProps(), children: [props.title ? (_jsx("header", { className: "relative w-full", children: props.title ? (_jsx("h2", { className: "border-b border-floating-border px-8 pb-2 text-3xl font-medium leading-relaxed", children: props.title })) : null })) : null, _jsx("section", { className: "flex-1 overflow-y-auto px-8 py-1", children: props.children }), props.footer ? (_jsx("footer", { className: "w-full border-t border-floating-border px-8 pt-4", children: props.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: props.onChange, parent: refs.floating, position: position, sheet: type === "sheet", value: value })) : null] }) }) }) })) : null }) })] }));
|
|
101
101
|
};
|
|
@@ -5,14 +5,8 @@ import { type OptionProps } from "./select";
|
|
|
5
5
|
export type AutocompleteItemProps = OptionProps & {
|
|
6
6
|
Render?: React.FC<OptionProps>;
|
|
7
7
|
};
|
|
8
|
-
export type AutocompleteOptionProps = Omit<React.HTMLProps<HTMLLIElement>, "children"> & {
|
|
9
|
-
active: boolean;
|
|
10
|
-
selected: boolean;
|
|
11
|
-
emptyMessage?: Label;
|
|
12
|
-
option: AutocompleteItemProps;
|
|
13
|
-
};
|
|
14
|
-
export declare const Option: React.ForwardRefExoticComponent<Omit<AutocompleteOptionProps, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
15
8
|
export type AutocompleteProps = Omit<InputFieldProps<"input">, "value"> & {
|
|
9
|
+
title?: string;
|
|
16
10
|
value?: string;
|
|
17
11
|
emptyMessage?: Label;
|
|
18
12
|
dynamicOption?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../../src/components/form/autocomplete.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../../src/components/form/autocomplete.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAoF,MAAM,OAAO,CAAC;AAMzG,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,MAAM,qBAAqB,GAAG,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC;AAErF,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,qBAAqB,EAAE,CAAC;CACpC,CAAC;AA+BF,eAAO,MAAM,YAAY,yGAoVxB,CAAC"}
|
|
@@ -2,22 +2,16 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { autoUpdate, FloatingFocusManager, FloatingPortal, offset, size, useDismiss, useFloating, useInteractions, useListNavigation, useRole, useTransitionStyles, } from "@floating-ui/react";
|
|
4
4
|
import Fuzzy from "fuzzy-search";
|
|
5
|
-
import {
|
|
6
|
-
import { forwardRef, Fragment, useEffect, useRef, useState } from "react";
|
|
5
|
+
import { ChevronDown } from "lucide-react";
|
|
7
6
|
import { AnimatePresence, motion } from "motion/react";
|
|
7
|
+
import { forwardRef, Fragment, useEffect, useRef, useState } from "react";
|
|
8
|
+
import { flushSync } from "react-dom";
|
|
9
|
+
import { Virtuoso } from "react-virtuoso";
|
|
8
10
|
import { useTranslations } from "../../hooks/use-components-provider";
|
|
9
11
|
import { css, dispatchInput, initializeInputDataset } from "../../lib/dom";
|
|
10
12
|
import { safeRegex } from "../../lib/fns";
|
|
11
13
|
import { InputField } from "./input-field";
|
|
12
14
|
const Frag = (props) => _jsx(Fragment, { children: props.children });
|
|
13
|
-
export const Option = forwardRef(({ selected, active, onClick, option, ...props }, ref) => {
|
|
14
|
-
const Label = option.Render ?? Frag;
|
|
15
|
-
const children = option.label ?? option.value;
|
|
16
|
-
if (option.hidden) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
return (_jsx(motion.li, { ...props, ref: ref, role: "option", "aria-selected": active, className: "w-full border-b border-tooltip-border last:border-transparent", children: _jsxs("button", { type: "button", "aria-busy": option.disabled, "aria-checked": active, "aria-current": active, "aria-selected": active, onClick: onClick, "data-value": option.value, className: `flex w-full cursor-pointer justify-between p-2 text-left ${active ? "bg-primary-hover text-primary-foreground" : ""} ${selected ? "bg-primary text-primary-foreground" : ""}`, children: [_jsx(Label, { ...props, label: option.label, value: option.value, children: children }), active ? (_jsx("span", { children: _jsx(CheckIcon, { "aria-hidden": true, className: "text-current", absoluteStrokeWidth: true, strokeWidth: 2, size: 22 }) })) : null] }) }));
|
|
20
|
-
});
|
|
21
15
|
const transitionStyles = {
|
|
22
16
|
duration: 300,
|
|
23
17
|
initial: { transform: "scaleY(0)", opacity: 0.2 },
|
|
@@ -26,10 +20,20 @@ const transitionStyles = {
|
|
|
26
20
|
};
|
|
27
21
|
const fuzzyOptions = { caseSensitive: false, sort: false };
|
|
28
22
|
const emptyRef = [];
|
|
23
|
+
const List = forwardRef(function VirtualList(props, ref) {
|
|
24
|
+
return (_jsx(motion.ul, { ...props, ref: ref, className: "w-full rounded-lg border-b border-tooltip-border last:border-transparent", children: _jsx(AnimatePresence, { children: props.children }) }));
|
|
25
|
+
});
|
|
26
|
+
const Item = forwardRef(function VirtualItem({ item, context, ...props }, ref) {
|
|
27
|
+
return _jsx(motion.li, { ...props, ref: ref, className: "first:rounded-t-lg last:rounded-t-lg" });
|
|
28
|
+
});
|
|
29
|
+
const components = { List, Item };
|
|
30
|
+
const DEFAULT_SIZE = 300;
|
|
29
31
|
export const Autocomplete = forwardRef(({ options, dynamicOption = false, feedback = null, labelClassName, emptyMessage, interactive, rightLabel, optionalText, container, hideLeft = false, right, left, error, required = false, ...props }, externalRef) => {
|
|
30
32
|
const fieldset = useRef(null);
|
|
33
|
+
const virtuoso = useRef(null);
|
|
31
34
|
const defaults = props.value ?? props.defaultValue ?? "";
|
|
32
35
|
const translation = useTranslations();
|
|
36
|
+
const [h, setH] = useState(0);
|
|
33
37
|
const [open, setOpen] = useState(false);
|
|
34
38
|
const [shadow, setShadow] = useState("");
|
|
35
39
|
const [value, setValue] = useState(defaults);
|
|
@@ -50,12 +54,31 @@ export const Autocomplete = forwardRef(({ options, dynamicOption = false, feedba
|
|
|
50
54
|
const pattern = dynamicOption
|
|
51
55
|
? undefined
|
|
52
56
|
: `^(${options.map((x) => `${safeRegex(x.value)}${x.label ? "|" + safeRegex(x.label) : ""}`).join("|")})$`;
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (!open)
|
|
59
|
+
setH(0);
|
|
60
|
+
}, [open]);
|
|
53
61
|
useEffect(() => {
|
|
54
62
|
if (props.value) {
|
|
55
63
|
const item = options.find((x) => x.value === props.value);
|
|
56
64
|
setValue(item?.label ?? props.value);
|
|
57
65
|
}
|
|
58
66
|
}, [props.value]);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (!open)
|
|
69
|
+
return;
|
|
70
|
+
const ul = refs.floating;
|
|
71
|
+
if (ul.current === null)
|
|
72
|
+
return;
|
|
73
|
+
let size = 0;
|
|
74
|
+
const items = Array.from(ul.current.querySelectorAll("li")).slice(0, Math.min(list.length, 10));
|
|
75
|
+
items.forEach((x) => {
|
|
76
|
+
const rect = x.getBoundingClientRect();
|
|
77
|
+
size += rect.height;
|
|
78
|
+
});
|
|
79
|
+
const s = Math.min(size, DEFAULT_SIZE);
|
|
80
|
+
setH(s);
|
|
81
|
+
}, [shadow, open]);
|
|
59
82
|
const { x, y, strategy, refs, context } = useFloating({
|
|
60
83
|
open,
|
|
61
84
|
transform: true,
|
|
@@ -65,14 +88,18 @@ export const Autocomplete = forwardRef(({ options, dynamicOption = false, feedba
|
|
|
65
88
|
middleware: [
|
|
66
89
|
offset(4),
|
|
67
90
|
size({
|
|
68
|
-
elementContext: "reference",
|
|
69
91
|
padding: 10,
|
|
92
|
+
elementContext: "reference",
|
|
70
93
|
apply(a) {
|
|
71
94
|
const w = fieldset.current?.getBoundingClientRect().width;
|
|
95
|
+
const ul = a.elements.floating.querySelector("ul");
|
|
96
|
+
const fullSize = ul?.getBoundingClientRect().height || 0;
|
|
97
|
+
const maxH = Math.min(fullSize < 40 ? DEFAULT_SIZE : fullSize, DEFAULT_SIZE);
|
|
98
|
+
flushSync(() => setTimeout(() => setH(maxH), 200));
|
|
72
99
|
Object.assign(a.elements.floating.style, {
|
|
73
100
|
width: `${w}px`,
|
|
74
101
|
maxWidth: `${w}px`,
|
|
75
|
-
maxHeight: `${
|
|
102
|
+
maxHeight: `${maxH}px`,
|
|
76
103
|
});
|
|
77
104
|
},
|
|
78
105
|
}),
|
|
@@ -126,24 +153,24 @@ export const Autocomplete = forwardRef(({ options, dynamicOption = false, feedba
|
|
|
126
153
|
event.target.name = props.name || "";
|
|
127
154
|
return value ? setOpen(true) : props.onChange?.(event);
|
|
128
155
|
};
|
|
156
|
+
const onCaretDownClick = () => {
|
|
157
|
+
setOpen(true);
|
|
158
|
+
setShadow("");
|
|
159
|
+
refs.reference.current?.focus();
|
|
160
|
+
};
|
|
129
161
|
const onFocus = () => {
|
|
130
162
|
setOpen(true);
|
|
131
163
|
setShadow("");
|
|
132
164
|
};
|
|
133
165
|
const onClose = () => {
|
|
166
|
+
refs.reference.current?.setAttribute("data-value", "");
|
|
134
167
|
setShadow("");
|
|
135
168
|
setValue("");
|
|
136
|
-
refs.reference.current?.setAttribute("data-value", "");
|
|
137
169
|
setLabel("");
|
|
138
170
|
dispatchInput(refs.reference.current, "");
|
|
139
171
|
setOpen(false);
|
|
140
172
|
};
|
|
141
173
|
const id = props.id || props.name;
|
|
142
|
-
const onCaretDownClick = () => {
|
|
143
|
-
setOpen(true);
|
|
144
|
-
setShadow("");
|
|
145
|
-
refs.reference.current?.focus();
|
|
146
|
-
};
|
|
147
174
|
return (_jsxs(InputField, { ...props, left: left, error: error, ref: fieldset, form: props.form, name: props.name, feedback: feedback, hideLeft: hideLeft, required: required, title: props.title, container: container, rightLabel: rightLabel, interactive: interactive, id: props.name || props.id, optionalText: optionalText, componentName: "autocomplete", labelClassName: labelClassName, placeholder: props.placeholder, right: _jsxs("span", { className: "flex items-center gap-0.5", children: [_jsxs("button", { type: "button", className: "transition-colors link:text-primary", onClick: onCaretDownClick, children: [_jsx(ChevronDown, { size: 20 }), _jsx("span", { className: "sr-only", children: translation.inputCaretDown })] }), value ? (_jsx("button", { type: "button", onClick: onClose, className: "transition-colors link:text-danger", children: _jsx("svg", { width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z", fill: "currentColor", fillRule: "evenodd", clipRule: "evenodd" }) }) })) : null] }), children: [_jsx("input", { "data-shadow": "true", ...getReferenceProps({
|
|
148
175
|
...props,
|
|
149
176
|
onChange,
|
|
@@ -154,6 +181,20 @@ export const Autocomplete = forwardRef(({ options, dynamicOption = false, feedba
|
|
|
154
181
|
id: `${id}-shadow`,
|
|
155
182
|
onClick: (e) => e.currentTarget.focus(),
|
|
156
183
|
onKeyDown(event) {
|
|
184
|
+
if (event.key === "ArrowDown") {
|
|
185
|
+
let next = index + 1;
|
|
186
|
+
if (next > list.length - 1)
|
|
187
|
+
next = 0;
|
|
188
|
+
virtuoso.current?.scrollIntoView({ index: next });
|
|
189
|
+
return setIndex(next);
|
|
190
|
+
}
|
|
191
|
+
if (event.key === "ArrowUp") {
|
|
192
|
+
let next = index - 1;
|
|
193
|
+
if (next < 0)
|
|
194
|
+
next = list.length - 1;
|
|
195
|
+
virtuoso.current?.scrollIntoView({ index: next });
|
|
196
|
+
return setIndex(next);
|
|
197
|
+
}
|
|
157
198
|
if (event.key === "Escape") {
|
|
158
199
|
event.currentTarget.blur();
|
|
159
200
|
return setOpen(false);
|
|
@@ -169,20 +210,29 @@ export const Autocomplete = forwardRef(({ options, dynamicOption = false, feedba
|
|
|
169
210
|
}
|
|
170
211
|
}
|
|
171
212
|
},
|
|
172
|
-
}), "data-value": value, "data-error": !!error, "data-name": id, "data-target": id, required: required, value: open ? shadow : label || value, "aria-autocomplete": "list", autoComplete: "off", className: css("input placeholder-input-mask group h-input-height w-full flex-1", "rounded-md bg-transparent px-input-x py-input-y text-foreground", "outline-none transition-colors focus:ring-2 focus:ring-inset focus:ring-primary", "group-error:text-danger group-error:placeholder-input-mask-error", "group-focus-within:border-primary group-hover:border-primary", props.className) }), _jsx("input", { id: id, name: id, type: "hidden", "data-origin": id, ref: externalRef, required: required, defaultValue: props.value || value || undefined }), _jsx(FloatingPortal, { preserveTabOrder: true, children: open ? (_jsx(FloatingFocusManager, { guards: true, returnFocus: false, context: context, initialFocus: -1, visuallyHiddenDismiss: true, children:
|
|
213
|
+
}), "data-value": value, "data-error": !!error, "data-name": id, "data-target": id, required: required, value: open ? shadow : label || value, "aria-autocomplete": "list", autoComplete: "off", className: css("input placeholder-input-mask group h-input-height w-full flex-1", "rounded-md bg-transparent px-input-x py-input-y text-foreground", "outline-none transition-colors focus:ring-2 focus:ring-inset focus:ring-primary", "group-error:text-danger group-error:placeholder-input-mask-error", "group-focus-within:border-primary group-hover:border-primary", props.className) }), _jsx("input", { id: id, name: id, type: "hidden", "data-origin": id, ref: externalRef, required: required, defaultValue: props.value || value || undefined }), _jsx(FloatingPortal, { preserveTabOrder: true, children: open ? (_jsx(FloatingFocusManager, { guards: true, returnFocus: false, context: context, initialFocus: -1, visuallyHiddenDismiss: true, children: _jsxs("ul", { ...getFloatingProps({
|
|
173
214
|
ref: refs.setFloating,
|
|
174
215
|
style: {
|
|
216
|
+
...transitions.styles,
|
|
175
217
|
position: strategy,
|
|
176
|
-
left: (x ?? 0) + (!!value ? 26 :
|
|
218
|
+
left: (x ?? 0) + (!!value ? 26 : 18),
|
|
177
219
|
top: y ?? 0,
|
|
178
|
-
...transitions.styles,
|
|
179
220
|
},
|
|
180
|
-
}), "data-floating": "true", className: "z-floating m-0 origin-[top_center] list-none
|
|
221
|
+
}), "data-floating": "true", className: "z-floating m-0 origin-[top_center] list-none overscroll-contain rounded-b-lg rounded-t-lg border border-floating-border bg-floating-background p-0 text-foreground shadow-floating", children: [list.length === 0 ? (_jsx("li", { role: "option", className: "w-full border-b border-tooltip-border last:border-transparent", children: _jsx("span", { className: "flex w-full justify-between p-2 text-left text-disabled", children: emptyMessage || translation.autocompleteEmpty }) })) : null, _jsx(Virtuoso, { data: list, ref: virtuoso, hidden: list.length === 0, components: components, className: "rounded-lg border-floating-border bg-floating-background p-0 text-foreground", style: { height: h }, itemContent: (i, option) => {
|
|
222
|
+
const Label = option.Render ?? Frag;
|
|
181
223
|
const active = value === option.value || value === option.label;
|
|
182
|
-
|
|
183
|
-
|
|
224
|
+
const selected = index === i;
|
|
225
|
+
const children = option.label ?? option.value;
|
|
226
|
+
return (_jsx("button", { "data-value": option.value, ...getItemProps({
|
|
184
227
|
ref: (node) => void (listRef.current[i] = node),
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
228
|
+
role: "option",
|
|
229
|
+
type: "button",
|
|
230
|
+
"aria-checked": active,
|
|
231
|
+
"aria-current": active,
|
|
232
|
+
"aria-selected": active,
|
|
233
|
+
"aria-busy": option.disabled,
|
|
234
|
+
onClick: () => onSelect(option, i),
|
|
235
|
+
className: `cursor-pointer w-full p-2 text-left ${active ? "bg-primary-hover text-primary-foreground" : ""} ${selected ? "bg-floating-hover text-floating-foreground" : ""}`,
|
|
236
|
+
}), children: _jsx(Label, { ...props, label: option.label, value: option.value, children: children }) }));
|
|
237
|
+
} })] }) })) : null })] }));
|
|
188
238
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"free-text.d.ts","sourceRoot":"","sources":["../../../../src/components/form/free-text.tsx"],"names":[],"mappings":"AACA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAC7D,OAAO,SAAS,EAAE,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"free-text.d.ts","sourceRoot":"","sources":["../../../../src/components/form/free-text.tsx"],"names":[],"mappings":"AACA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAC7D,OAAO,SAAS,EAAE,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,aAAa,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAE3E,KAAK,WAAW,GAAG,OAAO,GAAG,UAAU,CAAC;AAExC,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,WAAW,EAAE,UAAU,SAAS,MAAM,IAAI,QAAQ,CAClF,UAAU,GAAG,aAAa,EAC1B,eAAe,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,CACnE,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,WAAW,EAAE,IAAI,SAAS,gBAAgB,GAAG,mBAAmB,EAAE,KAAK,SAAS,MAAM,WAClH,OAAO,GAAG,UAAU,GAAG,OAAO,SAAS,eACnC,OAAO,GAAG,UAAU,gBACnB,aAAa,CAAC,CAAC,EAAE,KAAK,CAAC,aAC1B,CAAC,EAAE,EAAE,IAAI,KAAK,MAAM,IAAI,sCAqGtC,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { forwardRef, useEffect, useRef } from "react";
|
|
|
4
4
|
import { css, initializeInputDataset, mergeRefs } from "../../lib/dom";
|
|
5
5
|
import { InputField } from "./input-field";
|
|
6
6
|
export const createFreeText = (Element, elementName, defaultProps, register) => {
|
|
7
|
-
const FreeText = forwardRef(({
|
|
7
|
+
const FreeText = forwardRef(({ info, left, next, error, right, container, rightLabel, interactive, optionalText, type = "text", labelClassName, feedback = null, hideLeft = false, ...props }, ref) => {
|
|
8
8
|
const Render = Element;
|
|
9
9
|
const id = props.id ?? props.name;
|
|
10
10
|
const inputRef = useRef(null);
|
|
@@ -34,7 +34,7 @@ export const createFreeText = (Element, elementName, defaultProps, register) =>
|
|
|
34
34
|
input.removeEventListener("keydown", goNextInputImpl);
|
|
35
35
|
};
|
|
36
36
|
}, []);
|
|
37
|
-
return (_jsx(InputField, { ...defaultProps,
|
|
37
|
+
return (_jsx(InputField, { ...defaultProps, info: info, left: left, error: error, right: right, form: props.form, name: props.name, feedback: feedback, hideLeft: hideLeft, title: props.title, container: container, rightLabel: rightLabel, disabled: props.disabled, interactive: interactive, required: props.required, componentName: elementName, id: props.name || props.id, optionalText: optionalText, labelClassName: labelClassName, placeholder: props.placeholder, children: _jsx(Render, { ...defaultProps, ...props, id: id, name: id, type: type, "data-next": next, "aria-busy": props.disabled, "aria-disabled": props.disabled, "aria-readonly": props.readOnly, ref: mergeRefs(ref, inputRef), className: css("input placeholder-input-mask group h-input-height w-full flex-1", "rounded-md bg-transparent px-input-x py-input-y text-foreground", "outline-none transition-colors focus:ring-2 focus:ring-inset focus:ring-primary", "group-error:text-danger group-error:placeholder-input-mask-error", "resize-y group-focus-within:border-primary group-hover:border-primary", "disabled:cursor-not-allowed disabled:text-disabled", props.className) }) }));
|
|
38
38
|
});
|
|
39
39
|
return FreeText;
|
|
40
40
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { PropsWithChildren } from "react";
|
|
2
|
-
import { Label } from "../../types";
|
|
3
|
-
import { PolymorphicProps } from "../core/polymorph";
|
|
1
|
+
import React, { type PropsWithChildren } from "react";
|
|
2
|
+
import { type Label, Override } from "../../types";
|
|
3
|
+
import { type PolymorphicProps } from "../core/polymorph";
|
|
4
4
|
export type FeedbackProps = React.PropsWithChildren<Partial<{
|
|
5
5
|
info: Label;
|
|
6
6
|
title: Label;
|
|
@@ -10,7 +10,7 @@ export type FeedbackProps = React.PropsWithChildren<Partial<{
|
|
|
10
10
|
reportStatus: boolean;
|
|
11
11
|
}>>;
|
|
12
12
|
export declare const InputFeedback: ({ reportStatus, hideLeft, className, info, children, title }: FeedbackProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export type InputFieldProps<T extends "input" | "select" | "textarea"> = PolymorphicProps<Partial<{
|
|
13
|
+
export type InputFieldProps<T extends "input" | "select" | "textarea"> = PolymorphicProps<Partial<Override<FeedbackProps, {
|
|
14
14
|
componentName: string;
|
|
15
15
|
info: Label;
|
|
16
16
|
labelClassName: string;
|
|
@@ -26,6 +26,6 @@ export type InputFieldProps<T extends "input" | "select" | "textarea"> = Polymor
|
|
|
26
26
|
id: string;
|
|
27
27
|
name: string;
|
|
28
28
|
placeholder: string;
|
|
29
|
-
}
|
|
29
|
+
}>>, T>;
|
|
30
30
|
export declare const InputField: <T extends "input" | "select" | "textarea">(props: PropsWithChildren<InputFieldProps<T>>) => React.ReactElement;
|
|
31
31
|
//# sourceMappingURL=input-field.d.ts.map
|
|
@@ -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,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
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;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;CACzB,CAAC,CACL,CAAC;AAEF,eAAO,MAAM,aAAa,iEAA0E,aAAa,4CA6ChH,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,OAAO,GAAG,QAAQ,GAAG,UAAU,IAAI,gBAAgB,CACrF,OAAO,CACH,QAAQ,CACJ,aAAa,EACb;IACI,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,KAAK,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,KAAK,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,EAAE,KAAK,CAAC;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"}
|
|
@@ -2,13 +2,15 @@
|
|
|
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 { forwardRef, Fragment } from "react";
|
|
5
|
-
import { useTranslations } from "../../hooks/use-components-provider";
|
|
5
|
+
import { useTranslations, useTweaks } 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-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] }));
|
|
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, }, ref) => {
|
|
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
|
+
const tweaks = useTweaks();
|
|
11
|
+
const reportStatusDefault = reportStatus !== undefined ? reportStatus : tweaks.inputIconFeedback;
|
|
10
12
|
const ID = id ?? name;
|
|
11
13
|
const translation = useTranslations();
|
|
12
14
|
const optionalText = _optionalText ?? translation.inputOptionalLabel;
|
|
13
|
-
return (_jsxs("fieldset", { ref: ref, form: form, disabled: disabled, "data-error": !!error, "aria-disabled": disabled, "data-component": componentName, "data-interactive": !!interactive, className: css("group grid min-h-0 min-w-0 grid-cols-1 items-baseline", container), children: [_jsxs("label", { form: form, htmlFor: ID, className: "inline-flex cursor-text flex-row flex-wrap justify-between gap-1 text-sm transition-colors empty:hidden group-disabled:cursor-not-allowed group-error:text-danger", children: [_jsx(InputFeedback, { info: info, hideLeft: hideLeft, reportStatus:
|
|
15
|
+
return (_jsxs("fieldset", { ref: ref, form: form, disabled: disabled, "data-error": !!error, "aria-disabled": disabled, "data-component": componentName, "data-interactive": !!interactive, className: css("group grid min-h-0 min-w-0 grid-cols-1 items-baseline", container), children: [_jsxs("label", { form: form, htmlFor: ID, className: "inline-flex cursor-text flex-row flex-wrap justify-between gap-1 text-sm transition-colors empty:hidden group-disabled:cursor-not-allowed group-error:text-danger", children: [_jsx(InputFeedback, { info: info, hideLeft: hideLeft, reportStatus: reportStatusDefault, title: title, placeholder: placeholder, children: optionalText || rightLabel ? (_jsxs(Fragment, { children: [!required ? (_jsx("span", { "aria-disabled": disabled, className: "text-opacity-70 aria-disabled:text-disabled", children: optionalText })) : null, rightLabel ? _jsx(Fragment, { children: rightLabel }) : null] })) : null }), _jsxs("div", { className: `group relative flex w-full flex-row flex-nowrap items-center gap-x-2 gap-y-1 rounded-md border border-input-border bg-transparent transition-colors group-hover:border-primary group-disabled:border-disabled group-error:border-danger ${labelClassName}`, children: [left ? _jsx("span", { className: "flex flex-nowrap gap-1 whitespace-nowrap pl-2", children: left }) : null, children, right ? _jsx("span", { className: "flex flex-nowrap gap-2 whitespace-nowrap pr-2", children: right }) : null] })] }), _jsx("p", { className: "mt-input-gap hidden flex-shrink-0 flex-grow-0 whitespace-pre-wrap text-wrap text-xs empty:mt-0 empty:hidden group-has-[input:not(:focus):invalid[data-initialized=true]]:inline-block group-error:inline-block group-error:text-danger", children: error }), _jsx("p", { className: "mt-input-gap text-xs empty:mt-0 empty:hidden group-has-[input:not(:focus):valid[data-initialized=true]]:block group-assert:block group-error:hidden", children: feedback })] }));
|
|
14
16
|
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Label, Override } from "../../types";
|
|
3
|
+
import { InputFieldProps } from "./input-field";
|
|
4
|
+
import { type OptionProps } from "./select";
|
|
5
|
+
export type OnChangeMultiCombobox = (e: Override<React.ChangeEvent<HTMLInputElement>, {
|
|
6
|
+
target: EventTarget & Override<HTMLInputElement, {
|
|
7
|
+
value: string[];
|
|
8
|
+
}>;
|
|
9
|
+
}>) => void;
|
|
10
|
+
export type MultiComboboxItemProps = OptionProps & {
|
|
11
|
+
Render?: React.FC<OptionProps>;
|
|
12
|
+
};
|
|
13
|
+
export type MultiComboboxProps = Override<InputFieldProps<"input">, {
|
|
14
|
+
title?: string;
|
|
15
|
+
value?: string[];
|
|
16
|
+
emptyMessage?: Label;
|
|
17
|
+
selectedLabel?: string;
|
|
18
|
+
defaultValue?: string[];
|
|
19
|
+
dynamicOption?: boolean;
|
|
20
|
+
onChange?: OnChangeMultiCombobox;
|
|
21
|
+
options: MultiComboboxItemProps[];
|
|
22
|
+
}>;
|
|
23
|
+
export declare const MultiCombobox: React.ForwardRefExoticComponent<Omit<MultiComboboxProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
24
|
+
//# sourceMappingURL=multi-combobox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-combobox.d.ts","sourceRoot":"","sources":["../../../../src/components/form/multi-combobox.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAA6F,MAAM,OAAO,CAAC;AAOlH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,MAAM,qBAAqB,GAAG,CAChC,CAAC,EAAE,QAAQ,CACP,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,EACnC;IACI,MAAM,EAAE,WAAW,GACf,QAAQ,CACJ,gBAAgB,EAChB;QACI,KAAK,EAAE,MAAM,EAAE,CAAC;KACnB,CACJ,CAAC;CACT,CACJ,KACA,IAAI,CAAC;AAEV,MAAM,MAAM,sBAAsB,GAAG,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC;AAEtF,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CACrC,eAAe,CAAC,OAAO,CAAC,EACxB;IACI,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,OAAO,EAAE,sBAAsB,EAAE,CAAC;CACrC,CACJ,CAAC;AA4DF,eAAO,MAAM,aAAa,0GAuWzB,CAAC"}
|