@tamagui/select 1.114.3 → 1.115.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.
Files changed (51) hide show
  1. package/dist/cjs/BubbleSelect.cjs +45 -0
  2. package/dist/cjs/Select.cjs +398 -0
  3. package/dist/cjs/SelectContent.cjs +82 -0
  4. package/dist/cjs/SelectContent.native.cjs +28 -0
  5. package/dist/cjs/SelectContent.native.cjs.map +6 -0
  6. package/dist/cjs/SelectImpl.cjs +272 -0
  7. package/dist/cjs/SelectImpl.native.cjs +29 -0
  8. package/dist/cjs/SelectImpl.native.cjs.map +6 -0
  9. package/dist/cjs/SelectItem.cjs +158 -0
  10. package/dist/cjs/SelectItemText.cjs +89 -0
  11. package/dist/cjs/SelectScrollButton.cjs +136 -0
  12. package/dist/cjs/SelectScrollButton.native.cjs +28 -0
  13. package/dist/cjs/SelectScrollButton.native.cjs.map +6 -0
  14. package/dist/cjs/SelectTrigger.cjs +99 -0
  15. package/dist/cjs/SelectViewport.cjs +135 -0
  16. package/dist/cjs/SelectViewport.native.cjs +69 -0
  17. package/dist/cjs/SelectViewport.native.cjs.map +6 -0
  18. package/dist/cjs/constants.cjs +38 -0
  19. package/dist/cjs/context.cjs +55 -0
  20. package/dist/cjs/index.cjs +19 -0
  21. package/dist/cjs/types.cjs +16 -0
  22. package/dist/cjs/useSelectBreakpointActive.cjs +35 -0
  23. package/package.json +25 -24
  24. package/dist/cjs/BubbleSelect.js +0 -34
  25. package/dist/cjs/Select.js +0 -328
  26. package/dist/cjs/SelectContent.js +0 -45
  27. package/dist/cjs/SelectImpl.js +0 -224
  28. package/dist/cjs/SelectItem.js +0 -142
  29. package/dist/cjs/SelectItemText.js +0 -62
  30. package/dist/cjs/SelectScrollButton.js +0 -105
  31. package/dist/cjs/SelectTrigger.js +0 -84
  32. package/dist/cjs/SelectViewport.js +0 -111
  33. package/dist/cjs/constants.js +0 -27
  34. package/dist/cjs/context.js +0 -35
  35. package/dist/cjs/index.js +0 -16
  36. package/dist/cjs/types.js +0 -14
  37. package/dist/cjs/useSelectBreakpointActive.js +0 -29
  38. /package/dist/cjs/{BubbleSelect.js.map → BubbleSelect.cjs.map} +0 -0
  39. /package/dist/cjs/{Select.js.map → Select.cjs.map} +0 -0
  40. /package/dist/cjs/{SelectContent.js.map → SelectContent.cjs.map} +0 -0
  41. /package/dist/cjs/{SelectImpl.js.map → SelectImpl.cjs.map} +0 -0
  42. /package/dist/cjs/{SelectItem.js.map → SelectItem.cjs.map} +0 -0
  43. /package/dist/cjs/{SelectItemText.js.map → SelectItemText.cjs.map} +0 -0
  44. /package/dist/cjs/{SelectScrollButton.js.map → SelectScrollButton.cjs.map} +0 -0
  45. /package/dist/cjs/{SelectTrigger.js.map → SelectTrigger.cjs.map} +0 -0
  46. /package/dist/cjs/{SelectViewport.js.map → SelectViewport.cjs.map} +0 -0
  47. /package/dist/cjs/{constants.js.map → constants.cjs.map} +0 -0
  48. /package/dist/cjs/{context.js.map → context.cjs.map} +0 -0
  49. /package/dist/cjs/{index.js.map → index.cjs.map} +0 -0
  50. /package/dist/cjs/{types.js.map → types.cjs.map} +0 -0
  51. /package/dist/cjs/{useSelectBreakpointActive.js.map → useSelectBreakpointActive.cjs.map} +0 -0
