@veracity/vui 1.1.1 → 1.1.3
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/cjs/core/index.d.ts +1 -0
- package/dist/cjs/core/index.d.ts.map +1 -1
- package/dist/cjs/core/index.js +1 -0
- package/dist/cjs/core/media.d.ts +4 -3
- package/dist/cjs/core/media.d.ts.map +1 -1
- package/dist/cjs/core/types.d.ts +5 -0
- package/dist/cjs/core/types.d.ts.map +1 -0
- package/dist/cjs/core/types.js +2 -0
- package/dist/cjs/core/vuiProvider/vuiProvider.d.ts +2 -1
- package/dist/cjs/core/vuiProvider/vuiProvider.d.ts.map +1 -1
- package/dist/cjs/core/vuiProvider/vuiProvider.js +8 -8
- package/dist/cjs/modal/focusLock.d.ts +2 -1
- package/dist/cjs/modal/focusLock.d.ts.map +1 -1
- 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/portal/portal.d.ts +2 -1
- package/dist/cjs/portal/portal.d.ts.map +1 -1
- package/dist/cjs/tabs/tabs.d.ts +0 -1
- package/dist/cjs/tabs/tabs.d.ts.map +1 -1
- package/dist/cjs/tabs/tabs.js +3 -5
- package/dist/cjs/tabs/tabs.types.d.ts +0 -3
- package/dist/cjs/tabs/tabs.types.d.ts.map +1 -1
- package/dist/cjs/tabs/tabsNavBar.d.ts.map +1 -1
- package/dist/cjs/tabs/tabsNavBar.js +3 -3
- package/dist/esm/core/index.d.ts +1 -0
- package/dist/esm/core/index.d.ts.map +1 -1
- package/dist/esm/core/index.js +1 -0
- package/dist/esm/core/media.d.ts +4 -3
- package/dist/esm/core/media.d.ts.map +1 -1
- package/dist/esm/core/types.d.ts +5 -0
- package/dist/esm/core/types.d.ts.map +1 -0
- package/dist/esm/core/types.js +1 -0
- package/dist/esm/core/vuiProvider/vuiProvider.d.ts +2 -1
- package/dist/esm/core/vuiProvider/vuiProvider.d.ts.map +1 -1
- package/dist/esm/core/vuiProvider/vuiProvider.js +8 -8
- package/dist/esm/modal/focusLock.d.ts +2 -1
- package/dist/esm/modal/focusLock.d.ts.map +1 -1
- 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/portal/portal.d.ts +2 -1
- package/dist/esm/portal/portal.d.ts.map +1 -1
- package/dist/esm/tabs/tabs.d.ts +0 -1
- package/dist/esm/tabs/tabs.d.ts.map +1 -1
- package/dist/esm/tabs/tabs.js +3 -5
- package/dist/esm/tabs/tabs.types.d.ts +0 -3
- package/dist/esm/tabs/tabs.types.d.ts.map +1 -1
- package/dist/esm/tabs/tabsNavBar.d.ts.map +1 -1
- package/dist/esm/tabs/tabsNavBar.js +3 -3
- package/package.json +1 -2
- package/src/core/index.ts +1 -0
- package/src/core/media.tsx +4 -3
- package/src/core/types.ts +5 -0
- package/src/core/vuiProvider/vuiProvider.tsx +14 -13
- package/src/modal/focusLock.tsx +2 -1
- package/src/modal/modal.tsx +3 -13
- package/src/modal/modalManager.ts +6 -2
- package/src/modal/modalStyle.ts +9 -0
- package/src/portal/portal.tsx +2 -1
- package/src/tabs/tabs.tsx +4 -14
- package/src/tabs/tabs.types.ts +0 -3
- package/src/tabs/tabsNavBar.tsx +3 -5
package/dist/cjs/core/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA;AACrB,cAAc,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA;AACrB,cAAc,eAAe,CAAA"}
|
package/dist/cjs/core/index.js
CHANGED
|
@@ -19,5 +19,6 @@ __exportStar(require("./links"), exports);
|
|
|
19
19
|
__exportStar(require("./media"), exports);
|
|
20
20
|
__exportStar(require("./styled"), exports);
|
|
21
21
|
__exportStar(require("./theme"), exports);
|
|
22
|
+
__exportStar(require("./types"), exports);
|
|
22
23
|
__exportStar(require("./vui"), exports);
|
|
23
24
|
__exportStar(require("./vuiProvider"), exports);
|
package/dist/cjs/core/media.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { FC } from 'react';
|
|
|
2
2
|
import { StyledProps } from 'styled-components';
|
|
3
3
|
import { Screen } from '../theme';
|
|
4
4
|
import { AnyNumber, AnyString } from '../utils';
|
|
5
|
+
import { ChildrenProp } from './types';
|
|
5
6
|
declare type ScreenWidth = Screen | AnyNumber | AnyString;
|
|
6
7
|
export declare type RenderOnScreenProps = {
|
|
7
8
|
/** Changes direction to below the breakpoint. */
|
|
@@ -16,14 +17,14 @@ export declare const mediaDown: (width: ScreenWidth) => (props: StyledProps<unkn
|
|
|
16
17
|
/** Returns CSS media string with appropriate min-width value. */
|
|
17
18
|
export declare const mediaUp: (width: ScreenWidth) => (props: StyledProps<unknown>) => string;
|
|
18
19
|
/** Renders its content when viewport width is at or above 'md' breakpoint (default: 960px and more). */
|
|
19
|
-
export declare const RenderOnDesktop: FC<RenderOnScreenProps>;
|
|
20
|
+
export declare const RenderOnDesktop: FC<RenderOnScreenProps & ChildrenProp>;
|
|
20
21
|
/** Renders its content when viewport width is below 'md' breakpoint (default: below 960px). */
|
|
21
|
-
export declare const RenderOnMobile: FC<RenderOnScreenProps>;
|
|
22
|
+
export declare const RenderOnMobile: FC<RenderOnScreenProps & ChildrenProp>;
|
|
22
23
|
/**
|
|
23
24
|
* Renders its content when viewport width is at or above a provided breakpoint.
|
|
24
25
|
* Optionally, direction can be set to down, or below, the breakpoint.
|
|
25
26
|
*/
|
|
26
|
-
export declare const RenderOnScreen: FC<RenderOnScreenProps>;
|
|
27
|
+
export declare const RenderOnScreen: FC<RenderOnScreenProps & ChildrenProp>;
|
|
27
28
|
/** Returns true if current viewport width is between provided min and max widths. */
|
|
28
29
|
export declare function useBetween(minWidth: ScreenWidth, maxWidth: ScreenWidth): boolean;
|
|
29
30
|
/** Returns true if current viewport width is smaller than provided width. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/core/media.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/core/media.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,aAAK,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;AAEjD,oBAAY,mBAAmB,GAAG;IAChC,iDAAiD;IACjD,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,gFAAgF;AAChF,eAAO,MAAM,YAAY,aAAc,WAAW,YAAY,WAAW,aAAa,YAAY,OAAO,CAAC,WACN,CAAA;AAEpG,gEAAgE;AAChE,eAAO,MAAM,SAAS,UAAW,WAAW,aAAa,YAAY,OAAO,CAAC,WAE5E,CAAA;AAED,iEAAiE;AACjE,eAAO,MAAM,OAAO,UAAW,WAAW,aAAa,YAAY,OAAO,CAAC,WACzB,CAAA;AAElD,wGAAwG;AACxG,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,mBAAmB,GAAG,YAAY,CAA0C,CAAA;AAE7G,+FAA+F;AAC/F,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,GAAG,YAAY,CAAiD,CAAA;AAEnH;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,GAAG,YAAY,CAGjE,CAAA;AAED,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,WAKtE;AAED,6EAA6E;AAC7E,wBAAgB,OAAO,CAAC,KAAK,EAAE,WAAW,WAIzC;AAED,oEAAoE;AACpE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,WAAW;;;EAO1C;AAED,wFAAwF;AACxF,wBAAgB,KAAK,CAAC,KAAK,EAAE,WAAW,WAIvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAE3E,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC,OAAO,GAAG,aAAa,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,IAAI,CAAA;CACvG"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { VuiTheme } from '../../theme';
|
|
3
|
+
import { ChildrenProp } from '../types';
|
|
3
4
|
declare type VuiProviderProps = {
|
|
4
5
|
/** Adds basic styles to body @default true */
|
|
5
6
|
globalStyle?: boolean;
|
|
@@ -9,6 +10,6 @@ declare type VuiProviderProps = {
|
|
|
9
10
|
theme?: VuiTheme;
|
|
10
11
|
};
|
|
11
12
|
/** Provides theme to all wrapped components and by default includes CSS reset and global styles. */
|
|
12
|
-
declare const VuiProvider: FC<VuiProviderProps>;
|
|
13
|
+
declare const VuiProvider: FC<VuiProviderProps & ChildrenProp>;
|
|
13
14
|
export default VuiProvider;
|
|
14
15
|
//# sourceMappingURL=vuiProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vuiProvider.d.ts","sourceRoot":"","sources":["../../../../src/core/vuiProvider/vuiProvider.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"vuiProvider.d.ts","sourceRoot":"","sources":["../../../../src/core/vuiProvider/vuiProvider.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAKjC,OAAqB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAIvC,aAAK,gBAAgB,GAAG;IACtB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,wDAAwD;IACxD,KAAK,CAAC,EAAE,QAAQ,CAAA;CACjB,CAAA;AAED,oGAAoG;AACpG,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,GAAG,YAAY,CAepD,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -5,17 +5,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const styled_components_1 = require("styled-components");
|
|
8
|
+
const modalStyle_1 = __importDefault(require("../../modal/modalStyle"));
|
|
8
9
|
const popoverStyle_1 = __importDefault(require("../../popover/popoverStyle"));
|
|
9
10
|
const theme_1 = __importDefault(require("../../theme"));
|
|
10
11
|
const globalStyle_1 = __importDefault(require("./globalStyle"));
|
|
11
12
|
const resetCSS_1 = __importDefault(require("./resetCSS"));
|
|
12
13
|
/** Provides theme to all wrapped components and by default includes CSS reset and global styles. */
|
|
13
|
-
const VuiProvider = ({ children, globalStyle = true, resetCSS = true, theme = theme_1.default }) => {
|
|
14
|
-
|
|
15
|
-
react_1.default.createElement(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
14
|
+
const VuiProvider = ({ children, globalStyle = true, resetCSS = true, theme = theme_1.default }) => (react_1.default.createElement(styled_components_1.ThemeProvider, { theme: theme },
|
|
15
|
+
react_1.default.createElement(react_1.default.Fragment, null,
|
|
16
|
+
resetCSS && react_1.default.createElement(resetCSS_1.default, null),
|
|
17
|
+
react_1.default.createElement(globalStyle_1.default, { globalStyle: globalStyle }),
|
|
18
|
+
react_1.default.createElement(modalStyle_1.default, null),
|
|
19
|
+
react_1.default.createElement(popoverStyle_1.default, null),
|
|
20
|
+
children)));
|
|
21
21
|
exports.default = VuiProvider;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
+
import { ChildrenProp } from '../core/types';
|
|
2
3
|
import { FocusLockProps } from './focusLock.types';
|
|
3
4
|
/**
|
|
4
5
|
* Traps the focus within the provided content. That is, tabbing with keyboard will
|
|
5
6
|
* only cycle through the children and won't leave the boundary of the FocusLock.
|
|
6
7
|
* This behavior enhances accessibility of the Modal component.
|
|
7
8
|
*/
|
|
8
|
-
export declare const FocusLock: FC<FocusLockProps>;
|
|
9
|
+
export declare const FocusLock: FC<FocusLockProps & ChildrenProp>;
|
|
9
10
|
export default FocusLock;
|
|
10
11
|
//# sourceMappingURL=focusLock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focusLock.d.ts","sourceRoot":"","sources":["../../../src/modal/focusLock.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAe,MAAM,OAAO,CAAA;AAG9C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"focusLock.d.ts","sourceRoot":"","sources":["../../../src/modal/focusLock.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAe,MAAM,OAAO,CAAA;AAG9C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,GAAG,YAAY,CAmCvD,CAAA;AAED,eAAe,SAAS,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/modal/modal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/modal/modal.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAO,YAAY,EAAE,MAAM,SAAS,CAAA;AAK3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAC3C,OAAO,YAAY,MAAM,gBAAgB,CAAA;AAGzC;;;;;GAKG;AACH,eAAO,MAAM,KAAK;cA6FN,oBAAoB;aACrB,mBAAmB;CAC7B,CAAA;AAKD,eAAe,KAAK,CAAA"}
|
package/dist/cjs/modal/modal.js
CHANGED
|
@@ -39,7 +39,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
exports.Modal = void 0;
|
|
41
41
|
const react_1 = __importStar(require("react"));
|
|
42
|
-
const react_remove_scroll_1 = require("react-remove-scroll");
|
|
43
42
|
const box_1 = __importDefault(require("../box"));
|
|
44
43
|
const core_1 = require("../core");
|
|
45
44
|
const portal_1 = __importDefault(require("../portal"));
|
|
@@ -60,7 +59,7 @@ exports.Modal = (0, core_1.vui)((props, ref) => {
|
|
|
60
59
|
const { allowPinchZoom, children, className, contentProps, disableAutoFocus, disableBackdropClose, disableEscClose, disablePortal, disableReturnFocus, disableScrollLock, disableTrapFocus, finalFocusRef, hideBackdrop, initialFocusRef, isOpen, onBackdropClick: onBackdropClickProp, onClose, onEsc, preserveScrollBar, size, variant } = props, rest = __rest(props, ["allowPinchZoom", "children", "className", "contentProps", "disableAutoFocus", "disableBackdropClose", "disableEscClose", "disablePortal", "disableReturnFocus", "disableScrollLock", "disableTrapFocus", "finalFocusRef", "hideBackdrop", "initialFocusRef", "isOpen", "onBackdropClick", "onClose", "onEsc", "preserveScrollBar", "size", "variant"]);
|
|
61
60
|
const modalRef = (0, react_1.useRef)(null);
|
|
62
61
|
const mouseDownTarget = (0, react_1.useRef)(null);
|
|
63
|
-
(0, modalManager_1.useModalManager)(modalRef, isOpen);
|
|
62
|
+
(0, modalManager_1.useModalManager)(modalRef, isOpen, disableScrollLock);
|
|
64
63
|
if (!isOpen)
|
|
65
64
|
return null;
|
|
66
65
|
const onBackdropClick = (e) => {
|
|
@@ -80,9 +79,7 @@ exports.Modal = (0, core_1.vui)((props, ref) => {
|
|
|
80
79
|
onEsc === null || onEsc === void 0 ? void 0 : onEsc();
|
|
81
80
|
}
|
|
82
81
|
};
|
|
83
|
-
const onMouseDown = (e) =>
|
|
84
|
-
mouseDownTarget.current = e.target;
|
|
85
|
-
};
|
|
82
|
+
const onMouseDown = (e) => (mouseDownTarget.current = e.target);
|
|
86
83
|
const childProps = {
|
|
87
84
|
onClick: (e) => {
|
|
88
85
|
var _a, _b;
|
|
@@ -97,8 +94,7 @@ exports.Modal = (0, core_1.vui)((props, ref) => {
|
|
|
97
94
|
react_1.default.createElement(box_1.default, Object.assign({ className: (0, utils_1.cs)('vui-modal', className), ref: (0, utils_1.mergeRefs)(ref, modalRef) }, rest, { onKeyDown: (0, utils_1.callAll)(props.onKeyDown, onKeyDown), onMouseDown: (0, utils_1.callAll)(props.onMouseDown, onMouseDown) }),
|
|
98
95
|
!hideBackdrop && react_1.default.createElement(modalBackdrop_1.default, null),
|
|
99
96
|
react_1.default.createElement(focusLock_1.default, { autoFocus: !disableAutoFocus, finalFocusRef: finalFocusRef, initialFocusRef: initialFocusRef, isDisabled: disableTrapFocus, returnFocus: !disableReturnFocus },
|
|
100
|
-
react_1.default.createElement(
|
|
101
|
-
react_1.default.createElement(modalContent_1.default, Object.assign({}, contentProps), (0, react_1.cloneElement)(children, childProps))))))));
|
|
97
|
+
react_1.default.createElement(modalContent_1.default, Object.assign({}, contentProps), (0, react_1.cloneElement)(children, childProps)))))));
|
|
102
98
|
});
|
|
103
99
|
exports.Modal.Backdrop = modalBackdrop_1.default;
|
|
104
100
|
exports.Modal.Content = modalContent_1.default;
|
|
@@ -8,6 +8,6 @@ declare class ModalManager {
|
|
|
8
8
|
}
|
|
9
9
|
export declare const manager: ModalManager;
|
|
10
10
|
/** Refs of new modals will be automatically added/removed from the state when rendering. */
|
|
11
|
-
export declare function useModalManager(ref: Ref<any>, isOpen?: boolean): void;
|
|
11
|
+
export declare function useModalManager(ref: Ref<any>, isOpen?: boolean, disableScrollLock?: boolean): void;
|
|
12
12
|
export {};
|
|
13
13
|
//# sourceMappingURL=modalManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modalManager.d.ts","sourceRoot":"","sources":["../../../src/modal/modalManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAa,MAAM,OAAO,CAAA;AAEtC,0CAA0C;AAC1C,cAAM,YAAY;IAChB,MAAM,EAAE,GAAG,EAAE,CAAK;IAElB,GAAG,UAAW,GAAG,UAEhB;IAED,MAAM,UAAW,GAAG,UAEnB;IAED,UAAU,UAAW,GAAG,aAGvB;CACF;AAED,eAAO,MAAM,OAAO,cAAqB,CAAA;AAEzC,4FAA4F;AAC5F,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"modalManager.d.ts","sourceRoot":"","sources":["../../../src/modal/modalManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAa,MAAM,OAAO,CAAA;AAEtC,0CAA0C;AAC1C,cAAM,YAAY;IAChB,MAAM,EAAE,GAAG,EAAE,CAAK;IAElB,GAAG,UAAW,GAAG,UAEhB;IAED,MAAM,UAAW,GAAG,UAEnB;IAED,UAAU,UAAW,GAAG,aAGvB;CACF;AAED,eAAO,MAAM,OAAO,cAAqB,CAAA;AAEzC,4FAA4F;AAC5F,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,EAAE,OAAO,QAY3F"}
|
|
@@ -20,11 +20,17 @@ class ModalManager {
|
|
|
20
20
|
}
|
|
21
21
|
exports.manager = new ModalManager();
|
|
22
22
|
/** Refs of new modals will be automatically added/removed from the state when rendering. */
|
|
23
|
-
function useModalManager(ref, isOpen) {
|
|
23
|
+
function useModalManager(ref, isOpen, disableScrollLock) {
|
|
24
24
|
(0, react_1.useEffect)(() => {
|
|
25
|
-
|
|
25
|
+
if (isOpen) {
|
|
26
|
+
exports.manager.add(ref);
|
|
27
|
+
if (!disableScrollLock)
|
|
28
|
+
document.body.classList.add('no-scroll');
|
|
29
|
+
}
|
|
26
30
|
return () => {
|
|
27
31
|
exports.manager.remove(ref);
|
|
32
|
+
if (!disableScrollLock)
|
|
33
|
+
document.body.classList.remove('no-scroll');
|
|
28
34
|
};
|
|
29
35
|
}, [isOpen, ref]);
|
|
30
36
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modalStyle.d.ts","sourceRoot":"","sources":["../../../src/modal/modalStyle.ts"],"names":[],"mappings":";AAEA,wBAMC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("../core");
|
|
4
|
+
exports.default = (0, core_1.createGlobalStyle) `
|
|
5
|
+
|
|
6
|
+
body.no-scroll {
|
|
7
|
+
overflow: hidden !important;
|
|
8
|
+
overscroll-behavior: contain;
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
+
import { ChildrenProp } from '../core/types';
|
|
2
3
|
import { PortalProps } from './portal.types';
|
|
3
4
|
/** Provided children are portaled to document.body or custom container. */
|
|
4
|
-
export declare const Portal: FC<PortalProps>;
|
|
5
|
+
export declare const Portal: FC<PortalProps & ChildrenProp>;
|
|
5
6
|
export default Portal;
|
|
6
7
|
//# sourceMappingURL=portal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../../src/portal/portal.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAuB,MAAM,OAAO,CAAA;AAGtD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,2EAA2E;AAC3E,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../../src/portal/portal.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAuB,MAAM,OAAO,CAAA;AAGtD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,2EAA2E;AAC3E,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,GAAG,YAAY,CAajD,CAAA;AAED,eAAe,MAAM,CAAA"}
|
package/dist/cjs/tabs/tabs.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { TabsProps } from './tabs.types';
|
|
|
3
3
|
export declare const TabsBase: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("..").AnimationProps & import("..").BackgroundColorProps & import("..").BorderProps & import("..").BorderTopProps & import("..").BorderRightProps & import("..").BorderBottomProps & import("..").BorderLeftProps & import("..").BorderColorProps & import("..").BorderTopColorProps & import("..").BorderRightColorProps & import("..").BorderBottomColorProps & import("..").BorderLeftColorProps & import("..").BorderWidthProps & import("..").BorderTopWidthProps & import("..").BorderRightWidthProps & import("..").BorderBottomWidthProps & import("..").BorderLeftWidthProps & import("..").BorderStyleProps & import("..").BorderRadiusProps & import("..").OutlineProps & import("..").OutlineColorProps & import("..").OutlineWidthProps & import("..").OutlineStyleProps & import("..").DivideXProps & import("..").DivideYProps & import("..").DivideXReverseProps & import("..").DivideYReverseProps & import("..").DivideColorProps & import("..").DivideStyleProps & import("..").RingProps & import("..").RingColorProps & import("..").OpacityProps & import("..").BoxShadowProps & import("..").TextShadowProps & import("..").DisplayProps & import("..").AlignItemsProps & import("..").AlignContentProps & import("..").JustifyContentProps & import("..").JustifyItemsProps & import("..").FlexWrapProps & import("..").FlexGrowProps & import("..").FlexShrinkProps & import("..").FlexBasisProps & import("..").FlexDirectionProps & import("..").FlexProps & import("..").JustifySelfProps & import("..").AlignSelfProps & import("..").OrderProps & import("../system/flexboxGrids").RowProps & import("../system/flexboxGrids").ColProps & import("../system/grids").GapProps & import("../system/grids").ColumnGapProps & import("../system/grids").RowGapProps & import("../system/grids").GridColumnProps & import("../system/grids").GridRowProps & import("../system/grids").GridAutoFlowProps & import("../system/grids").GridAutoColumnsProps & import("../system/grids").GridAutoRowsProps & import("../system/grids").GridTemplateColumnsProps & import("../system/grids").GridTemplateRowsProps & import("../system/grids").GridTemplateAreasProps & import("../system/grids").GridAreaProps & import("..").AppearanceProps & import("..").CursorProps & import("..").PointerEventsProps & import("..").ResizeProps & import("..").UserSelectProps & import("..").IsTruncatedProps & import("..").FloatProps & import("..").BoxSizingProps & import("..").OverflowProps & import("..").OverflowXProps & import("..").OverflowYProps & import("..").PositionProps & import("..").ZIndexProps & import("..").TopProps & import("..").RightProps & import("..").BottomProps & import("..").LeftProps & import("..").VisibilityProps & import("..").OverscrollBehaviorProps & import("..").ObjectFitProps & import("..").MaxLinesProps & import("..").WidthProps & import("..").HeightProps & import("..").MaxWidthProps & import("..").MaxHeightProps & import("..").MinWidthProps & import("..").MinHeightProps & import("..").MarginProps & import("..").MarginTopProps & import("..").MarginRightProps & import("..").MarginBottomProps & import("..").MarginLeftProps & import("..").MarginXProps & import("..").MarginYProps & import("..").PaddingProps & import("..").PaddingTopProps & import("..").PaddingRightProps & import("..").PaddingBottomProps & import("..").PaddingLeftProps & import("..").PaddingXProps & import("..").PaddingYProps & import("..").SpaceXProps & import("..").SpaceYProps & import("..").SpaceXReverseProps & import("..").SpaceYReverseProps & import("../system/tables").BorderCollapseProps & import("../system/tables").TableLayoutProps & import("..").TransformProps & import("..").TransformOriginProps & import("..").TranslateXProps & import("..").TranslateYProps & import("..").RotateProps & import("..").SkewXProps & import("..").SkewYProps & import("..").ScaleProps & import("..").ScaleXProps & import("..").ScaleYProps & import("..").TransitionProps & import("..").TransitionPropertyProps & import("..").TransitionDurationProps & import("..").TransitionTimingFunctionProps & import("..").TransitionDelayProps & import("..").FontFamilyProps & import("..").FontSizeProps & import("..").FontStyleProps & import("..").FontWeightProps & import("..").LineHeightProps & import("..").ColorProps & import("..").TextTransformProps & import("..").TextDecorationProps & import("..").TextAlignProps & import("..").VerticalAlignProps & import("..").LetterSpacingProps & import("..").WhiteSpaceProps & import("..").TextOverflowProps & import("..").ListStyleTypeProps & import("..").ListStylePositionProps & import("..").WordBreakProps & import("..").ThemingProps<"Tabs"> & {
|
|
4
4
|
activeTabId?: number | undefined;
|
|
5
5
|
children?: React.ReactNode | React.ReactNode[];
|
|
6
|
-
withPanel?: boolean | undefined;
|
|
7
6
|
onTabClick?: ((id: number) => void) | undefined;
|
|
8
7
|
}, never>;
|
|
9
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/tabs/tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkC,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/tabs/tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkC,MAAM,OAAO,CAAA;AAMtD,OAAO,EAAY,SAAS,EAAE,MAAM,cAAc,CAAA;AAIlD,eAAO,MAAM,QAAQ;;;;SAEpB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,kDA0Df,CAAA;AAEF,eAAe,IAAI,CAAA"}
|
package/dist/cjs/tabs/tabs.js
CHANGED
|
@@ -41,7 +41,6 @@ exports.Tabs = exports.TabsBase = void 0;
|
|
|
41
41
|
const react_1 = __importStar(require("react"));
|
|
42
42
|
const core_1 = require("../core");
|
|
43
43
|
const p_1 = require("../p");
|
|
44
|
-
const panel_1 = require("../panel");
|
|
45
44
|
const utils_1 = require("../utils");
|
|
46
45
|
const tab_1 = __importDefault(require("./tab"));
|
|
47
46
|
const tabsNavBar_1 = __importDefault(require("./tabsNavBar"));
|
|
@@ -53,7 +52,7 @@ exports.TabsBase = core_1.styled.divBox `
|
|
|
53
52
|
* Implements Tabs navigation to switch between views.
|
|
54
53
|
*/
|
|
55
54
|
exports.Tabs = (0, core_1.vui)((props, ref) => {
|
|
56
|
-
const { activeTabId, children, className, size,
|
|
55
|
+
const { activeTabId, children, className, size, onTabClick } = props, rest = __rest(props, ["activeTabId", "children", "className", "size", "onTabClick"]);
|
|
57
56
|
const styles = (0, core_1.useStyleConfig)('Tabs', props);
|
|
58
57
|
const { tabs, setTabs, activeTabIndex, setActiveTabIndex, animationDirection, setAnimationDirection } = (0, useTabsState_1.useTabsState)('fadeIn', activeTabId);
|
|
59
58
|
(0, react_1.useEffect)(() => {
|
|
@@ -87,8 +86,7 @@ exports.Tabs = (0, core_1.vui)((props, ref) => {
|
|
|
87
86
|
};
|
|
88
87
|
const activeTab = tabs === null || tabs === void 0 ? void 0 : tabs[activeTabIndex];
|
|
89
88
|
return (react_1.default.createElement(exports.TabsBase, Object.assign({ className: (0, utils_1.cs)('vui-tabs', className), ref: ref }, styles.container, rest),
|
|
90
|
-
!!(tabs === null || tabs === void 0 ? void 0 : tabs.length) && (react_1.default.createElement(tabsNavBar_1.default, { activeNavItem: activeTabIndex, animationDirection: animationDirection, onNavItemClick: onNavItemClick, size: size, tabs: tabs
|
|
91
|
-
(tabs === null || tabs === void 0 ? void 0 : tabs.length) ? (
|
|
92
|
-
react_1.default.createElement(tab_1.default, { onClick: activeTab === null || activeTab === void 0 ? void 0 : activeTab.onClick, title: activeTab === null || activeTab === void 0 ? void 0 : activeTab.title }, !(activeTab === null || activeTab === void 0 ? void 0 : activeTab.disabled) && (activeTab === null || activeTab === void 0 ? void 0 : activeTab.children)))) : (react_1.default.createElement(tab_1.default, { onClick: activeTab === null || activeTab === void 0 ? void 0 : activeTab.onClick, title: activeTab === null || activeTab === void 0 ? void 0 : activeTab.title }, !(activeTab === null || activeTab === void 0 ? void 0 : activeTab.disabled) && (activeTab === null || activeTab === void 0 ? void 0 : activeTab.children)))) : (react_1.default.createElement(p_1.P, { p: 2 }, "Please specify Tabs."))));
|
|
89
|
+
!!(tabs === null || tabs === void 0 ? void 0 : tabs.length) && (react_1.default.createElement(tabsNavBar_1.default, { activeNavItem: activeTabIndex, animationDirection: animationDirection, onNavItemClick: onNavItemClick, size: size, tabs: tabs })),
|
|
90
|
+
(tabs === null || tabs === void 0 ? void 0 : tabs.length) ? (react_1.default.createElement(tab_1.default, { onClick: activeTab === null || activeTab === void 0 ? void 0 : activeTab.onClick, title: activeTab === null || activeTab === void 0 ? void 0 : activeTab.title }, !(activeTab === null || activeTab === void 0 ? void 0 : activeTab.disabled) && (activeTab === null || activeTab === void 0 ? void 0 : activeTab.children))) : (react_1.default.createElement(p_1.P, { p: 2 }, "Please specify Tabs."))));
|
|
93
91
|
});
|
|
94
92
|
exports.default = exports.Tabs;
|
|
@@ -6,8 +6,6 @@ export declare type TabsSize = 'md' | 'sm' | 'lg' | 'xl';
|
|
|
6
6
|
export declare type TabsProps = SystemProps & ThemingProps<'Tabs'> & {
|
|
7
7
|
activeTabId?: number;
|
|
8
8
|
children?: ReactNode | ReactNode[];
|
|
9
|
-
/** Wraps up the tab content with an outlined panel. */
|
|
10
|
-
withPanel?: boolean;
|
|
11
9
|
onTabClick?: (id: number) => void;
|
|
12
10
|
};
|
|
13
11
|
export declare type TabProps = SystemProps & {
|
|
@@ -23,6 +21,5 @@ export declare type TabNavBarProps = {
|
|
|
23
21
|
activeNavItem?: number;
|
|
24
22
|
animationDirection?: AnimationDirection;
|
|
25
23
|
size?: TabsSize;
|
|
26
|
-
withPanel?: boolean;
|
|
27
24
|
};
|
|
28
25
|
//# sourceMappingURL=tabs.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.types.d.ts","sourceRoot":"","sources":["../../../src/tabs/tabs.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,oBAAY,kBAAkB,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,CAAA;AAEpE,oBAAY,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAEhD,oBAAY,SAAS,GAAG,WAAW,GACjC,YAAY,CAAC,MAAM,CAAC,GAAG;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAA;IAClC,
|
|
1
|
+
{"version":3,"file":"tabs.types.d.ts","sourceRoot":"","sources":["../../../src/tabs/tabs.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,oBAAY,kBAAkB,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,CAAA;AAEpE,oBAAY,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAEhD,oBAAY,SAAS,GAAG,WAAW,GACjC,YAAY,CAAC,MAAM,CAAC,GAAG;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAA;IAClC,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CAClC,CAAA;AAEH,oBAAY,QAAQ,GAAG,WAAW,GAAG;IACnC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,SAAS,CAAA;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB,CAAA;AAED,oBAAY,cAAc,GAAG;IAC3B,IAAI,EAAE,QAAQ,EAAE,CAAA;IAChB,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;IACvC,IAAI,CAAC,EAAE,QAAQ,CAAA;CAChB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabsNavBar.d.ts","sourceRoot":"","sources":["../../../src/tabs/tabsNavBar.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"tabsNavBar.d.ts","sourceRoot":"","sources":["../../../src/tabs/tabsNavBar.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,eAAO,MAAM,UAAU,uDAwCrB,CAAA;AAEF,eAAe,UAAU,CAAA"}
|
|
@@ -11,9 +11,9 @@ const list_1 = require("../list");
|
|
|
11
11
|
const utils_1 = require("../utils");
|
|
12
12
|
exports.TabsNavBar = (0, core_1.vui)((props, ref) => {
|
|
13
13
|
var _a;
|
|
14
|
-
const { tabs, onNavItemClick, activeNavItem, animationDirection, size
|
|
15
|
-
return (react_1.default.createElement(list_1.List, { borderBottom:
|
|
14
|
+
const { tabs, onNavItemClick, activeNavItem, animationDirection, size } = props;
|
|
15
|
+
return (react_1.default.createElement(list_1.List, { borderBottom: "1px solid grey.40", className: (0, utils_1.cs)('vui-tabsNavBar'), display: "flex", isInteractive: true, ref: ref, size: size, w: 1 }, (_a = tabs === null || tabs === void 0 ? void 0 : tabs.map) === null || _a === void 0 ? void 0 : _a.call(tabs, tab => (react_1.default.createElement(list_1.ListItem, { className: `vui-tabsNavBarItem vui-tabsNavBarItem-${tab === null || tab === void 0 ? void 0 : tab.id}`, disabled: tab.disabled, display: "inline-flex", key: tab.id, onClick: () => (tab === null || tab === void 0 ? void 0 : tab.id) !== undefined && onNavItemClick(tab.id), position: "relative" },
|
|
16
16
|
tab.title,
|
|
17
|
-
!tab.disabled && tab.id === activeNavItem && (react_1.default.createElement(box_1.default, { animation: animationDirection, bg: "prussian.80", bottom:
|
|
17
|
+
!tab.disabled && tab.id === activeNavItem && (react_1.default.createElement(box_1.default, { animation: animationDirection, bg: "prussian.80", bottom: "-1px", h: `${size === 'sm' ? 2 : 4}px`, left: 0, position: "absolute", w: 1 }, "\u00A0")))))));
|
|
18
18
|
});
|
|
19
19
|
exports.default = exports.TabsNavBar;
|
package/dist/esm/core/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA;AACrB,cAAc,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA;AACrB,cAAc,eAAe,CAAA"}
|
package/dist/esm/core/index.js
CHANGED
package/dist/esm/core/media.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { FC } from 'react';
|
|
|
2
2
|
import { StyledProps } from 'styled-components';
|
|
3
3
|
import { Screen } from '../theme';
|
|
4
4
|
import { AnyNumber, AnyString } from '../utils';
|
|
5
|
+
import { ChildrenProp } from './types';
|
|
5
6
|
declare type ScreenWidth = Screen | AnyNumber | AnyString;
|
|
6
7
|
export declare type RenderOnScreenProps = {
|
|
7
8
|
/** Changes direction to below the breakpoint. */
|
|
@@ -16,14 +17,14 @@ export declare const mediaDown: (width: ScreenWidth) => (props: StyledProps<unkn
|
|
|
16
17
|
/** Returns CSS media string with appropriate min-width value. */
|
|
17
18
|
export declare const mediaUp: (width: ScreenWidth) => (props: StyledProps<unknown>) => string;
|
|
18
19
|
/** Renders its content when viewport width is at or above 'md' breakpoint (default: 960px and more). */
|
|
19
|
-
export declare const RenderOnDesktop: FC<RenderOnScreenProps>;
|
|
20
|
+
export declare const RenderOnDesktop: FC<RenderOnScreenProps & ChildrenProp>;
|
|
20
21
|
/** Renders its content when viewport width is below 'md' breakpoint (default: below 960px). */
|
|
21
|
-
export declare const RenderOnMobile: FC<RenderOnScreenProps>;
|
|
22
|
+
export declare const RenderOnMobile: FC<RenderOnScreenProps & ChildrenProp>;
|
|
22
23
|
/**
|
|
23
24
|
* Renders its content when viewport width is at or above a provided breakpoint.
|
|
24
25
|
* Optionally, direction can be set to down, or below, the breakpoint.
|
|
25
26
|
*/
|
|
26
|
-
export declare const RenderOnScreen: FC<RenderOnScreenProps>;
|
|
27
|
+
export declare const RenderOnScreen: FC<RenderOnScreenProps & ChildrenProp>;
|
|
27
28
|
/** Returns true if current viewport width is between provided min and max widths. */
|
|
28
29
|
export declare function useBetween(minWidth: ScreenWidth, maxWidth: ScreenWidth): boolean;
|
|
29
30
|
/** Returns true if current viewport width is smaller than provided width. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/core/media.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/core/media.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,aAAK,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;AAEjD,oBAAY,mBAAmB,GAAG;IAChC,iDAAiD;IACjD,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,gFAAgF;AAChF,eAAO,MAAM,YAAY,aAAc,WAAW,YAAY,WAAW,aAAa,YAAY,OAAO,CAAC,WACN,CAAA;AAEpG,gEAAgE;AAChE,eAAO,MAAM,SAAS,UAAW,WAAW,aAAa,YAAY,OAAO,CAAC,WAE5E,CAAA;AAED,iEAAiE;AACjE,eAAO,MAAM,OAAO,UAAW,WAAW,aAAa,YAAY,OAAO,CAAC,WACzB,CAAA;AAElD,wGAAwG;AACxG,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,mBAAmB,GAAG,YAAY,CAA0C,CAAA;AAE7G,+FAA+F;AAC/F,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,GAAG,YAAY,CAAiD,CAAA;AAEnH;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,GAAG,YAAY,CAGjE,CAAA;AAED,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,WAKtE;AAED,6EAA6E;AAC7E,wBAAgB,OAAO,CAAC,KAAK,EAAE,WAAW,WAIzC;AAED,oEAAoE;AACpE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,WAAW;;;EAO1C;AAED,wFAAwF;AACxF,wBAAgB,KAAK,CAAC,KAAK,EAAE,WAAW,WAIvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAE3E,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC,OAAO,GAAG,aAAa,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,IAAI,CAAA;CACvG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { VuiTheme } from '../../theme';
|
|
3
|
+
import { ChildrenProp } from '../types';
|
|
3
4
|
declare type VuiProviderProps = {
|
|
4
5
|
/** Adds basic styles to body @default true */
|
|
5
6
|
globalStyle?: boolean;
|
|
@@ -9,6 +10,6 @@ declare type VuiProviderProps = {
|
|
|
9
10
|
theme?: VuiTheme;
|
|
10
11
|
};
|
|
11
12
|
/** Provides theme to all wrapped components and by default includes CSS reset and global styles. */
|
|
12
|
-
declare const VuiProvider: FC<VuiProviderProps>;
|
|
13
|
+
declare const VuiProvider: FC<VuiProviderProps & ChildrenProp>;
|
|
13
14
|
export default VuiProvider;
|
|
14
15
|
//# sourceMappingURL=vuiProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vuiProvider.d.ts","sourceRoot":"","sources":["../../../../src/core/vuiProvider/vuiProvider.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"vuiProvider.d.ts","sourceRoot":"","sources":["../../../../src/core/vuiProvider/vuiProvider.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAKjC,OAAqB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAIvC,aAAK,gBAAgB,GAAG;IACtB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,wDAAwD;IACxD,KAAK,CAAC,EAAE,QAAQ,CAAA;CACjB,CAAA;AAED,oGAAoG;AACpG,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,GAAG,YAAY,CAepD,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ThemeProvider } from 'styled-components';
|
|
3
|
+
import ModalStyle from '../../modal/modalStyle';
|
|
3
4
|
import PopoverStyle from '../../popover/popoverStyle';
|
|
4
5
|
import defaultTheme from '../../theme';
|
|
5
6
|
import GlobalStyle from './globalStyle';
|
|
6
7
|
import ResetCSS from './resetCSS';
|
|
7
8
|
/** Provides theme to all wrapped components and by default includes CSS reset and global styles. */
|
|
8
|
-
const VuiProvider = ({ children, globalStyle = true, resetCSS = true, theme = defaultTheme }) => {
|
|
9
|
-
|
|
10
|
-
React.createElement(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
9
|
+
const VuiProvider = ({ children, globalStyle = true, resetCSS = true, theme = defaultTheme }) => (React.createElement(ThemeProvider, { theme: theme },
|
|
10
|
+
React.createElement(React.Fragment, null,
|
|
11
|
+
resetCSS && React.createElement(ResetCSS, null),
|
|
12
|
+
React.createElement(GlobalStyle, { globalStyle: globalStyle }),
|
|
13
|
+
React.createElement(ModalStyle, null),
|
|
14
|
+
React.createElement(PopoverStyle, null),
|
|
15
|
+
children)));
|
|
16
16
|
export default VuiProvider;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
+
import { ChildrenProp } from '../core/types';
|
|
2
3
|
import { FocusLockProps } from './focusLock.types';
|
|
3
4
|
/**
|
|
4
5
|
* Traps the focus within the provided content. That is, tabbing with keyboard will
|
|
5
6
|
* only cycle through the children and won't leave the boundary of the FocusLock.
|
|
6
7
|
* This behavior enhances accessibility of the Modal component.
|
|
7
8
|
*/
|
|
8
|
-
export declare const FocusLock: FC<FocusLockProps>;
|
|
9
|
+
export declare const FocusLock: FC<FocusLockProps & ChildrenProp>;
|
|
9
10
|
export default FocusLock;
|
|
10
11
|
//# sourceMappingURL=focusLock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focusLock.d.ts","sourceRoot":"","sources":["../../../src/modal/focusLock.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAe,MAAM,OAAO,CAAA;AAG9C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"focusLock.d.ts","sourceRoot":"","sources":["../../../src/modal/focusLock.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAe,MAAM,OAAO,CAAA;AAG9C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,GAAG,YAAY,CAmCvD,CAAA;AAED,eAAe,SAAS,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/modal/modal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/modal/modal.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAO,YAAY,EAAE,MAAM,SAAS,CAAA;AAK3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAC3C,OAAO,YAAY,MAAM,gBAAgB,CAAA;AAGzC;;;;;GAKG;AACH,eAAO,MAAM,KAAK;cA6FN,oBAAoB;aACrB,mBAAmB;CAC7B,CAAA;AAKD,eAAe,KAAK,CAAA"}
|
package/dist/esm/modal/modal.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { cloneElement, useRef } from 'react';
|
|
2
|
-
import { RemoveScroll } from 'react-remove-scroll';
|
|
3
2
|
import Box from '../box';
|
|
4
3
|
import { vui } from '../core';
|
|
5
4
|
import Portal from '../portal';
|
|
@@ -19,7 +18,7 @@ export const Modal = vui((props, ref) => {
|
|
|
19
18
|
const { allowPinchZoom, children, className, contentProps, disableAutoFocus, disableBackdropClose, disableEscClose, disablePortal, disableReturnFocus, disableScrollLock, disableTrapFocus, finalFocusRef, hideBackdrop, initialFocusRef, isOpen, onBackdropClick: onBackdropClickProp, onClose, onEsc, preserveScrollBar, size, variant, ...rest } = props;
|
|
20
19
|
const modalRef = useRef(null);
|
|
21
20
|
const mouseDownTarget = useRef(null);
|
|
22
|
-
useModalManager(modalRef, isOpen);
|
|
21
|
+
useModalManager(modalRef, isOpen, disableScrollLock);
|
|
23
22
|
if (!isOpen)
|
|
24
23
|
return null;
|
|
25
24
|
const onBackdropClick = (e) => {
|
|
@@ -39,9 +38,7 @@ export const Modal = vui((props, ref) => {
|
|
|
39
38
|
onEsc?.();
|
|
40
39
|
}
|
|
41
40
|
};
|
|
42
|
-
const onMouseDown = (e) =>
|
|
43
|
-
mouseDownTarget.current = e.target;
|
|
44
|
-
};
|
|
41
|
+
const onMouseDown = (e) => (mouseDownTarget.current = e.target);
|
|
45
42
|
const childProps = {
|
|
46
43
|
onClick: (e) => {
|
|
47
44
|
e.stopPropagation();
|
|
@@ -55,8 +52,7 @@ export const Modal = vui((props, ref) => {
|
|
|
55
52
|
React.createElement(Box, { className: cs('vui-modal', className), ref: mergeRefs(ref, modalRef), ...rest, onKeyDown: callAll(props.onKeyDown, onKeyDown), onMouseDown: callAll(props.onMouseDown, onMouseDown) },
|
|
56
53
|
!hideBackdrop && React.createElement(ModalBackdrop, null),
|
|
57
54
|
React.createElement(FocusLock, { autoFocus: !disableAutoFocus, finalFocusRef: finalFocusRef, initialFocusRef: initialFocusRef, isDisabled: disableTrapFocus, returnFocus: !disableReturnFocus },
|
|
58
|
-
React.createElement(
|
|
59
|
-
React.createElement(ModalContent, { ...contentProps }, cloneElement(children, childProps))))))));
|
|
55
|
+
React.createElement(ModalContent, { ...contentProps }, cloneElement(children, childProps)))))));
|
|
60
56
|
});
|
|
61
57
|
Modal.Backdrop = ModalBackdrop;
|
|
62
58
|
Modal.Content = ModalContent;
|
|
@@ -8,6 +8,6 @@ declare class ModalManager {
|
|
|
8
8
|
}
|
|
9
9
|
export declare const manager: ModalManager;
|
|
10
10
|
/** Refs of new modals will be automatically added/removed from the state when rendering. */
|
|
11
|
-
export declare function useModalManager(ref: Ref<any>, isOpen?: boolean): void;
|
|
11
|
+
export declare function useModalManager(ref: Ref<any>, isOpen?: boolean, disableScrollLock?: boolean): void;
|
|
12
12
|
export {};
|
|
13
13
|
//# sourceMappingURL=modalManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modalManager.d.ts","sourceRoot":"","sources":["../../../src/modal/modalManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAa,MAAM,OAAO,CAAA;AAEtC,0CAA0C;AAC1C,cAAM,YAAY;IAChB,MAAM,EAAE,GAAG,EAAE,CAAK;IAElB,GAAG,UAAW,GAAG,UAEhB;IAED,MAAM,UAAW,GAAG,UAEnB;IAED,UAAU,UAAW,GAAG,aAGvB;CACF;AAED,eAAO,MAAM,OAAO,cAAqB,CAAA;AAEzC,4FAA4F;AAC5F,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"modalManager.d.ts","sourceRoot":"","sources":["../../../src/modal/modalManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAa,MAAM,OAAO,CAAA;AAEtC,0CAA0C;AAC1C,cAAM,YAAY;IAChB,MAAM,EAAE,GAAG,EAAE,CAAK;IAElB,GAAG,UAAW,GAAG,UAEhB;IAED,MAAM,UAAW,GAAG,UAEnB;IAED,UAAU,UAAW,GAAG,aAGvB;CACF;AAED,eAAO,MAAM,OAAO,cAAqB,CAAA;AAEzC,4FAA4F;AAC5F,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,EAAE,OAAO,QAY3F"}
|
|
@@ -17,11 +17,17 @@ class ModalManager {
|
|
|
17
17
|
}
|
|
18
18
|
export const manager = new ModalManager();
|
|
19
19
|
/** Refs of new modals will be automatically added/removed from the state when rendering. */
|
|
20
|
-
export function useModalManager(ref, isOpen) {
|
|
20
|
+
export function useModalManager(ref, isOpen, disableScrollLock) {
|
|
21
21
|
useEffect(() => {
|
|
22
|
-
|
|
22
|
+
if (isOpen) {
|
|
23
|
+
manager.add(ref);
|
|
24
|
+
if (!disableScrollLock)
|
|
25
|
+
document.body.classList.add('no-scroll');
|
|
26
|
+
}
|
|
23
27
|
return () => {
|
|
24
28
|
manager.remove(ref);
|
|
29
|
+
if (!disableScrollLock)
|
|
30
|
+
document.body.classList.remove('no-scroll');
|
|
25
31
|
};
|
|
26
32
|
}, [isOpen, ref]);
|
|
27
33
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modalStyle.d.ts","sourceRoot":"","sources":["../../../src/modal/modalStyle.ts"],"names":[],"mappings":";AAEA,wBAMC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
+
import { ChildrenProp } from '../core/types';
|
|
2
3
|
import { PortalProps } from './portal.types';
|
|
3
4
|
/** Provided children are portaled to document.body or custom container. */
|
|
4
|
-
export declare const Portal: FC<PortalProps>;
|
|
5
|
+
export declare const Portal: FC<PortalProps & ChildrenProp>;
|
|
5
6
|
export default Portal;
|
|
6
7
|
//# sourceMappingURL=portal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../../src/portal/portal.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAuB,MAAM,OAAO,CAAA;AAGtD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,2EAA2E;AAC3E,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../../src/portal/portal.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAuB,MAAM,OAAO,CAAA;AAGtD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,2EAA2E;AAC3E,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,GAAG,YAAY,CAajD,CAAA;AAED,eAAe,MAAM,CAAA"}
|
package/dist/esm/tabs/tabs.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { TabsProps } from './tabs.types';
|
|
|
3
3
|
export declare const TabsBase: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("..").AnimationProps & import("..").BackgroundColorProps & import("..").BorderProps & import("..").BorderTopProps & import("..").BorderRightProps & import("..").BorderBottomProps & import("..").BorderLeftProps & import("..").BorderColorProps & import("..").BorderTopColorProps & import("..").BorderRightColorProps & import("..").BorderBottomColorProps & import("..").BorderLeftColorProps & import("..").BorderWidthProps & import("..").BorderTopWidthProps & import("..").BorderRightWidthProps & import("..").BorderBottomWidthProps & import("..").BorderLeftWidthProps & import("..").BorderStyleProps & import("..").BorderRadiusProps & import("..").OutlineProps & import("..").OutlineColorProps & import("..").OutlineWidthProps & import("..").OutlineStyleProps & import("..").DivideXProps & import("..").DivideYProps & import("..").DivideXReverseProps & import("..").DivideYReverseProps & import("..").DivideColorProps & import("..").DivideStyleProps & import("..").RingProps & import("..").RingColorProps & import("..").OpacityProps & import("..").BoxShadowProps & import("..").TextShadowProps & import("..").DisplayProps & import("..").AlignItemsProps & import("..").AlignContentProps & import("..").JustifyContentProps & import("..").JustifyItemsProps & import("..").FlexWrapProps & import("..").FlexGrowProps & import("..").FlexShrinkProps & import("..").FlexBasisProps & import("..").FlexDirectionProps & import("..").FlexProps & import("..").JustifySelfProps & import("..").AlignSelfProps & import("..").OrderProps & import("../system/flexboxGrids").RowProps & import("../system/flexboxGrids").ColProps & import("../system/grids").GapProps & import("../system/grids").ColumnGapProps & import("../system/grids").RowGapProps & import("../system/grids").GridColumnProps & import("../system/grids").GridRowProps & import("../system/grids").GridAutoFlowProps & import("../system/grids").GridAutoColumnsProps & import("../system/grids").GridAutoRowsProps & import("../system/grids").GridTemplateColumnsProps & import("../system/grids").GridTemplateRowsProps & import("../system/grids").GridTemplateAreasProps & import("../system/grids").GridAreaProps & import("..").AppearanceProps & import("..").CursorProps & import("..").PointerEventsProps & import("..").ResizeProps & import("..").UserSelectProps & import("..").IsTruncatedProps & import("..").FloatProps & import("..").BoxSizingProps & import("..").OverflowProps & import("..").OverflowXProps & import("..").OverflowYProps & import("..").PositionProps & import("..").ZIndexProps & import("..").TopProps & import("..").RightProps & import("..").BottomProps & import("..").LeftProps & import("..").VisibilityProps & import("..").OverscrollBehaviorProps & import("..").ObjectFitProps & import("..").MaxLinesProps & import("..").WidthProps & import("..").HeightProps & import("..").MaxWidthProps & import("..").MaxHeightProps & import("..").MinWidthProps & import("..").MinHeightProps & import("..").MarginProps & import("..").MarginTopProps & import("..").MarginRightProps & import("..").MarginBottomProps & import("..").MarginLeftProps & import("..").MarginXProps & import("..").MarginYProps & import("..").PaddingProps & import("..").PaddingTopProps & import("..").PaddingRightProps & import("..").PaddingBottomProps & import("..").PaddingLeftProps & import("..").PaddingXProps & import("..").PaddingYProps & import("..").SpaceXProps & import("..").SpaceYProps & import("..").SpaceXReverseProps & import("..").SpaceYReverseProps & import("../system/tables").BorderCollapseProps & import("../system/tables").TableLayoutProps & import("..").TransformProps & import("..").TransformOriginProps & import("..").TranslateXProps & import("..").TranslateYProps & import("..").RotateProps & import("..").SkewXProps & import("..").SkewYProps & import("..").ScaleProps & import("..").ScaleXProps & import("..").ScaleYProps & import("..").TransitionProps & import("..").TransitionPropertyProps & import("..").TransitionDurationProps & import("..").TransitionTimingFunctionProps & import("..").TransitionDelayProps & import("..").FontFamilyProps & import("..").FontSizeProps & import("..").FontStyleProps & import("..").FontWeightProps & import("..").LineHeightProps & import("..").ColorProps & import("..").TextTransformProps & import("..").TextDecorationProps & import("..").TextAlignProps & import("..").VerticalAlignProps & import("..").LetterSpacingProps & import("..").WhiteSpaceProps & import("..").TextOverflowProps & import("..").ListStyleTypeProps & import("..").ListStylePositionProps & import("..").WordBreakProps & import("..").ThemingProps<"Tabs"> & {
|
|
4
4
|
activeTabId?: number | undefined;
|
|
5
5
|
children?: React.ReactNode | React.ReactNode[];
|
|
6
|
-
withPanel?: boolean | undefined;
|
|
7
6
|
onTabClick?: ((id: number) => void) | undefined;
|
|
8
7
|
}, never>;
|
|
9
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/tabs/tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkC,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/tabs/tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkC,MAAM,OAAO,CAAA;AAMtD,OAAO,EAAY,SAAS,EAAE,MAAM,cAAc,CAAA;AAIlD,eAAO,MAAM,QAAQ;;;;SAEpB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,kDA0Df,CAAA;AAEF,eAAe,IAAI,CAAA"}
|
package/dist/esm/tabs/tabs.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { styled, useStyleConfig, vui } from '../core';
|
|
3
3
|
import { P } from '../p';
|
|
4
|
-
import { Panel } from '../panel';
|
|
5
4
|
import { cs } from '../utils';
|
|
6
5
|
import Tab from './tab';
|
|
7
6
|
import TabsNavBar from './tabsNavBar';
|
|
@@ -13,7 +12,7 @@ export const TabsBase = styled.divBox `
|
|
|
13
12
|
* Implements Tabs navigation to switch between views.
|
|
14
13
|
*/
|
|
15
14
|
export const Tabs = vui((props, ref) => {
|
|
16
|
-
const { activeTabId, children, className, size,
|
|
15
|
+
const { activeTabId, children, className, size, onTabClick, ...rest } = props;
|
|
17
16
|
const styles = useStyleConfig('Tabs', props);
|
|
18
17
|
const { tabs, setTabs, activeTabIndex, setActiveTabIndex, animationDirection, setAnimationDirection } = useTabsState('fadeIn', activeTabId);
|
|
19
18
|
useEffect(() => {
|
|
@@ -45,8 +44,7 @@ export const Tabs = vui((props, ref) => {
|
|
|
45
44
|
};
|
|
46
45
|
const activeTab = tabs?.[activeTabIndex];
|
|
47
46
|
return (React.createElement(TabsBase, { className: cs('vui-tabs', className), ref: ref, ...styles.container, ...rest },
|
|
48
|
-
!!tabs?.length && (React.createElement(TabsNavBar, { activeNavItem: activeTabIndex, animationDirection: animationDirection, onNavItemClick: onNavItemClick, size: size, tabs: tabs
|
|
49
|
-
tabs?.length ? (
|
|
50
|
-
React.createElement(Tab, { onClick: activeTab?.onClick, title: activeTab?.title }, !activeTab?.disabled && activeTab?.children))) : (React.createElement(Tab, { onClick: activeTab?.onClick, title: activeTab?.title }, !activeTab?.disabled && activeTab?.children))) : (React.createElement(P, { p: 2 }, "Please specify Tabs."))));
|
|
47
|
+
!!tabs?.length && (React.createElement(TabsNavBar, { activeNavItem: activeTabIndex, animationDirection: animationDirection, onNavItemClick: onNavItemClick, size: size, tabs: tabs })),
|
|
48
|
+
tabs?.length ? (React.createElement(Tab, { onClick: activeTab?.onClick, title: activeTab?.title }, !activeTab?.disabled && activeTab?.children)) : (React.createElement(P, { p: 2 }, "Please specify Tabs."))));
|
|
51
49
|
});
|
|
52
50
|
export default Tabs;
|
|
@@ -6,8 +6,6 @@ export declare type TabsSize = 'md' | 'sm' | 'lg' | 'xl';
|
|
|
6
6
|
export declare type TabsProps = SystemProps & ThemingProps<'Tabs'> & {
|
|
7
7
|
activeTabId?: number;
|
|
8
8
|
children?: ReactNode | ReactNode[];
|
|
9
|
-
/** Wraps up the tab content with an outlined panel. */
|
|
10
|
-
withPanel?: boolean;
|
|
11
9
|
onTabClick?: (id: number) => void;
|
|
12
10
|
};
|
|
13
11
|
export declare type TabProps = SystemProps & {
|
|
@@ -23,6 +21,5 @@ export declare type TabNavBarProps = {
|
|
|
23
21
|
activeNavItem?: number;
|
|
24
22
|
animationDirection?: AnimationDirection;
|
|
25
23
|
size?: TabsSize;
|
|
26
|
-
withPanel?: boolean;
|
|
27
24
|
};
|
|
28
25
|
//# sourceMappingURL=tabs.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.types.d.ts","sourceRoot":"","sources":["../../../src/tabs/tabs.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,oBAAY,kBAAkB,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,CAAA;AAEpE,oBAAY,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAEhD,oBAAY,SAAS,GAAG,WAAW,GACjC,YAAY,CAAC,MAAM,CAAC,GAAG;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAA;IAClC,
|
|
1
|
+
{"version":3,"file":"tabs.types.d.ts","sourceRoot":"","sources":["../../../src/tabs/tabs.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,oBAAY,kBAAkB,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,CAAA;AAEpE,oBAAY,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAEhD,oBAAY,SAAS,GAAG,WAAW,GACjC,YAAY,CAAC,MAAM,CAAC,GAAG;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAA;IAClC,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CAClC,CAAA;AAEH,oBAAY,QAAQ,GAAG,WAAW,GAAG;IACnC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,SAAS,CAAA;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB,CAAA;AAED,oBAAY,cAAc,GAAG;IAC3B,IAAI,EAAE,QAAQ,EAAE,CAAA;IAChB,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;IACvC,IAAI,CAAC,EAAE,QAAQ,CAAA;CAChB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabsNavBar.d.ts","sourceRoot":"","sources":["../../../src/tabs/tabsNavBar.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"tabsNavBar.d.ts","sourceRoot":"","sources":["../../../src/tabs/tabsNavBar.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,eAAO,MAAM,UAAU,uDAwCrB,CAAA;AAEF,eAAe,UAAU,CAAA"}
|
|
@@ -4,9 +4,9 @@ import { vui } from '../core';
|
|
|
4
4
|
import { List, ListItem } from '../list';
|
|
5
5
|
import { cs } from '../utils';
|
|
6
6
|
export const TabsNavBar = vui((props, ref) => {
|
|
7
|
-
const { tabs, onNavItemClick, activeNavItem, animationDirection, size
|
|
8
|
-
return (React.createElement(List, { borderBottom:
|
|
7
|
+
const { tabs, onNavItemClick, activeNavItem, animationDirection, size } = props;
|
|
8
|
+
return (React.createElement(List, { borderBottom: "1px solid grey.40", className: cs('vui-tabsNavBar'), display: "flex", isInteractive: true, ref: ref, size: size, w: 1 }, tabs?.map?.(tab => (React.createElement(ListItem, { className: `vui-tabsNavBarItem vui-tabsNavBarItem-${tab?.id}`, disabled: tab.disabled, display: "inline-flex", key: tab.id, onClick: () => tab?.id !== undefined && onNavItemClick(tab.id), position: "relative" },
|
|
9
9
|
tab.title,
|
|
10
|
-
!tab.disabled && tab.id === activeNavItem && (React.createElement(Box, { animation: animationDirection, bg: "prussian.80", bottom:
|
|
10
|
+
!tab.disabled && tab.id === activeNavItem && (React.createElement(Box, { animation: animationDirection, bg: "prussian.80", bottom: "-1px", h: `${size === 'sm' ? 2 : 4}px`, left: 0, position: "absolute", w: 1 }, "\u00A0")))))));
|
|
11
11
|
});
|
|
12
12
|
export default TabsNavBar;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veracity/vui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
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",
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"@xstyled/system": "2.5.0",
|
|
27
27
|
"@xstyled/util": "2.2.3",
|
|
28
28
|
"react-focus-lock": "2.8.1",
|
|
29
|
-
"react-remove-scroll": "2.4.3",
|
|
30
29
|
"styled-components": "5.3.3",
|
|
31
30
|
"tippy.js": "6.3.7"
|
|
32
31
|
},
|
package/src/core/index.ts
CHANGED
package/src/core/media.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import { StyledProps } from 'styled-components'
|
|
|
5
5
|
import { Screen } from '../theme'
|
|
6
6
|
import { AnyNumber, AnyString } from '../utils'
|
|
7
7
|
import { th, useTheme } from './theme'
|
|
8
|
+
import { ChildrenProp } from './types'
|
|
8
9
|
|
|
9
10
|
type ScreenWidth = Screen | AnyNumber | AnyString
|
|
10
11
|
|
|
@@ -29,16 +30,16 @@ export const mediaUp = (width: ScreenWidth) => (props: StyledProps<unknown>) =>
|
|
|
29
30
|
`@media (min-width: ${th.screen(width)(props)})`
|
|
30
31
|
|
|
31
32
|
/** Renders its content when viewport width is at or above 'md' breakpoint (default: 960px and more). */
|
|
32
|
-
export const RenderOnDesktop: FC<RenderOnScreenProps> = props => <RenderOnScreen {...props} />
|
|
33
|
+
export const RenderOnDesktop: FC<RenderOnScreenProps & ChildrenProp> = props => <RenderOnScreen {...props} />
|
|
33
34
|
|
|
34
35
|
/** Renders its content when viewport width is below 'md' breakpoint (default: below 960px). */
|
|
35
|
-
export const RenderOnMobile: FC<RenderOnScreenProps> = props => <RenderOnScreen isDown {...props} />
|
|
36
|
+
export const RenderOnMobile: FC<RenderOnScreenProps & ChildrenProp> = props => <RenderOnScreen isDown {...props} />
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
* Renders its content when viewport width is at or above a provided breakpoint.
|
|
39
40
|
* Optionally, direction can be set to down, or below, the breakpoint.
|
|
40
41
|
*/
|
|
41
|
-
export const RenderOnScreen: FC<RenderOnScreenProps> = ({ children, isDown, screen = 'md' }) => {
|
|
42
|
+
export const RenderOnScreen: FC<RenderOnScreenProps & ChildrenProp> = ({ children, isDown, screen = 'md' }) => {
|
|
42
43
|
const mediaFn = isDown ? useDown : useUp
|
|
43
44
|
return mediaFn(screen) ? <>{children}</> : null
|
|
44
45
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
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'
|
|
7
|
+
import { ChildrenProp } from '../types'
|
|
6
8
|
import GlobalStyle from './globalStyle'
|
|
7
9
|
import ResetCSS from './resetCSS'
|
|
8
10
|
|
|
@@ -16,22 +18,21 @@ type VuiProviderProps = {
|
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
/** Provides theme to all wrapped components and by default includes CSS reset and global styles. */
|
|
19
|
-
const VuiProvider: FC<VuiProviderProps> = ({
|
|
21
|
+
const VuiProvider: FC<VuiProviderProps & ChildrenProp> = ({
|
|
20
22
|
children,
|
|
21
23
|
globalStyle = true,
|
|
22
24
|
resetCSS = true,
|
|
23
25
|
theme = defaultTheme as VuiTheme
|
|
24
|
-
}) =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
26
|
+
}) => (
|
|
27
|
+
<ThemeProvider theme={theme}>
|
|
28
|
+
<>
|
|
29
|
+
{resetCSS && <ResetCSS />}
|
|
30
|
+
<GlobalStyle globalStyle={globalStyle} />
|
|
31
|
+
<ModalStyle />
|
|
32
|
+
<PopoverStyle />
|
|
33
|
+
{children}
|
|
34
|
+
</>
|
|
35
|
+
</ThemeProvider>
|
|
36
|
+
)
|
|
36
37
|
|
|
37
38
|
export default VuiProvider
|
package/src/modal/focusLock.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { FC, useCallback } from 'react'
|
|
2
2
|
import ReactFocusLock from 'react-focus-lock'
|
|
3
3
|
|
|
4
|
+
import { ChildrenProp } from '../core/types'
|
|
4
5
|
import { FocusLockProps } from './focusLock.types'
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -8,7 +9,7 @@ import { FocusLockProps } from './focusLock.types'
|
|
|
8
9
|
* only cycle through the children and won't leave the boundary of the FocusLock.
|
|
9
10
|
* This behavior enhances accessibility of the Modal component.
|
|
10
11
|
*/
|
|
11
|
-
export const FocusLock: FC<FocusLockProps> = props => {
|
|
12
|
+
export const FocusLock: FC<FocusLockProps & ChildrenProp> = props => {
|
|
12
13
|
const {
|
|
13
14
|
autoFocus,
|
|
14
15
|
children,
|
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
|
}
|
package/src/portal/portal.tsx
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { FC, useEffect, useState } from 'react'
|
|
2
2
|
import { createPortal } from 'react-dom'
|
|
3
3
|
|
|
4
|
+
import { ChildrenProp } from '../core/types'
|
|
4
5
|
import { PortalProps } from './portal.types'
|
|
5
6
|
|
|
6
7
|
/** Provided children are portaled to document.body or custom container. */
|
|
7
|
-
export const Portal: FC<PortalProps> = props => {
|
|
8
|
+
export const Portal: FC<PortalProps & ChildrenProp> = props => {
|
|
8
9
|
const { children, containerRef, disablePortal } = props
|
|
9
10
|
const [mountNode, setMountNode] = useState<HTMLElement>()
|
|
10
11
|
|
package/src/tabs/tabs.tsx
CHANGED
|
@@ -2,7 +2,6 @@ import React, { ReactElement, useEffect } from 'react'
|
|
|
2
2
|
|
|
3
3
|
import { styled, useStyleConfig, vui } from '../core'
|
|
4
4
|
import { P } from '../p'
|
|
5
|
-
import { Panel } from '../panel'
|
|
6
5
|
import { cs } from '../utils'
|
|
7
6
|
import Tab from './tab'
|
|
8
7
|
import { TabProps, TabsProps } from './tabs.types'
|
|
@@ -17,7 +16,7 @@ export const TabsBase = styled.divBox<TabsProps>`
|
|
|
17
16
|
* Implements Tabs navigation to switch between views.
|
|
18
17
|
*/
|
|
19
18
|
export const Tabs = vui<'div', TabsProps>((props, ref) => {
|
|
20
|
-
const { activeTabId, children, className, size,
|
|
19
|
+
const { activeTabId, children, className, size, onTabClick, ...rest } = props
|
|
21
20
|
const styles = useStyleConfig('Tabs', props)
|
|
22
21
|
const { tabs, setTabs, activeTabIndex, setActiveTabIndex, animationDirection, setAnimationDirection } = useTabsState(
|
|
23
22
|
'fadeIn',
|
|
@@ -63,21 +62,12 @@ export const Tabs = vui<'div', TabsProps>((props, ref) => {
|
|
|
63
62
|
onNavItemClick={onNavItemClick}
|
|
64
63
|
size={size}
|
|
65
64
|
tabs={tabs}
|
|
66
|
-
withPanel={withPanel}
|
|
67
65
|
/>
|
|
68
66
|
)}
|
|
69
67
|
{tabs?.length ? (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
{!activeTab?.disabled && activeTab?.children}
|
|
74
|
-
</Tab>
|
|
75
|
-
</Panel>
|
|
76
|
-
) : (
|
|
77
|
-
<Tab onClick={activeTab?.onClick} title={activeTab?.title}>
|
|
78
|
-
{!activeTab?.disabled && activeTab?.children}
|
|
79
|
-
</Tab>
|
|
80
|
-
)
|
|
68
|
+
<Tab onClick={activeTab?.onClick} title={activeTab?.title}>
|
|
69
|
+
{!activeTab?.disabled && activeTab?.children}
|
|
70
|
+
</Tab>
|
|
81
71
|
) : (
|
|
82
72
|
<P p={2}>Please specify Tabs.</P>
|
|
83
73
|
)}
|
package/src/tabs/tabs.types.ts
CHANGED
|
@@ -11,8 +11,6 @@ export type TabsProps = SystemProps &
|
|
|
11
11
|
ThemingProps<'Tabs'> & {
|
|
12
12
|
activeTabId?: number
|
|
13
13
|
children?: ReactNode | ReactNode[]
|
|
14
|
-
/** Wraps up the tab content with an outlined panel. */
|
|
15
|
-
withPanel?: boolean
|
|
16
14
|
onTabClick?: (id: number) => void
|
|
17
15
|
}
|
|
18
16
|
|
|
@@ -30,5 +28,4 @@ export type TabNavBarProps = {
|
|
|
30
28
|
activeNavItem?: number
|
|
31
29
|
animationDirection?: AnimationDirection
|
|
32
30
|
size?: TabsSize
|
|
33
|
-
withPanel?: boolean
|
|
34
31
|
}
|
package/src/tabs/tabsNavBar.tsx
CHANGED
|
@@ -7,16 +7,14 @@ import { cs } from '../utils'
|
|
|
7
7
|
import { TabNavBarProps } from './tabs.types'
|
|
8
8
|
|
|
9
9
|
export const TabsNavBar = vui<'div', TabNavBarProps>((props, ref) => {
|
|
10
|
-
const { tabs, onNavItemClick, activeNavItem, animationDirection, size
|
|
10
|
+
const { tabs, onNavItemClick, activeNavItem, animationDirection, size } = props
|
|
11
11
|
|
|
12
12
|
return (
|
|
13
13
|
<List
|
|
14
|
-
borderBottom=
|
|
14
|
+
borderBottom="1px solid grey.40"
|
|
15
15
|
className={cs('vui-tabsNavBar')}
|
|
16
16
|
display="flex"
|
|
17
17
|
isInteractive
|
|
18
|
-
mb={withPanel ? 0 : 2}
|
|
19
|
-
ml={withPanel ? 1 : 0}
|
|
20
18
|
ref={ref}
|
|
21
19
|
size={size}
|
|
22
20
|
w={1}
|
|
@@ -35,7 +33,7 @@ export const TabsNavBar = vui<'div', TabNavBarProps>((props, ref) => {
|
|
|
35
33
|
<Box
|
|
36
34
|
animation={animationDirection}
|
|
37
35
|
bg="prussian.80"
|
|
38
|
-
bottom=
|
|
36
|
+
bottom="-1px"
|
|
39
37
|
h={`${size === 'sm' ? 2 : 4}px`}
|
|
40
38
|
left={0}
|
|
41
39
|
position="absolute"
|