@scality/core-ui 0.127.0 → 0.128.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.
@@ -12,6 +12,7 @@ export declare const TabsContainer: import("styled-components").StyledComponent<
12
12
  }, never>;
13
13
  export declare const TabContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
14
14
  tabContentColor?: string | undefined;
15
+ withoutPadding?: boolean | undefined;
15
16
  }, never>;
16
17
  export declare const ScrollableContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
17
18
  export declare const TabsScroller: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -1 +1 @@
1
- {"version":3,"file":"StyledTabs.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tabsv2/StyledTabs.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,yGAGlB,CAAC;AACF,eAAO,MAAM,OAAO;;;;;;SAkDnB,CAAC;AACF,eAAO,MAAM,aAAa;;oBAER,MAAM;SAyBvB,CAAC;AACF,eAAO,MAAM,UAAU;;SAUtB,CAAC;AACF,eAAO,MAAM,mBAAmB,yGAE/B,CAAC;AACF,eAAO,MAAM,YAAY,yGAYxB,CAAC"}
1
+ {"version":3,"file":"StyledTabs.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tabsv2/StyledTabs.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,yGAGlB,CAAC;AACF,eAAO,MAAM,OAAO;;;;;;SAkDnB,CAAC;AACF,eAAO,MAAM,aAAa;;oBAER,MAAM;SAyBvB,CAAC;AACF,eAAO,MAAM,UAAU;;;SAatB,CAAC;AACF,eAAO,MAAM,mBAAmB,yGAE/B,CAAC;AACF,eAAO,MAAM,YAAY,yGAYxB,CAAC"}
@@ -74,7 +74,7 @@ export const TabsContainer = styled.div `
74
74
  `;