@@ -0,0 +1,28 @@
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: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var SelectScrollButton_native_exports = {};
22
+ __export(SelectScrollButton_native_exports, {
23
+ SelectScrollDownButton: () => SelectScrollDownButton,
24
+ SelectScrollUpButton: () => SelectScrollUpButton
25
+ });
26
+ module.exports = __toCommonJS(SelectScrollButton_native_exports);
27
+ const SelectScrollUpButton = _ => null,
28
+ SelectScrollDownButton = _ => null;
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/SelectScrollButton.native.tsx"],
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,uBAAuB,CAAC,MACnC,MAEW,yBAAyB,CAAC,MACrC;",
5
+ "names": []
6
+ }
@@ -0,0 +1,99 @@
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
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ 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", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
32
+ var SelectTrigger_exports = {};
33
+ __export(SelectTrigger_exports, {
34
+ SelectTrigger: () => SelectTrigger
35
+ });
36
+ module.exports = __toCommonJS(SelectTrigger_exports);
37
+ var import_compose_refs = require("@tamagui/compose-refs"),
38
+ import_core = require("@tamagui/core"),
39
+ import_list_item = require("@tamagui/list-item"),
40
+ React = __toESM(require("react")),
41
+ import_context = require("./context.cjs"),
42
+ import_jsx_runtime = require("react/jsx-runtime");
43
+ const TRIGGER_NAME = "SelectTrigger",
44
+ isPointerCoarse = import_core.isWeb && import_core.isClient ? window.matchMedia("(pointer:coarse)").matches : !0,
45
+ SelectTrigger = React.forwardRef(function (props, forwardedRef) {
46
+ const {
47
+ __scopeSelect,
48
+ disabled = !1,
49
+ unstyled = !1,
50
+ ...triggerProps
51
+ } = props,
52
+ context = (0, import_context.useSelectContext)(TRIGGER_NAME, __scopeSelect),
53
+ itemParentContext = (0, import_context.useSelectItemParentContext)(TRIGGER_NAME, __scopeSelect),
54
+ composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.floatingContext?.refs.setReference);
55
+ return itemParentContext.shouldRenderWebNative ? null : /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_list_item.ListItem, {
56
+ componentName: TRIGGER_NAME,
57
+ unstyled,
58
+ tag: "button",
59
+ type: "button",
60
+ id: itemParentContext.id,
61
+ ...(!unstyled && {
62
+ backgrounded: !0,
63
+ radiused: !0,
64
+ hoverTheme: !0,
65
+ pressTheme: !0,
66
+ focusable: !0,
67
+ focusVisibleStyle: {
68
+ outlineStyle: "solid",
69
+ outlineWidth: 2,
70
+ outlineColor: "$outlineColor"
71
+ },
72
+ borderWidth: 1,
73
+ size: itemParentContext.size
74
+ }),
75
+ "aria-expanded": context.open,
76
+ "aria-autocomplete": "none",
77
+ dir: context.dir,
78
+ disabled,
79
+ "data-disabled": disabled ? "" : void 0,
80
+ ...triggerProps,
81
+ ref: composedRefs,
82
+ ...(itemParentContext.interactions ? {
83
+ ...itemParentContext.interactions.getReferenceProps(),
84
+ ...(isPointerCoarse ? {
85
+ onPress() {
86
+ itemParentContext.setOpen(!context.open);
87
+ }
88
+ } : {
89
+ onMouseDown() {
90
+ context.floatingContext?.update(), itemParentContext.setOpen(!context.open);
91
+ }
92
+ })
93
+ } : {
94
+ onPress() {
95
+ itemParentContext.setOpen(!context.open);
96
+ }
97
+ })
98
+ });
99
+ });
@@ -0,0 +1,135 @@
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: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var SelectViewport_exports = {};
22
+ __export(SelectViewport_exports, {
23
+ SelectViewport: () => SelectViewport,
24
+ SelectViewportFrame: () => SelectViewportFrame
25
+ });
26
+ module.exports = __toCommonJS(SelectViewport_exports);
27
+ var import_react = require("@floating-ui/react"),
28
+ import_animate_presence = require("@tamagui/animate-presence"),
29
+ import_compose_refs = require("@tamagui/compose-refs"),
30
+ import_constants = require("@tamagui/constants"),
31
+ import_core = require("@tamagui/core"),
32
+ import_portal = require("@tamagui/portal"),
33
+ import_stacks = require("@tamagui/stacks"),
34
+ import_constants2 = require("./constants.cjs"),
35
+ import_context = require("./context.cjs"),
36
+ import_useSelectBreakpointActive = require("./useSelectBreakpointActive.cjs"),
37
+ import_jsx_runtime = require("react/jsx-runtime");
38
+ const SelectViewportFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
39
+ name: import_constants2.VIEWPORT_NAME,
40
+ variants: {
41
+ unstyled: {
42
+ false: {
43
+ size: "$2",
44
+ backgroundColor: "$background",
45
+ elevate: !0,
46
+ bordered: !0,
47
+ userSelect: "none",
48
+ outlineWidth: 0
49
+ }
50
+ },
51
+ size: {
52
+ "...size": (val, {
53
+ tokens
54
+ }) => ({
55
+ borderRadius: tokens.radius[val] ?? val
56
+ })
57
+ }
58
+ },
59
+ defaultVariants: {
60
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
61
+ }
62
+ }),
63
+ SelectViewport = SelectViewportFrame.styleable(function (props, forwardedRef) {
64
+ const {
65
+ __scopeSelect,
66
+ children,
67
+ disableScroll,
68
+ ...viewportProps
69
+ } = props,
70
+ context = (0, import_context.useSelectContext)(import_constants2.VIEWPORT_NAME, __scopeSelect),
71
+ itemContext = (0, import_context.useSelectItemParentContext)(import_constants2.VIEWPORT_NAME, __scopeSelect),
72
+ breakpointActive = (0, import_useSelectBreakpointActive.useSelectBreakpointActive)(context.sheetBreakpoint);
73
+ if ((0, import_constants.useIsomorphicLayoutEffect)(() => {
74
+ context.update && context.update();
75
+ }, [breakpointActive]), itemContext.shouldRenderWebNative) return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
76
+ children
77
+ });
78
+ if (breakpointActive || !import_constants.isWeb) return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_portal.PortalItem, {
79
+ hostName: `${context.scopeKey}SheetContents`,
80
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_context.ForwardSelectContext, {
81
+ __scopeSelect,
82
+ itemContext,
83
+ context,
84
+ children
85
+ })
86
+ });
87
+ if (!itemContext.interactions) return process.env.NODE_ENV === "development" && console.warn("No interactions provided to Select, potentially missing Adapt"), null;
88
+ const {
89
+ style,
90
+ // remove this, it was set to "Select" always
91
+ className,
92
+ ...floatingProps
93
+ } = itemContext.interactions.getFloatingProps(),
94
+ composedRefs = (0, import_compose_refs.composeRefs)(forwardedRef, context.floatingContext?.refs.setFloating);
95
+ return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
96
+ children: [!disableScroll && !props.unstyled && /* @__PURE__ */(0, import_jsx_runtime.jsx)("style", {
97
+ dangerouslySetInnerHTML: {
98
+ __html: selectViewportCSS
99
+ }
100
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, {
101
+ children: context.open ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react.FloatingFocusManager, {
102
+ context: context.floatingContext,
103
+ modal: !1,
104
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(SelectViewportFrame, {
105
+ size: itemContext.size,
106
+ role: "presentation",
107
+ ...viewportProps,
108
+ ...style,
109
+ ...floatingProps,
110
+ ...(!props.unstyled && {
111
+ overflowY: disableScroll ? void 0 : style.overflow ?? "auto"
112
+ }),
113
+ ref: composedRefs,
114
+ children
115
+ }, "select-viewport")
116
+ }) : null
117
+ }), !context.open && /* @__PURE__ */(0, import_jsx_runtime.jsx)("div", {
118
+ style: {
119
+ display: "none"
120
+ },
121
+ children: props.children
122
+ })]
123
+ });
124
+ }),
125
+ selectViewportCSS = `
126
+ .is_SelectViewport {
127
+ scrollbar-width: none;
128
+ -webkit-overflow-scrolling: touch;
129
+ overscroll-behavior: contain;
130
+ }
131
+
132
+ .is_SelectViewport::-webkit-scrollbar{
133
+ display:none
134
+ }
135
+ `;
@@ -0,0 +1,69 @@
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
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ 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", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
32
+ var SelectViewport_native_exports = {};
33
+ __export(SelectViewport_native_exports, {
34
+ SelectViewport: () => SelectViewport
35
+ });
36
+ module.exports = __toCommonJS(SelectViewport_native_exports);
37
+ var import_adapt = require("@tamagui/adapt"),
38
+ import_core = require("@tamagui/core"),
39
+ import_portal = require("@tamagui/portal"),
40
+ React = __toESM(require("react")),
41
+ import_constants = require("./constants.cjs"),
42
+ import_context = require("./context.cjs"),
43
+ import_jsx_runtime = require("react/jsx-runtime");
44
+ const SelectViewport = props => {
45
+ const {
46
+ __scopeSelect,
47
+ children
48
+ } = props,
49
+ context = (0, import_context.useSelectContext)(import_constants.VIEWPORT_NAME, __scopeSelect),
50
+ itemParentContext = (0, import_context.useSelectItemParentContext)(import_constants.VIEWPORT_NAME, __scopeSelect),
51
+ themeName = (0, import_core.useThemeName)(),
52
+ adaptContext = React.useContext(import_adapt.AdaptParentContext);
53
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_portal.PortalItem, {
54
+ hostName: `${context.scopeKey}SheetContents`,
55
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_core.Theme, {
56
+ name: themeName,
57
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_context.ForwardSelectContext, {
58
+ __scopeSelect,
59
+ itemContext: itemParentContext,
60
+ context,
61
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_adapt.AdaptParentContext.Provider, {
62
+ value: adaptContext,
63
+ children
64
+ })
65
+ })
66
+ })
67
+ });
68
+ };
69
+ SelectViewport.displayName = import_constants.VIEWPORT_NAME;
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/SelectViewport.native.tsx"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAmC,2BACnC,cAAoC,0BACpC,gBAA2B,4BAC3B,QAAuB,2BAEvB,mBAA8B,wBAC9B,iBAIO,sBAmBG;AAhBH,MAAM,iBAAiB,CAAC,UAAkD;AAC/E,QAAM,EAAE,eAAe,SAAS,IAAI,OAC9B,cAAU,iCAAiB,gCAAe,aAAa,GACvD,wBAAoB,2CAA2B,gCAAe,aAAa,GAC3E,gBAAY,0BAAa,GACzB,eAAe,MAAM,WAAW,+BAAkB;AAGxD,SACE,4CAAC,4BAAW,UAAU,GAAG,QAAQ,QAAQ,iBACvC,sDAAC,qBAAM,MAAM,WACX;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,aAAa;AAAA,MACb;AAAA,MAEA,sDAAC,gCAAmB,UAAnB,EAA4B,OAAO,cACjC,UACH;AAAA;AAAA,EACF,GACF,GACF;AAEJ;AAEA,eAAe,cAAc;",
5
+ "names": []
6
+ }
@@ -0,0 +1,38 @@
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: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var constants_exports = {};
22
+ __export(constants_exports, {
23
+ FALLBACK_THRESHOLD: () => FALLBACK_THRESHOLD,
24
+ MIN_HEIGHT: () => MIN_HEIGHT,
25
+ SCROLL_ARROW_THRESHOLD: () => SCROLL_ARROW_THRESHOLD,
26
+ SCROLL_ARROW_VELOCITY: () => SCROLL_ARROW_VELOCITY,
27
+ SELECT_NAME: () => SELECT_NAME,
28
+ VIEWPORT_NAME: () => VIEWPORT_NAME,
29
+ WINDOW_PADDING: () => WINDOW_PADDING
30
+ });
31
+ module.exports = __toCommonJS(constants_exports);
32
+ const SELECT_NAME = "Select",
33
+ WINDOW_PADDING = 8,
34
+ SCROLL_ARROW_VELOCITY = 8,
35
+ SCROLL_ARROW_THRESHOLD = 8,
36
+ MIN_HEIGHT = 80,
37
+ FALLBACK_THRESHOLD = 16,
38
+ VIEWPORT_NAME = "SelectViewport";
@@ -0,0 +1,55 @@
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: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var context_exports = {};
22
+ __export(context_exports, {
23
+ ForwardSelectContext: () => ForwardSelectContext,
24
+ SelectItemParentProvider: () => SelectItemParentProvider,
25
+ SelectProvider: () => SelectProvider,
26
+ createSelectContext: () => createSelectContext,
27
+ createSelectItemParentContext: () => createSelectItemParentContext,
28
+ createSelectItemParentScope: () => createSelectItemParentScope,
29
+ createSelectScope: () => createSelectScope,
30
+ useSelectContext: () => useSelectContext,
31
+ useSelectItemParentContext: () => useSelectItemParentContext
32
+ });
33
+ module.exports = __toCommonJS(context_exports);
34
+ var import_create_context = require("@tamagui/create-context"),
35
+ import_constants = require("./constants.cjs"),
36
+ import_jsx_runtime = require("react/jsx-runtime");
37
+ const [createSelectContext, createSelectScope] = (0, import_create_context.createContextScope)(import_constants.SELECT_NAME),
38
+ [SelectProvider, useSelectContext] = createSelectContext(import_constants.SELECT_NAME),
39
+ [createSelectItemParentContext, createSelectItemParentScope] = (0, import_create_context.createContextScope)(import_constants.SELECT_NAME),
40
+ [SelectItemParentProvider, useSelectItemParentContext] = createSelectContext(import_constants.SELECT_NAME),
41
+ ForwardSelectContext = ({
42
+ __scopeSelect,
43
+ context,
44
+ itemContext,
45
+ children
46
+ }) => /* @__PURE__ */(0, import_jsx_runtime.jsx)(SelectProvider, {
47
+ isInSheet: !0,
48
+ scope: __scopeSelect,
49
+ ...context,
50
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(SelectItemParentProvider, {
51
+ scope: __scopeSelect,
52
+ ...itemContext,
53
+ children
54
+ })
55
+ });
@@ -0,0 +1,19 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
+ get: () => from[key],
8
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
+ });
10
+ return to;
11
+ },
12
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
14
+ value: !0
15
+ }), mod);
16
+ var src_exports = {};
17
+ module.exports = __toCommonJS(src_exports);
18
+ __reExport(src_exports, require("./Select.cjs"), module.exports);
19
+ __reExport(src_exports, require("./context.cjs"), module.exports);
@@ -0,0 +1,16 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
+ get: () => from[key],
8
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
+ });
10
+ return to;
11
+ };
12
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
13
+ value: !0
14
+ }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
@@ -0,0 +1,35 @@
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: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var useSelectBreakpointActive_exports = {};
22
+ __export(useSelectBreakpointActive_exports, {
23
+ useSelectBreakpointActive: () => useSelectBreakpointActive,
24
+ useShowSelectSheet: () => useShowSelectSheet
25
+ });
26
+ module.exports = __toCommonJS(useSelectBreakpointActive_exports);
27
+ var import_core = require("@tamagui/core");
28
+ const useSelectBreakpointActive = sheetBreakpoint => {
29
+ const media = (0, import_core.useMedia)();
30
+ return sheetBreakpoint ? sheetBreakpoint === !0 ? !0 : sheetBreakpoint ? media[sheetBreakpoint] : !1 : !1;
31
+ },
32
+ useShowSelectSheet = context => {
33
+ const breakpointActive = useSelectBreakpointActive(context.sheetBreakpoint);
34
+ return context.open === !1 ? !1 : breakpointActive;
35
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/select",
3
- "version": "1.114.3",
3
+ "version": "1.115.0",
4
4
  "removeSideEffects": "true",
5
5
  "source": "src/index.tsx",
6
6
  "types": "./types/index.d.ts",
@@ -27,40 +27,41 @@
27
27
  "react-native": "./dist/cjs/index.native.js",
28
28
  "types": "./types/index.d.ts",
29
29
  "import": "./dist/esm/index.mjs",
30
- "require": "./dist/cjs/index.js"
30
+ "require": "./dist/cjs/index.cjs",
31
+ "default": "./dist/cjs/index.native.js"
31
32
  }
