@majoo-ui/react 2.4.3 → 2.4.5

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.
Files changed (50) hide show
  1. package/components/alertDialog/AlertDialog.esm.js +11 -1
  2. package/components/barChart/BarChart.esm.js +1 -1
  3. package/components/buttonGroup/ButtonGroup.esm.js +1 -0
  4. package/components/chart/lineChart/LineChart.esm.js +7 -10
  5. package/components/checkboxTable/CheckboxTable.esm.js +38 -38
  6. package/components/colorPicker/InputColorPicker.esm.js +5 -2
  7. package/components/datePicker/CustomDatePicker.esm.js +12 -3
  8. package/components/datePicker/InputDatePicker.esm.js +15 -6
  9. package/components/datePicker/InputDateRangePicker.esm.js +1 -1
  10. package/components/datePicker/timePicker/InputTimePicker.esm.js +6 -7
  11. package/components/datePicker/timePicker/TimePicker.esm.js +32 -38
  12. package/components/devicePreview/DevicePreview.esm.js +3 -3
  13. package/components/drawer/Drawer.esm.js +42 -6
  14. package/components/dropdownMenu/DropdownMenu.esm.js +15 -7
  15. package/components/editableTable/EditableTable.esm.js +22 -5
  16. package/components/form/components/FormHelper/Helper.esm.js +1 -1
  17. package/components/form/components/InputCheckbox/CheckboxGroup.esm.js +6 -10
  18. package/components/form/components/InputCombobox/InputCombobox.esm.js +6 -3
  19. package/components/form/components/InputCreatable/InputCreatable.esm.js +5 -6
  20. package/components/form/components/InputGroup/InputGroup.esm.js +8 -9
  21. package/components/form/components/InputNumber/InputNumber.esm.js +1 -1
  22. package/components/form/components/InputRadio/InputRadio.esm.js +5 -2
  23. package/components/form/components/InputRadio/InputRadioGroup.esm.js +12 -5
  24. package/components/form/components/InputResourceList/InputResourceList.esm.js +13 -7
  25. package/components/form/components/InputSearchbox/InputSearchbox.esm.js +9 -3
  26. package/components/form/components/InputSelect/InputSelect.esm.js +1 -1
  27. package/components/form/components/InputSelectCheck/InputSelectCheck.esm.js +5 -2
  28. package/components/form/components/InputSwitch/InputSwitch.esm.js +9 -8
  29. package/components/form/components/InputSwitch/InputSwitchWithImage.esm.js +9 -8
  30. package/components/form/components/InputTags/InputTags.esm.js +12 -11
  31. package/components/loadingBar/LoadingBar.esm.js +14 -8
  32. package/components/mapPicker/InputMapPicker.esm.js +0 -1
  33. package/components/modalDialog/ModalDialog.esm.js +14 -6
  34. package/components/notificationBadge/NotificationBadge.esm.js +12 -7
  35. package/components/pageDialog/PageDialog.esm.js +13 -7
  36. package/components/pagination/PaginationButton.esm.js +1 -0
  37. package/components/pieChart/PieChart.esm.js +1 -1
  38. package/components/popover/Popover.esm.js +3 -2
  39. package/components/progressIndicator/ProgressIndicator.esm.js +1 -1
  40. package/components/stepWizard/StepWizard.esm.js +4 -4
  41. package/components/table/MobileTable.esm.js +4 -2
  42. package/components/tabs/Tabs.esm.js +21 -10
  43. package/components/tooltip/Tooltip.esm.js +9 -4
  44. package/components/upload/Upload.esm.js +34 -18
  45. package/index.esm.js +2 -2
  46. package/layout/grid/Grid.esm.js +32 -13
  47. package/layout/pageContainer/PageContainer.esm.js +1 -0
  48. package/package.json +2 -2
  49. package/src/components/editableTable/EditableTable.d.ts +3 -1
  50. package/utils/element.esm.js +0 -21
@@ -253,10 +253,16 @@ DropdownMenuContext.propTypes = {
253
253
  side: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
254
254
  align: PropTypes.oneOf(['start', 'center', 'end'])
255
255
  };
