@majoo-ui/react 2.4.2 → 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.
Files changed (49) 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 +36 -40
  12. package/components/devicePreview/DevicePreview.esm.js +3 -3
  13. package/components/drawer/Drawer.esm.js +42 -6
  14. package/components/editableTable/EditableTable.esm.js +22 -5
  15. package/components/form/components/FormHelper/Helper.esm.js +1 -1
  16. package/components/form/components/InputCheckbox/CheckboxGroup.esm.js +6 -10
  17. package/components/form/components/InputCombobox/InputCombobox.esm.js +6 -3
  18. package/components/form/components/InputCreatable/InputCreatable.esm.js +5 -6
  19. package/components/form/components/InputGroup/InputGroup.esm.js +8 -9
  20. package/components/form/components/InputNumber/InputNumber.esm.js +1 -1
  21. package/components/form/components/InputRadio/InputRadio.esm.js +5 -2
  22. package/components/form/components/InputRadio/InputRadioGroup.esm.js +12 -5
  23. package/components/form/components/InputResourceList/InputResourceList.esm.js +13 -7
  24. package/components/form/components/InputSearchbox/InputSearchbox.esm.js +9 -3
  25. package/components/form/components/InputSelect/InputSelect.esm.js +1 -1
  26. package/components/form/components/InputSelectCheck/InputSelectCheck.esm.js +5 -2
  27. package/components/form/components/InputSwitch/InputSwitch.esm.js +9 -8
  28. package/components/form/components/InputSwitch/InputSwitchWithImage.esm.js +9 -8
  29. package/components/form/components/InputTags/InputTags.esm.js +12 -11
  30. package/components/loadingBar/LoadingBar.esm.js +14 -8
  31. package/components/mapPicker/InputMapPicker.esm.js +0 -1
  32. package/components/modalDialog/ModalDialog.esm.js +14 -6
  33. package/components/notificationBadge/NotificationBadge.esm.js +12 -7
  34. package/components/pageDialog/PageDialog.esm.js +13 -7
  35. package/components/pagination/PaginationButton.esm.js +1 -0
  36. package/components/pieChart/PieChart.esm.js +1 -1
  37. package/components/popover/Popover.esm.js +3 -2
  38. package/components/progressIndicator/ProgressIndicator.esm.js +1 -1
  39. package/components/stepWizard/StepWizard.esm.js +4 -4
  40. package/components/table/MobileTable.esm.js +4 -2
  41. package/components/tabs/Tabs.esm.js +1 -1
  42. package/components/tooltip/Tooltip.esm.js +9 -4
  43. package/components/upload/Upload.esm.js +34 -18
  44. package/index.esm.css +4 -4
  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
@@ -446,7 +446,17 @@ const AlertDialogRoot = ADialog.Root;
446
446
  const AlertDialogTrigger = ADialog.Trigger;
447
447
  const AlertDialogContent = Content;
448
448
  const AlertDialogTitle = StyledTitle;
449
- const AlertDialogDescription = StyledDescription;
449
+ const AlertDialogDescription = /*#__PURE__*/forwardRef(({
450
+ children,
451
+ ...props
452
+ }, ref) => /*#__PURE__*/jsx(ADialog.Description, {
453
+ asChild: true,
454
+ children: /*#__PURE__*/jsx(StyledDescription, {
455
+ ref: ref,
456
+ ...props,
457
+ children: children
458
+ })
459
+ }));
450
460
  const AlertDialogCancel = ADialog.Cancel;
451
461
  const AlertDialogConfirm = ADialog.Action;
452
462
 
@@ -174,7 +174,7 @@ function BarChartComponent({
174
174
  },
175
175
  content: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.render) ? (_a = tooltip === null || tooltip === void 0 ? void 0 : tooltip.render) === null || _a === void 0 ? void 0 : _a.call(tooltip) : jsx(CustomTooltip, {})
