@algolia/satellite 1.0.0-beta.132 → 1.0.0-beta.133

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 (96) hide show
  1. package/cjs/AnnouncementBadge/AnnouncementBadge.d.ts +1 -0
  2. package/cjs/AnnouncementBadge/AnnouncementBadge.js +3 -2
  3. package/cjs/AutoComplete/AutoComplete.d.ts +24 -14
  4. package/cjs/AutoComplete/AutoComplete.js +84 -15
  5. package/cjs/AutoComplete/components/DefaultOptionItem.d.ts +6 -2
  6. package/cjs/AutoComplete/components/DefaultOptionItem.js +5 -2
  7. package/cjs/AutoComplete/types.d.ts +26 -18
  8. package/cjs/AutoComplete/utils.d.ts +4 -4
  9. package/cjs/DatePicker/DatePicker/DatePicker.d.ts +5 -11
  10. package/cjs/DatePicker/DatePicker/DatePicker.js +10 -6
  11. package/cjs/DatePicker/DateRangePicker/DateRangePicker.d.ts +5 -11
  12. package/cjs/DatePicker/DateRangePicker/DateRangePicker.js +12 -6
  13. package/cjs/DatePicker/DateRangePicker/DateRangePickerDisplay.d.ts +2 -0
  14. package/cjs/DatePicker/DateRangePicker/DateRangePickerDisplay.js +3 -2
  15. package/cjs/DatePicker/components/Calendar.d.ts +4 -1
  16. package/cjs/DatePicker/components/Calendar.js +3 -1
  17. package/cjs/DatePicker/components/Display.d.ts +1 -1
  18. package/cjs/DatePicker/components/FooterActions.d.ts +2 -0
  19. package/cjs/DatePicker/components/FooterActions.js +4 -3
  20. package/cjs/DatePicker/components/Modal.d.ts +2 -2
  21. package/cjs/DatePicker/components/NavBar.d.ts +4 -1
  22. package/cjs/DatePicker/components/NavBar.js +4 -3
  23. package/cjs/DatePicker/types.d.ts +17 -0
  24. package/cjs/DatePicker/types.js +5 -0
  25. package/cjs/HelpUnderline/HelpUnderline.d.ts +1 -0
  26. package/cjs/KeyboardKey/KeyboardKey.d.ts +1 -0
  27. package/cjs/Modal/Modal.d.ts +4 -2
  28. package/cjs/Modal/Modal.js +2 -3
  29. package/cjs/Pagination/CompactPagination/CompactPagination.d.ts +12 -0
  30. package/cjs/Pagination/CompactPagination/CompactPagination.js +6 -6
  31. package/cjs/Pagination/DotPagination/DotPagination.d.ts +4 -1
  32. package/cjs/Pagination/DotPagination/DotPagination.js +5 -2
  33. package/cjs/Pagination/Pagination/Pagination.d.ts +7 -1
  34. package/cjs/Pagination/Pagination/Pagination.js +15 -8
  35. package/cjs/ScrollIndicator/ScrollIndicator.d.ts +2 -0
  36. package/cjs/Sidebar/Sidebar.d.ts +2 -0
  37. package/cjs/Tables/DataTable/DataTable.d.ts +11 -1
  38. package/cjs/Tables/DataTable/DataTable.js +3 -2
  39. package/cjs/Tables/DataTable/components/Body.d.ts +2 -2
  40. package/cjs/Tables/DataTable/components/Body.js +6 -5
  41. package/cjs/Tables/DataTable/components/Loader.d.ts +3 -1
  42. package/cjs/Tables/DataTable/components/Loader.js +4 -3
  43. package/cjs/Tag/Tag.d.ts +4 -1
  44. package/cjs/Tag/Tag.js +3 -2
  45. package/cjs/Tooltip/OverflowTooltipWrapper.d.ts +1 -0
  46. package/cjs/Tooltip/OverflowTooltipWrapper.js +1 -0
  47. package/cjs/utils/pluralize.js +6 -1
  48. package/esm/AnnouncementBadge/AnnouncementBadge.d.ts +1 -0
  49. package/esm/AnnouncementBadge/AnnouncementBadge.js +3 -2
  50. package/esm/AutoComplete/AutoComplete.d.ts +24 -14
  51. package/esm/AutoComplete/AutoComplete.js +85 -15
  52. package/esm/AutoComplete/components/DefaultOptionItem.d.ts +6 -2
  53. package/esm/AutoComplete/components/DefaultOptionItem.js +5 -2
  54. package/esm/AutoComplete/types.d.ts +26 -18
  55. package/esm/AutoComplete/utils.d.ts +4 -4
  56. package/esm/DatePicker/DatePicker/DatePicker.d.ts +5 -11
  57. package/esm/DatePicker/DatePicker/DatePicker.js +10 -6
  58. package/esm/DatePicker/DateRangePicker/DateRangePicker.d.ts +5 -11
  59. package/esm/DatePicker/DateRangePicker/DateRangePicker.js +12 -6
  60. package/esm/DatePicker/DateRangePicker/DateRangePickerDisplay.d.ts +2 -0
  61. package/esm/DatePicker/DateRangePicker/DateRangePickerDisplay.js +3 -2
  62. package/esm/DatePicker/components/Calendar.d.ts +4 -1
  63. package/esm/DatePicker/components/Calendar.js +3 -1
  64. package/esm/DatePicker/components/Display.d.ts +1 -1
  65. package/esm/DatePicker/components/FooterActions.d.ts +2 -0
  66. package/esm/DatePicker/components/FooterActions.js +4 -3
  67. package/esm/DatePicker/components/Modal.d.ts +2 -2
  68. package/esm/DatePicker/components/NavBar.d.ts +4 -1
  69. package/esm/DatePicker/components/NavBar.js +4 -3
  70. package/esm/DatePicker/types.d.ts +17 -0
  71. package/esm/DatePicker/types.js +1 -0
  72. package/esm/HelpUnderline/HelpUnderline.d.ts +1 -0
  73. package/esm/KeyboardKey/KeyboardKey.d.ts +1 -0
  74. package/esm/Modal/Modal.d.ts +4 -2
  75. package/esm/Modal/Modal.js +2 -3
  76. package/esm/Pagination/CompactPagination/CompactPagination.d.ts +12 -0
  77. package/esm/Pagination/CompactPagination/CompactPagination.js +6 -6
  78. package/esm/Pagination/DotPagination/DotPagination.d.ts +4 -1
  79. package/esm/Pagination/DotPagination/DotPagination.js +5 -2
  80. package/esm/Pagination/Pagination/Pagination.d.ts +7 -1
  81. package/esm/Pagination/Pagination/Pagination.js +15 -8
  82. package/esm/ScrollIndicator/ScrollIndicator.d.ts +2 -0
  83. package/esm/Sidebar/Sidebar.d.ts +2 -0
  84. package/esm/Tables/DataTable/DataTable.d.ts +11 -1
  85. package/esm/Tables/DataTable/DataTable.js +3 -2
  86. package/esm/Tables/DataTable/components/Body.d.ts +2 -2
  87. package/esm/Tables/DataTable/components/Body.js +6 -5
  88. package/esm/Tables/DataTable/components/Loader.d.ts +3 -1
  89. package/esm/Tables/DataTable/components/Loader.js +4 -3
  90. package/esm/Tag/Tag.d.ts +4 -1
  91. package/esm/Tag/Tag.js +3 -2
  92. package/esm/Tooltip/OverflowTooltipWrapper.d.ts +1 -0
  93. package/esm/Tooltip/OverflowTooltipWrapper.js +2 -0
  94. package/esm/utils/pluralize.js +6 -1
  95. package/package.json +1 -1
  96. package/satellite.min.css +1 -1
