@geneui/components 3.0.0-next-9ffcb93-16102024 → 3.0.0-next-48d0ef7-31102024
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/Avatar.js +63 -0
- package/CHANGELOG.md +7 -0
- package/Divider.js +23 -0
- package/{GeneUIProvider/index.js → GeneUIProvider.js} +52 -65
- package/HelperText.js +69 -0
- package/Info.js +64 -0
- package/Label.js +38 -0
- package/Loader.js +21 -0
- package/Pill.js +64 -0
- package/TextLink.js +20 -0
- package/{index-65217440.js → Tooltip.js} +104 -80
- package/{lib → components}/atoms/Avatar/Avatar.d.ts +7 -6
- package/components/atoms/Avatar/index.d.ts +1 -0
- package/{lib → components}/atoms/Divider/Divider.d.ts +5 -5
- package/components/atoms/Divider/index.d.ts +1 -0
- package/{lib → components}/atoms/HelperText/HelperText.d.ts +6 -5
- package/components/atoms/HelperText/index.d.ts +1 -0
- package/{lib → components}/atoms/Info/Info.d.ts +5 -5
- package/components/atoms/Info/index.d.ts +1 -0
- package/{lib → components}/atoms/Label/Label.d.ts +3 -3
- package/components/atoms/Label/index.d.ts +1 -0
- package/{lib → components}/atoms/Loader/Loader.d.ts +5 -5
- package/components/atoms/Loader/index.d.ts +1 -0
- package/{lib → components}/atoms/Pill/Pill.d.ts +7 -6
- package/components/atoms/Pill/index.d.ts +1 -0
- package/{lib → components}/atoms/TextLink/TextLink.d.ts +5 -5
- package/components/atoms/TextLink/index.d.ts +1 -0
- package/{lib → components}/molecules/Tooltip/Tooltip.d.ts +26 -21
- package/components/molecules/Tooltip/index.d.ts +1 -0
- package/components/providers/GeneUIProvider/GeneUIProvider.d.ts +30 -0
- package/components/providers/GeneUIProvider/index.d.ts +1 -0
- package/hooks/index.d.ts +2 -20
- package/hooks/useDebounceCallback/index.d.ts +1 -0
- package/hooks/useDebounceCallback/useDebounceCallback.d.ts +2 -0
- package/hooks/useEllipsisDetection/index.d.ts +1 -1
- package/hooks/useEllipsisDetection/useEllipsisDetection.d.ts +2 -2
- package/{index-031ff73c.js → index-ce02421b.js} +4 -4
- package/index.d.ts +11 -121
- package/index.js +12 -159
- package/package.json +24 -43
- package/tokens-0abb4e1b.js +6 -0
- package/types/index.d.ts +0 -3
- package/useEllipsisDetection-46d712b6.js +34 -0
- package/ActionableList/index.js +0 -1694
- package/AdvancedSearch/index.js +0 -892
- package/Alert/index.js +0 -98
- package/Avatar/index.js +0 -58
- package/Badge/index.js +0 -29
- package/Breadcrumb/index.js +0 -130
- package/BusyLoader/index.js +0 -31
- package/Button/index.js +0 -30
- package/Card/index.js +0 -502
- package/CardList/index.js +0 -662
- package/CellMeasurerCache-80be385d.js +0 -229
- package/Charts/index.js +0 -17662
- package/Checkbox/index.js +0 -229
- package/CheckboxGroup/index.js +0 -203
- package/CheckboxGroupWithSearch/index.js +0 -280
- package/Collapse/index.js +0 -195
- package/ColorPicker/index.js +0 -210
- package/ComboBox/index.js +0 -524
- package/Copy/index.js +0 -56
- package/Counter/index.js +0 -312
- package/DateFilter/index.js +0 -183
- package/DatePicker/index.js +0 -1229
- package/DatePickerInput/index.js +0 -883
- package/Divider/index.js +0 -23
- package/Drawer/index.js +0 -261
- package/Dropdown/index.js +0 -43
- package/Editor/index.js +0 -22975
- package/Empty/index.js +0 -76
- package/ExtendedInput/index.js +0 -590
- package/Form/index.js +0 -85
- package/FormContainer/index.js +0 -189
- package/FormableCheckbox/index.js +0 -24
- package/FormableDatePicker/index.js +0 -43
- package/FormableDropdown/index.js +0 -50
- package/FormableEditor/index.js +0 -26
- package/FormableHOC-85f89a81.js +0 -83
- package/FormableMultiSelectDropdown/index.js +0 -50
- package/FormableNumberInput/index.js +0 -34
- package/FormableRadio/index.js +0 -22
- package/FormableSwitcher/index.js +0 -22
- package/FormableTextInput/index.js +0 -34
- package/FormableUploader/index.js +0 -44
- package/Grid/index.js +0 -167
- package/HelperText/index.js +0 -86
- package/Holder/index.js +0 -261
- package/Icon/index.js +0 -62
- package/Image/index.js +0 -45
- package/ImagePreview/index.js +0 -217
- package/Info/index.js +0 -41
- package/InfoOutline-dd2e89d9.js +0 -29
- package/InteractiveWidget/index.js +0 -78
- package/KeyValue/index.js +0 -22
- package/Label/index.js +0 -48
- package/LinkButton/index.js +0 -34
- package/Loader/index.js +0 -23
- package/Menu/index.js +0 -281
- package/MobileNavigation/index.js +0 -94
- package/MobilePopup/index.js +0 -182
- package/Modal/index.js +0 -251
- package/ModuleTitle/index.js +0 -141
- package/NavigationMenu/index.js +0 -222
- package/Notification/index.js +0 -120
- package/Option/index.js +0 -184
- package/Overlay/index.js +0 -187
- package/Overspread/index.js +0 -291
- package/Pagination/index.js +0 -261
- package/Paper/index.js +0 -96
- package/Pill/index.js +0 -67
- package/Popover/index.js +0 -725
- package/PopoverV2/index.js +0 -19
- package/Portal/index.js +0 -58
- package/Products/index.js +0 -115
- package/Profile/index.js +0 -589
- package/Progress/index.js +0 -200
- package/QRCode/index.js +0 -814
- package/Radio/index.js +0 -151
- package/RadioGroup/index.js +0 -104
- package/Range/index.js +0 -191
- package/Rating/index.js +0 -174
- package/RichEditor/index.js +0 -13
- package/RichEditor-78c2617e.js +0 -228
- package/Scrollbar/index.js +0 -1585
- package/Search/index.js +0 -75
- package/SearchWithDropdown/index.js +0 -140
- package/Section/index.js +0 -61
- package/SkeletonLoader/index.js +0 -81
- package/Slider/index.js +0 -261
- package/Status/index.js +0 -97
- package/Steps/index.js +0 -314
- package/SuggestionList/index.js +0 -385
- package/Switcher/index.js +0 -193
- package/Table/index.js +0 -57
- package/TableCompositions/index.js +0 -16995
- package/Tabs/index.js +0 -235
- package/Tag/index.js +0 -102
- package/TextLink/index.js +0 -20
- package/Textarea/index.js +0 -242
- package/Time/index.js +0 -62
- package/TimePicker/index.js +0 -575
- package/Timeline/index.js +0 -113
- package/Title/index.js +0 -65
- package/Toaster/index.js +0 -116
- package/Tooltip/index.js +0 -6
- package/TransferList/index.js +0 -493
- package/Uploader/index.js +0 -992
- package/ValidatableCheckbox/index.js +0 -123
- package/ValidatableDatePicker/index.js +0 -316
- package/ValidatableDropdown/index.js +0 -141
- package/ValidatableElements/index.js +0 -67
- package/ValidatableMultiSelectDropdown/index.js +0 -152
- package/ValidatableNumberInput/index.js +0 -204
- package/ValidatableRadio/index.js +0 -116
- package/ValidatableSwitcher/index.js +0 -93
- package/ValidatableTextInput/index.js +0 -167
- package/ValidatableTimeInput/index.js +0 -174
- package/ValidatableUploader/index.js +0 -98
- package/Widget/index.js +0 -225
- package/_commonjsHelpers-24198af3.js +0 -35
- package/_rollupPluginBabelHelpers-a83240e1.js +0 -11
- package/callAfterDelay-7272faca.js +0 -12
- package/checkTimeValidation-e56771be.js +0 -16
- package/checkboxRadioSwitcher-5b69d7bd.js +0 -4
- package/clsx.m-2bb6df4b.js +0 -3
- package/config-1053d64d.js +0 -20
- package/configs-00612ce0.js +0 -103
- package/configs.js +0 -111
- package/dateValidation-67caec66.js +0 -225
- package/debounce-4419bc2f.js +0 -17
- package/guid-8ddf77b3.js +0 -16
- package/hooks/useBodyScroll.js +0 -16
- package/hooks/useClick.js +0 -18
- package/hooks/useClickOutside.js +0 -25
- package/hooks/useDebounce.js +0 -28
- package/hooks/useDeviceType.js +0 -17
- package/hooks/useDidMount.js +0 -15
- package/hooks/useForceUpdate.js +0 -8
- package/hooks/useHover.js +0 -20
- package/hooks/useImgDownload.js +0 -18
- package/hooks/useKeyDown.js +0 -21
- package/hooks/useMount.js +0 -13
- package/hooks/useMutationObserver.js +0 -21
- package/hooks/usePrevious.js +0 -10
- package/hooks/useThrottle.js +0 -16
- package/hooks/useToggle.js +0 -11
- package/hooks/useUpdatableRef.js +0 -14
- package/hooks/useUpdate.js +0 -10
- package/hooks/useWidth.js +0 -16
- package/hooks/useWindowSize.js +0 -40
- package/index-122432cd.js +0 -270
- package/index-262edd7a.js +0 -77
- package/index-2f5aa51e.js +0 -6483
- package/index-370f9acd.js +0 -4
- package/index-45eafea6.js +0 -90
- package/index-480fd7d9.js +0 -10032
- package/index-5f37f281.js +0 -168
- package/index-73aaa093.js +0 -1940
- package/index.mobile.d.ts +0 -14
- package/lib/atoms/Avatar/index.d.ts +0 -1
- package/lib/atoms/Badge/Badge.d.ts +0 -36
- package/lib/atoms/Badge/index.d.ts +0 -1
- package/lib/atoms/BusyLoader/BusyLoader.d.ts +0 -32
- package/lib/atoms/BusyLoader/BusyLoaderHolderHOC.d.ts +0 -8
- package/lib/atoms/BusyLoader/index.d.ts +0 -1
- package/lib/atoms/Button/Button.d.ts +0 -70
- package/lib/atoms/Button/index.d.ts +0 -1
- package/lib/atoms/Divider/index.d.ts +0 -1
- package/lib/atoms/Empty/Empty.d.ts +0 -39
- package/lib/atoms/Empty/index.d.ts +0 -1
- package/lib/atoms/Empty/utils.d.ts +0 -9
- package/lib/atoms/HelperText/index.d.ts +0 -1
- package/lib/atoms/Image/Image.d.ts +0 -51
- package/lib/atoms/Image/index.d.ts +0 -1
- package/lib/atoms/ImagePreview/ImagePreview.d.ts +0 -56
- package/lib/atoms/ImagePreview/ImagePreviewHOC.d.ts +0 -4
- package/lib/atoms/ImagePreview/Magnifier.d.ts +0 -40
- package/lib/atoms/ImagePreview/index.d.ts +0 -1
- package/lib/atoms/Info/index.d.ts +0 -1
- package/lib/atoms/KeyValue/KeyValue.d.ts +0 -29
- package/lib/atoms/KeyValue/index.d.ts +0 -1
- package/lib/atoms/Label/index.d.ts +0 -1
- package/lib/atoms/LinkButton/LinkButton.d.ts +0 -46
- package/lib/atoms/LinkButton/index.d.ts +0 -1
- package/lib/atoms/Loader/index.d.ts +0 -1
- package/lib/atoms/Pill/index.d.ts +0 -1
- package/lib/atoms/Rating/DefaultSvg.d.ts +0 -3
- package/lib/atoms/Rating/Rating.d.ts +0 -49
- package/lib/atoms/Rating/index.d.ts +0 -1
- package/lib/atoms/TextLink/index.d.ts +0 -1
- package/lib/molecules/Copy/Copy.d.ts +0 -38
- package/lib/molecules/Copy/index.d.ts +0 -1
- package/lib/molecules/InteractiveWidget/InteractiveWidget.d.ts +0 -70
- package/lib/molecules/InteractiveWidget/InteractiveWidgetIcon.d.ts +0 -8
- package/lib/molecules/InteractiveWidget/index.d.ts +0 -1
- package/lib/molecules/Tooltip/index.d.ts +0 -1
- package/lib/providers/GeneUIProvider/GeneUIProvider.d.ts +0 -30
- package/lib/providers/GeneUIProvider/index.d.ts +0 -1
- package/localization-4ba17032.js +0 -46
- package/objectWithoutPropertiesLoose-e1596bdb.js +0 -62
- package/rangeAndSlider-693a3d41.js +0 -8684
- package/react-beautiful-dnd.esm-b637016a.js +0 -10116
- package/react-lifecycles-compat.es-6e1f3768.js +0 -158
- package/redux-e591c1b8.js +0 -536
- package/tokens-8ab1179c.js +0 -6
- package/tslib.es6-f211516f.js +0 -35
- package/useEllipsisDetection-c1c9ad94.js +0 -38
package/Counter/index.js
DELETED
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
import React__default, { useRef, useState, useEffect, useMemo, useCallback } from 'react';
|
|
2
|
-
import { c as classnames } from '../index-031ff73c.js';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { n as noop, s as stopEvent } from '../index-5f37f281.js';
|
|
5
|
-
import useKeyDown from '../hooks/useKeyDown.js';
|
|
6
|
-
import '../configs-00612ce0.js';
|
|
7
|
-
import Button from '../Button/index.js';
|
|
8
|
-
import Label from '../Label/index.js';
|
|
9
|
-
import SkeletonLoader from '../SkeletonLoader/index.js';
|
|
10
|
-
import { T as Tooltip } from '../index-65217440.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 '../tslib.es6-f211516f.js';
|
|
17
|
-
import '../Icon/index.js';
|
|
18
|
-
import '../_rollupPluginBabelHelpers-a83240e1.js';
|
|
19
|
-
import '../InfoOutline-dd2e89d9.js';
|
|
20
|
-
import '../ArrowLeft-b88e2ba8.js';
|
|
21
|
-
import '../useEllipsisDetection-c1c9ad94.js';
|
|
22
|
-
import '../hooks/useDebounce.js';
|
|
23
|
-
import '../GeneUIProvider/index.js';
|
|
24
|
-
import '../hooks/useDeviceType.js';
|
|
25
|
-
import '../hooks/useWindowSize.js';
|
|
26
|
-
import '../SuggestionList/index.js';
|
|
27
|
-
import '../hooks/useClickOutside.js';
|
|
28
|
-
import '../config-1053d64d.js';
|
|
29
|
-
import '../Scrollbar/index.js';
|
|
30
|
-
import '../callAfterDelay-7272faca.js';
|
|
31
|
-
|
|
32
|
-
var css_248z = "[data-gene-ui-version=\"2.16.3\"] .counter{width:100%}[data-gene-ui-version=\"2.16.3\"] .counter.s-small{--height:2.4rem;--width:var(--height);min-width:8rem}[data-gene-ui-version=\"2.16.3\"] .counter.s-medium{--height:3.6rem;--width:var(--height);min-width:12rem}[data-gene-ui-version=\"2.16.3\"] .counter.s-big{--height:4.2rem;--width:var(--height);min-width:14rem}[data-gene-ui-version=\"2.16.3\"] .counter.r-round .react-loading-skeleton{border-radius:4.2rem}[data-gene-ui-version=\"2.16.3\"] .counter.r-smooth .react-loading-skeleton{border-radius:.4rem}[data-gene-ui-version=\"2.16.3\"] .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.16.3\"] .counter__wrapper{display:flex;gap:.4rem;height:var(--height)}[data-gene-ui-version=\"2.16.3\"] .counter__input{opacity:1!important}[data-gene-ui-version=\"2.16.3\"] .counter__input-holder{display:flex;min-width:var(---width);overflow:hidden;width:100%}[data-gene-ui-version=\"2.16.3\"] .counter__input-holder .react-loading-skeleton{height:var(--height)!important}[data-gene-ui-version=\"2.16.3\"] .counter__input .input-structure{padding:0}[data-gene-ui-version=\"2.16.3\"] .counter__input .input-element{justify-content:center;max-height:var(--height);min-height:var(--height);text-align:center}[data-gene-ui-version=\"2.16.3\"] .counter__input .input-element:disabled{color:rgba(var(--background-sc-rgb),.5)}[data-gene-ui-version=\"2.16.3\"] .counter__button{height:100%;min-height:100%;min-width:var(--width);width:var(--width)}[data-gene-ui-version=\"2.16.3\"] .counter__button .btn{max-height:100%;max-width:100%;min-height:100%;min-width:100%}[data-gene-ui-version=\"2.16.3\"] .counter__button .skeleton-holder .react-loading-skeleton{height:var(--height)!important;width:var(--width)}";
|
|
33
|
-
styleInject(css_248z);
|
|
34
|
-
|
|
35
|
-
const keyDownKeys = {
|
|
36
|
-
arrowUp: 'ArrowUp',
|
|
37
|
-
arrowDown: 'ArrowDown'
|
|
38
|
-
};
|
|
39
|
-
const inputRadiusMap = {
|
|
40
|
-
round: 'full-radius',
|
|
41
|
-
smooth: 'smooth-radius'
|
|
42
|
-
};
|
|
43
|
-
function Counter(_ref) {
|
|
44
|
-
let {
|
|
45
|
-
minusTooltipText,
|
|
46
|
-
plusTooltipText,
|
|
47
|
-
inputReadOnly,
|
|
48
|
-
defaultValue,
|
|
49
|
-
cornerRadius,
|
|
50
|
-
isLoading,
|
|
51
|
-
className,
|
|
52
|
-
minValue,
|
|
53
|
-
maxValue,
|
|
54
|
-
readOnly,
|
|
55
|
-
disabled,
|
|
56
|
-
onChange,
|
|
57
|
-
label,
|
|
58
|
-
value,
|
|
59
|
-
width,
|
|
60
|
-
size,
|
|
61
|
-
step
|
|
62
|
-
} = _ref;
|
|
63
|
-
const ref = useRef();
|
|
64
|
-
const inputRef = useRef();
|
|
65
|
-
const [showInputTooltip, setShowInputTooltip] = useState(false);
|
|
66
|
-
const [isTruncated, setIsTruncated] = useState(false);
|
|
67
|
-
const [data, setData] = useState(defaultValue || 0);
|
|
68
|
-
const [counterStep, setCounterStep] = useState(step);
|
|
69
|
-
useEffect(() => setCounterStep(step), [step]);
|
|
70
|
-
const isMinMaxWrong = useMemo(() => minValue >= maxValue, [minValue, maxValue]);
|
|
71
|
-
const isControlled = useMemo(() => value === 0 || !!value, [value]);
|
|
72
|
-
const modifiedSize = useMemo(() => typeof width === 'number' ? "".concat(width, "px") : width, [width]);
|
|
73
|
-
const isDisableMinus = useMemo(() => +data === minValue, [minValue, data]);
|
|
74
|
-
const isDisablePlus = useMemo(() => +data === maxValue, [maxValue, data]);
|
|
75
|
-
const isMinValue = useMemo(() => minValue !== undefined, [minValue]);
|
|
76
|
-
const isMaxValue = useMemo(() => maxValue !== undefined, [maxValue]);
|
|
77
|
-
useEffect(() => {
|
|
78
|
-
if (typeof defaultValue === 'number' && defaultValue <= maxValue && defaultValue >= minValue) {
|
|
79
|
-
return setData(defaultValue);
|
|
80
|
-
}
|
|
81
|
-
if (typeof minValue === 'number' && minValue > defaultValue) {
|
|
82
|
-
return setData(minValue);
|
|
83
|
-
}
|
|
84
|
-
}, [minValue, defaultValue, maxValue]);
|
|
85
|
-
useEffect(() => {
|
|
86
|
-
isControlled && setData(value);
|
|
87
|
-
}, [value]);
|
|
88
|
-
const setNewValue = useCallback(val => {
|
|
89
|
-
!isControlled && setData(eventState => (+eventState + +val).toString());
|
|
90
|
-
onChange((+data + +val).toString());
|
|
91
|
-
}, [isControlled, data]);
|
|
92
|
-
const setValueToMin = useCallback(() => {
|
|
93
|
-
!isControlled && setData(minValue === null || minValue === void 0 ? void 0 : minValue.toString());
|
|
94
|
-
onChange(minValue === null || minValue === void 0 ? void 0 : minValue.toString());
|
|
95
|
-
}, [isControlled, minValue]);
|
|
96
|
-
const setValueToMax = useCallback(() => {
|
|
97
|
-
!isControlled && setData(maxValue === null || maxValue === void 0 ? void 0 : maxValue.toString());
|
|
98
|
-
onChange(maxValue === null || maxValue === void 0 ? void 0 : maxValue.toString());
|
|
99
|
-
}, [isControlled, maxValue]);
|
|
100
|
-
const handleChange = useCallback(val => {
|
|
101
|
-
if (isMinValue && isMaxValue) {
|
|
102
|
-
if (+data <= maxValue && +data >= minValue && +val + +data <= maxValue && +val + +data >= minValue || val === '-') {
|
|
103
|
-
setNewValue(val);
|
|
104
|
-
} else if (+val + +data > maxValue) {
|
|
105
|
-
setValueToMax();
|
|
106
|
-
} else if (+val + +data < minValue) {
|
|
107
|
-
setValueToMin();
|
|
108
|
-
}
|
|
109
|
-
} else if (isMaxValue && +data <= maxValue || val === '-') {
|
|
110
|
-
if (+val + +data <= maxValue) {
|
|
111
|
-
setNewValue(val);
|
|
112
|
-
} else {
|
|
113
|
-
setValueToMax();
|
|
114
|
-
}
|
|
115
|
-
} else if (isMinValue && +data >= minValue || val === '-') {
|
|
116
|
-
if (+val + +data >= minValue) {
|
|
117
|
-
setNewValue(val);
|
|
118
|
-
} else {
|
|
119
|
-
setValueToMin();
|
|
120
|
-
}
|
|
121
|
-
} else {
|
|
122
|
-
setNewValue(val);
|
|
123
|
-
}
|
|
124
|
-
}, [data, isControlled]);
|
|
125
|
-
const setNewInputValue = useCallback(value => {
|
|
126
|
-
!isControlled && setData(value.trim());
|
|
127
|
-
!isNaN(+value) && onChange(value);
|
|
128
|
-
}, [isControlled]);
|
|
129
|
-
const handleInputChange = useCallback(_ref2 => {
|
|
130
|
-
let {
|
|
131
|
-
target: {
|
|
132
|
-
value
|
|
133
|
-
}
|
|
134
|
-
} = _ref2;
|
|
135
|
-
if (isMinValue && isMaxValue) {
|
|
136
|
-
if (+value <= maxValue && +value >= minValue || value === '-') {
|
|
137
|
-
setNewInputValue(value);
|
|
138
|
-
}
|
|
139
|
-
} else if (isMaxValue) {
|
|
140
|
-
if (+value <= maxValue) {
|
|
141
|
-
setNewInputValue(value);
|
|
142
|
-
} else if (value === '-') {
|
|
143
|
-
setNewInputValue(value);
|
|
144
|
-
}
|
|
145
|
-
} else if (isMinValue) {
|
|
146
|
-
if (+value >= minValue) {
|
|
147
|
-
setNewInputValue(value);
|
|
148
|
-
} else if (value === '-') {
|
|
149
|
-
setNewInputValue(value);
|
|
150
|
-
}
|
|
151
|
-
} else {
|
|
152
|
-
setNewInputValue(value);
|
|
153
|
-
}
|
|
154
|
-
}, [maxValue, minValue]);
|
|
155
|
-
useKeyDown(e => {
|
|
156
|
-
stopEvent(e, true);
|
|
157
|
-
if (e.key === keyDownKeys.arrowUp && !isDisablePlus) {
|
|
158
|
-
handleChange(counterStep);
|
|
159
|
-
}
|
|
160
|
-
if (e.key === keyDownKeys.arrowDown && !isDisableMinus) {
|
|
161
|
-
handleChange(-counterStep);
|
|
162
|
-
}
|
|
163
|
-
}, [handleChange], ref, [keyDownKeys.arrowUp, keyDownKeys.arrowDown]);
|
|
164
|
-
useEffect(() => {
|
|
165
|
-
var _inputRef$current, _inputRef$current2;
|
|
166
|
-
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)) {
|
|
167
|
-
!isTruncated && setIsTruncated(true);
|
|
168
|
-
} else {
|
|
169
|
-
isTruncated && setIsTruncated(false);
|
|
170
|
-
}
|
|
171
|
-
}, [data]);
|
|
172
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
173
|
-
ref: ref,
|
|
174
|
-
style: {
|
|
175
|
-
maxWidth: modifiedSize
|
|
176
|
-
},
|
|
177
|
-
onMouseOver: () => isTruncated && setShowInputTooltip(true),
|
|
178
|
-
onMouseLeave: () => isTruncated && setShowInputTooltip(false),
|
|
179
|
-
className: classnames('counter', className, "s-".concat(size), "r-".concat(cornerRadius))
|
|
180
|
-
}, label && /*#__PURE__*/React__default.createElement(Label, {
|
|
181
|
-
size: "medium",
|
|
182
|
-
labelText: label
|
|
183
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
184
|
-
className: "counter__wrapper"
|
|
185
|
-
}, !readOnly && /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
186
|
-
title: isDisableMinus && !isLoading ? minusTooltipText : ''
|
|
187
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
188
|
-
className: "counter__button counter__button-minus"
|
|
189
|
-
}, isLoading ? /*#__PURE__*/React__default.createElement(SkeletonLoader, {
|
|
190
|
-
isBusy: isLoading
|
|
191
|
-
}) : /*#__PURE__*/React__default.createElement(Button, {
|
|
192
|
-
icon: isLoading ? 'bc-icon-loader' : 'bc-icon-minus',
|
|
193
|
-
disabled: isMinMaxWrong || isDisableMinus || disabled,
|
|
194
|
-
cornerRadius: cornerRadius,
|
|
195
|
-
onClick: () => handleChange(-counterStep)
|
|
196
|
-
}))), /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
197
|
-
alwaysShow: showInputTooltip,
|
|
198
|
-
title: isTruncated ? data : ''
|
|
199
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
200
|
-
className: "counter__input-holder"
|
|
201
|
-
}, isLoading ? /*#__PURE__*/React__default.createElement(SkeletonLoader, {
|
|
202
|
-
isBusy: isLoading
|
|
203
|
-
}) : /*#__PURE__*/React__default.createElement(ExtendedInput, {
|
|
204
|
-
ref: inputRef,
|
|
205
|
-
className: "counter__input",
|
|
206
|
-
disabled: isMinMaxWrong || disabled || isLoading,
|
|
207
|
-
cornerRadius: inputRadiusMap[cornerRadius],
|
|
208
|
-
onChange: handleInputChange,
|
|
209
|
-
showNumberIcon: false,
|
|
210
|
-
readOnly: readOnly || inputReadOnly,
|
|
211
|
-
type: "number",
|
|
212
|
-
value: data
|
|
213
|
-
}))), !readOnly && /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
214
|
-
title: isDisablePlus && !isLoading ? plusTooltipText : ''
|
|
215
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
216
|
-
className: "counter__button counter__button-plus"
|
|
217
|
-
}, isLoading ? /*#__PURE__*/React__default.createElement(SkeletonLoader, {
|
|
218
|
-
isBusy: isLoading
|
|
219
|
-
}) : /*#__PURE__*/React__default.createElement(Button, {
|
|
220
|
-
icon: isLoading ? 'bc-icon-loader' : 'bc-icon-plus',
|
|
221
|
-
disabled: isMinMaxWrong || isDisablePlus || disabled,
|
|
222
|
-
cornerRadius: cornerRadius,
|
|
223
|
-
onClick: () => handleChange(counterStep)
|
|
224
|
-
})))));
|
|
225
|
-
}
|
|
226
|
-
const CounterConfig = {
|
|
227
|
-
size: ['small', 'medium', 'big'],
|
|
228
|
-
cornerRadius: ['round', 'smooth']
|
|
229
|
-
};
|
|
230
|
-
Counter.propTypes = {
|
|
231
|
-
/**
|
|
232
|
-
* Additional className
|
|
233
|
-
*/
|
|
234
|
-
className: PropTypes.string,
|
|
235
|
-
/**
|
|
236
|
-
* counter will become disabled when set to "true"
|
|
237
|
-
*/
|
|
238
|
-
disabled: PropTypes.bool,
|
|
239
|
-
/**
|
|
240
|
-
* counter input will become readonly when set to "true"
|
|
241
|
-
*/
|
|
242
|
-
inputReadOnly: PropTypes.bool,
|
|
243
|
-
/**
|
|
244
|
-
* Label for 'counter'.
|
|
245
|
-
*/
|
|
246
|
-
label: PropTypes.string,
|
|
247
|
-
/**
|
|
248
|
-
* onChange function which returns callBack if there is a change
|
|
249
|
-
*/
|
|
250
|
-
onChange: PropTypes.func,
|
|
251
|
-
/**
|
|
252
|
-
* Use this prop to control counter state. Note that when you specify this prop, the counter will not functionate itself
|
|
253
|
-
*/
|
|
254
|
-
value: PropTypes.number,
|
|
255
|
-
/**
|
|
256
|
-
* This prop will only applied once as defaultState for "value" when counter mounts.
|
|
257
|
-
* Note that specifying this prop is not mean controlling it.
|
|
258
|
-
*/
|
|
259
|
-
defaultValue: PropTypes.number,
|
|
260
|
-
/**
|
|
261
|
-
* Is loading state.
|
|
262
|
-
*/
|
|
263
|
-
isLoading: PropTypes.bool,
|
|
264
|
-
/**
|
|
265
|
-
* counter size, if the set value is number default use px
|
|
266
|
-
*/
|
|
267
|
-
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
268
|
-
/**
|
|
269
|
-
* counter size
|
|
270
|
-
*/
|
|
271
|
-
size: PropTypes.oneOf(CounterConfig.size),
|
|
272
|
-
/**
|
|
273
|
-
* counter corner radius
|
|
274
|
-
*/
|
|
275
|
-
cornerRadius: PropTypes.oneOf(CounterConfig.cornerRadius),
|
|
276
|
-
/**
|
|
277
|
-
* minus tooltip text
|
|
278
|
-
*/
|
|
279
|
-
minusTooltipText: PropTypes.string,
|
|
280
|
-
/**
|
|
281
|
-
* plus tooltip text
|
|
282
|
-
*/
|
|
283
|
-
plusTooltipText: PropTypes.string,
|
|
284
|
-
/**
|
|
285
|
-
* Counter minimum value
|
|
286
|
-
*/
|
|
287
|
-
minValue: PropTypes.number,
|
|
288
|
-
/**
|
|
289
|
-
* Counter maximum value
|
|
290
|
-
*/
|
|
291
|
-
maxValue: PropTypes.number,
|
|
292
|
-
/**
|
|
293
|
-
* Counter step value
|
|
294
|
-
*/
|
|
295
|
-
step: PropTypes.number
|
|
296
|
-
};
|
|
297
|
-
Counter.defaultProps = {
|
|
298
|
-
cornerRadius: CounterConfig.cornerRadius[0],
|
|
299
|
-
size: CounterConfig.size[1],
|
|
300
|
-
minusTooltipText: '',
|
|
301
|
-
inputReadOnly: false,
|
|
302
|
-
plusTooltipText: '',
|
|
303
|
-
isLoading: false,
|
|
304
|
-
disabled: false,
|
|
305
|
-
readOnly: false,
|
|
306
|
-
onChange: noop,
|
|
307
|
-
width: '100px',
|
|
308
|
-
label: '',
|
|
309
|
-
step: 1
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
export { Counter as default };
|
package/DateFilter/index.js
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { _ as _extends } from '../_rollupPluginBabelHelpers-a83240e1.js';
|
|
2
|
-
import React__default, { useState, useCallback } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { c as classnames } from '../index-031ff73c.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-5f37f281.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';
|
|
11
|
-
import 'react-dom';
|
|
12
|
-
import '../_commonjsHelpers-24198af3.js';
|
|
13
|
-
import '../tslib.es6-f211516f.js';
|
|
14
|
-
import '../Icon/index.js';
|
|
15
|
-
import '../configs-00612ce0.js';
|
|
16
|
-
import '../hooks/useClick.js';
|
|
17
|
-
import '../hooks/useKeyDown.js';
|
|
18
|
-
import '../hooks/useDeviceType.js';
|
|
19
|
-
import '../hooks/useWindowSize.js';
|
|
20
|
-
import '../hooks/useDebounce.js';
|
|
21
|
-
import '../index-73aaa093.js';
|
|
22
|
-
import '../index-122432cd.js';
|
|
23
|
-
import '../hooks/useClickOutside.js';
|
|
24
|
-
import '../Scrollbar/index.js';
|
|
25
|
-
import '../GeneUIProvider/index.js';
|
|
26
|
-
import '../debounce-4419bc2f.js';
|
|
27
|
-
import '../ExtendedInput/index.js';
|
|
28
|
-
import '../useEllipsisDetection-c1c9ad94.js';
|
|
29
|
-
import '../SuggestionList/index.js';
|
|
30
|
-
import '../config-1053d64d.js';
|
|
31
|
-
import '../callAfterDelay-7272faca.js';
|
|
32
|
-
import '../index-65217440.js';
|
|
33
|
-
import '../DatePicker/index.js';
|
|
34
|
-
import '../guid-8ddf77b3.js';
|
|
35
|
-
|
|
36
|
-
var css_248z = "[data-gene-ui-version=\"2.16.3\"] .date-filters-holder{align-items:center;display:flex;justify-content:flex-end;width:100%}[data-gene-ui-version=\"2.16.3\"] .date-filters-holder>:not(:last-child){flex-shrink:0}[data-gene-ui-version=\"2.16.3\"] .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.16.3\"] .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.16.3\"] .date-filter-input.active .icon{background:var(--hero);color:var(--hero-sc)}[data-gene-ui-version=\"2.16.3\"] .date-filter-input.active .input-element-back{background:#0000;border-color:var(--hero)}";
|
|
37
|
-
styleInject(css_248z);
|
|
38
|
-
|
|
39
|
-
function getFilterByKey(key, date) {
|
|
40
|
-
const [start, end] = date;
|
|
41
|
-
const startDate = start ? dayjsWithPlugins(start) : null;
|
|
42
|
-
const endDate = end ? dayjsWithPlugins(end) : null;
|
|
43
|
-
const today = dayjsWithPlugins();
|
|
44
|
-
const dayFromLastWeek = today.subtract(7, 'day');
|
|
45
|
-
const dayFromLastMonth = today.subtract(1, 'month');
|
|
46
|
-
if (key === 'today') return {
|
|
47
|
-
selected: startDate && isToday(startDate, endDate || startDate),
|
|
48
|
-
value: [today, today]
|
|
49
|
-
};
|
|
50
|
-
if (key === 'yesterday') return {
|
|
51
|
-
selected: startDate && isYesterday(startDate, endDate || startDate),
|
|
52
|
-
value: [today.subtract(1, 'day'), today.subtract(1, 'day')]
|
|
53
|
-
};
|
|
54
|
-
if (key === 'thisWeek') return {
|
|
55
|
-
selected: startDate && isThisWeek(startDate, endDate),
|
|
56
|
-
value: [today.startOf('week'), today.endOf('week')]
|
|
57
|
-
};
|
|
58
|
-
if (key === 'lastWeek') return {
|
|
59
|
-
selected: startDate && isLastWeek(startDate, endDate),
|
|
60
|
-
value: [dayFromLastWeek.startOf('week'), dayFromLastWeek.endOf('week')]
|
|
61
|
-
};
|
|
62
|
-
if (key === 'thisMonth') return {
|
|
63
|
-
selected: startDate && isThisMonth(startDate, endDate),
|
|
64
|
-
value: [today.startOf('month'), today.endOf('month')]
|
|
65
|
-
};
|
|
66
|
-
if (key === 'lastMonth') return {
|
|
67
|
-
selected: startDate && isLastMonth(startDate, endDate),
|
|
68
|
-
value: [dayFromLastMonth.startOf('month'), dayFromLastMonth.endOf('month')]
|
|
69
|
-
};
|
|
70
|
-
if (key === 'LMTD') return {
|
|
71
|
-
selected: startDate && isLastMonthToDate(startDate, endDate),
|
|
72
|
-
value: [dayFromLastMonth.startOf('month'), getLMTD(today, dayFromLastMonth)]
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
const getRightDate = (date, isControlled) => isControlled && date ? dayjsWithPlugins(date).toDate() : null;
|
|
76
|
-
function DateFilter(props) {
|
|
77
|
-
const {
|
|
78
|
-
value,
|
|
79
|
-
onChange,
|
|
80
|
-
format,
|
|
81
|
-
filters,
|
|
82
|
-
className,
|
|
83
|
-
buttonProps,
|
|
84
|
-
pickerProps,
|
|
85
|
-
...restProps
|
|
86
|
-
} = props;
|
|
87
|
-
const isControlled = ('value' in props);
|
|
88
|
-
const [localValue, setLocalValue] = useState(() => {
|
|
89
|
-
const [start, end] = value;
|
|
90
|
-
const startDate = getRightDate(start, isControlled);
|
|
91
|
-
const endDate = getRightDate(end, isControlled);
|
|
92
|
-
return [startDate, endDate];
|
|
93
|
-
});
|
|
94
|
-
const handleChange = useCallback(dates => {
|
|
95
|
-
setLocalValue(dates);
|
|
96
|
-
onChange(dates);
|
|
97
|
-
}, [onChange]);
|
|
98
|
-
const handleButtonClick = useCallback(_ref => {
|
|
99
|
-
let [start, end] = _ref;
|
|
100
|
-
const dateObj = [start.toDate(), end.toDate()];
|
|
101
|
-
setLocalValue(dateObj);
|
|
102
|
-
onChange(dateObj);
|
|
103
|
-
}, [onChange]);
|
|
104
|
-
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
105
|
-
className: classnames('date-filters-holder', className)
|
|
106
|
-
}, restProps), Object.keys(filters).map(key => {
|
|
107
|
-
const label = filters[key];
|
|
108
|
-
const filter = getFilterByKey(key, localValue);
|
|
109
|
-
return filter ? /*#__PURE__*/React__default.createElement(Button, _extends({
|
|
110
|
-
key: key,
|
|
111
|
-
onClick: () => handleButtonClick(filter.value),
|
|
112
|
-
color: "default",
|
|
113
|
-
active: filter.selected,
|
|
114
|
-
appearance: "minimal"
|
|
115
|
-
}, buttonProps), label) : null;
|
|
116
|
-
}), /*#__PURE__*/React__default.createElement(DatePickerInput.WithRange, _extends({
|
|
117
|
-
value: localValue,
|
|
118
|
-
format: format,
|
|
119
|
-
onChange: handleChange,
|
|
120
|
-
appearance: "minimal",
|
|
121
|
-
flexibility: "content-size",
|
|
122
|
-
className: "date-filter-input active"
|
|
123
|
-
}, pickerProps)));
|
|
124
|
-
}
|
|
125
|
-
DateFilter.propTypes = {
|
|
126
|
-
/**
|
|
127
|
-
* Specify the format of date
|
|
128
|
-
*/
|
|
129
|
-
format: PropTypes.string,
|
|
130
|
-
/**
|
|
131
|
-
* Fires when user attempts to change value
|
|
132
|
-
* (dates: Array) => void
|
|
133
|
-
*/
|
|
134
|
-
onChange: PropTypes.func,
|
|
135
|
-
/**
|
|
136
|
-
* Controls which filter buttons will be displayed based on filters object existing keys.
|
|
137
|
-
* For example if you define only `today` property on filters objects
|
|
138
|
-
* It will be display button with [today]'s property value
|
|
139
|
-
* Which will change Datefilter value to today.
|
|
140
|
-
* All filters will be displayed by default.
|
|
141
|
-
*/
|
|
142
|
-
filters: PropTypes.exact({
|
|
143
|
-
today: PropTypes.string,
|
|
144
|
-
yesterday: PropTypes.string,
|
|
145
|
-
thisWeek: PropTypes.string,
|
|
146
|
-
lastWeek: PropTypes.string,
|
|
147
|
-
thisMonth: PropTypes.string,
|
|
148
|
-
lastMonth: PropTypes.string,
|
|
149
|
-
LMTD: PropTypes.string
|
|
150
|
-
}),
|
|
151
|
-
/**
|
|
152
|
-
* Current value. Creates a controlled component.
|
|
153
|
-
*/
|
|
154
|
-
value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.instanceOf(dayjsWithPlugins)), PropTypes.arrayOf(PropTypes.instanceOf(Date)), PropTypes.arrayOf(PropTypes.string), PropTypes.arrayOf(PropTypes.number)]),
|
|
155
|
-
/**
|
|
156
|
-
* Additional classname which applies to datefilter holder div element
|
|
157
|
-
*/
|
|
158
|
-
className: PropTypes.string,
|
|
159
|
-
/**
|
|
160
|
-
* Accepts same props as button component (atoms)
|
|
161
|
-
*/
|
|
162
|
-
buttonProps: PropTypes.object,
|
|
163
|
-
/**
|
|
164
|
-
* This props will pass to picker, check DatePicker prop types
|
|
165
|
-
*/
|
|
166
|
-
pickerProps: PropTypes.object
|
|
167
|
-
};
|
|
168
|
-
DateFilter.defaultProps = {
|
|
169
|
-
value: [],
|
|
170
|
-
format: getBrowserDateFormat(),
|
|
171
|
-
onChange: noop,
|
|
172
|
-
filters: {
|
|
173
|
-
today: 'Today',
|
|
174
|
-
yesterday: 'Yesterday',
|
|
175
|
-
thisWeek: 'This Week',
|
|
176
|
-
lastWeek: 'Last Week',
|
|
177
|
-
thisMonth: 'This Month',
|
|
178
|
-
lastMonth: 'Last Month',
|
|
179
|
-
LMTD: 'LMTD'
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
export { DateFilter as default };
|