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
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NativeOverlay = NativeOverlay;
|
|
7
|
+
exports.__resetNativeOverlays = __resetNativeOverlays;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactNative = require("react-native");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
|
+
/**
|
|
13
|
+
* NativeOverlay
|
|
14
|
+
* The native `Modal` every orn-ui overlay (Alert, BottomSheet, Modal, Select)
|
|
15
|
+
* goes through.
|
|
16
|
+
*
|
|
17
|
+
* Why: iOS presents a native modal from the root view controller and only one
|
|
18
|
+
* at a time. A second `<Modal>` that is not rendered inside the first one is
|
|
19
|
+
* silently ignored while the first is presented, and also while it is still
|
|
20
|
+
* being dismissed. In practice an Alert from `showAlert()` over an open
|
|
21
|
+
* BottomSheet never showed, and neither did one opened right after closing a
|
|
22
|
+
* sheet. Android opens a window per modal and never had the problem: there
|
|
23
|
+
* this is a plain `Modal`.
|
|
24
|
+
*
|
|
25
|
+
* iOS, when an overlay becomes visible:
|
|
26
|
+
* - Rendered inside another overlay (nested): plain native modal; iOS presents
|
|
27
|
+
* it from that one, which works.
|
|
28
|
+
* - Another overlay is presented and this one is not inside it: it is drawn
|
|
29
|
+
* as a layer inside the topmost presented overlay instead of presenting a
|
|
30
|
+
* second native modal. Its React context then comes from that overlay's
|
|
31
|
+
* position: a provider that wraps only this overlay doesn't reach it.
|
|
32
|
+
* - Another overlay is closing (exit animation or native dismissal): it waits
|
|
33
|
+
* until that one is gone, then presents.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
const fill = {
|
|
37
|
+
position: 'absolute',
|
|
38
|
+
top: 0,
|
|
39
|
+
left: 0,
|
|
40
|
+
right: 0,
|
|
41
|
+
bottom: 0
|
|
42
|
+
};
|
|
43
|
+
/** After unmount, how long iOS may still be dismissing the native modal. */
|
|
44
|
+
const DISMISS_SETTLE_MS = 450;
|
|
45
|
+
|
|
46
|
+
// Module-level registry: overlays live in different React subtrees, and the
|
|
47
|
+
// constraint they share (one native presentation at a time) is global too.
|
|
48
|
+
const hosts = [];
|
|
49
|
+
const layers = new Map();
|
|
50
|
+
const ownerOf = new Map();
|
|
51
|
+
let nextId = 1;
|
|
52
|
+
|
|
53
|
+
// Two channels, so publishing a layer (every render of a layered overlay)
|
|
54
|
+
// only re-renders that host's outlet, never the overlays themselves — which
|
|
55
|
+
// would publish again and loop.
|
|
56
|
+
const hostListeners = new Set();
|
|
57
|
+
const layerListeners = new Map();
|
|
58
|
+
|
|
59
|
+
/** The host stack changed: waiting/layered overlays re-evaluate. */
|
|
60
|
+
function notify() {
|
|
61
|
+
hostListeners.forEach(listener => listener());
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** A host's layers changed: only its outlet re-renders. */
|
|
65
|
+
function notifyLayers(hostId) {
|
|
66
|
+
layerListeners.get(hostId)?.forEach(listener => listener());
|
|
67
|
+
}
|
|
68
|
+
function useChannel(subscribe) {
|
|
69
|
+
const [, setVersion] = (0, _react.useState)(0);
|
|
70
|
+
(0, _react.useEffect)(() => subscribe(() => setVersion(v => v + 1)), [subscribe]);
|
|
71
|
+
}
|
|
72
|
+
const subscribeHosts = listener => {
|
|
73
|
+
hostListeners.add(listener);
|
|
74
|
+
return () => {
|
|
75
|
+
hostListeners.delete(listener);
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
function liveTop() {
|
|
79
|
+
const top = hosts[hosts.length - 1];
|
|
80
|
+
return top && !top.closing ? top : undefined;
|
|
81
|
+
}
|
|
82
|
+
function decide(parentHost) {
|
|
83
|
+
if (hosts.length === 0) return 'native';
|
|
84
|
+
const top = liveTop();
|
|
85
|
+
if (!top) return 'wait';
|
|
86
|
+
// Nested inside the topmost overlay: iOS can present it from there.
|
|
87
|
+
if (top.id === parentHost) return 'native';
|
|
88
|
+
return 'layer';
|
|
89
|
+
}
|
|
90
|
+
function unpublish(id) {
|
|
91
|
+
const owner = ownerOf.get(id);
|
|
92
|
+
if (owner === undefined) return;
|
|
93
|
+
layers.get(owner)?.delete(id);
|
|
94
|
+
ownerOf.delete(id);
|
|
95
|
+
notifyLayers(owner);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Takes the native slot right away, before any later overlay decides. */
|
|
99
|
+
function claim(id, closing) {
|
|
100
|
+
if (hosts.some(h => h.id === id)) return;
|
|
101
|
+
hosts.push({
|
|
102
|
+
id,
|
|
103
|
+
closing
|
|
104
|
+
});
|
|
105
|
+
notify();
|
|
106
|
+
}
|
|
107
|
+
function removeHost(id) {
|
|
108
|
+
const index = hosts.findIndex(h => h.id === id);
|
|
109
|
+
if (index < 0) return;
|
|
110
|
+
hosts.splice(index, 1);
|
|
111
|
+
notify();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Id of the native overlay this subtree is rendered in, if any. */
|
|
115
|
+
const HostContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
116
|
+
|
|
117
|
+
/** Draws, inside a native host, the layers other overlays put into it. */
|
|
118
|
+
function LayerOutlet({
|
|
119
|
+
hostId
|
|
120
|
+
}) {
|
|
121
|
+
const [, setVersion] = (0, _react.useState)(0);
|
|
122
|
+
// Layout effect + an immediate re-read: a layer may have been published in
|
|
123
|
+
// the same commit, before this outlet subscribed.
|
|
124
|
+
(0, _react.useLayoutEffect)(() => {
|
|
125
|
+
const listener = () => setVersion(v => v + 1);
|
|
126
|
+
if (!layerListeners.has(hostId)) layerListeners.set(hostId, new Set());
|
|
127
|
+
layerListeners.get(hostId).add(listener);
|
|
128
|
+
if (layers.get(hostId)?.size) listener();
|
|
129
|
+
return () => {
|
|
130
|
+
layerListeners.get(hostId)?.delete(listener);
|
|
131
|
+
};
|
|
132
|
+
}, [hostId]);
|
|
133
|
+
const own = layers.get(hostId);
|
|
134
|
+
if (!own || own.size === 0) return null;
|
|
135
|
+
// Dialogs last, so they are drawn on top of sheets and modals.
|
|
136
|
+
const ordered = [...own.entries()].sort(([, a], [, b]) => Number(a.dialog) - Number(b.dialog));
|
|
137
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
138
|
+
children: ordered.map(([key, layer]) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
139
|
+
style: fill,
|
|
140
|
+
pointerEvents: "box-none",
|
|
141
|
+
children: layer.node
|
|
142
|
+
}, key))
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
function NativeOverlay({
|
|
146
|
+
closing = false,
|
|
147
|
+
dialog = false,
|
|
148
|
+
children,
|
|
149
|
+
...modalProps
|
|
150
|
+
}) {
|
|
151
|
+
const ios = _reactNative.Platform.OS === 'ios';
|
|
152
|
+
const parentHost = (0, _react.useContext)(HostContext);
|
|
153
|
+
const idRef = (0, _react.useRef)(0);
|
|
154
|
+
if (idRef.current === 0) idRef.current = nextId++;
|
|
155
|
+
const id = idRef.current;
|
|
156
|
+
useChannel(subscribeHosts);
|
|
157
|
+
|
|
158
|
+
// Decided in a layout effect, not during render: layout effects run in tree
|
|
159
|
+
// order before paint, so when two overlays mount in the same commit the
|
|
160
|
+
// first one claims the native slot before the second one decides.
|
|
161
|
+
const [mode, setMode] = (0, _react.useState)(ios ? 'pending' : 'native');
|
|
162
|
+
(0, _react.useLayoutEffect)(() => {
|
|
163
|
+
if (!ios) return;
|
|
164
|
+
if (mode === 'pending') {
|
|
165
|
+
const next = decide(parentHost);
|
|
166
|
+
if (next === 'native') claim(id, closing);
|
|
167
|
+
setMode(next);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (mode === 'wait' && !closing) {
|
|
171
|
+
const next = decide(parentHost);
|
|
172
|
+
if (next === 'native') claim(id, closing);
|
|
173
|
+
if (next !== 'wait') setMode(next);
|
|
174
|
+
}
|
|
175
|
+
// The host it layered into started closing or went away: move out.
|
|
176
|
+
if (mode === 'layer' && !closing) {
|
|
177
|
+
const owner = ownerOf.get(id);
|
|
178
|
+
const host = owner === undefined ? undefined : hosts.find(h => h.id === owner);
|
|
179
|
+
if (owner !== undefined && (!host || host.closing)) {
|
|
180
|
+
unpublish(id);
|
|
181
|
+
const next = decide(parentHost);
|
|
182
|
+
if (next === 'native') claim(id, closing);
|
|
183
|
+
setMode(next);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// Native host bookkeeping.
|
|
189
|
+
(0, _react.useLayoutEffect)(() => {
|
|
190
|
+
if (!ios || mode !== 'native') return;
|
|
191
|
+
const existing = hosts.find(h => h.id === id);
|
|
192
|
+
if (!existing) hosts.push({
|
|
193
|
+
id,
|
|
194
|
+
closing
|
|
195
|
+
});else if (existing.closing !== closing) existing.closing = closing;else return;
|
|
196
|
+
notify();
|
|
197
|
+
}, [ios, mode, closing, id]);
|
|
198
|
+
|
|
199
|
+
// Layer publishing: every render, so prop changes reach the host.
|
|
200
|
+
(0, _react.useLayoutEffect)(() => {
|
|
201
|
+
if (!ios || mode !== 'layer') return;
|
|
202
|
+
let owner = ownerOf.get(id);
|
|
203
|
+
if (owner === undefined) {
|
|
204
|
+
owner = liveTop()?.id;
|
|
205
|
+
// The host it chose started closing in the same commit (a sheet closed
|
|
206
|
+
// and an alert opened in one tick): decide again, usually to wait.
|
|
207
|
+
if (owner === undefined) {
|
|
208
|
+
const next = decide(parentHost);
|
|
209
|
+
if (next === 'native') claim(id, closing);
|
|
210
|
+
setMode(next);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
ownerOf.set(id, owner);
|
|
214
|
+
}
|
|
215
|
+
if (!layers.has(owner)) layers.set(owner, new Map());
|
|
216
|
+
layers.get(owner).set(id, {
|
|
217
|
+
node: /*#__PURE__*/(0, _jsxRuntime.jsx)(HostContext.Provider, {
|
|
218
|
+
value: owner,
|
|
219
|
+
children: children
|
|
220
|
+
}),
|
|
221
|
+
dialog
|
|
222
|
+
});
|
|
223
|
+
notifyLayers(owner);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
// Unmount: a layer just leaves; a native host stays "closing" while iOS
|
|
227
|
+
// finishes dismissing it, so the next overlay doesn't present too early.
|
|
228
|
+
(0, _react.useEffect)(() => () => {
|
|
229
|
+
if (!ios) return;
|
|
230
|
+
unpublish(id);
|
|
231
|
+
const host = hosts.find(h => h.id === id);
|
|
232
|
+
if (host) {
|
|
233
|
+
host.closing = true;
|
|
234
|
+
notify();
|
|
235
|
+
setTimeout(() => removeHost(id), DISMISS_SETTLE_MS);
|
|
236
|
+
}
|
|
237
|
+
}, [ios, id]);
|
|
238
|
+
if (!ios || mode === 'native') {
|
|
239
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Modal, {
|
|
240
|
+
visible: true,
|
|
241
|
+
...modalProps,
|
|
242
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(HostContext.Provider, {
|
|
243
|
+
value: id,
|
|
244
|
+
children: [ios && dialog && /*#__PURE__*/(0, _jsxRuntime.jsx)(LayerOutlet, {
|
|
245
|
+
hostId: id
|
|
246
|
+
}), children, ios && !dialog && /*#__PURE__*/(0, _jsxRuntime.jsx)(LayerOutlet, {
|
|
247
|
+
hostId: id
|
|
248
|
+
})]
|
|
249
|
+
})
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// 'layer' renders inside the host; 'wait' and 'pending' render nothing yet.
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** Test-only: clears the registry between tests. */
|
|
258
|
+
function __resetNativeOverlays() {
|
|
259
|
+
hosts.splice(0);
|
|
260
|
+
layers.clear();
|
|
261
|
+
ownerOf.clear();
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=NativeOverlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","fill","position","top","left","right","bottom","DISMISS_SETTLE_MS","hosts","layers","Map","ownerOf","nextId","hostListeners","Set","layerListeners","notify","forEach","listener","notifyLayers","hostId","useChannel","subscribe","setVersion","useState","useEffect","v","subscribeHosts","add","delete","liveTop","length","closing","undefined","decide","parentHost","id","unpublish","owner","claim","some","h","push","removeHost","index","findIndex","splice","HostContext","createContext","LayerOutlet","useLayoutEffect","size","own","ordered","entries","sort","a","b","Number","dialog","jsx","Fragment","children","map","key","layer","View","style","pointerEvents","node","NativeOverlay","modalProps","ios","Platform","OS","useContext","idRef","useRef","current","mode","setMode","next","host","find","existing","Provider","value","setTimeout","Modal","visible","jsxs","__resetNativeOverlays","clear"],"sourceRoot":"../../../src","sources":["theme/NativeOverlay.tsx"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAAsF,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC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AAC;MACRuE,UAAU,CAAC,MAAM5C,UAAU,CAACP,EAAE,CAAC,EAAE7B,iBAAiB,CAAC;IACrD;EACF,CAAC,EACD,CAACiE,GAAG,EAAEpC,EAAE,CACV,CAAC;EAED,IAAI,CAACoC,GAAG,IAAIO,IAAI,KAAK,QAAQ,EAAE;IAC7B,oBACE,IAAAlG,WAAA,CAAA+E,GAAA,EAAChF,YAAA,CAAA4G,KAAK;MAACC,OAAO;MAAA,GAAKlB,UAAU;MAAAT,QAAA,eAC3B,IAAAjF,WAAA,CAAA6G,IAAA,EAAC3C,WAAW,CAACsC,QAAQ;QAACC,KAAK,EAAElD,EAAG;QAAA0B,QAAA,GAE7BU,GAAG,IAAIb,MAAM,iBAAI,IAAA9E,WAAA,CAAA+E,GAAA,EAACX,WAAW;UAAC7B,MAAM,EAAEgB;QAAG,CAAE,CAAC,EAC5C0B,QAAQ,EACRU,GAAG,IAAI,CAACb,MAAM,iBAAI,IAAA9E,WAAA,CAAA+E,GAAA,EAACX,WAAW;UAAC7B,MAAM,EAAEgB;QAAG,CAAE,CAAC;MAAA,CAC1B;IAAC,CAClB,CAAC;EAEZ;;EAEA;EACA,OAAO,IAAI;AACb;;AAEA;AACO,SAASuD,qBAAqBA,CAAA,EAAG;EACtCnF,KAAK,CAACsC,MAAM,CAAC,CAAC,CAAC;EACfrC,MAAM,CAACmF,KAAK,CAAC,CAAC;EACdjF,OAAO,CAACiF,KAAK,CAAC,CAAC;AACjB","ignoreList":[]}
|
|
@@ -15,49 +15,105 @@ exports.useTheme = useTheme;
|
|
|
15
15
|
exports.useThemeMode = useThemeMode;
|
|
16
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
17
|
var _reactNative = require("react-native");
|
|
18
|
+
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
|
18
19
|
var _createTheme = require("./createTheme");
|
|
19
20
|
var _labels = require("./labels");
|
|
20
|
-
var _insets = require("./insets");
|
|
21
21
|
var _defaultIcons = require("../icons/defaultIcons");
|
|
22
|
+
var _KeyboardAvoidance = require("./KeyboardAvoidance");
|
|
22
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
24
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
24
25
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* monta un `<SafeAreaProvider>` nuevo y remide dentro de esa ventana.
|
|
26
|
+
* A native `<Modal>`/`<BottomSheet>` opens its own window (always on Android;
|
|
27
|
+
* on iOS depending on `presentationStyle`), so the insets measured at the app
|
|
28
|
+
* root may not hold in there. The boundary mounts a new `<SafeAreaProvider>`
|
|
29
|
+
* inside that window and re-measures; until the first measurement arrives it
|
|
30
|
+
* repeats the ambient insets.
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
const probeStyle = {
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
top: 0,
|
|
36
|
+
left: 0,
|
|
37
|
+
right: 0,
|
|
38
|
+
bottom: 0
|
|
39
|
+
};
|
|
40
|
+
function sameInsets(a, b) {
|
|
41
|
+
return a.top === b.top && a.right === b.right && a.bottom === b.bottom && a.left === b.left;
|
|
42
|
+
}
|
|
43
|
+
function InsetsProbe({
|
|
44
|
+
onMeasure
|
|
45
|
+
}) {
|
|
46
|
+
const insets = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
|
|
47
|
+
(0, _react.useEffect)(() => {
|
|
48
|
+
onMeasure(insets);
|
|
49
|
+
}, [insets, onMeasure]);
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
function RemeasuringModalSafeAreaBoundary({
|
|
34
53
|
children
|
|
35
54
|
}) {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
55
|
+
const ambient = useInsets();
|
|
56
|
+
const [measured, setMeasured] = (0, _react.useState)(null);
|
|
57
|
+
const onMeasure = (0, _react.useCallback)(next => setMeasured(prev => prev && sameInsets(prev, next) ? prev : next), []);
|
|
58
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
59
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSafeAreaContext.SafeAreaProvider, {
|
|
60
|
+
style: probeStyle,
|
|
61
|
+
pointerEvents: "none",
|
|
62
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(InsetsProbe, {
|
|
63
|
+
onMeasure: onMeasure
|
|
64
|
+
})
|
|
65
|
+
}), children(measured ?? ambient)]
|
|
39
66
|
});
|
|
40
67
|
}
|
|
41
68
|
const UIContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
42
69
|
/**
|
|
43
70
|
* UIProvider
|
|
44
|
-
*
|
|
45
|
-
* override
|
|
46
|
-
*
|
|
47
|
-
*
|
|
71
|
+
* The library's single entry point: resolves the active theme (system or
|
|
72
|
+
* manual override), measures the safe area insets (react-native-safe-area-context,
|
|
73
|
+
* a required peer) and injects icons, insets and default texts into the whole
|
|
74
|
+
* tree. It doesn't persist the mode — if the consumer wants to remember the
|
|
75
|
+
* preference across sessions, it controls `mode`/`onModeChange` and persists
|
|
76
|
+
* wherever it prefers.
|
|
48
77
|
*/
|
|
49
78
|
function UIProvider({
|
|
79
|
+
mountSafeAreaProvider = true,
|
|
80
|
+
...props
|
|
81
|
+
}) {
|
|
82
|
+
if (!mountSafeAreaProvider) return /*#__PURE__*/(0, _jsxRuntime.jsx)(MeasuredUIProvider, {
|
|
83
|
+
...props
|
|
84
|
+
});
|
|
85
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSafeAreaContext.SafeAreaProvider, {
|
|
86
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(MeasuredUIProvider, {
|
|
87
|
+
...props
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function MeasuredUIProvider({
|
|
92
|
+
insets: override,
|
|
93
|
+
...rest
|
|
94
|
+
}) {
|
|
95
|
+
const measured = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
|
|
96
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(UIProviderBase, {
|
|
97
|
+
insets: override ?? measured,
|
|
98
|
+
...rest
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function UIProviderBase({
|
|
50
102
|
children,
|
|
51
103
|
theme = _createTheme.defaultTheme,
|
|
52
104
|
defaultMode = 'system',
|
|
53
105
|
mode: controlledMode,
|
|
54
106
|
onModeChange,
|
|
55
107
|
icons = _defaultIcons.renderDefaultIcon,
|
|
56
|
-
insets
|
|
108
|
+
insets,
|
|
57
109
|
labels: labelOverrides,
|
|
58
110
|
allowFontScaling = false,
|
|
59
|
-
|
|
111
|
+
keyboardAvoidance = true
|
|
60
112
|
}) {
|
|
113
|
+
// Only the root provider shifts the app: a nested one (a modal with its own
|
|
114
|
+
// provider, a test) wraps nothing and doesn't change the layout.
|
|
115
|
+
const isRoot = (0, _react.useContext)(UIContext) === undefined;
|
|
116
|
+
const ModalSafeAreaBoundary = RemeasuringModalSafeAreaBoundary;
|
|
61
117
|
const systemScheme = (0, _reactNative.useColorScheme)();
|
|
62
118
|
const [uncontrolledMode, setUncontrolledMode] = (0, _react.useState)(defaultMode);
|
|
63
119
|
const isControlled = controlledMode !== undefined;
|
|
@@ -66,19 +122,6 @@ function UIProvider({
|
|
|
66
122
|
if (!isControlled) setUncontrolledMode(next);
|
|
67
123
|
onModeChange?.(next);
|
|
68
124
|
}, [isControlled, onModeChange]);
|
|
69
|
-
|
|
70
|
-
// Por instancia, no por módulo: dos `<UIProvider>` en el mismo árbol (tests,
|
|
71
|
-
// un modal con su propio provider) avisan cada uno si le faltan insets, en
|
|
72
|
-
// vez de que el segundo se calle porque el primero ya avisó una vez.
|
|
73
|
-
const warnedAboutInsets = (0, _react.useRef)(false);
|
|
74
|
-
|
|
75
|
-
// Olvidar `insets` no rompe nada visible al montar: el default de ceros
|
|
76
|
-
// recién se nota cuando abrís un Modal `full` (se mete abajo del notch) o un
|
|
77
|
-
// BottomSheet (queda pegado a la barra de gestos). El aviso llega antes.
|
|
78
|
-
if (__DEV__ && insets === _insets.zeroInsets && !warnedAboutInsets.current) {
|
|
79
|
-
warnedAboutInsets.current = true;
|
|
80
|
-
console.warn('orn-ui: <UIProvider> sin `insets`, se usan {top:0,bottom:0,left:0,right:0}. ' + 'Los modales y el Screen quedan sin safe area. Pasá `insets={useSafeAreaInsets()}` ' + "o usá <SafeAreaUIProvider> de 'orn-ui/safe-area', que lo cablea solo.");
|
|
81
|
-
}
|
|
82
125
|
const scheme = mode === 'system' ? systemScheme === 'dark' ? 'dark' : 'light' : mode;
|
|
83
126
|
const resolvedTheme = theme[scheme];
|
|
84
127
|
const labels = (0, _react.useMemo)(() => labelOverrides ? {
|
|
@@ -95,9 +138,19 @@ function UIProvider({
|
|
|
95
138
|
allowFontScaling,
|
|
96
139
|
ModalSafeAreaBoundary
|
|
97
140
|
}), [resolvedTheme, mode, setMode, icons, insets, labels, allowFontScaling, ModalSafeAreaBoundary]);
|
|
141
|
+
let content = children;
|
|
142
|
+
if (isRoot) {
|
|
143
|
+
content = keyboardAvoidance ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_KeyboardAvoidance.KeyboardPanArea, {
|
|
144
|
+
margin: resolvedTheme.tokens.spacing.md,
|
|
145
|
+
topLimit: insets.top,
|
|
146
|
+
children: children
|
|
147
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_KeyboardAvoidance.KeyboardHandled, {
|
|
148
|
+
children: children
|
|
149
|
+
});
|
|
150
|
+
}
|
|
98
151
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(UIContext.Provider, {
|
|
99
152
|
value: value,
|
|
100
|
-
children:
|
|
153
|
+
children: content
|
|
101
154
|
});
|
|
102
155
|
}
|
|
103
156
|
function useUIContext() {
|
|
@@ -136,12 +189,12 @@ function useAllowFontScaling() {
|
|
|
136
189
|
return useUIContext().allowFontScaling;
|
|
137
190
|
}
|
|
138
191
|
|
|
139
|
-
/**
|
|
192
|
+
/** Internal: consumed by `Modal`/`BottomSheet` to re-measure insets inside their own native window. */
|
|
140
193
|
function useModalSafeAreaBoundary() {
|
|
141
194
|
return useUIContext().ModalSafeAreaBoundary;
|
|
142
195
|
}
|
|
143
196
|
|
|
144
|
-
/** Re-
|
|
197
|
+
/** Re-exported so tests/consumers can simulate system changes without real RN. */
|
|
145
198
|
const __testUtils = exports.__testUtils = {
|
|
146
199
|
Appearance: _reactNative.Appearance
|
|
147
200
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_createTheme","_labels","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeSafeAreaContext","_createTheme","_labels","_defaultIcons","_KeyboardAvoidance","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","probeStyle","position","top","left","right","bottom","sameInsets","a","b","InsetsProbe","onMeasure","insets","useSafeAreaInsets","useEffect","RemeasuringModalSafeAreaBoundary","children","ambient","useInsets","measured","setMeasured","useState","useCallback","next","prev","jsxs","Fragment","jsx","SafeAreaProvider","style","pointerEvents","UIContext","createContext","undefined","UIProvider","mountSafeAreaProvider","props","MeasuredUIProvider","override","rest","UIProviderBase","theme","defaultTheme","defaultMode","mode","controlledMode","onModeChange","icons","renderDefaultIcon","labels","labelOverrides","allowFontScaling","keyboardAvoidance","isRoot","useContext","ModalSafeAreaBoundary","systemScheme","useColorScheme","uncontrolledMode","setUncontrolledMode","isControlled","setMode","scheme","resolvedTheme","useMemo","defaultLabels","value","content","KeyboardPanArea","margin","tokens","spacing","md","topLimit","KeyboardHandled","Provider","useUIContext","ctx","Error","useTheme","useColors","colors","useThemeMode","useIcons","useLabels","useAllowFontScaling","useModalSafeAreaBoundary","__testUtils","exports","Appearance"],"sourceRoot":"../../../src","sources":["theme/UIProvider.tsx"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,2BAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAGA,IAAAK,aAAA,GAAAL,OAAA;AAEA,IAAAM,kBAAA,GAAAN,OAAA;AAAuE,IAAAO,WAAA,GAAAP,OAAA;AAAA,SAAAD,wBAAAS,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,CAAAS,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa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AAC7B;AAEO,SAASuC,SAASA,CAAA,EAAoB;EAC3C,OAAOJ,YAAY,CAAC,CAAC,CAACnC,KAAK,CAACwC,MAAM;AACpC;AAEO,SAASC,YAAYA,CAAA,EAAG;EAC7B,MAAM;IAAEtC,IAAI;IAAEiB;EAAQ,CAAC,GAAGe,YAAY,CAAC,CAAC;EACxC,OAAO;IAAEhC,IAAI;IAAEiB;EAAQ,CAAC;AAC1B;AAEO,SAASsB,QAAQA,CAAA,EAAiB;EACvC,OAAOP,YAAY,CAAC,CAAC,CAAC7B,KAAK;AAC7B;AAEO,SAAS7B,SAASA,CAAA,EAAe;EACtC,OAAO0D,YAAY,CAAC,CAAC,CAAChE,MAAM;AAC9B;AAEO,SAASwE,SAASA,CAAA,EAAW;EAClC,OAAOR,YAAY,CAAC,CAAC,CAAC3B,MAAM;AAC9B;AAEO,SAASoC,mBAAmBA,CAAA,EAAY;EAC7C,OAAOT,YAAY,CAAC,CAAC,CAACzB,gBAAgB;AACxC;;AAEA;AACO,SAASmC,wBAAwBA,CAAA,EAAmC;EACzE,OAAOV,YAAY,CAAC,CAAC,CAACrB,qBAAqB;AAC7C;;AAEA;AACO,MAAMgC,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG;EAAEE,UAAU,EAAVA;AAAW,CAAC","ignoreList":[]}
|
|
@@ -14,20 +14,20 @@ exports.rgbToHsl = rgbToHsl;
|
|
|
14
14
|
exports.toHex = toHex;
|
|
15
15
|
exports.toHsl = toHsl;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* Dependency-free color utilities, used to derive a family of roles
|
|
18
|
+
* (fill / on-top / soft / readable) from a single brand hex.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
/**
|
|
21
|
+
/** Minimum AA contrast for normal text. */
|
|
22
22
|
const AA_CONTRAST = exports.AA_CONTRAST = 4.5;
|
|
23
23
|
|
|
24
|
-
/** Roles
|
|
24
|
+
/** Roles a theme accent needs, in a given scheme. */
|
|
25
25
|
|
|
26
26
|
const HEX = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
27
27
|
function hexToRgb(hex) {
|
|
28
28
|
const match = HEX.exec(hex.trim());
|
|
29
29
|
if (!match) {
|
|
30
|
-
throw new Error(`orn-ui:
|
|
30
|
+
throw new Error(`orn-ui: expected a hex color like "#7c3aed", got "${hex}".`);
|
|
31
31
|
}
|
|
32
32
|
const digits = match[1];
|
|
33
33
|
const full = digits.length === 3 ? digits.replace(/./g, c => c + c) : digits;
|
|
@@ -106,7 +106,7 @@ function channelLuminance(value) {
|
|
|
106
106
|
return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
/**
|
|
109
|
+
/** WCAG relative luminance of a hex. */
|
|
110
110
|
function luminance(hex) {
|
|
111
111
|
const {
|
|
112
112
|
r,
|
|
@@ -116,7 +116,7 @@ function luminance(hex) {
|
|
|
116
116
|
return 0.2126 * channelLuminance(r) + 0.7152 * channelLuminance(g) + 0.0722 * channelLuminance(b);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
/**
|
|
119
|
+
/** WCAG contrast ratio between two hexes: 1 (equal) to 21 (white on black). */
|
|
120
120
|
function contrast(a, b) {
|
|
121
121
|
const la = luminance(a);
|
|
122
122
|
const lb = luminance(b);
|
|
@@ -124,8 +124,8 @@ function contrast(a, b) {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
127
|
+
* White if it reaches AA contrast —which is what you expect on top of a color
|
|
128
|
+
* fill— and otherwise whichever extreme gives the most contrast.
|
|
129
129
|
*/
|
|
130
130
|
function bestOnColor(background, light, dark) {
|
|
131
131
|
if (contrast(background, light) >= AA_CONTRAST) return light;
|
|
@@ -133,9 +133,9 @@ function bestOnColor(background, light, dark) {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
|
-
*
|
|
137
|
-
* `against`.
|
|
138
|
-
*
|
|
136
|
+
* Shifts the hue's lightness until it reaches the requested contrast against
|
|
137
|
+
* `against`. If not even the extreme gets there —pure yellow on white, for
|
|
138
|
+
* example— it returns the most contrasting one found along the way.
|
|
139
139
|
*/
|
|
140
140
|
function reachContrast(hsl, against, target, direction) {
|
|
141
141
|
const step = direction === 'darker' ? -0.02 : 0.02;
|
|
@@ -157,9 +157,9 @@ function reachContrast(hsl, against, target, direction) {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
/**
|
|
160
|
-
*
|
|
161
|
-
* `surface`
|
|
162
|
-
*
|
|
160
|
+
* Derives an accent's four roles from a hex, for one scheme.
|
|
161
|
+
* `surface` is the background the `text` role has to be read on, so each
|
|
162
|
+
* scheme passes its own.
|
|
163
163
|
*/
|
|
164
164
|
function deriveAccent(hex, scheme, surface) {
|
|
165
165
|
const hsl = toHsl(hex);
|
|
@@ -180,8 +180,8 @@ function deriveAccent(hex, scheme, surface) {
|
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
//
|
|
184
|
-
// #004cef
|
|
183
|
+
// In dark the accent goes up in lightness and what sits on top goes down: a
|
|
184
|
+
// #004cef over #1e1e1e can't be told apart from the background.
|
|
185
185
|
const base = toHex({
|
|
186
186
|
...hsl,
|
|
187
187
|
l: 0.72
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AA_CONTRAST","exports","HEX","hexToRgb","hex","match","exec","trim","Error","digits","full","length","replace","c","r","parseInt","slice","g","b","toHexPair","value","Math","round","clamp","toString","padStart","rgbToHex","min","max","rgbToHsl","rn","gn","bn","delta","l","h","s","abs","hslToRgb","hp","x","r1","g1","b1","m","toHsl","toHex","hsl","channelLuminance","luminance","contrast","a","la","lb","bestOnColor","background","light","dark","reachContrast","against","target","direction","step","best","bestRatio","candidate","ratio","deriveAccent","scheme","surface","base","on","soft","text"],"sourceRoot":"../../../src","sources":["theme/colors.ts"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;;AAEA;AACO,MAAMA,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,GAAG;;AAc9B;;AAYA,MAAME,GAAG,GAAG,gCAAgC;AAErC,SAASC,QAAQA,CAACC,GAAW,EAAO;EACzC,MAAMC,KAAK,GAAGH,GAAG,CAACI,IAAI,CAACF,GAAG,CAACG,IAAI,CAAC,CAAC,CAAC;EAClC,IAAI,CAACF,KAAK,EAAE;IACV,MAAM,IAAIG,KAAK,CAAC,
|
|
1
|
+
{"version":3,"names":["AA_CONTRAST","exports","HEX","hexToRgb","hex","match","exec","trim","Error","digits","full","length","replace","c","r","parseInt","slice","g","b","toHexPair","value","Math","round","clamp","toString","padStart","rgbToHex","min","max","rgbToHsl","rn","gn","bn","delta","l","h","s","abs","hslToRgb","hp","x","r1","g1","b1","m","toHsl","toHex","hsl","channelLuminance","luminance","contrast","a","la","lb","bestOnColor","background","light","dark","reachContrast","against","target","direction","step","best","bestRatio","candidate","ratio","deriveAccent","scheme","surface","base","on","soft","text"],"sourceRoot":"../../../src","sources":["theme/colors.ts"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;;AAEA;AACO,MAAMA,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,GAAG;;AAc9B;;AAYA,MAAME,GAAG,GAAG,gCAAgC;AAErC,SAASC,QAAQA,CAACC,GAAW,EAAO;EACzC,MAAMC,KAAK,GAAGH,GAAG,CAACI,IAAI,CAACF,GAAG,CAACG,IAAI,CAAC,CAAC,CAAC;EAClC,IAAI,CAACF,KAAK,EAAE;IACV,MAAM,IAAIG,KAAK,CAAC,qDAAqDJ,GAAG,IAAI,CAAC;EAC/E;EACA,MAAMK,MAAM,GAAGJ,KAAK,CAAC,CAAC,CAAE;EACxB,MAAMK,IAAI,GAAGD,MAAM,CAACE,MAAM,KAAK,CAAC,GAAGF,MAAM,CAACG,OAAO,CAAC,IAAI,EAAGC,CAAC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