@cdx-ui/components 0.0.1-alpha.4 → 0.0.1-alpha.40
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 +54 -3
- 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 +181 -162
- 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 +180 -0
- package/lib/commonjs/components/Checkbox/index.js.map +1 -0
- package/lib/commonjs/components/Checkbox/styles.js +68 -0
- package/lib/commonjs/components/Checkbox/styles.js.map +1 -0
- 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/Switch/BaseSwitch.js +46 -0
- package/lib/commonjs/components/Switch/BaseSwitch.js.map +1 -0
- package/lib/commonjs/components/Switch/BaseSwitch.web.js +56 -0
- package/lib/commonjs/components/Switch/BaseSwitch.web.js.map +1 -0
- package/lib/commonjs/components/Switch/index.js +13 -0
- package/lib/commonjs/components/Switch/index.js.map +1 -0
- package/lib/commonjs/components/Switch/styles.js +128 -0
- package/lib/commonjs/components/Switch/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 +228 -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/metro/withCdxMetroConfig.js +24 -0
- package/lib/commonjs/metro/withCdxMetroConfig.js.map +1 -0
- 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 +180 -161
- 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 +176 -0
- package/lib/module/components/Checkbox/index.js.map +1 -0
- package/lib/module/components/Checkbox/styles.js +64 -0
- package/lib/module/components/Checkbox/styles.js.map +1 -0
- 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/Switch/BaseSwitch.js +42 -0
- package/lib/module/components/Switch/BaseSwitch.js.map +1 -0
- package/lib/module/components/Switch/BaseSwitch.web.js +52 -0
- package/lib/module/components/Switch/BaseSwitch.web.js.map +1 -0
- package/lib/module/components/Switch/index.js +9 -0
- package/lib/module/components/Switch/index.js.map +1 -0
- package/lib/module/components/Switch/styles.js +125 -0
- package/lib/module/components/Switch/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 +19 -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/metro/withCdxMetroConfig.js +20 -0
- package/lib/module/metro/withCdxMetroConfig.js.map +1 -0
- 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 +46 -0
- package/lib/typescript/components/Checkbox/index.d.ts.map +1 -0
- package/lib/typescript/components/Checkbox/styles.d.ts +18 -0
- package/lib/typescript/components/Checkbox/styles.d.ts.map +1 -0
- 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/BaseSwitch.d.ts +9 -0
- package/lib/typescript/components/Switch/BaseSwitch.d.ts.map +1 -0
- package/lib/typescript/components/Switch/BaseSwitch.web.d.ts +15 -0
- package/lib/typescript/components/Switch/BaseSwitch.web.d.ts.map +1 -0
- package/lib/typescript/components/Switch/index.d.ts +7 -0
- package/lib/typescript/components/Switch/index.d.ts.map +1 -0
- package/lib/typescript/components/Switch/styles.d.ts +26 -0
- package/lib/typescript/components/Switch/styles.d.ts.map +1 -0
- 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 +19 -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/metro/withCdxMetroConfig.d.ts +19 -0
- package/lib/typescript/metro/withCdxMetroConfig.d.ts.map +1 -0
- 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 +21 -10
- 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 -204
- package/src/components/Card/index.tsx +115 -0
- package/src/components/Card/styles.ts +41 -0
- package/src/components/Checkbox/index.tsx +207 -0
- package/src/components/Checkbox/styles.ts +103 -0
- 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/BaseSwitch.tsx +38 -0
- package/src/components/Switch/BaseSwitch.web.tsx +69 -0
- package/src/components/Switch/index.tsx +11 -0
- package/src/components/Switch/styles.ts +120 -0
- 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 +19 -0
- package/src/index.ts +3 -0
- package/src/metro/withCdxMetroConfig.ts +29 -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
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
2
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
+
import {
|
|
4
|
+
COLOR_BG_PRIMARY,
|
|
5
|
+
COLOR_BORDER_DEFAULT,
|
|
6
|
+
COLOR_TEXT_MUTED,
|
|
7
|
+
COLOR_TEXT_PRIMARY,
|
|
8
|
+
DISABLED_CURSOR,
|
|
9
|
+
DISABLED_OPACITY,
|
|
10
|
+
RADIUS_SM,
|
|
11
|
+
RADIUS_MD,
|
|
12
|
+
SHADOW_SM,
|
|
13
|
+
SHADOW_MD,
|
|
14
|
+
SIZE_SCALE,
|
|
15
|
+
TRANSITION_COLORS,
|
|
16
|
+
} from '../../styles/primitives';
|
|
3
17
|
|
|
4
18
|
// ── Trigger ─────────────────────────────────────────────────
|
|
5
19
|
|
|
6
20
|
export const selectTriggerVariants = cva(
|
|
7
21
|
[
|
|
8
|
-
'flex-row items-center justify-between',
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
22
|
+
'flex w-full min-w-0 flex-row items-center justify-between text-start',
|
|
23
|
+
RADIUS_SM,
|
|
24
|
+
SHADOW_SM,
|
|
25
|
+
TRANSITION_COLORS,
|
|
26
|
+
COLOR_BG_PRIMARY,
|
|
27
|
+
`border ${COLOR_BORDER_DEFAULT}`,
|
|
28
|
+
DISABLED_OPACITY,
|
|
29
|
+
DISABLED_CURSOR,
|
|
12
30
|
'data-[readonly=true]:cursor-default',
|
|
13
|
-
'data-[
|
|
31
|
+
'data-[state=open]:border-slate-900',
|
|
32
|
+
'data-[invalid=true]:border-red-500',
|
|
33
|
+
'data-[readonly=true]:bg-slate-50',
|
|
34
|
+
Platform.select({
|
|
35
|
+
default: 'data-[active=true]:border-slate-300',
|
|
36
|
+
web: [
|
|
37
|
+
'data-[hover=true]:border-slate-300 data-[active=true]:data-[hover=true]:border-slate-400',
|
|
38
|
+
'data-[focus-visible=true]:ring-2 data-[focus-visible=true]:ring-slate-400/50 data-[focus-visible=true]:ring-offset-2',
|
|
39
|
+
'data-[state=open]:ring-2 data-[state=open]:ring-slate-400/50',
|
|
40
|
+
].join(' '),
|
|
41
|
+
}),
|
|
14
42
|
],
|
|
15
43
|
{
|
|
16
44
|
variants: {
|
|
17
45
|
variant: {
|
|
18
|
-
outline: [
|
|
19
|
-
'bg-white border border-gray-300',
|
|
20
|
-
Platform.select({
|
|
21
|
-
default: 'data-[active=true]:border-gray-400',
|
|
22
|
-
web: 'data-[hover=true]:border-gray-400 data-[active=true]:data-[hover=true]:border-gray-500',
|
|
23
|
-
}),
|
|
24
|
-
'data-[state=open]:data-[invalid=false]:border-blue-500',
|
|
25
|
-
'data-[invalid=true]:border-red-500',
|
|
26
|
-
'data-[readonly=true]:bg-gray-50',
|
|
27
|
-
],
|
|
28
|
-
filled: [
|
|
29
|
-
'bg-gray-100 border border-transparent',
|
|
30
|
-
Platform.select({
|
|
31
|
-
default: 'data-[active=true]:bg-gray-200',
|
|
32
|
-
web: 'data-[hover=true]:bg-gray-200 data-[active=true]:data-[hover=true]:bg-gray-300',
|
|
33
|
-
}),
|
|
34
|
-
'data-[state=open]:border-blue-500',
|
|
35
|
-
'data-[invalid=true]:border-red-500 data-[invalid=true]:border',
|
|
36
|
-
'data-[readonly=true]:bg-gray-200',
|
|
37
|
-
],
|
|
38
|
-
ghost: [
|
|
39
|
-
'bg-transparent border border-transparent',
|
|
40
|
-
Platform.select({
|
|
41
|
-
default: 'data-[active=true]:bg-gray-100',
|
|
42
|
-
web: 'data-[hover=true]:bg-gray-50 data-[active=true]:data-[hover=true]:bg-gray-100',
|
|
43
|
-
}),
|
|
44
|
-
'data-[invalid=true]:border-red-500 data-[invalid=true]:border',
|
|
45
|
-
],
|
|
46
|
+
outline: [],
|
|
46
47
|
},
|
|
47
48
|
size: {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
lg: 'h-12 px-4 gap-2.5',
|
|
49
|
+
default: `${SIZE_SCALE.default.height} ${SIZE_SCALE.default.px} ${SIZE_SCALE.default.gap}`,
|
|
50
|
+
small: `${SIZE_SCALE.small.height} ${SIZE_SCALE.small.px} ${SIZE_SCALE.small.gap}`,
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
53
|
defaultVariants: {
|
|
54
54
|
variant: 'outline',
|
|
55
|
-
size: '
|
|
55
|
+
size: 'default',
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
);
|
|
@@ -60,23 +60,21 @@ export const selectTriggerVariants = cva(
|
|
|
60
60
|
// ── Value ───────────────────────────────────────────────────
|
|
61
61
|
|
|
62
62
|
export const selectValueVariants = cva(
|
|
63
|
-
[
|
|
63
|
+
[
|
|
64
|
+
'min-w-0 flex-1 text-start',
|
|
65
|
+
'data-[placeholder=true]:text-slate-400',
|
|
66
|
+
'data-[invalid=true]:text-red-600',
|
|
67
|
+
COLOR_TEXT_PRIMARY,
|
|
68
|
+
],
|
|
64
69
|
{
|
|
65
70
|
variants: {
|
|
66
|
-
variant: {
|
|
67
|
-
outline: 'text-gray-900',
|
|
68
|
-
filled: 'text-gray-900',
|
|
69
|
-
ghost: 'text-gray-900',
|
|
70
|
-
},
|
|
71
71
|
size: {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
lg: 'text-lg',
|
|
72
|
+
default: SIZE_SCALE.default.text,
|
|
73
|
+
small: SIZE_SCALE.small.text,
|
|
75
74
|
},
|
|
76
75
|
},
|
|
77
76
|
defaultVariants: {
|
|
78
|
-
|
|
79
|
-
size: 'md',
|
|
77
|
+
size: 'default',
|
|
80
78
|
},
|
|
81
79
|
},
|
|
82
80
|
);
|
|
@@ -84,23 +82,20 @@ export const selectValueVariants = cva(
|
|
|
84
82
|
// ── Icon ────────────────────────────────────────────────────
|
|
85
83
|
|
|
86
84
|
export const selectIconVariants = cva(
|
|
87
|
-
[
|
|
85
|
+
[
|
|
86
|
+
'shrink-0 items-center justify-center self-center',
|
|
87
|
+
COLOR_TEXT_MUTED,
|
|
88
|
+
'data-[invalid=true]:text-red-500',
|
|
89
|
+
],
|
|
88
90
|
{
|
|
89
91
|
variants: {
|
|
90
|
-
variant: {
|
|
91
|
-
outline: 'text-gray-500',
|
|
92
|
-
filled: 'text-gray-500',
|
|
93
|
-
ghost: 'text-gray-400',
|
|
94
|
-
},
|
|
95
92
|
size: {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
lg: 'h-6 w-6',
|
|
93
|
+
default: 'h-5 w-5',
|
|
94
|
+
small: 'h-4 w-4',
|
|
99
95
|
},
|
|
100
96
|
},
|
|
101
97
|
defaultVariants: {
|
|
102
|
-
|
|
103
|
-
size: 'md',
|
|
98
|
+
size: 'default',
|
|
104
99
|
},
|
|
105
100
|
},
|
|
106
101
|
);
|
|
@@ -108,12 +103,12 @@ export const selectIconVariants = cva(
|
|
|
108
103
|
// ── Content ─────────────────────────────────────────────────
|
|
109
104
|
|
|
110
105
|
export const selectContentVariants = cva([
|
|
111
|
-
|
|
112
|
-
|
|
106
|
+
COLOR_BG_PRIMARY,
|
|
107
|
+
`border ${COLOR_BORDER_DEFAULT}`,
|
|
113
108
|
'overflow-hidden',
|
|
114
|
-
|
|
109
|
+
RADIUS_MD,
|
|
115
110
|
Platform.select({
|
|
116
|
-
web:
|
|
111
|
+
web: SHADOW_MD,
|
|
117
112
|
default: '',
|
|
118
113
|
}),
|
|
119
114
|
'max-h-60',
|
|
@@ -127,22 +122,21 @@ export const selectItemVariants = cva(
|
|
|
127
122
|
'flex-row items-center',
|
|
128
123
|
'transition-colors duration-100',
|
|
129
124
|
'data-[disabled=true]:opacity-50 data-[disabled=true]:pointer-events-none',
|
|
130
|
-
'data-[state=checked]:bg-
|
|
125
|
+
'data-[state=checked]:bg-slate-50 data-[state=checked]:font-medium',
|
|
131
126
|
Platform.select({
|
|
132
|
-
default: 'data-[active=true]:bg-
|
|
133
|
-
web: 'data-[hover=true]:bg-
|
|
127
|
+
default: 'data-[active=true]:bg-slate-100',
|
|
128
|
+
web: 'data-[hover=true]:bg-slate-50 data-[active=true]:data-[hover=true]:bg-slate-100 data-[highlighted=true]:bg-slate-50',
|
|
134
129
|
}),
|
|
135
130
|
],
|
|
136
131
|
{
|
|
137
132
|
variants: {
|
|
138
133
|
size: {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
lg: 'px-4 py-2.5',
|
|
134
|
+
default: 'px-3 py-2',
|
|
135
|
+
small: 'px-2.5 py-1.5',
|
|
142
136
|
},
|
|
143
137
|
},
|
|
144
138
|
defaultVariants: {
|
|
145
|
-
size: '
|
|
139
|
+
size: 'default',
|
|
146
140
|
},
|
|
147
141
|
},
|
|
148
142
|
);
|
|
@@ -150,17 +144,16 @@ export const selectItemVariants = cva(
|
|
|
150
144
|
// ── ItemLabel ───────────────────────────────────────────────
|
|
151
145
|
|
|
152
146
|
export const selectItemLabelVariants = cva(
|
|
153
|
-
[
|
|
147
|
+
[COLOR_TEXT_PRIMARY, 'data-[state=checked]:font-medium'],
|
|
154
148
|
{
|
|
155
149
|
variants: {
|
|
156
150
|
size: {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
lg: 'text-lg',
|
|
151
|
+
default: SIZE_SCALE.default.text,
|
|
152
|
+
small: SIZE_SCALE.small.text,
|
|
160
153
|
},
|
|
161
154
|
},
|
|
162
155
|
defaultVariants: {
|
|
163
|
-
size: '
|
|
156
|
+
size: 'default',
|
|
164
157
|
},
|
|
165
158
|
},
|
|
166
159
|
);
|
|
@@ -1,21 +1,8 @@
|
|
|
1
1
|
import type { ForwardedRef } from 'react';
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { View, type ViewProps } from 'react-native';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// TODO: Integrate with tokens (multiply by spacing)
|
|
7
|
-
const spaceScale = {
|
|
8
|
-
xs: 1,
|
|
9
|
-
sm: 2,
|
|
10
|
-
md: 3,
|
|
11
|
-
lg: 4,
|
|
12
|
-
xl: 5,
|
|
13
|
-
'2xl': 6,
|
|
14
|
-
'3xl': 7,
|
|
15
|
-
'4xl': 8,
|
|
16
|
-
} as const;
|
|
17
|
-
|
|
18
|
-
type StackSpace = keyof typeof spaceScale;
|
|
4
|
+
import { cn } from '@cdx-ui/utils';
|
|
5
|
+
import { hStackRootVariants, type StackSpace } from './styles';
|
|
19
6
|
|
|
20
7
|
export interface HStackProps extends ViewProps {
|
|
21
8
|
className?: string;
|
|
@@ -24,13 +11,15 @@ export interface HStackProps extends ViewProps {
|
|
|
24
11
|
}
|
|
25
12
|
|
|
26
13
|
export const HStack = forwardRef<View, HStackProps>(
|
|
27
|
-
(
|
|
28
|
-
|
|
14
|
+
(
|
|
15
|
+
{ reversed = false, space, style, className, children, ...restProps },
|
|
16
|
+
ref: ForwardedRef<View>,
|
|
17
|
+
) => {
|
|
29
18
|
return (
|
|
30
19
|
<View
|
|
31
20
|
ref={ref}
|
|
32
|
-
className={className}
|
|
33
|
-
style={
|
|
21
|
+
className={cn(hStackRootVariants({ reversed, space }), className)}
|
|
22
|
+
style={style}
|
|
34
23
|
{...restProps}
|
|
35
24
|
>
|
|
36
25
|
{children}
|
|
@@ -1,21 +1,8 @@
|
|
|
1
1
|
import type { ForwardedRef } from 'react';
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { View, type ViewProps } from 'react-native';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// TODO: Integrate with tokens (multiply by spacing)
|
|
7
|
-
const spaceScale = {
|
|
8
|
-
xs: 1,
|
|
9
|
-
sm: 2,
|
|
10
|
-
md: 3,
|
|
11
|
-
lg: 4,
|
|
12
|
-
xl: 5,
|
|
13
|
-
'2xl': 6,
|
|
14
|
-
'3xl': 7,
|
|
15
|
-
'4xl': 8,
|
|
16
|
-
} as const;
|
|
17
|
-
|
|
18
|
-
type StackSpace = keyof typeof spaceScale;
|
|
4
|
+
import { cn } from '@cdx-ui/utils';
|
|
5
|
+
import { vStackRootVariants, type StackSpace } from './styles';
|
|
19
6
|
|
|
20
7
|
export interface VStackProps extends ViewProps {
|
|
21
8
|
className?: string;
|
|
@@ -24,17 +11,15 @@ export interface VStackProps extends ViewProps {
|
|
|
24
11
|
}
|
|
25
12
|
|
|
26
13
|
export const VStack = forwardRef<View, VStackProps>(
|
|
27
|
-
(
|
|
28
|
-
|
|
14
|
+
(
|
|
15
|
+
{ reversed = false, space, style, className, children, ...restProps },
|
|
16
|
+
ref: ForwardedRef<View>,
|
|
17
|
+
) => {
|
|
29
18
|
return (
|
|
30
19
|
<View
|
|
31
20
|
ref={ref}
|
|
32
|
-
className={className}
|
|
33
|
-
style={
|
|
34
|
-
{ flexDirection: reversed ? 'column-reverse' : 'column' },
|
|
35
|
-
gap ? { gap } : null,
|
|
36
|
-
style,
|
|
37
|
-
]}
|
|
21
|
+
className={cn(vStackRootVariants({ reversed, space }), className)}
|
|
22
|
+
style={style}
|
|
38
23
|
{...restProps}
|
|
39
24
|
>
|
|
40
25
|
{children}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { cva } from 'class-variance-authority';
|
|
2
|
+
|
|
3
|
+
const spaceMap = {
|
|
4
|
+
xs: 'gap-1',
|
|
5
|
+
sm: 'gap-2',
|
|
6
|
+
md: 'gap-3',
|
|
7
|
+
lg: 'gap-4',
|
|
8
|
+
xl: 'gap-5',
|
|
9
|
+
'2xl': 'gap-6',
|
|
10
|
+
'3xl': 'gap-7',
|
|
11
|
+
'4xl': 'gap-8',
|
|
12
|
+
'5xl': 'gap-9',
|
|
13
|
+
'6xl': 'gap-10',
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
export type StackSpace = keyof typeof spaceMap;
|
|
17
|
+
|
|
18
|
+
export const hStackRootVariants = cva([], {
|
|
19
|
+
variants: {
|
|
20
|
+
reversed: {
|
|
21
|
+
true: 'flex-row-reverse',
|
|
22
|
+
false: 'flex-row',
|
|
23
|
+
},
|
|
24
|
+
space: spaceMap,
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
reversed: false,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const vStackRootVariants = cva([], {
|
|
32
|
+
variants: {
|
|
33
|
+
reversed: {
|
|
34
|
+
true: 'flex-col-reverse',
|
|
35
|
+
false: 'flex-col',
|
|
36
|
+
},
|
|
37
|
+
space: spaceMap,
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
reversed: false,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { Switch as RNSwitch, type SwitchProps } from 'react-native';
|
|
3
|
+
import { cn } from '@cdx-ui/utils';
|
|
4
|
+
import {
|
|
5
|
+
switchIosBgVariants,
|
|
6
|
+
switchThumbColorVariants,
|
|
7
|
+
switchTrackOffVariants,
|
|
8
|
+
switchTrackOnVariants,
|
|
9
|
+
} from './styles';
|
|
10
|
+
|
|
11
|
+
export interface BaseSwitchProps extends Omit<SwitchProps, 'className'> {
|
|
12
|
+
states?: Record<string, boolean | undefined>;
|
|
13
|
+
dataSet?: Record<string, string>;
|
|
14
|
+
className?: string;
|
|
15
|
+
size?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const BaseSwitch = forwardRef<RNSwitch, BaseSwitchProps>(
|
|
19
|
+
({ states, className, disabled, value, ...props }, ref) => {
|
|
20
|
+
const isChecked = value ?? states?.checked ?? false;
|
|
21
|
+
const isDisabled = disabled ?? states?.disabled ?? false;
|
|
22
|
+
const isInvalid = states?.invalid ?? false;
|
|
23
|
+
|
|
24
|
+
const uniwindProps: Record<string, string | undefined> = {
|
|
25
|
+
className,
|
|
26
|
+
thumbColorClassName: cn(switchThumbColorVariants({ isDisabled })),
|
|
27
|
+
trackColorOnClassName: cn(switchTrackOnVariants({ isInvalid })),
|
|
28
|
+
trackColorOffClassName: cn(switchTrackOffVariants({ isInvalid })),
|
|
29
|
+
ios_backgroundColorClassName: cn(switchIosBgVariants({ isInvalid })),
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<RNSwitch ref={ref} value={isChecked} disabled={isDisabled} {...uniwindProps} {...props} />
|
|
34
|
+
);
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
BaseSwitch.displayName = 'BaseSwitch';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { Pressable, View } from 'react-native';
|
|
3
|
+
import { cn } from '@cdx-ui/utils';
|
|
4
|
+
import {
|
|
5
|
+
switchThumbVariants,
|
|
6
|
+
switchTrackVariants,
|
|
7
|
+
switchWebTrackColorVariants,
|
|
8
|
+
type SwitchVariantProps,
|
|
9
|
+
} from './styles';
|
|
10
|
+
|
|
11
|
+
export interface BaseSwitchProps {
|
|
12
|
+
value?: boolean;
|
|
13
|
+
onValueChange?: (value: boolean) => void;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
states?: Record<string, boolean | undefined>;
|
|
16
|
+
dataSet?: Record<string, string>;
|
|
17
|
+
className?: string;
|
|
18
|
+
size?: SwitchVariantProps['size'];
|
|
19
|
+
onFocus?: () => void;
|
|
20
|
+
onBlur?: () => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const BaseSwitch = forwardRef<View, BaseSwitchProps>(
|
|
24
|
+
(
|
|
25
|
+
{
|
|
26
|
+
value,
|
|
27
|
+
onValueChange,
|
|
28
|
+
disabled,
|
|
29
|
+
states,
|
|
30
|
+
dataSet,
|
|
31
|
+
className,
|
|
32
|
+
size = 'md',
|
|
33
|
+
onFocus,
|
|
34
|
+
onBlur,
|
|
35
|
+
...props
|
|
36
|
+
},
|
|
37
|
+
ref,
|
|
38
|
+
) => {
|
|
39
|
+
const isChecked = value ?? states?.checked ?? false;
|
|
40
|
+
const isDisabled = disabled ?? states?.disabled ?? false;
|
|
41
|
+
const isInvalid = states?.invalid ?? false;
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Pressable
|
|
45
|
+
ref={ref}
|
|
46
|
+
role="switch"
|
|
47
|
+
aria-checked={isChecked}
|
|
48
|
+
aria-disabled={isDisabled}
|
|
49
|
+
disabled={isDisabled}
|
|
50
|
+
onPress={() => onValueChange?.(!isChecked)}
|
|
51
|
+
onFocus={onFocus}
|
|
52
|
+
onBlur={onBlur}
|
|
53
|
+
tabIndex={0}
|
|
54
|
+
className={cn(
|
|
55
|
+
switchTrackVariants({ size }),
|
|
56
|
+
switchWebTrackColorVariants({ isChecked, isInvalid }),
|
|
57
|
+
className,
|
|
58
|
+
)}
|
|
59
|
+
// @ts-expect-error dataSet is a RNW/Uniwind prop not in Pressable types
|
|
60
|
+
dataSet={dataSet}
|
|
61
|
+
{...props}
|
|
62
|
+
>
|
|
63
|
+
<View className={cn(switchThumbVariants({ size, isChecked }))} />
|
|
64
|
+
</Pressable>
|
|
65
|
+
);
|
|
66
|
+
},
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
BaseSwitch.displayName = 'BaseSwitch';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ISwitchProps, createSwitch } from '@cdx-ui/primitives';
|
|
2
|
+
import { BaseSwitch } from './BaseSwitch';
|
|
3
|
+
import type { SwitchVariantProps } from './styles';
|
|
4
|
+
|
|
5
|
+
const SwitchPrimitive = createSwitch({ Root: BaseSwitch });
|
|
6
|
+
|
|
7
|
+
export interface SwitchProps extends ISwitchProps, SwitchVariantProps {
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Switch = SwitchPrimitive;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
|
+
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// NATIVE — Uniwind className bindings for RN Switch
|
|
5
|
+
// =============================================================================
|
|
6
|
+
|
|
7
|
+
export const switchThumbColorVariants = cva(['accent-white'], {
|
|
8
|
+
variants: {
|
|
9
|
+
isDisabled: {
|
|
10
|
+
true: 'accent-gray-200',
|
|
11
|
+
false: '',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: { isDisabled: false },
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const switchTrackOnVariants = cva(['accent-blue-500'], {
|
|
18
|
+
variants: {
|
|
19
|
+
isInvalid: {
|
|
20
|
+
true: 'accent-red-500',
|
|
21
|
+
false: '',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: { isInvalid: false },
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const switchTrackOffVariants = cva(['accent-gray-300'], {
|
|
28
|
+
variants: {
|
|
29
|
+
isInvalid: {
|
|
30
|
+
true: 'accent-red-300',
|
|
31
|
+
false: '',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: { isInvalid: false },
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const switchIosBgVariants = cva(['accent-gray-300'], {
|
|
38
|
+
variants: {
|
|
39
|
+
isInvalid: {
|
|
40
|
+
true: 'accent-red-300',
|
|
41
|
+
false: '',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: { isInvalid: false },
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// =============================================================================
|
|
48
|
+
// WEB — Tailwind classes for custom Pressable toggle
|
|
49
|
+
// =============================================================================
|
|
50
|
+
|
|
51
|
+
export const switchTrackVariants = cva(
|
|
52
|
+
[
|
|
53
|
+
'flex-row items-center rounded-full cursor-pointer',
|
|
54
|
+
'transition-colors duration-200',
|
|
55
|
+
'data-[disabled=true]:opacity-50 data-[disabled=true]:cursor-not-allowed',
|
|
56
|
+
'web:data-[focus-visible=true]:ring-3 web:data-[focus-visible=true]:ring-blue-300/50',
|
|
57
|
+
'web:data-[invalid=true]:data-[focus-visible=true]:ring-red-300/50',
|
|
58
|
+
],
|
|
59
|
+
{
|
|
60
|
+
variants: {
|
|
61
|
+
size: {
|
|
62
|
+
sm: 'w-9 h-5 p-0.5',
|
|
63
|
+
md: 'w-11 h-6 p-0.5',
|
|
64
|
+
lg: 'w-14 h-8 p-1',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
defaultVariants: {
|
|
68
|
+
size: 'md',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
export const switchWebTrackColorVariants = cva([], {
|
|
74
|
+
variants: {
|
|
75
|
+
isChecked: {
|
|
76
|
+
true: 'bg-blue-500 data-[hover=true]:bg-blue-600',
|
|
77
|
+
false: 'bg-gray-300 data-[hover=true]:bg-gray-400',
|
|
78
|
+
},
|
|
79
|
+
isInvalid: {
|
|
80
|
+
true: '',
|
|
81
|
+
false: '',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
compoundVariants: [
|
|
85
|
+
{ isChecked: true, isInvalid: true, className: 'bg-red-500 data-[hover=true]:bg-red-600' },
|
|
86
|
+
{ isChecked: false, isInvalid: true, className: 'bg-red-300 data-[hover=true]:bg-red-400' },
|
|
87
|
+
],
|
|
88
|
+
defaultVariants: {
|
|
89
|
+
isChecked: false,
|
|
90
|
+
isInvalid: false,
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
export const switchThumbVariants = cva(
|
|
95
|
+
['rounded-full bg-white shadow-sm', 'transition-transform duration-200'],
|
|
96
|
+
{
|
|
97
|
+
variants: {
|
|
98
|
+
size: {
|
|
99
|
+
sm: 'w-4 h-4',
|
|
100
|
+
md: 'w-5 h-5',
|
|
101
|
+
lg: 'w-6 h-6',
|
|
102
|
+
},
|
|
103
|
+
isChecked: {
|
|
104
|
+
true: '',
|
|
105
|
+
false: 'translate-x-0',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
compoundVariants: [
|
|
109
|
+
{ size: 'sm', isChecked: true, className: 'translate-x-4' },
|
|
110
|
+
{ size: 'md', isChecked: true, className: 'translate-x-5' },
|
|
111
|
+
{ size: 'lg', isChecked: true, className: 'translate-x-6' },
|
|
112
|
+
],
|
|
113
|
+
defaultVariants: {
|
|
114
|
+
size: 'md',
|
|
115
|
+
isChecked: false,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
export type SwitchVariantProps = VariantProps<typeof switchTrackVariants>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { forwardRef, type ComponentPropsWithoutRef, type ComponentRef } from 'react';
|
|
2
|
+
import { Text as RNText } from 'react-native';
|
|
3
|
+
import { cn } from '@cdx-ui/utils';
|
|
4
|
+
import { textStyle, TextVariantProps } from './styles';
|
|
5
|
+
|
|
6
|
+
export type TextProps = TextVariantProps &
|
|
7
|
+
ComponentPropsWithoutRef<typeof RNText> & { className?: string };
|
|
8
|
+
|
|
9
|
+
export const Text = forwardRef<ComponentRef<typeof RNText>, TextProps>(function Text(
|
|
10
|
+
{ className, size = 'md', ...props },
|
|
11
|
+
ref,
|
|
12
|
+
) {
|
|
13
|
+
return <RNText className={cn(textStyle({ size }), className)} {...props} ref={ref} />;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
Text.displayName = 'Text';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
+
|
|
4
|
+
export const textStyle = cva(
|
|
5
|
+
[
|
|
6
|
+
`text-content-primary font-normal`,
|
|
7
|
+
Platform.select({
|
|
8
|
+
web: 'font-sans my-0 bg-transparent display-inline no-underline',
|
|
9
|
+
default: '',
|
|
10
|
+
}),
|
|
11
|
+
],
|
|
12
|
+
{
|
|
13
|
+
variants: {
|
|
14
|
+
size: {
|
|
15
|
+
xl: 'body-xl',
|
|
16
|
+
lg: 'body-lg',
|
|
17
|
+
md: 'body-md',
|
|
18
|
+
sm: 'body-sm',
|
|
19
|
+
xs: 'body-xs',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export type TextVariantProps = VariantProps<typeof textStyle>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ForwardedRef, ReactElement } from 'react';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { FlashList, type FlashListProps, type FlashListRef } from '@shopify/flash-list';
|
|
4
|
+
|
|
5
|
+
export type VirtualizedListRef = FlashListRef<unknown>;
|
|
6
|
+
export type VirtualizedListProps<T = unknown> = FlashListProps<T>;
|
|
7
|
+
|
|
8
|
+
function VirtualizedListInner<T>(
|
|
9
|
+
props: VirtualizedListProps<T>,
|
|
10
|
+
ref: ForwardedRef<FlashListRef<T>>,
|
|
11
|
+
) {
|
|
12
|
+
return <FlashList ref={ref} role="list" {...props} />;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const VirtualizedList = forwardRef(VirtualizedListInner) as <T>(
|
|
16
|
+
props: VirtualizedListProps<T> & { ref?: ForwardedRef<FlashListRef<T>> },
|
|
17
|
+
) => ReactElement | null;
|
|
18
|
+
|
|
19
|
+
(VirtualizedList as { displayName?: string }).displayName = 'VirtualizedList';
|