@councilbox/councilbox-ui 2.0.58 → 2.0.60
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/SafeHtml.js +3 -0
- package/ScrollbarOld.js +3 -0
- package/dist/HOCs/overlayA11yStack.js +1 -1
- package/dist/HOCs/useDynamicStyles.js +39 -4
- package/dist/build-index.js +21 -7
- package/dist/components/Accordion/Accordion.css +7 -1
- package/dist/components/Button/Button.js +79 -87
- package/dist/components/Button/button.css +171 -16
- package/dist/components/DatePicker/Calendar.js +3 -5
- package/dist/components/DatePicker/DatePicker.css +1 -1
- package/dist/components/DateRangePicker/RangeCalendar.js +2 -4
- package/dist/components/IconButton/IconButton.js +1 -1
- package/dist/components/Modal/Modal.js +13 -3
- package/dist/components/RichTextInput/RichTextInput.js +28 -7
- package/dist/components/SafeHtml/SafeHtml.js +82 -0
- package/dist/components/Scrollbar/Scrollbar.css +60 -19
- package/dist/components/Scrollbar/Scrollbar.js +386 -62
- package/dist/components/ScrollbarOld/DesignScrollbarOld.js +24 -0
- package/dist/components/ScrollbarOld/ScrollbarOld.css +38 -0
- package/dist/components/ScrollbarOld/ScrollbarOld.js +104 -0
- package/dist/components/SelectInput/SelectInput.js +1 -0
- package/dist/components/Stepper/Stepper.css +6 -1
- package/dist/components/Tabs/Tabs.js +1 -0
- package/dist/components/TextInput/TextInput.css +164 -1
- package/dist/components/TextInput/TextInput.js +171 -167
- package/dist/components/ThemeProvider/Colors.js +1 -1
- package/dist/components/ThemeProvider/ThemeProvider.js +1 -7
- package/dist/components/Toast/toastStore.js +1 -0
- package/dist/styles/colorConsts.css +1 -1
- package/dist/styles/stylesheet.js +2 -50
- package/dist/testing/TestAutocomplete.js +1 -105
- package/dist/utils/sanitizeHtml.js +199 -0
- package/package.json +18 -32
- package/IconFont.js +0 -3
- package/dist/__snapshots__/storybook.test.js.snap +0 -104
- package/dist/components/1.Introduction.stories.mdx +0 -67
- package/dist/components/2.Changelog.stories.mdx +0 -595
- package/dist/components/3.Guide.stories.mdx +0 -235
- package/dist/components/Accordion/Accordion.stories.js +0 -44
- package/dist/components/Accordion/DesignAccordion.stories.js +0 -27
- package/dist/components/Alert/Alert.stories.js +0 -51
- package/dist/components/Avatar/Avatar.stories.js +0 -100
- package/dist/components/Avatar/DesignAvatar.stories.js +0 -64
- package/dist/components/Avatar/DesignAvatarText.stories.js +0 -123
- package/dist/components/AvatarGroup/AvatarGroup.stories.js +0 -25
- package/dist/components/AvatarGroup/DesignAvatarGroup.stories.js +0 -118
- package/dist/components/Block/Block.stories.js +0 -45
- package/dist/components/Block/DesignBlock.stories.js +0 -35
- package/dist/components/Button/Button.stories.js +0 -72
- package/dist/components/ButtonBasic/ButtonBasic.stories.js +0 -108
- package/dist/components/Checkbox/Checkbox.stories.js +0 -41
- package/dist/components/DatePicker/DatePicker.stories.js +0 -180
- package/dist/components/DateRangePicker/DateRangePicker.stories.js +0 -147
- package/dist/components/DateTimePicker/DateTimePicker.stories.js +0 -144
- package/dist/components/DragDrop/DragDrop.stories.js +0 -55
- package/dist/components/DrawerPanel/DrawerPanel.stories.js +0 -51
- package/dist/components/DropDown/DesignDropDown.stories.js +0 -216
- package/dist/components/DropDown/DropDown.stories.js +0 -43
- package/dist/components/EnhancedTable/DesignEnhancedTable.stories.js +0 -128
- package/dist/components/EnhancedTable/EnhancedTable.stories.js +0 -49
- package/dist/components/FabButton/DesignFabButton.stories.js +0 -40
- package/dist/components/FabButton/FabButton.stories.js +0 -46
- package/dist/components/Grid/DesignGrid.stories.js +0 -45
- package/dist/components/Grid/Grid.stories.js +0 -37
- package/dist/components/Header/DesignHeader.stories.js +0 -65
- package/dist/components/Header/Header.stories.js +0 -99
- package/dist/components/IconButton/DesignIconButton.stories.js +0 -113
- package/dist/components/IconButton/IconButton.stories.js +0 -40
- package/dist/components/IconButtonSquare/DesignIconButtonSquare.stories.js +0 -21
- package/dist/components/IconButtonSquare/IconButtonSquare.stories.js +0 -39
- package/dist/components/IconFont/IconFont.css +0 -0
- package/dist/components/IconFont/IconFont.js +0 -86
- package/dist/components/IconFont/IconFont.stories.js +0 -36
- package/dist/components/InputAutocomplete/InputAutocomplete.stories.js +0 -272
- package/dist/components/InputPassword/InputPassword.stories.js +0 -75
- package/dist/components/InputText/InputText.stories.js +0 -100
- package/dist/components/InputTextArea/DesignInputTextArea.stories.js +0 -116
- package/dist/components/InputTextArea/InputTextArea.stories.js +0 -40
- package/dist/components/LoadingSection/LoadingSection.stories.js +0 -42
- package/dist/components/MenuItem/DesignMenuItem.stories.js +0 -54
- package/dist/components/MenuItem/MenuItem.stories.js +0 -53
- package/dist/components/MenuLateralLeft/MenuLateralLeft.stories.js +0 -37
- package/dist/components/MenuLateralRight/MenuLateralRight.stories.js +0 -37
- package/dist/components/Modal/DesignModal.stories.js +0 -39
- package/dist/components/Modal/Modal.stories.js +0 -67
- package/dist/components/PaginationFooter/DesignPaginationFooter.stories.js +0 -22
- package/dist/components/PaginationFooter/PaginationFooter.stories.js +0 -48
- package/dist/components/RadioButton/Radio.stories.js +0 -57
- package/dist/components/RichTextInput/DesignRichTextInput.stories.js +0 -113
- package/dist/components/RichTextInput/RichTextInput.stories.js +0 -33
- package/dist/components/Ripple/Ripple.stories.js +0 -39
- package/dist/components/Scrollbar/Scrollbar.stories.js +0 -37
- package/dist/components/SelectInput/SelectInput.stories.js +0 -81
- package/dist/components/Slider/Slider.stories.js +0 -37
- package/dist/components/Spacing/Spacing.stories.js +0 -32
- package/dist/components/Stars/Stars.stories.js +0 -37
- package/dist/components/Stepper/DesignStepper.stories.js +0 -130
- package/dist/components/Stepper/Stepper.stories.js +0 -41
- package/dist/components/Table/DesignTable.stories.js +0 -614
- package/dist/components/Table/Table.stories.js +0 -53
- package/dist/components/Tabs/Tabs.stories.js +0 -44
- package/dist/components/Tag/DesignTags.stories.js +0 -81
- package/dist/components/Tag/Tag.stories.js +0 -45
- package/dist/components/TextInput/TextInput.stories.js +0 -60
- package/dist/components/TimePicker/TimePicker.stories.js +0 -132
- package/dist/components/Timeline/DesignTimeline.stories.js +0 -19
- package/dist/components/Timeline/Timeline.stories.js +0 -37
- package/dist/components/Toast/DesignToast.stories.js +0 -174
- package/dist/components/Toast/Toast.stories.js +0 -33
- package/dist/components/Toggle/Toggle.stories.js +0 -42
- package/dist/components/Tooltip/DesignTooltip.stories.js +0 -45
- package/dist/components/Tooltip/Tooltip.stories.js +0 -33
- package/dist/components/Typography/Typography.stories.js +0 -73
- package/dist/fonts/IconNames.json +0 -6848
- package/dist/reportWebVitals.js +0 -28
- package/dist/storybook.test.js +0 -5
|
@@ -6,14 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
10
|
require("../../styles/main.css");
|
|
10
11
|
require("./Scrollbar.css");
|
|
11
|
-
var _reactCustomScrollbars = require("react-custom-scrollbars-2");
|
|
12
|
-
var _getScrollbarWidth = _interopRequireDefault(require("react-custom-scrollbars-2/lib/utils/getScrollbarWidth"));
|
|
13
12
|
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
14
13
|
var _excluded = ["prefixClass"];
|
|
15
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
16
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
|
|
17
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
17
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -21,6 +19,37 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
21
19
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
22
20
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) { o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } } return i; }
|
|
23
21
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) { if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } } return t; }
|
|
22
|
+
var THUMB_MIN_SIZE = 30;
|
|
23
|
+
var AUTO_HIDE_TIMEOUT = 1000;
|
|
24
|
+
var SCROLL_STOP_DELAY = 100;
|
|
25
|
+
var TRACK_FADE_DURATION = 200;
|
|
26
|
+
var INTERACTIVE_SELECTOR = ['input', 'select', 'textarea', 'button', '[role="listbox"]', '[role="option"]', '[role="combobox"]', '[role="slider"]', '[role="tablist"]', '[role="tab"]', '[contenteditable="true"]'].join(', ');
|
|
27
|
+
var clampThumbSize = function clampThumbSize(trackSize, contentRatio) {
|
|
28
|
+
var proportionalSize = Math.ceil(contentRatio * trackSize);
|
|
29
|
+
return Math.min(trackSize, Math.max(proportionalSize, THUMB_MIN_SIZE));
|
|
30
|
+
};
|
|
31
|
+
var EMPTY_AXIS_GEOMETRY = {
|
|
32
|
+
size: 0,
|
|
33
|
+
offset: 0,
|
|
34
|
+
visible: false
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// Same measurement react-custom-scrollbars-2 uses: on systems with overlay/0-width
|
|
38
|
+
// native scrollbars (macOS trackpad default, some modern Chrome setups), this is 0 -
|
|
39
|
+
// and the library shows no custom thumb at all there, relying on the native overlay.
|
|
40
|
+
// We replicate that exactly instead of always drawing our own thumb.
|
|
41
|
+
var cachedScrollbarWidth = null;
|
|
42
|
+
var getScrollbarWidth = function getScrollbarWidth() {
|
|
43
|
+
var useCache = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
44
|
+
if (useCache && cachedScrollbarWidth !== null) return cachedScrollbarWidth;
|
|
45
|
+
if (typeof document === 'undefined') return 0;
|
|
46
|
+
var div = document.createElement('div');
|
|
47
|
+
div.style.cssText = 'width:100px;height:100px;position:absolute;top:-9999px;overflow:scroll;-ms-overflow-style:scrollbar;';
|
|
48
|
+
document.body.appendChild(div);
|
|
49
|
+
cachedScrollbarWidth = div.offsetWidth - div.clientWidth;
|
|
50
|
+
document.body.removeChild(div);
|
|
51
|
+
return cachedScrollbarWidth;
|
|
52
|
+
};
|
|
24
53
|
var Scrollbar = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
25
54
|
var propPrefixClass = _ref.prefixClass,
|
|
26
55
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -28,77 +57,372 @@ var Scrollbar = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
28
57
|
stylesInLine = _useDynamicStyles.stylesInLine,
|
|
29
58
|
dynamicPrefixClass = _useDynamicStyles.prefixClass;
|
|
30
59
|
var prefixClass = propPrefixClass || dynamicPrefixClass;
|
|
31
|
-
var
|
|
60
|
+
var style = props.style,
|
|
61
|
+
autoHide = props.autoHide,
|
|
62
|
+
children = props.children,
|
|
63
|
+
showX = props.showX,
|
|
64
|
+
onScrollStop = props.onScrollStop,
|
|
65
|
+
classFixProp = props.classFix,
|
|
66
|
+
_props$horizontalScro = props.horizontalScroll,
|
|
67
|
+
horizontalScroll = _props$horizontalScro === void 0 ? false : _props$horizontalScro;
|
|
68
|
+
|
|
69
|
+
// Consumers often pass `isMobile && 'ScrollbarMobile'`, which yields false/null instead of a string
|
|
70
|
+
var classFix = typeof classFixProp === 'string' ? classFixProp : '';
|
|
71
|
+
var isMobileMode = classFix.split(' ').filter(Boolean).includes('ScrollbarMobile');
|
|
72
|
+
var showHorizontalThumb = horizontalScroll && showX && !isMobileMode;
|
|
73
|
+
var viewRef = _react["default"].useRef(null);
|
|
74
|
+
var trackVerticalRef = _react["default"].useRef(null);
|
|
75
|
+
var trackHorizontalRef = _react["default"].useRef(null);
|
|
76
|
+
var thumbVerticalRef = _react["default"].useRef(null);
|
|
77
|
+
var thumbHorizontalRef = _react["default"].useRef(null);
|
|
78
|
+
var dragStateRef = _react["default"].useRef(null);
|
|
79
|
+
var trackMouseOverRef = _react["default"].useRef(false);
|
|
80
|
+
var scrollStopTimerRef = _react["default"].useRef(null);
|
|
81
|
+
var hideTracksTimerRef = _react["default"].useRef(null);
|
|
82
|
+
var geometryRef = _react["default"].useRef({
|
|
83
|
+
vertical: EMPTY_AXIS_GEOMETRY,
|
|
84
|
+
horizontal: EMPTY_AXIS_GEOMETRY
|
|
85
|
+
});
|
|
86
|
+
var tracksVisibleRef = _react["default"].useRef(true);
|
|
87
|
+
var hasNativeScrollbarRef = _react["default"].useRef(getScrollbarWidth() > 0);
|
|
88
|
+
var isCustomTrackHidden = _react["default"].useCallback(function () {
|
|
89
|
+
return isMobileMode || !hasNativeScrollbarRef.current;
|
|
90
|
+
}, [isMobileMode]);
|
|
91
|
+
|
|
92
|
+
// Thumb size/offset and track opacity are mutated directly on the DOM (like the
|
|
93
|
+
// original library's own dom-css updates) instead of through setState, since this
|
|
94
|
+
// runs on every scroll/resize frame and must never trigger a React re-render.
|
|
95
|
+
var applyTrackStyles = _react["default"].useCallback(function () {
|
|
96
|
+
var _geometryRef$current = geometryRef.current,
|
|
97
|
+
vertical = _geometryRef$current.vertical,
|
|
98
|
+
horizontal = _geometryRef$current.horizontal;
|
|
99
|
+
var showTracks = tracksVisibleRef.current;
|
|
100
|
+
var display = isCustomTrackHidden() ? 'none' : '';
|
|
101
|
+
if (thumbVerticalRef.current) {
|
|
102
|
+
thumbVerticalRef.current.style.height = "".concat(vertical.size, "px");
|
|
103
|
+
thumbVerticalRef.current.style.transform = "translateY(".concat(vertical.offset, "px)");
|
|
104
|
+
}
|
|
105
|
+
if (trackVerticalRef.current) {
|
|
106
|
+
trackVerticalRef.current.style.display = display;
|
|
107
|
+
trackVerticalRef.current.style.opacity = vertical.visible && showTracks ? '1' : '0';
|
|
108
|
+
trackVerticalRef.current.style.pointerEvents = vertical.visible ? 'auto' : 'none';
|
|
109
|
+
}
|
|
110
|
+
if (thumbHorizontalRef.current) {
|
|
111
|
+
thumbHorizontalRef.current.style.width = "".concat(horizontal.size, "px");
|
|
112
|
+
thumbHorizontalRef.current.style.transform = "translateX(".concat(horizontal.offset, "px)");
|
|
113
|
+
}
|
|
114
|
+
if (trackHorizontalRef.current) {
|
|
115
|
+
trackHorizontalRef.current.style.display = display;
|
|
116
|
+
trackHorizontalRef.current.style.opacity = horizontal.visible && showTracks ? '1' : '0';
|
|
117
|
+
trackHorizontalRef.current.style.pointerEvents = horizontal.visible ? 'auto' : 'none';
|
|
118
|
+
}
|
|
119
|
+
}, [isCustomTrackHidden]);
|
|
120
|
+
var setTracksVisibility = _react["default"].useCallback(function (visible) {
|
|
121
|
+
tracksVisibleRef.current = visible;
|
|
122
|
+
applyTrackStyles();
|
|
123
|
+
}, [applyTrackStyles]);
|
|
124
|
+
var updateThumbs = _react["default"].useCallback(function () {
|
|
125
|
+
var view = viewRef.current;
|
|
126
|
+
if (!view || isCustomTrackHidden()) return;
|
|
127
|
+
var scrollTop = view.scrollTop,
|
|
128
|
+
scrollHeight = view.scrollHeight,
|
|
129
|
+
clientHeight = view.clientHeight,
|
|
130
|
+
scrollLeft = view.scrollLeft,
|
|
131
|
+
scrollWidth = view.scrollWidth,
|
|
132
|
+
clientWidth = view.clientWidth;
|
|
133
|
+
var trackVerticalSize = trackVerticalRef.current ? trackVerticalRef.current.clientHeight : 0;
|
|
134
|
+
var trackHorizontalSize = trackHorizontalRef.current ? trackHorizontalRef.current.clientWidth : 0;
|
|
135
|
+
var verticalNeeded = scrollHeight > clientHeight + 1;
|
|
136
|
+
var horizontalNeeded = showHorizontalThumb && scrollWidth > clientWidth + 1;
|
|
137
|
+
var verticalThumbSize = trackVerticalSize ? clampThumbSize(trackVerticalSize, clientHeight / scrollHeight) : 0;
|
|
138
|
+
var verticalOffset = verticalNeeded ? scrollTop / (scrollHeight - clientHeight) * (trackVerticalSize - verticalThumbSize) : 0;
|
|
139
|
+
var horizontalThumbSize = trackHorizontalSize ? clampThumbSize(trackHorizontalSize, clientWidth / scrollWidth) : 0;
|
|
140
|
+
var horizontalOffset = horizontalNeeded ? scrollLeft / (scrollWidth - clientWidth) * (trackHorizontalSize - horizontalThumbSize) : 0;
|
|
141
|
+
geometryRef.current = {
|
|
142
|
+
vertical: {
|
|
143
|
+
size: verticalThumbSize,
|
|
144
|
+
offset: verticalOffset,
|
|
145
|
+
visible: verticalNeeded
|
|
146
|
+
},
|
|
147
|
+
horizontal: {
|
|
148
|
+
size: horizontalThumbSize,
|
|
149
|
+
offset: horizontalOffset,
|
|
150
|
+
visible: horizontalNeeded
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
applyTrackStyles();
|
|
154
|
+
}, [isCustomTrackHidden, showHorizontalThumb, applyTrackStyles]);
|
|
155
|
+
var showTracksNow = _react["default"].useCallback(function () {
|
|
156
|
+
clearTimeout(hideTracksTimerRef.current);
|
|
157
|
+
setTracksVisibility(true);
|
|
158
|
+
}, [setTracksVisibility]);
|
|
159
|
+
var scheduleHideTracks = _react["default"].useCallback(function () {
|
|
160
|
+
if (!autoHide) return;
|
|
161
|
+
if (dragStateRef.current || trackMouseOverRef.current) return;
|
|
162
|
+
clearTimeout(hideTracksTimerRef.current);
|
|
163
|
+
hideTracksTimerRef.current = setTimeout(function () {
|
|
164
|
+
return setTracksVisibility(false);
|
|
165
|
+
}, AUTO_HIDE_TIMEOUT);
|
|
166
|
+
}, [autoHide, setTracksVisibility]);
|
|
167
|
+
var rafIdRef = _react["default"].useRef(null);
|
|
168
|
+
|
|
169
|
+
// The library coalesces scroll/resize-driven updates into a single rAF (cancelling
|
|
170
|
+
// any pending frame first) so a burst of scroll events only recomputes once per
|
|
171
|
+
// paint. Prop/content-driven updates (below, in useLayoutEffect) stay synchronous
|
|
172
|
+
// so there's never a stale-thumb flash right after mount or a re-render.
|
|
173
|
+
var scheduleUpdateThumbs = _react["default"].useCallback(function () {
|
|
174
|
+
if (rafIdRef.current !== null) cancelAnimationFrame(rafIdRef.current);
|
|
175
|
+
rafIdRef.current = requestAnimationFrame(function () {
|
|
176
|
+
rafIdRef.current = null;
|
|
177
|
+
updateThumbs();
|
|
178
|
+
});
|
|
179
|
+
}, [updateThumbs]);
|
|
180
|
+
var handleScroll = _react["default"].useCallback(function () {
|
|
181
|
+
scheduleUpdateThumbs();
|
|
182
|
+
if (autoHide) showTracksNow();
|
|
183
|
+
clearTimeout(scrollStopTimerRef.current);
|
|
184
|
+
scrollStopTimerRef.current = setTimeout(function () {
|
|
185
|
+
onScrollStop === null || onScrollStop === void 0 ? void 0 : onScrollStop();
|
|
186
|
+
scheduleHideTracks();
|
|
187
|
+
}, SCROLL_STOP_DELAY);
|
|
188
|
+
}, [scheduleUpdateThumbs, autoHide, showTracksNow, onScrollStop, scheduleHideTracks]);
|
|
189
|
+
_react["default"].useLayoutEffect(function () {
|
|
190
|
+
updateThumbs();
|
|
191
|
+
});
|
|
192
|
+
_react["default"].useEffect(function () {
|
|
193
|
+
if (!autoHide) {
|
|
194
|
+
setTracksVisibility(true);
|
|
195
|
+
} else {
|
|
196
|
+
scheduleHideTracks();
|
|
197
|
+
}
|
|
198
|
+
}, [autoHide, scheduleHideTracks, setTracksVisibility]);
|
|
199
|
+
_react["default"].useEffect(function () {
|
|
200
|
+
var view = viewRef.current;
|
|
201
|
+
if (!view || typeof ResizeObserver === 'undefined') return undefined;
|
|
202
|
+
var observer = new ResizeObserver(function () {
|
|
203
|
+
return scheduleUpdateThumbs();
|
|
204
|
+
});
|
|
205
|
+
observer.observe(view);
|
|
206
|
+
if (view.firstElementChild) observer.observe(view.firstElementChild);
|
|
207
|
+
var handleWindowResize = function handleWindowResize() {
|
|
208
|
+
hasNativeScrollbarRef.current = getScrollbarWidth(false) > 0;
|
|
209
|
+
scheduleUpdateThumbs();
|
|
210
|
+
applyTrackStyles();
|
|
211
|
+
};
|
|
212
|
+
window.addEventListener('resize', handleWindowResize);
|
|
213
|
+
return function () {
|
|
214
|
+
observer.disconnect();
|
|
215
|
+
window.removeEventListener('resize', handleWindowResize);
|
|
216
|
+
};
|
|
217
|
+
}, [scheduleUpdateThumbs, applyTrackStyles]);
|
|
218
|
+
_react["default"].useEffect(function () {
|
|
219
|
+
return function () {
|
|
220
|
+
clearTimeout(scrollStopTimerRef.current);
|
|
221
|
+
clearTimeout(hideTracksTimerRef.current);
|
|
222
|
+
if (rafIdRef.current !== null) cancelAnimationFrame(rafIdRef.current);
|
|
223
|
+
};
|
|
224
|
+
}, []);
|
|
225
|
+
var startDrag = _react["default"].useCallback(function (axis, event) {
|
|
226
|
+
event.preventDefault();
|
|
227
|
+
event.stopPropagation();
|
|
228
|
+
var view = viewRef.current;
|
|
229
|
+
if (!view) return;
|
|
230
|
+
dragStateRef.current = {
|
|
231
|
+
axis: axis,
|
|
232
|
+
startClient: axis === 'vertical' ? event.clientY : event.clientX,
|
|
233
|
+
startScroll: axis === 'vertical' ? view.scrollTop : view.scrollLeft,
|
|
234
|
+
trackSize: axis === 'vertical' ? trackVerticalRef.current.clientHeight : trackHorizontalRef.current.clientWidth,
|
|
235
|
+
thumbSize: axis === 'vertical' ? geometryRef.current.vertical.size : geometryRef.current.horizontal.size
|
|
236
|
+
};
|
|
237
|
+
document.body.style.userSelect = 'none';
|
|
238
|
+
showTracksNow();
|
|
239
|
+
var handleMouseMove = function handleMouseMove(moveEvent) {
|
|
240
|
+
var drag = dragStateRef.current;
|
|
241
|
+
if (!drag) return;
|
|
242
|
+
var trackRange = drag.trackSize - drag.thumbSize;
|
|
243
|
+
if (trackRange <= 0) return;
|
|
244
|
+
var client = drag.axis === 'vertical' ? moveEvent.clientY : moveEvent.clientX;
|
|
245
|
+
var delta = client - drag.startClient;
|
|
246
|
+
if (drag.axis === 'vertical') {
|
|
247
|
+
var scrollable = view.scrollHeight - view.clientHeight;
|
|
248
|
+
view.scrollTop = drag.startScroll + delta / trackRange * scrollable;
|
|
249
|
+
} else {
|
|
250
|
+
var _scrollable = view.scrollWidth - view.clientWidth;
|
|
251
|
+
view.scrollLeft = drag.startScroll + delta / trackRange * _scrollable;
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
var handleMouseUp = function handleMouseUp() {
|
|
255
|
+
dragStateRef.current = null;
|
|
256
|
+
document.body.style.userSelect = '';
|
|
257
|
+
document.removeEventListener('mousemove', handleMouseMove);
|
|
258
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
|
259
|
+
scheduleHideTracks();
|
|
260
|
+
};
|
|
261
|
+
document.addEventListener('mousemove', handleMouseMove);
|
|
262
|
+
document.addEventListener('mouseup', handleMouseUp);
|
|
263
|
+
}, [showTracksNow, scheduleHideTracks]);
|
|
264
|
+
var handleTrackMouseDown = _react["default"].useCallback(function (axis, event) {
|
|
265
|
+
var thumbEl = axis === 'vertical' ? thumbVerticalRef.current : thumbHorizontalRef.current;
|
|
266
|
+
if (event.target === thumbEl) return;
|
|
267
|
+
var view = viewRef.current;
|
|
268
|
+
var trackEl = axis === 'vertical' ? trackVerticalRef.current : trackHorizontalRef.current;
|
|
269
|
+
if (!view || !trackEl) return;
|
|
270
|
+
var rect = trackEl.getBoundingClientRect();
|
|
271
|
+
var thumbSize = axis === 'vertical' ? geometryRef.current.vertical.size : geometryRef.current.horizontal.size;
|
|
272
|
+
var trackSize = axis === 'vertical' ? trackEl.clientHeight : trackEl.clientWidth;
|
|
273
|
+
var trackRange = trackSize - thumbSize;
|
|
274
|
+
if (trackRange <= 0) return;
|
|
275
|
+
var clickOffset = axis === 'vertical' ? event.clientY - rect.top : event.clientX - rect.left;
|
|
276
|
+
var ratio = Math.min(Math.max((clickOffset - thumbSize / 2) / trackRange, 0), 1);
|
|
277
|
+
if (axis === 'vertical') {
|
|
278
|
+
view.scrollTop = ratio * (view.scrollHeight - view.clientHeight);
|
|
279
|
+
} else {
|
|
280
|
+
view.scrollLeft = ratio * (view.scrollWidth - view.clientWidth);
|
|
281
|
+
}
|
|
282
|
+
}, []);
|
|
283
|
+
var handleTrackMouseEnter = _react["default"].useCallback(function () {
|
|
284
|
+
trackMouseOverRef.current = true;
|
|
285
|
+
showTracksNow();
|
|
286
|
+
}, [showTracksNow]);
|
|
287
|
+
var handleTrackMouseLeave = _react["default"].useCallback(function () {
|
|
288
|
+
trackMouseOverRef.current = false;
|
|
289
|
+
scheduleHideTracks();
|
|
290
|
+
}, [scheduleHideTracks]);
|
|
291
|
+
var handleKeyUpToScroll = _react["default"].useCallback(function (e) {
|
|
292
|
+
var target = e.target;
|
|
293
|
+
if (target.closest(INTERACTIVE_SELECTOR)) return;
|
|
294
|
+
if (!viewRef.current) return;
|
|
295
|
+
if (e.key === 'ArrowDown') viewRef.current.scrollTop = viewRef.current.scrollHeight;
|
|
296
|
+
if (e.key === 'ArrowUp') viewRef.current.scrollTop = 0;
|
|
297
|
+
}, []);
|
|
32
298
|
_react["default"].useImperativeHandle(ref, function () {
|
|
33
299
|
return {
|
|
34
300
|
scrollToBottom: function scrollToBottom() {
|
|
35
|
-
|
|
301
|
+
if (viewRef.current) viewRef.current.scrollTop = viewRef.current.scrollHeight;
|
|
36
302
|
},
|
|
37
303
|
scrollToTop: function scrollToTop() {
|
|
38
|
-
|
|
304
|
+
if (viewRef.current) viewRef.current.scrollTop = 0;
|
|
305
|
+
},
|
|
306
|
+
scrollToLeft: function scrollToLeft() {
|
|
307
|
+
if (viewRef.current) viewRef.current.scrollLeft = 0;
|
|
308
|
+
},
|
|
309
|
+
scrollToRight: function scrollToRight() {
|
|
310
|
+
if (viewRef.current) viewRef.current.scrollLeft = viewRef.current.scrollWidth;
|
|
39
311
|
},
|
|
40
312
|
getScrollHeight: function getScrollHeight() {
|
|
41
|
-
return
|
|
313
|
+
return viewRef.current ? viewRef.current.scrollHeight : 0;
|
|
314
|
+
},
|
|
315
|
+
getScrollTop: function getScrollTop() {
|
|
316
|
+
return viewRef.current ? viewRef.current.scrollTop : 0;
|
|
317
|
+
},
|
|
318
|
+
getScrollLeft: function getScrollLeft() {
|
|
319
|
+
return viewRef.current ? viewRef.current.scrollLeft : 0;
|
|
320
|
+
},
|
|
321
|
+
getScrollWidth: function getScrollWidth() {
|
|
322
|
+
return viewRef.current ? viewRef.current.scrollWidth : 0;
|
|
323
|
+
},
|
|
324
|
+
getClientHeight: function getClientHeight() {
|
|
325
|
+
return viewRef.current ? viewRef.current.clientHeight : 0;
|
|
326
|
+
},
|
|
327
|
+
getClientWidth: function getClientWidth() {
|
|
328
|
+
return viewRef.current ? viewRef.current.clientWidth : 0;
|
|
42
329
|
},
|
|
43
330
|
getValues: function getValues() {
|
|
44
|
-
|
|
331
|
+
var view = viewRef.current;
|
|
332
|
+
if (!view) {
|
|
333
|
+
return {
|
|
334
|
+
top: 0,
|
|
335
|
+
left: 0,
|
|
336
|
+
scrollTop: 0,
|
|
337
|
+
scrollLeft: 0,
|
|
338
|
+
scrollWidth: 0,
|
|
339
|
+
scrollHeight: 0,
|
|
340
|
+
clientWidth: 0,
|
|
341
|
+
clientHeight: 0 // eslint-disable-line max-len
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
var scrollTop = view.scrollTop,
|
|
345
|
+
scrollLeft = view.scrollLeft,
|
|
346
|
+
scrollWidth = view.scrollWidth,
|
|
347
|
+
scrollHeight = view.scrollHeight,
|
|
348
|
+
clientWidth = view.clientWidth,
|
|
349
|
+
clientHeight = view.clientHeight;
|
|
350
|
+
return {
|
|
351
|
+
left: scrollLeft / (scrollWidth - clientWidth) || 0,
|
|
352
|
+
top: scrollTop / (scrollHeight - clientHeight) || 0,
|
|
353
|
+
scrollTop: scrollTop,
|
|
354
|
+
scrollLeft: scrollLeft,
|
|
355
|
+
scrollWidth: scrollWidth,
|
|
356
|
+
scrollHeight: scrollHeight,
|
|
357
|
+
clientWidth: clientWidth,
|
|
358
|
+
clientHeight: clientHeight
|
|
359
|
+
};
|
|
45
360
|
}
|
|
46
361
|
};
|
|
47
362
|
}, []);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
} : {}), children);
|
|
363
|
+
return (
|
|
364
|
+
/*#__PURE__*/
|
|
365
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
366
|
+
_react["default"].createElement("div", {
|
|
367
|
+
className: prefixClass("Scrollbar ".concat(classFix, " ").concat(horizontalScroll ? 'scrollbarBoth' : 'scrollbarOnlyY', " scrollbarFixHeight")),
|
|
368
|
+
style: _objectSpread(_objectSpread({
|
|
369
|
+
position: 'relative',
|
|
370
|
+
overflow: 'hidden',
|
|
371
|
+
width: '100%',
|
|
372
|
+
height: '100%'
|
|
373
|
+
}, style), stylesInLine),
|
|
374
|
+
onKeyDown: handleKeyUpToScroll
|
|
375
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
376
|
+
ref: viewRef,
|
|
377
|
+
className: prefixClass('cbx-scrollbarNew-view'),
|
|
378
|
+
onScroll: handleScroll
|
|
379
|
+
}, children), /*#__PURE__*/_react["default"].createElement("div", {
|
|
380
|
+
ref: trackHorizontalRef,
|
|
381
|
+
className: prefixClass('cbx-scrollbarNew-trackHorizontal'),
|
|
382
|
+
style: {
|
|
383
|
+
transitionDuration: autoHide ? "".concat(TRACK_FADE_DURATION, "ms") : '0ms'
|
|
384
|
+
},
|
|
385
|
+
onMouseEnter: handleTrackMouseEnter,
|
|
386
|
+
onMouseLeave: handleTrackMouseLeave,
|
|
387
|
+
onMouseDown: function onMouseDown(e) {
|
|
388
|
+
return handleTrackMouseDown('horizontal', e);
|
|
389
|
+
}
|
|
390
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
391
|
+
ref: thumbHorizontalRef,
|
|
392
|
+
className: prefixClass('cbx-scrollbarNew-thumbHorizontal'),
|
|
393
|
+
onMouseDown: function onMouseDown(e) {
|
|
394
|
+
return startDrag('horizontal', e);
|
|
395
|
+
}
|
|
396
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
397
|
+
ref: trackVerticalRef,
|
|
398
|
+
className: prefixClass('cbx-scrollbarNew-trackVertical'),
|
|
399
|
+
style: {
|
|
400
|
+
transitionDuration: autoHide ? "".concat(TRACK_FADE_DURATION, "ms") : '0ms'
|
|
401
|
+
},
|
|
402
|
+
onMouseEnter: handleTrackMouseEnter,
|
|
403
|
+
onMouseLeave: handleTrackMouseLeave,
|
|
404
|
+
onMouseDown: function onMouseDown(e) {
|
|
405
|
+
return handleTrackMouseDown('vertical', e);
|
|
406
|
+
}
|
|
407
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
408
|
+
ref: thumbVerticalRef,
|
|
409
|
+
className: prefixClass('cbx-scrollbarNew-thumbVertical'),
|
|
410
|
+
onMouseDown: function onMouseDown(e) {
|
|
411
|
+
return startDrag('vertical', e);
|
|
412
|
+
}
|
|
413
|
+
})))
|
|
414
|
+
);
|
|
102
415
|
});
|
|
416
|
+
Scrollbar.propTypes = {
|
|
417
|
+
style: _propTypes["default"].object,
|
|
418
|
+
sx: _propTypes["default"].object,
|
|
419
|
+
autoHide: _propTypes["default"].bool,
|
|
420
|
+
showX: _propTypes["default"].bool,
|
|
421
|
+
horizontalScroll: _propTypes["default"].bool,
|
|
422
|
+
classFix: _propTypes["default"].string,
|
|
423
|
+
onScrollStop: _propTypes["default"].func,
|
|
424
|
+
prefixClass: _propTypes["default"].func,
|
|
425
|
+
children: _propTypes["default"].node
|
|
426
|
+
};
|
|
103
427
|
var _default = Scrollbar;
|
|
104
428
|
exports["default"] = _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _ScrollbarOld = _interopRequireDefault(require("./ScrollbarOld"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
|
+
var DesignScrollbarOld = function DesignScrollbarOld() {
|
|
11
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
12
|
+
style: {
|
|
13
|
+
height: '18.75rem'
|
|
14
|
+
}
|
|
15
|
+
}, /*#__PURE__*/_react["default"].createElement(_ScrollbarOld["default"], null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
16
|
+
style: {
|
|
17
|
+
height: '31.25rem',
|
|
18
|
+
background: 'gainsboro'
|
|
19
|
+
}
|
|
20
|
+
}, "Prueba")));
|
|
21
|
+
};
|
|
22
|
+
DesignScrollbarOld.displayName = "DesignScrollbarOld";
|
|
23
|
+
var _default = DesignScrollbarOld;
|
|
24
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.scrollbarFix {
|
|
2
|
+
margin-right: -17px;
|
|
3
|
+
scroll-behavior: smooth;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.Scrollbar>div:first-child {
|
|
7
|
+
scroll-behavior: smooth;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.scrollbarBoth>div:first-child {
|
|
11
|
+
margin-right: -17px !important;
|
|
12
|
+
margin-bottom: -0 !important;
|
|
13
|
+
overflow-x: auto !important;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.scrollbarOnlyY>div:first-child {
|
|
17
|
+
overflow-x: hidden !important;
|
|
18
|
+
margin-right: -17px !important;
|
|
19
|
+
margin-bottom: -0 !important;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.scrollflex>div:first-child {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-grow: 1;
|
|
25
|
+
min-height: 100%;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.scrollbarFixHeight > div > div {
|
|
29
|
+
/* flex-grow: 1; */
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.scrollbarFixHeightIos > div > div {
|
|
33
|
+
padding-bottom: 0!important;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.macOSFlexFix> div > div > div {
|
|
37
|
+
min-height: 100%;
|
|
38
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
require("../../styles/main.css");
|
|
10
|
+
require("./ScrollbarOld.css");
|
|
11
|
+
var _reactCustomScrollbars = require("react-custom-scrollbars-2");
|
|
12
|
+
var _getScrollbarWidth = _interopRequireDefault(require("react-custom-scrollbars-2/lib/utils/getScrollbarWidth"));
|
|
13
|
+
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
14
|
+
var _excluded = ["prefixClass"];
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
16
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
|
|
17
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
20
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
21
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
22
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) { o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } } return i; }
|
|
23
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) { if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } } return t; }
|
|
24
|
+
var ScrollbarOld = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
25
|
+
var propPrefixClass = _ref.prefixClass,
|
|
26
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
+
var _useDynamicStyles = (0, _useDynamicStyles2["default"])(props.sx),
|
|
28
|
+
stylesInLine = _useDynamicStyles.stylesInLine,
|
|
29
|
+
dynamicPrefixClass = _useDynamicStyles.prefixClass;
|
|
30
|
+
var prefixClass = propPrefixClass || dynamicPrefixClass;
|
|
31
|
+
var scrollbar = _react["default"].useRef(null);
|
|
32
|
+
_react["default"].useImperativeHandle(ref, function () {
|
|
33
|
+
return {
|
|
34
|
+
scrollToBottom: function scrollToBottom() {
|
|
35
|
+
scrollbar.current.scrollToBottom();
|
|
36
|
+
},
|
|
37
|
+
scrollToTop: function scrollToTop() {
|
|
38
|
+
scrollbar.current.scrollToTop();
|
|
39
|
+
},
|
|
40
|
+
getScrollHeight: function getScrollHeight() {
|
|
41
|
+
return scrollbar.current.getScrollHeight();
|
|
42
|
+
},
|
|
43
|
+
getValues: function getValues() {
|
|
44
|
+
return scrollbar.current.getValues();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}, []);
|
|
48
|
+
var handleKeyUpToScroll = _react["default"].useCallback(function (e) {
|
|
49
|
+
var interactiveSelector = 'input, select, textarea, button, [role="listbox"], [role="option"], [role="combobox"], [role="slider"], [role="tablist"], [role="tab"], [contenteditable="true"]';
|
|
50
|
+
var target = e.target;
|
|
51
|
+
if (target.closest(interactiveSelector)) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (e.key === 'ArrowDown') {
|
|
55
|
+
var _scrollbar$current;
|
|
56
|
+
scrollbar === null || scrollbar === void 0 ? void 0 : (_scrollbar$current = scrollbar.current) === null || _scrollbar$current === void 0 ? void 0 : _scrollbar$current.scrollToBottom();
|
|
57
|
+
}
|
|
58
|
+
if (e.key === 'ArrowUp') {
|
|
59
|
+
var _scrollbar$current2;
|
|
60
|
+
scrollbar === null || scrollbar === void 0 ? void 0 : (_scrollbar$current2 = scrollbar.current) === null || _scrollbar$current2 === void 0 ? void 0 : _scrollbar$current2.scrollToTop();
|
|
61
|
+
}
|
|
62
|
+
}, []);
|
|
63
|
+
var style = props.style,
|
|
64
|
+
autoHide = props.autoHide,
|
|
65
|
+
children = props.children,
|
|
66
|
+
showX = props.showX,
|
|
67
|
+
onScrollStop = props.onScrollStop,
|
|
68
|
+
classFixProp = props.classFix,
|
|
69
|
+
_props$horizontalScro = props.horizontalScroll,
|
|
70
|
+
horizontalScroll = _props$horizontalScro === void 0 ? false : _props$horizontalScro;
|
|
71
|
+
var classFix = typeof classFixProp === 'string' ? classFixProp : '';
|
|
72
|
+
var extraClass = '';
|
|
73
|
+
if (classFix === 'scrollflex' && !(0, _getScrollbarWidth["default"])()) {
|
|
74
|
+
extraClass = 'macOSFlexFix';
|
|
75
|
+
}
|
|
76
|
+
return /*#__PURE__*/_react["default"].createElement(_reactCustomScrollbars.Scrollbars, _extends({
|
|
77
|
+
ref: scrollbar,
|
|
78
|
+
autoHide: autoHide,
|
|
79
|
+
className: prefixClass("Scrollbar ".concat(classFix, " ").concat(extraClass, " ").concat(horizontalScroll ? 'scrollbarBoth' : 'scrollbarOnlyY', " scrollbarFixHeight")),
|
|
80
|
+
onScrollStop: onScrollStop,
|
|
81
|
+
onKeyDown: handleKeyUpToScroll,
|
|
82
|
+
style: _objectSpread(_objectSpread({
|
|
83
|
+
width: '100%',
|
|
84
|
+
height: '100%'
|
|
85
|
+
}, style), stylesInLine)
|
|
86
|
+
}, !showX ? {
|
|
87
|
+
renderTrackHorizontal: function renderTrackHorizontal(scrollbarProps) {
|
|
88
|
+
return /*#__PURE__*/_react["default"].createElement("div", _extends({
|
|
89
|
+
style: {
|
|
90
|
+
display: 'hidden'
|
|
91
|
+
}
|
|
92
|
+
}, scrollbarProps));
|
|
93
|
+
},
|
|
94
|
+
renderThumbHorizontal: function renderThumbHorizontal(scrollbarProps) {
|
|
95
|
+
return /*#__PURE__*/_react["default"].createElement("div", _extends({
|
|
96
|
+
style: {
|
|
97
|
+
display: 'hidden'
|
|
98
|
+
}
|
|
99
|
+
}, scrollbarProps));
|
|
100
|
+
}
|
|
101
|
+
} : {}), children);
|
|
102
|
+
});
|
|
103
|
+
var _default = ScrollbarOld;
|
|
104
|
+
exports["default"] = _default;
|
|
@@ -267,6 +267,7 @@ var SelectInput = function SelectInput(_ref) {
|
|
|
267
267
|
ref: selectRef
|
|
268
268
|
}, /*#__PURE__*/_react["default"].createElement(_InputText["default"], _extends({
|
|
269
269
|
ref: inputRef,
|
|
270
|
+
id: selectId,
|
|
270
271
|
label: label,
|
|
271
272
|
renderValue: getRenderValue(),
|
|
272
273
|
value: getRenderValue(),
|