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
|
@@ -9,6 +9,7 @@ var _reactNative = require("react-native");
|
|
|
9
9
|
var _colors = require("../theme/colors");
|
|
10
10
|
var _createStyles = require("../theme/createStyles");
|
|
11
11
|
var _UIProvider = require("../theme/UIProvider");
|
|
12
|
+
var _useReduceMotion = require("../theme/useReduceMotion");
|
|
12
13
|
var _SegmentedControl = require("../molecules/SegmentedControl");
|
|
13
14
|
var _marks = require("./chart/marks");
|
|
14
15
|
var _frame = require("./chart/frame");
|
|
@@ -17,26 +18,43 @@ var _math = require("./chart/math");
|
|
|
17
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
19
|
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); }
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
21
|
+
* A filter in the top bar. Chart doesn't filter anything on its own: it shows
|
|
22
|
+
* the control and reports. Whoever has the data decides what "last 7 days"
|
|
23
|
+
* means, and that can't be guessed from here.
|
|
23
24
|
*/
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
/** Background the marks paint "holes" with (donut center, point rings). */
|
|
27
|
+
const ChartSurfaceContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
28
|
+
function useChartSurface() {
|
|
29
|
+
const theme = (0, _UIProvider.useTheme)();
|
|
30
|
+
return (0, _react.useContext)(ChartSurfaceContext) ?? theme.colors.surfaceRaised;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// 'pie' and 'donut' are kept separate even though they share everything: with
|
|
34
|
+
// a single member whose `type` were `'pie' | 'donut'`, TypeScript doesn't drop
|
|
35
|
+
// that member from the union when ruling it out, and the rest of the component
|
|
36
|
+
// stops narrowing.
|
|
28
37
|
|
|
29
38
|
const DEFAULT_HEIGHT = 220;
|
|
30
39
|
const DEFAULT_TICKS = 4;
|
|
31
|
-
/**
|
|
40
|
+
/** Floor of the value-label gutter, on the left. */
|
|
32
41
|
const VALUE_GUTTER = 38;
|
|
33
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Estimated width of a label character. React Native doesn't measure text
|
|
44
|
+
* without rendering it, and measuring to decide the layout would make the
|
|
45
|
+
* chart show up shifted for a frame; at `fontSize.xs` a digit is around
|
|
46
|
+
* 0.6em, and too much is better than too little — extra room, no clipped number.
|
|
47
|
+
*/
|
|
48
|
+
const VALUE_CHAR = 6.5;
|
|
49
|
+
/** Gutter cap: a wide axis can't eat the plot. */
|
|
50
|
+
const VALUE_GUTTER_MAX = 0.3;
|
|
51
|
+
/** Category gutter when they go on the left (horizontal bars). */
|
|
34
52
|
const CATEGORY_GUTTER = 64;
|
|
35
|
-
/**
|
|
53
|
+
/** Gutter for the bottom labels. */
|
|
36
54
|
const BOTTOM_GUTTER = 16;
|
|
37
|
-
/**
|
|
55
|
+
/** Fraction of the band width taken by the bars; the rest is room. */
|
|
38
56
|
const BAND_FILL = 0.7;
|
|
39
|
-
/**
|
|
57
|
+
/** Room around the radar so the axis labels fit. */
|
|
40
58
|
const RADAR_INSET = 26;
|
|
41
59
|
const DIM_OPACITY = 0.3;
|
|
42
60
|
const useStyles = (0, _createStyles.createStyles)(theme => ({
|
|
@@ -78,7 +96,7 @@ const useStyles = (0, _createStyles.createStyles)(theme => ({
|
|
|
78
96
|
}
|
|
79
97
|
}));
|
|
80
98
|
|
|
81
|
-
/**
|
|
99
|
+
/** Controlled or own state, with the same contract in both cases. */
|
|
82
100
|
function useControlled(controlled, fallback) {
|
|
83
101
|
const [own, setOwn] = (0, _react.useState)(fallback);
|
|
84
102
|
const isControlled = controlled !== undefined;
|
|
@@ -86,10 +104,10 @@ function useControlled(controlled, fallback) {
|
|
|
86
104
|
}
|
|
87
105
|
|
|
88
106
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
107
|
+
* Resolves the value axis domain from what the consumer asked for. In
|
|
108
|
+
* 'sticky' the reference lives in a ref: what matters isn't this render's
|
|
109
|
+
* domain but the widest one seen so far, and keeping it in state would fire
|
|
110
|
+
* an extra render for every tick that widens the axis.
|
|
93
111
|
*/
|
|
94
112
|
function useDomain(measured, domain) {
|
|
95
113
|
const widest = (0, _react.useRef)(null);
|
|
@@ -103,19 +121,20 @@ function useDomain(measured, domain) {
|
|
|
103
121
|
|
|
104
122
|
/**
|
|
105
123
|
* Chart
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
124
|
+
* Bars (vertical, horizontal, grouped, stacked), line, area, pie, donut and
|
|
125
|
+
* radar in a single component, because what changes between them is the mark
|
|
126
|
+
* being drawn and not the rest: data, scale, axes, legend, tooltip, selection
|
|
127
|
+
* and filters are the same six mechanisms in all of them.
|
|
110
128
|
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
129
|
+
* It is drawn with `View`: React Native ships no vector canvas and the library
|
|
130
|
+
* can't add one. The three primitives are in `chart/marks.tsx` and the whole
|
|
131
|
+
* geometry, without React, in `chart/math.ts`.
|
|
114
132
|
*
|
|
115
|
-
* Gestalt:
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
133
|
+
* Gestalt: common fate — when you tap a category, everything that isn't it
|
|
134
|
+
* drops to {@link DIM_OPACITY} at once, so what is highlighted reads as a group
|
|
135
|
+
* and not as a loose mark. The legend uses similarity: the same color as the
|
|
136
|
+
* series, which is why it can turn it off without having to explain what it
|
|
137
|
+
* turns off.
|
|
119
138
|
*/
|
|
120
139
|
function Chart(props) {
|
|
121
140
|
const {
|
|
@@ -134,10 +153,11 @@ function Chart(props) {
|
|
|
134
153
|
onSelect,
|
|
135
154
|
tooltip = true,
|
|
136
155
|
formatValue = _math.formatNumber,
|
|
137
|
-
animate = true,
|
|
156
|
+
animate: animateProp = true,
|
|
138
157
|
duration,
|
|
139
158
|
emptyText,
|
|
140
159
|
accessibilityLabel,
|
|
160
|
+
surfaceColor,
|
|
141
161
|
style,
|
|
142
162
|
testID
|
|
143
163
|
} = props;
|
|
@@ -145,6 +165,9 @@ function Chart(props) {
|
|
|
145
165
|
const styles = useStyles();
|
|
146
166
|
const allowFontScaling = (0, _UIProvider.useAllowFontScaling)();
|
|
147
167
|
const uiLabels = (0, _UIProvider.useLabels)();
|
|
168
|
+
// Reduce Motion: the marks appear in their final shape instead of growing.
|
|
169
|
+
const reduceMotion = (0, _useReduceMotion.useReduceMotion)();
|
|
170
|
+
const animate = animateProp && !reduceMotion;
|
|
148
171
|
const [width, setWidth] = (0, _react.useState)(0);
|
|
149
172
|
const [hidden, setHidden, hiddenIsControlled] = useControlled(hiddenKeys, defaultHiddenKeys ?? []);
|
|
150
173
|
const [pick, setPick, selectionIsControlled] = useControlled(selected, null);
|
|
@@ -153,15 +176,15 @@ function Chart(props) {
|
|
|
153
176
|
const decimate = polyline ? props.decimate : false;
|
|
154
177
|
|
|
155
178
|
/**
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
179
|
+
* What gets drawn: the window of `data`, and from that the points that fit.
|
|
180
|
+
* Decimation runs over the whole row, chosen with the first visible series:
|
|
181
|
+
* the series share the x axis, so keeping different indexes per series would
|
|
182
|
+
* break the alignment, the touch layer and the tooltip.
|
|
160
183
|
*/
|
|
161
184
|
const rows = (0, _react.useMemo)(() => {
|
|
162
185
|
const windowed = windowSize && windowSize > 0 ? data.slice(-windowSize) : data;
|
|
163
186
|
if (!polyline || decimate === false || width === 0) return windowed;
|
|
164
|
-
//
|
|
187
|
+
// One point every two pixels: more can't be seen but still has to be paid for.
|
|
165
188
|
const target = typeof decimate === 'number' ? decimate : Math.floor(width / 2);
|
|
166
189
|
if (windowed.length <= target) return windowed;
|
|
167
190
|
const lead = series.find(item => !hidden.includes(item.key))?.key ?? series[0]?.key;
|
|
@@ -172,10 +195,10 @@ function Chart(props) {
|
|
|
172
195
|
const ids = (0, _react.useMemo)(() => rows.map((row, index) => selectBy ? selectBy(row, index) : String(index)), [rows, selectBy]);
|
|
173
196
|
|
|
174
197
|
/**
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
198
|
+
* The selection is stored by `id` and resolved against the current rows:
|
|
199
|
+
* if the datum shifted, the highlight follows it; if it left the window, it
|
|
200
|
+
* disappears. Blindly reusing the index would point at the datum that ended
|
|
201
|
+
* up in that spot, which isn't the one anyone picked.
|
|
179
202
|
*/
|
|
180
203
|
const selection = (0, _react.useMemo)(() => {
|
|
181
204
|
if (!pick) return null;
|
|
@@ -191,8 +214,8 @@ function Chart(props) {
|
|
|
191
214
|
};
|
|
192
215
|
}, [pick, ids, rows, labels]);
|
|
193
216
|
|
|
194
|
-
//
|
|
195
|
-
//
|
|
217
|
+
// In a pie the categories are the rows; in the rest, the columns. The
|
|
218
|
+
// color, the legend and what a tap on it turns off depend on that.
|
|
196
219
|
const palette = (0, _palette.seriesPalette)(theme, Math.max(1, isPie ? rows.length : series.length));
|
|
197
220
|
const entries = (0, _react.useMemo)(() => isPie ? labels.map((label, index) => ({
|
|
198
221
|
key: label,
|
|
@@ -212,9 +235,9 @@ function Chart(props) {
|
|
|
212
235
|
}, [hidden, hiddenIsControlled, setHidden, onHiddenKeysChange]);
|
|
213
236
|
|
|
214
237
|
/**
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
238
|
+
* The plots report what was tapped —row and series— and the whole selection
|
|
239
|
+
* is built here: it is the only place that knows `selectBy`, the labels and
|
|
240
|
+
* the actual rows, so the three don't repeat the building.
|
|
218
241
|
*/
|
|
219
242
|
const applySelection = (0, _react.useCallback)(hit => {
|
|
220
243
|
const row = hit ? rows[hit.index] : undefined;
|
|
@@ -226,9 +249,9 @@ function Chart(props) {
|
|
|
226
249
|
seriesKey: hit.seriesKey,
|
|
227
250
|
value: (0, _math.toNumber)(row[hit.seriesKey]) ?? 0
|
|
228
251
|
} : null;
|
|
229
|
-
//
|
|
230
|
-
//
|
|
231
|
-
//
|
|
252
|
+
// Tapping what is already selected releases it: without that there would
|
|
253
|
+
// be no way back to the whole chart without tapping outside, and
|
|
254
|
+
// "outside" doesn't always exist on a scrolling screen.
|
|
232
255
|
const same = next && selection && next.id === selection.id && next.seriesKey === selection.seriesKey;
|
|
233
256
|
const value = same ? null : next;
|
|
234
257
|
if (!selectionIsControlled) setPick(value);
|
|
@@ -253,77 +276,80 @@ function Chart(props) {
|
|
|
253
276
|
tooltip,
|
|
254
277
|
testID
|
|
255
278
|
};
|
|
256
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
children: filters.
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
279
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ChartSurfaceContext.Provider, {
|
|
280
|
+
value: surfaceColor ?? theme.colors.surfaceRaised,
|
|
281
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
282
|
+
style: [styles.root, style],
|
|
283
|
+
testID: testID,
|
|
284
|
+
accessible: false,
|
|
285
|
+
children: [filters && filters.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
286
|
+
style: styles.filters,
|
|
287
|
+
children: filters.map(filter => /*#__PURE__*/(0, _jsxRuntime.jsx)(_SegmentedControl.SegmentedControl, {
|
|
288
|
+
options: filter.options,
|
|
289
|
+
value: filter.value,
|
|
290
|
+
onChange: filter.onChange,
|
|
291
|
+
testID: testID && `${testID}-filter-${filter.key}`
|
|
292
|
+
}, filter.key))
|
|
293
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
294
|
+
style: [styles.plot, {
|
|
295
|
+
height
|
|
296
|
+
}],
|
|
297
|
+
onLayout: onLayout,
|
|
298
|
+
accessible: true,
|
|
299
|
+
accessibilityRole: "image",
|
|
300
|
+
accessibilityLabel: accessibilityLabel,
|
|
301
|
+
testID: testID && `${testID}-plot`,
|
|
302
|
+
children: [width === 0 || empty ? null : props.type === 'pie' || props.type === 'donut' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(PiePlot, {
|
|
303
|
+
...shared,
|
|
304
|
+
donut: props.type === 'donut',
|
|
305
|
+
innerRadius: props.innerRadius,
|
|
306
|
+
sliceLabels: props.sliceLabels ?? 'percent',
|
|
307
|
+
valueKey: series[0]?.key ?? ''
|
|
308
|
+
}) : props.type === 'radar' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(RadarPlot, {
|
|
309
|
+
...shared,
|
|
310
|
+
domain: props.domain,
|
|
311
|
+
levels: props.levels ?? 4,
|
|
312
|
+
fill: props.fill ?? true,
|
|
313
|
+
thickness: props.thickness ?? 2,
|
|
314
|
+
dots: props.dots ?? true
|
|
315
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(CartesianPlot, {
|
|
316
|
+
...shared,
|
|
317
|
+
type: props.type,
|
|
318
|
+
orientation: props.type === 'bar' ? props.orientation ?? 'vertical' : 'vertical',
|
|
319
|
+
stacked: props.type === 'bar' || props.type === 'area' ? props.stacked ?? false : false,
|
|
320
|
+
barRadius: props.type === 'bar' ? props.barRadius ?? theme.tokens.radius.xs : 0,
|
|
321
|
+
smooth: props.type !== 'bar' ? props.smooth ?? false : false,
|
|
322
|
+
thickness: props.type !== 'bar' ? props.thickness ?? 2 : 0,
|
|
323
|
+
dots: props.type === 'line' ? props.dots ?? true : props.type === 'area' ? props.dots ?? false : false,
|
|
324
|
+
fillOpacity: props.type === 'area' ? props.fillOpacity ?? 0.22 : 0,
|
|
325
|
+
domain: props.domain,
|
|
326
|
+
grid: props.grid ?? true,
|
|
327
|
+
ticks: props.ticks ?? DEFAULT_TICKS,
|
|
328
|
+
xAxis: props.xAxis ?? true,
|
|
329
|
+
yAxis: props.yAxis ?? true
|
|
330
|
+
}), empty ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
331
|
+
style: styles.empty,
|
|
332
|
+
testID: testID && `${testID}-empty`,
|
|
333
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
334
|
+
allowFontScaling: allowFontScaling,
|
|
335
|
+
style: styles.emptyText,
|
|
336
|
+
children: emptyText ?? uiLabels.noResultsTitle
|
|
337
|
+
})
|
|
338
|
+
}) : null]
|
|
339
|
+
}), showLegend ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_frame.Legend, {
|
|
340
|
+
items: entries,
|
|
341
|
+
hidden: hidden,
|
|
342
|
+
onToggle: toggleable ? applyHidden : undefined,
|
|
343
|
+
testID: testID && `${testID}-legend`
|
|
313
344
|
}) : null]
|
|
314
|
-
})
|
|
315
|
-
items: entries,
|
|
316
|
-
hidden: hidden,
|
|
317
|
-
onToggle: toggleable ? applyHidden : undefined,
|
|
318
|
-
testID: testID && `${testID}-legend`
|
|
319
|
-
}) : null]
|
|
345
|
+
})
|
|
320
346
|
});
|
|
321
347
|
}
|
|
322
348
|
Chart.displayName = 'Chart';
|
|
323
349
|
|
|
324
|
-
// ──
|
|
350
|
+
// ── what the three plots share ─────────────────────────────────────────────
|
|
325
351
|
|
|
326
|
-
/**
|
|
352
|
+
/** Tooltip rows for a category on the x axis. */
|
|
327
353
|
function tooltipRowsAt(rows, index, visible, format) {
|
|
328
354
|
const row = rows[index];
|
|
329
355
|
if (!row) return [];
|
|
@@ -338,12 +364,12 @@ function tooltipRowsAt(rows, index, visible, format) {
|
|
|
338
364
|
}).filter(item => item !== null);
|
|
339
365
|
}
|
|
340
366
|
|
|
341
|
-
// ──
|
|
367
|
+
// ── bars, line and area ────────────────────────────────────────────────────
|
|
342
368
|
|
|
343
|
-
/**
|
|
369
|
+
/** Width of one strip of the area fill, in pixels. Thinner = more views. */
|
|
344
370
|
const STRIP_WIDTH = 4;
|
|
345
371
|
const MAX_STRIPS = 140;
|
|
346
|
-
/**
|
|
372
|
+
/** Room between two bars of the same group. */
|
|
347
373
|
const GROUP_GAP = 2;
|
|
348
374
|
const CartesianPlot = /*#__PURE__*/(0, _react.memo)(props => {
|
|
349
375
|
const {
|
|
@@ -374,36 +400,49 @@ const CartesianPlot = /*#__PURE__*/(0, _react.memo)(props => {
|
|
|
374
400
|
yAxis
|
|
375
401
|
} = props;
|
|
376
402
|
const theme = (0, _UIProvider.useTheme)();
|
|
403
|
+
const surface = useChartSurface();
|
|
377
404
|
const horizontal = type === 'bar' && orientation === 'horizontal';
|
|
378
405
|
const keys = (0, _react.useMemo)(() => visible.map(entry => entry.key), [visible]);
|
|
379
|
-
const leftGutter = yAxis ? horizontal ? CATEGORY_GUTTER : VALUE_GUTTER : 0;
|
|
380
406
|
const bottomGutter = xAxis ? BOTTOM_GUTTER : 0;
|
|
381
|
-
const plotW = Math.max(1, width - leftGutter);
|
|
382
|
-
const plotH = Math.max(1, height - bottomGutter);
|
|
383
407
|
|
|
384
|
-
//
|
|
385
|
-
//
|
|
408
|
+
// The line may not touch zero (a temperature, a ranking); a bar does have
|
|
409
|
+
// to, because its length is what states the value.
|
|
386
410
|
const measured = (0, _react.useMemo)(() => (0, _math.extent)(rows, keys, {
|
|
387
411
|
stacked,
|
|
388
412
|
includeZero: type !== 'line'
|
|
389
413
|
}), [rows, keys, stacked, type]);
|
|
390
414
|
const [low, high] = useDomain(measured, domain);
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
415
|
+
|
|
416
|
+
// A hand-set domain is respected as is; a measured one (or 'sticky') is
|
|
417
|
+
// rounded, which is what makes the axis legible.
|
|
418
|
+
const nice = (0, _react.useMemo)(() => Array.isArray(domain) ? (0, _math.exactTicks)(low, high, tickCount) : (0, _math.niceScale)(low, high, tickCount), [domain, low, high, tickCount]);
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* The gutter comes from the longest label, not from a constant: with a
|
|
422
|
+
* custom `formatValue` ("$3000", "1.250 ms") a fixed width clips the number
|
|
423
|
+
* and the axis ends up saying "$30…". The ticks don't depend on the plot's
|
|
424
|
+
* width, so they can be measured before splitting it up.
|
|
425
|
+
*/
|
|
426
|
+
const leftGutter = (0, _react.useMemo)(() => {
|
|
427
|
+
if (!yAxis) return 0;
|
|
428
|
+
if (horizontal) return CATEGORY_GUTTER;
|
|
429
|
+
const longest = nice.values.reduce((widest, value) => Math.max(widest, formatValue(value).length), 0);
|
|
430
|
+
const wanted = Math.ceil(longest * VALUE_CHAR) + theme.tokens.spacing.sm;
|
|
431
|
+
return Math.max(VALUE_GUTTER, Math.min(wanted, Math.floor(width * VALUE_GUTTER_MAX)));
|
|
432
|
+
}, [yAxis, horizontal, nice, formatValue, width, theme.tokens.spacing.sm]);
|
|
433
|
+
const plotW = Math.max(1, width - leftGutter);
|
|
434
|
+
const plotH = Math.max(1, height - bottomGutter);
|
|
435
|
+
const toPixel = (0, _react.useMemo)(() => horizontal ? (0, _math.linearScale)([nice.min, nice.max], [0, plotW]) : (0, _math.linearScale)([nice.min, nice.max], [plotH, 0]), [horizontal, nice, plotW, plotH]);
|
|
436
|
+
const scale = (0, _react.useMemo)(() => ({
|
|
437
|
+
nice,
|
|
438
|
+
toPixel
|
|
439
|
+
}), [nice, toPixel]);
|
|
401
440
|
const band = (horizontal ? plotH : plotW) / Math.max(1, rows.length);
|
|
402
441
|
const centerOf = (0, _react.useCallback)(index => (index + 0.5) * band, [band]);
|
|
403
442
|
const baseline = scale.toPixel((0, _math.clamp)(0, scale.nice.min, scale.nice.max));
|
|
404
443
|
const stacks = (0, _react.useMemo)(() => stacked ? rows.map(row => (0, _math.stackRow)(row, keys)) : null, [stacked, rows, keys]);
|
|
405
444
|
|
|
406
|
-
/**
|
|
445
|
+
/** A series' points: `to` is the value, `from` the floor it is filled from. */
|
|
407
446
|
const pointsFor = (0, _react.useCallback)((key, edge) => {
|
|
408
447
|
const out = [];
|
|
409
448
|
rows.forEach((row, index) => {
|
|
@@ -426,8 +465,8 @@ const CartesianPlot = /*#__PURE__*/(0, _react.memo)(props => {
|
|
|
426
465
|
return out;
|
|
427
466
|
}, [rows, stacks, centerOf, scale, baseline]);
|
|
428
467
|
const pickAt = (0, _react.useCallback)((index, event) => {
|
|
429
|
-
//
|
|
430
|
-
//
|
|
468
|
+
// Which series the finger landed on: the one whose mark is closest to
|
|
469
|
+
// the touch on the value axis. With a single series it is always that one.
|
|
431
470
|
const touch = (horizontal ? event?.nativeEvent?.locationX : event?.nativeEvent?.locationY) ?? 0;
|
|
432
471
|
let bestKey = keys[0] ?? '';
|
|
433
472
|
let bestDistance = Infinity;
|
|
@@ -535,10 +574,10 @@ const CartesianPlot = /*#__PURE__*/(0, _react.memo)(props => {
|
|
|
535
574
|
},
|
|
536
575
|
children: [type === 'area' ?
|
|
537
576
|
/*#__PURE__*/
|
|
538
|
-
//
|
|
539
|
-
//
|
|
540
|
-
//
|
|
541
|
-
//
|
|
577
|
+
// Opacity goes on the group, not on each strip: the half
|
|
578
|
+
// pixel of overlap that hides the antialias seam is
|
|
579
|
+
// composited twice and leaves a vertical stripe every four
|
|
580
|
+
// pixels. Dimming the whole group, it is painted only once.
|
|
542
581
|
(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
543
582
|
pointerEvents: "none",
|
|
544
583
|
style: {
|
|
@@ -575,7 +614,7 @@ const CartesianPlot = /*#__PURE__*/(0, _react.memo)(props => {
|
|
|
575
614
|
}), dots ? raw.map((point, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_marks.Dot, {
|
|
576
615
|
point: point,
|
|
577
616
|
color: entry.color,
|
|
578
|
-
ringColor:
|
|
617
|
+
ringColor: surface,
|
|
579
618
|
size: selection?.index === index ? 8 : 6,
|
|
580
619
|
testID: testID && `${testID}-dot-${entry.key}-${index}`
|
|
581
620
|
}, index)) : null]
|
|
@@ -655,15 +694,15 @@ const CartesianPlot = /*#__PURE__*/(0, _react.memo)(props => {
|
|
|
655
694
|
});
|
|
656
695
|
CartesianPlot.displayName = 'CartesianPlot';
|
|
657
696
|
|
|
658
|
-
// ──
|
|
697
|
+
// ── pie and donut ──────────────────────────────────────────────────────────
|
|
659
698
|
|
|
660
699
|
const DONUT_RADIUS = 0.6;
|
|
661
|
-
/**
|
|
700
|
+
/** How far the selected slice pops out, in pixels. */
|
|
662
701
|
const EXPLODE = 8;
|
|
663
|
-
/**
|
|
702
|
+
/** Where the label falls, as a fraction between the hole and the edge. */
|
|
664
703
|
const LABEL_AT = 0.62;
|
|
665
704
|
|
|
666
|
-
/**
|
|
705
|
+
/** White or black, whichever reads over the color. An odd color doesn't break: it falls back to `text`. */
|
|
667
706
|
function inkOn(background, theme) {
|
|
668
707
|
try {
|
|
669
708
|
return (0, _colors.contrast)(background, theme.colors.white) >= (0, _colors.contrast)(background, theme.colors.black) ? theme.colors.white : theme.colors.black;
|
|
@@ -690,6 +729,7 @@ const PiePlot = /*#__PURE__*/(0, _react.memo)(props => {
|
|
|
690
729
|
valueKey
|
|
691
730
|
} = props;
|
|
692
731
|
const theme = (0, _UIProvider.useTheme)();
|
|
732
|
+
const surface = useChartSurface();
|
|
693
733
|
const styles = useStyles();
|
|
694
734
|
const allowFontScaling = (0, _UIProvider.useAllowFontScaling)();
|
|
695
735
|
const center = {
|
|
@@ -699,8 +739,8 @@ const PiePlot = /*#__PURE__*/(0, _react.memo)(props => {
|
|
|
699
739
|
const radius = Math.max(0, Math.min(width, height) / 2 - 2);
|
|
700
740
|
const hole = (0, _math.clamp)(innerRadius ?? (donut ? DONUT_RADIUS : 0), 0, 0.9) * radius;
|
|
701
741
|
const arcs = (0, _react.useMemo)(() => {
|
|
702
|
-
//
|
|
703
|
-
// 100%,
|
|
742
|
+
// A turned-off category is worth 0: it leaves the pie and the rest share
|
|
743
|
+
// the 100%, which is what whoever turned it off from the legend expects.
|
|
704
744
|
const values = rows.map((row, index) => visible.some(entry => entry.key === labels[index]) ? (0, _math.toNumber)(row[valueKey]) ?? 0 : 0);
|
|
705
745
|
return (0, _math.arcsFor)(values);
|
|
706
746
|
}, [rows, labels, visible, valueKey]);
|
|
@@ -710,8 +750,8 @@ const PiePlot = /*#__PURE__*/(0, _react.memo)(props => {
|
|
|
710
750
|
y: event?.nativeEvent?.locationY ?? 0
|
|
711
751
|
};
|
|
712
752
|
const distance = Math.hypot(point.x - center.x, point.y - center.y);
|
|
713
|
-
//
|
|
714
|
-
//
|
|
753
|
+
// A donut's hole isn't part of any slice, and neither is the area
|
|
754
|
+
// outside the circle: both release the selection.
|
|
715
755
|
if (distance > radius || distance < hole) return onPick(null);
|
|
716
756
|
const index = (0, _math.arcAt)(arcs, (0, _math.angleOf)(center, point));
|
|
717
757
|
if (index === -1) return onPick(null);
|
|
@@ -743,11 +783,11 @@ const PiePlot = /*#__PURE__*/(0, _react.memo)(props => {
|
|
|
743
783
|
width: hole * 2,
|
|
744
784
|
height: hole * 2,
|
|
745
785
|
borderRadius: hole,
|
|
746
|
-
backgroundColor:
|
|
786
|
+
backgroundColor: surface
|
|
747
787
|
}
|
|
748
788
|
}) : null, sliceLabels === 'none' ? null : arcs.map(arc => {
|
|
749
|
-
//
|
|
750
|
-
//
|
|
789
|
+
// A very thin slice has nowhere to write: the label would spill
|
|
790
|
+
// over its neighbors and none would be readable.
|
|
751
791
|
if (arc.sweep < 18) return null;
|
|
752
792
|
const at = (0, _math.polar)(center, hole + (radius - hole) * LABEL_AT, arc.start + arc.sweep / 2);
|
|
753
793
|
const color = entries[arc.index]?.color ?? theme.colors.primary;
|
|
@@ -792,7 +832,7 @@ PiePlot.displayName = 'PiePlot';
|
|
|
792
832
|
|
|
793
833
|
// ── radar ──────────────────────────────────────────────────────────────────
|
|
794
834
|
|
|
795
|
-
/**
|
|
835
|
+
/** Strips per side of the polygon when it is filled. More = cleaner edge, more views. */
|
|
796
836
|
const RADAR_STEPS = 5;
|
|
797
837
|
const RADAR_FILL_OPACITY = 0.18;
|
|
798
838
|
const RADAR_LABEL_WIDTH = 56;
|
|
@@ -815,6 +855,7 @@ const RadarPlot = /*#__PURE__*/(0, _react.memo)(props => {
|
|
|
815
855
|
dots
|
|
816
856
|
} = props;
|
|
817
857
|
const theme = (0, _UIProvider.useTheme)();
|
|
858
|
+
const surface = useChartSurface();
|
|
818
859
|
const styles = useStyles();
|
|
819
860
|
const allowFontScaling = (0, _UIProvider.useAllowFontScaling)();
|
|
820
861
|
const center = {
|
|
@@ -825,8 +866,8 @@ const RadarPlot = /*#__PURE__*/(0, _react.memo)(props => {
|
|
|
825
866
|
const angles = (0, _react.useMemo)(() => (0, _math.radarAngles)(rows.length), [rows.length]);
|
|
826
867
|
const keys = (0, _react.useMemo)(() => visible.map(entry => entry.key), [visible]);
|
|
827
868
|
|
|
828
|
-
//
|
|
829
|
-
//
|
|
869
|
+
// The radar measures from the center, and the center is 0: a minimum other
|
|
870
|
+
// than zero would make two similar values look miles apart.
|
|
830
871
|
const measured = (0, _react.useMemo)(() => [0, (0, _math.extent)(rows, keys, {
|
|
831
872
|
includeZero: true
|
|
832
873
|
})[1]], [rows, keys]);
|
|
@@ -871,11 +912,11 @@ const RadarPlot = /*#__PURE__*/(0, _react.memo)(props => {
|
|
|
871
912
|
},
|
|
872
913
|
children: [fill ?
|
|
873
914
|
/*#__PURE__*/
|
|
874
|
-
//
|
|
875
|
-
//
|
|
876
|
-
//
|
|
877
|
-
//
|
|
878
|
-
//
|
|
915
|
+
// Opacity goes on the group, not on each strip. Per strip, the
|
|
916
|
+
// 0.4° overlap that hides the antialias seam is composited
|
|
917
|
+
// twice and leaves a darker radius at each cut: the fill ends
|
|
918
|
+
// up looking like a spider web. Applied to the group, the strips
|
|
919
|
+
// paint opaque against each other and the whole is dimmed once.
|
|
879
920
|
(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
880
921
|
pointerEvents: "none",
|
|
881
922
|
style: {
|
|
@@ -903,7 +944,7 @@ const RadarPlot = /*#__PURE__*/(0, _react.memo)(props => {
|
|
|
903
944
|
}), dots ? points.map((point, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_marks.Dot, {
|
|
904
945
|
point: point,
|
|
905
946
|
color: entry.color,
|
|
906
|
-
ringColor:
|
|
947
|
+
ringColor: surface,
|
|
907
948
|
size: selection?.index === index ? 8 : 6
|
|
908
949
|
}, index)) : null]
|
|
909
950
|
}, entry.key);
|