@tamagui/select 2.7.7 → 3.0.0-beta.643.1
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/Select.cjs +409 -467
- package/dist/cjs/Select.native.cjs +495 -0
- package/dist/cjs/Select.native.js +445 -492
- package/dist/cjs/Select.native.js.map +1 -1
- package/dist/cjs/SelectContent.cjs +80 -79
- package/dist/cjs/SelectContent.native.cjs +30 -0
- package/dist/cjs/SelectContent.native.js +18 -22
- package/dist/cjs/SelectContent.native.js.map +1 -1
- package/dist/cjs/SelectImpl.cjs +299 -319
- package/dist/cjs/SelectImpl.native.cjs +30 -0
- package/dist/cjs/SelectImpl.native.js +17 -24
- package/dist/cjs/SelectImpl.native.js.map +1 -1
- package/dist/cjs/SelectItem.cjs +268 -205
- package/dist/cjs/SelectItem.native.cjs +317 -0
- package/dist/cjs/SelectItem.native.js +291 -211
- package/dist/cjs/SelectItem.native.js.map +1 -1
- package/dist/cjs/SelectItemText.cjs +49 -79
- package/dist/cjs/SelectItemText.native.cjs +74 -0
- package/dist/cjs/SelectItemText.native.js +50 -79
- package/dist/cjs/SelectItemText.native.js.map +1 -1
- package/dist/cjs/SelectScrollButton.cjs +111 -130
- package/dist/cjs/SelectScrollButton.native.cjs +38 -0
- package/dist/cjs/SelectScrollButton.native.js +25 -22
- package/dist/cjs/SelectScrollButton.native.js.map +1 -1
- package/dist/cjs/SelectTrigger.cjs +69 -84
- package/dist/cjs/SelectTrigger.native.cjs +91 -0
- package/dist/cjs/SelectTrigger.native.js +71 -66
- package/dist/cjs/SelectTrigger.native.js.map +1 -1
- package/dist/cjs/SelectViewport.cjs +119 -142
- package/dist/cjs/SelectViewport.native.cjs +73 -0
- package/dist/cjs/SelectViewport.native.js +54 -50
- package/dist/cjs/SelectViewport.native.js.map +1 -1
- package/dist/cjs/constants.cjs +21 -22
- package/dist/cjs/constants.native.cjs +41 -0
- package/dist/cjs/constants.native.js +21 -21
- package/dist/cjs/constants.native.js.map +1 -1
- package/dist/cjs/context.cjs +38 -48
- package/dist/cjs/context.native.cjs +58 -0
- package/dist/cjs/context.native.js +40 -49
- package/dist/cjs/context.native.js.map +1 -1
- package/dist/cjs/index.cjs +15 -11
- package/dist/cjs/index.native.cjs +27 -0
- package/dist/cjs/index.native.js +15 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/selectionController.cjs +334 -0
- package/dist/cjs/selectionController.native.cjs +403 -0
- package/dist/cjs/selectionController.native.js +405 -0
- package/dist/cjs/selectionController.native.js.map +1 -0
- package/dist/cjs/types.cjs +10 -11
- package/dist/cjs/types.native.cjs +19 -0
- package/dist/cjs/types.native.js +10 -10
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/esm/Select.mjs +382 -443
- package/dist/esm/Select.mjs.map +1 -1
- package/dist/esm/Select.native.js +418 -469
- package/dist/esm/Select.native.js.map +1 -1
- package/dist/esm/SelectContent.mjs +67 -61
- package/dist/esm/SelectContent.mjs.map +1 -1
- package/dist/esm/SelectContent.native.js +4 -5
- package/dist/esm/SelectContent.native.js.map +1 -1
- package/dist/esm/SelectImpl.mjs +284 -294
- package/dist/esm/SelectImpl.mjs.map +1 -1
- package/dist/esm/SelectImpl.native.js +5 -8
- package/dist/esm/SelectImpl.native.js.map +1 -1
- package/dist/esm/SelectItem.mjs +252 -182
- package/dist/esm/SelectItem.mjs.map +1 -1
- package/dist/esm/SelectItem.native.js +276 -190
- package/dist/esm/SelectItem.native.js.map +1 -1
- package/dist/esm/SelectItemText.mjs +33 -55
- package/dist/esm/SelectItemText.mjs.map +1 -1
- package/dist/esm/SelectItemText.native.js +34 -56
- package/dist/esm/SelectItemText.native.js.map +1 -1
- package/dist/esm/SelectScrollButton.mjs +95 -107
- package/dist/esm/SelectScrollButton.mjs.map +1 -1
- package/dist/esm/SelectScrollButton.native.js +11 -7
- package/dist/esm/SelectScrollButton.native.js.map +1 -1
- package/dist/esm/SelectTrigger.mjs +56 -58
- package/dist/esm/SelectTrigger.mjs.map +1 -1
- package/dist/esm/SelectTrigger.native.js +54 -44
- package/dist/esm/SelectTrigger.native.js.map +1 -1
- package/dist/esm/SelectViewport.mjs +104 -119
- package/dist/esm/SelectViewport.mjs.map +1 -1
- package/dist/esm/SelectViewport.native.js +44 -39
- package/dist/esm/SelectViewport.native.js.map +1 -1
- package/dist/esm/constants.mjs +1 -0
- package/dist/esm/constants.mjs.map +1 -1
- package/dist/esm/constants.native.js +1 -0
- package/dist/esm/constants.native.js.map +1 -1
- package/dist/esm/context.mjs +20 -28
- package/dist/esm/context.mjs.map +1 -1
- package/dist/esm/context.native.js +23 -31
- package/dist/esm/context.native.js.map +1 -1
- package/dist/esm/index.js +13 -3
- package/dist/esm/index.mjs +13 -3
- package/dist/esm/index.native.js +13 -3
- package/dist/esm/selectionController.mjs +305 -0
- package/dist/esm/selectionController.mjs.map +1 -0
- package/dist/esm/selectionController.native.js +372 -0
- package/dist/esm/selectionController.native.js.map +1 -0
- package/dist/esm/types.mjs +0 -2
- package/dist/esm/types.native.js +0 -2
- package/dist/jsx/Select.mjs +382 -443
- package/dist/jsx/Select.mjs.map +1 -1
- package/dist/jsx/Select.native.cjs +495 -0
- package/dist/jsx/Select.native.js +445 -492
- package/dist/jsx/Select.native.js.map +1 -1
- package/dist/jsx/SelectContent.mjs +67 -61
- package/dist/jsx/SelectContent.mjs.map +1 -1
- package/dist/jsx/SelectContent.native.cjs +30 -0
- package/dist/jsx/SelectContent.native.js +18 -22
- package/dist/jsx/SelectContent.native.js.map +1 -1
- package/dist/jsx/SelectImpl.mjs +284 -294
- package/dist/jsx/SelectImpl.mjs.map +1 -1
- package/dist/jsx/SelectImpl.native.cjs +30 -0
- package/dist/jsx/SelectImpl.native.js +17 -24
- package/dist/jsx/SelectImpl.native.js.map +1 -1
- package/dist/jsx/SelectItem.mjs +252 -182
- package/dist/jsx/SelectItem.mjs.map +1 -1
- package/dist/jsx/SelectItem.native.cjs +317 -0
- package/dist/jsx/SelectItem.native.js +291 -211
- package/dist/jsx/SelectItem.native.js.map +1 -1
- package/dist/jsx/SelectItemText.mjs +33 -55
- package/dist/jsx/SelectItemText.mjs.map +1 -1
- package/dist/jsx/SelectItemText.native.cjs +74 -0
- package/dist/jsx/SelectItemText.native.js +50 -79
- package/dist/jsx/SelectItemText.native.js.map +1 -1
- package/dist/jsx/SelectScrollButton.mjs +95 -107
- package/dist/jsx/SelectScrollButton.mjs.map +1 -1
- package/dist/jsx/SelectScrollButton.native.cjs +38 -0
- package/dist/jsx/SelectScrollButton.native.js +25 -22
- package/dist/jsx/SelectScrollButton.native.js.map +1 -1
- package/dist/jsx/SelectTrigger.mjs +56 -58
- package/dist/jsx/SelectTrigger.mjs.map +1 -1
- package/dist/jsx/SelectTrigger.native.cjs +91 -0
- package/dist/jsx/SelectTrigger.native.js +71 -66
- package/dist/jsx/SelectTrigger.native.js.map +1 -1
- package/dist/jsx/SelectViewport.mjs +104 -119
- package/dist/jsx/SelectViewport.mjs.map +1 -1
- package/dist/jsx/SelectViewport.native.cjs +73 -0
- package/dist/jsx/SelectViewport.native.js +54 -50
- package/dist/jsx/SelectViewport.native.js.map +1 -1
- package/dist/jsx/constants.mjs +1 -0
- package/dist/jsx/constants.mjs.map +1 -1
- package/dist/jsx/constants.native.cjs +41 -0
- package/dist/jsx/constants.native.js +21 -21
- package/dist/jsx/constants.native.js.map +1 -1
- package/dist/jsx/context.mjs +20 -28
- package/dist/jsx/context.mjs.map +1 -1
- package/dist/jsx/context.native.cjs +58 -0
- package/dist/jsx/context.native.js +40 -49
- package/dist/jsx/context.native.js.map +1 -1
- package/dist/jsx/index.js +13 -3
- package/dist/jsx/index.mjs +13 -3
- package/dist/jsx/index.native.cjs +27 -0
- package/dist/jsx/index.native.js +15 -10
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/selectionController.mjs +305 -0
- package/dist/jsx/selectionController.mjs.map +1 -0
- package/dist/jsx/selectionController.native.cjs +403 -0
- package/dist/jsx/selectionController.native.js +405 -0
- package/dist/jsx/selectionController.native.js.map +1 -0
- package/dist/jsx/types.mjs +0 -2
- package/dist/jsx/types.native.cjs +19 -0
- package/dist/jsx/types.native.js +10 -10
- package/dist/jsx/types.native.js.map +1 -1
- package/package.json +28 -28
- package/src/Select.tsx +457 -357
- package/src/SelectContent.tsx +46 -16
- package/src/SelectImpl.native.tsx +0 -8
- package/src/SelectImpl.tsx +87 -100
- package/src/SelectItem.tsx +282 -136
- package/src/SelectItemText.tsx +16 -33
- package/src/SelectScrollButton.native.tsx +13 -4
- package/src/SelectScrollButton.tsx +56 -41
- package/src/SelectTrigger.tsx +77 -53
- package/src/SelectViewport.native.tsx +42 -25
- package/src/SelectViewport.tsx +52 -51
- package/src/context.tsx +6 -2
- package/src/index.tsx +5 -2
- package/src/selectionController.ts +389 -0
- package/src/types.tsx +88 -45
- package/types/Select.d.ts +139 -201
- package/types/Select.d.ts.map +1 -1
- package/types/SelectContent.d.ts +1 -1
- package/types/SelectContent.d.ts.map +1 -1
- package/types/SelectContent.native.d.ts.map +1 -1
- package/types/SelectImpl.d.ts +2 -1
- package/types/SelectImpl.d.ts.map +1 -1
- package/types/SelectImpl.native.d.ts +1 -5
- package/types/SelectImpl.native.d.ts.map +1 -1
- package/types/SelectItem.d.ts +13 -16
- package/types/SelectItem.d.ts.map +1 -1
- package/types/SelectItemText.d.ts +9 -13
- package/types/SelectItemText.d.ts.map +1 -1
- package/types/SelectScrollButton.d.ts +15 -2
- package/types/SelectScrollButton.d.ts.map +1 -1
- package/types/SelectScrollButton.native.d.ts +16 -3
- package/types/SelectScrollButton.native.d.ts.map +1 -1
- package/types/SelectTrigger.d.ts +11 -23
- package/types/SelectTrigger.d.ts.map +1 -1
- package/types/SelectViewport.d.ts +11 -38
- package/types/SelectViewport.d.ts.map +1 -1
- package/types/SelectViewport.native.d.ts +15 -4
- package/types/SelectViewport.native.d.ts.map +1 -1
- package/types/context.d.ts +2 -0
- package/types/context.d.ts.map +1 -1
- package/types/index.d.ts +5 -2
- package/types/index.d.ts.map +1 -1
- package/types/selectionController.d.ts +88 -0
- package/types/selectionController.d.ts.map +1 -0
- package/types/types.d.ts +47 -37
- package/types/types.d.ts.map +1 -1
- package/dist/cjs/BubbleSelect.cjs +0 -50
- package/dist/cjs/BubbleSelect.native.js +0 -30
- package/dist/cjs/BubbleSelect.native.js.map +0 -1
- package/dist/cjs/useSelectBreakpointActive.cjs +0 -32
- package/dist/cjs/useSelectBreakpointActive.native.js +0 -35
- package/dist/cjs/useSelectBreakpointActive.native.js.map +0 -1
- package/dist/esm/BubbleSelect.mjs +0 -27
- package/dist/esm/BubbleSelect.mjs.map +0 -1
- package/dist/esm/BubbleSelect.native.js +0 -4
- package/dist/esm/BubbleSelect.native.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/esm/types.mjs.map +0 -1
- package/dist/esm/types.native.js.map +0 -1
- package/dist/esm/useSelectBreakpointActive.mjs +0 -7
- package/dist/esm/useSelectBreakpointActive.mjs.map +0 -1
- package/dist/esm/useSelectBreakpointActive.native.js +0 -7
- package/dist/esm/useSelectBreakpointActive.native.js.map +0 -1
- package/dist/jsx/BubbleSelect.mjs +0 -27
- package/dist/jsx/BubbleSelect.mjs.map +0 -1
- package/dist/jsx/BubbleSelect.native.js +0 -30
- package/dist/jsx/BubbleSelect.native.js.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
- package/dist/jsx/types.mjs.map +0 -1
- package/dist/jsx/useSelectBreakpointActive.mjs +0 -7
- package/dist/jsx/useSelectBreakpointActive.mjs.map +0 -1
- package/dist/jsx/useSelectBreakpointActive.native.js +0 -35
- package/dist/jsx/useSelectBreakpointActive.native.js.map +0 -1
- package/src/BubbleSelect.tsx +0 -50
- package/src/useSelectBreakpointActive.tsx +0 -7
- package/types/BubbleSelect.d.ts +0 -2
- package/types/BubbleSelect.d.ts.map +0 -1
- package/types/useSelectBreakpointActive.d.ts +0 -3
- package/types/useSelectBreakpointActive.d.ts.map +0 -1
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __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)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
10
|
-
get: () => from[key],
|
|
11
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
22
|
-
value: mod,
|
|
23
|
-
enumerable: true
|
|
24
|
-
}) : target, mod));
|
|
25
|
-
var import_compose_refs = require("@tamagui/compose-refs");
|
|
26
|
-
var import_use_previous = require("@tamagui/use-previous");
|
|
27
|
-
var React = __toESM(require("react"), 1);
|
|
28
|
-
const BubbleSelect = React.forwardRef((props, forwardedRef) => {
|
|
29
|
-
const {
|
|
30
|
-
value,
|
|
31
|
-
...selectProps
|
|
32
|
-
} = props;
|
|
33
|
-
const ref = React.useRef(null);
|
|
34
|
-
const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref);
|
|
35
|
-
const prevValue = (0, import_use_previous.usePrevious)(value);
|
|
36
|
-
React.useEffect(() => {
|
|
37
|
-
const select = ref.current;
|
|
38
|
-
const selectProto = window.HTMLSelectElement.prototype;
|
|
39
|
-
const descriptor = Object.getOwnPropertyDescriptor(selectProto, "value");
|
|
40
|
-
const setValue = descriptor.set;
|
|
41
|
-
if (prevValue !== value && setValue) {
|
|
42
|
-
const event = new Event("change", {
|
|
43
|
-
bubbles: true
|
|
44
|
-
});
|
|
45
|
-
setValue.call(select, value);
|
|
46
|
-
select.dispatchEvent(event);
|
|
47
|
-
}
|
|
48
|
-
}, [prevValue, value]);
|
|
49
|
-
return null;
|
|
50
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: () => from[key],
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
-
value: mod,
|
|
25
|
-
enumerable: true
|
|
26
|
-
}) : target, mod));
|
|
27
|
-
var import_compose_refs = require("@tamagui/compose-refs");
|
|
28
|
-
var import_use_previous = require("@tamagui/use-previous");
|
|
29
|
-
var React = __toESM(require("react"), 1);
|
|
30
|
-
//# sourceMappingURL=BubbleSelect.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["import_compose_refs","require","import_use_previous","React","__toESM"],"sources":["../../src/BubbleSelect.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;gBAAA;AACA,IAAAA,mBAAA,GAA4BC,OAAA;AAC5B,IAAAC,mBAAuB,GAAAD,OAAA;AAGvB,IAAAE,KAAM,GAAAC,OAAA,CAAAH,OAAqB,WAGzB,CAAC","ignoreList":[]}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all) __defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
-
get: () => from[key],
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: true
|
|
22
|
-
}), mod);
|
|
23
|
-
var useSelectBreakpointActive_exports = {};
|
|
24
|
-
__export(useSelectBreakpointActive_exports, {
|
|
25
|
-
useShowSelectSheet: () => useShowSelectSheet
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(useSelectBreakpointActive_exports);
|
|
28
|
-
var import_adapt = require("@tamagui/adapt");
|
|
29
|
-
const useShowSelectSheet = context => {
|
|
30
|
-
const breakpointActive = (0, import_adapt.useAdaptIsActive)(context.adaptScope);
|
|
31
|
-
return context.open === false ? false : breakpointActive;
|
|
32
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all) __defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
-
get: () => from[key],
|
|
17
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
25
|
-
var useSelectBreakpointActive_exports = {};
|
|
26
|
-
__export(useSelectBreakpointActive_exports, {
|
|
27
|
-
useShowSelectSheet: () => useShowSelectSheet
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(useSelectBreakpointActive_exports);
|
|
30
|
-
var import_adapt = require("@tamagui/adapt");
|
|
31
|
-
var useShowSelectSheet = function (context) {
|
|
32
|
-
var breakpointActive = (0, import_adapt.useAdaptIsActive)(context.adaptScope);
|
|
33
|
-
return context.open === false ? false : breakpointActive;
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=useSelectBreakpointActive.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useSelectBreakpointActive_exports","__export","useShowSelectSheet","module","exports","import_adapt","require","context","breakpointActive","useAdaptIsActive","adaptScope","open"],"sources":["../../src/useSelectBreakpointActive.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,iCAAA;AAAAC,QAAA,CAAAD,iCAAA;EAAAE,kBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAiC,CAAAK,iCAAA;AAG1B,IAAAK,YAAM,GAAAC,OAAA,CAAqB,gBAAiC;AACjE,IAAAJ,kBAAM,YAAAA,CAAmBK,OAAA;EACzB,IAAAC,gBAAe,IAAS,GAAAH,YAAQ,CAAQI,gBAAA,EAAAF,OAAA,CAAAG,UAAA;EAC1C,OAAAH,OAAA,CAAAI,IAAA,qBAAAH,gBAAA","ignoreList":[]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
2
|
-
import { usePrevious } from "@tamagui/use-previous";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
const BubbleSelect = React.forwardRef((props, forwardedRef) => {
|
|
5
|
-
const {
|
|
6
|
-
value,
|
|
7
|
-
...selectProps
|
|
8
|
-
} = props;
|
|
9
|
-
const ref = React.useRef(null);
|
|
10
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
11
|
-
const prevValue = usePrevious(value);
|
|
12
|
-
React.useEffect(() => {
|
|
13
|
-
const select = ref.current;
|
|
14
|
-
const selectProto = window.HTMLSelectElement.prototype;
|
|
15
|
-
const descriptor = Object.getOwnPropertyDescriptor(selectProto, "value");
|
|
16
|
-
const setValue = descriptor.set;
|
|
17
|
-
if (prevValue !== value && setValue) {
|
|
18
|
-
const event = new Event("change", {
|
|
19
|
-
bubbles: true
|
|
20
|
-
});
|
|
21
|
-
setValue.call(select, value);
|
|
22
|
-
select.dispatchEvent(event);
|
|
23
|
-
}
|
|
24
|
-
}, [prevValue, value]);
|
|
25
|
-
return null;
|
|
26
|
-
});
|
|
27
|
-
//# sourceMappingURL=BubbleSelect.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useComposedRefs","usePrevious","React","BubbleSelect","forwardRef","props","forwardedRef","value","selectProps","ref","useRef","composedRefs","prevValue","useEffect","select","current","selectProto","window","HTMLSelectElement","prototype","descriptor","Object","getOwnPropertyDescriptor","setValue","set","event","Event","bubbles","call","dispatchEvent"],"sources":["../../src/BubbleSelect.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,eAAA,QAAuB;AAChC,SAASC,WAAA,QAAmB;AAC5B,YAAYC,KAAA,MAAW;AAGvB,MAAMC,YAAA,GAAeD,KAAA,CAAME,UAAA,CAGzB,CAACC,KAAA,EAAOC,YAAA,KAAiB;EACzB,MAAM;IAAEC,KAAA;IAAO,GAAGC;EAAY,IAAIH,KAAA;EAClC,MAAMI,GAAA,GAAMP,KAAA,CAAMQ,MAAA,CAA0B,IAAI;EAChD,MAAMC,YAAA,GAAeX,eAAA,CAAgBM,YAAA,EAAcG,GAAG;EACtD,MAAMG,SAAA,GAAYX,WAAA,CAAYM,KAAK;EAGnCL,KAAA,CAAMW,SAAA,CAAU,MAAM;IACpB,MAAMC,MAAA,GAASL,GAAA,CAAIM,OAAA;IACnB,MAAMC,WAAA,GAAcC,MAAA,CAAOC,iBAAA,CAAkBC,SAAA;IAC7C,MAAMC,UAAA,GAAaC,MAAA,CAAOC,wBAAA,CACxBN,WAAA,EACA,OACF;IACA,MAAMO,QAAA,GAAWH,UAAA,CAAWI,GAAA;IAC5B,IAAIZ,SAAA,KAAcL,KAAA,IAASgB,QAAA,EAAU;MACnC,MAAME,KAAA,GAAQ,IAAIC,KAAA,CAAM,UAAU;QAAEC,OAAA,EAAS;MAAK,CAAC;MACnDJ,QAAA,CAASK,IAAA,CAAKd,MAAA,EAAQP,KAAK;MAC3BO,MAAA,CAAOe,aAAA,CAAcJ,KAAK;IAC5B;EACF,GAAG,CAACb,SAAA,EAAWL,KAAK,CAAC;EAerB,OAAO;AAMT,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useComposedRefs","usePrevious","React"],"sources":["../../src/BubbleSelect.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,eAAA,QAAuB;AAChC,SAASC,WAAA,QAAmB;AAC5B,YAAYC,KAAA,MAAW","ignoreList":[]}
|
package/dist/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.tsx"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AAEd,cAAc","ignoreList":[]}
|
package/dist/esm/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.tsx"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AAEd,cAAc","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.tsx"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AAEd,cAAc","ignoreList":[]}
|
package/dist/esm/types.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { useAdaptIsActive } from "@tamagui/adapt";
|
|
2
|
-
const useShowSelectSheet = context => {
|
|
3
|
-
const breakpointActive = useAdaptIsActive(context.adaptScope);
|
|
4
|
-
return context.open === false ? false : breakpointActive;
|
|
5
|
-
};
|
|
6
|
-
export { useShowSelectSheet };
|
|
7
|
-
//# sourceMappingURL=useSelectBreakpointActive.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useAdaptIsActive","useShowSelectSheet","context","breakpointActive","adaptScope","open"],"sources":["../../src/useSelectBreakpointActive.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,gBAAA,QAAwB;AAG1B,MAAMC,kBAAA,GAAsBC,OAAA,IAAgC;EACjE,MAAMC,gBAAA,GAAmBH,gBAAA,CAAiBE,OAAA,CAAQE,UAAU;EAC5D,OAAOF,OAAA,CAAQG,IAAA,KAAS,QAAQ,QAAQF,gBAAA;AAC1C","ignoreList":[]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { useAdaptIsActive } from "@tamagui/adapt";
|
|
2
|
-
var useShowSelectSheet = function (context) {
|
|
3
|
-
var breakpointActive = useAdaptIsActive(context.adaptScope);
|
|
4
|
-
return context.open === false ? false : breakpointActive;
|
|
5
|
-
};
|
|
6
|
-
export { useShowSelectSheet };
|
|
7
|
-
//# sourceMappingURL=useSelectBreakpointActive.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useAdaptIsActive","useShowSelectSheet","context","breakpointActive","adaptScope","open"],"sources":["../../src/useSelectBreakpointActive.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,gBAAA,QAAwB;AAG1B,IAAAC,kBAAM,YAAAA,CAAsBC,OAAgC;EACjE,IAAAC,gBAAM,GAAAH,gBAAmB,CAAAE,OAAiB,CAAAE,UAAQ;EAClD,OAAOF,OAAA,CAAQG,IAAA,KAAS,QAAQ,QAAQF,gBAAA;AAC1C","ignoreList":[]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
2
|
-
import { usePrevious } from "@tamagui/use-previous";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
const BubbleSelect = React.forwardRef((props, forwardedRef) => {
|
|
5
|
-
const {
|
|
6
|
-
value,
|
|
7
|
-
...selectProps
|
|
8
|
-
} = props;
|
|
9
|
-
const ref = React.useRef(null);
|
|
10
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
11
|
-
const prevValue = usePrevious(value);
|
|
12
|
-
React.useEffect(() => {
|
|
13
|
-
const select = ref.current;
|
|
14
|
-
const selectProto = window.HTMLSelectElement.prototype;
|
|
15
|
-
const descriptor = Object.getOwnPropertyDescriptor(selectProto, "value");
|
|
16
|
-
const setValue = descriptor.set;
|
|
17
|
-
if (prevValue !== value && setValue) {
|
|
18
|
-
const event = new Event("change", {
|
|
19
|
-
bubbles: true
|
|
20
|
-
});
|
|
21
|
-
setValue.call(select, value);
|
|
22
|
-
select.dispatchEvent(event);
|
|
23
|
-
}
|
|
24
|
-
}, [prevValue, value]);
|
|
25
|
-
return null;
|
|
26
|
-
});
|
|
27
|
-
//# sourceMappingURL=BubbleSelect.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useComposedRefs","usePrevious","React","BubbleSelect","forwardRef","props","forwardedRef","value","selectProps","ref","useRef","composedRefs","prevValue","useEffect","select","current","selectProto","window","HTMLSelectElement","prototype","descriptor","Object","getOwnPropertyDescriptor","setValue","set","event","Event","bubbles","call","dispatchEvent"],"sources":["../../src/BubbleSelect.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,eAAA,QAAuB;AAChC,SAASC,WAAA,QAAmB;AAC5B,YAAYC,KAAA,MAAW;AAGvB,MAAMC,YAAA,GAAeD,KAAA,CAAME,UAAA,CAGzB,CAACC,KAAA,EAAOC,YAAA,KAAiB;EACzB,MAAM;IAAEC,KAAA;IAAO,GAAGC;EAAY,IAAIH,KAAA;EAClC,MAAMI,GAAA,GAAMP,KAAA,CAAMQ,MAAA,CAA0B,IAAI;EAChD,MAAMC,YAAA,GAAeX,eAAA,CAAgBM,YAAA,EAAcG,GAAG;EACtD,MAAMG,SAAA,GAAYX,WAAA,CAAYM,KAAK;EAGnCL,KAAA,CAAMW,SAAA,CAAU,MAAM;IACpB,MAAMC,MAAA,GAASL,GAAA,CAAIM,OAAA;IACnB,MAAMC,WAAA,GAAcC,MAAA,CAAOC,iBAAA,CAAkBC,SAAA;IAC7C,MAAMC,UAAA,GAAaC,MAAA,CAAOC,wBAAA,CACxBN,WAAA,EACA,OACF;IACA,MAAMO,QAAA,GAAWH,UAAA,CAAWI,GAAA;IAC5B,IAAIZ,SAAA,KAAcL,KAAA,IAASgB,QAAA,EAAU;MACnC,MAAME,KAAA,GAAQ,IAAIC,KAAA,CAAM,UAAU;QAAEC,OAAA,EAAS;MAAK,CAAC;MACnDJ,QAAA,CAASK,IAAA,CAAKd,MAAA,EAAQP,KAAK;MAC3BO,MAAA,CAAOe,aAAA,CAAcJ,KAAK;IAC5B;EACF,GAAG,CAACb,SAAA,EAAWL,KAAK,CAAC;EAerB,OAAO;AAMT,CAAC","ignoreList":[]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: () => from[key],
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
-
value: mod,
|
|
25
|
-
enumerable: true
|
|
26
|
-
}) : target, mod));
|
|
27
|
-
var import_compose_refs = require("@tamagui/compose-refs");
|
|
28
|
-
var import_use_previous = require("@tamagui/use-previous");
|
|
29
|
-
var React = __toESM(require("react"), 1);
|
|
30
|
-
//# sourceMappingURL=BubbleSelect.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__copyProps","to","from","except","desc","key","call","get","enumerable","__toESM","mod","isNodeMode","target","__esModule","value","import_compose_refs","require"],"sources":["../../src/BubbleSelect.tsx"],"sourcesContent":[null],"mappings":"AAAA,YAAS;;AACT,IAAAA,QAAS,GAAAC,MAAA,CAAAC,MAAmB;AAC5B,IAAAC,SAAY,GAAAF,MAAA,CAAWG,cAAA;AAGvB,IAAAC,gBAAM,GAAeJ,MAAM,CAAAK,wBAGjB;AACR,IAAAC,iBAAkB,GAAAN,MAAA,CAAAO,mBAAgB;AAClC,IAAAC,YAAY,GAAAR,MAAM,CAAAS,cAA8B;AAChD,IAAAC,YAAM,GAAAV,MAAe,CAAAW,SAAA,CAAAC,cAAgB;AACrC,IAAAC,WAAM,GAAAA,CAAAC,EAAY,EAAAC,IAAA,EAAAC,MAAY,EAAKC,IAAA;EAGnC,IAAAF,IAAM,WAAUA,IAAM,wBAAAA,IAAA;IACpB,SAAMG,GAAA,IAASZ,iBAAI,CAAAS,IAAA,GACnB,IAAM,CAAAL,YAAA,CAAcS,IAAA,CAAAL,EAAO,EAAAI,GAAA,KAAAA,GAAA,KAAkBF,MAAA,EAC7Cd,SAAM,CAAAY,EAAA,EAAAI,GAAa;MAAAE,GAAO,EAAAA,CAAA,KAAAL,IAAA,CAAAG,GAAA;MAAAG,UAAA,IAAAJ,IAAA,GAAAb,gBAAA,CAAAW,IAAA,EAAAG,GAAA,MAAAD,IAAA,CAAAI;IAAA;EAAA;EACxB,OACAP,EAAA;AAAA;AAEF,IAAAQ,OAAM,GAAAA,CAAAC,GAAA,EAAAC,UAAW,EAAWC,MAAA,MAAAA,MAAA,GAAAF,GAAA,WAAAxB,QAAA,CAAAS,YAAA,CAAAe,GAAA,SAAAV,WAAA;AAC5B;AACE;AACA;AACA;AAA0BW,UAC5B,KAAAD,GAAA,KAAAA,GAAA,CAAAG,UAAA,GAAAxB,SAAA,CAAAuB,MAAA;EAAAE,KAAA,EAAAJ,GAAA;EAAAF,UAAA;AAAA,KAAAI,MAAA,EACFF,GAeA;AAMF,IAACK,mBAAA,GAAAC,OAAA","ignoreList":[]}
|
package/dist/jsx/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.tsx"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AAEd,cAAc","ignoreList":[]}
|
package/dist/jsx/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.tsx"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AAEd,cAAc","ignoreList":[]}
|
package/dist/jsx/types.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { useAdaptIsActive } from "@tamagui/adapt";
|
|
2
|
-
const useShowSelectSheet = context => {
|
|
3
|
-
const breakpointActive = useAdaptIsActive(context.adaptScope);
|
|
4
|
-
return context.open === false ? false : breakpointActive;
|
|
5
|
-
};
|
|
6
|
-
export { useShowSelectSheet };
|
|
7
|
-
//# sourceMappingURL=useSelectBreakpointActive.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useAdaptIsActive","useShowSelectSheet","context","breakpointActive","adaptScope","open"],"sources":["../../src/useSelectBreakpointActive.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,gBAAA,QAAwB;AAG1B,MAAMC,kBAAA,GAAsBC,OAAA,IAAgC;EACjE,MAAMC,gBAAA,GAAmBH,gBAAA,CAAiBE,OAAA,CAAQE,UAAU;EAC5D,OAAOF,OAAA,CAAQG,IAAA,KAAS,QAAQ,QAAQF,gBAAA;AAC1C","ignoreList":[]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all) __defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
-
get: () => from[key],
|
|
17
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
25
|
-
var useSelectBreakpointActive_exports = {};
|
|
26
|
-
__export(useSelectBreakpointActive_exports, {
|
|
27
|
-
useShowSelectSheet: () => useShowSelectSheet
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(useSelectBreakpointActive_exports);
|
|
30
|
-
var import_adapt = require("@tamagui/adapt");
|
|
31
|
-
var useShowSelectSheet = function (context) {
|
|
32
|
-
var breakpointActive = (0, import_adapt.useAdaptIsActive)(context.adaptScope);
|
|
33
|
-
return context.open === false ? false : breakpointActive;
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=useSelectBreakpointActive.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty"],"sources":["../../src/useSelectBreakpointActive.tsx"],"sourcesContent":[null],"mappings":"AAAA,YAAS;;AAGF,IAAAA,SAAM,GAAAC,MAAA,CAAAC,cAAsB;AACjC,IAAAC,gBAAM,GAAAF,MAAmB,CAAAG,wBAAyB;AAClD,IAAAC,iBAAe,GAAAJ,MAAS,CAAAK,mBAAgB;AAC1C,IAAAC,YAAA,GAAAN,MAAA,CAAAO,SAAA,CAAAC,cAAA","ignoreList":[]}
|
package/src/BubbleSelect.tsx
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { useComposedRefs } from '@tamagui/compose-refs'
|
|
2
|
-
import { usePrevious } from '@tamagui/use-previous'
|
|
3
|
-
import * as React from 'react'
|
|
4
|
-
|
|
5
|
-
/* -----------------------------------------------------------------------------------------------*/
|
|
6
|
-
const BubbleSelect = React.forwardRef<
|
|
7
|
-
HTMLSelectElement,
|
|
8
|
-
React.ComponentPropsWithoutRef<'select'>
|
|
9
|
-
>((props, forwardedRef) => {
|
|
10
|
-
const { value, ...selectProps } = props
|
|
11
|
-
const ref = React.useRef<HTMLSelectElement>(null)
|
|
12
|
-
const composedRefs = useComposedRefs(forwardedRef, ref)
|
|
13
|
-
const prevValue = usePrevious(value)
|
|
14
|
-
|
|
15
|
-
// Bubble value change to parents (e.g form change event)
|
|
16
|
-
React.useEffect(() => {
|
|
17
|
-
const select = ref.current!
|
|
18
|
-
const selectProto = window.HTMLSelectElement.prototype
|
|
19
|
-
const descriptor = Object.getOwnPropertyDescriptor(
|
|
20
|
-
selectProto,
|
|
21
|
-
'value'
|
|
22
|
-
) as PropertyDescriptor
|
|
23
|
-
const setValue = descriptor.set
|
|
24
|
-
if (prevValue !== value && setValue) {
|
|
25
|
-
const event = new Event('change', { bubbles: true })
|
|
26
|
-
setValue.call(select, value)
|
|
27
|
-
select.dispatchEvent(event)
|
|
28
|
-
}
|
|
29
|
-
}, [prevValue, value])
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* We purposefully use a `select` here to support form autofill as much
|
|
33
|
-
* as possible.
|
|
34
|
-
*
|
|
35
|
-
* We purposefully do not add the `value` attribute here to allow the value
|
|
36
|
-
* to be set programatically and bubble to any parent form `onChange` event.
|
|
37
|
-
* Adding the `value` will cause React to consider the programatic
|
|
38
|
-
* dispatch a duplicate and it will get swallowed.
|
|
39
|
-
*
|
|
40
|
-
* We use `VisuallyHidden` rather than `display: "none"` because Safari autofill
|
|
41
|
-
* won't work otherwise.
|
|
42
|
-
*/
|
|
43
|
-
// TODO
|
|
44
|
-
return null
|
|
45
|
-
// return (
|
|
46
|
-
// <VisuallyHidden asChild>
|
|
47
|
-
// <select {...selectProps} ref={composedRefs} defaultValue={value} />
|
|
48
|
-
// </VisuallyHidden>
|
|
49
|
-
// )
|
|
50
|
-
})
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { useAdaptIsActive } from '@tamagui/adapt'
|
|
2
|
-
import type { SelectContextValue } from './types'
|
|
3
|
-
|
|
4
|
-
export const useShowSelectSheet = (context: SelectContextValue) => {
|
|
5
|
-
const breakpointActive = useAdaptIsActive(context.adaptScope)
|
|
6
|
-
return context.open === false ? false : breakpointActive
|
|
7
|
-
}
|
package/types/BubbleSelect.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BubbleSelect.d.ts","sourceRoot":"","sources":["../src/BubbleSelect.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSelectBreakpointActive.d.ts","sourceRoot":"","sources":["../src/useSelectBreakpointActive.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEjD,eAAO,MAAM,kBAAkB,GAAI,SAAS,kBAAkB,YAG7D,CAAA"}
|