@algolia/satellite 1.0.0 → 1.1.0

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 (134) hide show
  1. package/dist/cjs/AutoComplete/AutoComplete.d.ts +1 -1
  2. package/dist/cjs/AutoComplete/AutoComplete.js +49 -26
  3. package/dist/cjs/AutoComplete/AutoComplete.tailwind.js +9 -1
  4. package/dist/cjs/AutoComplete/types.d.ts +1 -0
  5. package/dist/cjs/Checkbox/Checkbox.d.ts +1 -1
  6. package/dist/cjs/Checkbox/Checkbox.js +21 -13
  7. package/dist/cjs/Checkbox/Checkbox.tailwind.js +8 -2
  8. package/dist/cjs/DatePicker/DatePicker/DatePicker.d.ts +4 -2
  9. package/dist/cjs/DatePicker/DatePicker/DatePicker.js +18 -7
  10. package/dist/cjs/DatePicker/components/Display.d.ts +3 -3
  11. package/dist/cjs/DatePicker/components/Display.js +16 -5
  12. package/dist/cjs/Dropzone/Dropzone.d.ts +4 -2
  13. package/dist/cjs/Dropzone/Dropzone.js +23 -12
  14. package/dist/cjs/Field/Field.d.ts +1 -0
  15. package/dist/cjs/Field/Field.js +63 -11
  16. package/dist/cjs/Field/FieldContext.d.ts +3 -0
  17. package/dist/cjs/Field/useField.d.ts +4 -1
  18. package/dist/cjs/Field/useField.js +17 -1
  19. package/dist/cjs/Form/Form.d.ts +16 -0
  20. package/dist/cjs/Form/Form.js +140 -0
  21. package/dist/cjs/Form/FormContext.d.ts +13 -0
  22. package/dist/cjs/Form/FormContext.js +8 -0
  23. package/dist/cjs/Form/index.d.ts +3 -0
  24. package/dist/cjs/Form/index.js +27 -0
  25. package/dist/cjs/Form/stories/AsynchronousValidation.js +396 -0
  26. package/dist/cjs/Form/stories/Complex.js +928 -0
  27. package/dist/cjs/Form/stories/DependentFieldsValidation.js +249 -0
  28. package/dist/cjs/Form/stories/DirtyFields.js +339 -0
  29. package/dist/cjs/Form/stories/DynamicFieldsValidation.js +425 -0
  30. package/dist/cjs/Form/stories/FieldArrays.js +549 -0
  31. package/dist/cjs/Form/stories/ValidationStrategies.js +455 -0
  32. package/dist/cjs/Form/stories/utils/useFormikAutoFocusOnError.js +22 -0
  33. package/dist/cjs/Form/useForm.d.ts +1 -0
  34. package/dist/cjs/Form/useForm.js +11 -0
  35. package/dist/cjs/Input/Input.js +22 -9
  36. package/dist/cjs/Input/Input.tailwind.js +7 -2
  37. package/dist/cjs/Pagination/DotPagination/DotPagination.d.ts +1 -1
  38. package/dist/cjs/RadioGroup/RadioButton.d.ts +1 -1
  39. package/dist/cjs/RadioGroup/RadioButton.js +16 -3
  40. package/dist/cjs/RadioGroup/RadioButton.tailwind.js +23 -0
  41. package/dist/cjs/RadioGroup/RadioGroup.d.ts +7 -5
  42. package/dist/cjs/RadioGroup/RadioGroup.js +78 -16
  43. package/dist/cjs/RadioGroup/{RadiogroupContext.d.ts → RadioGroupContext.d.ts} +8 -1
  44. package/dist/cjs/RangeSlider/RangeSlider.d.ts +2 -3
  45. package/dist/cjs/RangeSlider/RangeSlider.js +27 -10
  46. package/dist/cjs/Satellite/locale.d.ts +2 -0
  47. package/dist/cjs/Select/Select.js +39 -6
  48. package/dist/cjs/Select/Select.tailwind.js +19 -0
  49. package/dist/cjs/Stepper/Step.js +2 -2
  50. package/dist/cjs/Switch/Switch.js +2 -2
  51. package/dist/cjs/Switch/SwitchOption.js +3 -3
  52. package/dist/cjs/Tables/DataTable/DataTable.d.ts +1 -1
  53. package/dist/cjs/Tag/Tag.d.ts +1 -1
  54. package/dist/cjs/TextArea/TextArea.d.ts +1 -0
  55. package/dist/cjs/TextArea/TextArea.js +47 -8
  56. package/dist/cjs/TextArea/TextArea.tailwind.js +41 -4
  57. package/dist/cjs/Toggle/Toggle.d.ts +1 -1
  58. package/dist/cjs/Toggle/Toggle.js +23 -6
  59. package/dist/cjs/Toggle/Toggle.tailwind.js +9 -0
  60. package/dist/cjs/Tooltip/Tooltip.d.ts +1 -1
  61. package/dist/cjs/index.d.ts +1 -0
  62. package/dist/cjs/index.js +12 -0
  63. package/dist/cjs/utils/isCssPropertySupported.d.ts +1 -1
  64. package/dist/cjs/utils/mergeRefs.d.ts +2 -0
  65. package/dist/cjs/utils/mergeRefs.js +17 -0
  66. package/dist/esm/AutoComplete/AutoComplete.d.ts +1 -1
  67. package/dist/esm/AutoComplete/AutoComplete.js +52 -27
  68. package/dist/esm/AutoComplete/AutoComplete.tailwind.js +9 -1
  69. package/dist/esm/AutoComplete/types.d.ts +1 -0
  70. package/dist/esm/Checkbox/Checkbox.d.ts +1 -1
  71. package/dist/esm/Checkbox/Checkbox.js +21 -13
  72. package/dist/esm/Checkbox/Checkbox.tailwind.js +8 -2
  73. package/dist/esm/DatePicker/DatePicker/DatePicker.d.ts +4 -2
  74. package/dist/esm/DatePicker/DatePicker/DatePicker.js +19 -8
  75. package/dist/esm/DatePicker/components/Display.d.ts +3 -3
  76. package/dist/esm/DatePicker/components/Display.js +15 -5
  77. package/dist/esm/Dropzone/Dropzone.d.ts +4 -2
  78. package/dist/esm/Dropzone/Dropzone.js +24 -13
  79. package/dist/esm/Field/Field.d.ts +1 -0
  80. package/dist/esm/Field/Field.js +64 -12
  81. package/dist/esm/Field/FieldContext.d.ts +3 -0
  82. package/dist/esm/Field/useField.d.ts +4 -1
  83. package/dist/esm/Field/useField.js +17 -2
  84. package/dist/esm/Form/Form.d.ts +16 -0
  85. package/dist/esm/Form/Form.js +135 -0
  86. package/dist/esm/Form/FormContext.d.ts +13 -0
  87. package/dist/esm/Form/FormContext.js +2 -0
  88. package/dist/esm/Form/index.d.ts +3 -0
  89. package/dist/esm/Form/index.js +3 -0
  90. package/dist/esm/Form/stories/AsynchronousValidation.js +387 -0
  91. package/dist/esm/Form/stories/Complex.js +919 -0
  92. package/dist/esm/Form/stories/DependentFieldsValidation.js +240 -0
  93. package/dist/esm/Form/stories/DirtyFields.js +330 -0
  94. package/dist/esm/Form/stories/DynamicFieldsValidation.js +416 -0
  95. package/dist/esm/Form/stories/FieldArrays.js +544 -0
  96. package/dist/esm/Form/stories/ValidationStrategies.js +446 -0
  97. package/dist/esm/Form/stories/utils/useFormikAutoFocusOnError.js +16 -0
  98. package/dist/esm/Form/useForm.d.ts +1 -0
  99. package/dist/esm/Form/useForm.js +5 -0
  100. package/dist/esm/Input/Input.js +22 -9
  101. package/dist/esm/Input/Input.tailwind.js +7 -2
  102. package/dist/esm/Pagination/DotPagination/DotPagination.d.ts +1 -1
  103. package/dist/esm/RadioGroup/RadioButton.d.ts +1 -1
  104. package/dist/esm/RadioGroup/RadioButton.js +16 -3
  105. package/dist/esm/RadioGroup/RadioButton.tailwind.js +23 -0
  106. package/dist/esm/RadioGroup/RadioGroup.d.ts +7 -5
  107. package/dist/esm/RadioGroup/RadioGroup.js +77 -15
  108. package/dist/esm/RadioGroup/{RadiogroupContext.d.ts → RadioGroupContext.d.ts} +8 -1
  109. package/dist/esm/RangeSlider/RangeSlider.d.ts +2 -3
  110. package/dist/esm/RangeSlider/RangeSlider.js +27 -10
  111. package/dist/esm/Satellite/locale.d.ts +2 -0
  112. package/dist/esm/Select/Select.js +41 -7
  113. package/dist/esm/Select/Select.tailwind.js +19 -0
  114. package/dist/esm/Stepper/Step.js +2 -2
  115. package/dist/esm/Switch/Switch.js +1 -1
  116. package/dist/esm/Switch/SwitchOption.js +2 -2
  117. package/dist/esm/Tables/DataTable/DataTable.d.ts +1 -1
  118. package/dist/esm/Tag/Tag.d.ts +1 -1
  119. package/dist/esm/TextArea/TextArea.d.ts +1 -0
  120. package/dist/esm/TextArea/TextArea.js +49 -9
  121. package/dist/esm/TextArea/TextArea.tailwind.js +41 -4
  122. package/dist/esm/Toggle/Toggle.d.ts +1 -1
  123. package/dist/esm/Toggle/Toggle.js +23 -6
  124. package/dist/esm/Toggle/Toggle.tailwind.js +9 -0
  125. package/dist/esm/Tooltip/Tooltip.d.ts +1 -1
  126. package/dist/esm/index.d.ts +1 -0
  127. package/dist/esm/index.js +1 -0
  128. package/dist/esm/utils/isCssPropertySupported.d.ts +1 -1
  129. package/dist/esm/utils/mergeRefs.d.ts +2 -0
  130. package/dist/esm/utils/mergeRefs.js +11 -0
  131. package/dist/satellite.min.css +1 -1
  132. package/package.json +13 -7
  133. /package/dist/cjs/RadioGroup/{RadiogroupContext.js → RadioGroupContext.js} +0 -0
  134. /package/dist/esm/RadioGroup/{RadiogroupContext.js → RadioGroupContext.js} +0 -0
