docthub-core-components 3.1.0 → 3.2.2
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/overrides/ui/autocomplete-checkbox.js +377 -366
- package/dist/components/overrides/ui/pickers/date-range-picker-field.js +40 -39
- package/dist/src/components/overrides/ui/autocomplete-checkbox.d.ts +16 -1
- package/dist/src/components/overrides/ui/pickers/date-range-picker-field.d.ts +5 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as a, jsxs as F } from "react/jsx-runtime";
|
|
3
3
|
import { c as Le } from "react-compiler-runtime";
|
|
4
4
|
import K from "dayjs";
|
|
5
5
|
import $e from "dayjs/plugin/customParseFormat";
|
|
@@ -23,29 +23,29 @@ const Qe = i.memo(function(B) {
|
|
|
23
23
|
} = B, V = r === void 0 ? "en" : r, c = s === void 0 ? 2 : s;
|
|
24
24
|
let u;
|
|
25
25
|
e[0] !== m || e[1] !== l ? (u = () => {
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
const d = new Date(m);
|
|
27
|
+
d.setMonth(d.getMonth() - 1), l(d);
|
|
28
28
|
}, e[0] = m, e[1] = l, e[2] = u) : u = e[2];
|
|
29
29
|
const h = u;
|
|
30
30
|
let k;
|
|
31
31
|
e[3] !== m || e[4] !== l ? (k = () => {
|
|
32
|
-
const
|
|
33
|
-
|
|
32
|
+
const d = new Date(m);
|
|
33
|
+
d.setMonth(d.getMonth() + 1), l(d);
|
|
34
34
|
}, e[3] = m, e[4] = l, e[5] = k) : k = e[5];
|
|
35
35
|
const M = k;
|
|
36
36
|
let O;
|
|
37
37
|
if (e[6] !== V || e[7] !== m || e[8] !== c) {
|
|
38
|
-
let
|
|
39
|
-
e[10] !== V || e[11] !== m ? (
|
|
38
|
+
let d;
|
|
39
|
+
e[10] !== V || e[11] !== m ? (d = (se, W) => K(m).add(W, "month").locale(V).format("MMMM YYYY"), e[10] = V, e[11] = m, e[12] = d) : d = e[12], O = Array.from({
|
|
40
40
|
length: c
|
|
41
|
-
},
|
|
41
|
+
}, d), e[6] = V, e[7] = m, e[8] = c, e[9] = O;
|
|
42
42
|
} else
|
|
43
43
|
O = e[9];
|
|
44
44
|
const v = O;
|
|
45
45
|
let L;
|
|
46
|
-
e[13] === Symbol.for("react.memo_cache_sentinel") ? (L = /* @__PURE__ */
|
|
46
|
+
e[13] === Symbol.for("react.memo_cache_sentinel") ? (L = /* @__PURE__ */ a(ze, { className: "h-4 w-4" }), e[13] = L) : L = e[13];
|
|
47
47
|
let b;
|
|
48
|
-
e[14] !== h ? (b = /* @__PURE__ */
|
|
48
|
+
e[14] !== h ? (b = /* @__PURE__ */ a("button", { type: "button", onClick: h, className: "flex h-7 w-7 items-center justify-center rounded-md border border-input bg-background p-0 text-foreground hover:bg-accent", "aria-label": "Previous month", children: L }), e[14] = h, e[15] = b) : b = e[15];
|
|
49
49
|
const T = `repeat(${c}, minmax(0, 1fr))`;
|
|
50
50
|
let P;
|
|
51
51
|
e[16] !== T ? (P = {
|
|
@@ -54,11 +54,11 @@ const Qe = i.memo(function(B) {
|
|
|
54
54
|
let p;
|
|
55
55
|
e[18] !== v ? (p = v.map(Ze), e[18] = v, e[19] = p) : p = e[19];
|
|
56
56
|
let x;
|
|
57
|
-
e[20] !== p || e[21] !== P ? (x = /* @__PURE__ */
|
|
57
|
+
e[20] !== p || e[21] !== P ? (x = /* @__PURE__ */ a("div", { className: "grid flex-1 gap-2 px-2 text-center text-sm font-semibold text-foreground", style: P, children: p }), e[20] = p, e[21] = P, e[22] = x) : x = e[22];
|
|
58
58
|
let D;
|
|
59
|
-
e[23] === Symbol.for("react.memo_cache_sentinel") ? (D = /* @__PURE__ */
|
|
59
|
+
e[23] === Symbol.for("react.memo_cache_sentinel") ? (D = /* @__PURE__ */ a(Ae, { className: "h-4 w-4" }), e[23] = D) : D = e[23];
|
|
60
60
|
let R;
|
|
61
|
-
e[24] !== M ? (R = /* @__PURE__ */
|
|
61
|
+
e[24] !== M ? (R = /* @__PURE__ */ a("button", { type: "button", onClick: M, className: "flex h-7 w-7 items-center justify-center rounded-md border border-input bg-background p-0 text-foreground hover:bg-accent", "aria-label": "Next month", children: D }), e[24] = M, e[25] = R) : R = e[25];
|
|
62
62
|
let $;
|
|
63
63
|
return e[26] !== x || e[27] !== R || e[28] !== b ? ($ = /* @__PURE__ */ F("div", { className: "flex items-center border-b border-border bg-muted px-2 py-1.5", children: [
|
|
64
64
|
b,
|
|
@@ -90,7 +90,7 @@ const Qe = i.memo(function(B) {
|
|
|
90
90
|
open: D,
|
|
91
91
|
onOpenChange: R,
|
|
92
92
|
dayPickerProps: $,
|
|
93
|
-
manual:
|
|
93
|
+
manual: d = !1,
|
|
94
94
|
// Default to false: calendar-only selection unless enabled
|
|
95
95
|
popoverAlign: se = "end",
|
|
96
96
|
iconPosition: W = "right",
|
|
@@ -106,16 +106,16 @@ const Qe = i.memo(function(B) {
|
|
|
106
106
|
...ye
|
|
107
107
|
}) => {
|
|
108
108
|
const {
|
|
109
|
-
disabled:
|
|
109
|
+
disabled: de,
|
|
110
110
|
fromDate: Ce,
|
|
111
111
|
toDate: Se,
|
|
112
112
|
startMonth: he,
|
|
113
113
|
endMonth: ve,
|
|
114
114
|
showOutsideDays: xe,
|
|
115
115
|
...C
|
|
116
|
-
} = $ ?? {}, ge = T ?? xe,
|
|
116
|
+
} = $ ?? {}, ge = T ?? xe, ae = L ?? v, [we, ke] = i.useState(!1), q = D !== void 0 ? D : we, j = R || ke, [S, y] = i.useState(""), [E, g] = i.useState(l), [ne, le] = i.useState(p ?? (l == null ? void 0 : l.from) ?? /* @__PURE__ */ new Date()), ce = i.useMemo(() => p ?? ne, [p, ne]), G = i.useCallback((t) => {
|
|
117
117
|
x ? x(t) : le(t);
|
|
118
|
-
}, [x]), Me = i.useMemo(() => B || (
|
|
118
|
+
}, [x]), Me = i.useMemo(() => B || (d ? `${v.toLowerCase()} - ${v.toLowerCase()}` : "Click to select date range"), [B, v, d]), H = i.useCallback((t) => K(t).locale(M).format(ae), [ae, M]), w = i.useCallback((t) => t != null && t.from ? t.from && t.to ? `${H(t.from)} - ${H(t.to)}` : H(t.from) : "", [H]), J = i.useCallback((t) => {
|
|
119
119
|
const o = t.trim();
|
|
120
120
|
if (!o) return null;
|
|
121
121
|
const f = K(o, v, !0).locale(M);
|
|
@@ -175,7 +175,8 @@ const Qe = i.memo(function(B) {
|
|
|
175
175
|
// react-day-picker v9 selection state keys
|
|
176
176
|
selected: "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
|
|
177
177
|
day_today: "bg-accent text-accent-foreground",
|
|
178
|
-
|
|
178
|
+
// react-day-picker v9 uses modifier key `outside` (not `day_outside`); `.day-outside` kept for `[&:has(...day-outside)]` cell selectors.
|
|
179
|
+
outside: "day-outside text-muted-foreground/60 [&_button:not(:disabled)]:text-muted-foreground/60 hover:[&_button:not(:disabled)]:text-muted-foreground",
|
|
179
180
|
disabled: "text-muted-foreground opacity-40 grayscale pointer-events-none cursor-not-allowed",
|
|
180
181
|
day_disabled: "text-muted-foreground opacity-40 grayscale pointer-events-none cursor-not-allowed",
|
|
181
182
|
day_range_middle: (
|
|
@@ -186,12 +187,12 @@ const Qe = i.memo(function(B) {
|
|
|
186
187
|
// react-day-picker v9 selection state keys
|
|
187
188
|
range_middle: "!bg-muted !text-foreground rounded-none [&>button]:!rounded-none",
|
|
188
189
|
day_hidden: "invisible"
|
|
189
|
-
}), []), _e = i.useMemo(() => He(Je(c, u),
|
|
190
|
+
}), []), _e = i.useMemo(() => He(Je(c, u), de), [c, u, de]), Pe = c ? me(c) : he, Re = u ? me(u) : ve;
|
|
190
191
|
i.useEffect(() => {
|
|
191
192
|
y(w(l)), g(l), l != null && l.from && !p && le(l.from);
|
|
192
193
|
}, [l, w, p]);
|
|
193
194
|
const Ve = i.useCallback((t) => {
|
|
194
|
-
if (!
|
|
195
|
+
if (!d) return;
|
|
195
196
|
let o = t.target.value;
|
|
196
197
|
if (y(o), !o.trim()) {
|
|
197
198
|
g(void 0), r == null || r(void 0), s == null || s(void 0);
|
|
@@ -201,7 +202,7 @@ const Qe = i.memo(function(B) {
|
|
|
201
202
|
f !== o && (y(f), o = f);
|
|
202
203
|
const n = Q(o);
|
|
203
204
|
n && U(n, c, u) && (g(n), r == null || r(n), s == null || s(n));
|
|
204
|
-
}, [
|
|
205
|
+
}, [d, r, s, ue, Q, c, u]), ee = i.useCallback(() => {
|
|
205
206
|
const t = S.trim();
|
|
206
207
|
if (!t) {
|
|
207
208
|
g(void 0), r == null || r(void 0), s == null || s(void 0);
|
|
@@ -217,12 +218,12 @@ const Qe = i.memo(function(B) {
|
|
|
217
218
|
const o = t.getRange();
|
|
218
219
|
U(o, c, u) && (y(w(o)), g(o), o.from && G(o.from), r == null || r(o), s == null || s(o));
|
|
219
220
|
}, [w, G, c, u, s, r]), Ee = !!(P && E && !h && !k), N = !!(h || k), Ye = i.useCallback((t) => {
|
|
220
|
-
if (!
|
|
221
|
+
if (!d) {
|
|
221
222
|
!N && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), j(!q));
|
|
222
223
|
return;
|
|
223
224
|
}
|
|
224
225
|
t.key === "Enter" && (t.preventDefault(), ee());
|
|
225
|
-
}, [
|
|
226
|
+
}, [d, ee, j, q, N]), Oe = i.useMemo(() => {
|
|
226
227
|
var t, o;
|
|
227
228
|
if (z) {
|
|
228
229
|
if (i.isValidElement(z)) {
|
|
@@ -237,51 +238,51 @@ const Qe = i.memo(function(B) {
|
|
|
237
238
|
}
|
|
238
239
|
});
|
|
239
240
|
}
|
|
240
|
-
return /* @__PURE__ */
|
|
241
|
+
return /* @__PURE__ */ a("span", { className: _("h-5 w-5 inline-flex items-center justify-center", X), style: I ? {
|
|
241
242
|
color: I
|
|
242
243
|
} : void 0, children: z });
|
|
243
244
|
}
|
|
244
|
-
return /* @__PURE__ */
|
|
245
|
+
return /* @__PURE__ */ a(Be, { strokeWidth: 1, className: _("h-5 w-5", X, h && "opacity-50"), style: I ? {
|
|
245
246
|
color: I
|
|
246
247
|
} : void 0 });
|
|
247
248
|
}, [z, X, I, h]);
|
|
248
249
|
return /* @__PURE__ */ F("div", { className: _("space-y-1", V), ...ye, children: [
|
|
249
250
|
Y && /* @__PURE__ */ F(Xe, { className: "text-sm font-medium text-foreground", children: [
|
|
250
251
|
Y,
|
|
251
|
-
m && /* @__PURE__ */
|
|
252
|
+
m && /* @__PURE__ */ a("span", { className: "text-red-500 ml-1", children: "*" })
|
|
252
253
|
] }),
|
|
253
254
|
/* @__PURE__ */ F(qe, { open: q, onOpenChange: (t) => {
|
|
254
255
|
N && t || j(t);
|
|
255
256
|
}, children: [
|
|
256
|
-
ie ? /* @__PURE__ */
|
|
257
|
-
|
|
257
|
+
ie ? /* @__PURE__ */ a(fe, { asChild: !0, children: ie }) : /* @__PURE__ */ F("div", { className: _("w-80 relative", O), onMouseDownCapture: () => {
|
|
258
|
+
d && be && !h && !k && j(!0);
|
|
258
259
|
}, children: [
|
|
259
|
-
/* @__PURE__ */
|
|
260
|
-
(!
|
|
261
|
-
}, placeholder: Me, disabled: h, readOnly: k || !
|
|
262
|
-
Ee && /* @__PURE__ */
|
|
263
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ a(We, { type: "text", value: S, onChange: Ve, onBlur: ee, onKeyDown: Ye, onClick: () => {
|
|
261
|
+
(!d && !N || d && pe && !N) && j(!0);
|
|
262
|
+
}, placeholder: Me, disabled: h, readOnly: k || !d, className: _("w-full pr-12", W === "left" && "pl-12", b && "border border-destructive focus-visible:ring-destructive", !d && !N && "cursor-pointer") }),
|
|
263
|
+
Ee && /* @__PURE__ */ a("button", { type: "button", onClick: Ie, className: "absolute right-10 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted focus:outline-none focus:ring-2 focus:ring-ring", "aria-label": "Clear date range", children: /* @__PURE__ */ a(Te, { className: "h-4 w-4 text-muted-foreground" }) }),
|
|
264
|
+
/* @__PURE__ */ a(fe, { asChild: !0, children: /* @__PURE__ */ a("button", { type: "button", className: _("absolute top-1/2 -translate-y-1/2 border-0 bg-transparent outline-none", W === "left" ? "left-3" : "right-1", N ? "cursor-default text-muted-foreground" : "cursor-pointer text-black hover:text-black"), style: {
|
|
264
265
|
height: "1.75rem",
|
|
265
266
|
width: "1.75rem"
|
|
266
267
|
}, onClick: N ? void 0 : () => {
|
|
267
268
|
j(!q);
|
|
268
269
|
}, disabled: N, "aria-label": "Open calendar", children: Oe }) })
|
|
269
270
|
] }),
|
|
270
|
-
/* @__PURE__ */
|
|
271
|
-
Z && Z.length > 0 && /* @__PURE__ */
|
|
272
|
-
/* @__PURE__ */
|
|
273
|
-
/* @__PURE__ */
|
|
271
|
+
/* @__PURE__ */ a(Ge, { className: "w-auto p-0 mt-2", align: se, children: /* @__PURE__ */ F("div", { className: "rounded-md border border-border bg-popover text-popover-foreground shadow-md", children: [
|
|
272
|
+
Z && Z.length > 0 && /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-2 p-3 border-b bg-muted/40", children: Z.map((t) => /* @__PURE__ */ a("button", { type: "button", className: "rounded-md border bg-background px-2.5 py-1.5 text-xs font-medium hover:bg-accent hover:text-accent-foreground", onClick: () => je(t), children: t.label }, t.label)) }),
|
|
273
|
+
/* @__PURE__ */ a(Qe, { month: ce, onMonthChange: G, locale: M, numberOfMonths: oe }),
|
|
274
|
+
/* @__PURE__ */ a("div", { className: "p-3", children: /* @__PURE__ */ a(Ke, { ...C, mode: "range", selected: E, onSelect: De, month: ce, onMonthChange: G, startMonth: Pe, endMonth: Re, disabled: _e, numberOfMonths: oe, showOutsideDays: ge, className: _("p-0", C.className), classNames: {
|
|
274
275
|
...Ne,
|
|
275
276
|
...C.classNames
|
|
276
277
|
} }) })
|
|
277
278
|
] }) })
|
|
278
279
|
] }),
|
|
279
|
-
(e || b) && /* @__PURE__ */
|
|
280
|
+
(e || b) && /* @__PURE__ */ a("p", { className: _("text-xs", b ? "text-destructive" : "text-muted-foreground"), children: b || e })
|
|
280
281
|
] });
|
|
281
282
|
});
|
|
282
283
|
Ue.displayName = "DateRangePickerField";
|
|
283
284
|
function Ze(Y) {
|
|
284
|
-
return /* @__PURE__ */
|
|
285
|
+
return /* @__PURE__ */ a("span", { className: "truncate", children: Y }, Y);
|
|
285
286
|
}
|
|
286
287
|
export {
|
|
287
288
|
Ue as DateRangePickerField
|
|
@@ -33,6 +33,21 @@ export interface AutocompleteCheckboxProps<T = unknown> {
|
|
|
33
33
|
checkboxColor?: string;
|
|
34
34
|
showSearch?: boolean;
|
|
35
35
|
searchPlaceholder?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Show the scrollbar styling on the dropdown list. Defaults to true.
|
|
38
|
+
* When false, the scrollbar is hidden but the list remains scrollable.
|
|
39
|
+
*/
|
|
40
|
+
showScroller?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Allow multiple selection. Defaults to true.
|
|
43
|
+
* When false, selecting an item replaces the previous selection and closes the dropdown.
|
|
44
|
+
*/
|
|
45
|
+
multiple?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Hide the per-option checkbox indicator. Defaults to false.
|
|
48
|
+
* Useful for single-select usage where the selected row is shown only via the highlight background.
|
|
49
|
+
*/
|
|
50
|
+
hideCheckbox?: boolean;
|
|
36
51
|
/**
|
|
37
52
|
* Trigger type: "input" (default) uses text input, "button" uses DoctButton
|
|
38
53
|
*/
|
|
@@ -80,5 +95,5 @@ export interface AutocompleteCheckboxProps<T = unknown> {
|
|
|
80
95
|
* Autocomplete component with checkbox selection.
|
|
81
96
|
* Supports two modes: "input" (default) with tags display, or "button" for filter bars.
|
|
82
97
|
*/
|
|
83
|
-
export declare function AutocompleteCheckbox<T extends OptionType>({ options, dataSource, value, onChange, change, onInputChange, placeholder, label, helperText, error, noOptionsText, emptyMessage, disabled, loading, required, clearable, disableCloseOnSelect, freeSolo, size, variant, fullWidth, className, inputClassName, checkboxPosition, showChip, showTags, checkboxProps, chipProps, checkboxColor, showSearch, searchPlaceholder, triggerType, triggerButtonLabel, triggerButtonVariant, triggerButtonSize, triggerButtonProps, triggerButtonIcon, triggerButtonIconPosition, portalContainer, disablePortal, dropdownWidth, getOptionLabel, getOptionValue, isOptionEqualToValue, filterOptions, renderOption, renderTags, limitTags, fields, }: AutocompleteCheckboxProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
98
|
+
export declare function AutocompleteCheckbox<T extends OptionType>({ options, dataSource, value, onChange, change, onInputChange, placeholder, label, helperText, error, noOptionsText, emptyMessage, disabled, loading, required, clearable, disableCloseOnSelect, freeSolo, size, variant, fullWidth, className, inputClassName, checkboxPosition, showChip, showTags, checkboxProps, chipProps, checkboxColor, showSearch, searchPlaceholder, showScroller, multiple, hideCheckbox, triggerType, triggerButtonLabel, triggerButtonVariant, triggerButtonSize, triggerButtonProps, triggerButtonIcon, triggerButtonIconPosition, portalContainer, disablePortal, dropdownWidth, getOptionLabel, getOptionValue, isOptionEqualToValue, filterOptions, renderOption, renderTags, limitTags, fields, }: AutocompleteCheckboxProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
84
99
|
export default AutocompleteCheckbox;
|
|
@@ -23,7 +23,11 @@ export interface DateRangePickerFieldProps extends Omit<React.HTMLAttributes<HTM
|
|
|
23
23
|
displayFormat?: string;
|
|
24
24
|
inputClassName?: string;
|
|
25
25
|
error?: string;
|
|
26
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Passes through to react-day-picker `showOutsideDays` (neighbor-month cells fill the grid).
|
|
28
|
+
* When visible, adjacent-month days use the muted `outside` styles on this picker.
|
|
29
|
+
* Top-level wins over `dayPickerProps.showOutsideDays` when both are set. When neither is set, behavior matches react-day-picker (outside days omitted).
|
|
30
|
+
*/
|
|
27
31
|
showOutsideDays?: boolean;
|
|
28
32
|
clearable?: boolean;
|
|
29
33
|
month?: Date;
|