32
33
  },
33
34
  "dependencies": {
34
35
  "@floating-ui/react": "^0.26.24",
35
36
  "@floating-ui/react-dom": "^2.1.2",
36
37
  "@floating-ui/react-native": "^0.10.6",
37
- "@tamagui/adapt": "1.114.3",
38
- "@tamagui/animate-presence": "1.114.3",
39
- "@tamagui/compose-refs": "1.114.3",
40
- "@tamagui/constants": "1.114.3",
41
- "@tamagui/core": "1.114.3",
42
- "@tamagui/create-context": "1.114.3",
43
- "@tamagui/dismissable": "1.114.3",
44
- "@tamagui/focus-scope": "1.114.3",
45
- "@tamagui/get-token": "1.114.3",
46
- "@tamagui/helpers": "1.114.3",
47
- "@tamagui/list-item": "1.114.3",
48
- "@tamagui/portal": "1.114.3",
49
- "@tamagui/remove-scroll": "1.114.3",
50
- "@tamagui/separator": "1.114.3",
51
- "@tamagui/sheet": "1.114.3",
52
- "@tamagui/stacks": "1.114.3",
53
- "@tamagui/text": "1.114.3",
54
- "@tamagui/use-controllable-state": "1.114.3",
55
- "@tamagui/use-debounce": "1.114.3",
56
- "@tamagui/use-event": "1.114.3",
57
- "@tamagui/use-previous": "1.114.3"
38
+ "@tamagui/adapt": "1.115.0",
39
+ "@tamagui/animate-presence": "1.115.0",
40
+ "@tamagui/compose-refs": "1.115.0",
41
+ "@tamagui/constants": "1.115.0",
42
+ "@tamagui/core": "1.115.0",
43
+ "@tamagui/create-context": "1.115.0",
44
+ "@tamagui/dismissable": "1.115.0",
45
+ "@tamagui/focus-scope": "1.115.0",
46
+ "@tamagui/get-token": "1.115.0",
47
+ "@tamagui/helpers": "1.115.0",
48
+ "@tamagui/list-item": "1.115.0",
49
+ "@tamagui/portal": "1.115.0",
50
+ "@tamagui/remove-scroll": "1.115.0",
51
+ "@tamagui/separator": "1.115.0",
52
+ "@tamagui/sheet": "1.115.0",
53
+ "@tamagui/stacks": "1.115.0",
54
+ "@tamagui/text": "1.115.0",
55
+ "@tamagui/use-controllable-state": "1.115.0",
56
+ "@tamagui/use-debounce": "1.115.0",
57
+ "@tamagui/use-event": "1.115.0",
58
+ "@tamagui/use-previous": "1.115.0"
58
59
  },