@@ -1,12 +1,14 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28;
4
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
5
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30;
6
6
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
7
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
8
  import cx from "clsx";
9
9
  import { useCombobox, useMultipleSelection } from "downshift";
10
+ import { forwardRef } from "react";
11
+ import { Fragment } from "react";
10
12
  import { useEffect, useMemo, useRef, useState } from "react";
11
13
  import { usePopper } from "react-popper";
12
14
  import useMeasure from "react-use/lib/useMeasure";
@@ -14,11 +16,12 @@ import usePrevious from "react-use/lib/usePrevious";
14
16
  import { Card } from "../Card";
15
17
  import { ClickAwayContainer } from "../ClickAwayContainer";
16
18
  import { useField } from "../Field";
17
- import { XIcon } from "../Icons";
19
+ import { CheckIcon, XIcon } from "../Icons";
18
20
  import { useCreatePortal, useLocale } from "../Satellite";
19
21
  import { ScrollIndicator } from "../ScrollIndicator";
20
22
  import stl from "../styles/helpers/satellitePrefixer";
21
23
  import { Tag } from "../Tag";
24
+ import { mergeRefs } from "../utils/mergeRefs";
22
25
  import { uniqBy } from "../utils/uniqBy";
23
26
  import { AutoCompleteProvider } from "./components/AutoCompleteContext";
