@cdx-ui/components 0.0.1-alpha.4 → 0.0.1-alpha.41
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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { TRANSITION_COLORS } from '../../styles/primitives';
|
|
3
|
+
|
|
4
|
+
// TODO: Handle visited state
|
|
5
|
+
|
|
6
|
+
export const linkRootVariants = cva([
|
|
7
|
+
'flex-row items-center gap-1',
|
|
8
|
+
'web:outline-none web:focus:outline-none web:focus-visible:outline-none',
|
|
9
|
+
TRANSITION_COLORS,
|
|
10
|
+
'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-stroke-focus web:data-[focus-visible=true]:ring-offset-2',
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
export const linkLabelVariants = cva([
|
|
14
|
+
'text-content-link',
|
|
15
|
+
'body-md',
|
|
16
|
+
'underline underline-offset-4',
|
|
17
|
+
]);
|
|
18
|
+
|
|
19
|
+
export const linkIconVariants = cva(['text-content-link', 'size-4']);
|
|
20
|
+
|
|
21
|
+
export type LinkVariantProps = VariantProps<typeof linkLabelVariants>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { ComponentProps, ComponentRef, ForwardedRef } from 'react';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import type { View } from 'react-native';
|
|
4
|
+
import { createOtpInput, type IOtpInputRootProps } from '@cdx-ui/primitives';
|
|
5
|
+
import { cn, useStyleContext, withStyleContext } from '@cdx-ui/utils';
|
|
6
|
+
import { HStack } from '../Stack/HStack';
|
|
7
|
+
import { Input, type InputProps } from '../Input';
|
|
8
|
+
import type { InputVariantProps } from '../Input/styles';
|
|
9
|
+
import {
|
|
10
|
+
otpCellVariants,
|
|
11
|
+
otpFieldVariants,
|
|
12
|
+
otpRootVariants,
|
|
13
|
+
type OtpInputVariantProps,
|
|
14
|
+
} from './styles';
|
|
15
|
+
|
|
16
|
+
const SCOPE = 'OTP_INPUT';
|
|
17
|
+
|
|
18
|
+
const OtpRoot = withStyleContext(HStack, SCOPE);
|
|
19
|
+
|
|
20
|
+
const useOtpInputStyleContext = () => useStyleContext(SCOPE) as InputVariantProps;
|
|
21
|
+
|
|
22
|
+
const OtpStyledCell = forwardRef<View, InputProps>(
|
|
23
|
+
({ className, children, ...props }, ref: ForwardedRef<View>) => {
|
|
24
|
+
const { size, variant } = useOtpInputStyleContext();
|
|
25
|
+
return (
|
|
26
|
+
<Input
|
|
27
|
+
ref={ref}
|
|
28
|
+
variant={variant}
|
|
29
|
+
size={size}
|
|
30
|
+
className={cn(otpCellVariants({ size }), className)}
|
|
31
|
+
{...props}
|
|
32
|
+
>
|
|
33
|
+
{children}
|
|
34
|
+
</Input>
|
|
35
|
+
);
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
OtpStyledCell.displayName = 'OtpInput.Cell';
|
|
40
|
+
|
|
41
|
+
const OtpStyledField = forwardRef<
|
|
42
|
+
ComponentRef<typeof Input.Field>,
|
|
43
|
+
ComponentProps<typeof Input.Field>
|
|
44
|
+
>(({ className, ...props }, ref) => {
|
|
45
|
+
const { size } = useOtpInputStyleContext();
|
|
46
|
+
return <Input.Field ref={ref} className={cn(otpFieldVariants({ size }), className)} {...props} />;
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
OtpStyledField.displayName = 'OtpInput.Field';
|
|
50
|
+
|
|
51
|
+
const OtpPrimitive = createOtpInput({
|
|
52
|
+
Root: OtpRoot,
|
|
53
|
+
Cell: OtpStyledCell,
|
|
54
|
+
Field: OtpStyledField,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export interface OtpInputProps extends Omit<IOtpInputRootProps, 'size'>, OtpInputVariantProps {
|
|
58
|
+
variant?: NonNullable<InputProps['variant']>;
|
|
59
|
+
size?: NonNullable<InputProps['size']>;
|
|
60
|
+
className?: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const OtpInput = forwardRef<View, OtpInputProps>(
|
|
64
|
+
({ variant = 'outline', size = 'default', fullWidth = true, className, style, ...rest }, ref) => {
|
|
65
|
+
const rootClassName = cn(otpRootVariants({ size, fullWidth }), className);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<OtpPrimitive
|
|
69
|
+
ref={ref}
|
|
70
|
+
className={rootClassName}
|
|
71
|
+
style={style}
|
|
72
|
+
context={{ variant, size }}
|
|
73
|
+
{...rest}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
},
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
OtpInput.displayName = 'OtpInput';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
|
+
|
|
3
|
+
export const otpRootVariants = cva('flex-row items-stretch gap-2.5', {
|
|
4
|
+
variants: {
|
|
5
|
+
size: {
|
|
6
|
+
default: '',
|
|
7
|
+
small: '',
|
|
8
|
+
},
|
|
9
|
+
fullWidth: {
|
|
10
|
+
true: 'w-full self-stretch justify-center',
|
|
11
|
+
false: 'self-start',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
size: 'default',
|
|
16
|
+
fullWidth: true,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
/** Narrow cell chrome: overrides Input root `w-full` / wide horizontal padding for one digit. */
|
|
21
|
+
export const otpCellVariants = cva('shrink-0 justify-center', {
|
|
22
|
+
variants: {
|
|
23
|
+
size: {
|
|
24
|
+
default: 'w-12 min-w-12 max-w-12 px-1',
|
|
25
|
+
small: 'w-10 min-w-10 max-w-10 px-0.5',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
size: 'default',
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const otpFieldVariants = cva('min-w-0 w-full text-center tabular-nums', {
|
|
34
|
+
variants: {
|
|
35
|
+
size: {
|
|
36
|
+
default: 'text-xl leading-6',
|
|
37
|
+
small: 'text-base leading-5',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
defaultVariants: {
|
|
41
|
+
size: 'default',
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export type OtpInputVariantProps = VariantProps<typeof otpRootVariants>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { View, type ViewProps } from 'react-native';
|
|
3
|
+
import { createProgress, type IProgressProps } from '@cdx-ui/primitives';
|
|
4
|
+
import { cn } from '@cdx-ui/utils';
|
|
5
|
+
import {
|
|
6
|
+
progressBarIndicatorVariants,
|
|
7
|
+
progressBarTrackVariants,
|
|
8
|
+
type ProgressBarTrackVariantProps,
|
|
9
|
+
} from './styles';
|
|
10
|
+
|
|
11
|
+
const ProgressPrimitive = createProgress({
|
|
12
|
+
Root: View,
|
|
13
|
+
Indicator: View,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export interface ProgressBarProps extends IProgressProps, ProgressBarTrackVariantProps {
|
|
17
|
+
readonly className?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ProgressBarIndicatorProps extends ViewProps {
|
|
21
|
+
readonly className?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const ProgressBarRoot = forwardRef<View, ProgressBarProps>(
|
|
25
|
+
({ className, style, ...props }, ref) => {
|
|
26
|
+
const trackClass = cn(progressBarTrackVariants(), className);
|
|
27
|
+
|
|
28
|
+
return <ProgressPrimitive ref={ref} className={trackClass} style={style} {...props} />;
|
|
29
|
+
},
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
ProgressBarRoot.displayName = 'ProgressBar';
|
|
33
|
+
|
|
34
|
+
const ProgressBarIndicator = forwardRef<View, ProgressBarIndicatorProps>(
|
|
35
|
+
({ className, style, ...props }, ref) => (
|
|
36
|
+
<ProgressPrimitive.Indicator
|
|
37
|
+
ref={ref}
|
|
38
|
+
className={cn(progressBarIndicatorVariants(), className)}
|
|
39
|
+
style={style}
|
|
40
|
+
{...props}
|
|
41
|
+
/>
|
|
42
|
+
),
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
ProgressBarIndicator.displayName = 'ProgressBar.Indicator';
|
|
46
|
+
|
|
47
|
+
type ProgressBarCompoundComponent = typeof ProgressBarRoot & {
|
|
48
|
+
Indicator: typeof ProgressBarIndicator;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const ProgressBar = Object.assign(ProgressBarRoot, {
|
|
52
|
+
Indicator: ProgressBarIndicator,
|
|
53
|
+
}) as ProgressBarCompoundComponent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
|
+
|
|
3
|
+
export const progressBarTrackVariants = cva([
|
|
4
|
+
'w-full flex-row overflow-hidden rounded-full bg-surface-action-tint h-1',
|
|
5
|
+
]);
|
|
6
|
+
|
|
7
|
+
export const progressBarIndicatorVariants = cva(['rounded-full bg-surface-action-strong']);
|
|
8
|
+
|
|
9
|
+
export type ProgressBarTrackVariantProps = VariantProps<typeof progressBarTrackVariants>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { forwardRef, useMemo } from 'react';
|
|
2
|
+
import { View, type ViewProps } from 'react-native';
|
|
3
|
+
import { cn } from '@cdx-ui/utils';
|
|
4
|
+
import {
|
|
5
|
+
progressSegmentedVariants,
|
|
6
|
+
segmentVariants,
|
|
7
|
+
type ProgressSegmentedVariants,
|
|
8
|
+
} from './styles';
|
|
9
|
+
|
|
10
|
+
export interface ProgressSegmentedProps extends ViewProps, ProgressSegmentedVariants {
|
|
11
|
+
/** Current step (1-based index into the segment count) */
|
|
12
|
+
readonly step: number;
|
|
13
|
+
/** Total number of segments */
|
|
14
|
+
readonly total?: number;
|
|
15
|
+
/** When true, the current step segment is marked as complete rather than in-progress */
|
|
16
|
+
readonly isStepComplete?: boolean;
|
|
17
|
+
/** Returns the accessibility value text announced by screen readers. Receives the clamped step, total, and whether the step is complete. */
|
|
18
|
+
readonly getAccessibilityText?: (step: number, total: number, isStepComplete: boolean) => string;
|
|
19
|
+
readonly className?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const ProgressSegmented = forwardRef<View, ProgressSegmentedProps>(
|
|
23
|
+
(
|
|
24
|
+
{
|
|
25
|
+
step,
|
|
26
|
+
total = 5,
|
|
27
|
+
isStepComplete = false,
|
|
28
|
+
getAccessibilityText,
|
|
29
|
+
className,
|
|
30
|
+
accessibilityLabel = 'Progress',
|
|
31
|
+
...props
|
|
32
|
+
},
|
|
33
|
+
ref,
|
|
34
|
+
) => {
|
|
35
|
+
const clampedStep = Math.max(0, Math.min(step, total));
|
|
36
|
+
|
|
37
|
+
const segments = useMemo(() => {
|
|
38
|
+
return Array.from({ length: total }, (_, index) => {
|
|
39
|
+
const segmentIndex = index + 1;
|
|
40
|
+
let state: 'complete' | 'incomplete' | 'inprogress' = 'incomplete';
|
|
41
|
+
|
|
42
|
+
if (segmentIndex < clampedStep || (isStepComplete && segmentIndex === clampedStep)) {
|
|
43
|
+
state = 'complete';
|
|
44
|
+
} else if (segmentIndex === clampedStep) {
|
|
45
|
+
state = 'inprogress';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return state;
|
|
49
|
+
});
|
|
50
|
+
}, [total, clampedStep, isStepComplete]);
|
|
51
|
+
|
|
52
|
+
let accessibilityText = `Step ${String(clampedStep)} of ${String(total)}`;
|
|
53
|
+
if (getAccessibilityText) {
|
|
54
|
+
accessibilityText = getAccessibilityText(clampedStep, total, isStepComplete);
|
|
55
|
+
} else if (isStepComplete) {
|
|
56
|
+
accessibilityText = `Step ${String(clampedStep)} of ${String(total)}, completed`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<View
|
|
61
|
+
ref={ref}
|
|
62
|
+
accessibilityRole="progressbar"
|
|
63
|
+
accessibilityLabel={accessibilityLabel}
|
|
64
|
+
accessibilityValue={{
|
|
65
|
+
min: 0,
|
|
66
|
+
max: total,
|
|
67
|
+
now: clampedStep,
|
|
68
|
+
text: accessibilityText,
|
|
69
|
+
}}
|
|
70
|
+
className={cn(progressSegmentedVariants(), className)}
|
|
71
|
+
{...props}
|
|
72
|
+
>
|
|
73
|
+
{segments.map((state, index) => (
|
|
74
|
+
<View key={index} className={cn(segmentVariants({ state }))} />
|
|
75
|
+
))}
|
|
76
|
+
</View>
|
|
77
|
+
);
|
|
78
|
+
},
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
ProgressSegmented.displayName = 'ProgressSegmented';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
|
+
|
|
3
|
+
export const progressSegmentedVariants = cva(['flex-row gap-1 w-full rounded overflow-hidden']);
|
|
4
|
+
|
|
5
|
+
export const segmentVariants = cva(['flex-1 h-1'], {
|
|
6
|
+
variants: {
|
|
7
|
+
state: {
|
|
8
|
+
complete: 'bg-surface-action-strong',
|
|
9
|
+
incomplete: 'bg-surface-action-tint',
|
|
10
|
+
inprogress:
|
|
11
|
+
'bg-gradient-to-r from-surface-action-strong from-50% to-surface-action-tint to-50%',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
state: 'incomplete',
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type ProgressSegmentedVariants = VariantProps<typeof progressSegmentedVariants>;
|
|
20
|
+
export type SegmentVariants = VariantProps<typeof segmentVariants>;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import type { PressableProps } from 'react-native';
|
|
4
|
+
|
|
5
|
+
export type SelectTriggerHostProps = PressableProps & { className?: string };
|
|
6
|
+
|
|
7
|
+
/** Props that must not be forwarded to a DOM `<button>`. */
|
|
8
|
+
const OMIT = new Set<string>([
|
|
9
|
+
'hitSlop',
|
|
10
|
+
'pressRetentionOffset',
|
|
11
|
+
'android_ripple',
|
|
12
|
+
'android_disableSound',
|
|
13
|
+
'unstable_pressDelay',
|
|
14
|
+
'onLongPress',
|
|
15
|
+
'delayLongPress',
|
|
16
|
+
'onPress',
|
|
17
|
+
'onPressIn',
|
|
18
|
+
'onPressOut',
|
|
19
|
+
'onHoverIn',
|
|
20
|
+
'onHoverOut',
|
|
21
|
+
'disabled',
|
|
22
|
+
'style',
|
|
23
|
+
'className',
|
|
24
|
+
'testID',
|
|
25
|
+
'children',
|
|
26
|
+
'accessible',
|
|
27
|
+
'accessibilityActions',
|
|
28
|
+
'accessibilityElementsHidden',
|
|
29
|
+
'accessibilityHint',
|
|
30
|
+
'accessibilityIgnoresInvertColors',
|
|
31
|
+
'accessibilityLabel',
|
|
32
|
+
'accessibilityLabelledBy',
|
|
33
|
+
'accessibilityLiveRegion',
|
|
34
|
+
'accessibilityRole',
|
|
35
|
+
'accessibilityState',
|
|
36
|
+
'accessibilityValue',
|
|
37
|
+
'accessibilityViewIsModal',
|
|
38
|
+
'importantForAccessibility',
|
|
39
|
+
'needsOffscreenAlphaCompositing',
|
|
40
|
+
'collapsable',
|
|
41
|
+
'shouldRasterizeIOS',
|
|
42
|
+
'removeClippedSubviews',
|
|
43
|
+
'onAccessibilityAction',
|
|
44
|
+
'onAccessibilityEscape',
|
|
45
|
+
'onAccessibilityTap',
|
|
46
|
+
]);
|
|
47
|
+
|
|
48
|
+
function resolveChildren(children: PressableProps['children']): React.ReactNode {
|
|
49
|
+
if (typeof children === 'function') {
|
|
50
|
+
return children({ pressed: false });
|
|
51
|
+
}
|
|
52
|
+
return children;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function filterDomProps(rest: object): React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
56
|
+
const entries = Object.entries(rest).filter(([key]) => !OMIT.has(key));
|
|
57
|
+
return Object.fromEntries(entries) as React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** UA `<button>` defaults (centered text, inline sizing) fight our flex + `justify-between` layout. */
|
|
61
|
+
const webButtonLayoutStyle: React.CSSProperties = {
|
|
62
|
+
display: 'flex',
|
|
63
|
+
flexDirection: 'row',
|
|
64
|
+
alignItems: 'center',
|
|
65
|
+
justifyContent: 'space-between',
|
|
66
|
+
width: '100%',
|
|
67
|
+
minWidth: 0,
|
|
68
|
+
textAlign: 'start',
|
|
69
|
+
boxSizing: 'border-box',
|
|
70
|
+
margin: 0,
|
|
71
|
+
font: 'inherit',
|
|
72
|
+
lineHeight: 'normal',
|
|
73
|
+
WebkitAppearance: 'none',
|
|
74
|
+
appearance: 'none',
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Native `<button type="button">` so the trigger is HTML-labelable (`<label htmlFor>` focuses it).
|
|
79
|
+
* `Pressable` on web is a non-labelable div; no extra refs are needed for label association.
|
|
80
|
+
*/
|
|
81
|
+
export const SelectTriggerHost = forwardRef<HTMLButtonElement, SelectTriggerHostProps>(
|
|
82
|
+
function SelectTriggerHost(props, ref) {
|
|
83
|
+
const {
|
|
84
|
+
children,
|
|
85
|
+
onPress,
|
|
86
|
+
onPressIn,
|
|
87
|
+
onPressOut,
|
|
88
|
+
onHoverIn,
|
|
89
|
+
onHoverOut,
|
|
90
|
+
disabled,
|
|
91
|
+
style,
|
|
92
|
+
className,
|
|
93
|
+
testID,
|
|
94
|
+
...rest
|
|
95
|
+
} = props;
|
|
96
|
+
|
|
97
|
+
const domProps = filterDomProps(rest);
|
|
98
|
+
const flattened = StyleSheet.flatten(style) as React.CSSProperties | undefined;
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<button
|
|
102
|
+
ref={ref}
|
|
103
|
+
{...domProps}
|
|
104
|
+
type="button"
|
|
105
|
+
disabled={!!disabled}
|
|
106
|
+
className={typeof className === 'string' ? className : undefined}
|
|
107
|
+
style={{ ...webButtonLayoutStyle, ...(flattened ?? {}) }}
|
|
108
|
+
data-testid={testID}
|
|
109
|
+
onClick={(e) => {
|
|
110
|
+
if (!disabled) {
|
|
111
|
+
onPress?.(e as unknown as Parameters<NonNullable<PressableProps['onPress']>>[0]);
|
|
112
|
+
}
|
|
113
|
+
}}
|
|
114
|
+
onPointerDown={(e) => {
|
|
115
|
+
onPressIn?.(e as unknown as Parameters<NonNullable<PressableProps['onPressIn']>>[0]);
|
|
116
|
+
}}
|
|
117
|
+
onPointerUp={(e) => {
|
|
118
|
+
onPressOut?.(e as unknown as Parameters<NonNullable<PressableProps['onPressOut']>>[0]);
|
|
119
|
+
}}
|
|
120
|
+
onPointerCancel={(e) => {
|
|
121
|
+
onPressOut?.(e as unknown as Parameters<NonNullable<PressableProps['onPressOut']>>[0]);
|
|
122
|
+
}}
|
|
123
|
+
onMouseEnter={(e) => {
|
|
124
|
+
onHoverIn?.(e as unknown as Parameters<NonNullable<PressableProps['onHoverIn']>>[0]);
|
|
125
|
+
}}
|
|
126
|
+
onMouseLeave={(e) => {
|
|
127
|
+
onHoverOut?.(e as unknown as Parameters<NonNullable<PressableProps['onHoverOut']>>[0]);
|
|
128
|
+
}}
|
|
129
|
+
>
|
|
130
|
+
{resolveChildren(children)}
|
|
131
|
+
</button>
|
|
132
|
+
);
|
|
133
|
+
},
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
SelectTriggerHost.displayName = 'SelectTriggerHost';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { forwardRef, type ReactNode } from 'react';
|
|
2
2
|
import { Pressable, Text, type TextProps, View, type ViewProps } from 'react-native';
|
|
3
|
+
import { ArrowDropDown } from '@cdx-ui/icons';
|
|
3
4
|
import {
|
|
4
5
|
createSelect,
|
|
5
6
|
type ISelectContentProps,
|
|
@@ -10,6 +11,8 @@ import {
|
|
|
10
11
|
type ISelectValueProps,
|
|
11
12
|
} from '@cdx-ui/primitives';
|
|
12
13
|
import { cn, useStyleContext, withStyleContext } from '@cdx-ui/utils';
|
|
14
|
+
import { Icon, IconProps } from '../Icon';
|
|
15
|
+
import { SelectTriggerHost } from './SelectTriggerHost';
|
|
13
16
|
import {
|
|
14
17
|
type SelectVariantProps,
|
|
15
18
|
selectContentVariants,
|
|
@@ -28,7 +31,7 @@ const useSelectStyleContext = () => useStyleContext(SCOPE) as SelectVariantProps
|
|
|
28
31
|
|
|
29
32
|
const SelectPrimitive = createSelect({
|
|
30
33
|
Root,
|
|
31
|
-
Trigger:
|
|
34
|
+
Trigger: SelectTriggerHost,
|
|
32
35
|
Value: Text,
|
|
33
36
|
Icon: View,
|
|
34
37
|
Content: View,
|
|
@@ -45,7 +48,7 @@ export interface SelectProps extends ViewProps, ISelectProps, SelectVariantProps
|
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
const SelectRoot = forwardRef<View, SelectProps>(
|
|
48
|
-
({ variant = 'outline', size = '
|
|
51
|
+
({ variant = 'outline', size = 'default', className, children, style, ...props }, ref) => {
|
|
49
52
|
return (
|
|
50
53
|
<SelectPrimitive
|
|
51
54
|
ref={ref}
|
|
@@ -80,6 +83,7 @@ const SelectTrigger = forwardRef<View, SelectTriggerProps>(
|
|
|
80
83
|
return (
|
|
81
84
|
<SelectPrimitive.Trigger ref={ref} className={computedClassName} style={style} {...props}>
|
|
82
85
|
{children}
|
|
86
|
+
<SelectIcon as={ArrowDropDown} />
|
|
83
87
|
</SelectPrimitive.Trigger>
|
|
84
88
|
);
|
|
85
89
|
},
|
|
@@ -96,9 +100,9 @@ export interface SelectValueProps extends TextProps, ISelectValueProps {
|
|
|
96
100
|
}
|
|
97
101
|
|
|
98
102
|
const SelectValue = forwardRef<Text, SelectValueProps>(({ className, style, ...props }, ref) => {
|
|
99
|
-
const {
|
|
103
|
+
const { size } = useSelectStyleContext();
|
|
100
104
|
|
|
101
|
-
const computedClassName = cn(selectValueVariants({
|
|
105
|
+
const computedClassName = cn(selectValueVariants({ size }), className);
|
|
102
106
|
|
|
103
107
|
return <SelectPrimitive.Value ref={ref} className={computedClassName} style={style} {...props} />;
|
|
104
108
|
});
|
|
@@ -109,17 +113,15 @@ SelectValue.displayName = 'Select.Value';
|
|
|
109
113
|
// STYLED ICON COMPONENT
|
|
110
114
|
// =============================================================================
|
|
111
115
|
|
|
112
|
-
export interface SelectIconProps extends
|
|
113
|
-
className?: string;
|
|
114
|
-
}
|
|
116
|
+
export interface SelectIconProps extends Omit<IconProps, 'children'> {}
|
|
115
117
|
|
|
116
|
-
const SelectIcon =
|
|
117
|
-
const {
|
|
118
|
+
const SelectIcon = ({ className, style, ...props }: SelectIconProps) => {
|
|
119
|
+
const { size } = useSelectStyleContext();
|
|
118
120
|
|
|
119
|
-
const computedClassName = cn(selectIconVariants({
|
|
121
|
+
const computedClassName = cn(selectIconVariants({ size }), className);
|
|
120
122
|
|
|
121
|
-
return <
|
|
122
|
-
}
|
|
123
|
+
return <Icon className={computedClassName} style={style} {...props} />;
|
|
124
|
+
};
|
|
123
125
|
|
|
124
126
|
SelectIcon.displayName = 'Select.Icon';
|
|
125
127
|
|
|
@@ -211,5 +213,3 @@ export const Select = Object.assign(SelectRoot, {
|
|
|
211
213
|
Item: SelectItem,
|
|
212
214
|
ItemLabel: SelectItemLabel,
|
|
213
215
|
}) as SelectCompoundComponent;
|
|
214
|
-
|
|
215
|
-
export type { SelectVariantProps } from './styles';
|