package/cjs/Tag/Tag.d.ts CHANGED
@@ -8,6 +8,9 @@ export interface TagProps extends DetailedHTMLProps<HTMLAttributes<HTMLSpanEleme
8
8
  * */
9
9
  variant?: TagVariants;
10
10
  onDelete?: MouseEventHandler<HTMLElement>;
11
+ locale?: {
12
+ removeButton?: string;
13
+ };
11
14
  }
12
15
  /**
13
16
  * Use tags to visually label UI objects for quick recognition and navigation. (!) **Tags can be added or removed from an object by users**.
@@ -30,5 +33,5 @@ export interface TagProps extends DetailedHTMLProps<HTMLAttributes<HTMLSpanEleme
30
33
  * - When writing tags, avoid line-wrapping
31
34
  * - Define the max width of text within a tag. Once the text reaches the max, truncate with ellipses
32
35
  */
33
- export declare const Tag: import("react").ForwardRefExoticComponent<Pick<TagProps, "hidden" | "dir" | "slot" | "style" | "title" | "color" | "translate" | "children" | "key" | "variant" | "className" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onDelete"> & import("react").RefAttributes<HTMLSpanElement>>;
36
+ export declare const Tag: import("react").ForwardRefExoticComponent<Pick<TagProps, "hidden" | "dir" | "slot" | "style" | "title" | "color" | "translate" | "children" | "key" | "variant" | "className" | "locale" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onDelete"> & import("react").RefAttributes<HTMLSpanElement>>;
34
37
  export default Tag;
package/cjs/Tag/Tag.js CHANGED
@@ -23,7 +23,7 @@ var _satellitePrefixer = _interopRequireDefault(require("../styles/helpers/satel
23
23
 
24
24
  var _jsxRuntime = require("react/jsx-runtime");
25
25
 
26
- var _excluded = ["children", "variant", "className", "onDelete"];
26
+ var _excluded = ["children", "variant", "className", "onDelete", "locale"];
27
27
 
28
28
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17;
29
29
 
@@ -77,6 +77,7 @@ var Tag = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
77
77
  variant = _ref$variant === void 0 ? "grey" : _ref$variant,
78
78
  className = _ref.className,
79
79
  onDelete = _ref.onDelete,
80
+ locale = _ref.locale,
80
81
  props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
81
82
  var title = typeof children === "string" ? children : "tag";
82
83
  var tagClassName = (0, _classnames["default"])((0, _satellitePrefixer["default"])(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["tag"]))), VARIANT_CLASSNAMES[variant], className);
