@algolia/satellite 1.7.0 → 1.9.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 (70) hide show
  1. package/dist/cjs/Actions/Button/PolymorphicButton.js +2 -2
  2. package/dist/cjs/Actions/Button/PolymorphicIconButton.js +2 -2
  3. package/dist/cjs/Actions/Button/types.d.ts +2 -2
  4. package/dist/cjs/Fields/AutoComplete/AutoComplete.js +15 -15
  5. package/dist/cjs/Fields/DatePicker/components/Calendar.js +1 -4
  6. package/dist/cjs/Fields/Field/Field.js +11 -1
  7. package/dist/cjs/Fields/Field/FieldContext.d.ts +1 -0
  8. package/dist/cjs/Fields/Field/useField.d.ts +2 -1
  9. package/dist/cjs/Fields/Field/useField.js +7 -2
  10. package/dist/cjs/Fields/Form/stories/ExtraErrors.js +6 -19
  11. package/dist/cjs/Fields/Form/stories/MultiStep.js +13 -35
  12. package/dist/cjs/Fields/Form/stories/ValidationStrategies.js +13 -30
  13. package/dist/cjs/Fields/RangeSlider/RangeSlider.js +7 -8
  14. package/dist/cjs/Helpers/Separator/Separator.js +1 -4
  15. package/dist/cjs/Icons/index.d.ts +1 -1
  16. package/dist/cjs/Icons/index.js +6 -0
  17. package/dist/cjs/Indicators/ScrollIndicator/ScrollIndicator.js +1 -2
  18. package/dist/cjs/Layout/Tables/DataTable/DataTable.d.ts +1 -1
  19. package/dist/cjs/Layout/Tables/DataTable/components/Body.d.ts +1 -1
  20. package/dist/cjs/Layout/Tables/DataTable/components/Header.d.ts +1 -1
  21. package/dist/cjs/Layout/Tables/DataTable/components/HeaderCell.d.ts +1 -1
  22. package/dist/cjs/Layout/Tables/DataTable/utils.d.ts +1 -1
  23. package/dist/cjs/Navigation/Stepper/Step.js +8 -7
  24. package/dist/cjs/Navigation/Stepper/Stepper.d.ts +6 -0
  25. package/dist/cjs/Navigation/Stepper/Stepper.js +9 -3
  26. package/dist/cjs/Navigation/Stepper/StepperContext.d.ts +2 -1
  27. package/dist/cjs/Overlay/Dropdown/DropdownContext.d.ts +1 -1
  28. package/dist/cjs/Overlay/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsGroupContext.d.ts +1 -1
  29. package/dist/cjs/Overlay/MenuButton/components/collapsible/CollapsibleItemsGroupContext.d.ts +1 -1
  30. package/dist/cjs/Overlay/Modal/Modal.d.ts +1 -1
  31. package/dist/cjs/Overlay/Popover/Popover.js +6 -0
  32. package/dist/cjs/Overlay/Popover/types.d.ts +5 -3
  33. package/dist/cjs/styles/helpers/makePurgeCssExtractor.js +3 -3
  34. package/dist/cjs/utils/useTriggerInputChange.js +4 -3
  35. package/dist/esm/Actions/Button/PolymorphicButton.js +2 -2
  36. package/dist/esm/Actions/Button/PolymorphicIconButton.js +2 -2
  37. package/dist/esm/Actions/Button/types.d.ts +2 -2
  38. package/dist/esm/Fields/AutoComplete/AutoComplete.js +15 -15
  39. package/dist/esm/Fields/DatePicker/components/Calendar.js +1 -4
  40. package/dist/esm/Fields/Field/Field.js +11 -1
  41. package/dist/esm/Fields/Field/FieldContext.d.ts +1 -0
  42. package/dist/esm/Fields/Field/useField.d.ts +2 -1
  43. package/dist/esm/Fields/Field/useField.js +7 -2
  44. package/dist/esm/Fields/Form/stories/ExtraErrors.js +6 -19
  45. package/dist/esm/Fields/Form/stories/MultiStep.js +13 -35
  46. package/dist/esm/Fields/Form/stories/ValidationStrategies.js +13 -30
  47. package/dist/esm/Fields/RangeSlider/RangeSlider.js +8 -9
  48. package/dist/esm/Helpers/Separator/Separator.js +1 -4
  49. package/dist/esm/Icons/index.d.ts +1 -1
  50. package/dist/esm/Icons/index.js +1 -1
  51. package/dist/esm/Indicators/ScrollIndicator/ScrollIndicator.js +1 -2
  52. package/dist/esm/Layout/Tables/DataTable/DataTable.d.ts +1 -1
  53. package/dist/esm/Layout/Tables/DataTable/components/Body.d.ts +1 -1
  54. package/dist/esm/Layout/Tables/DataTable/components/Header.d.ts +1 -1
  55. package/dist/esm/Layout/Tables/DataTable/components/HeaderCell.d.ts +1 -1
  56. package/dist/esm/Layout/Tables/DataTable/utils.d.ts +1 -1
  57. package/dist/esm/Navigation/Stepper/Step.js +8 -7
  58. package/dist/esm/Navigation/Stepper/Stepper.d.ts +6 -0
  59. package/dist/esm/Navigation/Stepper/Stepper.js +9 -3
  60. package/dist/esm/Navigation/Stepper/StepperContext.d.ts +2 -1
  61. package/dist/esm/Overlay/Dropdown/DropdownContext.d.ts +1 -1
  62. package/dist/esm/Overlay/Dropdown/components/DropdownCollapsibleItem/DropdownCollapsibleItemsGroupContext.d.ts +1 -1
  63. package/dist/esm/Overlay/MenuButton/components/collapsible/CollapsibleItemsGroupContext.d.ts +1 -1
  64. package/dist/esm/Overlay/Modal/Modal.d.ts +1 -1
  65. package/dist/esm/Overlay/Popover/Popover.js +6 -0
  66. package/dist/esm/Overlay/Popover/types.d.ts +5 -3
  67. package/dist/esm/styles/helpers/makePurgeCssExtractor.js +3 -3
  68. package/dist/esm/utils/useTriggerInputChange.js +4 -3
  69. package/dist/satellite.min.css +1 -1
  70. package/package.json +19 -19
