@swan-io/lake 1.0.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/HISTORY.md +3 -0
- package/LICENSE +21 -0
- package/README.md +49 -0
- package/package.json +60 -0
- package/src/components/Alert.d.ts +10 -0
- package/src/components/Alert.js +36 -0
- package/src/components/AppOpeningAnimation.d.ts +10 -0
- package/src/components/AppOpeningAnimation.js +50 -0
- package/src/components/AutoWidthImage.d.ts +8 -0
- package/src/components/AutoWidthImage.js +26 -0
- package/src/components/Avatar.d.ts +7 -0
- package/src/components/Avatar.js +42 -0
- package/src/components/BorderedButton.d.ts +16 -0
- package/src/components/BorderedButton.js +98 -0
- package/src/components/BorderedIcon.d.ts +12 -0
- package/src/components/BorderedIcon.js +25 -0
- package/src/components/BottomPanel.d.ts +9 -0
- package/src/components/BottomPanel.js +94 -0
- package/src/components/Box.d.ts +65 -0
- package/src/components/Box.js +31 -0
- package/src/components/Breadcrumbs.d.ts +18 -0
- package/src/components/Breadcrumbs.js +362 -0
- package/src/components/Button.d.ts +15 -0
- package/src/components/Button.js +83 -0
- package/src/components/Caption.d.ts +6 -0
- package/src/components/Caption.js +11 -0
- package/src/components/Checkbox.d.ts +12 -0
- package/src/components/Checkbox.js +83 -0
- package/src/components/ChoicePicker.d.ts +11 -0
- package/src/components/ChoicePicker.js +99 -0
- package/src/components/Combobox.d.ts +29 -0
- package/src/components/Combobox.js +182 -0
- package/src/components/FailureIcon.d.ts +8 -0
- package/src/components/FailureIcon.js +4 -0
- package/src/components/FileTile.d.ts +11 -0
- package/src/components/FileTile.js +37 -0
- package/src/components/Fill.d.ts +8 -0
- package/src/components/Fill.js +24 -0
- package/src/components/FilterChooser.d.ts +15 -0
- package/src/components/FilterChooser.js +52 -0
- package/src/components/Filters.d.ts +57 -0
- package/src/components/Filters.js +229 -0
- package/src/components/FixedListView.d.ts +104 -0
- package/src/components/FixedListView.js +821 -0
- package/src/components/FixedListViewCells.d.ts +55 -0
- package/src/components/FixedListViewCells.js +157 -0
- package/src/components/Flag.d.ts +8 -0
- package/src/components/Flag.js +36 -0
- package/src/components/FlowPresentation.d.ts +12 -0
- package/src/components/FlowPresentation.js +70 -0
- package/src/components/FocusTrap.d.ts +16 -0
- package/src/components/FocusTrap.js +90 -0
- package/src/components/Form.d.ts +8 -0
- package/src/components/Form.js +17 -0
- package/src/components/FullViewportLayer.d.ts +7 -0
- package/src/components/FullViewportLayer.js +91 -0
- package/src/components/Grid.d.ts +13 -0
- package/src/components/Grid.js +33 -0
- package/src/components/Heading.d.ts +61 -0
- package/src/components/Heading.js +27 -0
- package/src/components/Icon.d.ts +191 -0
- package/src/components/Icon.js +11 -0
- package/src/components/Input.d.ts +34 -0
- package/src/components/Input.js +115 -0
- package/src/components/InputError.d.ts +8 -0
- package/src/components/InputError.js +16 -0
- package/src/components/Label.d.ts +10 -0
- package/src/components/Label.js +19 -0
- package/src/components/LakeAlert.d.ts +14 -0
- package/src/components/LakeAlert.js +75 -0
- package/src/components/LakeButton.d.ts +36 -0
- package/src/components/LakeButton.js +171 -0
- package/src/components/LakeCheckbox.d.ts +16 -0
- package/src/components/LakeCheckbox.js +54 -0
- package/src/components/LakeCombobox.d.ts +28 -0
- package/src/components/LakeCombobox.js +166 -0
- package/src/components/LakeCopyButton.d.ts +10 -0
- package/src/components/LakeCopyButton.js +16 -0
- package/src/components/LakeDownloadButton.d.ts +8 -0
- package/src/components/LakeDownloadButton.js +6 -0
- package/src/components/LakeHeading.d.ts +10 -0
- package/src/components/LakeHeading.js +19 -0
- package/src/components/LakeLabel.d.ts +19 -0
- package/src/components/LakeLabel.js +43 -0
- package/src/components/LakeModal.d.ts +14 -0
- package/src/components/LakeModal.js +132 -0
- package/src/components/LakeRadio.d.ts +9 -0
- package/src/components/LakeRadio.js +44 -0
- package/src/components/LakeScrollView.d.ts +10 -0
- package/src/components/LakeScrollView.js +35 -0
- package/src/components/LakeSearchField.d.ts +10 -0
- package/src/components/LakeSearchField.js +111 -0
- package/src/components/LakeSelect.d.ts +30 -0
- package/src/components/LakeSelect.js +183 -0
- package/src/components/LakeSlider.d.ts +12 -0
- package/src/components/LakeSlider.js +31 -0
- package/src/components/LakeStepper.d.ts +21 -0
- package/src/components/LakeStepper.js +134 -0
- package/src/components/LakeText.d.ts +19 -0
- package/src/components/LakeText.js +20 -0
- package/src/components/LakeTextInput.d.ts +36 -0
- package/src/components/LakeTextInput.js +154 -0
- package/src/components/LakeTooltip.d.ts +24 -0
- package/src/components/LakeTooltip.js +188 -0
- package/src/components/Link.d.ts +138 -0
- package/src/components/Link.js +23 -0
- package/src/components/ListRightPanel.d.ts +17 -0
- package/src/components/ListRightPanel.js +79 -0
- package/src/components/LoadingView.d.ts +9 -0
- package/src/components/LoadingView.js +24 -0
- package/src/components/Modal.d.ts +12 -0
- package/src/components/Modal.js +80 -0
- package/src/components/MultiSelect.d.ts +27 -0
- package/src/components/MultiSelect.js +223 -0
- package/src/components/MultilineInput.d.ts +15 -0
- package/src/components/MultilineInput.js +55 -0
- package/src/components/Picker.d.ts +26 -0
- package/src/components/Picker.js +116 -0
- package/src/components/PlainListView.d.ts +36 -0
- package/src/components/PlainListView.js +208 -0
- package/src/components/Popover.d.ts +23 -0
- package/src/components/Popover.js +147 -0
- package/src/components/PopoverContent.d.ts +8 -0
- package/src/components/PopoverContent.js +9 -0
- package/src/components/Portal.d.ts +7 -0
- package/src/components/Portal.js +9 -0
- package/src/components/Pressable.d.ts +348 -0
- package/src/components/Pressable.js +91 -0
- package/src/components/ProgressBar.d.ts +11 -0
- package/src/components/ProgressBar.js +46 -0
- package/src/components/ProjectEnvTag.d.ts +7 -0
- package/src/components/ProjectEnvTag.js +12 -0
- package/src/components/QuickActions.d.ts +15 -0
- package/src/components/QuickActions.js +38 -0
- package/src/components/RadioGroup.d.ts +16 -0
- package/src/components/RadioGroup.js +34 -0
- package/src/components/ReadOnlyFieldList.d.ts +6 -0
- package/src/components/ReadOnlyFieldList.js +8 -0
- package/src/components/ResponsiveContainer.d.ts +13 -0
- package/src/components/ResponsiveContainer.js +23 -0
- package/src/components/RightPanel.d.ts +10 -0
- package/src/components/RightPanel.js +102 -0
- package/src/components/SegmentedControl.d.ts +19 -0
- package/src/components/SegmentedControl.js +74 -0
- package/src/components/Separator.d.ts +10 -0
- package/src/components/Separator.js +19 -0
- package/src/components/SidebarNavigationTracker.d.ts +13 -0
- package/src/components/SidebarNavigationTracker.js +93 -0
- package/src/components/Slider.d.ts +11 -0
- package/src/components/Slider.js +119 -0
- package/src/components/SmsOpeningAnimation.d.ts +8 -0
- package/src/components/SmsOpeningAnimation.js +52 -0
- package/src/components/Space.d.ts +10 -0
- package/src/components/Space.js +23 -0
- package/src/components/Stack.d.ts +12 -0
- package/src/components/Stack.js +23 -0
- package/src/components/StepDots.d.ts +7 -0
- package/src/components/StepDots.js +24 -0
- package/src/components/Stepper.d.ts +9 -0
- package/src/components/Stepper.js +67 -0
- package/src/components/SuccessIcon.d.ts +8 -0
- package/src/components/SuccessIcon.js +4 -0
- package/src/components/Svg.d.ts +145 -0
- package/src/components/Svg.js +24 -0
- package/src/components/SwanLogo.d.ts +8 -0
- package/src/components/SwanLogo.js +11 -0
- package/src/components/Switch.d.ts +9 -0
- package/src/components/Switch.js +74 -0
- package/src/components/TabView.d.ts +16 -0
- package/src/components/TabView.js +398 -0
- package/src/components/Table.d.ts +34 -0
- package/src/components/Table.js +79 -0
- package/src/components/Tag.d.ts +17 -0
- package/src/components/Tag.js +76 -0
- package/src/components/Tile.d.ts +34 -0
- package/src/components/Tile.js +130 -0
- package/src/components/TilePlaceholder.d.ts +6 -0
- package/src/components/TilePlaceholder.js +51 -0
- package/src/components/ToastStack.d.ts +2 -0
- package/src/components/ToastStack.js +96 -0
- package/src/components/Tooltip.d.ts +18 -0
- package/src/components/Tooltip.js +162 -0
- package/src/components/TransitionGroupView.d.ts +12 -0
- package/src/components/TransitionGroupView.js +43 -0
- package/src/components/TransitionView.d.ts +12 -0
- package/src/components/TransitionView.js +43 -0
- package/src/components/WithCurrentColor.d.ts +12 -0
- package/src/components/WithCurrentColor.js +65 -0
- package/src/components/WithPartnerAccentColor.d.ts +7 -0
- package/src/components/WithPartnerAccentColor.js +91 -0
- package/src/constants/colors.d.ts +42 -0
- package/src/constants/colors.js +42 -0
- package/src/constants/commonStyles.d.ts +66 -0
- package/src/constants/commonStyles.js +45 -0
- package/src/constants/design.d.ts +168 -0
- package/src/constants/design.js +564 -0
- package/src/constants/insets.d.ts +10 -0
- package/src/constants/insets.js +22 -0
- package/src/constants/typography.d.ts +26 -0
- package/src/constants/typography.js +54 -0
- package/src/hooks/useAnimatedValue.d.ts +2 -0
- package/src/hooks/useAnimatedValue.js +3 -0
- package/src/hooks/useBodyClassName.d.ts +3 -0
- package/src/hooks/useBodyClassName.js +14 -0
- package/src/hooks/useBoolean.d.ts +8 -0
- package/src/hooks/useBoolean.js +12 -0
- package/src/hooks/useComputedColors.d.ts +10 -0
- package/src/hooks/useComputedColors.js +42 -0
- package/src/hooks/useDebounce.d.ts +1 -0
- package/src/hooks/useDebounce.js +12 -0
- package/src/hooks/useDisclosure.d.ts +8 -0
- package/src/hooks/useDisclosure.js +12 -0
- package/src/hooks/useFirstMountState.d.ts +1 -0
- package/src/hooks/useFirstMountState.js +9 -0
- package/src/hooks/useForceableState.d.ts +1 -0
- package/src/hooks/useForceableState.js +6 -0
- package/src/hooks/useHover.d.ts +11 -0
- package/src/hooks/useHover.js +4 -0
- package/src/hooks/useInterval.d.ts +1 -0
- package/src/hooks/useInterval.js +11 -0
- package/src/hooks/useLazyRef.d.ts +2 -0
- package/src/hooks/useLazyRef.js +9 -0
- package/src/hooks/useMergeRefs.d.ts +2 -0
- package/src/hooks/useMergeRefs.js +5 -0
- package/src/hooks/useNativeProp.d.ts +2 -0
- package/src/hooks/useNativeProp.js +9 -0
- package/src/hooks/useOutsideClick.d.ts +8 -0
- package/src/hooks/useOutsideClick.js +54 -0
- package/src/hooks/usePersistedState.d.ts +1 -0
- package/src/hooks/usePersistedState.js +21 -0
- package/src/hooks/usePressEvents.d.ts +31 -0
- package/src/hooks/usePressEvents.js +4 -0
- package/src/hooks/usePreviousValue.d.ts +1 -0
- package/src/hooks/usePreviousValue.js +8 -0
- package/src/hooks/useResponsive.d.ts +7 -0
- package/src/hooks/useResponsive.js +20 -0
- package/src/hooks/useUpdateEffect.d.ts +2 -0
- package/src/hooks/useUpdateEffect.js +10 -0
- package/src/hooks/useUrqlMutation.d.ts +4 -0
- package/src/hooks/useUrqlMutation.js +30 -0
- package/src/hooks/useUrqlQuery.d.ts +19 -0
- package/src/hooks/useUrqlQuery.js +73 -0
- package/src/state/toasts.d.ts +21 -0
- package/src/state/toasts.js +61 -0
- package/src/utils/__tests__/array.test.d.ts +1 -0
- package/src/utils/__tests__/array.test.js +127 -0
- package/src/utils/__tests__/base64.test.d.ts +1 -0
- package/src/utils/__tests__/base64.test.js +27 -0
- package/src/utils/__tests__/function.test.d.ts +1 -0
- package/src/utils/__tests__/function.test.js +36 -0
- package/src/utils/__tests__/object.test.d.ts +1 -0
- package/src/utils/__tests__/object.test.js +17 -0
- package/src/utils/__tests__/rifm.test.d.ts +1 -0
- package/src/utils/__tests__/rifm.test.js +124 -0
- package/src/utils/__tests__/string.test.d.ts +1 -0
- package/src/utils/__tests__/string.test.js +16 -0
- package/src/utils/a11y.d.ts +1 -0
- package/src/utils/a11y.js +18 -0
- package/src/utils/array.d.ts +6 -0
- package/src/utils/array.js +71 -0
- package/src/utils/base64.d.ts +2 -0
- package/src/utils/base64.js +20 -0
- package/src/utils/file.d.ts +2 -0
- package/src/utils/file.js +10 -0
- package/src/utils/flagCountry.d.ts +1 -0
- package/src/utils/flagCountry.js +1 -0
- package/src/utils/function.d.ts +4 -0
- package/src/utils/function.js +19 -0
- package/src/utils/math.d.ts +16 -0
- package/src/utils/math.js +47 -0
- package/src/utils/nullish.d.ts +10 -0
- package/src/utils/nullish.js +8 -0
- package/src/utils/object.d.ts +2 -0
- package/src/utils/object.js +7 -0
- package/src/utils/popper.d.ts +3 -0
- package/src/utils/popper.js +30 -0
- package/src/utils/rifm.d.ts +14 -0
- package/src/utils/rifm.js +53 -0
- package/src/utils/string.d.ts +4 -0
- package/src/utils/string.js +233 -0
- package/src/utils/timer.d.ts +11 -0
- package/src/utils/timer.js +46 -0
- package/src/utils/types.d.ts +8 -0
- package/src/utils/types.js +1 -0
- package/src/utils/userAgent.d.ts +4 -0
- package/src/utils/userAgent.js +9 -0
- package/src/utils/viewport.d.ts +1 -0
- package/src/utils/viewport.js +12 -0
package/HISTORY.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Swan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @swan-io/lake
|
|
2
|
+
|
|
3
|
+
> Swan's design system
|
|
4
|
+
|
|
5
|
+
## Getting started
|
|
6
|
+
|
|
7
|
+
You can start the [Storybook](https://storybook.js.org), a small application that allows you to list and play with the various components.
|
|
8
|
+
|
|
9
|
+
```console
|
|
10
|
+
$ yarn start
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Consume the design system from apps
|
|
14
|
+
|
|
15
|
+
### Scaffolding
|
|
16
|
+
|
|
17
|
+
Our design system assumes that some basic CSS is injected (for fonts, variables and reset). In order to do so:
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import "@swan-io/lake/src/assets/fonts/Inter.css";
|
|
21
|
+
import "@swan-io/lake/src/assets/main.css";
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Tokens
|
|
25
|
+
|
|
26
|
+
To use the design tokens (e.g. colors, spacings…), you can import the `design` file:
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import {
|
|
30
|
+
colors,
|
|
31
|
+
backgroundColor,
|
|
32
|
+
texts,
|
|
33
|
+
gradients,
|
|
34
|
+
shadows,
|
|
35
|
+
spacings,
|
|
36
|
+
negativeSpacings,
|
|
37
|
+
radii,
|
|
38
|
+
fonts,
|
|
39
|
+
animations,
|
|
40
|
+
} from "@swan-io/lake/src/constants/design";
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Build
|
|
44
|
+
|
|
45
|
+
You can build a static version of the Storybook (e.g. to host a demo space):
|
|
46
|
+
|
|
47
|
+
```console
|
|
48
|
+
$ yarn build
|
|
49
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@swan-io/lake",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"engines": {
|
|
5
|
+
"node": ">=14.0.0",
|
|
6
|
+
"yarn": "^1.20.0"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"LICENSE",
|
|
10
|
+
"src/**/*.js",
|
|
11
|
+
"src/**/*.d.ts",
|
|
12
|
+
"README.md",
|
|
13
|
+
"HISTORY.md"
|
|
14
|
+
],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public",
|
|
17
|
+
"registry": "https://registry.npmjs.org"
|
|
18
|
+
},
|
|
19
|
+
"browserslist": [
|
|
20
|
+
">0.2%",
|
|
21
|
+
"not op_mini all",
|
|
22
|
+
"not dead",
|
|
23
|
+
"not ie <= 11",
|
|
24
|
+
"safari >= 12"
|
|
25
|
+
],
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@popperjs/core": "2.11.6",
|
|
28
|
+
"@swan-io/boxed": "0.12.1",
|
|
29
|
+
"@swan-io/chicane": "1.3.4",
|
|
30
|
+
"dayjs": "1.11.7",
|
|
31
|
+
"graphql": "15.8.0",
|
|
32
|
+
"polished": "4.2.2",
|
|
33
|
+
"prism-react-renderer": "1.3.5",
|
|
34
|
+
"react": "18.2.0",
|
|
35
|
+
"react-atomic-state": "1.2.7",
|
|
36
|
+
"react-dom": "18.2.0",
|
|
37
|
+
"react-dropzone": "14.2.3",
|
|
38
|
+
"react-fast-compare": "3.2.0",
|
|
39
|
+
"react-native-web": "0.18.12",
|
|
40
|
+
"react-popper": "2.3.0",
|
|
41
|
+
"react-ux-form": "1.3.0",
|
|
42
|
+
"rifm": "0.12.1",
|
|
43
|
+
"ts-pattern": "4.2.1",
|
|
44
|
+
"urql": "3.0.3",
|
|
45
|
+
"uuid": "9.0.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@storybook/react": "6.5.16",
|
|
49
|
+
"@testing-library/react": "13.4.0",
|
|
50
|
+
"@testing-library/user-event": "14.4.3",
|
|
51
|
+
"@types/react": "18.0.28",
|
|
52
|
+
"@types/react-dom": "18.0.11",
|
|
53
|
+
"@types/react-native": "0.70.11",
|
|
54
|
+
"@types/uuid": "9.0.1",
|
|
55
|
+
"jsdom": "21.1.0",
|
|
56
|
+
"ts-dedent": "2.2.0",
|
|
57
|
+
"type-fest": "3.6.1",
|
|
58
|
+
"vitest": "0.29.2"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
type AlertVariant = "info" | "warning" | "error";
|
|
4
|
+
type Props = {
|
|
5
|
+
variant: AlertVariant;
|
|
6
|
+
children: string;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
};
|
|
9
|
+
export declare const Alert: ({ variant, children, style }: Props) => JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { StyleSheet, Text } from "react-native";
|
|
3
|
+
import { colors } from "../constants/colors";
|
|
4
|
+
import { typography } from "../constants/typography";
|
|
5
|
+
import { Box } from "./Box";
|
|
6
|
+
import { Icon } from "./Icon";
|
|
7
|
+
import { Space } from "./Space";
|
|
8
|
+
const styles = StyleSheet.create({
|
|
9
|
+
base: {
|
|
10
|
+
paddingVertical: 12,
|
|
11
|
+
paddingHorizontal: 12,
|
|
12
|
+
borderRadius: 4,
|
|
13
|
+
},
|
|
14
|
+
text: {
|
|
15
|
+
...typography.bodySmall,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
const alertIcon = {
|
|
19
|
+
info: "info-filled",
|
|
20
|
+
warning: "warning-filled",
|
|
21
|
+
error: "error-circle-filled",
|
|
22
|
+
};
|
|
23
|
+
const alertColor = {
|
|
24
|
+
info: colors.gray[80],
|
|
25
|
+
warning: colors.orange[100],
|
|
26
|
+
error: colors.red[100],
|
|
27
|
+
};
|
|
28
|
+
const alertBackground = {
|
|
29
|
+
info: colors.gray[3],
|
|
30
|
+
warning: colors.orange[10],
|
|
31
|
+
error: colors.red[10],
|
|
32
|
+
};
|
|
33
|
+
export const Alert = ({ variant, children, style }) => {
|
|
34
|
+
const color = alertColor[variant];
|
|
35
|
+
return (_jsxs(Box, { direction: "row", alignItems: "center", style: [styles.base, { backgroundColor: alertBackground[variant] }, style], children: [_jsx(Icon, { name: alertIcon[variant], color: color, size: 20 }), _jsx(Space, { width: 12 }), _jsx(Text, { style: [styles.text, { color }], children: children })] }));
|
|
36
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
type Props = {
|
|
4
|
+
accentColor: string;
|
|
5
|
+
appLogo: string;
|
|
6
|
+
playing?: boolean;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
};
|
|
9
|
+
export declare const AppOpeningAnimation: ({ accentColor, appLogo, playing, style }: Props) => JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { StyleSheet } from "react-native";
|
|
4
|
+
import { backgroundColor } from "../constants/design";
|
|
5
|
+
import { Circle, G, Image, Mask, Path, Rect, Svg } from "./Svg";
|
|
6
|
+
const styles = StyleSheet.create({
|
|
7
|
+
circle: {
|
|
8
|
+
opacity: 0,
|
|
9
|
+
animationKeyframes: {
|
|
10
|
+
"0%": { opacity: 0, transform: [{ scale: 0.4 }] },
|
|
11
|
+
"30%": { opacity: 0, transform: [{ scale: 0.4 }] },
|
|
12
|
+
"40%": { opacity: 1 },
|
|
13
|
+
"75%": { opacity: 0, transform: [{ scale: 1.5 }] },
|
|
14
|
+
"100%": { opacity: 0, transform: [{ scale: 1.5 }] },
|
|
15
|
+
},
|
|
16
|
+
animationDuration: "5000ms",
|
|
17
|
+
animationTimingFunction: "ease-in-out",
|
|
18
|
+
animationIterationCount: "infinite",
|
|
19
|
+
},
|
|
20
|
+
icon: {
|
|
21
|
+
animationKeyframes: {
|
|
22
|
+
"0%": { transform: [{ scale: 1 }] },
|
|
23
|
+
"25%": { transform: [{ scale: 1 }] },
|
|
24
|
+
"35%": { transform: [{ translateY: 60 }, { scale: 10 }] },
|
|
25
|
+
"100%": { transform: [{ translateY: 60 }, { scale: 10 }] },
|
|
26
|
+
},
|
|
27
|
+
animationDuration: "5000ms",
|
|
28
|
+
animationTimingFunction: "ease-in-out",
|
|
29
|
+
animationIterationCount: "infinite",
|
|
30
|
+
},
|
|
31
|
+
logo: {
|
|
32
|
+
animationKeyframes: {
|
|
33
|
+
"0%": { transform: [{ translateY: 0 }, { scale: 1 }] },
|
|
34
|
+
"25%": { transform: [{ translateY: 0 }, { scale: 1 }] },
|
|
35
|
+
"35%": { transform: [{ translateY: 72 }, { scale: 2 }] },
|
|
36
|
+
"100%": { transform: [{ translateY: 72 }, { scale: 2 }] },
|
|
37
|
+
},
|
|
38
|
+
animationDuration: "5000ms",
|
|
39
|
+
animationTimingFunction: "ease-in-out",
|
|
40
|
+
animationIterationCount: "infinite",
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
export const AppOpeningAnimation = ({ accentColor, appLogo, playing = true, style }) => {
|
|
44
|
+
const animationStyle = useMemo(() => {
|
|
45
|
+
return {
|
|
46
|
+
animationPlayState: playing ? "running" : "paused",
|
|
47
|
+
};
|
|
48
|
+
}, [playing]);
|
|
49
|
+
return (_jsxs(Svg, { viewBox: "0 0 442 860", style: style, children: [_jsxs(Mask, { nativeID: "phoneScreen", children: [_jsx(Rect, { x: 0, y: 0, width: 442, height: 860, fill: "#000" }), _jsx(Rect, { fill: "#fff", x: 25, y: 21, width: 392, height: 817, rx: 45 })] }), _jsxs(G, { children: [_jsx(Rect, { fill: backgroundColor.default, x: 25, y: 21, width: 392, height: 817, rx: 45 }), _jsx(Path, { d: "M80 86h35.6c15 0 27 12 27 27v35.6c0 15-12 27-27 27H80c-15 0-27-12-27-27V113c0-15 12-27 27-27zm0 117.6h35.6c15 0 27 12.1 27 27v35.6c0 15-12 27-27 27H80c-15 0-27-12-27-27v-35.6c0-14.9 12-27 27-27zm0 117.7h35.6c15 0 27 12 27 27v35.6c0 14.9-12 27-27 27H80c-15 0-27-12.1-27-27v-35.6c0-15 12-27 27-27zm0 117.6h35.6c15 0 27 12.1 27 27v35.6c0 15-12 27-27 27H80c-15 0-27-12-27-27V466c0-14.9 12-27 27-27v-.1zm0 282.5h35.6c15 0 27 12 27 27V784c0 14.9-12 27-27 27H80c-15 0-27-12.1-27-27v-35.6c0-15 12-27 27-27zM203.2 86h35.6c15 0 27 12 27 27v35.6c0 15-12 27-27 27h-35.6c-15 0-27-12-27-27V113c0-15 12-27 27-27zm0 117.6h35.6c15 0 27 12.1 27 27v35.6c0 15-12 27-27 27h-35.6c-15 0-27-12-27-27v-35.6c0-14.9 12-27 27-27zm0 235.3h35.6c15 0 27 12.1 27 27v35.6c0 15-12 27-27 27h-35.6c-15 0-27-12-27-27V466c0-14.9 12-27 27-27v-.1zm0 282.5h35.6c15 0 27 12 27 27V784c0 14.9-12 27-27 27h-35.6c-15 0-27-12.1-27-27v-35.6c0-15 12-27 27-27zM326.4 86H362c15 0 27 12 27 27v35.6c0 15-12 27-27 27h-35.6c-15 0-27-12-27-27V113c0-15 12-27 27-27zm0 117.6H362c15 0 27 12.1 27 27v35.6c0 15-12 27-27 27h-35.6c-15 0-27-12-27-27v-35.6c0-14.9 12-27 27-27zm0 117.7H362c15 0 27 12 27 27v35.6c0 14.9-12 27-27 27h-35.6c-15 0-27-12.1-27-27v-35.6c0-15 12-27 27-27zm0 117.6H362c15 0 27 12.1 27 27v35.6c0 15-12 27-27 27h-35.6c-15 0-27-12-27-27V466c0-14.9 12-27 27-27v-.1zm0 282.5H362c15 0 27 12 27 27V784c0 14.9-12 27-27 27h-35.6c-15 0-27-12.1-27-27v-35.6c0-15 12-27 27-27z", fill: "#fff" }), _jsx(G, { mask: "url(#phoneScreen)", children: _jsx(Rect, { fill: accentColor, fillRule: "nonzero", x: 176.4, y: 321, width: 89.6, height: 89.6, rx: 27, style: [styles.icon, animationStyle], "transform-origin": "221.2 365.8" }) }), _jsx(Image, { xlinkHref: appLogo, preserveAspectRatio: "xMidYMid meet", x: 190, y: 335, height: 62, width: 62, style: [styles.logo, animationStyle], "transform-origin": "221.2 365.8" }), _jsx(Circle, { stroke: "#FFFFFF", strokeWidth: 2, cx: 219.5, cy: 439.5, r: 157.5, fill: "none", style: [styles.circle, animationStyle], "transform-origin": "219.5 439.5" }), _jsx(Path, { d: "M369 0a67.998 67.998 0 0168 68v177c1.326 0 2.598.527 3.536 1.464A5.004 5.004 0 01442 250v96a5.004 5.004 0 01-1.464 3.536A5.004 5.004 0 01437 351v441a67.996 67.996 0 01-19.917 48.083A67.996 67.996 0 01369 860H71a67.998 67.998 0 01-68-68V365.6a5 5 0 01-3-4.6v-58a5.002 5.002 0 013-4.6v-16.8a5 5 0 01-3-4.6v-58a5.002 5.002 0 013-4.6v-30.8a5 5 0 01-3-4.6v-24a5.002 5.002 0 013-4.6V68A68 68 0 0171 0h298zm0 21H71a46 46 0 00-46 45.2V792a45.999 45.999 0 0045.2 46H369a46 46 0 0046-45.2V67a45.998 45.998 0 00-46-46z", fill: "#000" })] })] }));
|
|
50
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Image, ImageProps } from "react-native";
|
|
3
|
+
import { Except } from "type-fest";
|
|
4
|
+
export declare const AutoWidthImage: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Except<ImageProps, "source"> & {
|
|
5
|
+
maxWidth?: number | undefined;
|
|
6
|
+
height: number;
|
|
7
|
+
sourceUri: string;
|
|
8
|
+
} & import("react").RefAttributes<Image>>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, memo, useEffect, useState } from "react";
|
|
3
|
+
import isEqual from "react-fast-compare";
|
|
4
|
+
import { Image } from "react-native";
|
|
5
|
+
import { isNotNullish } from "../utils/nullish";
|
|
6
|
+
export const AutoWidthImage = memo(forwardRef(({ maxWidth, height, sourceUri, style, ...props }, forwardedRef) => {
|
|
7
|
+
const [size, setSize] = useState({
|
|
8
|
+
height,
|
|
9
|
+
width: 0,
|
|
10
|
+
});
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
Image.getSize(sourceUri, (fetchedWidth, fetchedHeight) => {
|
|
13
|
+
const ratio = fetchedWidth / fetchedHeight;
|
|
14
|
+
const width = ratio * height;
|
|
15
|
+
if (isNotNullish(maxWidth) && maxWidth < width) {
|
|
16
|
+
const height = maxWidth / ratio;
|
|
17
|
+
setSize({ height, width: maxWidth });
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
setSize({ height, width });
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}, [maxWidth, height, sourceUri]);
|
|
24
|
+
return (_jsx(Image, { ref: forwardedRef, source: { uri: sourceUri }, style: [style, size], ...props }));
|
|
25
|
+
}), isEqual);
|
|
26
|
+
AutoWidthImage.displayName = "AutoWidthImage";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import { StyleSheet, Text, View } from "react-native";
|
|
4
|
+
import { commonStyles } from "../constants/commonStyles";
|
|
5
|
+
import { colors } from "../constants/design";
|
|
6
|
+
import { typography } from "../constants/typography";
|
|
7
|
+
import { Icon } from "./Icon";
|
|
8
|
+
const styles = StyleSheet.create({
|
|
9
|
+
text: {
|
|
10
|
+
...typography.bodyLarge,
|
|
11
|
+
fontWeight: typography.fontWeights.demi,
|
|
12
|
+
textAlign: "center",
|
|
13
|
+
},
|
|
14
|
+
container: {
|
|
15
|
+
borderWidth: 1,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
const initialsToVariant = (initials) => {
|
|
19
|
+
const value = (initials.charCodeAt(0) + initials.charCodeAt(1)) % 3;
|
|
20
|
+
switch (value) {
|
|
21
|
+
case 2:
|
|
22
|
+
return "darkPink";
|
|
23
|
+
case 1:
|
|
24
|
+
return "live";
|
|
25
|
+
default:
|
|
26
|
+
return "shakespear";
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export const Avatar = memo(({ initials = "", size }) => {
|
|
30
|
+
const variant = initialsToVariant(initials);
|
|
31
|
+
return (_jsx(View, { accessibilityRole: "image", style: [
|
|
32
|
+
commonStyles.center,
|
|
33
|
+
styles.container,
|
|
34
|
+
{
|
|
35
|
+
backgroundColor: colors[variant][100],
|
|
36
|
+
borderColor: colors[variant][200],
|
|
37
|
+
height: size,
|
|
38
|
+
width: size,
|
|
39
|
+
borderRadius: size / 2,
|
|
40
|
+
},
|
|
41
|
+
], children: initials !== "" ? (_jsx(Text, { style: [styles.text, { color: colors[variant][500], fontSize: size * 0.4 }], selectable: false, children: initials })) : (_jsx(Icon, { name: "person-filled", size: size - 8, color: colors[variant][50] })) }));
|
|
42
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactText } from "react";
|
|
2
|
+
import { GestureResponderEvent, StyleProp, View, ViewStyle } from "react-native";
|
|
3
|
+
import { IconName } from "./Icon";
|
|
4
|
+
type Props = {
|
|
5
|
+
accessibilityLabel?: string;
|
|
6
|
+
children?: ReactText;
|
|
7
|
+
color?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
icon?: IconName;
|
|
11
|
+
onPress?: (event: GestureResponderEvent) => void;
|
|
12
|
+
size?: "large" | "small";
|
|
13
|
+
style?: StyleProp<ViewStyle>;
|
|
14
|
+
};
|
|
15
|
+
export declare const BorderedButton: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<View>>>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, memo } from "react";
|
|
3
|
+
import { ActivityIndicator, Pressable, StyleSheet, Text, View, } from "react-native";
|
|
4
|
+
import { colors } from "../constants/colors";
|
|
5
|
+
import { typography } from "../constants/typography";
|
|
6
|
+
import { isNotNullish } from "../utils/nullish";
|
|
7
|
+
import { Icon } from "./Icon";
|
|
8
|
+
import { Space } from "./Space";
|
|
9
|
+
const styles = StyleSheet.create({
|
|
10
|
+
base: {
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
backgroundColor: colors.white,
|
|
13
|
+
borderColor: colors.gray[10],
|
|
14
|
+
borderRadius: 4,
|
|
15
|
+
borderWidth: 1,
|
|
16
|
+
flexDirection: "row",
|
|
17
|
+
flexShrink: 1,
|
|
18
|
+
height: 48,
|
|
19
|
+
justifyContent: "center",
|
|
20
|
+
overflow: "hidden",
|
|
21
|
+
paddingLeft: 20,
|
|
22
|
+
paddingRight: 20,
|
|
23
|
+
transitionDuration: "150ms",
|
|
24
|
+
transitionProperty: "background-color",
|
|
25
|
+
},
|
|
26
|
+
small: {
|
|
27
|
+
height: 40,
|
|
28
|
+
paddingLeft: 16,
|
|
29
|
+
paddingRight: 16,
|
|
30
|
+
},
|
|
31
|
+
withIcon: {
|
|
32
|
+
paddingLeft: 18,
|
|
33
|
+
},
|
|
34
|
+
withIconSmall: {
|
|
35
|
+
paddingLeft: 14,
|
|
36
|
+
},
|
|
37
|
+
iconOnly: {
|
|
38
|
+
paddingLeft: 13,
|
|
39
|
+
paddingRight: 13,
|
|
40
|
+
},
|
|
41
|
+
iconOnlySmall: {
|
|
42
|
+
paddingLeft: 10,
|
|
43
|
+
paddingRight: 10,
|
|
44
|
+
},
|
|
45
|
+
hovered: {
|
|
46
|
+
backgroundColor: colors.gray[3],
|
|
47
|
+
},
|
|
48
|
+
pressed: {
|
|
49
|
+
backgroundColor: colors.gray[10],
|
|
50
|
+
},
|
|
51
|
+
disabled: {
|
|
52
|
+
backgroundColor: colors.gray[3],
|
|
53
|
+
borderColor: colors.gray[3],
|
|
54
|
+
cursor: "not-allowed",
|
|
55
|
+
},
|
|
56
|
+
text: {
|
|
57
|
+
...typography.bodyLarge,
|
|
58
|
+
fontWeight: typography.fontWeights.demi,
|
|
59
|
+
lineHeight: 48,
|
|
60
|
+
},
|
|
61
|
+
textSmall: {
|
|
62
|
+
...typography.bodySmall,
|
|
63
|
+
fontWeight: typography.fontWeights.demi,
|
|
64
|
+
lineHeight: 40,
|
|
65
|
+
},
|
|
66
|
+
textDisabled: {
|
|
67
|
+
color: colors.gray[50],
|
|
68
|
+
},
|
|
69
|
+
loaderContainer: {
|
|
70
|
+
...StyleSheet.absoluteFillObject,
|
|
71
|
+
alignItems: "center",
|
|
72
|
+
backgroundColor: colors.white,
|
|
73
|
+
justifyContent: "center",
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
export const BorderedButton = memo(forwardRef(({ accessibilityLabel, children = "", color = colors.gray[100], disabled = false, loading = false, icon, onPress, size = "large", style, }, forwardedRef) => {
|
|
77
|
+
const hasText = children !== "";
|
|
78
|
+
const isSmall = size === "small";
|
|
79
|
+
const iconSize = isSmall ? 18 : 20;
|
|
80
|
+
return (_jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: accessibilityLabel, accessibilityBusy: loading, accessibilityDisabled: disabled, disabled: loading || disabled, ref: forwardedRef, onPress: onPress, style: ({ hovered, pressed }) => [
|
|
81
|
+
styles.base,
|
|
82
|
+
isSmall && styles.small,
|
|
83
|
+
isNotNullish(icon) && (isSmall ? styles.withIconSmall : styles.withIcon),
|
|
84
|
+
!hasText && (isSmall ? styles.iconOnlySmall : styles.iconOnly),
|
|
85
|
+
disabled
|
|
86
|
+
? styles.disabled
|
|
87
|
+
: pressed
|
|
88
|
+
? styles.pressed
|
|
89
|
+
: hovered
|
|
90
|
+
? styles.hovered
|
|
91
|
+
: false,
|
|
92
|
+
style,
|
|
93
|
+
], children: [icon && _jsx(Icon, { color: color, name: icon, size: iconSize }), hasText && isNotNullish(icon) && _jsx(Space, { width: isSmall ? 8 : 12 }), hasText && (_jsx(Text, { numberOfLines: 1, selectable: false, style: [
|
|
94
|
+
isSmall ? styles.textSmall : styles.text,
|
|
95
|
+
disabled ? styles.textDisabled : { color },
|
|
96
|
+
], children: children })), loading && (_jsx(View, { accessibilityRole: "none", style: styles.loaderContainer, children: _jsx(ActivityIndicator, { color: disabled ? colors.gray[50] : colors.gray[100], size: iconSize }) }))] }));
|
|
97
|
+
}));
|
|
98
|
+
BorderedButton.displayName = "BorderedButton";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ColorVariants } from "../constants/design";
|
|
3
|
+
import { IconName } from "./Icon";
|
|
4
|
+
import { SpacingValue } from "./Space";
|
|
5
|
+
type Props = {
|
|
6
|
+
name: IconName;
|
|
7
|
+
size?: number;
|
|
8
|
+
padding?: SpacingValue | 0;
|
|
9
|
+
color?: ColorVariants;
|
|
10
|
+
};
|
|
11
|
+
export declare const BorderedIcon: ({ name, size, padding, color }: Props) => JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
import { colors, radii } from "../constants/design";
|
|
4
|
+
import { Box } from "./Box";
|
|
5
|
+
import { Icon } from "./Icon";
|
|
6
|
+
const styles = StyleSheet.create({
|
|
7
|
+
base: {
|
|
8
|
+
borderRadius: radii[8],
|
|
9
|
+
borderWidth: 1,
|
|
10
|
+
borderColor: colors.current[100],
|
|
11
|
+
backgroundColor: colors.current[50],
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
export const BorderedIcon = ({ name, size = 96, padding = 0, color = "current" }) => {
|
|
15
|
+
const iconSize = size - padding * 2;
|
|
16
|
+
return (_jsx(Box, { alignItems: "center", justifyContent: "center", style: [
|
|
17
|
+
styles.base,
|
|
18
|
+
{
|
|
19
|
+
width: size,
|
|
20
|
+
height: size,
|
|
21
|
+
borderColor: colors[color][100],
|
|
22
|
+
backgroundColor: colors[color][50],
|
|
23
|
+
},
|
|
24
|
+
], children: _jsx(Icon, { name: name, size: iconSize, color: colors[color][500] }) }));
|
|
25
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
type Props = {
|
|
3
|
+
visible: boolean;
|
|
4
|
+
onPressClose: () => void;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
returnFocus?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const BottomPanel: ({ visible, onPressClose, children, returnFocus }: Props) => JSX.Element | null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense, useEffect, useState } from "react";
|
|
3
|
+
import { Pressable, ScrollView, StyleSheet, View } from "react-native";
|
|
4
|
+
import { commonStyles } from "../constants/commonStyles";
|
|
5
|
+
import { backgroundColor, radii, shadows, spacings } from "../constants/design";
|
|
6
|
+
import { useBodyClassName } from "../hooks/useBodyClassName";
|
|
7
|
+
import { FocusTrap } from "./FocusTrap";
|
|
8
|
+
import { LoadingView } from "./LoadingView";
|
|
9
|
+
import { Portal } from "./Portal";
|
|
10
|
+
import { TransitionView } from "./TransitionView";
|
|
11
|
+
const BACKGROUND_COLOR = "rgba(0, 0, 0, 0.6)";
|
|
12
|
+
const styles = StyleSheet.create({
|
|
13
|
+
fill: {
|
|
14
|
+
...StyleSheet.absoluteFillObject,
|
|
15
|
+
position: "fixed",
|
|
16
|
+
animationFillMode: "forwards",
|
|
17
|
+
},
|
|
18
|
+
overlay: {
|
|
19
|
+
...StyleSheet.absoluteFillObject,
|
|
20
|
+
backgroundColor: BACKGROUND_COLOR,
|
|
21
|
+
},
|
|
22
|
+
overlayEnter: {
|
|
23
|
+
animationKeyframes: {
|
|
24
|
+
"0%": { opacity: 0 },
|
|
25
|
+
},
|
|
26
|
+
animationDuration: "200ms",
|
|
27
|
+
animationTimingFunction: "ease-in-out",
|
|
28
|
+
},
|
|
29
|
+
overlayLeave: {
|
|
30
|
+
animationKeyframes: {
|
|
31
|
+
"100%": { opacity: 0 },
|
|
32
|
+
},
|
|
33
|
+
animationDuration: "200ms",
|
|
34
|
+
animationTimingFunction: "ease-in-out",
|
|
35
|
+
},
|
|
36
|
+
modalEnter: {
|
|
37
|
+
animationKeyframes: {
|
|
38
|
+
"0%": {
|
|
39
|
+
opacity: 0,
|
|
40
|
+
transform: [{ translateY: 20 }],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
animationDuration: "300ms",
|
|
44
|
+
animationTimingFunction: "ease-in-out",
|
|
45
|
+
},
|
|
46
|
+
modalLeave: {
|
|
47
|
+
animationKeyframes: {
|
|
48
|
+
"100%": {
|
|
49
|
+
opacity: 0,
|
|
50
|
+
transform: [{ translateY: 20 }],
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
animationDuration: "300ms",
|
|
54
|
+
animationTimingFunction: "ease-in-out",
|
|
55
|
+
},
|
|
56
|
+
modalContainer: {
|
|
57
|
+
...StyleSheet.absoluteFillObject,
|
|
58
|
+
},
|
|
59
|
+
modalContentContainer: {
|
|
60
|
+
justifyContent: "flex-end",
|
|
61
|
+
flexGrow: 1,
|
|
62
|
+
},
|
|
63
|
+
trap: {
|
|
64
|
+
...commonStyles.fill,
|
|
65
|
+
},
|
|
66
|
+
modal: {
|
|
67
|
+
backgroundColor: backgroundColor.accented,
|
|
68
|
+
borderTopLeftRadius: radii[8],
|
|
69
|
+
borderTopRightRadius: radii[8],
|
|
70
|
+
boxShadow: shadows.modal,
|
|
71
|
+
alignSelf: "stretch",
|
|
72
|
+
marginTop: spacings[32],
|
|
73
|
+
},
|
|
74
|
+
pressableOverlay: {
|
|
75
|
+
...StyleSheet.absoluteFillObject,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
export const BottomPanel = ({ visible, onPressClose, children, returnFocus = true }) => {
|
|
79
|
+
const [rootElement, setRootElement] = useState(() => undefined);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
const rootElement = document.createElement("div");
|
|
82
|
+
document.body.append(rootElement);
|
|
83
|
+
setRootElement(rootElement);
|
|
84
|
+
return () => {
|
|
85
|
+
rootElement.remove();
|
|
86
|
+
setRootElement(undefined);
|
|
87
|
+
};
|
|
88
|
+
}, []);
|
|
89
|
+
useBodyClassName("BottomPanelOpen", { enabled: visible });
|
|
90
|
+
if (rootElement == null) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return (_jsxs(Portal, { container: rootElement, children: [_jsx(TransitionView, { style: styles.fill, enter: styles.overlayEnter, leave: styles.overlayLeave, children: visible ? _jsx(View, { style: styles.overlay }) : null }), _jsx(Suspense, { fallback: _jsx(LoadingView, { color: backgroundColor.accented, delay: 0 }), children: _jsx(TransitionView, { style: styles.fill, enter: styles.modalEnter, leave: styles.modalLeave, children: visible ? (_jsxs(ScrollView, { style: styles.modalContainer, contentContainerStyle: styles.modalContentContainer, children: [_jsx(FocusTrap, { autoFocus: true, focusLock: true, returnFocus: returnFocus, style: styles.trap, children: onPressClose != null ? (_jsx(Pressable, { onPress: onPressClose, style: styles.pressableOverlay })) : null }), _jsx(View, { style: styles.modal, children: children })] })) : null }) })] }));
|
|
94
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { StyleProp, View, ViewProps, ViewStyle } from "react-native";
|
|
3
|
+
declare const directionStyles: {
|
|
4
|
+
columnReverse: {
|
|
5
|
+
flexDirection: "column-reverse";
|
|
6
|
+
};
|
|
7
|
+
row: {
|
|
8
|
+
flexDirection: "row";
|
|
9
|
+
};
|
|
10
|
+
rowReverse: {
|
|
11
|
+
flexDirection: "row-reverse";
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
declare const alignItemsStyles: {
|
|
15
|
+
baseline: {
|
|
16
|
+
alignItems: "baseline";
|
|
17
|
+
};
|
|
18
|
+
center: {
|
|
19
|
+
alignItems: "center";
|
|
20
|
+
};
|
|
21
|
+
end: {
|
|
22
|
+
alignItems: "flex-end";
|
|
23
|
+
};
|
|
24
|
+
start: {
|
|
25
|
+
alignItems: "flex-start";
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
declare const justifyContentStyles: {
|
|
29
|
+
center: {
|
|
30
|
+
justifyContent: "center";
|
|
31
|
+
};
|
|
32
|
+
end: {
|
|
33
|
+
justifyContent: "flex-end";
|
|
34
|
+
};
|
|
35
|
+
start: {
|
|
36
|
+
justifyContent: "flex-start";
|
|
37
|
+
};
|
|
38
|
+
spaceBetween: {
|
|
39
|
+
justifyContent: "space-between";
|
|
40
|
+
};
|
|
41
|
+
spaceAround: {
|
|
42
|
+
justifyContent: "space-around";
|
|
43
|
+
};
|
|
44
|
+
spaceEvenly: {
|
|
45
|
+
justifyContent: "space-evenly";
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
type BoxDirection = keyof typeof directionStyles | "column";
|
|
49
|
+
type BoxAlignItems = keyof typeof alignItemsStyles | "stretch";
|
|
50
|
+
type BoxJustifyContent = keyof typeof justifyContentStyles | "normal";
|
|
51
|
+
export type BoxProps = ViewProps & {
|
|
52
|
+
alignItems?: BoxAlignItems;
|
|
53
|
+
children?: ReactNode;
|
|
54
|
+
direction?: BoxDirection;
|
|
55
|
+
justifyContent?: BoxJustifyContent;
|
|
56
|
+
style?: StyleProp<ViewStyle>;
|
|
57
|
+
};
|
|
58
|
+
export declare const Box: import("react").ForwardRefExoticComponent<ViewProps & {
|
|
59
|
+
alignItems?: BoxAlignItems | undefined;
|
|
60
|
+
children?: ReactNode;
|
|
61
|
+
direction?: BoxDirection | undefined;
|
|
62
|
+
justifyContent?: BoxJustifyContent | undefined;
|
|
63
|
+
style?: StyleProp<ViewStyle>;
|
|
64
|
+
} & import("react").RefAttributes<View>>;
|
|
65
|
+
export {};
|