@@ -101,7 +102,7 @@ var Tag = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
101
102
  className: (0, _classnames["default"])((0, _satellitePrefixer["default"])(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2["default"])(["tag-close-button"]))), BUTTON_CLOSE_VARIANT_CLASSNAMES[variant]),
102
103
  type: "button",
103
104
  onClick: handleDelete,
104
- "aria-label": "Remove ".concat(title),
105
+ "aria-label": (locale === null || locale === void 0 ? void 0 : locale.removeButton) || "Remove ".concat(title),
105
106
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFeather.X, {
106
107
  size: "1em"
107
108
  })
@@ -1,5 +1,6 @@
1
1
  import type { FunctionComponent } from "react";
2
2
  import type { TooltipWrapperBaseProps } from "./types";
3
+ /** @ignore */
3
4
  export declare const isOverflowing: (element: HTMLElement) => boolean;
4
5
  export declare const OverflowTooltipWrapper: FunctionComponent<TooltipWrapperBaseProps>;
5
6
  export default OverflowTooltipWrapper;
@@ -39,6 +39,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
39
39
 
40
40
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
41
41
 
42
+ /** @ignore */
42
43
  var isOverflowing = function isOverflowing(element) {
43
44
  return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;
44
45
  };
@@ -17,7 +17,12 @@ function pluralize(count, word, options) {
17
17
  numberFormatter = _Object$assign.numberFormatter;
18
18
 
19
19
  var formattedNumber = numberFormatter(count);
20
- return "".concat(formattedNumber, " ").concat(plural ? plural : "".concat(word, "s"));
20
+
21
+ if (count === 1) {
22
+ return "".concat(formattedNumber, " ").concat(word);
23
+ }
24
+
25
+ return "".concat(formattedNumber, " ").concat(plural || "".concat(word, "s"));
21
26
  }
22
27
 
23
28
  var _default = pluralize;
@@ -4,6 +4,7 @@ export interface AnnouncementBadgeProps extends HTMLAttributes<HTMLSpanElement>
4
4
  size?: AnnouncementBadgeSizes;
5
5
  text?: "new" | "beta" | "internal" | "pilot";
6
6
  variant?: "accent" | "red";
7
+ locale?: string;
7
8
  children?: never;
8
9
  }
9
10
  export declare const AnnouncementBadge: FunctionComponent<AnnouncementBadgeProps>;
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
4
- var _excluded = ["size", "text", "variant", "className"];
4
+ var _excluded = ["size", "text", "variant", "className", "locale"];
5
5
 
6
6
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
7
7
 
@@ -24,12 +24,13 @@ export var AnnouncementBadge = function AnnouncementBadge(_ref) {
24
24
  text = _ref$text === void 0 ? "new" : _ref$text,
25
25
  variantProp = _ref.variant,
26
26
  className = _ref.className,
27
+ locale = _ref.locale,
27
28
  props = _objectWithoutProperties(_ref, _excluded);
28
29
 
29
30
  var variant = typeof variantProp === "string" ? variantProp : text === "internal" ? "red" : "accent";
30
31
  return /*#__PURE__*/_jsx("span", _objectSpread(_objectSpread({}, props), {}, {
31
32
  className: cx(DEFAULT_CLASSNAME, variant === "red" ? stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["bg-red-600"]))) : stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["bg-accent-600"]))), SIZE_CLASSNAMES[size], className),
32
- children: text
33
+ children: locale || text
33
34
  }));
34
35
  };
35
36
  export default AnnouncementBadge;
@@ -1,14 +1,17 @@
1
- import { ControllerStateAndHelpers } from "downshift";
1
+ import type { A11yStatusMessageOptions, ControllerStateAndHelpers } from "downshift";
2
2
  import { Component } from "react";
3
3
  import type { ChangeEvent, FocusEvent, KeyboardEvent, MouseEvent } from "react";
4
4
  import { FieldState } from "../Field/FieldStateContext";
5
- import type { AutoCompleteProps, Option } from "./types";
5
+ import type { AutoCompleteLocale, AutoCompleteProps, Option, OptionItemProps } from "./types";
6
6
  interface State {
7
7
  inputFocused: boolean;
8
8
  inputValue: string;
9
9
  inputWidth?: number;
10
10
  showAllResults: boolean;
11
11
  }
12
+ declare type DefaultOptionProps = OptionItemProps & {
13
+ locale?: AutoCompleteLocale;
14
+ };
12
15
  /**
13
16
  * Autocomplete is a search-as-you-type function that matches what a person types, usually the beginning of a word, or a prefix, with a word list. Not to be confused with auto-suggestion that predicts the end of a query.
14
17
  *
@@ -25,37 +28,44 @@ interface State {
25
28
  * - Provide matching results quickly
26
29
  * - Style different data
27
30
  */