24
27
  import { AutoCompleteEmptyState } from "./components/AutoCompleteEmptyState";
@@ -44,18 +47,30 @@ var updateRef = function updateRef(ref, value) {
44
47
  ref.current = value;
45
48
  }
46
49
  };
50
+ var InvalidIcon = function InvalidIcon() {
51
+ return /*#__PURE__*/_jsx(XIcon, {
52
+ className: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["h-4 w-4 text-white bg-red-700 p-px rounded-full"])))
53
+ });
54
+ };
55
+ var ValidatedIcon = function ValidatedIcon() {
56
+ return /*#__PURE__*/_jsx(CheckIcon, {
57
+ className: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["h-4 w-4 text-white bg-accent-600 p-px rounded-full"])))
58
+ });
59
+ };
47
60
 
48
61
  /**
49
62
  * The `Autocomplete` component enables users to search and select from a list using real-time input matching.
50
63
  *
51
64
  * See the [Autocomplete documentation page](https://satellite.algolia.com/components/forms/autocomplete) for more information.
52
65
  */
53
- export var AutoComplete = function AutoComplete(_ref) {
66
+ export var AutoComplete = /*#__PURE__*/forwardRef(function (_ref, ref) {
54
67
  var localeProp = _ref.locale,
55
68
  id = _ref.id,
56
69
  labelId = _ref.labelId,
57
70
  ariaLabel = _ref["aria-label"],
58
71
  name = _ref.name,
72
+ _ref$required = _ref.required,
73
+ required = _ref$required === void 0 ? false : _ref$required,
59
74
  placeholder = _ref.placeholder,
60
75
  autoFocus = _ref.autoFocus,
61
76
  inputValueProp = _ref.inputValue,
@@ -89,9 +104,15 @@ export var AutoComplete = function AutoComplete(_ref) {
89
104
  valuesClassName = _ref.valuesClassName,
90
105
  internalsRef = _ref.internalsRef;
91
106
  var createPortal = useCreatePortal();
92
- var _useField = useField(),
107
+ var _useField = useField({
108
+ required: required
109
+ }),
93
110
  status = _useField.state.status,
94
- fieldLabelId = _useField.labelId;
111
+ fieldLabelId = _useField.labelId,
112
+ descriptionId = _useField.descriptionId,
113
+ inputId = _useField.inputId;
114
+ var isInvalid = status === "invalid";
115
+ var StatusIcon = isInvalid ? InvalidIcon : status === "validated" ? ValidatedIcon : Fragment;
95
116
  var localeContext = useLocale("autoComplete");
96
117
  var locale = useMemo(function () {
97
118
  return _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_AUTOCOMPLETE_LOCALE), localeContext), localeProp);
@@ -165,7 +186,7 @@ export var AutoComplete = function AutoComplete(_ref) {
165
186
  }
166
187
  });
167
188
  var combobox = useCombobox({
168
- inputId: id,
189
+ inputId: id !== null && id !== void 0 ? id : inputId,
169
190
  labelId: labelId !== null && labelId !== void 0 ? labelId : fieldLabelId,
170
191
  items: items,
171
192
  itemToString: optionToString,
@@ -235,9 +256,12 @@ export var AutoComplete = function AutoComplete(_ref) {
235
256
  }
236
257
  });
237
258
  var inputProps = combobox.getInputProps(_objectSpread({
238
- "aria-label": ariaLabel
259
+ "aria-label": ariaLabel,
260
+ "aria-describedby": descriptionId,
261
+ "aria-invalid": isInvalid,
262
+ required: required
239
263
  }, multipleSelection.getDropdownProps({
240
- ref: inputRef,
264
+ ref: mergeRefs([inputRef, ref]),
241
265
  autoFocus: autoFocus,
242
266
  disabled: disabled,
243
267
  // See https://github.com/downshift-js/downshift/issues/1108
@@ -303,24 +327,24 @@ export var AutoComplete = function AutoComplete(_ref) {
303
327
  return /*#__PURE__*/_jsx(AutoCompleteProvider, {
304
328
  locale: locale,
305
329
  children: /*#__PURE__*/_jsxs("div", {
306
- className: cx(stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["flex"]))), className),
330
+ className: cx(stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["flex"]))), className),
307
331
  ref: function ref(el) {
308
332
  setContainerElement(el);
309
333
  // @ts-expect-error
310
334
  setContainerMeasureRef(el);
311
335
  },
312
336
  children: [/*#__PURE__*/_jsxs("div", {
313
- className: cx(stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["autocomplete-container"]))), variant === "large" && stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["autocomplete-large py-1"]))), inputFocused && stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["autocomplete-focused"]))), disabled && stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["autocomplete-disabled"]))), status === "invalid" && stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["autocomplete-invalid"]))), noWrap && stl(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["autocomplete-nowrap"])))),
337
+ className: cx(stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["autocomplete-container"]))), variant === "large" && stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["autocomplete-large py-1"]))), inputFocused && stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["autocomplete-focused"]))), disabled && stl(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["autocomplete-disabled"]))), isInvalid && stl(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["autocomplete-invalid"]))), noWrap && stl(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["autocomplete-nowrap"])))),
314
338
  onClick: function onClick() {
315
339
  var _inputRef$current;
316
340
  return (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
317
341
  },
318
342
  children: [Icon && /*#__PURE__*/_jsx(Icon, {
319
- className: cx(stl(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["mr-4 shrink-0"]))), stl(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["", ""])), disabled ? "text-grey-200" : inputFocused ? "text-accent-600" : "text-grey-500")),
343
+ className: cx(stl(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["mr-4 shrink-0"]))), stl(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["", ""])), disabled ? "text-grey-200" : inputFocused ? "text-accent-600" : "text-grey-500")),
320
344
  width: "1rem",
