@yamada-ui/autocomplete 1.6.5-dev-20241118173937 → 1.6.5-dev-20241118224412
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/autocomplete-create.js.map +1 -1
- package/dist/autocomplete-create.mjs +2 -2
- package/dist/autocomplete-empty.js.map +1 -1
- package/dist/autocomplete-empty.mjs +2 -2
- package/dist/autocomplete-option.js +10 -6
- package/dist/autocomplete-option.js.map +1 -1
- package/dist/autocomplete-option.mjs +2 -2
- package/dist/autocomplete.js +12 -8
- package/dist/autocomplete.js.map +1 -1
- package/dist/autocomplete.mjs +6 -6
- package/dist/{chunk-6II6KCIJ.mjs → chunk-6QAH2ARG.mjs} +2 -2
- package/dist/{chunk-2UKLSSUA.mjs → chunk-7GVG5MVF.mjs} +2 -2
- package/dist/{chunk-JYPMXZG4.mjs → chunk-7YDPBPBY.mjs} +4 -4
- package/dist/{chunk-NOSATNDY.mjs → chunk-J3GHHVSC.mjs} +7 -5
- package/dist/chunk-J3GHHVSC.mjs.map +1 -0
- package/dist/{chunk-3A2HEULI.mjs → chunk-LCC3VNZV.mjs} +11 -7
- package/dist/chunk-LCC3VNZV.mjs.map +1 -0
- package/dist/{chunk-75VF5Q5W.mjs → chunk-YWUT56L3.mjs} +4 -4
- package/dist/chunk-YWUT56L3.mjs.map +1 -0
- package/dist/{chunk-G6SC44LI.mjs → chunk-ZFWB5LCD.mjs} +2 -2
- package/dist/index.js +15 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/multi-autocomplete.d.mts +8 -0
- package/dist/multi-autocomplete.d.ts +8 -0
- package/dist/multi-autocomplete.js +15 -9
- package/dist/multi-autocomplete.js.map +1 -1
- package/dist/multi-autocomplete.mjs +6 -6
- package/dist/use-autocomplete-option.d.mts +16 -0
- package/dist/use-autocomplete-option.d.ts +16 -0
- package/dist/use-autocomplete-option.js +10 -6
- package/dist/use-autocomplete-option.js.map +1 -1
- package/dist/use-autocomplete-option.mjs +1 -1
- package/dist/use-autocomplete.d.mts +1 -1
- package/dist/use-autocomplete.d.ts +1 -1
- package/dist/use-autocomplete.js +12 -8
- package/dist/use-autocomplete.js.map +1 -1
- package/dist/use-autocomplete.mjs +3 -3
- package/package.json +4 -4
- package/dist/chunk-3A2HEULI.mjs.map +0 -1
- package/dist/chunk-75VF5Q5W.mjs.map +0 -1
- package/dist/chunk-NOSATNDY.mjs.map +0 -1
- /package/dist/{chunk-6II6KCIJ.mjs.map → chunk-6QAH2ARG.mjs.map} +0 -0
- /package/dist/{chunk-2UKLSSUA.mjs.map → chunk-7GVG5MVF.mjs.map} +0 -0
- /package/dist/{chunk-JYPMXZG4.mjs.map → chunk-7YDPBPBY.mjs.map} +0 -0
- /package/dist/{chunk-G6SC44LI.mjs.map → chunk-ZFWB5LCD.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
"use client"
|
2
2
|
import {
|
3
3
|
MultiAutocomplete
|
4
|
-
} from "./chunk-
|
4
|
+
} from "./chunk-J3GHHVSC.mjs";
|
5
5
|
import {
|
6
6
|
Autocomplete
|
7
|
-
} from "./chunk-
|
8
|
-
import "./chunk-
|
7
|
+
} from "./chunk-7YDPBPBY.mjs";
|
8
|
+
import "./chunk-YWUT56L3.mjs";
|
9
9
|
import {
|
10
10
|
AutocompleteCreate
|
11
|
-
} from "./chunk-
|
11
|
+
} from "./chunk-ZFWB5LCD.mjs";
|
12
12
|
import {
|
13
13
|
AutocompleteEmpty
|
14
|
-
} from "./chunk-
|
14
|
+
} from "./chunk-6QAH2ARG.mjs";
|
15
15
|
import "./chunk-REPBXBG3.mjs";
|
16
16
|
import "./chunk-PTPJFYGI.mjs";
|
17
17
|
import {
|
@@ -20,8 +20,8 @@ import {
|
|
20
20
|
import "./chunk-CMFJUJJW.mjs";
|
21
21
|
import {
|
22
22
|
AutocompleteOption
|
23
|
-
} from "./chunk-
|
24
|
-
import "./chunk-
|
23
|
+
} from "./chunk-7GVG5MVF.mjs";
|
24
|
+
import "./chunk-LCC3VNZV.mjs";
|
25
25
|
import "./chunk-6OTUOEYS.mjs";
|
26
26
|
import "./chunk-ZNO5RUVT.mjs";
|
27
27
|
export {
|
@@ -18,6 +18,12 @@ import './autocomplete-option-group.mjs';
|
|
18
18
|
import './use-autocomplete-option-group.mjs';
|
19
19
|
|
20
20
|
interface MultiAutocompleteOptions {
|
21
|
+
/**
|
22
|
+
* If `true`, display the select clear icon.
|
23
|
+
*
|
24
|
+
* @default true
|
25
|
+
*/
|
26
|
+
clearable?: boolean;
|
21
27
|
/**
|
22
28
|
* If `true`, the list element will be closed when value is selected.
|
23
29
|
*
|
@@ -59,6 +65,8 @@ interface MultiAutocompleteOptions {
|
|
59
65
|
* If `true`, display the select clear icon.
|
60
66
|
*
|
61
67
|
* @default true
|
68
|
+
*
|
69
|
+
* @deprecated Use `clearable` instead.
|
62
70
|
*/
|
63
71
|
isClearable?: boolean;
|
64
72
|
/**
|
@@ -18,6 +18,12 @@ import './autocomplete-option-group.js';
|
|
18
18
|
import './use-autocomplete-option-group.js';
|
19
19
|
|
20
20
|
interface MultiAutocompleteOptions {
|
21
|
+
/**
|
22
|
+
* If `true`, display the select clear icon.
|
23
|
+
*
|
24
|
+
* @default true
|
25
|
+
*/
|
26
|
+
clearable?: boolean;
|
21
27
|
/**
|
22
28
|
* If `true`, the list element will be closed when value is selected.
|
23
29
|
*
|
@@ -59,6 +65,8 @@ interface MultiAutocompleteOptions {
|
|
59
65
|
* If `true`, display the select clear icon.
|
60
66
|
*
|
61
67
|
* @default true
|
68
|
+
*
|
69
|
+
* @deprecated Use `clearable` instead.
|
62
70
|
*/
|
63
71
|
isClearable?: boolean;
|
64
72
|
/**
|
@@ -172,13 +172,17 @@ var useAutocompleteOption = (props) => {
|
|
172
172
|
id,
|
173
173
|
children,
|
174
174
|
closeOnSelect: customCloseOnSelect,
|
175
|
+
disabled,
|
176
|
+
focusable,
|
175
177
|
icon: customIcon,
|
176
178
|
isDisabled,
|
177
179
|
isFocusable,
|
178
180
|
value: optionValue,
|
179
181
|
...computedProps
|
180
182
|
} = { ...optionProps, ...props };
|
181
|
-
|
183
|
+
disabled != null ? disabled : disabled = isDisabled;
|
184
|
+
focusable != null ? focusable : focusable = isFocusable;
|
185
|
+
const trulyDisabled = !!disabled && !focusable;
|
182
186
|
const { descendants, index, register } = useAutocompleteDescendant({
|
183
187
|
disabled: trulyDisabled
|
184
188
|
});
|
@@ -204,7 +208,7 @@ var useAutocompleteOption = (props) => {
|
|
204
208
|
const onClick = (0, import_react2.useCallback)(
|
205
209
|
(ev) => {
|
206
210
|
ev.stopPropagation();
|
207
|
-
if (
|
211
|
+
if (disabled || !isTargetOption(ev.currentTarget)) {
|
208
212
|
if (inputRef.current) inputRef.current.focus();
|
209
213
|
return;
|
210
214
|
}
|
@@ -218,7 +222,7 @@ var useAutocompleteOption = (props) => {
|
|
218
222
|
isDuplicated,
|
219
223
|
onFocusNext,
|
220
224
|
omitSelectedValues,
|
221
|
-
|
225
|
+
disabled,
|
222
226
|
optionValue,
|
223
227
|
setFocusedIndex,
|
224
228
|
index,
|
@@ -250,10 +254,10 @@ var useAutocompleteOption = (props) => {
|
|
250
254
|
...props2,
|
251
255
|
id,
|
252
256
|
style: isHidden ? style : void 0,
|
253
|
-
"aria-disabled": (0, import_utils3.ariaAttr)(
|
257
|
+
"aria-disabled": (0, import_utils3.ariaAttr)(disabled),
|
254
258
|
"aria-hidden": (0, import_utils3.ariaAttr)(isHidden),
|
255
259
|
"aria-selected": isSelected,
|
256
|
-
"data-disabled": (0, import_utils3.dataAttr)(
|
260
|
+
"data-disabled": (0, import_utils3.dataAttr)(disabled),
|
257
261
|
"data-duplicated": (0, import_utils3.dataAttr)(isDuplicated),
|
258
262
|
"data-focus": (0, import_utils3.dataAttr)(isFocused),
|
259
263
|
"data-target": (0, import_utils3.dataAttr)(true),
|
@@ -267,7 +271,7 @@ var useAutocompleteOption = (props) => {
|
|
267
271
|
isDuplicated,
|
268
272
|
optionValue,
|
269
273
|
computedProps,
|
270
|
-
|
274
|
+
disabled,
|
271
275
|
isFocused,
|
272
276
|
isSelected,
|
273
277
|
isTarget,
|
@@ -884,8 +888,8 @@ var defaultFormat = (value) => {
|
|
884
888
|
var flattenItems = (items) => {
|
885
889
|
const filterItems = (items2) => items2.map((item) => {
|
886
890
|
var _a;
|
887
|
-
const {
|
888
|
-
const trulyDisabled = !!
|
891
|
+
const { disabled, focusable } = item;
|
892
|
+
const trulyDisabled = !!disabled && !focusable;
|
889
893
|
if (trulyDisabled) return;
|
890
894
|
if ("items" in item) {
|
891
895
|
return filterItems((_a = item.items) != null ? _a : []);
|
@@ -1669,6 +1673,7 @@ var MultiAutocomplete = (0, import_core9.forwardRef)(
|
|
1669
1673
|
);
|
1670
1674
|
let {
|
1671
1675
|
className,
|
1676
|
+
clearable,
|
1672
1677
|
closeOnSelect = false,
|
1673
1678
|
color,
|
1674
1679
|
component,
|
@@ -1715,6 +1720,7 @@ var MultiAutocomplete = (0, import_core9.forwardRef)(
|
|
1715
1720
|
});
|
1716
1721
|
h != null ? h : h = height;
|
1717
1722
|
minH != null ? minH : minH = minHeight;
|
1723
|
+
clearable != null ? clearable : clearable = isClearable;
|
1718
1724
|
const css = {
|
1719
1725
|
color,
|
1720
1726
|
h: "fit-content",
|
@@ -1759,7 +1765,7 @@ var MultiAutocomplete = (0, import_core9.forwardRef)(
|
|
1759
1765
|
...getFieldProps(fieldProps, ref)
|
1760
1766
|
}
|
1761
1767
|
),
|
1762
|
-
|
1768
|
+
clearable && value.length ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
1763
1769
|
AutocompleteClearIcon,
|
1764
1770
|
{
|
1765
1771
|
...clearIconProps,
|