@backstage/plugin-user-settings 0.5.1 → 0.6.0-next.1

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
@@ -1,5 +1,36 @@
1
1
  # @backstage/plugin-user-settings
2
2
 
3
+ ## 0.6.0-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - c3fa90e184: Updated dependency `zen-observable` to `^0.10.0`.
8
+ - Updated dependencies
9
+ - @backstage/core-app-api@1.2.1-next.1
10
+ - @backstage/core-components@0.12.1-next.1
11
+ - @backstage/core-plugin-api@1.1.1-next.1
12
+ - @backstage/types@1.0.2-next.1
13
+ - @backstage/errors@1.1.4-next.1
14
+ - @backstage/theme@0.2.16
15
+
16
+ ## 0.6.0-next.0
17
+
18
+ ### Minor Changes
19
+
20
+ - 29bdda5442: Added the ability to fully customize settings page. Deprecated UserSettingsTab in favour of SettingsLayout.Route
21
+
22
+ ### Patch Changes
23
+
24
+ - 3280711113: Updated dependency `msw` to `^0.49.0`.
25
+ - 19356df560: Updated dependency `zen-observable` to `^0.9.0`.
26
+ - Updated dependencies
27
+ - @backstage/core-components@0.12.1-next.0
28
+ - @backstage/core-app-api@1.2.1-next.0
29
+ - @backstage/core-plugin-api@1.1.1-next.0
30
+ - @backstage/types@1.0.2-next.0
31
+ - @backstage/errors@1.1.4-next.0
32
+ - @backstage/theme@0.2.16
33
+
3
34
  ## 0.5.1
4
35
 
5
36
  ### Patch Changes
package/README.md CHANGED
@@ -16,7 +16,7 @@ for installation instructions.
16
16
 
17
17
  Add the item to the Sidebar:
18
18
 
19
- ```ts
19
+ ```tsx
20
20
  import { Settings as SidebarSettings } from '@backstage/plugin-user-settings';
21
21
 
22
22
  <SidebarPage>
@@ -28,7 +28,7 @@ import { Settings as SidebarSettings } from '@backstage/plugin-user-settings';
28
28
 
29
29
  Add the page to the App routing:
30
30
 
31
- ```ts
31
+ ```tsx
32
32
  import { UserSettingsPage } from '@backstage/plugin-user-settings';
33
33
 
