@wso2/oxygen-ui 0.13.1 → 0.15.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/.ai/components.md +235 -0
- package/.claude/components.md +235 -0
- package/dist/components/AppSwitcher/AppSwitcher.d.ts +93 -0
- package/dist/components/AppSwitcher/AppSwitcherApp.d.ts +132 -0
- package/dist/components/AppSwitcher/AppSwitcherFooter.d.ts +78 -0
- package/dist/components/AppSwitcher/AppSwitcherSection.d.ts +72 -0
- package/dist/components/AppSwitcher/AppSwitcherTrigger.d.ts +44 -0
- package/dist/components/AppSwitcher/brand.d.ts +49 -0
- package/dist/components/AppSwitcher/context.d.ts +53 -0
- package/dist/components/AppSwitcher/index.d.ts +29 -0
- package/dist/components/AppSwitcher/url.d.ts +24 -0
- package/dist/components/UserMenu/UserMenu.d.ts +1 -1
- package/dist/components/UserMenu/UserMenuLogout.d.ts +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/index.js +1182 -592
- package/dist/index.js.map +4 -4
- package/package.json +4 -4
package/.ai/components.md
CHANGED
|
@@ -12,6 +12,7 @@ Complete API reference for custom Oxygen UI components. For MUI components, refe
|
|
|
12
12
|
- [Sidebar](#sidebar)
|
|
13
13
|
- [Footer](#footer)
|
|
14
14
|
- [UserMenu](#usermenu)
|
|
15
|
+
- [AppSwitcher](#appswitcher)
|
|
15
16
|
- [Form](#form)
|
|
16
17
|
- [NotificationPanel](#notificationpanel)
|
|
17
18
|
- [NotificationBanner](#notificationbanner)
|
|
@@ -1021,6 +1022,240 @@ import { UserIcon, SettingsIcon, LogOutIcon } from '@wso2/oxygen-ui-icons-react'
|
|
|
1021
1022
|
</UserMenu>
|
|
1022
1023
|
```
|
|
1023
1024
|
|
|
1025
|
+
## AppSwitcher
|
|
1026
|
+
|
|
1027
|
+
Popover for navigating between WSO2 Cloud platforms.
|
|
1028
|
+
|
|
1029
|
+
```tsx
|
|
1030
|
+
import { AppSwitcher } from '@wso2/oxygen-ui';
|
|
1031
|
+
```
|
|
1032
|
+
|
|
1033
|
+
### Compound component
|
|
1034
|
+
|
|
1035
|
+
The switcher is composed from sub-components, matching `Header`, `Sidebar` and `UserMenu`:
|
|
1036
|
+
|
|
1037
|
+
- `AppSwitcher.Trigger` — the grid icon button; rendered in place, in the header
|
|
1038
|
+
- `AppSwitcher.Section` — a labelled grid of cards, owning its own arrow-key navigation
|
|
1039
|
+
- `AppSwitcher.App` — a single destination card
|
|
1040
|
+
- `AppSwitcher.Footer` — the `Manage` section; its cards take the `manage` tone automatically
|
|
1041
|
+
|
|
1042
|
+
The trigger renders where it sits; every other child goes inside the popover. A typical switcher
|
|
1043
|
+
has two sections: a grid of platform cards, and a `Manage` section linking to the WSO2 Cloud tabs
|
|
1044
|
+
(organizations, users, billing).
|
|
1045
|
+
|
|
1046
|
+
### AppSwitcher Props
|
|
1047
|
+
|
|
1048
|
+
| Prop | Type | Default | Description |
|
|
1049
|
+
|------|------|---------|-------------|
|
|
1050
|
+
| `children` | `ReactNode` | required | Trigger, sections and footer |
|
|
1051
|
+
| `width` | `number` | `460` | Popover width (px) from the `sm` breakpoint up |
|
|
1052
|
+
| `aria-label` | `string` | `'Applications'` | Accessible name for the popover surface |
|
|
1053
|
+
| `sx` | `SxProps<Theme>` | - | Additional styles applied to the popover |
|
|
1054
|
+
|
|
1055
|
+
### AppSwitcher.Trigger Props
|
|
1056
|
+
|
|
1057
|
+
| Prop | Type | Default | Description |
|
|
1058
|
+
|------|------|---------|-------------|
|
|
1059
|
+
| `label` | `string` | `'Switch Platforms'` | Tooltip and accessible label |
|
|
1060
|
+
| `icon` | `ReactNode` | `<Grip size={24} />` | Custom trigger icon |
|
|
1061
|
+
|
|
1062
|
+
Extra props, including `aria-*` attributes and `ref`, are forwarded to the underlying button.
|
|
1063
|
+
|
|
1064
|
+
### AppSwitcher.Section Props
|
|
1065
|
+
|
|
1066
|
+
| Prop | Type | Default | Description |
|
|
1067
|
+
|------|------|---------|-------------|
|
|
1068
|
+
| `children` | `ReactNode` | required | `AppSwitcher.App` cards |
|
|
1069
|
+
| `label` | `string` | - | Heading above the grid; also labels the list |
|
|
1070
|
+
| `columns` | `number` | `3` | Grid columns from the `sm` breakpoint up |
|
|
1071
|
+
|
|
1072
|
+
### AppSwitcher.App Props
|
|
1073
|
+
|
|
1074
|
+
| Field | Type | Default | Description |
|
|
1075
|
+
|-------|------|---------|-------------|
|
|
1076
|
+
| `name` | `string` | required | Platform name (e.g. "API Platform") |
|
|
1077
|
+
| `url` | `string` | - | Destination URL; renders the card as an anchor |
|
|
1078
|
+
| `icon` | `ReactNode` | WSO2 mark | Mark shown above the name |
|
|
1079
|
+
| `target` | `string` | `'_blank'` | Anchor target for a card with a `url`; such platforms open in a new tab by default |
|
|
1080
|
+
| `disabled` | `boolean` | `false` | Blocks navigation (e.g. a platform not yet available) |
|
|
1081
|
+
| `tooltip` | `ReactNode` | - | Tooltip on hover/focus, e.g. `"Coming soon"` on an unavailable platform |
|
|
1082
|
+
| `component` | `ElementType` | - | Custom root, e.g. a router `Link` |
|
|
1083
|
+
| `componentProps` | `Record<string, unknown>` | - | Extra props for `component` (e.g. React Router's `to`) |
|
|
1084
|
+
| `onClick` | `(event) => void` | - | Click handler; the popover stays open after it runs |
|
|
1085
|
+
| `tone` | `'platform' \| 'manage'` | `'manage'` in the footer, else `'platform'` | Visual treatment |
|
|
1086
|
+
|
|
1087
|
+
### AppSwitcher.Footer Props
|
|
1088
|
+
|
|
1089
|
+
| Field | Type | Default | Description |
|
|
1090
|
+
|-------|------|---------|-------------|
|
|
1091
|
+
| `children` | `ReactNode` | - | Manage cards; they take the `manage` tone automatically |
|
|
1092
|
+
| `links` | `AppSwitcherFooterLink[]` | - | Destinations as data, as an alternative to `children` |
|
|
1093
|
+
| `label` | `string` | `'Manage'` | Heading above the links |
|
|
1094
|
+
| `columns` | `number` | `3` | Grid columns from the `sm` breakpoint up |
|
|
1095
|
+
|
|
1096
|
+
The footer renders nothing when it has neither children nor links.
|
|
1097
|
+
|
|
1098
|
+
### AppSwitcherFooterLink Type
|
|
1099
|
+
|
|
1100
|
+
| Field | Type | Default | Description |
|
|
1101
|
+
|-------|------|---------|-------------|
|
|
1102
|
+
| `key` | `string` | required | Stable identifier, used as the React key |
|
|
1103
|
+
| `name` | `string` | required | Link name (e.g. "Users & roles") |
|
|
1104
|
+
| `url` | `string` | - | Destination URL; renders the card as an anchor |
|
|
1105
|
+
| `icon` | `ReactNode` | WSO2 mark | Mark shown above the name |
|
|
1106
|
+
| `target` | `string` | `'_blank'` | Anchor target |
|
|
1107
|
+
| `disabled` | `boolean` | `false` | Blocks navigation |
|
|
1108
|
+
| `tooltip` | `ReactNode` | - | Tooltip on hover/focus |
|
|
1109
|
+
| `component` | `ElementType` | - | Custom root, e.g. a router `Link` |
|
|
1110
|
+
| `componentProps` | `Record<string, unknown>` | - | Extra props for `component` |
|
|
1111
|
+
| `onClick` | `(event) => void` | - | Click handler; the popover stays open after it runs |
|
|
1112
|
+
|
|
1113
|
+
### Usage
|
|
1114
|
+
|
|
1115
|
+
```tsx
|
|
1116
|
+
import { AppSwitcher, Header } from '@wso2/oxygen-ui';
|
|
1117
|
+
import { Building2, CreditCard, UserRoundPlus } from '@wso2/oxygen-ui-icons-react';
|
|
1118
|
+
|
|
1119
|
+
<Header.Actions>
|
|
1120
|
+
<AppSwitcher>
|
|
1121
|
+
<AppSwitcher.Trigger />
|
|
1122
|
+
<AppSwitcher.Section label="Platforms">
|
|
1123
|
+
<AppSwitcher.App name="Agent Manager" url="https://agent.wso2.com" />
|
|
1124
|
+
<AppSwitcher.App name="Identity Platform" url="https://identity.wso2.com" />
|
|
1125
|
+
<AppSwitcher.App name="API Platform" url="https://api.wso2.com" />
|
|
1126
|
+
<AppSwitcher.App name="Analytics Platform" disabled tooltip="Coming soon" />
|
|
1127
|
+
</AppSwitcher.Section>
|
|
1128
|
+
<AppSwitcher.Footer label="Manage">
|
|
1129
|
+
<AppSwitcher.App name="Organizations" url="https://console.wso2.com/organizations"
|
|
1130
|
+
icon={<Building2 size={18} />} />
|
|
1131
|
+
<AppSwitcher.App name="Users & roles" url="https://console.wso2.com/users"
|
|
1132
|
+
icon={<UserRoundPlus size={18} />} />
|
|
1133
|
+
<AppSwitcher.App name="Billing" url="https://console.wso2.com/billing"
|
|
1134
|
+
icon={<CreditCard size={18} />} />
|
|
1135
|
+
</AppSwitcher.Footer>
|
|
1136
|
+
</AppSwitcher>
|
|
1137
|
+
</Header.Actions>
|
|
1138
|
+
```
|
|
1139
|
+
|
|
1140
|
+
### The platform mark
|
|
1141
|
+
|
|
1142
|
+
Every platform card carries the WSO2 mark, the `WSO2` icon from `@wso2/oxygen-ui-icons-react`,
|
|
1143
|
+
supplied by the component. Products do not pick their own artwork, so the grid stays uniform
|
|
1144
|
+
across the cloud. Pass `icon` only when a destination genuinely needs different artwork — the
|
|
1145
|
+
manage links do, which is why they take neutral glyphs.
|
|
1146
|
+
|
|
1147
|
+
### Card states
|
|
1148
|
+
|
|
1149
|
+
A card is a name under a mark. Every card in a section is a fixed,
|
|
1150
|
+
identical size, so a name that wraps to two lines does not make its card taller than its
|
|
1151
|
+
neighbours; a name longer than two lines is clamped rather than spilling past the border.
|
|
1152
|
+
|
|
1153
|
+
- **Navigable** — resting card on the paper surface with a divider border. On hover it lifts
|
|
1154
|
+
2px, gains an accent border and `shadows[2]`. The lift is suppressed under
|
|
1155
|
+
`prefers-reduced-motion`; the border and shadow still carry the state.
|
|
1156
|
+
- **Unavailable** (`disabled`) — the same solid border as any other card, with an
|
|
1157
|
+
`action.hover` background, a faded mark and a muted label.
|
|
1158
|
+
The card never navigates, but stays focusable so it remains discoverable. Pass `tooltip` to
|
|
1159
|
+
explain why, e.g. `tooltip="Coming soon"`. Because unavailable cards carry `aria-disabled`
|
|
1160
|
+
rather than the native `disabled` attribute, they still receive pointer events, so the
|
|
1161
|
+
tooltip fires; a natively disabled button would swallow it. The tooltip *describes* the card
|
|
1162
|
+
rather than renaming it, so the platform name stays its accessible name.
|
|
1163
|
+
|
|
1164
|
+
### Dismissing the popover
|
|
1165
|
+
|
|
1166
|
+
Selecting a card does **not** close the popover. An enabled `url` card opens in a new tab, so the current tab
|
|
1167
|
+
does not navigate and dismissing would look like the switcher had closed itself for no reason.
|
|
1168
|
+
This matches other app-grid switchers. The popover closes on:
|
|
1169
|
+
|
|
1170
|
+
- a second click of the grid trigger,
|
|
1171
|
+
- a click outside it,
|
|
1172
|
+
- `Esc`.
|
|
1173
|
+
|
|
1174
|
+
### Routing
|
|
1175
|
+
|
|
1176
|
+
`AppSwitcher` does not depend on a router. Choose the pattern that matches the destination:
|
|
1177
|
+
|
|
1178
|
+
**Cross-app navigation (different origin/deployment)** — use `url`. The card renders as a real
|
|
1179
|
+
anchor, so middle-click and "open in new tab" work. Cards target `_blank` by default, since each
|
|
1180
|
+
platform is its own deployment; pass `target: '_self'` to navigate in place.
|
|
1181
|
+
|
|
1182
|
+
```tsx
|
|
1183
|
+
<AppSwitcher.App name="API Platform" url="https://api.wso2.com" />
|
|
1184
|
+
<AppSwitcher.App name="Agent Manager" url="/agent" target="_self" />
|
|
1185
|
+
```
|
|
1186
|
+
|
|
1187
|
+
**In-app navigation (same SPA)** — pass a router `Link` via `component`, and give it the
|
|
1188
|
+
router's own navigation prop through `componentProps`. React Router's `Link` takes `to`,
|
|
1189
|
+
not `href`, so `url` alone would not navigate.
|
|
1190
|
+
|
|
1191
|
+
```tsx
|
|
1192
|
+
import { Link } from 'react-router';
|
|
1193
|
+
|
|
1194
|
+
<AppSwitcher.App
|
|
1195
|
+
name="Integration Platform"
|
|
1196
|
+
component={Link}
|
|
1197
|
+
componentProps={{ to: '/integration' }}
|
|
1198
|
+
/>
|
|
1199
|
+
```
|
|
1200
|
+
|
|
1201
|
+
`componentProps` works the same way on the manage links:
|
|
1202
|
+
|
|
1203
|
+
```tsx
|
|
1204
|
+
<AppSwitcher.Footer>
|
|
1205
|
+
<AppSwitcher.App name="Billing" component={Link} componentProps={{ to: '/billing' }} />
|
|
1206
|
+
</AppSwitcher.Footer>
|
|
1207
|
+
```
|
|
1208
|
+
|
|
1209
|
+
**Programmatic navigation** — use `onClick`. The popover stays open after the handler runs,
|
|
1210
|
+
so a handler that navigates in the current tab should dismiss it itself if needed.
|
|
1211
|
+
|
|
1212
|
+
```tsx
|
|
1213
|
+
import { useNavigate } from 'react-router';
|
|
1214
|
+
|
|
1215
|
+
const navigate = useNavigate();
|
|
1216
|
+
|
|
1217
|
+
<AppSwitcher.App name="Agent Manager" onClick={() => navigate('/agent')} />
|
|
1218
|
+
```
|
|
1219
|
+
|
|
1220
|
+
Precedence: `component` wins over `url`; `disabled` blocks all navigation regardless.
|
|
1221
|
+
|
|
1222
|
+
A `_blank` target always keeps `rel="noopener noreferrer"`; `componentProps` cannot
|
|
1223
|
+
override it.
|
|
1224
|
+
|
|
1225
|
+
### Brand color
|
|
1226
|
+
|
|
1227
|
+
The switcher is WSO2 Cloud chrome, so it uses the brand orange (`#FF7300`) even in a product
|
|
1228
|
+
running a different palette: the WSO2 mark, the hover border and the focus ring are all brand
|
|
1229
|
+
orange rather than `palette.primary`. There is no variant to opt out of this.
|
|
1230
|
+
|
|
1231
|
+
**Contrast:** `#FF7300` is 2.73:1 on white. It is used only for the mark and the hover border —
|
|
1232
|
+
never for text, so the switcher has no brand-colored text to fail WCAG AA. The focus ring is
|
|
1233
|
+
author-defined, which WCAG 2.1 SC 1.4.11 holds to 3:1, so it uses a darker brand token
|
|
1234
|
+
(`#E56800`, 3.33:1 on the light card and 5.63:1 on the dark one) rather than `main`. The 2.73:1
|
|
1235
|
+
mark and hover border still fall under 3:1; that is a property of the brand palette rather than
|
|
1236
|
+
of this component (the standard card border, `#E0E0E0`, is 1.32:1), and is tracked in
|
|
1237
|
+
https://github.com/wso2/oxygen-ui/issues/558.
|
|
1238
|
+
|
|
1239
|
+
### Keyboard & Accessibility
|
|
1240
|
+
|
|
1241
|
+
| Key | Behavior |
|
|
1242
|
+
| --- | --- |
|
|
1243
|
+
| `Tab` | Moves into and through the cards |
|
|
1244
|
+
| `←` / `→` | Moves to the previous/next card |
|
|
1245
|
+
| `↑` / `↓` | Moves one grid row at a time (a single step in the mobile single-column layout) |
|
|
1246
|
+
| `Home` / `End` | Moves to the first/last card in the section |
|
|
1247
|
+
| `Esc` | Closes the popover and returns focus to the trigger |
|
|
1248
|
+
|
|
1249
|
+
Arrow keys clamp at the ends of a grid rather than wrapping, so a step off the last row does
|
|
1250
|
+
not jump somewhere unrelated. Each section is its own grid, so arrow keys do not cross from
|
|
1251
|
+
the platforms into the manage links.
|
|
1252
|
+
|
|
1253
|
+
- The trigger exposes `aria-haspopup`, `aria-expanded`, and `aria-controls`.
|
|
1254
|
+
- Platforms and manage links are each grouped in a list labelled by their section heading, so
|
|
1255
|
+
the count is announced.
|
|
1256
|
+
- Unavailable platforms are marked `aria-disabled` and stay focusable so they remain
|
|
1257
|
+
discoverable, but do not navigate or close the popover.
|
|
1258
|
+
|
|
1024
1259
|
### PageTitle
|
|
1025
1260
|
|
|
1026
1261
|
Page header with avatar and breadcrumb support.
|
package/.claude/components.md
CHANGED
|
@@ -12,6 +12,7 @@ Complete API reference for custom Oxygen UI components. For MUI components, refe
|
|
|
12
12
|
- [Sidebar](#sidebar)
|
|
13
13
|
- [Footer](#footer)
|
|
14
14
|
- [UserMenu](#usermenu)
|
|
15
|
+
- [AppSwitcher](#appswitcher)
|
|
15
16
|
- [Form](#form)
|
|
16
17
|
- [NotificationPanel](#notificationpanel)
|
|
17
18
|
- [NotificationBanner](#notificationbanner)
|
|
@@ -1021,6 +1022,240 @@ import { UserIcon, SettingsIcon, LogOutIcon } from '@wso2/oxygen-ui-icons-react'
|
|
|
1021
1022
|
</UserMenu>
|
|
1022
1023
|
```
|
|
1023
1024
|
|
|
1025
|
+
## AppSwitcher
|
|
1026
|
+
|
|
1027
|
+
Popover for navigating between WSO2 Cloud platforms.
|
|
1028
|
+
|
|
1029
|
+
```tsx
|
|
1030
|
+
import { AppSwitcher } from '@wso2/oxygen-ui';
|
|
1031
|
+
```
|
|
1032
|
+
|
|
1033
|
+
### Compound component
|
|
1034
|
+
|
|
1035
|
+
The switcher is composed from sub-components, matching `Header`, `Sidebar` and `UserMenu`:
|
|
1036
|
+
|
|
1037
|
+
- `AppSwitcher.Trigger` — the grid icon button; rendered in place, in the header
|
|
1038
|
+
- `AppSwitcher.Section` — a labelled grid of cards, owning its own arrow-key navigation
|
|
1039
|
+
- `AppSwitcher.App` — a single destination card
|
|
1040
|
+
- `AppSwitcher.Footer` — the `Manage` section; its cards take the `manage` tone automatically
|
|
1041
|
+
|
|
1042
|
+
The trigger renders where it sits; every other child goes inside the popover. A typical switcher
|
|
1043
|
+
has two sections: a grid of platform cards, and a `Manage` section linking to the WSO2 Cloud tabs
|
|
1044
|
+
(organizations, users, billing).
|
|
1045
|
+
|
|
1046
|
+
### AppSwitcher Props
|
|
1047
|
+
|
|
1048
|
+
| Prop | Type | Default | Description |
|
|
1049
|
+
|------|------|---------|-------------|
|
|
1050
|
+
| `children` | `ReactNode` | required | Trigger, sections and footer |
|
|
1051
|
+
| `width` | `number` | `460` | Popover width (px) from the `sm` breakpoint up |
|
|
1052
|
+
| `aria-label` | `string` | `'Applications'` | Accessible name for the popover surface |
|
|
1053
|
+
| `sx` | `SxProps<Theme>` | - | Additional styles applied to the popover |
|
|
1054
|
+
|
|
1055
|
+
### AppSwitcher.Trigger Props
|
|
1056
|
+
|
|
1057
|
+
| Prop | Type | Default | Description |
|
|
1058
|
+
|------|------|---------|-------------|
|
|
1059
|
+
| `label` | `string` | `'Switch Platforms'` | Tooltip and accessible label |
|
|
1060
|
+
| `icon` | `ReactNode` | `<Grip size={24} />` | Custom trigger icon |
|
|
1061
|
+
|
|
1062
|
+
Extra props, including `aria-*` attributes and `ref`, are forwarded to the underlying button.
|
|
1063
|
+
|
|
1064
|
+
### AppSwitcher.Section Props
|
|
1065
|
+
|
|
1066
|
+
| Prop | Type | Default | Description |
|
|
1067
|
+
|------|------|---------|-------------|
|
|
1068
|
+
| `children` | `ReactNode` | required | `AppSwitcher.App` cards |
|
|
1069
|
+
| `label` | `string` | - | Heading above the grid; also labels the list |
|
|
1070
|
+
| `columns` | `number` | `3` | Grid columns from the `sm` breakpoint up |
|
|
1071
|
+
|
|
1072
|
+
### AppSwitcher.App Props
|
|
1073
|
+
|
|
1074
|
+
| Field | Type | Default | Description |
|
|
1075
|
+
|-------|------|---------|-------------|
|
|
1076
|
+
| `name` | `string` | required | Platform name (e.g. "API Platform") |
|
|
1077
|
+
| `url` | `string` | - | Destination URL; renders the card as an anchor |
|
|
1078
|
+
| `icon` | `ReactNode` | WSO2 mark | Mark shown above the name |
|
|
1079
|
+
| `target` | `string` | `'_blank'` | Anchor target for a card with a `url`; such platforms open in a new tab by default |
|
|
1080
|
+
| `disabled` | `boolean` | `false` | Blocks navigation (e.g. a platform not yet available) |
|
|
1081
|
+
| `tooltip` | `ReactNode` | - | Tooltip on hover/focus, e.g. `"Coming soon"` on an unavailable platform |
|
|
1082
|
+
| `component` | `ElementType` | - | Custom root, e.g. a router `Link` |
|
|
1083
|
+
| `componentProps` | `Record<string, unknown>` | - | Extra props for `component` (e.g. React Router's `to`) |
|
|
1084
|
+
| `onClick` | `(event) => void` | - | Click handler; the popover stays open after it runs |
|
|
1085
|
+
| `tone` | `'platform' \| 'manage'` | `'manage'` in the footer, else `'platform'` | Visual treatment |
|
|
1086
|
+
|
|
1087
|
+
### AppSwitcher.Footer Props
|
|
1088
|
+
|
|
1089
|
+
| Field | Type | Default | Description |
|
|
1090
|
+
|-------|------|---------|-------------|
|
|
1091
|
+
| `children` | `ReactNode` | - | Manage cards; they take the `manage` tone automatically |
|
|
1092
|
+
| `links` | `AppSwitcherFooterLink[]` | - | Destinations as data, as an alternative to `children` |
|
|
1093
|
+
| `label` | `string` | `'Manage'` | Heading above the links |
|
|
1094
|
+
| `columns` | `number` | `3` | Grid columns from the `sm` breakpoint up |
|
|
1095
|
+
|
|
1096
|
+
The footer renders nothing when it has neither children nor links.
|
|
1097
|
+
|
|
1098
|
+
### AppSwitcherFooterLink Type
|
|
1099
|
+
|
|
1100
|
+
| Field | Type | Default | Description |
|
|
1101
|
+
|-------|------|---------|-------------|
|
|
1102
|
+
| `key` | `string` | required | Stable identifier, used as the React key |
|
|
1103
|
+
| `name` | `string` | required | Link name (e.g. "Users & roles") |
|
|
1104
|
+
| `url` | `string` | - | Destination URL; renders the card as an anchor |
|
|
1105
|
+
| `icon` | `ReactNode` | WSO2 mark | Mark shown above the name |
|
|
1106
|
+
| `target` | `string` | `'_blank'` | Anchor target |
|
|
1107
|
+
| `disabled` | `boolean` | `false` | Blocks navigation |
|
|
1108
|
+
| `tooltip` | `ReactNode` | - | Tooltip on hover/focus |
|
|
1109
|
+
| `component` | `ElementType` | - | Custom root, e.g. a router `Link` |
|
|
1110
|
+
| `componentProps` | `Record<string, unknown>` | - | Extra props for `component` |
|
|
1111
|
+
| `onClick` | `(event) => void` | - | Click handler; the popover stays open after it runs |
|
|
1112
|
+
|
|
1113
|
+
### Usage
|
|
1114
|
+
|
|
1115
|
+
```tsx
|
|
1116
|
+
import { AppSwitcher, Header } from '@wso2/oxygen-ui';
|
|
1117
|
+
import { Building2, CreditCard, UserRoundPlus } from '@wso2/oxygen-ui-icons-react';
|
|
1118
|
+
|
|
1119
|
+
<Header.Actions>
|
|
1120
|
+
<AppSwitcher>
|
|
1121
|
+
<AppSwitcher.Trigger />
|
|
1122
|
+
<AppSwitcher.Section label="Platforms">
|
|
1123
|
+
<AppSwitcher.App name="Agent Manager" url="https://agent.wso2.com" />
|
|
1124
|
+
<AppSwitcher.App name="Identity Platform" url="https://identity.wso2.com" />
|
|
1125
|
+
<AppSwitcher.App name="API Platform" url="https://api.wso2.com" />
|
|
1126
|
+
<AppSwitcher.App name="Analytics Platform" disabled tooltip="Coming soon" />
|
|
1127
|
+
</AppSwitcher.Section>
|
|
1128
|
+
<AppSwitcher.Footer label="Manage">
|
|
1129
|
+
<AppSwitcher.App name="Organizations" url="https://console.wso2.com/organizations"
|
|
1130
|
+
icon={<Building2 size={18} />} />
|
|
1131
|
+
<AppSwitcher.App name="Users & roles" url="https://console.wso2.com/users"
|
|
1132
|
+
icon={<UserRoundPlus size={18} />} />
|
|
1133
|
+
<AppSwitcher.App name="Billing" url="https://console.wso2.com/billing"
|
|
1134
|
+
icon={<CreditCard size={18} />} />
|
|
1135
|
+
</AppSwitcher.Footer>
|
|
1136
|
+
</AppSwitcher>
|
|
1137
|
+
</Header.Actions>
|
|
1138
|
+
```
|
|
1139
|
+
|
|
1140
|
+
### The platform mark
|
|
1141
|
+
|
|
1142
|
+
Every platform card carries the WSO2 mark, the `WSO2` icon from `@wso2/oxygen-ui-icons-react`,
|
|
1143
|
+
supplied by the component. Products do not pick their own artwork, so the grid stays uniform
|
|
1144
|
+
across the cloud. Pass `icon` only when a destination genuinely needs different artwork — the
|
|
1145
|
+
manage links do, which is why they take neutral glyphs.
|
|
1146
|
+
|
|
1147
|
+
### Card states
|
|
1148
|
+
|
|
1149
|
+
A card is a name under a mark. Every card in a section is a fixed,
|
|
1150
|
+
identical size, so a name that wraps to two lines does not make its card taller than its
|
|
1151
|
+
neighbours; a name longer than two lines is clamped rather than spilling past the border.
|
|
1152
|
+
|
|
1153
|
+
- **Navigable** — resting card on the paper surface with a divider border. On hover it lifts
|
|
1154
|
+
2px, gains an accent border and `shadows[2]`. The lift is suppressed under
|
|
1155
|
+
`prefers-reduced-motion`; the border and shadow still carry the state.
|
|
1156
|
+
- **Unavailable** (`disabled`) — the same solid border as any other card, with an
|
|
1157
|
+
`action.hover` background, a faded mark and a muted label.
|
|
1158
|
+
The card never navigates, but stays focusable so it remains discoverable. Pass `tooltip` to
|
|
1159
|
+
explain why, e.g. `tooltip="Coming soon"`. Because unavailable cards carry `aria-disabled`
|
|
1160
|
+
rather than the native `disabled` attribute, they still receive pointer events, so the
|
|
1161
|
+
tooltip fires; a natively disabled button would swallow it. The tooltip *describes* the card
|
|
1162
|
+
rather than renaming it, so the platform name stays its accessible name.
|
|
1163
|
+
|
|
1164
|
+
### Dismissing the popover
|
|
1165
|
+
|
|
1166
|
+
Selecting a card does **not** close the popover. An enabled `url` card opens in a new tab, so the current tab
|
|
1167
|
+
does not navigate and dismissing would look like the switcher had closed itself for no reason.
|
|
1168
|
+
This matches other app-grid switchers. The popover closes on:
|
|
1169
|
+
|
|
1170
|
+
- a second click of the grid trigger,
|
|
1171
|
+
- a click outside it,
|
|
1172
|
+
- `Esc`.
|
|
1173
|
+
|
|
1174
|
+
### Routing
|
|
1175
|
+
|
|
1176
|
+
`AppSwitcher` does not depend on a router. Choose the pattern that matches the destination:
|
|
1177
|
+
|
|
1178
|
+
**Cross-app navigation (different origin/deployment)** — use `url`. The card renders as a real
|
|
1179
|
+
anchor, so middle-click and "open in new tab" work. Cards target `_blank` by default, since each
|
|
1180
|
+
platform is its own deployment; pass `target: '_self'` to navigate in place.
|
|
1181
|
+
|
|
1182
|
+
```tsx
|
|
1183
|
+
<AppSwitcher.App name="API Platform" url="https://api.wso2.com" />
|
|
1184
|
+
<AppSwitcher.App name="Agent Manager" url="/agent" target="_self" />
|
|
1185
|
+
```
|
|
1186
|
+
|
|
1187
|
+
**In-app navigation (same SPA)** — pass a router `Link` via `component`, and give it the
|
|
1188
|
+
router's own navigation prop through `componentProps`. React Router's `Link` takes `to`,
|
|
1189
|
+
not `href`, so `url` alone would not navigate.
|
|
1190
|
+
|
|
1191
|
+
```tsx
|
|
1192
|
+
import { Link } from 'react-router';
|
|
1193
|
+
|
|
1194
|
+
<AppSwitcher.App
|
|
1195
|
+
name="Integration Platform"
|
|
1196
|
+
component={Link}
|
|
1197
|
+
componentProps={{ to: '/integration' }}
|
|
1198
|
+
/>
|
|
1199
|
+
```
|
|
1200
|
+
|
|
1201
|
+
`componentProps` works the same way on the manage links:
|
|
1202
|
+
|
|
1203
|
+
```tsx
|
|
1204
|
+
<AppSwitcher.Footer>
|
|
1205
|
+
<AppSwitcher.App name="Billing" component={Link} componentProps={{ to: '/billing' }} />
|
|
1206
|
+
</AppSwitcher.Footer>
|
|
1207
|
+
```
|
|
1208
|
+
|
|
1209
|
+
**Programmatic navigation** — use `onClick`. The popover stays open after the handler runs,
|
|
1210
|
+
so a handler that navigates in the current tab should dismiss it itself if needed.
|
|
1211
|
+
|
|
1212
|
+
```tsx
|
|
1213
|
+
import { useNavigate } from 'react-router';
|
|
1214
|
+
|
|
1215
|
+
const navigate = useNavigate();
|
|
1216
|
+
|
|
1217
|
+
<AppSwitcher.App name="Agent Manager" onClick={() => navigate('/agent')} />
|
|
1218
|
+
```
|
|
1219
|
+
|
|
1220
|
+
Precedence: `component` wins over `url`; `disabled` blocks all navigation regardless.
|
|
1221
|
+
|
|
1222
|
+
A `_blank` target always keeps `rel="noopener noreferrer"`; `componentProps` cannot
|
|
1223
|
+
override it.
|
|
1224
|
+
|
|
1225
|
+
### Brand color
|
|
1226
|
+
|
|
1227
|
+
The switcher is WSO2 Cloud chrome, so it uses the brand orange (`#FF7300`) even in a product
|
|
1228
|
+
running a different palette: the WSO2 mark, the hover border and the focus ring are all brand
|
|
1229
|
+
orange rather than `palette.primary`. There is no variant to opt out of this.
|
|
1230
|
+
|
|
1231
|
+
**Contrast:** `#FF7300` is 2.73:1 on white. It is used only for the mark and the hover border —
|
|
1232
|
+
never for text, so the switcher has no brand-colored text to fail WCAG AA. The focus ring is
|
|
1233
|
+
author-defined, which WCAG 2.1 SC 1.4.11 holds to 3:1, so it uses a darker brand token
|
|
1234
|
+
(`#E56800`, 3.33:1 on the light card and 5.63:1 on the dark one) rather than `main`. The 2.73:1
|
|
1235
|
+
mark and hover border still fall under 3:1; that is a property of the brand palette rather than
|
|
1236
|
+
of this component (the standard card border, `#E0E0E0`, is 1.32:1), and is tracked in
|
|
1237
|
+
https://github.com/wso2/oxygen-ui/issues/558.
|
|
1238
|
+
|
|
1239
|
+
### Keyboard & Accessibility
|
|
1240
|
+
|
|
1241
|
+
| Key | Behavior |
|
|
1242
|
+
| --- | --- |
|
|
1243
|
+
| `Tab` | Moves into and through the cards |
|
|
1244
|
+
| `←` / `→` | Moves to the previous/next card |
|
|
1245
|
+
| `↑` / `↓` | Moves one grid row at a time (a single step in the mobile single-column layout) |
|
|
1246
|
+
| `Home` / `End` | Moves to the first/last card in the section |
|
|
1247
|
+
| `Esc` | Closes the popover and returns focus to the trigger |
|
|
1248
|
+
|
|
1249
|
+
Arrow keys clamp at the ends of a grid rather than wrapping, so a step off the last row does
|
|
1250
|
+
not jump somewhere unrelated. Each section is its own grid, so arrow keys do not cross from
|
|
1251
|
+
the platforms into the manage links.
|
|
1252
|
+
|
|
1253
|
+
- The trigger exposes `aria-haspopup`, `aria-expanded`, and `aria-controls`.
|
|
1254
|
+
- Platforms and manage links are each grouped in a list labelled by their section heading, so
|
|
1255
|
+
the count is announced.
|
|
1256
|
+
- Unavailable platforms are marked `aria-disabled` and stay focusable so they remain
|
|
1257
|
+
discoverable, but do not navigate or close the popover.
|
|
1258
|
+
|
|
1024
1259
|
### PageTitle
|
|
1025
1260
|
|
|
1026
1261
|
Page header with avatar and breadcrumb support.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import * as React from 'react';
|
|
19
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
20
|
+
import { AppSwitcherTrigger } from './AppSwitcherTrigger';
|
|
21
|
+
import { AppSwitcherSection } from './AppSwitcherSection';
|
|
22
|
+
import { AppSwitcherApp } from './AppSwitcherApp';
|
|
23
|
+
import { AppSwitcherFooter } from './AppSwitcherFooter';
|
|
24
|
+
/**
|
|
25
|
+
* Props for the AppSwitcher component.
|
|
26
|
+
*/
|
|
27
|
+
export interface AppSwitcherProps {
|
|
28
|
+
/** Switcher content (Trigger, Section, App, Footer) */
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
/** Popover width in pixels from the `sm` breakpoint up (default: 460) */
|
|
31
|
+
width?: number;
|
|
32
|
+
/** Accessible name for the popover surface (default: `"Applications"`) */
|
|
33
|
+
'aria-label'?: string;
|
|
34
|
+
/** Additional sx props applied to the popover */
|
|
35
|
+
sx?: SxProps<Theme>;
|
|
36
|
+
/** Id of the app the user is in. Its card opens in the same tab and is marked `aria-current`. */
|
|
37
|
+
currentAppId?: string;
|
|
38
|
+
/** Tooltip on unavailable cards, e.g. for localisation (default: `"Coming soon"`) */
|
|
39
|
+
unavailableLabel?: React.ReactNode;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* AppSwitcher - Popover for navigating between WSO2 Cloud applications.
|
|
43
|
+
*
|
|
44
|
+
* A compound component pairing a grid icon button in the header with a popover
|
|
45
|
+
* listing the available platforms. The trigger renders in place; every other
|
|
46
|
+
* child goes inside the popover.
|
|
47
|
+
*
|
|
48
|
+
* Features:
|
|
49
|
+
* - Compound component pattern for maximum flexibility
|
|
50
|
+
* - Context-based open/close state sharing
|
|
51
|
+
* - Card buttons that render as links when given a `url`
|
|
52
|
+
* - Arrow-key navigation within each section grid
|
|
53
|
+
* - Responsive popover width (viewport-capped on mobile, fixed on desktop)
|
|
54
|
+
*
|
|
55
|
+
* Selecting a card leaves the popover open, since cards open in a new tab, so
|
|
56
|
+
* the current tab never navigates. The trigger, an outside click or Escape
|
|
57
|
+
* dismisses it. The current app (`currentAppId`) is the exception: it opens
|
|
58
|
+
* in the same tab, so selecting it closes the popover.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```tsx
|
|
62
|
+
* <AppSwitcher currentAppId="agent-manager">
|
|
63
|
+
* <AppSwitcher.Trigger label="Switch platforms" />
|
|
64
|
+
* <AppSwitcher.Section label="Platforms" apps={platforms} loading={isLoading} />
|
|
65
|
+
* <AppSwitcher.Footer label="Manage" links={manage} loading={isLoading} />
|
|
66
|
+
* </AppSwitcher>
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```tsx
|
|
71
|
+
* <Header.Actions>
|
|
72
|
+
* <AppSwitcher>
|
|
73
|
+
* <AppSwitcher.Trigger />
|
|
74
|
+
* <AppSwitcher.Section label="Platforms">
|
|
75
|
+
* <AppSwitcher.App name="Agent Manager" url="https://agent.wso2.com" />
|
|
76
|
+
* <AppSwitcher.App name="API Platform" url="https://api.wso2.com" />
|
|
77
|
+
* <AppSwitcher.App name="Analytics" disabled tooltip="Coming soon" />
|
|
78
|
+
* </AppSwitcher.Section>
|
|
79
|
+
* <AppSwitcher.Footer label="Manage">
|
|
80
|
+
* <AppSwitcher.App name="Organizations" url="https://console.wso2.com/organizations" />
|
|
81
|
+
* <AppSwitcher.App name="Billing" url="https://console.wso2.com/billing" />
|
|
82
|
+
* </AppSwitcher.Footer>
|
|
83
|
+
* </AppSwitcher>
|
|
84
|
+
* </Header.Actions>
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare const AppSwitcher: React.FC<AppSwitcherProps> & {
|
|
88
|
+
Trigger: typeof AppSwitcherTrigger;
|
|
89
|
+
Section: typeof AppSwitcherSection;
|
|
90
|
+
App: typeof AppSwitcherApp;
|
|
91
|
+
Footer: typeof AppSwitcherFooter;
|
|
92
|
+
};
|
|
93
|
+
export default AppSwitcher;
|