176
176
  }), (legend === null || legend === void 0 ? void 0 : legend.show) && jsx(Legend, {
177
- content: renderLegend(formattedData, legend, subtitle, tickFormatter)
177
+ content: () => renderLegend(formattedData, legend, subtitle, tickFormatter)
178
178
  }), jsxs(Bar, {
179
179
  dataKey: "total",
180
180
  barSize: 12,
@@ -209,6 +209,7 @@ function ButtonGroup({
209
209
  withMaxWidth,
210
210
  mobileOnly,
211
211
  desktopOnly,
212
+ segmented: _segmented,
212
213
  ...props
213
214
  }) {
214
215
  const [listContainerScrollPosition, setlistContainerScrollPosition] = useState(0);
@@ -1,14 +1,14 @@
1
1
  import 'core-js/modules/es.iterator.constructor.js';
2
+ import 'core-js/modules/es.iterator.flat-map.js';
2
3
  import 'core-js/modules/es.iterator.map.js';
3
4
  import 'core-js/modules/es.iterator.some.js';
4
5
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
5
6
  import { foundations } from '@majoo-ui/core';
6
- import { useState, useEffect } from 'react';
7
+ import { useState, useMemo, useEffect } from 'react';
7
8
  import { ResponsiveContainer, LineChart as LineChart$1, XAxis, YAxis, CartesianGrid, Tooltip, Line } from 'recharts';
8
9
  import { Image } from '../../image/Image.esm.js';
9
10
  import 'core-js/modules/es.iterator.filter.js';
10
11
  import 'core-js/modules/es.iterator.reduce.js';
11
- import 'react-i18next';
12
12
  import 'core-js/modules/es.array.includes.js';
13
13
  import Text from '../../text/Text.esm.js';
14
14
  import { styled } from '../../../config/stitches.config.esm.js';
@@ -142,16 +142,14 @@ function LineChart(props) {
142
142
  onComparatorChange,
143
143
  customTooltipDate
144
144
  } = props;
145
- const [isDividedByThousand, setIsDividedByThousand] = useState(false);
146
145
  const [isComparator, setIsComparator] = useState(false);
147
146
  const [hover, setHover] = useState(null);
148
147
  const [filteredData, setFilteredData] = useState([]);
149
- const [maxData, setMaxData] = useState(0);
150
- useEffect(() => {
151
- if (maxData > 0) {
152
- setIsDividedByThousand(String(Math.round(maxData)).length > 10);
153
- }
154
- }, [maxData]);
148
+ const maxData = useMemo(() => Math.max(0, ...data.flatMap(item => legendData.map(legend => {
149
+ const value = Number(item[legend.dataKey]);
150
+ return Number.isFinite(value) ? value : 0;
151
+ }))), [data, legendData]);
152
+ const isDividedByThousand = String(Math.round(maxData)).length > 10;
155
153
  useEffect(() => {
156
154
  setFilteredData(legendData.map(value => Object.assign(Object.assign({}, value), {
157
155
  hide: false,
@@ -259,7 +257,6 @@ function LineChart(props) {
259
257
  return compactCurrency(val);
260
258
  },
261
259
  domain: [dataMin => dataMin < 0 ? roundDown(dataMin) : 0, dataMax => {
262
- setMaxData(dataMax);
263
260
  return roundUpYAxis ? roundUp(dataMax) : dataMax;
264
261
  }]
265
262
  }), jsx(CartesianGrid, {
@@ -156,48 +156,48 @@ function CheckboxTable(props) {
156
156
  })
157
157
  }), jsx(TableBody, Object.assign({}, getTableBodyProps(), {
158
158
  children: rows === null || rows === void 0 ? void 0 : rows.map((row, index) => {
159
- var _a, _b, _c;
159
+ var _a, _b, _c, _d;
160
160
  prepareRow(row);
161
161
  const originalRow = row.original;
162
162
  return jsxs(React__default.Fragment, {
163
- children: [/*#__PURE__*/createElement(TableRow, Object.assign({}, row.getRowProps(), {
164
- key: index
165
- }), (_b = (_a = row === null || row === void 0 ? void 0 : row.cells) === null || _a === void 0 ? void 0 : _a.filter(cell => !cell.column.isSubRow)) === null || _b === void 0 ? void 0 : _b.map((cell, indexCell) => {
166
- var _a;
167
- const column = cell.column;
168
- const originalCell = cell.row.original;
169
- return /*#__PURE__*/createElement(TableCell, Object.assign({}, cell.getCellProps({
170
- style: {
171
- minWidth: column.minWidth,
172
- width: column.width,
173
- maxWidth: column.maxWidth
174
- }
175
- }), {
176
- key: index + indexCell + 'tb-cell',
177
- css: {
178
- '@md': {
179
- height: rowHeight
163
+ children: [jsx(TableRow, Object.assign({}, row.getRowProps(), {
164
+ children: (_b = (_a = row === null || row === void 0 ? void 0 : row.cells) === null || _a === void 0 ? void 0 : _a.filter(cell => !cell.column.isSubRow)) === null || _b === void 0 ? void 0 : _b.map((cell, indexCell) => {
165
+ var _a;
166
+ const column = cell.column;
167
+ const originalCell = cell.row.original;
168
+ return /*#__PURE__*/createElement(TableCell, Object.assign({}, cell.getCellProps({
169
+ style: {
170
+ minWidth: column.minWidth,
171
+ width: column.width,
172
+ maxWidth: column.maxWidth
180
173
  }
181
- }
182
- }), jsxs(TableCellContent, {
183
- align: align,
184
- children: [indexCell === 0 && jsx(Flex, {
185
- justify: "center",
186
- align: "center",
174
+ }), {
175
+ key: index + indexCell + 'tb-cell',
187
176
  css: {
188
- marginRight: 12,
189
- cursor: 'pointer',
190
- display: ((_a = originalCell === null || originalCell === void 0 ? void 0 : originalCell.detail) === null || _a === void 0 ? void 0 : _a.length) ? 'flex' : 'none !important'
191
- },
192
- onClick: () => {
193
- if (!Object.keys(state.expanded).includes(row.id)) {
194
- toggleAllRowsExpanded(false);
177
+ '@md': {
178
+ height: rowHeight
195
179
  }
196
- row.toggleRowExpanded(!row.isExpanded);
197
- },
198
- children: row.isExpanded ? jsx(ChevronUpOutline, {}) : jsx(ChevronDownOutline, {})
199
- }), cell.render('Cell')]
200
- }));
180
+ }
181
+ }), jsxs(TableCellContent, {
182
+ align: align,
183
+ children: [indexCell === 0 && jsx(Flex, {
184
+ justify: "center",
185
+ align: "center",
186
+ css: {
187
+ marginRight: 12,
188
+ cursor: 'pointer',
189
+ display: ((_a = originalCell === null || originalCell === void 0 ? void 0 : originalCell.detail) === null || _a === void 0 ? void 0 : _a.length) ? 'flex' : 'none !important'
190
+ },
191
+ onClick: () => {
192
+ if (!Object.keys(state.expanded).includes(row.id)) {
193
+ toggleAllRowsExpanded(false);
194
+ }
195
+ row.toggleRowExpanded(!row.isExpanded);
196
+ },
197
+ children: row.isExpanded ? jsx(ChevronUpOutline, {}) : jsx(ChevronDownOutline, {})
198
+ }), cell.render('Cell')]
199
+ }));
200
+ })
201
201
  })), (_c = originalRow === null || originalRow === void 0 ? void 0 : originalRow.detail) === null || _c === void 0 ? void 0 : _c.map((cell, index) => {
202
202
  const id_row = originalRow === null || originalRow === void 0 ? void 0 : originalRow.id;
203
203
  const {
@@ -207,7 +207,7 @@ function CheckboxTable(props) {
207
207
  } = cell;
208
208
  const headerRender = name;
209
209
  return /*#__PURE__*/createElement(TableRow, Object.assign({}, row.getRowProps(), {
210
- key: `row_collapse_${index}`,
210
+ key: `row_collapse_${id_subrow !== null && id_subrow !== void 0 ? id_subrow : index}`,
211
211
  css: {
212
212
  display: row.isExpanded ? 'table-row' : 'none'
213
213
  }
@@ -266,7 +266,7 @@ function CheckboxTable(props) {
266
266
  }, index + indexSubRow + 'tb-cell-collapse');
267
267
  }));
268
268
  })]
269
- });
269
+ }, (_d = originalRow.id) !== null && _d !== void 0 ? _d : row.id);
270
270
  })
271
271
  }))]
272
272
  })), rows.length < 1 && jsx(Flex, {
@@ -43,7 +43,8 @@ function InputColorPicker(props) {
43
43
  }), /*#__PURE__*/jsx(Separator, {}), /*#__PURE__*/jsx(InputText, {
44
44
  isPicker: true,
45
45
  placeholder: "Select color",
46
- value: getColor()
46
+ value: getColor(),
47
+ readOnly: true
47
48
  })]
48
49
  });
49
50
  }
@@ -58,7 +59,9 @@ function InputColorPicker(props) {
58
59
  placement: props.placement,
59
60
  children: [/*#__PURE__*/jsx(PopoverTrigger, {
60
61
  disabled: props.disabled,
61
- children: renderInputGroup()
62
+ children: /*#__PURE__*/jsx(Box, {
63
+ children: renderInputGroup()
64
+ })
62
65
  }), /*#__PURE__*/jsx(PopoverContent, {
63
66
  isMobile: props.isMobile,
64
67
  style: props.popoverCss,
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import { useState, useEffect, useReducer } from 'react';
4
4
  import useMediaQuery from '../../utils/useMediaQuery.esm.js';
5
- import { Drawer, DrawerContent } from '../drawer/Drawer.esm.js';
5
+ import { Drawer, DrawerContent, DrawerTitle } from '../drawer/Drawer.esm.js';
6
6
  import { AdvancedOption } from './AdvancedOption.esm.js';
7
7
  import { SINGLE_PICKER, DatePicker, ADVANCE_PICKER } from './DatePicker.esm.js';
8
8
  import { pickerReducer, UPDATE_PICKER, advancePickerOptionsId, advancePickerDate } from './state/reducer.esm.js';
@@ -107,12 +107,21 @@ function CustomDatePicker({
107
107
  open: openPicker,
108
108
  onOpenChange: handleOpenChange,
109
109
  side: "bottom",
110
- children: jsx(DrawerContent, {
110
+ children: jsxs(DrawerContent, {
111
111
  css: {
112
112
  position: 'fixed',
113
113
  left: 0
114
114
  },
115
- children: renderDatePicker()
115
+ children: [jsx(DrawerTitle, {
116
+ style: {
117
+ position: 'absolute',
118
+ width: 1,
119
+ height: 1,
120
+ overflow: 'hidden',
121
+ clip: 'rect(0 0 0 0)'
122
+ },
123
+ children: "Pilih tanggal"
124
+ }), renderDatePicker()]
116
125
  })
117
126
  })]
118
127
  });
@@ -3,7 +3,7 @@ import { useState, useEffect, useReducer } from 'react';
3
3
  import { CalendarOutline } from '@majoo-ui/icons';
4
4
  import Box from '../../layout/box/Box.esm.js';
5
5
  import useMediaQuery from '../../utils/useMediaQuery.esm.js';
6
- import { Drawer, DrawerContent } from '../drawer/Drawer.esm.js';
6
+ import { Drawer, DrawerContent, DrawerTitle } from '../drawer/Drawer.esm.js';
7
7
  import { InputGroup } from '../form/components/InputGroup/InputGroup.esm.js';
8
8
  import { InputLeftElement } from '../form/components/InputElement/InputElement.esm.js';
9
9
  import { InputText } from '../form/components/InputText/InputText.esm.js';
@@ -128,7 +128,7 @@ function InputDatePicker({
128
128
  // eslint-disable-next-line @typescript-eslint/no-empty-function
129
129
  onChange: () => {},
130
130
  isPicker: true,
131
- autoComplete: "false"
131
+ autoComplete: "off"
132
132
  })]
133
133
  });
134
134
  } else {
@@ -244,8 +244,8 @@ function InputDatePicker({
244
244
  })
245
245
  }),
