orn-ui 0.2.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +67 -52
- package/README.md +5 -9
- package/lib/commonjs/atoms/Avatar.js +77 -5
- package/lib/commonjs/atoms/Avatar.js.map +1 -1
- package/lib/commonjs/atoms/Badge.js +17 -8
- package/lib/commonjs/atoms/Badge.js.map +1 -1
- package/lib/commonjs/atoms/Button.js +108 -39
- package/lib/commonjs/atoms/Button.js.map +1 -1
- package/lib/commonjs/atoms/Card.js +24 -2
- package/lib/commonjs/atoms/Card.js.map +1 -1
- package/lib/commonjs/atoms/Checkbox.js +41 -10
- package/lib/commonjs/atoms/Checkbox.js.map +1 -1
- package/lib/commonjs/atoms/Divider.js +30 -5
- package/lib/commonjs/atoms/Divider.js.map +1 -1
- package/lib/commonjs/atoms/EmptyState.js +58 -20
- package/lib/commonjs/atoms/EmptyState.js.map +1 -1
- package/lib/commonjs/atoms/Fab.js +32 -12
- package/lib/commonjs/atoms/Fab.js.map +1 -1
- package/lib/commonjs/atoms/Gradient.js +102 -36
- package/lib/commonjs/atoms/Gradient.js.map +1 -1
- package/lib/commonjs/atoms/IconButton.js +25 -4
- package/lib/commonjs/atoms/IconButton.js.map +1 -1
- package/lib/commonjs/atoms/Image.js +61 -25
- package/lib/commonjs/atoms/Image.js.map +1 -1
- package/lib/commonjs/atoms/Input.js +105 -17
- package/lib/commonjs/atoms/Input.js.map +1 -1
- package/lib/commonjs/atoms/KeyValueRow.js +37 -9
- package/lib/commonjs/atoms/KeyValueRow.js.map +1 -1
- package/lib/commonjs/atoms/PressableScale.js +25 -5
- package/lib/commonjs/atoms/PressableScale.js.map +1 -1
- package/lib/commonjs/atoms/ShinyText.js +29 -29
- package/lib/commonjs/atoms/Skeleton.js +28 -13
- package/lib/commonjs/atoms/Skeleton.js.map +1 -1
- package/lib/commonjs/atoms/Spinner.js +81 -22
- package/lib/commonjs/atoms/Spinner.js.map +1 -1
- package/lib/commonjs/atoms/Text.js +56 -5
- package/lib/commonjs/atoms/Text.js.map +1 -1
- package/lib/commonjs/atoms/Transition.js +46 -43
- package/lib/commonjs/atoms/Transition.js.map +1 -1
- package/lib/commonjs/atoms/index.js +6 -0
- package/lib/commonjs/atoms/index.js.map +1 -1
- package/lib/commonjs/atoms/inputValidation.js +56 -0
- package/lib/commonjs/atoms/inputValidation.js.map +1 -0
- package/lib/commonjs/icons/Icon.js +4 -4
- package/lib/commonjs/icons/defaultIcons.js +576 -24
- package/lib/commonjs/icons/defaultIcons.js.map +1 -1
- package/lib/commonjs/icons/index.js +6 -0
- package/lib/commonjs/icons/index.js.map +1 -1
- package/lib/commonjs/molecules/AvatarHeader.js +47 -14
- package/lib/commonjs/molecules/AvatarHeader.js.map +1 -1
- package/lib/commonjs/molecules/FormActions.js +25 -9
- package/lib/commonjs/molecules/FormActions.js.map +1 -1
- package/lib/commonjs/molecules/InfoRow.js +30 -14
- package/lib/commonjs/molecules/InfoRow.js.map +1 -1
- package/lib/commonjs/molecules/OptionCard.js +37 -22
- package/lib/commonjs/molecules/OptionCard.js.map +1 -1
- package/lib/commonjs/molecules/SegmentedControl.js +103 -14
- package/lib/commonjs/molecules/SegmentedControl.js.map +1 -1
- package/lib/commonjs/molecules/Stepper.js +61 -16
- package/lib/commonjs/molecules/Stepper.js.map +1 -1
- package/lib/commonjs/molecules/Steps.js +105 -41
- package/lib/commonjs/molecules/Steps.js.map +1 -1
- package/lib/commonjs/molecules/SymmetricGrid.js +26 -18
- package/lib/commonjs/molecules/SymmetricGrid.js.map +1 -1
- package/lib/commonjs/organisms/Alert.js +49 -35
- package/lib/commonjs/organisms/Alert.js.map +1 -1
- package/lib/commonjs/organisms/AlertProvider.js +10 -10
- package/lib/commonjs/organisms/BottomSheet.js +137 -85
- package/lib/commonjs/organisms/BottomSheet.js.map +1 -1
- package/lib/commonjs/organisms/Chart.js +197 -156
- package/lib/commonjs/organisms/Chart.js.map +1 -1
- package/lib/commonjs/organisms/DateField.js +36 -20
- package/lib/commonjs/organisms/DateField.js.map +1 -1
- package/lib/commonjs/organisms/DatePicker.js +56 -33
- package/lib/commonjs/organisms/DatePicker.js.map +1 -1
- package/lib/commonjs/organisms/List.js +62 -34
- package/lib/commonjs/organisms/List.js.map +1 -1
- package/lib/commonjs/organisms/Modal.js +120 -82
- package/lib/commonjs/organisms/Modal.js.map +1 -1
- package/lib/commonjs/organisms/NavigationBar.js +63 -24
- package/lib/commonjs/organisms/NavigationBar.js.map +1 -1
- package/lib/commonjs/organisms/OptionWheel.js +64 -64
- package/lib/commonjs/organisms/OptionWheel.js.map +1 -1
- package/lib/commonjs/organisms/ReorderableList.js +48 -27
- package/lib/commonjs/organisms/ReorderableList.js.map +1 -1
- package/lib/commonjs/organisms/Screen.js +68 -35
- package/lib/commonjs/organisms/Screen.js.map +1 -1
- package/lib/commonjs/organisms/SearchList.js +56 -26
- package/lib/commonjs/organisms/SearchList.js.map +1 -1
- package/lib/commonjs/organisms/Select.js +45 -24
- package/lib/commonjs/organisms/Select.js.map +1 -1
- package/lib/commonjs/organisms/Slides.js +36 -23
- package/lib/commonjs/organisms/Slides.js.map +1 -1
- package/lib/commonjs/organisms/ThemeToggle.js +10 -9
- package/lib/commonjs/organisms/ThemeToggle.js.map +1 -1
- package/lib/commonjs/organisms/Timeline.js +73 -56
- package/lib/commonjs/organisms/Timeline.js.map +1 -1
- package/lib/commonjs/organisms/Toast.js +46 -15
- package/lib/commonjs/organisms/Toast.js.map +1 -1
- package/lib/commonjs/organisms/ToastProvider.js +14 -10
- package/lib/commonjs/organisms/ToastProvider.js.map +1 -1
- package/lib/commonjs/organisms/Wizard.js +40 -15
- package/lib/commonjs/organisms/Wizard.js.map +1 -1
- package/lib/commonjs/organisms/chart/frame.js +25 -25
- package/lib/commonjs/organisms/chart/frame.js.map +1 -1
- package/lib/commonjs/organisms/chart/marks.js +42 -42
- package/lib/commonjs/organisms/chart/math.js +84 -85
- package/lib/commonjs/organisms/chart/math.js.map +1 -1
- package/lib/commonjs/organisms/chart/palette.js +28 -28
- package/lib/commonjs/organisms/imperativeBridge.js +5 -5
- package/lib/commonjs/organisms/imperativeBridge.js.map +1 -1
- package/lib/commonjs/organisms/useSlides.js +53 -21
- package/lib/commonjs/organisms/useSlides.js.map +1 -1
- package/lib/commonjs/safe-area/SafeAreaUIProvider.js +9 -66
- package/lib/commonjs/safe-area/SafeAreaUIProvider.js.map +1 -1
- package/lib/commonjs/safe-area/index.js.map +1 -1
- package/lib/commonjs/theme/KeyboardAvoidance.js +206 -0
- package/lib/commonjs/theme/KeyboardAvoidance.js.map +1 -0
- package/lib/commonjs/theme/NativeOverlay.js +263 -0
- package/lib/commonjs/theme/NativeOverlay.js.map +1 -0
- package/lib/commonjs/theme/UIProvider.js +86 -33
- package/lib/commonjs/theme/UIProvider.js.map +1 -1
- package/lib/commonjs/theme/colors.js +17 -17
- package/lib/commonjs/theme/colors.js.map +1 -1
- package/lib/commonjs/theme/createStyles.js +19 -16
- package/lib/commonjs/theme/createStyles.js.map +1 -1
- package/lib/commonjs/theme/createTheme.js +6 -6
- package/lib/commonjs/theme/index.js +6 -0
- package/lib/commonjs/theme/index.js.map +1 -1
- package/lib/commonjs/theme/insets.js +1 -1
- package/lib/commonjs/theme/labels.js +29 -1
- package/lib/commonjs/theme/labels.js.map +1 -1
- package/lib/commonjs/theme/palettes.js +25 -23
- package/lib/commonjs/theme/palettes.js.map +1 -1
- package/lib/commonjs/theme/tokens.js +28 -14
- package/lib/commonjs/theme/tokens.js.map +1 -1
- package/lib/commonjs/theme/useKeyboardField.js +36 -0
- package/lib/commonjs/theme/useKeyboardField.js.map +1 -0
- package/lib/commonjs/theme/useReduceMotion.js +31 -0
- package/lib/commonjs/theme/useReduceMotion.js.map +1 -0
- package/lib/module/atoms/Avatar.js +79 -8
- package/lib/module/atoms/Avatar.js.map +1 -1
- package/lib/module/atoms/Badge.js +17 -8
- package/lib/module/atoms/Badge.js.map +1 -1
- package/lib/module/atoms/Button.js +110 -41
- package/lib/module/atoms/Button.js.map +1 -1
- package/lib/module/atoms/Card.js +24 -2
- package/lib/module/atoms/Card.js.map +1 -1
- package/lib/module/atoms/Checkbox.js +42 -11
- package/lib/module/atoms/Checkbox.js.map +1 -1
- package/lib/module/atoms/Divider.js +31 -6
- package/lib/module/atoms/Divider.js.map +1 -1
- package/lib/module/atoms/EmptyState.js +58 -20
- package/lib/module/atoms/EmptyState.js.map +1 -1
- package/lib/module/atoms/Fab.js +33 -13
- package/lib/module/atoms/Fab.js.map +1 -1
- package/lib/module/atoms/Gradient.js +103 -37
- package/lib/module/atoms/Gradient.js.map +1 -1
- package/lib/module/atoms/IconButton.js +25 -4
- package/lib/module/atoms/IconButton.js.map +1 -1
- package/lib/module/atoms/Image.js +61 -25
- package/lib/module/atoms/Image.js.map +1 -1
- package/lib/module/atoms/Input.js +108 -20
- package/lib/module/atoms/Input.js.map +1 -1
- package/lib/module/atoms/KeyValueRow.js +37 -9
- package/lib/module/atoms/KeyValueRow.js.map +1 -1
- package/lib/module/atoms/PressableScale.js +25 -5
- package/lib/module/atoms/PressableScale.js.map +1 -1
- package/lib/module/atoms/ShinyText.js +29 -29
- package/lib/module/atoms/Skeleton.js +30 -13
- package/lib/module/atoms/Skeleton.js.map +1 -1
- package/lib/module/atoms/Spinner.js +82 -23
- package/lib/module/atoms/Spinner.js.map +1 -1
- package/lib/module/atoms/Text.js +56 -5
- package/lib/module/atoms/Text.js.map +1 -1
- package/lib/module/atoms/Transition.js +41 -42
- package/lib/module/atoms/Transition.js.map +1 -1
- package/lib/module/atoms/index.js +1 -1
- package/lib/module/atoms/index.js.map +1 -1
- package/lib/module/atoms/inputValidation.js +52 -0
- package/lib/module/atoms/inputValidation.js.map +1 -0
- package/lib/module/icons/Icon.js +4 -4
- package/lib/module/icons/defaultIcons.js +574 -24
- package/lib/module/icons/defaultIcons.js.map +1 -1
- package/lib/module/icons/index.js +1 -1
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/molecules/AvatarHeader.js +47 -14
- package/lib/module/molecules/AvatarHeader.js.map +1 -1
- package/lib/module/molecules/FormActions.js +25 -9
- package/lib/module/molecules/FormActions.js.map +1 -1
- package/lib/module/molecules/InfoRow.js +30 -14
- package/lib/module/molecules/InfoRow.js.map +1 -1
- package/lib/module/molecules/OptionCard.js +37 -22
- package/lib/module/molecules/OptionCard.js.map +1 -1
- package/lib/module/molecules/SegmentedControl.js +107 -18
- package/lib/module/molecules/SegmentedControl.js.map +1 -1
- package/lib/module/molecules/Stepper.js +63 -18
- package/lib/module/molecules/Stepper.js.map +1 -1
- package/lib/module/molecules/Steps.js +107 -43
- package/lib/module/molecules/Steps.js.map +1 -1
- package/lib/module/molecules/SymmetricGrid.js +26 -18
- package/lib/module/molecules/SymmetricGrid.js.map +1 -1
- package/lib/module/organisms/Alert.js +51 -37
- package/lib/module/organisms/Alert.js.map +1 -1
- package/lib/module/organisms/AlertProvider.js +10 -10
- package/lib/module/organisms/BottomSheet.js +142 -88
- package/lib/module/organisms/BottomSheet.js.map +1 -1
- package/lib/module/organisms/Chart.js +199 -158
- package/lib/module/organisms/Chart.js.map +1 -1
- package/lib/module/organisms/DateField.js +36 -20
- package/lib/module/organisms/DateField.js.map +1 -1
- package/lib/module/organisms/DatePicker.js +56 -33
- package/lib/module/organisms/DatePicker.js.map +1 -1
- package/lib/module/organisms/List.js +62 -34
- package/lib/module/organisms/List.js.map +1 -1
- package/lib/module/organisms/Modal.js +122 -84
- package/lib/module/organisms/Modal.js.map +1 -1
- package/lib/module/organisms/NavigationBar.js +64 -25
- package/lib/module/organisms/NavigationBar.js.map +1 -1
- package/lib/module/organisms/OptionWheel.js +64 -64
- package/lib/module/organisms/OptionWheel.js.map +1 -1
- package/lib/module/organisms/ReorderableList.js +48 -27
- package/lib/module/organisms/ReorderableList.js.map +1 -1
- package/lib/module/organisms/Screen.js +70 -37
- package/lib/module/organisms/Screen.js.map +1 -1
- package/lib/module/organisms/SearchList.js +56 -26
- package/lib/module/organisms/SearchList.js.map +1 -1
- package/lib/module/organisms/Select.js +46 -25
- package/lib/module/organisms/Select.js.map +1 -1
- package/lib/module/organisms/Slides.js +37 -24
- package/lib/module/organisms/Slides.js.map +1 -1
- package/lib/module/organisms/ThemeToggle.js +11 -10
- package/lib/module/organisms/ThemeToggle.js.map +1 -1
- package/lib/module/organisms/Timeline.js +73 -56
- package/lib/module/organisms/Timeline.js.map +1 -1
- package/lib/module/organisms/Toast.js +47 -16
- package/lib/module/organisms/Toast.js.map +1 -1
- package/lib/module/organisms/ToastProvider.js +15 -11
- package/lib/module/organisms/ToastProvider.js.map +1 -1
- package/lib/module/organisms/Wizard.js +41 -16
- package/lib/module/organisms/Wizard.js.map +1 -1
- package/lib/module/organisms/chart/frame.js +25 -25
- package/lib/module/organisms/chart/frame.js.map +1 -1
- package/lib/module/organisms/chart/marks.js +42 -42
- package/lib/module/organisms/chart/math.js +84 -85
- package/lib/module/organisms/chart/math.js.map +1 -1
- package/lib/module/organisms/chart/palette.js +28 -28
- package/lib/module/organisms/imperativeBridge.js +5 -5
- package/lib/module/organisms/imperativeBridge.js.map +1 -1
- package/lib/module/organisms/useSlides.js +53 -21
- package/lib/module/organisms/useSlides.js.map +1 -1
- package/lib/module/safe-area/SafeAreaUIProvider.js +10 -65
- package/lib/module/safe-area/SafeAreaUIProvider.js.map +1 -1
- package/lib/module/safe-area/index.js +1 -0
- package/lib/module/safe-area/index.js.map +1 -1
- package/lib/module/theme/KeyboardAvoidance.js +198 -0
- package/lib/module/theme/KeyboardAvoidance.js.map +1 -0
- package/lib/module/theme/NativeOverlay.js +257 -0
- package/lib/module/theme/NativeOverlay.js.map +1 -0
- package/lib/module/theme/UIProvider.js +88 -35
- package/lib/module/theme/UIProvider.js.map +1 -1
- package/lib/module/theme/colors.js +17 -17
- package/lib/module/theme/colors.js.map +1 -1
- package/lib/module/theme/createStyles.js +20 -16
- package/lib/module/theme/createStyles.js.map +1 -1
- package/lib/module/theme/createTheme.js +6 -6
- package/lib/module/theme/index.js +1 -1
- package/lib/module/theme/index.js.map +1 -1
- package/lib/module/theme/insets.js +1 -1
- package/lib/module/theme/labels.js +29 -1
- package/lib/module/theme/labels.js.map +1 -1
- package/lib/module/theme/palettes.js +25 -23
- package/lib/module/theme/palettes.js.map +1 -1
- package/lib/module/theme/tokens.js +27 -13
- package/lib/module/theme/tokens.js.map +1 -1
- package/lib/module/theme/useKeyboardField.js +33 -0
- package/lib/module/theme/useKeyboardField.js.map +1 -0
- package/lib/module/theme/useReduceMotion.js +28 -0
- package/lib/module/theme/useReduceMotion.js.map +1 -0
- package/lib/typescript/atoms/Avatar.d.ts +35 -5
- package/lib/typescript/atoms/Avatar.d.ts.map +1 -1
- package/lib/typescript/atoms/Badge.d.ts +14 -3
- package/lib/typescript/atoms/Badge.d.ts.map +1 -1
- package/lib/typescript/atoms/Button.d.ts +34 -3
- package/lib/typescript/atoms/Button.d.ts.map +1 -1
- package/lib/typescript/atoms/Card.d.ts +13 -2
- package/lib/typescript/atoms/Card.d.ts.map +1 -1
- package/lib/typescript/atoms/Checkbox.d.ts +26 -1
- package/lib/typescript/atoms/Checkbox.d.ts.map +1 -1
- package/lib/typescript/atoms/Divider.d.ts +18 -1
- package/lib/typescript/atoms/Divider.d.ts.map +1 -1
- package/lib/typescript/atoms/EmptyState.d.ts +30 -3
- package/lib/typescript/atoms/EmptyState.d.ts.map +1 -1
- package/lib/typescript/atoms/Fab.d.ts +24 -4
- package/lib/typescript/atoms/Fab.d.ts.map +1 -1
- package/lib/typescript/atoms/Gradient.d.ts +21 -15
- package/lib/typescript/atoms/Gradient.d.ts.map +1 -1
- package/lib/typescript/atoms/IconButton.d.ts +18 -4
- package/lib/typescript/atoms/IconButton.d.ts.map +1 -1
- package/lib/typescript/atoms/Image.d.ts +39 -17
- package/lib/typescript/atoms/Image.d.ts.map +1 -1
- package/lib/typescript/atoms/Input.d.ts +57 -7
- package/lib/typescript/atoms/Input.d.ts.map +1 -1
- package/lib/typescript/atoms/KeyValueRow.d.ts +16 -4
- package/lib/typescript/atoms/KeyValueRow.d.ts.map +1 -1
- package/lib/typescript/atoms/PressableScale.d.ts +12 -5
- package/lib/typescript/atoms/PressableScale.d.ts.map +1 -1
- package/lib/typescript/atoms/ShinyText.d.ts +17 -17
- package/lib/typescript/atoms/ShinyText.d.ts.map +1 -1
- package/lib/typescript/atoms/Skeleton.d.ts +12 -7
- package/lib/typescript/atoms/Skeleton.d.ts.map +1 -1
- package/lib/typescript/atoms/Spinner.d.ts +29 -1
- package/lib/typescript/atoms/Spinner.d.ts.map +1 -1
- package/lib/typescript/atoms/Text.d.ts +46 -0
- package/lib/typescript/atoms/Text.d.ts.map +1 -1
- package/lib/typescript/atoms/Transition.d.ts +19 -15
- package/lib/typescript/atoms/Transition.d.ts.map +1 -1
- package/lib/typescript/atoms/index.d.ts +3 -3
- package/lib/typescript/atoms/index.d.ts.map +1 -1
- package/lib/typescript/atoms/inputValidation.d.ts +29 -0
- package/lib/typescript/atoms/inputValidation.d.ts.map +1 -0
- package/lib/typescript/icons/Icon.d.ts +4 -4
- package/lib/typescript/icons/defaultIcons.d.ts +19 -2
- package/lib/typescript/icons/defaultIcons.d.ts.map +1 -1
- package/lib/typescript/icons/index.d.ts +2 -2
- package/lib/typescript/icons/index.d.ts.map +1 -1
- package/lib/typescript/icons/types.d.ts +13 -3
- package/lib/typescript/icons/types.d.ts.map +1 -1
- package/lib/typescript/molecules/AvatarHeader.d.ts +23 -4
- package/lib/typescript/molecules/AvatarHeader.d.ts.map +1 -1
- package/lib/typescript/molecules/FormActions.d.ts +21 -4
- package/lib/typescript/molecules/FormActions.d.ts.map +1 -1
- package/lib/typescript/molecules/InfoRow.d.ts +17 -3
- package/lib/typescript/molecules/InfoRow.d.ts.map +1 -1
- package/lib/typescript/molecules/OptionCard.d.ts +20 -5
- package/lib/typescript/molecules/OptionCard.d.ts.map +1 -1
- package/lib/typescript/molecules/SegmentedControl.d.ts +18 -2
- package/lib/typescript/molecules/SegmentedControl.d.ts.map +1 -1
- package/lib/typescript/molecules/Stepper.d.ts +23 -7
- package/lib/typescript/molecules/Stepper.d.ts.map +1 -1
- package/lib/typescript/molecules/Steps.d.ts +18 -4
- package/lib/typescript/molecules/Steps.d.ts.map +1 -1
- package/lib/typescript/molecules/SymmetricGrid.d.ts +15 -5
- package/lib/typescript/molecules/SymmetricGrid.d.ts.map +1 -1
- package/lib/typescript/organisms/Alert.d.ts +28 -2
- package/lib/typescript/organisms/Alert.d.ts.map +1 -1
- package/lib/typescript/organisms/AlertProvider.d.ts +10 -10
- package/lib/typescript/organisms/AlertProvider.d.ts.map +1 -1
- package/lib/typescript/organisms/BottomSheet.d.ts +20 -5
- package/lib/typescript/organisms/BottomSheet.d.ts.map +1 -1
- package/lib/typescript/organisms/Chart.d.ts +86 -75
- package/lib/typescript/organisms/Chart.d.ts.map +1 -1
- package/lib/typescript/organisms/DateField.d.ts +17 -3
- package/lib/typescript/organisms/DateField.d.ts.map +1 -1
- package/lib/typescript/organisms/DatePicker.d.ts +7 -11
- package/lib/typescript/organisms/DatePicker.d.ts.map +1 -1
- package/lib/typescript/organisms/List.d.ts +30 -3
- package/lib/typescript/organisms/List.d.ts.map +1 -1
- package/lib/typescript/organisms/Modal.d.ts +30 -3
- package/lib/typescript/organisms/Modal.d.ts.map +1 -1
- package/lib/typescript/organisms/NavigationBar.d.ts +26 -7
- package/lib/typescript/organisms/NavigationBar.d.ts.map +1 -1
- package/lib/typescript/organisms/OptionWheel.d.ts +20 -16
- package/lib/typescript/organisms/OptionWheel.d.ts.map +1 -1
- package/lib/typescript/organisms/ReorderableList.d.ts +20 -11
- package/lib/typescript/organisms/ReorderableList.d.ts.map +1 -1
- package/lib/typescript/organisms/Screen.d.ts +27 -8
- package/lib/typescript/organisms/Screen.d.ts.map +1 -1
- package/lib/typescript/organisms/SearchList.d.ts +46 -3
- package/lib/typescript/organisms/SearchList.d.ts.map +1 -1
- package/lib/typescript/organisms/Select.d.ts +26 -6
- package/lib/typescript/organisms/Select.d.ts.map +1 -1
- package/lib/typescript/organisms/Slides.d.ts +44 -26
- package/lib/typescript/organisms/Slides.d.ts.map +1 -1
- package/lib/typescript/organisms/ThemeToggle.d.ts +6 -2
- package/lib/typescript/organisms/ThemeToggle.d.ts.map +1 -1
- package/lib/typescript/organisms/Timeline.d.ts +26 -9
- package/lib/typescript/organisms/Timeline.d.ts.map +1 -1
- package/lib/typescript/organisms/Toast.d.ts +19 -4
- package/lib/typescript/organisms/Toast.d.ts.map +1 -1
- package/lib/typescript/organisms/ToastProvider.d.ts +8 -8
- package/lib/typescript/organisms/ToastProvider.d.ts.map +1 -1
- package/lib/typescript/organisms/Wizard.d.ts +24 -6
- package/lib/typescript/organisms/Wizard.d.ts.map +1 -1
- package/lib/typescript/organisms/chart/frame.d.ts +21 -21
- package/lib/typescript/organisms/chart/frame.d.ts.map +1 -1
- package/lib/typescript/organisms/chart/marks.d.ts +28 -28
- package/lib/typescript/organisms/chart/marks.d.ts.map +1 -1
- package/lib/typescript/organisms/chart/math.d.ts +69 -70
- package/lib/typescript/organisms/chart/math.d.ts.map +1 -1
- package/lib/typescript/organisms/chart/palette.d.ts +2 -2
- package/lib/typescript/organisms/chart/palette.d.ts.map +1 -1
- package/lib/typescript/organisms/imperativeBridge.d.ts +4 -4
- package/lib/typescript/organisms/useSlides.d.ts +8 -16
- package/lib/typescript/organisms/useSlides.d.ts.map +1 -1
- package/lib/typescript/safe-area/SafeAreaUIProvider.d.ts +9 -7
- package/lib/typescript/safe-area/SafeAreaUIProvider.d.ts.map +1 -1
- package/lib/typescript/safe-area/index.d.ts.map +1 -1
- package/lib/typescript/theme/KeyboardAvoidance.d.ts +62 -0
- package/lib/typescript/theme/KeyboardAvoidance.d.ts.map +1 -0
- package/lib/typescript/theme/NativeOverlay.d.ts +43 -0
- package/lib/typescript/theme/NativeOverlay.d.ts.map +1 -0
- package/lib/typescript/theme/UIProvider.d.ts +38 -20
- package/lib/typescript/theme/UIProvider.d.ts.map +1 -1
- package/lib/typescript/theme/colors.d.ts +13 -13
- package/lib/typescript/theme/colors.d.ts.map +1 -1
- package/lib/typescript/theme/createStyles.d.ts +20 -14
- package/lib/typescript/theme/createStyles.d.ts.map +1 -1
- package/lib/typescript/theme/createTheme.d.ts +5 -5
- package/lib/typescript/theme/index.d.ts +1 -1
- package/lib/typescript/theme/index.d.ts.map +1 -1
- package/lib/typescript/theme/insets.d.ts +1 -1
- package/lib/typescript/theme/insets.d.ts.map +1 -1
- package/lib/typescript/theme/labels.d.ts +57 -2
- package/lib/typescript/theme/labels.d.ts.map +1 -1
- package/lib/typescript/theme/palettes.d.ts +25 -19
- package/lib/typescript/theme/palettes.d.ts.map +1 -1
- package/lib/typescript/theme/tokens.d.ts +15 -8
- package/lib/typescript/theme/tokens.d.ts.map +1 -1
- package/lib/typescript/theme/types.d.ts +7 -7
- package/lib/typescript/theme/types.d.ts.map +1 -1
- package/lib/typescript/theme/useKeyboardField.d.ts +17 -0
- package/lib/typescript/theme/useKeyboardField.d.ts.map +1 -0
- package/lib/typescript/theme/useReduceMotion.d.ts +7 -0
- package/lib/typescript/theme/useReduceMotion.d.ts.map +1 -0
- package/llms.txt +4 -4
- package/package.json +15 -14
- package/registry/alert-provider.json +4 -3
- package/registry/alert.json +3 -2
- package/registry/avatar-header.json +1 -1
- package/registry/avatar.json +3 -2
- package/registry/badge.json +1 -1
- package/registry/bottom-sheet.json +1 -1
- package/registry/button.json +3 -2
- package/registry/card.json +1 -1
- package/registry/chart.json +5 -5
- package/registry/checkbox.json +3 -2
- package/registry/core.json +31 -15
- package/registry/date-field.json +1 -1
- package/registry/date-picker.json +3 -2
- package/registry/divider.json +1 -1
- package/registry/empty-state.json +4 -2
- package/registry/fab.json +3 -2
- package/registry/form-actions.json +3 -2
- package/registry/gradient.json +1 -1
- package/registry/icon-button.json +3 -2
- package/registry/image.json +1 -1
- package/registry/index.json +79 -61
- package/registry/info-row.json +1 -1
- package/registry/input.json +5 -1
- package/registry/key-value-row.json +1 -1
- package/registry/list.json +3 -1
- package/registry/manifest.json +3 -1
- package/registry/modal.json +1 -1
- package/registry/navigation-bar.json +1 -1
- package/registry/option-card.json +3 -2
- package/registry/option-wheel.json +1 -1
- package/registry/pressable-scale.json +3 -2
- package/registry/reorderable-list.json +1 -1
- package/registry/screen.json +1 -1
- package/registry/search-list.json +7 -1
- package/registry/segmented-control.json +1 -1
- package/registry/select.json +1 -1
- package/registry/shiny-text.json +1 -1
- package/registry/skeleton.json +3 -2
- package/registry/slides.json +2 -2
- package/registry/spinner.json +1 -1
- package/registry/stepper.json +1 -1
- package/registry/steps.json +1 -1
- package/registry/symmetric-grid.json +1 -1
- package/registry/theme-toggle.json +1 -1
- package/registry/timeline.json +1 -1
- package/registry/title.json +1 -1
- package/registry/toast-provider.json +2 -2
- package/registry/toast.json +1 -1
- package/registry/transition.json +1 -1
- package/registry/wizard.json +1 -1
- package/src/atoms/Avatar.tsx +117 -26
- package/src/atoms/Badge.tsx +20 -9
- package/src/atoms/Button.tsx +102 -30
- package/src/atoms/Card.tsx +23 -3
- package/src/atoms/Checkbox.tsx +49 -12
- package/src/atoms/Divider.tsx +34 -4
- package/src/atoms/EmptyState.tsx +63 -16
- package/src/atoms/Fab.tsx +56 -9
- package/src/atoms/Gradient.tsx +92 -41
- package/src/atoms/IconButton.tsx +27 -4
- package/src/atoms/Image.tsx +74 -28
- package/src/atoms/Input.tsx +129 -19
- package/src/atoms/KeyValueRow.tsx +72 -28
- package/src/atoms/PressableScale.tsx +31 -7
- package/src/atoms/ShinyText.tsx +31 -31
- package/src/atoms/Skeleton.tsx +37 -17
- package/src/atoms/Spinner.tsx +87 -24
- package/src/atoms/Text.tsx +66 -6
- package/src/atoms/Transition.tsx +40 -44
- package/src/atoms/index.ts +3 -3
- package/src/atoms/inputValidation.ts +59 -0
- package/src/icons/Icon.tsx +4 -4
- package/src/icons/defaultIcons.tsx +445 -22
- package/src/icons/index.ts +2 -2
- package/src/icons/types.ts +26 -4
- package/src/molecules/AvatarHeader.tsx +88 -34
- package/src/molecules/FormActions.tsx +36 -6
- package/src/molecules/InfoRow.tsx +39 -12
- package/src/molecules/OptionCard.tsx +55 -20
- package/src/molecules/SegmentedControl.tsx +135 -15
- package/src/molecules/Stepper.tsx +73 -19
- package/src/molecules/Steps.tsx +121 -39
- package/src/molecules/SymmetricGrid.tsx +28 -12
- package/src/organisms/Alert.tsx +97 -26
- package/src/organisms/AlertProvider.tsx +13 -13
- package/src/organisms/BottomSheet.tsx +115 -43
- package/src/organisms/Chart.tsx +223 -165
- package/src/organisms/DateField.tsx +40 -15
- package/src/organisms/DatePicker.tsx +53 -32
- package/src/organisms/List.tsx +64 -15
- package/src/organisms/Modal.tsx +122 -63
- package/src/organisms/NavigationBar.tsx +73 -23
- package/src/organisms/OptionWheel.tsx +70 -66
- package/src/organisms/ReorderableList.tsx +49 -27
- package/src/organisms/Screen.tsx +79 -42
- package/src/organisms/SearchList.tsx +84 -20
- package/src/organisms/Select.tsx +63 -29
- package/src/organisms/Slides.tsx +63 -44
- package/src/organisms/ThemeToggle.tsx +15 -6
- package/src/organisms/Timeline.tsx +79 -62
- package/src/organisms/Toast.tsx +50 -15
- package/src/organisms/ToastProvider.tsx +17 -13
- package/src/organisms/Wizard.tsx +58 -21
- package/src/organisms/chart/frame.tsx +35 -35
- package/src/organisms/chart/marks.tsx +53 -53
- package/src/organisms/chart/math.ts +93 -94
- package/src/organisms/chart/palette.ts +28 -28
- package/src/organisms/imperativeBridge.ts +5 -5
- package/src/organisms/useSlides.ts +66 -31
- package/src/safe-area/SafeAreaUIProvider.tsx +9 -70
- package/src/safe-area/index.ts +1 -0
- package/src/theme/KeyboardAvoidance.tsx +216 -0
- package/src/theme/NativeOverlay.tsx +269 -0
- package/src/theme/UIProvider.tsx +109 -46
- package/src/theme/colors.ts +21 -21
- package/src/theme/createStyles.ts +23 -19
- package/src/theme/createTheme.ts +6 -6
- package/src/theme/index.ts +1 -1
- package/src/theme/insets.ts +1 -1
- package/src/theme/labels.ts +85 -2
- package/src/theme/palettes.ts +33 -25
- package/src/theme/tokens.ts +27 -13
- package/src/theme/types.ts +7 -7
- package/src/theme/useKeyboardField.ts +33 -0
- package/src/theme/useReduceMotion.ts +27 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Labels } from '../theme/labels';
|
|
2
|
+
|
|
3
|
+
/** A rule's value, optionally with its own message instead of the default label. */
|
|
4
|
+
export type InputRuleValue<T> = T | { value: T; message: string };
|
|
5
|
+
|
|
6
|
+
export interface InputRules {
|
|
7
|
+
/** Fewer characters than this is an error. Message: `labels.minLengthError`. */
|
|
8
|
+
minLength?: InputRuleValue<number>;
|
|
9
|
+
/** More characters than this is an error. Message: `labels.maxLengthError`. */
|
|
10
|
+
maxLength?: InputRuleValue<number>;
|
|
11
|
+
/** The value must match. Message: `labels.patternError`. */
|
|
12
|
+
pattern?: InputRuleValue<RegExp>;
|
|
13
|
+
/**
|
|
14
|
+
* Custom check, run last. Return an error message, or `false` for
|
|
15
|
+
* `labels.patternError`; anything else means valid.
|
|
16
|
+
*/
|
|
17
|
+
validate?: (value: string) => string | boolean | null | undefined;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function unpack<T>(rule: InputRuleValue<T>): { value: T; message?: string } {
|
|
21
|
+
return typeof rule === 'object' && rule !== null && 'value' in rule && 'message' in rule
|
|
22
|
+
? (rule as { value: T; message: string })
|
|
23
|
+
: { value: rule as T };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Error for the value, or undefined if it is valid. Order: required, min
|
|
28
|
+
* length, max length, pattern, custom validation — a single error is shown,
|
|
29
|
+
* the first one. An empty optional field is valid: the other rules don't run on nothing.
|
|
30
|
+
*/
|
|
31
|
+
export function validateInputValue(
|
|
32
|
+
value: string,
|
|
33
|
+
{ required, rules }: { required?: boolean; rules?: InputRules },
|
|
34
|
+
labels: Labels
|
|
35
|
+
): string | undefined {
|
|
36
|
+
if (value.trim() === '') return required ? labels.requiredError : undefined;
|
|
37
|
+
if (!rules) return undefined;
|
|
38
|
+
|
|
39
|
+
if (rules.minLength !== undefined) {
|
|
40
|
+
const { value: n, message } = unpack(rules.minLength);
|
|
41
|
+
if (value.length < n) return message ?? labels.minLengthError.replace('{n}', String(n));
|
|
42
|
+
}
|
|
43
|
+
if (rules.maxLength !== undefined) {
|
|
44
|
+
const { value: n, message } = unpack(rules.maxLength);
|
|
45
|
+
if (value.length > n) return message ?? labels.maxLengthError.replace('{n}', String(n));
|
|
46
|
+
}
|
|
47
|
+
if (rules.pattern !== undefined) {
|
|
48
|
+
const { value: re, message } = unpack(rules.pattern);
|
|
49
|
+
// A RegExp with the `g` flag keeps lastIndex between calls: reset it.
|
|
50
|
+
re.lastIndex = 0;
|
|
51
|
+
if (!re.test(value)) return message ?? labels.patternError;
|
|
52
|
+
}
|
|
53
|
+
if (rules.validate) {
|
|
54
|
+
const result = rules.validate(value);
|
|
55
|
+
if (typeof result === 'string' && result !== '') return result;
|
|
56
|
+
if (result === false) return labels.patternError;
|
|
57
|
+
}
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
package/src/icons/Icon.tsx
CHANGED
|
@@ -12,10 +12,10 @@ export interface IconProps {
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Icon
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* Resolves the glyph through the active renderer (UIProvider.icons, the
|
|
16
|
+
* zero-dep default if none was configured). Internal use by the library —
|
|
17
|
+
* public components expose `icon?: ReactNode` in addition to this, so the
|
|
18
|
+
* consumer can inject any icon without going through the name system.
|
|
19
19
|
*/
|
|
20
20
|
export const Icon = memo(({ name, size = 20, color, style }: IconProps) => {
|
|
21
21
|
const colors = useColors();
|
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
import { Text, View } from 'react-native';
|
|
3
|
-
import type { IconName, IconRenderProps } from './types';
|
|
3
|
+
import type { BuiltInIconName, IconName, IconRenderProps } from './types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* Default glyphs drawn with RN primitives (View + border + transform).
|
|
7
|
+
* Zero dependencies, zero fonts, zero async loading. They cover what the
|
|
8
|
+
* library needs internally (checkbox, Select chevrons, password toggle in
|
|
9
|
+
* Input, etc) plus a basic set for apps (menu, home, user…).
|
|
10
|
+
* For a complete set, the consumer injects their own via
|
|
11
|
+
* <UIProvider icons={...}> or the `icon` prop.
|
|
11
12
|
*/
|
|
12
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Color of the inner glyph of a filled icon (alert, warning): black or
|
|
16
|
+
* white depending on the fill's luminance. A fixed white disappeared over
|
|
17
|
+
* dark mode's light fills (figure and ground). Non-hex colors (rgb(),
|
|
18
|
+
* names) fall back to white, the common case over saturated accents.
|
|
19
|
+
*/
|
|
20
|
+
export function onColor(fill: string): string {
|
|
21
|
+
const hex = fill.trim().replace('#', '');
|
|
22
|
+
const full = hex.length === 3 ? hex.split('').map((c) => c + c).join('') : hex.slice(0, 6);
|
|
23
|
+
if (!/^[0-9a-fA-F]{6}$/.test(full)) return '#fff';
|
|
24
|
+
const channel = (i: number) => {
|
|
25
|
+
const c = parseInt(full.slice(i, i + 2), 16) / 255;
|
|
26
|
+
return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
27
|
+
};
|
|
28
|
+
const r = channel(0);
|
|
29
|
+
const g = channel(2);
|
|
30
|
+
const b = channel(4);
|
|
31
|
+
const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
32
|
+
// Threshold where contrast with black exceeds contrast with white.
|
|
33
|
+
return luminance > 0.179 ? '#000' : '#fff';
|
|
34
|
+
}
|
|
35
|
+
|
|
13
36
|
const Chevron = memo(({ size, color, direction }: IconRenderProps & { direction: 'up' | 'down' | 'left' | 'right' }) => {
|
|
14
37
|
const strokeWidth = Math.max(1.5, size / 12);
|
|
15
38
|
const arm = size * 0.32;
|
|
@@ -116,13 +139,13 @@ const PlusMinus = memo(({ size, color, minusOnly }: IconRenderProps & { minusOnl
|
|
|
116
139
|
PlusMinus.displayName = 'PlusMinus';
|
|
117
140
|
|
|
118
141
|
/**
|
|
119
|
-
*
|
|
142
|
+
* Circle with a typographic glyph inside (!, i, ?).
|
|
120
143
|
*
|
|
121
|
-
*
|
|
122
|
-
* Views:
|
|
123
|
-
* "
|
|
124
|
-
*
|
|
125
|
-
*
|
|
144
|
+
* Uses <Text> with the system font instead of composing the glyph from
|
|
145
|
+
* Views: it is still zero-dependency (it loads no font), and "i" vs "!" vs
|
|
146
|
+
* "?" stay unambiguous. Drawing them with bars and dots gave an "info"
|
|
147
|
+
* identical to an inverted "!", which is exactly what an information icon
|
|
148
|
+
* must not convey.
|
|
126
149
|
*/
|
|
127
150
|
const Circle = memo(
|
|
128
151
|
({ size, color, filled, label }: IconRenderProps & { filled?: boolean; label?: string }) => {
|
|
@@ -144,7 +167,7 @@ const Circle = memo(
|
|
|
144
167
|
<Text
|
|
145
168
|
allowFontScaling={false}
|
|
146
169
|
style={{
|
|
147
|
-
color: filled ?
|
|
170
|
+
color: filled ? onColor(color) : color,
|
|
148
171
|
fontSize: size * 0.62,
|
|
149
172
|
lineHeight: size * 0.74,
|
|
150
173
|
fontWeight: '700',
|
|
@@ -207,17 +230,17 @@ Eye.displayName = 'Eye';
|
|
|
207
230
|
|
|
208
231
|
const Search = memo(({ size, color }: IconRenderProps) => {
|
|
209
232
|
const strokeWidth = Math.max(1.5, size / 9);
|
|
210
|
-
//
|
|
211
|
-
//
|
|
212
|
-
//
|
|
213
|
-
//
|
|
233
|
+
// Large lens (72% of the height) at the top-left and a short handle coming
|
|
234
|
+
// out of its bottom-right edge along the 45° diagonal. The proportions matter
|
|
235
|
+
// at small sizes (16-20px): with a small lens and a long handle the glyph
|
|
236
|
+
// reads as a comma, not a magnifying glass.
|
|
214
237
|
const lensD = size * 0.72;
|
|
215
238
|
const lensR = lensD / 2;
|
|
216
239
|
const handleLen = size * 0.34;
|
|
217
240
|
const diag = Math.SQRT1_2; // cos(45°) === sin(45°)
|
|
218
|
-
//
|
|
219
|
-
//
|
|
220
|
-
//
|
|
241
|
+
// The handle is centered on the diagonal, starting right at the lens's
|
|
242
|
+
// edge: distance = radius + half the handle, minus a half-stroke overlap
|
|
243
|
+
// so no gap is left between edge and handle.
|
|
221
244
|
const dist = lensR + handleLen / 2 - strokeWidth / 2;
|
|
222
245
|
const cx = lensR + dist * diag;
|
|
223
246
|
const cy = lensR + dist * diag;
|
|
@@ -253,7 +276,379 @@ const Search = memo(({ size, color }: IconRenderProps) => {
|
|
|
253
276
|
});
|
|
254
277
|
Search.displayName = 'Search';
|
|
255
278
|
|
|
256
|
-
|
|
279
|
+
// ── Basic set for apps ─────────────────────────────────────────────────────
|
|
280
|
+
// Same rules as the rest: only View/Text, stroke proportional to the size
|
|
281
|
+
// (`size / 10`, minimum 1.5) and a square `size` box, so they all line up
|
|
282
|
+
// the same way in a row (Gestalt, similarity).
|
|
283
|
+
|
|
284
|
+
const stroke = (size: number) => Math.max(1.5, size / 10);
|
|
285
|
+
const box = (size: number) => ({ width: size, height: size, alignItems: 'center' as const, justifyContent: 'center' as const });
|
|
286
|
+
|
|
287
|
+
const Menu = memo(({ size, color }: IconRenderProps) => {
|
|
288
|
+
const sw = stroke(size);
|
|
289
|
+
const bar = { width: size * 0.7, height: sw, borderRadius: sw / 2, backgroundColor: color };
|
|
290
|
+
return (
|
|
291
|
+
<View style={[box(size), { gap: size * 0.16 }]}>
|
|
292
|
+
<View style={bar} />
|
|
293
|
+
<View style={bar} />
|
|
294
|
+
<View style={bar} />
|
|
295
|
+
</View>
|
|
296
|
+
);
|
|
297
|
+
});
|
|
298
|
+
Menu.displayName = 'Menu';
|
|
299
|
+
|
|
300
|
+
const Scan = memo(({ size, color }: IconRenderProps) => {
|
|
301
|
+
const sw = stroke(size);
|
|
302
|
+
const arm = size * 0.26;
|
|
303
|
+
const inset = size * 0.1;
|
|
304
|
+
const corner = (v: 'top' | 'bottom', h: 'left' | 'right') => ({
|
|
305
|
+
position: 'absolute' as const,
|
|
306
|
+
[v]: inset,
|
|
307
|
+
[h]: inset,
|
|
308
|
+
width: arm,
|
|
309
|
+
height: arm,
|
|
310
|
+
borderColor: color,
|
|
311
|
+
[v === 'top' ? 'borderTopWidth' : 'borderBottomWidth']: sw,
|
|
312
|
+
[h === 'left' ? 'borderLeftWidth' : 'borderRightWidth']: sw,
|
|
313
|
+
});
|
|
314
|
+
return (
|
|
315
|
+
<View style={box(size)}>
|
|
316
|
+
{/* Viewfinder: four corner brackets and the scan line across the middle. */}
|
|
317
|
+
<View style={corner('top', 'left')} />
|
|
318
|
+
<View style={corner('top', 'right')} />
|
|
319
|
+
<View style={corner('bottom', 'left')} />
|
|
320
|
+
<View style={corner('bottom', 'right')} />
|
|
321
|
+
<View style={{ width: size * 0.6, height: sw, borderRadius: sw / 2, backgroundColor: color }} />
|
|
322
|
+
</View>
|
|
323
|
+
);
|
|
324
|
+
});
|
|
325
|
+
Scan.displayName = 'Scan';
|
|
326
|
+
|
|
327
|
+
const More = memo(({ size, color }: IconRenderProps) => {
|
|
328
|
+
const d = Math.max(3, size * 0.16);
|
|
329
|
+
const dot = { width: d, height: d, borderRadius: d / 2, backgroundColor: color };
|
|
330
|
+
return (
|
|
331
|
+
<View style={[box(size), { flexDirection: 'row', gap: size * 0.12 }]}>
|
|
332
|
+
<View style={dot} />
|
|
333
|
+
<View style={dot} />
|
|
334
|
+
<View style={dot} />
|
|
335
|
+
</View>
|
|
336
|
+
);
|
|
337
|
+
});
|
|
338
|
+
More.displayName = 'More';
|
|
339
|
+
|
|
340
|
+
const Home = memo(({ size, color }: IconRenderProps) => {
|
|
341
|
+
const sw = stroke(size);
|
|
342
|
+
const roof = size * 0.5;
|
|
343
|
+
return (
|
|
344
|
+
<View style={box(size)}>
|
|
345
|
+
{/* Roof: a square with two borders, rotated 45°. */}
|
|
346
|
+
<View
|
|
347
|
+
style={{
|
|
348
|
+
position: 'absolute',
|
|
349
|
+
top: size * 0.14,
|
|
350
|
+
width: roof,
|
|
351
|
+
height: roof,
|
|
352
|
+
borderTopWidth: sw,
|
|
353
|
+
borderLeftWidth: sw,
|
|
354
|
+
borderColor: color,
|
|
355
|
+
transform: [{ rotate: '45deg' }],
|
|
356
|
+
}}
|
|
357
|
+
/>
|
|
358
|
+
{/* Body: walls and floor. */}
|
|
359
|
+
<View
|
|
360
|
+
style={{
|
|
361
|
+
position: 'absolute',
|
|
362
|
+
bottom: size * 0.12,
|
|
363
|
+
width: size * 0.56,
|
|
364
|
+
height: size * 0.4,
|
|
365
|
+
borderLeftWidth: sw,
|
|
366
|
+
borderRightWidth: sw,
|
|
367
|
+
borderBottomWidth: sw,
|
|
368
|
+
borderColor: color,
|
|
369
|
+
}}
|
|
370
|
+
/>
|
|
371
|
+
</View>
|
|
372
|
+
);
|
|
373
|
+
});
|
|
374
|
+
Home.displayName = 'Home';
|
|
375
|
+
|
|
376
|
+
const Settings = memo(({ size, color }: IconRenderProps) => {
|
|
377
|
+
const sw = stroke(size);
|
|
378
|
+
const ring = size * 0.5;
|
|
379
|
+
const tooth = { width: size * 0.16, height: size * 0.2, backgroundColor: color, borderRadius: sw / 2 };
|
|
380
|
+
return (
|
|
381
|
+
<View style={box(size)}>
|
|
382
|
+
{[0, 45, 90, 135, 180, 225, 270, 315].map((deg) => (
|
|
383
|
+
<View key={deg} style={[box(size), { position: 'absolute', transform: [{ rotate: `${deg}deg` }] }]}>
|
|
384
|
+
<View style={[tooth, { position: 'absolute', top: size * 0.08 }]} />
|
|
385
|
+
</View>
|
|
386
|
+
))}
|
|
387
|
+
<View style={{ width: ring, height: ring, borderRadius: ring / 2, borderWidth: sw * 1.6, borderColor: color }} />
|
|
388
|
+
</View>
|
|
389
|
+
);
|
|
390
|
+
});
|
|
391
|
+
Settings.displayName = 'Settings';
|
|
392
|
+
|
|
393
|
+
const User = memo(({ size, color }: IconRenderProps) => {
|
|
394
|
+
const sw = stroke(size);
|
|
395
|
+
const head = size * 0.38;
|
|
396
|
+
return (
|
|
397
|
+
<View style={box(size)}>
|
|
398
|
+
<View
|
|
399
|
+
style={{
|
|
400
|
+
position: 'absolute',
|
|
401
|
+
top: size * 0.08,
|
|
402
|
+
width: head,
|
|
403
|
+
height: head,
|
|
404
|
+
borderRadius: head / 2,
|
|
405
|
+
borderWidth: sw,
|
|
406
|
+
borderColor: color,
|
|
407
|
+
}}
|
|
408
|
+
/>
|
|
409
|
+
{/* Shoulders: half an ellipse open at the bottom. */}
|
|
410
|
+
<View
|
|
411
|
+
style={{
|
|
412
|
+
position: 'absolute',
|
|
413
|
+
bottom: size * 0.08,
|
|
414
|
+
width: size * 0.74,
|
|
415
|
+
height: size * 0.34,
|
|
416
|
+
borderTopLeftRadius: size * 0.37,
|
|
417
|
+
borderTopRightRadius: size * 0.37,
|
|
418
|
+
borderTopWidth: sw,
|
|
419
|
+
borderLeftWidth: sw,
|
|
420
|
+
borderRightWidth: sw,
|
|
421
|
+
borderColor: color,
|
|
422
|
+
}}
|
|
423
|
+
/>
|
|
424
|
+
</View>
|
|
425
|
+
);
|
|
426
|
+
});
|
|
427
|
+
User.displayName = 'User';
|
|
428
|
+
|
|
429
|
+
const Trash = memo(({ size, color }: IconRenderProps) => {
|
|
430
|
+
const sw = stroke(size);
|
|
431
|
+
const bodyW = size * 0.52;
|
|
432
|
+
const bodyH = size * 0.56;
|
|
433
|
+
return (
|
|
434
|
+
<View style={box(size)}>
|
|
435
|
+
{/* Handle and lid. */}
|
|
436
|
+
<View
|
|
437
|
+
style={{
|
|
438
|
+
position: 'absolute',
|
|
439
|
+
top: size * 0.08,
|
|
440
|
+
width: size * 0.26,
|
|
441
|
+
height: size * 0.12,
|
|
442
|
+
borderTopWidth: sw,
|
|
443
|
+
borderLeftWidth: sw,
|
|
444
|
+
borderRightWidth: sw,
|
|
445
|
+
borderColor: color,
|
|
446
|
+
}}
|
|
447
|
+
/>
|
|
448
|
+
<View
|
|
449
|
+
style={{
|
|
450
|
+
position: 'absolute',
|
|
451
|
+
top: size * 0.19,
|
|
452
|
+
width: size * 0.72,
|
|
453
|
+
height: sw,
|
|
454
|
+
borderRadius: sw / 2,
|
|
455
|
+
backgroundColor: color,
|
|
456
|
+
}}
|
|
457
|
+
/>
|
|
458
|
+
{/* Body with two slots. */}
|
|
459
|
+
<View
|
|
460
|
+
style={{
|
|
461
|
+
position: 'absolute',
|
|
462
|
+
bottom: size * 0.08,
|
|
463
|
+
width: bodyW,
|
|
464
|
+
height: bodyH,
|
|
465
|
+
borderLeftWidth: sw,
|
|
466
|
+
borderRightWidth: sw,
|
|
467
|
+
borderBottomWidth: sw,
|
|
468
|
+
borderBottomLeftRadius: sw * 1.5,
|
|
469
|
+
borderBottomRightRadius: sw * 1.5,
|
|
470
|
+
borderColor: color,
|
|
471
|
+
flexDirection: 'row',
|
|
472
|
+
justifyContent: 'center',
|
|
473
|
+
alignItems: 'center',
|
|
474
|
+
gap: bodyW * 0.22,
|
|
475
|
+
}}
|
|
476
|
+
>
|
|
477
|
+
<View style={{ width: sw * 0.8, height: bodyH * 0.55, backgroundColor: color, borderRadius: sw / 2 }} />
|
|
478
|
+
<View style={{ width: sw * 0.8, height: bodyH * 0.55, backgroundColor: color, borderRadius: sw / 2 }} />
|
|
479
|
+
</View>
|
|
480
|
+
</View>
|
|
481
|
+
);
|
|
482
|
+
});
|
|
483
|
+
Trash.displayName = 'Trash';
|
|
484
|
+
|
|
485
|
+
const Edit = memo(({ size, color }: IconRenderProps) => {
|
|
486
|
+
const sw = stroke(size);
|
|
487
|
+
return (
|
|
488
|
+
<View style={box(size)}>
|
|
489
|
+
{/* Pencil: outlined body, rotated 45°, with the tip pointing down-left. */}
|
|
490
|
+
<View style={{ alignItems: 'center', transform: [{ rotate: '45deg' }, { translateY: -size * 0.02 }] }}>
|
|
491
|
+
<View
|
|
492
|
+
style={{
|
|
493
|
+
width: size * 0.3,
|
|
494
|
+
height: size * 0.66,
|
|
495
|
+
borderWidth: sw,
|
|
496
|
+
borderColor: color,
|
|
497
|
+
borderTopLeftRadius: sw,
|
|
498
|
+
borderTopRightRadius: sw,
|
|
499
|
+
}}
|
|
500
|
+
/>
|
|
501
|
+
<View
|
|
502
|
+
style={{
|
|
503
|
+
width: 0,
|
|
504
|
+
height: 0,
|
|
505
|
+
borderLeftWidth: size * 0.15,
|
|
506
|
+
borderRightWidth: size * 0.15,
|
|
507
|
+
borderTopWidth: size * 0.22,
|
|
508
|
+
borderLeftColor: 'transparent',
|
|
509
|
+
borderRightColor: 'transparent',
|
|
510
|
+
borderTopColor: color,
|
|
511
|
+
}}
|
|
512
|
+
/>
|
|
513
|
+
</View>
|
|
514
|
+
</View>
|
|
515
|
+
);
|
|
516
|
+
});
|
|
517
|
+
Edit.displayName = 'Edit';
|
|
518
|
+
|
|
519
|
+
const Share = memo(({ size, color }: IconRenderProps) => {
|
|
520
|
+
const sw = stroke(size);
|
|
521
|
+
const arm = size * 0.26;
|
|
522
|
+
return (
|
|
523
|
+
<View style={box(size)}>
|
|
524
|
+
{/* Box open at the top. */}
|
|
525
|
+
<View
|
|
526
|
+
style={{
|
|
527
|
+
position: 'absolute',
|
|
528
|
+
bottom: size * 0.08,
|
|
529
|
+
width: size * 0.64,
|
|
530
|
+
height: size * 0.42,
|
|
531
|
+
borderLeftWidth: sw,
|
|
532
|
+
borderRightWidth: sw,
|
|
533
|
+
borderBottomWidth: sw,
|
|
534
|
+
borderBottomLeftRadius: sw * 1.5,
|
|
535
|
+
borderBottomRightRadius: sw * 1.5,
|
|
536
|
+
borderColor: color,
|
|
537
|
+
}}
|
|
538
|
+
/>
|
|
539
|
+
{/* Arrow pointing up, coming out of the box. */}
|
|
540
|
+
<View
|
|
541
|
+
style={{
|
|
542
|
+
position: 'absolute',
|
|
543
|
+
top: size * 0.1,
|
|
544
|
+
width: sw,
|
|
545
|
+
height: size * 0.56,
|
|
546
|
+
backgroundColor: color,
|
|
547
|
+
borderRadius: sw / 2,
|
|
548
|
+
}}
|
|
549
|
+
/>
|
|
550
|
+
<View
|
|
551
|
+
style={{
|
|
552
|
+
position: 'absolute',
|
|
553
|
+
top: size * 0.12,
|
|
554
|
+
width: arm,
|
|
555
|
+
height: arm,
|
|
556
|
+
borderTopWidth: sw,
|
|
557
|
+
borderLeftWidth: sw,
|
|
558
|
+
borderColor: color,
|
|
559
|
+
transform: [{ rotate: '45deg' }],
|
|
560
|
+
}}
|
|
561
|
+
/>
|
|
562
|
+
</View>
|
|
563
|
+
);
|
|
564
|
+
});
|
|
565
|
+
Share.displayName = 'Share';
|
|
566
|
+
|
|
567
|
+
const Heart = memo(({ size, color }: IconRenderProps) => {
|
|
568
|
+
// Two circles over a square rotated 45°: the classic shape, filled.
|
|
569
|
+
const s = size * 0.46;
|
|
570
|
+
const lobe = { position: 'absolute' as const, width: s, height: s, borderRadius: s / 2, backgroundColor: color };
|
|
571
|
+
return (
|
|
572
|
+
<View style={box(size)}>
|
|
573
|
+
<View style={{ width: s, height: s, transform: [{ translateY: size * 0.05 }, { rotate: '45deg' }] }}>
|
|
574
|
+
<View style={{ position: 'absolute', width: s, height: s, backgroundColor: color }} />
|
|
575
|
+
<View style={[lobe, { left: -s / 2 }]} />
|
|
576
|
+
<View style={[lobe, { top: -s / 2 }]} />
|
|
577
|
+
</View>
|
|
578
|
+
</View>
|
|
579
|
+
);
|
|
580
|
+
});
|
|
581
|
+
Heart.displayName = 'Heart';
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Star: typographic glyph (★, U+2605) like Circle's. A five-pointed star
|
|
585
|
+
* can't be composed well from rectangles; the variation selector U+FE0E
|
|
586
|
+
* forces the text version (monochrome, in the requested color) instead of
|
|
587
|
+
* the emoji.
|
|
588
|
+
*/
|
|
589
|
+
const Star = memo(({ size, color }: IconRenderProps) => (
|
|
590
|
+
<View style={box(size)}>
|
|
591
|
+
<Text
|
|
592
|
+
allowFontScaling={false}
|
|
593
|
+
style={{ color, fontSize: size * 0.95, lineHeight: size, textAlign: 'center', includeFontPadding: false }}
|
|
594
|
+
>
|
|
595
|
+
{'\u2605\uFE0E'}
|
|
596
|
+
</Text>
|
|
597
|
+
</View>
|
|
598
|
+
));
|
|
599
|
+
Star.displayName = 'Star';
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Warning: filled triangle with a "!" (not a circle like `alert`), so that
|
|
603
|
+
* warning and error aren't told apart by color alone.
|
|
604
|
+
*/
|
|
605
|
+
const WarningTriangle = memo(({ size, color }: IconRenderProps) => {
|
|
606
|
+
const half = size * 0.5;
|
|
607
|
+
const height = size * 0.88;
|
|
608
|
+
return (
|
|
609
|
+
<View style={box(size)}>
|
|
610
|
+
<View
|
|
611
|
+
style={{
|
|
612
|
+
width: 0,
|
|
613
|
+
height: 0,
|
|
614
|
+
borderLeftWidth: half,
|
|
615
|
+
borderRightWidth: half,
|
|
616
|
+
borderBottomWidth: height,
|
|
617
|
+
borderLeftColor: 'transparent',
|
|
618
|
+
borderRightColor: 'transparent',
|
|
619
|
+
borderBottomColor: color,
|
|
620
|
+
}}
|
|
621
|
+
/>
|
|
622
|
+
<Text
|
|
623
|
+
allowFontScaling={false}
|
|
624
|
+
style={{
|
|
625
|
+
position: 'absolute',
|
|
626
|
+
bottom: size * 0.06,
|
|
627
|
+
color: onColor(color),
|
|
628
|
+
fontSize: size * 0.58,
|
|
629
|
+
lineHeight: size * 0.66,
|
|
630
|
+
fontWeight: '700',
|
|
631
|
+
textAlign: 'center',
|
|
632
|
+
includeFontPadding: false,
|
|
633
|
+
}}
|
|
634
|
+
>
|
|
635
|
+
!
|
|
636
|
+
</Text>
|
|
637
|
+
</View>
|
|
638
|
+
);
|
|
639
|
+
});
|
|
640
|
+
WarningTriangle.displayName = 'WarningTriangle';
|
|
641
|
+
|
|
642
|
+
const warned = new Set<string>();
|
|
643
|
+
|
|
644
|
+
/** All included glyphs, in catalog order. */
|
|
645
|
+
export const BUILT_IN_ICON_NAMES: readonly BuiltInIconName[] = [
|
|
646
|
+
'check', 'close', 'plus', 'minus', 'search', 'scan', 'menu', 'more', 'home', 'settings', 'user',
|
|
647
|
+
'trash', 'edit', 'share', 'heart', 'star', 'eye', 'eye-off',
|
|
648
|
+
'chevron-left', 'chevron-right', 'chevron-up', 'chevron-down', 'alert', 'warning', 'info', 'question',
|
|
649
|
+
];
|
|
650
|
+
|
|
651
|
+
/** Default renderer. Used when <UIProvider icons={...}> doesn't pass its own. */
|
|
257
652
|
export function renderDefaultIcon(name: IconName, props: IconRenderProps): React.ReactNode {
|
|
258
653
|
switch (name) {
|
|
259
654
|
case 'check':
|
|
@@ -274,6 +669,8 @@ export function renderDefaultIcon(name: IconName, props: IconRenderProps): React
|
|
|
274
669
|
return <Eye {...props} off />;
|
|
275
670
|
case 'search':
|
|
276
671
|
return <Search {...props} />;
|
|
672
|
+
case 'scan':
|
|
673
|
+
return <Scan {...props} />;
|
|
277
674
|
case 'plus':
|
|
278
675
|
return <PlusMinus {...props} />;
|
|
279
676
|
case 'minus':
|
|
@@ -283,10 +680,36 @@ export function renderDefaultIcon(name: IconName, props: IconRenderProps): React
|
|
|
283
680
|
case 'info':
|
|
284
681
|
return <Circle {...props} label="i" />;
|
|
285
682
|
case 'warning':
|
|
286
|
-
return <
|
|
683
|
+
return <WarningTriangle {...props} />;
|
|
287
684
|
case 'question':
|
|
288
685
|
return <Circle {...props} label="?" />;
|
|
686
|
+
case 'menu':
|
|
687
|
+
return <Menu {...props} />;
|
|
688
|
+
case 'more':
|
|
689
|
+
return <More {...props} />;
|
|
690
|
+
case 'home':
|
|
691
|
+
return <Home {...props} />;
|
|
692
|
+
case 'settings':
|
|
693
|
+
return <Settings {...props} />;
|
|
694
|
+
case 'user':
|
|
695
|
+
return <User {...props} />;
|
|
696
|
+
case 'trash':
|
|
697
|
+
return <Trash {...props} />;
|
|
698
|
+
case 'edit':
|
|
699
|
+
return <Edit {...props} />;
|
|
700
|
+
case 'share':
|
|
701
|
+
return <Share {...props} />;
|
|
702
|
+
case 'heart':
|
|
703
|
+
return <Heart {...props} />;
|
|
704
|
+
case 'star':
|
|
705
|
+
return <Star {...props} />;
|
|
289
706
|
default:
|
|
707
|
+
// A name outside the included set only makes sense with a custom
|
|
708
|
+
// renderer (<UIProvider icons>). Without one there is no glyph: warn once.
|
|
709
|
+
if (typeof __DEV__ !== 'undefined' && __DEV__ && !warned.has(name)) {
|
|
710
|
+
warned.add(name);
|
|
711
|
+
console.warn(`orn-ui: no built-in icon named "${name}". Pass <UIProvider icons={...}> to render custom names.`);
|
|
712
|
+
}
|
|
290
713
|
return null;
|
|
291
714
|
}
|
|
292
715
|
}
|
package/src/icons/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Icon } from './Icon';
|
|
2
2
|
export type { IconProps } from './Icon';
|
|
3
|
-
export { renderDefaultIcon } from './defaultIcons';
|
|
4
|
-
export type { IconName, IconRenderer, IconRenderProps } from './types';
|
|
3
|
+
export { renderDefaultIcon, BUILT_IN_ICON_NAMES } from './defaultIcons';
|
|
4
|
+
export type { BuiltInIconName, IconName, IconRenderer, IconRenderProps } from './types';
|
package/src/icons/types.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Included glyphs (drawn with RN primitives, zero dependencies): the ones
|
|
5
|
+
* the library uses internally plus a basic set for apps.
|
|
6
|
+
*/
|
|
7
|
+
export type BuiltInIconName =
|
|
5
8
|
| 'check'
|
|
6
9
|
| 'close'
|
|
7
10
|
| 'chevron-down'
|
|
@@ -11,17 +14,36 @@ export type IconName =
|
|
|
11
14
|
| 'eye'
|
|
12
15
|
| 'eye-off'
|
|
13
16
|
| 'search'
|
|
17
|
+
| 'scan'
|
|
14
18
|
| 'plus'
|
|
15
19
|
| 'minus'
|
|
16
20
|
| 'alert'
|
|
17
21
|
| 'info'
|
|
18
22
|
| 'warning'
|
|
19
|
-
| 'question'
|
|
23
|
+
| 'question'
|
|
24
|
+
| 'menu'
|
|
25
|
+
| 'more'
|
|
26
|
+
| 'home'
|
|
27
|
+
| 'settings'
|
|
28
|
+
| 'user'
|
|
29
|
+
| 'trash'
|
|
30
|
+
| 'edit'
|
|
31
|
+
| 'share'
|
|
32
|
+
| 'heart'
|
|
33
|
+
| 'star';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Icon name accepted by `iconName`, `leftIconName`, etc. Autocompletes the
|
|
37
|
+
* included ones and also accepts any string, for those who plug in their own
|
|
38
|
+
* set with `<UIProvider icons={...}>` (e.g. `iconName="calendar"`). A name
|
|
39
|
+
* the active renderer doesn't know draws nothing (and warns in development).
|
|
40
|
+
*/
|
|
41
|
+
export type IconName = BuiltInIconName | (string & {});
|
|
20
42
|
|
|
21
43
|
export interface IconRenderProps {
|
|
22
44
|
size: number;
|
|
23
45
|
color: string;
|
|
24
46
|
}
|
|
25
47
|
|
|
26
|
-
/**
|
|
48
|
+
/** Injectable renderer: replaces the default glyphs with those of any icon set. */
|
|
27
49
|
export type IconRenderer = (name: IconName, props: IconRenderProps) => ReactNode;
|