@yahoo/uds-mobile 2.11.0 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/fixtures/dist/index.mjs +0 -10
- package/dist/bin/modes/dist/index.mjs +1 -0
- package/dist/bin/palette/dist/index.mjs +1 -0
- package/dist/components/AndroidBackHandler.js.map +1 -1
- package/dist/components/Avatar.js.map +1 -1
- package/dist/components/Badge.js.map +1 -1
- package/dist/components/Banner/Banner.js.map +1 -1
- package/dist/components/Banner/BannerContent.js.map +1 -1
- package/dist/components/Banner/BannerDescription.js.map +1 -1
- package/dist/components/Banner/BannerTitle.js.map +1 -1
- package/dist/components/Banner/utils.js.map +1 -1
- package/dist/components/BlurTarget.js.map +1 -1
- package/dist/components/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/components/BottomSheet/BottomSheetContent.js.map +1 -1
- package/dist/components/BottomSheet/BottomSheetDismiss.js.map +1 -1
- package/dist/components/BottomSheet/BottomSheetHandle.js.map +1 -1
- package/dist/components/BottomSheet/BottomSheetHeader.js.map +1 -1
- package/dist/components/BottomSheet/BottomSheetInternalProvider.js.map +1 -1
- package/dist/components/BottomSheet/BottomSheetProvider.js.map +1 -1
- package/dist/components/BottomSheet/BottomSheetTrigger.js.map +1 -1
- package/dist/components/BottomSheet/useBottomSheetDrag.js.map +1 -1
- package/dist/components/BottomSheet/useBottomSheetScroll.js.map +1 -1
- package/dist/components/BottomSheet/useBottomSheetSnapModel.js.map +1 -1
- package/dist/components/BottomSheet/useBottomSheetStore.js.map +1 -1
- package/dist/components/BottomSheet/useExpansionMargins.js.map +1 -1
- package/dist/components/BottomSheet/useKeyboardAvoidance.js.map +1 -1
- package/dist/components/BottomSheet/utils.js.map +1 -1
- package/dist/components/Box.js.map +1 -1
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Checkbox.js.map +1 -1
- package/dist/components/Chip.js.map +1 -1
- package/dist/components/Divider/Divider.js.map +1 -1
- package/dist/components/Divider/DividerLabel.js.map +1 -1
- package/dist/components/Divider/DividerLine.js.map +1 -1
- package/dist/components/Divider/utils.js.map +1 -1
- package/dist/components/HStack.js.map +1 -1
- package/dist/components/Icon.js.map +1 -1
- package/dist/components/IconButton.js.map +1 -1
- package/dist/components/IconSlot.js.map +1 -1
- package/dist/components/Image.js.map +1 -1
- package/dist/components/Input.js.map +1 -1
- package/dist/components/Link.js.map +1 -1
- package/dist/components/Pressable.js.map +1 -1
- package/dist/components/Radio.js.map +1 -1
- package/dist/components/Screen.js.map +1 -1
- package/dist/components/Scrim.js.map +1 -1
- package/dist/components/Switch.js.map +1 -1
- package/dist/components/Tabs/Tab.js.map +1 -1
- package/dist/components/Tabs/TabList.js.map +1 -1
- package/dist/components/Tabs/TabPanel.js.map +1 -1
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Tabs/tabTheme.js.map +1 -1
- package/dist/components/Tabs/tabsContexts.js.map +1 -1
- package/dist/components/Text.js.map +1 -1
- package/dist/components/UDSProvider.js.map +1 -1
- package/dist/components/VStack.js.map +1 -1
- package/dist/jest/mocks/icons.js.map +1 -1
- package/dist/jest/mocks/react-native.js.map +1 -1
- package/dist/jest/mocks/reanimated.js.map +1 -1
- package/dist/jest/mocks/styles.js.map +1 -1
- package/dist/jest/mocks/svg.js.map +1 -1
- package/dist/jest/mocks/unistyles.js.map +1 -1
- package/dist/jest/setup.js.map +1 -1
- package/dist/portal.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabTheme.js","names":[],"sources":["../../../src/components/Tabs/tabTheme.ts"],"sourcesContent":["import type { UniversalTabsVariant } from '@yahoo/uds-types';\nimport type { TextStyle, ViewStyle } from 'react-native';\n\ntype TabActiveState = 'on' | 'off';\ntype TabLayer = 'root' | 'rootText' | 'icon';\ntype InteractionState = 'rest' | 'pressed';\n\nfunction tabComponentPath(\n visual: UniversalTabsVariant,\n active: TabActiveState,\n layer: TabLayer,\n state: InteractionState,\n): string {\n const layerKey = layer === 'rootText' ? 'rootText' : layer;\n return `tab/variant/${visual}/active/${active}/${layerKey}/${state}`;\n}\n\n/** Default tab dimensions / spacing from tokens (`tab/size/default/...`). */\nexport function getTabSizeLayerStyle(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n theme: { components: Record<string, any> },\n layer: 'root' | 'rootText' | 'icon',\n): ViewStyle | TextStyle {\n const path = `tab/size/default/${layer}/rest`;\n const s = theme.components[path];\n return s && typeof s === 'object' ? s : {};\n}\n\n/** Variant + interaction layer (active on/off, pressed/rest). */\nexport function getTabLayerStyle(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n theme: { components: Record<string, any> },\n visual: UniversalTabsVariant,\n active: TabActiveState,\n layer: TabLayer,\n state: InteractionState,\n): ViewStyle | TextStyle {\n const path = tabComponentPath(visual, active, layer, state);\n const s = theme.components[path];\n return s && typeof s === 'object' ? s : {};\n}\n\n/** Size tokens + variant state (matches web stacking size + variant classes). */\nexport function getMergedTabLayerStyle(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n theme: { components: Record<string, any> },\n visual: UniversalTabsVariant,\n active: TabActiveState,\n layer: TabLayer,\n state: InteractionState,\n): ViewStyle | TextStyle {\n const sizeKey = layer === 'rootText' ? 'rootText' : layer === 'icon' ? 'icon' : 'root';\n return {\n ...(getTabSizeLayerStyle(theme, sizeKey) as object),\n ...(getTabLayerStyle(theme, visual, active, layer, state) as object),\n } as ViewStyle;\n}\n"],"mappings":";;AAOA,SAAS,iBACP,QACA,QACA,OACA,OACQ;
|
|
1
|
+
{"version":3,"file":"tabTheme.js","names":[],"sources":["../../../src/components/Tabs/tabTheme.ts"],"sourcesContent":["import type { UniversalTabsVariant } from '@yahoo/uds-types';\nimport type { TextStyle, ViewStyle } from 'react-native';\n\ntype TabActiveState = 'on' | 'off';\ntype TabLayer = 'root' | 'rootText' | 'icon';\ntype InteractionState = 'rest' | 'pressed';\n\nfunction tabComponentPath(\n visual: UniversalTabsVariant,\n active: TabActiveState,\n layer: TabLayer,\n state: InteractionState,\n): string {\n const layerKey = layer === 'rootText' ? 'rootText' : layer;\n return `tab/variant/${visual}/active/${active}/${layerKey}/${state}`;\n}\n\n/** Default tab dimensions / spacing from tokens (`tab/size/default/...`). */\nexport function getTabSizeLayerStyle(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n theme: { components: Record<string, any> },\n layer: 'root' | 'rootText' | 'icon',\n): ViewStyle | TextStyle {\n const path = `tab/size/default/${layer}/rest`;\n const s = theme.components[path];\n return s && typeof s === 'object' ? s : {};\n}\n\n/** Variant + interaction layer (active on/off, pressed/rest). */\nexport function getTabLayerStyle(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n theme: { components: Record<string, any> },\n visual: UniversalTabsVariant,\n active: TabActiveState,\n layer: TabLayer,\n state: InteractionState,\n): ViewStyle | TextStyle {\n const path = tabComponentPath(visual, active, layer, state);\n const s = theme.components[path];\n return s && typeof s === 'object' ? s : {};\n}\n\n/** Size tokens + variant state (matches web stacking size + variant classes). */\nexport function getMergedTabLayerStyle(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n theme: { components: Record<string, any> },\n visual: UniversalTabsVariant,\n active: TabActiveState,\n layer: TabLayer,\n state: InteractionState,\n): ViewStyle | TextStyle {\n const sizeKey = layer === 'rootText' ? 'rootText' : layer === 'icon' ? 'icon' : 'root';\n return {\n ...(getTabSizeLayerStyle(theme, sizeKey) as object),\n ...(getTabLayerStyle(theme, visual, active, layer, state) as object),\n } as ViewStyle;\n}\n"],"mappings":";;AAOA,SAAS,iBACP,QACA,QACA,OACA,OACQ;CAER,OAAO,eAAe,OAAO,UAAU,OAAO,GAD7B,UAAU,aAAa,aAAa,MACK,GAAG;;;AAI/D,SAAgB,qBAEd,OACA,OACuB;CACvB,MAAM,OAAO,oBAAoB,MAAM;CACvC,MAAM,IAAI,MAAM,WAAW;CAC3B,OAAO,KAAK,OAAO,MAAM,WAAW,IAAI,EAAE;;;AAI5C,SAAgB,iBAEd,OACA,QACA,QACA,OACA,OACuB;CACvB,MAAM,OAAO,iBAAiB,QAAQ,QAAQ,OAAO,MAAM;CAC3D,MAAM,IAAI,MAAM,WAAW;CAC3B,OAAO,KAAK,OAAO,MAAM,WAAW,IAAI,EAAE;;;AAI5C,SAAgB,uBAEd,OACA,QACA,QACA,OACA,OACuB;CAEvB,OAAO;EACL,GAAI,qBAAqB,OAFX,UAAU,aAAa,aAAa,UAAU,SAAS,SAAS,OAEtC;EACxC,GAAI,iBAAiB,OAAO,QAAQ,QAAQ,OAAO,MAAM;EAC1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabsContexts.js","names":[],"sources":["../../../src/components/Tabs/tabsContexts.tsx"],"sourcesContent":["import type { UniversalTabsVariant } from '@yahoo/uds-types';\nimport { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';\nimport type { LayoutRectangle } from 'react-native';\n\nexport interface TabsVisualContextValue {\n variant: UniversalTabsVariant;\n reduceMotion: boolean;\n}\n\nexport const TabsVisualContext = createContext<TabsVisualContextValue>({\n variant: 'primary',\n reduceMotion: false,\n});\n\nexport function useTabsVisualContext(): TabsVisualContextValue {\n return useContext(TabsVisualContext);\n}\n\nexport interface TabSelectionContextValue {\n selectedId: string | null | undefined;\n setSelectedId: (id: string) => void;\n registerTab: (id: string) => void;\n unregisterTab: (id: string) => void;\n tabLayouts: ReadonlyMap<string, LayoutRectangle>;\n setTabLayout: (id: string, layout: LayoutRectangle) => void;\n clearTabLayout: (id: string) => void;\n}\n\nexport const TabSelectionContext = createContext<TabSelectionContextValue | null>(null);\n\nexport function useTabSelectionContext(): TabSelectionContextValue {\n const ctx = useContext(TabSelectionContext);\n if (!ctx) {\n throw new Error('Tab components must be used within <Tabs>');\n }\n return ctx;\n}\n\nexport function useTabSelectionState({\n defaultSelectedId,\n selectedId: selectedIdProp,\n onSelectionChange,\n}: {\n defaultSelectedId?: string;\n selectedId?: string | null;\n onSelectionChange?: (selectedId: string | null | undefined) => void;\n}): TabSelectionContextValue {\n const isControlled = selectedIdProp !== undefined;\n const [internalSelectedId, setInternalSelectedId] = useState<string | null>(\n defaultSelectedId ?? null,\n );\n const [registeredIds, setRegisteredIds] = useState<string[]>([]);\n const [tabLayouts, setTabLayouts] = useState<Map<string, LayoutRectangle>>(() => new Map());\n\n const selectedId = isControlled ? selectedIdProp : internalSelectedId;\n\n const setSelectedId = useCallback(\n (id: string) => {\n if (!isControlled) {\n setInternalSelectedId(id);\n }\n onSelectionChange?.(id);\n },\n [isControlled, onSelectionChange],\n );\n\n const registerTab = useCallback((id: string) => {\n setRegisteredIds((prev) => (prev.includes(id) ? prev : [...prev, id]));\n }, []);\n\n const unregisterTab = useCallback((id: string) => {\n setRegisteredIds((prev) => prev.filter((x) => x !== id));\n setTabLayouts((prev) => {\n const next = new Map(prev);\n next.delete(id);\n return next;\n });\n }, []);\n\n const setTabLayout = useCallback((id: string, layout: LayoutRectangle) => {\n setTabLayouts((prev) => {\n const cur = prev.get(id);\n if (\n cur &&\n cur.x === layout.x &&\n cur.y === layout.y &&\n cur.width === layout.width &&\n cur.height === layout.height\n ) {\n return prev;\n }\n const next = new Map(prev);\n next.set(id, layout);\n return next;\n });\n }, []);\n\n const clearTabLayout = useCallback((id: string) => {\n setTabLayouts((prev) => {\n if (!prev.has(id)) {\n return prev;\n }\n const next = new Map(prev);\n next.delete(id);\n return next;\n });\n }, []);\n\n useEffect(() => {\n if (isControlled || defaultSelectedId !== undefined) {\n return;\n }\n if (internalSelectedId !== null) {\n return;\n }\n if (registeredIds.length === 0) {\n return;\n }\n setInternalSelectedId(registeredIds[0]!);\n }, [isControlled, defaultSelectedId, internalSelectedId, registeredIds]);\n\n return useMemo(\n () => ({\n selectedId,\n setSelectedId,\n registerTab,\n unregisterTab,\n tabLayouts,\n setTabLayout,\n clearTabLayout,\n }),\n [\n selectedId,\n setSelectedId,\n registerTab,\n unregisterTab,\n tabLayouts,\n setTabLayout,\n clearTabLayout,\n ],\n );\n}\n"],"mappings":";;;AASA,MAAa,oBAAoB,cAAsC;CACrE,SAAS;CACT,cAAc;CACf,CAAC;AAEF,SAAgB,uBAA+C;
|
|
1
|
+
{"version":3,"file":"tabsContexts.js","names":[],"sources":["../../../src/components/Tabs/tabsContexts.tsx"],"sourcesContent":["import type { UniversalTabsVariant } from '@yahoo/uds-types';\nimport { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';\nimport type { LayoutRectangle } from 'react-native';\n\nexport interface TabsVisualContextValue {\n variant: UniversalTabsVariant;\n reduceMotion: boolean;\n}\n\nexport const TabsVisualContext = createContext<TabsVisualContextValue>({\n variant: 'primary',\n reduceMotion: false,\n});\n\nexport function useTabsVisualContext(): TabsVisualContextValue {\n return useContext(TabsVisualContext);\n}\n\nexport interface TabSelectionContextValue {\n selectedId: string | null | undefined;\n setSelectedId: (id: string) => void;\n registerTab: (id: string) => void;\n unregisterTab: (id: string) => void;\n tabLayouts: ReadonlyMap<string, LayoutRectangle>;\n setTabLayout: (id: string, layout: LayoutRectangle) => void;\n clearTabLayout: (id: string) => void;\n}\n\nexport const TabSelectionContext = createContext<TabSelectionContextValue | null>(null);\n\nexport function useTabSelectionContext(): TabSelectionContextValue {\n const ctx = useContext(TabSelectionContext);\n if (!ctx) {\n throw new Error('Tab components must be used within <Tabs>');\n }\n return ctx;\n}\n\nexport function useTabSelectionState({\n defaultSelectedId,\n selectedId: selectedIdProp,\n onSelectionChange,\n}: {\n defaultSelectedId?: string;\n selectedId?: string | null;\n onSelectionChange?: (selectedId: string | null | undefined) => void;\n}): TabSelectionContextValue {\n const isControlled = selectedIdProp !== undefined;\n const [internalSelectedId, setInternalSelectedId] = useState<string | null>(\n defaultSelectedId ?? null,\n );\n const [registeredIds, setRegisteredIds] = useState<string[]>([]);\n const [tabLayouts, setTabLayouts] = useState<Map<string, LayoutRectangle>>(() => new Map());\n\n const selectedId = isControlled ? selectedIdProp : internalSelectedId;\n\n const setSelectedId = useCallback(\n (id: string) => {\n if (!isControlled) {\n setInternalSelectedId(id);\n }\n onSelectionChange?.(id);\n },\n [isControlled, onSelectionChange],\n );\n\n const registerTab = useCallback((id: string) => {\n setRegisteredIds((prev) => (prev.includes(id) ? prev : [...prev, id]));\n }, []);\n\n const unregisterTab = useCallback((id: string) => {\n setRegisteredIds((prev) => prev.filter((x) => x !== id));\n setTabLayouts((prev) => {\n const next = new Map(prev);\n next.delete(id);\n return next;\n });\n }, []);\n\n const setTabLayout = useCallback((id: string, layout: LayoutRectangle) => {\n setTabLayouts((prev) => {\n const cur = prev.get(id);\n if (\n cur &&\n cur.x === layout.x &&\n cur.y === layout.y &&\n cur.width === layout.width &&\n cur.height === layout.height\n ) {\n return prev;\n }\n const next = new Map(prev);\n next.set(id, layout);\n return next;\n });\n }, []);\n\n const clearTabLayout = useCallback((id: string) => {\n setTabLayouts((prev) => {\n if (!prev.has(id)) {\n return prev;\n }\n const next = new Map(prev);\n next.delete(id);\n return next;\n });\n }, []);\n\n useEffect(() => {\n if (isControlled || defaultSelectedId !== undefined) {\n return;\n }\n if (internalSelectedId !== null) {\n return;\n }\n if (registeredIds.length === 0) {\n return;\n }\n setInternalSelectedId(registeredIds[0]!);\n }, [isControlled, defaultSelectedId, internalSelectedId, registeredIds]);\n\n return useMemo(\n () => ({\n selectedId,\n setSelectedId,\n registerTab,\n unregisterTab,\n tabLayouts,\n setTabLayout,\n clearTabLayout,\n }),\n [\n selectedId,\n setSelectedId,\n registerTab,\n unregisterTab,\n tabLayouts,\n setTabLayout,\n clearTabLayout,\n ],\n );\n}\n"],"mappings":";;;AASA,MAAa,oBAAoB,cAAsC;CACrE,SAAS;CACT,cAAc;CACf,CAAC;AAEF,SAAgB,uBAA+C;CAC7D,OAAO,WAAW,kBAAkB;;AAatC,MAAa,sBAAsB,cAA+C,KAAK;AAEvF,SAAgB,yBAAmD;CACjE,MAAM,MAAM,WAAW,oBAAoB;CAC3C,IAAI,CAAC,KACH,MAAM,IAAI,MAAM,4CAA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f,OAAO;IACP;IACD,EAAE,CAAC;CAEN,gBAAgB;EACd,IAAI,gBAAgB,sBAAsB,KAAA,GACxC;EAEF,IAAI,uBAAuB,MACzB;EAEF,IAAI,cAAc,WAAW,GAC3B;EAEF,sBAAsB,cAAc,GAAI;IACvC;EAAC;EAAc;EAAmB;EAAoB;EAAc,CAAC;CAExE,OAAO,eACE;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACD,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","names":["RNText"],"sources":["../../src/components/Text.tsx"],"sourcesContent":["import type { Ref } from 'react';\nimport { memo, useMemo } from 'react';\nimport type { StyleProp, TextProps as RNTextProps, TextStyle } from 'react-native';\nimport { Text as RNText } from 'react-native';\n\nimport type { StyleProps } from '../../generated/styles';\nimport { styles } from '../../generated/styles';\n\n// TextVariant is a subset of fontFamily that represents typography variants\ntype TextVariant = Exclude<\n StyleProps['fontFamily'],\n 'sans' | 'sans-alt' | 'serif' | 'serif-alt' | 'mono' | 'icons'\n>;\n\n// React Native text decoration line values\n// See: https://reactnative.dev/docs/text-style-props#textdecorationline\ntype TextDecorationLine = 'none' | 'underline' | 'line-through' | 'underline line-through';\n\ninterface TextProps extends RNTextProps {\n /** Ref to the underlying Text element */\n ref?: Ref<RNText>;\n /** Text color from the theme palette */\n color?: StyleProps['color'];\n /** Typography variant - sets fontSize, lineHeight, letterSpacing, and fontFamily together */\n variant?: TextVariant;\n /** Override the fontFamily independently */\n fontFamily?: StyleProps['fontFamily'];\n /** Override the fontSize independently */\n fontSize?: StyleProps['fontSize'];\n /** Set font weight (not derived from variant) */\n fontWeight?: StyleProps['fontWeight'];\n /** Override the lineHeight independently */\n lineHeight?: StyleProps['lineHeight'];\n /** Override the letterSpacing independently */\n letterSpacing?: StyleProps['letterSpacing'];\n /** Text alignment (left, center, right) */\n textAlign?: StyleProps['textAlign'];\n /** Set text transform (not derived from variant) */\n textTransform?: StyleProps['textTransform'];\n /** Text decoration (underline, line-through, etc.) */\n textDecorationLine?: TextDecorationLine;\n // Background\n backgroundColor?: StyleProps['backgroundColor'];\n // Border\n borderRadius?: StyleProps['borderRadius'];\n borderTopStartRadius?: StyleProps['borderTopStartRadius'];\n borderTopEndRadius?: StyleProps['borderTopEndRadius'];\n borderBottomStartRadius?: StyleProps['borderBottomStartRadius'];\n borderBottomEndRadius?: StyleProps['borderBottomEndRadius'];\n borderColor?: StyleProps['borderColor'];\n borderStartColor?: StyleProps['borderStartColor'];\n borderEndColor?: StyleProps['borderEndColor'];\n borderTopColor?: StyleProps['borderTopColor'];\n borderBottomColor?: StyleProps['borderBottomColor'];\n borderWidth?: StyleProps['borderWidth'];\n borderVerticalWidth?: StyleProps['borderVerticalWidth'];\n borderHorizontalWidth?: StyleProps['borderHorizontalWidth'];\n borderStartWidth?: StyleProps['borderStartWidth'];\n borderEndWidth?: StyleProps['borderEndWidth'];\n borderTopWidth?: StyleProps['borderTopWidth'];\n borderBottomWidth?: StyleProps['borderBottomWidth'];\n // Spacing\n spacing?: StyleProps['spacing'];\n spacingHorizontal?: StyleProps['spacingHorizontal'];\n spacingVertical?: StyleProps['spacingVertical'];\n spacingBottom?: StyleProps['spacingBottom'];\n spacingEnd?: StyleProps['spacingEnd'];\n spacingStart?: StyleProps['spacingStart'];\n spacingTop?: StyleProps['spacingTop'];\n // Offset\n offset?: StyleProps['offset'];\n offsetVertical?: StyleProps['offsetVertical'];\n offsetHorizontal?: StyleProps['offsetHorizontal'];\n offsetBottom?: StyleProps['offsetBottom'];\n offsetEnd?: StyleProps['offsetEnd'];\n offsetStart?: StyleProps['offsetStart'];\n offsetTop?: StyleProps['offsetTop'];\n // Flex\n flexShrink?: StyleProps['flexShrink'];\n // Vertical Alignment\n verticalAlign?: TextStyle['textAlignVertical'];\n // Size\n height?: number | `${number}%`;\n width?: number | `${number}%`;\n minHeight?: number | `${number}%`;\n maxHeight?: number | `${number}%`;\n minWidth?: number | `${number}%`;\n maxWidth?: number | `${number}%`;\n // Dangerously set props\n dangerouslySetColor?: string;\n}\n\n/**\n * **📝 A text component with UDS styling**\n *\n * @description\n * A styled text component that supports UDS typography variants and colors.\n *\n * @category Display\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Text } from '@yahoo/uds-mobile/Text';\n *\n * <Text variant=\"body1\" color=\"primary\">Hello, World!</Text>\n * <Text variant=\"display1\" fontWeight=\"bold\">Heading</Text>\n * <Text variant=\"label1\" color=\"secondary\">Caption text</Text>\n * ```\n *\n * @usage\n * - Use variant prop to set typography (display1, body1, label1, etc.)\n * - Use color prop to set text color from the palette\n * - Use fontWeight to override the variant's default weight\n *\n * @accessibility\n * - Text is readable by screen readers by default\n * - Use appropriate variant sizes for readability\n * - Ensure sufficient color contrast with background\n *\n * @see {@link Link} for interactive text links\n */\nconst Text = memo(function Text({\n // Text-specific\n color = 'primary',\n variant = 'body1',\n fontFamily = variant,\n fontSize = variant,\n fontWeight,\n lineHeight = variant,\n letterSpacing = variant,\n textAlign,\n textTransform,\n textDecorationLine,\n style,\n // Background\n backgroundColor,\n // Border\n borderRadius,\n borderTopStartRadius,\n borderTopEndRadius,\n borderBottomStartRadius,\n borderBottomEndRadius,\n borderColor,\n borderStartColor,\n borderEndColor,\n borderTopColor,\n borderBottomColor,\n borderWidth,\n borderVerticalWidth,\n borderHorizontalWidth,\n borderStartWidth,\n borderEndWidth,\n borderTopWidth,\n borderBottomWidth,\n // Spacing\n spacing,\n spacingHorizontal,\n spacingVertical,\n spacingBottom,\n spacingEnd,\n spacingStart,\n spacingTop,\n // Offset\n offset,\n offsetVertical,\n offsetHorizontal,\n offsetBottom,\n offsetEnd,\n offsetStart,\n offsetTop,\n // Flex\n flexShrink,\n // Vertical Alignment\n verticalAlign,\n // Size\n height,\n minHeight,\n maxHeight,\n width,\n minWidth,\n maxWidth,\n // Dangerously set props\n dangerouslySetColor,\n ref,\n // Rest\n ...props\n}: TextProps) {\n styles.useVariants({\n // Text styles\n color,\n fontFamily,\n fontSize,\n fontWeight,\n lineHeight,\n letterSpacing,\n textAlign,\n textTransform,\n // Background\n backgroundColor,\n // Border\n borderRadius,\n borderTopStartRadius,\n borderTopEndRadius,\n borderBottomStartRadius,\n borderBottomEndRadius,\n borderColor,\n borderStartColor,\n borderEndColor,\n borderTopColor,\n borderBottomColor,\n borderWidth,\n borderVerticalWidth,\n borderHorizontalWidth,\n borderStartWidth,\n borderEndWidth,\n borderTopWidth,\n borderBottomWidth,\n // Spacing\n spacing,\n spacingHorizontal,\n spacingVertical,\n spacingBottom,\n spacingEnd,\n spacingStart,\n spacingTop,\n // Offset\n offset,\n offsetVertical,\n offsetHorizontal,\n offsetBottom,\n offsetEnd,\n offsetStart,\n offsetTop,\n // Flex\n flexShrink,\n });\n\n // styles.foundation must be in deps - it returns a new reference when variants change.\n const computedStyle: StyleProp<TextStyle> = useMemo(\n () => [\n textDecorationLine ? { textDecorationLine } : undefined,\n dangerouslySetColor ? { color: dangerouslySetColor } : undefined,\n verticalAlign ? { textAlignVertical: verticalAlign } : undefined,\n height ? { height } : undefined,\n minHeight ? { minHeight } : undefined,\n maxHeight ? { maxHeight } : undefined,\n width ? { width } : undefined,\n minWidth ? { minWidth } : undefined,\n maxWidth ? { maxWidth } : undefined,\n styles.foundation,\n style,\n ],\n [\n textDecorationLine,\n dangerouslySetColor,\n verticalAlign,\n height,\n minHeight,\n maxHeight,\n width,\n minWidth,\n maxWidth,\n style,\n styles.foundation,\n ],\n );\n\n return <RNText ref={ref} style={computedStyle} {...props} />;\n});\n\nText.displayName = 'Text';\n\nexport { Text, type TextProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0HA,MAAM,OAAO,KAAK,SAAS,KAAK,EAE9B,QAAQ,WACR,UAAU,SACV,aAAa,SACb,WAAW,SACX,YACA,aAAa,SACb,gBAAgB,SAChB,WACA,eACA,oBACA,OAEA,iBAEA,cACA,sBACA,oBACA,yBACA,uBACA,aACA,kBACA,gBACA,gBACA,mBACA,aACA,qBACA,uBACA,kBACA,gBACA,gBACA,mBAEA,SACA,mBACA,iBACA,eACA,YACA,cACA,YAEA,QACA,gBACA,kBACA,cACA,WACA,aACA,WAEA,YAEA,eAEA,QACA,WACA,WACA,OACA,UACA,UAEA,qBACA,KAEA,GAAG,SACS;
|
|
1
|
+
{"version":3,"file":"Text.js","names":["RNText"],"sources":["../../src/components/Text.tsx"],"sourcesContent":["import type { Ref } from 'react';\nimport { memo, useMemo } from 'react';\nimport type { StyleProp, TextProps as RNTextProps, TextStyle } from 'react-native';\nimport { Text as RNText } from 'react-native';\n\nimport type { StyleProps } from '../../generated/styles';\nimport { styles } from '../../generated/styles';\n\n// TextVariant is a subset of fontFamily that represents typography variants\ntype TextVariant = Exclude<\n StyleProps['fontFamily'],\n 'sans' | 'sans-alt' | 'serif' | 'serif-alt' | 'mono' | 'icons'\n>;\n\n// React Native text decoration line values\n// See: https://reactnative.dev/docs/text-style-props#textdecorationline\ntype TextDecorationLine = 'none' | 'underline' | 'line-through' | 'underline line-through';\n\ninterface TextProps extends RNTextProps {\n /** Ref to the underlying Text element */\n ref?: Ref<RNText>;\n /** Text color from the theme palette */\n color?: StyleProps['color'];\n /** Typography variant - sets fontSize, lineHeight, letterSpacing, and fontFamily together */\n variant?: TextVariant;\n /** Override the fontFamily independently */\n fontFamily?: StyleProps['fontFamily'];\n /** Override the fontSize independently */\n fontSize?: StyleProps['fontSize'];\n /** Set font weight (not derived from variant) */\n fontWeight?: StyleProps['fontWeight'];\n /** Override the lineHeight independently */\n lineHeight?: StyleProps['lineHeight'];\n /** Override the letterSpacing independently */\n letterSpacing?: StyleProps['letterSpacing'];\n /** Text alignment (left, center, right) */\n textAlign?: StyleProps['textAlign'];\n /** Set text transform (not derived from variant) */\n textTransform?: StyleProps['textTransform'];\n /** Text decoration (underline, line-through, etc.) */\n textDecorationLine?: TextDecorationLine;\n // Background\n backgroundColor?: StyleProps['backgroundColor'];\n // Border\n borderRadius?: StyleProps['borderRadius'];\n borderTopStartRadius?: StyleProps['borderTopStartRadius'];\n borderTopEndRadius?: StyleProps['borderTopEndRadius'];\n borderBottomStartRadius?: StyleProps['borderBottomStartRadius'];\n borderBottomEndRadius?: StyleProps['borderBottomEndRadius'];\n borderColor?: StyleProps['borderColor'];\n borderStartColor?: StyleProps['borderStartColor'];\n borderEndColor?: StyleProps['borderEndColor'];\n borderTopColor?: StyleProps['borderTopColor'];\n borderBottomColor?: StyleProps['borderBottomColor'];\n borderWidth?: StyleProps['borderWidth'];\n borderVerticalWidth?: StyleProps['borderVerticalWidth'];\n borderHorizontalWidth?: StyleProps['borderHorizontalWidth'];\n borderStartWidth?: StyleProps['borderStartWidth'];\n borderEndWidth?: StyleProps['borderEndWidth'];\n borderTopWidth?: StyleProps['borderTopWidth'];\n borderBottomWidth?: StyleProps['borderBottomWidth'];\n // Spacing\n spacing?: StyleProps['spacing'];\n spacingHorizontal?: StyleProps['spacingHorizontal'];\n spacingVertical?: StyleProps['spacingVertical'];\n spacingBottom?: StyleProps['spacingBottom'];\n spacingEnd?: StyleProps['spacingEnd'];\n spacingStart?: StyleProps['spacingStart'];\n spacingTop?: StyleProps['spacingTop'];\n // Offset\n offset?: StyleProps['offset'];\n offsetVertical?: StyleProps['offsetVertical'];\n offsetHorizontal?: StyleProps['offsetHorizontal'];\n offsetBottom?: StyleProps['offsetBottom'];\n offsetEnd?: StyleProps['offsetEnd'];\n offsetStart?: StyleProps['offsetStart'];\n offsetTop?: StyleProps['offsetTop'];\n // Flex\n flexShrink?: StyleProps['flexShrink'];\n // Vertical Alignment\n verticalAlign?: TextStyle['textAlignVertical'];\n // Size\n height?: number | `${number}%`;\n width?: number | `${number}%`;\n minHeight?: number | `${number}%`;\n maxHeight?: number | `${number}%`;\n minWidth?: number | `${number}%`;\n maxWidth?: number | `${number}%`;\n // Dangerously set props\n dangerouslySetColor?: string;\n}\n\n/**\n * **📝 A text component with UDS styling**\n *\n * @description\n * A styled text component that supports UDS typography variants and colors.\n *\n * @category Display\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Text } from '@yahoo/uds-mobile/Text';\n *\n * <Text variant=\"body1\" color=\"primary\">Hello, World!</Text>\n * <Text variant=\"display1\" fontWeight=\"bold\">Heading</Text>\n * <Text variant=\"label1\" color=\"secondary\">Caption text</Text>\n * ```\n *\n * @usage\n * - Use variant prop to set typography (display1, body1, label1, etc.)\n * - Use color prop to set text color from the palette\n * - Use fontWeight to override the variant's default weight\n *\n * @accessibility\n * - Text is readable by screen readers by default\n * - Use appropriate variant sizes for readability\n * - Ensure sufficient color contrast with background\n *\n * @see {@link Link} for interactive text links\n */\nconst Text = memo(function Text({\n // Text-specific\n color = 'primary',\n variant = 'body1',\n fontFamily = variant,\n fontSize = variant,\n fontWeight,\n lineHeight = variant,\n letterSpacing = variant,\n textAlign,\n textTransform,\n textDecorationLine,\n style,\n // Background\n backgroundColor,\n // Border\n borderRadius,\n borderTopStartRadius,\n borderTopEndRadius,\n borderBottomStartRadius,\n borderBottomEndRadius,\n borderColor,\n borderStartColor,\n borderEndColor,\n borderTopColor,\n borderBottomColor,\n borderWidth,\n borderVerticalWidth,\n borderHorizontalWidth,\n borderStartWidth,\n borderEndWidth,\n borderTopWidth,\n borderBottomWidth,\n // Spacing\n spacing,\n spacingHorizontal,\n spacingVertical,\n spacingBottom,\n spacingEnd,\n spacingStart,\n spacingTop,\n // Offset\n offset,\n offsetVertical,\n offsetHorizontal,\n offsetBottom,\n offsetEnd,\n offsetStart,\n offsetTop,\n // Flex\n flexShrink,\n // Vertical Alignment\n verticalAlign,\n // Size\n height,\n minHeight,\n maxHeight,\n width,\n minWidth,\n maxWidth,\n // Dangerously set props\n dangerouslySetColor,\n ref,\n // Rest\n ...props\n}: TextProps) {\n styles.useVariants({\n // Text styles\n color,\n fontFamily,\n fontSize,\n fontWeight,\n lineHeight,\n letterSpacing,\n textAlign,\n textTransform,\n // Background\n backgroundColor,\n // Border\n borderRadius,\n borderTopStartRadius,\n borderTopEndRadius,\n borderBottomStartRadius,\n borderBottomEndRadius,\n borderColor,\n borderStartColor,\n borderEndColor,\n borderTopColor,\n borderBottomColor,\n borderWidth,\n borderVerticalWidth,\n borderHorizontalWidth,\n borderStartWidth,\n borderEndWidth,\n borderTopWidth,\n borderBottomWidth,\n // Spacing\n spacing,\n spacingHorizontal,\n spacingVertical,\n spacingBottom,\n spacingEnd,\n spacingStart,\n spacingTop,\n // Offset\n offset,\n offsetVertical,\n offsetHorizontal,\n offsetBottom,\n offsetEnd,\n offsetStart,\n offsetTop,\n // Flex\n flexShrink,\n });\n\n // styles.foundation must be in deps - it returns a new reference when variants change.\n const computedStyle: StyleProp<TextStyle> = useMemo(\n () => [\n textDecorationLine ? { textDecorationLine } : undefined,\n dangerouslySetColor ? { color: dangerouslySetColor } : undefined,\n verticalAlign ? { textAlignVertical: verticalAlign } : undefined,\n height ? { height } : undefined,\n minHeight ? { minHeight } : undefined,\n maxHeight ? { maxHeight } : undefined,\n width ? { width } : undefined,\n minWidth ? { minWidth } : undefined,\n maxWidth ? { maxWidth } : undefined,\n styles.foundation,\n style,\n ],\n [\n textDecorationLine,\n dangerouslySetColor,\n verticalAlign,\n height,\n minHeight,\n maxHeight,\n width,\n minWidth,\n maxWidth,\n style,\n styles.foundation,\n ],\n );\n\n return <RNText ref={ref} style={computedStyle} {...props} />;\n});\n\nText.displayName = 'Text';\n\nexport { Text, type TextProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0HA,MAAM,OAAO,KAAK,SAAS,KAAK,EAE9B,QAAQ,WACR,UAAU,SACV,aAAa,SACb,WAAW,SACX,YACA,aAAa,SACb,gBAAgB,SAChB,WACA,eACA,oBACA,OAEA,iBAEA,cACA,sBACA,oBACA,yBACA,uBACA,aACA,kBACA,gBACA,gBACA,mBACA,aACA,qBACA,uBACA,kBACA,gBACA,gBACA,mBAEA,SACA,mBACA,iBACA,eACA,YACA,cACA,YAEA,QACA,gBACA,kBACA,cACA,WACA,aACA,WAEA,YAEA,eAEA,QACA,WACA,WACA,OACA,UACA,UAEA,qBACA,KAEA,GAAG,SACS;CACZ,OAAO,YAAY;EAEjB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACD,CAAC;CAgCF,OAAO,oBAACA,QAAD;EAAa;EAAK,OA7BmB,cACpC;GACJ,qBAAqB,EAAE,oBAAoB,GAAG,KAAA;GAC9C,sBAAsB,EAAE,OAAO,qBAAqB,GAAG,KAAA;GACvD,gBAAgB,EAAE,mBAAmB,eAAe,GAAG,KAAA;GACvD,SAAS,EAAE,QAAQ,GAAG,KAAA;GACtB,YAAY,EAAE,WAAW,GAAG,KAAA;GAC5B,YAAY,EAAE,WAAW,GAAG,KAAA;GAC5B,QAAQ,EAAE,OAAO,GAAG,KAAA;GACpB,WAAW,EAAE,UAAU,GAAG,KAAA;GAC1B,WAAW,EAAE,UAAU,GAAG,KAAA;GAC1B,OAAO;GACP;GACD,EACD;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,OAAO;GACR,CAG0C;EAAE,GAAI;EAAS,CAAA;EAC5D;AAEF,KAAK,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UDSProvider.js","names":[],"sources":["../../src/components/UDSProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { memo } from 'react';\nimport { StyleSheet } from 'react-native';\nimport { GestureHandlerRootView } from 'react-native-gesture-handler';\n\nimport { PortalProvider } from '../portal';\n\ninterface UDSProviderProps {\n children: ReactNode;\n}\n\n/**\n * Root provider for UDS Mobile.\n *\n * Place this at the top of your app layout:\n *\n * @example\n * ```tsx\n * import { UDSProvider } from '@yahoo/uds-mobile/UDSProvider';\n *\n * export default function RootLayout() {\n * return (\n * <UDSProvider>\n * <Stack />\n * </UDSProvider>\n * );\n * }\n * ```\n */\nconst UDSProvider = memo(function UDSProvider({ children }: UDSProviderProps) {\n return (\n <GestureHandlerRootView style={styles.root}>\n <PortalProvider>{children}</PortalProvider>\n </GestureHandlerRootView>\n );\n});\n\nconst styles = StyleSheet.create({\n root: {\n flex: 1,\n },\n});\n\nexport { UDSProvider };\nexport type { UDSProviderProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,cAAc,KAAK,SAAS,YAAY,EAAE,YAA8B;
|
|
1
|
+
{"version":3,"file":"UDSProvider.js","names":[],"sources":["../../src/components/UDSProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { memo } from 'react';\nimport { StyleSheet } from 'react-native';\nimport { GestureHandlerRootView } from 'react-native-gesture-handler';\n\nimport { PortalProvider } from '../portal';\n\ninterface UDSProviderProps {\n children: ReactNode;\n}\n\n/**\n * Root provider for UDS Mobile.\n *\n * Place this at the top of your app layout:\n *\n * @example\n * ```tsx\n * import { UDSProvider } from '@yahoo/uds-mobile/UDSProvider';\n *\n * export default function RootLayout() {\n * return (\n * <UDSProvider>\n * <Stack />\n * </UDSProvider>\n * );\n * }\n * ```\n */\nconst UDSProvider = memo(function UDSProvider({ children }: UDSProviderProps) {\n return (\n <GestureHandlerRootView style={styles.root}>\n <PortalProvider>{children}</PortalProvider>\n </GestureHandlerRootView>\n );\n});\n\nconst styles = StyleSheet.create({\n root: {\n flex: 1,\n },\n});\n\nexport { UDSProvider };\nexport type { UDSProviderProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,cAAc,KAAK,SAAS,YAAY,EAAE,YAA8B;CAC5E,OACE,oBAAC,wBAAD;EAAwB,OAAO,OAAO;YACpC,oBAAC,gBAAD,EAAiB,UAA0B,CAAA;EACpB,CAAA;EAE3B;AAEF,MAAM,SAAS,WAAW,OAAO,EAC/B,MAAM,EACJ,MAAM,GACP,EACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VStack.js","names":[],"sources":["../../src/components/VStack.tsx"],"sourcesContent":["import type { Ref } from 'react';\nimport { memo } from 'react';\nimport type { View } from 'react-native';\n\nimport type { StyleProps } from '../../generated/styles';\nimport type { BoxProps } from './Box';\nimport { Box } from './Box';\n\ninterface VStackProps extends Omit<BoxProps, 'ref'> {\n /** Gap between child elements */\n gap?: StyleProps['rowGap'];\n /** Ref to the underlying View */\n ref?: Ref<View>;\n}\n\n/**\n * **📦 A vertical stack layout component**\n *\n * @description\n * A convenience component for creating vertical layouts. It's a Box with\n * `flexDirection=\"column\"` preset.\n *\n * @category Layout\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { VStack } from '@yahoo/uds-mobile/VStack';\n *\n * <VStack gap=\"4\" alignItems=\"stretch\">\n * <Text>Item 1</Text>\n * <Text>Item 2</Text>\n * </VStack>\n * ```\n *\n * @usage\n * - Use for vertical arrangements of elements\n * - Use gap prop for consistent spacing between children\n *\n * @see {@link HStack} for horizontal layouts\n * @see {@link Box} for custom flex layouts\n */\nconst VStack = memo(function VStack({ gap, children, ref, ...props }: VStackProps) {\n return (\n <Box ref={ref} flexDirection=\"column\" columnGap={gap} rowGap={gap} {...props}>\n {children}\n </Box>\n );\n});\n\nVStack.displayName = 'VStack';\n\nexport { VStack, type VStackProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAM,SAAS,KAAK,SAAS,OAAO,EAAE,KAAK,UAAU,KAAK,GAAG,SAAsB;
|
|
1
|
+
{"version":3,"file":"VStack.js","names":[],"sources":["../../src/components/VStack.tsx"],"sourcesContent":["import type { Ref } from 'react';\nimport { memo } from 'react';\nimport type { View } from 'react-native';\n\nimport type { StyleProps } from '../../generated/styles';\nimport type { BoxProps } from './Box';\nimport { Box } from './Box';\n\ninterface VStackProps extends Omit<BoxProps, 'ref'> {\n /** Gap between child elements */\n gap?: StyleProps['rowGap'];\n /** Ref to the underlying View */\n ref?: Ref<View>;\n}\n\n/**\n * **📦 A vertical stack layout component**\n *\n * @description\n * A convenience component for creating vertical layouts. It's a Box with\n * `flexDirection=\"column\"` preset.\n *\n * @category Layout\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { VStack } from '@yahoo/uds-mobile/VStack';\n *\n * <VStack gap=\"4\" alignItems=\"stretch\">\n * <Text>Item 1</Text>\n * <Text>Item 2</Text>\n * </VStack>\n * ```\n *\n * @usage\n * - Use for vertical arrangements of elements\n * - Use gap prop for consistent spacing between children\n *\n * @see {@link HStack} for horizontal layouts\n * @see {@link Box} for custom flex layouts\n */\nconst VStack = memo(function VStack({ gap, children, ref, ...props }: VStackProps) {\n return (\n <Box ref={ref} flexDirection=\"column\" columnGap={gap} rowGap={gap} {...props}>\n {children}\n </Box>\n );\n});\n\nVStack.displayName = 'VStack';\n\nexport { VStack, type VStackProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAM,SAAS,KAAK,SAAS,OAAO,EAAE,KAAK,UAAU,KAAK,GAAG,SAAsB;CACjF,OACE,oBAAC,KAAD;EAAU;EAAK,eAAc;EAAS,WAAW;EAAK,QAAQ;EAAK,GAAI;EACpE;EACG,CAAA;EAER;AAEF,OAAO,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.js","names":[],"sources":["../../../src/jest/mocks/icons.ts"],"sourcesContent":["/**\n * Jest mock for @yahoo/uds-icons.\n *\n * Provides proxy-based mocks for glyph and SVG maps\n * so any icon name returns a valid placeholder.\n */\n\n// Proxy that returns a placeholder glyph character for any icon name\nconst glyphMapProxy = new Proxy(\n {},\n {\n get: (_target, prop) => {\n // Return a placeholder glyph character\n // Using a simple character that works in Jest/JSDOM\n if (typeof prop === 'string') {\n return '\\uE000'; // Private use area character\n }\n return undefined;\n },\n has: () => true,\n ownKeys: () => [],\n },\n);\n\n// Proxy that returns placeholder SVG content for any icon name\nconst svgMapProxy = new Proxy(\n {},\n {\n get: (_target, prop) => {\n // Return minimal valid SVG for any key\n if (typeof prop === 'string') {\n return '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><rect width=\"24\" height=\"24\" fill=\"currentColor\"/></svg>';\n }\n return undefined;\n },\n has: () => true,\n ownKeys: () => [],\n },\n);\n\n// Icon size mapping (matches actual package)\nexport const ICON_SIZE_MAP = {\n xs: 12,\n sm: 16,\n md: 24,\n lg: 32,\n xl: 48,\n} as const;\n\n// Export glyph map and names\nexport const glyphMap = glyphMapProxy;\nexport const glyphNames: string[] = [];\n\n// Export SVG map and names\nexport const svgMap = svgMapProxy;\nexport const svgGlyphNames: string[] = [];\n"],"mappings":";;;;;;;;;;;;;;;;AAQA,MAAM,gBAAgB,IAAI,MACxB,EAAE,EACF;CACE,MAAM,SAAS,SAAS;
|
|
1
|
+
{"version":3,"file":"icons.js","names":[],"sources":["../../../src/jest/mocks/icons.ts"],"sourcesContent":["/**\n * Jest mock for @yahoo/uds-icons.\n *\n * Provides proxy-based mocks for glyph and SVG maps\n * so any icon name returns a valid placeholder.\n */\n\n// Proxy that returns a placeholder glyph character for any icon name\nconst glyphMapProxy = new Proxy(\n {},\n {\n get: (_target, prop) => {\n // Return a placeholder glyph character\n // Using a simple character that works in Jest/JSDOM\n if (typeof prop === 'string') {\n return '\\uE000'; // Private use area character\n }\n return undefined;\n },\n has: () => true,\n ownKeys: () => [],\n },\n);\n\n// Proxy that returns placeholder SVG content for any icon name\nconst svgMapProxy = new Proxy(\n {},\n {\n get: (_target, prop) => {\n // Return minimal valid SVG for any key\n if (typeof prop === 'string') {\n return '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><rect width=\"24\" height=\"24\" fill=\"currentColor\"/></svg>';\n }\n return undefined;\n },\n has: () => true,\n ownKeys: () => [],\n },\n);\n\n// Icon size mapping (matches actual package)\nexport const ICON_SIZE_MAP = {\n xs: 12,\n sm: 16,\n md: 24,\n lg: 32,\n xl: 48,\n} as const;\n\n// Export glyph map and names\nexport const glyphMap = glyphMapProxy;\nexport const glyphNames: string[] = [];\n\n// Export SVG map and names\nexport const svgMap = svgMapProxy;\nexport const svgGlyphNames: string[] = [];\n"],"mappings":";;;;;;;;;;;;;;;;AAQA,MAAM,gBAAgB,IAAI,MACxB,EAAE,EACF;CACE,MAAM,SAAS,SAAS;EAGtB,IAAI,OAAO,SAAS,UAClB,OAAO;;CAIX,WAAW;CACX,eAAe,EAAE;CAClB,CACF;AAGD,MAAM,cAAc,IAAI,MACtB,EAAE,EACF;CACE,MAAM,SAAS,SAAS;EAEtB,IAAI,OAAO,SAAS,UAClB,OAAO;;CAIX,WAAW;CACX,eAAe,EAAE;CAClB,CACF;AAGD,MAAa,gBAAgB;CAC3B,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACL;AAGD,MAAa,WAAW;AACxB,MAAa,aAAuB,EAAE;AAGtC,MAAa,SAAS;AACtB,MAAa,gBAA0B,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-native.js","names":[],"sources":["../../../src/jest/mocks/react-native.tsx"],"sourcesContent":["/**\n * Jest mock for react-native core components.\n *\n * Provides simple mock implementations for React Native components\n * that work in a Jest environment without native modules.\n */\n\n/// <reference types=\"jest\" />\n\nimport type { ReactNode } from 'react';\nimport React, { forwardRef } from 'react';\n\n// Set up React Native globals\ndeclare const global: { __DEV__?: boolean };\nglobal.__DEV__ = true;\n\ninterface MockComponentProps {\n children?: ReactNode;\n style?: object;\n testID?: string;\n accessibilityRole?: string;\n accessibilityLabel?: string;\n [key: string]: unknown;\n}\n\n// Create a simple mock component factory\nfunction createMockComponent(name: string) {\n const MockComponent = forwardRef<unknown, MockComponentProps>(({ children, ...props }, ref) => {\n return React.createElement(name, { ...props, ref }, children as ReactNode);\n });\n MockComponent.displayName = name;\n return MockComponent;\n}\n\n// Component mocks\nconst View = createMockComponent('View');\nconst Text = createMockComponent('Text');\nconst Image = createMockComponent('Image');\nconst ScrollView = createMockComponent('ScrollView');\nconst TextInput = createMockComponent('TextInput');\nconst TouchableOpacity = createMockComponent('TouchableOpacity');\nconst TouchableHighlight = createMockComponent('TouchableHighlight');\nconst TouchableWithoutFeedback = createMockComponent('TouchableWithoutFeedback');\nconst Pressable = createMockComponent('Pressable');\nconst FlatList = createMockComponent('FlatList');\nconst SectionList = createMockComponent('SectionList');\nconst ActivityIndicator = createMockComponent('ActivityIndicator');\nconst SafeAreaView = createMockComponent('SafeAreaView');\nconst Modal = createMockComponent('Modal');\nconst Switch = createMockComponent('Switch');\nconst RefreshControl = createMockComponent('RefreshControl');\nconst KeyboardAvoidingView = createMockComponent('KeyboardAvoidingView');\n\n// StyleSheet mock\nconst StyleSheet = {\n create: <T extends Record<string, object>>(styles: T): T => styles,\n flatten: (style: object | object[]): object => {\n if (Array.isArray(style)) {\n return Object.assign({}, ...style);\n }\n return style || {};\n },\n compose: (style1: object, style2: object): object[] => [style1, style2],\n hairlineWidth: 1,\n absoluteFill: { position: 'absolute', left: 0, right: 0, top: 0, bottom: 0 },\n absoluteFillObject: { position: 'absolute', left: 0, right: 0, top: 0, bottom: 0 },\n};\n\n// Platform mock\nconst Platform = {\n OS: 'ios' as const,\n Version: 17,\n select: <T extends Record<string, unknown>>(config: T): T[keyof T] | undefined => {\n return (config.ios ?? config.default) as T[keyof T] | undefined;\n },\n isTV: false,\n isPad: false,\n isVision: false,\n isTesting: true,\n constants: {\n reactNativeVersion: { major: 0, minor: 83, patch: 0 },\n },\n};\n\n// Dimensions mock\nconst SCREEN_WIDTH = 375;\nconst SCREEN_HEIGHT = 812;\n\nconst Dimensions = {\n get: (_dim: 'window' | 'screen') => ({\n width: SCREEN_WIDTH,\n height: SCREEN_HEIGHT,\n scale: 2,\n fontScale: 1,\n }),\n set: jest.fn(),\n addEventListener: jest.fn(() => ({ remove: jest.fn() })),\n removeEventListener: jest.fn(),\n};\n\n// PixelRatio mock\nconst PixelRatio = {\n get: () => 2,\n getFontScale: () => 1,\n getPixelSizeForLayoutSize: (size: number) => size * 2,\n roundToNearestPixel: (size: number) => Math.round(size * 2) / 2,\n};\n\n// Animated mock (basic - reanimated provides more complete implementation)\nconst Animated = {\n View: createMockComponent('Animated.View'),\n Text: createMockComponent('Animated.Text'),\n Image: createMockComponent('Animated.Image'),\n ScrollView: createMockComponent('Animated.ScrollView'),\n Value: class {\n _value: number;\n constructor(value: number) {\n this._value = value;\n }\n },\n timing: jest.fn(() => ({ start: jest.fn() })),\n spring: jest.fn(() => ({ start: jest.fn() })),\n createAnimatedComponent: (Component: React.ComponentType) => Component,\n};\n\n// Keyboard mock\nconst Keyboard = {\n dismiss: jest.fn(),\n addListener: jest.fn(() => ({ remove: jest.fn() })),\n removeListener: jest.fn(),\n isVisible: jest.fn(() => false),\n};\n\n// Linking mock\nconst Linking = {\n openURL: jest.fn().mockResolvedValue(true),\n canOpenURL: jest.fn().mockResolvedValue(true),\n getInitialURL: jest.fn().mockResolvedValue(null),\n addEventListener: jest.fn(() => ({ remove: jest.fn() })),\n};\n\n// AppState mock\nconst AppState = {\n currentState: 'active',\n addEventListener: jest.fn(() => ({ remove: jest.fn() })),\n removeEventListener: jest.fn(),\n};\n\n// AccessibilityInfo mock\nconst AccessibilityInfo = {\n isReduceMotionEnabled: jest.fn().mockResolvedValue(false),\n isScreenReaderEnabled: jest.fn().mockResolvedValue(false),\n addEventListener: jest.fn(() => ({ remove: jest.fn() })),\n};\n\n// NativeEventEmitter mock\nclass NativeEventEmitter {\n addListener = jest.fn(() => ({ remove: jest.fn() }));\n removeListener = jest.fn();\n removeAllListeners = jest.fn();\n}\n\n// Appearance mock\nconst Appearance = {\n getColorScheme: () => 'light' as const,\n addChangeListener: jest.fn(() => ({ remove: jest.fn() })),\n removeChangeListener: jest.fn(),\n};\n\n// useColorScheme hook mock\nconst useColorScheme = () => 'light' as const;\n\n// useWindowDimensions hook mock\nconst useWindowDimensions = () => ({\n width: SCREEN_WIDTH,\n height: SCREEN_HEIGHT,\n scale: 2,\n fontScale: 1,\n});\n\n// Default export for compatibility\nconst ReactNative = {\n View,\n Text,\n Image,\n ScrollView,\n TextInput,\n TouchableOpacity,\n TouchableHighlight,\n TouchableWithoutFeedback,\n Pressable,\n FlatList,\n SectionList,\n ActivityIndicator,\n SafeAreaView,\n Modal,\n Switch,\n RefreshControl,\n KeyboardAvoidingView,\n StyleSheet,\n Platform,\n Dimensions,\n PixelRatio,\n Animated,\n Keyboard,\n Linking,\n AppState,\n AccessibilityInfo,\n NativeEventEmitter,\n Appearance,\n useColorScheme,\n useWindowDimensions,\n};\n\n// Named exports\nexport {\n AccessibilityInfo,\n ActivityIndicator,\n Animated,\n Appearance,\n AppState,\n Dimensions,\n FlatList,\n Image,\n Keyboard,\n KeyboardAvoidingView,\n Linking,\n Modal,\n NativeEventEmitter,\n PixelRatio,\n Platform,\n Pressable,\n RefreshControl,\n SafeAreaView,\n ScrollView,\n SectionList,\n StyleSheet,\n Switch,\n Text,\n TextInput,\n TouchableHighlight,\n TouchableOpacity,\n TouchableWithoutFeedback,\n useColorScheme,\n useWindowDimensions,\n View,\n};\n\nexport default ReactNative;\n"],"mappings":";;;AAcA,OAAO,UAAU;AAYjB,SAAS,oBAAoB,MAAc;CACzC,MAAM,gBAAgB,YAAyC,EAAE,UAAU,GAAG,SAAS,QAAQ;
|
|
1
|
+
{"version":3,"file":"react-native.js","names":[],"sources":["../../../src/jest/mocks/react-native.tsx"],"sourcesContent":["/**\n * Jest mock for react-native core components.\n *\n * Provides simple mock implementations for React Native components\n * that work in a Jest environment without native modules.\n */\n\n/// <reference types=\"jest\" />\n\nimport type { ReactNode } from 'react';\nimport React, { forwardRef } from 'react';\n\n// Set up React Native globals\ndeclare const global: { __DEV__?: boolean };\nglobal.__DEV__ = true;\n\ninterface MockComponentProps {\n children?: ReactNode;\n style?: object;\n testID?: string;\n accessibilityRole?: string;\n accessibilityLabel?: string;\n [key: string]: unknown;\n}\n\n// Create a simple mock component factory\nfunction createMockComponent(name: string) {\n const MockComponent = forwardRef<unknown, MockComponentProps>(({ children, ...props }, ref) => {\n return React.createElement(name, { ...props, ref }, children as ReactNode);\n });\n MockComponent.displayName = name;\n return MockComponent;\n}\n\n// Component mocks\nconst View = createMockComponent('View');\nconst Text = createMockComponent('Text');\nconst Image = createMockComponent('Image');\nconst ScrollView = createMockComponent('ScrollView');\nconst TextInput = createMockComponent('TextInput');\nconst TouchableOpacity = createMockComponent('TouchableOpacity');\nconst TouchableHighlight = createMockComponent('TouchableHighlight');\nconst TouchableWithoutFeedback = createMockComponent('TouchableWithoutFeedback');\nconst Pressable = createMockComponent('Pressable');\nconst FlatList = createMockComponent('FlatList');\nconst SectionList = createMockComponent('SectionList');\nconst ActivityIndicator = createMockComponent('ActivityIndicator');\nconst SafeAreaView = createMockComponent('SafeAreaView');\nconst Modal = createMockComponent('Modal');\nconst Switch = createMockComponent('Switch');\nconst RefreshControl = createMockComponent('RefreshControl');\nconst KeyboardAvoidingView = createMockComponent('KeyboardAvoidingView');\n\n// StyleSheet mock\nconst StyleSheet = {\n create: <T extends Record<string, object>>(styles: T): T => styles,\n flatten: (style: object | object[]): object => {\n if (Array.isArray(style)) {\n return Object.assign({}, ...style);\n }\n return style || {};\n },\n compose: (style1: object, style2: object): object[] => [style1, style2],\n hairlineWidth: 1,\n absoluteFill: { position: 'absolute', left: 0, right: 0, top: 0, bottom: 0 },\n absoluteFillObject: { position: 'absolute', left: 0, right: 0, top: 0, bottom: 0 },\n};\n\n// Platform mock\nconst Platform = {\n OS: 'ios' as const,\n Version: 17,\n select: <T extends Record<string, unknown>>(config: T): T[keyof T] | undefined => {\n return (config.ios ?? config.default) as T[keyof T] | undefined;\n },\n isTV: false,\n isPad: false,\n isVision: false,\n isTesting: true,\n constants: {\n reactNativeVersion: { major: 0, minor: 83, patch: 0 },\n },\n};\n\n// Dimensions mock\nconst SCREEN_WIDTH = 375;\nconst SCREEN_HEIGHT = 812;\n\nconst Dimensions = {\n get: (_dim: 'window' | 'screen') => ({\n width: SCREEN_WIDTH,\n height: SCREEN_HEIGHT,\n scale: 2,\n fontScale: 1,\n }),\n set: jest.fn(),\n addEventListener: jest.fn(() => ({ remove: jest.fn() })),\n removeEventListener: jest.fn(),\n};\n\n// PixelRatio mock\nconst PixelRatio = {\n get: () => 2,\n getFontScale: () => 1,\n getPixelSizeForLayoutSize: (size: number) => size * 2,\n roundToNearestPixel: (size: number) => Math.round(size * 2) / 2,\n};\n\n// Animated mock (basic - reanimated provides more complete implementation)\nconst Animated = {\n View: createMockComponent('Animated.View'),\n Text: createMockComponent('Animated.Text'),\n Image: createMockComponent('Animated.Image'),\n ScrollView: createMockComponent('Animated.ScrollView'),\n Value: class {\n _value: number;\n constructor(value: number) {\n this._value = value;\n }\n },\n timing: jest.fn(() => ({ start: jest.fn() })),\n spring: jest.fn(() => ({ start: jest.fn() })),\n createAnimatedComponent: (Component: React.ComponentType) => Component,\n};\n\n// Keyboard mock\nconst Keyboard = {\n dismiss: jest.fn(),\n addListener: jest.fn(() => ({ remove: jest.fn() })),\n removeListener: jest.fn(),\n isVisible: jest.fn(() => false),\n};\n\n// Linking mock\nconst Linking = {\n openURL: jest.fn().mockResolvedValue(true),\n canOpenURL: jest.fn().mockResolvedValue(true),\n getInitialURL: jest.fn().mockResolvedValue(null),\n addEventListener: jest.fn(() => ({ remove: jest.fn() })),\n};\n\n// AppState mock\nconst AppState = {\n currentState: 'active',\n addEventListener: jest.fn(() => ({ remove: jest.fn() })),\n removeEventListener: jest.fn(),\n};\n\n// AccessibilityInfo mock\nconst AccessibilityInfo = {\n isReduceMotionEnabled: jest.fn().mockResolvedValue(false),\n isScreenReaderEnabled: jest.fn().mockResolvedValue(false),\n addEventListener: jest.fn(() => ({ remove: jest.fn() })),\n};\n\n// NativeEventEmitter mock\nclass NativeEventEmitter {\n addListener = jest.fn(() => ({ remove: jest.fn() }));\n removeListener = jest.fn();\n removeAllListeners = jest.fn();\n}\n\n// Appearance mock\nconst Appearance = {\n getColorScheme: () => 'light' as const,\n addChangeListener: jest.fn(() => ({ remove: jest.fn() })),\n removeChangeListener: jest.fn(),\n};\n\n// useColorScheme hook mock\nconst useColorScheme = () => 'light' as const;\n\n// useWindowDimensions hook mock\nconst useWindowDimensions = () => ({\n width: SCREEN_WIDTH,\n height: SCREEN_HEIGHT,\n scale: 2,\n fontScale: 1,\n});\n\n// Default export for compatibility\nconst ReactNative = {\n View,\n Text,\n Image,\n ScrollView,\n TextInput,\n TouchableOpacity,\n TouchableHighlight,\n TouchableWithoutFeedback,\n Pressable,\n FlatList,\n SectionList,\n ActivityIndicator,\n SafeAreaView,\n Modal,\n Switch,\n RefreshControl,\n KeyboardAvoidingView,\n StyleSheet,\n Platform,\n Dimensions,\n PixelRatio,\n Animated,\n Keyboard,\n Linking,\n AppState,\n AccessibilityInfo,\n NativeEventEmitter,\n Appearance,\n useColorScheme,\n useWindowDimensions,\n};\n\n// Named exports\nexport {\n AccessibilityInfo,\n ActivityIndicator,\n Animated,\n Appearance,\n AppState,\n Dimensions,\n FlatList,\n Image,\n Keyboard,\n KeyboardAvoidingView,\n Linking,\n Modal,\n NativeEventEmitter,\n PixelRatio,\n Platform,\n Pressable,\n RefreshControl,\n SafeAreaView,\n ScrollView,\n SectionList,\n StyleSheet,\n Switch,\n Text,\n TextInput,\n TouchableHighlight,\n TouchableOpacity,\n TouchableWithoutFeedback,\n useColorScheme,\n useWindowDimensions,\n View,\n};\n\nexport default ReactNative;\n"],"mappings":";;;AAcA,OAAO,UAAU;AAYjB,SAAS,oBAAoB,MAAc;CACzC,MAAM,gBAAgB,YAAyC,EAAE,UAAU,GAAG,SAAS,QAAQ;EAC7F,OAAO,MAAM,cAAc,MAAM;GAAE,GAAG;GAAO;GAAK,EAAE,SAAsB;GAC1E;CACF,cAAc,cAAc;CAC5B,OAAO;;AAIT,MAAM,OAAO,oBAAoB,OAAO;AACxC,MAAM,O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ACzD,uBAAuB,KAAK,IAAI,CAAC,kBAAkB,MAAM;CACzD,kBAAkB,KAAK,UAAU,EAAE,QAAQ,KAAK,IAAI,EAAE,EAAE;CACzD;AAGD,IAAM,qBAAN,MAAyB;CACvB,cAAc,KAAK,UAAU,EAAE,QAAQ,KAAK,IAAI,EAAE,EAAE;CACpD,iBAAiB,KAAK,IAAI;CAC1B,qBAAqB,KAAK,IAAI;;AAIhC,MAAM,aAAa;CACjB,sBAAsB;CACtB,mBAAmB,KAAK,UAAU,EAAE,QAAQ,KAAK,IAAI,EAAE,EAAE;CACzD,sBAAsB,KAAK,IAAI;CAChC;AAGD,MAAM,uBAAuB;AAG7B,MAAM,6BAA6B;CACjC,OAAO;CACP,QAAQ;CACR,OAAO;CACP,WAAW;CACZ;AAGD,MAAM,cAAc;CAClB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reanimated.js","names":["Comp"],"sources":["../../../src/jest/mocks/reanimated.tsx"],"sourcesContent":["/**\n * Jest mock for react-native-reanimated.\n *\n * Provides minimal implementations for testing components\n * that use Reanimated animations.\n */\n\n/// <reference types=\"jest\" />\n\nimport type { ComponentType, PropsWithChildren, ReactNode } from 'react';\nimport React from 'react';\n\n// Shared value mock\nfunction useSharedValue<T>(initialValue: T) {\n return {\n value: initialValue,\n addListener: jest.fn(),\n removeListener: jest.fn(),\n modify: jest.fn(),\n };\n}\n\n// Derived value mock\nfunction useDerivedValue<T>(derivedFn: () => T): { value: T } {\n try {\n return { value: derivedFn() };\n } catch {\n return { value: undefined as T };\n }\n}\n\n// Animated style mock - returns empty object for snapshots\nfunction useAnimatedStyle<T extends object>(styleWorklet: () => T): T {\n try {\n return styleWorklet();\n } catch {\n return {} as T;\n }\n}\n\n// Animation timing functions - return the target value immediately\nfunction withTiming<T>(toValue: T): T {\n return toValue;\n}\n\nfunction withSpring<T>(toValue: T): T {\n return toValue;\n}\n\nfunction withDelay<T>(_delay: number, animation: T): T {\n return animation;\n}\n\nfunction withSequence<T>(...animations: T[]): T {\n return animations[animations.length - 1];\n}\n\nfunction withRepeat<T>(animation: T): T {\n return animation;\n}\n\nfunction withDecay(config: { velocity?: number; deceleration?: number }): number {\n return config.velocity ?? 0;\n}\n\n// Interpolation mock\nfunction interpolate(\n value: number,\n inputRange: readonly number[],\n outputRange: readonly number[],\n _extrapolation?: 'clamp' | 'extend' | { extrapolateLeft?: string; extrapolateRight?: string },\n): number {\n // Simple linear interpolation for testing\n if (value <= inputRange[0]) {\n return outputRange[0];\n }\n if (value >= inputRange[inputRange.length - 1]) {\n return outputRange[outputRange.length - 1];\n }\n\n // Find the segment\n for (let i = 0; i < inputRange.length - 1; i++) {\n if (value >= inputRange[i] && value <= inputRange[i + 1]) {\n const progress = (value - inputRange[i]) / (inputRange[i + 1] - inputRange[i]);\n return outputRange[i] + progress * (outputRange[i + 1] - outputRange[i]);\n }\n }\n\n return outputRange[outputRange.length - 1];\n}\n\nfunction interpolateColor(\n value: number,\n inputRange: readonly number[],\n outputRange: readonly string[],\n): string {\n if (value <= inputRange[0]) {\n return outputRange[0];\n }\n if (value >= inputRange[inputRange.length - 1]) {\n return outputRange[outputRange.length - 1];\n }\n // For testing, just return the closest color\n const index = Math.round(\n ((value - inputRange[0]) / (inputRange[inputRange.length - 1] - inputRange[0])) *\n (outputRange.length - 1),\n );\n return outputRange[Math.min(index, outputRange.length - 1)];\n}\n\n// Easing mock\nconst Easing = {\n linear: (t: number) => t,\n ease: (t: number) => t,\n quad: (t: number) => t * t,\n cubic: (t: number) => t * t * t,\n poly: (_n: number) => (t: number) => t,\n sin: (t: number) => t,\n circle: (t: number) => t,\n exp: (t: number) => t,\n elastic: (_bounciness?: number) => (t: number) => t,\n back: (_s?: number) => (t: number) => t,\n bounce: (t: number) => t,\n bezier: () => (t: number) => t,\n bezierFn: () => (t: number) => t,\n in: (easing: (t: number) => number) => easing,\n out: (easing: (t: number) => number) => easing,\n inOut: (easing: (t: number) => number) => easing,\n};\n\n// Gesture handler event hooks\nfunction useAnimatedGestureHandler(): Record<string, unknown> {\n return {};\n}\n\nfunction useAnimatedScrollHandler(): Record<string, unknown> {\n return {};\n}\n\n// Animated props\nfunction useAnimatedProps<T extends object>(propsWorklet: () => T): T {\n try {\n return propsWorklet();\n } catch {\n return {} as T;\n }\n}\n\n// Refs\nfunction useAnimatedRef<T>(): { current: T | null } {\n return { current: null };\n}\n\n// Reactions\nfunction useAnimatedReaction(): void {\n // no-op\n}\n\n// Simple mock components that don't depend on react-native imports\n// (to avoid issues with React Native's Jest mock initialization order)\ninterface MockViewProps {\n children?: ReactNode;\n style?: object;\n testID?: string;\n [key: string]: unknown;\n}\n\nfunction MockView({ children, style, testID, ...props }: MockViewProps) {\n // Use a simple div-like structure for Jest\n return React.createElement('View', { style, testID, ...props }, children);\n}\n\nfunction MockText({ children, style, testID, ...props }: MockViewProps) {\n return React.createElement('Text', { style, testID, ...props }, children);\n}\n\nfunction MockScrollView({ children, style, testID, ...props }: MockViewProps) {\n return React.createElement('ScrollView', { style, testID, ...props }, children);\n}\n\nfunction MockImage({ style, testID = 'AnimatedImage', ...props }: MockViewProps) {\n return React.createElement('Image', { style, testID, ...props });\n}\n\n// Animated component factory - creates a pass-through wrapper\nfunction createAnimatedComponent<T extends ComponentType<object>>(Component: T) {\n function AnimatedComponent({ children, style, ...props }: PropsWithChildren<{ style?: object }>) {\n // Flatten animated styles for rendering\n const flatStyle = Array.isArray(style) ? Object.assign({}, ...style) : style;\n const Comp = Component as ComponentType<{ style?: object; children?: ReactNode }>;\n return (\n <Comp style={flatStyle} {...props}>\n {children}\n </Comp>\n );\n }\n AnimatedComponent.displayName = `Animated(${(Component as { displayName?: string }).displayName || Component.name || 'Component'})`;\n return AnimatedComponent;\n}\n\n// Animated namespace with pre-created mock components\nconst Animated = {\n View: MockView,\n Text: MockText,\n Image: MockImage,\n ScrollView: MockScrollView,\n createAnimatedComponent,\n};\n\n// Layout animations\nconst FadeIn = { duration: jest.fn().mockReturnThis() };\nconst FadeOut = { duration: jest.fn().mockReturnThis() };\nconst SlideInRight = { duration: jest.fn().mockReturnThis() };\nconst SlideOutLeft = { duration: jest.fn().mockReturnThis() };\nconst ZoomIn = { duration: jest.fn().mockReturnThis() };\nconst ZoomOut = { duration: jest.fn().mockReturnThis() };\n\n// Color conversion\nfunction convertToRGBA(color: string | number): string {\n if (typeof color === 'string') {\n return color;\n }\n return `rgba(${(color >> 16) & 255}, ${(color >> 8) & 255}, ${color & 255}, 1)`;\n}\n\n// Run on JS/UI\nfunction runOnJS<T extends (...args: unknown[]) => unknown>(fn: T): T {\n return fn;\n}\n\nfunction runOnUI<T extends (...args: unknown[]) => unknown>(fn: T): T {\n return fn;\n}\n\n// Worklet helper\nfunction isWorklet(): boolean {\n return false;\n}\n\n// Cancel animation\nconst cancelAnimation = jest.fn();\n\n// Measure\nconst measure = jest.fn(() => ({\n x: 0,\n y: 0,\n width: 100,\n height: 100,\n pageX: 0,\n pageY: 0,\n}));\n\n// Scroll to\nconst scrollTo = jest.fn();\n\nexport default Animated;\n\nexport {\n Animated,\n cancelAnimation,\n convertToRGBA,\n createAnimatedComponent,\n Easing,\n FadeIn,\n FadeOut,\n interpolate,\n interpolateColor,\n isWorklet,\n measure,\n runOnJS,\n runOnUI,\n scrollTo,\n SlideInRight,\n SlideOutLeft,\n useAnimatedGestureHandler,\n useAnimatedProps,\n useAnimatedReaction,\n useAnimatedRef,\n useAnimatedScrollHandler,\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n withDecay,\n withDelay,\n withRepeat,\n withSequence,\n withSpring,\n withTiming,\n ZoomIn,\n ZoomOut,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,SAAS,eAAkB,cAAiB;AAC1C,QA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B,EAAE,UAAU,OAAO,GAAG,SAAgD;AAI/F,SACE,oBAACA,WAAD;GAAM,OAHU,MAAM,QAAQ,MAAM,GAAG,OAAO,OAAO,EAAE,EAAE,GAAG,MAAM,GAAG;GAG7C,GAAI;GACzB;GACI,CAAA;;AAGX,mBAAkB,cAAc,YAAa,UAAuC,eAAe,UAAU,QAAQ,YAAY;AACjI,QAAO;;AAIT,MAAM,WAAW;CACf,MAAM;CACN,MAAM;CACN,OAAO;CACP,YAAY;CACZ;CACD;AAGD,MAAM,SAAS,EAAE,UAAU,KAAK,IAAI,CAAC,gBAAgB,EAAE;AACvD,MAAM,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC,gBAAgB,EAAE;AACxD,MAAM,eAAe,EAAE,UAAU,KAAK,IAAI,CAAC,gBAAgB,EAAE;AAC7D,MAAM,eAAe,EAAE,UAAU,KAAK,IAAI,CAAC,gBAAgB,EAAE;AAC7D,MAAM,SAAS,EAAE,UAAU,KAAK,IAAI,CAAC,gBAAgB,EAAE;AACvD,MAAM,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC,gBAAgB,EAAE;AAGxD,SAAS,cAAc,OAAgC;AACrD,KAAI,OAAO,UAAU,SACnB,QAAO;AAET,QAAO,QAAS,SAAS,KAAM,IAAI,IAAK,SAAS,IAAK,IAAI,IAAI,QAAQ,IAAI;;AAI5E,SAAS,QAAmD,IAAU;AACpE,QAAO;;AAGT,SAAS,QAAmD,IAAU;AACpE,QAAO;;AAIT,SAAS,YAAqB;AAC5B,QAAO;;AAIT,MAAM,kBAAkB,KAAK,IAAI;AAGjC,MAAM,UAAU,KAAK,UAAU;CAC7B,GAAG;CACH,GAAG;CACH,OAAO;CACP,QAAQ;CACR,OAAO;CACP,OAAO;CACR,EAAE;AAGH,MAAM,WAAW,KAAK,IAAI"}
|
|
1
|
+
{"version":3,"file":"reanimated.js","names":["Comp"],"sources":["../../../src/jest/mocks/reanimated.tsx"],"sourcesContent":["/**\n * Jest mock for react-native-reanimated.\n *\n * Provides minimal implementations for testing components\n * that use Reanimated animations.\n */\n\n/// <reference types=\"jest\" />\n\nimport type { ComponentType, PropsWithChildren, ReactNode } from 'react';\nimport React from 'react';\n\n// Shared value mock\nfunction useSharedValue<T>(initialValue: T) {\n return {\n value: initialValue,\n addListener: jest.fn(),\n removeListener: jest.fn(),\n modify: jest.fn(),\n };\n}\n\n// Derived value mock\nfunction useDerivedValue<T>(derivedFn: () => T): { value: T } {\n try {\n return { value: derivedFn() };\n } catch {\n return { value: undefined as T };\n }\n}\n\n// Animated style mock - returns empty object for snapshots\nfunction useAnimatedStyle<T extends object>(styleWorklet: () => T): T {\n try {\n return styleWorklet();\n } catch {\n return {} as T;\n }\n}\n\n// Animation timing functions - return the target value immediately\nfunction withTiming<T>(toValue: T): T {\n return toValue;\n}\n\nfunction withSpring<T>(toValue: T): T {\n return toValue;\n}\n\nfunction withDelay<T>(_delay: number, animation: T): T {\n return animation;\n}\n\nfunction withSequence<T>(...animations: T[]): T {\n return animations[animations.length - 1];\n}\n\nfunction withRepeat<T>(animation: T): T {\n return animation;\n}\n\nfunction withDecay(config: { velocity?: number; deceleration?: number }): number {\n return config.velocity ?? 0;\n}\n\n// Interpolation mock\nfunction interpolate(\n value: number,\n inputRange: readonly number[],\n outputRange: readonly number[],\n _extrapolation?: 'clamp' | 'extend' | { extrapolateLeft?: string; extrapolateRight?: string },\n): number {\n // Simple linear interpolation for testing\n if (value <= inputRange[0]) {\n return outputRange[0];\n }\n if (value >= inputRange[inputRange.length - 1]) {\n return outputRange[outputRange.length - 1];\n }\n\n // Find the segment\n for (let i = 0; i < inputRange.length - 1; i++) {\n if (value >= inputRange[i] && value <= inputRange[i + 1]) {\n const progress = (value - inputRange[i]) / (inputRange[i + 1] - inputRange[i]);\n return outputRange[i] + progress * (outputRange[i + 1] - outputRange[i]);\n }\n }\n\n return outputRange[outputRange.length - 1];\n}\n\nfunction interpolateColor(\n value: number,\n inputRange: readonly number[],\n outputRange: readonly string[],\n): string {\n if (value <= inputRange[0]) {\n return outputRange[0];\n }\n if (value >= inputRange[inputRange.length - 1]) {\n return outputRange[outputRange.length - 1];\n }\n // For testing, just return the closest color\n const index = Math.round(\n ((value - inputRange[0]) / (inputRange[inputRange.length - 1] - inputRange[0])) *\n (outputRange.length - 1),\n );\n return outputRange[Math.min(index, outputRange.length - 1)];\n}\n\n// Easing mock\nconst Easing = {\n linear: (t: number) => t,\n ease: (t: number) => t,\n quad: (t: number) => t * t,\n cubic: (t: number) => t * t * t,\n poly: (_n: number) => (t: number) => t,\n sin: (t: number) => t,\n circle: (t: number) => t,\n exp: (t: number) => t,\n elastic: (_bounciness?: number) => (t: number) => t,\n back: (_s?: number) => (t: number) => t,\n bounce: (t: number) => t,\n bezier: () => (t: number) => t,\n bezierFn: () => (t: number) => t,\n in: (easing: (t: number) => number) => easing,\n out: (easing: (t: number) => number) => easing,\n inOut: (easing: (t: number) => number) => easing,\n};\n\n// Gesture handler event hooks\nfunction useAnimatedGestureHandler(): Record<string, unknown> {\n return {};\n}\n\nfunction useAnimatedScrollHandler(): Record<string, unknown> {\n return {};\n}\n\n// Animated props\nfunction useAnimatedProps<T extends object>(propsWorklet: () => T): T {\n try {\n return propsWorklet();\n } catch {\n return {} as T;\n }\n}\n\n// Refs\nfunction useAnimatedRef<T>(): { current: T | null } {\n return { current: null };\n}\n\n// Reactions\nfunction useAnimatedReaction(): void {\n // no-op\n}\n\n// Simple mock components that don't depend on react-native imports\n// (to avoid issues with React Native's Jest mock initialization order)\ninterface MockViewProps {\n children?: ReactNode;\n style?: object;\n testID?: string;\n [key: string]: unknown;\n}\n\nfunction MockView({ children, style, testID, ...props }: MockViewProps) {\n // Use a simple div-like structure for Jest\n return React.createElement('View', { style, testID, ...props }, children);\n}\n\nfunction MockText({ children, style, testID, ...props }: MockViewProps) {\n return React.createElement('Text', { style, testID, ...props }, children);\n}\n\nfunction MockScrollView({ children, style, testID, ...props }: MockViewProps) {\n return React.createElement('ScrollView', { style, testID, ...props }, children);\n}\n\nfunction MockImage({ style, testID = 'AnimatedImage', ...props }: MockViewProps) {\n return React.createElement('Image', { style, testID, ...props });\n}\n\n// Animated component factory - creates a pass-through wrapper\nfunction createAnimatedComponent<T extends ComponentType<object>>(Component: T) {\n function AnimatedComponent({ children, style, ...props }: PropsWithChildren<{ style?: object }>) {\n // Flatten animated styles for rendering\n const flatStyle = Array.isArray(style) ? Object.assign({}, ...style) : style;\n const Comp = Component as ComponentType<{ style?: object; children?: ReactNode }>;\n return (\n <Comp style={flatStyle} {...props}>\n {children}\n </Comp>\n );\n }\n AnimatedComponent.displayName = `Animated(${(Component as { displayName?: string }).displayName || Component.name || 'Component'})`;\n return AnimatedComponent;\n}\n\n// Animated namespace with pre-created mock components\nconst Animated = {\n View: MockView,\n Text: MockText,\n Image: MockImage,\n ScrollView: MockScrollView,\n createAnimatedComponent,\n};\n\n// Layout animations\nconst FadeIn = { duration: jest.fn().mockReturnThis() };\nconst FadeOut = { duration: jest.fn().mockReturnThis() };\nconst SlideInRight = { duration: jest.fn().mockReturnThis() };\nconst SlideOutLeft = { duration: jest.fn().mockReturnThis() };\nconst ZoomIn = { duration: jest.fn().mockReturnThis() };\nconst ZoomOut = { duration: jest.fn().mockReturnThis() };\n\n// Color conversion\nfunction convertToRGBA(color: string | number): string {\n if (typeof color === 'string') {\n return color;\n }\n return `rgba(${(color >> 16) & 255}, ${(color >> 8) & 255}, ${color & 255}, 1)`;\n}\n\n// Run on JS/UI\nfunction runOnJS<T extends (...args: unknown[]) => unknown>(fn: T): T {\n return fn;\n}\n\nfunction runOnUI<T extends (...args: unknown[]) => unknown>(fn: T): T {\n return fn;\n}\n\n// Worklet helper\nfunction isWorklet(): boolean {\n return false;\n}\n\n// Cancel animation\nconst cancelAnimation = jest.fn();\n\n// Measure\nconst measure = jest.fn(() => ({\n x: 0,\n y: 0,\n width: 100,\n height: 100,\n pageX: 0,\n pageY: 0,\n}));\n\n// Scroll to\nconst scrollTo = jest.fn();\n\nexport default Animated;\n\nexport {\n Animated,\n cancelAnimation,\n convertToRGBA,\n createAnimatedComponent,\n Easing,\n FadeIn,\n FadeOut,\n interpolate,\n interpolateColor,\n isWorklet,\n measure,\n runOnJS,\n runOnUI,\n scrollTo,\n SlideInRight,\n SlideOutLeft,\n useAnimatedGestureHandler,\n useAnimatedProps,\n useAnimatedReaction,\n useAnimatedRef,\n useAnimatedScrollHandler,\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n withDecay,\n withDelay,\n withRepeat,\n withSequence,\n withSpring,\n withTiming,\n ZoomIn,\n ZoomOut,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,SAAS,eAAkB,cAAiB;CAC1C,OAAO;EACL,OAAO;EACP,aAAa,KAAK,IAAI;EACtB,gBAAgB,KAAK,IAAI;EACzB,QAAQ,KAAK,IAAI;EAClB;;AAIH,SAAS,gBAAmB,WAAkC;CAC5D,IAAI;EACF,OAAO,EAAE,OAAO,WAAW,EAAE;SACvB;EACN,OAAO,EAAE,OAAO,KAAA,GAAgB;;;AAKpC,SAAS,iBAAmC,cAA0B;CACpE,IAAI;EACF,OAAO,cAAc;SACf;EACN,OAAO,EAAE;;;AAKb,SAAS,WAAc,SAAe;CACpC,OAAO;;AAGT,SAAS,WAAc,SAAe;CACpC,OAAO;;AAGT,SAAS,UAAa,QAAgB,WAAiB;CACrD,OAAO;;AAGT,SAAS,aAAgB,GAAG,YAAoB;CAC9C,OAAO,WAAW,WAAW,SAAS;;AAGxC,SAAS,WAAc,WAAiB;CACtC,OAAO;;AAGT,SAAS,UAAU,QAA8D;CAC/E,OAAO,OAAO,YAAY;;AAI5B,SAAS,YACP,OACA,YACA,aACA,gBACQ;CAER,IAAI,SAAS,WAAW,IACtB,OAAO,YAAY;CAErB,IAAI,SAAS,WAAW,WAAW,SAAS,IAC1C,OAAO,YAAY,YAAY,SAAS;CAI1C,KAAK,IAAI,IAAI,GAAG,IAAI,WAAW,SAAS,GAAG,KACzC,I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AI,IAAK,SAAS,IAAK,IAAI,IAAI,QAAQ,IAAI;;AAI5E,SAAS,QAAmD,IAAU;CACpE,OAAO;;AAGT,SAAS,QAAmD,IAAU;CACpE,OAAO;;AAIT,SAAS,YAAqB;CAC5B,OAAO;;AAIT,MAAM,kBAAkB,KAAK,IAAI;AAGjC,MAAM,UAAU,KAAK,UAAU;CAC7B,GAAG;CACH,GAAG;CACH,OAAO;CACP,QAAQ;CACR,OAAO;CACP,OAAO;CACR,EAAE;AAGH,MAAM,WAAW,KAAK,IAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":[],"sources":["../../../src/jest/mocks/styles.ts"],"sourcesContent":["/**\n * Jest mock for generated/styles.\n *\n * Provides proxy-based mocks for the generated style objects\n * (styles, buttonStyles, etc.) with useVariants as a no-op.\n */\n\n/// <reference types=\"jest\" />\n\n// Default style values for foundation\nconst defaultFoundation = {\n // Layout\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'stretch',\n justifyContent: 'flex-start',\n // Spacing\n padding: 0,\n paddingHorizontal: 0,\n paddingVertical: 0,\n margin: 0,\n gap: 0,\n // Colors\n backgroundColor: 'transparent',\n color: '#000000',\n borderColor: 'transparent',\n // Border\n borderWidth: 0,\n borderRadius: 0,\n // Typography\n fontFamily: 'System',\n fontSize: 14,\n lineHeight: 20,\n fontWeight: 'regular',\n // Effects\n opacity: 1,\n boxShadow: '',\n};\n\n// Create a style object with useVariants attached\nfunction createStyleObject(baseStyles: Record<string, unknown> = {}) {\n const proxy = new Proxy(\n { ...defaultFoundation, ...baseStyles, useVariants: jest.fn() },\n {\n get(target, prop) {\n if (prop === 'useVariants') {\n return jest.fn();\n }\n if (prop in target) {\n return target[prop as keyof typeof target];\n }\n // Return sensible defaults for unknown properties\n if (typeof prop === 'string') {\n if (prop.includes('color') || prop.includes('Color')) {\n return '#000000';\n }\n if (prop.includes('width') || prop.includes('Width')) {\n return 0;\n }\n if (prop.includes('radius') || prop.includes('Radius')) {\n return 0;\n }\n if (prop.includes('size') || prop.includes('Size')) {\n return 16;\n }\n if (prop.includes('spacing') || prop.includes('Spacing')) {\n return 0;\n }\n if (prop.includes('gap') || prop.includes('Gap')) {\n return 0;\n }\n }\n return undefined;\n },\n },\n );\n return proxy;\n}\n\n// Create a component style object (like buttonStyles) with multiple style keys\nfunction createComponentStyles(styleKeys: Record<string, Record<string, unknown>>) {\n const result: Record<string, unknown> = { useVariants: jest.fn() };\n\n for (const [key, baseStyles] of Object.entries(styleKeys)) {\n result[key] = createStyleObject(baseStyles);\n }\n\n return new Proxy(result, {\n get(target, prop) {\n if (prop === 'useVariants') {\n return jest.fn();\n }\n if (prop in target) {\n return target[prop as keyof typeof target];\n }\n // Return a default style object for any unknown key\n if (typeof prop === 'string') {\n return createStyleObject();\n }\n return undefined;\n },\n });\n}\n\n// Main styles export\nexport const styles = createComponentStyles({\n foundation: defaultFoundation,\n});\n\n// Button styles\nexport const buttonStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 8,\n paddingHorizontal: 16,\n paddingVertical: 10,\n backgroundColor: '#6001D2',\n borderRadius: 8,\n borderWidth: 0,\n borderColor: 'transparent',\n opacity: 1,\n boxShadow: '',\n },\n text: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 14,\n letterSpacing: 0,\n lineHeight: 20,\n color: '#FFFFFF',\n },\n icon: {\n fontSize: 16,\n iconSizeToken: 'sm',\n lineHeight: 16,\n color: '#FFFFFF',\n },\n});\n\n// Text styles\nexport const textStyles = createComponentStyles({\n root: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// Input styles\nexport const inputStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: 4,\n },\n label: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n inputContainer: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 12,\n paddingVertical: 10,\n backgroundColor: '#FFFFFF',\n borderRadius: 8,\n borderWidth: 1,\n borderColor: '#E0E0E0',\n },\n input: {\n flex: 1,\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 16,\n lineHeight: 24,\n color: '#000000',\n },\n helperText: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 12,\n lineHeight: 16,\n color: '#666666',\n },\n});\n\n// Checkbox styles\nexport const checkboxStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n box: {\n width: 20,\n height: 20,\n borderRadius: 4,\n borderWidth: 2,\n borderColor: '#6001D2',\n backgroundColor: 'transparent',\n },\n label: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// Switch styles\nexport const switchStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n track: {\n width: 48,\n height: 28,\n borderRadius: 14,\n backgroundColor: '#E0E0E0',\n },\n thumb: {\n width: 24,\n height: 24,\n borderRadius: 12,\n backgroundColor: '#FFFFFF',\n },\n label: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// Avatar styles\nexport const avatarStyles = createComponentStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: 9999,\n backgroundColor: '#E0E0E0',\n overflow: 'hidden',\n },\n image: {\n width: '100%',\n height: '100%',\n },\n initials: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 14,\n color: '#000000',\n },\n});\n\n// Badge styles\nexport const badgeStyles = createComponentStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n paddingHorizontal: 8,\n paddingVertical: 2,\n borderRadius: 4,\n backgroundColor: '#E0E0E0',\n },\n text: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 12,\n lineHeight: 16,\n color: '#000000',\n },\n});\n\n// Chip styles\nexport const chipStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n paddingHorizontal: 12,\n paddingVertical: 6,\n borderRadius: 16,\n backgroundColor: '#F5F5F5',\n borderWidth: 1,\n borderColor: '#E0E0E0',\n },\n text: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// Divider styles\nexport const dividerStyles = createComponentStyles({\n root: {\n gap: 8,\n },\n label: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 12,\n lineHeight: 16,\n color: '#000000',\n },\n line: {\n borderWidth: 1,\n borderColor: '#E0E0E0',\n },\n});\n\n// Link styles\nexport const linkStyles = createComponentStyles({\n root: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n text: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#6001D2',\n textDecorationLine: 'underline',\n },\n});\n\n// Radio styles\nexport const radioStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n circle: {\n width: 20,\n height: 20,\n borderRadius: 10,\n borderWidth: 2,\n borderColor: '#6001D2',\n backgroundColor: 'transparent',\n },\n dot: {\n width: 10,\n height: 10,\n borderRadius: 5,\n backgroundColor: '#6001D2',\n },\n label: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// IconButton styles\nexport const iconButtonStyles = createComponentStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: 8,\n backgroundColor: 'transparent',\n },\n icon: {\n fontSize: 24,\n color: '#000000',\n },\n});\n\n// Tabs (tab list chrome)\nexport const tabsStyles = createComponentStyles({\n root: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n});\n\n// Type for StyleProps\nexport interface StyleProps {\n color?: string;\n backgroundColor?: string;\n borderColor?: string;\n borderWidth?: number;\n borderRadius?: number;\n [key: string]: unknown;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,oBAAoB;CAExB,SAAS;CACT,eAAe;CACf,YAAY;CACZ,gBAAgB;CAEhB,SAAS;CACT,mBAAmB;CACnB,iBAAiB;CACjB,QAAQ;CACR,KAAK;CAEL,iBAAiB;CACjB,OAAO;CACP,aAAa;CAEb,aAAa;CACb,cAAc;CAEd,YAAY;CACZ,UAAU;CACV,YAAY;CACZ,YAAY;CAEZ,SAAS;CACT,WAAW;CACZ;AAGD,SAAS,kBAAkB,aAAsC,EAAE,EAAE;AAoCnE,QAAO,IAnCW,MAChB;EAAE,GAAG;EAAmB,GAAG;EAAY,aAAa,KAAK,IAAI;EAAE,EAC/D,EACE,IAAI,QAAQ,MAAM;AAChB,MAAI,SAAS,cACX,QAAO,KAAK,IAAI;AAElB,MAAI,QAAQ,OACV,QAAO,OAAO;AAGhB,MAAI,OAAO,SAAS,UAAU;AAC5B,OAAI,KAAK,SAAS,QAAQ,IAAI,KAAK,SAAS,QAAQ,CAClD,QAAO;AAET,OAAI,KAAK,SAAS,QAAQ,IAAI,KAAK,SAAS,QAAQ,CAClD,QAAO;AAET,OAAI,KAAK,SAAS,SAAS,IAAI,KAAK,SAAS,SAAS,CACpD,QAAO;AAET,OAAI,KAAK,SAAS,OAAO,IAAI,KAAK,SAAS,OAAO,CAChD,QAAO;AAET,OAAI,KAAK,SAAS,UAAU,IAAI,KAAK,SAAS,UAAU,CACtD,QAAO;AAET,OAAI,KAAK,SAAS,MAAM,IAAI,KAAK,SAAS,MAAM,CAC9C,QAAO;;IAKd,CAES;;AAId,SAAS,sBAAsB,WAAoD;CACjF,MAAM,SAAkC,EAAE,aAAa,KAAK,IAAI,EAAE;AAElE,MAAK,MAAM,CAAC,KAAK,eAA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YAAY;EACZ,OAAO;EACR;CACD,MAAM;EACJ,aAAa;EACb,aAAa;EACd;CACF,CAAC;AAGF,MAAa,aAAa,sBAAsB;CAC9C,MAAM;EACJ,eAAe;EACf,YAAY;EACZ,KAAK;EACN;CACD,MAAM;EACJ,YAAY;EACZ,UAAU;EACV,YAAY;EACZ,OAAO;EACP,oBAAoB;EACrB;CACF,CAAC;AAGF,MAAa,cAAc,sBAAsB;CAC/C,MAAM;EACJ,SAAS;EACT,eAAe;EACf,YAAY;EACZ,KAAK;EACN;CACD,QAAQ;EACN,OAAO;EACP,QAAQ;EACR,cAAc;EACd,aAAa;EACb,aAAa;EACb,iBAAiB;EAClB;CACD,KAAK;EACH,OAAO;EACP,QAAQ;EACR,cAAc;EACd,iBAAiB;EAClB;CACD,OAAO;EACL,YAAY;EACZ,UAAU;EACV,YAAY;EACZ,OAAO;EACR;CACF,CAAC;AAGF,MAAa,mBAAmB,sBAAsB;CACpD,MAAM;EACJ,SAAS;EACT,YAAY;EACZ,gBAAgB;EAChB,cAAc;EACd,iBAAiB;EAClB;CACD,MAAM;EACJ,UAAU;EACV,OAAO;EACR;CACF,CAAC;AAGF,MAAa,aAAa,sBAAsB,EAC9C,MAAM;CACJ,eAAe;CACf,YAAY;CACZ,KAAK;CACN,EACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"styles.js","names":[],"sources":["../../../src/jest/mocks/styles.ts"],"sourcesContent":["/**\n * Jest mock for generated/styles.\n *\n * Provides proxy-based mocks for the generated style objects\n * (styles, buttonStyles, etc.) with useVariants as a no-op.\n */\n\n/// <reference types=\"jest\" />\n\n// Default style values for foundation\nconst defaultFoundation = {\n // Layout\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'stretch',\n justifyContent: 'flex-start',\n // Spacing\n padding: 0,\n paddingHorizontal: 0,\n paddingVertical: 0,\n margin: 0,\n gap: 0,\n // Colors\n backgroundColor: 'transparent',\n color: '#000000',\n borderColor: 'transparent',\n // Border\n borderWidth: 0,\n borderRadius: 0,\n // Typography\n fontFamily: 'System',\n fontSize: 14,\n lineHeight: 20,\n fontWeight: 'regular',\n // Effects\n opacity: 1,\n boxShadow: '',\n};\n\n// Create a style object with useVariants attached\nfunction createStyleObject(baseStyles: Record<string, unknown> = {}) {\n const proxy = new Proxy(\n { ...defaultFoundation, ...baseStyles, useVariants: jest.fn() },\n {\n get(target, prop) {\n if (prop === 'useVariants') {\n return jest.fn();\n }\n if (prop in target) {\n return target[prop as keyof typeof target];\n }\n // Return sensible defaults for unknown properties\n if (typeof prop === 'string') {\n if (prop.includes('color') || prop.includes('Color')) {\n return '#000000';\n }\n if (prop.includes('width') || prop.includes('Width')) {\n return 0;\n }\n if (prop.includes('radius') || prop.includes('Radius')) {\n return 0;\n }\n if (prop.includes('size') || prop.includes('Size')) {\n return 16;\n }\n if (prop.includes('spacing') || prop.includes('Spacing')) {\n return 0;\n }\n if (prop.includes('gap') || prop.includes('Gap')) {\n return 0;\n }\n }\n return undefined;\n },\n },\n );\n return proxy;\n}\n\n// Create a component style object (like buttonStyles) with multiple style keys\nfunction createComponentStyles(styleKeys: Record<string, Record<string, unknown>>) {\n const result: Record<string, unknown> = { useVariants: jest.fn() };\n\n for (const [key, baseStyles] of Object.entries(styleKeys)) {\n result[key] = createStyleObject(baseStyles);\n }\n\n return new Proxy(result, {\n get(target, prop) {\n if (prop === 'useVariants') {\n return jest.fn();\n }\n if (prop in target) {\n return target[prop as keyof typeof target];\n }\n // Return a default style object for any unknown key\n if (typeof prop === 'string') {\n return createStyleObject();\n }\n return undefined;\n },\n });\n}\n\n// Main styles export\nexport const styles = createComponentStyles({\n foundation: defaultFoundation,\n});\n\n// Button styles\nexport const buttonStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 8,\n paddingHorizontal: 16,\n paddingVertical: 10,\n backgroundColor: '#6001D2',\n borderRadius: 8,\n borderWidth: 0,\n borderColor: 'transparent',\n opacity: 1,\n boxShadow: '',\n },\n text: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 14,\n letterSpacing: 0,\n lineHeight: 20,\n color: '#FFFFFF',\n },\n icon: {\n fontSize: 16,\n iconSizeToken: 'sm',\n lineHeight: 16,\n color: '#FFFFFF',\n },\n});\n\n// Text styles\nexport const textStyles = createComponentStyles({\n root: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// Input styles\nexport const inputStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: 4,\n },\n label: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n inputContainer: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 12,\n paddingVertical: 10,\n backgroundColor: '#FFFFFF',\n borderRadius: 8,\n borderWidth: 1,\n borderColor: '#E0E0E0',\n },\n input: {\n flex: 1,\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 16,\n lineHeight: 24,\n color: '#000000',\n },\n helperText: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 12,\n lineHeight: 16,\n color: '#666666',\n },\n});\n\n// Checkbox styles\nexport const checkboxStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n box: {\n width: 20,\n height: 20,\n borderRadius: 4,\n borderWidth: 2,\n borderColor: '#6001D2',\n backgroundColor: 'transparent',\n },\n label: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// Switch styles\nexport const switchStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n track: {\n width: 48,\n height: 28,\n borderRadius: 14,\n backgroundColor: '#E0E0E0',\n },\n thumb: {\n width: 24,\n height: 24,\n borderRadius: 12,\n backgroundColor: '#FFFFFF',\n },\n label: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// Avatar styles\nexport const avatarStyles = createComponentStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: 9999,\n backgroundColor: '#E0E0E0',\n overflow: 'hidden',\n },\n image: {\n width: '100%',\n height: '100%',\n },\n initials: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 14,\n color: '#000000',\n },\n});\n\n// Badge styles\nexport const badgeStyles = createComponentStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n paddingHorizontal: 8,\n paddingVertical: 2,\n borderRadius: 4,\n backgroundColor: '#E0E0E0',\n },\n text: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 12,\n lineHeight: 16,\n color: '#000000',\n },\n});\n\n// Chip styles\nexport const chipStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n paddingHorizontal: 12,\n paddingVertical: 6,\n borderRadius: 16,\n backgroundColor: '#F5F5F5',\n borderWidth: 1,\n borderColor: '#E0E0E0',\n },\n text: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// Divider styles\nexport const dividerStyles = createComponentStyles({\n root: {\n gap: 8,\n },\n label: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 12,\n lineHeight: 16,\n color: '#000000',\n },\n line: {\n borderWidth: 1,\n borderColor: '#E0E0E0',\n },\n});\n\n// Link styles\nexport const linkStyles = createComponentStyles({\n root: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n text: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#6001D2',\n textDecorationLine: 'underline',\n },\n});\n\n// Radio styles\nexport const radioStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n circle: {\n width: 20,\n height: 20,\n borderRadius: 10,\n borderWidth: 2,\n borderColor: '#6001D2',\n backgroundColor: 'transparent',\n },\n dot: {\n width: 10,\n height: 10,\n borderRadius: 5,\n backgroundColor: '#6001D2',\n },\n label: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// IconButton styles\nexport const iconButtonStyles = createComponentStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: 8,\n backgroundColor: 'transparent',\n },\n icon: {\n fontSize: 24,\n color: '#000000',\n },\n});\n\n// Tabs (tab list chrome)\nexport const tabsStyles = createComponentStyles({\n root: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n});\n\n// Type for StyleProps\nexport interface StyleProps {\n color?: string;\n backgroundColor?: string;\n borderColor?: string;\n borderWidth?: number;\n borderRadius?: number;\n [key: string]: unknown;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,oBAAoB;CAExB,SAAS;CACT,eAAe;CACf,YAAY;CACZ,gBAAgB;CAEhB,SAAS;CACT,mBAAmB;CACnB,iBAAiB;CACjB,QAAQ;CACR,KAAK;CAEL,iBAAiB;CACjB,OAAO;CACP,aAAa;CAEb,aAAa;CACb,cAAc;CAEd,YAAY;CACZ,UAAU;CACV,YAAY;CACZ,YAAY;CAEZ,SAAS;CACT,WAAW;CACZ;AAGD,SAAS,kBAAkB,aAAsC,EAAE,EAAE;CAoCnE,OAAO,IAnCW,MAChB;EAAE,GAAG;EAAmB,GAAG;EAAY,aAAa,KAAK,IAAI;EAAE,EAC/D,EACE,IAAI,QAAQ,MAAM;EAChB,IAAI,SAAS,eACX,OAAO,KAAK,IAAI;EAElB,IAAI,QAAQ,QACV,OAAO,OAAO;EAGhB,IAAI,OAAO,SAAS,UAAU;GAC5B,IAAI,KAAK,SAAS,QAAQ,IAAI,KAAK,SAAS,QAAQ,EAClD,OAAO;GAET,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CACN,EACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg.js","names":[],"sources":["../../../src/jest/mocks/svg.tsx"],"sourcesContent":["/**\n * Jest mock for react-native-svg.\n *\n * Provides minimal implementations for testing components\n * that render SVG icons.\n */\n\nimport type { PropsWithChildren } from 'react';\nimport React from 'react';\nimport { View } from 'react-native';\n\n// Common SVG element props\ninterface SvgProps extends PropsWithChildren {\n width?: number | string;\n height?: number | string;\n viewBox?: string;\n fill?: string;\n stroke?: string;\n style?: object;\n testID?: string;\n}\n\n// Main Svg component\nfunction Svg({ children, testID = 'Svg', style, ...props }: SvgProps) {\n return (\n <View testID={testID} style={style as object} {...props}>\n {children}\n </View>\n );\n}\n\n// SvgXml for inline XML rendering (used by Icon multicolor)\nfunction SvgXml({\n xml: _xml,\n width,\n height,\n ...props\n}: {\n xml: string;\n width?: number | string;\n height?: number | string;\n}) {\n return (\n <View testID=\"SvgXml\" style={{ width: width as number, height: height as number }} {...props} />\n );\n}\n\n// SvgUri for remote SVG loading\nfunction SvgUri({\n uri: _uri,\n width,\n height,\n ...props\n}: {\n uri: string;\n width?: number | string;\n height?: number | string;\n}) {\n return (\n <View testID=\"SvgUri\" style={{ width: width as number, height: height as number }} {...props} />\n );\n}\n\n// SVG shape elements - render as View with testID\n// Using a helper to create shape components with proper typing\nfunction createShapeComponent(testID: string) {\n return function ShapeComponent({ children, style }: SvgProps) {\n return (\n <View testID={testID} style={style as object}>\n {children}\n </View>\n );\n };\n}\n\nconst Circle = createShapeComponent('Circle');\nconst Rect = createShapeComponent('Rect');\nconst Path = createShapeComponent('Path');\nconst Line = createShapeComponent('Line');\nconst Polygon = createShapeComponent('Polygon');\nconst Polyline = createShapeComponent('Polyline');\nconst Ellipse = createShapeComponent('Ellipse');\nconst SvgText = createShapeComponent('SvgText');\nconst TSpan = createShapeComponent('TSpan');\nconst TextPath = createShapeComponent('TextPath');\nconst G = createShapeComponent('G');\nconst Use = createShapeComponent('Use');\nconst Defs = createShapeComponent('Defs');\nconst ClipPath = createShapeComponent('ClipPath');\nconst Mask = createShapeComponent('Mask');\nconst LinearGradient = createShapeComponent('LinearGradient');\nconst RadialGradient = createShapeComponent('RadialGradient');\nconst Stop = createShapeComponent('Stop');\nconst Pattern = createShapeComponent('Pattern');\nconst SvgSymbol = createShapeComponent('Symbol');\nconst SvgImage = createShapeComponent('SvgImage');\nconst ForeignObject = createShapeComponent('ForeignObject');\nconst Marker = createShapeComponent('Marker');\n\nexport default Svg;\n\n// Export with react-native-svg compatible names\nexport {\n Circle,\n ClipPath,\n Defs,\n Ellipse,\n ForeignObject,\n G,\n SvgImage as Image,\n Line,\n LinearGradient,\n Marker,\n Mask,\n Path,\n Pattern,\n Polygon,\n Polyline,\n RadialGradient,\n Rect,\n Stop,\n Svg,\n SvgUri,\n SvgXml,\n SvgSymbol as Symbol,\n SvgText as Text,\n TextPath,\n TSpan,\n Use,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,IAAI,EAAE,UAAU,SAAS,OAAO,OAAO,GAAG,SAAmB;
|
|
1
|
+
{"version":3,"file":"svg.js","names":[],"sources":["../../../src/jest/mocks/svg.tsx"],"sourcesContent":["/**\n * Jest mock for react-native-svg.\n *\n * Provides minimal implementations for testing components\n * that render SVG icons.\n */\n\nimport type { PropsWithChildren } from 'react';\nimport React from 'react';\nimport { View } from 'react-native';\n\n// Common SVG element props\ninterface SvgProps extends PropsWithChildren {\n width?: number | string;\n height?: number | string;\n viewBox?: string;\n fill?: string;\n stroke?: string;\n style?: object;\n testID?: string;\n}\n\n// Main Svg component\nfunction Svg({ children, testID = 'Svg', style, ...props }: SvgProps) {\n return (\n <View testID={testID} style={style as object} {...props}>\n {children}\n </View>\n );\n}\n\n// SvgXml for inline XML rendering (used by Icon multicolor)\nfunction SvgXml({\n xml: _xml,\n width,\n height,\n ...props\n}: {\n xml: string;\n width?: number | string;\n height?: number | string;\n}) {\n return (\n <View testID=\"SvgXml\" style={{ width: width as number, height: height as number }} {...props} />\n );\n}\n\n// SvgUri for remote SVG loading\nfunction SvgUri({\n uri: _uri,\n width,\n height,\n ...props\n}: {\n uri: string;\n width?: number | string;\n height?: number | string;\n}) {\n return (\n <View testID=\"SvgUri\" style={{ width: width as number, height: height as number }} {...props} />\n );\n}\n\n// SVG shape elements - render as View with testID\n// Using a helper to create shape components with proper typing\nfunction createShapeComponent(testID: string) {\n return function ShapeComponent({ children, style }: SvgProps) {\n return (\n <View testID={testID} style={style as object}>\n {children}\n </View>\n );\n };\n}\n\nconst Circle = createShapeComponent('Circle');\nconst Rect = createShapeComponent('Rect');\nconst Path = createShapeComponent('Path');\nconst Line = createShapeComponent('Line');\nconst Polygon = createShapeComponent('Polygon');\nconst Polyline = createShapeComponent('Polyline');\nconst Ellipse = createShapeComponent('Ellipse');\nconst SvgText = createShapeComponent('SvgText');\nconst TSpan = createShapeComponent('TSpan');\nconst TextPath = createShapeComponent('TextPath');\nconst G = createShapeComponent('G');\nconst Use = createShapeComponent('Use');\nconst Defs = createShapeComponent('Defs');\nconst ClipPath = createShapeComponent('ClipPath');\nconst Mask = createShapeComponent('Mask');\nconst LinearGradient = createShapeComponent('LinearGradient');\nconst RadialGradient = createShapeComponent('RadialGradient');\nconst Stop = createShapeComponent('Stop');\nconst Pattern = createShapeComponent('Pattern');\nconst SvgSymbol = createShapeComponent('Symbol');\nconst SvgImage = createShapeComponent('SvgImage');\nconst ForeignObject = createShapeComponent('ForeignObject');\nconst Marker = createShapeComponent('Marker');\n\nexport default Svg;\n\n// Export with react-native-svg compatible names\nexport {\n Circle,\n ClipPath,\n Defs,\n Ellipse,\n ForeignObject,\n G,\n SvgImage as Image,\n Line,\n LinearGradient,\n Marker,\n Mask,\n Path,\n Pattern,\n Polygon,\n Polyline,\n RadialGradient,\n Rect,\n Stop,\n Svg,\n SvgUri,\n SvgXml,\n SvgSymbol as Symbol,\n SvgText as Text,\n TextPath,\n TSpan,\n Use,\n};\n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,qBAAqB,UAAU;AAC/C,MAAM,YAAY,qBAAqB,SAAS;AAChD,MAAM,WAAW,qBAAqB,WAAW;AACjD,MAAM,gBAAgB,qBAAqB,gBAAgB;AAC3D,MAAM,SAAS,qBAAqB,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unistyles.js","names":[],"sources":["../../../src/jest/mocks/unistyles.ts"],"sourcesContent":["/**\n * Jest mock for react-native-unistyles.\n *\n * Provides minimal implementations of:\n * - useUnistyles() hook\n * - StyleSheet.create() / StyleSheet.configure()\n * - UnistylesRuntime\n */\n\n/// <reference types=\"jest\" />\n\nconst mockTheme = {\n colors: {\n text: {\n primary: '#000000',\n secondary: '#666666',\n tertiary: '#999999',\n muted: '#CCCCCC',\n onColor: '#FFFFFF',\n brand: '#6001D2',\n alert: '#D93025',\n positive: '#188038',\n warning: '#F29900',\n info: '#1A73E8',\n },\n background: {\n primary: '#FFFFFF',\n secondary: '#F5F5F5',\n accent: '#E8E0F0',\n brand: '#6001D2',\n 'brand-secondary': '#F3E8FF',\n alert: '#D93025',\n 'alert-secondary': '#FDECEA',\n positive: '#188038',\n 'positive-secondary': '#E6F4EA',\n warning: '#F29900',\n 'warning-secondary': '#FEF7E0',\n info: '#1A73E8',\n 'info-secondary': '#E8F0FE',\n 'elevation-0': '#FFFFFF',\n 'elevation-1': '#FFFFFF',\n 'elevation-2': '#FFFFFF',\n 'elevation-3': '#FFFFFF',\n 'elevation-4': '#FFFFFF',\n 'elevation-5': '#FFFFFF',\n },\n border: {\n primary: '#E0E0E0',\n secondary: '#CCCCCC',\n },\n },\n spacing: {\n '0': 0,\n '1': 4,\n '2': 8,\n '3': 12,\n '4': 16,\n '5': 20,\n '6': 24,\n '8': 32,\n '10': 40,\n '12': 48,\n },\n borderRadius: {\n none: 0,\n xs: 2,\n sm: 4,\n md: 8,\n lg: 12,\n xl: 16,\n full: 9999,\n },\n components: {},\n};\n\nconst mockRuntime = {\n themeName: 'light' as 'light' | 'dark',\n colorScheme: 'light' as 'light' | 'dark',\n setTheme: jest.fn(),\n setColorScheme: jest.fn(),\n screen: {\n width: 375,\n height: 812,\n },\n insets: {\n top: 44,\n bottom: 34,\n left: 0,\n right: 0,\n },\n statusBar: {\n height: 44,\n },\n navigationBar: {\n height: 0,\n },\n};\n\nconst useUnistyles = jest.fn(() => ({\n theme: mockTheme,\n rt: mockRuntime,\n}));\n\nconst useInitialTheme = jest.fn();\n\n// StyleSheet mock that handles both static and dynamic styles\nconst createStyleSheet = (styleCreator: unknown) => {\n // If it's a function (dynamic styles), call it with mock theme\n if (typeof styleCreator === 'function') {\n const styles = styleCreator(mockTheme, mockRuntime);\n // Add useVariants as a no-op for each style object\n if (styles && typeof styles === 'object') {\n const result = { ...styles };\n for (const key of Object.keys(result)) {\n const styleObj = result[key];\n if (styleObj && typeof styleObj === 'object') {\n (styleObj as Record<string, unknown>).useVariants = jest.fn();\n }\n }\n return result;\n }\n return styles;\n }\n // Static styles, return as-is\n return styleCreator;\n};\n\nconst StyleSheet = {\n create: createStyleSheet,\n configure: jest.fn(),\n};\n\nconst UnistylesRuntime = mockRuntime;\n\n// react-native-unistyles/reanimated exports\n// These are used for animated theme values in components like Button, Switch, Link, IconButton\n\nconst useAnimatedTheme = jest.fn(() => ({\n value: mockTheme,\n}));\n\nconst useAnimatedVariantColor = jest.fn((_path: string, fallback?: string) => ({\n value: fallback ?? '#000000',\n}));\n\n// All exports at the end of the file\nexport {\n StyleSheet,\n UnistylesRuntime,\n useAnimatedTheme,\n useAnimatedVariantColor,\n useInitialTheme,\n useUnistyles,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAWA,MAAM,YAAY;CAChB,QAAQ;EACN,MAAM;GACJ,SAAS;GACT,WAAW;GACX,UAAU;GACV,OAAO;GACP,SAAS;GACT,OAAO;GACP,OAAO;GACP,UAAU;GACV,SAAS;GACT,MAAM;GACP;EACD,YAAY;GACV,SAAS;GACT,WAAW;GACX,QAAQ;GACR,OAAO;GACP,mBAAmB;GACnB,OAAO;GACP,mBAAmB;GACnB,UAAU;GACV,sBAAsB;GACtB,SAAS;GACT,qBAAqB;GACrB,MAAM;GACN,kBAAkB;GAClB,eAAe;GACf,eAAe;GACf,eAAe;GACf,eAAe;GACf,eAAe;GACf,eAAe;GAChB;EACD,QAAQ;GACN,SAAS;GACT,WAAW;GACZ;EACF;CACD,SAAS;EACP,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,MAAM;EACN,MAAM;EACP;CACD,cAAc;EACZ,MAAM;EACN,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,MAAM;EACP;CACD,YAAY,EAAE;CACf;AAED,MAAM,cAAc;CAClB,WAAW;CACX,aAAa;CACb,UAAU,KAAK,IAAI;CACnB,gBAAgB,KAAK,IAAI;CACzB,QAAQ;EACN,OAAO;EACP,QAAQ;EACT;CACD,QAAQ;EACN,KAAK;EACL,QAAQ;EACR,MAAM;EACN,OAAO;EACR;CACD,WAAW,EACT,QAAQ,IACT;CACD,eAAe,EACb,QAAQ,GACT;CACF;AAED,MAAM,eAAe,KAAK,UAAU;CAClC,OAAO;CACP,IAAI;CACL,EAAE;AAEH,MAAM,kBAAkB,KAAK,IAAI;AAGjC,MAAM,oBAAoB,iBAA0B;
|
|
1
|
+
{"version":3,"file":"unistyles.js","names":[],"sources":["../../../src/jest/mocks/unistyles.ts"],"sourcesContent":["/**\n * Jest mock for react-native-unistyles.\n *\n * Provides minimal implementations of:\n * - useUnistyles() hook\n * - StyleSheet.create() / StyleSheet.configure()\n * - UnistylesRuntime\n */\n\n/// <reference types=\"jest\" />\n\nconst mockTheme = {\n colors: {\n text: {\n primary: '#000000',\n secondary: '#666666',\n tertiary: '#999999',\n muted: '#CCCCCC',\n onColor: '#FFFFFF',\n brand: '#6001D2',\n alert: '#D93025',\n positive: '#188038',\n warning: '#F29900',\n info: '#1A73E8',\n },\n background: {\n primary: '#FFFFFF',\n secondary: '#F5F5F5',\n accent: '#E8E0F0',\n brand: '#6001D2',\n 'brand-secondary': '#F3E8FF',\n alert: '#D93025',\n 'alert-secondary': '#FDECEA',\n positive: '#188038',\n 'positive-secondary': '#E6F4EA',\n warning: '#F29900',\n 'warning-secondary': '#FEF7E0',\n info: '#1A73E8',\n 'info-secondary': '#E8F0FE',\n 'elevation-0': '#FFFFFF',\n 'elevation-1': '#FFFFFF',\n 'elevation-2': '#FFFFFF',\n 'elevation-3': '#FFFFFF',\n 'elevation-4': '#FFFFFF',\n 'elevation-5': '#FFFFFF',\n },\n border: {\n primary: '#E0E0E0',\n secondary: '#CCCCCC',\n },\n },\n spacing: {\n '0': 0,\n '1': 4,\n '2': 8,\n '3': 12,\n '4': 16,\n '5': 20,\n '6': 24,\n '8': 32,\n '10': 40,\n '12': 48,\n },\n borderRadius: {\n none: 0,\n xs: 2,\n sm: 4,\n md: 8,\n lg: 12,\n xl: 16,\n full: 9999,\n },\n components: {},\n};\n\nconst mockRuntime = {\n themeName: 'light' as 'light' | 'dark',\n colorScheme: 'light' as 'light' | 'dark',\n setTheme: jest.fn(),\n setColorScheme: jest.fn(),\n screen: {\n width: 375,\n height: 812,\n },\n insets: {\n top: 44,\n bottom: 34,\n left: 0,\n right: 0,\n },\n statusBar: {\n height: 44,\n },\n navigationBar: {\n height: 0,\n },\n};\n\nconst useUnistyles = jest.fn(() => ({\n theme: mockTheme,\n rt: mockRuntime,\n}));\n\nconst useInitialTheme = jest.fn();\n\n// StyleSheet mock that handles both static and dynamic styles\nconst createStyleSheet = (styleCreator: unknown) => {\n // If it's a function (dynamic styles), call it with mock theme\n if (typeof styleCreator === 'function') {\n const styles = styleCreator(mockTheme, mockRuntime);\n // Add useVariants as a no-op for each style object\n if (styles && typeof styles === 'object') {\n const result = { ...styles };\n for (const key of Object.keys(result)) {\n const styleObj = result[key];\n if (styleObj && typeof styleObj === 'object') {\n (styleObj as Record<string, unknown>).useVariants = jest.fn();\n }\n }\n return result;\n }\n return styles;\n }\n // Static styles, return as-is\n return styleCreator;\n};\n\nconst StyleSheet = {\n create: createStyleSheet,\n configure: jest.fn(),\n};\n\nconst UnistylesRuntime = mockRuntime;\n\n// react-native-unistyles/reanimated exports\n// These are used for animated theme values in components like Button, Switch, Link, IconButton\n\nconst useAnimatedTheme = jest.fn(() => ({\n value: mockTheme,\n}));\n\nconst useAnimatedVariantColor = jest.fn((_path: string, fallback?: string) => ({\n value: fallback ?? '#000000',\n}));\n\n// All exports at the end of the file\nexport {\n StyleSheet,\n UnistylesRuntime,\n useAnimatedTheme,\n useAnimatedVariantColor,\n useInitialTheme,\n useUnistyles,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAWA,MAAM,YAAY;CAChB,QAAQ;EACN,MAAM;GACJ,SAAS;GACT,WAAW;GACX,UAAU;GACV,OAAO;GACP,SAAS;GACT,OAAO;GACP,OAAO;GACP,UAAU;GACV,SAAS;GACT,MAAM;GACP;EACD,YAAY;GACV,SAAS;GACT,WAAW;GACX,QAAQ;GACR,OAAO;GACP,mBAAmB;GACnB,OAAO;GACP,mBAAmB;GACnB,UAAU;GACV,sBAAsB;GACtB,SAAS;GACT,qBAAqB;GACrB,MAAM;GACN,kBAAkB;GAClB,eAAe;GACf,eAAe;GACf,eAAe;GACf,eAAe;GACf,eAAe;GACf,eAAe;GAChB;EACD,QAAQ;GACN,SAAS;GACT,WAAW;GACZ;EACF;CACD,SAAS;EACP,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,MAAM;EACN,MAAM;EACP;CACD,cAAc;EACZ,MAAM;EACN,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,MAAM;EACP;CACD,YAAY,EAAE;CACf;AAED,MAAM,cAAc;CAClB,WAAW;CACX,aAAa;CACb,UAAU,KAAK,IAAI;CACnB,gBAAgB,KAAK,IAAI;CACzB,QAAQ;EACN,OAAO;EACP,QAAQ;EACT;CACD,QAAQ;EACN,KAAK;EACL,QAAQ;EACR,MAAM;EACN,OAAO;EACR;CACD,WAAW,EACT,QAAQ,IACT;CACD,eAAe,EACb,QAAQ,GACT;CACF;AAED,MAAM,eAAe,KAAK,UAAU;CAClC,OAAO;CACP,IAAI;CACL,EAAE;AAEH,MAAM,kBAAkB,KAAK,IAAI;AAGjC,MAAM,oBAAoB,iBAA0B;CAElD,IAAI,OAAO,iBAAiB,YAAY;EACtC,MAAM,SAAS,aAAa,WAAW,YAAY;EAEnD,IAAI,UAAU,OAAO,WAAW,UAAU;GACxC,MAAM,SAAS,EAAE,GAAG,QAAQ;GAC5B,KAAK,MAAM,OAAO,OAAO,KAAK,OAAO,EAAE;IACrC,MAAM,WAAW,OAAO;IACxB,IAAI,YAAY,OAAO,aAAa,UAClC,SAAsC,cAAc,KAAK,IAAI;;GAGjE,OAAO;;EAET,OAAO;;CAGT,OAAO;;AAGT,MAAM,aAAa;CACjB,QAAQ;CACR,WAAW,KAAK,IAAI;CACrB;AAED,MAAM,mBAAmB;AAKzB,MAAM,mBAAmB,KAAK,UAAU,EACtC,OAAO,WACR,EAAE;AAEH,MAAM,0BAA0B,KAAK,IAAI,OAAe,cAAuB,EAC7E,OAAO,YAAY,WACpB,EAAE"}
|
package/dist/jest/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","names":["mockUnistyles","mockUnistyles.useAnimatedTheme","mockUnistyles.useAnimatedVariantColor","mockReanimated","mockSvg","mockIcons.glyphMap","mockIcons.glyphNames","mockIcons.svgMap","mockIcons.svgGlyphNames","mockIcons.ICON_SIZE_MAP"],"sources":["../../src/jest/setup.ts"],"sourcesContent":["/**\n * Registers Jest mocks for native dependencies.\n */\n\n// Jest allows variables prefixed with 'mock' in jest.mock() factories\nimport * as mockIcons from './mocks/icons';\nimport * as mockReanimated from './mocks/reanimated';\nimport * as mockSvg from './mocks/svg';\nimport * as mockUnistyles from './mocks/unistyles';\n\nlet isSetup = false;\n\nexport function setupUDSMobileJest(): void {\n if (isSetup) {\n return;\n }\n\n jest.mock('react-native-unistyles', () => mockUnistyles);\n\n jest.mock('react-native-unistyles/reanimated', () => ({\n useAnimatedTheme: mockUnistyles.useAnimatedTheme,\n useAnimatedVariantColor: mockUnistyles.useAnimatedVariantColor,\n }));\n\n jest.mock('react-native-reanimated', () => mockReanimated);\n\n jest.mock('react-native-svg', () => mockSvg);\n\n jest.mock('@yahoo/uds-icons/glyphMap', () => ({\n glyphMap: mockIcons.glyphMap,\n glyphNames: mockIcons.glyphNames,\n }));\n\n jest.mock('@yahoo/uds-icons/svgMap', () => ({\n svgMap: mockIcons.svgMap,\n svgGlyphNames: mockIcons.svgGlyphNames,\n }));\n\n jest.mock('@yahoo/uds-icons/tokens', () => ({\n ICON_SIZE_MAP: mockIcons.ICON_SIZE_MAP,\n }));\n\n isSetup = true;\n}\n\n/** @internal */\nexport function resetSetupState(): void {\n isSetup = false;\n}\n"],"mappings":";;;;;;;;;AAUA,IAAI,UAAU;AAEd,SAAgB,qBAA2B;
|
|
1
|
+
{"version":3,"file":"setup.js","names":["mockUnistyles","mockUnistyles.useAnimatedTheme","mockUnistyles.useAnimatedVariantColor","mockReanimated","mockSvg","mockIcons.glyphMap","mockIcons.glyphNames","mockIcons.svgMap","mockIcons.svgGlyphNames","mockIcons.ICON_SIZE_MAP"],"sources":["../../src/jest/setup.ts"],"sourcesContent":["/**\n * Registers Jest mocks for native dependencies.\n */\n\n// Jest allows variables prefixed with 'mock' in jest.mock() factories\nimport * as mockIcons from './mocks/icons';\nimport * as mockReanimated from './mocks/reanimated';\nimport * as mockSvg from './mocks/svg';\nimport * as mockUnistyles from './mocks/unistyles';\n\nlet isSetup = false;\n\nexport function setupUDSMobileJest(): void {\n if (isSetup) {\n return;\n }\n\n jest.mock('react-native-unistyles', () => mockUnistyles);\n\n jest.mock('react-native-unistyles/reanimated', () => ({\n useAnimatedTheme: mockUnistyles.useAnimatedTheme,\n useAnimatedVariantColor: mockUnistyles.useAnimatedVariantColor,\n }));\n\n jest.mock('react-native-reanimated', () => mockReanimated);\n\n jest.mock('react-native-svg', () => mockSvg);\n\n jest.mock('@yahoo/uds-icons/glyphMap', () => ({\n glyphMap: mockIcons.glyphMap,\n glyphNames: mockIcons.glyphNames,\n }));\n\n jest.mock('@yahoo/uds-icons/svgMap', () => ({\n svgMap: mockIcons.svgMap,\n svgGlyphNames: mockIcons.svgGlyphNames,\n }));\n\n jest.mock('@yahoo/uds-icons/tokens', () => ({\n ICON_SIZE_MAP: mockIcons.ICON_SIZE_MAP,\n }));\n\n isSetup = true;\n}\n\n/** @internal */\nexport function resetSetupState(): void {\n isSetup = false;\n}\n"],"mappings":";;;;;;;;;AAUA,IAAI,UAAU;AAEd,SAAgB,qBAA2B;CACzC,IAAI,SACF;CAGF,KAAK,KAAK,gCAAgCA,kBAAc;CAExD,KAAK,KAAK,4CAA4C;EAClCC;EACOC;EAC1B,EAAE;CAEH,KAAK,KAAK,iCAAiCC,mBAAe;CAE1D,KAAK,KAAK,0BAA0BC,YAAQ;CAE5C,KAAK,KAAK,oCAAoC;EAClCC;EACEC;EACb,EAAE;CAEH,KAAK,KAAK,kCAAkC;EAClCC;EACOC;EAChB,EAAE;CAEH,KAAK,KAAK,kCAAkC,EAC3BC,eAChB,EAAE;CAEH,UAAU;;;AAIZ,SAAgB,kBAAwB;CACtC,UAAU"}
|
package/dist/portal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal.js","names":[],"sources":["../src/portal.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport {\n createContext,\n memo,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useReducer,\n} from 'react';\nimport { StyleSheet, View } from 'react-native';\n\n// ---------------------------------------------------------------------------\n// State\n// ---------------------------------------------------------------------------\n\ntype PortalState = Map<string, ReactNode>;\n\ntype PortalAction =\n | { type: 'register'; id: string; node: ReactNode }\n | { type: 'unregister'; id: string };\n\nfunction portalReducer(state: PortalState, action: PortalAction): PortalState {\n switch (action.type) {\n case 'register': {\n const next = new Map(state);\n next.set(action.id, action.node);\n return next;\n }\n case 'unregister': {\n if (!state.has(action.id)) {\n return state;\n }\n const next = new Map(state);\n next.delete(action.id);\n return next;\n }\n }\n}\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\ninterface PortalContextValue {\n register: (id: string, node: ReactNode) => void;\n unregister: (id: string) => void;\n}\n\nconst PortalContext = createContext<PortalContextValue | null>(null);\n\nfunction usePortalContext(): PortalContextValue {\n const ctx = useContext(PortalContext);\n if (!ctx) {\n throw new Error('Portal must be used within a UDSProvider.');\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// PortalHost — renders registered portals. Place after children for z-order.\n// ---------------------------------------------------------------------------\n\nconst PortalHost = memo(function PortalHost({ state }: { state: PortalState }) {\n if (state.size === 0) {\n return null;\n }\n\n const nodes: ReactNode[] = [];\n state.forEach((node, id) => {\n nodes.push(\n <View key={id} style={styles.overlay} pointerEvents=\"box-none\">\n {node}\n </View>,\n );\n });\n return nodes;\n});\n\n// ---------------------------------------------------------------------------\n// Portal — registers children with the host. Renders nothing itself.\n// ---------------------------------------------------------------------------\n\nfunction Portal({ children }: { children: ReactNode }) {\n const id = useId();\n const { register, unregister } = usePortalContext();\n\n useEffect(() => {\n register(id, children);\n }, [id, children, register]);\n\n useEffect(() => {\n return () => unregister(id);\n }, [id, unregister]);\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// PortalProvider — sets up the portal context and host.\n// ---------------------------------------------------------------------------\n\nfunction PortalProvider({ children }: { children: ReactNode }) {\n const [state, dispatch] = useReducer(portalReducer, new Map() as PortalState);\n\n const register = useCallback(\n (id: string, node: ReactNode) => dispatch({ type: 'register', id, node }),\n [],\n );\n const unregister = useCallback((id: string) => dispatch({ type: 'unregister', id }), []);\n\n const contextValue = useMemo(() => ({ register, unregister }), [register, unregister]);\n\n return (\n <PortalContext.Provider value={contextValue}>\n {children}\n <PortalHost state={state} />\n </PortalContext.Provider>\n );\n}\n\nconst styles = StyleSheet.create({\n overlay: {\n ...StyleSheet.absoluteFill,\n },\n});\n\nexport { Portal, PortalProvider };\n"],"mappings":";;;;;AAuBA,SAAS,cAAc,OAAoB,QAAmC;
|
|
1
|
+
{"version":3,"file":"portal.js","names":[],"sources":["../src/portal.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport {\n createContext,\n memo,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useReducer,\n} from 'react';\nimport { StyleSheet, View } from 'react-native';\n\n// ---------------------------------------------------------------------------\n// State\n// ---------------------------------------------------------------------------\n\ntype PortalState = Map<string, ReactNode>;\n\ntype PortalAction =\n | { type: 'register'; id: string; node: ReactNode }\n | { type: 'unregister'; id: string };\n\nfunction portalReducer(state: PortalState, action: PortalAction): PortalState {\n switch (action.type) {\n case 'register': {\n const next = new Map(state);\n next.set(action.id, action.node);\n return next;\n }\n case 'unregister': {\n if (!state.has(action.id)) {\n return state;\n }\n const next = new Map(state);\n next.delete(action.id);\n return next;\n }\n }\n}\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\ninterface PortalContextValue {\n register: (id: string, node: ReactNode) => void;\n unregister: (id: string) => void;\n}\n\nconst PortalContext = createContext<PortalContextValue | null>(null);\n\nfunction usePortalContext(): PortalContextValue {\n const ctx = useContext(PortalContext);\n if (!ctx) {\n throw new Error('Portal must be used within a UDSProvider.');\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// PortalHost — renders registered portals. Place after children for z-order.\n// ---------------------------------------------------------------------------\n\nconst PortalHost = memo(function PortalHost({ state }: { state: PortalState }) {\n if (state.size === 0) {\n return null;\n }\n\n const nodes: ReactNode[] = [];\n state.forEach((node, id) => {\n nodes.push(\n <View key={id} style={styles.overlay} pointerEvents=\"box-none\">\n {node}\n </View>,\n );\n });\n return nodes;\n});\n\n// ---------------------------------------------------------------------------\n// Portal — registers children with the host. Renders nothing itself.\n// ---------------------------------------------------------------------------\n\nfunction Portal({ children }: { children: ReactNode }) {\n const id = useId();\n const { register, unregister } = usePortalContext();\n\n useEffect(() => {\n register(id, children);\n }, [id, children, register]);\n\n useEffect(() => {\n return () => unregister(id);\n }, [id, unregister]);\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// PortalProvider — sets up the portal context and host.\n// ---------------------------------------------------------------------------\n\nfunction PortalProvider({ children }: { children: ReactNode }) {\n const [state, dispatch] = useReducer(portalReducer, new Map() as PortalState);\n\n const register = useCallback(\n (id: string, node: ReactNode) => dispatch({ type: 'register', id, node }),\n [],\n );\n const unregister = useCallback((id: string) => dispatch({ type: 'unregister', id }), []);\n\n const contextValue = useMemo(() => ({ register, unregister }), [register, unregister]);\n\n return (\n <PortalContext.Provider value={contextValue}>\n {children}\n <PortalHost state={state} />\n </PortalContext.Provider>\n );\n}\n\nconst styles = StyleSheet.create({\n overlay: {\n ...StyleSheet.absoluteFill,\n },\n});\n\nexport { Portal, PortalProvider };\n"],"mappings":";;;;;AAuBA,SAAS,cAAc,OAAoB,QAAmC;CAC5E,QAAQ,OAAO,MAAf;EACE,KAAK,YAAY;GACf,MAAM,OAAO,IAAI,IAAI,MAAM;GAC3B,KAAK,IAAI,OAAO,IAAI,OAAO,KAAK;GAChC,OAAO;;EAET,KAAK,cAAc;GACjB,IAAI,CAAC,MAAM,IAAI,OAAO,GAAG,EACvB,OAAO;GAET,MAAM,OAAO,IAAI,IAAI,MAAM;GAC3B,KAAK,OAAO,OAAO,GAAG;GACtB,OAAO;;;;AAcb,MAAM,gBAAgB,cAAyC,KAAK;AAEpE,SAAS,mBAAuC;CAC9C,MAAM,MAAM,WAAW,cAAc;CACrC,IAAI,CAAC,KACH,MAAM,IAAI,MAAM,4CAA4C;CAE9D,OAAO;;AAOT,MAAM,aAAa,KAAK,SAAS,WAAW,EAAE,SAAiC;CAC7E,IAAI,MAA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