@@ -1,4 +1,4 @@
1
1
  import type { AdvancedColumnDefinition, DeterminatePagination, IndeterminatePagination, PaginationConfiguration, Row } from "./types";
2
2
  export declare const isDeterminatePagination: (pagination: PaginationConfiguration) => pagination is DeterminatePagination;
3
3
  export declare const isIndeterminatePagination: (pagination: PaginationConfiguration) => pagination is IndeterminatePagination;
4
- export declare const getCellValue: <Item extends {}>(column: AdvancedColumnDefinition<Item>, row: Row<Item>) => any;
4
+ export declare const getCellValue: <Item extends object>(column: AdvancedColumnDefinition<Item>, row: Row<Item>) => any;
@@ -17,7 +17,7 @@ var _uniqueId = require("../../utils/uniqueId");
17
17
  var _StepperContext = require("./StepperContext");
18
18
  var _jsxRuntime = require("react/jsx-runtime");
19
19
  var _excluded = ["className", "index", "icon", "label", "name", "completed", "disabled"];
20
- 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;
20
+ 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, _templateObject31;
21
21
  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; }
22
22
  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) { (0, _defineProperty2["default"])(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; }
23
23
  var BUTTON_SIZE_CLASSNAMES = {
@@ -63,6 +63,7 @@ var Step = exports.Step = function Step(_ref) {
63
63
  var activeLocale = typeof locale.activeStep === "function" ? locale.activeStep(stepName) : locale.activeStep;
64
64
  var completedLocale = typeof locale.completedStep === "function" ? locale.completedStep(stepName) : locale.completedStep;
65
65
  var incompletedLocale = typeof locale.incompletedStep === "function" ? locale.incompletedStep(stepName) : locale.incompletedStep;
66
+ var isVertical = context.orientation === "vertical";
66
67
  var Icon = CustomIcon;
67
68
  if (completed) {
68
69
  Icon = CheckIconInternal;
@@ -78,7 +79,7 @@ var Step = exports.Step = function Step(_ref) {
78
79
  "aria-label": disabled ? disabledLocale : active ? activeLocale : completed ? completedLocale : incompletedLocale,
79
80
  "aria-current": active ? "step" : undefined,
80
81
  disabled: disabled,
81
- tabIndex: index === context.activeStep ? 0 : -1,
82
+ tabIndex: index === context.focusedStep ? 0 : -1,
82
83
  "data-step-idx": index,
83
84
  onClick: function onClick() {
84
85
  var _context$onStepChange;
@@ -96,20 +97,20 @@ var Step = exports.Step = function Step(_ref) {
96
97
  }
97
98
  },
98
99
  children: [context.connectors && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
99
- className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2["default"])(["absolute -z-10 border-l h-full group-last/step:hidden"]))), completed ? (0, _satellitePrefixer["default"])(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2["default"])(["border-green-600"]))) : (0, _satellitePrefixer["default"])(_templateObject19 || (_templateObject19 = (0, _taggedTemplateLiteral2["default"])(["border-grey-200"]))), CONNECTOR_SIZE_CLASSNAMES[context.size])
100
+ className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2["default"])(["absolute -z-10 group-last/step:hidden"]))), isVertical ? (0, _satellitePrefixer["default"])(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2["default"])(["border-l h-full"]))) : (0, _satellitePrefixer["default"])(_templateObject19 || (_templateObject19 = (0, _taggedTemplateLiteral2["default"])(["border-t w-4 -right-px translate-x-full"]))), completed ? (0, _satellitePrefixer["default"])(_templateObject20 || (_templateObject20 = (0, _taggedTemplateLiteral2["default"])(["border-green-600"]))) : (0, _satellitePrefixer["default"])(_templateObject21 || (_templateObject21 = (0, _taggedTemplateLiteral2["default"])(["border-grey-200"]))), isVertical && CONNECTOR_SIZE_CLASSNAMES[context.size])
100
101
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
101
- className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject20 || (_templateObject20 = (0, _taggedTemplateLiteral2["default"])(["rounded-full flex items-center justify-center shrink-0 text-sm"]))), !active && !completed && (0, _satellitePrefixer["default"])(_templateObject21 || (_templateObject21 = (0, _taggedTemplateLiteral2["default"])(["bg-grey-100"]))), !active && !completed && !disabled && (0, _satellitePrefixer["default"])(_templateObject22 || (_templateObject22 = (0, _taggedTemplateLiteral2["default"])(["group-hover/button:bg-white"]))), active && !completed && (0, _satellitePrefixer["default"])(_templateObject23 || (_templateObject23 = (0, _taggedTemplateLiteral2["default"])(["bg-grey-800 text-white"]))), completed && (0, _satellitePrefixer["default"])(_templateObject24 || (_templateObject24 = (0, _taggedTemplateLiteral2["default"])(["bg-green-600 text-white"]))), ICON_SIZE_CLASSNAMES[context.size]),
102
+ className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject22 || (_templateObject22 = (0, _taggedTemplateLiteral2["default"])(["rounded-full flex items-center justify-center shrink-0 text-sm"]))), !active && !completed && (0, _satellitePrefixer["default"])(_templateObject23 || (_templateObject23 = (0, _taggedTemplateLiteral2["default"])(["bg-grey-100"]))), !active && !completed && !disabled && (0, _satellitePrefixer["default"])(_templateObject24 || (_templateObject24 = (0, _taggedTemplateLiteral2["default"])(["group-hover/button:bg-white"]))), active && !completed && (0, _satellitePrefixer["default"])(_templateObject25 || (_templateObject25 = (0, _taggedTemplateLiteral2["default"])(["bg-grey-800 text-white"]))), completed && (0, _satellitePrefixer["default"])(_templateObject26 || (_templateObject26 = (0, _taggedTemplateLiteral2["default"])(["bg-green-600 text-white"]))), ICON_SIZE_CLASSNAMES[context.size]),
102
103
  children: Icon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, {
103
104
  width: ICON_SIZE[context.size],
104
105
  height: ICON_SIZE[context.size]
105
106
  }) : index + 1
