@tamagui/select 1.1.1 → 1.1.2

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.
@@ -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 { SizeTokens } from '@tamagui/core'\nimport type { Scope } from '@tamagui/create-context'\nimport type { ThemeableStackProps, YStackProps } from '@tamagui/stacks'\nimport type {\n DispatchWithoutAction,\n HTMLProps,\n MutableRefObject,\n ReactNode,\n} 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: any\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}\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"],
4
+ "sourcesContent": ["import type {\n ContextData,\n FloatingContext,\n ReferenceType,\n} from '@floating-ui/react-dom-interactions'\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}\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
5
  "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -25,6 +25,10 @@ module.exports = __toCommonJS(useSelectBreakpointActive_exports);
25
25
  var import_core = require("@tamagui/core");
26
26
  const useSelectBreakpointActive = (sheetBreakpoint) => {
27
27
  const media = (0, import_core.useMedia)();
28
+ if (!sheetBreakpoint)
29
+ return false;
30
+ if (sheetBreakpoint === true)
31
+ return true;
28
32
  return sheetBreakpoint ? media[sheetBreakpoint] : false;
29
33
  };
30
34
  const useShowSelectSheet = (context) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/useSelectBreakpointActive.tsx"],
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 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": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAyB;AAIlB,MAAM,4BAA4B,CACvC,oBACG;AACH,QAAM,YAAQ,sBAAS;AACvB,SAAO,kBAAkB,MAAM,mBAAmB;AACpD;AAEO,MAAM,qBAAqB,CAAC,YAAgC;AACjE,QAAM,mBAAmB,0BAA0B,QAAQ,eAAe;AAC1E,SAAO,QAAQ,SAAS,QAAQ,QAAQ;AAC1C;",
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": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAyB;AAIlB,MAAM,4BAA4B,CACvC,oBACG;AACH,QAAM,YAAQ,sBAAS;AACvB,MAAI,CAAC;AAAiB,WAAO;AAC7B,MAAI,oBAAoB;AAAM,WAAO;AACrC,SAAO,kBAAkB,MAAM,mBAAmB;AACpD;AAEO,MAAM,qBAAqB,CAAC,YAAgC;AACjE,QAAM,mBAAmB,0BAA0B,QAAQ,eAAe;AAC1E,SAAO,QAAQ,SAAS,QAAQ,QAAQ;AAC1C;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,10 @@
1
1
  import { useMedia } from "@tamagui/core";
2
2
  const useSelectBreakpointActive = (sheetBreakpoint) => {
3
3
  const media = useMedia();
4
+ if (!sheetBreakpoint)
5
+ return false;
6
+ if (sheetBreakpoint === true)
7
+ return true;
4
8
  return sheetBreakpoint ? media[sheetBreakpoint] : false;
5
9
  };
6
10
  const useShowSelectSheet = (context) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/useSelectBreakpointActive.tsx"],
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 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": "AAAA,SAAS,gBAAgB;AAIlB,MAAM,4BAA4B,CACvC,oBACG;AACH,QAAM,QAAQ,SAAS;AACvB,SAAO,kBAAkB,MAAM,mBAAmB;AACpD;AAEO,MAAM,qBAAqB,CAAC,YAAgC;AACjE,QAAM,mBAAmB,0BAA0B,QAAQ,eAAe;AAC1E,SAAO,QAAQ,SAAS,QAAQ,QAAQ;AAC1C;",
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": "AAAA,SAAS,gBAAgB;AAIlB,MAAM,4BAA4B,CACvC,oBACG;AACH,QAAM,QAAQ,SAAS;AACvB,MAAI,CAAC;AAAiB,WAAO;AAC7B,MAAI,oBAAoB;AAAM,WAAO;AACrC,SAAO,kBAAkB,MAAM,mBAAmB;AACpD;AAEO,MAAM,qBAAqB,CAAC,YAAgC;AACjE,QAAM,mBAAmB,0BAA0B,QAAQ,eAAe;AAC1E,SAAO,QAAQ,SAAS,QAAQ,QAAQ;AAC1C;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,10 @@
1
1
  import { useMedia } from "@tamagui/core";
2
2
  const useSelectBreakpointActive = (sheetBreakpoint) => {
3
3
  const media = useMedia();
4
+ if (!sheetBreakpoint)
5
+ return false;
6
+ if (sheetBreakpoint === true)
7
+ return true;
4
8
  return sheetBreakpoint ? media[sheetBreakpoint] : false;
5
9
  };
6
10
  const useShowSelectSheet = (context) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/useSelectBreakpointActive.tsx"],
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 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": "AAAA,SAAS,gBAAgB;AAIlB,MAAM,4BAA4B,CACvC,oBACG;AACH,QAAM,QAAQ,SAAS;AACvB,SAAO,kBAAkB,MAAM,mBAAmB;AACpD;AAEO,MAAM,qBAAqB,CAAC,YAAgC;AACjE,QAAM,mBAAmB,0BAA0B,QAAQ,eAAe;AAC1E,SAAO,QAAQ,SAAS,QAAQ,QAAQ;AAC1C;",
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": "AAAA,SAAS,gBAAgB;AAIlB,MAAM,4BAA4B,CACvC,oBACG;AACH,QAAM,QAAQ,SAAS;AACvB,MAAI,CAAC;AAAiB,WAAO;AAC7B,MAAI,oBAAoB;AAAM,WAAO;AACrC,SAAO,kBAAkB,MAAM,mBAAmB;AACpD;AAEO,MAAM,qBAAqB,CAAC,YAAgC;AACjE,QAAM,mBAAmB,0BAA0B,QAAQ,eAAe;AAC1E,SAAO,QAAQ,SAAS,QAAQ,QAAQ;AAC1C;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/select",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "sideEffects": [
5
5
  "*.css"
6
6
  ],