75
75
  export const TabContent = styled.div `
76
76
  margin: 0;
77
- padding: 0;
77
+ padding: ${(props) => (props.withoutPadding ? '0' : spacing.r16)};
78
78
  display: block;
79
79
  width: 100%;
80
80
  height: 100%;
@@ -11,6 +11,7 @@ export type TabProps = {
11
11
  exact?: boolean;
12
12
  strict?: boolean;
13
13
  sensitive?: boolean;
14
+ withoutPadding?: boolean;
14
15
  };
15
16
  declare function Tab(_: TabProps): null;
16
17
  export { Tab };
@@ -1 +1 @@
1
- {"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tabsv2/Tab.ts"],"names":[],"mappings":";AAEA,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC3C,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,KAAK,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;IAC5B,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACxB,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,iBAAS,GAAG,CAAC,CAAC,EAAE,QAAQ,QAQvB;AAED,OAAO,EAAE,GAAG,EAAE,CAAC"}
1
+ {"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tabsv2/Tab.ts"],"names":[],"mappings":";AAEA,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC3C,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,KAAK,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;IAC5B,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACxB,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,iBAAS,GAAG,CAAC,CAAC,EAAE,QAAQ,QAQvB;AAED,OAAO,EAAE,GAAG,EAAE,CAAC"}
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- import { Element, ChildrenArray } from 'react';
1
+ import React, { ReactElement } from 'react';
3
2
  import { Tab } from './Tab';
3
+ import { TabProps } from './Tab';
4
4
  type TabsProps = {
5
5
  activeTabColor?: string;
6
6
  activeTabSeparator?: string;
@@ -9,7 +9,7 @@ type TabsProps = {
9
9
  tabContentColor?: string;
10
10
  separatorColor?: string;
11
11
  tabHoverColor?: string;
12
- children: ChildrenArray<Element<typeof Tab>>;
12
+ children: ReactElement<TabProps>[];
13
13
  className?: string;
14
14
  };
15
15
  export declare const TabsContext: React.Context<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"Tabsv2.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tabsv2/Tabsv2.component.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0D,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAkB/C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAM5B,KAAK,SAAS,GAAG;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AACF,eAAO,MAAM,WAAW,wBAAgC,CAAC;AAMzD,iBAAS,IAAI,CAAC,EACZ,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,aAAa,EACb,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,SAAS,eA6LX;kBAxMQ,IAAI;;;AA4Mb,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC"}
1
+ {"version":3,"file":"Tabsv2.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tabsv2/Tabsv2.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAKZ,YAAY,EACb,MAAM,OAAO,CAAC;AAmBf,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAS,MAAM,OAAO,CAAC;AAKxC,KAAK,SAAS,GAAG;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AACF,eAAO,MAAM,WAAW,wBAAgC,CAAC;AAMzD,iBAAS,IAAI,CAAC,EACZ,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,aAAa,EACb,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,SAAS,eAgMX;kBA3MQ,IAAI;;;AA+Mb,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- // @ts-nocheck
3
- import React, { createContext, useEffect, useState, useCallback } from 'react';
2
+ import React, { createContext, useEffect, useState, useCallback, } from 'react';
4
3
  import { TabBar, ScrollableContainer, TabContent, TabItem, TabsContainer, TabsScroller, } from './StyledTabs';
5
4
  import { useHistory, useLocation, useRouteMatch, matchPath, Route, } from 'react-router-dom';
6
5
  import { SecondaryText, BasicText, EmphaseText } from '../text/Text.component';
@@ -77,12 +76,12 @@ function Tabs({ activeTabColor, activeTabSeparator, tabLineColor, inactiveTabCol
77
76
  event.preventDefault();
78
77
  history.push(getPushHistoryPath(path, query));
79
78
  }
80
- }, ...childRest, children: [icon && _jsx(TabIcon, { label: label, children: icon }), isSelected ? (_jsx(BasicText, { className: "sc-tabs-item-title", children: label })) : (_jsx(SecondaryText, { className: "sc-tabs-item-title", children: label })), textBadge && (_jsx(EmphaseText, { className: "sc-tabs-item-icon", children: textBadge }))] }, index));
79
+ }, ...childRest, children: [icon && _jsx(TabIcon, { label: label, children: icon }), isSelected ? (_jsx(BasicText, { children: label })) : (_jsx(SecondaryText, { children: label })), textBadge && _jsx(EmphaseText, { children: textBadge })] }, index));
81
80
  });
82
- return (_jsx(TabsContext.Provider, { value: true, children: _jsxs(TabsContainer, { style: { containerType: 'size' }, className: ['sc-tabs', className].join(' '), tabLineColor: tabLineColor, separatorColor: separatorColor, ...rest, children: [_jsxs(ScrollableContainer, { children: [displayScroll.start && (_jsx(ScrollButton, { ref: scrollButtonStartRef, direction: "left", onClick: handleStartScrollClick })), _jsx(TabsScroller, { ref: tabsRef, onScroll: handleTabsScroll, children: _jsx(TabBar, { onKeyDown: handleKeyDown, ref: tabsListRef, className: "sc-tabs-bar", role: "tablist", children: tabItems }) }), displayScroll.end && (_jsx(ScrollButton, { ref: scrollButtonEndRef, direction: "right", onClick: handleEndScrollClick }))] }), _jsx(TabContent, { className: "sc-tabs-item-content", tabContentColor: tabContentColor, children: filteredTabsChildren.map((tab, index) => (_jsx(Route, { exact: tab.props.exact, sensitive: tab.props.sensitive, strict: tab.props.strict, path: tab.props.path.startsWith('/')
83
- ? tab.props.path
84
- : url + '/' + tab.props.path, children: !tab.props.query ||
85
- (tab.props.query && matchQuery(tab.props.query)) ? (tab.props.children) : (_jsx(_Fragment, {})) }, index))) })] }) }));
81
+ return (_jsx(TabsContext.Provider, { value: true, children: _jsxs(TabsContainer, { style: { containerType: 'size' }, className: ['sc-tabs', className].join(' '), tabLineColor: tabLineColor, separatorColor: separatorColor, ...rest, children: [_jsxs(ScrollableContainer, { children: [displayScroll.start && (_jsx(ScrollButton, { ref: scrollButtonStartRef, direction: "left", onClick: handleStartScrollClick })), _jsx(TabsScroller, { ref: tabsRef, onScroll: handleTabsScroll, children: _jsx(TabBar, { onKeyDown: handleKeyDown, ref: tabsListRef, className: "sc-tabs-bar", role: "tablist", children: tabItems }) }), displayScroll.end && (_jsx(ScrollButton, { ref: scrollButtonEndRef, direction: "right", onClick: handleEndScrollClick }))] }), filteredTabsChildren.map((tab, index) => (_jsx(Route, { exact: tab.props.exact, sensitive: tab.props.sensitive, strict: tab.props.strict, path: tab.props.path.startsWith('/')
82
+ ? tab.props.path
83
+ : url + '/' + tab.props.path, children: !tab.props.query ||
84
+ (tab.props.query && matchQuery(tab.props.query)) ? (_jsx(TabContent, { className: "sc-tabs-item-content", tabContentColor: tabContentColor, withoutPadding: tab.props.withoutPadding, children: tab.props.children })) : (_jsx(_Fragment, {})) }, index)))] }) }));
86
85
  }
87
86
  Tabs.Tab = Tab;
88
87
  // re-export Tab
@@ -4,7 +4,7 @@ declare const useScrollingTabs: (selectedTabIndex: number | null | undefined) =>
4
4
  scrollButtonEndRef: import("react").MutableRefObject<HTMLDivElement | null | undefined>;
5
5
  tabsRef: import("react").MutableRefObject<any>;
6
6
  tabsListRef: import("react").RefObject<HTMLDivElement>;
7
- handleKeyDown: (event: KeyboardEvent) => void;
7
+ handleKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void;
8
8
  handleTabsScroll: () => void;
9
9
  handleStartScrollClick: () => void;
10
10
  handleEndScrollClick: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"useScrollingTabs.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tabsv2/useScrollingTabs.ts"],"names":[],"mappings":";AAmIA,QAAA,MAAM,gBAAgB,qBAAsB,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;2BA0JrC,aAAa;;;;;;;;CA+C5C,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"useScrollingTabs.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tabsv2/useScrollingTabs.ts"],"names":[],"mappings":";AAmIA,QAAA,MAAM,gBAAgB,qBAAsB,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;2BA0JrC,mBAAmB,CAAC,cAAc,CAAC;;;;;;;;CA+ClE,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scality/core-ui",
3
- "version": "0.127.0",
3
+ "version": "0.128.0",
4
4
  "description": "Scality common React component library",
5
5
  "author": "Scality Engineering",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -84,9 +84,12 @@ export const TabsContainer = styled.div<{
84
84
  margin-right: -1px;
85
85
  }
86
86
  `;
