@cryptlex/web-components 5.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/data-table/data-table-filter.es.js +46 -44
- package/dist/components/data-table/data-table-filter.es.js.map +1 -1
- package/dist/components/data-table/data-table.es.js +160 -159
- package/dist/components/data-table/data-table.es.js.map +1 -1
- package/dist/components/data-table/table-commons.es.js +51 -217
- package/dist/components/data-table/table-commons.es.js.map +1 -1
- package/dist/components/inputs/date-picker.es.js +61 -41
- package/dist/components/inputs/date-picker.es.js.map +1 -1
- package/dist/components/inputs/datefield.es.js +9 -9
- package/dist/components/inputs/datefield.es.js.map +1 -1
- package/dist/components/inputs/field.es.js +36 -35
- package/dist/components/inputs/field.es.js.map +1 -1
- package/dist/components/inputs/id-search.es.js +36 -33
- package/dist/components/inputs/id-search.es.js.map +1 -1
- package/dist/components/inputs/multi-select.es.js +32 -39
- package/dist/components/inputs/multi-select.es.js.map +1 -1
- package/dist/components/inputs/{country-select.es.js → select-options.es.js} +26 -24
- package/dist/components/inputs/select-options.es.js.map +1 -0
- package/dist/components/inputs/select.es.js +46 -45
- package/dist/components/inputs/select.es.js.map +1 -1
- package/dist/components/ui/button.es.js +22 -24
- package/dist/components/ui/button.es.js.map +1 -1
- package/dist/components/ui/menu.es.js +44 -43
- package/dist/components/ui/menu.es.js.map +1 -1
- package/dist/components/ui/popover.es.js +1 -1
- package/dist/components/ui/popover.es.js.map +1 -1
- package/dist/index.es.d.ts +44 -54
- package/dist/index.es.js +206 -207
- package/dist/node_modules/.pnpm/@internationalized_date@3.8.2/node_modules/@internationalized/date/dist/CalendarDate.es.js +13 -13
- package/dist/node_modules/.pnpm/@internationalized_date@3.8.2/node_modules/@internationalized/date/dist/conversion.es.js +5 -5
- package/dist/node_modules/.pnpm/@internationalized_date@3.8.2/node_modules/@internationalized/date/dist/string.es.js +48 -39
- package/dist/node_modules/.pnpm/@internationalized_date@3.8.2/node_modules/@internationalized/date/dist/string.es.js.map +1 -1
- package/dist/utils/form-hook.es.js +10 -14
- package/dist/utils/form-hook.es.js.map +1 -1
- package/dist/utils/primitives.es.js.map +1 -1
- package/dist/utils/resource-names.es.js +182 -0
- package/dist/utils/resource-names.es.js.map +1 -0
- package/package.json +1 -1
- package/dist/components/inputs/country-select.es.js.map +0 -1
- package/dist/components/inputs/license-type-select.es.js +0 -31
- package/dist/components/inputs/license-type-select.es.js.map +0 -1
|
@@ -1,107 +1,127 @@
|
|
|
1
1
|
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { CalendarIcon as
|
|
2
|
+
import { CalendarIcon as f } from "lucide-react";
|
|
3
3
|
import { composeRenderProps as d } from "../../node_modules/.pnpm/react-aria-components@1.11.0_react-dom@19.1.0_react@19.1.0/node_modules/react-aria-components/dist/utils.es.js";
|
|
4
|
-
import { DatePicker as
|
|
5
|
-
import { Dialog as
|
|
6
|
-
import { DateInput as
|
|
7
|
-
import { FormField as
|
|
8
|
-
import { Calendar as
|
|
9
|
-
import {
|
|
4
|
+
import { DatePicker as x, DateRangePicker as $ } from "../../node_modules/.pnpm/react-aria-components@1.11.0_react-dom@19.1.0_react@19.1.0/node_modules/react-aria-components/dist/DatePicker.es.js";
|
|
5
|
+
import { Dialog as b } from "../../node_modules/.pnpm/react-aria-components@1.11.0_react-dom@19.1.0_react@19.1.0/node_modules/react-aria-components/dist/Dialog.es.js";
|
|
6
|
+
import { DateInput as c } from "./datefield.es.js";
|
|
7
|
+
import { FormField as p, FieldGroup as u } from "./field.es.js";
|
|
8
|
+
import { Calendar as v, RangeCalendar as N } from "../ui/calendar.es.js";
|
|
9
|
+
import { getLocalTimeZone as C } from "../../node_modules/.pnpm/@internationalized_date@3.8.2/node_modules/@internationalized/date/dist/queries.es.js";
|
|
10
|
+
import { parseAbsolute as D } from "../../node_modules/.pnpm/@internationalized_date@3.8.2/node_modules/@internationalized/date/dist/string.es.js";
|
|
11
|
+
import { Popover as P } from "../ui/popover.es.js";
|
|
10
12
|
import { Button as h } from "../ui/button.es.js";
|
|
13
|
+
import { useFieldContext as k } from "../../utils/form-context.es.js";
|
|
14
|
+
import { getFieldErrorMessage as m } from "../../utils/form-hook.es.js";
|
|
11
15
|
import { cn as n } from "../../utils/primitives.es.js";
|
|
12
|
-
const
|
|
13
|
-
className:
|
|
14
|
-
popoverClassName:
|
|
16
|
+
const g = ({
|
|
17
|
+
className: a,
|
|
18
|
+
popoverClassName: r,
|
|
15
19
|
...o
|
|
16
20
|
}) => /* @__PURE__ */ e(
|
|
17
|
-
|
|
21
|
+
P,
|
|
18
22
|
{
|
|
19
23
|
className: d(
|
|
20
|
-
|
|
24
|
+
r,
|
|
21
25
|
(t) => n("w-auto p-3", t)
|
|
22
26
|
),
|
|
23
27
|
children: /* @__PURE__ */ e(
|
|
24
|
-
|
|
28
|
+
b,
|
|
25
29
|
{
|
|
26
30
|
className: n(
|
|
27
|
-
"flex w-full flex-col gap-y-
|
|
28
|
-
|
|
31
|
+
"flex w-full flex-col gap-y-2 outline-none sm:flex-row sm:gap-x-icon sm:gap-y-0",
|
|
32
|
+
a
|
|
29
33
|
),
|
|
30
34
|
...o
|
|
31
35
|
}
|
|
32
36
|
)
|
|
33
37
|
}
|
|
34
38
|
);
|
|
35
|
-
function
|
|
36
|
-
label:
|
|
37
|
-
description:
|
|
39
|
+
function F({
|
|
40
|
+
label: a,
|
|
41
|
+
description: r,
|
|
38
42
|
errorMessage: o,
|
|
39
43
|
className: t,
|
|
40
|
-
...
|
|
44
|
+
...l
|
|
41
45
|
}) {
|
|
42
46
|
return /* @__PURE__ */ i(
|
|
43
|
-
|
|
47
|
+
x,
|
|
44
48
|
{
|
|
45
49
|
className: d(
|
|
46
50
|
t,
|
|
47
|
-
(
|
|
51
|
+
(s) => n("group flex flex-col gap-2", s)
|
|
48
52
|
),
|
|
49
|
-
...
|
|
53
|
+
...l,
|
|
50
54
|
children: [
|
|
51
|
-
/* @__PURE__ */ e(
|
|
52
|
-
/* @__PURE__ */ e(
|
|
55
|
+
/* @__PURE__ */ e(p, { label: a, description: r, errorMessage: o, children: /* @__PURE__ */ i(u, { "aria-label": a, children: [
|
|
56
|
+
/* @__PURE__ */ e(c, { className: "flex-1", variant: "ghost" }),
|
|
53
57
|
/* @__PURE__ */ e(
|
|
54
58
|
h,
|
|
55
59
|
{
|
|
56
60
|
variant: "ghost",
|
|
57
61
|
size: "icon",
|
|
58
|
-
className: "
|
|
59
|
-
children: /* @__PURE__ */ e(
|
|
62
|
+
className: "-me-2 ms-2",
|
|
63
|
+
children: /* @__PURE__ */ e(f, { "aria-hidden": !0 })
|
|
60
64
|
}
|
|
61
65
|
)
|
|
62
66
|
] }) }),
|
|
63
|
-
/* @__PURE__ */ e(
|
|
67
|
+
/* @__PURE__ */ e(g, { children: /* @__PURE__ */ e(v, {}) })
|
|
64
68
|
]
|
|
65
69
|
}
|
|
66
70
|
);
|
|
67
71
|
}
|
|
68
|
-
function
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
function q({ ...a }) {
|
|
73
|
+
const r = k();
|
|
74
|
+
return /* @__PURE__ */ e(
|
|
75
|
+
F,
|
|
76
|
+
{
|
|
77
|
+
hideTimeZone: !0,
|
|
78
|
+
value: r.state.value ? D(r.state.value, C()) : null,
|
|
79
|
+
onChange: (o) => o ? r.handleChange(o.toAbsoluteString()) : r.handleChange(null),
|
|
80
|
+
onBlur: r.handleBlur,
|
|
81
|
+
isInvalid: !!m(r),
|
|
82
|
+
errorMessage: m(r),
|
|
83
|
+
...a
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
function H({
|
|
88
|
+
label: a,
|
|
89
|
+
description: r,
|
|
71
90
|
errorMessage: o,
|
|
72
91
|
className: t,
|
|
73
|
-
...
|
|
92
|
+
...l
|
|
74
93
|
}) {
|
|
75
94
|
return /* @__PURE__ */ i(
|
|
76
|
-
|
|
95
|
+
$,
|
|
77
96
|
{
|
|
78
97
|
className: d(
|
|
79
98
|
t,
|
|
80
|
-
(
|
|
99
|
+
(s) => n("group flex flex-col gap-2", s)
|
|
81
100
|
),
|
|
82
|
-
...
|
|
101
|
+
...l,
|
|
83
102
|
children: [
|
|
84
|
-
/* @__PURE__ */ e(
|
|
85
|
-
/* @__PURE__ */ e(
|
|
103
|
+
/* @__PURE__ */ e(p, { label: a, errorMessage: o, description: r, children: /* @__PURE__ */ i(u, { children: [
|
|
104
|
+
/* @__PURE__ */ e(c, { variant: "ghost", slot: "start" }),
|
|
86
105
|
/* @__PURE__ */ e("span", { "aria-hidden": !0, className: "px-2 text-sm text-muted-foreground", children: "-" }),
|
|
87
|
-
/* @__PURE__ */ e(
|
|
106
|
+
/* @__PURE__ */ e(c, { className: "flex-1", variant: "ghost", slot: "end" }),
|
|
88
107
|
/* @__PURE__ */ e(
|
|
89
108
|
h,
|
|
90
109
|
{
|
|
91
110
|
variant: "ghost",
|
|
92
111
|
size: "icon",
|
|
93
112
|
className: "mr-1 data-[focus-visible]:ring-offset-0",
|
|
94
|
-
children: /* @__PURE__ */ e(
|
|
113
|
+
children: /* @__PURE__ */ e(f, { "aria-hidden": !0 })
|
|
95
114
|
}
|
|
96
115
|
)
|
|
97
116
|
] }) }),
|
|
98
|
-
/* @__PURE__ */ e(
|
|
117
|
+
/* @__PURE__ */ e(g, { children: /* @__PURE__ */ e(N, {}) })
|
|
99
118
|
]
|
|
100
119
|
}
|
|
101
120
|
);
|
|
102
121
|
}
|
|
103
122
|
export {
|
|
104
|
-
|
|
105
|
-
|
|
123
|
+
F as DatePicker,
|
|
124
|
+
H as DateRangePicker,
|
|
125
|
+
q as TfDatePicker
|
|
106
126
|
};
|
|
107
127
|
//# sourceMappingURL=date-picker.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.es.js","sources":["../../../lib/components/inputs/date-picker.tsx"],"sourcesContent":["import { CalendarIcon } from \"lucide-react\"\nimport {\n DatePicker as AriaDatePicker,\n DatePickerProps as AriaDatePickerProps,\n DateRangePicker as AriaDateRangePicker,\n DateRangePickerProps as AriaDateRangePickerProps,\n DateValue as AriaDateValue,\n Dialog as AriaDialog,\n DialogProps as AriaDialogProps,\n PopoverProps as AriaPopoverProps,\n composeRenderProps\n} from \"react-aria-components\"\n\nimport { DateInput } from \"@/components/inputs/datefield\"\nimport { FieldGroup, FormField, type FormFieldProps } from \"@/components/inputs/field\"\nimport { Button, Popover } from \"@/components/ui\"\nimport { Calendar, RangeCalendar } from \"@/components/ui/calendar\"\nimport { cn } from \"@/utils/index\"\n\nconst DatePickerContent = ({\n className,\n popoverClassName,\n ...props\n}: AriaDialogProps & { popoverClassName?: AriaPopoverProps[\"className\"] }) => (\n <Popover\n className={composeRenderProps(popoverClassName, (className) =>\n cn(\"w-auto p-3\", className)\n )}\n >\n <AriaDialog\n className={cn(\n \"flex w-full flex-col gap-y-
|
|
1
|
+
{"version":3,"file":"date-picker.es.js","sources":["../../../lib/components/inputs/date-picker.tsx"],"sourcesContent":["import { CalendarIcon } from \"lucide-react\"\nimport {\n DatePicker as AriaDatePicker,\n DatePickerProps as AriaDatePickerProps,\n DateRangePicker as AriaDateRangePicker,\n DateRangePickerProps as AriaDateRangePickerProps,\n DateValue as AriaDateValue,\n Dialog as AriaDialog,\n DialogProps as AriaDialogProps,\n PopoverProps as AriaPopoverProps,\n composeRenderProps\n} from \"react-aria-components\"\n\nimport { DateInput } from \"@/components/inputs/datefield\"\nimport { FieldGroup, FormField, type FormFieldProps } from \"@/components/inputs/field\"\nimport { Button, Popover } from \"@/components/ui\"\nimport { Calendar, RangeCalendar } from \"@/components/ui/calendar\"\nimport { cn, getFieldErrorMessage, useFieldContext } from \"@/utils/index\"\nimport { getLocalTimeZone, parseAbsolute, type ZonedDateTime } from \"@internationalized/date\"\n\nconst DatePickerContent = ({\n className,\n popoverClassName,\n ...props\n}: AriaDialogProps & { popoverClassName?: AriaPopoverProps[\"className\"] }) => (\n <Popover\n className={composeRenderProps(popoverClassName, (className) =>\n cn(\"w-auto p-3\", className)\n )}\n >\n <AriaDialog\n className={cn(\n \"flex w-full flex-col gap-y-2 outline-none sm:flex-row sm:gap-x-icon sm:gap-y-0\",\n className\n )}\n {...props}\n />\n </Popover>\n)\n\ninterface DatePickerProps<T extends AriaDateValue> extends AriaDatePickerProps<T>, FormFieldProps { }\n\nexport function DatePicker<T extends AriaDateValue>({\n label,\n description,\n errorMessage,\n className,\n ...props\n}: DatePickerProps<T>) {\n return (\n <AriaDatePicker\n className={composeRenderProps(className, (className) =>\n cn(\"group flex flex-col gap-2\", className)\n )}\n {...props}\n >\n <FormField label={label} description={description} errorMessage={errorMessage}>\n <FieldGroup aria-label={label}>\n <DateInput className=\"flex-1\" variant=\"ghost\" />\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className={'-me-2 ms-2'}\n >\n <CalendarIcon aria-hidden />\n </Button>\n </FieldGroup>\n </FormField>\n <DatePickerContent>\n <Calendar />\n </DatePickerContent>\n </AriaDatePicker>\n )\n}\n\nexport function TfDatePicker({ ...props }: Omit<DatePickerProps<ZonedDateTime>, 'value' | 'onChange' | 'onBlur' | 'isInvalid' | 'errorMessage'>) {\n const field = useFieldContext<string | null>();\n return (\n <DatePicker\n hideTimeZone\n value={field.state.value ? parseAbsolute(field.state.value, getLocalTimeZone()) : null}\n onChange={(v) => v ? field.handleChange(v.toAbsoluteString()) : field.handleChange(null)}\n onBlur={field.handleBlur}\n isInvalid={!!getFieldErrorMessage(field)}\n errorMessage={getFieldErrorMessage(field)}\n {...props}\n />)\n}\n\ninterface DateRangePickerProps<T extends AriaDateValue> extends AriaDateRangePickerProps<T>, FormFieldProps { }\nexport function DateRangePicker<T extends AriaDateValue>({\n label,\n description,\n errorMessage,\n className,\n ...props\n}: DateRangePickerProps<T>) {\n return (\n <AriaDateRangePicker\n className={composeRenderProps(className, (className) =>\n cn(\"group flex flex-col gap-2\", className)\n )}\n {...props}\n >\n <FormField label={label} errorMessage={errorMessage} description={description}>\n <FieldGroup>\n <DateInput variant=\"ghost\" slot={\"start\"} />\n <span aria-hidden className=\"px-2 text-sm text-muted-foreground\">\n -\n </span>\n <DateInput className=\"flex-1\" variant=\"ghost\" slot={\"end\"} />\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className=\"mr-1 data-[focus-visible]:ring-offset-0\"\n >\n <CalendarIcon aria-hidden />\n </Button>\n </FieldGroup>\n </FormField>\n <DatePickerContent>\n <RangeCalendar />\n </DatePickerContent>\n </AriaDateRangePicker>\n )\n}\n\n"],"names":["DatePickerContent","className","popoverClassName","props","jsx","Popover","composeRenderProps","cn","AriaDialog","DatePicker","label","description","errorMessage","jsxs","AriaDatePicker","FormField","FieldGroup","DateInput","Button","CalendarIcon","Calendar","TfDatePicker","field","useFieldContext","parseAbsolute","getLocalTimeZone","v","getFieldErrorMessage","DateRangePicker","AriaDateRangePicker","RangeCalendar"],"mappings":";;;;;;;;;;;;;;;AAoBA,MAAMA,IAAoB,CAAC;AAAA,EACzB,WAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,GAAGC;AACL,MACE,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,WAAWC;AAAAA,MAAmBJ;AAAA,MAAkB,CAACD,MAC/CM,EAAG,cAAcN,CAAS;AAAA,IAAA;AAAA,IAG5B,UAAA,gBAAAG;AAAA,MAACI;AAAAA,MAAA;AAAA,QACC,WAAWD;AAAA,UACT;AAAA,UACAN;AAAA,QAAA;AAAA,QAED,GAAGE;AAAA,MAAA;AAAA,IAAA;AAAA,EACN;AACF;AAKK,SAASM,EAAoC;AAAA,EAClD,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAX;AAAA,EACA,GAAGE;AACL,GAAuB;AACrB,SACE,gBAAAU;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,WAAWR;AAAAA,QAAmBL;AAAA,QAAW,CAACA,MACxCM,EAAG,6BAA6BN,CAAS;AAAA,MAAA;AAAA,MAE1C,GAAGE;AAAA,MAEJ,UA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CM,EAAG,6BAA6BN,CAAS;AAAA,MAAA;AAAA,MAE1C,GAAGE;AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAAC,EAACW,GAAA,EAAU,OAAAL,GAAc,cAAAE,GAA4B,aAAAD,GACnD,4BAACK,GAAA,EACC,UAAA;AAAA,UAAA,gBAAAZ,EAACa,GAAA,EAAU,SAAQ,SAAQ,MAAM,SAAS;AAAA,4BACzC,QAAA,EAAK,eAAW,IAAC,WAAU,sCAAqC,UAAA,KAEjE;AAAA,4BACCA,GAAA,EAAU,WAAU,UAAS,SAAQ,SAAQ,MAAM,OAAO;AAAA,UAC3D,gBAAAb;AAAA,YAACc;AAAA,YAAA;AAAA,cACC,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,WAAU;AAAA,cAEV,UAAA,gBAAAd,EAACe,GAAA,EAAa,eAAW,GAAA,CAAC;AAAA,YAAA;AAAA,UAAA;AAAA,QAC5B,EAAA,CACF,EAAA,CACF;AAAA,QACA,gBAAAf,EAACJ,GAAA,EACC,UAAA,gBAAAI,EAAC0B,GAAA,CAAA,CAAc,EAAA,CACjB;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as e } from "react/jsx-runtime";
|
|
3
3
|
import { composeRenderProps as o } from "../../node_modules/.pnpm/react-aria-components@1.11.0_react-dom@19.1.0_react@19.1.0/node_modules/react-aria-components/dist/utils.es.js";
|
|
4
|
-
import { DateSegment as
|
|
5
|
-
import { FormField as f, fieldGroupVariants as
|
|
4
|
+
import { DateSegment as s, DateInput as u, DateField as m, TimeField as p } from "../../node_modules/.pnpm/react-aria-components@1.11.0_react-dom@19.1.0_react@19.1.0/node_modules/react-aria-components/dist/DateField.es.js";
|
|
5
|
+
import { FormField as f, fieldGroupVariants as $ } from "./field.es.js";
|
|
6
6
|
import { cn as i } from "../../utils/primitives.es.js";
|
|
7
|
-
function
|
|
7
|
+
function x({ className: t, ...a }) {
|
|
8
8
|
return /* @__PURE__ */ e(
|
|
9
|
-
|
|
9
|
+
s,
|
|
10
10
|
{
|
|
11
11
|
className: o(
|
|
12
12
|
t,
|
|
13
13
|
(d) => i(
|
|
14
|
-
"
|
|
14
|
+
"inline caret-transparent outline-0",
|
|
15
15
|
/* Placeholder */
|
|
16
16
|
"data-[placeholder]:text-muted-foreground",
|
|
17
17
|
/* Disabled */
|
|
@@ -33,14 +33,14 @@ function l({
|
|
|
33
33
|
...d
|
|
34
34
|
}) {
|
|
35
35
|
return /* @__PURE__ */ e(
|
|
36
|
-
|
|
36
|
+
u,
|
|
37
37
|
{
|
|
38
38
|
className: o(
|
|
39
39
|
t,
|
|
40
|
-
(r) => i(
|
|
40
|
+
(r) => i($({ variant: a }), "text-sm", r)
|
|
41
41
|
),
|
|
42
42
|
...d,
|
|
43
|
-
children: (r) => /* @__PURE__ */ e(
|
|
43
|
+
children: (r) => /* @__PURE__ */ e(x, { segment: r })
|
|
44
44
|
}
|
|
45
45
|
);
|
|
46
46
|
}
|
|
@@ -85,7 +85,7 @@ function N({
|
|
|
85
85
|
export {
|
|
86
86
|
F as DateField,
|
|
87
87
|
l as DateInput,
|
|
88
|
-
|
|
88
|
+
x as DateSegment,
|
|
89
89
|
N as TimeField
|
|
90
90
|
};
|
|
91
91
|
//# sourceMappingURL=datefield.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datefield.es.js","sources":["../../../lib/components/inputs/datefield.tsx"],"sourcesContent":["\"use client\"\n\nimport { VariantProps } from \"class-variance-authority\"\nimport {\n DateField as AriaDateField,\n DateFieldProps as AriaDateFieldProps,\n DateInput as AriaDateInput,\n DateInputProps as AriaDateInputProps,\n DateSegment as AriaDateSegment,\n DateSegmentProps as AriaDateSegmentProps,\n DateValue as AriaDateValue,\n TimeField as AriaTimeField,\n TimeFieldProps as AriaTimeFieldProps,\n TimeValue as AriaTimeValue,\n composeRenderProps\n} from \"react-aria-components\"\n\nimport { cn } from \"@/utils/index\"\n\nimport { fieldGroupVariants, FormField, type FormFieldProps } from \"./field\"\n\nexport function DateSegment({ className, ...props }: AriaDateSegmentProps) {\n return (\n <AriaDateSegment\n className={composeRenderProps(className, (className) =>\n cn(\n \"
|
|
1
|
+
{"version":3,"file":"datefield.es.js","sources":["../../../lib/components/inputs/datefield.tsx"],"sourcesContent":["\"use client\"\n\nimport { VariantProps } from \"class-variance-authority\"\nimport {\n DateField as AriaDateField,\n DateFieldProps as AriaDateFieldProps,\n DateInput as AriaDateInput,\n DateInputProps as AriaDateInputProps,\n DateSegment as AriaDateSegment,\n DateSegmentProps as AriaDateSegmentProps,\n DateValue as AriaDateValue,\n TimeField as AriaTimeField,\n TimeFieldProps as AriaTimeFieldProps,\n TimeValue as AriaTimeValue,\n composeRenderProps\n} from \"react-aria-components\"\n\nimport { cn } from \"@/utils/index\"\n\nimport { fieldGroupVariants, FormField, type FormFieldProps } from \"./field\"\n\nexport function DateSegment({ className, ...props }: AriaDateSegmentProps) {\n return (\n <AriaDateSegment\n className={composeRenderProps(className, (className) =>\n cn(\n \"inline caret-transparent outline-0\",\n /* Placeholder */\n \"data-[placeholder]:text-muted-foreground\",\n /* Disabled */\n \"disabled-muted\",\n /* Focused */\n \"data-[focused]:bg-accent data-[focused]:text-accent-foreground\",\n /* Invalid */\n \"data-[invalid]:data-[focused]:bg-destructive data-[invalid]:data-[focused]:data-[placeholder]:text-destructive-foreground data-[invalid]:data-[focused]:text-destructive-foreground data-[invalid]:data-[placeholder]:text-destructive data-[invalid]:text-destructive\",\n className\n )\n )}\n {...props}\n />\n )\n}\n\ninterface DateInputProps\n extends AriaDateInputProps,\n VariantProps<typeof fieldGroupVariants> { }\n\nexport function DateInput({\n className,\n variant,\n ...props\n}: Omit<DateInputProps, \"children\">) {\n return (\n <AriaDateInput\n className={composeRenderProps(className, (className) =>\n cn(fieldGroupVariants({ variant }), \"text-sm\", className)\n )}\n {...props}\n >\n {(segment) => <DateSegment segment={segment} />}\n </AriaDateInput>\n )\n}\n\ninterface DateFieldProps<T extends AriaDateValue> extends AriaDateFieldProps<T>, FormFieldProps { }\n\nexport function DateField<T extends AriaDateValue>({\n label,\n description,\n className,\n errorMessage,\n ...props\n}: DateFieldProps<T>) {\n return (\n <AriaDateField\n className={composeRenderProps(className, (className) =>\n cn(\"group form-field\", className)\n )}\n {...props}\n >\n <FormField label={label} description={description} errorMessage={errorMessage}>\n <DateInput />\n </FormField>\n </AriaDateField>\n )\n}\n\ninterface TimeFieldProps<T extends AriaTimeValue> extends AriaTimeFieldProps<T>, FormFieldProps { }\n\nexport function TimeField<T extends AriaTimeValue>({\n label,\n description,\n errorMessage,\n className,\n ...props\n}: TimeFieldProps<T>) {\n return (\n <AriaTimeField\n className={composeRenderProps(className, (className) =>\n cn(\"group form-field\", className)\n )}\n {...props}\n >\n <FormField label={label} description={description} errorMessage={errorMessage}>\n <DateInput />\n </FormField>\n </AriaTimeField>\n )\n}\n"],"names":["DateSegment","className","props","jsx","AriaDateSegment","composeRenderProps","cn","DateInput","variant","AriaDateInput","fieldGroupVariants","segment","DateField","label","description","errorMessage","AriaDateField","FormField","TimeField","AriaTimeField"],"mappings":";;;;;;AAqBO,SAASA,EAAY,EAAE,WAAAC,GAAW,GAAGC,KAA+B;AACzE,SACE,gBAAAC;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,WAAWC;AAAAA,QAAmBJ;AAAA,QAAW,CAACA,MACxCK;AAAA,UACE;AAAA;AAAA,UAEA;AAAA;AAAA,UAEA;AAAA;AAAA,UAEA;AAAA;AAAA,UAEA;AAAA,UACAL;AAAAA,QAAA;AAAA,MACF;AAAA,MAED,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;AAMO,SAASK,EAAU;AAAA,EACxB,WAAAN;AAAA,EACA,SAAAO;AAAA,EACA,GAAGN;AACL,GAAqC;AACnC,SACE,gBAAAC;AAAA,IAACM;AAAAA,IAAA;AAAA,MACC,WAAWJ;AAAAA,QAAmBJ;AAAA,QAAW,CAACA,MACxCK,EAAGI,EAAmB,EAAE,SAAAF,EAAA,CAAS,GAAG,WAAWP,CAAS;AAAA,MAAA;AAAA,MAEzD,GAAGC;AAAA,MAEH,UAAA,CAACS,MAAY,gBAAAR,EAACH,GAAA,EAAY,SAAAW,EAAA,CAAkB;AAAA,IAAA;AAAA,EAAA;AAGnD;AAIO,SAASC,EAAmC;AAAA,EACjD,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAb;AAAA,EACA,cAAAc;AAAA,EACA,GAAGb;AACL,GAAsB;AACpB,SACE,gBAAAC;AAAA,IAACa;AAAAA,IAAA;AAAA,MACC,WAAWX;AAAAA,QAAmBJ;AAAA,QAAW,CAACA,MACxCK,EAAG,oBAAoBL,CAAS;AAAA,MAAA;AAAA,MAEjC,GAAGC;AAAA,MAEJ,4BAACe,GAAA,EAAU,OAAAJ,GAAc,aAAAC,GAA0B,cAAAC,GACjD,UAAA,gBAAAZ,EAACI,KAAU,EAAA,CACb;AAAA,IAAA;AAAA,EAAA;AAGN;AAIO,SAASW,EAAmC;AAAA,EACjD,OAAAL;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAd;AAAA,EACA,GAAGC;AACL,GAAsB;AACpB,SACE,gBAAAC;AAAA,IAACgB;AAAAA,IAAA;AAAA,MACC,WAAWd;AAAAA,QAAmBJ;AAAA,QAAW,CAACA,MACxCK,EAAG,oBAAoBL,CAAS;AAAA,MAAA;AAAA,MAEjC,GAAGC;AAAA,MAEJ,4BAACe,GAAA,EAAU,OAAAJ,GAAc,aAAAC,GAA0B,cAAAC,GACjD,UAAA,gBAAAZ,EAACI,KAAU,EAAA,CACb;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as r, jsxs as o, Fragment as s } from "react/jsx-runtime";
|
|
3
3
|
import { cva as d } from "class-variance-authority";
|
|
4
|
-
import { composeRenderProps as
|
|
5
|
-
import { Group as
|
|
6
|
-
import { Label as
|
|
7
|
-
import { Text as
|
|
4
|
+
import { composeRenderProps as l } from "../../node_modules/.pnpm/react-aria-components@1.11.0_react-dom@19.1.0_react@19.1.0/node_modules/react-aria-components/dist/utils.es.js";
|
|
5
|
+
import { Group as f } from "../../node_modules/.pnpm/react-aria-components@1.11.0_react-dom@19.1.0_react@19.1.0/node_modules/react-aria-components/dist/Group.es.js";
|
|
6
|
+
import { Label as m } from "../../node_modules/.pnpm/react-aria-components@1.11.0_react-dom@19.1.0_react@19.1.0/node_modules/react-aria-components/dist/Label.es.js";
|
|
7
|
+
import { Text as c } from "../../node_modules/.pnpm/react-aria-components@1.11.0_react-dom@19.1.0_react@19.1.0/node_modules/react-aria-components/dist/Text.es.js";
|
|
8
8
|
import { Info as u, CircleX as p } from "lucide-react";
|
|
9
|
-
import { cn as
|
|
9
|
+
import { cn as n } from "../../utils/primitives.es.js";
|
|
10
10
|
const x = d([
|
|
11
11
|
"select-none text-sm font-medium leading-none",
|
|
12
12
|
/* Disabled */
|
|
@@ -14,45 +14,46 @@ const x = d([
|
|
|
14
14
|
/* Invalid */
|
|
15
15
|
"group-data-[invalid]:text-destructive"
|
|
16
16
|
]);
|
|
17
|
-
function b({ className:
|
|
18
|
-
return /* @__PURE__ */
|
|
17
|
+
function b({ className: e, ...t }) {
|
|
18
|
+
return /* @__PURE__ */ r(m, { className: n(x(), e), ...t });
|
|
19
19
|
}
|
|
20
|
-
function g({ className:
|
|
20
|
+
function g({ className: e, children: t, ...i }) {
|
|
21
21
|
return /* @__PURE__ */ o(
|
|
22
|
-
|
|
22
|
+
c,
|
|
23
23
|
{
|
|
24
|
-
className:
|
|
24
|
+
className: n("text-sm text-muted leading-tight", e),
|
|
25
25
|
...i,
|
|
26
26
|
slot: "description",
|
|
27
27
|
children: [
|
|
28
|
-
|
|
29
|
-
/* @__PURE__ */
|
|
28
|
+
t,
|
|
29
|
+
/* @__PURE__ */ r(u, { className: "inline size-2 align-text-top ms-0.5" })
|
|
30
30
|
]
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function $({ className: e, children: t, ...i }) {
|
|
35
35
|
return /* @__PURE__ */ o(
|
|
36
36
|
"div",
|
|
37
37
|
{
|
|
38
|
-
className:
|
|
38
|
+
className: n("text-sm leading-tight text-destructive duration-150 animate-in transition-transform slide-in-from-top-5 fade-in", e),
|
|
39
39
|
...i,
|
|
40
40
|
children: [
|
|
41
|
-
|
|
42
|
-
/* @__PURE__ */
|
|
41
|
+
t,
|
|
42
|
+
/* @__PURE__ */ r(p, { className: "inline size-2 align-text-top ms-0.5" })
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
|
-
const
|
|
47
|
+
const h = d("", {
|
|
48
48
|
variants: {
|
|
49
49
|
variant: {
|
|
50
50
|
default: [
|
|
51
|
-
|
|
51
|
+
// TODO standardize the padding here
|
|
52
|
+
"relative flex h-input w-full items-center overflow-hidden border border-input bg-card px-2 py-2 text-sm ring-offset-background",
|
|
52
53
|
/* Focus Within */
|
|
53
|
-
"
|
|
54
|
+
"focus-ring",
|
|
54
55
|
/* Disabled */
|
|
55
|
-
"
|
|
56
|
+
"disabled-muted"
|
|
56
57
|
],
|
|
57
58
|
ghost: ""
|
|
58
59
|
}
|
|
@@ -61,33 +62,33 @@ const $ = d("", {
|
|
|
61
62
|
variant: "default"
|
|
62
63
|
}
|
|
63
64
|
});
|
|
64
|
-
function
|
|
65
|
-
return /* @__PURE__ */
|
|
66
|
-
|
|
65
|
+
function L({ className: e, variant: t, ...i }) {
|
|
66
|
+
return /* @__PURE__ */ r(
|
|
67
|
+
f,
|
|
67
68
|
{
|
|
68
|
-
className:
|
|
69
|
-
|
|
70
|
-
(a) =>
|
|
69
|
+
className: l(
|
|
70
|
+
e,
|
|
71
|
+
(a) => n(h({ variant: t }), a)
|
|
71
72
|
),
|
|
72
73
|
...i
|
|
73
74
|
}
|
|
74
75
|
);
|
|
75
76
|
}
|
|
76
|
-
function
|
|
77
|
+
function k({ label: e, description: t, errorMessage: i, children: a }) {
|
|
77
78
|
return /* @__PURE__ */ o(s, { children: [
|
|
78
|
-
|
|
79
|
+
e && /* @__PURE__ */ r(b, { children: e }),
|
|
79
80
|
a,
|
|
80
|
-
|
|
81
|
-
i && /* @__PURE__ */
|
|
81
|
+
t && /* @__PURE__ */ r(g, { children: t }),
|
|
82
|
+
i && /* @__PURE__ */ r($, { children: i })
|
|
82
83
|
] });
|
|
83
84
|
}
|
|
84
85
|
export {
|
|
85
86
|
g as FieldDescription,
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
$ as FieldError,
|
|
88
|
+
L as FieldGroup,
|
|
88
89
|
b as FieldLabel,
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
k as FormField,
|
|
91
|
+
h as fieldGroupVariants,
|
|
91
92
|
x as labelVariants
|
|
92
93
|
};
|
|
93
94
|
//# sourceMappingURL=field.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.es.js","sources":["../../../lib/components/inputs/field.tsx"],"sourcesContent":["\"use client\"\n\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport {\n Group as AriaGroup,\n GroupProps as AriaGroupProps,\n Label as AriaLabel,\n LabelProps as AriaLabelProps,\n Text as AriaText,\n TextProps as AriaTextProps,\n composeRenderProps\n} from \"react-aria-components\"\n\nimport { cn } from \"@/utils/index\"\nimport { CircleX, Info } from \"lucide-react\"\nimport type React from \"react\"\n\nexport const labelVariants = cva([\n \"select-none text-sm font-medium leading-none\",\n /* Disabled */\n \"disabled-muted\",\n /* Invalid */\n \"group-data-[invalid]:text-destructive\",\n])\n\nexport function FieldLabel({ className, ...props }: AriaLabelProps) {\n return (\n <AriaLabel className={cn(labelVariants(), className)} {...props} />\n )\n}\n\nexport function FieldDescription({ className, children, ...props }: AriaTextProps) {\n return (\n <AriaText\n className={cn(\"text-sm text-muted leading-tight\", className)}\n {...props}\n slot=\"description\"\n >\n {children}<Info className=\"inline size-2 align-text-top ms-0.5\" />\n </AriaText>\n )\n}\n// TODO, if we were to use AriaFieldError, it would use the internal ValidationState Context object, which might be useful for composing inputs but\n// this would have significant overlap with what Tanstack Form is already doing for us. It has pros and cons, needs to be discussed and explored.\nexport function FieldError({ className, children, ...props }: React.ComponentPropsWithRef<'div'>) {\n return (\n <div\n className={cn(\"text-sm leading-tight text-destructive duration-150 animate-in transition-transform slide-in-from-top-5 fade-in\", className)}\n {...props}\n >\n {children}<CircleX className=\"inline size-2 align-text-top ms-0.5\" />\n </div>\n )\n}\n\nexport const fieldGroupVariants = cva(\"\", {\n variants: {\n variant: {\n default: [\n \"relative flex h-input w-full items-center overflow-hidden border border-input bg-card px-
|
|
1
|
+
{"version":3,"file":"field.es.js","sources":["../../../lib/components/inputs/field.tsx"],"sourcesContent":["\"use client\"\n\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport {\n Group as AriaGroup,\n GroupProps as AriaGroupProps,\n Label as AriaLabel,\n LabelProps as AriaLabelProps,\n Text as AriaText,\n TextProps as AriaTextProps,\n composeRenderProps\n} from \"react-aria-components\"\n\nimport { cn } from \"@/utils/index\"\nimport { CircleX, Info } from \"lucide-react\"\nimport type React from \"react\"\n\nexport const labelVariants = cva([\n \"select-none text-sm font-medium leading-none\",\n /* Disabled */\n \"disabled-muted\",\n /* Invalid */\n \"group-data-[invalid]:text-destructive\",\n])\n\nexport function FieldLabel({ className, ...props }: AriaLabelProps) {\n return (\n <AriaLabel className={cn(labelVariants(), className)} {...props} />\n )\n}\n\nexport function FieldDescription({ className, children, ...props }: AriaTextProps) {\n return (\n <AriaText\n className={cn(\"text-sm text-muted leading-tight\", className)}\n {...props}\n slot=\"description\"\n >\n {children}<Info className=\"inline size-2 align-text-top ms-0.5\" />\n </AriaText>\n )\n}\n// TODO, if we were to use AriaFieldError, it would use the internal ValidationState Context object, which might be useful for composing inputs but\n// this would have significant overlap with what Tanstack Form is already doing for us. It has pros and cons, needs to be discussed and explored.\nexport function FieldError({ className, children, ...props }: React.ComponentPropsWithRef<'div'>) {\n return (\n <div\n className={cn(\"text-sm leading-tight text-destructive duration-150 animate-in transition-transform slide-in-from-top-5 fade-in\", className)}\n {...props}\n >\n {children}<CircleX className=\"inline size-2 align-text-top ms-0.5\" />\n </div>\n )\n}\n\nexport const fieldGroupVariants = cva(\"\", {\n variants: {\n variant: {\n default: [\n // TODO standardize the padding here\n \"relative flex h-input w-full items-center overflow-hidden border border-input bg-card px-2 py-2 text-sm ring-offset-background\",\n /* Focus Within */\n \"focus-ring\",\n /* Disabled */\n \"disabled-muted\",\n ],\n ghost: \"\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n})\n\nexport interface GroupProps\n extends AriaGroupProps,\n VariantProps<typeof fieldGroupVariants> { }\n\nexport function FieldGroup({ className, variant, ...props }: GroupProps) {\n return (\n <AriaGroup\n className={composeRenderProps(className, (className) =>\n cn(fieldGroupVariants({ variant }), className)\n )}\n {...props}\n />\n )\n}\n\nexport type FormFieldProps = {\n label?: string\n description?: React.ReactNode\n errorMessage?: string\n // | ((validation: AriaValidationResult) => string)\n}\n\nexport function FormField({ label, description, errorMessage, children }: FormFieldProps & {\n children: React.ReactNode\n}) {\n return <>\n {label && <FieldLabel>{label}</FieldLabel>}\n {children}\n {description && (<FieldDescription>{description}</FieldDescription>)}\n {errorMessage && <FieldError>{errorMessage}</FieldError>}\n </>\n}\n"],"names":["labelVariants","cva","FieldLabel","className","props","jsx","AriaLabel","cn","FieldDescription","children","jsxs","AriaText","Info","FieldError","CircleX","fieldGroupVariants","FieldGroup","variant","AriaGroup","composeRenderProps","FormField","label","description","errorMessage","Fragment"],"mappings":";;;;;;;;;AAiBO,MAAMA,IAAgBC,EAAI;AAAA,EAC/B;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AACF,CAAC;AAEM,SAASC,EAAW,EAAE,WAAAC,GAAW,GA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,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;AASO,SAASgB,EAAU,EAAE,OAAAC,GAAO,aAAAC,GAAa,cAAAC,GAAc,UAAAd,KAE3D;AACD,SAAO,gBAAAC,EAAAc,GAAA,EACJ,UAAA;AAAA,IAAAH,KAAS,gBAAAhB,EAACH,KAAY,UAAAmB,EAAA,CAAM;AAAA,IAC5BZ;AAAA,IACAa,KAAgB,gBAAAjB,EAACG,GAAA,EAAkB,UAAAc,EAAA,CAAY;AAAA,IAC/CC,KAAgB,gBAAAlB,EAACQ,GAAA,EAAY,UAAAU,EAAA,CAAa;AAAA,EAAA,GAC7C;AACF;"}
|
|
@@ -1,50 +1,53 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { SearchField as
|
|
3
|
-
import { Menu as
|
|
4
|
-
import { useQuery as
|
|
5
|
-
import { useId as
|
|
6
|
-
import { Autocomplete as
|
|
7
|
-
import { PopoverTrigger as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { jsx as r, Fragment as x, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { SearchField as F } from "./searchfield.es.js";
|
|
3
|
+
import { Menu as I, MenuItem as N } from "../ui/menu.es.js";
|
|
4
|
+
import { useQuery as p } from "@tanstack/react-query";
|
|
5
|
+
import { useId as C, useState as q } from "react";
|
|
6
|
+
import { Autocomplete as j } from "../../node_modules/.pnpm/react-aria-components@1.11.0_react-dom@19.1.0_react@19.1.0/node_modules/react-aria-components/dist/Autocomplete.es.js";
|
|
7
|
+
import { PopoverTrigger as K, Popover as M } from "../ui/popover.es.js";
|
|
8
|
+
import { Loader as $ } from "../ui/loader.es.js";
|
|
9
|
+
import { Button as v } from "../ui/button.es.js";
|
|
10
|
+
import { useFieldContext as A } from "../../utils/form-context.es.js";
|
|
11
|
+
function E({ value: t, disabled: s = !1, searchFn: n, multiple: o, onChange: f, onBlur: i, accessor: h = "id", idLookup: m }) {
|
|
12
|
+
const c = C(), [a, g] = q(""), { data: y, isError: d, isFetching: u, error: b } = p({
|
|
12
13
|
queryKey: [c, a],
|
|
13
14
|
queryFn: () => n(a)
|
|
14
|
-
}),
|
|
15
|
-
queryKey: [c,
|
|
16
|
-
queryFn: () => m(Array.from(
|
|
17
|
-
enabled: m &&
|
|
15
|
+
}), S = p({
|
|
16
|
+
queryKey: [c, t],
|
|
17
|
+
queryFn: () => m(Array.from(t.keys()).map((e) => e.toString())),
|
|
18
|
+
enabled: m && t.size > 0
|
|
18
19
|
});
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
-
e || i == null || i(
|
|
20
|
+
return /* @__PURE__ */ r(x, { children: /* @__PURE__ */ l(K, { onOpenChange: (e) => {
|
|
21
|
+
e || i == null || i(t);
|
|
21
22
|
}, children: [
|
|
22
|
-
/* @__PURE__ */
|
|
23
|
+
/* @__PURE__ */ r(v, { className: "min-w-3xs", isDisabled: s, children: (() => {
|
|
23
24
|
var e;
|
|
24
|
-
return
|
|
25
|
+
return (e = S.data) == null ? void 0 : e.join(",");
|
|
25
26
|
})() }),
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
|
|
27
|
+
/* @__PURE__ */ r(M, { className: "p-2", children: /* @__PURE__ */ l(
|
|
28
|
+
j,
|
|
28
29
|
{
|
|
29
30
|
inputValue: a,
|
|
30
|
-
onInputChange:
|
|
31
|
+
onInputChange: g,
|
|
31
32
|
children: [
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
/* @__PURE__ */ r(F, { className: "mb-icon", autoFocus: !0 }),
|
|
34
|
+
u && /* @__PURE__ */ r($, { className: "p-input" }),
|
|
35
|
+
!u && !d && /* @__PURE__ */ r(I, { selectedKeys: t, selectionMode: o ? "multiple" : "single", onSelectionChange: (e) => {
|
|
36
|
+
typeof e != "string" && f(e);
|
|
37
|
+
}, className: "text-sm", items: y, renderEmptyState: () => "No results found.", children: (e) => /* @__PURE__ */ r(N, { id: e[h], children: e.name }, e.id) }),
|
|
38
|
+
d && /* @__PURE__ */ r("div", { className: "text-destructive p-icon", children: b.message })
|
|
36
39
|
]
|
|
37
40
|
}
|
|
38
41
|
) })
|
|
39
42
|
] }) });
|
|
40
43
|
}
|
|
41
|
-
function
|
|
42
|
-
const n =
|
|
43
|
-
return /* @__PURE__ */
|
|
44
|
-
|
|
44
|
+
function k({ disabled: t, ...s }) {
|
|
45
|
+
const n = A();
|
|
46
|
+
return /* @__PURE__ */ r(
|
|
47
|
+
E,
|
|
45
48
|
{
|
|
46
49
|
...s,
|
|
47
|
-
disabled:
|
|
50
|
+
disabled: t || n.form.state.isSubmitting,
|
|
48
51
|
value: n.state.value,
|
|
49
52
|
onBlur: (o) => n.handleBlur(),
|
|
50
53
|
onChange: (o) => n.handleChange(o)
|
|
@@ -52,7 +55,7 @@ function V({ disabled: r, ...s }) {
|
|
|
52
55
|
);
|
|
53
56
|
}
|
|
54
57
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
E as IdSearchInput,
|
|
59
|
+
k as TfIdSearchInput
|
|
57
60
|
};
|
|
58
61
|
//# sourceMappingURL=id-search.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id-search.es.js","sources":["../../../lib/components/inputs/id-search.tsx"],"sourcesContent":["import { SearchField } from \"@/components/inputs/searchfield\";\nimport { Button, Popover, PopoverTrigger } from \"@/components/ui\";\nimport { Menu, MenuItem } from \"@/components/ui/menu\";\nimport { useFieldContext } from \"@/utils\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useId, useState } from \"react\";\nimport { Autocomplete } from 'react-aria-components';\n\nexport type SelectState = Set<number | string>;\n\ntype SearchInputProps<T> = {\n value: SelectState;\n onChange: (v: SelectState) => void\n onBlur?: (v: SelectState) => void\n multiple: boolean\n disabled?: boolean\n idLookup?: (ids: string[]) => Promise<string[] | undefined>\n searchFn: (q: string) => Promise<T[] | undefined>\n accessor: 'id' | 'name';\n}\nexport function IdSearchInput<T extends { id: string; name: string }>({ value, disabled = false, searchFn, multiple, onChange, onBlur, accessor = 'id', idLookup }: SearchInputProps<T>) {\n const id = useId();\n const [search, _setSearch] = useState('');\n const { data, isError, isFetching, error } = useQuery({\n queryKey: [id, search],\n queryFn: () => searchFn(search)\n })\n\n const namesQuery = useQuery({\n queryKey: [id, value],\n queryFn: () => idLookup!(Array.from(value.keys()).map(id => id.toString())),\n enabled: idLookup && value.size > 0\n })\n\n const renderButtonLabel = () => {\n
|
|
1
|
+
{"version":3,"file":"id-search.es.js","sources":["../../../lib/components/inputs/id-search.tsx"],"sourcesContent":["import { SearchField } from \"@/components/inputs/searchfield\";\nimport { Button, Loader, Popover, PopoverTrigger } from \"@/components/ui\";\nimport { Menu, MenuItem } from \"@/components/ui/menu\";\nimport { useFieldContext } from \"@/utils\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useId, useState } from \"react\";\nimport { Autocomplete } from 'react-aria-components';\n\nexport type SelectState = Set<number | string>;\n\ntype SearchInputProps<T> = {\n value: SelectState;\n onChange: (v: SelectState) => void\n onBlur?: (v: SelectState) => void\n multiple: boolean\n disabled?: boolean\n idLookup?: (ids: string[]) => Promise<string[] | undefined>\n searchFn: (q: string) => Promise<T[] | undefined>\n accessor: 'id' | 'name';\n}\nexport function IdSearchInput<T extends { id: string; name: string }>({ value, disabled = false, searchFn, multiple, onChange, onBlur, accessor = 'id', idLookup }: SearchInputProps<T>) {\n const id = useId();\n const [search, _setSearch] = useState('');\n const { data, isError, isFetching, error } = useQuery({\n queryKey: [id, search],\n queryFn: () => searchFn(search)\n })\n\n const namesQuery = useQuery({\n queryKey: [id, value],\n queryFn: () => idLookup!(Array.from(value.keys()).map(id => id.toString())),\n enabled: idLookup && value.size > 0\n })\n\n const renderButtonLabel = () => {\n return namesQuery.data?.join(',');\n };\n\n return <>\n <PopoverTrigger onOpenChange={(o) => {\n if (!o) {\n // searchInputRef.current?.focus();\n onBlur?.(value);\n }\n }}>\n <Button className={'min-w-3xs'} isDisabled={disabled}>{renderButtonLabel()}</Button>\n <Popover className={'p-2'}>\n <Autocomplete\n inputValue={search}\n onInputChange={_setSearch}\n >\n <SearchField className={'mb-icon'} autoFocus />\n {isFetching && <Loader className=\"p-input\" />}\n {!isFetching && !isError && <Menu selectedKeys={value} selectionMode={multiple ? \"multiple\" : 'single'} onSelectionChange={(s) => {\n if (typeof (s) === 'string') return;\n onChange(s)\n }} className={'text-sm'} items={data} renderEmptyState={() => 'No results found.'}>\n {(item) => (<MenuItem key={item['id']} id={item[accessor]}>{item.name}</MenuItem>)}\n </Menu>}\n {\n isError && <div className=\"text-destructive p-icon\">{error.message}</div>\n }\n </Autocomplete>\n </Popover>\n </PopoverTrigger >\n </>\n\n}\n\nexport function TfIdSearchInput<T extends { id: string; name: string }>({ disabled, ...props }: Omit<SearchInputProps<T>, 'value' | 'onChange'>) {\n const field = useFieldContext<SelectState>();\n return (\n <IdSearchInput\n {...props}\n disabled={disabled || field.form.state.isSubmitting}\n value={field.state.value}\n onBlur={_ => field.handleBlur()}\n onChange={(e) => field.handleChange(e)}\n />\n );\n}"],"names":["IdSearchInput","value","disabled","searchFn","multiple","onChange","onBlur","accessor","idLookup","id","useId","search","_setSearch","useState","data","isError","isFetching","error","useQuery","namesQuery","jsx","Fragment","jsxs","PopoverTrigger","o","Button","_a","Popover","Autocomplete","SearchField","Loader","Menu","s","item","MenuItem","TfIdSearchInput","props","field","useFieldContext","_","e"],"mappings":";;;;;;;;;;AAoBO,SAASA,EAAsD,EAAE,OAAAC,GAAO,UAAAC,IAAW,IAAO,UAAAC,GAAU,UAAAC,GAAU,UAAAC,GAAU,QAAAC,GAAQ,UAAAC,IAAW,MAAM,UAAAC,EAAA,GAAiC;AACrL,QAAMC,IAAKC,EAAA,GACL,CAACC,GAAQC,CAAU,IAAIC,EAAS,EAAE,GAClC,EAAE,MAAAC,GAAM,SAAAC,GAAS,YAAAC,GAAY,OAAAC,EAAA,IAAUC,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