@tamagui/select 1.0.1-beta.154 → 1.0.1-beta.157

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.
@@ -24,10 +24,17 @@ module.exports = __toCommonJS(SelectContent_exports);
24
24
  var import_jsx_runtime = require("react/jsx-runtime");
25
25
  var import_react_dom_interactions = require("@floating-ui/react-dom-interactions");
26
26
  var import_core = require("@tamagui/core");
27
+ var import_dismissable = require("@tamagui/dismissable");
28
+ var import_focus_scope = require("@tamagui/focus-scope");
27
29
  var import_context = require("./context");
28
30
  var import_Select = require("./Select");
29
31
  const CONTENT_NAME = "SelectContent";
30
- const SelectContent = ({ children, __scopeSelect }) => {
32
+ const SelectContent = ({
33
+ children,
34
+ __scopeSelect,
35
+ zIndex = 1e3,
36
+ ...focusScopeProps
37
+ }) => {
31
38
  const context = (0, import_context.useSelectContext)(CONTENT_NAME, __scopeSelect);
32
39
  const themeName = (0, import_core.useThemeName)();
33
40
  const showSheet = (0, import_Select.useShowSelectSheet)(context);
@@ -41,11 +48,16 @@ const SelectContent = ({ children, __scopeSelect }) => {
41
48
  }
42
49
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_dom_interactions.FloatingPortal, {
43
50
  children: context.open ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_dom_interactions.FloatingOverlay, {
51
+ style: { zIndex },
44
52
  lockScroll: !touch,
45
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_dom_interactions.FloatingFocusManager, {
46
- context: context.floatingContext,
47
- preventTabbing: true,
48
- children: contents
53
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_focus_scope.FocusScope, {
54
+ loop: true,
55
+ trapped: true,
56
+ ...focusScopeProps,
57
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dismissable.Dismissable, {
58
+ disableOutsidePointerEvents: true,
59
+ children: contents
60
+ })
49
61
  })
50
62
  }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
51
63
  style: { display: "none" },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/SelectContent.tsx"],
4
- "sourcesContent": ["import {\n FloatingFocusManager,\n FloatingOverlay,\n FloatingPortal,\n} from '@floating-ui/react-dom-interactions'\nimport { Theme, useIsTouchDevice, useThemeName } from '@tamagui/core'\nimport * as React from 'react'\n\nimport { useSelectContext } from './context'\nimport { useShowSelectSheet } from './Select'\nimport { SelectContentProps } from './types'\n\n/* -------------------------------------------------------------------------------------------------\n * SelectContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'SelectContent'\n\nexport const SelectContent = ({ children, __scopeSelect }: SelectContentProps) => {\n const context = useSelectContext(CONTENT_NAME, __scopeSelect)\n const themeName = useThemeName()\n const showSheet = useShowSelectSheet(context)\n const contents = <Theme name={themeName}>{children}</Theme>\n const touch = useIsTouchDevice()\n\n if (showSheet && context.open) {\n return contents\n }\n\n return (\n <FloatingPortal>\n {context.open ? (\n <FloatingOverlay lockScroll={!touch}>\n <FloatingFocusManager context={context.floatingContext!} preventTabbing>\n {contents}\n </FloatingFocusManager>\n </FloatingOverlay>\n ) : (\n <div style={{ display: 'none' }}>{contents}</div>\n )}\n </FloatingPortal>\n )\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBmB;AAtBnB,oCAIO;AACP,kBAAsD;AAGtD,qBAAiC;AACjC,oBAAmC;AAOnC,MAAM,eAAe;AAEd,MAAM,gBAAgB,CAAC,EAAE,UAAU,cAAc,MAA0B;AAChF,QAAM,cAAU,iCAAiB,cAAc,aAAa;AAC5D,QAAM,gBAAY,0BAAa;AAC/B,QAAM,gBAAY,kCAAmB,OAAO;AAC5C,QAAM,WAAW,4CAAC;AAAA,IAAM,MAAM;AAAA,IAAY;AAAA,GAAS;AACnD,QAAM,YAAQ,8BAAiB;AAE/B,MAAI,aAAa,QAAQ,MAAM;AAC7B,WAAO;AAAA,EACT;AAEA,SACE,4CAAC;AAAA,IACE,kBAAQ,OACP,4CAAC;AAAA,MAAgB,YAAY,CAAC;AAAA,MAC5B,sDAAC;AAAA,QAAqB,SAAS,QAAQ;AAAA,QAAkB,gBAAc;AAAA,QACpE;AAAA,OACH;AAAA,KACF,IAEA,4CAAC;AAAA,MAAI,OAAO,EAAE,SAAS,OAAO;AAAA,MAAI;AAAA,KAAS;AAAA,GAE/C;AAEJ;",
4
+ "sourcesContent": ["import { FloatingOverlay, FloatingPortal } from '@floating-ui/react-dom-interactions'\nimport { Theme, useIsTouchDevice, useThemeName } from '@tamagui/core'\nimport { Dismissable } from '@tamagui/dismissable'\nimport { FocusScope, FocusScopeProps } from '@tamagui/focus-scope'\n\nimport { useSelectContext } from './context'\nimport { useShowSelectSheet } from './Select'\nimport { SelectContentProps } from './types'\n\n/* -------------------------------------------------------------------------------------------------\n * SelectContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'SelectContent'\n\nexport const SelectContent = ({\n children,\n __scopeSelect,\n zIndex = 1000,\n ...focusScopeProps\n}: SelectContentProps & FocusScopeProps) => {\n const context = useSelectContext(CONTENT_NAME, __scopeSelect)\n const themeName = useThemeName()\n const showSheet = useShowSelectSheet(context)\n const contents = <Theme name={themeName}>{children}</Theme>\n const touch = useIsTouchDevice()\n\n if (showSheet && context.open) {\n return contents\n }\n\n return (\n <FloatingPortal>\n {context.open ? (\n <FloatingOverlay style={{ zIndex }} lockScroll={!touch}>\n <FocusScope loop trapped {...focusScopeProps}>\n <Dismissable disableOutsidePointerEvents>{contents}</Dismissable>\n </FocusScope>\n </FloatingOverlay>\n ) : (\n <div style={{ display: 'none' }}>{contents}</div>\n )}\n </FloatingPortal>\n )\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBmB;AAxBnB,oCAAgD;AAChD,kBAAsD;AACtD,yBAA4B;AAC5B,yBAA4C;AAE5C,qBAAiC;AACjC,oBAAmC;AAOnC,MAAM,eAAe;AAEd,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA,SAAS;AAAA,KACN;AACL,MAA4C;AAC1C,QAAM,cAAU,iCAAiB,cAAc,aAAa;AAC5D,QAAM,gBAAY,0BAAa;AAC/B,QAAM,gBAAY,kCAAmB,OAAO;AAC5C,QAAM,WAAW,4CAAC;AAAA,IAAM,MAAM;AAAA,IAAY;AAAA,GAAS;AACnD,QAAM,YAAQ,8BAAiB;AAE/B,MAAI,aAAa,QAAQ,MAAM;AAC7B,WAAO;AAAA,EACT;AAEA,SACE,4CAAC;AAAA,IACE,kBAAQ,OACP,4CAAC;AAAA,MAAgB,OAAO,EAAE,OAAO;AAAA,MAAG,YAAY,CAAC;AAAA,MAC/C,sDAAC;AAAA,QAAW,MAAI;AAAA,QAAC,SAAO;AAAA,QAAE,GAAG;AAAA,QAC3B,sDAAC;AAAA,UAAY,6BAA2B;AAAA,UAAE;AAAA,SAAS;AAAA,OACrD;AAAA,KACF,IAEA,4CAAC;AAAA,MAAI,OAAO,EAAE,SAAS,OAAO;AAAA,MAAI;AAAA,KAAS;AAAA,GAE/C;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/types.tsx"],
4
- "sourcesContent": ["import type {\n ContextData,\n FloatingContext,\n ReferenceType,\n} from '@floating-ui/react-dom-interactions'\nimport type { MediaQueryKey, 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 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 sheetBreakpoint?: MediaQueryKey | false\n}\n\ntype NonNull<A> = Exclude<A, void | null>\n\nexport interface SelectContextValue {\n dir?: Direction\n scopeKey: string\n sheetBreakpoint: NonNull<SelectProps['sheetBreakpoint']>\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 // 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}\n\nexport type SelectContentProps = ScopedProps<{ children?: React.ReactNode }>\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"],
4
+ "sourcesContent": ["import type {\n ContextData,\n FloatingContext,\n ReferenceType,\n} from '@floating-ui/react-dom-interactions'\nimport type { MediaQueryKey, 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 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 sheetBreakpoint?: MediaQueryKey | false\n}\n\ntype NonNull<A> = Exclude<A, void | null>\n\nexport interface SelectContextValue {\n dir?: Direction\n scopeKey: string\n sheetBreakpoint: NonNull<SelectProps['sheetBreakpoint']>\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 // 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}\n\nexport type SelectContentProps = ScopedProps<{ children?: React.ReactNode; zIndex?: number }>\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
5
  "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -1,14 +1,17 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import {
3
- FloatingFocusManager,
4
- FloatingOverlay,
5
- FloatingPortal
6
- } from "@floating-ui/react-dom-interactions";
2
+ import { FloatingOverlay, FloatingPortal } from "@floating-ui/react-dom-interactions";
7
3
  import { Theme, useIsTouchDevice, useThemeName } from "@tamagui/core";
4
+ import { Dismissable } from "@tamagui/dismissable";
5
+ import { FocusScope } from "@tamagui/focus-scope";
8
6
  import { useSelectContext } from "./context";
9
7
  import { useShowSelectSheet } from "./Select";
10
8
  const CONTENT_NAME = "SelectContent";
11
- const SelectContent = ({ children, __scopeSelect }) => {
9
+ const SelectContent = ({
10
+ children,
11
+ __scopeSelect,
12
+ zIndex = 1e3,
13
+ ...focusScopeProps
14
+ }) => {
12
15
  const context = useSelectContext(CONTENT_NAME, __scopeSelect);
13
16
  const themeName = useThemeName();
14
17
  const showSheet = useShowSelectSheet(context);
@@ -22,11 +25,16 @@ const SelectContent = ({ children, __scopeSelect }) => {
22
25
  }
23
26
  return /* @__PURE__ */ jsx(FloatingPortal, {
24
27
  children: context.open ? /* @__PURE__ */ jsx(FloatingOverlay, {
28
+ style: { zIndex },
25
29
  lockScroll: !touch,
26
- children: /* @__PURE__ */ jsx(FloatingFocusManager, {
27
- context: context.floatingContext,
28
- preventTabbing: true,
29
- children: contents
30
+ children: /* @__PURE__ */ jsx(FocusScope, {
31
+ loop: true,
32
+ trapped: true,
33
+ ...focusScopeProps,
34
+ children: /* @__PURE__ */ jsx(Dismissable, {
35
+ disableOutsidePointerEvents: true,
36
+ children: contents
37
+ })
30
38
  })
31
39
  }) : /* @__PURE__ */ jsx("div", {
32
40
  style: { display: "none" },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/SelectContent.tsx"],
4
- "sourcesContent": ["import {\n FloatingFocusManager,\n FloatingOverlay,\n FloatingPortal,\n} from '@floating-ui/react-dom-interactions'\nimport { Theme, useIsTouchDevice, useThemeName } from '@tamagui/core'\nimport * as React from 'react'\n\nimport { useSelectContext } from './context'\nimport { useShowSelectSheet } from './Select'\nimport { SelectContentProps } from './types'\n\n/* -------------------------------------------------------------------------------------------------\n * SelectContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'SelectContent'\n\nexport const SelectContent = ({ children, __scopeSelect }: SelectContentProps) => {\n const context = useSelectContext(CONTENT_NAME, __scopeSelect)\n const themeName = useThemeName()\n const showSheet = useShowSelectSheet(context)\n const contents = <Theme name={themeName}>{children}</Theme>\n const touch = useIsTouchDevice()\n\n if (showSheet && context.open) {\n return contents\n }\n\n return (\n <FloatingPortal>\n {context.open ? (\n <FloatingOverlay lockScroll={!touch}>\n <FloatingFocusManager context={context.floatingContext!} preventTabbing>\n {contents}\n </FloatingFocusManager>\n </FloatingOverlay>\n ) : (\n <div style={{ display: 'none' }}>{contents}</div>\n )}\n </FloatingPortal>\n )\n}\n"],
5
- "mappings": "AAsBmB;AAtBnB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,OAAO,kBAAkB,oBAAoB;AAGtD,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AAOnC,MAAM,eAAe;AAEd,MAAM,gBAAgB,CAAC,EAAE,UAAU,cAAc,MAA0B;AAChF,QAAM,UAAU,iBAAiB,cAAc,aAAa;AAC5D,QAAM,YAAY,aAAa;AAC/B,QAAM,YAAY,mBAAmB,OAAO;AAC5C,QAAM,WAAW,oBAAC;AAAA,IAAM,MAAM;AAAA,IAAY;AAAA,GAAS;AACnD,QAAM,QAAQ,iBAAiB;AAE/B,MAAI,aAAa,QAAQ,MAAM;AAC7B,WAAO;AAAA,EACT;AAEA,SACE,oBAAC;AAAA,IACE,kBAAQ,OACP,oBAAC;AAAA,MAAgB,YAAY,CAAC;AAAA,MAC5B,8BAAC;AAAA,QAAqB,SAAS,QAAQ;AAAA,QAAkB,gBAAc;AAAA,QACpE;AAAA,OACH;AAAA,KACF,IAEA,oBAAC;AAAA,MAAI,OAAO,EAAE,SAAS,OAAO;AAAA,MAAI;AAAA,KAAS;AAAA,GAE/C;AAEJ;",
4
+ "sourcesContent": ["import { FloatingOverlay, FloatingPortal } from '@floating-ui/react-dom-interactions'\nimport { Theme, useIsTouchDevice, useThemeName } from '@tamagui/core'\nimport { Dismissable } from '@tamagui/dismissable'\nimport { FocusScope, FocusScopeProps } from '@tamagui/focus-scope'\n\nimport { useSelectContext } from './context'\nimport { useShowSelectSheet } from './Select'\nimport { SelectContentProps } from './types'\n\n/* -------------------------------------------------------------------------------------------------\n * SelectContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'SelectContent'\n\nexport const SelectContent = ({\n children,\n __scopeSelect,\n zIndex = 1000,\n ...focusScopeProps\n}: SelectContentProps & FocusScopeProps) => {\n const context = useSelectContext(CONTENT_NAME, __scopeSelect)\n const themeName = useThemeName()\n const showSheet = useShowSelectSheet(context)\n const contents = <Theme name={themeName}>{children}</Theme>\n const touch = useIsTouchDevice()\n\n if (showSheet && context.open) {\n return contents\n }\n\n return (\n <FloatingPortal>\n {context.open ? (\n <FloatingOverlay style={{ zIndex }} lockScroll={!touch}>\n <FocusScope loop trapped {...focusScopeProps}>\n <Dismissable disableOutsidePointerEvents>{contents}</Dismissable>\n </FocusScope>\n </FloatingOverlay>\n ) : (\n <div style={{ display: 'none' }}>{contents}</div>\n )}\n </FloatingPortal>\n )\n}\n"],
5
+ "mappings": "AAwBmB;AAxBnB,SAAS,iBAAiB,sBAAsB;AAChD,SAAS,OAAO,kBAAkB,oBAAoB;AACtD,SAAS,mBAAmB;AAC5B,SAAS,kBAAmC;AAE5C,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AAOnC,MAAM,eAAe;AAEd,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA,SAAS;AAAA,KACN;AACL,MAA4C;AAC1C,QAAM,UAAU,iBAAiB,cAAc,aAAa;AAC5D,QAAM,YAAY,aAAa;AAC/B,QAAM,YAAY,mBAAmB,OAAO;AAC5C,QAAM,WAAW,oBAAC;AAAA,IAAM,MAAM;AAAA,IAAY;AAAA,GAAS;AACnD,QAAM,QAAQ,iBAAiB;AAE/B,MAAI,aAAa,QAAQ,MAAM;AAC7B,WAAO;AAAA,EACT;AAEA,SACE,oBAAC;AAAA,IACE,kBAAQ,OACP,oBAAC;AAAA,MAAgB,OAAO,EAAE,OAAO;AAAA,MAAG,YAAY,CAAC;AAAA,MAC/C,8BAAC;AAAA,QAAW,MAAI;AAAA,QAAC,SAAO;AAAA,QAAE,GAAG;AAAA,QAC3B,8BAAC;AAAA,UAAY,6BAA2B;AAAA,UAAE;AAAA,SAAS;AAAA,OACrD;AAAA,KACF,IAEA,oBAAC;AAAA,MAAI,OAAO,EAAE,SAAS,OAAO;AAAA,MAAI;AAAA,KAAS;AAAA,GAE/C;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -1,13 +1,16 @@
1
- import {
2
- FloatingFocusManager,
3
- FloatingOverlay,
4
- FloatingPortal
5
- } from "@floating-ui/react-dom-interactions";
1
+ import { FloatingOverlay, FloatingPortal } from "@floating-ui/react-dom-interactions";
6
2
  import { Theme, useIsTouchDevice, useThemeName } from "@tamagui/core";
3
+ import { Dismissable } from "@tamagui/dismissable";
4
+ import { FocusScope } from "@tamagui/focus-scope";
7
5
  import { useSelectContext } from "./context";
8
6
  import { useShowSelectSheet } from "./Select";
9
7
  const CONTENT_NAME = "SelectContent";
10
- const SelectContent = ({ children, __scopeSelect }) => {
8
+ const SelectContent = ({
9
+ children,
10
+ __scopeSelect,
11
+ zIndex = 1e3,
12
+ ...focusScopeProps
13
+ }) => {
11
14
  const context = useSelectContext(CONTENT_NAME, __scopeSelect);
12
15
  const themeName = useThemeName();
13
16
  const showSheet = useShowSelectSheet(context);
@@ -16,7 +19,7 @@ const SelectContent = ({ children, __scopeSelect }) => {
16
19
  if (showSheet && context.open) {
17
20
  return contents;
18
21
  }
19
- return <FloatingPortal>{context.open ? <FloatingOverlay lockScroll={!touch}><FloatingFocusManager context={context.floatingContext} preventTabbing>{contents}</FloatingFocusManager></FloatingOverlay> : <div style={{ display: "none" }}>{contents}</div>}</FloatingPortal>;
22
+ return <FloatingPortal>{context.open ? <FloatingOverlay style={{ zIndex }} lockScroll={!touch}><FocusScope loop trapped {...focusScopeProps}><Dismissable disableOutsidePointerEvents>{contents}</Dismissable></FocusScope></FloatingOverlay> : <div style={{ display: "none" }}>{contents}</div>}</FloatingPortal>;
20
23
  };
21
24
  export {
22
25
  SelectContent
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/SelectContent.tsx"],
4
- "sourcesContent": ["import {\n FloatingFocusManager,\n FloatingOverlay,\n FloatingPortal,\n} from '@floating-ui/react-dom-interactions'\nimport { Theme, useIsTouchDevice, useThemeName } from '@tamagui/core'\nimport * as React from 'react'\n\nimport { useSelectContext } from './context'\nimport { useShowSelectSheet } from './Select'\nimport { SelectContentProps } from './types'\n\n/* -------------------------------------------------------------------------------------------------\n * SelectContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'SelectContent'\n\nexport const SelectContent = ({ children, __scopeSelect }: SelectContentProps) => {\n const context = useSelectContext(CONTENT_NAME, __scopeSelect)\n const themeName = useThemeName()\n const showSheet = useShowSelectSheet(context)\n const contents = <Theme name={themeName}>{children}</Theme>\n const touch = useIsTouchDevice()\n\n if (showSheet && context.open) {\n return contents\n }\n\n return (\n <FloatingPortal>\n {context.open ? (\n <FloatingOverlay lockScroll={!touch}>\n <FloatingFocusManager context={context.floatingContext!} preventTabbing>\n {contents}\n </FloatingFocusManager>\n </FloatingOverlay>\n ) : (\n <div style={{ display: 'none' }}>{contents}</div>\n )}\n </FloatingPortal>\n )\n}\n"],
5
- "mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,OAAO,kBAAkB,oBAAoB;AAGtD,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AAOnC,MAAM,eAAe;AAEd,MAAM,gBAAgB,CAAC,EAAE,UAAU,cAAc,MAA0B;AAChF,QAAM,UAAU,iBAAiB,cAAc,aAAa;AAC5D,QAAM,YAAY,aAAa;AAC/B,QAAM,YAAY,mBAAmB,OAAO;AAC5C,QAAM,WAAW,CAAC,MAAM,MAAM,YAAY,SAAS,EAAjC;AAClB,QAAM,QAAQ,iBAAiB;AAE/B,MAAI,aAAa,QAAQ,MAAM;AAC7B,WAAO;AAAA,EACT;AAEA,SACE,CAAC,gBACE,QAAQ,OACP,CAAC,gBAAgB,YAAY,CAAC,OAC5B,CAAC,qBAAqB,SAAS,QAAQ,iBAAkB,gBACtD,SACH,EAFC,qBAGH,EAJC,mBAMD,CAAC,IAAI,OAAO,EAAE,SAAS,OAAO,IAAI,SAAS,EAA1C,KAEL,EAVC;AAYL;",
4
+ "sourcesContent": ["import { FloatingOverlay, FloatingPortal } from '@floating-ui/react-dom-interactions'\nimport { Theme, useIsTouchDevice, useThemeName } from '@tamagui/core'\nimport { Dismissable } from '@tamagui/dismissable'\nimport { FocusScope, FocusScopeProps } from '@tamagui/focus-scope'\n\nimport { useSelectContext } from './context'\nimport { useShowSelectSheet } from './Select'\nimport { SelectContentProps } from './types'\n\n/* -------------------------------------------------------------------------------------------------\n * SelectContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'SelectContent'\n\nexport const SelectContent = ({\n children,\n __scopeSelect,\n zIndex = 1000,\n ...focusScopeProps\n}: SelectContentProps & FocusScopeProps) => {\n const context = useSelectContext(CONTENT_NAME, __scopeSelect)\n const themeName = useThemeName()\n const showSheet = useShowSelectSheet(context)\n const contents = <Theme name={themeName}>{children}</Theme>\n const touch = useIsTouchDevice()\n\n if (showSheet && context.open) {\n return contents\n }\n\n return (\n <FloatingPortal>\n {context.open ? (\n <FloatingOverlay style={{ zIndex }} lockScroll={!touch}>\n <FocusScope loop trapped {...focusScopeProps}>\n <Dismissable disableOutsidePointerEvents>{contents}</Dismissable>\n </FocusScope>\n </FloatingOverlay>\n ) : (\n <div style={{ display: 'none' }}>{contents}</div>\n )}\n </FloatingPortal>\n )\n}\n"],
5
+ "mappings": "AAAA,SAAS,iBAAiB,sBAAsB;AAChD,SAAS,OAAO,kBAAkB,oBAAoB;AACtD,SAAS,mBAAmB;AAC5B,SAAS,kBAAmC;AAE5C,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AAOnC,MAAM,eAAe;AAEd,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA,SAAS;AAAA,KACN;AACL,MAA4C;AAC1C,QAAM,UAAU,iBAAiB,cAAc,aAAa;AAC5D,QAAM,YAAY,aAAa;AAC/B,QAAM,YAAY,mBAAmB,OAAO;AAC5C,QAAM,WAAW,CAAC,MAAM,MAAM,YAAY,SAAS,EAAjC;AAClB,QAAM,QAAQ,iBAAiB;AAE/B,MAAI,aAAa,QAAQ,MAAM;AAC7B,WAAO;AAAA,EACT;AAEA,SACE,CAAC,gBACE,QAAQ,OACP,CAAC,gBAAgB,OAAO,EAAE,OAAO,GAAG,YAAY,CAAC,OAC/C,CAAC,WAAW,KAAK,YAAY,iBAC3B,CAAC,YAAY,6BAA6B,SAAS,EAAlD,YACH,EAFC,WAGH,EAJC,mBAMD,CAAC,IAAI,OAAO,EAAE,SAAS,OAAO,IAAI,SAAS,EAA1C,KAEL,EAVC;AAYL;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/select",
3
- "version": "1.0.1-beta.154",
3
+ "version": "1.0.1-beta.157",
4
4
  "sideEffects": [
5
5
  "*.css"
6
6
  ],
@@ -27,16 +27,18 @@
27
27
  "@floating-ui/react-dom-interactions": "^0.8.1",
28
28
  "@floating-ui/react-native": "^0.8.0",
29
29
  "@radix-ui/react-use-previous": "^0.1.1",
30
- "@tamagui/compose-refs": "^1.0.1-beta.154",
31
- "@tamagui/core": "^1.0.1-beta.154",
32
- "@tamagui/create-context": "^1.0.1-beta.154",
33
- "@tamagui/list-item": "^1.0.1-beta.154",
34
- "@tamagui/portal": "^1.0.1-beta.154",
35
- "@tamagui/separator": "^1.0.1-beta.154",
36
- "@tamagui/stacks": "^1.0.1-beta.154",
37
- "@tamagui/text": "^1.0.1-beta.154",
38
- "@tamagui/use-controllable-state": "^1.0.1-beta.154",
39
- "@tamagui/use-event": "^1.0.1-beta.154"
30
+ "@tamagui/compose-refs": "^1.0.1-beta.157",
31
+ "@tamagui/core": "^1.0.1-beta.157",
32
+ "@tamagui/create-context": "^1.0.1-beta.157",
33
+ "@tamagui/dismissable": "^1.0.1-beta.157",
34
+ "@tamagui/focus-scope": "^1.0.1-beta.157",
35
+ "@tamagui/list-item": "^1.0.1-beta.157",
36
+ "@tamagui/portal": "^1.0.1-beta.157",
37
+ "@tamagui/separator": "^1.0.1-beta.157",
38
+ "@tamagui/stacks": "^1.0.1-beta.157",
39
+ "@tamagui/text": "^1.0.1-beta.157",
40
+ "@tamagui/use-controllable-state": "^1.0.1-beta.157",
41
+ "@tamagui/use-event": "^1.0.1-beta.157"
40
42
  },
41
43
  "peerDependencies": {
42
44
  "react": "*",
@@ -44,7 +46,7 @@
44
46
  "react-native": "*"
45
47
  },
46
48
  "devDependencies": {
47
- "@tamagui/build": "^1.0.1-beta.154",
49
+ "@tamagui/build": "^1.0.1-beta.157",
48
50
  "@types/react-native": "^0.69.2",
49
51
  "react": "*",
50
52
  "react-dom": "*",
@@ -1,10 +1,7 @@
1
- import {
2
- FloatingFocusManager,
3
- FloatingOverlay,
4
- FloatingPortal,
5
- } from '@floating-ui/react-dom-interactions'
1
+ import { FloatingOverlay, FloatingPortal } from '@floating-ui/react-dom-interactions'
6
2
  import { Theme, useIsTouchDevice, useThemeName } from '@tamagui/core'
7
- import * as React from 'react'
3
+ import { Dismissable } from '@tamagui/dismissable'
4
+ import { FocusScope, FocusScopeProps } from '@tamagui/focus-scope'
8
5
 
9
6
  import { useSelectContext } from './context'
10
7
  import { useShowSelectSheet } from './Select'
@@ -16,7 +13,12 @@ import { SelectContentProps } from './types'
16
13
 
17
14
  const CONTENT_NAME = 'SelectContent'
18
15
 
19
- export const SelectContent = ({ children, __scopeSelect }: SelectContentProps) => {
16
+ export const SelectContent = ({
17
+ children,
18
+ __scopeSelect,
19
+ zIndex = 1000,
20
+ ...focusScopeProps
21
+ }: SelectContentProps & FocusScopeProps) => {
20
22
  const context = useSelectContext(CONTENT_NAME, __scopeSelect)
21
23
  const themeName = useThemeName()
22
24
  const showSheet = useShowSelectSheet(context)
@@ -30,10 +32,10 @@ export const SelectContent = ({ children, __scopeSelect }: SelectContentProps) =
30
32
  return (
31
33
  <FloatingPortal>
32
34
  {context.open ? (
33
- <FloatingOverlay lockScroll={!touch}>
34
- <FloatingFocusManager context={context.floatingContext!} preventTabbing>
35
- {contents}
36
- </FloatingFocusManager>
35
+ <FloatingOverlay style={{ zIndex }} lockScroll={!touch}>
36
+ <FocusScope loop trapped {...focusScopeProps}>
37
+ <Dismissable disableOutsidePointerEvents>{contents}</Dismissable>
38
+ </FocusScope>
37
39
  </FloatingOverlay>
38
40
  ) : (
39
41
  <div style={{ display: 'none' }}>{contents}</div>
package/src/types.tsx CHANGED
@@ -80,7 +80,7 @@ export type SelectViewportProps = ThemeableStackProps & {
80
80
  size?: SizeTokens
81
81
  }
82
82
 
83
- export type SelectContentProps = ScopedProps<{ children?: React.ReactNode }>
83
+ export type SelectContentProps = ScopedProps<{ children?: React.ReactNode; zIndex?: number }>
84
84
 
85
85
  export interface SelectScrollButtonImplProps extends YStackProps {
86
86
  dir: 'up' | 'down'
package/types/Select.d.ts CHANGED
@@ -103,7 +103,7 @@ export declare const SelectIcon: import("@tamagui/core").TamaguiComponent<(Omit<
103
103
  readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
104
104
  }, string | number> & {
105
105
  [x: string]: undefined;
106
- }>>), any, import("@tamagui/core").StackPropsBase, {
106
+ }>>), TamaguiElement, import("@tamagui/core").StackPropsBase, {
107
107
  readonly fullscreen?: boolean | undefined;
108
108
  readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
109
109
  } | ({
@@ -185,7 +185,7 @@ export declare const SelectItemTextFrame: import("@tamagui/core").TamaguiCompone
185
185
  [x: string]: undefined;
186
186
  }), string | number> & {
187
187
  [x: string]: undefined;
188
- }>>), any, import("@tamagui/core").TextPropsBase, ({
188
+ }>>), TamaguiElement, import("@tamagui/core").TextPropsBase, ({
189
189
  size?: import("@tamagui/core").FontSizeTokens | undefined;
190
190
  } | ({
191
191
  size?: import("@tamagui/core").FontSizeTokens | undefined;
@@ -220,7 +220,7 @@ export declare const SelectGroupFrame: import("@tamagui/core").TamaguiComponent<
220
220
  readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
221
221
  }, string | number> & {
222
222
  [x: string]: undefined;
223
- }>>), any, import("@tamagui/core").StackPropsBase, {
223
+ }>>), TamaguiElement, import("@tamagui/core").StackPropsBase, {
224
224
  readonly fullscreen?: boolean | undefined;
225
225
  readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
226
226
  } | ({
@@ -248,7 +248,7 @@ export declare const SelectSeparator: import("@tamagui/core").TamaguiComponent<(
248
248
  vertical?: boolean | undefined;
249
249
  }, string | number> & {
250
250
  [x: string]: undefined;
251
- }>>), any, import("@tamagui/core").StackPropsBase, {
251
+ }>>), TamaguiElement, import("@tamagui/core").StackPropsBase, {
252
252
  vertical?: boolean | undefined;
253
253
  } | ({
254
254
  vertical?: boolean | undefined;
@@ -262,7 +262,12 @@ export declare const SelectSheetContents: {
262
262
  displayName: string;
263
263
  };
264
264
  export declare const Select: ((props: ScopedProps<SelectProps>) => JSX.Element) & {
265
- Content: ({ children, __scopeSelect }: import("./types").SelectContentProps) => JSX.Element;
265
+ Content: ({ children, __scopeSelect, zIndex, ...focusScopeProps }: {
266
+ children?: React.ReactNode;
267
+ zIndex?: number | undefined;
268
+ } & {
269
+ __scopeSelect?: import("@tamagui/create-context").Scope<any>;
270
+ } & import("@tamagui/focus-scope").FocusScopeProps) => JSX.Element;
266
271
  Group: React.ForwardRefExoticComponent<((Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
267
272
  readonly fullscreen?: boolean | undefined;
268
273
  readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
@@ -312,7 +317,7 @@ export declare const Select: ((props: ScopedProps<SelectProps>) => JSX.Element)
312
317
  readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
313
318
  }, string | number> & {
314
319
  [x: string]: undefined;
315
- }>>), any, import("@tamagui/core").StackPropsBase, {
320
+ }>>), TamaguiElement, import("@tamagui/core").StackPropsBase, {
316
321
  readonly fullscreen?: boolean | undefined;
317
322
  readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
318
323
  } | ({
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { FocusScopeProps } from '@tamagui/focus-scope';
2
3
  import { SelectContentProps } from './types';
3
- export declare const SelectContent: ({ children, __scopeSelect }: SelectContentProps) => JSX.Element;
4
+ export declare const SelectContent: ({ children, __scopeSelect, zIndex, ...focusScopeProps }: SelectContentProps & FocusScopeProps) => JSX.Element;
4
5
  //# sourceMappingURL=SelectContent.d.ts.map
@@ -54,7 +54,7 @@ export declare const SelectViewportFrame: import("@tamagui/core").TamaguiCompone
54
54
  chromeless?: boolean | "all" | undefined;
55
55
  }, "size"> & {
56
56
  size?: import("@tamagui/core").SizeTokens | undefined;
57
- }>>, any, import("@tamagui/core").StackPropsBase, {
57
+ }>>, TamaguiElement, import("@tamagui/core").StackPropsBase, {
58
58
  readonly fullscreen?: boolean | undefined;
59
59
  readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
60
60
  } & {
package/types/types.d.ts CHANGED
@@ -71,6 +71,7 @@ export declare type SelectViewportProps = ThemeableStackProps & {
71
71
  };
72
72
  export declare type SelectContentProps = ScopedProps<{
73
73
  children?: React.ReactNode;
74
+ zIndex?: number;
74
75
  }>;
75
76
  export interface SelectScrollButtonImplProps extends YStackProps {
76
77
  dir: 'up' | 'down';