@tamagui/select 1.13.2 → 1.13.4
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 +1 -47
- package/dist/cjs/BubbleSelect.js.map +2 -2
- package/dist/cjs/Select.js +1 -494
- package/dist/cjs/Select.js.map +2 -2
- package/dist/cjs/SelectContent.js +1 -54
- package/dist/cjs/SelectContent.js.map +2 -2
- package/dist/cjs/SelectContent.native.js +1 -30
- package/dist/cjs/SelectContent.native.js.map +2 -2
- package/dist/cjs/SelectImpl.js +1 -308
- package/dist/cjs/SelectImpl.js.map +2 -2
- package/dist/cjs/SelectImpl.native.js +1 -34
- package/dist/cjs/SelectImpl.native.js.map +2 -2
- package/dist/cjs/SelectScrollButton.js +1 -175
- package/dist/cjs/SelectScrollButton.js.map +2 -2
- package/dist/cjs/SelectScrollButton.native.js +1 -31
- package/dist/cjs/SelectScrollButton.native.js.map +2 -2
- package/dist/cjs/SelectViewport.js +2 -115
- package/dist/cjs/SelectViewport.js.map +2 -2
- package/dist/cjs/SelectViewport.native.js +1 -52
- package/dist/cjs/SelectViewport.native.js.map +2 -2
- package/dist/cjs/constants.js +1 -46
- package/dist/cjs/constants.js.map +2 -2
- package/dist/cjs/context.js +1 -43
- package/dist/cjs/context.js.map +2 -2
- package/dist/cjs/index.js +1 -19
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/types.js +1 -16
- package/dist/cjs/types.js.map +2 -2
- package/dist/cjs/useSelectBreakpointActive.js +1 -42
- package/dist/cjs/useSelectBreakpointActive.js.map +2 -2
- package/dist/esm/BubbleSelect.js +1 -24
- package/dist/esm/BubbleSelect.js.map +2 -2
- package/dist/esm/BubbleSelect.mjs +1 -24
- package/dist/esm/BubbleSelect.mjs.map +2 -2
- package/dist/esm/Select.js +1 -464
- package/dist/esm/Select.js.map +2 -2
- package/dist/esm/Select.mjs +1 -464
- package/dist/esm/Select.mjs.map +2 -2
- package/dist/esm/SelectContent.js +1 -30
- package/dist/esm/SelectContent.js.map +2 -2
- package/dist/esm/SelectContent.mjs +1 -30
- package/dist/esm/SelectContent.mjs.map +2 -2
- package/dist/esm/SelectContent.native.js +1 -6
- package/dist/esm/SelectContent.native.js.map +2 -2
- package/dist/esm/SelectContent.native.mjs +1 -6
- package/dist/esm/SelectContent.native.mjs.map +2 -2
- package/dist/esm/SelectImpl.js +1 -294
- package/dist/esm/SelectImpl.js.map +2 -2
- package/dist/esm/SelectImpl.mjs +1 -294
- package/dist/esm/SelectImpl.mjs.map +2 -2
- package/dist/esm/SelectImpl.native.js +1 -10
- package/dist/esm/SelectImpl.native.js.map +2 -2
- package/dist/esm/SelectImpl.native.mjs +1 -10
- package/dist/esm/SelectImpl.native.mjs.map +2 -2
- package/dist/esm/SelectScrollButton.js +1 -140
- package/dist/esm/SelectScrollButton.js.map +2 -2
- package/dist/esm/SelectScrollButton.mjs +1 -140
- package/dist/esm/SelectScrollButton.mjs.map +2 -2
- package/dist/esm/SelectScrollButton.native.js +1 -6
- package/dist/esm/SelectScrollButton.native.js.map +2 -2
- package/dist/esm/SelectScrollButton.native.mjs +1 -6
- package/dist/esm/SelectScrollButton.native.mjs.map +2 -2
- package/dist/esm/SelectViewport.js +2 -80
- package/dist/esm/SelectViewport.js.map +2 -2
- package/dist/esm/SelectViewport.mjs +2 -80
- package/dist/esm/SelectViewport.mjs.map +2 -2
- package/dist/esm/SelectViewport.native.js +1 -18
- package/dist/esm/SelectViewport.native.js.map +2 -2
- package/dist/esm/SelectViewport.native.mjs +1 -18
- package/dist/esm/SelectViewport.native.mjs.map +2 -2
- package/dist/esm/constants.js +1 -16
- package/dist/esm/constants.js.map +2 -2
- package/dist/esm/constants.mjs +1 -16
- package/dist/esm/constants.mjs.map +2 -2
- package/dist/esm/context.js +1 -15
- package/dist/esm/context.js.map +2 -2
- package/dist/esm/context.mjs +1 -15
- package/dist/esm/context.mjs.map +2 -2
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +1 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/useSelectBreakpointActive.js +1 -17
- package/dist/esm/useSelectBreakpointActive.js.map +2 -2
- package/dist/esm/useSelectBreakpointActive.mjs +1 -17
- package/dist/esm/useSelectBreakpointActive.mjs.map +2 -2
- package/dist/jsx/BubbleSelect.js +1 -24
- package/dist/jsx/BubbleSelect.js.map +2 -2
- package/dist/jsx/BubbleSelect.mjs +1 -24
- package/dist/jsx/BubbleSelect.mjs.map +2 -2
- package/dist/jsx/Select.js +1 -428
- package/dist/jsx/Select.js.map +2 -2
- package/dist/jsx/Select.mjs +1 -428
- package/dist/jsx/Select.mjs.map +2 -2
- package/dist/jsx/SelectContent.js +1 -29
- package/dist/jsx/SelectContent.js.map +2 -2
- package/dist/jsx/SelectContent.mjs +1 -29
- package/dist/jsx/SelectContent.mjs.map +2 -2
- package/dist/jsx/SelectContent.native.js +1 -6
- package/dist/jsx/SelectContent.native.js.map +2 -2
- package/dist/jsx/SelectContent.native.mjs +1 -6
- package/dist/jsx/SelectContent.native.mjs.map +2 -2
- package/dist/jsx/SelectImpl.js +1 -286
- package/dist/jsx/SelectImpl.js.map +2 -2
- package/dist/jsx/SelectImpl.mjs +1 -286
- package/dist/jsx/SelectImpl.mjs.map +2 -2
- package/dist/jsx/SelectImpl.native.js +1 -9
- package/dist/jsx/SelectImpl.native.js.map +2 -2
- package/dist/jsx/SelectImpl.native.mjs +1 -9
- package/dist/jsx/SelectImpl.native.mjs.map +2 -2
- package/dist/jsx/SelectScrollButton.js +1 -126
- package/dist/jsx/SelectScrollButton.js.map +2 -2
- package/dist/jsx/SelectScrollButton.mjs +1 -126
- package/dist/jsx/SelectScrollButton.mjs.map +2 -2
- package/dist/jsx/SelectScrollButton.native.js +1 -6
- package/dist/jsx/SelectScrollButton.native.js.map +2 -2
- package/dist/jsx/SelectScrollButton.native.mjs +1 -6
- package/dist/jsx/SelectScrollButton.native.mjs.map +2 -2
- package/dist/jsx/SelectViewport.js +2 -72
- package/dist/jsx/SelectViewport.js.map +2 -2
- package/dist/jsx/SelectViewport.mjs +2 -72
- package/dist/jsx/SelectViewport.mjs.map +2 -2
- package/dist/jsx/SelectViewport.native.js +1 -17
- package/dist/jsx/SelectViewport.native.js.map +2 -2
- package/dist/jsx/SelectViewport.native.mjs +1 -17
- package/dist/jsx/SelectViewport.native.mjs.map +2 -2
- package/dist/jsx/constants.js +1 -16
- package/dist/jsx/constants.js.map +2 -2
- package/dist/jsx/constants.mjs +1 -16
- package/dist/jsx/constants.mjs.map +2 -2
- package/dist/jsx/context.js +1 -14
- package/dist/jsx/context.js.map +2 -2
- package/dist/jsx/context.mjs +1 -14
- package/dist/jsx/context.mjs.map +2 -2
- package/dist/jsx/index.js +1 -2
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +1 -2
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/useSelectBreakpointActive.js +1 -17
- package/dist/jsx/useSelectBreakpointActive.js.map +2 -2
- package/dist/jsx/useSelectBreakpointActive.mjs +1 -17
- package/dist/jsx/useSelectBreakpointActive.mjs.map +2 -2
- package/package.json +16 -16
|
@@ -1,53 +1,2 @@
|
|
|
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;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var SelectViewport_native_exports = {};
|
|
30
|
-
__export(SelectViewport_native_exports, {
|
|
31
|
-
SelectViewport: () => SelectViewport
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(SelectViewport_native_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
-
var import_adapt = require("@tamagui/adapt");
|
|
36
|
-
var import_core = require("@tamagui/core");
|
|
37
|
-
var import_portal = require("@tamagui/portal");
|
|
38
|
-
var React = __toESM(require("react"));
|
|
39
|
-
var import_constants = require("./constants");
|
|
40
|
-
var import_context = require("./context");
|
|
41
|
-
const SelectViewport = (props) => {
|
|
42
|
-
const { __scopeSelect, children } = props;
|
|
43
|
-
const context = (0, import_context.useSelectContext)(import_constants.VIEWPORT_NAME, __scopeSelect);
|
|
44
|
-
const themeName = (0, import_core.useThemeName)();
|
|
45
|
-
const adaptContext = React.useContext(import_adapt.AdaptParentContext);
|
|
46
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalItem, { hostName: `${context.scopeKey}SheetContents`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, { name: themeName, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.SelectProvider, { scope: __scopeSelect, ...context, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_adapt.AdaptParentContext.Provider, { value: adaptContext, children }) }) }) });
|
|
47
|
-
};
|
|
48
|
-
SelectViewport.displayName = import_constants.VIEWPORT_NAME;
|
|
49
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
-
0 && (module.exports = {
|
|
51
|
-
SelectViewport
|
|
52
|
-
});
|
|
1
|
+
"use strict";var f=Object.create;var c=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var N=(e,t)=>{for(var o in t)c(e,o,{get:t[o],enumerable:!0})},P=(e,t,o,m)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of x(t))!v.call(e,r)&&r!==o&&c(e,r,{get:()=>t[r],enumerable:!(m=h(t,r))||m.enumerable});return e};var u=(e,t,o)=>(o=e!=null?f(C(e)):{},P(t||!e||!e.__esModule?c(o,"default",{value:e,enumerable:!0}):o,e)),T=e=>P(c({},"__esModule",{value:!0}),e);var w={};N(w,{SelectViewport:()=>d});module.exports=T(w);var p=require("react/jsx-runtime"),n=require("@tamagui/adapt"),s=require("@tamagui/core"),l=require("@tamagui/portal"),V=u(require("react")),i=require("./constants"),a=require("./context");const d=e=>{const{__scopeSelect:t,children:o}=e,m=(0,a.useSelectContext)(i.VIEWPORT_NAME,t),r=(0,s.useThemeName)(),S=V.useContext(n.AdaptParentContext);return(0,p.jsx)(l.PortalItem,{hostName:`${m.scopeKey}SheetContents`,children:(0,p.jsx)(s.Theme,{name:r,children:(0,p.jsx)(a.SelectProvider,{scope:t,...m,children:(0,p.jsx)(n.AdaptParentContext.Provider,{value:S,children:o})})})})};d.displayName=i.VIEWPORT_NAME;0&&(module.exports={SelectViewport});
|
|
53
2
|
//# sourceMappingURL=SelectViewport.native.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/SelectViewport.native.tsx"],
|
|
4
4
|
"sourcesContent": ["import { AdaptParentContext } from '@tamagui/adapt'\nimport { Stack, Theme, useThemeName } from '@tamagui/core'\nimport { PortalItem } from '@tamagui/portal'\nimport * as React from 'react'\n\nimport { VIEWPORT_NAME } from './constants'\nimport { SelectProvider, useSelectContext } from './context'\nimport { ScopedProps, SelectViewportProps } from './types'\n\nexport const SelectViewport = (props: ScopedProps<SelectViewportProps>) => {\n const { __scopeSelect, children } = props\n const context = useSelectContext(VIEWPORT_NAME, __scopeSelect)\n const themeName = useThemeName()\n const adaptContext = React.useContext(AdaptParentContext)\n\n // need to forward context...\n return (\n <PortalItem hostName={`${context.scopeKey}SheetContents`}>\n <Theme name={themeName}>\n <SelectProvider scope={__scopeSelect} {...context}>\n <AdaptParentContext.Provider value={adaptContext}>\n {children}\n </AdaptParentContext.Provider>\n </SelectProvider>\n </Theme>\n </PortalItem>\n )\n}\n\nSelectViewport.displayName = VIEWPORT_NAME\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,IAAA,eAAAC,EAAAH,GAoBU,IAAAI,EAAA,6BApBVC,EAAmC,0BACnCC,EAA2C,yBAC3CC,EAA2B,2BAC3BC,EAAuB,oBAEvBC,EAA8B,uBAC9BC,EAAiD,qBAG1C,MAAMR,EAAkBS,GAA4C,CACzE,KAAM,CAAE,cAAAC,EAAe,SAAAC,CAAS,EAAIF,EAC9BG,KAAU,oBAAiB,gBAAeF,CAAa,EACvDG,KAAY,gBAAa,EACzBC,EAAeR,EAAM,WAAW,oBAAkB,EAGxD,SACE,OAAC,cAAW,SAAU,GAAGM,EAAQ,wBAC/B,mBAAC,SAAM,KAAMC,EACX,mBAAC,kBAAe,MAAOH,EAAgB,GAAGE,EACxC,mBAAC,qBAAmB,SAAnB,CAA4B,MAAOE,EACjC,SAAAH,EACH,EACF,EACF,EACF,CAEJ,EAEAX,EAAe,YAAc",
|
|
6
|
+
"names": ["SelectViewport_native_exports", "__export", "SelectViewport", "__toCommonJS", "import_jsx_runtime", "import_adapt", "import_core", "import_portal", "React", "import_constants", "import_context", "props", "__scopeSelect", "children", "context", "themeName", "adaptContext"]
|
|
7
7
|
}
|
package/dist/cjs/constants.js
CHANGED
|
@@ -1,47 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var constants_exports = {};
|
|
20
|
-
__export(constants_exports, {
|
|
21
|
-
FALLBACK_THRESHOLD: () => FALLBACK_THRESHOLD,
|
|
22
|
-
MIN_HEIGHT: () => MIN_HEIGHT,
|
|
23
|
-
SCROLL_ARROW_THRESHOLD: () => SCROLL_ARROW_THRESHOLD,
|
|
24
|
-
SCROLL_ARROW_VELOCITY: () => SCROLL_ARROW_VELOCITY,
|
|
25
|
-
SELECT_NAME: () => SELECT_NAME,
|
|
26
|
-
VIEWPORT_NAME: () => VIEWPORT_NAME,
|
|
27
|
-
WINDOW_PADDING: () => WINDOW_PADDING
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(constants_exports);
|
|
30
|
-
const SELECT_NAME = "Select";
|
|
31
|
-
const WINDOW_PADDING = 8;
|
|
32
|
-
const SCROLL_ARROW_VELOCITY = 8;
|
|
33
|
-
const SCROLL_ARROW_THRESHOLD = 8;
|
|
34
|
-
const MIN_HEIGHT = 80;
|
|
35
|
-
const FALLBACK_THRESHOLD = 16;
|
|
36
|
-
const VIEWPORT_NAME = "SelectViewport";
|
|
37
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
-
0 && (module.exports = {
|
|
39
|
-
FALLBACK_THRESHOLD,
|
|
40
|
-
MIN_HEIGHT,
|
|
41
|
-
SCROLL_ARROW_THRESHOLD,
|
|
42
|
-
SCROLL_ARROW_VELOCITY,
|
|
43
|
-
SELECT_NAME,
|
|
44
|
-
VIEWPORT_NAME,
|
|
45
|
-
WINDOW_PADDING
|
|
46
|
-
});
|
|
1
|
+
"use strict";var c=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var p=(o,t)=>{for(var L in t)c(o,L,{get:t[L],enumerable:!0})},r=(o,t,L,E)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of R(t))!_.call(o,e)&&e!==L&&c(o,e,{get:()=>t[e],enumerable:!(E=O(t,e))||E.enumerable});return o};var n=o=>r(c({},"__esModule",{value:!0}),o);var C={};p(C,{FALLBACK_THRESHOLD:()=>I,MIN_HEIGHT:()=>H,SCROLL_ARROW_THRESHOLD:()=>S,SCROLL_ARROW_VELOCITY:()=>A,SELECT_NAME:()=>s,VIEWPORT_NAME:()=>T,WINDOW_PADDING:()=>x});module.exports=n(C);const s="Select",x=8,A=8,S=8,H=80,I=16,T="SelectViewport";0&&(module.exports={FALLBACK_THRESHOLD,MIN_HEIGHT,SCROLL_ARROW_THRESHOLD,SCROLL_ARROW_VELOCITY,SELECT_NAME,VIEWPORT_NAME,WINDOW_PADDING});
|
|
47
2
|
//# sourceMappingURL=constants.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/constants.tsx"],
|
|
4
4
|
"sourcesContent": ["export const SELECT_NAME = 'Select'\nexport const WINDOW_PADDING = 8\nexport const SCROLL_ARROW_VELOCITY = 8\nexport const SCROLL_ARROW_THRESHOLD = 8\nexport const MIN_HEIGHT = 80\nexport const FALLBACK_THRESHOLD = 16\nexport const VIEWPORT_NAME = 'SelectViewport'\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,EAAA,eAAAC,EAAA,2BAAAC,EAAA,0BAAAC,EAAA,gBAAAC,EAAA,kBAAAC,EAAA,mBAAAC,IAAA,eAAAC,EAAAT,GAAO,MAAMM,EAAc,SACdE,EAAiB,EACjBH,EAAwB,EACxBD,EAAyB,EACzBD,EAAa,GACbD,EAAqB,GACrBK,EAAgB",
|
|
6
|
+
"names": ["constants_exports", "__export", "FALLBACK_THRESHOLD", "MIN_HEIGHT", "SCROLL_ARROW_THRESHOLD", "SCROLL_ARROW_VELOCITY", "SELECT_NAME", "VIEWPORT_NAME", "WINDOW_PADDING", "__toCommonJS"]
|
|
7
7
|
}
|
package/dist/cjs/context.js
CHANGED
|
@@ -1,44 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var context_exports = {};
|
|
20
|
-
__export(context_exports, {
|
|
21
|
-
ForwardSelectContext: () => ForwardSelectContext,
|
|
22
|
-
SelectProvider: () => SelectProvider,
|
|
23
|
-
createSelectContext: () => createSelectContext,
|
|
24
|
-
createSelectScope: () => createSelectScope,
|
|
25
|
-
useSelectContext: () => useSelectContext
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(context_exports);
|
|
28
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
-
var import_create_context = require("@tamagui/create-context");
|
|
30
|
-
var import_constants = require("./constants");
|
|
31
|
-
const [createSelectContext, createSelectScope] = (0, import_create_context.createContextScope)(import_constants.SELECT_NAME);
|
|
32
|
-
const [SelectProvider, useSelectContext] = createSelectContext(import_constants.SELECT_NAME);
|
|
33
|
-
const ForwardSelectContext = (props) => {
|
|
34
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectProvider, { isInSheet: true, scope: props.__scopeSelect, ...props.context, children: props.children });
|
|
35
|
-
};
|
|
36
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
-
0 && (module.exports = {
|
|
38
|
-
ForwardSelectContext,
|
|
39
|
-
SelectProvider,
|
|
40
|
-
createSelectContext,
|
|
41
|
-
createSelectScope,
|
|
42
|
-
useSelectContext
|
|
43
|
-
});
|
|
1
|
+
"use strict";var r=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var s=(e,t)=>{for(var c in t)r(e,c,{get:t[c],enumerable:!0})},m=(e,t,c,S)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of d(t))!i.call(e,o)&&o!==c&&r(e,o,{get:()=>t[o],enumerable:!(S=a(t,o))||S.enumerable});return e};var u=e=>m(r({},"__esModule",{value:!0}),e);var E={};s(E,{ForwardSelectContext:()=>h,SelectProvider:()=>p,createSelectContext:()=>x,createSelectScope:()=>P,useSelectContext:()=>f});module.exports=u(E);var C=require("react/jsx-runtime"),l=require("@tamagui/create-context"),n=require("./constants");const[x,P]=(0,l.createContextScope)(n.SELECT_NAME),[p,f]=x(n.SELECT_NAME),h=e=>(0,C.jsx)(p,{isInSheet:!0,scope:e.__scopeSelect,...e.context,children:e.children});0&&(module.exports={ForwardSelectContext,SelectProvider,createSelectContext,createSelectScope,useSelectContext});
|
|
44
2
|
//# sourceMappingURL=context.js.map
|
package/dist/cjs/context.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/context.tsx"],
|
|
4
4
|
"sourcesContent": ["import { createContextScope } from '@tamagui/create-context'\n\nimport { SELECT_NAME } from './constants'\nimport { ScopedProps, SelectContextValue } from './types'\n\nexport const [createSelectContext, createSelectScope] =\n createContextScope(SELECT_NAME)\n\nexport const [SelectProvider, useSelectContext] =\n createSelectContext<SelectContextValue>(SELECT_NAME)\n\nexport const ForwardSelectContext = (\n props: ScopedProps<{ children?: any; context: SelectContextValue }>,\n) => {\n return (\n <SelectProvider isInSheet scope={props.__scopeSelect} {...props.context}>\n {props.children}\n </SelectProvider>\n )\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,EAAA,mBAAAC,EAAA,wBAAAC,EAAA,sBAAAC,EAAA,qBAAAC,IAAA,eAAAC,EAAAP,GAeI,IAAAQ,EAAA,6BAfJC,EAAmC,mCAEnCC,EAA4B,uBAGrB,KAAM,CAACN,EAAqBC,CAAiB,KAClD,sBAAmB,aAAW,EAEnB,CAACF,EAAgBG,CAAgB,EAC5CF,EAAwC,aAAW,EAExCF,EACXS,MAGE,OAACR,EAAA,CAAe,UAAS,GAAC,MAAOQ,EAAM,cAAgB,GAAGA,EAAM,QAC7D,SAAAA,EAAM,SACT",
|
|
6
|
+
"names": ["context_exports", "__export", "ForwardSelectContext", "SelectProvider", "createSelectContext", "createSelectScope", "useSelectContext", "__toCommonJS", "import_jsx_runtime", "import_create_context", "import_constants", "props"]
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var src_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(src_exports);
|
|
18
|
-
__reExport(src_exports, require("./Select"), module.exports);
|
|
19
|
-
__reExport(src_exports, require("./context"), module.exports);
|
|
1
|
+
"use strict";var S=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var c=(o,e,l,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of f(e))!m.call(o,p)&&p!==l&&S(o,p,{get:()=>e[p],enumerable:!(s=P(e,p))||s.enumerable});return o},r=(o,e,l)=>(c(o,e,"default"),l&&c(l,e,"default"));var n=o=>c(S({},"__esModule",{value:!0}),o);var t={};module.exports=n(t);r(t,require("./Select"),module.exports);r(t,require("./context"),module.exports);
|
|
20
2
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.tsx"],
|
|
4
4
|
"sourcesContent": ["export * from './Select'\nexport type {\n SelectContentProps,\n SelectProps,\n SelectScrollButtonProps,\n SelectViewportProps,\n} from './types'\nexport * from './context'\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GAAAE,EAAAF,EAAc,oBAAd,gBAOAE,EAAAF,EAAc,qBAPd",
|
|
6
|
+
"names": ["src_exports", "__toCommonJS", "__reExport"]
|
|
7
7
|
}
|
package/dist/cjs/types.js
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var types_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(types_exports);
|
|
1
|
+
"use strict";var l=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var p=(t,e,a,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of i(e))!c.call(t,o)&&o!==a&&l(t,o,{get:()=>e[o],enumerable:!(n=r(e,o))||n.enumerable});return t};var s=t=>p(l({},"__esModule",{value:!0}),t);var d={};module.exports=s(d);
|
|
17
2
|
//# sourceMappingURL=types.js.map
|
package/dist/cjs/types.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/types.tsx"],
|
|
4
4
|
"sourcesContent": ["import type { ContextData, FloatingContext, ReferenceType } from '@floating-ui/react'\nimport type { SizeTokens } from '@tamagui/core'\nimport type { Scope } from '@tamagui/create-context'\nimport type { ThemeableStackProps, YStackProps } from '@tamagui/stacks'\nimport type { DispatchWithoutAction, HTMLProps, MutableRefObject, ReactNode } from 'react'\n\nexport type Direction = 'ltr' | 'rtl'\n\nexport type ScopedProps<P> = P & { __scopeSelect?: Scope }\n\nexport type SelectImplProps = ScopedProps<SelectProps> & {\n activeIndexRef: any\n selectedIndexRef: any\n listContentRef: any\n}\n\nexport interface SelectProps {\n id?: string\n children?: ReactNode\n value?: string\n defaultValue?: string\n onValueChange?(value: string): void\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?(open: boolean): void\n dir?: Direction\n name?: string\n autoComplete?: string\n size?: SizeTokens\n}\n\nexport interface SelectContextValue {\n dir?: Direction\n scopeKey: string\n sheetBreakpoint: string | boolean | null\n size?: SizeTokens\n value: any\n selectedItem: ReactNode\n setSelectedItem: (item: ReactNode) => void\n selectedIndex: number\n setSelectedIndex: (index: number) => void\n activeIndex: number | null\n setActiveIndex: (index: number | null) => void\n setValueAtIndex: (index: number, value: string) => void\n open: boolean\n setOpen: (open: boolean) => void\n onChange: (value: string) => void\n valueNode: Element | null\n onValueNodeChange(node: HTMLElement): void\n valueNodeHasChildren: boolean\n onValueNodeHasChildrenChange(hasChildren: boolean): void\n forceUpdate: DispatchWithoutAction\n\n // SheetImpl only:\n isInSheet?: boolean\n\n // InlineImpl only:\n fallback: boolean\n blockSelection: boolean\n allowSelectRef?: MutableRefObject<boolean>\n allowMouseUpRef?: MutableRefObject<boolean>\n upArrowRef?: MutableRefObject<HTMLDivElement | null>\n downArrowRef?: MutableRefObject<HTMLDivElement | null>\n selectTimeoutRef?: MutableRefObject<any>\n setScrollTop?: Function\n setInnerOffset?: Function\n dataRef?: MutableRefObject<ContextData>\n controlledScrolling?: boolean\n listRef?: MutableRefObject<Array<HTMLElement | null>>\n floatingRef?: MutableRefObject<HTMLElement | null>\n canScrollUp?: boolean\n canScrollDown?: boolean\n floatingContext?: FloatingContext<ReferenceType>\n interactions?: {\n getReferenceProps: (userProps?: HTMLProps<Element> | undefined) => any\n getFloatingProps: (userProps?: HTMLProps<HTMLElement> | undefined) => any\n getItemProps: (userProps?: HTMLProps<HTMLElement> | undefined) => any\n }\n}\n\nexport type SelectViewportProps = ThemeableStackProps & {\n size?: SizeTokens\n disableScroll?: boolean\n}\n\nexport type SelectContentProps = ScopedProps<{\n children?: React.ReactNode\n zIndex?: number\n}>\n\nexport interface SelectScrollButtonImplProps extends YStackProps {\n dir: 'up' | 'down'\n componentName: string\n}\n\nexport interface SelectScrollButtonProps\n extends Omit<SelectScrollButtonImplProps, 'dir' | 'componentName'> {}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["types_exports", "__toCommonJS"]
|
|
7
7
|
}
|
|
@@ -1,43 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var useSelectBreakpointActive_exports = {};
|
|
20
|
-
__export(useSelectBreakpointActive_exports, {
|
|
21
|
-
useSelectBreakpointActive: () => useSelectBreakpointActive,
|
|
22
|
-
useShowSelectSheet: () => useShowSelectSheet
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(useSelectBreakpointActive_exports);
|
|
25
|
-
var import_core = require("@tamagui/core");
|
|
26
|
-
const useSelectBreakpointActive = (sheetBreakpoint) => {
|
|
27
|
-
const media = (0, import_core.useMedia)();
|
|
28
|
-
if (!sheetBreakpoint)
|
|
29
|
-
return false;
|
|
30
|
-
if (sheetBreakpoint === true)
|
|
31
|
-
return true;
|
|
32
|
-
return sheetBreakpoint ? media[sheetBreakpoint] : false;
|
|
33
|
-
};
|
|
34
|
-
const useShowSelectSheet = (context) => {
|
|
35
|
-
const breakpointActive = useSelectBreakpointActive(context.sheetBreakpoint);
|
|
36
|
-
return context.open === false ? false : breakpointActive;
|
|
37
|
-
};
|
|
38
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
-
0 && (module.exports = {
|
|
40
|
-
useSelectBreakpointActive,
|
|
41
|
-
useShowSelectSheet
|
|
42
|
-
});
|
|
1
|
+
"use strict";var l=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var f=(e,t)=>{for(var o in t)l(e,o,{get:t[o],enumerable:!0})},S=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of s(t))!i.call(e,r)&&r!==o&&l(e,r,{get:()=>t[r],enumerable:!(n=c(t,r))||n.enumerable});return e};var p=e=>S(l({},"__esModule",{value:!0}),e);var x={};f(x,{useSelectBreakpointActive:()=>a,useShowSelectSheet:()=>m});module.exports=p(x);var u=require("@tamagui/core");const a=e=>{const t=(0,u.useMedia)();return e?e===!0?!0:e?t[e]:!1:!1},m=e=>{const t=a(e.sheetBreakpoint);return e.open===!1?!1:t};0&&(module.exports={useSelectBreakpointActive,useShowSelectSheet});
|
|
43
2
|
//# sourceMappingURL=useSelectBreakpointActive.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useSelectBreakpointActive.tsx"],
|
|
4
4
|
"sourcesContent": ["import { useMedia } from '@tamagui/core'\n\nimport { SelectContextValue } from './types'\n\nexport const useSelectBreakpointActive = (\n sheetBreakpoint: SelectContextValue['sheetBreakpoint']\n) => {\n const media = useMedia()\n if (!sheetBreakpoint) return false\n if (sheetBreakpoint === true) return true\n return sheetBreakpoint ? media[sheetBreakpoint] : false\n}\n\nexport const useShowSelectSheet = (context: SelectContextValue) => {\n const breakpointActive = useSelectBreakpointActive(context.sheetBreakpoint)\n return context.open === false ? false : breakpointActive\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,EAAA,uBAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAyB,yBAIlB,MAAMH,EACXI,GACG,CACH,MAAMC,KAAQ,YAAS,EACvB,OAAKD,EACDA,IAAoB,GAAa,GAC9BA,EAAkBC,EAAMD,CAAe,EAAI,GAFrB,EAG/B,EAEaH,EAAsBK,GAAgC,CACjE,MAAMC,EAAmBP,EAA0BM,EAAQ,eAAe,EAC1E,OAAOA,EAAQ,OAAS,GAAQ,GAAQC,CAC1C",
|
|
6
|
+
"names": ["useSelectBreakpointActive_exports", "__export", "useSelectBreakpointActive", "useShowSelectSheet", "__toCommonJS", "import_core", "sheetBreakpoint", "media", "context", "breakpointActive"]
|
|
7
7
|
}
|
package/dist/esm/BubbleSelect.js
CHANGED
|
@@ -1,25 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
const BubbleSelect = React.forwardRef((props, forwardedRef) => {
|
|
5
|
-
const { value, ...selectProps } = props;
|
|
6
|
-
const ref = React.useRef(null);
|
|
7
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
8
|
-
const prevValue = usePrevious(value);
|
|
9
|
-
React.useEffect(() => {
|
|
10
|
-
const select = ref.current;
|
|
11
|
-
const selectProto = window.HTMLSelectElement.prototype;
|
|
12
|
-
const descriptor = Object.getOwnPropertyDescriptor(
|
|
13
|
-
selectProto,
|
|
14
|
-
"value"
|
|
15
|
-
);
|
|
16
|
-
const setValue = descriptor.set;
|
|
17
|
-
if (prevValue !== value && setValue) {
|
|
18
|
-
const event = new Event("change", { bubbles: true });
|
|
19
|
-
setValue.call(select, value);
|
|
20
|
-
select.dispatchEvent(event);
|
|
21
|
-
}
|
|
22
|
-
}, [prevValue, value]);
|
|
23
|
-
return null;
|
|
24
|
-
});
|
|
1
|
+
import{usePrevious as f}from"@radix-ui/react-use-previous";import{useComposedRefs as a}from"@tamagui/compose-refs";import*as t from"react";const b=t.forwardRef((n,l)=>{const{value:e,...i}=n,o=t.useRef(null),m=a(l,o),s=f(e);return t.useEffect(()=>{const r=o.current,p=window.HTMLSelectElement.prototype,c=Object.getOwnPropertyDescriptor(p,"value").set;if(s!==e&&c){const u=new Event("change",{bubbles:!0});c.call(r,e),r.dispatchEvent(u)}},[s,e]),null});
|
|
25
2
|
//# sourceMappingURL=BubbleSelect.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/BubbleSelect.tsx"],
|
|
4
4
|
"sourcesContent": ["import { usePrevious } from '@radix-ui/react-use-previous'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport * as React from 'react'\n\n/* -----------------------------------------------------------------------------------------------*/\nconst BubbleSelect = React.forwardRef<\n HTMLSelectElement,\n React.ComponentPropsWithoutRef<'select'>\n>((props, forwardedRef) => {\n const { value, ...selectProps } = props\n const ref = React.useRef<HTMLSelectElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, ref)\n const prevValue = usePrevious(value)\n\n // Bubble value change to parents (e.g form change event)\n React.useEffect(() => {\n const select = ref.current!\n const selectProto = window.HTMLSelectElement.prototype\n const descriptor = Object.getOwnPropertyDescriptor(\n selectProto,\n 'value',\n ) as PropertyDescriptor\n const setValue = descriptor.set\n if (prevValue !== value && setValue) {\n const event = new Event('change', { bubbles: true })\n setValue.call(select, value)\n select.dispatchEvent(event)\n }\n }, [prevValue, value])\n\n /**\n * We purposefully use a `select` here to support form autofill as much\n * as possible.\n *\n * We purposefully do not add the `value` attribute here to allow the value\n * to be set programatically and bubble to any parent form `onChange` event.\n * Adding the `value` will cause React to consider the programatic\n * dispatch a duplicate and it will get swallowed.\n *\n * We use `VisuallyHidden` rather than `display: \"none\"` because Safari autofill\n * won't work otherwise.\n */\n // TODO\n return null\n // return (\n // <VisuallyHidden asChild>\n // <select {...selectProps} ref={composedRefs} defaultValue={value} />\n // </VisuallyHidden>\n // )\n})\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "AAAA,OAAS,eAAAA,MAAmB,+BAC5B,OAAS,mBAAAC,MAAuB,wBAChC,UAAYC,MAAW,QAGvB,MAAMC,EAAeD,EAAM,WAGzB,CAACE,EAAOC,IAAiB,CACzB,KAAM,CAAE,MAAAC,EAAO,GAAGC,CAAY,EAAIH,EAC5BI,EAAMN,EAAM,OAA0B,IAAI,EAC1CO,EAAeR,EAAgBI,EAAcG,CAAG,EAChDE,EAAYV,EAAYM,CAAK,EAGnC,OAAAJ,EAAM,UAAU,IAAM,CACpB,MAAMS,EAASH,EAAI,QACbI,EAAc,OAAO,kBAAkB,UAKvCC,EAJa,OAAO,yBACxBD,EACA,OACF,EAC4B,IAC5B,GAAIF,IAAcJ,GAASO,EAAU,CACnC,MAAMC,EAAQ,IAAI,MAAM,SAAU,CAAE,QAAS,EAAK,CAAC,EACnDD,EAAS,KAAKF,EAAQL,CAAK,EAC3BK,EAAO,cAAcG,CAAK,CAC5B,CACF,EAAG,CAACJ,EAAWJ,CAAK,CAAC,EAed,IAMT,CAAC",
|
|
6
|
+
"names": ["usePrevious", "useComposedRefs", "React", "BubbleSelect", "props", "forwardedRef", "value", "selectProps", "ref", "composedRefs", "prevValue", "select", "selectProto", "setValue", "event"]
|
|
7
7
|
}
|
|
@@ -1,25 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
const BubbleSelect = React.forwardRef((props, forwardedRef) => {
|
|
5
|
-
const { value, ...selectProps } = props;
|
|
6
|
-
const ref = React.useRef(null);
|
|
7
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
8
|
-
const prevValue = usePrevious(value);
|
|
9
|
-
React.useEffect(() => {
|
|
10
|
-
const select = ref.current;
|
|
11
|
-
const selectProto = window.HTMLSelectElement.prototype;
|
|
12
|
-
const descriptor = Object.getOwnPropertyDescriptor(
|
|
13
|
-
selectProto,
|
|
14
|
-
"value"
|
|
15
|
-
);
|
|
16
|
-
const setValue = descriptor.set;
|
|
17
|
-
if (prevValue !== value && setValue) {
|
|
18
|
-
const event = new Event("change", { bubbles: true });
|
|
19
|
-
setValue.call(select, value);
|
|
20
|
-
select.dispatchEvent(event);
|
|
21
|
-
}
|
|
22
|
-
}, [prevValue, value]);
|
|
23
|
-
return null;
|
|
24
|
-
});
|
|
1
|
+
import{usePrevious as f}from"@radix-ui/react-use-previous";import{useComposedRefs as a}from"@tamagui/compose-refs";import*as t from"react";const b=t.forwardRef((n,l)=>{const{value:e,...i}=n,o=t.useRef(null),m=a(l,o),s=f(e);return t.useEffect(()=>{const r=o.current,p=window.HTMLSelectElement.prototype,c=Object.getOwnPropertyDescriptor(p,"value").set;if(s!==e&&c){const u=new Event("change",{bubbles:!0});c.call(r,e),r.dispatchEvent(u)}},[s,e]),null});
|
|
25
2
|
//# sourceMappingURL=BubbleSelect.mjs.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/BubbleSelect.tsx"],
|
|
4
4
|
"sourcesContent": ["import { usePrevious } from '@radix-ui/react-use-previous'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport * as React from 'react'\n\n/* -----------------------------------------------------------------------------------------------*/\nconst BubbleSelect = React.forwardRef<\n HTMLSelectElement,\n React.ComponentPropsWithoutRef<'select'>\n>((props, forwardedRef) => {\n const { value, ...selectProps } = props\n const ref = React.useRef<HTMLSelectElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, ref)\n const prevValue = usePrevious(value)\n\n // Bubble value change to parents (e.g form change event)\n React.useEffect(() => {\n const select = ref.current!\n const selectProto = window.HTMLSelectElement.prototype\n const descriptor = Object.getOwnPropertyDescriptor(\n selectProto,\n 'value',\n ) as PropertyDescriptor\n const setValue = descriptor.set\n if (prevValue !== value && setValue) {\n const event = new Event('change', { bubbles: true })\n setValue.call(select, value)\n select.dispatchEvent(event)\n }\n }, [prevValue, value])\n\n /**\n * We purposefully use a `select` here to support form autofill as much\n * as possible.\n *\n * We purposefully do not add the `value` attribute here to allow the value\n * to be set programatically and bubble to any parent form `onChange` event.\n * Adding the `value` will cause React to consider the programatic\n * dispatch a duplicate and it will get swallowed.\n *\n * We use `VisuallyHidden` rather than `display: \"none\"` because Safari autofill\n * won't work otherwise.\n */\n // TODO\n return null\n // return (\n // <VisuallyHidden asChild>\n // <select {...selectProps} ref={composedRefs} defaultValue={value} />\n // </VisuallyHidden>\n // )\n})\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "AAAA,OAAS,eAAAA,MAAmB,+BAC5B,OAAS,mBAAAC,MAAuB,wBAChC,UAAYC,MAAW,QAGvB,MAAMC,EAAeD,EAAM,WAGzB,CAACE,EAAOC,IAAiB,CACzB,KAAM,CAAE,MAAAC,EAAO,GAAGC,CAAY,EAAIH,EAC5BI,EAAMN,EAAM,OAA0B,IAAI,EAC1CO,EAAeR,EAAgBI,EAAcG,CAAG,EAChDE,EAAYV,EAAYM,CAAK,EAGnC,OAAAJ,EAAM,UAAU,IAAM,CACpB,MAAMS,EAASH,EAAI,QACbI,EAAc,OAAO,kBAAkB,UAKvCC,EAJa,OAAO,yBACxBD,EACA,OACF,EAC4B,IAC5B,GAAIF,IAAcJ,GAASO,EAAU,CACnC,MAAMC,EAAQ,IAAI,MAAM,SAAU,CAAE,QAAS,EAAK,CAAC,EACnDD,EAAS,KAAKF,EAAQL,CAAK,EAC3BK,EAAO,cAAcG,CAAK,CAC5B,CACF,EAAG,CAACJ,EAAWJ,CAAK,CAAC,EAed,IAMT,CAAC",
|
|
6
|
+
"names": ["usePrevious", "useComposedRefs", "React", "BubbleSelect", "props", "forwardedRef", "value", "selectProps", "ref", "composedRefs", "prevValue", "select", "selectProto", "setValue", "event"]
|
|
7
7
|
}
|