@unif/react-native-design 0.20.0 → 0.21.1
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 +121 -12
- package/lib/module/components/business/AvatarWithRing/AvatarWithRing.js +4 -5
- package/lib/module/components/business/AvatarWithRing/AvatarWithRing.js.map +1 -1
- package/lib/module/components/business/AvatarWithRing/styles.js +10 -9
- package/lib/module/components/business/AvatarWithRing/styles.js.map +1 -1
- package/lib/module/components/business/VersionPill/VersionPill.js +32 -15
- package/lib/module/components/business/VersionPill/VersionPill.js.map +1 -1
- package/lib/module/components/business/VersionPill/content.js +30 -0
- package/lib/module/components/business/VersionPill/content.js.map +1 -0
- package/lib/module/components/business/VersionPill/styles.js +4 -0
- package/lib/module/components/business/VersionPill/styles.js.map +1 -1
- package/lib/module/components/business/useSvgId.js +17 -8
- package/lib/module/components/business/useSvgId.js.map +1 -1
- package/lib/module/components/ui/Avatar/Avatar.js +22 -29
- package/lib/module/components/ui/Avatar/Avatar.js.map +1 -1
- package/lib/module/components/ui/Button/Button.js +40 -23
- package/lib/module/components/ui/Button/Button.js.map +1 -1
- package/lib/module/components/ui/Button/ButtonBase.js +13 -13
- package/lib/module/components/ui/Button/ButtonBase.js.map +1 -1
- package/lib/module/components/ui/Carousel/Carousel.js +68 -40
- package/lib/module/components/ui/Carousel/Carousel.js.map +1 -1
- package/lib/module/components/ui/Carousel/behavior.js +60 -0
- package/lib/module/components/ui/Carousel/behavior.js.map +1 -0
- package/lib/module/components/ui/Carousel/styles.js +6 -8
- package/lib/module/components/ui/Carousel/styles.js.map +1 -1
- package/lib/module/components/ui/Cell/Cell.js +76 -65
- package/lib/module/components/ui/Cell/Cell.js.map +1 -1
- package/lib/module/components/ui/Cell/Leading.js +11 -5
- package/lib/module/components/ui/Cell/Leading.js.map +1 -1
- package/lib/module/components/ui/Cell/content.js +34 -0
- package/lib/module/components/ui/Cell/content.js.map +1 -0
- package/lib/module/components/ui/Checkbox/Checkbox.js +25 -8
- package/lib/module/components/ui/Checkbox/Checkbox.js.map +1 -1
- package/lib/module/components/ui/Confirm/ConfirmHost.js +49 -25
- package/lib/module/components/ui/Confirm/ConfirmHost.js.map +1 -1
- package/lib/module/components/ui/Confirm/confirm.js +15 -29
- package/lib/module/components/ui/Confirm/confirm.js.map +1 -1
- package/lib/module/components/ui/Confirm/labels.js +10 -0
- package/lib/module/components/ui/Confirm/labels.js.map +1 -0
- package/lib/module/components/ui/Confirm/store.js +113 -0
- package/lib/module/components/ui/Confirm/store.js.map +1 -0
- package/lib/module/components/ui/Confirm/styles.js +4 -0
- package/lib/module/components/ui/Confirm/styles.js.map +1 -1
- package/lib/module/components/ui/DrawerHeader/DrawerHeader.js +17 -25
- package/lib/module/components/ui/DrawerHeader/DrawerHeader.js.map +1 -1
- package/lib/module/components/ui/Grid/Grid.js +26 -9
- package/lib/module/components/ui/Grid/Grid.js.map +1 -1
- package/lib/module/components/ui/Grid/accessibility.js +13 -0
- package/lib/module/components/ui/Grid/accessibility.js.map +1 -0
- package/lib/module/components/ui/IconButton/IconButton.js +16 -3
- package/lib/module/components/ui/IconButton/IconButton.js.map +1 -1
- package/lib/module/components/ui/Input/Input.js +8 -5
- package/lib/module/components/ui/Input/Input.js.map +1 -1
- package/lib/module/components/ui/Logo/Logo.js +22 -4
- package/lib/module/components/ui/Logo/Logo.js.map +1 -1
- package/lib/module/components/ui/NavBar/NavBar.js +23 -14
- package/lib/module/components/ui/NavBar/NavBar.js.map +1 -1
- package/lib/module/components/ui/NavBar/isSlot.js +297 -4
- package/lib/module/components/ui/NavBar/isSlot.js.map +1 -1
- package/lib/module/components/ui/PasswordInput/PasswordInput.js +61 -66
- package/lib/module/components/ui/PasswordInput/PasswordInput.js.map +1 -1
- package/lib/module/components/ui/Pulse/Pulse.js +1 -1
- package/lib/module/components/ui/Pulse/Pulse.js.map +1 -1
- package/lib/module/components/ui/Pulse/PulseDot.js +5 -7
- package/lib/module/components/ui/Pulse/PulseDot.js.map +1 -1
- package/lib/module/components/ui/Pulse/index.js +1 -1
- package/lib/module/components/ui/Pulse/index.js.map +1 -1
- package/lib/module/components/ui/Pulse/normalizePulseOptions.js +45 -0
- package/lib/module/components/ui/Pulse/normalizePulseOptions.js.map +1 -0
- package/lib/module/components/ui/Pulse/usePulse.js +61 -24
- package/lib/module/components/ui/Pulse/usePulse.js.map +1 -1
- package/lib/module/components/ui/Pulse/usePulseDriver.js +44 -0
- package/lib/module/components/ui/Pulse/usePulseDriver.js.map +1 -0
- package/lib/module/components/ui/Pulse/usePulseDriver.web.js +67 -0
- package/lib/module/components/ui/Pulse/usePulseDriver.web.js.map +1 -0
- package/lib/module/components/ui/Radio/Radio.js +31 -14
- package/lib/module/components/ui/Radio/Radio.js.map +1 -1
- package/lib/module/components/ui/Radio/RadioGroup.js +15 -2
- package/lib/module/components/ui/Radio/RadioGroup.js.map +1 -1
- package/lib/module/components/ui/Reveal/Reveal.js +4 -3
- package/lib/module/components/ui/Reveal/Reveal.js.map +1 -1
- package/lib/module/components/ui/Reveal/Reveal.web.js +55 -32
- package/lib/module/components/ui/Reveal/Reveal.web.js.map +1 -1
- package/lib/module/components/ui/Reveal/webTransition.js +157 -0
- package/lib/module/components/ui/Reveal/webTransition.js.map +1 -0
- package/lib/module/components/ui/Search/Search.js +85 -58
- package/lib/module/components/ui/Search/Search.js.map +1 -1
- package/lib/module/components/ui/Segmented/Segmented.js +4 -2
- package/lib/module/components/ui/Segmented/Segmented.js.map +1 -1
- package/lib/module/components/ui/Skeleton/Skeleton.js +5 -7
- package/lib/module/components/ui/Skeleton/Skeleton.js.map +1 -1
- package/lib/module/components/ui/Spinner/Spinner.js +18 -11
- package/lib/module/components/ui/Spinner/Spinner.js.map +1 -1
- package/lib/module/components/ui/Spinner/Spinner.web.js +18 -14
- package/lib/module/components/ui/Spinner/Spinner.web.js.map +1 -1
- package/lib/module/components/ui/Spinner/shared.js +6 -0
- package/lib/module/components/ui/Spinner/shared.js.map +1 -1
- package/lib/module/components/ui/Stepper/Stepper.js +131 -99
- package/lib/module/components/ui/Stepper/Stepper.js.map +1 -1
- package/lib/module/components/ui/Stepper/StepperPressable.js +4 -0
- package/lib/module/components/ui/Stepper/StepperPressable.js.map +1 -0
- package/lib/module/components/ui/Stepper/StepperPressable.web.js +4 -0
- package/lib/module/components/ui/Stepper/StepperPressable.web.js.map +1 -0
- package/lib/module/components/ui/Stepper/accessibility.js +30 -0
- package/lib/module/components/ui/Stepper/accessibility.js.map +1 -0
- package/lib/module/components/ui/Stepper/accessibility.types.js +4 -0
- package/lib/module/components/ui/Stepper/accessibility.types.js.map +1 -0
- package/lib/module/components/ui/Stepper/accessibility.web.js +57 -0
- package/lib/module/components/ui/Stepper/accessibility.web.js.map +1 -0
- package/lib/module/components/ui/Stepper/layout.js +28 -0
- package/lib/module/components/ui/Stepper/layout.js.map +1 -0
- package/lib/module/components/ui/Stepper/normalizeStepper.js +53 -0
- package/lib/module/components/ui/Stepper/normalizeStepper.js.map +1 -0
- package/lib/module/components/ui/Stepper/styles.js +9 -2
- package/lib/module/components/ui/Stepper/styles.js.map +1 -1
- package/lib/module/components/ui/Switch/Switch.js +45 -19
- package/lib/module/components/ui/Switch/Switch.js.map +1 -1
- package/lib/module/components/ui/Switch/Switch.web.js +47 -20
- package/lib/module/components/ui/Switch/Switch.web.js.map +1 -1
- package/lib/module/components/ui/Switch/styles.js +12 -5
- package/lib/module/components/ui/Switch/styles.js.map +1 -1
- package/lib/module/components/ui/Tag/Tag.js +3 -2
- package/lib/module/components/ui/Tag/Tag.js.map +1 -1
- package/lib/module/components/ui/TextField/TextFieldBase.js +131 -86
- package/lib/module/components/ui/TextField/TextFieldBase.js.map +1 -1
- package/lib/module/components/ui/TextField/TextFieldSlot.js +82 -0
- package/lib/module/components/ui/TextField/TextFieldSlot.js.map +1 -0
- package/lib/module/components/ui/TextField/normalize.js +238 -0
- package/lib/module/components/ui/TextField/normalize.js.map +1 -0
- package/lib/module/components/ui/TextField/styles.js +31 -0
- package/lib/module/components/ui/TextField/styles.js.map +1 -1
- package/lib/module/components/ui/TextField/useErrorAnnouncement.js +27 -0
- package/lib/module/components/ui/TextField/useErrorAnnouncement.js.map +1 -0
- package/lib/module/components/ui/TextField/useTextFieldValue.js +66 -0
- package/lib/module/components/ui/TextField/useTextFieldValue.js.map +1 -0
- package/lib/module/components/ui/TextField/valueState.js +93 -0
- package/lib/module/components/ui/TextField/valueState.js.map +1 -0
- package/lib/module/components/ui/Textarea/Textarea.js +7 -3
- package/lib/module/components/ui/Textarea/Textarea.js.map +1 -1
- package/lib/module/components/ui/Thumbnail/Thumbnail.js +67 -48
- package/lib/module/components/ui/Thumbnail/Thumbnail.js.map +1 -1
- package/lib/module/components/ui/Thumbnail/normalize.js +58 -0
- package/lib/module/components/ui/Thumbnail/normalize.js.map +1 -0
- package/lib/module/components/ui/Thumbnail/styles.js +6 -11
- package/lib/module/components/ui/Thumbnail/styles.js.map +1 -1
- package/lib/module/components/ui/Toast/ToastHost.js +64 -21
- package/lib/module/components/ui/Toast/ToastHost.js.map +1 -1
- package/lib/module/components/ui/Toast/ToastHost.web.js +73 -24
- package/lib/module/components/ui/Toast/ToastHost.web.js.map +1 -1
- package/lib/module/components/ui/Toast/store.js +110 -0
- package/lib/module/components/ui/Toast/store.js.map +1 -0
- package/lib/module/components/ui/Toast/toast.js +17 -7
- package/lib/module/components/ui/Toast/toast.js.map +1 -1
- package/lib/module/components/ui/index.js.map +1 -1
- package/lib/module/components/ui/shared/ImageAttempt.js +28 -0
- package/lib/module/components/ui/shared/ImageAttempt.js.map +1 -0
- package/lib/module/components/ui/shared/a11y.js +21 -0
- package/lib/module/components/ui/shared/a11y.js.map +1 -0
- package/lib/module/components/ui/shared/accessibilityName.js +9 -0
- package/lib/module/components/ui/shared/accessibilityName.js.map +1 -0
- package/lib/module/components/ui/shared/selectImageAttemptSource.js +5 -0
- package/lib/module/components/ui/shared/selectImageAttemptSource.js.map +1 -0
- package/lib/module/components/ui/shared/selectImageAttemptSource.shared.js +13 -0
- package/lib/module/components/ui/shared/selectImageAttemptSource.shared.js.map +1 -0
- package/lib/module/components/ui/shared/selectImageAttemptSource.web.js +5 -0
- package/lib/module/components/ui/shared/selectImageAttemptSource.web.js.map +1 -0
- package/lib/module/icons/data.js +1 -1
- package/lib/module/icons/data.js.map +1 -1
- package/lib/module/theme/ThemeProvider.js +14 -4
- package/lib/module/theme/ThemeProvider.js.map +1 -1
- package/lib/module/theme/fontScale.js +13 -0
- package/lib/module/theme/fontScale.js.map +1 -0
- package/lib/module/theme/index.js +2 -4
- package/lib/module/theme/index.js.map +1 -1
- package/lib/module/theme/themeContext.js +15 -0
- package/lib/module/theme/themeContext.js.map +1 -0
- package/lib/module/theme/themeDiagnostics.js +29 -0
- package/lib/module/theme/themeDiagnostics.js.map +1 -0
- package/lib/module/theme/usePrefersReducedMotion.js +11 -4
- package/lib/module/theme/usePrefersReducedMotion.js.map +1 -1
- package/lib/module/theme/usePrefersReducedMotion.web.js +5 -2
- package/lib/module/theme/usePrefersReducedMotion.web.js.map +1 -1
- package/lib/module/theme/useTheme.js +12 -25
- package/lib/module/theme/useTheme.js.map +1 -1
- package/lib/module/theme/useThemedStyles.js +9 -6
- package/lib/module/theme/useThemedStyles.js.map +1 -1
- package/lib/module/utils/imageSource.js +198 -0
- package/lib/module/utils/imageSource.js.map +1 -0
- package/lib/typescript/manual-tests/runtime-api/RuntimeApiScreen.d.ts +12 -0
- package/lib/typescript/manual-tests/runtime-api/RuntimeApiScreen.d.ts.map +1 -0
- package/lib/typescript/src/components/business/AvatarWithRing/AvatarWithRing.d.ts.map +1 -1
- package/lib/typescript/src/components/business/AvatarWithRing/styles.d.ts +8 -7
- package/lib/typescript/src/components/business/AvatarWithRing/styles.d.ts.map +1 -1
- package/lib/typescript/src/components/business/VersionPill/VersionPill.d.ts +1 -1
- package/lib/typescript/src/components/business/VersionPill/VersionPill.d.ts.map +1 -1
- package/lib/typescript/src/components/business/VersionPill/content.d.ts +19 -0
- package/lib/typescript/src/components/business/VersionPill/content.d.ts.map +1 -0
- package/lib/typescript/src/components/business/VersionPill/index.d.ts +1 -1
- package/lib/typescript/src/components/business/VersionPill/index.d.ts.map +1 -1
- package/lib/typescript/src/components/business/VersionPill/styles.d.ts +4 -0
- package/lib/typescript/src/components/business/VersionPill/styles.d.ts.map +1 -1
- package/lib/typescript/src/components/business/VersionPill/types.d.ts +6 -2
- package/lib/typescript/src/components/business/VersionPill/types.d.ts.map +1 -1
- package/lib/typescript/src/components/business/index.d.ts +1 -1
- package/lib/typescript/src/components/business/index.d.ts.map +1 -1
- package/lib/typescript/src/components/business/useSvgId.d.ts +6 -5
- package/lib/typescript/src/components/business/useSvgId.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Avatar/Avatar.d.ts +2 -2
- package/lib/typescript/src/components/ui/Avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Avatar/types.d.ts +6 -2
- package/lib/typescript/src/components/ui/Avatar/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Button/Button.d.ts +1 -1
- package/lib/typescript/src/components/ui/Button/Button.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Button/ButtonBase.d.ts +5 -3
- package/lib/typescript/src/components/ui/Button/ButtonBase.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Button/types.d.ts +5 -3
- package/lib/typescript/src/components/ui/Button/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Carousel/Carousel.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Carousel/behavior.d.ts +25 -0
- package/lib/typescript/src/components/ui/Carousel/behavior.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Carousel/styles.d.ts +4 -6
- package/lib/typescript/src/components/ui/Carousel/styles.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Carousel/types.d.ts +14 -6
- package/lib/typescript/src/components/ui/Carousel/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Cell/Cell.d.ts +1 -1
- package/lib/typescript/src/components/ui/Cell/Cell.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Cell/Leading.d.ts +2 -3
- package/lib/typescript/src/components/ui/Cell/Leading.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Cell/content.d.ts +18 -0
- package/lib/typescript/src/components/ui/Cell/content.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Cell/index.d.ts +1 -1
- package/lib/typescript/src/components/ui/Cell/index.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Cell/types.d.ts +66 -30
- package/lib/typescript/src/components/ui/Cell/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Checkbox/Checkbox.d.ts +1 -1
- package/lib/typescript/src/components/ui/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Checkbox/types.d.ts +12 -3
- package/lib/typescript/src/components/ui/Checkbox/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Confirm/ConfirmHost.d.ts +6 -3
- package/lib/typescript/src/components/ui/Confirm/ConfirmHost.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Confirm/confirm.d.ts +10 -4
- package/lib/typescript/src/components/ui/Confirm/confirm.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Confirm/labels.d.ts +6 -0
- package/lib/typescript/src/components/ui/Confirm/labels.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Confirm/store.d.ts +44 -0
- package/lib/typescript/src/components/ui/Confirm/store.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Confirm/styles.d.ts +3 -0
- package/lib/typescript/src/components/ui/Confirm/styles.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Confirm/types.d.ts +0 -9
- package/lib/typescript/src/components/ui/Confirm/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/DrawerHeader/DrawerHeader.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/DrawerHeader/types.d.ts +7 -1
- package/lib/typescript/src/components/ui/DrawerHeader/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Grid/Grid.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Grid/accessibility.d.ts +5 -0
- package/lib/typescript/src/components/ui/Grid/accessibility.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Grid/types.d.ts +2 -0
- package/lib/typescript/src/components/ui/Grid/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/IconButton/IconButton.d.ts +1 -1
- package/lib/typescript/src/components/ui/IconButton/IconButton.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/IconButton/types.d.ts +4 -2
- package/lib/typescript/src/components/ui/IconButton/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Input/Input.d.ts +5 -383
- package/lib/typescript/src/components/ui/Input/Input.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Input/index.d.ts +1 -0
- package/lib/typescript/src/components/ui/Input/index.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Input/types.d.ts +3 -17
- package/lib/typescript/src/components/ui/Input/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Logo/Logo.d.ts +2 -2
- package/lib/typescript/src/components/ui/Logo/Logo.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Logo/types.d.ts +2 -2
- package/lib/typescript/src/components/ui/Logo/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/NavBar/NavBar.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/NavBar/index.d.ts +1 -1
- package/lib/typescript/src/components/ui/NavBar/index.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/NavBar/isSlot.d.ts +24 -4
- package/lib/typescript/src/components/ui/NavBar/isSlot.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/NavBar/types.d.ts +8 -8
- package/lib/typescript/src/components/ui/NavBar/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/PasswordInput/PasswordInput.d.ts +6 -14
- package/lib/typescript/src/components/ui/PasswordInput/PasswordInput.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/PasswordInput/types.d.ts +4 -14
- package/lib/typescript/src/components/ui/PasswordInput/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Pulse/PulseDot.d.ts +1 -1
- package/lib/typescript/src/components/ui/Pulse/PulseDot.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Pulse/normalizePulseOptions.d.ts +32 -0
- package/lib/typescript/src/components/ui/Pulse/normalizePulseOptions.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Pulse/usePulse.d.ts +10 -5
- package/lib/typescript/src/components/ui/Pulse/usePulse.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Pulse/usePulseDriver.d.ts +11 -0
- package/lib/typescript/src/components/ui/Pulse/usePulseDriver.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Pulse/usePulseDriver.web.d.ts +18 -0
- package/lib/typescript/src/components/ui/Pulse/usePulseDriver.web.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Radio/Radio.d.ts +1 -1
- package/lib/typescript/src/components/ui/Radio/Radio.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Radio/RadioGroup.d.ts +2 -2
- package/lib/typescript/src/components/ui/Radio/RadioGroup.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Radio/types.d.ts +14 -3
- package/lib/typescript/src/components/ui/Radio/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Reveal/Reveal.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Reveal/Reveal.web.d.ts +2 -8
- package/lib/typescript/src/components/ui/Reveal/Reveal.web.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Reveal/types.d.ts +1 -1
- package/lib/typescript/src/components/ui/Reveal/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Reveal/webTransition.d.ts +38 -0
- package/lib/typescript/src/components/ui/Reveal/webTransition.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Search/Search.d.ts +4 -214
- package/lib/typescript/src/components/ui/Search/Search.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Search/types.d.ts +13 -6
- package/lib/typescript/src/components/ui/Search/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Segmented/Segmented.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Skeleton/Skeleton.d.ts +3 -3
- package/lib/typescript/src/components/ui/Skeleton/Skeleton.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Spinner/Spinner.d.ts +1 -1
- package/lib/typescript/src/components/ui/Spinner/Spinner.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Spinner/Spinner.web.d.ts +1 -1
- package/lib/typescript/src/components/ui/Spinner/Spinner.web.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Spinner/shared.d.ts +5 -0
- package/lib/typescript/src/components/ui/Spinner/shared.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Spinner/types.d.ts +1 -1
- package/lib/typescript/src/components/ui/Spinner/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Stepper/Stepper.d.ts +3 -3
- package/lib/typescript/src/components/ui/Stepper/Stepper.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Stepper/StepperPressable.d.ts +2 -0
- package/lib/typescript/src/components/ui/Stepper/StepperPressable.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Stepper/StepperPressable.web.d.ts +2 -0
- package/lib/typescript/src/components/ui/Stepper/StepperPressable.web.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Stepper/accessibility.d.ts +3 -0
- package/lib/typescript/src/components/ui/Stepper/accessibility.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Stepper/accessibility.types.d.ts +23 -0
- package/lib/typescript/src/components/ui/Stepper/accessibility.types.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Stepper/accessibility.web.d.ts +9 -0
- package/lib/typescript/src/components/ui/Stepper/accessibility.web.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Stepper/layout.d.ts +22 -0
- package/lib/typescript/src/components/ui/Stepper/layout.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Stepper/normalizeStepper.d.ts +31 -0
- package/lib/typescript/src/components/ui/Stepper/normalizeStepper.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Stepper/styles.d.ts +9 -2
- package/lib/typescript/src/components/ui/Stepper/styles.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Stepper/types.d.ts +3 -1
- package/lib/typescript/src/components/ui/Stepper/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Switch/Switch.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Switch/Switch.web.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Switch/styles.d.ts +9 -3
- package/lib/typescript/src/components/ui/Switch/styles.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Switch/types.d.ts +2 -2
- package/lib/typescript/src/components/ui/Switch/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Tag/Tag.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/TextField/TextFieldBase.d.ts +4 -401
- package/lib/typescript/src/components/ui/TextField/TextFieldBase.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/TextField/TextFieldSlot.d.ts +13 -0
- package/lib/typescript/src/components/ui/TextField/TextFieldSlot.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/TextField/normalize.d.ts +51 -0
- package/lib/typescript/src/components/ui/TextField/normalize.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/TextField/styles.d.ts +30 -0
- package/lib/typescript/src/components/ui/TextField/styles.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/TextField/types.d.ts +92 -18
- package/lib/typescript/src/components/ui/TextField/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/TextField/useErrorAnnouncement.d.ts +3 -0
- package/lib/typescript/src/components/ui/TextField/useErrorAnnouncement.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/TextField/useTextFieldValue.d.ts +18 -0
- package/lib/typescript/src/components/ui/TextField/useTextFieldValue.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/TextField/valueState.d.ts +50 -0
- package/lib/typescript/src/components/ui/TextField/valueState.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Textarea/Textarea.d.ts +4 -382
- package/lib/typescript/src/components/ui/Textarea/Textarea.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Textarea/index.d.ts +1 -0
- package/lib/typescript/src/components/ui/Textarea/index.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Textarea/types.d.ts +3 -14
- package/lib/typescript/src/components/ui/Textarea/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Thumbnail/Thumbnail.d.ts +5 -12
- package/lib/typescript/src/components/ui/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Thumbnail/index.d.ts +1 -1
- package/lib/typescript/src/components/ui/Thumbnail/index.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Thumbnail/normalize.d.ts +13 -0
- package/lib/typescript/src/components/ui/Thumbnail/normalize.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Thumbnail/styles.d.ts +4 -8
- package/lib/typescript/src/components/ui/Thumbnail/styles.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Thumbnail/types.d.ts +21 -13
- package/lib/typescript/src/components/ui/Thumbnail/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Toast/ToastHost.d.ts +6 -2
- package/lib/typescript/src/components/ui/Toast/ToastHost.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Toast/ToastHost.web.d.ts +6 -3
- package/lib/typescript/src/components/ui/Toast/ToastHost.web.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Toast/store.d.ts +39 -0
- package/lib/typescript/src/components/ui/Toast/store.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Toast/toast.d.ts +7 -2
- package/lib/typescript/src/components/ui/Toast/toast.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Toast/types.d.ts +5 -3
- package/lib/typescript/src/components/ui/Toast/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/index.d.ts +4 -4
- package/lib/typescript/src/components/ui/index.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/shared/ImageAttempt.d.ts +13 -0
- package/lib/typescript/src/components/ui/shared/ImageAttempt.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/shared/a11y.d.ts +19 -0
- package/lib/typescript/src/components/ui/shared/a11y.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/shared/accessibilityName.d.ts +3 -0
- package/lib/typescript/src/components/ui/shared/accessibilityName.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/shared/selectImageAttemptSource.d.ts +3 -0
- package/lib/typescript/src/components/ui/shared/selectImageAttemptSource.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/shared/selectImageAttemptSource.shared.d.ts +4 -0
- package/lib/typescript/src/components/ui/shared/selectImageAttemptSource.shared.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/shared/selectImageAttemptSource.web.d.ts +3 -0
- package/lib/typescript/src/components/ui/shared/selectImageAttemptSource.web.d.ts.map +1 -0
- package/lib/typescript/src/theme/ThemeProvider.d.ts +2 -3
- package/lib/typescript/src/theme/ThemeProvider.d.ts.map +1 -1
- package/lib/typescript/src/theme/fontScale.d.ts +4 -0
- package/lib/typescript/src/theme/fontScale.d.ts.map +1 -0
- package/lib/typescript/src/theme/index.d.ts +2 -1
- package/lib/typescript/src/theme/index.d.ts.map +1 -1
- package/lib/typescript/src/theme/themeContext.d.ts +6 -0
- package/lib/typescript/src/theme/themeContext.d.ts.map +1 -0
- package/lib/typescript/src/theme/themeDiagnostics.d.ts +6 -0
- package/lib/typescript/src/theme/themeDiagnostics.d.ts.map +1 -0
- package/lib/typescript/src/theme/usePrefersReducedMotion.d.ts +8 -3
- package/lib/typescript/src/theme/usePrefersReducedMotion.d.ts.map +1 -1
- package/lib/typescript/src/theme/usePrefersReducedMotion.web.d.ts +5 -2
- package/lib/typescript/src/theme/usePrefersReducedMotion.web.d.ts.map +1 -1
- package/lib/typescript/src/theme/useTheme.d.ts +1 -1
- package/lib/typescript/src/theme/useTheme.d.ts.map +1 -1
- package/lib/typescript/src/theme/useThemedStyles.d.ts +1 -1
- package/lib/typescript/src/theme/useThemedStyles.d.ts.map +1 -1
- package/lib/typescript/src/utils/imageSource.d.ts +20 -0
- package/lib/typescript/src/utils/imageSource.d.ts.map +1 -0
- package/lib/typescript/type-tests/public-api.d.ts +2 -0
- package/lib/typescript/type-tests/public-api.d.ts.map +1 -0
- package/lib/typescript/website/src/components/iconCatalogCategories.d.ts +11 -0
- package/lib/typescript/website/src/components/iconCatalogCategories.d.ts.map +1 -0
- package/package.json +30 -14
- package/src/components/business/AvatarWithRing/AvatarWithRing.tsx +11 -4
- package/src/components/business/AvatarWithRing/styles.ts +11 -9
- package/src/components/business/VersionPill/VersionPill.tsx +31 -25
- package/src/components/business/VersionPill/content.ts +47 -0
- package/src/components/business/VersionPill/index.ts +1 -1
- package/src/components/business/VersionPill/styles.ts +4 -0
- package/src/components/business/VersionPill/types.ts +7 -2
- package/src/components/business/index.ts +1 -1
- package/src/components/business/useSvgId.ts +29 -8
- package/src/components/ui/Avatar/Avatar.tsx +25 -34
- package/src/components/ui/Avatar/types.ts +6 -2
- package/src/components/ui/Button/Button.tsx +39 -20
- package/src/components/ui/Button/ButtonBase.tsx +21 -12
- package/src/components/ui/Button/types.ts +5 -3
- package/src/components/ui/Carousel/Carousel.tsx +102 -40
- package/src/components/ui/Carousel/behavior.ts +78 -0
- package/src/components/ui/Carousel/styles.ts +5 -7
- package/src/components/ui/Carousel/types.ts +18 -6
- package/src/components/ui/Cell/Cell.tsx +85 -74
- package/src/components/ui/Cell/Leading.tsx +14 -14
- package/src/components/ui/Cell/content.ts +53 -0
- package/src/components/ui/Cell/index.ts +7 -1
- package/src/components/ui/Cell/types.ts +64 -30
- package/src/components/ui/Checkbox/Checkbox.tsx +35 -8
- package/src/components/ui/Checkbox/types.ts +15 -3
- package/src/components/ui/Confirm/ConfirmHost.tsx +51 -26
- package/src/components/ui/Confirm/confirm.ts +17 -34
- package/src/components/ui/Confirm/labels.ts +14 -0
- package/src/components/ui/Confirm/store.ts +147 -0
- package/src/components/ui/Confirm/styles.ts +4 -0
- package/src/components/ui/Confirm/types.ts +2 -10
- package/src/components/ui/DrawerHeader/DrawerHeader.tsx +22 -27
- package/src/components/ui/DrawerHeader/types.ts +7 -1
- package/src/components/ui/Grid/Grid.tsx +44 -12
- package/src/components/ui/Grid/accessibility.ts +21 -0
- package/src/components/ui/Grid/types.ts +2 -0
- package/src/components/ui/IconButton/IconButton.tsx +20 -3
- package/src/components/ui/IconButton/types.ts +4 -2
- package/src/components/ui/Input/Input.tsx +16 -6
- package/src/components/ui/Input/index.ts +5 -0
- package/src/components/ui/Input/types.ts +12 -23
- package/src/components/ui/Logo/Logo.tsx +27 -4
- package/src/components/ui/Logo/types.ts +2 -2
- package/src/components/ui/NavBar/NavBar.tsx +27 -19
- package/src/components/ui/NavBar/index.ts +1 -1
- package/src/components/ui/NavBar/isSlot.ts +372 -5
- package/src/components/ui/NavBar/types.ts +9 -8
- package/src/components/ui/PasswordInput/PasswordInput.tsx +67 -69
- package/src/components/ui/PasswordInput/types.ts +12 -14
- package/src/components/ui/Pulse/PulseDot.tsx +5 -4
- package/src/components/ui/Pulse/normalizePulseOptions.ts +76 -0
- package/src/components/ui/Pulse/usePulse.ts +80 -34
- package/src/components/ui/Pulse/usePulseDriver.ts +49 -0
- package/src/components/ui/Pulse/usePulseDriver.web.ts +66 -0
- package/src/components/ui/Radio/Radio.tsx +44 -15
- package/src/components/ui/Radio/RadioGroup.tsx +21 -3
- package/src/components/ui/Radio/types.ts +17 -3
- package/src/components/ui/Reveal/Reveal.tsx +5 -3
- package/src/components/ui/Reveal/Reveal.web.tsx +72 -29
- package/src/components/ui/Reveal/types.ts +1 -1
- package/src/components/ui/Reveal/webTransition.ts +206 -0
- package/src/components/ui/Search/Search.tsx +127 -58
- package/src/components/ui/Search/types.ts +30 -9
- package/src/components/ui/Segmented/Segmented.tsx +10 -2
- package/src/components/ui/Skeleton/Skeleton.tsx +9 -5
- package/src/components/ui/Spinner/Spinner.tsx +25 -17
- package/src/components/ui/Spinner/Spinner.web.tsx +23 -18
- package/src/components/ui/Spinner/shared.ts +7 -0
- package/src/components/ui/Spinner/types.ts +1 -1
- package/src/components/ui/Stepper/Stepper.tsx +166 -86
- package/src/components/ui/Stepper/StepperPressable.tsx +1 -0
- package/src/components/ui/Stepper/StepperPressable.web.tsx +1 -0
- package/src/components/ui/Stepper/accessibility.ts +32 -0
- package/src/components/ui/Stepper/accessibility.types.ts +22 -0
- package/src/components/ui/Stepper/accessibility.web.ts +65 -0
- package/src/components/ui/Stepper/layout.ts +44 -0
- package/src/components/ui/Stepper/normalizeStepper.ts +85 -0
- package/src/components/ui/Stepper/styles.ts +9 -2
- package/src/components/ui/Stepper/types.ts +3 -1
- package/src/components/ui/Switch/Switch.tsx +54 -15
- package/src/components/ui/Switch/Switch.web.tsx +57 -19
- package/src/components/ui/Switch/styles.ts +11 -4
- package/src/components/ui/Switch/types.ts +2 -2
- package/src/components/ui/Tag/Tag.tsx +6 -2
- package/src/components/ui/TextField/TextFieldBase.tsx +175 -70
- package/src/components/ui/TextField/TextFieldSlot.tsx +91 -0
- package/src/components/ui/TextField/normalize.ts +280 -0
- package/src/components/ui/TextField/styles.ts +31 -0
- package/src/components/ui/TextField/types.ts +118 -22
- package/src/components/ui/TextField/useErrorAnnouncement.ts +27 -0
- package/src/components/ui/TextField/useTextFieldValue.ts +94 -0
- package/src/components/ui/TextField/valueState.ts +125 -0
- package/src/components/ui/Textarea/Textarea.tsx +11 -4
- package/src/components/ui/Textarea/index.ts +5 -0
- package/src/components/ui/Textarea/types.ts +14 -22
- package/src/components/ui/Thumbnail/Thumbnail.tsx +86 -51
- package/src/components/ui/Thumbnail/index.ts +5 -1
- package/src/components/ui/Thumbnail/normalize.ts +78 -0
- package/src/components/ui/Thumbnail/styles.ts +5 -10
- package/src/components/ui/Thumbnail/types.ts +43 -13
- package/src/components/ui/Toast/ToastHost.tsx +81 -22
- package/src/components/ui/Toast/ToastHost.web.tsx +91 -29
- package/src/components/ui/Toast/store.ts +148 -0
- package/src/components/ui/Toast/toast.ts +19 -10
- package/src/components/ui/Toast/types.ts +7 -3
- package/src/components/ui/index.ts +19 -4
- package/src/components/ui/shared/ImageAttempt.tsx +30 -0
- package/src/components/ui/shared/a11y.ts +18 -0
- package/src/components/ui/shared/accessibilityName.ts +6 -0
- package/src/components/ui/shared/selectImageAttemptSource.shared.ts +17 -0
- package/src/components/ui/shared/selectImageAttemptSource.ts +3 -0
- package/src/components/ui/shared/selectImageAttemptSource.web.ts +3 -0
- package/src/icons/data.ts +1 -1
- package/src/theme/ThemeProvider.tsx +18 -7
- package/src/theme/fontScale.ts +15 -0
- package/src/theme/index.ts +2 -3
- package/src/theme/themeContext.ts +24 -0
- package/src/theme/themeDiagnostics.ts +41 -0
- package/src/theme/usePrefersReducedMotion.ts +11 -4
- package/src/theme/usePrefersReducedMotion.web.ts +5 -2
- package/src/theme/useTheme.ts +19 -27
- package/src/theme/useThemedStyles.ts +12 -7
- package/src/utils/imageSource.ts +303 -0
- package/lib/module/components/ui/PasswordInput/styles.js +0 -12
- package/lib/module/components/ui/PasswordInput/styles.js.map +0 -1
- package/lib/module/components/ui/Pulse/usePulse.web.js +0 -76
- package/lib/module/components/ui/Pulse/usePulse.web.js.map +0 -1
- package/lib/typescript/src/components/ui/PasswordInput/styles.d.ts +0 -7
- package/lib/typescript/src/components/ui/PasswordInput/styles.d.ts.map +0 -1
- package/lib/typescript/src/components/ui/Pulse/usePulse.web.d.ts +0 -21
- package/lib/typescript/src/components/ui/Pulse/usePulse.web.d.ts.map +0 -1
- package/src/components/ui/PasswordInput/styles.ts +0 -7
- package/src/components/ui/Pulse/usePulse.web.ts +0 -74
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Stepper 唯一的范围与 action 归一化入口。
|
|
5
|
+
*
|
|
6
|
+
* 组件的视觉状态、handler 和 a11y 都消费同一份结果,避免边界按钮已禁用但
|
|
7
|
+
* adjustable 仍暴露无效 action。
|
|
8
|
+
*/
|
|
9
|
+
export function normalizeStepper({
|
|
10
|
+
value,
|
|
11
|
+
min = 0,
|
|
12
|
+
max = 99,
|
|
13
|
+
step = 1,
|
|
14
|
+
disabled = false
|
|
15
|
+
}) {
|
|
16
|
+
const safeMin = typeof min === 'number' && Number.isFinite(min) ? min : 0;
|
|
17
|
+
const safeMax = typeof max === 'number' && Number.isFinite(max) && max >= safeMin ? max : safeMin;
|
|
18
|
+
const safeStep = typeof step === 'number' && Number.isFinite(step) && step > 0 ? step : 1;
|
|
19
|
+
const safeValue = typeof value === 'number' && Number.isFinite(value) ? Math.min(safeMax, Math.max(safeMin, value)) : safeMin;
|
|
20
|
+
const rangeDisabled = disabled === true || safeMin === safeMax;
|
|
21
|
+
const canDecrement = !rangeDisabled && safeValue > safeMin;
|
|
22
|
+
const canIncrement = !rangeDisabled && safeValue < safeMax;
|
|
23
|
+
const accessibilityActions = [];
|
|
24
|
+
if (canIncrement) {
|
|
25
|
+
accessibilityActions.push({
|
|
26
|
+
name: 'increment',
|
|
27
|
+
label: '增加'
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (canDecrement) {
|
|
31
|
+
accessibilityActions.push({
|
|
32
|
+
name: 'decrement',
|
|
33
|
+
label: '减少'
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
safeMin,
|
|
38
|
+
safeMax,
|
|
39
|
+
safeStep,
|
|
40
|
+
safeValue,
|
|
41
|
+
rangeDisabled,
|
|
42
|
+
canDecrement,
|
|
43
|
+
canIncrement,
|
|
44
|
+
accessibilityActions
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function nextStepperValue(normalized, direction) {
|
|
48
|
+
if (direction === 'increment') {
|
|
49
|
+
return normalized.canIncrement ? Math.min(normalized.safeMax, normalized.safeValue + normalized.safeStep) : undefined;
|
|
50
|
+
}
|
|
51
|
+
return normalized.canDecrement ? Math.max(normalized.safeMin, normalized.safeValue - normalized.safeStep) : undefined;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=normalizeStepper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["normalizeStepper","value","min","max","step","disabled","safeMin","Number","isFinite","safeMax","safeStep","safeValue","Math","rangeDisabled","canDecrement","canIncrement","accessibilityActions","push","name","label","nextStepperValue","normalized","direction","undefined"],"sourceRoot":"../../../../../src","sources":["components/ui/Stepper/normalizeStepper.ts"],"mappings":";;AAwBA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,gBAAgBA,CAAC;EAC/BC,KAAK;EACLC,GAAG,GAAG,CAAC;EACPC,GAAG,GAAG,EAAE;EACRC,IAAI,GAAG,CAAC;EACRC,QAAQ,GAAG;AACc,CAAC,EAAqB;EAC/C,MAAMC,OAAO,GAAG,OAAOJ,GAAG,KAAK,QAAQ,IAAIK,MAAM,CAACC,QAAQ,CAACN,GAAG,CAAC,GAAGA,GAAG,GAAG,CAAC;EACzE,MAAMO,OAAO,GACX,OAAON,GAAG,KAAK,QAAQ,IAAII,MAAM,CAACC,QAAQ,CAACL,GAAG,CAAC,IAAIA,GAAG,IAAIG,OAAO,GAC7DH,GAAG,GACHG,OAAO;EACb,MAAMI,QAAQ,GACZ,OAAON,IAAI,KAAK,QAAQ,IAAIG,MAAM,CAACC,QAAQ,CAACJ,IAAI,CAAC,IAAIA,IAAI,GAAG,CAAC,GAAGA,IAAI,GAAG,CAAC;EAC1E,MAAMO,SAAS,GACb,OAAOV,KAAK,KAAK,QAAQ,IAAIM,MAAM,CAACC,QAAQ,CAACP,KAAK,CAAC,GAC/CW,IAAI,CAACV,GAAG,CAACO,OAAO,EAAEG,IAAI,CAACT,GAAG,CAACG,OAAO,EAAEL,KAAK,CAAC,CAAC,GAC3CK,OAAO;EACb,MAAMO,aAAa,GAAGR,QAAQ,KAAK,IAAI,IAAIC,OAAO,KAAKG,OAAO;EAC9D,MAAMK,YAAY,GAAG,CAACD,aAAa,IAAIF,SAAS,GAAGL,OAAO;EAC1D,MAAMS,YAAY,GAAG,CAACF,aAAa,IAAIF,SAAS,GAAGF,OAAO;EAC1D,MAAMO,oBAA+D,GAAG,EAAE;EAE1E,IAAID,YAAY,EAAE;IAChBC,oBAAoB,CAACC,IAAI,CAAC;MAAEC,IAAI,EAAE,WAAW;MAAEC,KAAK,EAAE;IAAK,CAAC,CAAC;EAC/D;EACA,IAAIL,YAAY,EAAE;IAChBE,oBAAoB,CAACC,IAAI,CAAC;MAAEC,IAAI,EAAE,WAAW;MAAEC,KAAK,EAAE;IAAK,CAAC,CAAC;EAC/D;EAEA,OAAO;IACLb,OAAO;IACPG,OAAO;IACPC,QAAQ;IACRC,SAAS;IACTE,aAAa;IACbC,YAAY;IACZC,YAAY;IACZC;EACF,CAAC;AACH;AAEA,OAAO,SAASI,gBAAgBA,CAC9BC,UAA6B,EAC7BC,SAA2B,EACP;EACpB,IAAIA,SAAS,KAAK,WAAW,EAAE;IAC7B,OAAOD,UAAU,CAACN,YAAY,GAC1BH,IAAI,CAACV,GAAG,CAACmB,UAAU,CAACZ,OAAO,EAAEY,UAAU,CAACV,SAAS,GAAGU,UAAU,CAACX,QAAQ,CAAC,GACxEa,SAAS;EACf;EACA,OAAOF,UAAU,CAACP,YAAY,GAC1BF,IAAI,CAACT,GAAG,CAACkB,UAAU,CAACf,OAAO,EAAEe,UAAU,CAACV,SAAS,GAAGU,UAAU,CAACX,QAAQ,CAAC,GACxEa,SAAS;AACf","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { StyleSheet } from 'react-native';
|
|
4
4
|
import { control, fw, r, radius, type as t } from "../../../theme/index.js";
|
|
5
5
|
/** Stepper 静态 + themed base —— btn / value 容器共用 cell 基底,radius / border 走 token。
|
|
6
|
-
* 尺寸(高 / 宽 / 字号)由 sizingFor 派生,sm 走 control.sm,md 走 r(32)(介于
|
|
6
|
+
* 尺寸(高 / 宽 / 字号)由 sizingFor 派生,sm 走 control.sm (`r(28)`),md 走 r(32)(介于
|
|
7
7
|
* control.sm 与 control.md 之间,与 avatar.md / dim.sendBtn 同值但语义独立)。 */
|
|
8
8
|
export const makeStyles = c => StyleSheet.create({
|
|
9
9
|
wrap: {
|
|
@@ -11,6 +11,13 @@ export const makeStyles = c => StyleSheet.create({
|
|
|
11
11
|
alignItems: 'center',
|
|
12
12
|
alignSelf: 'flex-start'
|
|
13
13
|
},
|
|
14
|
+
actionFrame: {
|
|
15
|
+
justifyContent: 'center'
|
|
16
|
+
},
|
|
17
|
+
valueFrame: {
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'center'
|
|
20
|
+
},
|
|
14
21
|
/** btn / value 共用的 cell 基底 —— 居中 + surface 背景 + 上下边框。
|
|
15
22
|
* 左右边框 / 圆角由 btnLeft / btnRight 增量补齐;value 中间无侧边框。 */
|
|
16
23
|
cell: {
|
|
@@ -43,7 +50,7 @@ export const makeStyles = c => StyleSheet.create({
|
|
|
43
50
|
}
|
|
44
51
|
});
|
|
45
52
|
|
|
46
|
-
/** Stepper 尺寸推导:sm(control.sm
|
|
53
|
+
/** Stepper 尺寸推导:sm(control.sm=`r(28)` 高 / `r(28)` 按钮 / r(40) 值宽 / xs 字)/
|
|
47
54
|
* md(r(32) 高 / r(32) 按钮 / r(48) 值宽 / sm 字)。
|
|
48
55
|
* 新增 size 在 types.ts 加 union + 这里加 case。 */
|
|
49
56
|
export function sizingFor(size) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StyleSheet","control","fw","r","radius","type","t","makeStyles","c","create","wrap","flexDirection","alignItems","alignSelf","
|
|
1
|
+
{"version":3,"names":["StyleSheet","control","fw","r","radius","type","t","makeStyles","c","create","wrap","flexDirection","alignItems","alignSelf","actionFrame","justifyContent","valueFrame","cell","backgroundColor","surface","borderTopWidth","borderBottomWidth","borderColor","outline","btnLeft","borderLeftWidth","borderTopLeftRadius","md","borderBottomLeftRadius","btnRight","borderRightWidth","borderTopRightRadius","borderBottomRightRadius","btnText","fontSize","h1","color","foreground","fontWeight","medium","lineHeight","valueText","sizingFor","size","h","sm","btn","w","fs","xs"],"sourceRoot":"../../../../../src","sources":["components/ui/Stepper/styles.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,OAAO,EAAEC,EAAE,EAAEC,CAAC,EAAEC,MAAM,EAAEC,IAAI,IAAIC,CAAC,QAAQ,yBAAgB;AAIlE;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAIC,CAAc,IACvCR,UAAU,CAACS,MAAM,CAAC;EAChBC,IAAI,EAAE;IACJC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,SAAS,EAAE;EACb,CAAC;EACDC,WAAW,EAAE;IACXC,cAAc,EAAE;EAClB,CAAC;EACDC,UAAU,EAAE;IACVJ,UAAU,EAAE,QAAQ;IACpBG,cAAc,EAAE;EAClB,CAAC;EACD;AACJ;EACIE,IAAI,EAAE;IACJL,UAAU,EAAE,QAAQ;IACpBG,cAAc,EAAE,QAAQ;IACxBG,eAAe,EAAEV,CAAC,CAACW,OAAO;IAC1BC,cAAc,EAAE,CAAC;IACjBC,iBAAiB,EAAE,CAAC;IACpBC,WAAW,EAAEd,CAAC,CAACe;EACjB,CAAC;EACDC,OAAO,EAAE;IACPC,eAAe,EAAE,CAAC;IAClBC,mBAAmB,EAAEtB,MAAM,CAACuB,EAAE;IAC9BC,sBAAsB,EAAExB,MAAM,CAACuB;EACjC,CAAC;EACDE,QAAQ,EAAE;IACRC,gBAAgB,EAAE,CAAC;IACnBC,oBAAoB,EAAE3B,MAAM,CAACuB,EAAE;IAC/BK,uBAAuB,EAAE5B,MAAM,CAACuB;EAClC,CAAC;EACDM,OAAO,EAAE;IACPC,QAAQ,EAAE5B,CAAC,CAAC6B,EAAE;IACdC,KAAK,EAAE5B,CAAC,CAAC6B,UAAU;IACnBC,UAAU,EAAEpC,EAAE,CAACqC,MAAM;IACrBC,UAAU,EAAElC,CAAC,CAAC6B;EAChB,CAAC;EACDM,SAAS,EAAE;IACTL,KAAK,EAAE5B,CAAC,CAAC6B,UAAU;IACnBC,UAAU,EAAEpC,EAAE,CAACqC;EACjB;AACF,CAAC,CAAC;;AAEJ;AACA;AACA;AACA,OAAO,SAASG,SAASA,CAACC,IAAiB,EAKzC;EACA,QAAQA,IAAI;IACV,KAAK,IAAI;MACP,OAAO;QAAEC,CAAC,EAAE3C,OAAO,CAAC4C,EAAE;QAAEC,GAAG,EAAE7C,OAAO,CAAC4C,EAAE;QAAEE,CAAC,EAAE5C,CAAC,CAAC,EAAE,CAAC;QAAE6C,EAAE,EAAE1C,CAAC,CAAC2C;MAAG,CAAC;IAC/D,KAAK,IAAI;MACP,OAAO;QAAEL,CAAC,EAAEzC,CAAC,CAAC,EAAE,CAAC;QAAE2C,GAAG,EAAE3C,CAAC,CAAC,EAAE,CAAC;QAAE4C,CAAC,EAAE5C,CAAC,CAAC,EAAE,CAAC;QAAE6C,EAAE,EAAE1C,CAAC,CAACuC;MAAG,CAAC;EACvD;AACF","ignoreList":[]}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import React, { useEffect } from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
4
5
|
import { Pressable } from 'react-native-gesture-handler';
|
|
5
6
|
import Animated, { cancelAnimation, interpolate, interpolateColor, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
7
|
+
import { motion, useColors, usePrefersReducedMotion, useThemedStyles } from "../../../theme/index.js";
|
|
8
|
+
import { createLogger } from "../../../utils/logger/index.js";
|
|
9
|
+
import { childTestID } from "../../../utils/testID/index.js";
|
|
10
|
+
import { A11Y_HIDDEN_PROPS } from "../shared/a11y.js";
|
|
11
|
+
import { normalizeNonBlankText } from "../shared/accessibilityName.js";
|
|
12
|
+
import { makeStyles, THUMB_OFF_X, THUMB_ON_X } from "./styles.js";
|
|
8
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
const log = createLogger('Switch');
|
|
15
|
+
|
|
9
16
|
/**
|
|
10
17
|
* 布尔切换。32×20 轨道 + 16×16 白色把手,200ms 缓动。
|
|
11
18
|
*
|
|
@@ -21,13 +28,27 @@ export function Switch({
|
|
|
21
28
|
}) {
|
|
22
29
|
const c = useColors();
|
|
23
30
|
const styles = useThemedStyles(makeStyles);
|
|
31
|
+
const reducedMotion = usePrefersReducedMotion();
|
|
24
32
|
const progress = useSharedValue(value ? 1 : 0);
|
|
33
|
+
const accessibleName = normalizeNonBlankText(accessibilityLabel);
|
|
34
|
+
const hasBlankLabel = accessibleName === undefined;
|
|
35
|
+
const isDisabled = disabled === true || hasBlankLabel;
|
|
25
36
|
useEffect(() => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
37
|
+
if (reducedMotion) {
|
|
38
|
+
cancelAnimation(progress);
|
|
39
|
+
progress.value = value ? 1 : 0;
|
|
40
|
+
} else {
|
|
41
|
+
progress.value = withTiming(value ? 1 : 0, {
|
|
42
|
+
duration: motion.base
|
|
43
|
+
});
|
|
44
|
+
}
|
|
29
45
|
return () => cancelAnimation(progress);
|
|
30
|
-
}, [
|
|
46
|
+
}, [progress, reducedMotion, value]);
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (hasBlankLabel) {
|
|
49
|
+
log.warn('Switch accessibilityLabel 不能为空白,当前 action 已禁用。');
|
|
50
|
+
}
|
|
51
|
+
}, [hasBlankLabel]);
|
|
31
52
|
const trackStyle = useAnimatedStyle(() => ({
|
|
32
53
|
backgroundColor: interpolateColor(progress.value, [0, 1], [c.surfaceContainerHighest, c.primary])
|
|
33
54
|
}));
|
|
@@ -37,23 +58,28 @@ export function Switch({
|
|
|
37
58
|
}]
|
|
38
59
|
}));
|
|
39
60
|
return /*#__PURE__*/_jsx(Pressable, {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
accessibilityRole: "switch",
|
|
47
|
-
accessibilityState: {
|
|
61
|
+
accessible: !hasBlankLabel,
|
|
62
|
+
onPress: isDisabled ? undefined : () => onChange(!value),
|
|
63
|
+
disabled: isDisabled,
|
|
64
|
+
style: [styles.pressable, isDisabled && styles.pressableDisabled],
|
|
65
|
+
accessibilityRole: hasBlankLabel ? undefined : 'switch',
|
|
66
|
+
accessibilityState: hasBlankLabel ? undefined : {
|
|
48
67
|
checked: value,
|
|
49
|
-
disabled:
|
|
68
|
+
disabled: isDisabled
|
|
50
69
|
},
|
|
51
|
-
accessibilityLabel:
|
|
70
|
+
accessibilityLabel: accessibleName,
|
|
52
71
|
testID: testID,
|
|
53
|
-
children: /*#__PURE__*/_jsx(
|
|
54
|
-
|
|
72
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
73
|
+
...A11Y_HIDDEN_PROPS,
|
|
74
|
+
style: styles.visualFrame,
|
|
75
|
+
testID: childTestID(testID, 'visual'),
|
|
55
76
|
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
56
|
-
style: [styles.
|
|
77
|
+
style: [styles.track, trackStyle],
|
|
78
|
+
testID: childTestID(testID, 'track'),
|
|
79
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
80
|
+
style: [styles.thumb, thumbStyle],
|
|
81
|
+
testID: childTestID(testID, 'thumb')
|
|
82
|
+
})
|
|
57
83
|
})
|
|
58
84
|
})
|
|
59
85
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","Pressable","Animated","cancelAnimation","interpolate","interpolateColor","useAnimatedStyle","useSharedValue","withTiming","
|
|
1
|
+
{"version":3,"names":["React","useEffect","View","Pressable","Animated","cancelAnimation","interpolate","interpolateColor","useAnimatedStyle","useSharedValue","withTiming","motion","useColors","usePrefersReducedMotion","useThemedStyles","createLogger","childTestID","A11Y_HIDDEN_PROPS","normalizeNonBlankText","makeStyles","THUMB_OFF_X","THUMB_ON_X","jsx","_jsx","log","Switch","value","onChange","disabled","accessibilityLabel","testID","c","styles","reducedMotion","progress","accessibleName","hasBlankLabel","undefined","isDisabled","duration","base","warn","trackStyle","backgroundColor","surfaceContainerHighest","primary","thumbStyle","transform","translateX","accessible","onPress","style","pressable","pressableDisabled","accessibilityRole","accessibilityState","checked","children","visualFrame","track","thumb"],"sourceRoot":"../../../../../src","sources":["components/ui/Switch/Switch.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,SAAS,QAAQ,8BAA8B;AAExD,OAAOC,QAAQ,IACbC,eAAe,EACfC,WAAW,EACXC,gBAAgB,EAChBC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,QACL,yBAAyB;AAChC,SACEC,MAAM,EACNC,SAAS,EACTC,uBAAuB,EACvBC,eAAe,QACV,yBAAgB;AACvB,SAASC,YAAY,QAAQ,gCAAuB;AACpD,SAASC,WAAW,QAAQ,gCAAuB;AACnD,SAASC,iBAAiB,QAAQ,mBAAgB;AAClD,SAASC,qBAAqB,QAAQ,gCAA6B;AACnE,SAASC,UAAU,EAAEC,WAAW,EAAEC,UAAU,QAAQ,aAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAG/D,MAAMC,GAAG,GAAGT,YAAY,CAAC,QAAQ,CAAC;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASU,MAAMA,CAAC;EACrBC,KAAK;EACLC,QAAQ;EACRC,QAAQ;EACRC,kBAAkB;EAClBC;AACW,CAAC,EAAqB;EACjC,MAAMC,CAAC,GAAGnB,SAAS,CAAC,CAAC;EACrB,MAAMoB,MAAM,GAAGlB,eAAe,CAACK,UAAU,CAAC;EAC1C,MAAMc,aAAa,GAAGpB,uBAA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
|
3
|
+
import React, { useEffect } from 'react';
|
|
4
4
|
import { Pressable } from 'react-native-gesture-handler';
|
|
5
5
|
import { View } from 'react-native';
|
|
6
|
-
import { motion, useColors, useThemedStyles } from "../../../theme/index.js";
|
|
6
|
+
import { motion, useColors, usePrefersReducedMotion, useThemedStyles } from "../../../theme/index.js";
|
|
7
|
+
import { createLogger } from "../../../utils/logger/index.js";
|
|
8
|
+
import { childTestID } from "../../../utils/testID/index.js";
|
|
9
|
+
import { A11Y_HIDDEN_PROPS } from "../shared/a11y.js";
|
|
10
|
+
import { normalizeNonBlankText } from "../shared/accessibilityName.js";
|
|
7
11
|
import { makeStyles, THUMB_OFF_X, THUMB_ON_X } from "./styles.js";
|
|
8
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const log = createLogger('Switch');
|
|
14
|
+
|
|
9
15
|
/**
|
|
10
16
|
* Web 端 Switch —— RN-Web 上 reanimated 4 + worklets 0.9.x 的 useAnimatedStyle
|
|
11
17
|
* 链路会抛 `Object.keys(undefined)` TypeError(切换时打印,thumb 卡住),走 CSS
|
|
@@ -25,41 +31,62 @@ export function Switch({
|
|
|
25
31
|
}) {
|
|
26
32
|
const c = useColors();
|
|
27
33
|
const styles = useThemedStyles(makeStyles);
|
|
34
|
+
const reducedMotion = usePrefersReducedMotion();
|
|
35
|
+
const accessibleName = normalizeNonBlankText(accessibilityLabel);
|
|
36
|
+
const hasBlankLabel = accessibleName === undefined;
|
|
37
|
+
const isDisabled = disabled === true || hasBlankLabel;
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (hasBlankLabel) {
|
|
40
|
+
log.warn('Switch accessibilityLabel 不能为空白,当前 action 已禁用。');
|
|
41
|
+
}
|
|
42
|
+
}, [hasBlankLabel]);
|
|
28
43
|
|
|
29
|
-
// 给 RN style 数组追加 web-only
|
|
44
|
+
// 给 RN style 数组追加 web-only 字段;reduced motion 时连 transition key
|
|
45
|
+
// 都不输出,避免浏览器仍创建零时长 transition。
|
|
30
46
|
const trackWebStyle = {
|
|
31
47
|
...styles.track,
|
|
32
48
|
backgroundColor: value ? c.primary : c.surfaceContainerHighest,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
49
|
+
...(reducedMotion ? {} : {
|
|
50
|
+
// RN style 不识 transition 但 RN-Web 会把它当 inline style 透传给 DOM
|
|
51
|
+
transitionProperty: 'background-color',
|
|
52
|
+
transitionDuration: `${motion.base}ms`,
|
|
53
|
+
transitionTimingFunction: 'ease-out'
|
|
54
|
+
})
|
|
37
55
|
};
|
|
38
56
|
const thumbWebStyle = {
|
|
39
57
|
...styles.thumb,
|
|
40
58
|
transform: [{
|
|
41
59
|
translateX: value ? THUMB_ON_X : THUMB_OFF_X
|
|
42
60
|
}],
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
61
|
+
...(reducedMotion ? {} : {
|
|
62
|
+
transitionProperty: 'transform',
|
|
63
|
+
transitionDuration: `${motion.base}ms`,
|
|
64
|
+
transitionTimingFunction: 'ease-out'
|
|
65
|
+
})
|
|
46
66
|
};
|
|
47
67
|
return /*#__PURE__*/_jsx(Pressable, {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
style:
|
|
52
|
-
accessibilityRole:
|
|
53
|
-
accessibilityState: {
|
|
68
|
+
accessible: !hasBlankLabel,
|
|
69
|
+
onPress: isDisabled ? undefined : () => onChange(!value),
|
|
70
|
+
disabled: isDisabled,
|
|
71
|
+
style: [styles.pressable, isDisabled && styles.pressableDisabled],
|
|
72
|
+
accessibilityRole: hasBlankLabel ? undefined : 'switch',
|
|
73
|
+
accessibilityState: hasBlankLabel ? undefined : {
|
|
54
74
|
checked: value,
|
|
55
|
-
disabled:
|
|
75
|
+
disabled: isDisabled
|
|
56
76
|
},
|
|
57
|
-
accessibilityLabel:
|
|
77
|
+
accessibilityLabel: accessibleName,
|
|
58
78
|
testID: testID,
|
|
59
79
|
children: /*#__PURE__*/_jsx(View, {
|
|
60
|
-
|
|
80
|
+
...A11Y_HIDDEN_PROPS,
|
|
81
|
+
style: styles.visualFrame,
|
|
82
|
+
testID: childTestID(testID, 'visual'),
|
|
61
83
|
children: /*#__PURE__*/_jsx(View, {
|
|
62
|
-
style:
|
|
84
|
+
style: trackWebStyle,
|
|
85
|
+
testID: childTestID(testID, 'track'),
|
|
86
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
87
|
+
style: thumbWebStyle,
|
|
88
|
+
testID: childTestID(testID, 'thumb')
|
|
89
|
+
})
|
|
63
90
|
})
|
|
64
91
|
})
|
|
65
92
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Pressable","View","motion","useColors","useThemedStyles","makeStyles","THUMB_OFF_X","THUMB_ON_X","jsx","_jsx","Switch","value","onChange","disabled","accessibilityLabel","testID","c","styles","trackWebStyle","track","backgroundColor","primary","surfaceContainerHighest","transitionProperty","transitionDuration","base","transitionTimingFunction","thumbWebStyle","thumb","transform","translateX","
|
|
1
|
+
{"version":3,"names":["React","useEffect","Pressable","View","motion","useColors","usePrefersReducedMotion","useThemedStyles","createLogger","childTestID","A11Y_HIDDEN_PROPS","normalizeNonBlankText","makeStyles","THUMB_OFF_X","THUMB_ON_X","jsx","_jsx","log","Switch","value","onChange","disabled","accessibilityLabel","testID","c","styles","reducedMotion","accessibleName","hasBlankLabel","undefined","isDisabled","warn","trackWebStyle","track","backgroundColor","primary","surfaceContainerHighest","transitionProperty","transitionDuration","base","transitionTimingFunction","thumbWebStyle","thumb","transform","translateX","accessible","onPress","style","pressable","pressableDisabled","accessibilityRole","accessibilityState","checked","children","visualFrame"],"sourceRoot":"../../../../../src","sources":["components/ui/Switch/Switch.web.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,SAAS,QAAQ,8BAA8B;AACxD,SAASC,IAAI,QAAQ,cAAc;AACnC,SACEC,MAAM,EACNC,SAAS,EACTC,uBAAuB,EACvBC,eAA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OAAO;QAAE,CAAE;MAAC,CAChE;IAAC,CACH;EAAC,CACE,CAAC;AAEhB","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { StyleSheet } from 'react-native';
|
|
4
|
-
import { r, radius } from "../../../theme/index.js";
|
|
4
|
+
import { fixed, r, radius } from "../../../theme/index.js";
|
|
5
5
|
/** 轨道宽 32 / 高 20、把手 16×16、轨道内边距 2 —— Unif 自有 Switch 物理尺寸。
|
|
6
6
|
* 导出常量给 Switch.tsx interpolate translateX 复用(走 r() 保证多设备一致缩放)。 */
|
|
7
7
|
export const TRACK_W = 32;
|
|
@@ -14,14 +14,21 @@ export const INSET = 2;
|
|
|
14
14
|
export const THUMB_OFF_X = r(INSET);
|
|
15
15
|
export const THUMB_ON_X = r(TRACK_W - INSET - THUMB);
|
|
16
16
|
export const makeStyles = c => StyleSheet.create({
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
// 固定命中框不走 r()/fontScale:它是手指可达性约束,不是视觉 token。
|
|
18
|
+
pressable: {
|
|
19
|
+
width: fixed.hitTarget,
|
|
20
|
+
height: fixed.hitTarget,
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
justifyContent: 'center',
|
|
19
23
|
// [L-37] alignSelf:'flex-start' 防止父容器拉伸把手区域(与 Chip [M-8] 同口径)
|
|
20
24
|
alignSelf: 'flex-start'
|
|
21
25
|
},
|
|
22
26
|
pressableDisabled: {
|
|
23
|
-
opacity: 0.5
|
|
24
|
-
|
|
27
|
+
opacity: 0.5
|
|
28
|
+
},
|
|
29
|
+
visualFrame: {
|
|
30
|
+
width: r(TRACK_W),
|
|
31
|
+
height: r(TRACK_H)
|
|
25
32
|
},
|
|
26
33
|
track: {
|
|
27
34
|
width: r(TRACK_W),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StyleSheet","r","radius","TRACK_W","TRACK_H","THUMB","INSET","THUMB_OFF_X","THUMB_ON_X","makeStyles","c","create","
|
|
1
|
+
{"version":3,"names":["StyleSheet","fixed","r","radius","TRACK_W","TRACK_H","THUMB","INSET","THUMB_OFF_X","THUMB_ON_X","makeStyles","c","create","pressable","width","hitTarget","height","alignItems","justifyContent","alignSelf","pressableDisabled","opacity","visualFrame","track","borderRadius","lg","thumb","pill","backgroundColor","onPrimary"],"sourceRoot":"../../../../../src","sources":["components/ui/Switch/styles.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,KAAK,EAAEC,CAAC,EAAEC,MAAM,QAAQ,yBAAgB;AAGjD;AACA;AACA,OAAO,MAAMC,OAAO,GAAG,EAAE;AACzB,OAAO,MAAMC,OAAO,GAAG,EAAE;AACzB,OAAO,MAAMC,KAAK,GAAG,EAAE;AACvB,OAAO,MAAMC,KAAK,GAAG,CAAC;;AAEtB;AACA;AACA,OAAO,MAAMC,WAAW,GAAGN,CAAC,CAACK,KAAK,CAAC;AACnC,OAAO,MAAME,UAAU,GAAGP,CAAC,CAACE,OAAO,GAAGG,KAAK,GAAGD,KAAK,CAAC;AAEpD,OAAO,MAAMI,UAAU,GAAIC,CAAc,IACvCX,UAAU,CAACY,MAAM,CAAC;EAChB;EACAC,SAAS,EAAE;IACTC,KAAK,EAAEb,KAAK,CAACc,SAAS;IACtBC,MAAM,EAAEf,KAAK,CAACc,SAAS;IACvBE,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxB;IACAC,SAAS,EAAE;EACb,CAAC;EACDC,iBAAiB,EAAE;IACjBC,OAAO,EAAE;EACX,CAAC;EACDC,WAAW,EAAE;IACXR,KAAK,EAAEZ,CAAC,CAACE,OAAO,CAAC;IACjBY,MAAM,EAAEd,CAAC,CAACG,OAAO;EACnB,CAAC;EACDkB,KAAK,EAAE;IACLT,KAAK,EAAEZ,CAAC,CAACE,OAAO,CAAC;IACjBY,MAAM,EAAEd,CAAC,CAACG,OAAO,CAAC;IAClBmB,YAAY,EAAErB,MAAM,CAACsB,EAAE;IACvBP,cAAc,EAAE;EAClB,CAAC;EACDQ,KAAK,EAAE;IACLZ,KAAK,EAAEZ,CAAC,CAACI,KAAK,CAAC;IACfU,MAAM,EAAEd,CAAC,CAACI,KAAK,CAAC;IAChB;IACAkB,YAAY,EAAErB,MAAM,CAACwB,IAAI;IACzBC,eAAe,EAAEjB,CAAC,CAACkB;EACrB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { Text, View } from 'react-native';
|
|
4
|
-
import { useColors } from "../../../theme/index.js";
|
|
4
|
+
import { scaleFontMetric, useColors, useFontScale } from "../../../theme/index.js";
|
|
5
5
|
import { paletteFor, sizingFor, styles } from "./styles.js";
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
export function Tag({
|
|
@@ -13,6 +13,7 @@ export function Tag({
|
|
|
13
13
|
testID
|
|
14
14
|
}) {
|
|
15
15
|
const c = useColors();
|
|
16
|
+
const fontScale = useFontScale();
|
|
16
17
|
const palette = paletteFor(variant, c);
|
|
17
18
|
const sizing = sizingFor(size);
|
|
18
19
|
const dynamicStyle = {
|
|
@@ -24,7 +25,7 @@ export function Tag({
|
|
|
24
25
|
};
|
|
25
26
|
const dynamicTextStyle = {
|
|
26
27
|
color: palette.fg,
|
|
27
|
-
fontSize: sizing.fs
|
|
28
|
+
fontSize: scaleFontMetric(sizing.fs, fontScale)
|
|
28
29
|
};
|
|
29
30
|
return /*#__PURE__*/_jsx(View, {
|
|
30
31
|
style: [styles.base, dynamicStyle, style],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Text","View","useColors","paletteFor","sizingFor","styles","jsx","_jsx","Tag","label","variant","size","style","numberOfLines","testID","c","palette","sizing","dynamicStyle","height","h","paddingHorizontal","px","backgroundColor","bg","borderColor","border","borderWidth","dynamicTextStyle","color","fg","fontSize","fs","base","children","text"],"sourceRoot":"../../../../../src","sources":["components/ui/Tag/Tag.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,IAAI,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,yBAAgB;
|
|
1
|
+
{"version":3,"names":["Text","View","scaleFontMetric","useColors","useFontScale","paletteFor","sizingFor","styles","jsx","_jsx","Tag","label","variant","size","style","numberOfLines","testID","c","fontScale","palette","sizing","dynamicStyle","height","h","paddingHorizontal","px","backgroundColor","bg","borderColor","border","borderWidth","dynamicTextStyle","color","fg","fontSize","fs","base","children","text"],"sourceRoot":"../../../../../src","sources":["components/ui/Tag/Tag.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,IAAI,QAAQ,cAAc;AACzC,SAASC,eAAe,EAAEC,SAAS,EAAEC,YAAY,QAAQ,yBAAgB;AACzE,SAASC,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAQ,aAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGzD,OAAO,SAASC,GAAGA,CAAC;EAClBC,KAAK;EACLC,OAAO,GAAG,SAAS;EACnBC,IAAI,GAAG,IAAI;EACXC,KAAK;EACLC,aAAa,GAAG,CAAC;EACjBC;AACQ,CAAC,EAAE;EACX,MAAMC,CAAC,GAAGd,SAAS,CAAC,CAAC;EACrB,MAAMe,SAAS,GAAGd,YAAY,CAAC,CAAC;EAChC,MAAMe,OAAO,GAAGd,UAAU,CAACO,OAAO,EAAEK,CAAC,CAAC;EACtC,MAAMG,MAAM,GAAGd,SAAS,CAACO,IAAI,CAAC;EAE9B,MAAMQ,YAAY,GAAG;IACnBC,MAAM,EAAEF,MAAM,CAACG,CAAC;IAChBC,iBAAiB,EAAEJ,MAAM,CAACK,EAAE;IAC5BC,eAAe,EAAEP,OAAO,CAACQ,EAAE;IAC3BC,WAAW,EAAET,OAAO,CAACU,MAAM,IAAI,aAAa;IAC5CC,WAAW,EAAEX,OAAO,CAACU,MAAM,GAAG,CAAC,GAAG;EACpC,CAAC;EACD,MAAME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