@mongodb-js/compass-components 0.4.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/compass-ui-colors.d.ts +3 -0
- package/lib/compass-ui-colors.js +7 -0
- package/lib/compass-ui-colors.js.map +1 -0
- package/lib/components/accordion.d.ts +7 -0
- package/lib/components/accordion.js +71 -0
- package/lib/components/accordion.js.map +1 -0
- package/lib/components/cancel-loader.d.ts +8 -0
- package/lib/components/cancel-loader.js +64 -0
- package/lib/components/cancel-loader.js.map +1 -0
- package/lib/components/confirmation-modal.d.ts +3 -1
- package/lib/components/confirmation-modal.js +5 -0
- package/lib/components/confirmation-modal.js.map +1 -1
- package/lib/components/content-with-fallback.d.ts +8 -0
- package/lib/components/content-with-fallback.js +78 -0
- package/lib/components/content-with-fallback.js.map +1 -0
- package/lib/components/file-input.d.ts +16 -0
- package/lib/components/file-input.js +100 -0
- package/lib/components/file-input.js.map +1 -0
- package/lib/components/resize-handle.d.ts +15 -0
- package/lib/components/resize-handle.js +117 -0
- package/lib/components/resize-handle.js.map +1 -0
- package/lib/components/spin-loader.d.ts +12 -0
- package/lib/components/spin-loader.js +53 -0
- package/lib/components/spin-loader.js.map +1 -0
- package/lib/hooks/use-focus-hover.d.ts +13 -0
- package/lib/hooks/use-focus-hover.js +63 -0
- package/lib/hooks/use-focus-hover.js.map +1 -0
- package/lib/index.d.ts +32 -1
- package/lib/index.js +104 -1
- package/lib/index.js.map +1 -1
- package/package.json +40 -9
- package/lib/.esm-wrapper.mjs +0 -4
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transparentWhite = exports.transparentGray = exports.gray8 = void 0;
|
|
4
|
+
exports.gray8 = '#f5f6f7';
|
|
5
|
+
exports.transparentGray = 'rgba(180, 180, 180, 0.5)';
|
|
6
|
+
exports.transparentWhite = 'rgba(255, 255, 255, 0.5)';
|
|
7
|
+
//# sourceMappingURL=compass-ui-colors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compass-ui-colors.js","sourceRoot":"","sources":["../src/compass-ui-colors.tsx"],"names":[],"mappings":";;;AAAa,QAAA,KAAK,GAAG,SAAS,CAAC;AAClB,QAAA,eAAe,GAAG,0BAA0B,CAAC;AAC7C,QAAA,gBAAgB,GAAG,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
const react_1 = __importStar(require("react"));
|
|
26
|
+
const tokens_1 = require("@leafygreen-ui/tokens");
|
|
27
|
+
const css_1 = require("@emotion/css");
|
|
28
|
+
const icon_1 = __importDefault(require("@leafygreen-ui/icon"));
|
|
29
|
+
const palette_1 = require("@leafygreen-ui/palette");
|
|
30
|
+
const utils_1 = require("@react-aria/utils");
|
|
31
|
+
const labelStyles = css_1.css({
|
|
32
|
+
padding: 0,
|
|
33
|
+
margin: 0,
|
|
34
|
+
fontWeight: 'bold',
|
|
35
|
+
});
|
|
36
|
+
const buttonStyles = css_1.css({
|
|
37
|
+
display: 'flex',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
border: 'none',
|
|
40
|
+
background: 'none',
|
|
41
|
+
borderRadius: '6px',
|
|
42
|
+
boxShadow: 'none',
|
|
43
|
+
transition: 'box-shadow 150ms ease-in-out',
|
|
44
|
+
'&:focus-visible': {
|
|
45
|
+
boxShadow: `0 0 0 3px ${palette_1.uiColors.focus}`,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
const containerStyles = css_1.css({
|
|
49
|
+
marginTop: tokens_1.spacing[3],
|
|
50
|
+
display: 'flex',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
});
|
|
53
|
+
const buttonIconStyles = css_1.css({
|
|
54
|
+
marginRight: tokens_1.spacing[1],
|
|
55
|
+
});
|
|
56
|
+
function Accordion(props) {
|
|
57
|
+
const [open, setOpen] = react_1.useState(false);
|
|
58
|
+
const regionId = utils_1.useId('region-');
|
|
59
|
+
const labelId = utils_1.useId('label-');
|
|
60
|
+
return (react_1.default.createElement("div", { "data-testid": props.dataTestId },
|
|
61
|
+
react_1.default.createElement("div", { className: containerStyles },
|
|
62
|
+
react_1.default.createElement("p", { className: labelStyles, id: labelId },
|
|
63
|
+
react_1.default.createElement("button", { className: buttonStyles, type: "button", "aria-expanded": open ? 'true' : 'false', "aria-controls": regionId, onClick: () => {
|
|
64
|
+
setOpen((currentOpen) => !currentOpen);
|
|
65
|
+
} },
|
|
66
|
+
react_1.default.createElement(icon_1.default, { className: buttonIconStyles, glyph: open ? 'ChevronDown' : 'ChevronRight' }),
|
|
67
|
+
props.text))),
|
|
68
|
+
open && (react_1.default.createElement("div", { role: "region", "aria-labelledby": labelId, id: regionId }, props.children))));
|
|
69
|
+
}
|
|
70
|
+
exports.default = Accordion;
|
|
71
|
+
//# sourceMappingURL=accordion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.js","sourceRoot":"","sources":["../../src/components/accordion.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAwC;AACxC,kDAAgD;AAChD,sCAAmC;AACnC,+DAAuC;AACvC,oDAAkD;AAClD,6CAA0C;AAE1C,MAAM,WAAW,GAAG,SAAG,CAAC;IACtB,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,UAAU,EAAE,MAAM;CACnB,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,SAAG,CAAC;IACvB,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;IACpB,MAAM,EAAE,MAAM;IACd,UAAU,EAAE,MAAM;IAClB,YAAY,EAAE,KAAK;IACnB,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,8BAA8B;IAC1C,iBAAiB,EAAE;QACjB,SAAS,EAAE,aAAa,kBAAQ,CAAC,KAAK,EAAE;KACzC;CACF,CAAC,CAAC;AACH,MAAM,eAAe,GAAG,SAAG,CAAC;IAC1B,SAAS,EAAE,gBAAO,CAAC,CAAC,CAAC;IACrB,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;CACrB,CAAC,CAAC;AACH,MAAM,gBAAgB,GAAG,SAAG,CAAC;IAC3B,WAAW,EAAE,gBAAO,CAAC,CAAC,CAAC;CACxB,CAAC,CAAC;AAKH,SAAS,SAAS,CAChB,KAA8C;IAE9C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,gBAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,aAAK,CAAC,SAAS,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,aAAK,CAAC,QAAQ,CAAC,CAAC;IAChC,OAAO,CACL,sDAAkB,KAAK,CAAC,UAAU;QAChC,uCAAK,SAAS,EAAE,eAAe;YAC7B,qCAAG,SAAS,EAAE,WAAW,EAAE,EAAE,EAAE,OAAO;gBACpC,0CACE,SAAS,EAAE,YAAY,EACvB,IAAI,EAAC,QAAQ,mBACE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,mBACvB,QAAQ,EACvB,OAAO,EAAE,GAAG,EAAE;wBACZ,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC;oBACzC,CAAC;oBAED,8BAAC,cAAI,IACH,SAAS,EAAE,gBAAgB,EAC3B,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc,GAC5C;oBACD,KAAK,CAAC,IAAI,CACJ,CACP,CACA;QAEL,IAAI,IAAI,CACP,uCAAK,IAAI,EAAC,QAAQ,qBAAkB,OAAO,EAAE,EAAE,EAAE,QAAQ,IACtD,KAAK,CAAC,QAAQ,CACX,CACP,CACG,CACP,CAAC;AACJ,CAAC;AAED,kBAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const css_1 = require("@emotion/css");
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const cancelLoaderStyle = css_1.css({
|
|
9
|
+
height: '100%',
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
justifyContent: 'center',
|
|
14
|
+
padding: '10px 0',
|
|
15
|
+
});
|
|
16
|
+
const progressTextStyle = css_1.css({
|
|
17
|
+
margin: '0 auto 30px',
|
|
18
|
+
textAlign: 'left',
|
|
19
|
+
fontSize: '24px',
|
|
20
|
+
color: '#807f7f',
|
|
21
|
+
fontWeight: 200,
|
|
22
|
+
});
|
|
23
|
+
const spinnerStyle = css_1.css({
|
|
24
|
+
animation: 'fa-spin 2s infinite linear',
|
|
25
|
+
width: '40px',
|
|
26
|
+
textAlign: 'center',
|
|
27
|
+
display: 'inline-block',
|
|
28
|
+
textRendering: 'auto',
|
|
29
|
+
font: 'normal normal normal 20px/1 FontAwesome',
|
|
30
|
+
'&::before': {
|
|
31
|
+
boxSizing: 'border-box',
|
|
32
|
+
content: '"\\f1ce"',
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
const buttonStyle = css_1.css({
|
|
36
|
+
padding: '0 10px 0 10px',
|
|
37
|
+
height: '28px',
|
|
38
|
+
fontWeight: 'bold',
|
|
39
|
+
fontSize: '13px',
|
|
40
|
+
lineHeight: '26px',
|
|
41
|
+
textTransform: 'uppercase',
|
|
42
|
+
backgroundColor: 'transparent',
|
|
43
|
+
border: '1px solid #13AA52',
|
|
44
|
+
borderRadius: '3px',
|
|
45
|
+
boxShadow: 'none',
|
|
46
|
+
color: '#13AA52',
|
|
47
|
+
fontFamily: 'Akzidenz',
|
|
48
|
+
'-webkit-appearance': 'button',
|
|
49
|
+
cursor: 'pointer',
|
|
50
|
+
overflow: 'visible',
|
|
51
|
+
margin: 0,
|
|
52
|
+
boxSizing: 'border-box',
|
|
53
|
+
outline: 'none',
|
|
54
|
+
});
|
|
55
|
+
function CancelLoader({ dataTestId, progressText, cancelText, onCancel, }) {
|
|
56
|
+
return (react_1.default.createElement("div", { "data-testid": dataTestId, className: cancelLoaderStyle },
|
|
57
|
+
react_1.default.createElement("div", { className: progressTextStyle },
|
|
58
|
+
react_1.default.createElement("i", { className: spinnerStyle }),
|
|
59
|
+
progressText),
|
|
60
|
+
react_1.default.createElement("div", null,
|
|
61
|
+
react_1.default.createElement("button", { className: buttonStyle, onClick: onCancel }, cancelText))));
|
|
62
|
+
}
|
|
63
|
+
exports.default = CancelLoader;
|
|
64
|
+
//# sourceMappingURL=cancel-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancel-loader.js","sourceRoot":"","sources":["../../src/components/cancel-loader.tsx"],"names":[],"mappings":";;;;;AAAA,sCAAmC;AACnC,kDAA0B;AAE1B,MAAM,iBAAiB,GAAG,SAAG,CAAC;IAC5B,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,QAAQ;IACvB,UAAU,EAAE,QAAQ;IACpB,cAAc,EAAE,QAAQ;IACxB,OAAO,EAAE,QAAQ;CAClB,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAG,SAAG,CAAC;IAC5B,MAAM,EAAE,aAAa;IACrB,SAAS,EAAE,MAAM;IACjB,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,SAAS;IAChB,UAAU,EAAE,GAAG;CAChB,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,SAAG,CAAC;IACvB,SAAS,EAAE,4BAA4B;IACvC,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,QAAQ;IACnB,OAAO,EAAE,cAAc;IACvB,aAAa,EAAE,MAAM;IACrB,IAAI,EAAE,yCAAyC;IAC/C,WAAW,EAAE;QACX,SAAS,EAAE,YAAY;QACvB,OAAO,EAAE,UAAU;KACpB;CACF,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,SAAG,CAAC;IACtB,OAAO,EAAE,eAAe;IACxB,MAAM,EAAE,MAAM;IACd,UAAU,EAAE,MAAM;IAClB,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,MAAM;IAClB,aAAa,EAAE,WAAW;IAC1B,eAAe,EAAE,aAAa;IAC9B,MAAM,EAAE,mBAAmB;IAC3B,YAAY,EAAE,KAAK;IACnB,SAAS,EAAE,MAAM;IACjB,KAAK,EAAE,SAAS;IAChB,UAAU,EAAE,UAAU;IACtB,oBAAoB,EAAE,QAAQ;IAC9B,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE,SAAS;IACnB,MAAM,EAAE,CAAC;IACT,SAAS,EAAE,YAAY;IACvB,OAAO,EAAE,MAAM;CAChB,CAAC,CAAC;AAEH,SAAS,YAAY,CAAC,EACpB,UAAU,EACV,YAAY,EACZ,UAAU,EACV,QAAQ,GAMT;IACC,OAAO,CACL,sDAAkB,UAAU,EAAE,SAAS,EAAE,iBAAiB;QACxD,uCAAK,SAAS,EAAE,iBAAiB;YAC/B,qCAAG,SAAS,EAAE,YAAY,GAAI;YAC7B,YAAY,CACT;QACN;YACE,0CAAQ,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,IAC9C,UAAU,CACJ,CACL,CACF,CACP,CAAC;AACJ,CAAC;AAED,kBAAe,YAAY,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import LeafyGreenConfirmationModal from '@leafygreen-ui/confirmation-modal';
|
|
3
|
-
declare function ConfirmationModal(props: React.ComponentProps<typeof LeafyGreenConfirmationModal>
|
|
3
|
+
declare function ConfirmationModal(props: React.ComponentProps<typeof LeafyGreenConfirmationModal> & {
|
|
4
|
+
trackingId?: string;
|
|
5
|
+
}): React.ReactElement;
|
|
4
6
|
export default ConfirmationModal;
|
|
@@ -5,7 +5,12 @@ 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 confirmation_modal_1 = __importDefault(require("@leafygreen-ui/confirmation-modal"));
|
|
8
|
+
const compass_logging_1 = require("@mongodb-js/compass-logging");
|
|
9
|
+
const { track } = compass_logging_1.createLoggerAndTelemetry('COMPASS-UI');
|
|
8
10
|
function ConfirmationModal(props) {
|
|
11
|
+
if (props.open && props.trackingId) {
|
|
12
|
+
track('Screen', { name: props.trackingId });
|
|
13
|
+
}
|
|
9
14
|
return react_1.default.createElement(confirmation_modal_1.default, { ...props });
|
|
10
15
|
}
|
|
11
16
|
exports.default = ConfirmationModal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirmation-modal.js","sourceRoot":"","sources":["../../src/components/confirmation-modal.tsx"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,2FAA4E;
|
|
1
|
+
{"version":3,"file":"confirmation-modal.js","sourceRoot":"","sources":["../../src/components/confirmation-modal.tsx"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,2FAA4E;AAC5E,iEAAuE;AACvE,MAAM,EAAE,KAAK,EAAE,GAAG,0CAAwB,CAAC,YAAY,CAAC,CAAC;AAEzD,SAAS,iBAAiB,CACxB,KAEC;IAED,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,UAAU,EAAE;QAClC,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;KAC7C;IACD,OAAO,8BAAC,4BAA2B,OAAK,KAAK,GAAI,CAAC;AACpD,CAAC;AAED,kBAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const ContentWithFallback: React.FunctionComponent<{
|
|
3
|
+
content(shouldRender: boolean, shouldAnimate: boolean): React.ReactElement | boolean;
|
|
4
|
+
fallback(shouldRender: boolean): React.ReactElement | boolean;
|
|
5
|
+
isContentReady: boolean;
|
|
6
|
+
contentAfterFallbackTimeout?: number;
|
|
7
|
+
fallbackTimeout?: number;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.ContentWithFallback = void 0;
|
|
23
|
+
const react_1 = __importStar(require("react"));
|
|
24
|
+
var RenderStatus;
|
|
25
|
+
(function (RenderStatus) {
|
|
26
|
+
RenderStatus["Nothing"] = "Nothing";
|
|
27
|
+
RenderStatus["Fallback"] = "Fallback";
|
|
28
|
+
RenderStatus["Content"] = "Content";
|
|
29
|
+
RenderStatus["ContentAnimated"] = "ContentAnimated";
|
|
30
|
+
})(RenderStatus || (RenderStatus = {}));
|
|
31
|
+
function isContent(status) {
|
|
32
|
+
return [RenderStatus.ContentAnimated, RenderStatus.Content].includes(status);
|
|
33
|
+
}
|
|
34
|
+
function useRenderWithFallback(isContentReady, { contentAfterFallbackTimeout = 200, fallbackTimeout = 30 } = {}) {
|
|
35
|
+
const [renderStatus, setRenderStatus] = react_1.useState(isContentReady ? RenderStatus.Content : RenderStatus.Nothing);
|
|
36
|
+
react_1.useEffect(() => {
|
|
37
|
+
if (isContent(renderStatus)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (isContentReady && renderStatus === RenderStatus.Nothing) {
|
|
41
|
+
setRenderStatus(RenderStatus.Content);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (isContentReady && renderStatus === RenderStatus.Fallback) {
|
|
45
|
+
const timeout = setTimeout(() => {
|
|
46
|
+
setRenderStatus(RenderStatus.ContentAnimated);
|
|
47
|
+
}, contentAfterFallbackTimeout);
|
|
48
|
+
return () => {
|
|
49
|
+
clearTimeout(timeout);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (!isContentReady && renderStatus === RenderStatus.Nothing) {
|
|
53
|
+
const timeout = setTimeout(() => {
|
|
54
|
+
setRenderStatus(RenderStatus.Fallback);
|
|
55
|
+
}, fallbackTimeout);
|
|
56
|
+
return () => {
|
|
57
|
+
clearTimeout(timeout);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}, [
|
|
61
|
+
renderStatus,
|
|
62
|
+
isContentReady,
|
|
63
|
+
contentAfterFallbackTimeout,
|
|
64
|
+
fallbackTimeout,
|
|
65
|
+
]);
|
|
66
|
+
return renderStatus;
|
|
67
|
+
}
|
|
68
|
+
const ContentWithFallback = ({ content, fallback, isContentReady, contentAfterFallbackTimeout, fallbackTimeout, }) => {
|
|
69
|
+
const renderStatus = useRenderWithFallback(isContentReady, {
|
|
70
|
+
contentAfterFallbackTimeout,
|
|
71
|
+
fallbackTimeout,
|
|
72
|
+
});
|
|
73
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
74
|
+
content(isContent(renderStatus), renderStatus === RenderStatus.ContentAnimated),
|
|
75
|
+
fallback(renderStatus === RenderStatus.Fallback)));
|
|
76
|
+
};
|
|
77
|
+
exports.ContentWithFallback = ContentWithFallback;
|
|
78
|
+
//# sourceMappingURL=content-with-fallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-with-fallback.js","sourceRoot":"","sources":["../../src/components/content-with-fallback.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA,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Q,CAAC,CAAC;YACzC,CAAC,EAAE,eAAe,CAAC,CAAC;YACpB,OAAO,GAAG,EAAE;gBACV,YAAY,CAAC,OAAO,CAAC,CAAC;YACxB,CAAC,CAAC;SACH;IACH,CAAC,EAAE;QACD,YAAY;QACZ,cAAc;QACd,2BAA2B;QAC3B,eAAe;KAChB,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;AACtB,CAAC;AACM,MAAM,mBAAmB,GAS3B,CAAC,EACJ,OAAO,EACP,QAAQ,EACR,cAAc,EACd,2BAA2B,EAC3B,eAAe,GAChB,EAAE,EAAE;IACH,MAAM,YAAY,GAAG,qBAAqB,CAAC,cAAc,EAAE;QACzD,2BAA2B;QAC3B,eAAe;KAChB,CAAC,CAAC;IAEH,OAAO,CACL;QACG,OAAO,CACN,SAAS,CAAC,YAAY,CAAC,EACvB,YAAY,KAAK,YAAY,CAAC,eAAe,CAC9C;QACA,QAAQ,CAAC,YAAY,KAAK,YAAY,CAAC,QAAQ,CAAC,CAChD,CACJ,CAAC;AACJ,CAAC,CAAC;AA9BW,QAAA,mBAAmB,uBA8B9B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare enum Variant {
|
|
3
|
+
Horizontal = "HORIZONTAL",
|
|
4
|
+
Vertical = "VERTICAL"
|
|
5
|
+
}
|
|
6
|
+
declare function FileInput({ id, label, onChange, multi, error, variant, link, values, }: {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
onChange: (files: string[]) => void;
|
|
10
|
+
multi?: boolean;
|
|
11
|
+
error?: boolean;
|
|
12
|
+
variant?: Variant;
|
|
13
|
+
link?: string;
|
|
14
|
+
values?: string[];
|
|
15
|
+
}): React.ReactElement;
|
|
16
|
+
export default FileInput;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Variant = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const css_1 = require("@emotion/css");
|
|
10
|
+
const __1 = require("..");
|
|
11
|
+
const formItemHorizontalStyles = css_1.css `
|
|
12
|
+
margin: 15px auto 15px;
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: flex-end;
|
|
15
|
+
`;
|
|
16
|
+
const formItemVerticalStyles = css_1.css `
|
|
17
|
+
margin: 5px auto 20px;
|
|
18
|
+
`;
|
|
19
|
+
const formItemErrorStyles = css_1.css `
|
|
20
|
+
border: 1px solid red;
|
|
21
|
+
|
|
22
|
+
&:focus {
|
|
23
|
+
border: 1px solid red;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
const buttonStyles = css_1.css `
|
|
27
|
+
width: 100%;
|
|
28
|
+
`;
|
|
29
|
+
const buttonErrorStyles = css_1.css `
|
|
30
|
+
border: 1px solid red;
|
|
31
|
+
`;
|
|
32
|
+
const labelHorizontalStyles = css_1.css `
|
|
33
|
+
width: 70%;
|
|
34
|
+
text-align: right;
|
|
35
|
+
vertical-align: middle;
|
|
36
|
+
padding-right: 15px;
|
|
37
|
+
margin: auto;
|
|
38
|
+
margin-bottom: 0;
|
|
39
|
+
`;
|
|
40
|
+
const labelErrorStyles = css_1.css `
|
|
41
|
+
color: red;
|
|
42
|
+
`;
|
|
43
|
+
const labelIconStyles = css_1.css `
|
|
44
|
+
display: inline-block;
|
|
45
|
+
vertical-align: middle;
|
|
46
|
+
font: normal normal normal 14px/1 FontAwesome;
|
|
47
|
+
font-size: inherit;
|
|
48
|
+
text-rendering: auto;
|
|
49
|
+
margin: 0 0 0 5px;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
color: #bfbfbe;
|
|
52
|
+
|
|
53
|
+
&:link,
|
|
54
|
+
&:active {
|
|
55
|
+
color: #bfbfbe;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&:link,
|
|
59
|
+
&:active,
|
|
60
|
+
&:hover {
|
|
61
|
+
text-decoration: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&:hover {
|
|
65
|
+
color: #fbb129;
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
var Variant;
|
|
69
|
+
(function (Variant) {
|
|
70
|
+
Variant["Horizontal"] = "HORIZONTAL";
|
|
71
|
+
Variant["Vertical"] = "VERTICAL";
|
|
72
|
+
})(Variant = exports.Variant || (exports.Variant = {}));
|
|
73
|
+
function FileInput({ id, label, onChange, multi = false, error = false, variant = Variant.Horizontal, link, values, }) {
|
|
74
|
+
const inputRef = react_1.default.useRef(null);
|
|
75
|
+
const buttonText = react_1.default.useMemo(() => {
|
|
76
|
+
if (Array.isArray(values) && values.length > 0) {
|
|
77
|
+
return values.map((file) => path_1.default.basename(file)).join(', ');
|
|
78
|
+
}
|
|
79
|
+
return multi ? 'Select files...' : 'Select a file...';
|
|
80
|
+
}, [values, multi]);
|
|
81
|
+
const onFilesChanged = react_1.default.useCallback((evt) => {
|
|
82
|
+
const fileList = Array.from(evt.currentTarget.files);
|
|
83
|
+
const files = fileList.map((file) => {
|
|
84
|
+
return file.path;
|
|
85
|
+
});
|
|
86
|
+
onChange(files);
|
|
87
|
+
}, [onChange]);
|
|
88
|
+
return (react_1.default.createElement("div", { className: css_1.cx({ [formItemHorizontalStyles]: variant === Variant.Horizontal }, { [formItemVerticalStyles]: variant === Variant.Vertical }, { [formItemErrorStyles]: error }) },
|
|
89
|
+
react_1.default.createElement("label", { htmlFor: id, className: css_1.cx({ [labelHorizontalStyles]: variant === Variant.Horizontal }, { [labelErrorStyles]: error }) },
|
|
90
|
+
react_1.default.createElement("span", null, label),
|
|
91
|
+
link && (react_1.default.createElement("a", { href: link, target: "_blank", rel: "noreferrer", className: labelIconStyles, "data-testid": "file-input-link" }, "\uF05A"))),
|
|
92
|
+
react_1.default.createElement("input", { ref: inputRef, id: `${id}_file_input`, name: id, type: "file", multiple: multi, onChange: onFilesChanged, style: { display: 'none' } }),
|
|
93
|
+
react_1.default.createElement(__1.Button, { id: id, "data-testid": "file-input-button", className: css_1.cx({ [buttonStyles]: true }, { [buttonErrorStyles]: error }), onClick: () => {
|
|
94
|
+
if (inputRef.current) {
|
|
95
|
+
inputRef.current.click();
|
|
96
|
+
}
|
|
97
|
+
}, title: "Select a file", leftGlyph: react_1.default.createElement(__1.Icon, { glyph: "AddFile", title: null, fill: "currentColor" }) }, buttonText)));
|
|
98
|
+
}
|
|
99
|
+
exports.default = FileInput;
|
|
100
|
+
//# sourceMappingURL=file-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-input.js","sourceRoot":"","sources":["../../src/components/file-input.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,gDAAwB;AACxB,sCAAuC;AAEvC,0BAAkC;AAElC,MAAM,wBAAwB,GAAG,SAAG,CAAA;;;;CAInC,CAAC;AAEF,MAAM,sBAAsB,GAAG,SAAG,CAAA;;CAEjC,CAAC;AAEF,MAAM,mBAAmB,GAAG,SAAG,CAAA;;;;;;CAM9B,CAAC;AAEF,MAAM,YAAY,GAAG,SAAG,CAAA;;CAEvB,CAAC;AAEF,MAAM,iBAAiB,GAAG,SAAG,CAAA;;CAE5B,CAAC;AAEF,MAAM,qBAAqB,GAAG,SAAG,CAAA;;;;;;;CAOhC,CAAC;AAEF,MAAM,gBAAgB,GAAG,SAAG,CAAA;;CAE3B,CAAC;AAEF,MAAM,eAAe,GAAG,SAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;CAwB1B,CAAC;AAEF,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,oCAAyB,CAAA;IACzB,gCAAqB,CAAA;AACvB,CAAC,EAHW,OAAO,GAAP,eAAO,KAAP,eAAO,QAGlB;AAQD,SAAS,SAAS,CAAC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irection {
|
|
3
|
+
TOP = "TOP",
|
|
4
|
+
RIGHT = "RIGHT"
|
|
5
|
+
}
|
|
6
|
+
declare function ResizeHandle({ direction, step, value, minValue, maxValue, onChange, title, }: {
|
|
7
|
+
direction: ResizeDirection;
|
|
8
|
+
step?: number;
|
|
9
|
+
value: number;
|
|
10
|
+
minValue: number;
|
|
11
|
+
maxValue: number;
|
|
12
|
+
onChange: (newValue: number) => void;
|
|
13
|
+
title: string;
|
|
14
|
+
}): React.ReactElement;
|
|
15
|
+
export { ResizeHandle, ResizeDirection };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.ResizeDirection = exports.ResizeHandle = void 0;
|
|
23
|
+
const css_1 = require("@emotion/css");
|
|
24
|
+
const react_1 = __importStar(require("react"));
|
|
25
|
+
var ResizeDirection;
|
|
26
|
+
(function (ResizeDirection) {
|
|
27
|
+
ResizeDirection["TOP"] = "TOP";
|
|
28
|
+
ResizeDirection["RIGHT"] = "RIGHT";
|
|
29
|
+
})(ResizeDirection || (ResizeDirection = {}));
|
|
30
|
+
exports.ResizeDirection = ResizeDirection;
|
|
31
|
+
const baseResizerStyles = css_1.css({
|
|
32
|
+
position: 'absolute',
|
|
33
|
+
background: 'transparent',
|
|
34
|
+
padding: 0,
|
|
35
|
+
transition: 'opacity 250ms ease',
|
|
36
|
+
transitionDelay: '0ms',
|
|
37
|
+
backgroundColor: '#019EE2',
|
|
38
|
+
opacity: '0',
|
|
39
|
+
outline: 'none',
|
|
40
|
+
zIndex: 100,
|
|
41
|
+
':focus': {
|
|
42
|
+
opacity: 1,
|
|
43
|
+
},
|
|
44
|
+
':hover': {
|
|
45
|
+
transitionDelay: '250ms',
|
|
46
|
+
opacity: 1,
|
|
47
|
+
},
|
|
48
|
+
WebkitAppearance: 'none',
|
|
49
|
+
'::-webkit-slider-thumb': {
|
|
50
|
+
WebkitAppearance: 'none',
|
|
51
|
+
},
|
|
52
|
+
'::-ms-track': {
|
|
53
|
+
background: 'none',
|
|
54
|
+
borderColor: 'none',
|
|
55
|
+
color: 'none',
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
const verticalResizerStyle = css_1.css({
|
|
59
|
+
width: '4px !important',
|
|
60
|
+
right: '-2px',
|
|
61
|
+
bottom: 0,
|
|
62
|
+
top: 0,
|
|
63
|
+
':hover': {
|
|
64
|
+
cursor: 'ew-resize',
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
const horizontalResizerStyle = css_1.css({
|
|
68
|
+
height: '4px !important',
|
|
69
|
+
top: '-2px',
|
|
70
|
+
right: 0,
|
|
71
|
+
left: 0,
|
|
72
|
+
':hover': {
|
|
73
|
+
cursor: 'ns-resize',
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
function ResizeHandle({ direction, step = 10, value, minValue, maxValue, onChange, title, }) {
|
|
77
|
+
const isDragging = react_1.useRef(false);
|
|
78
|
+
function boundSize(attemptedSize) {
|
|
79
|
+
return Math.min(maxValue, Math.max(minValue, attemptedSize));
|
|
80
|
+
}
|
|
81
|
+
let directionTitle = 'vertical';
|
|
82
|
+
let dimensionTitle = 'Width';
|
|
83
|
+
let resizerStyle = verticalResizerStyle;
|
|
84
|
+
if (direction === ResizeDirection.TOP) {
|
|
85
|
+
directionTitle = 'horizontal';
|
|
86
|
+
dimensionTitle = 'Height';
|
|
87
|
+
resizerStyle = horizontalResizerStyle;
|
|
88
|
+
}
|
|
89
|
+
return (react_1.default.createElement("input", { type: "range", "aria-roledescription": `${directionTitle} splitter`, "aria-label": `${dimensionTitle} of the ${title}, resize using arrow keys`, className: css_1.cx(baseResizerStyles, resizerStyle), min: minValue, max: maxValue, value: value, step: step, onChange: (event) => {
|
|
90
|
+
if (isDragging.current) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
onChange(boundSize(Number(event.target.value)));
|
|
94
|
+
}, onMouseDown: () => {
|
|
95
|
+
isDragging.current = true;
|
|
96
|
+
}, onMouseMove: (event) => {
|
|
97
|
+
if (isDragging.current) {
|
|
98
|
+
if (direction === ResizeDirection.RIGHT) {
|
|
99
|
+
onChange(boundSize(value + event.movementX));
|
|
100
|
+
}
|
|
101
|
+
else if (direction === ResizeDirection.TOP) {
|
|
102
|
+
onChange(boundSize(value - event.movementY));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}, onMouseUp: (event) => {
|
|
106
|
+
event.currentTarget.blur();
|
|
107
|
+
isDragging.current = false;
|
|
108
|
+
if (direction === ResizeDirection.RIGHT) {
|
|
109
|
+
onChange(boundSize(value + event.movementX));
|
|
110
|
+
}
|
|
111
|
+
else if (direction === ResizeDirection.TOP) {
|
|
112
|
+
onChange(boundSize(value - event.movementY));
|
|
113
|
+
}
|
|
114
|
+
} }));
|
|
115
|
+
}
|
|
116
|
+
exports.ResizeHandle = ResizeHandle;
|
|
117
|
+
//# sourceMappingURL=resize-handle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resize-handle.js","sourceRoot":"","sources":["../../src/components/resize-handle.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAuC;AACvC,+CAAsC;AAEtC,IAAK,eAGJ;AAHD,WAAK,eAAe;IAClB,8BAAW,CAAA;IACX,kCAAe,CAAA;AACjB,CAAC,EAHI,eAAe,KAAf,eAAe,QAGnB;AAiIsB,0CAAe;AA/HtC,MAAM,iBAAiB,GAAG,SAAG,CAAC;IAC5B,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,aAAa;IACzB,OAAO,EAAE,CAAC;IACV,UAAU,EAAE,oBAAoB;IAChC,eAAe,EAAE,KAAK;IACtB,eAAe,EAAE,SAAS;IAC1B,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,GAAG;IACX,QAAQ,EAAE;QACR,OAAO,EAAE,CAAC;KACX;IACD,QAAQ,EAAE;QACR,eAAe,EAAE,OAAO;QACxB,OAAO,EAAE,CAAC;KACX;IACD,gBAAgB,EAAE,MAAM;IACxB,wBAAwB,EAAE;QACxB,gBAAgB,EAAE,MAAM;KACzB;IACD,aAAa,EAAE;QACb,UAAU,EAAE,MAAM;QAClB,WAAW,EAAE,MAAM;QACnB,KAAK,EAAE,MAAM;KACd;CACF,CAAC,CAAC;AAEH,MAAM,oBAAoB,GAAG,SAAG,CAAC;IAC/B,KAAK,EAAE,gBAAgB;IACvB,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,CAAC;IACT,GAAG,EAAE,CAAC;IACN,QAAQ,EAAE;QACR,MAAM,EAAE,WAAW;KACpB;CACF,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG,SAAG,CAAC;IACjC,MAAM,EAAE,gBAAgB;IACxB,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC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,EAAE,EAAE;YACrB,IAAI,UAAU,CAAC,OAAO,EAAE;gBACtB,IAAI,SAAS,KAAK,eAAe,CAAC,KAAK,EAAE;oBACvC,QAAQ,CAAC,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;iBAC9C;qBAAM,IAAI,SAAS,KAAK,eAAe,CAAC,GAAG,EAAE;oBAC5C,QAAQ,CAAC,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;iBAC9C;aACF;QACH,CAAC,EACD,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YAGnB,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;YAE3B,UAAU,CAAC,OAAO,GAAG,KAAK,CAAC;YAC3B,IAAI,SAAS,KAAK,eAAe,CAAC,KAAK,EAAE;gBACvC,QAAQ,CAAC,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;aAC9C;iBAAM,IAAI,SAAS,KAAK,eAAe,CAAC,GAAG,EAAE;gBAC5C,QAAQ,CAAC,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;aAC9C;QACH,CAAC,GACD,CACH,CAAC;AACJ,CAAC;AAEQ,oCAAY"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Component } from 'react';
|
|
2
|
+
interface SpinLoaderProps {
|
|
3
|
+
className: string;
|
|
4
|
+
size?: string;
|
|
5
|
+
}
|
|
6
|
+
export default class SpinLoader extends Component<SpinLoaderProps> {
|
|
7
|
+
static defaultProps: {
|
|
8
|
+
size: string;
|
|
9
|
+
};
|
|
10
|
+
render(): JSX.Element;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
const react_1 = __importStar(require("react"));
|
|
23
|
+
const css_1 = require("@emotion/css");
|
|
24
|
+
const palette_1 = require("@leafygreen-ui/palette");
|
|
25
|
+
const shellLoaderSpin = css_1.keyframes `
|
|
26
|
+
0% { transform: rotate(0deg); }
|
|
27
|
+
100% { transform: rotate(360deg); }
|
|
28
|
+
`;
|
|
29
|
+
const spinLoaderStyle = css_1.css `
|
|
30
|
+
border: 2px solid transparent;
|
|
31
|
+
border-top: 2px solid ${palette_1.uiColors.gray.dark3};
|
|
32
|
+
border-radius: 50%;
|
|
33
|
+
padding: 0;
|
|
34
|
+
margin: 0;
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
display: inline-block;
|
|
37
|
+
|
|
38
|
+
animation: ${shellLoaderSpin} 700ms ease infinite;
|
|
39
|
+
`;
|
|
40
|
+
class SpinLoader extends react_1.Component {
|
|
41
|
+
render() {
|
|
42
|
+
const { size } = this.props;
|
|
43
|
+
return (react_1.default.createElement("div", { className: spinLoaderStyle, style: {
|
|
44
|
+
width: size,
|
|
45
|
+
height: size,
|
|
46
|
+
} }));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.default = SpinLoader;
|
|
50
|
+
SpinLoader.defaultProps = {
|
|
51
|
+
size: '12px',
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=spin-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spin-loader.js","sourceRoot":"","sources":["../../src/components/spin-loader.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,+CAAyC;AACzC,sCAA8C;AAC9C,oDAAkD;AAOlD,MAAM,eAAe,GAAG,eAAS,CAAA;;;CAGhC,CAAC;AAEF,MAAM,eAAe,GAAG,SAAG,CAAA;;0BAED,kBAAQ,CAAC,IAAI,CAAC,KAAK;;;;;;;eAO9B,eAAe;CAC7B,CAAC;AAEF,MAAqB,UAAW,SAAQ,iBAA0B;IAKhE,MAAM;QACJ,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAE5B,OAAO,CACL,uCACE,SAAS,EAAE,eAAe,EAC1B,KAAK,EAAE;gBACL,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,IAAI;aACb,GACD,CACH,CAAC;IACJ,CAAC;;AAjBH,6BAkBC;AAjBQ,uBAAY,GAAG;IACpB,IAAI,EAAE,MAAM;CACb,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare enum FocusState {
|
|
3
|
+
NoFocus = "NoFocus",
|
|
4
|
+
FocusVisible = "FocusVisible",
|
|
5
|
+
Focus = "Focus",
|
|
6
|
+
FocusWithinVisible = "FocusWithinVisible",
|
|
7
|
+
FocusWithin = "FocusWithin"
|
|
8
|
+
}
|
|
9
|
+
export declare function useFocusState(): [
|
|
10
|
+
React.HTMLAttributes<HTMLElement>,
|
|
11
|
+
FocusState
|
|
12
|
+
];
|
|
13
|
+
export declare function useHoverState(): [React.HTMLAttributes<HTMLElement>, boolean];
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useHoverState = exports.useFocusState = exports.FocusState = void 0;
|
|
4
|
+
const interactions_1 = require("@react-aria/interactions");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
var FocusState;
|
|
7
|
+
(function (FocusState) {
|
|
8
|
+
FocusState["NoFocus"] = "NoFocus";
|
|
9
|
+
FocusState["FocusVisible"] = "FocusVisible";
|
|
10
|
+
FocusState["Focus"] = "Focus";
|
|
11
|
+
FocusState["FocusWithinVisible"] = "FocusWithinVisible";
|
|
12
|
+
FocusState["FocusWithin"] = "FocusWithin";
|
|
13
|
+
})(FocusState = exports.FocusState || (exports.FocusState = {}));
|
|
14
|
+
function useFocusState() {
|
|
15
|
+
const [isFocused, setIsFocused] = react_1.useState(false);
|
|
16
|
+
const [isFocusWithin, setIsFocusWithin] = react_1.useState(false);
|
|
17
|
+
const { isFocusVisible } = interactions_1.useFocusVisible();
|
|
18
|
+
const { focusWithinProps } = interactions_1.useFocusWithin({
|
|
19
|
+
onFocusWithinChange: setIsFocusWithin,
|
|
20
|
+
});
|
|
21
|
+
const { focusProps } = interactions_1.useFocus({
|
|
22
|
+
onFocusChange: setIsFocused,
|
|
23
|
+
});
|
|
24
|
+
const mergedProps = {
|
|
25
|
+
onFocus(evt) {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
(_a = focusProps.onFocus) === null || _a === void 0 ? void 0 : _a.call(focusProps, evt);
|
|
28
|
+
(_b = focusWithinProps.onFocus) === null || _b === void 0 ? void 0 : _b.call(focusWithinProps, evt);
|
|
29
|
+
},
|
|
30
|
+
onBlur(evt) {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
(_a = focusProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(focusProps, evt);
|
|
33
|
+
(_b = focusWithinProps.onBlur) === null || _b === void 0 ? void 0 : _b.call(focusWithinProps, evt);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
return [
|
|
37
|
+
mergedProps,
|
|
38
|
+
isFocused && isFocusVisible
|
|
39
|
+
? FocusState.FocusVisible
|
|
40
|
+
: isFocused
|
|
41
|
+
? FocusState.Focus
|
|
42
|
+
: isFocusWithin && isFocusVisible
|
|
43
|
+
? FocusState.FocusWithinVisible
|
|
44
|
+
: isFocusWithin
|
|
45
|
+
? FocusState.FocusWithin
|
|
46
|
+
: FocusState.NoFocus,
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
exports.useFocusState = useFocusState;
|
|
50
|
+
function useHoverState() {
|
|
51
|
+
const [isHovered, setIsHovered] = react_1.useState(false);
|
|
52
|
+
const hoverProps = {
|
|
53
|
+
onMouseEnter() {
|
|
54
|
+
setIsHovered(true);
|
|
55
|
+
},
|
|
56
|
+
onMouseLeave() {
|
|
57
|
+
setIsHovered(false);
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
return [hoverProps, isHovered];
|
|
61
|
+
}
|
|
62
|
+
exports.useHoverState = useHoverState;
|
|
63
|
+
//# sourceMappingURL=use-focus-hover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-focus-hover.js","sourceRoot":"","sources":["../../src/hooks/use-focus-hover.ts"],"names":[],"mappings":";;;AAAA,2DAIkC;AAClC,iCAAwC;AAExC,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,iCAAmB,CAAA;IACnB,2CAA6B,CAAA;IAC7B,6BAAe,CAAA;IACf,uDAAyC,CAAA;IACzC,yCAA2B,CAAA;AAC7B,CAAC,EANW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAMrB;AAED,SAAgB,aAAa;IAI3B,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,gBAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC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AAY;YACV,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;KACF,CAAC;IACF,OAAO,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AACjC,CAAC;AAXD,sCAWC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,33 @@
|
|
|
1
|
+
import CancelLoader from './components/cancel-loader';
|
|
1
2
|
import ConfirmationModal from './components/confirmation-modal';
|
|
2
|
-
|
|
3
|
+
import FileInput from './components/file-input';
|
|
4
|
+
import SpinLoader from './components/spin-loader';
|
|
5
|
+
import { ResizeHandle, ResizeDirection } from './components/resize-handle';
|
|
6
|
+
import Accordion from './components/accordion';
|
|
7
|
+
export { default as Badge, Variant as BadgeVariant, } from '@leafygreen-ui/badge';
|
|
8
|
+
export { default as Banner, Variant as BannerVariant, } from '@leafygreen-ui/banner';
|
|
9
|
+
export { default as Button, Size as ButtonSize, Variant as ButtonVariant, } from '@leafygreen-ui/button';
|
|
10
|
+
export { default as Card } from '@leafygreen-ui/card';
|
|
11
|
+
export { default as Checkbox } from '@leafygreen-ui/checkbox';
|
|
12
|
+
export { default as Icon } from '@leafygreen-ui/icon';
|
|
13
|
+
export { default as IconButton } from '@leafygreen-ui/icon-button';
|
|
14
|
+
export { default as LeafyGreenProvider } from '@leafygreen-ui/leafygreen-provider';
|
|
15
|
+
export { AtlasLogoMark, MongoDBLogoMark, MongoDBLogo, } from '@leafygreen-ui/logo';
|
|
16
|
+
export { Menu, MenuSeparator, MenuItem } from '@leafygreen-ui/menu';
|
|
17
|
+
export { default as Modal } from '@leafygreen-ui/modal';
|
|
18
|
+
export { uiColors } from '@leafygreen-ui/palette';
|
|
19
|
+
export * as compassUIColors from './compass-ui-colors';
|
|
20
|
+
export { default as Portal } from '@leafygreen-ui/portal';
|
|
21
|
+
export { RadioBox, RadioBoxGroup } from '@leafygreen-ui/radio-box-group';
|
|
22
|
+
export { Select, Option, Size as SelectSize } from '@leafygreen-ui/select';
|
|
23
|
+
export { Tabs, Tab } from '@leafygreen-ui/tabs';
|
|
24
|
+
export { default as TextArea } from '@leafygreen-ui/text-area';
|
|
25
|
+
export { default as TextInput } from '@leafygreen-ui/text-input';
|
|
26
|
+
export { default as Toast, Variant as ToastVariant, } from '@leafygreen-ui/toast';
|
|
27
|
+
export { default as Toggle } from '@leafygreen-ui/toggle';
|
|
28
|
+
export { breakpoints, spacing } from '@leafygreen-ui/tokens';
|
|
29
|
+
export { default as Tooltip } from '@leafygreen-ui/tooltip';
|
|
30
|
+
export { H2, H3, Link, Subtitle, Label, Description, } from '@leafygreen-ui/typography';
|
|
31
|
+
export { Accordion, CancelLoader, ConfirmationModal, FileInput, SpinLoader, ResizeHandle, ResizeDirection, };
|
|
32
|
+
export { useFocusState, useHoverState, FocusState, } from './hooks/use-focus-hover';
|
|
33
|
+
export { ContentWithFallback } from './components/content-with-fallback';
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,112 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
2
21
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
23
|
};
|
|
5
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ConfirmationModal = void 0;
|
|
25
|
+
exports.ResizeDirection = exports.ResizeHandle = exports.SpinLoader = exports.FileInput = exports.ConfirmationModal = exports.CancelLoader = exports.Accordion = exports.Description = exports.Label = exports.Subtitle = exports.Link = exports.H3 = exports.H2 = exports.Tooltip = exports.spacing = exports.breakpoints = exports.Toggle = exports.ToastVariant = exports.Toast = exports.TextInput = exports.TextArea = exports.Tab = exports.Tabs = exports.SelectSize = exports.Option = exports.Select = exports.RadioBoxGroup = exports.RadioBox = exports.Portal = exports.compassUIColors = exports.uiColors = exports.Modal = exports.MenuItem = exports.MenuSeparator = exports.Menu = exports.MongoDBLogo = exports.MongoDBLogoMark = exports.AtlasLogoMark = exports.LeafyGreenProvider = exports.IconButton = exports.Icon = exports.Checkbox = exports.Card = exports.ButtonVariant = exports.ButtonSize = exports.Button = exports.BannerVariant = exports.Banner = exports.BadgeVariant = exports.Badge = void 0;
|
|
26
|
+
exports.ContentWithFallback = exports.FocusState = exports.useHoverState = exports.useFocusState = void 0;
|
|
27
|
+
const cancel_loader_1 = __importDefault(require("./components/cancel-loader"));
|
|
28
|
+
exports.CancelLoader = cancel_loader_1.default;
|
|
7
29
|
const confirmation_modal_1 = __importDefault(require("./components/confirmation-modal"));
|
|
8
30
|
exports.ConfirmationModal = confirmation_modal_1.default;
|
|
31
|
+
const file_input_1 = __importDefault(require("./components/file-input"));
|
|
32
|
+
exports.FileInput = file_input_1.default;
|
|
33
|
+
const spin_loader_1 = __importDefault(require("./components/spin-loader"));
|
|
34
|
+
exports.SpinLoader = spin_loader_1.default;
|
|
35
|
+
const resize_handle_1 = require("./components/resize-handle");
|
|
36
|
+
Object.defineProperty(exports, "ResizeHandle", { enumerable: true, get: function () { return resize_handle_1.ResizeHandle; } });
|
|
37
|
+
Object.defineProperty(exports, "ResizeDirection", { enumerable: true, get: function () { return resize_handle_1.ResizeDirection; } });
|
|
38
|
+
const accordion_1 = __importDefault(require("./components/accordion"));
|
|
39
|
+
exports.Accordion = accordion_1.default;
|
|
40
|
+
var badge_1 = require("@leafygreen-ui/badge");
|
|
41
|
+
Object.defineProperty(exports, "Badge", { enumerable: true, get: function () { return __importDefault(badge_1).default; } });
|
|
42
|
+
Object.defineProperty(exports, "BadgeVariant", { enumerable: true, get: function () { return badge_1.Variant; } });
|
|
43
|
+
var banner_1 = require("@leafygreen-ui/banner");
|
|
44
|
+
Object.defineProperty(exports, "Banner", { enumerable: true, get: function () { return __importDefault(banner_1).default; } });
|
|
45
|
+
Object.defineProperty(exports, "BannerVariant", { enumerable: true, get: function () { return banner_1.Variant; } });
|
|
46
|
+
var button_1 = require("@leafygreen-ui/button");
|
|
47
|
+
Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return __importDefault(button_1).default; } });
|
|
48
|
+
Object.defineProperty(exports, "ButtonSize", { enumerable: true, get: function () { return button_1.Size; } });
|
|
49
|
+
Object.defineProperty(exports, "ButtonVariant", { enumerable: true, get: function () { return button_1.Variant; } });
|
|
50
|
+
var card_1 = require("@leafygreen-ui/card");
|
|
51
|
+
Object.defineProperty(exports, "Card", { enumerable: true, get: function () { return __importDefault(card_1).default; } });
|
|
52
|
+
var checkbox_1 = require("@leafygreen-ui/checkbox");
|
|
53
|
+
Object.defineProperty(exports, "Checkbox", { enumerable: true, get: function () { return __importDefault(checkbox_1).default; } });
|
|
54
|
+
var icon_1 = require("@leafygreen-ui/icon");
|
|
55
|
+
Object.defineProperty(exports, "Icon", { enumerable: true, get: function () { return __importDefault(icon_1).default; } });
|
|
56
|
+
var icon_button_1 = require("@leafygreen-ui/icon-button");
|
|
57
|
+
Object.defineProperty(exports, "IconButton", { enumerable: true, get: function () { return __importDefault(icon_button_1).default; } });
|
|
58
|
+
var leafygreen_provider_1 = require("@leafygreen-ui/leafygreen-provider");
|
|
59
|
+
Object.defineProperty(exports, "LeafyGreenProvider", { enumerable: true, get: function () { return __importDefault(leafygreen_provider_1).default; } });
|
|
60
|
+
var logo_1 = require("@leafygreen-ui/logo");
|
|
61
|
+
Object.defineProperty(exports, "AtlasLogoMark", { enumerable: true, get: function () { return logo_1.AtlasLogoMark; } });
|
|
62
|
+
Object.defineProperty(exports, "MongoDBLogoMark", { enumerable: true, get: function () { return logo_1.MongoDBLogoMark; } });
|
|
63
|
+
Object.defineProperty(exports, "MongoDBLogo", { enumerable: true, get: function () { return logo_1.MongoDBLogo; } });
|
|
64
|
+
var menu_1 = require("@leafygreen-ui/menu");
|
|
65
|
+
Object.defineProperty(exports, "Menu", { enumerable: true, get: function () { return menu_1.Menu; } });
|
|
66
|
+
Object.defineProperty(exports, "MenuSeparator", { enumerable: true, get: function () { return menu_1.MenuSeparator; } });
|
|
67
|
+
Object.defineProperty(exports, "MenuItem", { enumerable: true, get: function () { return menu_1.MenuItem; } });
|
|
68
|
+
var modal_1 = require("@leafygreen-ui/modal");
|
|
69
|
+
Object.defineProperty(exports, "Modal", { enumerable: true, get: function () { return __importDefault(modal_1).default; } });
|
|
70
|
+
var palette_1 = require("@leafygreen-ui/palette");
|
|
71
|
+
Object.defineProperty(exports, "uiColors", { enumerable: true, get: function () { return palette_1.uiColors; } });
|
|
72
|
+
exports.compassUIColors = __importStar(require("./compass-ui-colors"));
|
|
73
|
+
var portal_1 = require("@leafygreen-ui/portal");
|
|
74
|
+
Object.defineProperty(exports, "Portal", { enumerable: true, get: function () { return __importDefault(portal_1).default; } });
|
|
75
|
+
var radio_box_group_1 = require("@leafygreen-ui/radio-box-group");
|
|
76
|
+
Object.defineProperty(exports, "RadioBox", { enumerable: true, get: function () { return radio_box_group_1.RadioBox; } });
|
|
77
|
+
Object.defineProperty(exports, "RadioBoxGroup", { enumerable: true, get: function () { return radio_box_group_1.RadioBoxGroup; } });
|
|
78
|
+
var select_1 = require("@leafygreen-ui/select");
|
|
79
|
+
Object.defineProperty(exports, "Select", { enumerable: true, get: function () { return select_1.Select; } });
|
|
80
|
+
Object.defineProperty(exports, "Option", { enumerable: true, get: function () { return select_1.Option; } });
|
|
81
|
+
Object.defineProperty(exports, "SelectSize", { enumerable: true, get: function () { return select_1.Size; } });
|
|
82
|
+
var tabs_1 = require("@leafygreen-ui/tabs");
|
|
83
|
+
Object.defineProperty(exports, "Tabs", { enumerable: true, get: function () { return tabs_1.Tabs; } });
|
|
84
|
+
Object.defineProperty(exports, "Tab", { enumerable: true, get: function () { return tabs_1.Tab; } });
|
|
85
|
+
var text_area_1 = require("@leafygreen-ui/text-area");
|
|
86
|
+
Object.defineProperty(exports, "TextArea", { enumerable: true, get: function () { return __importDefault(text_area_1).default; } });
|
|
87
|
+
var text_input_1 = require("@leafygreen-ui/text-input");
|
|
88
|
+
Object.defineProperty(exports, "TextInput", { enumerable: true, get: function () { return __importDefault(text_input_1).default; } });
|
|
89
|
+
var toast_1 = require("@leafygreen-ui/toast");
|
|
90
|
+
Object.defineProperty(exports, "Toast", { enumerable: true, get: function () { return __importDefault(toast_1).default; } });
|
|
91
|
+
Object.defineProperty(exports, "ToastVariant", { enumerable: true, get: function () { return toast_1.Variant; } });
|
|
92
|
+
var toggle_1 = require("@leafygreen-ui/toggle");
|
|
93
|
+
Object.defineProperty(exports, "Toggle", { enumerable: true, get: function () { return __importDefault(toggle_1).default; } });
|
|
94
|
+
var tokens_1 = require("@leafygreen-ui/tokens");
|
|
95
|
+
Object.defineProperty(exports, "breakpoints", { enumerable: true, get: function () { return tokens_1.breakpoints; } });
|
|
96
|
+
Object.defineProperty(exports, "spacing", { enumerable: true, get: function () { return tokens_1.spacing; } });
|
|
97
|
+
var tooltip_1 = require("@leafygreen-ui/tooltip");
|
|
98
|
+
Object.defineProperty(exports, "Tooltip", { enumerable: true, get: function () { return __importDefault(tooltip_1).default; } });
|
|
99
|
+
var typography_1 = require("@leafygreen-ui/typography");
|
|
100
|
+
Object.defineProperty(exports, "H2", { enumerable: true, get: function () { return typography_1.H2; } });
|
|
101
|
+
Object.defineProperty(exports, "H3", { enumerable: true, get: function () { return typography_1.H3; } });
|
|
102
|
+
Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return typography_1.Link; } });
|
|
103
|
+
Object.defineProperty(exports, "Subtitle", { enumerable: true, get: function () { return typography_1.Subtitle; } });
|
|
104
|
+
Object.defineProperty(exports, "Label", { enumerable: true, get: function () { return typography_1.Label; } });
|
|
105
|
+
Object.defineProperty(exports, "Description", { enumerable: true, get: function () { return typography_1.Description; } });
|
|
106
|
+
var use_focus_hover_1 = require("./hooks/use-focus-hover");
|
|
107
|
+
Object.defineProperty(exports, "useFocusState", { enumerable: true, get: function () { return use_focus_hover_1.useFocusState; } });
|
|
108
|
+
Object.defineProperty(exports, "useHoverState", { enumerable: true, get: function () { return use_focus_hover_1.useHoverState; } });
|
|
109
|
+
Object.defineProperty(exports, "FocusState", { enumerable: true, get: function () { return use_focus_hover_1.FocusState; } });
|
|
110
|
+
var content_with_fallback_1 = require("./components/content-with-fallback");
|
|
111
|
+
Object.defineProperty(exports, "ContentWithFallback", { enumerable: true, get: function () { return content_with_fallback_1.ContentWithFallback; } });
|
|
9
112
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAAsD;AAwDpD,uBAxDK,uBAAY,CAwDL;AAvDd,yFAAgE;AAwD9D,4BAxDK,4BAAiB,CAwDL;AAvDnB,yEAAgD;AAwD9C,oBAxDK,oBAAS,CAwDL;AAvDX,2EAAkD;AAwDhD,qBAxDK,qBAAU,CAwDL;AAvDZ,8DAA2E;AAwDzE,6FAx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AAgB;AAEzB,gDAA0D;AAAjD,iHAAA,OAAO,OAAU;AAC1B,gDAA6D;AAApD,qGAAA,WAAW,OAAA;AAAE,iGAAA,OAAO,OAAA;AAC7B,kDAA4D;AAAnD,mHAAA,OAAO,OAAW;AAC3B,wDAOmC;AANjC,gGAAA,EAAE,OAAA;AACF,gGAAA,EAAE,OAAA;AACF,kGAAA,IAAI,OAAA;AACJ,sGAAA,QAAQ,OAAA;AACR,mGAAA,KAAK,OAAA;AACL,yGAAA,WAAW,OAAA;AAWb,2DAIiC;AAH/B,gHAAA,aAAa,OAAA;AACb,gHAAA,aAAa,OAAA;AACb,6GAAA,UAAU,OAAA;AAEZ,4EAAyE;AAAhE,4HAAA,mBAAmB,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongodb-js/compass-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "React Components used in Compass",
|
|
5
5
|
"license": "SSPL",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
8
|
+
"webpack": "./src/index.ts",
|
|
8
9
|
"require": "./lib/index.js",
|
|
9
10
|
"import": "./lib/.esm-wrapper.mjs"
|
|
10
11
|
},
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
"prepublishOnly": "npm run compile",
|
|
20
21
|
"clean": "rimraf lib",
|
|
21
22
|
"precompile": "npm run clean",
|
|
22
|
-
"compile": "tsc -p tsconfig.json
|
|
23
|
+
"compile": "tsc -p tsconfig.json",
|
|
23
24
|
"eslint": "eslint",
|
|
24
25
|
"prettier": "prettier",
|
|
25
26
|
"lint": "npm run eslint . && npm run prettier -- --check .",
|
|
@@ -33,18 +34,47 @@
|
|
|
33
34
|
"reformat": "npm run prettier -- --write ."
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
|
-
"@leafygreen-ui/
|
|
37
|
+
"@leafygreen-ui/badge": "^4.0.4",
|
|
38
|
+
"@leafygreen-ui/banner": "^3.0.8",
|
|
39
|
+
"@leafygreen-ui/button": "^12.0.5",
|
|
40
|
+
"@leafygreen-ui/card": "^5.1.3",
|
|
41
|
+
"@leafygreen-ui/checkbox": "^6.0.5",
|
|
42
|
+
"@leafygreen-ui/confirmation-modal": "^2.2.1",
|
|
43
|
+
"@leafygreen-ui/icon": "^11.4.0",
|
|
44
|
+
"@leafygreen-ui/icon-button": "^9.1.6",
|
|
45
|
+
"@leafygreen-ui/leafygreen-provider": "^2.1.2",
|
|
46
|
+
"@leafygreen-ui/logo": "^6.1.0",
|
|
47
|
+
"@leafygreen-ui/menu": "^11.0.1",
|
|
48
|
+
"@leafygreen-ui/modal": "^7.0.0",
|
|
49
|
+
"@leafygreen-ui/palette": "^3.2.2",
|
|
50
|
+
"@leafygreen-ui/portal": "^3.1.3",
|
|
51
|
+
"@leafygreen-ui/radio-box-group": "^6.1.4",
|
|
52
|
+
"@leafygreen-ui/select": "^3.0.4",
|
|
53
|
+
"@leafygreen-ui/tabs": "^5.1.3",
|
|
54
|
+
"@leafygreen-ui/text-area": "^4.0.3",
|
|
55
|
+
"@leafygreen-ui/text-input": "^6.0.3",
|
|
56
|
+
"@leafygreen-ui/toast": "^0.4.10",
|
|
57
|
+
"@leafygreen-ui/toggle": "^7.0.4",
|
|
58
|
+
"@leafygreen-ui/tokens": "^0.5.3",
|
|
59
|
+
"@leafygreen-ui/tooltip": "^6.2.2",
|
|
60
|
+
"@leafygreen-ui/typography": "^8.0.2",
|
|
61
|
+
"@mongodb-js/compass-logging": "^0.5.0",
|
|
62
|
+
"@react-aria/interactions": "^3.6.0",
|
|
63
|
+
"@react-aria/utils": "^3.9.0"
|
|
37
64
|
},
|
|
38
65
|
"peerDependencies": {
|
|
39
|
-
"@
|
|
66
|
+
"@emotion/css": "^11.5.0",
|
|
40
67
|
"react": "^16.14.0"
|
|
41
68
|
},
|
|
42
69
|
"devDependencies": {
|
|
43
|
-
"@
|
|
44
|
-
"@mongodb-js/
|
|
45
|
-
"@mongodb-js/
|
|
46
|
-
"@mongodb-js/
|
|
70
|
+
"@emotion/css": "^11.5.0",
|
|
71
|
+
"@mongodb-js/eslint-config-compass": "^0.5.0",
|
|
72
|
+
"@mongodb-js/mocha-config-compass": "^0.6.0",
|
|
73
|
+
"@mongodb-js/prettier-config-compass": "^0.4.0",
|
|
74
|
+
"@mongodb-js/tsconfig-compass": "^0.4.0",
|
|
75
|
+
"@testing-library/dom": "^8.11.1",
|
|
47
76
|
"@testing-library/react": "^12.0.0",
|
|
77
|
+
"@testing-library/user-event": "^13.5.0",
|
|
48
78
|
"@types/chai": "^4.2.21",
|
|
49
79
|
"@types/chai-dom": "^0.0.10",
|
|
50
80
|
"@types/mocha": "^9.0.0",
|
|
@@ -58,6 +88,7 @@
|
|
|
58
88
|
"react": "^16.14.0",
|
|
59
89
|
"react-dom": "^16.14.0",
|
|
60
90
|
"rimraf": "^3.0.2",
|
|
91
|
+
"sinon": "^9.0.0",
|
|
61
92
|
"ts-node": "^10.1.0",
|
|
62
93
|
"typescript": "^4.3.5"
|
|
63
94
|
},
|
|
@@ -69,5 +100,5 @@
|
|
|
69
100
|
"publishConfig": {
|
|
70
101
|
"access": "public"
|
|
71
102
|
},
|
|
72
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "77166e3754e36e95c7ff7efb5a0ce5e0990b0ff7"
|
|
73
104
|
}
|
package/lib/.esm-wrapper.mjs
DELETED