@rnative/ui 0.0.0-stage → 1.0.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/README.md +1 -3
- package/dist/components/accordion/Accordion.d.ts +31 -0
- package/dist/components/accordion/Accordion.d.ts.map +1 -0
- package/dist/components/accordion/Accordion.js +121 -0
- package/dist/components/accordion/Accordion.js.map +1 -0
- package/dist/components/accordion/Accordion.styles.d.ts +8 -0
- package/dist/components/accordion/Accordion.styles.d.ts.map +1 -0
- package/dist/components/accordion/Accordion.styles.js +48 -0
- package/dist/components/accordion/Accordion.styles.js.map +1 -0
- package/dist/components/accordion/Accordion.types.d.ts +45 -0
- package/dist/components/accordion/Accordion.types.d.ts.map +1 -0
- package/dist/components/accordion/Accordion.types.js +9 -0
- package/dist/components/accordion/Accordion.types.js.map +1 -0
- package/dist/components/accordion/index.d.ts +6 -0
- package/dist/components/accordion/index.d.ts.map +1 -0
- package/dist/components/accordion/index.js +12 -0
- package/dist/components/accordion/index.js.map +1 -0
- package/dist/components/alert/Alert.d.ts +16 -0
- package/dist/components/alert/Alert.d.ts.map +1 -0
- package/dist/components/alert/Alert.js +28 -0
- package/dist/components/alert/Alert.js.map +1 -0
- package/dist/components/alert/Alert.styles.d.ts +8 -0
- package/dist/components/alert/Alert.styles.d.ts.map +1 -0
- package/dist/components/alert/Alert.styles.js +36 -0
- package/dist/components/alert/Alert.styles.js.map +1 -0
- package/dist/components/alert/Alert.types.d.ts +22 -0
- package/dist/components/alert/Alert.types.d.ts.map +1 -0
- package/dist/components/alert/Alert.types.js +9 -0
- package/dist/components/alert/Alert.types.js.map +1 -0
- package/dist/components/alert/Alert.variants.d.ts +19 -0
- package/dist/components/alert/Alert.variants.d.ts.map +1 -0
- package/dist/components/alert/Alert.variants.js +51 -0
- package/dist/components/alert/Alert.variants.js.map +1 -0
- package/dist/components/alert/index.d.ts +6 -0
- package/dist/components/alert/index.d.ts.map +1 -0
- package/dist/components/alert/index.js +9 -0
- package/dist/components/alert/index.js.map +1 -0
- package/dist/components/avatar/Avatar.d.ts +13 -0
- package/dist/components/avatar/Avatar.d.ts.map +1 -0
- package/dist/components/avatar/Avatar.js +31 -0
- package/dist/components/avatar/Avatar.js.map +1 -0
- package/dist/components/avatar/Avatar.styles.d.ts +8 -0
- package/dist/components/avatar/Avatar.styles.d.ts.map +1 -0
- package/dist/components/avatar/Avatar.styles.js +22 -0
- package/dist/components/avatar/Avatar.styles.js.map +1 -0
- package/dist/components/avatar/Avatar.types.d.ts +21 -0
- package/dist/components/avatar/Avatar.types.d.ts.map +1 -0
- package/dist/components/avatar/Avatar.types.js +9 -0
- package/dist/components/avatar/Avatar.types.js.map +1 -0
- package/dist/components/avatar/Avatar.variants.d.ts +23 -0
- package/dist/components/avatar/Avatar.variants.d.ts.map +1 -0
- package/dist/components/avatar/Avatar.variants.js +48 -0
- package/dist/components/avatar/Avatar.variants.js.map +1 -0
- package/dist/components/avatar/index.d.ts +6 -0
- package/dist/components/avatar/index.d.ts.map +1 -0
- package/dist/components/avatar/index.js +9 -0
- package/dist/components/avatar/index.js.map +1 -0
- package/dist/components/badge/Badge.d.ts +12 -0
- package/dist/components/badge/Badge.d.ts.map +1 -0
- package/dist/components/badge/Badge.js +25 -0
- package/dist/components/badge/Badge.js.map +1 -0
- package/dist/components/badge/Badge.styles.d.ts +8 -0
- package/dist/components/badge/Badge.styles.d.ts.map +1 -0
- package/dist/components/badge/Badge.styles.js +32 -0
- package/dist/components/badge/Badge.styles.js.map +1 -0
- package/dist/components/badge/Badge.types.d.ts +16 -0
- package/dist/components/badge/Badge.types.d.ts.map +1 -0
- package/dist/components/badge/Badge.types.js +8 -0
- package/dist/components/badge/Badge.types.js.map +1 -0
- package/dist/components/badge/Badge.variants.d.ts +23 -0
- package/dist/components/badge/Badge.variants.d.ts.map +1 -0
- package/dist/components/badge/Badge.variants.js +48 -0
- package/dist/components/badge/Badge.variants.js.map +1 -0
- package/dist/components/badge/index.d.ts +6 -0
- package/dist/components/badge/index.d.ts.map +1 -0
- package/dist/components/badge/index.js +9 -0
- package/dist/components/badge/index.js.map +1 -0
- package/dist/components/button/Button.d.ts +16 -0
- package/dist/components/button/Button.d.ts.map +1 -0
- package/dist/components/button/Button.js +61 -0
- package/dist/components/button/Button.js.map +1 -0
- package/dist/components/button/Button.styles.d.ts +8 -0
- package/dist/components/button/Button.styles.d.ts.map +1 -0
- package/dist/components/button/Button.styles.js +18 -0
- package/dist/components/button/Button.styles.js.map +1 -0
- package/dist/components/button/Button.types.d.ts +23 -0
- package/dist/components/button/Button.types.d.ts.map +1 -0
- package/dist/components/button/Button.types.js +6 -0
- package/dist/components/button/Button.types.js.map +1 -0
- package/dist/components/button/Button.variants.d.ts +11 -0
- package/dist/components/button/Button.variants.d.ts.map +1 -0
- package/dist/components/button/Button.variants.js +65 -0
- package/dist/components/button/Button.variants.js.map +1 -0
- package/dist/components/button/index.d.ts +6 -0
- package/dist/components/button/index.d.ts.map +1 -0
- package/dist/components/button/index.js +9 -0
- package/dist/components/button/index.js.map +1 -0
- package/dist/components/card/Card.d.ts +36 -0
- package/dist/components/card/Card.d.ts.map +1 -0
- package/dist/components/card/Card.js +53 -0
- package/dist/components/card/Card.js.map +1 -0
- package/dist/components/card/Card.styles.d.ts +8 -0
- package/dist/components/card/Card.styles.d.ts.map +1 -0
- package/dist/components/card/Card.styles.js +30 -0
- package/dist/components/card/Card.styles.js.map +1 -0
- package/dist/components/card/Card.types.d.ts +22 -0
- package/dist/components/card/Card.types.d.ts.map +1 -0
- package/dist/components/card/Card.types.js +9 -0
- package/dist/components/card/Card.types.js.map +1 -0
- package/dist/components/card/Card.variants.d.ts +14 -0
- package/dist/components/card/Card.variants.d.ts.map +1 -0
- package/dist/components/card/Card.variants.js +32 -0
- package/dist/components/card/Card.variants.js.map +1 -0
- package/dist/components/card/index.d.ts +6 -0
- package/dist/components/card/index.d.ts.map +1 -0
- package/dist/components/card/index.js +14 -0
- package/dist/components/card/index.js.map +1 -0
- package/dist/components/checkbox/CheckBox.d.ts +14 -0
- package/dist/components/checkbox/CheckBox.d.ts.map +1 -0
- package/dist/components/checkbox/CheckBox.js +40 -0
- package/dist/components/checkbox/CheckBox.js.map +1 -0
- package/dist/components/checkbox/CheckBox.styles.d.ts +8 -0
- package/dist/components/checkbox/CheckBox.styles.d.ts.map +1 -0
- package/dist/components/checkbox/CheckBox.styles.js +32 -0
- package/dist/components/checkbox/CheckBox.styles.js.map +1 -0
- package/dist/components/checkbox/CheckBox.types.d.ts +24 -0
- package/dist/components/checkbox/CheckBox.types.d.ts.map +1 -0
- package/dist/components/checkbox/CheckBox.types.js +9 -0
- package/dist/components/checkbox/CheckBox.types.js.map +1 -0
- package/dist/components/checkbox/CheckBox.variants.d.ts +14 -0
- package/dist/components/checkbox/CheckBox.variants.d.ts.map +1 -0
- package/dist/components/checkbox/CheckBox.variants.js +19 -0
- package/dist/components/checkbox/CheckBox.variants.js.map +1 -0
- package/dist/components/checkbox/index.d.ts +6 -0
- package/dist/components/checkbox/index.d.ts.map +1 -0
- package/dist/components/checkbox/index.js +9 -0
- package/dist/components/checkbox/index.js.map +1 -0
- package/dist/components/combobox/ComboBox.d.ts +16 -0
- package/dist/components/combobox/ComboBox.d.ts.map +1 -0
- package/dist/components/combobox/ComboBox.js +79 -0
- package/dist/components/combobox/ComboBox.js.map +1 -0
- package/dist/components/combobox/ComboBox.styles.d.ts +8 -0
- package/dist/components/combobox/ComboBox.styles.d.ts.map +1 -0
- package/dist/components/combobox/ComboBox.styles.js +57 -0
- package/dist/components/combobox/ComboBox.styles.js.map +1 -0
- package/dist/components/combobox/ComboBox.types.d.ts +46 -0
- package/dist/components/combobox/ComboBox.types.d.ts.map +1 -0
- package/dist/components/combobox/ComboBox.types.js +9 -0
- package/dist/components/combobox/ComboBox.types.js.map +1 -0
- package/dist/components/combobox/ComboBox.variants.d.ts +22 -0
- package/dist/components/combobox/ComboBox.variants.d.ts.map +1 -0
- package/dist/components/combobox/ComboBox.variants.js +68 -0
- package/dist/components/combobox/ComboBox.variants.js.map +1 -0
- package/dist/components/combobox/index.d.ts +6 -0
- package/dist/components/combobox/index.d.ts.map +1 -0
- package/dist/components/combobox/index.js +9 -0
- package/dist/components/combobox/index.js.map +1 -0
- package/dist/components/dialog/Dialog.d.ts +36 -0
- package/dist/components/dialog/Dialog.d.ts.map +1 -0
- package/dist/components/dialog/Dialog.js +84 -0
- package/dist/components/dialog/Dialog.js.map +1 -0
- package/dist/components/dialog/Dialog.styles.d.ts +8 -0
- package/dist/components/dialog/Dialog.styles.d.ts.map +1 -0
- package/dist/components/dialog/Dialog.styles.js +52 -0
- package/dist/components/dialog/Dialog.styles.js.map +1 -0
- package/dist/components/dialog/Dialog.types.d.ts +48 -0
- package/dist/components/dialog/Dialog.types.d.ts.map +1 -0
- package/dist/components/dialog/Dialog.types.js +10 -0
- package/dist/components/dialog/Dialog.types.js.map +1 -0
- package/dist/components/dialog/Dialog.variants.d.ts +13 -0
- package/dist/components/dialog/Dialog.variants.d.ts.map +1 -0
- package/dist/components/dialog/Dialog.variants.js +19 -0
- package/dist/components/dialog/Dialog.variants.js.map +1 -0
- package/dist/components/dialog/index.d.ts +6 -0
- package/dist/components/dialog/index.d.ts.map +1 -0
- package/dist/components/dialog/index.js +14 -0
- package/dist/components/dialog/index.js.map +1 -0
- package/dist/components/fab/FAB.d.ts +14 -0
- package/dist/components/fab/FAB.d.ts.map +1 -0
- package/dist/components/fab/FAB.js +46 -0
- package/dist/components/fab/FAB.js.map +1 -0
- package/dist/components/fab/FAB.styles.d.ts +8 -0
- package/dist/components/fab/FAB.styles.d.ts.map +1 -0
- package/dist/components/fab/FAB.styles.js +51 -0
- package/dist/components/fab/FAB.styles.js.map +1 -0
- package/dist/components/fab/FAB.types.d.ts +23 -0
- package/dist/components/fab/FAB.types.d.ts.map +1 -0
- package/dist/components/fab/FAB.types.js +8 -0
- package/dist/components/fab/FAB.types.js.map +1 -0
- package/dist/components/fab/FAB.variants.d.ts +48 -0
- package/dist/components/fab/FAB.variants.d.ts.map +1 -0
- package/dist/components/fab/FAB.variants.js +43 -0
- package/dist/components/fab/FAB.variants.js.map +1 -0
- package/dist/components/fab/index.d.ts +6 -0
- package/dist/components/fab/index.d.ts.map +1 -0
- package/dist/components/fab/index.js +9 -0
- package/dist/components/fab/index.js.map +1 -0
- package/dist/components/index.d.ts +30 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +46 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/input/Input.d.ts +17 -0
- package/dist/components/input/Input.d.ts.map +1 -0
- package/dist/components/input/Input.js +59 -0
- package/dist/components/input/Input.js.map +1 -0
- package/dist/components/input/Input.styles.d.ts +8 -0
- package/dist/components/input/Input.styles.d.ts.map +1 -0
- package/dist/components/input/Input.styles.js +25 -0
- package/dist/components/input/Input.styles.js.map +1 -0
- package/dist/components/input/Input.types.d.ts +25 -0
- package/dist/components/input/Input.types.d.ts.map +1 -0
- package/dist/components/input/Input.types.js +9 -0
- package/dist/components/input/Input.types.js.map +1 -0
- package/dist/components/input/Input.variants.d.ts +23 -0
- package/dist/components/input/Input.variants.d.ts.map +1 -0
- package/dist/components/input/Input.variants.js +61 -0
- package/dist/components/input/Input.variants.js.map +1 -0
- package/dist/components/input/index.d.ts +6 -0
- package/dist/components/input/index.d.ts.map +1 -0
- package/dist/components/input/index.js +9 -0
- package/dist/components/input/index.js.map +1 -0
- package/dist/components/separator/Separator.d.ts +17 -0
- package/dist/components/separator/Separator.d.ts.map +1 -0
- package/dist/components/separator/Separator.js +46 -0
- package/dist/components/separator/Separator.js.map +1 -0
- package/dist/components/separator/Separator.styles.d.ts +8 -0
- package/dist/components/separator/Separator.styles.d.ts.map +1 -0
- package/dist/components/separator/Separator.styles.js +25 -0
- package/dist/components/separator/Separator.styles.js.map +1 -0
- package/dist/components/separator/Separator.types.d.ts +25 -0
- package/dist/components/separator/Separator.types.d.ts.map +1 -0
- package/dist/components/separator/Separator.types.js +8 -0
- package/dist/components/separator/Separator.types.js.map +1 -0
- package/dist/components/separator/index.d.ts +6 -0
- package/dist/components/separator/index.d.ts.map +1 -0
- package/dist/components/separator/index.js +9 -0
- package/dist/components/separator/index.js.map +1 -0
- package/dist/components/text/Text.d.ts +18 -0
- package/dist/components/text/Text.d.ts.map +1 -0
- package/dist/components/text/Text.js +45 -0
- package/dist/components/text/Text.js.map +1 -0
- package/dist/components/text/Text.types.d.ts +14 -0
- package/dist/components/text/Text.types.d.ts.map +1 -0
- package/dist/components/text/Text.types.js +10 -0
- package/dist/components/text/Text.types.js.map +1 -0
- package/dist/components/text/Text.variants.d.ts +23 -0
- package/dist/components/text/Text.variants.d.ts.map +1 -0
- package/dist/components/text/Text.variants.js +32 -0
- package/dist/components/text/Text.variants.js.map +1 -0
- package/dist/components/text/index.d.ts +6 -0
- package/dist/components/text/index.d.ts.map +1 -0
- package/dist/components/text/index.js +9 -0
- package/dist/components/text/index.js.map +1 -0
- package/dist/design-tokens/animation.d.ts +22 -0
- package/dist/design-tokens/animation.d.ts.map +1 -0
- package/dist/design-tokens/animation.js +23 -0
- package/dist/design-tokens/animation.js.map +1 -0
- package/dist/design-tokens/border-radius.d.ts +15 -0
- package/dist/design-tokens/border-radius.d.ts.map +1 -0
- package/dist/design-tokens/border-radius.js +17 -0
- package/dist/design-tokens/border-radius.js.map +1 -0
- package/dist/design-tokens/colors.d.ts +179 -0
- package/dist/design-tokens/colors.d.ts.map +1 -0
- package/dist/design-tokens/colors.js +109 -0
- package/dist/design-tokens/colors.js.map +1 -0
- package/dist/design-tokens/index.d.ts +16 -0
- package/dist/design-tokens/index.d.ts.map +1 -0
- package/dist/design-tokens/index.js +32 -0
- package/dist/design-tokens/index.js.map +1 -0
- package/dist/design-tokens/shadows.d.ts +103 -0
- package/dist/design-tokens/shadows.d.ts.map +1 -0
- package/dist/design-tokens/shadows.js +75 -0
- package/dist/design-tokens/shadows.js.map +1 -0
- package/dist/design-tokens/spacing.d.ts +30 -0
- package/dist/design-tokens/spacing.d.ts.map +1 -0
- package/dist/design-tokens/spacing.js +32 -0
- package/dist/design-tokens/spacing.js.map +1 -0
- package/dist/design-tokens/typography.d.ts +40 -0
- package/dist/design-tokens/typography.d.ts.map +1 -0
- package/dist/design-tokens/typography.js +40 -0
- package/dist/design-tokens/typography.js.map +1 -0
- package/dist/primitives/Box.d.ts +38 -0
- package/dist/primitives/Box.d.ts.map +1 -0
- package/dist/primitives/Box.js +70 -0
- package/dist/primitives/Box.js.map +1 -0
- package/dist/primitives/Pressable.d.ts +30 -0
- package/dist/primitives/Pressable.d.ts.map +1 -0
- package/dist/primitives/Pressable.js +48 -0
- package/dist/primitives/Pressable.js.map +1 -0
- package/dist/primitives/Text.d.ts +23 -0
- package/dist/primitives/Text.d.ts.map +1 -0
- package/dist/primitives/Text.js +42 -0
- package/dist/primitives/Text.js.map +1 -0
- package/dist/primitives/index.d.ts +14 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +16 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/theme/ThemeContext.d.ts +10 -0
- package/dist/theme/ThemeContext.d.ts.map +1 -0
- package/dist/theme/ThemeContext.js +19 -0
- package/dist/theme/ThemeContext.js.map +1 -0
- package/dist/theme/ThemeProvider.d.ts +23 -0
- package/dist/theme/ThemeProvider.d.ts.map +1 -0
- package/dist/theme/ThemeProvider.js +87 -0
- package/dist/theme/ThemeProvider.js.map +1 -0
- package/dist/theme/index.d.ts +9 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +14 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/themes.d.ts +20 -0
- package/dist/theme/themes.d.ts.map +1 -0
- package/dist/theme/themes.js +65 -0
- package/dist/theme/themes.js.map +1 -0
- package/dist/theme/types.d.ts +92 -0
- package/dist/theme/types.d.ts.map +1 -0
- package/dist/theme/types.js +9 -0
- package/dist/theme/types.js.map +1 -0
- package/dist/theme/useTheme.d.ts +7 -0
- package/dist/theme/useTheme.d.ts.map +1 -0
- package/dist/theme/useTheme.js +9 -0
- package/dist/theme/useTheme.js.map +1 -0
- package/dist/utils/cn.d.ts +16 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/cn.js +33 -0
- package/dist/utils/cn.js.map +1 -0
- package/dist/utils/createVariants.d.ts +32 -0
- package/dist/utils/createVariants.d.ts.map +1 -0
- package/dist/utils/createVariants.js +26 -0
- package/dist/utils/createVariants.js.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +13 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/mergeProps.d.ts +10 -0
- package/dist/utils/mergeProps.d.ts.map +1 -0
- package/dist/utils/mergeProps.js +31 -0
- package/dist/utils/mergeProps.js.map +1 -0
- package/package.json +46 -3
- package/src/components/accordion/Accordion.styles.ts +46 -0
- package/src/components/accordion/Accordion.tsx +247 -0
- package/src/components/accordion/Accordion.types.ts +52 -0
- package/src/components/accordion/index.ts +17 -0
- package/src/components/alert/Alert.styles.ts +34 -0
- package/src/components/alert/Alert.tsx +87 -0
- package/src/components/alert/Alert.types.ts +24 -0
- package/src/components/alert/Alert.variants.ts +57 -0
- package/src/components/alert/index.ts +6 -0
- package/src/components/avatar/Avatar.styles.ts +20 -0
- package/src/components/avatar/Avatar.tsx +74 -0
- package/src/components/avatar/Avatar.types.ts +24 -0
- package/src/components/avatar/Avatar.variants.ts +55 -0
- package/src/components/avatar/index.ts +6 -0
- package/src/components/badge/Badge.styles.ts +30 -0
- package/src/components/badge/Badge.tsx +47 -0
- package/src/components/badge/Badge.types.ts +24 -0
- package/src/components/badge/Badge.variants.ts +62 -0
- package/src/components/badge/index.ts +6 -0
- package/src/components/button/Button.styles.ts +16 -0
- package/src/components/button/Button.tsx +108 -0
- package/src/components/button/Button.types.ts +30 -0
- package/src/components/button/Button.variants.ts +68 -0
- package/src/components/button/index.ts +6 -0
- package/src/components/card/Card.styles.ts +28 -0
- package/src/components/card/Card.tsx +112 -0
- package/src/components/card/Card.types.ts +26 -0
- package/src/components/card/Card.variants.ts +38 -0
- package/src/components/card/index.ts +18 -0
- package/src/components/checkbox/CheckBox.styles.ts +30 -0
- package/src/components/checkbox/CheckBox.tsx +98 -0
- package/src/components/checkbox/CheckBox.types.ts +26 -0
- package/src/components/checkbox/CheckBox.variants.ts +25 -0
- package/src/components/checkbox/index.ts +6 -0
- package/src/components/combobox/ComboBox.styles.ts +55 -0
- package/src/components/combobox/ComboBox.tsx +224 -0
- package/src/components/combobox/ComboBox.types.ts +51 -0
- package/src/components/combobox/ComboBox.variants.ts +82 -0
- package/src/components/combobox/index.ts +6 -0
- package/src/components/dialog/Dialog.styles.ts +50 -0
- package/src/components/dialog/Dialog.tsx +221 -0
- package/src/components/dialog/Dialog.types.ts +55 -0
- package/src/components/dialog/Dialog.variants.ts +24 -0
- package/src/components/dialog/index.ts +20 -0
- package/src/components/fab/FAB.styles.ts +49 -0
- package/src/components/fab/FAB.tsx +84 -0
- package/src/components/fab/FAB.types.ts +31 -0
- package/src/components/fab/FAB.variants.ts +55 -0
- package/src/components/fab/index.ts +6 -0
- package/src/components/index.ts +88 -0
- package/src/components/input/Input.styles.ts +23 -0
- package/src/components/input/Input.tsx +139 -0
- package/src/components/input/Input.types.ts +28 -0
- package/src/components/input/Input.variants.ts +71 -0
- package/src/components/input/index.ts +6 -0
- package/src/components/separator/Separator.styles.ts +23 -0
- package/src/components/separator/Separator.tsx +70 -0
- package/src/components/separator/Separator.types.ts +28 -0
- package/src/components/separator/index.ts +10 -0
- package/src/components/text/Text.tsx +75 -0
- package/src/components/text/Text.types.ts +27 -0
- package/src/components/text/Text.variants.ts +44 -0
- package/src/components/text/index.ts +6 -0
- package/src/design-tokens/animation.ts +23 -0
- package/src/design-tokens/border-radius.ts +16 -0
- package/src/design-tokens/colors.ts +120 -0
- package/src/design-tokens/index.ts +21 -0
- package/src/design-tokens/shadows.ts +78 -0
- package/src/design-tokens/spacing.ts +31 -0
- package/src/design-tokens/typography.ts +45 -0
- package/src/primitives/Box.tsx +121 -0
- package/src/primitives/Pressable.tsx +106 -0
- package/src/primitives/Text.tsx +84 -0
- package/src/primitives/index.ts +15 -0
- package/src/theme/ThemeContext.ts +20 -0
- package/src/theme/ThemeProvider.tsx +152 -0
- package/src/theme/index.ts +9 -0
- package/src/theme/themes.ts +71 -0
- package/src/theme/types.ts +89 -0
- package/src/theme/useTheme.ts +7 -0
- package/src/utils/cn.ts +37 -0
- package/src/utils/createVariants.ts +47 -0
- package/src/utils/index.ts +7 -0
- package/src/utils/mergeProps.ts +35 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Design Tokens: Colors
|
|
3
|
+
*
|
|
4
|
+
* Raw color palette + semantic color roles.
|
|
5
|
+
* Themes map semantic roles to raw palette values.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Raw palette — Slate (neutral)
|
|
9
|
+
export const slate = {
|
|
10
|
+
50: '#f8fafc',
|
|
11
|
+
100: '#f1f5f9',
|
|
12
|
+
200: '#e2e8f0',
|
|
13
|
+
300: '#cbd5e1',
|
|
14
|
+
400: '#94a3b8',
|
|
15
|
+
500: '#64748b',
|
|
16
|
+
600: '#475569',
|
|
17
|
+
700: '#334155',
|
|
18
|
+
800: '#1e293b',
|
|
19
|
+
900: '#0f172a',
|
|
20
|
+
950: '#020617',
|
|
21
|
+
} as const;
|
|
22
|
+
|
|
23
|
+
// Raw palette — Primary (blue)
|
|
24
|
+
export const primary = {
|
|
25
|
+
50: '#eff6ff',
|
|
26
|
+
100: '#dbeafe',
|
|
27
|
+
200: '#bfdbfe',
|
|
28
|
+
300: '#93c5fd',
|
|
29
|
+
400: '#60a5fa',
|
|
30
|
+
500: '#3b82f6',
|
|
31
|
+
600: '#2563eb',
|
|
32
|
+
700: '#1d4ed8',
|
|
33
|
+
800: '#1e40af',
|
|
34
|
+
900: '#1e3a8a',
|
|
35
|
+
950: '#172554',
|
|
36
|
+
} as const;
|
|
37
|
+
|
|
38
|
+
// Raw palette — Destructive (red)
|
|
39
|
+
export const destructive = {
|
|
40
|
+
50: '#fef2f2',
|
|
41
|
+
100: '#fee2e2',
|
|
42
|
+
200: '#fecaca',
|
|
43
|
+
300: '#fca5a5',
|
|
44
|
+
400: '#f87171',
|
|
45
|
+
500: '#ef4444',
|
|
46
|
+
600: '#dc2626',
|
|
47
|
+
700: '#b91c1c',
|
|
48
|
+
800: '#991b1b',
|
|
49
|
+
900: '#7f1d1d',
|
|
50
|
+
950: '#450a0a',
|
|
51
|
+
} as const;
|
|
52
|
+
|
|
53
|
+
// Raw palette — Secondary (muted)
|
|
54
|
+
export const secondary = {
|
|
55
|
+
50: '#f8fafc',
|
|
56
|
+
100: '#f1f5f9',
|
|
57
|
+
200: '#e2e8f0',
|
|
58
|
+
300: '#cbd5e1',
|
|
59
|
+
400: '#94a3b8',
|
|
60
|
+
500: '#64748b',
|
|
61
|
+
600: '#475569',
|
|
62
|
+
700: '#334155',
|
|
63
|
+
800: '#1e293b',
|
|
64
|
+
900: '#0f172a',
|
|
65
|
+
950: '#020617',
|
|
66
|
+
} as const;
|
|
67
|
+
|
|
68
|
+
// Raw palette — Muted (background accents)
|
|
69
|
+
export const muted = {
|
|
70
|
+
50: '#f8fafc',
|
|
71
|
+
100: '#f1f5f9',
|
|
72
|
+
200: '#e2e8f0',
|
|
73
|
+
300: '#cbd5e1',
|
|
74
|
+
400: '#94a3b8',
|
|
75
|
+
500: '#64748b',
|
|
76
|
+
600: '#475569',
|
|
77
|
+
700: '#334155',
|
|
78
|
+
800: '#1e293b',
|
|
79
|
+
900: '#0f172a',
|
|
80
|
+
950: '#020617',
|
|
81
|
+
} as const;
|
|
82
|
+
|
|
83
|
+
// Raw palette — Accent (green)
|
|
84
|
+
export const accent = {
|
|
85
|
+
50: '#f0fdf4',
|
|
86
|
+
100: '#dcfce7',
|
|
87
|
+
200: '#bbf7d0',
|
|
88
|
+
300: '#86efac',
|
|
89
|
+
400: '#4ade80',
|
|
90
|
+
500: '#22c55e',
|
|
91
|
+
600: '#16a34a',
|
|
92
|
+
700: '#15803d',
|
|
93
|
+
800: '#166534',
|
|
94
|
+
900: '#14532d',
|
|
95
|
+
950: '#052e16',
|
|
96
|
+
} as const;
|
|
97
|
+
|
|
98
|
+
// Raw palette — Popover / border / input
|
|
99
|
+
export const border = {
|
|
100
|
+
light: '#e2e8f0',
|
|
101
|
+
dark: '#334155',
|
|
102
|
+
} as const;
|
|
103
|
+
|
|
104
|
+
export type Slate = (typeof slate)[keyof typeof slate];
|
|
105
|
+
export type Primary = (typeof primary)[keyof typeof primary];
|
|
106
|
+
export type Destructive = (typeof destructive)[keyof typeof destructive];
|
|
107
|
+
export type Secondary = (typeof secondary)[keyof typeof secondary];
|
|
108
|
+
export type Muted = (typeof muted)[keyof typeof muted];
|
|
109
|
+
export type Accent = (typeof accent)[keyof typeof accent];
|
|
110
|
+
|
|
111
|
+
// Grouped palette namespace — lets consumers do `colors.slate[900]`, etc.
|
|
112
|
+
export const colors = {
|
|
113
|
+
slate,
|
|
114
|
+
primary,
|
|
115
|
+
destructive,
|
|
116
|
+
secondary,
|
|
117
|
+
muted,
|
|
118
|
+
accent,
|
|
119
|
+
border,
|
|
120
|
+
} as const;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Design Tokens: Barrel Export
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export { slate, primary, destructive, secondary, muted, accent, border, colors } from './colors';
|
|
6
|
+
export type { Slate, Primary, Destructive, Secondary, Muted, Accent } from './colors';
|
|
7
|
+
|
|
8
|
+
export { fontFamily, fontSize, fontWeight, lineHeight, letterSpacing } from './typography';
|
|
9
|
+
export type { FontSize, FontWeight, LineHeight } from './typography';
|
|
10
|
+
|
|
11
|
+
export { spacing } from './spacing';
|
|
12
|
+
export type { Spacing } from './spacing';
|
|
13
|
+
|
|
14
|
+
export { borderRadius } from './border-radius';
|
|
15
|
+
export type { BorderRadius } from './border-radius';
|
|
16
|
+
|
|
17
|
+
export { shadow, elevation, resolveShadow } from './shadows';
|
|
18
|
+
export type { ShadowKey, Elevation, ElevationKey } from './shadows';
|
|
19
|
+
|
|
20
|
+
export { animation } from './animation';
|
|
21
|
+
export type { AnimationDuration, AnimationEasing } from './animation';
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Design Tokens: Shadows & Elevation
|
|
3
|
+
*
|
|
4
|
+
* iOS uses shadowColor/shadowOffset/shadowOpacity/shadowRadius.
|
|
5
|
+
* Android uses elevation.
|
|
6
|
+
* Platform-specific resolution is centralized here.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Platform } from 'react-native';
|
|
10
|
+
|
|
11
|
+
export const shadow = {
|
|
12
|
+
xs: {
|
|
13
|
+
shadowColor: '#000',
|
|
14
|
+
shadowOffset: { width: 0, height: 1 },
|
|
15
|
+
shadowOpacity: 0.05,
|
|
16
|
+
shadowRadius: 2,
|
|
17
|
+
elevation: 1,
|
|
18
|
+
},
|
|
19
|
+
sm: {
|
|
20
|
+
shadowColor: '#000',
|
|
21
|
+
shadowOffset: { width: 0, height: 1 },
|
|
22
|
+
shadowOpacity: 0.1,
|
|
23
|
+
shadowRadius: 2,
|
|
24
|
+
elevation: 2,
|
|
25
|
+
},
|
|
26
|
+
md: {
|
|
27
|
+
shadowColor: '#000',
|
|
28
|
+
shadowOffset: { width: 0, height: 2 },
|
|
29
|
+
shadowOpacity: 0.1,
|
|
30
|
+
shadowRadius: 4,
|
|
31
|
+
elevation: 4,
|
|
32
|
+
},
|
|
33
|
+
lg: {
|
|
34
|
+
shadowColor: '#000',
|
|
35
|
+
shadowOffset: { width: 0, height: 4 },
|
|
36
|
+
shadowOpacity: 0.15,
|
|
37
|
+
shadowRadius: 6,
|
|
38
|
+
elevation: 8,
|
|
39
|
+
},
|
|
40
|
+
xl: {
|
|
41
|
+
shadowColor: '#000',
|
|
42
|
+
shadowOffset: { width: 0, height: 8 },
|
|
43
|
+
shadowOpacity: 0.2,
|
|
44
|
+
shadowRadius: 12,
|
|
45
|
+
elevation: 16,
|
|
46
|
+
},
|
|
47
|
+
} as const;
|
|
48
|
+
|
|
49
|
+
export const elevation = {
|
|
50
|
+
none: 0,
|
|
51
|
+
sm: 1,
|
|
52
|
+
md: 4,
|
|
53
|
+
lg: 8,
|
|
54
|
+
xl: 16,
|
|
55
|
+
'2xl': 24,
|
|
56
|
+
} as const;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Resolves a shadow token to platform-appropriate styles.
|
|
60
|
+
* iOS: shadow props; Android: elevation.
|
|
61
|
+
*/
|
|
62
|
+
export function resolveShadow(key: keyof typeof shadow) {
|
|
63
|
+
const token = shadow[key];
|
|
64
|
+
if (Platform.OS === 'android') {
|
|
65
|
+
return { elevation: token.elevation };
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
shadowColor: token.shadowColor,
|
|
69
|
+
shadowOffset: token.shadowOffset,
|
|
70
|
+
shadowOpacity: token.shadowOpacity,
|
|
71
|
+
shadowRadius: token.shadowRadius,
|
|
72
|
+
elevation: token.elevation,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export type ShadowKey = keyof typeof shadow;
|
|
77
|
+
export type Elevation = (typeof elevation)[keyof typeof elevation];
|
|
78
|
+
export type ElevationKey = keyof typeof elevation;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Design Tokens: Spacing
|
|
3
|
+
*
|
|
4
|
+
* Based on a 4px grid.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const spacing = {
|
|
8
|
+
0: 0,
|
|
9
|
+
1: 4,
|
|
10
|
+
2: 8,
|
|
11
|
+
3: 12,
|
|
12
|
+
4: 16,
|
|
13
|
+
5: 20,
|
|
14
|
+
6: 24,
|
|
15
|
+
7: 28,
|
|
16
|
+
8: 32,
|
|
17
|
+
9: 36,
|
|
18
|
+
10: 40,
|
|
19
|
+
11: 44,
|
|
20
|
+
12: 48,
|
|
21
|
+
14: 56,
|
|
22
|
+
16: 64,
|
|
23
|
+
20: 80,
|
|
24
|
+
24: 96,
|
|
25
|
+
28: 112,
|
|
26
|
+
32: 128,
|
|
27
|
+
36: 144,
|
|
28
|
+
40: 160,
|
|
29
|
+
} as const;
|
|
30
|
+
|
|
31
|
+
export type Spacing = keyof typeof spacing;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Design Tokens: Typography
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export const fontFamily = {
|
|
6
|
+
sans: 'System',
|
|
7
|
+
mono: 'Courier New',
|
|
8
|
+
} as const;
|
|
9
|
+
|
|
10
|
+
export const fontSize = {
|
|
11
|
+
xs: 12,
|
|
12
|
+
sm: 14,
|
|
13
|
+
base: 16,
|
|
14
|
+
lg: 18,
|
|
15
|
+
xl: 20,
|
|
16
|
+
'2xl': 24,
|
|
17
|
+
'3xl': 30,
|
|
18
|
+
} as const;
|
|
19
|
+
|
|
20
|
+
export const fontWeight = {
|
|
21
|
+
normal: '400',
|
|
22
|
+
medium: '500',
|
|
23
|
+
semibold: '600',
|
|
24
|
+
bold: '700',
|
|
25
|
+
} as const;
|
|
26
|
+
|
|
27
|
+
export const lineHeight = {
|
|
28
|
+
none: 1,
|
|
29
|
+
tight: 1.25,
|
|
30
|
+
normal: 1.5,
|
|
31
|
+
relaxed: 1.75,
|
|
32
|
+
} as const;
|
|
33
|
+
|
|
34
|
+
export const letterSpacing = {
|
|
35
|
+
tighter: -0.5,
|
|
36
|
+
tight: -0.25,
|
|
37
|
+
normal: 0,
|
|
38
|
+
wide: 0.25,
|
|
39
|
+
wider: 0.5,
|
|
40
|
+
widest: 1,
|
|
41
|
+
} as const;
|
|
42
|
+
|
|
43
|
+
export type FontSize = keyof typeof fontSize;
|
|
44
|
+
export type FontWeight = keyof typeof fontWeight;
|
|
45
|
+
export type LineHeight = keyof typeof lineHeight;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Primitive: Box
|
|
3
|
+
*
|
|
4
|
+
* A flexible layout primitive. Accepts all ViewProps plus theme-aware style
|
|
5
|
+
* tokens (padding, margin, background, border, shadow, etc.) resolved via
|
|
6
|
+
* the theme context.
|
|
7
|
+
*
|
|
8
|
+
* Static styles live in StyleSheet.create; dynamic values are token references.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { View, StyleSheet } from 'react-native';
|
|
12
|
+
import type {
|
|
13
|
+
ViewProps,
|
|
14
|
+
StyleProp,
|
|
15
|
+
ViewStyle,
|
|
16
|
+
} from 'react-native';
|
|
17
|
+
import { useTheme } from '../theme';
|
|
18
|
+
import { cn } from '../utils/cn';
|
|
19
|
+
import type { Spacing } from '../design-tokens/spacing';
|
|
20
|
+
import type { BorderRadius } from '../design-tokens/border-radius';
|
|
21
|
+
import type { ShadowKey } from '../design-tokens/shadows';
|
|
22
|
+
import type { ThemeColors } from '../theme/types';
|
|
23
|
+
|
|
24
|
+
export interface BoxProps extends ViewProps {
|
|
25
|
+
p?: Spacing;
|
|
26
|
+
px?: Spacing;
|
|
27
|
+
py?: Spacing;
|
|
28
|
+
pt?: Spacing;
|
|
29
|
+
pr?: Spacing;
|
|
30
|
+
pb?: Spacing;
|
|
31
|
+
pl?: Spacing;
|
|
32
|
+
m?: Spacing;
|
|
33
|
+
mx?: Spacing;
|
|
34
|
+
my?: Spacing;
|
|
35
|
+
mt?: Spacing;
|
|
36
|
+
mr?: Spacing;
|
|
37
|
+
mb?: Spacing;
|
|
38
|
+
ml?: Spacing;
|
|
39
|
+
bg?: keyof import('../theme/types').ThemeColors;
|
|
40
|
+
borderRadius?: BorderRadius;
|
|
41
|
+
shadow?: ShadowKey;
|
|
42
|
+
style?: StyleProp<ViewStyle>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const baseStyles = StyleSheet.create({
|
|
46
|
+
root: {},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export function Box({
|
|
50
|
+
p, px, py, pt, pr, pb, pl,
|
|
51
|
+
m, mx, my, mt, mr, mb, ml,
|
|
52
|
+
bg,
|
|
53
|
+
borderRadius: radius,
|
|
54
|
+
shadow: shadowKey,
|
|
55
|
+
style,
|
|
56
|
+
children,
|
|
57
|
+
...rest
|
|
58
|
+
}: BoxProps) {
|
|
59
|
+
const { theme } = useTheme();
|
|
60
|
+
|
|
61
|
+
const paddingStyle: ViewStyle = {};
|
|
62
|
+
if (p !== undefined) {
|
|
63
|
+
paddingStyle.padding = theme.spacing.scale[p];
|
|
64
|
+
}
|
|
65
|
+
if (px !== undefined) {
|
|
66
|
+
paddingStyle.paddingHorizontal = theme.spacing.scale[px];
|
|
67
|
+
}
|
|
68
|
+
if (py !== undefined) {
|
|
69
|
+
paddingStyle.paddingVertical = theme.spacing.scale[py];
|
|
70
|
+
}
|
|
71
|
+
if (pt !== undefined) paddingStyle.paddingTop = theme.spacing.scale[pt];
|
|
72
|
+
if (pr !== undefined) paddingStyle.paddingRight = theme.spacing.scale[pr];
|
|
73
|
+
if (pb !== undefined) paddingStyle.paddingBottom = theme.spacing.scale[pb];
|
|
74
|
+
if (pl !== undefined) paddingStyle.paddingLeft = theme.spacing.scale[pl];
|
|
75
|
+
|
|
76
|
+
const marginStyle: ViewStyle = {};
|
|
77
|
+
if (m !== undefined) {
|
|
78
|
+
marginStyle.margin = theme.spacing.scale[m];
|
|
79
|
+
}
|
|
80
|
+
if (mx !== undefined) {
|
|
81
|
+
marginStyle.marginHorizontal = theme.spacing.scale[mx];
|
|
82
|
+
}
|
|
83
|
+
if (my !== undefined) {
|
|
84
|
+
marginStyle.marginVertical = theme.spacing.scale[my];
|
|
85
|
+
}
|
|
86
|
+
if (mt !== undefined) marginStyle.marginTop = theme.spacing.scale[mt];
|
|
87
|
+
if (mr !== undefined) marginStyle.marginRight = theme.spacing.scale[mr];
|
|
88
|
+
if (mb !== undefined) marginStyle.marginBottom = theme.spacing.scale[mb];
|
|
89
|
+
if (ml !== undefined) marginStyle.marginLeft = theme.spacing.scale[ml];
|
|
90
|
+
|
|
91
|
+
const backgroundStyle: ViewStyle = {};
|
|
92
|
+
if (bg !== undefined) {
|
|
93
|
+
backgroundStyle.backgroundColor = theme.colors[bg];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const radiusStyle: ViewStyle = {};
|
|
97
|
+
if (radius !== undefined) {
|
|
98
|
+
radiusStyle.borderRadius = theme.borderRadius.scale[radius];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const shadowStyle = shadowKey !== undefined ? theme.shadows.resolve(shadowKey) : {};
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<View
|
|
105
|
+
{...rest}
|
|
106
|
+
style={cn(
|
|
107
|
+
baseStyles.root,
|
|
108
|
+
paddingStyle,
|
|
109
|
+
marginStyle,
|
|
110
|
+
backgroundStyle,
|
|
111
|
+
radiusStyle,
|
|
112
|
+
shadowStyle,
|
|
113
|
+
style,
|
|
114
|
+
)}
|
|
115
|
+
>
|
|
116
|
+
{children}
|
|
117
|
+
</View>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
Box.displayName = 'Box';
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Primitive: Pressable
|
|
3
|
+
*
|
|
4
|
+
* A touchable primitive with theme-aware styling and full accessibility.
|
|
5
|
+
* Wraps React Native's Pressable. Uses the render prop's `pressed` state to
|
|
6
|
+
* apply a pressed visual style (opacity by default, or a `pressedStyle`
|
|
7
|
+
* override) without re-mounting or nesting child pressables.
|
|
8
|
+
*
|
|
9
|
+
* Supports disabled state (visual + accessibility) and forwards all
|
|
10
|
+
* Pressable props.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
Pressable,
|
|
15
|
+
StyleSheet,
|
|
16
|
+
} from 'react-native';
|
|
17
|
+
import type { PressableProps, StyleProp, ViewStyle } from 'react-native';
|
|
18
|
+
import { useTheme } from '../theme';
|
|
19
|
+
import { cn } from '../utils/cn';
|
|
20
|
+
import type { Spacing } from '../design-tokens/spacing';
|
|
21
|
+
import type { BorderRadius } from '../design-tokens/border-radius';
|
|
22
|
+
|
|
23
|
+
export interface PressablePrimitiveProps extends Omit<PressableProps, 'style'> {
|
|
24
|
+
p?: Spacing;
|
|
25
|
+
px?: Spacing;
|
|
26
|
+
py?: Spacing;
|
|
27
|
+
bg?: keyof import('../theme/types').ThemeColors;
|
|
28
|
+
borderRadius?: BorderRadius;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/** Extra style applied while the pressable is pressed. */
|
|
31
|
+
pressedStyle?: StyleProp<ViewStyle>;
|
|
32
|
+
style?: StyleProp<ViewStyle>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const baseStyles = StyleSheet.create({
|
|
36
|
+
root: {},
|
|
37
|
+
pressed: {
|
|
38
|
+
opacity: 0.75,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export function PressablePrimitive({
|
|
43
|
+
p,
|
|
44
|
+
px,
|
|
45
|
+
py,
|
|
46
|
+
bg,
|
|
47
|
+
borderRadius: radius,
|
|
48
|
+
disabled,
|
|
49
|
+
pressedStyle,
|
|
50
|
+
style,
|
|
51
|
+
children,
|
|
52
|
+
onPress,
|
|
53
|
+
onLongPress,
|
|
54
|
+
onPressIn,
|
|
55
|
+
onPressOut,
|
|
56
|
+
...rest
|
|
57
|
+
}: PressablePrimitiveProps) {
|
|
58
|
+
const { theme } = useTheme();
|
|
59
|
+
|
|
60
|
+
const paddingStyle: ViewStyle = {};
|
|
61
|
+
if (p !== undefined) {
|
|
62
|
+
paddingStyle.padding = theme.spacing.scale[p];
|
|
63
|
+
}
|
|
64
|
+
if (px !== undefined) {
|
|
65
|
+
paddingStyle.paddingHorizontal = theme.spacing.scale[px];
|
|
66
|
+
}
|
|
67
|
+
if (py !== undefined) {
|
|
68
|
+
paddingStyle.paddingVertical = theme.spacing.scale[py];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const backgroundStyle: ViewStyle = {};
|
|
72
|
+
if (bg !== undefined) {
|
|
73
|
+
backgroundStyle.backgroundColor = theme.colors[bg];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const radiusStyle: ViewStyle = {};
|
|
77
|
+
if (radius !== undefined) {
|
|
78
|
+
radiusStyle.borderRadius = theme.borderRadius.scale[radius];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<Pressable
|
|
83
|
+
disabled={disabled}
|
|
84
|
+
onPress={disabled ? undefined : onPress}
|
|
85
|
+
onLongPress={disabled ? undefined : onLongPress}
|
|
86
|
+
onPressIn={disabled ? undefined : onPressIn}
|
|
87
|
+
onPressOut={disabled ? undefined : onPressOut}
|
|
88
|
+
style={({ pressed }) =>
|
|
89
|
+
cn(
|
|
90
|
+
baseStyles.root,
|
|
91
|
+
paddingStyle,
|
|
92
|
+
backgroundStyle,
|
|
93
|
+
radiusStyle,
|
|
94
|
+
disabled ? { opacity: 0.5 } : {},
|
|
95
|
+
pressed ? (pressedStyle ?? baseStyles.pressed) : {},
|
|
96
|
+
style,
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
{...rest}
|
|
100
|
+
>
|
|
101
|
+
{children}
|
|
102
|
+
</Pressable>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
PressablePrimitive.displayName = 'Pressable';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Primitive: Text
|
|
3
|
+
*
|
|
4
|
+
* A text primitive with theme-aware typography tokens.
|
|
5
|
+
* Supports color, fontSize, fontWeight, lineHeight, and text alignment.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Text, StyleSheet } from 'react-native';
|
|
9
|
+
import type { TextProps, StyleProp, TextStyle } from 'react-native';
|
|
10
|
+
import { useTheme } from '../theme';
|
|
11
|
+
import { cn } from '../utils/cn';
|
|
12
|
+
import type { FontSize } from '../design-tokens/typography';
|
|
13
|
+
import type { FontWeight } from '../design-tokens/typography';
|
|
14
|
+
import type { LineHeight } from '../design-tokens/typography';
|
|
15
|
+
|
|
16
|
+
export interface TextPrimitiveProps extends TextProps {
|
|
17
|
+
color?: keyof import('../theme/types').ThemeColors;
|
|
18
|
+
fontSize?: FontSize;
|
|
19
|
+
fontWeight?: FontWeight;
|
|
20
|
+
lineHeight?: LineHeight;
|
|
21
|
+
align?: 'left' | 'center' | 'right' | 'justify';
|
|
22
|
+
style?: StyleProp<TextStyle>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const baseStyles = StyleSheet.create({
|
|
26
|
+
root: {},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export function TextPrimitive({
|
|
30
|
+
color,
|
|
31
|
+
fontSize: size,
|
|
32
|
+
fontWeight: weight,
|
|
33
|
+
lineHeight: height,
|
|
34
|
+
align,
|
|
35
|
+
style,
|
|
36
|
+
children,
|
|
37
|
+
...rest
|
|
38
|
+
}: TextPrimitiveProps) {
|
|
39
|
+
const { theme } = useTheme();
|
|
40
|
+
|
|
41
|
+
const colorStyle: TextStyle = {};
|
|
42
|
+
if (color !== undefined) {
|
|
43
|
+
colorStyle.color = theme.colors[color];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const sizeStyle: TextStyle = {};
|
|
47
|
+
if (size !== undefined) {
|
|
48
|
+
sizeStyle.fontSize = theme.typography.fontSize[size];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const weightStyle: TextStyle = {};
|
|
52
|
+
if (weight !== undefined) {
|
|
53
|
+
weightStyle.fontWeight = theme.typography.fontWeight[weight];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const heightStyle: TextStyle = {};
|
|
57
|
+
if (height !== undefined) {
|
|
58
|
+
heightStyle.lineHeight = theme.typography.lineHeight[height];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const alignStyle: TextStyle = {};
|
|
62
|
+
if (align !== undefined) {
|
|
63
|
+
alignStyle.textAlign = align;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<Text
|
|
68
|
+
{...rest}
|
|
69
|
+
style={cn(
|
|
70
|
+
baseStyles.root,
|
|
71
|
+
colorStyle,
|
|
72
|
+
sizeStyle,
|
|
73
|
+
weightStyle,
|
|
74
|
+
heightStyle,
|
|
75
|
+
alignStyle,
|
|
76
|
+
style,
|
|
77
|
+
)}
|
|
78
|
+
>
|
|
79
|
+
{children}
|
|
80
|
+
</Text>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
TextPrimitive.displayName = 'Text';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Primitive: Barrel Export
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export { Box } from './Box';
|
|
6
|
+
export { TextPrimitive } from './Text';
|
|
7
|
+
export { PressablePrimitive as Pressable } from './Pressable';
|
|
8
|
+
export type { BoxProps } from './Box';
|
|
9
|
+
export type { TextPrimitiveProps } from './Text';
|
|
10
|
+
export type { PressablePrimitiveProps as PressableProps } from './Pressable';
|
|
11
|
+
|
|
12
|
+
/** @deprecated The primitive `Text` is now exported as `TextPrimitive`; the public `Text` component lives in `components/text`. */
|
|
13
|
+
export { TextPrimitive as Text } from './Text';
|
|
14
|
+
/** @deprecated Use `TextPrimitiveProps`; the public `TextProps` belongs to the `Text` component. */
|
|
15
|
+
export type { TextPrimitiveProps as TextProps } from './Text';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Theme: ThemeContext
|
|
3
|
+
*
|
|
4
|
+
* React Context holding the active theme. Provided by ThemeProvider.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { createContext, useContext } from 'react';
|
|
8
|
+
import type { Theme, ThemeContextValue } from './types';
|
|
9
|
+
|
|
10
|
+
export const ThemeContext = createContext<ThemeContextValue | undefined>(undefined);
|
|
11
|
+
|
|
12
|
+
export function useTheme(): ThemeContextValue {
|
|
13
|
+
const context = useContext(ThemeContext);
|
|
14
|
+
if (context === undefined) {
|
|
15
|
+
throw new Error('useTheme must be used within a ThemeProvider');
|
|
16
|
+
}
|
|
17
|
+
return context;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type { Theme, ThemeContextValue };
|