@yahoo/uds-mobile 2.23.3 → 2.24.0-beta.10
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/README.md +41 -13
- package/dist/bin/automated-config/dist/generated/generatedConfigs.mjs +92 -46
- package/dist/components/Avatar/AvatarIcon.cjs +8 -2
- package/dist/components/Avatar/AvatarIcon.d.cts.map +1 -1
- package/dist/components/Avatar/AvatarIcon.d.ts.map +1 -1
- package/dist/components/Avatar/AvatarIcon.js +9 -3
- package/dist/components/Avatar/AvatarIcon.js.map +1 -1
- package/dist/components/Avatar/AvatarImage.cjs +9 -2
- package/dist/components/Avatar/AvatarImage.d.cts.map +1 -1
- package/dist/components/Avatar/AvatarImage.d.ts.map +1 -1
- package/dist/components/Avatar/AvatarImage.js +10 -3
- package/dist/components/Avatar/AvatarImage.js.map +1 -1
- package/dist/components/Avatar/AvatarText.cjs +8 -2
- package/dist/components/Avatar/AvatarText.d.cts.map +1 -1
- package/dist/components/Avatar/AvatarText.d.ts.map +1 -1
- package/dist/components/Avatar/AvatarText.js +9 -3
- package/dist/components/Avatar/AvatarText.js.map +1 -1
- package/dist/components/Avatar/types.d.cts +7 -3
- package/dist/components/Avatar/types.d.cts.map +1 -1
- package/dist/components/Avatar/types.d.ts +7 -3
- package/dist/components/Avatar/types.d.ts.map +1 -1
- package/dist/components/Avatar/useAvatarFontScale.cjs +16 -0
- package/dist/components/Avatar/useAvatarFontScale.d.cts +7 -0
- package/dist/components/Avatar/useAvatarFontScale.d.cts.map +1 -0
- package/dist/components/Avatar/useAvatarFontScale.d.ts +7 -0
- package/dist/components/Avatar/useAvatarFontScale.d.ts.map +1 -0
- package/dist/components/Avatar/useAvatarFontScale.js +16 -0
- package/dist/components/Avatar/useAvatarFontScale.js.map +1 -0
- package/dist/components/Avatar/utils.cjs +9 -6
- package/dist/components/Avatar/utils.d.cts +2 -2
- package/dist/components/Avatar/utils.d.cts.map +1 -1
- package/dist/components/Avatar/utils.d.ts +2 -2
- package/dist/components/Avatar/utils.d.ts.map +1 -1
- package/dist/components/Avatar/utils.js +9 -6
- package/dist/components/Avatar/utils.js.map +1 -1
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +1 -1
- package/dist/components/Button/buttonTheme.cjs +31 -9
- package/dist/components/Button/buttonTheme.d.cts +24 -5
- package/dist/components/Button/buttonTheme.d.cts.map +1 -1
- package/dist/components/Button/buttonTheme.d.ts +24 -5
- package/dist/components/Button/buttonTheme.d.ts.map +1 -1
- package/dist/components/Button/buttonTheme.js +31 -10
- package/dist/components/Button/buttonTheme.js.map +1 -1
- package/dist/components/Button.cjs +35 -8
- package/dist/components/Button.d.cts +7 -0
- package/dist/components/Button.d.cts.map +1 -1
- package/dist/components/Button.d.ts +7 -0
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +35 -8
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Checkbox.cjs +42 -9
- package/dist/components/Checkbox.d.cts +7 -0
- package/dist/components/Checkbox.d.cts.map +1 -1
- package/dist/components/Checkbox.d.ts +7 -0
- package/dist/components/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox.js +42 -9
- package/dist/components/Checkbox.js.map +1 -1
- package/dist/components/Chip/ChipBase.cjs +31 -14
- package/dist/components/Chip/ChipBase.d.cts.map +1 -1
- package/dist/components/Chip/ChipBase.d.ts.map +1 -1
- package/dist/components/Chip/ChipBase.js +31 -14
- package/dist/components/Chip/ChipBase.js.map +1 -1
- package/dist/components/Chip/ChipDismissible.cjs +3 -1
- package/dist/components/Chip/ChipDismissible.js +3 -1
- package/dist/components/Chip/ChipDismissible.js.map +1 -1
- package/dist/components/Chip/types.d.cts +7 -0
- package/dist/components/Chip/types.d.cts.map +1 -1
- package/dist/components/Chip/types.d.ts +7 -0
- package/dist/components/Chip/types.d.ts.map +1 -1
- package/dist/components/Icon.cjs +24 -5
- package/dist/components/Icon.d.cts +11 -2
- package/dist/components/Icon.d.cts.map +1 -1
- package/dist/components/Icon.d.ts +11 -2
- package/dist/components/Icon.d.ts.map +1 -1
- package/dist/components/Icon.js +24 -5
- package/dist/components/Icon.js.map +1 -1
- package/dist/components/IconButton.cjs +17 -6
- package/dist/components/IconButton.d.cts +6 -0
- package/dist/components/IconButton.d.cts.map +1 -1
- package/dist/components/IconButton.d.ts +6 -0
- package/dist/components/IconButton.d.ts.map +1 -1
- package/dist/components/IconButton.js +18 -7
- package/dist/components/IconButton.js.map +1 -1
- package/dist/components/Input.cjs +56 -18
- package/dist/components/Input.d.cts +5 -0
- package/dist/components/Input.d.cts.map +1 -1
- package/dist/components/Input.d.ts +5 -0
- package/dist/components/Input.d.ts.map +1 -1
- package/dist/components/Input.js +56 -18
- package/dist/components/Input.js.map +1 -1
- package/dist/components/InputHelpText.cjs +7 -1
- package/dist/components/InputHelpText.d.cts +2 -0
- package/dist/components/InputHelpText.d.cts.map +1 -1
- package/dist/components/InputHelpText.d.ts +2 -0
- package/dist/components/InputHelpText.d.ts.map +1 -1
- package/dist/components/InputHelpText.js +7 -1
- package/dist/components/InputHelpText.js.map +1 -1
- package/dist/components/Link.cjs +13 -1
- package/dist/components/Link.d.cts +7 -0
- package/dist/components/Link.d.cts.map +1 -1
- package/dist/components/Link.d.ts +7 -0
- package/dist/components/Link.d.ts.map +1 -1
- package/dist/components/Link.js +13 -1
- package/dist/components/Link.js.map +1 -1
- package/dist/components/Pagination/Pagination.cjs +18 -10
- package/dist/components/Pagination/Pagination.d.cts +2 -0
- package/dist/components/Pagination/Pagination.d.cts.map +1 -1
- package/dist/components/Pagination/Pagination.d.ts +2 -0
- package/dist/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/components/Pagination/Pagination.js +18 -10
- package/dist/components/Pagination/Pagination.js.map +1 -1
- package/dist/components/Pagination/PaginationEllipsis.cjs +8 -2
- package/dist/components/Pagination/PaginationEllipsis.d.cts.map +1 -1
- package/dist/components/Pagination/PaginationEllipsis.d.ts.map +1 -1
- package/dist/components/Pagination/PaginationEllipsis.js +9 -3
- package/dist/components/Pagination/PaginationEllipsis.js.map +1 -1
- package/dist/components/Pagination/PaginationItem.cjs +2 -1
- package/dist/components/Pagination/PaginationItem.js +2 -1
- package/dist/components/Pagination/PaginationItem.js.map +1 -1
- package/dist/components/Pagination/PaginationLink.cjs +2 -1
- package/dist/components/Pagination/PaginationLink.js +2 -1
- package/dist/components/Pagination/PaginationLink.js.map +1 -1
- package/dist/components/Pagination/PaginationNext.cjs +3 -1
- package/dist/components/Pagination/PaginationNext.js +3 -1
- package/dist/components/Pagination/PaginationNext.js.map +1 -1
- package/dist/components/Pagination/PaginationPrev.cjs +3 -1
- package/dist/components/Pagination/PaginationPrev.js +3 -1
- package/dist/components/Pagination/PaginationPrev.js.map +1 -1
- package/dist/components/Pagination/paginationContext.d.cts +2 -0
- package/dist/components/Pagination/paginationContext.d.cts.map +1 -1
- package/dist/components/Pagination/paginationContext.d.ts +2 -0
- package/dist/components/Pagination/paginationContext.d.ts.map +1 -1
- package/dist/components/Pagination/paginationContext.js.map +1 -1
- package/dist/components/Pagination/usePaginationControlStyles.cjs +8 -1
- package/dist/components/Pagination/usePaginationControlStyles.d.cts.map +1 -1
- package/dist/components/Pagination/usePaginationControlStyles.d.ts.map +1 -1
- package/dist/components/Pagination/usePaginationControlStyles.js +9 -2
- package/dist/components/Pagination/usePaginationControlStyles.js.map +1 -1
- package/dist/components/Radio/Radio.cjs +30 -11
- package/dist/components/Radio/Radio.d.cts +7 -0
- package/dist/components/Radio/Radio.d.cts.map +1 -1
- package/dist/components/Radio/Radio.d.ts +7 -0
- package/dist/components/Radio/Radio.d.ts.map +1 -1
- package/dist/components/Radio/Radio.js +30 -11
- package/dist/components/Radio/Radio.js.map +1 -1
- package/dist/components/Select/Select.cjs +29 -6
- package/dist/components/Select/Select.d.cts +2 -0
- package/dist/components/Select/Select.d.cts.map +1 -1
- package/dist/components/Select/Select.d.ts +2 -0
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.js +29 -6
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/SelectContent.cjs +31 -23
- package/dist/components/Select/SelectContent.d.cts.map +1 -1
- package/dist/components/Select/SelectContent.d.ts.map +1 -1
- package/dist/components/Select/SelectContent.js +32 -24
- package/dist/components/Select/SelectContent.js.map +1 -1
- package/dist/components/Select/SelectItem.cjs +25 -15
- package/dist/components/Select/SelectItem.d.cts.map +1 -1
- package/dist/components/Select/SelectItem.d.ts.map +1 -1
- package/dist/components/Select/SelectItem.js +25 -15
- package/dist/components/Select/SelectItem.js.map +1 -1
- package/dist/components/Select/SelectTrigger.cjs +27 -13
- package/dist/components/Select/SelectTrigger.d.cts.map +1 -1
- package/dist/components/Select/SelectTrigger.d.ts.map +1 -1
- package/dist/components/Select/SelectTrigger.js +27 -13
- package/dist/components/Select/SelectTrigger.js.map +1 -1
- package/dist/components/Select/types.d.cts +2 -0
- package/dist/components/Select/types.d.cts.map +1 -1
- package/dist/components/Select/types.d.ts +2 -0
- package/dist/components/Select/types.d.ts.map +1 -1
- package/dist/components/Switch.cjs +48 -8
- package/dist/components/Switch.d.cts +7 -0
- package/dist/components/Switch.d.cts.map +1 -1
- package/dist/components/Switch.d.ts +7 -0
- package/dist/components/Switch.d.ts.map +1 -1
- package/dist/components/Switch.js +48 -8
- package/dist/components/Switch.js.map +1 -1
- package/dist/components/Tabs/Tab.cjs +17 -3
- package/dist/components/Tabs/Tab.d.cts.map +1 -1
- package/dist/components/Tabs/Tab.d.ts.map +1 -1
- package/dist/components/Tabs/Tab.js +17 -3
- package/dist/components/Tabs/Tab.js.map +1 -1
- package/dist/components/Tabs/Tabs.cjs +8 -3
- package/dist/components/Tabs/Tabs.d.cts +9 -1
- package/dist/components/Tabs/Tabs.d.cts.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +9 -1
- package/dist/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.js +8 -3
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Tabs/tabsContexts.d.cts +2 -0
- package/dist/components/Tabs/tabsContexts.d.cts.map +1 -1
- package/dist/components/Tabs/tabsContexts.d.ts +2 -0
- package/dist/components/Tabs/tabsContexts.d.ts.map +1 -1
- package/dist/components/Tabs/tabsContexts.js.map +1 -1
- package/dist/components/Text.cjs +9 -1
- package/dist/components/Text.d.cts +11 -2
- package/dist/components/Text.d.cts.map +1 -1
- package/dist/components/Text.d.ts +11 -2
- package/dist/components/Text.d.ts.map +1 -1
- package/dist/components/Text.js +9 -1
- package/dist/components/Text.js.map +1 -1
- package/dist/components/UDSProvider.cjs +6 -2
- package/dist/components/UDSProvider.d.cts +9 -0
- package/dist/components/UDSProvider.d.cts.map +1 -1
- package/dist/components/UDSProvider.d.ts +9 -0
- package/dist/components/UDSProvider.d.ts.map +1 -1
- package/dist/components/UDSProvider.js +6 -2
- package/dist/components/UDSProvider.js.map +1 -1
- package/dist/components/internal/Overlay/index.cjs +1 -1
- package/dist/components/internal/Overlay/index.js +1 -1
- package/dist/fontScaling/FontScalingContext.cjs +67 -0
- package/dist/fontScaling/FontScalingContext.d.cts +53 -0
- package/dist/fontScaling/FontScalingContext.d.cts.map +1 -0
- package/dist/fontScaling/FontScalingContext.d.ts +53 -0
- package/dist/fontScaling/FontScalingContext.d.ts.map +1 -0
- package/dist/fontScaling/FontScalingContext.js +63 -0
- package/dist/fontScaling/FontScalingContext.js.map +1 -0
- package/dist/fontScaling/androidNonlinearFontScaling.cjs +250 -0
- package/dist/fontScaling/androidNonlinearFontScaling.d.cts +7 -0
- package/dist/fontScaling/androidNonlinearFontScaling.d.cts.map +1 -0
- package/dist/fontScaling/androidNonlinearFontScaling.d.ts +7 -0
- package/dist/fontScaling/androidNonlinearFontScaling.d.ts.map +1 -0
- package/dist/fontScaling/androidNonlinearFontScaling.js +251 -0
- package/dist/fontScaling/androidNonlinearFontScaling.js.map +1 -0
- package/dist/fontScaling/constants.cjs +106 -0
- package/dist/fontScaling/constants.d.cts +60 -0
- package/dist/fontScaling/constants.d.cts.map +1 -0
- package/dist/fontScaling/constants.d.ts +60 -0
- package/dist/fontScaling/constants.d.ts.map +1 -0
- package/dist/fontScaling/constants.js +103 -0
- package/dist/fontScaling/constants.js.map +1 -0
- package/dist/fontScaling/index.cjs +14 -0
- package/dist/fontScaling/index.d.cts +8 -0
- package/dist/fontScaling/index.d.ts +8 -0
- package/dist/fontScaling/index.js +6 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.cjs +37 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.cts +35 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.cts.map +1 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.ts +35 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.ts.map +1 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.js +38 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.js.map +1 -0
- package/dist/fontScaling/types.cjs +1 -0
- package/dist/fontScaling/types.d.cts +54 -0
- package/dist/fontScaling/types.d.cts.map +1 -0
- package/dist/fontScaling/types.d.ts +54 -0
- package/dist/fontScaling/types.d.ts.map +1 -0
- package/dist/fontScaling/types.js +1 -0
- package/dist/fontScaling/useFontScale.cjs +58 -0
- package/dist/fontScaling/useFontScale.d.cts +12 -0
- package/dist/fontScaling/useFontScale.d.cts.map +1 -0
- package/dist/fontScaling/useFontScale.d.ts +12 -0
- package/dist/fontScaling/useFontScale.d.ts.map +1 -0
- package/dist/fontScaling/useFontScale.js +57 -0
- package/dist/fontScaling/useFontScale.js.map +1 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.cjs +24 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.d.cts +16 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.d.cts.map +1 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.d.ts +16 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.d.ts.map +1 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.js +24 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.js.map +1 -0
- package/dist/jest/mocks/react-native.cjs +19 -4
- package/dist/jest/mocks/react-native.d.cts +8 -5
- package/dist/jest/mocks/react-native.d.cts.map +1 -1
- package/dist/jest/mocks/react-native.d.ts +8 -5
- package/dist/jest/mocks/react-native.d.ts.map +1 -1
- package/dist/jest/mocks/react-native.js +18 -5
- package/dist/jest/mocks/react-native.js.map +1 -1
- package/dist/jest/mocks/styles.cjs +28 -1
- package/dist/jest/mocks/styles.d.cts.map +1 -1
- package/dist/jest/mocks/styles.d.ts.map +1 -1
- package/dist/jest/mocks/styles.js +28 -1
- package/dist/jest/mocks/styles.js.map +1 -1
- package/dist/jest/setup.cjs +4 -0
- package/dist/jest/setup.d.cts.map +1 -1
- package/dist/jest/setup.d.ts.map +1 -1
- package/dist/jest/setup.js +4 -0
- package/dist/jest/setup.js.map +1 -1
- package/dist/mobile/generated/fontMetrics.cjs +530 -530
- package/dist/mobile/generated/fontMetrics.js +530 -530
- package/dist/mobile/generated/fontMetrics.js.map +1 -1
- package/dist/portal.cjs +8 -2
- package/dist/portal.d.cts.map +1 -1
- package/dist/portal.d.ts.map +1 -1
- package/dist/portal.js +8 -2
- package/dist/portal.js.map +1 -1
- package/dist/types/dist/index.d.cts.map +1 -1
- package/dist/types/dist/index.d.ts.map +1 -1
- package/fonts/index.cjs +214 -214
- package/fonts/index.mjs +214 -214
- package/fonts/uds-icons.ttf +0 -0
- package/generated/fontMetrics.ts +530 -530
- package/generated/styles.d.ts +5 -28
- package/generated/unistyles.d.ts +0 -27
- package/package.json +11 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationItem.js","names":["Text"],"sources":["../../../src/components/Pagination/PaginationItem.tsx"],"sourcesContent":["import type { UniversalPaginationItemProps } from '@yahoo/uds-types';\nimport { memo, useCallback, useMemo, useState } from 'react';\nimport type { PressableProps } from 'react-native';\nimport { Pressable, StyleSheet } from 'react-native';\n\nimport { Text } from '../Text';\nimport { usePaginationContext } from './paginationContext';\nimport { usePaginationControlStyles } from './usePaginationControlStyles';\n\n/** RN Pressable types differ from web button HTML attributes; keep parity fields only. */\ninterface PaginationItemProps extends Omit<PressableProps, 'children' | 'style' | 'disabled'> {\n page: UniversalPaginationItemProps['page'];\n children?: UniversalPaginationItemProps['children'];\n}\n\n/**\n * **PaginationItem — single page control**\n *\n * @description\n * Renders a page number control. Usually composed via {@link PaginationNumbers}.\n *\n * @category Navigation\n * @platform mobile\n */\nconst PaginationItem = memo(function PaginationItem({\n page,\n children,\n onPress,\n ...rest\n}: PaginationItemProps) {\n const { activePage, size, variant, getItemAriaLabel, onPageChange }
|
|
1
|
+
{"version":3,"file":"PaginationItem.js","names":["Text"],"sources":["../../../src/components/Pagination/PaginationItem.tsx"],"sourcesContent":["import type { UniversalPaginationItemProps } from '@yahoo/uds-types';\nimport { memo, useCallback, useMemo, useState } from 'react';\nimport type { PressableProps } from 'react-native';\nimport { Pressable, StyleSheet } from 'react-native';\n\nimport { Text } from '../Text';\nimport { usePaginationContext } from './paginationContext';\nimport { usePaginationControlStyles } from './usePaginationControlStyles';\n\n/** RN Pressable types differ from web button HTML attributes; keep parity fields only. */\ninterface PaginationItemProps extends Omit<PressableProps, 'children' | 'style' | 'disabled'> {\n page: UniversalPaginationItemProps['page'];\n children?: UniversalPaginationItemProps['children'];\n}\n\n/**\n * **PaginationItem — single page control**\n *\n * @description\n * Renders a page number control. Usually composed via {@link PaginationNumbers}.\n *\n * @category Navigation\n * @platform mobile\n */\nconst PaginationItem = memo(function PaginationItem({\n page,\n children,\n onPress,\n ...rest\n}: PaginationItemProps) {\n const { activePage, size, variant, maxFontSizeMultiplier, getItemAriaLabel, onPageChange } =\n usePaginationContext();\n const isActive = page === activePage;\n const [pressed, setPressed] = useState(false);\n const { rootStyle, textStyle } = usePaginationControlStyles({\n size,\n variant,\n isActive,\n pressed,\n });\n\n const handlePress = useCallback(\n (event: Parameters<NonNullable<PressableProps['onPress']>>[0]) => {\n onPress?.(event);\n if (!isActive) {\n onPageChange?.(page);\n }\n },\n [isActive, onPageChange, onPress, page],\n );\n\n const label = children ?? page;\n const resolvedTextColor = useMemo(() => {\n const flat = StyleSheet.flatten(textStyle);\n return typeof flat?.color === 'string' ? flat.color : undefined;\n }, [textStyle]);\n\n return (\n <Pressable\n accessibilityLabel={getItemAriaLabel(page, isActive)}\n accessibilityRole=\"button\"\n accessibilityState={{ disabled: isActive, selected: isActive }}\n disabled={isActive}\n onPress={isActive ? undefined : handlePress}\n onPressIn={() => setPressed(true)}\n onPressOut={() => setPressed(false)}\n style={rootStyle}\n {...rest}\n >\n {typeof label === 'string' || typeof label === 'number' ? (\n <Text\n color=\"inherit\"\n variant=\"inherit\"\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n style={textStyle}\n dangerouslySetColor={resolvedTextColor}\n >\n {label}\n </Text>\n ) : (\n label\n )}\n </Pressable>\n );\n});\n\nPaginationItem.displayName = 'PaginationItem';\n\nexport { PaginationItem, type PaginationItemProps };\n"],"mappings":";;;;;;;;;;;;;;;;;AAwBA,MAAM,iBAAiB,KAAK,SAAS,eAAe,EAClD,MACA,UACA,SACA,GAAG,QACmB;CACtB,MAAM,EAAE,YAAY,MAAM,SAAS,uBAAuB,kBAAkB,iBAC1E,sBAAsB;CACxB,MAAM,WAAW,SAAS;CAC1B,MAAM,CAAC,SAAS,cAAc,SAAS,MAAM;CAC7C,MAAM,EAAE,WAAW,cAAc,2BAA2B;EAC1D;EACA;EACA;EACA;EACD,CAAC;CAEF,MAAM,cAAc,aACjB,UAAiE;EAChE,UAAU,MAAM;EAChB,IAAI,CAAC,UACH,eAAe,KAAK;IAGxB;EAAC;EAAU;EAAc;EAAS;EAAK,CACxC;CAED,MAAM,QAAQ,YAAY;CAC1B,MAAM,oBAAoB,cAAc;EACtC,MAAM,OAAO,WAAW,QAAQ,UAAU;EAC1C,OAAO,OAAO,MAAM,UAAU,WAAW,KAAK,QAAQ,KAAA;IACrD,CAAC,UAAU,CAAC;CAEf,OACE,oBAAC,WAAD;EACE,oBAAoB,iBAAiB,MAAM,SAAS;EACpD,mBAAkB;EAClB,oBAAoB;GAAE,UAAU;GAAU,UAAU;GAAU;EAC9D,UAAU;EACV,SAAS,WAAW,KAAA,IAAY;EAChC,iBAAiB,WAAW,KAAK;EACjC,kBAAkB,WAAW,MAAM;EACnC,OAAO;EACP,GAAI;YAEH,OAAO,UAAU,YAAY,OAAO,UAAU,WAC7C,oBAACA,QAAD;GACE,OAAM;GACN,SAAQ;GACe;GACvB,OAAO;GACP,qBAAqB;aAEpB;GACI,CAAA,GAEP;EAEQ,CAAA;EAEd;AAEF,eAAe,cAAc"}
|
|
@@ -18,7 +18,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
18
18
|
* @platform mobile
|
|
19
19
|
*/
|
|
20
20
|
const PaginationLink = (0, react.memo)(function PaginationLink({ page, href: _href, children, onPress, ...rest }) {
|
|
21
|
-
const { activePage, size, variant, getItemAriaLabel, onPageChange } = require_components_Pagination_paginationContext.usePaginationContext();
|
|
21
|
+
const { activePage, size, variant, maxFontSizeMultiplier, getItemAriaLabel, onPageChange } = require_components_Pagination_paginationContext.usePaginationContext();
|
|
22
22
|
const isActive = page === activePage;
|
|
23
23
|
const [pressed, setPressed] = (0, react.useState)(false);
|
|
24
24
|
const { rootStyle, textStyle } = require_components_Pagination_usePaginationControlStyles.usePaginationControlStyles({
|
|
@@ -57,6 +57,7 @@ const PaginationLink = (0, react.memo)(function PaginationLink({ page, href: _hr
|
|
|
57
57
|
children: typeof label === "string" || typeof label === "number" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
|
|
58
58
|
color: "inherit",
|
|
59
59
|
variant: "inherit",
|
|
60
|
+
maxFontSizeMultiplier,
|
|
60
61
|
style: textStyle,
|
|
61
62
|
dangerouslySetColor: resolvedTextColor,
|
|
62
63
|
children: label
|
|
@@ -16,7 +16,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
16
16
|
* @platform mobile
|
|
17
17
|
*/
|
|
18
18
|
const PaginationLink = memo(function PaginationLink({ page, href: _href, children, onPress, ...rest }) {
|
|
19
|
-
const { activePage, size, variant, getItemAriaLabel, onPageChange } = usePaginationContext();
|
|
19
|
+
const { activePage, size, variant, maxFontSizeMultiplier, getItemAriaLabel, onPageChange } = usePaginationContext();
|
|
20
20
|
const isActive = page === activePage;
|
|
21
21
|
const [pressed, setPressed] = useState(false);
|
|
22
22
|
const { rootStyle, textStyle } = usePaginationControlStyles({
|
|
@@ -55,6 +55,7 @@ const PaginationLink = memo(function PaginationLink({ page, href: _href, childre
|
|
|
55
55
|
children: typeof label === "string" || typeof label === "number" ? /* @__PURE__ */ jsx(Text$1, {
|
|
56
56
|
color: "inherit",
|
|
57
57
|
variant: "inherit",
|
|
58
|
+
maxFontSizeMultiplier,
|
|
58
59
|
style: textStyle,
|
|
59
60
|
dangerouslySetColor: resolvedTextColor,
|
|
60
61
|
children: label
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationLink.js","names":["Text"],"sources":["../../../src/components/Pagination/PaginationLink.tsx"],"sourcesContent":["import type { UniversalPaginationLinkProps } from '@yahoo/uds-types';\nimport { memo, useCallback, useMemo, useState } from 'react';\nimport type { PressableProps } from 'react-native';\nimport { Pressable, StyleSheet } from 'react-native';\n\nimport { Text } from '../Text';\nimport { usePaginationContext } from './paginationContext';\nimport { usePaginationControlStyles } from './usePaginationControlStyles';\n\n/** RN Pressable types differ from web anchor HTML attributes; keep parity fields only. */\ninterface PaginationLinkProps extends Omit<PressableProps, 'children' | 'style' | 'disabled'> {\n page: UniversalPaginationLinkProps['page'];\n href: UniversalPaginationLinkProps['href'];\n children?: UniversalPaginationLinkProps['children'];\n}\n\n/**\n * **PaginationLink — link-style page control**\n *\n * @description\n * Used when `getPageHref` is provided on {@link Pagination}. Invokes `onPageChange` on press.\n *\n * @category Navigation\n * @platform mobile\n */\nconst PaginationLink = memo(function PaginationLink({\n page,\n href: _href,\n children,\n onPress,\n ...rest\n}: PaginationLinkProps) {\n const { activePage, size, variant, getItemAriaLabel, onPageChange }
|
|
1
|
+
{"version":3,"file":"PaginationLink.js","names":["Text"],"sources":["../../../src/components/Pagination/PaginationLink.tsx"],"sourcesContent":["import type { UniversalPaginationLinkProps } from '@yahoo/uds-types';\nimport { memo, useCallback, useMemo, useState } from 'react';\nimport type { PressableProps } from 'react-native';\nimport { Pressable, StyleSheet } from 'react-native';\n\nimport { Text } from '../Text';\nimport { usePaginationContext } from './paginationContext';\nimport { usePaginationControlStyles } from './usePaginationControlStyles';\n\n/** RN Pressable types differ from web anchor HTML attributes; keep parity fields only. */\ninterface PaginationLinkProps extends Omit<PressableProps, 'children' | 'style' | 'disabled'> {\n page: UniversalPaginationLinkProps['page'];\n href: UniversalPaginationLinkProps['href'];\n children?: UniversalPaginationLinkProps['children'];\n}\n\n/**\n * **PaginationLink — link-style page control**\n *\n * @description\n * Used when `getPageHref` is provided on {@link Pagination}. Invokes `onPageChange` on press.\n *\n * @category Navigation\n * @platform mobile\n */\nconst PaginationLink = memo(function PaginationLink({\n page,\n href: _href,\n children,\n onPress,\n ...rest\n}: PaginationLinkProps) {\n const { activePage, size, variant, maxFontSizeMultiplier, getItemAriaLabel, onPageChange } =\n usePaginationContext();\n const isActive = page === activePage;\n const [pressed, setPressed] = useState(false);\n const { rootStyle, textStyle } = usePaginationControlStyles({\n size,\n variant,\n isActive,\n pressed,\n });\n\n const handlePress = useCallback(\n (event: Parameters<NonNullable<PressableProps['onPress']>>[0]) => {\n onPress?.(event);\n if (!isActive) {\n onPageChange?.(page);\n }\n },\n [isActive, onPageChange, onPress, page],\n );\n\n const label = children ?? page;\n const resolvedTextColor = useMemo(() => {\n const flat = StyleSheet.flatten(textStyle);\n return typeof flat?.color === 'string' ? flat.color : undefined;\n }, [textStyle]);\n\n return (\n <Pressable\n accessibilityLabel={getItemAriaLabel(page, isActive)}\n accessibilityRole=\"link\"\n accessibilityState={{ disabled: isActive, selected: isActive }}\n disabled={isActive}\n onPress={isActive ? undefined : handlePress}\n onPressIn={() => setPressed(true)}\n onPressOut={() => setPressed(false)}\n style={rootStyle}\n {...rest}\n >\n {typeof label === 'string' || typeof label === 'number' ? (\n <Text\n color=\"inherit\"\n variant=\"inherit\"\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n style={textStyle}\n dangerouslySetColor={resolvedTextColor}\n >\n {label}\n </Text>\n ) : (\n label\n )}\n </Pressable>\n );\n});\n\nPaginationLink.displayName = 'PaginationLink';\n\nexport { PaginationLink, type PaginationLinkProps };\n"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,MAAM,iBAAiB,KAAK,SAAS,eAAe,EAClD,MACA,MAAM,OACN,UACA,SACA,GAAG,QACmB;CACtB,MAAM,EAAE,YAAY,MAAM,SAAS,uBAAuB,kBAAkB,iBAC1E,sBAAsB;CACxB,MAAM,WAAW,SAAS;CAC1B,MAAM,CAAC,SAAS,cAAc,SAAS,MAAM;CAC7C,MAAM,EAAE,WAAW,cAAc,2BAA2B;EAC1D;EACA;EACA;EACA;EACD,CAAC;CAEF,MAAM,cAAc,aACjB,UAAiE;EAChE,UAAU,MAAM;EAChB,IAAI,CAAC,UACH,eAAe,KAAK;IAGxB;EAAC;EAAU;EAAc;EAAS;EAAK,CACxC;CAED,MAAM,QAAQ,YAAY;CAC1B,MAAM,oBAAoB,cAAc;EACtC,MAAM,OAAO,WAAW,QAAQ,UAAU;EAC1C,OAAO,OAAO,MAAM,UAAU,WAAW,KAAK,QAAQ,KAAA;IACrD,CAAC,UAAU,CAAC;CAEf,OACE,oBAAC,WAAD;EACE,oBAAoB,iBAAiB,MAAM,SAAS;EACpD,mBAAkB;EAClB,oBAAoB;GAAE,UAAU;GAAU,UAAU;GAAU;EAC9D,UAAU;EACV,SAAS,WAAW,KAAA,IAAY;EAChC,iBAAiB,WAAW,KAAK;EACjC,kBAAkB,WAAW,MAAM;EACnC,OAAO;EACP,GAAI;YAEH,OAAO,UAAU,YAAY,OAAO,UAAU,WAC7C,oBAACA,QAAD;GACE,OAAM;GACN,SAAQ;GACe;GACvB,OAAO;GACP,qBAAqB;aAEpB;GACI,CAAA,GAEP;EAEQ,CAAA;EAEd;AAEF,eAAe,cAAc"}
|
|
@@ -19,7 +19,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
19
19
|
* @platform mobile
|
|
20
20
|
*/
|
|
21
21
|
const PaginationNext = (0, react.memo)(function PaginationNext({ label = "Next", children, onPress, ...rest }) {
|
|
22
|
-
const { activePage, totalPages, size, variant, onPageChange } = require_components_Pagination_paginationContext.usePaginationContext();
|
|
22
|
+
const { activePage, totalPages, size, variant, maxFontSizeMultiplier, onPageChange } = require_components_Pagination_paginationContext.usePaginationContext();
|
|
23
23
|
const [pressed, setPressed] = (0, react.useState)(false);
|
|
24
24
|
(0, react.useEffect)(() => {
|
|
25
25
|
setPressed(false);
|
|
@@ -47,6 +47,7 @@ const PaginationNext = (0, react.memo)(function PaginationNext({ label = "Next",
|
|
|
47
47
|
const content = children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
|
|
48
48
|
color: "inherit",
|
|
49
49
|
variant: "inherit",
|
|
50
|
+
maxFontSizeMultiplier,
|
|
50
51
|
style: textStyle,
|
|
51
52
|
dangerouslySetColor: resolvedTextColor,
|
|
52
53
|
children: label
|
|
@@ -54,6 +55,7 @@ const PaginationNext = (0, react.memo)(function PaginationNext({ label = "Next",
|
|
|
54
55
|
name: "ChevronRight",
|
|
55
56
|
size: "sm",
|
|
56
57
|
color: iconStyle?.color,
|
|
58
|
+
maxFontSizeMultiplier,
|
|
57
59
|
style: iconStyle
|
|
58
60
|
})] });
|
|
59
61
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
|
|
@@ -17,7 +17,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
17
17
|
* @platform mobile
|
|
18
18
|
*/
|
|
19
19
|
const PaginationNext = memo(function PaginationNext({ label = "Next", children, onPress, ...rest }) {
|
|
20
|
-
const { activePage, totalPages, size, variant, onPageChange } = usePaginationContext();
|
|
20
|
+
const { activePage, totalPages, size, variant, maxFontSizeMultiplier, onPageChange } = usePaginationContext();
|
|
21
21
|
const [pressed, setPressed] = useState(false);
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
setPressed(false);
|
|
@@ -45,6 +45,7 @@ const PaginationNext = memo(function PaginationNext({ label = "Next", children,
|
|
|
45
45
|
const content = children ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Text$1, {
|
|
46
46
|
color: "inherit",
|
|
47
47
|
variant: "inherit",
|
|
48
|
+
maxFontSizeMultiplier,
|
|
48
49
|
style: textStyle,
|
|
49
50
|
dangerouslySetColor: resolvedTextColor,
|
|
50
51
|
children: label
|
|
@@ -52,6 +53,7 @@ const PaginationNext = memo(function PaginationNext({ label = "Next", children,
|
|
|
52
53
|
name: "ChevronRight",
|
|
53
54
|
size: "sm",
|
|
54
55
|
color: iconStyle?.color,
|
|
56
|
+
maxFontSizeMultiplier,
|
|
55
57
|
style: iconStyle
|
|
56
58
|
})] });
|
|
57
59
|
return /* @__PURE__ */ jsx(Pressable, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationNext.js","names":["Text"],"sources":["../../../src/components/Pagination/PaginationNext.tsx"],"sourcesContent":["import type { UniversalPaginationNextProps } from '@yahoo/uds-types';\nimport { memo, useCallback, useEffect, useMemo, useState } from 'react';\nimport type { PressableProps, TextStyle } from 'react-native';\nimport { Pressable, StyleSheet } from 'react-native';\n\nimport type { StyleProps } from '../../../generated/styles';\nimport { Icon } from '../Icon';\nimport { Text } from '../Text';\nimport { usePaginationContext } from './paginationContext';\nimport { usePaginationControlStyles } from './usePaginationControlStyles';\n\n/** RN Pressable types differ from web button HTML attributes; keep parity fields only. */\ninterface PaginationNextProps extends Omit<PressableProps, 'children' | 'style'> {\n label?: UniversalPaginationNextProps['label'];\n children?: UniversalPaginationNextProps['children'];\n}\n\n/**\n * **PaginationNext — next page control**\n *\n * @description\n * Hidden on the last page. Moves to the next page when pressed.\n *\n * @category Navigation\n * @platform mobile\n */\nconst PaginationNext = memo(function PaginationNext({\n label = 'Next',\n children,\n onPress,\n ...rest\n}: PaginationNextProps) {\n const { activePage, totalPages, size, variant, onPageChange }
|
|
1
|
+
{"version":3,"file":"PaginationNext.js","names":["Text"],"sources":["../../../src/components/Pagination/PaginationNext.tsx"],"sourcesContent":["import type { UniversalPaginationNextProps } from '@yahoo/uds-types';\nimport { memo, useCallback, useEffect, useMemo, useState } from 'react';\nimport type { PressableProps, TextStyle } from 'react-native';\nimport { Pressable, StyleSheet } from 'react-native';\n\nimport type { StyleProps } from '../../../generated/styles';\nimport { Icon } from '../Icon';\nimport { Text } from '../Text';\nimport { usePaginationContext } from './paginationContext';\nimport { usePaginationControlStyles } from './usePaginationControlStyles';\n\n/** RN Pressable types differ from web button HTML attributes; keep parity fields only. */\ninterface PaginationNextProps extends Omit<PressableProps, 'children' | 'style'> {\n label?: UniversalPaginationNextProps['label'];\n children?: UniversalPaginationNextProps['children'];\n}\n\n/**\n * **PaginationNext — next page control**\n *\n * @description\n * Hidden on the last page. Moves to the next page when pressed.\n *\n * @category Navigation\n * @platform mobile\n */\nconst PaginationNext = memo(function PaginationNext({\n label = 'Next',\n children,\n onPress,\n ...rest\n}: PaginationNextProps) {\n const { activePage, totalPages, size, variant, maxFontSizeMultiplier, onPageChange } =\n usePaginationContext();\n const [pressed, setPressed] = useState(false);\n\n // Pressable unmounts when we return null before onPressOut runs; reset on page change.\n useEffect(() => {\n setPressed(false);\n }, [activePage]);\n const { rootStyle, textStyle, iconStyle } = usePaginationControlStyles({\n size,\n variant,\n isActive: false,\n pressed,\n layout: 'prevNext',\n });\n\n const handlePress = useCallback(\n (event: Parameters<NonNullable<PressableProps['onPress']>>[0]) => {\n onPress?.(event);\n onPageChange?.(activePage + 1);\n },\n [activePage, onPageChange, onPress],\n );\n\n const resolvedTextColor = useMemo(() => {\n const flat = StyleSheet.flatten(textStyle);\n return typeof flat?.color === 'string' ? flat.color : undefined;\n }, [textStyle]);\n\n if (activePage >= totalPages) {\n return null;\n }\n\n const content = children ?? (\n <>\n <Text\n color=\"inherit\"\n variant=\"inherit\"\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n style={textStyle}\n dangerouslySetColor={resolvedTextColor}\n >\n {label}\n </Text>\n <Icon\n name=\"ChevronRight\"\n size=\"sm\"\n color={(iconStyle as TextStyle)?.color as StyleProps['color'] | undefined}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n style={iconStyle}\n />\n </>\n );\n\n return (\n <Pressable\n accessibilityLabel=\"Go to next page\"\n accessibilityRole=\"button\"\n onPress={handlePress}\n onPressIn={() => setPressed(true)}\n onPressOut={() => setPressed(false)}\n style={rootStyle}\n {...rest}\n >\n {content}\n </Pressable>\n );\n});\n\nPaginationNext.displayName = 'PaginationNext';\n\nexport { PaginationNext, type PaginationNextProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0BA,MAAM,iBAAiB,KAAK,SAAS,eAAe,EAClD,QAAQ,QACR,UACA,SACA,GAAG,QACmB;CACtB,MAAM,EAAE,YAAY,YAAY,MAAM,SAAS,uBAAuB,iBACpE,sBAAsB;CACxB,MAAM,CAAC,SAAS,cAAc,SAAS,MAAM;CAG7C,gBAAgB;EACd,WAAW,MAAM;IAChB,CAAC,WAAW,CAAC;CAChB,MAAM,EAAE,WAAW,WAAW,cAAc,2BAA2B;EACrE;EACA;EACA,UAAU;EACV;EACA,QAAQ;EACT,CAAC;CAEF,MAAM,cAAc,aACjB,UAAiE;EAChE,UAAU,MAAM;EAChB,eAAe,aAAa,EAAE;IAEhC;EAAC;EAAY;EAAc;EAAQ,CACpC;CAED,MAAM,oBAAoB,cAAc;EACtC,MAAM,OAAO,WAAW,QAAQ,UAAU;EAC1C,OAAO,OAAO,MAAM,UAAU,WAAW,KAAK,QAAQ,KAAA;IACrD,CAAC,UAAU,CAAC;CAEf,IAAI,cAAc,YAChB,OAAO;CAGT,MAAM,UAAU,YACd,qBAAA,UAAA,EAAA,UAAA,CACE,oBAACA,QAAD;EACE,OAAM;EACN,SAAQ;EACe;EACvB,OAAO;EACP,qBAAqB;YAEpB;EACI,CAAA,EACP,oBAAC,MAAD;EACE,MAAK;EACL,MAAK;EACL,OAAQ,WAAyB;EACV;EACvB,OAAO;EACP,CAAA,CACD,EAAA,CAAA;CAGL,OACE,oBAAC,WAAD;EACE,oBAAmB;EACnB,mBAAkB;EAClB,SAAS;EACT,iBAAiB,WAAW,KAAK;EACjC,kBAAkB,WAAW,MAAM;EACnC,OAAO;EACP,GAAI;YAEH;EACS,CAAA;EAEd;AAEF,eAAe,cAAc"}
|
|
@@ -19,7 +19,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
19
19
|
* @platform mobile
|
|
20
20
|
*/
|
|
21
21
|
const PaginationPrev = (0, react.memo)(function PaginationPrev({ label = "Prev", children, onPress, ...rest }) {
|
|
22
|
-
const { activePage, size, variant, onPageChange } = require_components_Pagination_paginationContext.usePaginationContext();
|
|
22
|
+
const { activePage, size, variant, maxFontSizeMultiplier, onPageChange } = require_components_Pagination_paginationContext.usePaginationContext();
|
|
23
23
|
const [pressed, setPressed] = (0, react.useState)(false);
|
|
24
24
|
(0, react.useEffect)(() => {
|
|
25
25
|
setPressed(false);
|
|
@@ -48,10 +48,12 @@ const PaginationPrev = (0, react.memo)(function PaginationPrev({ label = "Prev",
|
|
|
48
48
|
name: "ChevronLeft",
|
|
49
49
|
size: "sm",
|
|
50
50
|
color: iconStyle?.color,
|
|
51
|
+
maxFontSizeMultiplier,
|
|
51
52
|
style: iconStyle
|
|
52
53
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
|
|
53
54
|
color: "inherit",
|
|
54
55
|
variant: "inherit",
|
|
56
|
+
maxFontSizeMultiplier,
|
|
55
57
|
style: textStyle,
|
|
56
58
|
dangerouslySetColor: resolvedTextColor,
|
|
57
59
|
children: label
|
|
@@ -17,7 +17,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
17
17
|
* @platform mobile
|
|
18
18
|
*/
|
|
19
19
|
const PaginationPrev = memo(function PaginationPrev({ label = "Prev", children, onPress, ...rest }) {
|
|
20
|
-
const { activePage, size, variant, onPageChange } = usePaginationContext();
|
|
20
|
+
const { activePage, size, variant, maxFontSizeMultiplier, onPageChange } = usePaginationContext();
|
|
21
21
|
const [pressed, setPressed] = useState(false);
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
setPressed(false);
|
|
@@ -46,10 +46,12 @@ const PaginationPrev = memo(function PaginationPrev({ label = "Prev", children,
|
|
|
46
46
|
name: "ChevronLeft",
|
|
47
47
|
size: "sm",
|
|
48
48
|
color: iconStyle?.color,
|
|
49
|
+
maxFontSizeMultiplier,
|
|
49
50
|
style: iconStyle
|
|
50
51
|
}), /* @__PURE__ */ jsx(Text$1, {
|
|
51
52
|
color: "inherit",
|
|
52
53
|
variant: "inherit",
|
|
54
|
+
maxFontSizeMultiplier,
|
|
53
55
|
style: textStyle,
|
|
54
56
|
dangerouslySetColor: resolvedTextColor,
|
|
55
57
|
children: label
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationPrev.js","names":["Text"],"sources":["../../../src/components/Pagination/PaginationPrev.tsx"],"sourcesContent":["import type { UniversalPaginationPrevProps } from '@yahoo/uds-types';\nimport { memo, useCallback, useEffect, useMemo, useState } from 'react';\nimport type { PressableProps, TextStyle } from 'react-native';\nimport { Pressable, StyleSheet } from 'react-native';\n\nimport type { StyleProps } from '../../../generated/styles';\nimport { Icon } from '../Icon';\nimport { Text } from '../Text';\nimport { usePaginationContext } from './paginationContext';\nimport { usePaginationControlStyles } from './usePaginationControlStyles';\n\n/** RN Pressable types differ from web button HTML attributes; keep parity fields only. */\ninterface PaginationPrevProps extends Omit<PressableProps, 'children' | 'style'> {\n label?: UniversalPaginationPrevProps['label'];\n children?: UniversalPaginationPrevProps['children'];\n}\n\n/**\n * **PaginationPrev — previous page control**\n *\n * @description\n * Hidden on the first page. Moves to the previous page when pressed.\n *\n * @category Navigation\n * @platform mobile\n */\nconst PaginationPrev = memo(function PaginationPrev({\n label = 'Prev',\n children,\n onPress,\n ...rest\n}: PaginationPrevProps) {\n const { activePage, size, variant, onPageChange } = usePaginationContext();\n const [pressed, setPressed] = useState(false);\n\n // Pressable unmounts when we return null before onPressOut runs; reset on page change.\n useEffect(() => {\n setPressed(false);\n }, [activePage]);\n const { rootStyle, textStyle, iconStyle } = usePaginationControlStyles({\n size,\n variant,\n isActive: false,\n pressed,\n layout: 'prevNext',\n });\n\n const handlePress = useCallback(\n (event: Parameters<NonNullable<PressableProps['onPress']>>[0]) => {\n onPress?.(event);\n onPageChange?.(activePage - 1);\n },\n [activePage, onPageChange, onPress],\n );\n\n const resolvedTextColor = useMemo(() => {\n const flat = StyleSheet.flatten(textStyle);\n return typeof flat?.color === 'string' ? flat.color : undefined;\n }, [textStyle]);\n\n if (activePage <= 1) {\n return null;\n }\n\n const content = children ?? (\n <>\n <Icon\n name=\"ChevronLeft\"\n size=\"sm\"\n color={(iconStyle as TextStyle)?.color as StyleProps['color'] | undefined}\n style={iconStyle}\n />\n <Text\n color=\"inherit\"\n variant=\"inherit\"\n style={textStyle}\n dangerouslySetColor={resolvedTextColor}\n >\n {label}\n </Text>\n </>\n );\n\n return (\n <Pressable\n accessibilityLabel=\"Go to previous page\"\n accessibilityRole=\"button\"\n onPress={handlePress}\n onPressIn={() => setPressed(true)}\n onPressOut={() => setPressed(false)}\n style={rootStyle}\n {...rest}\n >\n {content}\n </Pressable>\n );\n});\n\nPaginationPrev.displayName = 'PaginationPrev';\n\nexport { PaginationPrev, type PaginationPrevProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0BA,MAAM,iBAAiB,KAAK,SAAS,eAAe,EAClD,QAAQ,QACR,UACA,SACA,GAAG,QACmB;CACtB,MAAM,EAAE,YAAY,MAAM,SAAS,iBAAiB,sBAAsB;
|
|
1
|
+
{"version":3,"file":"PaginationPrev.js","names":["Text"],"sources":["../../../src/components/Pagination/PaginationPrev.tsx"],"sourcesContent":["import type { UniversalPaginationPrevProps } from '@yahoo/uds-types';\nimport { memo, useCallback, useEffect, useMemo, useState } from 'react';\nimport type { PressableProps, TextStyle } from 'react-native';\nimport { Pressable, StyleSheet } from 'react-native';\n\nimport type { StyleProps } from '../../../generated/styles';\nimport { Icon } from '../Icon';\nimport { Text } from '../Text';\nimport { usePaginationContext } from './paginationContext';\nimport { usePaginationControlStyles } from './usePaginationControlStyles';\n\n/** RN Pressable types differ from web button HTML attributes; keep parity fields only. */\ninterface PaginationPrevProps extends Omit<PressableProps, 'children' | 'style'> {\n label?: UniversalPaginationPrevProps['label'];\n children?: UniversalPaginationPrevProps['children'];\n}\n\n/**\n * **PaginationPrev — previous page control**\n *\n * @description\n * Hidden on the first page. Moves to the previous page when pressed.\n *\n * @category Navigation\n * @platform mobile\n */\nconst PaginationPrev = memo(function PaginationPrev({\n label = 'Prev',\n children,\n onPress,\n ...rest\n}: PaginationPrevProps) {\n const { activePage, size, variant, maxFontSizeMultiplier, onPageChange } = usePaginationContext();\n const [pressed, setPressed] = useState(false);\n\n // Pressable unmounts when we return null before onPressOut runs; reset on page change.\n useEffect(() => {\n setPressed(false);\n }, [activePage]);\n const { rootStyle, textStyle, iconStyle } = usePaginationControlStyles({\n size,\n variant,\n isActive: false,\n pressed,\n layout: 'prevNext',\n });\n\n const handlePress = useCallback(\n (event: Parameters<NonNullable<PressableProps['onPress']>>[0]) => {\n onPress?.(event);\n onPageChange?.(activePage - 1);\n },\n [activePage, onPageChange, onPress],\n );\n\n const resolvedTextColor = useMemo(() => {\n const flat = StyleSheet.flatten(textStyle);\n return typeof flat?.color === 'string' ? flat.color : undefined;\n }, [textStyle]);\n\n if (activePage <= 1) {\n return null;\n }\n\n const content = children ?? (\n <>\n <Icon\n name=\"ChevronLeft\"\n size=\"sm\"\n color={(iconStyle as TextStyle)?.color as StyleProps['color'] | undefined}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n style={iconStyle}\n />\n <Text\n color=\"inherit\"\n variant=\"inherit\"\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n style={textStyle}\n dangerouslySetColor={resolvedTextColor}\n >\n {label}\n </Text>\n </>\n );\n\n return (\n <Pressable\n accessibilityLabel=\"Go to previous page\"\n accessibilityRole=\"button\"\n onPress={handlePress}\n onPressIn={() => setPressed(true)}\n onPressOut={() => setPressed(false)}\n style={rootStyle}\n {...rest}\n >\n {content}\n </Pressable>\n );\n});\n\nPaginationPrev.displayName = 'PaginationPrev';\n\nexport { PaginationPrev, type PaginationPrevProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0BA,MAAM,iBAAiB,KAAK,SAAS,eAAe,EAClD,QAAQ,QACR,UACA,SACA,GAAG,QACmB;CACtB,MAAM,EAAE,YAAY,MAAM,SAAS,uBAAuB,iBAAiB,sBAAsB;CACjG,MAAM,CAAC,SAAS,cAAc,SAAS,MAAM;CAG7C,gBAAgB;EACd,WAAW,MAAM;IAChB,CAAC,WAAW,CAAC;CAChB,MAAM,EAAE,WAAW,WAAW,cAAc,2BAA2B;EACrE;EACA;EACA,UAAU;EACV;EACA,QAAQ;EACT,CAAC;CAEF,MAAM,cAAc,aACjB,UAAiE;EAChE,UAAU,MAAM;EAChB,eAAe,aAAa,EAAE;IAEhC;EAAC;EAAY;EAAc;EAAQ,CACpC;CAED,MAAM,oBAAoB,cAAc;EACtC,MAAM,OAAO,WAAW,QAAQ,UAAU;EAC1C,OAAO,OAAO,MAAM,UAAU,WAAW,KAAK,QAAQ,KAAA;IACrD,CAAC,UAAU,CAAC;CAEf,IAAI,cAAc,GAChB,OAAO;CAGT,MAAM,UAAU,YACd,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,MAAD;EACE,MAAK;EACL,MAAK;EACL,OAAQ,WAAyB;EACV;EACvB,OAAO;EACP,CAAA,EACF,oBAACA,QAAD;EACE,OAAM;EACN,SAAQ;EACe;EACvB,OAAO;EACP,qBAAqB;YAEpB;EACI,CAAA,CACN,EAAA,CAAA;CAGL,OACE,oBAAC,WAAD;EACE,oBAAmB;EACnB,mBAAkB;EAClB,SAAS;EACT,iBAAiB,WAAW,KAAK;EACjC,kBAAkB,WAAW,MAAM;EACnC,OAAO;EACP,GAAI;YAEH;EACS,CAAA;EAEd;AAEF,eAAe,cAAc"}
|
|
@@ -10,6 +10,8 @@ interface PaginationContextValue {
|
|
|
10
10
|
ellipsisPlacement: PaginationEllipsisPlacement;
|
|
11
11
|
size: PaginationSize;
|
|
12
12
|
variant: PaginationVariant;
|
|
13
|
+
/** Resolved React Native control cap (0 = uncapped, undefined = disabled). */
|
|
14
|
+
maxFontSizeMultiplier?: number;
|
|
13
15
|
getPageHref?: (page: number) => string;
|
|
14
16
|
getItemAriaLabel: (page: number, isActive: boolean) => string;
|
|
15
17
|
onPageChange?: (page: number) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginationContext.d.cts","names":[],"sources":["../../../src/components/Pagination/paginationContext.tsx"],"mappings":";;;;;UASU,sBAAA;EACR,UAAA;EACA,UAAA;EACA,qBAAA;EACA,iBAAA,EAAmB,2BAAA;EACnB,IAAA,EAAM,cAAA;EACN,OAAA,EAAS,iBAAA;
|
|
1
|
+
{"version":3,"file":"paginationContext.d.cts","names":[],"sources":["../../../src/components/Pagination/paginationContext.tsx"],"mappings":";;;;;UASU,sBAAA;EACR,UAAA;EACA,UAAA;EACA,qBAAA;EACA,iBAAA,EAAmB,2BAAA;EACnB,IAAA,EAAM,cAAA;EACN,OAAA,EAAS,iBAAA;EADH;EAGN,qBAAA;EACA,WAAA,IAAe,IAAA;EACf,gBAAA,GAAmB,IAAA,UAAc,QAAA;EACjC,YAAA,IAAgB,IAAA;AAAA;AAAA,cAGZ,uBAAA,GAA2B,IAAA,UAAc,QAAA;AAAA,cAGzC,iBAAA,EAAiB,OAAA,CAAA,OAAA,CAAA,sBAAA;AAAA,UAEb,uBAAA;EACR,KAAA,EAAO,sBAAA;EACP,QAAA,EAAU,KAAA,CAAM,SAAA;AAAA;AAAA,cAGZ,kBAAA;EAAA;;;KAA2C,uBAAA,GAAuB,OAAA,CAAA,GAAA,CAAA,OAAA;;;iBAO/D,oBAAA,CAAA,GAAwB,sBAAA;AAAA,iBAQxB,eAAA,CAAA,GAAe,qBAAA"}
|
|
@@ -10,6 +10,8 @@ interface PaginationContextValue {
|
|
|
10
10
|
ellipsisPlacement: PaginationEllipsisPlacement;
|
|
11
11
|
size: PaginationSize;
|
|
12
12
|
variant: PaginationVariant;
|
|
13
|
+
/** Resolved React Native control cap (0 = uncapped, undefined = disabled). */
|
|
14
|
+
maxFontSizeMultiplier?: number;
|
|
13
15
|
getPageHref?: (page: number) => string;
|
|
14
16
|
getItemAriaLabel: (page: number, isActive: boolean) => string;
|
|
15
17
|
onPageChange?: (page: number) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginationContext.d.ts","names":[],"sources":["../../../src/components/Pagination/paginationContext.tsx"],"mappings":";;;;;UASU,sBAAA;EACR,UAAA;EACA,UAAA;EACA,qBAAA;EACA,iBAAA,EAAmB,2BAAA;EACnB,IAAA,EAAM,cAAA;EACN,OAAA,EAAS,iBAAA;
|
|
1
|
+
{"version":3,"file":"paginationContext.d.ts","names":[],"sources":["../../../src/components/Pagination/paginationContext.tsx"],"mappings":";;;;;UASU,sBAAA;EACR,UAAA;EACA,UAAA;EACA,qBAAA;EACA,iBAAA,EAAmB,2BAAA;EACnB,IAAA,EAAM,cAAA;EACN,OAAA,EAAS,iBAAA;EADH;EAGN,qBAAA;EACA,WAAA,IAAe,IAAA;EACf,gBAAA,GAAmB,IAAA,UAAc,QAAA;EACjC,YAAA,IAAgB,IAAA;AAAA;AAAA,cAGZ,uBAAA,GAA2B,IAAA,UAAc,QAAA;AAAA,cAGzC,iBAAA,EAAiB,OAAA,CAAA,OAAA,CAAA,sBAAA;AAAA,UAEb,uBAAA;EACR,KAAA,EAAO,sBAAA;EACP,QAAA,EAAU,KAAA,CAAM,SAAA;AAAA;AAAA,cAGZ,kBAAA;EAAA;;;KAA2C,uBAAA,GAAuB,OAAA,CAAA,GAAA,CAAA,OAAA;;;iBAO/D,oBAAA,CAAA,GAAwB,sBAAA;AAAA,iBAQxB,eAAA,CAAA,GAAe,qBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginationContext.js","names":[],"sources":["../../../src/components/Pagination/paginationContext.tsx"],"sourcesContent":["import type {\n PaginationEllipsisPlacement,\n PaginationSize,\n PaginationVariant,\n} from '@yahoo/uds-types';\nimport { createContext, useContext, useMemo } from 'react';\n\nimport { computeVisiblePages } from './computeVisiblePages';\n\ninterface PaginationContextValue {\n activePage: number;\n totalPages: number;\n maxVisiblePageNumbers: number;\n ellipsisPlacement: PaginationEllipsisPlacement;\n size: PaginationSize;\n variant: PaginationVariant;\n getPageHref?: (page: number) => string;\n getItemAriaLabel: (page: number, isActive: boolean) => string;\n onPageChange?: (page: number) => void;\n}\n\nconst defaultGetItemAriaLabel = (page: number, isActive: boolean) =>\n isActive ? `Page ${page}, current page` : `Go to page ${page}`;\n\nconst PaginationContext = createContext<PaginationContextValue | null>(null);\n\ninterface PaginationProviderProps {\n value: PaginationContextValue;\n children: React.ReactNode;\n}\n\nconst PaginationProvider = ({ value, children }: PaginationProviderProps) => {\n const contextValue = useMemo(() => value, [value]);\n return <PaginationContext.Provider value={contextValue}>{children}</PaginationContext.Provider>;\n};\n\nPaginationProvider.displayName = 'PaginationProvider';\n\nfunction usePaginationContext(): PaginationContextValue {\n const context = useContext(PaginationContext);\n if (!context) {\n throw new Error('Pagination components must be used within a Pagination provider.');\n }\n return context;\n}\n\nfunction useVisiblePages() {\n const { activePage, totalPages, maxVisiblePageNumbers, ellipsisPlacement } =\n usePaginationContext();\n return useMemo(\n () =>\n computeVisiblePages({\n activePage,\n totalPages,\n maxVisiblePageNumbers,\n ellipsisPlacement,\n }),\n [activePage, totalPages, maxVisiblePageNumbers, ellipsisPlacement],\n );\n}\n\nexport {\n defaultGetItemAriaLabel,\n PaginationContext,\n PaginationProvider,\n usePaginationContext,\n useVisiblePages,\n};\n"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"paginationContext.js","names":[],"sources":["../../../src/components/Pagination/paginationContext.tsx"],"sourcesContent":["import type {\n PaginationEllipsisPlacement,\n PaginationSize,\n PaginationVariant,\n} from '@yahoo/uds-types';\nimport { createContext, useContext, useMemo } from 'react';\n\nimport { computeVisiblePages } from './computeVisiblePages';\n\ninterface PaginationContextValue {\n activePage: number;\n totalPages: number;\n maxVisiblePageNumbers: number;\n ellipsisPlacement: PaginationEllipsisPlacement;\n size: PaginationSize;\n variant: PaginationVariant;\n /** Resolved React Native control cap (0 = uncapped, undefined = disabled). */\n maxFontSizeMultiplier?: number;\n getPageHref?: (page: number) => string;\n getItemAriaLabel: (page: number, isActive: boolean) => string;\n onPageChange?: (page: number) => void;\n}\n\nconst defaultGetItemAriaLabel = (page: number, isActive: boolean) =>\n isActive ? `Page ${page}, current page` : `Go to page ${page}`;\n\nconst PaginationContext = createContext<PaginationContextValue | null>(null);\n\ninterface PaginationProviderProps {\n value: PaginationContextValue;\n children: React.ReactNode;\n}\n\nconst PaginationProvider = ({ value, children }: PaginationProviderProps) => {\n const contextValue = useMemo(() => value, [value]);\n return <PaginationContext.Provider value={contextValue}>{children}</PaginationContext.Provider>;\n};\n\nPaginationProvider.displayName = 'PaginationProvider';\n\nfunction usePaginationContext(): PaginationContextValue {\n const context = useContext(PaginationContext);\n if (!context) {\n throw new Error('Pagination components must be used within a Pagination provider.');\n }\n return context;\n}\n\nfunction useVisiblePages() {\n const { activePage, totalPages, maxVisiblePageNumbers, ellipsisPlacement } =\n usePaginationContext();\n return useMemo(\n () =>\n computeVisiblePages({\n activePage,\n totalPages,\n maxVisiblePageNumbers,\n ellipsisPlacement,\n }),\n [activePage, totalPages, maxVisiblePageNumbers, ellipsisPlacement],\n );\n}\n\nexport {\n defaultGetItemAriaLabel,\n PaginationContext,\n PaginationProvider,\n usePaginationContext,\n useVisiblePages,\n};\n"],"mappings":";;;;;AAuBA,MAAM,2BAA2B,MAAc,aAC7C,WAAW,QAAQ,KAAK,kBAAkB,cAAc;AAE1D,MAAM,oBAAoB,cAA6C,KAAK;AAO5E,MAAM,sBAAsB,EAAE,OAAO,eAAwC;CAC3E,MAAM,eAAe,cAAc,OAAO,CAAC,MAAM,CAAC;CAClD,OAAO,oBAAC,kBAAkB,UAAnB;EAA4B,OAAO;EAAe;EAAsC,CAAA;;AAGjG,mBAAmB,cAAc;AAEjC,SAAS,uBAA+C;CACtD,MAAM,UAAU,WAAW,kBAAkB;CAC7C,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,mEAAmE;CAErF,OAAO;;AAGT,SAAS,kBAAkB;CACzB,MAAM,EAAE,YAAY,YAAY,uBAAuB,sBACrD,sBAAsB;CACxB,OAAO,cAEH,oBAAoB;EAClB;EACA;EACA;EACA;EACD,CAAC,EACJ;EAAC;EAAY;EAAY;EAAuB;EAAkB,CACnE"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_fontScaling_useFontScale = require("../../fontScaling/useFontScale.cjs");
|
|
5
|
+
const require_components_Pagination_paginationContext = require("./paginationContext.cjs");
|
|
4
6
|
const require_components_Pagination_paginationTheme = require("./paginationTheme.cjs");
|
|
5
7
|
let react = require("react");
|
|
6
8
|
let react_native = require("react-native");
|
|
@@ -8,12 +10,16 @@ let react_native_unistyles = require("react-native-unistyles");
|
|
|
8
10
|
//#region src/components/Pagination/usePaginationControlStyles.ts
|
|
9
11
|
function usePaginationControlStyles({ size, variant, isActive, pressed, layout = "page" }) {
|
|
10
12
|
const { theme } = (0, react_native_unistyles.useUnistyles)();
|
|
13
|
+
const { maxFontSizeMultiplier } = require_components_Pagination_paginationContext.usePaginationContext();
|
|
11
14
|
const active = isActive ? "on" : "off";
|
|
12
15
|
const interaction = pressed ? "pressed" : "rest";
|
|
13
16
|
const prevNextActive = "off";
|
|
17
|
+
const sizeTextStyle = require_components_Pagination_paginationTheme.getPaginationSizeLayerStyle(theme, size, "text");
|
|
18
|
+
const fontScaleFactor = require_fontScaling_useFontScale.useComponentFontScale(maxFontSizeMultiplier, typeof sizeTextStyle.lineHeight === "number" ? sizeTextStyle.lineHeight : sizeTextStyle.fontSize);
|
|
14
19
|
return {
|
|
15
20
|
rootStyle: (0, react.useMemo)(() => {
|
|
16
|
-
const { controlSize, borderRadius } = require_components_Pagination_paginationTheme.getPaginationControlMetrics(theme, size);
|
|
21
|
+
const { controlSize: baseControlSize, borderRadius } = require_components_Pagination_paginationTheme.getPaginationControlMetrics(theme, size);
|
|
22
|
+
const controlSize = Math.round(baseControlSize * fontScaleFactor);
|
|
17
23
|
const variantActive = layout === "prevNext" ? prevNextActive : active;
|
|
18
24
|
return [
|
|
19
25
|
layout === "page" ? paginationStaticStyles.pageRoot : paginationStaticStyles.prevNextRoot,
|
|
@@ -28,6 +34,7 @@ function usePaginationControlStyles({ size, variant, isActive, pressed, layout =
|
|
|
28
34
|
];
|
|
29
35
|
}, [
|
|
30
36
|
active,
|
|
37
|
+
fontScaleFactor,
|
|
31
38
|
interaction,
|
|
32
39
|
layout,
|
|
33
40
|
size,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePaginationControlStyles.d.cts","names":[],"sources":["../../../src/components/Pagination/usePaginationControlStyles.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"usePaginationControlStyles.d.cts","names":[],"sources":["../../../src/components/Pagination/usePaginationControlStyles.ts"],"mappings":";;;;;UAiBU,iCAAA;EACR,IAAA,EAAM,cAAA;EACN,OAAA,EAAS,iBAAA;EACT,QAAA;EACA,OAAA;EACA,MAAA;AAAA;AAAA,iBAGO,0BAAA,CAAA;EACP,IAAA;EACA,OAAA;EACA,QAAA;EACA,OAAA;EACA;AAAA,GACC,iCAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePaginationControlStyles.d.ts","names":[],"sources":["../../../src/components/Pagination/usePaginationControlStyles.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"usePaginationControlStyles.d.ts","names":[],"sources":["../../../src/components/Pagination/usePaginationControlStyles.ts"],"mappings":";;;;;UAiBU,iCAAA;EACR,IAAA,EAAM,cAAA;EACN,OAAA,EAAS,iBAAA;EACT,QAAA;EACA,OAAA;EACA,MAAA;AAAA;AAAA,iBAGO,0BAAA,CAAA;EACP,IAAA;EACA,OAAA;EACA,QAAA;EACA,OAAA;EACA;AAAA,GACC,iCAAA"}
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
-
import {
|
|
2
|
+
import { useComponentFontScale } from "../../fontScaling/useFontScale.js";
|
|
3
|
+
import { usePaginationContext } from "./paginationContext.js";
|
|
4
|
+
import { getMergedPaginationControlRootStyle, getMergedPaginationIconStyle, getMergedPaginationTextStyle, getPaginationControlMetrics, getPaginationSizeLayerStyle } from "./paginationTheme.js";
|
|
3
5
|
import { useMemo } from "react";
|
|
4
6
|
import { StyleSheet } from "react-native";
|
|
5
7
|
import { useUnistyles } from "react-native-unistyles";
|
|
6
8
|
//#region src/components/Pagination/usePaginationControlStyles.ts
|
|
7
9
|
function usePaginationControlStyles({ size, variant, isActive, pressed, layout = "page" }) {
|
|
8
10
|
const { theme } = useUnistyles();
|
|
11
|
+
const { maxFontSizeMultiplier } = usePaginationContext();
|
|
9
12
|
const active = isActive ? "on" : "off";
|
|
10
13
|
const interaction = pressed ? "pressed" : "rest";
|
|
11
14
|
const prevNextActive = "off";
|
|
15
|
+
const sizeTextStyle = getPaginationSizeLayerStyle(theme, size, "text");
|
|
16
|
+
const fontScaleFactor = useComponentFontScale(maxFontSizeMultiplier, typeof sizeTextStyle.lineHeight === "number" ? sizeTextStyle.lineHeight : sizeTextStyle.fontSize);
|
|
12
17
|
return {
|
|
13
18
|
rootStyle: useMemo(() => {
|
|
14
|
-
const { controlSize, borderRadius } = getPaginationControlMetrics(theme, size);
|
|
19
|
+
const { controlSize: baseControlSize, borderRadius } = getPaginationControlMetrics(theme, size);
|
|
20
|
+
const controlSize = Math.round(baseControlSize * fontScaleFactor);
|
|
15
21
|
const variantActive = layout === "prevNext" ? prevNextActive : active;
|
|
16
22
|
return [
|
|
17
23
|
layout === "page" ? paginationStaticStyles.pageRoot : paginationStaticStyles.prevNextRoot,
|
|
@@ -26,6 +32,7 @@ function usePaginationControlStyles({ size, variant, isActive, pressed, layout =
|
|
|
26
32
|
];
|
|
27
33
|
}, [
|
|
28
34
|
active,
|
|
35
|
+
fontScaleFactor,
|
|
29
36
|
interaction,
|
|
30
37
|
layout,
|
|
31
38
|
size,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePaginationControlStyles.js","names":[],"sources":["../../../src/components/Pagination/usePaginationControlStyles.ts"],"sourcesContent":["import type { PaginationSize, PaginationVariant } from '@yahoo/uds-types';\nimport { useMemo } from 'react';\nimport type { StyleProp, TextStyle, ViewStyle } from 'react-native';\nimport { StyleSheet } from 'react-native';\n// eslint-disable-next-line uds/no-use-unistyles -- pagination token lookups for variant + size layers\nimport { useUnistyles } from 'react-native-unistyles';\n\nimport {\n getMergedPaginationControlRootStyle,\n getMergedPaginationIconStyle,\n getMergedPaginationTextStyle,\n getPaginationControlMetrics,\n} from './paginationTheme';\n\ninterface UsePaginationControlStylesOptions {\n size: PaginationSize;\n variant: PaginationVariant;\n isActive: boolean;\n pressed: boolean;\n layout?: 'page' | 'prevNext';\n}\n\nfunction usePaginationControlStyles({\n size,\n variant,\n isActive,\n pressed,\n layout = 'page',\n}: UsePaginationControlStylesOptions) {\n const { theme } = useUnistyles();\n const active: 'on' | 'off' = isActive ? 'on' : 'off';\n const interaction = pressed ? 'pressed' : 'rest';\n const prevNextActive: 'on' | 'off' = 'off';\n\n const rootStyle = useMemo<StyleProp<ViewStyle>>(() => {\n const { controlSize, borderRadius } = getPaginationControlMetrics(theme, size);\n const variantActive = layout === 'prevNext' ? prevNextActive : active;\n\n return [\n layout === 'page' ? paginationStaticStyles.pageRoot : paginationStaticStyles.prevNextRoot,\n getMergedPaginationControlRootStyle(theme, size, variant, variantActive, interaction),\n {\n borderRadius,\n ...(layout === 'page'\n ? { height: controlSize, width: controlSize }\n : { minHeight: controlSize }),\n },\n ];\n }, [active, interaction, layout, size, theme, variant]);\n\n const textStyle = useMemo<StyleProp<TextStyle>>(() => {\n const variantActive = layout === 'prevNext' ? prevNextActive : active;\n\n return [\n paginationStaticStyles.text,\n getMergedPaginationTextStyle(theme, size, variant, variantActive, interaction),\n ];\n }, [active, interaction, layout, size, theme, variant]);\n\n const iconStyle = useMemo<StyleProp<TextStyle>>(\n () =>\n getMergedPaginationIconStyle(\n theme,\n size,\n variant,\n layout === 'prevNext' ? prevNextActive : active,\n interaction,\n ),\n [active, interaction, layout, size, theme, variant],\n );\n\n return { rootStyle, textStyle, iconStyle };\n}\n\nconst paginationStaticStyles = StyleSheet.create({\n pageRoot: {\n alignItems: 'center',\n justifyContent: 'center',\n flexShrink: 0,\n },\n prevNextRoot: {\n alignItems: 'center',\n flexDirection: 'row',\n flexShrink: 0,\n gap: 4,\n justifyContent: 'center',\n },\n text: {\n flexShrink: 0,\n fontVariant: ['tabular-nums'],\n textAlign: 'center',\n },\n});\n\nexport { usePaginationControlStyles };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePaginationControlStyles.js","names":[],"sources":["../../../src/components/Pagination/usePaginationControlStyles.ts"],"sourcesContent":["import type { PaginationSize, PaginationVariant } from '@yahoo/uds-types';\nimport { useMemo } from 'react';\nimport type { StyleProp, TextStyle, ViewStyle } from 'react-native';\nimport { StyleSheet } from 'react-native';\n// eslint-disable-next-line uds/no-use-unistyles -- pagination token lookups for variant + size layers\nimport { useUnistyles } from 'react-native-unistyles';\n\nimport { useComponentFontScale } from '../../fontScaling/useFontScale';\nimport { usePaginationContext } from './paginationContext';\nimport {\n getMergedPaginationControlRootStyle,\n getMergedPaginationIconStyle,\n getMergedPaginationTextStyle,\n getPaginationControlMetrics,\n getPaginationSizeLayerStyle,\n} from './paginationTheme';\n\ninterface UsePaginationControlStylesOptions {\n size: PaginationSize;\n variant: PaginationVariant;\n isActive: boolean;\n pressed: boolean;\n layout?: 'page' | 'prevNext';\n}\n\nfunction usePaginationControlStyles({\n size,\n variant,\n isActive,\n pressed,\n layout = 'page',\n}: UsePaginationControlStylesOptions) {\n const { theme } = useUnistyles();\n const { maxFontSizeMultiplier } = usePaginationContext();\n const active: 'on' | 'off' = isActive ? 'on' : 'off';\n const interaction = pressed ? 'pressed' : 'rest';\n const prevNextActive: 'on' | 'off' = 'off';\n const sizeTextStyle = getPaginationSizeLayerStyle(theme, size, 'text') as TextStyle;\n const fontScaleFactor = useComponentFontScale(\n maxFontSizeMultiplier,\n typeof sizeTextStyle.lineHeight === 'number'\n ? sizeTextStyle.lineHeight\n : sizeTextStyle.fontSize,\n );\n\n const rootStyle = useMemo<StyleProp<ViewStyle>>(() => {\n const { controlSize: baseControlSize, borderRadius } = getPaginationControlMetrics(theme, size);\n const controlSize = Math.round(baseControlSize * fontScaleFactor);\n const variantActive = layout === 'prevNext' ? prevNextActive : active;\n\n return [\n layout === 'page' ? paginationStaticStyles.pageRoot : paginationStaticStyles.prevNextRoot,\n getMergedPaginationControlRootStyle(theme, size, variant, variantActive, interaction),\n {\n borderRadius,\n ...(layout === 'page'\n ? { height: controlSize, width: controlSize }\n : { minHeight: controlSize }),\n },\n ];\n }, [active, fontScaleFactor, interaction, layout, size, theme, variant]);\n\n const textStyle = useMemo<StyleProp<TextStyle>>(() => {\n const variantActive = layout === 'prevNext' ? prevNextActive : active;\n\n return [\n paginationStaticStyles.text,\n getMergedPaginationTextStyle(theme, size, variant, variantActive, interaction),\n ];\n }, [active, interaction, layout, size, theme, variant]);\n\n const iconStyle = useMemo<StyleProp<TextStyle>>(\n () =>\n getMergedPaginationIconStyle(\n theme,\n size,\n variant,\n layout === 'prevNext' ? prevNextActive : active,\n interaction,\n ),\n [active, interaction, layout, size, theme, variant],\n );\n\n return { rootStyle, textStyle, iconStyle };\n}\n\nconst paginationStaticStyles = StyleSheet.create({\n pageRoot: {\n alignItems: 'center',\n justifyContent: 'center',\n flexShrink: 0,\n },\n prevNextRoot: {\n alignItems: 'center',\n flexDirection: 'row',\n flexShrink: 0,\n gap: 4,\n justifyContent: 'center',\n },\n text: {\n flexShrink: 0,\n fontVariant: ['tabular-nums'],\n textAlign: 'center',\n },\n});\n\nexport { usePaginationControlStyles };\n"],"mappings":";;;;;;;;AAyBA,SAAS,2BAA2B,EAClC,MACA,SACA,UACA,SACA,SAAS,UAC2B;CACpC,MAAM,EAAE,UAAU,cAAc;CAChC,MAAM,EAAE,0BAA0B,sBAAsB;CACxD,MAAM,SAAuB,WAAW,OAAO;CAC/C,MAAM,cAAc,UAAU,YAAY;CAC1C,MAAM,iBAA+B;CACrC,MAAM,gBAAgB,4BAA4B,OAAO,MAAM,OAAO;CACtE,MAAM,kBAAkB,sBACtB,uBACA,OAAO,cAAc,eAAe,WAChC,cAAc,aACd,cAAc,SACnB;CAwCD,OAAO;EAAE,WAtCS,cAAoC;GACpD,MAAM,EAAE,aAAa,iBAAiB,iBAAiB,4BAA4B,OAAO,KAAK;GAC/F,MAAM,cAAc,KAAK,MAAM,kBAAkB,gBAAgB;GACjE,MAAM,gBAAgB,WAAW,aAAa,iBAAiB;GAE/D,OAAO;IACL,WAAW,SAAS,uBAAuB,WAAW,uBAAuB;IAC7E,oCAAoC,OAAO,MAAM,SAAS,eAAe,YAAY;IACrF;KACE;KACA,GAAI,WAAW,SACX;MAAE,QAAQ;MAAa,OAAO;MAAa,GAC3C,EAAE,WAAW,aAAa;KAC/B;IACF;KACA;GAAC;GAAQ;GAAiB;GAAa;GAAQ;GAAM;GAAO;GAAQ,CAuBrD;EAAE,WArBF,cAAoC;GACpD,MAAM,gBAAgB,WAAW,aAAa,iBAAiB;GAE/D,OAAO,CACL,uBAAuB,MACvB,6BAA6B,OAAO,MAAM,SAAS,eAAe,YAAY,CAC/E;KACA;GAAC;GAAQ;GAAa;GAAQ;GAAM;GAAO;GAAQ,CAczB;EAAE,WAZb,cAEd,6BACE,OACA,MACA,SACA,WAAW,aAAa,iBAAiB,QACzC,YACD,EACH;GAAC;GAAQ;GAAa;GAAQ;GAAM;GAAO;GAAQ,CAGb;EAAE;;AAG5C,MAAM,yBAAyB,WAAW,OAAO;CAC/C,UAAU;EACR,YAAY;EACZ,gBAAgB;EAChB,YAAY;EACb;CACD,cAAc;EACZ,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,KAAK;EACL,gBAAgB;EACjB;CACD,MAAM;EACJ,YAAY;EACZ,aAAa,CAAC,eAAe;EAC7B,WAAW;EACZ;CACF,CAAC"}
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
4
|
const require_index = require("../../motion-tokens/dist/index.cjs");
|
|
5
5
|
const require_motion = require("../../motion.cjs");
|
|
6
|
+
const require_fontScaling_useFontScale = require("../../fontScaling/useFontScale.cjs");
|
|
7
|
+
const require_fontScaling_useMaxFontSizeMultiplier = require("../../fontScaling/useMaxFontSizeMultiplier.cjs");
|
|
6
8
|
const require_components_Pressable = require("../Pressable.cjs");
|
|
7
9
|
const require_components_FormLabel = require("../FormLabel.cjs");
|
|
8
10
|
const require_components_Radio_RadioGroupContext = require("./RadioGroupContext.cjs");
|
|
@@ -49,9 +51,10 @@ const VARIANT_ERROR_MAP = {
|
|
|
49
51
|
* @see {@link Checkbox} for multi-select options
|
|
50
52
|
* @see {@link Switch} for binary toggles
|
|
51
53
|
*/
|
|
52
|
-
const Radio = (0, react.memo)(function Radio({ label, labelPosition = "start", variant: variantInput, size: sizeInput, value: valueProp, checked: checkedProp, hasError: hasErrorProp, reduceMotion: reduceMotionProp, defaultChecked, disabled: disabledProp, required, onChange, ref, ...viewProps }) {
|
|
54
|
+
const Radio = (0, react.memo)(function Radio({ label, labelPosition = "start", variant: variantInput, size: sizeInput, value: valueProp, checked: checkedProp, hasError: hasErrorProp, reduceMotion: reduceMotionProp, defaultChecked, disabled: disabledProp, required, maxFontSizeMultiplier, onChange, ref, ...viewProps }) {
|
|
53
55
|
const uid = `uds-radio-${(0, react.useId)()}`;
|
|
54
56
|
const radioGroup = require_components_Radio_RadioGroupContext.useRadioGroupContext();
|
|
57
|
+
const resolvedMaxFontSizeMultiplier = require_fontScaling_useMaxFontSizeMultiplier.useMaxFontSizeMultiplier("control", maxFontSizeMultiplier);
|
|
55
58
|
const disabled = Boolean(disabledProp || radioGroup?.disabled);
|
|
56
59
|
const hasError = hasErrorProp ?? radioGroup?.hasError;
|
|
57
60
|
const reduceMotion = reduceMotionProp ?? radioGroup?.reduceMotion;
|
|
@@ -106,22 +109,36 @@ const Radio = (0, react.memo)(function Radio({ label, labelPosition = "start", v
|
|
|
106
109
|
value: valueState,
|
|
107
110
|
pressed
|
|
108
111
|
});
|
|
112
|
+
const radioBaseSize = generated_styles.radioStyles.radio.width;
|
|
113
|
+
const fontScaleFactor = require_fontScaling_useFontScale.useComponentFontScale(resolvedMaxFontSizeMultiplier, typeof radioBaseSize === "number" ? radioBaseSize : void 0);
|
|
109
114
|
const rootStyle = (0, react.useMemo)(() => [generated_styles.radioStyles.root, { opacity: disabled ? .5 : 1 }], [generated_styles.radioStyles.root, disabled]);
|
|
110
|
-
const radioBoxStyle = (0, react.useMemo)(() =>
|
|
115
|
+
const radioBoxStyle = (0, react.useMemo)(() => {
|
|
116
|
+
const { width, height } = generated_styles.radioStyles.radio;
|
|
117
|
+
const scaledBox = fontScaleFactor !== 1 && typeof width === "number" && typeof height === "number" ? {
|
|
118
|
+
width: Math.round(width * fontScaleFactor),
|
|
119
|
+
height: Math.round(height * fontScaleFactor)
|
|
120
|
+
} : void 0;
|
|
121
|
+
return [
|
|
122
|
+
generated_styles.radioStyles.radio,
|
|
123
|
+
scaledBox,
|
|
124
|
+
{
|
|
125
|
+
alignItems: "center",
|
|
126
|
+
justifyContent: "center",
|
|
127
|
+
borderRadius: 9999
|
|
128
|
+
},
|
|
129
|
+
radioAnimatedStyle
|
|
130
|
+
];
|
|
131
|
+
}, [
|
|
111
132
|
generated_styles.radioStyles.radio,
|
|
112
|
-
|
|
113
|
-
alignItems: "center",
|
|
114
|
-
justifyContent: "center",
|
|
115
|
-
borderRadius: 9999
|
|
116
|
-
},
|
|
133
|
+
fontScaleFactor,
|
|
117
134
|
radioAnimatedStyle
|
|
118
|
-
]
|
|
135
|
+
]);
|
|
119
136
|
const INNER_CIRCLE_SIZE = 8;
|
|
120
137
|
const circleStyle = (0, react.useMemo)(() => [generated_styles.radioStyles.radioCircle, {
|
|
121
|
-
width: INNER_CIRCLE_SIZE,
|
|
122
|
-
height: INNER_CIRCLE_SIZE,
|
|
138
|
+
width: Math.round(INNER_CIRCLE_SIZE * fontScaleFactor),
|
|
139
|
+
height: Math.round(INNER_CIRCLE_SIZE * fontScaleFactor),
|
|
123
140
|
borderRadius: 9999
|
|
124
|
-
}], [generated_styles.radioStyles.radioCircle]);
|
|
141
|
+
}], [generated_styles.radioStyles.radioCircle, fontScaleFactor]);
|
|
125
142
|
const labelContent = (0, react.useMemo)(() => {
|
|
126
143
|
if (!label) return null;
|
|
127
144
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_FormLabel.FormLabel, {
|
|
@@ -131,12 +148,14 @@ const Radio = (0, react.memo)(function Radio({ label, labelPosition = "start", v
|
|
|
131
148
|
required,
|
|
132
149
|
showRequiredAsterisk: required,
|
|
133
150
|
hasError,
|
|
151
|
+
maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
|
|
134
152
|
style: generated_styles.radioStyles.text
|
|
135
153
|
});
|
|
136
154
|
}, [
|
|
137
155
|
label,
|
|
138
156
|
required,
|
|
139
157
|
hasError,
|
|
158
|
+
resolvedMaxFontSizeMultiplier,
|
|
140
159
|
generated_styles.radioStyles.text
|
|
141
160
|
]);
|
|
142
161
|
const a11yState = (0, react.useMemo)(() => ({
|
|
@@ -14,6 +14,13 @@ interface RadioProps extends Omit<ViewProps, 'style'>, UniversalRadioProps {
|
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
/** Whether the radio is required */
|
|
16
16
|
required?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Caps how far the circle, dot, and label grow with the OS text-size
|
|
19
|
+
* setting; all three scale by the same factor. Set null to remove the cap;
|
|
20
|
+
* override app-wide via UDSFontScalingProvider.
|
|
21
|
+
* @default 2
|
|
22
|
+
*/
|
|
23
|
+
maxFontSizeMultiplier?: number | null;
|
|
17
24
|
/** Callback fired when the checked state changes */
|
|
18
25
|
onChange?: (checked: boolean) => void;
|
|
19
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.d.cts","names":[],"sources":["../../../src/components/Radio/Radio.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"Radio.d.cts","names":[],"sources":["../../../src/components/Radio/Radio.tsx"],"mappings":";;;;;;;UAsBU,UAAA,SAAmB,IAAA,CAAK,SAAA,YAAqB,mBAAA;;EAErD,GAAA,GAAM,GAAA,CAAI,IAAA;EAFS;EAInB,cAAA;EAJgC;EAMhC,QAAA;EAJM;EAMN,QAAA;EARqD;;;;;;EAerD,qBAAA;EAbM;EAeN,QAAA,IAAY,OAAA;AAAA;;;;;;;;AAAgB;;;;;;;;;;;;;;;;;;;;;;;;;cAmDxB,KAAA,EAAK,OAAA,CAAA,oBAAA,CAAA,UAAA"}
|
|
@@ -14,6 +14,13 @@ interface RadioProps extends Omit<ViewProps, 'style'>, UniversalRadioProps {
|
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
/** Whether the radio is required */
|
|
16
16
|
required?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Caps how far the circle, dot, and label grow with the OS text-size
|
|
19
|
+
* setting; all three scale by the same factor. Set null to remove the cap;
|
|
20
|
+
* override app-wide via UDSFontScalingProvider.
|
|
21
|
+
* @default 2
|
|
22
|
+
*/
|
|
23
|
+
maxFontSizeMultiplier?: number | null;
|
|
17
24
|
/** Callback fired when the checked state changes */
|
|
18
25
|
onChange?: (checked: boolean) => void;
|
|
19
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.d.ts","names":[],"sources":["../../../src/components/Radio/Radio.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"Radio.d.ts","names":[],"sources":["../../../src/components/Radio/Radio.tsx"],"mappings":";;;;;;;UAsBU,UAAA,SAAmB,IAAA,CAAK,SAAA,YAAqB,mBAAA;;EAErD,GAAA,GAAM,GAAA,CAAI,IAAA;EAFS;EAInB,cAAA;EAJgC;EAMhC,QAAA;EAJM;EAMN,QAAA;EARqD;;;;;;EAerD,qBAAA;EAbM;EAeN,QAAA,IAAY,OAAA;AAAA;;;;;;;;AAAgB;;;;;;;;;;;;;;;;;;;;;;;;;cAmDxB,KAAA,EAAK,OAAA,CAAA,oBAAA,CAAA,UAAA"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
2
|
import { SCALE_EFFECTS } from "../../motion-tokens/dist/index.js";
|
|
3
3
|
import { BUTTON_SPRING_CONFIG } from "../../motion.js";
|
|
4
|
+
import { useComponentFontScale } from "../../fontScaling/useFontScale.js";
|
|
5
|
+
import { useMaxFontSizeMultiplier } from "../../fontScaling/useMaxFontSizeMultiplier.js";
|
|
4
6
|
import { Pressable as Pressable$1 } from "../Pressable.js";
|
|
5
7
|
import { FormLabel } from "../FormLabel.js";
|
|
6
8
|
import { useRadioGroupContext } from "./RadioGroupContext.js";
|
|
@@ -46,9 +48,10 @@ const VARIANT_ERROR_MAP = {
|
|
|
46
48
|
* @see {@link Checkbox} for multi-select options
|
|
47
49
|
* @see {@link Switch} for binary toggles
|
|
48
50
|
*/
|
|
49
|
-
const Radio = memo(function Radio({ label, labelPosition = "start", variant: variantInput, size: sizeInput, value: valueProp, checked: checkedProp, hasError: hasErrorProp, reduceMotion: reduceMotionProp, defaultChecked, disabled: disabledProp, required, onChange, ref, ...viewProps }) {
|
|
51
|
+
const Radio = memo(function Radio({ label, labelPosition = "start", variant: variantInput, size: sizeInput, value: valueProp, checked: checkedProp, hasError: hasErrorProp, reduceMotion: reduceMotionProp, defaultChecked, disabled: disabledProp, required, maxFontSizeMultiplier, onChange, ref, ...viewProps }) {
|
|
50
52
|
const uid = `uds-radio-${useId()}`;
|
|
51
53
|
const radioGroup = useRadioGroupContext();
|
|
54
|
+
const resolvedMaxFontSizeMultiplier = useMaxFontSizeMultiplier("control", maxFontSizeMultiplier);
|
|
52
55
|
const disabled = Boolean(disabledProp || radioGroup?.disabled);
|
|
53
56
|
const hasError = hasErrorProp ?? radioGroup?.hasError;
|
|
54
57
|
const reduceMotion = reduceMotionProp ?? radioGroup?.reduceMotion;
|
|
@@ -103,22 +106,36 @@ const Radio = memo(function Radio({ label, labelPosition = "start", variant: var
|
|
|
103
106
|
value: valueState,
|
|
104
107
|
pressed
|
|
105
108
|
});
|
|
109
|
+
const radioBaseSize = radioStyles.radio.width;
|
|
110
|
+
const fontScaleFactor = useComponentFontScale(resolvedMaxFontSizeMultiplier, typeof radioBaseSize === "number" ? radioBaseSize : void 0);
|
|
106
111
|
const rootStyle = useMemo(() => [radioStyles.root, { opacity: disabled ? .5 : 1 }], [radioStyles.root, disabled]);
|
|
107
|
-
const radioBoxStyle = useMemo(() =>
|
|
112
|
+
const radioBoxStyle = useMemo(() => {
|
|
113
|
+
const { width, height } = radioStyles.radio;
|
|
114
|
+
const scaledBox = fontScaleFactor !== 1 && typeof width === "number" && typeof height === "number" ? {
|
|
115
|
+
width: Math.round(width * fontScaleFactor),
|
|
116
|
+
height: Math.round(height * fontScaleFactor)
|
|
117
|
+
} : void 0;
|
|
118
|
+
return [
|
|
119
|
+
radioStyles.radio,
|
|
120
|
+
scaledBox,
|
|
121
|
+
{
|
|
122
|
+
alignItems: "center",
|
|
123
|
+
justifyContent: "center",
|
|
124
|
+
borderRadius: 9999
|
|
125
|
+
},
|
|
126
|
+
radioAnimatedStyle
|
|
127
|
+
];
|
|
128
|
+
}, [
|
|
108
129
|
radioStyles.radio,
|
|
109
|
-
|
|
110
|
-
alignItems: "center",
|
|
111
|
-
justifyContent: "center",
|
|
112
|
-
borderRadius: 9999
|
|
113
|
-
},
|
|
130
|
+
fontScaleFactor,
|
|
114
131
|
radioAnimatedStyle
|
|
115
|
-
]
|
|
132
|
+
]);
|
|
116
133
|
const INNER_CIRCLE_SIZE = 8;
|
|
117
134
|
const circleStyle = useMemo(() => [radioStyles.radioCircle, {
|
|
118
|
-
width: INNER_CIRCLE_SIZE,
|
|
119
|
-
height: INNER_CIRCLE_SIZE,
|
|
135
|
+
width: Math.round(INNER_CIRCLE_SIZE * fontScaleFactor),
|
|
136
|
+
height: Math.round(INNER_CIRCLE_SIZE * fontScaleFactor),
|
|
120
137
|
borderRadius: 9999
|
|
121
|
-
}], [radioStyles.radioCircle]);
|
|
138
|
+
}], [radioStyles.radioCircle, fontScaleFactor]);
|
|
122
139
|
const labelContent = useMemo(() => {
|
|
123
140
|
if (!label) return null;
|
|
124
141
|
return /* @__PURE__ */ jsx(FormLabel, {
|
|
@@ -128,12 +145,14 @@ const Radio = memo(function Radio({ label, labelPosition = "start", variant: var
|
|
|
128
145
|
required,
|
|
129
146
|
showRequiredAsterisk: required,
|
|
130
147
|
hasError,
|
|
148
|
+
maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
|
|
131
149
|
style: radioStyles.text
|
|
132
150
|
});
|
|
133
151
|
}, [
|
|
134
152
|
label,
|
|
135
153
|
required,
|
|
136
154
|
hasError,
|
|
155
|
+
resolvedMaxFontSizeMultiplier,
|
|
137
156
|
radioStyles.text
|
|
138
157
|
]);
|
|
139
158
|
const a11yState = useMemo(() => ({
|