@memobit/libs 3.0.0 → 3.1.1
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/Accordion/Accordion.css +1 -0
- package/dist/components/Accordion/Accordion2.js +79 -0
- package/dist/components/AlertDialog/AlertDialog.css +1 -0
- package/dist/components/AlertDialog/AlertDialog2.js +26 -0
- package/dist/components/AnalogClock/AnalogClock.css +1 -0
- package/dist/components/AnalogClock/AnalogClock2.js +293 -0
- package/dist/components/AngleSlider/AngleSlider.css +1 -0
- package/dist/components/AngleSlider/AngleSlider2.js +135 -0
- package/dist/components/AppHeader/AppHeader.css +1 -0
- package/dist/components/AppHeader/AppHeader2.js +44 -0
- package/dist/components/Auth/ChangePasswordModal/ChangePasswordModal.css +1 -0
- package/dist/components/Auth/ChangePasswordModal/ChangePasswordModal2.js +138 -0
- package/dist/components/Auth/Login/Login.css +1 -0
- package/dist/components/Auth/Login/Login2.js +155 -0
- package/dist/components/Auth/MfaSetupModal/MfaSetupModal.css +1 -0
- package/dist/components/Auth/MfaSetupModal/MfaSetupModal2.js +327 -0
- package/dist/components/AvatarInitials/AvatarInitials.css +1 -0
- package/dist/components/AvatarInitials/AvatarInitials2.js +73 -0
- package/dist/components/BMI/BMI.css +1 -0
- package/dist/components/BMI/BMI2.js +53 -0
- package/dist/components/BMI/bmiUtils.js +265 -0
- package/dist/components/Badge/Badge.css +1 -0
- package/dist/components/Badge/Badge2.js +30 -0
- package/dist/components/Banner/Banner.css +1 -0
- package/dist/components/Banner/Banner2.js +57 -0
- package/dist/components/Blockquote/Blockquote.css +1 -0
- package/dist/components/Blockquote/Blockquote2.js +55 -0
- package/dist/components/Breadcrumb/Breadcrumb.css +1 -0
- package/dist/components/Breadcrumb/Breadcrumb2.js +36 -0
- package/dist/components/BulkActionBar/BulkActionBar.css +1 -0
- package/dist/components/BulkActionBar/BulkActionBar2.js +39 -0
- package/dist/components/Button/Button.css +1 -0
- package/dist/components/Button/Button2.js +32 -0
- package/dist/components/Calendar/Calendar.css +1 -0
- package/dist/components/Calendar/Calendar2.js +279 -0
- package/dist/components/CalendarHeatmap/CalendarHeatmap.css +1 -0
- package/dist/components/CalendarHeatmap/CalendarHeatmap2.js +91 -0
- package/dist/components/Card/Card.css +1 -0
- package/dist/components/Card/Card2.js +47 -0
- package/dist/components/Checkbox/Checkbox.css +1 -0
- package/dist/components/Checkbox/Checkbox2.js +35 -0
- package/dist/components/Chip/Chip.css +1 -0
- package/dist/components/Chip/Chip2.js +31 -0
- package/dist/components/CollapsibleSection/CollapsibleSection.css +1 -0
- package/dist/components/CollapsibleSection/CollapsibleSection2.js +68 -0
- package/dist/components/ColorPicker/ColorPicker.css +1 -0
- package/dist/components/ColorPicker/ColorPicker2.js +257 -0
- package/dist/components/CommandPalette/CommandPalette.css +1 -0
- package/dist/components/CommandPalette/CommandPalette2.js +97 -0
- package/dist/components/Confetti/Confetti.css +1 -0
- package/dist/components/Confetti/Confetti2.js +175 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.css +1 -0
- package/dist/components/ConfirmDialog/ConfirmDialog2.js +37 -0
- package/dist/components/ConfirmPopover/ConfirmPopover.css +1 -0
- package/dist/components/ConfirmPopover/ConfirmPopover2.js +55 -0
- package/dist/components/ContextMenu/ContextMenu.css +1 -0
- package/dist/components/ContextMenu/ContextMenu2.js +53 -0
- package/dist/components/ContextToast/ContextToast.css +1 -0
- package/dist/components/ContextToast/ContextToast2.js +96 -0
- package/dist/components/ControlPanel/ControlPanel.css +1 -0
- package/dist/components/ControlPanel/ControlPanel.types.js +21 -0
- package/dist/components/ControlPanel/ControlPanel2.js +137 -0
- package/dist/components/ControlPanel/ControlPanelContext.js +31 -0
- package/dist/components/ControlPanel/ControlPanelFilter.js +386 -0
- package/dist/components/ControlPanel/ControlPanelNav.js +74 -0
- package/dist/components/ControlPanel/ControlPanelOptions.js +197 -0
- package/dist/components/CopyButton/CopyButton.css +1 -0
- package/dist/components/CopyButton/CopyButton2.js +48 -0
- package/dist/components/CountryWithFlag/CountryWithFlag.css +1 -0
- package/dist/components/CountryWithFlag/CountryWithFlag2.js +21 -0
- package/dist/components/DataView/DataView.CardView.js +189 -0
- package/dist/components/DataView/DataView.ColumnSelector.js +51 -0
- package/dist/components/DataView/DataView.MiniSort.js +25 -0
- package/dist/components/DataView/DataView.css +1 -0
- package/dist/components/DataView/DataView2.js +433 -0
- package/dist/components/DatePicker/DatePicker.css +1 -0
- package/dist/components/DatePicker/DatePicker2.js +151 -0
- package/dist/components/DateRangePicker/DateRangePicker.css +1 -0
- package/dist/components/DateRangePicker/DateRangePicker2.js +223 -0
- package/dist/components/DayAgenda/DayAgenda.css +1 -0
- package/dist/components/DayAgenda/DayAgenda2.js +120 -0
- package/dist/components/DiffViewer/DiffViewer.css +1 -0
- package/dist/components/DiffViewer/DiffViewer2.js +270 -0
- package/dist/components/Drawer/Drawer.css +1 -0
- package/dist/components/Drawer/Drawer2.js +119 -0
- package/dist/components/Dropdown/Dropdown.css +1 -0
- package/dist/components/Dropdown/Dropdown2.js +413 -0
- package/dist/components/EmojiPicker/EmojiPicker.css +1 -0
- package/dist/components/EmojiPicker/EmojiPicker2.js +789 -0
- package/dist/components/EmojiPicker/emojiKeywords/activities.js +508 -0
- package/dist/components/EmojiPicker/emojiKeywords/animals.js +501 -0
- package/dist/components/EmojiPicker/emojiKeywords/food.js +540 -0
- package/dist/components/EmojiPicker/emojiKeywords/index.js +21 -0
- package/dist/components/EmojiPicker/emojiKeywords/objects.js +652 -0
- package/dist/components/EmojiPicker/emojiKeywords/people.js +488 -0
- package/dist/components/EmojiPicker/emojiKeywords/smileys.js +538 -0
- package/dist/components/EmojiPicker/emojiKeywords/symbols.js +597 -0
- package/dist/components/EmojiPicker/emojiKeywords/travel.js +507 -0
- package/dist/components/EmptyState/EmptyState.css +1 -0
- package/dist/components/EmptyState/EmptyState2.js +47 -0
- package/dist/components/ErrorBoundary/ErrorBoundary.css +1 -0
- package/dist/components/ErrorBoundary/ErrorBoundary2.js +37 -0
- package/dist/components/EventCalendar/EventCalendar.Chip.js +45 -0
- package/dist/components/EventCalendar/EventCalendar.Month.js +118 -0
- package/dist/components/EventCalendar/EventCalendar.Week.js +131 -0
- package/dist/components/EventCalendar/EventCalendar.css +1 -0
- package/dist/components/EventCalendar/EventCalendar.helpers.js +72 -0
- package/dist/components/EventCalendar/EventCalendar2.js +157 -0
- package/dist/components/FileDropzone/FileDropzone.css +1 -0
- package/dist/components/FileDropzone/FileDropzone2.js +71 -0
- package/dist/components/Flag/Flag.css +1 -0
- package/dist/components/Flag/Flag2.js +36 -0
- package/dist/components/FloatButton/FloatButton.css +1 -0
- package/dist/components/FloatButton/FloatButton2.js +68 -0
- package/dist/components/FloatingWindow/FloatingWindow.css +1 -0
- package/dist/components/FloatingWindow/FloatingWindow2.js +203 -0
- package/dist/components/FolderBrowserModal/FolderBrowserModal.css +1 -0
- package/dist/components/FolderBrowserModal/FolderBrowserModal2.js +144 -0
- package/dist/components/Grid/Col.js +17 -0
- package/dist/components/Grid/Grid.css +1 -0
- package/dist/components/Grid/Grid2.js +28 -0
- package/dist/components/Icon/Icon.css +1 -0
- package/dist/components/Icon/Icon2.js +23 -0
- package/dist/components/IconPicker/IconPicker.css +1 -0
- package/dist/components/IconPicker/IconPicker2.js +51 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.css +1 -0
- package/dist/components/InfiniteScroll/InfiniteScroll2.js +66 -0
- package/dist/components/InputDate/InputDate.css +1 -0
- package/dist/components/InputDate/InputDate2.js +87 -0
- package/dist/components/InputEmail/InputEmail.css +1 -0
- package/dist/components/InputEmail/InputEmail2.js +73 -0
- package/dist/components/InputFile/InputFile.css +1 -0
- package/dist/components/InputFile/InputFile2.js +41 -0
- package/dist/components/InputMask/InputMask.css +1 -0
- package/dist/components/InputMask/InputMask2.js +163 -0
- package/dist/components/InputNumber/InputNumber.css +1 -0
- package/dist/components/InputNumber/InputNumber2.js +60 -0
- package/dist/components/InputPIN/InputPIN.css +1 -0
- package/dist/components/InputPIN/InputPIN2.js +121 -0
- package/dist/components/InputPassword/InputPassword.css +1 -0
- package/dist/components/InputPassword/InputPassword2.js +47 -0
- package/dist/components/InputPhone/InputPhone.css +1 -0
- package/dist/components/InputPhone/InputPhone2.js +82 -0
- package/dist/components/InputSearch/InputSearch.css +1 -0
- package/dist/components/InputSearch/InputSearch2.js +53 -0
- package/dist/components/InputText/InputText.css +1 -0
- package/dist/components/InputText/InputText2.js +47 -0
- package/dist/components/InputTextarea/InputTextarea.css +1 -0
- package/dist/components/InputTextarea/InputTextarea2.js +46 -0
- package/dist/components/InputTime/InputTime.css +1 -0
- package/dist/components/InputTime/InputTime2.js +85 -0
- package/dist/components/InputUrl/InputUrl.css +1 -0
- package/dist/components/InputUrl/InputUrl2.js +65 -0
- package/dist/components/JourneyWizard/JourneyWizard.css +1 -0
- package/dist/components/JourneyWizard/JourneyWizard2.js +147 -0
- package/dist/components/List/List.css +1 -0
- package/dist/components/List/List2.js +28 -0
- package/dist/components/Loading/Loading.css +1 -0
- package/dist/components/Loading/Loading2.js +11 -0
- package/dist/components/MenuHamburger/MenuHamburger.css +1 -0
- package/dist/components/MenuHamburger/MenuHamburger2.js +65 -0
- package/dist/components/MiniSort/MiniSort.css +1 -0
- package/dist/components/MiniSort/MiniSort2.js +52 -0
- package/dist/components/MiniStatsCard/MiniStatsCard.css +1 -0
- package/dist/components/MiniStatsCard/MiniStatsCard2.js +67 -0
- package/dist/components/Minimap/Minimap.css +1 -0
- package/dist/components/Minimap/Minimap2.js +62 -0
- package/dist/components/Modal/Modal.css +1 -0
- package/dist/components/Modal/Modal2.js +87 -0
- package/dist/components/NavBar/NavBar.css +1 -0
- package/dist/components/NavBar/NavBar2.js +64 -0
- package/dist/components/NotificationPanel/NotificationPanel.css +1 -0
- package/dist/components/NotificationPanel/NotificationPanel2.js +66 -0
- package/dist/components/Pagination/Pagination.css +1 -0
- package/dist/components/Pagination/Pagination2.js +92 -0
- package/dist/components/PieChart/PieChart.css +1 -0
- package/dist/components/PieChart/PieChart2.js +142 -0
- package/dist/components/Popover/Popover.css +1 -0
- package/dist/components/Popover/Popover2.js +109 -0
- package/dist/components/Popover/hooks/Popover.hook.js +33 -0
- package/dist/components/ProgressBar/ProgressBar.css +1 -0
- package/dist/components/ProgressBar/ProgressBar2.js +48 -0
- package/dist/components/ProgressRing/ProgressRing.css +1 -0
- package/dist/components/ProgressRing/ProgressRing2.js +54 -0
- package/dist/components/QuantitySelector/QuantitySelector.css +1 -0
- package/dist/components/QuantitySelector/QuantitySelector2.js +94 -0
- package/dist/components/QuickAdd/QuickAdd.css +1 -0
- package/dist/components/QuickAdd/QuickAdd2.js +56 -0
- package/dist/components/QuickNumberUpdate/QuickNumberUpdate.css +1 -0
- package/dist/components/QuickNumberUpdate/QuickNumberUpdate2.js +52 -0
- package/dist/components/QuickOptionUpdate/QuickOptionUpdate.css +1 -0
- package/dist/components/QuickOptionUpdate/QuickOptionUpdate2.js +67 -0
- package/dist/components/Radio/Radio.css +1 -0
- package/dist/components/Radio/Radio2.js +36 -0
- package/dist/components/RangeSlider/RangeSlider.css +1 -0
- package/dist/components/RangeSlider/RangeSlider2.js +157 -0
- package/dist/components/Rating/Rating.css +1 -0
- package/dist/components/Rating/Rating2.js +148 -0
- package/dist/components/Rating/RatingIcon.js +102 -0
- package/dist/components/RichTextEditor/RichTextEditor.css +1 -0
- package/dist/components/RichTextEditor/RichTextEditor2.js +212 -0
- package/dist/components/RichTextEditor/RteLinkPrompt.js +42 -0
- package/dist/components/RichTextEditor/RteTableToolbar.js +95 -0
- package/dist/components/RichTextEditor/RteToolbar.js +106 -0
- package/dist/components/RichTextEditor/helpers.js +73 -0
- package/dist/components/RichTextEditor/hooks/useEditorHistory.js +39 -0
- package/dist/components/RichTextEditor/hooks/useLinkPrompt.js +61 -0
- package/dist/components/RichTextEditor/hooks/useTableOps.js +134 -0
- package/dist/components/RollingNumber/RollingNumber.css +1 -0
- package/dist/components/RollingNumber/RollingNumber2.js +71 -0
- package/dist/components/ScrollToTop/ScrollToTop.css +1 -0
- package/dist/components/ScrollToTop/ScrollToTop2.js +40 -0
- package/dist/components/Separator/Separator.css +1 -0
- package/dist/components/Separator/Separator2.js +39 -0
- package/dist/components/Sidebar/Sidebar.css +1 -0
- package/dist/components/Sidebar/Sidebar2.js +115 -0
- package/dist/components/Sidebar/SidebarContext.js +31 -0
- package/dist/components/SignalStrength/SignalStrength.css +1 -0
- package/dist/components/SignalStrength/SignalStrength2.js +56 -0
- package/dist/components/Skeleton/Skeleton.css +1 -0
- package/dist/components/Skeleton/Skeleton2.js +50 -0
- package/dist/components/Slider/Slider.css +1 -0
- package/dist/components/Slider/Slider2.js +39 -0
- package/dist/components/SplitPanel/SplitPanel.css +1 -0
- package/dist/components/SplitPanel/SplitPanel2.js +69 -0
- package/dist/components/Splitter/Splitter.css +1 -0
- package/dist/components/Splitter/Splitter2.js +89 -0
- package/dist/components/StackedBar/StackedBar.css +1 -0
- package/dist/components/StackedBar/StackedBar2.js +50 -0
- package/dist/components/Stats/Stats.css +1 -0
- package/dist/components/Stats/Stats2.js +26 -0
- package/dist/components/StickyBar/StickyBar.css +1 -0
- package/dist/components/StickyBar/StickyBar2.js +29 -0
- package/dist/components/SuggestionsList/SuggestionsList.css +1 -0
- package/dist/components/SuggestionsList/SuggestionsList2.js +121 -0
- package/dist/components/ThemeSettings/ThemeContext.js +140 -0
- package/dist/components/ThemeSettings/ThemeContextValue.js +5 -0
- package/dist/components/ThemeSettings/ThemeSettings.css +1 -0
- package/dist/components/ThemeSettings/ThemeSettings2.js +245 -0
- package/dist/components/ThemeSettings/themeConfig.js +7 -0
- package/dist/components/ThemeSettings/useTheme.js +10 -0
- package/dist/components/TimePicker/TimePicker.css +1 -0
- package/dist/components/TimePicker/TimePicker2.js +118 -0
- package/dist/components/TimePicker/TimeSpinner.js +59 -0
- package/dist/components/Timeline/Timeline.css +1 -0
- package/dist/components/Timeline/Timeline2.js +57 -0
- package/dist/components/TimelineMarkers/TimelineMarkers.css +1 -0
- package/dist/components/TimelineMarkers/TimelineMarkers2.js +73 -0
- package/dist/components/TipsOfTheDay/TipsOfTheDay.css +1 -0
- package/dist/components/TipsOfTheDay/TipsOfTheDay2.js +24 -0
- package/dist/components/Toast/Toast.css +1 -0
- package/dist/components/Toast/Toast2.js +39 -0
- package/dist/components/ToggleButtons/ToggleButtons.css +1 -0
- package/dist/components/ToggleButtons/ToggleButtons2.js +47 -0
- package/dist/components/ToggleSwitch/ToggleSwitch.css +1 -0
- package/dist/components/ToggleSwitch/ToggleSwitch2.js +27 -0
- package/dist/components/Toolbar/Toolbar.css +1 -0
- package/dist/components/Toolbar/Toolbar2.js +129 -0
- package/dist/components/Tooltip/Tooltip.css +1 -0
- package/dist/components/Tooltip/Tooltip2.js +93 -0
- package/dist/components/TourHud/TourHud.css +1 -0
- package/dist/components/TourHud/TourHud2.js +70 -0
- package/dist/components/Transition/Transition.css +1 -0
- package/dist/components/Transition/Transition2.js +68 -0
- package/dist/components/Tree/Tree.css +1 -0
- package/dist/components/Tree/Tree2.js +95 -0
- package/dist/components/VirtualList/VirtualList.css +1 -0
- package/dist/components/VirtualList/VirtualList2.js +64 -0
- package/dist/components/WHtR/WHtR.css +1 -0
- package/dist/components/WHtR/WHtR2.js +115 -0
- package/dist/contexts/AuthContext/AuthContext.js +113 -0
- package/dist/helpers/AppPersistenceStorage.js +50 -0
- package/dist/helpers/Datetime.js +114 -0
- package/dist/helpers/Format.js +21 -0
- package/dist/helpers/Highlight.js +36 -0
- package/dist/helpers/HtmlContent.js +118 -0
- package/dist/helpers/LogicalOperators.js +15 -0
- package/dist/helpers/Numbers.js +15 -0
- package/dist/helpers/Pagination.js +7 -0
- package/dist/helpers/Search.js +15 -0
- package/dist/helpers/Strings.js +10 -0
- package/dist/helpers/Urls.js +68 -0
- package/dist/helpers/VersionInfo.js +36 -0
- package/dist/hooks/useAppPersistence.js +51 -0
- package/dist/hooks/useAuth/useAuth.js +10 -0
- package/dist/hooks/useBodyScrollLock.js +31 -0
- package/dist/hooks/useBreakpoint.js +65 -0
- package/dist/hooks/useComponentEffect.js +8 -0
- package/dist/hooks/useSwipe.js +45 -0
- package/dist/index.css +1 -2
- package/dist/index.esm.js +1 -17211
- package/dist/index.js +348 -0
- package/dist/mfa.js +4 -0
- package/dist/node_modules/qrcode.react/lib/esm/index.js +979 -0
- package/dist/validators/Vin.js +69 -0
- package/dist/version.js +8 -0
- package/dist/version.json +4 -4
- package/package.json +8 -7
- package/dist/mfa.esm.js +0 -1293
- package/dist/useAuth-BBqdDG2z.js +0 -467
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
import './DataView.css';
|
|
2
|
+
import { Icon as X } from "../Icon/Icon2.js";
|
|
3
|
+
import { Button as mt } from "../Button/Button2.js";
|
|
4
|
+
import { Tooltip as Te } from "../Tooltip/Tooltip2.js";
|
|
5
|
+
import { Checkbox as re } from "../Checkbox/Checkbox2.js";
|
|
6
|
+
import { useBreakpoint as pt } from "../../hooks/useBreakpoint.js";
|
|
7
|
+
import { Dropdown as vt } from "../Dropdown/Dropdown2.js";
|
|
8
|
+
import { getResultsCount as _t } from "../../helpers/Pagination.js";
|
|
9
|
+
import { EmptyState as oe } from "../EmptyState/EmptyState2.js";
|
|
10
|
+
import { Pagination as Ae } from "../Pagination/Pagination2.js";
|
|
11
|
+
import { TimelineMarkerDot as wt, calculateTimelineMarkers as gt } from "../TimelineMarkers/TimelineMarkers2.js";
|
|
12
|
+
import { CardView as bt, DEFAULT_PAGE_SIZES as Ee, getColumnLabel as yt, renderCellContent as kt, renderColumnLabel as Ct } from "./DataView.CardView.js";
|
|
13
|
+
import { DataViewColumnSelector as Nt } from "./DataView.ColumnSelector.js";
|
|
14
|
+
import { DataViewMiniSort as St } from "./DataView.MiniSort.js";
|
|
15
|
+
/* empty css */
|
|
16
|
+
import Ge, { useMemo as L, useState as P } from "react";
|
|
17
|
+
import { Fragment as Mt, jsx as t, jsxs as c } from "react/jsx-runtime";
|
|
18
|
+
function Pt({ state: h }) {
|
|
19
|
+
return /* @__PURE__ */ t("span", {
|
|
20
|
+
className: `data-view__sort-icon data-view__sort-icon--${h}`,
|
|
21
|
+
children: /* @__PURE__ */ t(X, { name: h === "asc" ? "arrow-up" : h === "desc" ? "arrow-down" : "arrow-bidirectional-vertical" })
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1, onSelectionChange: Ve, selectedIds: le, pageSizeOptions: ce = Ee, initialPageSize: xe = Ee[1], showPageSize: $ = !0, card: Be, actions: k, actionsWidth: K, timeline: C, onRowClick: R, rowHref: de, rowClassName: he, rowDetail: Fe, empty: N, initialSortKey: Ie = null, initialSortDirection: Ke = "asc", sortKey: Z, sortDirection: ue, onSortChange: Re, miniSort: z, showCardSortControls: ze = !0, desktopView: fe = "table", cardMaxWidth: Ue, className: D, onPageChange: We, onPageSizeChange: me, currentPage: pe, totalItems: ve, group: o, showResultsCount: je = !0, totalCount: Oe, itemNoun: Xe, columnSelector: q }) {
|
|
25
|
+
const { isMobile: Ze } = pt(), [qe, Je] = P(Ie), [Qe, Ye] = P(Ke), [He, et] = P([]), m = le ?? He, [tt, at] = P(1), nt = pe ?? tt, [T, _e] = P(xe), [S, st] = P(() => h.reduce((e, n) => (n.width && (e[n.key] = n.width), e), {})), [we, it] = P(/* @__PURE__ */ new Set()), ge = (e) => {
|
|
26
|
+
it((n) => {
|
|
27
|
+
const i = new Set(n);
|
|
28
|
+
return i.has(e) ? i.delete(e) : i.add(e), i;
|
|
29
|
+
});
|
|
30
|
+
}, M = (e, n) => Le?.(e, n) ?? n, V = (e) => {
|
|
31
|
+
pe === void 0 && at(e), We?.(e);
|
|
32
|
+
}, p = Z !== void 0 ? Z : qe, v = ue ?? Qe, A = (e, n) => {
|
|
33
|
+
Z === void 0 && Je(e), ue === void 0 && Ye(n), Re?.({
|
|
34
|
+
key: e,
|
|
35
|
+
direction: n
|
|
36
|
+
}), V(1);
|
|
37
|
+
}, U = L(() => new Set(y ?? []), [y]), W = L(() => {
|
|
38
|
+
let e = I;
|
|
39
|
+
if (p) {
|
|
40
|
+
const a = h.find((s) => s.key === p);
|
|
41
|
+
if (a) {
|
|
42
|
+
const s = a.sortAccessor || a.accessor || ((f) => {
|
|
43
|
+
const u = f[a.key];
|
|
44
|
+
return typeof u == "string" || typeof u == "number" ? u : "";
|
|
45
|
+
}), r = [...I].sort((f, u) => {
|
|
46
|
+
const _ = s(f), d = s(u);
|
|
47
|
+
return typeof _ == "number" && typeof d == "number" ? _ - d : String(_).localeCompare(String(d));
|
|
48
|
+
});
|
|
49
|
+
e = v === "asc" ? r : r.reverse();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (U.size === 0) return e;
|
|
53
|
+
const n = [], i = [];
|
|
54
|
+
if (e.forEach((a, s) => {
|
|
55
|
+
U.has(M(a, s)) ? n.push(a) : i.push(a);
|
|
56
|
+
}), y && y.length > 1 && n.length > 1) {
|
|
57
|
+
const a = new Map(y.map((s, r) => [s, r]));
|
|
58
|
+
n.sort((s, r) => (a.get(M(s, 0)) ?? 0) - (a.get(M(r, 0)) ?? 0));
|
|
59
|
+
}
|
|
60
|
+
return [...n, ...i];
|
|
61
|
+
}, [
|
|
62
|
+
h,
|
|
63
|
+
I,
|
|
64
|
+
v,
|
|
65
|
+
p,
|
|
66
|
+
U,
|
|
67
|
+
y
|
|
68
|
+
]), j = ve !== void 0, x = L(() => {
|
|
69
|
+
if (!o || j) return W;
|
|
70
|
+
const e = /* @__PURE__ */ new Map(), n = [];
|
|
71
|
+
W.forEach((a) => {
|
|
72
|
+
const s = o.groupBy(a), r = e.get(s);
|
|
73
|
+
r ? r.push(a) : (e.set(s, [a]), n.push(s));
|
|
74
|
+
});
|
|
75
|
+
const i = n.map((a) => {
|
|
76
|
+
const s = e.get(a);
|
|
77
|
+
return {
|
|
78
|
+
key: a,
|
|
79
|
+
label: o.groupLabel(a),
|
|
80
|
+
items: s,
|
|
81
|
+
totalCount: s.length
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
return o.sortGroups ? i.sort(o.sortGroups) : i.sort((a, s) => a.key === null ? 1 : s.key === null ? -1 : 0), i.flatMap((a) => a.items);
|
|
85
|
+
}, [
|
|
86
|
+
o,
|
|
87
|
+
j,
|
|
88
|
+
W
|
|
89
|
+
]), O = j ? ve : x.length, J = Math.max(1, Math.ceil(O / T)), B = Math.min(nt, J), g = j ? x : x.slice((B - 1) * T, B * T), Q = je ? _t(T, O, Oe ?? O, B, Xe) : null, Y = L(() => {
|
|
90
|
+
if (!o) return null;
|
|
91
|
+
const e = /* @__PURE__ */ new Map();
|
|
92
|
+
return x.forEach((n) => {
|
|
93
|
+
const i = o.groupBy(n);
|
|
94
|
+
e.set(i, (e.get(i) ?? 0) + 1);
|
|
95
|
+
}), e;
|
|
96
|
+
}, [o, x]), H = L(() => {
|
|
97
|
+
if (!o || !Y) return null;
|
|
98
|
+
const e = /* @__PURE__ */ new Map(), n = [];
|
|
99
|
+
g.forEach((a) => {
|
|
100
|
+
const s = o.groupBy(a), r = e.get(s);
|
|
101
|
+
r ? r.push(a) : (e.set(s, [a]), n.push(s));
|
|
102
|
+
});
|
|
103
|
+
const i = n.map((a) => ({
|
|
104
|
+
key: a,
|
|
105
|
+
label: o.groupLabel(a),
|
|
106
|
+
items: e.get(a),
|
|
107
|
+
totalCount: Y.get(a) ?? 0
|
|
108
|
+
}));
|
|
109
|
+
return o.sortGroups ? i.sort(o.sortGroups) : i.sort((a, s) => a.key === null ? 1 : s.key === null ? -1 : 0), i;
|
|
110
|
+
}, [
|
|
111
|
+
o,
|
|
112
|
+
Y,
|
|
113
|
+
g
|
|
114
|
+
]), be = L(() => C ? gt(g.map((e) => ({
|
|
115
|
+
id: C.idAccessor(e),
|
|
116
|
+
date: C.dateAccessor(e)
|
|
117
|
+
})), C.granularity) : /* @__PURE__ */ new Map(), [g, C]), E = (e) => {
|
|
118
|
+
le === void 0 && et(e), Ve?.(I.filter((n, i) => e.includes(M(n, i))));
|
|
119
|
+
}, rt = (e) => {
|
|
120
|
+
e.sortable && (p === e.key ? A(e.key, v === "asc" ? "desc" : "asc") : A(e.key, "asc"));
|
|
121
|
+
}, ot = (e, n) => {
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
const i = e.clientX, a = S[n] ?? 150, s = (f) => {
|
|
124
|
+
const u = f.clientX - i, _ = h.find((d) => d.key === n)?.minWidth ?? 120;
|
|
125
|
+
st((d) => ({
|
|
126
|
+
...d,
|
|
127
|
+
[n]: Math.max(_, a + u)
|
|
128
|
+
}));
|
|
129
|
+
}, r = () => {
|
|
130
|
+
window.removeEventListener("mousemove", s), window.removeEventListener("mouseup", r);
|
|
131
|
+
};
|
|
132
|
+
window.addEventListener("mousemove", s), window.addEventListener("mouseup", r);
|
|
133
|
+
}, ye = h.some((e) => e.filter), ee = h.filter((e) => e.sortable), lt = ee.map((e) => ({
|
|
134
|
+
label: yt(e),
|
|
135
|
+
value: e.key
|
|
136
|
+
})), ct = ee.length > 0, te = p ? ee.find((e) => e.key === p) : void 0, dt = z?.align ?? "left", ke = (z?.columns ?? z?.column ?? []).length > 0 ? /* @__PURE__ */ t(St, {
|
|
137
|
+
columns: h,
|
|
138
|
+
config: z,
|
|
139
|
+
sortKey: p,
|
|
140
|
+
sortDirection: v,
|
|
141
|
+
onSort: A
|
|
142
|
+
}) : null, Ce = q && q.options.length > 0 ? /* @__PURE__ */ t(Nt, { config: q }) : null, b = g.map(M), ae = b.filter((e) => m.includes(e)).length, ne = !!w && b.length > 0 && ae === b.length, Ne = !!w && ae > 0 && ae < b.length, Se = (e) => {
|
|
143
|
+
E(e ? [...m, ...b.filter((n) => !m.includes(n))] : m.filter((n) => !b.includes(n)));
|
|
144
|
+
}, ht = w && b.length > 0 ? /* @__PURE__ */ c("label", {
|
|
145
|
+
className: "data-view__select-all",
|
|
146
|
+
children: [/* @__PURE__ */ t(re, {
|
|
147
|
+
checked: ne,
|
|
148
|
+
indeterminate: Ne,
|
|
149
|
+
onChange: Se
|
|
150
|
+
}), /* @__PURE__ */ t("span", { children: ne ? "Clear selection" : `Select these ${b.length}` })]
|
|
151
|
+
}) : null, Me = (e) => Q || ke || Ce || e ? /* @__PURE__ */ c("div", {
|
|
152
|
+
className: `data-view__top-row data-view__top-row--mini-${dt}`,
|
|
153
|
+
children: [
|
|
154
|
+
Q && /* @__PURE__ */ t("div", {
|
|
155
|
+
className: "data-view__results-count",
|
|
156
|
+
children: Q
|
|
157
|
+
}),
|
|
158
|
+
e,
|
|
159
|
+
ke,
|
|
160
|
+
Ce
|
|
161
|
+
]
|
|
162
|
+
}) : null, Pe = Me();
|
|
163
|
+
if (fe !== "cards" && h.length === 0) return /* @__PURE__ */ c("div", {
|
|
164
|
+
className: `data-view${D ? ` ${D}` : ""}`,
|
|
165
|
+
children: [Pe, /* @__PURE__ */ t("div", {
|
|
166
|
+
className: "data-view__wrapper data-view__wrapper--empty",
|
|
167
|
+
children: /* @__PURE__ */ t(oe, {
|
|
168
|
+
title: "No columns selected",
|
|
169
|
+
description: "Use the Columns button above to pick which columns to display."
|
|
170
|
+
})
|
|
171
|
+
})]
|
|
172
|
+
});
|
|
173
|
+
if (fe === "cards") return /* @__PURE__ */ c("div", {
|
|
174
|
+
className: `data-view data-view--cards${D ? ` ${D}` : ""}`,
|
|
175
|
+
children: [
|
|
176
|
+
Me(ht),
|
|
177
|
+
ze && ct && /* @__PURE__ */ c("div", {
|
|
178
|
+
className: "data-view__card-sort-bar",
|
|
179
|
+
children: [/* @__PURE__ */ t("div", {
|
|
180
|
+
className: "data-view__card-sort-field",
|
|
181
|
+
children: /* @__PURE__ */ t(vt, {
|
|
182
|
+
name: "data-view-card-sort",
|
|
183
|
+
label: "Sort by",
|
|
184
|
+
options: lt,
|
|
185
|
+
value: p,
|
|
186
|
+
placeholder: "Sort by...",
|
|
187
|
+
searchable: !1,
|
|
188
|
+
usePortal: !1,
|
|
189
|
+
onChange: (e) => {
|
|
190
|
+
if (!e || Array.isArray(e)) {
|
|
191
|
+
A(null, v);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const n = String(e.value);
|
|
195
|
+
A(n, p === n ? v : "asc");
|
|
196
|
+
}
|
|
197
|
+
})
|
|
198
|
+
}), /* @__PURE__ */ t(Te, {
|
|
199
|
+
title: v === "asc" ? "Sort descending" : "Sort ascending",
|
|
200
|
+
children: /* @__PURE__ */ t(mt, {
|
|
201
|
+
className: "data-view__card-sort-direction",
|
|
202
|
+
disabled: !te,
|
|
203
|
+
onClick: () => {
|
|
204
|
+
te && A(te.key, v === "asc" ? "desc" : "asc");
|
|
205
|
+
},
|
|
206
|
+
variant: "ghost",
|
|
207
|
+
children: /* @__PURE__ */ t(X, { name: v === "asc" ? "arrow-up" : "arrow-down" })
|
|
208
|
+
})
|
|
209
|
+
})]
|
|
210
|
+
}),
|
|
211
|
+
ye && /* @__PURE__ */ t("div", {
|
|
212
|
+
className: "data-view__filter-bar",
|
|
213
|
+
children: h.filter((e) => e.filter).map((e) => /* @__PURE__ */ t("div", {
|
|
214
|
+
className: "data-view__filter-bar-item",
|
|
215
|
+
children: e.filter
|
|
216
|
+
}, e.key))
|
|
217
|
+
}),
|
|
218
|
+
/* @__PURE__ */ t(bt, {
|
|
219
|
+
data: g,
|
|
220
|
+
columns: h,
|
|
221
|
+
rowKey: M,
|
|
222
|
+
card: Be,
|
|
223
|
+
actions: k,
|
|
224
|
+
timeline: C,
|
|
225
|
+
onRowClick: R,
|
|
226
|
+
rowHref: de,
|
|
227
|
+
rowClassName: he,
|
|
228
|
+
empty: N,
|
|
229
|
+
selectable: w,
|
|
230
|
+
selectedIds: m,
|
|
231
|
+
pinnedIds: y,
|
|
232
|
+
cardMaxWidth: Ue,
|
|
233
|
+
isMobile: Ze,
|
|
234
|
+
groups: H ?? void 0,
|
|
235
|
+
showGroupCount: o?.showCount !== !1,
|
|
236
|
+
collapsible: o?.collapsible,
|
|
237
|
+
collapsedGroups: we,
|
|
238
|
+
onToggleGroup: ge,
|
|
239
|
+
onToggleSelect: (e, n) => {
|
|
240
|
+
E(n ? [...m, e] : m.filter((i) => i !== e));
|
|
241
|
+
}
|
|
242
|
+
}),
|
|
243
|
+
/* @__PURE__ */ t(Ae, {
|
|
244
|
+
currentPage: B,
|
|
245
|
+
totalPages: J,
|
|
246
|
+
totalItems: O,
|
|
247
|
+
onPageChange: V,
|
|
248
|
+
pageSizeOptions: $ ? ce : void 0,
|
|
249
|
+
pageSize: $ ? T : void 0,
|
|
250
|
+
onPageSizeChange: $ ? (e) => {
|
|
251
|
+
_e(e), V(1), me?.(e);
|
|
252
|
+
} : void 0
|
|
253
|
+
})
|
|
254
|
+
]
|
|
255
|
+
});
|
|
256
|
+
const F = h.filter((e) => !e.hideInTable), G = C && be.size > 0, $e = /* @__PURE__ */ c(Mt, { children: [
|
|
257
|
+
Pe,
|
|
258
|
+
/* @__PURE__ */ t("div", {
|
|
259
|
+
className: "data-view__wrapper",
|
|
260
|
+
children: /* @__PURE__ */ c("table", { children: [/* @__PURE__ */ c("thead", { children: [/* @__PURE__ */ c("tr", { children: [
|
|
261
|
+
G && /* @__PURE__ */ t("th", { className: "data-view__timeline-cell" }),
|
|
262
|
+
w && /* @__PURE__ */ t("th", {
|
|
263
|
+
className: "data-view__checkbox",
|
|
264
|
+
children: /* @__PURE__ */ t(re, {
|
|
265
|
+
checked: ne,
|
|
266
|
+
indeterminate: Ne,
|
|
267
|
+
onChange: Se
|
|
268
|
+
})
|
|
269
|
+
}),
|
|
270
|
+
F.map((e) => {
|
|
271
|
+
const n = {};
|
|
272
|
+
return S[e.key] && (n.width = S[e.key]), e.minWidth && (n.minWidth = e.minWidth), /* @__PURE__ */ c("th", {
|
|
273
|
+
style: Object.keys(n).length > 0 ? n : void 0,
|
|
274
|
+
className: e.sortable ? "is-sortable" : "",
|
|
275
|
+
onClick: () => rt(e),
|
|
276
|
+
children: [/* @__PURE__ */ c("span", {
|
|
277
|
+
className: "data-view__th-content",
|
|
278
|
+
children: [Ct(e), e.sortable && /* @__PURE__ */ t(Pt, { state: p === e.key ? v : "unsorted" })]
|
|
279
|
+
}), /* @__PURE__ */ t("span", {
|
|
280
|
+
className: "data-view__resizer",
|
|
281
|
+
onMouseDown: (i) => ot(i, e.key),
|
|
282
|
+
onClick: (i) => i.stopPropagation()
|
|
283
|
+
})]
|
|
284
|
+
}, e.key);
|
|
285
|
+
}),
|
|
286
|
+
k && /* @__PURE__ */ t("th", {
|
|
287
|
+
className: "data-view__actions-header",
|
|
288
|
+
style: K ? { width: K } : void 0,
|
|
289
|
+
children: "Actions"
|
|
290
|
+
})
|
|
291
|
+
] }), ye && /* @__PURE__ */ c("tr", {
|
|
292
|
+
className: "data-view__filter-row",
|
|
293
|
+
children: [
|
|
294
|
+
G && /* @__PURE__ */ t("td", { className: "data-view__filter-cell data-view__filter-cell--spacer" }),
|
|
295
|
+
w && /* @__PURE__ */ t("td", { className: "data-view__filter-cell data-view__filter-cell--spacer" }),
|
|
296
|
+
F.map((e) => /* @__PURE__ */ t("td", {
|
|
297
|
+
className: "data-view__filter-cell",
|
|
298
|
+
style: S[e.key] ? { width: S[e.key] } : void 0,
|
|
299
|
+
children: e.filter ?? null
|
|
300
|
+
}, e.key)),
|
|
301
|
+
k && /* @__PURE__ */ t("td", { className: "data-view__filter-cell data-view__filter-cell--spacer" })
|
|
302
|
+
]
|
|
303
|
+
})] }), /* @__PURE__ */ t("tbody", { children: (() => {
|
|
304
|
+
if (g.length === 0) return /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", {
|
|
305
|
+
colSpan: F.length + (G ? 1 : 0) + (w ? 1 : 0) + (k ? 1 : 0),
|
|
306
|
+
className: "data-view__empty",
|
|
307
|
+
children: N ? /* @__PURE__ */ t(oe, {
|
|
308
|
+
title: N.title,
|
|
309
|
+
description: N.description,
|
|
310
|
+
icon: N.icon,
|
|
311
|
+
primary: N.primary,
|
|
312
|
+
secondary: N.secondary
|
|
313
|
+
}) : /* @__PURE__ */ t(oe, { title: "No data available" })
|
|
314
|
+
}) });
|
|
315
|
+
const e = F.length + (G ? 1 : 0) + (w ? 1 : 0) + (k ? 1 : 0), n = o?.showCount !== !1, i = (a, s) => {
|
|
316
|
+
const r = M(a, s), f = m.includes(r), u = U.has(r), _ = be.get(s), d = de?.(a), De = !!R || !!d, ut = (l) => {
|
|
317
|
+
if (d && (l.metaKey || l.ctrlKey || l.shiftKey)) {
|
|
318
|
+
window.open(d, "_blank", "noopener,noreferrer");
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
if (R) {
|
|
322
|
+
R(a, l);
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
d && window.location.assign(d);
|
|
326
|
+
}, ft = (l) => {
|
|
327
|
+
l.button !== 1 || !d || (l.preventDefault(), window.open(d, "_blank", "noopener,noreferrer"));
|
|
328
|
+
}, se = Fe?.(a);
|
|
329
|
+
return /* @__PURE__ */ c(Ge.Fragment, { children: [/* @__PURE__ */ c("tr", {
|
|
330
|
+
className: `${f ? "is-selected" : ""} ${De ? "data-view__row--clickable" : ""} ${u ? "data-view__row--pinned" : ""} ${he?.(a) || ""}`,
|
|
331
|
+
onClick: De ? ut : void 0,
|
|
332
|
+
onAuxClick: d ? ft : void 0,
|
|
333
|
+
children: [
|
|
334
|
+
G && /* @__PURE__ */ t("td", {
|
|
335
|
+
className: "data-view__timeline-cell",
|
|
336
|
+
children: _ && /* @__PURE__ */ t(wt, { marker: _ })
|
|
337
|
+
}),
|
|
338
|
+
w && /* @__PURE__ */ t("td", {
|
|
339
|
+
className: "data-view__checkbox",
|
|
340
|
+
children: /* @__PURE__ */ t(re, {
|
|
341
|
+
checked: f,
|
|
342
|
+
onChange: (l) => {
|
|
343
|
+
E(l ? [...m, r] : m.filter((ie) => ie !== r));
|
|
344
|
+
}
|
|
345
|
+
})
|
|
346
|
+
}),
|
|
347
|
+
F.map((l, ie) => /* @__PURE__ */ c("td", {
|
|
348
|
+
style: S[l.key] ? { width: S[l.key] } : void 0,
|
|
349
|
+
children: [ie === 0 && u && /* @__PURE__ */ t(Te, {
|
|
350
|
+
title: "Pinned",
|
|
351
|
+
children: /* @__PURE__ */ t(X, {
|
|
352
|
+
className: "data-view__pin-indicator",
|
|
353
|
+
name: "pin",
|
|
354
|
+
size: "sm"
|
|
355
|
+
})
|
|
356
|
+
}), kt(l, a)]
|
|
357
|
+
}, l.key)),
|
|
358
|
+
k && /* @__PURE__ */ t("td", {
|
|
359
|
+
className: "data-view__actions-cell",
|
|
360
|
+
style: K ? { width: K } : void 0,
|
|
361
|
+
children: /* @__PURE__ */ t("div", {
|
|
362
|
+
className: "data-view__table-actions",
|
|
363
|
+
onClick: (l) => l.stopPropagation(),
|
|
364
|
+
children: k(a)
|
|
365
|
+
})
|
|
366
|
+
})
|
|
367
|
+
]
|
|
368
|
+
}), se != null && se !== !1 && /* @__PURE__ */ t("tr", {
|
|
369
|
+
className: "data-view__row-detail",
|
|
370
|
+
children: /* @__PURE__ */ t("td", {
|
|
371
|
+
colSpan: e,
|
|
372
|
+
onClick: (l) => l.stopPropagation(),
|
|
373
|
+
children: se
|
|
374
|
+
})
|
|
375
|
+
})] }, r);
|
|
376
|
+
};
|
|
377
|
+
if (H) {
|
|
378
|
+
let a = 0;
|
|
379
|
+
return H.map((s) => {
|
|
380
|
+
const r = a;
|
|
381
|
+
a += s.items.length;
|
|
382
|
+
const f = o?.collapsible && we.has(s.key);
|
|
383
|
+
return /* @__PURE__ */ c(Ge.Fragment, { children: [/* @__PURE__ */ t("tr", {
|
|
384
|
+
className: `data-view__group-row${o?.collapsible ? " data-view__group-row--collapsible" : ""}`,
|
|
385
|
+
onClick: o?.collapsible ? () => ge(s.key) : void 0,
|
|
386
|
+
children: /* @__PURE__ */ c("td", {
|
|
387
|
+
colSpan: e,
|
|
388
|
+
className: "data-view__group-cell",
|
|
389
|
+
children: [
|
|
390
|
+
/* @__PURE__ */ t("span", {
|
|
391
|
+
className: "data-view__group-label",
|
|
392
|
+
children: s.label
|
|
393
|
+
}),
|
|
394
|
+
n && /* @__PURE__ */ t("span", {
|
|
395
|
+
className: "data-view__group-count",
|
|
396
|
+
children: s.items.length === s.totalCount ? s.totalCount : `${s.items.length} of ${s.totalCount}`
|
|
397
|
+
}),
|
|
398
|
+
o?.collapsible && /* @__PURE__ */ t(X, {
|
|
399
|
+
className: "data-view__group-chevron",
|
|
400
|
+
name: f ? "caret-down" : "caret-up",
|
|
401
|
+
size: "sm"
|
|
402
|
+
})
|
|
403
|
+
]
|
|
404
|
+
})
|
|
405
|
+
}), !f && s.items.map((u, _) => i(u, r + _))] }, s.key ?? "__null__");
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
return g.map((a, s) => i(a, s));
|
|
409
|
+
})() })] })
|
|
410
|
+
}),
|
|
411
|
+
/* @__PURE__ */ t(Ae, {
|
|
412
|
+
currentPage: B,
|
|
413
|
+
totalPages: J,
|
|
414
|
+
totalItems: W.length,
|
|
415
|
+
onPageChange: V,
|
|
416
|
+
pageSizeOptions: $ ? ce : void 0,
|
|
417
|
+
pageSize: $ ? T : void 0,
|
|
418
|
+
onPageSizeChange: $ ? (e) => {
|
|
419
|
+
_e(e), V(1), me?.(e);
|
|
420
|
+
} : void 0
|
|
421
|
+
})
|
|
422
|
+
] });
|
|
423
|
+
return /* @__PURE__ */ t("div", {
|
|
424
|
+
className: `data-view${D ? ` ${D}` : ""}`,
|
|
425
|
+
children: G ? /* @__PURE__ */ c("div", {
|
|
426
|
+
className: "timeline-markers",
|
|
427
|
+
children: [/* @__PURE__ */ t("div", { className: "timeline-markers__track" }), $e]
|
|
428
|
+
}) : $e
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
export {
|
|
432
|
+
Wt as DataView
|
|
433
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--radius-sm:4px;--radius:8px;--radius-full:9999px;--checkbox-size:18px;--radio-size:18px;--body-background-glow:none;--spacing-1:1px;--spacing-2:2px;--spacing-4:4px;--spacing-6:6px;--spacing-8:8px;--spacing-12:12px;--spacing-16:16px;--spacing-20:20px;--spacing-24:24px;--spacing-32:32px;--spacing-40:40px;--spacing-48:48px;--spacing-60:60px;--spacing-64:64px;--spacing-80:80px;--spacing-100:100px;--spacing-200:200px;--spacing-300:300px;--spacing-400:400px;--font-size-xxs:.625rem;--font-size-xs:.75rem;--font-size-sm:.875rem;--font-size-md:1rem;--font-size-lg:1.25rem;--font-size-xl:1.5rem;--font-size-xxl:2rem;--font-size-xxxl:3rem;--font-family-display:var(--font-family,sans-serif);--font-family-mono:ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;--form-control-font-family:var(--font-family,sans-serif);--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--line-height-none:1;--line-height-tight:1.2;--line-height-normal:1.5;--line-height-loose:1.8;--duration-hover:.2s;--duration-fade:.3s;--duration-slide:.4s;--transition-fast:.15s ease-in-out;--transition-moderate:.3s ease-in-out;--transition-slow:.5s ease-in-out}.datepicker{width:100%;max-width:300px;display:inline-block;position:relative}.datepicker__input{background-color:var(--form-control-background-color);border:var(--spacing-1) solid var(--form-control-border-color);border-radius:var(--radius-sm);color:var(--form-control-color);cursor:pointer;justify-content:space-between;align-items:center;gap:var(--spacing-8);padding:var(--spacing-12);font-size:var(--font-size-sm);line-height:var(--line-height-normal);box-sizing:border-box;transition:border-color .2s,background-color .2s;display:flex}.datepicker__input:hover:not(.datepicker__input--disabled){border-color:var(--form-control-focus-border-color)}.datepicker__input--open{border-color:var(--form-control-focus-border-color);background-color:var(--form-control-focus-background-color)}.datepicker__input--disabled{opacity:.5;cursor:not-allowed}.datepicker__value{font-size:inherit;white-space:nowrap;text-overflow:ellipsis;flex:1;overflow:hidden}.datepicker__value--placeholder{color:var(--form-control-placeholder-color)}.datepicker__actions{align-items:center;gap:var(--spacing-4);display:flex}.datepicker__clear{color:var(--form-control-placeholder-color);cursor:pointer;font-size:var(--font-size-md);background:0 0;border:none;padding:0;line-height:1;transition:color .2s}.datepicker__clear:hover{color:var(--form-control-color)}.datepicker__icon{font-size:var(--font-size-md);line-height:1}.datepicker__dropdown{background-color:var(--calendar-background-color);border:1px solid var(--calendar-border-color);border-radius:var(--radius);padding:var(--spacing-16);box-sizing:border-box;min-width:280px;max-height:calc(100vh - var(--spacing-32));z-index:1100;position:fixed;top:0;left:0;overflow-y:auto;box-shadow:0 4px 12px #00000026}.datepicker__dropdown--inline{margin-top:var(--spacing-12);box-shadow:none;z-index:auto;max-height:none;position:static;overflow:visible}.datepicker__dropdown-close{width:var(--spacing-32);height:var(--spacing-32);margin:calc(var(--spacing-16) * -1) calc(var(--spacing-16) * -1) 0 auto;border-radius:var(--radius-full);color:var(--body-sub-title-color);cursor:pointer;z-index:1;background:0 0;border:none;justify-content:center;align-items:center;transition:color .2s,background-color .2s;display:flex;position:sticky;top:0}.datepicker__dropdown-close:hover{color:var(--body-color);background-color:var(--card-background-accent-color)}.datepicker__time{border-top:1px solid var(--calendar-border-color);margin-top:var(--spacing-16);padding-top:var(--spacing-16)}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import './DatePicker.css';
|
|
2
|
+
import { Icon as H } from "../Icon/Icon2.js";
|
|
3
|
+
import { Tooltip as Y } from "../Tooltip/Tooltip2.js";
|
|
4
|
+
import { APP_DATE_FORMAT as Z, formatDate as l } from "../../helpers/Datetime.js";
|
|
5
|
+
import { Calendar as O } from "../Calendar/Calendar2.js";
|
|
6
|
+
import { TimePicker as ee } from "../TimePicker/TimePicker2.js";
|
|
7
|
+
/* empty css */
|
|
8
|
+
import { useCallback as te, useEffect as x, useRef as E, useState as D } from "react";
|
|
9
|
+
import { Fragment as ne, jsx as i, jsxs as h } from "react/jsx-runtime";
|
|
10
|
+
import { createPortal as re } from "react-dom";
|
|
11
|
+
var me = ({ value: t, onChange: g, mode: s = "single", withTime: f = !1, timeFormat: L = "24h", withSeconds: w = !1, withClock: M = !1, clockSize: P = 208, minuteStep: I = 1, dateFormat: _ = Z, placeholder: z = "Select date...", disabled: b = !1, clearable: F = !0, autoClose: N = !0, alwaysOpen: r = !1, ...C }) => {
|
|
12
|
+
const [j, u] = D(!1), [k, S] = D({
|
|
13
|
+
hours: 0,
|
|
14
|
+
minutes: 0,
|
|
15
|
+
seconds: 0
|
|
16
|
+
}), [B, p] = D(null), [q, $] = D({
|
|
17
|
+
position: "fixed",
|
|
18
|
+
visibility: "hidden"
|
|
19
|
+
}), m = E(null), c = E(null);
|
|
20
|
+
x(() => {
|
|
21
|
+
f && t instanceof Date && S({
|
|
22
|
+
hours: t.getHours(),
|
|
23
|
+
minutes: t.getMinutes(),
|
|
24
|
+
seconds: t.getSeconds()
|
|
25
|
+
});
|
|
26
|
+
}, [t, f]);
|
|
27
|
+
const o = r ? !b : j;
|
|
28
|
+
x(() => {
|
|
29
|
+
if (r) return;
|
|
30
|
+
const e = (n) => {
|
|
31
|
+
o && m.current && c.current && !m.current.contains(n.target) && !c.current.contains(n.target) && (p(null), u(!1));
|
|
32
|
+
};
|
|
33
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
34
|
+
}, [r, o]);
|
|
35
|
+
const a = te(() => {
|
|
36
|
+
if (r || !o || !m.current || !c.current) return;
|
|
37
|
+
const e = m.current.getBoundingClientRect(), n = c.current.getBoundingClientRect(), d = 16, A = 8, Q = window.innerHeight - e.bottom - d, T = e.top - d, U = Q < n.height && T > n.height ? e.top - n.height - A : e.bottom + A, V = Math.max(d, Math.min(U, window.innerHeight - n.height - d)), X = Math.max(d, Math.min(e.left, window.innerWidth - n.width - d));
|
|
38
|
+
$({
|
|
39
|
+
position: "fixed",
|
|
40
|
+
top: `${V}px`,
|
|
41
|
+
left: `${X}px`,
|
|
42
|
+
zIndex: 1100
|
|
43
|
+
});
|
|
44
|
+
}, [r, o]);
|
|
45
|
+
x(() => {
|
|
46
|
+
if (r || !o) {
|
|
47
|
+
$({
|
|
48
|
+
position: "fixed",
|
|
49
|
+
visibility: "hidden"
|
|
50
|
+
});
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const e = requestAnimationFrame(() => requestAnimationFrame(a));
|
|
54
|
+
window.addEventListener("resize", a), window.addEventListener("scroll", a, !0);
|
|
55
|
+
const n = new ResizeObserver(() => a());
|
|
56
|
+
return c.current && n.observe(c.current), () => {
|
|
57
|
+
cancelAnimationFrame(e), n.disconnect(), window.removeEventListener("resize", a), window.removeEventListener("scroll", a, !0);
|
|
58
|
+
};
|
|
59
|
+
}, [
|
|
60
|
+
r,
|
|
61
|
+
o,
|
|
62
|
+
a
|
|
63
|
+
]);
|
|
64
|
+
const y = () => {
|
|
65
|
+
if (!t) return "";
|
|
66
|
+
if (s === "single" && t instanceof Date) {
|
|
67
|
+
const e = l(t, _);
|
|
68
|
+
return f ? `${e} ${w ? l(t, "HH:mm:ss") : l(t, "HH:mm")}` : e;
|
|
69
|
+
}
|
|
70
|
+
return s === "range" && t && "start" in t ? `${l(t.start, _)} - ${l(t.end, _)}` : s === "multiple" && Array.isArray(t) ? t.map((e) => l(e, _)).join(", ") : "";
|
|
71
|
+
}, W = (e) => {
|
|
72
|
+
if (!f || !(e instanceof Date)) {
|
|
73
|
+
g?.(e), N && s !== "multiple" && !r && u(!1);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const n = new Date(e);
|
|
77
|
+
n.setHours(k.hours, k.minutes, k.seconds), g?.(n), N && !r && u(!1);
|
|
78
|
+
}, G = (e) => {
|
|
79
|
+
if (S(e), !(t instanceof Date)) return;
|
|
80
|
+
const n = new Date(t);
|
|
81
|
+
n.setHours(e.hours, e.minutes, e.seconds), g?.(n);
|
|
82
|
+
}, J = (e) => {
|
|
83
|
+
e.stopPropagation(), p(null), g?.(void 0);
|
|
84
|
+
}, K = () => {
|
|
85
|
+
p(null), u(!1);
|
|
86
|
+
}, R = y(), v = () => /* @__PURE__ */ h(ne, { children: [/* @__PURE__ */ i(O, {
|
|
87
|
+
...C,
|
|
88
|
+
mode: s,
|
|
89
|
+
value: t,
|
|
90
|
+
onChange: W,
|
|
91
|
+
rangeStart: s === "range" ? B : C.rangeStart,
|
|
92
|
+
onRangeStartChange: s === "range" ? p : C.onRangeStartChange
|
|
93
|
+
}), f && s === "single" && t instanceof Date && /* @__PURE__ */ i("div", {
|
|
94
|
+
className: "datepicker__time",
|
|
95
|
+
children: /* @__PURE__ */ i(ee, {
|
|
96
|
+
clockSize: P,
|
|
97
|
+
format: L,
|
|
98
|
+
minuteStep: I,
|
|
99
|
+
onChange: G,
|
|
100
|
+
value: k,
|
|
101
|
+
withClock: M,
|
|
102
|
+
withSeconds: w
|
|
103
|
+
})
|
|
104
|
+
})] });
|
|
105
|
+
return /* @__PURE__ */ h("div", {
|
|
106
|
+
className: "datepicker",
|
|
107
|
+
children: [/* @__PURE__ */ h("div", {
|
|
108
|
+
ref: m,
|
|
109
|
+
className: `datepicker__input ${b ? "datepicker__input--disabled" : ""} ${o ? "datepicker__input--open" : ""}`,
|
|
110
|
+
onClick: () => {
|
|
111
|
+
b || r || (o && p(null), u(!o));
|
|
112
|
+
},
|
|
113
|
+
children: [/* @__PURE__ */ i("span", {
|
|
114
|
+
className: `datepicker__value ${R ? "" : "datepicker__value--placeholder"}`,
|
|
115
|
+
children: R || z
|
|
116
|
+
}), /* @__PURE__ */ h("div", {
|
|
117
|
+
className: "datepicker__actions",
|
|
118
|
+
children: [F && R && /* @__PURE__ */ i(Y, {
|
|
119
|
+
title: "Clear",
|
|
120
|
+
children: /* @__PURE__ */ i("button", {
|
|
121
|
+
type: "button",
|
|
122
|
+
className: "datepicker__clear",
|
|
123
|
+
onClick: J,
|
|
124
|
+
children: "×"
|
|
125
|
+
})
|
|
126
|
+
}), /* @__PURE__ */ i("span", {
|
|
127
|
+
className: "datepicker__icon",
|
|
128
|
+
children: /* @__PURE__ */ i(H, { name: "calendar" })
|
|
129
|
+
})]
|
|
130
|
+
})]
|
|
131
|
+
}), o && (r ? /* @__PURE__ */ i("div", {
|
|
132
|
+
ref: c,
|
|
133
|
+
className: "datepicker__dropdown datepicker__dropdown--inline",
|
|
134
|
+
children: v()
|
|
135
|
+
}) : re(/* @__PURE__ */ h("div", {
|
|
136
|
+
ref: c,
|
|
137
|
+
className: "datepicker__dropdown",
|
|
138
|
+
style: q,
|
|
139
|
+
children: [/* @__PURE__ */ i("button", {
|
|
140
|
+
type: "button",
|
|
141
|
+
className: "datepicker__dropdown-close",
|
|
142
|
+
onClick: K,
|
|
143
|
+
title: "Close",
|
|
144
|
+
children: /* @__PURE__ */ i(H, { name: "clear" })
|
|
145
|
+
}), v()]
|
|
146
|
+
}), document.body))]
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
export {
|
|
150
|
+
me as DatePicker
|
|
151
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.date-range-picker{gap:var(--spacing-12);background:var(--card-background-color);border:1px solid var(--delimiter-color);border-radius:var(--radius);-webkit-backdrop-filter:var(--card-backdrop-filter,none);padding:var(--spacing-16);flex-direction:column;display:flex}.date-range-picker__label-row{justify-content:space-between;align-items:center;gap:var(--spacing-8);display:flex}.date-range-picker__label{color:var(--form-control-label-color,var(--body-color));font-size:var(--form-control-label-font-size,inherit);font-weight:var(--form-control-label-font-weight,var(--font-weight-semibold));letter-spacing:var(--form-control-label-letter-spacing,normal);text-transform:var(--form-control-label-text-transform,none)}.date-range-picker__presets{gap:var(--spacing-4);flex-wrap:wrap;display:flex}.date-range-picker__inputs{align-items:center;gap:var(--spacing-8);flex-wrap:wrap;display:flex}.date-range-picker__inputs .input-text-wrapper{flex:1 1 var(--spacing-100)}.date-range-picker__inputs .input-text{width:100%}.date-range-picker__separator{color:var(--body-color-muted)}.date-range-picker__toggle{margin-left:auto}.date-range-picker__calendar{gap:var(--spacing-12);flex-direction:column;display:flex}.date-range-picker__overlay{background:var(--card-background-color);border:var(--spacing-1) solid var(--delimiter-color);border-radius:var(--radius);-webkit-backdrop-filter:var(--card-backdrop-filter,none);box-shadow:var(--card-surface-box-shadow,var(--card-box-shadow));max-height:calc(100vh - var(--spacing-32));max-width:calc(100vw - var(--spacing-32));padding:var(--spacing-16);position:fixed;top:0;left:0;overflow:auto}.date-range-picker__nav{justify-content:space-between;align-items:center;gap:var(--spacing-12);display:flex}.date-range-picker__nav .button{padding:var(--spacing-8) var(--spacing-12)}.date-range-picker__months{gap:var(--spacing-16);flex-wrap:wrap;display:flex}.date-range-picker__months .calendar{flex:1 1 var(--spacing-200)}
|