321
345
  height: "1rem"
322
346
  }), /*#__PURE__*/_jsxs("div", {
323
- className: cx(stl(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["flex items-center flex-1 max-h-full"]))), !noWrap && stl(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["flex-wrap overflow-y-scroll no-scrollbar"]))), multiple && stl(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["-ml-1"]))), valuesClassName),
347
+ className: cx(stl(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["flex items-center flex-1 max-h-full"]))), !noWrap && stl(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["flex-wrap overflow-y-scroll no-scrollbar"]))), multiple && stl(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["-ml-1"]))), valuesClassName),
324
348
  children: [multiple && selectedItems.map(function (option, index) {
325
349
  return renderValueTemplate ? /*#__PURE__*/_jsx("span", _objectSpread(_objectSpread({}, multipleSelection.getSelectedItemProps({
326
350
  selectedItem: option,
@@ -335,7 +359,7 @@ export var AutoComplete = function AutoComplete(_ref) {
335
359
  evt.stopPropagation();
336
360
  multipleSelection.removeSelectedItem(option);
337
361
  },
338
- className: stl(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["m-1 max-w-48 ", ""])), disabled && "opacity-50")
362
+ className: stl(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["m-1 max-w-48 ", ""])), disabled && "opacity-50")
339
363
  }, multipleSelection.getSelectedItemProps({
340
364
  selectedItem: option,
341
365
  index: index
@@ -348,21 +372,21 @@ export var AutoComplete = function AutoComplete(_ref) {
348
372
  }), /*#__PURE__*/_jsx("input", _objectSpread(_objectSpread({
349
373
  "data-lpignore": true
350
374
  }, inputProps), {}, {
351
- id: id,
375
+ id: id !== null && id !== void 0 ? id : inputId,
352
376
  name: name,
353
377
  type: "text",
354
378
  placeholder: hasValue ? "" : placeholder,
355
379
  autoComplete: "off",
356
- className: cx(stl(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["autocomplete-input py-1.5"]))), multiple && stl(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["ml-1"]))), shouldRenderCustomTemplate && hasValue && stl(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["h-0 w-0 opacity-0"]))))
380
+ className: cx(stl(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["autocomplete-input py-1.5"]))), multiple && stl(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["ml-1"]))), shouldRenderCustomTemplate && hasValue && stl(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["h-0 w-0 opacity-0"]))))
357
381
  }))]
358
382
  }), Boolean(showClearButton || endItem) && /*#__PURE__*/_jsxs("div", {
359
- className: cx(showClearButton && endItem && stl(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["my-2 flex self-end space-x-4"])))),
383
+ className: cx(showClearButton && endItem && stl(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["my-2 flex self-end space-x-4"])))),
360
384
  children: [!!endItem && /*#__PURE__*/_jsx("div", {
361
- className: stl(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["text-grey-700 my-auto"]))),
385
+ className: stl(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["text-grey-700 my-auto"]))),
362
386
  children: endItem
363
387
  }), showClearButton && /*#__PURE__*/_jsx("button", {
364
388
  type: "button",
365
- className: stl(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["w-6 h-6 flex items-center justify-center text-grey-500"]))),
389
+ className: stl(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["w-6 h-6 flex items-center justify-center text-grey-500"]))),
366
390
  onClick: function onClick() {
367
391
  setInternalInputValue("");
368
392
  multipleSelection.setSelectedItems([]);
@@ -372,11 +396,11 @@ export var AutoComplete = function AutoComplete(_ref) {
372
396
  size: ".75rem"
373
397
  })
374
398
  })]