106
107
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
107
- className: (0, _clsx["default"])(disabled && (0, _satellitePrefixer["default"])(_templateObject25 || (_templateObject25 = (0, _taggedTemplateLiteral2["default"])(["text-grey-300"])))),
108
+ className: (0, _clsx["default"])(disabled && (0, _satellitePrefixer["default"])(_templateObject27 || (_templateObject27 = (0, _taggedTemplateLiteral2["default"])(["text-grey-300"])))),
108
109
  children: [!!label && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
109
- className: (0, _satellitePrefixer["default"])(_templateObject26 || (_templateObject26 = (0, _taggedTemplateLiteral2["default"])(["text-sm line-clamp-1"]))),
110
+ className: (0, _satellitePrefixer["default"])(_templateObject28 || (_templateObject28 = (0, _taggedTemplateLiteral2["default"])(["text-sm line-clamp-1"]))),
110
111
  children: label
111
112
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
112
- className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject27 || (_templateObject27 = (0, _taggedTemplateLiteral2["default"])(["text-base line-clamp-2"]))), (completed || active) && (0, _satellitePrefixer["default"])(_templateObject28 || (_templateObject28 = (0, _taggedTemplateLiteral2["default"])(["text-grey-900"]))), context.size === "small" && (0, _satellitePrefixer["default"])(_templateObject29 || (_templateObject29 = (0, _taggedTemplateLiteral2["default"])(["text-sm"])))),
113
+ className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject29 || (_templateObject29 = (0, _taggedTemplateLiteral2["default"])(["text-base line-clamp-2"]))), (completed || active) && (0, _satellitePrefixer["default"])(_templateObject30 || (_templateObject30 = (0, _taggedTemplateLiteral2["default"])(["text-grey-900"]))), context.size === "small" && (0, _satellitePrefixer["default"])(_templateObject31 || (_templateObject31 = (0, _taggedTemplateLiteral2["default"])(["text-sm"])))),
113
114
  children: name
114
115
  })]
115
116
  })]
@@ -7,6 +7,7 @@ export declare type StepperLocale = {
7
7
  completedStep?: string | ((stepName: string) => string);
8
8
  };
9
9
  export declare type StepperSizes = "small" | "default" | "large";
10
+ export declare type StepperOrientation = "horizontal" | "vertical";
10
11
  export interface StepperProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
11
12
  /**
12
13
  * Defines the steps of the Stepper.
@@ -27,6 +28,11 @@ export interface StepperProps extends Omit<HTMLAttributes<HTMLDivElement>, "chil
27
28
  * @default "default"
28
29
  */
29
30
  size?: StepperSizes;
