@veracity/vui 1.1.0 → 1.1.2
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/README.md +15 -0
- package/dist/cjs/core/styled.d.ts +6 -6
- package/dist/cjs/core/vuiProvider/vuiProvider.d.ts.map +1 -1
- package/dist/cjs/core/vuiProvider/vuiProvider.js +7 -4
- package/dist/cjs/icons/baseIcons/fal/falFileSignature.d.ts +4 -0
- package/dist/cjs/icons/baseIcons/fal/falFileSignature.d.ts.map +1 -0
- package/dist/cjs/icons/baseIcons/fal/falFileSignature.js +7 -0
- package/dist/cjs/icons/baseIcons/fal/falPaperclip.d.ts +4 -0
- package/dist/cjs/icons/baseIcons/fal/falPaperclip.d.ts.map +1 -0
- package/dist/cjs/icons/baseIcons/fal/falPaperclip.js +7 -0
- package/dist/cjs/icons/baseIcons/icons.d.ts +5 -3
- package/dist/cjs/icons/baseIcons/icons.d.ts.map +1 -1
- package/dist/cjs/icons/baseIcons/icons.js +14 -10
- package/dist/cjs/icons/baseIcons/types.d.ts +1 -1
- package/dist/cjs/icons/baseIcons/types.d.ts.map +1 -1
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/modal/modal.d.ts.map +1 -1
- package/dist/cjs/modal/modal.js +3 -7
- package/dist/cjs/modal/modalManager.d.ts +1 -1
- package/dist/cjs/modal/modalManager.d.ts.map +1 -1
- package/dist/cjs/modal/modalManager.js +8 -2
- package/dist/cjs/modal/modalStyle.d.ts +3 -0
- package/dist/cjs/modal/modalStyle.d.ts.map +1 -0
- package/dist/cjs/modal/modalStyle.js +10 -0
- package/dist/cjs/progress/index.d.ts +4 -0
- package/dist/cjs/progress/index.d.ts.map +1 -0
- package/dist/cjs/progress/index.js +24 -0
- package/dist/cjs/progress/progress.d.ts +6 -0
- package/dist/cjs/progress/progress.d.ts.map +1 -0
- package/dist/cjs/progress/progress.js +59 -0
- package/dist/cjs/progress/progress.types.d.ts +8 -0
- package/dist/cjs/progress/progress.types.d.ts.map +1 -0
- package/dist/cjs/progress/progress.types.js +2 -0
- package/dist/cjs/progress/theme.d.ts +47 -0
- package/dist/cjs/progress/theme.d.ts.map +1 -0
- package/dist/cjs/progress/theme.js +51 -0
- package/dist/cjs/tabs/index.d.ts +5 -0
- package/dist/cjs/tabs/index.d.ts.map +1 -0
- package/dist/cjs/tabs/index.js +25 -0
- package/dist/cjs/tabs/tab.d.ts +8 -0
- package/dist/cjs/tabs/tab.d.ts.map +1 -0
- package/dist/cjs/tabs/tab.js +20 -0
- package/dist/cjs/tabs/tabs.d.ts +13 -0
- package/dist/cjs/tabs/tabs.d.ts.map +1 -0
- package/dist/cjs/tabs/tabs.js +92 -0
- package/dist/cjs/tabs/tabs.types.d.ts +25 -0
- package/dist/cjs/tabs/tabs.types.d.ts.map +1 -0
- package/dist/cjs/tabs/tabs.types.js +2 -0
- package/dist/cjs/tabs/tabsNavBar.d.ts +4 -0
- package/dist/cjs/tabs/tabsNavBar.d.ts.map +1 -0
- package/dist/cjs/tabs/tabsNavBar.js +19 -0
- package/dist/cjs/tabs/theme.d.ts +14 -0
- package/dist/cjs/tabs/theme.d.ts.map +1 -0
- package/dist/cjs/tabs/theme.js +19 -0
- package/dist/cjs/tabs/useTabsState.d.ts +11 -0
- package/dist/cjs/tabs/useTabsState.d.ts.map +1 -0
- package/dist/cjs/tabs/useTabsState.js +11 -0
- package/dist/cjs/theme/components.d.ts +57 -0
- package/dist/cjs/theme/components.d.ts.map +1 -1
- package/dist/cjs/theme/components.js +22 -18
- package/dist/cjs/theme/defaultTheme.d.ts +57 -0
- package/dist/cjs/theme/defaultTheme.d.ts.map +1 -1
- package/dist/cjs/tooltip/tooltip.d.ts.map +1 -1
- package/dist/cjs/tooltip/tooltip.js +2 -2
- package/dist/cjs/tooltip/tooltip.types.d.ts +2 -0
- package/dist/cjs/tooltip/tooltip.types.d.ts.map +1 -1
- package/dist/esm/core/styled.d.ts +6 -6
- package/dist/esm/core/vuiProvider/vuiProvider.d.ts.map +1 -1
- package/dist/esm/core/vuiProvider/vuiProvider.js +7 -4
- package/dist/esm/icons/baseIcons/fal/falFileSignature.d.ts +4 -0
- package/dist/esm/icons/baseIcons/fal/falFileSignature.d.ts.map +1 -0
- package/dist/esm/icons/baseIcons/fal/falFileSignature.js +5 -0
- package/dist/esm/icons/baseIcons/fal/falPaperclip.d.ts +4 -0
- package/dist/esm/icons/baseIcons/fal/falPaperclip.d.ts.map +1 -0
- package/dist/esm/icons/baseIcons/fal/falPaperclip.js +5 -0
- package/dist/esm/icons/baseIcons/icons.d.ts +5 -3
- package/dist/esm/icons/baseIcons/icons.d.ts.map +1 -1
- package/dist/esm/icons/baseIcons/icons.js +5 -3
- package/dist/esm/icons/baseIcons/types.d.ts +1 -1
- package/dist/esm/icons/baseIcons/types.d.ts.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/modal/modal.d.ts.map +1 -1
- package/dist/esm/modal/modal.js +3 -7
- package/dist/esm/modal/modalManager.d.ts +1 -1
- package/dist/esm/modal/modalManager.d.ts.map +1 -1
- package/dist/esm/modal/modalManager.js +8 -2
- package/dist/esm/modal/modalStyle.d.ts +3 -0
- package/dist/esm/modal/modalStyle.d.ts.map +1 -0
- package/dist/esm/modal/modalStyle.js +8 -0
- package/dist/esm/progress/index.d.ts +4 -0
- package/dist/esm/progress/index.d.ts.map +1 -0
- package/dist/esm/progress/index.js +3 -0
- package/dist/esm/progress/progress.d.ts +6 -0
- package/dist/esm/progress/progress.d.ts.map +1 -0
- package/dist/esm/progress/progress.js +22 -0
- package/dist/esm/progress/progress.types.d.ts +8 -0
- package/dist/esm/progress/progress.types.d.ts.map +1 -0
- package/dist/esm/progress/progress.types.js +1 -0
- package/dist/esm/progress/theme.d.ts +47 -0
- package/dist/esm/progress/theme.d.ts.map +1 -0
- package/dist/esm/progress/theme.js +49 -0
- package/dist/esm/tabs/index.d.ts +5 -0
- package/dist/esm/tabs/index.d.ts.map +1 -0
- package/dist/esm/tabs/index.js +4 -0
- package/dist/esm/tabs/tab.d.ts +8 -0
- package/dist/esm/tabs/tab.d.ts.map +1 -0
- package/dist/esm/tabs/tab.js +14 -0
- package/dist/esm/tabs/tabs.d.ts +13 -0
- package/dist/esm/tabs/tabs.d.ts.map +1 -0
- package/dist/esm/tabs/tabs.js +50 -0
- package/dist/esm/tabs/tabs.types.d.ts +25 -0
- package/dist/esm/tabs/tabs.types.d.ts.map +1 -0
- package/dist/esm/tabs/tabs.types.js +1 -0
- package/dist/esm/tabs/tabsNavBar.d.ts +4 -0
- package/dist/esm/tabs/tabsNavBar.d.ts.map +1 -0
- package/dist/esm/tabs/tabsNavBar.js +12 -0
- package/dist/esm/tabs/theme.d.ts +14 -0
- package/dist/esm/tabs/theme.d.ts.map +1 -0
- package/dist/esm/tabs/theme.js +17 -0
- package/dist/esm/tabs/useTabsState.d.ts +11 -0
- package/dist/esm/tabs/useTabsState.d.ts.map +1 -0
- package/dist/esm/tabs/useTabsState.js +7 -0
- package/dist/esm/theme/components.d.ts +57 -0
- package/dist/esm/theme/components.d.ts.map +1 -1
- package/dist/esm/theme/components.js +4 -0
- package/dist/esm/theme/defaultTheme.d.ts +57 -0
- package/dist/esm/theme/defaultTheme.d.ts.map +1 -1
- package/dist/esm/tooltip/tooltip.d.ts.map +1 -1
- package/dist/esm/tooltip/tooltip.js +2 -2
- package/dist/esm/tooltip/tooltip.types.d.ts +2 -0
- package/dist/esm/tooltip/tooltip.types.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/core/vuiProvider/vuiProvider.tsx +8 -6
- package/src/icons/baseIcons/fal/falFileSignature.ts +8 -0
- package/src/icons/baseIcons/fal/falPaperclip.ts +8 -0
- package/src/icons/baseIcons/icons.ts +5 -3
- package/src/icons/baseIcons/types.ts +5 -3
- package/src/index.ts +2 -0
- package/src/modal/modal.tsx +3 -13
- package/src/modal/modalManager.ts +6 -2
- package/src/modal/modalStyle.ts +9 -0
- package/src/progress/index.ts +3 -0
- package/src/progress/progress.tsx +54 -0
- package/src/progress/progress.types.ts +9 -0
- package/src/progress/theme.ts +53 -0
- package/src/tabs/index.ts +4 -0
- package/src/tabs/tab.tsx +23 -0
- package/src/tabs/tabs.tsx +78 -0
- package/src/tabs/tabs.types.ts +31 -0
- package/src/tabs/tabsNavBar.tsx +51 -0
- package/src/tabs/theme.ts +22 -0
- package/src/tabs/useTabsState.ts +11 -0
- package/src/theme/components.ts +4 -0
- package/src/tooltip/tooltip.tsx +2 -1
- package/src/tooltip/tooltip.types.ts +2 -0
|
@@ -898,6 +898,51 @@ declare const defaultTheme: {
|
|
|
898
898
|
};
|
|
899
899
|
};
|
|
900
900
|
};
|
|
901
|
+
Progress: {
|
|
902
|
+
baseStyle: {};
|
|
903
|
+
defaultProps: {
|
|
904
|
+
size: string;
|
|
905
|
+
};
|
|
906
|
+
sizes: {
|
|
907
|
+
sm: {
|
|
908
|
+
container: {
|
|
909
|
+
minH: string;
|
|
910
|
+
};
|
|
911
|
+
percentage: {
|
|
912
|
+
fontSize: string;
|
|
913
|
+
top: string;
|
|
914
|
+
};
|
|
915
|
+
};
|
|
916
|
+
md: {
|
|
917
|
+
container: {
|
|
918
|
+
minH: string;
|
|
919
|
+
};
|
|
920
|
+
percentage: {
|
|
921
|
+
fontSize: string;
|
|
922
|
+
top: string;
|
|
923
|
+
};
|
|
924
|
+
};
|
|
925
|
+
lg: {
|
|
926
|
+
container: {
|
|
927
|
+
minH: string;
|
|
928
|
+
};
|
|
929
|
+
percentage: {
|
|
930
|
+
fontSize: string;
|
|
931
|
+
top: string;
|
|
932
|
+
};
|
|
933
|
+
};
|
|
934
|
+
xl: {
|
|
935
|
+
container: {
|
|
936
|
+
minH: string;
|
|
937
|
+
};
|
|
938
|
+
percentage: {
|
|
939
|
+
fontSize: string;
|
|
940
|
+
top: string;
|
|
941
|
+
};
|
|
942
|
+
};
|
|
943
|
+
};
|
|
944
|
+
variants: {};
|
|
945
|
+
};
|
|
901
946
|
Popover: {
|
|
902
947
|
baseStyle: {};
|
|
903
948
|
defaultProps: {};
|
|
@@ -1205,6 +1250,18 @@ declare const defaultTheme: {
|
|
|
1205
1250
|
striped: {};
|
|
1206
1251
|
};
|
|
1207
1252
|
};
|
|
1253
|
+
Tabs: {
|
|
1254
|
+
baseStyle: {};
|
|
1255
|
+
defaultProps: {};
|
|
1256
|
+
parts: string[];
|
|
1257
|
+
sizes: {
|
|
1258
|
+
sm: {};
|
|
1259
|
+
md: {};
|
|
1260
|
+
lg: {};
|
|
1261
|
+
xl: {};
|
|
1262
|
+
};
|
|
1263
|
+
variants: {};
|
|
1264
|
+
};
|
|
1208
1265
|
Tag: {
|
|
1209
1266
|
baseStyle: {};
|
|
1210
1267
|
defaultProps: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultTheme.d.ts","sourceRoot":"","sources":["../../../src/theme/defaultTheme.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"defaultTheme.d.ts","sourceRoot":"","sources":["../../../src/theme/defaultTheme.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGjB,CAAA;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/tooltip/tooltip.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;;;KAKK;AACL,eAAO,MAAM,OAAO,UAAW,YAAY,
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/tooltip/tooltip.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;;;KAKK;AACL,eAAO,MAAM,OAAO,UAAW,YAAY,gBAmC1C,CAAA;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -9,11 +9,11 @@ import { animation, color, pointerPlacement, pointerSize } from './tooltip.setup
|
|
|
9
9
|
*
|
|
10
10
|
* */
|
|
11
11
|
export const Tooltip = (props) => {
|
|
12
|
-
const { children, text = 'demo', placement = 'top', isAnimated = false } = props;
|
|
12
|
+
const { children, maxWidth = '400px', text = 'demo', placement = 'top', isAnimated = false } = props;
|
|
13
13
|
return (React.createElement(Popover, { placement: placement, trigger: "mouseenter" },
|
|
14
14
|
React.createElement(Popover.Trigger, { as: Box, display: "inline-block" },
|
|
15
15
|
React.createElement(Box, { display: "inline-block" }, children)),
|
|
16
|
-
React.createElement(Popover.Content, { animation: isAnimated ? animation[placement] : undefined, bg: color, color: "white", m: 1, p: 1, pl: 2, pr: 2 },
|
|
16
|
+
React.createElement(Popover.Content, { animation: isAnimated ? animation[placement] : undefined, bg: color, color: "white", m: 1, maxW: maxWidth, p: 1, pl: 2, pr: 2 },
|
|
17
17
|
!isAnimated && (React.createElement(Box, { bg: color, bottom: pointerPlacement[placement].bottom, h: `${pointerSize}px`, left: pointerPlacement[placement].left, position: "absolute", right: pointerPlacement[placement].right, top: pointerPlacement[placement].top, transform: `translate(${pointerPlacement[placement].translate}) rotate(45deg)`, w: `${pointerSize}px` })),
|
|
18
18
|
text)));
|
|
19
19
|
};
|
|
@@ -6,6 +6,8 @@ export declare type TooltipProps = {
|
|
|
6
6
|
placement?: 'top' | 'left' | 'bottom' | 'right';
|
|
7
7
|
/** Displays the tooltip with animation, without the arrow pointer. */
|
|
8
8
|
isAnimated?: boolean;
|
|
9
|
+
/** Sets maximum width to the tooltip body. */
|
|
10
|
+
maxWidth?: string;
|
|
9
11
|
children?: ReactNode;
|
|
10
12
|
};
|
|
11
13
|
//# sourceMappingURL=tooltip.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.types.d.ts","sourceRoot":"","sources":["../../../src/tooltip/tooltip.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,oBAAY,YAAY,GAAG;IACzB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,wBAAwB;IACxB,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;IAC/C,sEAAsE;IACtE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA"}
|
|
1
|
+
{"version":3,"file":"tooltip.types.d.ts","sourceRoot":"","sources":["../../../src/tooltip/tooltip.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,oBAAY,YAAY,GAAG;IACzB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,wBAAwB;IACxB,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;IAC/C,sEAAsE;IACtE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veracity/vui",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "Veracity UI React
|
|
3
|
+
"version": "1.1.2",
|
|
4
|
+
"description": "Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
"Veracity",
|
|
12
12
|
"UI",
|
|
13
13
|
"React",
|
|
14
|
-
"Components"
|
|
14
|
+
"Components",
|
|
15
|
+
"VUI",
|
|
16
|
+
"ui.veracity.com"
|
|
15
17
|
],
|
|
16
18
|
"repository": {
|
|
17
19
|
"type": "git",
|
|
@@ -24,12 +26,11 @@
|
|
|
24
26
|
"@xstyled/system": "2.5.0",
|
|
25
27
|
"@xstyled/util": "2.2.3",
|
|
26
28
|
"react-focus-lock": "2.8.1",
|
|
27
|
-
"react-remove-scroll": "2.4.3",
|
|
28
29
|
"styled-components": "5.3.3",
|
|
29
30
|
"tippy.js": "6.3.7"
|
|
30
31
|
},
|
|
31
32
|
"peerDependencies": {
|
|
32
|
-
"react": "^17.0.
|
|
33
|
-
"react-dom": "^17.0.
|
|
33
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
34
|
+
"react-dom": "^17.0.0 || ^18.0.0"
|
|
34
35
|
}
|
|
35
|
-
}
|
|
36
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { FC } from 'react'
|
|
2
2
|
import { ThemeProvider } from 'styled-components'
|
|
3
3
|
|
|
4
|
+
import ModalStyle from '../../modal/modalStyle'
|
|
4
5
|
import PopoverStyle from '../../popover/popoverStyle'
|
|
5
6
|
import defaultTheme, { VuiTheme } from '../../theme'
|
|
6
7
|
import GlobalStyle from './globalStyle'
|
|
@@ -24,12 +25,13 @@ const VuiProvider: FC<VuiProviderProps> = ({
|
|
|
24
25
|
}) => {
|
|
25
26
|
return (
|
|
26
27
|
<ThemeProvider theme={theme}>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
<>
|
|
29
|
+
{resetCSS && <ResetCSS />}
|
|
30
|
+
<GlobalStyle globalStyle={globalStyle} />
|
|
31
|
+
<ModalStyle />
|
|
32
|
+
<PopoverStyle />
|
|
33
|
+
{children}
|
|
34
|
+
</>
|
|
33
35
|
</ThemeProvider>
|
|
34
36
|
)
|
|
35
37
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
import { IconDefinition } from '../../types'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
details: [32, 32, [], '', ['M31.1111 9.4375L29.7778 8.125C28.6111 6.97656 26.8333 6.97656 25.6667 8.125L16.8333 16.7656C15.1667 18.4062 14.2222 20.7031 14.2222 23C14 23 13.7778 22.8906 13.6667 22.6719C13 21.3594 11.1111 21.0312 10 21.9062L9.22222 19.6094C9.05556 19.0625 8.55556 18.7344 8 18.7344C7.38889 18.7344 6.88889 19.0625 6.72222 19.6094L5.72222 22.6172C5.61111 22.8359 5.38889 23 5.11111 23H4.44444C3.94444 23 3.55556 23.4375 3.55556 23.875C3.55556 24.3672 3.94444 24.75 4.44444 24.75H5.11111C6.16667 24.75 7.05556 24.1484 7.38889 23.1641L8 21.4141L8.88889 24.1484C9.16667 24.9141 10.2222 24.9688 10.5556 24.3125L11 23.4375C11.2222 23 11.8333 23 12.1111 23.4922C12.5 24.2578 13.2778 24.75 14.2222 24.75H16C19.6667 24.75 22.2222 22.2344 22.3333 22.1797L31.1111 13.4844C31.6667 12.9375 32 12.2266 32 11.4609C32 10.6953 31.6667 9.98438 31.1111 9.4375ZM21.0556 20.9219C19.7222 22.2891 17.8889 23 16 23C16 21.1406 16.7222 19.3359 18.0556 18.0234L24.7222 11.4609L27.6667 14.3594L21.0556 20.9219ZM29.8889 12.2266L28.7222 13.375L25.7778 10.4766L26.9444 9.32812C27.3889 8.94531 28.0556 8.94531 28.5 9.32812L29.8889 10.6953C30.2778 11.1328 30.2778 11.7891 29.8889 12.2266ZM20.2222 26.5C19.8333 26.5 19.5 26.7188 19.3889 27.1016C19.1111 27.7578 18.5 28.25 17.6667 28.25H3.44444C2.5 28.25 1.72222 27.4844 1.72222 26.5V5.5C1.72222 4.57031 2.5 3.75 3.44444 3.75H10.5556V9.875C10.5556 11.3516 11.7222 12.5 13.2222 12.5H16.7778C17.2778 12.5 17.6667 12.1172 17.6667 11.6797V11.625C17.6667 11.1328 17.2778 10.75 16.8333 10.75H13.2778C12.7778 10.75 12.3889 10.3672 12.3889 9.875V3.91406C12.6111 3.96875 12.8333 4.07812 13.0556 4.29688L18.0556 9.21875C18.3889 9.54688 18.9444 9.54688 19.2778 9.21875C19.6111 8.83594 19.6111 8.34375 19.2778 7.96094L14.2778 3.03906C13.6111 2.38281 12.7222 2 11.7778 2H3.5C1.55556 2 0 3.58594 0 5.5V26.5C0 28.4688 1.55556 30 3.5 30H17.6667C19.2778 30 20.6111 29.0156 21.0556 27.6484C21.2222 27.1016 20.7778 26.5 20.2222 26.5Z']],
|
|
7
|
+
name: 'falFileSignature'
|
|
8
|
+
} as IconDefinition
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
import { IconDefinition } from '../../types'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
details: [32, 32, [], '', ['M9.31914 32C7.25189 32 5.18458 31.2131 3.61083 29.6393C0.463078 26.4918 0.463078 21.3703 3.6107 18.2228L19.9901 1.84364C22.4483 -0.614547 26.4481 -0.614547 28.9064 1.84364C31.3646 4.30189 31.3646 8.30158 28.9064 10.7597L14.992 24.6738C13.2235 26.4426 10.3453 26.4428 8.57639 24.6738C6.80764 22.905 6.80764 20.027 8.57639 18.2583L19.2202 7.61464C19.5131 7.32177 19.988 7.32177 20.2808 7.61464L20.6346 7.96845C20.9275 8.26133 20.9275 8.7362 20.6346 9.02914L9.99089 19.6727C9.00208 20.6615 9.00208 22.2704 9.99095 23.2593C10.9798 24.248 12.5887 24.248 13.5775 23.2593L27.4919 9.34514C29.1701 7.66695 29.1701 4.93633 27.4919 3.25802C25.8135 1.57983 23.0829 1.57995 21.4047 3.25802L5.02527 19.6373C2.65764 22.0049 2.65764 25.8572 5.02527 28.2248C7.39302 30.5924 11.2455 30.5925 13.613 28.2249L27.222 14.6162C27.5148 14.3233 27.9897 14.3233 28.2826 14.6162L28.6364 14.97C28.9293 15.2629 28.9293 15.7378 28.6364 16.0307L15.0275 29.6393C13.4538 31.2131 11.3865 32 9.31914 32Z']],
|
|
7
|
+
name: 'falPaperclip'
|
|
8
|
+
} as IconDefinition
|
|
@@ -83,12 +83,12 @@ export { default as falArrowFromRight } from './fal/falArrowFromRight'
|
|
|
83
83
|
export { default as falArrowFromTop } from './fal/falArrowFromTop'
|
|
84
84
|
export { default as falArrowLeft } from './fal/falArrowLeft'
|
|
85
85
|
export { default as falArrowRight } from './fal/falArrowRight'
|
|
86
|
+
export { default as falArrows } from './fal/falArrows'
|
|
86
87
|
export { default as falArrowToBottom } from './fal/falArrowToBottom'
|
|
87
88
|
export { default as falArrowToLeft } from './fal/falArrowToLeft'
|
|
88
89
|
export { default as falArrowToRight } from './fal/falArrowToRight'
|
|
89
90
|
export { default as falArrowToTop } from './fal/falArrowToTop'
|
|
90
91
|
export { default as falArrowUp } from './fal/falArrowUp'
|
|
91
|
-
export { default as falArrows } from './fal/falArrows'
|
|
92
92
|
export { default as falAward } from './fal/falAward'
|
|
93
93
|
export { default as falBan } from './fal/falBan'
|
|
94
94
|
export { default as falBars } from './fal/falBars'
|
|
@@ -175,6 +175,7 @@ export { default as falFileInvoiceDollar } from './fal/falFileInvoiceDollar'
|
|
|
175
175
|
export { default as falFilePdf } from './fal/falFilePdf'
|
|
176
176
|
export { default as falFilePlus } from './fal/falFilePlus'
|
|
177
177
|
export { default as falFilePowerpoint } from './fal/falFilePowerpoint'
|
|
178
|
+
export { default as falFileSignature } from './fal/falFileSignature'
|
|
178
179
|
export { default as falFileSpreadsheet } from './fal/falFileSpreadsheet'
|
|
179
180
|
export { default as falFileVideo } from './fal/falFileVideo'
|
|
180
181
|
export { default as falFileWord } from './fal/falFileWord'
|
|
@@ -209,6 +210,7 @@ export { default as falMapMarkerAltSlash } from './fal/falMapMarkerAltSlash'
|
|
|
209
210
|
export { default as falMapMarkerCheck } from './fal/falMapMarkerCheck'
|
|
210
211
|
export { default as falMapMarkerExclamation } from './fal/falMapMarkerExclamation'
|
|
211
212
|
export { default as falMinus } from './fal/falMinus'
|
|
213
|
+
export { default as falPaperclip } from './fal/falPaperclip'
|
|
212
214
|
export { default as falPause } from './fal/falPause'
|
|
213
215
|
export { default as falPauseCircle } from './fal/falPauseCircle'
|
|
214
216
|
export { default as falPen } from './fal/falPen'
|
|
@@ -271,10 +273,10 @@ export { default as falUserCog } from './fal/falUserCog'
|
|
|
271
273
|
export { default as falUserEdit } from './fal/falUserEdit'
|
|
272
274
|
export { default as falUserFriends } from './fal/falUserFriends'
|
|
273
275
|
export { default as falUserPlus } from './fal/falUserPlus'
|
|
274
|
-
export { default as falUserShield } from './fal/falUserShield'
|
|
275
|
-
export { default as falUserTimes } from './fal/falUserTimes'
|
|
276
276
|
export { default as falUsers } from './fal/falUsers'
|
|
277
277
|
export { default as falUsersClass } from './fal/falUsersClass'
|
|
278
|
+
export { default as falUserShield } from './fal/falUserShield'
|
|
279
|
+
export { default as falUserTimes } from './fal/falUserTimes'
|
|
278
280
|
export { default as falWater } from './fal/falWater'
|
|
279
281
|
export { default as falWind } from './fal/falWind'
|
|
280
282
|
export { default as falWindTurbine } from './fal/falWindTurbine'
|
|
@@ -84,12 +84,12 @@ export type BaseIcon =
|
|
|
84
84
|
| 'falArrowFromTop'
|
|
85
85
|
| 'falArrowLeft'
|
|
86
86
|
| 'falArrowRight'
|
|
87
|
+
| 'falArrows'
|
|
87
88
|
| 'falArrowToBottom'
|
|
88
89
|
| 'falArrowToLeft'
|
|
89
90
|
| 'falArrowToRight'
|
|
90
91
|
| 'falArrowToTop'
|
|
91
92
|
| 'falArrowUp'
|
|
92
|
-
| 'falArrows'
|
|
93
93
|
| 'falAward'
|
|
94
94
|
| 'falBan'
|
|
95
95
|
| 'falBars'
|
|
@@ -176,6 +176,7 @@ export type BaseIcon =
|
|
|
176
176
|
| 'falFilePdf'
|
|
177
177
|
| 'falFilePlus'
|
|
178
178
|
| 'falFilePowerpoint'
|
|
179
|
+
| 'falFileSignature'
|
|
179
180
|
| 'falFileSpreadsheet'
|
|
180
181
|
| 'falFileVideo'
|
|
181
182
|
| 'falFileWord'
|
|
@@ -210,6 +211,7 @@ export type BaseIcon =
|
|
|
210
211
|
| 'falMapMarkerCheck'
|
|
211
212
|
| 'falMapMarkerExclamation'
|
|
212
213
|
| 'falMinus'
|
|
214
|
+
| 'falPaperclip'
|
|
213
215
|
| 'falPause'
|
|
214
216
|
| 'falPauseCircle'
|
|
215
217
|
| 'falPen'
|
|
@@ -272,10 +274,10 @@ export type BaseIcon =
|
|
|
272
274
|
| 'falUserEdit'
|
|
273
275
|
| 'falUserFriends'
|
|
274
276
|
| 'falUserPlus'
|
|
275
|
-
| 'falUserShield'
|
|
276
|
-
| 'falUserTimes'
|
|
277
277
|
| 'falUsers'
|
|
278
278
|
| 'falUsersClass'
|
|
279
|
+
| 'falUserShield'
|
|
280
|
+
| 'falUserTimes'
|
|
279
281
|
| 'falWater'
|
|
280
282
|
| 'falWind'
|
|
281
283
|
| 'falWindTurbine'
|
package/src/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ export * from './pagination'
|
|
|
25
25
|
export * from './panel'
|
|
26
26
|
export * from './popover'
|
|
27
27
|
export * from './portal'
|
|
28
|
+
export * from './progress'
|
|
28
29
|
export * from './radio'
|
|
29
30
|
export * from './select'
|
|
30
31
|
export * from './skeleton'
|
|
@@ -36,6 +37,7 @@ export * from './t'
|
|
|
36
37
|
export * from './toast'
|
|
37
38
|
export * from './tooltip'
|
|
38
39
|
export * from './table'
|
|
40
|
+
export * from './tabs'
|
|
39
41
|
export * from './tag'
|
|
40
42
|
export * from './textarea'
|
|
41
43
|
export * from './theme'
|
package/src/modal/modal.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { cloneElement, useRef } from 'react'
|
|
2
|
-
import { RemoveScroll } from 'react-remove-scroll'
|
|
3
2
|
|
|
4
3
|
import Box from '../box'
|
|
5
4
|
import { vui, VuiComponent } from '../core'
|
|
@@ -46,7 +45,7 @@ export const Modal = vui<'div', ModalProps>((props, ref) => {
|
|
|
46
45
|
const modalRef = useRef<HTMLElement>(null)
|
|
47
46
|
const mouseDownTarget = useRef<EventTarget | null>(null)
|
|
48
47
|
|
|
49
|
-
useModalManager(modalRef, isOpen)
|
|
48
|
+
useModalManager(modalRef, isOpen, disableScrollLock)
|
|
50
49
|
|
|
51
50
|
if (!isOpen) return null
|
|
52
51
|
|
|
@@ -73,9 +72,7 @@ export const Modal = vui<'div', ModalProps>((props, ref) => {
|
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
74
|
|
|
76
|
-
const onMouseDown = (e: MouseEvent) =>
|
|
77
|
-
mouseDownTarget.current = e.target
|
|
78
|
-
}
|
|
75
|
+
const onMouseDown = (e: MouseEvent) => (mouseDownTarget.current = e.target)
|
|
79
76
|
|
|
80
77
|
const childProps = {
|
|
81
78
|
onClick: (e: any) => {
|
|
@@ -106,14 +103,7 @@ export const Modal = vui<'div', ModalProps>((props, ref) => {
|
|
|
106
103
|
isDisabled={disableTrapFocus}
|
|
107
104
|
returnFocus={!disableReturnFocus}
|
|
108
105
|
>
|
|
109
|
-
<
|
|
110
|
-
allowPinchZoom={allowPinchZoom}
|
|
111
|
-
enabled={!disableScrollLock}
|
|
112
|
-
forwardProps
|
|
113
|
-
removeScrollBar={!preserveScrollBar}
|
|
114
|
-
>
|
|
115
|
-
<ModalContent {...contentProps}>{cloneElement(children, childProps)}</ModalContent>
|
|
116
|
-
</RemoveScroll>
|
|
106
|
+
<ModalContent {...contentProps}>{cloneElement(children, childProps)}</ModalContent>
|
|
117
107
|
</FocusLock>
|
|
118
108
|
</Box>
|
|
119
109
|
</Portal>
|
|
@@ -21,12 +21,16 @@ class ModalManager {
|
|
|
21
21
|
export const manager = new ModalManager()
|
|
22
22
|
|
|
23
23
|
/** Refs of new modals will be automatically added/removed from the state when rendering. */
|
|
24
|
-
export function useModalManager(ref: Ref<any>, isOpen?: boolean) {
|
|
24
|
+
export function useModalManager(ref: Ref<any>, isOpen?: boolean, disableScrollLock?: boolean) {
|
|
25
25
|
useEffect(() => {
|
|
26
|
-
|
|
26
|
+
if (isOpen) {
|
|
27
|
+
manager.add(ref)
|
|
28
|
+
if (!disableScrollLock) document.body.classList.add('no-scroll')
|
|
29
|
+
}
|
|
27
30
|
|
|
28
31
|
return () => {
|
|
29
32
|
manager.remove(ref)
|
|
33
|
+
if (!disableScrollLock) document.body.classList.remove('no-scroll')
|
|
30
34
|
}
|
|
31
35
|
}, [isOpen, ref])
|
|
32
36
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import { Box } from '../box'
|
|
4
|
+
import { styled, useStyleConfig, vui } from '../core'
|
|
5
|
+
import { cs } from '../utils'
|
|
6
|
+
import { ProgressProps } from './progress.types'
|
|
7
|
+
|
|
8
|
+
export const ProgressBase = styled.divBox`
|
|
9
|
+
display: flex;
|
|
10
|
+
width: 100%;
|
|
11
|
+
`
|
|
12
|
+
|
|
13
|
+
const minPercentageDisplay = 3
|
|
14
|
+
|
|
15
|
+
/** Indicates a process progress. */
|
|
16
|
+
export const Progress = vui<'div', ProgressProps>((props, ref) => {
|
|
17
|
+
const { className, size = 'md', value = 0, max = 100, showPercentage, ...rest } = props
|
|
18
|
+
|
|
19
|
+
const [width, setWidth] = useState(0)
|
|
20
|
+
|
|
21
|
+
const styles = useStyleConfig('Progress', props)
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const w = !value ? 0 : Math.ceil((value / max) * 100)
|
|
25
|
+
setWidth(w > 100 ? 100 : w)
|
|
26
|
+
}, [value, max])
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<ProgressBase
|
|
30
|
+
className={cs('vui-progress', className)}
|
|
31
|
+
ref={ref}
|
|
32
|
+
{...styles.container}
|
|
33
|
+
{...rest}
|
|
34
|
+
bg="grey.10"
|
|
35
|
+
borderRadius="sm"
|
|
36
|
+
h={1}
|
|
37
|
+
>
|
|
38
|
+
<Box
|
|
39
|
+
bg="prussian.80"
|
|
40
|
+
borderRadius="sm"
|
|
41
|
+
position="relative"
|
|
42
|
+
textAlign="right"
|
|
43
|
+
transition="width 0.4s ease-in-out;"
|
|
44
|
+
w={`${width}%`}
|
|
45
|
+
>
|
|
46
|
+
{showPercentage && value >= minPercentageDisplay && (
|
|
47
|
+
<Box {...styles.percentage} position="absolute" right="0">{`${width}%`}</Box>
|
|
48
|
+
)}
|
|
49
|
+
</Box>
|
|
50
|
+
</ProgressBase>
|
|
51
|
+
)
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
export default Progress
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const baseStyle = {}
|
|
2
|
+
|
|
3
|
+
const defaultProps = {
|
|
4
|
+
size: 'md'
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const sizes = {
|
|
8
|
+
sm: {
|
|
9
|
+
container: {
|
|
10
|
+
minH: '4px'
|
|
11
|
+
},
|
|
12
|
+
percentage: {
|
|
13
|
+
fontSize: '80%',
|
|
14
|
+
top: '-16px'
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
md: {
|
|
18
|
+
container: {
|
|
19
|
+
minH: '8px'
|
|
20
|
+
},
|
|
21
|
+
percentage: {
|
|
22
|
+
fontSize: '100%',
|
|
23
|
+
top: '-20px'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
lg: {
|
|
27
|
+
container: {
|
|
28
|
+
minH: '12px'
|
|
29
|
+
},
|
|
30
|
+
percentage: {
|
|
31
|
+
fontSize: '110%',
|
|
32
|
+
top: '-22px'
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
xl: {
|
|
36
|
+
container: {
|
|
37
|
+
minH: '16px'
|
|
38
|
+
},
|
|
39
|
+
percentage: {
|
|
40
|
+
fontSize: '120%',
|
|
41
|
+
top: '-24px'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const variants = {}
|
|
47
|
+
|
|
48
|
+
export default {
|
|
49
|
+
baseStyle,
|
|
50
|
+
defaultProps,
|
|
51
|
+
sizes,
|
|
52
|
+
variants
|
|
53
|
+
}
|
package/src/tabs/tab.tsx
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { styled, vui } from '../core'
|
|
4
|
+
import { cs } from '../utils'
|
|
5
|
+
import { TabProps } from './tabs.types'
|
|
6
|
+
|
|
7
|
+
export const TabBase = styled.divBox`
|
|
8
|
+
width: 100%;
|
|
9
|
+
`
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Implements a Tab component
|
|
13
|
+
*/
|
|
14
|
+
export const Tab = vui<'div', TabProps>((props, ref) => {
|
|
15
|
+
const { children, className } = props
|
|
16
|
+
return (
|
|
17
|
+
<TabBase className={cs('vui-tab', className)} ref={ref}>
|
|
18
|
+
{children}
|
|
19
|
+
</TabBase>
|
|
20
|
+
)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export default Tab
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React, { ReactElement, useEffect } from 'react'
|
|
2
|
+
|
|
3
|
+
import { styled, useStyleConfig, vui } from '../core'
|
|
4
|
+
import { P } from '../p'
|
|
5
|
+
import { cs } from '../utils'
|
|
6
|
+
import Tab from './tab'
|
|
7
|
+
import { TabProps, TabsProps } from './tabs.types'
|
|
8
|
+
import TabsNavBar from './tabsNavBar'
|
|
9
|
+
import { useTabsState } from './useTabsState'
|
|
10
|
+
|
|
11
|
+
export const TabsBase = styled.divBox<TabsProps>`
|
|
12
|
+
width: 100%;
|
|
13
|
+
`
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Implements Tabs navigation to switch between views.
|
|
17
|
+
*/
|
|
18
|
+
export const Tabs = vui<'div', TabsProps>((props, ref) => {
|
|
19
|
+
const { activeTabId, children, className, size, onTabClick, ...rest } = props
|
|
20
|
+
const styles = useStyleConfig('Tabs', props)
|
|
21
|
+
const { tabs, setTabs, activeTabIndex, setActiveTabIndex, animationDirection, setAnimationDirection } = useTabsState(
|
|
22
|
+
'fadeIn',
|
|
23
|
+
activeTabId
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
const t: TabProps[] = []
|
|
28
|
+
if (children) {
|
|
29
|
+
;(children as ReactElement[]).forEach((child: ReactElement<TabProps>, index: number) => {
|
|
30
|
+
if (child?.props?.title) {
|
|
31
|
+
t.push({
|
|
32
|
+
id: index,
|
|
33
|
+
title: child.props.title,
|
|
34
|
+
children: child.props.children,
|
|
35
|
+
disabled: child.props.disabled,
|
|
36
|
+
onClick: child.props.onClick
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
setTabs(t)
|
|
42
|
+
if (activeTabId !== undefined && tabs?.[activeTabId]) {
|
|
43
|
+
setActiveTabIndex(activeTabId)
|
|
44
|
+
}
|
|
45
|
+
}, [children, activeTabId])
|
|
46
|
+
|
|
47
|
+
const onNavItemClick = (id: number) => {
|
|
48
|
+
setAnimationDirection(id < activeTabIndex ? 'fadeLeft' : 'fadeRight')
|
|
49
|
+
setActiveTabIndex(id)
|
|
50
|
+
onTabClick?.(id)
|
|
51
|
+
tabs.find(t => t.id === id)?.onClick?.()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const activeTab = tabs?.[activeTabIndex]
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<TabsBase className={cs('vui-tabs', className)} ref={ref} {...styles.container} {...rest}>
|
|
58
|
+
{!!tabs?.length && (
|
|
59
|
+
<TabsNavBar
|
|
60
|
+
activeNavItem={activeTabIndex}
|
|
61
|
+
animationDirection={animationDirection}
|
|
62
|
+
onNavItemClick={onNavItemClick}
|
|
63
|
+
size={size}
|
|
64
|
+
tabs={tabs}
|
|
65
|
+
/>
|
|
66
|
+
)}
|
|
67
|
+
{tabs?.length ? (
|
|
68
|
+
<Tab onClick={activeTab?.onClick} title={activeTab?.title}>
|
|
69
|
+
{!activeTab?.disabled && activeTab?.children}
|
|
70
|
+
</Tab>
|
|
71
|
+
) : (
|
|
72
|
+
<P p={2}>Please specify Tabs.</P>
|
|
73
|
+
)}
|
|
74
|
+
</TabsBase>
|
|
75
|
+
)
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
export default Tabs
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ReactNode } from 'react'
|
|
2
|
+
|
|
3
|
+
import { SystemProps } from '../system'
|
|
4
|
+
import { ThemingProps } from '../theme'
|
|
5
|
+
|
|
6
|
+
export type AnimationDirection = 'fadeLeft' | 'fadeRight' | 'fadeIn'
|
|
7
|
+
|
|
8
|
+
export type TabsSize = 'md' | 'sm' | 'lg' | 'xl'
|
|
9
|
+
|
|
10
|
+
export type TabsProps = SystemProps &
|
|
11
|
+
ThemingProps<'Tabs'> & {
|
|
12
|
+
activeTabId?: number
|
|
13
|
+
children?: ReactNode | ReactNode[]
|
|
14
|
+
onTabClick?: (id: number) => void
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type TabProps = SystemProps & {
|
|
18
|
+
id?: number
|
|
19
|
+
title: ReactNode
|
|
20
|
+
children?: ReactNode
|
|
21
|
+
disabled?: boolean
|
|
22
|
+
onClick?: () => void
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type TabNavBarProps = {
|
|
26
|
+
tabs: TabProps[]
|
|
27
|
+
onNavItemClick: (id: number) => void
|
|
28
|
+
activeNavItem?: number
|
|
29
|
+
animationDirection?: AnimationDirection
|
|
30
|
+
size?: TabsSize
|
|
31
|
+
}
|