@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
@@ -1,20 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import React, { forwardRef } from 'react';
3
- import { ScrollView } from 'react-native';
4
- import styled from 'styled-components/native';
5
-
6
- const BodyView = styled.View`
7
- padding: ${({ theme }) => theme.kitt.spacing * 6}px ${({ theme }) => theme.kitt.spacing * 4}px;
8
- `;
9
-
10
- export interface BodyProps {
11
- children: NonNullable<ReactNode>;
12
- }
13
-
14
- export const ModalBody = forwardRef<ScrollView, BodyProps>(({ children }, ref) => {
15
- return (
16
- <ScrollView ref={ref}>
17
- <BodyView>{children}</BodyView>
18
- </ScrollView>
19
- );
20
- });
@@ -1,18 +0,0 @@
1
- import type { ReactElement, ReactNode } from 'react';
2
- import React from 'react';
3
- import styled from 'styled-components/native';
4
-
5
- export interface FooterProps {
6
- children: NonNullable<ReactNode>;
7
- }
8
-
9
- const FooterView = styled.View`
10
- flex: 0 0 auto;
11
- padding: ${({ theme }) => theme.kitt.spacing * 4}px;
12
- border-top-width: 1px;
13
- border-top-color: ${({ theme }) => theme.kitt.colors.separator};
14
- `;
15
-
16
- export function ModalFooter({ children }: FooterProps): ReactElement {
17
- return <FooterView>{children}</FooterView>;
18
- }
@@ -1,66 +0,0 @@
1
- import { XIcon } from '@ornikar/kitt-icons';
2
- import type { ReactElement, ReactNode } from 'react';
3
- import React, { useContext } from 'react';
4
- import styled from 'styled-components/native';
5
- import { Button } from '../Button/Button';
6
- import { OnCloseContext } from './OnCloseContext';
7
-
8
- export interface HeaderProps {
9
- children: NonNullable<ReactNode>;
10
- left?: ReactNode;
11
- right?: ReactNode;
12
- }
13
-
14
- const HeaderView = styled.View`
15
- position: relative;
16
- padding: ${({ theme }) => theme.kitt.spacing * 2}px;
17
- display: flex;
18
- flex: 0 0 auto;
19
- flex-direction: row;
20
- justify-content: space-between;
21
- align-items: center;
22
- border-bottom-width: 1px;
23
- border-bottom-color: ${({ theme }) => theme.kitt.colors.separator};
24
- min-height: 57px;
25
- `;
26
-
27
- const LeftIconView = styled.View`
28
- align-self: flex-start;
29
- margin-right: ${({ theme }) => theme.kitt.spacing * 2}px;
30
- `;
31
-
32
- const RightIconView = styled.View`
33
- align-self: flex-start;
34
- margin-left: ${({ theme }) => theme.kitt.spacing * 2}px;
35
- `;
36
-
37
- interface TitleViewProps {
38
- isIconLeft?: boolean;
39
- }
40
-
41
- const TitleView = styled.View<TitleViewProps>`
42
- padding-left: ${({ theme, isIconLeft }) => (isIconLeft ? 0 : theme.kitt.spacing * 2)}px;
43
- flex-shrink: 1;
44
- `;
45
-
46
- export function ModalHeader({ left, right, children }: HeaderProps): ReactElement {
47
- const onClose = useContext(OnCloseContext);
48
-
49
- const isIconLeft = !!left;
50
-
51
- return (
52
- <HeaderView>
53
- {isIconLeft && <LeftIconView>{left}</LeftIconView>}
54
-
55
- <TitleView isIconLeft={isIconLeft}>{children}</TitleView>
56
-
57
- {right !== undefined ? (
58
- right
59
- ) : (
60
- <RightIconView>
61
- <Button type="subtle-dark" icon={<XIcon />} onPress={onClose} />
62
- </RightIconView>
63
- )}
64
- </HeaderView>
65
- );
66
- }
@@ -1,181 +0,0 @@
1
- import { action } from '@storybook/addon-actions';
2
- import { storiesOf } from '@storybook/react-native';
3
- import { ArrowLeftIcon, CalendarIcon } from '@ornikar/kitt-icons';
4
- import { Section } from '@ornikar/kitt-universal';
5
- import type { ReactElement } from 'react';
6
- import React, { useState } from 'react';
7
- import type { Except } from 'type-fest';
8
- import { Typography } from '..';
9
- import { Button } from '../Button/Button';
10
- import type { ModalProps } from './Modal';
11
- import { Modal } from './Modal';
12
-
13
- type ModalWrapperProps = Except<ModalProps, 'visible' | 'onClose'>;
14
-
15
- function ModalWrapper(props: ModalWrapperProps): ReactElement {
16
- const [visible, setVisible] = useState<boolean>(false);
17
-
18
- return (
19
- <>
20
- <Button type="primary" onPress={() => setVisible((prev) => !prev)}>
21
- <Typography.Text base="body">Toggle modal</Typography.Text>
22
- </Button>
23
-
24
- <Modal visible={visible} onClose={() => setVisible(false)} {...props} />
25
- </>
26
- );
27
- }
28
-
29
- storiesOf('kitt-universal/Modal', module)
30
- .add('Default', () => (
31
- <Section title="Default">
32
- <ModalWrapper>
33
- <Modal.Header>
34
- <Typography.Text base="body" variant="bold">
35
- Title
36
- </Typography.Text>
37
- </Modal.Header>
38
-
39
- <Modal.Body>
40
- <Typography.Text base="body">Modal body goes here...</Typography.Text>
41
- </Modal.Body>
42
- </ModalWrapper>
43
- </Section>
44
- ))
45
- .add('With a Long Heading', () => {
46
- return (
47
- <Section title="With a Long Heading">
48
- <ModalWrapper>
49
- <Modal.Header>
50
- <Typography.Text base="body" variant="bold">
51
- The original Knight Rider series followed the adventures of Michael Knight, a modern-day crime fighter who
52
- uses a technologically advanced, artificially intelligent automobile. This car is virtually
53
- indestructible, due to a high-tech coating applied to it.
54
- </Typography.Text>
55
- </Modal.Header>
56
-
57
- <Modal.Body>
58
- <Typography.Text base="body">Modal body goes here...</Typography.Text>
59
- </Modal.Body>
60
- </ModalWrapper>
61
- </Section>
62
- );
63
- })
64
- .add('With Left Action', () => (
65
- <Section title="With Left Action">
66
- <ModalWrapper>
67
- <Modal.Header
68
- left={<Button type="subtle-dark" icon={<ArrowLeftIcon />} onPress={action('On Left Action Press')} />}
69
- >
70
- <Typography.Text base="body" variant="bold">
71
- Title
72
- </Typography.Text>
73
- </Modal.Header>
74
-
75
- <Modal.Body>
76
- <Typography.Text base="body">Modal body goes here...</Typography.Text>
77
- </Modal.Body>
78
- </ModalWrapper>
79
- </Section>
80
- ))
81
- .add('With Custom Right Action', () => {
82
- return (
83
- <Section title="With Custom Right Action">
84
- <ModalWrapper>
85
- <Modal.Header
86
- right={<Button type="subtle-dark" icon={<CalendarIcon />} onPress={action('On Right Action Press')} />}
87
- >
88
- <Typography.Text base="body" variant="bold">
89
- Title
90
- </Typography.Text>
91
- </Modal.Header>
92
-
93
- <Modal.Body>
94
- <Typography.Text base="body">Modal body goes here...</Typography.Text>
95
- </Modal.Body>
96
- </ModalWrapper>
97
- </Section>
98
- );
99
- })
100
- .add('With Footer', () => {
101
- return (
102
- <Section title="With Footer">
103
- <ModalWrapper>
104
- <Modal.Header>
105
- <Typography.Text base="body" variant="bold">
106
- Title
107
- </Typography.Text>
108
- </Modal.Header>
109
-
110
- <Modal.Body>
111
- <Typography.Text base="body">
112
- The original Knight Rider series followed the adventures of Michael Knight, a modern-day crime fighter who
113
- uses a technologically advanced, artificially intelligent automobile. This car is virtually
114
- indestructible, due to a high-tech coating applied to it.
115
- </Typography.Text>
116
- </Modal.Body>
117
-
118
- <Modal.Footer>
119
- <Button stretch type="primary" onPress={action('On Press Primary')}>
120
- <Typography.Text base="body" variant="bold">
121
- Primary
122
- </Typography.Text>
123
- </Button>
124
-
125
- <Button stretch type="subtle" onPress={action('On Press Secondary')}>
126
- <Typography.Text base="body" variant="bold">
127
- Secondary
128
- </Typography.Text>
129
- </Button>
130
- </Modal.Footer>
131
- </ModalWrapper>
132
- </Section>
133
- );
134
- })
135
- .add('With Long Content', () => (
136
- <Section title="With Long Content">
137
- <ModalWrapper>
138
- <Modal.Header>
139
- <Typography.Text base="body" variant="bold">
140
- Title
141
- </Typography.Text>
142
- </Modal.Header>
143
-
144
- <Modal.Body>
145
- <Typography.Text base="body">
146
- The original Knight Rider series followed the adventures of Michael Knight, a modern-day crime fighter who
147
- uses a technologically advanced, artificially intelligent automobile. This car is virtually indestructible,
148
- due to a high-tech coating applied to it.
149
- </Typography.Text>
150
-
151
- <Typography.Text base="body">
152
- Knight Rider stories usually depict either average citizens, or ethical heads of corporations, being bullied
153
- series is instructed by the Foundation for Law and Government (FLAG) to assist in some manner. The
154
- </Typography.Text>
155
-
156
- <Typography.Text base="body">
157
- KITT is essentially an advanced supercomputer on wheels. The brain of KITT is the Knight 2000 microprocessor
158
- which is the centre of a self-aware cybernetic logic module that allowed KITT to think, learn, communicate
159
- and interact with humans. He always had an ego that was easy to bruise and displayed a very sensitive, but
160
- kind and dryly humorous personality. He also has an in-dash entertainment system that can play music and
161
- video, and run various computer programs including arcade games which Michael sometimes indulged in while
162
- KITT was driving.
163
- </Typography.Text>
164
- </Modal.Body>
165
-
166
- <Modal.Footer>
167
- <Button stretch type="primary" onPress={action('On Press Primary')}>
168
- <Typography.Text base="body" variant="bold">
169
- Primary
170
- </Typography.Text>
171
- </Button>
172
-
173
- <Button stretch type="subtle" onPress={action('On Press Secondary')}>
174
- <Typography.Text base="body" variant="bold">
175
- Secondary
176
- </Typography.Text>
177
- </Button>
178
- </Modal.Footer>
179
- </ModalWrapper>
180
- </Section>
181
- ));
@@ -1,66 +0,0 @@
1
- import type { ReactElement, ReactNode } from 'react';
2
- import React from 'react';
3
- import { Modal as NativeModal } from 'react-native';
4
- import styled from 'styled-components/native';
5
- import { Overlay } from '../Overlay/Overlay';
6
- import { ModalBody } from './Body';
7
- import { ModalFooter } from './Footer';
8
- import { ModalHeader } from './Header';
9
- import { OnCloseContext } from './OnCloseContext';
10
-
11
- export interface ModalProps {
12
- visible: boolean;
13
- children: ReactNode;
14
- onClose: () => void;
15
- onEntered?: () => void;
16
- onExited?: () => void;
17
- }
18
-
19
- const ModalView = styled.View`
20
- top: 0;
21
- left: 0;
22
- width: 100%;
23
- height: 100%;
24
-
25
- display: flex;
26
- align-items: center;
27
- justify-content: center;
28
- padding: ${({ theme }) => theme.kitt.spacing * 20}px ${({ theme }) => theme.kitt.spacing * 4}px;
29
- `;
30
-
31
- const ContentView = styled.View`
32
- position: relative;
33
- display: flex;
34
- flex-direction: column;
35
- max-height: 100%;
36
- max-width: 540px;
37
- height: auto;
38
- width: 100%;
39
- border-radius: ${({ theme }) => theme.kitt.card.borderRadius};
40
- background-color: ${({ theme }) => theme.kitt.palettes.lateOcean.white};
41
- `;
42
-
43
- export function Modal({ visible, children, onClose, onEntered, onExited }: ModalProps): ReactElement {
44
- return (
45
- <OnCloseContext.Provider value={onClose}>
46
- <NativeModal
47
- transparent
48
- animationType="fade"
49
- visible={visible}
50
- onShow={onEntered}
51
- onDismiss={onExited}
52
- onRequestClose={onClose}
53
- >
54
- <ModalView>
55
- <Overlay onPress={onClose} />
56
-
57
- <ContentView>{children}</ContentView>
58
- </ModalView>
59
- </NativeModal>
60
- </OnCloseContext.Provider>
61
- );
62
- }
63
-
64
- Modal.Header = ModalHeader;
65
- Modal.Body = ModalBody;
66
- Modal.Footer = ModalFooter;
@@ -1,3 +0,0 @@
1
- import { createContext } from 'react';
2
-
3
- export const OnCloseContext = createContext<() => void>(() => {});