@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,34 @@
|
|
|
1
|
+
import { createContext, useContext, useId, useMemo, useRef } from 'react';
|
|
2
|
+
import type { DialogContextProps, DialogControlRefProps, DialogControlProps } from './types';
|
|
3
|
+
|
|
4
|
+
export const Context = createContext<DialogContextProps>({
|
|
5
|
+
close: () => {},
|
|
6
|
+
isWithinDialog: false,
|
|
7
|
+
});
|
|
8
|
+
Context.displayName = 'BloomDialogContext';
|
|
9
|
+
|
|
10
|
+
export function useDialogContext(): DialogContextProps {
|
|
11
|
+
return useContext(Context);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function useDialogControl(): DialogControlProps {
|
|
15
|
+
const id = useId();
|
|
16
|
+
const control = useRef<DialogControlRefProps | null>({
|
|
17
|
+
open: () => {},
|
|
18
|
+
close: () => {},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return useMemo<DialogControlProps>(
|
|
22
|
+
() => ({
|
|
23
|
+
id,
|
|
24
|
+
ref: control,
|
|
25
|
+
open: (options) => {
|
|
26
|
+
control.current?.open(options);
|
|
27
|
+
},
|
|
28
|
+
close: (cb) => {
|
|
29
|
+
control.current?.close(cb);
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
[id],
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ScrollViewProps, StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export type DialogControlRefProps = {
|
|
4
|
+
open: (options?: Record<string, unknown>) => void;
|
|
5
|
+
close: (callback?: () => void) => void;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type DialogControlProps = DialogControlRefProps & {
|
|
9
|
+
id: string;
|
|
10
|
+
ref: React.RefObject<DialogControlRefProps | null>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type DialogContextProps = {
|
|
14
|
+
close: DialogControlProps['close'];
|
|
15
|
+
isWithinDialog: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type DialogOuterProps = {
|
|
19
|
+
control: DialogControlProps;
|
|
20
|
+
onClose?: () => void;
|
|
21
|
+
testID?: string;
|
|
22
|
+
webOptions?: {
|
|
23
|
+
alignCenter?: boolean;
|
|
24
|
+
};
|
|
25
|
+
preventExpansion?: boolean;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type DialogInnerProps = React.PropsWithChildren<{
|
|
29
|
+
style?: StyleProp<ViewStyle>;
|
|
30
|
+
label?: string;
|
|
31
|
+
header?: React.ReactNode;
|
|
32
|
+
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
33
|
+
keyboardDismissMode?: ScrollViewProps['keyboardDismissMode'];
|
|
34
|
+
}>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { View, StyleSheet } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useTheme } from '../theme/use-theme';
|
|
5
|
+
import type { DividerProps } from './types';
|
|
6
|
+
|
|
7
|
+
const DividerComponent: React.FC<DividerProps> = ({
|
|
8
|
+
color,
|
|
9
|
+
thickness = StyleSheet.hairlineWidth,
|
|
10
|
+
vertical = false,
|
|
11
|
+
spacing = 0,
|
|
12
|
+
style,
|
|
13
|
+
testID,
|
|
14
|
+
}) => {
|
|
15
|
+
const theme = useTheme();
|
|
16
|
+
const resolvedColor = color ?? theme.colors.border;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<View
|
|
20
|
+
testID={testID}
|
|
21
|
+
style={[
|
|
22
|
+
vertical
|
|
23
|
+
? {
|
|
24
|
+
width: thickness,
|
|
25
|
+
alignSelf: 'stretch',
|
|
26
|
+
backgroundColor: resolvedColor,
|
|
27
|
+
marginHorizontal: spacing,
|
|
28
|
+
}
|
|
29
|
+
: {
|
|
30
|
+
height: thickness,
|
|
31
|
+
width: '100%',
|
|
32
|
+
backgroundColor: resolvedColor,
|
|
33
|
+
marginVertical: spacing,
|
|
34
|
+
},
|
|
35
|
+
style,
|
|
36
|
+
]}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const Divider = memo(DividerComponent);
|
|
42
|
+
Divider.displayName = 'Divider';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export interface DividerProps {
|
|
4
|
+
/** Custom color (defaults to theme.colors.border) */
|
|
5
|
+
color?: string;
|
|
6
|
+
/** Line thickness (defaults to StyleSheet.hairlineWidth) */
|
|
7
|
+
thickness?: number;
|
|
8
|
+
/** If true, renders a vertical divider */
|
|
9
|
+
vertical?: boolean;
|
|
10
|
+
/** Spacing around the divider (marginVertical for horizontal, marginHorizontal for vertical) */
|
|
11
|
+
spacing?: number;
|
|
12
|
+
/** Custom style */
|
|
13
|
+
style?: StyleProp<ViewStyle>;
|
|
14
|
+
testID?: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React, { Component, type ErrorInfo, type ReactNode } from 'react';
|
|
2
|
+
import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useTheme } from '../theme/use-theme';
|
|
5
|
+
import type { ErrorBoundaryProps } from './types';
|
|
6
|
+
|
|
7
|
+
interface ErrorBoundaryState {
|
|
8
|
+
hasError: boolean;
|
|
9
|
+
error: Error | null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function DefaultFallback({
|
|
13
|
+
title,
|
|
14
|
+
message,
|
|
15
|
+
retryLabel,
|
|
16
|
+
onRetry,
|
|
17
|
+
}: {
|
|
18
|
+
title: string;
|
|
19
|
+
message: string;
|
|
20
|
+
retryLabel: string;
|
|
21
|
+
onRetry: () => void;
|
|
22
|
+
}) {
|
|
23
|
+
const theme = useTheme();
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<View style={[styles.container, { backgroundColor: theme.colors.background }]}>
|
|
27
|
+
<Text style={[styles.title, { color: theme.colors.text }]}>{title}</Text>
|
|
28
|
+
<Text style={[styles.message, { color: theme.colors.textSecondary }]}>{message}</Text>
|
|
29
|
+
<TouchableOpacity
|
|
30
|
+
style={[styles.retryButton, { backgroundColor: theme.colors.primary }]}
|
|
31
|
+
onPress={onRetry}
|
|
32
|
+
activeOpacity={0.7}
|
|
33
|
+
>
|
|
34
|
+
<Text style={styles.retryText}>{retryLabel}</Text>
|
|
35
|
+
</TouchableOpacity>
|
|
36
|
+
</View>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
41
|
+
static displayName = 'ErrorBoundary';
|
|
42
|
+
|
|
43
|
+
state: ErrorBoundaryState = {
|
|
44
|
+
hasError: false,
|
|
45
|
+
error: null,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
static getDerivedStateFromError(error: Error): ErrorBoundaryState {
|
|
49
|
+
return { hasError: true, error };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void {
|
|
53
|
+
this.props.onError?.(error, errorInfo);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private handleRetry = (): void => {
|
|
57
|
+
this.setState({ hasError: false, error: null });
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
render(): ReactNode {
|
|
61
|
+
if (this.state.hasError) {
|
|
62
|
+
if (this.props.fallback) {
|
|
63
|
+
return this.props.fallback;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<DefaultFallback
|
|
68
|
+
title={this.props.title ?? 'Something went wrong'}
|
|
69
|
+
message={this.props.message ?? 'An unexpected error occurred'}
|
|
70
|
+
retryLabel={this.props.retryLabel ?? 'Try Again'}
|
|
71
|
+
onRetry={this.handleRetry}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return this.props.children;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const styles = StyleSheet.create({
|
|
81
|
+
container: {
|
|
82
|
+
flex: 1,
|
|
83
|
+
alignItems: 'center',
|
|
84
|
+
justifyContent: 'center',
|
|
85
|
+
padding: 20,
|
|
86
|
+
},
|
|
87
|
+
title: {
|
|
88
|
+
fontSize: 24,
|
|
89
|
+
fontWeight: 'bold',
|
|
90
|
+
marginBottom: 12,
|
|
91
|
+
textAlign: 'center',
|
|
92
|
+
},
|
|
93
|
+
message: {
|
|
94
|
+
fontSize: 16,
|
|
95
|
+
textAlign: 'center',
|
|
96
|
+
marginBottom: 24,
|
|
97
|
+
lineHeight: 22,
|
|
98
|
+
paddingHorizontal: 16,
|
|
99
|
+
},
|
|
100
|
+
retryButton: {
|
|
101
|
+
paddingHorizontal: 24,
|
|
102
|
+
paddingVertical: 12,
|
|
103
|
+
borderRadius: 12,
|
|
104
|
+
minWidth: 120,
|
|
105
|
+
alignItems: 'center',
|
|
106
|
+
},
|
|
107
|
+
retryText: {
|
|
108
|
+
color: '#FFFFFF',
|
|
109
|
+
fontSize: 16,
|
|
110
|
+
fontWeight: '600',
|
|
111
|
+
},
|
|
112
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactNode, ErrorInfo } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ErrorBoundaryProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** Custom fallback UI to render on error */
|
|
6
|
+
fallback?: ReactNode;
|
|
7
|
+
/** Error title (defaults to "Something went wrong") */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** Error message (defaults to "An unexpected error occurred") */
|
|
10
|
+
message?: string;
|
|
11
|
+
/** Retry button label (defaults to "Try Again") */
|
|
12
|
+
retryLabel?: string;
|
|
13
|
+
/** Callback when an error is caught */
|
|
14
|
+
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
15
|
+
testID?: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React, { Children } from 'react';
|
|
2
|
+
import { View, Text, TouchableOpacity } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useTheme } from '../theme/use-theme';
|
|
5
|
+
import type { GroupedButtonsProps, GroupedButtonItemProps } from './types';
|
|
6
|
+
|
|
7
|
+
export type { GroupedButtonsProps, GroupedButtonItemProps } from './types';
|
|
8
|
+
|
|
9
|
+
export function GroupedButtons({ children, style }: GroupedButtonsProps) {
|
|
10
|
+
const theme = useTheme();
|
|
11
|
+
const childArray = Children.toArray(children);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<View
|
|
15
|
+
style={[
|
|
16
|
+
{
|
|
17
|
+
borderRadius: 12,
|
|
18
|
+
backgroundColor: theme.colors.card,
|
|
19
|
+
overflow: 'hidden',
|
|
20
|
+
},
|
|
21
|
+
style,
|
|
22
|
+
]}
|
|
23
|
+
>
|
|
24
|
+
{childArray.map((child, index) => (
|
|
25
|
+
<React.Fragment key={index}>
|
|
26
|
+
{child}
|
|
27
|
+
{index < childArray.length - 1 && (
|
|
28
|
+
<View
|
|
29
|
+
style={{
|
|
30
|
+
height: 1,
|
|
31
|
+
backgroundColor: theme.colors.borderLight,
|
|
32
|
+
marginLeft: 16,
|
|
33
|
+
}}
|
|
34
|
+
/>
|
|
35
|
+
)}
|
|
36
|
+
</React.Fragment>
|
|
37
|
+
))}
|
|
38
|
+
</View>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function Item({
|
|
43
|
+
label,
|
|
44
|
+
description,
|
|
45
|
+
icon,
|
|
46
|
+
onPress,
|
|
47
|
+
destructive = false,
|
|
48
|
+
disabled = false,
|
|
49
|
+
testID,
|
|
50
|
+
}: GroupedButtonItemProps) {
|
|
51
|
+
const theme = useTheme();
|
|
52
|
+
|
|
53
|
+
const labelColor = destructive ? theme.colors.negative : theme.colors.text;
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<TouchableOpacity
|
|
57
|
+
onPress={onPress}
|
|
58
|
+
disabled={disabled}
|
|
59
|
+
activeOpacity={0.6}
|
|
60
|
+
testID={testID}
|
|
61
|
+
style={{
|
|
62
|
+
flexDirection: 'row',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
paddingVertical: 12,
|
|
65
|
+
paddingHorizontal: 16,
|
|
66
|
+
opacity: disabled ? 0.5 : 1,
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
{icon && (
|
|
70
|
+
<View style={{ marginRight: 12 }}>
|
|
71
|
+
{icon}
|
|
72
|
+
</View>
|
|
73
|
+
)}
|
|
74
|
+
<View style={{ flex: 1 }}>
|
|
75
|
+
<Text style={{ fontSize: 16, color: labelColor }}>
|
|
76
|
+
{label}
|
|
77
|
+
</Text>
|
|
78
|
+
{description && (
|
|
79
|
+
<Text
|
|
80
|
+
style={{
|
|
81
|
+
fontSize: 13,
|
|
82
|
+
color: theme.colors.textSecondary,
|
|
83
|
+
marginTop: 2,
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
{description}
|
|
87
|
+
</Text>
|
|
88
|
+
)}
|
|
89
|
+
</View>
|
|
90
|
+
</TouchableOpacity>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
GroupedButtons.Item = Item;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export interface GroupedButtonsProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
style?: StyleProp<ViewStyle>;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface GroupedButtonItemProps {
|
|
9
|
+
label: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
onPress: () => void;
|
|
13
|
+
destructive?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
testID?: string;
|
|
16
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './theme';
|
|
2
|
+
export * from './portal';
|
|
3
|
+
export * as Dialog from './dialog';
|
|
4
|
+
export * as Prompt from './prompt';
|
|
5
|
+
export * from './button';
|
|
6
|
+
export * from './grouped-buttons';
|
|
7
|
+
export * from './divider';
|
|
8
|
+
export * from './radio-indicator';
|
|
9
|
+
export * from './collapsible';
|
|
10
|
+
export { ErrorBoundary } from './error-boundary';
|
|
11
|
+
export type { ErrorBoundaryProps } from './error-boundary';
|
|
12
|
+
export * from './avatar';
|
|
13
|
+
export * from './loading';
|
|
14
|
+
export * as PromptInput from './prompt-input';
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import React, { memo, useEffect, useMemo } from 'react';
|
|
2
|
+
import { View, Text, ActivityIndicator, StyleSheet, type DimensionValue } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useTheme } from '../theme/use-theme';
|
|
5
|
+
import type {
|
|
6
|
+
LoadingProps,
|
|
7
|
+
SpinnerLoadingProps,
|
|
8
|
+
TopLoadingProps,
|
|
9
|
+
SkeletonLoadingProps,
|
|
10
|
+
InlineLoadingProps,
|
|
11
|
+
} from './types';
|
|
12
|
+
|
|
13
|
+
const SIZE_CONFIG = {
|
|
14
|
+
small: { spinner: 20, text: 13 },
|
|
15
|
+
medium: { spinner: 24, text: 15 },
|
|
16
|
+
large: { spinner: 44, text: 16 },
|
|
17
|
+
} as const;
|
|
18
|
+
|
|
19
|
+
// Lazy-loaded reanimated for the top variant
|
|
20
|
+
type ReanimatedType = typeof import('react-native-reanimated');
|
|
21
|
+
let reanimatedModule: ReanimatedType | null = null;
|
|
22
|
+
let reanimatedResolved = false;
|
|
23
|
+
|
|
24
|
+
function getReanimated(): ReanimatedType | null {
|
|
25
|
+
if (!reanimatedResolved) {
|
|
26
|
+
reanimatedResolved = true;
|
|
27
|
+
try {
|
|
28
|
+
reanimatedModule = require('react-native-reanimated');
|
|
29
|
+
} catch {
|
|
30
|
+
reanimatedModule = null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return reanimatedModule;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const SpinnerLoading: React.FC<SpinnerLoadingProps> = ({
|
|
37
|
+
size = 'medium',
|
|
38
|
+
color,
|
|
39
|
+
text,
|
|
40
|
+
textStyle,
|
|
41
|
+
style,
|
|
42
|
+
showText = true,
|
|
43
|
+
iconSize,
|
|
44
|
+
spinnerIcon,
|
|
45
|
+
testID,
|
|
46
|
+
}) => {
|
|
47
|
+
const theme = useTheme();
|
|
48
|
+
const sizeConfig = SIZE_CONFIG[size];
|
|
49
|
+
const effectiveIconSize = iconSize ?? sizeConfig.spinner;
|
|
50
|
+
const spinnerColor = color ?? theme.colors.primary;
|
|
51
|
+
const textColor = color ?? theme.colors.textSecondary;
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<View style={[styles.container, style]} testID={testID}>
|
|
55
|
+
{spinnerIcon ?? <ActivityIndicator size={effectiveIconSize > 30 ? 'large' : 'small'} color={spinnerColor} />}
|
|
56
|
+
{showText && text && (
|
|
57
|
+
<Text
|
|
58
|
+
style={[
|
|
59
|
+
styles.text,
|
|
60
|
+
{ color: textColor, fontSize: sizeConfig.text, marginTop: 8 },
|
|
61
|
+
textStyle,
|
|
62
|
+
]}
|
|
63
|
+
>
|
|
64
|
+
{text}
|
|
65
|
+
</Text>
|
|
66
|
+
)}
|
|
67
|
+
</View>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const TopLoading: React.FC<TopLoadingProps> = ({
|
|
72
|
+
size = 'medium',
|
|
73
|
+
color,
|
|
74
|
+
style,
|
|
75
|
+
showLoading = true,
|
|
76
|
+
iconSize,
|
|
77
|
+
heightOffset = 0,
|
|
78
|
+
spinnerIcon,
|
|
79
|
+
testID,
|
|
80
|
+
}) => {
|
|
81
|
+
const theme = useTheme();
|
|
82
|
+
const sizeConfig = SIZE_CONFIG[size];
|
|
83
|
+
const effectiveIconSize = iconSize ?? sizeConfig.spinner;
|
|
84
|
+
const targetHeight = Math.max(0, effectiveIconSize + sizeConfig.spinner + heightOffset);
|
|
85
|
+
const spinnerColor = color ?? theme.colors.primary;
|
|
86
|
+
|
|
87
|
+
const reanimated = getReanimated();
|
|
88
|
+
|
|
89
|
+
// Non-animated fallback when reanimated is not available
|
|
90
|
+
if (!reanimated) {
|
|
91
|
+
if (!showLoading) return null;
|
|
92
|
+
return (
|
|
93
|
+
<View style={[styles.topContainer, { height: targetHeight }, style]} testID={testID}>
|
|
94
|
+
<View style={[styles.topLoadingView, { height: targetHeight }]}>
|
|
95
|
+
{spinnerIcon ?? <ActivityIndicator size={effectiveIconSize > 30 ? 'large' : 'small'} color={spinnerColor} />}
|
|
96
|
+
</View>
|
|
97
|
+
</View>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const { default: Animated, useAnimatedStyle, useSharedValue, withTiming, Easing } = reanimated;
|
|
102
|
+
|
|
103
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
104
|
+
const height = useSharedValue(showLoading ? targetHeight : 0);
|
|
105
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
106
|
+
const opacity = useSharedValue(showLoading ? 1 : 0);
|
|
107
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
108
|
+
const translateY = useSharedValue(showLoading ? 0 : -targetHeight);
|
|
109
|
+
|
|
110
|
+
const timingConfig = { duration: 250, easing: Easing.out(Easing.cubic) };
|
|
111
|
+
|
|
112
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
height.value = withTiming(showLoading ? targetHeight : 0, timingConfig);
|
|
115
|
+
opacity.value = withTiming(showLoading ? 1 : 0, timingConfig);
|
|
116
|
+
translateY.value = withTiming(showLoading ? 0 : -targetHeight, timingConfig);
|
|
117
|
+
}, [showLoading, targetHeight, height, opacity, translateY]);
|
|
118
|
+
|
|
119
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
120
|
+
const containerAnimated = useAnimatedStyle(() => ({
|
|
121
|
+
height: height.value,
|
|
122
|
+
}));
|
|
123
|
+
|
|
124
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
125
|
+
const innerAnimated = useAnimatedStyle(() => ({
|
|
126
|
+
opacity: opacity.value,
|
|
127
|
+
transform: [{ translateY: translateY.value }],
|
|
128
|
+
}));
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<Animated.View style={[styles.topContainer, containerAnimated]} testID={testID}>
|
|
132
|
+
<Animated.View style={[styles.topLoadingView, { height: targetHeight }, innerAnimated, style]}>
|
|
133
|
+
{spinnerIcon ?? <ActivityIndicator size={effectiveIconSize > 30 ? 'large' : 'small'} color={spinnerColor} />}
|
|
134
|
+
</Animated.View>
|
|
135
|
+
</Animated.View>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const SkeletonLoading: React.FC<SkeletonLoadingProps> = ({
|
|
140
|
+
lines = 3,
|
|
141
|
+
width = '100%',
|
|
142
|
+
lineHeight = 16,
|
|
143
|
+
style,
|
|
144
|
+
testID,
|
|
145
|
+
}) => {
|
|
146
|
+
const theme = useTheme();
|
|
147
|
+
const skeletonColor = theme.colors.backgroundSecondary;
|
|
148
|
+
|
|
149
|
+
const skeletonLines = useMemo(
|
|
150
|
+
() =>
|
|
151
|
+
Array.from({ length: lines }, (_, index) => (
|
|
152
|
+
<View
|
|
153
|
+
key={index}
|
|
154
|
+
style={[
|
|
155
|
+
styles.skeletonLine,
|
|
156
|
+
{
|
|
157
|
+
width: (typeof width === 'string' ? width : `${width}%`) as DimensionValue,
|
|
158
|
+
height: lineHeight,
|
|
159
|
+
backgroundColor: skeletonColor,
|
|
160
|
+
marginBottom: index < lines - 1 ? 8 : 0,
|
|
161
|
+
},
|
|
162
|
+
]}
|
|
163
|
+
/>
|
|
164
|
+
)),
|
|
165
|
+
[lines, width, lineHeight, skeletonColor],
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<View style={[styles.skeletonContainer, style]} testID={testID}>
|
|
170
|
+
{skeletonLines}
|
|
171
|
+
</View>
|
|
172
|
+
);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const InlineLoading: React.FC<InlineLoadingProps> = ({
|
|
176
|
+
size = 'small',
|
|
177
|
+
color,
|
|
178
|
+
text,
|
|
179
|
+
style,
|
|
180
|
+
textStyle,
|
|
181
|
+
spinnerIcon,
|
|
182
|
+
testID,
|
|
183
|
+
}) => {
|
|
184
|
+
const theme = useTheme();
|
|
185
|
+
const sizeConfig = SIZE_CONFIG[size];
|
|
186
|
+
const spinnerColor = color ?? theme.colors.primary;
|
|
187
|
+
const textColor = theme.colors.textSecondary;
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<View style={[styles.inlineContainer, style]} testID={testID}>
|
|
191
|
+
{spinnerIcon ?? <ActivityIndicator size="small" color={spinnerColor} />}
|
|
192
|
+
{text && (
|
|
193
|
+
<Text
|
|
194
|
+
style={[
|
|
195
|
+
{ color: textColor, fontSize: sizeConfig.text, marginLeft: 8 },
|
|
196
|
+
textStyle,
|
|
197
|
+
]}
|
|
198
|
+
>
|
|
199
|
+
{text}
|
|
200
|
+
</Text>
|
|
201
|
+
)}
|
|
202
|
+
</View>
|
|
203
|
+
);
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const LoadingComponent: React.FC<LoadingProps> = (props) => {
|
|
207
|
+
const variant = props.variant ?? 'spinner';
|
|
208
|
+
|
|
209
|
+
switch (variant) {
|
|
210
|
+
case 'top':
|
|
211
|
+
return <TopLoading {...(props as TopLoadingProps)} />;
|
|
212
|
+
case 'skeleton':
|
|
213
|
+
return <SkeletonLoading {...(props as SkeletonLoadingProps)} />;
|
|
214
|
+
case 'inline':
|
|
215
|
+
return <InlineLoading {...(props as InlineLoadingProps)} />;
|
|
216
|
+
case 'spinner':
|
|
217
|
+
default:
|
|
218
|
+
return <SpinnerLoading {...(props as SpinnerLoadingProps)} />;
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export const Loading = memo(LoadingComponent);
|
|
223
|
+
Loading.displayName = 'Loading';
|
|
224
|
+
|
|
225
|
+
const styles = StyleSheet.create({
|
|
226
|
+
container: {
|
|
227
|
+
flex: 1,
|
|
228
|
+
alignItems: 'center',
|
|
229
|
+
justifyContent: 'center',
|
|
230
|
+
},
|
|
231
|
+
text: {
|
|
232
|
+
textAlign: 'center',
|
|
233
|
+
},
|
|
234
|
+
topContainer: {
|
|
235
|
+
width: '100%',
|
|
236
|
+
position: 'relative',
|
|
237
|
+
overflow: 'hidden',
|
|
238
|
+
},
|
|
239
|
+
topLoadingView: {
|
|
240
|
+
width: '100%',
|
|
241
|
+
alignItems: 'center',
|
|
242
|
+
justifyContent: 'center',
|
|
243
|
+
position: 'absolute',
|
|
244
|
+
top: 0,
|
|
245
|
+
left: 0,
|
|
246
|
+
},
|
|
247
|
+
skeletonContainer: {
|
|
248
|
+
width: '100%',
|
|
249
|
+
},
|
|
250
|
+
skeletonLine: {
|
|
251
|
+
borderRadius: 4,
|
|
252
|
+
},
|
|
253
|
+
inlineContainer: {
|
|
254
|
+
flexDirection: 'row',
|
|
255
|
+
alignItems: 'center',
|
|
256
|
+
justifyContent: 'center',
|
|
257
|
+
},
|
|
258
|
+
});
|