31
+ /**
32
+ * Defines the orientation of the Stepper.
33
+ * @default "vertical"
34
+ */
35
+ orientation?: StepperOrientation;
30
36
  /**
31
37
  * Defines whether the connectors should be displayed.
32
38
  * @default true
@@ -17,8 +17,8 @@ var _Step = require("./Step");
17
17
  var _StepperContext = require("./StepperContext");
18
18
  var _utils = require("./utils");
19
19
  var _jsxRuntime = require("react/jsx-runtime");
20
- var _templateObject;
21
- var _excluded = ["steps", "activeStep", "onStepChange", "size", "connectors", "locale", "className"];
20
+ var _templateObject, _templateObject2, _templateObject3;
21
+ var _excluded = ["steps", "activeStep", "onStepChange", "size", "orientation", "connectors", "locale", "className"];
22
22
  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; }
23
23
  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) { (0, _defineProperty2["default"])(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; }
24
24
  var DEFAULT_TAG_LOCALE = {
@@ -41,6 +41,8 @@ var Stepper = exports.Stepper = function Stepper(_ref) {
41
41
  _onStepChange = _ref.onStepChange,
42
42
  _ref$size = _ref.size,
43
43
  size = _ref$size === void 0 ? "default" : _ref$size,
44
+ _ref$orientation = _ref.orientation,
45
+ orientation = _ref$orientation === void 0 ? "vertical" : _ref$orientation,
44
46
  _ref$connectors = _ref.connectors,
45
47
  connectors = _ref$connectors === void 0 ? true : _ref$connectors,
46
48
  propsLocale = _ref.locale,
@@ -87,6 +89,7 @@ var Stepper = exports.Stepper = function Stepper(_ref) {
87
89
  activeStep: activeStep,
88
90
  focusedStep: focusedStep,
89
91
  size: size,
92
+ orientation: orientation,
90
93
  connectors: connectors,
91
94
  locale: locale,
92
95
  onStepChange: function onStepChange(index) {
@@ -103,11 +106,14 @@ var Stepper = exports.Stepper = function Stepper(_ref) {
103
106
  className: (0, _clsx["default"])(className),
104
107
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("ol", {
105
108
  role: "presentation",
106
- className: (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["flex flex-col isolate"]))),
109
+ className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["flex isolate"]))), orientation === "vertical" ? (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["flex-col"]))) : (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["gap-0"])))),
107
110
  ref: containerRef,
108
111
  onFocus: function onFocus() {
109
112
  setFocusedStep(activeStep);
110
113
  },
114
+ onBlur: function onBlur() {
115
+ setFocusedStep(activeStep);
116
+ },
111
117
  onKeyDown: function onKeyDown(event) {
112
118
  switch (event.key) {
113
119
  case "ArrowLeft":
@@ -1,9 +1,10 @@
1
1
  /// <reference types="react" />
2
- import type { StepperLocale, StepperSizes } from "./Stepper";
2
+ import type { StepperLocale, StepperOrientation, StepperSizes } from "./Stepper";
3
3
  export declare type StepperContextType = {
4
4
  activeStep: number;
5
5
  focusedStep: number;
6
6
  size: StepperSizes;
7
+ orientation: StepperOrientation;
7
8
  connectors: boolean;
8
9
  locale: StepperLocale;
9
10
  onStepChange?: (index: number) => void;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  export interface DropdownContextInterface {
3
- showMenu(show: boolean): void;
3
+ showMenu: (show: boolean) => void;
4
4
  }
5
5
  export declare const DropdownContext: import("react").Context<DropdownContextInterface | null>;
6
6
  export declare const useDropdownContext: () => DropdownContextInterface;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export interface DropdownCollapsibleItemsGroupContextInterface {
3
3
  expandedItems: readonly string[];
4
- onItemClick(name: string): void;
4
+ onItemClick: (name: string) => void;
5
5
  }
6
6
  export declare const DropdownCollapsibleItemsGroupContext: import("react").Context<DropdownCollapsibleItemsGroupContextInterface | null>;
7
7
  /** @deprecated */
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export interface CollapsibleItemsGroupContextInterface {
3
3
  expandedItems: readonly string[];
4
- onItemClick(name: string): void;
4
+ onItemClick: (name: string) => void;
5
5
  }
6
6
  export declare const CollapsibleItemsGroupContext: import("react").Context<CollapsibleItemsGroupContextInterface | null>;
7
7
  export declare const useCollapsibleItemsGroup: () => CollapsibleItemsGroupContextInterface;
@@ -44,7 +44,7 @@ export declare type ModalProps = XOR<ModalControlledProps, ModalUncontrolledProp
44
44
  * The element that should receive focus once the `Modal` is opened.
45
45
  * If unspecified, the first focusable element will be focused.
46
46
  * If an element is passed, it will be focused.
47
- * If 'skip' is passed, the close button will be focused if present, with a fallback on the dialog element itself.
47
+ * If 'skipContent' is passed, the close button will be focused if present, with a fallback on the dialog element itself.
48
48
  */
49
49
  autoFocusOnOpenElement?: HTMLElement | null | "skipContent";
50
50
  children: ReactNode;
@@ -64,6 +64,7 @@ var Popover = exports.Popover = function Popover(_ref) {
64
64
  }, []);
65
65
  var isControlled = typeof open !== "undefined";
66
66
  var triggerRef = (0, _react.useRef)(null);
67
+ var closeButtonRef = (0, _react.useRef)(null);
67
68
  var createPortal = (0, _Satellite.useCreatePortal)();
