@equinor/fusion-framework-react-components-bookmark 0.1.14-next.0 → 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.
Files changed (51) hide show
  1. package/CHANGELOG.md +20 -3
  2. package/dist/esm/components/Bookmark.js +1 -1
  3. package/dist/esm/components/Bookmark.js.map +1 -1
  4. package/dist/esm/components/BookmarkProvider.js +1 -1
  5. package/dist/esm/components/BookmarkProvider.js.map +1 -1
  6. package/dist/esm/components/create-bookmark/CreateBookmark.js +3 -3
  7. package/dist/esm/components/create-bookmark/CreateBookmark.js.map +1 -1
  8. package/dist/esm/components/edit-bookmark/EditBookmark.js +4 -4
  9. package/dist/esm/components/edit-bookmark/EditBookmark.js.map +1 -1
  10. package/dist/esm/components/filter/Filter.js +2 -2
  11. package/dist/esm/components/filter/Filter.js.map +1 -1
  12. package/dist/esm/components/import-bookmark/ImportBookmark.js +2 -2
  13. package/dist/esm/components/import-bookmark/ImportBookmark.js.map +1 -1
  14. package/dist/esm/components/loading/Loading.js +2 -2
  15. package/dist/esm/components/loading/Loading.js.map +1 -1
  16. package/dist/esm/components/row/MoreMenu.js +2 -2
  17. package/dist/esm/components/row/MoreMenu.js.map +1 -1
  18. package/dist/esm/components/row/Row.js +3 -3
  19. package/dist/esm/components/row/Row.js.map +1 -1
  20. package/dist/esm/components/section/Section.js +1 -1
  21. package/dist/esm/components/section/Section.js.map +1 -1
  22. package/dist/esm/components/sectionList/SectionList.js +2 -2
  23. package/dist/esm/components/sectionList/SectionList.js.map +1 -1
  24. package/dist/esm/hooks/useBookmarkGrouping.js.map +1 -1
  25. package/dist/esm/version.js +2 -0
  26. package/dist/esm/version.js.map +1 -0
  27. package/dist/tsconfig.tsbuildinfo +1 -1
  28. package/dist/types/components/BookmarkProvider.d.ts +1 -1
  29. package/dist/types/components/create-bookmark/CreateBookmark.d.ts +2 -2
  30. package/dist/types/components/edit-bookmark/EditBookmark.d.ts +3 -3
  31. package/dist/types/components/filter/Filter.d.ts +5 -5
  32. package/dist/types/components/row/MoreMenu.d.ts +4 -4
  33. package/dist/types/components/row/Row.d.ts +6 -6
  34. package/dist/types/components/section/Section.d.ts +2 -2
  35. package/dist/types/components/sectionList/SectionList.d.ts +1 -1
  36. package/dist/types/components/shared/SharedIcon.d.ts +2 -2
  37. package/dist/types/hooks/useBookmarkGrouping.d.ts +1 -1
  38. package/dist/types/version.d.ts +1 -0
  39. package/package.json +7 -8
  40. package/src/components/BookmarkProvider.tsx +1 -1
  41. package/src/components/create-bookmark/CreateBookmark.tsx +3 -3
  42. package/src/components/edit-bookmark/EditBookmark.tsx +6 -5
  43. package/src/components/filter/Filter.tsx +5 -5
  44. package/src/components/row/MoreMenu.tsx +4 -4
  45. package/src/components/row/Row.tsx +8 -6
  46. package/src/components/section/Section.tsx +2 -2
  47. package/src/components/sectionList/SectionList.tsx +8 -7
  48. package/src/components/shared/SharedIcon.tsx +2 -2
  49. package/src/hooks/useBookmarkGrouping.ts +2 -2
  50. package/src/version.ts +2 -0
  51. package/tsconfig.json +6 -1
@@ -1,4 +1,4 @@
1
- import { FrameworkEvent, FrameworkEventInit } from '@equinor/fusion-framework-module-event';
1
+ import type { FrameworkEvent, FrameworkEventInit } from '@equinor/fusion-framework-module-event';
2
2
  import { PropsWithChildren } from 'react';
3
3
  export declare const BookmarkProvider: ({ children }: PropsWithChildren<unknown>) => JSX.Element;
