orn-ui 0.2.10 → 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 +66 -51
- package/README.md +3 -7
- 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 +174 -154
- 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 +176 -156
- 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 +193 -164
- 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
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Chart geometry and scales: everything that can be tested without mounting a
|
|
3
|
+
* tree lives here, without React and without dependencies. marks.tsx only
|
|
4
|
+
* translates these numbers into styles, and Chart.tsx only decides which mark to draw.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
9
|
-
*
|
|
6
|
+
* Conventions:
|
|
7
|
+
* - React Native coordinates: origin at the top-left, `y` grows downward.
|
|
8
|
+
* - Angles in degrees, 0° at 12 o'clock, increasing clockwise —
|
|
9
|
+
* which is how a pie is read and how `transform: rotate` turns in RN.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
export interface Point {
|
|
@@ -14,10 +14,10 @@ export interface Point {
|
|
|
14
14
|
y: number;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
/**
|
|
17
|
+
/** Data row: an x-axis category and one number per series. */
|
|
18
18
|
export type ChartRow = Record<string, string | number | null | undefined>;
|
|
19
19
|
|
|
20
|
-
/**
|
|
20
|
+
/** Reads a cell as a number, or null if it isn't one (a gap in the series). */
|
|
21
21
|
export function toNumber(value: unknown): number | null {
|
|
22
22
|
return typeof value === 'number' && Number.isFinite(value) ? value : null;
|
|
23
23
|
}
|
|
@@ -26,17 +26,17 @@ export function clamp(value: number, min: number, max: number): number {
|
|
|
26
26
|
return Math.min(max, Math.max(min, value));
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
/**
|
|
29
|
+
/** Kills the floating point noise left by adding `step` in a loop. */
|
|
30
30
|
function tidy(value: number): number {
|
|
31
31
|
return Number(value.toFixed(10));
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
// ──
|
|
34
|
+
// ── scales ─────────────────────────────────────────────────────────────────
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
37
|
+
* The 1, 2, 5 or 10 (times its power of ten) closest above `rough`.
|
|
38
|
+
* It is what makes ticks land on numbers someone would say out loud —
|
|
39
|
+
* 0, 250, 500 — and not on 0, 237, 474.
|
|
40
40
|
*/
|
|
41
41
|
export function niceStep(rough: number): number {
|
|
42
42
|
if (!(rough > 0)) return 1;
|
|
@@ -47,18 +47,18 @@ export function niceStep(rough: number): number {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export interface Ticks {
|
|
50
|
-
/**
|
|
50
|
+
/** Lower end, rounded outward. */
|
|
51
51
|
min: number;
|
|
52
|
-
/**
|
|
52
|
+
/** Upper end, rounded outward. */
|
|
53
53
|
max: number;
|
|
54
54
|
step: number;
|
|
55
55
|
values: number[];
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
59
|
+
* Domain rounded to legible values plus the list of ticks. `count` is an
|
|
60
|
+
* intent, not a promise: rounding outward may give one more or one fewer,
|
|
61
|
+
* and that is preferable to an axis with arbitrary numbers.
|
|
62
62
|
*/
|
|
63
63
|
export function niceScale(min: number, max: number, count = 5): Ticks {
|
|
64
64
|
let lo = Math.min(min, max);
|
|
@@ -68,8 +68,8 @@ export function niceScale(min: number, max: number, count = 5): Ticks {
|
|
|
68
68
|
hi = 1;
|
|
69
69
|
}
|
|
70
70
|
if (lo === hi) {
|
|
71
|
-
//
|
|
72
|
-
//
|
|
71
|
+
// A single value doesn't define a range. A symmetric one is made up so
|
|
72
|
+
// the mark neither sticks to the edge nor fills the whole height.
|
|
73
73
|
const pad = Math.abs(lo) || 1;
|
|
74
74
|
lo -= pad;
|
|
75
75
|
hi += pad;
|
|
@@ -78,17 +78,17 @@ export function niceScale(min: number, max: number, count = 5): Ticks {
|
|
|
78
78
|
const start = Math.floor(lo / step) * step;
|
|
79
79
|
const end = Math.ceil(hi / step) * step;
|
|
80
80
|
const values: number[] = [];
|
|
81
|
-
// `end + step / 2`
|
|
82
|
-
// tick
|
|
81
|
+
// `end + step / 2` instead of `end`: adding step accumulates error and the
|
|
82
|
+
// last tick would be lost precisely in the most used domains (0–100, 0–1).
|
|
83
83
|
for (let value = start; value <= end + step / 2; value += step) values.push(tidy(value));
|
|
84
84
|
return { min: start, max: end, step, values };
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
* Ticks
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
88
|
+
* Ticks for a domain the consumer set by hand. It rounds nothing: if someone
|
|
89
|
+
* asks for 0–100, the axis says 0–100. It is the opposite of `niceScale`, and
|
|
90
|
+
* it is what a live chart needs — an axis that rearranges itself on every tick
|
|
91
|
+
* makes the line jump even though the data hasn't moved.
|
|
92
92
|
*/
|
|
93
93
|
export function exactTicks(min: number, max: number, count = 5): Ticks {
|
|
94
94
|
const lo = Math.min(min, max);
|
|
@@ -105,16 +105,16 @@ export function exactTicks(min: number, max: number, count = 5): Ticks {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
108
|
+
* Merges two domains keeping the widest. It is the 'sticky' mode: the axis
|
|
109
|
+
* grows when a value arrives that didn't fit and never shrinks back, so what
|
|
110
|
+
* you see moving is the data and not the scale.
|
|
111
111
|
*/
|
|
112
112
|
export function growExtent(previous: [number, number] | null, next: [number, number]): [number, number] {
|
|
113
113
|
if (!previous) return next;
|
|
114
114
|
return [Math.min(previous[0], next[0]), Math.max(previous[1], next[1])];
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
/**
|
|
117
|
+
/** Linear domain → range interpolator. A degenerate domain falls to the middle of the range. */
|
|
118
118
|
export function linearScale(domain: [number, number], range: [number, number]): (value: number) => number {
|
|
119
119
|
const [d0, d1] = domain;
|
|
120
120
|
const [r0, r1] = range;
|
|
@@ -124,13 +124,13 @@ export function linearScale(domain: [number, number], range: [number, number]):
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
export interface ExtentOptions {
|
|
127
|
-
/**
|
|
127
|
+
/** The series are summed instead of compared (stacked bars/areas). */
|
|
128
128
|
stacked?: boolean;
|
|
129
|
-
/**
|
|
129
|
+
/** Forces 0 into the domain: without it, a short bar lies. */
|
|
130
130
|
includeZero?: boolean;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
/**
|
|
133
|
+
/** Minimum and maximum of the requested series. With no data it returns [0, 1]. */
|
|
134
134
|
export function extent(rows: ChartRow[], keys: string[], options: ExtentOptions = {}): [number, number] {
|
|
135
135
|
const { stacked = false, includeZero = false } = options;
|
|
136
136
|
let min = Infinity;
|
|
@@ -138,8 +138,8 @@ export function extent(rows: ChartRow[], keys: string[], options: ExtentOptions
|
|
|
138
138
|
|
|
139
139
|
for (const row of rows) {
|
|
140
140
|
if (stacked) {
|
|
141
|
-
//
|
|
142
|
-
//
|
|
141
|
+
// Positives and negatives stack toward opposite sides of zero, so each
|
|
142
|
+
// side has its own total and neither cancels the other.
|
|
143
143
|
let up = 0;
|
|
144
144
|
let down = 0;
|
|
145
145
|
for (const key of keys) {
|
|
@@ -168,21 +168,21 @@ export function extent(rows: ChartRow[], keys: string[], options: ExtentOptions
|
|
|
168
168
|
return [min, max];
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
// ──
|
|
171
|
+
// ── stacking ───────────────────────────────────────────────────────────────
|
|
172
172
|
|
|
173
173
|
export interface StackBand {
|
|
174
174
|
key: string;
|
|
175
|
-
/**
|
|
175
|
+
/** Edge of the band closest to zero. */
|
|
176
176
|
from: number;
|
|
177
|
-
/**
|
|
177
|
+
/** Edge furthest from zero. */
|
|
178
178
|
to: number;
|
|
179
179
|
value: number;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
/**
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
183
|
+
* Stacked bands of a row. Positives grow from 0 upward and negatives from 0
|
|
184
|
+
* downward: a negative series doesn't eat the positives' height, which is
|
|
185
|
+
* what happens if everything is stacked in a single accumulator.
|
|
186
186
|
*/
|
|
187
187
|
export function stackRow(row: ChartRow, keys: string[]): StackBand[] {
|
|
188
188
|
const bands: StackBand[] = [];
|
|
@@ -206,7 +206,7 @@ export function stackRow(row: ChartRow, keys: string[]): StackBand[] {
|
|
|
206
206
|
|
|
207
207
|
const RAD = Math.PI / 180;
|
|
208
208
|
|
|
209
|
-
/**
|
|
209
|
+
/** Point at `radius` from the center at the given angle (0° up, clockwise). */
|
|
210
210
|
export function polar(center: Point, radius: number, angle: number): Point {
|
|
211
211
|
return {
|
|
212
212
|
x: center.x + radius * Math.sin(angle * RAD),
|
|
@@ -214,25 +214,25 @@ export function polar(center: Point, radius: number, angle: number): Point {
|
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
/**
|
|
217
|
+
/** Angle of a point relative to the center, normalized to [0, 360). */
|
|
218
218
|
export function angleOf(center: Point, point: Point): number {
|
|
219
219
|
const degrees = Math.atan2(point.x - center.x, center.y - point.y) / RAD;
|
|
220
220
|
return (degrees + 360) % 360;
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
export interface Arc {
|
|
224
|
-
/**
|
|
224
|
+
/** Index of the row it represents. */
|
|
225
225
|
index: number;
|
|
226
226
|
start: number;
|
|
227
227
|
sweep: number;
|
|
228
228
|
value: number;
|
|
229
|
-
/**
|
|
229
|
+
/** Share of the total, 0–1. */
|
|
230
230
|
ratio: number;
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
/**
|
|
234
|
-
*
|
|
235
|
-
*
|
|
234
|
+
* Arcs of a pie. Negatives don't exist in a pie (there is no "less slice"):
|
|
235
|
+
* they are dropped instead of inverted. Total 0 ⇒ nothing to draw.
|
|
236
236
|
*/
|
|
237
237
|
export function arcsFor(values: number[]): Arc[] {
|
|
238
238
|
const safe = values.map((value) => (Number.isFinite(value) && value > 0 ? value : 0));
|
|
@@ -250,7 +250,7 @@ export function arcsFor(values: number[]): Arc[] {
|
|
|
250
250
|
return arcs;
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
/**
|
|
253
|
+
/** The arc containing that angle, or -1. */
|
|
254
254
|
export function arcAt(arcs: Arc[], angle: number): number {
|
|
255
255
|
const normalized = (angle + 360) % 360;
|
|
256
256
|
for (const arc of arcs) {
|
|
@@ -259,26 +259,26 @@ export function arcAt(arcs: Arc[], angle: number): number {
|
|
|
259
259
|
return -1;
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
/**
|
|
262
|
+
/** Angles of a radar's axes: the first at the top, the rest evenly spread. */
|
|
263
263
|
export function radarAngles(count: number): number[] {
|
|
264
264
|
if (count <= 0) return [];
|
|
265
265
|
return Array.from({ length: count }, (_, index) => (index * 360) / count);
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
// ──
|
|
268
|
+
// ── segments and curves ────────────────────────────────────────────────────
|
|
269
269
|
|
|
270
270
|
export interface SegmentBox {
|
|
271
271
|
left: number;
|
|
272
272
|
top: number;
|
|
273
273
|
width: number;
|
|
274
274
|
height: number;
|
|
275
|
-
/**
|
|
275
|
+
/** Degrees for `transform: [{ rotate }]`. */
|
|
276
276
|
rotate: number;
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
/**
|
|
280
|
-
*
|
|
281
|
-
*
|
|
280
|
+
* Box of a segment a→b: without SVG, a line is a thin rectangle rotated
|
|
281
|
+
* around its center. Width = distance, height = thickness, rotation = the slope.
|
|
282
282
|
*/
|
|
283
283
|
export function segmentBox(a: Point, b: Point, thickness: number): SegmentBox {
|
|
284
284
|
const dx = b.x - a.x;
|
|
@@ -294,17 +294,17 @@ export function segmentBox(a: Point, b: Point, thickness: number): SegmentBox {
|
|
|
294
294
|
}
|
|
295
295
|
|
|
296
296
|
/**
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
297
|
+
* Smooths a polyline with Catmull-Rom sampled in `steps` segments per span.
|
|
298
|
+
* The curve passes through all the original points (unlike a free-control
|
|
299
|
+
* Bézier), so the data is still the data; only path is added in between, and
|
|
300
|
+
* the result is drawn with the same straight segments.
|
|
301
301
|
*/
|
|
302
302
|
export function smoothPoints(points: Point[], steps = 8): Point[] {
|
|
303
303
|
if (points.length < 3 || steps < 2) return points;
|
|
304
304
|
const out: Point[] = [points[0]!];
|
|
305
305
|
for (let i = 0; i < points.length - 1; i += 1) {
|
|
306
|
-
//
|
|
307
|
-
//
|
|
306
|
+
// The endpoints are duplicated so the first and last spans have the
|
|
307
|
+
// four references the spline asks for.
|
|
308
308
|
const p0 = points[i - 1] ?? points[i]!;
|
|
309
309
|
const p1 = points[i]!;
|
|
310
310
|
const p2 = points[i + 1]!;
|
|
@@ -323,8 +323,8 @@ export function smoothPoints(points: Point[], steps = 8): Point[] {
|
|
|
323
323
|
}
|
|
324
324
|
|
|
325
325
|
/**
|
|
326
|
-
* `y`
|
|
327
|
-
*
|
|
326
|
+
* The polyline's `y` at that `x`, or null if it falls outside. It is what
|
|
327
|
+
* turns a line into an area: each vertical strip asks for its height here.
|
|
328
328
|
*/
|
|
329
329
|
export function sampleY(points: Point[], x: number): number | null {
|
|
330
330
|
if (points.length === 0) return null;
|
|
@@ -340,14 +340,14 @@ export function sampleY(points: Point[], x: number): number | null {
|
|
|
340
340
|
return null;
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
-
// ──
|
|
343
|
+
// ── formatting ─────────────────────────────────────────────────────────────
|
|
344
344
|
|
|
345
345
|
const UNITS = ['', 'k', 'M', 'B'];
|
|
346
346
|
|
|
347
347
|
/**
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
348
|
+
* Default format for axes and tooltip: compact, because the axis of a 320px
|
|
349
|
+
* chart has no room for "1250000". The consumer replaces it entirely with
|
|
350
|
+
* `formatValue`.
|
|
351
351
|
*/
|
|
352
352
|
export function formatNumber(value: number): string {
|
|
353
353
|
if (!Number.isFinite(value)) return '';
|
|
@@ -369,12 +369,12 @@ export interface FanStrip {
|
|
|
369
369
|
}
|
|
370
370
|
|
|
371
371
|
/**
|
|
372
|
-
*
|
|
373
|
-
*
|
|
372
|
+
* Breaks a polygon around a center into angular slices: it is what lets a
|
|
373
|
+
* radar be filled with the same primitive that draws a pie.
|
|
374
374
|
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
375
|
+
* The cut goes along the polygon's side (parameter `t`), not by angle: the
|
|
376
|
+
* radius of a chord isn't linear in the angle, and cutting by angle would
|
|
377
|
+
* round off the vertices exactly where the data says there should be a point.
|
|
378
378
|
*/
|
|
379
379
|
export function fanStrips(center: Point, points: Point[], steps = 6): FanStrip[] {
|
|
380
380
|
if (points.length < 3 || steps < 1) return [];
|
|
@@ -390,14 +390,14 @@ export function fanStrips(center: Point, points: Point[], steps = 6): FanStrip[]
|
|
|
390
390
|
const t = s / steps;
|
|
391
391
|
const point = { x: a.x + (b.x - a.x) * t, y: a.y + (b.y - a.y) * t };
|
|
392
392
|
const angle = angleOf(center, point);
|
|
393
|
-
//
|
|
394
|
-
//
|
|
393
|
+
// The jump from 360 to 0 falls somewhere along the path: without this,
|
|
394
|
+
// that slice would be drawn turning backwards and cover everything else.
|
|
395
395
|
let sweep = angle - previousAngle;
|
|
396
396
|
if (sweep < 0) sweep += 360;
|
|
397
397
|
if (sweep > 0) {
|
|
398
398
|
const radius = (Math.hypot(previous.x - center.x, previous.y - center.y) + Math.hypot(point.x - center.x, point.y - center.y)) / 2;
|
|
399
|
-
//
|
|
400
|
-
// antialias
|
|
399
|
+
// The slices overlap a hair on purpose: without the overlap, the
|
|
400
|
+
// antialias leaves a light seam between strips.
|
|
401
401
|
strips.push({ start: previousAngle, sweep: sweep + 0.4, radius });
|
|
402
402
|
}
|
|
403
403
|
previous = point;
|
|
@@ -407,23 +407,22 @@ export function fanStrips(center: Point, points: Point[], steps = 6): FanStrip[]
|
|
|
407
407
|
return strips;
|
|
408
408
|
}
|
|
409
409
|
|
|
410
|
-
// ──
|
|
410
|
+
// ── decimation ─────────────────────────────────────────────────────────────
|
|
411
411
|
|
|
412
412
|
/**
|
|
413
|
-
* LTTB (Largest-Triangle-Three-Buckets):
|
|
414
|
-
*
|
|
415
|
-
*
|
|
416
|
-
*
|
|
413
|
+
* LTTB (Largest-Triangle-Three-Buckets): picks `threshold` points from
|
|
414
|
+
* `values` while keeping the shape of the curve. Returns indexes, not points,
|
|
415
|
+
* so the caller can keep the whole row —all its series— and not only the one
|
|
416
|
+
* used to decide.
|
|
417
417
|
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
*
|
|
418
|
+
* Why not sample every N: every N eats the peaks, which are exactly what
|
|
419
|
+
* someone looks at in a time series. LTTB splits the path into buckets and
|
|
420
|
+
* from each one keeps the point that forms the largest triangle with the one
|
|
421
|
+
* already picked and with the average of the next bucket — that is, the one
|
|
422
|
+
* that changes the silhouette the most. First and last are always kept.
|
|
423
423
|
*
|
|
424
|
-
* `x`
|
|
425
|
-
*
|
|
426
|
-
* índice.
|
|
424
|
+
* `x` is the index: a chart's categories are spread evenly along the axis, so
|
|
425
|
+
* the horizontal distance between two points is their index distance.
|
|
427
426
|
*/
|
|
428
427
|
export function lttbIndices(values: (number | null)[], threshold: number): number[] {
|
|
429
428
|
const total = values.length;
|
|
@@ -431,16 +430,16 @@ export function lttbIndices(values: (number | null)[], threshold: number): numbe
|
|
|
431
430
|
|
|
432
431
|
const at = (index: number) => values[index] ?? 0;
|
|
433
432
|
const selected = [0];
|
|
434
|
-
//
|
|
435
|
-
// `threshold < total`
|
|
436
|
-
//
|
|
433
|
+
// One bucket per intermediate point: the first and the last aren't drawn.
|
|
434
|
+
// With `threshold < total` a bucket spans more than one point, so none is
|
|
435
|
+
// empty and exactly `threshold` indexes come out, with no repeats.
|
|
437
436
|
const every = (total - 2) / (threshold - 2);
|
|
438
437
|
let previous = 0;
|
|
439
438
|
|
|
440
439
|
for (let bucket = 0; bucket < threshold - 2; bucket += 1) {
|
|
441
|
-
//
|
|
442
|
-
//
|
|
443
|
-
//
|
|
440
|
+
// Average of the *next* bucket: the triangle's third vertex. It is
|
|
441
|
+
// offset one bucket from the candidates, and that offset is the
|
|
442
|
+
// algorithm — comparing against the bucket itself doesn't look ahead.
|
|
444
443
|
const avgStart = Math.floor((bucket + 1) * every) + 1;
|
|
445
444
|
const avgEnd = Math.min(Math.floor((bucket + 2) * every) + 1, total);
|
|
446
445
|
let avgX = 0;
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Chart's categorical palette, derived from the theme.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
4
|
+
* There is deliberately no list of colors here: if there were, a custom
|
|
5
|
+
* `brand` would produce a chart that doesn't look like the rest of the app,
|
|
6
|
+
* and dark mode would have to be maintained by hand. The first series reuse
|
|
7
|
+
* the theme's accents (which already come with contrast resolved for their
|
|
8
|
+
* scheme) and, when they run out, the primary's hue keeps rotating by the
|
|
9
|
+
* golden angle: the 137.5° sequence is the one that takes longest to repeat
|
|
10
|
+
* a similar hue, which is exactly what you ask of a categorical palette.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* Each color is checked against `surface` at 3:1 — the WCAG 1.4.11 minimum
|
|
13
|
+
* for graphical objects, which is what a bar is — and lightened or darkened
|
|
14
|
+
* until it meets it.
|
|
15
15
|
*/
|
|
16
16
|
import { contrast, toHex, toHsl } from '../../theme/colors';
|
|
17
17
|
import type { Theme } from '../../theme/types';
|
|
18
18
|
|
|
19
|
-
/**
|
|
19
|
+
/** Minimum contrast of a graphical object against its background (WCAG 1.4.11). */
|
|
20
20
|
export const GRAPHIC_CONTRAST = 3;
|
|
21
21
|
|
|
22
22
|
const GOLDEN_ANGLE = 137.508;
|
|
23
23
|
|
|
24
|
-
/**
|
|
24
|
+
/** Theme accents in order of appearance: hues well apart from one another. */
|
|
25
25
|
function seeds(theme: Theme): string[] {
|
|
26
26
|
const { primary, secondary, warning, success, error } = theme.colors;
|
|
27
27
|
return [primary, secondary, warning, success, error];
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* Pushes the lightness until it stands off the background. The step is small
|
|
32
|
+
* and the cap low because the goal is to correct a color, not invent another:
|
|
33
|
+
* if it didn't get there in 12 tries, the best achieved is returned.
|
|
34
34
|
*/
|
|
35
35
|
function readable(hex: string, surface: string): string {
|
|
36
36
|
if (contrast(hex, surface) >= GRAPHIC_CONTRAST) return hex;
|
|
37
37
|
|
|
38
38
|
const hsl = toHsl(hex);
|
|
39
|
-
//
|
|
39
|
+
// Over a light background you have to darken, over a dark one lighten.
|
|
40
40
|
const direction = toHsl(surface).l > 0.5 ? -1 : 1;
|
|
41
41
|
let best = hex;
|
|
42
42
|
let bestContrast = contrast(hex, surface);
|
|
@@ -63,9 +63,9 @@ function buildUnsafe(theme: Theme, count: number): string[] {
|
|
|
63
63
|
out.push(readable(base[index]!, surface));
|
|
64
64
|
continue;
|
|
65
65
|
}
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
//
|
|
66
|
+
// Once past the accents, the primary's hue is rotated. `l` alternates one
|
|
67
|
+
// step per turn so two neighboring hues aren't confused if the rotation
|
|
68
|
+
// brings them close.
|
|
69
69
|
const seed = toHsl(base[0]!);
|
|
70
70
|
const turn = index - base.length + 1;
|
|
71
71
|
out.push(
|
|
@@ -83,10 +83,10 @@ function buildUnsafe(theme: Theme, count: number): string[] {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
86
|
+
* The color helpers speak hex. A theme with an accent in `rgba()` is legal
|
|
87
|
+
* for React Native and makes `toHsl` throw: in that case it falls back to the
|
|
88
|
+
* accents as they came, cycling. A chart with repeated colors is worse than
|
|
89
|
+
* one with derived colors, but far better than one that doesn't render.
|
|
90
90
|
*/
|
|
91
91
|
function build(theme: Theme, count: number): string[] {
|
|
92
92
|
try {
|
|
@@ -97,12 +97,12 @@ function build(theme: Theme, count: number): string[] {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
//
|
|
101
|
-
//
|
|
102
|
-
// (
|
|
100
|
+
// One palette per theme, and per theme the longest array requested so far:
|
|
101
|
+
// the cache is shared among all mounted charts, which is the normal case
|
|
102
|
+
// (a dashboard with six charts on the same theme).
|
|
103
103
|
const cache = new WeakMap<Theme, string[]>();
|
|
104
104
|
|
|
105
|
-
/** `count`
|
|
105
|
+
/** `count` stable colors for the series: the same index always gives the same color. */
|
|
106
106
|
export function seriesPalette(theme: Theme, count: number): string[] {
|
|
107
107
|
const cached = cache.get(theme);
|
|
108
108
|
if (cached && cached.length >= count) return cached.slice(0, count);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* (
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Bridge between the mounted provider and code that isn't a component
|
|
3
|
+
* (services, API layer, interceptors). The provider registers itself on mount
|
|
4
|
+
* and clears itself on unmount, so outside the tree there is never a live
|
|
5
|
+
* reference left to a dead context.
|
|
6
6
|
*/
|
|
7
7
|
export interface ImperativeBridge<T> {
|
|
8
8
|
set: (value: T | null) => void;
|
|
@@ -19,7 +19,7 @@ export function createImperativeBridge<T>(providerName: string): ImperativeBridg
|
|
|
19
19
|
get: () => {
|
|
20
20
|
if (!current && __DEV__) {
|
|
21
21
|
console.warn(
|
|
22
|
-
`orn-ui:
|
|
22
|
+
`orn-ui: the imperative API was called without a mounted <${providerName}>. The call was ignored.`
|
|
23
23
|
);
|
|
24
24
|
}
|
|
25
25
|
return current;
|