react-native-system-ui 0.0.7 → 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 +46 -31
- 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 +9 -2
|
@@ -22,7 +22,10 @@ var _utils = require("../../utils");
|
|
|
22
22
|
var _tokens = require("./tokens");
|
|
23
23
|
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
24
|
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); }
|
|
25
|
-
const
|
|
25
|
+
const resolveFiniteNumber = (value, fallback) => (0, _utils.isFiniteNumber)(value) ? value : fallback;
|
|
26
|
+
const resolveNonNegativeNumber = (value, fallback) => Math.max(0, resolveFiniteNumber(value, fallback));
|
|
27
|
+
const resolvePositiveNumber = (value, fallback) => Math.max(1, resolveFiniteNumber(value, fallback));
|
|
28
|
+
const WaterMarkImpl = props => {
|
|
26
29
|
const {
|
|
27
30
|
content: contentProp,
|
|
28
31
|
width,
|
|
@@ -44,9 +47,6 @@ const WaterMark = props => {
|
|
|
44
47
|
...rest
|
|
45
48
|
} = props;
|
|
46
49
|
const tokens = (0, _tokens.useWaterMarkTokens)(tokensOverride);
|
|
47
|
-
const resolveFiniteNumber = (value, fallback) => (0, _utils.isFiniteNumber)(value) ? value : fallback;
|
|
48
|
-
const resolveNonNegativeNumber = (value, fallback) => Math.max(0, resolveFiniteNumber(value, fallback));
|
|
49
|
-
const resolvePositiveNumber = (value, fallback) => Math.max(1, resolveFiniteNumber(value, fallback));
|
|
50
50
|
const content = contentProp ?? tokens.defaults.content;
|
|
51
51
|
const zIndex = resolveFiniteNumber(zIndexProp, tokens.defaults.zIndex);
|
|
52
52
|
const fullPage = fullPageProp ?? tokens.defaults.fullPage;
|
|
@@ -64,9 +64,8 @@ const WaterMark = props => {
|
|
|
64
64
|
const resolvedGapY = resolveNonNegativeNumber(gapY, tokens.defaults.gapY);
|
|
65
65
|
const resolvedRotate = resolveFiniteNumber(rotate, tokens.defaults.rotate);
|
|
66
66
|
const resolvedOpacity = Math.max(0, Math.min(1, resolveFiniteNumber(opacity, tokens.defaults.opacity)));
|
|
67
|
-
const fontSizeFromFont = (0, _utils.isFiniteNumber)(font?.size) ? font
|
|
68
|
-
const
|
|
69
|
-
const normalizedFontSize = Math.max(0, resolvedFontSize);
|
|
67
|
+
const fontSizeFromFont = (0, _utils.isFiniteNumber)(font?.size) ? font.size : (0, _utils.isString)(font?.size) ? Number.parseFloat(font.size) : undefined;
|
|
68
|
+
const normalizedFontSize = Math.max(0, resolveFiniteNumber((Number.isFinite(fontSizeFromFont ?? Number.NaN) ? fontSizeFromFont : undefined) ?? fontSize, tokens.defaults.fontSize));
|
|
70
69
|
const resolvedColor = font?.color ?? color ?? tokens.colors.mark;
|
|
71
70
|
const markWidth = resolvePositiveNumber(image?.width ?? width, tokens.defaults.width);
|
|
72
71
|
const markHeight = resolvePositiveNumber(image?.height ?? height, tokens.defaults.height);
|
|
@@ -74,15 +73,17 @@ const WaterMark = props => {
|
|
|
74
73
|
const cellHeight = Math.max(1, markHeight + resolvedGapY);
|
|
75
74
|
const rows = size.height ? Math.ceil(size.height / cellHeight) + 1 : 1;
|
|
76
75
|
const cols = size.width ? Math.ceil(size.width / cellWidth) + 1 : 1;
|
|
77
|
-
const
|
|
76
|
+
const onLayoutCalculatedRef = (0, _react().useRef)(onLayoutCalculated);
|
|
77
|
+
onLayoutCalculatedRef.current = onLayoutCalculated;
|
|
78
|
+
const handleLayout = (0, _react().useCallback)(event => {
|
|
78
79
|
if (fullPage) return;
|
|
79
80
|
const {
|
|
80
81
|
width,
|
|
81
82
|
height
|
|
82
83
|
} = event.nativeEvent.layout;
|
|
83
84
|
if (!(0, _utils.isFiniteNumber)(width) || !(0, _utils.isFiniteNumber)(height)) return;
|
|
84
|
-
const nextWidth = Math.max(0, width)
|
|
85
|
-
|
|
85
|
+
const nextWidth = Math.max(0, width),
|
|
86
|
+
nextHeight = Math.max(0, height);
|
|
86
87
|
if (lastLayoutRef.current.width === nextWidth && lastLayoutRef.current.height === nextHeight) return;
|
|
87
88
|
lastLayoutRef.current = {
|
|
88
89
|
width: nextWidth,
|
|
@@ -92,49 +93,47 @@ const WaterMark = props => {
|
|
|
92
93
|
width: nextWidth,
|
|
93
94
|
height: nextHeight
|
|
94
95
|
});
|
|
95
|
-
|
|
96
|
+
onLayoutCalculatedRef.current?.({
|
|
96
97
|
width: nextWidth,
|
|
97
98
|
height: nextHeight
|
|
98
99
|
});
|
|
99
|
-
};
|
|
100
|
+
}, [fullPage]);
|
|
100
101
|
(0, _react().useEffect)(() => {
|
|
101
|
-
if (!fullPage) return;
|
|
102
|
-
|
|
103
|
-
if (window.width <= 0 || window.height <= 0) return;
|
|
104
|
-
onLayoutCalculated?.({
|
|
102
|
+
if (!fullPage || !(0, _utils.isFiniteNumber)(window.width) || !(0, _utils.isFiniteNumber)(window.height) || window.width <= 0 || window.height <= 0) return;
|
|
103
|
+
onLayoutCalculatedRef.current?.({
|
|
105
104
|
width: window.width,
|
|
106
105
|
height: window.height
|
|
107
106
|
});
|
|
108
|
-
}, [fullPage,
|
|
109
|
-
const zIndexStyle = {
|
|
107
|
+
}, [fullPage, window.width, window.height]);
|
|
108
|
+
const zIndexStyle = (0, _react().useMemo)(() => ({
|
|
110
109
|
zIndex
|
|
111
|
-
};
|
|
112
|
-
const cellStyle = {
|
|
110
|
+
}), [zIndex]);
|
|
111
|
+
const cellStyle = (0, _react().useMemo)(() => ({
|
|
113
112
|
width: cellWidth,
|
|
114
113
|
height: cellHeight
|
|
115
|
-
};
|
|
116
|
-
const oddRowStyle = {
|
|
114
|
+
}), [cellWidth, cellHeight]);
|
|
115
|
+
const oddRowStyle = (0, _react().useMemo)(() => ({
|
|
117
116
|
paddingLeft: cellWidth / 2
|
|
118
|
-
};
|
|
119
|
-
const markStyle = {
|
|
117
|
+
}), [cellWidth]);
|
|
118
|
+
const markStyle = (0, _react().useMemo)(() => ({
|
|
120
119
|
width: markWidth,
|
|
121
120
|
height: markHeight,
|
|
122
121
|
transform: [{
|
|
123
122
|
rotate: `${resolvedRotate}deg`
|
|
124
123
|
}]
|
|
125
|
-
};
|
|
126
|
-
const imageStyle = {
|
|
124
|
+
}), [markWidth, markHeight, resolvedRotate]);
|
|
125
|
+
const imageStyle = (0, _react().useMemo)(() => ({
|
|
127
126
|
width: markWidth,
|
|
128
127
|
height: markHeight,
|
|
129
128
|
opacity: resolvedOpacity
|
|
130
|
-
};
|
|
131
|
-
const textBaseStyle = {
|
|
129
|
+
}), [markWidth, markHeight, resolvedOpacity]);
|
|
130
|
+
const textBaseStyle = (0, _react().useMemo)(() => ({
|
|
132
131
|
fontSize: normalizedFontSize,
|
|
133
132
|
color: resolvedColor,
|
|
134
133
|
opacity: resolvedOpacity,
|
|
135
134
|
fontFamily: font?.family,
|
|
136
135
|
fontWeight: font?.weight
|
|
137
|
-
};
|
|
136
|
+
}), [normalizedFontSize, resolvedColor, resolvedOpacity, font?.family, font?.weight]);
|
|
138
137
|
const rowIndexes = Array.from({
|
|
139
138
|
length: rows
|
|
140
139
|
}, (_, i) => i);
|
|
@@ -143,6 +142,8 @@ const WaterMark = props => {
|
|
|
143
142
|
}, (_, i) => i);
|
|
144
143
|
return /*#__PURE__*/_react().default.createElement(_reactNative().View, _extends({
|
|
145
144
|
pointerEvents: "none",
|
|
145
|
+
importantForAccessibility: "no-hide-descendants",
|
|
146
|
+
accessibilityElementsHidden: true,
|
|
146
147
|
style: [fullPage ? tokens.layout.absoluteFill : null, zIndexStyle, style],
|
|
147
148
|
onLayout: handleLayout
|
|
148
149
|
}, rest), /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
@@ -166,5 +167,6 @@ const WaterMark = props => {
|
|
|
166
167
|
style: [textBaseStyle, textStyle]
|
|
167
168
|
}, content))))))));
|
|
168
169
|
};
|
|
170
|
+
const WaterMark = /*#__PURE__*/_react().default.memo(WaterMarkImpl);
|
|
169
171
|
WaterMark.displayName = 'WaterMark';
|
|
170
172
|
var _default = exports.default = WaterMark;
|
|
@@ -15,21 +15,15 @@ var _ThemeContext = require("./ThemeContext");
|
|
|
15
15
|
var _tokens = require("./tokens");
|
|
16
16
|
var _validate = require("../utils/validate");
|
|
17
17
|
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
|
-
const
|
|
19
|
-
return Boolean((0, _validate.isObject)(value) && 'palette' in value && 'spacing' in value);
|
|
20
|
-
};
|
|
18
|
+
const isTokens = v => Boolean((0, _validate.isObject)(v) && 'palette' in v && 'spacing' in v);
|
|
21
19
|
const ThemeProvider = ({
|
|
22
20
|
value,
|
|
23
21
|
children
|
|
24
22
|
}) => {
|
|
25
|
-
const resolved = (0, _react().useMemo)(() => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
foundations,
|
|
30
|
-
components
|
|
31
|
-
};
|
|
32
|
-
}, [value]);
|
|
23
|
+
const resolved = (0, _react().useMemo)(() => ({
|
|
24
|
+
foundations: isTokens(value) ? value : (0, _tokens.createTokens)(value?.foundations),
|
|
25
|
+
components: isTokens(value) ? undefined : value?.components
|
|
26
|
+
}), [value]);
|
|
33
27
|
return /*#__PURE__*/_react().default.createElement(_ThemeContext.ThemeContext.Provider, {
|
|
34
28
|
value: resolved
|
|
35
29
|
}, children);
|
|
@@ -13,18 +13,16 @@ function _react() {
|
|
|
13
13
|
}
|
|
14
14
|
var _deepMerge = require("../utils/deepMerge");
|
|
15
15
|
var _useTheme = require("./useTheme");
|
|
16
|
-
const createComponentTokensHook = (key, createBaseTokens) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, [componentOverrides, foundations, overrides]);
|
|
28
|
-
};
|
|
16
|
+
const createComponentTokensHook = (key, createBaseTokens) => overrides => {
|
|
17
|
+
const {
|
|
18
|
+
foundations,
|
|
19
|
+
components
|
|
20
|
+
} = (0, _useTheme.useTheme)();
|
|
21
|
+
const co = components?.[key];
|
|
22
|
+
return (0, _react().useMemo)(() => {
|
|
23
|
+
const base = createBaseTokens(foundations);
|
|
24
|
+
const merged = co && overrides ? (0, _deepMerge.deepMerge)(co, overrides) : co ?? overrides;
|
|
25
|
+
return merged ? (0, _deepMerge.deepMerge)(base, merged) : base;
|
|
26
|
+
}, [co, foundations, overrides]);
|
|
29
27
|
};
|
|
30
28
|
exports.createComponentTokensHook = createComponentTokensHook;
|
|
@@ -137,11 +137,10 @@ const auroraOverrides = {
|
|
|
137
137
|
lineHeightMultiplier: 1.25
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
|
-
const buildPreset = overrides => (0, _tokens.createTokens)(overrides);
|
|
141
140
|
const themePresets = exports.themePresets = {
|
|
142
141
|
light: _tokens.defaultTokens,
|
|
143
|
-
dark:
|
|
144
|
-
aurora:
|
|
142
|
+
dark: (0, _tokens.createTokens)(darkOverrides),
|
|
143
|
+
aurora: (0, _tokens.createTokens)(auroraOverrides)
|
|
145
144
|
};
|
|
146
145
|
const getThemePreset = name => themePresets[name];
|
|
147
146
|
exports.getThemePreset = getThemePreset;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.defaultTokens = exports.defaultFoundations = exports.createTokens =
|
|
6
|
+
exports.defaultTokens = exports.defaultFoundations = exports.createTokens = void 0;
|
|
7
7
|
var _deepMerge = require("../utils/deepMerge");
|
|
8
8
|
const defaultFoundations = exports.defaultFoundations = {
|
|
9
9
|
palette: {
|
|
@@ -130,15 +130,6 @@ const defaultFoundations = exports.defaultFoundations = {
|
|
|
130
130
|
pressed: 0.85
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
|
-
const
|
|
134
|
-
if (!overrides) {
|
|
135
|
-
return defaultFoundations;
|
|
136
|
-
}
|
|
137
|
-
return (0, _deepMerge.deepMerge)(defaultFoundations, overrides);
|
|
138
|
-
};
|
|
139
|
-
exports.buildFoundations = buildFoundations;
|
|
140
|
-
const createTokens = overrides => {
|
|
141
|
-
return buildFoundations(overrides);
|
|
142
|
-
};
|
|
133
|
+
const createTokens = overrides => overrides ? (0, _deepMerge.deepMerge)(defaultFoundations, overrides) : defaultFoundations;
|
|
143
134
|
exports.createTokens = createTokens;
|
|
144
135
|
const defaultTokens = exports.defaultTokens = defaultFoundations;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "getReducedMotion", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _useReducedMotion.getReducedMotion;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "useAnimatedTransition", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _useAnimatedTransition.useAnimatedTransition;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "useReducedMotion", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _useReducedMotion.useReducedMotion;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _useReducedMotion = require("./useReducedMotion");
|
|
25
|
+
var _useAnimatedTransition = require("./useAnimatedTransition");
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useAnimatedTransition = void 0;
|
|
7
|
+
function _react() {
|
|
8
|
+
const data = require("react");
|
|
9
|
+
_react = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _reactNative() {
|
|
15
|
+
const data = require("react-native");
|
|
16
|
+
_reactNative = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
var _platform = require("../../platform");
|
|
22
|
+
var _useReducedMotion = require("./useReducedMotion");
|
|
23
|
+
const EASE_OUT = _reactNative().Easing.bezier(0.075, 0.82, 0.165, 1.0);
|
|
24
|
+
const EASE_IN = _reactNative().Easing.bezier(0.55, 0.055, 0.675, 0.19);
|
|
25
|
+
const useAnimatedTransition = ({
|
|
26
|
+
visible,
|
|
27
|
+
duration = 300,
|
|
28
|
+
enterEasing = EASE_OUT,
|
|
29
|
+
exitEasing = EASE_IN,
|
|
30
|
+
useNativeDriver: driver = _platform.nativeDriverEnabled
|
|
31
|
+
}) => {
|
|
32
|
+
const reduceMotion = (0, _useReducedMotion.useReducedMotion)();
|
|
33
|
+
const [mounted, setMounted] = (0, _react().useState)(visible);
|
|
34
|
+
const progress = (0, _react().useRef)(new (_reactNative().Animated.Value)(visible ? 1 : 0)).current;
|
|
35
|
+
const animRef = (0, _react().useRef)(null);
|
|
36
|
+
const seqRef = (0, _react().useRef)(0);
|
|
37
|
+
const run = (0, _react().useCallback)((show, dur, easeIn, easeOut, nd) => {
|
|
38
|
+
seqRef.current += 1;
|
|
39
|
+
const seq = seqRef.current;
|
|
40
|
+
animRef.current?.stop();
|
|
41
|
+
if (show) setMounted(true);
|
|
42
|
+
if (dur <= 0) {
|
|
43
|
+
progress.setValue(show ? 1 : 0);
|
|
44
|
+
if (!show) setMounted(false);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const anim = _reactNative().Animated.timing(progress, {
|
|
48
|
+
toValue: show ? 1 : 0,
|
|
49
|
+
duration: dur,
|
|
50
|
+
easing: show ? easeIn : easeOut,
|
|
51
|
+
useNativeDriver: nd,
|
|
52
|
+
isInteraction: false
|
|
53
|
+
});
|
|
54
|
+
animRef.current = anim;
|
|
55
|
+
anim.start(({
|
|
56
|
+
finished
|
|
57
|
+
}) => {
|
|
58
|
+
if (finished && seq === seqRef.current && !show) setMounted(false);
|
|
59
|
+
});
|
|
60
|
+
}, [progress]);
|
|
61
|
+
(0, _react().useEffect)(() => {
|
|
62
|
+
run(visible, reduceMotion ? 0 : duration, enterEasing, exitEasing, driver);
|
|
63
|
+
}, [visible, reduceMotion, duration, enterEasing, exitEasing, driver, run]);
|
|
64
|
+
(0, _react().useEffect)(() => () => {
|
|
65
|
+
animRef.current?.stop();
|
|
66
|
+
}, []);
|
|
67
|
+
return {
|
|
68
|
+
mounted,
|
|
69
|
+
progress
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
exports.useAnimatedTransition = useAnimatedTransition;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useReducedMotion = exports.getReducedMotion = exports._resetForTesting = void 0;
|
|
7
|
+
function _react() {
|
|
8
|
+
const data = require("react");
|
|
9
|
+
_react = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _reactNative() {
|
|
15
|
+
const data = require("react-native");
|
|
16
|
+
_reactNative = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
let _reduced = false;
|
|
22
|
+
let _inited = false;
|
|
23
|
+
const _subs = new Set();
|
|
24
|
+
const set = v => {
|
|
25
|
+
if (v === _reduced) return;
|
|
26
|
+
_reduced = v;
|
|
27
|
+
_subs.forEach(fn => fn(v));
|
|
28
|
+
};
|
|
29
|
+
const init = () => {
|
|
30
|
+
if (_inited) return;
|
|
31
|
+
_inited = true;
|
|
32
|
+
if (_reactNative().Platform.OS === 'web') {
|
|
33
|
+
if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {
|
|
34
|
+
try {
|
|
35
|
+
const mql = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
36
|
+
_reduced = mql.matches;
|
|
37
|
+
const h = e => set(e.matches);
|
|
38
|
+
mql.addEventListener?.('change', h) ?? mql.addListener?.(h);
|
|
39
|
+
} catch {}
|
|
40
|
+
}
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
_reactNative().AccessibilityInfo.isReduceMotionEnabled?.().then(v => set(!!v)).catch(() => {});
|
|
44
|
+
try {
|
|
45
|
+
_reactNative().AccessibilityInfo.addEventListener('reduceMotionChanged', v => set(v));
|
|
46
|
+
} catch {}
|
|
47
|
+
};
|
|
48
|
+
const useReducedMotion = () => {
|
|
49
|
+
const r = (0, _react().useRef)(false);
|
|
50
|
+
if (!r.current) {
|
|
51
|
+
r.current = true;
|
|
52
|
+
init();
|
|
53
|
+
}
|
|
54
|
+
const [v, sv] = (0, _react().useState)(_reduced);
|
|
55
|
+
(0, _react().useEffect)(() => {
|
|
56
|
+
if (_reduced !== v) sv(_reduced);
|
|
57
|
+
_subs.add(sv);
|
|
58
|
+
return () => {
|
|
59
|
+
_subs.delete(sv);
|
|
60
|
+
};
|
|
61
|
+
}, []);
|
|
62
|
+
return v;
|
|
63
|
+
};
|
|
64
|
+
exports.useReducedMotion = useReducedMotion;
|
|
65
|
+
const getReducedMotion = () => {
|
|
66
|
+
init();
|
|
67
|
+
return _reduced;
|
|
68
|
+
};
|
|
69
|
+
exports.getReducedMotion = getReducedMotion;
|
|
70
|
+
const _resetForTesting = () => {
|
|
71
|
+
_reduced = false;
|
|
72
|
+
_inited = false;
|
|
73
|
+
_subs.clear();
|
|
74
|
+
};
|
|
75
|
+
exports._resetForTesting = _resetForTesting;
|
|
@@ -31,27 +31,19 @@ const useAriaListBox = props => {
|
|
|
31
31
|
label,
|
|
32
32
|
...rest
|
|
33
33
|
} = props;
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
...(ariaLabel ? {
|
|
40
|
-
'aria-label': ariaLabel
|
|
41
|
-
} : null)
|
|
42
|
-
};
|
|
43
|
-
}, [label, rest]);
|
|
44
|
-
const state = (0, _list().useListState)(resolvedProps);
|
|
34
|
+
const resolved = typeof label === 'string' ? {
|
|
35
|
+
...rest,
|
|
36
|
+
'aria-label': label
|
|
37
|
+
} : rest;
|
|
38
|
+
const state = (0, _list().useListState)(resolved);
|
|
45
39
|
const {
|
|
46
40
|
listBoxProps,
|
|
47
41
|
labelProps
|
|
48
|
-
} = (0, _listbox().useListBox)(
|
|
49
|
-
const resolvedListBoxProps = (0, _react().useMemo)(() => listBoxProps, [listBoxProps]);
|
|
50
|
-
const resolvedLabelProps = (0, _react().useMemo)(() => labelProps, [labelProps]);
|
|
42
|
+
} = (0, _listbox().useListBox)(resolved, state, ref);
|
|
51
43
|
return {
|
|
52
44
|
state,
|
|
53
|
-
listBoxProps:
|
|
54
|
-
labelProps:
|
|
45
|
+
listBoxProps: (0, _react().useMemo)(() => listBoxProps, [listBoxProps]),
|
|
46
|
+
labelProps: (0, _react().useMemo)(() => labelProps, [labelProps]),
|
|
55
47
|
ref
|
|
56
48
|
};
|
|
57
49
|
};
|
|
@@ -30,7 +30,7 @@ const useAriaOverlay = ({
|
|
|
30
30
|
onClose,
|
|
31
31
|
isDismissable = true,
|
|
32
32
|
shouldCloseOnInteractOutside,
|
|
33
|
-
overlayProps:
|
|
33
|
+
overlayProps: overrides
|
|
34
34
|
}) => {
|
|
35
35
|
const overlayRef = (0, _react().useRef)(null);
|
|
36
36
|
const {
|
|
@@ -41,10 +41,10 @@ const useAriaOverlay = ({
|
|
|
41
41
|
isDismissable,
|
|
42
42
|
shouldCloseOnInteractOutside
|
|
43
43
|
}, overlayRef);
|
|
44
|
-
const
|
|
44
|
+
const resolved = (0, _react().useMemo)(() => (0, _utils().mergeProps)(overlayProps ?? {}, overrides ?? {}), [overrides, overlayProps]);
|
|
45
45
|
return {
|
|
46
46
|
overlayRef,
|
|
47
|
-
overlayProps:
|
|
47
|
+
overlayProps: resolved
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
50
|
exports.useAriaOverlay = useAriaOverlay;
|
|
@@ -39,12 +39,7 @@ function _utils() {
|
|
|
39
39
|
};
|
|
40
40
|
return data;
|
|
41
41
|
}
|
|
42
|
-
const
|
|
43
|
-
if (typeof _utils().mergeProps === 'function') {
|
|
44
|
-
return (0, _utils().mergeProps)(...args);
|
|
45
|
-
}
|
|
46
|
-
return Object.assign({}, ...args);
|
|
47
|
-
};
|
|
42
|
+
const mp = (...args) => typeof _utils().mergeProps === 'function' ? (0, _utils().mergeProps)(...args) : Object.assign({}, ...args);
|
|
48
43
|
const useAriaPress = ({
|
|
49
44
|
disabled = false,
|
|
50
45
|
allowHover = _reactNative().Platform.OS === 'web',
|
|
@@ -65,32 +60,24 @@ const useAriaPress = ({
|
|
|
65
60
|
} = (0, _interactions().useHover)({
|
|
66
61
|
isDisabled: disabled || !allowHover
|
|
67
62
|
});
|
|
68
|
-
const useFocusCompat = _focus().useFocus;
|
|
69
63
|
const {
|
|
70
64
|
isFocused,
|
|
71
65
|
focusProps
|
|
72
|
-
} =
|
|
66
|
+
} = (0, _focus().useFocus)({
|
|
73
67
|
isDisabled: disabled
|
|
74
68
|
});
|
|
75
|
-
const useFocusRingCompat = _focus().useFocusRing;
|
|
76
69
|
const {
|
|
77
70
|
focusProps: focusRingProps,
|
|
78
71
|
isFocusVisible
|
|
79
|
-
} =
|
|
72
|
+
} = (0, _focus().useFocusRing)({
|
|
80
73
|
isDisabled: disabled
|
|
81
74
|
});
|
|
82
75
|
const interactionProps = (0, _react().useMemo)(() => {
|
|
83
|
-
let
|
|
84
|
-
if (allowHover)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
merged = mergePropsCompat(merged, focusProps, focusRingProps);
|
|
89
|
-
}
|
|
90
|
-
if (extraProps) {
|
|
91
|
-
merged = mergePropsCompat(merged, extraProps);
|
|
92
|
-
}
|
|
93
|
-
return merged;
|
|
76
|
+
let m = pressProps;
|
|
77
|
+
if (allowHover) m = mp(m, hoverProps);
|
|
78
|
+
if (allowFocus && !disabled) m = mp(m, focusProps, focusRingProps);
|
|
79
|
+
if (extraProps) m = mp(m, extraProps);
|
|
80
|
+
return m;
|
|
94
81
|
}, [allowFocus, allowHover, disabled, extraProps, focusProps, focusRingProps, hoverProps, pressProps]);
|
|
95
82
|
const states = (0, _react().useMemo)(() => ({
|
|
96
83
|
hovered: !!isHovered,
|
|
@@ -26,15 +26,15 @@ function _toggle2() {
|
|
|
26
26
|
return data;
|
|
27
27
|
}
|
|
28
28
|
const useAriaToggle = props => {
|
|
29
|
-
const
|
|
29
|
+
const fallbackRef = (0, _react().useRef)(null);
|
|
30
|
+
const inputRef = props.inputRef ?? fallbackRef;
|
|
30
31
|
const state = (0, _toggle2().useToggleState)(props);
|
|
31
32
|
const {
|
|
32
33
|
inputProps
|
|
33
34
|
} = (0, _toggle().useToggle)(props, state, inputRef);
|
|
34
|
-
const resolvedInputProps = (0, _react().useMemo)(() => inputProps, [inputProps]);
|
|
35
35
|
return {
|
|
36
36
|
state,
|
|
37
|
-
inputProps:
|
|
37
|
+
inputProps: (0, _react().useMemo)(() => inputProps, [inputProps]),
|
|
38
38
|
inputRef
|
|
39
39
|
};
|
|
40
40
|
};
|