375
- })]
399
+ }), /*#__PURE__*/_jsx(StatusIcon, {})]
376
400
  }), createPortal( /*#__PURE__*/_jsx(ClickAwayContainer, {
377
401
  element: menuRef.current,
378
402
  children: /*#__PURE__*/_jsxs(Card, _objectSpread(_objectSpread({}, menuPopper.attributes), {}, {
379
- className: cx(stl(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["z-dropdown"]))), menuClassName),
403
+ className: cx(stl(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["z-dropdown"]))), menuClassName),
380
404
  style: _objectSpread(_objectSpread(_objectSpread({}, menuPopper.styles.popper), hideMenu && {
381
405
  display: "none"
382
406
  }), {}, {
@@ -387,7 +411,7 @@ export var AutoComplete = function AutoComplete(_ref) {
387
411
  elevation: "300",
388
412
  fullBleed: true,
389
413
  children: [hideMenu ? /*#__PURE__*/_jsx("div", _objectSpread({}, combobox.getMenuProps())) : items.length === 0 ? /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({}, combobox.getMenuProps({
390
- className: stl(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["min-h-10"])))
414
+ className: stl(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["min-h-10"])))
391
415
  })), {}, {
392
416
  children: /*#__PURE__*/_jsx("div", {
393
417
  role: "option",
@@ -398,15 +422,15 @@ export var AutoComplete = function AutoComplete(_ref) {
398
422
  })
399
423
  })
400
424
  })) : /*#__PURE__*/_jsx(ScrollIndicator, {
401
- className: menuSize === "large" ? stl(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["max-h-96"]))) : stl(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["max-h-64"]))),
425
+ className: menuSize === "large" ? stl(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["max-h-96"]))) : stl(_templateObject25 || (_templateObject25 = _taggedTemplateLiteral(["max-h-64"]))),
402
426
  children: /*#__PURE__*/_jsx("ul", _objectSpread(_objectSpread({}, combobox.getMenuProps()), {}, {
403
427
  children: items.map(function (item, index) {
404
428
  return /*#__PURE__*/_jsx("li", _objectSpread(_objectSpread({}, combobox.getItemProps({
405
429
  item: item,
406
- className: cx(stl(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["autocomplete-result flex items-center min-h-10 px-4 cursor-pointer"]))), index === combobox.highlightedIndex && stl(_templateObject25 || (_templateObject25 = _taggedTemplateLiteral(["bg-grey-100"]))), item.disabled && stl(_templateObject26 || (_templateObject26 = _taggedTemplateLiteral(["cursor-not-allowed"]))))
430
+ className: cx(stl(_templateObject26 || (_templateObject26 = _taggedTemplateLiteral(["autocomplete-result flex items-center min-h-10 px-4 cursor-pointer"]))), index === combobox.highlightedIndex && stl(_templateObject27 || (_templateObject27 = _taggedTemplateLiteral(["bg-grey-100"]))), item.disabled && stl(_templateObject28 || (_templateObject28 = _taggedTemplateLiteral(["cursor-not-allowed"]))))
407
431
  })), {}, {
408
432
  children: item.value === SHOW_ALL_ITEMS_ID ? /*#__PURE__*/_jsx("span", {
409
- className: stl(_templateObject27 || (_templateObject27 = _taggedTemplateLiteral(["w-full py-2 truncate text-center text-grey-900"]))),
433
+ className: stl(_templateObject29 || (_templateObject29 = _taggedTemplateLiteral(["w-full py-2 truncate text-center text-grey-900"]))),
410
434
  children: item.label
411
435
  }, item.value) : /*#__PURE__*/_jsx(OptionItem, {
412
436
  multiple: Boolean(multiple),
@@ -418,11 +442,12 @@ export var AutoComplete = function AutoComplete(_ref) {
418
442
  })
419
443
  }))
420
444
  }), !!menuFooter && /*#__PURE__*/_jsx("footer", {
421
- className: stl(_templateObject28 || (_templateObject28 = _taggedTemplateLiteral(["flex items-center justify-center min-h-12 p-4 bg-grey-100 border-t border-grey-200 text-grey-600"]))),
445
+ className: stl(_templateObject30 || (_templateObject30 = _taggedTemplateLiteral(["flex items-center justify-center min-h-12 p-4 bg-grey-100 border-t border-grey-200 text-grey-600"]))),
422
446
  children: menuFooter
423
447
  })]
424
448
  }))
425
449
  }))]
426
450
  })
427
451
  });