246
246
  children: jsx(PopoverTrigger, {
247
- children: showRangeControl ? renderInputGroup() : jsx(Box, {
248
- css: css,
247
+ children: jsx(Box, {
248
+ css: showRangeControl ? undefined : css,
249
249
  children: renderInputGroup()
250
250
  })
251
251
  })
@@ -278,12 +278,21 @@ function InputDatePicker({
278
278
  side: "bottom",
279
279
  portalled: portalledMobile,
280
280
  css: drawerCss,
281
- children: jsx(DrawerContent, {
281
+ children: jsxs(DrawerContent, {
282
282
  size: "full",
283
283
  css: Object.assign(Object.assign({}, drawerContentCss), {
284
284
  height: 'unset !important'
285
285
  }),
286
- children: renderDatePicker()
286
+ children: [jsx(DrawerTitle, {
287
+ style: {
288
+ position: 'absolute',
289
+ width: 1,
290
+ height: 1,
291
+ overflow: 'hidden',
292
+ clip: 'rect(0 0 0 0)'
293
+ },
294
+ children: t('label.selectDate', 'Pilih tanggal')
295
+ }), renderDatePicker()]
287
296
  })
288
297
  })]
289
298
  });
@@ -166,7 +166,7 @@ function InputDateRangePicker(props) {
166
166
  // eslint-disable-next-line @typescript-eslint/no-empty-function
167
167
  onChange: () => {},
168
168
  isPicker: true,
169
- autoComplete: "false"
169
+ autoComplete: "off"
170
170
  })]
