orn-ui 0.1.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 +107 -0
- package/bin/orn-ui.mjs +228 -0
- package/lib/commonjs/atoms/Avatar.js +42 -0
- package/lib/commonjs/atoms/Avatar.js.map +1 -0
- package/lib/commonjs/atoms/Badge.js +82 -0
- package/lib/commonjs/atoms/Badge.js.map +1 -0
- package/lib/commonjs/atoms/Button.js +222 -0
- package/lib/commonjs/atoms/Button.js.map +1 -0
- package/lib/commonjs/atoms/Card.js +33 -0
- package/lib/commonjs/atoms/Card.js.map +1 -0
- package/lib/commonjs/atoms/Checkbox.js +107 -0
- package/lib/commonjs/atoms/Checkbox.js.map +1 -0
- package/lib/commonjs/atoms/Divider.js +27 -0
- package/lib/commonjs/atoms/Divider.js.map +1 -0
- package/lib/commonjs/atoms/EmptyState.js +69 -0
- package/lib/commonjs/atoms/EmptyState.js.map +1 -0
- package/lib/commonjs/atoms/Fab.js +62 -0
- package/lib/commonjs/atoms/Fab.js.map +1 -0
- package/lib/commonjs/atoms/IconButton.js +60 -0
- package/lib/commonjs/atoms/IconButton.js.map +1 -0
- package/lib/commonjs/atoms/Image.js +113 -0
- package/lib/commonjs/atoms/Image.js.map +1 -0
- package/lib/commonjs/atoms/Input.js +173 -0
- package/lib/commonjs/atoms/Input.js.map +1 -0
- package/lib/commonjs/atoms/KeyValueRow.js +60 -0
- package/lib/commonjs/atoms/KeyValueRow.js.map +1 -0
- package/lib/commonjs/atoms/PressableScale.js +60 -0
- package/lib/commonjs/atoms/PressableScale.js.map +1 -0
- package/lib/commonjs/atoms/Spinner.js +156 -0
- package/lib/commonjs/atoms/Spinner.js.map +1 -0
- package/lib/commonjs/atoms/Text.js +63 -0
- package/lib/commonjs/atoms/Text.js.map +1 -0
- package/lib/commonjs/atoms/index.js +135 -0
- package/lib/commonjs/atoms/index.js.map +1 -0
- package/lib/commonjs/icons/Icon.js +40 -0
- package/lib/commonjs/icons/Icon.js.map +1 -0
- package/lib/commonjs/icons/defaultIcons.js +386 -0
- package/lib/commonjs/icons/defaultIcons.js.map +1 -0
- package/lib/commonjs/icons/index.js +20 -0
- package/lib/commonjs/icons/index.js.map +1 -0
- package/lib/commonjs/icons/types.js +6 -0
- package/lib/commonjs/icons/types.js.map +1 -0
- package/lib/commonjs/index.js +61 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/molecules/AvatarHeader.js +87 -0
- package/lib/commonjs/molecules/AvatarHeader.js.map +1 -0
- package/lib/commonjs/molecules/FormActions.js +47 -0
- package/lib/commonjs/molecules/FormActions.js.map +1 -0
- package/lib/commonjs/molecules/InfoRow.js +83 -0
- package/lib/commonjs/molecules/InfoRow.js.map +1 -0
- package/lib/commonjs/molecules/OptionCard.js +98 -0
- package/lib/commonjs/molecules/OptionCard.js.map +1 -0
- package/lib/commonjs/molecules/Stepper.js +104 -0
- package/lib/commonjs/molecules/Stepper.js.map +1 -0
- package/lib/commonjs/molecules/Steps.js +220 -0
- package/lib/commonjs/molecules/Steps.js.map +1 -0
- package/lib/commonjs/molecules/ThemeToggle.js +91 -0
- package/lib/commonjs/molecules/ThemeToggle.js.map +1 -0
- package/lib/commonjs/molecules/index.js +55 -0
- package/lib/commonjs/molecules/index.js.map +1 -0
- package/lib/commonjs/organisms/Alert.js +223 -0
- package/lib/commonjs/organisms/Alert.js.map +1 -0
- package/lib/commonjs/organisms/AlertProvider.js +109 -0
- package/lib/commonjs/organisms/AlertProvider.js.map +1 -0
- package/lib/commonjs/organisms/BottomSheet.js +154 -0
- package/lib/commonjs/organisms/BottomSheet.js.map +1 -0
- package/lib/commonjs/organisms/DateField.js +147 -0
- package/lib/commonjs/organisms/DateField.js.map +1 -0
- package/lib/commonjs/organisms/DatePicker.js +253 -0
- package/lib/commonjs/organisms/DatePicker.js.map +1 -0
- package/lib/commonjs/organisms/List.js +143 -0
- package/lib/commonjs/organisms/List.js.map +1 -0
- package/lib/commonjs/organisms/Modal.js +286 -0
- package/lib/commonjs/organisms/Modal.js.map +1 -0
- package/lib/commonjs/organisms/Screen.js +75 -0
- package/lib/commonjs/organisms/Screen.js.map +1 -0
- package/lib/commonjs/organisms/SearchList.js +180 -0
- package/lib/commonjs/organisms/SearchList.js.map +1 -0
- package/lib/commonjs/organisms/Select.js +178 -0
- package/lib/commonjs/organisms/Select.js.map +1 -0
- package/lib/commonjs/organisms/Toast.js +157 -0
- package/lib/commonjs/organisms/Toast.js.map +1 -0
- package/lib/commonjs/organisms/ToastProvider.js +131 -0
- package/lib/commonjs/organisms/ToastProvider.js.map +1 -0
- package/lib/commonjs/organisms/Wizard.js +116 -0
- package/lib/commonjs/organisms/Wizard.js.map +1 -0
- package/lib/commonjs/organisms/index.js +127 -0
- package/lib/commonjs/organisms/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/theme/UIProvider.js +110 -0
- package/lib/commonjs/theme/UIProvider.js.map +1 -0
- package/lib/commonjs/theme/createStyles.js +42 -0
- package/lib/commonjs/theme/createStyles.js.map +1 -0
- package/lib/commonjs/theme/createTheme.js +50 -0
- package/lib/commonjs/theme/createTheme.js.map +1 -0
- package/lib/commonjs/theme/index.js +151 -0
- package/lib/commonjs/theme/index.js.map +1 -0
- package/lib/commonjs/theme/insets.js +15 -0
- package/lib/commonjs/theme/insets.js.map +1 -0
- package/lib/commonjs/theme/labels.js +18 -0
- package/lib/commonjs/theme/labels.js.map +1 -0
- package/lib/commonjs/theme/palettes.js +42 -0
- package/lib/commonjs/theme/palettes.js.map +1 -0
- package/lib/commonjs/theme/tokens.js +120 -0
- package/lib/commonjs/theme/tokens.js.map +1 -0
- package/lib/commonjs/theme/types.js +6 -0
- package/lib/commonjs/theme/types.js.map +1 -0
- package/lib/module/atoms/Avatar.js +37 -0
- package/lib/module/atoms/Avatar.js.map +1 -0
- package/lib/module/atoms/Badge.js +77 -0
- package/lib/module/atoms/Badge.js.map +1 -0
- package/lib/module/atoms/Button.js +217 -0
- package/lib/module/atoms/Button.js.map +1 -0
- package/lib/module/atoms/Card.js +28 -0
- package/lib/module/atoms/Card.js.map +1 -0
- package/lib/module/atoms/Checkbox.js +102 -0
- package/lib/module/atoms/Checkbox.js.map +1 -0
- package/lib/module/atoms/Divider.js +22 -0
- package/lib/module/atoms/Divider.js.map +1 -0
- package/lib/module/atoms/EmptyState.js +64 -0
- package/lib/module/atoms/EmptyState.js.map +1 -0
- package/lib/module/atoms/Fab.js +57 -0
- package/lib/module/atoms/Fab.js.map +1 -0
- package/lib/module/atoms/IconButton.js +55 -0
- package/lib/module/atoms/IconButton.js.map +1 -0
- package/lib/module/atoms/Image.js +108 -0
- package/lib/module/atoms/Image.js.map +1 -0
- package/lib/module/atoms/Input.js +168 -0
- package/lib/module/atoms/Input.js.map +1 -0
- package/lib/module/atoms/KeyValueRow.js +55 -0
- package/lib/module/atoms/KeyValueRow.js.map +1 -0
- package/lib/module/atoms/PressableScale.js +55 -0
- package/lib/module/atoms/PressableScale.js.map +1 -0
- package/lib/module/atoms/Spinner.js +151 -0
- package/lib/module/atoms/Spinner.js.map +1 -0
- package/lib/module/atoms/Text.js +58 -0
- package/lib/module/atoms/Text.js.map +1 -0
- package/lib/module/atoms/index.js +18 -0
- package/lib/module/atoms/index.js.map +1 -0
- package/lib/module/icons/Icon.js +35 -0
- package/lib/module/icons/Icon.js.map +1 -0
- package/lib/module/icons/defaultIcons.js +381 -0
- package/lib/module/icons/defaultIcons.js.map +1 -0
- package/lib/module/icons/index.js +5 -0
- package/lib/module/icons/index.js.map +1 -0
- package/lib/module/icons/types.js +4 -0
- package/lib/module/icons/types.js.map +1 -0
- package/lib/module/index.js +8 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/molecules/AvatarHeader.js +82 -0
- package/lib/module/molecules/AvatarHeader.js.map +1 -0
- package/lib/module/molecules/FormActions.js +42 -0
- package/lib/module/molecules/FormActions.js.map +1 -0
- package/lib/module/molecules/InfoRow.js +78 -0
- package/lib/module/molecules/InfoRow.js.map +1 -0
- package/lib/module/molecules/OptionCard.js +93 -0
- package/lib/module/molecules/OptionCard.js.map +1 -0
- package/lib/module/molecules/Stepper.js +99 -0
- package/lib/module/molecules/Stepper.js.map +1 -0
- package/lib/module/molecules/Steps.js +215 -0
- package/lib/module/molecules/Steps.js.map +1 -0
- package/lib/module/molecules/ThemeToggle.js +86 -0
- package/lib/module/molecules/ThemeToggle.js.map +1 -0
- package/lib/module/molecules/index.js +10 -0
- package/lib/module/molecules/index.js.map +1 -0
- package/lib/module/organisms/Alert.js +218 -0
- package/lib/module/organisms/Alert.js.map +1 -0
- package/lib/module/organisms/AlertProvider.js +103 -0
- package/lib/module/organisms/AlertProvider.js.map +1 -0
- package/lib/module/organisms/BottomSheet.js +149 -0
- package/lib/module/organisms/BottomSheet.js.map +1 -0
- package/lib/module/organisms/DateField.js +142 -0
- package/lib/module/organisms/DateField.js.map +1 -0
- package/lib/module/organisms/DatePicker.js +247 -0
- package/lib/module/organisms/DatePicker.js.map +1 -0
- package/lib/module/organisms/List.js +138 -0
- package/lib/module/organisms/List.js.map +1 -0
- package/lib/module/organisms/Modal.js +281 -0
- package/lib/module/organisms/Modal.js.map +1 -0
- package/lib/module/organisms/Screen.js +70 -0
- package/lib/module/organisms/Screen.js.map +1 -0
- package/lib/module/organisms/SearchList.js +175 -0
- package/lib/module/organisms/SearchList.js.map +1 -0
- package/lib/module/organisms/Select.js +173 -0
- package/lib/module/organisms/Select.js.map +1 -0
- package/lib/module/organisms/Toast.js +152 -0
- package/lib/module/organisms/Toast.js.map +1 -0
- package/lib/module/organisms/ToastProvider.js +125 -0
- package/lib/module/organisms/ToastProvider.js.map +1 -0
- package/lib/module/organisms/Wizard.js +111 -0
- package/lib/module/organisms/Wizard.js.map +1 -0
- package/lib/module/organisms/index.js +16 -0
- package/lib/module/organisms/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/theme/UIProvider.js +97 -0
- package/lib/module/theme/UIProvider.js.map +1 -0
- package/lib/module/theme/createStyles.js +38 -0
- package/lib/module/theme/createStyles.js.map +1 -0
- package/lib/module/theme/createTheme.js +45 -0
- package/lib/module/theme/createTheme.js.map +1 -0
- package/lib/module/theme/index.js +10 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/theme/insets.js +11 -0
- package/lib/module/theme/insets.js.map +1 -0
- package/lib/module/theme/labels.js +14 -0
- package/lib/module/theme/labels.js.map +1 -0
- package/lib/module/theme/palettes.js +38 -0
- package/lib/module/theme/palettes.js.map +1 -0
- package/lib/module/theme/tokens.js +117 -0
- package/lib/module/theme/tokens.js.map +1 -0
- package/lib/module/theme/types.js +4 -0
- package/lib/module/theme/types.js.map +1 -0
- package/lib/typescript/atoms/Avatar.d.ts +15 -0
- package/lib/typescript/atoms/Avatar.d.ts.map +1 -0
- package/lib/typescript/atoms/Badge.d.ts +19 -0
- package/lib/typescript/atoms/Badge.d.ts.map +1 -0
- package/lib/typescript/atoms/Button.d.ts +30 -0
- package/lib/typescript/atoms/Button.d.ts.map +1 -0
- package/lib/typescript/atoms/Card.d.ts +8 -0
- package/lib/typescript/atoms/Card.d.ts.map +1 -0
- package/lib/typescript/atoms/Checkbox.d.ts +11 -0
- package/lib/typescript/atoms/Checkbox.d.ts.map +1 -0
- package/lib/typescript/atoms/Divider.d.ts +8 -0
- package/lib/typescript/atoms/Divider.d.ts.map +1 -0
- package/lib/typescript/atoms/EmptyState.d.ts +12 -0
- package/lib/typescript/atoms/EmptyState.d.ts.map +1 -0
- package/lib/typescript/atoms/Fab.d.ts +22 -0
- package/lib/typescript/atoms/Fab.d.ts.map +1 -0
- package/lib/typescript/atoms/IconButton.d.ts +23 -0
- package/lib/typescript/atoms/IconButton.d.ts.map +1 -0
- package/lib/typescript/atoms/Image.d.ts +45 -0
- package/lib/typescript/atoms/Image.d.ts.map +1 -0
- package/lib/typescript/atoms/Input.d.ts +24 -0
- package/lib/typescript/atoms/Input.d.ts.map +1 -0
- package/lib/typescript/atoms/KeyValueRow.d.ts +17 -0
- package/lib/typescript/atoms/KeyValueRow.d.ts.map +1 -0
- package/lib/typescript/atoms/PressableScale.d.ts +15 -0
- package/lib/typescript/atoms/PressableScale.d.ts.map +1 -0
- package/lib/typescript/atoms/Spinner.d.ts +20 -0
- package/lib/typescript/atoms/Spinner.d.ts.map +1 -0
- package/lib/typescript/atoms/Text.d.ts +13 -0
- package/lib/typescript/atoms/Text.d.ts.map +1 -0
- package/lib/typescript/atoms/index.d.ts +31 -0
- package/lib/typescript/atoms/index.d.ts.map +1 -0
- package/lib/typescript/icons/Icon.d.ts +18 -0
- package/lib/typescript/icons/Icon.d.ts.map +1 -0
- package/lib/typescript/icons/defaultIcons.d.ts +5 -0
- package/lib/typescript/icons/defaultIcons.d.ts.map +1 -0
- package/lib/typescript/icons/index.d.ts +5 -0
- package/lib/typescript/icons/index.d.ts.map +1 -0
- package/lib/typescript/icons/types.d.ts +10 -0
- package/lib/typescript/icons/types.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +6 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/molecules/AvatarHeader.d.ts +20 -0
- package/lib/typescript/molecules/AvatarHeader.d.ts.map +1 -0
- package/lib/typescript/molecules/FormActions.d.ts +21 -0
- package/lib/typescript/molecules/FormActions.d.ts.map +1 -0
- package/lib/typescript/molecules/InfoRow.d.ts +17 -0
- package/lib/typescript/molecules/InfoRow.d.ts.map +1 -0
- package/lib/typescript/molecules/OptionCard.d.ts +20 -0
- package/lib/typescript/molecules/OptionCard.d.ts.map +1 -0
- package/lib/typescript/molecules/Stepper.d.ts +15 -0
- package/lib/typescript/molecules/Stepper.d.ts.map +1 -0
- package/lib/typescript/molecules/Steps.d.ts +29 -0
- package/lib/typescript/molecules/Steps.d.ts.map +1 -0
- package/lib/typescript/molecules/ThemeToggle.d.ts +15 -0
- package/lib/typescript/molecules/ThemeToggle.d.ts.map +1 -0
- package/lib/typescript/molecules/index.d.ts +15 -0
- package/lib/typescript/molecules/index.d.ts.map +1 -0
- package/lib/typescript/organisms/Alert.d.ts +29 -0
- package/lib/typescript/organisms/Alert.d.ts.map +1 -0
- package/lib/typescript/organisms/AlertProvider.d.ts +32 -0
- package/lib/typescript/organisms/AlertProvider.d.ts.map +1 -0
- package/lib/typescript/organisms/BottomSheet.d.ts +15 -0
- package/lib/typescript/organisms/BottomSheet.d.ts.map +1 -0
- package/lib/typescript/organisms/DateField.d.ts +26 -0
- package/lib/typescript/organisms/DateField.d.ts.map +1 -0
- package/lib/typescript/organisms/DatePicker.d.ts +49 -0
- package/lib/typescript/organisms/DatePicker.d.ts.map +1 -0
- package/lib/typescript/organisms/List.d.ts +35 -0
- package/lib/typescript/organisms/List.d.ts.map +1 -0
- package/lib/typescript/organisms/Modal.d.ts +25 -0
- package/lib/typescript/organisms/Modal.d.ts.map +1 -0
- package/lib/typescript/organisms/Screen.d.ts +26 -0
- package/lib/typescript/organisms/Screen.d.ts.map +1 -0
- package/lib/typescript/organisms/SearchList.d.ts +40 -0
- package/lib/typescript/organisms/SearchList.d.ts.map +1 -0
- package/lib/typescript/organisms/Select.d.ts +25 -0
- package/lib/typescript/organisms/Select.d.ts.map +1 -0
- package/lib/typescript/organisms/Toast.d.ts +28 -0
- package/lib/typescript/organisms/Toast.d.ts.map +1 -0
- package/lib/typescript/organisms/ToastProvider.d.ts +36 -0
- package/lib/typescript/organisms/ToastProvider.d.ts.map +1 -0
- package/lib/typescript/organisms/Wizard.d.ts +40 -0
- package/lib/typescript/organisms/Wizard.d.ts.map +1 -0
- package/lib/typescript/organisms/index.d.ts +27 -0
- package/lib/typescript/organisms/index.d.ts.map +1 -0
- package/lib/typescript/theme/UIProvider.d.ts +47 -0
- package/lib/typescript/theme/UIProvider.d.ts.map +1 -0
- package/lib/typescript/theme/createStyles.d.ts +21 -0
- package/lib/typescript/theme/createStyles.d.ts.map +1 -0
- package/lib/typescript/theme/createTheme.d.ts +9 -0
- package/lib/typescript/theme/createTheme.d.ts.map +1 -0
- package/lib/typescript/theme/index.d.ts +14 -0
- package/lib/typescript/theme/index.d.ts.map +1 -0
- package/lib/typescript/theme/insets.d.ts +9 -0
- package/lib/typescript/theme/insets.d.ts.map +1 -0
- package/lib/typescript/theme/labels.d.ts +13 -0
- package/lib/typescript/theme/labels.d.ts.map +1 -0
- package/lib/typescript/theme/palettes.d.ts +24 -0
- package/lib/typescript/theme/palettes.d.ts.map +1 -0
- package/lib/typescript/theme/tokens.d.ts +41 -0
- package/lib/typescript/theme/tokens.d.ts.map +1 -0
- package/lib/typescript/theme/types.d.ts +24 -0
- package/lib/typescript/theme/types.d.ts.map +1 -0
- package/package.json +311 -0
- package/registry/alert-provider.json +21 -0
- package/registry/alert.json +19 -0
- package/registry/avatar-header.json +18 -0
- package/registry/avatar.json +18 -0
- package/registry/badge.json +18 -0
- package/registry/bottom-sheet.json +18 -0
- package/registry/button.json +18 -0
- package/registry/card.json +18 -0
- package/registry/checkbox.json +18 -0
- package/registry/core.json +64 -0
- package/registry/date-field.json +24 -0
- package/registry/date-picker.json +23 -0
- package/registry/divider.json +18 -0
- package/registry/empty-state.json +18 -0
- package/registry/fab.json +19 -0
- package/registry/form-actions.json +19 -0
- package/registry/icon-button.json +19 -0
- package/registry/image.json +20 -0
- package/registry/index.json +465 -0
- package/registry/info-row.json +19 -0
- package/registry/input.json +18 -0
- package/registry/key-value-row.json +18 -0
- package/registry/list.json +20 -0
- package/registry/manifest.json +263 -0
- package/registry/modal.json +21 -0
- package/registry/option-card.json +18 -0
- package/registry/pressable-scale.json +18 -0
- package/registry/screen.json +18 -0
- package/registry/search-list.json +23 -0
- package/registry/select.json +18 -0
- package/registry/spinner.json +18 -0
- package/registry/stepper.json +18 -0
- package/registry/steps.json +18 -0
- package/registry/theme-toggle.json +18 -0
- package/registry/title.json +21 -0
- package/registry/toast-provider.json +20 -0
- package/registry/toast.json +18 -0
- package/registry/wizard.json +20 -0
- package/src/atoms/Avatar.tsx +40 -0
- package/src/atoms/Badge.tsx +55 -0
- package/src/atoms/Button.tsx +186 -0
- package/src/atoms/Card.tsx +27 -0
- package/src/atoms/Checkbox.tsx +75 -0
- package/src/atoms/Divider.tsx +14 -0
- package/src/atoms/EmptyState.tsx +60 -0
- package/src/atoms/Fab.tsx +63 -0
- package/src/atoms/IconButton.tsx +53 -0
- package/src/atoms/Image.tsx +137 -0
- package/src/atoms/Input.tsx +166 -0
- package/src/atoms/KeyValueRow.tsx +48 -0
- package/src/atoms/PressableScale.tsx +52 -0
- package/src/atoms/Spinner.tsx +127 -0
- package/src/atoms/Text.tsx +58 -0
- package/src/atoms/index.ts +30 -0
- package/src/icons/Icon.tsx +27 -0
- package/src/icons/defaultIcons.tsx +292 -0
- package/src/icons/index.ts +4 -0
- package/src/icons/types.ts +27 -0
- package/src/index.ts +5 -0
- package/src/molecules/AvatarHeader.tsx +69 -0
- package/src/molecules/FormActions.tsx +52 -0
- package/src/molecules/InfoRow.tsx +52 -0
- package/src/molecules/OptionCard.tsx +82 -0
- package/src/molecules/Stepper.tsx +76 -0
- package/src/molecules/Steps.tsx +198 -0
- package/src/molecules/ThemeToggle.tsx +67 -0
- package/src/molecules/index.ts +14 -0
- package/src/organisms/Alert.tsx +162 -0
- package/src/organisms/AlertProvider.tsx +125 -0
- package/src/organisms/BottomSheet.tsx +95 -0
- package/src/organisms/DateField.tsx +134 -0
- package/src/organisms/DatePicker.tsx +255 -0
- package/src/organisms/List.tsx +154 -0
- package/src/organisms/Modal.tsx +251 -0
- package/src/organisms/Screen.tsx +84 -0
- package/src/organisms/SearchList.tsx +186 -0
- package/src/organisms/Select.tsx +156 -0
- package/src/organisms/Toast.tsx +135 -0
- package/src/organisms/ToastProvider.tsx +166 -0
- package/src/organisms/Wizard.tsx +137 -0
- package/src/organisms/index.ts +26 -0
- package/src/theme/UIProvider.tsx +129 -0
- package/src/theme/createStyles.ts +40 -0
- package/src/theme/createTheme.ts +49 -0
- package/src/theme/index.ts +22 -0
- package/src/theme/insets.ts +9 -0
- package/src/theme/labels.ts +23 -0
- package/src/theme/palettes.ts +53 -0
- package/src/theme/tokens.ts +113 -0
- package/src/theme/types.ts +27 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { Text, View } from 'react-native';
|
|
3
|
+
import type { IconName, IconRenderProps } from './types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Glifos default dibujados con primitivas de RN (View + border + transform).
|
|
7
|
+
* Cero dependencias, cero fuentes, cero carga asíncrona. Cubren únicamente
|
|
8
|
+
* lo que la librería necesita internamente (checkbox, chevrons de Select,
|
|
9
|
+
* toggle de password en Input, etc). Para íconos de producto, el consumidor
|
|
10
|
+
* inyecta su propio set vía <UIProvider icons={...}> o la prop `icon`.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const Chevron = memo(({ size, color, direction }: IconRenderProps & { direction: 'up' | 'down' | 'left' | 'right' }) => {
|
|
14
|
+
const strokeWidth = Math.max(1.5, size / 12);
|
|
15
|
+
const arm = size * 0.32;
|
|
16
|
+
const rotation: Record<typeof direction, number> = {
|
|
17
|
+
down: 45,
|
|
18
|
+
up: 225,
|
|
19
|
+
left: 135,
|
|
20
|
+
right: -45,
|
|
21
|
+
};
|
|
22
|
+
return (
|
|
23
|
+
<View style={{ width: size, height: size, alignItems: 'center', justifyContent: 'center' }}>
|
|
24
|
+
<View
|
|
25
|
+
style={{
|
|
26
|
+
width: arm,
|
|
27
|
+
height: arm,
|
|
28
|
+
borderRightWidth: strokeWidth,
|
|
29
|
+
borderBottomWidth: strokeWidth,
|
|
30
|
+
borderColor: color,
|
|
31
|
+
transform: [{ rotate: `${rotation[direction]}deg` }, { translateY: -arm * 0.15 }],
|
|
32
|
+
}}
|
|
33
|
+
/>
|
|
34
|
+
</View>
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
Chevron.displayName = 'Chevron';
|
|
38
|
+
|
|
39
|
+
const Check = memo(({ size, color }: IconRenderProps) => {
|
|
40
|
+
const strokeWidth = Math.max(1.5, size / 10);
|
|
41
|
+
return (
|
|
42
|
+
<View style={{ width: size, height: size, alignItems: 'center', justifyContent: 'center' }}>
|
|
43
|
+
<View
|
|
44
|
+
style={{
|
|
45
|
+
width: size * 0.5,
|
|
46
|
+
height: size * 0.28,
|
|
47
|
+
borderLeftWidth: strokeWidth,
|
|
48
|
+
borderBottomWidth: strokeWidth,
|
|
49
|
+
borderColor: color,
|
|
50
|
+
transform: [{ rotate: '-45deg' }, { translateY: -size * 0.06 }],
|
|
51
|
+
}}
|
|
52
|
+
/>
|
|
53
|
+
</View>
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
Check.displayName = 'Check';
|
|
57
|
+
|
|
58
|
+
const Close = memo(({ size, color }: IconRenderProps) => {
|
|
59
|
+
const strokeWidth = Math.max(1.5, size / 10);
|
|
60
|
+
const line = size * 0.62;
|
|
61
|
+
return (
|
|
62
|
+
<View style={{ width: size, height: size, alignItems: 'center', justifyContent: 'center' }}>
|
|
63
|
+
<View
|
|
64
|
+
style={{
|
|
65
|
+
position: 'absolute',
|
|
66
|
+
width: line,
|
|
67
|
+
height: strokeWidth,
|
|
68
|
+
backgroundColor: color,
|
|
69
|
+
borderRadius: strokeWidth / 2,
|
|
70
|
+
transform: [{ rotate: '45deg' }],
|
|
71
|
+
}}
|
|
72
|
+
/>
|
|
73
|
+
<View
|
|
74
|
+
style={{
|
|
75
|
+
position: 'absolute',
|
|
76
|
+
width: line,
|
|
77
|
+
height: strokeWidth,
|
|
78
|
+
backgroundColor: color,
|
|
79
|
+
borderRadius: strokeWidth / 2,
|
|
80
|
+
transform: [{ rotate: '-45deg' }],
|
|
81
|
+
}}
|
|
82
|
+
/>
|
|
83
|
+
</View>
|
|
84
|
+
);
|
|
85
|
+
});
|
|
86
|
+
Close.displayName = 'Close';
|
|
87
|
+
|
|
88
|
+
const PlusMinus = memo(({ size, color, minusOnly }: IconRenderProps & { minusOnly?: boolean }) => {
|
|
89
|
+
const strokeWidth = Math.max(1.5, size / 10);
|
|
90
|
+
const line = size * 0.56;
|
|
91
|
+
return (
|
|
92
|
+
<View style={{ width: size, height: size, alignItems: 'center', justifyContent: 'center' }}>
|
|
93
|
+
<View
|
|
94
|
+
style={{
|
|
95
|
+
position: 'absolute',
|
|
96
|
+
width: line,
|
|
97
|
+
height: strokeWidth,
|
|
98
|
+
backgroundColor: color,
|
|
99
|
+
borderRadius: strokeWidth / 2,
|
|
100
|
+
}}
|
|
101
|
+
/>
|
|
102
|
+
{!minusOnly && (
|
|
103
|
+
<View
|
|
104
|
+
style={{
|
|
105
|
+
position: 'absolute',
|
|
106
|
+
width: strokeWidth,
|
|
107
|
+
height: line,
|
|
108
|
+
backgroundColor: color,
|
|
109
|
+
borderRadius: strokeWidth / 2,
|
|
110
|
+
}}
|
|
111
|
+
/>
|
|
112
|
+
)}
|
|
113
|
+
</View>
|
|
114
|
+
);
|
|
115
|
+
});
|
|
116
|
+
PlusMinus.displayName = 'PlusMinus';
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Círculo con un glifo tipográfico adentro (!, i, ?).
|
|
120
|
+
*
|
|
121
|
+
* Usa <Text> con la fuente del sistema en vez de componer el glifo con
|
|
122
|
+
* Views: sigue siendo cero-dependencias (no carga ninguna fuente), y "i" vs
|
|
123
|
+
* "!" vs "?" quedan inequívocos. Dibujarlos con barras y puntos daba un
|
|
124
|
+
* "info" idéntico a un "!" invertido, que es exactamente lo que un ícono de
|
|
125
|
+
* información no debe comunicar.
|
|
126
|
+
*/
|
|
127
|
+
const Circle = memo(
|
|
128
|
+
({ size, color, filled, label }: IconRenderProps & { filled?: boolean; label?: string }) => {
|
|
129
|
+
const strokeWidth = Math.max(1.5, size / 12);
|
|
130
|
+
return (
|
|
131
|
+
<View
|
|
132
|
+
style={{
|
|
133
|
+
width: size,
|
|
134
|
+
height: size,
|
|
135
|
+
borderRadius: size / 2,
|
|
136
|
+
borderWidth: filled ? 0 : strokeWidth,
|
|
137
|
+
borderColor: color,
|
|
138
|
+
backgroundColor: filled ? color : 'transparent',
|
|
139
|
+
alignItems: 'center',
|
|
140
|
+
justifyContent: 'center',
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
{!!label && (
|
|
144
|
+
<Text
|
|
145
|
+
allowFontScaling={false}
|
|
146
|
+
style={{
|
|
147
|
+
color: filled ? '#fff' : color,
|
|
148
|
+
fontSize: size * 0.62,
|
|
149
|
+
lineHeight: size * 0.74,
|
|
150
|
+
fontWeight: '700',
|
|
151
|
+
textAlign: 'center',
|
|
152
|
+
includeFontPadding: false,
|
|
153
|
+
}}
|
|
154
|
+
>
|
|
155
|
+
{label}
|
|
156
|
+
</Text>
|
|
157
|
+
)}
|
|
158
|
+
</View>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
Circle.displayName = 'Circle';
|
|
163
|
+
|
|
164
|
+
const Eye = memo(({ size, color, off }: IconRenderProps & { off?: boolean }) => {
|
|
165
|
+
const strokeWidth = Math.max(1.5, size / 12);
|
|
166
|
+
return (
|
|
167
|
+
<View style={{ width: size, height: size, alignItems: 'center', justifyContent: 'center' }}>
|
|
168
|
+
<View
|
|
169
|
+
style={{
|
|
170
|
+
width: size * 0.8,
|
|
171
|
+
height: size * 0.8,
|
|
172
|
+
borderRadius: size * 0.4,
|
|
173
|
+
borderWidth: strokeWidth,
|
|
174
|
+
borderColor: color,
|
|
175
|
+
overflow: 'hidden',
|
|
176
|
+
alignItems: 'center',
|
|
177
|
+
justifyContent: 'center',
|
|
178
|
+
transform: [{ scaleY: 0.55 }],
|
|
179
|
+
}}
|
|
180
|
+
>
|
|
181
|
+
<View
|
|
182
|
+
style={{
|
|
183
|
+
width: size * 0.26,
|
|
184
|
+
height: size * 0.26,
|
|
185
|
+
borderRadius: size * 0.13,
|
|
186
|
+
backgroundColor: color,
|
|
187
|
+
transform: [{ scaleY: 1 / 0.55 }],
|
|
188
|
+
}}
|
|
189
|
+
/>
|
|
190
|
+
</View>
|
|
191
|
+
{off && (
|
|
192
|
+
<View
|
|
193
|
+
style={{
|
|
194
|
+
position: 'absolute',
|
|
195
|
+
width: size * 1.05,
|
|
196
|
+
height: strokeWidth,
|
|
197
|
+
backgroundColor: color,
|
|
198
|
+
borderRadius: strokeWidth / 2,
|
|
199
|
+
transform: [{ rotate: '-45deg' }],
|
|
200
|
+
}}
|
|
201
|
+
/>
|
|
202
|
+
)}
|
|
203
|
+
</View>
|
|
204
|
+
);
|
|
205
|
+
});
|
|
206
|
+
Eye.displayName = 'Eye';
|
|
207
|
+
|
|
208
|
+
const Search = memo(({ size, color }: IconRenderProps) => {
|
|
209
|
+
const strokeWidth = Math.max(1.5, size / 9);
|
|
210
|
+
// Lente grande (72% del alto) arriba-izquierda y mango corto saliendo de su
|
|
211
|
+
// borde inferior-derecho sobre la diagonal de 45°. Las proporciones importan
|
|
212
|
+
// a tamaños chicos (16-20px): con un lente chico y mango largo el glifo se
|
|
213
|
+
// lee como una coma, no como una lupa.
|
|
214
|
+
const lensD = size * 0.72;
|
|
215
|
+
const lensR = lensD / 2;
|
|
216
|
+
const handleLen = size * 0.34;
|
|
217
|
+
const diag = Math.SQRT1_2; // cos(45°) === sin(45°)
|
|
218
|
+
// El mango se centra sobre la diagonal, arrancando justo en el borde del
|
|
219
|
+
// lente: distancia = radio + mitad del mango, menos un solapamiento de
|
|
220
|
+
// medio trazo para que no quede un hueco entre borde y mango.
|
|
221
|
+
const dist = lensR + handleLen / 2 - strokeWidth / 2;
|
|
222
|
+
const cx = lensR + dist * diag;
|
|
223
|
+
const cy = lensR + dist * diag;
|
|
224
|
+
|
|
225
|
+
return (
|
|
226
|
+
<View style={{ width: size, height: size }}>
|
|
227
|
+
<View
|
|
228
|
+
style={{
|
|
229
|
+
position: 'absolute',
|
|
230
|
+
top: 0,
|
|
231
|
+
left: 0,
|
|
232
|
+
width: lensD,
|
|
233
|
+
height: lensD,
|
|
234
|
+
borderRadius: lensR,
|
|
235
|
+
borderWidth: strokeWidth,
|
|
236
|
+
borderColor: color,
|
|
237
|
+
}}
|
|
238
|
+
/>
|
|
239
|
+
<View
|
|
240
|
+
style={{
|
|
241
|
+
position: 'absolute',
|
|
242
|
+
left: cx - strokeWidth / 2,
|
|
243
|
+
top: cy - handleLen / 2,
|
|
244
|
+
width: strokeWidth,
|
|
245
|
+
height: handleLen,
|
|
246
|
+
backgroundColor: color,
|
|
247
|
+
borderRadius: strokeWidth / 2,
|
|
248
|
+
transform: [{ rotate: '-45deg' }],
|
|
249
|
+
}}
|
|
250
|
+
/>
|
|
251
|
+
</View>
|
|
252
|
+
);
|
|
253
|
+
});
|
|
254
|
+
Search.displayName = 'Search';
|
|
255
|
+
|
|
256
|
+
/** Renderer default. Se usa cuando <UIProvider icons={...}> no pasa uno propio. */
|
|
257
|
+
export function renderDefaultIcon(name: IconName, props: IconRenderProps): React.ReactNode {
|
|
258
|
+
switch (name) {
|
|
259
|
+
case 'check':
|
|
260
|
+
return <Check {...props} />;
|
|
261
|
+
case 'close':
|
|
262
|
+
return <Close {...props} />;
|
|
263
|
+
case 'chevron-down':
|
|
264
|
+
return <Chevron {...props} direction="down" />;
|
|
265
|
+
case 'chevron-up':
|
|
266
|
+
return <Chevron {...props} direction="up" />;
|
|
267
|
+
case 'chevron-left':
|
|
268
|
+
return <Chevron {...props} direction="left" />;
|
|
269
|
+
case 'chevron-right':
|
|
270
|
+
return <Chevron {...props} direction="right" />;
|
|
271
|
+
case 'eye':
|
|
272
|
+
return <Eye {...props} />;
|
|
273
|
+
case 'eye-off':
|
|
274
|
+
return <Eye {...props} off />;
|
|
275
|
+
case 'search':
|
|
276
|
+
return <Search {...props} />;
|
|
277
|
+
case 'plus':
|
|
278
|
+
return <PlusMinus {...props} />;
|
|
279
|
+
case 'minus':
|
|
280
|
+
return <PlusMinus {...props} minusOnly />;
|
|
281
|
+
case 'alert':
|
|
282
|
+
return <Circle {...props} filled label="!" />;
|
|
283
|
+
case 'info':
|
|
284
|
+
return <Circle {...props} label="i" />;
|
|
285
|
+
case 'warning':
|
|
286
|
+
return <Circle {...props} filled label="!" />;
|
|
287
|
+
case 'question':
|
|
288
|
+
return <Circle {...props} label="?" />;
|
|
289
|
+
default:
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/** Glifos que los componentes de la librería necesitan internamente. */
|
|
4
|
+
export type IconName =
|
|
5
|
+
| 'check'
|
|
6
|
+
| 'close'
|
|
7
|
+
| 'chevron-down'
|
|
8
|
+
| 'chevron-up'
|
|
9
|
+
| 'chevron-left'
|
|
10
|
+
| 'chevron-right'
|
|
11
|
+
| 'eye'
|
|
12
|
+
| 'eye-off'
|
|
13
|
+
| 'search'
|
|
14
|
+
| 'plus'
|
|
15
|
+
| 'minus'
|
|
16
|
+
| 'alert'
|
|
17
|
+
| 'info'
|
|
18
|
+
| 'warning'
|
|
19
|
+
| 'question';
|
|
20
|
+
|
|
21
|
+
export interface IconRenderProps {
|
|
22
|
+
size: number;
|
|
23
|
+
color: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Renderer inyectable: reemplaza los glifos default por los de cualquier set de iconos. */
|
|
27
|
+
export type IconRenderer = (name: IconName, props: IconRenderProps) => ReactNode;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { Text, View, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import { createStyles } from '../theme/createStyles';
|
|
4
|
+
import { useAllowFontScaling, useColors } from '../theme/UIProvider';
|
|
5
|
+
import { Icon } from '../icons/Icon';
|
|
6
|
+
import type { IconName } from '../icons/types';
|
|
7
|
+
|
|
8
|
+
export interface AvatarHeaderProps {
|
|
9
|
+
/** Ícono a mostrar dentro del círculo. Si se omite, se usan `initials`. */
|
|
10
|
+
iconName?: IconName;
|
|
11
|
+
iconColor?: string;
|
|
12
|
+
/** Texto corto (ej. 2 letras) mostrado si no se pasa `iconName`. */
|
|
13
|
+
initials?: string;
|
|
14
|
+
title: string;
|
|
15
|
+
subtitle?: React.ReactNode;
|
|
16
|
+
style?: StyleProp<ViewStyle>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const useStyles = createStyles((theme) => ({
|
|
20
|
+
container: { alignItems: 'center', marginBottom: theme.tokens.spacing.xl },
|
|
21
|
+
avatar: {
|
|
22
|
+
width: 80,
|
|
23
|
+
height: 80,
|
|
24
|
+
borderRadius: 40,
|
|
25
|
+
backgroundColor: theme.colors.primary + '20',
|
|
26
|
+
justifyContent: 'center',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
marginBottom: theme.tokens.spacing.md,
|
|
29
|
+
},
|
|
30
|
+
initials: { fontSize: theme.tokens.fontSize.xxl, fontWeight: theme.tokens.fontWeight.bold, color: theme.colors.primary },
|
|
31
|
+
title: { fontSize: theme.tokens.fontSize.xl, fontWeight: theme.tokens.fontWeight.bold, textAlign: 'center', color: theme.colors.text, marginBottom: theme.tokens.spacing.xs },
|
|
32
|
+
subtitle: { fontSize: theme.tokens.fontSize.md, color: theme.colors.textLight },
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* AvatarHeader
|
|
37
|
+
* Círculo 80x80 con ícono o iniciales + título/subtítulo centrado. Header
|
|
38
|
+
* típico de modales de detalle (cliente, producto, etc).
|
|
39
|
+
*/
|
|
40
|
+
export const AvatarHeader = memo(({ iconName, iconColor, initials, title, subtitle, style }: AvatarHeaderProps) => {
|
|
41
|
+
const colors = useColors();
|
|
42
|
+
const styles = useStyles();
|
|
43
|
+
const allowFontScaling = useAllowFontScaling();
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<View style={[styles.container, style]}>
|
|
47
|
+
<View style={styles.avatar}>
|
|
48
|
+
{iconName ? (
|
|
49
|
+
<Icon name={iconName} size={40} color={iconColor || colors.primary} />
|
|
50
|
+
) : (
|
|
51
|
+
<Text allowFontScaling={allowFontScaling} style={styles.initials}>
|
|
52
|
+
{initials}
|
|
53
|
+
</Text>
|
|
54
|
+
)}
|
|
55
|
+
</View>
|
|
56
|
+
<Text allowFontScaling={allowFontScaling} style={styles.title}>
|
|
57
|
+
{title}
|
|
58
|
+
</Text>
|
|
59
|
+
{typeof subtitle === 'string' ? (
|
|
60
|
+
<Text allowFontScaling={allowFontScaling} style={styles.subtitle}>
|
|
61
|
+
{subtitle}
|
|
62
|
+
</Text>
|
|
63
|
+
) : (
|
|
64
|
+
subtitle
|
|
65
|
+
)}
|
|
66
|
+
</View>
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
AvatarHeader.displayName = 'AvatarHeader';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { View, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import { Button } from '../atoms/Button';
|
|
4
|
+
import type { IconName } from '../icons/types';
|
|
5
|
+
import { useLabels } from '../theme/UIProvider';
|
|
6
|
+
|
|
7
|
+
export interface FormActionsProps {
|
|
8
|
+
/** Si se omite, solo se muestra el botón secundario. */
|
|
9
|
+
primaryLabel?: string;
|
|
10
|
+
onPrimaryPress?: () => void;
|
|
11
|
+
primaryDisabled?: boolean;
|
|
12
|
+
primaryLoading?: boolean;
|
|
13
|
+
primaryLeftIconName?: IconName;
|
|
14
|
+
secondaryLabel?: string;
|
|
15
|
+
onSecondaryPress: () => void;
|
|
16
|
+
style?: StyleProp<ViewStyle>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* FormActions
|
|
21
|
+
* Par de botones: uno primario (guardar/editar) y uno ghost (cerrar/cancelar).
|
|
22
|
+
* Uso típico: al final de un form, o en el footer de un Modal.
|
|
23
|
+
*/
|
|
24
|
+
export const FormActions = memo(
|
|
25
|
+
({
|
|
26
|
+
primaryLabel,
|
|
27
|
+
onPrimaryPress,
|
|
28
|
+
primaryDisabled = false,
|
|
29
|
+
primaryLoading = false,
|
|
30
|
+
primaryLeftIconName,
|
|
31
|
+
secondaryLabel,
|
|
32
|
+
onSecondaryPress,
|
|
33
|
+
style,
|
|
34
|
+
}: FormActionsProps) => {
|
|
35
|
+
const labels = useLabels();
|
|
36
|
+
return (
|
|
37
|
+
<View style={[{ gap: 12 }, style]}>
|
|
38
|
+
{primaryLabel && onPrimaryPress && (
|
|
39
|
+
<Button
|
|
40
|
+
title={primaryLabel}
|
|
41
|
+
onPress={onPrimaryPress}
|
|
42
|
+
disabled={primaryDisabled}
|
|
43
|
+
loading={primaryLoading}
|
|
44
|
+
leftIconName={primaryLeftIconName}
|
|
45
|
+
/>
|
|
46
|
+
)}
|
|
47
|
+
<Button title={secondaryLabel ?? labels.close} onPress={onSecondaryPress} variant="ghost" />
|
|
48
|
+
</View>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
FormActions.displayName = 'FormActions';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { Text, View, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import { createStyles } from '../theme/createStyles';
|
|
4
|
+
import { useAllowFontScaling, useColors } from '../theme/UIProvider';
|
|
5
|
+
import { Icon } from '../icons/Icon';
|
|
6
|
+
import type { IconName } from '../icons/types';
|
|
7
|
+
import { Avatar } from '../atoms/Avatar';
|
|
8
|
+
|
|
9
|
+
export interface InfoRowProps {
|
|
10
|
+
icon: IconName;
|
|
11
|
+
label: string;
|
|
12
|
+
value: string | null | undefined;
|
|
13
|
+
placeholder: string;
|
|
14
|
+
style?: StyleProp<ViewStyle>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const useStyles = createStyles((theme) => ({
|
|
18
|
+
row: { flexDirection: 'row', alignItems: 'center' },
|
|
19
|
+
icon: { marginRight: theme.tokens.spacing.md },
|
|
20
|
+
textContainer: { flex: 1 },
|
|
21
|
+
label: { fontSize: theme.tokens.fontSize.sm, color: theme.colors.textLight, marginBottom: 2 },
|
|
22
|
+
value: { fontSize: theme.tokens.fontSize.md + 1, color: theme.colors.text, fontWeight: theme.tokens.fontWeight.medium },
|
|
23
|
+
placeholder: { color: theme.colors.textLight, fontStyle: 'italic' },
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* InfoRow
|
|
28
|
+
* Ícono circular a la izquierda + label/valor apilado a la derecha. Muestra
|
|
29
|
+
* `placeholder` en itálica si no hay valor. Pensado para modales de detalle.
|
|
30
|
+
*/
|
|
31
|
+
export const InfoRow = memo(({ icon, label, value, placeholder, style }: InfoRowProps) => {
|
|
32
|
+
const colors = useColors();
|
|
33
|
+
const styles = useStyles();
|
|
34
|
+
const allowFontScaling = useAllowFontScaling();
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<View style={[styles.row, style]}>
|
|
38
|
+
<Avatar size={40} backgroundColor={colors.inputBackground} style={styles.icon}>
|
|
39
|
+
<Icon name={icon} size={20} color={colors.textLight} />
|
|
40
|
+
</Avatar>
|
|
41
|
+
<View style={styles.textContainer}>
|
|
42
|
+
<Text allowFontScaling={allowFontScaling} style={styles.label}>
|
|
43
|
+
{label}
|
|
44
|
+
</Text>
|
|
45
|
+
<Text allowFontScaling={allowFontScaling} style={[styles.value, !value && styles.placeholder]}>
|
|
46
|
+
{value || placeholder}
|
|
47
|
+
</Text>
|
|
48
|
+
</View>
|
|
49
|
+
</View>
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
InfoRow.displayName = 'InfoRow';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { Text, TouchableOpacity, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import { createStyles } from '../theme/createStyles';
|
|
4
|
+
import { useAllowFontScaling, useColors } from '../theme/UIProvider';
|
|
5
|
+
import { Icon } from '../icons/Icon';
|
|
6
|
+
import type { IconName } from '../icons/types';
|
|
7
|
+
|
|
8
|
+
export interface OptionCardProps {
|
|
9
|
+
label: string;
|
|
10
|
+
iconName: IconName;
|
|
11
|
+
isSelected: boolean;
|
|
12
|
+
onPress: () => void;
|
|
13
|
+
/** 'vertical': ícono arriba, texto abajo centrado. 'horizontal': ícono y texto en fila. */
|
|
14
|
+
layout?: 'vertical' | 'horizontal';
|
|
15
|
+
style?: StyleProp<ViewStyle>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const useStyles = createStyles((theme) => ({
|
|
19
|
+
card: {
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
backgroundColor: theme.colors.surface,
|
|
23
|
+
borderRadius: theme.tokens.radius.md,
|
|
24
|
+
borderWidth: 1,
|
|
25
|
+
borderColor: theme.colors.border,
|
|
26
|
+
...theme.tokens.shadow.sm,
|
|
27
|
+
},
|
|
28
|
+
cardHorizontal: { flex: 1, flexDirection: 'row', padding: theme.tokens.spacing.md - 2, gap: theme.tokens.spacing.sm },
|
|
29
|
+
cardVertical: { width: '31%', padding: theme.tokens.spacing.sm, gap: 5, minHeight: 100 },
|
|
30
|
+
cardSelected: {
|
|
31
|
+
borderColor: theme.colors.primary,
|
|
32
|
+
backgroundColor: theme.colors.primary + '15',
|
|
33
|
+
borderWidth: 1.5,
|
|
34
|
+
elevation: 0,
|
|
35
|
+
shadowOpacity: 0,
|
|
36
|
+
},
|
|
37
|
+
label: { color: theme.colors.textLight, fontWeight: theme.tokens.fontWeight.medium },
|
|
38
|
+
labelVertical: { fontSize: theme.tokens.fontSize.xs, textAlign: 'center' },
|
|
39
|
+
labelSelected: { color: theme.colors.primary },
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* OptionCard
|
|
44
|
+
* Card con ícono+label que resalta con borde/fondo primary cuando
|
|
45
|
+
* `isSelected`. Para elegir entre opciones excluyentes (forma de pago, tipo
|
|
46
|
+
* de documento, etc).
|
|
47
|
+
*/
|
|
48
|
+
export const OptionCard = memo(
|
|
49
|
+
({ label, iconName, isSelected, onPress, layout = 'horizontal', style }: OptionCardProps) => {
|
|
50
|
+
const colors = useColors();
|
|
51
|
+
const styles = useStyles();
|
|
52
|
+
const allowFontScaling = useAllowFontScaling();
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<TouchableOpacity
|
|
56
|
+
// activeOpacity=1: esta tarjeta tiene elevation (sombra Android); animar su
|
|
57
|
+
// propia opacity en el press dispara un bug de Android que redibuja la
|
|
58
|
+
// sombra como un borde oscuro pegado al borde del componente.
|
|
59
|
+
activeOpacity={1}
|
|
60
|
+
style={[
|
|
61
|
+
styles.card,
|
|
62
|
+
layout === 'vertical' ? styles.cardVertical : styles.cardHorizontal,
|
|
63
|
+
isSelected && styles.cardSelected,
|
|
64
|
+
style,
|
|
65
|
+
]}
|
|
66
|
+
onPress={onPress}
|
|
67
|
+
accessibilityRole="button"
|
|
68
|
+
accessibilityState={{ selected: isSelected }}
|
|
69
|
+
accessibilityLabel={label}
|
|
70
|
+
>
|
|
71
|
+
<Icon name={iconName} size={24} color={isSelected ? colors.primary : colors.textLight} />
|
|
72
|
+
<Text
|
|
73
|
+
allowFontScaling={allowFontScaling}
|
|
74
|
+
style={[styles.label, layout === 'vertical' && styles.labelVertical, isSelected && styles.labelSelected]}
|
|
75
|
+
>
|
|
76
|
+
{label}
|
|
77
|
+
</Text>
|
|
78
|
+
</TouchableOpacity>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
OptionCard.displayName = 'OptionCard';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { TextInput, TouchableOpacity, View, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import { createStyles } from '../theme/createStyles';
|
|
4
|
+
import { useAllowFontScaling, useColors } from '../theme/UIProvider';
|
|
5
|
+
import { Icon } from '../icons/Icon';
|
|
6
|
+
|
|
7
|
+
export interface StepperProps {
|
|
8
|
+
value: string;
|
|
9
|
+
onChangeText: (text: string) => void;
|
|
10
|
+
onIncrement: () => void;
|
|
11
|
+
onDecrement: () => void;
|
|
12
|
+
size?: 'sm' | 'md';
|
|
13
|
+
style?: StyleProp<ViewStyle>;
|
|
14
|
+
incrementAccessibilityLabel?: string;
|
|
15
|
+
decrementAccessibilityLabel?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const useStyles = createStyles((theme) => ({
|
|
19
|
+
control: { flexDirection: 'row', alignItems: 'center', borderWidth: 1, borderColor: theme.colors.border, borderRadius: theme.tokens.radius.md },
|
|
20
|
+
btn: { height: '100%', justifyContent: 'center', alignItems: 'center', backgroundColor: theme.colors.inputBackground },
|
|
21
|
+
btnSm: { backgroundColor: 'transparent' },
|
|
22
|
+
input: { flex: 1, textAlign: 'center', fontSize: theme.tokens.fontSize.lg, color: theme.colors.text, height: '100%' },
|
|
23
|
+
inputSm: { flex: 0, width: 50, borderLeftWidth: 1, borderRightWidth: 1, borderColor: theme.colors.border },
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
/** Stepper: botón "-" + input numérico editable + botón "+". */
|
|
27
|
+
export const Stepper = memo(
|
|
28
|
+
({
|
|
29
|
+
value,
|
|
30
|
+
onChangeText,
|
|
31
|
+
onIncrement,
|
|
32
|
+
onDecrement,
|
|
33
|
+
size = 'md',
|
|
34
|
+
style,
|
|
35
|
+
incrementAccessibilityLabel = 'Increment',
|
|
36
|
+
decrementAccessibilityLabel = 'Decrement',
|
|
37
|
+
}: StepperProps) => {
|
|
38
|
+
const colors = useColors();
|
|
39
|
+
const styles = useStyles();
|
|
40
|
+
const allowFontScaling = useAllowFontScaling();
|
|
41
|
+
const isSmall = size === 'sm';
|
|
42
|
+
const btnSize = isSmall ? 36 : 48;
|
|
43
|
+
const iconSize = isSmall ? 18 : 20;
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<View style={[styles.control, { height: isSmall ? 36 : 48 }, style]}>
|
|
47
|
+
<TouchableOpacity
|
|
48
|
+
onPress={onDecrement}
|
|
49
|
+
style={[styles.btn, { width: btnSize }, isSmall && styles.btnSm]}
|
|
50
|
+
accessibilityRole="button"
|
|
51
|
+
accessibilityLabel={decrementAccessibilityLabel}
|
|
52
|
+
>
|
|
53
|
+
<Icon name="minus" size={iconSize} color={colors.primary} />
|
|
54
|
+
</TouchableOpacity>
|
|
55
|
+
<TextInput
|
|
56
|
+
allowFontScaling={allowFontScaling}
|
|
57
|
+
style={[styles.input, isSmall && styles.inputSm]}
|
|
58
|
+
value={value}
|
|
59
|
+
onChangeText={onChangeText}
|
|
60
|
+
keyboardType="numeric"
|
|
61
|
+
selectTextOnFocus
|
|
62
|
+
accessibilityLabel="Quantity"
|
|
63
|
+
/>
|
|
64
|
+
<TouchableOpacity
|
|
65
|
+
onPress={onIncrement}
|
|
66
|
+
style={[styles.btn, { width: btnSize }, isSmall && styles.btnSm]}
|
|
67
|
+
accessibilityRole="button"
|
|
68
|
+
accessibilityLabel={incrementAccessibilityLabel}
|
|
69
|
+
>
|
|
70
|
+
<Icon name="plus" size={iconSize} color={colors.primary} />
|
|
71
|
+
</TouchableOpacity>
|
|
72
|
+
</View>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
Stepper.displayName = 'Stepper';
|