59
60
  "peerDependencies": {
60
61
  "react": "*"
61
62
  },
62
63
  "devDependencies": {
63
- "@tamagui/build": "1.114.3",
64
+ "@tamagui/build": "1.115.0",
64
65
  "react": "^18.2.0 || ^19.0.0",
65
66
  "react-dom": "^18.2.0 || ^19.0.0",
66
67
  "react-native": "0.74.1"
@@ -1,34 +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, __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
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- return to;
11
- };
12
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
13
- // If the importer is in node compatibility mode or this is not an ESM
14
- // file that has been converted to a CommonJS file using a Babel-
15
- // compatible transform (i.e. "__esModule" has not been set), then set
16
- // "default" to the CommonJS "module.exports" for node compatibility.
17
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
18
- mod
19
- ));
20
- var import_compose_refs = require("@tamagui/compose-refs"), import_use_previous = require("@tamagui/use-previous"), React = __toESM(require("react"));
21
- const BubbleSelect = React.forwardRef((props, forwardedRef) => {
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(
25
- selectProto,
26
- "value"
27
- ).set;
28
- if (prevValue !== value && setValue) {
29
- const event = new Event("change", { bubbles: !0 });
30
- setValue.call(select, value), select.dispatchEvent(event);
31
- }
32
- }, [prevValue, value]), null;
33
- });
34
- //# sourceMappingURL=BubbleSelect.js.map