@ornikar/kitt-universal 27.5.1-canary.4d3ec9b2bbb3371c254ae88141f81bb445a59f73.0 → 27.5.1-canary.7b68cb8f8312c7736633882eefa6e43178ed4819.0

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 (90) hide show
  1. package/AGENTS.md +30 -0
  2. package/CHANGELOG.md +8 -5
  3. package/dist/definitions/TabBar/TabBar.d.ts +6 -4
  4. package/dist/definitions/TabBar/TabBar.d.ts.map +1 -1
  5. package/dist/definitions/TabBar/TabBarItem.d.ts +11 -1
  6. package/dist/definitions/TabBar/TabBarItem.d.ts.map +1 -1
  7. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts +180 -12
  8. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts.map +1 -1
  9. package/dist/definitions/themes/default.d.ts +1 -12
  10. package/dist/definitions/themes/default.d.ts.map +1 -1
  11. package/dist/definitions/themes/late-ocean/icon.d.ts +0 -20
  12. package/dist/definitions/themes/late-ocean/icon.d.ts.map +1 -1
  13. package/dist/definitions/themes/late-ocean/tabBar.d.ts +34 -0
  14. package/dist/definitions/themes/late-ocean/tabBar.d.ts.map +1 -0
  15. package/dist/definitions/typography/Typography.d.ts.map +1 -1
  16. package/dist/definitions/typography/TypographyIcon.d.ts.map +1 -1
  17. package/dist/definitions/typography/utils/getTypographyFamily.d.ts +2 -1
  18. package/dist/definitions/typography/utils/getTypographyFamily.d.ts.map +1 -1
  19. package/dist/index-metro.es.android.js +565 -250
  20. package/dist/index-metro.es.android.js.map +1 -1
  21. package/dist/index-metro.es.ios.js +565 -250
  22. package/dist/index-metro.es.ios.js.map +1 -1
  23. package/dist/index-node-22.17.cjs.js +456 -140
  24. package/dist/index-node-22.17.cjs.js.map +1 -1
  25. package/dist/index-node-22.17.cjs.web.js +457 -141
  26. package/dist/index-node-22.17.cjs.web.js.map +1 -1
  27. package/dist/index-node-22.17.es.mjs +456 -140
  28. package/dist/index-node-22.17.es.mjs.map +1 -1
  29. package/dist/index-node-22.17.es.web.mjs +457 -141
  30. package/dist/index-node-22.17.es.web.mjs.map +1 -1
  31. package/dist/index.es.js +567 -242
  32. package/dist/index.es.js.map +1 -1
  33. package/dist/index.es.web.js +566 -241
  34. package/dist/index.es.web.js.map +1 -1
  35. package/dist/linaria-themes-metro.es.android.js +179 -36
  36. package/dist/linaria-themes-metro.es.android.js.map +1 -1
  37. package/dist/linaria-themes-metro.es.ios.js +179 -36
  38. package/dist/linaria-themes-metro.es.ios.js.map +1 -1
  39. package/dist/linaria-themes-node-22.17.cjs.js +179 -36
  40. package/dist/linaria-themes-node-22.17.cjs.js.map +1 -1
  41. package/dist/linaria-themes-node-22.17.cjs.web.js +179 -36
  42. package/dist/linaria-themes-node-22.17.cjs.web.js.map +1 -1
  43. package/dist/linaria-themes-node-22.17.es.mjs +179 -36
  44. package/dist/linaria-themes-node-22.17.es.mjs.map +1 -1
  45. package/dist/linaria-themes-node-22.17.es.web.mjs +179 -36
  46. package/dist/linaria-themes-node-22.17.es.web.mjs.map +1 -1
  47. package/dist/linaria-themes.es.js +179 -36
  48. package/dist/linaria-themes.es.js.map +1 -1
  49. package/dist/linaria-themes.es.web.js +179 -36
  50. package/dist/linaria-themes.es.web.js.map +1 -1
  51. package/dist/tsbuildinfo +1 -1
  52. package/package.json +2 -2
  53. package/scripts/codemods/__testfixtures__/csf1-csf2/decorator.input.tsx +11 -0
  54. package/scripts/codemods/__testfixtures__/csf1-csf2/decorator.output.tsx +17 -0
  55. package/scripts/codemods/__testfixtures__/csf1-csf2/default.input.tsx +88 -0
  56. package/scripts/codemods/__testfixtures__/csf1-csf2/default.output.tsx +94 -0
  57. package/scripts/codemods/__testfixtures__/csf1-csf2/new.input.tsx +77 -0
  58. package/scripts/codemods/__testfixtures__/csf1-csf2/new.output.tsx +92 -0
  59. package/scripts/codemods/__testfixtures__/csf1-csf2/parameters.input.tsx +21 -0
  60. package/scripts/codemods/__testfixtures__/csf1-csf2/parameters.output.tsx +28 -0
  61. package/scripts/codemods/__tests__/csf1-csf2.test.ts +10 -0
  62. package/scripts/codemods/card-modal.js +155 -0
  63. package/scripts/codemods/csf1-csf2.js +315 -0
  64. package/scripts/codemods/fullscreen-modal.js +155 -0
  65. package/scripts/codemods/navigation-modal.js +155 -0
  66. package/scripts/{run-transformers.js → run-codemods.js} +12 -12
  67. package/scripts/transformers/card-modal.js +0 -136
  68. package/scripts/transformers/fullscreen-modal.js +0 -138
  69. package/scripts/transformers/navigation-modal.js +0 -138
  70. /package/scripts/{transformers → codemods}/__testfixtures__/card-modal/basic.input.js +0 -0
  71. /package/scripts/{transformers → codemods}/__testfixtures__/card-modal/basic.output.js +0 -0
  72. /package/scripts/{transformers → codemods}/__testfixtures__/card-modal/withExpressions.input.js +0 -0
  73. /package/scripts/{transformers → codemods}/__testfixtures__/card-modal/withExpressions.output.js +0 -0
  74. /package/scripts/{transformers → codemods}/__testfixtures__/card-modal/wrongOrder.input.js +0 -0
  75. /package/scripts/{transformers → codemods}/__testfixtures__/card-modal/wrongOrder.output.js +0 -0
  76. /package/scripts/{transformers → codemods}/__testfixtures__/fullscreen-modal/basic.input.js +0 -0
  77. /package/scripts/{transformers → codemods}/__testfixtures__/fullscreen-modal/basic.output.js +0 -0
  78. /package/scripts/{transformers → codemods}/__testfixtures__/fullscreen-modal/withExpressions.input.js +0 -0
  79. /package/scripts/{transformers → codemods}/__testfixtures__/fullscreen-modal/withExpressions.output.js +0 -0
  80. /package/scripts/{transformers → codemods}/__testfixtures__/fullscreen-modal/wrongOrder.input.js +0 -0
  81. /package/scripts/{transformers → codemods}/__testfixtures__/fullscreen-modal/wrongOrder.output.js +0 -0
  82. /package/scripts/{transformers → codemods}/__testfixtures__/navigation-modal/basic.input.js +0 -0
  83. /package/scripts/{transformers → codemods}/__testfixtures__/navigation-modal/basic.output.js +0 -0
  84. /package/scripts/{transformers → codemods}/__testfixtures__/navigation-modal/withExpressions.input.js +0 -0
  85. /package/scripts/{transformers → codemods}/__testfixtures__/navigation-modal/withExpressions.output.js +0 -0
  86. /package/scripts/{transformers → codemods}/__testfixtures__/navigation-modal/wrongOrder.input.js +0 -0
  87. /package/scripts/{transformers → codemods}/__testfixtures__/navigation-modal/wrongOrder.output.js +0 -0
  88. /package/scripts/{transformers → codemods}/__tests__/card-modal.test.js +0 -0
  89. /package/scripts/{transformers → codemods}/__tests__/fullscreen-modal.test.js +0 -0
  90. /package/scripts/{transformers → codemods}/__tests__/navigation-modal.test.js +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ornikar/kitt-universal",
