@oxyhq/bloom 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +295 -0
- package/lib/commonjs/avatar/Avatar.js +215 -0
- package/lib/commonjs/avatar/Avatar.js.map +1 -0
- package/lib/commonjs/avatar/index.js +13 -0
- package/lib/commonjs/avatar/index.js.map +1 -0
- package/lib/commonjs/avatar/types.js +6 -0
- package/lib/commonjs/avatar/types.js.map +1 -0
- package/lib/commonjs/button/Button.js +169 -0
- package/lib/commonjs/button/Button.js.map +1 -0
- package/lib/commonjs/button/index.js +43 -0
- package/lib/commonjs/button/index.js.map +1 -0
- package/lib/commonjs/button/types.js +6 -0
- package/lib/commonjs/button/types.js.map +1 -0
- package/lib/commonjs/collapsible/Collapsible.js +58 -0
- package/lib/commonjs/collapsible/Collapsible.js.map +1 -0
- package/lib/commonjs/collapsible/index.js +13 -0
- package/lib/commonjs/collapsible/index.js.map +1 -0
- package/lib/commonjs/collapsible/types.js +6 -0
- package/lib/commonjs/collapsible/types.js.map +1 -0
- package/lib/commonjs/dialog/Dialog.js +186 -0
- package/lib/commonjs/dialog/Dialog.js.map +1 -0
- package/lib/commonjs/dialog/Dialog.web.js +244 -0
- package/lib/commonjs/dialog/Dialog.web.js.map +1 -0
- package/lib/commonjs/dialog/context.js +35 -0
- package/lib/commonjs/dialog/context.js.map +1 -0
- package/lib/commonjs/dialog/index.js +56 -0
- package/lib/commonjs/dialog/index.js.map +1 -0
- package/lib/commonjs/dialog/types.js +6 -0
- package/lib/commonjs/dialog/types.js.map +1 -0
- package/lib/commonjs/divider/Divider.js +39 -0
- package/lib/commonjs/divider/Divider.js.map +1 -0
- package/lib/commonjs/divider/index.js +13 -0
- package/lib/commonjs/divider/index.js.map +1 -0
- package/lib/commonjs/divider/types.js +6 -0
- package/lib/commonjs/divider/types.js.map +1 -0
- package/lib/commonjs/error-boundary/ErrorBoundary.js +116 -0
- package/lib/commonjs/error-boundary/ErrorBoundary.js.map +1 -0
- package/lib/commonjs/error-boundary/index.js +13 -0
- package/lib/commonjs/error-boundary/index.js.map +1 -0
- package/lib/commonjs/error-boundary/types.js +6 -0
- package/lib/commonjs/error-boundary/types.js.map +1 -0
- package/lib/commonjs/grouped-buttons/GroupedButtons.js +86 -0
- package/lib/commonjs/grouped-buttons/GroupedButtons.js.map +1 -0
- package/lib/commonjs/grouped-buttons/index.js +19 -0
- package/lib/commonjs/grouped-buttons/index.js.map +1 -0
- package/lib/commonjs/grouped-buttons/types.js +6 -0
- package/lib/commonjs/grouped-buttons/types.js.map +1 -0
- package/lib/commonjs/index.js +136 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/loading/Loading.js +274 -0
- package/lib/commonjs/loading/Loading.js.map +1 -0
- package/lib/commonjs/loading/index.js +13 -0
- package/lib/commonjs/loading/index.js.map +1 -0
- package/lib/commonjs/loading/types.js +6 -0
- package/lib/commonjs/loading/types.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/portal/index.js +90 -0
- package/lib/commonjs/portal/index.js.map +1 -0
- package/lib/commonjs/prompt/Prompt.js +267 -0
- package/lib/commonjs/prompt/Prompt.js.map +1 -0
- package/lib/commonjs/prompt/index.js +61 -0
- package/lib/commonjs/prompt/index.js.map +1 -0
- package/lib/commonjs/prompt-input/Actions.js +45 -0
- package/lib/commonjs/prompt-input/Actions.js.map +1 -0
- package/lib/commonjs/prompt-input/Attachments.js +277 -0
- package/lib/commonjs/prompt-input/Attachments.js.map +1 -0
- package/lib/commonjs/prompt-input/PromptInput.js +226 -0
- package/lib/commonjs/prompt-input/PromptInput.js.map +1 -0
- package/lib/commonjs/prompt-input/SubmitButton.js +81 -0
- package/lib/commonjs/prompt-input/SubmitButton.js.map +1 -0
- package/lib/commonjs/prompt-input/Textarea.js +101 -0
- package/lib/commonjs/prompt-input/Textarea.js.map +1 -0
- package/lib/commonjs/prompt-input/Textarea.web.js +148 -0
- package/lib/commonjs/prompt-input/Textarea.web.js.map +1 -0
- package/lib/commonjs/prompt-input/context.js +35 -0
- package/lib/commonjs/prompt-input/context.js.map +1 -0
- package/lib/commonjs/prompt-input/index.js +54 -0
- package/lib/commonjs/prompt-input/index.js.map +1 -0
- package/lib/commonjs/prompt-input/types.js +6 -0
- package/lib/commonjs/prompt-input/types.js.map +1 -0
- package/lib/commonjs/radio-indicator/RadioIndicator.js +48 -0
- package/lib/commonjs/radio-indicator/RadioIndicator.js.map +1 -0
- package/lib/commonjs/radio-indicator/index.js +13 -0
- package/lib/commonjs/radio-indicator/index.js.map +1 -0
- package/lib/commonjs/radio-indicator/types.js +6 -0
- package/lib/commonjs/radio-indicator/types.js.map +1 -0
- package/lib/commonjs/theme/BloomThemeProvider.js +122 -0
- package/lib/commonjs/theme/BloomThemeProvider.js.map +1 -0
- package/lib/commonjs/theme/adaptive-colors.js +96 -0
- package/lib/commonjs/theme/adaptive-colors.js.map +1 -0
- package/lib/commonjs/theme/apply-dark-class.js +13 -0
- package/lib/commonjs/theme/apply-dark-class.js.map +1 -0
- package/lib/commonjs/theme/color-presets.js +486 -0
- package/lib/commonjs/theme/color-presets.js.map +1 -0
- package/lib/commonjs/theme/index.js +57 -0
- package/lib/commonjs/theme/index.js.map +1 -0
- package/lib/commonjs/theme/set-color-scheme-safe.js +23 -0
- package/lib/commonjs/theme/set-color-scheme-safe.js.map +1 -0
- package/lib/commonjs/theme/types.js +2 -0
- package/lib/commonjs/theme/types.js.map +1 -0
- package/lib/commonjs/theme/use-theme.js +29 -0
- package/lib/commonjs/theme/use-theme.js.map +1 -0
- package/lib/module/avatar/Avatar.js +210 -0
- package/lib/module/avatar/Avatar.js.map +1 -0
- package/lib/module/avatar/index.js +4 -0
- package/lib/module/avatar/index.js.map +1 -0
- package/lib/module/avatar/types.js +4 -0
- package/lib/module/avatar/types.js.map +1 -0
- package/lib/module/button/Button.js +164 -0
- package/lib/module/button/Button.js.map +1 -0
- package/lib/module/button/index.js +4 -0
- package/lib/module/button/index.js.map +1 -0
- package/lib/module/button/types.js +4 -0
- package/lib/module/button/types.js.map +1 -0
- package/lib/module/collapsible/Collapsible.js +53 -0
- package/lib/module/collapsible/Collapsible.js.map +1 -0
- package/lib/module/collapsible/index.js +4 -0
- package/lib/module/collapsible/index.js.map +1 -0
- package/lib/module/collapsible/types.js +4 -0
- package/lib/module/collapsible/types.js.map +1 -0
- package/lib/module/dialog/Dialog.js +165 -0
- package/lib/module/dialog/Dialog.js.map +1 -0
- package/lib/module/dialog/Dialog.web.js +222 -0
- package/lib/module/dialog/Dialog.web.js.map +1 -0
- package/lib/module/dialog/context.js +29 -0
- package/lib/module/dialog/context.js.map +1 -0
- package/lib/module/dialog/index.js +5 -0
- package/lib/module/dialog/index.js.map +1 -0
- package/lib/module/dialog/types.js +4 -0
- package/lib/module/dialog/types.js.map +1 -0
- package/lib/module/divider/Divider.js +34 -0
- package/lib/module/divider/Divider.js.map +1 -0
- package/lib/module/divider/index.js +4 -0
- package/lib/module/divider/index.js.map +1 -0
- package/lib/module/divider/types.js +4 -0
- package/lib/module/divider/types.js.map +1 -0
- package/lib/module/error-boundary/ErrorBoundary.js +110 -0
- package/lib/module/error-boundary/ErrorBoundary.js.map +1 -0
- package/lib/module/error-boundary/index.js +4 -0
- package/lib/module/error-boundary/index.js.map +1 -0
- package/lib/module/error-boundary/types.js +4 -0
- package/lib/module/error-boundary/types.js.map +1 -0
- package/lib/module/grouped-buttons/GroupedButtons.js +80 -0
- package/lib/module/grouped-buttons/GroupedButtons.js.map +1 -0
- package/lib/module/grouped-buttons/index.js +4 -0
- package/lib/module/grouped-buttons/index.js.map +1 -0
- package/lib/module/grouped-buttons/types.js +4 -0
- package/lib/module/grouped-buttons/types.js.map +1 -0
- package/lib/module/index.js +16 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/loading/Loading.js +269 -0
- package/lib/module/loading/Loading.js.map +1 -0
- package/lib/module/loading/index.js +4 -0
- package/lib/module/loading/index.js.map +1 -0
- package/lib/module/loading/types.js +4 -0
- package/lib/module/loading/types.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/portal/index.js +85 -0
- package/lib/module/portal/index.js.map +1 -0
- package/lib/module/prompt/Prompt.js +250 -0
- package/lib/module/prompt/Prompt.js.map +1 -0
- package/lib/module/prompt/index.js +4 -0
- package/lib/module/prompt/index.js.map +1 -0
- package/lib/module/prompt-input/Actions.js +40 -0
- package/lib/module/prompt-input/Actions.js.map +1 -0
- package/lib/module/prompt-input/Attachments.js +272 -0
- package/lib/module/prompt-input/Attachments.js.map +1 -0
- package/lib/module/prompt-input/PromptInput.js +221 -0
- package/lib/module/prompt-input/PromptInput.js.map +1 -0
- package/lib/module/prompt-input/SubmitButton.js +76 -0
- package/lib/module/prompt-input/SubmitButton.js.map +1 -0
- package/lib/module/prompt-input/Textarea.js +96 -0
- package/lib/module/prompt-input/Textarea.js.map +1 -0
- package/lib/module/prompt-input/Textarea.web.js +143 -0
- package/lib/module/prompt-input/Textarea.web.js.map +1 -0
- package/lib/module/prompt-input/context.js +28 -0
- package/lib/module/prompt-input/context.js.map +1 -0
- package/lib/module/prompt-input/index.js +9 -0
- package/lib/module/prompt-input/index.js.map +1 -0
- package/lib/module/prompt-input/types.js +4 -0
- package/lib/module/prompt-input/types.js.map +1 -0
- package/lib/module/radio-indicator/RadioIndicator.js +43 -0
- package/lib/module/radio-indicator/RadioIndicator.js.map +1 -0
- package/lib/module/radio-indicator/index.js +4 -0
- package/lib/module/radio-indicator/index.js.map +1 -0
- package/lib/module/radio-indicator/types.js +4 -0
- package/lib/module/radio-indicator/types.js.map +1 -0
- package/lib/module/theme/BloomThemeProvider.js +116 -0
- package/lib/module/theme/BloomThemeProvider.js.map +1 -0
- package/lib/module/theme/adaptive-colors.js +92 -0
- package/lib/module/theme/adaptive-colors.js.map +1 -0
- package/lib/module/theme/apply-dark-class.js +9 -0
- package/lib/module/theme/apply-dark-class.js.map +1 -0
- package/lib/module/theme/color-presets.js +481 -0
- package/lib/module/theme/color-presets.js.map +1 -0
- package/lib/module/theme/index.js +6 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/theme/set-color-scheme-safe.js +19 -0
- package/lib/module/theme/set-color-scheme-safe.js.map +1 -0
- package/lib/module/theme/types.js +2 -0
- package/lib/module/theme/types.js.map +1 -0
- package/lib/module/theme/use-theme.js +23 -0
- package/lib/module/theme/use-theme.js.map +1 -0
- package/lib/typescript/commonjs/avatar/Avatar.d.ts +4 -0
- package/lib/typescript/commonjs/avatar/Avatar.d.ts.map +1 -0
- package/lib/typescript/commonjs/avatar/index.d.ts +3 -0
- package/lib/typescript/commonjs/avatar/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/avatar/types.d.ts +31 -0
- package/lib/typescript/commonjs/avatar/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/button/Button.d.ts +10 -0
- package/lib/typescript/commonjs/button/Button.d.ts.map +1 -0
- package/lib/typescript/commonjs/button/index.d.ts +3 -0
- package/lib/typescript/commonjs/button/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/button/types.d.ts +25 -0
- package/lib/typescript/commonjs/button/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/collapsible/Collapsible.d.ts +4 -0
- package/lib/typescript/commonjs/collapsible/Collapsible.d.ts.map +1 -0
- package/lib/typescript/commonjs/collapsible/index.d.ts +3 -0
- package/lib/typescript/commonjs/collapsible/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/collapsible/types.d.ts +18 -0
- package/lib/typescript/commonjs/collapsible/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/Dialog.d.ts +11 -0
- package/lib/typescript/commonjs/dialog/Dialog.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts +23 -0
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/context.d.ts +5 -0
- package/lib/typescript/commonjs/dialog/context.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/index.d.ts +4 -0
- package/lib/typescript/commonjs/dialog/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/types.d.ts +30 -0
- package/lib/typescript/commonjs/dialog/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/divider/Divider.d.ts +4 -0
- package/lib/typescript/commonjs/divider/Divider.d.ts.map +1 -0
- package/lib/typescript/commonjs/divider/index.d.ts +3 -0
- package/lib/typescript/commonjs/divider/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/divider/types.d.ts +15 -0
- package/lib/typescript/commonjs/divider/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/error-boundary/ErrorBoundary.d.ts +16 -0
- package/lib/typescript/commonjs/error-boundary/ErrorBoundary.d.ts.map +1 -0
- package/lib/typescript/commonjs/error-boundary/index.d.ts +3 -0
- package/lib/typescript/commonjs/error-boundary/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/error-boundary/types.d.ts +16 -0
- package/lib/typescript/commonjs/error-boundary/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/grouped-buttons/GroupedButtons.d.ts +8 -0
- package/lib/typescript/commonjs/grouped-buttons/GroupedButtons.d.ts.map +1 -0
- package/lib/typescript/commonjs/grouped-buttons/index.d.ts +3 -0
- package/lib/typescript/commonjs/grouped-buttons/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/grouped-buttons/types.d.ts +15 -0
- package/lib/typescript/commonjs/grouped-buttons/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +15 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/loading/Loading.d.ts +4 -0
- package/lib/typescript/commonjs/loading/Loading.d.ts.map +1 -0
- package/lib/typescript/commonjs/loading/index.d.ts +3 -0
- package/lib/typescript/commonjs/loading/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/loading/types.d.ts +60 -0
- package/lib/typescript/commonjs/loading/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/portal/index.d.ts +5 -0
- package/lib/typescript/commonjs/portal/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/prompt/Prompt.d.ts +42 -0
- package/lib/typescript/commonjs/prompt/Prompt.d.ts.map +1 -0
- package/lib/typescript/commonjs/prompt/index.d.ts +3 -0
- package/lib/typescript/commonjs/prompt/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/prompt-input/Actions.d.ts +3 -0
- package/lib/typescript/commonjs/prompt-input/Actions.d.ts.map +1 -0
- package/lib/typescript/commonjs/prompt-input/Attachments.d.ts +3 -0
- package/lib/typescript/commonjs/prompt-input/Attachments.d.ts.map +1 -0
- package/lib/typescript/commonjs/prompt-input/PromptInput.d.ts +3 -0
- package/lib/typescript/commonjs/prompt-input/PromptInput.d.ts.map +1 -0
- package/lib/typescript/commonjs/prompt-input/SubmitButton.d.ts +3 -0
- package/lib/typescript/commonjs/prompt-input/SubmitButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/prompt-input/Textarea.d.ts +3 -0
- package/lib/typescript/commonjs/prompt-input/Textarea.d.ts.map +1 -0
- package/lib/typescript/commonjs/prompt-input/Textarea.web.d.ts +3 -0
- package/lib/typescript/commonjs/prompt-input/Textarea.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/prompt-input/context.d.ts +34 -0
- package/lib/typescript/commonjs/prompt-input/context.d.ts.map +1 -0
- package/lib/typescript/commonjs/prompt-input/index.d.ts +8 -0
- package/lib/typescript/commonjs/prompt-input/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/prompt-input/types.d.ts +88 -0
- package/lib/typescript/commonjs/prompt-input/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/radio-indicator/RadioIndicator.d.ts +4 -0
- package/lib/typescript/commonjs/radio-indicator/RadioIndicator.d.ts.map +1 -0
- package/lib/typescript/commonjs/radio-indicator/index.d.ts +3 -0
- package/lib/typescript/commonjs/radio-indicator/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/radio-indicator/types.d.ts +15 -0
- package/lib/typescript/commonjs/radio-indicator/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/BloomThemeProvider.d.ts +20 -0
- package/lib/typescript/commonjs/theme/BloomThemeProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/adaptive-colors.d.ts +3 -0
- package/lib/typescript/commonjs/theme/adaptive-colors.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/apply-dark-class.d.ts +2 -0
- package/lib/typescript/commonjs/theme/apply-dark-class.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/color-presets.d.ts +12 -0
- package/lib/typescript/commonjs/theme/color-presets.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/index.d.ts +7 -0
- package/lib/typescript/commonjs/theme/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/set-color-scheme-safe.d.ts +9 -0
- package/lib/typescript/commonjs/theme/set-color-scheme-safe.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/types.d.ts +39 -0
- package/lib/typescript/commonjs/theme/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/use-theme.d.ts +5 -0
- package/lib/typescript/commonjs/theme/use-theme.d.ts.map +1 -0
- package/lib/typescript/module/avatar/Avatar.d.ts +4 -0
- package/lib/typescript/module/avatar/Avatar.d.ts.map +1 -0
- package/lib/typescript/module/avatar/index.d.ts +3 -0
- package/lib/typescript/module/avatar/index.d.ts.map +1 -0
- package/lib/typescript/module/avatar/types.d.ts +31 -0
- package/lib/typescript/module/avatar/types.d.ts.map +1 -0
- package/lib/typescript/module/button/Button.d.ts +10 -0
- package/lib/typescript/module/button/Button.d.ts.map +1 -0
- package/lib/typescript/module/button/index.d.ts +3 -0
- package/lib/typescript/module/button/index.d.ts.map +1 -0
- package/lib/typescript/module/button/types.d.ts +25 -0
- package/lib/typescript/module/button/types.d.ts.map +1 -0
- package/lib/typescript/module/collapsible/Collapsible.d.ts +4 -0
- package/lib/typescript/module/collapsible/Collapsible.d.ts.map +1 -0
- package/lib/typescript/module/collapsible/index.d.ts +3 -0
- package/lib/typescript/module/collapsible/index.d.ts.map +1 -0
- package/lib/typescript/module/collapsible/types.d.ts +18 -0
- package/lib/typescript/module/collapsible/types.d.ts.map +1 -0
- package/lib/typescript/module/dialog/Dialog.d.ts +11 -0
- package/lib/typescript/module/dialog/Dialog.d.ts.map +1 -0
- package/lib/typescript/module/dialog/Dialog.web.d.ts +23 -0
- package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -0
- package/lib/typescript/module/dialog/context.d.ts +5 -0
- package/lib/typescript/module/dialog/context.d.ts.map +1 -0
- package/lib/typescript/module/dialog/index.d.ts +4 -0
- package/lib/typescript/module/dialog/index.d.ts.map +1 -0
- package/lib/typescript/module/dialog/types.d.ts +30 -0
- package/lib/typescript/module/dialog/types.d.ts.map +1 -0
- package/lib/typescript/module/divider/Divider.d.ts +4 -0
- package/lib/typescript/module/divider/Divider.d.ts.map +1 -0
- package/lib/typescript/module/divider/index.d.ts +3 -0
- package/lib/typescript/module/divider/index.d.ts.map +1 -0
- package/lib/typescript/module/divider/types.d.ts +15 -0
- package/lib/typescript/module/divider/types.d.ts.map +1 -0
- package/lib/typescript/module/error-boundary/ErrorBoundary.d.ts +16 -0
- package/lib/typescript/module/error-boundary/ErrorBoundary.d.ts.map +1 -0
- package/lib/typescript/module/error-boundary/index.d.ts +3 -0
- package/lib/typescript/module/error-boundary/index.d.ts.map +1 -0
- package/lib/typescript/module/error-boundary/types.d.ts +16 -0
- package/lib/typescript/module/error-boundary/types.d.ts.map +1 -0
- package/lib/typescript/module/grouped-buttons/GroupedButtons.d.ts +8 -0
- package/lib/typescript/module/grouped-buttons/GroupedButtons.d.ts.map +1 -0
- package/lib/typescript/module/grouped-buttons/index.d.ts +3 -0
- package/lib/typescript/module/grouped-buttons/index.d.ts.map +1 -0
- package/lib/typescript/module/grouped-buttons/types.d.ts +15 -0
- package/lib/typescript/module/grouped-buttons/types.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +15 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/loading/Loading.d.ts +4 -0
- package/lib/typescript/module/loading/Loading.d.ts.map +1 -0
- package/lib/typescript/module/loading/index.d.ts +3 -0
- package/lib/typescript/module/loading/index.d.ts.map +1 -0
- package/lib/typescript/module/loading/types.d.ts +60 -0
- package/lib/typescript/module/loading/types.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/portal/index.d.ts +5 -0
- package/lib/typescript/module/portal/index.d.ts.map +1 -0
- package/lib/typescript/module/prompt/Prompt.d.ts +42 -0
- package/lib/typescript/module/prompt/Prompt.d.ts.map +1 -0
- package/lib/typescript/module/prompt/index.d.ts +3 -0
- package/lib/typescript/module/prompt/index.d.ts.map +1 -0
- package/lib/typescript/module/prompt-input/Actions.d.ts +3 -0
- package/lib/typescript/module/prompt-input/Actions.d.ts.map +1 -0
- package/lib/typescript/module/prompt-input/Attachments.d.ts +3 -0
- package/lib/typescript/module/prompt-input/Attachments.d.ts.map +1 -0
- package/lib/typescript/module/prompt-input/PromptInput.d.ts +3 -0
- package/lib/typescript/module/prompt-input/PromptInput.d.ts.map +1 -0
- package/lib/typescript/module/prompt-input/SubmitButton.d.ts +3 -0
- package/lib/typescript/module/prompt-input/SubmitButton.d.ts.map +1 -0
- package/lib/typescript/module/prompt-input/Textarea.d.ts +3 -0
- package/lib/typescript/module/prompt-input/Textarea.d.ts.map +1 -0
- package/lib/typescript/module/prompt-input/Textarea.web.d.ts +3 -0
- package/lib/typescript/module/prompt-input/Textarea.web.d.ts.map +1 -0
- package/lib/typescript/module/prompt-input/context.d.ts +34 -0
- package/lib/typescript/module/prompt-input/context.d.ts.map +1 -0
- package/lib/typescript/module/prompt-input/index.d.ts +8 -0
- package/lib/typescript/module/prompt-input/index.d.ts.map +1 -0
- package/lib/typescript/module/prompt-input/types.d.ts +88 -0
- package/lib/typescript/module/prompt-input/types.d.ts.map +1 -0
- package/lib/typescript/module/radio-indicator/RadioIndicator.d.ts +4 -0
- package/lib/typescript/module/radio-indicator/RadioIndicator.d.ts.map +1 -0
- package/lib/typescript/module/radio-indicator/index.d.ts +3 -0
- package/lib/typescript/module/radio-indicator/index.d.ts.map +1 -0
- package/lib/typescript/module/radio-indicator/types.d.ts +15 -0
- package/lib/typescript/module/radio-indicator/types.d.ts.map +1 -0
- package/lib/typescript/module/theme/BloomThemeProvider.d.ts +20 -0
- package/lib/typescript/module/theme/BloomThemeProvider.d.ts.map +1 -0
- package/lib/typescript/module/theme/adaptive-colors.d.ts +3 -0
- package/lib/typescript/module/theme/adaptive-colors.d.ts.map +1 -0
- package/lib/typescript/module/theme/apply-dark-class.d.ts +2 -0
- package/lib/typescript/module/theme/apply-dark-class.d.ts.map +1 -0
- package/lib/typescript/module/theme/color-presets.d.ts +12 -0
- package/lib/typescript/module/theme/color-presets.d.ts.map +1 -0
- package/lib/typescript/module/theme/index.d.ts +7 -0
- package/lib/typescript/module/theme/index.d.ts.map +1 -0
- package/lib/typescript/module/theme/set-color-scheme-safe.d.ts +9 -0
- package/lib/typescript/module/theme/set-color-scheme-safe.d.ts.map +1 -0
- package/lib/typescript/module/theme/types.d.ts +39 -0
- package/lib/typescript/module/theme/types.d.ts.map +1 -0
- package/lib/typescript/module/theme/use-theme.d.ts +5 -0
- package/lib/typescript/module/theme/use-theme.d.ts.map +1 -0
- package/package.json +260 -0
- package/src/avatar/Avatar.tsx +217 -0
- package/src/avatar/index.ts +2 -0
- package/src/avatar/types.ts +32 -0
- package/src/button/Button.tsx +172 -0
- package/src/button/index.ts +10 -0
- package/src/button/types.ts +25 -0
- package/src/collapsible/Collapsible.tsx +62 -0
- package/src/collapsible/index.ts +2 -0
- package/src/collapsible/types.ts +18 -0
- package/src/dialog/Dialog.tsx +160 -0
- package/src/dialog/Dialog.web.tsx +238 -0
- package/src/dialog/context.ts +34 -0
- package/src/dialog/index.ts +3 -0
- package/src/dialog/types.ts +34 -0
- package/src/divider/Divider.tsx +42 -0
- package/src/divider/index.ts +2 -0
- package/src/divider/types.ts +15 -0
- package/src/error-boundary/ErrorBoundary.tsx +112 -0
- package/src/error-boundary/index.ts +2 -0
- package/src/error-boundary/types.ts +16 -0
- package/src/grouped-buttons/GroupedButtons.tsx +94 -0
- package/src/grouped-buttons/index.ts +2 -0
- package/src/grouped-buttons/types.ts +16 -0
- package/src/index.ts +14 -0
- package/src/loading/Loading.tsx +258 -0
- package/src/loading/index.ts +10 -0
- package/src/loading/types.ts +69 -0
- package/src/portal/index.tsx +100 -0
- package/src/prompt/Prompt.tsx +248 -0
- package/src/prompt/index.ts +13 -0
- package/src/prompt-input/Actions.tsx +45 -0
- package/src/prompt-input/Attachments.tsx +264 -0
- package/src/prompt-input/PromptInput.tsx +263 -0
- package/src/prompt-input/SubmitButton.tsx +74 -0
- package/src/prompt-input/Textarea.tsx +102 -0
- package/src/prompt-input/Textarea.web.tsx +154 -0
- package/src/prompt-input/context.ts +59 -0
- package/src/prompt-input/index.ts +18 -0
- package/src/prompt-input/types.ts +92 -0
- package/src/radio-indicator/RadioIndicator.tsx +52 -0
- package/src/radio-indicator/index.ts +2 -0
- package/src/radio-indicator/types.ts +15 -0
- package/src/theme/BloomThemeProvider.tsx +160 -0
- package/src/theme/adaptive-colors.ts +90 -0
- package/src/theme/apply-dark-class.ts +7 -0
- package/src/theme/color-presets.ts +499 -0
- package/src/theme/index.ts +6 -0
- package/src/theme/set-color-scheme-safe.ts +19 -0
- package/src/theme/types.ts +48 -0
- package/src/theme/use-theme.ts +24 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import React, { useMemo, memo } from 'react';
|
|
2
|
+
import { TouchableOpacity, Text, Platform, type ViewStyle, type TextStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useTheme } from '../theme/use-theme';
|
|
5
|
+
import type { ButtonProps } from './types';
|
|
6
|
+
|
|
7
|
+
export type { ButtonProps, ButtonVariant, ButtonSize } from './types';
|
|
8
|
+
|
|
9
|
+
const SIZE_CONFIG = {
|
|
10
|
+
small: {
|
|
11
|
+
paddingVertical: 6,
|
|
12
|
+
paddingHorizontal: 12,
|
|
13
|
+
fontSize: 14,
|
|
14
|
+
minHeight: 32,
|
|
15
|
+
},
|
|
16
|
+
medium: {
|
|
17
|
+
paddingVertical: 8,
|
|
18
|
+
paddingHorizontal: 16,
|
|
19
|
+
fontSize: 15,
|
|
20
|
+
minHeight: 40,
|
|
21
|
+
},
|
|
22
|
+
large: {
|
|
23
|
+
paddingVertical: 12,
|
|
24
|
+
paddingHorizontal: 20,
|
|
25
|
+
fontSize: 16,
|
|
26
|
+
minHeight: 48,
|
|
27
|
+
},
|
|
28
|
+
} as const;
|
|
29
|
+
|
|
30
|
+
const ICON_HIT_SLOP = { top: 10, bottom: 10, left: 10, right: 10 } as const;
|
|
31
|
+
|
|
32
|
+
const ButtonComponent: React.FC<ButtonProps> = ({
|
|
33
|
+
onPress,
|
|
34
|
+
children,
|
|
35
|
+
disabled = false,
|
|
36
|
+
variant = 'primary',
|
|
37
|
+
size = 'medium',
|
|
38
|
+
style,
|
|
39
|
+
textStyle,
|
|
40
|
+
icon,
|
|
41
|
+
iconPosition = 'left',
|
|
42
|
+
accessibilityLabel,
|
|
43
|
+
accessibilityHint,
|
|
44
|
+
hitSlop,
|
|
45
|
+
activeOpacity,
|
|
46
|
+
testID,
|
|
47
|
+
}) => {
|
|
48
|
+
const theme = useTheme();
|
|
49
|
+
|
|
50
|
+
const baseStyles = useMemo((): ViewStyle => {
|
|
51
|
+
const sizeConfig = SIZE_CONFIG[size];
|
|
52
|
+
const styles: ViewStyle = {
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
justifyContent: 'center',
|
|
55
|
+
flexDirection: 'row',
|
|
56
|
+
overflow: 'hidden',
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
if (variant !== 'icon') {
|
|
60
|
+
styles.paddingVertical = sizeConfig.paddingVertical;
|
|
61
|
+
styles.paddingHorizontal = sizeConfig.paddingHorizontal;
|
|
62
|
+
styles.minHeight = sizeConfig.minHeight;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
switch (variant) {
|
|
66
|
+
case 'primary':
|
|
67
|
+
styles.backgroundColor = theme.colors.primary;
|
|
68
|
+
styles.borderRadius = 20;
|
|
69
|
+
break;
|
|
70
|
+
case 'secondary':
|
|
71
|
+
styles.backgroundColor = 'transparent';
|
|
72
|
+
styles.borderWidth = 1;
|
|
73
|
+
styles.borderColor = theme.colors.border;
|
|
74
|
+
styles.borderRadius = 20;
|
|
75
|
+
break;
|
|
76
|
+
case 'icon':
|
|
77
|
+
styles.backgroundColor = theme.colors.background;
|
|
78
|
+
styles.borderWidth = 1;
|
|
79
|
+
styles.borderColor = theme.colors.border;
|
|
80
|
+
styles.borderRadius = 100;
|
|
81
|
+
styles.padding = 8;
|
|
82
|
+
styles.width = sizeConfig.minHeight;
|
|
83
|
+
styles.height = sizeConfig.minHeight;
|
|
84
|
+
break;
|
|
85
|
+
case 'ghost':
|
|
86
|
+
styles.backgroundColor = 'transparent';
|
|
87
|
+
styles.borderRadius = 8;
|
|
88
|
+
break;
|
|
89
|
+
case 'text':
|
|
90
|
+
styles.backgroundColor = 'transparent';
|
|
91
|
+
styles.paddingVertical = 4;
|
|
92
|
+
styles.paddingHorizontal = 8;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return styles;
|
|
97
|
+
}, [variant, size, theme]);
|
|
98
|
+
|
|
99
|
+
const computedTextStyle = useMemo((): TextStyle => {
|
|
100
|
+
const sizeConfig = SIZE_CONFIG[size];
|
|
101
|
+
const styles: TextStyle = {
|
|
102
|
+
fontSize: sizeConfig.fontSize,
|
|
103
|
+
fontWeight: Platform.OS === 'web' ? 'bold' : '600',
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
switch (variant) {
|
|
107
|
+
case 'primary':
|
|
108
|
+
styles.color = theme.colors.card;
|
|
109
|
+
break;
|
|
110
|
+
case 'secondary':
|
|
111
|
+
styles.color = theme.colors.text;
|
|
112
|
+
break;
|
|
113
|
+
case 'ghost':
|
|
114
|
+
case 'text':
|
|
115
|
+
styles.color = theme.colors.primary;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return styles;
|
|
120
|
+
}, [variant, size, theme]);
|
|
121
|
+
|
|
122
|
+
const defaultHitSlop = variant === 'icon' ? ICON_HIT_SLOP : undefined;
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<TouchableOpacity
|
|
126
|
+
style={[baseStyles, disabled && { opacity: 0.5 }, style]}
|
|
127
|
+
onPress={onPress}
|
|
128
|
+
disabled={disabled}
|
|
129
|
+
activeOpacity={activeOpacity ?? (variant === 'icon' ? 0.7 : 0.8)}
|
|
130
|
+
hitSlop={hitSlop ?? defaultHitSlop}
|
|
131
|
+
accessibilityLabel={accessibilityLabel}
|
|
132
|
+
accessibilityHint={accessibilityHint}
|
|
133
|
+
accessibilityRole="button"
|
|
134
|
+
accessibilityState={{ disabled }}
|
|
135
|
+
testID={testID}
|
|
136
|
+
>
|
|
137
|
+
{iconPosition === 'left' && icon}
|
|
138
|
+
{children != null && (
|
|
139
|
+
<Text style={[computedTextStyle, textStyle]}>{children}</Text>
|
|
140
|
+
)}
|
|
141
|
+
{iconPosition === 'right' && icon}
|
|
142
|
+
</TouchableOpacity>
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const Button = memo(ButtonComponent);
|
|
147
|
+
Button.displayName = 'Button';
|
|
148
|
+
|
|
149
|
+
export const PrimaryButton = memo((props: Omit<ButtonProps, 'variant'>) => (
|
|
150
|
+
<Button {...props} variant="primary" />
|
|
151
|
+
));
|
|
152
|
+
PrimaryButton.displayName = 'PrimaryButton';
|
|
153
|
+
|
|
154
|
+
export const SecondaryButton = memo((props: Omit<ButtonProps, 'variant'>) => (
|
|
155
|
+
<Button {...props} variant="secondary" />
|
|
156
|
+
));
|
|
157
|
+
SecondaryButton.displayName = 'SecondaryButton';
|
|
158
|
+
|
|
159
|
+
export const IconButton = memo((props: Omit<ButtonProps, 'variant'>) => (
|
|
160
|
+
<Button {...props} variant="icon" />
|
|
161
|
+
));
|
|
162
|
+
IconButton.displayName = 'IconButton';
|
|
163
|
+
|
|
164
|
+
export const GhostButton = memo((props: Omit<ButtonProps, 'variant'>) => (
|
|
165
|
+
<Button {...props} variant="ghost" />
|
|
166
|
+
));
|
|
167
|
+
GhostButton.displayName = 'GhostButton';
|
|
168
|
+
|
|
169
|
+
export const TextButton = memo((props: Omit<ButtonProps, 'variant'>) => (
|
|
170
|
+
<Button {...props} variant="text" />
|
|
171
|
+
));
|
|
172
|
+
TextButton.displayName = 'TextButton';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'icon' | 'ghost' | 'text';
|
|
4
|
+
|
|
5
|
+
export type ButtonSize = 'small' | 'medium' | 'large';
|
|
6
|
+
|
|
7
|
+
export interface ButtonProps {
|
|
8
|
+
onPress?: () => void;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
|
|
12
|
+
variant?: ButtonVariant;
|
|
13
|
+
size?: ButtonSize;
|
|
14
|
+
style?: StyleProp<ViewStyle>;
|
|
15
|
+
textStyle?: StyleProp<TextStyle>;
|
|
16
|
+
|
|
17
|
+
icon?: React.ReactNode;
|
|
18
|
+
iconPosition?: 'left' | 'right';
|
|
19
|
+
|
|
20
|
+
accessibilityLabel?: string;
|
|
21
|
+
accessibilityHint?: string;
|
|
22
|
+
hitSlop?: { top: number; bottom: number; left: number; right: number };
|
|
23
|
+
activeOpacity?: number;
|
|
24
|
+
testID?: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React, { memo, useState } from 'react';
|
|
2
|
+
import { View, Text, TouchableOpacity } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useTheme } from '../theme/use-theme';
|
|
5
|
+
import type { CollapsibleProps } from './types';
|
|
6
|
+
|
|
7
|
+
const CollapsibleComponent: React.FC<CollapsibleProps> = ({
|
|
8
|
+
title,
|
|
9
|
+
children,
|
|
10
|
+
defaultOpen = false,
|
|
11
|
+
chevronIcon,
|
|
12
|
+
style,
|
|
13
|
+
titleStyle,
|
|
14
|
+
testID,
|
|
15
|
+
}) => {
|
|
16
|
+
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
17
|
+
const theme = useTheme();
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<View style={style} testID={testID}>
|
|
21
|
+
<TouchableOpacity
|
|
22
|
+
onPress={() => setIsOpen((prev) => !prev)}
|
|
23
|
+
activeOpacity={0.7}
|
|
24
|
+
style={{
|
|
25
|
+
flexDirection: 'row',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
paddingVertical: 12,
|
|
28
|
+
gap: 8,
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
{chevronIcon ?? (
|
|
32
|
+
<Text
|
|
33
|
+
style={{
|
|
34
|
+
fontSize: 16,
|
|
35
|
+
color: theme.colors.textSecondary,
|
|
36
|
+
transform: [{ rotate: isOpen ? '90deg' : '0deg' }],
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
›
|
|
40
|
+
</Text>
|
|
41
|
+
)}
|
|
42
|
+
<Text
|
|
43
|
+
style={[
|
|
44
|
+
{
|
|
45
|
+
fontSize: 16,
|
|
46
|
+
fontWeight: '600',
|
|
47
|
+
color: theme.colors.text,
|
|
48
|
+
flex: 1,
|
|
49
|
+
},
|
|
50
|
+
titleStyle,
|
|
51
|
+
]}
|
|
52
|
+
>
|
|
53
|
+
{title}
|
|
54
|
+
</Text>
|
|
55
|
+
</TouchableOpacity>
|
|
56
|
+
{isOpen && children}
|
|
57
|
+
</View>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const Collapsible = memo(CollapsibleComponent);
|
|
62
|
+
Collapsible.displayName = 'Collapsible';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface CollapsibleProps {
|
|
5
|
+
/** Header title text */
|
|
6
|
+
title: string;
|
|
7
|
+
/** Content to show/hide */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/** Whether to start open (defaults to false) */
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
/** Custom chevron icon (defaults to "›" character with rotation) */
|
|
12
|
+
chevronIcon?: ReactNode;
|
|
13
|
+
/** Container style */
|
|
14
|
+
style?: StyleProp<ViewStyle>;
|
|
15
|
+
/** Title text style */
|
|
16
|
+
titleStyle?: StyleProp<TextStyle>;
|
|
17
|
+
testID?: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import React, { useCallback, useImperativeHandle, useMemo, useRef } from 'react';
|
|
2
|
+
import { Pressable, StyleSheet, View } from 'react-native';
|
|
3
|
+
import { BottomSheetModal, BottomSheetView, BottomSheetBackdrop, type BottomSheetBackdropProps } from '@gorhom/bottom-sheet';
|
|
4
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
|
+
|
|
6
|
+
import { useTheme } from '../theme/use-theme';
|
|
7
|
+
import { Context, useDialogContext } from './context';
|
|
8
|
+
import type { DialogControlProps, DialogInnerProps, DialogOuterProps } from './types';
|
|
9
|
+
|
|
10
|
+
export { useDialogContext, useDialogControl } from './context';
|
|
11
|
+
export type { DialogControlProps, DialogOuterProps, DialogInnerProps } from './types';
|
|
12
|
+
|
|
13
|
+
export function Outer({
|
|
14
|
+
children,
|
|
15
|
+
control,
|
|
16
|
+
onClose,
|
|
17
|
+
testID,
|
|
18
|
+
preventExpansion,
|
|
19
|
+
}: React.PropsWithChildren<DialogOuterProps>) {
|
|
20
|
+
const theme = useTheme();
|
|
21
|
+
const ref = useRef<BottomSheetModal>(null);
|
|
22
|
+
const closeCallbacks = useRef<(() => void)[]>([]);
|
|
23
|
+
|
|
24
|
+
const callQueuedCallbacks = useCallback(() => {
|
|
25
|
+
for (const cb of closeCallbacks.current) {
|
|
26
|
+
try {
|
|
27
|
+
cb();
|
|
28
|
+
} catch (e) {
|
|
29
|
+
console.error('Dialog close callback error:', e);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
closeCallbacks.current = [];
|
|
33
|
+
}, []);
|
|
34
|
+
|
|
35
|
+
const open = useCallback(() => {
|
|
36
|
+
ref.current?.present();
|
|
37
|
+
}, []);
|
|
38
|
+
|
|
39
|
+
const close = useCallback<DialogControlProps['close']>((cb) => {
|
|
40
|
+
if (typeof cb === 'function') {
|
|
41
|
+
closeCallbacks.current.push(cb);
|
|
42
|
+
}
|
|
43
|
+
ref.current?.dismiss();
|
|
44
|
+
}, []);
|
|
45
|
+
|
|
46
|
+
const handleDismiss = useCallback(() => {
|
|
47
|
+
callQueuedCallbacks();
|
|
48
|
+
onClose?.();
|
|
49
|
+
}, [callQueuedCallbacks, onClose]);
|
|
50
|
+
|
|
51
|
+
useImperativeHandle(
|
|
52
|
+
control.ref,
|
|
53
|
+
() => ({ open, close }),
|
|
54
|
+
[open, close],
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const context = useMemo(
|
|
58
|
+
() => ({ close, isWithinDialog: true }),
|
|
59
|
+
[close],
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const renderBackdrop = useCallback(
|
|
63
|
+
(props: BottomSheetBackdropProps) => (
|
|
64
|
+
<BottomSheetBackdrop
|
|
65
|
+
{...props}
|
|
66
|
+
appearsOnIndex={0}
|
|
67
|
+
disappearsOnIndex={-1}
|
|
68
|
+
pressBehavior="close"
|
|
69
|
+
opacity={0.4}
|
|
70
|
+
/>
|
|
71
|
+
),
|
|
72
|
+
[],
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<BottomSheetModal
|
|
77
|
+
ref={ref}
|
|
78
|
+
enablePanDownToClose
|
|
79
|
+
enableDismissOnClose
|
|
80
|
+
enableDynamicSizing={!preventExpansion}
|
|
81
|
+
snapPoints={preventExpansion ? ['40%'] : undefined}
|
|
82
|
+
backgroundStyle={{
|
|
83
|
+
backgroundColor: theme.colors.background,
|
|
84
|
+
borderTopLeftRadius: 20,
|
|
85
|
+
borderTopRightRadius: 20,
|
|
86
|
+
}}
|
|
87
|
+
handleIndicatorStyle={{
|
|
88
|
+
backgroundColor: theme.colors.text,
|
|
89
|
+
width: 35,
|
|
90
|
+
height: 5,
|
|
91
|
+
opacity: 0.5,
|
|
92
|
+
}}
|
|
93
|
+
backdropComponent={renderBackdrop}
|
|
94
|
+
onDismiss={handleDismiss}
|
|
95
|
+
style={{ maxWidth: 500, margin: 'auto' }}
|
|
96
|
+
>
|
|
97
|
+
<Context.Provider value={context}>
|
|
98
|
+
<BottomSheetView
|
|
99
|
+
testID={testID}
|
|
100
|
+
style={{ backgroundColor: theme.colors.background }}
|
|
101
|
+
>
|
|
102
|
+
{children}
|
|
103
|
+
</BottomSheetView>
|
|
104
|
+
</Context.Provider>
|
|
105
|
+
</BottomSheetModal>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function Inner({ children, style, header, contentContainerStyle }: DialogInnerProps) {
|
|
110
|
+
const insets = useSafeAreaInsets();
|
|
111
|
+
return (
|
|
112
|
+
<>
|
|
113
|
+
{header}
|
|
114
|
+
<View
|
|
115
|
+
style={[
|
|
116
|
+
{ paddingTop: 20, paddingHorizontal: 20, paddingBottom: insets.bottom + insets.top },
|
|
117
|
+
contentContainerStyle,
|
|
118
|
+
style,
|
|
119
|
+
]}
|
|
120
|
+
>
|
|
121
|
+
{children}
|
|
122
|
+
</View>
|
|
123
|
+
</>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function ScrollableInner(props: DialogInnerProps) {
|
|
128
|
+
return <Inner {...props} />;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const handleStyles = StyleSheet.create({
|
|
132
|
+
container: { position: 'absolute', width: '100%', alignItems: 'center', zIndex: 10, height: 20 },
|
|
133
|
+
bar: { top: 8, width: 35, height: 5, borderRadius: 3, alignSelf: 'center', opacity: 0.5 },
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
export function Handle() {
|
|
137
|
+
const theme = useTheme();
|
|
138
|
+
const { close } = useDialogContext();
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<View style={handleStyles.container}>
|
|
142
|
+
<Pressable
|
|
143
|
+
onPress={() => close()}
|
|
144
|
+
accessibilityLabel="Dismiss"
|
|
145
|
+
accessibilityHint="Tap to close the dialog"
|
|
146
|
+
hitSlop={{ top: 10, bottom: 10, left: 40, right: 40 }}
|
|
147
|
+
>
|
|
148
|
+
<View style={[handleStyles.bar, { backgroundColor: theme.colors.text }]} />
|
|
149
|
+
</Pressable>
|
|
150
|
+
</View>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function Close() {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function Backdrop() {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import React, { createContext, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { Pressable, Text, View, type ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useTheme } from '../theme/use-theme';
|
|
5
|
+
import { Portal } from '../portal';
|
|
6
|
+
import { Context, useDialogContext } from './context';
|
|
7
|
+
import type { DialogControlProps, DialogInnerProps, DialogOuterProps } from './types';
|
|
8
|
+
|
|
9
|
+
export { useDialogContext, useDialogControl } from './context';
|
|
10
|
+
export type { DialogControlProps, DialogOuterProps, DialogInnerProps } from './types';
|
|
11
|
+
|
|
12
|
+
const FADE_OUT_DURATION = 150;
|
|
13
|
+
|
|
14
|
+
const stopPropagation = (e: { stopPropagation: () => void }) => e.stopPropagation();
|
|
15
|
+
|
|
16
|
+
const ClosingContext = createContext(false);
|
|
17
|
+
|
|
18
|
+
export function Outer({
|
|
19
|
+
children,
|
|
20
|
+
control,
|
|
21
|
+
onClose,
|
|
22
|
+
testID,
|
|
23
|
+
webOptions,
|
|
24
|
+
}: React.PropsWithChildren<DialogOuterProps>) {
|
|
25
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
26
|
+
const [isClosing, setIsClosing] = useState(false);
|
|
27
|
+
const closeCallbacksRef = useRef<(() => void)[]>([]);
|
|
28
|
+
|
|
29
|
+
const open = useCallback(() => {
|
|
30
|
+
setIsClosing(false);
|
|
31
|
+
setIsOpen(true);
|
|
32
|
+
}, []);
|
|
33
|
+
|
|
34
|
+
const close = useCallback<DialogControlProps['close']>((cb) => {
|
|
35
|
+
if (typeof cb === 'function') {
|
|
36
|
+
closeCallbacksRef.current.push(cb);
|
|
37
|
+
}
|
|
38
|
+
setIsClosing(true);
|
|
39
|
+
}, []);
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (!isClosing) return;
|
|
43
|
+
|
|
44
|
+
const timer = setTimeout(() => {
|
|
45
|
+
setIsOpen(false);
|
|
46
|
+
setIsClosing(false);
|
|
47
|
+
for (const cb of closeCallbacksRef.current) {
|
|
48
|
+
try {
|
|
49
|
+
cb();
|
|
50
|
+
} catch (e) {
|
|
51
|
+
console.error('Dialog close callback error:', e);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
closeCallbacksRef.current = [];
|
|
55
|
+
onClose?.();
|
|
56
|
+
}, FADE_OUT_DURATION);
|
|
57
|
+
|
|
58
|
+
return () => clearTimeout(timer);
|
|
59
|
+
}, [isClosing, onClose]);
|
|
60
|
+
|
|
61
|
+
useImperativeHandle(
|
|
62
|
+
control.ref,
|
|
63
|
+
() => ({ open, close }),
|
|
64
|
+
[open, close],
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const context = useMemo(
|
|
68
|
+
() => ({ close, isWithinDialog: true }),
|
|
69
|
+
[close],
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
if (!isOpen) return null;
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<Portal>
|
|
76
|
+
<Context.Provider value={context}>
|
|
77
|
+
<ClosingContext.Provider value={isClosing}>
|
|
78
|
+
<Pressable
|
|
79
|
+
onPress={() => close()}
|
|
80
|
+
style={{
|
|
81
|
+
position: 'fixed' as 'absolute',
|
|
82
|
+
top: 0,
|
|
83
|
+
left: 0,
|
|
84
|
+
right: 0,
|
|
85
|
+
bottom: 0,
|
|
86
|
+
zIndex: 50,
|
|
87
|
+
alignItems: 'center',
|
|
88
|
+
justifyContent: webOptions?.alignCenter ? 'center' : undefined,
|
|
89
|
+
paddingHorizontal: 20,
|
|
90
|
+
paddingVertical: '10vh' as unknown as number,
|
|
91
|
+
overflow: 'scroll',
|
|
92
|
+
}}
|
|
93
|
+
>
|
|
94
|
+
<DialogBackdrop isClosing={isClosing} />
|
|
95
|
+
<View
|
|
96
|
+
testID={testID}
|
|
97
|
+
style={{
|
|
98
|
+
width: '100%',
|
|
99
|
+
zIndex: 60,
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
minHeight: webOptions?.alignCenter ? undefined : '60%',
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
{children}
|
|
105
|
+
</View>
|
|
106
|
+
</Pressable>
|
|
107
|
+
</ClosingContext.Provider>
|
|
108
|
+
</Context.Provider>
|
|
109
|
+
</Portal>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function Inner({
|
|
114
|
+
children,
|
|
115
|
+
style,
|
|
116
|
+
label,
|
|
117
|
+
header,
|
|
118
|
+
contentContainerStyle,
|
|
119
|
+
}: DialogInnerProps) {
|
|
120
|
+
const theme = useTheme();
|
|
121
|
+
const isClosing = useContext(ClosingContext);
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<View
|
|
125
|
+
role="dialog"
|
|
126
|
+
aria-label={label}
|
|
127
|
+
onStartShouldSetResponder={() => true}
|
|
128
|
+
onResponderRelease={stopPropagation}
|
|
129
|
+
{...({ onClick: stopPropagation } as Record<string, unknown>)}
|
|
130
|
+
style={[
|
|
131
|
+
{
|
|
132
|
+
position: 'relative',
|
|
133
|
+
borderRadius: 10,
|
|
134
|
+
width: '100%',
|
|
135
|
+
maxWidth: 600,
|
|
136
|
+
backgroundColor: theme.colors.background,
|
|
137
|
+
borderWidth: 1,
|
|
138
|
+
borderColor: theme.isDark ? 'rgba(255,255,255,0.1)' : 'rgba(0,0,0,0.1)',
|
|
139
|
+
shadowColor: '#000',
|
|
140
|
+
shadowOpacity: theme.isDark ? 0.4 : 0.1,
|
|
141
|
+
shadowRadius: 30,
|
|
142
|
+
shadowOffset: { width: 0, height: 4 },
|
|
143
|
+
overflow: 'hidden',
|
|
144
|
+
},
|
|
145
|
+
isClosing
|
|
146
|
+
? { animation: `bloomDialogZoomFadeOut ease-in ${FADE_OUT_DURATION}ms forwards` } as ViewStyle
|
|
147
|
+
: { animation: 'bloomDialogZoomFadeIn cubic-bezier(0.16, 1, 0.3, 1) 0.3s' } as ViewStyle,
|
|
148
|
+
style,
|
|
149
|
+
]}
|
|
150
|
+
>
|
|
151
|
+
{header}
|
|
152
|
+
<View style={[{ padding: 20 }, contentContainerStyle]}>
|
|
153
|
+
{children}
|
|
154
|
+
</View>
|
|
155
|
+
</View>
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function ScrollableInner(props: DialogInnerProps) {
|
|
160
|
+
return <Inner {...props} />;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export function Handle() {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function Close() {
|
|
168
|
+
const { close } = useDialogContext();
|
|
169
|
+
const theme = useTheme();
|
|
170
|
+
|
|
171
|
+
return (
|
|
172
|
+
<View
|
|
173
|
+
style={{
|
|
174
|
+
position: 'absolute',
|
|
175
|
+
top: 10,
|
|
176
|
+
right: 10,
|
|
177
|
+
zIndex: 10,
|
|
178
|
+
}}
|
|
179
|
+
>
|
|
180
|
+
<Pressable
|
|
181
|
+
onPress={() => close()}
|
|
182
|
+
accessibilityLabel="Close dialog"
|
|
183
|
+
style={{
|
|
184
|
+
width: 34,
|
|
185
|
+
height: 34,
|
|
186
|
+
borderRadius: 17,
|
|
187
|
+
backgroundColor: theme.isDark ? 'rgba(255,255,255,0.1)' : 'rgba(0,0,0,0.05)',
|
|
188
|
+
alignItems: 'center',
|
|
189
|
+
justifyContent: 'center',
|
|
190
|
+
}}
|
|
191
|
+
>
|
|
192
|
+
<Text style={{ fontSize: 18, color: theme.colors.text, lineHeight: 20 }}>
|
|
193
|
+
{'\u00D7'}
|
|
194
|
+
</Text>
|
|
195
|
+
</Pressable>
|
|
196
|
+
</View>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function DialogBackdrop({ isClosing }: { isClosing: boolean }) {
|
|
201
|
+
const style: ViewStyle[] = [
|
|
202
|
+
{
|
|
203
|
+
position: 'fixed' as 'absolute',
|
|
204
|
+
top: 0,
|
|
205
|
+
left: 0,
|
|
206
|
+
right: 0,
|
|
207
|
+
bottom: 0,
|
|
208
|
+
backgroundColor: 'rgba(0,0,0,0.8)',
|
|
209
|
+
},
|
|
210
|
+
isClosing
|
|
211
|
+
? { animation: `bloomDialogFadeOut ease-in ${FADE_OUT_DURATION}ms forwards` } as ViewStyle
|
|
212
|
+
: { animation: 'bloomDialogFadeIn ease-out 0.15s' } as ViewStyle,
|
|
213
|
+
];
|
|
214
|
+
|
|
215
|
+
return <View style={style} />;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export function Backdrop() {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* CSS keyframes required for web dialog animations.
|
|
224
|
+
* Consumers should inject this string into a <style> tag or their global CSS:
|
|
225
|
+
*
|
|
226
|
+
* ```css
|
|
227
|
+
* @keyframes bloomDialogFadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
228
|
+
* @keyframes bloomDialogFadeOut { from { opacity: 1; } to { opacity: 0; } }
|
|
229
|
+
* @keyframes bloomDialogZoomFadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
|
|
230
|
+
* @keyframes bloomDialogZoomFadeOut { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.95); } }
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
export const BLOOM_DIALOG_CSS = `
|
|
234
|
+
@keyframes bloomDialogFadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
235
|
+
@keyframes bloomDialogFadeOut { from { opacity: 1; } to { opacity: 0; } }
|
|
236
|
+
@keyframes bloomDialogZoomFadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
|
|
237
|
+
@keyframes bloomDialogZoomFadeOut { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.95); } }
|
|
238
|
+
`;
|