@ornikar/kitt-universal 1.0.0 → 1.0.1

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 (139) hide show
  1. package/package.json +4 -4
  2. package/CHANGELOG.md +0 -8
  3. package/src/.eslintrc.json +0 -19
  4. package/src/Avatar/Avatar.stories.tsx +0 -45
  5. package/src/Avatar/Avatar.tsx +0 -60
  6. package/src/Avatar/__snapshots__/Avatar.stories.tsx.snap +0 -1229
  7. package/src/Button/Button.stories.tsx +0 -301
  8. package/src/Button/Button.tsx +0 -60
  9. package/src/Button/ButtonContainer.tsx +0 -32
  10. package/src/Button/ButtonContent.tsx +0 -133
  11. package/src/Button/__snapshots__/Button.stories.tsx.snap +0 -7483
  12. package/src/Button/useButton.ts +0 -14
  13. package/src/Card/Card.stories.tsx +0 -31
  14. package/src/Card/Card.tsx +0 -25
  15. package/src/Card/__snapshots__/Card.stories.tsx.snap +0 -306
  16. package/src/FullScreenModal/Body.tsx +0 -25
  17. package/src/FullScreenModal/FullScreenModal.stories.tsx +0 -63
  18. package/src/FullScreenModal/FullScreenModal.tsx +0 -21
  19. package/src/FullScreenModal/Header.tsx +0 -129
  20. package/src/FullScreenModal/__snapshots__/FullScreenModal.stories.tsx.snap +0 -771
  21. package/src/Icon/Icon.stories.tsx +0 -59
  22. package/src/Icon/Icon.tsx +0 -37
  23. package/src/Icon/SpinningIcon.tsx +0 -38
  24. package/src/Icon/SpinningIcon.web.module.css +0 -13
  25. package/src/Icon/SpinningIcon.web.module.css.d.ts +0 -6
  26. package/src/Icon/SpinningIcon.web.tsx +0 -11
  27. package/src/Icon/__snapshots__/Icon.stories.tsx.snap +0 -5648
  28. package/src/KittBreakpoints.ts +0 -44
  29. package/src/ListItem/ListItem.stories.tsx +0 -122
  30. package/src/ListItem/ListItem.tsx +0 -61
  31. package/src/ListItem/ListItemContent.tsx +0 -17
  32. package/src/ListItem/ListItemSideContent.tsx +0 -41
  33. package/src/ListItem/__snapshots__/ListItem.stories.tsx.snap +0 -1514
  34. package/src/Loader/LargeLoader.tsx +0 -12
  35. package/src/Loader/LargeLoader.web.module.css +0 -103
  36. package/src/Loader/LargeLoader.web.module.css.d.ts +0 -11
  37. package/src/Loader/LargeLoader.web.test.tsx +0 -10
  38. package/src/Loader/LargeLoader.web.tsx +0 -18
  39. package/src/Loader/Loader.stories.tsx +0 -47
  40. package/src/Loader/Loader.tsx +0 -21
  41. package/src/Loader/Loader.web.test.tsx +0 -20
  42. package/src/Loader/Loader.web.tsx +0 -14
  43. package/src/Loader/__snapshots__/LargeLoader.web.test.tsx.snap +0 -33
  44. package/src/Loader/__snapshots__/Loader.stories.tsx.snap +0 -607
  45. package/src/Loader/__snapshots__/Loader.web.test.tsx.snap +0 -103
  46. package/src/Message/Message.stories.tsx +0 -102
  47. package/src/Message/Message.tsx +0 -114
  48. package/src/Message/__snapshots__/Message.stories.tsx.snap +0 -2776
  49. package/src/Modal/Body.tsx +0 -20
  50. package/src/Modal/Footer.tsx +0 -18
  51. package/src/Modal/Header.tsx +0 -66
  52. package/src/Modal/Modal.stories.tsx +0 -181
  53. package/src/Modal/Modal.tsx +0 -66
  54. package/src/Modal/OnCloseContext.ts +0 -3
  55. package/src/Modal/__snapshots__/Modal.stories.tsx.snap +0 -2960
  56. package/src/Notification/Notification.stories.tsx +0 -102
  57. package/src/Notification/Notification.tsx +0 -21
  58. package/src/Notification/__snapshots__/Notification.stories.tsx.snap +0 -2861
  59. package/src/Overlay/Overlay.tsx +0 -22
  60. package/src/Tag/Tag.stories.tsx +0 -18
  61. package/src/Tag/Tag.tsx +0 -31
  62. package/src/Tag/__snapshots__/Tag.stories.tsx.snap +0 -303
  63. package/src/Tooltip/Tooltip.tsx +0 -17
  64. package/src/__mocks__/react-native-safe-area-context.tsx +0 -26
  65. package/src/forms/InputFeedback/InputFeedback.stories.tsx +0 -17
  66. package/src/forms/InputFeedback/InputFeedback.tsx +0 -28
  67. package/src/forms/InputFeedback/__snapshots__/InputFeedback.stories.tsx.snap +0 -252
  68. package/src/forms/InputField/InputField.stories.tsx +0 -19
  69. package/src/forms/InputField/InputField.tsx +0 -45
  70. package/src/forms/InputField/__snapshots__/InputField.stories.tsx.snap +0 -240
  71. package/src/forms/InputFormState.ts +0 -1
  72. package/src/forms/InputText/InputText.stories.tsx +0 -85
  73. package/src/forms/InputText/InputText.tsx +0 -172
  74. package/src/forms/InputText/__snapshots__/InputText.stories.tsx.snap +0 -4274
  75. package/src/forms/InputText/useInputText.ts +0 -19
  76. package/src/forms/Label/Label.stories.tsx +0 -14
  77. package/src/forms/Label/Label.tsx +0 -17
  78. package/src/forms/Label/__snapshots__/Label.stories.tsx.snap +0 -174
  79. package/src/forms/Radio/Radio.stories.tsx +0 -48
  80. package/src/forms/Radio/Radio.tsx +0 -81
  81. package/src/forms/Radio/__snapshots__/Radio.stories.tsx.snap +0 -967
  82. package/src/forms/TextArea/TextArea.stories.tsx +0 -72
  83. package/src/forms/TextArea/TextArea.tsx +0 -12
  84. package/src/forms/TextArea/__snapshots__/TextArea.stories.tsx.snap +0 -2091
  85. package/src/index.ts +0 -61
  86. package/src/stories/Block.tsx +0 -24
  87. package/src/stories/Flex.tsx +0 -16
  88. package/src/stories/color-tokens.stories.tsx +0 -143
  89. package/src/stories-list.ts +0 -22
  90. package/src/story-components/Section.tsx +0 -56
  91. package/src/story-components/Story.tsx +0 -24
  92. package/src/story-components/StoryDecorator.tsx +0 -8
  93. package/src/story-components/StoryGrid.tsx +0 -80
  94. package/src/story-components/StoryTitle.stories.tsx +0 -12
  95. package/src/story-components/StoryTitle.tsx +0 -69
  96. package/src/story-components/__snapshots__/StoryTitle.stories.tsx.snap +0 -155
  97. package/src/story-components/index.ts +0 -5
  98. package/src/themes/default.ts +0 -34
  99. package/src/themes/late-ocean/avatarLateOceanTheme.ts +0 -12
  100. package/src/themes/late-ocean/buttonLateOceanTheme.ts +0 -37
  101. package/src/themes/late-ocean/cardLateOceanTheme.ts +0 -19
  102. package/src/themes/late-ocean/colorsLateOceanTheme.ts +0 -19
  103. package/src/themes/late-ocean/feedbackMessageLateOceanTheme.ts +0 -10
  104. package/src/themes/late-ocean/formLateOceanTheme.ts +0 -9
  105. package/src/themes/late-ocean/fullScreenModalLateOceanTheme.ts +0 -9
  106. package/src/themes/late-ocean/inputFieldLateOceanTheme.ts +0 -4
  107. package/src/themes/late-ocean/inputLateOceanTheme.ts +0 -55
  108. package/src/themes/late-ocean/listItemLateOceanTheme.ts +0 -8
  109. package/src/themes/late-ocean/radioLateOceanTheme.ts +0 -19
  110. package/src/themes/late-ocean/shadowsLateOceanTheme.ts +0 -3
  111. package/src/themes/late-ocean/tagLateOceanTheme.ts +0 -17
  112. package/src/themes/late-ocean/typographyLateOceanTheme.ts +0 -94
  113. package/src/themes/palettes/lateOceanColorPalette.ts +0 -24
  114. package/src/typings/babel-config.d.ts +0 -6
  115. package/src/typings/metro.d.ts +0 -6
  116. package/src/typography/Typography.stories.tsx +0 -113
  117. package/src/typography/Typography.tsx +0 -165
  118. package/src/typography/TypographyIcon.stories.tsx +0 -31
  119. package/src/typography/TypographyIcon.tsx +0 -35
  120. package/src/typography/TypographyLink.stories.tsx +0 -88
  121. package/src/typography/TypographyLink.tsx +0 -48
  122. package/src/typography/__snapshots__/Typography.stories.tsx.snap +0 -6118
  123. package/src/typography/__snapshots__/TypographyIcon.stories.tsx.snap +0 -334
  124. package/src/typography/__snapshots__/TypographyLink.stories.tsx.snap +0 -10945
  125. package/src/useKittTheme.tsx +0 -12
  126. package/src/utils/storybook/decorators/KittThemeDecorator.tsx +0 -27
  127. package/src/utils/storybook/decorators/SafeAreaProviderDecorator.tsx +0 -11
  128. package/src/utils/storybook/setup-global-decorators.ts +0 -6
  129. package/src/utils/tests/renderWithProvidersUtils.tsx +0 -17
  130. package/src/utils/typeUtils.ts +0 -6
  131. package/src/utils/windowSize/MatchWindowSize.tsx +0 -14
  132. package/src/utils/windowSize/__snapshots__/windowSize.stories.tsx.snap +0 -1485
  133. package/src/utils/windowSize/createWindowSizeHelper.test.ts +0 -11
  134. package/src/utils/windowSize/createWindowSizeHelper.ts +0 -65
  135. package/src/utils/windowSize/useMatchWindowSize.ts +0 -14
  136. package/src/utils/windowSize/useWindowSize.ts +0 -1
  137. package/src/utils/windowSize/windowSize.stories.tsx +0 -115
  138. package/tsconfig.build.json +0 -33
  139. package/tsconfig.json +0 -13
