@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,180 @@
|
|
|
1
|
+
import React, { memo, useMemo } from 'react';
|
|
2
|
+
import { Pressable, StyleSheet, View, type ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useTheme } from '../theme/use-theme';
|
|
5
|
+
import { useInteractionState } from '../hooks/useInteractionState';
|
|
6
|
+
import { Text } from '../typography';
|
|
7
|
+
import { borderRadius, fontSize, space } from '../styles/tokens';
|
|
8
|
+
import type { ItemProps } from './types';
|
|
9
|
+
|
|
10
|
+
const DENSITY = {
|
|
11
|
+
comfortable: { paddingVertical: 10, minHeight: 44 },
|
|
12
|
+
compact: { paddingVertical: 6, minHeight: 36 },
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A generic list row — the building block shared by settings lists, menus,
|
|
17
|
+
* combobox/command option lists, etc. Leading + trailing slots flank a
|
|
18
|
+
* title/subtitle text column (or arbitrary `children`). Pressable when an
|
|
19
|
+
* `onPress` is supplied; otherwise a static container.
|
|
20
|
+
*/
|
|
21
|
+
const ItemComponent = function Item({
|
|
22
|
+
title,
|
|
23
|
+
subtitle,
|
|
24
|
+
children,
|
|
25
|
+
leading,
|
|
26
|
+
trailing,
|
|
27
|
+
onPress,
|
|
28
|
+
onLongPress,
|
|
29
|
+
disabled = false,
|
|
30
|
+
destructive = false,
|
|
31
|
+
selected = false,
|
|
32
|
+
active = false,
|
|
33
|
+
density = 'comfortable',
|
|
34
|
+
style,
|
|
35
|
+
titleStyle,
|
|
36
|
+
subtitleStyle,
|
|
37
|
+
accessibilityLabel,
|
|
38
|
+
accessibilityHint,
|
|
39
|
+
accessibilityRole,
|
|
40
|
+
role,
|
|
41
|
+
testID,
|
|
42
|
+
}: ItemProps) {
|
|
43
|
+
const theme = useTheme();
|
|
44
|
+
const { state: pressed, onIn: onPressIn, onOut: onPressOut } =
|
|
45
|
+
useInteractionState();
|
|
46
|
+
|
|
47
|
+
const titleColor = destructive ? theme.colors.error : theme.colors.text;
|
|
48
|
+
const cfg = DENSITY[density];
|
|
49
|
+
|
|
50
|
+
const containerStyle = useMemo((): ViewStyle => {
|
|
51
|
+
const base: ViewStyle = {
|
|
52
|
+
flexDirection: 'row',
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
gap: space.md,
|
|
55
|
+
paddingHorizontal: space.lg,
|
|
56
|
+
paddingVertical: cfg.paddingVertical,
|
|
57
|
+
minHeight: cfg.minHeight,
|
|
58
|
+
borderRadius: borderRadius.sm,
|
|
59
|
+
};
|
|
60
|
+
if (selected || active) {
|
|
61
|
+
base.backgroundColor = active
|
|
62
|
+
? theme.colors.primaryLight
|
|
63
|
+
: theme.colors.backgroundSecondary;
|
|
64
|
+
}
|
|
65
|
+
return base;
|
|
66
|
+
}, [cfg, selected, active, theme]);
|
|
67
|
+
|
|
68
|
+
const body =
|
|
69
|
+
children != null ? (
|
|
70
|
+
children
|
|
71
|
+
) : (
|
|
72
|
+
<View style={styles.textColumn}>
|
|
73
|
+
{title != null ? (
|
|
74
|
+
typeof title === 'string' ? (
|
|
75
|
+
<Text
|
|
76
|
+
numberOfLines={1}
|
|
77
|
+
style={[styles.title, { color: titleColor }, titleStyle]}>
|
|
78
|
+
{title}
|
|
79
|
+
</Text>
|
|
80
|
+
) : (
|
|
81
|
+
title
|
|
82
|
+
)
|
|
83
|
+
) : null}
|
|
84
|
+
{subtitle != null ? (
|
|
85
|
+
typeof subtitle === 'string' ? (
|
|
86
|
+
<Text
|
|
87
|
+
numberOfLines={2}
|
|
88
|
+
style={[
|
|
89
|
+
styles.subtitle,
|
|
90
|
+
{ color: theme.colors.textSecondary },
|
|
91
|
+
subtitleStyle,
|
|
92
|
+
]}>
|
|
93
|
+
{subtitle}
|
|
94
|
+
</Text>
|
|
95
|
+
) : (
|
|
96
|
+
subtitle
|
|
97
|
+
)
|
|
98
|
+
) : null}
|
|
99
|
+
</View>
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const content = (
|
|
103
|
+
<View style={[containerStyle, style]} testID={testID}>
|
|
104
|
+
{leading != null ? <View style={styles.slot}>{leading}</View> : null}
|
|
105
|
+
{body}
|
|
106
|
+
{trailing != null ? <View style={styles.slot}>{trailing}</View> : null}
|
|
107
|
+
</View>
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
if (onPress || onLongPress) {
|
|
111
|
+
const resolvedRole = accessibilityRole ?? 'button';
|
|
112
|
+
const handlePress = disabled || !onPress ? undefined : onPress;
|
|
113
|
+
const handleLongPress = disabled || !onLongPress ? undefined : onLongPress;
|
|
114
|
+
return (
|
|
115
|
+
<Pressable
|
|
116
|
+
onPress={handlePress}
|
|
117
|
+
onLongPress={handleLongPress}
|
|
118
|
+
onPressIn={disabled ? undefined : onPressIn}
|
|
119
|
+
onPressOut={disabled ? undefined : onPressOut}
|
|
120
|
+
disabled={disabled}
|
|
121
|
+
android_ripple={{ color: theme.colors.border }}
|
|
122
|
+
accessibilityRole={resolvedRole}
|
|
123
|
+
{...(role ? { role } : {})}
|
|
124
|
+
accessibilityLabel={
|
|
125
|
+
accessibilityLabel ?? (typeof title === 'string' ? title : undefined)
|
|
126
|
+
}
|
|
127
|
+
accessibilityHint={accessibilityHint}
|
|
128
|
+
accessibilityState={{ disabled, selected }}
|
|
129
|
+
style={[
|
|
130
|
+
disabled && styles.disabled,
|
|
131
|
+
pressed && !disabled && styles.pressed,
|
|
132
|
+
]}>
|
|
133
|
+
{content}
|
|
134
|
+
</Pressable>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<View
|
|
140
|
+
accessibilityRole={accessibilityRole ?? 'none'}
|
|
141
|
+
{...(role ? { role } : {})}
|
|
142
|
+
accessibilityLabel={
|
|
143
|
+
accessibilityLabel ?? (typeof title === 'string' ? title : undefined)
|
|
144
|
+
}
|
|
145
|
+
accessibilityHint={accessibilityHint}
|
|
146
|
+
accessibilityState={disabled ? { disabled: true } : undefined}
|
|
147
|
+
style={disabled ? styles.disabled : undefined}>
|
|
148
|
+
{content}
|
|
149
|
+
</View>
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const styles = StyleSheet.create({
|
|
154
|
+
slot: {
|
|
155
|
+
alignItems: 'center',
|
|
156
|
+
justifyContent: 'center',
|
|
157
|
+
},
|
|
158
|
+
textColumn: {
|
|
159
|
+
flex: 1,
|
|
160
|
+
minWidth: 0,
|
|
161
|
+
},
|
|
162
|
+
title: {
|
|
163
|
+
fontSize: fontSize.md,
|
|
164
|
+
fontWeight: '500',
|
|
165
|
+
lineHeight: fontSize.md * 1.3,
|
|
166
|
+
},
|
|
167
|
+
subtitle: {
|
|
168
|
+
fontSize: fontSize.sm,
|
|
169
|
+
lineHeight: fontSize.sm * 1.3,
|
|
170
|
+
},
|
|
171
|
+
disabled: {
|
|
172
|
+
opacity: 0.5,
|
|
173
|
+
},
|
|
174
|
+
pressed: {
|
|
175
|
+
opacity: 0.6,
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
export const Item = memo(ItemComponent);
|
|
180
|
+
Item.displayName = 'Item';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { AccessibilityRole, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export interface ItemProps {
|
|
4
|
+
/** Primary title text. */
|
|
5
|
+
title?: React.ReactNode;
|
|
6
|
+
/** Secondary text rendered below the title. */
|
|
7
|
+
subtitle?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Arbitrary body content. When provided it replaces the
|
|
10
|
+
* `title`/`subtitle` text column — use it for fully custom rows.
|
|
11
|
+
*/
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
/** Leading slot (icon, avatar, radio, etc.). */
|
|
14
|
+
leading?: React.ReactNode;
|
|
15
|
+
/** Trailing slot (chevron, switch, badge, value text, etc.). */
|
|
16
|
+
trailing?: React.ReactNode;
|
|
17
|
+
/** Makes the row pressable. */
|
|
18
|
+
onPress?: () => void;
|
|
19
|
+
/** Long-press handler. Only honored when the row is pressable. */
|
|
20
|
+
onLongPress?: () => void;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/** Render the title in the theme's negative/error color. */
|
|
23
|
+
destructive?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Selected state — applies a subtle highlighted background. Useful when
|
|
26
|
+
* `Item` is used as an option inside an overlay (combobox, command, menu).
|
|
27
|
+
*/
|
|
28
|
+
selected?: boolean;
|
|
29
|
+
/** Highlighted (keyboard-focused) state for overlay lists. */
|
|
30
|
+
active?: boolean;
|
|
31
|
+
/** Vertical density. Defaults to `'comfortable'`. */
|
|
32
|
+
density?: 'comfortable' | 'compact';
|
|
33
|
+
style?: StyleProp<ViewStyle>;
|
|
34
|
+
titleStyle?: StyleProp<TextStyle>;
|
|
35
|
+
subtitleStyle?: StyleProp<TextStyle>;
|
|
36
|
+
accessibilityLabel?: string;
|
|
37
|
+
accessibilityHint?: string;
|
|
38
|
+
accessibilityRole?: AccessibilityRole;
|
|
39
|
+
/**
|
|
40
|
+
* Web ARIA role override. Use `'option'` for combobox/listbox items (RN's
|
|
41
|
+
* `accessibilityRole` has no `'option'`); ignored on native.
|
|
42
|
+
*/
|
|
43
|
+
role?: 'option' | 'menuitem' | 'listitem';
|
|
44
|
+
testID?: string;
|
|
45
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
|
+
|
|
5
|
+
import { Kbd } from './Kbd';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Kbd> = {
|
|
8
|
+
title: 'Components/Kbd',
|
|
9
|
+
component: Kbd,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
|
|
14
|
+
type Story = StoryObj<typeof Kbd>;
|
|
15
|
+
|
|
16
|
+
export const Single: Story = {
|
|
17
|
+
args: { children: 'K' },
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const Combo: Story = {
|
|
21
|
+
render: () => (
|
|
22
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 4 }}>
|
|
23
|
+
<Kbd>⌘</Kbd>
|
|
24
|
+
<Kbd>K</Kbd>
|
|
25
|
+
</View>
|
|
26
|
+
),
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Sizes: Story = {
|
|
30
|
+
render: () => (
|
|
31
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>
|
|
32
|
+
<Kbd size="sm">Esc</Kbd>
|
|
33
|
+
<Kbd size="md">Enter</Kbd>
|
|
34
|
+
</View>
|
|
35
|
+
),
|
|
36
|
+
};
|
package/src/kbd/Kbd.tsx
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { Platform, StyleSheet, View, type TextStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useTheme } from '../theme/use-theme';
|
|
5
|
+
import { Text } from '../typography';
|
|
6
|
+
import { borderRadius } from '../styles/tokens';
|
|
7
|
+
import type { KbdProps } from './types';
|
|
8
|
+
|
|
9
|
+
const SIZE_CONFIG = {
|
|
10
|
+
sm: { minWidth: 18, height: 18, fontSize: 11, paddingHorizontal: 4 },
|
|
11
|
+
md: { minWidth: 22, height: 22, fontSize: 12, paddingHorizontal: 6 },
|
|
12
|
+
} as const;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A small keyboard-key chip. Bordered, monospace via the Bloom mono font
|
|
16
|
+
* token, themed for light/dark. Used to surface shortcuts (e.g. `⌘K`,
|
|
17
|
+
* `Esc`) inside menus, command palettes and tooltips.
|
|
18
|
+
*/
|
|
19
|
+
const KbdComponent = function Kbd({
|
|
20
|
+
children,
|
|
21
|
+
size = 'md',
|
|
22
|
+
style,
|
|
23
|
+
textStyle,
|
|
24
|
+
testID,
|
|
25
|
+
}: KbdProps) {
|
|
26
|
+
const theme = useTheme();
|
|
27
|
+
const cfg = SIZE_CONFIG[size];
|
|
28
|
+
|
|
29
|
+
const monoFamily: TextStyle =
|
|
30
|
+
Platform.OS === 'web'
|
|
31
|
+
? { fontFamily: 'var(--bloom-font-mono)' }
|
|
32
|
+
: { fontFamily: 'Geist Mono' };
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<View
|
|
36
|
+
testID={testID}
|
|
37
|
+
style={[
|
|
38
|
+
styles.container,
|
|
39
|
+
{
|
|
40
|
+
minWidth: cfg.minWidth,
|
|
41
|
+
height: cfg.height,
|
|
42
|
+
paddingHorizontal: cfg.paddingHorizontal,
|
|
43
|
+
backgroundColor: theme.colors.backgroundSecondary,
|
|
44
|
+
borderColor: theme.colors.border,
|
|
45
|
+
},
|
|
46
|
+
style,
|
|
47
|
+
]}>
|
|
48
|
+
<Text
|
|
49
|
+
numberOfLines={1}
|
|
50
|
+
style={[
|
|
51
|
+
monoFamily,
|
|
52
|
+
{
|
|
53
|
+
fontSize: cfg.fontSize,
|
|
54
|
+
lineHeight: cfg.height,
|
|
55
|
+
color: theme.colors.textSecondary,
|
|
56
|
+
textAlign: 'center',
|
|
57
|
+
},
|
|
58
|
+
textStyle,
|
|
59
|
+
]}>
|
|
60
|
+
{children}
|
|
61
|
+
</Text>
|
|
62
|
+
</View>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const styles = StyleSheet.create({
|
|
67
|
+
container: {
|
|
68
|
+
borderWidth: 1,
|
|
69
|
+
borderRadius: borderRadius.xs,
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
justifyContent: 'center',
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
export const Kbd = memo(KbdComponent);
|
|
76
|
+
Kbd.displayName = 'Kbd';
|
package/src/kbd/index.ts
ADDED
package/src/kbd/types.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export interface KbdProps {
|
|
4
|
+
/** Key label, e.g. `⌘`, `K`, `Esc`, `Ctrl`. */
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
/** Visual size. Defaults to `'md'`. */
|
|
7
|
+
size?: 'sm' | 'md';
|
|
8
|
+
/** Container style override. */
|
|
9
|
+
style?: StyleProp<ViewStyle>;
|
|
10
|
+
/** Text style override. */
|
|
11
|
+
textStyle?: StyleProp<TextStyle>;
|
|
12
|
+
testID?: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
|
+
|
|
5
|
+
import { Label } from './Label';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Label> = {
|
|
8
|
+
title: 'Forms/Label',
|
|
9
|
+
component: Label,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
|
|
14
|
+
type Story = StoryObj<typeof Label>;
|
|
15
|
+
|
|
16
|
+
export const Basic: Story = {
|
|
17
|
+
args: { children: 'Email address' },
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const Required: Story = {
|
|
21
|
+
args: { children: 'Email address', required: true },
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const Sizes: Story = {
|
|
25
|
+
render: () => (
|
|
26
|
+
<View style={{ gap: 8 }}>
|
|
27
|
+
<Label size="xs">Extra small</Label>
|
|
28
|
+
<Label size="sm">Small (default)</Label>
|
|
29
|
+
<Label size="md">Medium</Label>
|
|
30
|
+
</View>
|
|
31
|
+
),
|
|
32
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useTheme } from '../theme/use-theme';
|
|
5
|
+
import { Text } from '../typography';
|
|
6
|
+
import { atoms as a } from '../styles';
|
|
7
|
+
import { fontSize } from '../styles/tokens';
|
|
8
|
+
import type { LabelProps } from './types';
|
|
9
|
+
|
|
10
|
+
const SIZE_FONT = {
|
|
11
|
+
xs: fontSize.xs,
|
|
12
|
+
sm: fontSize.sm,
|
|
13
|
+
md: fontSize.md,
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Themed form label. A thin wrapper over Bloom's `Text` that applies the
|
|
18
|
+
* label typography (medium weight, secondary color) and optionally renders a
|
|
19
|
+
* required marker. On web it forwards `htmlFor` so a click focuses the
|
|
20
|
+
* associated control.
|
|
21
|
+
*/
|
|
22
|
+
const LabelComponent = function Label({
|
|
23
|
+
children,
|
|
24
|
+
nativeID,
|
|
25
|
+
htmlFor,
|
|
26
|
+
required = false,
|
|
27
|
+
disabled = false,
|
|
28
|
+
size = 'sm',
|
|
29
|
+
style,
|
|
30
|
+
testID,
|
|
31
|
+
}: LabelProps) {
|
|
32
|
+
const theme = useTheme();
|
|
33
|
+
|
|
34
|
+
const webProps: Record<string, unknown> =
|
|
35
|
+
Platform.OS === 'web' ? { htmlFor: htmlFor ?? nativeID } : {};
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Text
|
|
39
|
+
{...webProps}
|
|
40
|
+
nativeID={nativeID}
|
|
41
|
+
testID={testID}
|
|
42
|
+
style={[
|
|
43
|
+
a.font_medium,
|
|
44
|
+
a.mb_sm,
|
|
45
|
+
{
|
|
46
|
+
fontSize: SIZE_FONT[size],
|
|
47
|
+
color: disabled ? theme.colors.textTertiary : theme.colors.textSecondary,
|
|
48
|
+
},
|
|
49
|
+
style,
|
|
50
|
+
]}>
|
|
51
|
+
{children}
|
|
52
|
+
{required ? (
|
|
53
|
+
<Text
|
|
54
|
+
accessibilityLabel="required"
|
|
55
|
+
style={{ color: theme.colors.negative }}>
|
|
56
|
+
{' *'}
|
|
57
|
+
</Text>
|
|
58
|
+
) : null}
|
|
59
|
+
</Text>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const Label = memo(LabelComponent);
|
|
64
|
+
Label.displayName = 'Label';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { StyleProp, TextStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export interface LabelProps {
|
|
4
|
+
/** Label text. */
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* Native ID of the control this label describes. On web, also wires up
|
|
8
|
+
* `htmlFor` so clicking the label focuses the associated input.
|
|
9
|
+
*/
|
|
10
|
+
nativeID?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Web-only convenience: the `id` of the form control this label is for.
|
|
13
|
+
* Defaults to `nativeID` when omitted. Ignored on native.
|
|
14
|
+
*/
|
|
15
|
+
htmlFor?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Render a required marker (an asterisk in the theme's negative color)
|
|
18
|
+
* after the label text. Defaults to `false`.
|
|
19
|
+
*/
|
|
20
|
+
required?: boolean;
|
|
21
|
+
/** Visually subdued label (e.g. for optional fields). Defaults to `false`. */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/** Typography size token. Defaults to `'sm'`. */
|
|
24
|
+
size?: 'xs' | 'sm' | 'md';
|
|
25
|
+
style?: StyleProp<TextStyle>;
|
|
26
|
+
testID?: string;
|
|
27
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
|
+
|
|
5
|
+
import * as Popover from './index';
|
|
6
|
+
import { Button } from '../button';
|
|
7
|
+
import { Item } from '../item';
|
|
8
|
+
import { Text } from '../typography';
|
|
9
|
+
|
|
10
|
+
const meta: Meta = {
|
|
11
|
+
title: 'Overlays/Popover',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
|
|
16
|
+
type Story = StoryObj;
|
|
17
|
+
|
|
18
|
+
export const Basic: Story = {
|
|
19
|
+
render: () => (
|
|
20
|
+
<View style={{ padding: 80 }}>
|
|
21
|
+
<Popover.Root>
|
|
22
|
+
<Popover.Trigger label="Open popover">
|
|
23
|
+
{({ props }) => (
|
|
24
|
+
<Button {...props} onPress={props.onPress}>
|
|
25
|
+
Open popover
|
|
26
|
+
</Button>
|
|
27
|
+
)}
|
|
28
|
+
</Popover.Trigger>
|
|
29
|
+
<Popover.Content label="Account actions" placement="bottom-start">
|
|
30
|
+
<View style={{ minWidth: 200 }}>
|
|
31
|
+
<Item title="Edit profile" density="compact" onPress={() => {}} />
|
|
32
|
+
<Item title="Settings" density="compact" onPress={() => {}} />
|
|
33
|
+
<Item title="Sign out" density="compact" destructive onPress={() => {}} />
|
|
34
|
+
</View>
|
|
35
|
+
</Popover.Content>
|
|
36
|
+
</Popover.Root>
|
|
37
|
+
</View>
|
|
38
|
+
),
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const RichContent: Story = {
|
|
42
|
+
render: () => (
|
|
43
|
+
<View style={{ padding: 80 }}>
|
|
44
|
+
<Popover.Root>
|
|
45
|
+
<Popover.Trigger label="Details">
|
|
46
|
+
{({ props }) => (
|
|
47
|
+
<Button {...props} variant="secondary" onPress={props.onPress}>
|
|
48
|
+
Details
|
|
49
|
+
</Button>
|
|
50
|
+
)}
|
|
51
|
+
</Popover.Trigger>
|
|
52
|
+
<Popover.Content label="Details" placement="bottom" maxWidth={280}>
|
|
53
|
+
<View style={{ padding: 12, gap: 6 }}>
|
|
54
|
+
<Text style={{ fontWeight: '600' }}>Storage</Text>
|
|
55
|
+
<Text>4.2 GB of 10 GB used.</Text>
|
|
56
|
+
</View>
|
|
57
|
+
</Popover.Content>
|
|
58
|
+
</Popover.Root>
|
|
59
|
+
</View>
|
|
60
|
+
),
|
|
61
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
import type { View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import type { PopoverControlProps } from './types';
|
|
5
|
+
|
|
6
|
+
export interface PopoverContextValue {
|
|
7
|
+
control: PopoverControlProps;
|
|
8
|
+
/** Whether the popover is currently open. Drives web rendering. */
|
|
9
|
+
isOpen: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Ref to the trigger wrapper. Web uses it to anchor the floating panel.
|
|
12
|
+
* Native ignores it (it presents a bottom sheet).
|
|
13
|
+
*/
|
|
14
|
+
triggerRef: React.RefObject<View | null>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const PopoverContext = createContext<PopoverContextValue | null>(null);
|
|
18
|
+
PopoverContext.displayName = 'PopoverContext';
|
|
19
|
+
|
|
20
|
+
export function usePopoverContext(): PopoverContextValue {
|
|
21
|
+
const ctx = useContext(PopoverContext);
|
|
22
|
+
if (!ctx) {
|
|
23
|
+
throw new Error('Popover components must be used within a <Popover.Root>');
|
|
24
|
+
}
|
|
25
|
+
return ctx;
|
|
26
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import React, { useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useDialogControl } from '../dialog/context';
|
|
5
|
+
import { SheetShell } from '../dialog/SheetShell';
|
|
6
|
+
import { PopoverContext, usePopoverContext } from './context';
|
|
7
|
+
import type {
|
|
8
|
+
PopoverContentProps,
|
|
9
|
+
PopoverControlProps,
|
|
10
|
+
PopoverRootProps,
|
|
11
|
+
PopoverTriggerProps,
|
|
12
|
+
} from './types';
|
|
13
|
+
|
|
14
|
+
export type {
|
|
15
|
+
PopoverControlProps,
|
|
16
|
+
PopoverContentProps,
|
|
17
|
+
PopoverTriggerProps,
|
|
18
|
+
PopoverRootProps,
|
|
19
|
+
PopoverPlacement,
|
|
20
|
+
PopoverTriggerRenderProps,
|
|
21
|
+
PopoverTriggerState,
|
|
22
|
+
} from './types';
|
|
23
|
+
|
|
24
|
+
export { useDialogControl as usePopoverControl } from '../dialog/context';
|
|
25
|
+
export { usePopoverContext };
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Native `Popover` — presents its content in a bottom sheet (Bloom's
|
|
29
|
+
* established native-overlay convention, shared with `Menu`/`Select`). The
|
|
30
|
+
* web fork (`index.web.tsx`) anchors a floating panel to the trigger.
|
|
31
|
+
*/
|
|
32
|
+
export function Root({ children, control }: PopoverRootProps) {
|
|
33
|
+
const defaultControl = useDialogControl();
|
|
34
|
+
const triggerRef = useRef<View | null>(null);
|
|
35
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
36
|
+
|
|
37
|
+
const activeControl = control ?? defaultControl;
|
|
38
|
+
|
|
39
|
+
// Wrap the control so `isOpen` reflects open/close on native too.
|
|
40
|
+
const wrappedControl = useMemo<PopoverControlProps>(
|
|
41
|
+
() => ({
|
|
42
|
+
...activeControl,
|
|
43
|
+
open: () => {
|
|
44
|
+
setIsOpen(true);
|
|
45
|
+
activeControl.open();
|
|
46
|
+
},
|
|
47
|
+
close: (cb) => {
|
|
48
|
+
setIsOpen(false);
|
|
49
|
+
activeControl.close(cb);
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
52
|
+
[activeControl],
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const context = useMemo(
|
|
56
|
+
() => ({ control: wrappedControl, isOpen, triggerRef }),
|
|
57
|
+
[wrappedControl, isOpen],
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<PopoverContext.Provider value={context}>
|
|
62
|
+
{children}
|
|
63
|
+
</PopoverContext.Provider>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function Trigger({ children, label }: PopoverTriggerProps) {
|
|
68
|
+
const { control, triggerRef } = usePopoverContext();
|
|
69
|
+
const [focused, setFocused] = useState(false);
|
|
70
|
+
const [pressed, setPressed] = useState(false);
|
|
71
|
+
|
|
72
|
+
const rendered = children({
|
|
73
|
+
control,
|
|
74
|
+
state: { hovered: false, focused, pressed },
|
|
75
|
+
props: {
|
|
76
|
+
onPress: () => control.open(),
|
|
77
|
+
onFocus: () => setFocused(true),
|
|
78
|
+
onBlur: () => setFocused(false),
|
|
79
|
+
accessibilityLabel: label,
|
|
80
|
+
accessibilityRole: 'button',
|
|
81
|
+
'aria-haspopup': 'dialog',
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<View ref={triggerRef} collapsable={false}>
|
|
87
|
+
{rendered}
|
|
88
|
+
</View>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function Content({
|
|
93
|
+
children,
|
|
94
|
+
label = 'Popover',
|
|
95
|
+
style,
|
|
96
|
+
}: PopoverContentProps) {
|
|
97
|
+
const { control } = usePopoverContext();
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<SheetShell control={control} label={label} contentStyle={style}>
|
|
101
|
+
{children}
|
|
102
|
+
</SheetShell>
|
|
103
|
+
);
|
|
104
|
+
}
|