@rafal.lemieszewski/tide-ui 0.83.0 → 0.84.3
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/README.md +20 -8
- package/dist/cjs/components/core-index.cjs +1 -0
- package/dist/cjs/components/fundamental/accordion.cjs +1 -0
- package/dist/cjs/components/fundamental/alert-dialog.cjs +1 -0
- package/dist/cjs/components/fundamental/alert.cjs +1 -0
- package/dist/cjs/components/fundamental/autocomplete-search.cjs +1 -0
- package/dist/cjs/components/fundamental/avatar-group.cjs +1 -0
- package/dist/cjs/components/fundamental/avatar.cjs +1 -0
- package/dist/cjs/components/fundamental/badge.cjs +1 -0
- package/dist/cjs/components/fundamental/breadcrumb.cjs +1 -0
- package/dist/cjs/components/fundamental/button-group.cjs +1 -0
- package/dist/cjs/components/fundamental/button.cjs +1 -0
- package/dist/cjs/components/fundamental/calendar.cjs +1 -0
- package/dist/cjs/components/fundamental/card.cjs +1 -0
- package/dist/cjs/components/fundamental/chart.cjs +1 -0
- package/dist/cjs/components/fundamental/checkbox.cjs +1 -0
- package/dist/cjs/components/fundamental/collapsible.cjs +1 -0
- package/dist/cjs/components/fundamental/combobox.cjs +1 -0
- package/dist/cjs/components/fundamental/command.cjs +1 -0
- package/dist/cjs/components/fundamental/country-dropdown.cjs +1 -0
- package/dist/cjs/components/fundamental/custom-icons.cjs +1 -0
- package/dist/cjs/components/fundamental/date-picker.cjs +1 -0
- package/dist/cjs/components/fundamental/dialog.cjs +1 -0
- package/dist/cjs/components/fundamental/drawer.cjs +1 -0
- package/dist/cjs/components/fundamental/dropdown-menu.cjs +1 -0
- package/dist/cjs/components/fundamental/editable.cjs +1 -0
- package/dist/cjs/components/fundamental/empty.cjs +1 -0
- package/dist/cjs/components/fundamental/file-upload.cjs +1 -0
- package/dist/cjs/components/fundamental/flag.cjs +1 -0
- package/dist/cjs/components/fundamental/form-field.cjs +1 -0
- package/dist/cjs/components/fundamental/hover-card.cjs +1 -0
- package/dist/cjs/components/fundamental/icon.cjs +1 -0
- package/dist/cjs/components/fundamental/input-group.cjs +1 -0
- package/dist/cjs/components/fundamental/input.cjs +1 -0
- package/dist/cjs/components/fundamental/kbd.cjs +1 -0
- package/dist/cjs/components/fundamental/label.cjs +1 -0
- package/dist/cjs/components/fundamental/month-picker.cjs +1 -0
- package/dist/cjs/components/fundamental/pagination.cjs +1 -0
- package/dist/cjs/components/fundamental/popover.cjs +1 -0
- package/dist/cjs/components/fundamental/progress.cjs +1 -0
- package/dist/cjs/components/fundamental/radio-group.cjs +1 -0
- package/dist/cjs/components/fundamental/resizable.cjs +1 -0
- package/dist/cjs/components/fundamental/scroll-area.cjs +1 -0
- package/dist/cjs/components/fundamental/select.cjs +1 -0
- package/dist/cjs/components/fundamental/separator.cjs +1 -0
- package/dist/cjs/components/fundamental/sheet.cjs +1 -0
- package/dist/cjs/components/fundamental/sidebar.cjs +1 -0
- package/dist/cjs/components/fundamental/skeleton.cjs +1 -0
- package/dist/cjs/components/fundamental/slider.cjs +1 -0
- package/dist/cjs/components/fundamental/spinner.cjs +1 -0
- package/dist/cjs/components/fundamental/switch.cjs +1 -0
- package/dist/cjs/components/fundamental/table.cjs +1 -0
- package/dist/cjs/components/fundamental/tabs.cjs +1 -0
- package/dist/cjs/components/fundamental/tag.cjs +27 -0
- package/dist/cjs/components/fundamental/text-link.cjs +1 -0
- package/dist/cjs/components/fundamental/textarea.cjs +1 -0
- package/dist/cjs/components/fundamental/toast.cjs +1 -0
- package/dist/cjs/components/fundamental/toggle-group.cjs +1 -0
- package/dist/cjs/components/fundamental/toggle.cjs +1 -0
- package/dist/cjs/components/fundamental/tooltip.cjs +1 -0
- package/dist/cjs/components/fundamental/tree.cjs +1 -0
- package/dist/cjs/components/product/activity-log.cjs +1 -0
- package/dist/cjs/components/product/app-frame.cjs +1 -0
- package/dist/cjs/components/product/attributes-list.cjs +1 -0
- package/dist/cjs/components/product/bookmarks.cjs +1 -0
- package/dist/cjs/components/product/data-table-settings-menu.cjs +1 -0
- package/dist/cjs/components/product/data-table.cjs +1 -0
- package/dist/cjs/components/product/filters.cjs +1 -0
- package/dist/cjs/components/product/fixture-status.cjs +1 -0
- package/dist/cjs/components/product/linked-chart.cjs +1 -0
- package/dist/cjs/components/product/view-mode-menu.cjs +1 -0
- package/dist/cjs/lib/date-utils.cjs +1 -0
- package/dist/cjs/lib/hooks.cjs +1 -0
- package/dist/cjs/lib/index.cjs +1 -0
- package/dist/cjs/lib/utils.cjs +1 -0
- package/dist/es/components/core-index.js +37 -0
- package/dist/es/components/fundamental/accordion.js +60 -0
- package/dist/es/components/fundamental/alert-dialog.js +116 -0
- package/dist/es/components/fundamental/alert.js +65 -0
- package/dist/es/components/fundamental/autocomplete-search.js +139 -0
- package/dist/es/components/fundamental/avatar-group.js +51 -0
- package/dist/es/components/fundamental/avatar.js +165 -0
- package/dist/es/components/fundamental/badge.js +157 -0
- package/dist/es/components/fundamental/breadcrumb.js +142 -0
- package/dist/es/components/fundamental/button-group.js +86 -0
- package/dist/es/components/fundamental/button.js +186 -0
- package/dist/es/components/fundamental/calendar.js +130 -0
- package/dist/es/components/fundamental/card.js +68 -0
- package/dist/es/components/fundamental/chart.js +1006 -0
- package/dist/es/components/fundamental/checkbox.js +51 -0
- package/dist/es/components/fundamental/collapsible.js +55 -0
- package/dist/es/components/fundamental/combobox.js +229 -0
- package/dist/es/components/fundamental/command.js +155 -0
- package/dist/es/components/fundamental/country-dropdown.js +215 -0
- package/dist/es/components/fundamental/custom-icons.js +876 -0
- package/dist/es/components/fundamental/date-picker.js +119 -0
- package/dist/es/components/fundamental/dialog.js +106 -0
- package/dist/es/components/fundamental/drawer.js +93 -0
- package/dist/es/components/fundamental/dropdown-menu.js +600 -0
- package/dist/es/components/fundamental/editable.js +123 -0
- package/dist/es/components/fundamental/empty.js +152 -0
- package/dist/es/components/fundamental/file-upload.js +289 -0
- package/dist/es/components/fundamental/flag.js +60 -0
- package/dist/es/components/fundamental/form-field.js +352 -0
- package/dist/es/components/fundamental/hover-card.js +23 -0
- package/dist/es/components/fundamental/icon.js +200 -0
- package/dist/es/components/fundamental/input-group.js +135 -0
- package/dist/es/components/fundamental/input.js +78 -0
- package/dist/es/components/fundamental/kbd.js +57 -0
- package/dist/es/components/fundamental/label.js +54 -0
- package/dist/es/components/fundamental/month-picker.js +161 -0
- package/dist/es/components/fundamental/pagination.js +109 -0
- package/dist/es/components/fundamental/popover.js +24 -0
- package/dist/es/components/fundamental/progress.js +66 -0
- package/dist/es/components/fundamental/radio-group.js +64 -0
- package/dist/es/components/fundamental/resizable.js +43 -0
- package/dist/es/components/fundamental/scroll-area.js +38 -0
- package/dist/es/components/fundamental/select.js +136 -0
- package/dist/es/components/fundamental/separator.js +47 -0
- package/dist/es/components/fundamental/sheet.js +134 -0
- package/dist/es/components/fundamental/sidebar.js +709 -0
- package/dist/es/components/fundamental/skeleton.js +158 -0
- package/dist/es/components/fundamental/slider.js +35 -0
- package/dist/es/components/fundamental/spinner.js +225 -0
- package/dist/es/components/fundamental/switch.js +27 -0
- package/dist/es/components/fundamental/table.js +263 -0
- package/dist/es/components/fundamental/tabs.js +170 -0
- package/dist/es/components/fundamental/tag.js +295 -0
- package/dist/es/components/fundamental/text-link.js +105 -0
- package/dist/es/components/fundamental/textarea.js +47 -0
- package/dist/es/components/fundamental/toast.js +108 -0
- package/dist/es/components/fundamental/toggle-group.js +37 -0
- package/dist/es/components/fundamental/toggle.js +51 -0
- package/dist/es/components/fundamental/tooltip.js +26 -0
- package/dist/es/components/fundamental/tree.js +161 -0
- package/dist/es/components/product/activity-log.js +231 -0
- package/dist/es/components/product/app-frame.js +985 -0
- package/dist/es/components/product/attributes-list.js +351 -0
- package/dist/es/components/product/bookmarks.js +833 -0
- package/dist/es/components/product/data-table-settings-menu.js +169 -0
- package/dist/es/components/product/data-table.js +2473 -0
- package/dist/es/components/product/filters.js +1041 -0
- package/dist/es/components/product/fixture-status.js +178 -0
- package/dist/es/components/product/linked-chart.js +179 -0
- package/dist/es/components/product/view-mode-menu.js +353 -0
- package/dist/es/lib/date-utils.js +151 -0
- package/dist/es/lib/hooks.js +29 -0
- package/dist/es/lib/index.js +348 -0
- package/dist/es/lib/utils.js +8 -0
- package/dist/es/style.css +1 -0
- package/dist/types/bookmarks.d.ts +2 -0
- package/dist/types/calendar.d.ts +2 -0
- package/dist/types/chart.d.ts +2 -0
- package/dist/types/components/core-index.d.cts +135 -0
- package/dist/types/components/core-index.d.ts +135 -0
- package/dist/{components → types/components}/fundamental/avatar.d.ts +3 -3
- package/dist/{components → types/components}/fundamental/badge.d.ts +2 -2
- package/dist/{components → types/components}/fundamental/button-group.d.ts +2 -2
- package/dist/{components → types/components}/fundamental/button.d.ts +1 -1
- package/dist/types/components/fundamental/calendar.d.ts +7 -0
- package/dist/types/components/fundamental/chart.d.ts +95 -0
- package/dist/{components → types/components}/fundamental/command.d.ts +2 -2
- package/dist/types/components/fundamental/country-dropdown.d.ts +34 -0
- package/dist/types/components/fundamental/date-picker.d.ts +30 -0
- package/dist/{components → types/components}/fundamental/file-upload.d.ts +1 -1
- package/dist/{components → types/components}/fundamental/form-field.d.ts +2 -2
- package/dist/{components → types/components}/fundamental/form.d.ts +2 -2
- package/dist/{components → types/components}/fundamental/icon.d.ts +1 -1
- package/dist/{components → types/components}/fundamental/input-group.d.ts +1 -1
- package/dist/types/components/fundamental/resizable.d.cts +23 -0
- package/dist/{components → types/components}/fundamental/resizable.d.ts +1 -1
- package/dist/{components → types/components}/fundamental/sidebar.d.ts +3 -3
- package/dist/{components → types/components}/fundamental/spinner.d.ts +1 -1
- package/dist/{components → types/components}/fundamental/table.d.ts +3 -3
- package/dist/{components → types/components}/fundamental/text-link.d.ts +1 -1
- package/dist/{components → types/components}/index.d.ts +118 -118
- package/dist/{components → types/components}/product/activity-log.d.ts +1 -1
- package/dist/{components → types/components}/product/attributes-list.d.ts +1 -1
- package/dist/types/components/product/bookmarks.d.cts +90 -0
- package/dist/{components → types/components}/product/bookmarks.d.ts +1 -1
- package/dist/types/components/product/data-table.d.ts +802 -0
- package/dist/types/components/product/filters.d.ts +124 -0
- package/dist/{components → types/components}/product/fixture-status.d.ts +1 -1
- package/dist/types/components/product/linked-chart.d.cts +22 -0
- package/dist/{components → types/components}/product/linked-chart.d.ts +1 -1
- package/dist/types/country-dropdown.d.ts +2 -0
- package/dist/types/data-table.d.ts +2 -0
- package/dist/types/date-picker.d.ts +2 -0
- package/dist/types/filters.d.ts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/lib/index.d.cts +104 -0
- package/dist/types/lib/index.d.ts +104 -0
- package/dist/types/linked-chart.d.ts +2 -0
- package/dist/types/resizable.d.ts +2 -0
- package/package.json +191 -31
- package/dist/index.cjs.js +0 -144
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.es.js +0 -87768
- package/dist/index.es.js.map +0 -1
- package/dist/lib/index.d.ts +0 -3
- package/dist/style.css +0 -1
- /package/dist/{components → types/components}/fundamental/accordion.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/alert-dialog.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/alert.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/autocomplete-search.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/avatar-group.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/breadcrumb.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/button.test.d.ts +0 -0
- /package/dist/{components/fundamental/calendar.d.ts → types/components/fundamental/calendar.d.cts} +0 -0
- /package/dist/{components → types/components}/fundamental/card.d.ts +0 -0
- /package/dist/{components/fundamental/chart.d.ts → types/components/fundamental/chart.d.cts} +0 -0
- /package/dist/{components → types/components}/fundamental/checkbox.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/collapsible.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/combobox.d.ts +0 -0
- /package/dist/{components/fundamental/country-dropdown.d.ts → types/components/fundamental/country-dropdown.d.cts} +0 -0
- /package/dist/{components → types/components}/fundamental/custom-icons.d.ts +0 -0
- /package/dist/{components/fundamental/date-picker.d.ts → types/components/fundamental/date-picker.d.cts} +0 -0
- /package/dist/{components → types/components}/fundamental/dialog.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/drawer.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/dropdown-menu.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/editable.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/empty.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/flag.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/hover-card.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/input.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/kbd.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/label.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/month-picker.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/pagination.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/popover.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/progress.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/radio-group.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/scroll-area.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/select.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/separator.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/sheet.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/skeleton.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/slider.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/switch.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/tabs.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/tag.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/textarea.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/toast.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/toggle-group.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/toggle.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/tooltip.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/tree.d.ts +0 -0
- /package/dist/{components → types/components}/product/app-frame.d.ts +0 -0
- /package/dist/{components → types/components}/product/data-table-settings-menu.d.ts +0 -0
- /package/dist/{components/product/data-table.d.ts → types/components/product/data-table.d.cts} +0 -0
- /package/dist/{components/product/filters.d.ts → types/components/product/filters.d.cts} +0 -0
- /package/dist/{components → types/components}/product/view-mode-menu.d.ts +0 -0
- /package/dist/{lib → types/lib}/date-utils.d.ts +0 -0
- /package/dist/{lib → types/lib}/hooks.d.ts +0 -0
- /package/dist/{lib → types/lib}/utils.d.ts +0 -0
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { jsxs as s, jsx as n, Fragment as v } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ne, useState as V, useImperativeHandle as le, useEffect as T } from "react";
|
|
3
|
+
import { Button as se } from "../fundamental/button.js";
|
|
4
|
+
import { DropdownMenu as re, DropdownMenuTrigger as ie, DropdownMenuContent as te, DropdownMenuSeparator as F } from "../fundamental/dropdown-menu.js";
|
|
5
|
+
import { Select as d, SelectTrigger as h, SelectValue as u, SelectContent as m, SelectItem as a } from "../fundamental/select.js";
|
|
6
|
+
import { Toggle as ae } from "../fundamental/toggle.js";
|
|
7
|
+
import { Tabs as oe, TabsList as ce, TabsTrigger as y } from "../fundamental/tabs.js";
|
|
8
|
+
import { Switch as de } from "../fundamental/switch.js";
|
|
9
|
+
import { Label as he } from "../fundamental/label.js";
|
|
10
|
+
import { Icon as w } from "../fundamental/icon.js";
|
|
11
|
+
import { Input as ue } from "../fundamental/input.js";
|
|
12
|
+
function me(i) {
|
|
13
|
+
if (!i) return null;
|
|
14
|
+
try {
|
|
15
|
+
const c = localStorage.getItem(i);
|
|
16
|
+
return c ? JSON.parse(c) : null;
|
|
17
|
+
} catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function ge(i, c) {
|
|
22
|
+
if (i)
|
|
23
|
+
try {
|
|
24
|
+
localStorage.setItem(i, JSON.stringify(c));
|
|
25
|
+
} catch (g) {
|
|
26
|
+
console.warn("Failed to save settings to localStorage:", g);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function L(i = "table", c = []) {
|
|
30
|
+
return {
|
|
31
|
+
viewMode: i,
|
|
32
|
+
table: {
|
|
33
|
+
sortDirection: "asc",
|
|
34
|
+
visibleColumns: c.map((g) => g.id)
|
|
35
|
+
// Initialize with all columns visible
|
|
36
|
+
},
|
|
37
|
+
columns: {
|
|
38
|
+
sortDirection: "asc"
|
|
39
|
+
},
|
|
40
|
+
folders: {
|
|
41
|
+
sortDirection: "asc",
|
|
42
|
+
showFoldersFirst: !1
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function M(i) {
|
|
47
|
+
if (i?.directionOptions)
|
|
48
|
+
return i.directionOptions;
|
|
49
|
+
if (i?.dataType)
|
|
50
|
+
switch (i.dataType) {
|
|
51
|
+
case "text":
|
|
52
|
+
return { asc: "A to Z", desc: "Z to A" };
|
|
53
|
+
case "number":
|
|
54
|
+
return { asc: "Ascending", desc: "Descending" };
|
|
55
|
+
case "date":
|
|
56
|
+
return { asc: "Oldest first", desc: "Newest first" };
|
|
57
|
+
case "boolean":
|
|
58
|
+
return { asc: "False first", desc: "True first" };
|
|
59
|
+
}
|
|
60
|
+
return { asc: "Ascending", desc: "Descending" };
|
|
61
|
+
}
|
|
62
|
+
const pe = ne(
|
|
63
|
+
function({
|
|
64
|
+
persistenceKey: c,
|
|
65
|
+
defaultViewMode: g = "table",
|
|
66
|
+
sortableColumns: C = [],
|
|
67
|
+
groupableColumns: D = [],
|
|
68
|
+
columns: p = [],
|
|
69
|
+
columnsSortableColumns: x,
|
|
70
|
+
columnsGroupableColumns: f,
|
|
71
|
+
foldersSortableColumns: b,
|
|
72
|
+
align: O = "end",
|
|
73
|
+
triggerClassName: R
|
|
74
|
+
}, j) {
|
|
75
|
+
const [r, t] = V(() => {
|
|
76
|
+
const e = me(c);
|
|
77
|
+
return e || L(g, p);
|
|
78
|
+
}), [N, A] = V("");
|
|
79
|
+
le(j, () => ({
|
|
80
|
+
getSettings: () => r,
|
|
81
|
+
reset: () => {
|
|
82
|
+
t(L(g, p));
|
|
83
|
+
}
|
|
84
|
+
})), T(() => {
|
|
85
|
+
ge(c, r);
|
|
86
|
+
}, [r, c]), T(() => {
|
|
87
|
+
r.viewMode === "columns" && !r.columns.groupColumn && f && f.length > 0 && t((e) => ({
|
|
88
|
+
...e,
|
|
89
|
+
columns: {
|
|
90
|
+
...e.columns,
|
|
91
|
+
groupColumn: f[0].id
|
|
92
|
+
}
|
|
93
|
+
}));
|
|
94
|
+
}, [r.viewMode, r.columns.groupColumn, f]);
|
|
95
|
+
const W = C.length > 0, I = D.length > 0, P = p.length > 0, J = (x?.length ?? 0) > 0, S = (f?.length ?? 0) > 0, z = (b?.length ?? 0) > 0, Z = 1 + (z ? 1 : 0) + (S ? 1 : 0) > 1, B = N ? p.filter(
|
|
96
|
+
(e) => e.label.toLowerCase().includes(N.toLowerCase())
|
|
97
|
+
) : p, E = p.length >= 20, G = (e) => {
|
|
98
|
+
t((l) => ({ ...l, viewMode: e }));
|
|
99
|
+
}, H = (e) => {
|
|
100
|
+
t((l) => ({
|
|
101
|
+
...l,
|
|
102
|
+
table: { ...l.table, sortColumn: e }
|
|
103
|
+
}));
|
|
104
|
+
}, k = (e) => {
|
|
105
|
+
t((l) => ({
|
|
106
|
+
...l,
|
|
107
|
+
table: { ...l.table, sortDirection: e }
|
|
108
|
+
}));
|
|
109
|
+
}, q = (e) => {
|
|
110
|
+
t((l) => ({
|
|
111
|
+
...l,
|
|
112
|
+
table: { ...l.table, groupColumn: e === "none" ? void 0 : e }
|
|
113
|
+
}));
|
|
114
|
+
}, Q = (e, l) => {
|
|
115
|
+
t((o) => ({
|
|
116
|
+
...o,
|
|
117
|
+
table: {
|
|
118
|
+
...o.table,
|
|
119
|
+
visibleColumns: l ? [...o.table.visibleColumns, e] : o.table.visibleColumns.filter((ee) => ee !== e)
|
|
120
|
+
}
|
|
121
|
+
}));
|
|
122
|
+
}, U = (e) => {
|
|
123
|
+
t((l) => ({
|
|
124
|
+
...l,
|
|
125
|
+
columns: { ...l.columns, sortColumn: e }
|
|
126
|
+
}));
|
|
127
|
+
}, X = (e) => {
|
|
128
|
+
t((l) => ({
|
|
129
|
+
...l,
|
|
130
|
+
columns: { ...l.columns, sortDirection: e }
|
|
131
|
+
}));
|
|
132
|
+
}, Y = (e) => {
|
|
133
|
+
t((l) => ({
|
|
134
|
+
...l,
|
|
135
|
+
columns: { ...l.columns, groupColumn: e === "none" ? void 0 : e }
|
|
136
|
+
}));
|
|
137
|
+
}, _ = (e) => {
|
|
138
|
+
t((l) => ({
|
|
139
|
+
...l,
|
|
140
|
+
folders: { ...l.folders, sortColumn: e }
|
|
141
|
+
}));
|
|
142
|
+
}, $ = (e) => {
|
|
143
|
+
t((l) => ({
|
|
144
|
+
...l,
|
|
145
|
+
folders: { ...l.folders, sortDirection: e }
|
|
146
|
+
}));
|
|
147
|
+
}, K = (e) => {
|
|
148
|
+
t((l) => ({
|
|
149
|
+
...l,
|
|
150
|
+
folders: { ...l.folders, showFoldersFirst: e }
|
|
151
|
+
}));
|
|
152
|
+
};
|
|
153
|
+
return /* @__PURE__ */ s(re, { children: [
|
|
154
|
+
/* @__PURE__ */ n(ie, { asChild: !0, children: /* @__PURE__ */ n(
|
|
155
|
+
se,
|
|
156
|
+
{
|
|
157
|
+
size: "m",
|
|
158
|
+
icon: "settings",
|
|
159
|
+
className: R
|
|
160
|
+
}
|
|
161
|
+
) }),
|
|
162
|
+
/* @__PURE__ */ s(te, { align: O, className: "w-72 max-w-[90vw]", children: [
|
|
163
|
+
Z && /* @__PURE__ */ s(v, { children: [
|
|
164
|
+
/* @__PURE__ */ s("div", { className: "px-3 pt-3 pb-2", children: [
|
|
165
|
+
/* @__PURE__ */ n("h3", { className: "text-label-sm text-[var(--color-text-tertiary)] mb-2", children: "View mode" }),
|
|
166
|
+
/* @__PURE__ */ n(oe, { value: r.viewMode, onValueChange: G, children: /* @__PURE__ */ s(ce, { variant: "pilled", size: "s", fullWidth: !0, children: [
|
|
167
|
+
/* @__PURE__ */ n(y, { variant: "pilled", size: "s", fullWidth: !0, value: "table", children: "Table" }),
|
|
168
|
+
z && /* @__PURE__ */ n(y, { variant: "pilled", size: "s", fullWidth: !0, value: "folders", children: "Folders" }),
|
|
169
|
+
S && /* @__PURE__ */ n(y, { variant: "pilled", size: "s", fullWidth: !0, value: "columns", children: "Columns" })
|
|
170
|
+
] }) })
|
|
171
|
+
] }),
|
|
172
|
+
/* @__PURE__ */ n(F, {})
|
|
173
|
+
] }),
|
|
174
|
+
/* @__PURE__ */ s("div", { className: "p-3", children: [
|
|
175
|
+
r.viewMode === "table" && /* @__PURE__ */ s("div", { className: "space-y-4", children: [
|
|
176
|
+
W && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
177
|
+
/* @__PURE__ */ n("h4", { className: "text-label-sm text-[var(--color-text-tertiary)]", children: "Sorting" }),
|
|
178
|
+
/* @__PURE__ */ s("div", { className: "flex flex-col gap-2", children: [
|
|
179
|
+
/* @__PURE__ */ s(d, { value: r.table.sortColumn, onValueChange: H, children: [
|
|
180
|
+
/* @__PURE__ */ n(h, { size: "s", children: /* @__PURE__ */ n(u, { placeholder: "Select column to sort" }) }),
|
|
181
|
+
/* @__PURE__ */ n(m, { children: C.map((e) => /* @__PURE__ */ n(a, { value: e.id, children: e.label }, e.id)) })
|
|
182
|
+
] }),
|
|
183
|
+
r.table.sortColumn && /* @__PURE__ */ s(
|
|
184
|
+
d,
|
|
185
|
+
{
|
|
186
|
+
value: r.table.sortDirection,
|
|
187
|
+
onValueChange: (e) => k(e),
|
|
188
|
+
children: [
|
|
189
|
+
/* @__PURE__ */ n(h, { size: "s", children: /* @__PURE__ */ n(u, {}) }),
|
|
190
|
+
/* @__PURE__ */ n(m, { children: (() => {
|
|
191
|
+
const e = C.find((o) => o.id === r.table.sortColumn), l = M(e);
|
|
192
|
+
return /* @__PURE__ */ s(v, { children: [
|
|
193
|
+
/* @__PURE__ */ n(a, { value: "asc", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
194
|
+
/* @__PURE__ */ n(w, { name: "arrow-down-narrow-wide", size: "s" }),
|
|
195
|
+
/* @__PURE__ */ n("span", { children: l.asc })
|
|
196
|
+
] }) }),
|
|
197
|
+
/* @__PURE__ */ n(a, { value: "desc", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
198
|
+
/* @__PURE__ */ n(w, { name: "arrow-down-wide-narrow", size: "s" }),
|
|
199
|
+
/* @__PURE__ */ n("span", { children: l.desc })
|
|
200
|
+
] }) })
|
|
201
|
+
] });
|
|
202
|
+
})() })
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
] })
|
|
207
|
+
] }),
|
|
208
|
+
I && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
209
|
+
/* @__PURE__ */ n("h4", { className: "text-label-sm text-[var(--color-text-tertiary)]", children: "Grouping" }),
|
|
210
|
+
/* @__PURE__ */ s(d, { value: r.table.groupColumn || "none", onValueChange: q, children: [
|
|
211
|
+
/* @__PURE__ */ n(h, { size: "s", children: /* @__PURE__ */ n(u, { placeholder: "Select column to group by" }) }),
|
|
212
|
+
/* @__PURE__ */ s(m, { children: [
|
|
213
|
+
/* @__PURE__ */ n(a, { value: "none", children: "None" }),
|
|
214
|
+
D.map((e) => /* @__PURE__ */ n(a, { value: e.id, children: e.label }, e.id))
|
|
215
|
+
] })
|
|
216
|
+
] })
|
|
217
|
+
] }),
|
|
218
|
+
P && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
219
|
+
/* @__PURE__ */ n("h4", { className: "text-label-sm text-[var(--color-text-tertiary)]", children: "Display columns" }),
|
|
220
|
+
E && /* @__PURE__ */ n(
|
|
221
|
+
ue,
|
|
222
|
+
{
|
|
223
|
+
type: "search",
|
|
224
|
+
size: "s",
|
|
225
|
+
placeholder: "Search columns...",
|
|
226
|
+
value: N,
|
|
227
|
+
onChange: (e) => A(e.target.value)
|
|
228
|
+
}
|
|
229
|
+
),
|
|
230
|
+
/* @__PURE__ */ n("div", { className: "flex flex-wrap items-start justify-start gap-1 max-h-[190px] overflow-y-auto", children: B.map((e) => {
|
|
231
|
+
const l = r.table.visibleColumns.includes(e.id);
|
|
232
|
+
return /* @__PURE__ */ n(
|
|
233
|
+
ae,
|
|
234
|
+
{
|
|
235
|
+
variant: "outline",
|
|
236
|
+
size: "s",
|
|
237
|
+
pressed: l,
|
|
238
|
+
onPressedChange: (o) => {
|
|
239
|
+
Q(e.id, o);
|
|
240
|
+
},
|
|
241
|
+
children: e.label
|
|
242
|
+
},
|
|
243
|
+
e.id
|
|
244
|
+
);
|
|
245
|
+
}) })
|
|
246
|
+
] })
|
|
247
|
+
] }),
|
|
248
|
+
r.viewMode === "folders" && b && b.length > 0 && /* @__PURE__ */ n(v, { children: /* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
249
|
+
/* @__PURE__ */ n("h4", { className: "text-label-sm text-[var(--color-text-tertiary)]", children: "Sorting" }),
|
|
250
|
+
/* @__PURE__ */ s("div", { className: "flex flex-col gap-2", children: [
|
|
251
|
+
/* @__PURE__ */ s(
|
|
252
|
+
d,
|
|
253
|
+
{
|
|
254
|
+
value: r.folders.sortColumn,
|
|
255
|
+
onValueChange: _,
|
|
256
|
+
children: [
|
|
257
|
+
/* @__PURE__ */ n(h, { size: "s", children: /* @__PURE__ */ n(u, { placeholder: "Select column" }) }),
|
|
258
|
+
/* @__PURE__ */ n(m, { children: b.map((e) => /* @__PURE__ */ n(a, { value: e.id, children: e.label }, e.id)) })
|
|
259
|
+
]
|
|
260
|
+
}
|
|
261
|
+
),
|
|
262
|
+
r.folders.sortColumn && /* @__PURE__ */ s(
|
|
263
|
+
d,
|
|
264
|
+
{
|
|
265
|
+
value: r.folders.sortDirection,
|
|
266
|
+
onValueChange: (e) => $(e),
|
|
267
|
+
children: [
|
|
268
|
+
/* @__PURE__ */ n(h, { size: "s", children: /* @__PURE__ */ n(u, {}) }),
|
|
269
|
+
/* @__PURE__ */ n(m, { children: (() => {
|
|
270
|
+
const e = b.find((o) => o.id === r.folders.sortColumn), l = M(e);
|
|
271
|
+
return /* @__PURE__ */ s(v, { children: [
|
|
272
|
+
/* @__PURE__ */ n(a, { value: "asc", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
273
|
+
/* @__PURE__ */ n(w, { name: "arrow-down-narrow-wide", size: "s" }),
|
|
274
|
+
/* @__PURE__ */ n("span", { children: l.asc })
|
|
275
|
+
] }) }),
|
|
276
|
+
/* @__PURE__ */ n(a, { value: "desc", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
277
|
+
/* @__PURE__ */ n(w, { name: "arrow-down-wide-narrow", size: "s" }),
|
|
278
|
+
/* @__PURE__ */ n("span", { children: l.desc })
|
|
279
|
+
] }) })
|
|
280
|
+
] });
|
|
281
|
+
})() })
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
)
|
|
285
|
+
] })
|
|
286
|
+
] }) }),
|
|
287
|
+
r.viewMode === "columns" && /* @__PURE__ */ s("div", { className: "space-y-4", children: [
|
|
288
|
+
S && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
289
|
+
/* @__PURE__ */ n("h4", { className: "text-label-sm text-[var(--color-text-tertiary)]", children: "Grouping" }),
|
|
290
|
+
/* @__PURE__ */ s(d, { value: r.columns.groupColumn || "none", onValueChange: Y, children: [
|
|
291
|
+
/* @__PURE__ */ n(h, { size: "s", children: /* @__PURE__ */ n(u, { placeholder: "Select column to group by" }) }),
|
|
292
|
+
/* @__PURE__ */ s(m, { children: [
|
|
293
|
+
/* @__PURE__ */ n(a, { value: "none", children: "None" }),
|
|
294
|
+
f?.map((e) => /* @__PURE__ */ n(a, { value: e.id, children: e.label }, e.id))
|
|
295
|
+
] })
|
|
296
|
+
] })
|
|
297
|
+
] }),
|
|
298
|
+
J && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
299
|
+
/* @__PURE__ */ n("h4", { className: "text-label-sm text-[var(--color-text-tertiary)]", children: "Sorting" }),
|
|
300
|
+
/* @__PURE__ */ s("div", { className: "flex flex-col gap-2", children: [
|
|
301
|
+
/* @__PURE__ */ s(d, { value: r.columns.sortColumn, onValueChange: U, children: [
|
|
302
|
+
/* @__PURE__ */ n(h, { size: "s", children: /* @__PURE__ */ n(u, { placeholder: "Select column to sort" }) }),
|
|
303
|
+
/* @__PURE__ */ n(m, { children: x?.map((e) => /* @__PURE__ */ n(a, { value: e.id, children: e.label }, e.id)) })
|
|
304
|
+
] }),
|
|
305
|
+
r.columns.sortColumn && /* @__PURE__ */ s(
|
|
306
|
+
d,
|
|
307
|
+
{
|
|
308
|
+
value: r.columns.sortDirection,
|
|
309
|
+
onValueChange: (e) => X(e),
|
|
310
|
+
children: [
|
|
311
|
+
/* @__PURE__ */ n(h, { size: "s", children: /* @__PURE__ */ n(u, {}) }),
|
|
312
|
+
/* @__PURE__ */ n(m, { children: (() => {
|
|
313
|
+
const e = x?.find((o) => o.id === r.columns.sortColumn), l = M(e);
|
|
314
|
+
return /* @__PURE__ */ s(v, { children: [
|
|
315
|
+
/* @__PURE__ */ n(a, { value: "asc", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
316
|
+
/* @__PURE__ */ n(w, { name: "arrow-down-narrow-wide", size: "s" }),
|
|
317
|
+
/* @__PURE__ */ n("span", { children: l.asc })
|
|
318
|
+
] }) }),
|
|
319
|
+
/* @__PURE__ */ n(a, { value: "desc", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
320
|
+
/* @__PURE__ */ n(w, { name: "arrow-down-wide-narrow", size: "s" }),
|
|
321
|
+
/* @__PURE__ */ n("span", { children: l.desc })
|
|
322
|
+
] }) })
|
|
323
|
+
] });
|
|
324
|
+
})() })
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
)
|
|
328
|
+
] })
|
|
329
|
+
] })
|
|
330
|
+
] })
|
|
331
|
+
] }),
|
|
332
|
+
r.viewMode === "folders" && /* @__PURE__ */ s(v, { children: [
|
|
333
|
+
/* @__PURE__ */ n(F, {}),
|
|
334
|
+
/* @__PURE__ */ n("div", { className: "p-3", children: /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
|
|
335
|
+
/* @__PURE__ */ n(he, { htmlFor: "folders-first", children: "Show folders first" }),
|
|
336
|
+
/* @__PURE__ */ n(
|
|
337
|
+
de,
|
|
338
|
+
{
|
|
339
|
+
id: "folders-first",
|
|
340
|
+
checked: r.folders.showFoldersFirst,
|
|
341
|
+
onCheckedChange: K
|
|
342
|
+
}
|
|
343
|
+
)
|
|
344
|
+
] }) })
|
|
345
|
+
] })
|
|
346
|
+
] })
|
|
347
|
+
] });
|
|
348
|
+
}
|
|
349
|
+
);
|
|
350
|
+
pe.displayName = "ViewModeMenu";
|
|
351
|
+
export {
|
|
352
|
+
pe as ViewModeMenu
|
|
353
|
+
};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
function r() {
|
|
2
|
+
const t = /* @__PURE__ */ new Date(), e = t.getDay(), n = (e === 0 ? -6 : 1) - e, a = new Date(t);
|
|
3
|
+
return a.setDate(t.getDate() + n), a.setHours(0, 0, 0, 0), a;
|
|
4
|
+
}
|
|
5
|
+
function w() {
|
|
6
|
+
const t = r(), e = new Date(t);
|
|
7
|
+
return e.setDate(t.getDate() + 6), e.setHours(23, 59, 59, 999), e;
|
|
8
|
+
}
|
|
9
|
+
function h() {
|
|
10
|
+
const t = /* @__PURE__ */ new Date();
|
|
11
|
+
return new Date(t.getFullYear(), t.getMonth(), 1);
|
|
12
|
+
}
|
|
13
|
+
function i() {
|
|
14
|
+
const t = /* @__PURE__ */ new Date();
|
|
15
|
+
return new Date(t.getFullYear(), t.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
16
|
+
}
|
|
17
|
+
function D() {
|
|
18
|
+
const t = /* @__PURE__ */ new Date();
|
|
19
|
+
return new Date(t.getFullYear(), 0, 1);
|
|
20
|
+
}
|
|
21
|
+
function f() {
|
|
22
|
+
const t = /* @__PURE__ */ new Date();
|
|
23
|
+
return new Date(t.getFullYear(), 11, 31, 23, 59, 59, 999);
|
|
24
|
+
}
|
|
25
|
+
function d() {
|
|
26
|
+
const t = r(), e = new Date(t);
|
|
27
|
+
return e.setDate(t.getDate() - 7), e;
|
|
28
|
+
}
|
|
29
|
+
function y() {
|
|
30
|
+
const t = r(), e = new Date(t);
|
|
31
|
+
return e.setDate(t.getDate() - 1), e.setHours(23, 59, 59, 999), e;
|
|
32
|
+
}
|
|
33
|
+
function L() {
|
|
34
|
+
const t = /* @__PURE__ */ new Date();
|
|
35
|
+
return new Date(t.getFullYear(), t.getMonth() - 1, 1);
|
|
36
|
+
}
|
|
37
|
+
function Y() {
|
|
38
|
+
const t = /* @__PURE__ */ new Date();
|
|
39
|
+
return new Date(t.getFullYear(), t.getMonth(), 0, 23, 59, 59, 999);
|
|
40
|
+
}
|
|
41
|
+
function M() {
|
|
42
|
+
const t = /* @__PURE__ */ new Date();
|
|
43
|
+
return new Date(t.getFullYear() - 1, 0, 1);
|
|
44
|
+
}
|
|
45
|
+
function m() {
|
|
46
|
+
const t = /* @__PURE__ */ new Date();
|
|
47
|
+
return new Date(t.getFullYear() - 1, 11, 31, 23, 59, 59, 999);
|
|
48
|
+
}
|
|
49
|
+
function s(t) {
|
|
50
|
+
const e = /* @__PURE__ */ new Date(), n = new Date(e);
|
|
51
|
+
return n.setDate(e.getDate() - t), n.setHours(0, 0, 0, 0), n;
|
|
52
|
+
}
|
|
53
|
+
function o() {
|
|
54
|
+
const t = /* @__PURE__ */ new Date();
|
|
55
|
+
return t.setHours(23, 59, 59, 999), t;
|
|
56
|
+
}
|
|
57
|
+
function c() {
|
|
58
|
+
const t = /* @__PURE__ */ new Date(), e = Math.floor(t.getMonth() / 3);
|
|
59
|
+
return new Date(t.getFullYear(), e * 3, 1);
|
|
60
|
+
}
|
|
61
|
+
function S() {
|
|
62
|
+
const t = /* @__PURE__ */ new Date(), e = Math.floor(t.getMonth() / 3);
|
|
63
|
+
return new Date(t.getFullYear(), e * 3 + 3, 0, 23, 59, 59, 999);
|
|
64
|
+
}
|
|
65
|
+
function l() {
|
|
66
|
+
const t = /* @__PURE__ */ new Date(), e = Math.floor(t.getMonth() / 3), n = e === 0 ? 3 : e - 1, a = e === 0 ? t.getFullYear() - 1 : t.getFullYear();
|
|
67
|
+
return new Date(a, n * 3, 1);
|
|
68
|
+
}
|
|
69
|
+
function F() {
|
|
70
|
+
const t = /* @__PURE__ */ new Date(), e = Math.floor(t.getMonth() / 3), n = e === 0 ? 3 : e - 1, a = e === 0 ? t.getFullYear() - 1 : t.getFullYear();
|
|
71
|
+
return new Date(a, n * 3 + 3, 0, 23, 59, 59, 999);
|
|
72
|
+
}
|
|
73
|
+
function u(t) {
|
|
74
|
+
return `Q${Math.floor(t.getMonth() / 3) + 1} ${t.getFullYear()}`;
|
|
75
|
+
}
|
|
76
|
+
function k(t) {
|
|
77
|
+
switch (t) {
|
|
78
|
+
case "this-week":
|
|
79
|
+
return [r(), w()];
|
|
80
|
+
case "this-month":
|
|
81
|
+
return [h(), i()];
|
|
82
|
+
case "this-year":
|
|
83
|
+
return [D(), f()];
|
|
84
|
+
case "last-week":
|
|
85
|
+
return [d(), y()];
|
|
86
|
+
case "last-month":
|
|
87
|
+
return [L(), Y()];
|
|
88
|
+
case "last-year":
|
|
89
|
+
return [M(), m()];
|
|
90
|
+
case "last-30-days":
|
|
91
|
+
return [s(30), o()];
|
|
92
|
+
case "last-90-days":
|
|
93
|
+
return [s(90), o()];
|
|
94
|
+
case "last-6-months":
|
|
95
|
+
return [s(180), o()];
|
|
96
|
+
case "this-quarter":
|
|
97
|
+
return [c(), S()];
|
|
98
|
+
case "last-quarter":
|
|
99
|
+
return [l(), F()];
|
|
100
|
+
default:
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function T(t, e) {
|
|
105
|
+
const n = {
|
|
106
|
+
year: "numeric",
|
|
107
|
+
month: "short",
|
|
108
|
+
day: "numeric"
|
|
109
|
+
}, a = t.toLocaleDateString("en-US", n), g = e.toLocaleDateString("en-US", n);
|
|
110
|
+
return `${a} - ${g}`;
|
|
111
|
+
}
|
|
112
|
+
function q(t) {
|
|
113
|
+
return {
|
|
114
|
+
custom: "Custom",
|
|
115
|
+
"this-week": "This week",
|
|
116
|
+
"this-month": "This month",
|
|
117
|
+
"this-year": "This year",
|
|
118
|
+
"last-week": "Last week",
|
|
119
|
+
"last-month": "Last month",
|
|
120
|
+
"last-year": "Last year",
|
|
121
|
+
"last-30-days": "Last 30 days",
|
|
122
|
+
"last-90-days": "Last 90 days",
|
|
123
|
+
"last-6-months": "Last 6 months",
|
|
124
|
+
"this-quarter": `This quarter (${u(c())})`,
|
|
125
|
+
"last-quarter": `Last quarter (${u(l())})`
|
|
126
|
+
}[t] || t;
|
|
127
|
+
}
|
|
128
|
+
export {
|
|
129
|
+
k as calculatePresetRange,
|
|
130
|
+
T as formatDateRange,
|
|
131
|
+
s as getDaysAgo,
|
|
132
|
+
Y as getLastMonthEnd,
|
|
133
|
+
L as getLastMonthStart,
|
|
134
|
+
F as getLastQuarterEnd,
|
|
135
|
+
l as getLastQuarterStart,
|
|
136
|
+
y as getLastWeekEnd,
|
|
137
|
+
d as getLastWeekStart,
|
|
138
|
+
m as getLastYearEnd,
|
|
139
|
+
M as getLastYearStart,
|
|
140
|
+
q as getPresetLabel,
|
|
141
|
+
u as getQuarterLabel,
|
|
142
|
+
i as getThisMonthEnd,
|
|
143
|
+
h as getThisMonthStart,
|
|
144
|
+
S as getThisQuarterEnd,
|
|
145
|
+
c as getThisQuarterStart,
|
|
146
|
+
w as getThisWeekEnd,
|
|
147
|
+
r as getThisWeekStart,
|
|
148
|
+
f as getThisYearEnd,
|
|
149
|
+
D as getThisYearStart,
|
|
150
|
+
o as getToday
|
|
151
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useState as a, useEffect as o } from "react";
|
|
2
|
+
function u(n) {
|
|
3
|
+
const [s, i] = a(!1);
|
|
4
|
+
return o(() => {
|
|
5
|
+
if (typeof window > "u") return;
|
|
6
|
+
const t = window.matchMedia(n);
|
|
7
|
+
i(t.matches);
|
|
8
|
+
const e = (r) => {
|
|
9
|
+
i(r.matches);
|
|
10
|
+
};
|
|
11
|
+
return t.addEventListener("change", e), () => t.removeEventListener("change", e);
|
|
12
|
+
}, [n]), s;
|
|
13
|
+
}
|
|
14
|
+
function f() {
|
|
15
|
+
const [n, s] = a(!0), [i, t] = a(!1);
|
|
16
|
+
return o(() => {
|
|
17
|
+
if (typeof window > "u") return;
|
|
18
|
+
const e = window.matchMedia("(min-width: 768px)");
|
|
19
|
+
s(e.matches), t(!0);
|
|
20
|
+
const r = (c) => {
|
|
21
|
+
s(c.matches);
|
|
22
|
+
};
|
|
23
|
+
return e.addEventListener("change", r), () => e.removeEventListener("change", r);
|
|
24
|
+
}, []), i ? n : !0;
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
f as useIsDesktop,
|
|
28
|
+
u as useMediaQuery
|
|
29
|
+
};
|