impact-nova 0.1.13 → 1.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/layout/dashboard-layout.d.ts +21 -6
- package/dist/components/ui/accordion-nested-list/accordion-nested-list.js +32 -33
- package/dist/components/ui/accordion.js +25 -23
- package/dist/components/ui/ag-grid-react/cell-renderers/date-display-renderer.js +32 -21
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/date-cell-editor.d.ts +3 -5
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/date-cell-editor.js +57 -55
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.d.ts +5 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.js +50 -52
- package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.d.ts +1 -1
- package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.js +34 -34
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +8 -11
- package/dist/components/ui/ag-grid-react/headers/column-menu/column-settings-menu.js +17 -17
- package/dist/components/ui/ag-grid-react/headers/header-search-input.js +3 -3
- package/dist/components/ui/alert-dialog.js +45 -40
- package/dist/components/ui/alert.d.ts +21 -4
- package/dist/components/ui/alert.js +45 -25
- package/dist/components/ui/avatar.js +19 -16
- package/dist/components/ui/badge.js +8 -1
- package/dist/components/ui/breadcrumb.js +1 -0
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button-group.js +27 -32
- package/dist/components/ui/button-variants.d.ts +1 -1
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.js +11 -9
- package/dist/components/ui/calendar.d.ts +14 -2
- package/dist/components/ui/calendar.js +443 -376
- package/dist/components/ui/card.js +7 -6
- package/dist/components/ui/checkbox.js +64 -48
- package/dist/components/ui/chips.d.ts +1 -0
- package/dist/components/ui/chips.js +27 -19
- package/dist/components/ui/data-table/data-table-column-list.d.ts +4 -1
- package/dist/components/ui/data-table/data-table-column-list.js +58 -54
- package/dist/components/ui/data-table/data-table-sheet.d.ts +1 -1
- package/dist/components/ui/data-table/data-table-sheet.js +43 -40
- package/dist/components/ui/data-table/data-table-view-options.js +17 -17
- package/dist/components/ui/data-table/data-table.js +21 -20
- package/dist/components/ui/date-picker/date-picker.js +93 -93
- package/dist/components/ui/date-picker/date-range-picker.js +142 -133
- package/dist/components/ui/date-picker/month-picker.js +96 -93
- package/dist/components/ui/date-picker/month-range-picker.js +144 -134
- package/dist/components/ui/date-picker/multi-date-picker.js +43 -45
- package/dist/components/ui/date-picker/multi-month-picker.js +37 -39
- package/dist/components/ui/date-picker/multi-week-picker.js +56 -46
- package/dist/components/ui/date-picker/week-picker.js +119 -109
- package/dist/components/ui/date-picker/week-range-picker.js +170 -147
- package/dist/components/ui/dialog.js +15 -6
- package/dist/components/ui/drawer.js +16 -13
- package/dist/components/ui/dropdown-menu.js +4 -2
- package/dist/components/ui/dynamic-layout.d.ts +2 -2
- package/dist/components/ui/dynamic-layout.js +18 -15
- package/dist/components/ui/empty-container.js +69 -64
- package/dist/components/ui/file-upload.js +113 -106
- package/dist/components/ui/filter-panel/filter-panel.js +49 -46
- package/dist/components/ui/filter-strip/filter-strip.js +41 -37
- package/dist/components/ui/header.js +26 -25
- package/dist/components/ui/horizontal-scroller/horizontal-scroller.js +43 -40
- package/dist/components/ui/hover-card.js +6 -5
- package/dist/components/ui/input.d.ts +1 -1
- package/dist/components/ui/input.js +79 -68
- package/dist/components/ui/loader.d.ts +1 -0
- package/dist/components/ui/loader.js +23 -13
- package/dist/components/ui/nested-list/components/NestedListContent.d.ts +1 -3
- package/dist/components/ui/nested-list/components/NestedListContent.js +16 -15
- package/dist/components/ui/nested-list/components/SortableItem.js +116 -80
- package/dist/components/ui/nested-list/hooks/useNestedListDragDrop.d.ts +13 -1
- package/dist/components/ui/nested-list/hooks/useNestedListDragDrop.js +162 -112
- package/dist/components/ui/nested-list/nested-list.js +182 -189
- package/dist/components/ui/notification-panel/notification-item.js +19 -17
- package/dist/components/ui/notification-panel/notification-list.js +21 -21
- package/dist/components/ui/notification-panel/notification-panel.js +25 -25
- package/dist/components/ui/popover.js +37 -34
- package/dist/components/ui/progress.js +12 -10
- package/dist/components/ui/prompt.js +29 -27
- package/dist/components/ui/radio-group.js +55 -46
- package/dist/components/ui/select/components/Submenu.d.ts +1 -2
- package/dist/components/ui/select/components/Submenu.js +52 -48
- package/dist/components/ui/select/select.js +321 -324
- package/dist/components/ui/sheet.js +18 -15
- package/dist/components/ui/sidebar.d.ts +2 -2
- package/dist/components/ui/sidebar.js +3 -3
- package/dist/components/ui/skeleton.d.ts +2 -1
- package/dist/components/ui/skeleton.js +12 -11
- package/dist/components/ui/slider.js +39 -12
- package/dist/components/ui/smart-input.js +44 -39
- package/dist/components/ui/stepper.js +33 -29
- package/dist/components/ui/switch.js +6 -4
- package/dist/components/ui/tabs.js +50 -45
- package/dist/components/ui/tag-group.d.ts +2 -1
- package/dist/components/ui/tag-group.js +29 -25
- package/dist/components/ui/tag.d.ts +1 -0
- package/dist/components/ui/tag.js +26 -20
- package/dist/components/ui/textarea.js +18 -17
- package/dist/components/ui/toast.d.ts +1 -1
- package/dist/components/ui/toast.js +47 -41
- package/dist/components/ui/toaster.js +42 -42
- package/dist/components/ui/tooltip.js +18 -16
- package/dist/components/ui/types/date-picker.types.d.ts +33 -0
- package/dist/components/ui/types/empty-container.types.d.ts +5 -0
- package/dist/components/ui/types/nested-list.types.d.ts +1 -0
- package/dist/components/ui/types/select.types.d.ts +0 -1
- package/dist/icons/assets/bookmark.svg.js +4 -0
- package/dist/icons/assets/bookmark.svg2.js +5 -0
- package/dist/icons/assets/bookmarkFilled.svg.js +4 -0
- package/dist/icons/assets/bookmarkFilled.svg2.js +5 -0
- package/dist/icons/assets/download.svg.js +4 -0
- package/dist/icons/assets/download.svg2.js +5 -0
- package/dist/icons/index.d.ts +20 -6
- package/dist/icons/index.js +398 -370
- package/dist/impact-nova.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +318 -314
- package/dist/lib/fiscal-calendar.d.ts +62 -0
- package/dist/lib/fiscal-calendar.js +99 -0
- package/dist/lib/utils.d.ts +2 -1
- package/dist/lib/utils.js +29 -13
- package/package.json +5 -5
- package/dist/components/ui/select/hooks/useClickOutside.d.ts +0 -15
- package/dist/components/ui/select/hooks/useClickOutside.js +0 -43
- package/dist/components/ui/select/hooks/useMenuPosition.d.ts +0 -2
- package/dist/components/ui/select/hooks/useMenuPosition.js +0 -89
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { WeekSelection } from '../components/ui/calendar';
|
|
2
|
+
export type CalendarType = "calendar" | "fiscal";
|
|
3
|
+
export type FiscalMode = "basic" | "advanced" | "custom";
|
|
4
|
+
export type SelectionMode = "week" | "fiscalMonth";
|
|
5
|
+
/** Per-month week counts for the fiscal year, e.g. [4,4,5,4,4,5,4,4,5,4,4,5] */
|
|
6
|
+
export type FiscalMonthPattern = number[];
|
|
7
|
+
/** Describes one fiscal month (a contiguous block of weeks). */
|
|
8
|
+
export interface FiscalMonth {
|
|
9
|
+
/** 0-based index within the fiscal year (0 = first fiscal month) */
|
|
10
|
+
index: number;
|
|
11
|
+
startDate: Date;
|
|
12
|
+
endDate: Date;
|
|
13
|
+
weekCount: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Pre-defined fiscal month patterns, each repeated 4× to yield 12 fiscal months.
|
|
17
|
+
* The pattern describes the number of weeks in each of the 3-month period.
|
|
18
|
+
* Sum = 13 weeks per quarter × 4 = 52 weeks per year.
|
|
19
|
+
*/
|
|
20
|
+
export declare const FISCAL_PATTERNS: Record<string, FiscalMonthPattern>;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the WeekSelection for a basic 7-day fiscal week.
|
|
23
|
+
* Unlike the "calendar" mode, the week is NOT clipped to month boundaries.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getFiscalWeekSelection(date: Date, weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6): WeekSelection;
|
|
26
|
+
/**
|
|
27
|
+
* Build the fiscal month calendar for one civil year.
|
|
28
|
+
*
|
|
29
|
+
* @param civilYear The civil year (e.g. 2026)
|
|
30
|
+
* @param pattern Array of week-counts per fiscal month (length 12)
|
|
31
|
+
* @param weekStartsOn Day the fiscal week begins
|
|
32
|
+
* @param fiscalYearStartMonth 1-based month where the fiscal year starts (default 1 = January)
|
|
33
|
+
*
|
|
34
|
+
* The first fiscal month starts at `weekStart(fiscalYearStartMonth 1st, civilYear)`.
|
|
35
|
+
* Each subsequent fiscal month begins exactly (weekCount × 7) days after the previous one.
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildFiscalMonthCalendar(civilYear: number, pattern: FiscalMonthPattern, weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6, fiscalYearStartMonth?: number): FiscalMonth[];
|
|
38
|
+
/**
|
|
39
|
+
* Given a date and a pre-built fiscal calendar, find which fiscal month the date
|
|
40
|
+
* falls in and return a WeekSelection spanning that entire fiscal month.
|
|
41
|
+
*
|
|
42
|
+
* Returns `undefined` if the date is outside the fiscal calendar range.
|
|
43
|
+
*/
|
|
44
|
+
export declare function getFiscalMonthSelection(date: Date, fiscalCalendar: FiscalMonth[]): WeekSelection | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Standard calendar week selection – the week is clipped to the month boundary
|
|
47
|
+
* (same as the existing "normal" behaviour).
|
|
48
|
+
*/
|
|
49
|
+
export declare function getCalendarWeekSelection(date: Date, weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6): WeekSelection;
|
|
50
|
+
export interface ResolveWeekSelectionOptions {
|
|
51
|
+
calendarType?: CalendarType;
|
|
52
|
+
fiscalMode?: FiscalMode;
|
|
53
|
+
selectionMode?: SelectionMode;
|
|
54
|
+
fiscalMonthPattern?: FiscalMonthPattern;
|
|
55
|
+
fiscalYearStartMonth?: number;
|
|
56
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Unified entry point for computing a WeekSelection from a clicked date,
|
|
60
|
+
* respecting the full new API.
|
|
61
|
+
*/
|
|
62
|
+
export declare function resolveWeekSelection(date: Date, options?: ResolveWeekSelectionOptions): WeekSelection;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
const M = {
|
|
2
|
+
"4-4-5": [4, 4, 5, 4, 4, 5, 4, 4, 5, 4, 4, 5]
|
|
3
|
+
};
|
|
4
|
+
function g(t, a) {
|
|
5
|
+
const e = new Date(t), s = (e.getDay() + 7 - a) % 7;
|
|
6
|
+
return e.setDate(e.getDate() - s), e.setHours(0, 0, 0, 0), e;
|
|
7
|
+
}
|
|
8
|
+
function f(t, a) {
|
|
9
|
+
const e = new Date(t);
|
|
10
|
+
return e.setDate(e.getDate() + a), e;
|
|
11
|
+
}
|
|
12
|
+
function u(t, a) {
|
|
13
|
+
const e = g(t, a), n = f(e, 6), c = new Date(t.getFullYear(), t.getMonth(), 1).getDay(), r = e.getDate(), o = e.getMonth() === t.getMonth() ? r : 1, l = Math.ceil((o + c) / 7);
|
|
14
|
+
return {
|
|
15
|
+
year: t.getFullYear(),
|
|
16
|
+
month: t.getMonth(),
|
|
17
|
+
weekOfMonth: Math.max(1, l),
|
|
18
|
+
startDate: e,
|
|
19
|
+
endDate: n
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function w(t, a, e, n = 1) {
|
|
23
|
+
if (a.length !== 12)
|
|
24
|
+
throw new Error(`fiscalMonthPattern must have exactly 12 entries, got ${a.length}`);
|
|
25
|
+
const s = new Date(t, n - 1, 1);
|
|
26
|
+
let c = g(s, e);
|
|
27
|
+
const r = [];
|
|
28
|
+
for (let o = 0; o < 12; o++) {
|
|
29
|
+
const l = a[o], D = new Date(c), i = f(D, l * 7 - 1);
|
|
30
|
+
r.push({ index: o, startDate: D, endDate: i, weekCount: l }), c = f(i, 1);
|
|
31
|
+
}
|
|
32
|
+
return r;
|
|
33
|
+
}
|
|
34
|
+
function y(t, a) {
|
|
35
|
+
const e = new Date(t);
|
|
36
|
+
e.setHours(0, 0, 0, 0);
|
|
37
|
+
for (const n of a) {
|
|
38
|
+
const s = new Date(n.startDate);
|
|
39
|
+
s.setHours(0, 0, 0, 0);
|
|
40
|
+
const c = new Date(n.endDate);
|
|
41
|
+
if (c.setHours(23, 59, 59, 999), e >= s && e <= c)
|
|
42
|
+
return {
|
|
43
|
+
year: n.startDate.getFullYear(),
|
|
44
|
+
month: n.startDate.getMonth(),
|
|
45
|
+
weekOfMonth: n.index + 1,
|
|
46
|
+
startDate: n.startDate,
|
|
47
|
+
endDate: n.endDate
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function d(t, a) {
|
|
52
|
+
const e = g(t, a), n = f(e, 6), s = new Date(t.getFullYear(), t.getMonth(), 1), c = new Date(t.getFullYear(), t.getMonth() + 1, 0), r = e < s ? new Date(s) : new Date(e), o = n > c ? new Date(c) : new Date(n), D = new Date(r.getFullYear(), r.getMonth(), 1).getDay(), i = r.getDate(), h = Math.ceil((i + D) / 7);
|
|
53
|
+
return {
|
|
54
|
+
year: r.getFullYear(),
|
|
55
|
+
month: r.getMonth(),
|
|
56
|
+
weekOfMonth: Math.max(1, h),
|
|
57
|
+
startDate: r,
|
|
58
|
+
endDate: o
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function k(t, a = {}) {
|
|
62
|
+
const {
|
|
63
|
+
calendarType: e = "calendar",
|
|
64
|
+
fiscalMode: n = "basic",
|
|
65
|
+
selectionMode: s = "week",
|
|
66
|
+
fiscalMonthPattern: c,
|
|
67
|
+
fiscalYearStartMonth: r = 1,
|
|
68
|
+
weekStartsOn: o = 1
|
|
69
|
+
} = a;
|
|
70
|
+
if (e === "calendar")
|
|
71
|
+
return d(t, o);
|
|
72
|
+
if (n === "basic" || s === "week")
|
|
73
|
+
return u(t, o);
|
|
74
|
+
const l = c ?? M["4-4-5"];
|
|
75
|
+
if (l.length !== 12)
|
|
76
|
+
return u(t, o);
|
|
77
|
+
const D = w(
|
|
78
|
+
t.getFullYear(),
|
|
79
|
+
l,
|
|
80
|
+
o,
|
|
81
|
+
r
|
|
82
|
+
), i = y(t, D);
|
|
83
|
+
if (i) return i;
|
|
84
|
+
const h = w(
|
|
85
|
+
t.getFullYear() - 1,
|
|
86
|
+
l,
|
|
87
|
+
o,
|
|
88
|
+
r
|
|
89
|
+
);
|
|
90
|
+
return y(t, h) ?? u(t, o);
|
|
91
|
+
}
|
|
92
|
+
export {
|
|
93
|
+
M as FISCAL_PATTERNS,
|
|
94
|
+
w as buildFiscalMonthCalendar,
|
|
95
|
+
d as getCalendarWeekSelection,
|
|
96
|
+
y as getFiscalMonthSelection,
|
|
97
|
+
u as getFiscalWeekSelection,
|
|
98
|
+
k as resolveWeekSelection
|
|
99
|
+
};
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { ClassValue } from 'clsx';
|
|
2
2
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
3
|
-
export declare function maskDate(value: string, formatStr: string): string;
|
|
3
|
+
export declare function maskDate(value: string, formatStr: string, previousValue?: string): string;
|
|
4
|
+
export declare function padValidDateString(value: string, formatStr: string): string;
|
package/dist/lib/utils.js
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
|
-
import { clsx as
|
|
2
|
-
import { twMerge as
|
|
3
|
-
function
|
|
4
|
-
return
|
|
1
|
+
import { clsx as f } from "clsx";
|
|
2
|
+
import { twMerge as d } from "tailwind-merge";
|
|
3
|
+
function x(...s) {
|
|
4
|
+
return d(f(s));
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
for (let
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
function P(s, g, l = "") {
|
|
7
|
+
if (!s) return "";
|
|
8
|
+
const r = g.replace(/[a-zA-Z]/g, "")[0] || "/", a = l && s.length < l.length, n = s.split(r), i = g.split(r), c = [];
|
|
9
|
+
for (let t = 0; t < n.length && !(t >= i.length); t++) {
|
|
10
|
+
let e = n[t].replace(/[^0-9]/g, "");
|
|
11
|
+
const o = i[t].length;
|
|
12
|
+
if (e.length > o) {
|
|
13
|
+
const p = e.substring(o);
|
|
14
|
+
e = e.substring(0, o), n[t + 1] !== void 0 ? n[t + 1] = p + n[t + 1] : n.push(p);
|
|
15
|
+
}
|
|
16
|
+
!a && t < n.length - 1 && e.length > 0 && e.length < o && (e = e.padStart(o, "0")), c.push(e);
|
|
12
17
|
}
|
|
13
|
-
|
|
18
|
+
let h = c.join(r);
|
|
19
|
+
if (!a) {
|
|
20
|
+
const t = c.length - 1;
|
|
21
|
+
t < i.length - 1 && c[t].length === i[t].length && (h.endsWith(r) || (h += r));
|
|
22
|
+
}
|
|
23
|
+
return h;
|
|
24
|
+
}
|
|
25
|
+
function b(s, g) {
|
|
26
|
+
if (!s) return "";
|
|
27
|
+
const l = g.replace(/[a-zA-Z]/g, "")[0] || "/", r = s.split(l), a = g.split(l);
|
|
28
|
+
return r.map((n, i) => a[i] && n ? n.padStart(a[i].length, "0") : n).join(l);
|
|
14
29
|
}
|
|
15
30
|
export {
|
|
16
|
-
|
|
17
|
-
|
|
31
|
+
x as cn,
|
|
32
|
+
P as maskDate,
|
|
33
|
+
b as padValidDateString
|
|
18
34
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
{
|
|
3
3
|
"name": "impact-nova",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"description": "Enterprise-grade React design system built with React 19, Vite, Tailwind CSS, and Radix UI. Comprehensive UI component library for scalable, accessible, and performant applications.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -550,8 +550,8 @@
|
|
|
550
550
|
"@vitejs/plugin-react": "^5.1.1",
|
|
551
551
|
"@vitest/browser-playwright": "^4.0.18",
|
|
552
552
|
"@vitest/coverage-v8": "^4.0.18",
|
|
553
|
-
"ag-grid-enterprise": "
|
|
554
|
-
"ag-grid-react": "
|
|
553
|
+
"ag-grid-enterprise": "35.0.1",
|
|
554
|
+
"ag-grid-react": "35.0.1",
|
|
555
555
|
"autoprefixer": "^10.4.23",
|
|
556
556
|
"eslint": "^9.39.1",
|
|
557
557
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
@@ -574,8 +574,8 @@
|
|
|
574
574
|
"vitest": "^4.0.18"
|
|
575
575
|
},
|
|
576
576
|
"peerDependencies": {
|
|
577
|
-
"ag-grid-enterprise": "
|
|
578
|
-
"ag-grid-react": "
|
|
577
|
+
"ag-grid-enterprise": "35.0.1",
|
|
578
|
+
"ag-grid-react": "35.0.1",
|
|
579
579
|
"highcharts": "^12.5.0",
|
|
580
580
|
"highcharts-border-radius": "^0.0.4",
|
|
581
581
|
"highcharts-react-official": "^3.2.3",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
import { OnChangeValue, SingleValue, MultiValue, Option } from '../../types/select.types';
|
|
3
|
-
interface UseClickOutsideProps<OptionType extends Option, IsMulti extends boolean> {
|
|
4
|
-
isOpen: boolean;
|
|
5
|
-
setIsOpen: (isOpen: boolean) => void;
|
|
6
|
-
triggerRef: RefObject<HTMLElement | null>;
|
|
7
|
-
menuRef: RefObject<HTMLElement | null>;
|
|
8
|
-
onMenuClose?: (finalValue?: OnChangeValue<OptionType, IsMulti>, finalSelectionOrder?: string[]) => void;
|
|
9
|
-
internalValue: SingleValue<OptionType> | MultiValue<OptionType>;
|
|
10
|
-
isMulti: boolean;
|
|
11
|
-
setSearchValue: (val: string) => void;
|
|
12
|
-
setActiveSubmenu: (val: string | null) => void;
|
|
13
|
-
}
|
|
14
|
-
export declare const useClickOutside: <OptionType extends Option, IsMulti extends boolean>({ isOpen, setIsOpen, triggerRef, menuRef, onMenuClose, internalValue, isMulti, setSearchValue, setActiveSubmenu, }: UseClickOutsideProps<OptionType, IsMulti>) => void;
|
|
15
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { useEffect as k } from "react";
|
|
2
|
-
import { isOptionArray as w } from "../utils/select.js";
|
|
3
|
-
const O = ({
|
|
4
|
-
isOpen: o,
|
|
5
|
-
setIsOpen: s,
|
|
6
|
-
triggerRef: e,
|
|
7
|
-
menuRef: c,
|
|
8
|
-
onMenuClose: i,
|
|
9
|
-
internalValue: n,
|
|
10
|
-
isMulti: r,
|
|
11
|
-
setSearchValue: d,
|
|
12
|
-
setActiveSubmenu: m
|
|
13
|
-
}) => {
|
|
14
|
-
k(() => {
|
|
15
|
-
const u = (f) => {
|
|
16
|
-
const t = f.target, a = e.current?.contains(t), l = c.current?.contains(t), v = t instanceof Element ? t.closest(".select-submenu-container") : null;
|
|
17
|
-
if (!a && !l && !v) {
|
|
18
|
-
if (o) {
|
|
19
|
-
s(!1);
|
|
20
|
-
const E = n, p = r && w(n) ? n.map((g) => g.value) : void 0;
|
|
21
|
-
i?.(E, p);
|
|
22
|
-
}
|
|
23
|
-
d(""), m(null);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
return document.addEventListener("mousedown", u), () => {
|
|
27
|
-
document.removeEventListener("mousedown", u);
|
|
28
|
-
};
|
|
29
|
-
}, [
|
|
30
|
-
o,
|
|
31
|
-
s,
|
|
32
|
-
e,
|
|
33
|
-
c,
|
|
34
|
-
i,
|
|
35
|
-
n,
|
|
36
|
-
r,
|
|
37
|
-
d,
|
|
38
|
-
m
|
|
39
|
-
]);
|
|
40
|
-
};
|
|
41
|
-
export {
|
|
42
|
-
O as useClickOutside
|
|
43
|
-
};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
export declare const useMenuPosition: (isOpen: boolean, triggerRef: RefObject<HTMLDivElement | null>, menuRef: RefObject<HTMLDivElement | null>, flatOptionsLength: number, isProcessing: boolean, dropdownZIndex?: number) => import('react').CSSProperties;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { useState as k, useRef as A, useLayoutEffect as D } from "react";
|
|
2
|
-
const K = (z, c, v, X, q, b) => {
|
|
3
|
-
const [B, S] = k({
|
|
4
|
-
opacity: 0
|
|
5
|
-
// Start hidden to prevent flash
|
|
6
|
-
}), l = A(null), E = A(null), y = A(!0);
|
|
7
|
-
return D(() => {
|
|
8
|
-
if (!z || !c.current) {
|
|
9
|
-
y.current || (S({ opacity: 0 }), y.current = !0);
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
y.current = !1;
|
|
13
|
-
const W = () => {
|
|
14
|
-
if (!c.current) return null;
|
|
15
|
-
const t = c.current.getBoundingClientRect(), e = window.innerWidth, M = window.innerHeight, i = window.scrollX, m = window.scrollY;
|
|
16
|
-
let w = 320;
|
|
17
|
-
v.current && (w = v.current.getBoundingClientRect().height || 320);
|
|
18
|
-
const s = t.width, r = 4, j = M - t.bottom, x = t.top, O = e - t.right, U = t.left;
|
|
19
|
-
let n = "bottom", a = 0, o = 0, g = "";
|
|
20
|
-
j >= w + r ? (n = "bottom", a = t.bottom + m + r, o = t.left + i) : x >= w + r ? (n = "top", a = t.top + m - w - r, o = t.left + i) : O >= s + r ? (n = "right", a = t.top + m, o = t.right + i + r, g = "translateY(0)") : U >= s + r ? (n = "left", a = t.top + m, o = t.left + i - s - r, g = "translateY(0)") : (n = "bottom", a = t.bottom + m + r, o = t.left + i);
|
|
21
|
-
let d = o - i;
|
|
22
|
-
return d + s > e && (d = Math.max(0, e - s)), d < 0 && (d = 0), o = d + i, {
|
|
23
|
-
top: a,
|
|
24
|
-
left: o,
|
|
25
|
-
width: n === "bottom" || n === "top" ? s : "auto",
|
|
26
|
-
minWidth: n === "right" || n === "left" ? s : void 0,
|
|
27
|
-
position: n,
|
|
28
|
-
transform: g
|
|
29
|
-
};
|
|
30
|
-
}, Y = (t) => {
|
|
31
|
-
const e = E.current;
|
|
32
|
-
(!e || e.top !== t.top || e.left !== t.left || e.width !== t.width || e.position !== t.position) && (E.current = {
|
|
33
|
-
top: t.top,
|
|
34
|
-
left: t.left,
|
|
35
|
-
width: t.width,
|
|
36
|
-
position: t.position
|
|
37
|
-
}, S({
|
|
38
|
-
position: "absolute",
|
|
39
|
-
top: t.top,
|
|
40
|
-
left: t.left,
|
|
41
|
-
width: t.width,
|
|
42
|
-
minWidth: t.minWidth,
|
|
43
|
-
zIndex: typeof b == "number" ? b : 20,
|
|
44
|
-
transform: t.transform,
|
|
45
|
-
opacity: 1
|
|
46
|
-
// Make visible
|
|
47
|
-
}));
|
|
48
|
-
}, F = () => {
|
|
49
|
-
l.current !== null && cancelAnimationFrame(l.current), l.current = requestAnimationFrame(() => {
|
|
50
|
-
const t = W();
|
|
51
|
-
t && (Y(t), l.current = null);
|
|
52
|
-
});
|
|
53
|
-
}, R = W();
|
|
54
|
-
R && Y(R);
|
|
55
|
-
const C = new ResizeObserver(() => {
|
|
56
|
-
F();
|
|
57
|
-
});
|
|
58
|
-
C.observe(c.current);
|
|
59
|
-
let f = null;
|
|
60
|
-
const H = () => {
|
|
61
|
-
f === null && (f = requestAnimationFrame(() => {
|
|
62
|
-
F(), f = null;
|
|
63
|
-
}));
|
|
64
|
-
};
|
|
65
|
-
let p = null;
|
|
66
|
-
const h = () => {
|
|
67
|
-
p === null && (p = requestAnimationFrame(() => {
|
|
68
|
-
F(), p = null;
|
|
69
|
-
}));
|
|
70
|
-
}, L = [];
|
|
71
|
-
let u = c.current?.parentElement;
|
|
72
|
-
for (; u; ) {
|
|
73
|
-
const t = window.getComputedStyle(u).overflowY, e = window.getComputedStyle(u).overflowX;
|
|
74
|
-
(t === "auto" || t === "scroll" || e === "auto" || e === "scroll") && L.push(u), u = u.parentElement;
|
|
75
|
-
}
|
|
76
|
-
return L.forEach((t) => {
|
|
77
|
-
t.addEventListener("scroll", h, {
|
|
78
|
-
passive: !0
|
|
79
|
-
});
|
|
80
|
-
}), window.addEventListener("resize", H, { passive: !0 }), window.addEventListener("scroll", h, { passive: !0, capture: !0 }), () => {
|
|
81
|
-
l.current !== null && (cancelAnimationFrame(l.current), l.current = null), f !== null && cancelAnimationFrame(f), p !== null && cancelAnimationFrame(p), C.disconnect(), L.forEach((t) => {
|
|
82
|
-
t.removeEventListener("scroll", h);
|
|
83
|
-
}), window.removeEventListener("resize", H), window.removeEventListener("scroll", h, !0), E.current = null;
|
|
84
|
-
};
|
|
85
|
-
}, [z, X, c, v, q, b]), B;
|
|
86
|
-
};
|
|
87
|
-
export {
|
|
88
|
-
K as useMenuPosition
|
|
89
|
-
};
|