@tamagui/select 1.61.2 → 1.62.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/cjs/BubbleSelect.js +12 -26
- package/dist/cjs/BubbleSelect.js.map +1 -1
- package/dist/cjs/BubbleSelect.native.js +35 -0
- package/dist/cjs/BubbleSelect.native.js.map +6 -0
- package/dist/cjs/Select.js +80 -205
- package/dist/cjs/Select.js.map +2 -2
- package/dist/cjs/Select.native.js +353 -0
- package/dist/cjs/Select.native.js.map +6 -0
- package/dist/cjs/SelectContent.js +10 -34
- package/dist/cjs/SelectContent.js.map +1 -1
- package/dist/cjs/SelectContent.native.js +6 -11
- package/dist/cjs/SelectContent.native.js.map +1 -1
- package/dist/cjs/SelectImpl.js +94 -190
- package/dist/cjs/SelectImpl.js.map +1 -1
- package/dist/cjs/SelectImpl.native.js +6 -14
- package/dist/cjs/SelectImpl.native.js.map +1 -1
- package/dist/cjs/SelectItem.js +36 -88
- package/dist/cjs/SelectItem.js.map +1 -1
- package/dist/cjs/SelectItem.native.js +145 -0
- package/dist/cjs/SelectItem.native.js.map +6 -0
- package/dist/cjs/SelectScrollButton.js +40 -87
- package/dist/cjs/SelectScrollButton.js.map +2 -2
- package/dist/cjs/SelectScrollButton.native.js +6 -10
- package/dist/cjs/SelectScrollButton.native.js.map +1 -1
- package/dist/cjs/SelectTrigger.js +20 -40
- package/dist/cjs/SelectTrigger.js.map +2 -2
- package/dist/cjs/SelectTrigger.native.js +73 -0
- package/dist/cjs/SelectTrigger.native.js.map +6 -0
- package/dist/cjs/SelectViewport.js +24 -54
- package/dist/cjs/SelectViewport.js.map +2 -2
- package/dist/cjs/SelectViewport.native.js +9 -24
- package/dist/cjs/SelectViewport.native.js.map +1 -1
- package/dist/cjs/constants.js +6 -16
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/constants.native.js +38 -0
- package/dist/cjs/constants.native.js.map +6 -0
- package/dist/cjs/context.js +8 -20
- package/dist/cjs/context.js.map +1 -1
- package/dist/cjs/context.native.js +48 -0
- package/dist/cjs/context.native.js.map +6 -0
- package/dist/cjs/index.js +4 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +22 -0
- package/dist/cjs/index.native.js.map +6 -0
- package/dist/cjs/types.js +3 -6
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/types.native.js +15 -0
- package/dist/cjs/types.native.js.map +6 -0
- package/dist/cjs/useSelectBreakpointActive.js +8 -17
- package/dist/cjs/useSelectBreakpointActive.js.map +1 -1
- package/dist/cjs/useSelectBreakpointActive.native.js +35 -0
- package/dist/cjs/useSelectBreakpointActive.native.js.map +6 -0
- package/dist/esm/BubbleSelect.js +7 -15
- package/dist/esm/BubbleSelect.js.map +1 -1
- package/dist/esm/Select.js +73 -171
- package/dist/esm/Select.js.map +2 -2
- package/dist/esm/SelectContent.js +5 -20
- package/dist/esm/SelectContent.js.map +1 -1
- package/dist/esm/SelectImpl.js +87 -171
- package/dist/esm/SelectImpl.js.map +1 -1
- package/dist/esm/SelectItem.js +29 -70
- package/dist/esm/SelectItem.js.map +1 -1
- package/dist/esm/SelectScrollButton.js +33 -68
- package/dist/esm/SelectScrollButton.js.map +2 -2
- package/dist/esm/SelectTrigger.js +13 -23
- package/dist/esm/SelectTrigger.js.map +2 -2
- package/dist/esm/SelectViewport.js +19 -36
- package/dist/esm/SelectViewport.js.map +2 -2
- package/dist/esm/constants.js +1 -7
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/context.js +3 -9
- package/dist/esm/context.js.map +1 -1
- package/dist/esm/useSelectBreakpointActive.js +3 -8
- package/dist/esm/useSelectBreakpointActive.js.map +1 -1
- package/dist/jsx/BubbleSelect.js +7 -15
- package/dist/jsx/BubbleSelect.js.map +1 -1
- package/dist/jsx/BubbleSelect.native.js +17 -0
- package/dist/jsx/BubbleSelect.native.js.map +6 -0
- package/dist/jsx/Select.js +68 -165
- package/dist/jsx/Select.js.map +2 -2
- package/dist/jsx/Select.native.js +337 -0
- package/dist/jsx/Select.native.js.map +6 -0
- package/dist/jsx/SelectContent.js +3 -18
- package/dist/jsx/SelectContent.js.map +1 -1
- package/dist/jsx/SelectContent.native.js +1 -3
- package/dist/jsx/SelectContent.native.js.map +1 -1
- package/dist/jsx/SelectImpl.js +86 -167
- package/dist/jsx/SelectImpl.js.map +1 -1
- package/dist/jsx/SelectImpl.native.js +1 -6
- package/dist/jsx/SelectImpl.native.js.map +1 -1
- package/dist/jsx/SelectItem.js +28 -68
- package/dist/jsx/SelectItem.js.map +1 -1
- package/dist/jsx/SelectItem.native.js +115 -0
- package/dist/jsx/SelectItem.native.js.map +6 -0
- package/dist/jsx/SelectScrollButton.js +22 -53
- package/dist/jsx/SelectScrollButton.js.map +1 -1
- package/dist/jsx/SelectScrollButton.native.js +1 -2
- package/dist/jsx/SelectScrollButton.native.js.map +1 -1
- package/dist/jsx/SelectTrigger.js +11 -19
- package/dist/jsx/SelectTrigger.js.map +2 -2
- package/dist/jsx/SelectTrigger.native.js +44 -0
- package/dist/jsx/SelectTrigger.native.js.map +6 -0
- package/dist/jsx/SelectViewport.js +16 -32
- package/dist/jsx/SelectViewport.js.map +2 -2
- package/dist/jsx/SelectViewport.native.js +1 -5
- package/dist/jsx/SelectViewport.native.js.map +1 -1
- package/dist/jsx/constants.js +1 -7
- package/dist/jsx/constants.js.map +1 -1
- package/dist/jsx/constants.native.js +11 -0
- package/dist/jsx/constants.native.js.map +6 -0
- package/dist/jsx/context.js +2 -8
- package/dist/jsx/context.js.map +1 -1
- package/dist/jsx/context.native.js +20 -0
- package/dist/jsx/context.native.js.map +6 -0
- package/dist/jsx/index.native.js +3 -0
- package/dist/jsx/index.native.js.map +6 -0
- package/dist/jsx/types.native.js +1 -0
- package/dist/jsx/types.native.js.map +6 -0
- package/dist/jsx/useSelectBreakpointActive.js +3 -8
- package/dist/jsx/useSelectBreakpointActive.js.map +1 -1
- package/dist/jsx/useSelectBreakpointActive.native.js +13 -0
- package/dist/jsx/useSelectBreakpointActive.native.js.map +6 -0
- package/package.json +19 -19
- package/types/Select.d.ts +1 -0
- package/types/Select.d.ts.map +1 -1
- package/dist/esm/SelectContent.native.js +0 -7
- package/dist/esm/SelectContent.native.js.map +0 -6
- package/dist/esm/SelectImpl.native.js +0 -11
- package/dist/esm/SelectImpl.native.js.map +0 -6
- package/dist/esm/SelectScrollButton.native.js +0 -7
- package/dist/esm/SelectScrollButton.native.js.map +0 -6
- package/dist/esm/SelectViewport.native.js +0 -32
- package/dist/esm/SelectViewport.native.js.map +0 -6
package/dist/cjs/BubbleSelect.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from
|
|
7
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
8
|
for (let key of __getOwnPropNames(from))
|
|
11
|
-
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
9
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
10
|
return to;
|
|
15
11
|
};
|
|
16
12
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
@@ -18,31 +14,21 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
18
14
|
// file that has been converted to a CommonJS file using a Babel-
|
|
19
15
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
16
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable:
|
|
17
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
18
|
mod
|
|
23
19
|
));
|
|
24
|
-
var import_compose_refs = require("@tamagui/compose-refs");
|
|
25
|
-
var import_use_previous = require("@tamagui/use-previous");
|
|
26
|
-
var React = __toESM(require("react"));
|
|
20
|
+
var import_compose_refs = require("@tamagui/compose-refs"), import_use_previous = require("@tamagui/use-previous"), React = __toESM(require("react"));
|
|
27
21
|
const BubbleSelect = React.forwardRef((props, forwardedRef) => {
|
|
28
|
-
const { value, ...selectProps } = props;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const prevValue = (0, import_use_previous.usePrevious)(value);
|
|
32
|
-
React.useEffect(() => {
|
|
33
|
-
const select = ref.current;
|
|
34
|
-
const selectProto = window.HTMLSelectElement.prototype;
|
|
35
|
-
const descriptor = Object.getOwnPropertyDescriptor(
|
|
22
|
+
const { value, ...selectProps } = props, ref = React.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref), prevValue = (0, import_use_previous.usePrevious)(value);
|
|
23
|
+
return React.useEffect(() => {
|
|
24
|
+
const select = ref.current, selectProto = window.HTMLSelectElement.prototype, setValue = Object.getOwnPropertyDescriptor(
|
|
36
25
|
selectProto,
|
|
37
26
|
"value"
|
|
38
|
-
);
|
|
39
|
-
const setValue = descriptor.set;
|
|
27
|
+
).set;
|
|
40
28
|
if (prevValue !== value && setValue) {
|
|
41
|
-
const event = new Event("change", { bubbles:
|
|
42
|
-
setValue.call(select, value);
|
|
43
|
-
select.dispatchEvent(event);
|
|
29
|
+
const event = new Event("change", { bubbles: !0 });
|
|
30
|
+
setValue.call(select, value), select.dispatchEvent(event);
|
|
44
31
|
}
|
|
45
|
-
}, [prevValue, value]);
|
|
46
|
-
return null;
|
|
32
|
+
}, [prevValue, value]), null;
|
|
47
33
|
});
|
|
48
34
|
//# sourceMappingURL=BubbleSelect.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/BubbleSelect.tsx"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA,0BAAgC,kCAChC,sBAA4B,kCAC5B,QAAuB;AAGvB,MAAM,eAAe,MAAM,WAGzB,CAAC,OAAO,iBAAiB;AACzB,QAAM,EAAE,OAAO,GAAG,YAAY,IAAI,OAC5B,MAAM,MAAM,OAA0B,IAAI,GAC1C,mBAAe,qCAAgB,cAAc,GAAG,GAChD,gBAAY,iCAAY,KAAK;AAGnC,eAAM,UAAU,MAAM;AACpB,UAAM,SAAS,IAAI,SACb,cAAc,OAAO,kBAAkB,WAKvC,WAJa,OAAO;AAAA,MACxB;AAAA,MACA;AAAA,IACF,EAC4B;AAC5B,QAAI,cAAc,SAAS,UAAU;AACnC,YAAM,QAAQ,IAAI,MAAM,UAAU,EAAE,SAAS,GAAK,CAAC;AACnD,eAAS,KAAK,QAAQ,KAAK,GAC3B,OAAO,cAAc,KAAK;AAAA,IAC5B;AAAA,EACF,GAAG,CAAC,WAAW,KAAK,CAAC,GAed;AAMT,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __copyProps = (to, from, except, desc) => {
|
|
8
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
9
|
+
for (let key of __getOwnPropNames(from))
|
|
10
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
14
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
15
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
16
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
17
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
18
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
19
|
+
mod
|
|
20
|
+
));
|
|
21
|
+
var import_compose_refs = require("@tamagui/compose-refs"), import_use_previous = require("@tamagui/use-previous"), React = __toESM(require("react"));
|
|
22
|
+
const BubbleSelect = React.forwardRef((props, forwardedRef) => {
|
|
23
|
+
const { value, ...selectProps } = props, ref = React.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref), prevValue = (0, import_use_previous.usePrevious)(value);
|
|
24
|
+
return React.useEffect(() => {
|
|
25
|
+
const select = ref.current, selectProto = window.HTMLSelectElement.prototype, setValue = Object.getOwnPropertyDescriptor(
|
|
26
|
+
selectProto,
|
|
27
|
+
"value"
|
|
28
|
+
).set;
|
|
29
|
+
if (prevValue !== value && setValue) {
|
|
30
|
+
const event = new Event("change", { bubbles: !0 });
|
|
31
|
+
setValue.call(select, value), select.dispatchEvent(event);
|
|
32
|
+
}
|
|
33
|
+
}, [prevValue, value]), null;
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=BubbleSelect.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/BubbleSelect.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA,0BAAgC,kCAChC,sBAA4B,kCAC5B,QAAuB;AAGvB,MAAM,eAAe,MAAM,WAGzB,CAAC,OAAO,iBAAiB;AACzB,QAAM,EAAE,OAAO,GAAG,YAAY,IAAI,OAC5B,MAAM,MAAM,OAA0B,IAAI,GAC1C,mBAAe,qCAAgB,cAAc,GAAG,GAChD,gBAAY,iCAAY,KAAK;AAGnC,eAAM,UAAU,MAAM;AACpB,UAAM,SAAS,IAAI,SACb,cAAc,OAAO,kBAAkB,WAKvC,WAJa,OAAO;AAAA,MACxB;AAAA,MACA;AAAA,IACF,EAC4B;AAC5B,QAAI,cAAc,SAAS,UAAU;AACnC,YAAM,QAAQ,IAAI,MAAM,UAAU,EAAE,SAAS,GAAK,CAAC;AACnD,eAAS,KAAK,QAAQ,KAAK,GAC3B,OAAO,cAAc,KAAK;AAAA,IAC5B;AAAA,EACF,GAAG,CAAC,WAAW,KAAK,CAAC,GAed;AAMT,CAAC;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/dist/cjs/Select.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable:
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
14
11
|
for (let key of __getOwnPropNames(from))
|
|
15
|
-
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
13
|
return to;
|
|
19
14
|
};
|
|
20
15
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
@@ -22,10 +17,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
17
|
// file that has been converted to a CommonJS file using a Babel-
|
|
23
18
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
19
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable:
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
26
21
|
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
29
23
|
var Select_exports = {};
|
|
30
24
|
__export(Select_exports, {
|
|
31
25
|
Select: () => Select,
|
|
@@ -35,51 +29,23 @@ __export(Select_exports, {
|
|
|
35
29
|
SelectSeparator: () => SelectSeparator
|
|
36
30
|
});
|
|
37
31
|
module.exports = __toCommonJS(Select_exports);
|
|
38
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
|
-
|
|
40
|
-
var import_compose_refs = require("@tamagui/compose-refs");
|
|
41
|
-
var import_core = require("@tamagui/core");
|
|
42
|
-
var import_get_token = require("@tamagui/get-token");
|
|
43
|
-
var import_list_item = require("@tamagui/list-item");
|
|
44
|
-
var import_portal = require("@tamagui/portal");
|
|
45
|
-
var import_separator = require("@tamagui/separator");
|
|
46
|
-
var import_sheet = require("@tamagui/sheet");
|
|
47
|
-
var import_stacks = require("@tamagui/stacks");
|
|
48
|
-
var import_text = require("@tamagui/text");
|
|
49
|
-
var import_use_controllable_state = require("@tamagui/use-controllable-state");
|
|
50
|
-
var React = __toESM(require("react"));
|
|
51
|
-
var import_constants = require("./constants");
|
|
52
|
-
var import_context = require("./context");
|
|
53
|
-
var import_SelectContent = require("./SelectContent");
|
|
54
|
-
var import_SelectImpl = require("./SelectImpl");
|
|
55
|
-
var import_SelectItem = require("./SelectItem");
|
|
56
|
-
var import_SelectScrollButton = require("./SelectScrollButton");
|
|
57
|
-
var import_SelectTrigger = require("./SelectTrigger");
|
|
58
|
-
var import_SelectViewport = require("./SelectViewport");
|
|
59
|
-
var import_useSelectBreakpointActive = require("./useSelectBreakpointActive");
|
|
60
|
-
const VALUE_NAME = "SelectValue";
|
|
61
|
-
const SelectValueFrame = (0, import_core.styled)(import_text.SizableText, {
|
|
32
|
+
var import_adapt = require("@tamagui/adapt"), import_compose_refs = require("@tamagui/compose-refs"), import_core = require("@tamagui/core"), import_get_token = require("@tamagui/get-token"), import_list_item = require("@tamagui/list-item"), import_portal = require("@tamagui/portal"), import_separator = require("@tamagui/separator"), import_sheet = require("@tamagui/sheet"), import_stacks = require("@tamagui/stacks"), import_text = require("@tamagui/text"), import_use_controllable_state = require("@tamagui/use-controllable-state"), React = __toESM(require("react")), import_constants = require("./constants"), import_context = require("./context"), import_SelectContent = require("./SelectContent"), import_SelectImpl = require("./SelectImpl"), import_SelectItem = require("./SelectItem"), import_SelectScrollButton = require("./SelectScrollButton"), import_SelectTrigger = require("./SelectTrigger"), import_SelectViewport = require("./SelectViewport"), import_useSelectBreakpointActive = require("./useSelectBreakpointActive"), import_jsx_runtime = require("react/jsx-runtime");
|
|
33
|
+
const VALUE_NAME = "SelectValue", SelectValueFrame = (0, import_core.styled)(import_text.SizableText, {
|
|
62
34
|
name: VALUE_NAME,
|
|
63
35
|
userSelect: "none"
|
|
64
|
-
})
|
|
65
|
-
const SelectValue = SelectValueFrame.styleable(function SelectValue2({
|
|
36
|
+
}), SelectValue = SelectValueFrame.styleable(function({
|
|
66
37
|
__scopeSelect,
|
|
67
38
|
children: childrenProp,
|
|
68
39
|
placeholder,
|
|
69
40
|
...props
|
|
70
41
|
}, forwardedRef) {
|
|
71
|
-
const context = (0, import_context.useSelectContext)(VALUE_NAME, __scopeSelect);
|
|
72
|
-
const itemParentContext = (0, import_context.useSelectItemParentContext)(VALUE_NAME, __scopeSelect);
|
|
73
|
-
const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.onValueNodeChange);
|
|
74
|
-
const children = childrenProp ?? context.selectedItem;
|
|
75
|
-
const isEmptyValue = context.value == null || context.value === "";
|
|
76
|
-
const selectValueChildren = isEmptyValue ? placeholder ?? children : children;
|
|
42
|
+
const context = (0, import_context.useSelectContext)(VALUE_NAME, __scopeSelect), itemParentContext = (0, import_context.useSelectItemParentContext)(VALUE_NAME, __scopeSelect), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.onValueNodeChange), children = childrenProp ?? context.selectedItem, selectValueChildren = context.value == null || context.value === "" ? placeholder ?? children : children;
|
|
77
43
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
78
44
|
SelectValueFrame,
|
|
79
45
|
{
|
|
80
46
|
...!props.unstyled && {
|
|
81
47
|
size: itemParentContext.size,
|
|
82
|
-
ellipse:
|
|
48
|
+
ellipse: !0
|
|
83
49
|
},
|
|
84
50
|
ref: composedRefs,
|
|
85
51
|
pointerEvents: "none",
|
|
@@ -90,14 +56,11 @@ const SelectValue = SelectValueFrame.styleable(function SelectValue2({
|
|
|
90
56
|
});
|
|
91
57
|
function unwrapSelectItem(selectValueChildren) {
|
|
92
58
|
return React.Children.map(selectValueChildren, (child) => {
|
|
93
|
-
var _a, _b, _c;
|
|
94
59
|
if (child) {
|
|
95
|
-
if (
|
|
60
|
+
if (child.type?.staticConfig?.componentName === ITEM_TEXT_NAME)
|
|
96
61
|
return child.props.children;
|
|
97
|
-
|
|
98
|
-
if ((_c = child.props) == null ? void 0 : _c.children) {
|
|
62
|
+
if (child.props?.children)
|
|
99
63
|
return unwrapSelectItem(child.props.children);
|
|
100
|
-
}
|
|
101
64
|
}
|
|
102
65
|
return child;
|
|
103
66
|
});
|
|
@@ -105,34 +68,25 @@ function unwrapSelectItem(selectValueChildren) {
|
|
|
105
68
|
const SelectIcon = (0, import_core.styled)(import_stacks.XStack, {
|
|
106
69
|
name: "SelectIcon",
|
|
107
70
|
// @ts-ignore
|
|
108
|
-
"aria-hidden":
|
|
71
|
+
"aria-hidden": !0,
|
|
109
72
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_text.Paragraph, { children: "\u25BC" })
|
|
110
|
-
})
|
|
111
|
-
const ITEM_TEXT_NAME = "SelectItemText";
|
|
112
|
-
const SelectItemTextFrame = (0, import_core.styled)(import_text.SizableText, {
|
|
73
|
+
}), ITEM_TEXT_NAME = "SelectItemText", SelectItemTextFrame = (0, import_core.styled)(import_text.SizableText, {
|
|
113
74
|
name: ITEM_TEXT_NAME,
|
|
114
75
|
variants: {
|
|
115
76
|
unstyled: {
|
|
116
77
|
false: {
|
|
117
78
|
userSelect: "none",
|
|
118
79
|
color: "$color",
|
|
119
|
-
ellipse:
|
|
80
|
+
ellipse: !0
|
|
120
81
|
}
|
|
121
82
|
}
|
|
122
83
|
},
|
|
123
84
|
defaultVariants: {
|
|
124
|
-
unstyled:
|
|
85
|
+
unstyled: !1
|
|
125
86
|
}
|
|
126
|
-
})
|
|
127
|
-
const SelectItemText = React.forwardRef(
|
|
87
|
+
}), SelectItemText = React.forwardRef(
|
|
128
88
|
(props, forwardedRef) => {
|
|
129
|
-
const { __scopeSelect, className, ...itemTextProps } = props
|
|
130
|
-
const context = (0, import_context.useSelectContext)(ITEM_TEXT_NAME, __scopeSelect);
|
|
131
|
-
const itemParentContext = (0, import_context.useSelectItemParentContext)(ITEM_TEXT_NAME, __scopeSelect);
|
|
132
|
-
const ref = React.useRef(null);
|
|
133
|
-
const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref);
|
|
134
|
-
const itemContext = (0, import_SelectItem.useSelectItemContext)(ITEM_TEXT_NAME, __scopeSelect);
|
|
135
|
-
const contents = React.useMemo(
|
|
89
|
+
const { __scopeSelect, className, ...itemTextProps } = props, context = (0, import_context.useSelectContext)(ITEM_TEXT_NAME, __scopeSelect), itemParentContext = (0, import_context.useSelectItemParentContext)(ITEM_TEXT_NAME, __scopeSelect), ref = React.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref), itemContext = (0, import_SelectItem.useSelectItemContext)(ITEM_TEXT_NAME, __scopeSelect), contents = React.useMemo(
|
|
136
90
|
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
137
91
|
SelectItemTextFrame,
|
|
138
92
|
{
|
|
@@ -146,66 +100,43 @@ const SelectItemText = React.forwardRef(
|
|
|
146
100
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
147
101
|
[props, itemParentContext.size, className, itemContext.textId]
|
|
148
102
|
);
|
|
149
|
-
React.useEffect(() => {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}, []);
|
|
154
|
-
React.useEffect(() => {
|
|
155
|
-
return itemParentContext.valueSubscribe((val) => {
|
|
156
|
-
if (val === itemContext.value) {
|
|
157
|
-
context.setSelectedItem(contents);
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
}, [itemContext.value]);
|
|
161
|
-
if (itemParentContext.shouldRenderWebNative) {
|
|
162
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: props.children });
|
|
163
|
-
}
|
|
164
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: contents });
|
|
103
|
+
return React.useEffect(() => {
|
|
104
|
+
itemParentContext.initialValue === itemContext.value && !context.selectedIndex && context.setSelectedItem(contents);
|
|
105
|
+
}, []), React.useEffect(() => itemParentContext.valueSubscribe((val) => {
|
|
106
|
+
val === itemContext.value && context.setSelectedItem(contents);
|
|
107
|
+
}), [itemContext.value]), itemParentContext.shouldRenderWebNative ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: props.children }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: contents });
|
|
165
108
|
}
|
|
166
109
|
);
|
|
167
110
|
SelectItemText.displayName = ITEM_TEXT_NAME;
|
|
168
|
-
const ITEM_INDICATOR_NAME = "SelectItemIndicator"
|
|
169
|
-
const SelectItemIndicatorFrame = (0, import_core.styled)(import_stacks.XStack, {
|
|
111
|
+
const ITEM_INDICATOR_NAME = "SelectItemIndicator", SelectItemIndicatorFrame = (0, import_core.styled)(import_stacks.XStack, {
|
|
170
112
|
name: ITEM_TEXT_NAME
|
|
171
|
-
})
|
|
172
|
-
const SelectItemIndicator = React.forwardRef(
|
|
113
|
+
}), SelectItemIndicator = React.forwardRef(
|
|
173
114
|
(props, forwardedRef) => {
|
|
174
|
-
const { __scopeSelect, ...itemIndicatorProps } = props;
|
|
175
|
-
|
|
176
|
-
const itemContext = (0, import_SelectItem.useSelectItemContext)(ITEM_INDICATOR_NAME, __scopeSelect);
|
|
177
|
-
if (context.shouldRenderWebNative) {
|
|
178
|
-
return null;
|
|
179
|
-
}
|
|
180
|
-
return itemContext.isSelected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemIndicatorFrame, { "aria-hidden": true, ...itemIndicatorProps, ref: forwardedRef }) : null;
|
|
115
|
+
const { __scopeSelect, ...itemIndicatorProps } = props, context = (0, import_context.useSelectItemParentContext)(ITEM_INDICATOR_NAME, __scopeSelect), itemContext = (0, import_SelectItem.useSelectItemContext)(ITEM_INDICATOR_NAME, __scopeSelect);
|
|
116
|
+
return context.shouldRenderWebNative ? null : itemContext.isSelected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemIndicatorFrame, { "aria-hidden": !0, ...itemIndicatorProps, ref: forwardedRef }) : null;
|
|
181
117
|
}
|
|
182
118
|
);
|
|
183
119
|
SelectItemIndicator.displayName = ITEM_INDICATOR_NAME;
|
|
184
|
-
const GROUP_NAME = "SelectGroup"
|
|
185
|
-
const [SelectGroupContextProvider, useSelectGroupContext] = (0, import_context.createSelectContext)(GROUP_NAME);
|
|
186
|
-
const SelectGroupFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
120
|
+
const GROUP_NAME = "SelectGroup", [SelectGroupContextProvider, useSelectGroupContext] = (0, import_context.createSelectContext)(GROUP_NAME), SelectGroupFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
187
121
|
name: GROUP_NAME,
|
|
188
122
|
width: "100%"
|
|
189
|
-
})
|
|
190
|
-
const NativeSelectTextFrame = (0, import_core.styled)(import_text.SizableText, {
|
|
123
|
+
}), NativeSelectTextFrame = (0, import_core.styled)(import_text.SizableText, {
|
|
191
124
|
tag: "select",
|
|
192
125
|
backgroundColor: "$background",
|
|
193
126
|
borderColor: "$borderColor",
|
|
194
127
|
hoverStyle: {
|
|
195
128
|
backgroundColor: "$backgroundHover"
|
|
196
129
|
}
|
|
197
|
-
})
|
|
198
|
-
const NativeSelectFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
130
|
+
}), NativeSelectFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
199
131
|
name: "NativeSelect",
|
|
200
|
-
bordered:
|
|
132
|
+
bordered: !0,
|
|
201
133
|
userSelect: "none",
|
|
202
134
|
outlineWidth: 0,
|
|
203
135
|
paddingRight: 10,
|
|
204
136
|
variants: {
|
|
205
137
|
size: {
|
|
206
138
|
"...size": (val, extras) => {
|
|
207
|
-
const { tokens } = extras;
|
|
208
|
-
const paddingHorizontal = (0, import_core.getVariableValue)(tokens.space[val]);
|
|
139
|
+
const { tokens } = extras, paddingHorizontal = (0, import_core.getVariableValue)(tokens.space[val]);
|
|
209
140
|
return {
|
|
210
141
|
borderRadius: tokens.radius[val] ?? val,
|
|
211
142
|
minHeight: tokens.size[val],
|
|
@@ -221,38 +152,28 @@ const NativeSelectFrame = (0, import_core.styled)(import_stacks.ThemeableStack,
|
|
|
221
152
|
defaultVariants: {
|
|
222
153
|
size: "$2"
|
|
223
154
|
}
|
|
224
|
-
})
|
|
225
|
-
const SelectGroup = React.forwardRef(
|
|
155
|
+
}), SelectGroup = React.forwardRef(
|
|
226
156
|
(props, forwardedRef) => {
|
|
227
|
-
const { __scopeSelect, ...groupProps } = props
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
// @ts-ignore
|
|
248
|
-
appearance: "none"
|
|
249
|
-
},
|
|
250
|
-
children: props.children
|
|
251
|
-
}
|
|
252
|
-
) })
|
|
253
|
-
);
|
|
254
|
-
}
|
|
255
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
157
|
+
const { __scopeSelect, ...groupProps } = props, groupId = React.useId(), context = (0, import_context.useSelectContext)(GROUP_NAME, __scopeSelect), itemParentContext = (0, import_context.useSelectItemParentContext)(GROUP_NAME, __scopeSelect), size = itemParentContext.size ?? "$true", nativeSelectRef = React.useRef(null), content = function() {
|
|
158
|
+
return itemParentContext.shouldRenderWebNative ? (
|
|
159
|
+
// @ts-expect-error until we support typing based on tag
|
|
160
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NativeSelectFrame, { asChild: !0, size, value: context.value, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
161
|
+
NativeSelectTextFrame,
|
|
162
|
+
{
|
|
163
|
+
onChange: (event) => {
|
|
164
|
+
itemParentContext.onChange(event.currentTarget.value);
|
|
165
|
+
},
|
|
166
|
+
size,
|
|
167
|
+
ref: nativeSelectRef,
|
|
168
|
+
style: {
|
|
169
|
+
color: "var(--color)",
|
|
170
|
+
// @ts-ignore
|
|
171
|
+
appearance: "none"
|
|
172
|
+
},
|
|
173
|
+
children: props.children
|
|
174
|
+
}
|
|
175
|
+
) })
|
|
176
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
256
177
|
SelectGroupFrame,
|
|
257
178
|
{
|
|
258
179
|
role: "group",
|
|
@@ -266,16 +187,10 @@ const SelectGroup = React.forwardRef(
|
|
|
266
187
|
}
|
|
267
188
|
);
|
|
268
189
|
SelectGroup.displayName = GROUP_NAME;
|
|
269
|
-
const LABEL_NAME = "SelectLabel"
|
|
270
|
-
const SelectLabel = React.forwardRef(
|
|
190
|
+
const LABEL_NAME = "SelectLabel", SelectLabel = React.forwardRef(
|
|
271
191
|
(props, forwardedRef) => {
|
|
272
|
-
const { __scopeSelect, ...labelProps } = props;
|
|
273
|
-
|
|
274
|
-
const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
|
|
275
|
-
if (context.shouldRenderWebNative) {
|
|
276
|
-
return null;
|
|
277
|
-
}
|
|
278
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
192
|
+
const { __scopeSelect, ...labelProps } = props, context = (0, import_context.useSelectItemParentContext)(LABEL_NAME, __scopeSelect), groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
|
|
193
|
+
return context.shouldRenderWebNative ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
279
194
|
import_list_item.ListItem,
|
|
280
195
|
{
|
|
281
196
|
tag: "div",
|
|
@@ -292,30 +207,20 @@ const SelectLabel = React.forwardRef(
|
|
|
292
207
|
SelectLabel.displayName = LABEL_NAME;
|
|
293
208
|
const SelectSeparator = (0, import_core.styled)(import_separator.Separator, {
|
|
294
209
|
name: "SelectSeparator"
|
|
295
|
-
})
|
|
296
|
-
const
|
|
297
|
-
const context = (0, import_context.useSelectContext)("SelectSheetController", props.__scopeSelect);
|
|
298
|
-
const showSheet = (0, import_useSelectBreakpointActive.useShowSelectSheet)(context);
|
|
299
|
-
const breakpointActive = (0, import_useSelectBreakpointActive.useSelectBreakpointActive)(context.sheetBreakpoint);
|
|
300
|
-
const getShowSheet = (0, import_core.useGet)(showSheet);
|
|
210
|
+
}), SelectSheetController = (props) => {
|
|
211
|
+
const context = (0, import_context.useSelectContext)("SelectSheetController", props.__scopeSelect), showSheet = (0, import_useSelectBreakpointActive.useShowSelectSheet)(context), breakpointActive = (0, import_useSelectBreakpointActive.useSelectBreakpointActive)(context.sheetBreakpoint), getShowSheet = (0, import_core.useGet)(showSheet);
|
|
301
212
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
302
213
|
import_sheet.SheetController,
|
|
303
214
|
{
|
|
304
215
|
onOpenChange: (val) => {
|
|
305
|
-
|
|
306
|
-
props.onOpenChange(val);
|
|
307
|
-
}
|
|
216
|
+
getShowSheet() && props.onOpenChange(val);
|
|
308
217
|
},
|
|
309
218
|
open: context.open,
|
|
310
|
-
hidden: breakpointActive ===
|
|
219
|
+
hidden: breakpointActive === !1,
|
|
311
220
|
children: props.children
|
|
312
221
|
}
|
|
313
222
|
);
|
|
314
|
-
}
|
|
315
|
-
const SelectSheetImpl = (props) => {
|
|
316
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: props.children });
|
|
317
|
-
};
|
|
318
|
-
const Select = (0, import_core.withStaticProperties)(
|
|
223
|
+
}, SelectSheetImpl = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: props.children }), Select = (0, import_core.withStaticProperties)(
|
|
319
224
|
(props) => {
|
|
320
225
|
const {
|
|
321
226
|
__scopeSelect,
|
|
@@ -329,49 +234,29 @@ const Select = (0, import_core.withStaticProperties)(
|
|
|
329
234
|
onValueChange,
|
|
330
235
|
size: sizeProp = "$true",
|
|
331
236
|
dir
|
|
332
|
-
} = props
|
|
333
|
-
const id = React.useId();
|
|
334
|
-
const scopeKey = __scopeSelect ? Object.keys(__scopeSelect)[0] ?? id : id;
|
|
335
|
-
const { when, AdaptProvider } = (0, import_adapt.useAdaptParent)({
|
|
237
|
+
} = props, id = React.useId(), scopeKey = __scopeSelect ? Object.keys(__scopeSelect)[0] ?? id : id, { when, AdaptProvider } = (0, import_adapt.useAdaptParent)({
|
|
336
238
|
Contents: React.useCallback(
|
|
337
239
|
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalHost, { name: `${scopeKey}SheetContents` }),
|
|
338
240
|
[scopeKey]
|
|
339
241
|
)
|
|
340
|
-
})
|
|
341
|
-
const sheetBreakpoint = when;
|
|
342
|
-
const isSheet = (0, import_useSelectBreakpointActive.useSelectBreakpointActive)(sheetBreakpoint);
|
|
343
|
-
const SelectImpl = isSheet || !import_core.isWeb ? SelectSheetImpl : import_SelectImpl.SelectInlineImpl;
|
|
344
|
-
const forceUpdate = React.useReducer(() => ({}), {})[1];
|
|
345
|
-
const [selectedItem, setSelectedItem] = React.useState(null);
|
|
346
|
-
const [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
|
|
242
|
+
}), sheetBreakpoint = when, SelectImpl = (0, import_useSelectBreakpointActive.useSelectBreakpointActive)(sheetBreakpoint) || !import_core.isWeb ? SelectSheetImpl : import_SelectImpl.SelectInlineImpl, forceUpdate = React.useReducer(() => ({}), {})[1], [selectedItem, setSelectedItem] = React.useState(null), [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
|
|
347
243
|
prop: openProp,
|
|
348
|
-
defaultProp: defaultOpen ||
|
|
244
|
+
defaultProp: defaultOpen || !1,
|
|
349
245
|
onChange: onOpenChange
|
|
350
|
-
})
|
|
351
|
-
const [value, setValue] = (0, import_use_controllable_state.useControllableState)({
|
|
246
|
+
}), [value, setValue] = (0, import_use_controllable_state.useControllableState)({
|
|
352
247
|
prop: valueProp,
|
|
353
248
|
defaultProp: defaultValue || "",
|
|
354
249
|
onChange: onValueChange,
|
|
355
|
-
transition:
|
|
250
|
+
transition: !0
|
|
356
251
|
});
|
|
357
252
|
React.useEffect(() => {
|
|
358
|
-
|
|
359
|
-
emitValue(value);
|
|
360
|
-
}
|
|
253
|
+
open && emitValue(value);
|
|
361
254
|
}, [open]);
|
|
362
|
-
const [activeIndex, setActiveIndex] = React.useState(0);
|
|
363
|
-
const [emitValue, valueSubscribe] = useEmitter();
|
|
364
|
-
const [emitActiveIndex, activeIndexSubscribe] = useEmitter();
|
|
365
|
-
const selectedIndexRef = React.useRef(null);
|
|
366
|
-
const activeIndexRef = React.useRef(null);
|
|
367
|
-
const listContentRef = React.useRef([]);
|
|
368
|
-
const [selectedIndex, setSelectedIndex] = React.useState(0);
|
|
369
|
-
const [valueNode, setValueNode] = React.useState(null);
|
|
255
|
+
const [activeIndex, setActiveIndex] = React.useState(0), [emitValue, valueSubscribe] = useEmitter(), [emitActiveIndex, activeIndexSubscribe] = useEmitter(), selectedIndexRef = React.useRef(null), activeIndexRef = React.useRef(null), listContentRef = React.useRef([]), [selectedIndex, setSelectedIndex] = React.useState(0), [valueNode, setValueNode] = React.useState(null);
|
|
370
256
|
(0, import_core.useIsomorphicLayoutEffect)(() => {
|
|
371
|
-
selectedIndexRef.current = selectedIndex;
|
|
372
|
-
activeIndexRef.current = activeIndex;
|
|
257
|
+
selectedIndexRef.current = selectedIndex, activeIndexRef.current = activeIndex;
|
|
373
258
|
});
|
|
374
|
-
const shouldRenderWebNative = import_core.isWeb && (native ===
|
|
259
|
+
const shouldRenderWebNative = import_core.isWeb && (native === !0 || native === "web" || Array.isArray(native) && native.includes("web"));
|
|
375
260
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
376
261
|
import_context.SelectItemParentProvider,
|
|
377
262
|
{
|
|
@@ -382,8 +267,7 @@ const Select = (0, import_core.withStaticProperties)(
|
|
|
382
267
|
valueSubscribe,
|
|
383
268
|
setOpen,
|
|
384
269
|
onChange: React.useCallback((val) => {
|
|
385
|
-
setValue(val);
|
|
386
|
-
emitValue(val);
|
|
270
|
+
setValue(val), emitValue(val);
|
|
387
271
|
}, []),
|
|
388
272
|
setSelectedIndex,
|
|
389
273
|
setValueAtIndex: React.useCallback((index, value2) => {
|
|
@@ -395,8 +279,8 @@ const Select = (0, import_core.withStaticProperties)(
|
|
|
395
279
|
{
|
|
396
280
|
scope: __scopeSelect,
|
|
397
281
|
dir,
|
|
398
|
-
blockSelection:
|
|
399
|
-
fallback:
|
|
282
|
+
blockSelection: !1,
|
|
283
|
+
fallback: !1,
|
|
400
284
|
selectedItem,
|
|
401
285
|
setSelectedItem,
|
|
402
286
|
forceUpdate,
|
|
@@ -407,10 +291,7 @@ const Select = (0, import_core.withStaticProperties)(
|
|
|
407
291
|
activeIndex,
|
|
408
292
|
selectedIndex,
|
|
409
293
|
setActiveIndex: React.useCallback((index) => {
|
|
410
|
-
setActiveIndex(index);
|
|
411
|
-
if (typeof index === "number") {
|
|
412
|
-
emitActiveIndex(index);
|
|
413
|
-
}
|
|
294
|
+
setActiveIndex(index), typeof index == "number" && emitActiveIndex(index);
|
|
414
295
|
}, []),
|
|
415
296
|
value,
|
|
416
297
|
open,
|
|
@@ -451,18 +332,12 @@ const Select = (0, import_core.withStaticProperties)(
|
|
|
451
332
|
);
|
|
452
333
|
function useEmitter() {
|
|
453
334
|
const listeners = React.useRef();
|
|
454
|
-
|
|
455
|
-
listeners.current = /* @__PURE__ */ new Set();
|
|
456
|
-
}
|
|
335
|
+
listeners.current || (listeners.current = /* @__PURE__ */ new Set());
|
|
457
336
|
const emit = (value) => {
|
|
458
337
|
listeners.current.forEach((l) => l(value));
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
return () => {
|
|
463
|
-
listeners.current.delete(listener);
|
|
464
|
-
};
|
|
465
|
-
}, []);
|
|
338
|
+
}, subscribe = React.useCallback((listener) => (listeners.current.add(listener), () => {
|
|
339
|
+
listeners.current.delete(listener);
|
|
340
|
+
}), []);
|
|
466
341
|
return [emit, subscribe];
|
|
467
342
|
}
|
|
468
343
|
Select.displayName = import_constants.SELECT_NAME;
|
package/dist/cjs/Select.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Select.tsx"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": ["
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsC,2BACtC,sBAAgC,kCAChC,cAYO,0BACP,mBAAyB,+BACzB,mBAAwC,+BACxC,gBAA2B,4BAC3B,mBAA0B,+BAC1B,eAAuC,2BACvC,gBAA+C,4BAC/C,cAAuC,0BACvC,gCAAqC,4CACrC,QAAuB,2BAEvB,mBAA4B,wBAC5B,iBAMO,sBACP,uBAA8B,4BAC9B,oBAAiC,yBACjC,oBAAiD,yBACjD,4BAA6D,iCAC7D,uBAA8B,4BAC9B,wBAA+B,6BAE/B,mCAGO,wCAmCH;AA7BJ,MAAM,aAAa,eAEb,uBAAmB,oBAAO,yBAAa;AAAA,EAC3C,MAAM;AAAA,EACN,YAAY;AACd,CAAC,GAMK,cAAc,iBAAiB,UAA4B,SAC/D;AAAA,EACE;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,GAAG;AACL,GACA,cACA;AAEA,QAAM,cAAU,iCAAiB,Y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