87
- export const TabContent = styled.div<{ tabContentColor?: string }>`
87
+ export const TabContent = styled.div<{
88
+ tabContentColor?: string;
89
+ withoutPadding?: boolean;
90
+ }>`
88
91
  margin: 0;
89
- padding: 0;
92
+ padding: ${(props) => (props.withoutPadding ? '0' : spacing.r16)};
90
93
  display: block;
91
94
  width: 100%;
92
95
  height: 100%;
@@ -12,6 +12,7 @@ export type TabProps = {
12
12
  exact?: boolean;
13
13
  strict?: boolean;
14
14
  sensitive?: boolean;
15
+ withoutPadding?: boolean;
15
16
  };
16
17
 
17
18
  function Tab(_: TabProps) {
@@ -1,6 +1,10 @@
1
- // @ts-nocheck
2
- import React, { createContext, useEffect, useState, useCallback } from 'react';
3
- import { Element, ChildrenArray } from 'react';
1
+ import React, {
2
+ createContext,
3
+ useEffect,
4
+ useState,
5
+ useCallback,
6
+ ReactElement,
7
+ } from 'react';
4
8
  import {
5
9
  TabBar,
6
10
  ScrollableContainer,
@@ -15,6 +19,7 @@ import {
15
19
  useRouteMatch,
16
20
  matchPath,
17
21
  Route,
22
+ Switch,
18
23
  } from 'react-router-dom';
19
24
  import { SecondaryText, BasicText, EmphaseText } from '../text/Text.component';
20
25
  import { ScrollButton } from './ScrollButton';
@@ -32,7 +37,7 @@ type TabsProps = {
32
37
  tabContentColor?: string;
33
38
  separatorColor?: string;
34
39
  tabHoverColor?: string;
35
- children: ChildrenArray<Element<typeof Tab>>;
40
+ children: ReactElement<TabProps>[];
36
41
  className?: string;
37
42
  };
38
43
  export const TabsContext = createContext<boolean>(false);
@@ -60,9 +65,11 @@ function Tabs({
60
65
  number | null | undefined
61
66
  >(null);
62
67
  const queryURL = new URLSearchParams(location.search);
63
- const filteredTabsChildren = React.Children.toArray(children).filter(
68
+ const filteredTabsChildren: ReactElement<TabProps>[] = React.Children.toArray(
69
+ children,
70
+ ).filter(
64
71
  (child) => React.isValidElement(child) && child.type === Tab,
65
- );
72
+ ) as ReactElement<TabProps>[];
66
73
 
67
74
  const matchQuery = useCallback(
68
75
  (query: Query): boolean => {
@@ -168,18 +175,17 @@ function Tabs({
168
175
  >
169
176
  {icon && <TabIcon label={label}>{icon}</TabIcon>}
170
177
  {isSelected ? (
171
- <BasicText className="sc-tabs-item-title">{label}</BasicText>
178
+ <BasicText>{label}</BasicText>
172
179
  ) : (
173
- <SecondaryText className="sc-tabs-item-title">{label}</SecondaryText>
174
- )}
175
- {textBadge && (
176
- <EmphaseText className="sc-tabs-item-icon">{textBadge}</EmphaseText>
180
+ <SecondaryText>{label}</SecondaryText>
177
181
  )}
182
+ {textBadge && <EmphaseText>{textBadge}</EmphaseText>}
178
183
  </TabItem>
179
184
  );
180
185
  });
181
186
  return (
182
187
  <TabsContext.Provider value={true}>
188
+ {/*@ts-expect-error containerType is not yet a valid prop for react */}
183
189
  <TabsContainer
184
190
  style={{ containerType: 'size' }}
185
191
  className={['sc-tabs', className].join(' ')}
@@ -213,31 +219,33 @@ function Tabs({
213
219
  />
214
220
  )}
215
221
  </ScrollableContainer>
216
- <TabContent
217
- className="sc-tabs-item-content"
218
- tabContentColor={tabContentColor}
219
- >
220
- {filteredTabsChildren.map((tab: Element<typeof Tab>, index) => (
221
- <Route
222
- exact={tab.props.exact}
223
- sensitive={tab.props.sensitive}
224
- strict={tab.props.strict}
225
- key={index}
226
- path={
227
- tab.props.path.startsWith('/')
228
- ? tab.props.path
229
- : url + '/' + tab.props.path
230
- }
231
- >
232
- {!tab.props.query ||
233
- (tab.props.query && matchQuery(tab.props.query)) ? (
234
- tab.props.children
235
- ) : (
236
- <></>
237
- )}
238
- </Route>
239
- ))}
240
- </TabContent>
222
+
223
+ {filteredTabsChildren.map((tab, index) => (
224
+ <Route
225
+ exact={tab.props.exact}
226
+ sensitive={tab.props.sensitive}
227
+ strict={tab.props.strict}
228
+ path={
229
+ tab.props.path.startsWith('/')
230
+ ? tab.props.path
231
+ : url + '/' + tab.props.path
232
+ }
233
+ key={index}
234
+ >
235
+ {!tab.props.query ||
236
+ (tab.props.query && matchQuery(tab.props.query)) ? (
237
+ <TabContent
238
+ className="sc-tabs-item-content"
239
+ tabContentColor={tabContentColor}
240
+ withoutPadding={tab.props.withoutPadding}
241
+ >
242
+ {tab.props.children}
243
+ </TabContent>
244
+ ) : (
245
+ <></>
246
+ )}
247
+ </Route>
248
+ ))}
241
249
  </TabsContainer>
242
250
  </TabsContext.Provider>
243
251
  );
@@ -283,7 +283,7 @@ const useScrollingTabs = (selectedTabIndex: number | null | undefined) => {
283
283
  scrollSelectedIntoView();
284
284
  }, [scrollSelectedIntoView, selectedTabIndex]);
285
285
 
286
- const handleKeyDown = (event: KeyboardEvent) => {
286
+ const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
287
287
  const list = tabsListRef.current;
288
288
  const ownerDocument = (list && list.ownerDocument) || document;
289
289
  const currentFocus = ownerDocument.activeElement;
@@ -5,15 +5,23 @@ import { Wrapper, Title } from './common';
5
5
  import { BrowserRouter } from 'react-router-dom';
6
6
  import { brand, spacing } from '../src/lib/style/theme';
7
7
  import styled from 'styled-components';
8
- import { useLocation } from 'react-router';
8
+ import { MemoryRouter, Route, useLocation } from 'react-router';
9
+
9
10
  const Content = styled.div`
10
11
  padding: ${spacing.sp24};
11
12
  color: ${(props) => props.theme.textPrimary};
13
+ height: 100%;
12
14
  `;
13
15
  export default {
14
16
  title: 'Components/Navigation/Tabs',
15
17
  component: Tabs,
16
- decorators: [(story) => <BrowserRouter>{story()}</BrowserRouter>],
18
+ decorators: [
19
+ (story) => (
20
+ <BrowserRouter>
21
+ <Wrapper style={{ minHeight: '30rem' }}>{story()}</Wrapper>
22
+ </BrowserRouter>
23
+ ),
24
+ ],
17
25
  argTypes: {
18
26
  activeTabSeparator: {
19
27
  control: {
@@ -79,44 +87,52 @@ const DefaultTabsDetails = (props) => {
79
87
  <Title>
80
88
  {location.pathname} / {location.search}
81
89
  </Title>
82
- <Tabs {...props}>
83
- <Tab path="/iframe.html" label="Users">
84
- <Content>Users Content</Content>
85
- </Tab>
86
- <Tab
87
- path="/path1"
88
- query={{
89
- tab: 'group',
90
- }}
91
- label="Groups"
92
- >
93
- {details()}
94
- </Tab>
95
- <Tab
96
- path="/path1"
97
- query={{
98
- tab: 'role @',
99
- }}
100
- label="Roles"
101
- >
102
- {details()}
103
- </Tab>
104
- <Tab
105
- path="/path1"
106
- query={{
107
- tab: 'policies',
108
- }}
109
- label="Policies"
110
- >
111
- {details()}
112
- </Tab>
113
- <Tab path="/path4" label="Storage Location">
114
- <Content>Storage Location Content</Content>
115
- </Tab>
116
- <Tab path="/path5" label="Properties">
117
- <Content>Properties Content</Content>
118
- </Tab>
119
- </Tabs>
90
+ <MemoryRouter initialEntries={['/path?tab=group']} initialIndex={0}>
91
+ <Route
92
+ path="/:path?"
93
+ render={() => (
94
+ <Tabs {...props}>
95
+ <Tab path="/path" label="Users" withoutPadding>
96
+ <Content>Users Content</Content>
97
+ </Tab>
98
+ <Tab
99
+ path="/path1"
100
+ query={{
101
+ tab: 'group',
102
+ }}
103
+ label="Groups"
104
+ >
105
+ {details()}
106
+ </Tab>
107
+ <Tab
108
+ path="/path1"
109
+ query={{
110
+ tab: 'role',
111
+ }}
112
+ label="Roles"
113
+ withoutPadding
114
+ >
115
+ <Content>Roles content</Content>
116
+ </Tab>
117
+ <Tab
118
+ path="/path1"
119
+ query={{
120
+ tab: 'policies',
121
+ }}
122
+ label="Policies"
123
+ >
124
+ <Content>Policies content</Content>
125
+ </Tab>
126
+ <Tab path="/path4" label="Storage Location">
127
+ <Content>Storage Location Content</Content>
128
+ </Tab>
129
+ <Tab path="/path5" label="Properties">
130
+ <Content>Properties Content</Content>
131
+ </Tab>
132
+ </Tabs>
133
+ )}
134
+ />
135
+ </MemoryRouter>
120
136
  </>
121
137
  );
122
138
  };