171
171
  });
172
172
  }
@@ -56,13 +56,12 @@ function InputTimePicker({
56
56
  })
57
57
  }), /*#__PURE__*/jsx(InputText, {
58
58
  placeholder: placeholder,
59
- value: getInputPickerValue(value),
60
- defaultValue: defaultValue,
59
+ value: getInputPickerValue(value ?? defaultValue) ?? '',
61
60
  onChange: () => {
62
61
  /* noop: read-only picker input, value set via picker */
63
62
  },
64
63
  isPicker: true,
65
- autoComplete: "false",
64
+ autoComplete: "off",
66
65
  readOnly: true
67
66
  // tabIndex="-1"
68
67
  })]
@@ -162,11 +161,11 @@ InputTimePicker.propTypes = {
162
161
  /**
163
162
  Time picker default value, support moment format.
164
163
  */
165
- defaultValue: PropTypes.instanceOf(Date),
164
+ defaultValue: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.object]),
166
165
  /**
167
166
  Time picker value, support moment format.
168
167
  */
169
- value: PropTypes.instanceOf(Date),
168
+ value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.object]),
170
169
  /**
171
170
  Change handler.
172
171
  */
@@ -178,11 +177,11 @@ InputTimePicker.propTypes = {
178
177
  /**
179
178
  Specify the minimum date.
180
179
  */
181
- minDate: PropTypes.instanceOf(Date),
180
+ minDate: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.object]),
182
181
  /**
183
182
  Specify the maximum date.
184
183
  */
