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
package/src/theme/createTheme.ts
CHANGED
|
@@ -26,7 +26,7 @@ function mergeDeep<T extends Record<string, any>>(base: T, patch?: Partial<T>):
|
|
|
26
26
|
|
|
27
27
|
const capitalize = <T extends string>(name: T) => (name.charAt(0).toUpperCase() + name.slice(1)) as Capitalize<T>;
|
|
28
28
|
|
|
29
|
-
/**
|
|
29
|
+
/** Expands each `brand` hex into the accent's four roles in a scheme. */
|
|
30
30
|
function brandColors(
|
|
31
31
|
brand: ThemeOverrides['brand'],
|
|
32
32
|
scheme: 'light' | 'dark',
|
|
@@ -49,12 +49,12 @@ function brandColors(
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
52
|
+
* Builds the light/dark theme pair consumed by <UIProvider theme={...}>.
|
|
53
|
+
* Never mutates the defaults: each call produces new objects, safe to share
|
|
54
|
+
* between different providers (tests, multi-brand in the same tree).
|
|
55
55
|
*
|
|
56
|
-
* `brand`
|
|
57
|
-
*
|
|
56
|
+
* `brand` is applied before `colors`, so a hand-written role always wins
|
|
57
|
+
* over the derived one.
|
|
58
58
|
*/
|
|
59
59
|
export function createTheme(overrides?: ThemeOverrides): ThemePair {
|
|
60
60
|
const tokens = mergeDeep(defaultTokens, overrides?.tokens as any);
|
package/src/theme/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { spacing, radius, fontSize, fontWeight, lineHeight, duration, shadow, tokens } from './tokens';
|
|
1
|
+
export { spacing, radius, fontSize, fontWeight, lineHeight, letterSpacing, duration, shadow, tokens } from './tokens';
|
|
2
2
|
export type { Tokens } from './tokens';
|
|
3
3
|
export { lightPalette, darkPalette } from './palettes';
|
|
4
4
|
export type { ThemeColors } from './palettes';
|
package/src/theme/insets.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Structurally identical to react-native-safe-area-context's EdgeInsets, without depending on the package. */
|
|
2
2
|
export interface EdgeInsets {
|
|
3
3
|
top: number;
|
|
4
4
|
right: number;
|
package/src/theme/labels.ts
CHANGED
|
@@ -8,12 +8,67 @@ export interface Labels {
|
|
|
8
8
|
noResultsDescription: string;
|
|
9
9
|
search: string;
|
|
10
10
|
selectPlaceholder: string;
|
|
11
|
-
/**
|
|
11
|
+
/** Month names, January to December. */
|
|
12
12
|
months: string[];
|
|
13
|
-
/**
|
|
13
|
+
/** Weekday initials, index 0 = Sunday (matches `Date.getDay()`). */
|
|
14
14
|
weekdaysShort: string[];
|
|
15
15
|
selectDate: string;
|
|
16
16
|
clear: string;
|
|
17
|
+
/** Eye button in Input with `isPassword`. */
|
|
18
|
+
showPassword: string;
|
|
19
|
+
hidePassword: string;
|
|
20
|
+
/** Appended to the accessible name of a `required` field (the asterisk is visual only). */
|
|
21
|
+
required: string;
|
|
22
|
+
/** Input validation: shown when a `required` field is empty. */
|
|
23
|
+
requiredError: string;
|
|
24
|
+
/** Input validation, `rules.minLength`. `{n}` is replaced by the limit. */
|
|
25
|
+
minLengthError: string;
|
|
26
|
+
/** Input validation, `rules.maxLength`. `{n}` is replaced by the limit. */
|
|
27
|
+
maxLengthError: string;
|
|
28
|
+
/** Input validation, `rules.pattern`. */
|
|
29
|
+
patternError: string;
|
|
30
|
+
/** Stepper: accessible name of the numeric field. */
|
|
31
|
+
quantity: string;
|
|
32
|
+
/** Stepper: "+" button. */
|
|
33
|
+
increment: string;
|
|
34
|
+
/** Stepper: "-" button. */
|
|
35
|
+
decrement: string;
|
|
36
|
+
/** Steps: accessible name of a step. `{n}`, `{total}` and `{label}` are replaced. */
|
|
37
|
+
stepOf: string;
|
|
38
|
+
/** Steps: state of a step already done. */
|
|
39
|
+
stepCompleted: string;
|
|
40
|
+
/** Steps: state of the step in progress. */
|
|
41
|
+
stepCurrent: string;
|
|
42
|
+
/** Steps: state of a step not reached yet. */
|
|
43
|
+
stepPending: string;
|
|
44
|
+
/** DatePicker: button to the previous month. */
|
|
45
|
+
previousMonth: string;
|
|
46
|
+
/** DatePicker: button to the next month. */
|
|
47
|
+
nextMonth: string;
|
|
48
|
+
/** ReorderableList: screen-reader action that moves a row one place up. */
|
|
49
|
+
moveUp: string;
|
|
50
|
+
/** ReorderableList: screen-reader action that moves a row one place down. */
|
|
51
|
+
moveDown: string;
|
|
52
|
+
/** SearchList: accessible name of the scan button. */
|
|
53
|
+
scan: string;
|
|
54
|
+
/** Slides: indicator name. `{n}` and `{total}` are replaced. */
|
|
55
|
+
slideOf: string;
|
|
56
|
+
/** Slides: button that pauses autoPlay. */
|
|
57
|
+
pauseSlides: string;
|
|
58
|
+
/** Slides: button that resumes autoPlay. */
|
|
59
|
+
resumeSlides: string;
|
|
60
|
+
/** ThemeToggle: segment that follows the system appearance. */
|
|
61
|
+
themeSystem: string;
|
|
62
|
+
/** ThemeToggle: light segment. */
|
|
63
|
+
themeLight: string;
|
|
64
|
+
/** ThemeToggle: dark segment. */
|
|
65
|
+
themeDark: string;
|
|
66
|
+
/** Wizard: button to the previous step. */
|
|
67
|
+
back: string;
|
|
68
|
+
/** Wizard: button to the next step. */
|
|
69
|
+
next: string;
|
|
70
|
+
/** Wizard: next button on the last step. */
|
|
71
|
+
finish: string;
|
|
17
72
|
}
|
|
18
73
|
|
|
19
74
|
export const defaultLabels: Labels = {
|
|
@@ -33,4 +88,32 @@ export const defaultLabels: Labels = {
|
|
|
33
88
|
weekdaysShort: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
|
|
34
89
|
selectDate: 'Select date',
|
|
35
90
|
clear: 'Clear',
|
|
91
|
+
showPassword: 'Show password',
|
|
92
|
+
hidePassword: 'Hide password',
|
|
93
|
+
required: 'required',
|
|
94
|
+
requiredError: 'This field is required',
|
|
95
|
+
minLengthError: 'Enter at least {n} characters',
|
|
96
|
+
maxLengthError: 'Enter at most {n} characters',
|
|
97
|
+
patternError: 'Invalid format',
|
|
98
|
+
quantity: 'Quantity',
|
|
99
|
+
increment: 'Increment',
|
|
100
|
+
decrement: 'Decrement',
|
|
101
|
+
stepOf: 'Step {n} of {total}: {label}',
|
|
102
|
+
stepCompleted: 'completed',
|
|
103
|
+
stepCurrent: 'current',
|
|
104
|
+
stepPending: 'pending',
|
|
105
|
+
previousMonth: 'Previous month',
|
|
106
|
+
nextMonth: 'Next month',
|
|
107
|
+
moveUp: 'Move up',
|
|
108
|
+
moveDown: 'Move down',
|
|
109
|
+
scan: 'Scan',
|
|
110
|
+
slideOf: 'Slide {n} of {total}',
|
|
111
|
+
pauseSlides: 'Pause automatic slides',
|
|
112
|
+
resumeSlides: 'Resume automatic slides',
|
|
113
|
+
themeSystem: 'Auto',
|
|
114
|
+
themeLight: 'Light',
|
|
115
|
+
themeDark: 'Dark',
|
|
116
|
+
back: 'Back',
|
|
117
|
+
next: 'Next',
|
|
118
|
+
finish: 'Finish',
|
|
36
119
|
};
|
package/src/theme/palettes.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Each color is a `string`, not a literal (`as const`): light and dark have
|
|
3
|
+
* different values for the same key, and createTheme() must be able to
|
|
4
|
+
* accept any hex/rgba in the overrides — literal typing would prevent it.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* Each accent comes in four roles, and they are not interchangeable:
|
|
7
7
|
*
|
|
8
|
-
* `primary`
|
|
9
|
-
* `onPrimary`
|
|
10
|
-
* `primarySoft`
|
|
11
|
-
* `primaryText`
|
|
12
|
-
*
|
|
8
|
+
* `primary` solid fill (button background, selected day, FAB).
|
|
9
|
+
* `onPrimary` text/icon *on top of* that fill.
|
|
10
|
+
* `primarySoft` tinted background for selected states and pills.
|
|
11
|
+
* `primaryText` accent text/icon over `surface`, `background`
|
|
12
|
+
* or over its own `primarySoft`.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* The reason is contrast: an accent that reads well as a fill doesn't read
|
|
15
|
+
* as text. Components used to use `colors.primary` for both things and tinted
|
|
16
|
+
* it by appending alpha to the hex (`colors.primary + '15'`), which in dark
|
|
17
|
+
* gave 2.6:1 over the surface — well below WCAG AA's 4.5:1. Every pair in
|
|
18
|
+
* this palette passes AA in both schemes.
|
|
19
19
|
*/
|
|
20
20
|
export interface ThemeColors {
|
|
21
21
|
primary: string;
|
|
@@ -47,14 +47,20 @@ export interface ThemeColors {
|
|
|
47
47
|
black: string;
|
|
48
48
|
background: string;
|
|
49
49
|
surface: string;
|
|
50
|
+
/**
|
|
51
|
+
* Fill of a surface that sits on another surface (Card). In light it equals
|
|
52
|
+
* `surface` (the shadow separates it); in dark it is lighter, because
|
|
53
|
+
* shadows don't show and elevation reads as a lighter fill.
|
|
54
|
+
*/
|
|
55
|
+
surfaceRaised: string;
|
|
50
56
|
text: string;
|
|
51
57
|
textLight: string;
|
|
52
58
|
border: string;
|
|
53
59
|
inputBackground: string;
|
|
54
60
|
overlay: string;
|
|
55
|
-
/**
|
|
61
|
+
/** Semi-transparent veil over custom content (List's loading footer). */
|
|
56
62
|
scrim: string;
|
|
57
|
-
/**
|
|
63
|
+
/** Placeholder background while an image loads. */
|
|
58
64
|
skeleton: string;
|
|
59
65
|
}
|
|
60
66
|
|
|
@@ -81,9 +87,9 @@ export const lightPalette: ThemeColors = {
|
|
|
81
87
|
successSoft: '#e3f6e9',
|
|
82
88
|
successText: '#116a30',
|
|
83
89
|
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
//
|
|
90
|
+
// Red goes with white text, which is what people expect from a destructive
|
|
91
|
+
// button. #ff3b30 doesn't reach 4.5:1 with white and forced near-black text
|
|
92
|
+
// over red; this shade does, and still reads as an alert red.
|
|
87
93
|
error: '#dc2626',
|
|
88
94
|
onError: '#ffffff',
|
|
89
95
|
errorSoft: '#fdeaea',
|
|
@@ -96,19 +102,20 @@ export const lightPalette: ThemeColors = {
|
|
|
96
102
|
|
|
97
103
|
background: '#f8f9fa',
|
|
98
104
|
surface: '#ffffff',
|
|
105
|
+
surfaceRaised: '#ffffff',
|
|
99
106
|
text: '#333333',
|
|
100
107
|
textLight: '#666666',
|
|
101
108
|
border: '#e5e7eb',
|
|
102
109
|
inputBackground: '#f5f7fa',
|
|
103
110
|
overlay: 'rgba(0,0,0,0.5)',
|
|
104
111
|
scrim: 'rgba(248,249,250,0.8)',
|
|
105
|
-
skeleton: '#
|
|
112
|
+
skeleton: '#e3e5e8',
|
|
106
113
|
};
|
|
107
114
|
|
|
108
115
|
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* `onPrimary`
|
|
116
|
+
* The dark accents are NOT the light ones: over `#1e1e1e` the accent's
|
|
117
|
+
* lightness has to go up and that of the text on top has to go down (which
|
|
118
|
+
* is why `onPrimary` is dark blue here and white in light).
|
|
112
119
|
*/
|
|
113
120
|
export const darkPalette: ThemeColors = {
|
|
114
121
|
...neutral,
|
|
@@ -140,11 +147,12 @@ export const darkPalette: ThemeColors = {
|
|
|
140
147
|
|
|
141
148
|
background: '#121212',
|
|
142
149
|
surface: '#1e1e1e',
|
|
150
|
+
surfaceRaised: '#303036',
|
|
143
151
|
text: '#ecedee',
|
|
144
152
|
textLight: '#9ba1a6',
|
|
145
|
-
border: '#
|
|
153
|
+
border: '#3a3a40',
|
|
146
154
|
inputBackground: '#232326',
|
|
147
155
|
overlay: 'rgba(0,0,0,0.6)',
|
|
148
156
|
scrim: 'rgba(18,18,18,0.8)',
|
|
149
|
-
skeleton: '#
|
|
157
|
+
skeleton: '#44444b',
|
|
150
158
|
};
|
package/src/theme/tokens.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Platform, type ViewStyle } from 'react-native';
|
|
2
2
|
|
|
3
|
-
//
|
|
4
|
-
// createTheme()
|
|
5
|
-
//
|
|
6
|
-
//
|
|
3
|
+
// Numeric scales are typed explicitly as `number` (not `as const`):
|
|
4
|
+
// createTheme() must be able to override any value with any other number:
|
|
5
|
+
// with literal typing, overriding `radius.md` to `999` would fail because
|
|
6
|
+
// the inferred type would be the literal `8`, not `number`.
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* Spacing scale. Always use these values instead of magic numbers so the
|
|
10
|
+
* vertical/horizontal rhythm is consistent across components.
|
|
11
11
|
*/
|
|
12
12
|
export const spacing: Record<'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | 'xxxl', number> = {
|
|
13
13
|
xxs: 2,
|
|
@@ -40,8 +40,8 @@ export const fontSize: Record<'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl', number>
|
|
|
40
40
|
xxl: 24,
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
// fontWeight
|
|
44
|
-
//
|
|
43
|
+
// fontWeight does need literals: RN's TextStyle.fontWeight requires a union
|
|
44
|
+
// of specific strings ('400' | '500' | ...), not an arbitrary `string`.
|
|
45
45
|
export const fontWeight = {
|
|
46
46
|
regular: '400',
|
|
47
47
|
medium: '500',
|
|
@@ -49,13 +49,26 @@ export const fontWeight = {
|
|
|
49
49
|
bold: '700',
|
|
50
50
|
} as const;
|
|
51
51
|
|
|
52
|
-
export const lineHeight: Record<'sm' | 'md' | 'lg', number> = {
|
|
52
|
+
export const lineHeight: Record<'sm' | 'md' | 'lg' | 'xl', number> = {
|
|
53
53
|
sm: 16,
|
|
54
54
|
md: 20,
|
|
55
55
|
lg: 24,
|
|
56
|
+
xl: 30,
|
|
56
57
|
};
|
|
57
58
|
|
|
58
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Tracking (letterSpacing) in points. `tight` offsets the extra room that
|
|
61
|
+
* large sizes bring by default (titles); `normal` is the system's;
|
|
62
|
+
* `wide` spaces out small caps.
|
|
63
|
+
*/
|
|
64
|
+
export const letterSpacing: Record<'tight' | 'normal' | 'wide', number> = {
|
|
65
|
+
tight: -0.5,
|
|
66
|
+
normal: 0,
|
|
67
|
+
/** Short, small, uppercase labels (Badge): a little room makes them legible. */
|
|
68
|
+
wide: 0.3,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** Durations in ms for Animated.timing/spring. */
|
|
59
72
|
export const duration: Record<'fast' | 'base' | 'slow', number> = {
|
|
60
73
|
fast: 150,
|
|
61
74
|
base: 200,
|
|
@@ -68,9 +81,9 @@ type ShadowStyle = Pick<
|
|
|
68
81
|
>;
|
|
69
82
|
|
|
70
83
|
/**
|
|
71
|
-
*
|
|
72
|
-
* `shadowColor`
|
|
73
|
-
*
|
|
84
|
+
* Cross-platform shadows: shadow* for iOS, elevation for Android.
|
|
85
|
+
* `shadowColor` is left fixed at black — a per-theme shadow color is too
|
|
86
|
+
* fine a detail to justify the complexity of resolving it here.
|
|
74
87
|
*/
|
|
75
88
|
export const shadow: Record<'none' | 'sm' | 'md' | 'lg', ShadowStyle> = {
|
|
76
89
|
none: Platform.select({
|
|
@@ -106,6 +119,7 @@ export const tokens = {
|
|
|
106
119
|
fontSize,
|
|
107
120
|
fontWeight,
|
|
108
121
|
lineHeight,
|
|
122
|
+
letterSpacing,
|
|
109
123
|
duration,
|
|
110
124
|
shadow,
|
|
111
125
|
};
|
package/src/theme/types.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Tokens } from './tokens';
|
|
2
2
|
import type { ThemeColors } from './palettes';
|
|
3
3
|
|
|
4
|
-
/**
|
|
4
|
+
/** Resolved theme: the palette of a given scheme + shared tokens. */
|
|
5
5
|
export interface Theme {
|
|
6
6
|
colors: ThemeColors;
|
|
7
7
|
tokens: Tokens;
|
|
8
8
|
scheme: 'light' | 'dark';
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
/**
|
|
11
|
+
/** Light/dark theme pair produced by createTheme() and consumed by UIProvider. */
|
|
12
12
|
export interface ThemePair {
|
|
13
13
|
light: Theme;
|
|
14
14
|
dark: Theme;
|
|
@@ -18,15 +18,15 @@ export type DeepPartial<T> = {
|
|
|
18
18
|
[K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
/**
|
|
21
|
+
/** Accents that can be defined with a single hex via `brand`. */
|
|
22
22
|
export type BrandAccent = 'primary' | 'secondary' | 'success' | 'error' | 'warning';
|
|
23
23
|
|
|
24
24
|
export interface ThemeOverrides {
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
26
|
+
* One hex per accent; each one derives its four roles (fill, content on top,
|
|
27
|
+
* subtle background and the variant legible on `surface`) for light and
|
|
28
|
+
* dark, with contrast already resolved. A plain string sets `primary`.
|
|
29
|
+
* Anything passed in `colors` wins over the derived values.
|
|
30
30
|
*/
|
|
31
31
|
brand?: string | Partial<Record<BrandAccent, string>>;
|
|
32
32
|
colors?: {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useMemo, useRef, type RefObject, type ComponentRef } from 'react';
|
|
2
|
+
import type { View } from 'react-native';
|
|
3
|
+
import { useKeyboardHost, type KeyboardField } from './KeyboardAvoidance';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Registers a text field with the nearest keyboard host (a Screen's content or
|
|
7
|
+
* the root UIProvider) so it stays visible above the keyboard. `boxRef` is the
|
|
8
|
+
* block that has to be seen whole: label, field and error.
|
|
9
|
+
*
|
|
10
|
+
* Call `focus()` from the TextInput's onFocus (and again when the block grows,
|
|
11
|
+
* e.g. an error shows up while typing) and `blur()` from onBlur. Inside a
|
|
12
|
+
* container that already handles the keyboard there is no host and both are
|
|
13
|
+
* no-ops.
|
|
14
|
+
*/
|
|
15
|
+
export function useKeyboardField(boxRef: RefObject<ComponentRef<typeof View> | null>) {
|
|
16
|
+
const host = useKeyboardHost();
|
|
17
|
+
const field = useRef<KeyboardField>({
|
|
18
|
+
measure: () =>
|
|
19
|
+
new Promise((resolve) => {
|
|
20
|
+
const node = boxRef.current;
|
|
21
|
+
if (!node) return resolve(null);
|
|
22
|
+
node.measureInWindow((_x, y, _w, height) => resolve({ y, height }));
|
|
23
|
+
}),
|
|
24
|
+
}).current;
|
|
25
|
+
|
|
26
|
+
return useMemo(
|
|
27
|
+
() => ({
|
|
28
|
+
focus: () => host?.focus(field),
|
|
29
|
+
blur: () => host?.blur(field),
|
|
30
|
+
}),
|
|
31
|
+
[host, field]
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { AccessibilityInfo } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Follows the system "reduce motion" setting: when it is on, animations jump
|
|
6
|
+
* to their final state instead of being disabled, so callbacks and unmounting
|
|
7
|
+
* still happen the same way.
|
|
8
|
+
*/
|
|
9
|
+
export function useReduceMotion(): boolean {
|
|
10
|
+
const [reduceMotion, setReduceMotion] = useState(false);
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
let alive = true;
|
|
14
|
+
// The state is only updated if the setting is on: the initial value is
|
|
15
|
+
// already `false` and a setState from false to false would cost a render per mount.
|
|
16
|
+
AccessibilityInfo.isReduceMotionEnabled().then((enabled) => {
|
|
17
|
+
if (alive && enabled) setReduceMotion(true);
|
|
18
|
+
});
|
|
19
|
+
const sub = AccessibilityInfo.addEventListener('reduceMotionChanged', setReduceMotion);
|
|
20
|
+
return () => {
|
|
21
|
+
alive = false;
|
|
22
|
+
sub.remove();
|
|
23
|
+
};
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
26
|
+
return reduceMotion;
|
|
27
|
+
}
|