34
34
  const AppRoutes = () => (
@@ -46,7 +46,7 @@ By default, the plugin provides a list of configured authentication providers fe
46
46
 
47
47
  If you want to supply your own custom list of Authentication Providers, use the `providerSettings` prop:
48
48
 
49
- ```ts
49
+ ```tsx
50
50
  const MyAuthProviders = () => (
51
51
  <ListItem>
52
52
  <ListItemText primary="example" />
@@ -71,20 +71,20 @@ const AppRoutes = () => (
71
71
  By default, the plugin renders 3 tabs of settings; GENERAL, AUTHENTICATION PROVIDERS, and FEATURE FLAGS.
72
72
 
73
73
  If you want to add more options for your users,
74
- just pass the extra tabs using `UserSettingsTab` components as children of the `UserSettingsPage` route.
74
+ just pass the extra tabs using `SettingsLayout.Route` components as children of the `UserSettingsPage` route.
75
75
  The path is in this case a child of the settings path,
76
76
  in the example below it would be `/settings/advanced` so that you can easily link to it.
77
77
 
78
78
  ```tsx
79
79
  import {
80
+ SettingsLayout,
80
81
  UserSettingsPage,
81
- UserSettingsTab,
82
82
  } from '@backstage/plugin-user-settings';
83
83
 
84
84
  <Route path="/settings" element={<UserSettingsPage />}>
85
- <UserSettingsTab path="/advanced" title="Advanced">
85
+ <SettingsLayout.Route path="/advanced" title="Advanced">
86
86
  <AdvancedSettings />
87
- </UserSettingsTab>
87
+ </SettingsLayout.Route>
88
88
  </Route>;
89
89
  ```
90
90
 
@@ -93,3 +93,40 @@ make sure you use a similar component structure as the other tabs.
93
93
  You can take a look at
94
94
  [the example extra tab](https://github.com/backstage/backstage/blob/master/packages/app/src/components/advancedSettings/AdvancedSettings.tsx)
95
95
  we have created in Backstage's demo app.
96
+
97
+ To change the layout altogether, create a custom page in `packages/app/src/components/user-settings/SettingsPage.tsx`:
98
+
99
+ ```tsx
100
+ import React from 'react';
101
+ import {
102
+ SettingsLayout,
103
+ UserSettingsGeneral,
104
+ } from '@backstage/plugin-user-settings';
105
+ import { AdvancedSettings } from './advancedSettings';
106
+
107
+ export const settingsPage = (
108
+ <SettingsLayout>
109
+ <SettingsLayout.Route path="general" title="General">
110
+ <UserSettingsGeneral />
111
+ </SettingsLayout.Route>
112
+ <SettingsLayout.Route path="advanced" title="Advanced">
113
+ <AdvancedSettings />
114
+ </SettingsLayout.Route>
115
+ </SettingsLayout>
116
+ );
117
+ ```
118
+
119
+ Now register the new settings page in `packages/app/src/App.tsx`:
120
+
121
+ ```diff
122
+ + import {settingsPage} from './components/settings/settingsPage';
123
+
124
+ const routes = (
125
+ <FlatRoutes>
126
+ - <Route path="/settings" element={<UserSettingsPage />} />
127
+ + <Route path="/settings" element={<UserSettingsPage />}>
128
+ + {settingsPage}
129
+ + </Route>
130
+ </FlatRoutes>
131
+ );
132
+ ```
@@ -0,0 +1,23 @@
1
+ export { Router as SettingsPage } from '../index.esm.js';
2
+ import '@backstage/core-app-api';
3
+ import '@backstage/errors';
4
+ import 'zen-observable';
5
+ import '@backstage/core-plugin-api';
6
+ import 'react';
7
+ import '@material-ui/icons/Settings';
8
+ import '@backstage/core-components';
9
+ import 'react-router';
10
+ import '@material-ui/core';
11
+ import '@material-ui/icons/Star';
12
+ import '@material-ui/icons/Clear';
13
+ import 'react-use/lib/useAsync';
14
+ import '@material-ui/icons/MeetingRoom';
15
+ import '@material-ui/icons/MoreVert';
16
+ import 'react-use/lib/useObservable';
17
+ import '@material-ui/icons/BrightnessAuto';
18
+ import '@material-ui/lab/ToggleButton';
19
+ import '@material-ui/lab/ToggleButtonGroup';
20
+ import '@material-ui/core/Chip';
21
+ import '@material-ui/core/Grid';
22
+ import '@material-ui/core/Typography';
23
+ //# sourceMappingURL=index-24ed3bf4.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-24ed3bf4.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -2,7 +2,8 @@
2
2
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
3
3
  import { StorageApi, FetchApi, DiscoveryApi, ErrorApi, IdentityApi, StorageValueSnapshot, IconComponent, ApiRef, ProfileInfoApi, SessionApi, ProfileInfo } from '@backstage/core-plugin-api';
4
4
  import { JsonValue, Observable } from '@backstage/types';
5
- import { PropsWithChildren } from 'react';
5
+ import React, { PropsWithChildren } from 'react';
6
+ import { TabProps } from '@material-ui/core';
6
7
 
7
8
  /**
8
9
  * An implementation of the storage API, that uses the user-settings backend to
@@ -52,9 +53,7 @@ declare const Settings: (props: {
52
53
  icon?: IconComponent;
53
54
  }) => JSX.Element;
54
55
 
55
- /**
56
- * @public
57
- */
56
+ /** @public */
58
57
  declare const SettingsPage: (props: {
59
58
  providerSettings?: JSX.Element;
60
59
  }) => JSX.Element;
@@ -119,9 +118,9 @@ declare const useUserProfile: () => {
119
118
  loading: false;
120
119
  };
121
120
 
122
- /** @public */
123
- declare const USER_SETTINGS_TAB_KEY = "user-settings.tab";
124
- /** @public */
121
+ /** @public @deprecated Use SettingsLayout.Route approach instead */
122
+ declare const USER_SETTINGS_TAB_KEY = "plugin.user-settings.settingsLayoutRoute";
123
+ /** @public @deprecated Use SettingsLayoutRouteProps instead */
125
124
  declare type UserSettingsTabProps = PropsWithChildren<{
126
125
  /**
127
126
  * The path to the tab in the settings route
@@ -135,7 +134,31 @@ declare type UserSettingsTabProps = PropsWithChildren<{
135
134
  * Renders a tab inside the settings page
136
135
  * @param props - Component props
137
136
  * @public
137
+ * @deprecated Use SettingsLayout.Route instead
138
138
  */
139
139
  declare const UserSettingsTab: (props: UserSettingsTabProps) => JSX.Element;
140
140
 
141
- export { DefaultProviderSettings, ProviderSettingsItem, SettingsPage as Router, Settings, USER_SETTINGS_TAB_KEY, UserSettingsAppearanceCard, UserSettingsAuthProviders, UserSettingsFeatureFlags, UserSettingsGeneral, UserSettingsIdentityCard, UserSettingsMenu, UserSettingsPage, UserSettingsPinToggle, UserSettingsProfileCard, UserSettingsSignInAvatar, UserSettingsStorage, UserSettingsTab, UserSettingsTabProps, UserSettingsThemeToggle, userSettingsPlugin as plugin, useUserProfile, userSettingsPlugin };
141
+ /** @public */
142
+ declare type SettingsLayoutRouteProps = {
143
+ path: string;
144
+ title: string;
145
+ children: JSX.Element;
146
+ tabProps?: TabProps<React.ElementType, {
147
+ component?: React.ElementType;
148
+ }>;
149
+ };
150
+ /** @public */
151
+ declare type SettingsLayoutProps = {
152
+ title?: string;
153
+ subtitle?: string;
154
+ children?: React.ReactNode;
155
+ };
156
+ /**
157
+ * @public
158
+ */
159
+ declare const SettingsLayout: {
160
+ (props: SettingsLayoutProps): JSX.Element;
161
+ Route: (props: SettingsLayoutRouteProps) => null;
162
+ };
163
+
164
+ export { DefaultProviderSettings, ProviderSettingsItem, SettingsPage as Router, Settings, SettingsLayout, SettingsLayoutProps, SettingsLayoutRouteProps, USER_SETTINGS_TAB_KEY, UserSettingsAppearanceCard, UserSettingsAuthProviders, UserSettingsFeatureFlags, UserSettingsGeneral, UserSettingsIdentityCard, UserSettingsMenu, UserSettingsPage, UserSettingsPinToggle, UserSettingsProfileCard, UserSettingsSignInAvatar, UserSettingsStorage, UserSettingsTab, UserSettingsTabProps, UserSettingsThemeToggle, userSettingsPlugin as plugin, useUserProfile, userSettingsPlugin };