package/src/index.ts DELETED
@@ -1,61 +0,0 @@
1
- export type { AvatarProps } from './Avatar/Avatar';
2
- export { Avatar } from './Avatar/Avatar';
3
- export type { ButtonProps } from './Button/Button';
4
- export { Button } from './Button/Button';
5
- export type { CardProps } from './Card/Card';
6
- export { Card } from './Card/Card';
7
- export type { InputFeedbackProps } from './forms/InputFeedback/InputFeedback';
8
- export { InputFeedback } from './forms/InputFeedback/InputFeedback';
9
- export type { InputFieldProps } from './forms/InputField/InputField';
10
- export { InputField } from './forms/InputField/InputField';
11
- export type { InputTextProps, InputTextState, TextInputMixinProps } from './forms/InputText/InputText';
12
- export { InputText, styledTextInputMixin } from './forms/InputText/InputText';
13
- export type { LabelProps } from './forms/Label/Label';
14
- export { Label } from './forms/Label/Label';
15
- export type { RadioProps } from './forms/Radio/Radio';
16
- export { Radio } from './forms/Radio/Radio';
17
- export type { TextAreaProps } from './forms/TextArea/TextArea';
18
- export { TextArea } from './forms/TextArea/TextArea';
19
- export type { FullScreenModalProps } from './FullScreenModal/FullScreenModal';
20
- export { FullScreenModal } from './FullScreenModal/FullScreenModal';
21
- export type { IconProps } from './Icon/Icon';
22
- export { Icon } from './Icon/Icon';
23
- export type { KittBreakpoint, KittBreakpointMax } from './KittBreakpoints';
24
- export { KittBreakpoints, KittBreakpointsMax } from './KittBreakpoints';
25
- export type { ListItemProps } from './ListItem/ListItem';
26
- export { ListItem } from './ListItem/ListItem';
27
- export type { LargeLoaderProps } from './Loader/LargeLoader';
28
- export { LargeLoader } from './Loader/LargeLoader';
29
- export type { LoaderProps } from './Loader/Loader';
30
- export { Loader } from './Loader/Loader';
31
- export type { MessageProps } from './Message/Message';
32
- export { Message } from './Message/Message';
33
- export type { ModalProps } from './Modal/Modal';
34
- export { Modal } from './Modal/Modal';
35
- export type { NotificationProps } from './Notification/Notification';
36
- export { Notification } from './Notification/Notification';
37
- export { Section, Story, StoryDecorator, StoryGrid, StoryTitle } from './story-components';
38
- export type { TagProps } from './Tag/Tag';
39
- export { Tag } from './Tag/Tag';
40
- export type { KittTheme } from './themes/default';
41
- export { theme } from './themes/default';
42
- export type { TooltipProps } from './Tooltip/Tooltip';
43
- export { Tooltip } from './Tooltip/Tooltip';
44
- export type {
45
- TypographyColor,
46
- TypographyHeadingProps,
47
- TypographyProps,
48
- TypographyTextProps,
49
- } from './typography/Typography';
50
- export { Typography } from './typography/Typography';
51
- export type { TypographyIconProps } from './typography/TypographyIcon';
52
- export { TypographyIcon } from './typography/TypographyIcon';
53
- export type { TypographyLinkProps } from './typography/TypographyLink';
54
- export { TypographyLink } from './typography/TypographyLink';
55
- export { useKittTheme } from './useKittTheme';
56
- export type { WindowSizeHelper } from './utils/windowSize/createWindowSizeHelper';
57
- export { createWindowSizeHelper } from './utils/windowSize/createWindowSizeHelper';
58
- export { MatchWindowSize } from './utils/windowSize/MatchWindowSize';
59
- export { matchWindowSize, useMatchWindowSize } from './utils/windowSize/useMatchWindowSize';
60
- export { useWindowSize } from './utils/windowSize/useWindowSize';
61
- export * from '@ornikar/kitt-icons';
@@ -1,24 +0,0 @@
1
- import styled from 'styled-components/native';
2
-
3
- export interface BlockProps {
4
- color?: 'dark' | 'white' | 'primary' | 'transparent';
5
- }
6
-
7
- const getBackgroundColorFromBlockColor = (color: BlockProps['color'] = 'transparent'): string => {
8
- switch (color) {
9
- case 'dark':
10
- return '#293033';
11
- case 'white':
12
- return '#ffffff';
13
- default:
14
- return 'transparent';
15
- }
16
- };
17
-
18
- export const Block = styled.View<BlockProps>`
19
- background: ${({ color }) => getBackgroundColorFromBlockColor(color)};
20
- `;
21
-
22
- export const BlockWithPadding = styled(Block)`
23
- padding: 10px 5px;
24
- `;
@@ -1,16 +0,0 @@
1
- import type { ViewStyle } from 'react-native';
2
- import styled from 'styled-components/native';
3
-
4
- interface FlexProps {
5
- direction: ViewStyle['flexDirection'];
6
- padding?: number;
7
- }
8
-
9
- export const Flex = styled.View.withConfig<FlexProps>({
10
- shouldForwardProp: (prop, defaultValidatorFn) => !['direction', 'padding'].includes(prop) && defaultValidatorFn(prop),
11
- })`
12
- display: flex;
13
- flex-direction: ${({ direction }) => direction};
14
- flex-wrap: wrap;
15
- padding: ${({ theme, padding = 0 }) => padding * theme.kitt.spacing}px;
16
- `;
@@ -1,143 +0,0 @@
1
- import { storiesOf } from '@storybook/react-native';
2
- import { Section, Story, StoryGrid } from '@ornikar/kitt-universal';
3
- import type { ReactElement } from 'react';
4
- import React from 'react';
5
- import styled, { useTheme } from 'styled-components/native';
6
- import type { TypographyProps } from '../typography/Typography';
7
- import { Typography } from '../typography/Typography';
8
-
9
- interface StyledColorTokenProps {
10
- value: string;
11
- }
12
-
13
- const StyledColorToken = styled.View<StyledColorTokenProps>`
14
- display: flex;
15
- align-items: center;
16
- padding: 24px 12px;
17
- border-radius: 20px;
18
- margin: 8px 0;
19
- background-color: ${({ value }) => value};
20
- `;
21
-
22
- interface ColorTokenProps extends StyledColorTokenProps {
23
- color?: TypographyProps['color'];
24
- name: string;
25
- value: string;
26
- }
27
-
28
- function ColorToken({ color, name, value }: ColorTokenProps): ReactElement {
29
- return (
30
- <StyledColorToken value={value}>
31
- <Typography.Text base="body" color={color} variant="bold">
32
- {name}
33
- </Typography.Text>
34
- <Typography.Text base="body" color={color}>
35
- {value}
36
- </Typography.Text>
37
- </StyledColorToken>
38
- );
39
- }
40
-
41
- function DesignTokensColors(): ReactElement {
42
- const theme = useTheme();
43
-
44
- return (
45
- <Story title="Design Tokens">
46
- <Section title="Late Ocean">
47
- <StoryGrid.Row breakpoint="medium">
48
- <StoryGrid.Col>
49
- <ColorToken color="white" name="Late Ocean" value={theme.kitt.palettes.lateOcean.lateOcean} />
50
- </StoryGrid.Col>
51
- <StoryGrid.Col>
52
- <ColorToken color="white" name="Late Ocean Light 1" value={theme.kitt.palettes.lateOcean.lateOceanLight1} />
53
- </StoryGrid.Col>
54
- <StoryGrid.Col>
55
- <ColorToken color="white" name="Late Ocean Light 2" value={theme.kitt.palettes.lateOcean.lateOceanLight2} />
56
- </StoryGrid.Col>
57
- <StoryGrid.Col>
58
- <ColorToken color="white" name="Late Ocean Light 3" value={theme.kitt.palettes.lateOcean.lateOceanLight3} />
59
- </StoryGrid.Col>
60
- </StoryGrid.Row>
61
- </Section>
62
-
63
- <Section title="Warm Embrace">
64
- <StoryGrid.Row breakpoint="medium">
65
- <StoryGrid.Col>
66
- <ColorToken color="black" name="Warm Embrace" value={theme.kitt.palettes.lateOcean.warmEmbrace} />
67
- </StoryGrid.Col>
68
- <StoryGrid.Col>
69
- <ColorToken
70
- color="black"
71
- name="Warm Embrace Light 1"
72
- value={theme.kitt.palettes.lateOcean.warmEmbraceLight1}
73
- />
74
- </StoryGrid.Col>
75
- </StoryGrid.Row>
76
- </Section>
77
-
78
- <Section title="Black">
79
- <StoryGrid.Row breakpoint="medium">
80
- <StoryGrid.Col>
81
- <ColorToken color="white" name="Black 1000" value={theme.kitt.palettes.lateOcean.black1000} />
82
- </StoryGrid.Col>
83
- <StoryGrid.Col>
84
- <ColorToken color="white" name="Black 555" value={theme.kitt.palettes.lateOcean.black555} />
85
- </StoryGrid.Col>
86
- <StoryGrid.Col>
87
- <ColorToken color="black" name="Black 200" value={theme.kitt.palettes.lateOcean.black200} />
88
- </StoryGrid.Col>
89
- <StoryGrid.Col>
90
- <ColorToken color="black" name="Black 100" value={theme.kitt.palettes.lateOcean.black100} />
91
- </StoryGrid.Col>
92
- <StoryGrid.Col>
93
- <ColorToken color="black" name="Black 50" value={theme.kitt.palettes.lateOcean.black50} />
94
- </StoryGrid.Col>
95
- <StoryGrid.Col>
96
- <ColorToken color="black" name="White" value={theme.kitt.palettes.lateOcean.white} />
97
- </StoryGrid.Col>
98
- </StoryGrid.Row>
99
- </Section>
100
-
101
- <Section title="Functional Colors">
102
- <StoryGrid.Row breakpoint="medium">
103
- <StoryGrid.Col>
104
- <ColorToken color="white" name="Viride" value={theme.kitt.palettes.lateOcean.viride} />
105
- </StoryGrid.Col>
106
- <StoryGrid.Col>
107
- <ColorToken color="white" name="English Vermillon" value={theme.kitt.palettes.lateOcean.englishVermillon} />
108
- </StoryGrid.Col>
109
- <StoryGrid.Col>
110
- <ColorToken name="Gold Crayola" value={theme.kitt.palettes.lateOcean.goldCrayola} />
111
- </StoryGrid.Col>
112
- <StoryGrid.Col>
113
- <ColorToken name="Aero" value={theme.kitt.palettes.lateOcean.aero} />
114
- </StoryGrid.Col>
115
- </StoryGrid.Row>
116
- </Section>
117
-
118
- <Section title="Brand Colors">
119
- <StoryGrid.Row breakpoint="medium">
120
- <StoryGrid.Col>
121
- <ColorToken color="white" name="Primary" value={theme.kitt.colors.primary} />
122
- </StoryGrid.Col>
123
- <StoryGrid.Col>
124
- <ColorToken name="Accent" value={theme.kitt.colors.accent} />
125
- </StoryGrid.Col>
126
- <StoryGrid.Col>
127
- <ColorToken color="white" name="Success" value={theme.kitt.colors.success} />
128
- </StoryGrid.Col>
129
- <StoryGrid.Col>
130
- <ColorToken color="white" name="Correct" value={theme.kitt.colors.correct} />
131
- </StoryGrid.Col>
132
- <StoryGrid.Col>
133
- <ColorToken color="white" name="Alert" value={theme.kitt.colors.danger} />
134
- </StoryGrid.Col>
135
- </StoryGrid.Row>
136
- </Section>
137
- </Story>
138
- );
139
- }
140
-
141
- storiesOf('kitt-universal/Design tokens', module).add('Colors', () => <DesignTokensColors />, {
142
- jest: { ignore: true },
143
- });
@@ -1,22 +0,0 @@
1
- /* Please sort alphabetically */
2
- import './stories/color-tokens.stories';
3
- import './Avatar/Avatar.stories';
4
- import './Button/Button.stories';
5
- import './Card/Card.stories';
6
- import './forms/InputFeedback/InputFeedback.stories';
7
- import './forms/Label/Label.stories';
8
- import './forms/Radio/Radio.stories';
9
- import './forms/TextArea/TextArea.stories';
10
- import './forms/InputText/InputText.stories';
11
- import './Icon/Icon.stories';
12
- import './ListItem/ListItem.stories';
13
- import './Loader/Loader.stories';
14
- import './Message/Message.stories';
15
- import './Modal/Modal.stories';
16
- import './Notification/Notification.stories';
17
- import './Tag/Tag.stories';
18
- import './typography/Typography.stories';
19
- import './typography/TypographyIcon.stories';
20
- import './typography/TypographyLink.stories';
21
- import './FullScreenModal/FullScreenModal.stories';
22
- import './utils/windowSize/windowSize.stories';
@@ -1,56 +0,0 @@
1
- import type { ReactElement, ReactNode } from 'react';
2
- import React from 'react';
3
- import type { ViewProps } from 'react-native';
4
- import styled from 'styled-components/native';
5
- import { StoryTitle } from './StoryTitle';
6
-
7
- const StyledSection = styled.View`
8
- margin-bottom: 30px;
9
- `;
10
-
11
- interface SectionProps extends ViewProps {
12
- title: string;
13
- className?: string;
14
- children: ReactNode;
15
- }
16
-
17
- export function Section({ title, className, children, ...props }: SectionProps): ReactElement {
18
- return (
19
- <StyledSection {...props}>
20
- <StoryTitle.Level2>{title}</StoryTitle.Level2>
21
- {children}
22
- </StyledSection>
23
- );
24
- }
25
-
26
- const StyledSubSection = styled.View`
27
- margin-bottom: 20px;
28
- `;
29
-
30
- function SubSection({ title, className, children, ...props }: SectionProps): ReactElement {
31
- return (
32
- <StyledSubSection {...props}>
33
- <StoryTitle.Level3>{title}</StoryTitle.Level3>
34
- {children}
35
- </StyledSubSection>
36
- );
37
- }
38
-
39
- interface DemoSectionProps {
40
- children: ReactNode;
41
- }
42
-
43
- const StyledDemoSection = styled.View`
44
- margin-bottom: 90px;
45
- `;
46
-
47
- function DemoSection({ children }: DemoSectionProps): ReactElement {
48
- return (
49
- <StyledDemoSection>
50
- <Section title="Demo">{children}</Section>
51
- </StyledDemoSection>
52
- );
53
- }
54
-
55
- Section.SubSection = SubSection;
56
- Section.DemoSection = DemoSection;
@@ -1,24 +0,0 @@
1
- import type { ReactElement, ReactNode } from 'react';
2
- import React from 'react';
3
- import type { ScrollViewProps } from 'react-native';
4
- import styled from 'styled-components/native';
5
- import { StoryTitle } from './StoryTitle';
6
-
7
- export interface StoryProps {
8
- title: ReactNode;
9
- children: ReactNode;
10
- contentContainerStyle?: ScrollViewProps['contentContainerStyle'];
11
- }
12
-
13
- const StoryContainer = styled.ScrollView`
14
- padding: 10px;
15
- `;
16
-
17
- export function Story({ title, contentContainerStyle, children }: StoryProps): ReactElement {
18
- return (
19
- <StoryContainer contentContainerStyle={contentContainerStyle}>
20
- <StoryTitle>{title}</StoryTitle>
21
- {children}
22
- </StoryContainer>
23
- );
24
- }
@@ -1,8 +0,0 @@
1
- import type { StoryContext, StoryFn } from '@storybook/addons';
2
- import type { ReactNode } from 'react';
3
- import React from 'react';
4
- import { Story } from './Story';
5
-
6
- export function StoryDecorator(storyFn: StoryFn<ReactNode>, context: StoryContext): ReturnType<StoryFn<ReactNode>> {
7
- return <Story title={context.name}>{storyFn()}</Story>;
8
- }
@@ -1,80 +0,0 @@
1
- import type { ReactElement, ReactNode } from 'react';
2
- import React from 'react';
3
- import { useWindowDimensions } from 'react-native';
4
- import styled from 'styled-components/native';
5
- import type { TypographyProps } from '..';
6
- import { StoryTitle } from './StoryTitle';
7
-
8
- const SmallScreenRow = styled.View`
9
- flex-direction: column;
10
- margin: 0;
11
- `;
12
-
13
- const SmallScreenCol = styled.View`
14
- padding: 10px 0 20px;
15
- `;
16
-
17
- const FlexRow = styled.View`
18
- flex-direction: row;
19
- margin: 0 -5px 20px;
20
- `;
21
-
22
- const FlexCol = styled.View`
23
- flex-grow: 1;
24
- flex-basis: 0;
25
- margin: 0 5px 10px;
26
- `;
27
-
28
- export interface StoryGridRowProps {
29
- children: NonNullable<ReactNode>;
30
- breakpoint?: 'small' | 'medium';
31
- }
32
-
33
- function StoryGridRow({ children, breakpoint = 'small' }: StoryGridRowProps): ReactElement {
34
- // eslint-disable-next-line unicorn/expiring-todo-comments
35
- // TODO use useBreakpoint instead
36
- const { width } = useWindowDimensions();
37
- const breakpointValue = breakpoint === 'small' ? 480 : 768;
38
-
39
- if (width < breakpointValue) {
40
- return (
41
- <SmallScreenRow>
42
- {React.Children.map(children, (child) => (
43
- <SmallScreenCol>{child}</SmallScreenCol>
44
- ))}
45
- </SmallScreenRow>
46
- );
47
- }
48
-
49
- return (
50
- <FlexRow>
51
- {React.Children.map(children, (child) => (
52
- <FlexCol>{child}</FlexCol>
53
- ))}
54
- </FlexRow>
55
- );
56
- }
57
-
58
- export interface StoryGridColProps {
59
- children: NonNullable<ReactNode>;
60
- title?: string;
61
- titleColor?: TypographyProps['color'];
62
- }
63
-
64
- function StoryGridCol({ title, titleColor, children }: StoryGridColProps): ReactElement {
65
- return (
66
- <>
67
- {title ? (
68
- <StoryTitle.Level4 numberOfLines={1} color={titleColor}>
69
- {title}
70
- </StoryTitle.Level4>
71
- ) : null}
72
- {children}
73
- </>
74
- );
75
- }
76
-
77
- export const StoryGrid = {
78
- Row: StoryGridRow,
79
- Col: StoryGridCol,
80
- };
@@ -1,12 +0,0 @@
1
- import { storiesOf } from '@storybook/react-native';
2
- import React from 'react';
3
- import { Section } from './Section';
4
- import { StoryTitle } from './StoryTitle';
5
-
6
- storiesOf('kitt-universal/story-components', module).add('StoryTitle', () => (
7
- <Section title="Story Title">
8
- <StoryTitle>Title level 1</StoryTitle>
9
- <StoryTitle.Level2>Title level 2</StoryTitle.Level2>
10
- <StoryTitle.Level3>Title level 3</StoryTitle.Level3>
11
- </Section>
12
- ));
@@ -1,69 +0,0 @@
1
- import type { ReactElement, ReactNode } from 'react';
2
- import React from 'react';
3
- import styled from 'styled-components/native';
4
- import type { TypographyProps } from '../typography/Typography';
5
- import { Typography } from '../typography/Typography';
6
-
7
- interface StoryTitleProps {
8
- color?: TypographyProps['color'];
9
- numberOfLines?: TypographyProps['numberOfLines'];
10
- children: ReactNode;
11
- }
12
-
13
- const StoryTitleContainer = styled.View`
14
- margin-bottom: 30px;
15
- `;
16
-
17
- const StorySubTitleContainer = styled.View`
18
- margin-bottom: 10px;
19
- `;
20
-
21
- export function StoryTitle({ color, children, numberOfLines }: StoryTitleProps): ReactElement {
22
- return (
23
- <StoryTitleContainer>
24
- <Typography.h1 variant="bold" base="header1" color={color} numberOfLines={numberOfLines}>
25
- {children}
26
- </Typography.h1>
27
- </StoryTitleContainer>
28
- );
29
- }
30
-
31
- function StoryTitleLevel2({ color, children, numberOfLines }: StoryTitleProps): ReactElement {
32
- return (
33
- <StoryTitleContainer>
34
- <Typography.h2 variant="bold" base="header2" color={color} numberOfLines={numberOfLines}>
35
- {children}
36
- </Typography.h2>
37
- </StoryTitleContainer>
38
- );
39
- }
40
-
41
- StoryTitleLevel2.displayName = 'StoryTitle.Level2';
42
-
43
- function StoryTitleLevel3({ color, children, numberOfLines }: StoryTitleProps): ReactElement {
44
- return (
45
- <StorySubTitleContainer>
46
- <Typography.h3 variant="bold" base="header3" medium="header4" color={color} numberOfLines={numberOfLines}>
47
- {children}
48
- </Typography.h3>
49
- </StorySubTitleContainer>
50
- );
51
- }
52
-
53
- StoryTitleLevel3.displayName = 'StoryTitle.Level3';
54
-
55
- function StoryTitleLevel4({ color, children, numberOfLines }: StoryTitleProps): ReactElement {
56
- return (
57
- <StorySubTitleContainer>
58
- <Typography.h4 variant="bold" base="header4" medium="header5" color={color} numberOfLines={numberOfLines}>
59
- {children}
60
- </Typography.h4>
61
- </StorySubTitleContainer>
62
- );
63
- }
64
-
65
- StoryTitleLevel4.displayName = 'StoryTitle.Level3';
66
-
67
- StoryTitle.Level2 = StoryTitleLevel2;
68
- StoryTitle.Level3 = StoryTitleLevel3;
69
- StoryTitle.Level4 = StoryTitleLevel4;
@@ -1,155 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`kitt-universal/story-components StoryTitle 1`] = `
4
- <RNCSafeAreaProvider
5
- onInsetsChange={[Function]}
6
- style={
7
- Array [
8
- Object {
9
- "flex": 1,
10
- },
11
- undefined,
12
- ]
13
- }
14
- >
15
- <View
16
- style={
17
- Array [
18
- Object {
19
- "marginBottom": 30,
20
- },
21
- ]
22
- }
23
- >
24
- <View
25
- style={
26
- Array [
27
- Object {
28
- "marginBottom": 30,
29
- },
30
- ]
31
- }
32
- >
33
- <Text
34
- aria-level="2"
35
- color="black"
36
- isHeader={true}
37
- style={
38
- Array [
39
- Object {
40
- "color": "#000000",
41
- "fontFamily": "Moderat-Extended-Bold",
42
- "fontSize": 32,
43
- "fontStyle": "normal",
44
- "fontWeight": "400",
45
- "lineHeight": 42,
46
- "textDecorationColor": "#000000",
47
- },
48
- ]
49
- }
50
- type="header2"
51
- variant="bold"
52
- >
53
- Story Title
54
- </Text>
55
- </View>
56
- <View
57
- style={
58
- Array [
59
- Object {
60
- "marginBottom": 30,
61
- },
62
- ]
63
- }
64
- >
65
- <Text
66
- aria-level="1"
67
- color="black"
68
- isHeader={true}
69
- style={
70
- Array [
71
- Object {
72
- "color": "#000000",
73
- "fontFamily": "Moderat-Extended-Bold",
74
- "fontSize": 38,
75
- "fontStyle": "normal",
76
- "fontWeight": "400",
77
- "lineHeight": 49,
78
- "textDecorationColor": "#000000",
79
- },
80
- ]
81
- }
82
- type="header1"
83
- variant="bold"
84
- >
85
- Title level 1
86
- </Text>
87
- </View>
88
- <View
89
- style={
90
- Array [
91
- Object {
92
- "marginBottom": 30,
93
- },
94
- ]
95
- }
96
- >
97
- <Text
98
- aria-level="2"
99
- color="black"
100
- isHeader={true}
101
- style={
102
- Array [
103
- Object {
104
- "color": "#000000",
105
- "fontFamily": "Moderat-Extended-Bold",
106
- "fontSize": 32,
107
- "fontStyle": "normal",
108
- "fontWeight": "400",
109
- "lineHeight": 42,
110
- "textDecorationColor": "#000000",
111
- },
112
- ]
113
- }
114
- type="header2"
115
- variant="bold"
116
- >
117
- Title level 2
118
- </Text>
119
- </View>
120
- <View
121
- style={
122
- Array [
123
- Object {
124
- "marginBottom": 10,
125
- },
126
- ]
127
- }
128
- >
129
- <Text
130
- aria-level="3"
131
- color="black"
132
- isHeader={true}
133
- medium="header4"
134
- style={
135
- Array [
136
- Object {
137
- "color": "#000000",
138
- "fontFamily": "Moderat-Extended-Bold",
139
- "fontSize": 24,
140
- "fontStyle": "normal",
141
- "fontWeight": "400",
142
- "lineHeight": 31,
143
- "textDecorationColor": "#000000",
144
- },
145
- ]
146
- }
147
- type="header3"
148
- variant="bold"
149
- >
150
- Title level 3
151
- </Text>
152
- </View>
153
- </View>
154
- </RNCSafeAreaProvider>
155
- `;
@@ -1,5 +0,0 @@
1
- export { Section } from './Section';
2
- export { Story } from './Story';
3
- export { StoryDecorator } from './StoryDecorator';
4
- export { StoryGrid } from './StoryGrid';
5
- export { StoryTitle } from './StoryTitle';