@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,11 +0,0 @@
1
- import { KittBreakpoints } from '../../KittBreakpoints';
2
- import { createWindowSizeHelper } from './createWindowSizeHelper';
3
-
4
- describe('createWindowSizeHelper', () => {
5
- it('should throw when sizes are not correctly sorted', () => {
6
- const helper = createWindowSizeHelper(480);
7
- expect(() => helper.mapWindowWidth([KittBreakpoints.MEDIUM, ''], [KittBreakpoints.SMALL, ''])).toThrow(
8
- 'mapWindowWidth: sort your values to be mobile first. 480 is < 768, so 480 should be before 768.',
9
- );
10
- });
11
- });
@@ -1,65 +0,0 @@
1
- import type { MatchWindowSizeOptions } from './useMatchWindowSize';
2
- import { matchWindowSize } from './useMatchWindowSize';
3
-
4
- export interface WindowSizeHelper {
5
- /** Prefer using if or map variants, at it should be more web friendly */
6
- matchWindowSize: (options: MatchWindowSizeOptions) => boolean;
7
-
8
- /**
9
- * @example
10
- * ```typescript
11
- * const Container = styled.View`
12
- * ${({ theme }) =>
13
- * theme.responsive.ifWindowSizeMatches(
14
- * { minWidth: KittBreakpoints.SMALL },
15
- * 'padding: 5px 0 10px;'
16
- * )
17
- * )};
18
- * `;
19
- * ```
20
- */
21
- ifWindowSizeMatches: <T extends string | null>(options: MatchWindowSizeOptions, valueIfTrue: T, valueIfFalse: T) => T;
22
-
23
- /**
24
- *
25
- * @example
26
- * ```typescript
27
- * const Container = styled.View`
28
- * ${({ theme }) =>
29
- * theme.responsive.mapWindowWidth(
30
- * [KittBreakpoints.BASE, 'padding: 5px 0 10px;'],
31
- * [KittBreakpoints.SMALL, 'padding: 10px 0;'],
32
- * )
33
- * )};
34
- * `;
35
- * ```
36
- */
37
- mapWindowWidth: <V extends string>(...widthList: [number, V][]) => V | null;
38
- }
39
-
40
- export function createWindowSizeHelper(currentWidth: number): WindowSizeHelper {
41
- return {
42
- matchWindowSize: (options) => matchWindowSize(currentWidth, options),
43
-
44
- ifWindowSizeMatches: (options, valueIfTrue, valueIfFalse) =>
45
- matchWindowSize(currentWidth, options) ? valueIfTrue : valueIfFalse,
46
-
47
- mapWindowWidth: <V extends string>(...widthList: [number, V][]): V | null => {
48
- if (__DEV__) {
49
- widthList.slice(1).forEach(([minWidth], index) => {
50
- const previousMinWidth = widthList[index][0];
51
- if (previousMinWidth > minWidth) {
52
- throw new Error(
53
- `mapWindowWidth: sort your values to be mobile first. ${minWidth} is < ${previousMinWidth}, so ${minWidth} should be before ${previousMinWidth}.`,
54
- );
55
- }
56
- });
57
- }
58
- const found = widthList.find(([minWidth, value]) =>
59
- matchWindowSize(currentWidth, { minWidth: Number(minWidth) }),
60
- );
61
- if (!found) return null;
62
- return found[1];
63
- },
64
- };
65
- }
@@ -1,14 +0,0 @@
1
- import { useWindowDimensions } from 'react-native';
2
-
3
- export interface MatchWindowSizeOptions {
4
- minWidth: number;
5
- maxWidth?: number;
6
- }
7
- export function matchWindowSize(currentWidth: number, { minWidth, maxWidth }: MatchWindowSizeOptions): boolean {
8
- return currentWidth >= minWidth && (!maxWidth || currentWidth <= maxWidth);
9
- }
10
-
11
- export function useMatchWindowSize(options: MatchWindowSizeOptions): boolean {
12
- const { width } = useWindowDimensions();
13
- return matchWindowSize(width, options);
14
- }
@@ -1 +0,0 @@
1
- export { useWindowDimensions as useWindowSize } from 'react-native';
@@ -1,115 +0,0 @@
1
- import { storiesOf } from '@storybook/react-native';
2
- import { Section, Story, StoryGrid } from '@ornikar/kitt-universal';
3
- import React from 'react';
4
- import styled from 'styled-components/native';
5
- import { KittBreakpoints, KittBreakpointsMax } from '../../KittBreakpoints';
6
- import { Typography } from '../../typography/Typography';
7
- import { MatchWindowSize } from './MatchWindowSize';
8
-
9
- const StyledBreakpointView = styled.View`
10
- ${({ theme }) =>
11
- theme.responsive.ifWindowSizeMatches(
12
- { minWidth: KittBreakpoints.LARGE },
13
- 'background-color: red;',
14
- 'background-color: blue;',
15
- )}
16
- ${({ theme }) =>
17
- theme.responsive.mapWindowWidth(
18
- /* from BASE to SMALL */
19
- [KittBreakpoints.BASE, 'margin-bottom: 15px;'],
20
- /* from SMALL to WIDE */
21
- [KittBreakpoints.SMALL, 'margin-bottom: 10px;'],
22
- /* from WIDE */
23
- [
24
- KittBreakpoints.WIDE,
25
- `
26
- margin-bottom: 0;
27
- `,
28
- ],
29
- )}
30
- `;
31
-
32
- const StyledWord = styled.Text`
33
- ${({ theme }) =>
34
- theme.responsive.ifWindowSizeMatches({ minWidth: KittBreakpoints.LARGE }, 'color: red;', 'color: blue;')}
35
- `;
36
-
37
- storiesOf('kitt-universal/Utils', module)
38
- .add('Window Size', () => (
39
- <Story title="Window Size">
40
- <Section title="Breakpoints Values">
41
- <StoryGrid.Row>
42
- {Object.entries(KittBreakpoints).map(([name, value]) => (
43
- <StoryGrid.Col key={name} title={name}>
44
- <Typography.Text base="body">{`min-width: ${value}`}</Typography.Text>
45
- </StoryGrid.Col>
46
- ))}
47
- </StoryGrid.Row>
48
- </Section>
49
-
50
- <Section title="In Breakpoint">
51
- <StoryGrid.Row>
52
- {Object.entries(KittBreakpoints).map(([name, value]) => (
53
- <StoryGrid.Col key={name} title={name}>
54
- <MatchWindowSize minWidth={value} maxWidth={KittBreakpointsMax[name as keyof typeof KittBreakpointsMax]}>
55
- <Typography.Text base="body">yes</Typography.Text>
56
- </MatchWindowSize>
57
- </StoryGrid.Col>
58
- ))}
59
- </StoryGrid.Row>
60
- </Section>
61
-
62
- <Section title="minWidth">
63
- <StoryGrid.Row>
64
- {Object.entries(KittBreakpoints).map(([name, value]) => (
65
- <StoryGrid.Col key={name} title={name}>
66
- <MatchWindowSize minWidth={value}>
67
- <Typography.Text base="body">yes</Typography.Text>
68
- </MatchWindowSize>
69
- </StoryGrid.Col>
70
- ))}
71
- </StoryGrid.Row>
72
- </Section>
73
-
74
- <Section title="maxWidth">
75
- <StoryGrid.Row>
76
- {Object.entries(KittBreakpointsMax).map(([name, value]) => (
77
- <StoryGrid.Col key={name} title={name}>
78
- <MatchWindowSize minWidth={KittBreakpoints.BASE} maxWidth={value}>
79
- <Typography.Text base="body">yes</Typography.Text>
80
- </MatchWindowSize>
81
- </StoryGrid.Col>
82
- ))}
83
- </StoryGrid.Row>
84
- </Section>
85
-
86
- <Section title="Styled View">
87
- <StyledBreakpointView>
88
- <Typography.Text base="body">styled view</Typography.Text>
89
- </StyledBreakpointView>
90
- </Section>
91
- </Story>
92
- ))
93
- .add(
94
- 'Window Size in list (performance test)',
95
- () => (
96
- <Typography.Paragraph base="body">
97
- {`Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
98
-
99
- Curabitur sodales ligula in libero. Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet.
100
-
101
- Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam.
102
-
103
- Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit amet pede facilisis laoreet. Donec lacus nunc, viverra nec, blandit vel, egestas et, augue.
104
-
105
- Vestibulum tincidunt malesuada tellus. Ut ultrices ultrices enim. Curabitur sit amet mauris. Morbi in dui quis est pulvinar ullamcorper. Nulla facilisi. Integer lacinia sollicitudin massa. Cras metus. Sed aliquet risus a tortor. Integer id quam. Morbi mi. Quisque nisl felis, venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales libero eget ante.
106
- `
107
- .split(' ')
108
- .map((word, index) => (
109
- // eslint-disable-next-line react/no-array-index-key
110
- <StyledWord key={index}>{word} </StyledWord>
111
- ))}
112
- </Typography.Paragraph>
113
- ),
114
- { chromatic: { disable: true }, jest: { ignore: true } },
115
- );
@@ -1,33 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "rootDir": "src",
5
- "composite": true,
6
- "noEmit": false,
7
- "isolatedModules": false,
8
- "emitDeclarationOnly": true,
9
- "declarationMap": true,
10
- "outDir": "dist/definitions",
11
- "tsBuildInfoFile": "dist/tsbuildinfo",
12
- "rootDirs": ["src"],
13
- "paths": {}
14
- },
15
- "exclude": [
16
- "dist",
17
- "**/__mocks__",
18
- "**/__tests__",
19
- "**/*.test.ts",
20
- "**/*.test.tsx",
21
- "**/*.stories.ts",
22
- "**/*.stories.tsx",
23
- "**/stories.ts",
24
- "**/stories.tsx",
25
- "**/stories/**",
26
- "**/stories-list.ts"
27
- ],
28
- "references": [
29
- {
30
- "path": "../../@ornikar/kitt-icons/tsconfig.build.json"
31
- }
32
- ]
33
- }
package/tsconfig.json DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "rootDirs": ["src", "../../../@ornikar/kitt-icons/src"],
5
- "baseUrl": "./src",
6
- "paths": {
7
- "@ornikar/kitt-universal": ["./index.ts"],
8
- "@ornikar/kitt-icons": ["../../../@ornikar/kitt-icons/src/index.ts"]
9
- },
10
- "jsx": "preserve"
11
- },
12
- "include": ["src", "../../typings"]
13
- }