@economic/taco 0.0.25-alpha.0 → 0.0.26-alpha.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.
@@ -3941,6 +3941,9 @@ var defaultLocalisationTexts = {
3941
3941
  today: 'Today'
3942
3942
  }
3943
3943
  },
3944
+ combobox: {
3945
+ tooltip: 'Search in list'
3946
+ },
3944
3947
  datepicker: {
3945
3948
  calendar: 'Calendar',
3946
3949
  clear: 'Clear',
@@ -4875,6 +4878,7 @@ var useCombobox = function useCombobox(_ref, ref) {
4875
4878
  props = _objectWithoutPropertiesLoose(_ref, _excluded$g);
4876
4879
 
4877
4880
  var inputRef = useProxiedRef(ref);
4881
+ var buttonRef = React.useRef(null);
4878
4882
  var listRef = React.useRef(null);
4879
4883
 
4880
4884
  var _React$useState = React.useState(false),
@@ -5036,8 +5040,18 @@ var useCombobox = function useCombobox(_ref, ref) {
5036
5040
  return;
5037
5041
  }
5038
5042
 
5039
- case keycode('up'):
5040
5043
  case keycode('down'):
5044
+ if (open) {
5045
+ event.preventDefault();
5046
+ } else {
5047
+ if (!inline && buttonRef.current) {
5048
+ buttonRef.current.click();
5049
+ }
5050
+ }
5051
+
5052
+ break;
5053
+
5054
+ case keycode('up'):
5041
5055
  case keycode('home'):
5042
5056
  case keycode('end'):
5043
5057
  {
@@ -5102,7 +5116,7 @@ var useCombobox = function useCombobox(_ref, ref) {
5102
5116
  readOnly: readOnly,
5103
5117
  ref: inputRef,
5104
5118
  type: 'text',
5105
- value: inputValue || ''
5119
+ value: inputValue !== null && inputValue !== void 0 ? inputValue : ''
5106
5120
  });
5107
5121
 
5108
5122
  var list = {
@@ -5117,10 +5131,14 @@ var useCombobox = function useCombobox(_ref, ref) {
5117
5131
  tabIndex: -1,
5118
5132
  value: currentIndex
5119
5133
  };
5134
+ var button = {
5135
+ ref: buttonRef
5136
+ };
5120
5137
  return {
5121
5138
  combobox: combobox,
5122
5139
  input: input,
5123
5140
  list: list,
5141
+ button: button,
5124
5142
  popover: {
5125
5143
  open: open,
5126
5144
  onOpenChange: setOpen
@@ -5173,19 +5191,25 @@ var useBoundingClientRectListener = function useBoundingClientRectListener(ref)
5173
5191
  return dimensions;
5174
5192
  };
5175
5193
 
5176
- var _excluded$h = ["className", "style"];
5194
+ var _excluded$h = ["className", "dialog", "style"];
5177
5195
  var Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
5178
5196
  var externalClassName = props.className,
5197
+ dialog = props.dialog,
5179
5198
  style = props.style,
5180
5199
  otherProps = _objectWithoutPropertiesLoose(props, _excluded$h);
5181
5200
 
5182
5201
  var _useCombobox = useCombobox(otherProps, ref),
5183
5202
  combobox = _useCombobox.combobox,
5203
+ button = _useCombobox.button,
5184
5204
  input = _useCombobox.input,
5185
5205
  popover = _useCombobox.popover,
5186
5206
  list = _useCombobox.list;
5187
5207
 
5188
5208
  var internalRef = React.useRef(null);
5209
+
5210
+ var _useLocalization = useLocalization(),
5211
+ texts = _useLocalization.texts;
5212
+
5189
5213
  var selectDimensions = useBoundingClientRectListener(internalRef);
5190
5214
  var className = cn('inline-flex relative', {
5191
5215
  'yt-combobox--inline': props.inline
@@ -5210,7 +5234,19 @@ var Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
5210
5234
  return popover.onOpenChange(true);
5211
5235
  },
5212
5236
  tabIndex: -1
5213
- }) : props.button
5237
+ }) : dialog ? React.createElement(IconButton, {
5238
+ icon: "list-search",
5239
+ disabled: props.readOnly || props.disabled,
5240
+ dialog: dialog,
5241
+ onFocus: function onFocus() {
5242
+ var _input$ref$current;
5243
+
5244
+ (_input$ref$current = input.ref.current) === null || _input$ref$current === void 0 ? void 0 : _input$ref$current.focus();
5245
+ },
5246
+ ref: button.ref,
5247
+ tabIndex: -1,
5248
+ tooltip: texts.combobox.tooltip
5249
+ }) : undefined
5214
5250
  })))), React.createElement(PopoverPrimitive.Content, {
5215
5251
  align: "start",
5216
5252
  onOpenAutoFocus: function onOpenAutoFocus(event) {
@@ -7615,6 +7651,7 @@ var Select = /*#__PURE__*/React.forwardRef(function Select(props, ref) {
7615
7651
 
7616
7652
  if (editable) {
7617
7653
  return React.createElement(Combobox, Object.assign({}, otherProps, {
7654
+ dialog: undefined,
7618
7655
  inline: true,
7619
7656
  ref: ref
7620
7657
  }));