@oxyhq/bloom 0.6.24 → 0.7.1
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/lib/commonjs/alert-dialog/AlertDialog.js +109 -0
- package/lib/commonjs/alert-dialog/AlertDialog.js.map +1 -0
- package/lib/commonjs/alert-dialog/AlertDialogHost.js +50 -0
- package/lib/commonjs/alert-dialog/AlertDialogHost.js.map +1 -0
- package/lib/commonjs/alert-dialog/confirm-store.js +80 -0
- package/lib/commonjs/alert-dialog/confirm-store.js.map +1 -0
- package/lib/commonjs/alert-dialog/index.js +19 -0
- package/lib/commonjs/alert-dialog/index.js.map +1 -0
- package/lib/commonjs/alert-dialog/index.web.js +19 -0
- package/lib/commonjs/alert-dialog/index.web.js.map +1 -0
- package/lib/commonjs/alert-dialog/types.js +6 -0
- package/lib/commonjs/alert-dialog/types.js.map +1 -0
- package/lib/commonjs/combobox/Combobox.js +227 -0
- package/lib/commonjs/combobox/Combobox.js.map +1 -0
- package/lib/commonjs/combobox/index.js +11 -0
- package/lib/commonjs/combobox/index.js.map +1 -0
- package/lib/commonjs/combobox/index.web.js +11 -0
- package/lib/commonjs/combobox/index.web.js.map +1 -0
- package/lib/commonjs/combobox/types.js +6 -0
- package/lib/commonjs/combobox/types.js.map +1 -0
- package/lib/commonjs/command/Command.js +256 -0
- package/lib/commonjs/command/Command.js.map +1 -0
- package/lib/commonjs/command/index.js +10 -0
- package/lib/commonjs/command/index.js.map +1 -0
- package/lib/commonjs/command/index.web.js +10 -0
- package/lib/commonjs/command/index.web.js.map +1 -0
- package/lib/commonjs/command/types.js +6 -0
- package/lib/commonjs/command/types.js.map +1 -0
- package/lib/commonjs/field/Field.js +68 -0
- package/lib/commonjs/field/Field.js.map +1 -0
- package/lib/commonjs/field/index.js +13 -0
- package/lib/commonjs/field/index.js.map +1 -0
- package/lib/commonjs/field/types.js +6 -0
- package/lib/commonjs/field/types.js.map +1 -0
- package/lib/commonjs/index.js +117 -25
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +117 -25
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/input-group/InputGroup.js +172 -0
- package/lib/commonjs/input-group/InputGroup.js.map +1 -0
- package/lib/commonjs/input-group/index.js +19 -0
- package/lib/commonjs/input-group/index.js.map +1 -0
- package/lib/commonjs/input-group/types.js +6 -0
- package/lib/commonjs/input-group/types.js.map +1 -0
- package/lib/commonjs/item/Item.js +172 -0
- package/lib/commonjs/item/Item.js.map +1 -0
- package/lib/commonjs/item/index.js +13 -0
- package/lib/commonjs/item/index.js.map +1 -0
- package/lib/commonjs/item/types.js +6 -0
- package/lib/commonjs/item/types.js.map +1 -0
- package/lib/commonjs/kbd/Kbd.js +79 -0
- package/lib/commonjs/kbd/Kbd.js.map +1 -0
- package/lib/commonjs/kbd/index.js +13 -0
- package/lib/commonjs/kbd/index.js.map +1 -0
- package/lib/commonjs/kbd/types.js +6 -0
- package/lib/commonjs/kbd/types.js.map +1 -0
- package/lib/commonjs/label/Label.js +60 -0
- package/lib/commonjs/label/Label.js.map +1 -0
- package/lib/commonjs/label/index.js +13 -0
- package/lib/commonjs/label/index.js.map +1 -0
- package/lib/commonjs/label/types.js +6 -0
- package/lib/commonjs/label/types.js.map +1 -0
- package/lib/commonjs/popover/context.js +18 -0
- package/lib/commonjs/popover/context.js.map +1 -0
- package/lib/commonjs/popover/index.js +111 -0
- package/lib/commonjs/popover/index.js.map +1 -0
- package/lib/commonjs/popover/index.web.js +286 -0
- package/lib/commonjs/popover/index.web.js.map +1 -0
- package/lib/commonjs/popover/types.js +6 -0
- package/lib/commonjs/popover/types.js.map +1 -0
- package/lib/commonjs/react-native-css.d.js +2 -0
- package/lib/commonjs/react-native-css.d.js.map +1 -0
- package/lib/commonjs/slider/Slider.js +255 -0
- package/lib/commonjs/slider/Slider.js.map +1 -0
- package/lib/commonjs/slider/index.js +13 -0
- package/lib/commonjs/slider/index.js.map +1 -0
- package/lib/commonjs/slider/types.js +6 -0
- package/lib/commonjs/slider/types.js.map +1 -0
- package/lib/commonjs/theme/BloomThemeProvider.js +39 -7
- package/lib/commonjs/theme/BloomThemeProvider.js.map +1 -1
- package/lib/commonjs/theme/color-presets.js +118 -118
- package/lib/commonjs/theme/color-presets.js.map +1 -1
- package/lib/commonjs/theme/color-scope/index.js +28 -6
- package/lib/commonjs/theme/color-scope/index.js.map +1 -1
- package/lib/commonjs/theme/color-scope/style-builder.js +35 -0
- package/lib/commonjs/theme/color-scope/style-builder.js.map +1 -1
- package/lib/commonjs/theme/native-root-vars.js +105 -0
- package/lib/commonjs/theme/native-root-vars.js.map +1 -0
- package/lib/commonjs/theme/native-root-vars.web.js +27 -0
- package/lib/commonjs/theme/native-root-vars.web.js.map +1 -0
- package/lib/commonjs/theme/preset-vars.js +4 -1
- package/lib/commonjs/theme/preset-vars.js.map +1 -1
- package/lib/module/alert-dialog/AlertDialog.js +104 -0
- package/lib/module/alert-dialog/AlertDialog.js.map +1 -0
- package/lib/module/alert-dialog/AlertDialogHost.js +45 -0
- package/lib/module/alert-dialog/AlertDialogHost.js.map +1 -0
- package/lib/module/alert-dialog/confirm-store.js +73 -0
- package/lib/module/alert-dialog/confirm-store.js.map +1 -0
- package/lib/module/alert-dialog/index.js +9 -0
- package/lib/module/alert-dialog/index.js.map +1 -0
- package/lib/module/alert-dialog/index.web.js +9 -0
- package/lib/module/alert-dialog/index.web.js.map +1 -0
- package/lib/module/alert-dialog/types.js +4 -0
- package/lib/module/alert-dialog/types.js.map +1 -0
- package/lib/module/combobox/Combobox.js +222 -0
- package/lib/module/combobox/Combobox.js.map +1 -0
- package/lib/module/combobox/index.js +6 -0
- package/lib/module/combobox/index.js.map +1 -0
- package/lib/module/combobox/index.web.js +6 -0
- package/lib/module/combobox/index.web.js.map +1 -0
- package/lib/module/combobox/types.js +4 -0
- package/lib/module/combobox/types.js.map +1 -0
- package/lib/module/command/Command.js +251 -0
- package/lib/module/command/Command.js.map +1 -0
- package/lib/module/command/index.js +6 -0
- package/lib/module/command/index.js.map +1 -0
- package/lib/module/command/index.web.js +6 -0
- package/lib/module/command/index.web.js.map +1 -0
- package/lib/module/command/types.js +4 -0
- package/lib/module/command/types.js.map +1 -0
- package/lib/module/field/Field.js +63 -0
- package/lib/module/field/Field.js.map +1 -0
- package/lib/module/field/index.js +4 -0
- package/lib/module/field/index.js.map +1 -0
- package/lib/module/field/types.js +4 -0
- package/lib/module/field/types.js.map +1 -0
- package/lib/module/index.js +10 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +10 -3
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/input-group/InputGroup.js +167 -0
- package/lib/module/input-group/InputGroup.js.map +1 -0
- package/lib/module/input-group/index.js +4 -0
- package/lib/module/input-group/index.js.map +1 -0
- package/lib/module/input-group/types.js +4 -0
- package/lib/module/input-group/types.js.map +1 -0
- package/lib/module/item/Item.js +167 -0
- package/lib/module/item/Item.js.map +1 -0
- package/lib/module/item/index.js +4 -0
- package/lib/module/item/index.js.map +1 -0
- package/lib/module/item/types.js +4 -0
- package/lib/module/item/types.js.map +1 -0
- package/lib/module/kbd/Kbd.js +74 -0
- package/lib/module/kbd/Kbd.js.map +1 -0
- package/lib/module/kbd/index.js +4 -0
- package/lib/module/kbd/index.js.map +1 -0
- package/lib/module/kbd/types.js +4 -0
- package/lib/module/kbd/types.js.map +1 -0
- package/lib/module/label/Label.js +55 -0
- package/lib/module/label/Label.js.map +1 -0
- package/lib/module/label/index.js +4 -0
- package/lib/module/label/index.js.map +1 -0
- package/lib/module/label/types.js +4 -0
- package/lib/module/label/types.js.map +1 -0
- package/lib/module/popover/context.js +13 -0
- package/lib/module/popover/context.js.map +1 -0
- package/lib/module/popover/index.js +95 -0
- package/lib/module/popover/index.js.map +1 -0
- package/lib/module/popover/index.web.js +274 -0
- package/lib/module/popover/index.web.js.map +1 -0
- package/lib/module/popover/types.js +4 -0
- package/lib/module/popover/types.js.map +1 -0
- package/lib/module/react-native-css.d.js +2 -0
- package/lib/module/react-native-css.d.js.map +1 -0
- package/lib/module/slider/Slider.js +250 -0
- package/lib/module/slider/Slider.js.map +1 -0
- package/lib/module/slider/index.js +4 -0
- package/lib/module/slider/index.js.map +1 -0
- package/lib/module/slider/types.js +4 -0
- package/lib/module/slider/types.js.map +1 -0
- package/lib/module/theme/BloomThemeProvider.js +40 -8
- package/lib/module/theme/BloomThemeProvider.js.map +1 -1
- package/lib/module/theme/color-presets.js +118 -118
- package/lib/module/theme/color-presets.js.map +1 -1
- package/lib/module/theme/color-scope/index.js +29 -7
- package/lib/module/theme/color-scope/index.js.map +1 -1
- package/lib/module/theme/color-scope/style-builder.js +35 -0
- package/lib/module/theme/color-scope/style-builder.js.map +1 -1
- package/lib/module/theme/native-root-vars.js +101 -0
- package/lib/module/theme/native-root-vars.js.map +1 -0
- package/lib/module/theme/native-root-vars.web.js +23 -0
- package/lib/module/theme/native-root-vars.web.js.map +1 -0
- package/lib/module/theme/preset-vars.js +4 -1
- package/lib/module/theme/preset-vars.js.map +1 -1
- package/lib/typescript/commonjs/alert-dialog/AlertDialog.d.ts +21 -0
- package/lib/typescript/commonjs/alert-dialog/AlertDialog.d.ts.map +1 -0
- package/lib/typescript/commonjs/alert-dialog/AlertDialogHost.d.ts +15 -0
- package/lib/typescript/commonjs/alert-dialog/AlertDialogHost.d.ts.map +1 -0
- package/lib/typescript/commonjs/alert-dialog/confirm-store.d.ts +31 -0
- package/lib/typescript/commonjs/alert-dialog/confirm-store.d.ts.map +1 -0
- package/lib/typescript/commonjs/alert-dialog/index.d.ts +8 -0
- package/lib/typescript/commonjs/alert-dialog/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/alert-dialog/index.web.d.ts +8 -0
- package/lib/typescript/commonjs/alert-dialog/index.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/alert-dialog/types.d.ts +44 -0
- package/lib/typescript/commonjs/alert-dialog/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/combobox/Combobox.d.ts +33 -0
- package/lib/typescript/commonjs/combobox/Combobox.d.ts.map +1 -0
- package/lib/typescript/commonjs/combobox/index.d.ts +6 -0
- package/lib/typescript/commonjs/combobox/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/combobox/index.web.d.ts +6 -0
- package/lib/typescript/commonjs/combobox/index.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/combobox/types.d.ts +40 -0
- package/lib/typescript/commonjs/combobox/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/command/Command.d.ts +22 -0
- package/lib/typescript/commonjs/command/Command.d.ts.map +1 -0
- package/lib/typescript/commonjs/command/index.d.ts +6 -0
- package/lib/typescript/commonjs/command/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/command/index.web.d.ts +6 -0
- package/lib/typescript/commonjs/command/index.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/command/types.d.ts +46 -0
- package/lib/typescript/commonjs/command/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/field/Field.d.ts +4 -0
- package/lib/typescript/commonjs/field/Field.d.ts.map +1 -0
- package/lib/typescript/commonjs/field/index.d.ts +3 -0
- package/lib/typescript/commonjs/field/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/field/types.d.ts +26 -0
- package/lib/typescript/commonjs/field/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/icons/common.d.ts +8 -8
- package/lib/typescript/commonjs/index.d.ts +19 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +19 -0
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/input-group/InputGroup.d.ts +9 -0
- package/lib/typescript/commonjs/input-group/InputGroup.d.ts.map +1 -0
- package/lib/typescript/commonjs/input-group/index.d.ts +3 -0
- package/lib/typescript/commonjs/input-group/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/input-group/types.d.ts +35 -0
- package/lib/typescript/commonjs/input-group/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/item/Item.d.ts +4 -0
- package/lib/typescript/commonjs/item/Item.d.ts.map +1 -0
- package/lib/typescript/commonjs/item/index.d.ts +3 -0
- package/lib/typescript/commonjs/item/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/item/types.d.ts +45 -0
- package/lib/typescript/commonjs/item/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/kbd/Kbd.d.ts +4 -0
- package/lib/typescript/commonjs/kbd/Kbd.d.ts.map +1 -0
- package/lib/typescript/commonjs/kbd/index.d.ts +3 -0
- package/lib/typescript/commonjs/kbd/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/kbd/types.d.ts +13 -0
- package/lib/typescript/commonjs/kbd/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/label/Label.d.ts +4 -0
- package/lib/typescript/commonjs/label/Label.d.ts.map +1 -0
- package/lib/typescript/commonjs/label/index.d.ts +3 -0
- package/lib/typescript/commonjs/label/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/label/types.d.ts +27 -0
- package/lib/typescript/commonjs/label/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/popover/context.d.ts +15 -0
- package/lib/typescript/commonjs/popover/context.d.ts.map +1 -0
- package/lib/typescript/commonjs/popover/index.d.ts +14 -0
- package/lib/typescript/commonjs/popover/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/popover/index.web.d.ts +14 -0
- package/lib/typescript/commonjs/popover/index.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/popover/types.d.ts +54 -0
- package/lib/typescript/commonjs/popover/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/slider/Slider.d.ts +4 -0
- package/lib/typescript/commonjs/slider/Slider.d.ts.map +1 -0
- package/lib/typescript/commonjs/slider/index.d.ts +3 -0
- package/lib/typescript/commonjs/slider/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/slider/types.d.ts +30 -0
- package/lib/typescript/commonjs/slider/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/BloomThemeProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/color-scope/index.d.ts +9 -2
- package/lib/typescript/commonjs/theme/color-scope/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/color-scope/style-builder.d.ts +32 -0
- package/lib/typescript/commonjs/theme/color-scope/style-builder.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/native-root-vars.d.ts +89 -0
- package/lib/typescript/commonjs/theme/native-root-vars.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/native-root-vars.web.d.ts +20 -0
- package/lib/typescript/commonjs/theme/native-root-vars.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/preset-vars.d.ts.map +1 -1
- package/lib/typescript/module/alert-dialog/AlertDialog.d.ts +21 -0
- package/lib/typescript/module/alert-dialog/AlertDialog.d.ts.map +1 -0
- package/lib/typescript/module/alert-dialog/AlertDialogHost.d.ts +15 -0
- package/lib/typescript/module/alert-dialog/AlertDialogHost.d.ts.map +1 -0
- package/lib/typescript/module/alert-dialog/confirm-store.d.ts +31 -0
- package/lib/typescript/module/alert-dialog/confirm-store.d.ts.map +1 -0
- package/lib/typescript/module/alert-dialog/index.d.ts +8 -0
- package/lib/typescript/module/alert-dialog/index.d.ts.map +1 -0
- package/lib/typescript/module/alert-dialog/index.web.d.ts +8 -0
- package/lib/typescript/module/alert-dialog/index.web.d.ts.map +1 -0
- package/lib/typescript/module/alert-dialog/types.d.ts +44 -0
- package/lib/typescript/module/alert-dialog/types.d.ts.map +1 -0
- package/lib/typescript/module/combobox/Combobox.d.ts +33 -0
- package/lib/typescript/module/combobox/Combobox.d.ts.map +1 -0
- package/lib/typescript/module/combobox/index.d.ts +6 -0
- package/lib/typescript/module/combobox/index.d.ts.map +1 -0
- package/lib/typescript/module/combobox/index.web.d.ts +6 -0
- package/lib/typescript/module/combobox/index.web.d.ts.map +1 -0
- package/lib/typescript/module/combobox/types.d.ts +40 -0
- package/lib/typescript/module/combobox/types.d.ts.map +1 -0
- package/lib/typescript/module/command/Command.d.ts +22 -0
- package/lib/typescript/module/command/Command.d.ts.map +1 -0
- package/lib/typescript/module/command/index.d.ts +6 -0
- package/lib/typescript/module/command/index.d.ts.map +1 -0
- package/lib/typescript/module/command/index.web.d.ts +6 -0
- package/lib/typescript/module/command/index.web.d.ts.map +1 -0
- package/lib/typescript/module/command/types.d.ts +46 -0
- package/lib/typescript/module/command/types.d.ts.map +1 -0
- package/lib/typescript/module/field/Field.d.ts +4 -0
- package/lib/typescript/module/field/Field.d.ts.map +1 -0
- package/lib/typescript/module/field/index.d.ts +3 -0
- package/lib/typescript/module/field/index.d.ts.map +1 -0
- package/lib/typescript/module/field/types.d.ts +26 -0
- package/lib/typescript/module/field/types.d.ts.map +1 -0
- package/lib/typescript/module/icons/common.d.ts +8 -8
- package/lib/typescript/module/index.d.ts +19 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +19 -0
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/input-group/InputGroup.d.ts +9 -0
- package/lib/typescript/module/input-group/InputGroup.d.ts.map +1 -0
- package/lib/typescript/module/input-group/index.d.ts +3 -0
- package/lib/typescript/module/input-group/index.d.ts.map +1 -0
- package/lib/typescript/module/input-group/types.d.ts +35 -0
- package/lib/typescript/module/input-group/types.d.ts.map +1 -0
- package/lib/typescript/module/item/Item.d.ts +4 -0
- package/lib/typescript/module/item/Item.d.ts.map +1 -0
- package/lib/typescript/module/item/index.d.ts +3 -0
- package/lib/typescript/module/item/index.d.ts.map +1 -0
- package/lib/typescript/module/item/types.d.ts +45 -0
- package/lib/typescript/module/item/types.d.ts.map +1 -0
- package/lib/typescript/module/kbd/Kbd.d.ts +4 -0
- package/lib/typescript/module/kbd/Kbd.d.ts.map +1 -0
- package/lib/typescript/module/kbd/index.d.ts +3 -0
- package/lib/typescript/module/kbd/index.d.ts.map +1 -0
- package/lib/typescript/module/kbd/types.d.ts +13 -0
- package/lib/typescript/module/kbd/types.d.ts.map +1 -0
- package/lib/typescript/module/label/Label.d.ts +4 -0
- package/lib/typescript/module/label/Label.d.ts.map +1 -0
- package/lib/typescript/module/label/index.d.ts +3 -0
- package/lib/typescript/module/label/index.d.ts.map +1 -0
- package/lib/typescript/module/label/types.d.ts +27 -0
- package/lib/typescript/module/label/types.d.ts.map +1 -0
- package/lib/typescript/module/popover/context.d.ts +15 -0
- package/lib/typescript/module/popover/context.d.ts.map +1 -0
- package/lib/typescript/module/popover/index.d.ts +14 -0
- package/lib/typescript/module/popover/index.d.ts.map +1 -0
- package/lib/typescript/module/popover/index.web.d.ts +14 -0
- package/lib/typescript/module/popover/index.web.d.ts.map +1 -0
- package/lib/typescript/module/popover/types.d.ts +54 -0
- package/lib/typescript/module/popover/types.d.ts.map +1 -0
- package/lib/typescript/module/slider/Slider.d.ts +4 -0
- package/lib/typescript/module/slider/Slider.d.ts.map +1 -0
- package/lib/typescript/module/slider/index.d.ts +3 -0
- package/lib/typescript/module/slider/index.d.ts.map +1 -0
- package/lib/typescript/module/slider/types.d.ts +30 -0
- package/lib/typescript/module/slider/types.d.ts.map +1 -0
- package/lib/typescript/module/theme/BloomThemeProvider.d.ts.map +1 -1
- package/lib/typescript/module/theme/color-scope/index.d.ts +9 -2
- package/lib/typescript/module/theme/color-scope/index.d.ts.map +1 -1
- package/lib/typescript/module/theme/color-scope/style-builder.d.ts +32 -0
- package/lib/typescript/module/theme/color-scope/style-builder.d.ts.map +1 -1
- package/lib/typescript/module/theme/native-root-vars.d.ts +89 -0
- package/lib/typescript/module/theme/native-root-vars.d.ts.map +1 -0
- package/lib/typescript/module/theme/native-root-vars.web.d.ts +20 -0
- package/lib/typescript/module/theme/native-root-vars.web.d.ts.map +1 -0
- package/lib/typescript/module/theme/preset-vars.d.ts.map +1 -1
- package/package.json +141 -1
- package/src/__tests__/Field.test.tsx +55 -0
- package/src/__tests__/InputGroup.test.tsx +44 -0
- package/src/__tests__/Item.test.tsx +73 -0
- package/src/__tests__/Kbd.test.tsx +27 -0
- package/src/__tests__/Label.test.tsx +30 -0
- package/src/__tests__/Slider.test.tsx +38 -0
- package/src/__tests__/confirm-store.test.ts +58 -0
- package/src/__tests__/native-root-vars.test.ts +125 -0
- package/src/alert-dialog/AlertDialog.stories.tsx +61 -0
- package/src/alert-dialog/AlertDialog.tsx +120 -0
- package/src/alert-dialog/AlertDialogHost.tsx +51 -0
- package/src/alert-dialog/confirm-store.ts +77 -0
- package/src/alert-dialog/index.ts +13 -0
- package/src/alert-dialog/index.web.ts +13 -0
- package/src/alert-dialog/types.ts +46 -0
- package/src/combobox/Combobox.stories.tsx +40 -0
- package/src/combobox/Combobox.tsx +274 -0
- package/src/combobox/index.ts +6 -0
- package/src/combobox/index.web.ts +6 -0
- package/src/combobox/types.ts +41 -0
- package/src/command/Command.stories.tsx +60 -0
- package/src/command/Command.tsx +276 -0
- package/src/command/index.ts +6 -0
- package/src/command/index.web.ts +6 -0
- package/src/command/types.ts +47 -0
- package/src/field/Field.stories.tsx +54 -0
- package/src/field/Field.tsx +77 -0
- package/src/field/index.ts +2 -0
- package/src/field/types.ts +26 -0
- package/src/index.ts +23 -0
- package/src/index.web.ts +23 -0
- package/src/input-group/InputGroup.stories.tsx +65 -0
- package/src/input-group/InputGroup.tsx +184 -0
- package/src/input-group/index.ts +2 -0
- package/src/input-group/types.ts +36 -0
- package/src/item/Item.stories.tsx +43 -0
- package/src/item/Item.tsx +180 -0
- package/src/item/index.ts +2 -0
- package/src/item/types.ts +45 -0
- package/src/kbd/Kbd.stories.tsx +36 -0
- package/src/kbd/Kbd.tsx +76 -0
- package/src/kbd/index.ts +2 -0
- package/src/kbd/types.ts +13 -0
- package/src/label/Label.stories.tsx +32 -0
- package/src/label/Label.tsx +64 -0
- package/src/label/index.ts +2 -0
- package/src/label/types.ts +27 -0
- package/src/popover/Popover.stories.tsx +61 -0
- package/src/popover/context.ts +26 -0
- package/src/popover/index.tsx +104 -0
- package/src/popover/index.web.tsx +325 -0
- package/src/popover/types.ts +60 -0
- package/src/react-native-css.d.ts +69 -0
- package/src/slider/Slider.stories.tsx +46 -0
- package/src/slider/Slider.tsx +275 -0
- package/src/slider/index.ts +2 -0
- package/src/slider/types.ts +30 -0
- package/src/theme/BloomThemeProvider.tsx +32 -6
- package/src/theme/color-presets.ts +118 -118
- package/src/theme/color-scope/index.tsx +30 -8
- package/src/theme/color-scope/style-builder.ts +40 -0
- package/src/theme/native-root-vars.ts +102 -0
- package/src/theme/native-root-vars.web.ts +22 -0
- package/src/theme/preset-vars.ts +4 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import type { Props as IconProps } from '../icons/common';
|
|
3
|
+
|
|
4
|
+
export interface CommandItem {
|
|
5
|
+
/** Stable id. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Primary label. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Secondary text shown beneath the label. */
|
|
10
|
+
description?: string;
|
|
11
|
+
/** Optional leading icon component (a Bloom icon). */
|
|
12
|
+
icon?: React.ComponentType<IconProps>;
|
|
13
|
+
/** Optional keywords that also match the query (not displayed). */
|
|
14
|
+
keywords?: string[];
|
|
15
|
+
/** Trailing shortcut hint (e.g. `'⌘K'`) — rendered as `Kbd`. */
|
|
16
|
+
shortcut?: string;
|
|
17
|
+
/** Group label this item belongs to. */
|
|
18
|
+
group?: string;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** Invoked on select. The palette closes afterward. */
|
|
21
|
+
onSelect: () => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface CommandProps {
|
|
25
|
+
/** Whether the palette is open (controlled). */
|
|
26
|
+
visible: boolean;
|
|
27
|
+
/** Close request (Escape, backdrop, after a selection). */
|
|
28
|
+
onClose: () => void;
|
|
29
|
+
/** Command items. */
|
|
30
|
+
items: CommandItem[];
|
|
31
|
+
/** Input placeholder. Defaults to `'Type a command or search…'`. */
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
/** Shown when no items match. Defaults to `'No results found.'`. */
|
|
34
|
+
emptyText?: string;
|
|
35
|
+
/** Controlled query. When omitted the palette owns the query. */
|
|
36
|
+
query?: string;
|
|
37
|
+
onQueryChange?: (query: string) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Custom filter. Defaults to a case-insensitive substring match against
|
|
40
|
+
* `label`, `description` and `keywords`.
|
|
41
|
+
*/
|
|
42
|
+
filter?: (item: CommandItem, query: string) => boolean;
|
|
43
|
+
/** Max height of the results list in px. Defaults to `360`. */
|
|
44
|
+
maxListHeight?: number;
|
|
45
|
+
style?: StyleProp<ViewStyle>;
|
|
46
|
+
testID?: string;
|
|
47
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
|
+
|
|
5
|
+
import { Field } from './Field';
|
|
6
|
+
import { Switch } from '../switch';
|
|
7
|
+
import * as TextField from '../text-field';
|
|
8
|
+
|
|
9
|
+
const meta: Meta = {
|
|
10
|
+
title: 'Forms/Field',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
|
|
15
|
+
type Story = StoryObj;
|
|
16
|
+
|
|
17
|
+
export const WithInput: Story = {
|
|
18
|
+
render: () => {
|
|
19
|
+
const [v, setV] = useState('');
|
|
20
|
+
return (
|
|
21
|
+
<View style={{ width: 360 }}>
|
|
22
|
+
<Field label="Username" description="Choose a unique handle." required>
|
|
23
|
+
<TextField.Input label="Username" value={v} onChangeText={setV} placeholder="ada" />
|
|
24
|
+
</Field>
|
|
25
|
+
</View>
|
|
26
|
+
);
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const WithError: Story = {
|
|
31
|
+
render: () => {
|
|
32
|
+
const [v, setV] = useState('not-an-email');
|
|
33
|
+
return (
|
|
34
|
+
<View style={{ width: 360 }}>
|
|
35
|
+
<Field label="Email" error="Enter a valid email address.">
|
|
36
|
+
<TextField.Input label="Email" value={v} onChangeText={setV} isInvalid />
|
|
37
|
+
</Field>
|
|
38
|
+
</View>
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const WrappingAControl: Story = {
|
|
44
|
+
render: () => {
|
|
45
|
+
const [on, setOn] = useState(true);
|
|
46
|
+
return (
|
|
47
|
+
<View style={{ width: 360 }}>
|
|
48
|
+
<Field label="Notifications" description="Email me about account activity.">
|
|
49
|
+
<Switch value={on} onValueChange={setOn} />
|
|
50
|
+
</Field>
|
|
51
|
+
</View>
|
|
52
|
+
);
|
|
53
|
+
},
|
|
54
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useTheme } from '../theme/use-theme';
|
|
5
|
+
import { Text } from '../typography';
|
|
6
|
+
import { Label } from '../label';
|
|
7
|
+
import { atoms as a } from '../styles';
|
|
8
|
+
import { fontSize, space } from '../styles/tokens';
|
|
9
|
+
import type { FieldProps } from './types';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Standalone form-field wrapper: an optional `Label`, the control (passed as
|
|
13
|
+
* `children`), and a description **or** error message below it. Composes
|
|
14
|
+
* Bloom's `Label`. Unlike `TextField` — which bakes its label/error into the
|
|
15
|
+
* input chrome — `Field` wraps any arbitrary control (a `Switch`, a
|
|
16
|
+
* `SegmentedControl`, a custom picker, etc.).
|
|
17
|
+
*/
|
|
18
|
+
const FieldComponent = function Field({
|
|
19
|
+
children,
|
|
20
|
+
label,
|
|
21
|
+
description,
|
|
22
|
+
error,
|
|
23
|
+
required = false,
|
|
24
|
+
disabled = false,
|
|
25
|
+
nativeID,
|
|
26
|
+
style,
|
|
27
|
+
testID,
|
|
28
|
+
}: FieldProps) {
|
|
29
|
+
const theme = useTheme();
|
|
30
|
+
const hasError = typeof error === 'string' && error.length > 0;
|
|
31
|
+
const descriptionID = nativeID ? `${nativeID}-description` : undefined;
|
|
32
|
+
const errorID = nativeID ? `${nativeID}-error` : undefined;
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<View style={[a.w_full, style]} testID={testID}>
|
|
36
|
+
{label != null ? (
|
|
37
|
+
<Label htmlFor={nativeID} required={required} disabled={disabled}>
|
|
38
|
+
{label}
|
|
39
|
+
</Label>
|
|
40
|
+
) : null}
|
|
41
|
+
|
|
42
|
+
{children}
|
|
43
|
+
|
|
44
|
+
{hasError ? (
|
|
45
|
+
<Text
|
|
46
|
+
nativeID={errorID}
|
|
47
|
+
accessibilityRole="alert"
|
|
48
|
+
style={[
|
|
49
|
+
{
|
|
50
|
+
fontSize: fontSize.sm,
|
|
51
|
+
color: theme.colors.negative,
|
|
52
|
+
marginTop: space.xs,
|
|
53
|
+
},
|
|
54
|
+
]}>
|
|
55
|
+
{error}
|
|
56
|
+
</Text>
|
|
57
|
+
) : description != null ? (
|
|
58
|
+
<Text
|
|
59
|
+
nativeID={descriptionID}
|
|
60
|
+
style={[
|
|
61
|
+
{
|
|
62
|
+
fontSize: fontSize.sm,
|
|
63
|
+
color: disabled
|
|
64
|
+
? theme.colors.textTertiary
|
|
65
|
+
: theme.colors.textSecondary,
|
|
66
|
+
marginTop: space.xs,
|
|
67
|
+
},
|
|
68
|
+
]}>
|
|
69
|
+
{description}
|
|
70
|
+
</Text>
|
|
71
|
+
) : null}
|
|
72
|
+
</View>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const Field = memo(FieldComponent);
|
|
77
|
+
Field.displayName = 'Field';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export interface FieldProps {
|
|
4
|
+
/** The input/control this field wraps. */
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
/** Field label, rendered above the control via Bloom's `Label`. */
|
|
7
|
+
label?: React.ReactNode;
|
|
8
|
+
/** Helper/description text rendered below the control. */
|
|
9
|
+
description?: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Error message. When a non-empty string is provided the field renders in
|
|
12
|
+
* its invalid state (error-colored message, replaces the description).
|
|
13
|
+
*/
|
|
14
|
+
error?: string | null;
|
|
15
|
+
/** Mark the field's label with a required asterisk. */
|
|
16
|
+
required?: boolean;
|
|
17
|
+
/** Disabled styling for the label/description. */
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* `nativeID` wired to the label's `htmlFor` (web) so a label click focuses
|
|
21
|
+
* the control. Set the same id on the child control's `nativeID`.
|
|
22
|
+
*/
|
|
23
|
+
nativeID?: string;
|
|
24
|
+
style?: StyleProp<ViewStyle>;
|
|
25
|
+
testID?: string;
|
|
26
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -67,6 +67,16 @@ export { IconCircle } from './icon-circle';
|
|
|
67
67
|
export * as TextField from './text-field';
|
|
68
68
|
export * as SegmentedControl from './segmented-control';
|
|
69
69
|
export { SearchInput } from './search-input';
|
|
70
|
+
export { Label } from './label';
|
|
71
|
+
export type { LabelProps } from './label';
|
|
72
|
+
export { Field } from './field';
|
|
73
|
+
export type { FieldProps } from './field';
|
|
74
|
+
export { InputGroup } from './input-group';
|
|
75
|
+
export type { InputGroupProps, InputGroupAddonProps } from './input-group';
|
|
76
|
+
export { Slider } from './slider';
|
|
77
|
+
export type { SliderProps } from './slider';
|
|
78
|
+
export { Combobox } from './combobox';
|
|
79
|
+
export type { ComboboxProps, ComboboxOption } from './combobox';
|
|
70
80
|
|
|
71
81
|
// Bottom sheet
|
|
72
82
|
export { BottomSheet } from './bottom-sheet';
|
|
@@ -82,6 +92,10 @@ export * as Accordion from './accordion';
|
|
|
82
92
|
|
|
83
93
|
// Settings / Grouped list
|
|
84
94
|
export * from './settings-list';
|
|
95
|
+
export { Item } from './item';
|
|
96
|
+
export type { ItemProps } from './item';
|
|
97
|
+
export { Kbd } from './kbd';
|
|
98
|
+
export type { KbdProps } from './kbd';
|
|
85
99
|
|
|
86
100
|
// Overlay components
|
|
87
101
|
export * as Admonition from './admonition';
|
|
@@ -89,6 +103,15 @@ export * as Menu from './menu';
|
|
|
89
103
|
export * as Tooltip from './tooltip';
|
|
90
104
|
export * as Select from './select';
|
|
91
105
|
export * as ContextMenu from './context-menu';
|
|
106
|
+
export * as Popover from './popover';
|
|
107
|
+
export { AlertDialog, AlertDialogHost, confirm } from './alert-dialog';
|
|
108
|
+
export type {
|
|
109
|
+
AlertDialogProps,
|
|
110
|
+
AlertDialogActionStyle,
|
|
111
|
+
ConfirmOptions,
|
|
112
|
+
} from './alert-dialog';
|
|
113
|
+
export { Command } from './command';
|
|
114
|
+
export type { CommandProps, CommandItem } from './command';
|
|
92
115
|
|
|
93
116
|
// Code (mono)
|
|
94
117
|
export * as Code from './code';
|
package/src/index.web.ts
CHANGED
|
@@ -72,6 +72,16 @@ export { IconCircle } from './icon-circle';
|
|
|
72
72
|
export * as TextField from './text-field';
|
|
73
73
|
export * as SegmentedControl from './segmented-control';
|
|
74
74
|
export { SearchInput } from './search-input';
|
|
75
|
+
export { Label } from './label';
|
|
76
|
+
export type { LabelProps } from './label';
|
|
77
|
+
export { Field } from './field';
|
|
78
|
+
export type { FieldProps } from './field';
|
|
79
|
+
export { InputGroup } from './input-group';
|
|
80
|
+
export type { InputGroupProps, InputGroupAddonProps } from './input-group';
|
|
81
|
+
export { Slider } from './slider';
|
|
82
|
+
export type { SliderProps } from './slider';
|
|
83
|
+
export { Combobox } from './combobox/index.web';
|
|
84
|
+
export type { ComboboxProps, ComboboxOption } from './combobox/index.web';
|
|
75
85
|
|
|
76
86
|
// Bottom sheet
|
|
77
87
|
export { BottomSheet } from './bottom-sheet';
|
|
@@ -87,6 +97,10 @@ export * as Accordion from './accordion';
|
|
|
87
97
|
|
|
88
98
|
// Settings / Grouped list
|
|
89
99
|
export * from './settings-list';
|
|
100
|
+
export { Item } from './item';
|
|
101
|
+
export type { ItemProps } from './item';
|
|
102
|
+
export { Kbd } from './kbd';
|
|
103
|
+
export type { KbdProps } from './kbd';
|
|
90
104
|
|
|
91
105
|
// Overlay components
|
|
92
106
|
export * as Admonition from './admonition';
|
|
@@ -94,6 +108,15 @@ export * as Menu from './menu/index.web';
|
|
|
94
108
|
export * as Tooltip from './tooltip/index.web';
|
|
95
109
|
export * as Select from './select/index.web';
|
|
96
110
|
export * as ContextMenu from './context-menu/index.web';
|
|
111
|
+
export * as Popover from './popover/index.web';
|
|
112
|
+
export { AlertDialog, AlertDialogHost, confirm } from './alert-dialog/index.web';
|
|
113
|
+
export type {
|
|
114
|
+
AlertDialogProps,
|
|
115
|
+
AlertDialogActionStyle,
|
|
116
|
+
ConfirmOptions,
|
|
117
|
+
} from './alert-dialog/index.web';
|
|
118
|
+
export { Command } from './command/index.web';
|
|
119
|
+
export type { CommandProps, CommandItem } from './command/index.web';
|
|
97
120
|
|
|
98
121
|
// Code (mono)
|
|
99
122
|
export * as Code from './code';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
|
+
|
|
5
|
+
import { InputGroup } from './InputGroup';
|
|
6
|
+
import * as TextField from '../text-field';
|
|
7
|
+
import { Button } from '../button';
|
|
8
|
+
import { Kbd } from '../kbd';
|
|
9
|
+
|
|
10
|
+
const meta: Meta = {
|
|
11
|
+
title: 'Forms/InputGroup',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
|
|
16
|
+
type Story = StoryObj;
|
|
17
|
+
|
|
18
|
+
export const TextAddons: Story = {
|
|
19
|
+
render: () => {
|
|
20
|
+
const [v, setV] = useState('');
|
|
21
|
+
return (
|
|
22
|
+
<View style={{ width: 360 }}>
|
|
23
|
+
<InputGroup>
|
|
24
|
+
<InputGroup.Addon>https://</InputGroup.Addon>
|
|
25
|
+
<TextField.Input label="Domain" value={v} onChangeText={setV} placeholder="oxy" />
|
|
26
|
+
<InputGroup.Addon>.so</InputGroup.Addon>
|
|
27
|
+
</InputGroup>
|
|
28
|
+
</View>
|
|
29
|
+
);
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const ButtonAddon: Story = {
|
|
34
|
+
render: () => {
|
|
35
|
+
const [v, setV] = useState('');
|
|
36
|
+
return (
|
|
37
|
+
<View style={{ width: 360 }}>
|
|
38
|
+
<InputGroup>
|
|
39
|
+
<TextField.Input label="Invite" value={v} onChangeText={setV} placeholder="email" />
|
|
40
|
+
<InputGroup.Addon divider noPadding>
|
|
41
|
+
<Button variant="ghost" size="small" onPress={() => {}}>
|
|
42
|
+
Send
|
|
43
|
+
</Button>
|
|
44
|
+
</InputGroup.Addon>
|
|
45
|
+
</InputGroup>
|
|
46
|
+
</View>
|
|
47
|
+
);
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const ShortcutHint: Story = {
|
|
52
|
+
render: () => {
|
|
53
|
+
const [v, setV] = useState('');
|
|
54
|
+
return (
|
|
55
|
+
<View style={{ width: 360 }}>
|
|
56
|
+
<InputGroup>
|
|
57
|
+
<TextField.Input label="Search" value={v} onChangeText={setV} placeholder="Search…" />
|
|
58
|
+
<InputGroup.Addon>
|
|
59
|
+
<Kbd size="sm">⌘K</Kbd>
|
|
60
|
+
</InputGroup.Addon>
|
|
61
|
+
</InputGroup>
|
|
62
|
+
</View>
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
createContext,
|
|
3
|
+
memo,
|
|
4
|
+
useContext,
|
|
5
|
+
useMemo,
|
|
6
|
+
} from 'react';
|
|
7
|
+
import { Platform, StyleSheet, View } from 'react-native';
|
|
8
|
+
|
|
9
|
+
import { useTheme } from '../theme/use-theme';
|
|
10
|
+
import { useInteractionState } from '../hooks/useInteractionState';
|
|
11
|
+
import { Text } from '../typography';
|
|
12
|
+
import { borderRadius, fontSize, space } from '../styles/tokens';
|
|
13
|
+
import type { InputGroupAddonProps, InputGroupProps } from './types';
|
|
14
|
+
|
|
15
|
+
const SIZE_CONFIG = {
|
|
16
|
+
sm: { minHeight: 36, paddingHorizontal: space.sm },
|
|
17
|
+
md: { minHeight: 44, paddingHorizontal: space.md },
|
|
18
|
+
lg: { minHeight: 52, paddingHorizontal: space.lg },
|
|
19
|
+
} as const;
|
|
20
|
+
|
|
21
|
+
interface InputGroupContextValue {
|
|
22
|
+
size: 'sm' | 'md' | 'lg';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const InputGroupContext = createContext<InputGroupContextValue>({ size: 'md' });
|
|
26
|
+
InputGroupContext.displayName = 'InputGroupContext';
|
|
27
|
+
|
|
28
|
+
const AddonComponent = function InputGroupAddon({
|
|
29
|
+
children,
|
|
30
|
+
divider = false,
|
|
31
|
+
noPadding = false,
|
|
32
|
+
style,
|
|
33
|
+
testID,
|
|
34
|
+
}: InputGroupAddonProps) {
|
|
35
|
+
const theme = useTheme();
|
|
36
|
+
const { size } = useContext(InputGroupContext);
|
|
37
|
+
const cfg = SIZE_CONFIG[size];
|
|
38
|
+
|
|
39
|
+
// Plain string/number content is wrapped in a themed Text so it reads as a
|
|
40
|
+
// subdued addon label (and never trips RN's "raw text outside <Text>" rule).
|
|
41
|
+
const content =
|
|
42
|
+
typeof children === 'string' || typeof children === 'number' ? (
|
|
43
|
+
<Text
|
|
44
|
+
numberOfLines={1}
|
|
45
|
+
style={{ color: theme.colors.textSecondary, fontSize: fontSize.md }}>
|
|
46
|
+
{children}
|
|
47
|
+
</Text>
|
|
48
|
+
) : (
|
|
49
|
+
children
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<View
|
|
54
|
+
testID={testID}
|
|
55
|
+
style={[
|
|
56
|
+
styles.addon,
|
|
57
|
+
!noPadding && { paddingHorizontal: cfg.paddingHorizontal },
|
|
58
|
+
style,
|
|
59
|
+
]}>
|
|
60
|
+
{divider ? (
|
|
61
|
+
<View
|
|
62
|
+
style={[styles.divider, { backgroundColor: theme.colors.borderLight }]}
|
|
63
|
+
/>
|
|
64
|
+
) : null}
|
|
65
|
+
{content}
|
|
66
|
+
</View>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const Addon = memo(AddonComponent);
|
|
71
|
+
Addon.displayName = 'InputGroup.Addon';
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Horizontal group that wraps an input with leading/trailing addons (icons,
|
|
75
|
+
* text, buttons, `Kbd`). Renders a single bordered chrome — radii, border,
|
|
76
|
+
* focus/error colors match Bloom's `TextField` so a group reads as one field.
|
|
77
|
+
* The input child stretches to fill the middle.
|
|
78
|
+
*
|
|
79
|
+
* ```tsx
|
|
80
|
+
* <InputGroup>
|
|
81
|
+
* <InputGroup.Addon>https://</InputGroup.Addon>
|
|
82
|
+
* <TextField.Input label="Domain" value={v} onChangeText={setV} />
|
|
83
|
+
* <InputGroup.Addon divider>
|
|
84
|
+
* <Button size="small" variant="ghost" onPress={go}>Go</Button>
|
|
85
|
+
* </InputGroup.Addon>
|
|
86
|
+
* </InputGroup>
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
const InputGroupComponent = function InputGroup({
|
|
90
|
+
children,
|
|
91
|
+
isInvalid = false,
|
|
92
|
+
disabled = false,
|
|
93
|
+
size = 'md',
|
|
94
|
+
style,
|
|
95
|
+
testID,
|
|
96
|
+
}: InputGroupProps) {
|
|
97
|
+
const theme = useTheme();
|
|
98
|
+
const cfg = SIZE_CONFIG[size];
|
|
99
|
+
const { state: focused, onIn: onFocus, onOut: onBlur } = useInteractionState();
|
|
100
|
+
const { state: hovered, onIn: onHoverIn, onOut: onHoverOut } =
|
|
101
|
+
useInteractionState();
|
|
102
|
+
|
|
103
|
+
const borderColor = isInvalid
|
|
104
|
+
? theme.colors.negative
|
|
105
|
+
: focused
|
|
106
|
+
? theme.colors.primary
|
|
107
|
+
: hovered
|
|
108
|
+
? theme.colors.borderLight
|
|
109
|
+
: 'transparent';
|
|
110
|
+
|
|
111
|
+
const backgroundColor = isInvalid
|
|
112
|
+
? theme.colors.negativeSubtle
|
|
113
|
+
: theme.colors.contrast50;
|
|
114
|
+
|
|
115
|
+
const ctx = useMemo<InputGroupContextValue>(() => ({ size }), [size]);
|
|
116
|
+
|
|
117
|
+
const webHandlers: Record<string, unknown> =
|
|
118
|
+
Platform.OS === 'web'
|
|
119
|
+
? {
|
|
120
|
+
onMouseOver: onHoverIn,
|
|
121
|
+
onMouseOut: onHoverOut,
|
|
122
|
+
}
|
|
123
|
+
: {};
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<InputGroupContext.Provider value={ctx}>
|
|
127
|
+
<View
|
|
128
|
+
testID={testID}
|
|
129
|
+
accessibilityState={disabled ? { disabled: true } : undefined}
|
|
130
|
+
// Capture focus bubbling from a nested input so the whole chrome
|
|
131
|
+
// reflects focus — RN-web bubbles focus/blur, native does not but a
|
|
132
|
+
// nested TextInput's own focus ring is sufficient there.
|
|
133
|
+
onFocus={onFocus}
|
|
134
|
+
onBlur={onBlur}
|
|
135
|
+
{...webHandlers}
|
|
136
|
+
style={[
|
|
137
|
+
styles.container,
|
|
138
|
+
{
|
|
139
|
+
minHeight: cfg.minHeight,
|
|
140
|
+
backgroundColor,
|
|
141
|
+
borderColor,
|
|
142
|
+
},
|
|
143
|
+
disabled && styles.disabled,
|
|
144
|
+
style,
|
|
145
|
+
]}>
|
|
146
|
+
{children}
|
|
147
|
+
</View>
|
|
148
|
+
</InputGroupContext.Provider>
|
|
149
|
+
);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const styles = StyleSheet.create({
|
|
153
|
+
container: {
|
|
154
|
+
flexDirection: 'row',
|
|
155
|
+
alignItems: 'stretch',
|
|
156
|
+
width: '100%',
|
|
157
|
+
borderRadius: borderRadius.sm,
|
|
158
|
+
borderWidth: 2,
|
|
159
|
+
overflow: 'hidden',
|
|
160
|
+
},
|
|
161
|
+
addon: {
|
|
162
|
+
flexDirection: 'row',
|
|
163
|
+
alignItems: 'center',
|
|
164
|
+
justifyContent: 'center',
|
|
165
|
+
gap: space.xs,
|
|
166
|
+
flexShrink: 0,
|
|
167
|
+
position: 'relative',
|
|
168
|
+
},
|
|
169
|
+
divider: {
|
|
170
|
+
position: 'absolute',
|
|
171
|
+
left: 0,
|
|
172
|
+
top: space.sm,
|
|
173
|
+
bottom: space.sm,
|
|
174
|
+
width: StyleSheet.hairlineWidth,
|
|
175
|
+
},
|
|
176
|
+
disabled: {
|
|
177
|
+
opacity: 0.5,
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
const InputGroupBase = memo(InputGroupComponent);
|
|
182
|
+
InputGroupBase.displayName = 'InputGroup';
|
|
183
|
+
|
|
184
|
+
export const InputGroup = Object.assign(InputGroupBase, { Addon });
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export interface InputGroupAddonProps {
|
|
4
|
+
/** Addon content (icon, text, `Button`, `Kbd`, etc.). */
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* Visually separate the addon from the input with a hairline divider on the
|
|
8
|
+
* inner edge. Defaults to `false` (addons that are buttons usually want
|
|
9
|
+
* this `true`; plain text/icons usually don't).
|
|
10
|
+
*/
|
|
11
|
+
divider?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Remove the default horizontal padding (useful when the addon is an
|
|
14
|
+
* interactive control that brings its own hit area / padding).
|
|
15
|
+
*/
|
|
16
|
+
noPadding?: boolean;
|
|
17
|
+
style?: StyleProp<ViewStyle>;
|
|
18
|
+
testID?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface InputGroupProps {
|
|
22
|
+
/**
|
|
23
|
+
* Group children. Place `InputGroup.Addon` elements before/after the input
|
|
24
|
+
* (a Bloom `TextField.Input`, a `SearchInput`, or any control). The middle
|
|
25
|
+
* child stretches to fill.
|
|
26
|
+
*/
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
/** Invalid state — renders the error-colored border. */
|
|
29
|
+
isInvalid?: boolean;
|
|
30
|
+
/** Disabled styling. */
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** Size affects height + horizontal padding. Defaults to `'md'`. */
|
|
33
|
+
size?: 'sm' | 'md' | 'lg';
|
|
34
|
+
style?: StyleProp<ViewStyle>;
|
|
35
|
+
testID?: string;
|
|
36
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
|
+
|
|
5
|
+
import { Item } from './Item';
|
|
6
|
+
import { Badge } from '../badge';
|
|
7
|
+
import { Person_Stroke2_Corner0_Rounded as PersonIcon } from '../icons/Person';
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof Item> = {
|
|
10
|
+
title: 'Components/Item',
|
|
11
|
+
component: Item,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
|
|
16
|
+
type Story = StoryObj<typeof Item>;
|
|
17
|
+
|
|
18
|
+
export const Basic: Story = {
|
|
19
|
+
args: { title: 'Profile', subtitle: 'Manage your account details' },
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Pressable: Story = {
|
|
23
|
+
render: () => (
|
|
24
|
+
<View style={{ width: 360 }}>
|
|
25
|
+
<Item
|
|
26
|
+
title="Account"
|
|
27
|
+
subtitle="Email, password, sessions"
|
|
28
|
+
leading={<PersonIcon size="md" />}
|
|
29
|
+
trailing={<Badge content={3} color="primary" />}
|
|
30
|
+
onPress={() => {}}
|
|
31
|
+
/>
|
|
32
|
+
</View>
|
|
33
|
+
),
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Density: Story = {
|
|
37
|
+
render: () => (
|
|
38
|
+
<View style={{ width: 360, gap: 4 }}>
|
|
39
|
+
<Item title="Comfortable" subtitle="default density" />
|
|
40
|
+
<Item title="Compact" density="compact" />
|
|
41
|
+
</View>
|
|
42
|
+
),
|
|
43
|
+
};
|