28
- export declare class AutoComplete<T extends Option> extends Component<AutoCompleteProps, State> {
31
+ export declare class AutoComplete<T extends Option = Option> extends Component<AutoCompleteProps<T>, State> {
29
32
  static defaultProps: {
30
33
  clearable: boolean;
31
34
  creatable: boolean;
32
35
  multiple: boolean;
33
36
  maxResults: number;
34
- emptyState: JSX.Element;
35
- createFromInputValue: import("./types").CreateFromInputValue;
37
+ createFromInputValue: <T_1 extends Option = Option>(options: T_1[] | undefined, inputValue: string) => Option[];
36
38
  options: never[];
37
39
  separatorKeyCodes: never[];
38
40
  separatorKeys: never[];
39
- optionItemComponent: import("./types").OptionItemComponentType;
41
+ optionItemComponent: ({ locale, ...props }: DefaultOptionProps) => JSX.Element;
40
42
  noWrap: boolean;
43
+ locale: {
44
+ clearInputButton: string;
45
+ emptyStateTitle: string;
46
+ itemsAvailable: (resultCount: number) => string;
47
+ showMoreButton: (extraResults: number) => string;
48
+ optionItemPrefix: (multiple: boolean) => "Add" | "Use";
49
+ };
41
50
  };
42
51
  state: State;
43
52
  inputContainerRef: HTMLDivElement | null;
44
53
  inputRef: HTMLInputElement | null;
45
- componentDidUpdate(prevProps: AutoCompleteProps): void;
54
+ componentDidUpdate(prevProps: AutoCompleteProps<T>): void;
46
55
  handleClearClick: () => void;
47
56
  handleFakeInputClick: () => void | null;
48
- handleInputBlur: (state: ControllerStateAndHelpers<Option>) => (evt: FocusEvent<HTMLInputElement>) => void;
57
+ handleInputBlur: (state: ControllerStateAndHelpers<T | Option>) => (evt: FocusEvent<HTMLInputElement>) => void;
49
58
  handleInputChange: (evt: ChangeEvent<HTMLInputElement>) => void;
50
59
  handleInputContainerRefUpdate: (el: HTMLDivElement | null) => void;
51
60
  updateInputWidth: () => void;
52
- handleKeyDown: (state: ControllerStateAndHelpers<Option>) => (evt: KeyboardEvent<any>) => void;
53
- handleChange: (option: Option) => void;
61
+ handleKeyDown: (state: ControllerStateAndHelpers<T | Option>) => (evt: KeyboardEvent<any>) => void;
62
+ handleChange: (option: T) => void;
54
63
  handleShowAllResults: (evt: MouseEvent<HTMLButtonElement>) => void;
55
- removeValue: (removedOption: Option) => void;
56
- renderInput: (results: Option[], autocompleteHelpers: ControllerStateAndHelpers<Option>, fieldState: FieldState) => JSX.Element;
57
- renderMenu: (results: Option[], autocompleteHelpers: ControllerStateAndHelpers<Option>) => JSX.Element;
58
- renderSelect: (autocompleteHelpers: ControllerStateAndHelpers<Option>, fieldState: FieldState) => JSX.Element;
64
+ removeValue: (removedOption: T) => void;
65
+ getA11yStatusMessage: (options: A11yStatusMessageOptions<any>) => string;
66
+ renderInput: (results: T[], autocompleteHelpers: ControllerStateAndHelpers<T | Option>, fieldState: FieldState) => JSX.Element;
67
+ renderMenu: (results: T[], autocompleteHelpers: ControllerStateAndHelpers<T | Option>) => JSX.Element;
68
+ renderSelect: (autocompleteHelpers: ControllerStateAndHelpers<T | Option>, fieldState: FieldState) => JSX.Element;
59
69
  render(): JSX.Element;
60
70
  }
61
71
  export default AutoComplete;
@@ -8,17 +8,20 @@ import _inherits from "@babel/runtime/helpers/inherits";
8
8
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
9
9
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
10
10
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
11
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
11
12
 
12
13
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16;
13
14
 
14
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
-
16
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
+ var _excluded = ["locale"];
17
16
 
18
17
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
19
18
 
20
19
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
21
20
 
21
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
22
+
23
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
24
+
22
25
  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; } } }; }
23
26
 
24
27
  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); }
@@ -107,9 +110,31 @@ var MENU_POPPER_MODFIERS = [{
107
110
  }];
108
111
  var BACKSPACE_KEY_CODE = 8;
109
112
 
110
- var defaultEmptyState = /*#__PURE__*/_jsx(AutoCompleteEmptyState, {
111
- title: "No matches found"
112
- });
113
+ /** @ignore */
114
+ var DefaultEmptyState = function DefaultEmptyState(_ref) {
115
+ var _locale$emptyStateTit;
116
+
117
+ var locale = _ref.locale;
118
+ return /*#__PURE__*/_jsx(AutoCompleteEmptyState, {
119
+ title: (_locale$emptyStateTit = locale === null || locale === void 0 ? void 0 : locale.emptyStateTitle) !== null && _locale$emptyStateTit !== void 0 ? _locale$emptyStateTit : AutoComplete.defaultProps.locale.emptyStateTitle
120
+ });
121
+ };
122
+
123
+ /** @ignore */
124
+ var DefaultOption = function DefaultOption(_ref2) {
125
+ var locale = _ref2.locale,
126
+ props = _objectWithoutProperties(_ref2, _excluded);
127
+
128
+ return /*#__PURE__*/_jsx(DefaultOptionItem, _objectSpread(_objectSpread({}, props), {}, {
129
+ locale: {
130
+ optionItemPrefix: function optionItemPrefix(multiple) {
131
+ var _locale$optionItemPre, _locale$optionItemPre2;
132
+
133
+ return (_locale$optionItemPre = locale === null || locale === void 0 ? void 0 : (_locale$optionItemPre2 = locale.optionItemPrefix) === null || _locale$optionItemPre2 === void 0 ? void 0 : _locale$optionItemPre2.call(locale, multiple)) !== null && _locale$optionItemPre !== void 0 ? _locale$optionItemPre : AutoComplete.defaultProps.locale.optionItemPrefix(multiple);
134
+ }
135
+ }
136
+ }));
137
+ };
113
138
  /**
114
139
  * Autocomplete is a search-as-you-type function that matches what a person types, usually the beginning of a word, or a prefix, with a word list. Not to be confused with auto-suggestion that predicts the end of a query.
115
140
  *
@@ -315,7 +340,29 @@ export var AutoComplete = /*#__PURE__*/function (_Component) {
315
340
  _this.props.onChange(newOptions);
316
341
  });
