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
|
@@ -63,7 +63,6 @@ const CheckboxGroup = exports.CheckboxGroup = /*#__PURE__*/_react().default.forw
|
|
|
63
63
|
const disabled = disabledProp ?? tokens.defaults.groupDisabled;
|
|
64
64
|
const direction = directionProp ?? tokens.defaults.groupDirection;
|
|
65
65
|
const gap = Math.max(0, gapProp ?? tokens.spacing.groupGap);
|
|
66
|
-
const supportsGap = _reactNative().Platform.OS === 'web';
|
|
67
66
|
const registryRef = (0, _react().useRef)(new Map());
|
|
68
67
|
const state = (0, _checkbox2().useCheckboxGroupState)({
|
|
69
68
|
value: value?.map(serialize),
|
|
@@ -99,18 +98,6 @@ const CheckboxGroup = exports.CheckboxGroup = /*#__PURE__*/_react().default.forw
|
|
|
99
98
|
registryRef.current.delete(key);
|
|
100
99
|
}, []);
|
|
101
100
|
const childrenArray = (0, _react().useMemo)(() => _react().default.Children.toArray(children).filter(child => child != null && !(0, _utils.isBoolean)(child)), [children]);
|
|
102
|
-
const childrenLength = childrenArray.length;
|
|
103
|
-
const itemStyleForIndex = (0, _react().useCallback)(index => {
|
|
104
|
-
const isLast = index === childrenLength - 1;
|
|
105
|
-
if (direction === 'horizontal') {
|
|
106
|
-
return [tokens.layout.groupItem, !isLast && {
|
|
107
|
-
marginRight: gap
|
|
108
|
-
}];
|
|
109
|
-
}
|
|
110
|
-
return isLast ? tokens.layout.groupItem : [tokens.layout.groupItem, {
|
|
111
|
-
marginBottom: gap
|
|
112
|
-
}];
|
|
113
|
-
}, [childrenLength, direction, gap, tokens.layout.groupItem]);
|
|
114
101
|
const toggleAll = (0, _react().useCallback)((options = {}) => {
|
|
115
102
|
const opts = (0, _utils.isBoolean)(options) ? {
|
|
116
103
|
checked: options
|
|
@@ -127,10 +114,7 @@ const CheckboxGroup = exports.CheckboxGroup = /*#__PURE__*/_react().default.forw
|
|
|
127
114
|
if (current.has(key)) nextKeys.push(key);
|
|
128
115
|
return;
|
|
129
116
|
}
|
|
130
|
-
|
|
131
|
-
if (shouldSelect) {
|
|
132
|
-
nextKeys.push(key);
|
|
133
|
-
}
|
|
117
|
+
if (targetChecked === true ? true : targetChecked === false ? false : !current.has(key)) nextKeys.push(key);
|
|
134
118
|
});
|
|
135
119
|
state.setValue(nextKeys);
|
|
136
120
|
}, [disabled, state]);
|
|
@@ -149,30 +133,15 @@ const CheckboxGroup = exports.CheckboxGroup = /*#__PURE__*/_react().default.forw
|
|
|
149
133
|
registerValue,
|
|
150
134
|
unregisterValue
|
|
151
135
|
}), [checkedColor, direction, iconRender, iconSize, labelDisabled, max, registerValue, shape, state, unregisterValue]);
|
|
152
|
-
const containerStyle =
|
|
136
|
+
const containerStyle = [direction === 'horizontal' ? tokens.layout.groupHorizontal : tokens.layout.groupVertical, {
|
|
153
137
|
columnGap: direction === 'horizontal' ? gap : undefined,
|
|
154
138
|
rowGap: gap
|
|
155
|
-
}
|
|
156
|
-
const renderedChildren = (0, _react().useMemo)(() => supportsGap ? childrenArray : childrenArray.map((child, index) => {
|
|
157
|
-
const key = /*#__PURE__*/_react().default.isValidElement(child) && child.key !== null ? child.key : index;
|
|
158
|
-
const itemStyle = itemStyleForIndex(index);
|
|
159
|
-
if (/*#__PURE__*/_react().default.isValidElement(child) && child.type !== _react().default.Fragment) {
|
|
160
|
-
const element = child;
|
|
161
|
-
return /*#__PURE__*/_react().default.cloneElement(element, {
|
|
162
|
-
style: [element.props.style, itemStyle],
|
|
163
|
-
key
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
167
|
-
key: key,
|
|
168
|
-
style: itemStyle
|
|
169
|
-
}, child);
|
|
170
|
-
}), [childrenArray, itemStyleForIndex, supportsGap]);
|
|
139
|
+
}, style];
|
|
171
140
|
return /*#__PURE__*/_react().default.createElement(CheckboxGroupContext.Provider, {
|
|
172
141
|
value: contextValue
|
|
173
142
|
}, /*#__PURE__*/_react().default.createElement(_reactNative().View, _extends({}, resolvedGroupProps, viewProps, {
|
|
174
143
|
accessibilityLabel: accessibilityLabel,
|
|
175
144
|
accessibilityHint: accessibilityHint,
|
|
176
145
|
style: containerStyle
|
|
177
|
-
}),
|
|
146
|
+
}), childrenArray));
|
|
178
147
|
});
|
|
@@ -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 createCheckboxTokens = foundations => {
|
|
16
20
|
const {
|
|
17
21
|
palette,
|
|
@@ -20,7 +24,6 @@ const createCheckboxTokens = foundations => {
|
|
|
20
24
|
fontSize,
|
|
21
25
|
typography
|
|
22
26
|
} = foundations;
|
|
23
|
-
const onPrimary = palette.primary.foreground ?? '#ffffff';
|
|
24
27
|
return {
|
|
25
28
|
defaults: {
|
|
26
29
|
shape: 'round',
|
|
@@ -36,14 +39,8 @@ const createCheckboxTokens = foundations => {
|
|
|
36
39
|
flexDirection: 'row',
|
|
37
40
|
alignItems: 'center'
|
|
38
41
|
},
|
|
39
|
-
iconWrapper:
|
|
40
|
-
|
|
41
|
-
alignItems: 'center'
|
|
42
|
-
},
|
|
43
|
-
icon: {
|
|
44
|
-
justifyContent: 'center',
|
|
45
|
-
alignItems: 'center'
|
|
46
|
-
},
|
|
42
|
+
iconWrapper: centered,
|
|
43
|
+
icon: centered,
|
|
47
44
|
checkmark: {
|
|
48
45
|
textAlign: 'center',
|
|
49
46
|
includeFontPadding: false
|
|
@@ -72,7 +69,7 @@ const createCheckboxTokens = foundations => {
|
|
|
72
69
|
checkedBackground: palette.primary[500],
|
|
73
70
|
disabledBorder: palette.default[300],
|
|
74
71
|
disabledBackground: palette.default[100],
|
|
75
|
-
checkmark:
|
|
72
|
+
checkmark: palette.primary.foreground ?? '#ffffff',
|
|
76
73
|
label: palette.default.foreground ?? '#111827',
|
|
77
74
|
labelDisabled: palette.default[400]
|
|
78
75
|
},
|
|
@@ -26,6 +26,7 @@ function _reactNativeSvg() {
|
|
|
26
26
|
return data;
|
|
27
27
|
}
|
|
28
28
|
var _utils = require("../../utils");
|
|
29
|
+
var _animation = require("../../hooks/animation");
|
|
29
30
|
var _tokens = require("./tokens");
|
|
30
31
|
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); }
|
|
31
32
|
const SVG_ROTATION = {
|
|
@@ -42,18 +43,16 @@ const WEB_ROTATION = {
|
|
|
42
43
|
};
|
|
43
44
|
const isTransparentColor = value => {
|
|
44
45
|
const normalized = value.trim().toLowerCase();
|
|
45
|
-
if (!normalized) return true;
|
|
46
|
-
if (normalized === 'transparent') return true;
|
|
46
|
+
if (!normalized || normalized === 'transparent') return true;
|
|
47
47
|
const rgbaMatch = normalized.match(/^rgba\(([^)]*)\)$/);
|
|
48
48
|
if (rgbaMatch) {
|
|
49
|
-
const
|
|
50
|
-
const alpha = Number(parts[3]);
|
|
49
|
+
const alpha = Number(rgbaMatch[1].split(',')[3]?.trim());
|
|
51
50
|
return Number.isFinite(alpha) && alpha === 0;
|
|
52
51
|
}
|
|
53
52
|
return false;
|
|
54
53
|
};
|
|
55
54
|
const AnimatedSvgCircle = _reactNative().Animated.createAnimatedComponent(_reactNativeSvg().Circle);
|
|
56
|
-
const
|
|
55
|
+
const CircleImpl = props => {
|
|
57
56
|
const {
|
|
58
57
|
tokensOverride,
|
|
59
58
|
rate: rateProp,
|
|
@@ -72,6 +71,7 @@ const Circle = props => {
|
|
|
72
71
|
children
|
|
73
72
|
} = props;
|
|
74
73
|
const tokens = (0, _tokens.useCircleTokens)(tokensOverride);
|
|
74
|
+
const reducedMotion = (0, _animation.useReducedMotion)();
|
|
75
75
|
const fill = fillProp ?? tokens.defaults.fill;
|
|
76
76
|
const clockwise = clockwiseProp ?? tokens.defaults.clockwise;
|
|
77
77
|
const startPosition = startPositionProp ?? tokens.defaults.startPosition;
|
|
@@ -93,15 +93,13 @@ const Circle = props => {
|
|
|
93
93
|
const content = (0, _react().useMemo)(() => {
|
|
94
94
|
if (children == null || children === false) return null;
|
|
95
95
|
const childArray = _react().default.Children.toArray(children);
|
|
96
|
-
if (childArray.every(_utils.isText)) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}, childArray.map(String).join(''));
|
|
104
|
-
}
|
|
96
|
+
if (childArray.every(_utils.isText)) return /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
|
|
97
|
+
style: [tokens.layout.text, {
|
|
98
|
+
color: tokens.colors.text,
|
|
99
|
+
fontSize: tokens.typography.fontSize,
|
|
100
|
+
lineHeight: tokens.typography.lineHeight
|
|
101
|
+
}, textStyle]
|
|
102
|
+
}, childArray.map(String).join(''));
|
|
105
103
|
return children;
|
|
106
104
|
}, [children, textStyle, tokens.colors.text, tokens.layout.text, tokens.typography.fontSize, tokens.typography.lineHeight]);
|
|
107
105
|
if (_reactNative().Platform.OS === 'web') {
|
|
@@ -119,12 +117,14 @@ const Circle = props => {
|
|
|
119
117
|
};
|
|
120
118
|
if (safeStroke > 0) {
|
|
121
119
|
const mask = `radial-gradient(farthest-side, transparent calc(100% - ${safeStroke}px), #000 calc(100% - ${safeStroke}px))`;
|
|
122
|
-
webRingStyle
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
120
|
+
Object.assign(webRingStyle, {
|
|
121
|
+
WebkitMaskImage: mask,
|
|
122
|
+
maskImage: mask,
|
|
123
|
+
WebkitMaskRepeat: 'no-repeat',
|
|
124
|
+
maskRepeat: 'no-repeat',
|
|
125
|
+
WebkitMaskSize: '100% 100%',
|
|
126
|
+
maskSize: '100% 100%'
|
|
127
|
+
});
|
|
128
128
|
}
|
|
129
129
|
return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
130
130
|
style: baseStyle
|
|
@@ -151,18 +151,19 @@ const Circle = props => {
|
|
|
151
151
|
const dashOffsetTarget = (clockwise ? 1 : -1) * circumference * (1 - rate / 100);
|
|
152
152
|
const dashOffset = (0, _react().useRef)(new (_reactNative().Animated.Value)(dashOffsetTarget)).current;
|
|
153
153
|
(0, _react().useEffect)(() => {
|
|
154
|
-
if (!animated || safeDuration <= 0) {
|
|
154
|
+
if (!animated || safeDuration <= 0 || reducedMotion) {
|
|
155
155
|
dashOffset.setValue(dashOffsetTarget);
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
158
|
const animation = _reactNative().Animated.timing(dashOffset, {
|
|
159
159
|
toValue: dashOffsetTarget,
|
|
160
160
|
duration: safeDuration,
|
|
161
|
-
useNativeDriver: false
|
|
161
|
+
useNativeDriver: false,
|
|
162
|
+
isInteraction: false
|
|
162
163
|
});
|
|
163
164
|
animation.start();
|
|
164
165
|
return () => animation.stop();
|
|
165
|
-
}, [animated, dashOffset, dashOffsetTarget, safeDuration]);
|
|
166
|
+
}, [animated, dashOffset, dashOffsetTarget, reducedMotion, safeDuration]);
|
|
166
167
|
const center = resolvedSize / 2;
|
|
167
168
|
return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
168
169
|
style: baseStyle
|
|
@@ -194,6 +195,6 @@ const Circle = props => {
|
|
|
194
195
|
style: contentStyle
|
|
195
196
|
}, content));
|
|
196
197
|
};
|
|
197
|
-
exports.Circle =
|
|
198
|
+
const Circle = exports.Circle = /*#__PURE__*/_react().default.memo(CircleImpl);
|
|
198
199
|
Circle.displayName = 'Circle';
|
|
199
200
|
var _default = exports.default = Circle;
|
|
@@ -25,6 +25,7 @@ function _reactNativeSystemIcon() {
|
|
|
25
25
|
};
|
|
26
26
|
return data;
|
|
27
27
|
}
|
|
28
|
+
var _animation = require("../../hooks/animation");
|
|
28
29
|
var _cell = require("../cell");
|
|
29
30
|
var _utils = require("../../utils");
|
|
30
31
|
var _tokens = require("./tokens");
|
|
@@ -37,13 +38,8 @@ const normalizeValue = value => {
|
|
|
37
38
|
if (value === null) return [];
|
|
38
39
|
return [String(value)];
|
|
39
40
|
};
|
|
40
|
-
const buildOutputValue = (keys, accordion) =>
|
|
41
|
-
|
|
42
|
-
return keys[0] ?? '';
|
|
43
|
-
}
|
|
44
|
-
return keys;
|
|
45
|
-
};
|
|
46
|
-
const Collapse = props => {
|
|
41
|
+
const buildOutputValue = (keys, accordion) => accordion ? keys[0] ?? '' : keys;
|
|
42
|
+
const CollapseImpl = props => {
|
|
47
43
|
const {
|
|
48
44
|
tokensOverride,
|
|
49
45
|
children,
|
|
@@ -67,36 +63,20 @@ const Collapse = props => {
|
|
|
67
63
|
} = tokens;
|
|
68
64
|
const controlled = value !== undefined;
|
|
69
65
|
const normalizedValue = normalizeValue(value);
|
|
70
|
-
const
|
|
71
|
-
const
|
|
66
|
+
const normalizedDefaultValue = normalizeValue(defaultValue) ?? [];
|
|
67
|
+
const onChangeRef = (0, _react().useRef)(onChange);
|
|
68
|
+
onChangeRef.current = onChange;
|
|
69
|
+
const [internalValue, setInternalValue] = (0, _react().useState)(() => accordion ? normalizedDefaultValue.slice(0, 1) : normalizedDefaultValue);
|
|
72
70
|
const activeKeys = controlled ? accordion ? (normalizedValue ?? []).slice(0, 1) : normalizedValue ?? [] : internalValue;
|
|
73
71
|
const toggle = (0, _react().useCallback)((name, expand) => {
|
|
74
72
|
if (disabled) return;
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
let
|
|
78
|
-
if (accordion)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
next = exists ? [] : current;
|
|
83
|
-
} else {
|
|
84
|
-
next = exists ? [] : [name];
|
|
85
|
-
}
|
|
86
|
-
} else {
|
|
87
|
-
if (expand === true) {
|
|
88
|
-
next = exists ? current : [...current, name];
|
|
89
|
-
} else if (expand === false) {
|
|
90
|
-
next = exists ? current.filter(item => item !== name) : current;
|
|
91
|
-
} else {
|
|
92
|
-
next = exists ? current.filter(item => item !== name) : [...current, name];
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (!controlled) {
|
|
96
|
-
setInternalValue(next);
|
|
97
|
-
}
|
|
98
|
-
onChange?.(buildOutputValue(next, accordion));
|
|
99
|
-
}, [accordion, activeKeys, controlled, disabled, onChange]);
|
|
73
|
+
const existing = activeKeys.includes(name);
|
|
74
|
+
const shouldExpand = expand ?? !existing;
|
|
75
|
+
let nextKeys;
|
|
76
|
+
if (accordion) nextKeys = shouldExpand ? [name] : existing ? [] : activeKeys;else nextKeys = shouldExpand ? existing ? activeKeys : [...activeKeys, name] : existing ? activeKeys.filter(key => key !== name) : activeKeys;
|
|
77
|
+
if (!controlled) setInternalValue(nextKeys);
|
|
78
|
+
onChangeRef.current?.(buildOutputValue(nextKeys, accordion));
|
|
79
|
+
}, [accordion, activeKeys, controlled, disabled]);
|
|
100
80
|
const contextValue = (0, _react().useMemo)(() => ({
|
|
101
81
|
activeKeys,
|
|
102
82
|
toggle,
|
|
@@ -111,9 +91,7 @@ const Collapse = props => {
|
|
|
111
91
|
const items = _react().default.Children.toArray(children);
|
|
112
92
|
return items.map((child, index) => {
|
|
113
93
|
if (! /*#__PURE__*/_react().default.isValidElement(child)) return child;
|
|
114
|
-
if (!(0, _utils.isFunction)(child.type) && !(0, _utils.isObject)(child.type))
|
|
115
|
-
return child;
|
|
116
|
-
}
|
|
94
|
+
if (!(0, _utils.isFunction)(child.type) && !(0, _utils.isObject)(child.type)) return child;
|
|
117
95
|
const name = child.props.name ?? String(index);
|
|
118
96
|
return /*#__PURE__*/_react().default.cloneElement(child, {
|
|
119
97
|
name,
|
|
@@ -137,8 +115,7 @@ const Collapse = props => {
|
|
|
137
115
|
color: colors.border
|
|
138
116
|
}), renderedChildren));
|
|
139
117
|
};
|
|
140
|
-
|
|
141
|
-
const Hairline = ({
|
|
118
|
+
const Hairline = /*#__PURE__*/_react().default.memo(({
|
|
142
119
|
tokens,
|
|
143
120
|
position,
|
|
144
121
|
color,
|
|
@@ -154,18 +131,17 @@ const Hairline = ({
|
|
|
154
131
|
pointerEvents: "none",
|
|
155
132
|
style: [tokens.layout.hairline, hairlineStyle]
|
|
156
133
|
});
|
|
157
|
-
};
|
|
134
|
+
});
|
|
158
135
|
const CollapsePanel = /*#__PURE__*/_react().default.forwardRef((props, ref) => {
|
|
159
136
|
const context = (0, _react().useContext)(CollapseContext);
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
137
|
+
const reducedMotion = (0, _animation.useReducedMotion)();
|
|
138
|
+
if (!context) throw new Error('Collapse.Panel must be used within Collapse');
|
|
163
139
|
const {
|
|
164
140
|
activeKeys,
|
|
165
141
|
toggle,
|
|
166
142
|
iconPosition,
|
|
167
143
|
expandIcon,
|
|
168
|
-
disabled:
|
|
144
|
+
disabled: contextDisabled,
|
|
169
145
|
tokens
|
|
170
146
|
} = context;
|
|
171
147
|
const {
|
|
@@ -178,8 +154,8 @@ const CollapsePanel = /*#__PURE__*/_react().default.forwardRef((props, ref) => {
|
|
|
178
154
|
extra,
|
|
179
155
|
value,
|
|
180
156
|
border: panelBorder = tokens.defaults.panelBorder,
|
|
181
|
-
isLink = tokens.defaults.panelIsLink,
|
|
182
|
-
size = tokens.defaults.panelSize,
|
|
157
|
+
isLink: isLinkProp = tokens.defaults.panelIsLink,
|
|
158
|
+
size: sizeProp = tokens.defaults.panelSize,
|
|
183
159
|
disabled,
|
|
184
160
|
readOnly,
|
|
185
161
|
children,
|
|
@@ -190,7 +166,7 @@ const CollapsePanel = /*#__PURE__*/_react().default.forwardRef((props, ref) => {
|
|
|
190
166
|
} = props;
|
|
191
167
|
const nameKey = String(name);
|
|
192
168
|
const isActive = activeKeys.includes(nameKey);
|
|
193
|
-
const mergedDisabled =
|
|
169
|
+
const mergedDisabled = contextDisabled || disabled;
|
|
194
170
|
const {
|
|
195
171
|
colors,
|
|
196
172
|
spacing,
|
|
@@ -198,20 +174,33 @@ const CollapsePanel = /*#__PURE__*/_react().default.forwardRef((props, ref) => {
|
|
|
198
174
|
} = tokens;
|
|
199
175
|
const [contentHeight, setContentHeight] = (0, _react().useState)(0);
|
|
200
176
|
const animation = (0, _react().useRef)(new (_reactNative().Animated.Value)(isActive ? 1 : 0)).current;
|
|
201
|
-
const
|
|
177
|
+
const collapseAnimRef = (0, _react().useRef)(null);
|
|
178
|
+
const rotation = animation.interpolate({
|
|
202
179
|
inputRange: [0, 1],
|
|
203
180
|
outputRange: ['90deg', '-90deg']
|
|
204
181
|
});
|
|
205
182
|
(0, _react().useEffect)(() => {
|
|
206
|
-
|
|
183
|
+
collapseAnimRef.current?.stop();
|
|
184
|
+
const anim = _reactNative().Animated.timing(animation, {
|
|
207
185
|
toValue: isActive ? 1 : 0,
|
|
208
|
-
duration: tokens.defaults.animationDuration,
|
|
186
|
+
duration: reducedMotion ? 0 : tokens.defaults.animationDuration,
|
|
209
187
|
easing: _reactNative().Easing.ease,
|
|
210
|
-
useNativeDriver: false
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
188
|
+
useNativeDriver: false,
|
|
189
|
+
isInteraction: false
|
|
190
|
+
});
|
|
191
|
+
collapseAnimRef.current = anim;
|
|
192
|
+
anim.start(({
|
|
193
|
+
finished
|
|
194
|
+
}) => {
|
|
195
|
+
if (finished) collapseAnimRef.current = null;
|
|
196
|
+
});
|
|
197
|
+
return () => {
|
|
198
|
+
collapseAnimRef.current?.stop();
|
|
199
|
+
collapseAnimRef.current = null;
|
|
200
|
+
};
|
|
201
|
+
}, [animation, isActive, reducedMotion, tokens.defaults.animationDuration]);
|
|
202
|
+
const renderedLabel = description ?? label;
|
|
203
|
+
const renderedValue = extra ?? value;
|
|
215
204
|
const handleToggle = (0, _react().useCallback)(() => {
|
|
216
205
|
if (mergedDisabled || readOnly) return;
|
|
217
206
|
toggle(nameKey);
|
|
@@ -223,11 +212,9 @@ const CollapsePanel = /*#__PURE__*/_react().default.forwardRef((props, ref) => {
|
|
|
223
212
|
}
|
|
224
213
|
}), [mergedDisabled, nameKey, readOnly, toggle]);
|
|
225
214
|
const handleContentLayout = (0, _react().useCallback)(event => {
|
|
226
|
-
const
|
|
227
|
-
if ((0, _utils.isNumber)(
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
}, [contentHeight]);
|
|
215
|
+
const height = event.nativeEvent.layout.height;
|
|
216
|
+
if ((0, _utils.isNumber)(height) && Number.isFinite(height)) setContentHeight(prev => prev === height ? prev : height);
|
|
217
|
+
}, []);
|
|
231
218
|
const animatedStyle = (0, _react().useMemo)(() => ({
|
|
232
219
|
height: animation.interpolate({
|
|
233
220
|
inputRange: [0, 1],
|
|
@@ -235,59 +222,53 @@ const CollapsePanel = /*#__PURE__*/_react().default.forwardRef((props, ref) => {
|
|
|
235
222
|
})
|
|
236
223
|
}), [animation, contentHeight]);
|
|
237
224
|
const renderExpandIcon = (0, _react().useCallback)(() => {
|
|
238
|
-
if ((0, _utils.isFunction)(expandIcon))
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
if (expandIcon) {
|
|
242
|
-
return expandIcon;
|
|
243
|
-
}
|
|
225
|
+
if ((0, _utils.isFunction)(expandIcon)) return expandIcon(isActive);
|
|
226
|
+
if (expandIcon) return expandIcon;
|
|
244
227
|
return /*#__PURE__*/_react().default.createElement(_reactNative().Animated.View, {
|
|
245
228
|
style: {
|
|
246
229
|
transform: [{
|
|
247
|
-
rotate
|
|
230
|
+
rotate: rotation
|
|
248
231
|
}]
|
|
249
232
|
}
|
|
250
233
|
}, /*#__PURE__*/_react().default.createElement(_reactNativeSystemIcon().Arrow, {
|
|
251
234
|
size: 16,
|
|
252
235
|
fill: mergedDisabled ? colors.disabled : colors.arrow
|
|
253
236
|
}));
|
|
254
|
-
}, [colors.arrow, colors.disabled, expandIcon, isActive, mergedDisabled,
|
|
255
|
-
const contentNode = (0, _react().useMemo)(() =>
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
const
|
|
263
|
-
const
|
|
264
|
-
const showHeaderBottomBorder = isActive && showItemBorder;
|
|
265
|
-
const showExpandIcon = isLink && !readOnly;
|
|
237
|
+
}, [colors.arrow, colors.disabled, expandIcon, isActive, mergedDisabled, rotation]);
|
|
238
|
+
const contentNode = (0, _react().useMemo)(() => (0, _utils.renderTextOrNode)(children, {
|
|
239
|
+
color: mergedDisabled ? colors.disabled : colors.description,
|
|
240
|
+
fontSize: typography.descriptionSize,
|
|
241
|
+
lineHeight: Math.round(typography.descriptionSize * 1.5)
|
|
242
|
+
}), [children, colors.description, colors.disabled, mergedDisabled, typography.descriptionSize]);
|
|
243
|
+
const showInnerBorder = Boolean(panelBorder);
|
|
244
|
+
const showTopBorder = index > 0 && showInnerBorder;
|
|
245
|
+
const showHeaderBottomBorder = isActive && showInnerBorder;
|
|
246
|
+
const showExpandIcon = isLinkProp && !readOnly;
|
|
266
247
|
const headerIcon = iconPosition === 'left' ? showExpandIcon || (0, _utils.isRenderable)(icon) ? /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
267
248
|
style: tokens.layout.headerIconRow
|
|
268
|
-
}, showExpandIcon
|
|
249
|
+
}, showExpandIcon && /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
269
250
|
style: {
|
|
270
251
|
marginRight: icon ? tokens.spacing.iconGap : 0
|
|
271
252
|
}
|
|
272
|
-
}, renderExpandIcon())
|
|
253
|
+
}, renderExpandIcon()), icon) : undefined : icon;
|
|
273
254
|
const headerRightIcon = iconPosition === 'right' && showExpandIcon ? renderExpandIcon() : undefined;
|
|
274
255
|
return /*#__PURE__*/_react().default.createElement(_reactNative().View, _extends({
|
|
275
256
|
style: [tokens.layout.panel, {
|
|
276
257
|
backgroundColor: colors.background
|
|
277
258
|
}, style]
|
|
278
|
-
}, rest), showTopBorder
|
|
259
|
+
}, rest), showTopBorder && /*#__PURE__*/_react().default.createElement(Hairline, {
|
|
279
260
|
tokens: tokens,
|
|
280
261
|
position: "top",
|
|
281
262
|
color: colors.border,
|
|
282
263
|
inset: spacing.paddingHorizontal
|
|
283
|
-
})
|
|
264
|
+
}), /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
284
265
|
style: tokens.layout.headerWrapper
|
|
285
266
|
}, /*#__PURE__*/_react().default.createElement(_cell.Cell, {
|
|
286
267
|
title: title,
|
|
287
|
-
label:
|
|
268
|
+
label: renderedLabel,
|
|
288
269
|
icon: headerIcon,
|
|
289
|
-
value:
|
|
290
|
-
size:
|
|
270
|
+
value: renderedValue,
|
|
271
|
+
size: sizeProp,
|
|
291
272
|
border: false,
|
|
292
273
|
disabled: mergedDisabled,
|
|
293
274
|
onPress: readOnly ? undefined : handleToggle,
|
|
@@ -305,12 +286,12 @@ const CollapsePanel = /*#__PURE__*/_react().default.forwardRef((props, ref) => {
|
|
|
305
286
|
color: colors.disabled
|
|
306
287
|
} : undefined,
|
|
307
288
|
rightIcon: headerRightIcon
|
|
308
|
-
}), showHeaderBottomBorder
|
|
289
|
+
}), showHeaderBottomBorder && /*#__PURE__*/_react().default.createElement(Hairline, {
|
|
309
290
|
tokens: tokens,
|
|
310
291
|
position: "bottom",
|
|
311
292
|
color: colors.border,
|
|
312
293
|
inset: spacing.paddingHorizontal
|
|
313
|
-
})
|
|
294
|
+
})), /*#__PURE__*/_react().default.createElement(_reactNative().Animated.View, {
|
|
314
295
|
style: [tokens.layout.bodyWrapper, animatedStyle]
|
|
315
296
|
}, /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
316
297
|
onLayout: handleContentLayout,
|
|
@@ -321,7 +302,10 @@ const CollapsePanel = /*#__PURE__*/_react().default.forwardRef((props, ref) => {
|
|
|
321
302
|
}]
|
|
322
303
|
}, contentNode)));
|
|
323
304
|
});
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
Collapse.
|
|
305
|
+
CollapseImpl.Panel = CollapsePanel;
|
|
306
|
+
CollapseImpl.Item = CollapsePanel;
|
|
307
|
+
const Collapse = exports.Collapse = Object.assign(/*#__PURE__*/_react().default.memo(CollapseImpl), {
|
|
308
|
+
Panel: CollapsePanel,
|
|
309
|
+
Item: CollapsePanel
|
|
310
|
+
});
|
|
327
311
|
var _default = exports.default = Collapse;
|
|
@@ -11,21 +11,34 @@ function _react() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
+
function _reactNative() {
|
|
15
|
+
const data = require("react-native");
|
|
16
|
+
_reactNative = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
14
21
|
var _ThemeProvider = require("../../design-system/ThemeProvider");
|
|
15
22
|
var _portal = require("../portal");
|
|
23
|
+
var _DirectionContext = require("./DirectionContext");
|
|
16
24
|
var _LocaleContext = require("./LocaleContext");
|
|
17
25
|
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); }
|
|
18
26
|
const ConfigProviderBase = ({
|
|
19
27
|
theme,
|
|
20
28
|
locale,
|
|
29
|
+
direction,
|
|
21
30
|
children
|
|
22
31
|
}) => {
|
|
23
|
-
const
|
|
24
|
-
const
|
|
32
|
+
const ctxLocale = (0, _react().useContext)(_LocaleContext.LocaleContext);
|
|
33
|
+
const ctxDirection = (0, _react().useContext)(_DirectionContext.DirectionContext);
|
|
34
|
+
const resolvedLocale = locale ?? ctxLocale;
|
|
35
|
+
const resolvedDirection = direction ?? ctxDirection ?? (_reactNative().I18nManager.isRTL ? 'rtl' : 'ltr');
|
|
25
36
|
return /*#__PURE__*/_react().default.createElement(_ThemeProvider.ThemeProvider, {
|
|
26
37
|
value: theme
|
|
38
|
+
}, /*#__PURE__*/_react().default.createElement(_DirectionContext.DirectionContext.Provider, {
|
|
39
|
+
value: resolvedDirection
|
|
27
40
|
}, /*#__PURE__*/_react().default.createElement(_LocaleContext.LocaleContext.Provider, {
|
|
28
41
|
value: resolvedLocale
|
|
29
|
-
}, /*#__PURE__*/_react().default.createElement(_portal.PortalHost, null, children)));
|
|
42
|
+
}, /*#__PURE__*/_react().default.createElement(_portal.PortalHost, null, children))));
|
|
30
43
|
};
|
|
31
44
|
const ConfigProvider = exports.ConfigProvider = /*#__PURE__*/_react().default.memo(ConfigProviderBase);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DirectionContext = void 0;
|
|
7
|
+
function _react() {
|
|
8
|
+
const data = _interopRequireDefault(require("react"));
|
|
9
|
+
_react = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
const DirectionContext = exports.DirectionContext = /*#__PURE__*/_react().default.createContext('ltr');
|
|
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "enUS", {
|
|
|
15
15
|
return _enUS.enUS;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "useDirection", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _useDirection.useDirection;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
Object.defineProperty(exports, "useLocale", {
|
|
19
25
|
enumerable: true,
|
|
20
26
|
get: function () {
|
|
@@ -29,5 +35,6 @@ Object.defineProperty(exports, "zhCN", {
|
|
|
29
35
|
});
|
|
30
36
|
var _ConfigProvider = require("./ConfigProvider");
|
|
31
37
|
var _useLocale = require("./useLocale");
|
|
38
|
+
var _useDirection = require("./useDirection");
|
|
32
39
|
var _zhCN = require("./locale/zh-CN");
|
|
33
40
|
var _enUS = require("./locale/en-US");
|
|
@@ -76,5 +76,37 @@ const enUS = exports.enUS = {
|
|
|
76
76
|
},
|
|
77
77
|
vanAddressList: {
|
|
78
78
|
add: 'Add address'
|
|
79
|
+
},
|
|
80
|
+
vanForm: {
|
|
81
|
+
validationFailed: 'Validation failed'
|
|
82
|
+
},
|
|
83
|
+
vanPopup: {
|
|
84
|
+
closeOverlay: 'Close overlay',
|
|
85
|
+
closeHint: 'Double-tap to close'
|
|
86
|
+
},
|
|
87
|
+
vanToast: {
|
|
88
|
+
closeHint: 'Double-tap to dismiss'
|
|
89
|
+
},
|
|
90
|
+
vanShareSheet: {
|
|
91
|
+
cancel: 'Cancel'
|
|
92
|
+
},
|
|
93
|
+
vanNumberKeyboard: {
|
|
94
|
+
close: 'Done'
|
|
95
|
+
},
|
|
96
|
+
vanNoticeBar: {
|
|
97
|
+
close: 'Close'
|
|
98
|
+
},
|
|
99
|
+
vanNavBar: {
|
|
100
|
+
back: 'Back',
|
|
101
|
+
action: 'Actions'
|
|
102
|
+
},
|
|
103
|
+
vanImage: {
|
|
104
|
+
loading: 'Loading...',
|
|
105
|
+
error: 'Failed to load'
|
|
106
|
+
},
|
|
107
|
+
vanCascader: {
|
|
108
|
+
placeholder: 'Select',
|
|
109
|
+
loading: 'Loading...',
|
|
110
|
+
close: 'Close'
|
|
79
111
|
}
|
|
80
112
|
};
|