@stack-spot/citric-react 0.21.0 → 0.22.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/dist/citric.css +15 -2
- package/dist/components/IconBox.d.ts +1 -1
- package/dist/components/ProgressBar.d.ts +5 -1
- package/dist/components/ProgressBar.d.ts.map +1 -1
- package/dist/components/ProgressBar.js +1 -1
- package/dist/components/ProgressBar.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +1 -1
- package/dist/components/Tabs/index.d.ts.map +1 -1
- package/dist/components/Tabs/index.js +3 -2
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/types.d.ts +6 -0
- package/dist/components/Tabs/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/IconBox.tsx +1 -1
- package/src/components/ProgressBar.tsx +6 -2
- package/src/components/Tabs/index.tsx +3 -2
- package/src/components/Tabs/types.ts +6 -0
package/dist/citric.css
CHANGED
|
@@ -481,11 +481,12 @@
|
|
|
481
481
|
|
|
482
482
|
> nav {
|
|
483
483
|
display: flex;
|
|
484
|
+
position: relative;
|
|
484
485
|
border-bottom: 1px solid var(--light-600);
|
|
485
486
|
> label {
|
|
486
487
|
appearance: none;
|
|
487
488
|
margin: 0;
|
|
488
|
-
padding: 8px 32px;
|
|
489
|
+
padding: 8px min(2%, 32px);
|
|
489
490
|
position: relative;
|
|
490
491
|
display: flex;
|
|
491
492
|
align-items: center;
|
|
@@ -515,6 +516,13 @@
|
|
|
515
516
|
}
|
|
516
517
|
}
|
|
517
518
|
|
|
519
|
+
&.equally-sized > nav > label {
|
|
520
|
+
padding: 8px 0;
|
|
521
|
+
flex: 1;
|
|
522
|
+
justify-content: center;
|
|
523
|
+
text-align: center;
|
|
524
|
+
}
|
|
525
|
+
|
|
518
526
|
> section {
|
|
519
527
|
display: flex;
|
|
520
528
|
flex-direction: column;
|
|
@@ -1462,6 +1470,7 @@ input[type="range"][data-citric="slider"] {
|
|
|
1462
1470
|
|
|
1463
1471
|
|
|
1464
1472
|
[data-citric="progress-bar"] {
|
|
1473
|
+
--speed: 1s;
|
|
1465
1474
|
border-radius: var(--radius-lg);
|
|
1466
1475
|
width: 100%;
|
|
1467
1476
|
height: 2px;
|
|
@@ -1477,8 +1486,12 @@ input[type="range"][data-citric="slider"] {
|
|
|
1477
1486
|
background-color: var(--scheme-500, var(--palette-500, var(--primary-500)));
|
|
1478
1487
|
}
|
|
1479
1488
|
|
|
1489
|
+
&.fast {
|
|
1490
|
+
--speed: 0.5s;
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1480
1493
|
&.indeterminate:after {
|
|
1481
|
-
animation: progress-indeterminate-bar
|
|
1494
|
+
animation: progress-indeterminate-bar var(--speed) infinite;
|
|
1482
1495
|
}
|
|
1483
1496
|
}
|
|
1484
1497
|
|
|
@@ -17,7 +17,7 @@ export interface BaseIconBoxProps<T extends IconBoxTag, G extends IconGroup> ext
|
|
|
17
17
|
* background and foreground colors change on hover or focus.
|
|
18
18
|
* - text: a circle with transparent background. Its size depends on the value of `size`. If this is clickable, the background and
|
|
19
19
|
* foreground colors change on hover or focus (it won't be transparent).
|
|
20
|
-
* - none: no special styling, its size
|
|
20
|
+
* - none: no special styling, its size depends only on the size of the icon (the property `size` is ignored). Even if this is clickable,
|
|
21
21
|
* the style doesn't change on hover or focus.
|
|
22
22
|
*
|
|
23
23
|
* @default 'circle'
|
|
@@ -6,7 +6,11 @@ export interface BaseProgressBarProps extends WithColorScheme, WithColorPalette
|
|
|
6
6
|
* If not provided, the progress will be indeterminate, causing an animation loop.
|
|
7
7
|
*/
|
|
8
8
|
progress?: number;
|
|
9
|
+
/**
|
|
10
|
+
* The speed which the bar animation runs. Only valid if `progress` is `undefined`.
|
|
11
|
+
*/
|
|
12
|
+
speed?: 'normal' | 'fast';
|
|
9
13
|
}
|
|
10
14
|
export type ProgressBarProps = React.JSX.IntrinsicElements['div'] & BaseProgressBarProps;
|
|
11
|
-
export declare const ProgressBar: ({ progress, style, className, ...props }: ProgressBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const ProgressBar: ({ progress, speed, style, className, ...props }: ProgressBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
16
|
//# sourceMappingURL=ProgressBar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../src/components/ProgressBar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAK5D,MAAM,WAAW,oBAAqB,SAAQ,eAAe,EAAE,gBAAgB;IAC7E;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../src/components/ProgressBar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAK5D,MAAM,WAAW,oBAAqB,SAAQ,eAAe,EAAE,gBAAgB;IAC7E;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;CAC3B;AAED,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,oBAAoB,CAAA;AAExF,eAAO,MAAM,WAAW,oDAA6D,gBAAgB,4CAQpG,CAAA"}
|
|
@@ -4,5 +4,5 @@ import { isNil } from 'lodash';
|
|
|
4
4
|
import { applyCSSVariable } from '../utils/css.js';
|
|
5
5
|
import { withRef } from '../utils/react.js';
|
|
6
6
|
import { CitricComponent } from './CitricComponent.js';
|
|
7
|
-
export const ProgressBar = withRef(({ progress, style, className, ...props }) => _jsx(CitricComponent, { tag: "div", component: "progress-bar", className: listToClass([className, isNil(progress) && 'indeterminate']), style: progress === undefined ? style : applyCSSVariable(style, 'progress', progress), ...props }));
|
|
7
|
+
export const ProgressBar = withRef(({ progress, speed, style, className, ...props }) => _jsx(CitricComponent, { tag: "div", component: "progress-bar", className: listToClass([className, isNil(progress) && 'indeterminate', speed === 'fast' && 'fast']), style: progress === undefined ? style : applyCSSVariable(style, 'progress', progress), ...props }));
|
|
8
8
|
//# sourceMappingURL=ProgressBar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.js","sourceRoot":"","sources":["../../src/components/ProgressBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAE9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"ProgressBar.js","sourceRoot":"","sources":["../../src/components/ProgressBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAE9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAiBnD,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,EAAoB,EAAE,EAAE,CACvG,KAAC,eAAe,IACd,GAAG,EAAC,KAAK,EACT,SAAS,EAAC,cAAc,EACxB,SAAS,EAAE,WAAW,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI,eAAe,EAAE,KAAK,KAAK,MAAM,IAAI,MAAM,CAAC,CAAC,EACnG,KAAK,EAAE,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,KACjF,KAAK,GACT,CACH,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TabController } from './TabController.js';
|
|
2
2
|
import { TabsProps } from './types.js';
|
|
3
|
-
declare function _Tabs<Key extends string>({ tabs, value, onChange, controller: ctrl, ...props }: TabsProps<Key>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function _Tabs<Key extends string>({ tabs, value, equallySized, onChange, controller: ctrl, className, ...props }: TabsProps<Key>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export declare function useTabController<Key extends string = string>(): TabController<Key> | undefined;
|
|
5
5
|
export declare const Tabs: typeof _Tabs;
|
|
6
6
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/index.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAKnC,iBAAS,KAAK,CAAC,GAAG,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,CAAC,GAAG,CAAC,2CAsChI;AAED,wBAAgB,gBAAgB,CAAC,GAAG,SAAS,MAAM,GAAG,MAAM,KAAK,aAAa,CAAC,GAAG,CAAC,GAAG,SAAS,CAE9F;AAWD,eAAO,MAAM,IAAI,cAAiB,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { listToClass } from '@stack-spot/portal-theme';
|
|
2
3
|
import { useTranslate } from '@stack-spot/portal-translate';
|
|
3
4
|
import { createContext, Suspense, useContext, useEffect, useMemo, useState } from 'react';
|
|
4
5
|
import { withRef } from '../../utils/react.js';
|
|
@@ -9,7 +10,7 @@ import { Center } from '../layout.js';
|
|
|
9
10
|
import { TabController } from './TabController.js';
|
|
10
11
|
import { findSelectedIndex } from './utils.js';
|
|
11
12
|
const ctx = createContext(undefined);
|
|
12
|
-
function _Tabs({ tabs, value, onChange, controller: ctrl, ...props }) {
|
|
13
|
+
function _Tabs({ tabs, value, equallySized, onChange, controller: ctrl, className, ...props }) {
|
|
13
14
|
const controller = useMemo(() => ctrl ?? new TabController(tabs.map(t => t.key), value || tabs[0]?.key), []);
|
|
14
15
|
const t = useTranslate(dictionary);
|
|
15
16
|
const [selectedIndex, setSelectedIndex] = useState(findSelectedIndex(tabs, controller.getValue()));
|
|
@@ -22,7 +23,7 @@ function _Tabs({ tabs, value, onChange, controller: ctrl, ...props }) {
|
|
|
22
23
|
onChange?.(v);
|
|
23
24
|
}), [tabs]);
|
|
24
25
|
const nav = useMemo(() => tabs.map(({ key, label, disabled }, index) => (_jsxs("label", { children: [_jsx("input", { type: "radio", role: "tab", checked: index === selectedIndex, onChange: () => controller.setValue(key), disabled: disabled }), label || key] }, key))), [tabs, selectedIndex]);
|
|
25
|
-
return (_jsx(ctx.Provider, { value: controller, children: _jsxs(CitricComponent, { tag: "div", component: "tabs", ...props, children: [_jsx("nav", { children: nav }), _jsx("section", { children: _jsx(ErrorBoundary, { message: t.error, children: _jsx(Suspense, { fallback: _jsx(Center, { style: { padding: '20px' }, children: _jsx(ProgressCircular, {}) }), children: selectedIndex === -1 ? null : tabs[selectedIndex]?.content }) }, selectedIndex) })] }) }));
|
|
26
|
+
return (_jsx(ctx.Provider, { value: controller, children: _jsxs(CitricComponent, { tag: "div", component: "tabs", className: listToClass([className, equallySized && 'equally-sized']), ...props, children: [_jsx("nav", { children: nav }), _jsx("section", { children: _jsx(ErrorBoundary, { message: t.error, children: _jsx(Suspense, { fallback: _jsx(Center, { style: { padding: '20px' }, children: _jsx(ProgressCircular, {}) }), children: selectedIndex === -1 ? null : tabs[selectedIndex]?.content }) }, selectedIndex) })] }) }));
|
|
26
27
|
}
|
|
27
28
|
export function useTabController() {
|
|
28
29
|
return useContext(ctx);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Tabs/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACzF,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE3C,MAAM,GAAG,GAAG,aAAa,CAAiC,SAAS,CAAC,CAAA;AAEpE,SAAS,KAAK,CAAqB,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,KAAK,EAAkB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Tabs/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B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K,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,OAAO,GAClD,IAHO,aAAa,CAIjB,GACR,IACM,GACL,CAChB,CAAA;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,UAAU,CAAC,GAAG,CAAC,CAAA;AACxB,CAAC;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,KAAK,EAAE,8BAA8B;KACtC;IACD,EAAE,EAAE;QACF,KAAK,EAAE,oCAAoC;KAC5C;CACmB,CAAA;AAEtB,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA"}
|
|
@@ -41,6 +41,12 @@ export interface BaseTabsProps<Key extends string> extends WithColorScheme, With
|
|
|
41
41
|
* A tab-controller, useful if you want to control the tabs outside the component context.
|
|
42
42
|
*/
|
|
43
43
|
controller?: TabController<Key>;
|
|
44
|
+
/**
|
|
45
|
+
* Instead of each tab occupying only the space it needs, all tabs will have their sizes equally distributed.
|
|
46
|
+
*
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
equallySized?: boolean;
|
|
44
50
|
}
|
|
45
51
|
export type TabsProps<Key extends string> = Omit<React.JSX.IntrinsicElements['div'], 'onChange' | 'children'> & BaseTabsProps<Key>;
|
|
46
52
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,MAAM,WAAW,GAAG,CAAC,GAAG,SAAS,MAAM,GAAG,MAAM;IAC9C;;OAEG;IACH,GAAG,EAAE,GAAG,CAAC;IACT;;OAEG;IACH,KAAK,CAAC,EAAE,MA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U,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;IAChC;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,MAAM,SAAS,CAAC,GAAG,SAAS,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ export interface BaseIconBoxProps<T extends IconBoxTag, G extends IconGroup> ext
|
|
|
23
23
|
* background and foreground colors change on hover or focus.
|
|
24
24
|
* - text: a circle with transparent background. Its size depends on the value of `size`. If this is clickable, the background and
|
|
25
25
|
* foreground colors change on hover or focus (it won't be transparent).
|
|
26
|
-
* - none: no special styling, its size
|
|
26
|
+
* - none: no special styling, its size depends only on the size of the icon (the property `size` is ignored). Even if this is clickable,
|
|
27
27
|
* the style doesn't change on hover or focus.
|
|
28
28
|
*
|
|
29
29
|
* @default 'circle'
|
|
@@ -12,15 +12,19 @@ export interface BaseProgressBarProps extends WithColorScheme, WithColorPalette
|
|
|
12
12
|
* If not provided, the progress will be indeterminate, causing an animation loop.
|
|
13
13
|
*/
|
|
14
14
|
progress?: number,
|
|
15
|
+
/**
|
|
16
|
+
* The speed which the bar animation runs. Only valid if `progress` is `undefined`.
|
|
17
|
+
*/
|
|
18
|
+
speed?: 'normal' | 'fast',
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
export type ProgressBarProps = React.JSX.IntrinsicElements['div'] & BaseProgressBarProps
|
|
18
22
|
|
|
19
|
-
export const ProgressBar = withRef(({ progress, style, className, ...props }: ProgressBarProps) =>
|
|
23
|
+
export const ProgressBar = withRef(({ progress, speed, style, className, ...props }: ProgressBarProps) =>
|
|
20
24
|
<CitricComponent
|
|
21
25
|
tag="div"
|
|
22
26
|
component="progress-bar"
|
|
23
|
-
className={listToClass([className, isNil(progress) && 'indeterminate'])}
|
|
27
|
+
className={listToClass([className, isNil(progress) && 'indeterminate', speed === 'fast' && 'fast'])}
|
|
24
28
|
style={progress === undefined ? style : applyCSSVariable(style, 'progress', progress)}
|
|
25
29
|
{...props}
|
|
26
30
|
/>,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { listToClass } from '@stack-spot/portal-theme'
|
|
1
2
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
2
3
|
import { createContext, Suspense, useContext, useEffect, useMemo, useState } from 'react'
|
|
3
4
|
import { withRef } from '../../utils/react'
|
|
@@ -11,7 +12,7 @@ import { findSelectedIndex } from './utils'
|
|
|
11
12
|
|
|
12
13
|
const ctx = createContext<TabController<any> | undefined>(undefined)
|
|
13
14
|
|
|
14
|
-
function _Tabs<Key extends string>({ tabs, value, onChange, controller: ctrl, ...props }: TabsProps<Key>) {
|
|
15
|
+
function _Tabs<Key extends string>({ tabs, value, equallySized, onChange, controller: ctrl, className, ...props }: TabsProps<Key>) {
|
|
15
16
|
const controller = useMemo(() => ctrl ?? new TabController<Key>(tabs.map(t => t.key), value || tabs[0]?.key), [])
|
|
16
17
|
const t = useTranslate(dictionary)
|
|
17
18
|
const [selectedIndex, setSelectedIndex] = useState(findSelectedIndex(tabs, controller.getValue()))
|
|
@@ -37,7 +38,7 @@ function _Tabs<Key extends string>({ tabs, value, onChange, controller: ctrl, ..
|
|
|
37
38
|
|
|
38
39
|
return (
|
|
39
40
|
<ctx.Provider value={controller}>
|
|
40
|
-
<CitricComponent tag="div" component="tabs" {...props}>
|
|
41
|
+
<CitricComponent tag="div" component="tabs" className={listToClass([className, equallySized && 'equally-sized'])} {...props}>
|
|
41
42
|
<nav>{nav}</nav>
|
|
42
43
|
<section>
|
|
43
44
|
<ErrorBoundary key={selectedIndex} message={t.error}>
|
|
@@ -43,6 +43,12 @@ export interface BaseTabsProps<Key extends string> extends WithColorScheme, With
|
|
|
43
43
|
* A tab-controller, useful if you want to control the tabs outside the component context.
|
|
44
44
|
*/
|
|
45
45
|
controller?: TabController<Key>,
|
|
46
|
+
/**
|
|
47
|
+
* Instead of each tab occupying only the space it needs, all tabs will have their sizes equally distributed.
|
|
48
|
+
*
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
equallySized?: boolean,
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
export type TabsProps<Key extends string> = Omit<React.JSX.IntrinsicElements['div'], 'onChange' | 'children'> & BaseTabsProps<Key>
|