@ornikar/kitt-universal 27.4.0 → 27.5.1-canary.eac3fc19869888632e3a59913cf9f700a72b0dad.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 (86) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/definitions/CardModal/CardModalAnimation/CardModalAnimation.web.d.ts.map +1 -1
  3. package/dist/definitions/DialogModal/DialogModalAnimation/DialogModalAnimation.web.d.ts.map +1 -1
  4. package/dist/definitions/FullscreenModal/FullscreenModalAnimation.web.d.ts.map +1 -1
  5. package/dist/definitions/GoogleMapsAutocompleteProvider/GoogleMapsAutocompleteProvider.d.ts.map +1 -1
  6. package/dist/definitions/MapMarker/MapMarker.d.ts +2 -5
  7. package/dist/definitions/MapMarker/MapMarker.d.ts.map +1 -1
  8. package/dist/definitions/MapMarker/constants.d.ts +6 -0
  9. package/dist/definitions/MapMarker/constants.d.ts.map +1 -0
  10. package/dist/definitions/MapMarker/utils/getBackgroundColor.d.ts +2 -1
  11. package/dist/definitions/MapMarker/utils/getBackgroundColor.d.ts.map +1 -1
  12. package/dist/definitions/Picker/Picker.web.d.ts.map +1 -1
  13. package/dist/definitions/TabBar/TabBar.d.ts.map +1 -1
  14. package/dist/definitions/TimePicker/TimePicker.web.d.ts.map +1 -1
  15. package/dist/definitions/themes/late-ocean/cardModal.d.ts +21 -4
  16. package/dist/definitions/themes/late-ocean/cardModal.d.ts.map +1 -1
  17. package/dist/definitions/themes/late-ocean/dialogModal.d.ts +21 -4
  18. package/dist/definitions/themes/late-ocean/dialogModal.d.ts.map +1 -1
  19. package/dist/definitions/themes/late-ocean/fullscreenModal.d.ts +21 -4
  20. package/dist/definitions/themes/late-ocean/fullscreenModal.d.ts.map +1 -1
  21. package/dist/definitions/themes/late-ocean/shadows.d.ts +4 -2
  22. package/dist/definitions/themes/late-ocean/shadows.d.ts.map +1 -1
  23. package/dist/definitions/themes/late-ocean/skeleton.d.ts +2 -1
  24. package/dist/definitions/themes/late-ocean/skeleton.d.ts.map +1 -1
  25. package/dist/index-metro.es.android.js +100 -39
  26. package/dist/index-metro.es.android.js.map +1 -1
  27. package/dist/index-metro.es.ios.js +100 -39
  28. package/dist/index-metro.es.ios.js.map +1 -1
  29. package/dist/index-node-22.17.cjs.js +99 -38
  30. package/dist/index-node-22.17.cjs.js.map +1 -1
  31. package/dist/index-node-22.17.cjs.web.css +2 -2
  32. package/dist/index-node-22.17.cjs.web.js +66 -32
  33. package/dist/index-node-22.17.cjs.web.js.map +1 -1
  34. package/dist/index-node-22.17.es.mjs +99 -38
  35. package/dist/index-node-22.17.es.mjs.map +1 -1
  36. package/dist/index-node-22.17.es.web.css +2 -2
  37. package/dist/index-node-22.17.es.web.mjs +66 -32
  38. package/dist/index-node-22.17.es.web.mjs.map +1 -1
  39. package/dist/index.es.js +97 -74
  40. package/dist/index.es.js.map +1 -1
  41. package/dist/index.es.web.js +76 -44
  42. package/dist/index.es.web.js.map +1 -1
  43. package/dist/linaria-themes-metro.es.android.js +40 -10
  44. package/dist/linaria-themes-metro.es.android.js.map +1 -1
  45. package/dist/linaria-themes-metro.es.ios.js +40 -10
  46. package/dist/linaria-themes-metro.es.ios.js.map +1 -1
  47. package/dist/linaria-themes-node-22.17.cjs.js +40 -10
  48. package/dist/linaria-themes-node-22.17.cjs.js.map +1 -1
  49. package/dist/linaria-themes-node-22.17.cjs.web.js +40 -10
  50. package/dist/linaria-themes-node-22.17.cjs.web.js.map +1 -1
  51. package/dist/linaria-themes-node-22.17.es.mjs +40 -10
  52. package/dist/linaria-themes-node-22.17.es.mjs.map +1 -1
  53. package/dist/linaria-themes-node-22.17.es.web.mjs +40 -10
  54. package/dist/linaria-themes-node-22.17.es.web.mjs.map +1 -1
  55. package/dist/linaria-themes.es.js +40 -10
  56. package/dist/linaria-themes.es.js.map +1 -1
  57. package/dist/linaria-themes.es.web.js +40 -10
  58. package/dist/linaria-themes.es.web.js.map +1 -1
  59. package/dist/styles.css +2 -2
  60. package/dist/tsbuildinfo +1 -1
  61. package/package.json +1 -1
  62. package/scripts/transformers/__testfixtures__/card-modal/basic.input.js +19 -0
  63. package/scripts/transformers/__testfixtures__/card-modal/basic.output.js +15 -0
  64. package/scripts/transformers/__testfixtures__/card-modal/withExpressions.input.js +23 -0
  65. package/scripts/transformers/__testfixtures__/card-modal/withExpressions.output.js +19 -0
  66. package/scripts/transformers/__testfixtures__/card-modal/wrongOrder.input.js +19 -0
  67. package/scripts/transformers/__testfixtures__/card-modal/wrongOrder.output.js +15 -0
  68. package/scripts/transformers/__testfixtures__/fullscreen-modal/basic.input.js +19 -0
  69. package/scripts/transformers/__testfixtures__/fullscreen-modal/basic.output.js +15 -0
  70. package/scripts/transformers/__testfixtures__/fullscreen-modal/withExpressions.input.js +23 -0
  71. package/scripts/transformers/__testfixtures__/fullscreen-modal/withExpressions.output.js +19 -0
  72. package/scripts/transformers/__testfixtures__/fullscreen-modal/wrongOrder.input.js +19 -0
  73. package/scripts/transformers/__testfixtures__/fullscreen-modal/wrongOrder.output.js +15 -0
  74. package/scripts/transformers/__testfixtures__/navigation-modal/basic.input.js +19 -0
  75. package/scripts/transformers/__testfixtures__/navigation-modal/basic.output.js +15 -0
  76. package/scripts/transformers/__testfixtures__/navigation-modal/withExpressions.input.js +23 -0
  77. package/scripts/transformers/__testfixtures__/navigation-modal/withExpressions.output.js +19 -0
  78. package/scripts/transformers/__testfixtures__/navigation-modal/wrongOrder.input.js +19 -0
  79. package/scripts/transformers/__testfixtures__/navigation-modal/wrongOrder.output.js +15 -0
  80. package/scripts/transformers/__tests__/card-modal.test.js +10 -0
  81. package/scripts/transformers/__tests__/fullscreen-modal.test.js +10 -0
  82. package/scripts/transformers/__tests__/navigation-modal.test.js +10 -0
  83. package/scripts/transformers/card-modal.js +101 -0
  84. package/scripts/transformers/fullscreen-modal.js +101 -0
  85. package/scripts/transformers/navigation-modal.js +101 -0
  86. package/scripts/transformers/modals.js +0 -102
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ornikar/kitt-universal",
3
- "version": "27.4.0",
3
+ "version": "27.5.1-canary.eac3fc19869888632e3a59913cf9f700a72b0dad.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "directory": "@ornikar/kitt-universal",
@@ -0,0 +1,19 @@
1
+ function Test() {
2
+ return (
3
+ <CardModal
4
+ header={<CardModal.Header title="With Header and Body" />}
5
+ body={
6
+ <CardModal.Body>
7
+ <LoremIpsum />
8
+ </CardModal.Body>
9
+ }
10
+ footer={
11
+ <CardModal.Footer shouldHandleBottomNotch={false}>
12
+ <Button stretch type="primary">
13
+ With Body and Footer
14
+ </Button>
15
+ </CardModal.Footer>
16
+ }
17
+ />
18
+ );
19
+ }
@@ -0,0 +1,15 @@
1
+ function Test() {
2
+ return (
3
+ <CardModal>
4
+ <CardModal.Header title="With Header and Body" />
5
+ <CardModal.Body>
6
+ <LoremIpsum />
7
+ </CardModal.Body>
8
+ <CardModal.Footer shouldHandleBottomNotch={false}>
9
+ <Button stretch type="primary">
10
+ With Body and Footer
11
+ </Button>
12
+ </CardModal.Footer>
13
+ </CardModal>
14
+ );
15
+ }
@@ -0,0 +1,23 @@
1
+ function Test() {
2
+ return (
3
+ <CardModal
4
+ header={shouldDisplayHeader ? <CardModal.Header title="With Header and Body" /> : null}
5
+ body={
6
+ shouldDisplayBody ? (
7
+ <View>
8
+ <LoremIpsum />
9
+ </View>
10
+ ) : null
11
+ }
12
+ footer={
13
+ shouldDisplayFooter ? (
14
+ <CardModal.Footer shouldHandleBottomNotch={false}>
15
+ <Button stretch type="primary">
16
+ With Body and Footer
17
+ </Button>
18
+ </CardModal.Footer>
19
+ ) : null
20
+ }
21
+ />
22
+ );
23
+ }
@@ -0,0 +1,19 @@
1
+ function Test() {
2
+ return (
3
+ <CardModal>
4
+ {shouldDisplayHeader ? <CardModal.Header title="With Header and Body" /> : null}
5
+ {shouldDisplayBody ? (
6
+ <View>
7
+ <LoremIpsum />
8
+ </View>
9
+ ) : null}
10
+ {shouldDisplayFooter ? (
11
+ <CardModal.Footer shouldHandleBottomNotch={false}>
12
+ <Button stretch type="primary">
13
+ With Body and Footer
14
+ </Button>
15
+ </CardModal.Footer>
16
+ ) : null}
17
+ </CardModal>
18
+ );
19
+ }
@@ -0,0 +1,19 @@
1
+ function Test() {
2
+ return (
3
+ <CardModal
4
+ footer={
5
+ <CardModal.Footer shouldHandleBottomNotch={false}>
6
+ <Button stretch type="primary">
7
+ With Body and Footer
8
+ </Button>
9
+ </CardModal.Footer>
10
+ }
11
+ header={<CardModal.Header title="With Header and Body" />}
12
+ body={
13
+ <CardModal.Body>
14
+ <LoremIpsum />
15
+ </CardModal.Body>
16
+ }
17
+ />
18
+ );
19
+ }
@@ -0,0 +1,15 @@
1
+ function Test() {
2
+ return (
3
+ <CardModal>
4
+ <CardModal.Header title="With Header and Body" />
5
+ <CardModal.Body>
6
+ <LoremIpsum />
7
+ </CardModal.Body>
8
+ <CardModal.Footer shouldHandleBottomNotch={false}>
9
+ <Button stretch type="primary">
10
+ With Body and Footer
11
+ </Button>
12
+ </CardModal.Footer>
13
+ </CardModal>
14
+ );
15
+ }
@@ -0,0 +1,19 @@
1
+ function Test() {
2
+ return (
3
+ <FullscreenModal
4
+ header={<FullscreenModal.Header title="With Header and Body" />}
5
+ body={
6
+ <FullscreenModal.Body>
7
+ <LoremIpsum />
8
+ </FullscreenModal.Body>
9
+ }
10
+ footer={
11
+ <FullscreenModal.Footer shouldHandleBottomNotch={false}>
12
+ <Button stretch type="primary">
13
+ With Body and Footer
14
+ </Button>
15
+ </FullscreenModal.Footer>
16
+ }
17
+ />
18
+ );
19
+ }
@@ -0,0 +1,15 @@
1
+ function Test() {
2
+ return (
3
+ <FullscreenModal>
4
+ <FullscreenModal.Header title="With Header and Body" />
5
+ <FullscreenModal.Body>
6
+ <LoremIpsum />
7
+ </FullscreenModal.Body>
8
+ <FullscreenModal.Footer shouldHandleBottomNotch={false}>
9
+ <Button stretch type="primary">
10
+ With Body and Footer
11
+ </Button>
12
+ </FullscreenModal.Footer>
13
+ </FullscreenModal>
14
+ );
15
+ }
@@ -0,0 +1,23 @@
1
+ function Test() {
2
+ return (
3
+ <FullscreenModal
4
+ header={shouldDisplayHeader ? <FullscreenModal.Header title="With Header and Body" /> : null}
5
+ body={
6
+ shouldDisplayBody ? (
7
+ <View>
8
+ <LoremIpsum />
9
+ </View>
10
+ ) : null
11
+ }
12
+ footer={
13
+ shouldDisplayFooter ? (
14
+ <FullscreenModal.Footer shouldHandleBottomNotch={false}>
15
+ <Button stretch type="primary">
16
+ With Body and Footer
17
+ </Button>
18
+ </FullscreenModal.Footer>
19
+ ) : null
20
+ }
21
+ />
22
+ );
23
+ }
@@ -0,0 +1,19 @@
1
+ function Test() {
2
+ return (
3
+ <FullscreenModal>
4
+ {shouldDisplayHeader ? <FullscreenModal.Header title="With Header and Body" /> : null}
5
+ {shouldDisplayBody ? (
6
+ <View>
7
+ <LoremIpsum />
8
+ </View>
9
+ ) : null}
10
+ {shouldDisplayFooter ? (
11
+ <FullscreenModal.Footer shouldHandleBottomNotch={false}>
12
+ <Button stretch type="primary">
13
+ With Body and Footer
14
+ </Button>
15
+ </FullscreenModal.Footer>
16
+ ) : null}
17
+ </FullscreenModal>
18
+ );
19
+ }
@@ -0,0 +1,19 @@
1
+ function Test() {
2
+ return (
3
+ <FullscreenModal
4
+ footer={
5
+ <FullscreenModal.Footer shouldHandleBottomNotch={false}>
6
+ <Button stretch type="primary">
7
+ With Body and Footer
8
+ </Button>
9
+ </FullscreenModal.Footer>
10
+ }
11
+ header={<FullscreenModal.Header title="With Header and Body" />}
12
+ body={
13
+ <FullscreenModal.Body>
14
+ <LoremIpsum />
15
+ </FullscreenModal.Body>
16
+ }
17
+ />
18
+ );
19
+ }
@@ -0,0 +1,15 @@
1
+ function Test() {
2
+ return (
3
+ <FullscreenModal>
4
+ <FullscreenModal.Header title="With Header and Body" />
5
+ <FullscreenModal.Body>
6
+ <LoremIpsum />
7
+ </FullscreenModal.Body>
8
+ <FullscreenModal.Footer shouldHandleBottomNotch={false}>
9
+ <Button stretch type="primary">
10
+ With Body and Footer
11
+ </Button>
12
+ </FullscreenModal.Footer>
13
+ </FullscreenModal>
14
+ );
15
+ }
@@ -0,0 +1,19 @@
1
+ function Test() {
2
+ return (
3
+ <NavigationModal
4
+ header={<NavigationModal.Header title="With Header and Body" />}
5
+ body={
6
+ <NavigationModal.Body>
7
+ <LoremIpsum />
8
+ </NavigationModal.Body>
9
+ }
10
+ footer={
11
+ <NavigationModal.Footer shouldHandleBottomNotch={false}>
12
+ <Button stretch type="primary">
13
+ With Body and Footer
14
+ </Button>
15
+ </NavigationModal.Footer>
16
+ }
17
+ />
18
+ );
19
+ }
@@ -0,0 +1,15 @@
1
+ function Test() {
2
+ return (
3
+ <NavigationModal>
4
+ <NavigationModal.Header title="With Header and Body" />
5
+ <NavigationModal.Body>
6
+ <LoremIpsum />
7
+ </NavigationModal.Body>
8
+ <NavigationModal.Footer shouldHandleBottomNotch={false}>
9
+ <Button stretch type="primary">
10
+ With Body and Footer
11
+ </Button>
12
+ </NavigationModal.Footer>
13
+ </NavigationModal>
14
+ );
15
+ }
@@ -0,0 +1,23 @@
1
+ function Test() {
2
+ return (
3
+ <NavigationModal
4
+ header={shouldDisplayHeader ? <NavigationModal.Header title="With Header and Body" /> : null}
5
+ body={
6
+ shouldDisplayBody ? (
7
+ <View>
8
+ <LoremIpsum />
9
+ </View>
10
+ ) : null
11
+ }
12
+ footer={
13
+ shouldDisplayFooter ? (
14
+ <NavigationModal.Footer shouldHandleBottomNotch={false}>
15
+ <Button stretch type="primary">
16
+ With Body and Footer
17
+ </Button>
18
+ </NavigationModal.Footer>
19
+ ) : null
20
+ }
21
+ />
22
+ );
23
+ }
@@ -0,0 +1,19 @@
1
+ function Test() {
2
+ return (
3
+ <NavigationModal>
4
+ {shouldDisplayHeader ? <NavigationModal.Header title="With Header and Body" /> : null}
5
+ {shouldDisplayBody ? (
6
+ <View>
7
+ <LoremIpsum />
8
+ </View>
9
+ ) : null}
10
+ {shouldDisplayFooter ? (
11
+ <NavigationModal.Footer shouldHandleBottomNotch={false}>
12
+ <Button stretch type="primary">
13
+ With Body and Footer
14
+ </Button>
15
+ </NavigationModal.Footer>
16
+ ) : null}
17
+ </NavigationModal>
18
+ );
19
+ }
@@ -0,0 +1,19 @@
1
+ function Test() {
2
+ return (
3
+ <NavigationModal
4
+ footer={
5
+ <NavigationModal.Footer shouldHandleBottomNotch={false}>
6
+ <Button stretch type="primary">
7
+ With Body and Footer
8
+ </Button>
9
+ </NavigationModal.Footer>
10
+ }
11
+ header={<NavigationModal.Header title="With Header and Body" />}
12
+ body={
13
+ <NavigationModal.Body>
14
+ <LoremIpsum />
15
+ </NavigationModal.Body>
16
+ }
17
+ />
18
+ );
19
+ }
@@ -0,0 +1,15 @@
1
+ function Test() {
2
+ return (
3
+ <NavigationModal>
4
+ <NavigationModal.Header title="With Header and Body" />
5
+ <NavigationModal.Body>
6
+ <LoremIpsum />
7
+ </NavigationModal.Body>
8
+ <NavigationModal.Footer shouldHandleBottomNotch={false}>
9
+ <Button stretch type="primary">
10
+ With Body and Footer
11
+ </Button>
12
+ </NavigationModal.Footer>
13
+ </NavigationModal>
14
+ );
15
+ }
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ jest.autoMockOff();
4
+ const { defineTest } = require('jscodeshift/dist/testUtils');
5
+
6
+ const tests = ['basic', 'withExpressions', 'wrongOrder'];
7
+
8
+ describe('CardModal', () => {
9
+ tests.forEach((test) => defineTest(__dirname, 'card-modal', null, `card-modal/${test}`));
10
+ });
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ jest.autoMockOff();
4
+ const { defineTest } = require('jscodeshift/dist/testUtils');
5
+
6
+ const tests = ['basic', 'withExpressions', 'wrongOrder'];
7
+
8
+ describe('FullscreenModal', () => {
9
+ tests.forEach((test) => defineTest(__dirname, 'fullscreen-modal', null, `fullscreen-modal/${test}`));
10
+ });
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ jest.autoMockOff();
4
+ const { defineTest } = require('jscodeshift/dist/testUtils');
5
+
6
+ const tests = ['basic', 'withExpressions', 'wrongOrder'];
7
+
8
+ describe('NavigationModal', () => {
9
+ tests.forEach((test) => defineTest(__dirname, 'navigation-modal', null, `navigation-modal/${test}`));
10
+ });
@@ -0,0 +1,101 @@
1
+ 'use strict';
2
+
3
+ // Transform CardModal from props-based API to children-based API
4
+ // Converts header, body, footer props to nested children in the correct order
5
+
6
+ // Use local jscodeshift instance directly
7
+ const jscodeshift = require('jscodeshift');
8
+ const prettier = require('prettier');
9
+
10
+ module.exports = async function transformer(fileInfo, api) {
11
+ // Use the jscodeshift API to parse the file
12
+ const j = api.jscodeshift || jscodeshift;
13
+
14
+ // Parse the source code of the file
15
+ const root = j(fileInfo.source);
16
+
17
+ // ----------- Start of transformer logic
18
+
19
+ // Find all CardModal JSX elements
20
+ root
21
+ .find(j.JSXElement, {
22
+ openingElement: {
23
+ name: {
24
+ name: 'CardModal',
25
+ },
26
+ },
27
+ })
28
+ .forEach((path) => {
29
+ const element = path.value;
30
+ const { openingElement } = element;
31
+
32
+ // Extract header, body, and footer props
33
+ const getAttributeByName = (attributes, name) => {
34
+ return attributes.find((attr) => attr.type === 'JSXAttribute' && attr.name.name === name);
35
+ };
36
+
37
+ const headerProp = getAttributeByName(openingElement.attributes, 'header');
38
+ const bodyProp = getAttributeByName(openingElement.attributes, 'body');
39
+ const footerProp = getAttributeByName(openingElement.attributes, 'footer');
40
+
41
+ // If we found any of these props, transform the element
42
+ if (headerProp || bodyProp || footerProp) {
43
+ // Remove the header, body, and footer attributes
44
+ openingElement.attributes = openingElement.attributes.filter((attr) => {
45
+ if (attr.type !== 'JSXAttribute') return true;
46
+ return !['header', 'body', 'footer'].includes(attr.name.name);
47
+ });
48
+
49
+ // Create children array in the correct order: header, body, footer
50
+ const children = [];
51
+
52
+ // Helper function to extract child from prop value
53
+ const extractChild = (propValue) => {
54
+ if (propValue.type === 'JSXExpressionContainer') {
55
+ // Check if the expression is a simple JSX element (not a conditional/complex expression)
56
+ if (propValue.expression.type === 'JSXElement') {
57
+ // For simple JSX elements, use them directly as children
58
+ return propValue.expression;
59
+ }
60
+ // For complex expressions (conditionals, etc.), keep as expression container
61
+ return propValue;
62
+ }
63
+ return propValue;
64
+ };
65
+
66
+ // Add header if it exists
67
+ if (headerProp && headerProp.value) {
68
+ children.push(extractChild(headerProp.value));
69
+ }
70
+
71
+ // Add body if it exists
72
+ if (bodyProp && bodyProp.value) {
73
+ children.push(extractChild(bodyProp.value));
74
+ }
75
+
76
+ // Add footer if it exists
77
+ if (footerProp && footerProp.value) {
78
+ children.push(extractChild(footerProp.value));
79
+ }
80
+
81
+ // Update the element to have children instead of being self-closing
82
+ if (children.length > 0) {
83
+ element.children = children;
84
+ element.closingElement = j.jsxClosingElement(j.jsxIdentifier('CardModal'));
85
+ openingElement.selfClosing = false;
86
+ }
87
+ }
88
+ });
89
+
90
+ // ----------- End of transformer logic
91
+
92
+ // Return the modified source code after transformation
93
+ const output = root.toSource({ quote: 'single' });
94
+
95
+ const prettierConfig = await prettier.resolveConfig(fileInfo.path);
96
+
97
+ return prettier.format(output, {
98
+ ...prettierConfig,
99
+ filepath: fileInfo.path,
100
+ });
101
+ };
@@ -0,0 +1,101 @@
1
+ 'use strict';
2
+
3
+ // Transform FullscreenModal from props-based API to children-based API
4
+ // Converts header, body, footer props to nested children in the correct order
5
+
6
+ // Use local jscodeshift instance directly
7
+ const jscodeshift = require('jscodeshift');
8
+ const prettier = require('prettier');
9
+
10
+ module.exports = async function transformer(fileInfo, api) {
11
+ // Use the jscodeshift API to parse the file
12
+ const j = api.jscodeshift || jscodeshift;
13
+
14
+ // Parse the source code of the file
15
+ const root = j(fileInfo.source);
16
+
17
+ // ----------- Start of transformer logic
18
+
19
+ // Find all FullscreenModal JSX elements
20
+ root
21
+ .find(j.JSXElement, {
22
+ openingElement: {
23
+ name: {
24
+ name: 'FullscreenModal',
25
+ },
26
+ },
27
+ })
28
+ .forEach((path) => {
29
+ const element = path.value;
30
+ const { openingElement } = element;
31
+
32
+ // Extract header, body, and footer props
33
+ const getAttributeByName = (attributes, name) => {
34
+ return attributes.find((attr) => attr.type === 'JSXAttribute' && attr.name.name === name);
35
+ };
36
+
37
+ const headerProp = getAttributeByName(openingElement.attributes, 'header');
38
+ const bodyProp = getAttributeByName(openingElement.attributes, 'body');
39
+ const footerProp = getAttributeByName(openingElement.attributes, 'footer');
40
+
41
+ // If we found any of these props, transform the element
42
+ if (headerProp || bodyProp || footerProp) {
43
+ // Remove the header, body, and footer attributes
44
+ openingElement.attributes = openingElement.attributes.filter((attr) => {
45
+ if (attr.type !== 'JSXAttribute') return true;
46
+ return !['header', 'body', 'footer'].includes(attr.name.name);
47
+ });
48
+
49
+ // Create children array in the correct order: header, body, footer
50
+ const children = [];
51
+
52
+ // Helper function to extract child from prop value
53
+ const extractChild = (propValue) => {
54
+ if (propValue.type === 'JSXExpressionContainer') {
55
+ // Check if the expression is a simple JSX element (not a conditional/complex expression)
56
+ if (propValue.expression.type === 'JSXElement') {
57
+ // For simple JSX elements, use them directly as children
58
+ return propValue.expression;
59
+ }
60
+ // For complex expressions (conditionals, etc.), keep as expression container
61
+ return propValue;
62
+ }
63
+ return propValue;
64
+ };
65
+
66
+ // Add header if it exists
67
+ if (headerProp && headerProp.value) {
68
+ children.push(extractChild(headerProp.value));
69
+ }
70
+
71
+ // Add body if it exists
72
+ if (bodyProp && bodyProp.value) {
73
+ children.push(extractChild(bodyProp.value));
74
+ }
75
+
76
+ // Add footer if it exists
77
+ if (footerProp && footerProp.value) {
78
+ children.push(extractChild(footerProp.value));
79
+ }
80
+
81
+ // Update the element to have children instead of being self-closing
82
+ if (children.length > 0) {
83
+ element.children = children;
84
+ element.closingElement = j.jsxClosingElement(j.jsxIdentifier('FullscreenModal'));
85
+ openingElement.selfClosing = false;
86
+ }
87
+ }
88
+ });
89
+
90
+ // ----------- End of transformer logic
91
+
92
+ // Return the modified source code after transformation
93
+ const output = root.toSource({ quote: 'single' });
94
+
95
+ const prettierConfig = await prettier.resolveConfig(fileInfo.path);
96
+
97
+ return prettier.format(output, {
98
+ ...prettierConfig,
99
+ filepath: fileInfo.path,
100
+ });
101
+ };