317
342
 
343
+ _defineProperty(_assertThisInitialized(_this), "getA11yStatusMessage", function (options) {
344
+ if (!options.isOpen) {
345
+ return "";
346
+ }
347
+
348
+ if (!options.resultCount) {
349
+ var _this$props$locale$em, _this$props$locale;
350
+
351
+ return (_this$props$locale$em = (_this$props$locale = _this.props.locale) === null || _this$props$locale === void 0 ? void 0 : _this$props$locale.emptyStateTitle) !== null && _this$props$locale$em !== void 0 ? _this$props$locale$em : "";
352
+ }
353
+
354
+ if (options.resultCount > 0) {
355
+ var _this$props$locale$it, _this$props$locale2, _this$props$locale2$i;
356
+
357
+ return (_this$props$locale$it = (_this$props$locale2 = _this.props.locale) === null || _this$props$locale2 === void 0 ? void 0 : (_this$props$locale2$i = _this$props$locale2.itemsAvailable) === null || _this$props$locale2$i === void 0 ? void 0 : _this$props$locale2$i.call(_this$props$locale2, options.resultCount)) !== null && _this$props$locale$it !== void 0 ? _this$props$locale$it : "";
358
+ }
359
+
360
+ return "";
361
+ });
362
+
318
363
  _defineProperty(_assertThisInitialized(_this), "renderInput", function (results, autocompleteHelpers, fieldState) {
364
+ var _this$props$locale3;
365
+
319
366
  var _this$props3 = _this.props,
320
367
  id = _this$props3.id,
321
368
  placeholder = _this$props3.placeholder,
@@ -413,7 +460,7 @@ export var AutoComplete = /*#__PURE__*/function (_Component) {
413
460
  type: "button",
414
461
  className: stl(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["w-6 flex items-center justify-center text-grey-500"]))),
415
462
  onClick: _this.handleClearClick,
416
- "aria-label": "Clear input value",
463
+ "aria-label": (_this$props$locale3 = _this.props.locale) === null || _this$props$locale3 === void 0 ? void 0 : _this$props$locale3.clearInputButton,
417
464
  children: /*#__PURE__*/_jsx(X, {
418
465
  size: ".75rem"
419
466
  })
@@ -430,12 +477,17 @@ export var AutoComplete = /*#__PURE__*/function (_Component) {
430
477
  highlightedIndex = autocompleteHelpers.highlightedIndex,
431
478
  inputValue = autocompleteHelpers.inputValue,
432
479
  isOpen = autocompleteHelpers.isOpen;
480
+
481
+ var defaultEmptyState = /*#__PURE__*/_jsx(DefaultEmptyState, {
482
+ locale: _this.props.locale
483
+ });
484
+
433
485
  var _this$props4 = _this.props,
434
486
  menuClassName = _this$props4.menuClassName,
435
487
  menuSize = _this$props4.menuSize,
436
- _this$props4$emptySta = _this$props4.emptyState,
437
- emptyState = _this$props4$emptySta === void 0 ? AutoComplete.defaultProps.emptyState : _this$props4$emptySta,
438
488
  menuFooter = _this$props4.menuFooter,
489
+ _this$props4$emptySta = _this$props4.emptyState,
490
+ emptyState = _this$props4$emptySta === void 0 ? defaultEmptyState : _this$props4$emptySta,
439
491
  _this$props4$maxResul = _this$props4.maxResults,
440
492
  maxResults = _this$props4$maxResul === void 0 ? AutoComplete.defaultProps.maxResults : _this$props4$maxResul,
441
493
  _this$props4$multiple = _this$props4.multiple,
@@ -470,6 +522,8 @@ export var AutoComplete = /*#__PURE__*/function (_Component) {
470
522
  referenceElement: (_this$inputContainerR3 = _this.inputContainerRef) !== null && _this$inputContainerR3 !== void 0 ? _this$inputContainerR3 : undefined,
471
523
  modifiers: MENU_POPPER_MODFIERS,
472
524
  children: function children(popper) {
525
+ var _this$props$locale4, _this$props$locale4$s;
526
+
473
527
  return /*#__PURE__*/_jsx("div", {
474
528
  className: cx(stl(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["z-dropdown"]))), menuClassName),
475
529
  style: _objectSpread(_objectSpread({}, popper.style), dropdownStyle),
@@ -492,16 +546,17 @@ export var AutoComplete = /*#__PURE__*/function (_Component) {
492
546
  })), {}, {
493
547
  children: /*#__PURE__*/_jsx(OptionItem, _objectSpread(_objectSpread({}, optionItemProps), {}, {
494
548
  highlighted: index === highlightedIndex,
495
- option: result
549
+ option: result,
550
+ locale: _this.props.locale
496
551
  }))
497
552
  }), result.value);
