@memobit/libs 3.4.3 → 3.6.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/AngleSlider/AngleSlider2.js +27 -27
- package/dist/components/AppHeader/AppHeader2.js +39 -36
- package/dist/components/Auth/ChangePasswordModal/ChangePasswordModal2.js +48 -52
- package/dist/components/Auth/MfaSetupModal/MfaSetupModal2.js +64 -65
- package/dist/components/Blockquote/Blockquote2.js +14 -14
- package/dist/components/BulkActionBar/BulkActionBar2.js +34 -30
- package/dist/components/Calendar/Calendar2.js +10 -8
- package/dist/components/Card/Card.css +1 -1
- package/dist/components/Confetti/Confetti2.js +2 -3
- package/dist/components/ControlPanel/ControlPanelFilter.js +26 -26
- package/dist/components/DataView/DataView.CardView.js +8 -4
- package/dist/components/DataView/DataView.ColumnSelector.js +24 -21
- package/dist/components/DataView/DataView.MiniSort.js +18 -16
- package/dist/components/DataView/DataView2.js +90 -86
- package/dist/components/DiffViewer/DiffViewer2.js +124 -118
- package/dist/components/Dropdown/Dropdown2.js +0 -3
- package/dist/components/EventCalendar/EventCalendar.Chip.js +21 -21
- package/dist/components/EventCalendar/EventCalendar.Month.js +19 -19
- package/dist/components/FloatingWindow/FloatingWindow2.js +60 -60
- package/dist/components/Grid/Grid2.js +18 -18
- package/dist/components/InputPIN/InputPIN2.js +42 -42
- package/dist/components/MiniSort/MiniSort2.js +47 -43
- package/dist/components/MiniStatsCard/MiniStatsCard2.js +20 -20
- package/dist/components/Pagination/Pagination2.js +18 -18
- package/dist/components/Popover/Popover2.js +23 -21
- package/dist/components/ProtectedRoute/ProtectedRoute.css +1 -0
- package/dist/components/ProtectedRoute/ProtectedRoute2.js +19 -0
- package/dist/components/RangeSlider/RangeSlider2.js +25 -25
- package/dist/components/Rating/RatingIcon.js +9 -9
- package/dist/components/RichTextEditor/hooks/useLinkPrompt.js +7 -6
- package/dist/components/RollingNumber/RollingNumber2.js +33 -31
- package/dist/components/Separator/Separator2.js +27 -23
- package/dist/components/Skeleton/Skeleton2.js +6 -8
- package/dist/components/Slider/Slider2.js +32 -32
- package/dist/components/Splitter/Splitter2.js +34 -34
- package/dist/components/StackedBar/StackedBar2.js +36 -34
- package/dist/components/Stats/Stats2.js +20 -16
- package/dist/components/StickyBar/StickyBar2.js +26 -22
- package/dist/components/Timeline/Timeline2.js +53 -47
- package/dist/components/Tooltip/Tooltip2.js +7 -8
- package/dist/components/TourHud/TourHud2.js +20 -20
- package/dist/components/Transition/Transition2.js +20 -20
- package/dist/components/Tree/Tree2.js +23 -23
- package/dist/contexts/AuthContext/AuthContext.js +33 -32
- package/dist/helpers/Charts.js +18 -0
- package/dist/helpers/Http.js +102 -0
- package/dist/helpers/Images.js +19 -0
- package/dist/helpers/Numbers.js +5 -4
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/hooks/useAccountMenu.js +58 -0
- package/dist/http.d.ts +97 -0
- package/dist/http.js +14 -0
- package/dist/index.d.ts +152 -5
- package/dist/index.js +334 -309
- package/dist/node_modules/qrcode.react/lib/esm/index.js +2 -2
- package/dist/router.d.ts +18 -0
- package/dist/router.js +4 -0
- package/dist/version.js +2 -2
- package/dist/version.json +4 -4
- package/package.json +38 -23
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
2
3
|
import { Context } from 'react';
|
|
3
4
|
import { CSSProperties } from 'react';
|
|
4
5
|
import { default as default_2 } from 'react';
|
|
@@ -8,13 +9,14 @@ import { FocusEvent as FocusEvent_2 } from 'react';
|
|
|
8
9
|
import { ForwardRefExoticComponent } from 'react';
|
|
9
10
|
import { getThemeConfig } from '@memobit/themes';
|
|
10
11
|
import { IconName } from '@memobit/icons';
|
|
11
|
-
import { JSX } from 'react
|
|
12
|
+
import { JSX } from 'react';
|
|
12
13
|
import { KeyboardEvent as KeyboardEvent_2 } from 'react';
|
|
13
14
|
import { MouseEvent as MouseEvent_2 } from 'react';
|
|
14
15
|
import { ReactElement } from 'react';
|
|
15
16
|
import { ReactNode } from 'react';
|
|
16
17
|
import { ReactPortal } from 'react';
|
|
17
18
|
import { RefAttributes } from 'react';
|
|
19
|
+
import { SyntheticEvent } from 'react';
|
|
18
20
|
import { THEME_CONFIGS } from '@memobit/themes';
|
|
19
21
|
import { ThemeConfig } from '@memobit/themes';
|
|
20
22
|
import { TouchEvent as TouchEvent_2 } from 'react';
|
|
@@ -37,6 +39,11 @@ export declare interface AccordionProps {
|
|
|
37
39
|
className?: string;
|
|
38
40
|
}
|
|
39
41
|
|
|
42
|
+
declare interface AccountMenuModalProps {
|
|
43
|
+
isOpen: boolean;
|
|
44
|
+
onClose: () => void;
|
|
45
|
+
}
|
|
46
|
+
|
|
40
47
|
/**
|
|
41
48
|
* Adds days to a date
|
|
42
49
|
*/
|
|
@@ -104,6 +111,25 @@ export declare interface AngleSliderProps {
|
|
|
104
111
|
|
|
105
112
|
export declare type AngleSliderVariant = 'accent' | 'info' | 'success' | 'warning' | 'danger';
|
|
106
113
|
|
|
114
|
+
export declare interface ApiClient {
|
|
115
|
+
get: <T>(path: string) => Promise<T>;
|
|
116
|
+
post: <T, P = unknown>(path: string, payload?: P) => Promise<T>;
|
|
117
|
+
put: <T, P = unknown>(path: string, payload?: P) => Promise<T>;
|
|
118
|
+
patch: <T, P = unknown>(path: string, payload?: P) => Promise<T>;
|
|
119
|
+
delete: <T>(path: string) => Promise<T>;
|
|
120
|
+
upload: <T>(path: string, formData: FormData) => Promise<T>;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export declare interface ApiClientConfig {
|
|
124
|
+
baseUrl: string;
|
|
125
|
+
loginPath?: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export declare class ApiError extends Error {
|
|
129
|
+
readonly status: number;
|
|
130
|
+
constructor(message: string, status: number);
|
|
131
|
+
}
|
|
132
|
+
|
|
107
133
|
export declare const APP_DATE_FORMAT = "DD MMM YYYY";
|
|
108
134
|
|
|
109
135
|
export declare const APP_DATE_TIME_FORMAT = "DD MMM YYYY HH:mm";
|
|
@@ -126,6 +152,8 @@ export declare interface AppHeaderProps {
|
|
|
126
152
|
showSeparator?: boolean;
|
|
127
153
|
}
|
|
128
154
|
|
|
155
|
+
export declare const applyImageFallback: (event: SyntheticEvent<HTMLImageElement>, categoryKey?: string) => void;
|
|
156
|
+
|
|
129
157
|
export declare interface AppPersistenceDefaults<TPages, TTheme> {
|
|
130
158
|
pages?: TPages;
|
|
131
159
|
theme: TTheme;
|
|
@@ -164,7 +192,7 @@ export declare interface AuthContextValue {
|
|
|
164
192
|
|
|
165
193
|
export declare function AuthLogin({ redirectPath }: LoginProps): ReactElement;
|
|
166
194
|
|
|
167
|
-
export declare function AuthProvider({ children, config }: AuthProviderProps): JSX.Element;
|
|
195
|
+
export declare function AuthProvider({ children, config }: AuthProviderProps): default_2.JSX.Element;
|
|
168
196
|
|
|
169
197
|
declare interface AuthProviderProps {
|
|
170
198
|
children: default_2.ReactNode;
|
|
@@ -303,6 +331,8 @@ export declare const breakpoints: {
|
|
|
303
331
|
};
|
|
304
332
|
};
|
|
305
333
|
|
|
334
|
+
export declare const buildRequestHeaders: (method: HttpMethod, json?: boolean) => Record<string, string>;
|
|
335
|
+
|
|
306
336
|
export declare interface BulkAction {
|
|
307
337
|
key: string;
|
|
308
338
|
label: string;
|
|
@@ -479,6 +509,20 @@ declare interface ChangePasswordModalProps {
|
|
|
479
509
|
onClose: () => void;
|
|
480
510
|
}
|
|
481
511
|
|
|
512
|
+
export declare const chartColors: {
|
|
513
|
+
readonly axis: "var(--body-color-muted)";
|
|
514
|
+
readonly grid: "var(--border-color)";
|
|
515
|
+
readonly text: "var(--body-color)";
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
declare interface ChartTooltipStyle {
|
|
519
|
+
contentStyle: CSSProperties;
|
|
520
|
+
itemStyle: CSSProperties;
|
|
521
|
+
labelStyle: CSSProperties;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
export declare const chartTooltipStyle: ChartTooltipStyle;
|
|
525
|
+
|
|
482
526
|
export declare const Checkbox: FC<CheckboxProps>;
|
|
483
527
|
|
|
484
528
|
declare interface CheckboxProps {
|
|
@@ -512,6 +556,8 @@ export declare type ChipSize = 'xsmall' | 'small' | 'medium' | 'large';
|
|
|
512
556
|
|
|
513
557
|
export declare type ChipVariant = 'plain' | 'default' | 'success' | 'info' | 'warning' | 'danger';
|
|
514
558
|
|
|
559
|
+
export declare const clamp: (value: number, min: number, max: number) => number;
|
|
560
|
+
|
|
515
561
|
export declare const Col: FC<ColProps>;
|
|
516
562
|
|
|
517
563
|
export declare const CollapsibleSection: default_2.FC<CollapsibleSectionProps>;
|
|
@@ -977,7 +1023,17 @@ declare interface CountryWithFlagProps {
|
|
|
977
1023
|
className?: string;
|
|
978
1024
|
}
|
|
979
1025
|
|
|
980
|
-
|
|
1026
|
+
/**
|
|
1027
|
+
* Cookie-session API client shared by the memobit apps: sends credentials, adds the CSRF
|
|
1028
|
+
* header on mutating requests, surfaces the server's `error` message, and on 401 navigates
|
|
1029
|
+
* to the login page. The 401 path returns a promise that never settles so callers don't
|
|
1030
|
+
* flash an error toast while the browser is already leaving the page.
|
|
1031
|
+
*/
|
|
1032
|
+
export declare const createApiClient: ({ baseUrl, loginPath }: ApiClientConfig) => ApiClient;
|
|
1033
|
+
|
|
1034
|
+
export declare const CSRF_HEADER = "X-CSRF-Token";
|
|
1035
|
+
|
|
1036
|
+
declare function DataView_2<T>({ columns, data, rowKey, pinnedIds, selectable, onSelectionChange, selectedIds: controlledSelectedIds, pageSizeOptions, initialPageSize, showPageSize, card, actions, actionsWidth, timeline, onRowClick, rowHref, rowClassName, rowDetail, empty, initialSortKey, initialSortDirection, sortKey: controlledSortKey, sortDirection: controlledSortDirection, onSortChange, miniSort, showCardSortControls, desktopView, cardMaxWidth, className, onPageChange, onPageSizeChange, currentPage: controlledCurrentPage, totalItems: controlledTotalItems, group, showResultsCount, totalCount, itemNoun, columnSelector, }: DataViewProps<T>): default_2.JSX.Element;
|
|
981
1037
|
export { DataView_2 as DataView }
|
|
982
1038
|
|
|
983
1039
|
export declare interface DataViewCardConfig<T> {
|
|
@@ -1646,11 +1702,26 @@ export declare const formatSecondsToMediaTime: (seconds: number | undefined) =>
|
|
|
1646
1702
|
|
|
1647
1703
|
export declare const fuzzyMatch: (text: string, query: string) => boolean;
|
|
1648
1704
|
|
|
1705
|
+
export declare const getCategoryImageUrl: (categoryKey: string) => string;
|
|
1706
|
+
|
|
1707
|
+
export declare const getCsrfToken: () => string | null;
|
|
1708
|
+
|
|
1649
1709
|
/**
|
|
1650
1710
|
* Gets the number of days in a specific month
|
|
1651
1711
|
*/
|
|
1652
1712
|
export declare const getDaysInMonth: (year: number, month: number) => number;
|
|
1653
1713
|
|
|
1714
|
+
export declare const getDefaultImageUrl: () => string;
|
|
1715
|
+
|
|
1716
|
+
/**
|
|
1717
|
+
* Resolves what an <img> should show for a stored image value:
|
|
1718
|
+
* - a File (new, unsaved upload) → a blob URL
|
|
1719
|
+
* - a full URL, blob URL or already-prefixed path → unchanged
|
|
1720
|
+
* - empty → the category fallback, else the app default
|
|
1721
|
+
* - a bare filename → its path under specific/
|
|
1722
|
+
*/
|
|
1723
|
+
export declare const getImageUrl: (filename: string | File, categoryKey?: string) => string;
|
|
1724
|
+
|
|
1654
1725
|
export declare const getIndicatorColor: (bmi: number, ranges: BMIRange[]) => string;
|
|
1655
1726
|
|
|
1656
1727
|
export declare const getIndicatorPosition: (bmi: number, ranges: BMIRange[]) => number;
|
|
@@ -1668,6 +1739,8 @@ export declare const getIsoWeek: (date: Date) => number;
|
|
|
1668
1739
|
*/
|
|
1669
1740
|
export declare const getMonthMatrix: (year: number, month: number, firstDayOfWeek?: 0 | 1) => Date[][];
|
|
1670
1741
|
|
|
1742
|
+
export declare const getNextImageFallback: (currentSrc: string, categoryKey?: string) => string | null;
|
|
1743
|
+
|
|
1671
1744
|
export declare const getPediatricRanges: (p5: number, p85: number, p95: number) => BMIRange[];
|
|
1672
1745
|
|
|
1673
1746
|
export declare const getPercent: (value: number, total: number) => number;
|
|
@@ -1735,6 +1808,54 @@ export declare const htmlToMarkdown: (html: string) => string;
|
|
|
1735
1808
|
*/
|
|
1736
1809
|
export declare const htmlToPlainText: (html: string | undefined | null) => string;
|
|
1737
1810
|
|
|
1811
|
+
export declare const HttpMethod: {
|
|
1812
|
+
readonly Get: "GET";
|
|
1813
|
+
readonly Post: "POST";
|
|
1814
|
+
readonly Put: "PUT";
|
|
1815
|
+
readonly Patch: "PATCH";
|
|
1816
|
+
readonly Delete: "DELETE";
|
|
1817
|
+
};
|
|
1818
|
+
|
|
1819
|
+
export declare type HttpMethod = (typeof HttpMethod)[keyof typeof HttpMethod];
|
|
1820
|
+
|
|
1821
|
+
export declare const HttpStatus: {
|
|
1822
|
+
readonly Continue: 100;
|
|
1823
|
+
readonly SwitchingProtocols: 101;
|
|
1824
|
+
readonly Ok: 200;
|
|
1825
|
+
readonly Created: 201;
|
|
1826
|
+
readonly Accepted: 202;
|
|
1827
|
+
readonly NoContent: 204;
|
|
1828
|
+
readonly PartialContent: 206;
|
|
1829
|
+
readonly MovedPermanently: 301;
|
|
1830
|
+
readonly Found: 302;
|
|
1831
|
+
readonly SeeOther: 303;
|
|
1832
|
+
readonly NotModified: 304;
|
|
1833
|
+
readonly TemporaryRedirect: 307;
|
|
1834
|
+
readonly PermanentRedirect: 308;
|
|
1835
|
+
readonly BadRequest: 400;
|
|
1836
|
+
readonly Unauthorized: 401;
|
|
1837
|
+
readonly PaymentRequired: 402;
|
|
1838
|
+
readonly Forbidden: 403;
|
|
1839
|
+
readonly NotFound: 404;
|
|
1840
|
+
readonly MethodNotAllowed: 405;
|
|
1841
|
+
readonly NotAcceptable: 406;
|
|
1842
|
+
readonly RequestTimeout: 408;
|
|
1843
|
+
readonly Conflict: 409;
|
|
1844
|
+
readonly Gone: 410;
|
|
1845
|
+
readonly PayloadTooLarge: 413;
|
|
1846
|
+
readonly UnsupportedMediaType: 415;
|
|
1847
|
+
readonly UnprocessableEntity: 422;
|
|
1848
|
+
readonly Locked: 423;
|
|
1849
|
+
readonly TooManyRequests: 429;
|
|
1850
|
+
readonly InternalServerError: 500;
|
|
1851
|
+
readonly NotImplemented: 501;
|
|
1852
|
+
readonly BadGateway: 502;
|
|
1853
|
+
readonly ServiceUnavailable: 503;
|
|
1854
|
+
readonly GatewayTimeout: 504;
|
|
1855
|
+
};
|
|
1856
|
+
|
|
1857
|
+
export declare type HttpStatus = (typeof HttpStatus)[keyof typeof HttpStatus];
|
|
1858
|
+
|
|
1738
1859
|
export declare const Icon: default_2.FC<IconProps>;
|
|
1739
1860
|
|
|
1740
1861
|
/**
|
|
@@ -1785,6 +1906,8 @@ export declare type IconSize = 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | 'xxxl';
|
|
|
1785
1906
|
|
|
1786
1907
|
export declare type IconVariant = 'default' | 'muted' | 'accent' | 'info' | 'success' | 'warning' | 'danger';
|
|
1787
1908
|
|
|
1909
|
+
export declare const IMAGES_BASE_PATH = "/data-files/images";
|
|
1910
|
+
|
|
1788
1911
|
export declare const InfiniteScroll: ({ children, onLoadMore, hasMore, isLoading, threshold, rootMargin, height, onScrollChange, endMessage, className, }: InfiniteScrollProps) => JSX.Element;
|
|
1789
1912
|
|
|
1790
1913
|
declare interface InfiniteScrollProps {
|
|
@@ -2153,6 +2276,8 @@ export declare const isAfter: (date: Date, compareDate: Date) => boolean;
|
|
|
2153
2276
|
*/
|
|
2154
2277
|
export declare const isBefore: (date: Date, compareDate: Date) => boolean;
|
|
2155
2278
|
|
|
2279
|
+
export declare const isClientErrorStatus: (status: number) => boolean;
|
|
2280
|
+
|
|
2156
2281
|
/**
|
|
2157
2282
|
* Checks if a date is within a range (inclusive)
|
|
2158
2283
|
*/
|
|
@@ -2163,6 +2288,10 @@ export declare const isDateInRange: (date: Date, start: Date, end: Date) => bool
|
|
|
2163
2288
|
*/
|
|
2164
2289
|
export declare const isSameDay: (date1: Date, date2: Date) => boolean;
|
|
2165
2290
|
|
|
2291
|
+
export declare const isServerErrorStatus: (status: number) => boolean;
|
|
2292
|
+
|
|
2293
|
+
export declare const isSuccessStatus: (status: number) => boolean;
|
|
2294
|
+
|
|
2166
2295
|
/**
|
|
2167
2296
|
* Checks if a date is today
|
|
2168
2297
|
*/
|
|
@@ -2676,7 +2805,9 @@ declare interface RatingProps {
|
|
|
2676
2805
|
|
|
2677
2806
|
export declare type RatingVariant = 'success' | 'info' | 'warning' | 'danger';
|
|
2678
2807
|
|
|
2679
|
-
export declare const
|
|
2808
|
+
export declare const readErrorMessage: (response: Response) => Promise<string>;
|
|
2809
|
+
|
|
2810
|
+
export declare const RichTextEditor: ({ advanced, error, format, id, label, onBlur, onChange, placeholder, required, value, }: RichTextEditorProps) => default_2.JSX.Element;
|
|
2680
2811
|
|
|
2681
2812
|
declare interface RichTextEditorProps {
|
|
2682
2813
|
advanced?: boolean;
|
|
@@ -3178,7 +3309,7 @@ export declare interface ToastAction {
|
|
|
3178
3309
|
onClick: () => void;
|
|
3179
3310
|
}
|
|
3180
3311
|
|
|
3181
|
-
export declare const ToastContainer: ({ position, showDismissButton }: ToastContainerProps) => JSX.Element;
|
|
3312
|
+
export declare const ToastContainer: ({ position, showDismissButton }: ToastContainerProps) => default_2.JSX.Element;
|
|
3182
3313
|
|
|
3183
3314
|
export declare type ToastContainerPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'top' | 'bottom' | 'left' | 'right';
|
|
3184
3315
|
|
|
@@ -3435,6 +3566,22 @@ declare type TreeVariant = 'default' | 'info' | 'success' | 'warning' | 'danger'
|
|
|
3435
3566
|
|
|
3436
3567
|
export declare const truncateText: (text: string, maxLength?: number, separator?: string) => string;
|
|
3437
3568
|
|
|
3569
|
+
export declare const useAccountMenu: ({ appName, mfaModal: MfaModal, themeLabel, loginPath }: UseAccountMenuOptions) => UseAccountMenuReturn;
|
|
3570
|
+
|
|
3571
|
+
export declare interface UseAccountMenuOptions {
|
|
3572
|
+
appName: string;
|
|
3573
|
+
mfaModal?: ComponentType<AccountMenuModalProps>;
|
|
3574
|
+
themeLabel?: string;
|
|
3575
|
+
loginPath?: string;
|
|
3576
|
+
}
|
|
3577
|
+
|
|
3578
|
+
export declare interface UseAccountMenuReturn {
|
|
3579
|
+
themeItem: MenuHamburgerItem;
|
|
3580
|
+
accountItems: MenuHamburgerItem[];
|
|
3581
|
+
items: MenuHamburgerItem[];
|
|
3582
|
+
modals: ReactElement;
|
|
3583
|
+
}
|
|
3584
|
+
|
|
3438
3585
|
export declare function useAppPersistence<TPages, TTheme>(appId: string, defaults: AppPersistenceDefaults<TPages, TTheme>): UseAppPersistenceReturn<TPages, TTheme>;
|
|
3439
3586
|
|
|
3440
3587
|
export declare interface UseAppPersistenceReturn<TPages, TTheme> {
|