256
- const DropdownMenuContentContext = ({
256
+ const setRef = (ref, node) => {
257
+ if (typeof ref === 'function') ref(node);else if (ref) ref.current = node;
258
+ };
259
+
260
+ // forwardRef because DropdownMenuPortal renders its child through Radix's `Portal asChild`,
261
+ // which hands that child a ref; a plain function component would drop it with a warning.
262
+ const DropdownMenuContentContext = /*#__PURE__*/React__default.forwardRef(({
257
263
  theme = 'default',
258
264
  ...props
259
- }) => {
265
+ }, forwardedRef) => {
260
266
  const {
261
267
  side,
262
268
  align
@@ -271,7 +277,8 @@ const DropdownMenuContentContext = ({
271
277
  appElement.classList.remove('noscroll');
272
278
  }
273
279
  }
274
- }, []);
280
+ setRef(forwardedRef, node);
281
+ }, [forwardedRef]);
275
282
  return /*#__PURE__*/jsx(StyledContent, {
276
283
  className: `dropdown-content ${themeProvider?.theme || ''}`,
277
284
  side: side,
@@ -280,7 +287,7 @@ const DropdownMenuContentContext = ({
280
287
  ...props,
281
288
  children: props.children
282
289
  });
283
- };
290
+ });
284
291
  DropdownMenuContentContext.propTypes = {
285
292
  sideOffset: PropTypes.number,
286
293
  alignOffset: PropTypes.number,
@@ -288,18 +295,19 @@ DropdownMenuContentContext.propTypes = {
288
295
  };
289
296
 
290
297
  // Radix positions submenus itself, so this only carries the theme class across the portal.
291
- const DropdownMenuSubContentContext = ({
298
+ const DropdownMenuSubContentContext = /*#__PURE__*/React__default.forwardRef(({
292
299
  theme = 'default',
293
300
  children,
294
301
  ...props
295
- }) => {
302
+ }, ref) => {
296
303
  const themeProvider = useThemeProvider(theme);
297
304
  return /*#__PURE__*/jsx(StyledSubContent, {
298
305
  className: `dropdown-content ${themeProvider?.theme || ''}`,
306
+ ref: ref,
299
307
  ...props,
300
308
  children: children
301
309
  });
302
- };
310
+ });
303
311
  DropdownMenuSubContentContext.propTypes = {
304
312
  sideOffset: PropTypes.number,
305
313
  alignOffset: PropTypes.number,
@@ -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
- function Switch(props) {
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: props === null || props === void 0 ? void 0 : props.position,
270
- css: props === null || props === void 0 ? void 0 : props.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
- }, props))
291
+ }, switchProps))
275
292
  });
276
- }
293
+ });
277
294
  function Remove(props) {
278
295
  const [isHover, setIsHover] = useState(false);
279
296
  function onEnter() {
@@ -37,7 +37,7 @@ const FormHelper = ({
37
37
  return /*#__PURE__*/jsx(StyledHelper, {
38
38
  error: error,
39
39
  variant: "helper",
40
- classname: "retina-error",
40
+ className: "retina-error",
41
41
  ...props,
42
42
  children: children
43
43
  });
@@ -16,22 +16,18 @@ const CheckboxGroup = ({
16
16
  const [selectedItems, setSelectedItems] = useState(defaultValue);
17
17
  const checkItem = (item, index) => {
18
18
  if (!value) {
19
- setSelectedItems(current => {
20
- const items = [...current, item];
21
- if (onChange) onChange(items);
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
- setSelectedItems(current => {
31
- const items = current.filter(currItem => currItem !== item);
32
- if (onChange) onChange(items);
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 isLetter = children.some(child => child && (child.type.name === 'InputPrefix' || child.type.name === 'InputSuffix' || child.type.name === 'InputLeftElement' || child.type.name === 'InputRightElement'));
148
- const isElement = children.some(child => child && (child.type.name === 'InputLeftElement' || child.type.name === 'InputRightElement'));
149
- const clone = children.map((child, index) => {
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(Flex, {
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
- return props?.children && /*#__PURE__*/jsx(InputRadioContext.Provider, {
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
- ...props,
17
- children: React__default.Children.map(props?.children, child => /*#__PURE__*/React__default.cloneElement(child, {
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, useMemo, useRef, useEffect } from 'react';
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
- }, `${resource.value}`), !!resource.subLabel && jsx(Paragraph, {
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: debounce(query => {
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
- const debounceChange = useCallback(debounce(e => onChange?.(e), 1000), [onChange]);
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: 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
- shortContentRegular: true,
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(dataOffLabel)',
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(dataOnLabel)',
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
- dataOnLabel: dataOnLabel,
79
- dataOffLabel: dataOffLabel,
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(dataOffLabel)',
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(dataOnLabel)',
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
- dataOnLabel: dataOnLabel,
105
- dataOffLabel: dataOffLabel,
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
- setTags([...tags, event.target.value]);
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
- setTags([...tags.filter(tag => tags.indexOf(tag) !== index)]);
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
- shortContentRegular: true,
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.arrayOf(PropTypes.string),
244
+ onChange: PropTypes.func,
244
245
  onRemoveItem: PropTypes.func,
245
246
  onEnter: PropTypes.func,
246
247
  onInputChange: PropTypes.func,