4
4
  declare module '@equinor/fusion-framework-module-event' {
@@ -1,4 +1,4 @@
1
1
  export declare const CreateBookmarkModal: ({ isOpen, onClose, }: {
2
- isOpen: boolean;
3
- onClose: (b: boolean) => void;
2
+ readonly isOpen: boolean;
3
+ readonly onClose: (b: boolean) => void;
4
4
  }) => JSX.Element;
@@ -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,7 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  type SectionProps = {
3
- name: string;
4
- children: ReactNode;
3
+ readonly name: string;
4
+ readonly children: ReactNode;
5
5
  };
6
6
  export declare const Section: ({ children, name }: SectionProps) => JSX.Element;
7
7
  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 {};
@@ -1,6 +1,6 @@
1
1
  type SharedIconProps = {
2
- createdBy: string;
3
- createdById: string;
2
+ readonly createdBy: string;
3
+ readonly createdById: string;
4
4
  };
5
5
  export declare const SharedIcon: ({ createdBy, createdById }: SharedIconProps) => 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, (item: Bookmark) => string>;
12
+ groupingModes: Record<GroupingKeys, (_item: Bookmark) => string>;
13
13
  groupByKey: GroupingKeys;
14
14
  };
@@ -0,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.14-next.0",
3
+ "version": "0.1.16",
4
4
  "description": "",
5
5
  "main": "dist/esm/index.js",
6
6
  "exports": {
@@ -23,8 +23,9 @@
23
23
  "directory": "packages/react/components/bookmark"
24
24
  },
25
25
  "dependencies": {
26
- "@equinor/eds-utils": "^0.7.0",
27
- "@equinor/fusion-framework-react-module-bookmark": "^2.0.13-next.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"
28
29
  },
29
30
  "devDependencies": {
30
31
  "@emotion/css": "^11.10.6",
@@ -33,11 +34,12 @@
33
34
  "@equinor/eds-core-react": "^0.30.0",
34
35
  "@equinor/eds-icons": "^0.19.1",
35
36
  "@equinor/eds-tokens": "^0.9.0",
37
+ "@equinor/fusion-framework-module-app": "^5.2.1",
38
+ "@equinor/fusion-framework-module-event": "^4.0.3",
36
39
  "@types/react": "^17.0.11",
37
40
  "react": "^17.0.2",
38
- "react-dom": "^17.0.2",
39
41
  "styled-components": "^5.3.9",
40
- "typescript": "^5.0.4"
42
+ "typescript": "^5.1.3"
41
43
  },
42
44
  "peerDependencies": {
43
45
  "@emotion/css": "^11.10.6",
@@ -52,9 +54,6 @@
52
54
  "peerDependenciesMeta": {
53
55
  "@types/react": {
54
56
  "optional": true
55
- },
56
- "react-dom": {
57
- "optional": true
58
57
  }
59
58
  }
60
59
  }
@@ -1,5 +1,5 @@
1
1
  import { Snackbar } from '@equinor/eds-core-react';
2
- import { FrameworkEvent, FrameworkEventInit } from '@equinor/fusion-framework-module-event';
2
+ import type { FrameworkEvent, FrameworkEventInit } from '@equinor/fusion-framework-module-event';
3
3
  import { useFramework } from '@equinor/fusion-framework-react';
4
4
  import { PropsWithChildren, useEffect, useState } from 'react';
5
5
  import { CreateBookmarkModal } from './create-bookmark';
@@ -1,6 +1,6 @@
1
1
  import styled from '@emotion/styled';
2
2
  import { Button, Checkbox, Dialog, Input, Label, TextField } from '@equinor/eds-core-react';
3
- import { AppModule } from '@equinor/fusion-framework-module-app';
3
+ import type { AppModule } from '@equinor/fusion-framework-module-app';
4
4
  import { useFramework } from '@equinor/fusion-framework-react';
5
5
  import { useBookmark } from '@equinor/fusion-framework-react-module-bookmark';
6
6
  import { ChangeEvent, useState } from 'react';
@@ -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: '',
@@ -1,8 +1,9 @@
1
1
  import { css } from '@emotion/css';
2
2
  import styled from '@emotion/styled';
3
3
  import { Button, Checkbox, Dialog, Input, Label, TextField } from '@equinor/eds-core-react';
4
- import { AppModule } from '@equinor/fusion-framework-module-app';
5
- import { PatchBookmark } from '@equinor/fusion-framework-module-bookmark';
4
+ import type { AppModule } from '@equinor/fusion-framework-module-app';
5
+ // TODO - export from `@equinor/fusion-framework-react-module-bookmark`
6
+ import type { PatchBookmark } from '@equinor/fusion-framework-module-bookmark';
6
7
  import { useFramework } from '@equinor/fusion-framework-react';