68
69
  if (children.type === _react.Fragment) {
69
70
  throw new Error("Popover component doesn't accept a Fragment as a child.");
@@ -90,6 +91,10 @@ var Popover = exports.Popover = function Popover(_ref) {
90
91
  onOpenAutoFocus: function onOpenAutoFocus(e) {
91
92
  if (autoFocusOnOpenElement === false) {
92
93
  e.preventDefault();
94
+ } else if (autoFocusOnOpenElement === "skipContent") {
95
+ var _closeButtonRef$curre;
96
+ e.preventDefault();
97
+ (_closeButtonRef$curre = closeButtonRef.current) === null || _closeButtonRef$curre === void 0 || _closeButtonRef$curre.focus();
93
98
  } else if (autoFocusOnOpenElement instanceof HTMLElement) {
94
99
  e.preventDefault();
95
100
  autoFocusOnOpenElement.focus();
@@ -123,6 +128,7 @@ var Popover = exports.Popover = function Popover(_ref) {
123
128
  className: (0, _satellitePrefixer["default"])(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["mt-2"]))),
124
129
  children: footer
125
130
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(PopoverPrimitive.Close, {
131
+ ref: closeButtonRef,
126
132
  className: (0, _satellitePrefixer["default"])(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["absolute top-2 right-2"]))),
127
133
  asChild: true,
128
134
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Actions.IconButton, {
@@ -63,10 +63,12 @@ export interface PopoverProps extends Omit<HTMLAttributes<HTMLDivElement>, "titl
63
63
  avoidCollisions?: boolean;
64
64
  /**
65
65
  * The element that should receive focus once the `Popover` is opened.
66
- * If `undefined` or `null` is passed, the first focusable element will be focused.
67
- * If `false`, no element will be focused.
66
+ * If unspecified, the first focusable element will be focused.
67
+ * If an element is passed, it will be focused.
68
+ * If `false`, no element will be focused automatically for you. You should manage focus yourself.
69
+ * If 'skipContent' is passed, the close button will be focused.
68
70
  */
69
- autoFocusOnOpenElement?: HTMLElement | null | false;
71
+ autoFocusOnOpenElement?: HTMLElement | null | false | "skipContent";
70
72
  /**
71
73
  * Defines the locale of the `Popover`.
72
74
  */
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
4
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
3
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
4
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
5
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
6
6
  // @ts-check
7
7
  var prefixTailwindClassName = require("./prefixTailwindClassName");
8
8
 
@@ -11,15 +11,16 @@ var _react = require("react");
11
11
  */
12
12
  var useTriggerInputChange = exports.useTriggerInputChange = function useTriggerInputChange(inputRef) {
13
13
  var triggerInputChange = (0, _react.useCallback)(function (value) {
14
+ var _Object$getOwnPropert;
14
15
  var input = inputRef.current;
15
16
  if (!input) return;
16
17
 
17
- // @ts-ignore
18
- var nativeInputValueSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value").set;
18
+ // eslint-disable-next-line @typescript-eslint/unbound-method
19
+ var nativeInputValueSetter = (_Object$getOwnPropert = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")) === null || _Object$getOwnPropert === void 0 ? void 0 : _Object$getOwnPropert.set;
19
20
  var ev2 = new Event("input", {
20
21
  bubbles: true
21
22
  });
22
- nativeInputValueSetter.call(input, value);
23
+ nativeInputValueSetter === null || nativeInputValueSetter === void 0 || nativeInputValueSetter.call(input, value);
23
24
  input.dispatchEvent(ev2);
24
25
  }, [inputRef]);
25
26
  return triggerInputChange;
@@ -33,7 +33,7 @@ export var PolymorphicButton = /*#__PURE__*/forwardRef(function (props, ref) {
33
33
  children = props.children,
34
34
  cleanedProps = _objectWithoutProperties(props, _excluded);
35
35
  if (loading) {
36
- // @ts-expect-error
36
+ // @ts-expect-error disabled is not present in PolymorphicButtonProps
37
37
  cleanedProps.disabled = true;
38
38
  }
39
39
  var buttonClassName = cx(BASE_CLASSNAMES, BUTTON_SIZE_CLASSNAMES[size], BUTTON_VARIANT_CLASSNAMES[variant], cleanedProps.disabled && stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["btn-disabled"]))), className);
@@ -41,7 +41,7 @@ export var PolymorphicButton = /*#__PURE__*/forwardRef(function (props, ref) {
41
41
  var iconClassNames = cx(getIconColorClassName(props), loading && stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["invisible"]))));
42
42
  var textClassNames = cx(loading && stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["invisible"]))));
43
43
  if (isButtonType(props) && !Object.prototype.hasOwnProperty.call(cleanedProps, "type")) {
44
- // @ts-expect-error
44
+ // @ts-expect-error type is not present in PolymorphicButtonProps
45
45
  cleanedProps.type = "button";
46
46
  }
47
47
  return /*#__PURE__*/_jsxs(Component, _objectSpread(_objectSpread({}, cleanedProps), {}, {
@@ -44,13 +44,13 @@ export var PolymorphicIconButton = /*#__PURE__*/forwardRef(function (props, ref)
44
44
  loading = _props$loading === void 0 ? false : _props$loading,
45
45
  cleanedProps = _objectWithoutProperties(props, _excluded);
46
46
  if (loading) {
47
- // @ts-expect-error
47
+ // @ts-expect-error disabled prop is not present in PolymorphicIconButtonProps
48
48
  cleanedProps.disabled = true;
49
49
  }
50
50
  var iconButtonClassName = cx(BASE_CLASSNAMES, SIZE_CLASSNAMES[size], VARIANT_CLASSNAMES[variant], cleanedProps.disabled && stl(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["btn-disabled"]))), className);
51
51
  var loaderClassNames = stl(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["absolute ", ""])), (variant === "destructive" || variant === "primary") && "text-white");
52
52
  if (isButtonType(props) && !Object.prototype.hasOwnProperty.call(cleanedProps, "type")) {
53
- // @ts-ignore
53
+ // @ts-expect-error type is not present in PolymorphicIconButtonProps
54
54
  cleanedProps.type = "button";
55
55
  }
56
56
  return /*#__PURE__*/_jsx(TooltipWrapper, {
@@ -25,8 +25,8 @@ declare type AsProp<C extends React.ElementType> = {
25
25
  as?: C;
26
26
  };
27
27
  declare type PropsToOmit<C extends React.ElementType, P> = keyof (AsProp<C> & P);
28
- declare type PolymorphicComponentProp<C extends React.ElementType, Props = {}> = React.PropsWithChildren<Props & AsProp<C>> & Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>;
29
- export declare type PolymorphicComponentPropWithRef<C extends React.ElementType, Props = {}> = PolymorphicComponentProp<C, Props> & {
28
+ declare type PolymorphicComponentProp<C extends React.ElementType, Props = object> = React.PropsWithChildren<Props & AsProp<C>> & Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>;
29
+ export declare type PolymorphicComponentPropWithRef<C extends React.ElementType, Props = object> = PolymorphicComponentProp<C, Props> & {
30
30
  ref?: PolymorphicRef<C>;
31
31
  };
32
32
  export declare type PolymorphicRef<C extends React.ElementType> = React.ComponentPropsWithRef<C>["ref"];
@@ -2,7 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
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;
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, _templateObject31;
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";
@@ -271,7 +271,7 @@ export var AutoComplete = /*#__PURE__*/forwardRef(function (_ref, ref) {
271
271
  if (!multiple && value && !newInputValue) {
272
272
  multipleSelection.setSelectedItems([]);
273
273
  }
274
- (_menuPopper$update = menuPopper.update) === null || _menuPopper$update === void 0 || _menuPopper$update.call(menuPopper);
274
+ void ((_menuPopper$update = menuPopper.update) === null || _menuPopper$update === void 0 ? void 0 : _menuPopper$update.call(menuPopper));
275
275
  },
276
276
  // We need to make sure to define event handlers here so that they can be composed properly
277
277
  onFocus: function onFocus(evt) {
@@ -285,7 +285,7 @@ export var AutoComplete = /*#__PURE__*/forwardRef(function (_ref, ref) {
285
285
  },
286
286
  onKeyDown: function onKeyDown(evt) {
287
287
  if (combobox.isOpen && ["ArrowLeft", "ArrowRight"].includes(evt.key)) {
288
- // @ts-expect-error
288
+ // @ts-expect-error wrong type
289
289
  evt.nativeEvent.preventDownshiftDefault = true;
290
290
  }
291
291
  if (multiple && creatable && inputValue.trim().length > 0 && separatorKeys !== null && separatorKeys !== void 0 && separatorKeys.includes(evt.key)) {
@@ -323,7 +323,7 @@ export var AutoComplete = /*#__PURE__*/forwardRef(function (_ref, ref) {
323
323
  if (oldHideMenu.current !== hideMenu) {
324
324
  var _menuPopper$update2;
325
325
  oldHideMenu.current = hideMenu;
326
- (_menuPopper$update2 = menuPopper.update) === null || _menuPopper$update2 === void 0 || _menuPopper$update2.call(menuPopper);
326
+ void ((_menuPopper$update2 = menuPopper.update) === null || _menuPopper$update2 === void 0 ? void 0 : _menuPopper$update2.call(menuPopper));
327
327
  }
328
328
  return /*#__PURE__*/_jsx(AutoCompleteProvider, {
329
329
  locale: locale,
@@ -331,7 +331,7 @@ export var AutoComplete = /*#__PURE__*/forwardRef(function (_ref, ref) {
331
331
  className: cx(stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["flex"]))), className),
332
332
  ref: function ref(el) {
333
333
  setContainerElement(el);
334
- // @ts-expect-error
334
+ // @ts-expect-error - setContainerMeasureRef does accept HTMLDivElement | null
335
335
  setContainerMeasureRef(el);
336
336
  },
337
337
  children: [/*#__PURE__*/_jsxs("div", {
@@ -378,16 +378,16 @@ export var AutoComplete = /*#__PURE__*/forwardRef(function (_ref, ref) {
378
378
  type: "text",
379
379
  placeholder: hasValue ? "" : placeholder,
380
380
  autoComplete: "off",
381
- 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"]))))
381
+ className: cx(stl(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["autocomplete-input"]))), multiple && stl(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["ml-1"]))), shouldRenderCustomTemplate && hasValue ? stl(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["h-0 w-0 opacity-0"]))) : stl(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["py-1.5"]))))
382
382
  }))]
383
383
  }), Boolean(showClearButton || endItem) && /*#__PURE__*/_jsxs("div", {
384
- className: cx(showClearButton && endItem && stl(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["my-2 flex self-end space-x-4"])))),
384
+ className: cx(showClearButton && endItem && stl(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["my-2 flex self-end space-x-4"])))),
385
385
  children: [!!endItem && /*#__PURE__*/_jsx("div", {
386
- className: stl(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["text-grey-700 my-auto"]))),
386
+ className: stl(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["text-grey-700 my-auto"]))),
387
387
  children: endItem
