@yamada-ui/autocomplete 0.2.10 → 0.2.11
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.
- package/dist/autocomplete-create.js +24 -17
- package/dist/autocomplete-create.mjs +1 -1
- package/dist/autocomplete-empty.js +24 -17
- package/dist/autocomplete-empty.mjs +1 -1
- package/dist/autocomplete-icon.js +30 -23
- package/dist/autocomplete-icon.mjs +1 -1
- package/dist/autocomplete-list.js +4 -1
- package/dist/autocomplete-list.mjs +1 -1
- package/dist/autocomplete-option-group.d.mts +1 -1
- package/dist/autocomplete-option-group.d.ts +1 -1
- package/dist/autocomplete-option-group.js +10 -5
- package/dist/autocomplete-option-group.mjs +1 -1
- package/dist/autocomplete-option.d.mts +1 -1
- package/dist/autocomplete-option.d.ts +1 -1
- package/dist/autocomplete-option.js +33 -22
- package/dist/autocomplete-option.mjs +1 -1
- package/dist/autocomplete.d.mts +1 -1
- package/dist/autocomplete.d.ts +1 -1
- package/dist/autocomplete.js +226 -120
- package/dist/autocomplete.mjs +1 -1
- package/dist/{chunk-5O3XEEJE.mjs → chunk-ZVZP7IWT.mjs} +352 -229
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +345 -229
- package/dist/index.mjs +1 -1
- package/dist/multi-autocomplete.d.mts +1 -1
- package/dist/multi-autocomplete.d.ts +1 -1
- package/dist/multi-autocomplete.js +245 -149
- package/dist/multi-autocomplete.mjs +1 -1
- package/dist/{use-autocomplete-cbe9b443.d.ts → use-autocomplete-2422c1c8.d.ts} +25 -5
- package/dist/use-autocomplete.d.mts +1 -1
- package/dist/use-autocomplete.d.ts +1 -1
- package/dist/use-autocomplete.js +131 -45
- package/dist/use-autocomplete.mjs +1 -1
- package/package.json +11 -11
|
@@ -110,31 +110,38 @@ var AutocompleteIcon = (0, import_core2.forwardRef)(
|
|
|
110
110
|
}
|
|
111
111
|
})
|
|
112
112
|
);
|
|
113
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ui.div, { ref, className: (0, import_utils2.cx)("ui-autocomplete-icon", className), __css: css, ...rest, children: (0, import_utils2.isValidElement)(children) ? cloneChildren : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icon.ChevronIcon, {}) });
|
|
114
|
-
}
|
|
115
|
-
);
|
|
116
|
-
var AutocompleteItemIcon = (0, import_core2.forwardRef)(
|
|
117
|
-
({ className, ...rest }, ref) => {
|
|
118
|
-
const { styles } = useAutocompleteContext();
|
|
119
|
-
const css = {
|
|
120
|
-
flexShrink: 0,
|
|
121
|
-
display: "inline-flex",
|
|
122
|
-
justifyContent: "center",
|
|
123
|
-
alignItems: "center",
|
|
124
|
-
fontSize: "0.85em",
|
|
125
|
-
...styles.itemIcon
|
|
126
|
-
};
|
|
127
113
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
128
|
-
import_core2.ui.
|
|
114
|
+
import_core2.ui.div,
|
|
129
115
|
{
|
|
130
116
|
ref,
|
|
131
|
-
className: (0, import_utils2.cx)("ui-autocomplete-
|
|
117
|
+
className: (0, import_utils2.cx)("ui-autocomplete-icon", className),
|
|
132
118
|
__css: css,
|
|
133
|
-
...rest
|
|
119
|
+
...rest,
|
|
120
|
+
children: (0, import_utils2.isValidElement)(children) ? cloneChildren : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icon.ChevronIcon, {})
|
|
134
121
|
}
|
|
135
122
|
);
|
|
136
123
|
}
|
|
137
124
|
);
|
|
125
|
+
var AutocompleteItemIcon = (0, import_core2.forwardRef)(({ className, ...rest }, ref) => {
|
|
126
|
+
const { styles } = useAutocompleteContext();
|
|
127
|
+
const css = {
|
|
128
|
+
flexShrink: 0,
|
|
129
|
+
display: "inline-flex",
|
|
130
|
+
justifyContent: "center",
|
|
131
|
+
alignItems: "center",
|
|
132
|
+
fontSize: "0.85em",
|
|
133
|
+
...styles.itemIcon
|
|
134
|
+
};
|
|
135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
136
|
+
import_core2.ui.span,
|
|
137
|
+
{
|
|
138
|
+
ref,
|
|
139
|
+
className: (0, import_utils2.cx)("ui-autocomplete-item-icon", className),
|
|
140
|
+
__css: css,
|
|
141
|
+
...rest
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
});
|
|
138
145
|
|
|
139
146
|
// src/autocomplete-create.tsx
|
|
140
147
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
@@ -108,31 +108,38 @@ var AutocompleteIcon = (0, import_core2.forwardRef)(
|
|
|
108
108
|
}
|
|
109
109
|
})
|
|
110
110
|
);
|
|
111
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ui.div, { ref, className: (0, import_utils2.cx)("ui-autocomplete-icon", className), __css: css, ...rest, children: (0, import_utils2.isValidElement)(children) ? cloneChildren : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icon.ChevronIcon, {}) });
|
|
112
|
-
}
|
|
113
|
-
);
|
|
114
|
-
var AutocompleteItemIcon = (0, import_core2.forwardRef)(
|
|
115
|
-
({ className, ...rest }, ref) => {
|
|
116
|
-
const { styles } = useAutocompleteContext();
|
|
117
|
-
const css = {
|
|
118
|
-
flexShrink: 0,
|
|
119
|
-
display: "inline-flex",
|
|
120
|
-
justifyContent: "center",
|
|
121
|
-
alignItems: "center",
|
|
122
|
-
fontSize: "0.85em",
|
|
123
|
-
...styles.itemIcon
|
|
124
|
-
};
|
|
125
111
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
126
|
-
import_core2.ui.
|
|
112
|
+
import_core2.ui.div,
|
|
127
113
|
{
|
|
128
114
|
ref,
|
|
129
|
-
className: (0, import_utils2.cx)("ui-autocomplete-
|
|
115
|
+
className: (0, import_utils2.cx)("ui-autocomplete-icon", className),
|
|
130
116
|
__css: css,
|
|
131
|
-
...rest
|
|
117
|
+
...rest,
|
|
118
|
+
children: (0, import_utils2.isValidElement)(children) ? cloneChildren : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icon.ChevronIcon, {})
|
|
132
119
|
}
|
|
133
120
|
);
|
|
134
121
|
}
|
|
135
122
|
);
|
|
123
|
+
var AutocompleteItemIcon = (0, import_core2.forwardRef)(({ className, ...rest }, ref) => {
|
|
124
|
+
const { styles } = useAutocompleteContext();
|
|
125
|
+
const css = {
|
|
126
|
+
flexShrink: 0,
|
|
127
|
+
display: "inline-flex",
|
|
128
|
+
justifyContent: "center",
|
|
129
|
+
alignItems: "center",
|
|
130
|
+
fontSize: "0.85em",
|
|
131
|
+
...styles.itemIcon
|
|
132
|
+
};
|
|
133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
134
|
+
import_core2.ui.span,
|
|
135
|
+
{
|
|
136
|
+
ref,
|
|
137
|
+
className: (0, import_utils2.cx)("ui-autocomplete-item-icon", className),
|
|
138
|
+
__css: css,
|
|
139
|
+
...rest
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
});
|
|
136
143
|
|
|
137
144
|
// src/autocomplete-empty.tsx
|
|
138
145
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
@@ -80,7 +80,16 @@ var AutocompleteIcon = (0, import_core2.forwardRef)(
|
|
|
80
80
|
}
|
|
81
81
|
})
|
|
82
82
|
);
|
|
83
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
83
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
84
|
+
import_core2.ui.div,
|
|
85
|
+
{
|
|
86
|
+
ref,
|
|
87
|
+
className: (0, import_utils2.cx)("ui-autocomplete-icon", className),
|
|
88
|
+
__css: css,
|
|
89
|
+
...rest,
|
|
90
|
+
children: (0, import_utils2.isValidElement)(children) ? cloneChildren : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icon.ChevronIcon, {})
|
|
91
|
+
}
|
|
92
|
+
);
|
|
84
93
|
}
|
|
85
94
|
);
|
|
86
95
|
var AutocompleteClearIcon = ({
|
|
@@ -106,28 +115,26 @@ var AutocompleteClearIcon = ({
|
|
|
106
115
|
}
|
|
107
116
|
);
|
|
108
117
|
};
|
|
109
|
-
var AutocompleteItemIcon = (0, import_core2.forwardRef)(
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
);
|
|
118
|
+
var AutocompleteItemIcon = (0, import_core2.forwardRef)(({ className, ...rest }, ref) => {
|
|
119
|
+
const { styles } = useAutocompleteContext();
|
|
120
|
+
const css = {
|
|
121
|
+
flexShrink: 0,
|
|
122
|
+
display: "inline-flex",
|
|
123
|
+
justifyContent: "center",
|
|
124
|
+
alignItems: "center",
|
|
125
|
+
fontSize: "0.85em",
|
|
126
|
+
...styles.itemIcon
|
|
127
|
+
};
|
|
128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
129
|
+
import_core2.ui.span,
|
|
130
|
+
{
|
|
131
|
+
ref,
|
|
132
|
+
className: (0, import_utils2.cx)("ui-autocomplete-item-icon", className),
|
|
133
|
+
__css: css,
|
|
134
|
+
...rest
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
});
|
|
131
138
|
// Annotate the CommonJS export names for ESM import in node:
|
|
132
139
|
0 && (module.exports = {
|
|
133
140
|
AutocompleteClearIcon,
|
|
@@ -94,7 +94,10 @@ var useAutocompleteList = () => {
|
|
|
94
94
|
role: "select",
|
|
95
95
|
tabIndex: -1,
|
|
96
96
|
...props,
|
|
97
|
-
onAnimationComplete: (0, import_utils.handlerAll)(
|
|
97
|
+
onAnimationComplete: (0, import_utils.handlerAll)(
|
|
98
|
+
props.onAnimationComplete,
|
|
99
|
+
onAnimationComplete
|
|
100
|
+
)
|
|
98
101
|
}),
|
|
99
102
|
[listRef, onAnimationComplete]
|
|
100
103
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _yamada_ui_core from '@yamada-ui/core';
|
|
2
2
|
import { HTMLUIProps } from '@yamada-ui/core';
|
|
3
|
-
import { U as UseAutocompleteOptionGroupProps } from './use-autocomplete-
|
|
3
|
+
import { U as UseAutocompleteOptionGroupProps } from './use-autocomplete-2422c1c8.js';
|
|
4
4
|
import 'react/jsx-runtime';
|
|
5
5
|
import 'react';
|
|
6
6
|
import '@yamada-ui/form-control';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _yamada_ui_core from '@yamada-ui/core';
|
|
2
2
|
import { HTMLUIProps } from '@yamada-ui/core';
|
|
3
|
-
import { U as UseAutocompleteOptionGroupProps } from './use-autocomplete-
|
|
3
|
+
import { U as UseAutocompleteOptionGroupProps } from './use-autocomplete-2422c1c8.js';
|
|
4
4
|
import 'react/jsx-runtime';
|
|
5
5
|
import 'react';
|
|
6
6
|
import '@yamada-ui/form-control';
|
|
@@ -45,15 +45,20 @@ var [AutocompleteProvider, useAutocompleteContext] = (0, import_utils.createCont
|
|
|
45
45
|
name: "AutocompleteContext",
|
|
46
46
|
errorMessage: `useAutocompleteContext returned is 'undefined'. Seems you forgot to wrap the components in "<Autocomplete />" or "<MultiAutocomplete />"`
|
|
47
47
|
});
|
|
48
|
-
var useAutocompleteOptionGroup = ({
|
|
48
|
+
var useAutocompleteOptionGroup = ({
|
|
49
|
+
label,
|
|
50
|
+
...rest
|
|
51
|
+
}) => {
|
|
49
52
|
const { value, omitSelectedValues } = useAutocompleteContext();
|
|
50
53
|
const isMulti = (0, import_utils.isArray)(value);
|
|
51
54
|
const descendants = useAutocompleteDescendantsContext();
|
|
52
55
|
const values = descendants.values();
|
|
53
|
-
const selectedValues = isMulti && omitSelectedValues ? descendants.values(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
const selectedValues = isMulti && omitSelectedValues ? descendants.values(
|
|
57
|
+
({ node }) => {
|
|
58
|
+
var _a;
|
|
59
|
+
return value.includes((_a = node.dataset.value) != null ? _a : "");
|
|
60
|
+
}
|
|
61
|
+
) : [];
|
|
57
62
|
const selectedIndexes = selectedValues.map(({ index }) => index);
|
|
58
63
|
const childValues = values.filter(
|
|
59
64
|
({ node, index }) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '@yamada-ui/core';
|
|
2
2
|
import 'react';
|
|
3
|
-
export { A as AutocompleteOption, a as AutocompleteOptionProps } from './use-autocomplete-
|
|
3
|
+
export { A as AutocompleteOption, a as AutocompleteOptionProps } from './use-autocomplete-2422c1c8.js';
|
|
4
4
|
import 'react/jsx-runtime';
|
|
5
5
|
import '@yamada-ui/form-control';
|
|
6
6
|
import '@yamada-ui/popover';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '@yamada-ui/core';
|
|
2
2
|
import 'react';
|
|
3
|
-
export { A as AutocompleteOption, a as AutocompleteOptionProps } from './use-autocomplete-
|
|
3
|
+
export { A as AutocompleteOption, a as AutocompleteOptionProps } from './use-autocomplete-2422c1c8.js';
|
|
4
4
|
import 'react/jsx-runtime';
|
|
5
5
|
import '@yamada-ui/form-control';
|
|
6
6
|
import '@yamada-ui/popover';
|
|
@@ -81,14 +81,18 @@ var useAutocompleteOption = (props) => {
|
|
|
81
81
|
} = { ...optionProps, ...props };
|
|
82
82
|
const trulyDisabled = !!isDisabled && !isFocusable;
|
|
83
83
|
const itemRef = (0, import_react.useRef)(null);
|
|
84
|
-
const { index, register, descendants } = useAutocompleteDescendant({
|
|
84
|
+
const { index, register, descendants } = useAutocompleteDescendant({
|
|
85
|
+
disabled: trulyDisabled
|
|
86
|
+
});
|
|
85
87
|
const values = descendants.values();
|
|
86
88
|
const frontValues = values.slice(0, index);
|
|
87
89
|
const isMulti = (0, import_utils.isArray)(value);
|
|
88
|
-
const isDuplicated = !isMulti ? frontValues.some(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
const isDuplicated = !isMulti ? frontValues.some(
|
|
91
|
+
({ node }) => {
|
|
92
|
+
var _a2;
|
|
93
|
+
return node.dataset.value === ((_a2 = computedProps.value) != null ? _a2 : "");
|
|
94
|
+
}
|
|
95
|
+
) : false;
|
|
92
96
|
const isSelected = !isDuplicated && (!isMulti ? ((_a = computedProps.value) != null ? _a : "") === value : value.includes((_b = computedProps.value) != null ? _b : ""));
|
|
93
97
|
const isTarget = "target" in ((_d = (_c = itemRef.current) == null ? void 0 : _c.dataset) != null ? _d : {});
|
|
94
98
|
const isFocused = index === focusedIndex;
|
|
@@ -213,31 +217,38 @@ var AutocompleteIcon = (0, import_core2.forwardRef)(
|
|
|
213
217
|
}
|
|
214
218
|
})
|
|
215
219
|
);
|
|
216
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ui.div, { ref, className: (0, import_utils2.cx)("ui-autocomplete-icon", className), __css: css, ...rest, children: (0, import_utils2.isValidElement)(children) ? cloneChildren : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icon.ChevronIcon, {}) });
|
|
217
|
-
}
|
|
218
|
-
);
|
|
219
|
-
var AutocompleteItemIcon = (0, import_core2.forwardRef)(
|
|
220
|
-
({ className, ...rest }, ref) => {
|
|
221
|
-
const { styles } = useAutocompleteContext();
|
|
222
|
-
const css = {
|
|
223
|
-
flexShrink: 0,
|
|
224
|
-
display: "inline-flex",
|
|
225
|
-
justifyContent: "center",
|
|
226
|
-
alignItems: "center",
|
|
227
|
-
fontSize: "0.85em",
|
|
228
|
-
...styles.itemIcon
|
|
229
|
-
};
|
|
230
220
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
231
|
-
import_core2.ui.
|
|
221
|
+
import_core2.ui.div,
|
|
232
222
|
{
|
|
233
223
|
ref,
|
|
234
|
-
className: (0, import_utils2.cx)("ui-autocomplete-
|
|
224
|
+
className: (0, import_utils2.cx)("ui-autocomplete-icon", className),
|
|
235
225
|
__css: css,
|
|
236
|
-
...rest
|
|
226
|
+
...rest,
|
|
227
|
+
children: (0, import_utils2.isValidElement)(children) ? cloneChildren : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icon.ChevronIcon, {})
|
|
237
228
|
}
|
|
238
229
|
);
|
|
239
230
|
}
|
|
240
231
|
);
|
|
232
|
+
var AutocompleteItemIcon = (0, import_core2.forwardRef)(({ className, ...rest }, ref) => {
|
|
233
|
+
const { styles } = useAutocompleteContext();
|
|
234
|
+
const css = {
|
|
235
|
+
flexShrink: 0,
|
|
236
|
+
display: "inline-flex",
|
|
237
|
+
justifyContent: "center",
|
|
238
|
+
alignItems: "center",
|
|
239
|
+
fontSize: "0.85em",
|
|
240
|
+
...styles.itemIcon
|
|
241
|
+
};
|
|
242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
243
|
+
import_core2.ui.span,
|
|
244
|
+
{
|
|
245
|
+
ref,
|
|
246
|
+
className: (0, import_utils2.cx)("ui-autocomplete-item-icon", className),
|
|
247
|
+
__css: css,
|
|
248
|
+
...rest
|
|
249
|
+
}
|
|
250
|
+
);
|
|
251
|
+
});
|
|
241
252
|
|
|
242
253
|
// src/autocomplete-option.tsx
|
|
243
254
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
package/dist/autocomplete.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import * as _yamada_ui_core from '@yamada-ui/core';
|
|
|
2
2
|
import { ThemeProps, HTMLUIProps } from '@yamada-ui/core';
|
|
3
3
|
import { AutocompleteIconProps } from './autocomplete-icon.mjs';
|
|
4
4
|
import { AutocompleteListProps } from './autocomplete-list.mjs';
|
|
5
|
-
import { b as UseAutocompleteProps } from './use-autocomplete-
|
|
5
|
+
import { b as UseAutocompleteProps } from './use-autocomplete-2422c1c8.js';
|
|
6
6
|
import 'react';
|
|
7
7
|
import 'react/jsx-runtime';
|
|
8
8
|
import '@yamada-ui/form-control';
|
package/dist/autocomplete.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as _yamada_ui_core from '@yamada-ui/core';
|
|
|
2
2
|
import { ThemeProps, HTMLUIProps } from '@yamada-ui/core';
|
|
3
3
|
import { AutocompleteIconProps } from './autocomplete-icon.js';
|
|
4
4
|
import { AutocompleteListProps } from './autocomplete-list.js';
|
|
5
|
-
import { b as UseAutocompleteProps } from './use-autocomplete-
|
|
5
|
+
import { b as UseAutocompleteProps } from './use-autocomplete-2422c1c8.js';
|
|
6
6
|
import 'react';
|
|
7
7
|
import 'react/jsx-runtime';
|
|
8
8
|
import '@yamada-ui/form-control';
|