428
- };
452
+ });
453
+ AutoComplete.displayName = "AutoComplete";
@@ -24,6 +24,7 @@ var autoCompletePlugin = plugin(function (_ref) {
24
24
  border: "1px solid ".concat(theme("colors.grey.500")),
25
25
  boxShadow: "inset 0px 1px 4px 0px ".concat(rgba(theme("colors.grey.500"), 0.3)),
26
26
  transition: "all 100ms ease-in-out",
27
+ outline: "1px solid transparent",
27
28
  "&:not(.autocomplete-disabled, .autocomplete-focused):hover": {
28
29
  borderColor: theme("colors.grey.600")
29
30
  },
@@ -59,7 +60,14 @@ var autoCompletePlugin = plugin(function (_ref) {
59
60
  },
60
61
  ".autocomplete-invalid:not(.autocomplete-disabled)": {
61
62
  backgroundColor: theme("colors.red.100"),
62
- borderColor: theme("colors.red.700")
63
+ borderColor: theme("colors.red.700"),
64
+ "&:hover": {
65
+ backgroundColor: theme("colors.red.50"),
66
+ borderColor: theme("colors.red.700")
67
+ },
68
+ "&.autocomplete-focused, &.autocomplete-container:focus-within": {
69
+ outlineColor: theme("colors.red.700")
70
+ }
63
71
  },
64
72
  ".autocomplete-nowrap": {
65
73
  overflowX: "scroll",
@@ -15,6 +15,7 @@ export interface AutoCompleteBaseProps<T extends Option = Option> {
15
15
  labelId?: string;
16
16
  icon?: IconComponentType;
17
17
  name?: string;
18
+ required?: boolean;
18
19
  className?: string;
19
20
  valuesClassName?: string;
20
21
  menuClassName?: string;
@@ -19,5 +19,5 @@ export declare type CheckboxProps = CheckboxInputProps & CheckboxCustomProps;
19
19
  *
20
20
  * See the [Checkbox documentation page](https://satellite.algolia.com/components/controls/checkbox) for more information.
21
21
  */
22
- export declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLInputElement>, "onChange"> & Pick<InputHTMLAttributes<HTMLInputElement>, "defaultChecked" | "onChange" | "autoFocus" | "disabled" | "checked" | "required"> & CheckboxCustomProps & import("react").RefAttributes<HTMLInputElement>>;
22
+ export declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLInputElement>, "onChange"> & Pick<InputHTMLAttributes<HTMLInputElement>, "defaultChecked" | "onChange" | "required" | "autoFocus" | "disabled" | "checked"> & CheckboxCustomProps & import("react").RefAttributes<HTMLInputElement>>;
23
23
  export {};
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
5
- var _excluded = ["children", "className", "textPosition", "indeterminate", "defaultChecked", "checkedColor", "checked", "disabled"];
5
+ var _excluded = ["children", "className", "textPosition", "indeterminate", "defaultChecked", "checkedColor", "checked", "disabled", "required"];
6
6
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
7
7
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
8
8
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -12,11 +12,9 @@ import { useField } from "../Field";
12
12
  import { CheckIcon, MinusIcon } from "../Icons";
13
13
  import stl from "../styles/helpers/satellitePrefixer";
14
14
  import { isRenderedChild } from "../utils/isRenderedChild";
15
+ import { uniqueId } from "../utils/uniqueId";
15
16
  import { jsx as _jsx } from "react/jsx-runtime";
16
17
  import { jsxs as _jsxs } from "react/jsx-runtime";
17
- var generateFieldId = function generateFieldId() {
18
- return Math.random().toString(36).substring(7);
19
- };
20
18
  var STATUS_CLASSNAMES = {
21
19
  "default": "",
22
20
  invalid: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["checkbox-invalid"]))),
@@ -38,13 +36,19 @@ export var Checkbox = /*#__PURE__*/forwardRef(function (_ref, ref) {
38
36
  checkedColor = _ref.checkedColor,
39
37
  checked = _ref.checked,
40
38
  disabled = _ref.disabled,
39
+ required = _ref.required,
41
40
  checkboxProps = _objectWithoutProperties(_ref, _excluded);
42
- var id = useMemo(function () {
43
- return checkboxProps.id || generateFieldId();
44
- }, [checkboxProps.id]);
45
- var _useField = useField(),
41
+ var _useField = useField({
42
+ required: required
43
+ }),
46
44
  status = _useField.state.status,
47
- labelId = _useField.labelId;
45
+ labelId = _useField.labelId,
46
+ descriptionId = _useField.descriptionId,
47
+ inputId = _useField.inputId;
48
+ var id = useMemo(function () {
49
+ var _ref2, _checkboxProps$id;
50
+ return (_ref2 = (_checkboxProps$id = checkboxProps.id) !== null && _checkboxProps$id !== void 0 ? _checkboxProps$id : inputId) !== null && _ref2 !== void 0 ? _ref2 : uniqueId("checkbox");
51
+ }, [checkboxProps.id, inputId]);
48
52
  var isControlled = typeof checked === "boolean";
49
53
  var _useState = useState(Boolean(isControlled ? checked : defaultChecked)),
50
54
  _useState2 = _slicedToArray(_useState, 2),
@@ -69,10 +73,14 @@ export var Checkbox = /*#__PURE__*/forwardRef(function (_ref, ref) {
69
73
  },
70
74
  children: [/*#__PURE__*/_jsx(CheckboxIcon, {
71
75
  className: stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["checkbox-icon"])))
72
- }), /*#__PURE__*/_jsx("input", _objectSpread(_objectSpread({}, checkboxProps), {}, {
73
- "aria-checked": indeterminate ? "mixed" : isChecked,
74
- id: id,
76
+ }), /*#__PURE__*/_jsx("input", _objectSpread(_objectSpread({
75
77
  "aria-labelledby": labelId,
78
+ "aria-describedby": descriptionId
79
+ }, checkboxProps), {}, {
80
+ id: id !== null && id !== void 0 ? id : inputId,
81
+ required: required,
82
+ "aria-invalid": status === "invalid",
83
+ "aria-checked": indeterminate ? "mixed" : isChecked,
76
84
  className: stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n opacity-0 absolute inset-0\n ", "\n "])), disabled ? "cursor-not-allowed" : "cursor-pointer"),
77
85
  type: "checkbox",
78
86
  ref: ref,
@@ -82,7 +90,7 @@ export var Checkbox = /*#__PURE__*/forwardRef(function (_ref, ref) {
82
90
  }))]
83
91
  }), isRenderedChild(children) && /*#__PURE__*/_jsx("label", {
84
92
  className: stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display-body\n ", "\n ", "\n "])), disabled && "text-grey-300 cursor-not-allowed", textPosition === "left" ? "pr-2" : "pl-2"),
85
- htmlFor: id,
93
+ htmlFor: id !== null && id !== void 0 ? id : inputId,
86
94
  children: children
87
95
  })]
88
96
  });
@@ -34,14 +34,20 @@ var checkboxPlugin = plugin(function (_ref) {
34
34
  }
35
35
  },
36
36
  ".group\\/checkbox:hover": {
37
- "& > .checkbox:not(.checkbox-disabled, .checkbox-checked, .checkbox-indeterminate, :has(input:focus))": {
37
+ "& > .checkbox:not(.checkbox-disabled, .checkbox-checked, .checkbox-indeterminate, .checkbox-invalid, :has(input:focus))": {
38
38
  borderColor: theme("colors.grey.600")
39
39
  }
40
40
  },
41
41
  ".checkbox-invalid:not(.checkbox-disabled)": {
42
42
  color: theme("colors.red.700"),
43
43
  background: theme("colors.red.100"),
44
- borderColor: "currentColor"
44
+ borderColor: "currentColor",
45
+ "&:hover": {
46
+ background: theme("colors.red.50")
47
+ },
48
+ "&:focus-within": {
49
+ outline: "1px solid ".concat(theme("colors.red.700"))
50
+ }
45
51
  },
46
52
  ".checkbox-checked, .checkbox-indeterminate": {
47
53
  borderColor: "currentColor",
@@ -1,4 +1,4 @@
1
- import type { Dispatch, MouseEvent, ReactNode, VFC } from "react";
1
+ import type { Dispatch, MouseEvent, ReactNode } from "react";
2
2
  import type { DatePickerCalendarProps } from "../components/Calendar";
3
3
  import type { DatePickerDisplayProps } from "../components/Display";
4
4
  import type { DatePickerFooterActionsProps } from "../components/FooterActions";
@@ -17,6 +17,7 @@ interface RenderTargetParams {
17
17
  isOpen: boolean;
18
18
  }
19
19
  export declare type DatePickerProps = {
20
+ id?: string;
20
21
  calendarProps?: Pick<DatePickerCalendarProps, "fromMonth" | "toMonth" | "disabled">;
21
22
  onOpen?: DatePickerDisplayProps["onClick"];
22
23
  onChange?: (value: Date | null) => void;
@@ -29,11 +30,12 @@ export declare type DatePickerProps = {
29
30
  value?: Date | null;
30
31
  initialValue?: Date | null;
31
32
  buttonSize?: DatePickerDisplayProps["size"];
33
+ required?: boolean;
32
34
  } & SharedDatePickerProps;
33
35
  /**
34
36
  * The `DatePicker` component allows users to easily select a date, featuring a calendar view, month/year navigation, and custom options.
35
37
  *
36
38
  * See the [Date Picker documentation page](https://satellite.algolia.com/layouts/date-picker) for more information.
37
39
  */
38
- export declare const DatePicker: VFC<DatePickerProps>;
40
+ export declare const DatePicker: import("react").ForwardRefExoticComponent<DatePickerProps & import("react").RefAttributes<HTMLButtonElement>>;
39
41
  export {};
@@ -1,10 +1,11 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- var _templateObject, _templateObject2, _templateObject3, _templateObject4;
4
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
5
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
- import { useMemo, useReducer, useState } from "react";
7
+ import { forwardRef, useMemo, useReducer, useState } from "react";
8
+ import { useField } from "../../Field";
8
9
  import { useLocale } from "../../Satellite";
9
10
  import stl from "../../styles/helpers/satellitePrefixer";
10
11
  import { DatePickerCalendar } from "../components/Calendar";
@@ -23,8 +24,8 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
23
24
  *
24
25
  * See the [Date Picker documentation page](https://satellite.algolia.com/layouts/date-picker) for more information.
25
26
  */
26
- export var DatePicker = function DatePicker(props) {
27
- var _props$initialValue, _props$validate, _props$calendarProps;
27
+ export var DatePicker = /*#__PURE__*/forwardRef(function (props, ref) {
28
+ var _props$initialValue, _props$validate, _props$id, _props$calendarProps;
28
29
  var contextLocale = useLocale("datePicker");
29
30
  var locale = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_DATE_PICKER_LOCALE), contextLocale), props.locale);
30
31
  var _useState = useState(null),
@@ -89,6 +90,12 @@ export var DatePicker = function DatePicker(props) {
89
90
  },
90
91
  // eslint-disable-next-line react-hooks/exhaustive-deps
91
92
  [props]);
93
+ var _useField = useField({
94
+ required: props.required || false
95
+ }),
96
+ status = _useField.state.status,
97
+ inputId = _useField.inputId;
98
+ var isInvalid = status === "invalid";
92
99
  return /*#__PURE__*/_jsxs("div", {
93
100
  children: [/*#__PURE__*/_jsx("span", {
94
101
  ref: setTargetElement,
@@ -97,15 +104,18 @@ export var DatePicker = function DatePicker(props) {
97
104
  toggle: state.show ? handleClose : handleOpen,
98
105
  isOpen: state.show
99
106
  }) : /*#__PURE__*/_jsx(DatePickerDisplay, {
107
+ id: (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : inputId,
108
+ ref: ref,
100
109
  onClick: state.show ? handleClose : handleOpen,
101
110
  size: props.buttonSize,
111
+ className: isInvalid ? stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["border-red-700 bg-red-100 bg-none focus:outline-1 focus:outline focus:outline-red-700 focus:shadow-none focus:bg-none focus:bg-red-100 focus:border-red-700 hover:border-red-700 hover:bg-red-50 hover:bg-none"]))) : undefined,
102
112
  children: value ? /*#__PURE__*/_jsx("time", {
103
113
  dateTime: value.toISOString(),
104
114
  children: formatDate(value)
105
115
  }) : locale.openButton
106
116
  })
107
117
  }), /*#__PURE__*/_jsx(DatePickerModal, {
108
- className: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["date-picker"]))),
118
+ className: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["date-picker"]))),
109
119
  show: state.show,
110
120
  onClickAway: function onClickAway(evt) {
111
121
  if (!(targetElement !== null && targetElement !== void 0 && targetElement.contains(evt.target))) {
@@ -118,7 +128,7 @@ export var DatePicker = function DatePicker(props) {
118
128
  targetElement: targetElement,
119
129
  placement: props.modalPlacement,
120
130
  children: /*#__PURE__*/_jsxs("div", {
121
- className: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["flex"]))),
131
+ className: stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["flex"]))),
122
132
  children: [/*#__PURE__*/_jsxs("div", {
123
133
  children: [/*#__PURE__*/_jsx(DatePickerCalendar, _objectSpread(_objectSpread(_objectSpread({
124
134
  mode: "single",
@@ -144,7 +154,7 @@ export var DatePicker = function DatePicker(props) {
144
154
  })]
145
155
  }), props.renderRightPanel && /*#__PURE__*/_jsxs(_Fragment, {
146
156
  children: [/*#__PURE__*/_jsx("div", {
147
- className: stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["h-full w-px bg-red-800"])))
157
+ className: stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["h-full w-px bg-red-800"])))
148
158
  }), /*#__PURE__*/_jsxs(DatePickerSidePanel, {
149
159
  children: [props.renderRightPanel({
150
160
  state: state,
@@ -160,4 +170,5 @@ export var DatePicker = function DatePicker(props) {
160
170
  })
161
171
  })]
162
172
  });
163
- };
173
+ });
174
+ DatePicker.displayName = "DatePicker";
@@ -1,9 +1,9 @@
1
- import type { ReactNode, VFC } from "react";
1
+ import type { ReactNode } from "react";
2
2
  import type { ButtonProps, ButtonSize } from "../../Button";
