@majoo-ui/react 2.4.3 → 2.4.4
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/components/alertDialog/AlertDialog.esm.js +11 -1
- package/components/barChart/BarChart.esm.js +1 -1
- package/components/buttonGroup/ButtonGroup.esm.js +1 -0
- package/components/chart/lineChart/LineChart.esm.js +7 -10
- package/components/checkboxTable/CheckboxTable.esm.js +38 -38
- package/components/colorPicker/InputColorPicker.esm.js +5 -2
- package/components/datePicker/CustomDatePicker.esm.js +12 -3
- package/components/datePicker/InputDatePicker.esm.js +15 -6
- package/components/datePicker/InputDateRangePicker.esm.js +1 -1
- package/components/datePicker/timePicker/InputTimePicker.esm.js +6 -7
- package/components/datePicker/timePicker/TimePicker.esm.js +32 -38
- package/components/devicePreview/DevicePreview.esm.js +3 -3
- package/components/drawer/Drawer.esm.js +42 -6
- package/components/editableTable/EditableTable.esm.js +22 -5
- package/components/form/components/FormHelper/Helper.esm.js +1 -1
- package/components/form/components/InputCheckbox/CheckboxGroup.esm.js +6 -10
- package/components/form/components/InputCombobox/InputCombobox.esm.js +6 -3
- package/components/form/components/InputCreatable/InputCreatable.esm.js +5 -6
- package/components/form/components/InputGroup/InputGroup.esm.js +8 -9
- package/components/form/components/InputNumber/InputNumber.esm.js +1 -1
- package/components/form/components/InputRadio/InputRadio.esm.js +5 -2
- package/components/form/components/InputRadio/InputRadioGroup.esm.js +12 -5
- package/components/form/components/InputResourceList/InputResourceList.esm.js +13 -7
- package/components/form/components/InputSearchbox/InputSearchbox.esm.js +9 -3
- package/components/form/components/InputSelect/InputSelect.esm.js +1 -1
- package/components/form/components/InputSelectCheck/InputSelectCheck.esm.js +5 -2
- package/components/form/components/InputSwitch/InputSwitch.esm.js +9 -8
- package/components/form/components/InputSwitch/InputSwitchWithImage.esm.js +9 -8
- package/components/form/components/InputTags/InputTags.esm.js +12 -11
- package/components/loadingBar/LoadingBar.esm.js +14 -8
- package/components/mapPicker/InputMapPicker.esm.js +0 -1
- package/components/modalDialog/ModalDialog.esm.js +14 -6
- package/components/notificationBadge/NotificationBadge.esm.js +12 -7
- package/components/pageDialog/PageDialog.esm.js +13 -7
- package/components/pagination/PaginationButton.esm.js +1 -0
- package/components/pieChart/PieChart.esm.js +1 -1
- package/components/popover/Popover.esm.js +3 -2
- package/components/progressIndicator/ProgressIndicator.esm.js +1 -1
- package/components/stepWizard/StepWizard.esm.js +4 -4
- package/components/table/MobileTable.esm.js +4 -2
- package/components/tabs/Tabs.esm.js +1 -1
- package/components/tooltip/Tooltip.esm.js +9 -4
- package/components/upload/Upload.esm.js +34 -18
- package/index.esm.css +4 -4
- package/index.esm.js +2 -2
- package/layout/grid/Grid.esm.js +32 -13
- package/layout/pageContainer/PageContainer.esm.js +1 -0
- package/package.json +2 -2
- package/src/components/editableTable/EditableTable.d.ts +3 -1
|
@@ -3,6 +3,7 @@ import 'core-js/modules/es.iterator.constructor.js';
|
|
|
3
3
|
import 'core-js/modules/es.iterator.filter.js';
|
|
4
4
|
import 'core-js/modules/es.iterator.map.js';
|
|
5
5
|
import 'core-js/modules/es.json.stringify.js';
|
|
6
|
+
import { __rest } from 'tslib';
|
|
6
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
8
|
import { RemoveOutline } from '@majoo-ui/icons';
|
|
8
9
|
import React__default, { useState, useRef, useCallback, useEffect, memo } from 'react';
|
|
@@ -86,6 +87,16 @@ const TableCell = styled('td', {
|
|
|
86
87
|
height: '80px'
|
|
87
88
|
},
|
|
88
89
|
variants: {
|
|
90
|
+
subCell: {
|
|
91
|
+
true: {
|
|
92
|
+
height: 'unset'
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
headerSubCell: {
|
|
96
|
+
true: {
|
|
97
|
+
fontWeight: 600
|
|
98
|
+
}
|
|
99
|
+
},
|
|
89
100
|
verticalAlign: {
|
|
90
101
|
top: {
|
|
91
102
|
verticalAlign: 'top'
|
|
@@ -264,16 +275,22 @@ function Product({
|
|
|
264
275
|
})
|
|
265
276
|
});
|
|
266
277
|
}
|
|
267
|
-
|
|
278
|
+
const Switch = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
279
|
+
const {
|
|
280
|
+
position,
|
|
281
|
+
css
|
|
282
|
+
} = props,
|
|
283
|
+
switchProps = __rest(props, ["position", "css"]);
|
|
268
284
|
return jsx(ContainerSwitch, {
|
|
269
|
-
position:
|
|
270
|
-
css:
|
|
285
|
+
position: position,
|
|
286
|
+
css: css,
|
|
271
287
|
children: jsx(InputSwitch, Object.assign({
|
|
288
|
+
ref: ref,
|
|
272
289
|
dataOnLabel: "ON",
|
|
273
290
|
dataOffLabel: "OFF"
|
|
274
|
-
},
|
|
291
|
+
}, switchProps))
|
|
275
292
|
});
|
|
276
|
-
}
|
|
293
|
+
});
|
|
277
294
|
function Remove(props) {
|
|
278
295
|
const [isHover, setIsHover] = useState(false);
|
|
279
296
|
function onEnter() {
|
|
@@ -16,22 +16,18 @@ const CheckboxGroup = ({
|
|
|
16
16
|
const [selectedItems, setSelectedItems] = useState(defaultValue);
|
|
17
17
|
const checkItem = (item, index) => {
|
|
18
18
|
if (!value) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return items;
|
|
23
|
-
});
|
|
19
|
+
const items = [...selectedItems, item];
|
|
20
|
+
setSelectedItems(items);
|
|
21
|
+
if (onChange) onChange(items);
|
|
24
22
|
} else {
|
|
25
23
|
if (onChange) onChange([...value, item], index);
|
|
26
24
|
}
|
|
27
25
|
};
|
|
28
26
|
const uncheckItem = (item, index) => {
|
|
29
27
|
if (!value) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return items;
|
|
34
|
-
});
|
|
28
|
+
const items = selectedItems.filter(currItem => currItem !== item);
|
|
29
|
+
setSelectedItems(items);
|
|
30
|
+
if (onChange) onChange(items);
|
|
35
31
|
} else {
|
|
36
32
|
if (onChange) onChange(value.filter(currItem => currItem !== item), index);
|
|
37
33
|
}
|
|
@@ -8,7 +8,6 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
8
8
|
import { useCombobox } from 'downshift';
|
|
9
9
|
import { SelectContainer, SelectBox, OptionWrapper, SelectOption, SelectItem, Input } from '../InputSelect/InputSelect.esm.js';
|
|
10
10
|
import 'core-js/modules/es.iterator.reduce.js';
|
|
11
|
-
import 'react-i18next';
|
|
12
11
|
import 'core-js/modules/es.array.includes.js';
|
|
13
12
|
import { Portal } from '@majoo-ui/helpers';
|
|
14
13
|
import { InputGroup } from '../InputGroup/InputGroup.esm.js';
|
|
@@ -124,7 +123,9 @@ const InputCombobox = /*#__PURE__*/React.forwardRef((_a, forwardedRef) => {
|
|
|
124
123
|
css: css,
|
|
125
124
|
ref: selectBoxRef,
|
|
126
125
|
children: [jsx(PopoverTrigger, {
|
|
127
|
-
children: jsx(SelectBox, Object.assign({}, getComboboxProps(
|
|
126
|
+
children: jsx(SelectBox, Object.assign({}, getComboboxProps({}, {
|
|
127
|
+
suppressRefError: true
|
|
128
|
+
}), {
|
|
128
129
|
size: size,
|
|
129
130
|
disabled: disabled,
|
|
130
131
|
isInvalid: isInvalid,
|
|
@@ -144,7 +145,9 @@ const InputCombobox = /*#__PURE__*/React.forwardRef((_a, forwardedRef) => {
|
|
|
144
145
|
style: {
|
|
145
146
|
width: optionsWidth
|
|
146
147
|
},
|
|
147
|
-
children: inputItems.length > 0 && jsx(OptionWrapper, Object.assign({}, getMenuProps(
|
|
148
|
+
children: inputItems.length > 0 && jsx(OptionWrapper, Object.assign({}, getMenuProps({}, {
|
|
149
|
+
suppressRefError: true
|
|
150
|
+
}), {
|
|
148
151
|
css: {
|
|
149
152
|
display: isOpen ? 'block' : 'none',
|
|
150
153
|
pointerEvents: 'auto'
|
|
@@ -143,7 +143,7 @@ const Item = styled('div', {
|
|
|
143
143
|
cursor: 'pointer',
|
|
144
144
|
lineHeight: '20px'
|
|
145
145
|
});
|
|
146
|
-
function InputCreatable({
|
|
146
|
+
const InputCreatable = /*#__PURE__*/React__default.forwardRef(function InputCreatable({
|
|
147
147
|
size,
|
|
148
148
|
isInvalid,
|
|
149
149
|
placeholder,
|
|
@@ -154,16 +154,13 @@ function InputCreatable({
|
|
|
154
154
|
maxChar,
|
|
155
155
|
onClickItem,
|
|
156
156
|
localeText
|
|
157
|
-
}) {
|
|
157
|
+
}, ref) {
|
|
158
158
|
const text = useInputCreatableLocaleText(localeText);
|
|
159
159
|
const [inputValue, setInputValue] = React__default.useState(value || '');
|
|
160
160
|
const [isOpen, setOpen] = React__default.useState(false);
|
|
161
161
|
React__default.useEffect(() => {
|
|
162
162
|
setInputValue(value);
|
|
163
163
|
}, [value]);
|
|
164
|
-
React__default.useEffect(() => {
|
|
165
|
-
onChange && onChange(inputValue);
|
|
166
|
-
}, [inputValue]);
|
|
167
164
|
const handleInputValue = value => {
|
|
168
165
|
if (value === '') {
|
|
169
166
|
setInputValue('');
|
|
@@ -172,6 +169,7 @@ function InputCreatable({
|
|
|
172
169
|
setOpen(true);
|
|
173
170
|
setInputValue(value);
|
|
174
171
|
}
|
|
172
|
+
onChange?.(value);
|
|
175
173
|
};
|
|
176
174
|
return /*#__PURE__*/jsxs(Wrapper, {
|
|
177
175
|
children: [/*#__PURE__*/jsx(InputWrapper, {
|
|
@@ -179,6 +177,7 @@ function InputCreatable({
|
|
|
179
177
|
isInvalid: isInvalid,
|
|
180
178
|
disabled: disabled || readOnly,
|
|
181
179
|
children: /*#__PURE__*/jsx(Input, {
|
|
180
|
+
ref: ref,
|
|
182
181
|
type: "text",
|
|
183
182
|
placeholder: placeholder,
|
|
184
183
|
disabled: disabled,
|
|
@@ -206,7 +205,7 @@ function InputCreatable({
|
|
|
206
205
|
})
|
|
207
206
|
})]
|
|
208
207
|
});
|
|
209
|
-
}
|
|
208
|
+
});
|
|
210
209
|
InputCreatable.propTypes = {
|
|
211
210
|
placeholder: PropTypes.string,
|
|
212
211
|
size: PropTypes.string,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import 'core-js/modules/es.iterator.constructor.js';
|
|
2
2
|
import 'core-js/modules/es.iterator.map.js';
|
|
3
3
|
import 'core-js/modules/es.iterator.some.js';
|
|
4
|
+
import 'core-js/modules/es.iterator.to-array.js';
|
|
4
5
|
import React__default from 'react';
|
|
5
6
|
import { styled } from '../../../../config/stitches.config.esm.js';
|
|
6
7
|
import PropTypes from 'prop-types';
|
|
@@ -144,20 +145,18 @@ const InputGroup = ({
|
|
|
144
145
|
size = 'lg',
|
|
145
146
|
...rest
|
|
146
147
|
}) => {
|
|
147
|
-
const
|
|
148
|
-
const
|
|
149
|
-
const
|
|
148
|
+
const childArray = React__default.Children.toArray(children);
|
|
149
|
+
const isLetter = childArray.some(child => child && (child.type.name === 'InputPrefix' || child.type.name === 'InputSuffix' || child.type.name === 'InputLeftElement' || child.type.name === 'InputRightElement'));
|
|
150
|
+
const isElement = childArray.some(child => child && (child.type.name === 'InputLeftElement' || child.type.name === 'InputRightElement'));
|
|
151
|
+
const clone = childArray.map(child => {
|
|
150
152
|
if (child === null) return null;
|
|
151
153
|
return isLetter ? child.type.name === 'InputText' ? /*#__PURE__*/React__default.cloneElement(child, {
|
|
152
154
|
inputGroup: true,
|
|
153
|
-
size: size
|
|
154
|
-
key: index
|
|
155
|
+
size: size
|
|
155
156
|
}) : /*#__PURE__*/React__default.cloneElement(child, {
|
|
156
|
-
size: size
|
|
157
|
-
key: index
|
|
157
|
+
size: size
|
|
158
158
|
}) : /*#__PURE__*/React__default.cloneElement(child, {
|
|
159
|
-
size: size
|
|
160
|
-
key: index
|
|
159
|
+
size: size
|
|
161
160
|
});
|
|
162
161
|
});
|
|
163
162
|
return /*#__PURE__*/jsx(InputGroupStyle, {
|
|
@@ -231,7 +231,7 @@ const InputNumber = /*#__PURE__*/React__default.forwardRef(({
|
|
|
231
231
|
}));
|
|
232
232
|
InputNumber.propTypes = {
|
|
233
233
|
placeholder: PropTypes.string,
|
|
234
|
-
value: PropTypes.string,
|
|
234
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
235
235
|
size: PropTypes.oneOf(['sm', 'lg']),
|
|
236
236
|
isInvalid: PropTypes.bool,
|
|
237
237
|
readOnly: PropTypes.bool,
|
|
@@ -95,7 +95,9 @@ const StyledRadio = styled(RadioGroupPrimitive.Item, RADIO_BASE_STYLES, {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
|
-
const Container = styled(
|
|
98
|
+
const Container = styled('div', {
|
|
99
|
+
display: 'flex',
|
|
100
|
+
flexDirection: 'column',
|
|
99
101
|
variants: {
|
|
100
102
|
outlined: {
|
|
101
103
|
true: {
|
|
@@ -172,6 +174,8 @@ const InputRadio = ({
|
|
|
172
174
|
inputProps,
|
|
173
175
|
description,
|
|
174
176
|
readOnly,
|
|
177
|
+
outlined: _outlined,
|
|
178
|
+
block: _block,
|
|
175
179
|
...props
|
|
176
180
|
}) => {
|
|
177
181
|
function renderInputType(type, checkedValue, onValueChange) {
|
|
@@ -226,7 +230,6 @@ const InputRadio = ({
|
|
|
226
230
|
htmlFor: id,
|
|
227
231
|
outlined: outlined,
|
|
228
232
|
children: /*#__PURE__*/jsxs(Container, {
|
|
229
|
-
direction: "column",
|
|
230
233
|
outlined: outlined,
|
|
231
234
|
disabledOutlined: outlined && (readOnly || disabled),
|
|
232
235
|
disabled: disabled,
|
|
@@ -9,12 +9,19 @@ import { InputRadioContext } from './context.esm.js';
|
|
|
9
9
|
import { jsx } from 'react/jsx-runtime';
|
|
10
10
|
|
|
11
11
|
const RadioGroup = styled(RadioGroupPrimitive.Root, Flex);
|
|
12
|
-
function InputRadioGroup(props) {
|
|
13
|
-
|
|
12
|
+
const InputRadioGroup = /*#__PURE__*/React__default.forwardRef(function InputRadioGroup(props, ref) {
|
|
13
|
+
const {
|
|
14
|
+
children,
|
|
15
|
+
outlined: _outlined,
|
|
16
|
+
block: _block,
|
|
17
|
+
...groupProps
|
|
18
|
+
} = props;
|
|
19
|
+
return children && /*#__PURE__*/jsx(InputRadioContext.Provider, {
|
|
14
20
|
value: props,
|
|
15
21
|
children: /*#__PURE__*/jsx(RadioGroup, {
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
ref: ref,
|
|
23
|
+
...groupProps,
|
|
24
|
+
children: React__default.Children.map(children, child => /*#__PURE__*/React__default.cloneElement(child, {
|
|
18
25
|
style: {
|
|
19
26
|
...child.props.style,
|
|
20
27
|
opacity: 1
|
|
@@ -22,7 +29,7 @@ function InputRadioGroup(props) {
|
|
|
22
29
|
}))
|
|
23
30
|
})
|
|
24
31
|
});
|
|
25
|
-
}
|
|
32
|
+
});
|
|
26
33
|
InputRadioGroup.propTypes = {
|
|
27
34
|
defaultValue: PropTypes.string,
|
|
28
35
|
value: PropTypes.string,
|
|
@@ -12,7 +12,7 @@ import 'core-js/modules/es.set.is-superset-of.v2.js';
|
|
|
12
12
|
import 'core-js/modules/es.set.symmetric-difference.v2.js';
|
|
13
13
|
import 'core-js/modules/es.set.union.v2.js';
|
|
14
14
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
15
|
-
import { useState,
|
|
15
|
+
import { useState, useRef, useMemo, useEffect } from 'react';
|
|
16
16
|
import Box from '../../../../layout/box/Box.esm.js';
|
|
17
17
|
import Flex from '../../../../layout/flex/Flex.esm.js';
|
|
18
18
|
import Text from '../../../text/Text.esm.js';
|
|
@@ -88,6 +88,15 @@ function InputResourceList({
|
|
|
88
88
|
const [sortType, setSortType] = useState('asc');
|
|
89
89
|
const [data, setData] = useState([]);
|
|
90
90
|
const [expand, setExpand] = useState(false);
|
|
91
|
+
// read the latest onQueryChange through a ref so a new callback identity doesn't drop a pending call
|
|
92
|
+
const onQueryChangeRef = useRef(onQueryChange);
|
|
93
|
+
onQueryChangeRef.current = onQueryChange;
|
|
94
|
+
const handleQueryChange = useMemo(() => debounce(nextQuery => {
|
|
95
|
+
var _a;
|
|
96
|
+
setQuery(nextQuery);
|
|
97
|
+
(_a = onQueryChangeRef.current) === null || _a === void 0 ? void 0 : _a.call(onQueryChangeRef, nextQuery);
|
|
98
|
+
}, 1000), []);
|
|
99
|
+
useEffect(() => () => handleQueryChange.cancel(), [handleQueryChange]);
|
|
91
100
|
const isValueString = typeof (value === null || value === void 0 ? void 0 : value[0]) === 'string';
|
|
92
101
|
const checkedItems = useMemo(() => {
|
|
93
102
|
if (!value) return [];
|
|
@@ -191,7 +200,7 @@ function InputResourceList({
|
|
|
191
200
|
color: "secondary",
|
|
192
201
|
children: resource === null || resource === void 0 ? void 0 : resource.description
|
|
193
202
|
})]
|
|
194
|
-
}
|
|
203
|
+
}), !!resource.subLabel && jsx(Paragraph, {
|
|
195
204
|
color: isDisabled ? 'disable' : 'primary',
|
|
196
205
|
css: {
|
|
197
206
|
overflowX: 'hidden',
|
|
@@ -206,7 +215,7 @@ function InputResourceList({
|
|
|
206
215
|
paragraph: "longContentRegular",
|
|
207
216
|
children: resource.subLabel
|
|
208
217
|
})]
|
|
209
|
-
});
|
|
218
|
+
}, resource.value);
|
|
210
219
|
};
|
|
211
220
|
function sorting(data, type) {
|
|
212
221
|
function ascending(a, b) {
|
|
@@ -273,10 +282,7 @@ function InputResourceList({
|
|
|
273
282
|
children: [customHeader, (searchable || !!onQueryChange) && jsx(InputSearchbox, Object.assign({
|
|
274
283
|
size: "lg",
|
|
275
284
|
placeholder: searchPlaceholder || text.searchPlaceholder,
|
|
276
|
-
onChange:
|
|
277
|
-
setQuery(query);
|
|
278
|
-
if (onQueryChange) onQueryChange(query);
|
|
279
|
-
}, 1000),
|
|
285
|
+
onChange: handleQueryChange,
|
|
280
286
|
disabled: disabled
|
|
281
287
|
}, {})), defaultSort && jsxs(Flex, {
|
|
282
288
|
align: "center",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState, useCallback } from 'react';
|
|
1
|
+
import { useState, useRef, useMemo, useEffect, useCallback } from 'react';
|
|
2
2
|
import { InputGroup } from '../InputGroup/InputGroup.esm.js';
|
|
3
3
|
import { InputText } from '../InputText/InputText.esm.js';
|
|
4
4
|
import { InputLeftElement, InputRightElement } from '../InputElement/InputElement.esm.js';
|
|
@@ -28,7 +28,12 @@ const InputSearchbox = ({
|
|
|
28
28
|
const text = useInputSearchboxLocaleText(localeText);
|
|
29
29
|
const [value, setValue] = useState(defaultValue);
|
|
30
30
|
const inputValue = props?.value ?? value;
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
// read the latest onChange through a ref so a new callback identity doesn't drop a pending call
|
|
33
|
+
const onChangeRef = useRef(onChange);
|
|
34
|
+
onChangeRef.current = onChange;
|
|
35
|
+
const debounceChange = useMemo(() => debounce(e => onChangeRef.current?.(e), 1000), []);
|
|
36
|
+
useEffect(() => () => debounceChange.cancel(), [debounceChange]);
|
|
32
37
|
const handleChange = useCallback(e => {
|
|
33
38
|
setValue(e.target.value);
|
|
34
39
|
if (withDebounce) {
|
|
@@ -41,6 +46,7 @@ const InputSearchbox = ({
|
|
|
41
46
|
e.preventDefault();
|
|
42
47
|
if (!disabled) {
|
|
43
48
|
setValue('');
|
|
49
|
+
debounceChange.cancel();
|
|
44
50
|
if (onChange) onChange('');
|
|
45
51
|
}
|
|
46
52
|
};
|
|
@@ -55,7 +61,7 @@ const InputSearchbox = ({
|
|
|
55
61
|
}), /*#__PURE__*/jsx(InputText, {
|
|
56
62
|
placeholder: text.placeholder,
|
|
57
63
|
onChange: handleChange,
|
|
58
|
-
value:
|
|
64
|
+
value: inputValue ?? '',
|
|
59
65
|
disabled: disabled,
|
|
60
66
|
css: {
|
|
61
67
|
height: 'fit-content'
|
|
@@ -565,6 +565,7 @@ const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
565
565
|
handleInputValue(String(state.inputValue ? state.inputValue : '').toLowerCase());
|
|
566
566
|
}
|
|
567
567
|
if (!('isOpen' in state)) return;
|
|
568
|
+
setOpen(Boolean(state.isOpen));
|
|
568
569
|
if (state.isOpen && embedSearch) handleInputValue('', true);
|
|
569
570
|
if (!state.isOpen && fetchData && query && query.length > 0 && onSearch) {
|
|
570
571
|
onSearch('');
|
|
@@ -598,7 +599,6 @@ const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
598
599
|
})
|
|
599
600
|
}));
|
|
600
601
|
};
|
|
601
|
-
setOpen(isOpen);
|
|
602
602
|
return !isMobile ? jsx(Popover, {
|
|
603
603
|
open: openOptions,
|
|
604
604
|
onOpenChange: setOpenOptions,
|
|
@@ -381,6 +381,9 @@ const InputSelectCheck = /*#__PURE__*/forwardRef(({
|
|
|
381
381
|
onChange?.(values);
|
|
382
382
|
}
|
|
383
383
|
}, [onChange, totalItemCount]);
|
|
384
|
+
React__default.useEffect(() => () => {
|
|
385
|
+
if (onChangeTimeoutRef.current) clearTimeout(onChangeTimeoutRef.current);
|
|
386
|
+
}, []);
|
|
384
387
|
|
|
385
388
|
// Determine if virtualization should be enabled
|
|
386
389
|
const shouldVirtualize = virtualized && totalItemCount >= virtualizedThreshold;
|
|
@@ -1014,7 +1017,7 @@ const InputSelectCheck = /*#__PURE__*/forwardRef(({
|
|
|
1014
1017
|
})]
|
|
1015
1018
|
}, item.id),
|
|
1016
1019
|
children: item?.children?.map((optItem, optIndex) => renderOptionItem(optItem, groupIndex + optIndex + 1, true))
|
|
1017
|
-
});
|
|
1020
|
+
}, item.id);
|
|
1018
1021
|
};
|
|
1019
1022
|
return /*#__PURE__*/jsxs(Wrapper, {
|
|
1020
1023
|
css: css,
|
|
@@ -1072,7 +1075,7 @@ const InputSelectCheck = /*#__PURE__*/forwardRef(({
|
|
|
1072
1075
|
})
|
|
1073
1076
|
})]
|
|
1074
1077
|
}), helperText && /*#__PURE__*/jsx(Paragraph, {
|
|
1075
|
-
|
|
1078
|
+
paragraph: "shortContentRegular",
|
|
1076
1079
|
css: {
|
|
1077
1080
|
paddingTop: 8,
|
|
1078
1081
|
fontSize: 12,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import 'react';
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
import { styled } from '../../../../config/stitches.config.esm.js';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
@@ -33,7 +33,7 @@ const StyledSwitch = styled(SwitchPrimitive.Root, {
|
|
|
33
33
|
},
|
|
34
34
|
'&::before': {
|
|
35
35
|
display: 'block',
|
|
36
|
-
content: 'attr(
|
|
36
|
+
content: 'attr(data-off-label)',
|
|
37
37
|
position: 'absolute',
|
|
38
38
|
fontWeight: 600,
|
|
39
39
|
fontSize: '$label',
|
|
@@ -46,7 +46,7 @@ const StyledSwitch = styled(SwitchPrimitive.Root, {
|
|
|
46
46
|
backgroundColor: '$bgBrand',
|
|
47
47
|
'&::before': {
|
|
48
48
|
display: 'block',
|
|
49
|
-
content: 'attr(
|
|
49
|
+
content: 'attr(data-on-label)',
|
|
50
50
|
position: 'absolute',
|
|
51
51
|
fontWeight: 600,
|
|
52
52
|
fontSize: '$label',
|
|
@@ -66,22 +66,23 @@ const StyledSwitch = styled(SwitchPrimitive.Root, {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
|
-
const InputSwitch = ({
|
|
69
|
+
const InputSwitch = /*#__PURE__*/React__default.forwardRef(({
|
|
70
70
|
id,
|
|
71
71
|
defaultChecked,
|
|
72
72
|
dataOnLabel,
|
|
73
73
|
dataOffLabel,
|
|
74
74
|
disabled,
|
|
75
75
|
...props
|
|
76
|
-
}) => /*#__PURE__*/jsx(StyledSwitch, {
|
|
76
|
+
}, ref) => /*#__PURE__*/jsx(StyledSwitch, {
|
|
77
|
+
ref: ref,
|
|
77
78
|
defaultChecked: defaultChecked,
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
"data-on-label": dataOnLabel,
|
|
80
|
+
"data-off-label": dataOffLabel,
|
|
80
81
|
disabled: disabled,
|
|
81
82
|
id: id,
|
|
82
83
|
...props,
|
|
83
84
|
children: /*#__PURE__*/jsx(StyledThumb, {})
|
|
84
|
-
});
|
|
85
|
+
}));
|
|
85
86
|
InputSwitch.propTypes = {
|
|
86
87
|
id: PropTypes.string,
|
|
87
88
|
disabled: PropTypes.bool,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import 'react';
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
import { styled } from '../../../../config/stitches.config.esm.js';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
@@ -48,7 +48,7 @@ const StyledSwitch = styled(SwitchPrimitive.Root, {
|
|
|
48
48
|
},
|
|
49
49
|
'&::before': {
|
|
50
50
|
display: 'block',
|
|
51
|
-
content: 'attr(
|
|
51
|
+
content: 'attr(data-off-label)',
|
|
52
52
|
position: 'absolute',
|
|
53
53
|
fontWeight: 600,
|
|
54
54
|
fontSize: '$label',
|
|
@@ -60,7 +60,7 @@ const StyledSwitch = styled(SwitchPrimitive.Root, {
|
|
|
60
60
|
'&[data-state="checked"]': {
|
|
61
61
|
'&::before': {
|
|
62
62
|
display: 'block',
|
|
63
|
-
content: 'attr(
|
|
63
|
+
content: 'attr(data-on-label)',
|
|
64
64
|
position: 'absolute',
|
|
65
65
|
fontWeight: 600,
|
|
66
66
|
fontSize: '$label',
|
|
@@ -88,7 +88,7 @@ const StyledSwitch = styled(SwitchPrimitive.Root, {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
|
-
const InputSwitchWithImage = ({
|
|
91
|
+
const InputSwitchWithImage = /*#__PURE__*/React__default.forwardRef(({
|
|
92
92
|
id,
|
|
93
93
|
defaultChecked,
|
|
94
94
|
dataOnLabel,
|
|
@@ -99,10 +99,11 @@ const InputSwitchWithImage = ({
|
|
|
99
99
|
thumbAltOn,
|
|
100
100
|
thumbAltOff,
|
|
101
101
|
...props
|
|
102
|
-
}) => /*#__PURE__*/jsx(StyledSwitch, {
|
|
102
|
+
}, ref) => /*#__PURE__*/jsx(StyledSwitch, {
|
|
103
|
+
ref: ref,
|
|
103
104
|
defaultChecked: defaultChecked,
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
"data-on-label": dataOnLabel,
|
|
106
|
+
"data-off-label": dataOffLabel,
|
|
106
107
|
disabled: disabled,
|
|
107
108
|
id: id,
|
|
108
109
|
...props,
|
|
@@ -117,7 +118,7 @@ const InputSwitchWithImage = ({
|
|
|
117
118
|
className: "off"
|
|
118
119
|
})]
|
|
119
120
|
})
|
|
120
|
-
});
|
|
121
|
+
}));
|
|
121
122
|
InputSwitchWithImage.propTypes = {
|
|
122
123
|
id: PropTypes.string,
|
|
123
124
|
disabled: PropTypes.bool,
|
|
@@ -115,7 +115,7 @@ const TagWrapper = styled(Box, {
|
|
|
115
115
|
marginTop: '5px',
|
|
116
116
|
gap: '5px'
|
|
117
117
|
});
|
|
118
|
-
function InputTags({
|
|
118
|
+
const InputTags = /*#__PURE__*/React__default.forwardRef(function InputTags({
|
|
119
119
|
size,
|
|
120
120
|
isInvalid,
|
|
121
121
|
placeholder,
|
|
@@ -132,15 +132,12 @@ function InputTags({
|
|
|
132
132
|
unremovableTags,
|
|
133
133
|
onRemoveItem,
|
|
134
134
|
...props
|
|
135
|
-
}) {
|
|
135
|
+
}, ref) {
|
|
136
136
|
const [tags, setTags] = React__default.useState(value);
|
|
137
137
|
const [regexError, setRegexError] = React__default.useState(false);
|
|
138
138
|
React__default.useEffect(() => {
|
|
139
139
|
setTags(value);
|
|
140
140
|
}, [value]);
|
|
141
|
-
React__default.useEffect(() => {
|
|
142
|
-
onChange && onChange(tags);
|
|
143
|
-
}, [tags]);
|
|
144
141
|
const addTags = event => {
|
|
145
142
|
if (event.key === 'Enter' && event.target.value !== '' && max !== tags.length) {
|
|
146
143
|
if (tags.find(tag => tag.toLowerCase() === event.target.value.toLowerCase())) {
|
|
@@ -166,7 +163,9 @@ function InputTags({
|
|
|
166
163
|
key: 'success',
|
|
167
164
|
value: event.target.value
|
|
168
165
|
});
|
|
169
|
-
|
|
166
|
+
const nextTags = [...tags, event.target.value];
|
|
167
|
+
setTags(nextTags);
|
|
168
|
+
onChange?.(nextTags);
|
|
170
169
|
event.target.value = '';
|
|
171
170
|
}
|
|
172
171
|
};
|
|
@@ -175,7 +174,9 @@ function InputTags({
|
|
|
175
174
|
return tags;
|
|
176
175
|
} else {
|
|
177
176
|
onRemoveItem?.(tags[index]);
|
|
178
|
-
|
|
177
|
+
const nextTags = tags.filter(tag => tags.indexOf(tag) !== index);
|
|
178
|
+
setTags(nextTags);
|
|
179
|
+
onChange?.(nextTags);
|
|
179
180
|
}
|
|
180
181
|
};
|
|
181
182
|
|
|
@@ -193,12 +194,12 @@ function InputTags({
|
|
|
193
194
|
size: size,
|
|
194
195
|
isInvalid: isInvalid || regexError,
|
|
195
196
|
disabled: disabled || readOnly || tags.length >= max,
|
|
196
|
-
value: value,
|
|
197
197
|
css: {
|
|
198
198
|
...props.css
|
|
199
199
|
},
|
|
200
200
|
...props,
|
|
201
201
|
children: /*#__PURE__*/jsx(Input, {
|
|
202
|
+
ref: ref,
|
|
202
203
|
type: "text",
|
|
203
204
|
onKeyUp: event => addTags(event)
|
|
204
205
|
// onKeyDown={event => removeTags(tags.length - 1, event.key)}
|
|
@@ -216,7 +217,7 @@ function InputTags({
|
|
|
216
217
|
color: "red",
|
|
217
218
|
children: "Invalid Input"
|
|
218
219
|
})), helperText && /*#__PURE__*/jsx(Paragraph, {
|
|
219
|
-
|
|
220
|
+
paragraph: "shortContentRegular",
|
|
220
221
|
css: {
|
|
221
222
|
paddingTop: 8,
|
|
222
223
|
paddingBottom: 3,
|
|
@@ -235,12 +236,12 @@ function InputTags({
|
|
|
235
236
|
}, index))
|
|
236
237
|
})]
|
|
237
238
|
});
|
|
238
|
-
}
|
|
239
|
+
});
|
|
239
240
|
InputTags.propTypes = {
|
|
240
241
|
placeholder: PropTypes.string,
|
|
241
242
|
size: PropTypes.string,
|
|
242
243
|
value: PropTypes.arrayOf(PropTypes.string),
|
|
243
|
-
onChange: PropTypes.
|
|
244
|
+
onChange: PropTypes.func,
|
|
244
245
|
onRemoveItem: PropTypes.func,
|
|
245
246
|
onEnter: PropTypes.func,
|
|
246
247
|
onInputChange: PropTypes.func,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { useState, useEffect } from 'react';
|
|
2
|
+
import { useState, useRef, useEffect } from 'react';
|
|
3
3
|
import { styled } from '@stitches/react';
|
|
4
4
|
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
5
5
|
|
|
@@ -64,7 +64,6 @@ function PrimitiveLoadingBar({
|
|
|
64
64
|
})]
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
let interval;
|
|
68
67
|
function LoadingBar(props) {
|
|
69
68
|
const {
|
|
70
69
|
show,
|
|
@@ -73,25 +72,32 @@ function LoadingBar(props) {
|
|
|
73
72
|
} = props;
|
|
74
73
|
const [progress, setProgress] = useState(0);
|
|
75
74
|
const [visibility, setVisibility] = useState(false);
|
|
75
|
+
const intervalRef = useRef(null);
|
|
76
|
+
const hideTimeoutRef = useRef(null);
|
|
76
77
|
useEffect(() => {
|
|
78
|
+
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
79
|
+
if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
|
|
77
80
|
if (show) {
|
|
81
|
+
setProgress(0);
|
|
78
82
|
setVisibility(true);
|
|
79
|
-
|
|
80
|
-
setProgress(prev => prev < 100
|
|
83
|
+
intervalRef.current = setInterval(() => {
|
|
84
|
+
setProgress(prev => prev < 100 ? prev + 1 : prev);
|
|
81
85
|
}, intervalTime);
|
|
82
86
|
} else {
|
|
83
87
|
setProgress(100);
|
|
84
|
-
|
|
85
|
-
setTimeout(() => {
|
|
88
|
+
hideTimeoutRef.current = setTimeout(() => {
|
|
86
89
|
setVisibility(false);
|
|
87
90
|
setProgress(0);
|
|
88
91
|
}, 1000);
|
|
89
92
|
}
|
|
90
|
-
return () =>
|
|
93
|
+
return () => {
|
|
94
|
+
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
95
|
+
if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
|
|
96
|
+
};
|
|
91
97
|
}, [show, intervalTime]);
|
|
92
98
|
useEffect(() => {
|
|
93
99
|
if (progress === 100) {
|
|
94
|
-
clearInterval(
|
|
100
|
+
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
95
101
|
onCompleted === null || onCompleted === void 0 ? void 0 : onCompleted();
|
|
96
102
|
}
|
|
97
103
|
}, [progress, onCompleted]);
|