orn-ui 0.2.9 → 0.3.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/AGENTS.md +67 -52
- package/README.md +5 -9
- package/lib/commonjs/atoms/Avatar.js +77 -5
- package/lib/commonjs/atoms/Avatar.js.map +1 -1
- package/lib/commonjs/atoms/Badge.js +17 -8
- package/lib/commonjs/atoms/Badge.js.map +1 -1
- package/lib/commonjs/atoms/Button.js +108 -39
- package/lib/commonjs/atoms/Button.js.map +1 -1
- package/lib/commonjs/atoms/Card.js +24 -2
- package/lib/commonjs/atoms/Card.js.map +1 -1
- package/lib/commonjs/atoms/Checkbox.js +41 -10
- package/lib/commonjs/atoms/Checkbox.js.map +1 -1
- package/lib/commonjs/atoms/Divider.js +30 -5
- package/lib/commonjs/atoms/Divider.js.map +1 -1
- package/lib/commonjs/atoms/EmptyState.js +58 -20
- package/lib/commonjs/atoms/EmptyState.js.map +1 -1
- package/lib/commonjs/atoms/Fab.js +32 -12
- package/lib/commonjs/atoms/Fab.js.map +1 -1
- package/lib/commonjs/atoms/Gradient.js +102 -36
- package/lib/commonjs/atoms/Gradient.js.map +1 -1
- package/lib/commonjs/atoms/IconButton.js +25 -4
- package/lib/commonjs/atoms/IconButton.js.map +1 -1
- package/lib/commonjs/atoms/Image.js +61 -25
- package/lib/commonjs/atoms/Image.js.map +1 -1
- package/lib/commonjs/atoms/Input.js +105 -17
- package/lib/commonjs/atoms/Input.js.map +1 -1
- package/lib/commonjs/atoms/KeyValueRow.js +37 -9
- package/lib/commonjs/atoms/KeyValueRow.js.map +1 -1
- package/lib/commonjs/atoms/PressableScale.js +25 -5
- package/lib/commonjs/atoms/PressableScale.js.map +1 -1
- package/lib/commonjs/atoms/ShinyText.js +29 -29
- package/lib/commonjs/atoms/Skeleton.js +28 -13
- package/lib/commonjs/atoms/Skeleton.js.map +1 -1
- package/lib/commonjs/atoms/Spinner.js +81 -22
- package/lib/commonjs/atoms/Spinner.js.map +1 -1
- package/lib/commonjs/atoms/Text.js +56 -5
- package/lib/commonjs/atoms/Text.js.map +1 -1
- package/lib/commonjs/atoms/Transition.js +46 -43
- package/lib/commonjs/atoms/Transition.js.map +1 -1
- package/lib/commonjs/atoms/index.js +6 -0
- package/lib/commonjs/atoms/index.js.map +1 -1
- package/lib/commonjs/atoms/inputValidation.js +56 -0
- package/lib/commonjs/atoms/inputValidation.js.map +1 -0
- package/lib/commonjs/icons/Icon.js +4 -4
- package/lib/commonjs/icons/defaultIcons.js +576 -24
- package/lib/commonjs/icons/defaultIcons.js.map +1 -1
- package/lib/commonjs/icons/index.js +6 -0
- package/lib/commonjs/icons/index.js.map +1 -1
- package/lib/commonjs/molecules/AvatarHeader.js +47 -14
- package/lib/commonjs/molecules/AvatarHeader.js.map +1 -1
- package/lib/commonjs/molecules/FormActions.js +25 -9
- package/lib/commonjs/molecules/FormActions.js.map +1 -1
- package/lib/commonjs/molecules/InfoRow.js +30 -14
- package/lib/commonjs/molecules/InfoRow.js.map +1 -1
- package/lib/commonjs/molecules/OptionCard.js +37 -22
- package/lib/commonjs/molecules/OptionCard.js.map +1 -1
- package/lib/commonjs/molecules/SegmentedControl.js +103 -14
- package/lib/commonjs/molecules/SegmentedControl.js.map +1 -1
- package/lib/commonjs/molecules/Stepper.js +61 -16
- package/lib/commonjs/molecules/Stepper.js.map +1 -1
- package/lib/commonjs/molecules/Steps.js +105 -41
- package/lib/commonjs/molecules/Steps.js.map +1 -1
- package/lib/commonjs/molecules/SymmetricGrid.js +26 -18
- package/lib/commonjs/molecules/SymmetricGrid.js.map +1 -1
- package/lib/commonjs/organisms/Alert.js +49 -35
- package/lib/commonjs/organisms/Alert.js.map +1 -1
- package/lib/commonjs/organisms/AlertProvider.js +10 -10
- package/lib/commonjs/organisms/BottomSheet.js +137 -85
- package/lib/commonjs/organisms/BottomSheet.js.map +1 -1
- package/lib/commonjs/organisms/Chart.js +197 -156
- package/lib/commonjs/organisms/Chart.js.map +1 -1
- package/lib/commonjs/organisms/DateField.js +36 -20
- package/lib/commonjs/organisms/DateField.js.map +1 -1
- package/lib/commonjs/organisms/DatePicker.js +56 -33
- package/lib/commonjs/organisms/DatePicker.js.map +1 -1
- package/lib/commonjs/organisms/List.js +62 -34
- package/lib/commonjs/organisms/List.js.map +1 -1
- package/lib/commonjs/organisms/Modal.js +120 -82
- package/lib/commonjs/organisms/Modal.js.map +1 -1
- package/lib/commonjs/organisms/NavigationBar.js +63 -24
- package/lib/commonjs/organisms/NavigationBar.js.map +1 -1
- package/lib/commonjs/organisms/OptionWheel.js +64 -64
- package/lib/commonjs/organisms/OptionWheel.js.map +1 -1
- package/lib/commonjs/organisms/ReorderableList.js +48 -27
- package/lib/commonjs/organisms/ReorderableList.js.map +1 -1
- package/lib/commonjs/organisms/Screen.js +68 -35
- package/lib/commonjs/organisms/Screen.js.map +1 -1
- package/lib/commonjs/organisms/SearchList.js +56 -26
- package/lib/commonjs/organisms/SearchList.js.map +1 -1
- package/lib/commonjs/organisms/Select.js +45 -24
- package/lib/commonjs/organisms/Select.js.map +1 -1
- package/lib/commonjs/organisms/Slides.js +36 -23
- package/lib/commonjs/organisms/Slides.js.map +1 -1
- package/lib/commonjs/organisms/ThemeToggle.js +10 -9
- package/lib/commonjs/organisms/ThemeToggle.js.map +1 -1
- package/lib/commonjs/organisms/Timeline.js +73 -56
- package/lib/commonjs/organisms/Timeline.js.map +1 -1
- package/lib/commonjs/organisms/Toast.js +46 -15
- package/lib/commonjs/organisms/Toast.js.map +1 -1
- package/lib/commonjs/organisms/ToastProvider.js +14 -10
- package/lib/commonjs/organisms/ToastProvider.js.map +1 -1
- package/lib/commonjs/organisms/Wizard.js +40 -15
- package/lib/commonjs/organisms/Wizard.js.map +1 -1
- package/lib/commonjs/organisms/chart/frame.js +25 -25
- package/lib/commonjs/organisms/chart/frame.js.map +1 -1
- package/lib/commonjs/organisms/chart/marks.js +42 -42
- package/lib/commonjs/organisms/chart/math.js +84 -85
- package/lib/commonjs/organisms/chart/math.js.map +1 -1
- package/lib/commonjs/organisms/chart/palette.js +28 -28
- package/lib/commonjs/organisms/imperativeBridge.js +5 -5
- package/lib/commonjs/organisms/imperativeBridge.js.map +1 -1
- package/lib/commonjs/organisms/useSlides.js +53 -21
- package/lib/commonjs/organisms/useSlides.js.map +1 -1
- package/lib/commonjs/safe-area/SafeAreaUIProvider.js +9 -66
- package/lib/commonjs/safe-area/SafeAreaUIProvider.js.map +1 -1
- package/lib/commonjs/safe-area/index.js.map +1 -1
- package/lib/commonjs/theme/KeyboardAvoidance.js +206 -0
- package/lib/commonjs/theme/KeyboardAvoidance.js.map +1 -0
- package/lib/commonjs/theme/NativeOverlay.js +263 -0
- package/lib/commonjs/theme/NativeOverlay.js.map +1 -0
- package/lib/commonjs/theme/UIProvider.js +86 -33
- package/lib/commonjs/theme/UIProvider.js.map +1 -1
- package/lib/commonjs/theme/colors.js +17 -17
- package/lib/commonjs/theme/colors.js.map +1 -1
- package/lib/commonjs/theme/createStyles.js +19 -16
- package/lib/commonjs/theme/createStyles.js.map +1 -1
- package/lib/commonjs/theme/createTheme.js +6 -6
- package/lib/commonjs/theme/index.js +6 -0
- package/lib/commonjs/theme/index.js.map +1 -1
- package/lib/commonjs/theme/insets.js +1 -1
- package/lib/commonjs/theme/labels.js +29 -1
- package/lib/commonjs/theme/labels.js.map +1 -1
- package/lib/commonjs/theme/palettes.js +25 -23
- package/lib/commonjs/theme/palettes.js.map +1 -1
- package/lib/commonjs/theme/tokens.js +28 -14
- package/lib/commonjs/theme/tokens.js.map +1 -1
- package/lib/commonjs/theme/useKeyboardField.js +36 -0
- package/lib/commonjs/theme/useKeyboardField.js.map +1 -0
- package/lib/commonjs/theme/useReduceMotion.js +31 -0
- package/lib/commonjs/theme/useReduceMotion.js.map +1 -0
- package/lib/module/atoms/Avatar.js +79 -8
- package/lib/module/atoms/Avatar.js.map +1 -1
- package/lib/module/atoms/Badge.js +17 -8
- package/lib/module/atoms/Badge.js.map +1 -1
- package/lib/module/atoms/Button.js +110 -41
- package/lib/module/atoms/Button.js.map +1 -1
- package/lib/module/atoms/Card.js +24 -2
- package/lib/module/atoms/Card.js.map +1 -1
- package/lib/module/atoms/Checkbox.js +42 -11
- package/lib/module/atoms/Checkbox.js.map +1 -1
- package/lib/module/atoms/Divider.js +31 -6
- package/lib/module/atoms/Divider.js.map +1 -1
- package/lib/module/atoms/EmptyState.js +58 -20
- package/lib/module/atoms/EmptyState.js.map +1 -1
- package/lib/module/atoms/Fab.js +33 -13
- package/lib/module/atoms/Fab.js.map +1 -1
- package/lib/module/atoms/Gradient.js +103 -37
- package/lib/module/atoms/Gradient.js.map +1 -1
- package/lib/module/atoms/IconButton.js +25 -4
- package/lib/module/atoms/IconButton.js.map +1 -1
- package/lib/module/atoms/Image.js +61 -25
- package/lib/module/atoms/Image.js.map +1 -1
- package/lib/module/atoms/Input.js +108 -20
- package/lib/module/atoms/Input.js.map +1 -1
- package/lib/module/atoms/KeyValueRow.js +37 -9
- package/lib/module/atoms/KeyValueRow.js.map +1 -1
- package/lib/module/atoms/PressableScale.js +25 -5
- package/lib/module/atoms/PressableScale.js.map +1 -1
- package/lib/module/atoms/ShinyText.js +29 -29
- package/lib/module/atoms/Skeleton.js +30 -13
- package/lib/module/atoms/Skeleton.js.map +1 -1
- package/lib/module/atoms/Spinner.js +82 -23
- package/lib/module/atoms/Spinner.js.map +1 -1
- package/lib/module/atoms/Text.js +56 -5
- package/lib/module/atoms/Text.js.map +1 -1
- package/lib/module/atoms/Transition.js +41 -42
- package/lib/module/atoms/Transition.js.map +1 -1
- package/lib/module/atoms/index.js +1 -1
- package/lib/module/atoms/index.js.map +1 -1
- package/lib/module/atoms/inputValidation.js +52 -0
- package/lib/module/atoms/inputValidation.js.map +1 -0
- package/lib/module/icons/Icon.js +4 -4
- package/lib/module/icons/defaultIcons.js +574 -24
- package/lib/module/icons/defaultIcons.js.map +1 -1
- package/lib/module/icons/index.js +1 -1
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/molecules/AvatarHeader.js +47 -14
- package/lib/module/molecules/AvatarHeader.js.map +1 -1
- package/lib/module/molecules/FormActions.js +25 -9
- package/lib/module/molecules/FormActions.js.map +1 -1
- package/lib/module/molecules/InfoRow.js +30 -14
- package/lib/module/molecules/InfoRow.js.map +1 -1
- package/lib/module/molecules/OptionCard.js +37 -22
- package/lib/module/molecules/OptionCard.js.map +1 -1
- package/lib/module/molecules/SegmentedControl.js +107 -18
- package/lib/module/molecules/SegmentedControl.js.map +1 -1
- package/lib/module/molecules/Stepper.js +63 -18
- package/lib/module/molecules/Stepper.js.map +1 -1
- package/lib/module/molecules/Steps.js +107 -43
- package/lib/module/molecules/Steps.js.map +1 -1
- package/lib/module/molecules/SymmetricGrid.js +26 -18
- package/lib/module/molecules/SymmetricGrid.js.map +1 -1
- package/lib/module/organisms/Alert.js +51 -37
- package/lib/module/organisms/Alert.js.map +1 -1
- package/lib/module/organisms/AlertProvider.js +10 -10
- package/lib/module/organisms/BottomSheet.js +142 -88
- package/lib/module/organisms/BottomSheet.js.map +1 -1
- package/lib/module/organisms/Chart.js +199 -158
- package/lib/module/organisms/Chart.js.map +1 -1
- package/lib/module/organisms/DateField.js +36 -20
- package/lib/module/organisms/DateField.js.map +1 -1
- package/lib/module/organisms/DatePicker.js +56 -33
- package/lib/module/organisms/DatePicker.js.map +1 -1
- package/lib/module/organisms/List.js +62 -34
- package/lib/module/organisms/List.js.map +1 -1
- package/lib/module/organisms/Modal.js +122 -84
- package/lib/module/organisms/Modal.js.map +1 -1
- package/lib/module/organisms/NavigationBar.js +64 -25
- package/lib/module/organisms/NavigationBar.js.map +1 -1
- package/lib/module/organisms/OptionWheel.js +64 -64
- package/lib/module/organisms/OptionWheel.js.map +1 -1
- package/lib/module/organisms/ReorderableList.js +48 -27
- package/lib/module/organisms/ReorderableList.js.map +1 -1
- package/lib/module/organisms/Screen.js +70 -37
- package/lib/module/organisms/Screen.js.map +1 -1
- package/lib/module/organisms/SearchList.js +56 -26
- package/lib/module/organisms/SearchList.js.map +1 -1
- package/lib/module/organisms/Select.js +46 -25
- package/lib/module/organisms/Select.js.map +1 -1
- package/lib/module/organisms/Slides.js +37 -24
- package/lib/module/organisms/Slides.js.map +1 -1
- package/lib/module/organisms/ThemeToggle.js +11 -10
- package/lib/module/organisms/ThemeToggle.js.map +1 -1
- package/lib/module/organisms/Timeline.js +73 -56
- package/lib/module/organisms/Timeline.js.map +1 -1
- package/lib/module/organisms/Toast.js +47 -16
- package/lib/module/organisms/Toast.js.map +1 -1
- package/lib/module/organisms/ToastProvider.js +15 -11
- package/lib/module/organisms/ToastProvider.js.map +1 -1
- package/lib/module/organisms/Wizard.js +41 -16
- package/lib/module/organisms/Wizard.js.map +1 -1
- package/lib/module/organisms/chart/frame.js +25 -25
- package/lib/module/organisms/chart/frame.js.map +1 -1
- package/lib/module/organisms/chart/marks.js +42 -42
- package/lib/module/organisms/chart/math.js +84 -85
- package/lib/module/organisms/chart/math.js.map +1 -1
- package/lib/module/organisms/chart/palette.js +28 -28
- package/lib/module/organisms/imperativeBridge.js +5 -5
- package/lib/module/organisms/imperativeBridge.js.map +1 -1
- package/lib/module/organisms/useSlides.js +53 -21
- package/lib/module/organisms/useSlides.js.map +1 -1
- package/lib/module/safe-area/SafeAreaUIProvider.js +10 -65
- package/lib/module/safe-area/SafeAreaUIProvider.js.map +1 -1
- package/lib/module/safe-area/index.js +1 -0
- package/lib/module/safe-area/index.js.map +1 -1
- package/lib/module/theme/KeyboardAvoidance.js +198 -0
- package/lib/module/theme/KeyboardAvoidance.js.map +1 -0
- package/lib/module/theme/NativeOverlay.js +257 -0
- package/lib/module/theme/NativeOverlay.js.map +1 -0
- package/lib/module/theme/UIProvider.js +88 -35
- package/lib/module/theme/UIProvider.js.map +1 -1
- package/lib/module/theme/colors.js +17 -17
- package/lib/module/theme/colors.js.map +1 -1
- package/lib/module/theme/createStyles.js +20 -16
- package/lib/module/theme/createStyles.js.map +1 -1
- package/lib/module/theme/createTheme.js +6 -6
- package/lib/module/theme/index.js +1 -1
- package/lib/module/theme/index.js.map +1 -1
- package/lib/module/theme/insets.js +1 -1
- package/lib/module/theme/labels.js +29 -1
- package/lib/module/theme/labels.js.map +1 -1
- package/lib/module/theme/palettes.js +25 -23
- package/lib/module/theme/palettes.js.map +1 -1
- package/lib/module/theme/tokens.js +27 -13
- package/lib/module/theme/tokens.js.map +1 -1
- package/lib/module/theme/useKeyboardField.js +33 -0
- package/lib/module/theme/useKeyboardField.js.map +1 -0
- package/lib/module/theme/useReduceMotion.js +28 -0
- package/lib/module/theme/useReduceMotion.js.map +1 -0
- package/lib/typescript/atoms/Avatar.d.ts +35 -5
- package/lib/typescript/atoms/Avatar.d.ts.map +1 -1
- package/lib/typescript/atoms/Badge.d.ts +14 -3
- package/lib/typescript/atoms/Badge.d.ts.map +1 -1
- package/lib/typescript/atoms/Button.d.ts +34 -3
- package/lib/typescript/atoms/Button.d.ts.map +1 -1
- package/lib/typescript/atoms/Card.d.ts +13 -2
- package/lib/typescript/atoms/Card.d.ts.map +1 -1
- package/lib/typescript/atoms/Checkbox.d.ts +26 -1
- package/lib/typescript/atoms/Checkbox.d.ts.map +1 -1
- package/lib/typescript/atoms/Divider.d.ts +18 -1
- package/lib/typescript/atoms/Divider.d.ts.map +1 -1
- package/lib/typescript/atoms/EmptyState.d.ts +30 -3
- package/lib/typescript/atoms/EmptyState.d.ts.map +1 -1
- package/lib/typescript/atoms/Fab.d.ts +24 -4
- package/lib/typescript/atoms/Fab.d.ts.map +1 -1
- package/lib/typescript/atoms/Gradient.d.ts +21 -15
- package/lib/typescript/atoms/Gradient.d.ts.map +1 -1
- package/lib/typescript/atoms/IconButton.d.ts +18 -4
- package/lib/typescript/atoms/IconButton.d.ts.map +1 -1
- package/lib/typescript/atoms/Image.d.ts +39 -17
- package/lib/typescript/atoms/Image.d.ts.map +1 -1
- package/lib/typescript/atoms/Input.d.ts +57 -7
- package/lib/typescript/atoms/Input.d.ts.map +1 -1
- package/lib/typescript/atoms/KeyValueRow.d.ts +16 -4
- package/lib/typescript/atoms/KeyValueRow.d.ts.map +1 -1
- package/lib/typescript/atoms/PressableScale.d.ts +12 -5
- package/lib/typescript/atoms/PressableScale.d.ts.map +1 -1
- package/lib/typescript/atoms/ShinyText.d.ts +17 -17
- package/lib/typescript/atoms/ShinyText.d.ts.map +1 -1
- package/lib/typescript/atoms/Skeleton.d.ts +12 -7
- package/lib/typescript/atoms/Skeleton.d.ts.map +1 -1
- package/lib/typescript/atoms/Spinner.d.ts +29 -1
- package/lib/typescript/atoms/Spinner.d.ts.map +1 -1
- package/lib/typescript/atoms/Text.d.ts +46 -0
- package/lib/typescript/atoms/Text.d.ts.map +1 -1
- package/lib/typescript/atoms/Transition.d.ts +19 -15
- package/lib/typescript/atoms/Transition.d.ts.map +1 -1
- package/lib/typescript/atoms/index.d.ts +3 -3
- package/lib/typescript/atoms/index.d.ts.map +1 -1
- package/lib/typescript/atoms/inputValidation.d.ts +29 -0
- package/lib/typescript/atoms/inputValidation.d.ts.map +1 -0
- package/lib/typescript/icons/Icon.d.ts +4 -4
- package/lib/typescript/icons/defaultIcons.d.ts +19 -2
- package/lib/typescript/icons/defaultIcons.d.ts.map +1 -1
- package/lib/typescript/icons/index.d.ts +2 -2
- package/lib/typescript/icons/index.d.ts.map +1 -1
- package/lib/typescript/icons/types.d.ts +13 -3
- package/lib/typescript/icons/types.d.ts.map +1 -1
- package/lib/typescript/molecules/AvatarHeader.d.ts +23 -4
- package/lib/typescript/molecules/AvatarHeader.d.ts.map +1 -1
- package/lib/typescript/molecules/FormActions.d.ts +21 -4
- package/lib/typescript/molecules/FormActions.d.ts.map +1 -1
- package/lib/typescript/molecules/InfoRow.d.ts +17 -3
- package/lib/typescript/molecules/InfoRow.d.ts.map +1 -1
- package/lib/typescript/molecules/OptionCard.d.ts +20 -5
- package/lib/typescript/molecules/OptionCard.d.ts.map +1 -1
- package/lib/typescript/molecules/SegmentedControl.d.ts +18 -2
- package/lib/typescript/molecules/SegmentedControl.d.ts.map +1 -1
- package/lib/typescript/molecules/Stepper.d.ts +23 -7
- package/lib/typescript/molecules/Stepper.d.ts.map +1 -1
- package/lib/typescript/molecules/Steps.d.ts +18 -4
- package/lib/typescript/molecules/Steps.d.ts.map +1 -1
- package/lib/typescript/molecules/SymmetricGrid.d.ts +15 -5
- package/lib/typescript/molecules/SymmetricGrid.d.ts.map +1 -1
- package/lib/typescript/organisms/Alert.d.ts +28 -2
- package/lib/typescript/organisms/Alert.d.ts.map +1 -1
- package/lib/typescript/organisms/AlertProvider.d.ts +10 -10
- package/lib/typescript/organisms/AlertProvider.d.ts.map +1 -1
- package/lib/typescript/organisms/BottomSheet.d.ts +20 -5
- package/lib/typescript/organisms/BottomSheet.d.ts.map +1 -1
- package/lib/typescript/organisms/Chart.d.ts +86 -75
- package/lib/typescript/organisms/Chart.d.ts.map +1 -1
- package/lib/typescript/organisms/DateField.d.ts +17 -3
- package/lib/typescript/organisms/DateField.d.ts.map +1 -1
- package/lib/typescript/organisms/DatePicker.d.ts +7 -11
- package/lib/typescript/organisms/DatePicker.d.ts.map +1 -1
- package/lib/typescript/organisms/List.d.ts +30 -3
- package/lib/typescript/organisms/List.d.ts.map +1 -1
- package/lib/typescript/organisms/Modal.d.ts +30 -3
- package/lib/typescript/organisms/Modal.d.ts.map +1 -1
- package/lib/typescript/organisms/NavigationBar.d.ts +26 -7
- package/lib/typescript/organisms/NavigationBar.d.ts.map +1 -1
- package/lib/typescript/organisms/OptionWheel.d.ts +20 -16
- package/lib/typescript/organisms/OptionWheel.d.ts.map +1 -1
- package/lib/typescript/organisms/ReorderableList.d.ts +20 -11
- package/lib/typescript/organisms/ReorderableList.d.ts.map +1 -1
- package/lib/typescript/organisms/Screen.d.ts +27 -8
- package/lib/typescript/organisms/Screen.d.ts.map +1 -1
- package/lib/typescript/organisms/SearchList.d.ts +46 -3
- package/lib/typescript/organisms/SearchList.d.ts.map +1 -1
- package/lib/typescript/organisms/Select.d.ts +26 -6
- package/lib/typescript/organisms/Select.d.ts.map +1 -1
- package/lib/typescript/organisms/Slides.d.ts +44 -26
- package/lib/typescript/organisms/Slides.d.ts.map +1 -1
- package/lib/typescript/organisms/ThemeToggle.d.ts +6 -2
- package/lib/typescript/organisms/ThemeToggle.d.ts.map +1 -1
- package/lib/typescript/organisms/Timeline.d.ts +26 -9
- package/lib/typescript/organisms/Timeline.d.ts.map +1 -1
- package/lib/typescript/organisms/Toast.d.ts +19 -4
- package/lib/typescript/organisms/Toast.d.ts.map +1 -1
- package/lib/typescript/organisms/ToastProvider.d.ts +8 -8
- package/lib/typescript/organisms/ToastProvider.d.ts.map +1 -1
- package/lib/typescript/organisms/Wizard.d.ts +24 -6
- package/lib/typescript/organisms/Wizard.d.ts.map +1 -1
- package/lib/typescript/organisms/chart/frame.d.ts +21 -21
- package/lib/typescript/organisms/chart/frame.d.ts.map +1 -1
- package/lib/typescript/organisms/chart/marks.d.ts +28 -28
- package/lib/typescript/organisms/chart/marks.d.ts.map +1 -1
- package/lib/typescript/organisms/chart/math.d.ts +69 -70
- package/lib/typescript/organisms/chart/math.d.ts.map +1 -1
- package/lib/typescript/organisms/chart/palette.d.ts +2 -2
- package/lib/typescript/organisms/chart/palette.d.ts.map +1 -1
- package/lib/typescript/organisms/imperativeBridge.d.ts +4 -4
- package/lib/typescript/organisms/useSlides.d.ts +8 -16
- package/lib/typescript/organisms/useSlides.d.ts.map +1 -1
- package/lib/typescript/safe-area/SafeAreaUIProvider.d.ts +9 -7
- package/lib/typescript/safe-area/SafeAreaUIProvider.d.ts.map +1 -1
- package/lib/typescript/safe-area/index.d.ts.map +1 -1
- package/lib/typescript/theme/KeyboardAvoidance.d.ts +62 -0
- package/lib/typescript/theme/KeyboardAvoidance.d.ts.map +1 -0
- package/lib/typescript/theme/NativeOverlay.d.ts +43 -0
- package/lib/typescript/theme/NativeOverlay.d.ts.map +1 -0
- package/lib/typescript/theme/UIProvider.d.ts +38 -20
- package/lib/typescript/theme/UIProvider.d.ts.map +1 -1
- package/lib/typescript/theme/colors.d.ts +13 -13
- package/lib/typescript/theme/colors.d.ts.map +1 -1
- package/lib/typescript/theme/createStyles.d.ts +20 -14
- package/lib/typescript/theme/createStyles.d.ts.map +1 -1
- package/lib/typescript/theme/createTheme.d.ts +5 -5
- package/lib/typescript/theme/index.d.ts +1 -1
- package/lib/typescript/theme/index.d.ts.map +1 -1
- package/lib/typescript/theme/insets.d.ts +1 -1
- package/lib/typescript/theme/insets.d.ts.map +1 -1
- package/lib/typescript/theme/labels.d.ts +57 -2
- package/lib/typescript/theme/labels.d.ts.map +1 -1
- package/lib/typescript/theme/palettes.d.ts +25 -19
- package/lib/typescript/theme/palettes.d.ts.map +1 -1
- package/lib/typescript/theme/tokens.d.ts +15 -8
- package/lib/typescript/theme/tokens.d.ts.map +1 -1
- package/lib/typescript/theme/types.d.ts +7 -7
- package/lib/typescript/theme/types.d.ts.map +1 -1
- package/lib/typescript/theme/useKeyboardField.d.ts +17 -0
- package/lib/typescript/theme/useKeyboardField.d.ts.map +1 -0
- package/lib/typescript/theme/useReduceMotion.d.ts +7 -0
- package/lib/typescript/theme/useReduceMotion.d.ts.map +1 -0
- package/llms.txt +4 -4
- package/package.json +15 -14
- package/registry/alert-provider.json +4 -3
- package/registry/alert.json +3 -2
- package/registry/avatar-header.json +1 -1
- package/registry/avatar.json +3 -2
- package/registry/badge.json +1 -1
- package/registry/bottom-sheet.json +1 -1
- package/registry/button.json +3 -2
- package/registry/card.json +1 -1
- package/registry/chart.json +5 -5
- package/registry/checkbox.json +3 -2
- package/registry/core.json +31 -15
- package/registry/date-field.json +1 -1
- package/registry/date-picker.json +3 -2
- package/registry/divider.json +1 -1
- package/registry/empty-state.json +4 -2
- package/registry/fab.json +3 -2
- package/registry/form-actions.json +3 -2
- package/registry/gradient.json +1 -1
- package/registry/icon-button.json +3 -2
- package/registry/image.json +1 -1
- package/registry/index.json +79 -61
- package/registry/info-row.json +1 -1
- package/registry/input.json +5 -1
- package/registry/key-value-row.json +1 -1
- package/registry/list.json +3 -1
- package/registry/manifest.json +3 -1
- package/registry/modal.json +1 -1
- package/registry/navigation-bar.json +1 -1
- package/registry/option-card.json +3 -2
- package/registry/option-wheel.json +1 -1
- package/registry/pressable-scale.json +3 -2
- package/registry/reorderable-list.json +1 -1
- package/registry/screen.json +1 -1
- package/registry/search-list.json +7 -1
- package/registry/segmented-control.json +1 -1
- package/registry/select.json +1 -1
- package/registry/shiny-text.json +1 -1
- package/registry/skeleton.json +3 -2
- package/registry/slides.json +2 -2
- package/registry/spinner.json +1 -1
- package/registry/stepper.json +1 -1
- package/registry/steps.json +1 -1
- package/registry/symmetric-grid.json +1 -1
- package/registry/theme-toggle.json +1 -1
- package/registry/timeline.json +1 -1
- package/registry/title.json +1 -1
- package/registry/toast-provider.json +2 -2
- package/registry/toast.json +1 -1
- package/registry/transition.json +1 -1
- package/registry/wizard.json +1 -1
- package/src/atoms/Avatar.tsx +117 -26
- package/src/atoms/Badge.tsx +20 -9
- package/src/atoms/Button.tsx +102 -30
- package/src/atoms/Card.tsx +23 -3
- package/src/atoms/Checkbox.tsx +49 -12
- package/src/atoms/Divider.tsx +34 -4
- package/src/atoms/EmptyState.tsx +63 -16
- package/src/atoms/Fab.tsx +56 -9
- package/src/atoms/Gradient.tsx +92 -41
- package/src/atoms/IconButton.tsx +27 -4
- package/src/atoms/Image.tsx +74 -28
- package/src/atoms/Input.tsx +129 -19
- package/src/atoms/KeyValueRow.tsx +72 -28
- package/src/atoms/PressableScale.tsx +31 -7
- package/src/atoms/ShinyText.tsx +31 -31
- package/src/atoms/Skeleton.tsx +37 -17
- package/src/atoms/Spinner.tsx +87 -24
- package/src/atoms/Text.tsx +66 -6
- package/src/atoms/Transition.tsx +40 -44
- package/src/atoms/index.ts +3 -3
- package/src/atoms/inputValidation.ts +59 -0
- package/src/icons/Icon.tsx +4 -4
- package/src/icons/defaultIcons.tsx +445 -22
- package/src/icons/index.ts +2 -2
- package/src/icons/types.ts +26 -4
- package/src/molecules/AvatarHeader.tsx +88 -34
- package/src/molecules/FormActions.tsx +36 -6
- package/src/molecules/InfoRow.tsx +39 -12
- package/src/molecules/OptionCard.tsx +55 -20
- package/src/molecules/SegmentedControl.tsx +135 -15
- package/src/molecules/Stepper.tsx +73 -19
- package/src/molecules/Steps.tsx +121 -39
- package/src/molecules/SymmetricGrid.tsx +28 -12
- package/src/organisms/Alert.tsx +97 -26
- package/src/organisms/AlertProvider.tsx +13 -13
- package/src/organisms/BottomSheet.tsx +115 -43
- package/src/organisms/Chart.tsx +223 -165
- package/src/organisms/DateField.tsx +40 -15
- package/src/organisms/DatePicker.tsx +53 -32
- package/src/organisms/List.tsx +64 -15
- package/src/organisms/Modal.tsx +122 -63
- package/src/organisms/NavigationBar.tsx +73 -23
- package/src/organisms/OptionWheel.tsx +70 -66
- package/src/organisms/ReorderableList.tsx +49 -27
- package/src/organisms/Screen.tsx +79 -42
- package/src/organisms/SearchList.tsx +84 -20
- package/src/organisms/Select.tsx +63 -29
- package/src/organisms/Slides.tsx +63 -44
- package/src/organisms/ThemeToggle.tsx +15 -6
- package/src/organisms/Timeline.tsx +79 -62
- package/src/organisms/Toast.tsx +50 -15
- package/src/organisms/ToastProvider.tsx +17 -13
- package/src/organisms/Wizard.tsx +58 -21
- package/src/organisms/chart/frame.tsx +35 -35
- package/src/organisms/chart/marks.tsx +53 -53
- package/src/organisms/chart/math.ts +93 -94
- package/src/organisms/chart/palette.ts +28 -28
- package/src/organisms/imperativeBridge.ts +5 -5
- package/src/organisms/useSlides.ts +66 -31
- package/src/safe-area/SafeAreaUIProvider.tsx +9 -70
- package/src/safe-area/index.ts +1 -0
- package/src/theme/KeyboardAvoidance.tsx +216 -0
- package/src/theme/NativeOverlay.tsx +269 -0
- package/src/theme/UIProvider.tsx +109 -46
- package/src/theme/colors.ts +21 -21
- package/src/theme/createStyles.ts +23 -19
- package/src/theme/createTheme.ts +6 -6
- package/src/theme/index.ts +1 -1
- package/src/theme/insets.ts +1 -1
- package/src/theme/labels.ts +85 -2
- package/src/theme/palettes.ts +33 -25
- package/src/theme/tokens.ts +27 -13
- package/src/theme/types.ts +7 -7
- package/src/theme/useKeyboardField.ts +33 -0
- package/src/theme/useReduceMotion.ts +27 -0
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Alert = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
+
var _NativeOverlay = require("../theme/NativeOverlay");
|
|
9
10
|
var _createStyles = require("../theme/createStyles");
|
|
10
11
|
var _UIProvider = require("../theme/UIProvider");
|
|
11
12
|
var _Button = require("../atoms/Button");
|
|
@@ -19,6 +20,12 @@ const ICON_BY_TYPE = {
|
|
|
19
20
|
question: 'question',
|
|
20
21
|
info: 'info'
|
|
21
22
|
};
|
|
23
|
+
|
|
24
|
+
/** Readable line length for a short dialog on tablets too. */
|
|
25
|
+
const DIALOG_MAX_WIDTH = 340;
|
|
26
|
+
const ICON_SIZE = 48;
|
|
27
|
+
/** Above any sibling of the inline host. */
|
|
28
|
+
const INLINE_Z = 9999;
|
|
22
29
|
const useStyles = (0, _createStyles.createStyles)(theme => ({
|
|
23
30
|
overlay: {
|
|
24
31
|
flex: 1,
|
|
@@ -27,53 +34,53 @@ const useStyles = (0, _createStyles.createStyles)(theme => ({
|
|
|
27
34
|
alignItems: 'center',
|
|
28
35
|
padding: theme.tokens.spacing.xl
|
|
29
36
|
},
|
|
30
|
-
|
|
37
|
+
fill: {
|
|
31
38
|
position: 'absolute',
|
|
32
39
|
top: 0,
|
|
33
40
|
left: 0,
|
|
34
41
|
right: 0,
|
|
35
|
-
bottom: 0
|
|
36
|
-
|
|
42
|
+
bottom: 0
|
|
43
|
+
},
|
|
44
|
+
overlayInline: {
|
|
45
|
+
zIndex: INLINE_Z
|
|
37
46
|
},
|
|
38
47
|
container: {
|
|
39
|
-
|
|
48
|
+
// Raised: in dark mode the plain surface sank into the dimmed backdrop.
|
|
49
|
+
backgroundColor: theme.colors.surfaceRaised,
|
|
40
50
|
borderRadius: theme.tokens.radius.xl,
|
|
41
51
|
padding: theme.tokens.spacing.xl,
|
|
42
52
|
width: '100%',
|
|
43
|
-
maxWidth:
|
|
53
|
+
maxWidth: DIALOG_MAX_WIDTH,
|
|
44
54
|
alignItems: 'center',
|
|
45
55
|
...theme.tokens.shadow.md
|
|
46
56
|
},
|
|
47
57
|
iconContainer: {
|
|
48
|
-
marginBottom: theme.tokens.spacing.lg
|
|
58
|
+
marginBottom: theme.tokens.spacing.lg
|
|
49
59
|
},
|
|
50
60
|
title: {
|
|
51
61
|
fontSize: theme.tokens.fontSize.xl,
|
|
62
|
+
lineHeight: theme.tokens.lineHeight.lg,
|
|
52
63
|
fontWeight: theme.tokens.fontWeight.bold,
|
|
53
64
|
color: theme.colors.text,
|
|
54
65
|
textAlign: 'center',
|
|
55
|
-
marginBottom: theme.tokens.spacing.
|
|
66
|
+
marginBottom: theme.tokens.spacing.sm
|
|
56
67
|
},
|
|
57
68
|
message: {
|
|
58
69
|
fontSize: theme.tokens.fontSize.md,
|
|
70
|
+
lineHeight: theme.tokens.lineHeight.md,
|
|
59
71
|
color: theme.colors.textLight,
|
|
60
|
-
textAlign: 'center'
|
|
61
|
-
marginBottom: theme.tokens.spacing.xl,
|
|
62
|
-
lineHeight: theme.tokens.lineHeight.md
|
|
72
|
+
textAlign: 'center'
|
|
63
73
|
},
|
|
64
74
|
buttonContainer: {
|
|
65
75
|
flexDirection: 'row',
|
|
66
76
|
justifyContent: 'center',
|
|
67
|
-
gap: theme.tokens.spacing.sm
|
|
68
|
-
width: '100%'
|
|
77
|
+
gap: theme.tokens.spacing.sm,
|
|
78
|
+
width: '100%',
|
|
79
|
+
marginTop: theme.tokens.spacing.xl
|
|
69
80
|
},
|
|
70
81
|
buttonContainerVertical: {
|
|
71
82
|
flexDirection: 'column'
|
|
72
83
|
},
|
|
73
|
-
button: {
|
|
74
|
-
paddingVertical: theme.tokens.spacing.md - 2,
|
|
75
|
-
paddingHorizontal: theme.tokens.spacing.xl
|
|
76
|
-
},
|
|
77
84
|
buttonHorizontal: {
|
|
78
85
|
flex: 1
|
|
79
86
|
},
|
|
@@ -82,7 +89,7 @@ const useStyles = (0, _createStyles.createStyles)(theme => ({
|
|
|
82
89
|
}
|
|
83
90
|
}));
|
|
84
91
|
|
|
85
|
-
/**
|
|
92
|
+
/** Derives the list of buttons from props, without mutating the `buttons` received through props. */
|
|
86
93
|
function resolveButtons(props, labels) {
|
|
87
94
|
const {
|
|
88
95
|
buttons,
|
|
@@ -90,7 +97,8 @@ function resolveButtons(props, labels) {
|
|
|
90
97
|
cancelText,
|
|
91
98
|
onConfirm,
|
|
92
99
|
onCancel,
|
|
93
|
-
onClose
|
|
100
|
+
onClose,
|
|
101
|
+
destructive
|
|
94
102
|
} = props;
|
|
95
103
|
if (buttons && buttons.length > 0) return buttons;
|
|
96
104
|
if (confirmText || onConfirm) {
|
|
@@ -106,7 +114,7 @@ function resolveButtons(props, labels) {
|
|
|
106
114
|
list.push({
|
|
107
115
|
text: confirmText || labels.confirm,
|
|
108
116
|
onPress: onConfirm,
|
|
109
|
-
variant: 'primary'
|
|
117
|
+
variant: destructive ? 'destructive' : 'primary'
|
|
110
118
|
});
|
|
111
119
|
return list;
|
|
112
120
|
}
|
|
@@ -119,8 +127,17 @@ function resolveButtons(props, labels) {
|
|
|
119
127
|
|
|
120
128
|
/**
|
|
121
129
|
* Alert
|
|
122
|
-
*
|
|
123
|
-
*
|
|
130
|
+
* Declarative dialog component. For imperative use (showing it from a
|
|
131
|
+
* handler without lifting your own state), use AlertProvider + useAlert().
|
|
132
|
+
*
|
|
133
|
+
* Gestalt, figure-ground: the overlay dims everything behind, so the dialog
|
|
134
|
+
* is the only figure. Proximity: icon, title and message sit together and the
|
|
135
|
+
* buttons a larger step below, as the answer block. Von Restorff: only the
|
|
136
|
+
* main action is filled (or red when `destructive`); cancel is outline.
|
|
137
|
+
* Hick: two buttons side by side; three or more stack so each reads alone.
|
|
138
|
+
*
|
|
139
|
+
* Accessibility: the title is a header, the dialog is modal for VoiceOver and
|
|
140
|
+
* the escape gesture (two-finger Z) calls `onClose`.
|
|
124
141
|
*/
|
|
125
142
|
const Alert = exports.Alert = /*#__PURE__*/(0, _react.memo)(props => {
|
|
126
143
|
const {
|
|
@@ -131,13 +148,14 @@ const Alert = exports.Alert = /*#__PURE__*/(0, _react.memo)(props => {
|
|
|
131
148
|
onClose,
|
|
132
149
|
inline = false
|
|
133
150
|
} = props;
|
|
151
|
+
const theme = (0, _UIProvider.useTheme)();
|
|
134
152
|
const colors = (0, _UIProvider.useColors)();
|
|
135
153
|
const styles = useStyles();
|
|
136
154
|
const labels = (0, _UIProvider.useLabels)();
|
|
137
155
|
const allowFontScaling = (0, _UIProvider.useAllowFontScaling)();
|
|
138
156
|
if (!visible) return null;
|
|
139
157
|
const iconColor = {
|
|
140
|
-
//
|
|
158
|
+
// Icons over the dialog's surface: `*Text` role, not the full accent.
|
|
141
159
|
success: colors.successText,
|
|
142
160
|
error: colors.errorText,
|
|
143
161
|
warning: colors.warningText,
|
|
@@ -154,22 +172,24 @@ const Alert = exports.Alert = /*#__PURE__*/(0, _react.memo)(props => {
|
|
|
154
172
|
onPress: onClose,
|
|
155
173
|
accessibilityRole: "none",
|
|
156
174
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
157
|
-
style: [styles.overlay, inline && styles.overlayInline],
|
|
175
|
+
style: [styles.overlay, inline && [styles.fill, styles.overlayInline]],
|
|
158
176
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableWithoutFeedback, {
|
|
159
177
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
160
178
|
style: styles.container,
|
|
161
179
|
accessibilityRole: "alert",
|
|
162
180
|
accessibilityViewIsModal: true,
|
|
181
|
+
onAccessibilityEscape: onClose,
|
|
163
182
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
164
183
|
style: styles.iconContainer,
|
|
165
184
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.Icon, {
|
|
166
185
|
name: ICON_BY_TYPE[type],
|
|
167
|
-
size:
|
|
186
|
+
size: ICON_SIZE,
|
|
168
187
|
color: iconColor[type]
|
|
169
188
|
})
|
|
170
189
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
171
190
|
allowFontScaling: allowFontScaling,
|
|
172
191
|
style: styles.title,
|
|
192
|
+
accessibilityRole: "header",
|
|
173
193
|
children: title
|
|
174
194
|
}), !!message && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
175
195
|
allowFontScaling: allowFontScaling,
|
|
@@ -186,9 +206,9 @@ const Alert = exports.Alert = /*#__PURE__*/(0, _react.memo)(props => {
|
|
|
186
206
|
title: btn.text,
|
|
187
207
|
onPress: btn.onPress || onClose || (() => {}),
|
|
188
208
|
variant: variant,
|
|
189
|
-
style:
|
|
209
|
+
style: vertical ? styles.buttonVertical : styles.buttonHorizontal,
|
|
190
210
|
textStyle: {
|
|
191
|
-
fontSize:
|
|
211
|
+
fontSize: theme.tokens.fontSize.md
|
|
192
212
|
}
|
|
193
213
|
}, index);
|
|
194
214
|
})
|
|
@@ -199,20 +219,14 @@ const Alert = exports.Alert = /*#__PURE__*/(0, _react.memo)(props => {
|
|
|
199
219
|
});
|
|
200
220
|
if (inline) {
|
|
201
221
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
202
|
-
style:
|
|
203
|
-
position: 'absolute',
|
|
204
|
-
top: 0,
|
|
205
|
-
left: 0,
|
|
206
|
-
right: 0,
|
|
207
|
-
bottom: 0
|
|
208
|
-
},
|
|
222
|
+
style: styles.fill,
|
|
209
223
|
pointerEvents: "box-none",
|
|
210
224
|
children: content
|
|
211
225
|
});
|
|
212
226
|
}
|
|
213
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
227
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_NativeOverlay.NativeOverlay, {
|
|
228
|
+
dialog: true,
|
|
214
229
|
transparent: true,
|
|
215
|
-
visible: visible,
|
|
216
230
|
animationType: "fade",
|
|
217
231
|
statusBarTranslucent: true,
|
|
218
232
|
presentationStyle: "overFullScreen",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_createStyles","_UIProvider","_Button","_Icon","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ICON_BY_TYPE","success","error","warning","question","info","useStyles","createStyles","theme","overlay","flex","backgroundColor","colors","justifyContent","alignItems","padding","tokens","spacing","xl","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_NativeOverlay","_createStyles","_UIProvider","_Button","_Icon","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ICON_BY_TYPE","success","error","warning","question","info","DIALOG_MAX_WIDTH","ICON_SIZE","INLINE_Z","useStyles","createStyles","theme","overlay","flex","backgroundColor","colors","justifyContent","alignItems","padding","tokens","spacing","xl","fill","position","top","left","right","bottom","overlayInline","zIndex","container","surfaceRaised","borderRadius","radius","width","maxWidth","shadow","md","iconContainer","marginBottom","lg","title","fontSize","lineHeight","fontWeight","bold","color","text","textAlign","sm","message","textLight","buttonContainer","flexDirection","gap","marginTop","buttonContainerVertical","buttonHorizontal","buttonVertical","resolveButtons","props","labels","buttons","confirmText","cancelText","onConfirm","onCancel","onClose","destructive","length","list","push","cancel","onPress","variant","style","confirm","close","Alert","exports","memo","visible","type","inline","useTheme","useColors","styles","useLabels","allowFontScaling","useAllowFontScaling","iconColor","successText","errorText","warningText","primaryText","secondaryText","effectiveButtons","vertical","content","jsx","TouchableWithoutFeedback","accessibilityRole","children","View","jsxs","accessibilityViewIsModal","onAccessibilityEscape","Icon","name","size","Text","map","btn","index","isCancel","Button","textStyle","pointerEvents","NativeOverlay","dialog","transparent","animationType","statusBarTranslucent","presentationStyle","onRequestClose","displayName"],"sourceRoot":"../../../src","sources":["organisms/Alert.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAAqC,IAAAO,WAAA,GAAAP,OAAA;AAAA,SAAAD,wBAAAS,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,CAAAS,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OA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]}
|
|
@@ -17,15 +17,15 @@ const AlertContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
|
17
17
|
const bridge = (0, _imperativeBridge.createImperativeBridge)('AlertProvider');
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* Opens an alert from outside the React tree —a service, an interceptor—
|
|
21
|
+
* without going through the hook. Without a mounted <AlertProvider> it
|
|
22
|
+
* resolves immediately, so an `await` never hangs.
|
|
23
23
|
*/
|
|
24
24
|
function showAlert(options) {
|
|
25
25
|
return bridge.get()?.alert(options) ?? Promise.resolve();
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
/**
|
|
28
|
+
/** Same as showAlert, but resolves true/false. Without a provider, false. */
|
|
29
29
|
function showConfirm(options) {
|
|
30
30
|
return bridge.get()?.confirm(options) ?? Promise.resolve(false);
|
|
31
31
|
}
|
|
@@ -41,18 +41,18 @@ const HIDDEN = {
|
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* AlertProvider
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* `const ok = await confirm({ title: '
|
|
44
|
+
* Mounts a single imperatively controlled <Alert>. Place it once near the
|
|
45
|
+
* root (inside UIProvider). Async handlers can do
|
|
46
|
+
* `const ok = await confirm({ title: 'Delete', destructive: true })`.
|
|
47
47
|
*/
|
|
48
48
|
function AlertProvider({
|
|
49
49
|
children
|
|
50
50
|
}) {
|
|
51
51
|
const [state, setState] = (0, _react.useState)(HIDDEN);
|
|
52
52
|
const resolverRef = (0, _react.useRef)(null);
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
53
|
+
// If alert()/confirm() are called again while one is already open, the
|
|
54
|
+
// previous request is resolved (not discarded) before showing the new one:
|
|
55
|
+
// this keeps its promise from hanging forever.
|
|
56
56
|
const settlePending = (0, _react.useCallback)(() => {
|
|
57
57
|
resolverRef.current?.(undefined);
|
|
58
58
|
resolverRef.current = null;
|
|
@@ -8,15 +8,21 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _createStyles = require("../theme/createStyles");
|
|
10
10
|
var _UIProvider = require("../theme/UIProvider");
|
|
11
|
+
var _useReduceMotion = require("../theme/useReduceMotion");
|
|
12
|
+
var _KeyboardAvoidance = require("../theme/KeyboardAvoidance");
|
|
13
|
+
var _NativeOverlay = require("../theme/NativeOverlay");
|
|
11
14
|
var _Text = require("../atoms/Text");
|
|
12
15
|
var _IconButton = require("../atoms/IconButton");
|
|
13
16
|
var _Transition = require("../atoms/Transition");
|
|
14
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
18
|
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); }
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
19
|
+
/** Drag distance (pt) that closes the sheet on release. */const DISMISS_DISTANCE = 100;
|
|
20
|
+
/** Downward release speed that closes it even after a short drag (a flick). */
|
|
21
|
+
const DISMISS_VELOCITY = 0.5;
|
|
22
|
+
const HANDLE_WIDTH = 40;
|
|
23
|
+
const HANDLE_HEIGHT = 5;
|
|
24
|
+
const HANDLE_OPACITY = 0.4;
|
|
25
|
+
const CLOSE_ICON_SIZE = 24;
|
|
20
26
|
const useStyles = (0, _createStyles.createStyles)(theme => ({
|
|
21
27
|
container: {
|
|
22
28
|
flex: 1,
|
|
@@ -26,7 +32,8 @@ const useStyles = (0, _createStyles.createStyles)(theme => ({
|
|
|
26
32
|
backgroundColor: theme.colors.overlay
|
|
27
33
|
},
|
|
28
34
|
sheet: {
|
|
29
|
-
|
|
35
|
+
// Raised: in dark mode the plain surface sank into the dimmed backdrop.
|
|
36
|
+
backgroundColor: theme.colors.surfaceRaised,
|
|
30
37
|
borderTopLeftRadius: theme.tokens.radius.xxl,
|
|
31
38
|
borderTopRightRadius: theme.tokens.radius.xxl,
|
|
32
39
|
...theme.tokens.shadow.lg
|
|
@@ -36,10 +43,13 @@ const useStyles = (0, _createStyles.createStyles)(theme => ({
|
|
|
36
43
|
alignItems: 'center'
|
|
37
44
|
},
|
|
38
45
|
handle: {
|
|
39
|
-
width:
|
|
40
|
-
height:
|
|
41
|
-
borderRadius:
|
|
42
|
-
|
|
46
|
+
width: HANDLE_WIDTH,
|
|
47
|
+
height: HANDLE_HEIGHT,
|
|
48
|
+
borderRadius: HANDLE_HEIGHT / 2,
|
|
49
|
+
// textLight, faded: `border` was nearly invisible on a white sheet, and
|
|
50
|
+
// the handle is the only hint that the sheet can be dragged.
|
|
51
|
+
backgroundColor: theme.colors.textLight,
|
|
52
|
+
opacity: HANDLE_OPACITY
|
|
43
53
|
},
|
|
44
54
|
header: {
|
|
45
55
|
flexDirection: 'row',
|
|
@@ -82,10 +92,17 @@ const absoluteFill = {
|
|
|
82
92
|
|
|
83
93
|
/**
|
|
84
94
|
* BottomSheet
|
|
85
|
-
*
|
|
86
|
-
* gesture-handler
|
|
87
|
-
* scroll
|
|
88
|
-
*
|
|
95
|
+
* Sheet that slides in from the bottom, with drag to close (PanResponder, not
|
|
96
|
+
* an external gesture-handler: the library is zero-dependency). Header, footer
|
|
97
|
+
* and scroll are optional, so it covers both the bare sheet and the full
|
|
98
|
+
* form.
|
|
99
|
+
*
|
|
100
|
+
* Gestalt, figure-ground: the backdrop dims the screen, so the sheet is the
|
|
101
|
+
* only figure. Common region: header, content and footer share one panel;
|
|
102
|
+
* the footer's top border separates the actions from the content. Continuity:
|
|
103
|
+
* it slides from the edge it lives on and the drag follows the finger back
|
|
104
|
+
* down; a short flick closes it too. Fitts: content sits in the thumb zone.
|
|
105
|
+
* Reduce Motion: it appears and leaves without sliding.
|
|
89
106
|
*/
|
|
90
107
|
const BottomSheet = exports.BottomSheet = /*#__PURE__*/(0, _react.memo)(({
|
|
91
108
|
visible,
|
|
@@ -97,30 +114,42 @@ const BottomSheet = exports.BottomSheet = /*#__PURE__*/(0, _react.memo)(({
|
|
|
97
114
|
scrollable = true,
|
|
98
115
|
draggable = true,
|
|
99
116
|
maxHeight = 0.9,
|
|
100
|
-
closeAccessibilityLabel
|
|
117
|
+
closeAccessibilityLabel,
|
|
101
118
|
containerStyle,
|
|
102
119
|
contentStyle,
|
|
120
|
+
inline = false,
|
|
103
121
|
testID
|
|
104
122
|
}) => {
|
|
105
123
|
const styles = useStyles();
|
|
106
124
|
const colors = (0, _UIProvider.useColors)();
|
|
125
|
+
const theme = (0, _UIProvider.useTheme)();
|
|
126
|
+
const labels = (0, _UIProvider.useLabels)();
|
|
127
|
+
const reduceMotion = (0, _useReduceMotion.useReduceMotion)();
|
|
128
|
+
const {
|
|
129
|
+
height: screenHeight
|
|
130
|
+
} = (0, _reactNative.useWindowDimensions)();
|
|
131
|
+
const closeLabel = closeAccessibilityLabel ?? labels.close;
|
|
132
|
+
const {
|
|
133
|
+
duration
|
|
134
|
+
} = theme.tokens;
|
|
135
|
+
// The PanResponder is created once: it reads these through refs.
|
|
136
|
+
const screenHeightRef = (0, _react.useRef)(screenHeight);
|
|
137
|
+
screenHeightRef.current = screenHeight;
|
|
138
|
+
const snapBackMs = (0, _react.useRef)(duration.fast);
|
|
139
|
+
snapBackMs.current = reduceMotion ? 0 : duration.fast;
|
|
107
140
|
const ModalSafeAreaBoundary = (0, _UIProvider.useModalSafeAreaBoundary)();
|
|
108
141
|
const [mounted, setMounted] = (0, _react.useState)(visible);
|
|
109
142
|
const [keyboardOpen, setKeyboardOpen] = (0, _react.useState)(false);
|
|
110
143
|
const progress = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
//
|
|
144
|
+
// The PanResponder further down is created only once; reading `onClose`
|
|
145
|
+
// straight from the closure would always give the one from that first
|
|
146
|
+
// render. The ref reflects the latest prop no matter when the closure was created.
|
|
114
147
|
const onCloseRef = (0, _react.useRef)(onClose);
|
|
115
148
|
onCloseRef.current = onClose;
|
|
116
149
|
(0, _react.useEffect)(() => {
|
|
117
|
-
const animation =
|
|
118
|
-
toValue: 1,
|
|
119
|
-
duration:
|
|
120
|
-
useNativeDriver: true
|
|
121
|
-
}) : _reactNative.Animated.timing(progress, {
|
|
122
|
-
toValue: 0,
|
|
123
|
-
duration: 200,
|
|
150
|
+
const animation = _reactNative.Animated.timing(progress, {
|
|
151
|
+
toValue: visible ? 1 : 0,
|
|
152
|
+
duration: reduceMotion ? 0 : visible ? duration.slow : duration.base,
|
|
124
153
|
useNativeDriver: true
|
|
125
154
|
});
|
|
126
155
|
if (visible) setMounted(true);
|
|
@@ -129,11 +158,11 @@ const BottomSheet = exports.BottomSheet = /*#__PURE__*/(0, _react.memo)(({
|
|
|
129
158
|
}) => {
|
|
130
159
|
if (!visible && finished) setMounted(false);
|
|
131
160
|
});
|
|
132
|
-
//
|
|
133
|
-
//
|
|
134
|
-
// `setMounted`
|
|
161
|
+
// If the effect runs again (or the component unmounts) before it
|
|
162
|
+
// finishes, it is cut short: otherwise, a late `finished` could call
|
|
163
|
+
// `setMounted` on an already unmounted component.
|
|
135
164
|
return () => animation.stop();
|
|
136
|
-
}, [visible, progress]);
|
|
165
|
+
}, [visible, progress, reduceMotion, duration.slow, duration.base]);
|
|
137
166
|
(0, _react.useEffect)(() => {
|
|
138
167
|
if (footerPlacement !== 'hide-with-keyboard') return;
|
|
139
168
|
const [show, hide] = _reactNative.Platform.OS === 'ios' ? ['keyboardWillShow', 'keyboardWillHide'] : ['keyboardDidShow', 'keyboardDidHide'];
|
|
@@ -143,15 +172,16 @@ const BottomSheet = exports.BottomSheet = /*#__PURE__*/(0, _react.memo)(({
|
|
|
143
172
|
const panResponder = (0, _react.useRef)(_reactNative.PanResponder.create({
|
|
144
173
|
onMoveShouldSetPanResponder: (_, gesture) => gesture.dy > 5 && Math.abs(gesture.dy) > Math.abs(gesture.dx),
|
|
145
174
|
onPanResponderMove: (_, gesture) => {
|
|
146
|
-
|
|
175
|
+
const h = screenHeightRef.current;
|
|
176
|
+
if (gesture.dy > 0) progress.setValue(1 - Math.min(gesture.dy, h) / h);
|
|
147
177
|
},
|
|
148
178
|
onPanResponderRelease: (_, gesture) => {
|
|
149
|
-
if (gesture.dy >
|
|
179
|
+
if (gesture.dy > DISMISS_DISTANCE || gesture.dy > 0 && gesture.vy > DISMISS_VELOCITY) {
|
|
150
180
|
onCloseRef.current();
|
|
151
181
|
} else {
|
|
152
182
|
_reactNative.Animated.timing(progress, {
|
|
153
183
|
toValue: 1,
|
|
154
|
-
duration:
|
|
184
|
+
duration: snapBackMs.current,
|
|
155
185
|
useNativeDriver: true
|
|
156
186
|
}).start();
|
|
157
187
|
}
|
|
@@ -159,8 +189,8 @@ const BottomSheet = exports.BottomSheet = /*#__PURE__*/(0, _react.memo)(({
|
|
|
159
189
|
})).current;
|
|
160
190
|
if (!mounted) return null;
|
|
161
191
|
|
|
162
|
-
//
|
|
163
|
-
//
|
|
192
|
+
// Percentage, not pixels: it is measured against the container, which is
|
|
193
|
+
// shorter with the keyboard open, so the sheet always fits entirely.
|
|
164
194
|
const resolvedMaxHeight = maxHeight <= 1 ? `${maxHeight * 100}%` : maxHeight;
|
|
165
195
|
const hasHeader = !!title;
|
|
166
196
|
const scrolledFooter = !!footer && footerPlacement === 'scroll' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
@@ -181,61 +211,83 @@ const BottomSheet = exports.BottomSheet = /*#__PURE__*/(0, _react.memo)(({
|
|
|
181
211
|
style: [styles.content, contentStyle],
|
|
182
212
|
children: [children, scrolledFooter]
|
|
183
213
|
});
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.KeyboardAvoidingView, {
|
|
191
|
-
style: styles.container,
|
|
192
|
-
behavior: _reactNative.Platform.OS === 'ios' ? 'padding' : 'height',
|
|
193
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Transition.Transition, {
|
|
194
|
-
value: progress,
|
|
195
|
-
preset: "fade",
|
|
196
|
-
style: [absoluteFill, styles.backdrop],
|
|
197
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
198
|
-
style: absoluteFill,
|
|
199
|
-
onPress: onClose,
|
|
200
|
-
testID: "bottom-sheet-backdrop",
|
|
201
|
-
accessibilityRole: hasHeader ? undefined : 'button',
|
|
202
|
-
accessibilityLabel: hasHeader ? undefined : closeAccessibilityLabel
|
|
203
|
-
})
|
|
204
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(ModalSafeAreaBoundary, {
|
|
205
|
-
children: insets => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Transition.Transition, {
|
|
214
|
+
const tree = /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
215
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_KeyboardAvoidance.KeyboardHandled, {
|
|
216
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.KeyboardAvoidingView, {
|
|
217
|
+
style: styles.container,
|
|
218
|
+
behavior: _reactNative.Platform.OS === 'ios' ? 'padding' : 'height',
|
|
219
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Transition.Transition, {
|
|
206
220
|
value: progress,
|
|
207
|
-
preset: "
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
style: [styles.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
221
|
+
preset: "fade",
|
|
222
|
+
style: [absoluteFill, styles.backdrop],
|
|
223
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
224
|
+
style: absoluteFill,
|
|
225
|
+
onPress: onClose,
|
|
226
|
+
testID: "bottom-sheet-backdrop",
|
|
227
|
+
accessibilityRole: hasHeader ? undefined : 'button',
|
|
228
|
+
accessibilityLabel: hasHeader ? undefined : closeLabel
|
|
229
|
+
})
|
|
230
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(ModalSafeAreaBoundary, {
|
|
231
|
+
children: insets => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Transition.Transition, {
|
|
232
|
+
value: progress,
|
|
233
|
+
preset: "slide-up",
|
|
234
|
+
distance: screenHeight,
|
|
235
|
+
testID: testID,
|
|
236
|
+
style: [styles.sheet, {
|
|
237
|
+
maxHeight: resolvedMaxHeight,
|
|
238
|
+
paddingBottom: Math.max(insets.bottom, theme.tokens.spacing.xl)
|
|
239
|
+
}, containerStyle],
|
|
240
|
+
children: [draggable &&
|
|
241
|
+
/*#__PURE__*/
|
|
242
|
+
// Decorative for screen readers: closing is already exposed by the
|
|
243
|
+
// close button (with a title) or by the backdrop (without one).
|
|
244
|
+
(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
245
|
+
style: styles.handleArea,
|
|
246
|
+
testID: "bottom-sheet-handle",
|
|
247
|
+
accessibilityElementsHidden: true,
|
|
248
|
+
importantForAccessibility: "no-hide-descendants",
|
|
249
|
+
...panResponder.panHandlers,
|
|
250
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
251
|
+
style: styles.handle
|
|
252
|
+
})
|
|
253
|
+
}), hasHeader && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
254
|
+
style: [styles.header, !draggable && styles.headerSpaced],
|
|
255
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.Title, {
|
|
256
|
+
style: styles.title,
|
|
257
|
+
numberOfLines: 1,
|
|
258
|
+
children: title
|
|
259
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.IconButton, {
|
|
260
|
+
iconName: "close",
|
|
261
|
+
size: CLOSE_ICON_SIZE,
|
|
262
|
+
color: colors.text,
|
|
263
|
+
onPress: onClose,
|
|
264
|
+
accessibilityLabel: closeLabel
|
|
265
|
+
})]
|
|
266
|
+
}), body, pinnedFooter]
|
|
267
|
+
})
|
|
268
|
+
})]
|
|
269
|
+
})
|
|
237
270
|
})
|
|
238
271
|
});
|
|
272
|
+
if (inline) {
|
|
273
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
274
|
+
style: absoluteFill,
|
|
275
|
+
pointerEvents: "box-none",
|
|
276
|
+
children: tree
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
return (
|
|
280
|
+
/*#__PURE__*/
|
|
281
|
+
// closing: while the exit animation plays, no other overlay layers into it.
|
|
282
|
+
(0, _jsxRuntime.jsx)(_NativeOverlay.NativeOverlay, {
|
|
283
|
+
closing: !visible,
|
|
284
|
+
transparent: true,
|
|
285
|
+
animationType: "none",
|
|
286
|
+
statusBarTranslucent: true,
|
|
287
|
+
onRequestClose: onClose,
|
|
288
|
+
children: tree
|
|
289
|
+
})
|
|
290
|
+
);
|
|
239
291
|
});
|
|
240
292
|
BottomSheet.displayName = 'BottomSheet';
|
|
241
293
|
//# sourceMappingURL=BottomSheet.js.map
|