@commercetools-frontend/application-components 21.4.0 → 21.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. package/dist/commercetools-frontend-application-components.cjs.dev.js +541 -230
  2. package/dist/commercetools-frontend-application-components.cjs.prod.js +430 -171
  3. package/dist/commercetools-frontend-application-components.esm.js +533 -232
  4. package/dist/declarations/src/components/detail-pages/custom-form-detail-page/custom-form-detail-page.d.ts +201 -0
  5. package/dist/declarations/src/components/detail-pages/custom-form-detail-page/index.d.ts +1 -0
  6. package/dist/declarations/src/components/detail-pages/form-detail-page/form-detail-page.d.ts +125 -0
  7. package/dist/declarations/src/components/detail-pages/form-detail-page/index.d.ts +1 -0
  8. package/dist/declarations/src/components/detail-pages/info-detail-page/index.d.ts +1 -0
  9. package/dist/declarations/src/components/detail-pages/info-detail-page/info-detail-page.d.ts +37 -0
  10. package/dist/declarations/src/components/{tabular-detail-page → detail-pages/tabular-detail-page}/index.d.ts +0 -0
  11. package/dist/declarations/src/components/{tabular-detail-page → detail-pages/tabular-detail-page}/tabular-detail-page.d.ts +0 -0
  12. package/dist/declarations/src/components/dialogs/internals/dialog-container.d.ts +3 -3
  13. package/dist/declarations/src/components/dialogs/internals/dialog-header.d.ts +1 -1
  14. package/dist/declarations/src/components/dialogs/internals/dialog.styles.d.ts +2 -1
  15. package/dist/declarations/src/components/modal-pages/internals/modal-page.d.ts +5 -5
  16. package/dist/declarations/src/components/modal-pages/internals/modal-page.styles.d.ts +1 -3
  17. package/dist/declarations/src/components/portals-container/portals-container.d.ts +6 -5
  18. package/dist/declarations/src/hooks/use-mutation-observer/index.d.ts +1 -0
  19. package/dist/declarations/src/hooks/use-mutation-observer/use-mutation-observer.d.ts +4 -0
  20. package/dist/declarations/src/index.d.ts +4 -1
  21. package/package.json +8 -6
