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
|
@@ -5,35 +5,64 @@ import { Text, View } from 'react-native';
|
|
|
5
5
|
import { createStyles } from '../theme/createStyles';
|
|
6
6
|
import { useAllowFontScaling, useColors, useLabels } from '../theme/UIProvider';
|
|
7
7
|
import { Icon } from '../icons/Icon';
|
|
8
|
+
import { Button } from './Button';
|
|
8
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
/** Icon size: the block's focal point without competing with the title. */
|
|
11
|
+
const ICON_SIZE = 48;
|
|
12
|
+
/** Minimum height: the block doesn't get squashed inside a short empty list. */
|
|
13
|
+
const MIN_HEIGHT = 200;
|
|
9
14
|
const useStyles = createStyles(theme => ({
|
|
10
15
|
container: {
|
|
11
16
|
flex: 1,
|
|
12
17
|
justifyContent: 'center',
|
|
13
18
|
alignItems: 'center',
|
|
14
|
-
padding: theme.tokens.spacing.
|
|
15
|
-
minHeight:
|
|
19
|
+
padding: theme.tokens.spacing.xl,
|
|
20
|
+
minHeight: MIN_HEIGHT
|
|
16
21
|
},
|
|
17
22
|
title: {
|
|
18
23
|
fontSize: theme.tokens.fontSize.lg,
|
|
19
24
|
fontWeight: theme.tokens.fontWeight.semibold,
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
lineHeight: theme.tokens.lineHeight.lg,
|
|
26
|
+
color: theme.colors.text,
|
|
27
|
+
marginTop: theme.tokens.spacing.md,
|
|
22
28
|
textAlign: 'center'
|
|
23
29
|
},
|
|
24
30
|
description: {
|
|
25
31
|
fontSize: theme.tokens.fontSize.md,
|
|
32
|
+
lineHeight: theme.tokens.lineHeight.md,
|
|
26
33
|
color: theme.colors.textLight,
|
|
27
|
-
marginTop: theme.tokens.spacing.xs
|
|
34
|
+
marginTop: theme.tokens.spacing.xs,
|
|
28
35
|
textAlign: 'center'
|
|
36
|
+
},
|
|
37
|
+
message: {
|
|
38
|
+
alignItems: 'center'
|
|
39
|
+
},
|
|
40
|
+
action: {
|
|
41
|
+
marginTop: theme.tokens.spacing.lg
|
|
29
42
|
}
|
|
30
43
|
}));
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* EmptyState
|
|
47
|
+
* Centered icon + title + description for a list or screen with no data.
|
|
48
|
+
*
|
|
49
|
+
* Gestalt, proximity: title and description sit close together (`spacing.xs`)
|
|
50
|
+
* and the icon one step further (`spacing.md`), so they read as a message
|
|
51
|
+
* with its image and not as three loose pieces. Similarity: the title in
|
|
52
|
+
* `text` and the description in `textLight` mark the hierarchy. The action,
|
|
53
|
+
* if any, is set further apart (`spacing.lg`): it is the next step, not part
|
|
54
|
+
* of the message.
|
|
55
|
+
* The message is a single accessibility node (title and description together;
|
|
56
|
+
* the icon is decorative) and the button a separate, focusable one.
|
|
57
|
+
*/
|
|
31
58
|
export const EmptyState = /*#__PURE__*/memo(({
|
|
32
59
|
title,
|
|
33
60
|
description,
|
|
34
61
|
iconName = 'search',
|
|
35
62
|
icon,
|
|
36
|
-
|
|
63
|
+
action,
|
|
64
|
+
style,
|
|
65
|
+
testID
|
|
37
66
|
}) => {
|
|
38
67
|
const colors = useColors();
|
|
39
68
|
const styles = useStyles();
|
|
@@ -43,20 +72,29 @@ export const EmptyState = /*#__PURE__*/memo(({
|
|
|
43
72
|
const resolvedDescription = description ?? labels.noResultsDescription;
|
|
44
73
|
return /*#__PURE__*/_jsxs(View, {
|
|
45
74
|
style: [styles.container, style],
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
75
|
+
testID: testID,
|
|
76
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
77
|
+
style: styles.message,
|
|
78
|
+
accessible: true,
|
|
79
|
+
accessibilityRole: "text",
|
|
80
|
+
children: [icon ?? /*#__PURE__*/_jsx(Icon, {
|
|
81
|
+
name: iconName,
|
|
82
|
+
size: ICON_SIZE,
|
|
83
|
+
color: colors.textLight
|
|
84
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
85
|
+
allowFontScaling: allowFontScaling,
|
|
86
|
+
style: styles.title,
|
|
87
|
+
children: resolvedTitle
|
|
88
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
89
|
+
allowFontScaling: allowFontScaling,
|
|
90
|
+
style: styles.description,
|
|
91
|
+
children: resolvedDescription
|
|
92
|
+
})]
|
|
93
|
+
}), action && /*#__PURE__*/_jsx(Button, {
|
|
94
|
+
title: action.label,
|
|
95
|
+
onPress: action.onPress,
|
|
96
|
+
variant: action.variant ?? 'primary',
|
|
97
|
+
style: styles.action
|
|
60
98
|
})]
|
|
61
99
|
});
|
|
62
100
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","memo","Text","View","createStyles","useAllowFontScaling","useColors","useLabels","Icon","jsx","_jsx","jsxs","_jsxs","useStyles","theme","container","flex","justifyContent","alignItems","padding","tokens","spacing","
|
|
1
|
+
{"version":3,"names":["React","memo","Text","View","createStyles","useAllowFontScaling","useColors","useLabels","Icon","Button","jsx","_jsx","jsxs","_jsxs","ICON_SIZE","MIN_HEIGHT","useStyles","theme","container","flex","justifyContent","alignItems","padding","tokens","spacing","xl","minHeight","title","fontSize","lg","fontWeight","semibold","lineHeight","color","colors","text","marginTop","md","textAlign","description","textLight","xs","message","action","EmptyState","iconName","icon","style","testID","styles","labels","allowFontScaling","resolvedTitle","noResultsTitle","resolvedDescription","noResultsDescription","children","accessible","accessibilityRole","name","size","label","onPress","variant","displayName"],"sourceRoot":"../../../src","sources":["atoms/EmptyState.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,SAASC,IAAI,EAAEC,IAAI,QAAwC,cAAc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AA,CAACT,IAAI;QAACiD,gBAAgB,EAAEA,gBAAiB;QAACJ,KAAK,EAAEE,MAAM,CAACV,WAAY;QAAAiB,QAAA,EACjEF;MAAmB,CAChB,CAAC;IAAA,CACH,CAAC,EACNX,MAAM,iBACLhC,IAAA,CAACF,MAAM;MACLkB,KAAK,EAAEgB,MAAM,CAACkB,KAAM;MACpBC,OAAO,EAAEnB,MAAM,CAACmB,OAAQ;MACxBC,OAAO,EAAEpB,MAAM,CAACoB,OAAO,IAAI,SAAU;MACrChB,KAAK,EAAEE,MAAM,CAACN;IAAO,CACtB,CACF;EAAA,CACG,CAAC;AAEX,CACF,CAAC;AACDC,UAAU,CAACoB,WAAW,GAAG,YAAY","ignoreList":[]}
|
package/lib/module/atoms/Fab.js
CHANGED
|
@@ -3,9 +3,14 @@
|
|
|
3
3
|
import React, { memo } from 'react';
|
|
4
4
|
import { PressableScale } from './PressableScale';
|
|
5
5
|
import { Icon } from '../icons/Icon';
|
|
6
|
+
import { onColor } from '../icons/defaultIcons';
|
|
6
7
|
import { createStyles } from '../theme/createStyles';
|
|
7
|
-
import { useColors } from '../theme/UIProvider';
|
|
8
|
+
import { useColors, useInsets, useTheme } from '../theme/UIProvider';
|
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
/** Default diameter: comfortably above the 44pt touch minimum (Fitts). */
|
|
11
|
+
const DEFAULT_SIZE = 60;
|
|
12
|
+
/** The glyph takes up half the circle. */
|
|
13
|
+
const ICON_RATIO = 0.5;
|
|
9
14
|
const useStyles = createStyles(theme => ({
|
|
10
15
|
fab: {
|
|
11
16
|
position: 'absolute',
|
|
@@ -17,39 +22,54 @@ const useStyles = createStyles(theme => ({
|
|
|
17
22
|
|
|
18
23
|
/**
|
|
19
24
|
* Fab
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* offset (
|
|
25
|
+
* Circular floating button for the screen's main action.
|
|
26
|
+
* `bottom`/`right` instead of the required `tabBarHeight` of the original
|
|
27
|
+
* version — the consumer decides its own offset (with or without a tab bar).
|
|
28
|
+
*
|
|
29
|
+
* Gestalt, figure/ground: it is the only thing that floats (`lg` shadow) and
|
|
30
|
+
* carries the accent, so it stands apart from the content passing beneath it
|
|
31
|
+
* (Von Restorff: one per screen). Fitts: large and in the thumb's corner,
|
|
32
|
+
* above the safe area so it doesn't compete with the home gesture.
|
|
23
33
|
*/
|
|
24
34
|
export const Fab = /*#__PURE__*/memo(({
|
|
25
35
|
onPress,
|
|
26
36
|
iconName = 'plus',
|
|
27
37
|
icon,
|
|
28
|
-
size =
|
|
29
|
-
bottom
|
|
30
|
-
right
|
|
38
|
+
size = DEFAULT_SIZE,
|
|
39
|
+
bottom,
|
|
40
|
+
right,
|
|
41
|
+
safeArea = true,
|
|
31
42
|
color,
|
|
32
43
|
style,
|
|
33
|
-
accessibilityLabel
|
|
44
|
+
accessibilityLabel,
|
|
45
|
+
testID
|
|
34
46
|
}) => {
|
|
35
47
|
const styles = useStyles();
|
|
36
48
|
const colors = useColors();
|
|
49
|
+
const theme = useTheme();
|
|
50
|
+
const insets = useInsets();
|
|
51
|
+
const fill = color ?? colors.primary;
|
|
52
|
+
// With the theme color, its `onPrimary`; with a custom one, black or white
|
|
53
|
+
// depending on contrast (a cyan with a white icon was unreadable).
|
|
54
|
+
const glyph = color ? onColor(color) : colors.onPrimary;
|
|
55
|
+
const edge = theme.tokens.spacing.xl;
|
|
37
56
|
return /*#__PURE__*/_jsx(PressableScale, {
|
|
38
57
|
onPress: onPress,
|
|
39
58
|
style: [styles.fab, {
|
|
40
59
|
width: size,
|
|
41
60
|
height: size,
|
|
42
61
|
borderRadius: size / 2,
|
|
43
|
-
bottom,
|
|
44
|
-
right,
|
|
45
|
-
backgroundColor:
|
|
62
|
+
bottom: (bottom ?? edge) + (safeArea ? insets.bottom : 0),
|
|
63
|
+
right: (right ?? edge) + (safeArea ? insets.right : 0),
|
|
64
|
+
backgroundColor: fill
|
|
46
65
|
}, style],
|
|
47
66
|
accessibilityRole: "button",
|
|
48
67
|
accessibilityLabel: accessibilityLabel,
|
|
68
|
+
testID: testID,
|
|
49
69
|
children: icon ?? /*#__PURE__*/_jsx(Icon, {
|
|
50
70
|
name: iconName,
|
|
51
|
-
size: size *
|
|
52
|
-
color:
|
|
71
|
+
size: size * ICON_RATIO,
|
|
72
|
+
color: glyph
|
|
53
73
|
})
|
|
54
74
|
});
|
|
55
75
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","memo","PressableScale","Icon","createStyles","useColors","jsx","_jsx","useStyles","theme","fab","position","justifyContent","alignItems","tokens","shadow","lg","Fab","onPress","iconName","icon","size","bottom","right","color","style","accessibilityLabel","styles","colors","width","height","borderRadius","backgroundColor","
|
|
1
|
+
{"version":3,"names":["React","memo","PressableScale","Icon","onColor","createStyles","useColors","useInsets","useTheme","jsx","_jsx","DEFAULT_SIZE","ICON_RATIO","useStyles","theme","fab","position","justifyContent","alignItems","tokens","shadow","lg","Fab","onPress","iconName","icon","size","bottom","right","safeArea","color","style","accessibilityLabel","testID","styles","colors","insets","fill","primary","glyph","onPrimary","edge","spacing","xl","width","height","borderRadius","backgroundColor","accessibilityRole","children","name","displayName"],"sourceRoot":"../../../src","sources":["atoms/Fab.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AAEnC,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,IAAI,QAAQ,eAAe;AACpC,SAASC,OAAO,QAAQ,uBAAuB;AAE/C,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SAASC,SAAS,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,qBAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AA6BrE;AACA,MAAMC,YAAY,GAAG,EAAE;AACvB;AACA,MAAMC,UAAU,GAAG,GAAG;AAEtB,MAAMC,SAAS,GAAGR,YAAY,CAAES,KAAK,KAAM;EACzCC,GAAG,EAAE;IACHC,QAAQ,EAAE,UAAU;I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M,CAACR,KAAK,GAAG,CAAC,CAAC;MACtDmB,eAAe,EAAEV;IACnB,CAAC,EACDN,KAAK,CACL;IACFiB,iBAAiB,EAAC,QAAQ;IAC1BhB,kBAAkB,EAAEA,kBAAmB;IACvCC,MAAM,EAAEA,MAAO;IAAAgB,QAAA,EAEdxB,IAAI,iBAAIf,IAAA,CAACP,IAAI;MAAC+C,IAAI,EAAE1B,QAAS;MAACE,IAAI,EAAEA,IAAI,GAAGd,UAAW;MAACkB,KAAK,EAAES;IAAM,CAAE;EAAC,CAC1D,CAAC;AAErB,CACF,CAAC;AACDjB,GAAG,CAAC6B,WAAW,GAAG,KAAK","ignoreList":[]}
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import React, { memo, useMemo } from 'react';
|
|
3
|
+
import React, { memo, useMemo, useState } from 'react';
|
|
4
4
|
import { StyleSheet, View } from 'react-native';
|
|
5
5
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
-
const DEFAULT_STEPS =
|
|
6
|
+
const DEFAULT_STEPS = 48;
|
|
7
7
|
const styles = StyleSheet.create({
|
|
8
|
-
//
|
|
8
|
+
// Clips the rotated plane of the diagonals and the gradient to the borderRadius.
|
|
9
9
|
root: {
|
|
10
10
|
overflow: 'hidden'
|
|
11
11
|
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
band: {
|
|
16
|
-
flex: 1
|
|
17
|
-
},
|
|
18
|
-
// Plano √2 centrado: rotado 45° cubre las esquinas sin medir el contenedor.
|
|
12
|
+
// Centered √2 plane: covers the corners of a SQUARE container without
|
|
13
|
+
// measuring it. Only used until the first onLayout; after that the plane is
|
|
14
|
+
// sized with the real diagonal (see `diagonalBox`).
|
|
19
15
|
diagonalPlane: {
|
|
20
16
|
position: 'absolute',
|
|
21
17
|
top: '-21%',
|
|
@@ -25,16 +21,54 @@ const styles = StyleSheet.create({
|
|
|
25
21
|
}
|
|
26
22
|
});
|
|
27
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Opacities of stacked layers: layer k (from 1 to n-1) starts at k/n and
|
|
26
|
+
* runs to the end of the segment; stacked with "over", the total opacity in
|
|
27
|
+
* band k is k/(n-1), same as side-by-side bands. The difference: no layer
|
|
28
|
+
* edge sits next to a gap, so the antialiasing of an edge (especially when
|
|
29
|
+
* rotated) blends with the color of the layer below and not with what is
|
|
30
|
+
* behind the gradient — without the thin lines between bands.
|
|
31
|
+
*/
|
|
32
|
+
function layerOpacities(n) {
|
|
33
|
+
const out = [];
|
|
34
|
+
let prev = 0;
|
|
35
|
+
for (let k = 1; k < n; k += 1) {
|
|
36
|
+
const total = k / (n - 1);
|
|
37
|
+
out.push(prev >= 1 ? 1 : 1 - (1 - total) / (1 - prev));
|
|
38
|
+
prev = total;
|
|
39
|
+
}
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Square with the diagonal as its side, centered: rotated 45° it covers any rectangle. */
|
|
44
|
+
function diagonalBox(width, height) {
|
|
45
|
+
const side = Math.hypot(width, height);
|
|
46
|
+
return {
|
|
47
|
+
position: 'absolute',
|
|
48
|
+
width: side,
|
|
49
|
+
height: side,
|
|
50
|
+
left: (width - side) / 2,
|
|
51
|
+
top: (height - side) / 2
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
28
55
|
/**
|
|
29
56
|
* Gradient
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
57
|
+
* Dependency-free linear gradient: React Native doesn't ship one in the
|
|
58
|
+
* supported range (Expo SDK 54–57) and `experimental_backgroundImage` isn't
|
|
59
|
+
* available across that whole window, so it is composed from bands.
|
|
60
|
+
*
|
|
61
|
+
* Each segment paints the start color and, on top, layers of the end color
|
|
62
|
+
* that accumulate (see `layerOpacities`). The compositor blends alpha linearly:
|
|
63
|
+
* the result is the sRGB interpolation between stops without parsing the
|
|
64
|
+
* color, which is why any format RN accepts works (hex, `rgba()`, name). The
|
|
65
|
+
* layers run to the end of the plane so no thin lines are left between
|
|
66
|
+
* bands, and the diagonals rotate a square the size of the measured diagonal
|
|
67
|
+
* to cover any rectangle, not just squares.
|
|
33
68
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* cualquier formato que acepte RN (hex, `rgba()`, nombre).
|
|
69
|
+
* Gestalt, figure and ground: content on top must contrast with ALL the
|
|
70
|
+
* stops, not just the first — white text that reads well over the blue at
|
|
71
|
+
* the start can get lost over the light blue at the end.
|
|
38
72
|
*/
|
|
39
73
|
export const Gradient = /*#__PURE__*/memo(({
|
|
40
74
|
colors,
|
|
@@ -46,10 +80,21 @@ export const Gradient = /*#__PURE__*/memo(({
|
|
|
46
80
|
}) => {
|
|
47
81
|
const isRow = direction === 'horizontal';
|
|
48
82
|
const isDiagonal = direction === 'diagonal' || direction === 'diagonal-reverse';
|
|
49
|
-
// rotate
|
|
50
|
-
//
|
|
83
|
+
// positive rotate turns clockwise (Y grows downward): -45° sends the
|
|
84
|
+
// gradient axis down-right.
|
|
51
85
|
const rotate = direction === 'diagonal' ? '-45deg' : '45deg';
|
|
52
86
|
const bandCount = Math.max(2, Math.floor(steps));
|
|
87
|
+
const [size, setSize] = useState(null);
|
|
88
|
+
const onLayout = isDiagonal ? e => {
|
|
89
|
+
const {
|
|
90
|
+
width,
|
|
91
|
+
height
|
|
92
|
+
} = e.nativeEvent.layout;
|
|
93
|
+
setSize(prev => prev && prev.width === width && prev.height === height ? prev : {
|
|
94
|
+
width,
|
|
95
|
+
height
|
|
96
|
+
});
|
|
97
|
+
} : undefined;
|
|
53
98
|
const painted = useMemo(() => {
|
|
54
99
|
if (colors.length === 0) return null;
|
|
55
100
|
if (colors.length === 1) {
|
|
@@ -59,42 +104,63 @@ export const Gradient = /*#__PURE__*/memo(({
|
|
|
59
104
|
}]
|
|
60
105
|
});
|
|
61
106
|
}
|
|
62
|
-
const
|
|
107
|
+
const segmentCount = colors.length - 1;
|
|
108
|
+
const opacities = layerOpacities(bandCount);
|
|
109
|
+
// From `start` (fraction of the axis) to the end of the plane.
|
|
110
|
+
const from = start => isRow ? {
|
|
111
|
+
position: 'absolute',
|
|
112
|
+
top: 0,
|
|
113
|
+
bottom: 0,
|
|
114
|
+
right: 0,
|
|
115
|
+
left: `${start * 100}%`
|
|
116
|
+
} : {
|
|
117
|
+
position: 'absolute',
|
|
118
|
+
left: 0,
|
|
119
|
+
right: 0,
|
|
120
|
+
bottom: 0,
|
|
121
|
+
top: `${start * 100}%`
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// Segments are stacked too: each one covers the previous from its start,
|
|
125
|
+
// and since it begins with the color the previous one ended with, the
|
|
126
|
+
// edge between segments doesn't show the background.
|
|
127
|
+
const segments = colors.slice(0, -1).map((start, index) => {
|
|
63
128
|
const to = colors[index + 1];
|
|
129
|
+
const segStart = index / segmentCount;
|
|
130
|
+
const segLength = 1 / segmentCount;
|
|
131
|
+
// The segment runs from segStart to the END of the plane; its layers
|
|
132
|
+
// sit at fractions of that remaining length.
|
|
133
|
+
const rest = 1 - segStart;
|
|
64
134
|
return /*#__PURE__*/_jsx(View, {
|
|
65
|
-
style: [
|
|
66
|
-
backgroundColor:
|
|
67
|
-
flexDirection: isRow ? 'row' : 'column'
|
|
135
|
+
style: [from(segStart), {
|
|
136
|
+
backgroundColor: start
|
|
68
137
|
}],
|
|
69
|
-
children:
|
|
70
|
-
|
|
71
|
-
}, (_, band) => /*#__PURE__*/_jsx(View, {
|
|
72
|
-
style: [styles.band, {
|
|
138
|
+
children: opacities.map((opacity, k) => /*#__PURE__*/_jsx(View, {
|
|
139
|
+
style: [from((k + 1) / bandCount * segLength / rest), {
|
|
73
140
|
backgroundColor: to,
|
|
74
|
-
opacity
|
|
141
|
+
opacity
|
|
75
142
|
}]
|
|
76
|
-
},
|
|
77
|
-
}, `${
|
|
143
|
+
}, k))
|
|
144
|
+
}, `${start}-${to}-${index}`);
|
|
78
145
|
});
|
|
79
|
-
|
|
80
|
-
style:
|
|
81
|
-
flexDirection: isRow ? 'row' : 'column'
|
|
82
|
-
}],
|
|
146
|
+
if (!isDiagonal) return /*#__PURE__*/_jsx(View, {
|
|
147
|
+
style: StyleSheet.absoluteFill,
|
|
83
148
|
children: segments
|
|
84
149
|
});
|
|
85
|
-
|
|
150
|
+
const plane = size ? diagonalBox(size.width, size.height) : styles.diagonalPlane;
|
|
86
151
|
return /*#__PURE__*/_jsx(View, {
|
|
87
|
-
style: [
|
|
152
|
+
style: [plane, {
|
|
88
153
|
transform: [{
|
|
89
154
|
rotate
|
|
90
155
|
}]
|
|
91
156
|
}],
|
|
92
157
|
children: segments
|
|
93
158
|
});
|
|
94
|
-
}, [colors, isRow, isDiagonal, rotate, bandCount]);
|
|
159
|
+
}, [colors, isRow, isDiagonal, rotate, bandCount, size]);
|
|
95
160
|
return /*#__PURE__*/_jsxs(View, {
|
|
96
161
|
testID: testID,
|
|
97
162
|
style: [styles.root, style],
|
|
163
|
+
onLayout: onLayout,
|
|
98
164
|
children: [/*#__PURE__*/_jsx(View, {
|
|
99
165
|
style: StyleSheet.absoluteFill,
|
|
100
166
|
pointerEvents: "none",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","memo","useMemo","StyleSheet","View","jsx","_jsx","jsxs","_jsxs","DEFAULT_STEPS","styles","create","root","overflow","
|
|
1
|
+
{"version":3,"names":["React","memo","useMemo","useState","StyleSheet","View","jsx","_jsx","jsxs","_jsxs","DEFAULT_STEPS","styles","create","root","overflow","diagonalPlane","position","top","left","width","height","layerOpacities","n","out","prev","k","total","push","diagonalBox","side","Math","hypot","Gradient","colors","direction","steps","children","style","testID","isRow","isDiagonal","rotate","bandCount","max","floor","size","setSize","onLayout","e","nativeEvent","layout","undefined","painted","length","absoluteFill","backgroundColor","segmentCount","opacities","from","start","bottom","right","segments","slice","map","index","to","segStart","segLength","rest","opacity","plane","transform","pointerEvents","displayName"],"sourceRoot":"../../../src","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CACJ,CAAC,EACNhB,QAAQ;EAAA,CACL,CAAC;AAEX,CACF,CAAC;AACDJ,QAAQ,CAAC0C,WAAW,GAAG,UAAU","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ import React, { memo } from 'react';
|
|
|
4
4
|
import { PressableScale } from './PressableScale';
|
|
5
5
|
import { Icon } from '../icons/Icon';
|
|
6
6
|
import { createStyles } from '../theme/createStyles';
|
|
7
|
+
import { useTheme } from '../theme/UIProvider';
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
const useStyles = createStyles(theme => ({
|
|
9
10
|
hitArea: {
|
|
@@ -13,12 +14,22 @@ const useStyles = createStyles(theme => ({
|
|
|
13
14
|
}
|
|
14
15
|
}));
|
|
15
16
|
|
|
17
|
+
/** Minimum touch area recommended by Apple (44pt) and Material (48dp ≈ 44pt). */
|
|
18
|
+
const MIN_TOUCH = 44;
|
|
19
|
+
|
|
16
20
|
/**
|
|
17
21
|
* IconButton
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
+
* Icon-only button. `accessibilityLabel` is required: with no visible text,
|
|
23
|
+
* it is the only way for a screen reader to announce what it does.
|
|
24
|
+
*
|
|
25
|
+
* Fitts: the visible area is icon + `spacing.sm` per side (24 + 16 = 40pt
|
|
26
|
+
* with the default size, 32pt with `size={16}`). `hitSlop` makes up the
|
|
27
|
+
* rest up to 44pt without enlarging the layout, so a row of icons keeps its
|
|
28
|
+
* rhythm and each one is still easy to tap.
|
|
29
|
+
*
|
|
30
|
+
* Gestalt, figure and ground: it has no background of its own, the icon is
|
|
31
|
+
* the figure over whatever is behind it; that is why the default color is
|
|
32
|
+
* `colors.text` (guaranteed AA contrast) and `disabled` dims it by half.
|
|
22
33
|
*/
|
|
23
34
|
export const IconButton = /*#__PURE__*/memo(({
|
|
24
35
|
iconName,
|
|
@@ -32,9 +43,19 @@ export const IconButton = /*#__PURE__*/memo(({
|
|
|
32
43
|
testID
|
|
33
44
|
}) => {
|
|
34
45
|
const styles = useStyles();
|
|
46
|
+
const theme = useTheme();
|
|
47
|
+
const visible = size + theme.tokens.spacing.sm * 2;
|
|
48
|
+
const extra = Math.max(0, Math.ceil((MIN_TOUCH - visible) / 2));
|
|
49
|
+
const hitSlop = extra > 0 ? {
|
|
50
|
+
top: extra,
|
|
51
|
+
bottom: extra,
|
|
52
|
+
left: extra,
|
|
53
|
+
right: extra
|
|
54
|
+
} : undefined;
|
|
35
55
|
return /*#__PURE__*/_jsx(PressableScale, {
|
|
36
56
|
onPress: onPress,
|
|
37
57
|
disabled: disabled,
|
|
58
|
+
hitSlop: hitSlop,
|
|
38
59
|
style: [styles.hitArea, {
|
|
39
60
|
opacity: disabled ? 0.5 : 1
|
|
40
61
|
}, style],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","memo","PressableScale","Icon","createStyles","jsx","_jsx","useStyles","theme","hitArea","padding","tokens","spacing","sm","alignItems","justifyContent","IconButton","iconName","icon","onPress","size","color","disabled","style","accessibilityLabel","testID","styles","opacity","accessibilityRole","accessibilityState","children","name","displayName"],"sourceRoot":"../../../src","sources":["atoms/IconButton.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AAEnC,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,IAAI,QAAQ,eAAe;AAEpC,SAASC,YAAY,QAAQ,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;
|
|
1
|
+
{"version":3,"names":["React","memo","PressableScale","Icon","createStyles","useTheme","jsx","_jsx","useStyles","theme","hitArea","padding","tokens","spacing","sm","alignItems","justifyContent","MIN_TOUCH","IconButton","iconName","icon","onPress","size","color","disabled","style","accessibilityLabel","testID","styles","visible","extra","Math","max","ceil","hitSlop","top","bottom","left","right","undefined","opacity","accessibilityRole","accessibilityState","children","name","displayName"],"sourceRoot":"../../../src","sources":["atoms/IconButton.tsx"],"mappings":";;AAAA,OAAO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