388
388
  }), showClearButton && /*#__PURE__*/_jsx("button", {
389
389
  type: "button",
390
- className: stl(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["w-6 h-6 flex items-center justify-center text-grey-500"]))),
390
+ className: stl(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["w-6 h-6 flex items-center justify-center text-grey-500"]))),
391
391
  onClick: function onClick() {
392
392
  setInternalInputValue("");
393
393
  multipleSelection.setSelectedItems([]);
@@ -401,7 +401,7 @@ export var AutoComplete = /*#__PURE__*/forwardRef(function (_ref, ref) {
401
401
  }), createPortal( /*#__PURE__*/_jsx(ClickAwayContainer, {
402
402
  element: menuRef.current,
403
403
  children: /*#__PURE__*/_jsxs(Card, _objectSpread(_objectSpread({}, menuPopper.attributes), {}, {
404
- className: cx(stl(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["z-dropdown"]))), menuClassName),
404
+ className: cx(stl(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["z-dropdown"]))), menuClassName),
405
405
  style: _objectSpread(_objectSpread(_objectSpread({}, menuPopper.styles.popper), hideMenu && {
406
406
  display: "none"
407
407
  }), {}, {
@@ -412,7 +412,7 @@ export var AutoComplete = /*#__PURE__*/forwardRef(function (_ref, ref) {
412
412
  elevation: "300",
413
413
  fullBleed: true,
414
414
  children: [hideMenu ? /*#__PURE__*/_jsx("div", _objectSpread({}, combobox.getMenuProps())) : items.length === 0 ? /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({}, combobox.getMenuProps({
415
- className: stl(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["min-h-10"])))
415
+ className: stl(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["min-h-10"])))
416
416
  })), {}, {
417
417
  children: /*#__PURE__*/_jsx("div", {
418
418
  role: "option",
@@ -423,15 +423,15 @@ export var AutoComplete = /*#__PURE__*/forwardRef(function (_ref, ref) {
423
423
  })
424
424
  })
425
425
  })) : /*#__PURE__*/_jsx(ScrollIndicator, {
426
- className: menuSize === "large" ? stl(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["max-h-96"]))) : stl(_templateObject25 || (_templateObject25 = _taggedTemplateLiteral(["max-h-64"]))),
426
+ className: menuSize === "large" ? stl(_templateObject25 || (_templateObject25 = _taggedTemplateLiteral(["max-h-96"]))) : stl(_templateObject26 || (_templateObject26 = _taggedTemplateLiteral(["max-h-64"]))),
427
427
  children: /*#__PURE__*/_jsx("ul", _objectSpread(_objectSpread({}, combobox.getMenuProps()), {}, {
428
428
  children: items.map(function (item, index) {
429
429
  return /*#__PURE__*/_jsx("li", _objectSpread(_objectSpread({}, combobox.getItemProps({
430
430
  item: item,
431
- 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"]))))
431
+ className: cx(stl(_templateObject27 || (_templateObject27 = _taggedTemplateLiteral(["autocomplete-result flex items-center min-h-10 px-4 cursor-pointer"]))), index === combobox.highlightedIndex && stl(_templateObject28 || (_templateObject28 = _taggedTemplateLiteral(["bg-grey-100"]))), item.disabled && stl(_templateObject29 || (_templateObject29 = _taggedTemplateLiteral(["cursor-not-allowed"]))))
432
432
  })), {}, {
433
433
  children: item.value === SHOW_ALL_ITEMS_ID ? /*#__PURE__*/_jsx("span", {
434
- className: stl(_templateObject29 || (_templateObject29 = _taggedTemplateLiteral(["w-full py-2 truncate text-center text-grey-900"]))),
434
+ className: stl(_templateObject30 || (_templateObject30 = _taggedTemplateLiteral(["w-full py-2 truncate text-center text-grey-900"]))),
435
435
  children: item.label
436
436
  }, item.value) : /*#__PURE__*/_jsx(OptionItem, {
437
437
  multiple: Boolean(multiple),
@@ -443,7 +443,7 @@ export var AutoComplete = /*#__PURE__*/forwardRef(function (_ref, ref) {
443
443
  })
444
444
  }))
445
445
  }), !!menuFooter && /*#__PURE__*/_jsx("footer", {
446
- 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"]))),
446
+ className: stl(_templateObject31 || (_templateObject31 = _taggedTemplateLiteral(["flex items-center justify-center min-h-12 p-4 bg-grey-100 border-t border-grey-200 text-grey-600"]))),
447
447
  children: menuFooter
448
448
  })]
449
449
  }))
@@ -10,10 +10,7 @@ export var DatePickerCalendar = function DatePickerCalendar(props) {
10
10
  var curatedProps = Object.fromEntries(Object.entries(props).filter(function (_ref) {
11
11
  var _ref2 = _slicedToArray(_ref, 1),
12
12
  key = _ref2[0];
13
- return (
14
- // @ts-expect-error
15
- !excludedDayPickerPropsList.includes(key)
16
- );
13
+ return !excludedDayPickerPropsList.includes(key);
17
14
  }));
18
15
 
19
16
  /**
@@ -50,6 +50,10 @@ export var Field = function Field(_ref) {
50
50
  _useState2 = _slicedToArray(_useState, 2),
51
51
  requiredContext = _useState2[0],
52
52
  setRequiredContext = _useState2[1];
53
+ var _useState3 = useState(undefined),
54
+ _useState4 = _slicedToArray(_useState3, 2),
55
+ elementToFocusContext = _useState4[0],
56
+ setElementToFocusContext = _useState4[1];
53
57
  if (process.env.NODE_ENV !== "production") {
54
58
  if (typeof requiredProp !== "undefined" && typeof requiredContext !== "undefined" && requiredProp !== requiredContext) {
55
59
  console.warn("The `required` prop is set to different values on both the Field (`required=".concat(requiredProp, "`) and the underlying input component (`required=").concat(requiredContext, "`)."));
@@ -78,13 +82,19 @@ export var Field = function Field(_ref) {
78
82
  labelId: labelId,
79
83
  descriptionId: descriptionId,
80
84
  inputId: labelFor,
81
- setRequired: setRequiredContext
85
+ setRequired: setRequiredContext,
86
+ setElementToFocus: setElementToFocusContext
82
87
  },
83
88
  children: /*#__PURE__*/_jsxs("div", {
84
89
  className: className,
85
90
  children: [/*#__PURE__*/_jsxs("label", {
86
91
  className: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["cursor-pointer flex ", ""])), inline ? "items-center" : "flex-col"),
87
92
  htmlFor: labelFor,
93
+ onClick: function onClick() {
94
+ if (!(elementToFocusContext !== null && elementToFocusContext !== void 0 && elementToFocusContext.closest("[aria-disabled=true]")) && !(elementToFocusContext !== null && elementToFocusContext !== void 0 && elementToFocusContext.closest("[disabled=true]"))) {
95
+ elementToFocusContext === null || elementToFocusContext === void 0 || elementToFocusContext.focus();
96
+ }
97
+ },
88
98
  children: [hasLabel && /*#__PURE__*/_jsxs("div", {
89
99
  id: labelId,
90
100
  className: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["truncate ", ""])), inline ? "mr-2" : "mb-1"),
@@ -13,6 +13,7 @@ export declare type FieldContextValue = {
13
13
  descriptionId?: string;
14
14
  inputId?: string;
15
15
  setRequired?: (required?: boolean) => void;
16
+ setElementToFocus?: (elementToFocus?: HTMLElement) => void;
16
17
  };
17
18
  export declare const DEFAULT_FIELD_STATE: FieldState;
18
19
  export declare const DEFAULT_CONTEXT_VALUE: FieldContextValue;
@@ -1,5 +1,6 @@
1
1
  import type { FieldContextValue } from "./FieldContext";
2
2
  export declare type UseFieldProps = {
3
3
  required?: boolean;
4
+ elementToFocus?: HTMLElement;
4
5
  };
5
- export declare const useField: ({ required }?: UseFieldProps) => FieldContextValue;
6
+ export declare const useField: ({ required, elementToFocus }?: UseFieldProps) => FieldContextValue;
@@ -1,19 +1,24 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["setRequired"];
3
+ var _excluded = ["setRequired", "setElementToFocus"];
4
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
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
6
  import { useContext, useEffect } from "react";
7
7
  import { FieldContext } from "./FieldContext";
8
8
  export var useField = function useField() {
9
9
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
10
- required = _ref.required;
10
+ required = _ref.required,
11
+ elementToFocus = _ref.elementToFocus;
11
12
  var _useContext = useContext(FieldContext),
12
13
  setRequired = _useContext.setRequired,
14
+ setElementToFocus = _useContext.setElementToFocus,
13
15
  contextValue = _objectWithoutProperties(_useContext, _excluded);
14
16
  useEffect(function () {
15
17
  return setRequired === null || setRequired === void 0 ? void 0 : setRequired(required);
16
18
  }, [setRequired, required]);
19
+ useEffect(function () {
20
+ return setElementToFocus === null || setElementToFocus === void 0 ? void 0 : setElementToFocus(elementToFocus);
21
+ }, [setElementToFocus, elementToFocus]);
17
22
  return _objectSpread({
18
23
  setRequired: setRequired
19
24
  }, contextValue);
@@ -213,25 +213,12 @@ export var FormikExtraErrorsComponent = function FormikExtraErrorsComponent() {
213
213
  children: /*#__PURE__*/_jsxs("div", {
214
214
  className: stl(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["flex flex-col gap-8 w-full @lg:w-1/2"]))),
215
215
  children: [/*#__PURE__*/_jsxs(Form, {
216
- onSubmit: ( /*#__PURE__*/function () {
217
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(e) {
218
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
219
- while (1) switch (_context3.prev = _context3.next) {
220
- case 0:
221
- setRevalidationEnabled(true);
222
- formik.handleSubmit(e);
223
- // notice that you might want to hook your validations into Formik onSubmit handler (called just above)
224
- // not directly here
225
- case 2:
226
- case "end":
227
- return _context3.stop();
228
- }
229
- }, _callee3);
230
- }));
231
- return function (_x3) {
232
- return _ref3.apply(this, arguments);
233
- };
234
- }()),
216
+ onSubmit: function onSubmit(e) {
217
+ setRevalidationEnabled(true);
218
+ formik.handleSubmit(e);
219
+ // notice that you might want to hook your validations into Formik onSubmit handler (called just above)
220
+ // not directly here
221
+ },
235
222
  onChange: function onChange() {
236
223
  return setExtraErrors([]);
237
224
  },