react-native-system-ui 0.0.6 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -30
- package/dist/cjs/components/action-sheet/ActionSheet.js +97 -105
- package/dist/cjs/components/action-sheet/tokens.js +16 -27
- package/dist/cjs/components/area/Area.js +54 -67
- package/dist/cjs/components/area/tokens.js +6 -3
- package/dist/cjs/components/avatar/Avatar.js +25 -23
- package/dist/cjs/components/badge/Badge.js +31 -31
- package/dist/cjs/components/badge/tokens.js +6 -8
- package/dist/cjs/components/button/Button.js +115 -151
- package/dist/cjs/components/button/ButtonGroup.js +8 -42
- package/dist/cjs/components/button/tokens.js +1 -8
- package/dist/cjs/components/calendar/Calendar.js +212 -223
- package/dist/cjs/components/calendar/tokens.js +3 -3
- package/dist/cjs/components/cascader/Cascader.js +177 -180
- package/dist/cjs/components/cascader/tokens.js +2 -2
- package/dist/cjs/components/cascader/useCascaderExtend.js +25 -29
- package/dist/cjs/components/cell/Cell.js +70 -83
- package/dist/cjs/components/cell/CellGroup.js +16 -29
- package/dist/cjs/components/checkbox/Checkbox.js +139 -132
- package/dist/cjs/components/checkbox/CheckboxGroup.js +4 -35
- package/dist/cjs/components/checkbox/tokens.js +7 -10
- package/dist/cjs/components/circle/Circle.js +25 -24
- package/dist/cjs/components/collapse/Collapse.js +75 -91
- package/dist/cjs/components/config-provider/ConfigProvider.js +16 -3
- package/dist/cjs/components/config-provider/DirectionContext.js +15 -0
- package/dist/cjs/components/config-provider/index.js +7 -0
- package/dist/cjs/components/config-provider/locale/en-US.js +32 -0
- package/dist/cjs/components/config-provider/locale/zh-CN.js +32 -0
- package/dist/cjs/components/config-provider/useDirection.js +16 -0
- package/dist/cjs/components/count-down/CountDown.js +20 -15
- package/dist/cjs/components/datetime-picker/DatetimePicker.js +61 -84
- package/dist/cjs/components/datetime-picker/tokens.js +14 -3
- package/dist/cjs/components/dialog/Dialog.js +153 -121
- package/dist/cjs/components/dialog/imperative.js +17 -30
- package/dist/cjs/components/divider/Divider.js +26 -28
- package/dist/cjs/components/empty/Empty.js +35 -39
- package/dist/cjs/components/error-boundary/ErrorBoundary.js +73 -0
- package/dist/cjs/components/error-boundary/index.js +19 -0
- package/dist/cjs/components/field/Field.js +109 -106
- package/dist/cjs/components/flex/Flex.js +18 -18
- package/dist/cjs/components/flex/FlexItem.js +26 -27
- package/dist/cjs/components/form/Form.js +142 -161
- package/dist/cjs/components/form/FormItem.js +69 -97
- package/dist/cjs/components/form/FormList.js +49 -37
- package/dist/cjs/components/form/tokens.js +6 -3
- package/dist/cjs/components/form/utils.js +15 -34
- package/dist/cjs/components/grid/Grid.js +30 -29
- package/dist/cjs/components/grid/GridItem.js +84 -85
- package/dist/cjs/components/image/Image.js +55 -59
- package/dist/cjs/components/image/tokens.js +2 -2
- package/dist/cjs/components/image-preview/ImagePreview.js +124 -112
- package/dist/cjs/components/image-preview/imperative.js +4 -13
- package/dist/cjs/components/index.js +13 -0
- package/dist/cjs/components/input/Input.js +30 -22
- package/dist/cjs/components/loading/Loading.js +14 -15
- package/dist/cjs/components/nav-bar/NavBar.js +68 -83
- package/dist/cjs/components/nav-bar/tokens.js +1 -9
- package/dist/cjs/components/notice-bar/NoticeBar.js +74 -77
- package/dist/cjs/components/notify/Notify.js +88 -84
- package/dist/cjs/components/notify/imperative.js +20 -43
- package/dist/cjs/components/notify/tokens.js +1 -11
- package/dist/cjs/components/number-keyboard/NumberKeyboard.js +187 -209
- package/dist/cjs/components/overlay/Overlay.js +37 -52
- package/dist/cjs/components/overlay/tokens.js +5 -3
- package/dist/cjs/components/password-input/PasswordInput.js +98 -79
- package/dist/cjs/components/picker/Picker.js +440 -421
- package/dist/cjs/components/picker/tokens.js +1 -1
- package/dist/cjs/components/popup/Popup.js +263 -293
- package/dist/cjs/components/portal/Portal.js +12 -29
- package/dist/cjs/components/portal/PortalHost.js +151 -234
- package/dist/cjs/components/progress/Progress.js +51 -48
- package/dist/cjs/components/radio/Radio.js +45 -42
- package/dist/cjs/components/radio/RadioGroup.js +8 -40
- package/dist/cjs/components/radio/tokens.js +7 -10
- package/dist/cjs/components/safe-area-view/SafeAreaView.js +22 -26
- package/dist/cjs/components/search/Search.js +51 -43
- package/dist/cjs/components/selector/Selector.js +14 -13
- package/dist/cjs/components/share-sheet/ShareSheet.js +160 -161
- package/dist/cjs/components/sidebar/Sidebar.js +39 -45
- package/dist/cjs/components/sidebar/SidebarContext.js +1 -2
- package/dist/cjs/components/sidebar/SidebarItem.js +13 -16
- package/dist/cjs/components/sidebar/tokens.js +1 -3
- package/dist/cjs/components/skeleton/Skeleton.js +30 -37
- package/dist/cjs/components/skeleton/tokens.js +1 -2
- package/dist/cjs/components/slider/Slider.js +156 -135
- package/dist/cjs/components/space/Space.js +46 -69
- package/dist/cjs/components/stepper/Stepper.js +177 -155
- package/dist/cjs/components/swiper/Swiper.js +251 -253
- package/dist/cjs/components/swiper/SwiperPagIndicator.js +25 -27
- package/dist/cjs/components/swiper/tokens.js +10 -3
- package/dist/cjs/components/switch/Switch.js +13 -15
- package/dist/cjs/components/tabbar/Tabbar.js +35 -27
- package/dist/cjs/components/tabbar/TabbarContext.js +1 -2
- package/dist/cjs/components/tabbar/TabbarItem.js +65 -68
- package/dist/cjs/components/tabs/Tabs.js +286 -313
- package/dist/cjs/components/tag/Tag.js +46 -37
- package/dist/cjs/components/toast/Toast.js +90 -90
- package/dist/cjs/components/toast/imperative.js +16 -41
- package/dist/cjs/components/typography/Typography.js +3 -5
- package/dist/cjs/components/water-mark/WaterMark.js +31 -29
- package/dist/cjs/design-system/ThemeProvider.js +5 -11
- package/dist/cjs/design-system/createComponentTokensHook.js +11 -13
- package/dist/cjs/design-system/presets.js +2 -3
- package/dist/cjs/design-system/tokens.js +2 -11
- package/dist/cjs/hooks/animation/index.js +25 -0
- package/dist/cjs/hooks/animation/useAnimatedTransition.js +72 -0
- package/dist/cjs/hooks/animation/useReducedMotion.js +75 -0
- package/dist/cjs/hooks/aria/useAriaListBox.js +8 -16
- package/dist/cjs/hooks/aria/useAriaOverlay.js +3 -3
- package/dist/cjs/hooks/aria/useAriaPress.js +8 -21
- package/dist/cjs/hooks/aria/useAriaToggle.js +3 -3
- package/dist/cjs/hooks/gesture/useGestureScroll.js +60 -61
- package/dist/cjs/hooks/index.js +12 -0
- package/dist/cjs/hooks/overlay/OverlayStackStore.js +49 -69
- package/dist/cjs/hooks/overlay/useOverlayStack.js +13 -19
- package/dist/cjs/hooks/useControllableValue.js +10 -21
- package/dist/cjs/hooks/useCountDown.js +14 -22
- package/dist/cjs/hooks/useHairline.js +17 -29
- package/dist/cjs/hooks/useSafeAreaPadding.js +1 -4
- package/dist/cjs/index.js +67 -1
- package/dist/cjs/platform/animation.js +10 -2
- package/dist/cjs/platform/measure.js +18 -36
- package/dist/cjs/utils/color.js +21 -35
- package/dist/cjs/utils/compare.js +7 -12
- package/dist/cjs/utils/createPlatformShadow.js +28 -39
- package/dist/cjs/utils/date.js +20 -50
- package/dist/cjs/utils/deepMerge.js +16 -26
- package/dist/cjs/utils/hairline.js +74 -71
- package/dist/cjs/utils/index.js +22 -0
- package/dist/cjs/utils/number.js +21 -29
- package/dist/cjs/utils/render.js +27 -0
- package/dist/cjs/utils/rtl.js +25 -0
- package/dist/cjs/utils/string.js +8 -25
- package/dist/es/components/action-sheet/ActionSheet.js +99 -107
- package/dist/es/components/action-sheet/tokens.js +16 -27
- package/dist/es/components/area/Area.js +55 -68
- package/dist/es/components/area/tokens.js +6 -3
- package/dist/es/components/avatar/Avatar.js +25 -23
- package/dist/es/components/avatar/index.js +1 -2
- package/dist/es/components/badge/Badge.js +33 -33
- package/dist/es/components/badge/tokens.js +6 -8
- package/dist/es/components/button/Button.js +116 -152
- package/dist/es/components/button/ButtonGroup.js +9 -43
- package/dist/es/components/button/tokens.js +2 -3
- package/dist/es/components/calendar/Calendar.js +214 -225
- package/dist/es/components/calendar/tokens.js +3 -3
- package/dist/es/components/cascader/Cascader.js +180 -183
- package/dist/es/components/cascader/tokens.js +2 -2
- package/dist/es/components/cascader/useCascaderExtend.js +25 -29
- package/dist/es/components/cell/Cell.js +71 -84
- package/dist/es/components/cell/CellGroup.js +16 -28
- package/dist/es/components/checkbox/Checkbox.js +140 -133
- package/dist/es/components/checkbox/CheckboxGroup.js +5 -36
- package/dist/es/components/checkbox/tokens.js +7 -10
- package/dist/es/components/circle/Circle.js +25 -23
- package/dist/es/components/collapse/Collapse.js +77 -92
- package/dist/es/components/config-provider/ConfigProvider.js +10 -3
- package/dist/es/components/config-provider/DirectionContext.js +2 -0
- package/dist/es/components/config-provider/index.js +1 -0
- package/dist/es/components/config-provider/locale/en-US.js +32 -0
- package/dist/es/components/config-provider/locale/zh-CN.js +32 -0
- package/dist/es/components/config-provider/useDirection.js +3 -0
- package/dist/es/components/count-down/CountDown.js +23 -18
- package/dist/es/components/datetime-picker/DatetimePicker.js +61 -84
- package/dist/es/components/datetime-picker/tokens.js +14 -3
- package/dist/es/components/dialog/Dialog.js +154 -121
- package/dist/es/components/dialog/imperative.js +17 -30
- package/dist/es/components/divider/Divider.js +28 -29
- package/dist/es/components/empty/Empty.js +36 -39
- package/dist/es/components/error-boundary/ErrorBoundary.js +61 -0
- package/dist/es/components/error-boundary/index.js +1 -0
- package/dist/es/components/field/Field.js +109 -106
- package/dist/es/components/flex/Flex.js +18 -17
- package/dist/es/components/flex/FlexItem.js +27 -27
- package/dist/es/components/form/Form.js +143 -162
- package/dist/es/components/form/FormItem.js +68 -95
- package/dist/es/components/form/FormList.js +49 -37
- package/dist/es/components/form/tokens.js +6 -3
- package/dist/es/components/form/utils.js +15 -34
- package/dist/es/components/grid/Grid.js +30 -28
- package/dist/es/components/grid/GridItem.js +84 -84
- package/dist/es/components/image/Image.js +58 -62
- package/dist/es/components/image/tokens.js +2 -2
- package/dist/es/components/image-preview/ImagePreview.js +124 -112
- package/dist/es/components/image-preview/imperative.js +4 -13
- package/dist/es/components/index.js +3 -1
- package/dist/es/components/input/Input.js +31 -23
- package/dist/es/components/loading/Loading.js +16 -16
- package/dist/es/components/nav-bar/NavBar.js +68 -83
- package/dist/es/components/nav-bar/tokens.js +1 -3
- package/dist/es/components/notice-bar/NoticeBar.js +74 -76
- package/dist/es/components/notify/Notify.js +92 -87
- package/dist/es/components/notify/imperative.js +21 -44
- package/dist/es/components/notify/tokens.js +1 -5
- package/dist/es/components/number-keyboard/NumberKeyboard.js +187 -209
- package/dist/es/components/overlay/Overlay.js +36 -51
- package/dist/es/components/overlay/tokens.js +5 -3
- package/dist/es/components/password-input/PasswordInput.js +98 -79
- package/dist/es/components/picker/Picker.js +440 -421
- package/dist/es/components/picker/tokens.js +1 -1
- package/dist/es/components/popup/Popup.js +263 -292
- package/dist/es/components/portal/Portal.js +13 -29
- package/dist/es/components/portal/PortalHost.js +152 -234
- package/dist/es/components/progress/Progress.js +51 -48
- package/dist/es/components/radio/Radio.js +47 -44
- package/dist/es/components/radio/RadioGroup.js +10 -41
- package/dist/es/components/radio/tokens.js +7 -10
- package/dist/es/components/safe-area-view/SafeAreaView.js +22 -25
- package/dist/es/components/search/Search.js +52 -44
- package/dist/es/components/selector/Selector.js +14 -13
- package/dist/es/components/share-sheet/ShareSheet.js +162 -163
- package/dist/es/components/sidebar/Sidebar.js +41 -47
- package/dist/es/components/sidebar/SidebarContext.js +1 -2
- package/dist/es/components/sidebar/SidebarItem.js +13 -15
- package/dist/es/components/sidebar/tokens.js +1 -3
- package/dist/es/components/skeleton/Skeleton.js +30 -37
- package/dist/es/components/skeleton/tokens.js +1 -2
- package/dist/es/components/slider/Slider.js +156 -134
- package/dist/es/components/space/Space.js +48 -71
- package/dist/es/components/stepper/Stepper.js +178 -156
- package/dist/es/components/swiper/Swiper.js +252 -254
- package/dist/es/components/swiper/SwiperPagIndicator.js +25 -27
- package/dist/es/components/swiper/tokens.js +10 -3
- package/dist/es/components/switch/Switch.js +13 -15
- package/dist/es/components/tabbar/Tabbar.js +36 -28
- package/dist/es/components/tabbar/TabbarContext.js +1 -2
- package/dist/es/components/tabbar/TabbarItem.js +66 -69
- package/dist/es/components/tabs/Tabs.js +286 -313
- package/dist/es/components/tag/Tag.js +49 -39
- package/dist/es/components/toast/Toast.js +93 -91
- package/dist/es/components/toast/imperative.js +16 -41
- package/dist/es/components/typography/Typography.js +3 -5
- package/dist/es/components/water-mark/WaterMark.js +32 -30
- package/dist/es/design-system/ThemeProvider.js +5 -11
- package/dist/es/design-system/createComponentTokensHook.js +11 -13
- package/dist/es/design-system/presets.js +2 -3
- package/dist/es/design-system/tokens.js +1 -9
- package/dist/es/hooks/animation/index.js +2 -0
- package/dist/es/hooks/animation/useAnimatedTransition.js +53 -0
- package/dist/es/hooks/animation/useReducedMotion.js +54 -0
- package/dist/es/hooks/aria/useAriaListBox.js +8 -16
- package/dist/es/hooks/aria/useAriaOverlay.js +3 -3
- package/dist/es/hooks/aria/useAriaPress.js +8 -21
- package/dist/es/hooks/aria/useAriaToggle.js +3 -3
- package/dist/es/hooks/gesture/useGestureScroll.js +60 -61
- package/dist/es/hooks/index.js +1 -0
- package/dist/es/hooks/overlay/OverlayStackStore.js +49 -69
- package/dist/es/hooks/overlay/useOverlayStack.js +13 -19
- package/dist/es/hooks/useControllableValue.js +10 -21
- package/dist/es/hooks/useCountDown.js +14 -22
- package/dist/es/hooks/useHairline.js +16 -28
- package/dist/es/hooks/useSafeAreaPadding.js +1 -4
- package/dist/es/index.js +8 -1
- package/dist/es/platform/animation.js +9 -1
- package/dist/es/platform/measure.js +18 -36
- package/dist/es/utils/color.js +21 -35
- package/dist/es/utils/compare.js +7 -12
- package/dist/es/utils/createPlatformShadow.js +28 -39
- package/dist/es/utils/date.js +20 -50
- package/dist/es/utils/deepMerge.js +16 -26
- package/dist/es/utils/hairline.js +73 -65
- package/dist/es/utils/index.js +2 -0
- package/dist/es/utils/number.js +21 -29
- package/dist/es/utils/render.js +7 -0
- package/dist/es/utils/rtl.js +17 -0
- package/dist/es/utils/string.js +8 -25
- package/dist/types/components/action-sheet/ActionSheet.d.ts +1 -1
- package/dist/types/components/area/Area.d.ts +1 -1
- package/dist/types/components/area/tokens.d.ts +4 -0
- package/dist/types/components/avatar/Avatar.d.ts +1 -1
- package/dist/types/components/avatar/index.d.ts +1 -2
- package/dist/types/components/badge/Badge.d.ts +1 -1
- package/dist/types/components/button/Button.d.ts +1 -1
- package/dist/types/components/button/index.d.ts +1 -1
- package/dist/types/components/calendar/Calendar.d.ts +1 -1
- package/dist/types/components/cascader/Cascader.d.ts +1 -1
- package/dist/types/components/cell/Cell.d.ts +1 -1
- package/dist/types/components/cell/CellGroup.d.ts +1 -1
- package/dist/types/components/cell/index.d.ts +2 -2
- package/dist/types/components/checkbox/Checkbox.d.ts +1 -1
- package/dist/types/components/circle/Circle.d.ts +1 -1
- package/dist/types/components/collapse/Collapse.d.ts +1 -2
- package/dist/types/components/config-provider/DirectionContext.d.ts +3 -0
- package/dist/types/components/config-provider/index.d.ts +2 -1
- package/dist/types/components/config-provider/locale/en-US.d.ts +32 -0
- package/dist/types/components/config-provider/locale/zh-CN.d.ts +32 -0
- package/dist/types/components/config-provider/useDirection.d.ts +1 -0
- package/dist/types/components/count-down/CountDown.d.ts +1 -1
- package/dist/types/components/datetime-picker/DatetimePicker.d.ts +1 -1
- package/dist/types/components/datetime-picker/tokens.d.ts +12 -0
- package/dist/types/components/dialog/Dialog.d.ts +1 -1
- package/dist/types/components/divider/Divider.d.ts +1 -1
- package/dist/types/components/empty/Empty.d.ts +1 -1
- package/dist/types/components/error-boundary/ErrorBoundary.d.ts +6 -0
- package/dist/types/components/error-boundary/index.d.ts +2 -0
- package/dist/types/components/field/Field.d.ts +1 -1
- package/dist/types/components/flex/Flex.d.ts +1 -1
- package/dist/types/components/flex/FlexItem.d.ts +1 -1
- package/dist/types/components/flex/index.d.ts +2 -2
- package/dist/types/components/form/Form.d.ts +1 -1
- package/dist/types/components/form/FormItem.d.ts +2 -1
- package/dist/types/components/form/index.d.ts +2 -2
- package/dist/types/components/form/tokens.d.ts +4 -0
- package/dist/types/components/grid/Grid.d.ts +1 -1
- package/dist/types/components/grid/GridItem.d.ts +1 -1
- package/dist/types/components/grid/index.d.ts +2 -2
- package/dist/types/components/image/Image.d.ts +1 -1
- package/dist/types/components/image-preview/ImagePreview.d.ts +1 -1
- package/dist/types/components/index.d.ts +4 -1
- package/dist/types/components/input/Input.d.ts +3 -3
- package/dist/types/components/loading/Loading.d.ts +1 -1
- package/dist/types/components/nav-bar/NavBar.d.ts +1 -1
- package/dist/types/components/notice-bar/NoticeBar.d.ts +1 -1
- package/dist/types/components/notify/Notify.d.ts +2 -2
- package/dist/types/components/notify/index.d.ts +1 -1
- package/dist/types/components/overlay/Overlay.d.ts +1 -5
- package/dist/types/components/overlay/tokens.d.ts +3 -0
- package/dist/types/components/password-input/PasswordInput.d.ts +1 -1
- package/dist/types/components/picker/Picker.d.ts +5 -5
- package/dist/types/components/popup/Popup.d.ts +3 -42
- package/dist/types/components/portal/Portal.d.ts +9 -6
- package/dist/types/components/portal/PortalHost.d.ts +1 -1
- package/dist/types/components/radio/RadioGroup.d.ts +1 -1
- package/dist/types/components/safe-area-view/SafeAreaView.d.ts +1 -1
- package/dist/types/components/search/Search.d.ts +1 -1
- package/dist/types/components/share-sheet/ShareSheet.d.ts +1 -1
- package/dist/types/components/sidebar/Sidebar.d.ts +1 -1
- package/dist/types/components/sidebar/SidebarContext.d.ts +1 -1
- package/dist/types/components/sidebar/SidebarItem.d.ts +1 -1
- package/dist/types/components/sidebar/index.d.ts +2 -2
- package/dist/types/components/skeleton/Skeleton.d.ts +1 -1
- package/dist/types/components/slider/Slider.d.ts +1 -1
- package/dist/types/components/stepper/Stepper.d.ts +1 -1
- package/dist/types/components/swiper/Swiper.d.ts +1 -1
- package/dist/types/components/swiper/index.d.ts +1 -1
- package/dist/types/components/swiper/tokens.d.ts +8 -0
- package/dist/types/components/tabbar/Tabbar.d.ts +2 -2
- package/dist/types/components/tabbar/TabbarContext.d.ts +1 -1
- package/dist/types/components/tabbar/TabbarItem.d.ts +2 -2
- package/dist/types/components/tabs/Tabs.d.ts +1 -1
- package/dist/types/components/tabs/index.d.ts +1 -1
- package/dist/types/components/tag/Tag.d.ts +1 -1
- package/dist/types/components/toast/Toast.d.ts +2 -2
- package/dist/types/components/toast/index.d.ts +1 -1
- package/dist/types/components/water-mark/WaterMark.d.ts +1 -1
- package/dist/types/design-system/tokens.d.ts +0 -1
- package/dist/types/hooks/animation/index.d.ts +3 -0
- package/dist/types/hooks/animation/useAnimatedTransition.d.ts +13 -0
- package/dist/types/hooks/animation/useReducedMotion.d.ts +3 -0
- package/dist/types/hooks/aria/useAriaOverlay.d.ts +1 -1
- package/dist/types/hooks/gesture/useGestureScroll.d.ts +11 -10
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/overlay/OverlayStackStore.d.ts +8 -8
- package/dist/types/hooks/useHairline.d.ts +1 -1
- package/dist/types/index.d.ts +5 -0
- package/dist/types/platform/animation.d.ts +8 -0
- package/dist/types/platform/measure.d.ts +1 -1
- package/dist/types/utils/compare.d.ts +1 -1
- package/dist/types/utils/createPlatformShadow.d.ts +2 -2
- package/dist/types/utils/date.d.ts +2 -2
- package/dist/types/utils/hairline.d.ts +5 -10
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/number.d.ts +2 -2
- package/dist/types/utils/render.d.ts +5 -0
- package/dist/types/utils/rtl.d.ts +5 -0
- package/package.json +10 -3
|
@@ -19,6 +19,7 @@ function _reactNative() {
|
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
21
|
var _utils = require("../../utils");
|
|
22
|
+
var _animation = require("../../hooks/animation");
|
|
22
23
|
var _tokens = require("./tokens");
|
|
23
24
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
24
25
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
@@ -29,20 +30,20 @@ const ProgressFilledTrack = ({
|
|
|
29
30
|
}) => {
|
|
30
31
|
const context = (0, _react().useContext)(ProgressContext);
|
|
31
32
|
if (!context) return null;
|
|
32
|
-
const
|
|
33
|
+
const size = (0, _react().useMemo)(() => context.animatedValue.interpolate({
|
|
33
34
|
inputRange: [0, 100],
|
|
34
35
|
outputRange: ['0%', '100%']
|
|
35
36
|
}), [context.animatedValue]);
|
|
36
37
|
const sizeStyle = (0, _react().useMemo)(() => context.orientation === 'vertical' ? {
|
|
37
38
|
width: context.height,
|
|
38
|
-
height:
|
|
39
|
+
height: size,
|
|
39
40
|
bottom: 0,
|
|
40
41
|
left: 0,
|
|
41
42
|
position: 'absolute'
|
|
42
43
|
} : {
|
|
43
44
|
height: context.height,
|
|
44
|
-
width:
|
|
45
|
-
}, [context.height, context.orientation,
|
|
45
|
+
width: size
|
|
46
|
+
}, [context.height, context.orientation, size]);
|
|
46
47
|
const baseStyle = [context.orientation === 'vertical' ? {
|
|
47
48
|
position: 'absolute',
|
|
48
49
|
left: 0,
|
|
@@ -82,86 +83,88 @@ const Progress = exports.Progress = /*#__PURE__*/(0, _react().memo)(props => {
|
|
|
82
83
|
...rest
|
|
83
84
|
} = props;
|
|
84
85
|
const tokens = (0, _tokens.useProgressTokens)(tokensOverride);
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
const
|
|
86
|
+
const reducedMotion = (0, _animation.useReducedMotion)();
|
|
87
|
+
const percentageClamped = (0, _utils.clamp)((0, _utils.parsePercentage)(percentageProp ?? tokens.defaults.percentage), 0, 100);
|
|
88
|
+
const height = (0, _utils.parseNumberLike)(strokeWidth, tokens.sizing.height) ?? tokens.sizing.height;
|
|
89
|
+
const inactive = inactiveProp ?? tokens.defaults.inactive;
|
|
88
90
|
const orientation = orientationProp ?? 'horizontal';
|
|
89
|
-
const
|
|
90
|
-
const shouldAnimate = (
|
|
91
|
-
const duration =
|
|
91
|
+
const showPivotValue = orientation === 'vertical' ? false : showPivotProp ?? tokens.defaults.showPivot;
|
|
92
|
+
const shouldAnimate = (animated ?? transitionProp ?? tokens.defaults.transition) && !inactive;
|
|
93
|
+
const duration = Math.max(0, animationDurationProp ?? tokens.defaults.animationDuration);
|
|
92
94
|
const isGradient = _reactNative().Platform.OS === 'web' && (0, _utils.isString)(color) && GRADIENT_REGEX.test(color);
|
|
93
|
-
const resolvedTrackColor =
|
|
94
|
-
const resolvedIndicatorColor =
|
|
95
|
-
const
|
|
96
|
-
const resolvedPivotTextColor =
|
|
97
|
-
const
|
|
98
|
-
const hasPivot =
|
|
99
|
-
const animatedValue = (0, _react().useRef)(new (_reactNative().Animated.Value)(
|
|
95
|
+
const resolvedTrackColor = trackColor ?? tokens.colors.track;
|
|
96
|
+
const resolvedIndicatorColor = inactive ? tokens.colors.track : !isGradient ? color ?? tokens.colors.indicator : undefined;
|
|
97
|
+
const resolvedPivotBackground = pivotColor ?? (isGradient ? inactive ? tokens.colors.track : tokens.colors.indicator : resolvedIndicatorColor);
|
|
98
|
+
const resolvedPivotTextColor = textColor ?? tokens.colors.pivotText;
|
|
99
|
+
const pivotContentText = pivotText ?? `${percentageClamped}%`;
|
|
100
|
+
const hasPivot = showPivotValue && pivotContentText !== null && pivotContentText !== false;
|
|
101
|
+
const animatedValue = (0, _react().useRef)(new (_reactNative().Animated.Value)(percentageClamped)).current;
|
|
100
102
|
(0, _react().useEffect)(() => {
|
|
101
|
-
if (shouldAnimate && duration > 0) {
|
|
103
|
+
if (shouldAnimate && duration > 0 && !reducedMotion) {
|
|
102
104
|
const animation = _reactNative().Animated.timing(animatedValue, {
|
|
103
|
-
toValue:
|
|
105
|
+
toValue: percentageClamped,
|
|
104
106
|
duration,
|
|
105
|
-
useNativeDriver: false
|
|
107
|
+
useNativeDriver: false,
|
|
108
|
+
isInteraction: false
|
|
106
109
|
});
|
|
107
110
|
animation.start();
|
|
108
111
|
return () => animation.stop();
|
|
109
112
|
} else {
|
|
110
|
-
animatedValue.setValue(
|
|
113
|
+
animatedValue.setValue(percentageClamped);
|
|
111
114
|
}
|
|
112
|
-
}, [
|
|
115
|
+
}, [percentageClamped, shouldAnimate, duration, animatedValue, reducedMotion]);
|
|
113
116
|
const [layout, setLayout] = (0, _react().useState)({
|
|
114
117
|
track: 0,
|
|
115
118
|
pivot: 0
|
|
116
119
|
});
|
|
117
|
-
const onTrackLayout = (0, _react().useCallback)(
|
|
118
|
-
const width =
|
|
120
|
+
const onTrackLayout = (0, _react().useCallback)(event => {
|
|
121
|
+
const width = event.nativeEvent.layout.width;
|
|
119
122
|
setLayout(prev => prev.track === width ? prev : {
|
|
120
123
|
...prev,
|
|
121
124
|
track: width
|
|
122
125
|
});
|
|
123
126
|
}, []);
|
|
124
|
-
const onPivotLayout = (0, _react().useCallback)(
|
|
125
|
-
const width =
|
|
127
|
+
const onPivotLayout = (0, _react().useCallback)(event => {
|
|
128
|
+
const width = event.nativeEvent.layout.width;
|
|
126
129
|
setLayout(prev => prev.pivot === width ? prev : {
|
|
127
130
|
...prev,
|
|
128
131
|
pivot: width
|
|
129
132
|
});
|
|
130
133
|
}, []);
|
|
131
|
-
const trackStyle =
|
|
134
|
+
const trackStyle = [tokens.layout.track, orientation === 'vertical' ? {
|
|
132
135
|
width: height,
|
|
133
136
|
height: '100%',
|
|
134
137
|
backgroundColor: resolvedTrackColor,
|
|
135
138
|
borderRadius: height / 2
|
|
136
139
|
} : {
|
|
137
|
-
height,
|
|
140
|
+
height: height,
|
|
138
141
|
backgroundColor: resolvedTrackColor,
|
|
139
142
|
borderRadius: height / 2
|
|
140
|
-
}]
|
|
143
|
+
}];
|
|
141
144
|
const pivotNode = (0, _react().useMemo)(() => {
|
|
142
145
|
if (!hasPivot) return null;
|
|
143
146
|
const {
|
|
144
|
-
track:
|
|
145
|
-
pivot:
|
|
147
|
+
track: trackWidth,
|
|
148
|
+
pivot: pivotWidth
|
|
146
149
|
} = layout;
|
|
147
150
|
const pivotContainerStyle = [tokens.layout.pivot, {
|
|
148
151
|
bottom: height + tokens.sizing.pivotPaddingVertical * 2,
|
|
149
|
-
backgroundColor:
|
|
152
|
+
backgroundColor: resolvedPivotBackground,
|
|
150
153
|
paddingHorizontal: tokens.sizing.pivotPaddingHorizontal,
|
|
151
154
|
paddingVertical: tokens.sizing.pivotPaddingVertical,
|
|
152
155
|
borderRadius: height,
|
|
153
|
-
opacity:
|
|
156
|
+
opacity: trackWidth > 0 ? 1 : 0
|
|
154
157
|
}];
|
|
155
158
|
let transformStyle = null;
|
|
156
|
-
if (
|
|
157
|
-
const
|
|
158
|
-
const
|
|
159
|
-
if (
|
|
159
|
+
if (trackWidth > 0 && pivotWidth > 0) {
|
|
160
|
+
const pivotPosition1 = pivotWidth / 2 / trackWidth * 100;
|
|
161
|
+
const pivotPosition2 = (trackWidth - pivotWidth / 2) / trackWidth * 100;
|
|
162
|
+
if (pivotPosition1 < pivotPosition2) {
|
|
160
163
|
transformStyle = {
|
|
161
164
|
transform: [{
|
|
162
165
|
translateX: animatedValue.interpolate({
|
|
163
|
-
inputRange: [0,
|
|
164
|
-
outputRange: [0, 0,
|
|
166
|
+
inputRange: [0, pivotPosition1, pivotPosition2, 100],
|
|
167
|
+
outputRange: [0, 0, trackWidth - pivotWidth, trackWidth - pivotWidth],
|
|
165
168
|
extrapolate: 'clamp'
|
|
166
169
|
})
|
|
167
170
|
}]
|
|
@@ -169,7 +172,7 @@ const Progress = exports.Progress = /*#__PURE__*/(0, _react().memo)(props => {
|
|
|
169
172
|
} else {
|
|
170
173
|
transformStyle = {
|
|
171
174
|
transform: [{
|
|
172
|
-
translateX: (
|
|
175
|
+
translateX: (trackWidth - pivotWidth) / 2
|
|
173
176
|
}]
|
|
174
177
|
};
|
|
175
178
|
}
|
|
@@ -178,20 +181,20 @@ const Progress = exports.Progress = /*#__PURE__*/(0, _react().memo)(props => {
|
|
|
178
181
|
style: [pivotContainerStyle, transformStyle],
|
|
179
182
|
pointerEvents: "none",
|
|
180
183
|
onLayout: onPivotLayout
|
|
181
|
-
}, (0, _utils.isText)(
|
|
184
|
+
}, (0, _utils.isText)(pivotContentText) ? /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
|
|
182
185
|
style: [tokens.layout.pivotText, {
|
|
183
186
|
color: resolvedPivotTextColor,
|
|
184
187
|
fontSize: tokens.typography.pivotFontSize
|
|
185
188
|
}, pivotStyle]
|
|
186
|
-
},
|
|
187
|
-
}, [animatedValue, hasPivot, height, layout, onPivotLayout,
|
|
189
|
+
}, pivotContentText) : pivotContentText);
|
|
190
|
+
}, [animatedValue, hasPivot, height, layout, onPivotLayout, pivotContentText, pivotStyle, resolvedPivotBackground, resolvedPivotTextColor, tokens.layout.pivot, tokens.layout.pivotText, tokens.sizing.pivotPaddingHorizontal, tokens.sizing.pivotPaddingVertical, tokens.typography.pivotFontSize]);
|
|
188
191
|
const progressContextValue = (0, _react().useMemo)(() => ({
|
|
189
|
-
animatedValue,
|
|
190
|
-
orientation,
|
|
191
|
-
height,
|
|
192
|
+
animatedValue: animatedValue,
|
|
193
|
+
orientation: orientation,
|
|
194
|
+
height: height,
|
|
192
195
|
indicatorColor: resolvedIndicatorColor,
|
|
193
196
|
indicatorStyle: indicatorStyle,
|
|
194
|
-
isGradient,
|
|
197
|
+
isGradient: isGradient,
|
|
195
198
|
gradientColor: isGradient ? color : undefined,
|
|
196
199
|
layoutIndicator: tokens.layout.indicator
|
|
197
200
|
}), [animatedValue, color, height, indicatorStyle, isGradient, orientation, resolvedIndicatorColor, tokens.layout.indicator]);
|
|
@@ -203,7 +206,7 @@ const Progress = exports.Progress = /*#__PURE__*/(0, _react().memo)(props => {
|
|
|
203
206
|
accessibilityValue: {
|
|
204
207
|
min: 0,
|
|
205
208
|
max: 100,
|
|
206
|
-
now:
|
|
209
|
+
now: percentageClamped
|
|
207
210
|
}
|
|
208
211
|
}, rest), /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
209
212
|
style: trackStyle,
|
|
@@ -35,6 +35,7 @@ function _toggle() {
|
|
|
35
35
|
var _RadioContext = require("./RadioContext");
|
|
36
36
|
var _tokens = require("./tokens");
|
|
37
37
|
var _utils = require("../../utils");
|
|
38
|
+
var _validate = require("../../utils/validate");
|
|
38
39
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
39
40
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
40
41
|
const Radio = exports.Radio = /*#__PURE__*/_react().default.memo(props => {
|
|
@@ -74,7 +75,11 @@ const Radio = exports.Radio = /*#__PURE__*/_react().default.memo(props => {
|
|
|
74
75
|
const standaloneKey = serializedValue ?? 'standalone';
|
|
75
76
|
const inputRef = (0, _react().useRef)(null);
|
|
76
77
|
const inputElementRef = (0, _react().useRef)(null);
|
|
77
|
-
const
|
|
78
|
+
const onChangeRef = (0, _react().useRef)(onChange);
|
|
79
|
+
onChangeRef.current = onChange;
|
|
80
|
+
const onClickRef = (0, _react().useRef)(onClick);
|
|
81
|
+
onClickRef.current = onClick;
|
|
82
|
+
const resolvedAccessibilityLabel = accessibilityLabel ?? ariaLabel ?? ((0, _validate.isText)(children) ? String(children) : undefined) ?? serializedValue ?? 'radio';
|
|
78
83
|
const {
|
|
79
84
|
isSelected: standaloneSelected,
|
|
80
85
|
setSelected: setStandaloneSelected
|
|
@@ -116,67 +121,68 @@ const Radio = exports.Radio = /*#__PURE__*/_react().default.memo(props => {
|
|
|
116
121
|
const isChecked = isGroup && group && serializedValue !== undefined ? group.state.selectedValue === serializedValue : checked !== undefined ? checked : standaloneSelected;
|
|
117
122
|
const inputOnPress = inputProps?.onPress;
|
|
118
123
|
const handlePress = (0, _react().useCallback)(e => {
|
|
119
|
-
|
|
124
|
+
onClickRef.current?.(e);
|
|
120
125
|
if (resolvedDisabled) return;
|
|
121
126
|
if (isGroup && group && serializedValue !== undefined) {
|
|
122
127
|
if (!isChecked) group.state.setSelectedValue(serializedValue);
|
|
123
128
|
return;
|
|
124
129
|
}
|
|
125
130
|
if (checked !== undefined) {
|
|
126
|
-
|
|
131
|
+
onChangeRef.current?.(!checked);
|
|
127
132
|
return;
|
|
128
133
|
}
|
|
129
|
-
if (
|
|
134
|
+
if (onChangeRef.current) {
|
|
130
135
|
setStandaloneSelected(!standaloneSelected);
|
|
131
136
|
return;
|
|
132
137
|
}
|
|
133
138
|
inputOnPress?.(e);
|
|
134
|
-
}, [checked, group, inputOnPress, isChecked, isGroup,
|
|
139
|
+
}, [checked, group, inputOnPress, isChecked, isGroup, resolvedDisabled, serializedValue, setStandaloneSelected, standaloneSelected]);
|
|
135
140
|
const mergedInputProps = inputProps ? {
|
|
136
141
|
...inputProps,
|
|
137
142
|
onPress: handlePress
|
|
138
143
|
} : {};
|
|
139
144
|
const borderColor = resolvedDisabled ? tokens.colors.disabledBorder : isChecked ? resolvedCheckedColor : tokens.colors.border;
|
|
140
145
|
const backgroundColor = resolvedDisabled ? tokens.colors.disabledBackground : tokens.colors.background;
|
|
141
|
-
const spacingStyle =
|
|
146
|
+
const spacingStyle = resolvedLabelPosition === 'left' ? {
|
|
142
147
|
marginRight: tokens.spacing.gap
|
|
143
148
|
} : {
|
|
144
149
|
marginLeft: tokens.spacing.gap
|
|
145
|
-
}
|
|
146
|
-
const labelColor =
|
|
147
|
-
const borderRadius =
|
|
148
|
-
const labelNode = (0, _react().useMemo)(() =>
|
|
150
|
+
};
|
|
151
|
+
const labelColor = resolvedDisabled ? tokens.colors.labelDisabled : tokens.colors.label;
|
|
152
|
+
const borderRadius = shape === 'square' ? tokens.radii.square : tokens.radii.round;
|
|
153
|
+
const labelNode = (0, _react().useMemo)(() => !(0, _validate.isRenderable)(children) ? null : /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
149
154
|
style: [tokens.layout.labelWrapper, spacingStyle],
|
|
150
155
|
pointerEvents: "none",
|
|
151
156
|
accessible: false
|
|
152
|
-
}, (0, _utils.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
fontWeight: tokens.typography.fontWeight
|
|
160
|
-
}, labelStyle]
|
|
161
|
-
}, children) : children), [children, labelColor, labelStyle, spacingStyle, tokens.layout.label, tokens.layout.labelWrapper, tokens.typography.fontFamily, tokens.typography.fontSize, tokens.typography.fontWeight, tokens.typography.lineHeightMultiplier]);
|
|
157
|
+
}, (0, _utils.renderTextOrNode)(children, [tokens.layout.label, {
|
|
158
|
+
color: labelColor,
|
|
159
|
+
fontSize: tokens.typography.fontSize,
|
|
160
|
+
lineHeight: tokens.typography.fontSize * tokens.typography.lineHeightMultiplier,
|
|
161
|
+
fontFamily: tokens.typography.fontFamily,
|
|
162
|
+
fontWeight: tokens.typography.fontWeight
|
|
163
|
+
}, labelStyle].filter(Boolean))), [children, labelColor, labelStyle, spacingStyle, tokens.layout.label, tokens.layout.labelWrapper, tokens.typography.fontFamily, tokens.typography.fontSize, tokens.typography.fontWeight, tokens.typography.lineHeightMultiplier]);
|
|
162
164
|
const interactive = !resolvedDisabled && !resolvedLabelDisabled;
|
|
163
165
|
const defaultIcon = (0, _react().useMemo)(() => /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
164
166
|
style: [tokens.layout.icon, {
|
|
165
167
|
width: resolvedIconSize,
|
|
166
168
|
height: resolvedIconSize,
|
|
167
169
|
borderRadius,
|
|
168
|
-
borderWidth: tokens.borders.width,
|
|
169
|
-
borderColor,
|
|
170
170
|
backgroundColor
|
|
171
171
|
}]
|
|
172
|
-
}, isChecked
|
|
172
|
+
}, isChecked && /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
173
173
|
style: {
|
|
174
174
|
width: resolvedIconSize * tokens.sizing.dotScale,
|
|
175
175
|
height: resolvedIconSize * tokens.sizing.dotScale,
|
|
176
176
|
borderRadius,
|
|
177
177
|
backgroundColor: resolvedCheckedColor
|
|
178
178
|
}
|
|
179
|
-
})
|
|
179
|
+
}), /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
180
|
+
style: (0, _utils.createHairlineView)({
|
|
181
|
+
position: 'all',
|
|
182
|
+
color: borderColor,
|
|
183
|
+
borderRadius
|
|
184
|
+
})
|
|
185
|
+
})), [backgroundColor, borderColor, borderRadius, isChecked, resolvedCheckedColor, resolvedIconSize, tokens.layout.icon, tokens.sizing.dotScale]);
|
|
180
186
|
const iconVisual = iconRender ? iconRender({
|
|
181
187
|
checked: Boolean(isChecked),
|
|
182
188
|
disabled: Boolean(resolvedDisabled)
|
|
@@ -215,24 +221,21 @@ const Radio = exports.Radio = /*#__PURE__*/_react().default.memo(props => {
|
|
|
215
221
|
},
|
|
216
222
|
style: tokens.layout.iconWrapper
|
|
217
223
|
}), iconVisual, webInputNode);
|
|
218
|
-
const
|
|
219
|
-
const first =
|
|
220
|
-
const second =
|
|
221
|
-
if (interactive) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}), first, second);
|
|
233
|
-
}
|
|
224
|
+
const isLeft = resolvedLabelPosition === 'left';
|
|
225
|
+
const first = isLeft ? labelNode : iconNode;
|
|
226
|
+
const second = isLeft ? iconNode : labelNode;
|
|
227
|
+
if (interactive) return /*#__PURE__*/_react().default.createElement(_reactNative().Pressable, _extends({}, mergedInputProps, {
|
|
228
|
+
ref: inputRef,
|
|
229
|
+
testID: serializedValue !== undefined ? `radio-icon-${serializedValue}` : undefined,
|
|
230
|
+
disabled: resolvedDisabled,
|
|
231
|
+
accessibilityRole: "radio",
|
|
232
|
+
accessibilityState: {
|
|
233
|
+
selected: isChecked,
|
|
234
|
+
disabled: resolvedDisabled
|
|
235
|
+
},
|
|
236
|
+
style: [tokens.layout.container, style]
|
|
237
|
+
}), first, second);
|
|
234
238
|
return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
235
239
|
style: [tokens.layout.container, style]
|
|
236
240
|
}, first, second);
|
|
237
|
-
});
|
|
238
|
-
Radio.displayName = 'Radio';
|
|
241
|
+
});
|
|
@@ -36,7 +36,7 @@ var _tokens = require("./tokens");
|
|
|
36
36
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
37
37
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
38
38
|
const RadioGroupContext = exports.RadioGroupContext = /*#__PURE__*/_react().default.createContext(null);
|
|
39
|
-
const
|
|
39
|
+
const RadioGroupImpl = props => {
|
|
40
40
|
const {
|
|
41
41
|
value,
|
|
42
42
|
defaultValue,
|
|
@@ -71,8 +71,7 @@ const RadioGroup = props => {
|
|
|
71
71
|
defaultValue: defaultValue == null ? undefined : String(defaultValue),
|
|
72
72
|
isDisabled: disabled,
|
|
73
73
|
onChange: key => {
|
|
74
|
-
|
|
75
|
-
onChange?.(raw ?? key);
|
|
74
|
+
onChange?.(registryRef.current.get(key) ?? key);
|
|
76
75
|
},
|
|
77
76
|
name
|
|
78
77
|
});
|
|
@@ -90,25 +89,6 @@ const RadioGroup = props => {
|
|
|
90
89
|
}),
|
|
91
90
|
'aria-disabled': disabled
|
|
92
91
|
}), [accessibilityHint, disabled, radioGroupProps]);
|
|
93
|
-
const supportsGap = _reactNative().Platform.OS === 'web';
|
|
94
|
-
const childrenArray = (0, _react().useMemo)(() => _react().default.Children.toArray(children).filter(child => child != null && typeof child !== 'boolean'), [children]);
|
|
95
|
-
const childrenLength = childrenArray.length;
|
|
96
|
-
const itemStyleForIndex = (0, _react().useCallback)(index => {
|
|
97
|
-
if (supportsGap) return tokens.layout.groupItem;
|
|
98
|
-
const isLast = index === childrenLength - 1;
|
|
99
|
-
if (direction === 'horizontal') {
|
|
100
|
-
return [tokens.layout.groupItem, !isLast && {
|
|
101
|
-
marginRight: gap
|
|
102
|
-
}];
|
|
103
|
-
}
|
|
104
|
-
return isLast ? tokens.layout.groupItem : [tokens.layout.groupItem, {
|
|
105
|
-
marginBottom: gap
|
|
106
|
-
}];
|
|
107
|
-
}, [childrenLength, direction, gap, supportsGap, tokens.layout.groupItem]);
|
|
108
|
-
const containerGapStyle = (0, _react().useMemo)(() => supportsGap ? {
|
|
109
|
-
columnGap: direction === 'horizontal' ? gap : undefined,
|
|
110
|
-
rowGap: gap
|
|
111
|
-
} : null, [direction, gap, supportsGap]);
|
|
112
92
|
const contextValue = (0, _react().useMemo)(() => ({
|
|
113
93
|
state,
|
|
114
94
|
direction,
|
|
@@ -118,28 +98,16 @@ const RadioGroup = props => {
|
|
|
118
98
|
registerValue,
|
|
119
99
|
unregisterValue
|
|
120
100
|
}), [checkedColor, direction, iconSize, labelDisabled, registerValue, state, unregisterValue]);
|
|
121
|
-
const containerStyle =
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if (/*#__PURE__*/_react().default.isValidElement(child) && child.type !== _react().default.Fragment) {
|
|
126
|
-
const element = child;
|
|
127
|
-
return /*#__PURE__*/_react().default.cloneElement(element, {
|
|
128
|
-
style: [element.props.style, itemStyle],
|
|
129
|
-
key
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
133
|
-
key: key,
|
|
134
|
-
style: itemStyle
|
|
135
|
-
}, child);
|
|
136
|
-
}), [childrenArray, itemStyleForIndex, supportsGap]);
|
|
101
|
+
const containerStyle = [direction === 'horizontal' ? tokens.layout.groupHorizontal : tokens.layout.groupVertical, {
|
|
102
|
+
columnGap: direction === 'horizontal' ? gap : undefined,
|
|
103
|
+
rowGap: gap
|
|
104
|
+
}, style];
|
|
137
105
|
return /*#__PURE__*/_react().default.createElement(RadioGroupContext.Provider, {
|
|
138
106
|
value: contextValue
|
|
139
107
|
}, /*#__PURE__*/_react().default.createElement(_reactNative().View, _extends({}, resolvedRadioGroupProps, viewProps, {
|
|
140
108
|
accessibilityLabel: accessibilityLabel,
|
|
141
109
|
accessibilityHint: accessibilityHint,
|
|
142
110
|
style: containerStyle
|
|
143
|
-
}),
|
|
111
|
+
}), children));
|
|
144
112
|
};
|
|
145
|
-
exports.RadioGroup =
|
|
113
|
+
const RadioGroup = exports.RadioGroup = /*#__PURE__*/_react().default.memo(RadioGroupImpl);
|
|
@@ -12,6 +12,10 @@ function _reactNative() {
|
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
14
|
var _designSystem = require("../../design-system");
|
|
15
|
+
const centered = {
|
|
16
|
+
justifyContent: 'center',
|
|
17
|
+
alignItems: 'center'
|
|
18
|
+
};
|
|
15
19
|
const createRadioTokens = foundations => {
|
|
16
20
|
const {
|
|
17
21
|
palette,
|
|
@@ -19,7 +23,6 @@ const createRadioTokens = foundations => {
|
|
|
19
23
|
fontSize,
|
|
20
24
|
typography
|
|
21
25
|
} = foundations;
|
|
22
|
-
const onPrimary = palette.primary.foreground ?? '#ffffff';
|
|
23
26
|
return {
|
|
24
27
|
defaults: {
|
|
25
28
|
iconSize: 20,
|
|
@@ -34,17 +37,11 @@ const createRadioTokens = foundations => {
|
|
|
34
37
|
flexDirection: 'row',
|
|
35
38
|
alignItems: 'center'
|
|
36
39
|
},
|
|
37
|
-
iconWrapper:
|
|
38
|
-
justifyContent: 'center',
|
|
39
|
-
alignItems: 'center'
|
|
40
|
-
},
|
|
40
|
+
iconWrapper: centered,
|
|
41
41
|
labelWrapper: {
|
|
42
42
|
flexShrink: 1
|
|
43
43
|
},
|
|
44
|
-
icon:
|
|
45
|
-
justifyContent: 'center',
|
|
46
|
-
alignItems: 'center'
|
|
47
|
-
},
|
|
44
|
+
icon: centered,
|
|
48
45
|
label: {
|
|
49
46
|
includeFontPadding: false
|
|
50
47
|
},
|
|
@@ -66,7 +63,7 @@ const createRadioTokens = foundations => {
|
|
|
66
63
|
checkedBackground: palette.primary[500],
|
|
67
64
|
disabledBorder: palette.default[300],
|
|
68
65
|
disabledBackground: palette.default[100],
|
|
69
|
-
checkmark:
|
|
66
|
+
checkmark: palette.primary.foreground ?? '#ffffff',
|
|
70
67
|
label: palette.default.foreground ?? '#111827',
|
|
71
68
|
labelDisabled: palette.default[400]
|
|
72
69
|
},
|
|
@@ -20,44 +20,40 @@ function _reactNative() {
|
|
|
20
20
|
}
|
|
21
21
|
var _useSafeAreaPadding = require("../../hooks/useSafeAreaPadding");
|
|
22
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
|
-
const
|
|
23
|
+
const SafeAreaViewImpl = ({
|
|
24
24
|
edge,
|
|
25
25
|
style,
|
|
26
26
|
children,
|
|
27
27
|
onLayout,
|
|
28
28
|
pointerEvents
|
|
29
29
|
}) => {
|
|
30
|
-
const
|
|
31
|
-
if (edge === 'top') {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}, style],
|
|
47
|
-
pointerEvents: pointerEvents ?? 'none'
|
|
48
|
-
});
|
|
49
|
-
}
|
|
30
|
+
const padding = (0, _useSafeAreaPadding.useSafeAreaPadding)({});
|
|
31
|
+
if (edge === 'top') return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
32
|
+
style: [{
|
|
33
|
+
width: '100%',
|
|
34
|
+
minHeight: padding.paddingTop
|
|
35
|
+
}, style],
|
|
36
|
+
onLayout: onLayout,
|
|
37
|
+
pointerEvents: pointerEvents ?? 'none'
|
|
38
|
+
});
|
|
39
|
+
if (edge === 'bottom') return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
40
|
+
style: [{
|
|
41
|
+
width: '100%',
|
|
42
|
+
minHeight: padding.paddingBottom
|
|
43
|
+
}, style],
|
|
44
|
+
pointerEvents: pointerEvents ?? 'none'
|
|
45
|
+
});
|
|
50
46
|
return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
51
47
|
style: [{
|
|
52
48
|
width: '100%',
|
|
53
|
-
paddingTop:
|
|
54
|
-
paddingBottom:
|
|
55
|
-
paddingLeft:
|
|
56
|
-
paddingRight:
|
|
49
|
+
paddingTop: padding.paddingTop,
|
|
50
|
+
paddingBottom: padding.paddingBottom,
|
|
51
|
+
paddingLeft: padding.paddingLeft,
|
|
52
|
+
paddingRight: padding.paddingRight
|
|
57
53
|
}, style],
|
|
58
54
|
onLayout: onLayout,
|
|
59
55
|
pointerEvents: pointerEvents
|
|
60
56
|
}, children);
|
|
61
57
|
};
|
|
62
|
-
exports.SafeAreaView =
|
|
58
|
+
const SafeAreaView = exports.SafeAreaView = /*#__PURE__*/_react().default.memo(SafeAreaViewImpl);
|
|
63
59
|
SafeAreaView.displayName = 'SafeAreaView';
|