@cleartrip/ct-design-style-manager 4.0.0-rc → 5.0.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gs.d.ts","sourceRoot":"","sources":["../../src/globalLayoutStyles/gs.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiYb,CAAC"}
package/dist/index.d.ts CHANGED
@@ -3,4 +3,5 @@ import useWebMergeStyles from './useWebMergeStyles';
3
3
  import makeStyles from './makeStyles';
4
4
  import useNativeMergeStyles from './useNativeMergeStyles';
5
5
  export { useStyles, useWebMergeStyles, makeStyles, useNativeMergeStyles };
6
+ export { gs } from './globalLayoutStyles/gs';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,oBAAoB,EAAE,CAAC;AAC1E,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { Theme as ThemeType } from '@cleartrip/ct-design-theme';
2
- import type { NamedStyles } from '@cleartrip/ct-design-types';
3
- declare function makeStyles<T extends NamedStyles<T>>(styleFactory: (theme: ThemeType) => T | NamedStyles<T>, customTheme?: ThemeType): T;
2
+ import { NamedStyles } from '@cleartrip/ct-design-types';
3
+ declare function makeStyles<T extends NamedStyles<T>>(styleFactory: (theme: ThemeType) => T | NamedStyles<T> | NamedStyles<unknown>, customTheme?: ThemeType): T;
4
4
  export default makeStyles;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/makeStyles/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,IAAI,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAI9D,iBAAS,UAAU,CAAC,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,EAC1C,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EACtD,WAAW,CAAC,EAAE,SAAS,GACtB,CAAC,CAyDH;AAED,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/makeStyles/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,IAAI,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAIzD,iBAAS,UAAU,CAAC,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,EAC1C,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,EAC7E,WAAW,CAAC,EAAE,SAAS,GACtB,CAAC,CAyDH;AAED,eAAe,UAAU,CAAC"}
@@ -1,5 +1,6 @@
1
+ import { NamedStyles } from '@cleartrip/ct-design-types';
1
2
  import { StyleSheet } from 'react-native';
2
3
  import { Theme as ThemeType } from '@cleartrip/ct-design-theme';
3
- declare function makeStyles<T extends StyleSheet.NamedStyles<T>>(styleFactory: (theme: ThemeType) => T | StyleSheet.NamedStyles<T>, customTheme?: ThemeType): T | StyleSheet.NamedStyles<T>;
4
+ declare function makeStyles<T extends StyleSheet.NamedStyles<T>>(styleFactory: (theme: ThemeType) => T | NamedStyles<T> | NamedStyles<unknown>, customTheme?: ThemeType): T | NamedStyles<T> | NamedStyles<unknown>;
4
5
  export default makeStyles;
5
6
  //# sourceMappingURL=index.native.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../src/makeStyles/index.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEhE,iBAAS,UAAU,CAAC,CAAC,SAAS,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,EACrD,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,CAAC,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,EACjE,WAAW,CAAC,EAAE,SAAS,GACtB,CAAC,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAkC/B;AAED,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../src/makeStyles/index.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEhE,iBAAS,UAAU,CAAC,CAAC,SAAS,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,EACrD,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,EAC7E,WAAW,CAAC,EAAE,SAAS,GACtB,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,CAiC3C;AAED,eAAe,UAAU,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { DependencyList } from 'react';
2
2
  import { Theme as ThemeType } from '@cleartrip/ct-design-theme';
3
3
  import type { NamedStyles } from '@cleartrip/ct-design-types';
4
- declare function useStyles<T extends NamedStyles<T>>(styleFactory: (theme: ThemeType) => T | NamedStyles<T>, dep: DependencyList): T;
4
+ declare function useStyles<T extends NamedStyles<T>>(styleFactory: (theme: ThemeType) => T | NamedStyles<T> | NamedStyles<unknown>, dep: DependencyList): T;
5
5
  export default useStyles;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useStyles/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAK9D,iBAAS,SAAS,CAAC,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,EACzC,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EACtD,GAAG,EAAE,cAAc,GAClB,CAAC,CASH;AAED,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useStyles/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAK9D,iBAAS,SAAS,CAAC,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,EACzC,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,EAC7E,GAAG,EAAE,cAAc,GAClB,CAAC,CASH;AAED,eAAe,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleartrip/ct-design-style-manager",