185
- maxDate: PropTypes.instanceOf(Date),
184
+ maxDate: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.object]),
186
185
  /**
187
186
  * Invalid state input.
188
187
  */
@@ -1,4 +1,4 @@
1
- import React__default, { useState } from 'react';
1
+ import { useState } from 'react';
2
2
  import { styled } from '../../../config/stitches.config.esm.js';
3
3
  import { ChevronUpOutline, ChevronDownOutline } from '@majoo-ui/icons';
4
4
  import Box from '../../../layout/box/Box.esm.js';
@@ -165,13 +165,16 @@ const NativeTimePicker = ({
165
165
  }) => {
166
166
  const [date, setDate] = useState(value ? value : defaultValue ? defaultValue : moment());
167
167
  const format = 'HH:mm';
168
- const inputRef = React__default.useRef(false);
168
+ // raw text of the field being typed in, so a half-typed value isn't reformatted mid-keystroke
169
+ const [draft, setDraft] = useState(null);
169
170
  function handleChange(e) {
170
171
  onChange(e, moment(e).format(format));
171
172
  }
172
173
  function setNewDate(newDate) {
173
- setDate(newDate);
174
- onChange && handleChange(newDate);
174
+ // minDate/maxDate arrive as Date; onChange consumers call moment methods (toDate, format)
175
+ const nextDate = moment(newDate);
176
+ setDate(nextDate);
177
+ onChange && handleChange(nextDate);
175
178
  }
176
179
  function handleUp(type) {
177
180
  if (!disabled) {
@@ -205,53 +208,51 @@ const NativeTimePicker = ({
205
208
  const minLength = value?.length > 1;
206
209
  const hourValue = params => moment(moment(`${moment(date).format('DD:MM:YYYY:mm')}:${params}`, 'DD:MM:YYYY:mm:HH').toDate());
207
210
  const minuteValue = params => moment(moment(`${moment(date).format('DD:MM:YYYY:HH')}:${params}`, 'DD:MM:YYYY:HH:mm').toDate());
211
+ const clampDate = newDate => {
212
+ setDraft(null);
213
+ setNewDate(newDate);
214
+ };
208
215
  if (!disabled) {
216
+ setDraft({
217
+ type,
218
+ value
219
+ });
209
220
  if (type === 'hour') {
210
221
  if (value < 0 && minLength) {
211
- setNewDate(minDate || hourValue(0));
212
- inputRef.current = false;
222
+ clampDate(minDate || hourValue(0));
213
223
  return;
214
224
  }
215
225
  if (value > 23 && minLength) {
216
- setNewDate(maxDate || hourValue(23));
217
- inputRef.current = false;
226
+ clampDate(maxDate || hourValue(23));
218
227
  return;
219
228
  }
220
229
  if (minDate && hourValue(value) < moment(minDate) && minLength) {
221
- setNewDate(minDate);
222
- inputRef.current = false;
230
+ clampDate(minDate);
223
231
  return;
224
232
  }
225
233
  if (maxDate && hourValue(value) > moment(maxDate) && minLength) {
226
- setNewDate(maxDate);
227
- inputRef.current = false;
234
+ clampDate(maxDate);
228
235
  return;
229
236
  }
230
237
  setNewDate(moment(moment(`${moment(date).format('DD:MM:YYYY')}:${value}:${moment(date).format('mm')}`, format).toDate()));
231
- inputRef.current = true;
232
238
  } else {
233
239
  if (value < 0 && minLength) {
234
- setNewDate(minuteValue(0));
235
- inputRef.current = false;
240
+ clampDate(minuteValue(0));
236
241
  return;
237
242
  }
238
243
  if (value > 59 && minLength) {
239
- setNewDate(minuteValue(59));
240
- inputRef.current = false;
244
+ clampDate(minuteValue(59));
241
245
  return;
242
246
  }
243
247
  if (minDate && minuteValue(value) < moment(minDate) && minLength) {
244
- setNewDate(minDate);
245
- inputRef.current = false;
248
+ clampDate(minDate);
246
249
  return;
247
250
  }
248
251
  if (maxDate && minuteValue(value) > moment(maxDate) && minLength) {
249
- setNewDate(maxDate);
250
- inputRef.current = false;
252
+ clampDate(maxDate);
251
253
  return;
252
254
  }
253
255
  setNewDate(moment(moment(`${moment(date).format('DD:MM:YYYY:HH')}:${value}`, format).toDate()));
254
- inputRef.current = true;
255
256
  }
256
257
  }
257
258
  }
@@ -279,8 +280,7 @@ const NativeTimePicker = ({
279
280
  })]
280
281
  }), /*#__PURE__*/jsx(Input, {
281
282
  type: "time",
282
- defaultValue: moment(date).format(format),
283
- value: value,
283
+ value: moment(date).format(format),
284
284
  onChange: handleChange
285
285
  }), /*#__PURE__*/jsxs(Flex, {
286
286
  gap: 1,
@@ -289,11 +289,9 @@ const NativeTimePicker = ({
289
289
  maxLength: 2,
290
290
  disabled: disabled,
291
291
  readOnly: disabledHourIncrease || disabledHourDecrease || disabledHour,
292
- defaultValue: hourValue,
293
- value: !inputRef.current ? hourValue : undefined,
292
+ value: draft?.type === 'hour' ? draft.value : hourValue,
294
293
  onChange: e => handleInputChange('hour', e),
295
- onFocus: () => inputRef.current = true,
296
- onBlur: () => inputRef.current = false
294
+ onBlur: () => setDraft(null)
297
295
  }), /*#__PURE__*/jsx(Time, {
298
296
  size: size,
299
297
  children: ":"
@@ -302,11 +300,9 @@ const NativeTimePicker = ({
302
300
  maxLength: 2,
303
301
  disabled: disabled,
304
302
  readOnly: disabledMinuteIncrease || disabledMinuteDecrease || disabledMinute,
305
- defaultValue: minuteValue,
306
- value: !inputRef.current ? minuteValue : undefined,
303
+ value: draft?.type === 'minute' ? draft.value : minuteValue,
307
304
  onChange: e => handleInputChange('minute', e),
308
- onFocus: () => inputRef.current = true,
309
- onBlur: () => inputRef.current = false
305
+ onBlur: () => setDraft(null)
310
306
  })]
311
307
  }), /*#__PURE__*/jsxs(Flex, {
312
308
  direction: "row",
@@ -335,11 +331,11 @@ NativeTimePicker.propTypes = {
335
331
  /**
336
332
  Time picker default value, support moment format.
337
333
  */
338
- defaultValue: PropTypes.instanceOf(Date),
334
+ defaultValue: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.object]),
339
335
  /**
340
336
  Time picker value, support moment format.
341
337
  */
342
- value: PropTypes.instanceOf(Date),
338
+ value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.object]),
343
339
  /**
344
340
  Disabled state.
345
341
  */
@@ -371,11 +367,11 @@ NativeTimePicker.propTypes = {
371
367
  /**
372
368
  Specify the minimum date.
373
369
  */
374
- minDate: PropTypes.instanceOf(Date),
370
+ minDate: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.object]),
375
371
  /**
376
372
  Specify the maximum date.
377
373
  */
