@availity/mui-spaces 0.2.6 → 0.3.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/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.3.0](https://github.com/Availity/element/compare/@availity/mui-spaces@0.2.6...@availity/mui-spaces@0.3.0) (2024-07-19)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `@availity/mock` updated to version `0.2.6`
10
+ * `mui-list` updated to version `0.2.6`
11
+
12
+ ### Features
13
+
14
+ * **mui-spaces:** init commit for SpacesLink ([0c225ff](https://github.com/Availity/element/commit/0c225ff1e51061b63bc0237b1ecdb9e868d31d8c))
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **mui-spaces:** updateUrl additionalParams ([8043679](https://github.com/Availity/element/commit/8043679cdf33e0970765c1ae1587c2981bab76bb))
20
+
5
21
  ## [0.2.6](https://github.com/Availity/element/compare/@availity/mui-spaces@0.2.5...@availity/mui-spaces@0.2.6) (2024-07-01)
6
22
 
7
23
  ### Dependency Updates
package/dist/index.d.mts CHANGED
@@ -1,5 +1,122 @@
1
1
  import * as react from 'react';
2
+ import { ChipProps } from '@mui/material/Chip';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
4
 
5
+ type StatusChipProps = {
6
+ /** The color of the component.
7
+ * @default default */
8
+ color?: 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning';
9
+ } & Omit<ChipProps, 'avatar' | 'children' | 'color' | 'variant' | 'skipFocusWhenDisabled' | 'disabled' | 'size' | 'icon' | 'clickable' | 'deleteIcon' | 'onDelete'>;
10
+
11
+ type SpacesLinkVariants = 'card' | 'list' | 'default' | undefined;
12
+ type SpacesLinkWithSpace = {
13
+ /** If no spaceId is provided, the first space in the spaces array is used.
14
+ * Note: This is only to be used when the Spaces provider should only ever contain a single space.
15
+ */
16
+ spaceId?: string;
17
+ /** Use to directly pass a space to the component rather than have it fetched from the spaces API.
18
+ * This component does not have to be a child of SpacesProvider.
19
+ * Note: If you are wanting to take advantage of the sso links you will additionally need to pass the clientId in.
20
+ */
21
+ space: Space | SsoTypeSpace;
22
+ } & SpacesLinkProps;
23
+ type SpacesLinkWithSpaceId = {
24
+ /** If no spaceId is provided, the first space in the spaces array is used.
25
+ * Note: This is only to be used when the Spaces provider should only ever contain a single space.
26
+ */
27
+ spaceId: string;
28
+ /** Use to directly pass a space to the component rather than have it fetched from the spaces API.
29
+ * This component does not have to be a child of SpacesProvider.
30
+ * Note: If you are wanting to take advantage of the sso links you will additionally need to pass the clientId in.
31
+ */
32
+ space?: Space | SsoTypeSpace;
33
+ } & SpacesLinkProps;
34
+ type SpacesLinkProps = {
35
+ /** Children can be a react child or render prop. */
36
+ children?: JSX.Element | ((props: any | undefined) => JSX.Element);
37
+ /** Tag to overwrite the root component rendered. */
38
+ tag?: string;
39
+ /** Tag to overwrite the body component that renders the title, description and data values.
40
+ * It defaults to CardBody or div depending on the value of the variant prop.
41
+ */
42
+ bodyTag?: string;
43
+ /** Tag to overwrite the title component. If variant prop is set to "card", defaults to CardTitle.
44
+ * If variant is set to "list", defaults to ListItemHeading. Overwise, defaults to div.
45
+ */
46
+ titleTag?: string;
47
+ /** Tag to overwrite the text component. If variant prop is set to "card", defaults to Card Text.
48
+ * If variant is set to "list", defaults to ListItemText. Otherwise, defaults to div.
49
+ */
50
+ textTag?: string;
51
+ titleClassName?: string;
52
+ /** When true, utilizes the Card component for styling. */
53
+ card?: boolean;
54
+ /** When true, renders an @availity/mui-icon next to the title if present on the Space. */
55
+ icon?: boolean;
56
+ /** When true, renders the Spaces description beneath the title. */
57
+ description?: boolean;
58
+ /** When passed in, provides predefined styles for the component.
59
+ * @default 'default'
60
+ */
61
+ variant?: SpacesLinkVariants;
62
+ /** When true, renders the FavoriteHeart component to the left of the Component.
63
+ * Note, this does require you to have wrapped your component somewhere in the Favorites Provider.
64
+ * This also requires the peerDependency @tanstack/react-query.
65
+ */
66
+ favorite?: boolean;
67
+ /** When true, renders the tyitle, and allow for the description and date info to be added on.
68
+ * @default true
69
+ */
70
+ body?: boolean;
71
+ /** When true, renders the activeDate of the space. */
72
+ showDate?: boolean;
73
+ /** When true, renders the name of the space.
74
+ * @default true
75
+ */
76
+ showName?: boolean;
77
+ /** When true, renders a "New!" badge if the activeDate is less than 30 days old. */
78
+ showNew?: boolean;
79
+ /** When true, renders the component vertically. */
80
+ stacked?: boolean;
81
+ /** Optionally pass in your own landing state for the component if you are managing the state yourself. */
82
+ loading?: boolean;
83
+ /** Required when space is not provided, or space is provided and space contains an sso link. */
84
+ clientId?: string;
85
+ style?: object;
86
+ className?: string;
87
+ /** Allows the description length to be truncated. */
88
+ maxDescriptionWidth?: string;
89
+ /** Additional attributes you may want to tack onto the native-form when submitting a SAML sso.
90
+ * i.e. spaceId or sourceApplicationId
91
+ */
92
+ linkAttributes?: object;
93
+ /** Allows the role of the root component to be overwritten.
94
+ * If variant prop is set to "list", defaults to "listitem".
95
+ */
96
+ role?: string;
97
+ /** When Analytics props are passed inside the analytics props, they will be passed down to the click item.
98
+ * For more information on Analytics props see: Autotrack Logged Events
99
+ */
100
+ analytics?: object;
101
+ customBadgeText?: string;
102
+ customBadgeColor?: StatusChipProps['color'];
103
+ /** prefix for ids to prevent duplicates when the same config link is displayed on the page more than once
104
+ * @default ''
105
+ */
106
+ idPrefix?: string;
107
+ [key: string]: any;
108
+ };
109
+ interface SsoTypeSpace extends Space {
110
+ type: 'saml' | 'openid';
111
+ }
112
+
113
+ type Link = {
114
+ /** Contains a URL or URL Fragment that the hyperlink points to. */
115
+ url?: string;
116
+ /** Specifies where to open the linked URL. */
117
+ target?: string;
118
+ text?: string;
119
+ };
3
120
  type NameValuePair = {
4
121
  /** The key of the of the data. */
5
122
  name: string;
@@ -38,20 +155,19 @@ type Space = {
38
155
  mapping?: Record<string, string>;
39
156
  mappingPairs?: NameValuePair[];
40
157
  /** Whether or not the space is ghosted */
41
- isGhost?: boolean;
42
- link?: {
43
- /** Contains a URL or URL Fragment that the hyperlink points to. */
44
- url: string;
45
- /** Specifies where to open the linked URL. */
46
- target: string;
47
- };
158
+ isGhosted?: boolean;
159
+ link?: Link;
48
160
  /** The description of the configuration. */
49
161
  description?: string;
50
162
  url?: string;
163
+ parents?: Space[];
164
+ shortName?: string;
165
+ activeDate?: string;
166
+ isNew?: boolean;
51
167
  };
52
168
  type SpacesContextType = {
53
169
  /** Array of spaces to be passed into the Spaces provider. */
54
- spaces?: Map<string, Space>;
170
+ spaces?: Map<string, Space | SsoTypeSpace>;
55
171
  /** Array of spaces from previous page load. */
56
172
  previousSpacesMap?: Map<string, Space>;
57
173
  /** Array of spaces organized by configurationId. */
@@ -78,7 +194,7 @@ type SpacesProps = {
78
194
  /** The Client ID obtained from APIConnect. Must be subscribed to the thanos API. */
79
195
  clientId: string;
80
196
  /** Children can be a react child or render prop. */
81
- children?: React.ReactNode;
197
+ children?: React.ReactNode | ((props: any | undefined) => React.ReactNode);
82
198
  /** Array of payerIds the Spaces provider should fetch the spaces for.
83
199
  * Any payerIds already included in spaces will not be fetched again.
84
200
  * Note: If a payerId is associated with more than one payer space, the order in which they are returned should not be relied upon.
@@ -91,6 +207,7 @@ type SpacesProps = {
91
207
  * Useful for if you already have the spaces in your app and don't want the spaces provider to have to fetch them again. */
92
208
  spaces?: Space[];
93
209
  };
210
+ type UseSpaces = (...ids: string[]) => (Space | SsoTypeSpace)[] | undefined;
94
211
 
95
212
  declare const INITIAL_STATE: {
96
213
  loading: boolean;
@@ -98,6 +215,45 @@ declare const INITIAL_STATE: {
98
215
  declare const SpacesContext: react.Context<SpacesContextType>;
99
216
  declare const useSpacesContext: () => SpacesContextType;
100
217
  declare const Spaces: ({ query, variables, clientId, children, payerIds, spaceIds, spaces: spacesFromProps, }: SpacesProps) => JSX.Element;
101
- declare const useSpaces: (...ids: string[]) => Space[] | undefined;
218
+ declare const useSpaces: UseSpaces;
219
+
220
+ declare const SpacesLink: ({ spaceId, space: propSpace, className, children, favorite, icon, showName, showNew, showDate, stacked, body, description: showDescription, tag, bodyTag, titleTag, textTag, titleClassName, variant, loading: propsLoading, clientId: propsClientId, maxDescriptionWidth, style, linkAttributes, role, analytics, customBadgeText, customBadgeColor, idPrefix, ...rest }: SpacesLinkWithSpace | SpacesLinkWithSpaceId) => react_jsx_runtime.JSX.Element;
221
+
222
+ type SpacesAgreementProps = {
223
+ spaceId: string;
224
+ markdown?: boolean;
225
+ id?: string;
226
+ };
227
+ declare const SpacesAgreement: ({ spaceId, markdown, id: elementId }: SpacesAgreementProps) => react_jsx_runtime.JSX.Element | null;
228
+
229
+ type SpacesDisclaimerProps = {
230
+ accent?: boolean;
231
+ spaceId: string;
232
+ markdown?: boolean;
233
+ id?: string;
234
+ };
235
+ declare const SpacesDisclaimer: ({ accent, spaceId, markdown, id: elementId, ...props }: SpacesDisclaimerProps) => react_jsx_runtime.JSX.Element | null;
236
+
237
+ type SpacesGhostTextProps = {
238
+ spaceId: string;
239
+ id?: string;
240
+ } & React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
241
+ declare const SpacesGhostText: ({ spaceId, id, ...props }: SpacesGhostTextProps) => react_jsx_runtime.JSX.Element | null;
242
+
243
+ type BaseSpacesImageProps = {
244
+ imageType?: 'url' | 'images.logo' | 'images.tile' | 'images.billboard' | 'images.promotional' | 'images.promotionalHover';
245
+ fallback?: string;
246
+ id?: string;
247
+ };
248
+ type SpacesImageSpaceId = {
249
+ spaceId: string;
250
+ payerId?: string;
251
+ } & BaseSpacesImageProps;
252
+ type SpacesImagePayerId = {
253
+ spaceId?: string;
254
+ payerId: string;
255
+ } & BaseSpacesImageProps;
256
+ type SpacesImageProps = SpacesImageSpaceId | SpacesImagePayerId;
257
+ declare const SpacesImage: ({ spaceId, payerId, imageType, fallback, ...props }: SpacesImageProps) => react_jsx_runtime.JSX.Element | null;
102
258
 
103
- export { INITIAL_STATE, Spaces, SpacesContext, useSpaces, useSpacesContext };
259
+ export { INITIAL_STATE, type Space, Spaces, SpacesAgreement, type SpacesAgreementProps, SpacesContext, SpacesDisclaimer, type SpacesDisclaimerProps, SpacesGhostText, type SpacesGhostTextProps, SpacesImage, type SpacesImageProps, SpacesLink, useSpaces, useSpacesContext };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,122 @@
1
1
  import * as react from 'react';
2
+ import { ChipProps } from '@mui/material/Chip';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
4
 
5
+ type StatusChipProps = {
6
+ /** The color of the component.
7
+ * @default default */
8
+ color?: 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning';
9
+ } & Omit<ChipProps, 'avatar' | 'children' | 'color' | 'variant' | 'skipFocusWhenDisabled' | 'disabled' | 'size' | 'icon' | 'clickable' | 'deleteIcon' | 'onDelete'>;
10
+
11
+ type SpacesLinkVariants = 'card' | 'list' | 'default' | undefined;
12
+ type SpacesLinkWithSpace = {
13
+ /** If no spaceId is provided, the first space in the spaces array is used.
14
+ * Note: This is only to be used when the Spaces provider should only ever contain a single space.
15
+ */
16
+ spaceId?: string;
17
+ /** Use to directly pass a space to the component rather than have it fetched from the spaces API.
18
+ * This component does not have to be a child of SpacesProvider.
19
+ * Note: If you are wanting to take advantage of the sso links you will additionally need to pass the clientId in.
20
+ */
21
+ space: Space | SsoTypeSpace;
22
+ } & SpacesLinkProps;
23
+ type SpacesLinkWithSpaceId = {
24
+ /** If no spaceId is provided, the first space in the spaces array is used.
25
+ * Note: This is only to be used when the Spaces provider should only ever contain a single space.
26
+ */
27
+ spaceId: string;
28
+ /** Use to directly pass a space to the component rather than have it fetched from the spaces API.
29
+ * This component does not have to be a child of SpacesProvider.
30
+ * Note: If you are wanting to take advantage of the sso links you will additionally need to pass the clientId in.
31
+ */
32
+ space?: Space | SsoTypeSpace;
33
+ } & SpacesLinkProps;
34
+ type SpacesLinkProps = {
35
+ /** Children can be a react child or render prop. */
36
+ children?: JSX.Element | ((props: any | undefined) => JSX.Element);
37
+ /** Tag to overwrite the root component rendered. */
38
+ tag?: string;
39
+ /** Tag to overwrite the body component that renders the title, description and data values.
40
+ * It defaults to CardBody or div depending on the value of the variant prop.
41
+ */
42
+ bodyTag?: string;
43
+ /** Tag to overwrite the title component. If variant prop is set to "card", defaults to CardTitle.
44
+ * If variant is set to "list", defaults to ListItemHeading. Overwise, defaults to div.
45
+ */
46
+ titleTag?: string;
47
+ /** Tag to overwrite the text component. If variant prop is set to "card", defaults to Card Text.
48
+ * If variant is set to "list", defaults to ListItemText. Otherwise, defaults to div.
49
+ */
50
+ textTag?: string;
51
+ titleClassName?: string;
52
+ /** When true, utilizes the Card component for styling. */
53
+ card?: boolean;
54
+ /** When true, renders an @availity/mui-icon next to the title if present on the Space. */
55
+ icon?: boolean;
56
+ /** When true, renders the Spaces description beneath the title. */
57
+ description?: boolean;
58
+ /** When passed in, provides predefined styles for the component.
59
+ * @default 'default'
60
+ */
61
+ variant?: SpacesLinkVariants;
62
+ /** When true, renders the FavoriteHeart component to the left of the Component.
63
+ * Note, this does require you to have wrapped your component somewhere in the Favorites Provider.
64
+ * This also requires the peerDependency @tanstack/react-query.
65
+ */
66
+ favorite?: boolean;
67
+ /** When true, renders the tyitle, and allow for the description and date info to be added on.
68
+ * @default true
69
+ */
70
+ body?: boolean;
71
+ /** When true, renders the activeDate of the space. */
72
+ showDate?: boolean;
73
+ /** When true, renders the name of the space.
74
+ * @default true
75
+ */
76
+ showName?: boolean;
77
+ /** When true, renders a "New!" badge if the activeDate is less than 30 days old. */
78
+ showNew?: boolean;
79
+ /** When true, renders the component vertically. */
80
+ stacked?: boolean;
81
+ /** Optionally pass in your own landing state for the component if you are managing the state yourself. */
82
+ loading?: boolean;
83
+ /** Required when space is not provided, or space is provided and space contains an sso link. */
84
+ clientId?: string;
85
+ style?: object;
86
+ className?: string;
87
+ /** Allows the description length to be truncated. */
88
+ maxDescriptionWidth?: string;
89
+ /** Additional attributes you may want to tack onto the native-form when submitting a SAML sso.
90
+ * i.e. spaceId or sourceApplicationId
91
+ */
92
+ linkAttributes?: object;
93
+ /** Allows the role of the root component to be overwritten.
94
+ * If variant prop is set to "list", defaults to "listitem".
95
+ */
96
+ role?: string;
97
+ /** When Analytics props are passed inside the analytics props, they will be passed down to the click item.
98
+ * For more information on Analytics props see: Autotrack Logged Events
99
+ */
100
+ analytics?: object;
101
+ customBadgeText?: string;
102
+ customBadgeColor?: StatusChipProps['color'];
103
+ /** prefix for ids to prevent duplicates when the same config link is displayed on the page more than once
104
+ * @default ''
105
+ */
106
+ idPrefix?: string;
107
+ [key: string]: any;
108
+ };
109
+ interface SsoTypeSpace extends Space {
110
+ type: 'saml' | 'openid';
111
+ }
112
+
113
+ type Link = {
114
+ /** Contains a URL or URL Fragment that the hyperlink points to. */
115
+ url?: string;
116
+ /** Specifies where to open the linked URL. */
117
+ target?: string;
118
+ text?: string;
119
+ };
3
120
  type NameValuePair = {
4
121
  /** The key of the of the data. */
5
122
  name: string;
@@ -38,20 +155,19 @@ type Space = {
38
155
  mapping?: Record<string, string>;
39
156
  mappingPairs?: NameValuePair[];
40
157
  /** Whether or not the space is ghosted */
41
- isGhost?: boolean;
42
- link?: {
43
- /** Contains a URL or URL Fragment that the hyperlink points to. */
44
- url: string;
45
- /** Specifies where to open the linked URL. */
46
- target: string;
47
- };
158
+ isGhosted?: boolean;
159
+ link?: Link;
48
160
  /** The description of the configuration. */
49
161
  description?: string;
50
162
  url?: string;
163
+ parents?: Space[];
164
+ shortName?: string;
165
+ activeDate?: string;
166
+ isNew?: boolean;
51
167
  };
52
168
  type SpacesContextType = {
53
169
  /** Array of spaces to be passed into the Spaces provider. */
54
- spaces?: Map<string, Space>;
170
+ spaces?: Map<string, Space | SsoTypeSpace>;
55
171
  /** Array of spaces from previous page load. */
56
172
  previousSpacesMap?: Map<string, Space>;
57
173
  /** Array of spaces organized by configurationId. */
@@ -78,7 +194,7 @@ type SpacesProps = {
78
194
  /** The Client ID obtained from APIConnect. Must be subscribed to the thanos API. */
79
195
  clientId: string;
80
196
  /** Children can be a react child or render prop. */
81
- children?: React.ReactNode;
197
+ children?: React.ReactNode | ((props: any | undefined) => React.ReactNode);
82
198
  /** Array of payerIds the Spaces provider should fetch the spaces for.
83
199
  * Any payerIds already included in spaces will not be fetched again.
84
200
  * Note: If a payerId is associated with more than one payer space, the order in which they are returned should not be relied upon.
@@ -91,6 +207,7 @@ type SpacesProps = {
91
207
  * Useful for if you already have the spaces in your app and don't want the spaces provider to have to fetch them again. */
92
208
  spaces?: Space[];
93
209
  };
210
+ type UseSpaces = (...ids: string[]) => (Space | SsoTypeSpace)[] | undefined;
94
211
 
95
212
  declare const INITIAL_STATE: {
96
213
  loading: boolean;
@@ -98,6 +215,45 @@ declare const INITIAL_STATE: {
98
215
  declare const SpacesContext: react.Context<SpacesContextType>;
99
216
  declare const useSpacesContext: () => SpacesContextType;
100
217
  declare const Spaces: ({ query, variables, clientId, children, payerIds, spaceIds, spaces: spacesFromProps, }: SpacesProps) => JSX.Element;
101
- declare const useSpaces: (...ids: string[]) => Space[] | undefined;
218
+ declare const useSpaces: UseSpaces;
219
+
220
+ declare const SpacesLink: ({ spaceId, space: propSpace, className, children, favorite, icon, showName, showNew, showDate, stacked, body, description: showDescription, tag, bodyTag, titleTag, textTag, titleClassName, variant, loading: propsLoading, clientId: propsClientId, maxDescriptionWidth, style, linkAttributes, role, analytics, customBadgeText, customBadgeColor, idPrefix, ...rest }: SpacesLinkWithSpace | SpacesLinkWithSpaceId) => react_jsx_runtime.JSX.Element;
221
+
222
+ type SpacesAgreementProps = {
223
+ spaceId: string;
224
+ markdown?: boolean;
225
+ id?: string;
226
+ };
227
+ declare const SpacesAgreement: ({ spaceId, markdown, id: elementId }: SpacesAgreementProps) => react_jsx_runtime.JSX.Element | null;
228
+
229
+ type SpacesDisclaimerProps = {
230
+ accent?: boolean;
231
+ spaceId: string;
232
+ markdown?: boolean;
233
+ id?: string;
234
+ };
235
+ declare const SpacesDisclaimer: ({ accent, spaceId, markdown, id: elementId, ...props }: SpacesDisclaimerProps) => react_jsx_runtime.JSX.Element | null;
236
+
237
+ type SpacesGhostTextProps = {
238
+ spaceId: string;
239
+ id?: string;
240
+ } & React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
241
+ declare const SpacesGhostText: ({ spaceId, id, ...props }: SpacesGhostTextProps) => react_jsx_runtime.JSX.Element | null;
242
+
243
+ type BaseSpacesImageProps = {
244
+ imageType?: 'url' | 'images.logo' | 'images.tile' | 'images.billboard' | 'images.promotional' | 'images.promotionalHover';
245
+ fallback?: string;
246
+ id?: string;
247
+ };
248
+ type SpacesImageSpaceId = {
249
+ spaceId: string;
250
+ payerId?: string;
251
+ } & BaseSpacesImageProps;
252
+ type SpacesImagePayerId = {
253
+ spaceId?: string;
254
+ payerId: string;
255
+ } & BaseSpacesImageProps;
256
+ type SpacesImageProps = SpacesImageSpaceId | SpacesImagePayerId;
257
+ declare const SpacesImage: ({ spaceId, payerId, imageType, fallback, ...props }: SpacesImageProps) => react_jsx_runtime.JSX.Element | null;
102
258
 
103
- export { INITIAL_STATE, Spaces, SpacesContext, useSpaces, useSpacesContext };
259
+ export { INITIAL_STATE, type Space, Spaces, SpacesAgreement, type SpacesAgreementProps, SpacesContext, SpacesDisclaimer, type SpacesDisclaimerProps, SpacesGhostText, type SpacesGhostTextProps, SpacesImage, type SpacesImageProps, SpacesLink, useSpaces, useSpacesContext };