@g4rcez/components 0.0.69 → 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.
Files changed (55) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/index.js +83 -48
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +9685 -9139
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/index.umd.js +83 -48
  7. package/dist/index.umd.js.map +1 -1
  8. package/dist/preset/src/styles/dark.d.ts.map +1 -1
  9. package/dist/preset/src/styles/dark.js +2 -0
  10. package/dist/preset/src/styles/light.d.ts.map +1 -1
  11. package/dist/preset/src/styles/light.js +2 -0
  12. package/dist/preset/src/styles/theme.types.d.ts +1 -0
  13. package/dist/preset/src/styles/theme.types.d.ts.map +1 -1
  14. package/dist/src/components/core/button.d.ts +1 -1
  15. package/dist/src/components/core/button.js +13 -13
  16. package/dist/src/components/core/tag.d.ts +2 -2
  17. package/dist/src/components/display/alert.d.ts +1 -1
  18. package/dist/src/components/display/calendar.d.ts.map +1 -1
  19. package/dist/src/components/display/calendar.js +5 -6
  20. package/dist/src/components/display/notifications.d.ts +1 -1
  21. package/dist/src/components/floating/modal.d.ts.map +1 -1
  22. package/dist/src/components/floating/modal.js +2 -1
  23. package/dist/src/components/form/autocomplete.d.ts +1 -7
  24. package/dist/src/components/form/autocomplete.d.ts.map +1 -1
  25. package/dist/src/components/form/autocomplete.js +77 -27
  26. package/dist/src/components/form/free-text.d.ts.map +1 -1
  27. package/dist/src/components/form/free-text.js +2 -2
  28. package/dist/src/components/form/input-field.d.ts +5 -5
  29. package/dist/src/components/form/input-field.d.ts.map +1 -1
  30. package/dist/src/components/form/input-field.js +5 -3
  31. package/dist/src/components/form/multi-combobox.d.ts +24 -0
  32. package/dist/src/components/form/multi-combobox.d.ts.map +1 -0
  33. package/dist/src/components/form/{virtual-autocomplete.js → multi-combobox.js} +92 -68
  34. package/dist/src/components/form/select.d.ts.map +1 -1
  35. package/dist/src/components/form/select.js +1 -1
  36. package/dist/src/components/index.d.ts +1 -1
  37. package/dist/src/components/index.d.ts.map +1 -1
  38. package/dist/src/components/index.js +1 -1
  39. package/dist/src/components/table/thead.d.ts.map +1 -1
  40. package/dist/src/components/table/thead.js +1 -1
  41. package/dist/src/hooks/use-components-provider.d.ts +10 -1
  42. package/dist/src/hooks/use-components-provider.d.ts.map +1 -1
  43. package/dist/src/hooks/use-components-provider.js +26 -7
  44. package/dist/src/lib/dict.d.ts +9 -0
  45. package/dist/src/lib/dict.d.ts.map +1 -0
  46. package/dist/src/lib/dict.js +28 -0
  47. package/dist/src/styles/dark.d.ts.map +1 -1
  48. package/dist/src/styles/dark.js +2 -0
  49. package/dist/src/styles/light.d.ts.map +1 -1
  50. package/dist/src/styles/light.js +2 -0
  51. package/dist/src/styles/theme.types.d.ts +1 -0
  52. package/dist/src/styles/theme.types.d.ts.map +1 -1
  53. package/package.json +2 -2
  54. package/dist/src/components/form/virtual-autocomplete.d.ts +0 -15
  55. 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,YAwLxB,CAAC"}
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,YAwLzB,CAAC"}
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
  },
@@ -9,6 +9,7 @@ type BasicTokens = {
9
9
  foreground: string;
10
10
  };