378
- maxDate: PropTypes.instanceOf(Date)
374
+ maxDate: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.object])
379
375
  };
380
376
  const TimePicker = ({
381
377
  size,
@@ -434,11 +430,11 @@ TimePicker.propTypes = {
434
430
  /**
435
431
  Time picker default value, support moment format.
436
432
  */
437
- defaultValue: PropTypes.instanceOf(Date),
433
+ defaultValue: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.object]),
438
434
  /**
439
435
  Time picker value, support moment format.
440
436
  */
441
- value: PropTypes.instanceOf(Date),
437
+ value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.object]),
442
438
  /**
443
439
  Disabled state.
444
440
  */
@@ -470,11 +466,11 @@ TimePicker.propTypes = {
470
466
  /**
471
467
  Specify the minimum date.
472
468
  */
473
- minDate: PropTypes.instanceOf(Date),
469
+ minDate: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.object]),
474
470
  /**
475
471
  Specify the maximum date.
476
472
  */
477
- maxDate: PropTypes.instanceOf(Date)
473
+ maxDate: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.object])
478
474
  };
479
475
  NativeTimePicker.displayName = 'NativeTimePicker';
480
476
 
@@ -11,7 +11,6 @@ import Flex from '../../layout/flex/Flex.esm.js';
11
11
  import { Image } from '../image/Image.esm.js';
