@noya-app/noya-designsystem 0.1.43 → 0.1.44
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +21 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/Combobox.tsx +22 -10
- package/src/components/SelectMenu.tsx +4 -0
package/dist/index.mjs
CHANGED
|
@@ -12272,7 +12272,8 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
12272
12272
|
open,
|
|
12273
12273
|
onFocus,
|
|
12274
12274
|
onBlur,
|
|
12275
|
-
onOpenChange
|
|
12275
|
+
onOpenChange,
|
|
12276
|
+
contentStyle
|
|
12276
12277
|
}) {
|
|
12277
12278
|
const selectedItem = menuItems.find(
|
|
12278
12279
|
(item) => typeof item !== "string" && item.value === value
|
|
@@ -12360,7 +12361,9 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
12360
12361
|
collisionPadding: 8,
|
|
12361
12362
|
align: "end",
|
|
12362
12363
|
style: {
|
|
12363
|
-
width: "var(--radix-select-trigger-width)"
|
|
12364
|
+
width: "var(--radix-select-trigger-width)",
|
|
12365
|
+
maxHeight: "500px",
|
|
12366
|
+
...contentStyle
|
|
12364
12367
|
}
|
|
12365
12368
|
},
|
|
12366
12369
|
/* @__PURE__ */ React51.createElement(Select.ScrollUpButton, { className: scrollButtonStyles }, /* @__PURE__ */ React51.createElement(
|
|
@@ -13158,7 +13161,7 @@ var Combobox = memo14(
|
|
|
13158
13161
|
if (rest.mode === "string") {
|
|
13159
13162
|
return {
|
|
13160
13163
|
mode: rest.mode,
|
|
13161
|
-
|
|
13164
|
+
value: rest.value,
|
|
13162
13165
|
onChange: rest.onChange,
|
|
13163
13166
|
onSelectItem: rest.onSelectItem,
|
|
13164
13167
|
onHoverItem: rest.onHoverItem,
|
|
@@ -13168,7 +13171,7 @@ var Combobox = memo14(
|
|
|
13168
13171
|
} else {
|
|
13169
13172
|
return {
|
|
13170
13173
|
mode: rest.mode,
|
|
13171
|
-
|
|
13174
|
+
value: rest.value,
|
|
13172
13175
|
onChange: rest.onChange,
|
|
13173
13176
|
onSelectItem: rest.onSelectItem,
|
|
13174
13177
|
onHoverItem: rest.onHoverItem,
|
|
@@ -13177,7 +13180,7 @@ var Combobox = memo14(
|
|
|
13177
13180
|
}
|
|
13178
13181
|
}, [
|
|
13179
13182
|
rest.mode,
|
|
13180
|
-
rest.
|
|
13183
|
+
rest.value,
|
|
13181
13184
|
rest.onChange,
|
|
13182
13185
|
rest.onSelectItem,
|
|
13183
13186
|
rest.onHoverItem,
|
|
@@ -13185,7 +13188,14 @@ var Combobox = memo14(
|
|
|
13185
13188
|
rest.allowArbitraryValues
|
|
13186
13189
|
]);
|
|
13187
13190
|
const ref = useRef17(null);
|
|
13188
|
-
|
|
13191
|
+
function getInitialValueString() {
|
|
13192
|
+
if (props.mode === "string") {
|
|
13193
|
+
return props.value ?? "";
|
|
13194
|
+
} else {
|
|
13195
|
+
return props.value?.name ?? "";
|
|
13196
|
+
}
|
|
13197
|
+
}
|
|
13198
|
+
const initialValueString = getInitialValueString();
|
|
13189
13199
|
const [comboboxState] = useState20(
|
|
13190
13200
|
() => new ComboboxState(
|
|
13191
13201
|
items,
|
|
@@ -13200,6 +13210,9 @@ var Combobox = memo14(
|
|
|
13200
13210
|
useEffect15(() => {
|
|
13201
13211
|
comboboxState.setItems(items);
|
|
13202
13212
|
}, [items, comboboxState]);
|
|
13213
|
+
useEffect15(() => {
|
|
13214
|
+
comboboxState.setFilter(initialValueString);
|
|
13215
|
+
}, [comboboxState, initialValueString]);
|
|
13203
13216
|
const { filter, selectedIndex, filteredItems } = state;
|
|
13204
13217
|
const shouldShowMenu = isFocused && !(hideMenuWhenEmptyValue && filter === "");
|
|
13205
13218
|
useEffect15(() => {
|
|
@@ -13414,9 +13427,10 @@ var Combobox = memo14(
|
|
|
13414
13427
|
);
|
|
13415
13428
|
useEffect15(() => {
|
|
13416
13429
|
if (!shouldBlur) return;
|
|
13430
|
+
if (document.activeElement !== ref.current) return;
|
|
13431
|
+
setShouldBlur(false);
|
|
13417
13432
|
ref.current?.focus();
|
|
13418
13433
|
handleBlur();
|
|
13419
|
-
setShouldBlur(false);
|
|
13420
13434
|
}, [shouldBlur, handleBlur]);
|
|
13421
13435
|
return /* @__PURE__ */ React54.createElement(
|
|
13422
13436
|
InputField.Root,
|