@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.
Files changed (204) hide show
  1. package/dist/docs/Icon/Icon.md +1 -0
  2. package/dist/docs/InputDate/InputDate.md +1 -4
  3. package/dist/docs/InputPressable/InputPressable.md +1 -1
  4. package/dist/docs/Select/Select.md +22 -16
  5. package/dist/docs/usage-guidelines/usage-guidelines.md +9 -14
  6. package/dist/package.json +4 -4
  7. package/dist/tsconfig.build.json +8 -2
  8. package/dist/tsconfig.build.tsbuildinfo +1 -1
  9. package/dist/tsconfig.json +1 -0
  10. package/dist/types/src/ContentOverlay/BottomSheetKeyboardAwareScrollView.d.ts +1 -2
  11. package/package.json +4 -4
  12. package/src/ActionItem/ActionItem.stories.tsx +16 -95
  13. package/src/ActionItem/ActionItemGroup.stories.tsx +7 -84
  14. package/src/ActionItem/docs/ActionItemActionAlignmentExample.tsx +23 -0
  15. package/src/ActionItem/docs/ActionItemBasicExample.tsx +12 -0
  16. package/src/ActionItem/docs/ActionItemGroupBasicExample.tsx +39 -0
  17. package/src/ActionItem/docs/ActionItemGroupMixedComponentsExample.tsx +52 -0
  18. package/src/ActionItem/docs/ActionItemInACardExample.tsx +27 -0
  19. package/src/ActionItem/docs/ActionItemInteractiveChildrenExample.tsx +30 -0
  20. package/src/ActionItem/docs/ActionItemMixedComponentsExample.tsx +36 -0
  21. package/src/ActionItem/docs/ActionItemNoActionExample.tsx +15 -0
  22. package/src/ActionItem/docs/ActionItemTitleOnlyExample.tsx +18 -0
  23. package/src/ActionItem/docs/index.ts +9 -0
  24. package/src/ActionLabel/ActionLabel.stories.tsx +10 -11
  25. package/src/ActionLabel/docs/ActionLabelBasicExample.tsx +15 -0
  26. package/src/ActionLabel/docs/ActionLabelColorExample.tsx +15 -0
  27. package/src/ActionLabel/docs/ActionLabelDarkBackgroundExample.tsx +25 -0
  28. package/src/ActionLabel/docs/ActionLabelDisabledExample.tsx +15 -0
  29. package/src/ActionLabel/docs/index.ts +4 -0
  30. package/src/ActivityIndicator/ActivityIndicator.stories.tsx +3 -18
  31. package/src/ActivityIndicator/docs/ActivityIndicatorBasicExample.tsx +22 -0
  32. package/src/ActivityIndicator/docs/index.ts +1 -0
  33. package/src/AtlantisThemeContext/AtlantisThemeContext.stories.tsx +7 -70
  34. package/src/AtlantisThemeContext/docs/AtlantisThemeContextBasicExample.tsx +41 -0
  35. package/src/AtlantisThemeContext/docs/AtlantisThemeContextForceThemeForProviderExample.tsx +56 -0
  36. package/src/AtlantisThemeContext/docs/index.ts +2 -0
  37. package/src/AutoLink/AutoLink.stories.tsx +3 -0
  38. package/src/AutoLink/docs/AutoLinkBasicExample.tsx +14 -0
  39. package/src/AutoLink/docs/AutoLinkSkipPhoneNumberExample.tsx +14 -0
  40. package/src/AutoLink/docs/index.ts +2 -0
  41. package/src/Banner/Banner.stories.tsx +11 -45
  42. package/src/Banner/docs/BannerActionsInBannersExample.tsx +18 -0
  43. package/src/Banner/docs/BannerBasicExample.tsx +21 -0
  44. package/src/Banner/docs/BannerErrorDetailsExample.tsx +19 -0
  45. package/src/Banner/docs/BannerErrorExample.tsx +13 -0
  46. package/src/Banner/docs/index.ts +4 -0
  47. package/src/BottomSheet/BottomSheet.stories.tsx +6 -111
  48. package/src/BottomSheet/docs/BottomSheetBasicExample.tsx +63 -0
  49. package/src/BottomSheet/docs/BottomSheetHeaderFooterExample.tsx +65 -0
  50. package/src/BottomSheet/docs/index.ts +2 -0
  51. package/src/Button/Button.stories.tsx +3 -5
  52. package/src/Button/docs/ButtonBasicExample.tsx +14 -0
  53. package/src/Button/docs/ButtonCancelExample.tsx +15 -0
  54. package/src/Button/docs/index.ts +2 -0
  55. package/src/ButtonGroup/ButtonGroup.stories.tsx +9 -64
  56. package/src/ButtonGroup/docs/ButtonGroupBasicExample.tsx +34 -0
  57. package/src/ButtonGroup/docs/ButtonGroupPrimaryExample.tsx +37 -0
  58. package/src/ButtonGroup/docs/ButtonGroupSecondaryExample.tsx +35 -0
  59. package/src/ButtonGroup/docs/index.ts +3 -0
  60. package/src/Card/Card.stories.tsx +9 -43
  61. package/src/Card/docs/CardBasicExample.tsx +20 -0
  62. package/src/Card/docs/CardElevationExample.tsx +30 -0
  63. package/src/Card/docs/CardPressableExample.tsx +34 -0
  64. package/src/Card/docs/index.ts +3 -0
  65. package/src/Checkbox/Checkbox.stories.tsx +16 -56
  66. package/src/Checkbox/docs/CheckboxBasicExample.tsx +9 -0
  67. package/src/Checkbox/docs/CheckboxControlledExample.tsx +18 -0
  68. package/src/Checkbox/docs/CheckboxGroupBasicExample.tsx +15 -0
  69. package/src/Checkbox/docs/CheckboxGroupControlledExample.tsx +32 -0
  70. package/src/Checkbox/docs/CheckboxGroupLabelledExample.tsx +15 -0
  71. package/src/Checkbox/docs/index.ts +5 -0
  72. package/src/Chip/Chip.stories.tsx +11 -62
  73. package/src/Chip/docs/ChipAccentExample.tsx +62 -0
  74. package/src/Chip/docs/ChipBasicExample.tsx +19 -0
  75. package/src/Chip/docs/ChipDismissableExample.tsx +23 -0
  76. package/src/Chip/docs/ChipInactiveBackgroundColorExample.tsx +23 -0
  77. package/src/Chip/docs/index.ts +4 -0
  78. package/src/Content/Content.stories.tsx +4 -19
  79. package/src/Content/docs/ContentHorizontal.tsx +22 -0
  80. package/src/Content/docs/ContentVertical.tsx +22 -0
  81. package/src/Content/docs/index.ts +2 -0
  82. package/src/ContentOverlay/ContentOverlay.stories.tsx +6 -52
  83. package/src/ContentOverlay/docs/ContentOverlayBasic.tsx +54 -0
  84. package/src/ContentOverlay/docs/index.ts +1 -0
  85. package/src/Disclosure/Disclosure.stories.tsx +4 -20
  86. package/src/Disclosure/docs/DisclosureBasic.tsx +23 -0
  87. package/src/Disclosure/docs/index.ts +1 -0
  88. package/src/Divider/Divider.stories.tsx +6 -50
  89. package/src/Divider/docs/DividerHorizontal.tsx +21 -0
  90. package/src/Divider/docs/DividerVertical.tsx +39 -0
  91. package/src/Divider/docs/index.ts +2 -0
  92. package/src/EmptyState/EmptyState.stories.tsx +2 -0
  93. package/src/EmptyState/docs/EmptyStateBasic.tsx +27 -0
  94. package/src/EmptyState/docs/index.ts +1 -0
  95. package/src/Flex/Flex.stories.tsx +6 -57
  96. package/src/Flex/docs/FlexMultiRow.tsx +25 -0
  97. package/src/Flex/docs/FlexNested.tsx +22 -0
  98. package/src/Flex/docs/index.ts +2 -0
  99. package/src/Form/Form.stories.tsx +6 -50
  100. package/src/Form/docs/FormBasic.tsx +63 -0
  101. package/src/Form/docs/index.ts +1 -0
  102. package/src/FormField/FormField.stories.tsx +4 -46
  103. package/src/FormField/docs/FormFieldBasic.tsx +15 -0
  104. package/src/FormField/docs/FormFieldWithValidations.tsx +38 -0
  105. package/src/FormField/docs/index.ts +2 -0
  106. package/src/FormatFile/FormatFile.stories.tsx +8 -36
  107. package/src/FormatFile/docs/FormatFileBasic.tsx +25 -0
  108. package/src/FormatFile/docs/index.ts +1 -0
  109. package/src/Glimmer/Glimmer.stories.tsx +6 -31
  110. package/src/Glimmer/docs/GlimmerBasic.tsx +9 -0
  111. package/src/Glimmer/docs/GlimmerInDepth.tsx +32 -0
  112. package/src/Glimmer/docs/index.ts +2 -0
  113. package/src/Heading/Heading.stories.tsx +5 -18
  114. package/src/Heading/docs/HeadingLevels.tsx +21 -0
  115. package/src/Heading/docs/index.ts +1 -0
  116. package/src/Icon/Icon.stories.tsx +4 -7
  117. package/src/Icon/docs/IconBasic.tsx +7 -0
  118. package/src/Icon/docs/index.ts +1 -0
  119. package/src/IconButton/IconButton.stories.tsx +2 -0
  120. package/src/IconButton/docs/IconButtonBasic.tsx +17 -0
  121. package/src/IconButton/docs/index.ts +1 -0
  122. package/src/InputCurrency/InputCurrency.stories.tsx +2 -0
  123. package/src/InputCurrency/docs/InputCurrencyBasic.tsx +9 -0
  124. package/src/InputCurrency/docs/index.ts +1 -0
  125. package/src/InputDate/InputDate.stories.tsx +10 -11
  126. package/src/InputDate/docs/InputDateBasic.tsx +9 -0
  127. package/src/InputDate/docs/InputDateEmptyValueLabel.tsx +17 -0
  128. package/src/InputDate/docs/InputDateInvalid.tsx +17 -0
  129. package/src/InputDate/docs/index.ts +3 -0
  130. package/src/InputEmail/InputEmail.stories.tsx +4 -7
  131. package/src/InputEmail/docs/InputEmailBasic.tsx +9 -0
  132. package/src/InputEmail/docs/index.ts +1 -0
  133. package/src/InputFieldWrapper/InputFieldWrapper.stories.tsx +15 -23
  134. package/src/InputFieldWrapper/docs/InputFieldWrapperBasic.tsx +15 -0
  135. package/src/InputFieldWrapper/docs/InputFieldWrapperClearable.tsx +24 -0
  136. package/src/InputFieldWrapper/docs/InputFieldWrapperDisabled.tsx +18 -0
  137. package/src/InputFieldWrapper/docs/InputFieldWrapperInvalid.tsx +18 -0
  138. package/src/InputFieldWrapper/docs/InputFieldWrapperPrefixAndSuffix.tsx +18 -0
  139. package/src/InputFieldWrapper/docs/index.ts +5 -0
  140. package/src/InputNumber/InputNumber.stories.tsx +5 -6
  141. package/src/InputNumber/docs/InputNumberBasic.tsx +7 -0
  142. package/src/InputNumber/docs/InputNumberInvalid.tsx +15 -0
  143. package/src/InputNumber/docs/index.ts +2 -0
  144. package/src/InputPassword/InputPassword.stories.tsx +4 -5
  145. package/src/InputPassword/docs/InputPasswordBasic.tsx +9 -0
  146. package/src/InputPassword/docs/index.ts +1 -0
  147. package/src/InputPressable/InputPressable.stories.tsx +14 -20
  148. package/src/InputPressable/docs/InputPressableBasic.tsx +17 -0
  149. package/src/InputPressable/docs/InputPressableClearable.tsx +23 -0
  150. package/src/InputPressable/docs/InputPressableClickableSuffix.tsx +14 -0
  151. package/src/InputPressable/docs/InputPressableDisabled.tsx +16 -0
  152. package/src/InputPressable/docs/InputPressableInvalid.tsx +16 -0
  153. package/src/InputPressable/docs/InputPressablePrefixOrSuffix.tsx +20 -0
  154. package/src/InputPressable/docs/index.ts +6 -0
  155. package/src/InputSearch/InputSearch.stories.tsx +4 -18
  156. package/src/InputSearch/docs/InputSearchBasic.tsx +20 -0
  157. package/src/InputSearch/docs/index.ts +1 -0
  158. package/src/InputText/InputText.stories.tsx +7 -29
  159. package/src/InputText/docs/InputTextBasic.tsx +7 -0
  160. package/src/InputText/docs/InputTextInvalid.tsx +14 -0
  161. package/src/InputText/docs/InputTextToolbar.tsx +31 -0
  162. package/src/InputText/docs/index.ts +3 -0
  163. package/src/InputTime/InputTime.stories.tsx +10 -72
  164. package/src/InputTime/docs/InputTimeBasic.tsx +29 -0
  165. package/src/InputTime/docs/InputTimeEmptyValue.tsx +27 -0
  166. package/src/InputTime/docs/InputTimeFormControlled.tsx +46 -0
  167. package/src/InputTime/docs/index.ts +3 -0
  168. package/src/ProgressBar/ProgressBar.stories.tsx +6 -46
  169. package/src/ProgressBar/docs/ProgressBarBasic.tsx +22 -0
  170. package/src/ProgressBar/docs/ProgressBarWithHeader.tsx +45 -0
  171. package/src/ProgressBar/docs/index.ts +2 -0
  172. package/src/Select/Select.stories.tsx +6 -18
  173. package/src/Select/docs/SelectBasic.tsx +14 -0
  174. package/src/Select/docs/SelectInitialValue.tsx +18 -0
  175. package/src/Select/docs/index.ts +2 -0
  176. package/src/StatusLabel/StatusLabel.stories.tsx +2 -0
  177. package/src/StatusLabel/docs/StatusLabelBasic.tsx +9 -0
  178. package/src/StatusLabel/docs/index.ts +1 -0
  179. package/src/Switch/Switch.stories.tsx +6 -18
  180. package/src/Switch/docs/SwitchBasic.tsx +9 -0
  181. package/src/Switch/docs/SwitchControlled.tsx +21 -0
  182. package/src/Switch/docs/index.ts +2 -0
  183. package/src/Text/Text.stories.tsx +14 -33
  184. package/src/Text/docs/TextBasic.tsx +17 -0
  185. package/src/Text/docs/TextMultiLevelNesting.tsx +14 -0
  186. package/src/Text/docs/TextNestedBold.tsx +10 -0
  187. package/src/Text/docs/TextNestedMixedStyles.tsx +11 -0
  188. package/src/Text/docs/index.ts +4 -0
  189. package/src/TextList/TextList.stories.tsx +12 -0
  190. package/src/TextList/docs/TextListBasic.tsx +9 -0
  191. package/src/TextList/docs/TextListChildSpacing.tsx +19 -0
  192. package/src/TextList/docs/TextListEmphasis.tsx +19 -0
  193. package/src/TextList/docs/TextListLevels.tsx +19 -0
  194. package/src/TextList/docs/TextListSpacing.tsx +19 -0
  195. package/src/TextList/docs/index.ts +5 -0
  196. package/src/ThumbnailList/ThumbnailList.stories.tsx +3 -61
  197. package/src/ThumbnailList/docs/ThumbnailListBasic.tsx +62 -0
  198. package/src/ThumbnailList/docs/index.ts +1 -0
  199. package/src/Toast/Toast.stories.tsx +10 -21
  200. package/src/Toast/docs/ToastBasic.tsx +23 -0
  201. package/src/Toast/docs/index.ts +1 -0
  202. package/src/Typography/Typography.stories.tsx +5 -11
  203. package/src/Typography/docs/TypographyBasic.tsx +9 -0
  204. package/src/Typography/docs/index.ts +1 -0
