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,372 @@
|
|
|
1
|
+
import type {InputThemeSize} from './Type';
|
|
2
|
+
import {dimensions} from '../values/Dimension';
|
|
3
|
+
|
|
4
|
+
export const INPUT_VARIANTS = {
|
|
5
|
+
OUTLINED: 'outlined',
|
|
6
|
+
FILLED: 'filled',
|
|
7
|
+
STANDARD: 'standard',
|
|
8
|
+
} as const;
|
|
9
|
+
|
|
10
|
+
export const INPUT_SIZES = {
|
|
11
|
+
SMALL: 'small',
|
|
12
|
+
MEDIUM: 'medium',
|
|
13
|
+
LARGE: 'large',
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
export const inputTheme: InputThemeSize = {
|
|
17
|
+
small: {
|
|
18
|
+
outlined: {
|
|
19
|
+
container: {
|
|
20
|
+
padding: dimensions.dimension04,
|
|
21
|
+
minHeight: dimensions.dimension17,
|
|
22
|
+
},
|
|
23
|
+
input: {
|
|
24
|
+
fontSize: dimensions.dimension07,
|
|
25
|
+
lineHeight: dimensions.dimension10,
|
|
26
|
+
},
|
|
27
|
+
label: {
|
|
28
|
+
fontSize: dimensions.dimension06,
|
|
29
|
+
lineHeight: dimensions.dimension08,
|
|
30
|
+
},
|
|
31
|
+
error: {
|
|
32
|
+
fontSize: dimensions.dimension05,
|
|
33
|
+
lineHeight: dimensions.dimension07,
|
|
34
|
+
},
|
|
35
|
+
helperText: {
|
|
36
|
+
fontSize: dimensions.dimension05,
|
|
37
|
+
lineHeight: dimensions.dimension07,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
filled: {
|
|
41
|
+
container: {
|
|
42
|
+
padding: dimensions.dimension04,
|
|
43
|
+
minHeight: dimensions.dimension17,
|
|
44
|
+
backgroundColor: 'colorBackgroundLight',
|
|
45
|
+
},
|
|
46
|
+
input: {
|
|
47
|
+
fontSize: dimensions.dimension07,
|
|
48
|
+
lineHeight: dimensions.dimension10,
|
|
49
|
+
},
|
|
50
|
+
label: {
|
|
51
|
+
fontSize: dimensions.dimension06,
|
|
52
|
+
lineHeight: dimensions.dimension08,
|
|
53
|
+
},
|
|
54
|
+
error: {
|
|
55
|
+
fontSize: dimensions.dimension05,
|
|
56
|
+
lineHeight: dimensions.dimension07,
|
|
57
|
+
},
|
|
58
|
+
helperText: {
|
|
59
|
+
fontSize: dimensions.dimension05,
|
|
60
|
+
lineHeight: dimensions.dimension07,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
standard: {
|
|
64
|
+
container: {
|
|
65
|
+
padding: dimensions.dimension04,
|
|
66
|
+
minHeight: dimensions.dimension17,
|
|
67
|
+
borderWidth: dimensions.dimension00,
|
|
68
|
+
borderBottomWidth: dimensions.dimension01,
|
|
69
|
+
},
|
|
70
|
+
input: {
|
|
71
|
+
fontSize: dimensions.dimension07,
|
|
72
|
+
lineHeight: dimensions.dimension10,
|
|
73
|
+
},
|
|
74
|
+
label: {
|
|
75
|
+
fontSize: dimensions.dimension06,
|
|
76
|
+
lineHeight: dimensions.dimension08,
|
|
77
|
+
},
|
|
78
|
+
error: {
|
|
79
|
+
fontSize: dimensions.dimension05,
|
|
80
|
+
lineHeight: dimensions.dimension07,
|
|
81
|
+
},
|
|
82
|
+
helperText: {
|
|
83
|
+
fontSize: dimensions.dimension05,
|
|
84
|
+
lineHeight: dimensions.dimension07,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
medium: {
|
|
89
|
+
outlined: {
|
|
90
|
+
container: {
|
|
91
|
+
padding: dimensions.dimension06,
|
|
92
|
+
minHeight: dimensions.dimension18,
|
|
93
|
+
},
|
|
94
|
+
input: {
|
|
95
|
+
fontSize: dimensions.dimension08,
|
|
96
|
+
lineHeight: dimensions.dimension12,
|
|
97
|
+
},
|
|
98
|
+
label: {
|
|
99
|
+
fontSize: dimensions.dimension07,
|
|
100
|
+
lineHeight: dimensions.dimension10,
|
|
101
|
+
},
|
|
102
|
+
error: {
|
|
103
|
+
fontSize: dimensions.dimension06,
|
|
104
|
+
lineHeight: dimensions.dimension08,
|
|
105
|
+
},
|
|
106
|
+
helperText: {
|
|
107
|
+
fontSize: dimensions.dimension06,
|
|
108
|
+
lineHeight: dimensions.dimension08,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
filled: {
|
|
112
|
+
container: {
|
|
113
|
+
padding: dimensions.dimension06,
|
|
114
|
+
minHeight: dimensions.dimension18,
|
|
115
|
+
backgroundColor: '',
|
|
116
|
+
},
|
|
117
|
+
input: {
|
|
118
|
+
fontSize: dimensions.dimension08,
|
|
119
|
+
lineHeight: dimensions.dimension12,
|
|
120
|
+
},
|
|
121
|
+
label: {
|
|
122
|
+
fontSize: dimensions.dimension07,
|
|
123
|
+
lineHeight: dimensions.dimension10,
|
|
124
|
+
},
|
|
125
|
+
error: {
|
|
126
|
+
fontSize: dimensions.dimension06,
|
|
127
|
+
lineHeight: dimensions.dimension08,
|
|
128
|
+
},
|
|
129
|
+
helperText: {
|
|
130
|
+
fontSize: dimensions.dimension06,
|
|
131
|
+
lineHeight: dimensions.dimension08,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
standard: {
|
|
135
|
+
container: {
|
|
136
|
+
padding: dimensions.dimension06,
|
|
137
|
+
minHeight: dimensions.dimension18,
|
|
138
|
+
borderWidth: dimensions.dimension00,
|
|
139
|
+
borderBottomWidth: dimensions.dimension01,
|
|
140
|
+
},
|
|
141
|
+
input: {
|
|
142
|
+
fontSize: dimensions.dimension08,
|
|
143
|
+
lineHeight: dimensions.dimension12,
|
|
144
|
+
},
|
|
145
|
+
label: {
|
|
146
|
+
fontSize: dimensions.dimension07,
|
|
147
|
+
lineHeight: dimensions.dimension10,
|
|
148
|
+
},
|
|
149
|
+
error: {
|
|
150
|
+
fontSize: dimensions.dimension06,
|
|
151
|
+
lineHeight: dimensions.dimension08,
|
|
152
|
+
},
|
|
153
|
+
helperText: {
|
|
154
|
+
fontSize: dimensions.dimension06,
|
|
155
|
+
lineHeight: dimensions.dimension08,
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
large: {
|
|
160
|
+
outlined: {
|
|
161
|
+
container: {
|
|
162
|
+
padding: dimensions.dimension08,
|
|
163
|
+
minHeight: dimensions.dimension19,
|
|
164
|
+
},
|
|
165
|
+
input: {
|
|
166
|
+
fontSize: dimensions.dimension09,
|
|
167
|
+
lineHeight: dimensions.dimension14,
|
|
168
|
+
},
|
|
169
|
+
label: {
|
|
170
|
+
fontSize: dimensions.dimension08,
|
|
171
|
+
lineHeight: dimensions.dimension12,
|
|
172
|
+
},
|
|
173
|
+
error: {
|
|
174
|
+
fontSize: dimensions.dimension07,
|
|
175
|
+
lineHeight: dimensions.dimension10,
|
|
176
|
+
},
|
|
177
|
+
helperText: {
|
|
178
|
+
fontSize: dimensions.dimension07,
|
|
179
|
+
lineHeight: dimensions.dimension10,
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
filled: {
|
|
183
|
+
container: {
|
|
184
|
+
padding: dimensions.dimension08,
|
|
185
|
+
minHeight: dimensions.dimension19,
|
|
186
|
+
backgroundColor: 'colorBackgroundLight',
|
|
187
|
+
},
|
|
188
|
+
input: {
|
|
189
|
+
fontSize: dimensions.dimension09,
|
|
190
|
+
lineHeight: dimensions.dimension14,
|
|
191
|
+
},
|
|
192
|
+
label: {
|
|
193
|
+
fontSize: dimensions.dimension08,
|
|
194
|
+
lineHeight: dimensions.dimension12,
|
|
195
|
+
},
|
|
196
|
+
error: {
|
|
197
|
+
fontSize: dimensions.dimension07,
|
|
198
|
+
lineHeight: dimensions.dimension10,
|
|
199
|
+
},
|
|
200
|
+
helperText: {
|
|
201
|
+
fontSize: dimensions.dimension07,
|
|
202
|
+
lineHeight: dimensions.dimension10,
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
standard: {
|
|
206
|
+
container: {
|
|
207
|
+
padding: dimensions.dimension08,
|
|
208
|
+
minHeight: dimensions.dimension19,
|
|
209
|
+
borderWidth: dimensions.dimension00,
|
|
210
|
+
borderBottomWidth: dimensions.dimension01,
|
|
211
|
+
},
|
|
212
|
+
input: {
|
|
213
|
+
fontSize: dimensions.dimension09,
|
|
214
|
+
lineHeight: dimensions.dimension14,
|
|
215
|
+
},
|
|
216
|
+
label: {
|
|
217
|
+
fontSize: dimensions.dimension08,
|
|
218
|
+
lineHeight: dimensions.dimension12,
|
|
219
|
+
},
|
|
220
|
+
error: {
|
|
221
|
+
fontSize: dimensions.dimension07,
|
|
222
|
+
lineHeight: dimensions.dimension10,
|
|
223
|
+
},
|
|
224
|
+
helperText: {
|
|
225
|
+
fontSize: dimensions.dimension07,
|
|
226
|
+
lineHeight: dimensions.dimension10,
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
xlarge: {
|
|
231
|
+
outlined: {
|
|
232
|
+
container: {
|
|
233
|
+
padding: dimensions.dimension10,
|
|
234
|
+
minHeight: dimensions.dimension20,
|
|
235
|
+
},
|
|
236
|
+
input: {
|
|
237
|
+
fontSize: dimensions.dimension12,
|
|
238
|
+
lineHeight: dimensions.dimension16,
|
|
239
|
+
},
|
|
240
|
+
label: {
|
|
241
|
+
fontSize: dimensions.dimension10,
|
|
242
|
+
lineHeight: dimensions.dimension14,
|
|
243
|
+
},
|
|
244
|
+
error: {
|
|
245
|
+
fontSize: dimensions.dimension09,
|
|
246
|
+
lineHeight: dimensions.dimension12,
|
|
247
|
+
},
|
|
248
|
+
helperText: {
|
|
249
|
+
fontSize: dimensions.dimension09,
|
|
250
|
+
lineHeight: dimensions.dimension12,
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
filled: {
|
|
254
|
+
container: {
|
|
255
|
+
padding: dimensions.dimension10,
|
|
256
|
+
minHeight: dimensions.dimension20,
|
|
257
|
+
backgroundColor: 'colorBackgroundLight',
|
|
258
|
+
},
|
|
259
|
+
input: {
|
|
260
|
+
fontSize: dimensions.dimension12,
|
|
261
|
+
lineHeight: dimensions.dimension16,
|
|
262
|
+
},
|
|
263
|
+
label: {
|
|
264
|
+
fontSize: dimensions.dimension10,
|
|
265
|
+
lineHeight: dimensions.dimension14,
|
|
266
|
+
},
|
|
267
|
+
error: {
|
|
268
|
+
fontSize: dimensions.dimension09,
|
|
269
|
+
lineHeight: dimensions.dimension12,
|
|
270
|
+
},
|
|
271
|
+
helperText: {
|
|
272
|
+
fontSize: dimensions.dimension09,
|
|
273
|
+
lineHeight: dimensions.dimension12,
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
standard: {
|
|
277
|
+
container: {
|
|
278
|
+
padding: dimensions.dimension10,
|
|
279
|
+
minHeight: dimensions.dimension20,
|
|
280
|
+
borderWidth: dimensions.dimension00,
|
|
281
|
+
borderBottomWidth: dimensions.dimension01,
|
|
282
|
+
},
|
|
283
|
+
input: {
|
|
284
|
+
fontSize: dimensions.dimension12,
|
|
285
|
+
lineHeight: dimensions.dimension16,
|
|
286
|
+
},
|
|
287
|
+
label: {
|
|
288
|
+
fontSize: dimensions.dimension10,
|
|
289
|
+
lineHeight: dimensions.dimension14,
|
|
290
|
+
},
|
|
291
|
+
error: {
|
|
292
|
+
fontSize: dimensions.dimension09,
|
|
293
|
+
lineHeight: dimensions.dimension12,
|
|
294
|
+
},
|
|
295
|
+
helperText: {
|
|
296
|
+
fontSize: dimensions.dimension09,
|
|
297
|
+
lineHeight: dimensions.dimension12,
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
xxlarge: {
|
|
302
|
+
outlined: {
|
|
303
|
+
container: {
|
|
304
|
+
padding: dimensions.dimension12,
|
|
305
|
+
minHeight: dimensions.dimension21,
|
|
306
|
+
},
|
|
307
|
+
input: {
|
|
308
|
+
fontSize: dimensions.dimension14,
|
|
309
|
+
lineHeight: dimensions.dimension18,
|
|
310
|
+
},
|
|
311
|
+
label: {
|
|
312
|
+
fontSize: dimensions.dimension12,
|
|
313
|
+
lineHeight: dimensions.dimension16,
|
|
314
|
+
},
|
|
315
|
+
error: {
|
|
316
|
+
fontSize: dimensions.dimension10,
|
|
317
|
+
lineHeight: dimensions.dimension14,
|
|
318
|
+
},
|
|
319
|
+
helperText: {
|
|
320
|
+
fontSize: dimensions.dimension10,
|
|
321
|
+
lineHeight: dimensions.dimension14,
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
filled: {
|
|
325
|
+
container: {
|
|
326
|
+
padding: dimensions.dimension12,
|
|
327
|
+
minHeight: dimensions.dimension21,
|
|
328
|
+
backgroundColor: 'colorBackgroundLight',
|
|
329
|
+
},
|
|
330
|
+
input: {
|
|
331
|
+
fontSize: dimensions.dimension14,
|
|
332
|
+
lineHeight: dimensions.dimension18,
|
|
333
|
+
},
|
|
334
|
+
label: {
|
|
335
|
+
fontSize: dimensions.dimension12,
|
|
336
|
+
lineHeight: dimensions.dimension16,
|
|
337
|
+
},
|
|
338
|
+
error: {
|
|
339
|
+
fontSize: dimensions.dimension10,
|
|
340
|
+
lineHeight: dimensions.dimension14,
|
|
341
|
+
},
|
|
342
|
+
helperText: {
|
|
343
|
+
fontSize: dimensions.dimension10,
|
|
344
|
+
lineHeight: dimensions.dimension14,
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
standard: {
|
|
348
|
+
container: {
|
|
349
|
+
padding: dimensions.dimension12,
|
|
350
|
+
minHeight: dimensions.dimension21,
|
|
351
|
+
borderWidth: dimensions.dimension00,
|
|
352
|
+
borderBottomWidth: dimensions.dimension01,
|
|
353
|
+
},
|
|
354
|
+
input: {
|
|
355
|
+
fontSize: dimensions.dimension14,
|
|
356
|
+
lineHeight: dimensions.dimension18,
|
|
357
|
+
},
|
|
358
|
+
label: {
|
|
359
|
+
fontSize: dimensions.dimension12,
|
|
360
|
+
lineHeight: dimensions.dimension16,
|
|
361
|
+
},
|
|
362
|
+
error: {
|
|
363
|
+
fontSize: dimensions.dimension10,
|
|
364
|
+
lineHeight: dimensions.dimension14,
|
|
365
|
+
},
|
|
366
|
+
helperText: {
|
|
367
|
+
fontSize: dimensions.dimension10,
|
|
368
|
+
lineHeight: dimensions.dimension14,
|
|
369
|
+
},
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { ViewStyle, TextStyle, TextInputProps } from 'react-native';
|
|
3
|
+
import type { VariantBreakPoints } from '../responsive/Type';
|
|
4
|
+
import type { CountryCode } from 'libphonenumber-js';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export type InputVariantType = 'outlined' | 'filled' | 'standard';
|
|
8
|
+
export type InputSizeType = 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge';
|
|
9
|
+
|
|
10
|
+
export interface InputIconProps {
|
|
11
|
+
style?: ViewStyle;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface InputProps extends Omit<TextInputProps, 'style'> {
|
|
15
|
+
// variant?: InputVariantType;
|
|
16
|
+
size?: InputSizeType;
|
|
17
|
+
labelText?: string;
|
|
18
|
+
error?: string;
|
|
19
|
+
helperText?: string;
|
|
20
|
+
startAdornment?: React.ReactNode;
|
|
21
|
+
endAdornment?: React.ReactNode;
|
|
22
|
+
prefixIcon?: React.ReactElement<InputIconProps>;
|
|
23
|
+
suffixIcon?: React.ReactElement<InputIconProps>;
|
|
24
|
+
containerStyle?: ViewStyle;
|
|
25
|
+
inputStyle?: TextStyle;
|
|
26
|
+
labelStyle?: TextStyle;
|
|
27
|
+
errorStyle?: TextStyle;
|
|
28
|
+
helperTextStyle?: TextStyle;
|
|
29
|
+
phoneNumber?: boolean;
|
|
30
|
+
countryCode?: string;
|
|
31
|
+
showCountryFlag?: boolean;
|
|
32
|
+
onCountryCodeChange?: (code: string) => void;
|
|
33
|
+
screenName?: string;
|
|
34
|
+
id?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface InputTheme {
|
|
38
|
+
container: ViewStyle;
|
|
39
|
+
input: TextStyle;
|
|
40
|
+
label: TextStyle;
|
|
41
|
+
error: TextStyle;
|
|
42
|
+
helperText: TextStyle;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type InputThemeVariant = {
|
|
46
|
+
[key in InputVariantType]: InputTheme;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type InputThemeSize = {
|
|
50
|
+
[key in InputSizeType]: InputThemeVariant;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type InputBreakpoints = VariantBreakPoints;
|
|
54
|
+
|
|
55
|
+
export type ExtendedInputVariant =
|
|
56
|
+
| 'outlined'
|
|
57
|
+
| 'filled'
|
|
58
|
+
| 'phoneWithFlag'
|
|
59
|
+
| 'phoneWithCodeOnly'
|
|
60
|
+
| 'currency'
|
|
61
|
+
| 'select'
|
|
62
|
+
| 'checkbox';
|
|
63
|
+
|
|
64
|
+
export type SelectListType = 'default' | 'checkbox';
|
|
65
|
+
|
|
66
|
+
export interface SelectOption {
|
|
67
|
+
label: string;
|
|
68
|
+
value: string;
|
|
69
|
+
icon?: React.ReactNode;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface ExtendedInputProps extends Omit<InputProps, 'onChangeText'> {
|
|
73
|
+
variant?: ExtendedInputVariant;
|
|
74
|
+
disabled?: boolean;
|
|
75
|
+
hover?: boolean;
|
|
76
|
+
multiple?: boolean;
|
|
77
|
+
listType?: SelectListType;
|
|
78
|
+
options?: SelectOption[];
|
|
79
|
+
searchable?: boolean;
|
|
80
|
+
noItemText?: string;
|
|
81
|
+
maxVisibleItems?: number;
|
|
82
|
+
selectedIcon?: React.ReactNode;
|
|
83
|
+
expandChips?: boolean;
|
|
84
|
+
maxAllowed?: number;
|
|
85
|
+
onChangeText?: ((value: string) => void) | ((value: string | string[]) => void);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface WebPhoneInputProps
|
|
89
|
+
extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
90
|
+
style?: React.CSSProperties;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface CountryCodeButtonProps {
|
|
94
|
+
country: CountryCode | undefined;
|
|
95
|
+
toggleDropdown: () => void;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface CurrencyCodeButtonProps {
|
|
99
|
+
currency: string;
|
|
100
|
+
toggleDropdown: () => void;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface SeparatorProps {
|
|
104
|
+
colorTheme: {
|
|
105
|
+
colors: {
|
|
106
|
+
colorBorderSubtle: string;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
ReactNode,
|
|
3
|
+
RefObject,
|
|
4
|
+
useCallback,
|
|
5
|
+
useEffect,
|
|
6
|
+
useMemo,
|
|
7
|
+
useRef,
|
|
8
|
+
useState,
|
|
9
|
+
} from 'react';
|
|
10
|
+
import {createPortal} from 'react-dom';
|
|
11
|
+
|
|
12
|
+
const SCROLLBAR_STYLE_ID = 'slice-input-portal-scrollbar-style';
|
|
13
|
+
|
|
14
|
+
type AnchorRect = {
|
|
15
|
+
top: number;
|
|
16
|
+
left: number;
|
|
17
|
+
width: number;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
interface InputPortalProps {
|
|
21
|
+
open: boolean;
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
anchorRef: RefObject<HTMLElement>;
|
|
24
|
+
offsetTop?: number;
|
|
25
|
+
padding?: number;
|
|
26
|
+
maxHeight?: number;
|
|
27
|
+
borderColor: string;
|
|
28
|
+
backgroundColor: string;
|
|
29
|
+
zIndex?: number;
|
|
30
|
+
onRequestClose?: () => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const basePortalStyle: React.CSSProperties = {
|
|
34
|
+
position: 'fixed',
|
|
35
|
+
boxSizing: 'border-box',
|
|
36
|
+
overflowY: 'auto',
|
|
37
|
+
overflowX: 'hidden',
|
|
38
|
+
borderRadius: 8,
|
|
39
|
+
boxShadow: '0 8px 24px rgba(0,0,0,0.16)',
|
|
40
|
+
scrollbarWidth: 'none',
|
|
41
|
+
msOverflowStyle: 'none',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const InputPortal = ({
|
|
45
|
+
open,
|
|
46
|
+
children,
|
|
47
|
+
anchorRef,
|
|
48
|
+
offsetTop = 6,
|
|
49
|
+
padding = 8,
|
|
50
|
+
maxHeight = 220,
|
|
51
|
+
borderColor,
|
|
52
|
+
backgroundColor,
|
|
53
|
+
zIndex = 100000,
|
|
54
|
+
onRequestClose,
|
|
55
|
+
}: InputPortalProps) => {
|
|
56
|
+
const [anchorRect, setAnchorRect] = useState<AnchorRect | null>(null);
|
|
57
|
+
const portalRef = useRef<HTMLDivElement | null>(null);
|
|
58
|
+
const rafRef = useRef<number | null>(null);
|
|
59
|
+
|
|
60
|
+
const setAnchorRectIfChanged = useCallback((nextRect: AnchorRect) => {
|
|
61
|
+
setAnchorRect(prevRect => {
|
|
62
|
+
if (
|
|
63
|
+
prevRect &&
|
|
64
|
+
prevRect.top === nextRect.top &&
|
|
65
|
+
prevRect.left === nextRect.left &&
|
|
66
|
+
prevRect.width === nextRect.width
|
|
67
|
+
) {
|
|
68
|
+
return prevRect;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return nextRect;
|
|
72
|
+
});
|
|
73
|
+
}, []);
|
|
74
|
+
|
|
75
|
+
const measureAnchorRect = useCallback(() => {
|
|
76
|
+
if (!anchorRef.current) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const inputShell = anchorRef.current.closest(
|
|
81
|
+
'.slice-input-container',
|
|
82
|
+
) as HTMLElement | null;
|
|
83
|
+
|
|
84
|
+
const rectSource = inputShell ?? anchorRef.current;
|
|
85
|
+
const rect = rectSource.getBoundingClientRect();
|
|
86
|
+
|
|
87
|
+
setAnchorRectIfChanged({
|
|
88
|
+
top: rect.bottom + offsetTop,
|
|
89
|
+
left: rect.left,
|
|
90
|
+
width: rect.width,
|
|
91
|
+
});
|
|
92
|
+
}, [anchorRef, offsetTop, setAnchorRectIfChanged]);
|
|
93
|
+
|
|
94
|
+
const scheduleMeasureAnchorRect = useCallback(() => {
|
|
95
|
+
if (rafRef.current !== null) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
rafRef.current = window.requestAnimationFrame(() => {
|
|
100
|
+
rafRef.current = null;
|
|
101
|
+
measureAnchorRect();
|
|
102
|
+
});
|
|
103
|
+
}, [measureAnchorRect]);
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if (!open) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
scheduleMeasureAnchorRect();
|
|
111
|
+
|
|
112
|
+
const handleLayout = () => scheduleMeasureAnchorRect();
|
|
113
|
+
|
|
114
|
+
window.addEventListener('resize', handleLayout);
|
|
115
|
+
window.addEventListener('scroll', handleLayout, true);
|
|
116
|
+
|
|
117
|
+
return () => {
|
|
118
|
+
if (rafRef.current !== null) {
|
|
119
|
+
window.cancelAnimationFrame(rafRef.current);
|
|
120
|
+
rafRef.current = null;
|
|
121
|
+
}
|
|
122
|
+
window.removeEventListener('resize', handleLayout);
|
|
123
|
+
window.removeEventListener('scroll', handleLayout, true);
|
|
124
|
+
};
|
|
125
|
+
}, [open, scheduleMeasureAnchorRect]);
|
|
126
|
+
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
if (typeof document === 'undefined') {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (document.getElementById(SCROLLBAR_STYLE_ID)) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const styleNode = document.createElement('style');
|
|
137
|
+
styleNode.id = SCROLLBAR_STYLE_ID;
|
|
138
|
+
styleNode.textContent =
|
|
139
|
+
'.slice-input-portal::-webkit-scrollbar{width:0;height:0;display:none;}';
|
|
140
|
+
document.head.appendChild(styleNode);
|
|
141
|
+
}, []);
|
|
142
|
+
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
if (!open || !onRequestClose) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const handleOutsidePointerDown = (event: PointerEvent | MouseEvent) => {
|
|
149
|
+
const target = event.target as Node | null;
|
|
150
|
+
|
|
151
|
+
if (!target) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (portalRef.current?.contains(target)) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (anchorRef.current?.contains(target)) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
onRequestClose();
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
if (typeof window !== 'undefined' && 'PointerEvent' in window) {
|
|
167
|
+
document.addEventListener('pointerdown', handleOutsidePointerDown, true);
|
|
168
|
+
return () => {
|
|
169
|
+
document.removeEventListener(
|
|
170
|
+
'pointerdown',
|
|
171
|
+
handleOutsidePointerDown,
|
|
172
|
+
true,
|
|
173
|
+
);
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
document.addEventListener('mousedown', handleOutsidePointerDown, true);
|
|
178
|
+
|
|
179
|
+
return () => {
|
|
180
|
+
document.removeEventListener('mousedown', handleOutsidePointerDown, true);
|
|
181
|
+
};
|
|
182
|
+
}, [anchorRef, onRequestClose, open]);
|
|
183
|
+
|
|
184
|
+
const portalStyle = useMemo(
|
|
185
|
+
() => ({
|
|
186
|
+
...basePortalStyle,
|
|
187
|
+
top: anchorRect ? anchorRect.top : -9999,
|
|
188
|
+
left: anchorRect ? anchorRect.left : -9999,
|
|
189
|
+
width: anchorRect ? anchorRect.width : 0,
|
|
190
|
+
padding,
|
|
191
|
+
maxHeight,
|
|
192
|
+
zIndex,
|
|
193
|
+
border: `1px solid ${borderColor}`,
|
|
194
|
+
backgroundColor,
|
|
195
|
+
}),
|
|
196
|
+
[anchorRect, backgroundColor, borderColor, maxHeight, padding, zIndex],
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
if (!open || typeof document === 'undefined') {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return createPortal(
|
|
204
|
+
<div ref={portalRef} className="slice-input-portal" style={portalStyle}>
|
|
205
|
+
{children}
|
|
206
|
+
</div>,
|
|
207
|
+
document.body,
|
|
208
|
+
);
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export default React.memo(InputPortal);
|