jp-composter 0.1.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.
- package/dist/index.d.mts +997 -0
- package/dist/index.d.ts +997 -0
- package/dist/index.js +36837 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +36778 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +66 -0
- package/src/SliceUI/IconMoon.tsx +33 -0
- package/src/SliceUI/assets/Anatomy diagram copy.svg +19 -0
- package/src/SliceUI/assets/Anatomy diagram.svg +19 -0
- package/src/SliceUI/assets/Anatomycheck.svg +15 -0
- package/src/SliceUI/assets/Anatomyinput.svg +32 -0
- package/src/SliceUI/assets/Checkbox.jpg +0 -0
- package/src/SliceUI/assets/Diagram copy.svg +15 -0
- package/src/SliceUI/assets/Diagram.jpg +0 -0
- package/src/SliceUI/assets/Diagram.svg +15 -0
- package/src/SliceUI/assets/Frame 5 copy.png +0 -0
- package/src/SliceUI/assets/Frame 5.png +0 -0
- package/src/SliceUI/assets/Frame 65.png +0 -0
- package/src/SliceUI/assets/Frame_65.png +0 -0
- package/src/SliceUI/assets/Icon copy.svg +3 -0
- package/src/SliceUI/assets/Icon.svg +3 -0
- package/src/SliceUI/assets/Icon_Bridging copy.svg +39 -0
- package/src/SliceUI/assets/Icon_Bridging.svg +39 -0
- package/src/SliceUI/assets/Icon_Consistent copy.svg +39 -0
- package/src/SliceUI/assets/Icon_Consistent.svg +39 -0
- package/src/SliceUI/assets/Icon_Plug copy.svg +38 -0
- package/src/SliceUI/assets/Icon_Plug.svg +38 -0
- package/src/SliceUI/assets/Icon_Reusable copy.svg +39 -0
- package/src/SliceUI/assets/Icon_Reusable.svg +39 -0
- package/src/SliceUI/assets/Layer_1.png +0 -0
- package/src/SliceUI/assets/accessibility.png +0 -0
- package/src/SliceUI/assets/accessibility.svg +1 -0
- package/src/SliceUI/assets/addon-library.png +0 -0
- package/src/SliceUI/assets/assets.png +0 -0
- package/src/SliceUI/assets/avif-test-image.avif +0 -0
- package/src/SliceUI/assets/bridging.svg +13 -0
- package/src/SliceUI/assets/consistent.svg +11 -0
- package/src/SliceUI/assets/context.png +0 -0
- package/src/SliceUI/assets/discord.svg +1 -0
- package/src/SliceUI/assets/docs.png +0 -0
- package/src/SliceUI/assets/figma-plugin.png +0 -0
- package/src/SliceUI/assets/github.svg +1 -0
- package/src/SliceUI/assets/resources/Anatomy diagram.svg +19 -0
- package/src/SliceUI/assets/resources/Anatomycheck.svg +15 -0
- package/src/SliceUI/assets/resources/Anatomyinput.svg +32 -0
- package/src/SliceUI/assets/resources/Diagram.svg +15 -0
- package/src/SliceUI/assets/resources/Frame 5.png +0 -0
- package/src/SliceUI/assets/resources/Frame 65.png +0 -0
- package/src/SliceUI/assets/resources/Icon.svg +3 -0
- package/src/SliceUI/assets/resources/Icon_Bridging.svg +39 -0
- package/src/SliceUI/assets/resources/Icon_Consistent.svg +39 -0
- package/src/SliceUI/assets/resources/Icon_Plug.svg +38 -0
- package/src/SliceUI/assets/resources/Icon_Reusable.svg +39 -0
- package/src/SliceUI/assets/resources/fonts/FontIcon.json +150 -0
- package/src/SliceUI/assets/resources/fonts/Lato-Black.ttf +0 -0
- package/src/SliceUI/assets/resources/fonts/Lato-Bold.ttf +0 -0
- package/src/SliceUI/assets/resources/fonts/Lato-Heavy.ttf +0 -0
- package/src/SliceUI/assets/resources/fonts/Lato-Medium.ttf +0 -0
- package/src/SliceUI/assets/resources/fonts/Lato-Regular.ttf +0 -0
- package/src/SliceUI/assets/resources/fonts/Lato.woff2 +0 -0
- package/src/SliceUI/assets/resources/fonts/icomoon.eot +0 -0
- package/src/SliceUI/assets/resources/fonts/icomoon.svg +601 -0
- package/src/SliceUI/assets/resources/fonts/icomoon.ttf +0 -0
- package/src/SliceUI/assets/resources/fonts/icomoon.woff +0 -0
- package/src/SliceUI/assets/resources/fonts/selection.json +1 -0
- package/src/SliceUI/assets/share.png +0 -0
- package/src/SliceUI/assets/styling.png +0 -0
- package/src/SliceUI/assets/testing.png +0 -0
- package/src/SliceUI/assets/theming.png +0 -0
- package/src/SliceUI/assets/tutorials.svg +1 -0
- package/src/SliceUI/assets/youtube.svg +1 -0
- package/src/SliceUI/automation/helper.ts +29 -0
- package/src/SliceUI/avatar/Avatar.tsx +237 -0
- package/src/SliceUI/avatar/Token.ts +116 -0
- package/src/SliceUI/avatar/Type.ts +36 -0
- package/src/SliceUI/avatar/helper.ts +53 -0
- package/src/SliceUI/badge/Badge.tsx +308 -0
- package/src/SliceUI/badge/Token.ts +202 -0
- package/src/SliceUI/badge/Type.ts +46 -0
- package/src/SliceUI/badge/helper.ts +39 -0
- package/src/SliceUI/button/Button.tsx +243 -0
- package/src/SliceUI/button/Token.ts +138 -0
- package/src/SliceUI/button/Type.ts +34 -0
- package/src/SliceUI/button/helper.ts +125 -0
- package/src/SliceUI/checkbox/Checkbox.tsx +176 -0
- package/src/SliceUI/checkbox/Token.ts +128 -0
- package/src/SliceUI/checkbox/Type.ts +35 -0
- package/src/SliceUI/chip/Chip.tsx +290 -0
- package/src/SliceUI/chip/Token.ts +151 -0
- package/src/SliceUI/chip/Type.ts +43 -0
- package/src/SliceUI/chip/helper.ts +40 -0
- package/src/SliceUI/colors/Pallete.ts +151 -0
- package/src/SliceUI/colors/Token.ts +110 -0
- package/src/SliceUI/colors/Type.ts +56 -0
- package/src/SliceUI/contextProvider/context.tsx +108 -0
- package/src/SliceUI/divider/Divider.tsx +109 -0
- package/src/SliceUI/divider/Token.ts +18 -0
- package/src/SliceUI/divider/Type.ts +26 -0
- package/src/SliceUI/icon/CustomIcon.ts +4 -0
- package/src/SliceUI/icon/IcoMoonIcon.tsx +11 -0
- package/src/SliceUI/icon/Icon.tsx +38 -0
- package/src/SliceUI/icon/Token.ts +14 -0
- package/src/SliceUI/icon/Type.ts +13 -0
- package/src/SliceUI/icon/selection.json +1 -0
- package/src/SliceUI/input/Input.tsx +573 -0
- package/src/SliceUI/input/ToDo.md +99 -0
- package/src/SliceUI/input/Token.ts +372 -0
- package/src/SliceUI/input/Type.ts +109 -0
- package/src/SliceUI/input/components/InputPortal.tsx +211 -0
- package/src/SliceUI/input/components/NativeBottomSheet.tsx +296 -0
- package/src/SliceUI/input/components/SelectChip.tsx +185 -0
- package/src/SliceUI/input/components/SelectList.tsx +173 -0
- package/src/SliceUI/input/components/SelectListItem.tsx +377 -0
- package/src/SliceUI/input/components/SelectScrollbarStyle.ts +44 -0
- package/src/SliceUI/input/hooks/useCustomScrollbar.ts +17 -0
- package/src/SliceUI/input/hooks/useInputState.ts +41 -0
- package/src/SliceUI/input/hooks/useLabelAnimation.ts +132 -0
- package/src/SliceUI/input/hooks/useOutsideClick.ts +38 -0
- package/src/SliceUI/input/hooks/useSelectLogic.ts +338 -0
- package/src/SliceUI/input/utils/inputUtils.ts +120 -0
- package/src/SliceUI/input/utils/selectUtils.ts +85 -0
- package/src/SliceUI/input/utils/styleUtils.ts +50 -0
- package/src/SliceUI/input/variants/CurrencyInput/CurrencyInput.tsx +16 -0
- package/src/SliceUI/input/variants/CurrencyInput/NativeCurrencyInput.tsx +181 -0
- package/src/SliceUI/input/variants/CurrencyInput/WebCurrencyInput.tsx +163 -0
- package/src/SliceUI/input/variants/CurrencyInput/types.ts +17 -0
- package/src/SliceUI/input/variants/PhoneInput/NativePhoneInput.tsx +189 -0
- package/src/SliceUI/input/variants/PhoneInput/PhoneInput.tsx +16 -0
- package/src/SliceUI/input/variants/PhoneInput/WebPhoneInput.tsx +291 -0
- package/src/SliceUI/input/variants/PhoneInput/types.ts +22 -0
- package/src/SliceUI/input/variants/SelectInput/SelectInput.tsx +407 -0
- package/src/SliceUI/input/variants/SelectInput/types.ts +34 -0
- package/src/SliceUI/input/variants/TextInput.tsx +68 -0
- package/src/SliceUI/layout/Box.tsx +38 -0
- package/src/SliceUI/layout/Center.tsx +38 -0
- package/src/SliceUI/layout/Divider.tsx +37 -0
- package/src/SliceUI/layout/Grid.tsx +75 -0
- package/src/SliceUI/layout/PageContainer.tsx +60 -0
- package/src/SliceUI/layout/ScrollContainer.tsx +72 -0
- package/src/SliceUI/layout/Spacer.tsx +54 -0
- package/src/SliceUI/layout/Stack.tsx +97 -0
- package/src/SliceUI/layout/StickyHeader.tsx +71 -0
- package/src/SliceUI/radio/RadioButton.tsx +130 -0
- package/src/SliceUI/radio/Token.ts +197 -0
- package/src/SliceUI/radio/Type.ts +35 -0
- package/src/SliceUI/react-native.config.js +3 -0
- package/src/SliceUI/responsive/Type.ts +7 -0
- package/src/SliceUI/responsive/helper.ts +53 -0
- package/src/SliceUI/switch/Switch.tsx +119 -0
- package/src/SliceUI/switch/Token.ts +205 -0
- package/src/SliceUI/switch/Type.ts +26 -0
- package/src/SliceUI/tab/TabItem.tsx +204 -0
- package/src/SliceUI/tab/Tabs.tsx +110 -0
- package/src/SliceUI/tab/Token.ts +282 -0
- package/src/SliceUI/tab/Type.ts +66 -0
- package/src/SliceUI/tab/helper.ts +53 -0
- package/src/SliceUI/table/Table.tsx +388 -0
- package/src/SliceUI/table/TableCell.tsx +158 -0
- package/src/SliceUI/table/TableFooter.tsx +353 -0
- package/src/SliceUI/table/TableHeader.tsx +247 -0
- package/src/SliceUI/table/TableRow.tsx +218 -0
- package/src/SliceUI/table/Token.ts +252 -0
- package/src/SliceUI/table/Type.ts +213 -0
- package/src/SliceUI/table/helper.ts +376 -0
- package/src/SliceUI/table/index.ts +53 -0
- package/src/SliceUI/theme/dummyColors.tsx +7 -0
- package/src/SliceUI/theme/theme.ts +107 -0
- package/src/SliceUI/typography/BaseTypographyToken.ts +62 -0
- package/src/SliceUI/typography/FoundationToken.ts +48 -0
- package/src/SliceUI/typography/Token.ts +228 -0
- package/src/SliceUI/typography/Type.ts +20 -0
- package/src/SliceUI/typography/Typography.tsx +99 -0
- package/src/SliceUI/values/BorderRadius.ts +17 -0
- package/src/SliceUI/values/BorderWidth.ts +7 -0
- package/src/SliceUI/values/Dimension.ts +35 -0
- package/src/SliceUI/values/IconSizes.ts +13 -0
- package/src/SliceUI/values/Spacing.ts +22 -0
- package/src/declarations.d.ts +8 -0
- package/src/index.tsx +119 -0
- package/src/stories/Colors.mdx +1418 -0
- package/src/stories/Dimensions.mdx +60 -0
- package/src/stories/GetStarted.mdx +90 -0
- package/src/stories/Introduction.mdx +136 -0
- package/src/stories/Shape.mdx +126 -0
- package/src/stories/Spacing.mdx +104 -0
- package/src/stories/Typography.mdx +454 -0
- package/src/stories/Utils.mdx +277 -0
- package/src/stories/story-components/AddIcon.js +13 -0
- package/src/stories/story-components/RectangleWithBox.jsx +51 -0
- package/src/stories/story-components/RoundedRectangle.jsx +18 -0
- package/src/stories/story-components/RoundedWithWhiteInside.jsx +33 -0
- package/src/stories/story-components/WhiteRoundedRectangle.jsx +107 -0
- package/src/stories/story-components/svgPaths.js +126 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import type { FontWeight, TypographyVariants } from './Type';
|
|
2
|
+
import { foundationTypography } from './FoundationToken';
|
|
3
|
+
import { baseTypographyToken } from './BaseTypographyToken';
|
|
4
|
+
|
|
5
|
+
export const TYPOGRAPHY_STYLES: TypographyVariants = {
|
|
6
|
+
display1Black: {
|
|
7
|
+
fontFamily: foundationTypography.fontFamily.latoBlack,
|
|
8
|
+
fontSize: baseTypographyToken.display.display1.fontSize,
|
|
9
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBlack as FontWeight,
|
|
10
|
+
lineHeight: baseTypographyToken.display.display1.lineHeight,
|
|
11
|
+
},
|
|
12
|
+
display1Heavy: {
|
|
13
|
+
fontFamily: foundationTypography.fontFamily.latoHeavy,
|
|
14
|
+
fontSize: baseTypographyToken.display.display1.fontSize,
|
|
15
|
+
fontWeight: foundationTypography.fontWeight.fontWeightHeavy as FontWeight,
|
|
16
|
+
lineHeight: baseTypographyToken.display.display1.lineHeight,
|
|
17
|
+
},
|
|
18
|
+
display1Bold: {
|
|
19
|
+
fontFamily: foundationTypography.fontFamily.latoBold,
|
|
20
|
+
fontSize: baseTypographyToken.display.display1.fontSize,
|
|
21
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBold as FontWeight,
|
|
22
|
+
lineHeight: baseTypographyToken.display.display1.lineHeight,
|
|
23
|
+
},
|
|
24
|
+
display2Black: {
|
|
25
|
+
fontFamily: foundationTypography.fontFamily.latoBlack,
|
|
26
|
+
fontSize: baseTypographyToken.display.display2.fontSize,
|
|
27
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBlack as FontWeight,
|
|
28
|
+
lineHeight: baseTypographyToken.display.display2.lineHeight,
|
|
29
|
+
},
|
|
30
|
+
display2Heavy: {
|
|
31
|
+
fontFamily: foundationTypography.fontFamily.latoHeavy,
|
|
32
|
+
fontSize: baseTypographyToken.display.display2.fontSize,
|
|
33
|
+
fontWeight: foundationTypography.fontWeight.fontWeightHeavy as FontWeight,
|
|
34
|
+
lineHeight: baseTypographyToken.display.display2.lineHeight,
|
|
35
|
+
},
|
|
36
|
+
display2Bold: {
|
|
37
|
+
fontFamily: foundationTypography.fontFamily.latoBold,
|
|
38
|
+
fontSize: baseTypographyToken.display.display2.fontSize,
|
|
39
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBold as FontWeight,
|
|
40
|
+
lineHeight: baseTypographyToken.display.display2.lineHeight,
|
|
41
|
+
},
|
|
42
|
+
display3Black: {
|
|
43
|
+
fontFamily: foundationTypography.fontFamily.latoBlack,
|
|
44
|
+
fontSize: baseTypographyToken.display.display3.fontSize,
|
|
45
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBlack as FontWeight,
|
|
46
|
+
lineHeight: baseTypographyToken.display.display3.lineHeight,
|
|
47
|
+
},
|
|
48
|
+
display3Heavy: {
|
|
49
|
+
fontFamily: foundationTypography.fontFamily.latoHeavy,
|
|
50
|
+
fontSize: baseTypographyToken.display.display3.fontSize,
|
|
51
|
+
fontWeight: foundationTypography.fontWeight.fontWeightHeavy as FontWeight,
|
|
52
|
+
lineHeight: baseTypographyToken.display.display3.lineHeight,
|
|
53
|
+
},
|
|
54
|
+
display3Bold: {
|
|
55
|
+
fontFamily: foundationTypography.fontFamily.latoBold,
|
|
56
|
+
fontSize: baseTypographyToken.display.display3.fontSize,
|
|
57
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBold as FontWeight,
|
|
58
|
+
lineHeight: baseTypographyToken.display.display3.lineHeight,
|
|
59
|
+
},
|
|
60
|
+
display4Black: {
|
|
61
|
+
fontFamily: foundationTypography.fontFamily.latoBlack,
|
|
62
|
+
fontSize: baseTypographyToken.display.display4.fontSize,
|
|
63
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBlack as FontWeight,
|
|
64
|
+
lineHeight: baseTypographyToken.display.display4.lineHeight,
|
|
65
|
+
},
|
|
66
|
+
display4Heavy: {
|
|
67
|
+
fontFamily: foundationTypography.fontFamily.latoHeavy,
|
|
68
|
+
fontSize: baseTypographyToken.display.display4.fontSize,
|
|
69
|
+
fontWeight: foundationTypography.fontWeight.fontWeightHeavy as FontWeight,
|
|
70
|
+
lineHeight: baseTypographyToken.display.display4.lineHeight,
|
|
71
|
+
},
|
|
72
|
+
display4Bold: {
|
|
73
|
+
fontFamily: foundationTypography.fontFamily.latoBold,
|
|
74
|
+
fontSize: baseTypographyToken.display.display4.fontSize,
|
|
75
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBold as FontWeight,
|
|
76
|
+
lineHeight: baseTypographyToken.display.display4.lineHeight,
|
|
77
|
+
},
|
|
78
|
+
heading1Black: {
|
|
79
|
+
fontFamily: foundationTypography.fontFamily.latoBlack,
|
|
80
|
+
fontSize: baseTypographyToken.heading.heading1.fontSize,
|
|
81
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBlack as FontWeight,
|
|
82
|
+
lineHeight: baseTypographyToken.heading.heading1.lineHeight,
|
|
83
|
+
},
|
|
84
|
+
heading1Heavy: {
|
|
85
|
+
fontFamily: foundationTypography.fontFamily.latoHeavy,
|
|
86
|
+
fontSize: baseTypographyToken.heading.heading1.fontSize,
|
|
87
|
+
fontWeight: foundationTypography.fontWeight.fontWeightHeavy as FontWeight,
|
|
88
|
+
lineHeight: baseTypographyToken.heading.heading1.lineHeight,
|
|
89
|
+
},
|
|
90
|
+
heading2Black: {
|
|
91
|
+
fontFamily: foundationTypography.fontFamily.latoBlack,
|
|
92
|
+
fontSize: baseTypographyToken.heading.heading2.fontSize,
|
|
93
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBlack as FontWeight,
|
|
94
|
+
lineHeight: baseTypographyToken.heading.heading2.lineHeight,
|
|
95
|
+
},
|
|
96
|
+
heading2Heavy: {
|
|
97
|
+
fontFamily: foundationTypography.fontFamily.latoHeavy,
|
|
98
|
+
fontSize: baseTypographyToken.heading.heading2.fontSize,
|
|
99
|
+
fontWeight: foundationTypography.fontWeight.fontWeightHeavy as FontWeight,
|
|
100
|
+
lineHeight: baseTypographyToken.heading.heading2.lineHeight,
|
|
101
|
+
},
|
|
102
|
+
heading3Black: {
|
|
103
|
+
fontFamily: foundationTypography.fontFamily.latoBlack,
|
|
104
|
+
fontSize: baseTypographyToken.heading.heading3.fontSize,
|
|
105
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBlack as FontWeight,
|
|
106
|
+
lineHeight: baseTypographyToken.heading.heading3.lineHeight,
|
|
107
|
+
},
|
|
108
|
+
heading3Heavy: {
|
|
109
|
+
fontFamily: foundationTypography.fontFamily.latoHeavy,
|
|
110
|
+
fontSize: baseTypographyToken.heading.heading3.fontSize,
|
|
111
|
+
fontWeight: foundationTypography.fontWeight.fontWeightHeavy as FontWeight,
|
|
112
|
+
lineHeight: baseTypographyToken.heading.heading3.lineHeight,
|
|
113
|
+
},
|
|
114
|
+
heading3Bold: {
|
|
115
|
+
fontFamily: foundationTypography.fontFamily.latoBold,
|
|
116
|
+
fontSize: baseTypographyToken.heading.heading3.fontSize,
|
|
117
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBold as FontWeight,
|
|
118
|
+
lineHeight: baseTypographyToken.heading.heading3.lineHeight,
|
|
119
|
+
},
|
|
120
|
+
heading4Black: {
|
|
121
|
+
fontFamily: foundationTypography.fontFamily.latoBlack,
|
|
122
|
+
fontSize: baseTypographyToken.heading.heading4.fontSize,
|
|
123
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBlack as FontWeight,
|
|
124
|
+
lineHeight: baseTypographyToken.heading.heading4.lineHeight,
|
|
125
|
+
},
|
|
126
|
+
heading4Heavy: {
|
|
127
|
+
fontFamily: foundationTypography.fontFamily.latoHeavy,
|
|
128
|
+
fontSize: baseTypographyToken.heading.heading4.fontSize,
|
|
129
|
+
fontWeight: foundationTypography.fontWeight.fontWeightHeavy as FontWeight,
|
|
130
|
+
lineHeight: baseTypographyToken.heading.heading4.lineHeight,
|
|
131
|
+
},
|
|
132
|
+
heading4Bold: {
|
|
133
|
+
fontFamily: foundationTypography.fontFamily.latoBold,
|
|
134
|
+
fontSize: baseTypographyToken.heading.heading4.fontSize,
|
|
135
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBold as FontWeight,
|
|
136
|
+
lineHeight: baseTypographyToken.heading.heading4.lineHeight,
|
|
137
|
+
},
|
|
138
|
+
heading5Black: {
|
|
139
|
+
fontFamily: foundationTypography.fontFamily.latoBlack,
|
|
140
|
+
fontSize: baseTypographyToken.heading.heading5.fontSize,
|
|
141
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBlack as FontWeight,
|
|
142
|
+
lineHeight: baseTypographyToken.heading.heading5.lineHeight,
|
|
143
|
+
},
|
|
144
|
+
heading5Bold: {
|
|
145
|
+
fontFamily: foundationTypography.fontFamily.latoBold,
|
|
146
|
+
fontSize: baseTypographyToken.heading.heading5.fontSize,
|
|
147
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBold as FontWeight,
|
|
148
|
+
lineHeight: baseTypographyToken.heading.heading5.lineHeight,
|
|
149
|
+
},
|
|
150
|
+
heading5Medium: {
|
|
151
|
+
fontFamily: foundationTypography.fontFamily.latoMedium,
|
|
152
|
+
fontSize: baseTypographyToken.heading.heading5.fontSize,
|
|
153
|
+
fontWeight: foundationTypography.fontWeight.fontWeightMedium as FontWeight,
|
|
154
|
+
lineHeight: baseTypographyToken.heading.heading5.lineHeight,
|
|
155
|
+
},
|
|
156
|
+
body1Bold: {
|
|
157
|
+
fontFamily: foundationTypography.fontFamily.latoBold,
|
|
158
|
+
fontSize: baseTypographyToken.body.body1.fontSize,
|
|
159
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBold as FontWeight,
|
|
160
|
+
lineHeight: baseTypographyToken.body.body1.lineHeight,
|
|
161
|
+
},
|
|
162
|
+
body1Medium: {
|
|
163
|
+
fontFamily: foundationTypography.fontFamily.latoMedium,
|
|
164
|
+
fontSize: baseTypographyToken.body.body1.fontSize,
|
|
165
|
+
fontWeight: foundationTypography.fontWeight.fontWeightMedium as FontWeight,
|
|
166
|
+
lineHeight: baseTypographyToken.body.body1.lineHeight,
|
|
167
|
+
},
|
|
168
|
+
body1Regular: {
|
|
169
|
+
fontFamily: foundationTypography.fontFamily.latoRegular,
|
|
170
|
+
fontSize: baseTypographyToken.body.body1.fontSize,
|
|
171
|
+
fontWeight: foundationTypography.fontWeight.fontWeightRegular as FontWeight,
|
|
172
|
+
lineHeight: baseTypographyToken.body.body1.lineHeight,
|
|
173
|
+
},
|
|
174
|
+
body2Bold: {
|
|
175
|
+
fontFamily: foundationTypography.fontFamily.latoBold,
|
|
176
|
+
fontSize: baseTypographyToken.body.body2.fontSize,
|
|
177
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBold as FontWeight,
|
|
178
|
+
lineHeight: baseTypographyToken.body.body2.lineHeight,
|
|
179
|
+
},
|
|
180
|
+
body2Medium: {
|
|
181
|
+
fontFamily: foundationTypography.fontFamily.latoMedium,
|
|
182
|
+
fontSize: baseTypographyToken.body.body2.fontSize,
|
|
183
|
+
fontWeight: foundationTypography.fontWeight.fontWeightMedium as FontWeight,
|
|
184
|
+
lineHeight: baseTypographyToken.body.body2.lineHeight,
|
|
185
|
+
},
|
|
186
|
+
body2Regular: {
|
|
187
|
+
fontFamily: foundationTypography.fontFamily.latoRegular,
|
|
188
|
+
fontSize: baseTypographyToken.body.body2.fontSize,
|
|
189
|
+
fontWeight: foundationTypography.fontWeight.fontWeightRegular as FontWeight,
|
|
190
|
+
lineHeight: baseTypographyToken.body.body2.lineHeight,
|
|
191
|
+
},
|
|
192
|
+
body3Bold: {
|
|
193
|
+
fontFamily: foundationTypography.fontFamily.latoBold,
|
|
194
|
+
fontSize: baseTypographyToken.body.body3.fontSize,
|
|
195
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBold as FontWeight,
|
|
196
|
+
lineHeight: baseTypographyToken.body.body3.lineHeight,
|
|
197
|
+
},
|
|
198
|
+
body3Medium: {
|
|
199
|
+
fontFamily: foundationTypography.fontFamily.latoMedium,
|
|
200
|
+
fontSize: baseTypographyToken.body.body3.fontSize,
|
|
201
|
+
fontWeight: foundationTypography.fontWeight.fontWeightMedium as FontWeight,
|
|
202
|
+
lineHeight: baseTypographyToken.body.body3.lineHeight,
|
|
203
|
+
},
|
|
204
|
+
body3Regular: {
|
|
205
|
+
fontFamily: foundationTypography.fontFamily.latoRegular,
|
|
206
|
+
fontSize: baseTypographyToken.body.body3.fontSize,
|
|
207
|
+
fontWeight: foundationTypography.fontWeight.fontWeightRegular as FontWeight,
|
|
208
|
+
lineHeight: baseTypographyToken.body.body3.lineHeight,
|
|
209
|
+
},
|
|
210
|
+
body4Bold: {
|
|
211
|
+
fontFamily: foundationTypography.fontFamily.latoBold,
|
|
212
|
+
fontSize: baseTypographyToken.body.body4.fontSize,
|
|
213
|
+
fontWeight: foundationTypography.fontWeight.fontWeightBold as FontWeight,
|
|
214
|
+
lineHeight: baseTypographyToken.body.body4.lineHeight,
|
|
215
|
+
},
|
|
216
|
+
body4Medium: {
|
|
217
|
+
fontFamily: foundationTypography.fontFamily.latoMedium,
|
|
218
|
+
fontSize: baseTypographyToken.body.body4.fontSize,
|
|
219
|
+
fontWeight: foundationTypography.fontWeight.fontWeightMedium as FontWeight,
|
|
220
|
+
lineHeight: baseTypographyToken.body.body4.lineHeight,
|
|
221
|
+
},
|
|
222
|
+
body4Regular: {
|
|
223
|
+
fontFamily: foundationTypography.fontFamily.latoRegular,
|
|
224
|
+
fontSize: baseTypographyToken.body.body4.fontSize,
|
|
225
|
+
fontWeight: foundationTypography.fontWeight.fontWeightRegular as FontWeight,
|
|
226
|
+
lineHeight: baseTypographyToken.body.body4.lineHeight,
|
|
227
|
+
},
|
|
228
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TextStyle } from 'react-native';
|
|
2
|
+
import type { TYPOGRAPHY_STYLES } from './Token';
|
|
3
|
+
import type { VariantBreakPoints } from '../responsive/Type';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export type TypographyStyleKeys = keyof typeof TYPOGRAPHY_STYLES;
|
|
7
|
+
|
|
8
|
+
export type TypographyVariants = Record<string, TextStyle>;
|
|
9
|
+
export type FontWeight = TextStyle['fontWeight'];
|
|
10
|
+
|
|
11
|
+
export interface TypographyViewProps {
|
|
12
|
+
screenName?: string; // Screen name
|
|
13
|
+
id?: string; // Element ID
|
|
14
|
+
children: string | string[]; // Text content
|
|
15
|
+
variant?: string | VariantBreakPoints; // Typography style variant (default: 'display1Black')
|
|
16
|
+
style?: TextStyle; // Optional custom styles
|
|
17
|
+
align?: 'auto' | 'left' | 'right' | 'center' | 'justify' | undefined; // Text alignment (default: 'left')
|
|
18
|
+
spacing?: number; // Line spacing (default: 0),
|
|
19
|
+
extraProps?: any;
|
|
20
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React, {useMemo} from 'react';
|
|
2
|
+
|
|
3
|
+
import {useSliceTheme} from '../contextProvider/context';
|
|
4
|
+
import {resolveVariant, scaleFont} from '../responsive/helper';
|
|
5
|
+
import {setTestId} from '../automation/helper';
|
|
6
|
+
import type {TypographyViewProps} from './Type';
|
|
7
|
+
import {Platform, StyleSheet, Text, type TextStyle} from 'react-native';
|
|
8
|
+
import {TYPOGRAPHY_STYLES} from './Token';
|
|
9
|
+
|
|
10
|
+
const DEFAULT_VARIANT: keyof typeof TYPOGRAPHY_STYLES = 'display1Black';
|
|
11
|
+
|
|
12
|
+
const VARIANT_ALIASES: Record<string, keyof typeof TYPOGRAPHY_STYLES> = {
|
|
13
|
+
h1: 'heading1Heavy',
|
|
14
|
+
h2: 'heading2Heavy',
|
|
15
|
+
h3: 'heading3Bold',
|
|
16
|
+
h4: 'heading4Bold',
|
|
17
|
+
h5: 'heading5Bold',
|
|
18
|
+
h6: 'body1Bold',
|
|
19
|
+
body1: 'body1Regular',
|
|
20
|
+
body2: 'body2Regular',
|
|
21
|
+
body3: 'body3Regular',
|
|
22
|
+
body4: 'body4Regular',
|
|
23
|
+
body2Semibold: 'body2Bold',
|
|
24
|
+
captionRegular: 'body4Regular',
|
|
25
|
+
captionMedium: 'body4Medium',
|
|
26
|
+
captionBold: 'body4Bold',
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const resolveTypographyVariant = (
|
|
30
|
+
variantKey: string,
|
|
31
|
+
): keyof typeof TYPOGRAPHY_STYLES => {
|
|
32
|
+
const normalizedVariant =
|
|
33
|
+
VARIANT_ALIASES[variantKey] ??
|
|
34
|
+
(variantKey as keyof typeof TYPOGRAPHY_STYLES);
|
|
35
|
+
|
|
36
|
+
return normalizedVariant in TYPOGRAPHY_STYLES
|
|
37
|
+
? normalizedVariant
|
|
38
|
+
: DEFAULT_VARIANT;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const Typography: React.FC<TypographyViewProps> = ({
|
|
42
|
+
screenName = 'default',
|
|
43
|
+
id = 'default',
|
|
44
|
+
children,
|
|
45
|
+
variant = DEFAULT_VARIANT,
|
|
46
|
+
style,
|
|
47
|
+
align = 'left',
|
|
48
|
+
spacing = 0,
|
|
49
|
+
...extraProps
|
|
50
|
+
}) => {
|
|
51
|
+
const {theme, deviceBreakpoint} = useSliceTheme();
|
|
52
|
+
|
|
53
|
+
const {isDebugBuildType = false, automationBaseid = 'AK_'} = theme;
|
|
54
|
+
|
|
55
|
+
// Memoize typography styles to avoid unnecessary recalculations
|
|
56
|
+
const textStyles = useMemo(() => {
|
|
57
|
+
const rawVariant = resolveVariant(variant, deviceBreakpoint);
|
|
58
|
+
const breakPointVariant = resolveTypographyVariant(rawVariant);
|
|
59
|
+
const themeTextStyles =
|
|
60
|
+
theme.typographyStyles?.[breakPointVariant] ??
|
|
61
|
+
TYPOGRAPHY_STYLES[breakPointVariant] ??
|
|
62
|
+
TYPOGRAPHY_STYLES[DEFAULT_VARIANT];
|
|
63
|
+
const textStyle = {
|
|
64
|
+
fontFamily: Platform.OS === 'web' ? 'Lato' : themeTextStyles?.fontFamily,
|
|
65
|
+
fontWeight: themeTextStyles?.fontWeight,
|
|
66
|
+
fontSize: scaleFont(themeTextStyles?.fontSize),
|
|
67
|
+
lineHeight: scaleFont(themeTextStyles?.lineHeight),
|
|
68
|
+
textAlign: align,
|
|
69
|
+
marginBottom: spacing,
|
|
70
|
+
};
|
|
71
|
+
return style ? StyleSheet.flatten([textStyle, style]) : textStyle;
|
|
72
|
+
}, [
|
|
73
|
+
variant,
|
|
74
|
+
deviceBreakpoint,
|
|
75
|
+
theme.typographyStyles,
|
|
76
|
+
align,
|
|
77
|
+
spacing,
|
|
78
|
+
style,
|
|
79
|
+
]);
|
|
80
|
+
|
|
81
|
+
const styles = useMemo(() => {
|
|
82
|
+
return StyleSheet.create({
|
|
83
|
+
typography: textStyles as TextStyle,
|
|
84
|
+
});
|
|
85
|
+
}, [textStyles]);
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<Text
|
|
89
|
+
style={styles.typography}
|
|
90
|
+
{...extraProps}
|
|
91
|
+
{...(isDebugBuildType && automationBaseid
|
|
92
|
+
? setTestId(automationBaseid, screenName, id)
|
|
93
|
+
: {})}>
|
|
94
|
+
{children}
|
|
95
|
+
</Text>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export default React.memo(Typography);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { dimensions } from './Dimension';
|
|
2
|
+
|
|
3
|
+
export const borderRadius = {
|
|
4
|
+
borderRadius0: dimensions.dimension00, // 0px
|
|
5
|
+
borderRadius10: dimensions.dimension01, // 2px
|
|
6
|
+
borderRadius20: dimensions.dimension02, // 4px
|
|
7
|
+
borderRadius30: dimensions.dimension04, // 8px
|
|
8
|
+
borderRadius40: dimensions.dimension06, // 12px
|
|
9
|
+
borderRadius50: dimensions.dimension08, // 16px
|
|
10
|
+
borderRadius60: dimensions.dimension10, // 20px
|
|
11
|
+
borderRadius70: dimensions.dimension12, // 24px
|
|
12
|
+
borderRadius80: dimensions.dimension14, // 28px
|
|
13
|
+
borderRadius90: dimensions.dimension16, // 32px
|
|
14
|
+
borderRadius100: dimensions.dimension17, // 64px
|
|
15
|
+
borderRadius110: dimensions.dimension18, // 96px
|
|
16
|
+
borderRadiusFull: dimensions.dimension100, // 1000px
|
|
17
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export const dimensions = {
|
|
2
|
+
dimension00: 0,
|
|
3
|
+
dimension01: 2,
|
|
4
|
+
dimension02: 4,
|
|
5
|
+
dimension03: 6,
|
|
6
|
+
dimension04: 8,
|
|
7
|
+
dimension05: 10,
|
|
8
|
+
dimension06: 12,
|
|
9
|
+
dimension07: 14,
|
|
10
|
+
dimension08: 16,
|
|
11
|
+
dimension09: 18,
|
|
12
|
+
dimension10: 20,
|
|
13
|
+
dimension11: 22,
|
|
14
|
+
dimension12: 24,
|
|
15
|
+
dimension13: 26,
|
|
16
|
+
dimension14: 28,
|
|
17
|
+
dimension15: 30,
|
|
18
|
+
dimension16: 32,
|
|
19
|
+
dimension17: 36,
|
|
20
|
+
dimension18: 40,
|
|
21
|
+
dimension19: 48,
|
|
22
|
+
dimension20: 56,
|
|
23
|
+
dimension21: 64,
|
|
24
|
+
dimension22: 72,
|
|
25
|
+
dimension23: 80,
|
|
26
|
+
dimension24: 88,
|
|
27
|
+
dimension25: 96,
|
|
28
|
+
dimension26: 112,
|
|
29
|
+
dimension27: 128,
|
|
30
|
+
dimension28: 144,
|
|
31
|
+
dimension29: 160,
|
|
32
|
+
dimension30: 176,
|
|
33
|
+
dimension31: 192,
|
|
34
|
+
dimension100: 1000,
|
|
35
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { dimensions } from './Dimension';
|
|
2
|
+
|
|
3
|
+
export const iconSize = {
|
|
4
|
+
iconSize01: dimensions.dimension07,
|
|
5
|
+
iconSize02: dimensions.dimension08,
|
|
6
|
+
iconSize03: dimensions.dimension10,
|
|
7
|
+
iconSize04: dimensions.dimension12,
|
|
8
|
+
iconSize05: dimensions.dimension14,
|
|
9
|
+
iconSize06: dimensions.dimension16,
|
|
10
|
+
iconSize07: dimensions.dimension17,
|
|
11
|
+
iconSize08: dimensions.dimension18,
|
|
12
|
+
iconSize09: dimensions.dimension19
|
|
13
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { dimensions } from './Dimension';
|
|
2
|
+
|
|
3
|
+
export const spacing = {
|
|
4
|
+
space0: dimensions.dimension00,
|
|
5
|
+
space50: dimensions.dimension01,
|
|
6
|
+
space100: dimensions.dimension02,
|
|
7
|
+
space150: dimensions.dimension03,
|
|
8
|
+
space200: dimensions.dimension04,
|
|
9
|
+
space250: dimensions.dimension05,
|
|
10
|
+
space300: dimensions.dimension06,
|
|
11
|
+
space350: dimensions.dimension07,
|
|
12
|
+
space400: dimensions.dimension08,
|
|
13
|
+
space450: dimensions.dimension09,
|
|
14
|
+
space500: dimensions.dimension10,
|
|
15
|
+
space550: dimensions.dimension11,
|
|
16
|
+
space600: dimensions.dimension12,
|
|
17
|
+
space800: dimensions.dimension16,
|
|
18
|
+
space900: dimensions.dimension18,
|
|
19
|
+
space1000: dimensions.dimension20,
|
|
20
|
+
space1200: dimensions.dimension24,
|
|
21
|
+
space1400: dimensions.dimension28
|
|
22
|
+
};
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
requireNativeComponent,
|
|
4
|
+
UIManager,
|
|
5
|
+
Platform,
|
|
6
|
+
View,
|
|
7
|
+
type ViewStyle,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
|
|
10
|
+
const LINKING_ERROR =
|
|
11
|
+
"The package 'react-native-fh-slice-ui' doesn't seem to be linked. Make sure: \n\n" +
|
|
12
|
+
Platform.select({ios: "- You have run 'pod install'\n", default: ''}) +
|
|
13
|
+
'- You rebuilt the app after installing the package\n' +
|
|
14
|
+
'- You are not using Expo Go\n';
|
|
15
|
+
|
|
16
|
+
type FhSliceUIProps = {
|
|
17
|
+
color: string;
|
|
18
|
+
style: ViewStyle;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const ComponentName = 'FhSliceUIView';
|
|
22
|
+
|
|
23
|
+
let FhSliceUIView: React.ComponentType<FhSliceUIProps>;
|
|
24
|
+
|
|
25
|
+
if (Platform.OS === 'web') {
|
|
26
|
+
// Fallback for web: render an empty View with given color and style
|
|
27
|
+
FhSliceUIView = ({color, style}) => (
|
|
28
|
+
<View style={[{backgroundColor: color}, style]} />
|
|
29
|
+
);
|
|
30
|
+
} else {
|
|
31
|
+
// Native implementation
|
|
32
|
+
FhSliceUIView =
|
|
33
|
+
UIManager.getViewManagerConfig(ComponentName) != null
|
|
34
|
+
? requireNativeComponent<FhSliceUIProps>(ComponentName)
|
|
35
|
+
: () => {
|
|
36
|
+
throw new Error(LINKING_ERROR);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export {FhSliceUIView};
|
|
41
|
+
|
|
42
|
+
// ===== COMPONENTS =====
|
|
43
|
+
|
|
44
|
+
export {default as Typography} from './SliceUI/typography/Typography';
|
|
45
|
+
|
|
46
|
+
export {default as Input} from './SliceUI/input/Input';
|
|
47
|
+
|
|
48
|
+
export {default as Icon} from './SliceUI/icon/Icon';
|
|
49
|
+
|
|
50
|
+
export {default as Button} from './SliceUI/button/Button';
|
|
51
|
+
|
|
52
|
+
export {default as Chip} from './SliceUI/chip/Chip';
|
|
53
|
+
|
|
54
|
+
export {default as Badge} from './SliceUI/badge/Badge';
|
|
55
|
+
|
|
56
|
+
export {default as Avatar} from './SliceUI/avatar/Avatar';
|
|
57
|
+
|
|
58
|
+
export {default as TabItem} from './SliceUI/tab/TabItem';
|
|
59
|
+
|
|
60
|
+
export {default as Tabs} from './SliceUI/tab/Tabs';
|
|
61
|
+
|
|
62
|
+
export {HStack, VStack} from './SliceUI/layout/Stack';
|
|
63
|
+
|
|
64
|
+
export {default as Switch} from './SliceUI/switch/Switch';
|
|
65
|
+
|
|
66
|
+
export {RadioButton} from './SliceUI/radio/RadioButton';
|
|
67
|
+
|
|
68
|
+
export {Divider} from './SliceUI/divider/Divider';
|
|
69
|
+
|
|
70
|
+
export { default as Checkbox } from './SliceUI/checkbox/Checkbox';
|
|
71
|
+
|
|
72
|
+
// ===== LAYOUT COMPONENTS =====
|
|
73
|
+
|
|
74
|
+
export { default as Box } from './SliceUI/layout/Box';
|
|
75
|
+
|
|
76
|
+
export { default as Center } from './SliceUI/layout/Center';
|
|
77
|
+
|
|
78
|
+
export { default as Grid } from './SliceUI/layout/Grid';
|
|
79
|
+
|
|
80
|
+
export { default as Spacer } from './SliceUI/layout/Spacer';
|
|
81
|
+
|
|
82
|
+
// ===== TABLE COMPONENTS =====
|
|
83
|
+
export {
|
|
84
|
+
Table,
|
|
85
|
+
TableCell,
|
|
86
|
+
TableHeader,
|
|
87
|
+
TableRow,
|
|
88
|
+
TableFooter,
|
|
89
|
+
} from './SliceUI/table';
|
|
90
|
+
|
|
91
|
+
// ===== THEMING =====
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
SliceThemeProvider,
|
|
95
|
+
useSliceTheme,
|
|
96
|
+
} from './SliceUI/contextProvider/context';
|
|
97
|
+
|
|
98
|
+
export {colors} from './SliceUI/colors/Pallete';
|
|
99
|
+
|
|
100
|
+
export {DarkColorTokens, LightColorTokens} from './SliceUI/colors/Token';
|
|
101
|
+
|
|
102
|
+
export {theme} from './SliceUI/theme/theme';
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
// ==== DESIGN TOKENS====
|
|
106
|
+
export { spacing } from './SliceUI/values/Spacing';
|
|
107
|
+
export { borderRadius } from './SliceUI/values/BorderRadius';
|
|
108
|
+
export { borderWidth } from './SliceUI/values/BorderWidth';
|
|
109
|
+
export { iconSize } from './SliceUI/values/IconSizes';
|
|
110
|
+
export { dimensions } from './SliceUI/values/Dimension';
|
|
111
|
+
|
|
112
|
+
// ==== RESPONSIVE UTILITIES ====
|
|
113
|
+
|
|
114
|
+
export {
|
|
115
|
+
Breakpoints,
|
|
116
|
+
getDeviceBreakpoint,
|
|
117
|
+
scaleFont,
|
|
118
|
+
resolveVariant
|
|
119
|
+
} from './SliceUI/responsive/helper';
|