@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
|
@@ -5,9 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.buildNativePresetStyle = buildNativePresetStyle;
|
|
7
7
|
exports.buildScopeVars = buildScopeVars;
|
|
8
|
+
exports.getVariableContextProvider = getVariableContextProvider;
|
|
8
9
|
var _reactNative = require("react-native");
|
|
9
10
|
var _presetVars = require("../preset-vars.js");
|
|
10
11
|
var _lazyRequire = require("../../utils/lazy-require.js");
|
|
12
|
+
/**
|
|
13
|
+
* Component that provides inline CSS variables to a subtree via NativeWind's
|
|
14
|
+
* (react-native-css's) real `VariableContext`. The runtime strips the leading
|
|
15
|
+
* `--` from each key internally, so we feed it the full `--name -> value`
|
|
16
|
+
* record produced by `buildScopeVars`.
|
|
17
|
+
*/
|
|
18
|
+
|
|
11
19
|
const getNativeWindVars = (0, _lazyRequire.lazyRequire)('nativewind');
|
|
12
20
|
|
|
13
21
|
/**
|
|
@@ -21,11 +29,38 @@ function buildScopeVars(colorPreset, mode) {
|
|
|
21
29
|
});
|
|
22
30
|
}
|
|
23
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Resolve NativeWind's `VariableContextProvider` — the canonical, non-deprecated
|
|
34
|
+
* react-native-css v3 API for providing inline CSS variables to a subtree. It
|
|
35
|
+
* reads the same `VariableContext` that interop className components consume, so
|
|
36
|
+
* descendants resolve `var(--primary)` etc. correctly. Returns `null` on web or
|
|
37
|
+
* when `nativewind` is not installed.
|
|
38
|
+
*
|
|
39
|
+
* This replaces the deprecated `vars()`-on-a-plain-`<View>`-style mechanism:
|
|
40
|
+
* under react-native-css@3, `vars()` returns an inline-vars marker that is only
|
|
41
|
+
* propagated to children when the host element matches className style rules
|
|
42
|
+
* (`usesVariables`/`variables`). A plain `<View>` with no `className` drops the
|
|
43
|
+
* vars silently, so the subtree renders without the preset palette.
|
|
44
|
+
*/
|
|
45
|
+
function getVariableContextProvider() {
|
|
46
|
+
if (_reactNative.Platform.OS === 'web') return null;
|
|
47
|
+
const module = getNativeWindVars();
|
|
48
|
+
if (!module || typeof module.VariableContextProvider !== 'function') return null;
|
|
49
|
+
return module.VariableContextProvider;
|
|
50
|
+
}
|
|
51
|
+
|
|
24
52
|
/**
|
|
25
53
|
* Build a native style object carrying every CSS var of the preset, using
|
|
26
54
|
* NativeWind's `vars()` when available. Returns `undefined` on web (where the
|
|
27
55
|
* provider writes vars to `documentElement` instead) or when `nativewind` is
|
|
28
56
|
* not installed.
|
|
57
|
+
*
|
|
58
|
+
* @deprecated Under react-native-css@3, `vars()` only propagates to a subtree
|
|
59
|
+
* when applied to an interop className component (the runtime gates propagation
|
|
60
|
+
* on matched className style rules). Applied to a plain `<View>` the vars are
|
|
61
|
+
* dropped silently. Prefer wrapping children in `getVariableContextProvider()`.
|
|
62
|
+
* Retained only as the escape-hatch contract of `useColorScopeStyle`, where the
|
|
63
|
+
* caller owns the host element and is expected to be a className component.
|
|
29
64
|
*/
|
|
30
65
|
function buildNativePresetStyle(colorPreset, mode) {
|
|
31
66
|
if (_reactNative.Platform.OS === 'web') return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_presetVars","_lazyRequire","getNativeWindVars","lazyRequire","buildScopeVars","colorPreset","mode","getPresetVars","includeResolvedColorVars","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_presetVars","_lazyRequire","getNativeWindVars","lazyRequire","buildScopeVars","colorPreset","mode","getPresetVars","includeResolvedColorVars","getVariableContextProvider","Platform","OS","module","VariableContextProvider","buildNativePresetStyle","undefined","vars"],"sourceRoot":"../../../../src","sources":["theme/color-scope/style-builder.ts"],"mappings":";;;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;;AAWA,MAAMG,iBAAiB,GAAG,IAAAC,wBAAW,EAAuB,YAAY,CAAC;;AAEzE;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAC5BC,WAAyB,EACzBC,IAAsB,EACE;EACxB,OAAO,IAAAC,yBAAa,EAACF,WAAW,EAAEC,IAAI,EAAE;IAAEE,wBAAwB,EAAE;EAAK,CAAC,CAAC;AAC7E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,0BAA0BA,CAAA,EAA4C;EACpF,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE,OAAO,IAAI;EACtC,MAAMC,MAAM,GAAGV,iBAAiB,CAAC,CAAC;EAClC,IAAI,CAACU,MAAM,IAAI,OAAOA,MAAM,CAACC,uBAAuB,KAAK,UAAU,EAAE,OAAO,IAAI;EAChF,OAAOD,MAAM,CAACC,uBAAuB;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,sBAAsBA,CACpCT,WAAyB,EACzBC,IAAsB,EACA;EACtB,IAAII,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE,OAAOI,SAAS;EAC3C,MAAMH,MAAM,GAAGV,iBAAiB,CAAC,CAAC;EAClC,IAAI,CAACU,MAAM,IAAI,OAAOA,MAAM,CAACI,IAAI,KAAK,UAAU,EAAE,OAAOD,SAAS;EAClE,OAAOH,MAAM,CAACI,IAAI,CAACZ,cAAc,CAACC,WAAW,EAAEC,IAAI,CAAC,CAAC;AACvD","ignoreList":[]}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.applyNativeRootVars = applyNativeRootVars;
|
|
7
|
+
var _nativeInternal = require("react-native-css/native-internal");
|
|
8
|
+
var _styleBuilder = require("./color-scope/style-builder.js");
|
|
9
|
+
/**
|
|
10
|
+
* Publish the active color preset's CSS custom properties into react-native-css's
|
|
11
|
+
* GLOBAL root-variable family so they reach the ENTIRE native app tree — including
|
|
12
|
+
* content rendered outside the React subtree of `BloomThemeProvider`: expo-router
|
|
13
|
+
* navigator screens, `Portal`s, `Dialog`/`BottomSheet` overlays, and any other host
|
|
14
|
+
* that paints through a separate React root.
|
|
15
|
+
*
|
|
16
|
+
* Why a global write is required (native only)
|
|
17
|
+
* --------------------------------------------
|
|
18
|
+
* react-native-css resolves a `var(--x)` reference (its `varResolver`) in this order:
|
|
19
|
+
* 1. `name in inheritedVariables` — the React-context-inherited vars. This is what
|
|
20
|
+
* `VariableContextProvider` populates, but it is React-context-scoped, so it only
|
|
21
|
+
* reaches *direct descendants* of the provider in the React tree.
|
|
22
|
+
* 2. `inlineVariables[name]` — same-component inline vars.
|
|
23
|
+
* 3. `variables[name]` — resolved inherited vars.
|
|
24
|
+
* 4. `universalVariables(name)` — a GLOBAL observable family.
|
|
25
|
+
* 5. `rootVariables(name)` — a GLOBAL observable family.
|
|
26
|
+
* 6. the declared fallback.
|
|
27
|
+
*
|
|
28
|
+
* `BloomThemeProvider`'s `VariableContextProvider` only feeds path #1, so the navigator
|
|
29
|
+
* host and every portal/modal — which render outside that subtree — never see the
|
|
30
|
+
* preset vars and fall through to `rootVariables`/`universalVariables`. By default those
|
|
31
|
+
* families hold only react-native-css's own `__rn-css-rem`/`__rn-css-color` entries
|
|
32
|
+
* (Bloom's `global.css` defines the `hsl(var(--primary))` indirection but not the HSL
|
|
33
|
+
* triples themselves — those are injected at runtime), so the whole tree below the
|
|
34
|
+
* navigator renders monochrome. Writing the triples into `rootVariables` here is the
|
|
35
|
+
* exact same mechanism react-native-css uses for compiled `:root {}` / `@theme` vars
|
|
36
|
+
* (`StyleCollection.inject` does `rootVariables(name).set(valueArray)`), so portaled
|
|
37
|
+
* content resolves the palette identically regardless of React-tree position.
|
|
38
|
+
*
|
|
39
|
+
* Why a STATIC `import`, not a runtime `require` (critical)
|
|
40
|
+
* ---------------------------------------------------------
|
|
41
|
+
* react-native-css@3.0.7 ships both a `dist/commonjs` and a `dist/module` build, and
|
|
42
|
+
* Metro bundles BOTH. In `native-internal/root.js` the variable families are plain
|
|
43
|
+
* module-local consts — NOT `globalThis`-guarded the way `StyleCollection` is — so the
|
|
44
|
+
* commonjs `root.js` and the module `root.js` each instantiate their OWN separate
|
|
45
|
+
* `rootVariables` family. The react-native-css renderer (`react-native-css/src/components/View.tsx`
|
|
46
|
+
* → `varResolver`) imports its `root.js` via ESM `import`, i.e. the MODULE build. A
|
|
47
|
+
* runtime `require('react-native-css/native-internal')` resolves the package's `require`
|
|
48
|
+
* export condition → the COMMONJS build → a DIFFERENT family the renderer never
|
|
49
|
+
* subscribes to, so the writes are a silent no-op on device. A static top-level
|
|
50
|
+
* `import` resolves the `import` condition → the MODULE build → the renderer's instance.
|
|
51
|
+
*
|
|
52
|
+
* This plain file is the NATIVE/default variant (Metro selects it on iOS/Android,
|
|
53
|
+
* which have no `.native` override here); the web variant lives in the sibling
|
|
54
|
+
* `native-root-vars.web.ts` no-op, which web bundlers pick over this one. So the
|
|
55
|
+
* static `react-native-css/native-internal` import below is never pulled into a web
|
|
56
|
+
* bundle — only into native. This mirrors Bloom's existing platform-split convention
|
|
57
|
+
* (`color-scope/index.tsx` + `color-scope/index.web.tsx`, `FontLoader.native.tsx`).
|
|
58
|
+
*
|
|
59
|
+
* Keying contract (verified against react-native-css@3.0.7)
|
|
60
|
+
* ---------------------------------------------------------
|
|
61
|
+
* The `rootVariables` family is keyed by the BARE variable name, WITHOUT the leading
|
|
62
|
+
* `--`. The compiler strips it uniformly: a `:root { --primary: ... }` declaration is
|
|
63
|
+
* stored via `rule.v.push([property.slice(2), value])` then routed into
|
|
64
|
+
* `shared.rootVariables[name]`, and `@property --x` goes through
|
|
65
|
+
* `name.startsWith("--") ? name.slice(2) : name`. The lookup side matches: a `var(--x)`
|
|
66
|
+
* reference compiles to `[{}, "var", ident.slice(2)]`, so `varResolver` looks up the
|
|
67
|
+
* bare name. `buildScopeVars` returns keys WITH the `--` prefix, so we strip it before
|
|
68
|
+
* writing each entry.
|
|
69
|
+
*
|
|
70
|
+
* Value shape
|
|
71
|
+
* -----------
|
|
72
|
+
* Each entry is a `VariableValue[]` — an array of `[value, mediaCondition?]` tuples.
|
|
73
|
+
* Bloom's preset vars are unconditional, so each is a single-element `[[value]]`, e.g.
|
|
74
|
+
* `rootVariables('primary').set([['205 87% 53%']])`. This is the same shape the compiler
|
|
75
|
+
* emits for unconditional `:root` vars.
|
|
76
|
+
*
|
|
77
|
+
* This is native-only and additive: the `VariableContextProvider` wrapper stays (it is
|
|
78
|
+
* the correct, scoped mechanism for `BloomColorScope` subtree overrides and harmlessly
|
|
79
|
+
* covers direct descendants). The web fork (`native-root-vars.web.ts`) no-ops — web
|
|
80
|
+
* writes the same vars to `document.documentElement` via `applyColorPresetVars`.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Write the preset's CSS vars to react-native-css's global `rootVariables` family
|
|
85
|
+
* so the whole native tree (navigator screens + portals/modals/bottom-sheets)
|
|
86
|
+
* resolves the active palette.
|
|
87
|
+
*
|
|
88
|
+
* Each `.set` notifies its own observers synchronously (react-native-css only
|
|
89
|
+
* batches notifications inside its own `StyleCollection.inject`; outside it,
|
|
90
|
+
* `observableBatch.current` is unset so every `.set` runs observers immediately),
|
|
91
|
+
* so sequential writes correctly trigger a re-render when the preset/mode changes.
|
|
92
|
+
*
|
|
93
|
+
* Defensive guard: if a host ships a react-native-css build that doesn't expose
|
|
94
|
+
* `rootVariables` as a callable (it always does on @3), we bail rather than throw.
|
|
95
|
+
*/
|
|
96
|
+
function applyNativeRootVars(colorPreset, mode) {
|
|
97
|
+
if (typeof _nativeInternal.rootVariables !== 'function') return;
|
|
98
|
+
const vars = (0, _styleBuilder.buildScopeVars)(colorPreset, mode);
|
|
99
|
+
for (const [key, value] of Object.entries(vars)) {
|
|
100
|
+
// The family is keyed by the bare name; `buildScopeVars` keys include `--`.
|
|
101
|
+
const name = key.startsWith('--') ? key.slice(2) : key;
|
|
102
|
+
(0, _nativeInternal.rootVariables)(name).set([[value]]);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=native-root-vars.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_nativeInternal","require","_styleBuilder","applyNativeRootVars","colorPreset","mode","rootVariables","vars","buildScopeVars","key","value","Object","entries","name","startsWith","slice","set"],"sourceRoot":"../../../src","sources":["theme/native-root-vars.ts"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,mBAAmBA,CAACC,WAAyB,EAAEC,IAAsB,EAAQ;EAC3F,IAAI,OAAOC,6BAAa,KAAK,UAAU,EAAE;EAEzC,MAAMC,IAAI,GAAG,IAAAC,4BAAc,EAACJ,WAAW,EAAEC,IAAI,CAAC;EAC9C,KAAK,MAAM,CAACI,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACL,IAAI,CAAC,EAAE;IAC/C;IACA,MAAMM,IAAI,GAAGJ,GAAG,CAACK,UAAU,CAAC,IAAI,CAAC,GAAGL,GAAG,CAACM,KAAK,CAAC,CAAC,CAAC,GAAGN,GAAG;IACtD,IAAAH,6BAAa,EAACO,IAAI,CAAC,CAACG,GAAG,CAAC,CAAC,CAACN,KAAK,CAAC,CAAC,CAAC;EACpC;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.applyNativeRootVars = applyNativeRootVars;
|
|
7
|
+
/**
|
|
8
|
+
* Web fork of `applyNativeRootVars` — a no-op.
|
|
9
|
+
*
|
|
10
|
+
* On web, `BloomThemeProvider` already writes the active preset's CSS vars to
|
|
11
|
+
* `document.documentElement` via `applyColorPresetVars`, which the browser /
|
|
12
|
+
* react-native-web resolve natively. The native/default variant — the plain
|
|
13
|
+
* sibling `native-root-vars.ts` — instead publishes those vars into
|
|
14
|
+
* react-native-css's GLOBAL `rootVariables` family.
|
|
15
|
+
*
|
|
16
|
+
* Keeping the native variant's `react-native-css/native-internal` import out of
|
|
17
|
+
* the web bundle is the whole reason this is a platform-split module: web (and
|
|
18
|
+
* any non-NativeWind host) picks this `.web` fork over the plain file and so
|
|
19
|
+
* never statically pulls react-native-css internals.
|
|
20
|
+
*
|
|
21
|
+
* The signature is intentionally identical to the plain variant so the import
|
|
22
|
+
* site in `BloomThemeProvider` is platform-agnostic.
|
|
23
|
+
*/
|
|
24
|
+
function applyNativeRootVars(_colorPreset, _mode) {
|
|
25
|
+
// Intentionally empty — web applies preset vars to `document.documentElement`.
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=native-root-vars.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["applyNativeRootVars","_colorPreset","_mode"],"sourceRoot":"../../../src","sources":["theme/native-root-vars.web.ts"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAmBA,CAACC,YAA0B,EAAEC,KAAuB,EAAQ;EAC7F;AAAA","ignoreList":[]}
|
|
@@ -54,7 +54,10 @@ function getPresetVars(colorName, mode, options = {}) {
|
|
|
54
54
|
const isDark = mode === 'dark';
|
|
55
55
|
const extended = {
|
|
56
56
|
...base,
|
|
57
|
-
|
|
57
|
+
// Light cards carry the same faint preset tint as `--popover` (H 12% 99%)
|
|
58
|
+
// so they read as part of the preset family rather than a pure-white slab —
|
|
59
|
+
// mirroring how dark cards (H 30% 10%) carry the accent hue into near-black.
|
|
60
|
+
'--card': isDark ? `${hue} 30% 10%` : `${hue} 12% 99%`,
|
|
58
61
|
'--card-foreground': foreground,
|
|
59
62
|
'--chart-1': `${hue} ${sat}% 85%`,
|
|
60
63
|
'--chart-2': `${hue} ${sat}% 75%`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_colorPresets","extractHue","hslVar","parseInt","split","extractSat","RESOLVED_COLOR_MAP","getPresetVars","colorName","mode","options","preset","APP_COLOR_PRESETS","base","light","dark","get","key","primary","foreground","hue","sat","Math","min","isDark","extended","includeResolvedColorVars","resolved","rawKey","colorKey","Object","entries","value","applyPresetVarsToDocument","Platform","OS","document","vars","root","documentElement","style","setProperty"],"sourceRoot":"../../../src","sources":["theme/preset-vars.ts"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAEA,SAASE,UAAUA,CAACC,MAAc,EAAU;EAC1C,OAAOC,QAAQ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CAAC;EAChC,MAAMG,UAAU,GAAGH,GAAG,CAAC,cAAc,CAAC;EACtC,MAAMI,GAAG,GAAGnB,UAAU,CAACiB,OAAO,CAAC;EAC/B,MAAMG,GAAG,GAAGC,IAAI,CAACC,GAAG,CAAClB,UAAU,CAACa,OAAO,CAAC,EAAE,EAAE,CAAC;EAC7C,MAAMM,MAAM,GAAGf,IAAI,KAAK,MAAM;EAE9B,MAAMgB,QAAsB,GAAG;IAC7B,GAAGZ,IAAI;IACP,QAAQ,EAAEW,MAAM,GAAG,GAAGJ,GAAG,UAAU,GAAG,
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_colorPresets","extractHue","hslVar","parseInt","split","extractSat","RESOLVED_COLOR_MAP","getPresetVars","colorName","mode","options","preset","APP_COLOR_PRESETS","base","light","dark","get","key","primary","foreground","hue","sat","Math","min","isDark","extended","includeResolvedColorVars","resolved","rawKey","colorKey","Object","entries","value","applyPresetVarsToDocument","Platform","OS","document","vars","root","documentElement","style","setProperty"],"sourceRoot":"../../../src","sources":["theme/preset-vars.ts"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAEA,SAASE,UAAUA,CAACC,MAAc,EAAU;EAC1C,OAAOC,QAAQ,CAACD,MAAM,CAACE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,EAAE,CAAC;AAClD;AAEA,SAASC,UAAUA,CAACH,MAAc,EAAU;EAC1C,OAAOC,QAAQ,CAACD,MAAM,CAACE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,EAAE,CAAC;AAClD;AAEA,MAAME,kBAA0C,GAAG;EACjD,cAAc,EAAE,oBAAoB;EACpC,cAAc,EAAE,oBAAoB;EACpC,WAAW,EAAE,iBAAiB;EAC9B,sBAAsB,EAAE,4BAA4B;EACpD,aAAa,EAAE,mBAAmB;EAClC,wBAAwB,EAAE,8BAA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C,OAA2B,EACrB;EACN,IAAIwB,qBAAQ,CAACC,EAAE,KAAK,KAAK,IAAI,OAAOC,QAAQ,KAAK,WAAW,EAAE;EAE9D,MAAMC,IAAI,GAAG9B,aAAa,CAACC,SAAS,EAAEC,IAAI,EAAEC,OAAO,CAAC;EACpD,MAAM4B,IAAI,GAAGF,QAAQ,CAACG,eAAe,CAACC,KAAK;EAC3C,KAAK,MAAM,CAACvB,GAAG,EAAEe,KAAK,CAAC,IAAIF,MAAM,CAACC,OAAO,CAACM,IAAI,CAAC,EAAE;IAC/CC,IAAI,CAACG,WAAW,CAACxB,GAAG,EAAEe,KAAK,CAAC;EAC9B;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { memo, useCallback } from 'react';
|
|
4
|
+
import { StyleSheet, View } from 'react-native';
|
|
5
|
+
import { Button } from "../button/index.js";
|
|
6
|
+
import { useTheme } from "../theme/use-theme.js";
|
|
7
|
+
import { Text } from "../typography/index.js";
|
|
8
|
+
import { fontSize, space } from "../styles/tokens.js";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
/**
|
|
11
|
+
* Build the `AlertDialog` component bound to a platform `CenteredDialog`.
|
|
12
|
+
*
|
|
13
|
+
* `CenteredDialog` is platform-forked (native RN `Modal` vs pure-DOM web
|
|
14
|
+
* overlay), and this repo never relies on implicit `.web` resolution — the
|
|
15
|
+
* platform entry files (`index.ts` / `index.web.ts`) inject the correct
|
|
16
|
+
* `CenteredDialog` here. The body below is single-source, no duplication.
|
|
17
|
+
*
|
|
18
|
+
* `AlertDialog` is a thin wrapper over `CenteredDialog` that lays out a title,
|
|
19
|
+
* description and a confirm/cancel action row. Reach for the imperative
|
|
20
|
+
* `confirm()` helper + `<AlertDialogHost />` to trigger a confirm from an
|
|
21
|
+
* event handler without owning visible state.
|
|
22
|
+
*/
|
|
23
|
+
export function createAlertDialog(CenteredDialog) {
|
|
24
|
+
const AlertDialogComponent = function AlertDialog({
|
|
25
|
+
visible,
|
|
26
|
+
onClose,
|
|
27
|
+
title,
|
|
28
|
+
description,
|
|
29
|
+
confirmLabel = 'Confirm',
|
|
30
|
+
cancelLabel = 'Cancel',
|
|
31
|
+
onConfirm,
|
|
32
|
+
onCancel,
|
|
33
|
+
destructive = false,
|
|
34
|
+
hideCancel = false,
|
|
35
|
+
dismissible = false,
|
|
36
|
+
cardStyle,
|
|
37
|
+
testID
|
|
38
|
+
}) {
|
|
39
|
+
const theme = useTheme();
|
|
40
|
+
const handleCancel = useCallback(() => {
|
|
41
|
+
onCancel?.();
|
|
42
|
+
onClose();
|
|
43
|
+
}, [onCancel, onClose]);
|
|
44
|
+
const handleConfirm = useCallback(() => {
|
|
45
|
+
onConfirm?.();
|
|
46
|
+
onClose();
|
|
47
|
+
}, [onConfirm, onClose]);
|
|
48
|
+
return /*#__PURE__*/_jsx(CenteredDialog, {
|
|
49
|
+
visible: visible,
|
|
50
|
+
onClose: dismissible ? onClose : () => {},
|
|
51
|
+
dismissible: dismissible,
|
|
52
|
+
title: title,
|
|
53
|
+
showClose: false,
|
|
54
|
+
accessibilityLabel: title,
|
|
55
|
+
cardStyle: cardStyle,
|
|
56
|
+
testID: testID,
|
|
57
|
+
footer: /*#__PURE__*/_jsxs(View, {
|
|
58
|
+
style: styles.actions,
|
|
59
|
+
children: [!hideCancel ? /*#__PURE__*/_jsx(Button, {
|
|
60
|
+
variant: "secondary",
|
|
61
|
+
size: "medium",
|
|
62
|
+
onPress: handleCancel,
|
|
63
|
+
style: styles.action,
|
|
64
|
+
accessibilityLabel: cancelLabel,
|
|
65
|
+
children: cancelLabel
|
|
66
|
+
}) : null, /*#__PURE__*/_jsx(Button, {
|
|
67
|
+
variant: "primary",
|
|
68
|
+
size: "medium",
|
|
69
|
+
onPress: handleConfirm,
|
|
70
|
+
style: [styles.action, destructive && {
|
|
71
|
+
backgroundColor: theme.colors.negative
|
|
72
|
+
}],
|
|
73
|
+
textStyle: destructive ? {
|
|
74
|
+
color: theme.colors.negativeForeground
|
|
75
|
+
} : undefined,
|
|
76
|
+
accessibilityLabel: confirmLabel,
|
|
77
|
+
children: confirmLabel
|
|
78
|
+
})]
|
|
79
|
+
}),
|
|
80
|
+
children: description ? /*#__PURE__*/_jsx(Text, {
|
|
81
|
+
style: {
|
|
82
|
+
fontSize: fontSize.md,
|
|
83
|
+
lineHeight: fontSize.md * 1.4,
|
|
84
|
+
color: theme.colors.textSecondary
|
|
85
|
+
},
|
|
86
|
+
children: description
|
|
87
|
+
}) : null
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
const AlertDialog = /*#__PURE__*/memo(AlertDialogComponent);
|
|
91
|
+
AlertDialog.displayName = 'AlertDialog';
|
|
92
|
+
return AlertDialog;
|
|
93
|
+
}
|
|
94
|
+
const styles = StyleSheet.create({
|
|
95
|
+
actions: {
|
|
96
|
+
flexDirection: 'row',
|
|
97
|
+
justifyContent: 'flex-end',
|
|
98
|
+
gap: space.sm
|
|
99
|
+
},
|
|
100
|
+
action: {
|
|
101
|
+
minWidth: 96
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
//# sourceMappingURL=AlertDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","memo","useCallback","StyleSheet","View","Button","useTheme","Text","fontSize","space","jsx","_jsx","jsxs","_jsxs","createAlertDialog","CenteredDialog","AlertDialogComponent","AlertDialog","visible","onClose","title","description","confirmLabel","cancelLabel","onConfirm","onCancel","destructive","hideCancel","dismissible","cardStyle","testID","theme","handleCancel","handleConfirm","showClose","accessibilityLabel","footer","style","styles","actions","children","variant","size","onPress","action","backgroundColor","colors","negative","textStyle","color","negativeForeground","undefined","md","lineHeight","textSecondary","displayName","create","flexDirection","justifyContent","gap","sm","minWidth"],"sourceRoot":"../../../src","sources":["alert-dialog/AlertDialog.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,I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vC,OAAOtC,WAAW;AACpB;AAIA,MAAMqB,MAAM,GAAGnC,UAAU,CAACqD,MAAM,CAAC;EAC/BjB,OAAO,EAAE;IACPkB,aAAa,EAAE,KAAK;IACpBC,cAAc,EAAE,UAAU;IAC1BC,GAAG,EAAElD,KAAK,CAACmD;EACb,CAAC;EACDhB,MAAM,EAAE;IACNiB,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useEffect, useState } from 'react';
|
|
4
|
+
import { resolveConfirm, subscribeConfirms } from "./confirm-store.js";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
/**
|
|
7
|
+
* Build the `<AlertDialogHost />` bound to a platform `AlertDialog`. The
|
|
8
|
+
* platform entry files (`index.ts` / `index.web.ts`) inject the correct one.
|
|
9
|
+
*
|
|
10
|
+
* The host mounts the imperative `confirm()` UI. Wrap your app root once
|
|
11
|
+
* (after `BloomThemeProvider`) and you can call `confirm()` from anywhere —
|
|
12
|
+
* including before the host mounts (entries are queued and drained on
|
|
13
|
+
* subscribe). Confirms present one at a time in FIFO order.
|
|
14
|
+
*/
|
|
15
|
+
export function createAlertDialogHost(AlertDialog) {
|
|
16
|
+
function ConfirmHost({
|
|
17
|
+
entry
|
|
18
|
+
}) {
|
|
19
|
+
return /*#__PURE__*/_jsx(AlertDialog, {
|
|
20
|
+
visible: true,
|
|
21
|
+
title: entry.title,
|
|
22
|
+
description: entry.description,
|
|
23
|
+
confirmLabel: entry.confirmLabel,
|
|
24
|
+
cancelLabel: entry.cancelLabel,
|
|
25
|
+
destructive: entry.destructive,
|
|
26
|
+
hideCancel: entry.hideCancel,
|
|
27
|
+
dismissible: entry.dismissible,
|
|
28
|
+
onConfirm: () => resolveConfirm(entry.id, true),
|
|
29
|
+
onCancel: () => resolveConfirm(entry.id, false),
|
|
30
|
+
onClose: () => resolveConfirm(entry.id, false)
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function AlertDialogHost() {
|
|
34
|
+
const [queue, setQueue] = useState([]);
|
|
35
|
+
useEffect(() => subscribeConfirms(setQueue), []);
|
|
36
|
+
const head = queue[0];
|
|
37
|
+
if (!head) return null;
|
|
38
|
+
return /*#__PURE__*/_jsx(ConfirmHost, {
|
|
39
|
+
entry: head
|
|
40
|
+
}, head.id);
|
|
41
|
+
}
|
|
42
|
+
AlertDialogHost.displayName = 'AlertDialogHost';
|
|
43
|
+
return AlertDialogHost;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=AlertDialogHost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useEffect","useState","resolveConfirm","subscribeConfirms","jsx","_jsx","createAlertDialogHost","AlertDialog","ConfirmHost","entry","visible","title","description","confirmLabel","cancelLabel","destructive","hideCancel","dismissible","onConfirm","id","onCancel","onClose","AlertDialogHost","queue","setQueue","head","displayName"],"sourceRoot":"../../../src","sources":["alert-dialog/AlertDialogHost.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAElD,SACEC,cAAc,EACdC,iBAAiB,QAEZ,oBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAACC,WAA4B,EAAE;EAClE,SAASC,WAAWA,CAAC;IAAEC;EAA+B,CAAC,EAAE;IACvD,oBACEJ,IAAA,CAACE,WAAW;MACVG,OAAO;MACPC,KAAK,EAAEF,KAAK,CAACE,KAAM;MACnBC,WAAW,EAAEH,KAAK,CAACG,WAAY;MAC/BC,YAAY,EAAEJ,KAAK,CAACI,YAAa;MACjCC,WAAW,EAAEL,KAAK,CAACK,WAAY;MAC/BC,WAAW,EAAEN,KAAK,CAACM,WAAY;MAC/BC,UAAU,EAAEP,KAAK,CAACO,UAAW;MAC7BC,WAAW,EAAER,KAAK,CAACQ,WAAY;MAC/BC,SAAS,EAAEA,CAAA,KAAMhB,cAAc,CAACO,KAAK,CAACU,EAAE,EAAE,IAAI,CAAE;MAChDC,QAAQ,EAAEA,CAAA,KAAMlB,cAAc,CAACO,KAAK,CAACU,EAAE,EAAE,KAAK,CAAE;MAChDE,OAAO,EAAEA,CAAA,KAAMnB,cAAc,CAACO,KAAK,CAACU,EAAE,EAAE,KAAK;IAAE,CAChD,CAAC;EAEN;EAEA,SAASG,eAAeA,CAAA,EAAG;IACzB,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGvB,QAAQ,CAA0B,EAAE,CAAC;IAE/DD,SAAS,CAAC,MAAMG,iBAAiB,CAACqB,QAAQ,CAAC,EAAE,EAAE,CAAC;IAEhD,MAAMC,IAAI,GAAGF,KAAK,CAAC,CAAC,CAAC;IACrB,IAAI,CAACE,IAAI,EAAE,OAAO,IAAI;IAEtB,oBAAOpB,IAAA,CAACG,WAAW;MAAeC,KAAK,EAAEgB;IAAK,GAArBA,IAAI,CAACN,EAAkB,CAAC;EACnD;EACAG,eAAe,CAACI,WAAW,GAAG,iBAAiB;EAE/C,OAAOJ,eAAe;AACxB","ignoreList":[]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Imperative confirm store.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors the `dialog/alert-store` pattern: a module-scope queue + a single
|
|
7
|
+
* subscriber (the `<AlertDialogHost />` mounted in the app tree). `confirm()`
|
|
8
|
+
* enqueues an entry and resolves a promise with the user's choice. Entries
|
|
9
|
+
* enqueued before the host mounts drain on subscribe — no lost confirms.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
let idCounter = 0;
|
|
13
|
+
function genId() {
|
|
14
|
+
idCounter += 1;
|
|
15
|
+
return `bloom-confirm-${idCounter}`;
|
|
16
|
+
}
|
|
17
|
+
let queue = [];
|
|
18
|
+
let listener = null;
|
|
19
|
+
function emit() {
|
|
20
|
+
if (listener) listener(queue);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Show a Bloom confirm dialog and resolve with the user's choice.
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* const ok = await confirm({
|
|
28
|
+
* title: 'Delete app?',
|
|
29
|
+
* description: 'This cannot be undone.',
|
|
30
|
+
* confirmLabel: 'Delete',
|
|
31
|
+
* destructive: true,
|
|
32
|
+
* });
|
|
33
|
+
* if (ok) await doDelete();
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export function confirm(options) {
|
|
37
|
+
return new Promise(resolve => {
|
|
38
|
+
const id = genId();
|
|
39
|
+
queue = [...queue, {
|
|
40
|
+
...options,
|
|
41
|
+
id,
|
|
42
|
+
resolve
|
|
43
|
+
}];
|
|
44
|
+
emit();
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Resolve and remove an entry. Called by the host on confirm/cancel/dismiss. */
|
|
49
|
+
export function resolveConfirm(id, confirmed) {
|
|
50
|
+
const entry = queue.find(e => e.id === id);
|
|
51
|
+
if (!entry) return;
|
|
52
|
+
queue = queue.filter(e => e.id !== id);
|
|
53
|
+
entry.resolve(confirmed);
|
|
54
|
+
emit();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Subscribe to queue changes (single-subscriber model; latest wins). Delivers
|
|
59
|
+
* the current queue synchronously so a freshly mounted host catches up.
|
|
60
|
+
*/
|
|
61
|
+
export function subscribeConfirms(fn) {
|
|
62
|
+
listener = fn;
|
|
63
|
+
fn(queue);
|
|
64
|
+
return () => {
|
|
65
|
+
if (listener === fn) listener = null;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Inspect the current queue. Used by tests. */
|
|
70
|
+
export function getConfirmQueue() {
|
|
71
|
+
return queue;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=confirm-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["idCounter","genId","queue","listener","emit","confirm","options","Promise","resolve","id","resolveConfirm","confirmed","entry","find","e","filter","subscribeConfirms","fn","getConfirmQueue"],"sourceRoot":"../../../src","sources":["alert-dialog/confirm-store.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAIA,SAAS,GAAG,CAAC;AACjB,SAASC,KAAKA,CAAA,EAAW;EACvBD,SAAS,IAAI,CAAC;EACd,OAAO,iBAAiBA,SAAS,EAAE;AACrC;AASA,IAAIE,KAAqB,GAAG,EAAE;AAC9B,IAAIC,QAAyB,GAAG,IAAI;AAEpC,SAASC,IAAIA,CAAA,EAAS;EACpB,IAAID,QAAQ,EAAEA,QAAQ,CAACD,KAAK,CAAC;AAC/B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,OAAOA,CAACC,OAAuB,EAAoB;EACjE,OAAO,IAAIC,OAAO,CAAWC,OAAO,IAAK;IACvC,MAAMC,EAAE,GAAGR,KAAK,CAAC,CAAC;IAClBC,KAAK,GAAG,CAAC,GAAGA,KAAK,EAAE;MAAE,GAAGI,OAAO;MAAEG,EAAE;MAAED;IAAQ,CAAC,CAAC;IAC/CJ,IAAI,CAAC,CAAC;EACR,CAAC,CAAC;AACJ;;AAEA;AACA,OAAO,SAASM,cAAcA,CAACD,EAAU,EAAEE,SAAkB,EAAQ;EACnE,MAAMC,KAAK,GAAGV,KAAK,CAACW,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACL,EAAE,KAAKA,EAAE,CAAC;EAC5C,IAAI,CAACG,KAAK,EAAE;EACZV,KAAK,GAAGA,KAAK,CAACa,MAAM,CAAED,CAAC,IAAKA,CAAC,CAACL,EAAE,KAAKA,EAAE,CAAC;EACxCG,KAAK,CAACJ,OAAO,CAACG,SAAS,CAAC;EACxBP,IAAI,CAAC,CAAC;AACR;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASY,iBAAiBA,CAACC,EAAY,EAAc;EAC1Dd,QAAQ,GAAGc,EAAE;EACbA,EAAE,CAACf,KAAK,CAAC;EACT,OAAO,MAAM;IACX,IAAIC,QAAQ,KAAKc,EAAE,EAAEd,QAAQ,GAAG,IAAI;EACtC,CAAC;AACH;;AAEA;AACA,OAAO,SAASe,eAAeA,CAAA,EAA4B;EACzD,OAAOhB,KAAK;AACd","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { CenteredDialog } from '../dialog/index';
|
|
4
|
+
import { createAlertDialog } from "./AlertDialog.js";
|
|
5
|
+
import { createAlertDialogHost } from "./AlertDialogHost.js";
|
|
6
|
+
export const AlertDialog = createAlertDialog(CenteredDialog);
|
|
7
|
+
export const AlertDialogHost = createAlertDialogHost(AlertDialog);
|
|
8
|
+
export { confirm } from "./confirm-store.js";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CenteredDialog","createAlertDialog","createAlertDialogHost","AlertDialog","AlertDialogHost","confirm"],"sourceRoot":"../../../src","sources":["alert-dialog/index.ts"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,iBAAiB;AAChD,SAASC,iBAAiB,QAAQ,kBAAe;AACjD,SAASC,qBAAqB,QAAQ,sBAAmB;AAEzD,OAAO,MAAMC,WAAW,GAAGF,iBAAiB,CAACD,cAAc,CAAC;AAC5D,OAAO,MAAMI,eAAe,GAAGF,qBAAqB,CAACC,WAAW,CAAC;AAEjE,SAASE,OAAO,QAAQ,oBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { CenteredDialog } from "../dialog/index.web.js";
|
|
4
|
+
import { createAlertDialog } from "./AlertDialog.js";
|
|
5
|
+
import { createAlertDialogHost } from "./AlertDialogHost.js";
|
|
6
|
+
export const AlertDialog = createAlertDialog(CenteredDialog);
|
|
7
|
+
export const AlertDialogHost = createAlertDialogHost(AlertDialog);
|
|
8
|
+
export { confirm } from "./confirm-store.js";
|
|
9
|
+
//# sourceMappingURL=index.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CenteredDialog","createAlertDialog","createAlertDialogHost","AlertDialog","AlertDialogHost","confirm"],"sourceRoot":"../../../src","sources":["alert-dialog/index.web.ts"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,wBAAqB;AACpD,SAASC,iBAAiB,QAAQ,kBAAe;AACjD,SAASC,qBAAqB,QAAQ,sBAAmB;AAEzD,OAAO,MAAMC,WAAW,GAAGF,iBAAiB,CAACD,cAAc,CAAC;AAC5D,OAAO,MAAMI,eAAe,GAAGF,qBAAqB,CAACC,WAAW,CAAC;AAEjE,SAASE,OAAO,QAAQ,oBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["alert-dialog/types.ts"],"mappings":"","ignoreList":[]}
|