3
- export interface DatePickerDisplayProps {
3
+ export interface DatePickerDisplayProps extends ButtonProps {
4
4
  id?: string;
5
5
  onClick: ButtonProps["onClick"];
6
6
  children: ReactNode;
7
7
  size?: ButtonSize;
8
8
  }
9
- export declare const DatePickerDisplay: VFC<DatePickerDisplayProps>;
9
+ export declare const DatePickerDisplay: import("react").ForwardRefExoticComponent<DatePickerDisplayProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -1,16 +1,26 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["id", "size", "onClick", "children"];
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ import { forwardRef } from "react";
1
7
  import { Button } from "../../Button";
2
8
  import { CalendarIcon } from "../../Icons";
3
9
  import { jsx as _jsx } from "react/jsx-runtime";
4
- export var DatePickerDisplay = function DatePickerDisplay(_ref) {
10
+ export var DatePickerDisplay = /*#__PURE__*/forwardRef(function (_ref, ref) {
5
11
  var id = _ref.id,
6
12
  size = _ref.size,
7
13
  onClick = _ref.onClick,
8
- children = _ref.children;
9
- return /*#__PURE__*/_jsx(Button, {
14
+ children = _ref.children,
15
+ props = _objectWithoutProperties(_ref, _excluded);
16
+ return /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
10
17
  id: id,
11
18
  size: size,
12
19
  startIcon: CalendarIcon,
13
20
  onClick: onClick,
21
+ ref: ref
22
+ }, props), {}, {
14
23
  children: children
15
- });
16
- };
24
+ }));
25
+ });
26
+ DatePickerDisplay.displayName = "Display";
@@ -1,4 +1,4 @@
1
- import type { VFC } from "react";
1
+ /// <reference types="react" />
2
2
  import type { FileRejection, DropzoneProps as ReactDropZoneProps } from "react-dropzone";
3
3
  export declare type DropzoneLocale = {
4
4
  clearInput?: string;
@@ -14,6 +14,8 @@ export interface DropzoneBaseProps {
14
14
  className?: string;
15
15
  /** @default false */
16
16
  multiple?: boolean;
17
+ /** @default false */
18
+ required?: boolean;
17
19
  locale?: DropzoneLocale;
18
20
  }
19
21
  export declare type DropzoneProps = DropzoneBaseProps & Omit<ReactDropZoneProps, "onDrop" | "onDropAccepted" | "onDropRejected" | "multiple">;
@@ -22,4 +24,4 @@ export declare type DropzoneProps = DropzoneBaseProps & Omit<ReactDropZoneProps,
22
24
  *
23
25
  * See the [Dropzone documentation page](https://satellite.algolia.com/components/forms/dropzone) for more information.
24
26
  */
25
- export declare const Dropzone: VFC<DropzoneProps>;
27
+ export declare const Dropzone: import("react").ForwardRefExoticComponent<DropzoneBaseProps & Omit<ReactDropZoneProps, "onDrop" | "multiple" | "onDropAccepted" | "onDropRejected"> & import("react").RefAttributes<HTMLInputElement>>;