@@ -27,19 +27,19 @@
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/adapt": "^1.1.1",
31
- "@tamagui/compose-refs": "^1.1.1",
32
- "@tamagui/core": "^1.1.1",
33
- "@tamagui/create-context": "^1.1.1",
34
- "@tamagui/dismissable": "^1.1.1",
35
- "@tamagui/focus-scope": "^1.1.1",
36
- "@tamagui/list-item": "^1.1.1",
37
- "@tamagui/portal": "^1.1.1",
38
- "@tamagui/separator": "^1.1.1",
39
- "@tamagui/stacks": "^1.1.1",
40
- "@tamagui/text": "^1.1.1",
41
- "@tamagui/use-controllable-state": "^1.1.1",
42
- "@tamagui/use-event": "^1.1.1"
30
+ "@tamagui/adapt": "^1.1.2",
31
+ "@tamagui/compose-refs": "^1.1.2",
32
+ "@tamagui/core": "^1.1.2",
33
+ "@tamagui/create-context": "^1.1.2",
34
+ "@tamagui/dismissable": "^1.1.2",
35
+ "@tamagui/focus-scope": "^1.1.2",
36
+ "@tamagui/list-item": "^1.1.2",
37
+ "@tamagui/portal": "^1.1.2",
38
+ "@tamagui/separator": "^1.1.2",
39
+ "@tamagui/stacks": "^1.1.2",
40
+ "@tamagui/text": "^1.1.2",
41
+ "@tamagui/use-controllable-state": "^1.1.2",
42
+ "@tamagui/use-event": "^1.1.2"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": "*",
@@ -47,7 +47,7 @@
47
47
  "react-native": "*"
48
48
  },
49
49
  "devDependencies": {
50
- "@tamagui/build": "^1.1.1",
50
+ "@tamagui/build": "^1.1.2",
51
51
  "react": "^18.2.0",
52
52
  "react-dom": "^18.2.0",
53
53
  "react-native": "*"
package/src/types.tsx CHANGED
@@ -6,12 +6,7 @@ import type {
6
6
  import type { SizeTokens } from '@tamagui/core'
7
7
  import type { Scope } from '@tamagui/create-context'
8
8
  import type { ThemeableStackProps, YStackProps } from '@tamagui/stacks'
9
- import type {
10
- DispatchWithoutAction,
11
- HTMLProps,
12
- MutableRefObject,
13
- ReactNode,
14
- } from 'react'
9
+ import type { DispatchWithoutAction, HTMLProps, MutableRefObject, ReactNode } from 'react'
15
10
 
16
11
  export type Direction = 'ltr' | 'rtl'
17
12
 
@@ -41,7 +36,7 @@ export interface SelectProps {
41
36
  export interface SelectContextValue {
42
37
  dir?: Direction
43
38
  scopeKey: string
44
- sheetBreakpoint: any
39
+ sheetBreakpoint: string | boolean | null
45
40
  size?: SizeTokens
46
41
  value: any
47
42
  selectedItem: ReactNode
@@ -3,9 +3,11 @@ import { useMedia } from '@tamagui/core'
3
3
  import { SelectContextValue } from './types'
4
4
 
5
5
  export const useSelectBreakpointActive = (
6
- sheetBreakpoint: SelectContextValue['sheetBreakpoint'],
6
+ sheetBreakpoint: SelectContextValue['sheetBreakpoint']
7
7
  ) => {
8
8
  const media = useMedia()
9
+ if (!sheetBreakpoint) return false
10
+ if (sheetBreakpoint === true) return true
9
11
  return sheetBreakpoint ? media[sheetBreakpoint] : false
10
12
  }
11
13
 
package/types/types.d.ts CHANGED
@@ -29,7 +29,7 @@ export interface SelectProps {
29
29
  export interface SelectContextValue {
30
30
  dir?: Direction;
31
31
  scopeKey: string;
32
- sheetBreakpoint: any;
32
+ sheetBreakpoint: string | boolean | null;
33
33
  size?: SizeTokens;
34
34
  value: any;
35
35
  selectedItem: ReactNode;