@widergy/energy-ui 2.12.2 → 2.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/EnergyThemeProvider/index.js +13 -36
- package/dist/components/Loading/constants.js +1 -2
- package/dist/components/Loading/index.js +13 -12
- package/dist/components/Loading/theme.js +4 -2
- package/dist/components/UTAlert/AlertHandler.js +75 -101
- package/dist/components/UTAlert/index.js +65 -87
- package/dist/components/UTAlert/theme.js +32 -32
- package/dist/components/UTAttachment/components/Preview/index.js +8 -9
- package/dist/components/UTAttachment/constants.js +7 -13
- package/dist/components/UTAttachment/index.js +159 -250
- package/dist/components/UTAttachment/layout.js +26 -27
- package/dist/components/UTAttachment/theme.js +4 -2
- package/dist/components/UTAttachment/utils.js +34 -117
- package/dist/components/UTAutocomplete/components/ListBox/index.js +13 -21
- package/dist/components/UTAutocomplete/components/ListBox/utils.js +9 -11
- package/dist/components/UTAutocomplete/constants.js +12 -23
- package/dist/components/UTAutocomplete/index.js +54 -94
- package/dist/components/UTAutocomplete/theme.js +6 -4
- package/dist/components/UTAvatar/constants.js +2 -3
- package/dist/components/UTAvatar/index.js +18 -17
- package/dist/components/UTBarChart/components/Bars/components/Bar/components/Rect/index.js +22 -22
- package/dist/components/UTBarChart/components/Bars/components/Bar/constants.js +1 -1
- package/dist/components/UTBarChart/components/Bars/components/Bar/index.js +21 -22
- package/dist/components/UTBarChart/components/Bars/constants.js +3 -6
- package/dist/components/UTBarChart/components/Bars/index.js +70 -80
- package/dist/components/UTBarChart/components/Legend/constants.js +12 -18
- package/dist/components/UTBarChart/components/Legend/index.js +75 -93
- package/dist/components/UTBarChart/components/Legend/utils.js +1 -5
- package/dist/components/UTBarChart/components/Levels/index.js +16 -14
- package/dist/components/UTBarChart/components/Levels/utils.js +25 -27
- package/dist/components/UTBarChart/components/LinearPlot/constants.js +3 -5
- package/dist/components/UTBarChart/components/LinearPlot/index.js +25 -20
- package/dist/components/UTBarChart/components/LinearPlot/utils.js +37 -39
- package/dist/components/UTBarChart/components/Pagination/constants.js +1 -2
- package/dist/components/UTBarChart/components/Pagination/index.js +20 -24
- package/dist/components/UTBarChart/components/XAxis/components/AxisElement/index.js +21 -32
- package/dist/components/UTBarChart/components/XAxis/components/Decoration/constants.js +2 -4
- package/dist/components/UTBarChart/components/XAxis/components/Decoration/index.js +20 -19
- package/dist/components/UTBarChart/components/XAxis/constants.js +1 -2
- package/dist/components/UTBarChart/components/XAxis/index.js +54 -65
- package/dist/components/UTBarChart/components/YAxis/AxisElement/index.js +12 -11
- package/dist/components/UTBarChart/components/YAxis/constants.js +1 -2
- package/dist/components/UTBarChart/components/YAxis/index.js +30 -37
- package/dist/components/UTBarChart/components/YAxis/utils.js +4 -6
- package/dist/components/UTBarChart/constants.js +4 -8
- package/dist/components/UTBarChart/hooks/use-dynamic-margins.js +23 -40
- package/dist/components/UTBarChart/index.js +152 -166
- package/dist/components/UTBarChart/theme.js +4 -2
- package/dist/components/UTBarChart/types.js +10 -19
- package/dist/components/UTBarChart/utils.js +107 -111
- package/dist/components/UTBreadcrumbs/constants.js +23 -31
- package/dist/components/UTBreadcrumbs/index.js +76 -101
- package/dist/components/UTBreadcrumbs/theme.js +4 -2
- package/dist/components/UTButton/constants.js +11 -17
- package/dist/components/UTButton/index.js +28 -31
- package/dist/components/UTButton/theme.js +23 -23
- package/dist/components/UTCBUInput/index.js +36 -40
- package/dist/components/UTCBUInput/theme.js +4 -2
- package/dist/components/UTCaptcha/index.js +19 -45
- package/dist/components/UTCard/components/UTCardFooter/index.js +15 -16
- package/dist/components/UTCard/index.js +85 -120
- package/dist/components/UTCard/theme.js +11 -12
- package/dist/components/UTCard/types.js +2 -3
- package/dist/components/UTCarousel/components/Button/index.js +13 -13
- package/dist/components/UTCarousel/components/Legend/index.js +13 -15
- package/dist/components/UTCarousel/components/Slider/component/Slide/index.js +16 -16
- package/dist/components/UTCarousel/components/Slider/constants.js +5 -10
- package/dist/components/UTCarousel/components/Slider/index.js +204 -273
- package/dist/components/UTCarousel/components/Slider/layout.js +67 -94
- package/dist/components/UTCarousel/index.js +14 -15
- package/dist/components/UTCarousel/theme.js +4 -2
- package/dist/components/UTCheckList/constants.js +1 -2
- package/dist/components/UTCheckList/index.js +72 -93
- package/dist/components/UTCheckList/theme.js +31 -31
- package/dist/components/UTCheckbox/constants.js +3 -6
- package/dist/components/UTCheckbox/index.js +32 -44
- package/dist/components/UTCheckbox/theme.js +35 -35
- package/dist/components/UTConsumptionBar/components/ConsumptionBarIndicator/index.js +9 -9
- package/dist/components/UTConsumptionBar/constants.js +3 -6
- package/dist/components/UTConsumptionBar/index.js +53 -80
- package/dist/components/UTCuit/index.js +109 -133
- package/dist/components/UTCuit/theme.js +51 -53
- package/dist/components/UTDatePicker/components/Day/constants.js +1 -2
- package/dist/components/UTDatePicker/components/Day/index.js +12 -12
- package/dist/components/UTDatePicker/constants.js +20 -31
- package/dist/components/UTDatePicker/index.js +60 -102
- package/dist/components/UTDatePicker/theme.js +5 -3
- package/dist/components/UTDatePicker/types.js +2 -3
- package/dist/components/UTDatePicker/utils.js +2 -6
- package/dist/components/UTDialog/constants.js +2 -4
- package/dist/components/UTDialog/index.js +38 -37
- package/dist/components/UTDialog/theme.js +4 -2
- package/dist/components/UTDialog/types.js +2 -3
- package/dist/components/UTDotMenu/index.js +39 -61
- package/dist/components/UTEmojiPicker/constants.js +6 -11
- package/dist/components/UTEmojiPicker/index.js +45 -65
- package/dist/components/UTEmojiPicker/theme.js +4 -2
- package/dist/components/UTEmojiPicker/utils.js +21 -51
- package/dist/components/UTExternalLink/constants.js +3 -5
- package/dist/components/UTExternalLink/index.js +18 -15
- package/dist/components/UTExternalLink/theme.js +8 -6
- package/dist/components/UTFileInput/constants.js +2 -4
- package/dist/components/UTFileInput/index.js +7 -31
- package/dist/components/UTFileInput/layout.js +68 -97
- package/dist/components/UTIconButton/index.js +49 -72
- package/dist/components/UTIconButton/theme.js +4 -2
- package/dist/components/UTImageRadio/components/ImageRadioCard/index.js +53 -58
- package/dist/components/UTImageRadio/constants.js +3 -6
- package/dist/components/UTImageRadio/index.js +39 -47
- package/dist/components/UTImageRadio/theme.js +11 -12
- package/dist/components/UTImageRadio/types.js +2 -3
- package/dist/components/UTImageRadio/utils.js +2 -6
- package/dist/components/UTLabel/constants.js +14 -20
- package/dist/components/UTLabel/index.js +18 -20
- package/dist/components/UTLabel/theme.js +15 -15
- package/dist/components/UTList/index.js +15 -18
- package/dist/components/UTLoading/index.js +15 -15
- package/dist/components/UTMap/components/GoogleMaps/constants.js +8 -11
- package/dist/components/UTMap/components/GoogleMaps/index.js +63 -91
- package/dist/components/UTMap/components/GoogleMaps/styles.js +2 -3
- package/dist/components/UTMap/constants.js +6 -12
- package/dist/components/UTMap/index.js +163 -198
- package/dist/components/UTMap/types.js +4 -6
- package/dist/components/UTMap/utils.js +29 -46
- package/dist/components/UTMap/withGoogleMapScript.js +18 -22
- package/dist/components/UTMenu/index.js +52 -69
- package/dist/components/UTMenu/theme.js +5 -3
- package/dist/components/UTMenu/utils.js +5 -11
- package/dist/components/UTModal/constants.js +9 -13
- package/dist/components/UTModal/index.js +26 -30
- package/dist/components/UTModal/theme.js +4 -2
- package/dist/components/UTPagination/components/PageSizeSelector/index.js +11 -10
- package/dist/components/UTPagination/components/PageSizeSelector/utils.js +7 -13
- package/dist/components/UTPagination/components/Pagination/components/NavigationButton/index.js +12 -12
- package/dist/components/UTPagination/components/Pagination/index.js +28 -39
- package/dist/components/UTPagination/components/Pagination/utils.js +8 -14
- package/dist/components/UTPagination/constants.js +3 -6
- package/dist/components/UTPagination/index.js +16 -17
- package/dist/components/UTPagination/theme.js +4 -2
- package/dist/components/UTPanel/index.js +38 -44
- package/dist/components/UTPasswordField/components/PasswordValidations/components/Error/index.js +13 -10
- package/dist/components/UTPasswordField/components/PasswordValidations/components/Validation/index.js +22 -19
- package/dist/components/UTPasswordField/components/PasswordValidations/index.js +63 -50
- package/dist/components/UTPasswordField/components/PasswordWarning/index.js +25 -26
- package/dist/components/UTPasswordField/index.js +26 -23
- package/dist/components/UTPasswordField/theme.js +4 -2
- package/dist/components/UTPhoneInput/constants.js +3 -6
- package/dist/components/UTPhoneInput/index.js +180 -205
- package/dist/components/UTPhoneInput/theme.js +77 -77
- package/dist/components/UTPieChart/components/ArrowLabel/constants.js +4 -8
- package/dist/components/UTPieChart/components/ArrowLabel/index.js +24 -23
- package/dist/components/UTPieChart/components/Legend/contants.js +3 -6
- package/dist/components/UTPieChart/components/Legend/index.js +27 -24
- package/dist/components/UTPieChart/constants.js +13 -26
- package/dist/components/UTPieChart/hooks/use-animated-value/index.js +15 -33
- package/dist/components/UTPieChart/index.js +73 -76
- package/dist/components/UTPieChart/theme.js +4 -2
- package/dist/components/UTPieChart/utils.js +4 -2
- package/dist/components/UTProgressBar/constants.js +2 -4
- package/dist/components/UTProgressBar/index.js +15 -17
- package/dist/components/UTProgressBar/theme.js +4 -2
- package/dist/components/UTProgressBar/types.js +2 -3
- package/dist/components/UTRadioGroup/index.js +56 -83
- package/dist/components/UTRadioGroup/theme.js +52 -52
- package/dist/components/UTRating/components/Circle/index.js +41 -56
- package/dist/components/UTRating/components/Faces/constants.js +2 -4
- package/dist/components/UTRating/components/Faces/index.js +34 -36
- package/dist/components/UTRating/components/Star/index.js +36 -40
- package/dist/components/UTRating/constants.js +4 -8
- package/dist/components/UTRating/index.js +31 -46
- package/dist/components/UTRating/theme.js +4 -2
- package/dist/components/UTRipple/Ripple.js +22 -39
- package/dist/components/UTRipple/index.js +18 -37
- package/dist/components/UTSelect/components/Option/index.js +13 -13
- package/dist/components/UTSelect/constants.js +4 -8
- package/dist/components/UTSelect/index.js +63 -85
- package/dist/components/UTSelect/stylesJS.js +2 -3
- package/dist/components/UTSelect/theme.js +6 -4
- package/dist/components/UTSelect/utils.js +3 -13
- package/dist/components/UTSidebar/components/ListOption/index.js +34 -49
- package/dist/components/UTSidebar/components/LogosContainer/components/DynamicIcon/index.js +8 -8
- package/dist/components/UTSidebar/components/LogosContainer/index.js +14 -14
- package/dist/components/UTSidebar/components/Option/constants.js +2 -3
- package/dist/components/UTSidebar/components/Option/index.js +28 -32
- package/dist/components/UTSidebar/components/Toggler/index.js +11 -11
- package/dist/components/UTSidebar/index.js +42 -53
- package/dist/components/UTSidebar/theme.js +4 -2
- package/dist/components/UTSidebar/types.js +5 -10
- package/dist/components/UTSkeleton/index.js +10 -36
- package/dist/components/UTStatus/constants.js +5 -9
- package/dist/components/UTStatus/index.js +16 -15
- package/dist/components/UTStatus/theme.js +66 -49
- package/dist/components/UTSwitch/constants.js +3 -6
- package/dist/components/UTSwitch/index.js +42 -57
- package/dist/components/UTSwitch/theme.js +4 -2
- package/dist/components/UTTable/components/ActionIcons/constants.js +1 -2
- package/dist/components/UTTable/components/ActionIcons/index.js +47 -85
- package/dist/components/UTTable/components/Cell/components/ActionButton/index.js +10 -12
- package/dist/components/UTTable/components/Cell/index.js +18 -23
- package/dist/components/UTTable/components/HeaderCell/constants.js +2 -3
- package/dist/components/UTTable/components/HeaderCell/index.js +23 -30
- package/dist/components/UTTable/components/HeaderCell/utils.js +3 -3
- package/dist/components/UTTable/components/PrimaryAction/index.js +12 -11
- package/dist/components/UTTable/components/ResponsiveCell/index.js +19 -20
- package/dist/components/UTTable/components/Status/index.js +18 -19
- package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/index.js +10 -9
- package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/utils.js +7 -13
- package/dist/components/UTTable/components/TableFooter/components/Pagination/components/NavigationButton/index.js +12 -12
- package/dist/components/UTTable/components/TableFooter/components/Pagination/index.js +21 -32
- package/dist/components/UTTable/components/TableFooter/components/Pagination/utils.js +8 -14
- package/dist/components/UTTable/components/TableFooter/constants.js +1 -2
- package/dist/components/UTTable/components/TableFooter/index.js +15 -15
- package/dist/components/UTTable/components/TableHeader/index.js +11 -11
- package/dist/components/UTTable/components/TableRow/constants.js +3 -6
- package/dist/components/UTTable/components/TableRow/index.js +82 -95
- package/dist/components/UTTable/components/TableRow/styles.module.scss +8 -1
- package/dist/components/UTTable/components/TableRow/utils.js +15 -0
- package/dist/components/UTTable/constants.js +26 -43
- package/dist/components/UTTable/hook.js +11 -26
- package/dist/components/UTTable/index.js +129 -220
- package/dist/components/UTTable/theme.js +17 -17
- package/dist/components/UTTable/types.js +4 -8
- package/dist/components/UTTable/utils.js +70 -74
- package/dist/components/UTTabs/components/TooltipTab/index.js +20 -30
- package/dist/components/UTTabs/constants.js +4 -8
- package/dist/components/UTTabs/index.js +57 -86
- package/dist/components/UTTabs/theme.js +4 -2
- package/dist/components/UTTabs/utils.js +1 -1
- package/dist/components/UTTextArea/constants.js +3 -6
- package/dist/components/UTTextArea/index.js +23 -23
- package/dist/components/UTTextArea/theme.js +4 -2
- package/dist/components/UTTextInput/constants.js +2 -3
- package/dist/components/UTTextInput/index.js +137 -165
- package/dist/components/UTTextInput/theme.js +6 -4
- package/dist/components/UTThirdPartyCookieChecker/index.js +17 -21
- package/dist/components/UTToggle/components/ToggleOption/index.js +16 -17
- package/dist/components/UTToggle/index.js +25 -26
- package/dist/components/UTToggle/theme.js +4 -2
- package/dist/components/UTTooltip/index.js +23 -30
- package/dist/components/UTTooltip/theme.js +4 -2
- package/dist/components/UTTopbar/components/Notifications/index.js +11 -14
- package/dist/components/UTTopbar/components/UserMenu/index.js +15 -15
- package/dist/components/UTTopbar/index.js +28 -31
- package/dist/components/UTTopbar/theme.js +4 -2
- package/dist/components/UTTopbar/types.js +5 -9
- package/dist/components/UTTouchableWithoutFeedback/index.js +14 -27
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/constants.js +2 -4
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/index.js +34 -31
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/utils.js +4 -4
- package/dist/components/UTVirtualizedList/components/VirtualizedData/constants.js +6 -12
- package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-ledger.js +8 -18
- package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-virtualized-data.js +23 -47
- package/dist/components/UTVirtualizedList/components/VirtualizedData/index.js +31 -34
- package/dist/components/UTVirtualizedList/components/VirtualizedData/utils.js +81 -93
- package/dist/components/UTVirtualizedList/constants.js +4 -8
- package/dist/components/UTVirtualizedList/index.js +26 -38
- package/dist/components/UTWorkflowContainer/components/ActionButton/index.js +17 -21
- package/dist/components/UTWorkflowContainer/constants.js +3 -6
- package/dist/components/UTWorkflowContainer/hooks/use-previous.js +3 -3
- package/dist/components/UTWorkflowContainer/index.js +32 -51
- package/dist/components/UTWorkflowContainer/theme.js +60 -53
- package/dist/components/UTWorkflowContainer/types.js +2 -3
- package/dist/components/WithLoading/index.js +10 -15
- package/dist/components/WithTheme/index.js +10 -17
- package/dist/components/WithTheme/layout.js +22 -28
- package/dist/components/WithTouch/index.js +12 -19
- package/dist/constants/UTTable.js +2 -3
- package/dist/index.js +58 -58
- package/dist/theme.js +6 -5
- package/dist/types/commonTypes.js +3 -5
- package/dist/types/consumptionTypes.js +3 -5
- package/dist/types/formTypes.js +4 -7
- package/dist/types/tableTypes.js +2 -3
- package/dist/utils/classesUtils.js +5 -13
- package/dist/utils/componentUtils.js +10 -13
- package/dist/utils/helperFunctions.js +4 -4
- package/dist/utils/shadowUtils.js +13 -11
- package/dist/utils/useScreenSize.js +2 -3
- package/package.json +1 -1
|
@@ -1,40 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = void 0;
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
8
|
var _propTypes = require("prop-types");
|
|
10
|
-
function _getRequireWildcardCache(
|
|
11
|
-
function _interopRequireWildcard(
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
11
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
13
|
-
|
|
14
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
17
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
18
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
-
var AxisElement = function AxisElement(_ref) {
|
|
12
|
+
const AxisElement = _ref => {
|
|
20
13
|
var _textRef$getBoundingC, _textRef$getBoundingC2, _textRef$getBoundingC3;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
setTextRef = _useState2[1];
|
|
14
|
+
let {
|
|
15
|
+
x,
|
|
16
|
+
graphYStart,
|
|
17
|
+
className,
|
|
18
|
+
mainLabel,
|
|
19
|
+
mainLabelStyles,
|
|
20
|
+
secondaryLabel,
|
|
21
|
+
color,
|
|
22
|
+
yOffset,
|
|
23
|
+
circle,
|
|
24
|
+
selected,
|
|
25
|
+
selectedLabelBackground,
|
|
26
|
+
labelBackgroundPadding
|
|
27
|
+
} = _ref;
|
|
28
|
+
const y = graphYStart + yOffset;
|
|
29
|
+
const [textRef, setTextRef] = (0, _react.useState)();
|
|
38
30
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, secondaryLabel && /*#__PURE__*/_react.default.createElement("text", {
|
|
39
31
|
className: className,
|
|
40
32
|
textAnchor: "middle",
|
|
@@ -52,9 +44,7 @@ var AxisElement = function AxisElement(_ref) {
|
|
|
52
44
|
fill: selectedLabelBackground,
|
|
53
45
|
rx: "14"
|
|
54
46
|
}), /*#__PURE__*/_react.default.createElement("text", _extends({
|
|
55
|
-
ref:
|
|
56
|
-
return setTextRef(el);
|
|
57
|
-
},
|
|
47
|
+
ref: el => setTextRef(el),
|
|
58
48
|
className: className,
|
|
59
49
|
textAnchor: "middle",
|
|
60
50
|
fill: color,
|
|
@@ -76,5 +66,4 @@ AxisElement.propTypes = {
|
|
|
76
66
|
selectedLabelBackground: _propTypes.string,
|
|
77
67
|
labelBackgroundPadding: _propTypes.number
|
|
78
68
|
};
|
|
79
|
-
var _default = AxisElement;
|
|
80
|
-
exports.default = _default;
|
|
69
|
+
var _default = exports.default = AxisElement;
|
|
@@ -4,7 +4,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.LINE_PADDING_Y = exports.LINE_PADDING_X = void 0;
|
|
7
|
-
|
|
8
|
-
exports.
|
|
9
|
-
var LINE_PADDING_Y = 20;
|
|
10
|
-
exports.LINE_PADDING_Y = LINE_PADDING_Y;
|
|
7
|
+
const LINE_PADDING_X = exports.LINE_PADDING_X = 5;
|
|
8
|
+
const LINE_PADDING_Y = exports.LINE_PADDING_Y = 20;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -9,23 +8,26 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
8
|
var _propTypes = require("prop-types");
|
|
10
9
|
var _commonTypes = require("../../../../../../types/commonTypes");
|
|
11
10
|
var _constants = require("./constants");
|
|
12
|
-
function _getRequireWildcardCache(
|
|
13
|
-
function _interopRequireWildcard(
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
13
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
const Decoration = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
decoration,
|
|
17
|
+
barWidth,
|
|
18
|
+
graphYStart,
|
|
19
|
+
offset,
|
|
20
|
+
classes
|
|
21
|
+
} = _ref;
|
|
22
|
+
const {
|
|
23
|
+
x,
|
|
24
|
+
label,
|
|
25
|
+
position,
|
|
26
|
+
textAnchor,
|
|
27
|
+
textProps = {},
|
|
28
|
+
withLine
|
|
29
|
+
} = decoration;
|
|
30
|
+
const xCoordinate = x + (position === 'center' ? barWidth / 2 : 0);
|
|
29
31
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("text", _extends({
|
|
30
32
|
className: classes.decoration,
|
|
31
33
|
textAnchor: textAnchor,
|
|
@@ -53,5 +55,4 @@ Decoration.propTypes = {
|
|
|
53
55
|
offset: _propTypes.number,
|
|
54
56
|
classes: _commonTypes.classesType
|
|
55
57
|
};
|
|
56
|
-
var _default = Decoration;
|
|
57
|
-
exports.default = _default;
|
|
58
|
+
var _default = exports.default = Decoration;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -14,46 +13,35 @@ var _AxisElement = _interopRequireDefault(require("./components/AxisElement"));
|
|
|
14
13
|
var _Decoration = _interopRequireDefault(require("./components/Decoration"));
|
|
15
14
|
var _constants = require("./constants");
|
|
16
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
function _getRequireWildcardCache(
|
|
18
|
-
function _interopRequireWildcard(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
pagination: pagination
|
|
47
|
-
});
|
|
48
|
-
}, [data, currentPage, pagination, decoratorRenderer]) || [];
|
|
49
|
-
var _useState = (0, _react.useState)(0),
|
|
50
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
-
offset = _useState2[0],
|
|
52
|
-
setOffset = _useState2[1];
|
|
53
|
-
var formattedDecorators = (0, _react.useMemo)(function () {
|
|
54
|
-
return (0, _utils.getFormattedDecorators)(xAxis, decorations, currentPage, pagination);
|
|
55
|
-
}, [decorations]);
|
|
56
|
-
(0, _react.useEffect)(function () {
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
+
const XAxis = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
data,
|
|
21
|
+
setRef,
|
|
22
|
+
classes,
|
|
23
|
+
barWidth,
|
|
24
|
+
xAxisDefinition,
|
|
25
|
+
xAxis,
|
|
26
|
+
graphYStart,
|
|
27
|
+
graphXStart,
|
|
28
|
+
graphXEnd,
|
|
29
|
+
decoratorRenderer,
|
|
30
|
+
pagination,
|
|
31
|
+
currentPage,
|
|
32
|
+
initialHeight,
|
|
33
|
+
paginationRef,
|
|
34
|
+
currentLabel
|
|
35
|
+
} = _ref;
|
|
36
|
+
const xOffset = barWidth / 2;
|
|
37
|
+
const decorations = (0, _react.useMemo)(() => decoratorRenderer === null || decoratorRenderer === void 0 ? void 0 : decoratorRenderer({
|
|
38
|
+
data,
|
|
39
|
+
currentPage,
|
|
40
|
+
pagination
|
|
41
|
+
}), [data, currentPage, pagination, decoratorRenderer]) || [];
|
|
42
|
+
const [offset, setOffset] = (0, _react.useState)(0);
|
|
43
|
+
const formattedDecorators = (0, _react.useMemo)(() => (0, _utils.getFormattedDecorators)(xAxis, decorations, currentPage, pagination), [decorations]);
|
|
44
|
+
(0, _react.useEffect)(() => {
|
|
57
45
|
if (!offset && initialHeight > 0) {
|
|
58
46
|
setOffset(initialHeight);
|
|
59
47
|
}
|
|
@@ -70,14 +58,16 @@ var XAxis = function XAxis(_ref) {
|
|
|
70
58
|
className: classes.xAxis
|
|
71
59
|
}), /*#__PURE__*/_react.default.createElement("g", null, /*#__PURE__*/_react.default.createElement("g", {
|
|
72
60
|
ref: paginationRef
|
|
73
|
-
}, xAxisDefinition.map(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
61
|
+
}, xAxisDefinition.map((_ref2, index) => {
|
|
62
|
+
let {
|
|
63
|
+
mainLabel,
|
|
64
|
+
color,
|
|
65
|
+
mainLabelStyles,
|
|
66
|
+
circle,
|
|
67
|
+
selectedLabelBackground,
|
|
68
|
+
labelBackgroundPadding
|
|
69
|
+
} = _ref2;
|
|
70
|
+
const selected = index === currentLabel;
|
|
81
71
|
return /*#__PURE__*/_react.default.createElement(_AxisElement.default, {
|
|
82
72
|
className: "".concat(classes.xAxisMainLabel, " ").concat(selected && classes.xAxisSelectedLabel),
|
|
83
73
|
barWidth: barWidth,
|
|
@@ -92,9 +82,11 @@ var XAxis = function XAxis(_ref) {
|
|
|
92
82
|
selectedLabelBackground: selectedLabelBackground,
|
|
93
83
|
labelBackgroundPadding: labelBackgroundPadding
|
|
94
84
|
});
|
|
95
|
-
})), /*#__PURE__*/_react.default.createElement("g", null, xAxisDefinition.map(
|
|
96
|
-
|
|
97
|
-
|
|
85
|
+
})), /*#__PURE__*/_react.default.createElement("g", null, xAxisDefinition.map((_ref3, index) => {
|
|
86
|
+
let {
|
|
87
|
+
secondaryLabel,
|
|
88
|
+
color
|
|
89
|
+
} = _ref3;
|
|
98
90
|
return /*#__PURE__*/_react.default.createElement(_AxisElement.default, {
|
|
99
91
|
className: classes.xAxisSecondaryLabel,
|
|
100
92
|
barWidth: barWidth,
|
|
@@ -104,17 +96,15 @@ var XAxis = function XAxis(_ref) {
|
|
|
104
96
|
graphYStart: graphYStart,
|
|
105
97
|
yOffset: _constants.Y_OFFSET
|
|
106
98
|
});
|
|
107
|
-
})))), /*#__PURE__*/_react.default.createElement("g", null, formattedDecorators.map(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
});
|
|
117
|
-
})));
|
|
99
|
+
})))), /*#__PURE__*/_react.default.createElement("g", null, formattedDecorators.map(decoration => /*#__PURE__*/_react.default.createElement(_Decoration.default, {
|
|
100
|
+
classes: classes,
|
|
101
|
+
barWidth: barWidth,
|
|
102
|
+
xAxis: xAxis,
|
|
103
|
+
decoration: decoration,
|
|
104
|
+
offset: offset + _constants.Y_OFFSET,
|
|
105
|
+
graphYStart: graphYStart,
|
|
106
|
+
yOffset: _constants.Y_OFFSET
|
|
107
|
+
}))));
|
|
118
108
|
};
|
|
119
109
|
XAxis.propTypes = {
|
|
120
110
|
classes: _commonTypes.classesType,
|
|
@@ -133,5 +123,4 @@ XAxis.propTypes = {
|
|
|
133
123
|
paginationRef: _commonTypes.refType,
|
|
134
124
|
currentLabel: _propTypes.number
|
|
135
125
|
};
|
|
136
|
-
var _default = XAxis;
|
|
137
|
-
exports.default = _default;
|
|
126
|
+
var _default = exports.default = XAxis;
|
|
@@ -8,15 +8,17 @@ var _propTypes = require("prop-types");
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _commonTypes = require("../../../../../types/commonTypes");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
const AxisElement = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
x,
|
|
14
|
+
value,
|
|
15
|
+
label,
|
|
16
|
+
textAnchor,
|
|
17
|
+
yAxis,
|
|
18
|
+
height,
|
|
19
|
+
setRef,
|
|
20
|
+
className
|
|
21
|
+
} = _ref;
|
|
20
22
|
return /*#__PURE__*/_react.default.createElement("text", {
|
|
21
23
|
className: className,
|
|
22
24
|
ref: setRef,
|
|
@@ -38,5 +40,4 @@ AxisElement.propTypes = {
|
|
|
38
40
|
height: _propTypes.number,
|
|
39
41
|
setRef: _commonTypes.refType
|
|
40
42
|
};
|
|
41
|
-
var _default = AxisElement;
|
|
42
|
-
exports.default = _default;
|
|
43
|
+
var _default = exports.default = AxisElement;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -13,37 +12,32 @@ var _utils = require("./utils");
|
|
|
13
12
|
var _AxisElement = _interopRequireDefault(require("./AxisElement"));
|
|
14
13
|
var _constants = require("./constants");
|
|
15
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
function _getRequireWildcardCache(
|
|
17
|
-
function _interopRequireWildcard(
|
|
18
|
-
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
+
const YAxis = _ref => {
|
|
19
18
|
var _labelRef$current, _labelRef$current$get;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
valueDecorator =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
});
|
|
43
|
-
}, [yAxisTicks]);
|
|
44
|
-
var linearDataUnitXPosition = graphXEnd - graphXEnd * 0.04;
|
|
45
|
-
var unitYPosition = unitSubtitle ? (graphYEnd - _constants.UNIT_PADDING) / 2 : graphYEnd - _constants.UNIT_PADDING;
|
|
46
|
-
var unitSubtitleYPosition = graphYEnd - graphYEnd * 0.5;
|
|
19
|
+
let {
|
|
20
|
+
classes,
|
|
21
|
+
graphYEnd,
|
|
22
|
+
graphYStart,
|
|
23
|
+
maxValue,
|
|
24
|
+
setRef,
|
|
25
|
+
textAnchor,
|
|
26
|
+
unit,
|
|
27
|
+
valueDecorator = value => value,
|
|
28
|
+
x,
|
|
29
|
+
yAxis,
|
|
30
|
+
yAxisTicks,
|
|
31
|
+
graphXEnd,
|
|
32
|
+
unitSubtitle,
|
|
33
|
+
linearData
|
|
34
|
+
} = _ref;
|
|
35
|
+
const labelRef = (0, _react.useRef)();
|
|
36
|
+
const height = ((_labelRef$current = labelRef.current) === null || _labelRef$current === void 0 || (_labelRef$current$get = _labelRef$current.getBoundingClientRect) === null || _labelRef$current$get === void 0 ? void 0 : _labelRef$current$get.call(_labelRef$current).height) || 0;
|
|
37
|
+
const axis = (0, _react.useMemo)(() => new Array(yAxisTicks).fill(0).map((_, index) => index), [yAxisTicks]);
|
|
38
|
+
const linearDataUnitXPosition = graphXEnd - graphXEnd * 0.04;
|
|
39
|
+
const unitYPosition = unitSubtitle ? (graphYEnd - _constants.UNIT_PADDING) / 2 : graphYEnd - _constants.UNIT_PADDING;
|
|
40
|
+
const unitSubtitleYPosition = graphYEnd - graphYEnd * 0.5;
|
|
47
41
|
return /*#__PURE__*/_react.default.createElement("g", {
|
|
48
42
|
textAnchor: textAnchor,
|
|
49
43
|
ref: setRef
|
|
@@ -55,10 +49,10 @@ var YAxis = function YAxis(_ref) {
|
|
|
55
49
|
className: classes.yAxisUnit,
|
|
56
50
|
x: x,
|
|
57
51
|
y: unitSubtitleYPosition
|
|
58
|
-
}, unitSubtitle), axis.map(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
}, unitSubtitle), axis.map(index => {
|
|
53
|
+
const newMaxValue = (0, _utils.yAxisMaxValueRounder)(maxValue, yAxisTicks);
|
|
54
|
+
const value = Math.round((maxValue - index * maxValue / (yAxisTicks - 1)) * 100) / 100;
|
|
55
|
+
const labelValue = Math.round((newMaxValue - index * newMaxValue / (yAxisTicks - 1)) * 100) / 100;
|
|
62
56
|
return /*#__PURE__*/_react.default.createElement(_AxisElement.default, {
|
|
63
57
|
className: classes.yAxisLabel,
|
|
64
58
|
setRef: (0, _utils.applyToIndex)(0, index, labelRef),
|
|
@@ -87,5 +81,4 @@ YAxis.propTypes = {
|
|
|
87
81
|
unitSubtitle: _propTypes.string,
|
|
88
82
|
linearData: _propTypes.bool
|
|
89
83
|
};
|
|
90
|
-
var _default = YAxis;
|
|
91
|
-
exports.default = _default;
|
|
84
|
+
var _default = exports.default = YAxis;
|
|
@@ -4,13 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.yAxisMaxValueRounder = exports.applyToIndex = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const applyToIndex = function (targetIndex, currentIndex, prop) {
|
|
8
|
+
let defaultValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
9
9
|
return currentIndex === targetIndex ? prop : defaultValue;
|
|
10
10
|
};
|
|
11
11
|
exports.applyToIndex = applyToIndex;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return maxValue < 25 ? maxValue : Math.ceil(maxValue / (yAxisTicks - 1) / TICKS_MULTIPLIER_DISTANCE) * TICKS_MULTIPLIER_DISTANCE * (yAxisTicks - 1);
|
|
15
|
-
};
|
|
12
|
+
const TICKS_MULTIPLIER_DISTANCE = 5;
|
|
13
|
+
const yAxisMaxValueRounder = (maxValue, yAxisTicks) => maxValue < 25 ? maxValue : Math.ceil(maxValue / (yAxisTicks - 1) / TICKS_MULTIPLIER_DISTANCE) * TICKS_MULTIPLIER_DISTANCE * (yAxisTicks - 1);
|
|
16
14
|
exports.yAxisMaxValueRounder = yAxisMaxValueRounder;
|
|
@@ -4,11 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DEFAULT_SCROLL_PADDING = exports.DEFAULT_MAX_VALUE = exports.DEFAULT_MARGIN_TOP = exports.DEFAULT_AXIS_PADDING = void 0;
|
|
7
|
-
|
|
8
|
-
exports.
|
|
9
|
-
|
|
10
|
-
exports.
|
|
11
|
-
var DEFAULT_MARGIN_TOP = 40;
|
|
12
|
-
exports.DEFAULT_MARGIN_TOP = DEFAULT_MARGIN_TOP;
|
|
13
|
-
var DEFAULT_MAX_VALUE = 100;
|
|
14
|
-
exports.DEFAULT_MAX_VALUE = DEFAULT_MAX_VALUE;
|
|
7
|
+
const DEFAULT_AXIS_PADDING = exports.DEFAULT_AXIS_PADDING = 10;
|
|
8
|
+
const DEFAULT_SCROLL_PADDING = exports.DEFAULT_SCROLL_PADDING = 20;
|
|
9
|
+
const DEFAULT_MARGIN_TOP = exports.DEFAULT_MARGIN_TOP = 40;
|
|
10
|
+
const DEFAULT_MAX_VALUE = exports.DEFAULT_MAX_VALUE = 100;
|
|
@@ -5,38 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
setMarginRight = _useState4[1];
|
|
25
|
-
var _useState5 = (0, _react.useState)(0),
|
|
26
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
27
|
-
marginBottom = _useState6[0],
|
|
28
|
-
setMarginBottom = _useState6[1];
|
|
29
|
-
var _useState7 = (0, _react.useState)(0),
|
|
30
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
31
|
-
marginTop = _useState8[0],
|
|
32
|
-
setMarginTop = _useState8[1];
|
|
33
|
-
var lateralMargin = options.lateralMargin,
|
|
34
|
-
verticalMargin = options.verticalMargin;
|
|
35
|
-
var marginLeftRef = (0, _react.useRef)();
|
|
36
|
-
var marginRightRef = (0, _react.useRef)();
|
|
37
|
-
var marginBottomRef = (0, _react.useRef)();
|
|
38
|
-
var marginTopRef = (0, _react.useRef)();
|
|
39
|
-
(0, _react.useEffect)(function () {
|
|
8
|
+
const LATERAL_DEFAULT_MARGIN = 30;
|
|
9
|
+
const VERTICAL_DEFAULT_MARGIN = 0;
|
|
10
|
+
const useDynamicMargins = (center, options) => {
|
|
11
|
+
const [marginLeft, setMarginLeft] = (0, _react.useState)(0);
|
|
12
|
+
const [marginRight, setMarginRight] = (0, _react.useState)(0);
|
|
13
|
+
const [marginBottom, setMarginBottom] = (0, _react.useState)(0);
|
|
14
|
+
const [marginTop, setMarginTop] = (0, _react.useState)(0);
|
|
15
|
+
const {
|
|
16
|
+
lateralMargin,
|
|
17
|
+
verticalMargin
|
|
18
|
+
} = options;
|
|
19
|
+
const marginLeftRef = (0, _react.useRef)();
|
|
20
|
+
const marginRightRef = (0, _react.useRef)();
|
|
21
|
+
const marginBottomRef = (0, _react.useRef)();
|
|
22
|
+
const marginTopRef = (0, _react.useRef)();
|
|
23
|
+
(0, _react.useEffect)(() => {
|
|
40
24
|
var _marginLeftRef$curren, _marginRightRef$curre, _marginBottomRef$curr, _marginTopRef$current;
|
|
41
25
|
setMarginLeft(Math.ceil((_marginLeftRef$curren = marginLeftRef.current) === null || _marginLeftRef$curren === void 0 ? void 0 : _marginLeftRef$curren.getBoundingClientRect().width) || lateralMargin || LATERAL_DEFAULT_MARGIN);
|
|
42
26
|
setMarginRight(Math.ceil((_marginRightRef$curre = marginRightRef.current) === null || _marginRightRef$curre === void 0 ? void 0 : _marginRightRef$curre.getBoundingClientRect().width) || lateralMargin || LATERAL_DEFAULT_MARGIN);
|
|
@@ -44,15 +28,14 @@ var useDynamicMargins = function useDynamicMargins(center, options) {
|
|
|
44
28
|
setMarginTop(Math.ceil((_marginTopRef$current = marginTopRef.current) === null || _marginTopRef$current === void 0 ? void 0 : _marginTopRef$current.getBoundingClientRect().height) || verticalMargin || VERTICAL_DEFAULT_MARGIN);
|
|
45
29
|
}, []);
|
|
46
30
|
return {
|
|
47
|
-
marginLeftRef
|
|
48
|
-
marginRightRef
|
|
49
|
-
marginBottomRef
|
|
50
|
-
marginTopRef
|
|
51
|
-
marginBottom
|
|
52
|
-
marginTop
|
|
31
|
+
marginLeftRef,
|
|
32
|
+
marginRightRef,
|
|
33
|
+
marginBottomRef,
|
|
34
|
+
marginTopRef,
|
|
35
|
+
marginBottom,
|
|
36
|
+
marginTop,
|
|
53
37
|
marginLeft: center ? Math.max(marginLeft, marginRight) : marginLeft,
|
|
54
38
|
marginRight: center ? Math.max(marginLeft, marginRight) : marginRight
|
|
55
39
|
};
|
|
56
40
|
};
|
|
57
|
-
var _default = useDynamicMargins;
|
|
58
|
-
exports.default = _default;
|
|
41
|
+
var _default = exports.default = useDynamicMargins;
|