@equinor/fusion-framework-react-components-bookmark 0.1.15 → 0.1.16
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/CHANGELOG.md +12 -0
- package/dist/esm/components/row/Row.js.map +1 -1
- package/dist/esm/hooks/useBookmarkGrouping.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/components/create-bookmark/CreateBookmark.d.ts +2 -2
- package/dist/types/components/edit-bookmark/EditBookmark.d.ts +3 -3
- package/dist/types/components/filter/Filter.d.ts +5 -5
- package/dist/types/components/row/MoreMenu.d.ts +4 -4
- package/dist/types/components/row/Row.d.ts +6 -6
- package/dist/types/components/section/Section.d.ts +2 -2
- package/dist/types/components/sectionList/SectionList.d.ts +1 -1
- package/dist/types/components/shared/SharedIcon.d.ts +2 -2
- package/dist/types/hooks/useBookmarkGrouping.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +5 -5
- package/src/components/create-bookmark/CreateBookmark.tsx +2 -2
- package/src/components/edit-bookmark/EditBookmark.tsx +3 -3
- package/src/components/filter/Filter.tsx +5 -5
- package/src/components/row/MoreMenu.tsx +4 -4
- package/src/components/row/Row.tsx +8 -6
- package/src/components/section/Section.tsx +2 -2
- package/src/components/sectionList/SectionList.tsx +6 -6
- package/src/components/shared/SharedIcon.tsx +2 -2
- package/src/hooks/useBookmarkGrouping.ts +2 -2
- package/src/version.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const EditBookmarkModal: ({ isOpen, onClose, bookmarkId, }: {
|
|
2
|
-
isOpen: boolean;
|
|
3
|
-
onClose: (b: boolean) => void;
|
|
4
|
-
bookmarkId?: string | undefined;
|
|
2
|
+
readonly isOpen: boolean;
|
|
3
|
+
readonly onClose: (b: boolean) => void;
|
|
4
|
+
readonly bookmarkId?: string | undefined;
|
|
5
5
|
}) => JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { GroupingKeys } from '../../hooks/useBookmarkGrouping';
|
|
2
2
|
type BookmarkFilterProps = {
|
|
3
|
-
searchText: string;
|
|
4
|
-
setSearchText: (newVal: string | null) => void;
|
|
5
|
-
setGroupBy: (groupBy: GroupingKeys) => void;
|
|
6
|
-
groupingModes: string[];
|
|
7
|
-
groupBy: string;
|
|
3
|
+
readonly searchText: string;
|
|
4
|
+
readonly setSearchText: (newVal: string | null) => void;
|
|
5
|
+
readonly setGroupBy: (groupBy: GroupingKeys) => void;
|
|
6
|
+
readonly groupingModes: string[];
|
|
7
|
+
readonly groupBy: string;
|
|
8
8
|
};
|
|
9
9
|
export declare const BookmarkFilter: ({ searchText, setGroupBy, setSearchText, groupingModes, groupBy, }: BookmarkFilterProps) => JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { MutableRefObject } from 'react';
|
|
2
2
|
import { MenuOption } from './Row';
|
|
3
3
|
type MenuProps = {
|
|
4
|
-
pRef: MutableRefObject<HTMLElement | null>;
|
|
5
|
-
onClose: VoidFunction;
|
|
6
|
-
open: boolean;
|
|
7
|
-
options: MenuOption[];
|
|
4
|
+
readonly pRef: MutableRefObject<HTMLElement | null>;
|
|
5
|
+
readonly onClose: VoidFunction;
|
|
6
|
+
readonly open: boolean;
|
|
7
|
+
readonly options: MenuOption[];
|
|
8
8
|
};
|
|
9
9
|
export declare const MoreMenu: ({ pRef, onClose, open, options }: MenuProps) => JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -6,12 +6,12 @@ export type MenuOption = {
|
|
|
6
6
|
Icon?: ReactNode;
|
|
7
7
|
};
|
|
8
8
|
type RowProps = {
|
|
9
|
-
name: string;
|
|
10
|
-
id: string;
|
|
11
|
-
menuOpen: boolean;
|
|
12
|
-
onMenuOpen: (id: string) => void;
|
|
13
|
-
menuOptions: MenuOption[];
|
|
14
|
-
children?: ReactNode;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly menuOpen: boolean;
|
|
12
|
+
readonly onMenuOpen: (id: string) => void;
|
|
13
|
+
readonly menuOptions: MenuOption[];
|
|
14
|
+
readonly children?: ReactNode;
|
|
15
15
|
};
|
|
16
16
|
export declare const Row: ({ name, menuOptions, children, id, menuOpen, onMenuOpen }: RowProps) => JSX.Element;
|
|
17
17
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useBookmarkGrouping } from '../../hooks';
|
|
2
2
|
type SectionListProps = {
|
|
3
|
-
bookmarkGroups: ReturnType<typeof useBookmarkGrouping>['bookmarkGroups'];
|
|
3
|
+
readonly bookmarkGroups: ReturnType<typeof useBookmarkGrouping>['bookmarkGroups'];
|
|
4
4
|
};
|
|
5
5
|
export declare const SectionList: ({ bookmarkGroups }: SectionListProps) => JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -9,6 +9,6 @@ export declare const useBookmarkGrouping: (bookmarks?: Bookmark[]) => {
|
|
|
9
9
|
groupingProperty: string;
|
|
10
10
|
values: Bookmark<unknown>[];
|
|
11
11
|
}[];
|
|
12
|
-
groupingModes: Record<GroupingKeys, (
|
|
12
|
+
groupingModes: Record<GroupingKeys, (_item: Bookmark) => string>;
|
|
13
13
|
groupByKey: GroupingKeys;
|
|
14
14
|
};
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.1.
|
|
1
|
+
export declare const version = "0.1.16";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-react-components-bookmark",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"directory": "packages/react/components/bookmark"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@equinor/eds-utils": "^0.
|
|
27
|
-
"@equinor/fusion-framework-react": "^5.2.
|
|
28
|
-
"@equinor/fusion-framework-react-module-bookmark": "^2.0.
|
|
26
|
+
"@equinor/eds-utils": "^0.8.1",
|
|
27
|
+
"@equinor/fusion-framework-react": "^5.2.3",
|
|
28
|
+
"@equinor/fusion-framework-react-module-bookmark": "^2.0.13"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@emotion/css": "^11.10.6",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@equinor/eds-icons": "^0.19.1",
|
|
36
36
|
"@equinor/eds-tokens": "^0.9.0",
|
|
37
37
|
"@equinor/fusion-framework-module-app": "^5.2.1",
|
|
38
|
-
"@equinor/fusion-framework-module-event": "^4.0.
|
|
38
|
+
"@equinor/fusion-framework-module-event": "^4.0.3",
|
|
39
39
|
"@types/react": "^17.0.11",
|
|
40
40
|
"react": "^17.0.2",
|
|
41
41
|
"styled-components": "^5.3.9",
|
|
@@ -15,8 +15,8 @@ export const CreateBookmarkModal = ({
|
|
|
15
15
|
isOpen,
|
|
16
16
|
onClose,
|
|
17
17
|
}: {
|
|
18
|
-
isOpen: boolean;
|
|
19
|
-
onClose: (b: boolean) => void;
|
|
18
|
+
readonly isOpen: boolean;
|
|
19
|
+
readonly onClose: (b: boolean) => void;
|
|
20
20
|
}) => {
|
|
21
21
|
const [state, setState] = useState<{ name: string; description: string; isShared: boolean }>({
|
|
22
22
|
name: '',
|
|
@@ -34,9 +34,9 @@ export const EditBookmarkModal = ({
|
|
|
34
34
|
onClose,
|
|
35
35
|
bookmarkId,
|
|
36
36
|
}: {
|
|
37
|
-
isOpen: boolean;
|
|
38
|
-
onClose: (b: boolean) => void;
|
|
39
|
-
bookmarkId?: string;
|
|
37
|
+
readonly isOpen: boolean;
|
|
38
|
+
readonly onClose: (b: boolean) => void;
|
|
39
|
+
readonly bookmarkId?: string;
|
|
40
40
|
}) => {
|
|
41
41
|
const [state, setState] = useState<PatchBookmark>({
|
|
42
42
|
id: '',
|
|
@@ -3,11 +3,11 @@ import { Search, Autocomplete } from '@equinor/eds-core-react';
|
|
|
3
3
|
import { GroupingKeys } from '../../hooks/useBookmarkGrouping';
|
|
4
4
|
|
|
5
5
|
type BookmarkFilterProps = {
|
|
6
|
-
searchText: string;
|
|
7
|
-
setSearchText: (newVal: string | null) => void;
|
|
8
|
-
setGroupBy: (groupBy: GroupingKeys) => void;
|
|
9
|
-
groupingModes: string[];
|
|
10
|
-
groupBy: string;
|
|
6
|
+
readonly searchText: string;
|
|
7
|
+
readonly setSearchText: (newVal: string | null) => void;
|
|
8
|
+
readonly setGroupBy: (groupBy: GroupingKeys) => void;
|
|
9
|
+
readonly groupingModes: string[];
|
|
10
|
+
readonly groupBy: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
const styles = {
|
|
@@ -3,10 +3,10 @@ import { MutableRefObject } from 'react';
|
|
|
3
3
|
import { MenuOption } from './Row';
|
|
4
4
|
|
|
5
5
|
type MenuProps = {
|
|
6
|
-
pRef: MutableRefObject<HTMLElement | null>;
|
|
7
|
-
onClose: VoidFunction;
|
|
8
|
-
open: boolean;
|
|
9
|
-
options: MenuOption[];
|
|
6
|
+
readonly pRef: MutableRefObject<HTMLElement | null>;
|
|
7
|
+
readonly onClose: VoidFunction;
|
|
8
|
+
readonly open: boolean;
|
|
9
|
+
readonly options: MenuOption[];
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export const MoreMenu = ({ pRef, onClose, open, options }: MenuProps) => {
|
|
@@ -14,12 +14,12 @@ export type MenuOption = {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
type RowProps = {
|
|
17
|
-
name: string;
|
|
18
|
-
id: string;
|
|
19
|
-
menuOpen: boolean;
|
|
20
|
-
onMenuOpen: (id: string) => void;
|
|
21
|
-
menuOptions: MenuOption[];
|
|
22
|
-
children?: ReactNode;
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly menuOpen: boolean;
|
|
20
|
+
readonly onMenuOpen: (id: string) => void;
|
|
21
|
+
readonly menuOptions: MenuOption[];
|
|
22
|
+
readonly children?: ReactNode;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const styles = {
|
|
@@ -51,7 +51,9 @@ export const Row = ({ name, menuOptions, children, id, menuOpen, onMenuOpen }: R
|
|
|
51
51
|
|
|
52
52
|
useOutsideClick(pRef.current, () => onMenuOpen(''));
|
|
53
53
|
|
|
54
|
+
// TODO: @noggling fix this
|
|
54
55
|
return (
|
|
56
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events
|
|
55
57
|
<li
|
|
56
58
|
className={styles.row}
|
|
57
59
|
onClick={(e) => {
|
|
@@ -41,8 +41,8 @@ Icon.add({
|
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
type SectionProps = {
|
|
44
|
-
name: string;
|
|
45
|
-
children: ReactNode;
|
|
44
|
+
readonly name: string;
|
|
45
|
+
readonly children: ReactNode;
|
|
46
46
|
};
|
|
47
47
|
export const Section = ({ children, name }: SectionProps) => {
|
|
48
48
|
const [isExpanded, setIsExpanded] = useState(true);
|
|
@@ -23,7 +23,7 @@ Icon.add({
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
type SectionListProps = {
|
|
26
|
-
bookmarkGroups: ReturnType<typeof useBookmarkGrouping>['bookmarkGroups'];
|
|
26
|
+
readonly bookmarkGroups: ReturnType<typeof useBookmarkGrouping>['bookmarkGroups'];
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export const SectionList = ({ bookmarkGroups }: SectionListProps) => {
|
|
@@ -47,7 +47,7 @@ export const SectionList = ({ bookmarkGroups }: SectionListProps) => {
|
|
|
47
47
|
(bookmarkId: string) => {
|
|
48
48
|
event.dispatchEvent('onBookmarkEdit', { detail: { bookmarkId } });
|
|
49
49
|
},
|
|
50
|
-
[event]
|
|
50
|
+
[event],
|
|
51
51
|
);
|
|
52
52
|
|
|
53
53
|
const shareBookmark = useCallback(
|
|
@@ -59,14 +59,14 @@ export const SectionList = ({ bookmarkGroups }: SectionListProps) => {
|
|
|
59
59
|
}
|
|
60
60
|
updateBookmark({ ...bookmark, isShared: !bookmark.isShared });
|
|
61
61
|
},
|
|
62
|
-
[event, updateBookmark]
|
|
62
|
+
[event, updateBookmark],
|
|
63
63
|
);
|
|
64
64
|
|
|
65
65
|
const updateBookmarkWithCurrentView = useCallback(
|
|
66
66
|
(bookmark: Bookmark) => {
|
|
67
67
|
updateBookmark({ ...bookmark }, { updatePayload: true });
|
|
68
68
|
},
|
|
69
|
-
[updateBookmark]
|
|
69
|
+
[updateBookmark],
|
|
70
70
|
);
|
|
71
71
|
|
|
72
72
|
const createMenuOptions = (bookmark: Bookmark) =>
|
|
@@ -78,7 +78,7 @@ export const SectionList = ({ bookmarkGroups }: SectionListProps) => {
|
|
|
78
78
|
removeBookmarkFavorite,
|
|
79
79
|
updateBookmarkWithCurrentView,
|
|
80
80
|
getCurrentAppKey(),
|
|
81
|
-
user?.localAccountId
|
|
81
|
+
user?.localAccountId,
|
|
82
82
|
);
|
|
83
83
|
|
|
84
84
|
if (loading) return <Loading />;
|
|
@@ -120,7 +120,7 @@ function createBookmarkActions(
|
|
|
120
120
|
removeBookmarkFavorite: (bookmarkId: string) => void,
|
|
121
121
|
updateBookmarkWithCurrentView: (bookmark: Bookmark) => void,
|
|
122
122
|
appKey?: string,
|
|
123
|
-
localAccountId?: string
|
|
123
|
+
localAccountId?: string,
|
|
124
124
|
) {
|
|
125
125
|
if (bookmark.createdBy.azureUniqueId === localAccountId) {
|
|
126
126
|
return [
|
|
@@ -4,8 +4,8 @@ import { tokens } from '@equinor/eds-tokens';
|
|
|
4
4
|
import { useFramework } from '@equinor/fusion-framework-react';
|
|
5
5
|
|
|
6
6
|
type SharedIconProps = {
|
|
7
|
-
createdBy: string;
|
|
8
|
-
createdById: string;
|
|
7
|
+
readonly createdBy: string;
|
|
8
|
+
readonly createdById: string;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export const SharedIcon = ({ createdBy, createdById }: SharedIconProps) => {
|
|
@@ -4,7 +4,7 @@ import { useState } from 'react';
|
|
|
4
4
|
|
|
5
5
|
export type GroupingKeys = 'Group by app' | 'Created by' | 'Group by Context';
|
|
6
6
|
|
|
7
|
-
const groupingModes: Record<GroupingKeys, (
|
|
7
|
+
const groupingModes: Record<GroupingKeys, (_item: Bookmark) => string> = {
|
|
8
8
|
'Group by app': (item: Bookmark) => item.appKey,
|
|
9
9
|
'Created by': (item: Bookmark) => item.createdBy.name,
|
|
10
10
|
'Group by Context': (item: Bookmark) => item?.context?.name ?? 'Unknown',
|
|
@@ -31,7 +31,7 @@ const groupBy = <T>(
|
|
|
31
31
|
array: T[],
|
|
32
32
|
getKey: (item: T) => string,
|
|
33
33
|
searchText: string | null,
|
|
34
|
-
field: keyof T
|
|
34
|
+
field: keyof T,
|
|
35
35
|
) => {
|
|
36
36
|
return (
|
|
37
37
|
array
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '0.1.
|
|
2
|
+
export const version = '0.1.16';
|