@tamagui/linear-gradient 1.0.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.
Files changed (111) hide show
  1. package/dist/cjs/BubbleSelect.js +44 -0
  2. package/dist/cjs/BubbleSelect.js.map +7 -0
  3. package/dist/cjs/LinearGradient.js +74 -0
  4. package/dist/cjs/LinearGradient.js.map +7 -0
  5. package/dist/cjs/Select.js +480 -0
  6. package/dist/cjs/Select.js.map +7 -0
  7. package/dist/cjs/SelectContent.js +76 -0
  8. package/dist/cjs/SelectContent.js.map +7 -0
  9. package/dist/cjs/SelectContent.native.js +31 -0
  10. package/dist/cjs/SelectContent.native.js.map +7 -0
  11. package/dist/cjs/SelectImpl.js +301 -0
  12. package/dist/cjs/SelectImpl.js.map +7 -0
  13. package/dist/cjs/SelectImpl.native.js +37 -0
  14. package/dist/cjs/SelectImpl.native.js.map +7 -0
  15. package/dist/cjs/SelectScrollButton.js +161 -0
  16. package/dist/cjs/SelectScrollButton.js.map +7 -0
  17. package/dist/cjs/SelectScrollButton.native.js +32 -0
  18. package/dist/cjs/SelectScrollButton.native.js.map +7 -0
  19. package/dist/cjs/SelectViewport.js +126 -0
  20. package/dist/cjs/SelectViewport.js.map +7 -0
  21. package/dist/cjs/SelectViewport.native.js +62 -0
  22. package/dist/cjs/SelectViewport.native.js.map +7 -0
  23. package/dist/cjs/constants.js +47 -0
  24. package/dist/cjs/constants.js.map +7 -0
  25. package/dist/cjs/context.js +49 -0
  26. package/dist/cjs/context.js.map +7 -0
  27. package/dist/cjs/index.js +19 -0
  28. package/dist/cjs/index.js.map +7 -0
  29. package/dist/cjs/linear-gradient.js +29 -0
  30. package/dist/cjs/linear-gradient.js.map +7 -0
  31. package/dist/cjs/types.js +17 -0
  32. package/dist/cjs/types.js.map +7 -0
  33. package/dist/cjs/useSelectBreakpointActive.js +39 -0
  34. package/dist/cjs/useSelectBreakpointActive.js.map +7 -0
  35. package/dist/esm/BubbleSelect.js +25 -0
  36. package/dist/esm/BubbleSelect.js.map +7 -0
  37. package/dist/esm/LinearGradient.js +51 -0
  38. package/dist/esm/LinearGradient.js.map +7 -0
  39. package/dist/esm/Select.js +452 -0
  40. package/dist/esm/Select.js.map +7 -0
  41. package/dist/esm/SelectContent.js +52 -0
  42. package/dist/esm/SelectContent.js.map +7 -0
  43. package/dist/esm/SelectContent.native.js +7 -0
  44. package/dist/esm/SelectContent.native.js.map +7 -0
  45. package/dist/esm/SelectImpl.js +286 -0
  46. package/dist/esm/SelectImpl.js.map +7 -0
  47. package/dist/esm/SelectImpl.native.js +13 -0
  48. package/dist/esm/SelectImpl.native.js.map +7 -0
  49. package/dist/esm/SelectScrollButton.js +130 -0
  50. package/dist/esm/SelectScrollButton.js.map +7 -0
  51. package/dist/esm/SelectScrollButton.native.js +7 -0
  52. package/dist/esm/SelectScrollButton.native.js.map +7 -0
  53. package/dist/esm/SelectViewport.js +95 -0
  54. package/dist/esm/SelectViewport.js.map +7 -0
  55. package/dist/esm/SelectViewport.native.js +32 -0
  56. package/dist/esm/SelectViewport.native.js.map +7 -0
  57. package/dist/esm/constants.js +17 -0
  58. package/dist/esm/constants.js.map +7 -0
  59. package/dist/esm/context.js +21 -0
  60. package/dist/esm/context.js.map +7 -0
  61. package/dist/esm/index.js +2 -0
  62. package/dist/esm/index.js.map +7 -0
  63. package/dist/esm/linear-gradient.js +5 -0
  64. package/dist/esm/linear-gradient.js.map +7 -0
  65. package/dist/esm/types.js +1 -0
  66. package/dist/esm/types.js.map +7 -0
  67. package/dist/esm/useSelectBreakpointActive.js +14 -0
  68. package/dist/esm/useSelectBreakpointActive.js.map +7 -0
  69. package/dist/jsx/BubbleSelect.js +25 -0
  70. package/dist/jsx/BubbleSelect.js.map +7 -0
  71. package/dist/jsx/LinearGradient.js +39 -0
  72. package/dist/jsx/LinearGradient.js.map +7 -0
  73. package/dist/jsx/Select.js +326 -0
  74. package/dist/jsx/Select.js.map +7 -0
  75. package/dist/jsx/SelectContent.js +30 -0
  76. package/dist/jsx/SelectContent.js.map +7 -0
  77. package/dist/jsx/SelectContent.native.js +7 -0
  78. package/dist/jsx/SelectContent.native.js.map +7 -0
  79. package/dist/jsx/SelectImpl.js +259 -0
  80. package/dist/jsx/SelectImpl.js.map +7 -0
  81. package/dist/jsx/SelectImpl.native.js +10 -0
  82. package/dist/jsx/SelectImpl.native.js.map +7 -0
  83. package/dist/jsx/SelectScrollButton.js +103 -0
  84. package/dist/jsx/SelectScrollButton.js.map +7 -0
  85. package/dist/jsx/SelectScrollButton.native.js +7 -0
  86. package/dist/jsx/SelectScrollButton.native.js.map +7 -0
  87. package/dist/jsx/SelectViewport.js +73 -0
  88. package/dist/jsx/SelectViewport.js.map +7 -0
  89. package/dist/jsx/SelectViewport.native.js +18 -0
  90. package/dist/jsx/SelectViewport.native.js.map +7 -0
  91. package/dist/jsx/constants.js +17 -0
  92. package/dist/jsx/constants.js.map +7 -0
  93. package/dist/jsx/context.js +15 -0
  94. package/dist/jsx/context.js.map +7 -0
  95. package/dist/jsx/index.js +2 -0
  96. package/dist/jsx/index.js.map +7 -0
  97. package/dist/jsx/linear-gradient.js +5 -0
  98. package/dist/jsx/linear-gradient.js.map +7 -0
  99. package/dist/jsx/types.js +1 -0
  100. package/dist/jsx/types.js.map +7 -0
  101. package/dist/jsx/useSelectBreakpointActive.js +14 -0
  102. package/dist/jsx/useSelectBreakpointActive.js.map +7 -0
  103. package/package.json +43 -0
  104. package/src/LinearGradient.tsx +64 -0
  105. package/src/index.ts +1 -0
  106. package/src/linear-gradient.d.ts +3 -0
  107. package/src/linear-gradient.d.ts.map +1 -0
  108. package/src/linear-gradient.ts +2 -0
  109. package/types/LinearGradient.d.ts +10 -0
  110. package/types/index.d.ts +2 -0
  111. package/types/linear-gradient.d.ts +3 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Select.tsx"],
