@smartsoft001/react 2.202.0 → 2.203.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/overlays/overlays.d.ts +5 -3
- package/src/lib/components/overlays/overlays.js +24 -4
- 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 +20 -0
- 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 +18 -1
- package/src/lib/services/modal/modal.service.js +31 -1
- package/src/lib/services/modal/modal.service.js.map +1 -1
- package/styles.css +6 -0
|
@@ -30,6 +30,7 @@ export declare function useListMasonryGrid<T extends IEntity<string>>(props: Sma
|
|
|
30
30
|
itemHandler: ((id: string) => void) | null;
|
|
31
31
|
detailsComponent: import("react").ComponentType<any> | null;
|
|
32
32
|
detailsComponentProps: import("../../../models").IDetailsOptions<T> | null;
|
|
33
|
+
detailsHandler: ((item: T) => void) | null;
|
|
33
34
|
select: ((id: string) => void) | undefined;
|
|
34
35
|
unselect: (() => void) | undefined;
|
|
35
36
|
detailsButtonOptions: import("../../../models").IButtonOptions;
|
|
@@ -40,4 +41,10 @@ export declare function useListMasonryGrid<T extends IEntity<string>>(props: Sma
|
|
|
40
41
|
handlePageChange: (nextPage: number) => void;
|
|
41
42
|
infiniteScroll: boolean;
|
|
42
43
|
infiniteScrollRef: import("react").RefObject<HTMLDivElement | null>;
|
|
44
|
+
sortable: boolean;
|
|
45
|
+
activeSort: import("..").IListSortState | null;
|
|
46
|
+
isSortable: (key: string) => boolean;
|
|
47
|
+
sortBy: (key: string) => void;
|
|
48
|
+
getAriaSort: (key: string) => "ascending" | "descending" | null;
|
|
49
|
+
getSortIndicator: (key: string) => string;
|
|
43
50
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IEntity } from '@smartsoft001/domain-core';
|
|
2
2
|
import { SmartListModeProps } from '../list.types';
|
|
3
3
|
/**
|
|
4
|
-
* The mobile list: a stacked list with one paragraph per cell and the
|
|
5
|
-
* item buttons, the `top` component factory above it and the paging below it
|
|
4
|
+
* The mobile list: a stacked list with one paragraph per cell and the details /
|
|
5
|
+
* remove / item buttons, the `top` component factory above it and the paging below it
|
|
6
6
|
* (`PaginationMode.singlePage`).
|
|
7
7
|
*/
|
|
8
8
|
export declare function SmartListMobile<T extends IEntity<string>>(props: SmartListModeProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,20 +10,20 @@ const model_1 = require("../../../utils/model");
|
|
|
10
10
|
const paging_1 = require("../../paging/paging");
|
|
11
11
|
const use_list_1 = require("../use-list");
|
|
12
12
|
/**
|
|
13
|
-
* The mobile list: a stacked list with one paragraph per cell and the
|
|
14
|
-
* item buttons, the `top` component factory above it and the paging below it
|
|
13
|
+
* The mobile list: a stacked list with one paragraph per cell and the details /
|
|
14
|
+
* remove / item buttons, the `top` component factory above it and the paging below it
|
|
15
15
|
* (`PaginationMode.singlePage`).
|
|
16
16
|
*/
|
|
17
17
|
function SmartListMobile(props) {
|
|
18
18
|
const { options, className } = props;
|
|
19
19
|
const t = (0, hooks_1.useTranslate)();
|
|
20
|
-
const { list, keys, cellPipe, type, checkRemoveHandler, removeHandler, itemHandler, page, totalPages, handlePageChange, infiniteScroll, infiniteScrollRef, } = (0, use_list_1.useList)(props);
|
|
20
|
+
const { list, keys, cellPipe, type, checkRemoveHandler, removeHandler, itemHandler, detailsHandler, page, totalPages, handlePageChange, infiniteScroll, infiniteScrollRef, } = (0, use_list_1.useList)(props);
|
|
21
21
|
const Top = options.componentFactories?.top;
|
|
22
22
|
const mobileItems = list ?? [];
|
|
23
23
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { children: Top ? (0, jsx_runtime_1.jsx)(Top, {}) : null }), (0, jsx_runtime_1.jsx)("ul", { role: "list", className: (0, class_names_1.cn)('smart:divide-y smart:divide-gray-100 smart:dark:divide-white/10', className), children: mobileItems.map((item) => ((0, jsx_runtime_1.jsxs)("li", { className: "smart:flex smart:justify-between smart:gap-x-6 smart:py-5", children: [(0, jsx_runtime_1.jsx)("div", { className: "smart:flex smart:min-w-0 smart:gap-x-4", children: (0, jsx_runtime_1.jsx)("div", { className: "smart:min-w-0 smart:flex-auto", children: keys.map((key) => {
|
|
24
24
|
const cell = (0, model_1.getListCell)(item, key, cellPipe, type, t);
|
|
25
25
|
return cell ? ((0, jsx_runtime_1.jsx)("p", { className: "smart:text-sm smart:text-gray-900 smart:dark:text-white", dangerouslySetInnerHTML: (0, html_1.toInnerHtml)(cell.value) }, key)) : null;
|
|
26
|
-
}) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "smart:flex smart:shrink-0 smart:items-center smart:gap-x-4", children: [removeHandler &&
|
|
26
|
+
}) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "smart:flex smart:shrink-0 smart:items-center smart:gap-x-4", children: [detailsHandler ? ((0, jsx_runtime_1.jsx)("button", { type: "button", "data-role": "details", className: "smart:text-indigo-600 smart:hover:text-indigo-900 smart:dark:text-indigo-400 smart:dark:hover:text-indigo-300 smart:text-sm", onClick: () => detailsHandler(item), children: t('show') })) : null, removeHandler &&
|
|
27
27
|
(!checkRemoveHandler || checkRemoveHandler(item)) ? ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "smart:text-red-600 smart:hover:text-red-900 smart:dark:text-red-400 smart:dark:hover:text-red-300 smart:text-sm", onClick: () => removeHandler?.(item), children: t('remove') })) : null, itemHandler ? ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "smart:text-indigo-600 smart:hover:text-indigo-900 smart:dark:text-indigo-400 smart:dark:hover:text-indigo-300 smart:text-sm", onClick: () => itemHandler?.(item.id), children: "\u2192" })) : null] })] }, item.id))) }), options.pagination?.mode === models_1.PaginationMode.singlePage ? ((0, jsx_runtime_1.jsx)(paging_1.SmartPaging, { currentPage: page ?? 1, totalPages: totalPages ?? 1, onPageChange: handlePageChange })) : null, infiniteScroll ? ((0, jsx_runtime_1.jsx)("div", { ref: infiniteScrollRef, "data-role": "infinite-scroll", "aria-hidden": "true" })) : null] }));
|
|
28
28
|
}
|
|
29
29
|
//# sourceMappingURL=list-mobile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-mobile.js","sourceRoot":"","sources":["../../../../../../../../../packages/shared/react/src/lib/components/list/mobile/list-mobile.tsx"],"names":[],"mappings":";;AAgBA,
|
|
1
|
+
{"version":3,"file":"list-mobile.js","sourceRoot":"","sources":["../../../../../../../../../packages/shared/react/src/lib/components/list/mobile/list-mobile.tsx"],"names":[],"mappings":";;AAgBA,0CAyGC;;AAvHD,4CAAiD;AACjD,oDAAwD;AACxD,4DAAgD;AAChD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"}
|
|
@@ -23,7 +23,7 @@ function SmartListMobilePreset(props) {
|
|
|
23
23
|
const { options, className } = props;
|
|
24
24
|
const t = (0, hooks_1.useTranslate)();
|
|
25
25
|
const fileUrl = (0, use_list_1.useListFileUrl)();
|
|
26
|
-
const { list, keys, cellPipe, type, checkRemoveHandler, removeHandler, itemHandler, page, totalPages, handlePageChange, infiniteScroll, infiniteScrollRef, } = (0, use_list_1.useList)(props);
|
|
26
|
+
const { list, keys, cellPipe, type, checkRemoveHandler, removeHandler, itemHandler, detailsHandler, page, totalPages, handlePageChange, infiniteScroll, infiniteScrollRef, } = (0, use_list_1.useList)(props);
|
|
27
27
|
const Top = options.componentFactories?.top;
|
|
28
28
|
const presetItems = list ?? [];
|
|
29
29
|
const cardContainerClasses = (0, preset_classes_1.getCardContainerClasses)();
|
|
@@ -37,7 +37,7 @@ function SmartListMobilePreset(props) {
|
|
|
37
37
|
if (!cell || cell.type === models_1.FieldType.image)
|
|
38
38
|
return null;
|
|
39
39
|
return key === titleKey ? ((0, jsx_runtime_1.jsx)("h3", { "data-role": "card-title", className: "smart:font-semibold smart:text-gray-900 smart:dark:text-white", dangerouslySetInnerHTML: (0, html_1.toInnerHtml)(cell.value) }, key)) : ((0, jsx_runtime_1.jsx)("p", { "data-role": "card-text", className: "smart:mt-1 smart:text-gray-500 smart:dark:text-gray-400", dangerouslySetInnerHTML: (0, html_1.toInnerHtml)(cell.value) }, key));
|
|
40
|
-
}), (0, jsx_runtime_1.jsxs)("div", { className: "smart:flex smart:items-center smart:gap-x-4", children: [itemHandler ? ((0, jsx_runtime_1.jsx)("button", { type: "button", "data-role": "item", className: "smart:mt-2 smart:py-2 smart:px-3 smart:inline-flex smart:justify-center smart:items-center smart:gap-x-2 smart:text-sm smart:font-medium smart:rounded-lg smart:bg-blue-600 smart:dark:bg-blue-500 smart:text-white smart:hover:bg-blue-700 smart:dark:hover:bg-blue-600 smart:focus:outline-hidden", onClick: () => itemHandler?.(item.id), children: t('details') })) : null, removeHandler &&
|
|
40
|
+
}), (0, jsx_runtime_1.jsxs)("div", { className: "smart:flex smart:items-center smart:gap-x-4", children: [itemHandler ? ((0, jsx_runtime_1.jsx)("button", { type: "button", "data-role": "item", className: "smart:mt-2 smart:py-2 smart:px-3 smart:inline-flex smart:justify-center smart:items-center smart:gap-x-2 smart:text-sm smart:font-medium smart:rounded-lg smart:bg-blue-600 smart:dark:bg-blue-500 smart:text-white smart:hover:bg-blue-700 smart:dark:hover:bg-blue-600 smart:focus:outline-hidden", onClick: () => itemHandler?.(item.id), children: t('details') })) : null, detailsHandler ? ((0, jsx_runtime_1.jsx)("button", { type: "button", "data-role": "details", className: "smart:mt-2 smart:text-blue-600 smart:hover:text-blue-700 smart:dark:text-blue-400 smart:dark:hover:text-blue-300 smart:text-sm", onClick: () => detailsHandler(item), children: t('show') })) : null, removeHandler &&
|
|
41
41
|
(!checkRemoveHandler || checkRemoveHandler(item)) ? ((0, jsx_runtime_1.jsx)("button", { type: "button", "data-role": "remove", className: "smart:mt-2 smart:text-red-600 smart:hover:text-red-900 smart:dark:text-red-400 smart:dark:hover:text-red-300 smart:text-sm", onClick: () => removeHandler?.(item), children: t('remove') })) : null] })] })] }, item.id));
|
|
42
42
|
}) }), options.pagination?.mode === models_2.PaginationMode.singlePage ? ((0, jsx_runtime_1.jsx)(paging_1.SmartPaging, { currentPage: page ?? 1, totalPages: totalPages ?? 1, onPageChange: handlePageChange })) : null, infiniteScroll ? ((0, jsx_runtime_1.jsx)("div", { ref: infiniteScrollRef, "data-role": "infinite-scroll", "aria-hidden": "true" })) : null] }));
|
|
43
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-mobile-preset.js","sourceRoot":"","sources":["../../../../../../../../../../packages/shared/react/src/lib/components/list/mobile/preset/list-mobile-preset.tsx"],"names":[],"mappings":";;AAqBA,
|
|
1
|
+
{"version":3,"file":"list-mobile-preset.js","sourceRoot":"","sources":["../../../../../../../../../../packages/shared/react/src/lib/components/list/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ieldOptions } from '@smartsoft001/models';
|
|
3
|
+
import { IListSortState } from './list-sort';
|
|
3
4
|
import { SmartListModeProps } from './list.types';
|
|
4
5
|
import { IButtonOptions, IDetailsOptions } from '../../models';
|
|
5
6
|
/**
|
|
@@ -22,6 +23,13 @@ export declare function useListFileUrl(): (file: {
|
|
|
22
23
|
* With `pagination.mode === PaginationMode.infiniteScroll` and a next page,
|
|
23
24
|
* `infiniteScroll` is `true`: render an element with `infiniteScrollRef`
|
|
24
25
|
* after the items, and the next page loads when it scrolls into view.
|
|
26
|
+
*
|
|
27
|
+
* With `sort`, `sortBy(key)` sorts by a column (ascending, or the other
|
|
28
|
+
* direction for the active one) through
|
|
29
|
+
* `provider.getData({ offset: 0, sortBy, sortDesc })`; `activeSort`,
|
|
30
|
+
* `getAriaSort(key)` and `getSortIndicator(key)` describe it for the headers.
|
|
31
|
+
* With `details`, `detailsHandler(item)` opens the details of an item in a
|
|
32
|
+
* modal (`SmartDetailsPage`, or `details.component`).
|
|
25
33
|
*/
|
|
26
34
|
export declare function useList<T extends IEntity<string>>({ options, }: SmartListModeProps<T>): {
|
|
27
35
|
fields: {
|
|
@@ -45,6 +53,7 @@ export declare function useList<T extends IEntity<string>>({ options, }: SmartLi
|
|
|
45
53
|
itemHandler: ((id: string) => void) | null;
|
|
46
54
|
detailsComponent: import("react").ComponentType<any> | null;
|
|
47
55
|
detailsComponentProps: IDetailsOptions<T> | null;
|
|
56
|
+
detailsHandler: ((item: T) => void) | null;
|
|
48
57
|
select: ((id: string) => void) | undefined;
|
|
49
58
|
unselect: (() => void) | undefined;
|
|
50
59
|
detailsButtonOptions: IButtonOptions;
|
|
@@ -55,4 +64,10 @@ export declare function useList<T extends IEntity<string>>({ options, }: SmartLi
|
|
|
55
64
|
handlePageChange: (nextPage: number) => void;
|
|
56
65
|
infiniteScroll: boolean;
|
|
57
66
|
infiniteScrollRef: import("react").RefObject<HTMLDivElement | null>;
|
|
67
|
+
sortable: boolean;
|
|
68
|
+
activeSort: IListSortState | null;
|
|
69
|
+
isSortable: (key: string) => boolean;
|
|
70
|
+
sortBy: (key: string) => void;
|
|
71
|
+
getAriaSort: (key: string) => "ascending" | "descending" | null;
|
|
72
|
+
getSortIndicator: (key: string) => string;
|
|
58
73
|
};
|
|
@@ -3,8 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useListFileUrl = useListFileUrl;
|
|
4
4
|
exports.useList = useList;
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const list_details_modal_1 = require("./list-details-modal");
|
|
7
|
+
const list_sort_1 = require("./list-sort");
|
|
6
8
|
const models_1 = require("../../models");
|
|
9
|
+
const details_page_1 = require("../../pages/details/details-page");
|
|
7
10
|
const hooks_1 = require("../../providers/hooks");
|
|
11
|
+
const store_1 = require("../../store/store");
|
|
8
12
|
const NO_FIELDS = [];
|
|
9
13
|
/**
|
|
10
14
|
* The column keys of the list: the fields the user may see (list
|
|
@@ -60,12 +64,20 @@ function getItemUrl(routingPrefix, id) {
|
|
|
60
64
|
* With `pagination.mode === PaginationMode.infiniteScroll` and a next page,
|
|
61
65
|
* `infiniteScroll` is `true`: render an element with `infiniteScrollRef`
|
|
62
66
|
* after the items, and the next page loads when it scrolls into view.
|
|
67
|
+
*
|
|
68
|
+
* With `sort`, `sortBy(key)` sorts by a column (ascending, or the other
|
|
69
|
+
* direction for the active one) through
|
|
70
|
+
* `provider.getData({ offset: 0, sortBy, sortDesc })`; `activeSort`,
|
|
71
|
+
* `getAriaSort(key)` and `getSortIndicator(key)` describe it for the headers.
|
|
72
|
+
* With `details`, `detailsHandler(item)` opens the details of an item in a
|
|
73
|
+
* modal (`SmartDetailsPage`, or `details.component`).
|
|
63
74
|
*/
|
|
64
75
|
function useList({ options, }) {
|
|
65
76
|
const t = (0, hooks_1.useTranslate)();
|
|
66
77
|
const authService = (0, hooks_1.useAuthService)();
|
|
67
78
|
const alertService = (0, hooks_1.useAlertService)();
|
|
68
79
|
const navigation = (0, hooks_1.useNavigation)();
|
|
80
|
+
const modalService = (0, hooks_1.useModalService)();
|
|
69
81
|
const fields = options.fields ?? NO_FIELDS;
|
|
70
82
|
const provider = options.provider;
|
|
71
83
|
const sort = options.sort ?? {};
|
|
@@ -129,7 +141,7 @@ function useList({ options, }) {
|
|
|
129
141
|
const detailsProvider = options.details ? details?.provider : undefined;
|
|
130
142
|
const detailsComponent = (options.details && details?.component) || null;
|
|
131
143
|
const detailsComponentProps = (0, react_1.useMemo)(() => {
|
|
132
|
-
if (!
|
|
144
|
+
if (!detailsProvider)
|
|
133
145
|
return null;
|
|
134
146
|
return {
|
|
135
147
|
item: detailsProvider.item,
|
|
@@ -140,7 +152,6 @@ function useList({ options, }) {
|
|
|
140
152
|
componentFactories: details?.componentFactories,
|
|
141
153
|
};
|
|
142
154
|
}, [
|
|
143
|
-
detailsComponent,
|
|
144
155
|
detailsProvider,
|
|
145
156
|
type,
|
|
146
157
|
itemHandler,
|
|
@@ -149,6 +160,60 @@ function useList({ options, }) {
|
|
|
149
160
|
]);
|
|
150
161
|
const select = detailsProvider?.getData;
|
|
151
162
|
const unselect = detailsProvider?.clearData;
|
|
163
|
+
// The details modal reads the options from here, so it follows the item
|
|
164
|
+
// the provider loads after the modal opened.
|
|
165
|
+
const [detailsStore] = (0, react_1.useState)(() => new store_1.SmartStore(null));
|
|
166
|
+
(0, react_1.useEffect)(() => {
|
|
167
|
+
detailsStore.set(detailsComponentProps);
|
|
168
|
+
}, [detailsStore, detailsComponentProps]);
|
|
169
|
+
const detailsHandler = (0, react_1.useMemo)(() => {
|
|
170
|
+
if (!detailsProvider)
|
|
171
|
+
return null;
|
|
172
|
+
return (item) => {
|
|
173
|
+
unselect?.();
|
|
174
|
+
void modalService
|
|
175
|
+
.show({
|
|
176
|
+
component: list_details_modal_1.SmartListDetailsModal,
|
|
177
|
+
props: {
|
|
178
|
+
component: detailsComponent ?? details_page_1.SmartDetailsPage,
|
|
179
|
+
store: detailsStore,
|
|
180
|
+
},
|
|
181
|
+
mode: 'bottom',
|
|
182
|
+
})
|
|
183
|
+
.then(() => select?.(item.id));
|
|
184
|
+
};
|
|
185
|
+
}, [
|
|
186
|
+
detailsProvider,
|
|
187
|
+
detailsComponent,
|
|
188
|
+
detailsStore,
|
|
189
|
+
modalService,
|
|
190
|
+
select,
|
|
191
|
+
unselect,
|
|
192
|
+
]);
|
|
193
|
+
const sortOption = options.sort;
|
|
194
|
+
const sortable = !!sortOption;
|
|
195
|
+
const [sortState, setSortState] = (0, react_1.useState)(() => ({ source: sortOption, value: (0, list_sort_1.getListDefaultSort)(sortOption) }));
|
|
196
|
+
let activeSort = sortState.value;
|
|
197
|
+
// A new `sort` option starts over from its default.
|
|
198
|
+
if (sortState.source !== sortOption) {
|
|
199
|
+
activeSort = (0, list_sort_1.getListDefaultSort)(sortOption);
|
|
200
|
+
setSortState({ source: sortOption, value: activeSort });
|
|
201
|
+
}
|
|
202
|
+
const isSortable = (0, react_1.useCallback)((key) => sortable && (0, list_sort_1.isListSortableKey)(key), [sortable]);
|
|
203
|
+
const sortBy = (0, react_1.useCallback)((key) => {
|
|
204
|
+
if (!isSortable(key))
|
|
205
|
+
return;
|
|
206
|
+
const next = (0, list_sort_1.getNextListSort)(activeSort, key);
|
|
207
|
+
const filter = {
|
|
208
|
+
offset: 0,
|
|
209
|
+
sortBy: next.key,
|
|
210
|
+
sortDesc: next.desc,
|
|
211
|
+
};
|
|
212
|
+
setSortState({ source: sortOption, value: next });
|
|
213
|
+
provider?.getData(filter);
|
|
214
|
+
}, [isSortable, activeSort, sortOption, provider]);
|
|
215
|
+
const getAriaSort = (0, react_1.useCallback)((key) => isSortable(key) ? (0, list_sort_1.getListAriaSort)(activeSort, key) : null, [isSortable, activeSort]);
|
|
216
|
+
const getSortIndicator = (0, react_1.useCallback)((key) => (0, list_sort_1.getListSortIndicator)(activeSort, key), [activeSort]);
|
|
152
217
|
const detailsButtonOptions = (0, react_1.useMemo)(() => ({
|
|
153
218
|
loading,
|
|
154
219
|
click: () => {
|
|
@@ -231,6 +296,7 @@ function useList({ options, }) {
|
|
|
231
296
|
itemHandler,
|
|
232
297
|
detailsComponent,
|
|
233
298
|
detailsComponentProps,
|
|
299
|
+
detailsHandler,
|
|
234
300
|
select,
|
|
235
301
|
unselect,
|
|
236
302
|
detailsButtonOptions,
|
|
@@ -241,6 +307,12 @@ function useList({ options, }) {
|
|
|
241
307
|
handlePageChange,
|
|
242
308
|
infiniteScroll,
|
|
243
309
|
infiniteScrollRef,
|
|
310
|
+
sortable,
|
|
311
|
+
activeSort,
|
|
312
|
+
isSortable,
|
|
313
|
+
sortBy,
|
|
314
|
+
getAriaSort,
|
|
315
|
+
getSortIndicator,
|
|
244
316
|
};
|
|
245
317
|
}
|
|
246
318
|
//# sourceMappingURL=use-list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-list.js","sourceRoot":"","sources":["../../../../../../../../packages/shared/react/src/lib/components/list/use-list.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"use-list.js","sourceRoot":"","sources":["../../../../../../../../packages/shared/react/src/lib/components/list/use-list.ts"],"names":[],"mappings":";;AAgGA,wCASC;AA8BD,0BAsUC;AA7cD,iCAA0E;AAK1E,6DAA6D;AAC7D,2CAQqB;AAErB,yCAOsB;AACtB,mEAAoE;AACpE,iDAO+B;AAC/B,6CAA+C;AAU/C,MAAM,SAAS,GAAgB,EAAE,CAAC;AAElC;;;;;GAKG;AACH,SAAS,WAAW,CAClB,MAAmB,EACnB,IAAsB,EACtB,iBAAiE;IAEjE,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,MAAM;SACH,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;QAChB,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,IAAsC,CAAC;QAElE,IAAI,IAAI,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YAC7B,OAAO,iBAAiB,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,CA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ED,MAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC,CAAC,OAAO,EAAE,EAAE;YACpD,IACE,cAAc,CAAC,OAAO;gBACtB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,EAC9C,CAAC;gBACD,OAAO;YACT,CAAC;YAED,cAAc,CAAC,OAAO,GAAG,IAAI,CAAC;YAE9B,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;gBACpD,cAAc,CAAC,OAAO,GAAG,KAAK,CAAC;YACjC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEzB,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC,EAAE,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC;IAE3B,OAAO;QACL,MAAM;QACN,QAAQ;QACR,IAAI;QACJ,QAAQ;QACR,UAAU;QACV,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,OAAO;QACP,OAAO;QACP,aAAa;QACb,kBAAkB;QAClB,WAAW;QACX,gBAAgB;QAChB,qBAAqB;QACrB,cAAc;QACd,MAAM;QACN,QAAQ;QACR,oBAAoB;QACpB,YAAY;QACZ,YAAY;QACZ,IAAI;QACJ,UAAU;QACV,gBAAgB;QAChB,cAAc;QACd,iBAAiB;QACjB,QAAQ;QACR,UAAU;QACV,UAAU;QACV,MAAM;QACN,WAAW;QACX,gBAAgB;KACjB,CAAC;AACJ,CAAC"}
|
|
@@ -6,6 +6,12 @@ const react_1 = require("react");
|
|
|
6
6
|
const class_names_1 = require("../../../utils/class-names");
|
|
7
7
|
const use_modal_1 = require("../use-modal");
|
|
8
8
|
const preset_classes_1 = require("./preset-classes");
|
|
9
|
+
/**
|
|
10
|
+
* The preset modals that are open, in the order they opened. Every open preset
|
|
11
|
+
* listens to Escape on the whole document, so with modals stacked only the one
|
|
12
|
+
* on top closes on it.
|
|
13
|
+
*/
|
|
14
|
+
const openModalLayers = [];
|
|
9
15
|
/**
|
|
10
16
|
* Styled modal variation (preset). Register it as `components.modal` on
|
|
11
17
|
* `SmartProvider` to restyle every `<SmartModal>`, or render it directly.
|
|
@@ -21,12 +27,19 @@ function SmartModalPreset(props) {
|
|
|
21
27
|
(0, react_1.useEffect)(() => {
|
|
22
28
|
if (!open)
|
|
23
29
|
return undefined;
|
|
30
|
+
// Escape closes only the modal on top when modals are stacked.
|
|
31
|
+
const layer = {};
|
|
32
|
+
openModalLayers.push(layer);
|
|
24
33
|
const onKeyDown = (event) => {
|
|
25
|
-
|
|
34
|
+
const onTop = openModalLayers[openModalLayers.length - 1] === layer;
|
|
35
|
+
if (onTop && (event.key === 'Escape' || event.key === 'Esc'))
|
|
26
36
|
close();
|
|
27
37
|
};
|
|
28
38
|
document.addEventListener('keydown', onKeyDown);
|
|
29
|
-
return () =>
|
|
39
|
+
return () => {
|
|
40
|
+
document.removeEventListener('keydown', onKeyDown);
|
|
41
|
+
openModalLayers.splice(openModalLayers.indexOf(layer), 1);
|
|
42
|
+
};
|
|
30
43
|
}, [open, close]);
|
|
31
44
|
if (!open)
|
|
32
45
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-preset.js","sourceRoot":"","sources":["../../../../../../../../../packages/shared/react/src/lib/components/modal/preset/modal-preset.tsx"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"modal-preset.js","sourceRoot":"","sources":["../../../../../../../../../packages/shared/react/src/lib/components/modal/preset/modal-preset.tsx"],"names":[],"mappings":";;AAmCA,4CAwHC;;AA3JD,iCAAkC;AAGlC,4DAAgD;AAEhD,4CAAwC;AACxC,qDAW0B;AAE1B;;;;GAIG;AACH,MAAM,eAAe,GAAa,EAAE,CAAC;AAErC;;;;;;;;GAQG;AACH,SAAg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AAC,OAAO,EACrB,cAAc,EAAC,OAAO,iBACV,MAAM,aAElB,iCAAM,CAAC,EAAC,YAAY,GAAG,EACvB,iCAAM,CAAC,EAAC,YAAY,GAAG,IACnB,IACC,CACV,IACG,CACP,EAED,iCAAK,SAAS,EAAE,2BAAU,aACvB,WAAW,IAAI,8BAAG,SAAS,EAAE,kCAAiB,YAAG,WAAW,GAAK,EACjE,QAAQ,IACL,EAEL,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CACrB,gCAAK,SAAS,EAAE,IAAA,sCAAqB,EAAC,OAAO,EAAE,WAAW,CAAC,YACxD,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACvB,mCAEE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,IAAA,sCAAqB,EAAC,MAAM,CAAC,OAAO,CAAC,EAChD,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,YAErC,MAAM,CAAC,KAAK,IALR,MAAM,CAAC,EAAE,CAMP,CACV,CAAC,GACE,CACP,IACG,GACF,GACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -3,9 +3,11 @@ export declare function SmartToastHost(): import("react/jsx-runtime").JSX.Elemen
|
|
|
3
3
|
/** The dialogs `AlertService.show` opened, rendered through `<SmartAlert>`. */
|
|
4
4
|
export declare function SmartAlertHost(): import("react/jsx-runtime").JSX.Element | null;
|
|
5
5
|
/**
|
|
6
|
-
* The components `ModalService.show` opened, each in a `<SmartModal
|
|
7
|
-
* component gets its `props` and a
|
|
8
|
-
* modal with a result.
|
|
6
|
+
* The components `ModalService.show` opened, each in a `<SmartModal>` with its
|
|
7
|
+
* close button, the last one on top. The component gets its `props` and a
|
|
8
|
+
* `dismiss(data)` prop that closes the modal with a result. `cssClass` (and
|
|
9
|
+
* `smart-modal-bottom` for `mode: 'bottom'`) goes on the modal; with
|
|
10
|
+
* `backdropDismiss: false` a click on the backdrop leaves it open.
|
|
9
11
|
*/
|
|
10
12
|
export declare function SmartModalHost(): import("react/jsx-runtime").JSX.Element | null;
|
|
11
13
|
/**
|
|
@@ -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");
|
|
@@ -42,17 +43,36 @@ function SmartAlertHost() {
|
|
|
42
43
|
return null;
|
|
43
44
|
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
45
|
}
|
|
46
|
+
/** The modals of `ModalService` show their close button. */
|
|
47
|
+
const MODAL_HOST_OPTIONS = { withDismiss: true };
|
|
45
48
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
|
|
49
|
+
* With `backdropDismiss: false`, stops a click that lands in the modal but
|
|
50
|
+
* outside its dialog (the backdrop) before the modal sees it.
|
|
51
|
+
*/
|
|
52
|
+
function keepOpenOnBackdrop(request, event) {
|
|
53
|
+
if (request.backdropDismiss !== false)
|
|
54
|
+
return;
|
|
55
|
+
const target = event.target;
|
|
56
|
+
if (!target?.closest?.('[role="dialog"]'))
|
|
57
|
+
event.stopPropagation();
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The components `ModalService.show` opened, each in a `<SmartModal>` with its
|
|
61
|
+
* close button, the last one on top. The component gets its `props` and a
|
|
62
|
+
* `dismiss(data)` prop that closes the modal with a result. `cssClass` (and
|
|
63
|
+
* `smart-modal-bottom` for `mode: 'bottom'`) goes on the modal; with
|
|
64
|
+
* `backdropDismiss: false` a click on the backdrop leaves it open.
|
|
49
65
|
*/
|
|
50
66
|
function SmartModalHost() {
|
|
51
67
|
const { modalService } = (0, smart_context_1.useSmart)();
|
|
52
68
|
const modals = (0, store_1.useStore)(modalService.modals);
|
|
53
69
|
if (!modals.length)
|
|
54
70
|
return null;
|
|
55
|
-
return ((0, jsx_runtime_1.jsx)(BodyPortal, { children: modals.map((
|
|
71
|
+
return ((0, jsx_runtime_1.jsx)(BodyPortal, { children: modals.map((request) => {
|
|
72
|
+
const { id, component: Component, props, dismiss, cssClass, mode, } = request;
|
|
73
|
+
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') ||
|
|
74
|
+
undefined, options: MODAL_HOST_OPTIONS, onClosed: () => dismiss(), children: (0, jsx_runtime_1.jsx)(Component, { ...(props ?? {}), dismiss: dismiss }) }) }, id));
|
|
75
|
+
}) }));
|
|
56
76
|
}
|
|
57
77
|
/**
|
|
58
78
|
* 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":";;AA0BA,wCAuCC;AAGD,wCAiBC;AA2BD,wCA0CC;AAMD,sCAQC;;AAxKD,iCAA4C;AAE5C,yCAAyC;AAGzC,iEAAyD;AAGzD,6CAA6C;AAC7C,yDAA6C;AAC7C,0CAA4C;AAC5C,0CAA4C;AAC5C,+DAAiE;AAEjE,8EAA8E;AAC9E,SAAS,UAAU,CAAC,EAAE,QAAQ,EAA2B;IACvD,MAAM,CAAC,OAA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|
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,gDAAkD;AAElD,0CAA4D;AAE5D;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,SAAS,GACa;IACtB,MAAM,CAAC,GAAG,IAAA,oBAAY,GAAE,CAAC;IACzB,MAAM,EAAE,IAAI,EAAE,GAAG,IAAA,kBAAO,GAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC;IAE/B,OAAO,CACL,iCAAK,SAAS,EAAE,SAAS,IAAI,SAAS,eAAY,MAAM,aACrD,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,CACtB,iCAAK,SAAS,EAAC,gHAAgH,aAC7H,gCAAK,SAAS,EAAC,4BAA4B,YACzC,iCAAK,SAAS,EAAC,6CAA6C,aACzD,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,CACzB,mCACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,IAAI,EACb,SAAS,E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M,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;IAC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AAmB;IACnB,qBAAqB;IACrB,wBAAwB;IACxB,0BAA0B;CAC3B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,MAAM,UAAU,GAAG;IACjB,eAAe;IACf,mBAAmB;IACnB,oBAAoB;IACpB,oBAAoB;IACpB,YAAY;IACZ,cAAc;IACd,eAAe;IACf,mBAAmB;IACnB,mBAAmB;IACnB,qBAAqB;IACrB,wBAAwB;IACxB,0BAA0B;CAC3B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,SAAgB,8BAA8B;IAC5C,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAgB,wBAAwB;IACtC,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAgB,6BAA6B;IAC3C,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAgB,+BAA+B;IAC7C,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,SAAgB,yBAAyB,CAAC,OAAgB;IACxD,OAAO,GAAG,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,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;
|