7
8
  import { useBookmark } from '@equinor/fusion-framework-react-module-bookmark';
8
9
  import { ChangeEvent, useEffect, useState } from 'react';
@@ -33,9 +34,9 @@ export const EditBookmarkModal = ({
33
34
  onClose,
34
35
  bookmarkId,
35
36
  }: {
36
- isOpen: boolean;
37
- onClose: (b: boolean) => void;
38
- bookmarkId?: string;
37
+ readonly isOpen: boolean;
38
+ readonly onClose: (b: boolean) => void;
39
+ readonly bookmarkId?: string;
39
40
  }) => {
40
41
  const [state, setState] = useState<PatchBookmark>({
41
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);
@@ -3,7 +3,8 @@ import { useBookmarkGrouping } from '../../hooks';
3
3
  import { Row } from '../row/Row';
4
4
  import { Section } from '../section/Section';
5
5
  import { SharedIcon } from '../shared/SharedIcon';
6
- import { Bookmark } from '@equinor/fusion-framework-module-bookmark';
6
+ // TODO - export from `@equinor/fusion-framework-react-module-bookmark`
7
+ import type { Bookmark } from '@equinor/fusion-framework-module-bookmark';
7
8
  import { useBookmark } from '@equinor/fusion-framework-react-module-bookmark';
8
9
  import { useCurrentUser } from '@equinor/fusion-framework-react/hooks';
9
10
  import { useCallback, useEffect, useState } from 'react';
@@ -22,7 +23,7 @@ Icon.add({
22
23
  });
23
24
 
24
25
  type SectionListProps = {
25
- bookmarkGroups: ReturnType<typeof useBookmarkGrouping>['bookmarkGroups'];
26
+ readonly bookmarkGroups: ReturnType<typeof useBookmarkGrouping>['bookmarkGroups'];
26
27
  };
27
28
 
28
29
  export const SectionList = ({ bookmarkGroups }: SectionListProps) => {
@@ -46,7 +47,7 @@ export const SectionList = ({ bookmarkGroups }: SectionListProps) => {
46
47
  (bookmarkId: string) => {
47
48
  event.dispatchEvent('onBookmarkEdit', { detail: { bookmarkId } });
48
49
  },
49
- [event]
50
+ [event],
50
51
  );
51
52
 
52
53
  const shareBookmark = useCallback(
@@ -58,14 +59,14 @@ export const SectionList = ({ bookmarkGroups }: SectionListProps) => {
58
59
  }
59
60
  updateBookmark({ ...bookmark, isShared: !bookmark.isShared });
60
61
  },
61
- [event, updateBookmark]
62
+ [event, updateBookmark],
62
63
  );
63
64
 
64
65
  const updateBookmarkWithCurrentView = useCallback(
65
66
  (bookmark: Bookmark) => {
66
67
  updateBookmark({ ...bookmark }, { updatePayload: true });
67
68
  },
68
- [updateBookmark]
69
+ [updateBookmark],
69
70
  );
70
71
 
71
72
  const createMenuOptions = (bookmark: Bookmark) =>
@@ -77,7 +78,7 @@ export const SectionList = ({ bookmarkGroups }: SectionListProps) => {
77
78
  removeBookmarkFavorite,
78
79
  updateBookmarkWithCurrentView,
79
80
  getCurrentAppKey(),
80
- user?.localAccountId
81
+ user?.localAccountId,
81
82
  );
82
83
 
83
84
  if (loading) return <Loading />;
@@ -119,7 +120,7 @@ function createBookmarkActions(
119
120
  removeBookmarkFavorite: (bookmarkId: string) => void,
120
121
  updateBookmarkWithCurrentView: (bookmark: Bookmark) => void,
121
122
  appKey?: string,
122
- localAccountId?: string
123
+ localAccountId?: string,
123
124
  ) {
124
125
  if (bookmark.createdBy.azureUniqueId === localAccountId) {
125
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, (item: Bookmark) => string> = {
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 ADDED
@@ -0,0 +1,2 @@
1
+ // Generated by genversion.
2
+ export const version = '0.1.16';
package/tsconfig.json CHANGED
@@ -7,7 +7,12 @@
7
7
  "baseUrl": "src",
8
8
  },
9
9
  "references": [
10
-
10
+ {
11
+ "path": "../../framework"
12
+ },
13
+ {
14
+ "path": "../../modules/bookmark"
15
+ }
11
16
  ],
12
17
  "include": [
13
18
  "src/**/*"