@mongodb-js/compass-components 0.5.0 → 0.9.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.
Files changed (47) hide show
  1. package/lib/compass-ui-colors.d.ts +3 -0
  2. package/lib/compass-ui-colors.js +7 -0
  3. package/lib/compass-ui-colors.js.map +1 -0
  4. package/lib/components/accordion.d.ts +7 -0
  5. package/lib/components/accordion.js +71 -0
  6. package/lib/components/accordion.js.map +1 -0
  7. package/lib/components/cancel-loader.d.ts +8 -0
  8. package/lib/components/cancel-loader.js +64 -0
  9. package/lib/components/cancel-loader.js.map +1 -0
  10. package/lib/components/confirmation-modal.d.ts +3 -1
  11. package/lib/components/confirmation-modal.js +5 -0
  12. package/lib/components/confirmation-modal.js.map +1 -1
  13. package/lib/components/content-with-fallback.d.ts +17 -0
  14. package/lib/components/content-with-fallback.js +119 -0
  15. package/lib/components/content-with-fallback.js.map +1 -0
  16. package/lib/components/file-input.d.ts +20 -0
  17. package/lib/components/file-input.js +121 -0
  18. package/lib/components/file-input.js.map +1 -0
  19. package/lib/components/inline-definition.d.ts +7 -0
  20. package/lib/components/inline-definition.js +31 -0
  21. package/lib/components/inline-definition.js.map +1 -0
  22. package/lib/components/placeholder.d.ts +8 -0
  23. package/lib/components/placeholder.js +68 -0
  24. package/lib/components/placeholder.js.map +1 -0
  25. package/lib/components/resize-handle.d.ts +15 -0
  26. package/lib/components/resize-handle.js +117 -0
  27. package/lib/components/resize-handle.js.map +1 -0
  28. package/lib/components/spin-loader.d.ts +12 -0
  29. package/lib/components/spin-loader.js +53 -0
  30. package/lib/components/spin-loader.js.map +1 -0
  31. package/lib/components/tooltip.d.ts +13 -0
  32. package/lib/components/tooltip.js +52 -0
  33. package/lib/components/tooltip.js.map +1 -0
  34. package/lib/hooks/use-dom-rect.d.ts +5 -0
  35. package/lib/hooks/use-dom-rect.js +28 -0
  36. package/lib/hooks/use-dom-rect.js.map +1 -0
  37. package/lib/hooks/use-focus-hover.d.ts +14 -0
  38. package/lib/hooks/use-focus-hover.js +57 -0
  39. package/lib/hooks/use-focus-hover.js.map +1 -0
  40. package/lib/index.d.ts +39 -1
  41. package/lib/index.js +132 -1
  42. package/lib/index.js.map +1 -1
  43. package/lib/utils/merge-props.d.ts +2 -0
  44. package/lib/utils/merge-props.js +24 -0
  45. package/lib/utils/merge-props.js.map +1 -0
  46. package/package.json +45 -11
  47. package/lib/.esm-wrapper.mjs +0 -4
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ declare enum ResizeDirection {
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 = (0, 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 = (0, 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 = (0, 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 = (0, 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: (0, 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,IAAA,SAAG,EAAC;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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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 = (0, css_1.keyframes) `
26
+ 0% { transform: rotate(0deg); }
27
+ 100% { transform: rotate(360deg); }
28
+ `;
29
+ const spinLoaderStyle = (0, 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,IAAA,eAAS,EAAA;;;CAGhC,CAAC;AAEF,MAAM,eAAe,GAAG,IAAA,SAAG,EAAA;;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 LeafyGreenTooltip from '@leafygreen-ui/tooltip';
2
+ import React from 'react';
3
+ declare type TooltipTriggerProps = {
4
+ isDisabled?: boolean;
5
+ delay?: number;
6
+ triggerOn?: 'focus';
7
+ };
8
+ declare type LeafyGreenTooltipProps = React.ComponentPropsWithoutRef<typeof LeafyGreenTooltip>;
9
+ declare type TooltipTrigger = React.FunctionComponent;
10
+ declare const Tooltip: React.FunctionComponent<TooltipTriggerProps & Omit<LeafyGreenTooltipProps, 'open' | 'setOpen' | 'trigger'> & {
11
+ trigger: TooltipTrigger;
12
+ }>;
13
+ export { Tooltip };
@@ -0,0 +1,52 @@
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
+ exports.Tooltip = void 0;
26
+ const tooltip_1 = require("@react-stately/tooltip");
27
+ const tooltip_2 = require("@react-aria/tooltip");
28
+ const tooltip_3 = __importDefault(require("@leafygreen-ui/tooltip"));
29
+ const react_1 = __importStar(require("react"));
30
+ const merge_props_1 = require("../utils/merge-props");
31
+ const Tooltip = ({ isDisabled, triggerOn, delay, trigger, ...rest }) => {
32
+ const ref = (0, react_1.useRef)(null);
33
+ const tooltipState = (0, tooltip_1.useTooltipTriggerState)({
34
+ isDisabled,
35
+ trigger: triggerOn,
36
+ delay,
37
+ });
38
+ const { triggerProps, tooltipProps } = (0, tooltip_2.useTooltipTrigger)({ isDisabled, trigger: triggerOn }, tooltipState, ref);
39
+ const setOpen = (0, react_1.useCallback)((isOpen) => {
40
+ if (isOpen) {
41
+ tooltipState.open();
42
+ }
43
+ else {
44
+ tooltipState.close();
45
+ }
46
+ }, [tooltipState]);
47
+ return (react_1.default.createElement(tooltip_3.default, { open: tooltipState.isOpen, setOpen: setOpen, trigger: ({ children, className }) => {
48
+ return trigger((0, merge_props_1.mergeProps)({ children, className }, triggerProps));
49
+ }, ...rest, ...tooltipProps }));
50
+ };
51
+ exports.Tooltip = Tooltip;
52
+ //# sourceMappingURL=tooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../src/components/tooltip.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAAgE;AAChE,iDAAwD;AACxD,qEAAuD;AACvD,+CAAmD;AACnD,sDAAkD;AAoBlD,MAAM,OAAO,GAKT,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;IACzD,MAAM,GAAG,GAAG,IAAA,cAAM,EAAwB,IAAI,CAAC,CAAC;IAChD,MAAM,YAAY,GAAG,IAAA,gCAAsB,EAAC;QAC1C,UAAU;QACV,OAAO,EAAE,SAAS;QAClB,KAAK;KACN,CAAC,CAAC;IACH,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,IAAA,2BAAiB,EACtD,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,EAClC,YAAY,EACZ,GAAG,CACJ,CAAC;IACF,MAAM,OAAO,GAAG,IAAA,mBAAW,EACzB,CAAC,MAAM,EAAE,EAAE;QACT,IAAI,MAAM,EAAE;YACV,YAAY,CAAC,IAAI,EAAE,CAAC;SACrB;aAAM;YACL,YAAY,CAAC,KAAK,EAAE,CAAC;SACtB;IACH,CAAC,EACD,CAAC,YAAY,CAAC,CACf,CAAC;IACF,OAAO,CACL,8BAAC,iBAAiB,IAChB,IAAI,EAAE,YAAY,CAAC,MAAM,EACzB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAgC,EAAE,EAAE;YACjE,OAAO,OAAO,CAAC,IAAA,wBAAU,EAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC;QACpE,CAAC,KACG,IAAI,KACJ,YAAY,GACG,CACtB,CAAC;AACJ,CAAC,CAAC;AAEO,0BAAO"}
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare function useDOMRect<T extends HTMLElement = HTMLDivElement>(): [
3
+ React.HTMLProps<T>,
4
+ DOMRectReadOnly
5
+ ];
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useDOMRect = void 0;
4
+ const react_1 = require("react");
5
+ function useDOMRect() {
6
+ const [rect, setRect] = (0, react_1.useState)(() => new DOMRectReadOnly());
7
+ const ref = (0, react_1.useRef)(null);
8
+ const observer = (0, react_1.useRef)(null);
9
+ if (observer.current === null) {
10
+ observer.current = new ResizeObserver((entry) => {
11
+ setRect(entry[0].contentRect);
12
+ });
13
+ }
14
+ (0, react_1.useLayoutEffect)(() => {
15
+ var _a;
16
+ if (ref.current) {
17
+ const el = ref.current;
18
+ (_a = observer.current) === null || _a === void 0 ? void 0 : _a.observe(ref.current);
19
+ return () => {
20
+ var _a;
21
+ (_a = observer.current) === null || _a === void 0 ? void 0 : _a.unobserve(el);
22
+ };
23
+ }
24
+ }, []);
25
+ return [{ ref }, rect];
26
+ }
27
+ exports.useDOMRect = useDOMRect;
28
+ //# sourceMappingURL=use-dom-rect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-dom-rect.js","sourceRoot":"","sources":["../../src/hooks/use-dom-rect.ts"],"names":[],"mappings":";;;AAAA,iCAA0D;AAE1D,SAAgB,UAAU;IAIxB,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAA,gBAAQ,EAC9B,GAAG,EAAE,CAAC,IAAI,eAAe,EAAE,CAC5B,CAAC;IACF,MAAM,GAAG,GAAG,IAAA,cAAM,EAAW,IAAI,CAAC,CAAC;IACnC,MAAM,QAAQ,GAAG,IAAA,cAAM,EAAwB,IAAI,CAAC,CAAC;IACrD,IAAI,QAAQ,CAAC,OAAO,KAAK,IAAI,EAAE;QAC7B,QAAQ,CAAC,OAAO,GAAG,IAAI,cAAc,CAAC,CAAC,KAAK,EAAE,EAAE;YAC9C,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;KACJ;IACD,IAAA,uBAAe,EAAC,GAAG,EAAE;;QACnB,IAAI,GAAG,CAAC,OAAO,EAAE;YACf,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC;YACvB,MAAA,QAAQ,CAAC,OAAO,0CAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACvC,OAAO,GAAG,EAAE;;gBACV,MAAA,QAAQ,CAAC,OAAO,0CAAE,SAAS,CAAC,EAAE,CAAC,CAAC;YAClC,CAAC,CAAC;SACH;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,CAAC,EAAE,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC;AACzB,CAAC;AAxBD,gCAwBC"}
@@ -0,0 +1,14 @@
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
+ React.MutableRefObject<FocusState>
13
+ ];
14
+ export declare function useHoverState(): [React.HTMLAttributes<HTMLElement>, boolean];
@@ -0,0 +1,57 @@
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 utils_1 = require("@react-aria/utils");
6
+ const react_1 = require("react");
7
+ var FocusState;
8
+ (function (FocusState) {
9
+ FocusState["NoFocus"] = "NoFocus";
10
+ FocusState["FocusVisible"] = "FocusVisible";
11
+ FocusState["Focus"] = "Focus";
12
+ FocusState["FocusWithinVisible"] = "FocusWithinVisible";
13
+ FocusState["FocusWithin"] = "FocusWithin";
14
+ })(FocusState = exports.FocusState || (exports.FocusState = {}));
15
+ function getFocusState(isFocused, isFocusWithin, isFocusVisible) {
16
+ return isFocused && isFocusVisible
17
+ ? FocusState.FocusVisible
18
+ : isFocused
19
+ ? FocusState.Focus
20
+ : isFocusWithin && isFocusVisible
21
+ ? FocusState.FocusWithinVisible
22
+ : isFocusWithin
23
+ ? FocusState.FocusWithin
24
+ : FocusState.NoFocus;
25
+ }
26
+ function useFocusState() {
27
+ const focusStateRef = (0, react_1.useRef)(FocusState.NoFocus);
28
+ const [isFocused, setIsFocused] = (0, react_1.useState)(false);
29
+ const [isFocusWithin, setIsFocusWithin] = (0, react_1.useState)(false);
30
+ const { isFocusVisible } = (0, interactions_1.useFocusVisible)();
31
+ const { focusWithinProps } = (0, interactions_1.useFocusWithin)({
32
+ onFocusWithinChange: setIsFocusWithin,
33
+ });
34
+ const { focusProps } = (0, interactions_1.useFocus)({
35
+ onFocusChange: setIsFocused,
36
+ });
37
+ const mergedProps = (0, react_1.useMemo)(() => {
38
+ return (0, utils_1.mergeProps)(focusProps, focusWithinProps);
39
+ }, [focusProps, focusWithinProps]);
40
+ focusStateRef.current = getFocusState(isFocused, isFocusWithin, isFocusVisible);
41
+ return [mergedProps, focusStateRef.current, focusStateRef];
42
+ }
43
+ exports.useFocusState = useFocusState;
44
+ function useHoverState() {
45
+ const [isHovered, setIsHovered] = (0, react_1.useState)(false);
46
+ const hoverProps = {
47
+ onMouseEnter() {
48
+ setIsHovered(true);
49
+ },
50
+ onMouseLeave() {
51
+ setIsHovered(false);
52
+ },
53
+ };
54
+ return [hoverProps, isHovered];
55
+ }
56
+ exports.useHoverState = useHoverState;
57
+ //# 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,6CAA+C;AAC/C,iCAAyD;AAEzD,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,SAAS,aAAa,CACpB,SAAkB,EAClB,aAAsB,EACtB,cAAuB;IAEvB,OAAO,SAAS,IAAI,cAAc;QAChC,CAAC,CAAC,UAAU,CAAC,YAAY;QACzB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,UAAU,CAAC,KAAK;YAClB,CAAC,CAAC,aAAa,IAAI,cAAc;gBACjC,CAAC,CAAC,UAAU,CAAC,kBAAkB;gBAC/B,CAAC,CAAC,aAAa;oBACf,CAAC,CAAC,UAAU,CAAC,WAAW;oBACxB,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC;AACzB,CAAC;AAED,SAAgB,aAAa;IAK3B,MAAM,aAAa,GAAG,IAAA,cAAM,EAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACjD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAC1D,MAAM,EAAE,cAAc,EAAE,GAAG,IAAA,8BAAe,GAAE,CAAC;IAC7C,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAA,6BAAc,EAAC;QAC1C,mBAAmB,EAAE,gBAAgB;KACtC,CAAC,CAAC;IACH,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,uBAAQ,EAAC;QAC9B,aAAa,EAAE,YAAY;KAC5B,CAAC,CAAC;IACH,MAAM,WAAW,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC/B,OAAO,IAAA,kBAAU,EAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;IAClD,CAAC,EAAE,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAC;IACnC,aAAa,CAAC,OAAO,GAAG,aAAa,CACnC,SAAS,EACT,aAAa,EACb,cAAc,CACf,CAAC;IACF,OAAO,CAAC,WAAW,EAAE,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AAC7D,CAAC;AAxBD,sCAwBC;AAED,SAAgB,aAAa;IAC3B,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG;QACjB,YAAY;YACV,YAAY,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;QACD,YAAY;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,40 @@
1
+ import CancelLoader from './components/cancel-loader';
1
2
  import ConfirmationModal from './components/confirmation-modal';
2
- export { ConfirmationModal };
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 { Tooltip } from './components/tooltip';
30
+ export { H1, H2, H3, Subtitle, Body, InlineCode, InlineKeyCode, Disclaimer, Overline, Link, 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, FadeInPlaceholder, } from './components/content-with-fallback';
34
+ export { default as emotion, flush, hydrate, cx, merge, getRegisteredStyles, injectGlobal, keyframes, css, sheet, cache, } from '@leafygreen-ui/emotion';
35
+ export { InlineDefinition } from './components/inline-definition';
36
+ import type { glyphs } from '@leafygreen-ui/icon';
37
+ export declare type IconGlyph = Extract<keyof typeof glyphs, string>;
38
+ export { SegmentedControl, SegmentedControlOption, } from '@leafygreen-ui/segmented-control';
39
+ export { Placeholder } from './components/placeholder';
40
+ export { useDOMRect } from './hooks/use-dom-rect';
package/lib/index.js CHANGED
@@ -1,9 +1,140 @@
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.Accordion = exports.Description = exports.Label = exports.Link = exports.Overline = exports.Disclaimer = exports.InlineKeyCode = exports.InlineCode = exports.Body = exports.Subtitle = exports.H3 = exports.H2 = exports.H1 = 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.useDOMRect = exports.Placeholder = exports.SegmentedControlOption = exports.SegmentedControl = exports.InlineDefinition = exports.cache = exports.sheet = exports.css = exports.keyframes = exports.injectGlobal = exports.getRegisteredStyles = exports.merge = exports.cx = exports.hydrate = exports.flush = exports.emotion = exports.FadeInPlaceholder = exports.ContentWithFallback = exports.FocusState = exports.useHoverState = exports.useFocusState = exports.ResizeDirection = exports.ResizeHandle = exports.SpinLoader = exports.FileInput = exports.ConfirmationModal = exports.CancelLoader = 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("./components/tooltip");
98
+ Object.defineProperty(exports, "Tooltip", { enumerable: true, get: function () { return tooltip_1.Tooltip; } });
99
+ var typography_1 = require("@leafygreen-ui/typography");
100
+ Object.defineProperty(exports, "H1", { enumerable: true, get: function () { return typography_1.H1; } });
101
+ Object.defineProperty(exports, "H2", { enumerable: true, get: function () { return typography_1.H2; } });
102
+ Object.defineProperty(exports, "H3", { enumerable: true, get: function () { return typography_1.H3; } });
103
+ Object.defineProperty(exports, "Subtitle", { enumerable: true, get: function () { return typography_1.Subtitle; } });
104
+ Object.defineProperty(exports, "Body", { enumerable: true, get: function () { return typography_1.Body; } });
105
+ Object.defineProperty(exports, "InlineCode", { enumerable: true, get: function () { return typography_1.InlineCode; } });
106
+ Object.defineProperty(exports, "InlineKeyCode", { enumerable: true, get: function () { return typography_1.InlineKeyCode; } });
107
+ Object.defineProperty(exports, "Disclaimer", { enumerable: true, get: function () { return typography_1.Disclaimer; } });
108
+ Object.defineProperty(exports, "Overline", { enumerable: true, get: function () { return typography_1.Overline; } });
109
+ Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return typography_1.Link; } });
110
+ Object.defineProperty(exports, "Label", { enumerable: true, get: function () { return typography_1.Label; } });
111
+ Object.defineProperty(exports, "Description", { enumerable: true, get: function () { return typography_1.Description; } });
112
+ var use_focus_hover_1 = require("./hooks/use-focus-hover");
113
+ Object.defineProperty(exports, "useFocusState", { enumerable: true, get: function () { return use_focus_hover_1.useFocusState; } });
114
+ Object.defineProperty(exports, "useHoverState", { enumerable: true, get: function () { return use_focus_hover_1.useHoverState; } });
115
+ Object.defineProperty(exports, "FocusState", { enumerable: true, get: function () { return use_focus_hover_1.FocusState; } });
116
+ var content_with_fallback_1 = require("./components/content-with-fallback");
117
+ Object.defineProperty(exports, "ContentWithFallback", { enumerable: true, get: function () { return content_with_fallback_1.ContentWithFallback; } });
118
+ Object.defineProperty(exports, "FadeInPlaceholder", { enumerable: true, get: function () { return content_with_fallback_1.FadeInPlaceholder; } });
119
+ var emotion_1 = require("@leafygreen-ui/emotion");
120
+ Object.defineProperty(exports, "emotion", { enumerable: true, get: function () { return __importDefault(emotion_1).default; } });
121
+ Object.defineProperty(exports, "flush", { enumerable: true, get: function () { return emotion_1.flush; } });
122
+ Object.defineProperty(exports, "hydrate", { enumerable: true, get: function () { return emotion_1.hydrate; } });
123
+ Object.defineProperty(exports, "cx", { enumerable: true, get: function () { return emotion_1.cx; } });
124
+ Object.defineProperty(exports, "merge", { enumerable: true, get: function () { return emotion_1.merge; } });
125
+ Object.defineProperty(exports, "getRegisteredStyles", { enumerable: true, get: function () { return emotion_1.getRegisteredStyles; } });
126
+ Object.defineProperty(exports, "injectGlobal", { enumerable: true, get: function () { return emotion_1.injectGlobal; } });
127
+ Object.defineProperty(exports, "keyframes", { enumerable: true, get: function () { return emotion_1.keyframes; } });
128
+ Object.defineProperty(exports, "css", { enumerable: true, get: function () { return emotion_1.css; } });
129
+ Object.defineProperty(exports, "sheet", { enumerable: true, get: function () { return emotion_1.sheet; } });
130
+ Object.defineProperty(exports, "cache", { enumerable: true, get: function () { return emotion_1.cache; } });
131
+ var inline_definition_1 = require("./components/inline-definition");
132
+ Object.defineProperty(exports, "InlineDefinition", { enumerable: true, get: function () { return inline_definition_1.InlineDefinition; } });
133
+ var segmented_control_1 = require("@leafygreen-ui/segmented-control");
134
+ Object.defineProperty(exports, "SegmentedControl", { enumerable: true, get: function () { return segmented_control_1.SegmentedControl; } });
135
+ Object.defineProperty(exports, "SegmentedControlOption", { enumerable: true, get: function () { return segmented_control_1.SegmentedControlOption; } });
136
+ var placeholder_1 = require("./components/placeholder");
137
+ Object.defineProperty(exports, "Placeholder", { enumerable: true, get: function () { return placeholder_1.Placeholder; } });
138
+ var use_dom_rect_1 = require("./hooks/use-dom-rect");
139
+ Object.defineProperty(exports, "useDOMRect", { enumerable: true, get: function () { return use_dom_rect_1.useDOMRect; } });
9
140
  //# 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":";;;;;;AAAA,yFAAgE;AAEvD,4BAFF,4BAAiB,CAEE"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAAsD;AA8DpD,uBA9DK,uBAAY,CA8DL;AA7Dd,yFAAgE;AA8D9D,4BA9DK,4BAAiB,CA8DL;AA7DnB,yEAAgD;AA8D9C,oBA9DK,oBAAS,CA8DL;AA7DX,2EAAkD;AA8DhD,qBA9DK,qBAAU,CA8DL;AA7DZ,8DAA2E;AA8DzE,6FA9DO,4BAAY,OA8DP;AACZ,gGA/DqB,+BAAe,OA+DrB;AA9DjB,uEAA+C;AAwD7C,oBAxDK,mBAAS,CAwDL;AAvDX,8CAG8B;AAF5B,+GAAA,OAAO,OAAS;AAChB,qGAAA,OAAO,OAAgB;AAEzB,gDAG+B;AAF7B,iHAAA,OAAO,OAAU;AACjB,uGAAA,OAAO,OAAiB;AAE1B,gDAI+B;AAH7B,iHAAA,OAAO,OAAU;AACjB,oGAAA,IAAI,OAAc;AAClB,uGAAA,OAAO,OAAiB;AAE1B,4CAAsD;AAA7C,6GAAA,OAAO,OAAQ;AACxB,oDAA8D;AAArD,qHAAA,OAAO,OAAY;AAC5B,4CAAsD;AAA7C,6GAAA,OAAO,OAAQ;AACxB,0DAA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AAWb,2DAIiC;AAH/B,gHAAA,aAAa,OAAA;AACb,gHAAA,aAAa,OAAA;AACb,6GAAA,UAAU,OAAA;AAEZ,4EAG4C;AAF1C,4HAAA,mBAAmB,OAAA;AACnB,0HAAA,iBAAiB,OAAA;AAEnB,kDAYgC;AAX9B,mHAAA,OAAO,OAAW;AAClB,gGAAA,KAAK,OAAA;AACL,kGAAA,OAAO,OAAA;AACP,6FAAA,EAAE,OAAA;AACF,gGAAA,KAAK,OAAA;AACL,8GAAA,mBAAmB,OAAA;AACnB,uGAAA,YAAY,OAAA;AACZ,oGAAA,SAAS,OAAA;AACT,8FAAA,GAAG,OAAA;AACH,gGAAA,KAAK,OAAA;AACL,gGAAA,KAAK,OAAA;AAEP,oEAAkE;AAAzD,qHAAA,gBAAgB,OAAA;AAGzB,sEAG0C;AAFxC,qHAAA,gBAAgB,OAAA;AAChB,2HAAA,sBAAsB,OAAA;AAExB,wDAAuD;AAA9C,0GAAA,WAAW,OAAA;AACpB,qDAAkD;AAAzC,0GAAA,UAAU,OAAA"}
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare function mergeProps<T extends HTMLElement = HTMLElement>(...props: React.HTMLProps<T>[]): typeof props[number];
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mergeProps = void 0;
4
+ const utils_1 = require("@react-aria/utils");
5
+ function mergeProps(...props) {
6
+ const propsWithRefs = props.filter((prop) => prop.ref);
7
+ return {
8
+ ...(0, utils_1.mergeProps)(...props),
9
+ ...(propsWithRefs.length > 0 && {
10
+ ref(val) {
11
+ propsWithRefs.forEach(({ ref }) => {
12
+ if (typeof ref === 'function') {
13
+ ref(val);
14
+ }
15
+ else if (ref && typeof ref === 'object') {
16
+ ref.current = val;
17
+ }
18
+ });
19
+ },
20
+ }),
21
+ };
22
+ }
23
+ exports.mergeProps = mergeProps;
24
+ //# sourceMappingURL=merge-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge-props.js","sourceRoot":"","sources":["../../src/utils/merge-props.ts"],"names":[],"mappings":";;;AACA,6CAA8D;AAE9D,SAAgB,UAAU,CACxB,GAAG,KAA2B;IAE9B,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvD,OAAO;QAEL,GAAG,IAAA,kBAAW,EAAC,GAAG,KAAK,CAAC;QACxB,GAAG,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI;YAC9B,GAAG,CAAC,GAAM;gBACR,aAAa,CAAC,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;oBAChC,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;wBAC7B,GAAG,CAAC,GAAG,CAAC,CAAC;qBACV;yBAAM,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;wBACxC,GAAiC,CAAC,OAAO,GAAG,GAAG,CAAC;qBAClD;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;KACH,CAAC;AACJ,CAAC;AAnBD,gCAmBC"}