@smartsoft001/react 2.202.0 → 2.204.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/package.json +4 -4
- package/src/lib/components/list/desktop/list-desktop.d.ts +3 -3
- package/src/lib/components/list/desktop/list-desktop.js +8 -5
- package/src/lib/components/list/desktop/list-desktop.js.map +1 -1
- package/src/lib/components/list/desktop/preset/list-desktop-preset.d.ts +2 -1
- package/src/lib/components/list/desktop/preset/list-desktop-preset.js +7 -3
- package/src/lib/components/list/desktop/preset/list-desktop-preset.js.map +1 -1
- package/src/lib/components/list/desktop/preset/preset-classes.d.ts +4 -0
- package/src/lib/components/list/desktop/preset/preset-classes.js +24 -0
- package/src/lib/components/list/desktop/preset/preset-classes.js.map +1 -1
- package/src/lib/components/list/desktop/use-list-desktop.d.ts +9 -1
- package/src/lib/components/list/desktop/use-list-desktop.js +5 -3
- package/src/lib/components/list/desktop/use-list-desktop.js.map +1 -1
- package/src/lib/components/list/index.d.ts +2 -0
- package/src/lib/components/list/index.js +2 -0
- package/src/lib/components/list/index.js.map +1 -1
- package/src/lib/components/list/list-details-modal.d.ts +19 -0
- package/src/lib/components/list/list-details-modal.js +16 -0
- package/src/lib/components/list/list-details-modal.js.map +1 -0
- package/src/lib/components/list/list-sort.d.ts +31 -0
- package/src/lib/components/list/list-sort.js +43 -0
- package/src/lib/components/list/list-sort.js.map +1 -0
- package/src/lib/components/list/masonry-grid/list-masonry-grid.d.ts +2 -1
- package/src/lib/components/list/masonry-grid/list-masonry-grid.js +7 -6
- package/src/lib/components/list/masonry-grid/list-masonry-grid.js.map +1 -1
- package/src/lib/components/list/masonry-grid/preset/list-masonry-grid-preset.js +7 -7
- package/src/lib/components/list/masonry-grid/preset/list-masonry-grid-preset.js.map +1 -1
- package/src/lib/components/list/masonry-grid/use-list-masonry-grid.d.ts +7 -0
- package/src/lib/components/list/mobile/list-mobile.d.ts +2 -2
- package/src/lib/components/list/mobile/list-mobile.js +4 -4
- package/src/lib/components/list/mobile/list-mobile.js.map +1 -1
- package/src/lib/components/list/mobile/preset/list-mobile-preset.js +2 -2
- package/src/lib/components/list/mobile/preset/list-mobile-preset.js.map +1 -1
- package/src/lib/components/list/use-list.d.ts +15 -0
- package/src/lib/components/list/use-list.js +74 -2
- package/src/lib/components/list/use-list.js.map +1 -1
- package/src/lib/components/modal/preset/modal-preset.js +15 -2
- package/src/lib/components/modal/preset/modal-preset.js.map +1 -1
- package/src/lib/components/modal/preset/preset-classes.js +45 -7
- package/src/lib/components/modal/preset/preset-classes.js.map +1 -1
- package/src/lib/components/modal/standard/modal-standard.d.ts +2 -1
- package/src/lib/components/modal/standard/modal-standard.js +26 -2
- package/src/lib/components/modal/standard/modal-standard.js.map +1 -1
- package/src/lib/components/overlays/overlays.d.ts +13 -4
- package/src/lib/components/overlays/overlays.js +67 -11
- package/src/lib/components/overlays/overlays.js.map +1 -1
- package/src/lib/components/page/standard/page-standard.d.ts +3 -5
- package/src/lib/components/page/standard/page-standard.js +4 -6
- package/src/lib/components/page/standard/page-standard.js.map +1 -1
- package/src/lib/components/vertical-navigation/preset/preset-classes.d.ts +1 -0
- package/src/lib/components/vertical-navigation/preset/preset-classes.js +13 -0
- package/src/lib/components/vertical-navigation/preset/preset-classes.js.map +1 -1
- package/src/lib/components/vertical-navigation/preset/vertical-navigation-preset.d.ts +3 -2
- package/src/lib/components/vertical-navigation/preset/vertical-navigation-preset.js +8 -3
- package/src/lib/components/vertical-navigation/preset/vertical-navigation-preset.js.map +1 -1
- package/src/lib/components/vertical-navigation/standard/vertical-navigation-standard.d.ts +5 -1
- package/src/lib/components/vertical-navigation/standard/vertical-navigation-standard.js +11 -2
- package/src/lib/components/vertical-navigation/standard/vertical-navigation-standard.js.map +1 -1
- package/src/lib/models/interfaces.d.ts +21 -1
- package/src/lib/models/interfaces.js.map +1 -1
- package/src/lib/providers/model-possibilities.provider.d.ts +1 -1
- package/src/lib/providers/model-possibilities.provider.js +1 -1
- package/src/lib/services/modal/modal.service.d.ts +22 -1
- package/src/lib/services/modal/modal.service.js +31 -1
- package/src/lib/services/modal/modal.service.js.map +1 -1
- package/src/lib/services/toast/toast.service.d.ts +12 -4
- package/src/lib/services/toast/toast.service.js +12 -4
- package/src/lib/services/toast/toast.service.js.map +1 -1
- package/styles.css +33 -0
|
@@ -9,6 +9,7 @@ const react_1 = require("react");
|
|
|
9
9
|
const react_dom_1 = require("react-dom");
|
|
10
10
|
const smart_context_1 = require("../../providers/smart-context");
|
|
11
11
|
const store_1 = require("../../store/store");
|
|
12
|
+
const class_names_1 = require("../../utils/class-names");
|
|
12
13
|
const alert_1 = require("../alert/alert");
|
|
13
14
|
const modal_1 = require("../modal/modal");
|
|
14
15
|
const notification_1 = require("../notification/notification");
|
|
@@ -20,19 +21,47 @@ function BodyPortal({ children }) {
|
|
|
20
21
|
return null;
|
|
21
22
|
return (0, react_dom_1.createPortal)(children, document.body);
|
|
22
23
|
}
|
|
23
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* The notification variant of a toast: `simple` without buttons (it renders no
|
|
26
|
+
* actions), `condensed` for a message with buttons, `with-actions-below` for a
|
|
27
|
+
* title, its message and buttons (`condensed` would drop the message).
|
|
28
|
+
*/
|
|
29
|
+
function getToastVariant(toast) {
|
|
30
|
+
if (!toast.buttons?.length)
|
|
31
|
+
return 'simple';
|
|
32
|
+
return toast.title ? 'with-actions-below' : 'condensed';
|
|
33
|
+
}
|
|
34
|
+
/** The buttons of a toast as notification actions, keyed by their index. */
|
|
35
|
+
function getToastActions(toast) {
|
|
36
|
+
return toast.buttons?.map((button, index) => ({
|
|
37
|
+
id: String(index),
|
|
38
|
+
label: button.text,
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The toasts of `ToastService`, rendered through `<SmartNotification>` in a
|
|
43
|
+
* stack fixed to the bottom of the viewport, above the modals. A toast shows
|
|
44
|
+
* its title with the message under it, or the message alone; its buttons are
|
|
45
|
+
* the notification's actions, each running its handler and closing the toast.
|
|
46
|
+
* Error toasts are announced assertively, info toasts politely.
|
|
47
|
+
*/
|
|
24
48
|
function SmartToastHost() {
|
|
25
49
|
const { toastService } = (0, smart_context_1.useSmart)();
|
|
26
50
|
const toasts = (0, store_1.useStore)(toastService.toasts);
|
|
27
51
|
if (!toasts.length)
|
|
28
52
|
return null;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
53
|
+
const runAction = (toast, actionId) => {
|
|
54
|
+
try {
|
|
55
|
+
toast.buttons?.[Number(actionId)]?.handler();
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
toastService.dismiss(toast.id);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)(BodyPortal, { children: (0, jsx_runtime_1.jsx)("div", { className: "smart:pointer-events-none smart:fixed smart:inset-x-0 smart:bottom-0 smart:z-[100] smart:flex smart:flex-col smart:items-center smart:gap-2 smart:p-4 smart:sm:items-end", "data-role": "toasts", children: toasts.map((toast) => ((0, jsx_runtime_1.jsx)("div", { className: "smart:pointer-events-auto smart:w-full smart:max-w-sm", "data-type": toast.type, children: (0, jsx_runtime_1.jsx)(notification_1.SmartNotification, { title: toast.title || toast.message, description: toast.title ? toast.message : undefined, dismissible: true, actions: getToastActions(toast), options: {
|
|
62
|
+
variant: getToastVariant(toast),
|
|
34
63
|
ariaLive: toast.type === 'error' ? 'assertive' : 'polite',
|
|
35
|
-
}, onActionClick: ({ actionId }) => toast
|
|
64
|
+
}, onActionClick: ({ actionId }) => runAction(toast, actionId), onDismissed: () => toastService.dismiss(toast.id) }) }, toast.id))) }) }));
|
|
36
65
|
}
|
|
37
66
|
/** The dialogs `AlertService.show` opened, rendered through `<SmartAlert>`. */
|
|
38
67
|
function SmartAlertHost() {
|
|
@@ -42,17 +71,44 @@ function SmartAlertHost() {
|
|
|
42
71
|
return null;
|
|
43
72
|
return ((0, jsx_runtime_1.jsx)(BodyPortal, { children: alerts.map((alert) => ((0, jsx_runtime_1.jsx)(alert_1.SmartAlert, { options: alert.options, onDismissed: alert.resolve }, alert.id))) }));
|
|
44
73
|
}
|
|
74
|
+
/** The modals of `ModalService` show their close button. */
|
|
75
|
+
const MODAL_HOST_OPTIONS = { withDismiss: true };
|
|
76
|
+
/** `mode: 'bottom'`: the bottom sheet, with its close button. */
|
|
77
|
+
const MODAL_HOST_BOTTOM_SHEET_OPTIONS = {
|
|
78
|
+
withDismiss: true,
|
|
79
|
+
variant: 'bottom-sheet',
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* With `backdropDismiss: false`, stops a click that lands in the modal but
|
|
83
|
+
* outside its dialog (the backdrop) before the modal sees it.
|
|
84
|
+
*/
|
|
85
|
+
function keepOpenOnBackdrop(request, event) {
|
|
86
|
+
if (request.backdropDismiss !== false)
|
|
87
|
+
return;
|
|
88
|
+
const target = event.target;
|
|
89
|
+
if (!target?.closest?.('[role="dialog"]'))
|
|
90
|
+
event.stopPropagation();
|
|
91
|
+
}
|
|
45
92
|
/**
|
|
46
|
-
* The components `ModalService.show` opened, each in a `<SmartModal
|
|
47
|
-
* component gets its `props` and a
|
|
48
|
-
* modal with a result.
|
|
93
|
+
* The components `ModalService.show` opened, each in a `<SmartModal>` with its
|
|
94
|
+
* close button, the last one on top. The component gets its `props` and a
|
|
95
|
+
* `dismiss(data)` prop that closes the modal with a result. `mode: 'bottom'`
|
|
96
|
+
* renders the `'bottom-sheet'` variant; `cssClass` (and `smart-modal-bottom`
|
|
97
|
+
* for `mode: 'bottom'`) goes on the modal; with `backdropDismiss: false` a
|
|
98
|
+
* click on the backdrop leaves it open.
|
|
49
99
|
*/
|
|
50
100
|
function SmartModalHost() {
|
|
51
101
|
const { modalService } = (0, smart_context_1.useSmart)();
|
|
52
102
|
const modals = (0, store_1.useStore)(modalService.modals);
|
|
53
103
|
if (!modals.length)
|
|
54
104
|
return null;
|
|
55
|
-
return ((0, jsx_runtime_1.jsx)(BodyPortal, { children: modals.map((
|
|
105
|
+
return ((0, jsx_runtime_1.jsx)(BodyPortal, { children: modals.map((request) => {
|
|
106
|
+
const { id, component: Component, props, dismiss, cssClass, mode, } = request;
|
|
107
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "smart:contents", "data-role": "modal", "data-mode": mode ?? 'default', onClickCapture: (event) => keepOpenOnBackdrop(request, event), children: (0, jsx_runtime_1.jsx)(modal_1.SmartModal, { open: true, className: (0, class_names_1.cn)(cssClass, mode === 'bottom' && 'smart-modal-bottom') ||
|
|
108
|
+
undefined, options: mode === 'bottom'
|
|
109
|
+
? MODAL_HOST_BOTTOM_SHEET_OPTIONS
|
|
110
|
+
: MODAL_HOST_OPTIONS, onClosed: () => dismiss(), children: (0, jsx_runtime_1.jsx)(Component, { ...(props ?? {}), dismiss: dismiss }) }) }, id));
|
|
111
|
+
}) }));
|
|
56
112
|
}
|
|
57
113
|
/**
|
|
58
114
|
* The hosts of everything the services open: toasts, alerts and modals.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlays.js","sourceRoot":"","sources":["../../../../../../../../packages/shared/react/src/lib/components/overlays/overlays.tsx"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"overlays.js","sourceRoot":"","sources":["../../../../../../../../packages/shared/react/src/lib/components/overlays/overlays.tsx"],"names":[],"mappings":";;AAuDA,wCA2CC;AAGD,wCAiBC;AAkCD,wCA8CC;AAMD,sCAQC;;AApND,iCAA4C;AAE5C,yCAAyC;AAOzC,iEAAyD;AAGzD,6CAA6C;AAC7C,yDAA6C;AAC7C,0CAA4C;AAC5C,0CAA4C;AAC5C,+DAAiE;AAEjE,8EAA8E;AAC9E,SAAS,UAAU,CAAC,EAAE,QAAQ,EAA2B;IACvD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAE9C,IAAA,iBAAS,EAAC,GAAG,EAAE,CAAC,U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EAAE,IAAI,KAAK,QAAQ,IAAI,oBAAoB,CAAC;wBACvD,SAAS,EAEX,OAAO,EACL,IAAI,KAAK,QAAQ;wBACf,CAAC,CAAC,+BAA+B;wBACjC,CAAC,CAAC,kBAAkB,EAExB,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,YAEzB,uBAAC,SAAS,OAAK,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,GAAI,GACvC,IApBR,EAAE,CAqBH,CACP,CAAC;QACJ,CAAC,CAAC,GACS,CACd,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAgB,aAAa;IAC3B,OAAO,CACL,6DACE,uBAAC,cAAc,KAAG,EAClB,uBAAC,cAAc,KAAG,EAClB,uBAAC,cAAc,KAAG,IACjB,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -2,9 +2,7 @@ import { SmartPageVariantProps } from '../page.types';
|
|
|
2
2
|
/**
|
|
3
3
|
* The default page rendering: a header with the optional back button, the
|
|
4
4
|
* translated title, the search input and the end buttons, followed by
|
|
5
|
-
* `options.bodyTpl
|
|
6
|
-
*
|
|
7
|
-
* It renders no wrapper element (header and body are siblings) and does not
|
|
8
|
-
* apply `className`.
|
|
5
|
+
* `options.bodyTpl`, inside a root element (`data-role="page"`) that takes
|
|
6
|
+
* `className`.
|
|
9
7
|
*/
|
|
10
|
-
export declare function SmartPageStandard({ options }: SmartPageVariantProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function SmartPageStandard({ options, className, }: SmartPageVariantProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,15 +8,13 @@ const use_page_1 = require("../use-page");
|
|
|
8
8
|
/**
|
|
9
9
|
* The default page rendering: a header with the optional back button, the
|
|
10
10
|
* translated title, the search input and the end buttons, followed by
|
|
11
|
-
* `options.bodyTpl
|
|
12
|
-
*
|
|
13
|
-
* It renders no wrapper element (header and body are siblings) and does not
|
|
14
|
-
* apply `className`.
|
|
11
|
+
* `options.bodyTpl`, inside a root element (`data-role="page"`) that takes
|
|
12
|
+
* `className`.
|
|
15
13
|
*/
|
|
16
|
-
function SmartPageStandard({ options }) {
|
|
14
|
+
function SmartPageStandard({ options, className, }) {
|
|
17
15
|
const t = (0, hooks_1.useTranslate)();
|
|
18
16
|
const { back } = (0, use_page_1.usePage)();
|
|
19
17
|
const search = options?.search;
|
|
20
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: className || undefined, "data-role": "page", children: [!options?.hideHeader ? ((0, jsx_runtime_1.jsxs)("div", { className: "smart:md:flex smart:md:items-center smart:md:justify-between smart:px-4 smart:py-4 smart:sm:px-6 smart:lg:px-8", children: [(0, jsx_runtime_1.jsx)("div", { className: "smart:min-w-0 smart:flex-1", children: (0, jsx_runtime_1.jsxs)("div", { className: "smart:flex smart:items-center smart:gap-x-3", children: [options?.showBackButton ? ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: back, className: "smart:inline-flex smart:items-center smart:rounded-md smart:p-1.5 smart:text-gray-400 smart:hover:text-gray-500 smart:dark:text-gray-500 smart:dark:hover:text-gray-400", children: (0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", className: "smart:size-5", children: (0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", d: "M17 10a.75.75 0 0 1-.75.75H5.612l4.158 3.96a.75.75 0 1 1-1.04 1.08l-5.5-5.25a.75.75 0 0 1 0-1.08l5.5-5.25a.75.75 0 1 1 1.04 1.08L5.612 9.25H16.25A.75.75 0 0 1 17 10Z", clipRule: "evenodd" }) }) })) : null, (0, jsx_runtime_1.jsx)("h2", { className: "smart:text-2xl/7 smart:font-bold smart:text-gray-900 smart:sm:truncate smart:sm:text-3xl smart:sm:tracking-tight smart:dark:text-white", children: t(options?.title ?? '') })] }) }), options?.endButtons?.length || search ? ((0, jsx_runtime_1.jsxs)("div", { className: "smart:mt-4 smart:flex smart:shrink-0 smart:gap-x-2 smart:md:ml-4 smart:md:mt-0", children: [search ? ((0, jsx_runtime_1.jsx)("div", { className: "smart:relative smart:rounded-md smart:shadow-xs", children: (0, jsx_runtime_1.jsx)("input", { type: "text", value: search.text ?? '', onChange: (e) => search.set(e.target.value), placeholder: t('search'), className: "smart:block smart:w-full smart:rounded-md smart:border-0 smart:py-1.5 smart:pl-3 smart:pr-10 smart:text-gray-900 smart:ring-1 smart:ring-inset smart:ring-gray-300 smart:placeholder:text-gray-400 smart:focus:ring-2 smart:focus:ring-inset smart:focus:ring-indigo-600 smart:sm:text-sm/6 smart:dark:bg-white/5 smart:dark:text-white smart:dark:ring-white/10 smart:dark:placeholder:text-gray-500" }) })) : null, (options?.endButtons ?? []).map((btn) => ((0, jsx_runtime_1.jsxs)(button_1.SmartButton, { options: (0, use_page_1.getPageButtonOptions)(btn), disabled: !!btn.disabled, children: [btn.text ? t(btn.text) : null, btn.number ? ((0, jsx_runtime_1.jsx)("span", { className: "smart:ml-1 smart:inline-flex smart:items-center smart:rounded-full smart:bg-indigo-100 smart:px-2 smart:py-0.5 smart:text-xs smart:font-medium smart:text-indigo-700 smart:dark:bg-indigo-500/10 smart:dark:text-indigo-400", children: btn.number })) : null] }, btn.icon)))] })) : null] })) : null, (0, jsx_runtime_1.jsx)("div", { className: "smart:px-4 smart:sm:px-6 smart:lg:px-8", children: options?.bodyTpl ? options.bodyTpl : null })] }));
|
|
21
19
|
}
|
|
22
20
|
//# sourceMappingURL=page-standard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-standard.js","sourceRoot":"","sources":["../../../../../../../../../packages/shared/react/src/lib/components/page/standard/page-standard.tsx"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"page-standard.js","sourceRoot":"","sources":["../../../../../../../../../packages/shared/react/src/lib/components/page/standard/page-standard.tsx"],"names":[],"mappings":";;AAWA,8CA2EC;;AAtFD,oDAAwD;AACxD,gD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AAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAC3C,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,EACxB,SAAS,EAAC,uYAAuY,GACjZ,GACE,CACP,CAAC,CAAC,CAAC,IAAI,EACP,CAAC,OAAO,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACxC,wBAAC,oBAAW,IAEV,OAAO,EAAE,IAAA,+BAAoB,EAAC,GAAG,CAAC,EAClC,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,aAEvB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAC7B,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CACZ,iCAAM,SAAS,EAAC,6NAA6N,YAC1O,GAAG,CAAC,MAAM,GACN,CACR,CAAC,CAAC,CAAC,IAAI,KATH,GAAG,CAAC,IAAI,CAUD,CACf,CAAC,IACE,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC,CAAC,CAAC,IAAI,EACR,gCAAK,SAAS,EAAC,wCAAwC,YACpD,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,GACtC,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare function getVerticalNavContainerClasses(): string;
|
|
2
2
|
export declare function getVerticalNavNavClasses(): string;
|
|
3
|
+
export declare function getVerticalNavListItemClasses(): string;
|
|
3
4
|
export declare function getVerticalNavGroupTitleClasses(): string;
|
|
4
5
|
export declare function getVerticalNavItemClasses(current: boolean): string;
|
|
5
6
|
export declare function getVerticalNavIconClasses(): string;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getVerticalNavContainerClasses = getVerticalNavContainerClasses;
|
|
7
7
|
exports.getVerticalNavNavClasses = getVerticalNavNavClasses;
|
|
8
|
+
exports.getVerticalNavListItemClasses = getVerticalNavListItemClasses;
|
|
8
9
|
exports.getVerticalNavGroupTitleClasses = getVerticalNavGroupTitleClasses;
|
|
9
10
|
exports.getVerticalNavItemClasses = getVerticalNavItemClasses;
|
|
10
11
|
exports.getVerticalNavIconClasses = getVerticalNavIconClasses;
|
|
@@ -16,12 +17,21 @@ const CONTAINER = [
|
|
|
16
17
|
'smart:border-gray-200',
|
|
17
18
|
'smart:dark:border-gray-700',
|
|
18
19
|
].join(' ');
|
|
20
|
+
// The list of a group's items. The list reset keeps it identical to the
|
|
21
|
+
// former per-group <nav> where the Tailwind preflight is not loaded.
|
|
19
22
|
const NAV = [
|
|
20
23
|
'smart:-me-0.5',
|
|
21
24
|
'smart:flex',
|
|
22
25
|
'smart:flex-col',
|
|
23
26
|
'smart:space-y-3',
|
|
27
|
+
'smart:my-0',
|
|
28
|
+
'smart:p-0',
|
|
29
|
+
'smart:list-none',
|
|
24
30
|
].join(' ');
|
|
31
|
+
// A column flex item, so the tab inside stretches to the full width (with
|
|
32
|
+
// its trailing border on the container's edge) as it did as a direct child
|
|
33
|
+
// of the group's flex column.
|
|
34
|
+
const LIST_ITEM = ['smart:flex', 'smart:flex-col'].join(' ');
|
|
25
35
|
const GROUP_TITLE = [
|
|
26
36
|
'smart:px-1',
|
|
27
37
|
'smart:pb-1',
|
|
@@ -98,6 +108,9 @@ function getVerticalNavContainerClasses() {
|
|
|
98
108
|
function getVerticalNavNavClasses() {
|
|
99
109
|
return NAV;
|
|
100
110
|
}
|
|
111
|
+
function getVerticalNavListItemClasses() {
|
|
112
|
+
return LIST_ITEM;
|
|
113
|
+
}
|
|
101
114
|
function getVerticalNavGroupTitleClasses() {
|
|
102
115
|
return GROUP_TITLE;
|
|
103
116
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset-classes.js","sourceRoot":"","sources":["../../../../../../../../../packages/shared/react/src/lib/components/vertical-navigation/preset/preset-classes.ts"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,2EAA2E;AAC3E,+EAA+E;;
|
|
1
|
+
{"version":3,"file":"preset-classes.js","sourceRoot":"","sources":["../../../../../../../../../packages/shared/react/src/lib/components/vertical-navigation/preset/preset-classes.ts"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,2EAA2E;AAC3E,+EAA+E;;AAuG/E,wEAEC;AAED,4DAEC;AAED,sEAEC;AAED,0EAEC;AAED,8DAEC;AAED,8DAEC;AAED,oEAEC;AAED,gEAEC;AAnID,MAAM,SAAS,GAAG;IAChB,cAAc;IACd,kBAAkB;IAClB,uBAAuB;IACvB,4BAA4B;CAC7B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,wEAAwE;AACxE,qEAAqE;AACrE,MAAM,GAAG,GAAG;IACV,eAAe;IACf,YAAY;IACZ,gBAAgB;IAChB,iBAAiB;IACjB,YAAY;IACZ,WAAW;IACX,iBAAiB;CAClB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,0EAA0E;AAC1E,2EAA2E;AAC3E,8BAA8B;AAC9B,MAAM,SAAS,GAAG,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE7D,MAAM,WAAW,GAAG;IAClB,YAAY;IACZ,YAAY;IACZ,eAAe;IACf,qBAAqB;IACrB,iBAAiB;IACjB,qBAAqB;IACrB,4EAA4E;IAC5E,sDAAsD;IACtD,qBAAqB;IACrB,0BAA0B;CAC3B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,8EAA8E;AAC9E,4CAA4C;AAC5C,MAAM,SAAS,GAAG;IAChB,YAAY;IACZ,YAAY;IACZ,mBAAmB;IACnB,oBAAoB;IACpB,aAAa;IACb,kBAAkB;IAClB,eAAe;IACf,yBAAyB;IACzB,0BAA0B;CAC3B,CAAC,IA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AAC,CAAC,aAAa,EAAE,CAAC;AACjE,CAAC;AAED,SAAgB,yBAAyB;IACvC,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAgB,4BAA4B;IAC1C,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAgB,0BAA0B;IACxC,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -5,7 +5,8 @@ import { SmartVerticalNavigationProps } from '../vertical-navigation.types';
|
|
|
5
5
|
* `<SmartVerticalNavigation>`, or render it directly.
|
|
6
6
|
*
|
|
7
7
|
* The Preline vertical-tabs look: each item is a tab with a trailing border,
|
|
8
|
-
* the `current` item gaining the primary border and text accent.
|
|
9
|
-
*
|
|
8
|
+
* the `current` item gaining the primary border and text accent. One `<nav>`
|
|
9
|
+
* landmark (`options.ariaLabel`, `'Sidebar'` by default) holds every group; a
|
|
10
|
+
* group is a list labelled by its title.
|
|
10
11
|
*/
|
|
11
12
|
export declare function SmartVerticalNavigationPreset(props: SmartVerticalNavigationProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,13 +13,18 @@ const use_vertical_navigation_1 = require("../use-vertical-navigation");
|
|
|
13
13
|
* `<SmartVerticalNavigation>`, or render it directly.
|
|
14
14
|
*
|
|
15
15
|
* The Preline vertical-tabs look: each item is a tab with a trailing border,
|
|
16
|
-
* the `current` item gaining the primary border and text accent.
|
|
17
|
-
*
|
|
16
|
+
* the `current` item gaining the primary border and text accent. One `<nav>`
|
|
17
|
+
* landmark (`options.ariaLabel`, `'Sidebar'` by default) holds every group; a
|
|
18
|
+
* group is a list labelled by its title.
|
|
18
19
|
*/
|
|
19
20
|
function SmartVerticalNavigationPreset(props) {
|
|
20
21
|
const { options, className } = props;
|
|
21
22
|
const { groups, itemClick } = (0, use_vertical_navigation_1.useVerticalNavigation)(props);
|
|
23
|
+
const id = (0, react_1.useId)();
|
|
22
24
|
const renderContent = (item) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [item.iconTpl ? ((0, jsx_runtime_1.jsx)("span", { className: (0, preset_classes_1.getVerticalNavIconClasses)(), children: item.iconTpl })) : item.initial ? ((0, jsx_runtime_1.jsx)("span", { className: (0, preset_classes_1.getVerticalNavInitialClasses)(), children: item.initial })) : null, item.label && (0, jsx_runtime_1.jsx)("span", { children: item.label }), item.badge !== undefined && item.badge !== null && ((0, jsx_runtime_1.jsx)("span", { className: (0, preset_classes_1.getVerticalNavBadgeClasses)(), children: item.badge }))] }));
|
|
23
|
-
return ((0, jsx_runtime_1.jsx)("
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)("nav", { className: (0, class_names_1.cn)((0, preset_classes_1.getVerticalNavContainerClasses)(), className), "aria-label": options?.ariaLabel ?? 'Sidebar', children: groups.map((group, index) => {
|
|
26
|
+
const titleId = group.title ? `${id}-group-${index}` : undefined;
|
|
27
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [group.title && ((0, jsx_runtime_1.jsx)("div", { id: titleId, className: (0, preset_classes_1.getVerticalNavGroupTitleClasses)(), children: group.title })), (0, jsx_runtime_1.jsx)("ul", { role: "list", className: (0, preset_classes_1.getVerticalNavNavClasses)(), "aria-labelledby": titleId, children: group.items.map((item) => ((0, jsx_runtime_1.jsx)("li", { className: (0, preset_classes_1.getVerticalNavListItemClasses)(), children: item.href ? ((0, jsx_runtime_1.jsx)(nav_link_1.SmartNavLink, { href: item.href, className: (0, preset_classes_1.getVerticalNavItemClasses)(Boolean(item.current)), "aria-current": item.current ? 'page' : undefined, children: renderContent(item) })) : ((0, jsx_runtime_1.jsx)("button", { type: "button", className: (0, preset_classes_1.getVerticalNavItemClasses)(Boolean(item.current)), "aria-current": item.current ? 'page' : undefined, onClick: () => itemClick(item.id), children: renderContent(item) })) }, item.id))) })] }, group.id ?? index));
|
|
28
|
+
}) }));
|
|
24
29
|
}
|
|
25
30
|
//# sourceMappingURL=vertical-navigation-preset.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertical-navigation-preset.js","sourceRoot":"","sources":["../../../../../../../../../packages/shared/react/src/lib/components/vertical-navigation/preset/vertical-navigation-preset.tsx"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"vertical-navigation-preset.js","sourceRoot":"","sources":["../../../../../../../../../packages/shared/react/src/lib/components/vertical-navigation/preset/vertical-navigation-preset.tsx"],"names":[],"mappings":";;AA4BA,sEAyEC;;AArGD,iCAAwC;AAExC,qDAS0B;AAE1B,4DAAgD;AAChD,oDAAqD;AACrD,wEAAmE;AAGnE;;;;;;;;;GASG;AACH,SAAgB,6BAA6B,CAC3C,KAAmC;IAEnC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACrC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,+CAAqB,EAAC,KAAK,CAAC,CAAC;IAC3D,MAAM,EAAE,GAAG,IAAA,aAAK,GAAE,CAAC;IAEnB,MAAM,aAAa,GAAG,CAAC,IAAsB,EAAE,EAAE,CAAC,CAChD,6DACG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CACd,iCAAM,SAAS,EAAE,IAAA,0CAAyB,GAAE,YAAG,IAAI,CAAC,OAAO,GAAQ,CACpE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CACjB,iCAAM,SAAS,EAAE,IAAA,6CAA4B,GAAE,YAAG,IAAI,CAAC,OAAO,GAAQ,CACvE,CAAC,CAAC,CAAC,IAAI,EACP,IAAI,CAAC,KAAK,IAAI,2CAAO,IAAI,CAAC,KAAK,GAAQ,EACvC,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,CAClD,iCAAM,SAAS,EAAE,IAAA,2CAA0B,GAAE,YAAG,IAAI,CAAC,KAAK,GAAQ,CACnE,IACA,CACJ,CAAC;IAEF,OAAO,CACL,gCACE,SAAS,EAAE,IAAA,gBAAE,EAAC,IAAA,+CAA8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AAI,CAAC,EAAE,CAuBX,CACN,CAAC,GACC,KArCQ,KAAK,CAAC,EAAE,IAAI,KAAK,CAsCrB,CACZ,CAAC;QACJ,CAAC,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { SmartVerticalNavigationProps } from '../vertical-navigation.types';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* The default vertical navigation rendering: one `<nav>` landmark
|
|
4
|
+
* (`options.ariaLabel`, `'Sidebar'` by default) with a list of groups, each a
|
|
5
|
+
* list of items labelled by the group's title.
|
|
6
|
+
*/
|
|
3
7
|
export declare function SmartVerticalNavigationStandard(props: SmartVerticalNavigationProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,14 +2,23 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SmartVerticalNavigationStandard = SmartVerticalNavigationStandard;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
5
6
|
const class_names_1 = require("../../../utils/class-names");
|
|
6
7
|
const nav_link_1 = require("../../navbar/nav-link");
|
|
7
8
|
const use_vertical_navigation_1 = require("../use-vertical-navigation");
|
|
8
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* The default vertical navigation rendering: one `<nav>` landmark
|
|
11
|
+
* (`options.ariaLabel`, `'Sidebar'` by default) with a list of groups, each a
|
|
12
|
+
* list of items labelled by the group's title.
|
|
13
|
+
*/
|
|
9
14
|
function SmartVerticalNavigationStandard(props) {
|
|
10
15
|
const { options, className } = props;
|
|
11
16
|
const { groups, itemClick } = (0, use_vertical_navigation_1.useVerticalNavigation)(props);
|
|
17
|
+
const id = (0, react_1.useId)();
|
|
12
18
|
const renderContent = (item) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [item.iconTpl ? ((0, jsx_runtime_1.jsx)("span", { className: "item-icon", children: item.iconTpl })) : item.initial ? ((0, jsx_runtime_1.jsx)("span", { className: "item-initial", children: item.initial })) : null, item.label && (0, jsx_runtime_1.jsx)("span", { className: "item-label", children: item.label }), item.badge !== undefined && item.badge !== null && ((0, jsx_runtime_1.jsx)("span", { className: "item-badge", children: item.badge }))] }));
|
|
13
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: className, children: (0, jsx_runtime_1.jsx)("nav", { className: "vertical-navigation", "aria-label": options?.ariaLabel ?? 'Sidebar', children: (0, jsx_runtime_1.jsx)("ul", { role: "list", className: "groups", children: groups.map((group, index) =>
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: className, children: (0, jsx_runtime_1.jsx)("nav", { className: "vertical-navigation", "aria-label": options?.ariaLabel ?? 'Sidebar', children: (0, jsx_runtime_1.jsx)("ul", { role: "list", className: "groups", children: groups.map((group, index) => {
|
|
20
|
+
const titleId = group.title ? `${id}-group-${index}` : undefined;
|
|
21
|
+
return ((0, jsx_runtime_1.jsxs)("li", { className: "group", children: [group.title && ((0, jsx_runtime_1.jsx)("div", { id: titleId, className: "group-title", children: group.title })), (0, jsx_runtime_1.jsx)("ul", { role: "list", className: "items", "aria-labelledby": titleId, children: group.items.map((item) => ((0, jsx_runtime_1.jsx)("li", { className: "item", children: item.href ? ((0, jsx_runtime_1.jsx)(nav_link_1.SmartNavLink, { href: item.href, className: (0, class_names_1.cn)('item-link', item.current && 'current'), "aria-current": item.current ? 'page' : undefined, children: renderContent(item) })) : ((0, jsx_runtime_1.jsx)("button", { type: "button", className: (0, class_names_1.cn)('item-button', item.current && 'current'), "aria-current": item.current ? 'page' : undefined, onClick: () => itemClick(item.id), children: renderContent(item) })) }, item.id))) })] }, group.id ?? index));
|
|
22
|
+
}) }) }) }));
|
|
14
23
|
}
|
|
15
24
|
//# sourceMappingURL=vertical-navigation-standard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertical-navigation-standard.js","sourceRoot":"","sources":["../../../../../../../../../packages/shared/react/src/lib/components/vertical-navigation/standard/vertical-navigation-standard.tsx"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"vertical-navigation-standard.js","sourceRoot":"","sources":["../../../../../../../../../packages/shared/react/src/lib/components/vertical-navigation/standard/vertical-navigation-standard.tsx"],"names":[],"mappings":";;AAaA,0EAwEC;;AArFD,iCAA8B;AAG9B,4DAAgD;AAChD,oDAAqD;AACrD,wEAAmE;AAGnE;;;;GAIG;AACH,SAAgB,+BAA+B,CAC7C,KAAmC;IAEnC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACrC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,+CAAqB,EAAC,KAAK,CAAC,CAAC;IAC3D,MAAM,EAAE,GAAG,IAAA,aAAK,GAAE,CAAC;IAEnB,MAAM,aAAa,GAAG,CAAC,IAAsB,EAAE,EAAE,CAAC,CAChD,6DACG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CACd,iCAAM,SAAS,EAAC,WAAW,YAAE,IAAI,CAAC,OAAO,GAAQ,CAClD,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CACjB,iCAAM,SAAS,EAAC,cAAc,YAAE,IAAI,CAAC,OAAO,GAAQ,CACrD,CAAC,CAAC,CAAC,IAAI,EACP,IAAI,CAAC,KAAK,IAAI,iCAAM,SAAS,EAAC,YAAY,YAAE,IAAI,CAAC,KAAK,GAAQ,EAC9D,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,CAClD,iCAAM,SAAS,EAAC,YAAY,YAAE,IAAI,CAAC,KAAK,GAAQ,CACjD,IACA,CACJ,CAAC;IAEF,OAAO,CACL,gCAAK,SAAS,EAAE,SAAS,YACvB,gCACE,SAAS,EAAC,qBAAqB,gBACnB,OAAO,EAAE,SAAS,IAAI,SAAS,YAE3C,+BAAI,IAAI,EAAC,MAAM,EAAC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AE,IAAI,KAAK,CAiCrB,CACN,CAAC;gBACJ,CAAC,CAAC,GACC,GACD,GACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -338,7 +338,7 @@ export interface ICommandPaletteOptions {
|
|
|
338
338
|
emptyText?: string;
|
|
339
339
|
ariaLabel?: string;
|
|
340
340
|
}
|
|
341
|
-
export type SmartModalVariant = 'centered' | 'wide' | 'alert' | 'left-aligned-buttons';
|
|
341
|
+
export type SmartModalVariant = 'centered' | 'wide' | 'alert' | 'left-aligned-buttons' | 'bottom-sheet';
|
|
342
342
|
export type SmartModalActionVariant = 'primary' | 'secondary' | 'danger';
|
|
343
343
|
export type SmartModalFooterStyle = 'default' | 'gray';
|
|
344
344
|
export interface IModalAction {
|
|
@@ -858,6 +858,11 @@ export interface IPageOptions {
|
|
|
858
858
|
sidebarTpl?: ReactNode;
|
|
859
859
|
}
|
|
860
860
|
export interface IListProvider<T> {
|
|
861
|
+
/**
|
|
862
|
+
* Reads the data again with `filter` merged into the current one. The list
|
|
863
|
+
* calls it with `{ offset: 0, sortBy, sortDesc }` when a sortable header is
|
|
864
|
+
* clicked (`IListOptions.sort` set).
|
|
865
|
+
*/
|
|
861
866
|
getData: (filter: any) => void;
|
|
862
867
|
onChangeMultiSelected?: (list: Array<T>) => void;
|
|
863
868
|
/** Clears the multi-selection whenever it emits. */
|
|
@@ -866,6 +871,11 @@ export interface IListProvider<T> {
|
|
|
866
871
|
loading: boolean;
|
|
867
872
|
}
|
|
868
873
|
export interface IListPaginationOptions {
|
|
874
|
+
/**
|
|
875
|
+
* `PaginationMode.singlePage` renders the pager below the items;
|
|
876
|
+
* `PaginationMode.infiniteScroll` calls `loadNextPage` when the end of the
|
|
877
|
+
* items scrolls into view, while `page < totalPages`.
|
|
878
|
+
*/
|
|
869
879
|
mode?: PaginationMode;
|
|
870
880
|
/** Not read by the built-in implementations (standard or preset); available to a custom implementation registered for the component. */
|
|
871
881
|
limit: number;
|
|
@@ -908,10 +918,20 @@ export interface IListOptions<T> {
|
|
|
908
918
|
pagination?: IListPaginationOptions;
|
|
909
919
|
cellPipe?: ICellPipe<T>;
|
|
910
920
|
componentFactories?: IListComponentFactories<T>;
|
|
921
|
+
/**
|
|
922
|
+
* Makes the field headers of the desktop modes sort buttons: a click reads
|
|
923
|
+
* the data through `provider.getData({ offset: 0, sortBy, sortDesc })`.
|
|
924
|
+
* `default` / `defaultDesc` is the sort the headers show at first.
|
|
925
|
+
*/
|
|
911
926
|
sort?: boolean | {
|
|
912
927
|
default?: string;
|
|
913
928
|
defaultDesc?: boolean;
|
|
914
929
|
};
|
|
930
|
+
/**
|
|
931
|
+
* Adds a details action to every item: it opens `component`
|
|
932
|
+
* (`SmartDetailsPage` by default) in a modal with the `IDetailsOptions` of
|
|
933
|
+
* `provider` as its `value`, and asks `provider.getData(id)` for the item.
|
|
934
|
+
*/
|
|
915
935
|
details?: boolean | {
|
|
916
936
|
provider?: IDetailsProvider<T>;
|
|
917
937
|
componentFactories?: IDetailsComponentFactories<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../../../packages/shared/react/src/lib/models/interfaces.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../../../packages/shared/react/src/lib/models/interfaces.ts"],"names":[],"mappings":";;;AA2qCA,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mDAAiC,CAAA;IACjC,2CAAyB,CAAA;AAC3B,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,6BAAiB,CAAA;IACjB,+BAAmB,CAAA;IACnB,uCAA2B,CAAA;AAC7B,CAAC,EAJW,QAAQ,wBAAR,QAAQ,QAInB"}
|
|
@@ -5,7 +5,7 @@ export interface IModelPossibilitiesOptions {
|
|
|
5
5
|
type?: any;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
* Supplies the options of
|
|
8
|
+
* Supplies the options of a `radio` or `check` field and of the preset `enum` field,
|
|
9
9
|
* e.g. loaded from the API. It is asked again whenever the form's value
|
|
10
10
|
* changes, so the options can depend on other fields. Return nothing to keep
|
|
11
11
|
* the field's own `possibilities`.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IModelPossibilitiesProvider = void 0;
|
|
4
4
|
/**
|
|
5
|
-
* Supplies the options of
|
|
5
|
+
* Supplies the options of a `radio` or `check` field and of the preset `enum` field,
|
|
6
6
|
* e.g. loaded from the API. It is asked again whenever the form's value
|
|
7
7
|
* changes, so the options can depend on other fields. Return nothing to keep
|
|
8
8
|
* the field's own `possibilities`.
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import { SmartStore } from '../../store';
|
|
3
3
|
export interface IModalServiceOptions {
|
|
4
|
+
/** Rendered in the modal with `props` and a `dismiss(data)` prop. */
|
|
4
5
|
component: ComponentType<any>;
|
|
5
6
|
props?: Record<string, unknown>;
|
|
7
|
+
/**
|
|
8
|
+
* `'bottom'` opens the modal as a bottom sheet (the `'bottom-sheet'` modal
|
|
9
|
+
* variant: docked to the bottom of the viewport, full width up to a max
|
|
10
|
+
* width) and adds the `smart-modal-bottom` class to it.
|
|
11
|
+
*/
|
|
6
12
|
mode?: 'default' | 'bottom';
|
|
13
|
+
/** Classes added to the modal (`<SmartModal className>`). */
|
|
7
14
|
cssClass?: string[];
|
|
15
|
+
/**
|
|
16
|
+
* `false` keeps the modal open on a click on its backdrop and on Escape;
|
|
17
|
+
* its close button and `dismiss()` still close it. Defaults to `true`.
|
|
18
|
+
*/
|
|
8
19
|
backdropDismiss?: boolean;
|
|
9
20
|
}
|
|
10
21
|
export interface IModal {
|
|
@@ -20,12 +31,22 @@ export interface IModalRequest extends IModalServiceOptions {
|
|
|
20
31
|
/**
|
|
21
32
|
* Opens a component in a modal dialog. The component receives `props` and can
|
|
22
33
|
* close the dialog, with a result, through `useModalService().dismiss(data)`
|
|
23
|
-
* or the `dismiss` prop it is given.
|
|
34
|
+
* or the `dismiss` prop it is given. The modals stack: the last one opened is
|
|
35
|
+
* on top, and `dismiss()` closes it.
|
|
24
36
|
*/
|
|
25
37
|
export declare class ModalService {
|
|
26
38
|
readonly modals: SmartStore<IModalRequest[]>;
|
|
27
39
|
private nextId;
|
|
40
|
+
private listening;
|
|
41
|
+
/**
|
|
42
|
+
* Stops Escape before the modal's own document listener (added after this
|
|
43
|
+
* one) while the top modal has `backdropDismiss: false`. Elements inside the
|
|
44
|
+
* modal still receive the key.
|
|
45
|
+
*/
|
|
46
|
+
private readonly onKeydown;
|
|
28
47
|
show(options: IModalServiceOptions): Promise<IModal>;
|
|
29
48
|
/** Closes the modal opened last. */
|
|
30
49
|
dismiss<T>(data?: T | null): Promise<void>;
|
|
50
|
+
/** Listens to Escape on the document while a modal is open. */
|
|
51
|
+
private listenToEscape;
|
|
31
52
|
}
|
|
@@ -5,11 +5,26 @@ const store_1 = require("../../store");
|
|
|
5
5
|
/**
|
|
6
6
|
* Opens a component in a modal dialog. The component receives `props` and can
|
|
7
7
|
* close the dialog, with a result, through `useModalService().dismiss(data)`
|
|
8
|
-
* or the `dismiss` prop it is given.
|
|
8
|
+
* or the `dismiss` prop it is given. The modals stack: the last one opened is
|
|
9
|
+
* on top, and `dismiss()` closes it.
|
|
9
10
|
*/
|
|
10
11
|
class ModalService {
|
|
11
12
|
modals = new store_1.SmartStore([]);
|
|
12
13
|
nextId = 1;
|
|
14
|
+
listening = false;
|
|
15
|
+
/**
|
|
16
|
+
* Stops Escape before the modal's own document listener (added after this
|
|
17
|
+
* one) while the top modal has `backdropDismiss: false`. Elements inside the
|
|
18
|
+
* modal still receive the key.
|
|
19
|
+
*/
|
|
20
|
+
onKeydown = (event) => {
|
|
21
|
+
if (event.key !== 'Escape' && event.key !== 'Esc')
|
|
22
|
+
return;
|
|
23
|
+
const modals = this.modals.get();
|
|
24
|
+
if (modals[modals.length - 1]?.backdropDismiss === false) {
|
|
25
|
+
event.stopImmediatePropagation();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
13
28
|
async show(options) {
|
|
14
29
|
const id = this.nextId++;
|
|
15
30
|
let resolveDismiss;
|
|
@@ -20,9 +35,11 @@ class ModalService {
|
|
|
20
35
|
if (!this.modals.get().some((m) => m.id === id))
|
|
21
36
|
return;
|
|
22
37
|
this.modals.update((modals) => modals.filter((m) => m.id !== id));
|
|
38
|
+
this.listenToEscape();
|
|
23
39
|
resolveDismiss({ data });
|
|
24
40
|
};
|
|
25
41
|
this.modals.update((modals) => [...modals, { ...options, id, dismiss }]);
|
|
42
|
+
this.listenToEscape();
|
|
26
43
|
return { dismiss, onDidDismiss: () => dismissed };
|
|
27
44
|
}
|
|
28
45
|
/** Closes the modal opened last. */
|
|
@@ -30,6 +47,19 @@ class ModalService {
|
|
|
30
47
|
const modals = this.modals.get();
|
|
31
48
|
modals[modals.length - 1]?.dismiss(data);
|
|
32
49
|
}
|
|
50
|
+
/** Listens to Escape on the document while a modal is open. */
|
|
51
|
+
listenToEscape() {
|
|
52
|
+
if (typeof document === 'undefined')
|
|
53
|
+
return;
|
|
54
|
+
const open = this.modals.get().length > 0;
|
|
55
|
+
if (open && !this.listening) {
|
|
56
|
+
document.addEventListener('keydown', this.onKeydown);
|
|
57
|
+
}
|
|
58
|
+
else if (!open && this.listening) {
|
|
59
|
+
document.removeEventListener('keydown', this.onKeydown);
|
|
60
|
+
}
|
|
61
|
+
this.listening = open;
|
|
62
|
+
}
|
|
33
63
|
}
|
|
34
64
|
exports.ModalService = ModalService;
|
|
35
65
|
//# sourceMappingURL=modal.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.service.js","sourceRoot":"","sources":["../../../../../../../../packages/shared/react/src/lib/services/modal/modal.service.ts"],"names":[],"mappings":";;;AAEA,uCAAyC;
|
|
1
|
+
{"version":3,"file":"modal.service.js","sourceRoot":"","sources":["../../../../../../../../packages/shared/react/src/lib/services/modal/modal.service.ts"],"names":[],"mappings":";;;AAEA,uCAAyC;AA+BzC;;;;;GAKG;AACH,MAAa,YAAY;IACd,MAAM,GAAG,IAAI,kBAAU,CAAkB,EAAE,CAAC,CAAC;IAE9C,MAAM,GAAG,CAAC,CAAC;IACX,SAAS,GAAG,KAAK,CAAC;IAE1B;;;;OAIG;IACc,SAAS,GAAG,CAAC,KAAoB,EAAQ,EAAE;QAC1D,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,GAAG,KAAK,KAAK;YAAE,OAAO;QAE1D,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QAEjC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,eAAe,KAAK,KAAK,EAAE,CAAC;YACzD,KAAK,CAAC,wBAAwB,EAAE,CAAC;QACnC,CAAC;IACH,CAAC,CAAC;IAEF,KAAK,CAAC,IAAI,CAAC,OAA6B;QACtC,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACzB,IAAI,cAAgD,CAAC;QACrD,MAAM,SAAS,GAAG,IAAI,OAAO,CAAgB,CAAC,OAAO,EAAE,EAAE;YACvD,cAAc,GAAG,OAAO,CAAC;QAC3B,CAAC,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,CAAC,OAAY,IAAI,EAAE,EAAE;YACnC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;gBAAE,OAAO;YAExD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,E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} from '../../store';
|
|
2
2
|
export interface IToastButton {
|
|
3
3
|
text: string;
|
|
4
|
+
/** Kept for compatibility; the actions render in the order given. */
|
|
4
5
|
position: 'start' | 'end';
|
|
6
|
+
/** Runs on a click on the button; the toast closes afterwards. */
|
|
5
7
|
handler: () => void;
|
|
6
8
|
}
|
|
7
9
|
export interface IToastOptions {
|
|
8
10
|
title?: string;
|
|
9
11
|
message: string;
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Milliseconds before the toast closes itself; 2000 when it is missing,
|
|
14
|
+
* zero or negative.
|
|
15
|
+
*/
|
|
11
16
|
duration?: number;
|
|
12
17
|
buttons?: Array<IToastButton>;
|
|
13
18
|
}
|
|
@@ -17,9 +22,11 @@ export interface IToast extends IToastOptions {
|
|
|
17
22
|
}
|
|
18
23
|
/**
|
|
19
24
|
* Short messages shown at the bottom of the screen. `SmartProvider` renders
|
|
20
|
-
* the queue; any code with the service can push to it.
|
|
21
|
-
*
|
|
22
|
-
*
|
|
25
|
+
* the queue; any code with the service can push to it. A toast closes itself
|
|
26
|
+
* after its `duration`, on its close button or after one of its buttons ran
|
|
27
|
+
* its handler. Error toasts are announced assertively, info toasts politely.
|
|
28
|
+
* While an error lock is held (`addLockError`), error toasts are swallowed,
|
|
29
|
+
* e.g. during a sign-out that makes every pending request fail.
|
|
23
30
|
*/
|
|
24
31
|
export declare class ToastService {
|
|
25
32
|
readonly toasts: SmartStore<IToast[]>;
|
|
@@ -27,6 +34,7 @@ export declare class ToastService {
|
|
|
27
34
|
private nextId;
|
|
28
35
|
private readonly timers;
|
|
29
36
|
addLockError(): void;
|
|
37
|
+
/** Releases one error lock; the count does not go below zero. */
|
|
30
38
|
removeLockError(): void;
|
|
31
39
|
error(config: IToastOptions): Promise<void>;
|
|
32
40
|
info(config: IToastOptions): Promise<void>;
|