498
553
  }), extraResults > 0 && !showAllResults && /*#__PURE__*/_jsx("li", {
499
554
  className: stl(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["p-2 text-right"]))),
500
- children: /*#__PURE__*/_jsxs(Button, {
555
+ children: /*#__PURE__*/_jsx(Button, {
501
556
  variant: "subtle",
502
557
  size: "small",
503
558
  onMouseDown: _this.handleShowAllResults,
504
- children: ["Show ", pluralize(extraResults, "result"), " more"]
559
+ children: (_this$props$locale4 = _this.props.locale) === null || _this$props$locale4 === void 0 ? void 0 : (_this$props$locale4$s = _this$props$locale4.showMoreButton) === null || _this$props$locale4$s === void 0 ? void 0 : _this$props$locale4$s.call(_this$props$locale4, extraResults)
505
560
  })
506
561
  })]
507
562
  }))
@@ -574,6 +629,7 @@ export var AutoComplete = /*#__PURE__*/function (_Component) {
574
629
  */
575
630
  ,
576
631
  selectedItem: null,
632
+ getA11yStatusMessage: _this2.getA11yStatusMessage,
577
633
  onChange: _this2.handleChange,
578
634
  itemToString: optionToString,
579
635
  defaultHighlightedIndex: 0,
@@ -594,13 +650,27 @@ _defineProperty(AutoComplete, "defaultProps", {
594
650
  creatable: false,
595
651
  multiple: false,
596
652
  maxResults: 7,
597
- emptyState: defaultEmptyState,
598
653
  createFromInputValue: defaultCreateFromInputValue,
599
654
  options: [],
600
655
  separatorKeyCodes: [],
601
656
  separatorKeys: [],
602
- optionItemComponent: DefaultOptionItem,
603
- noWrap: false
657
+ optionItemComponent: DefaultOption,
658
+ noWrap: false,
659
+ locale: {
660
+ clearInputButton: "Clear input value",
661
+ emptyStateTitle: "No matches found",
662
+ itemsAvailable: function itemsAvailable(resultCount) {
663
+ return "".concat(pluralize(resultCount, "item is", {
664
+ plural: "items are"
665
+ }), " available");
666
+ },
667
+ showMoreButton: function showMoreButton(extraResults) {
668
+ return "Show ".concat(pluralize(extraResults, "result"), " more");
669
+ },
670
+ optionItemPrefix: function optionItemPrefix(multiple) {
671
+ return multiple ? "Add" : "Use";
672
+ }
673
+ }
604
674
  });
605
675
 
606
676
  export default AutoComplete;
@@ -1,3 +1,7 @@
1
- import type { OptionItemComponentType } from "../types";
2
- declare const DefaultOptionItem: OptionItemComponentType;
1
+ /// <reference types="react" />
2
+ import type { AutoCompleteLocale, OptionItemProps } from "../types";
3
+ declare type DefaultOptionItemProps = OptionItemProps & {
4
+ locale?: AutoCompleteLocale;
5
+ };
6
+ declare const DefaultOptionItem: ({ option, multiple, locale }: DefaultOptionItemProps) => JSX.Element;
3
7
  export default DefaultOptionItem;
@@ -12,13 +12,16 @@ var metadataSpacer = /*#__PURE__*/_jsx("span", {
12
12
  });
13
13
 
14
14
  var DefaultOptionItem = function DefaultOptionItem(_ref) {
15
+ var _locale$optionItemPre;
16
+
15
17
  var option = _ref.option,
16
- multiple = _ref.multiple;
18
+ multiple = _ref.multiple,
19
+ locale = _ref.locale;
17
20
  return /*#__PURE__*/_jsxs("div", {
18
21
  className: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["truncate py-2"]))),
19
22
  children: [/*#__PURE__*/_jsx("span", {
20
23
  className: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["font-semibold text-md text-grey-900"]))),
21
- children: option["new"] ? "".concat(multiple ? "Add " : "Use ", " ").concat(option.label) : option.label
24
+ children: option["new"] ? "".concat(locale === null || locale === void 0 ? void 0 : (_locale$optionItemPre = locale.optionItemPrefix) === null || _locale$optionItemPre === void 0 ? void 0 : _locale$optionItemPre.call(locale, multiple), " ").concat(option.label) : option.label
22
25
  }), option.metadata && option.metadata.length > 0 && /*#__PURE__*/_jsx("ul", {
23
26
  className: stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["flex text-grey-600"]))),