@@ -0,0 +1,201 @@
1
+ import type { ReactElement, ReactNode, MouseEvent, KeyboardEvent } from 'react';
2
+ declare type MessageDescriptor = {
3
+ id: string;
4
+ description?: string | object;
5
+ defaultMessage?: string;
6
+ values?: Record<string, ReactNode>;
7
+ };
8
+ declare type CustomFormDetailPageProps = {
9
+ title?: string;
10
+ subtitle?: string | ReactElement;
11
+ customTitleRow?: ReactNode;
12
+ children: ReactNode;
13
+ formControls?: ReactNode;
14
+ hideControls?: boolean;
15
+ previousPathLabel?: string | MessageDescriptor;
16
+ onPreviousPathClick: (event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
17
+ };
18
+ declare const CustomFormDetailPage: {
19
+ (props: CustomFormDetailPageProps): import("@emotion/react/jsx-runtime").JSX.Element;
20
+ displayName: string;
21
+ defaultProps: Pick<CustomFormDetailPageProps, "hideControls">;
22
+ PageHeaderTitle: {
23
+ (props: {
24
+ title: string;
25
+ titleSize: "big" | "small";
26
+ truncate: boolean;
27
+ subtitle?: string | ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
28
+ children?: undefined;
29
+ }): import("@emotion/react/jsx-runtime").JSX.Element;
30
+ displayName: string;
31
+ defaultProps: Pick<{
32
+ title: string;
33
+ titleSize: "big" | "small";
34
+ truncate: boolean;
35
+ subtitle?: string | ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
36
+ children?: undefined;
37
+ }, "truncate" | "titleSize">;
38
+ };
39
+ FormPrimaryButton: {
40
+ (props: {
41
+ label: string | {
42
+ id: string;
43
+ description?: string | object | undefined;
44
+ defaultMessage?: string | undefined;
45
+ };
46
+ onClick: (event: import("react").SyntheticEvent<Element, Event>) => void;
47
+ isDisabled: boolean;
48
+ dataAttributes: {
49
+ [key: string]: string;
50
+ };
51
+ children?: undefined;
52
+ }): import("@emotion/react/jsx-runtime").JSX.Element;
53
+ displayName: string;
54
+ defaultProps: Pick<{
55
+ label: string | {
56
+ id: string;
57
+ description?: string | object | undefined;
58
+ defaultMessage?: string | undefined;
59
+ };
60
+ onClick: (event: import("react").SyntheticEvent<Element, Event>) => void;
61
+ isDisabled: boolean;
62
+ dataAttributes: {
63
+ [key: string]: string;
64
+ };
65
+ children?: undefined;
66
+ }, "label" | "isDisabled" | "dataAttributes">;
67
+ };
68
+ FormSecondaryButton: {
69
+ (props: {
70
+ label: string | {
71
+ id: string;
72
+ description?: string | object | undefined;
73
+ defaultMessage?: string | undefined;
74
+ };
75
+ onClick: (event: import("react").SyntheticEvent<Element, Event>) => void;
76
+ isDisabled: boolean;
77
+ dataAttributes: {
78
+ [key: string]: string;
79
+ };
80
+ children?: undefined;
81
+ }): import("@emotion/react/jsx-runtime").JSX.Element;
82
+ displayName: string;
83
+ defaultProps: Pick<{
84
+ label: string | {
85
+ id: string;
86
+ description?: string | object | undefined;
87
+ defaultMessage?: string | undefined;
88
+ };
89
+ onClick: (event: import("react").SyntheticEvent<Element, Event>) => void;
90
+ isDisabled: boolean;
91
+ dataAttributes: {
92
+ [key: string]: string;
93
+ };
94
+ children?: undefined;
95
+ }, "label" | "isDisabled" | "dataAttributes">;
96
+ };
97
+ FormDeleteButton: {
98
+ (props: {
99
+ label: string | {
100
+ id: string;
101
+ description?: string | object | undefined;
102
+ defaultMessage?: string | undefined;
103
+ };
104
+ onClick: (event: import("react").SyntheticEvent<Element, Event>) => void;
105
+ isDisabled: boolean;
106
+ dataAttributes: {
107
+ [key: string]: string;
108
+ };
109
+ children?: undefined;
110
+ }): import("@emotion/react/jsx-runtime").JSX.Element;
111
+ displayName: string;
112
+ defaultProps: Pick<{
113
+ label: string | {
114
+ id: string;
115
+ description?: string | object | undefined;
116
+ defaultMessage?: string | undefined;
117
+ };
118
+ onClick: (event: import("react").SyntheticEvent<Element, Event>) => void;
119
+ isDisabled: boolean;
120
+ dataAttributes: {
121
+ [key: string]: string;
122
+ };
123
+ children?: undefined;
124
+ }, "label" | "isDisabled" | "dataAttributes">;
125
+ };
126
+ Intl: {
127
+ cancel: {
128
+ id: string;
129
+ defaultMessage: string;
130
+ };
131
+ revert: {
132
+ id: string;
133
+ defaultMessage: string;
134
+ };
135
+ confirm: {
136
+ id: string;
137
+ defaultMessage: string;
138
+ };
139
+ save: {
140
+ id: string;
141
+ defaultMessage: string;
142
+ };
143
+ update: {
144
+ id: string;
145
+ defaultMessage: string;
146
+ };
147
+ create: {
148
+ id: string;
149
+ defaultMessage: string;
150
+ };
151
+ delete: {
152
+ id: string;
153
+ defaultMessage: string;
154
+ };
155
+ add: {
156
+ id: string;
157
+ defaultMessage: string;
158
+ };
159
+ remove: {
160
+ id: string;
161
+ defaultMessage: string;
162
+ };
163
+ close: {
164
+ id: string;
165
+ defaultMessage: string;
166
+ };
167
+ edit: {
168
+ id: string;
169
+ defaultMessage: string;
170
+ };
171
+ open: {
172
+ id: string;
173
+ defaultMessage: string;
174
+ };
175
+ activate: {
176
+ id: string;
177
+ defaultMessage: string;
178
+ };
179
+ deactivate: {
180
+ id: string;
181
+ defaultMessage: string;
182
+ };
183
+ active: {
184
+ id: string;
185
+ defaultMessage: string;
186
+ };
187
+ inactive: {
188
+ id: string;
189
+ defaultMessage: string;
190
+ };
191
+ enable: {
192
+ id: string;
193
+ defaultMessage: string;
194
+ };
195
+ disable: {
196
+ id: string;
197
+ defaultMessage: string;
198
+ };
199
+ };
200
+ };
201
+ export default CustomFormDetailPage;
@@ -0,0 +1 @@
1
+ export { default } from './custom-form-detail-page';
@@ -0,0 +1,125 @@
1
+ import type { ReactElement, ReactNode, MouseEvent, KeyboardEvent, SyntheticEvent } from 'react';
2
+ declare type MessageDescriptor = {
3
+ id: string;
4
+ description?: string | object;
5
+ defaultMessage?: string;
6
+ };
7
+ declare type Label = string | MessageDescriptor;
8
+ declare type FormDetailPageProps = {
9
+ title?: string;
10
+ subtitle?: string | ReactElement;
11
+ customTitleRow?: ReactNode;
12
+ children: ReactNode;
13
+ previousPathLabel?: string | MessageDescriptor;
14
+ onPreviousPathClick: (event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
15
+ isPrimaryButtonDisabled?: boolean;
16
+ isSecondaryButtonDisabled?: boolean;
17
+ dataAttributesPrimaryButton?: {
18
+ [key: string]: string;
19
+ };
20
+ dataAttributesSecondaryButton?: {
21
+ [key: string]: string;
22
+ };
23
+ labelPrimaryButton?: Label;
24
+ labelSecondaryButton?: Label;
25
+ onPrimaryButtonClick: (event: SyntheticEvent) => void;
26
+ onSecondaryButtonClick: (event: SyntheticEvent) => void;
27
+ hideControls: boolean;
28
+ };
29
+ declare const FormDetailPage: {
30
+ (props: FormDetailPageProps): import("@emotion/react/jsx-runtime").JSX.Element;
31
+ displayName: string;
32
+ defaultProps: Pick<FormDetailPageProps, "hideControls">;
33
+ PageHeaderTitle: {
34
+ (props: {
35
+ title: string;
36
+ titleSize: "big" | "small";
37
+ truncate: boolean;
38
+ subtitle?: string | ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
39
+ children?: undefined;
40
+ }): import("@emotion/react/jsx-runtime").JSX.Element;
41
+ displayName: string;
42
+ defaultProps: Pick<{
43
+ title: string;
44
+ titleSize: "big" | "small";
45
+ truncate: boolean;
46
+ subtitle?: string | ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
47
+ children?: undefined;
48
+ }, "truncate" | "titleSize">;
49
+ };
50
+ Intl: {
51
+ cancel: {
52
+ id: string;
53
+ defaultMessage: string;
54
+ };
55
+ revert: {
56
+ id: string;
57
+ defaultMessage: string;
58
+ };
59
+ confirm: {
60
+ id: string;
61
+ defaultMessage: string;
62
+ };
63
+ save: {
64
+ id: string;
65
+ defaultMessage: string;
66
+ };
67
+ update: {
68
+ id: string;
69
+ defaultMessage: string;
70
+ };
71
+ create: {
72
+ id: string;
73
+ defaultMessage: string;
74
+ };
75
+ delete: {
76
+ id: string;
77
+ defaultMessage: string;
78
+ };
79
+ add: {
80
+ id: string;
81
+ defaultMessage: string;
82
+ };
83
+ remove: {
84
+ id: string;
85
+ defaultMessage: string;
86
+ };
87
+ close: {
88
+ id: string;
89
+ defaultMessage: string;
90
+ };
91
+ edit: {
92
+ id: string;
93
+ defaultMessage: string;
94
+ };
95
+ open: {
96
+ id: string;
97
+ defaultMessage: string;
98
+ };
99
+ activate: {
100
+ id: string;
101
+ defaultMessage: string;
102
+ };
103
+ deactivate: {
104
+ id: string;
105
+ defaultMessage: string;
106
+ };
107
+ active: {
108
+ id: string;
109
+ defaultMessage: string;
110
+ };
111
+ inactive: {
112
+ id: string;
113
+ defaultMessage: string;
114
+ };
115
+ enable: {
116
+ id: string;
117
+ defaultMessage: string;
118
+ };
119
+ disable: {
120
+ id: string;
121
+ defaultMessage: string;
122
+ };
123
+ };
124
+ };
125
+ export default FormDetailPage;
@@ -0,0 +1 @@
1
+ export { default } from './form-detail-page';
@@ -0,0 +1 @@
1
+ export { default } from './info-detail-page';
@@ -0,0 +1,37 @@
1
+ import type { ReactElement, ReactNode, MouseEvent, KeyboardEvent } from 'react';
2
+ declare type MessageDescriptor = {
3
+ id: string;
4
+ description?: string | object;
5
+ defaultMessage?: string;
6
+ values?: Record<string, ReactNode>;
7
+ };
8
+ declare type InfoDetailPageProps = {
9
+ title?: string;
10
+ subtitle?: string | ReactElement;
11
+ customTitleRow?: ReactNode;
12
+ children: ReactNode;
13
+ previousPathLabel?: string | MessageDescriptor;
14
+ onPreviousPathClick: (event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
15
+ };
16
+ declare const InfoDetailPage: {
17
+ (props: InfoDetailPageProps): import("@emotion/react/jsx-runtime").JSX.Element;
18
+ displayName: string;
19
+ PageHeaderTitle: {
20
+ (props: {
21
+ title: string;
22
+ titleSize: "big" | "small";
23
+ truncate: boolean;
24
+ subtitle?: string | ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
25
+ children?: undefined;
26
+ }): import("@emotion/react/jsx-runtime").JSX.Element;
27
+ displayName: string;
28
+ defaultProps: Pick<{
29
+ title: string;
30
+ titleSize: "big" | "small";
31
+ truncate: boolean;
32
+ subtitle?: string | ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
33
+ children?: undefined;
34
+ }, "truncate" | "titleSize">;
35
+ };
36
+ };
37
+ export default InfoDetailPage;
@@ -1,10 +1,10 @@
1
- import { ReactNode, SyntheticEvent } from 'react';
1
+ import type { ReactNode, SyntheticEvent } from 'react';
2
2
  declare const getDefaultParentSelector: () => HTMLElement;
3
3
  declare type Props = {
4
4
  isOpen: boolean;
5
5
  onClose?: (event: SyntheticEvent) => void;
6
6
  size: 'm' | 'l' | 7 | 8 | 9 | 10 | 'scale';
7
- zIndex: number;
7
+ zIndex?: number;
8
8
  title: string;
9
9
  children: ReactNode;
10
10
  getParentSelector: typeof getDefaultParentSelector;
@@ -12,6 +12,6 @@ declare type Props = {
12
12
  declare const DialogContainer: {
13
13
  (props: Props): import("@emotion/react/jsx-runtime").JSX.Element;
14
14
  displayName: string;
15
- defaultProps: Pick<Props, "zIndex" | "size" | "getParentSelector">;
15
+ defaultProps: Pick<Props, "size" | "getParentSelector">;
16
16
  };
17
17
  export default DialogContainer;
@@ -1,4 +1,4 @@
1
- import { SyntheticEvent } from 'react';
1
+ import type { SyntheticEvent } from 'react';
2
2
  declare type Props = {
3
3
  title: string;
4
4
  onClose?: (event: SyntheticEvent) => void;
@@ -1,6 +1,7 @@
1
1
  declare type StyleProps = {
2
2
  size: 'm' | 'l' | 7 | 8 | 9 | 10 | 'scale';
3
+ zIndex?: number;
3
4
  };
4
5
  export declare const getModalContentStyles: (props: StyleProps) => import("@emotion/utils").SerializedStyles;
5
- export declare const getModalOverlayStyles: () => import("@emotion/utils").SerializedStyles;
6
+ export declare const getOverlayStyles: (props: StyleProps) => import("@emotion/utils").SerializedStyles;
6
7
  export {};
@@ -1,5 +1,5 @@
1
- import type { CSSObject } from '@emotion/react';
2
- import { ReactNode, SyntheticEvent } from 'react';
1
+ import { type ReactNode, type SyntheticEvent } from 'react';
2
+ import { type CSSObject } from '@emotion/react';
3
3
  declare const getDefaultParentSelector: () => HTMLElement;
4
4
  declare type MessageDescriptor = {
5
5
  id: string;
@@ -8,13 +8,13 @@ declare type MessageDescriptor = {
8
8
  };
9
9
  declare type Label = string | MessageDescriptor;
10
10
  declare type Props = {
11
- level: number;
11
+ level?: number;
12
12
  title: string;
13
13
  isOpen: boolean;
14
14
  onClose?: (event: SyntheticEvent) => void;
15
15
  children: ReactNode;
16
16
  zIndex?: number;
17
- baseZIndex: number;
17
+ baseZIndex?: number;
18
18
  getParentSelector: typeof getDefaultParentSelector;
19
19
  shouldDelayOnClose: boolean;
20
20
  afterOpenStyles?: string | CSSObject;
@@ -25,6 +25,6 @@ declare type Props = {
25
25
  declare const ModalPage: {
26
26
  (props: Props): import("@emotion/react/jsx-runtime").JSX.Element;
27
27
  displayName: string;
28
- defaultProps: Pick<Props, "getParentSelector" | "level" | "baseZIndex" | "shouldDelayOnClose">;
28
+ defaultProps: Pick<Props, "getParentSelector" | "shouldDelayOnClose">;
29
29
  };
30
30
  export default ModalPage;
@@ -1,10 +1,8 @@
1
1
  export declare const TRANSITION_DURATION = 200;
2
2
  declare type StyleProps = {
3
- level: number;
4
3
  zIndex?: number;
5
- baseZIndex: number;
6
4
  };
7
- export declare const getContainerStyles: (props: StyleProps) => import("@emotion/utils").SerializedStyles;
5
+ export declare const getContainerStyles: (_props: StyleProps) => import("@emotion/utils").SerializedStyles;
8
6
  export declare const getOverlayStyles: (props: StyleProps) => import("@emotion/utils").SerializedStyles;
9
7
  export declare const getAfterOpenContainerAnimation: () => import("@emotion/utils").SerializedStyles;
10
8
  export declare const getAfterOpenOverlayAnimation: () => import("@emotion/utils").SerializedStyles;
@@ -4,11 +4,12 @@ declare type TLayoutRefs = {
4
4
  notificationsPageRef: MutableRefObject<HTMLDivElement>;
5
5
  };
6
6
  declare type TPortalsContainerProps = {
7
- offsetTop: string;
8
- offsetLeft: string;
9
- offsetLeftOnExpandedMenu: string;
10
- containerSelectorToPreventScrollingOnOpen: string;
11
- zIndex: number;
7
+ offsetTop?: string;
8
+ offsetLeft?: string;
9
+ offsetLeftOnExpandedMenu?: string;
10
+ containerSelectorToPreventScrollingOnOpen?: string;
11
+ zIndex?: number;
12
+ baseModalZIndex?: number;
12
13
  };
13
14
  declare const PortalsContainer: import("react").ForwardRefExoticComponent<TPortalsContainerProps & import("react").RefAttributes<TLayoutRefs>>;
14
15
  export default PortalsContainer;
@@ -0,0 +1 @@
1
+ export { default } from './use-mutation-observer';
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ declare type TUseMutationObserverCallback = (mutationRecord: MutationRecord, observer: MutationObserver) => void;
3
+ declare function useMutationObserver<T extends HTMLElement>(target: React.RefObject<T> | T | null, callback: TUseMutationObserverCallback, options?: MutationObserverInit): MutationObserver;
4
+ export default useMutationObserver;
@@ -1,7 +1,6 @@
1
1
  export { default as version } from './version';
2
2
  export { default as TabHeader } from './components/tab-header';
3
3
  export { default as TabularMainPage } from './components/tabular-main-page';
4
- export { default as TabularDetailPage } from './components/tabular-detail-page';
5
4
  export { default as InfoDialog } from './components/dialogs/info-dialog';
6
5
  export { default as ConfirmationDialog } from './components/dialogs/confirmation-dialog';
7
6
  export { default as FormDialog } from './components/dialogs/form-dialog';
@@ -9,6 +8,10 @@ export { default as InfoModalPage } from './components/modal-pages/info-modal-pa
9
8
  export { default as FormModalPage } from './components/modal-pages/form-modal-page';
10
9
  export { default as TabularModalPage } from './components/modal-pages/tabular-modal-page';
11
10
  export { default as CustomFormModalPage } from './components/modal-pages/custom-form-modal-page';
11
+ export { default as CustomFormDetailPage } from './components/detail-pages/custom-form-detail-page';
12
+ export { default as FormDetailPage } from './components/detail-pages/form-detail-page';
13
+ export { default as InfoDetailPage } from './components/detail-pages/info-detail-page';
14
+ export { default as TabularDetailPage } from './components/detail-pages/tabular-detail-page';
12
15
  export { default as PublicPageLayout } from './components/public-page-layout';
13
16
  export { default as MaintenancePageLayout } from './components/maintenance-page-layout';
14
17
  export { default as PageNotFound } from './components/page-not-found';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/application-components",
3
- "version": "21.4.0",
3
+ "version": "21.6.0",
4
4
  "description": "Generic components for building Merchant Center applications",
5
5
  "bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
6
6
  "repository": {
@@ -29,11 +29,11 @@
29
29
  "dependencies": {
30
30
  "@babel/runtime": "^7.17.9",
31
31
  "@babel/runtime-corejs3": "^7.17.9",
32
- "@commercetools-frontend/application-shell-connectors": "21.3.4",
32
+ "@commercetools-frontend/application-shell-connectors": "21.6.0",
33
33
  "@commercetools-frontend/assets": "21.0.0",
34
34
  "@commercetools-frontend/constants": "21.3.4",
35
- "@commercetools-frontend/i18n": "21.4.0",
36
- "@commercetools-frontend/l10n": "21.3.4",
35
+ "@commercetools-frontend/i18n": "21.6.0",
36
+ "@commercetools-frontend/l10n": "21.6.0",
37
37
  "@commercetools-uikit/card": "^15.0.0",
38
38
  "@commercetools-uikit/constraints": "^15.0.0",
39
39
  "@commercetools-uikit/design-system": "^15.0.0",
@@ -49,6 +49,7 @@
49
49
  "@commercetools-uikit/utils": "^15.0.0",
50
50
  "@emotion/react": "11.9.0",
51
51
  "@emotion/styled": "11.8.1",
52
+ "@react-hook/latest": "1.0.3",
52
53
  "@react-hook/resize-observer": "1.2.5",
53
54
  "@types/history": "4.7.11",
54
55
  "@types/lodash": "^4.14.181",
@@ -59,13 +60,14 @@
59
60
  "history": "4.10.1",
60
61
  "lodash": "4.17.21",
61
62
  "prop-types": "15.8.1",
62
- "react-modal": "3.14.4"
63
+ "raf-schd": "^4.0.3",
64
+ "react-modal": "3.15.1"
63
65
  },
64
66
  "devDependencies": {
65
67
  "react": "17.0.2",
66
68
  "react-dom": "17.0.2",
67
69
  "react-intl": "^5.25.0",
68
- "react-router-dom": "5.3.0"
70
+ "react-router-dom": "5.3.1"
69
71
  },
70
72
  "peerDependencies": {
71
73
  "react": "17.x",