@quillsql/react 2.8.4 → 2.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AddToDashboardModal.js +146 -180
- package/dist/BarList.js +36 -43
- package/dist/Chart.js +99 -131
- package/dist/ChartBuilder.js +80 -88
- package/dist/ChartEditor.js +14 -20
- package/dist/Context.js +52 -56
- package/dist/Dashboard.d.ts.map +1 -1
- package/dist/Dashboard.js +246 -305
- package/dist/DateRangePicker/Calendar.js +41 -45
- package/dist/DateRangePicker/DateRangePicker.js +32 -60
- package/dist/DateRangePicker/DateRangePickerButton.js +14 -16
- package/dist/DateRangePicker/dateRangePickerUtils.d.ts +6 -0
- package/dist/DateRangePicker/dateRangePickerUtils.d.ts.map +1 -1
- package/dist/DateRangePicker/dateRangePickerUtils.js +89 -89
- package/dist/DateRangePicker/index.js +1 -8
- package/dist/PieChart.js +35 -69
- package/dist/QuillProvider.js +4 -6
- package/dist/ReportBuilder.js +120 -128
- package/dist/SQLEditor.js +56 -64
- package/dist/Table.d.ts +2 -1
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +64 -68
- package/dist/TableChart.js +17 -44
- package/dist/assets/ArrowDownHeadIcon.js +3 -5
- package/dist/assets/ArrowDownIcon.js +3 -5
- package/dist/assets/ArrowDownRightIcon.js +3 -5
- package/dist/assets/ArrowLeftHeadIcon.js +3 -5
- package/dist/assets/ArrowRightHeadIcon.js +3 -5
- package/dist/assets/ArrowRightIcon.js +3 -5
- package/dist/assets/ArrowUpHeadIcon.js +3 -5
- package/dist/assets/ArrowUpIcon.js +3 -5
- package/dist/assets/ArrowUpRightIcon.js +3 -5
- package/dist/assets/CalendarIcon.js +3 -5
- package/dist/assets/CalendarNormalIcon.js +3 -5
- package/dist/assets/DoubleArrowLeftHeadIcon.js +3 -5
- package/dist/assets/DoubleArrowRightHeadIcon.js +3 -5
- package/dist/assets/ExclamationFilledIcon.js +3 -5
- package/dist/assets/FilterIcon.js +3 -5
- package/dist/assets/LoadingSpinner.js +3 -5
- package/dist/assets/RefreshIcon.js +3 -5
- package/dist/assets/SearchIcon.js +3 -5
- package/dist/assets/UpLeftArrowsIcon.js +3 -5
- package/dist/assets/XCircleIcon.js +3 -5
- package/dist/assets/XIcon.js +3 -5
- package/dist/assets/index.js +21 -48
- package/dist/components/BigModal/BigModal.js +13 -38
- package/dist/components/Dropdown/Dropdown.js +24 -52
- package/dist/components/Dropdown/DropdownItem.js +9 -34
- package/dist/components/Dropdown/index.js +2 -10
- package/dist/components/Modal/Modal.js +13 -38
- package/dist/components/Modal/index.js +1 -8
- package/dist/components/QuillCard.js +8 -12
- package/dist/components/SqlTextEditor.d.ts +7 -0
- package/dist/components/SqlTextEditor.d.ts.map +1 -0
- package/dist/components/SqlTextEditor.js +14 -0
- package/dist/components/UiComponents.js +37 -50
- package/dist/components/selectUtils.js +6 -16
- package/dist/contexts/BaseColorContext.js +3 -5
- package/dist/contexts/HoveredValueContext.js +3 -5
- package/dist/contexts/RootStylesContext.js +3 -5
- package/dist/contexts/SelectedValueContext.js +3 -5
- package/dist/contexts/index.js +4 -14
- package/dist/hooks/index.js +4 -14
- package/dist/hooks/useDashboard.d.ts +7 -0
- package/dist/hooks/useDashboard.d.ts.map +1 -0
- package/dist/hooks/useDashboard.js +48 -0
- package/dist/hooks/useInternalState.js +3 -5
- package/dist/hooks/useOnClickOutside.js +3 -5
- package/dist/hooks/useOnWindowResize.js +4 -6
- package/dist/hooks/useQuill.js +11 -15
- package/dist/hooks/useSelectOnKeyDown.js +4 -6
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -28
- package/dist/internals/ReportBuilder/PivotList.js +14 -19
- package/dist/internals/ReportBuilder/PivotModal.js +84 -91
- package/dist/internals/ReportBuilder/PivotModal.spec.js +70 -72
- package/dist/lib/font.js +2 -5
- package/dist/lib/index.js +3 -19
- package/dist/lib/inputTypes.js +1 -2
- package/dist/lib/utils.js +8 -18
- package/dist/utils/aggregate.js +28 -34
- package/dist/utils/colorToHex.js +1 -4
- package/dist/utils/dataFetcher.js +2 -7
- package/dist/utils/downloadCSV.js +1 -5
- package/package.json +2 -4
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const ArrowUpRightIcon = ({ ...props }) => ((0, jsx_runtime_1.jsxs)("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "24", height: "24", children: [(0, jsx_runtime_1.jsx)("path", { fill: "none", d: "M0 0h24v24H0z" }), (0, jsx_runtime_1.jsx)("path", { fill: "currentColor", d: "M16.004 9.414l-8.607 8.607-1.414-1.414L14.589 8H7.004V6h11v11h-2V9.414z" })] }));
|
|
5
|
-
exports.default = ArrowUpRightIcon;
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const ArrowUpRightIcon = ({ ...props }) => (_jsxs("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "24", height: "24", children: [_jsx("path", { fill: "none", d: "M0 0h24v24H0z" }), _jsx("path", { fill: "currentColor", d: "M16.004 9.414l-8.607 8.607-1.414-1.414L14.589 8H7.004V6h11v11h-2V9.414z" })] }));
|
|
3
|
+
export default ArrowUpRightIcon;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const CalendarIcon = ({ ...props }) => ((0, jsx_runtime_1.jsx)("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", d: "M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z", clipRule: "evenodd" }) }));
|
|
5
|
-
exports.default = CalendarIcon;
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const CalendarIcon = ({ ...props }) => (_jsx("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", children: _jsx("path", { fillRule: "evenodd", d: "M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z", clipRule: "evenodd" }) }));
|
|
3
|
+
export default CalendarIcon;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const CalendarNormalIcon = ({ ...props }) => ((0, jsx_runtime_1.jsxs)("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", ry: "2" }), (0, jsx_runtime_1.jsx)("line", { x1: "16", x2: "16", y1: "2", y2: "6" }), (0, jsx_runtime_1.jsx)("line", { x1: "8", x2: "8", y1: "2", y2: "6" }), (0, jsx_runtime_1.jsx)("line", { x1: "3", x2: "21", y1: "10", y2: "10" })] }));
|
|
5
|
-
exports.default = CalendarNormalIcon;
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const CalendarNormalIcon = ({ ...props }) => (_jsxs("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", ry: "2" }), _jsx("line", { x1: "16", x2: "16", y1: "2", y2: "6" }), _jsx("line", { x1: "8", x2: "8", y1: "2", y2: "6" }), _jsx("line", { x1: "3", x2: "21", y1: "10", y2: "10" })] }));
|
|
3
|
+
export default CalendarNormalIcon;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const DoubleArrowLeftHeadIcon = ({ ...props }) => ((0, jsx_runtime_1.jsxs)("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: [(0, jsx_runtime_1.jsx)("path", { id: "svg_1", d: "m0,0l24,0l0,24l-24,0l0,-24z", fill: "none" }), (0, jsx_runtime_1.jsx)("path", { id: "svg_2", d: "m14.1247,12l4.95,4.95l-1.414,1.414l-6.364,-6.364l6.364,-6.364l1.414,1.414l-4.95,4.95z" }), (0, jsx_runtime_1.jsx)("path", { id: "svg_3", d: "m7.31152,12l4.95,4.95l-1.414,1.414l-6.364,-6.364l6.364,-6.364l1.414,1.414l-4.95,4.95z" })] }));
|
|
5
|
-
exports.default = DoubleArrowLeftHeadIcon;
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const DoubleArrowLeftHeadIcon = ({ ...props }) => (_jsxs("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: [_jsx("path", { id: "svg_1", d: "m0,0l24,0l0,24l-24,0l0,-24z", fill: "none" }), _jsx("path", { id: "svg_2", d: "m14.1247,12l4.95,4.95l-1.414,1.414l-6.364,-6.364l6.364,-6.364l1.414,1.414l-4.95,4.95z" }), _jsx("path", { id: "svg_3", d: "m7.31152,12l4.95,4.95l-1.414,1.414l-6.364,-6.364l6.364,-6.364l1.414,1.414l-4.95,4.95z" })] }));
|
|
3
|
+
export default DoubleArrowLeftHeadIcon;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const DoubleArrowRightHeadIcon = ({ ...props }) => ((0, jsx_runtime_1.jsxs)("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: [(0, jsx_runtime_1.jsx)("path", { id: "svg_1", d: "m0,0l24,0l0,24l-24,0l0,-24z", fill: "none" }), (0, jsx_runtime_1.jsx)("path", { transform: "rotate(180 15.1857 12)", id: "svg_2", d: "m14.1247,12l4.95,4.95l-1.414,1.414l-6.364,-6.364l6.364,-6.364l1.414,1.414l-4.95,4.95z" }), (0, jsx_runtime_1.jsx)("path", { transform: "rotate(180 8.37252 12)", id: "svg_3", d: "m7.31152,12l4.95,4.95l-1.414,1.414l-6.364,-6.364l6.364,-6.364l1.414,1.414l-4.95,4.95z" })] }));
|
|
5
|
-
exports.default = DoubleArrowRightHeadIcon;
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const DoubleArrowRightHeadIcon = ({ ...props }) => (_jsxs("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: [_jsx("path", { id: "svg_1", d: "m0,0l24,0l0,24l-24,0l0,-24z", fill: "none" }), _jsx("path", { transform: "rotate(180 15.1857 12)", id: "svg_2", d: "m14.1247,12l4.95,4.95l-1.414,1.414l-6.364,-6.364l6.364,-6.364l1.414,1.414l-4.95,4.95z" }), _jsx("path", { transform: "rotate(180 8.37252 12)", id: "svg_3", d: "m7.31152,12l4.95,4.95l-1.414,1.414l-6.364,-6.364l6.364,-6.364l1.414,1.414l-4.95,4.95z" })] }));
|
|
3
|
+
export default DoubleArrowRightHeadIcon;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const ExclamationFilledIcon = ({ ...props }) => ((0, jsx_runtime_1.jsx)("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", d: "M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z", clipRule: "evenodd" }) }));
|
|
5
|
-
exports.default = ExclamationFilledIcon;
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const ExclamationFilledIcon = ({ ...props }) => (_jsx("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: _jsx("path", { fillRule: "evenodd", d: "M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z", clipRule: "evenodd" }) }));
|
|
3
|
+
export default ExclamationFilledIcon;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const FilterIcon = ({ ...props }) => ((0, jsx_runtime_1.jsxs)("svg", { ...props, width: "12", height: "10", viewBox: "0 0 12 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("rect", { y: "2", width: "8", height: "1", fill: "#373531" }), (0, jsx_runtime_1.jsx)("rect", { x: "8", y: "1", width: "3", height: "3", rx: "1.5", stroke: "#373531" }), (0, jsx_runtime_1.jsx)("rect", { x: "11.5", y: "8.5", width: "8", height: "1", transform: "rotate(-180 11.5 8.5)", fill: "#373531" }), (0, jsx_runtime_1.jsx)("rect", { x: "3.5", y: "9.5", width: "3", height: "3", rx: "1.5", transform: "rotate(-180 3.5 9.5)", stroke: "#373531" })] }));
|
|
5
|
-
exports.default = FilterIcon;
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const FilterIcon = ({ ...props }) => (_jsxs("svg", { ...props, width: "12", height: "10", viewBox: "0 0 12 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("rect", { y: "2", width: "8", height: "1", fill: "#373531" }), _jsx("rect", { x: "8", y: "1", width: "3", height: "3", rx: "1.5", stroke: "#373531" }), _jsx("rect", { x: "11.5", y: "8.5", width: "8", height: "1", transform: "rotate(-180 11.5 8.5)", fill: "#373531" }), _jsx("rect", { x: "3.5", y: "9.5", width: "3", height: "3", rx: "1.5", transform: "rotate(-180 3.5 9.5)", stroke: "#373531" })] }));
|
|
3
|
+
export default FilterIcon;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const LoadingSpinner = ({ ...props }) => ((0, jsx_runtime_1.jsxs)("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: [(0, jsx_runtime_1.jsx)("path", { fill: "none", d: "M0 0h24v24H0z" }), (0, jsx_runtime_1.jsx)("path", { d: "M18.364 5.636L16.95 7.05A7 7 0 1 0 19 12h2a9 9 0 1 1-2.636-6.364z" })] }));
|
|
5
|
-
exports.default = LoadingSpinner;
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const LoadingSpinner = ({ ...props }) => (_jsxs("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: [_jsx("path", { fill: "none", d: "M0 0h24v24H0z" }), _jsx("path", { d: "M18.364 5.636L16.95 7.05A7 7 0 1 0 19 12h2a9 9 0 1 1-2.636-6.364z" })] }));
|
|
3
|
+
export default LoadingSpinner;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const RefreshIcon = ({ ...props }) => ((0, jsx_runtime_1.jsx)("svg", { ...props, width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M8.0115 4.674H10.5075L8.917 3.0825C8.40495 2.57044 7.76711 2.2022 7.06761 2.0148C6.36811 1.82741 5.63161 1.82746 4.93214 2.01496C4.23267 2.20246 3.59489 2.57079 3.0829 3.08293C2.57092 3.59507 2.20279 4.23297 2.0155 4.9325M1.4925 9.822V7.326M1.4925 7.326H3.9885M1.4925 7.326L3.0825 8.9175C3.59456 9.42956 4.2324 9.7978 4.9319 9.9852C5.6314 10.1726 6.3679 10.1725 7.06737 9.98504C7.76684 9.79754 8.40462 9.42921 8.9166 8.91707C9.42859 8.40493 9.79672 7.76703 9.984 7.0675M10.5075 2.178V4.673", stroke: "#384151", strokeOpacity: "0.85", strokeWidth: "0.75", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
5
|
-
exports.default = RefreshIcon;
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const RefreshIcon = ({ ...props }) => (_jsx("svg", { ...props, width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M8.0115 4.674H10.5075L8.917 3.0825C8.40495 2.57044 7.76711 2.2022 7.06761 2.0148C6.36811 1.82741 5.63161 1.82746 4.93214 2.01496C4.23267 2.20246 3.59489 2.57079 3.0829 3.08293C2.57092 3.59507 2.20279 4.23297 2.0155 4.9325M1.4925 9.822V7.326M1.4925 7.326H3.9885M1.4925 7.326L3.0825 8.9175C3.59456 9.42956 4.2324 9.7978 4.9319 9.9852C5.6314 10.1726 6.3679 10.1725 7.06737 9.98504C7.76684 9.79754 8.40462 9.42921 8.9166 8.91707C9.42859 8.40493 9.79672 7.76703 9.984 7.0675M10.5075 2.178V4.673", stroke: "#384151", strokeOpacity: "0.85", strokeWidth: "0.75", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
3
|
+
export default RefreshIcon;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const SearchIcon = ({ ...props }) => ((0, jsx_runtime_1.jsx)("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", d: "M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z", clipRule: "evenodd" }) }));
|
|
5
|
-
exports.default = SearchIcon;
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const SearchIcon = ({ ...props }) => (_jsx("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", children: _jsx("path", { fillRule: "evenodd", d: "M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z", clipRule: "evenodd" }) }));
|
|
3
|
+
export default SearchIcon;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const UpLeftArrowsIcon = ({ ...props }) => ((0, jsx_runtime_1.jsxs)("svg", { ...props, width: "13", height: "13", viewBox: "0 0 13 13", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("rect", { x: "2.125", y: "8", width: "1", height: "3", rx: "0.5", transform: "rotate(45 2.125 8)", fill: "#373531" }), (0, jsx_runtime_1.jsx)("rect", { y: "10.125", width: "1", height: "3", rx: "0.5", transform: "rotate(-45 0 10.125)", fill: "#373531" }), (0, jsx_runtime_1.jsx)("rect", { x: "12.0977", y: "2.125", width: "1", height: "3", rx: "0.5", transform: "rotate(135 12.0977 2.125)", fill: "#373531" }), (0, jsx_runtime_1.jsx)("rect", { x: "9.97266", width: "1", height: "3", rx: "0.5", transform: "rotate(45 9.97266 0)", fill: "#373531" }), (0, jsx_runtime_1.jsx)("path", { d: "M10 1.125V9.125C10 9.67728 9.55228 10.125 9 10.125H1", stroke: "#373531" })] }));
|
|
5
|
-
exports.default = UpLeftArrowsIcon;
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const UpLeftArrowsIcon = ({ ...props }) => (_jsxs("svg", { ...props, width: "13", height: "13", viewBox: "0 0 13 13", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("rect", { x: "2.125", y: "8", width: "1", height: "3", rx: "0.5", transform: "rotate(45 2.125 8)", fill: "#373531" }), _jsx("rect", { y: "10.125", width: "1", height: "3", rx: "0.5", transform: "rotate(-45 0 10.125)", fill: "#373531" }), _jsx("rect", { x: "12.0977", y: "2.125", width: "1", height: "3", rx: "0.5", transform: "rotate(135 12.0977 2.125)", fill: "#373531" }), _jsx("rect", { x: "9.97266", width: "1", height: "3", rx: "0.5", transform: "rotate(45 9.97266 0)", fill: "#373531" }), _jsx("path", { d: "M10 1.125V9.125C10 9.67728 9.55228 10.125 9 10.125H1", stroke: "#373531" })] }));
|
|
3
|
+
export default UpLeftArrowsIcon;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const XCircleIcon = ({ ...props }) => ((0, jsx_runtime_1.jsx)("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z", clipRule: "evenodd" }) }));
|
|
5
|
-
exports.default = XCircleIcon;
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const XCircleIcon = ({ ...props }) => (_jsx("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", children: _jsx("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z", clipRule: "evenodd" }) }));
|
|
3
|
+
export default XCircleIcon;
|
package/dist/assets/XIcon.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const XIcon = ({ ...props }) => ((0, jsx_runtime_1.jsx)("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", height: "20", width: "20", children: (0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", d: "M5.47 5.47a.75.75 0 011.06 0L12 10.94l5.47-5.47a.75.75 0 111.06 1.06L13.06 12l5.47 5.47a.75.75 0 11-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 01-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 010-1.06z", clipRule: "evenodd" }) }));
|
|
5
|
-
exports.default = XIcon;
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const XIcon = ({ ...props }) => (_jsx("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", height: "20", width: "20", children: _jsx("path", { fillRule: "evenodd", d: "M5.47 5.47a.75.75 0 011.06 0L12 10.94l5.47-5.47a.75.75 0 111.06 1.06L13.06 12l5.47 5.47a.75.75 0 11-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 01-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 010-1.06z", clipRule: "evenodd" }) }));
|
|
3
|
+
export default XIcon;
|
package/dist/assets/index.js
CHANGED
|
@@ -1,48 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Object.defineProperty(exports, "DoubleArrowRightHeadIcon", { enumerable: true, get: function () { return __importDefault(DoubleArrowRightHeadIcon_1).default; } });
|
|
23
|
-
var ArrowUpHeadIcon_1 = require("./ArrowUpHeadIcon");
|
|
24
|
-
Object.defineProperty(exports, "ArrowUpHeadIcon", { enumerable: true, get: function () { return __importDefault(ArrowUpHeadIcon_1).default; } });
|
|
25
|
-
var ArrowUpIcon_1 = require("./ArrowUpIcon");
|
|
26
|
-
Object.defineProperty(exports, "ArrowUpIcon", { enumerable: true, get: function () { return __importDefault(ArrowUpIcon_1).default; } });
|
|
27
|
-
var ArrowUpRightIcon_1 = require("./ArrowUpRightIcon");
|
|
28
|
-
Object.defineProperty(exports, "ArrowUpRightIcon", { enumerable: true, get: function () { return __importDefault(ArrowUpRightIcon_1).default; } });
|
|
29
|
-
var CalendarIcon_1 = require("./CalendarIcon");
|
|
30
|
-
Object.defineProperty(exports, "CalendarIcon", { enumerable: true, get: function () { return __importDefault(CalendarIcon_1).default; } });
|
|
31
|
-
var CalendarNormalIcon_1 = require("./CalendarNormalIcon");
|
|
32
|
-
Object.defineProperty(exports, "CalendarNormalIcon", { enumerable: true, get: function () { return __importDefault(CalendarNormalIcon_1).default; } });
|
|
33
|
-
var ExclamationFilledIcon_1 = require("./ExclamationFilledIcon");
|
|
34
|
-
Object.defineProperty(exports, "ExclamationFilledIcon", { enumerable: true, get: function () { return __importDefault(ExclamationFilledIcon_1).default; } });
|
|
35
|
-
var LoadingSpinner_1 = require("./LoadingSpinner");
|
|
36
|
-
Object.defineProperty(exports, "LoadingSpinner", { enumerable: true, get: function () { return __importDefault(LoadingSpinner_1).default; } });
|
|
37
|
-
var SearchIcon_1 = require("./SearchIcon");
|
|
38
|
-
Object.defineProperty(exports, "SearchIcon", { enumerable: true, get: function () { return __importDefault(SearchIcon_1).default; } });
|
|
39
|
-
var XCircleIcon_1 = require("./XCircleIcon");
|
|
40
|
-
Object.defineProperty(exports, "XCircleIcon", { enumerable: true, get: function () { return __importDefault(XCircleIcon_1).default; } });
|
|
41
|
-
var RefreshIcon_1 = require("./RefreshIcon");
|
|
42
|
-
Object.defineProperty(exports, "RefreshIcon", { enumerable: true, get: function () { return __importDefault(RefreshIcon_1).default; } });
|
|
43
|
-
var FilterIcon_1 = require("./FilterIcon");
|
|
44
|
-
Object.defineProperty(exports, "FilterIcon", { enumerable: true, get: function () { return __importDefault(FilterIcon_1).default; } });
|
|
45
|
-
var UpLeftArrowsIcon_1 = require("./UpLeftArrowsIcon");
|
|
46
|
-
Object.defineProperty(exports, "UpLeftArrowsIcon", { enumerable: true, get: function () { return __importDefault(UpLeftArrowsIcon_1).default; } });
|
|
47
|
-
var XIcon_1 = require("./XIcon");
|
|
48
|
-
Object.defineProperty(exports, "XIcon", { enumerable: true, get: function () { return __importDefault(XIcon_1).default; } });
|
|
1
|
+
export { default as ArrowDownHeadIcon } from './ArrowDownHeadIcon';
|
|
2
|
+
export { default as ArrowDownRightIcon } from './ArrowDownRightIcon';
|
|
3
|
+
export { default as ArrowDownIcon } from './ArrowDownIcon';
|
|
4
|
+
export { default as ArrowRightIcon } from './ArrowRightIcon';
|
|
5
|
+
export { default as ArrowRightHeadIcon } from './ArrowRightHeadIcon';
|
|
6
|
+
export { default as ArrowLeftHeadIcon } from './ArrowLeftHeadIcon';
|
|
7
|
+
export { default as DoubleArrowLeftHeadIcon } from './DoubleArrowLeftHeadIcon';
|
|
8
|
+
export { default as DoubleArrowRightHeadIcon } from './DoubleArrowRightHeadIcon';
|
|
9
|
+
export { default as ArrowUpHeadIcon } from './ArrowUpHeadIcon';
|
|
10
|
+
export { default as ArrowUpIcon } from './ArrowUpIcon';
|
|
11
|
+
export { default as ArrowUpRightIcon } from './ArrowUpRightIcon';
|
|
12
|
+
export { default as CalendarIcon } from './CalendarIcon';
|
|
13
|
+
export { default as CalendarNormalIcon } from './CalendarNormalIcon';
|
|
14
|
+
export { default as ExclamationFilledIcon } from './ExclamationFilledIcon';
|
|
15
|
+
export { default as LoadingSpinner } from './LoadingSpinner';
|
|
16
|
+
export { default as SearchIcon } from './SearchIcon';
|
|
17
|
+
export { default as XCircleIcon } from './XCircleIcon';
|
|
18
|
+
export { default as RefreshIcon } from './RefreshIcon';
|
|
19
|
+
export { default as FilterIcon } from './FilterIcon';
|
|
20
|
+
export { default as UpLeftArrowsIcon } from './UpLeftArrowsIcon';
|
|
21
|
+
export { default as XIcon } from './XIcon';
|
|
@@ -1,39 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
2
|
// @ts-nocheck
|
|
28
3
|
/* eslint-disable react/display-name */
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const BigModal =
|
|
4
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { useOnClickOutside, useOnWindowResize } from '../../hooks';
|
|
6
|
+
import { mergeRefs } from '../../lib';
|
|
7
|
+
const BigModal = React.forwardRef((props, ref) => {
|
|
33
8
|
const { showModal, setShowModal, parentRef, width, maxHeight = '18rem', children, className, theme, ...other } = props;
|
|
34
|
-
const [modalExceedsWindow, setModalExceedsWindow] =
|
|
35
|
-
const modalRef =
|
|
36
|
-
const checkModalExceedsWindow =
|
|
9
|
+
const [modalExceedsWindow, setModalExceedsWindow] = useState(false);
|
|
10
|
+
const modalRef = useRef(null);
|
|
11
|
+
const checkModalExceedsWindow = useCallback((modalWidth, windowWidth) => {
|
|
37
12
|
if (!parentRef.current) {
|
|
38
13
|
return false;
|
|
39
14
|
}
|
|
@@ -43,7 +18,7 @@ const BigModal = react_1.default.forwardRef((props, ref) => {
|
|
|
43
18
|
const getAbsoluteSpacing = () => {
|
|
44
19
|
return modalExceedsWindow ? '0' : '0';
|
|
45
20
|
};
|
|
46
|
-
|
|
21
|
+
useOnClickOutside(modalRef, e => {
|
|
47
22
|
// Exclude click on trigger button (e.g. Dropdown Button) from outside click handler
|
|
48
23
|
const isTriggerElem = parentRef
|
|
49
24
|
? parentRef.current?.contains(e.target)
|
|
@@ -53,17 +28,17 @@ const BigModal = react_1.default.forwardRef((props, ref) => {
|
|
|
53
28
|
}
|
|
54
29
|
});
|
|
55
30
|
// Execute only when modal is of absolute size
|
|
56
|
-
|
|
31
|
+
useEffect(() => {
|
|
57
32
|
if (width) {
|
|
58
33
|
setModalExceedsWindow(checkModalExceedsWindow(width, window.innerWidth));
|
|
59
34
|
}
|
|
60
35
|
}, [checkModalExceedsWindow, parentRef, width]);
|
|
61
|
-
|
|
36
|
+
useOnWindowResize(() => {
|
|
62
37
|
if (width) {
|
|
63
38
|
setModalExceedsWindow(checkModalExceedsWindow(width, window.innerWidth));
|
|
64
39
|
}
|
|
65
40
|
});
|
|
66
|
-
return showModal ? ((
|
|
41
|
+
return showModal ? (_jsx("div", { ref: mergeRefs([modalRef, ref]), style: {
|
|
67
42
|
position: 'absolute',
|
|
68
43
|
zIndex: 10,
|
|
69
44
|
overflowY: 'auto',
|
|
@@ -84,4 +59,4 @@ const BigModal = react_1.default.forwardRef((props, ref) => {
|
|
|
84
59
|
transform: 'translate(-50%, -50%)',
|
|
85
60
|
}, ...other, children: children })) : null;
|
|
86
61
|
});
|
|
87
|
-
|
|
62
|
+
export default BigModal;
|
|
@@ -1,60 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
30
2
|
/* eslint-disable react/display-name */
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const Dropdown =
|
|
3
|
+
import React, { useRef, useState } from 'react';
|
|
4
|
+
import { HoveredValueContext, SelectedValueContext } from '../../contexts';
|
|
5
|
+
import { useInternalState, useSelectOnKeyDown } from '../../hooks';
|
|
6
|
+
import { ArrowDownHeadIcon } from '../../assets';
|
|
7
|
+
import { mergeRefs } from '../../lib';
|
|
8
|
+
import { constructValueToNameMapping, hasValue } from '../selectUtils';
|
|
9
|
+
import Modal from '../Modal';
|
|
10
|
+
const Dropdown = React.forwardRef((props, ref) => {
|
|
39
11
|
const { defaultValue, value, onValueChange, placeholder = 'Select...', disabled = false, icon, children, className, theme, ...other } = props;
|
|
40
|
-
const [selectedValue, setSelectedValue] =
|
|
41
|
-
const [isFocused, setIsFocused] =
|
|
42
|
-
const dropdownRef =
|
|
12
|
+
const [selectedValue, setSelectedValue] = useInternalState(defaultValue, value);
|
|
13
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
14
|
+
const dropdownRef = useRef(null);
|
|
43
15
|
const Icon = icon;
|
|
44
|
-
const valueToNameMapping =
|
|
45
|
-
const optionValues =
|
|
16
|
+
const valueToNameMapping = constructValueToNameMapping(children);
|
|
17
|
+
const optionValues = React.Children.map(children, (child) => child.props.value);
|
|
46
18
|
const handleValueChange = (value) => {
|
|
47
19
|
setSelectedValue(value);
|
|
48
20
|
setIsFocused(false);
|
|
49
21
|
onValueChange?.(value);
|
|
50
22
|
};
|
|
51
|
-
const [hoveredValue, handleKeyDown] =
|
|
52
|
-
const hasSelection =
|
|
53
|
-
return ((
|
|
23
|
+
const [hoveredValue, handleKeyDown] = useSelectOnKeyDown(handleValueChange, optionValues, isFocused, setIsFocused, selectedValue);
|
|
24
|
+
const hasSelection = hasValue(selectedValue);
|
|
25
|
+
return (_jsxs("div", { ref: mergeRefs([dropdownRef, ref]), onKeyDown: handleKeyDown, style: {
|
|
54
26
|
position: 'relative',
|
|
55
27
|
width: '100%',
|
|
56
28
|
minWidth: '10rem',
|
|
57
|
-
}, ...other, children: [(
|
|
29
|
+
}, ...other, children: [_jsxs("button", { style: {
|
|
58
30
|
display: 'flex',
|
|
59
31
|
justifyContent: 'space-between',
|
|
60
32
|
alignItems: 'center',
|
|
@@ -66,20 +38,20 @@ const Dropdown = react_1.default.forwardRef((props, ref) => {
|
|
|
66
38
|
boxShadow: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
|
|
67
39
|
cursor: 'pointer',
|
|
68
40
|
background: 'white',
|
|
69
|
-
}, type: "button", onClick: () => setIsFocused(!isFocused), disabled: disabled, children: [(
|
|
41
|
+
}, type: "button", onClick: () => setIsFocused(!isFocused), disabled: disabled, children: [_jsxs("div", { style: {
|
|
70
42
|
display: 'flex',
|
|
71
43
|
justifyContent: 'start',
|
|
72
44
|
alignItems: 'center',
|
|
73
45
|
whiteSpace: 'nowrap',
|
|
74
46
|
overflow: 'hidden',
|
|
75
47
|
textOverflow: 'ellipsis',
|
|
76
|
-
}, children: [Icon ? ((
|
|
48
|
+
}, children: [Icon ? (_jsx(Icon, { style: {
|
|
77
49
|
flexShrink: 0,
|
|
78
50
|
height: '1.5rem',
|
|
79
51
|
width: '1.5rem',
|
|
80
52
|
color: theme?.secondaryTextColor || '#6C727F',
|
|
81
53
|
marginRight: '1.5rem',
|
|
82
|
-
}, "aria-hidden": "true" })) : null, (
|
|
54
|
+
}, "aria-hidden": "true" })) : null, _jsx("p", { style: {
|
|
83
55
|
margin: 0,
|
|
84
56
|
fontSize: '13px',
|
|
85
57
|
fontWeight: '500',
|
|
@@ -88,12 +60,12 @@ const Dropdown = react_1.default.forwardRef((props, ref) => {
|
|
|
88
60
|
textOverflow: 'ellipsis',
|
|
89
61
|
}, children: selectedValue
|
|
90
62
|
? valueToNameMapping.get(selectedValue)
|
|
91
|
-
: placeholder })] }), (
|
|
63
|
+
: placeholder })] }), _jsx(ArrowDownHeadIcon, { style: {
|
|
92
64
|
flexShrink: 0,
|
|
93
65
|
height: '1.5rem',
|
|
94
66
|
width: '1.5rem',
|
|
95
67
|
marginRight: '-0.25rem',
|
|
96
68
|
color: theme?.secondaryTextColor || '#6C727F',
|
|
97
|
-
}, "aria-hidden": "true" })] }), (
|
|
69
|
+
}, "aria-hidden": "true" })] }), _jsx(Modal, { theme: theme, showModal: isFocused, setShowModal: setIsFocused, parentRef: dropdownRef, children: _jsx(SelectedValueContext.Provider, { value: { selectedValue, handleValueChange }, children: _jsx(HoveredValueContext.Provider, { value: { hoveredValue }, children: React.Children.map(children, (child) => React.cloneElement(child)) }) }) })] }));
|
|
98
70
|
});
|
|
99
|
-
|
|
71
|
+
export default Dropdown;
|
|
@@ -1,40 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
2
|
/* eslint-disable react/display-name */
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const DropdownItem =
|
|
3
|
+
import React, { useContext } from 'react';
|
|
4
|
+
import { HoveredValueContext, SelectedValueContext } from '../../contexts';
|
|
5
|
+
const DropdownItem = React.forwardRef((props, ref) => {
|
|
31
6
|
const { value, text, icon, className, theme, lastItem, ...other } = props;
|
|
32
|
-
const { selectedValue, handleValueChange } =
|
|
33
|
-
const { hoveredValue } =
|
|
7
|
+
const { selectedValue, handleValueChange } = useContext(SelectedValueContext);
|
|
8
|
+
const { hoveredValue } = useContext(HoveredValueContext);
|
|
34
9
|
const isActive = selectedValue === value;
|
|
35
10
|
const isHovered = hoveredValue === value;
|
|
36
11
|
const Icon = icon ? icon : null;
|
|
37
|
-
return ((
|
|
12
|
+
return (_jsx("button", { ref: ref, style: {
|
|
38
13
|
display: 'flex',
|
|
39
14
|
alignItems: 'center',
|
|
40
15
|
justifyContent: 'start',
|
|
@@ -55,7 +30,7 @@ const DropdownItem = react_1.default.forwardRef((props, ref) => {
|
|
|
55
30
|
borderLeft: 'none',
|
|
56
31
|
cursor: 'pointer',
|
|
57
32
|
color: theme?.secondaryTextColor || '#364153',
|
|
58
|
-
}, type: "button", onClick: () => handleValueChange?.(value), ...other, children: (
|
|
33
|
+
}, type: "button", onClick: () => handleValueChange?.(value), ...other, children: _jsx("p", { style: {
|
|
59
34
|
margin: 0,
|
|
60
35
|
fontFamily: theme?.fontFamily,
|
|
61
36
|
color: theme?.primaryTextColor,
|
|
@@ -64,4 +39,4 @@ const DropdownItem = react_1.default.forwardRef((props, ref) => {
|
|
|
64
39
|
textOverflow: 'ellipsis',
|
|
65
40
|
}, children: text ?? value }) }));
|
|
66
41
|
});
|
|
67
|
-
|
|
42
|
+
export default DropdownItem;
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DropdownItem = exports.Dropdown = void 0;
|
|
7
|
-
var Dropdown_1 = require("./Dropdown");
|
|
8
|
-
Object.defineProperty(exports, "Dropdown", { enumerable: true, get: function () { return __importDefault(Dropdown_1).default; } });
|
|
9
|
-
var DropdownItem_1 = require("./DropdownItem");
|
|
10
|
-
Object.defineProperty(exports, "DropdownItem", { enumerable: true, get: function () { return __importDefault(DropdownItem_1).default; } });
|
|
1
|
+
export { default as Dropdown } from "./Dropdown";
|
|
2
|
+
export { default as DropdownItem } from "./DropdownItem";
|
|
@@ -1,39 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
2
|
// @ts-nocheck
|
|
28
3
|
/* eslint-disable react/display-name */
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const Modal =
|
|
4
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { useOnClickOutside, useOnWindowResize } from '../../hooks';
|
|
6
|
+
import { mergeRefs } from '../../lib';
|
|
7
|
+
const Modal = React.forwardRef((props, ref) => {
|
|
33
8
|
const { showModal, setShowModal, parentRef, width, maxHeight = '18rem', children, className, theme, ...other } = props;
|
|
34
|
-
const [modalExceedsWindow, setModalExceedsWindow] =
|
|
35
|
-
const modalRef =
|
|
36
|
-
const checkModalExceedsWindow =
|
|
9
|
+
const [modalExceedsWindow, setModalExceedsWindow] = useState(false);
|
|
10
|
+
const modalRef = useRef(null);
|
|
11
|
+
const checkModalExceedsWindow = useCallback((modalWidth, windowWidth) => {
|
|
37
12
|
if (!parentRef.current) {
|
|
38
13
|
return false;
|
|
39
14
|
}
|
|
@@ -43,7 +18,7 @@ const Modal = react_1.default.forwardRef((props, ref) => {
|
|
|
43
18
|
const getAbsoluteSpacing = () => {
|
|
44
19
|
return modalExceedsWindow ? '0' : '0';
|
|
45
20
|
};
|
|
46
|
-
|
|
21
|
+
useOnClickOutside(modalRef, e => {
|
|
47
22
|
// Exclude click on trigger button (e.g. Dropdown Button) from outside click handler
|
|
48
23
|
const isTriggerElem = parentRef
|
|
49
24
|
? parentRef.current?.contains(e.target)
|
|
@@ -53,17 +28,17 @@ const Modal = react_1.default.forwardRef((props, ref) => {
|
|
|
53
28
|
}
|
|
54
29
|
});
|
|
55
30
|
// Execute only when modal is of absolute size
|
|
56
|
-
|
|
31
|
+
useEffect(() => {
|
|
57
32
|
if (width) {
|
|
58
33
|
setModalExceedsWindow(checkModalExceedsWindow(width, window.innerWidth));
|
|
59
34
|
}
|
|
60
35
|
}, [checkModalExceedsWindow, parentRef, width]);
|
|
61
|
-
|
|
36
|
+
useOnWindowResize(() => {
|
|
62
37
|
if (width) {
|
|
63
38
|
setModalExceedsWindow(checkModalExceedsWindow(width, window.innerWidth));
|
|
64
39
|
}
|
|
65
40
|
});
|
|
66
|
-
return showModal ? ((
|
|
41
|
+
return showModal ? (_jsx("div", { ref: mergeRefs([modalRef, ref]), style: {
|
|
67
42
|
position: 'absolute',
|
|
68
43
|
zIndex: 10,
|
|
69
44
|
overflowY: 'auto',
|
|
@@ -87,4 +62,4 @@ const Modal = react_1.default.forwardRef((props, ref) => {
|
|
|
87
62
|
boxShadow: '0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)',
|
|
88
63
|
}, ...other, children: children })) : null;
|
|
89
64
|
});
|
|
90
|
-
|
|
65
|
+
export default Modal;
|