@jobber/components-native 0.101.6 → 0.101.8
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/dist/docs/Icon/Icon.md +1 -0
- package/dist/docs/InputDate/InputDate.md +1 -4
- package/dist/docs/InputPressable/InputPressable.md +1 -1
- package/dist/docs/Select/Select.md +22 -16
- package/dist/docs/usage-guidelines/usage-guidelines.md +9 -14
- package/dist/package.json +4 -4
- package/dist/tsconfig.build.json +8 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/tsconfig.json +1 -0
- package/dist/types/src/ContentOverlay/BottomSheetKeyboardAwareScrollView.d.ts +1 -2
- package/package.json +4 -4
- package/src/ActionItem/ActionItem.stories.tsx +16 -95
- package/src/ActionItem/ActionItemGroup.stories.tsx +7 -84
- package/src/ActionItem/docs/ActionItemActionAlignmentExample.tsx +23 -0
- package/src/ActionItem/docs/ActionItemBasicExample.tsx +12 -0
- package/src/ActionItem/docs/ActionItemGroupBasicExample.tsx +39 -0
- package/src/ActionItem/docs/ActionItemGroupMixedComponentsExample.tsx +52 -0
- package/src/ActionItem/docs/ActionItemInACardExample.tsx +27 -0
- package/src/ActionItem/docs/ActionItemInteractiveChildrenExample.tsx +30 -0
- package/src/ActionItem/docs/ActionItemMixedComponentsExample.tsx +36 -0
- package/src/ActionItem/docs/ActionItemNoActionExample.tsx +15 -0
- package/src/ActionItem/docs/ActionItemTitleOnlyExample.tsx +18 -0
- package/src/ActionItem/docs/index.ts +9 -0
- package/src/ActionLabel/ActionLabel.stories.tsx +10 -11
- package/src/ActionLabel/docs/ActionLabelBasicExample.tsx +15 -0
- package/src/ActionLabel/docs/ActionLabelColorExample.tsx +15 -0
- package/src/ActionLabel/docs/ActionLabelDarkBackgroundExample.tsx +25 -0
- package/src/ActionLabel/docs/ActionLabelDisabledExample.tsx +15 -0
- package/src/ActionLabel/docs/index.ts +4 -0
- package/src/ActivityIndicator/ActivityIndicator.stories.tsx +3 -18
- package/src/ActivityIndicator/docs/ActivityIndicatorBasicExample.tsx +22 -0
- package/src/ActivityIndicator/docs/index.ts +1 -0
- package/src/AtlantisThemeContext/AtlantisThemeContext.stories.tsx +7 -70
- package/src/AtlantisThemeContext/docs/AtlantisThemeContextBasicExample.tsx +41 -0
- package/src/AtlantisThemeContext/docs/AtlantisThemeContextForceThemeForProviderExample.tsx +56 -0
- package/src/AtlantisThemeContext/docs/index.ts +2 -0
- package/src/AutoLink/AutoLink.stories.tsx +3 -0
- package/src/AutoLink/docs/AutoLinkBasicExample.tsx +14 -0
- package/src/AutoLink/docs/AutoLinkSkipPhoneNumberExample.tsx +14 -0
- package/src/AutoLink/docs/index.ts +2 -0
- package/src/Banner/Banner.stories.tsx +11 -45
- package/src/Banner/docs/BannerActionsInBannersExample.tsx +18 -0
- package/src/Banner/docs/BannerBasicExample.tsx +21 -0
- package/src/Banner/docs/BannerErrorDetailsExample.tsx +19 -0
- package/src/Banner/docs/BannerErrorExample.tsx +13 -0
- package/src/Banner/docs/index.ts +4 -0
- package/src/BottomSheet/BottomSheet.stories.tsx +6 -111
- package/src/BottomSheet/docs/BottomSheetBasicExample.tsx +63 -0
- package/src/BottomSheet/docs/BottomSheetHeaderFooterExample.tsx +65 -0
- package/src/BottomSheet/docs/index.ts +2 -0
- package/src/Button/Button.stories.tsx +3 -5
- package/src/Button/docs/ButtonBasicExample.tsx +14 -0
- package/src/Button/docs/ButtonCancelExample.tsx +15 -0
- package/src/Button/docs/index.ts +2 -0
- package/src/ButtonGroup/ButtonGroup.stories.tsx +9 -64
- package/src/ButtonGroup/docs/ButtonGroupBasicExample.tsx +34 -0
- package/src/ButtonGroup/docs/ButtonGroupPrimaryExample.tsx +37 -0
- package/src/ButtonGroup/docs/ButtonGroupSecondaryExample.tsx +35 -0
- package/src/ButtonGroup/docs/index.ts +3 -0
- package/src/Card/Card.stories.tsx +9 -43
- package/src/Card/docs/CardBasicExample.tsx +20 -0
- package/src/Card/docs/CardElevationExample.tsx +30 -0
- package/src/Card/docs/CardPressableExample.tsx +34 -0
- package/src/Card/docs/index.ts +3 -0
- package/src/Checkbox/Checkbox.stories.tsx +16 -56
- package/src/Checkbox/docs/CheckboxBasicExample.tsx +9 -0
- package/src/Checkbox/docs/CheckboxControlledExample.tsx +18 -0
- package/src/Checkbox/docs/CheckboxGroupBasicExample.tsx +15 -0
- package/src/Checkbox/docs/CheckboxGroupControlledExample.tsx +32 -0
- package/src/Checkbox/docs/CheckboxGroupLabelledExample.tsx +15 -0
- package/src/Checkbox/docs/index.ts +5 -0
- package/src/Chip/Chip.stories.tsx +11 -62
- package/src/Chip/docs/ChipAccentExample.tsx +62 -0
- package/src/Chip/docs/ChipBasicExample.tsx +19 -0
- package/src/Chip/docs/ChipDismissableExample.tsx +23 -0
- package/src/Chip/docs/ChipInactiveBackgroundColorExample.tsx +23 -0
- package/src/Chip/docs/index.ts +4 -0
- package/src/Content/Content.stories.tsx +4 -19
- package/src/Content/docs/ContentHorizontal.tsx +22 -0
- package/src/Content/docs/ContentVertical.tsx +22 -0
- package/src/Content/docs/index.ts +2 -0
- package/src/ContentOverlay/ContentOverlay.stories.tsx +6 -52
- package/src/ContentOverlay/docs/ContentOverlayBasic.tsx +54 -0
- package/src/ContentOverlay/docs/index.ts +1 -0
- package/src/Disclosure/Disclosure.stories.tsx +4 -20
- package/src/Disclosure/docs/DisclosureBasic.tsx +23 -0
- package/src/Disclosure/docs/index.ts +1 -0
- package/src/Divider/Divider.stories.tsx +6 -50
- package/src/Divider/docs/DividerHorizontal.tsx +21 -0
- package/src/Divider/docs/DividerVertical.tsx +39 -0
- package/src/Divider/docs/index.ts +2 -0
- package/src/EmptyState/EmptyState.stories.tsx +2 -0
- package/src/EmptyState/docs/EmptyStateBasic.tsx +27 -0
- package/src/EmptyState/docs/index.ts +1 -0
- package/src/Flex/Flex.stories.tsx +6 -57
- package/src/Flex/docs/FlexMultiRow.tsx +25 -0
- package/src/Flex/docs/FlexNested.tsx +22 -0
- package/src/Flex/docs/index.ts +2 -0
- package/src/Form/Form.stories.tsx +6 -50
- package/src/Form/docs/FormBasic.tsx +63 -0
- package/src/Form/docs/index.ts +1 -0
- package/src/FormField/FormField.stories.tsx +4 -46
- package/src/FormField/docs/FormFieldBasic.tsx +15 -0
- package/src/FormField/docs/FormFieldWithValidations.tsx +38 -0
- package/src/FormField/docs/index.ts +2 -0
- package/src/FormatFile/FormatFile.stories.tsx +8 -36
- package/src/FormatFile/docs/FormatFileBasic.tsx +25 -0
- package/src/FormatFile/docs/index.ts +1 -0
- package/src/Glimmer/Glimmer.stories.tsx +6 -31
- package/src/Glimmer/docs/GlimmerBasic.tsx +9 -0
- package/src/Glimmer/docs/GlimmerInDepth.tsx +32 -0
- package/src/Glimmer/docs/index.ts +2 -0
- package/src/Heading/Heading.stories.tsx +5 -18
- package/src/Heading/docs/HeadingLevels.tsx +21 -0
- package/src/Heading/docs/index.ts +1 -0
- package/src/Icon/Icon.stories.tsx +4 -7
- package/src/Icon/docs/IconBasic.tsx +7 -0
- package/src/Icon/docs/index.ts +1 -0
- package/src/IconButton/IconButton.stories.tsx +2 -0
- package/src/IconButton/docs/IconButtonBasic.tsx +17 -0
- package/src/IconButton/docs/index.ts +1 -0
- package/src/InputCurrency/InputCurrency.stories.tsx +2 -0
- package/src/InputCurrency/docs/InputCurrencyBasic.tsx +9 -0
- package/src/InputCurrency/docs/index.ts +1 -0
- package/src/InputDate/InputDate.stories.tsx +10 -11
- package/src/InputDate/docs/InputDateBasic.tsx +9 -0
- package/src/InputDate/docs/InputDateEmptyValueLabel.tsx +17 -0
- package/src/InputDate/docs/InputDateInvalid.tsx +17 -0
- package/src/InputDate/docs/index.ts +3 -0
- package/src/InputEmail/InputEmail.stories.tsx +4 -7
- package/src/InputEmail/docs/InputEmailBasic.tsx +9 -0
- package/src/InputEmail/docs/index.ts +1 -0
- package/src/InputFieldWrapper/InputFieldWrapper.stories.tsx +15 -23
- package/src/InputFieldWrapper/docs/InputFieldWrapperBasic.tsx +15 -0
- package/src/InputFieldWrapper/docs/InputFieldWrapperClearable.tsx +24 -0
- package/src/InputFieldWrapper/docs/InputFieldWrapperDisabled.tsx +18 -0
- package/src/InputFieldWrapper/docs/InputFieldWrapperInvalid.tsx +18 -0
- package/src/InputFieldWrapper/docs/InputFieldWrapperPrefixAndSuffix.tsx +18 -0
- package/src/InputFieldWrapper/docs/index.ts +5 -0
- package/src/InputNumber/InputNumber.stories.tsx +5 -6
- package/src/InputNumber/docs/InputNumberBasic.tsx +7 -0
- package/src/InputNumber/docs/InputNumberInvalid.tsx +15 -0
- package/src/InputNumber/docs/index.ts +2 -0
- package/src/InputPassword/InputPassword.stories.tsx +4 -5
- package/src/InputPassword/docs/InputPasswordBasic.tsx +9 -0
- package/src/InputPassword/docs/index.ts +1 -0
- package/src/InputPressable/InputPressable.stories.tsx +14 -20
- package/src/InputPressable/docs/InputPressableBasic.tsx +17 -0
- package/src/InputPressable/docs/InputPressableClearable.tsx +23 -0
- package/src/InputPressable/docs/InputPressableClickableSuffix.tsx +14 -0
- package/src/InputPressable/docs/InputPressableDisabled.tsx +16 -0
- package/src/InputPressable/docs/InputPressableInvalid.tsx +16 -0
- package/src/InputPressable/docs/InputPressablePrefixOrSuffix.tsx +20 -0
- package/src/InputPressable/docs/index.ts +6 -0
- package/src/InputSearch/InputSearch.stories.tsx +4 -18
- package/src/InputSearch/docs/InputSearchBasic.tsx +20 -0
- package/src/InputSearch/docs/index.ts +1 -0
- package/src/InputText/InputText.stories.tsx +7 -29
- package/src/InputText/docs/InputTextBasic.tsx +7 -0
- package/src/InputText/docs/InputTextInvalid.tsx +14 -0
- package/src/InputText/docs/InputTextToolbar.tsx +31 -0
- package/src/InputText/docs/index.ts +3 -0
- package/src/InputTime/InputTime.stories.tsx +10 -72
- package/src/InputTime/docs/InputTimeBasic.tsx +29 -0
- package/src/InputTime/docs/InputTimeEmptyValue.tsx +27 -0
- package/src/InputTime/docs/InputTimeFormControlled.tsx +46 -0
- package/src/InputTime/docs/index.ts +3 -0
- package/src/ProgressBar/ProgressBar.stories.tsx +6 -46
- package/src/ProgressBar/docs/ProgressBarBasic.tsx +22 -0
- package/src/ProgressBar/docs/ProgressBarWithHeader.tsx +45 -0
- package/src/ProgressBar/docs/index.ts +2 -0
- package/src/Select/Select.stories.tsx +6 -18
- package/src/Select/docs/SelectBasic.tsx +14 -0
- package/src/Select/docs/SelectInitialValue.tsx +18 -0
- package/src/Select/docs/index.ts +2 -0
- package/src/StatusLabel/StatusLabel.stories.tsx +2 -0
- package/src/StatusLabel/docs/StatusLabelBasic.tsx +9 -0
- package/src/StatusLabel/docs/index.ts +1 -0
- package/src/Switch/Switch.stories.tsx +6 -18
- package/src/Switch/docs/SwitchBasic.tsx +9 -0
- package/src/Switch/docs/SwitchControlled.tsx +21 -0
- package/src/Switch/docs/index.ts +2 -0
- package/src/Text/Text.stories.tsx +14 -33
- package/src/Text/docs/TextBasic.tsx +17 -0
- package/src/Text/docs/TextMultiLevelNesting.tsx +14 -0
- package/src/Text/docs/TextNestedBold.tsx +10 -0
- package/src/Text/docs/TextNestedMixedStyles.tsx +11 -0
- package/src/Text/docs/index.ts +4 -0
- package/src/TextList/TextList.stories.tsx +12 -0
- package/src/TextList/docs/TextListBasic.tsx +9 -0
- package/src/TextList/docs/TextListChildSpacing.tsx +19 -0
- package/src/TextList/docs/TextListEmphasis.tsx +19 -0
- package/src/TextList/docs/TextListLevels.tsx +19 -0
- package/src/TextList/docs/TextListSpacing.tsx +19 -0
- package/src/TextList/docs/index.ts +5 -0
- package/src/ThumbnailList/ThumbnailList.stories.tsx +3 -61
- package/src/ThumbnailList/docs/ThumbnailListBasic.tsx +62 -0
- package/src/ThumbnailList/docs/index.ts +1 -0
- package/src/Toast/Toast.stories.tsx +10 -21
- package/src/Toast/docs/ToastBasic.tsx +23 -0
- package/src/Toast/docs/index.ts +1 -0
- package/src/Typography/Typography.stories.tsx +5 -11
- package/src/Typography/docs/TypographyBasic.tsx +9 -0
- package/src/Typography/docs/index.ts +1 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import { ActionLabel, useAtlantisTheme } from "@jobber/components-native";
|
|
5
|
+
|
|
6
|
+
export function ActionLabelDarkBackgroundExample(
|
|
7
|
+
props: Partial<ComponentProps<typeof ActionLabel>>,
|
|
8
|
+
) {
|
|
9
|
+
const { children, ...actionLabelProps } = props;
|
|
10
|
+
const { tokens } = useAtlantisTheme();
|
|
11
|
+
console.log({ tokens });
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<View
|
|
15
|
+
style={{
|
|
16
|
+
backgroundColor: tokens["color-surface--reverse"],
|
|
17
|
+
padding: tokens["space-base"],
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
20
|
+
<ActionLabel variation="onPrimary" {...actionLabelProps}>
|
|
21
|
+
{children ?? "Light Me Up"}
|
|
22
|
+
</ActionLabel>
|
|
23
|
+
</View>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
import { ActionLabel } from "@jobber/components-native";
|
|
4
|
+
|
|
5
|
+
export function ActionLabelDisabledExample(
|
|
6
|
+
props: Partial<ComponentProps<typeof ActionLabel>>,
|
|
7
|
+
) {
|
|
8
|
+
const { children, ...actionLabelProps } = props;
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<ActionLabel disabled {...actionLabelProps}>
|
|
12
|
+
{children ?? "Disabled"}
|
|
13
|
+
</ActionLabel>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { ActionLabelBasicExample } from "./ActionLabelBasicExample";
|
|
2
|
+
export { ActionLabelColorExample } from "./ActionLabelColorExample";
|
|
3
|
+
export { ActionLabelDarkBackgroundExample } from "./ActionLabelDarkBackgroundExample";
|
|
4
|
+
export { ActionLabelDisabledExample } from "./ActionLabelDisabledExample";
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
Content,
|
|
6
|
-
Divider,
|
|
7
|
-
Heading,
|
|
8
|
-
} from "@jobber/components-native";
|
|
2
|
+
import { ActivityIndicator } from "@jobber/components-native";
|
|
3
|
+
import { ActivityIndicatorBasicExample } from "./docs";
|
|
9
4
|
|
|
10
5
|
const meta = {
|
|
11
6
|
title: "Components/Status and Feedback/ActivityIndicator",
|
|
@@ -17,18 +12,8 @@ const meta = {
|
|
|
17
12
|
export default meta;
|
|
18
13
|
type Story = StoryObj<typeof meta>;
|
|
19
14
|
|
|
20
|
-
const BasicTemplate = (args: Story["args"]) => (
|
|
21
|
-
<Content>
|
|
22
|
-
<Heading level="subtitle">Small</Heading>
|
|
23
|
-
<ActivityIndicator size="small" />
|
|
24
|
-
<Divider size="base" />
|
|
25
|
-
<Heading level="subtitle">Large</Heading>
|
|
26
|
-
<ActivityIndicator {...args} />
|
|
27
|
-
</Content>
|
|
28
|
-
);
|
|
29
|
-
|
|
30
15
|
export const Basic: Story = {
|
|
31
|
-
render:
|
|
16
|
+
render: ActivityIndicatorBasicExample,
|
|
32
17
|
args: {
|
|
33
18
|
size: "large",
|
|
34
19
|
},
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
import {
|
|
4
|
+
ActivityIndicator,
|
|
5
|
+
Content,
|
|
6
|
+
Divider,
|
|
7
|
+
Heading,
|
|
8
|
+
} from "@jobber/components-native";
|
|
9
|
+
|
|
10
|
+
export function ActivityIndicatorBasicExample(
|
|
11
|
+
props: Partial<ComponentProps<typeof ActivityIndicator>>,
|
|
12
|
+
) {
|
|
13
|
+
return (
|
|
14
|
+
<Content>
|
|
15
|
+
<Heading level="subtitle">Small</Heading>
|
|
16
|
+
<ActivityIndicator size="small" />
|
|
17
|
+
<Divider size="base" />
|
|
18
|
+
<Heading level="subtitle">Large</Heading>
|
|
19
|
+
<ActivityIndicator size="large" {...props} />
|
|
20
|
+
</Content>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ActivityIndicatorBasicExample } from "./ActivityIndicatorBasicExample";
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
1
|
+
import type React from "react";
|
|
3
2
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
3
|
+
import { AtlantisThemeContextProvider } from "@jobber/components-native";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Text,
|
|
9
|
-
useAtlantisTheme,
|
|
10
|
-
} from "@jobber/components-native";
|
|
5
|
+
AtlantisThemeContextBasicExample,
|
|
6
|
+
AtlantisThemeContextForceThemeForProviderExample,
|
|
7
|
+
} from "./docs";
|
|
11
8
|
|
|
12
9
|
const meta = {
|
|
13
10
|
title: "Components/Themes/AtlantisThemeContext",
|
|
@@ -26,70 +23,10 @@ type Story = StoryObj<
|
|
|
26
23
|
}
|
|
27
24
|
>;
|
|
28
25
|
|
|
29
|
-
function ChildrenComponent({
|
|
30
|
-
message = "It is possible to have multiple Atlantis Theme providers.",
|
|
31
|
-
}: {
|
|
32
|
-
readonly message?: string;
|
|
33
|
-
}) {
|
|
34
|
-
const { theme, tokens, setTheme } = useAtlantisTheme();
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<View
|
|
38
|
-
style={{
|
|
39
|
-
backgroundColor: tokens["color-surface"],
|
|
40
|
-
}}
|
|
41
|
-
>
|
|
42
|
-
<Content>
|
|
43
|
-
<Text>{message}</Text>
|
|
44
|
-
<Text>{`Current theme: ${theme}`}</Text>
|
|
45
|
-
<Text>Tokens can be accessed using tokens[token-name]</Text>
|
|
46
|
-
<Text>{`For example color-surface: ${tokens["color-surface"]}`}</Text>
|
|
47
|
-
<Button label="Set dark theme" onPress={() => setTheme("dark")} />
|
|
48
|
-
<Button label="Set light theme" onPress={() => setTheme("light")} />
|
|
49
|
-
</Content>
|
|
50
|
-
</View>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function ForcedDarkThemeComponent() {
|
|
55
|
-
const { tokens } = useAtlantisTheme();
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<View
|
|
59
|
-
style={{
|
|
60
|
-
backgroundColor: tokens["color-surface"],
|
|
61
|
-
}}
|
|
62
|
-
>
|
|
63
|
-
<Content>
|
|
64
|
-
<Text>This will always be a dark theme</Text>
|
|
65
|
-
</Content>
|
|
66
|
-
</View>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const BasicTemplate = (args: Story["args"]) => {
|
|
71
|
-
return (
|
|
72
|
-
<AtlantisThemeContextProvider {...args}>
|
|
73
|
-
<ChildrenComponent />
|
|
74
|
-
</AtlantisThemeContextProvider>
|
|
75
|
-
);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
26
|
export const Basic: Story = {
|
|
79
|
-
render:
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const ForceThemeTemplate = (args: Story["args"]) => {
|
|
83
|
-
return (
|
|
84
|
-
<AtlantisThemeContextProvider {...args}>
|
|
85
|
-
<ChildrenComponent message="It is possible to have a provider ignore Theme Changes" />
|
|
86
|
-
<AtlantisThemeContextProvider dangerouslyOverrideTheme="dark">
|
|
87
|
-
<ForcedDarkThemeComponent />
|
|
88
|
-
</AtlantisThemeContextProvider>
|
|
89
|
-
</AtlantisThemeContextProvider>
|
|
90
|
-
);
|
|
27
|
+
render: AtlantisThemeContextBasicExample,
|
|
91
28
|
};
|
|
92
29
|
|
|
93
30
|
export const ForceThemeForProvider: Story = {
|
|
94
|
-
render:
|
|
31
|
+
render: AtlantisThemeContextForceThemeForProviderExample,
|
|
95
32
|
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import {
|
|
4
|
+
AtlantisThemeContextProvider,
|
|
5
|
+
Button,
|
|
6
|
+
Content,
|
|
7
|
+
Text,
|
|
8
|
+
useAtlantisTheme,
|
|
9
|
+
} from "@jobber/components-native";
|
|
10
|
+
import type { AtlantisThemeContextProviderProps } from "@jobber/components-native";
|
|
11
|
+
|
|
12
|
+
function ChildrenComponent({
|
|
13
|
+
message = "It is possible to have multiple Atlantis Theme providers.",
|
|
14
|
+
}: {
|
|
15
|
+
readonly message?: string;
|
|
16
|
+
}) {
|
|
17
|
+
const { theme, tokens, setTheme } = useAtlantisTheme();
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<View style={{ backgroundColor: tokens["color-surface"] }}>
|
|
21
|
+
<Content>
|
|
22
|
+
<Text>{message}</Text>
|
|
23
|
+
<Text>{`Current theme: ${theme}`}</Text>
|
|
24
|
+
<Text>Tokens can be accessed using tokens[token-name]</Text>
|
|
25
|
+
<Text>{`For example color-surface: ${tokens["color-surface"]}`}</Text>
|
|
26
|
+
<Button label="Set dark theme" onPress={() => setTheme("dark")} />
|
|
27
|
+
<Button label="Set light theme" onPress={() => setTheme("light")} />
|
|
28
|
+
</Content>
|
|
29
|
+
</View>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function AtlantisThemeContextBasicExample(
|
|
34
|
+
props: Partial<Omit<AtlantisThemeContextProviderProps, "children">>,
|
|
35
|
+
) {
|
|
36
|
+
return (
|
|
37
|
+
<AtlantisThemeContextProvider {...props}>
|
|
38
|
+
<ChildrenComponent />
|
|
39
|
+
</AtlantisThemeContextProvider>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import {
|
|
4
|
+
AtlantisThemeContextProvider,
|
|
5
|
+
Button,
|
|
6
|
+
Content,
|
|
7
|
+
Text,
|
|
8
|
+
useAtlantisTheme,
|
|
9
|
+
} from "@jobber/components-native";
|
|
10
|
+
import type { AtlantisThemeContextProviderProps } from "@jobber/components-native";
|
|
11
|
+
|
|
12
|
+
function ChildrenComponent({
|
|
13
|
+
message = "It is possible to have multiple Atlantis Theme providers.",
|
|
14
|
+
}: {
|
|
15
|
+
readonly message?: string;
|
|
16
|
+
}) {
|
|
17
|
+
const { theme, tokens, setTheme } = useAtlantisTheme();
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<View style={{ backgroundColor: tokens["color-surface"] }}>
|
|
21
|
+
<Content>
|
|
22
|
+
<Text>{message}</Text>
|
|
23
|
+
<Text>{`Current theme: ${theme}`}</Text>
|
|
24
|
+
<Text>Tokens can be accessed using tokens[token-name]</Text>
|
|
25
|
+
<Text>{`For example color-surface: ${tokens["color-surface"]}`}</Text>
|
|
26
|
+
<Button label="Set dark theme" onPress={() => setTheme("dark")} />
|
|
27
|
+
<Button label="Set light theme" onPress={() => setTheme("light")} />
|
|
28
|
+
</Content>
|
|
29
|
+
</View>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function ForcedDarkThemeComponent() {
|
|
34
|
+
const { tokens } = useAtlantisTheme();
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<View style={{ backgroundColor: tokens["color-surface"] }}>
|
|
38
|
+
<Content>
|
|
39
|
+
<Text>This will always be a dark theme</Text>
|
|
40
|
+
</Content>
|
|
41
|
+
</View>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function AtlantisThemeContextForceThemeForProviderExample(
|
|
46
|
+
props: Partial<Omit<AtlantisThemeContextProviderProps, "children">>,
|
|
47
|
+
) {
|
|
48
|
+
return (
|
|
49
|
+
<AtlantisThemeContextProvider {...props}>
|
|
50
|
+
<ChildrenComponent message="It is possible to have a provider ignore Theme Changes" />
|
|
51
|
+
<AtlantisThemeContextProvider dangerouslyOverrideTheme="dark">
|
|
52
|
+
<ForcedDarkThemeComponent />
|
|
53
|
+
</AtlantisThemeContextProvider>
|
|
54
|
+
</AtlantisThemeContextProvider>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
2
2
|
import { AutoLink } from "@jobber/components-native";
|
|
3
|
+
import { AutoLinkBasicExample, AutoLinkSkipPhoneNumberExample } from "./docs";
|
|
3
4
|
|
|
4
5
|
const meta = {
|
|
5
6
|
title: "Components/Text and Typography/AutoLink",
|
|
@@ -12,6 +13,7 @@ export default meta;
|
|
|
12
13
|
type Story = StoryObj<typeof meta>;
|
|
13
14
|
|
|
14
15
|
export const Basic: Story = {
|
|
16
|
+
render: AutoLinkBasicExample,
|
|
15
17
|
args: {
|
|
16
18
|
children:
|
|
17
19
|
"I am a test with a link to getjobber.com! Call me at 902-555-5555 or email me at test@example.com",
|
|
@@ -19,6 +21,7 @@ export const Basic: Story = {
|
|
|
19
21
|
};
|
|
20
22
|
|
|
21
23
|
export const SkipPhoneNumber: Story = {
|
|
24
|
+
render: AutoLinkSkipPhoneNumberExample,
|
|
22
25
|
args: {
|
|
23
26
|
phone: false,
|
|
24
27
|
children:
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { AutoLink } from "@jobber/components-native";
|
|
4
|
+
|
|
5
|
+
export function AutoLinkBasicExample(
|
|
6
|
+
props: Partial<ComponentProps<typeof AutoLink>>,
|
|
7
|
+
) {
|
|
8
|
+
return (
|
|
9
|
+
<AutoLink {...props}>
|
|
10
|
+
{props.children ??
|
|
11
|
+
"I am a test with a link to getjobber.com! Call me at 902-555-5555 or email me at test@example.com"}
|
|
12
|
+
</AutoLink>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { AutoLink } from "@jobber/components-native";
|
|
4
|
+
|
|
5
|
+
export function AutoLinkSkipPhoneNumberExample(
|
|
6
|
+
props: Partial<ComponentProps<typeof AutoLink>>,
|
|
7
|
+
) {
|
|
8
|
+
return (
|
|
9
|
+
<AutoLink phone={false} {...props}>
|
|
10
|
+
{props.children ??
|
|
11
|
+
"Ignoring phone numbers like 902-555-5555 but still linking getjobber.com!"}
|
|
12
|
+
</AutoLink>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
3
2
|
import { action } from "storybook/actions";
|
|
4
|
-
import { Banner
|
|
3
|
+
import { Banner } from "@jobber/components-native";
|
|
4
|
+
import {
|
|
5
|
+
BannerActionsInBannersExample,
|
|
6
|
+
BannerBasicExample,
|
|
7
|
+
BannerErrorDetailsExample,
|
|
8
|
+
BannerErrorExample,
|
|
9
|
+
} from "./docs";
|
|
5
10
|
|
|
6
11
|
const meta = {
|
|
7
12
|
title: "Components/Status and Feedback/Banner",
|
|
@@ -17,51 +22,12 @@ const meta = {
|
|
|
17
22
|
export default meta;
|
|
18
23
|
type Story = StoryObj<typeof meta>;
|
|
19
24
|
|
|
20
|
-
const BasicTemplate = () => (
|
|
21
|
-
<Content>
|
|
22
|
-
<Banner type="success">
|
|
23
|
-
<Text>Your import is complete</Text>
|
|
24
|
-
</Banner>
|
|
25
|
-
<Banner type="notice">
|
|
26
|
-
<Text>Your import is in progress</Text>
|
|
27
|
-
</Banner>
|
|
28
|
-
<Banner type="warning">
|
|
29
|
-
<Text>Your trial is about to end</Text>
|
|
30
|
-
</Banner>
|
|
31
|
-
<Banner type="error">
|
|
32
|
-
<Text>There was an error with your import</Text>
|
|
33
|
-
</Banner>
|
|
34
|
-
</Content>
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
const ActionsTemplate = (args: Story["args"]) => (
|
|
38
|
-
<Banner {...args}>{args?.children}</Banner>
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const ErrorTemplate = (args: Story["args"]) => (
|
|
42
|
-
<Banner {...args}>{args?.children}</Banner>
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
const ErrorDetailsTemplate = (args: Story["args"]) => {
|
|
46
|
-
const listItems = [
|
|
47
|
-
"This client already exists",
|
|
48
|
-
"This phone number doesn't receive SMS",
|
|
49
|
-
];
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<Banner {...args}>
|
|
53
|
-
<Text level="text">There was an error submitting your form:</Text>
|
|
54
|
-
<TextList level="text" items={listItems} />
|
|
55
|
-
</Banner>
|
|
56
|
-
);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
25
|
export const Basic: Story = {
|
|
60
|
-
render:
|
|
26
|
+
render: BannerBasicExample,
|
|
61
27
|
};
|
|
62
28
|
|
|
63
29
|
export const ActionsInBanners: Story = {
|
|
64
|
-
render:
|
|
30
|
+
render: BannerActionsInBannersExample,
|
|
65
31
|
args: {
|
|
66
32
|
type: "notice",
|
|
67
33
|
children: "Your trial has been extended!",
|
|
@@ -70,7 +36,7 @@ export const ActionsInBanners: Story = {
|
|
|
70
36
|
};
|
|
71
37
|
|
|
72
38
|
export const Error: Story = {
|
|
73
|
-
render:
|
|
39
|
+
render: BannerErrorExample,
|
|
74
40
|
args: {
|
|
75
41
|
type: "error",
|
|
76
42
|
children: "Currently offline. Functionality is limited.",
|
|
@@ -79,7 +45,7 @@ export const Error: Story = {
|
|
|
79
45
|
};
|
|
80
46
|
|
|
81
47
|
export const ErrorDetails: Story = {
|
|
82
|
-
render:
|
|
48
|
+
render: BannerErrorDetailsExample,
|
|
83
49
|
args: {
|
|
84
50
|
type: "error",
|
|
85
51
|
icon: "alert",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { action } from "storybook/actions";
|
|
4
|
+
import { Banner } from "@jobber/components-native";
|
|
5
|
+
|
|
6
|
+
export function BannerActionsInBannersExample(
|
|
7
|
+
props: Partial<ComponentProps<typeof Banner>>,
|
|
8
|
+
) {
|
|
9
|
+
return (
|
|
10
|
+
<Banner
|
|
11
|
+
type="notice"
|
|
12
|
+
action={{ label: "View Plans", onPress: () => action("alert")("Plans") }}
|
|
13
|
+
{...props}
|
|
14
|
+
>
|
|
15
|
+
{props.children ?? "Your trial has been extended!"}
|
|
16
|
+
</Banner>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Banner, Content, Text } from "@jobber/components-native";
|
|
3
|
+
|
|
4
|
+
export function BannerBasicExample() {
|
|
5
|
+
return (
|
|
6
|
+
<Content>
|
|
7
|
+
<Banner type="success">
|
|
8
|
+
<Text>Your import is complete</Text>
|
|
9
|
+
</Banner>
|
|
10
|
+
<Banner type="notice">
|
|
11
|
+
<Text>Your import is in progress</Text>
|
|
12
|
+
</Banner>
|
|
13
|
+
<Banner type="warning">
|
|
14
|
+
<Text>Your trial is about to end</Text>
|
|
15
|
+
</Banner>
|
|
16
|
+
<Banner type="error">
|
|
17
|
+
<Text>There was an error with your import</Text>
|
|
18
|
+
</Banner>
|
|
19
|
+
</Content>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Banner, Text, TextList } from "@jobber/components-native";
|
|
4
|
+
|
|
5
|
+
export function BannerErrorDetailsExample(
|
|
6
|
+
props: Partial<ComponentProps<typeof Banner>>,
|
|
7
|
+
) {
|
|
8
|
+
const listItems = [
|
|
9
|
+
"This client already exists",
|
|
10
|
+
"This phone number doesn't receive SMS",
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<Banner type="error" icon="alert" {...props}>
|
|
15
|
+
<Text level="text">There was an error submitting your form:</Text>
|
|
16
|
+
<TextList level="text" items={listItems} />
|
|
17
|
+
</Banner>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Banner } from "@jobber/components-native";
|
|
4
|
+
|
|
5
|
+
export function BannerErrorExample(
|
|
6
|
+
props: Partial<ComponentProps<typeof Banner>>,
|
|
7
|
+
) {
|
|
8
|
+
return (
|
|
9
|
+
<Banner type="error" icon="offline" {...props}>
|
|
10
|
+
{props.children ?? "Currently offline. Functionality is limited."}
|
|
11
|
+
</Banner>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { BannerBasicExample } from "./BannerBasicExample";
|
|
2
|
+
export { BannerActionsInBannersExample } from "./BannerActionsInBannersExample";
|
|
3
|
+
export { BannerErrorExample } from "./BannerErrorExample";
|
|
4
|
+
export { BannerErrorDetailsExample } from "./BannerErrorDetailsExample";
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import React, { useRef } from "react";
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
3
|
-
import { View } from "react-native";
|
|
4
|
-
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
5
|
-
import { action } from "storybook/actions";
|
|
6
|
-
import { Button, Heading, Text } from "@jobber/components-native";
|
|
7
2
|
import { BottomSheet } from "./BottomSheet";
|
|
8
|
-
import
|
|
9
|
-
|
|
3
|
+
import {
|
|
4
|
+
BottomSheetBasicExample,
|
|
5
|
+
BottomSheetHeaderFooterExample,
|
|
6
|
+
} from "./docs";
|
|
10
7
|
|
|
11
8
|
const meta = {
|
|
12
9
|
title: "Components/Selections/BottomSheet",
|
|
@@ -16,114 +13,12 @@ const meta = {
|
|
|
16
13
|
export default meta;
|
|
17
14
|
type Story = StoryObj<typeof meta>;
|
|
18
15
|
|
|
19
|
-
const BasicTemplate = () => {
|
|
20
|
-
const bottomSheetRef = useRef<BottomSheetRef>(null);
|
|
21
|
-
|
|
22
|
-
const openBottomSheet = () => {
|
|
23
|
-
bottomSheetRef.current?.open();
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const closeBottomSheet = () => {
|
|
27
|
-
bottomSheetRef.current?.close();
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<SafeAreaProvider>
|
|
32
|
-
<View style={{ display: "flex", flexDirection: "column", gap: 16 }}>
|
|
33
|
-
<Heading>Basic BottomSheet</Heading>
|
|
34
|
-
<Text>
|
|
35
|
-
Note that due to the differences between React Native Web and React
|
|
36
|
-
Native, this does not render 100% properly
|
|
37
|
-
</Text>
|
|
38
|
-
<Button label="Open Bottom Sheet" onPress={openBottomSheet} />
|
|
39
|
-
<Button label="Close Bottom Sheet" onPress={closeBottomSheet} />
|
|
40
|
-
</View>
|
|
41
|
-
<BottomSheet
|
|
42
|
-
ref={bottomSheetRef}
|
|
43
|
-
onClose={() => action("console.log")("closed bottom sheet")}
|
|
44
|
-
onOpen={() => action("console.log")("opened bottom sheet")}
|
|
45
|
-
>
|
|
46
|
-
<BottomSheetOption
|
|
47
|
-
icon="sendMessage"
|
|
48
|
-
iconColor="greyBlue"
|
|
49
|
-
text="Send message"
|
|
50
|
-
onPress={() => action("alert")("send message")}
|
|
51
|
-
/>
|
|
52
|
-
<BottomSheetOption
|
|
53
|
-
icon="phone"
|
|
54
|
-
iconColor="greyBlue"
|
|
55
|
-
text="Call a friend"
|
|
56
|
-
onPress={() => action("alert")("Calling a friend")}
|
|
57
|
-
/>
|
|
58
|
-
<BottomSheetOption
|
|
59
|
-
destructive={true}
|
|
60
|
-
icon="trash"
|
|
61
|
-
text="Remove"
|
|
62
|
-
onPress={() => action("alert")("Removed")}
|
|
63
|
-
/>
|
|
64
|
-
</BottomSheet>
|
|
65
|
-
</SafeAreaProvider>
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const HeaderFooterInputTextTemplate = () => {
|
|
70
|
-
const bottomSheetRef = useRef<BottomSheetRef>(null);
|
|
71
|
-
|
|
72
|
-
const openBottomSheet = () => {
|
|
73
|
-
bottomSheetRef.current?.open();
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const closeBottomSheet = () => {
|
|
77
|
-
bottomSheetRef.current?.close();
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
<SafeAreaProvider>
|
|
82
|
-
<View style={{ display: "flex", flexDirection: "column", gap: 16 }}>
|
|
83
|
-
<Heading>Basic BottomSheet</Heading>
|
|
84
|
-
<Text>
|
|
85
|
-
Note that due to the differences between React Native Web and React
|
|
86
|
-
Native, this does not render 100% properly
|
|
87
|
-
</Text>
|
|
88
|
-
<Button label="Open Bottom Sheet" onPress={openBottomSheet} />
|
|
89
|
-
<Button label="Close Bottom Sheet" onPress={closeBottomSheet} />
|
|
90
|
-
</View>
|
|
91
|
-
<BottomSheet
|
|
92
|
-
ref={bottomSheetRef}
|
|
93
|
-
showCancel={true}
|
|
94
|
-
heading="BottomSheet Header"
|
|
95
|
-
onClose={() => action("console.log")("closed bottom sheet")}
|
|
96
|
-
onOpen={() => action("console.log")("opened bottom sheet")}
|
|
97
|
-
>
|
|
98
|
-
<BottomSheetOption
|
|
99
|
-
icon="sendMessage"
|
|
100
|
-
iconColor="greyBlue"
|
|
101
|
-
text="Send message"
|
|
102
|
-
onPress={() => action("alert")("send message")}
|
|
103
|
-
/>
|
|
104
|
-
<BottomSheetOption
|
|
105
|
-
icon="phone"
|
|
106
|
-
iconColor="greyBlue"
|
|
107
|
-
text="Call a friend"
|
|
108
|
-
onPress={() => action("alert")("Calling a friend")}
|
|
109
|
-
/>
|
|
110
|
-
<BottomSheetOption
|
|
111
|
-
destructive={true}
|
|
112
|
-
icon="trash"
|
|
113
|
-
text="Remove"
|
|
114
|
-
onPress={() => action("alert")("Removed")}
|
|
115
|
-
/>
|
|
116
|
-
</BottomSheet>
|
|
117
|
-
</SafeAreaProvider>
|
|
118
|
-
);
|
|
119
|
-
};
|
|
120
|
-
|
|
121
16
|
export const Basic: Story = {
|
|
122
|
-
render:
|
|
17
|
+
render: BottomSheetBasicExample,
|
|
123
18
|
args: {} as Story["args"],
|
|
124
19
|
};
|
|
125
20
|
|
|
126
21
|
export const HeaderFooterInputText: Story = {
|
|
127
|
-
render:
|
|
22
|
+
render: BottomSheetHeaderFooterExample,
|
|
128
23
|
args: {} as Story["args"],
|
|
129
24
|
};
|