@uipath/apollo-wind 2.76.1 → 2.78.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.
- package/dist/components/ui/index.cjs +24 -24
- package/dist/components/ui/quick-form-field/quick-form-field.cjs +4 -2
- package/dist/components/ui/quick-form-field/quick-form-field.js +4 -2
- package/dist/components/ui/search.cjs +38 -13
- package/dist/components/ui/search.d.ts +17 -2
- package/dist/components/ui/search.js +41 -16
- package/dist/styles.css +3 -0
- package/package.json +1 -1
|
@@ -36,10 +36,10 @@ var __webpack_modules__ = {
|
|
|
36
36
|
"@/components/ui/button" (module) {
|
|
37
37
|
module.exports = require("./button.cjs");
|
|
38
38
|
},
|
|
39
|
-
"
|
|
39
|
+
"@/components/ui/calendar" (module) {
|
|
40
40
|
module.exports = require("./calendar.cjs");
|
|
41
41
|
},
|
|
42
|
-
"
|
|
42
|
+
"./card" (module) {
|
|
43
43
|
module.exports = require("./card.cjs");
|
|
44
44
|
},
|
|
45
45
|
"./chart" (module) {
|
|
@@ -81,7 +81,7 @@ var __webpack_modules__ = {
|
|
|
81
81
|
"./datetime-picker" (module) {
|
|
82
82
|
module.exports = require("./datetime-picker.cjs");
|
|
83
83
|
},
|
|
84
|
-
"
|
|
84
|
+
"./dialog" (module) {
|
|
85
85
|
module.exports = require("./dialog.cjs");
|
|
86
86
|
},
|
|
87
87
|
"./disclosure-tree" (module) {
|
|
@@ -90,13 +90,13 @@ var __webpack_modules__ = {
|
|
|
90
90
|
"./drawer" (module) {
|
|
91
91
|
module.exports = require("./drawer.cjs");
|
|
92
92
|
},
|
|
93
|
-
"
|
|
93
|
+
"./dropdown-menu" (module) {
|
|
94
94
|
module.exports = require("./dropdown-menu.cjs");
|
|
95
95
|
},
|
|
96
96
|
"./dropzone-overlay" (module) {
|
|
97
97
|
module.exports = require("./dropzone-overlay.cjs");
|
|
98
98
|
},
|
|
99
|
-
"
|
|
99
|
+
"./editable-cell" (module) {
|
|
100
100
|
module.exports = require("./editable-cell.cjs");
|
|
101
101
|
},
|
|
102
102
|
"./empty-state" (module) {
|
|
@@ -120,7 +120,7 @@ var __webpack_modules__ = {
|
|
|
120
120
|
"@/components/ui/hover-card" (module) {
|
|
121
121
|
module.exports = require("./hover-card.cjs");
|
|
122
122
|
},
|
|
123
|
-
"
|
|
123
|
+
"./info-tooltip" (module) {
|
|
124
124
|
module.exports = require("./info-tooltip.cjs");
|
|
125
125
|
},
|
|
126
126
|
"@/components/ui/input-group" (module) {
|
|
@@ -135,7 +135,7 @@ var __webpack_modules__ = {
|
|
|
135
135
|
"@/components/ui/label" (module) {
|
|
136
136
|
module.exports = require("./label.cjs");
|
|
137
137
|
},
|
|
138
|
-
"
|
|
138
|
+
"./layout" (module) {
|
|
139
139
|
module.exports = require("./layout/index.cjs");
|
|
140
140
|
},
|
|
141
141
|
"./live-region" (module) {
|
|
@@ -201,7 +201,7 @@ var __webpack_modules__ = {
|
|
|
201
201
|
"./reference-chip-colors" (module) {
|
|
202
202
|
module.exports = require("./reference-chip-colors.cjs");
|
|
203
203
|
},
|
|
204
|
-
"
|
|
204
|
+
"./reference-chip" (module) {
|
|
205
205
|
module.exports = require("./reference-chip.cjs");
|
|
206
206
|
},
|
|
207
207
|
"./resizable" (module) {
|
|
@@ -249,13 +249,13 @@ var __webpack_modules__ = {
|
|
|
249
249
|
"./switch" (module) {
|
|
250
250
|
module.exports = require("./switch.cjs");
|
|
251
251
|
},
|
|
252
|
-
"
|
|
252
|
+
"./table" (module) {
|
|
253
253
|
module.exports = require("./table.cjs");
|
|
254
254
|
},
|
|
255
255
|
"./tabs" (module) {
|
|
256
256
|
module.exports = require("./tabs.cjs");
|
|
257
257
|
},
|
|
258
|
-
"
|
|
258
|
+
"./textarea" (module) {
|
|
259
259
|
module.exports = require("./textarea.cjs");
|
|
260
260
|
},
|
|
261
261
|
"./thinking-indicator" (module) {
|
|
@@ -264,7 +264,7 @@ var __webpack_modules__ = {
|
|
|
264
264
|
"./toggle-group" (module) {
|
|
265
265
|
module.exports = require("./toggle-group.cjs");
|
|
266
266
|
},
|
|
267
|
-
"
|
|
267
|
+
"./toggle" (module) {
|
|
268
268
|
module.exports = require("./toggle.cjs");
|
|
269
269
|
},
|
|
270
270
|
"./tool-call" (module) {
|
|
@@ -276,7 +276,7 @@ var __webpack_modules__ = {
|
|
|
276
276
|
"./tree-view" (module) {
|
|
277
277
|
module.exports = require("./tree-view.cjs");
|
|
278
278
|
},
|
|
279
|
-
"
|
|
279
|
+
"./variable-picker" (module) {
|
|
280
280
|
module.exports = require("./variable-picker/index.cjs");
|
|
281
281
|
},
|
|
282
282
|
"./variable-value-control" (module) {
|
|
@@ -452,7 +452,7 @@ var __webpack_exports__ = {};
|
|
|
452
452
|
"ReferenceChip"
|
|
453
453
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_button_group__rspack_import_11[__rspack_import_key];
|
|
454
454
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
455
|
-
var _calendar__rspack_import_12 = __webpack_require__("
|
|
455
|
+
var _calendar__rspack_import_12 = __webpack_require__("@/components/ui/calendar");
|
|
456
456
|
var __rspack_reexport = {};
|
|
457
457
|
for(const __rspack_import_key in _calendar__rspack_import_12)if ([
|
|
458
458
|
"getReferenceChipColors",
|
|
@@ -462,7 +462,7 @@ var __webpack_exports__ = {};
|
|
|
462
462
|
"ReferenceChip"
|
|
463
463
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_calendar__rspack_import_12[__rspack_import_key];
|
|
464
464
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
465
|
-
var _card__rspack_import_13 = __webpack_require__("
|
|
465
|
+
var _card__rspack_import_13 = __webpack_require__("./card");
|
|
466
466
|
var __rspack_reexport = {};
|
|
467
467
|
for(const __rspack_import_key in _card__rspack_import_13)if ([
|
|
468
468
|
"getReferenceChipColors",
|
|
@@ -602,7 +602,7 @@ var __webpack_exports__ = {};
|
|
|
602
602
|
"ReferenceChip"
|
|
603
603
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_datetime_picker__rspack_import_26[__rspack_import_key];
|
|
604
604
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
605
|
-
var _dialog__rspack_import_27 = __webpack_require__("
|
|
605
|
+
var _dialog__rspack_import_27 = __webpack_require__("./dialog");
|
|
606
606
|
var __rspack_reexport = {};
|
|
607
607
|
for(const __rspack_import_key in _dialog__rspack_import_27)if ([
|
|
608
608
|
"getReferenceChipColors",
|
|
@@ -632,7 +632,7 @@ var __webpack_exports__ = {};
|
|
|
632
632
|
"ReferenceChip"
|
|
633
633
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_drawer__rspack_import_29[__rspack_import_key];
|
|
634
634
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
635
|
-
var _dropdown_menu__rspack_import_30 = __webpack_require__("
|
|
635
|
+
var _dropdown_menu__rspack_import_30 = __webpack_require__("./dropdown-menu");
|
|
636
636
|
var __rspack_reexport = {};
|
|
637
637
|
for(const __rspack_import_key in _dropdown_menu__rspack_import_30)if ([
|
|
638
638
|
"getReferenceChipColors",
|
|
@@ -652,7 +652,7 @@ var __webpack_exports__ = {};
|
|
|
652
652
|
"ReferenceChip"
|
|
653
653
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_dropzone_overlay__rspack_import_31[__rspack_import_key];
|
|
654
654
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
655
|
-
var _editable_cell__rspack_import_32 = __webpack_require__("
|
|
655
|
+
var _editable_cell__rspack_import_32 = __webpack_require__("./editable-cell");
|
|
656
656
|
var __rspack_reexport = {};
|
|
657
657
|
for(const __rspack_import_key in _editable_cell__rspack_import_32)if ([
|
|
658
658
|
"getReferenceChipColors",
|
|
@@ -732,7 +732,7 @@ var __webpack_exports__ = {};
|
|
|
732
732
|
"ReferenceChip"
|
|
733
733
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_hover_card__rspack_import_39[__rspack_import_key];
|
|
734
734
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
735
|
-
var _info_tooltip__rspack_import_40 = __webpack_require__("
|
|
735
|
+
var _info_tooltip__rspack_import_40 = __webpack_require__("./info-tooltip");
|
|
736
736
|
var __rspack_reexport = {};
|
|
737
737
|
for(const __rspack_import_key in _info_tooltip__rspack_import_40)if ([
|
|
738
738
|
"getReferenceChipColors",
|
|
@@ -782,7 +782,7 @@ var __webpack_exports__ = {};
|
|
|
782
782
|
"ReferenceChip"
|
|
783
783
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_label__rspack_import_44[__rspack_import_key];
|
|
784
784
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
785
|
-
var _layout__rspack_import_45 = __webpack_require__("
|
|
785
|
+
var _layout__rspack_import_45 = __webpack_require__("./layout");
|
|
786
786
|
var __rspack_reexport = {};
|
|
787
787
|
for(const __rspack_import_key in _layout__rspack_import_45)if ([
|
|
788
788
|
"getReferenceChipColors",
|
|
@@ -992,7 +992,7 @@ var __webpack_exports__ = {};
|
|
|
992
992
|
"ReferenceChip"
|
|
993
993
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_radio_group__rspack_import_65[__rspack_import_key];
|
|
994
994
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
995
|
-
var _reference_chip__rspack_import_66 = __webpack_require__("
|
|
995
|
+
var _reference_chip__rspack_import_66 = __webpack_require__("./reference-chip");
|
|
996
996
|
var _reference_chip_colors__rspack_import_67 = __webpack_require__("./reference-chip-colors");
|
|
997
997
|
var _resizable__rspack_import_68 = __webpack_require__("./resizable");
|
|
998
998
|
var __rspack_reexport = {};
|
|
@@ -1144,7 +1144,7 @@ var __webpack_exports__ = {};
|
|
|
1144
1144
|
"ReferenceChip"
|
|
1145
1145
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_switch__rspack_import_82[__rspack_import_key];
|
|
1146
1146
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
1147
|
-
var _table__rspack_import_83 = __webpack_require__("
|
|
1147
|
+
var _table__rspack_import_83 = __webpack_require__("./table");
|
|
1148
1148
|
var __rspack_reexport = {};
|
|
1149
1149
|
for(const __rspack_import_key in _table__rspack_import_83)if ([
|
|
1150
1150
|
"getReferenceChipColors",
|
|
@@ -1164,7 +1164,7 @@ var __webpack_exports__ = {};
|
|
|
1164
1164
|
"ReferenceChip"
|
|
1165
1165
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_tabs__rspack_import_84[__rspack_import_key];
|
|
1166
1166
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
1167
|
-
var _textarea__rspack_import_85 = __webpack_require__("
|
|
1167
|
+
var _textarea__rspack_import_85 = __webpack_require__("./textarea");
|
|
1168
1168
|
var __rspack_reexport = {};
|
|
1169
1169
|
for(const __rspack_import_key in _textarea__rspack_import_85)if ([
|
|
1170
1170
|
"getReferenceChipColors",
|
|
@@ -1184,7 +1184,7 @@ var __webpack_exports__ = {};
|
|
|
1184
1184
|
"ReferenceChip"
|
|
1185
1185
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_thinking_indicator__rspack_import_86[__rspack_import_key];
|
|
1186
1186
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
1187
|
-
var _toggle__rspack_import_87 = __webpack_require__("
|
|
1187
|
+
var _toggle__rspack_import_87 = __webpack_require__("./toggle");
|
|
1188
1188
|
var __rspack_reexport = {};
|
|
1189
1189
|
for(const __rspack_import_key in _toggle__rspack_import_87)if ([
|
|
1190
1190
|
"getReferenceChipColors",
|
|
@@ -1226,7 +1226,7 @@ var __webpack_exports__ = {};
|
|
|
1226
1226
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
1227
1227
|
var _tree_view__rspack_import_91 = __webpack_require__("./tree-view");
|
|
1228
1228
|
var _tree_view__rspack_import_91_default = /*#__PURE__*/ __webpack_require__.n(_tree_view__rspack_import_91);
|
|
1229
|
-
var _variable_picker__rspack_import_92 = __webpack_require__("
|
|
1229
|
+
var _variable_picker__rspack_import_92 = __webpack_require__("./variable-picker");
|
|
1230
1230
|
var __rspack_reexport = {};
|
|
1231
1231
|
for(const __rspack_import_key in _variable_picker__rspack_import_92)if ([
|
|
1232
1232
|
"getReferenceChipColors",
|
|
@@ -283,8 +283,10 @@ function QuickFormField({ value = '', onValueChange, onValueBlur, locked = true,
|
|
|
283
283
|
onBlur: onValueBlur
|
|
284
284
|
}) : 'textarea' === fieldType ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_input_group_cjs_namespaceObject.InputGroupTextarea, {
|
|
285
285
|
...textInputProps,
|
|
286
|
-
|
|
287
|
-
|
|
286
|
+
rows: 1,
|
|
287
|
+
minRows: 1,
|
|
288
|
+
maxRows: 8,
|
|
289
|
+
className: "py-[3px] future:py-0.5"
|
|
288
290
|
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_input_group_cjs_namespaceObject.InputGroupInput, {
|
|
289
291
|
...textInputProps,
|
|
290
292
|
type: 'integer' === fieldType || 'double' === fieldType ? 'number' : 'text',
|
|
@@ -255,8 +255,10 @@ function QuickFormField({ value = '', onValueChange, onValueBlur, locked = true,
|
|
|
255
255
|
onBlur: onValueBlur
|
|
256
256
|
}) : 'textarea' === fieldType ? /*#__PURE__*/ jsx(InputGroupTextarea, {
|
|
257
257
|
...textInputProps,
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
rows: 1,
|
|
259
|
+
minRows: 1,
|
|
260
|
+
maxRows: 8,
|
|
261
|
+
className: "py-[3px] future:py-0.5"
|
|
260
262
|
}) : /*#__PURE__*/ jsx(InputGroupInput, {
|
|
261
263
|
...textInputProps,
|
|
262
264
|
type: 'integer' === fieldType || 'double' === fieldType ? 'number' : 'text',
|
|
@@ -38,13 +38,30 @@ const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
|
38
38
|
const DEFAULT_SEARCH_STRINGS = {
|
|
39
39
|
clear: 'Clear'
|
|
40
40
|
};
|
|
41
|
-
const Search = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, value, onChange, onClear, showClearButton = true, variant, size, error, errorId, strings, ...props }, ref)=>{
|
|
41
|
+
const Search = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, value, onChange, onValueChange, onClear, showClearButton = true, variant, size, error, errorId, strings, ...props }, ref)=>{
|
|
42
42
|
const text = {
|
|
43
43
|
...DEFAULT_SEARCH_STRINGS,
|
|
44
44
|
...strings
|
|
45
45
|
};
|
|
46
|
+
const inputRef = external_react_namespaceObject.useRef(null);
|
|
47
|
+
const setRef = external_react_namespaceObject.useMemo(()=>(0, index_cjs_namespaceObject.composeRefs)(ref, inputRef), [
|
|
48
|
+
ref
|
|
49
|
+
]);
|
|
50
|
+
const handleChange = (e)=>{
|
|
51
|
+
if (onValueChange) {
|
|
52
|
+
onChange?.(e);
|
|
53
|
+
onValueChange(e.target.value);
|
|
54
|
+
} else onChange?.(e.target.value);
|
|
55
|
+
};
|
|
46
56
|
const handleClear = ()=>{
|
|
47
|
-
|
|
57
|
+
const input = inputRef.current;
|
|
58
|
+
if (input) {
|
|
59
|
+
Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set?.call(input, '');
|
|
60
|
+
input.dispatchEvent(new Event('input', {
|
|
61
|
+
bubbles: true
|
|
62
|
+
}));
|
|
63
|
+
input.focus();
|
|
64
|
+
}
|
|
48
65
|
onClear?.();
|
|
49
66
|
};
|
|
50
67
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_input_group_cjs_namespaceObject.InputGroup, {
|
|
@@ -61,11 +78,11 @@ const Search = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ classN
|
|
|
61
78
|
})
|
|
62
79
|
}),
|
|
63
80
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_input_group_cjs_namespaceObject.InputGroupInput, {
|
|
64
|
-
ref:
|
|
81
|
+
ref: setRef,
|
|
65
82
|
type: "search",
|
|
66
83
|
className: (0, index_cjs_namespaceObject.cn)('[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none', className),
|
|
67
84
|
value: value,
|
|
68
|
-
onChange:
|
|
85
|
+
onChange: handleChange,
|
|
69
86
|
...props
|
|
70
87
|
}),
|
|
71
88
|
showClearButton && value && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_input_group_cjs_namespaceObject.InputGroupAddon, {
|
|
@@ -84,6 +101,8 @@ const Search = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ classN
|
|
|
84
101
|
Search.displayName = 'Search';
|
|
85
102
|
const SearchWithSuggestions = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ value, onChange, placeholder = 'Search...', suggestions = [], onSelect, emptyMessage = 'No results found.', className, strings }, ref)=>{
|
|
86
103
|
const [open, setOpen] = external_react_namespaceObject.useState(false);
|
|
104
|
+
const anchorRef = external_react_namespaceObject.useRef(null);
|
|
105
|
+
const popupId = external_react_namespaceObject.useId();
|
|
87
106
|
const [searchValue, setSearchValue] = external_react_namespaceObject.useState(value || '');
|
|
88
107
|
external_react_namespaceObject.useEffect(()=>{
|
|
89
108
|
if (void 0 !== value) setSearchValue(value);
|
|
@@ -102,33 +121,39 @@ const SearchWithSuggestions = /*#__PURE__*/ external_react_namespaceObject.forwa
|
|
|
102
121
|
onChange?.(newValue);
|
|
103
122
|
setOpen(newValue.length > 0);
|
|
104
123
|
};
|
|
124
|
+
const isOpen = open && filteredSuggestions.length > 0;
|
|
105
125
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
106
126
|
ref: ref,
|
|
107
127
|
"data-slot": "search-with-suggestions",
|
|
108
128
|
className: (0, index_cjs_namespaceObject.cn)('relative', className),
|
|
109
129
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_popover_cjs_namespaceObject.Popover, {
|
|
110
|
-
open:
|
|
130
|
+
open: isOpen,
|
|
111
131
|
onOpenChange: setOpen,
|
|
112
132
|
children: [
|
|
113
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.
|
|
133
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverAnchor, {
|
|
114
134
|
asChild: true,
|
|
115
135
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
136
|
+
ref: anchorRef,
|
|
116
137
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Search, {
|
|
117
138
|
value: searchValue,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
setSearchValue('');
|
|
121
|
-
onChange?.('');
|
|
122
|
-
setOpen(false);
|
|
123
|
-
},
|
|
139
|
+
onValueChange: handleInputChange,
|
|
140
|
+
onClick: ()=>setOpen(true),
|
|
124
141
|
placeholder: placeholder,
|
|
125
|
-
strings: strings
|
|
142
|
+
strings: strings,
|
|
143
|
+
"aria-haspopup": "dialog",
|
|
144
|
+
"aria-expanded": isOpen,
|
|
145
|
+
"aria-controls": isOpen ? popupId : void 0
|
|
126
146
|
})
|
|
127
147
|
})
|
|
128
148
|
}),
|
|
129
149
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverContent, {
|
|
150
|
+
id: popupId,
|
|
130
151
|
className: "w-[--radix-popover-trigger-width] p-0",
|
|
131
152
|
align: "start",
|
|
153
|
+
onOpenAutoFocus: (e)=>e.preventDefault(),
|
|
154
|
+
onInteractOutside: (e)=>{
|
|
155
|
+
if (anchorRef.current?.contains(e.target)) e.preventDefault();
|
|
156
|
+
},
|
|
132
157
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_command_cjs_namespaceObject.Command, {
|
|
133
158
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_command_cjs_namespaceObject.CommandList, {
|
|
134
159
|
children: 0 === filteredSuggestions.length ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_command_cjs_namespaceObject.CommandEmpty, {
|
|
@@ -5,9 +5,8 @@ export interface SearchStrings {
|
|
|
5
5
|
clear: string;
|
|
6
6
|
}
|
|
7
7
|
export declare const DEFAULT_SEARCH_STRINGS: SearchStrings;
|
|
8
|
-
|
|
8
|
+
interface SearchBaseProps extends Omit<InputGroupInputProps, 'onChange'> {
|
|
9
9
|
value?: string;
|
|
10
|
-
onChange?: (value: string) => void;
|
|
11
10
|
onClear?: () => void;
|
|
12
11
|
showClearButton?: boolean;
|
|
13
12
|
variant?: InputGroupProps['variant'];
|
|
@@ -19,6 +18,22 @@ export interface SearchProps extends Omit<InputGroupInputProps, 'onChange'> {
|
|
|
19
18
|
/** Overrides for any subset of the built-in labels. */
|
|
20
19
|
strings?: Partial<SearchStrings>;
|
|
21
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Two modes:
|
|
23
|
+
* - Standard (new integrations; required with `asChild` wrappers like
|
|
24
|
+
* cmdk `Command.Input` or Radix Slot): pass `onValueChange` for the
|
|
25
|
+
* string value; `onChange` receives the native event.
|
|
26
|
+
* - Legacy (existing consumers): omit `onValueChange`;
|
|
27
|
+
* `onChange` receives the string value.
|
|
28
|
+
*/
|
|
29
|
+
export type SearchProps = SearchBaseProps & ({
|
|
30
|
+
onValueChange: (value: string) => void;
|
|
31
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
32
|
+
} | {
|
|
33
|
+
onValueChange?: undefined;
|
|
34
|
+
/** @deprecated Pass `onValueChange` instead; `onChange` will receive the native event. */
|
|
35
|
+
onChange?: (value: string) => void;
|
|
36
|
+
});
|
|
22
37
|
declare const Search: React.ForwardRefExoticComponent<SearchProps & React.RefAttributes<HTMLInputElement>>;
|
|
23
38
|
export interface SearchWithSuggestionsProps {
|
|
24
39
|
value?: string;
|
|
@@ -1,20 +1,37 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Search, X } from "lucide-react";
|
|
3
|
-
import { forwardRef, useEffect, useState } from "react";
|
|
3
|
+
import { forwardRef, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { Command, CommandEmpty, CommandGroup, CommandItem, CommandList } from "./command.js";
|
|
5
5
|
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "./input-group.js";
|
|
6
|
-
import { Popover,
|
|
7
|
-
import { cn } from "../../lib/index.js";
|
|
6
|
+
import { Popover, PopoverAnchor, PopoverContent } from "./popover.js";
|
|
7
|
+
import { cn, composeRefs } from "../../lib/index.js";
|
|
8
8
|
const DEFAULT_SEARCH_STRINGS = {
|
|
9
9
|
clear: 'Clear'
|
|
10
10
|
};
|
|
11
|
-
const search_Search = /*#__PURE__*/ forwardRef(({ className, value, onChange, onClear, showClearButton = true, variant, size, error, errorId, strings, ...props }, ref)=>{
|
|
11
|
+
const search_Search = /*#__PURE__*/ forwardRef(({ className, value, onChange, onValueChange, onClear, showClearButton = true, variant, size, error, errorId, strings, ...props }, ref)=>{
|
|
12
12
|
const text = {
|
|
13
13
|
...DEFAULT_SEARCH_STRINGS,
|
|
14
14
|
...strings
|
|
15
15
|
};
|
|
16
|
+
const inputRef = useRef(null);
|
|
17
|
+
const setRef = useMemo(()=>composeRefs(ref, inputRef), [
|
|
18
|
+
ref
|
|
19
|
+
]);
|
|
20
|
+
const handleChange = (e)=>{
|
|
21
|
+
if (onValueChange) {
|
|
22
|
+
onChange?.(e);
|
|
23
|
+
onValueChange(e.target.value);
|
|
24
|
+
} else onChange?.(e.target.value);
|
|
25
|
+
};
|
|
16
26
|
const handleClear = ()=>{
|
|
17
|
-
|
|
27
|
+
const input = inputRef.current;
|
|
28
|
+
if (input) {
|
|
29
|
+
Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set?.call(input, '');
|
|
30
|
+
input.dispatchEvent(new Event('input', {
|
|
31
|
+
bubbles: true
|
|
32
|
+
}));
|
|
33
|
+
input.focus();
|
|
34
|
+
}
|
|
18
35
|
onClear?.();
|
|
19
36
|
};
|
|
20
37
|
return /*#__PURE__*/ jsxs(InputGroup, {
|
|
@@ -31,11 +48,11 @@ const search_Search = /*#__PURE__*/ forwardRef(({ className, value, onChange, on
|
|
|
31
48
|
})
|
|
32
49
|
}),
|
|
33
50
|
/*#__PURE__*/ jsx(InputGroupInput, {
|
|
34
|
-
ref:
|
|
51
|
+
ref: setRef,
|
|
35
52
|
type: "search",
|
|
36
53
|
className: cn('[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none', className),
|
|
37
54
|
value: value,
|
|
38
|
-
onChange:
|
|
55
|
+
onChange: handleChange,
|
|
39
56
|
...props
|
|
40
57
|
}),
|
|
41
58
|
showClearButton && value && /*#__PURE__*/ jsx(InputGroupAddon, {
|
|
@@ -54,6 +71,8 @@ const search_Search = /*#__PURE__*/ forwardRef(({ className, value, onChange, on
|
|
|
54
71
|
search_Search.displayName = 'Search';
|
|
55
72
|
const SearchWithSuggestions = /*#__PURE__*/ forwardRef(({ value, onChange, placeholder = 'Search...', suggestions = [], onSelect, emptyMessage = 'No results found.', className, strings }, ref)=>{
|
|
56
73
|
const [open, setOpen] = useState(false);
|
|
74
|
+
const anchorRef = useRef(null);
|
|
75
|
+
const popupId = useId();
|
|
57
76
|
const [searchValue, setSearchValue] = useState(value || '');
|
|
58
77
|
useEffect(()=>{
|
|
59
78
|
if (void 0 !== value) setSearchValue(value);
|
|
@@ -72,33 +91,39 @@ const SearchWithSuggestions = /*#__PURE__*/ forwardRef(({ value, onChange, place
|
|
|
72
91
|
onChange?.(newValue);
|
|
73
92
|
setOpen(newValue.length > 0);
|
|
74
93
|
};
|
|
94
|
+
const isOpen = open && filteredSuggestions.length > 0;
|
|
75
95
|
return /*#__PURE__*/ jsx("div", {
|
|
76
96
|
ref: ref,
|
|
77
97
|
"data-slot": "search-with-suggestions",
|
|
78
98
|
className: cn('relative', className),
|
|
79
99
|
children: /*#__PURE__*/ jsxs(Popover, {
|
|
80
|
-
open:
|
|
100
|
+
open: isOpen,
|
|
81
101
|
onOpenChange: setOpen,
|
|
82
102
|
children: [
|
|
83
|
-
/*#__PURE__*/ jsx(
|
|
103
|
+
/*#__PURE__*/ jsx(PopoverAnchor, {
|
|
84
104
|
asChild: true,
|
|
85
105
|
children: /*#__PURE__*/ jsx("div", {
|
|
106
|
+
ref: anchorRef,
|
|
86
107
|
children: /*#__PURE__*/ jsx(search_Search, {
|
|
87
108
|
value: searchValue,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
setSearchValue('');
|
|
91
|
-
onChange?.('');
|
|
92
|
-
setOpen(false);
|
|
93
|
-
},
|
|
109
|
+
onValueChange: handleInputChange,
|
|
110
|
+
onClick: ()=>setOpen(true),
|
|
94
111
|
placeholder: placeholder,
|
|
95
|
-
strings: strings
|
|
112
|
+
strings: strings,
|
|
113
|
+
"aria-haspopup": "dialog",
|
|
114
|
+
"aria-expanded": isOpen,
|
|
115
|
+
"aria-controls": isOpen ? popupId : void 0
|
|
96
116
|
})
|
|
97
117
|
})
|
|
98
118
|
}),
|
|
99
119
|
/*#__PURE__*/ jsx(PopoverContent, {
|
|
120
|
+
id: popupId,
|
|
100
121
|
className: "w-[--radix-popover-trigger-width] p-0",
|
|
101
122
|
align: "start",
|
|
123
|
+
onOpenAutoFocus: (e)=>e.preventDefault(),
|
|
124
|
+
onInteractOutside: (e)=>{
|
|
125
|
+
if (anchorRef.current?.contains(e.target)) e.preventDefault();
|
|
126
|
+
},
|
|
102
127
|
children: /*#__PURE__*/ jsx(Command, {
|
|
103
128
|
children: /*#__PURE__*/ jsx(CommandList, {
|
|
104
129
|
children: 0 === filteredSuggestions.length ? /*#__PURE__*/ jsx(CommandEmpty, {
|
package/dist/styles.css
CHANGED