@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,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Component: Avatar Variants
|
|
3
|
+
*
|
|
4
|
+
* Size and shape style definitions resolved against the active theme at
|
|
5
|
+
* render time.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { TextStyle, ViewStyle } from 'react-native';
|
|
9
|
+
import type { Theme } from '../../theme/types';
|
|
10
|
+
import type { AvatarSize, AvatarVariant } from './Avatar.types';
|
|
11
|
+
import { borderRadius } from '../../design-tokens';
|
|
12
|
+
|
|
13
|
+
export interface AvatarVariantConfig {
|
|
14
|
+
size: Record<AvatarSize, ViewStyle>;
|
|
15
|
+
textSize: Record<AvatarSize, TextStyle>;
|
|
16
|
+
variant: Record<AvatarVariant, ViewStyle>;
|
|
17
|
+
defaultSize: AvatarSize;
|
|
18
|
+
defaultVariant: AvatarVariant;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function getAvatarVariants(theme: Theme): AvatarVariantConfig {
|
|
22
|
+
return {
|
|
23
|
+
size: {
|
|
24
|
+
sm: { width: 32, height: 32 },
|
|
25
|
+
default: { width: 40, height: 40 },
|
|
26
|
+
lg: { width: 56, height: 56 },
|
|
27
|
+
xl: { width: 72, height: 72 },
|
|
28
|
+
},
|
|
29
|
+
textSize: {
|
|
30
|
+
sm: { fontSize: theme.typography.fontSize.xs },
|
|
31
|
+
default: { fontSize: theme.typography.fontSize.sm },
|
|
32
|
+
lg: { fontSize: theme.typography.fontSize.base },
|
|
33
|
+
xl: { fontSize: theme.typography.fontSize.lg },
|
|
34
|
+
},
|
|
35
|
+
variant: {
|
|
36
|
+
circle: { borderRadius: borderRadius.full },
|
|
37
|
+
rounded: { borderRadius: borderRadius.lg },
|
|
38
|
+
},
|
|
39
|
+
defaultSize: 'default',
|
|
40
|
+
defaultVariant: 'circle',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Derives up to two initials from a full name ("Ada Lovelace" → "AL").
|
|
46
|
+
* Single-word names use the first two letters.
|
|
47
|
+
*/
|
|
48
|
+
export function getInitials(name: string): string {
|
|
49
|
+
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
50
|
+
if (parts.length === 0) return '?';
|
|
51
|
+
if (parts.length === 1) return parts[0]!.slice(0, 2).toUpperCase();
|
|
52
|
+
const first = parts[0]!;
|
|
53
|
+
const last = parts[parts.length - 1]!;
|
|
54
|
+
return (first[0]! + last[0]!).toUpperCase();
|
|
55
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Component: Badge Styles
|
|
3
|
+
*
|
|
4
|
+
* Static styles created with StyleSheet.create. The chip surface and text
|
|
5
|
+
* colors are resolved from the theme at render time via Badge.variants.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { StyleSheet } from 'react-native';
|
|
9
|
+
import { spacing } from '../../design-tokens';
|
|
10
|
+
|
|
11
|
+
export const badgeStyles = StyleSheet.create({
|
|
12
|
+
root: {
|
|
13
|
+
alignSelf: 'flex-start',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
justifyContent: 'center',
|
|
16
|
+
borderRadius: 9999,
|
|
17
|
+
},
|
|
18
|
+
sm: {
|
|
19
|
+
paddingHorizontal: spacing[2],
|
|
20
|
+
paddingVertical: spacing[0],
|
|
21
|
+
},
|
|
22
|
+
default: {
|
|
23
|
+
paddingHorizontal: spacing[2],
|
|
24
|
+
paddingVertical: spacing[1],
|
|
25
|
+
},
|
|
26
|
+
lg: {
|
|
27
|
+
paddingHorizontal: spacing[3],
|
|
28
|
+
paddingVertical: spacing[1],
|
|
29
|
+
},
|
|
30
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Component: Badge
|
|
3
|
+
*
|
|
4
|
+
* A small status/label chip with variant/size support. The chip surface and
|
|
5
|
+
* text color are resolved from the active theme.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { useTheme } from '../../theme';
|
|
9
|
+
import { cn } from '../../utils/cn';
|
|
10
|
+
import { TextPrimitive } from '../../primitives/Text';
|
|
11
|
+
import { getBadgeVariants } from './Badge.variants';
|
|
12
|
+
import { badgeStyles } from './Badge.styles';
|
|
13
|
+
import type { BadgeProps, BadgeVariant, BadgeSize } from './Badge.types';
|
|
14
|
+
|
|
15
|
+
export function Badge({
|
|
16
|
+
variant: variantProp,
|
|
17
|
+
size: sizeProp,
|
|
18
|
+
style,
|
|
19
|
+
textStyle,
|
|
20
|
+
...rest
|
|
21
|
+
}: BadgeProps) {
|
|
22
|
+
const { theme } = useTheme();
|
|
23
|
+
const { variant, fontSize, defaultVariant, defaultSize } = getBadgeVariants(theme);
|
|
24
|
+
|
|
25
|
+
const variantKey: BadgeVariant = variantProp ?? defaultVariant;
|
|
26
|
+
const sizeKey: BadgeSize = sizeProp ?? defaultSize;
|
|
27
|
+
const entry = variant[variantKey];
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<TextPrimitive
|
|
31
|
+
{...rest}
|
|
32
|
+
fontSize={fontSize[sizeKey]}
|
|
33
|
+
fontWeight="medium"
|
|
34
|
+
style={cn(
|
|
35
|
+
badgeStyles.root,
|
|
36
|
+
badgeStyles[sizeKey],
|
|
37
|
+
entry.container,
|
|
38
|
+
entry.text,
|
|
39
|
+
textStyle,
|
|
40
|
+
)}
|
|
41
|
+
>
|
|
42
|
+
{rest.children}
|
|
43
|
+
</TextPrimitive>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
Badge.displayName = 'Badge';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Component: Badge Types
|
|
3
|
+
*
|
|
4
|
+
* A small status/label chip.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { TextProps, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
8
|
+
|
|
9
|
+
export type BadgeVariant =
|
|
10
|
+
| 'default'
|
|
11
|
+
| 'secondary'
|
|
12
|
+
| 'outline'
|
|
13
|
+
| 'destructive'
|
|
14
|
+
| 'success';
|
|
15
|
+
|
|
16
|
+
export type BadgeSize = 'sm' | 'default' | 'lg';
|
|
17
|
+
|
|
18
|
+
export interface BadgeProps extends Omit<TextProps, 'style'> {
|
|
19
|
+
variant?: BadgeVariant;
|
|
20
|
+
size?: BadgeSize;
|
|
21
|
+
style?: StyleProp<ViewStyle>;
|
|
22
|
+
/** Style applied to the inner text. */
|
|
23
|
+
textStyle?: StyleProp<TextStyle>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Component: Badge Variants
|
|
3
|
+
*
|
|
4
|
+
* Variant surface/text color pairs resolved against the active theme at
|
|
5
|
+
* render time. Existing semantic roles are reused: `accent` (green) for
|
|
6
|
+
* success — no hardcoded colors.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { TextStyle, ViewStyle } from 'react-native';
|
|
10
|
+
import type { Theme } from '../../theme/types';
|
|
11
|
+
import type { BadgeVariant, BadgeSize } from './Badge.types';
|
|
12
|
+
import type { FontSize } from '../../design-tokens/typography';
|
|
13
|
+
|
|
14
|
+
export interface BadgeVariantEntry {
|
|
15
|
+
container: ViewStyle;
|
|
16
|
+
text: TextStyle;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface BadgeVariantConfig {
|
|
20
|
+
variant: Record<BadgeVariant, BadgeVariantEntry>;
|
|
21
|
+
fontSize: Record<BadgeSize, FontSize>;
|
|
22
|
+
defaultVariant: BadgeVariant;
|
|
23
|
+
defaultSize: BadgeSize;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function getBadgeVariants(theme: Theme): BadgeVariantConfig {
|
|
27
|
+
return {
|
|
28
|
+
variant: {
|
|
29
|
+
default: {
|
|
30
|
+
container: { backgroundColor: theme.colors.primary },
|
|
31
|
+
text: { color: theme.colors.primaryForeground },
|
|
32
|
+
},
|
|
33
|
+
secondary: {
|
|
34
|
+
container: { backgroundColor: theme.colors.secondary },
|
|
35
|
+
text: { color: theme.colors.secondaryForeground },
|
|
36
|
+
},
|
|
37
|
+
outline: {
|
|
38
|
+
container: {
|
|
39
|
+
backgroundColor: 'transparent',
|
|
40
|
+
borderWidth: 1,
|
|
41
|
+
borderColor: theme.colors.border,
|
|
42
|
+
},
|
|
43
|
+
text: { color: theme.colors.foreground },
|
|
44
|
+
},
|
|
45
|
+
destructive: {
|
|
46
|
+
container: { backgroundColor: theme.colors.destructive },
|
|
47
|
+
text: { color: theme.colors.destructiveForeground },
|
|
48
|
+
},
|
|
49
|
+
success: {
|
|
50
|
+
container: { backgroundColor: theme.colors.accent },
|
|
51
|
+
text: { color: theme.colors.accentForeground },
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
fontSize: {
|
|
55
|
+
sm: 'xs',
|
|
56
|
+
default: 'sm',
|
|
57
|
+
lg: 'base',
|
|
58
|
+
},
|
|
59
|
+
defaultVariant: 'default',
|
|
60
|
+
defaultSize: 'default',
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Component: Button Styles
|
|
3
|
+
*
|
|
4
|
+
* Base styles created with StyleSheet.create. All theme-dependent values
|
|
5
|
+
* are resolved at render time in Button.tsx via the theme context.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { StyleSheet } from 'react-native';
|
|
9
|
+
|
|
10
|
+
export const buttonStyles = StyleSheet.create({
|
|
11
|
+
root: {
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
justifyContent: 'center',
|
|
14
|
+
},
|
|
15
|
+
text: {},
|
|
16
|
+
});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Component: Button
|
|
3
|
+
*
|
|
4
|
+
* A pressable button with variant/size support, disabled state, and full
|
|
5
|
+
* accessibility. Built on the Pressable primitive.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { useTheme } from '../../theme';
|
|
9
|
+
import { cn } from '../../utils/cn';
|
|
10
|
+
import { PressablePrimitive } from '../../primitives/Pressable';
|
|
11
|
+
import { TextPrimitive } from '../../primitives/Text';
|
|
12
|
+
import { getButtonVariants } from './Button.variants';
|
|
13
|
+
import { buttonStyles } from './Button.styles';
|
|
14
|
+
import type { ButtonProps, ButtonVariant, ButtonSize } from './Button.types';
|
|
15
|
+
|
|
16
|
+
export interface ButtonComponentProps extends ButtonProps {
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function resolveBgColor(
|
|
21
|
+
variant: ButtonVariant,
|
|
22
|
+
): keyof import('../../theme/types').ThemeColors | undefined {
|
|
23
|
+
if (variant === 'default') return 'primary';
|
|
24
|
+
if (variant === 'destructive') return 'destructive';
|
|
25
|
+
if (variant === 'secondary') return 'secondary';
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function resolveTextColor(
|
|
30
|
+
variant: ButtonVariant,
|
|
31
|
+
theme: ReturnType<typeof useTheme>['theme']['colors'],
|
|
32
|
+
): string {
|
|
33
|
+
if (variant === 'default') return theme.primaryForeground;
|
|
34
|
+
if (variant === 'destructive') return theme.destructiveForeground;
|
|
35
|
+
if (variant === 'outline') return theme.primary;
|
|
36
|
+
if (variant === 'secondary') return theme.secondaryForeground;
|
|
37
|
+
if (variant === 'ghost') return theme.foreground;
|
|
38
|
+
if (variant === 'link') return theme.primary;
|
|
39
|
+
return theme.foreground;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function resolveTextSize(size: ButtonSize, theme: ReturnType<typeof useTheme>['theme']['typography']): number {
|
|
43
|
+
if (size === 'sm') return theme.fontSize.sm;
|
|
44
|
+
if (size === 'lg') return theme.fontSize.lg;
|
|
45
|
+
return theme.fontSize.base;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function Button({
|
|
49
|
+
children,
|
|
50
|
+
variant: variantProp,
|
|
51
|
+
size: sizeProp,
|
|
52
|
+
disabled,
|
|
53
|
+
style,
|
|
54
|
+
onPress,
|
|
55
|
+
accessibilityLabel,
|
|
56
|
+
accessibilityRole = 'button',
|
|
57
|
+
accessibilityHint,
|
|
58
|
+
...rest
|
|
59
|
+
}: ButtonComponentProps) {
|
|
60
|
+
const theme = useTheme();
|
|
61
|
+
|
|
62
|
+
const { variants, defaultVariants } = getButtonVariants(theme.theme);
|
|
63
|
+
const variant = variantProp ?? defaultVariants.variant;
|
|
64
|
+
const size = sizeProp ?? defaultVariants.size;
|
|
65
|
+
|
|
66
|
+
const variantStyle = variants.variant[variant];
|
|
67
|
+
const sizeStyle = variants.size[size];
|
|
68
|
+
|
|
69
|
+
const bgColor = resolveBgColor(variant);
|
|
70
|
+
const textColor = resolveTextColor(variant, theme.theme.colors);
|
|
71
|
+
const textSize = resolveTextSize(size, theme.theme.typography);
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<PressablePrimitive
|
|
75
|
+
disabled={disabled}
|
|
76
|
+
onPress={onPress}
|
|
77
|
+
accessibilityLabel={accessibilityLabel}
|
|
78
|
+
accessibilityRole={accessibilityRole}
|
|
79
|
+
accessibilityHint={accessibilityHint}
|
|
80
|
+
accessibilityState={{ disabled }}
|
|
81
|
+
bg={bgColor}
|
|
82
|
+
style={cn(
|
|
83
|
+
buttonStyles.root,
|
|
84
|
+
variantStyle,
|
|
85
|
+
sizeStyle,
|
|
86
|
+
disabled ? { opacity: 0.5 } : {},
|
|
87
|
+
style,
|
|
88
|
+
)}
|
|
89
|
+
{...rest}
|
|
90
|
+
>
|
|
91
|
+
<TextPrimitive
|
|
92
|
+
style={cn(
|
|
93
|
+
buttonStyles.text,
|
|
94
|
+
{ color: textColor },
|
|
95
|
+
{ fontSize: textSize },
|
|
96
|
+
{ fontWeight: theme.theme.typography.fontWeight.semibold },
|
|
97
|
+
disabled ? { opacity: 0.5 } : {},
|
|
98
|
+
)}
|
|
99
|
+
>
|
|
100
|
+
{children}
|
|
101
|
+
</TextPrimitive>
|
|
102
|
+
</PressablePrimitive>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
Button.displayName = 'Button';
|
|
107
|
+
|
|
108
|
+
export type { ButtonProps, ButtonVariant, ButtonSize };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Component: Button Types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { PressableProps } from 'react-native';
|
|
6
|
+
|
|
7
|
+
export type ButtonVariant =
|
|
8
|
+
| 'default'
|
|
9
|
+
| 'destructive'
|
|
10
|
+
| 'outline'
|
|
11
|
+
| 'secondary'
|
|
12
|
+
| 'ghost'
|
|
13
|
+
| 'link';
|
|
14
|
+
|
|
15
|
+
export type ButtonSize = 'sm' | 'default' | 'lg';
|
|
16
|
+
|
|
17
|
+
export interface ButtonProps extends PressableProps {
|
|
18
|
+
variant?: ButtonVariant;
|
|
19
|
+
size?: ButtonSize;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
style?: import('react-native').StyleProp<import('react-native').ViewStyle>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ButtonVariantConfig {
|
|
25
|
+
variants: {
|
|
26
|
+
variant: Record<ButtonVariant, import('react-native').ViewStyle>;
|
|
27
|
+
size: Record<ButtonSize, import('react-native').ViewStyle>;
|
|
28
|
+
};
|
|
29
|
+
defaultVariants: { variant: ButtonVariant; size: ButtonSize };
|
|
30
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Component: Button Variants
|
|
3
|
+
*
|
|
4
|
+
* Variant style definitions resolved against the active theme at render time.
|
|
5
|
+
* Each variant maps semantic theme colors to visual styles.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Theme } from '../../theme/types';
|
|
9
|
+
import type { ButtonVariantConfig, ButtonVariant, ButtonSize } from './Button.types';
|
|
10
|
+
import { spacing, borderRadius } from '../../design-tokens';
|
|
11
|
+
|
|
12
|
+
export function getButtonVariants(theme: Theme): ButtonVariantConfig {
|
|
13
|
+
const baseTextStyle: import('react-native').TextStyle = {
|
|
14
|
+
fontWeight: theme.typography.fontWeight.semibold,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
variants: {
|
|
19
|
+
variant: {
|
|
20
|
+
default: {
|
|
21
|
+
backgroundColor: theme.colors.primary,
|
|
22
|
+
},
|
|
23
|
+
destructive: {
|
|
24
|
+
backgroundColor: theme.colors.destructive,
|
|
25
|
+
},
|
|
26
|
+
outline: {
|
|
27
|
+
borderWidth: 1,
|
|
28
|
+
borderColor: theme.colors.border,
|
|
29
|
+
backgroundColor: 'transparent',
|
|
30
|
+
},
|
|
31
|
+
secondary: {
|
|
32
|
+
backgroundColor: theme.colors.secondary,
|
|
33
|
+
},
|
|
34
|
+
ghost: {
|
|
35
|
+
backgroundColor: 'transparent',
|
|
36
|
+
},
|
|
37
|
+
link: {
|
|
38
|
+
backgroundColor: 'transparent',
|
|
39
|
+
paddingHorizontal: 0,
|
|
40
|
+
paddingVertical: 0,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
size: {
|
|
44
|
+
sm: {
|
|
45
|
+
paddingVertical: spacing[2],
|
|
46
|
+
paddingHorizontal: spacing[4],
|
|
47
|
+
minHeight: 32,
|
|
48
|
+
borderRadius: borderRadius.md,
|
|
49
|
+
},
|
|
50
|
+
default: {
|
|
51
|
+
paddingVertical: spacing[3],
|
|
52
|
+
paddingHorizontal: spacing[5],
|
|
53
|
+
minHeight: 40,
|
|
54
|
+
borderRadius: borderRadius.md,
|
|
55
|
+
},
|
|
56
|
+
lg: {
|
|
57
|
+
paddingVertical: spacing[4],
|
|
58
|
+
paddingHorizontal: spacing[6],
|
|
59
|
+
minHeight: 48,
|
|
60
|
+
borderRadius: borderRadius.lg,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
defaultVariants: { variant: 'default', size: 'default' },
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type { ButtonVariant, ButtonSize };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Component: Card Styles
|
|
3
|
+
*
|
|
4
|
+
* Static styles created with StyleSheet.create. The card's surface
|
|
5
|
+
* (background/border/shadow) is resolved against the theme at render time.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { StyleSheet } from 'react-native';
|
|
9
|
+
import { spacing, borderRadius } from '../../design-tokens';
|
|
10
|
+
|
|
11
|
+
export const cardStyles = StyleSheet.create({
|
|
12
|
+
root: {
|
|
13
|
+
borderRadius: borderRadius.lg,
|
|
14
|
+
padding: spacing[5],
|
|
15
|
+
gap: spacing[4],
|
|
16
|
+
},
|
|
17
|
+
header: {
|
|
18
|
+
gap: spacing[1],
|
|
19
|
+
},
|
|
20
|
+
content: {
|
|
21
|
+
gap: spacing[2],
|
|
22
|
+
},
|
|
23
|
+
footer: {
|
|
24
|
+
flexDirection: 'row',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
gap: spacing[2],
|
|
27
|
+
},
|
|
28
|
+
});
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Component: Card
|
|
3
|
+
*
|
|
4
|
+
* A composable card container with header/title/description/content/footer
|
|
5
|
+
* sub-components, mirroring the shadcn/ui structure. The surface (background,
|
|
6
|
+
* border, shadow) is resolved against the active theme.
|
|
7
|
+
*
|
|
8
|
+
* All parts are exported individually so consumers can compose freely; the
|
|
9
|
+
* root `Card` applies the themed surface.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { View } from 'react-native';
|
|
13
|
+
import { useTheme } from '../../theme';
|
|
14
|
+
import { cn } from '../../utils/cn';
|
|
15
|
+
import { TextPrimitive } from '../../primitives/Text';
|
|
16
|
+
import { getCardVariants } from './Card.variants';
|
|
17
|
+
import { cardStyles } from './Card.styles';
|
|
18
|
+
import type {
|
|
19
|
+
CardProps,
|
|
20
|
+
CardPartProps,
|
|
21
|
+
CardTextPartProps,
|
|
22
|
+
CardVariant,
|
|
23
|
+
} from './Card.types';
|
|
24
|
+
|
|
25
|
+
export function Card({
|
|
26
|
+
variant: variantProp,
|
|
27
|
+
style,
|
|
28
|
+
children,
|
|
29
|
+
...rest
|
|
30
|
+
}: CardProps) {
|
|
31
|
+
const { theme } = useTheme();
|
|
32
|
+
const { variant, defaultVariant } = getCardVariants(theme);
|
|
33
|
+
const variantKey: CardVariant = variantProp ?? defaultVariant;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<View
|
|
37
|
+
accessibilityRole="summary"
|
|
38
|
+
{...rest}
|
|
39
|
+
style={cn(cardStyles.root, variant[variantKey], style)}
|
|
40
|
+
>
|
|
41
|
+
{children}
|
|
42
|
+
</View>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
Card.displayName = 'Card';
|
|
47
|
+
|
|
48
|
+
export function CardHeader({ style, children, ...rest }: CardPartProps) {
|
|
49
|
+
return (
|
|
50
|
+
<View {...rest} style={cn(cardStyles.header, style)}>
|
|
51
|
+
{children}
|
|
52
|
+
</View>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
CardHeader.displayName = 'CardHeader';
|
|
57
|
+
|
|
58
|
+
export function CardTitle({ style, children, ...rest }: CardTextPartProps) {
|
|
59
|
+
return (
|
|
60
|
+
<TextPrimitive
|
|
61
|
+
color="cardForeground"
|
|
62
|
+
fontSize="lg"
|
|
63
|
+
fontWeight="semibold"
|
|
64
|
+
accessibilityRole="header"
|
|
65
|
+
{...rest}
|
|
66
|
+
style={style}
|
|
67
|
+
>
|
|
68
|
+
{children}
|
|
69
|
+
</TextPrimitive>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
CardTitle.displayName = 'CardTitle';
|
|
74
|
+
|
|
75
|
+
export function CardDescription({
|
|
76
|
+
style,
|
|
77
|
+
children,
|
|
78
|
+
...rest
|
|
79
|
+
}: CardTextPartProps) {
|
|
80
|
+
return (
|
|
81
|
+
<TextPrimitive
|
|
82
|
+
color="mutedForeground"
|
|
83
|
+
fontSize="sm"
|
|
84
|
+
{...rest}
|
|
85
|
+
style={style}
|
|
86
|
+
>
|
|
87
|
+
{children}
|
|
88
|
+
</TextPrimitive>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
CardDescription.displayName = 'CardDescription';
|
|
93
|
+
|
|
94
|
+
export function CardContent({ style, children, ...rest }: CardPartProps) {
|
|
95
|
+
return (
|
|
96
|
+
<View {...rest} style={cn(cardStyles.content, style)}>
|
|
97
|
+
{children}
|
|
98
|
+
</View>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
CardContent.displayName = 'CardContent';
|
|
103
|
+
|
|
104
|
+
export function CardFooter({ style, children, ...rest }: CardPartProps) {
|
|
105
|
+
return (
|
|
106
|
+
<View {...rest} style={cn(cardStyles.footer, style)}>
|
|
107
|
+
{children}
|
|
108
|
+
</View>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
CardFooter.displayName = 'CardFooter';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Component: Card Types
|
|
3
|
+
*
|
|
4
|
+
* A composable card container with header/title/description/content/footer
|
|
5
|
+
* sub-components, mirroring the shadcn/ui structure.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { ViewProps, StyleProp, ViewStyle } from 'react-native';
|
|
9
|
+
import type { TextPrimitiveProps } from '../../primitives/Text';
|
|
10
|
+
import type { ReactNode } from 'react';
|
|
11
|
+
|
|
12
|
+
export type CardVariant = 'default' | 'outline' | 'ghost';
|
|
13
|
+
|
|
14
|
+
export interface CardProps extends ViewProps {
|
|
15
|
+
variant?: CardVariant;
|
|
16
|
+
style?: StyleProp<ViewStyle>;
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface CardPartProps extends ViewProps {
|
|
21
|
+
style?: StyleProp<ViewStyle>;
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Props for text-based card parts (title / description). */
|
|
26
|
+
export type CardTextPartProps = TextPrimitiveProps;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Component: Card Variants
|
|
3
|
+
*
|
|
4
|
+
* Variant surface styles resolved against the active theme at render time.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { ViewStyle } from 'react-native';
|
|
8
|
+
import type { Theme } from '../../theme/types';
|
|
9
|
+
import type { CardVariant } from './Card.types';
|
|
10
|
+
import { resolveShadow } from '../../design-tokens';
|
|
11
|
+
|
|
12
|
+
export interface CardVariantConfig {
|
|
13
|
+
variant: Record<CardVariant, ViewStyle>;
|
|
14
|
+
defaultVariant: CardVariant;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function getCardVariants(theme: Theme): CardVariantConfig {
|
|
18
|
+
return {
|
|
19
|
+
variant: {
|
|
20
|
+
default: {
|
|
21
|
+
backgroundColor: theme.colors.card,
|
|
22
|
+
borderWidth: 1,
|
|
23
|
+
borderColor: theme.colors.border,
|
|
24
|
+
...resolveShadow('sm'),
|
|
25
|
+
},
|
|
26
|
+
outline: {
|
|
27
|
+
backgroundColor: theme.colors.card,
|
|
28
|
+
borderWidth: 1,
|
|
29
|
+
borderColor: theme.colors.border,
|
|
30
|
+
},
|
|
31
|
+
ghost: {
|
|
32
|
+
backgroundColor: 'transparent',
|
|
33
|
+
borderWidth: 0,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
defaultVariant: 'default',
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANAN-UI — Component: Card Barrel Export
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
Card,
|
|
7
|
+
CardHeader,
|
|
8
|
+
CardTitle,
|
|
9
|
+
CardDescription,
|
|
10
|
+
CardContent,
|
|
11
|
+
CardFooter,
|
|
12
|
+
} from './Card';
|
|
13
|
+
export type {
|
|
14
|
+
CardProps,
|
|
15
|
+
CardPartProps,
|
|
16
|
+
CardTextPartProps,
|
|
17
|
+
CardVariant,
|
|
18
|
+
} from './Card.types';
|