24
27
  children: option.metadata.map(function (metadata, idx) {
@@ -1,7 +1,14 @@
1
1
  import type { ComponentType, FocusEventHandler, ReactNode } from "react";
2
2
  import type { IconComponentType } from "../types";
3
3
  export declare type AutoCompleteVariant = "medium" | "large";
4
- export interface AutoCompleteBaseProps {
4
+ export declare type AutoCompleteLocale = {
5
+ emptyStateTitle?: string;
6
+ clearInputButton?: string;
7
+ itemsAvailable?: (resultCount: number) => string;
8
+ showMoreButton?: (extraResults: number) => string;
9
+ optionItemPrefix?: (multiple: boolean) => string;
10
+ };
11
+ export interface AutoCompleteBaseProps<T extends Option = Option> {
5
12
  id?: string;
6
13
  icon?: IconComponentType;
7
14
  name?: string;
@@ -12,7 +19,7 @@ export interface AutoCompleteBaseProps {
12
19
  placeholder?: string;
13
20
  disabled?: boolean;
14
21
  autoFocus?: boolean;
15
- options?: Option[];
22
+ options?: T[];
16
23
  inputValue?: string;
17
24
  onTextChange?: (text: string) => any;
18
25
  onFocus?: FocusEventHandler<HTMLInputElement>;
@@ -21,13 +28,13 @@ export interface AutoCompleteBaseProps {
21
28
  clearable?: boolean;
22
29
  selectOnBlur?: boolean;
23
30
  maxResults?: number;
24
- createFromInputValue?: CreateFromInputValue;
31
+ createFromInputValue?: CreateFromInputValue<T>;
25
32
  separatorKeyCodes?: number[];
26
33
  separatorKeys?: string[];
27
- renderValueTemplate?: (args: RenderValueTemplateArgs) => JSX.Element;
34
+ renderValueTemplate?: (args: RenderValueTemplateArgs<T>) => JSX.Element;
28
35
  emptyState?: ReactNode;
29
36
  menuFooter?: ReactNode;
30
- optionItemComponent?: OptionItemComponentType;
37
+ optionItemComponent?: OptionItemComponentType<T>;
31
38
  /** Keep the input on a single line */
32
39
  noWrap?: boolean;
33
40
  endItem?: ReactNode;
@@ -36,18 +43,19 @@ export interface AutoCompleteBaseProps {
36
43
  * @default "medium"
37
44
  */
38
45
  menuSize?: "medium" | "large";
46
+ locale?: AutoCompleteLocale;
39
47
  }
40
- export interface AutoCompleteSingleProps extends AutoCompleteBaseProps {
48
+ export interface AutoCompleteSingleProps<T extends Option = Option> extends AutoCompleteBaseProps<T> {
41
49
  multiple?: false;
42
- value?: Option;
43
- onChange: (option: Option | null) => void;
50
+ value?: T;
51
+ onChange: (option: T | null) => void;
44
52
  }
45
- export interface AutoCompleteMultiProps extends AutoCompleteBaseProps {
53
+ export interface AutoCompleteMultiProps<T extends Option = Option> extends AutoCompleteBaseProps<T> {
46
54
  multiple: true;
47
- value?: Option[];
48
- onChange: (option: Option[] | null) => void;
55
+ value?: T[];
56
+ onChange: (option: T[] | null) => void;
49
57
  }
50
- export declare type AutoCompleteProps = AutoCompleteMultiProps | AutoCompleteSingleProps;
58
+ export declare type AutoCompleteProps<T extends Option = Option> = AutoCompleteMultiProps<T> | AutoCompleteSingleProps<T>;
51
59
  declare type OptionsValue = string | number | boolean;
52
60
  export interface Option {
53
61
  value: OptionsValue;
@@ -57,22 +65,22 @@ export interface Option {
57
65
  disabled?: boolean;
58
66
  bypassNeedleMatch?: boolean;
59
67
  }
60
- export interface OptionItemProps {
61
- option: Option;
68
+ export interface OptionItemProps<T extends Option = Option> {
69
+ option: T;
62
70
  multiple: boolean;
63
71
  inputValue: string;
64
72
  highlighted: boolean;
65
73
  }
66
- export declare type OptionItemComponentType = ComponentType<OptionItemProps>;
74
+ export declare type OptionItemComponentType<T extends Option = Option> = ComponentType<OptionItemProps<T>>;
67
75
  export interface OptionRendererParams {
68
76
  multiple: boolean;
69
77
  inputValue: string;
70
78
  highlighted: boolean;
71
79
  }
72
- export interface RenderValueTemplateArgs {
73
- option: Option;
80
+ export interface RenderValueTemplateArgs<T extends Option = Option> {
81
+ option: T;
74
82
  key: string;
75
83
  editable: boolean;
76
84
  }
77
- export declare type CreateFromInputValue = (options: Option[] | undefined, inputValue: string) => Option[];
85
+ export declare type CreateFromInputValue<T extends Option = Option> = (options: T[] | undefined, inputValue: string) => Option[];
78
86
  export {};
@@ -1,4 +1,4 @@
1
- import type { AutoCompleteMultiProps, AutoCompleteProps, CreateFromInputValue } from "./types";
2
- export declare function isAutoCompleteMultiProps(props: AutoCompleteProps): props is AutoCompleteMultiProps;
3
- export declare const defaultCreateFromInputValue: CreateFromInputValue;
4
- export declare const caseInsensitiveCreateFromInputValue: CreateFromInputValue;
1
+ import type { AutoCompleteMultiProps, AutoCompleteProps, Option } from "./types";
2
+ export declare function isAutoCompleteMultiProps<T extends Option = Option>(props: AutoCompleteProps<T>): props is AutoCompleteMultiProps<T>;
3
+ export declare const defaultCreateFromInputValue: <T extends Option = Option>(options: T[] | undefined, inputValue: string) => Option[];
4
+ export declare const caseInsensitiveCreateFromInputValue: <T extends Option = Option>(options: T[] | undefined, inputValue: string) => Option[];
@@ -1,8 +1,8 @@
1
1
  import type { Dispatch, FunctionComponent, MouseEvent, ReactNode } from "react";
2
- import { CalendarProps } from "../components/Calendar";
3
- import { DisplayProps } from "../components/Display";
4
- import { FooterActionsProps } from "../components/FooterActions";
5
- import { ModalProps } from "../components/Modal";
2
+ import type { CalendarProps } from "../components/Calendar";
3
+ import type { DisplayProps } from "../components/Display";
4
+ import type { FooterActionsProps } from "../components/FooterActions";
5
+ import type { SharedDatePickerProps } from "../types";
6
6
  import { DatePickerReducerAction, DatePickerReducerState } from "./datePickerReducer";
7
7
  interface LeftFooterComponentArgs {
8
8
  state: DatePickerReducerState;
@@ -29,12 +29,6 @@ export declare type DatePickerProps = {
29
29
  value?: Date | null;
30
30
  initialValue?: Date | null;
31
31
  buttonSize?: DisplayProps["size"];
32
- modalPlacement?: ModalProps["placement"];
33
- } & ({
34
- editableYear?: false;
35
- } | {
36
- editableYear: true;
37
- years?: number[];
38
- });
32
+ } & SharedDatePickerProps;
39
33
  declare const DatePicker: FunctionComponent<DatePickerProps>;
40
34
  export default DatePicker;
@@ -23,7 +23,7 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
23
23
  import { Fragment as _Fragment } from "react/jsx-runtime";
24
24
 
25
25
  var DatePicker = function DatePicker(props) {
26
- var _props$initialValue, _props$validate, _props$validate$call, _props$calendarProps;
26
+ var _props$initialValue, _props$validate, _props$validate$call, _props$locale, _props$calendarProps;
27
27
 
28
28
  var _useState = useState(null),
29
29
  _useState2 = _slicedToArray(_useState, 2),
@@ -108,7 +108,7 @@ var DatePicker = function DatePicker(props) {
108
108
  children: value ? /*#__PURE__*/_jsx("time", {
109
109
  dateTime: value.toISOString(),
110
110
  children: formatDate(value)
111
- }) : "Enter a date..."
111
+ }) : ((_props$locale = props.locale) === null || _props$locale === void 0 ? void 0 : _props$locale.openButton) || "Enter a date..."
112
112
  })
113
113
  }), /*#__PURE__*/_jsx(Modal, {
114
114
  className: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["date-picker"]))),
@@ -126,12 +126,14 @@ var DatePicker = function DatePicker(props) {
126
126
  children: /*#__PURE__*/_jsxs("div", {
127
127
  className: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["flex"]))),
128
128
  children: [/*#__PURE__*/_jsxs("div", {
129
- children: [/*#__PURE__*/_jsx(Calendar, _objectSpread(_objectSpread({
129
+ children: [/*#__PURE__*/_jsx(Calendar, _objectSpread(_objectSpread(_objectSpread({
130
130
  numberOfMonths: 1
131
131
  }, (_props$calendarProps = props === null || props === void 0 ? void 0 : props.calendarProps) !== null && _props$calendarProps !== void 0 ? _props$calendarProps : {}), {}, {
132
132
  selectedDays: value !== null && value !== void 0 ? value : undefined,
133
133
  onDayClick: handleDayClick
134
- }, yearProps)), /*#__PURE__*/_jsxs(Footer, {
134
+ }, yearProps), {}, {
135
+ locale: props.locale
136
+ })), /*#__PURE__*/_jsxs(Footer, {
135
137
  children: [props.renderLeftFooter && /*#__PURE__*/_jsx("div", {
136
138
  children: props.renderLeftFooter({
137
139
  state: state,
@@ -140,7 +142,8 @@ var DatePicker = function DatePicker(props) {
140
142
  }), !props.renderRightPanel && /*#__PURE__*/_jsx(FooterActions, {
141
143
  onCancel: handleClose,
142
144
  onApply: handleApply,
143
- disableApply: !isValid
145
+ disableApply: !isValid,
146
+ locale: props.locale
144
147
  })]
145
148
  })]
146
149
  }), props.renderRightPanel && /*#__PURE__*/_jsxs(_Fragment, {
@@ -153,7 +156,8 @@ var DatePicker = function DatePicker(props) {
153
156
  }), /*#__PURE__*/_jsx(FooterActions, {
154
157
  onCancel: handleClose,
155
158
  onApply: handleApply,
156
- disableApply: !isValid
159
+ disableApply: !isValid,
160
+ locale: props.locale
157
161
  })]
158
162
  })]
159
163
  })]