@mw-kit/mw-ui 1.10.8 → 1.10.9
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.
|
@@ -2,9 +2,10 @@ import type { SelectPlacement } from '../../types';
|
|
|
2
2
|
type UseFloatingMenuParams = {
|
|
3
3
|
open: boolean;
|
|
4
4
|
onOpenChange: (open: boolean) => void;
|
|
5
|
+
minWidth: number;
|
|
5
6
|
placement?: SelectPlacement;
|
|
6
7
|
};
|
|
7
|
-
declare const useFloatingMenu: ({ open, onOpenChange, placement, }: UseFloatingMenuParams) => {
|
|
8
|
+
declare const useFloatingMenu: ({ open, onOpenChange, minWidth, placement, }: UseFloatingMenuParams) => {
|
|
8
9
|
floating: {
|
|
9
10
|
placement: import("@floating-ui/utils").Placement;
|
|
10
11
|
strategy: import("@floating-ui/utils").Strategy;
|
|
@@ -69,6 +69,7 @@ export type CommonSelectProps<Option> = SelectButtonProps & {
|
|
|
69
69
|
*/
|
|
70
70
|
estimateSize?: ReactVirtualizerOptions<Element, Element>['estimateSize'] | number;
|
|
71
71
|
height?: number;
|
|
72
|
+
minWidth?: number;
|
|
72
73
|
};
|
|
73
74
|
export type SelectSingleProps<Option> = CommonSelectProps<Option> & {
|
|
74
75
|
value: Option | null;
|
package/dist/index.d.mts
CHANGED
|
@@ -3234,6 +3234,7 @@ type CommonSelectProps<Option> = SelectButtonProps & {
|
|
|
3234
3234
|
*/
|
|
3235
3235
|
estimateSize?: ReactVirtualizerOptions<Element, Element>['estimateSize'] | number;
|
|
3236
3236
|
height?: number;
|
|
3237
|
+
minWidth?: number;
|
|
3237
3238
|
};
|
|
3238
3239
|
type SelectSingleProps<Option> = CommonSelectProps<Option> & {
|
|
3239
3240
|
value: Option | null;
|
package/dist/index.js
CHANGED
|
@@ -19059,6 +19059,7 @@ var import_react71 = require("@floating-ui/react");
|
|
|
19059
19059
|
var useFloatingMenu = ({
|
|
19060
19060
|
open,
|
|
19061
19061
|
onOpenChange,
|
|
19062
|
+
minWidth,
|
|
19062
19063
|
placement = "bottom"
|
|
19063
19064
|
}) => {
|
|
19064
19065
|
const floating = (0, import_react71.useFloating)({
|
|
@@ -19068,13 +19069,16 @@ var useFloatingMenu = ({
|
|
|
19068
19069
|
whileElementsMounted: import_react71.autoUpdate,
|
|
19069
19070
|
middleware: [
|
|
19070
19071
|
(0, import_react71.flip)(),
|
|
19071
|
-
(0, import_react71.size)(
|
|
19072
|
-
|
|
19073
|
-
|
|
19074
|
-
|
|
19075
|
-
|
|
19076
|
-
|
|
19077
|
-
|
|
19072
|
+
(0, import_react71.size)(
|
|
19073
|
+
{
|
|
19074
|
+
apply({ rects, elements }) {
|
|
19075
|
+
Object.assign(elements.floating.style, {
|
|
19076
|
+
minWidth: `${Math.max(rects.reference.width, minWidth)}px`
|
|
19077
|
+
});
|
|
19078
|
+
}
|
|
19079
|
+
},
|
|
19080
|
+
[minWidth]
|
|
19081
|
+
)
|
|
19078
19082
|
]
|
|
19079
19083
|
});
|
|
19080
19084
|
const transition = (0, import_react71.useTransitionStatus)(floating.context, {
|
|
@@ -20054,6 +20058,7 @@ var useMultiSelect = ({
|
|
|
20054
20058
|
overscan,
|
|
20055
20059
|
estimateSize,
|
|
20056
20060
|
height,
|
|
20061
|
+
minWidth = 290,
|
|
20057
20062
|
value,
|
|
20058
20063
|
setValue,
|
|
20059
20064
|
finder,
|
|
@@ -20071,6 +20076,7 @@ var useMultiSelect = ({
|
|
|
20071
20076
|
placeholder: closedLabel,
|
|
20072
20077
|
onClear: () => setValue([]),
|
|
20073
20078
|
Component: SelectMultiOptions,
|
|
20079
|
+
minWidth,
|
|
20074
20080
|
buttonProps
|
|
20075
20081
|
};
|
|
20076
20082
|
};
|
|
@@ -20197,6 +20203,7 @@ var useSingleSelect = ({
|
|
|
20197
20203
|
overscan,
|
|
20198
20204
|
estimateSize,
|
|
20199
20205
|
height,
|
|
20206
|
+
minWidth = 230,
|
|
20200
20207
|
value,
|
|
20201
20208
|
setValue,
|
|
20202
20209
|
ValueComponent,
|
|
@@ -20222,6 +20229,7 @@ var useSingleSelect = ({
|
|
|
20222
20229
|
placeholder: closedLabel,
|
|
20223
20230
|
onClear: () => setValue(null),
|
|
20224
20231
|
Component: SelectSingleOptions,
|
|
20232
|
+
minWidth,
|
|
20225
20233
|
buttonProps
|
|
20226
20234
|
};
|
|
20227
20235
|
};
|
|
@@ -20414,9 +20422,11 @@ var Select2 = import_react81.default.forwardRef(
|
|
|
20414
20422
|
const required = isRequired() || props.required;
|
|
20415
20423
|
const disabled = isDisabled() || props.disabled;
|
|
20416
20424
|
const viewMode = isViewMode() || props.viewMode;
|
|
20425
|
+
const { isEmpty, placeholder, Component: Component5, onClear, minWidth, buttonProps } = instances_default(props);
|
|
20417
20426
|
const { floating, transition, interactions } = useFloatingMenu_default({
|
|
20418
20427
|
open,
|
|
20419
20428
|
onOpenChange: setOpen,
|
|
20429
|
+
minWidth,
|
|
20420
20430
|
placement
|
|
20421
20431
|
});
|
|
20422
20432
|
const height = (0, import_react81.useMemo)(() => {
|
|
@@ -20431,7 +20441,6 @@ var Select2 = import_react81.default.forwardRef(
|
|
|
20431
20441
|
setOpen(true);
|
|
20432
20442
|
}
|
|
20433
20443
|
};
|
|
20434
|
-
const { isEmpty, placeholder, Component: Component5, onClear, buttonProps } = instances_default(props);
|
|
20435
20444
|
const clearEnabled = !isEmpty && props.clearable && !props.disabled && !props.readOnly;
|
|
20436
20445
|
const setRef = (0, import_react81.useCallback)(
|
|
20437
20446
|
(node) => {
|
package/dist/index.mjs
CHANGED
|
@@ -19019,6 +19019,7 @@ import {
|
|
|
19019
19019
|
var useFloatingMenu = ({
|
|
19020
19020
|
open,
|
|
19021
19021
|
onOpenChange,
|
|
19022
|
+
minWidth,
|
|
19022
19023
|
placement = "bottom"
|
|
19023
19024
|
}) => {
|
|
19024
19025
|
const floating = useFloating2({
|
|
@@ -19028,13 +19029,16 @@ var useFloatingMenu = ({
|
|
|
19028
19029
|
whileElementsMounted: autoUpdate2,
|
|
19029
19030
|
middleware: [
|
|
19030
19031
|
flip2(),
|
|
19031
|
-
size3(
|
|
19032
|
-
|
|
19033
|
-
|
|
19034
|
-
|
|
19035
|
-
|
|
19036
|
-
|
|
19037
|
-
|
|
19032
|
+
size3(
|
|
19033
|
+
{
|
|
19034
|
+
apply({ rects, elements }) {
|
|
19035
|
+
Object.assign(elements.floating.style, {
|
|
19036
|
+
minWidth: `${Math.max(rects.reference.width, minWidth)}px`
|
|
19037
|
+
});
|
|
19038
|
+
}
|
|
19039
|
+
},
|
|
19040
|
+
[minWidth]
|
|
19041
|
+
)
|
|
19038
19042
|
]
|
|
19039
19043
|
});
|
|
19040
19044
|
const transition = useTransitionStatus(floating.context, {
|
|
@@ -20014,6 +20018,7 @@ var useMultiSelect = ({
|
|
|
20014
20018
|
overscan,
|
|
20015
20019
|
estimateSize,
|
|
20016
20020
|
height,
|
|
20021
|
+
minWidth = 290,
|
|
20017
20022
|
value,
|
|
20018
20023
|
setValue,
|
|
20019
20024
|
finder,
|
|
@@ -20031,6 +20036,7 @@ var useMultiSelect = ({
|
|
|
20031
20036
|
placeholder: closedLabel,
|
|
20032
20037
|
onClear: () => setValue([]),
|
|
20033
20038
|
Component: SelectMultiOptions,
|
|
20039
|
+
minWidth,
|
|
20034
20040
|
buttonProps
|
|
20035
20041
|
};
|
|
20036
20042
|
};
|
|
@@ -20157,6 +20163,7 @@ var useSingleSelect = ({
|
|
|
20157
20163
|
overscan,
|
|
20158
20164
|
estimateSize,
|
|
20159
20165
|
height,
|
|
20166
|
+
minWidth = 230,
|
|
20160
20167
|
value,
|
|
20161
20168
|
setValue,
|
|
20162
20169
|
ValueComponent,
|
|
@@ -20182,6 +20189,7 @@ var useSingleSelect = ({
|
|
|
20182
20189
|
placeholder: closedLabel,
|
|
20183
20190
|
onClear: () => setValue(null),
|
|
20184
20191
|
Component: SelectSingleOptions,
|
|
20192
|
+
minWidth,
|
|
20185
20193
|
buttonProps
|
|
20186
20194
|
};
|
|
20187
20195
|
};
|
|
@@ -20374,9 +20382,11 @@ var Select2 = React348.forwardRef(
|
|
|
20374
20382
|
const required = isRequired() || props.required;
|
|
20375
20383
|
const disabled = isDisabled() || props.disabled;
|
|
20376
20384
|
const viewMode = isViewMode() || props.viewMode;
|
|
20385
|
+
const { isEmpty, placeholder, Component: Component5, onClear, minWidth, buttonProps } = instances_default(props);
|
|
20377
20386
|
const { floating, transition, interactions } = useFloatingMenu_default({
|
|
20378
20387
|
open,
|
|
20379
20388
|
onOpenChange: setOpen,
|
|
20389
|
+
minWidth,
|
|
20380
20390
|
placement
|
|
20381
20391
|
});
|
|
20382
20392
|
const height = useMemo13(() => {
|
|
@@ -20391,7 +20401,6 @@ var Select2 = React348.forwardRef(
|
|
|
20391
20401
|
setOpen(true);
|
|
20392
20402
|
}
|
|
20393
20403
|
};
|
|
20394
|
-
const { isEmpty, placeholder, Component: Component5, onClear, buttonProps } = instances_default(props);
|
|
20395
20404
|
const clearEnabled = !isEmpty && props.clearable && !props.disabled && !props.readOnly;
|
|
20396
20405
|
const setRef = useCallback12(
|
|
20397
20406
|
(node) => {
|