@cdx-ui/components 0.0.1-alpha.9 → 0.0.1-beta.2
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 +53 -2
- package/lib/commonjs/components/AlertDialog/index.js +117 -0
- package/lib/commonjs/components/AlertDialog/index.js.map +1 -0
- package/lib/commonjs/components/Avatar/index.js +156 -0
- package/lib/commonjs/components/Avatar/index.js.map +1 -0
- package/lib/commonjs/components/Avatar/styles.js +80 -0
- package/lib/commonjs/components/Avatar/styles.js.map +1 -0
- package/lib/commonjs/components/BottomSheet/index.js +248 -0
- package/lib/commonjs/components/BottomSheet/index.js.map +1 -0
- package/lib/commonjs/components/BottomSheet/styles.js +61 -0
- package/lib/commonjs/components/BottomSheet/styles.js.map +1 -0
- package/lib/commonjs/components/Box/Box.js +1 -0
- package/lib/commonjs/components/Box/Box.js.map +1 -1
- package/lib/commonjs/components/Button/index.js +20 -9
- package/lib/commonjs/components/Button/index.js.map +1 -1
- package/lib/commonjs/components/Button/styles.js +182 -163
- package/lib/commonjs/components/Button/styles.js.map +1 -1
- package/lib/commonjs/components/Card/index.js +104 -0
- package/lib/commonjs/components/Card/index.js.map +1 -0
- package/lib/commonjs/components/Card/styles.js +28 -0
- package/lib/commonjs/components/Card/styles.js.map +1 -0
- package/lib/commonjs/components/Checkbox/index.js +18 -11
- package/lib/commonjs/components/Checkbox/index.js.map +1 -1
- package/lib/commonjs/components/Checkbox/styles.js +17 -16
- package/lib/commonjs/components/Checkbox/styles.js.map +1 -1
- package/lib/commonjs/components/Chip/index.js +103 -0
- package/lib/commonjs/components/Chip/index.js.map +1 -0
- package/lib/commonjs/components/Chip/styles.js +52 -0
- package/lib/commonjs/components/Chip/styles.js.map +1 -0
- package/lib/commonjs/components/Dialog/index.js +275 -0
- package/lib/commonjs/components/Dialog/index.js.map +1 -0
- package/lib/commonjs/components/Dialog/styles.js +63 -0
- package/lib/commonjs/components/Dialog/styles.js.map +1 -0
- package/lib/commonjs/components/Field/FieldLabel.js +33 -0
- package/lib/commonjs/components/Field/FieldLabel.js.map +1 -0
- package/lib/commonjs/components/Field/FieldLabel.web.js +22 -0
- package/lib/commonjs/components/Field/FieldLabel.web.js.map +1 -0
- package/lib/commonjs/components/Field/index.js +158 -0
- package/lib/commonjs/components/Field/index.js.map +1 -0
- package/lib/commonjs/components/Field/styles.js +16 -0
- package/lib/commonjs/components/Field/styles.js.map +1 -0
- package/lib/commonjs/components/Form/FormRoot.js +25 -0
- package/lib/commonjs/components/Form/FormRoot.js.map +1 -0
- package/lib/commonjs/components/Form/FormRoot.web.js +17 -0
- package/lib/commonjs/components/Form/FormRoot.web.js.map +1 -0
- package/lib/commonjs/components/Form/index.js +48 -0
- package/lib/commonjs/components/Form/index.js.map +1 -0
- package/lib/commonjs/components/Form/styles.js +9 -0
- package/lib/commonjs/components/Form/styles.js.map +1 -0
- package/lib/commonjs/components/Heading/index.js +35 -0
- package/lib/commonjs/components/Heading/index.js.map +1 -0
- package/lib/commonjs/components/Heading/styles.js +23 -0
- package/lib/commonjs/components/Heading/styles.js.map +1 -0
- package/lib/commonjs/components/Icon/index.js +61 -0
- package/lib/commonjs/components/Icon/index.js.map +1 -0
- package/lib/commonjs/components/IconButton/index.js +75 -0
- package/lib/commonjs/components/IconButton/index.js.map +1 -0
- package/lib/commonjs/components/IconButton/styles.js +44 -0
- package/lib/commonjs/components/IconButton/styles.js.map +1 -0
- package/lib/commonjs/components/Image/Image.js +69 -0
- package/lib/commonjs/components/Image/Image.js.map +1 -0
- package/lib/commonjs/components/Image/index.js +13 -0
- package/lib/commonjs/components/Image/index.js.map +1 -0
- package/lib/commonjs/components/Input/BaseInput.android.js +20 -0
- package/lib/commonjs/components/Input/BaseInput.android.js.map +1 -0
- package/lib/commonjs/components/Input/index.js +10 -16
- package/lib/commonjs/components/Input/index.js.map +1 -1
- package/lib/commonjs/components/Input/styles.js +17 -30
- package/lib/commonjs/components/Input/styles.js.map +1 -1
- package/lib/commonjs/components/Link/index.js +94 -0
- package/lib/commonjs/components/Link/index.js.map +1 -0
- package/lib/commonjs/components/Link/styles.js +14 -0
- package/lib/commonjs/components/Link/styles.js.map +1 -0
- package/lib/commonjs/components/OtpInput/index.js +83 -0
- package/lib/commonjs/components/OtpInput/index.js.map +1 -0
- package/lib/commonjs/components/OtpInput/styles.js +48 -0
- package/lib/commonjs/components/OtpInput/styles.js.map +1 -0
- package/lib/commonjs/components/ProgressBar/index.js +45 -0
- package/lib/commonjs/components/ProgressBar/index.js.map +1 -0
- package/lib/commonjs/components/ProgressBar/styles.js +10 -0
- package/lib/commonjs/components/ProgressBar/styles.js.map +1 -0
- package/lib/commonjs/components/ProgressSegmented/index.js +62 -0
- package/lib/commonjs/components/ProgressSegmented/index.js.map +1 -0
- package/lib/commonjs/components/ProgressSegmented/styles.js +21 -0
- package/lib/commonjs/components/ProgressSegmented/styles.js.map +1 -0
- package/lib/commonjs/components/Select/SelectTriggerHost.js +10 -0
- package/lib/commonjs/components/Select/SelectTriggerHost.js.map +1 -0
- package/lib/commonjs/components/Select/SelectTriggerHost.web.js +98 -0
- package/lib/commonjs/components/Select/SelectTriggerHost.web.js.map +1 -0
- package/lib/commonjs/components/Select/index.js +13 -13
- package/lib/commonjs/components/Select/index.js.map +1 -1
- package/lib/commonjs/components/Select/styles.js +29 -53
- package/lib/commonjs/components/Select/styles.js.map +1 -1
- package/lib/commonjs/components/Stack/HStack.js +8 -21
- package/lib/commonjs/components/Stack/HStack.js.map +1 -1
- package/lib/commonjs/components/Stack/VStack.js +8 -21
- package/lib/commonjs/components/Stack/VStack.js.map +1 -1
- package/lib/commonjs/components/Stack/styles.js +44 -0
- package/lib/commonjs/components/Stack/styles.js.map +1 -0
- package/lib/commonjs/components/Text/index.js +18 -9
- package/lib/commonjs/components/Text/index.js.map +1 -1
- package/lib/commonjs/components/Text/styles.js +23 -0
- package/lib/commonjs/components/Text/styles.js.map +1 -0
- package/lib/commonjs/components/VirtualizedList/index.js +19 -0
- package/lib/commonjs/components/VirtualizedList/index.js.map +1 -0
- package/lib/commonjs/components/index.js +204 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/index.js +40 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/styles/index.js +17 -0
- package/lib/commonjs/styles/index.js.map +1 -0
- package/lib/commonjs/styles/primitives.js +123 -0
- package/lib/commonjs/styles/primitives.js.map +1 -0
- package/lib/module/components/AlertDialog/index.js +112 -0
- package/lib/module/components/AlertDialog/index.js.map +1 -0
- package/lib/module/components/Avatar/index.js +152 -0
- package/lib/module/components/Avatar/index.js.map +1 -0
- package/lib/module/components/Avatar/styles.js +77 -0
- package/lib/module/components/Avatar/styles.js.map +1 -0
- package/lib/module/components/BottomSheet/index.js +242 -0
- package/lib/module/components/BottomSheet/index.js.map +1 -0
- package/lib/module/components/BottomSheet/styles.js +58 -0
- package/lib/module/components/BottomSheet/styles.js.map +1 -0
- package/lib/module/components/Box/Box.js +1 -0
- package/lib/module/components/Box/Box.js.map +1 -1
- package/lib/module/components/Button/index.js +21 -10
- package/lib/module/components/Button/index.js.map +1 -1
- package/lib/module/components/Button/styles.js +181 -162
- package/lib/module/components/Button/styles.js.map +1 -1
- package/lib/module/components/Card/index.js +100 -0
- package/lib/module/components/Card/index.js.map +1 -0
- package/lib/module/components/Card/styles.js +25 -0
- package/lib/module/components/Card/styles.js.map +1 -0
- package/lib/module/components/Checkbox/index.js +19 -12
- package/lib/module/components/Checkbox/index.js.map +1 -1
- package/lib/module/components/Checkbox/styles.js +17 -16
- package/lib/module/components/Checkbox/styles.js.map +1 -1
- package/lib/module/components/Chip/index.js +99 -0
- package/lib/module/components/Chip/index.js.map +1 -0
- package/lib/module/components/Chip/styles.js +48 -0
- package/lib/module/components/Chip/styles.js.map +1 -0
- package/lib/module/components/Dialog/index.js +267 -0
- package/lib/module/components/Dialog/index.js.map +1 -0
- package/lib/module/components/Dialog/styles.js +60 -0
- package/lib/module/components/Dialog/styles.js.map +1 -0
- package/lib/module/components/Field/FieldLabel.js +29 -0
- package/lib/module/components/Field/FieldLabel.js.map +1 -0
- package/lib/module/components/Field/FieldLabel.web.js +17 -0
- package/lib/module/components/Field/FieldLabel.web.js.map +1 -0
- package/lib/module/components/Field/index.js +155 -0
- package/lib/module/components/Field/index.js.map +1 -0
- package/lib/module/components/Field/styles.js +12 -0
- package/lib/module/components/Field/styles.js.map +1 -0
- package/lib/module/components/Form/FormRoot.js +21 -0
- package/lib/module/components/Form/FormRoot.js.map +1 -0
- package/lib/module/components/Form/FormRoot.web.js +12 -0
- package/lib/module/components/Form/FormRoot.web.js.map +1 -0
- package/lib/module/components/Form/index.js +44 -0
- package/lib/module/components/Form/index.js.map +1 -0
- package/lib/module/components/Form/styles.js +5 -0
- package/lib/module/components/Form/styles.js.map +1 -0
- package/lib/module/components/Heading/index.js +31 -0
- package/lib/module/components/Heading/index.js.map +1 -0
- package/lib/module/components/Heading/styles.js +19 -0
- package/lib/module/components/Heading/styles.js.map +1 -0
- package/lib/module/components/Icon/index.js +57 -0
- package/lib/module/components/Icon/index.js.map +1 -0
- package/lib/module/components/IconButton/index.js +71 -0
- package/lib/module/components/IconButton/index.js.map +1 -0
- package/lib/module/components/IconButton/styles.js +40 -0
- package/lib/module/components/IconButton/styles.js.map +1 -0
- package/lib/module/components/Image/Image.js +67 -0
- package/lib/module/components/Image/Image.js.map +1 -0
- package/lib/module/components/Image/index.js +4 -0
- package/lib/module/components/Image/index.js.map +1 -0
- package/lib/module/components/Input/BaseInput.android.js +16 -0
- package/lib/module/components/Input/BaseInput.android.js.map +1 -0
- package/lib/module/components/Input/index.js +10 -16
- package/lib/module/components/Input/index.js.map +1 -1
- package/lib/module/components/Input/styles.js +17 -30
- package/lib/module/components/Input/styles.js.map +1 -1
- package/lib/module/components/Link/index.js +85 -0
- package/lib/module/components/Link/index.js.map +1 -0
- package/lib/module/components/Link/styles.js +11 -0
- package/lib/module/components/Link/styles.js.map +1 -0
- package/lib/module/components/OtpInput/index.js +79 -0
- package/lib/module/components/OtpInput/index.js.map +1 -0
- package/lib/module/components/OtpInput/styles.js +44 -0
- package/lib/module/components/OtpInput/styles.js.map +1 -0
- package/lib/module/components/ProgressBar/index.js +41 -0
- package/lib/module/components/ProgressBar/index.js.map +1 -0
- package/lib/module/components/ProgressBar/styles.js +6 -0
- package/lib/module/components/ProgressBar/styles.js.map +1 -0
- package/lib/module/components/ProgressSegmented/index.js +58 -0
- package/lib/module/components/ProgressSegmented/index.js.map +1 -0
- package/lib/module/components/ProgressSegmented/styles.js +17 -0
- package/lib/module/components/ProgressSegmented/styles.js.map +1 -0
- package/lib/module/components/Select/SelectTriggerHost.js +7 -0
- package/lib/module/components/Select/SelectTriggerHost.js.map +1 -0
- package/lib/module/components/Select/SelectTriggerHost.web.js +93 -0
- package/lib/module/components/Select/SelectTriggerHost.web.js.map +1 -0
- package/lib/module/components/Select/index.js +14 -14
- package/lib/module/components/Select/index.js.map +1 -1
- package/lib/module/components/Select/styles.js +29 -53
- package/lib/module/components/Select/styles.js.map +1 -1
- package/lib/module/components/Stack/HStack.js +8 -21
- package/lib/module/components/Stack/HStack.js.map +1 -1
- package/lib/module/components/Stack/VStack.js +8 -21
- package/lib/module/components/Stack/VStack.js.map +1 -1
- package/lib/module/components/Stack/styles.js +40 -0
- package/lib/module/components/Stack/styles.js.map +1 -0
- package/lib/module/components/Text/index.js +19 -1
- package/lib/module/components/Text/index.js.map +1 -1
- package/lib/module/components/Text/styles.js +19 -0
- package/lib/module/components/Text/styles.js.map +1 -0
- package/lib/module/components/VirtualizedList/index.js +15 -0
- package/lib/module/components/VirtualizedList/index.js.map +1 -0
- package/lib/module/components/index.js +17 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/styles/index.js +4 -0
- package/lib/module/styles/index.js.map +1 -0
- package/lib/module/styles/primitives.js +119 -0
- package/lib/module/styles/primitives.js.map +1 -0
- package/lib/typescript/components/AlertDialog/index.d.ts +30 -0
- package/lib/typescript/components/AlertDialog/index.d.ts.map +1 -0
- package/lib/typescript/components/Avatar/index.d.ts +40 -0
- package/lib/typescript/components/Avatar/index.d.ts.map +1 -0
- package/lib/typescript/components/Avatar/styles.d.ts +16 -0
- package/lib/typescript/components/Avatar/styles.d.ts.map +1 -0
- package/lib/typescript/components/BottomSheet/index.d.ts +61 -0
- package/lib/typescript/components/BottomSheet/index.d.ts.map +1 -0
- package/lib/typescript/components/BottomSheet/styles.d.ts +16 -0
- package/lib/typescript/components/BottomSheet/styles.d.ts.map +1 -0
- package/lib/typescript/components/Box/Box.d.ts +1 -0
- package/lib/typescript/components/Box/Box.d.ts.map +1 -1
- package/lib/typescript/components/Button/index.d.ts +6 -3
- package/lib/typescript/components/Button/index.d.ts.map +1 -1
- package/lib/typescript/components/Button/styles.d.ts +11 -8
- package/lib/typescript/components/Button/styles.d.ts.map +1 -1
- package/lib/typescript/components/Card/index.d.ts +30 -0
- package/lib/typescript/components/Card/index.d.ts.map +1 -0
- package/lib/typescript/components/Card/styles.d.ts +6 -0
- package/lib/typescript/components/Card/styles.d.ts.map +1 -0
- package/lib/typescript/components/Checkbox/index.d.ts +7 -5
- package/lib/typescript/components/Checkbox/index.d.ts.map +1 -1
- package/lib/typescript/components/Checkbox/styles.d.ts +4 -4
- package/lib/typescript/components/Checkbox/styles.d.ts.map +1 -1
- package/lib/typescript/components/Chip/index.d.ts +27 -0
- package/lib/typescript/components/Chip/index.d.ts.map +1 -0
- package/lib/typescript/components/Chip/styles.d.ts +12 -0
- package/lib/typescript/components/Chip/styles.d.ts.map +1 -0
- package/lib/typescript/components/Dialog/index.d.ts +61 -0
- package/lib/typescript/components/Dialog/index.d.ts.map +1 -0
- package/lib/typescript/components/Dialog/styles.d.ts +14 -0
- package/lib/typescript/components/Dialog/styles.d.ts.map +1 -0
- package/lib/typescript/components/Field/FieldLabel.d.ts +18 -0
- package/lib/typescript/components/Field/FieldLabel.d.ts.map +1 -0
- package/lib/typescript/components/Field/FieldLabel.web.d.ts +16 -0
- package/lib/typescript/components/Field/FieldLabel.web.d.ts.map +1 -0
- package/lib/typescript/components/Field/index.d.ts +26 -0
- package/lib/typescript/components/Field/index.d.ts.map +1 -0
- package/lib/typescript/components/Field/styles.d.ts +16 -0
- package/lib/typescript/components/Field/styles.d.ts.map +1 -0
- package/lib/typescript/components/Form/FormRoot.d.ts +14 -0
- package/lib/typescript/components/Form/FormRoot.d.ts.map +1 -0
- package/lib/typescript/components/Form/FormRoot.web.d.ts +10 -0
- package/lib/typescript/components/Form/FormRoot.web.d.ts.map +1 -0
- package/lib/typescript/components/Form/index.d.ts +7 -0
- package/lib/typescript/components/Form/index.d.ts.map +1 -0
- package/lib/typescript/components/Form/styles.d.ts +2 -0
- package/lib/typescript/components/Form/styles.d.ts.map +1 -0
- package/lib/typescript/components/Heading/index.d.ts +10 -0
- package/lib/typescript/components/Heading/index.d.ts.map +1 -0
- package/lib/typescript/components/Heading/styles.d.ts +6 -0
- package/lib/typescript/components/Heading/styles.d.ts.map +1 -0
- package/lib/typescript/components/Icon/index.d.ts +27 -0
- package/lib/typescript/components/Icon/index.d.ts.map +1 -0
- package/lib/typescript/components/IconButton/index.d.ts +15 -0
- package/lib/typescript/components/IconButton/index.d.ts.map +1 -0
- package/lib/typescript/components/IconButton/styles.d.ts +11 -0
- package/lib/typescript/components/IconButton/styles.d.ts.map +1 -0
- package/lib/typescript/components/Image/Image.d.ts +47 -0
- package/lib/typescript/components/Image/Image.d.ts.map +1 -0
- package/lib/typescript/components/Image/index.d.ts +2 -0
- package/lib/typescript/components/Image/index.d.ts.map +1 -0
- package/lib/typescript/components/Input/BaseInput.android.d.ts +3 -0
- package/lib/typescript/components/Input/BaseInput.android.d.ts.map +1 -0
- package/lib/typescript/components/Input/index.d.ts +7 -5
- package/lib/typescript/components/Input/index.d.ts.map +1 -1
- package/lib/typescript/components/Input/styles.d.ts +5 -7
- package/lib/typescript/components/Input/styles.d.ts.map +1 -1
- package/lib/typescript/components/Link/index.d.ts +26 -0
- package/lib/typescript/components/Link/index.d.ts.map +1 -0
- package/lib/typescript/components/Link/styles.d.ts +6 -0
- package/lib/typescript/components/Link/styles.d.ts.map +1 -0
- package/lib/typescript/components/OtpInput/index.d.ts +11 -0
- package/lib/typescript/components/OtpInput/index.d.ts.map +1 -0
- package/lib/typescript/components/OtpInput/styles.d.ts +14 -0
- package/lib/typescript/components/OtpInput/styles.d.ts.map +1 -0
- package/lib/typescript/components/ProgressBar/index.d.ts +17 -0
- package/lib/typescript/components/ProgressBar/index.d.ts.map +1 -0
- package/lib/typescript/components/ProgressBar/styles.d.ts +5 -0
- package/lib/typescript/components/ProgressBar/styles.d.ts.map +1 -0
- package/lib/typescript/components/ProgressSegmented/index.d.ts +15 -0
- package/lib/typescript/components/ProgressSegmented/index.d.ts.map +1 -0
- package/lib/typescript/components/ProgressSegmented/styles.d.ts +8 -0
- package/lib/typescript/components/ProgressSegmented/styles.d.ts.map +1 -0
- package/lib/typescript/components/Select/SelectTriggerHost.d.ts +3 -0
- package/lib/typescript/components/Select/SelectTriggerHost.d.ts.map +1 -0
- package/lib/typescript/components/Select/SelectTriggerHost.web.d.ts +13 -0
- package/lib/typescript/components/Select/SelectTriggerHost.web.d.ts.map +1 -0
- package/lib/typescript/components/Select/index.d.ts +7 -4
- package/lib/typescript/components/Select/index.d.ts.map +1 -1
- package/lib/typescript/components/Select/styles.d.ts +6 -8
- package/lib/typescript/components/Select/styles.d.ts.map +1 -1
- package/lib/typescript/components/Stack/HStack.d.ts +1 -12
- package/lib/typescript/components/Stack/HStack.d.ts.map +1 -1
- package/lib/typescript/components/Stack/VStack.d.ts +1 -12
- package/lib/typescript/components/Stack/VStack.d.ts.map +1 -1
- package/lib/typescript/components/Stack/styles.d.ts +23 -0
- package/lib/typescript/components/Stack/styles.d.ts.map +1 -0
- package/lib/typescript/components/Switch/index.d.ts +0 -1
- package/lib/typescript/components/Switch/index.d.ts.map +1 -1
- package/lib/typescript/components/Text/index.d.ts +9 -1
- package/lib/typescript/components/Text/index.d.ts.map +1 -1
- package/lib/typescript/components/Text/styles.d.ts +6 -0
- package/lib/typescript/components/Text/styles.d.ts.map +1 -0
- package/lib/typescript/components/VirtualizedList/index.d.ts +8 -0
- package/lib/typescript/components/VirtualizedList/index.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts +17 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +3 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/styles/index.d.ts +2 -0
- package/lib/typescript/styles/index.d.ts.map +1 -0
- package/lib/typescript/styles/primitives.d.ts +85 -0
- package/lib/typescript/styles/primitives.d.ts.map +1 -0
- package/package.json +15 -6
- package/src/components/AlertDialog/index.tsx +124 -0
- package/src/components/Avatar/index.tsx +172 -0
- package/src/components/Avatar/styles.ts +83 -0
- package/src/components/BottomSheet/index.tsx +316 -0
- package/src/components/BottomSheet/styles.ts +79 -0
- package/src/components/Box/Box.tsx +1 -0
- package/src/components/Button/index.tsx +14 -9
- package/src/components/Button/styles.ts +159 -209
- package/src/components/Card/index.tsx +115 -0
- package/src/components/Card/styles.ts +41 -0
- package/src/components/Checkbox/index.tsx +15 -23
- package/src/components/Checkbox/styles.ts +33 -24
- package/src/components/Chip/index.tsx +91 -0
- package/src/components/Chip/styles.ts +52 -0
- package/src/components/Dialog/index.tsx +304 -0
- package/src/components/Dialog/styles.ts +88 -0
- package/src/components/Field/FieldLabel.tsx +33 -0
- package/src/components/Field/FieldLabel.web.tsx +25 -0
- package/src/components/Field/index.tsx +171 -0
- package/src/components/Field/styles.ts +32 -0
- package/src/components/Form/FormRoot.tsx +20 -0
- package/src/components/Form/FormRoot.web.tsx +12 -0
- package/src/components/Form/index.tsx +38 -0
- package/src/components/Form/styles.ts +3 -0
- package/src/components/Heading/index.tsx +36 -0
- package/src/components/Heading/styles.tsx +25 -0
- package/src/components/Icon/index.tsx +54 -0
- package/src/components/IconButton/index.tsx +92 -0
- package/src/components/IconButton/styles.ts +59 -0
- package/src/components/Image/Image.tsx +77 -0
- package/src/components/Image/index.ts +1 -0
- package/src/components/Input/BaseInput.android.tsx +13 -0
- package/src/components/Input/index.tsx +9 -22
- package/src/components/Input/styles.ts +36 -40
- package/src/components/Link/index.tsx +83 -0
- package/src/components/Link/styles.ts +21 -0
- package/src/components/OtpInput/index.tsx +79 -0
- package/src/components/OtpInput/styles.ts +45 -0
- package/src/components/ProgressBar/index.tsx +53 -0
- package/src/components/ProgressBar/styles.ts +9 -0
- package/src/components/ProgressSegmented/index.tsx +81 -0
- package/src/components/ProgressSegmented/styles.ts +20 -0
- package/src/components/Select/SelectTriggerHost.tsx +4 -0
- package/src/components/Select/SelectTriggerHost.web.tsx +136 -0
- package/src/components/Select/index.tsx +14 -14
- package/src/components/Select/styles.ts +68 -75
- package/src/components/Stack/HStack.tsx +8 -19
- package/src/components/Stack/VStack.tsx +8 -23
- package/src/components/Stack/styles.ts +42 -0
- package/src/components/Switch/index.tsx +0 -2
- package/src/components/Text/index.tsx +16 -0
- package/src/components/Text/styles.tsx +25 -0
- package/src/components/VirtualizedList/index.tsx +19 -0
- package/src/components/index.ts +17 -0
- package/src/index.ts +3 -0
- package/src/styles/index.ts +1 -0
- package/src/styles/primitives.ts +107 -0
- package/lib/commonjs/components/Text/Text.js +0 -30
- package/lib/commonjs/components/Text/Text.js.map +0 -1
- package/lib/module/components/Text/Text.js +0 -26
- package/lib/module/components/Text/Text.js.map +0 -1
- package/lib/typescript/components/Text/Text.d.ts +0 -11
- package/lib/typescript/components/Text/Text.d.ts.map +0 -1
- package/src/components/Text/Text.tsx +0 -58
- package/src/components/Text/index.ts +0 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
+
import {
|
|
4
|
+
COLOR_BG_INVERSE,
|
|
5
|
+
COLOR_BG_PRIMARY,
|
|
6
|
+
COLOR_BORDER_DEFAULT,
|
|
7
|
+
COLOR_TEXT_PRIMARY,
|
|
8
|
+
COLOR_TEXT_SECONDARY,
|
|
9
|
+
RADIUS_MD,
|
|
10
|
+
SHADOW_MD,
|
|
11
|
+
TRANSITION_COLORS,
|
|
12
|
+
} from '../../styles/primitives';
|
|
13
|
+
|
|
14
|
+
// ── Overlay ─────────────────────────────────────────────────
|
|
15
|
+
|
|
16
|
+
export const dialogOverlayVariants = cva(['absolute inset-0', COLOR_BG_INVERSE, 'opacity-50']);
|
|
17
|
+
|
|
18
|
+
// ── Content ─────────────────────────────────────────────────
|
|
19
|
+
|
|
20
|
+
export const dialogContentVariants = cva(
|
|
21
|
+
[
|
|
22
|
+
COLOR_BG_PRIMARY,
|
|
23
|
+
`border ${COLOR_BORDER_DEFAULT}`,
|
|
24
|
+
RADIUS_MD,
|
|
25
|
+
Platform.select({ web: SHADOW_MD, default: '' }),
|
|
26
|
+
'max-h-[85vh] overflow-hidden',
|
|
27
|
+
],
|
|
28
|
+
{
|
|
29
|
+
variants: {
|
|
30
|
+
size: {
|
|
31
|
+
sm: 'w-[90%] max-w-sm',
|
|
32
|
+
md: 'w-[90%] max-w-md',
|
|
33
|
+
lg: 'w-[90%] max-w-lg',
|
|
34
|
+
full: 'w-full mx-4',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
defaultVariants: {
|
|
38
|
+
size: 'md',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
// ── Header ──────────────────────────────────────────────────
|
|
44
|
+
|
|
45
|
+
export const dialogHeaderVariants = cva([
|
|
46
|
+
'flex-row items-center justify-between shrink-0',
|
|
47
|
+
'px-6 pt-6 pb-2',
|
|
48
|
+
]);
|
|
49
|
+
|
|
50
|
+
// ── Title ───────────────────────────────────────────────────
|
|
51
|
+
|
|
52
|
+
export const dialogTitleVariants = cva(['text-lg font-semibold', COLOR_TEXT_PRIMARY]);
|
|
53
|
+
|
|
54
|
+
// ── Description ─────────────────────────────────────────────
|
|
55
|
+
|
|
56
|
+
export const dialogDescriptionVariants = cva(['text-sm mt-1', COLOR_TEXT_SECONDARY]);
|
|
57
|
+
|
|
58
|
+
// ── Body ────────────────────────────────────────────────────
|
|
59
|
+
|
|
60
|
+
export const dialogBodyVariants = cva(['px-6 py-4 shrink min-h-0']);
|
|
61
|
+
|
|
62
|
+
// ── Footer ──────────────────────────────────────────────────
|
|
63
|
+
|
|
64
|
+
export const dialogFooterVariants = cva([
|
|
65
|
+
'flex-row items-center justify-end shrink-0',
|
|
66
|
+
'gap-3 px-6 pt-2 pb-6',
|
|
67
|
+
]);
|
|
68
|
+
|
|
69
|
+
// ── Close ───────────────────────────────────────────────────
|
|
70
|
+
|
|
71
|
+
export const dialogCloseVariants = cva([
|
|
72
|
+
'p-1 -m-1 rounded-full',
|
|
73
|
+
TRANSITION_COLORS,
|
|
74
|
+
Platform.select({
|
|
75
|
+
default: 'data-[active=true]:opacity-70',
|
|
76
|
+
web: [
|
|
77
|
+
'data-[hover=true]:bg-slate-100',
|
|
78
|
+
'data-[active=true]:bg-slate-200',
|
|
79
|
+
'data-[focus-visible=true]:ring-2 data-[focus-visible=true]:ring-slate-400/50 data-[focus-visible=true]:ring-offset-2',
|
|
80
|
+
].join(' '),
|
|
81
|
+
}),
|
|
82
|
+
]);
|
|
83
|
+
|
|
84
|
+
// ── Close Icon ──────────────────────────────────────────────
|
|
85
|
+
|
|
86
|
+
export const dialogCloseIconVariants = cva(['size-5 text-slate-500']);
|
|
87
|
+
|
|
88
|
+
export type DialogVariantProps = VariantProps<typeof dialogContentVariants>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { Text, TextProps, type GestureResponderEvent } from 'react-native';
|
|
3
|
+
import { composeEventHandlers, useFormControlContext } from '@cdx-ui/utils';
|
|
4
|
+
|
|
5
|
+
export type BaseFieldLabelProps = TextProps & {
|
|
6
|
+
/** @platform web — forwarded on web; ignored here (see `FieldLabelRoot.web`). */
|
|
7
|
+
htmlFor?: string;
|
|
8
|
+
/** Optional; composed with label tap-to-focus on native. */
|
|
9
|
+
onPress?: ((event: GestureResponderEvent) => void) | null;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Native: `Text` label row — tap focuses the field input via form context
|
|
14
|
+
* (parity with `<label htmlFor>` on web).
|
|
15
|
+
*/
|
|
16
|
+
export const BaseFieldLabel = forwardRef<Text, BaseFieldLabelProps>(
|
|
17
|
+
({ htmlFor: _omitHtmlFor, onPress, ...props }, ref) => {
|
|
18
|
+
void _omitHtmlFor;
|
|
19
|
+
|
|
20
|
+
const { focusInput, isDisabled } = useFormControlContext();
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Text
|
|
24
|
+
ref={ref}
|
|
25
|
+
{...props}
|
|
26
|
+
disabled={Boolean(isDisabled)}
|
|
27
|
+
onPress={composeEventHandlers(onPress, () => focusInput?.())}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
},
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
BaseFieldLabel.displayName = 'BaseFieldLabel';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { forwardRef, type ReactNode } from 'react';
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
// TODO: Why does dataSet need to be decomposed into individual data attributes?
|
|
5
|
+
|
|
6
|
+
export type BaseFieldLabelProps = ViewProps & {
|
|
7
|
+
htmlFor?: string;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
/** @platform native — ignored on DOM `<label>`; set by form primitive for Uniwind. */
|
|
10
|
+
dataSet?: Record<string, string>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** Real `<label>` so clicking the label focuses the associated control (`htmlFor` → input `id`). */
|
|
14
|
+
export const BaseFieldLabel = forwardRef<HTMLLabelElement, BaseFieldLabelProps>((props, ref) => {
|
|
15
|
+
return (
|
|
16
|
+
<label
|
|
17
|
+
ref={ref}
|
|
18
|
+
{...(props as React.LabelHTMLAttributes<HTMLLabelElement>)}
|
|
19
|
+
data-invalid={props.dataSet?.invalid}
|
|
20
|
+
data-required={props.dataSet?.required}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
BaseFieldLabel.displayName = 'BaseFieldLabel';
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { Text, View } from 'react-native';
|
|
3
|
+
import { ErrorIcon } from '@cdx-ui/icons';
|
|
4
|
+
import {
|
|
5
|
+
createField,
|
|
6
|
+
IFieldErrorProps,
|
|
7
|
+
IFieldHelperProps,
|
|
8
|
+
IFieldLabelProps,
|
|
9
|
+
type IFieldRootProps,
|
|
10
|
+
} from '@cdx-ui/primitives';
|
|
11
|
+
import { cn } from '@cdx-ui/utils';
|
|
12
|
+
import { Icon } from '../Icon';
|
|
13
|
+
import { BaseFieldLabel } from './FieldLabel';
|
|
14
|
+
import {
|
|
15
|
+
fieldErrorIconVariants,
|
|
16
|
+
fieldErrorTextVariants,
|
|
17
|
+
fieldErrorVariants,
|
|
18
|
+
fieldHelperVariants,
|
|
19
|
+
fieldHelperTextVariants,
|
|
20
|
+
fieldLabelVariants,
|
|
21
|
+
fieldRootVariants,
|
|
22
|
+
type FieldRootVariantProps,
|
|
23
|
+
type FieldLabelVariantProps,
|
|
24
|
+
type FieldHelperVariantProps,
|
|
25
|
+
type FieldErrorVariantProps,
|
|
26
|
+
} from './styles';
|
|
27
|
+
|
|
28
|
+
// =============================================================================
|
|
29
|
+
// PRIMITIVE
|
|
30
|
+
// =============================================================================
|
|
31
|
+
|
|
32
|
+
const FieldPrimitive = createField({
|
|
33
|
+
Root: View,
|
|
34
|
+
Label: BaseFieldLabel,
|
|
35
|
+
Helper: View,
|
|
36
|
+
HelperText: Text,
|
|
37
|
+
Error: View,
|
|
38
|
+
ErrorText: Text,
|
|
39
|
+
ErrorIcon: View,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// =============================================================================
|
|
43
|
+
// FIELD ROOT
|
|
44
|
+
// =============================================================================
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Field wrapper + context. For **initial focus**, pass `autoFocus` on `Input.Field` (not here).
|
|
48
|
+
*/
|
|
49
|
+
export interface FieldRootProps extends IFieldRootProps, FieldRootVariantProps {}
|
|
50
|
+
|
|
51
|
+
const FieldRoot = forwardRef<View, FieldRootProps>(
|
|
52
|
+
({ className, children, style, ...props }, ref) => {
|
|
53
|
+
const computedClassName = cn(fieldRootVariants(), className);
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<FieldPrimitive ref={ref} className={computedClassName} style={style} {...props}>
|
|
57
|
+
{children}
|
|
58
|
+
</FieldPrimitive>
|
|
59
|
+
);
|
|
60
|
+
},
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
FieldRoot.displayName = 'Field';
|
|
64
|
+
|
|
65
|
+
// =============================================================================
|
|
66
|
+
// FIELD LABEL
|
|
67
|
+
// =============================================================================
|
|
68
|
+
|
|
69
|
+
export interface FieldLabelProps extends IFieldLabelProps, FieldLabelVariantProps {}
|
|
70
|
+
|
|
71
|
+
const FieldLabel = forwardRef<View, FieldLabelProps>(
|
|
72
|
+
({ className, children, style, htmlFor, ...props }, ref) => {
|
|
73
|
+
const labelClassName = cn(fieldLabelVariants(), className);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<FieldPrimitive.Label
|
|
77
|
+
ref={ref}
|
|
78
|
+
className={labelClassName}
|
|
79
|
+
style={style}
|
|
80
|
+
htmlFor={htmlFor}
|
|
81
|
+
requiredIndicator={
|
|
82
|
+
<Text className="text-red-500" aria-hidden>
|
|
83
|
+
{' *'}
|
|
84
|
+
</Text>
|
|
85
|
+
}
|
|
86
|
+
{...props}
|
|
87
|
+
>
|
|
88
|
+
{children}
|
|
89
|
+
</FieldPrimitive.Label>
|
|
90
|
+
);
|
|
91
|
+
},
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
FieldLabel.displayName = 'Field.Label';
|
|
95
|
+
|
|
96
|
+
// =============================================================================
|
|
97
|
+
// FIELD HELPER
|
|
98
|
+
// =============================================================================
|
|
99
|
+
|
|
100
|
+
export interface FieldHelperProps extends IFieldHelperProps, FieldHelperVariantProps {}
|
|
101
|
+
|
|
102
|
+
const FieldHelper = forwardRef<View, FieldHelperProps>(
|
|
103
|
+
({ className, children, style, ...props }, ref) => {
|
|
104
|
+
const containerClassName = cn(fieldHelperVariants(), className);
|
|
105
|
+
const textClassName = cn(fieldHelperTextVariants());
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<FieldPrimitive.Helper ref={ref} className={containerClassName} style={style} {...props}>
|
|
109
|
+
<FieldPrimitive.HelperText className={textClassName}>{children}</FieldPrimitive.HelperText>
|
|
110
|
+
</FieldPrimitive.Helper>
|
|
111
|
+
);
|
|
112
|
+
},
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
FieldHelper.displayName = 'Field.Helper';
|
|
116
|
+
|
|
117
|
+
// =============================================================================
|
|
118
|
+
// FIELD ERROR (internal icon + text composition)
|
|
119
|
+
// =============================================================================
|
|
120
|
+
|
|
121
|
+
const FieldErrorIcon = ({ className, style, ...props }: { className?: string; style?: any }) => {
|
|
122
|
+
const computedClassName = cn(fieldErrorIconVariants(), className);
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<Icon
|
|
126
|
+
as={ErrorIcon}
|
|
127
|
+
className={computedClassName}
|
|
128
|
+
style={style}
|
|
129
|
+
aria-hidden={true}
|
|
130
|
+
{...props}
|
|
131
|
+
/>
|
|
132
|
+
);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
FieldErrorIcon.displayName = 'Field.ErrorIcon';
|
|
136
|
+
|
|
137
|
+
export interface FieldErrorProps extends IFieldErrorProps, FieldErrorVariantProps {}
|
|
138
|
+
|
|
139
|
+
const FieldError = forwardRef<View, FieldErrorProps>(
|
|
140
|
+
({ className, children, style, ...props }, ref) => {
|
|
141
|
+
const containerClassName = cn(fieldErrorVariants(), className);
|
|
142
|
+
const textClassName = cn(fieldErrorTextVariants());
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<FieldPrimitive.Error ref={ref} className={containerClassName} style={style} {...props}>
|
|
146
|
+
<FieldPrimitive.ErrorIcon>
|
|
147
|
+
<FieldErrorIcon />
|
|
148
|
+
</FieldPrimitive.ErrorIcon>
|
|
149
|
+
<FieldPrimitive.ErrorText className={textClassName}>{children}</FieldPrimitive.ErrorText>
|
|
150
|
+
</FieldPrimitive.Error>
|
|
151
|
+
);
|
|
152
|
+
},
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
FieldError.displayName = 'Field.Error';
|
|
156
|
+
|
|
157
|
+
// =============================================================================
|
|
158
|
+
// COMPOUND EXPORT
|
|
159
|
+
// =============================================================================
|
|
160
|
+
|
|
161
|
+
type FieldCompoundComponent = typeof FieldRoot & {
|
|
162
|
+
Label: typeof FieldLabel;
|
|
163
|
+
Helper: typeof FieldHelper;
|
|
164
|
+
Error: typeof FieldError;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const Field = Object.assign(FieldRoot, {
|
|
168
|
+
Label: FieldLabel,
|
|
169
|
+
Helper: FieldHelper,
|
|
170
|
+
Error: FieldError,
|
|
171
|
+
}) as FieldCompoundComponent;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { DISABLED_OPACITY } from '../../styles/primitives';
|
|
3
|
+
|
|
4
|
+
export const fieldRootVariants = cva(['flex-col gap-2', 'web:last:mb-0', DISABLED_OPACITY]);
|
|
5
|
+
|
|
6
|
+
export const fieldLabelVariants = cva([
|
|
7
|
+
'body-md',
|
|
8
|
+
'font-medium',
|
|
9
|
+
'text-content-primary',
|
|
10
|
+
'flex-row items-center',
|
|
11
|
+
DISABLED_OPACITY,
|
|
12
|
+
'web:cursor-pointer',
|
|
13
|
+
'data-[invalid=true]:text-content-danger',
|
|
14
|
+
]);
|
|
15
|
+
|
|
16
|
+
export const fieldHelperVariants = cva(['flex-row items-center']);
|
|
17
|
+
|
|
18
|
+
export const fieldHelperTextVariants = cva(['body-sm', 'text-content-tertiary']);
|
|
19
|
+
|
|
20
|
+
export const fieldErrorVariants = cva(['flex-row items-center gap-1']);
|
|
21
|
+
|
|
22
|
+
export const fieldErrorTextVariants = cva(['body-sm', 'text-content-danger']);
|
|
23
|
+
|
|
24
|
+
export const fieldErrorIconVariants = cva(['size-3.5', 'text-content-danger']);
|
|
25
|
+
|
|
26
|
+
export type FieldRootVariantProps = VariantProps<typeof fieldRootVariants>;
|
|
27
|
+
export type FieldLabelVariantProps = VariantProps<typeof fieldLabelVariants>;
|
|
28
|
+
export type FieldHelperVariantProps = VariantProps<typeof fieldHelperVariants>;
|
|
29
|
+
export type FieldHelperTextVariantProps = VariantProps<typeof fieldHelperTextVariants>;
|
|
30
|
+
export type FieldErrorVariantProps = VariantProps<typeof fieldErrorVariants>;
|
|
31
|
+
export type FieldErrorTextVariantProps = VariantProps<typeof fieldErrorTextVariants>;
|
|
32
|
+
export type FieldErrorIconVariantProps = VariantProps<typeof fieldErrorIconVariants>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { View, type ViewProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export type BaseFormRootProps = ViewProps & {
|
|
5
|
+
onSubmit?: (e: React.SyntheticEvent) => void;
|
|
6
|
+
action?: string | ((formData: FormData) => void | Promise<void>);
|
|
7
|
+
method?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const BaseFormRoot = forwardRef<View, BaseFormRootProps>(
|
|
12
|
+
({ onSubmit: _onSubmit, action: _action, method: _method, ...props }, ref) => {
|
|
13
|
+
void _onSubmit;
|
|
14
|
+
void _action;
|
|
15
|
+
void _method;
|
|
16
|
+
return <View ref={ref} {...props} />;
|
|
17
|
+
},
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
BaseFormRoot.displayName = 'BaseFormRoot';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
|
|
3
|
+
export type BaseFormRootProps = React.FormHTMLAttributes<HTMLFormElement> & {
|
|
4
|
+
className?: string;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const BaseFormRoot = forwardRef<HTMLFormElement, BaseFormRootProps>((props, ref) => {
|
|
9
|
+
return <form ref={ref} {...props} />;
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
BaseFormRoot.displayName = 'BaseFormRoot';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { createForm } from '@cdx-ui/primitives';
|
|
4
|
+
import { cn } from '@cdx-ui/utils';
|
|
5
|
+
import { BaseFormRoot, type BaseFormRootProps } from './FormRoot';
|
|
6
|
+
import { formRootVariants } from './styles';
|
|
7
|
+
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// PRIMITIVE
|
|
10
|
+
// =============================================================================
|
|
11
|
+
|
|
12
|
+
const FormPrimitive = createForm({ Root: BaseFormRoot });
|
|
13
|
+
|
|
14
|
+
FormPrimitive.displayName = 'FormPrimitive';
|
|
15
|
+
|
|
16
|
+
// =============================================================================
|
|
17
|
+
// FORM ROOT (container — <form> on web, <View> on RN)
|
|
18
|
+
// =============================================================================
|
|
19
|
+
|
|
20
|
+
export interface FormProps extends BaseFormRootProps {}
|
|
21
|
+
|
|
22
|
+
const FormRoot = forwardRef<View, FormProps>(({ className, children, style, ...props }, ref) => {
|
|
23
|
+
const computedClassName = cn(formRootVariants(), className);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<FormPrimitive ref={ref} className={computedClassName} style={style} {...props}>
|
|
27
|
+
{children}
|
|
28
|
+
</FormPrimitive>
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
FormRoot.displayName = 'Form';
|
|
33
|
+
|
|
34
|
+
// =============================================================================
|
|
35
|
+
// EXPORT
|
|
36
|
+
// =============================================================================
|
|
37
|
+
|
|
38
|
+
export const Form = FormRoot;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { forwardRef, memo, type ComponentRef, type ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
import { cn } from '@cdx-ui/utils';
|
|
4
|
+
import { headingStyle, type HeadingVariantProps } from './styles';
|
|
5
|
+
|
|
6
|
+
const sizeToLevel = {
|
|
7
|
+
xl: 1,
|
|
8
|
+
lg: 2,
|
|
9
|
+
md: 3,
|
|
10
|
+
sm: 4,
|
|
11
|
+
xs: 5,
|
|
12
|
+
} as const;
|
|
13
|
+
|
|
14
|
+
export type HeadingProps = HeadingVariantProps &
|
|
15
|
+
ComponentPropsWithoutRef<typeof Text> & {
|
|
16
|
+
className?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const Heading = memo(
|
|
20
|
+
forwardRef<ComponentRef<typeof Text>, HeadingProps>(function Heading(
|
|
21
|
+
{ className, size = 'lg', ...props },
|
|
22
|
+
ref,
|
|
23
|
+
) {
|
|
24
|
+
return (
|
|
25
|
+
<Text
|
|
26
|
+
role="heading"
|
|
27
|
+
aria-level={sizeToLevel[size ?? 'lg']}
|
|
28
|
+
className={cn(headingStyle({ size }), className)}
|
|
29
|
+
{...props}
|
|
30
|
+
ref={ref}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
}),
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
Heading.displayName = 'Heading';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
+
|
|
4
|
+
export const headingStyle = cva(
|
|
5
|
+
[
|
|
6
|
+
`text-content-primary my-0`,
|
|
7
|
+
Platform.select({
|
|
8
|
+
web: 'bg-transparent display-inline no-underline',
|
|
9
|
+
default: '',
|
|
10
|
+
}),
|
|
11
|
+
],
|
|
12
|
+
{
|
|
13
|
+
variants: {
|
|
14
|
+
size: {
|
|
15
|
+
xl: 'heading-xl',
|
|
16
|
+
lg: 'heading-lg',
|
|
17
|
+
md: 'heading-md',
|
|
18
|
+
sm: 'heading-sm',
|
|
19
|
+
xs: 'heading-xs',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export type HeadingVariantProps = VariantProps<typeof headingStyle>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { withUniwind } from 'uniwind';
|
|
2
|
+
import { cn } from '@cdx-ui/utils';
|
|
3
|
+
import type { CdxIcon, CdxIconProps } from '@cdx-ui/icons';
|
|
4
|
+
import { COLOR_TEXT_PRIMARY } from '../../styles/primitives';
|
|
5
|
+
|
|
6
|
+
export type IconProps = CdxIconProps & {
|
|
7
|
+
className?: string; // TODO: Why does this need to specified manually?
|
|
8
|
+
as: CdxIcon;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
function IconImpl({ as: IconComponent, ...props }: IconProps) {
|
|
12
|
+
return <IconComponent {...props} />;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const StyledIcon = withUniwind(IconImpl, {
|
|
16
|
+
size: {
|
|
17
|
+
fromClassName: 'className',
|
|
18
|
+
styleProperty: 'width',
|
|
19
|
+
},
|
|
20
|
+
color: {
|
|
21
|
+
fromClassName: 'className',
|
|
22
|
+
styleProperty: 'color',
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A wrapper component for CDX icons with Uniwind `className` support via `withUniwind`.
|
|
28
|
+
*
|
|
29
|
+
* This component allows you to render any CDX icon while applying utility classes
|
|
30
|
+
* using `uniwind`. It avoids the need to wrap or configure each icon individually.
|
|
31
|
+
*
|
|
32
|
+
* @component
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* import { Icon } from '@cdx-ui/components';
|
|
36
|
+
* import { ArrowRight } from '@cdx-ui/icons';
|
|
37
|
+
*
|
|
38
|
+
* <Icon as={ArrowRight} className="text-red-500 size-4" />
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @param {CdxIcon} as - The CDX icon component to render.
|
|
42
|
+
* @param {string} className - Utility classes to style the icon using Uniwind.
|
|
43
|
+
* @param {number} size - Icon size (overrides the size class).
|
|
44
|
+
* @param {...CdxIconProps} ...props - Additional icon props passed to the "as" icon.
|
|
45
|
+
*/
|
|
46
|
+
export function Icon({ as: IconComponent, className, ...props }: IconProps) {
|
|
47
|
+
return (
|
|
48
|
+
<StyledIcon
|
|
49
|
+
as={IconComponent}
|
|
50
|
+
className={cn(COLOR_TEXT_PRIMARY, 'size-5', className)}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { ActivityIndicator, Pressable, Text, View, type PressableProps } from 'react-native';
|
|
3
|
+
import {
|
|
4
|
+
createButton,
|
|
5
|
+
dataAttributes,
|
|
6
|
+
type IButtonProps,
|
|
7
|
+
useButtonContext,
|
|
8
|
+
} from '@cdx-ui/primitives';
|
|
9
|
+
import type { CdxIcon } from '@cdx-ui/icons';
|
|
10
|
+
import { cn } from '@cdx-ui/utils';
|
|
11
|
+
import { Icon, type IconProps } from '../Icon';
|
|
12
|
+
import {
|
|
13
|
+
type IconButtonVariantProps,
|
|
14
|
+
iconButtonGlyphVariants,
|
|
15
|
+
iconButtonIconColorVariants,
|
|
16
|
+
iconButtonRootVariants,
|
|
17
|
+
} from './styles';
|
|
18
|
+
|
|
19
|
+
const IconButtonPrimitive = createButton({
|
|
20
|
+
Root: Pressable,
|
|
21
|
+
Text,
|
|
22
|
+
Group: View,
|
|
23
|
+
Spinner: ActivityIndicator,
|
|
24
|
+
Icon: View,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
function IconButtonGlyph({ as: IconComponent, className }: { as: CdxIcon; className: string }) {
|
|
28
|
+
const { hover, focus, active, disabled, focusVisible } = useButtonContext();
|
|
29
|
+
return (
|
|
30
|
+
<Icon
|
|
31
|
+
as={IconComponent}
|
|
32
|
+
className={className}
|
|
33
|
+
{...dataAttributes({
|
|
34
|
+
hover,
|
|
35
|
+
focus,
|
|
36
|
+
active,
|
|
37
|
+
disabled,
|
|
38
|
+
focusVisible,
|
|
39
|
+
})}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface IconButtonProps extends PressableProps, IButtonProps, IconButtonVariantProps {
|
|
45
|
+
className?: string;
|
|
46
|
+
/** CDX icon component to render (icon-only control). */
|
|
47
|
+
as: CdxIcon;
|
|
48
|
+
/** Passed through to the underlying `Icon`. */
|
|
49
|
+
iconClassName?: IconProps['className'];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const IconButtonRoot = forwardRef<View, IconButtonProps>(
|
|
53
|
+
(
|
|
54
|
+
{
|
|
55
|
+
variant = 'solid',
|
|
56
|
+
size = 'default',
|
|
57
|
+
className,
|
|
58
|
+
style,
|
|
59
|
+
as: IconComponent,
|
|
60
|
+
iconClassName,
|
|
61
|
+
accessibilityRole = 'button',
|
|
62
|
+
...props
|
|
63
|
+
},
|
|
64
|
+
ref,
|
|
65
|
+
) => {
|
|
66
|
+
const rootClassName = cn(iconButtonRootVariants({ variant, size }), className);
|
|
67
|
+
|
|
68
|
+
const glyphClassName = cn(
|
|
69
|
+
iconButtonGlyphVariants({ size }),
|
|
70
|
+
iconButtonIconColorVariants(),
|
|
71
|
+
iconClassName,
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<IconButtonPrimitive
|
|
76
|
+
ref={ref}
|
|
77
|
+
accessibilityRole={accessibilityRole}
|
|
78
|
+
className={rootClassName}
|
|
79
|
+
style={style}
|
|
80
|
+
{...props}
|
|
81
|
+
>
|
|
82
|
+
<IconButtonGlyph as={IconComponent} className={glyphClassName} />
|
|
83
|
+
</IconButtonPrimitive>
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
IconButtonRoot.displayName = 'IconButton';
|
|
89
|
+
|
|
90
|
+
export const IconButton = IconButtonRoot;
|
|
91
|
+
|
|
92
|
+
export type { IconButtonVariantProps };
|