3
- "version": "4.0.0-rc",
3
+ "version": "5.0.0",
4
4
  "description": "Style hooks",
5
5
  "types": "dist/index.d.ts",
6
6
  "react-native": "src/index.ts",
@@ -19,11 +19,11 @@
19
19
  "dependencies": {
20
20
  "@emotion/css": "11.13.4",
21
21
  "@react-native/normalize-colors": "^0.78.1",
22
- "@cleartrip/ct-design-theme": "4.0.0-rc",
23
- "@cleartrip/ct-design-types": "4.0.0-rc"
22
+ "@cleartrip/ct-design-theme": "5.0.0",
23
+ "@cleartrip/ct-design-types": "5.0.0"
24
24
  },
25
25
  "devDependencies": {
26
- "@cleartrip/ct-design-types": "4.0.0-rc"
26
+ "@cleartrip/ct-design-types": "5.0.0"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "react": ">=16.8.0",
@@ -0,0 +1,390 @@
1
+ import makeStyles from '../makeStyles';
2
+
3
+ /** Legacy Global-style layout utility map (AldenUI `Global` / trains `gs`). */
4
+
5
+ export const gs = makeStyles((theme) => {
6
+ const { spacing } = theme;
7
+ return {
8
+ // Display
9
+ flex: { display: 'flex' as const },
10
+ 'flex-1': { flex: 1 },
11
+
12
+ // Flex Direction
13
+ 'flex-row': { flexDirection: 'row' as const },
14
+ 'flex-column': { flexDirection: 'column' as const },
15
+ 'flex-row-reverse': { flexDirection: 'row-reverse' as const },
16
+ 'flex-column-reverse': { flexDirection: 'column-reverse' as const },
17
+
18
+ // font weights
19
+ 'fw-400': { fontWeight: '400' as const },
20
+ 'fw-500': { fontWeight: '500' as const },
21
+ 'fw-600': { fontWeight: '600' as const },
22
+
23
+ // Flex Wrap
24
+ 'flex-nowrap': { flexWrap: 'nowrap' as const },
25
+ 'flex-wrap': { flexWrap: 'wrap' as const },
26
+ 'flex-wrap-reverse': { flexWrap: 'wrap-reverse' as const },
27
+
28
+ // Flex Shrink
29
+ 'flex-no-shrink': { flexShrink: spacing[0] },
30
+
31
+ // Align Items
32
+ 'flex-stretch': { alignItems: 'stretch' as const },
33
+ 'flex-top': { alignItems: 'flex-start' as const },
34
+ 'flex-middle': { alignItems: 'center' as const },
35
+ 'flex-bottom': { alignItems: 'flex-end' as const },
36
+ 'flex-baseline': { alignItems: 'baseline' as const },
37
+
38
+ // Align Content
39
+ 'flex-wrap-stretch': { alignContent: 'stretch' as const },
40
+ 'flex-wrap-top': { alignContent: 'flex-start' as const },
41
+ 'flex-wrap-middle': { alignContent: 'center' as const },
42
+ 'flex-wrap-bottom': { alignContent: 'flex-end' as const },
43
+ 'flex-wrap-between': { alignContent: 'space-between' as const },
44
+ 'flex-wrap-around': { alignContent: 'space-around' as const },
45
+
46
+ // Justify Content
47
+ 'flex-left': { justifyContent: 'flex-start' as const },
48
+ 'flex-start': { justifyContent: 'flex-start' as const },
49
+ 'flex-end': { justifyContent: 'flex-end' as const },
50
+ 'flex-right': { justifyContent: 'flex-end' as const },
51
+ 'flex-center': { justifyContent: 'center' as const },
52
+ 'flex-between': { justifyContent: 'space-between' as const },
53
+ 'flex-around': { justifyContent: 'space-around' as const },
54
+
55
+ // Flex Basis
56
+ 'flex-basis-auto': { flexBasis: 'auto' as const },
57
+
58
+ // Row Gap
59
+ 'flex-rg-1': { rowGap: spacing[1] },
60
+ 'flex-rg-2': { rowGap: spacing[2] },
61
+ 'flex-rg-3': { rowGap: spacing[3] },
62
+ 'flex-rg-4': { rowGap: spacing[4] },
63
+ 'flex-rg-6': { rowGap: spacing[6] },
64
+ 'flex-rg-7': { rowGap: spacing[7] },
65
+ 'flex-rg-8': { rowGap: spacing[8] },
66
+ 'flex-rg-9': { rowGap: spacing[9] },
67
+ 'flex-rg-10': { rowGap: spacing[10] },
68
+
69
+ // Column Gap
70
+ 'flex-cg-1': { columnGap: spacing[1] },
71
+ 'flex-cg-2': { columnGap: spacing[2] },
72
+ 'flex-cg-3': { columnGap: spacing[3] },
73
+ 'flex-cg-4': { columnGap: spacing[4] },
74
+ 'flex-cg-6': { columnGap: spacing[6] },
75
+
76
+ // Gap
77
+ 'flex-gap-0.5': { gap: spacing['0.5'] },
78
+ 'flex-gap-1': { gap: spacing[1] },
79
+ 'flex-gap-1.5': { gap: spacing['1.5'] },
80
+ 'flex-gap-2': { gap: spacing[2] },
81
+ 'flex-gap-3': { gap: spacing[3] },
82
+ 'flex-gap-4': { gap: spacing[4] },
83
+ 'flex-gap-6': { gap: spacing[6] },
84
+
85
+ // Width
86
+ 'w-0p': { width: '0%' as const },
87
+ 'w-10p': { width: '10%' as const },
88
+ 'w-20p': { width: '20%' as const },
89
+ 'w-30p': { width: '30%' as const },
90
+ 'w-40p': { width: '40%' as const },
91
+ 'w-50p': { width: '50%' as const },
92
+ 'w-60p': { width: '60%' as const },
93
+ 'w-70p': { width: '70%' as const },
94
+ 'w-80p': { width: '80%' as const },
95
+ 'w-90p': { width: '90%' as const },
96
+ 'w-100p': { width: '100%' as const },
97
+ 'w-0': { width: spacing[0] },
98
+ 'w-1': { width: spacing[1] },
99
+ 'w-2': { width: spacing[2] },
100
+ 'w-3': { width: spacing[3] },
101
+ 'w-4': { width: spacing[4] },
102
+ 'w-5': { width: spacing[5] },
103
+ 'w-6': { width: spacing[6] },
104
+ 'w-7': { width: spacing[7] },
105
+ 'w-8': { width: spacing[8] },
106
+ 'w-9': { width: spacing[9] },
107
+ 'w-10': { width: spacing[10] },
108
+ 'w-14': { width: spacing[14] },
109
+ 'w-16': { width: spacing[16] },
110
+
111
+ // top
112
+ 't-0': { top: 0 },
113
+
114
+ // bottoms
115
+ 'b-0': { bottom: 0 },
116
+
117
+ // lefts
118
+ 'l-0': { left: 0 },
119
+
120
+ // Height
121
+ 'h-0p': { height: '0%' as const },
122
+ 'h-10p': { height: '10%' as const },
123
+ 'h-20p': { height: '20%' as const },
124
+ 'h-30p': { height: '30%' as const },
125
+ 'h-40p': { height: '40%' as const },
126
+ 'h-50p': { height: '50%' as const },
127
+ 'h-60p': { height: '60%' as const },
128
+ 'h-70p': { height: '70%' as const },
129
+ 'h-80p': { height: '80%' as const },
130
+ 'h-90p': { height: '90%' as const },
131
+ 'h-100p': { height: '100%' as const },
132
+ 'h-0': { height: spacing[0] },
133
+ 'h-1': { height: spacing[1] },
134
+ 'h-2': { height: spacing[2] },
135
+ 'h-3': { height: spacing[3] },
136
+ 'h-4': { height: spacing[4] },
137
+ 'h-5': { height: spacing[5] },
138
+ 'h-6': { height: spacing[6] },
139
+ 'h-7': { height: spacing[7] },
140
+ 'h-8': { height: spacing[8] },
141
+ 'h-9': { height: spacing[9] },
142
+ 'h-10': { height: spacing[10] },
143
+ 'h-14': { height: spacing[14] },
144
+ 'h-16': { height: spacing[16] },
145
+
146
+ // Margin
147
+ 'm-0': { margin: spacing[0] },
148
+ 'm-1': { margin: spacing[1] },
149
+ 'm-2': { margin: spacing[2] },
150
+ 'm-3': { margin: spacing[3] },
151
+ 'm-4': { margin: spacing[4] },
152
+ 'm-5': { margin: spacing[5] },
153
+ 'm-6': { margin: spacing[6] },
154
+ 'm-7': { margin: spacing[7] },
155
+ 'm-8': { margin: spacing[8] },
156
+ 'm-9': { margin: spacing[9] },
157
+ 'm-10': { margin: spacing[10] },
158
+
159
+ // Margin Top
160
+ 'mt-0': { marginTop: spacing[0] },
161
+ 'mt-1': { marginTop: spacing[1] },
162
+ 'mt-2': { marginTop: spacing[2] },
163
+ 'mt-3': { marginTop: spacing[3] },
164
+ 'mt-4': { marginTop: spacing[4] },
165
+ 'mt-5': { marginTop: spacing[5] },
166
+ 'mt-6': { marginTop: spacing[6] },
167
+ 'mt-7': { marginTop: spacing[7] },
168
+ 'mt-8': { marginTop: spacing[8] },
169
+ 'mt-9': { marginTop: spacing[9] },
170
+ 'mt-10': { marginTop: spacing[10] },
171
+
172
+ // Margin Bottom
173
+ 'mb-0': { marginBottom: spacing[0] },
174
+ 'mb-1': { marginBottom: spacing[1] },
175
+ 'mb-2': { marginBottom: spacing[2] },
176
+ 'mb-3': { marginBottom: spacing[3] },
177
+ 'mb-4': { marginBottom: spacing[4] },
178
+ 'mb-5': { marginBottom: spacing[5] },
179
+ 'mb-6': { marginBottom: spacing[6] },
180
+ 'mb-7': { marginBottom: spacing[7] },
181
+ 'mb-8': { marginBottom: spacing[8] },
182
+ 'mb-9': { marginBottom: spacing[9] },
183
+ 'mb-10': { marginBottom: spacing[10] },
184
+
185
+ // Margin Left
186
+ 'ml-0': { marginLeft: spacing[0] },
187
+ 'ml-1': { marginLeft: spacing[1] },
188
+ 'ml-2': { marginLeft: spacing[2] },
189
+ 'ml-3': { marginLeft: spacing[3] },
190
+ 'ml-4': { marginLeft: spacing[4] },
191
+ 'ml-5': { marginLeft: spacing[5] },
192
+ 'ml-6': { marginLeft: spacing[6] },
193
+ 'ml-7': { marginLeft: spacing[7] },
194
+ 'ml-8': { marginLeft: spacing[8] },
195
+ 'ml-9': { marginLeft: spacing[9] },
196
+ 'ml-10': { marginLeft: spacing[10] },
197
+
198
+ // Margin Right
199
+ 'mr-0': { marginRight: spacing[0] },
200
+ 'mr-1': { marginRight: spacing[1] },
201
+ 'mr-1.5': { marginRight: spacing['1.5'] },
202
+ 'mr-2': { marginRight: spacing[2] },
203
+ 'mr-3': { marginRight: spacing[3] },
204
+ 'mr-4': { marginRight: spacing[4] },
205
+ 'mr-5': { marginRight: spacing[5] },
206
+ 'mr-6': { marginRight: spacing[6] },
207
+ 'mr-7': { marginRight: spacing[7] },
208
+ 'mr-8': { marginRight: spacing[8] },
209
+ 'mr-9': { marginRight: spacing[9] },
210
+ 'mr-10': { marginRight: spacing[10] },
211
+
212
+ // Margin Horizontal
213
+ 'mx-0': { marginHorizontal: spacing[0] },
214
+ 'mx-1': { marginHorizontal: spacing[1] },
215
+ 'mx-2': { marginHorizontal: spacing[2] },
216
+ 'mx-3': { marginHorizontal: spacing[3] },
217
+ 'mx-4': { marginHorizontal: spacing[4] },
218
+ 'mx-5': { marginHorizontal: spacing[5] },
219
+ 'mx-6': { marginHorizontal: spacing[6] },
220
+ 'mx-7': { marginHorizontal: spacing[7] },
221
+ 'mx-8': { marginHorizontal: spacing[8] },
222
+ 'mx-9': { marginHorizontal: spacing[9] },
223
+ 'mx-10': { marginHorizontal: spacing[10] },
224
+
225
+ // Margin Vertical
226
+ 'my-0': { marginVertical: spacing[0] },
227
+ 'my-1': { marginVertical: spacing[1] },
228
+ 'my-2': { marginVertical: spacing[2] },
229
+ 'my-3': { marginVertical: spacing[3] },
230
+ 'my-4': { marginVertical: spacing[4] },
231
+ 'my-5': { marginVertical: spacing[5] },
232
+ 'my-6': { marginVertical: spacing[6] },
233
+ 'my-7': { marginVertical: spacing[7] },
234
+ 'my-8': { marginVertical: spacing[8] },
235
+ 'my-9': { marginVertical: spacing[9] },
236
+ 'my-10': { marginVertical: spacing[10] },
237
+
238
+ // Padding
239
+ 'p-0': { padding: spacing[0] },
240
+ 'p-1': { padding: spacing[1] },
241
+ 'p-2': { padding: spacing[2] },
242
+ 'p-3': { padding: spacing[3] },
243
+ 'p-4': { padding: spacing[4] },
244
+ 'p-5': { padding: spacing[5] },
245
+ 'p-6': { padding: spacing[6] },
246
+ 'p-7': { padding: spacing[7] },
247
+ 'p-8': { padding: spacing[8] },
248
+ 'p-9': { padding: spacing[9] },
249
+ 'p-10': { padding: spacing[10] },
250
+
251
+ // Padding Top
252
+ 'pt-0': { paddingTop: spacing[0] },
253
+ 'pt-1': { paddingTop: spacing[1] },
254
+ 'pt-2': { paddingTop: spacing[2] },
255
+ 'pt-3': { paddingTop: spacing[3] },
256
+ 'pt-4': { paddingTop: spacing[4] },
257
+ 'pt-5': { paddingTop: spacing[5] },
258
+ 'pt-6': { paddingTop: spacing[6] },
259
+ 'pt-7': { paddingTop: spacing[7] },
260
+ 'pt-8': { paddingTop: spacing[8] },
261
+ 'pt-9': { paddingTop: spacing[9] },
262
+ 'pt-10': { paddingTop: spacing[10] },
263
+ 'pt-16': { paddingTop: spacing[16] },
264
+ 'pt-12': { paddingTop: spacing[12] },
265
+
266
+ // Padding Bottom
267
+ 'pb-0': { paddingBottom: spacing[0] },
268
+ 'pb-1': { paddingBottom: spacing[1] },
269
+ 'pb-2': { paddingBottom: spacing[2] },
270
+ 'pb-3': { paddingBottom: spacing[3] },
271
+ 'pb-4': { paddingBottom: spacing[4] },
272
+ 'pb-5': { paddingBottom: spacing[5] },
273
+ 'pb-6': { paddingBottom: spacing[6] },
274
+ 'pb-7': { paddingBottom: spacing[7] },
275
+ 'pb-8': { paddingBottom: spacing[8] },
276
+ 'pb-9': { paddingBottom: spacing[9] },
277
+ 'pb-10': { paddingBottom: spacing[10] },
278
+
279
+ // Padding Left
280
+ 'pl-0': { paddingLeft: spacing[0] },
281
+ 'pl-1': { paddingLeft: spacing[1] },
282
+ 'pl-2': { paddingLeft: spacing[2] },
283
+ 'pl-3': { paddingLeft: spacing[3] },
284
+ 'pl-4': { paddingLeft: spacing[4] },
285
+ 'pl-5': { paddingLeft: spacing[5] },
286
+ 'pl-6': { paddingLeft: spacing[6] },
287
+ 'pl-7': { paddingLeft: spacing[7] },
288
+ 'pl-8': { paddingLeft: spacing[8] },
289
+ 'pl-9': { paddingLeft: spacing[9] },
290
+ 'pl-10': { paddingLeft: spacing[10] },
291
+
292
+ // Padding Right
293
+ 'pr-0': { paddingRight: spacing[0] },
294
+ 'pr-1': { paddingRight: spacing[1] },
295
+ 'pr-2': { paddingRight: spacing[2] },
296
+ 'pr-3': { paddingRight: spacing[3] },
297
+ 'pr-4': { paddingRight: spacing[4] },
298
+ 'pr-5': { paddingRight: spacing[5] },
299
+ 'pr-6': { paddingRight: spacing[6] },
300
+ 'pr-7': { paddingRight: spacing[7] },
301
+ 'pr-8': { paddingRight: spacing[8] },
302
+ 'pr-9': { paddingRight: spacing[9] },
303
+ 'pr-10': { paddingRight: spacing[10] },
304
+
305
+ // Padding Horizontal
306
+ 'px-0': { paddingHorizontal: spacing[0] },
307
+ 'px-0.5': { paddingHorizontal: spacing['0.5'] },
308
+ 'px-1': { paddingHorizontal: spacing[1] },
309
+ 'px-2': { paddingHorizontal: spacing[2] },
310
+ 'px-3': { paddingHorizontal: spacing[3] },
311
+ 'px-4': { paddingHorizontal: spacing[4] },
312
+ 'px-5': { paddingHorizontal: spacing[5] },
313
+ 'px-6': { paddingHorizontal: spacing[6] },
314
+ 'px-7': { paddingHorizontal: spacing[7] },
315
+ 'px-8': { paddingHorizontal: spacing[8] },
316
+ 'px-9': { paddingHorizontal: spacing[9] },
317
+ 'px-10': { paddingHorizontal: spacing[10] },
318
+
319
+ // Padding Vertical
320
+ 'py-0': { paddingVertical: spacing[0] },
321
+ 'py-0.5': { paddingVertical: spacing['0.5'] },
322
+ 'py-1': { paddingVertical: spacing[1] },
323
+ 'py-2': { paddingVertical: spacing[2] },
324
+ 'py-3': { paddingVertical: spacing[3] },
325
+ 'py-4': { paddingVertical: spacing[4] },
326
+ 'py-5': { paddingVertical: spacing[5] },
327
+ 'py-6': { paddingVertical: spacing[6] },
328
+ 'py-7': { paddingVertical: spacing[7] },
329
+ 'py-8': { paddingVertical: spacing[8] },
330
+ 'py-9': { paddingVertical: spacing[9] },
331
+ 'py-10': { paddingVertical: spacing[10] },
332
+
333
+ // border-radius
334
+ 'br-50p': { borderRadius: 50 },
335
+ 'br-4': { borderRadius: 4 },
336
+ 'br-8': { borderRadius: 8 },
337
+ 'br-12': { borderRadius: 12 },
338
+ 'br-16': { borderRadius: 16 },
339
+ 'br-20': { borderRadius: 20 },
340
+
341
+ // z-index
342
+ 'z-0': { zIndex: 0 },
343
+ 'z-1': { zIndex: 1 },
344
+ 'z-2': { zIndex: 2 },
345
+ 'z-5': { zIndex: 5 },
346
+ 'z-10': { zIndex: 10 },
347
+ 'z-100': { zIndex: 100 },
348
+
349
+ // colors
350
+ 'bg-neutral-100': { backgroundColor: '#ffffff' },
351
+
352
+ // positions
353
+ 'p-relative': { position: 'relative' as const },
354
+ 'p-absolute': { position: 'absolute' as const },
355
+
356
+ // shadow
357
+ 'bs-shadow-top-white': {
358
+ shadowColor: '#1a1a1a',
359
+ shadowOffset: { width: 0, height: -4 },
360
+ shadowOpacity: 0.08,
361
+ shadowRadius: 16,
362
+ elevation: 5,
363
+ },
364
+ 'bs-shadow-bottom-white': {
365
+ shadowColor: '#1a1a1a',
366
+ shadowOffset: { width: 0, height: 2 },
367
+ shadowOpacity: 0.08,
368
+ shadowRadius: 16,
369
+ elevation: 5,
370
+ },
371
+
372
+ // overflow
373
+ 'o-hidden': {
374
+ overflow: 'hidden' as const,
375
+ },
376
+
377
+ // text align
378
+ 'ta-c': {
379
+ textAlign: 'center' as const,
380
+ },
381
+
382
+ 'ta-l': {
383
+ textAlign: 'left' as const,
384
+ },
385
+
386
+ 'ta-r': {
387
+ textAlign: 'right' as const,
388
+ },
389
+ };
390
+ });
package/src/index.ts CHANGED
@@ -4,3 +4,4 @@ import makeStyles from './makeStyles';
4
4
  import useNativeMergeStyles from './useNativeMergeStyles';
5
5
 
6
6
  export { useStyles, useWebMergeStyles, makeStyles, useNativeMergeStyles };
7
+ export { gs } from './globalLayoutStyles/gs';
@@ -1,11 +1,12 @@
1
+ import { NamedStyles } from '@cleartrip/ct-design-types';
1
2
  import { StyleSheet } from 'react-native';
2
3
  import { ThemeManager } from '@cleartrip/ct-design-theme';
3
4
  import { Theme as ThemeType } from '@cleartrip/ct-design-theme';
4
5
 
5
6
  function makeStyles<T extends StyleSheet.NamedStyles<T>>(
6
- styleFactory: (theme: ThemeType) => T | StyleSheet.NamedStyles<T>,
7
+ styleFactory: (theme: ThemeType) => T | NamedStyles<T> | NamedStyles<unknown>,
7
8
  customTheme?: ThemeType,
8
- ): T | StyleSheet.NamedStyles<T> {
9
+ ): T | NamedStyles<T> | NamedStyles<unknown> {
9
10
  /**
10
11
  * Get the current theme.
11
12
  */
@@ -34,10 +35,9 @@ function makeStyles<T extends StyleSheet.NamedStyles<T>>(
34
35
  styles as unknown as { [s: string]: (theme: ThemeType) => unknown },
35
36
  )) {
36
37
  const updatedValue = typeof value === 'function' ? value(theme) : value;
37
- styles[key as keyof T] = updatedValue as (T | StyleSheet.NamedStyles<T>)[keyof T];
38
+ styles[key] = updatedValue;
38
39
  }
39
40
 
40
- // @ts-ignore
41
41
  return StyleSheet.create(styles);
42
42
  }
