@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": "AAuDM,SAmSA,UAnSA;AAvDN,SAAS,OAAO,sBAAsB;AACtC,SAAS,uBAAuB;AAChC,SAA6C,aAAa;AAC1D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AACtB,SAAS,gBAA+B;AACxC,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB,uBAAuB;AACjD,SAAS,QAAQ,cAA2B;AAC5C,SAAS,WAAW,m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AAAA,EAEJ;AAAA,EACA;AAAA,IACE;AAAA,IACA,SAAS;AAAA,IACT,OAAO;AAAA,IACP,MAAM;AAAA,IACN,MAAM;AAAA,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": ["value"]
7
+ }
@@ -0,0 +1,52 @@
1
+ import { Fragment, jsx } from "react/jsx-runtime";
2
+ import { FloatingOverlay, FloatingPortal } from "@floating-ui/react-dom-interactions";
3
+ import { Theme, useIsTouchDevice, useThemeName } from "@tamagui/core";
4
+ import { Dismissable } from "@tamagui/dismissable";
5
+ import { FocusScope } from "@tamagui/focus-scope";
6
+ import { useSelectContext } from "./context";
7
+ import { useShowSelectSheet } from "./useSelectBreakpointActive";
8
+ const CONTENT_NAME = "SelectContent";
9
+ const SelectContent = ({
10
+ children,
11
+ __scopeSelect,
12
+ zIndex = 1e3,
13
+ ...focusScopeProps
14
+ }) => {
15
+ const context = useSelectContext(CONTENT_NAME, __scopeSelect);
16
+ const themeName = useThemeName();
17
+ const showSheet = useShowSelectSheet(context);
18
+ const contents = /* @__PURE__ */ jsx(Theme, {
19
+ name: themeName,
20
+ children
21
+ });
22
+ const touch = useIsTouchDevice();
23
+ if (showSheet) {
24
+ if (!context.open) {
25
+ return null;
26
+ }
27
+ return /* @__PURE__ */ jsx(Fragment, {
28
+ children: contents
29
+ });
30
+ }
31
+ return /* @__PURE__ */ jsx(FloatingPortal, {
32
+ children: context.open ? /* @__PURE__ */ jsx(FloatingOverlay, {
33
+ style: { zIndex },
34
+ lockScroll: !touch,
35
+ children: /* @__PURE__ */ jsx(FocusScope, {
36
+ loop: true,
37
+ trapped: true,
38
+ ...focusScopeProps,
39
+ children: /* @__PURE__ */ jsx(Dismissable, {
40
+ children: contents
41
+ })
42
+ })
43
+ }) : /* @__PURE__ */ jsx("div", {
44
+ style: { display: "none" },
45
+ children: contents
46
+ })
47
+ });
48
+ };
49
+ export {
50
+ SelectContent
51
+ };
52
+ //# 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": "AAwBmB,SAOR,UAPQ;AAxBnB,SAAS,iBAAiB,sBAAsB;AAChD,SAAS,OAAO,kBAAkB,oBAAoB;AACtD,SAAS,mBAAmB;AAC5B,SAAS,kBAAmC;AAE5C,SAAS,wBAAwB;AAEjC,SAAS,0BAA0B;AAMnC,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,WAAW;AACb,QAAI,CAAC,QAAQ,MAAM;AACjB,aAAO;AAAA,IACT;AACA,WAAO;AAAA,MAAG;AAAA,KAAS;AAAA,EACrB;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,UAAa;AAAA,SAAS;AAAA,OACzB;AAAA,KACF,IAEA,oBAAC;AAAA,MAAI,OAAO,EAAE,SAAS,OAAO;AAAA,MAAI;AAAA,KAAS;AAAA,GAE/C;AAEJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ const SelectContent = ({ children }) => {
2
+ return children;
3
+ };
4
+ export {
5
+ SelectContent
6
+ };
7
+ //# 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": "AAEO,MAAM,gBAAgB,CAAC,EAAE,SAAS,MAA0B;AACjE,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,286 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import {
3
+ autoUpdate,
4
+ flip,
5
+ inner,
6
+ offset,
7
+ shift,
8
+ size,
9
+ useClick,
10
+ useDismiss,
11
+ useFloating,
12
+ useInnerOffset,
13
+ useInteractions,
14
+ useListNavigation,
15
+ useRole,
16
+ useTypeahead
17
+ } from "@floating-ui/react-dom-interactions";
18
+ import { isWeb, useIsTouchDevice, useIsomorphicLayoutEffect } from "@tamagui/core";
19
+ import * as React from "react";
20
+ import { flushSync } from "react-dom";
21
+ import { SCROLL_ARROW_THRESHOLD, WINDOW_PADDING } from "./constants";
22
+ import { SelectProvider, useSelectContext } from "./context";
23
+ const SelectInlineImpl = (props) => {
24
+ const {
25
+ __scopeSelect,
26
+ children,
27
+ open = false,
28
+ selectedIndexRef,
29
+ listContentRef
30
+ } = props;
31
+ const selectContext = useSelectContext("SelectSheetImpl", __scopeSelect);
32
+ const {
33
+ setActiveIndex,
34
+ setOpen,
35
+ setSelectedIndex,
36
+ selectedIndex,
37
+ activeIndex,
38
+ forceUpdate
39
+ } = selectContext;
40
+ const [scrollTop, setScrollTop] = React.useState(0);
41
+ const touch = useIsTouchDevice();
42
+ const listItemsRef = React.useRef([]);
43
+ const overflowRef = React.useRef(null);
44
+ const upArrowRef = React.useRef(null);
45
+ const downArrowRef = React.useRef(null);
46
+ const allowSelectRef = React.useRef(false);
47
+ const allowMouseUpRef = React.useRef(true);
48
+ const selectTimeoutRef = React.useRef();
49
+ const state = React.useRef({
50
+ isMouseOutside: false
51
+ });
52
+ const [controlledScrolling, setControlledScrolling] = React.useState(false);
53
+ const [fallback, setFallback] = React.useState(false);
54
+ const [innerOffset, setInnerOffset] = React.useState(0);
55
+ const [blockSelection, setBlockSelection] = React.useState(false);
56
+ const floatingStyle = React.useRef({});
57
+ React.useEffect(() => {
58
+ const frame = requestAnimationFrame(() => {
59
+ if (!open) {
60
+ setScrollTop(0);
61
+ setFallback(false);
62
+ setActiveIndex(null);
63
+ setControlledScrolling(false);
64
+ }
65
+ });
66
+ return () => {
67
+ cancelAnimationFrame(frame);
68
+ };
69
+ }, [open, setActiveIndex]);
70
+ if (isWeb) {
71
+ React.useEffect(() => {
72
+ if (!open)
73
+ return;
74
+ const mouseUp = (e) => {
75
+ if (state.current.isMouseOutside) {
76
+ setOpen(false);
77
+ }
78
+ };
79
+ document.addEventListener("mouseup", mouseUp);
80
+ return () => {
81
+ document.removeEventListener("mouseup", mouseUp);
82
+ };
83
+ }, [open]);
84
+ }
85
+ const updateFloatingSize = size({
86
+ apply({
87
+ availableHeight,
88
+ rects: {
89
+ reference: { width }
90
+ }
91
+ }) {
92
+ floatingStyle.current = {
93
+ width,
94
+ maxHeight: availableHeight
95
+ };
96
+ },
97
+ padding: WINDOW_PADDING
98
+ });
99
+ const { x, y, reference, floating, strategy, context, refs } = useFloating({
100
+ open,
101
+ onOpenChange: setOpen,
102
+ whileElementsMounted: autoUpdate,
103
+ placement: "bottom-start",
104
+ middleware: fallback ? [
105
+ offset(5),
106
+ ...[
107
+ touch ? shift({ crossAxis: true, padding: WINDOW_PADDING }) : flip({ padding: WINDOW_PADDING })
108
+ ],
109
+ updateFloatingSize
110
+ ] : [
111
+ inner({
112
+ listRef: listItemsRef,
113
+ overflowRef,
114
+ index: selectedIndex,
115
+ offset: innerOffset,
116
+ onFallbackChange: setFallback,
117
+ padding: 10,
118
+ minItemsVisible: touch ? 10 : 4,
119
+ referenceOverflowThreshold: 20
120
+ }),
121
+ updateFloatingSize
122
+ ]
123
+ });
124
+ const floatingRef = refs.floating;
125
+ const showUpArrow = open && scrollTop > SCROLL_ARROW_THRESHOLD;
126
+ const showDownArrow = open && floatingRef.current && scrollTop < floatingRef.current.scrollHeight - floatingRef.current.clientHeight - SCROLL_ARROW_THRESHOLD;
127
+ const interactions = useInteractions([
128
+ useClick(context, { event: "mousedown" }),
129
+ useDismiss(context, { outsidePress: false }),
130
+ useRole(context, { role: "listbox" }),
131
+ useInnerOffset(context, {
132
+ enabled: !fallback,
133
+ onChange: setInnerOffset,
134
+ overflowRef
135
+ }),
136
+ useListNavigation(context, {
137
+ listRef: listItemsRef,
138
+ activeIndex,
139
+ selectedIndex,
140
+ onNavigate: setActiveIndex
141
+ }),
142
+ useTypeahead(context, {
143
+ listRef: listContentRef,
144
+ onMatch: open ? setActiveIndex : setSelectedIndex,
145
+ selectedIndex,
146
+ activeIndex
147
+ })
148
+ ]);
149
+ const interactionsContext = {
150
+ ...interactions,
151
+ getReferenceProps() {
152
+ return interactions.getReferenceProps({
153
+ ref: reference,
154
+ className: "SelectTrigger",
155
+ onKeyDown(event) {
156
+ if (event.key === "Enter" || event.key === " " && !context.dataRef.current.typing) {
157
+ event.preventDefault();
158
+ setOpen(true);
159
+ }
160
+ }
161
+ });
162
+ },
163
+ getFloatingProps(props2) {
164
+ return interactions.getFloatingProps({
165
+ ref: floating,
166
+ className: "Select",
167
+ ...props2,
168
+ style: {
169
+ position: strategy,
170
+ top: y ?? "",
171
+ left: x ?? "",
172
+ outline: 0,
173
+ listStyleType: "none",
174
+ scrollbarWidth: "none",
175
+ ...floatingStyle.current,
176
+ ...props2 == null ? void 0 : props2.style
177
+ },
178
+ onPointerEnter() {
179
+ setControlledScrolling(false);
180
+ state.current.isMouseOutside = false;
181
+ },
182
+ onPointerLeave() {
183
+ state.current.isMouseOutside = true;
184
+ },
185
+ onPointerMove() {
186
+ state.current.isMouseOutside = false;
187
+ setControlledScrolling(false);
188
+ },
189
+ onKeyDown() {
190
+ setControlledScrolling(true);
191
+ },
192
+ onContextMenu(e) {
193
+ e.preventDefault();
194
+ },
195
+ onScroll(event) {
196
+ flushSync(() => setScrollTop(event.currentTarget.scrollTop));
197
+ }
198
+ });
199
+ }
200
+ };
201
+ useIsomorphicLayoutEffect(() => {
202
+ if (open) {
203
+ selectTimeoutRef.current = setTimeout(() => {
204
+ allowSelectRef.current = true;
205
+ }, 300);
206
+ return () => {
207
+ clearTimeout(selectTimeoutRef.current);
208
+ };
209
+ } else {
210
+ allowSelectRef.current = false;
211
+ allowMouseUpRef.current = true;
212
+ setInnerOffset(0);
213
+ setFallback(false);
214
+ setBlockSelection(false);
215
+ }
216
+ }, [open]);
217
+ useIsomorphicLayoutEffect(() => {
218
+ function onPointerDown(e) {
219
+ var _a, _b, _c;
220
+ const target = e.target;
221
+ 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)))) {
222
+ setOpen(false);
223
+ setControlledScrolling(false);
224
+ }
225
+ }
226
+ if (open) {
227
+ document.addEventListener("pointerdown", onPointerDown);
228
+ return () => {
229
+ document.removeEventListener("pointerdown", onPointerDown);
230
+ };
231
+ }
232
+ }, [open, refs, setOpen]);
233
+ useIsomorphicLayoutEffect(() => {
234
+ var _a, _b;
235
+ if (open && controlledScrolling) {
236
+ if (activeIndex != null) {
237
+ (_a = listItemsRef.current[activeIndex]) == null ? void 0 : _a.scrollIntoView({ block: "nearest" });
238
+ }
239
+ }
240
+ setScrollTop(((_b = refs.floating.current) == null ? void 0 : _b.scrollTop) ?? 0);
241
+ }, [open, refs, controlledScrolling, activeIndex]);
242
+ useIsomorphicLayoutEffect(() => {
243
+ var _a;
244
+ if (open && fallback) {
245
+ if (selectedIndex != null) {
246
+ (_a = listItemsRef.current[selectedIndex]) == null ? void 0 : _a.scrollIntoView({ block: "nearest" });
247
+ }
248
+ }
249
+ }, [open, fallback, selectedIndex]);
250
+ useIsomorphicLayoutEffect(() => {
251
+ if (refs.floating.current && fallback) {
252
+ refs.floating.current.style.maxHeight = "";
253
+ }
254
+ }, [refs, fallback]);
255
+ return /* @__PURE__ */ jsx(SelectProvider, {
256
+ scope: __scopeSelect,
257
+ ...selectContext,
258
+ setScrollTop,
259
+ setInnerOffset,
260
+ floatingRef,
261
+ setValueAtIndex: (index, value) => {
262
+ listContentRef.current[index] = value;
263
+ },
264
+ fallback,
265
+ interactions: interactionsContext,
266
+ floatingContext: context,
267
+ activeIndex,
268
+ canScrollDown: !!showDownArrow,
269
+ canScrollUp: !!showUpArrow,
270
+ controlledScrolling: true,
271
+ dataRef: context.dataRef,
272
+ listRef: listItemsRef,
273
+ blockSelection,
274
+ allowMouseUpRef,
275
+ upArrowRef,
276
+ downArrowRef,
277
+ selectTimeoutRef,
278
+ allowSelectRef,
279
+ children
280
+ });
281
+ };
282
+ const userAgent = typeof navigator !== "undefined" && navigator.userAgent || "";
283
+ export {
284
+ SelectInlineImpl
285
+ };
286
+ //# 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": "AAyTI;AAzTJ;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,OAAO,kBAAkB,iCAAiC;AACnE,YAAY,WAAW;AACvB,SAAS,iBAAiB;AAE1B,SAAS,wBAAwB,sBAAsB;AACvD,SAAS,gBAAgB,wBAAwB;AAI1C,MAAM,mBAAmB,CAAC,UAA2B;AAC1D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,gBAAgB,iBAAiB,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,QAAQ,iBAAiB;AAE/B,QAAM,eAAe,MAAM,OAAkC,CAAC,CAAC;AAC/D,QAAM,cAAc,MAAM,OAA0B,IA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,WAAW,UAAU;AACrC,WAAK,SAAS,QAAQ,MAAM,YAAY;AAAA,IAC1C;AAAA,EACF,GAAG,CAAC,MAAM,QAAQ,CAAC;AAOnB,SACE,oBAAC;AAAA,IACC,OAAO;AAAA,IACN,GAAI;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,13 @@
1
+ import { Fragment, jsx } from "react/jsx-runtime";
2
+ const SelectInlineImpl = (props) => {
3
+ if (process.env.NODE_ENV === "development") {
4
+ console.warn("Sheet not implemented inline on native");
5
+ }
6
+ return /* @__PURE__ */ jsx(Fragment, {
7
+ children: props.children
8
+ });
9
+ };
10
+ export {
11
+ SelectInlineImpl
12
+ };
13
+ //# 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": "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
+ }
@@ -0,0 +1,130 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { autoUpdate, offset, useFloating } from "@floating-ui/react-dom-interactions";
3
+ import { useComposedRefs } from "@tamagui/compose-refs";
4
+ import { useIsomorphicLayoutEffect } from "@tamagui/core";
5
+ import { YStack } from "@tamagui/stacks";
6
+ import * as React from "react";
7
+ import { flushSync } from "react-dom";
8
+ import { useSelectContext } from "./context";
9
+ const SCROLL_UP_BUTTON_NAME = "SelectScrollUpButton";
10
+ const SelectScrollUpButton = React.forwardRef((props, forwardedRef) => {
11
+ return /* @__PURE__ */ jsx(SelectScrollButtonImpl, {
12
+ componentName: SCROLL_UP_BUTTON_NAME,
13
+ ...props,
14
+ dir: "up",
15
+ ref: forwardedRef
16
+ });
17
+ });
18
+ SelectScrollUpButton.displayName = SCROLL_UP_BUTTON_NAME;
19
+ const SCROLL_DOWN_BUTTON_NAME = "SelectScrollDownButton";
20
+ const SelectScrollDownButton = React.forwardRef((props, forwardedRef) => {
21
+ return /* @__PURE__ */ jsx(SelectScrollButtonImpl, {
22
+ componentName: SCROLL_DOWN_BUTTON_NAME,
23
+ ...props,
24
+ dir: "down",
25
+ ref: forwardedRef
26
+ });
27
+ });
28
+ SelectScrollDownButton.displayName = SCROLL_DOWN_BUTTON_NAME;
29
+ const SelectScrollButtonImpl = React.memo(
30
+ React.forwardRef(
31
+ (props, forwardedRef) => {
32
+ var _a;
33
+ const { __scopeSelect, dir, componentName, ...scrollIndicatorProps } = props;
34
+ const {
35
+ floatingRef,
36
+ forceUpdate,
37
+ open,
38
+ fallback,
39
+ setScrollTop,
40
+ setInnerOffset,
41
+ ...context
42
+ } = useSelectContext(componentName, __scopeSelect);
43
+ const [element, setElement] = React.useState(null);
44
+ const statusRef = React.useRef("idle");
45
+ const isVisible = context[dir === "down" ? "canScrollDown" : "canScrollUp"];
46
+ const frameRef = React.useRef();
47
+ const { x, y, reference, floating, strategy, update, refs } = useFloating({
48
+ strategy: "fixed",
49
+ placement: dir === "up" ? "top" : "bottom",
50
+ middleware: [offset(({ rects }) => -rects.floating.height)],
51
+ whileElementsMounted: (...args) => autoUpdate(...args, { animationFrame: true })
52
+ });
53
+ const composedRef = useComposedRefs(forwardedRef, floating);
54
+ if (floatingRef) {
55
+ if (open) {
56
+ if (element !== floatingRef.current) {
57
+ setElement(floatingRef.current);
58
+ reference(floatingRef.current);
59
+ requestAnimationFrame(update);
60
+ }
61
+ } else {
62
+ cancelAnimationFrame(frameRef.current);
63
+ }
64
+ }
65
+ useIsomorphicLayoutEffect(() => {
66
+ return () => {
67
+ cancelAnimationFrame(frameRef.current);
68
+ };
69
+ }, []);
70
+ if (!(isVisible && floatingRef)) {
71
+ return null;
72
+ }
73
+ const onScroll = (amount) => {
74
+ if (fallback) {
75
+ if (refs.floating.current) {
76
+ refs.floating.current.scrollTop -= amount;
77
+ flushSync(() => {
78
+ var _a2;
79
+ return setScrollTop(((_a2 = refs.floating.current) == null ? void 0 : _a2.scrollTop) ?? 0);
80
+ });
81
+ }
82
+ } else {
83
+ flushSync(() => setInnerOffset((value) => value - amount));
84
+ }
85
+ };
86
+ return /* @__PURE__ */ jsx(YStack, {
87
+ ref: composedRef,
88
+ componentName,
89
+ "aria-hidden": true,
90
+ ...scrollIndicatorProps,
91
+ zIndex: 1e3,
92
+ position: strategy,
93
+ left: x || 0,
94
+ top: y || 0,
95
+ width: `calc(${(((_a = floatingRef == null ? void 0 : floatingRef.current) == null ? void 0 : _a.offsetWidth) ?? 0) - 2}px)`,
96
+ onPointerEnter: () => {
97
+ statusRef.current = "active";
98
+ let prevNow = Date.now();
99
+ function frame() {
100
+ if (element) {
101
+ const currentNow = Date.now();
102
+ const msElapsed = currentNow - prevNow;
103
+ prevNow = currentNow;
104
+ const pixelsToScroll = msElapsed / 2;
105
+ const remainingPixels = dir === "up" ? element.scrollTop : element.scrollHeight - element.clientHeight - element.scrollTop;
106
+ const scrollRemaining = dir === "up" ? element.scrollTop - pixelsToScroll > 0 : element.scrollTop + pixelsToScroll < element.scrollHeight - element.clientHeight;
107
+ onScroll(
108
+ dir === "up" ? Math.min(pixelsToScroll, remainingPixels) : Math.max(-pixelsToScroll, -remainingPixels)
109
+ );
110
+ if (scrollRemaining) {
111
+ frameRef.current = requestAnimationFrame(frame);
112
+ }
113
+ }
114
+ }
115
+ cancelAnimationFrame(frameRef.current);
116
+ frameRef.current = requestAnimationFrame(frame);
117
+ },
118
+ onPointerLeave: () => {
119
+ statusRef.current = "idle";
120
+ cancelAnimationFrame(frameRef.current);
121
+ }
122
+ });
123
+ }
124
+ )
125
+ );
126
+ export {
127
+ SelectScrollDownButton,
128
+ SelectScrollUpButton
129
+ };
130
+ //# sourceMappingURL=SelectScrollButton.js.map