4
+ "sourcesContent": ["import { Adapt, useAdaptParent } from '@tamagui/adapt'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport { GetProps, TamaguiElement, isClient, isWeb } from '@tamagui/core'\nimport {\n styled,\n useGet,\n useIsomorphicLayoutEffect,\n withStaticProperties,\n} from '@tamagui/core'\nimport { useId } from '@tamagui/core'\nimport { ListItem, ListItemProps } from '@tamagui/list-item'\nimport { PortalHost } from '@tamagui/portal'\nimport { Separator } from '@tamagui/separator'\nimport { ControlledSheet, SheetController } from '@tamagui/sheet'\nimport { XStack, YStack, YStackProps } from '@tamagui/stacks'\nimport { Paragraph, SizableText } from '@tamagui/text'\nimport { useControllableState } from '@tamagui/use-controllable-state'\nimport * as React from 'react'\n\nimport { SELECT_NAME } from './constants'\nimport { SelectProvider, createSelectContext, useSelectContext } from './context'\nimport { SelectContent } from './SelectContent'\nimport { SelectInlineImpl } from './SelectImpl'\nimport { SelectScrollDownButton, SelectScrollUpButton } from './SelectScrollButton'\nimport { SelectViewport } from './SelectViewport'\nimport { ScopedProps, SelectImplProps, SelectProps } from './types'\nimport {\n useSelectBreakpointActive,\n useShowSelectSheet,\n} from './useSelectBreakpointActive'\n\n/* -------------------------------------------------------------------------------------------------\n * SelectTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'SelectTrigger'\n\nexport type SelectTriggerProps = ListItemProps\n\nexport const SelectTrigger = React.forwardRef<TamaguiElement, SelectTriggerProps>(\n (props: ScopedProps<SelectTriggerProps>, forwardedRef) => {\n const {\n __scopeSelect,\n disabled = false,\n // @ts-ignore\n 'aria-labelledby': ariaLabelledby,\n ...triggerProps\n } = props\n const context = useSelectContext(TRIGGER_NAME, __scopeSelect)\n // const composedRefs = useComposedRefs(forwardedRef, context.onTriggerChange)\n // const getItems = useCollection(__scopeSelect)\n // const labelId = useLabelContext(context.trigger)\n const labelledBy = ariaLabelledby // || labelId\n\n return (\n <ListItem\n componentName={TRIGGER_NAME}\n backgrounded\n radiused\n hoverTheme\n pressTheme\n focusTheme\n focusable\n borderWidth={1}\n size={context.size}\n // aria-controls={context.contentId}\n aria-expanded={context.open}\n aria-autocomplete=\"none\"\n aria-labelledby={labelledBy}\n dir={context.dir}\n disabled={disabled}\n data-disabled={disabled ? '' : undefined}\n {...triggerProps}\n ref={forwardedRef}\n {...(process.env.TAMAGUI_TARGET === 'web' && context.interactions\n ? context.interactions.getReferenceProps()\n : {\n onPress() {\n context.setOpen(!context.open)\n },\n })}\n />\n )\n }\n)\n\nSelectTrigger.displayName = TRIGGER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectValue\n * -----------------------------------------------------------------------------------------------*/\n\nconst VALUE_NAME = 'SelectValue'\n\nconst SelectValueFrame = styled(Paragraph, {\n name: VALUE_NAME,\n selectable: false,\n})\n\ntype SelectValueProps = GetProps<typeof SelectValueFrame> & {\n placeholder?: React.ReactNode\n}\n\nconst SelectValue = SelectValueFrame.extractable(\n React.forwardRef<TamaguiElement, SelectValueProps>(\n (\n {\n __scopeSelect,\n children: childrenProp,\n placeholder,\n }: ScopedProps<SelectValueProps>,\n forwardedRef\n ) => {\n // We ignore `className` and `style` as this part shouldn't be styled.\n const context = useSelectContext(VALUE_NAME, __scopeSelect)\n const { onValueNodeHasChildrenChange } = context\n const composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange)\n\n const children = childrenProp ?? context.selectedItem\n const hasChildren = !!children\n const selectValueChildren =\n context.value === undefined && placeholder !== undefined ? placeholder : children\n\n useIsomorphicLayoutEffect(() => {\n onValueNodeHasChildrenChange(hasChildren)\n }, [onValueNodeHasChildrenChange, hasChildren])\n\n return (\n <SelectValueFrame\n size={context.size}\n ref={composedRefs}\n // we don't want events from the portalled `SelectValue` children to bubble\n // through the item they came from\n pointerEvents=\"none\"\n >\n {selectValueChildren}\n </SelectValueFrame>\n )\n }\n )\n)\n\nSelectValue.displayName = VALUE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectIcon\n * -----------------------------------------------------------------------------------------------*/\n\nexport const SelectIcon = styled(XStack, {\n name: 'SelectIcon',\n // @ts-ignore\n 'aria-hidden': true,\n children: <Paragraph>\u25BC</Paragraph>,\n})\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'SelectItem'\n\ntype SelectItemContextValue = {\n value: string\n textId: string\n isSelected: boolean\n}\n\nconst [SelectItemContextProvider, useSelectItemContext] =\n createSelectContext<SelectItemContextValue>(ITEM_NAME)\n\nexport interface SelectItemProps extends YStackProps {\n value: string\n index: number\n disabled?: boolean\n textValue?: string\n}\n\nexport const SelectItem = React.forwardRef<TamaguiElement, SelectItemProps>(\n (props: ScopedProps<SelectItemProps>, forwardedRef) => {\n const {\n __scopeSelect,\n value,\n disabled = false,\n textValue: textValueProp,\n index,\n ...itemProps\n } = props\n const context = useSelectContext(ITEM_NAME, __scopeSelect)\n const isSelected = context.value === value\n const textId = useId()\n\n const {\n selectedIndex,\n setSelectedIndex,\n listRef,\n open,\n setOpen,\n onChange,\n setActiveIndex,\n allowMouseUpRef,\n allowSelectRef,\n setValueAtIndex,\n selectTimeoutRef,\n dataRef,\n } = context\n\n const composedRefs = useComposedRefs(forwardedRef, (node) => {\n if (!isWeb) return\n if (node instanceof HTMLElement) {\n if (listRef) {\n listRef.current[index] = node\n }\n }\n })\n\n React.useEffect(() => {\n setValueAtIndex(index, value)\n }, [index, setValueAtIndex, value])\n\n function handleSelect() {\n setSelectedIndex(index)\n onChange(value)\n setOpen(false)\n }\n\n const selectItemProps = context.interactions\n ? context.interactions.getItemProps({\n onTouchStart() {\n allowSelectRef!.current = true\n allowMouseUpRef!.current = false\n },\n onKeyDown(event) {\n if (\n event.key === 'Enter' ||\n (event.key === ' ' && !dataRef?.current.typing)\n ) {\n event.preventDefault()\n handleSelect()\n } else {\n allowSelectRef!.current = true\n }\n },\n onClick() {\n if (allowSelectRef!.current) {\n setSelectedIndex(index)\n setOpen(false)\n }\n },\n onMouseUp() {\n if (!allowMouseUpRef!.current) {\n return\n }\n\n if (allowSelectRef!.current) {\n handleSelect()\n }\n\n // On touch devices, prevent the element from\n // immediately closing `onClick` by deferring it\n clearTimeout(selectTimeoutRef!.current)\n selectTimeoutRef!.current = setTimeout(() => {\n allowSelectRef!.current = true\n })\n },\n })\n : {\n onPress: handleSelect,\n }\n\n return (\n <SelectItemContextProvider\n scope={__scopeSelect}\n value={value}\n textId={textId || ''}\n isSelected={isSelected}\n >\n <ListItem\n backgrounded\n pressTheme\n cursor=\"\"\n focusTheme\n outlineWidth={0}\n componentName={ITEM_NAME}\n ref={composedRefs}\n aria-labelledby={textId}\n aria-selected={isSelected}\n data-state={isSelected ? 'active' : 'inactive'}\n aria-disabled={disabled || undefined}\n data-disabled={disabled ? '' : undefined}\n tabIndex={disabled ? undefined : -1}\n size={context.size}\n {...itemProps}\n {...selectItemProps}\n />\n </SelectItemContextProvider>\n )\n }\n)\n\nSelectItem.displayName = ITEM_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItemText\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_TEXT_NAME = 'SelectItemText'\n\nexport const SelectItemTextFrame = styled(SizableText, {\n name: ITEM_TEXT_NAME,\n selectable: false,\n})\n\ntype SelectItemTextProps = GetProps<typeof SelectItemTextFrame>\n\nconst SelectItemText = React.forwardRef<TamaguiElement, SelectItemTextProps>(\n (props: ScopedProps<SelectItemTextProps>, forwardedRef) => {\n const { __scopeSelect, className, ...itemTextProps } = props\n const context = useSelectContext(ITEM_TEXT_NAME, __scopeSelect)\n const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect)\n const ref = React.useRef<TamaguiElement | null>(null)\n const composedRefs = useComposedRefs(forwardedRef, ref)\n const isSelected = Boolean(itemContext.isSelected && context.valueNode)\n\n const contents = React.useMemo(\n () => (\n <SelectItemTextFrame\n className={className}\n size={context.size}\n id={itemContext.textId}\n {...itemTextProps}\n ref={composedRefs}\n />\n ),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [props, context.size, className, itemContext.textId]\n )\n\n // until portals work in sub-trees on RN, use this just for native:\n React.useEffect(() => {\n if (isSelected) {\n context.setSelectedItem(contents)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isSelected, contents])\n\n return (\n <>\n {contents}\n\n {/* Portal the select item text into the trigger value node */}\n {/* this needs some extra stability between renders */}\n {/* {isWeb && isSelected\n ? ReactDOM.createPortal(itemTextProps.children, context.valueNode!)\n : null} */}\n\n {/* Portal an option in the bubble select */}\n {/* {context.bubbleSelect\n ? ReactDOM.createPortal(\n // we use `.textContent` because `option` only support `string` or `number`\n <option value={itemContext.value}>{ref.current?.textContent}</option>,\n context.bubbleSelect\n )\n : null} */}\n </>\n )\n }\n)\n\nSelectItemText.displayName = ITEM_TEXT_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_INDICATOR_NAME = 'SelectItemIndicator'\n\nconst SelectItemIndicatorFrame = styled(XStack, {\n name: ITEM_TEXT_NAME,\n})\n\ntype SelectItemIndicatorProps = GetProps<typeof SelectItemIndicatorFrame>\n\nconst SelectItemIndicator = React.forwardRef<TamaguiElement, SelectItemIndicatorProps>(\n (props: ScopedProps<SelectItemIndicatorProps>, forwardedRef) => {\n const { __scopeSelect, ...itemIndicatorProps } = props\n const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect)\n return itemContext.isSelected ? (\n <SelectItemIndicatorFrame aria-hidden {...itemIndicatorProps} ref={forwardedRef} />\n ) : null\n }\n)\n\nSelectItemIndicator.displayName = ITEM_INDICATOR_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'SelectGroup'\n\ntype SelectGroupContextValue = { id: string }\n\nconst [SelectGroupContextProvider, useSelectGroupContext] =\n createSelectContext<SelectGroupContextValue>(GROUP_NAME)\n\nexport const SelectGroupFrame = styled(YStack, {\n name: GROUP_NAME,\n width: '100%',\n})\n\ntype SelectGroupProps = GetProps<typeof SelectGroupFrame>\n\nconst SelectGroup = React.forwardRef<TamaguiElement, SelectGroupProps>(\n (props: ScopedProps<SelectGroupProps>, forwardedRef) => {\n const { __scopeSelect, ...groupProps } = props\n const groupId = useId()\n return (\n <SelectGroupContextProvider scope={__scopeSelect} id={groupId || ''}>\n <SelectGroupFrame\n // @ts-ignore\n role=\"group\"\n aria-labelledby={groupId}\n {...groupProps}\n ref={forwardedRef}\n />\n </SelectGroupContextProvider>\n )\n }\n)\n\nSelectGroup.displayName = GROUP_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectLabel\n * -----------------------------------------------------------------------------------------------*/\n\nconst LABEL_NAME = 'SelectLabel'\n\nexport type SelectLabelProps = ListItemProps\n\nconst SelectLabel = React.forwardRef<TamaguiElement, SelectLabelProps>(\n (props: ScopedProps<SelectLabelProps>, forwardedRef) => {\n const { __scopeSelect, ...labelProps } = props\n const context = useSelectContext(LABEL_NAME, __scopeSelect)\n const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect)\n return (\n <ListItem\n componentName={LABEL_NAME}\n fontWeight=\"800\"\n id={groupContext.id}\n size={context.size}\n {...labelProps}\n ref={forwardedRef}\n />\n )\n }\n)\n\nSelectLabel.displayName = LABEL_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SelectSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nexport const SelectSeparator = styled(Separator, {\n name: 'SelectSeparator',\n})\n\nconst SelectSheetController = (\n props: ScopedProps<{}> & {\n children: React.ReactNode\n onOpenChange: React.Dispatch<React.SetStateAction<boolean>>\n }\n) => {\n const context = useSelectContext('SelectSheetController', props.__scopeSelect)\n const showSheet = useShowSelectSheet(context)\n const breakpointActive = useSelectBreakpointActive(context.sheetBreakpoint)\n const getShowSheet = useGet(showSheet)\n\n return (\n <SheetController\n onOpenChange={(val) => {\n if (getShowSheet()) {\n props.onOpenChange(val)\n }\n }}\n open={context.open}\n hidden={breakpointActive === false}\n >\n {props.children}\n </SheetController>\n )\n}\n\nconst SelectSheetImpl = (props: SelectImplProps) => {\n return <>{props.children}</>\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Select\n * -----------------------------------------------------------------------------------------------*/\n\nexport const Select = withStaticProperties(\n (props: ScopedProps<SelectProps>) => {\n const {\n __scopeSelect,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n value: valueProp,\n defaultValue,\n onValueChange,\n size: sizeProp = '$4',\n dir,\n } = props\n\n const id = useId()\n const scopeKey = __scopeSelect ? Object.keys(__scopeSelect)[0] ?? id : id\n\n const { when, AdaptProvider } = useAdaptParent({\n Contents: React.useCallback(\n () => <PortalHost name={`${scopeKey}SheetContents`} />,\n [scopeKey]\n ),\n })\n const sheetBreakpoint = when\n const isSheet = useSelectBreakpointActive(sheetBreakpoint)\n const SelectImpl = isSheet || !isWeb ? SelectSheetImpl : SelectInlineImpl\n const forceUpdate = React.useReducer(() => ({}), {})[1]\n const [selectedItem, setSelectedItem] = React.useState<React.ReactNode>(null)\n\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen || false,\n onChange: onOpenChange,\n strategy: 'most-recent-wins',\n })\n\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue || '',\n onChange: onValueChange,\n strategy: 'most-recent-wins',\n transition: true,\n })\n\n const [activeIndex, setActiveIndex] = React.useState<number | null>(null)\n const selectedIndexRef = React.useRef<number | null>(null)\n const activeIndexRef = React.useRef<number | null>(null)\n\n const listContentRef = React.useRef<string[]>([])\n\n const [selectedIndex, setSelectedIndex] = React.useState(\n Math.max(0, listContentRef.current.indexOf(value))\n )\n\n const [valueNode, setValueNode] = React.useState<HTMLElement | null>(null)\n const [valueNodeHasChildren, setValueNodeHasChildren] = React.useState(false)\n\n useIsomorphicLayoutEffect(() => {\n selectedIndexRef.current = selectedIndex\n activeIndexRef.current = activeIndex\n })\n\n return (\n <AdaptProvider>\n <SelectProvider\n dir={dir}\n blockSelection={false}\n size={sizeProp}\n fallback={false}\n selectedItem={selectedItem}\n setSelectedItem={setSelectedItem}\n forceUpdate={forceUpdate}\n valueNode={valueNode}\n onValueNodeChange={setValueNode}\n onValueNodeHasChildrenChange={setValueNodeHasChildren}\n valueNodeHasChildren={valueNodeHasChildren}\n scopeKey={scopeKey}\n sheetBreakpoint={sheetBreakpoint}\n scope={__scopeSelect}\n setValueAtIndex={(index, value) => {\n listContentRef.current[index] = value\n }}\n activeIndex={activeIndex}\n onChange={setValue}\n selectedIndex={selectedIndex}\n setActiveIndex={setActiveIndex}\n setOpen={setOpen}\n setSelectedIndex={setSelectedIndex}\n value={value}\n open={open}\n >\n <SelectSheetController onOpenChange={setOpen} __scopeSelect={__scopeSelect}>\n <SelectImpl\n activeIndexRef={activeIndexRef}\n listContentRef={listContentRef}\n selectedIndexRef={selectedIndexRef}\n {...props}\n open={open}\n value={value}\n >\n {children}\n </SelectImpl>\n </SelectSheetController>\n </SelectProvider>\n </AdaptProvider>\n )\n },\n {\n Adapt,\n Content: SelectContent,\n Group: SelectGroup,\n Icon: SelectIcon,\n Item: SelectItem,\n ItemIndicator: SelectItemIndicator,\n ItemText: SelectItemText,\n Label: SelectLabel,\n ScrollDownButton: SelectScrollDownButton,\n ScrollUpButton: SelectScrollUpButton,\n Trigger: SelectTrigger,\n Value: SelectValue,\n Viewport: SelectViewport,\n Sheet: ControlledSheet,\n }\n)\n\n// @ts-ignore\nSelect.displayName = SELECT_NAME\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuDM;AAvDN,mBAAsC;AACtC,0BAAgC;AAChC,kBAA0D;AAC1D,IAAAA,eAKO;AACP,IAAAA,eAAsB;AACtB,uBAAwC;AACxC,oBAA2B;AAC3B,uBAA0B;AAC1B,mBAAiD;AACjD,oBAA4C;AAC5C,kBAAuC;AACvC,oCAAqC;AACrC,YAAuB;AA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A,IACN,eAAe;AAAA,IACf,UAAU;AAAA,IACV,OAAO;AAAA,IACP,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,IAChB,SAAS;AAAA,IACT,OAAO;AAAA,IACP,UAAU;AAAA,IACV,OAAO;AAAA,EACT;AACF;AAGA,OAAO,cAAc;",
6
+ "names": ["import_core", "value"]
7
+ }
@@ -0,0 +1,76 @@
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 SelectContent_exports = {};
20
+ __export(SelectContent_exports, {
21
+ SelectContent: () => SelectContent
22
+ });
23
+ module.exports = __toCommonJS(SelectContent_exports);
24
+ var import_jsx_runtime = require("react/jsx-runtime");
25
+ var import_react_dom_interactions = require("@floating-ui/react-dom-interactions");
26
+ var import_core = require("@tamagui/core");
27
+ var import_dismissable = require("@tamagui/dismissable");
28
+ var import_focus_scope = require("@tamagui/focus-scope");
29
+ var import_context = require("./context");
30
+ var import_useSelectBreakpointActive = require("./useSelectBreakpointActive");
31
+ const CONTENT_NAME = "SelectContent";
32
+ const SelectContent = ({
33
+ children,
34
+ __scopeSelect,
35
+ zIndex = 1e3,
36
+ ...focusScopeProps
37
+ }) => {
38
+ const context = (0, import_context.useSelectContext)(CONTENT_NAME, __scopeSelect);
39
+ const themeName = (0, import_core.useThemeName)();
40
+ const showSheet = (0, import_useSelectBreakpointActive.useShowSelectSheet)(context);
41
+ const contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, {
42
+ name: themeName,
43
+ children
44
+ });
45
+ const touch = (0, import_core.useIsTouchDevice)();
46
+ if (showSheet) {
47
+ if (!context.open) {
48
+ return null;
49
+ }
50
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
51
+ children: contents
52
+ });
53
+ }
54
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_dom_interactions.FloatingPortal, {
55
+ children: context.open ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_dom_interactions.FloatingOverlay, {
56
+ style: { zIndex },
57
+ lockScroll: !touch,
58
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_focus_scope.FocusScope, {
59
+ loop: true,
60
+ trapped: true,
61
+ ...focusScopeProps,
62
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dismissable.Dismissable, {
63
+ children: contents
64
+ })
65
+ })
66
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
67
+ style: { display: "none" },
68
+ children: contents
69
+ })
70
+ });
71
+ };
72
+ // Annotate the CommonJS export names for ESM import in node:
73
+ 0 && (module.exports = {
74
+ SelectContent
75
+ });
76
+ //# sourceMappingURL=SelectContent.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/SelectContent.tsx"],
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 { SelectContentProps } from './types'\nimport { useShowSelectSheet } from './useSelectBreakpointActive'\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) {\n if (!context.open) {\n return null\n }\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>{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;AAEjC,uCAAmC;AAMnC,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,qDAAmB,OAAO;AAC5C,QAAM,WAAW,4CAAC;AAAA,IAAM,MAAM;AAAA,IAAY;AAAA,GAAS;AACnD,QAAM,YAAQ,8BAAiB;AAE/B,MAAI,WAAW;AACb,QAAI,CAAC,QAAQ,MAAM;AACjB,aAAO;AAAA,IACT;AACA,WAAO;AAAA,MAAG;AAAA,KAAS;AAAA,EACrB;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,UAAa;AAAA,SAAS;AAAA,OACzB;AAAA,KACF,IAEA,4CAAC;AAAA,MAAI,OAAO,EAAE,SAAS,OAAO;AAAA,MAAI;AAAA,KAAS;AAAA,GAE/C;AAEJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,31 @@
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 SelectContent_native_exports = {};
20
+ __export(SelectContent_native_exports, {
21
+ SelectContent: () => SelectContent
22
+ });
23
+ module.exports = __toCommonJS(SelectContent_native_exports);
24
+ const SelectContent = ({ children }) => {
25
+ return children;
26
+ };
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ SelectContent
30
+ });
31
+ //# sourceMappingURL=SelectContent.native.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/SelectContent.native.tsx"],
4
+ "sourcesContent": ["import { SelectContentProps } from './types'\n\nexport const SelectContent = ({ children }: SelectContentProps) => {\n return children\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,gBAAgB,CAAC,EAAE,SAAS,MAA0B;AACjE,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,301 @@
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
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var SelectImpl_exports = {};
26
+ __export(SelectImpl_exports, {
27
+ SelectInlineImpl: () => SelectInlineImpl
28
+ });
29
+ module.exports = __toCommonJS(SelectImpl_exports);
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ var import_react_dom_interactions = require("@floating-ui/react-dom-interactions");
32
+ var import_core = require("@tamagui/core");
33
+ var React = __toESM(require("react"));
34
+ var import_react_dom = require("react-dom");
35
+ var import_constants = require("./constants");
36
+ var import_context = require("./context");
37
+ const SelectInlineImpl = (props) => {
38
+ const {
39
+ __scopeSelect,
40
+ children,
41
+ open = false,
42
+ selectedIndexRef,
43
+ listContentRef
44
+ } = props;
45
+ const selectContext = (0, import_context.useSelectContext)("SelectSheetImpl", __scopeSelect);
46
+ const {
47
+ setActiveIndex,
48
+ setOpen,
49
+ setSelectedIndex,
50
+ selectedIndex,
51
+ activeIndex,
52
+ forceUpdate
53
+ } = selectContext;
54
+ const [scrollTop, setScrollTop] = React.useState(0);
55
+ const touch = (0, import_core.useIsTouchDevice)();
56
+ const listItemsRef = React.useRef([]);
57
+ const overflowRef = React.useRef(null);
58
+ const upArrowRef = React.useRef(null);
59
+ const downArrowRef = React.useRef(null);
60
+ const allowSelectRef = React.useRef(false);
61
+ const allowMouseUpRef = React.useRef(true);
62
+ const selectTimeoutRef = React.useRef();
63
+ const state = React.useRef({
64
+ isMouseOutside: false
65
+ });
66
+ const [controlledScrolling, setControlledScrolling] = React.useState(false);
67
+ const [fallback, setFallback] = React.useState(false);
68
+ const [innerOffset, setInnerOffset] = React.useState(0);
69
+ const [blockSelection, setBlockSelection] = React.useState(false);
70
+ const floatingStyle = React.useRef({});
71
+ React.useEffect(() => {
72
+ const frame = requestAnimationFrame(() => {
73
+ if (!open) {
74
+ setScrollTop(0);
75
+ setFallback(false);
76
+ setActiveIndex(null);
77
+ setControlledScrolling(false);
78
+ }
79
+ });
80
+ return () => {
81
+ cancelAnimationFrame(frame);
82
+ };
83
+ }, [open, setActiveIndex]);
84
+ if (import_core.isWeb) {
85
+ React.useEffect(() => {
86
+ if (!open)
87
+ return;
88
+ const mouseUp = (e) => {
89
+ if (state.current.isMouseOutside) {
90
+ setOpen(false);
91
+ }
92
+ };
93
+ document.addEventListener("mouseup", mouseUp);
94
+ return () => {
95
+ document.removeEventListener("mouseup", mouseUp);
96
+ };
97
+ }, [open]);
98
+ }
99
+ const updateFloatingSize = (0, import_react_dom_interactions.size)({
100
+ apply({
101
+ availableHeight,
102
+ rects: {
103
+ reference: { width }
104
+ }
105
+ }) {
106
+ floatingStyle.current = {
107
+ width,
108
+ maxHeight: availableHeight
109
+ };
110
+ },
111
+ padding: import_constants.WINDOW_PADDING
112
+ });
113
+ const { x, y, reference, floating, strategy, context, refs } = (0, import_react_dom_interactions.useFloating)({
114
+ open,
115
+ onOpenChange: setOpen,
116
+ whileElementsMounted: import_react_dom_interactions.autoUpdate,
117
+ placement: "bottom-start",
118
+ middleware: fallback ? [
119
+ (0, import_react_dom_interactions.offset)(5),
120
+ ...[
121
+ touch ? (0, import_react_dom_interactions.shift)({ crossAxis: true, padding: import_constants.WINDOW_PADDING }) : (0, import_react_dom_interactions.flip)({ padding: import_constants.WINDOW_PADDING })
122
+ ],
123
+ updateFloatingSize
124
+ ] : [
125
+ (0, import_react_dom_interactions.inner)({
126
+ listRef: listItemsRef,
127
+ overflowRef,
128
+ index: selectedIndex,
129
+ offset: innerOffset,
130
+ onFallbackChange: setFallback,
131
+ padding: 10,
132
+ minItemsVisible: touch ? 10 : 4,
133
+ referenceOverflowThreshold: 20
134
+ }),
135
+ updateFloatingSize
136
+ ]
137
+ });
138
+ const floatingRef = refs.floating;
139
+ const showUpArrow = open && scrollTop > import_constants.SCROLL_ARROW_THRESHOLD;
140
+ const showDownArrow = open && floatingRef.current && scrollTop < floatingRef.current.scrollHeight - floatingRef.current.clientHeight - import_constants.SCROLL_ARROW_THRESHOLD;
141
+ const interactions = (0, import_react_dom_interactions.useInteractions)([
142
+ (0, import_react_dom_interactions.useClick)(context, { event: "mousedown" }),
143
+ (0, import_react_dom_interactions.useDismiss)(context, { outsidePress: false }),
144
+ (0, import_react_dom_interactions.useRole)(context, { role: "listbox" }),
145
+ (0, import_react_dom_interactions.useInnerOffset)(context, {
146
+ enabled: !fallback,
147
+ onChange: setInnerOffset,
148
+ overflowRef
149
+ }),
150
+ (0, import_react_dom_interactions.useListNavigation)(context, {
151
+ listRef: listItemsRef,
152
+ activeIndex,
153
+ selectedIndex,
154
+ onNavigate: setActiveIndex
155
+ }),
156
+ (0, import_react_dom_interactions.useTypeahead)(context, {
157
+ listRef: listContentRef,
158
+ onMatch: open ? setActiveIndex : setSelectedIndex,
159
+ selectedIndex,
160
+ activeIndex
161
+ })
162
+ ]);
163
+ const interactionsContext = {
164
+ ...interactions,
165
+ getReferenceProps() {
166
+ return interactions.getReferenceProps({
167
+ ref: reference,
168
+ className: "SelectTrigger",
169
+ onKeyDown(event) {
170
+ if (event.key === "Enter" || event.key === " " && !context.dataRef.current.typing) {
171
+ event.preventDefault();
172
+ setOpen(true);
173
+ }
174
+ }
175
+ });
176
+ },
177
+ getFloatingProps(props2) {
178
+ return interactions.getFloatingProps({
179
+ ref: floating,
180
+ className: "Select",
181
+ ...props2,
182
+ style: {
183
+ position: strategy,
184
+ top: y ?? "",
185
+ left: x ?? "",
186
+ outline: 0,
187
+ listStyleType: "none",
188
+ scrollbarWidth: "none",
189
+ ...floatingStyle.current,
190
+ ...props2 == null ? void 0 : props2.style
191
+ },
192
+ onPointerEnter() {
193
+ setControlledScrolling(false);
194
+ state.current.isMouseOutside = false;
195
+ },
196
+ onPointerLeave() {
197
+ state.current.isMouseOutside = true;
198
+ },
199
+ onPointerMove() {
200
+ state.current.isMouseOutside = false;
201
+ setControlledScrolling(false);
202
+ },
203
+ onKeyDown() {
204
+ setControlledScrolling(true);
205
+ },
206
+ onContextMenu(e) {
207
+ e.preventDefault();
208
+ },
209
+ onScroll(event) {
210
+ (0, import_react_dom.flushSync)(() => setScrollTop(event.currentTarget.scrollTop));
211
+ }
212
+ });
213
+ }
214
+ };
215
+ (0, import_core.useIsomorphicLayoutEffect)(() => {
216
+ if (open) {
217
+ selectTimeoutRef.current = setTimeout(() => {
218
+ allowSelectRef.current = true;
219
+ }, 300);
220
+ return () => {
221
+ clearTimeout(selectTimeoutRef.current);
222
+ };
223
+ } else {
224
+ allowSelectRef.current = false;
225
+ allowMouseUpRef.current = true;
226
+ setInnerOffset(0);
227
+ setFallback(false);
228
+ setBlockSelection(false);
229
+ }
230
+ }, [open]);
231
+ (0, import_core.useIsomorphicLayoutEffect)(() => {
232
+ function onPointerDown(e) {
233
+ var _a, _b, _c;
234
+ const target = e.target;
235
+ if (!(((_a = refs.floating.current) == null ? void 0 : _a.contains(target)) || ((_b = upArrowRef.current) == null ? void 0 : _b.contains(target)) || ((_c = downArrowRef.current) == null ? void 0 : _c.contains(target)))) {
236
+ setOpen(false);
237
+ setControlledScrolling(false);
238
+ }
239
+ }
240
+ if (open) {
241
+ document.addEventListener("pointerdown", onPointerDown);
242
+ return () => {
243
+ document.removeEventListener("pointerdown", onPointerDown);
244
+ };
245
+ }
246
+ }, [open, refs, setOpen]);
247
+ (0, import_core.useIsomorphicLayoutEffect)(() => {
248
+ var _a, _b;
249
+ if (open && controlledScrolling) {
250
+ if (activeIndex != null) {
251
+ (_a = listItemsRef.current[activeIndex]) == null ? void 0 : _a.scrollIntoView({ block: "nearest" });
252
+ }
253
+ }
254
+ setScrollTop(((_b = refs.floating.current) == null ? void 0 : _b.scrollTop) ?? 0);
255
+ }, [open, refs, controlledScrolling, activeIndex]);
256
+ (0, import_core.useIsomorphicLayoutEffect)(() => {
257
+ var _a;
258
+ if (open && fallback) {
259
+ if (selectedIndex != null) {
260
+ (_a = listItemsRef.current[selectedIndex]) == null ? void 0 : _a.scrollIntoView({ block: "nearest" });
261
+ }
262
+ }
263
+ }, [open, fallback, selectedIndex]);
264
+ (0, import_core.useIsomorphicLayoutEffect)(() => {
265
+ if (refs.floating.current && fallback) {
266
+ refs.floating.current.style.maxHeight = "";
267
+ }
268
+ }, [refs, fallback]);
269
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_context.SelectProvider, {
270
+ scope: __scopeSelect,
271
+ ...selectContext,
272
+ setScrollTop,
273
+ setInnerOffset,
274
+ floatingRef,
275
+ setValueAtIndex: (index, value) => {
276
+ listContentRef.current[index] = value;
277
+ },
278
+ fallback,
279
+ interactions: interactionsContext,
280
+ floatingContext: context,
281
+ activeIndex,
282
+ canScrollDown: !!showDownArrow,
283
+ canScrollUp: !!showUpArrow,
284
+ controlledScrolling: true,
285
+ dataRef: context.dataRef,
286
+ listRef: listItemsRef,
287
+ blockSelection,
288
+ allowMouseUpRef,
289
+ upArrowRef,
290
+ downArrowRef,
291
+ selectTimeoutRef,
292
+ allowSelectRef,
293
+ children
294
+ });
295
+ };
296
+ const userAgent = typeof navigator !== "undefined" && navigator.userAgent || "";
297
+ // Annotate the CommonJS export names for ESM import in node:
298
+ 0 && (module.exports = {
299
+ SelectInlineImpl
300
+ });
301
+ //# sourceMappingURL=SelectImpl.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/SelectImpl.tsx"],
4
+ "sourcesContent": ["import {\n SideObject,\n autoUpdate,\n flip,\n inner,\n offset,\n shift,\n size,\n useClick,\n useDismiss,\n useFloating,\n useInnerOffset,\n useInteractions,\n useListNavigation,\n useRole,\n useTypeahead,\n} from '@floating-ui/react-dom-interactions'\nimport { isWeb, useIsTouchDevice, useIsomorphicLayoutEffect } from '@tamagui/core'\nimport * as React from 'react'\nimport { flushSync } from 'react-dom'\n\nimport { SCROLL_ARROW_THRESHOLD, WINDOW_PADDING } from './constants'\nimport { SelectProvider, useSelectContext } from './context'\nimport { SelectImplProps } from './types'\n\n// TODO use id for focusing from label\nexport const SelectInlineImpl = (props: SelectImplProps) => {\n const {\n __scopeSelect,\n children,\n open = false,\n selectedIndexRef,\n listContentRef,\n } = props\n\n const selectContext = useSelectContext('SelectSheetImpl', __scopeSelect)\n const {\n setActiveIndex,\n setOpen,\n setSelectedIndex,\n selectedIndex,\n activeIndex,\n forceUpdate,\n } = selectContext\n const [scrollTop, setScrollTop] = React.useState(0)\n const touch = useIsTouchDevice()\n\n const listItemsRef = React.useRef<Array<HTMLElement | null>>([])\n const overflowRef = React.useRef<null | SideObject>(null)\n const upArrowRef = React.useRef<HTMLDivElement | null>(null)\n const downArrowRef = React.useRef<HTMLDivElement | null>(null)\n const allowSelectRef = React.useRef(false)\n const allowMouseUpRef = React.useRef(true)\n const selectTimeoutRef = React.useRef<any>()\n const state = React.useRef({\n isMouseOutside: false,\n })\n\n const [controlledScrolling, setControlledScrolling] = React.useState(false)\n const [fallback, setFallback] = React.useState(false)\n const [innerOffset, setInnerOffset] = React.useState(0)\n const [blockSelection, setBlockSelection] = React.useState(false)\n const floatingStyle = React.useRef({})\n\n // Wait for scroll position to settle before showing arrows to prevent\n // interference with pointer events.\n React.useEffect(() => {\n const frame = requestAnimationFrame(() => {\n if (!open) {\n setScrollTop(0)\n setFallback(false)\n setActiveIndex(null)\n setControlledScrolling(false)\n }\n })\n return () => {\n cancelAnimationFrame(frame)\n }\n }, [open, setActiveIndex])\n\n // close when mouseup outside select\n if (isWeb) {\n React.useEffect(() => {\n if (!open) return\n const mouseUp = (e: MouseEvent) => {\n if (state.current.isMouseOutside) {\n setOpen(false)\n }\n }\n document.addEventListener('mouseup', mouseUp)\n return () => {\n document.removeEventListener('mouseup', mouseUp)\n }\n }, [open])\n }\n\n const updateFloatingSize = size({\n apply({\n availableHeight,\n rects: {\n reference: { width },\n },\n }) {\n floatingStyle.current = {\n width: width,\n maxHeight: availableHeight,\n }\n },\n padding: WINDOW_PADDING,\n })\n\n const { x, y, reference, floating, strategy, context, refs } = useFloating({\n open,\n onOpenChange: setOpen,\n whileElementsMounted: autoUpdate,\n placement: 'bottom-start',\n middleware: fallback\n ? [\n offset(5),\n ...[\n touch\n ? shift({ crossAxis: true, padding: WINDOW_PADDING })\n : flip({ padding: WINDOW_PADDING }),\n ],\n updateFloatingSize,\n ]\n : [\n inner({\n listRef: listItemsRef,\n overflowRef,\n index: selectedIndex,\n offset: innerOffset,\n onFallbackChange: setFallback,\n padding: 10,\n minItemsVisible: touch ? 10 : 4,\n referenceOverflowThreshold: 20,\n }),\n updateFloatingSize,\n ],\n })\n\n const floatingRef = refs.floating\n\n const showUpArrow = open && scrollTop > SCROLL_ARROW_THRESHOLD\n const showDownArrow =\n open &&\n floatingRef.current &&\n scrollTop <\n floatingRef.current.scrollHeight -\n floatingRef.current.clientHeight -\n SCROLL_ARROW_THRESHOLD\n\n const interactions = useInteractions([\n useClick(context, { event: 'mousedown' }),\n useDismiss(context, { outsidePress: false }),\n useRole(context, { role: 'listbox' }),\n useInnerOffset(context, {\n enabled: !fallback,\n onChange: setInnerOffset,\n overflowRef,\n }),\n useListNavigation(context, {\n listRef: listItemsRef,\n activeIndex,\n selectedIndex,\n onNavigate: setActiveIndex,\n }),\n useTypeahead(context, {\n listRef: listContentRef,\n onMatch: open ? setActiveIndex : setSelectedIndex,\n selectedIndex,\n activeIndex,\n }),\n ])\n\n const interactionsContext = {\n ...interactions,\n getReferenceProps() {\n return interactions.getReferenceProps({\n ref: reference,\n className: 'SelectTrigger',\n onKeyDown(event) {\n if (\n event.key === 'Enter' ||\n (event.key === ' ' && !context.dataRef.current.typing)\n ) {\n event.preventDefault()\n setOpen(true)\n }\n },\n })\n },\n getFloatingProps(props) {\n return interactions.getFloatingProps({\n ref: floating,\n className: 'Select',\n ...props,\n style: {\n position: strategy,\n top: y ?? '',\n left: x ?? '',\n outline: 0,\n listStyleType: 'none',\n scrollbarWidth: 'none',\n ...floatingStyle.current,\n ...props?.style,\n },\n onPointerEnter() {\n setControlledScrolling(false)\n state.current.isMouseOutside = false\n },\n onPointerLeave() {\n state.current.isMouseOutside = true\n },\n onPointerMove() {\n state.current.isMouseOutside = false\n setControlledScrolling(false)\n },\n onKeyDown() {\n setControlledScrolling(true)\n },\n onContextMenu(e) {\n e.preventDefault()\n },\n onScroll(event) {\n // In React 18, the ScrollArrows need to synchronously know this value to prevent\n // painting at the wrong time.\n flushSync(() => setScrollTop(event.currentTarget.scrollTop))\n },\n })\n },\n }\n\n // effects\n\n useIsomorphicLayoutEffect(() => {\n if (open) {\n selectTimeoutRef.current = setTimeout(() => {\n allowSelectRef.current = true\n }, 300)\n\n return () => {\n clearTimeout(selectTimeoutRef.current)\n }\n } else {\n allowSelectRef.current = false\n allowMouseUpRef.current = true\n setInnerOffset(0)\n setFallback(false)\n setBlockSelection(false)\n }\n }, [open])\n\n // Replacement for `useDismiss` as the arrows are outside of the floating\n // element DOM tree.\n useIsomorphicLayoutEffect(() => {\n function onPointerDown(e: PointerEvent) {\n const target = e.target as Node\n if (\n !(\n refs.floating.current?.contains(target) ||\n upArrowRef.current?.contains(target) ||\n downArrowRef.current?.contains(target)\n )\n ) {\n setOpen(false)\n setControlledScrolling(false)\n }\n }\n\n if (open) {\n document.addEventListener('pointerdown', onPointerDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown)\n }\n }\n }, [open, refs, setOpen])\n\n // Scroll the `activeIndex` item into view only in \"controlledScrolling\"\n // (keyboard nav) mode.\n useIsomorphicLayoutEffect(() => {\n if (open && controlledScrolling) {\n if (activeIndex != null) {\n listItemsRef.current[activeIndex]?.scrollIntoView({ block: 'nearest' })\n }\n }\n\n setScrollTop(refs.floating.current?.scrollTop ?? 0)\n }, [open, refs, controlledScrolling, activeIndex])\n\n // Scroll the `selectedIndex` into view upon opening the floating element.\n useIsomorphicLayoutEffect(() => {\n if (open && fallback) {\n if (selectedIndex != null) {\n listItemsRef.current[selectedIndex]?.scrollIntoView({ block: 'nearest' })\n }\n }\n }, [open, fallback, selectedIndex])\n\n // Unset the height limiting for fallback mode. This gets executed prior to\n // the positioning call.\n useIsomorphicLayoutEffect(() => {\n if (refs.floating.current && fallback) {\n refs.floating.current.style.maxHeight = ''\n }\n }, [refs, fallback])\n\n // We set this to true by default so that events bubble to forms without JS (SSR)\n // const isFormControl = trigger ? Boolean(trigger.closest('form')) : true\n // const [bubbleSelect, setBubbleSelect] = React.useState<HTMLSelectElement | null>(null)\n // const triggerPointerDownPosRef = React.useRef<{ x: number; y: number } | null>(null)\n\n return (\n <SelectProvider\n scope={__scopeSelect}\n {...(selectContext as Required<typeof selectContext>)}\n setScrollTop={setScrollTop}\n setInnerOffset={setInnerOffset}\n floatingRef={floatingRef}\n setValueAtIndex={(index, value) => {\n listContentRef.current[index] = value\n }}\n fallback={fallback}\n interactions={interactionsContext}\n floatingContext={context}\n activeIndex={activeIndex}\n canScrollDown={!!showDownArrow}\n canScrollUp={!!showUpArrow}\n controlledScrolling\n dataRef={context.dataRef}\n listRef={listItemsRef}\n blockSelection={blockSelection}\n allowMouseUpRef={allowMouseUpRef}\n upArrowRef={upArrowRef}\n downArrowRef={downArrowRef}\n selectTimeoutRef={selectTimeoutRef}\n allowSelectRef={allowSelectRef}\n >\n {children}\n {/* {isFormControl ? (\n <BubbleSelect\n ref={setBubbleSelect}\n aria-hidden\n tabIndex={-1}\n name={name}\n autoComplete={autoComplete}\n value={value}\n // enable form autofill\n onChange={(event) => setValue(event.target.value)}\n />\n ) : null} */}\n </SelectProvider>\n )\n}\n\n// Cross browser fixes for pinch-zooming/backdrop-filter \uD83D\uDE44\nconst userAgent = (typeof navigator !== 'undefined' && navigator.userAgent) || ''\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAyTI;AAzTJ,oCAgBO;AACP,kBAAmE;AACnE,YAAuB;AACvB,uBAA0B;AAE1B,uBAAuD;AACvD,qBAAiD;AAI1C,MAAM,mBAAmB,CAAC,UAA2B;AAC1D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,oBAAgB,iCAAiB,mBAAmB,aAAa;AACvE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAS,CAAC;AAClD,QAAM,YAAQ,8BAAiB;AAE/B,QAAM,eAAe,MAAM,OAAkC,CAAC,CAAC;AAC/D,QAAM,cAAc,MAAM,OAA0B,IAAI;AACxD,QAAM,aAAa,MAAM,OAA8B,IAAI;AAC3D,QAAM,eAAe,MAAM,OAA8B,IAAI;AAC7D,QAAM,iBAAiB,MAAM,OAAO,KAAK;AACzC,QAAM,kBAAkB,MAAM,OAAO,IAAI;AACzC,QAAM,mB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AAI;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,iBAAiB,CAAC,OAAO,UAAU;AACjC,qBAAe,QAAQ,SAAS;AAAA,IAClC;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB;AAAA,IACA,eAAe,CAAC,CAAC;AAAA,IACjB,aAAa,CAAC,CAAC;AAAA,IACf,qBAAmB;AAAA,IACnB,SAAS,QAAQ;AAAA,IACjB,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEC;AAAA,GAaH;AAEJ;AAGA,MAAM,YAAa,OAAO,cAAc,eAAe,UAAU,aAAc;",
6
+ "names": ["props"]
7
+ }
@@ -0,0 +1,37 @@
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 SelectImpl_native_exports = {};
20
+ __export(SelectImpl_native_exports, {
21
+ SelectInlineImpl: () => SelectInlineImpl
22
+ });
23
+ module.exports = __toCommonJS(SelectImpl_native_exports);
24
+ var import_jsx_runtime = require("react/jsx-runtime");
25
+ const SelectInlineImpl = (props) => {
26
+ if (process.env.NODE_ENV === "development") {
27
+ console.warn("Sheet not implemented inline on native");
28
+ }
29
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
30
+ children: props.children
31
+ });
32
+ };
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ SelectInlineImpl
36
+ });
37
+ //# sourceMappingURL=SelectImpl.native.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/SelectImpl.native.tsx"],
4
+ "sourcesContent": ["import { SelectImplProps } from './types'\n\n/**\n * TODO can just make it a sheet for native\n * later on can have `native` prop\n */\n\nexport const SelectInlineImpl = (props: SelectImplProps) => {\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn('Sheet not implemented inline on native')\n }\n return <>{props.children}</>\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYS;AALF,MAAM,mBAAmB,CAAC,UAA2B;AAC1D,MAAI,QAAQ,IAAI,aAAa,eAAe;AAE1C,YAAQ,KAAK,wCAAwC;AAAA,EACvD;AACA,SAAO;AAAA,IAAG,gBAAM;AAAA,GAAS;AAC3B;",
6
+ "names": []
7
+ }