@geneui/components 2.11.2 → 2.12.2
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/{ActionableList.js → ActionableList/index.js} +83 -152
- package/{AdvancedSearch.js → AdvancedSearch/index.js} +290 -304
- package/Alert/index.js +97 -0
- package/Avatar/index.js +30 -0
- package/Badge/index.js +75 -0
- package/{Breadcrumb.js → Breadcrumb/index.js} +32 -31
- package/BusyLoader/index.js +68 -0
- package/Button/index.js +129 -0
- package/CHANGELOG.md +53 -0
- package/{Card.js → Card/index.js} +82 -94
- package/{CardList.js → CardList/index.js} +120 -165
- package/{CellMeasurerCache-b786dd93.js → CellMeasurerCache-3741d716.js} +2 -2
- package/{index-9164a86d.js → Charts/index.js} +17103 -30447
- package/{Checkbox.js → Checkbox/index.js} +37 -38
- package/{CheckboxGroup.js → CheckboxGroup/index.js} +41 -42
- package/{CheckboxGroupWithSearch.js → CheckboxGroupWithSearch/index.js} +64 -65
- package/{Collapse.js → Collapse/index.js} +28 -29
- package/{ColorPicker.js → ColorPicker/index.js} +16 -16
- package/ComboBox/index.js +525 -0
- package/Counter/index.js +310 -0
- package/{DateFilter.js → DateFilter/index.js} +45 -43
- package/{DatePicker.js → DatePicker/index.js} +106 -108
- package/{index-0199942c.js → DatePickerInput/index.js} +114 -100
- package/{Divider.js → Divider/index.js} +9 -10
- package/{Drawer.js → Drawer/index.js} +40 -41
- package/Dropdown/index.js +41 -0
- package/{Editor.js → Editor/index.js} +165 -164
- package/{Empty.js → Empty/index.js} +12 -13
- package/{ExtendedInput.js → ExtendedInput/index.js} +81 -71
- package/Form/index.js +83 -0
- package/{FormContainer.js → FormContainer/index.js} +25 -26
- package/FormableCheckbox/index.js +26 -0
- package/FormableDatePicker/index.js +41 -0
- package/FormableDropdown/index.js +48 -0
- package/FormableEditor/index.js +24 -0
- package/{FormableHOC-21051057.js → FormableHOC-55263162.js} +3 -3
- package/FormableMultiSelectDropdown/index.js +48 -0
- package/FormableNumberInput/index.js +32 -0
- package/FormableRadio/index.js +22 -0
- package/FormableSwitcher/index.js +22 -0
- package/FormableTextInput/index.js +32 -0
- package/FormableUploader/index.js +42 -0
- package/GeneUIProvider/index.js +282 -0
- package/{Grid.js → Grid/index.js} +27 -27
- package/Holder/index.js +261 -0
- package/{Icon.js → Icon/index.js} +9 -10
- package/Image/index.js +129 -0
- package/ImagePreview/index.js +481 -0
- package/{KeyValue.js → KeyValue/index.js} +11 -12
- package/LICENSE +21 -0
- package/Label/index.js +57 -0
- package/LinkButton/index.js +67 -0
- package/{Menu.js → Menu/index.js} +27 -28
- package/MobileNavigation/index.js +94 -0
- package/{MobilePopup.js → MobilePopup/index.js} +42 -41
- package/{Modal.js → Modal/index.js} +39 -40
- package/ModuleTitle/index.js +143 -0
- package/{NavigationMenu.js → NavigationMenu/index.js} +30 -29
- package/Notification/index.js +119 -0
- package/Option/index.js +184 -0
- package/Overlay/index.js +189 -0
- package/Overspread/index.js +289 -0
- package/{Pagination.js → Pagination/index.js} +35 -34
- package/Paper/index.js +96 -0
- package/{index-084588e9.js → Popover/index.js} +48 -58
- package/PopoverV2/index.js +18 -0
- package/{Portal.js → Portal/index.js} +7 -8
- package/{Products.js → Products/index.js} +20 -21
- package/Profile/index.js +585 -0
- package/Progress/index.js +199 -0
- package/{QRCode.js → QRCode/index.js} +4 -6
- package/{Radio.js → Radio/index.js} +25 -26
- package/{RadioGroup.js → RadioGroup/index.js} +17 -18
- package/{index-00fe8887.js → Range/index.js} +29 -32
- package/RichEditor/index.js +13 -0
- package/{RichEditor-98accead.js → RichEditor-8b0f7ccd.js} +18 -18
- package/{Scrollbar.js → Scrollbar/index.js} +15 -17
- package/{Search.js → Search/index.js} +25 -24
- package/SearchWithDropdown/index.js +138 -0
- package/Section/index.js +61 -0
- package/{SkeletonLoader.js → SkeletonLoader/index.js} +13 -14
- package/{Slider.js → Slider/index.js} +46 -43
- package/Status/index.js +103 -0
- package/Steps/index.js +313 -0
- package/{index-897d8240.js → SuggestionList/index.js} +15 -38
- package/{Switcher.js → Switcher/index.js} +30 -31
- package/Table/index.js +53 -0
- package/{TableCompositions.js → TableCompositions/index.js} +131 -168
- package/Tabs/index.js +235 -0
- package/Tag/index.js +102 -0
- package/{TextLink.js → TextLink/index.js} +3 -3
- package/{Textarea.js → Textarea/index.js} +66 -65
- package/{Time.js → Time/index.js} +13 -14
- package/TimePicker/index.js +555 -0
- package/Timeline/index.js +113 -0
- package/Title/index.js +65 -0
- package/{Toaster.js → Toaster/index.js} +19 -20
- package/{Tooltip.js → Tooltip/index.js} +27 -28
- package/{TransferList.js → TransferList/index.js} +44 -55
- package/{index-135b9d17.js → Uploader/index.js} +119 -116
- package/{ValidatableCheckbox.js → ValidatableCheckbox/index.js} +23 -24
- package/{ValidatableDatePicker.js → ValidatableDatePicker/index.js} +44 -42
- package/ValidatableDropdown/index.js +139 -0
- package/ValidatableElements/index.js +65 -0
- package/ValidatableMultiSelectDropdown/index.js +150 -0
- package/{ValidatableNumberInput.js → ValidatableNumberInput/index.js} +41 -33
- package/{ValidatableRadio.js → ValidatableRadio/index.js} +19 -20
- package/{ValidatableSwitcher.js → ValidatableSwitcher/index.js} +19 -20
- package/{ValidatableTextInput.js → ValidatableTextInput/index.js} +32 -31
- package/{ValidatableTimeInput.js → ValidatableTimeInput/index.js} +31 -30
- package/{ValidatableUploader.js → ValidatableUploader/index.js} +36 -34
- package/Widget/index.js +227 -0
- package/config-0ca92874.js +31 -0
- package/{configs-91c86664.js → configs-fed6ac34.js} +28 -1
- package/hooks/useBodyScroll.js +16 -0
- package/hooks/useClick.js +18 -0
- package/{useClickOutside-5183e396.js → hooks/useClickOutside.js} +1 -1
- package/hooks/useDebounceHook.js +16 -0
- package/{useDeviceType-dd51db38.js → hooks/useDeviceType.js} +4 -3
- package/hooks/useDidMount.js +15 -0
- package/{useEllipsisDetection-ef536015.js → hooks/useEllipsisDetection.js} +1 -1
- package/hooks/useForceUpdate.js +8 -0
- package/hooks/useImgDownload.js +18 -0
- package/{useKeyDown-38102ae7.js → hooks/useKeyDown.js} +1 -1
- package/hooks/useMount.js +13 -0
- package/hooks/useMutationObserver.js +21 -0
- package/hooks/usePrevious.js +10 -0
- package/hooks/useThrottle.js +16 -0
- package/hooks/useToggle.js +11 -0
- package/hooks/useUpdatableRef.js +14 -0
- package/hooks/useUpdate.js +10 -0
- package/{useWidth-9f4647f8.js → hooks/useWidth.js} +2 -2
- package/{useWindowSize-80369d76.js → hooks/useWindowSize.js} +1 -1
- package/{index-8c98317a.js → index-11eea761.js} +678 -752
- package/index-2ad83e03.js +4 -0
- package/index-34e47647.js +10054 -0
- package/index-45eafea6.js +90 -0
- package/{index-5e96cb4d.js → index-462461c0.js} +50 -48
- package/{index-ac59cb10.js → index-a0e4e333.js} +6 -6
- package/{index-e8776f3d.js → index-b1e429a7.js} +1 -1
- package/index.d.ts +115 -0
- package/index.js +137 -113
- package/index.mobile.d.ts +16 -0
- package/lib/atoms/Avatar/Avatar.d.ts +34 -0
- package/lib/atoms/Avatar/index.d.ts +1 -0
- package/lib/atoms/LinkButton/LinkButton.d.ts +46 -0
- package/lib/atoms/LinkButton/index.d.ts +1 -0
- package/{objectWithoutPropertiesLoose-299691d8.js → objectWithoutPropertiesLoose-d8a4a68c.js} +12 -12
- package/package.json +42 -22
- package/{rangeAndSlider-20599da4.js → rangeAndSlider-0301a458.js} +220 -375
- package/{react-beautiful-dnd.esm-38c37304.js → react-beautiful-dnd.esm-04c14563.js} +9 -9
- package/react-lifecycles-compat.es-6e1f3768.js +158 -0
- package/Alert.js +0 -98
- package/Avatar.js +0 -77
- package/Badge.js +0 -76
- package/BusyLoader.js +0 -69
- package/Button.js +0 -130
- package/Charts.js +0 -99
- package/ComboBox.js +0 -99
- package/Counter.js +0 -99
- package/DatePickerInput.js +0 -30
- package/Dropdown.js +0 -99
- package/Form.js +0 -116
- package/FormableCheckbox.js +0 -27
- package/FormableDatePicker.js +0 -39
- package/FormableDropdown.js +0 -105
- package/FormableEditor.js +0 -24
- package/FormableMultiSelectDropdown.js +0 -105
- package/FormableNumberInput.js +0 -31
- package/FormableRadio.js +0 -23
- package/FormableSwitcher.js +0 -23
- package/FormableTextInput.js +0 -31
- package/FormableUploader.js +0 -40
- package/GeneUIProvider.js +0 -256
- package/Holder.js +0 -99
- package/Image.js +0 -130
- package/ImagePreview.js +0 -99
- package/Label.js +0 -58
- package/LinkButton.js +0 -104
- package/MobileNavigation.js +0 -95
- package/ModuleTitle.js +0 -99
- package/Notification.js +0 -120
- package/Option.js +0 -186
- package/Overlay.js +0 -99
- package/Overspread.js +0 -343
- package/Paper.js +0 -97
- package/Popover.js +0 -20
- package/PopoverV2.js +0 -19
- package/Profile.js +0 -99
- package/Progress.js +0 -200
- package/Range.js +0 -14
- package/RichEditor.js +0 -13
- package/SearchWithDropdown.js +0 -195
- package/Section.js +0 -62
- package/Status.js +0 -104
- package/Steps.js +0 -312
- package/SuggestionList.js +0 -15
- package/Table.js +0 -102
- package/Tabs.js +0 -236
- package/Tag.js +0 -103
- package/TimePicker.js +0 -99
- package/Timeline.js +0 -114
- package/Title.js +0 -66
- package/Uploader.js +0 -32
- package/ValidatableDropdown.js +0 -99
- package/ValidatableElements.js +0 -99
- package/ValidatableMultiSelectDropdown.js +0 -99
- package/Widget.js +0 -99
- package/globalStyling-9c60a159.js +0 -4
- package/index-2030e31c.js +0 -4
- package/index-b7a33c58.js +0 -11
- package/index-e0af0caf.js +0 -1182
- package/useMount-6fef51a5.js +0 -9
package/Counter/index.js
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import React__default, { useRef, useState, useEffect, useMemo, useCallback } from 'react';
|
|
2
|
+
import { c as classnames } from '../index-6ff23041.js';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { n as noop, s as stopEvent } from '../index-a0e4e333.js';
|
|
5
|
+
import useKeyDown from '../hooks/useKeyDown.js';
|
|
6
|
+
import '../configs-fed6ac34.js';
|
|
7
|
+
import Button from '../Button/index.js';
|
|
8
|
+
import Label from '../Label/index.js';
|
|
9
|
+
import SkeletonLoader from '../SkeletonLoader/index.js';
|
|
10
|
+
import Tooltip from '../Tooltip/index.js';
|
|
11
|
+
import ExtendedInput from '../ExtendedInput/index.js';
|
|
12
|
+
import { s as styleInject } from '../style-inject.es-746bb8ed.js';
|
|
13
|
+
import '../dateValidation-67caec66.js';
|
|
14
|
+
import '../_commonjsHelpers-24198af3.js';
|
|
15
|
+
import 'react-dom';
|
|
16
|
+
import '../_rollupPluginBabelHelpers-e8fb2e5c.js';
|
|
17
|
+
import '../Icon/index.js';
|
|
18
|
+
import '../Popover-f4d1cac0.js';
|
|
19
|
+
import '../hooks/useDeviceType.js';
|
|
20
|
+
import '../hooks/useWindowSize.js';
|
|
21
|
+
import '../GeneUIProvider/index.js';
|
|
22
|
+
import '../hooks/useEllipsisDetection.js';
|
|
23
|
+
import '../SuggestionList/index.js';
|
|
24
|
+
import '../hooks/useClickOutside.js';
|
|
25
|
+
import '../config-0ca92874.js';
|
|
26
|
+
import '../Scrollbar/index.js';
|
|
27
|
+
|
|
28
|
+
var css_248z = "[data-gene-ui-version=\"2.12.2\"] .counter{width:100%}[data-gene-ui-version=\"2.12.2\"] .counter.s-small{--height:2.4rem;--width:var(--height);min-width:8rem}[data-gene-ui-version=\"2.12.2\"] .counter.s-medium{--height:3.6rem;--width:var(--height);min-width:12rem}[data-gene-ui-version=\"2.12.2\"] .counter.s-big{--height:4.2rem;--width:var(--height);min-width:14rem}[data-gene-ui-version=\"2.12.2\"] .counter.r-round .react-loading-skeleton{border-radius:4.2rem}[data-gene-ui-version=\"2.12.2\"] .counter.r-smooth .react-loading-skeleton{border-radius:.4rem}[data-gene-ui-version=\"2.12.2\"] .counter__label{color:rgba(var(--background-sc-rgb),.75);font-size:1.4rem;font-weight:600;margin-bottom:.8rem;opacity:.5}[data-gene-ui-version=\"2.12.2\"] .counter__wrapper{display:flex;gap:.4rem;height:var(--height)}[data-gene-ui-version=\"2.12.2\"] .counter__input{opacity:1!important}[data-gene-ui-version=\"2.12.2\"] .counter__input-holder{display:flex;min-width:var(---width);overflow:hidden;width:100%}[data-gene-ui-version=\"2.12.2\"] .counter__input-holder .react-loading-skeleton{height:var(--height)!important}[data-gene-ui-version=\"2.12.2\"] .counter__input .input-structure{padding:0}[data-gene-ui-version=\"2.12.2\"] .counter__input .input-element{justify-content:center;max-height:var(--height);min-height:var(--height);text-align:center}[data-gene-ui-version=\"2.12.2\"] .counter__input .input-element:disabled{color:rgba(var(--background-sc-rgb),.5)}[data-gene-ui-version=\"2.12.2\"] .counter__button{height:100%;min-height:100%;min-width:var(--width);width:var(--width)}[data-gene-ui-version=\"2.12.2\"] .counter__button .btn{max-height:100%;max-width:100%;min-height:100%;min-width:100%}[data-gene-ui-version=\"2.12.2\"] .counter__button .skeleton-holder .react-loading-skeleton{height:var(--height)!important;width:var(--width)}";
|
|
29
|
+
styleInject(css_248z);
|
|
30
|
+
|
|
31
|
+
const keyDownKeys = {
|
|
32
|
+
arrowUp: 'ArrowUp',
|
|
33
|
+
arrowDown: 'ArrowDown'
|
|
34
|
+
};
|
|
35
|
+
const inputRadiusMap = {
|
|
36
|
+
round: 'full-radius',
|
|
37
|
+
smooth: 'smooth-radius'
|
|
38
|
+
};
|
|
39
|
+
function Counter(_ref) {
|
|
40
|
+
let {
|
|
41
|
+
minusTooltipText,
|
|
42
|
+
plusTooltipText,
|
|
43
|
+
inputReadOnly,
|
|
44
|
+
defaultValue,
|
|
45
|
+
cornerRadius,
|
|
46
|
+
isLoading,
|
|
47
|
+
className,
|
|
48
|
+
minValue,
|
|
49
|
+
maxValue,
|
|
50
|
+
readOnly,
|
|
51
|
+
disabled,
|
|
52
|
+
onChange,
|
|
53
|
+
label,
|
|
54
|
+
value,
|
|
55
|
+
width,
|
|
56
|
+
size,
|
|
57
|
+
step
|
|
58
|
+
} = _ref;
|
|
59
|
+
const ref = useRef();
|
|
60
|
+
const inputRef = useRef();
|
|
61
|
+
const [showInputTooltip, setShowInputTooltip] = useState(false);
|
|
62
|
+
const [isTruncated, setIsTruncated] = useState(false);
|
|
63
|
+
const [data, setData] = useState(defaultValue || 0);
|
|
64
|
+
const [counterStep, setCounterStep] = useState(step);
|
|
65
|
+
useEffect(() => setCounterStep(step), [step]);
|
|
66
|
+
const isMinMaxWrong = useMemo(() => minValue >= maxValue, [minValue, maxValue]);
|
|
67
|
+
const isControlled = useMemo(() => value === 0 || !!value, [value]);
|
|
68
|
+
const modifiedSize = useMemo(() => typeof width === 'number' ? "".concat(width, "px") : width, [width]);
|
|
69
|
+
const isDisableMinus = useMemo(() => +data === minValue, [minValue, data]);
|
|
70
|
+
const isDisablePlus = useMemo(() => +data === maxValue, [maxValue, data]);
|
|
71
|
+
const isMinValue = useMemo(() => minValue !== undefined, [minValue]);
|
|
72
|
+
const isMaxValue = useMemo(() => maxValue !== undefined, [maxValue]);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (typeof defaultValue === 'number' && defaultValue <= maxValue && defaultValue >= minValue) {
|
|
75
|
+
return setData(defaultValue);
|
|
76
|
+
}
|
|
77
|
+
if (typeof minValue === 'number' && minValue > defaultValue) {
|
|
78
|
+
return setData(minValue);
|
|
79
|
+
}
|
|
80
|
+
}, [minValue, defaultValue, maxValue]);
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
isControlled && setData(value);
|
|
83
|
+
}, [value]);
|
|
84
|
+
const setNewValue = useCallback(val => {
|
|
85
|
+
!isControlled && setData(eventState => (+eventState + +val).toString());
|
|
86
|
+
onChange((+data + +val).toString());
|
|
87
|
+
}, [isControlled, data]);
|
|
88
|
+
const setValueToMin = useCallback(() => {
|
|
89
|
+
!isControlled && setData(minValue === null || minValue === void 0 ? void 0 : minValue.toString());
|
|
90
|
+
onChange(minValue === null || minValue === void 0 ? void 0 : minValue.toString());
|
|
91
|
+
}, [isControlled, minValue]);
|
|
92
|
+
const setValueToMax = useCallback(() => {
|
|
93
|
+
!isControlled && setData(maxValue === null || maxValue === void 0 ? void 0 : maxValue.toString());
|
|
94
|
+
onChange(maxValue === null || maxValue === void 0 ? void 0 : maxValue.toString());
|
|
95
|
+
}, [isControlled, maxValue]);
|
|
96
|
+
const handleChange = useCallback(val => {
|
|
97
|
+
if (isMinValue && isMaxValue) {
|
|
98
|
+
if (+data <= maxValue && +data >= minValue && +val + +data <= maxValue && +val + +data >= minValue || val === '-') {
|
|
99
|
+
setNewValue(val);
|
|
100
|
+
} else if (+val + +data > maxValue) {
|
|
101
|
+
setValueToMax();
|
|
102
|
+
} else if (+val + +data < minValue) {
|
|
103
|
+
setValueToMin();
|
|
104
|
+
}
|
|
105
|
+
} else if (isMaxValue && +data <= maxValue || val === '-') {
|
|
106
|
+
if (+val + +data <= maxValue) {
|
|
107
|
+
setNewValue(val);
|
|
108
|
+
} else {
|
|
109
|
+
setValueToMax();
|
|
110
|
+
}
|
|
111
|
+
} else if (isMinValue && +data >= minValue || val === '-') {
|
|
112
|
+
if (+val + +data >= minValue) {
|
|
113
|
+
setNewValue(val);
|
|
114
|
+
} else {
|
|
115
|
+
setValueToMin();
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
setNewValue(val);
|
|
119
|
+
}
|
|
120
|
+
}, [data, isControlled]);
|
|
121
|
+
const setNewInputValue = useCallback(value => {
|
|
122
|
+
!isControlled && setData(value.trim());
|
|
123
|
+
!isNaN(+value) && onChange(value);
|
|
124
|
+
}, [isControlled]);
|
|
125
|
+
const handleInputChange = useCallback(_ref2 => {
|
|
126
|
+
let {
|
|
127
|
+
target: {
|
|
128
|
+
value
|
|
129
|
+
}
|
|
130
|
+
} = _ref2;
|
|
131
|
+
if (isMinValue && isMaxValue) {
|
|
132
|
+
if (+value <= maxValue && +value >= minValue || value === '-') {
|
|
133
|
+
setNewInputValue(value);
|
|
134
|
+
}
|
|
135
|
+
} else if (isMaxValue) {
|
|
136
|
+
if (+value <= maxValue) {
|
|
137
|
+
setNewInputValue(value);
|
|
138
|
+
} else if (value === '-') {
|
|
139
|
+
setNewInputValue(value);
|
|
140
|
+
}
|
|
141
|
+
} else if (isMinValue) {
|
|
142
|
+
if (+value >= minValue) {
|
|
143
|
+
setNewInputValue(value);
|
|
144
|
+
} else if (value === '-') {
|
|
145
|
+
setNewInputValue(value);
|
|
146
|
+
}
|
|
147
|
+
} else {
|
|
148
|
+
setNewInputValue(value);
|
|
149
|
+
}
|
|
150
|
+
}, [maxValue, minValue]);
|
|
151
|
+
useKeyDown(e => {
|
|
152
|
+
stopEvent(e, true);
|
|
153
|
+
if (e.key === keyDownKeys.arrowUp && !isDisablePlus) {
|
|
154
|
+
handleChange(counterStep);
|
|
155
|
+
}
|
|
156
|
+
if (e.key === keyDownKeys.arrowDown && !isDisableMinus) {
|
|
157
|
+
handleChange(-counterStep);
|
|
158
|
+
}
|
|
159
|
+
}, [handleChange], ref, [keyDownKeys.arrowUp, keyDownKeys.arrowDown]);
|
|
160
|
+
useEffect(() => {
|
|
161
|
+
var _inputRef$current, _inputRef$current2;
|
|
162
|
+
if (((_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.scrollWidth) > ((_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.offsetWidth)) {
|
|
163
|
+
!isTruncated && setIsTruncated(true);
|
|
164
|
+
} else {
|
|
165
|
+
isTruncated && setIsTruncated(false);
|
|
166
|
+
}
|
|
167
|
+
}, [data]);
|
|
168
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
169
|
+
ref: ref,
|
|
170
|
+
style: {
|
|
171
|
+
maxWidth: modifiedSize
|
|
172
|
+
},
|
|
173
|
+
onMouseOver: () => isTruncated && setShowInputTooltip(true),
|
|
174
|
+
onMouseLeave: () => isTruncated && setShowInputTooltip(false),
|
|
175
|
+
className: classnames('counter', className, "s-".concat(size), "r-".concat(cornerRadius))
|
|
176
|
+
}, label && /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
177
|
+
title: label
|
|
178
|
+
}, /*#__PURE__*/React__default.createElement(Label, {
|
|
179
|
+
className: "counter__label ellipsis-text",
|
|
180
|
+
size: "bodySmall"
|
|
181
|
+
}, label)), /*#__PURE__*/React__default.createElement("div", {
|
|
182
|
+
className: "counter__wrapper"
|
|
183
|
+
}, !readOnly && /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
184
|
+
title: isDisableMinus && !isLoading ? minusTooltipText : ''
|
|
185
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
186
|
+
className: "counter__button counter__button-minus"
|
|
187
|
+
}, isLoading ? /*#__PURE__*/React__default.createElement(SkeletonLoader, {
|
|
188
|
+
isBusy: isLoading
|
|
189
|
+
}) : /*#__PURE__*/React__default.createElement(Button, {
|
|
190
|
+
icon: isLoading ? 'bc-icon-loader' : 'bc-icon-minus',
|
|
191
|
+
disabled: isMinMaxWrong || isDisableMinus || disabled,
|
|
192
|
+
cornerRadius: cornerRadius,
|
|
193
|
+
onClick: () => handleChange(-counterStep)
|
|
194
|
+
}))), /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
195
|
+
alwaysShow: showInputTooltip,
|
|
196
|
+
title: isTruncated ? data : ''
|
|
197
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
198
|
+
className: "counter__input-holder"
|
|
199
|
+
}, isLoading ? /*#__PURE__*/React__default.createElement(SkeletonLoader, {
|
|
200
|
+
isBusy: isLoading
|
|
201
|
+
}) : /*#__PURE__*/React__default.createElement(ExtendedInput, {
|
|
202
|
+
ref: inputRef,
|
|
203
|
+
className: "counter__input",
|
|
204
|
+
disabled: isMinMaxWrong || disabled || isLoading,
|
|
205
|
+
cornerRadius: inputRadiusMap[cornerRadius],
|
|
206
|
+
onChange: handleInputChange,
|
|
207
|
+
showNumberIcon: false,
|
|
208
|
+
readOnly: readOnly || inputReadOnly,
|
|
209
|
+
type: "number",
|
|
210
|
+
value: data
|
|
211
|
+
}))), !readOnly && /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
212
|
+
title: isDisablePlus && !isLoading ? plusTooltipText : ''
|
|
213
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
214
|
+
className: "counter__button counter__button-plus"
|
|
215
|
+
}, isLoading ? /*#__PURE__*/React__default.createElement(SkeletonLoader, {
|
|
216
|
+
isBusy: isLoading
|
|
217
|
+
}) : /*#__PURE__*/React__default.createElement(Button, {
|
|
218
|
+
icon: isLoading ? 'bc-icon-loader' : 'bc-icon-plus',
|
|
219
|
+
disabled: isMinMaxWrong || isDisablePlus || disabled,
|
|
220
|
+
cornerRadius: cornerRadius,
|
|
221
|
+
onClick: () => handleChange(counterStep)
|
|
222
|
+
})))));
|
|
223
|
+
}
|
|
224
|
+
const CounterConfig = {
|
|
225
|
+
size: ['small', 'medium', 'big'],
|
|
226
|
+
cornerRadius: ['round', 'smooth']
|
|
227
|
+
};
|
|
228
|
+
Counter.propTypes = {
|
|
229
|
+
/**
|
|
230
|
+
* Additional className
|
|
231
|
+
*/
|
|
232
|
+
className: PropTypes.string,
|
|
233
|
+
/**
|
|
234
|
+
* counter will become disabled when set to "true"
|
|
235
|
+
*/
|
|
236
|
+
disabled: PropTypes.bool,
|
|
237
|
+
/**
|
|
238
|
+
* counter input will become readonly when set to "true"
|
|
239
|
+
*/
|
|
240
|
+
inputReadOnly: PropTypes.bool,
|
|
241
|
+
/**
|
|
242
|
+
* Label for 'counter'.
|
|
243
|
+
*/
|
|
244
|
+
label: PropTypes.string,
|
|
245
|
+
/**
|
|
246
|
+
* onChange function which returns callBack if there is a change
|
|
247
|
+
*/
|
|
248
|
+
onChange: PropTypes.func,
|
|
249
|
+
/**
|
|
250
|
+
* Use this prop to control counter state. Note that when you specify this prop, the counter will not functionate itself
|
|
251
|
+
*/
|
|
252
|
+
value: PropTypes.number,
|
|
253
|
+
/**
|
|
254
|
+
* This prop will only applied once as defaultState for "value" when counter mounts.
|
|
255
|
+
* Note that specifying this prop is not mean controlling it.
|
|
256
|
+
*/
|
|
257
|
+
defaultValue: PropTypes.number,
|
|
258
|
+
/**
|
|
259
|
+
* Is loading state.
|
|
260
|
+
*/
|
|
261
|
+
isLoading: PropTypes.bool,
|
|
262
|
+
/**
|
|
263
|
+
* counter size, if the set value is number default use px
|
|
264
|
+
*/
|
|
265
|
+
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
266
|
+
/**
|
|
267
|
+
* counter size
|
|
268
|
+
*/
|
|
269
|
+
size: PropTypes.oneOf(CounterConfig.size),
|
|
270
|
+
/**
|
|
271
|
+
* counter corner radius
|
|
272
|
+
*/
|
|
273
|
+
cornerRadius: PropTypes.oneOf(CounterConfig.cornerRadius),
|
|
274
|
+
/**
|
|
275
|
+
* minus tooltip text
|
|
276
|
+
*/
|
|
277
|
+
minusTooltipText: PropTypes.string,
|
|
278
|
+
/**
|
|
279
|
+
* plus tooltip text
|
|
280
|
+
*/
|
|
281
|
+
plusTooltipText: PropTypes.string,
|
|
282
|
+
/**
|
|
283
|
+
* Counter minimum value
|
|
284
|
+
*/
|
|
285
|
+
minValue: PropTypes.number,
|
|
286
|
+
/**
|
|
287
|
+
* Counter maximum value
|
|
288
|
+
*/
|
|
289
|
+
maxValue: PropTypes.number,
|
|
290
|
+
/**
|
|
291
|
+
* Counter step value
|
|
292
|
+
*/
|
|
293
|
+
step: PropTypes.number
|
|
294
|
+
};
|
|
295
|
+
Counter.defaultProps = {
|
|
296
|
+
cornerRadius: CounterConfig.cornerRadius[0],
|
|
297
|
+
size: CounterConfig.size[1],
|
|
298
|
+
minusTooltipText: '',
|
|
299
|
+
inputReadOnly: false,
|
|
300
|
+
plusTooltipText: '',
|
|
301
|
+
isLoading: false,
|
|
302
|
+
disabled: false,
|
|
303
|
+
readOnly: false,
|
|
304
|
+
onChange: noop,
|
|
305
|
+
width: '100px',
|
|
306
|
+
label: '',
|
|
307
|
+
step: 1
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
export { Counter as default };
|
|
@@ -1,35 +1,37 @@
|
|
|
1
|
-
import { _ as _extends } from '
|
|
1
|
+
import { _ as _extends } from '../_rollupPluginBabelHelpers-e8fb2e5c.js';
|
|
2
2
|
import React__default, { useState, useCallback } from 'react';
|
|
3
|
-
import
|
|
4
|
-
import { c as classnames } from '
|
|
5
|
-
import { n as noop, b as isToday, d as isYesterday, e as isThisWeek,
|
|
6
|
-
import { d as dayjsWithPlugins } from '
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import '
|
|
10
|
-
import {
|
|
11
|
-
import { g as getBrowserDateFormat } from './localization-4ba17032.js';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { c as classnames } from '../index-6ff23041.js';
|
|
5
|
+
import { n as noop, b as isToday, d as isYesterday, e as isThisWeek, g as isLastWeek, h as isThisMonth, j as isLastMonth, l as isLastMonthToDate, m as getLMTD } from '../index-a0e4e333.js';
|
|
6
|
+
import { d as dayjsWithPlugins } from '../dateValidation-67caec66.js';
|
|
7
|
+
import Button from '../Button/index.js';
|
|
8
|
+
import DatePickerInput from '../DatePickerInput/index.js';
|
|
9
|
+
import { s as styleInject } from '../style-inject.es-746bb8ed.js';
|
|
10
|
+
import { g as getBrowserDateFormat } from '../localization-4ba17032.js';
|
|
12
11
|
import 'react-dom';
|
|
13
|
-
import '
|
|
14
|
-
import '
|
|
15
|
-
import '
|
|
16
|
-
import '
|
|
17
|
-
import '
|
|
18
|
-
import '
|
|
19
|
-
import '
|
|
20
|
-
import '
|
|
21
|
-
import '
|
|
22
|
-
import '
|
|
23
|
-
import '
|
|
24
|
-
import '
|
|
25
|
-
import '
|
|
26
|
-
import '
|
|
27
|
-
import '
|
|
28
|
-
import '
|
|
29
|
-
import '
|
|
30
|
-
import '
|
|
12
|
+
import '../_commonjsHelpers-24198af3.js';
|
|
13
|
+
import '../Icon/index.js';
|
|
14
|
+
import '../configs-fed6ac34.js';
|
|
15
|
+
import '../hooks/useClick.js';
|
|
16
|
+
import '../hooks/useKeyDown.js';
|
|
17
|
+
import '../hooks/useDeviceType.js';
|
|
18
|
+
import '../hooks/useWindowSize.js';
|
|
19
|
+
import '../index-462461c0.js';
|
|
20
|
+
import '../index-122432cd.js';
|
|
21
|
+
import '../hooks/useClickOutside.js';
|
|
22
|
+
import '../Scrollbar/index.js';
|
|
23
|
+
import '../GeneUIProvider/index.js';
|
|
24
|
+
import '../debounce-4419bc2f.js';
|
|
25
|
+
import '../ExtendedInput/index.js';
|
|
26
|
+
import '../hooks/useEllipsisDetection.js';
|
|
27
|
+
import '../SuggestionList/index.js';
|
|
28
|
+
import '../config-0ca92874.js';
|
|
29
|
+
import '../Tooltip/index.js';
|
|
30
|
+
import '../Popover-f4d1cac0.js';
|
|
31
|
+
import '../DatePicker/index.js';
|
|
32
|
+
import '../guid-8ddf77b3.js';
|
|
31
33
|
|
|
32
|
-
var css_248z = "[data-gene-ui-version=\"
|
|
34
|
+
var css_248z = "[data-gene-ui-version=\"2.12.2\"] .date-filters-holder{align-items:center;display:flex;justify-content:flex-end;width:100%}[data-gene-ui-version=\"2.12.2\"] .date-filters-holder>:not(:last-child){flex-shrink:0}[data-gene-ui-version=\"2.12.2\"] .date-filter-input{margin-inline-start:1rem}html:not([dir=rtl]) .date-filter-input .input-structure{padding-right:0}html[dir=rtl] .date-filter-input .input-structure{padding-left:0}[data-gene-ui-version=\"2.12.2\"] .date-filter-input .icon{border-radius:var(--input-element-border-radius,100%);height:3.6rem;margin:0 0 0 .5rem;width:3.6rem}html[dir=rtl] .date-filter-input .icon{margin:0 .5rem 0 0}[data-gene-ui-version=\"2.12.2\"] .date-filter-input.active .icon{background:var(--hero);color:var(--hero-sc)}[data-gene-ui-version=\"2.12.2\"] .date-filter-input.active .input-element-back{background:#0000;border-color:var(--hero)}";
|
|
33
35
|
styleInject(css_248z);
|
|
34
36
|
|
|
35
37
|
function getFilterByKey(key, date) {
|
|
@@ -122,12 +124,12 @@ DateFilter.propTypes = {
|
|
|
122
124
|
/**
|
|
123
125
|
* Specify the format of date
|
|
124
126
|
*/
|
|
125
|
-
format:
|
|
127
|
+
format: PropTypes.string,
|
|
126
128
|
/**
|
|
127
129
|
* Fires when user attempts to change value
|
|
128
130
|
* (dates: Array) => void
|
|
129
131
|
*/
|
|
130
|
-
onChange:
|
|
132
|
+
onChange: PropTypes.func,
|
|
131
133
|
/**
|
|
132
134
|
* Controls which filter buttons will be displayed based on filters object existing keys.
|
|
133
135
|
* For example if you define only `today` property on filters objects
|
|
@@ -135,31 +137,31 @@ DateFilter.propTypes = {
|
|
|
135
137
|
* Which will change Datefilter value to today.
|
|
136
138
|
* All filters will be displayed by default.
|
|
137
139
|
*/
|
|
138
|
-
filters:
|
|
139
|
-
today:
|
|
140
|
-
yesterday:
|
|
141
|
-
thisWeek:
|
|
142
|
-
lastWeek:
|
|
143
|
-
thisMonth:
|
|
144
|
-
lastMonth:
|
|
145
|
-
LMTD:
|
|
140
|
+
filters: PropTypes.exact({
|
|
141
|
+
today: PropTypes.string,
|
|
142
|
+
yesterday: PropTypes.string,
|
|
143
|
+
thisWeek: PropTypes.string,
|
|
144
|
+
lastWeek: PropTypes.string,
|
|
145
|
+
thisMonth: PropTypes.string,
|
|
146
|
+
lastMonth: PropTypes.string,
|
|
147
|
+
LMTD: PropTypes.string
|
|
146
148
|
}),
|
|
147
149
|
/**
|
|
148
150
|
* Current value. Creates a controlled component.
|
|
149
151
|
*/
|
|
150
|
-
value:
|
|
152
|
+
value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.instanceOf(dayjsWithPlugins)), PropTypes.arrayOf(PropTypes.instanceOf(Date)), PropTypes.arrayOf(PropTypes.string), PropTypes.arrayOf(PropTypes.number)]),
|
|
151
153
|
/**
|
|
152
154
|
* Additional classname which applies to datefilter holder div element
|
|
153
155
|
*/
|
|
154
|
-
className:
|
|
156
|
+
className: PropTypes.string,
|
|
155
157
|
/**
|
|
156
158
|
* Accepts same props as button component (atoms)
|
|
157
159
|
*/
|
|
158
|
-
buttonProps:
|
|
160
|
+
buttonProps: PropTypes.object,
|
|
159
161
|
/**
|
|
160
162
|
* This props will pass to picker, check DatePicker prop types
|
|
161
163
|
*/
|
|
162
|
-
pickerProps:
|
|
164
|
+
pickerProps: PropTypes.object
|
|
163
165
|
};
|
|
164
166
|
DateFilter.defaultProps = {
|
|
165
167
|
value: [],
|