3
- "version": "27.5.1-canary.4d3ec9b2bbb3371c254ae88141f81bb445a59f73.0",
3
+ "version": "27.5.1-canary.7b68cb8f8312c7736633882eefa6e43178ed4819.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "directory": "@ornikar/kitt-universal",
@@ -72,7 +72,7 @@
72
72
  "./babel-plugin-csf-to-jest": "./babel-plugin-csf-to-jest.js"
73
73
  },
74
74
  "bin": {
75
- "run-transformers": "./scripts/run-transformers.js"
75
+ "run-codemods": "./scripts/run-codemods.js"
76
76
  },
77
77
  "engines": {
78
78
  "node": ">=22.17.0"
@@ -0,0 +1,11 @@
1
+ import { storiesOf } from '@storybook/react-native';
2
+ import {
3
+ NativeStoryDecorator,
4
+ AnotherDecorator,
5
+ } from '@ornikar/learner-apps-shared/src/storybook/decorators/NativeStoryDecorator';
6
+ import { NotificationEnablerScreenView } from './NotificationEnablerScreenView';
7
+
8
+ storiesOf('LNA/shared/components', module)
9
+ .addDecorator(NativeStoryDecorator)
10
+ .addDecorator(AnotherDecorator)
11
+ .add('NotificationEnablerScreen', () => <NotificationEnablerScreenView firstname="Michael" />);
@@ -0,0 +1,17 @@
1
+ import type { ComponentMeta, ComponentStory } from '@storybook/react-native';
2
+ import {
3
+ NativeStoryDecorator,
4
+ AnotherDecorator,
5
+ } from '@ornikar/learner-apps-shared/src/storybook/decorators/NativeStoryDecorator';
6
+ import { NotificationEnablerScreenView } from './NotificationEnablerScreenView';
7
+
8
+ export default {
9
+ title: 'LNA/shared/components',
10
+ component: NotificationEnablerScreenView,
11
+ decorators: [NativeStoryDecorator, AnotherDecorator],
12
+ } satisfies ComponentMeta<typeof NotificationEnablerScreenView>;
13
+
14
+ export const NotificationEnablerScreenStory: ComponentStory<typeof NotificationEnablerScreenView> = () => (
15
+ <NotificationEnablerScreenView firstname="Michael" />
16
+ );
17
+ NotificationEnablerScreenStory.storyName = 'NotificationEnablerScreen';
@@ -0,0 +1,88 @@
1
+ import { storiesOf } from '@storybook/react-native';
2
+ import { InfoRegularIcon } from '@ornikar/kitt-icons/phosphor';
3
+ import { HStack, IconButton, Story, StorySection, Typography, VStack } from '@ornikar/kitt-universal';
4
+ import type { ReactNode } from 'react';
5
+ import { useVisibility } from '../../hooks/useVisibility';
6
+ import { CustomTooltip } from './CustomTooltip';
7
+
8
+ function CustomTooltipWrapper(): ReactNode {
9
+ const { visible, toggle } = useVisibility(true);
10
+
11
+ return (
12
+ <Story title="CustomTooltip">
13
+ <StorySection title="Top (Default) | Right (Default)">
14
+ <CustomTooltip visible={visible} onTooltipPress={toggle}>
15
+ <Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
16
+ </CustomTooltip>
17
+ <HStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
18
+ <Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
19
+ <IconButton icon={<InfoRegularIcon />} onPress={toggle} />
20
+ </HStack>
21
+ </StorySection>
22
+
23
+ <StorySection title="Top | Center">
24
+ <CustomTooltip visible={visible} alignment="center" onTooltipPress={toggle}>
25
+ <Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
26
+ </CustomTooltip>
27
+ <VStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
28
+ <IconButton icon={<InfoRegularIcon />} onPress={toggle} />
29
+ <Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
30
+ </VStack>
31
+ </StorySection>
32
+
33
+ <StorySection title="Top | Left">
34
+ <CustomTooltip visible={visible} alignment="flex-start" onTooltipPress={toggle}>
35
+ <Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
36
+ </CustomTooltip>
37
+ <HStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
38
+ <IconButton icon={<InfoRegularIcon />} onPress={toggle} />
39
+ <Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
40
+ </HStack>
41
+ </StorySection>
42
+
43
+ <StorySection title="Bottom | Right (Default)">
44
+ <CustomTooltip visible={visible} position="bottom" positionOffset={56} onTooltipPress={toggle}>
45
+ <Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
46
+ </CustomTooltip>
47
+ <HStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
48
+ <Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
49
+ <IconButton icon={<InfoRegularIcon />} onPress={toggle} />
50
+ </HStack>
51
+ </StorySection>
52
+
53
+ <StorySection title="Bottom | Center">
54
+ <CustomTooltip
55
+ visible={visible}
56
+ position="bottom"
57
+ positionOffset={56}
58
+ alignment="center"
59
+ onTooltipPress={toggle}
60
+ >
61
+ <Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
62
+ </CustomTooltip>
63
+ <VStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
64
+ <IconButton icon={<InfoRegularIcon />} onPress={toggle} />
65
+ <Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
66
+ </VStack>
67
+ </StorySection>
68
+
69
+ <StorySection title="Bottom | Left">
70
+ <CustomTooltip
71
+ visible={visible}
72
+ position="bottom"
73
+ positionOffset={56}
74
+ alignment="flex-start"
75
+ onTooltipPress={toggle}
76
+ >
77
+ <Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
78
+ </CustomTooltip>
79
+ <HStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
80
+ <IconButton icon={<InfoRegularIcon />} onPress={toggle} />
81
+ <Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
82
+ </HStack>
83
+ </StorySection>
84
+ </Story>
85
+ );
86
+ }
87
+
88
+ storiesOf('LAS/shared/components', module).add('CustomTooltip', () => <CustomTooltipWrapper />);
@@ -0,0 +1,94 @@
1
+ import type { ComponentMeta, ComponentStory } from '@storybook/react-native';
2
+ import { InfoRegularIcon } from '@ornikar/kitt-icons/phosphor';
3
+ import { HStack, IconButton, Story, StorySection, Typography, VStack } from '@ornikar/kitt-universal';
4
+ import type { ReactNode } from 'react';
5
+ import { useVisibility } from '../../hooks/useVisibility';
6
+ import { CustomTooltip } from './CustomTooltip';
7
+
8
+ function CustomTooltipWrapper(): ReactNode {
9
+ const { visible, toggle } = useVisibility(true);
10
+
11
+ return (
12
+ <Story title="CustomTooltip">
13
+ <StorySection title="Top (Default) | Right (Default)">
14
+ <CustomTooltip visible={visible} onTooltipPress={toggle}>
15
+ <Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
16
+ </CustomTooltip>
17
+ <HStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
18
+ <Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
19
+ <IconButton icon={<InfoRegularIcon />} onPress={toggle} />
20
+ </HStack>
21
+ </StorySection>
22
+
23
+ <StorySection title="Top | Center">
24
+ <CustomTooltip visible={visible} alignment="center" onTooltipPress={toggle}>
25
+ <Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
26
+ </CustomTooltip>
27
+ <VStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
28
+ <IconButton icon={<InfoRegularIcon />} onPress={toggle} />
29
+ <Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
30
+ </VStack>
31
+ </StorySection>
32
+
33
+ <StorySection title="Top | Left">
34
+ <CustomTooltip visible={visible} alignment="flex-start" onTooltipPress={toggle}>
35
+ <Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
36
+ </CustomTooltip>
37
+ <HStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
38
+ <IconButton icon={<InfoRegularIcon />} onPress={toggle} />
39
+ <Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
40
+ </HStack>
41
+ </StorySection>
42
+
43
+ <StorySection title="Bottom | Right (Default)">
44
+ <CustomTooltip visible={visible} position="bottom" positionOffset={56} onTooltipPress={toggle}>
45
+ <Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
46
+ </CustomTooltip>
47
+ <HStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
48
+ <Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
49
+ <IconButton icon={<InfoRegularIcon />} onPress={toggle} />
50
+ </HStack>
51
+ </StorySection>
52
+
53
+ <StorySection title="Bottom | Center">
54
+ <CustomTooltip
55
+ visible={visible}
56
+ position="bottom"
57
+ positionOffset={56}
58
+ alignment="center"
59
+ onTooltipPress={toggle}
60
+ >
61
+ <Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
62
+ </CustomTooltip>
63
+ <VStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
64
+ <IconButton icon={<InfoRegularIcon />} onPress={toggle} />
65
+ <Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
66
+ </VStack>
67
+ </StorySection>
68
+
69
+ <StorySection title="Bottom | Left">
70
+ <CustomTooltip
71
+ visible={visible}
72
+ position="bottom"
73
+ positionOffset={56}
74
+ alignment="flex-start"
75
+ onTooltipPress={toggle}
76
+ >
77
+ <Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
78
+ </CustomTooltip>
79
+ <HStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
80
+ <IconButton icon={<InfoRegularIcon />} onPress={toggle} />
81
+ <Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
82
+ </HStack>
83
+ </StorySection>
84
+ </Story>
85
+ );
86
+ }
87
+
88
+ export default {
89
+ title: 'LAS/shared/components',
90
+ component: CustomTooltipWrapper,
91
+ } satisfies ComponentMeta<typeof CustomTooltipWrapper>;
92
+
93
+ export const CustomTooltipStory: ComponentStory<typeof CustomTooltipWrapper> = () => <CustomTooltipWrapper />;
94
+ CustomTooltipStory.storyName = 'CustomTooltip';
@@ -0,0 +1,77 @@
1
+ import { action } from '@storybook/addon-actions';
2
+ import { storiesOf } from '@storybook/react-native';
3
+ import { ApolloError } from '@apollo/client';
4
+ import { StoryDecorator } from '@ornikar/kitt-universal';
5
+ import { NotificationProvider } from '@ornikar/react-notification';
6
+ import {
7
+ ThirdPartyServiceStatusEnum,
8
+ ThirdPartyServiceTypeEnum,
9
+ } from '@ornikar/learner-apps-shared/src/__generated__/globalTypes';
10
+ import {
11
+ mockLearningChaptersEmptyError,
12
+ mockLearningChaptersWithCourses,
13
+ mockLearningChaptersWithCoursesQueryBuilder,
14
+ } from '@ornikar/learner-apps-shared/src/shared/apollo/mocks/learningChaptersWithCoursesMock';
15
+ import {
16
+ getThirdPartyService,
17
+ mockThirdPartyServiceQueryBuilder,
18
+ } from '@ornikar/learner-apps-shared/src/shared/apollo/mocks/thirdPartyService';
19
+ import { ApolloDecorator } from '../../../../../../../storybook/decorators/ApolloDecorator';
20
+ import {
21
+ DrivingDashboardLearningChaptersModalView,
22
+ LearningChaptersModalBodyWrapper,
23
+ } from './DrivingDashboardLearningChaptersModalView';
24
+
25
+ storiesOf('LAS/driving/dashboard/components/DrivingDashboardLearningChaptersModal', module)
26
+ .addDecorator(StoryDecorator as any)
27
+ .addDecorator(ApolloDecorator)
28
+ .add('Default', () => <DrivingDashboardLearningChaptersModalView visible onClose={action('onClose')} />, {
29
+ apollo: {
30
+ mocks: [
31
+ mockThirdPartyServiceQueryBuilder(
32
+ ThirdPartyServiceTypeEnum.NORTHPASS,
33
+ getThirdPartyService(ThirdPartyServiceTypeEnum.NORTHPASS, ThirdPartyServiceStatusEnum.UP),
34
+ ),
35
+ mockLearningChaptersWithCoursesQueryBuilder(mockLearningChaptersWithCourses),
36
+ ],
37
+ },
38
+ jest: {
39
+ ignore: true,
40
+ },
41
+ })
42
+ .add('Empty chapters', () => <LearningChaptersModalBodyWrapper visible />, {
43
+ apollo: {
44
+ mocks: [
45
+ mockThirdPartyServiceQueryBuilder(
46
+ ThirdPartyServiceTypeEnum.NORTHPASS,
47
+ getThirdPartyService(ThirdPartyServiceTypeEnum.NORTHPASS, ThirdPartyServiceStatusEnum.UP),
48
+ ),
49
+ mockLearningChaptersWithCoursesQueryBuilder(mockLearningChaptersEmptyError),
50
+ ],
51
+ },
52
+ jest: {
53
+ ignore: true,
54
+ },
55
+ })
56
+ .add(
57
+ 'Error',
58
+ () => (
59
+ <NotificationProvider>
60
+ <DrivingDashboardLearningChaptersModalView visible onClose={action('onClose')} />
61
+ </NotificationProvider>
62
+ ),
63
+ {
64
+ apollo: {
65
+ mocks: [
66
+ mockThirdPartyServiceQueryBuilder(
67
+ ThirdPartyServiceTypeEnum.NORTHPASS,
68
+ getThirdPartyService(ThirdPartyServiceTypeEnum.NORTHPASS, ThirdPartyServiceStatusEnum.DOWN),
69
+ ),
70
+ mockLearningChaptersWithCoursesQueryBuilder(mockLearningChaptersEmptyError, new ApolloError({})),
71
+ ],
72
+ },
73
+ jest: {
74
+ ignore: true,
75
+ },
76
+ },
77
+ );
@@ -0,0 +1,92 @@
1
+ import { action } from '@storybook/addon-actions';
2
+ import type { ComponentMeta, ComponentStory } from '@storybook/react-native';
3
+ import { ApolloError } from '@apollo/client';
4
+ import { StoryDecorator } from '@ornikar/kitt-universal';
5
+ import { NotificationProvider } from '@ornikar/react-notification';
6
+ import {
7
+ ThirdPartyServiceStatusEnum,
8
+ ThirdPartyServiceTypeEnum,
9
+ } from '@ornikar/learner-apps-shared/src/__generated__/globalTypes';
10
+ import {
11
+ mockLearningChaptersEmptyError,
12
+ mockLearningChaptersWithCourses,
13
+ mockLearningChaptersWithCoursesQueryBuilder,
14
+ } from '@ornikar/learner-apps-shared/src/shared/apollo/mocks/learningChaptersWithCoursesMock';
15
+ import {
16
+ getThirdPartyService,
17
+ mockThirdPartyServiceQueryBuilder,
18
+ } from '@ornikar/learner-apps-shared/src/shared/apollo/mocks/thirdPartyService';
19
+ import { ApolloDecorator } from '../../../../../../../storybook/decorators/ApolloDecorator';
20
+ import {
21
+ DrivingDashboardLearningChaptersModalView,
22
+ LearningChaptersModalBodyWrapper,
23
+ } from './DrivingDashboardLearningChaptersModalView';
24
+
25
+ export default {
26
+ title: 'LAS/driving/dashboard/components/DrivingDashboardLearningChaptersModal',
27
+ component: DrivingDashboardLearningChaptersModalView,
28
+ decorators: [StoryDecorator, ApolloDecorator],
29
+ } satisfies ComponentMeta<typeof DrivingDashboardLearningChaptersModalView>;
30
+
31
+ export const DefaultStory: ComponentStory<typeof DrivingDashboardLearningChaptersModalView> = () => (
32
+ <DrivingDashboardLearningChaptersModalView visible onClose={action('onClose')} />
33
+ );
34
+ DefaultStory.storyName = 'Default';
35
+
36
+ DefaultStory.parameters = {
37
+ apollo: {
38
+ mocks: [
39
+ mockThirdPartyServiceQueryBuilder(
40
+ ThirdPartyServiceTypeEnum.NORTHPASS,
41
+ getThirdPartyService(ThirdPartyServiceTypeEnum.NORTHPASS, ThirdPartyServiceStatusEnum.UP),
42
+ ),
43
+ mockLearningChaptersWithCoursesQueryBuilder(mockLearningChaptersWithCourses),
44
+ ],
45
+ },
46
+ jest: {
47
+ ignore: true,
48
+ },
49
+ };
50
+
51
+ export const EmptyChaptersStory: ComponentStory<typeof DrivingDashboardLearningChaptersModalView> = () => (
52
+ <LearningChaptersModalBodyWrapper visible />
53
+ );
54
+ EmptyChaptersStory.storyName = 'Empty chapters';
55
+
56
+ EmptyChaptersStory.parameters = {
57
+ apollo: {
58
+ mocks: [
59
+ mockThirdPartyServiceQueryBuilder(
60
+ ThirdPartyServiceTypeEnum.NORTHPASS,
61
+ getThirdPartyService(ThirdPartyServiceTypeEnum.NORTHPASS, ThirdPartyServiceStatusEnum.UP),
62
+ ),
63
+ mockLearningChaptersWithCoursesQueryBuilder(mockLearningChaptersEmptyError),
64
+ ],
65
+ },
66
+ jest: {
67
+ ignore: true,
68
+ },
69
+ };
70
+
71
+ export const ErrorStory: ComponentStory<typeof DrivingDashboardLearningChaptersModalView> = () => (
72
+ <NotificationProvider>
73
+ <DrivingDashboardLearningChaptersModalView visible onClose={action('onClose')} />
74
+ </NotificationProvider>
75
+ );
76
+
77
+ ErrorStory.storyName = 'Error';
78
+
79
+ ErrorStory.parameters = {
80
+ apollo: {
81
+ mocks: [
82
+ mockThirdPartyServiceQueryBuilder(
83
+ ThirdPartyServiceTypeEnum.NORTHPASS,
84
+ getThirdPartyService(ThirdPartyServiceTypeEnum.NORTHPASS, ThirdPartyServiceStatusEnum.DOWN),
85
+ ),
86
+ mockLearningChaptersWithCoursesQueryBuilder(mockLearningChaptersEmptyError, new ApolloError({})),
87
+ ],
88
+ },
89
+ jest: {
90
+ ignore: true,
91
+ },
92
+ };
@@ -0,0 +1,21 @@
1
+ import { storiesOf } from '@storybook/react-native';
2
+ import { GestureHandlerRootView } from 'react-native-gesture-handler';
3
+ import { NativeStoryDecorator } from '@ornikar/learner-apps-shared/src/storybook/decorators/NativeStoryDecorator';
4
+ import { WelcomePageView } from './WelcomePageView';
5
+
6
+ storiesOf('Learner Native App/Authentication/Pages/WelcomePageView', module)
7
+ .addDecorator(NativeStoryDecorator)
8
+ .addParameters({
9
+ chromatic: { disable: true },
10
+ jest: {
11
+ createBeforeAfterEachCallbacks: () => ({
12
+ before: () => jest.useFakeTimers({ legacyFakeTimers: true }),
13
+ after: () => jest.useRealTimers(),
14
+ }),
15
+ },
16
+ })
17
+ .add('WelcomePageView', () => (
18
+ <GestureHandlerRootView>
19
+ <WelcomePageView topInset={60} bottomInset={0} />
20
+ </GestureHandlerRootView>
21
+ ));
@@ -0,0 +1,28 @@
1
+ import type { ComponentMeta, ComponentStory } from '@storybook/react-native';
2
+ import { GestureHandlerRootView } from 'react-native-gesture-handler';
3
+ import { NativeStoryDecorator } from '@ornikar/learner-apps-shared/src/storybook/decorators/NativeStoryDecorator';
4
+ import { WelcomePageView } from './WelcomePageView';
5
+
6
+ export default {
7
+ title: 'LNA/authentication/pages',
8
+ component: WelcomePageView,
9
+ decorators: [NativeStoryDecorator],
10
+
11
+ parameters: {
12
+ chromatic: { disable: true },
13
+ jest: {
14
+ createBeforeAfterEachCallbacks: () => ({
15
+ before: () => jest.useFakeTimers({ legacyFakeTimers: true }),
16
+ after: () => jest.useRealTimers(),
17
+ }),
18
+ },
19
+ },
20
+ } satisfies ComponentMeta<typeof WelcomePageView>;
21
+
22
+ export const WelcomePageStory: ComponentStory<typeof WelcomePageView> = () => (
23
+ <GestureHandlerRootView>
24
+ <WelcomePageView topInset={60} bottomInset={0} />
25
+ </GestureHandlerRootView>
26
+ );
27
+
28
+ WelcomePageStory.storyName = 'WelcomePage';
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ jest.autoMockOff();
4
+ const { defineTest } = require('jscodeshift/dist/testUtils');
5
+
6
+ const tests = ['default', 'decorator', 'parameters', 'new'];
7
+
8
+ describe('CSF1-CSF2 Migration', () => {
9
+ tests.forEach((test) => defineTest(__dirname, 'csf1-csf2', null, `csf1-csf2/${test}`, { parser: 'tsx' }));
10
+ });
@@ -0,0 +1,155 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Transforms CardModal components from prop-based structure to children-based structure.
5
+ * Converts header, body, and footer props into direct children, maintaining proper order.
6
+ */
7
+
8
+ // Use local jscodeshift instance directly
9
+ const jscodeshift = require('jscodeshift');
10
+ const prettier = require('prettier');
11
+
12
+ module.exports = async function transformer(fileInfo, api) {
13
+ // Use the jscodeshift API to parse the file
14
+ const j = api.jscodeshift || jscodeshift;
15
+
16
+ // Parse the source code of the file
17
+ const root = j(fileInfo.source);
18
+
19
+ // ----------- Start of codemod logic
20
+
21
+ let hasChanges = false;
22
+
23
+ // Find all CardModal JSX elements
24
+ root
25
+ .find(j.JSXElement, {
26
+ openingElement: {
27
+ name: {
28
+ name: 'CardModal',
29
+ },
30
+ },
31
+ })
32
+ .forEach((path) => {
33
+ const element = path.value;
34
+ const openingElement = element.openingElement;
35
+
36
+ // Check if this CardModal has header, body, or footer props
37
+ const headerProp = openingElement.attributes.find(
38
+ (attr) => attr.type === 'JSXAttribute' && attr.name.name === 'header',
39
+ );
40
+ const bodyProp = openingElement.attributes.find(
41
+ (attr) => attr.type === 'JSXAttribute' && attr.name.name === 'body',
42
+ );
43
+ const footerProp = openingElement.attributes.find(
44
+ (attr) => attr.type === 'JSXAttribute' && attr.name.name === 'footer',
45
+ );
46
+
47
+ // Only transform if at least one of these props exists
48
+ if (!headerProp && !bodyProp && !footerProp) {
49
+ return;
50
+ }
51
+
52
+ hasChanges = true;
53
+
54
+ // Extract the prop values and create children
55
+ const children = [];
56
+
57
+ // Helper function to extract content from prop value
58
+ const extractPropContent = (prop) => {
59
+ if (!prop || !prop.value) return [];
60
+
61
+ if (prop.value.type === 'JSXExpressionContainer') {
62
+ const expression = prop.value.expression;
63
+
64
+ // Check if the expression is a CardModal.Body - if so, extract its children
65
+ if (
66
+ expression.type === 'JSXElement' &&
67
+ expression.openingElement.name.type === 'JSXMemberExpression' &&
68
+ expression.openingElement.name.object.name === 'CardModal' &&
69
+ expression.openingElement.name.property.name === 'Body'
70
+ ) {
71
+ // Return the CardModal.Body element itself, not its children
72
+ return [expression];
73
+ } else if (expression.type === 'JSXElement') {
74
+ // For other JSX elements (header, footer), return the element directly (not wrapped)
75
+ return [expression];
76
+ } else {
77
+ // For other expressions (including conditionals), return as JSX expression
78
+ return [j.jsxExpressionContainer(expression)];
79
+ }
80
+ } else if (prop.value.type === 'JSXElement') {
81
+ // Direct JSX element
82
+ if (
83
+ prop.value.openingElement.name.type === 'JSXMemberExpression' &&
84
+ prop.value.openingElement.name.object.name === 'CardModal' &&
85
+ prop.value.openingElement.name.property.name === 'Body'
86
+ ) {
87
+ // Direct CardModal.Body element - return the element itself
88
+ return [prop.value];
89
+ } else {
90
+ // For other direct JSX elements (like CardModal.Header, CardModal.Footer), return as-is
91
+ return [prop.value];
92
+ }
93
+ } else {
94
+ // For other types, return as-is
95
+ return [prop.value];
96
+ }
97
+ };
98
+
99
+ // Add header first
100
+ if (headerProp) {
101
+ const headerContent = extractPropContent(headerProp);
102
+ children.push(...headerContent);
103
+ }
104
+
105
+ // Add body second
106
+ if (bodyProp) {
107
+ const bodyContent = extractPropContent(bodyProp);
108
+ children.push(...bodyContent);
109
+ }
110
+
111
+ // Add footer last
112
+ if (footerProp) {
113
+ const footerContent = extractPropContent(footerProp);
114
+ children.push(...footerContent);
115
+ }
116
+
117
+ // Remove the header, body, and footer props from attributes
118
+ openingElement.attributes = openingElement.attributes.filter((attr) => {
119
+ return !(
120
+ attr.type === 'JSXAttribute' &&
121
+ (attr.name.name === 'header' || attr.name.name === 'body' || attr.name.name === 'footer')
122
+ );
123
+ });
124
+
125
+ // Update the element to be self-closing if no children, or add children
126
+ if (children.length === 0) {
127
+ openingElement.selfClosing = true;
128
+ element.closingElement = null;
129
+ element.children = [];
130
+ } else {
131
+ openingElement.selfClosing = false;
132
+ if (!element.closingElement) {
133
+ element.closingElement = j.jsxClosingElement(j.jsxIdentifier('CardModal'));
134
+ }
135
+ element.children = children;
136
+ }
137
+ });
138
+
139
+ // Only return modified code if changes were made
140
+ if (!hasChanges) {
141
+ return fileInfo.source;
142
+ }
143
+
144
+ // ----------- End of codemod logic
145
+
146
+ // Return the modified source code after transformation
147
+ const output = root.toSource({ quote: 'single' });
148
+
149
+ const prettierConfig = await prettier.resolveConfig(fileInfo.path);
150
+
151
+ return prettier.format(output, {
152
+ ...prettierConfig,
153
+ filepath: fileInfo.path,
154
+ });
155
+ };