11
11
  type ComponentToken = {
12
+ hover: string;
12
13
  border: string;
13
14
  overlay: string;
14
15
  background: string;
@@ -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,GAA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,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC;CACnF,CAAC"}
@@ -5,7 +5,7 @@ import { PolymorphicProps } from "./polymorph";
5
5
  declare const buttonVariants: (props?: ({
6
6
  size?: "big" | "small" | "min" | "default" | "icon" | null | undefined;
7
7
  rounded?: "circle" | "default" | "rough" | "squared" | null | undefined;
8
- theme?: "main" | "disabled" | "loading" | "raw" | "danger" | "info" | "neutral" | "primary" | "secondary" | "success" | "warn" | "ghost-danger" | "ghost-warn" | "ghost-success" | "ghost-primary" | "ghost-secondary" | "ghost-info" | null | undefined;
8
+ theme?: "main" | "disabled" | "loading" | "raw" | "info" | "warn" | "danger" | "neutral" | "primary" | "success" | "secondary" | "ghost-info" | "ghost-warn" | "ghost-danger" | "ghost-primary" | "ghost-success" | "ghost-secondary" | null | undefined;
9
9
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
10
10
  export type ButtonProps<T extends React.ElementType = "button"> = PolymorphicProps<VariantProps<typeof buttonVariants> & Partial<{
11
11
  icon: Label;
@@ -3,39 +3,39 @@ import { cva } from "class-variance-authority";
3
3
  import { forwardRef } from "react";
4
4
  import { css } from "../../lib/dom";
5
5
  import { Polymorph } from "./polymorph";
6
- const buttonVariants = cva("relative overflow-hidden inline-flex duration-500 enabled:hover:bg-opacity-70 data-[loading=true]:opacity-30 data-[loading=true]:animate-pulse gap-1.5 items-center justify-center align-middle cursor-pointer whitespace-nowrap font-medium transition-colors ease-in disabled:cursor-not-allowed disabled:bg-opacity-40 disabled:text-opacity-80 focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring ease-normal", {
6
+ const buttonVariants = cva("relative overflow-hidden inline-flex duration-500 enabled:hover:bg-opacity-70 enabled:focus:bg-opacity-70 data-[loading=true]:opacity-30 data-[loading=true]:animate-pulse gap-1.5 items-center justify-center align-middle cursor-pointer whitespace-nowrap font-medium transition-colors ease-in disabled:cursor-not-allowed disabled:bg-opacity-40 disabled:text-opacity-80 focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring ease-normal", {
7
7
  variants: {
8
8
  size: {
9
- default: "h-10 px-4 py-2",
9
+ icon: "p-1",
10
10
  big: "h-12 px-6 py-4",
11
- small: "h-8 px-4 py-2 text-sm",
11
+ default: "h-10 px-4 py-2",
12
12
  min: "h-7 px-3 py-1 text-sm",
13
- icon: "p-1",
13
+ small: "h-8 px-4 py-2 text-sm",
14
14
  },
15
15
  rounded: {
16
16
  rough: "rounded-sm",
17
- default: "rounded-button",
18
17
  squared: "rounded-none",
18
+ default: "rounded-button",
19
19
  circle: "rounded-full aspect-square",
20
20
  },
21
21
  theme: {
22
22
  raw: "",
23
- danger: "bg-button-danger-bg text-button-danger-text",
23
+ main: "bg-primary text-primary-foreground",
24
24
  disabled: "bg-disabled duration-700 opacity-70",
25
25
  info: "bg-button-info-bg text-button-info-text",
26
- loading: "animate-pulse bg-disabled duration-700 opacity-70",
27
- main: "bg-primary text-primary-foreground",
26
+ warn: "bg-button-warn-bg text-button-warn-text",
27
+ danger: "bg-button-danger-bg text-button-danger-text",
28
28
  neutral: "bg-transparent border-2 border-card-border",
29
29
  primary: "bg-button-primary-bg text-button-primary-text",
30
- secondary: "bg-button-secondary-bg text-button-secondary-text",
31
30
  success: "bg-button-success-bg text-button-success-text",
32
- warn: "bg-button-warn-bg text-button-warn-text",
33
- "ghost-danger": "bg-transparent hover:bg-danger/20 border border-danger text-danger",
31
+ loading: "animate-pulse bg-disabled duration-700 opacity-70",
32
+ secondary: "bg-button-secondary-bg text-button-secondary-text",
33
+ "ghost-info": "bg-transparent hover:bg-info/20 border border-info text-info",
34
34
  "ghost-warn": "bg-transparent hover:bg-warn/20 border border-warn text-warn",
35
- "ghost-success": "bg-transparent hover:bg-success/20 border border-success text-success",
35
+ "ghost-danger": "bg-transparent hover:bg-danger/20 border border-danger text-danger",
36
36
  "ghost-primary": "bg-transparent hover:bg-primary/20 border border-primary text-primary",
37
+ "ghost-success": "bg-transparent hover:bg-success/20 border border-success text-success",
37
38
  "ghost-secondary": "bg-transparent hover:bg-secondary/20 border border-secondary text-secondary",
38
- "ghost-info": "bg-transparent hover:bg-info/20 border border-info text-info",
39
39
  },
40
40
  },
41
41
  defaultVariants: { theme: "main", size: "default", rounded: "default" },
@@ -3,11 +3,11 @@ import React from "react";
3
3
  import { Label } from "../../types";
4
4
  import { PolymorphicProps } from "./polymorph";
5
5
  declare const indicatorVariant: (props?: ({
6
- theme?: "main" | "danger" | "info" | "secondary" | "success" | "warn" | null | undefined;
6
+ theme?: "main" | "info" | "warn" | "danger" | "success" | "secondary" | null | undefined;
7
7
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
8
8
  declare const tagVariants: (props?: ({
9
9
  size?: "big" | "small" | "default" | "icon" | null | undefined;
10
- theme?: "disabled" | "loading" | "danger" | "info" | "neutral" | "primary" | "secondary" | "success" | "warn" | null | undefined;
10
+ theme?: "disabled" | "loading" | "info" | "warn" | "danger" | "neutral" | "primary" | "success" | "secondary" | null | undefined;
11
11
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
12
12
  export type TagProps<T extends React.ElementType = "span"> = PolymorphicProps<VariantProps<typeof tagVariants> & Partial<{
13
13
  icon: Label;
@@ -7,7 +7,7 @@ type CollapseProps = HTMLMotionProps<"section"> & {
7
7
  };
8
8
  export declare const Collapse: (props: PropsWithChildren<CollapseProps>) => import("react/jsx-runtime").JSX.Element;
9
9
  declare const alertVariants: (props?: ({
10
- theme?: "danger" | "info" | "neutral" | "primary" | "secondary" | "success" | "warn" | null | undefined;
10
+ theme?: "info" | "warn" | "danger" | "neutral" | "primary" | "success" | "secondary" | null | undefined;
11
11
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
12
12
  export type AlertProps<T extends React.ElementType = "div"> = PolymorphicProps<VariantProps<typeof alertVariants> & Partial<{
13
13
  Icon: React.ReactElement;
@@ -1 +1 @@
1
- {"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../../src/components/display/calendar.tsx"],"names":[],"mappings":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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;CAC1C,GAAG,CAAC,CAAC,SAAS,MAAM,GACjB;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,GACtC,CAAC,SAAS,OAAO,GACjB;IACA,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,aAAa,CAAC;CACzB,GACC,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,CACrF,CAAC;AA0HF,eAAO,MAAM,QAAQ,mKAclB,aAAa,4CA+Of,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-components-provider";
11
+ import { useLocale, useTranslations } from "../../hooks/use-components-provider";
12
12
  import { css } from "../../lib/dom";
13
13
  import { splitInto, uuid } from "../../lib/fns";
14
14
  const transition = { type: "spring", bounce: 0.3, duration: 0.6 };
@@ -75,6 +75,7 @@ const CalendarBody = (props) => {
75
75
  export const Calendar = ({ RenderOnDay, changeOnlyOnClick = false, labelRange, disabledDate, locale, markToday = true, onChangeMonth, onChangeYear, rangeMode = false, onChange, styles, markRange = true, ...props }) => {
76
76
  const id = useRef(uuid());
77
77
  const translations = useTranslations();
78
+ const currentLocale = useLocale(locale);
78
79
  const root = useRef(null);
79
80
  const { date, range } = props;
80
81
  const providedDate = date || new Date();
@@ -85,7 +86,7 @@ export const Calendar = ({ RenderOnDay, changeOnlyOnClick = false, labelRange, d
85
86
  year: formatYear(providedDate),
86
87
  direction: undefined,
87
88
  range: { from: range?.from, to: range?.to },
88
- months: getOptionsMonth(id.current, providedDate, locale),
89
+ months: getOptionsMonth(id.current, providedDate, currentLocale),
89
90
  selectMode: (rangeMode ? "from" : undefined),
90
91
  week: eachDayOfInterval({ start: startOfWeek(providedDate), end: endOfWeek(providedDate) }),
91
92
  }, (get) => ({
@@ -190,7 +191,7 @@ export const Calendar = ({ RenderOnDay, changeOnlyOnClick = false, labelRange, d
190
191
  });
191
192
  const zip = splitInto(createDays(state.date), 7);
192
193
  const currentAsString = state.date.toISOString();
193
- const monthString = formatMonth(state.date, locale);
194
+ const monthString = formatMonth(state.date, currentLocale);
194
195
  useEffect(() => {
195
196
  if (!changeOnlyOnClick)
196
197
  onChange?.(state.date);
@@ -208,7 +209,5 @@ export const Calendar = ({ RenderOnDay, changeOnlyOnClick = false, labelRange, d
208
209
  onChangeYear?.(new Date(value));
209
210
  defer(value);
210
211
  };
211
- 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, "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", { style: { width: `${monthString.length}ch` }, value: monthString, onChange: dispatch.onChangeMonth, className: "w-fit cursor-pointer appearance-none bg-transparent capitalize proportional-nums hover:text-primary", children: state.months }), _jsx(TheMaskInput, { mask: "int", value: state.year, maxLength: 4, placeholder: "YYYY", 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, "data-focustrap": "next", variants: removeImmediately, className: "z-calendar rounded-full p-1.5 hover:bg-primary", onClick: dispatch.nextMonth, children: _jsx(ChevronRightIcon, { className: "h-4 w-4" }) }), _jsx("div", { className: "absolute inset-0", style: {
212
- backgroundImage: "linear-gradient(to right, hsla(var(--card-background)) 15%, transparent 30%, transparent 70%, hsla(var(--card-background)) 85%)",
213
- } })] }), _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(locale, { weekday: "short" }) }, dayOfWeek.toString()))) }) }), _jsx(CalendarBody, { stateRange: state.range, stateDate: state.date, disabledDate: disabledDate, markRange: markRange, zip: zip, range: range, styles: styles, dispatch: dispatch, date: date || null, markToday: markToday, rangeMode: rangeMode, labelRange: labelRange, RenderOnDay: RenderOnDay, direction: state.direction, 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 }) })] }) }));
214
213
  };
@@ -2,7 +2,7 @@ import { type VariantProps } from "class-variance-authority";
2
2
  import { type PropsWithChildren } from "react";
3
3
  import { Label } from "../../types";
4
4
  declare const variants: (props?: ({
5
- theme?: "default" | "danger" | "info" | "success" | "warn" | null | undefined;
5
+ theme?: "default" | "info" | "warn" | "danger" | "success" | null | undefined;
6
6
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
7
7
  type NotificationOptions = Partial<{
8
8
  title: Label;
@@ -1 +1 @@
1
- {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../../src/components/floating/modal.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,EAAY,iBAAiB,EAAS,MAAM,OAAO,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AA2DpC,MAAM,MAAM,UAAU,GAAG;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,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+1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { RemoveScroll } from "react-remove-scroll";
3
4
  import { FloatingFocusManager, FloatingOverlay, FloatingPortal, useClick, useDismiss, useFloating, useInteractions, useRole, } from "@floating-ui/react";
4
5
  import { Slot } from "@radix-ui/react-slot";
5
6
  import { cva } from "class-variance-authority";
@@ -96,5 +97,5 @@ export const Modal = ({ type: _type = "dialog", resizer = true, overlayClickClos
96
97
  const onClose = () => props.onChange(false);
97
98
  return (_jsxs(Fragment, { children: [props.trigger ? (_jsx(Fragment, { children: props.asChild ? (_jsx(Slot, { ref: refs.setReference, ...getReferenceProps({
98
99
  layoutId: props.layoutId,
99
- }), children: Trigger })) : (_jsx(motion.button, { ref: refs.setReference, ...getReferenceProps(), layoutId: props.layoutId, type: "button", children: Trigger })) })) : null, _jsx(FloatingPortal, { children: _jsx(AnimatePresence, { presenceAffectsLayout: true, children: props.open ? (_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 }) })] }));
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 }) })] }));
100
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":"AAgBA,OAAO,KAAoF,MAAM,OAAO,CAAC;AAKzG,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,uBAAuB,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC,GAAG;IACrF,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,MAAM,EAAE,qBAAqB,CAAC;CACjC,CAAC;AAIF,eAAO,MAAM,MAAM,4GAiCjB,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG;IACtE,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;AAaF,eAAO,MAAM,YAAY,yGAkSxB,CAAC"}
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 { CheckIcon, ChevronDown } from "lucide-react";
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: `${Math.min(250, a.availableHeight)}px`,
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: _jsx("ul", { ...getFloatingProps({
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 : 16),
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 overflow-auto overflow-y-auto overscroll-contain rounded-b-lg rounded-t-lg border border-floating-border bg-floating-background p-0 text-foreground shadow-floating", children: _jsxs(AnimatePresence, { children: [list.map((option, i) => {
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
- return (_jsx(Option, { ...getItemProps({
183
- onClick: () => onSelect(option, i),
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
- selected: index === i,
186
- }), option: option, active: active, selected: index === i }, `${option.value}-option`));
187
- }), 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] }) }) })) : null })] }));
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,EAAY,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAA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,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(({ type = "text", feedback = null, info, labelClassName, next, interactive, rightLabel, optionalText, container, hideLeft = false, right, left, error, ...props }, ref) => {
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, componentName: elementName, info: info, container: container, error: error, feedback: feedback, hideLeft: hideLeft, left: left, optionalText: optionalText, right: right, rightLabel: rightLabel, interactive: interactive, form: props.form, id: props.name || props.id, name: props.name, labelClassName: labelClassName, title: props.title, placeholder: props.placeholder, required: props.required, disabled: props.disabled, 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) }) }));
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
- }>, T>;
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;AAGvE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD,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,CAAC;IACJ,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,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AE,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: true, 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 })] }));
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
  });