12
12
  import 'core-js/modules/es.iterator.filter.js';
13
13
  import 'core-js/modules/es.iterator.reduce.js';
14
- import 'react-i18next';
15
14
  import 'core-js/modules/es.array.includes.js';
16
15
  import Paragraph from '../paragraph/Paragraph.esm.js';
17
16
  import Text from '../text/Text.esm.js';
@@ -182,9 +181,10 @@ const DevicePreview = props => {
182
181
  };
183
182
  React.useEffect(() => {
184
183
  if (props.withComponent || (props === null || props === void 0 ? void 0 : props.variant)) {
185
- setTimeout(() => {
184
+ const timeout = setTimeout(() => {
186
185
  setRender(prev => prev + 1);
187
186
  }, 100);
187
+ return () => clearTimeout(timeout);
188
188
  }
189
189
  }, [props.withComponent, props === null || props === void 0 ? void 0 : props.variant]);
190
190
  const renderVariant = variant => {
@@ -565,7 +565,7 @@ const DevicePreview = props => {
565
565
  };
566
566
  return jsxs(Flex, {
567
567
  align: "center",
568
- gap: "6",
568
+ gap: 6,
569
569
  children: [props.carousel && jsx(IconStyled, {
570
570
  type: "button",
571
571
  onClick: prevSlide,
@@ -9,6 +9,8 @@ import { ConditionalWrapper } from '../../wrapper/ConditionalWrapper.esm.js';
9
9
  import { jsx, jsxs } from 'react/jsx-runtime';
10
10
 
11
11
  const Context = /*#__PURE__*/React__default.createContext();
12
+ // lets a DrawerDescription at any depth tell its DrawerContent that a description exists
13
+ const DescriptionContext = /*#__PURE__*/React__default.createContext(null);
12
14
  const {
13
15
  sizes
14
16
  } = foundations;
@@ -47,11 +49,24 @@ function Drawer({
47
49
  children,
48
50
  ...props
49
51
  }) {
52
+ const {
53
+ portalled,
54
+ side,
55
+ size,
56
+ css,
57
+ borderHeader,
58
+ borderFooter
59
+ } = props;
50
60
  return /*#__PURE__*/jsx(DialogPrimitive.Root, {
51
61
  ...props,
52
62
  children: /*#__PURE__*/jsx(Context.Provider, {
53
63
  value: {
54
- ...props
64
+ portalled,
65
+ side,
66
+ size,
67
+ css,
68
+ borderHeader,
69
+ borderFooter
55
70
  },
56
71
  children: children
57
72
  })
@@ -219,6 +234,12 @@ const DrawerContent = ({
219
234
  showOverlay,
220
235
  ...props
221
236
  }) => {
237
+ const [descriptionCount, setDescriptionCount] = React__default.useState(0);
238
+ const registerDescription = React__default.useCallback(() => {
239
+ setDescriptionCount(count => count + 1);
240
+ return () => setDescriptionCount(count => count - 1);
241
+ }, []);
242
+ const hasDescription = descriptionCount > 0;
222
243
  return /*#__PURE__*/jsx(Context.Consumer, {
223
244
  children: value => /*#__PURE__*/jsxs(ConditionalWrapper, {
224
245
  condition: value.portalled,
@@ -226,10 +247,18 @@ const DrawerContent = ({
226
247
  children: child
227
248
  }),
228
249
  children: [showOverlay && /*#__PURE__*/jsx(StyledOverlay, {}), /*#__PURE__*/jsx(StyledContent, {
229
- ...value,
250
+ side: value.side,
251
+ size: value.size,
252
+ css: value.css,
253
+ ...(hasDescription ? {} : {
254
+ 'aria-describedby': undefined
255
+ }),
230
256
  ...props,
231
257
  showOverlay: showOverlay,
232
- children: children
258
+ children: /*#__PURE__*/jsx(DescriptionContext.Provider, {
259
+ value: registerDescription,
260
+ children: children
261
+ })
233
262
  })]
234
263
  })
235
264
  });
@@ -237,7 +266,7 @@ const DrawerContent = ({
237
266
  const DrawerHeader = props => {
238
267
  return /*#__PURE__*/jsx(Context.Consumer, {
239
268
  children: value => /*#__PURE__*/jsx(Header, {
240
- ...value,
269
+ borderHeader: value.borderHeader,
241
270
  children: props.children
242
271
  })
243
272
  });
@@ -245,7 +274,7 @@ const DrawerHeader = props => {
245
274
  const DrawerFooter = props => {
246
275
  return /*#__PURE__*/jsx(Context.Consumer, {
247
276
  children: value => /*#__PURE__*/jsx(Footer, {
248
- ...value,
277
+ borderFooter: value.borderFooter,
249
278
  children: props.children
250
279
  })
251
280
  });
@@ -253,7 +282,14 @@ const DrawerFooter = props => {
253
282
  const DrawerTrigger = DialogPrimitive.Trigger;
254
283
  const DrawerClose = StyledClose;
255
284
  const DrawerTitle = DialogPrimitive.Title;
256
- const DrawerDescription = DialogPrimitive.Description;
285
+ const DrawerDescription = /*#__PURE__*/React__default.forwardRef((props, ref) => {
286
+ const registerDescription = React__default.useContext(DescriptionContext);
287
+ React__default.useLayoutEffect(() => registerDescription?.(), [registerDescription]);
288
+ return /*#__PURE__*/jsx(DialogPrimitive.Description, {
289
+ ref: ref,
290
+ ...props
291
+ });
292
+ });
257
293
  const DrawerBody = Body;
258
294
  const DrawerCloseButton = () => {
259
295
  return /*#__PURE__*/jsx(CloseButton, {