@@ -1,13 +1,10 @@
1
- import React, { useState } from "react";
2
1
  import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
3
- import { SafeAreaProvider } from "react-native-safe-area-context";
4
- import { action } from "storybook/actions";
2
+ import { InputTime } from "@jobber/components-native";
5
3
  import {
6
- AtlantisOverlayProvider,
7
- Content,
8
- Form,
9
- InputTime,
10
- } from "@jobber/components-native";
4
+ InputTimeBasic,
5
+ InputTimeEmptyValue,
6
+ InputTimeFormControlled,
7
+ } from "./docs";
11
8
 
12
9
  const meta = {
13
10
  title: "Components/Forms and Inputs/InputTime",
@@ -34,74 +31,15 @@ interface NativeInputTimeFormStoryArgs {
34
31
  type ControlledStory = StoryObj<NativeInputTimeControlledStoryArgs>;
35
32
  type FormStory = StoryObj<NativeInputTimeFormStoryArgs>;
36
33
 
37
- const BasicTemplate = (args: ControlledStory["args"]) => {
38
- const [time, setTime] = useState<Date | undefined>(
39
- new Date("2023-07-21T16:36:34.873Z"),
40
- );
41
-
42
- return (
43
- <InputTime
44
- placeholder={args?.placeholder}
45
- disabled={args?.disabled}
46
- invalid={args?.invalid}
47
- emptyValueLabel={args?.emptyValueLabel}
48
- value={time}
49
- onChange={newTime => setTime(newTime)}
50
- />
51
- );
52
- };
53
-
54
- const EmptyValueTemplate = (args: ControlledStory["args"]) => {
55
- const [time, setTime] = useState<Date | undefined>(undefined);
56
-
57
- return (
58
- <InputTime
59
- placeholder={args?.placeholder}
60
- disabled={args?.disabled}
61
- invalid={args?.invalid}
62
- emptyValueLabel={args?.emptyValueLabel}
63
- value={time}
64
- onChange={newTime => setTime(newTime)}
65
- />
66
- );
67
- };
68
-
69
- const FormControlledTemplate = (args: FormStory["args"]) => (
70
- <SafeAreaProvider>
71
- <AtlantisOverlayProvider>
72
- <Form
73
- initialValues={{ startTime: new Date("2023-07-21T16:36:34.873Z") }}
74
- onSubmit={value =>
75
- new Promise(resolve => {
76
- setTimeout(
77
- () => resolve(action("alert")(JSON.stringify(value, undefined))),
78
- 1000,
79
- );
80
- })
81
- }
82
- onSubmitError={() => undefined}
83
- onSubmitSuccess={() => undefined}
84
- >
85
- <Content>
86
- <InputTime
87
- name={args?.name ?? "startTime"}
88
- placeholder={args?.placeholder}
89
- />
90
- </Content>
91
- </Form>
92
- </AtlantisOverlayProvider>
93
- </SafeAreaProvider>
94
- );
95
-
96
34
  export const Basic: ControlledStory = {
97
- render: BasicTemplate,
35
+ render: InputTimeBasic,
98
36
  args: {
99
37
  placeholder: "Start time",
100
38
  },
101
39
  };
102
40
 
103
41
  export const Disabled: ControlledStory = {
104
- render: BasicTemplate,
42
+ render: InputTimeBasic,
105
43
  args: {
106
44
  placeholder: "Start time",
107
45
  disabled: true,
@@ -109,7 +47,7 @@ export const Disabled: ControlledStory = {
109
47
  };
110
48
 
111
49
  export const Invalid: ControlledStory = {
112
- render: BasicTemplate,
50
+ render: InputTimeBasic,
113
51
  args: {
114
52
  placeholder: "Start time",
115
53
  invalid: "Start time is required",
@@ -117,7 +55,7 @@ export const Invalid: ControlledStory = {
117
55
  };
118
56
 
119
57
  export const FormControlled: FormStory = {
120
- render: FormControlledTemplate,
58
+ render: InputTimeFormControlled,
121
59
  args: {
122
60
  name: "startTime",
123
61
  placeholder: "Created time",
@@ -125,7 +63,7 @@ export const FormControlled: FormStory = {
125
63
  };
126
64
 
127
65
  export const EmptyValue: ControlledStory = {
128
- render: EmptyValueTemplate,
66
+ render: InputTimeEmptyValue,
129
67
  args: {
130
68
  placeholder: "Start time",
131
69
  emptyValueLabel: "Unscheduled",
@@ -0,0 +1,29 @@
1
+ import React, { useState } from "react";
2
+ import type { ComponentProps } from "react";
3
+ import { InputTime } from "@jobber/components-native";
4
+
5
+ type InputTimeProps = ComponentProps<typeof InputTime>;
6
+
7
+ interface InputTimeControlledArgs {
8
+ placeholder?: InputTimeProps["placeholder"];
9
+ disabled?: InputTimeProps["disabled"];
10
+ invalid?: InputTimeProps["invalid"];
11
+ emptyValueLabel?: InputTimeProps["emptyValueLabel"];
12
+ }
13
+
14
+ export function InputTimeBasic(props: Partial<InputTimeControlledArgs>) {
15
+ const [time, setTime] = useState<Date | undefined>(
16
+ new Date("2023-07-21T16:36:34.873Z"),
17
+ );
18
+
19
+ return (
20
+ <InputTime
21
+ placeholder={props.placeholder}
22
+ disabled={props.disabled}
23
+ invalid={props.invalid}
24
+ emptyValueLabel={props.emptyValueLabel}
25
+ value={time}
26
+ onChange={newTime => setTime(newTime)}
27
+ />
28
+ );
29
+ }
@@ -0,0 +1,27 @@
1
+ import React, { useState } from "react";
2
+ import type { ComponentProps } from "react";
3
+ import { InputTime } from "@jobber/components-native";
4
+
5
+ type InputTimeProps = ComponentProps<typeof InputTime>;
6
+
7
+ interface InputTimeControlledArgs {
8
+ placeholder?: InputTimeProps["placeholder"];
9
+ disabled?: InputTimeProps["disabled"];
10
+ invalid?: InputTimeProps["invalid"];
11
+ emptyValueLabel?: InputTimeProps["emptyValueLabel"];
12
+ }
13
+
14
+ export function InputTimeEmptyValue(props: Partial<InputTimeControlledArgs>) {
15
+ const [time, setTime] = useState<Date | undefined>(undefined);
16
+
17
+ return (
18
+ <InputTime
19
+ placeholder={props.placeholder}
20
+ disabled={props.disabled}
21
+ invalid={props.invalid}
22
+ emptyValueLabel={props.emptyValueLabel}
23
+ value={time}
24
+ onChange={newTime => setTime(newTime)}
25
+ />
26
+ );
27
+ }
@@ -0,0 +1,46 @@
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
+ InputTime,
9
+ } from "@jobber/components-native";
10
+
11
+ interface InputTimeFormStoryArgs {
12
+ name?: string;
13
+ placeholder?: string;
14
+ }
15
+
16
+ export function InputTimeFormControlled(
17
+ props: Partial<InputTimeFormStoryArgs>,
18
+ ) {
19
+ return (
20
+ <SafeAreaProvider>
21
+ <AtlantisOverlayProvider>
22
+ <Form
23
+ initialValues={{ startTime: new Date("2023-07-21T16:36:34.873Z") }}
24
+ onSubmit={value =>
25
+ new Promise(resolve => {
26
+ setTimeout(
27
+ () =>
28
+ resolve(action("alert")(JSON.stringify(value, undefined))),
29
+ 1000,
30
+ );
31
+ })
32
+ }
33
+ onSubmitError={() => undefined}
34
+ onSubmitSuccess={() => undefined}
35
+ >
36
+ <Content>
37
+ <InputTime
38
+ name={props.name ?? "startTime"}
39
+ placeholder={props.placeholder}
40
+ />
41
+ </Content>
42
+ </Form>
43
+ </AtlantisOverlayProvider>
44
+ </SafeAreaProvider>
45
+ );
46
+ }
@@ -0,0 +1,3 @@
1
+ export { InputTimeBasic } from "./InputTimeBasic";
2
+ export { InputTimeFormControlled } from "./InputTimeFormControlled";
3
+ export { InputTimeEmptyValue } from "./InputTimeEmptyValue";
@@ -1,15 +1,11 @@
1
- import React, { useState } from "react";
1
+ import type { ComponentProps } from "react";
2
2
  import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
3
- import {
4
- Button,
5
- Content,
6
- Heading,
7
- ProgressBar,
8
- } from "@jobber/components-native";
3
+ import { ProgressBar } from "@jobber/components-native";
4
+ import { ProgressBarBasic, ProgressBarWithHeader } from "./docs";
9
5
 
10
6
  type ProgressBarStoryArgs = Partial<
11
7
  Pick<
12
- React.ComponentProps<typeof ProgressBar>,
8
+ ComponentProps<typeof ProgressBar>,
13
9
  "current" | "total" | "inProgress" | "variation" | "size"
14
10
  >
15
11
  >;
@@ -28,15 +24,7 @@ export default meta;
28
24
  type Story = StoryObj<ProgressBarStoryArgs>;
29
25
 
30
26
  export const Basic: Story = {
31
- render: args => (
32
- <ProgressBar
33
- current={args?.current ?? 1}
34
- inProgress={args?.inProgress}
35
- size={args?.size}
36
- total={args?.total ?? 5}
37
- variation={args?.variation}
38
- />
39
- ),
27
+ render: ProgressBarBasic,
40
28
  args: {
41
29
  total: 5,
42
30
  current: 1,
@@ -45,35 +33,7 @@ export const Basic: Story = {
45
33
  };
46
34
 
47
35
  export const WithHeader: Story = {
48
- render: args => {
49
- const [step, setStep] = useState(1);
50
- const totalSteps = 6;
51
-
52
- return (
53
- <ProgressBar
54
- current={step}
55
- inProgress={args?.inProgress}
56
- size={args?.size}
57
- total={totalSteps}
58
- variation={args?.variation}
59
- header={
60
- <>
61
- <Content>
62
- <Heading level="heading">Upload progress</Heading>
63
- </Content>
64
- <Button
65
- label="Step Back"
66
- onPress={() => setStep(Math.max(0, step - 1))}
67
- />
68
- <Button
69
- label="Step Forward"
70
- onPress={() => setStep(Math.min(totalSteps, step + 1))}
71
- />
72
- </>
73
- }
74
- />
75
- );
76
- },
36
+ render: ProgressBarWithHeader,
77
37
  args: {
78
38
  total: 6,
79
39
  current: 1,
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import { ProgressBar } from "@jobber/components-native";
3
+ import type { ProgressBarProps } from "@jobber/components-native";
4
+
5
+ type ProgressBarStoryArgs = Partial<
6
+ Pick<
7
+ ProgressBarProps,
8
+ "current" | "total" | "inProgress" | "variation" | "size"
9
+ >
10
+ >;
11
+
12
+ export function ProgressBarBasic(props: ProgressBarStoryArgs) {
13
+ return (
14
+ <ProgressBar
15
+ current={props.current ?? 1}
16
+ inProgress={props.inProgress}
17
+ size={props.size}
18
+ total={props.total ?? 5}
19
+ variation={props.variation}
20
+ />
21
+ );
22
+ }
@@ -0,0 +1,45 @@
1
+ import React, { useState } from "react";
2
+ import {
3
+ Button,
4
+ Content,
5
+ Heading,
6
+ ProgressBar,
7
+ } from "@jobber/components-native";
8
+ import type { ProgressBarProps } from "@jobber/components-native";
9
+
10
+ type ProgressBarStoryArgs = Partial<
11
+ Pick<
12
+ ProgressBarProps,
13
+ "current" | "total" | "inProgress" | "variation" | "size"
14
+ >
15
+ >;
16
+
17
+ export function ProgressBarWithHeader(props: ProgressBarStoryArgs) {
18
+ const [step, setStep] = useState(1);
19
+ const totalSteps = 6;
20
+
21
+ return (
22
+ <ProgressBar
23
+ current={step}
24
+ inProgress={props.inProgress}
25
+ size={props.size}
26
+ total={totalSteps}
27
+ variation={props.variation}
28
+ header={
29
+ <>
30
+ <Content>
31
+ <Heading level="heading">Upload progress</Heading>
32
+ </Content>
33
+ <Button
34
+ label="Step Back"
35
+ onPress={() => setStep(Math.max(0, step - 1))}
36
+ />
37
+ <Button
38
+ label="Step Forward"
39
+ onPress={() => setStep(Math.min(totalSteps, step + 1))}
40
+ />
41
+ </>
42
+ }
43
+ />
44
+ );
45
+ }
@@ -0,0 +1,2 @@
1
+ export { ProgressBarBasic } from "./ProgressBarBasic";
2
+ export { ProgressBarWithHeader } from "./ProgressBarWithHeader";
@@ -1,9 +1,10 @@
1
- import React from "react";
1
+ import type { ComponentProps } from "react";
2
2
  import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
3
- import { Option, Select } from "@jobber/components-native";
3
+ import { Select } from "@jobber/components-native";
4
+ import { SelectBasic, SelectInitialValue } from "./docs";
4
5
 
5
6
  type SelectStoryArgs = Pick<
6
- React.ComponentProps<typeof Select>,
7
+ ComponentProps<typeof Select>,
7
8
  "label" | "defaultValue"
8
9
  >;
9
10
 
@@ -21,27 +22,14 @@ export default meta;
21
22
  type Story = StoryObj<SelectStoryArgs>;
22
23
 
23
24
  export const Basic: Story = {
24
- render: args => (
25
- <Select label={args?.label ?? "Favorite number"}>
26
- <Option value="1">1</Option>
27
- <Option value="2">2</Option>
28
- </Select>
29
- ),
25
+ render: SelectBasic,
30
26
  args: {
31
27
  label: "Favorite number",
32
28
  },
33
29
  };
34
30
 
35
31
  export const InitialValue: Story = {
36
- render: args => (
37
- <Select
38
- label={args?.label ?? "Favorite number"}
39
- defaultValue={args?.defaultValue ?? "2"}
40
- >
41
- <Option value="1">1</Option>
42
- <Option value="2">2</Option>
43
- </Select>
44
- ),
32
+ render: SelectInitialValue,
45
33
  args: {
46
34
  label: "Favorite number",
47
35
  defaultValue: "2",
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { Option, Select } from "@jobber/components-native";
3
+ import type { SelectProps } from "@jobber/components-native";
4
+
5
+ type SelectStoryArgs = Pick<SelectProps, "label" | "defaultValue">;
6
+
7
+ export function SelectBasic(props: Partial<SelectStoryArgs>) {
8
+ return (
9
+ <Select label={props.label ?? "Favorite number"} {...props}>
10
+ <Option value="1">1</Option>
11
+ <Option value="2">2</Option>
12
+ </Select>
13
+ );
14
+ }
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { Option, Select } from "@jobber/components-native";
3
+ import type { SelectProps } from "@jobber/components-native";
4
+
5
+ type SelectStoryArgs = Pick<SelectProps, "label" | "defaultValue">;
6
+
7
+ export function SelectInitialValue(props: Partial<SelectStoryArgs>) {
8
+ return (
9
+ <Select
10
+ label={props.label ?? "Favorite number"}
11
+ defaultValue={props.defaultValue ?? "2"}
12
+ {...props}
13
+ >
14
+ <Option value="1">1</Option>
15
+ <Option value="2">2</Option>
16
+ </Select>
17
+ );
18
+ }
@@ -0,0 +1,2 @@
1
+ export { SelectBasic } from "./SelectBasic";
2
+ export { SelectInitialValue } from "./SelectInitialValue";
@@ -1,5 +1,6 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
2
2
  import { StatusLabel } from "@jobber/components-native";
3
+ import { StatusLabelBasic } from "./docs";
3
4
 
4
5
  const meta = {
5
6
  title: "Components/Status and Feedback/StatusLabel",
@@ -15,6 +16,7 @@ export default meta;
15
16
  type Story = StoryObj<typeof meta>;
16
17
 
17
18
  export const Basic: Story = {
19
+ render: StatusLabelBasic,
18
20
  args: {
19
21
  text: "Success",
20
22
  alignment: "start",
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import type { ComponentProps } from "react";
3
+ import { StatusLabel } from "@jobber/components-native";
4
+
5
+ type StatusLabelProps = ComponentProps<typeof StatusLabel>;
6
+
7
+ export function StatusLabelBasic(props: Partial<StatusLabelProps>) {
8
+ return <StatusLabel text="Success" alignment="start" {...props} />;
9
+ }
@@ -0,0 +1 @@
1
+ export { StatusLabelBasic } from "./StatusLabelBasic";
@@ -1,8 +1,9 @@
1
- import React, { useState } from "react";
1
+ import type { ComponentProps } from "react";
2
2
  import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
3
- import { Button, Content, Switch } from "@jobber/components-native";
3
+ import { Switch } from "@jobber/components-native";
4
+ import { SwitchBasic, SwitchControlled } from "./docs";
4
5
 
5
- type SwitchStoryArgs = Pick<React.ComponentProps<typeof Switch>, "label">;
6
+ type SwitchStoryArgs = Pick<ComponentProps<typeof Switch>, "label">;
6
7
 
7
8
  const meta = {
8
9
  title: "Components/Selections/Switch",
@@ -18,27 +19,14 @@ export default meta;
18
19
  type Story = StoryObj<SwitchStoryArgs>;
19
20
 
20
21
  export const Basic: Story = {
21
- render: args => <Switch label={args?.label ?? "Toggle example"} />,
22
+ render: SwitchBasic,
22
23
  args: {
23
24
  label: "Toggle example",
24
25
  },
25
26
  };
26
27
 
27
28
  export const Controlled: Story = {
28
- render: args => {
29
- const [value, setValue] = useState(false);
30
-
31
- return (
32
- <Content>
33
- <Button onPress={() => setValue(!value)} label="Toggle Switch" />
34
- <Switch
35
- label={args?.label ?? "Controlled Toggle example"}
36
- value={value}
37
- onValueChange={setValue}
38
- />
39
- </Content>
40
- );
41
- },
29
+ render: SwitchControlled,
42
30
  args: {
43
31
  label: "Controlled Toggle example",
44
32
  },
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { Switch } from "@jobber/components-native";
3
+ import type { SwitchProps } from "@jobber/components-native";
4
+
5
+ type SwitchStoryArgs = Pick<SwitchProps, "label">;
6
+
7
+ export function SwitchBasic(props: Partial<SwitchStoryArgs>) {
8
+ return <Switch label={props.label ?? "Toggle example"} {...props} />;
9
+ }
@@ -0,0 +1,21 @@
1
+ import React, { useState } from "react";
2
+ import { Button, Content, Switch } from "@jobber/components-native";
3
+ import type { SwitchProps } from "@jobber/components-native";
4
+
5
+ type SwitchStoryArgs = Pick<SwitchProps, "label">;
6
+
7
+ export function SwitchControlled(props: Partial<SwitchStoryArgs>) {
8
+ const [value, setValue] = useState(false);
9
+
10
+ return (
11
+ <Content>
12
+ <Button onPress={() => setValue(!value)} label="Toggle Switch" />
13
+ <Switch
14
+ label={props.label ?? "Controlled Toggle example"}
15
+ {...props}
16
+ value={value}
17
+ onValueChange={setValue}
18
+ />
19
+ </Content>
20
+ );
21
+ }
@@ -0,0 +1,2 @@
1
+ export { SwitchBasic } from "./SwitchBasic";
2
+ export { SwitchControlled } from "./SwitchControlled";
@@ -1,9 +1,15 @@
1
- import React from "react";
1
+ import type { ComponentProps } from "react";
2
2
  import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
3
3
  import { Text } from "@jobber/components-native";
4
+ import {
5
+ TextBasic,
6
+ TextMultiLevelNesting,
7
+ TextNestedBold,
8
+ TextNestedMixedStyles,
9
+ } from "./docs";
4
10
 
5
11
  type TextStoryArgs = Pick<
6
- React.ComponentProps<typeof Text>,
12
+ ComponentProps<typeof Text>,
7
13
  "children" | "level" | "reverseTheme"
8
14
  >;
9
15
 
@@ -20,16 +26,8 @@ export default meta;
20
26
 
21
27
  type Story = StoryObj<TextStoryArgs>;
22
28
 
23
- const BasicTemplate = (args: Story["args"]) => {
24
- return (
25
- <Text level={args?.level} reverseTheme={args?.reverseTheme}>
26
- {args?.children}
27
- </Text>
28
- );
29
- };
30
-
31
29
  export const Basic: Story = {
32
- render: BasicTemplate,
30
+ render: TextBasic,
33
31
  args: {
34
32
  children:
35
33
  '"640K is more memory than anyone will ever need on a computer" - Not Bill Gates',
@@ -37,7 +35,7 @@ export const Basic: Story = {
37
35
  };
38
36
 
39
37
  export const SupportingText: Story = {
40
- render: BasicTemplate,
38
+ render: TextBasic,
41
39
  args: {
42
40
  children:
43
41
  "Supporting Text should be used to supplement additional, more important content",
@@ -46,7 +44,7 @@ export const SupportingText: Story = {
46
44
  };
47
45
 
48
46
  export const ReverseTheme: Story = {
49
- render: BasicTemplate,
47
+ render: TextBasic,
50
48
  args: {
51
49
  children: "Changes Text color for display on a dark background",
52
50
  reverseTheme: true,
@@ -57,30 +55,13 @@ export const ReverseTheme: Story = {
57
55
  };
58
56
 
59
57
  export const NestedBold: Story = {
60
- render: () => (
61
- <Text>
62
- This is <Text emphasis="strong">bold</Text> inside a sentence.
63
- </Text>
64
- ),
58
+ render: TextNestedBold,
65
59
  };
66
60
 
67
61
  export const NestedMixedStyles: Story = {
68
- render: () => (
69
- <Text>
70
- Start, <Text italic>italic segment</Text>, and a
71
- <Text emphasis="strong"> bold segment</Text>.
72
- </Text>
73
- ),
62
+ render: TextNestedMixedStyles,
74
63
  };
75
64
 
76
65
  export const MultiLevelNesting: Story = {
77
- render: () => (
78
- <Text>
79
- Level 1{" "}
80
- <Text>
81
- contains <Text emphasis="strong">Level 2</Text>
82
- </Text>{" "}
83
- done.
84
- </Text>
85
- ),
66
+ render: TextMultiLevelNesting,
86
67
  };
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import type { ComponentProps } from "react";
3
+ import { Text } from "@jobber/components-native";
4
+
5
+ type TextStoryArgs = Pick<
6
+ ComponentProps<typeof Text>,
7
+ "children" | "level" | "reverseTheme"
8
+ >;
9
+
10
+ export function TextBasic(props: Partial<TextStoryArgs>) {
11
+ return (
12
+ <Text level={props.level} reverseTheme={props.reverseTheme}>
13
+ {props.children ??
14
+ '"640K is more memory than anyone will ever need on a computer" - Not Bill Gates'}
15
+ </Text>
16
+ );
17
+ }