@jobber/components-native 0.101.7 → 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/InputDate/InputDate.md +1 -4
- package/dist/docs/Select/Select.md +22 -16
- package/dist/docs/usage-guidelines/usage-guidelines.md +9 -13
- package/dist/package.json +3 -3
- package/dist/tsconfig.build.json +8 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/tsconfig.json +1 -0
- package/package.json +3 -3
- 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,54 @@
|
|
|
1
|
+
import React, { useRef } from "react";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
5
|
+
import { action } from "storybook/actions";
|
|
6
|
+
import { BottomSheetModalProvider } from "@gorhom/bottom-sheet";
|
|
7
|
+
import type { ContentOverlayRef } from "@jobber/components-native";
|
|
8
|
+
import {
|
|
9
|
+
Button,
|
|
10
|
+
ContentOverlay,
|
|
11
|
+
Heading,
|
|
12
|
+
Text,
|
|
13
|
+
} from "@jobber/components-native";
|
|
14
|
+
|
|
15
|
+
type ContentOverlayProps = ComponentProps<typeof ContentOverlay>;
|
|
16
|
+
|
|
17
|
+
export function ContentOverlayBasic(props: Partial<ContentOverlayProps>) {
|
|
18
|
+
const contentOverlayRef = useRef<ContentOverlayRef>(null);
|
|
19
|
+
|
|
20
|
+
const openContentOverlay = () => {
|
|
21
|
+
contentOverlayRef.current?.open?.();
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const closeContentOverlay = () => {
|
|
25
|
+
contentOverlayRef.current?.close?.();
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<SafeAreaProvider>
|
|
30
|
+
<BottomSheetModalProvider>
|
|
31
|
+
<View style={{ display: "flex", flexDirection: "column", gap: 16 }}>
|
|
32
|
+
<Heading>Basic ContentOverlay</Heading>
|
|
33
|
+
<Text>
|
|
34
|
+
Note that due to the differences between React Native Web and React
|
|
35
|
+
Native, this does not render 100% properly
|
|
36
|
+
</Text>
|
|
37
|
+
<Button label="Open Content Overlay" onPress={openContentOverlay} />
|
|
38
|
+
<Button label="Close Content Overlay" onPress={closeContentOverlay} />
|
|
39
|
+
</View>
|
|
40
|
+
<ContentOverlay
|
|
41
|
+
ref={contentOverlayRef}
|
|
42
|
+
title="Content Overlay Title"
|
|
43
|
+
onClose={() => action("console.log")("closed content overlay")}
|
|
44
|
+
onOpen={() => action("console.log")("opened content overlay")}
|
|
45
|
+
{...props}
|
|
46
|
+
>
|
|
47
|
+
<View style={{ padding: 16 }}>
|
|
48
|
+
<Text>This is the content inside the overlay.</Text>
|
|
49
|
+
</View>
|
|
50
|
+
</ContentOverlay>
|
|
51
|
+
</BottomSheetModalProvider>
|
|
52
|
+
</SafeAreaProvider>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ContentOverlayBasic } from "./ContentOverlayBasic";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
3
3
|
import { Disclosure } from "@jobber/components-native";
|
|
4
|
+
import { DisclosureBasic } from "./docs";
|
|
4
5
|
|
|
5
6
|
const meta = {
|
|
6
7
|
title: "Components/Layouts and Structure/Disclosure",
|
|
@@ -12,30 +13,13 @@ const meta = {
|
|
|
12
13
|
} satisfies Meta<typeof Disclosure>;
|
|
13
14
|
export default meta;
|
|
14
15
|
type DisclosureStoryArgs = Pick<
|
|
15
|
-
|
|
16
|
+
ComponentProps<typeof Disclosure>,
|
|
16
17
|
"header" | "content" | "isEmpty"
|
|
17
18
|
>;
|
|
18
19
|
type Story = StoryObj<DisclosureStoryArgs>;
|
|
19
20
|
|
|
20
|
-
const BasicTemplate = (args: Story["args"]) => {
|
|
21
|
-
const [open, setOpen] = useState(false);
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<Disclosure
|
|
25
|
-
header={args?.header ?? "Advanced Instructions"}
|
|
26
|
-
content={
|
|
27
|
-
args?.content ??
|
|
28
|
-
"For every 2 team members you add, your profits will triple."
|
|
29
|
-
}
|
|
30
|
-
isEmpty={args?.isEmpty ?? false}
|
|
31
|
-
open={open}
|
|
32
|
-
onToggle={() => setOpen(!open)}
|
|
33
|
-
/>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
21
|
export const Basic: Story = {
|
|
38
|
-
render:
|
|
22
|
+
render: DisclosureBasic,
|
|
39
23
|
args: {
|
|
40
24
|
header: "Advanced Instructions",
|
|
41
25
|
content: "For every 2 team members you add, your profits will triple.",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
import { Disclosure } from "@jobber/components-native";
|
|
4
|
+
|
|
5
|
+
type DisclosureProps = ComponentProps<typeof Disclosure>;
|
|
6
|
+
|
|
7
|
+
export function DisclosureBasic(props: Partial<DisclosureProps>) {
|
|
8
|
+
const [open, setOpen] = useState(false);
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<Disclosure
|
|
12
|
+
header={props.header ?? "Advanced Instructions"}
|
|
13
|
+
content={
|
|
14
|
+
props.content ??
|
|
15
|
+
"For every 2 team members you add, your profits will triple."
|
|
16
|
+
}
|
|
17
|
+
isEmpty={props.isEmpty ?? false}
|
|
18
|
+
{...props}
|
|
19
|
+
open={open}
|
|
20
|
+
onToggle={() => setOpen(!open)}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DisclosureBasic } from "./DisclosureBasic";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
1
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
4
|
-
import {
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
import { Divider } from "@jobber/components-native";
|
|
4
|
+
import { DividerHorizontal, DividerVertical } from "./docs";
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
7
|
title: "Components/Layouts and Structure/Divider",
|
|
@@ -11,54 +11,10 @@ const meta = {
|
|
|
11
11
|
},
|
|
12
12
|
} satisfies Meta<typeof Divider>;
|
|
13
13
|
export default meta;
|
|
14
|
-
type Story = StoryObj<Partial<
|
|
15
|
-
|
|
16
|
-
const HorizontalTemplate = (args: Story["args"]) => (
|
|
17
|
-
<View
|
|
18
|
-
style={{
|
|
19
|
-
display: "flex",
|
|
20
|
-
gap: 16,
|
|
21
|
-
}}
|
|
22
|
-
>
|
|
23
|
-
<Content>Some amazing content</Content>
|
|
24
|
-
<Divider {...args} />
|
|
25
|
-
<Content>Even more amazing content</Content>
|
|
26
|
-
</View>
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
const VerticalTemplate = (args: Story["args"]) => (
|
|
30
|
-
<View>
|
|
31
|
-
<View style={{ marginBottom: 16 }}>
|
|
32
|
-
<Heading>Summary</Heading>
|
|
33
|
-
</View>
|
|
34
|
-
<View
|
|
35
|
-
style={{
|
|
36
|
-
display: "flex",
|
|
37
|
-
flexDirection: "row",
|
|
38
|
-
height: 40,
|
|
39
|
-
gap: 16,
|
|
40
|
-
}}
|
|
41
|
-
>
|
|
42
|
-
<Content spacing="small">
|
|
43
|
-
<Heading level="subHeading">Today</Heading>
|
|
44
|
-
<Text>{"\n"}$104.13</Text>
|
|
45
|
-
</Content>
|
|
46
|
-
<Divider {...args} direction="vertical" />
|
|
47
|
-
<Content spacing="small">
|
|
48
|
-
<Heading level="subHeading">Tomorrow</Heading>
|
|
49
|
-
<Text>{"\n"}$262.42</Text>
|
|
50
|
-
</Content>
|
|
51
|
-
<Divider {...args} direction="vertical" />
|
|
52
|
-
<Content spacing="small">
|
|
53
|
-
<Heading level="subHeading">Next Week</Heading>
|
|
54
|
-
<Text>{"\n"}$123.23</Text>
|
|
55
|
-
</Content>
|
|
56
|
-
</View>
|
|
57
|
-
</View>
|
|
58
|
-
);
|
|
14
|
+
type Story = StoryObj<Partial<ComponentProps<typeof Divider>>>;
|
|
59
15
|
|
|
60
16
|
export const Horizontal: Story = {
|
|
61
|
-
render:
|
|
17
|
+
render: DividerHorizontal,
|
|
62
18
|
args: {
|
|
63
19
|
size: "base",
|
|
64
20
|
direction: "horizontal",
|
|
@@ -66,7 +22,7 @@ export const Horizontal: Story = {
|
|
|
66
22
|
};
|
|
67
23
|
|
|
68
24
|
export const Vertical: Story = {
|
|
69
|
-
render:
|
|
25
|
+
render: DividerVertical,
|
|
70
26
|
args: {
|
|
71
27
|
size: "base",
|
|
72
28
|
direction: "vertical",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import { Content, Divider } from "@jobber/components-native";
|
|
5
|
+
|
|
6
|
+
type DividerProps = ComponentProps<typeof Divider>;
|
|
7
|
+
|
|
8
|
+
export function DividerHorizontal(props: Partial<DividerProps>) {
|
|
9
|
+
return (
|
|
10
|
+
<View
|
|
11
|
+
style={{
|
|
12
|
+
display: "flex",
|
|
13
|
+
gap: 16,
|
|
14
|
+
}}
|
|
15
|
+
>
|
|
16
|
+
<Content>Some amazing content</Content>
|
|
17
|
+
<Divider size="base" direction="horizontal" {...props} />
|
|
18
|
+
<Content>Even more amazing content</Content>
|
|
19
|
+
</View>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import { Content, Divider, Heading, Text } from "@jobber/components-native";
|
|
5
|
+
|
|
6
|
+
type DividerProps = ComponentProps<typeof Divider>;
|
|
7
|
+
|
|
8
|
+
export function DividerVertical(props: Partial<DividerProps>) {
|
|
9
|
+
return (
|
|
10
|
+
<View>
|
|
11
|
+
<View style={{ marginBottom: 16 }}>
|
|
12
|
+
<Heading>Summary</Heading>
|
|
13
|
+
</View>
|
|
14
|
+
<View
|
|
15
|
+
style={{
|
|
16
|
+
display: "flex",
|
|
17
|
+
flexDirection: "row",
|
|
18
|
+
height: 40,
|
|
19
|
+
gap: 16,
|
|
20
|
+
}}
|
|
21
|
+
>
|
|
22
|
+
<Content spacing="small">
|
|
23
|
+
<Heading level="subHeading">Today</Heading>
|
|
24
|
+
<Text>{"\n"}$104.13</Text>
|
|
25
|
+
</Content>
|
|
26
|
+
<Divider size="base" direction="vertical" {...props} />
|
|
27
|
+
<Content spacing="small">
|
|
28
|
+
<Heading level="subHeading">Tomorrow</Heading>
|
|
29
|
+
<Text>{"\n"}$262.42</Text>
|
|
30
|
+
</Content>
|
|
31
|
+
<Divider size="base" direction="vertical" {...props} />
|
|
32
|
+
<Content spacing="small">
|
|
33
|
+
<Heading level="subHeading">Next Week</Heading>
|
|
34
|
+
<Text>{"\n"}$123.23</Text>
|
|
35
|
+
</Content>
|
|
36
|
+
</View>
|
|
37
|
+
</View>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
2
2
|
import { action } from "storybook/actions";
|
|
3
3
|
import { EmptyState } from "@jobber/components-native";
|
|
4
|
+
import { EmptyStateBasic } from "./docs";
|
|
4
5
|
|
|
5
6
|
const meta = {
|
|
6
7
|
title: "Components/Status and Feedback/EmptyState",
|
|
@@ -13,6 +14,7 @@ export default meta;
|
|
|
13
14
|
type Story = StoryObj<typeof meta>;
|
|
14
15
|
|
|
15
16
|
export const Basic: Story = {
|
|
17
|
+
render: EmptyStateBasic,
|
|
16
18
|
args: {
|
|
17
19
|
icon: "home",
|
|
18
20
|
title: "Title",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { action } from "storybook/actions";
|
|
3
|
+
import { EmptyState } from "@jobber/components-native";
|
|
4
|
+
import type { EmptyStateProps } from "@jobber/components-native";
|
|
5
|
+
|
|
6
|
+
export function EmptyStateBasic(props: Partial<EmptyStateProps>) {
|
|
7
|
+
return (
|
|
8
|
+
<EmptyState
|
|
9
|
+
icon="home"
|
|
10
|
+
title="Title"
|
|
11
|
+
description="Description"
|
|
12
|
+
primaryAction={{
|
|
13
|
+
label: "Click Me",
|
|
14
|
+
onPress: () => {
|
|
15
|
+
action("alert")("👋");
|
|
16
|
+
},
|
|
17
|
+
}}
|
|
18
|
+
secondaryAction={{
|
|
19
|
+
label: "Don't Forget About Me",
|
|
20
|
+
onPress: () => {
|
|
21
|
+
action("alert")("👋");
|
|
22
|
+
},
|
|
23
|
+
}}
|
|
24
|
+
{...props}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EmptyStateBasic } from "./EmptyStateBasic";
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { View } from "react-native";
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
3
2
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
Content,
|
|
7
|
-
Flex,
|
|
8
|
-
Icon,
|
|
9
|
-
StatusLabel,
|
|
10
|
-
Text,
|
|
11
|
-
} from "@jobber/components-native";
|
|
3
|
+
import { Flex } from "@jobber/components-native";
|
|
4
|
+
import { FlexMultiRow, FlexNested } from "./docs";
|
|
12
5
|
|
|
13
6
|
const meta = {
|
|
14
7
|
title: "Components/Layouts and Structure/Flex",
|
|
@@ -22,57 +15,13 @@ const meta = {
|
|
|
22
15
|
} satisfies Meta<typeof Flex>;
|
|
23
16
|
export default meta;
|
|
24
17
|
type FlexStoryArgs = Pick<
|
|
25
|
-
|
|
18
|
+
ComponentProps<typeof Flex>,
|
|
26
19
|
"template" | "align" | "gap"
|
|
27
20
|
>;
|
|
28
21
|
type Story = StoryObj<FlexStoryArgs>;
|
|
29
22
|
|
|
30
|
-
const NestedTemplate = (args: Story["args"]) => (
|
|
31
|
-
<Flex
|
|
32
|
-
template={args?.template ?? ["grow", "shrink"]}
|
|
33
|
-
align={args?.align}
|
|
34
|
-
gap={args?.gap}
|
|
35
|
-
>
|
|
36
|
-
<Flex align={"flex-start"} template={["shrink", "grow"]}>
|
|
37
|
-
<Icon name="quote" />
|
|
38
|
-
<View>
|
|
39
|
-
<Flex template={["grow", "shrink"]}>
|
|
40
|
-
<Text emphasis="strong">Dylan Tec</Text>
|
|
41
|
-
<StatusLabel text="Success" status="success" />
|
|
42
|
-
</Flex>
|
|
43
|
-
<Text>Sep 03 | $100 | Quote #93</Text>
|
|
44
|
-
</View>
|
|
45
|
-
</Flex>
|
|
46
|
-
<Icon name="arrowRight" />
|
|
47
|
-
</Flex>
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
const MultiRowTemplate = (args: Story["args"]) => (
|
|
51
|
-
<Flex
|
|
52
|
-
template={args?.template ?? ["grow", "grow"]}
|
|
53
|
-
align={args?.align}
|
|
54
|
-
gap={args?.gap}
|
|
55
|
-
>
|
|
56
|
-
{[
|
|
57
|
-
"Cash",
|
|
58
|
-
"Cheque",
|
|
59
|
-
"Credit card",
|
|
60
|
-
"Bank transfer",
|
|
61
|
-
"Money order",
|
|
62
|
-
"Pigeon Mail",
|
|
63
|
-
"Other",
|
|
64
|
-
].map(name => (
|
|
65
|
-
<Card key={name}>
|
|
66
|
-
<Content>
|
|
67
|
-
<Text emphasis="strong">{name}</Text>
|
|
68
|
-
</Content>
|
|
69
|
-
</Card>
|
|
70
|
-
))}
|
|
71
|
-
</Flex>
|
|
72
|
-
);
|
|
73
|
-
|
|
74
23
|
export const Nested: Story = {
|
|
75
|
-
render:
|
|
24
|
+
render: FlexNested,
|
|
76
25
|
args: {
|
|
77
26
|
template: ["grow", "shrink"],
|
|
78
27
|
align: "center",
|
|
@@ -80,7 +29,7 @@ export const Nested: Story = {
|
|
|
80
29
|
};
|
|
81
30
|
|
|
82
31
|
export const MultiRow: Story = {
|
|
83
|
-
render:
|
|
32
|
+
render: FlexMultiRow,
|
|
84
33
|
args: {
|
|
85
34
|
template: ["grow", "grow"],
|
|
86
35
|
gap: "small",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Card, Content, Flex, Text } from "@jobber/components-native";
|
|
3
|
+
import type { FlexProps } from "@jobber/components-native";
|
|
4
|
+
|
|
5
|
+
export function FlexMultiRow(props: Partial<FlexProps>) {
|
|
6
|
+
return (
|
|
7
|
+
<Flex template={["grow", "grow"]} gap="small" {...props}>
|
|
8
|
+
{[
|
|
9
|
+
"Cash",
|
|
10
|
+
"Cheque",
|
|
11
|
+
"Credit card",
|
|
12
|
+
"Bank transfer",
|
|
13
|
+
"Money order",
|
|
14
|
+
"Pigeon Mail",
|
|
15
|
+
"Other",
|
|
16
|
+
].map(name => (
|
|
17
|
+
<Card key={name}>
|
|
18
|
+
<Content>
|
|
19
|
+
<Text emphasis="strong">{name}</Text>
|
|
20
|
+
</Content>
|
|
21
|
+
</Card>
|
|
22
|
+
))}
|
|
23
|
+
</Flex>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { Flex, Icon, StatusLabel, Text } from "@jobber/components-native";
|
|
4
|
+
import type { FlexProps } from "@jobber/components-native";
|
|
5
|
+
|
|
6
|
+
export function FlexNested(props: Partial<FlexProps>) {
|
|
7
|
+
return (
|
|
8
|
+
<Flex template={["grow", "shrink"]} align="center" {...props}>
|
|
9
|
+
<Flex align={"flex-start"} template={["shrink", "grow"]}>
|
|
10
|
+
<Icon name="quote" />
|
|
11
|
+
<View>
|
|
12
|
+
<Flex template={["grow", "shrink"]}>
|
|
13
|
+
<Text emphasis="strong">Dylan Tec</Text>
|
|
14
|
+
<StatusLabel text="Success" status="success" />
|
|
15
|
+
</Flex>
|
|
16
|
+
<Text>Sep 03 | $100 | Quote #93</Text>
|
|
17
|
+
</View>
|
|
18
|
+
</Flex>
|
|
19
|
+
<Icon name="arrowRight" />
|
|
20
|
+
</Flex>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
3
|
-
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
4
3
|
import { action } from "storybook/actions";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
Content,
|
|
8
|
-
Form,
|
|
9
|
-
InputText,
|
|
10
|
-
} from "@jobber/components-native";
|
|
4
|
+
import { Form } from "@jobber/components-native";
|
|
5
|
+
import { FormBasic } from "./docs";
|
|
11
6
|
|
|
12
7
|
const meta = {
|
|
13
8
|
title: "Components/Forms and Inputs/Form",
|
|
@@ -25,51 +20,12 @@ interface NativeFormStoryArgs {
|
|
|
25
20
|
lastName: string;
|
|
26
21
|
nickName: string;
|
|
27
22
|
};
|
|
28
|
-
secondaryActions?:
|
|
23
|
+
secondaryActions?: ComponentProps<typeof Form>["secondaryActions"];
|
|
29
24
|
}
|
|
30
25
|
type Story = StoryObj<NativeFormStoryArgs>;
|
|
31
26
|
|
|
32
|
-
const BasicTemplate = (args: Story["args"]) => (
|
|
33
|
-
<SafeAreaProvider>
|
|
34
|
-
<AtlantisOverlayProvider>
|
|
35
|
-
<Form
|
|
36
|
-
initialValues={args?.initialValues}
|
|
37
|
-
secondaryActions={args?.secondaryActions}
|
|
38
|
-
onSubmit={value =>
|
|
39
|
-
new Promise(resolve => {
|
|
40
|
-
setTimeout(
|
|
41
|
-
() => resolve(action("alert")(JSON.stringify(value, undefined))),
|
|
42
|
-
1000,
|
|
43
|
-
);
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
onSubmitError={() => undefined}
|
|
47
|
-
onSubmitSuccess={() => undefined}
|
|
48
|
-
>
|
|
49
|
-
<Content>
|
|
50
|
-
<InputText
|
|
51
|
-
name="firstName"
|
|
52
|
-
placeholder="First name"
|
|
53
|
-
validations={{ required: "Please add a first name" }}
|
|
54
|
-
/>
|
|
55
|
-
<InputText
|
|
56
|
-
name="lastName"
|
|
57
|
-
placeholder="Last name"
|
|
58
|
-
validations={{ required: "Please add a last name" }}
|
|
59
|
-
/>
|
|
60
|
-
<InputText
|
|
61
|
-
name="nickName"
|
|
62
|
-
placeholder="Nick name"
|
|
63
|
-
validations={{ required: "Please add a nick name" }}
|
|
64
|
-
/>
|
|
65
|
-
</Content>
|
|
66
|
-
</Form>
|
|
67
|
-
</AtlantisOverlayProvider>
|
|
68
|
-
</SafeAreaProvider>
|
|
69
|
-
);
|
|
70
|
-
|
|
71
27
|
export const Basic: Story = {
|
|
72
|
-
render:
|
|
28
|
+
render: FormBasic,
|
|
73
29
|
args: {
|
|
74
30
|
initialValues: {
|
|
75
31
|
firstName: "Greatest",
|
|
@@ -80,7 +36,7 @@ export const Basic: Story = {
|
|
|
80
36
|
};
|
|
81
37
|
|
|
82
38
|
export const WithSecondaryActions: Story = {
|
|
83
|
-
render:
|
|
39
|
+
render: FormBasic,
|
|
84
40
|
args: {
|
|
85
41
|
initialValues: {
|
|
86
42
|
firstName: "Test",
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
3
|
+
import { action } from "storybook/actions";
|
|
4
|
+
import {
|
|
5
|
+
AtlantisOverlayProvider,
|
|
6
|
+
Content,
|
|
7
|
+
Form,
|
|
8
|
+
InputText,
|
|
9
|
+
} from "@jobber/components-native";
|
|
10
|
+
import type { FormProps } from "@jobber/components-native";
|
|
11
|
+
|
|
12
|
+
type FormStoryArgs = Pick<
|
|
13
|
+
FormProps<{ firstName: string; lastName: string; nickName: string }, unknown>,
|
|
14
|
+
"initialValues" | "secondaryActions"
|
|
15
|
+
>;
|
|
16
|
+
|
|
17
|
+
export function FormBasic(props: Partial<FormStoryArgs>) {
|
|
18
|
+
return (
|
|
19
|
+
<SafeAreaProvider>
|
|
20
|
+
<AtlantisOverlayProvider>
|
|
21
|
+
<Form
|
|
22
|
+
initialValues={
|
|
23
|
+
props.initialValues ?? {
|
|
24
|
+
firstName: "Greatest",
|
|
25
|
+
lastName: "Ever",
|
|
26
|
+
nickName: "",
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
secondaryActions={props.secondaryActions}
|
|
30
|
+
onSubmit={value =>
|
|
31
|
+
new Promise(resolve => {
|
|
32
|
+
setTimeout(
|
|
33
|
+
() =>
|
|
34
|
+
resolve(action("alert")(JSON.stringify(value, undefined))),
|
|
35
|
+
1000,
|
|
36
|
+
);
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
onSubmitError={() => undefined}
|
|
40
|
+
onSubmitSuccess={() => undefined}
|
|
41
|
+
>
|
|
42
|
+
<Content>
|
|
43
|
+
<InputText
|
|
44
|
+
name="firstName"
|
|
45
|
+
placeholder="First name"
|
|
46
|
+
validations={{ required: "Please add a first name" }}
|
|
47
|
+
/>
|
|
48
|
+
<InputText
|
|
49
|
+
name="lastName"
|
|
50
|
+
placeholder="Last name"
|
|
51
|
+
validations={{ required: "Please add a last name" }}
|
|
52
|
+
/>
|
|
53
|
+
<InputText
|
|
54
|
+
name="nickName"
|
|
55
|
+
placeholder="Nick name"
|
|
56
|
+
validations={{ required: "Please add a nick name" }}
|
|
57
|
+
/>
|
|
58
|
+
</Content>
|
|
59
|
+
</Form>
|
|
60
|
+
</AtlantisOverlayProvider>
|
|
61
|
+
</SafeAreaProvider>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FormBasic } from "./FormBasic";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { FormProvider, useForm } from "react-hook-form";
|
|
3
1
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
4
|
-
import { FormField
|
|
2
|
+
import { FormField } from "@jobber/components-native";
|
|
3
|
+
import { FormFieldBasic, FormFieldWithValidations } from "./docs";
|
|
5
4
|
|
|
6
5
|
const meta = {
|
|
7
6
|
title: "Components/Private/FormField",
|
|
@@ -17,56 +16,15 @@ interface NativeFormFieldStoryArgs {
|
|
|
17
16
|
}
|
|
18
17
|
type Story = StoryObj<NativeFormFieldStoryArgs>;
|
|
19
18
|
|
|
20
|
-
const BasicTemplate = (args: Story["args"]) => {
|
|
21
|
-
return (
|
|
22
|
-
<FormField name={args?.name ?? "name"}>
|
|
23
|
-
{field => {
|
|
24
|
-
return <InputText value={field.value} placeholder="Enter name here" />;
|
|
25
|
-
}}
|
|
26
|
-
</FormField>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const WithValidationsTemplate = (args: Story["args"]) => {
|
|
31
|
-
const methods = useForm({ mode: "onChange" });
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<FormProvider {...methods}>
|
|
35
|
-
<FormField
|
|
36
|
-
name={args?.name ?? "validations"}
|
|
37
|
-
validations={{
|
|
38
|
-
maxLength: {
|
|
39
|
-
value: 5,
|
|
40
|
-
message: "Should not exceed 5 characters",
|
|
41
|
-
},
|
|
42
|
-
}}
|
|
43
|
-
>
|
|
44
|
-
{(field, error) => {
|
|
45
|
-
return (
|
|
46
|
-
<>
|
|
47
|
-
{error && <Text variation="error">{error.message}</Text>}
|
|
48
|
-
<InputText
|
|
49
|
-
value={field.value}
|
|
50
|
-
placeholder="Should not exceed 5 characters"
|
|
51
|
-
onChangeText={field.onChange}
|
|
52
|
-
/>
|
|
53
|
-
</>
|
|
54
|
-
);
|
|
55
|
-
}}
|
|
56
|
-
</FormField>
|
|
57
|
-
</FormProvider>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
19
|
export const Basic: Story = {
|
|
62
|
-
render:
|
|
20
|
+
render: FormFieldBasic,
|
|
63
21
|
args: {
|
|
64
22
|
name: "name",
|
|
65
23
|
},
|
|
66
24
|
};
|
|
67
25
|
|
|
68
26
|
export const WithValidations: Story = {
|
|
69
|
-
render:
|
|
27
|
+
render: FormFieldWithValidations,
|
|
70
28
|
args: {
|
|
71
29
|
name: "validations",
|
|
72
30
|
},
|