@majoo-ui/react 1.59.9-rc.1 → 1.59.9-rc.3
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.
|
@@ -105,14 +105,14 @@ export declare const SelectBox: import("@stitches/react/types/styled-component")
|
|
|
105
105
|
align?: "stretch" | "center" | "end" | "start" | "baseline" | undefined;
|
|
106
106
|
justify?: "center" | "end" | "start" | "between" | "evenly" | "around" | undefined;
|
|
107
107
|
wrap?: "wrap" | "noWrap" | "wrapReverse" | undefined;
|
|
108
|
-
gap?: 1 | 10 | 12 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | "1" | "2" | "3" | "
|
|
109
|
-
m?: 1 | 10 | 12 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | "1" | "2" | "3" | "
|
|
110
|
-
mt?: 1 | 10 | 12 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | "1" | "2" | "3" | "
|
|
111
|
-
mb?: 1 | 10 | 12 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | "1" | "2" | "3" | "
|
|
112
|
-
mr?: 1 | 10 | 12 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | "1" | "2" | "3" | "
|
|
113
|
-
ml?: 1 | 10 | 12 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | "1" | "2" | "3" | "
|
|
114
|
-
mx?: 1 | 10 | 12 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | "1" | "2" | "3" | "
|
|
115
|
-
my?: 1 | 10 | 12 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | "1" | "2" | "3" | "
|
|
108
|
+
gap?: 1 | 10 | 12 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | "1" | "2" | "3" | "4" | "10" | "12" | "5" | "6" | "7" | "8" | "9" | "11" | undefined;
|
|
109
|
+
m?: 1 | 10 | 12 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | "1" | "2" | "3" | "4" | "10" | "12" | "5" | "6" | "7" | "8" | "9" | "11" | undefined;
|
|
110
|
+
mt?: 1 | 10 | 12 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | "1" | "2" | "3" | "4" | "10" | "12" | "5" | "6" | "7" | "8" | "9" | "11" | undefined;
|
|
111
|
+
mb?: 1 | 10 | 12 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | "1" | "2" | "3" | "4" | "10" | "12" | "5" | "6" | "7" | "8" | "9" | "11" | undefined;
|
|
112
|
+
mr?: 1 | 10 | 12 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | "1" | "2" | "3" | "4" | "10" | "12" | "5" | "6" | "7" | "8" | "9" | "11" | undefined;
|
|
113
|
+
ml?: 1 | 10 | 12 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | "1" | "2" | "3" | "4" | "10" | "12" | "5" | "6" | "7" | "8" | "9" | "11" | undefined;
|
|
114
|
+
mx?: 1 | 10 | 12 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | "1" | "2" | "3" | "4" | "10" | "12" | "5" | "6" | "7" | "8" | "9" | "11" | undefined;
|
|
115
|
+
my?: 1 | 10 | 12 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | "1" | "2" | "3" | "4" | "10" | "12" | "5" | "6" | "7" | "8" | "9" | "11" | undefined;
|
|
116
116
|
mobileOnly?: boolean | "true" | undefined;
|
|
117
117
|
desktopOnly?: boolean | "true" | undefined;
|
|
118
118
|
}, {
|
package/index.esm.js
CHANGED
|
@@ -13048,10 +13048,24 @@ const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
13048
13048
|
const [item, setItem] = useState([]);
|
|
13049
13049
|
const [groupedItems, setGroupedItems] = useState([]);
|
|
13050
13050
|
const [selectedValue, setSelectedValue] = useState(value);
|
|
13051
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
13051
13052
|
const [query, setQuery] = useState();
|
|
13052
13053
|
const [openOptions, setOpenOptions] = useState(false);
|
|
13054
|
+
const [open, setOpen] = useState(false);
|
|
13053
13055
|
const selectBoxRef = useRef(null);
|
|
13054
13056
|
const scrollerRef = useRef(null);
|
|
13057
|
+
useEffect(() => {
|
|
13058
|
+
var _a, _b;
|
|
13059
|
+
if (search && Boolean(query)) {
|
|
13060
|
+
(_a = scrollerRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
|
13061
|
+
top: 0
|
|
13062
|
+
});
|
|
13063
|
+
return;
|
|
13064
|
+
}
|
|
13065
|
+
(_b = scrollerRef.current) === null || _b === void 0 ? void 0 : _b.scrollTo({
|
|
13066
|
+
top: selectedIndex * 60
|
|
13067
|
+
});
|
|
13068
|
+
}, [query, search, openOptions, open, selectedIndex]);
|
|
13055
13069
|
const handleInputValue = (value, isReset = false) => {
|
|
13056
13070
|
if (onSearch && !isReset) onSearch(value);
|
|
13057
13071
|
if (fetchData) return;
|
|
@@ -13184,6 +13198,7 @@ const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
13184
13198
|
}, void 0)
|
|
13185
13199
|
}), void 0);
|
|
13186
13200
|
};
|
|
13201
|
+
setOpen(isOpen);
|
|
13187
13202
|
return !isMobile ? jsx(Popover, Object.assign({
|
|
13188
13203
|
open: openOptions,
|
|
13189
13204
|
onOpenChange: setOpenOptions,
|
|
@@ -13367,7 +13382,8 @@ const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
13367
13382
|
var _a;
|
|
13368
13383
|
return /*#__PURE__*/createElement$2(SelectItem, Object.assign({}, getItemProps({
|
|
13369
13384
|
item,
|
|
13370
|
-
disabled: item.isDisabled || item.isGroup
|
|
13385
|
+
disabled: item.isDisabled || item.isGroup,
|
|
13386
|
+
onClick: () => setSelectedIndex(index)
|
|
13371
13387
|
}), {
|
|
13372
13388
|
key: (_a = item.value) !== null && _a !== void 0 ? _a : index,
|
|
13373
13389
|
hasGroup: !!item.group,
|
package/index.umd.js
CHANGED
|
@@ -13157,14 +13157,32 @@
|
|
|
13157
13157
|
var _x = React.useState(value),
|
|
13158
13158
|
selectedValue = _x[0],
|
|
13159
13159
|
setSelectedValue = _x[1];
|
|
13160
|
-
var _y = React.useState(),
|
|
13161
|
-
|
|
13162
|
-
|
|
13163
|
-
var _z = React.useState(
|
|
13164
|
-
|
|
13165
|
-
|
|
13160
|
+
var _y = React.useState(0),
|
|
13161
|
+
selectedIndex = _y[0],
|
|
13162
|
+
setSelectedIndex = _y[1];
|
|
13163
|
+
var _z = React.useState(),
|
|
13164
|
+
query = _z[0],
|
|
13165
|
+
setQuery = _z[1];
|
|
13166
|
+
var _0 = React.useState(false),
|
|
13167
|
+
openOptions = _0[0],
|
|
13168
|
+
setOpenOptions = _0[1];
|
|
13169
|
+
var _1 = React.useState(false),
|
|
13170
|
+
open = _1[0],
|
|
13171
|
+
setOpen = _1[1];
|
|
13166
13172
|
var selectBoxRef = React.useRef(null);
|
|
13167
13173
|
var scrollerRef = React.useRef(null);
|
|
13174
|
+
React.useEffect(function () {
|
|
13175
|
+
var _a, _b;
|
|
13176
|
+
if (search && Boolean(query)) {
|
|
13177
|
+
(_a = scrollerRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
|
13178
|
+
top: 0
|
|
13179
|
+
});
|
|
13180
|
+
return;
|
|
13181
|
+
}
|
|
13182
|
+
(_b = scrollerRef.current) === null || _b === void 0 ? void 0 : _b.scrollTo({
|
|
13183
|
+
top: selectedIndex * 60
|
|
13184
|
+
});
|
|
13185
|
+
}, [query, search, openOptions, open, selectedIndex]);
|
|
13168
13186
|
var handleInputValue = function handleInputValue(value, isReset) {
|
|
13169
13187
|
if (isReset === void 0) {
|
|
13170
13188
|
isReset = false;
|
|
@@ -13320,6 +13338,7 @@
|
|
|
13320
13338
|
}, void 0)
|
|
13321
13339
|
}), void 0);
|
|
13322
13340
|
};
|
|
13341
|
+
setOpen(isOpen);
|
|
13323
13342
|
return !isMobile ? jsxRuntime.jsx(Popover, __assign({
|
|
13324
13343
|
open: openOptions,
|
|
13325
13344
|
onOpenChange: setOpenOptions,
|
|
@@ -13509,7 +13528,10 @@
|
|
|
13509
13528
|
var _a;
|
|
13510
13529
|
return /*#__PURE__*/React.createElement(SelectItem, __assign({}, getItemProps({
|
|
13511
13530
|
item: item,
|
|
13512
|
-
disabled: item.isDisabled || item.isGroup
|
|
13531
|
+
disabled: item.isDisabled || item.isGroup,
|
|
13532
|
+
onClick: function () {
|
|
13533
|
+
return setSelectedIndex(index);
|
|
13534
|
+
}
|
|
13513
13535
|
}), {
|
|
13514
13536
|
key: (_a = item.value) !== null && _a !== void 0 ? _a : index,
|
|
13515
13537
|
hasGroup: !!item.group,
|