43
43
 
@@ -1,12 +1,12 @@
1
1
  /* eslint-disable @typescript-eslint/no-unsafe-assignment */
2
2
  import { css } from '@emotion/css';
3
3
  import { ThemeManager, Theme as ThemeType } from '@cleartrip/ct-design-theme';
4
- import type { NamedStyles } from '@cleartrip/ct-design-types';
4
+ import { NamedStyles } from '@cleartrip/ct-design-types';
5
5
  import preprocess from './preprocess';
6
6
  import { validate } from './validate';
7
7
 
8
8
  function makeStyles<T extends NamedStyles<T>>(
9
- styleFactory: (theme: ThemeType) => T | NamedStyles<T>,
9
+ styleFactory: (theme: ThemeType) => T | NamedStyles<T> | NamedStyles<unknown>,
10
10
  customTheme?: ThemeType,
11
11
  ): T {
12
12
  /**
@@ -36,7 +36,7 @@ function makeStyles<T extends NamedStyles<T>>(
36
36
  for (const [key, value] of Object.entries<unknown | ((theme: ThemeType) => unknown)>(styles)) {
37
37
  const updatedValue = typeof value === 'function' ? value(theme) : value;
38
38
 
39
- styles[key as keyof T] = updatedValue;
39
+ styles[key] = updatedValue;
40
40
  }
41
41
 
42
42
  /**
@@ -14,7 +14,7 @@ function useNativeMergeStyles<T extends ViewStyle | ImageStyle | TextStyle>(
14
14
  deps: DependencyList,
15
15
  ): StyleProp<T> {
16
16
  return useStableMemo(() => {
17
- if (getStyles<T>(styles)) {
17
+ if (getStyles<T>(styles.filter(Boolean))) {
18
18
  return StyleSheet.compose(null, styles);
19
19
  }
20
20
  }, deps);
@@ -8,13 +8,13 @@ import useStableMemo from '../useStableMemo';
8
8
  import makeStyles from '../makeStyles';
9
9
 
10
10
  function useStyles<T extends NamedStyles<T>>(
11
- styleFactory: (theme: ThemeType) => T | NamedStyles<T>,
11
+ styleFactory: (theme: ThemeType) => T | NamedStyles<T> | NamedStyles<unknown>,
12
12
  dep: DependencyList,
13
13
  ): T {
14
14
  const theme = useTheme();
15
15
 
16
16
  return useStableMemo(() => {
17
- const adaptedFactory = (providedTheme: ThemeType): T | NamedStyles<T> => {
17
+ const adaptedFactory = (providedTheme: ThemeType): T | NamedStyles<T> | NamedStyles<unknown> => {
18
18
  return styleFactory(providedTheme);
19
19
  };
20
20
  return makeStyles(adaptedFactory, theme);
@@ -16,7 +16,7 @@ import preprocess from '../makeStyles/preprocess';
16
16
  const useWebMergeStyles = <T extends Styles | string>(styles: T[], deps: DependencyList) => {
17
17
  return useStableMemo(() => {
18
18
  const classes: string[] = [];
19
- styles.forEach((style) => {
19
+ styles.filter(Boolean).forEach((style) => {
20
20
  if (typeof style === 'string') {
21
21
  classes.push(style);
22
22
  } else {
@@ -1,13 +0,0 @@
1
- import { Styles } from '@cleartrip/ct-design-types';
2
- type NeverString<T> = T extends string ? never : T;
3
- type WeakStyle = NeverString<Styles>;
4
- declare class StylingCacheManager {
5
- static instance: StylingCacheManager;
6
- private cache;
7
- constructor();
8
- set(key: WeakStyle, value: string): void;
9
- get(key: WeakStyle): string | undefined;
10
- }
11
- declare const StylingCache: Readonly<StylingCacheManager>;
12
- export default StylingCache;
13
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/StylingCache/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,KAAK,GAAG,CAAC,CAAC;AAEnD,KAAK,SAAS,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAErC,cAAM,mBAAmB;IACvB,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IACrC,OAAO,CAAC,KAAK,CAA6B;;IAgB1C,GAAG,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM;IASjC,GAAG,CAAC,GAAG,EAAE,SAAS;CAGnB;AAED,QAAA,MAAM,YAAY,+BAA2C,CAAC;AAC9D,eAAe,YAAY,CAAC"}
@@ -1,40 +0,0 @@
1
- import { Styles } from '@cleartrip/ct-design-types';
2
-
3
- type NeverString<T> = T extends string ? never : T;
4
-
5
- type WeakStyle = NeverString<Styles>;
6
-
7
- class StylingCacheManager {
8
- static instance: StylingCacheManager;
9
- private cache: WeakMap<WeakStyle, string>;
10
-
11
- constructor() {
12
- if (StylingCacheManager.instance) {
13
- throw new Error('You can only create one instance!');
14
- }
15
- StylingCacheManager.instance = this;
16
- this.cache = new WeakMap();
17
- }
18
-
19
- /**
20
- *
21
- * @param key Key is primarily the page name or any unique string
22
- * @param value Value is the slot node index and it corresponding height
23
- * @description This method is used to set new cache or replace the entire existing cache key
24
- */
25
- set(key: WeakStyle, value: string) {
26
- this.cache.set(key, value);
27
- }
28
-
29
- /**
30
- *
31
- * @param key Key is primarily the page name or any unique string
32
- * @returns This method returns the cache data if the cache exists or undefined if it does not
33
- */
34
- get(key: WeakStyle) {
35
- return this.cache.get(key);
36
- }
37
- }
38
-
39
- const StylingCache = Object.freeze(new StylingCacheManager());
40
- export default StylingCache;