react-native-system-ui 1.0.1 → 1.0.3
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 +44 -24
- package/dist/cjs/components/action-sheet/ActionSheet.js +1 -297
- package/dist/cjs/components/action-sheet/index.js +1 -16
- package/dist/cjs/components/action-sheet/tokens.js +1 -133
- package/dist/cjs/components/area/Area.js +1 -127
- package/dist/cjs/components/area/index.js +1 -9
- package/dist/cjs/components/area/tokens.js +1 -14
- package/dist/cjs/components/avatar/Avatar.js +1 -125
- package/dist/cjs/components/avatar/index.js +1 -18
- package/dist/cjs/components/avatar/tokens.js +1 -56
- package/dist/cjs/components/badge/Badge.js +1 -166
- package/dist/cjs/components/badge/index.js +1 -8
- package/dist/cjs/components/badge/tokens.js +1 -81
- package/dist/cjs/components/button/Button.js +1 -203
- package/dist/cjs/components/button/ButtonContext.js +1 -12
- package/dist/cjs/components/button/ButtonGroup.js +1 -65
- package/dist/cjs/components/button/index.js +1 -12
- package/dist/cjs/components/button/tokens.js +1 -176
- package/dist/cjs/components/calendar/Calendar.js +1 -452
- package/dist/cjs/components/calendar/index.js +1 -9
- package/dist/cjs/components/calendar/tokens.js +1 -129
- package/dist/cjs/components/cascader/Cascader.js +1 -481
- package/dist/cjs/components/cascader/index.js +1 -15
- package/dist/cjs/components/cascader/tokens.js +1 -138
- package/dist/cjs/components/cascader/useCascaderExtend.js +1 -39
- package/dist/cjs/components/cell/Cell.js +1 -181
- package/dist/cjs/components/cell/CellContext.js +1 -19
- package/dist/cjs/components/cell/CellGroup.js +1 -100
- package/dist/cjs/components/cell/index.js +1 -19
- package/dist/cjs/components/cell/tokens.js +1 -173
- package/dist/cjs/components/checkbox/Checkbox.js +1 -251
- package/dist/cjs/components/checkbox/CheckboxContext.js +1 -12
- package/dist/cjs/components/checkbox/CheckboxGroup.js +1 -148
- package/dist/cjs/components/checkbox/index.js +1 -16
- package/dist/cjs/components/checkbox/tokens.js +1 -97
- package/dist/cjs/components/circle/Circle.js +1 -212
- package/dist/cjs/components/circle/index.js +1 -9
- package/dist/cjs/components/circle/tokens.js +1 -55
- package/dist/cjs/components/collapse/Collapse.js +1 -311
- package/dist/cjs/components/collapse/index.js +1 -8
- package/dist/cjs/components/collapse/tokens.js +1 -81
- package/dist/cjs/components/config-provider/ConfigProvider.js +1 -44
- package/dist/cjs/components/config-provider/DirectionContext.js +1 -15
- package/dist/cjs/components/config-provider/LocaleContext.js +1 -16
- package/dist/cjs/components/config-provider/index.js +1 -40
- package/dist/cjs/components/config-provider/locale/en-US.js +1 -112
- package/dist/cjs/components/config-provider/locale/zh-CN.js +1 -112
- package/dist/cjs/components/config-provider/tokens.js +1 -11
- package/dist/cjs/components/config-provider/useDirection.js +1 -16
- package/dist/cjs/components/config-provider/useLocale.js +1 -16
- package/dist/cjs/components/count-down/CountDown.js +1 -88
- package/dist/cjs/components/count-down/index.js +1 -15
- package/dist/cjs/components/count-down/tokens.js +1 -34
- package/dist/cjs/components/datetime-picker/DatetimePicker.js +1 -319
- package/dist/cjs/components/datetime-picker/index.js +1 -9
- package/dist/cjs/components/datetime-picker/tokens.js +1 -22
- package/dist/cjs/components/dialog/Dialog.js +1 -433
- package/dist/cjs/components/dialog/imperative.js +1 -199
- package/dist/cjs/components/dialog/index.js +1 -23
- package/dist/cjs/components/dialog/tokens.js +1 -64
- package/dist/cjs/components/divider/Divider.js +1 -126
- package/dist/cjs/components/divider/index.js +1 -8
- package/dist/cjs/components/divider/tokens.js +1 -62
- package/dist/cjs/components/empty/Empty.js +1 -125
- package/dist/cjs/components/empty/index.js +1 -8
- package/dist/cjs/components/empty/tokens.js +1 -55
- package/dist/cjs/components/error-boundary/ErrorBoundary.js +1 -74
- package/dist/cjs/components/error-boundary/index.js +1 -19
- package/dist/cjs/components/field/Field.js +1 -565
- package/dist/cjs/components/field/index.js +1 -29
- package/dist/cjs/components/field/tokens.js +1 -150
- package/dist/cjs/components/flex/Flex.js +1 -85
- package/dist/cjs/components/flex/FlexContext.js +1 -12
- package/dist/cjs/components/flex/FlexItem.js +1 -95
- package/dist/cjs/components/flex/index.js +1 -19
- package/dist/cjs/components/flex/tokens.js +1 -21
- package/dist/cjs/components/form/Form.js +1 -340
- package/dist/cjs/components/form/FormContext.js +1 -12
- package/dist/cjs/components/form/FormItem.js +1 -151
- package/dist/cjs/components/form/FormList.js +1 -95
- package/dist/cjs/components/form/index.js +1 -50
- package/dist/cjs/components/form/tokens.js +1 -14
- package/dist/cjs/components/form/utils.js +1 -56
- package/dist/cjs/components/grid/Grid.js +1 -118
- package/dist/cjs/components/grid/GridContext.js +1 -12
- package/dist/cjs/components/grid/GridItem.js +1 -158
- package/dist/cjs/components/grid/index.js +1 -12
- package/dist/cjs/components/grid/tokens.js +1 -105
- package/dist/cjs/components/image/Image.js +1 -263
- package/dist/cjs/components/image/index.js +1 -16
- package/dist/cjs/components/image/tokens.js +1 -66
- package/dist/cjs/components/image-preview/ImagePreview.js +1 -398
- package/dist/cjs/components/image-preview/imperative.js +1 -72
- package/dist/cjs/components/image-preview/index.js +1 -17
- package/dist/cjs/components/image-preview/tokens.js +1 -43
- package/dist/cjs/components/index.js +1 -769
- package/dist/cjs/components/input/Input.js +1 -122
- package/dist/cjs/components/input/index.js +1 -15
- package/dist/cjs/components/input/tokens.js +1 -22
- package/dist/cjs/components/loading/Loading.js +1 -76
- package/dist/cjs/components/loading/index.js +1 -8
- package/dist/cjs/components/loading/tokens.js +1 -32
- package/dist/cjs/components/nav-bar/NavBar.js +1 -196
- package/dist/cjs/components/nav-bar/index.js +1 -16
- package/dist/cjs/components/nav-bar/tokens.js +1 -90
- package/dist/cjs/components/notice-bar/NoticeBar.js +1 -369
- package/dist/cjs/components/notice-bar/index.js +1 -8
- package/dist/cjs/components/notice-bar/tokens.js +1 -39
- package/dist/cjs/components/notify/Notify.js +1 -262
- package/dist/cjs/components/notify/imperative.js +1 -145
- package/dist/cjs/components/notify/index.js +1 -10
- package/dist/cjs/components/notify/tokens.js +1 -74
- package/dist/cjs/components/number-keyboard/NumberKeyboard.js +1 -487
- package/dist/cjs/components/number-keyboard/index.js +1 -15
- package/dist/cjs/components/number-keyboard/tokens.js +1 -59
- package/dist/cjs/components/overlay/Overlay.js +1 -81
- package/dist/cjs/components/overlay/index.js +1 -28
- package/dist/cjs/components/overlay/tokens.js +1 -13
- package/dist/cjs/components/password-input/PasswordInput.js +1 -346
- package/dist/cjs/components/password-input/index.js +1 -13
- package/dist/cjs/components/password-input/tokens.js +1 -53
- package/dist/cjs/components/picker/Picker.js +1 -1056
- package/dist/cjs/components/picker/index.js +1 -15
- package/dist/cjs/components/picker/tokens.js +1 -53
- package/dist/cjs/components/popup/Popup.js +1 -518
- package/dist/cjs/components/popup/index.js +1 -15
- package/dist/cjs/components/popup/tokens.js +1 -62
- package/dist/cjs/components/portal/Portal.js +1 -50
- package/dist/cjs/components/portal/PortalContext.js +1 -15
- package/dist/cjs/components/portal/PortalHost.js +1 -253
- package/dist/cjs/components/portal/index.js +1 -25
- package/dist/cjs/components/portal/tokens.js +1 -11
- package/dist/cjs/components/progress/Progress.js +1 -216
- package/dist/cjs/components/progress/index.js +1 -14
- package/dist/cjs/components/progress/tokens.js +1 -52
- package/dist/cjs/components/radio/Radio.js +1 -245
- package/dist/cjs/components/radio/RadioContext.js +1 -12
- package/dist/cjs/components/radio/RadioGroup.js +1 -113
- package/dist/cjs/components/radio/index.js +1 -16
- package/dist/cjs/components/radio/tokens.js +1 -92
- package/dist/cjs/components/safe-area-view/SafeAreaView.js +1 -59
- package/dist/cjs/components/safe-area-view/index.js +1 -12
- package/dist/cjs/components/safe-area-view/tokens.js +1 -11
- package/dist/cjs/components/search/Search.js +1 -215
- package/dist/cjs/components/search/index.js +1 -15
- package/dist/cjs/components/search/tokens.js +1 -54
- package/dist/cjs/components/selector/Selector.js +1 -185
- package/dist/cjs/components/selector/index.js +1 -15
- package/dist/cjs/components/selector/tokens.js +1 -100
- package/dist/cjs/components/share-sheet/ShareSheet.js +1 -286
- package/dist/cjs/components/share-sheet/index.js +1 -16
- package/dist/cjs/components/share-sheet/tokens.js +1 -55
- package/dist/cjs/components/sidebar/Sidebar.js +1 -103
- package/dist/cjs/components/sidebar/SidebarContext.js +1 -17
- package/dist/cjs/components/sidebar/SidebarItem.js +1 -103
- package/dist/cjs/components/sidebar/index.js +1 -26
- package/dist/cjs/components/sidebar/tokens.js +1 -93
- package/dist/cjs/components/skeleton/Skeleton.js +1 -162
- package/dist/cjs/components/skeleton/index.js +1 -22
- package/dist/cjs/components/skeleton/tokens.js +1 -39
- package/dist/cjs/components/slider/Slider.js +1 -633
- package/dist/cjs/components/slider/index.js +1 -8
- package/dist/cjs/components/slider/tokens.js +1 -37
- package/dist/cjs/components/space/Space.js +1 -134
- package/dist/cjs/components/space/index.js +1 -18
- package/dist/cjs/components/space/tokens.js +1 -39
- package/dist/cjs/components/stepper/Stepper.js +1 -484
- package/dist/cjs/components/stepper/index.js +1 -15
- package/dist/cjs/components/stepper/tokens.js +1 -60
- package/dist/cjs/components/swiper/Swiper.js +1 -364
- package/dist/cjs/components/swiper/SwiperItem.js +1 -12
- package/dist/cjs/components/swiper/SwiperPagIndicator.js +1 -106
- package/dist/cjs/components/swiper/index.js +1 -40
- package/dist/cjs/components/swiper/tokens.js +1 -18
- package/dist/cjs/components/switch/Switch.js +1 -102
- package/dist/cjs/components/switch/index.js +1 -15
- package/dist/cjs/components/switch/tokens.js +1 -31
- package/dist/cjs/components/tabbar/Tabbar.js +1 -149
- package/dist/cjs/components/tabbar/TabbarContext.js +1 -17
- package/dist/cjs/components/tabbar/TabbarItem.js +1 -153
- package/dist/cjs/components/tabbar/index.js +1 -25
- package/dist/cjs/components/tabbar/tokens.js +1 -41
- package/dist/cjs/components/tabs/Tabs.js +1 -860
- package/dist/cjs/components/tabs/index.js +1 -25
- package/dist/cjs/components/tabs/tokens.js +1 -111
- package/dist/cjs/components/tag/Tag.js +1 -130
- package/dist/cjs/components/tag/index.js +1 -8
- package/dist/cjs/components/tag/tokens.js +1 -104
- package/dist/cjs/components/toast/Toast.js +1 -303
- package/dist/cjs/components/toast/imperative.js +1 -144
- package/dist/cjs/components/toast/index.js +1 -10
- package/dist/cjs/components/toast/tokens.js +1 -43
- package/dist/cjs/components/typography/Typography.js +1 -181
- package/dist/cjs/components/typography/index.js +1 -9
- package/dist/cjs/components/typography/tokens.js +1 -88
- package/dist/cjs/components/water-mark/WaterMark.js +1 -172
- package/dist/cjs/components/water-mark/index.js +1 -22
- package/dist/cjs/components/water-mark/tokens.js +1 -54
- package/dist/cjs/design-system/Text.js +1 -38
- package/dist/cjs/design-system/ThemeContext.js +1 -19
- package/dist/cjs/design-system/ThemeProvider.js +1 -31
- package/dist/cjs/design-system/createComponentTokensHook.js +1 -28
- package/dist/cjs/design-system/index.js +1 -66
- package/dist/cjs/design-system/mergeTokensOverride.js +1 -9
- package/dist/cjs/design-system/presets.js +1 -146
- package/dist/cjs/design-system/tokens.js +1 -135
- package/dist/cjs/design-system/useTheme.js +1 -16
- package/dist/cjs/hooks/animation/index.js +1 -25
- package/dist/cjs/hooks/animation/useAnimatedTransition.js +1 -72
- package/dist/cjs/hooks/animation/useReducedMotion.js +1 -75
- package/dist/cjs/hooks/aria/index.js +1 -49
- package/dist/cjs/hooks/aria/useAriaListBox.js +1 -50
- package/dist/cjs/hooks/aria/useAriaOverlay.js +1 -50
- package/dist/cjs/hooks/aria/useAriaPress.js +1 -94
- package/dist/cjs/hooks/aria/useAriaToggle.js +1 -41
- package/dist/cjs/hooks/gesture/index.js +1 -16
- package/dist/cjs/hooks/gesture/useGestureScroll.js +1 -129
- package/dist/cjs/hooks/index.js +1 -96
- package/dist/cjs/hooks/overlay/OverlayStackStore.js +1 -106
- package/dist/cjs/hooks/overlay/index.js +1 -27
- package/dist/cjs/hooks/overlay/useOverlayStack.js +1 -53
- package/dist/cjs/hooks/useControllableValue.js +1 -41
- package/dist/cjs/hooks/useCountDown.js +1 -99
- package/dist/cjs/hooks/useHairline.js +1 -46
- package/dist/cjs/hooks/useSafeAreaPadding.js +1 -38
- package/dist/cjs/index.js +1 -104
- package/dist/cjs/nativewind.js +1 -0
- package/dist/cjs/platform/animation.js +1 -22
- package/dist/cjs/platform/history.js +1 -14
- package/dist/cjs/platform/index.js +1 -60
- package/dist/cjs/platform/measure.js +1 -39
- package/dist/cjs/platform/runtime.js +1 -19
- package/dist/cjs/platform/scrollLock.js +1 -24
- package/dist/cjs/utils/array.js +1 -12
- package/dist/cjs/utils/color.js +1 -33
- package/dist/cjs/utils/compare.js +1 -21
- package/dist/cjs/utils/createPlatformShadow.js +1 -52
- package/dist/cjs/utils/date.js +1 -45
- package/dist/cjs/utils/deepMerge.js +1 -27
- package/dist/cjs/utils/hairline.js +1 -107
- package/dist/cjs/utils/index.js +1 -148
- package/dist/cjs/utils/number.js +1 -65
- package/dist/cjs/utils/promise.js +1 -9
- package/dist/cjs/utils/render.js +1 -21
- package/dist/cjs/utils/rtl.js +1 -25
- package/dist/cjs/utils/string.js +1 -22
- package/dist/cjs/utils/validate.js +1 -39
- package/dist/es/components/action-sheet/ActionSheet.js +1 -271
- package/dist/es/components/action-sheet/index.js +1 -3
- package/dist/es/components/action-sheet/tokens.js +1 -126
- package/dist/es/components/area/Area.js +1 -113
- package/dist/es/components/area/index.js +1 -2
- package/dist/es/components/area/tokens.js +1 -8
- package/dist/es/components/avatar/Avatar.js +1 -106
- package/dist/es/components/avatar/index.js +1 -1
- package/dist/es/components/avatar/tokens.js +1 -49
- package/dist/es/components/badge/Badge.js +1 -147
- package/dist/es/components/badge/index.js +1 -2
- package/dist/es/components/badge/tokens.js +1 -75
- package/dist/es/components/button/Button.js +1 -184
- package/dist/es/components/button/ButtonContext.js +1 -1
- package/dist/es/components/button/ButtonGroup.js +1 -46
- package/dist/es/components/button/index.js +1 -7
- package/dist/es/components/button/tokens.js +1 -170
- package/dist/es/components/calendar/Calendar.js +1 -432
- package/dist/es/components/calendar/index.js +1 -2
- package/dist/es/components/calendar/tokens.js +1 -122
- package/dist/es/components/cascader/Cascader.js +1 -455
- package/dist/es/components/cascader/index.js +1 -3
- package/dist/es/components/cascader/tokens.js +1 -131
- package/dist/es/components/cascader/useCascaderExtend.js +1 -32
- package/dist/es/components/cell/Cell.js +1 -156
- package/dist/es/components/cell/CellContext.js +1 -6
- package/dist/es/components/cell/CellGroup.js +1 -81
- package/dist/es/components/cell/index.js +1 -8
- package/dist/es/components/cell/tokens.js +1 -160
- package/dist/es/components/checkbox/Checkbox.js +1 -220
- package/dist/es/components/checkbox/CheckboxContext.js +1 -1
- package/dist/es/components/checkbox/CheckboxGroup.js +1 -117
- package/dist/es/components/checkbox/index.js +1 -5
- package/dist/es/components/checkbox/tokens.js +1 -85
- package/dist/es/components/circle/Circle.js +1 -187
- package/dist/es/components/circle/index.js +1 -2
- package/dist/es/components/circle/tokens.js +1 -48
- package/dist/es/components/collapse/Collapse.js +1 -286
- package/dist/es/components/collapse/index.js +1 -2
- package/dist/es/components/collapse/tokens.js +1 -74
- package/dist/es/components/config-provider/ConfigProvider.js +1 -25
- package/dist/es/components/config-provider/DirectionContext.js +1 -2
- package/dist/es/components/config-provider/LocaleContext.js +1 -3
- package/dist/es/components/config-provider/index.js +1 -5
- package/dist/es/components/config-provider/locale/en-US.js +1 -106
- package/dist/es/components/config-provider/locale/zh-CN.js +1 -106
- package/dist/es/components/config-provider/tokens.js +1 -5
- package/dist/es/components/config-provider/useDirection.js +1 -3
- package/dist/es/components/config-provider/useLocale.js +1 -3
- package/dist/es/components/count-down/CountDown.js +1 -69
- package/dist/es/components/count-down/index.js +1 -3
- package/dist/es/components/count-down/tokens.js +1 -27
- package/dist/es/components/datetime-picker/DatetimePicker.js +1 -305
- package/dist/es/components/datetime-picker/index.js +1 -2
- package/dist/es/components/datetime-picker/tokens.js +1 -16
- package/dist/es/components/dialog/Dialog.js +1 -407
- package/dist/es/components/dialog/imperative.js +1 -185
- package/dist/es/components/dialog/index.js +1 -17
- package/dist/es/components/dialog/tokens.js +1 -57
- package/dist/es/components/divider/Divider.js +1 -107
- package/dist/es/components/divider/index.js +1 -2
- package/dist/es/components/divider/tokens.js +1 -55
- package/dist/es/components/empty/Empty.js +1 -100
- package/dist/es/components/empty/index.js +1 -2
- package/dist/es/components/empty/tokens.js +1 -48
- package/dist/es/components/error-boundary/ErrorBoundary.js +1 -62
- package/dist/es/components/error-boundary/index.js +1 -1
- package/dist/es/components/field/Field.js +1 -539
- package/dist/es/components/field/index.js +1 -6
- package/dist/es/components/field/tokens.js +1 -138
- package/dist/es/components/flex/Flex.js +1 -66
- package/dist/es/components/flex/FlexContext.js +1 -1
- package/dist/es/components/flex/FlexItem.js +1 -76
- package/dist/es/components/flex/index.js +1 -8
- package/dist/es/components/flex/tokens.js +1 -15
- package/dist/es/components/form/Form.js +1 -319
- package/dist/es/components/form/FormContext.js +1 -1
- package/dist/es/components/form/FormItem.js +1 -138
- package/dist/es/components/form/FormList.js +1 -81
- package/dist/es/components/form/index.js +1 -13
- package/dist/es/components/form/tokens.js +1 -8
- package/dist/es/components/form/utils.js +1 -45
- package/dist/es/components/grid/Grid.js +1 -99
- package/dist/es/components/grid/GridContext.js +1 -1
- package/dist/es/components/grid/GridItem.js +1 -138
- package/dist/es/components/grid/index.js +1 -6
- package/dist/es/components/grid/tokens.js +1 -98
- package/dist/es/components/image/Image.js +1 -238
- package/dist/es/components/image/index.js +1 -3
- package/dist/es/components/image/tokens.js +1 -60
- package/dist/es/components/image-preview/ImagePreview.js +1 -378
- package/dist/es/components/image-preview/imperative.js +1 -58
- package/dist/es/components/image-preview/index.js +1 -11
- package/dist/es/components/image-preview/tokens.js +1 -37
- package/dist/es/components/index.js +1 -110
- package/dist/es/components/input/Input.js +1 -109
- package/dist/es/components/input/index.js +1 -3
- package/dist/es/components/input/tokens.js +1 -16
- package/dist/es/components/loading/Loading.js +1 -57
- package/dist/es/components/loading/index.js +1 -2
- package/dist/es/components/loading/tokens.js +1 -25
- package/dist/es/components/nav-bar/NavBar.js +1 -171
- package/dist/es/components/nav-bar/index.js +1 -3
- package/dist/es/components/nav-bar/tokens.js +1 -83
- package/dist/es/components/notice-bar/NoticeBar.js +1 -344
- package/dist/es/components/notice-bar/index.js +1 -2
- package/dist/es/components/notice-bar/tokens.js +1 -32
- package/dist/es/components/notify/Notify.js +1 -242
- package/dist/es/components/notify/imperative.js +1 -131
- package/dist/es/components/notify/index.js +1 -5
- package/dist/es/components/notify/tokens.js +1 -67
- package/dist/es/components/number-keyboard/NumberKeyboard.js +1 -467
- package/dist/es/components/number-keyboard/index.js +1 -3
- package/dist/es/components/number-keyboard/tokens.js +1 -53
- package/dist/es/components/overlay/Overlay.js +1 -50
- package/dist/es/components/overlay/index.js +1 -4
- package/dist/es/components/overlay/tokens.js +1 -7
- package/dist/es/components/password-input/PasswordInput.js +1 -327
- package/dist/es/components/password-input/index.js +1 -1
- package/dist/es/components/password-input/tokens.js +1 -41
- package/dist/es/components/picker/Picker.js +1 -1031
- package/dist/es/components/picker/index.js +1 -3
- package/dist/es/components/picker/tokens.js +1 -47
- package/dist/es/components/popup/Popup.js +1 -492
- package/dist/es/components/popup/index.js +1 -3
- package/dist/es/components/popup/tokens.js +1 -55
- package/dist/es/components/portal/Portal.js +1 -37
- package/dist/es/components/portal/PortalContext.js +1 -2
- package/dist/es/components/portal/PortalHost.js +1 -234
- package/dist/es/components/portal/index.js +1 -3
- package/dist/es/components/portal/tokens.js +1 -5
- package/dist/es/components/progress/Progress.js +1 -196
- package/dist/es/components/progress/index.js +1 -3
- package/dist/es/components/progress/tokens.js +1 -45
- package/dist/es/components/radio/Radio.js +1 -214
- package/dist/es/components/radio/RadioContext.js +1 -1
- package/dist/es/components/radio/RadioGroup.js +1 -82
- package/dist/es/components/radio/index.js +1 -5
- package/dist/es/components/radio/tokens.js +1 -80
- package/dist/es/components/safe-area-view/SafeAreaView.js +1 -40
- package/dist/es/components/safe-area-view/index.js +1 -1
- package/dist/es/components/safe-area-view/tokens.js +1 -5
- package/dist/es/components/search/Search.js +1 -189
- package/dist/es/components/search/index.js +1 -3
- package/dist/es/components/search/tokens.js +1 -48
- package/dist/es/components/selector/Selector.js +1 -166
- package/dist/es/components/selector/index.js +1 -3
- package/dist/es/components/selector/tokens.js +1 -88
- package/dist/es/components/share-sheet/ShareSheet.js +1 -266
- package/dist/es/components/share-sheet/index.js +1 -3
- package/dist/es/components/share-sheet/tokens.js +1 -49
- package/dist/es/components/sidebar/Sidebar.js +1 -84
- package/dist/es/components/sidebar/SidebarContext.js +1 -3
- package/dist/es/components/sidebar/SidebarItem.js +1 -84
- package/dist/es/components/sidebar/index.js +1 -8
- package/dist/es/components/sidebar/tokens.js +1 -80
- package/dist/es/components/skeleton/Skeleton.js +1 -143
- package/dist/es/components/skeleton/index.js +1 -4
- package/dist/es/components/skeleton/tokens.js +1 -33
- package/dist/es/components/slider/Slider.js +1 -596
- package/dist/es/components/slider/index.js +1 -2
- package/dist/es/components/slider/tokens.js +1 -31
- package/dist/es/components/space/Space.js +1 -115
- package/dist/es/components/space/index.js +1 -2
- package/dist/es/components/space/tokens.js +1 -32
- package/dist/es/components/stepper/Stepper.js +1 -465
- package/dist/es/components/stepper/index.js +1 -3
- package/dist/es/components/stepper/tokens.js +1 -54
- package/dist/es/components/swiper/Swiper.js +1 -344
- package/dist/es/components/swiper/SwiperItem.js +1 -1
- package/dist/es/components/swiper/SwiperPagIndicator.js +1 -87
- package/dist/es/components/swiper/index.js +1 -10
- package/dist/es/components/swiper/tokens.js +1 -12
- package/dist/es/components/switch/Switch.js +1 -83
- package/dist/es/components/switch/index.js +1 -3
- package/dist/es/components/switch/tokens.js +1 -25
- package/dist/es/components/tabbar/Tabbar.js +1 -130
- package/dist/es/components/tabbar/TabbarContext.js +1 -3
- package/dist/es/components/tabbar/TabbarItem.js +1 -133
- package/dist/es/components/tabbar/index.js +1 -7
- package/dist/es/components/tabbar/tokens.js +1 -35
- package/dist/es/components/tabs/Tabs.js +1 -841
- package/dist/es/components/tabs/index.js +1 -7
- package/dist/es/components/tabs/tokens.js +1 -105
- package/dist/es/components/tag/Tag.js +1 -105
- package/dist/es/components/tag/index.js +1 -2
- package/dist/es/components/tag/tokens.js +1 -97
- package/dist/es/components/toast/Toast.js +1 -277
- package/dist/es/components/toast/imperative.js +1 -130
- package/dist/es/components/toast/index.js +1 -5
- package/dist/es/components/toast/tokens.js +1 -36
- package/dist/es/components/typography/Typography.js +1 -162
- package/dist/es/components/typography/index.js +1 -2
- package/dist/es/components/typography/tokens.js +1 -82
- package/dist/es/components/water-mark/WaterMark.js +1 -153
- package/dist/es/components/water-mark/index.js +1 -4
- package/dist/es/components/water-mark/tokens.js +1 -42
- package/dist/es/design-system/Text.js +1 -19
- package/dist/es/design-system/ThemeContext.js +1 -6
- package/dist/es/design-system/ThemeProvider.js +1 -17
- package/dist/es/design-system/createComponentTokensHook.js +1 -15
- package/dist/es/design-system/index.js +1 -7
- package/dist/es/design-system/mergeTokensOverride.js +1 -2
- package/dist/es/design-system/presets.js +1 -139
- package/dist/es/design-system/tokens.js +1 -128
- package/dist/es/design-system/useTheme.js +1 -3
- package/dist/es/hooks/animation/index.js +1 -2
- package/dist/es/hooks/animation/useAnimatedTransition.js +1 -53
- package/dist/es/hooks/animation/useReducedMotion.js +1 -54
- package/dist/es/hooks/aria/index.js +1 -5
- package/dist/es/hooks/aria/useAriaListBox.js +1 -25
- package/dist/es/hooks/aria/useAriaOverlay.js +1 -25
- package/dist/es/hooks/aria/useAriaPress.js +1 -57
- package/dist/es/hooks/aria/useAriaToggle.js +1 -16
- package/dist/es/hooks/gesture/index.js +1 -2
- package/dist/es/hooks/gesture/useGestureScroll.js +1 -110
- package/dist/es/hooks/index.js +1 -8
- package/dist/es/hooks/overlay/OverlayStackStore.js +1 -93
- package/dist/es/hooks/overlay/index.js +1 -3
- package/dist/es/hooks/overlay/useOverlayStack.js +1 -40
- package/dist/es/hooks/useControllableValue.js +1 -29
- package/dist/es/hooks/useCountDown.js +1 -87
- package/dist/es/hooks/useHairline.js +1 -26
- package/dist/es/hooks/useSafeAreaPadding.js +1 -20
- package/dist/es/index.js +1 -11
- package/dist/es/nativewind.js +1 -0
- package/dist/es/platform/animation.js +1 -10
- package/dist/es/platform/history.js +1 -7
- package/dist/es/platform/index.js +1 -6
- package/dist/es/platform/measure.js +1 -32
- package/dist/es/platform/runtime.js +1 -4
- package/dist/es/platform/scrollLock.js +1 -16
- package/dist/es/types.js +1 -1
- package/dist/es/utils/array.js +1 -5
- package/dist/es/utils/color.js +1 -25
- package/dist/es/utils/compare.js +1 -13
- package/dist/es/utils/createPlatformShadow.js +1 -39
- package/dist/es/utils/date.js +1 -33
- package/dist/es/utils/deepMerge.js +1 -21
- package/dist/es/utils/hairline.js +1 -93
- package/dist/es/utils/index.js +1 -14
- package/dist/es/utils/number.js +1 -48
- package/dist/es/utils/promise.js +1 -2
- package/dist/es/utils/render.js +1 -7
- package/dist/es/utils/rtl.js +1 -17
- package/dist/es/utils/string.js +1 -13
- package/dist/es/utils/validate.js +1 -14
- package/dist/types/nativewind.d.ts +4 -0
- package/package.json +15 -3
|
@@ -1,62 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.usePopupTokens = exports.createPopupTokens = void 0;
|
|
7
|
-
var _designSystem = require("../../design-system");
|
|
8
|
-
const createPopupTokens = foundations => {
|
|
9
|
-
const {
|
|
10
|
-
palette,
|
|
11
|
-
spacing,
|
|
12
|
-
radii,
|
|
13
|
-
fontSize,
|
|
14
|
-
typography
|
|
15
|
-
} = foundations;
|
|
16
|
-
return {
|
|
17
|
-
colors: {
|
|
18
|
-
overlay: 'rgba(0,0,0,0.5)',
|
|
19
|
-
background: '#ffffff',
|
|
20
|
-
title: palette.default[900],
|
|
21
|
-
description: palette.default[500],
|
|
22
|
-
closeIcon: palette.default[300]
|
|
23
|
-
},
|
|
24
|
-
radius: {
|
|
25
|
-
round: radii.lg,
|
|
26
|
-
shadow: 18
|
|
27
|
-
},
|
|
28
|
-
spacing: {
|
|
29
|
-
padding: spacing.lg,
|
|
30
|
-
titleTop: spacing.xl,
|
|
31
|
-
titleBottom: spacing.md,
|
|
32
|
-
descriptionHorizontal: spacing.xl,
|
|
33
|
-
descriptionBottom: spacing.md,
|
|
34
|
-
closeIconTop: spacing.md,
|
|
35
|
-
closeIconRight: spacing.md,
|
|
36
|
-
closeIconSize: 36,
|
|
37
|
-
closeIconPadding: spacing.ssm
|
|
38
|
-
},
|
|
39
|
-
typography: {
|
|
40
|
-
fontFamily: typography.fontFamily,
|
|
41
|
-
titleSize: fontSize.md,
|
|
42
|
-
titleWeight: typography.weight.medium,
|
|
43
|
-
descriptionSize: fontSize.sm,
|
|
44
|
-
descriptionLineHeight: 20
|
|
45
|
-
},
|
|
46
|
-
shadow: {
|
|
47
|
-
color: 'rgba(0,0,0,0.25)',
|
|
48
|
-
opacity: 0.35,
|
|
49
|
-
radius: 18,
|
|
50
|
-
offsetY: 8,
|
|
51
|
-
elevation: 24
|
|
52
|
-
},
|
|
53
|
-
layout: {
|
|
54
|
-
maxWidth: 420,
|
|
55
|
-
minWidth: 260,
|
|
56
|
-
centerMaxWidth: 360,
|
|
57
|
-
sideWidth: '80%'
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
exports.createPopupTokens = createPopupTokens;
|
|
62
|
-
const usePopupTokens = exports.usePopupTokens = (0, _designSystem.createComponentTokensHook)('popup', createPopupTokens);
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.usePopupTokens=exports.createPopupTokens=void 0;var _designSystem=require("../../design-system");const createPopupTokens=e=>{const{palette:o,spacing:t,radii:s,fontSize:i,typography:n}=e;return{colors:{overlay:"rgba(0,0,0,0.5)",background:"#ffffff",title:o.default[900],description:o.default[500],closeIcon:o.default[300]},radius:{round:s.lg,shadow:18},spacing:{padding:t.lg,titleTop:t.xl,titleBottom:t.md,descriptionHorizontal:t.xl,descriptionBottom:t.md,closeIconTop:t.md,closeIconRight:t.md,closeIconSize:36,closeIconPadding:t.ssm},typography:{fontFamily:n.fontFamily,titleSize:i.md,titleWeight:n.weight.medium,descriptionSize:i.sm,descriptionLineHeight:20},shadow:{color:"rgba(0,0,0,0.25)",opacity:.35,radius:18,offsetY:8,elevation:24},layout:{maxWidth:420,minWidth:260,centerMaxWidth:360,sideWidth:"80%"}}};exports.createPopupTokens=createPopupTokens;const usePopupTokens=exports.usePopupTokens=(0,_designSystem.createComponentTokensHook)("popup",createPopupTokens);
|
|
@@ -1,50 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.Portal = void 0;
|
|
7
|
-
function _react() {
|
|
8
|
-
const data = _interopRequireWildcard(require("react"));
|
|
9
|
-
_react = function () {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
var _PortalHost = require("./PortalHost");
|
|
15
|
-
var _PortalContext = require("./PortalContext");
|
|
16
|
-
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); }
|
|
17
|
-
const PortalComponentImpl = ({
|
|
18
|
-
children,
|
|
19
|
-
isOpen,
|
|
20
|
-
visible
|
|
21
|
-
}, _ref) => {
|
|
22
|
-
const manager = (0, _react().useContext)(_PortalContext.PortalContext) ?? _PortalHost.portalManager;
|
|
23
|
-
const keyRef = (0, _react().useRef)(null);
|
|
24
|
-
const content = isOpen ?? visible ?? true ? children : null;
|
|
25
|
-
(0, _react().useLayoutEffect)(() => {
|
|
26
|
-
keyRef.current === null ? keyRef.current = manager.mount(content) : manager.update(keyRef.current, content);
|
|
27
|
-
}, [manager, content]);
|
|
28
|
-
(0, _react().useLayoutEffect)(() => () => {
|
|
29
|
-
if (keyRef.current != null) {
|
|
30
|
-
manager.unmount(keyRef.current);
|
|
31
|
-
keyRef.current = null;
|
|
32
|
-
}
|
|
33
|
-
}, [manager]);
|
|
34
|
-
return null;
|
|
35
|
-
};
|
|
36
|
-
const PortalComponentRef = /*#__PURE__*/_react().default.forwardRef(PortalComponentImpl);
|
|
37
|
-
PortalComponentRef.displayName = 'Portal';
|
|
38
|
-
const PortalComponent = /*#__PURE__*/_react().default.memo(PortalComponentRef);
|
|
39
|
-
const add = (content, key) => _PortalHost.portalManager.mount(content, key);
|
|
40
|
-
const remove = key => _PortalHost.portalManager.unmount(key);
|
|
41
|
-
const update = (key, content) => _PortalHost.portalManager.update(key, content);
|
|
42
|
-
const clear = () => _PortalHost.portalStore.clear();
|
|
43
|
-
const Portal = exports.Portal = Object.assign(PortalComponent, {
|
|
44
|
-
Host: _PortalHost.PortalHost,
|
|
45
|
-
add,
|
|
46
|
-
remove,
|
|
47
|
-
update,
|
|
48
|
-
clear
|
|
49
|
-
});
|
|
50
|
-
var _default = exports.default = Portal;
|
|
1
|
+
"use strict";function _react(){const t=_interopRequireWildcard(require("react"));return _react=function(){return t},t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Portal=void 0;var _PortalHost=require("./PortalHost"),_PortalContext=require("./PortalContext");function _interopRequireWildcard(t,e){if("function"==typeof WeakMap)var r=new WeakMap,o=new WeakMap;return(_interopRequireWildcard=function(t,e){if(!e&&t&&t.__esModule)return t;var a,n,l={__proto__:null,default:t};if(null===t||"object"!=typeof t&&"function"!=typeof t)return l;if(a=e?o:r){if(a.has(t))return a.get(t);a.set(t,l)}for(const e in t)"default"!==e&&{}.hasOwnProperty.call(t,e)&&((n=(a=Object.defineProperty)&&Object.getOwnPropertyDescriptor(t,e))&&(n.get||n.set)?a(l,e,n):l[e]=t[e]);return l})(t,e)}const PortalComponentImpl=({children:t,isOpen:e,visible:r},o)=>{const a=(0,_react().useContext)(_PortalContext.PortalContext)??_PortalHost.portalManager,n=(0,_react().useRef)(null),l=e??r??1?t:null;return(0,_react().useLayoutEffect)(()=>{null===n.current?n.current=a.mount(l):a.update(n.current,l)},[a,l]),(0,_react().useLayoutEffect)(()=>()=>{null!=n.current&&(a.unmount(n.current),n.current=null)},[a]),null},PortalComponentRef=_react().default.forwardRef(PortalComponentImpl);PortalComponentRef.displayName="Portal";const PortalComponent=_react().default.memo(PortalComponentRef),add=(t,e)=>_PortalHost.portalManager.mount(t,e),remove=t=>_PortalHost.portalManager.unmount(t),update=(t,e)=>_PortalHost.portalManager.update(t,e),clear=()=>_PortalHost.portalStore.clear(),Portal=exports.Portal=Object.assign(PortalComponent,{Host:_PortalHost.PortalHost,add:add,remove:remove,update:update,clear:clear});var _default=exports.default=Portal;
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PortalContext = 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 PortalContext = exports.PortalContext = /*#__PURE__*/_react().default.createContext(null);
|
|
1
|
+
"use strict";function _react(){const e=_interopRequireDefault(require("react"));return _react=function(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.PortalContext=void 0;const PortalContext=exports.PortalContext=_react().default.createContext(null);
|
|
@@ -1,253 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.portalStore = exports.portalManager = exports.PortalHost = void 0;
|
|
7
|
-
function _react() {
|
|
8
|
-
const data = _interopRequireWildcard(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 _utils = require("../../utils");
|
|
22
|
-
var _PortalContext = require("./PortalContext");
|
|
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
|
-
const AE = 'RNSU_PORTAL_ADD';
|
|
25
|
-
const UE = 'RNSU_PORTAL_UPDATE';
|
|
26
|
-
const RE = 'RNSU_PORTAL_REMOVE';
|
|
27
|
-
const CE = 'RNSU_PORTAL_CLEAR';
|
|
28
|
-
const TVE = _reactNative().DeviceEventEmitter || new (_reactNative().NativeEventEmitter)();
|
|
29
|
-
const IW = _reactNative().Platform.OS === 'web';
|
|
30
|
-
const ao = (m, o) => {
|
|
31
|
-
if (o.type === 'mount') m.mount(o.children, o.key);else if (o.type === 'update') m.update(o.key, o.children);else if (o.type === 'clear') m.clear();else m.unmount(o.key);
|
|
32
|
-
};
|
|
33
|
-
const PortalManagerView = /*#__PURE__*/_react().default.forwardRef((_, ref) => {
|
|
34
|
-
const [e, setE] = (0, _react().useState)([]);
|
|
35
|
-
const ks = (0, _react().useRef)(0);
|
|
36
|
-
const us = (0, _react().useCallback)(en => {
|
|
37
|
-
setE(p => {
|
|
38
|
-
const i = p.findIndex(it => it.key === en.key);
|
|
39
|
-
return i === -1 ? [...p, en] : [...p.slice(0, i), en, ...p.slice(i + 1)];
|
|
40
|
-
});
|
|
41
|
-
}, []);
|
|
42
|
-
const mt = (0, _react().useCallback)((c, k) => {
|
|
43
|
-
const rk = k ?? ++ks.current;
|
|
44
|
-
if ((0, _utils.isNumber)(k) && k >= ks.current) ks.current = k + 1;
|
|
45
|
-
us({
|
|
46
|
-
key: rk,
|
|
47
|
-
children: c
|
|
48
|
-
});
|
|
49
|
-
return rk;
|
|
50
|
-
}, [us]);
|
|
51
|
-
const up = (0, _react().useCallback)((k, c) => {
|
|
52
|
-
us({
|
|
53
|
-
key: k,
|
|
54
|
-
children: c
|
|
55
|
-
});
|
|
56
|
-
}, [us]);
|
|
57
|
-
const um = (0, _react().useCallback)(k => {
|
|
58
|
-
setE(p => p.filter(it => it.key !== k));
|
|
59
|
-
}, []);
|
|
60
|
-
const cl = (0, _react().useCallback)(() => {
|
|
61
|
-
setE([]);
|
|
62
|
-
}, []);
|
|
63
|
-
_react().default.useImperativeHandle(ref, () => ({
|
|
64
|
-
mount: mt,
|
|
65
|
-
update: up,
|
|
66
|
-
unmount: um,
|
|
67
|
-
clear: cl
|
|
68
|
-
}), [mt, up, um, cl]);
|
|
69
|
-
if (e.length === 0) return null;
|
|
70
|
-
return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
71
|
-
pointerEvents: "box-none",
|
|
72
|
-
style: S.pl,
|
|
73
|
-
collapsable: false
|
|
74
|
-
}, e.map(en => /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
75
|
-
key: en.key,
|
|
76
|
-
pointerEvents: "box-none",
|
|
77
|
-
collapsable: false,
|
|
78
|
-
style: S.pe
|
|
79
|
-
}, en.children)));
|
|
80
|
-
});
|
|
81
|
-
let ah = 0;
|
|
82
|
-
let nh = 1;
|
|
83
|
-
let ngk = 10000;
|
|
84
|
-
const gm = {
|
|
85
|
-
mount: (c, k) => {
|
|
86
|
-
if (typeof __DEV__ !== 'undefined' && __DEV__ && ah === 0) console.warn('[Portal] Please mount <PortalHost> or <ConfigProvider> at the root to enable imperative APIs.');
|
|
87
|
-
const rk = k ?? ngk++;
|
|
88
|
-
if ((0, _utils.isNumber)(k) && k >= ngk) ngk = k + 1;
|
|
89
|
-
TVE.emit(AE, {
|
|
90
|
-
key: rk,
|
|
91
|
-
children: c
|
|
92
|
-
});
|
|
93
|
-
return rk;
|
|
94
|
-
},
|
|
95
|
-
update: (k, c) => {
|
|
96
|
-
TVE.emit(UE, {
|
|
97
|
-
key: k,
|
|
98
|
-
children: c
|
|
99
|
-
});
|
|
100
|
-
},
|
|
101
|
-
unmount: k => {
|
|
102
|
-
TVE.emit(RE, {
|
|
103
|
-
key: k
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
const PortalHostImpl = ({
|
|
108
|
-
children
|
|
109
|
-
}) => {
|
|
110
|
-
const hir = (0, _react().useRef)(nh++),
|
|
111
|
-
mr = (0, _react().useRef)(null),
|
|
112
|
-
qr = (0, _react().useRef)([]),
|
|
113
|
-
nkr = (0, _react().useRef)(1);
|
|
114
|
-
const eor = (0, _react().useCallback)(o => {
|
|
115
|
-
const m = mr.current;
|
|
116
|
-
if (m) ao(m, o);else qr.current.push(o);
|
|
117
|
-
}, []);
|
|
118
|
-
const sm = (0, _react().useMemo)(() => ({
|
|
119
|
-
mount: (c, k) => {
|
|
120
|
-
const rk = k ?? nkr.current++;
|
|
121
|
-
if ((0, _utils.isNumber)(k) && k >= nkr.current) nkr.current = k + 1;
|
|
122
|
-
eor({
|
|
123
|
-
type: 'mount',
|
|
124
|
-
key: rk,
|
|
125
|
-
children: c
|
|
126
|
-
});
|
|
127
|
-
return rk;
|
|
128
|
-
},
|
|
129
|
-
update: (k, c) => {
|
|
130
|
-
eor({
|
|
131
|
-
type: 'update',
|
|
132
|
-
key: k,
|
|
133
|
-
children: c
|
|
134
|
-
});
|
|
135
|
-
},
|
|
136
|
-
unmount: k => {
|
|
137
|
-
eor({
|
|
138
|
-
type: 'unmount',
|
|
139
|
-
key: k
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
}), [eor]);
|
|
143
|
-
const hmr = (0, _react().useCallback)(m => {
|
|
144
|
-
mr.current = m;
|
|
145
|
-
if (m) {
|
|
146
|
-
if (qr.current.length > 0) {
|
|
147
|
-
const pd = qr.current.splice(0, qr.current.length);
|
|
148
|
-
pd.forEach(o => ao(m, o));
|
|
149
|
-
}
|
|
150
|
-
;
|
|
151
|
-
if (ah === 0 || ah === hir.current) ah = hir.current;else if (typeof __DEV__ !== 'undefined' && __DEV__) console.warn('[PortalHost] Multiple PortalHost instances detected. Imperative APIs will only use the first mounted host.');
|
|
152
|
-
}
|
|
153
|
-
}, []);
|
|
154
|
-
(0, _react().useEffect)(() => () => {
|
|
155
|
-
if (ah === hir.current) {
|
|
156
|
-
ah = 0;
|
|
157
|
-
qr.current = [];
|
|
158
|
-
portalStore.clear();
|
|
159
|
-
}
|
|
160
|
-
}, []);
|
|
161
|
-
(0, _react().useEffect)(() => {
|
|
162
|
-
const ha = ({
|
|
163
|
-
key: k,
|
|
164
|
-
children: c
|
|
165
|
-
}) => {
|
|
166
|
-
if (ah !== hir.current) return;
|
|
167
|
-
eor({
|
|
168
|
-
type: 'mount',
|
|
169
|
-
key: k,
|
|
170
|
-
children: c
|
|
171
|
-
});
|
|
172
|
-
};
|
|
173
|
-
const hu = ({
|
|
174
|
-
key: k,
|
|
175
|
-
children: c
|
|
176
|
-
}) => {
|
|
177
|
-
if (ah !== hir.current) return;
|
|
178
|
-
eor({
|
|
179
|
-
type: 'update',
|
|
180
|
-
key: k,
|
|
181
|
-
children: c
|
|
182
|
-
});
|
|
183
|
-
};
|
|
184
|
-
const hr = ({
|
|
185
|
-
key: k
|
|
186
|
-
}) => {
|
|
187
|
-
if (ah !== hir.current) return;
|
|
188
|
-
eor({
|
|
189
|
-
type: 'unmount',
|
|
190
|
-
key: k
|
|
191
|
-
});
|
|
192
|
-
};
|
|
193
|
-
const hc = () => {
|
|
194
|
-
if (ah !== hir.current) return;
|
|
195
|
-
qr.current = [];
|
|
196
|
-
eor({
|
|
197
|
-
type: 'clear'
|
|
198
|
-
});
|
|
199
|
-
};
|
|
200
|
-
const as = TVE.addListener(AE, ha);
|
|
201
|
-
const us = TVE.addListener(UE, hu);
|
|
202
|
-
const rs = TVE.addListener(RE, hr);
|
|
203
|
-
const cs = TVE.addListener(CE, hc);
|
|
204
|
-
return () => {
|
|
205
|
-
as.remove();
|
|
206
|
-
us.remove();
|
|
207
|
-
rs.remove();
|
|
208
|
-
cs.remove();
|
|
209
|
-
};
|
|
210
|
-
}, [eor]);
|
|
211
|
-
return /*#__PURE__*/_react().default.createElement(_PortalContext.PortalContext.Provider, {
|
|
212
|
-
value: sm
|
|
213
|
-
}, /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
214
|
-
style: S.h,
|
|
215
|
-
collapsable: false
|
|
216
|
-
}, /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
217
|
-
style: S.r,
|
|
218
|
-
collapsable: false,
|
|
219
|
-
pointerEvents: "box-none"
|
|
220
|
-
}, children), /*#__PURE__*/_react().default.createElement(PortalManagerView, {
|
|
221
|
-
ref: hmr
|
|
222
|
-
})));
|
|
223
|
-
};
|
|
224
|
-
const PortalHost = exports.PortalHost = /*#__PURE__*/_react().default.memo(PortalHostImpl);
|
|
225
|
-
PortalHost.displayName = 'PortalHost';
|
|
226
|
-
const S = _reactNative().StyleSheet.create({
|
|
227
|
-
h: {
|
|
228
|
-
position: 'relative',
|
|
229
|
-
flex: 1
|
|
230
|
-
},
|
|
231
|
-
r: {
|
|
232
|
-
flex: 1
|
|
233
|
-
},
|
|
234
|
-
pl: IW ? {
|
|
235
|
-
position: 'fixed',
|
|
236
|
-
top: 0,
|
|
237
|
-
left: 0,
|
|
238
|
-
right: 0,
|
|
239
|
-
bottom: 0
|
|
240
|
-
} : {
|
|
241
|
-
..._reactNative().StyleSheet.absoluteFillObject
|
|
242
|
-
},
|
|
243
|
-
pe: {
|
|
244
|
-
..._reactNative().StyleSheet.absoluteFillObject
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
const portalManager = exports.portalManager = gm;
|
|
248
|
-
const portalStore = exports.portalStore = {
|
|
249
|
-
clear: () => {
|
|
250
|
-
TVE.emit(CE);
|
|
251
|
-
},
|
|
252
|
-
hasHosts: () => ah !== 0
|
|
253
|
-
};
|
|
1
|
+
"use strict";function _react(){const e=_interopRequireWildcard(require("react"));return _react=function(){return e},e}function _reactNative(){const e=require("react-native");return _reactNative=function(){return e},e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.portalStore=exports.portalManager=exports.PortalHost=void 0;var _utils=require("../../utils"),_PortalContext=require("./PortalContext");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap,a=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var n,o,l={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return l;if(n=t?a:r){if(n.has(e))return n.get(e);n.set(e,l)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((o=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(o.get||o.set)?n(l,t,o):l[t]=e[t]);return l})(e,t)}const AE="RNSU_PORTAL_ADD",UE="RNSU_PORTAL_UPDATE",RE="RNSU_PORTAL_REMOVE",CE="RNSU_PORTAL_CLEAR",TVE=_reactNative().DeviceEventEmitter||new(_reactNative().NativeEventEmitter),IW="web"===_reactNative().Platform.OS,ao=(e,t)=>{"mount"===t.type?e.mount(t.children,t.key):"update"===t.type?e.update(t.key,t.children):"clear"===t.type?e.clear():e.unmount(t.key)},PortalManagerView=_react().default.forwardRef((e,t)=>{const[r,a]=(0,_react().useState)([]),n=(0,_react().useRef)(0),o=(0,_react().useCallback)(e=>{a(t=>{const r=t.findIndex(t=>t.key===e.key);return-1===r?[...t,e]:[...t.slice(0,r),e,...t.slice(r+1)]})},[]),l=(0,_react().useCallback)((e,t)=>{const r=t??++n.current;return(0,_utils.isNumber)(t)&&t>=n.current&&(n.current=t+1),o({key:r,children:e}),r},[o]),c=(0,_react().useCallback)((e,t)=>{o({key:e,children:t})},[o]),u=(0,_react().useCallback)(e=>{a(t=>t.filter(t=>t.key!==e))},[]),i=(0,_react().useCallback)(()=>{a([])},[]);return _react().default.useImperativeHandle(t,()=>({mount:l,update:c,unmount:u,clear:i}),[l,c,u,i]),0===r.length?null:_react().default.createElement(_reactNative().View,{pointerEvents:"box-none",style:S.pl,collapsable:!1},r.map(e=>_react().default.createElement(_reactNative().View,{key:e.key,pointerEvents:"box-none",collapsable:!1,style:S.pe},e.children)))});let ah=0,nh=1,ngk=1e4;const gm={mount:(e,t)=>{"undefined"!=typeof __DEV__&&__DEV__&&0===ah&&console.warn("[Portal] Please mount <PortalHost> or <ConfigProvider> at the root to enable imperative APIs.");const r=t??ngk++;return(0,_utils.isNumber)(t)&&t>=ngk&&(ngk=t+1),TVE.emit(AE,{key:r,children:e}),r},update:(e,t)=>{TVE.emit(UE,{key:e,children:t})},unmount:e=>{TVE.emit(RE,{key:e})}},PortalHostImpl=({children:e})=>{const t=(0,_react().useRef)(nh++),r=(0,_react().useRef)(null),a=(0,_react().useRef)([]),n=(0,_react().useRef)(1),o=(0,_react().useCallback)(e=>{const t=r.current;t?ao(t,e):a.current.push(e)},[]),l=(0,_react().useMemo)(()=>({mount:(e,t)=>{const r=t??n.current++;return(0,_utils.isNumber)(t)&&t>=n.current&&(n.current=t+1),o({type:"mount",key:r,children:e}),r},update:(e,t)=>{o({type:"update",key:e,children:t})},unmount:e=>{o({type:"unmount",key:e})}}),[o]),c=(0,_react().useCallback)(e=>{if(r.current=e,e){if(a.current.length>0){a.current.splice(0,a.current.length).forEach(t=>ao(e,t))}0===ah||ah===t.current?ah=t.current:"undefined"!=typeof __DEV__&&__DEV__&&console.warn("[PortalHost] Multiple PortalHost instances detected. Imperative APIs will only use the first mounted host.")}},[]);return(0,_react().useEffect)(()=>()=>{ah===t.current&&(ah=0,a.current=[],portalStore.clear())},[]),(0,_react().useEffect)(()=>{const e=TVE.addListener(AE,({key:e,children:r})=>{ah===t.current&&o({type:"mount",key:e,children:r})}),r=TVE.addListener(UE,({key:e,children:r})=>{ah===t.current&&o({type:"update",key:e,children:r})}),n=TVE.addListener(RE,({key:e})=>{ah===t.current&&o({type:"unmount",key:e})}),l=TVE.addListener(CE,()=>{ah===t.current&&(a.current=[],o({type:"clear"}))});return()=>{e.remove(),r.remove(),n.remove(),l.remove()}},[o]),_react().default.createElement(_PortalContext.PortalContext.Provider,{value:l},_react().default.createElement(_reactNative().View,{style:S.h,collapsable:!1},_react().default.createElement(_reactNative().View,{style:S.r,collapsable:!1,pointerEvents:"box-none"},e),_react().default.createElement(PortalManagerView,{ref:c})))},PortalHost=exports.PortalHost=_react().default.memo(PortalHostImpl);PortalHost.displayName="PortalHost";const S=_reactNative().StyleSheet.create({h:{position:"relative",flex:1},r:{flex:1},pl:IW?{position:"fixed",top:0,left:0,right:0,bottom:0}:{..._reactNative().StyleSheet.absoluteFillObject},pe:{..._reactNative().StyleSheet.absoluteFillObject}}),portalManager=exports.portalManager=gm,portalStore=exports.portalStore={clear:()=>{TVE.emit(CE)},hasHosts:()=>0!==ah};
|
|
@@ -1,25 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Portal", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _Portal.Portal;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "PortalHost", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _PortalHost.PortalHost;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "portalManager", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _PortalHost.portalManager;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
var _PortalHost = require("./PortalHost");
|
|
25
|
-
var _Portal = require("./Portal");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"Portal",{enumerable:!0,get:function(){return _Portal.Portal}}),Object.defineProperty(exports,"PortalHost",{enumerable:!0,get:function(){return _PortalHost.PortalHost}}),Object.defineProperty(exports,"portalManager",{enumerable:!0,get:function(){return _PortalHost.portalManager}});var _PortalHost=require("./PortalHost"),_Portal=require("./Portal");
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.usePortalTokens = void 0;
|
|
7
|
-
var _designSystem = require("../../design-system");
|
|
8
|
-
const createPortalTokens = _foundations => {
|
|
9
|
-
return {};
|
|
10
|
-
};
|
|
11
|
-
const usePortalTokens = exports.usePortalTokens = (0, _designSystem.createComponentTokensHook)('portal', createPortalTokens);
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.usePortalTokens=void 0;var _designSystem=require("../../design-system");const createPortalTokens=e=>({}),usePortalTokens=exports.usePortalTokens=(0,_designSystem.createComponentTokensHook)("portal",createPortalTokens);
|
|
@@ -1,216 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.ProgressFilledTrack = exports.Progress = void 0;
|
|
7
|
-
function _react() {
|
|
8
|
-
const data = _interopRequireWildcard(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 _utils = require("../../utils");
|
|
22
|
-
var _animation = require("../../hooks/animation");
|
|
23
|
-
var _tokens = require("./tokens");
|
|
24
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
25
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
26
|
-
const GRADIENT_REGEX = /linear-gradient|radial-gradient|conic-gradient/i;
|
|
27
|
-
const ProgressContext = /*#__PURE__*/_react().default.createContext(null);
|
|
28
|
-
const ProgressFilledTrack = ({
|
|
29
|
-
style
|
|
30
|
-
}) => {
|
|
31
|
-
const context = (0, _react().useContext)(ProgressContext);
|
|
32
|
-
if (!context) return null;
|
|
33
|
-
const size = (0, _react().useMemo)(() => context.animatedValue.interpolate({
|
|
34
|
-
inputRange: [0, 100],
|
|
35
|
-
outputRange: ['0%', '100%']
|
|
36
|
-
}), [context.animatedValue]);
|
|
37
|
-
const sizeStyle = (0, _react().useMemo)(() => context.orientation === 'vertical' ? {
|
|
38
|
-
width: context.height,
|
|
39
|
-
height: size,
|
|
40
|
-
bottom: 0,
|
|
41
|
-
left: 0,
|
|
42
|
-
position: 'absolute'
|
|
43
|
-
} : {
|
|
44
|
-
height: context.height,
|
|
45
|
-
width: size
|
|
46
|
-
}, [context.height, context.orientation, size]);
|
|
47
|
-
const baseStyle = [context.orientation === 'vertical' ? {
|
|
48
|
-
position: 'absolute',
|
|
49
|
-
left: 0,
|
|
50
|
-
bottom: 0
|
|
51
|
-
} : context.layoutIndicator, {
|
|
52
|
-
backgroundColor: context.indicatorColor,
|
|
53
|
-
borderRadius: context.height / 2,
|
|
54
|
-
...(context.isGradient && context.gradientColor ? {
|
|
55
|
-
backgroundImage: context.gradientColor
|
|
56
|
-
} : null)
|
|
57
|
-
}, sizeStyle, context.indicatorStyle, style];
|
|
58
|
-
return /*#__PURE__*/_react().default.createElement(_reactNative().Animated.View, {
|
|
59
|
-
style: baseStyle
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
exports.ProgressFilledTrack = ProgressFilledTrack;
|
|
63
|
-
const Progress = exports.Progress = /*#__PURE__*/(0, _react().memo)(props => {
|
|
64
|
-
const {
|
|
65
|
-
tokensOverride,
|
|
66
|
-
percentage: pctP,
|
|
67
|
-
strokeWidth,
|
|
68
|
-
color,
|
|
69
|
-
trackColor,
|
|
70
|
-
pivotText,
|
|
71
|
-
pivotColor,
|
|
72
|
-
textColor,
|
|
73
|
-
inactive: inactP,
|
|
74
|
-
showPivot: showPivotP,
|
|
75
|
-
animated,
|
|
76
|
-
transition: transP,
|
|
77
|
-
animationDuration: durP,
|
|
78
|
-
style,
|
|
79
|
-
pivotStyle,
|
|
80
|
-
indicatorStyle,
|
|
81
|
-
orientation: oriP,
|
|
82
|
-
children,
|
|
83
|
-
...rest
|
|
84
|
-
} = props;
|
|
85
|
-
const tokens = (0, _tokens.useProgressTokens)(tokensOverride);
|
|
86
|
-
const reducedMotion = (0, _animation.useReducedMotion)();
|
|
87
|
-
const pct = (0, _utils.clamp)((0, _utils.parsePercentage)(pctP ?? tokens.defaults.percentage), 0, 100);
|
|
88
|
-
const h = (0, _utils.parseNumberLike)(strokeWidth, tokens.sizing.height) ?? tokens.sizing.height;
|
|
89
|
-
const inact = inactP ?? tokens.defaults.inactive;
|
|
90
|
-
const ori = oriP ?? 'horizontal';
|
|
91
|
-
const showPivot = ori === 'vertical' ? false : showPivotP ?? tokens.defaults.showPivot;
|
|
92
|
-
const doAnim = (animated ?? transP ?? tokens.defaults.transition) && !inact;
|
|
93
|
-
const dur = Math.max(0, durP ?? tokens.defaults.animationDuration);
|
|
94
|
-
const isGrad = _reactNative().Platform.OS === 'web' && (0, _utils.isString)(color) && GRADIENT_REGEX.test(color);
|
|
95
|
-
const trackClr = trackColor ?? tokens.colors.track;
|
|
96
|
-
const indClr = inact ? tokens.colors.track : !isGrad ? color ?? tokens.colors.indicator : undefined;
|
|
97
|
-
const pivotBg = pivotColor ?? (isGrad ? inact ? tokens.colors.track : tokens.colors.indicator : indClr);
|
|
98
|
-
const pivotTxtClr = textColor ?? tokens.colors.pivotText;
|
|
99
|
-
const pivotCnt = pivotText ?? `${pct}%`;
|
|
100
|
-
const hasPiv = showPivot && pivotCnt !== null && pivotCnt !== false;
|
|
101
|
-
const animVal = (0, _react().useRef)(new (_reactNative().Animated.Value)(pct)).current;
|
|
102
|
-
(0, _react().useEffect)(() => {
|
|
103
|
-
if (doAnim && dur > 0 && !reducedMotion) {
|
|
104
|
-
const anim = _reactNative().Animated.timing(animVal, {
|
|
105
|
-
toValue: pct,
|
|
106
|
-
duration: dur,
|
|
107
|
-
useNativeDriver: false,
|
|
108
|
-
isInteraction: false
|
|
109
|
-
});
|
|
110
|
-
anim.start();
|
|
111
|
-
return () => anim.stop();
|
|
112
|
-
} else animVal.setValue(pct);
|
|
113
|
-
}, [pct, doAnim, dur, animVal, reducedMotion]);
|
|
114
|
-
const [lay, setLay] = (0, _react().useState)({
|
|
115
|
-
track: 0,
|
|
116
|
-
pivot: 0
|
|
117
|
-
});
|
|
118
|
-
const onTrackLay = (0, _react().useCallback)(e => {
|
|
119
|
-
const w = e.nativeEvent.layout.width;
|
|
120
|
-
setLay(prev => prev.track === w ? prev : {
|
|
121
|
-
...prev,
|
|
122
|
-
track: w
|
|
123
|
-
});
|
|
124
|
-
}, []);
|
|
125
|
-
const onPivotLay = (0, _react().useCallback)(e => {
|
|
126
|
-
const w = e.nativeEvent.layout.width;
|
|
127
|
-
setLay(prev => prev.pivot === w ? prev : {
|
|
128
|
-
...prev,
|
|
129
|
-
pivot: w
|
|
130
|
-
});
|
|
131
|
-
}, []);
|
|
132
|
-
const trackStyle = [tokens.layout.track, ori === 'vertical' ? {
|
|
133
|
-
width: h,
|
|
134
|
-
height: '100%',
|
|
135
|
-
backgroundColor: trackClr,
|
|
136
|
-
borderRadius: h / 2
|
|
137
|
-
} : {
|
|
138
|
-
height: h,
|
|
139
|
-
backgroundColor: trackClr,
|
|
140
|
-
borderRadius: h / 2
|
|
141
|
-
}];
|
|
142
|
-
const pivotNode = (0, _react().useMemo)(() => {
|
|
143
|
-
if (!hasPiv) return null;
|
|
144
|
-
const {
|
|
145
|
-
track: tw,
|
|
146
|
-
pivot: pw
|
|
147
|
-
} = lay;
|
|
148
|
-
const ctrStyle = [tokens.layout.pivot, {
|
|
149
|
-
bottom: h + tokens.sizing.pivotPaddingVertical * 2,
|
|
150
|
-
backgroundColor: pivotBg,
|
|
151
|
-
paddingHorizontal: tokens.sizing.pivotPaddingHorizontal,
|
|
152
|
-
paddingVertical: tokens.sizing.pivotPaddingVertical,
|
|
153
|
-
borderRadius: h,
|
|
154
|
-
opacity: tw > 0 ? 1 : 0
|
|
155
|
-
}];
|
|
156
|
-
let transStyle = null;
|
|
157
|
-
if (tw > 0 && pw > 0) {
|
|
158
|
-
const p1 = pw / 2 / tw * 100;
|
|
159
|
-
const p2 = (tw - pw / 2) / tw * 100;
|
|
160
|
-
transStyle = p1 < p2 ? {
|
|
161
|
-
transform: [{
|
|
162
|
-
translateX: animVal.interpolate({
|
|
163
|
-
inputRange: [0, p1, p2, 100],
|
|
164
|
-
outputRange: [0, 0, tw - pw, tw - pw],
|
|
165
|
-
extrapolate: 'clamp'
|
|
166
|
-
})
|
|
167
|
-
}]
|
|
168
|
-
} : {
|
|
169
|
-
transform: [{
|
|
170
|
-
translateX: (tw - pw) / 2
|
|
171
|
-
}]
|
|
172
|
-
};
|
|
173
|
-
} else transStyle = {
|
|
174
|
-
transform: [{
|
|
175
|
-
translateX: (tw - pw) / 2
|
|
176
|
-
}]
|
|
177
|
-
};
|
|
178
|
-
return /*#__PURE__*/_react().default.createElement(_reactNative().Animated.View, {
|
|
179
|
-
style: [ctrStyle, transStyle],
|
|
180
|
-
pointerEvents: "none",
|
|
181
|
-
onLayout: onPivotLay
|
|
182
|
-
}, (0, _utils.isText)(pivotCnt) ? /*#__PURE__*/_react().default.createElement(_reactNative().Text, {
|
|
183
|
-
style: [tokens.layout.pivotText, {
|
|
184
|
-
color: pivotTxtClr,
|
|
185
|
-
fontFamily: tokens.typography.fontFamily,
|
|
186
|
-
fontSize: tokens.typography.pivotFontSize
|
|
187
|
-
}, pivotStyle]
|
|
188
|
-
}, pivotCnt) : pivotCnt);
|
|
189
|
-
}, [animVal, hasPiv, h, lay, onPivotLay, pivotCnt, pivotStyle, pivotBg, pivotTxtClr, tokens.layout.pivot, tokens.layout.pivotText, tokens.sizing.pivotPaddingHorizontal, tokens.sizing.pivotPaddingVertical, tokens.typography.fontFamily, tokens.typography.pivotFontSize]);
|
|
190
|
-
const ctxVal = (0, _react().useMemo)(() => ({
|
|
191
|
-
animatedValue: animVal,
|
|
192
|
-
orientation: ori,
|
|
193
|
-
height: h,
|
|
194
|
-
indicatorColor: indClr,
|
|
195
|
-
indicatorStyle: indicatorStyle,
|
|
196
|
-
isGradient: isGrad,
|
|
197
|
-
gradientColor: isGrad ? color : undefined,
|
|
198
|
-
layoutIndicator: tokens.layout.indicator
|
|
199
|
-
}), [animVal, color, h, indicatorStyle, isGrad, ori, indClr, tokens.layout.indicator]);
|
|
200
|
-
return /*#__PURE__*/_react().default.createElement(ProgressContext.Provider, {
|
|
201
|
-
value: ctxVal
|
|
202
|
-
}, /*#__PURE__*/_react().default.createElement(_reactNative().View, _extends({
|
|
203
|
-
style: style,
|
|
204
|
-
accessibilityRole: "progressbar",
|
|
205
|
-
accessibilityValue: {
|
|
206
|
-
min: 0,
|
|
207
|
-
max: 100,
|
|
208
|
-
now: pct
|
|
209
|
-
}
|
|
210
|
-
}, rest), /*#__PURE__*/_react().default.createElement(_reactNative().View, {
|
|
211
|
-
style: trackStyle,
|
|
212
|
-
onLayout: hasPiv ? onTrackLay : undefined
|
|
213
|
-
}, children ?? /*#__PURE__*/_react().default.createElement(ProgressFilledTrack, null)), pivotNode));
|
|
214
|
-
});
|
|
215
|
-
Progress.displayName = 'Progress';
|
|
216
|
-
var _default = exports.default = Progress;
|
|
1
|
+
"use strict";function _react(){const t=_interopRequireWildcard(require("react"));return _react=function(){return t},t}function _reactNative(){const t=require("react-native");return _reactNative=function(){return t},t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ProgressFilledTrack=exports.Progress=void 0;var _utils=require("../../utils"),_animation=require("../../hooks/animation"),_tokens=require("./tokens");function _interopRequireWildcard(t,e){if("function"==typeof WeakMap)var r=new WeakMap,a=new WeakMap;return(_interopRequireWildcard=function(t,e){if(!e&&t&&t.__esModule)return t;var i,o,n={__proto__:null,default:t};if(null===t||"object"!=typeof t&&"function"!=typeof t)return n;if(i=e?a:r){if(i.has(t))return i.get(t);i.set(t,n)}for(const e in t)"default"!==e&&{}.hasOwnProperty.call(t,e)&&((o=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(t,e))&&(o.get||o.set)?i(n,e,o):n[e]=t[e]);return n})(t,e)}function _extends(){return _extends=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)({}).hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},_extends.apply(null,arguments)}const GRADIENT_REGEX=/linear-gradient|radial-gradient|conic-gradient/i,ProgressContext=_react().default.createContext(null),ProgressFilledTrack=({style:t})=>{const e=(0,_react().useContext)(ProgressContext);if(!e)return null;const r=(0,_react().useMemo)(()=>e.animatedValue.interpolate({inputRange:[0,100],outputRange:["0%","100%"]}),[e.animatedValue]),a=(0,_react().useMemo)(()=>"vertical"===e.orientation?{width:e.height,height:r,bottom:0,left:0,position:"absolute"}:{height:e.height,width:r},[e.height,e.orientation,r]),i=["vertical"===e.orientation?{position:"absolute",left:0,bottom:0}:e.layoutIndicator,{backgroundColor:e.indicatorColor,borderRadius:e.height/2,...e.isGradient&&e.gradientColor?{backgroundImage:e.gradientColor}:null},a,e.indicatorStyle,t];return _react().default.createElement(_reactNative().Animated.View,{style:i})};exports.ProgressFilledTrack=ProgressFilledTrack;const Progress=exports.Progress=(0,_react().memo)(t=>{const{tokensOverride:e,percentage:r,strokeWidth:a,color:i,trackColor:o,pivotText:n,pivotColor:l,textColor:s,inactive:c,showPivot:u,animated:d,transition:p,animationDuration:g,style:v,pivotStyle:_,indicatorStyle:f,orientation:y,children:m,...h}=t,k=(0,_tokens.useProgressTokens)(e),P=(0,_animation.useReducedMotion)(),b=(0,_utils.clamp)((0,_utils.parsePercentage)(r??k.defaults.percentage),0,100),x=(0,_utils.parseNumberLike)(a,k.sizing.height)??k.sizing.height,w=c??k.defaults.inactive,C=y??"horizontal",R="vertical"!==C&&(u??k.defaults.showPivot),E=(d??p??k.defaults.transition)&&!w,N=Math.max(0,g??k.defaults.animationDuration),V="web"===_reactNative().Platform.OS&&(0,_utils.isString)(i)&&GRADIENT_REGEX.test(i),z=o??k.colors.track,T=w?k.colors.track:V?void 0:i??k.colors.indicator,M=l??(V?w?k.colors.track:k.colors.indicator:T),F=s??k.colors.pivotText,O=n??`${b}%`,S=R&&null!==O&&!1!==O,q=(0,_react().useRef)(new(_reactNative().Animated.Value)(b)).current;(0,_react().useEffect)(()=>{if(E&&N>0&&!P){const t=_reactNative().Animated.timing(q,{toValue:b,duration:N,useNativeDriver:!1,isInteraction:!1});return t.start(),()=>t.stop()}q.setValue(b)},[b,E,N,q,P]);const[W,j]=(0,_react().useState)({track:0,pivot:0}),A=(0,_react().useCallback)(t=>{const e=t.nativeEvent.layout.width;j(t=>t.track===e?t:{...t,track:e})},[]),D=(0,_react().useCallback)(t=>{const e=t.nativeEvent.layout.width;j(t=>t.pivot===e?t:{...t,pivot:e})},[]),G=[k.layout.track,"vertical"===C?{width:x,height:"100%",backgroundColor:z,borderRadius:x/2}:{height:x,backgroundColor:z,borderRadius:x/2}],I=(0,_react().useMemo)(()=>{if(!S)return null;const{track:t,pivot:e}=W,r=[k.layout.pivot,{bottom:x+2*k.sizing.pivotPaddingVertical,backgroundColor:M,paddingHorizontal:k.sizing.pivotPaddingHorizontal,paddingVertical:k.sizing.pivotPaddingVertical,borderRadius:x,opacity:t>0?1:0}];let a=null;if(t>0&&e>0){const r=e/2/t*100,i=(t-e/2)/t*100;a=r<i?{transform:[{translateX:q.interpolate({inputRange:[0,r,i,100],outputRange:[0,0,t-e,t-e],extrapolate:"clamp"})}]}:{transform:[{translateX:(t-e)/2}]}}else a={transform:[{translateX:(t-e)/2}]};return _react().default.createElement(_reactNative().Animated.View,{style:[r,a],pointerEvents:"none",onLayout:D},(0,_utils.isText)(O)?_react().default.createElement(_reactNative().Text,{style:[k.layout.pivotText,{color:F,fontFamily:k.typography.fontFamily,fontSize:k.typography.pivotFontSize},_]},O):O)},[q,S,x,W,D,O,_,M,F,k.layout.pivot,k.layout.pivotText,k.sizing.pivotPaddingHorizontal,k.sizing.pivotPaddingVertical,k.typography.fontFamily,k.typography.pivotFontSize]),X=(0,_react().useMemo)(()=>({animatedValue:q,orientation:C,height:x,indicatorColor:T,indicatorStyle:f,isGradient:V,gradientColor:V?i:void 0,layoutIndicator:k.layout.indicator}),[q,i,x,f,V,C,T,k.layout.indicator]);return _react().default.createElement(ProgressContext.Provider,{value:X},_react().default.createElement(_reactNative().View,_extends({style:v,accessibilityRole:"progressbar",accessibilityValue:{min:0,max:100,now:b}},h),_react().default.createElement(_reactNative().View,{style:G,onLayout:S?A:void 0},m??_react().default.createElement(ProgressFilledTrack,null)),I))});Progress.displayName="Progress";var _default=exports.default=Progress;
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "ProgressFilledTrack", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _Progress.ProgressFilledTrack;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
exports.default = void 0;
|
|
13
|
-
var _Progress = require("./Progress");
|
|
14
|
-
var _default = exports.default = _Progress.Progress;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ProgressFilledTrack",{enumerable:!0,get:function(){return _Progress.ProgressFilledTrack}}),exports.default=void 0;var _Progress=require("./Progress"),_default=exports.default=_Progress.Progress;
|