onecart-ui 1.0.1
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/README.md +351 -0
- package/dist/components/Button/Button.d.ts +4 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/index.d.ts +3 -0
- package/dist/components/Button/index.d.ts.map +1 -0
- package/dist/components/Heading/Heading.d.ts +5 -0
- package/dist/components/Heading/Heading.d.ts.map +1 -0
- package/dist/components/Heading/index.d.ts +3 -0
- package/dist/components/Heading/index.d.ts.map +1 -0
- package/dist/components/Paragraph/Paragraph.d.ts +5 -0
- package/dist/components/Paragraph/Paragraph.d.ts.map +1 -0
- package/dist/components/Paragraph/index.d.ts +3 -0
- package/dist/components/Paragraph/index.d.ts.map +1 -0
- package/dist/components/Text/Text.d.ts +5 -0
- package/dist/components/Text/Text.d.ts.map +1 -0
- package/dist/components/Text/index.d.ts +3 -0
- package/dist/components/Text/index.d.ts.map +1 -0
- package/dist/components/Typography/Typography.d.ts +5 -0
- package/dist/components/Typography/Typography.d.ts.map +1 -0
- package/dist/components/Typography/index.d.ts +3 -0
- package/dist/components/Typography/index.d.ts.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/styles/tokens/index.d.ts +107 -0
- package/dist/styles/tokens/index.d.ts.map +1 -0
- package/dist/styles/tokens/tokens.d.ts +350 -0
- package/dist/styles/tokens/tokens.d.ts.map +1 -0
- package/dist/styles/tokens/typography.d.ts +154 -0
- package/dist/styles/tokens/typography.d.ts.map +1 -0
- package/dist/styles/tokens/utils/fontUtils.d.ts +26 -0
- package/dist/styles/tokens/utils/fontUtils.d.ts.map +1 -0
- package/dist/styles/tokens/utils/utils.d.ts +13 -0
- package/dist/styles/tokens/utils/utils.d.ts.map +1 -0
- package/dist/theme/ThemeProvider.d.ts +14 -0
- package/dist/theme/ThemeProvider.d.ts.map +1 -0
- package/dist/theme/index.d.ts +55 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/types/Button.d.ts +47 -0
- package/dist/types/Button.d.ts.map +1 -0
- package/dist/types/Heading.d.ts +24 -0
- package/dist/types/Heading.d.ts.map +1 -0
- package/dist/types/Paragraph.d.ts +35 -0
- package/dist/types/Paragraph.d.ts.map +1 -0
- package/dist/types/Text.d.ts +32 -0
- package/dist/types/Text.d.ts.map +1 -0
- package/dist/types/Typography.d.ts +64 -0
- package/dist/types/Typography.d.ts.map +1 -0
- package/package.json +72 -0
- package/src/components/Button/Button.tsx +155 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Heading/Heading.tsx +48 -0
- package/src/components/Heading/index.ts +2 -0
- package/src/components/Paragraph/Paragraph.tsx +93 -0
- package/src/components/Paragraph/index.ts +6 -0
- package/src/components/Text/Text.tsx +96 -0
- package/src/components/Text/index.ts +2 -0
- package/src/components/Typography/Typography.tsx +123 -0
- package/src/components/Typography/index.ts +7 -0
- package/src/index.ts +34 -0
- package/src/styles/tokens/index.ts +130 -0
- package/src/styles/tokens/tokens-autocomplete-config.json +2417 -0
- package/src/styles/tokens/tokens.css +352 -0
- package/src/styles/tokens/tokens.js +350 -0
- package/src/styles/tokens/tokens.json +427 -0
- package/src/styles/tokens/tokens.less +349 -0
- package/src/styles/tokens/tokens.scss +349 -0
- package/src/styles/tokens/tokens.ts +350 -0
- package/src/styles/tokens/tokensMap.scss +353 -0
- package/src/styles/tokens/typography.ts +172 -0
- package/src/styles/tokens/utils/fontUtils.ts +63 -0
- package/src/styles/tokens/utils/utils.ts +19 -0
- package/src/theme/ThemeProvider.tsx +71 -0
- package/src/theme/index.ts +107 -0
- package/src/types/Button.ts +56 -0
- package/src/types/Heading.ts +27 -0
- package/src/types/Paragraph.ts +40 -0
- package/src/types/Text.ts +40 -0
- package/src/types/Typography.ts +94 -0
package/README.md
ADDED
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
# Getting Started with @onecart/ui
|
|
2
|
+
|
|
3
|
+
Welcome to @onecart/ui – a comprehensive cross-platform system built for React and React Native applications. This component library is powered by Figma Design Tokens and provides a consistent component experience across platforms.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Using npm
|
|
9
|
+
npm install @onecart/ui react react-native react-native-web
|
|
10
|
+
|
|
11
|
+
# Using yarn
|
|
12
|
+
yarn add @onecart/ui react react-native react-native-web
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Basic Setup
|
|
16
|
+
|
|
17
|
+
First, wrap your application with the `ThemeProvider`:
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import React from "react";
|
|
21
|
+
import { ThemeProvider } from "@onecart/ui";
|
|
22
|
+
|
|
23
|
+
function App() {
|
|
24
|
+
return <ThemeProvider>{/* Your app content */}</ThemeProvider>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default App;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
This will provide the default theme to all components in the library.
|
|
31
|
+
|
|
32
|
+
## Component Overview
|
|
33
|
+
|
|
34
|
+
### The Typography Pyramid
|
|
35
|
+
|
|
36
|
+
The typography system consists of four main components that build on top of each other:
|
|
37
|
+
|
|
38
|
+
1. **Typography**: The base component for all text rendering (lowest level)
|
|
39
|
+
2. **Text**: Extends Typography with decorations and link functionality
|
|
40
|
+
3. **Heading**: Semantic headings with subtitle support
|
|
41
|
+
4. **Paragraph**: Rich text blocks with spacing and formatting options
|
|
42
|
+
|
|
43
|
+
## Practical Examples
|
|
44
|
+
|
|
45
|
+
### Creating a Landing Page Header
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { Heading, Text, Paragraph } from "@onecart/ui";
|
|
49
|
+
|
|
50
|
+
function LandingPageHeader() {
|
|
51
|
+
return (
|
|
52
|
+
<div>
|
|
53
|
+
<Heading level="h1">Transform Your Design System</Heading>
|
|
54
|
+
<Text variant="labelLg" color="#666666">
|
|
55
|
+
Powered by Figma Design Tokens
|
|
56
|
+
</Text>
|
|
57
|
+
|
|
58
|
+
<Paragraph spacing="lg">
|
|
59
|
+
Build consistent, accessible interfaces across React and React Native
|
|
60
|
+
with our comprehensive typography system.
|
|
61
|
+
</Paragraph>
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Interactive Form with Typography
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { Heading, Text, Paragraph } from "@onecart/ui";
|
|
71
|
+
import { View, TextInput, Button } from "react-native";
|
|
72
|
+
|
|
73
|
+
function SignupForm() {
|
|
74
|
+
return (
|
|
75
|
+
<View style={{ maxWidth: 400, padding: 24 }}>
|
|
76
|
+
<Heading level="h2">Create Account</Heading>
|
|
77
|
+
<Paragraph spacing="lg">
|
|
78
|
+
Join thousands of developers building cross-platform apps.
|
|
79
|
+
</Paragraph>
|
|
80
|
+
|
|
81
|
+
<View style={{ marginBottom: 16 }}>
|
|
82
|
+
<Text variant="labelMd" style={{ marginBottom: 4 }}>
|
|
83
|
+
Email Address
|
|
84
|
+
</Text>
|
|
85
|
+
<TextInput
|
|
86
|
+
style={{
|
|
87
|
+
borderWidth: 1,
|
|
88
|
+
borderColor: "#ccc",
|
|
89
|
+
padding: 8,
|
|
90
|
+
borderRadius: 4,
|
|
91
|
+
}}
|
|
92
|
+
placeholder="you@example.com"
|
|
93
|
+
/>
|
|
94
|
+
</View>
|
|
95
|
+
|
|
96
|
+
<View style={{ marginBottom: 24 }}>
|
|
97
|
+
<Text variant="labelMd" style={{ marginBottom: 4 }}>
|
|
98
|
+
Password
|
|
99
|
+
</Text>
|
|
100
|
+
<TextInput
|
|
101
|
+
style={{
|
|
102
|
+
borderWidth: 1,
|
|
103
|
+
borderColor: "#ccc",
|
|
104
|
+
padding: 8,
|
|
105
|
+
borderRadius: 4,
|
|
106
|
+
}}
|
|
107
|
+
placeholder="••••••••"
|
|
108
|
+
secureTextEntry
|
|
109
|
+
/>
|
|
110
|
+
<Text variant="bodyXs" color="#666666" style={{ marginTop: 4 }}>
|
|
111
|
+
Must be at least 8 characters
|
|
112
|
+
</Text>
|
|
113
|
+
</View>
|
|
114
|
+
|
|
115
|
+
<Button title="Sign Up" onPress={() => {}} />
|
|
116
|
+
</View>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Typography Components in Detail
|
|
122
|
+
|
|
123
|
+
#### Typography
|
|
124
|
+
|
|
125
|
+
The foundational text component:
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
import { Typography } from "@onecart/ui";
|
|
129
|
+
|
|
130
|
+
function TypographyExamples() {
|
|
131
|
+
return (
|
|
132
|
+
<>
|
|
133
|
+
<Typography>Default body text</Typography>
|
|
134
|
+
<Typography variant="displayXl">Display XL</Typography>
|
|
135
|
+
<Typography variant="headingLg">Large heading</Typography>
|
|
136
|
+
<Typography variant="bodySm">Small body text</Typography>
|
|
137
|
+
<Typography weight="bold">Bold text</Typography>
|
|
138
|
+
<Typography align="center">Centered text</Typography>
|
|
139
|
+
</>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Text
|
|
145
|
+
|
|
146
|
+
Enhanced text component with decorations and link support:
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
import { Text } from "@onecart/ui";
|
|
150
|
+
|
|
151
|
+
function TextExamples() {
|
|
152
|
+
return (
|
|
153
|
+
<>
|
|
154
|
+
<Text>Regular text</Text>
|
|
155
|
+
<Text underline>Underlined text</Text>
|
|
156
|
+
<Text strikethrough>Strikethrough text</Text>
|
|
157
|
+
<Text italic>Italic text</Text>
|
|
158
|
+
<Text weight="bold">Bold text</Text>
|
|
159
|
+
<Text underline italic>
|
|
160
|
+
Underlined italic text
|
|
161
|
+
</Text>
|
|
162
|
+
<Text link onLinkPress={() => console.log("Link clicked")}>
|
|
163
|
+
This is a link
|
|
164
|
+
</Text>
|
|
165
|
+
</>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Heading
|
|
171
|
+
|
|
172
|
+
Semantic heading component for page and section titles:
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
import { Heading } from '@onecart/ui';
|
|
176
|
+
|
|
177
|
+
function HeadingExamples() {
|
|
178
|
+
return (
|
|
179
|
+
<>
|
|
180
|
+
<Heading level="h1">Page Title</Heading>
|
|
181
|
+
<Heading level="h2" subtitle="More information about this section">
|
|
182
|
+
Section Title
|
|
183
|
+
</Heading>
|
|
184
|
+
<Heading level="h3" align="center" color="#0066CC">
|
|
185
|
+
Centered Blue Heading
|
|
186
|
+
</Heading>
|
|
187
|
+
Section Title
|
|
188
|
+
</Heading>
|
|
189
|
+
<Heading
|
|
190
|
+
level="h3"
|
|
191
|
+
align="center"
|
|
192
|
+
color="#0066CC"
|
|
193
|
+
>
|
|
194
|
+
Customized Heading
|
|
195
|
+
</Heading>
|
|
196
|
+
</>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Paragraph
|
|
202
|
+
|
|
203
|
+
Rich text paragraphs with formatting options:
|
|
204
|
+
|
|
205
|
+
```tsx
|
|
206
|
+
import { Paragraph, Text } from "@onecart/ui";
|
|
207
|
+
|
|
208
|
+
function Example() {
|
|
209
|
+
return (
|
|
210
|
+
<>
|
|
211
|
+
<Paragraph>Regular paragraph with default spacing.</Paragraph>
|
|
212
|
+
|
|
213
|
+
<Paragraph size="lg" spacing="xl">
|
|
214
|
+
Large paragraph text with extra large bottom spacing.
|
|
215
|
+
</Paragraph>
|
|
216
|
+
|
|
217
|
+
<Paragraph firstLineIndent={true}>
|
|
218
|
+
This paragraph has its first line indented, which is common in printed
|
|
219
|
+
books and formal documents.
|
|
220
|
+
</Paragraph>
|
|
221
|
+
|
|
222
|
+
<Paragraph>
|
|
223
|
+
You can also include <Text weight="bold">formatted text</Text> within
|
|
224
|
+
paragraphs for <Text italic>rich content</Text>.
|
|
225
|
+
</Paragraph>
|
|
226
|
+
</>
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Custom Theming
|
|
232
|
+
|
|
233
|
+
You can customize the theme to match your brand:
|
|
234
|
+
|
|
235
|
+
```tsx
|
|
236
|
+
import { ThemeProvider } from "@onecart/ui";
|
|
237
|
+
|
|
238
|
+
// Define custom theme
|
|
239
|
+
const brandTheme = {
|
|
240
|
+
colors: {
|
|
241
|
+
primary: "#8E24AA",
|
|
242
|
+
text: {
|
|
243
|
+
primary: "#212121",
|
|
244
|
+
secondary: "#616161",
|
|
245
|
+
header: "#000000",
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
typography: {
|
|
249
|
+
fontFamily: {
|
|
250
|
+
base: "Roboto",
|
|
251
|
+
heading: "Roboto Condensed",
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
function App() {
|
|
257
|
+
return (
|
|
258
|
+
<ThemeProvider theme={brandTheme}>
|
|
259
|
+
{/* Your themed app content */}
|
|
260
|
+
</ThemeProvider>
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Complete Application Example
|
|
266
|
+
|
|
267
|
+
Here's a complete example of a simple article page using all typography components:
|
|
268
|
+
|
|
269
|
+
```tsx
|
|
270
|
+
import React from "react";
|
|
271
|
+
import { View, ScrollView } from "react-native";
|
|
272
|
+
import { ThemeProvider, Heading, Text, Paragraph } from "@onecart/ui";
|
|
273
|
+
|
|
274
|
+
function ArticlePage() {
|
|
275
|
+
return (
|
|
276
|
+
<ThemeProvider>
|
|
277
|
+
<ScrollView style={{ padding: 16, maxWidth: 800, margin: "0 auto" }}>
|
|
278
|
+
<Heading level="h1">Typography System in Design</Heading>
|
|
279
|
+
|
|
280
|
+
<Text
|
|
281
|
+
variant="labelMd"
|
|
282
|
+
color="textSecondary"
|
|
283
|
+
style={{ marginBottom: 24 }}
|
|
284
|
+
>
|
|
285
|
+
Posted by Sarah Chen • June 2, 2025 • 5 min read
|
|
286
|
+
</Text>
|
|
287
|
+
|
|
288
|
+
<Paragraph spacing="lg">
|
|
289
|
+
Typography is the foundation of any good design system. It establishes
|
|
290
|
+
hierarchy, improves readability, and creates visual harmony across
|
|
291
|
+
your interfaces.
|
|
292
|
+
</Paragraph>
|
|
293
|
+
|
|
294
|
+
<Heading level="h2">The Importance of Consistency</Heading>
|
|
295
|
+
<Paragraph>
|
|
296
|
+
When designing cross-platform applications, maintaining consistency
|
|
297
|
+
becomes even more crucial. Users expect a cohesive experience
|
|
298
|
+
regardless of whether they're using your web app or mobile app.
|
|
299
|
+
</Paragraph>
|
|
300
|
+
|
|
301
|
+
<Paragraph spacing="lg">
|
|
302
|
+
The <Text weight="bold">@onecart/ui</Text> library solves this by
|
|
303
|
+
providing a comprehensive typography system that works seamlessly
|
|
304
|
+
across React and React Native, all powered by{" "}
|
|
305
|
+
<Text italic>Figma Design Tokens</Text>.
|
|
306
|
+
</Paragraph>
|
|
307
|
+
|
|
308
|
+
<View
|
|
309
|
+
style={{
|
|
310
|
+
padding: 16,
|
|
311
|
+
backgroundColor: "#f5f5f5",
|
|
312
|
+
borderRadius: 8,
|
|
313
|
+
marginBottom: 24,
|
|
314
|
+
}}
|
|
315
|
+
>
|
|
316
|
+
<Heading level="h3" style={{ marginTop: 0 }}>
|
|
317
|
+
Key Benefits
|
|
318
|
+
</Heading>
|
|
319
|
+
<Paragraph>
|
|
320
|
+
• <Text weight="bold">Cross-platform consistency</Text>
|
|
321
|
+
</Paragraph>
|
|
322
|
+
<Paragraph>
|
|
323
|
+
• <Text weight="bold">Semantic markup</Text> for accessibility
|
|
324
|
+
</Paragraph>
|
|
325
|
+
<Paragraph>
|
|
326
|
+
• <Text weight="bold">Token-based styling</Text> for themability
|
|
327
|
+
</Paragraph>
|
|
328
|
+
<Paragraph>
|
|
329
|
+
• <Text weight="bold">Responsive</Text> out of the box
|
|
330
|
+
</Paragraph>
|
|
331
|
+
</View>
|
|
332
|
+
|
|
333
|
+
<Heading level="h2">Getting Started</Heading>
|
|
334
|
+
<Paragraph spacing="lg">
|
|
335
|
+
To implement this typography system in your project, simply install
|
|
336
|
+
the package and wrap your application with the{" "}
|
|
337
|
+
<Text weight="semibold">ThemeProvider</Text>. Then, you can start
|
|
338
|
+
using the various typography components throughout your app.
|
|
339
|
+
</Paragraph>
|
|
340
|
+
|
|
341
|
+
<Paragraph>
|
|
342
|
+
For more information, visit our <Text link>documentation site</Text>{" "}
|
|
343
|
+
or check out our <Text link>Storybook examples</Text>.
|
|
344
|
+
</Paragraph>
|
|
345
|
+
</ScrollView>
|
|
346
|
+
</ThemeProvider>
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export default ArticlePage;
|
|
351
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA+IxC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../../src/components/Heading/Heading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAYnD,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA+B1C,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Heading/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Paragraph.d.ts","sourceRoot":"","sources":["../../../src/components/Paragraph/Paragraph.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIvD,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAmF9C,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Paragraph/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,GACjB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/components/Text/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAsFpC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Text/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Typography.d.ts","sourceRoot":"","sources":["../../../src/components/Typography/Typography.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAgHhD,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Typography/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,gBAAgB,GACjB,MAAM,wBAAwB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { Button } from "./components/Button";
|
|
2
|
+
export { Typography } from "./components/Typography";
|
|
3
|
+
export { Text } from "./components/Text";
|
|
4
|
+
export { Heading } from "./components/Heading";
|
|
5
|
+
export { Paragraph } from "./components/Paragraph";
|
|
6
|
+
export type { ButtonProps } from "./types/Button";
|
|
7
|
+
export type { TypographyProps, TypographyVariant, TypographyAlign, TypographyWeight, } from "./types/Typography";
|
|
8
|
+
export type { TextProps } from "./types/Text";
|
|
9
|
+
export type { HeadingProps, HeadingLevel } from "./types/Heading";
|
|
10
|
+
export type { ParagraphProps, ParagraphSize, ParagraphSpacing, } from "./types/Paragraph";
|
|
11
|
+
export { ThemeProvider, useTheme } from "./theme/ThemeProvider";
|
|
12
|
+
export { defaultTheme, type Theme, type ThemeColors, type ThemeSpacing, type ThemeBorderRadius, type ThemeTypography, } from "./theme";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAClE,YAAY,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EACL,YAAY,EACZ,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,eAAe,GACrB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import o,{createContext as i,useContext as r}from"react";import{TouchableOpacity as a,ActivityIndicator as l,Text as s,View as d}from"react-native";const c="1rem",g="0.5rem",p="0.75rem",h="1rem",m="#525252",f="#3b3b3b",u="#111",x="#0053e2",b="#00df88",y="#4ce9ac",v="#98f2cf",S="#E5FCF3",F="#f1f1f1",z="#e2e2e2",C="#c6c6c6",H="#ababab",W="#919191",D="Campton",w="book",k="16px",L="12px",M="none",R="none",I="none",E=e=>e&&"string"==typeof e?16*parseFloat(e.replace("rem","")):0,T=e=>e&&"string"==typeof e?parseFloat(e.replace("px","")):0,A=e=>"number"==typeof e?e.toString():"book"===e?"400":e,X={display2xl:{fontFamily:"Campton",fontSize:T("52px"),fontWeight:A(500),lineHeight:T("56px"),color:u,letterSpacing:"0%",textDecoration:"none",textCase:"none"},displayXl:{fontFamily:"Campton",fontSize:T("44px"),fontWeight:A(500),lineHeight:T("48px"),color:u,letterSpacing:"0%",textDecoration:"none",textCase:"none"},headingXl:{fontFamily:"Campton",fontSize:T("40px"),fontWeight:A(600),lineHeight:T("44px"),color:u,letterSpacing:"0%",textDecoration:"none",textCase:"none"},headingLg:{fontFamily:"Campton",fontSize:T("36px"),fontWeight:A(600),lineHeight:T("40px"),color:u,letterSpacing:"0%",textDecoration:"none",textCase:"none"},headingMd:{fontFamily:"Campton",fontSize:T("32px"),fontWeight:A(600),lineHeight:T("36px"),color:u,letterSpacing:"0%",textDecoration:"none",textCase:"none"},headingSm:{fontFamily:"Campton",fontSize:T("28px"),fontWeight:A(600),lineHeight:T("32px"),color:u,letterSpacing:"0%",textDecoration:"none",textCase:"none"},headingXs:{fontFamily:"Campton",fontSize:T("20px"),fontWeight:A(600),lineHeight:T("28px"),color:u,letterSpacing:"0%",textDecoration:"none",textCase:"none"},bodyLg:{fontFamily:"Campton",fontSize:T("16px"),fontWeight:A("book"),lineHeight:T("24px"),color:f,letterSpacing:"0%",textDecoration:"none",textCase:"none",paragraphIndent:"0px"},bodyMd:{fontFamily:"Campton",fontSize:T("14px"),fontWeight:A("book"),lineHeight:T("20px"),color:f,letterSpacing:"0%",textDecoration:"none",textCase:"none",paragraphIndent:"0px"},bodySm:{fontFamily:"Campton",fontSize:T("12px"),fontWeight:A("book"),lineHeight:T("20px"),color:f,letterSpacing:"0%",textDecoration:"none",textCase:"none",paragraphIndent:"0px"},bodyXs:{fontFamily:D,fontSize:T(L),fontWeight:A(w),lineHeight:T(k),color:f,letterSpacing:"0%",textDecoration:R,textCase:M,paragraphIndent:"0px"},labelLg:{fontFamily:"Campton",fontSize:T("16px"),fontWeight:A(500),lineHeight:T("16px"),color:m,letterSpacing:"0%",textDecoration:"none",textCase:"none"},labelMd:{fontFamily:"Campton",fontSize:T("14px"),fontWeight:A(500),lineHeight:T("20px"),color:m,letterSpacing:"0%",textDecoration:I,textCase:"none"},labelSm:{fontFamily:D,fontSize:T(L),fontWeight:A(w),lineHeight:T(k),color:m,letterSpacing:"0%",textDecoration:R,textCase:M},weights:{normal:"400",medium:A(500),semibold:A(600),bold:"700"}},P=e=>e&&"string"==typeof e?16*parseFloat(e.replace("rem","")):0,j=e=>e&&"string"==typeof e?parseFloat(e.replace("px","")):0,O={primary:{background:{default:b,hover:y,active:v,disabled:S},text:{default:"#FFFFFF",disabled:W},border:{default:b,hover:y,active:v,disabled:S}},secondary:{background:{default:F,hover:z,active:C,disabled:F},text:{default:"#525252",disabled:H},border:{default:C,hover:H,active:W,disabled:z}},outline:{background:{default:"transparent",hover:S,active:v,disabled:"transparent"},text:{default:b,disabled:H},border:{default:b,hover:y,active:v,disabled:C}},ghost:{background:{default:"transparent",hover:F,active:z,disabled:"transparent"},text:{default:"#6a6a6a",disabled:H},border:{default:"transparent",hover:"transparent",active:"transparent",disabled:"transparent"}},sizes:{sm:{paddingHorizontal:P("0.75rem"),paddingVertical:P(g),fontSize:j("12px"),borderRadius:P("0.25rem"),minHeight:32},md:{paddingHorizontal:P(c),paddingVertical:P(p),fontSize:j("16px"),borderRadius:P("0.25rem"),minHeight:40},lg:{paddingHorizontal:P("2rem"),paddingVertical:P(h),fontSize:j("18px"),borderRadius:P("0.5rem"),minHeight:48}},common:{fontWeight:500,lineHeight:j("16px"),borderWidth:j("0.0625rem"),transition:"all 0.2s ease-in-out"}},V=({children:n,variant:i="primary",size:r="md",disabled:d=!1,fullWidth:c=!1,loading:g=!1,style:p,textStyle:h,accessibilityLabel:m,testID:f,onPress:u})=>{const x=o.useMemo((()=>{try{const e=O.sizes[r],t=O[i];return{...{borderRadius:e.borderRadius,borderWidth:O.common.borderWidth,alignItems:"center",justifyContent:"center",flexDirection:"row"},backgroundColor:d?t.background.disabled:t.background.default,borderColor:d?t.border.disabled:t.border.default}}catch(e){return{backgroundColor:"primary"===i?"#007AFF":"transparent",borderColor:"primary"===i?"#007AFF":"#E5E5EA",borderWidth:1,borderRadius:4,alignItems:"center",justifyContent:"center",flexDirection:"row"}}}),[i,r,d]),b=o.useMemo((()=>{try{const e=O.sizes[r];return{paddingHorizontal:e.paddingHorizontal,paddingVertical:e.paddingVertical,minHeight:e.minHeight}}catch(e){return{paddingHorizontal:16,paddingVertical:8,minHeight:"sm"===r?32:"lg"===r?48:40}}}),[r]),y=o.useMemo((()=>{try{const e=O.sizes[r],t=O[i];return{...{fontSize:e.fontSize,fontWeight:O.common.fontWeight,lineHeight:O.common.lineHeight,color:d?t.text.disabled:t.text.default},...h}}catch(e){return{fontSize:"sm"===r?12:"lg"===r?18:16,fontWeight:"500",color:d?"#8E8E93":"primary"===i?"#FFFFFF":"#007AFF",...h}}}),[i,r,d,h]),v=o.useCallback((()=>{d||g||!u||u()}),[d,g,u]),S=o.useMemo((()=>({...x,...b,...c&&{width:"100%"},...d&&{opacity:.6},...p})),[x,b,c,d,p]);return e(a,{style:S,onPress:v,disabled:d||g,accessibilityLabel:m,accessibilityRole:"button",testID:f,children:[g&&t(l,{size:"small",color:"string"==typeof y.color?y.color:"#000000",style:{marginRight:8}}),t(s,{style:y,children:n})]})},B={colors:{primary:"#007AFF",secondary:"#5856D6",background:"#FFFFFF",surface:"#F2F2F7",text:"#000000",textSecondary:"#8E8E93",border:"#E5E5EA",error:"#FF3B30",warning:"#FF9500",success:"#34C759"},spacing:{xs:4,sm:8,md:16,lg:24,xl:32},borderRadius:{none:0,sm:4,md:8,lg:12,full:9999},typography:{fontSize:{xs:12,sm:14,md:16,lg:18,xl:20,xxl:24},fontWeight:{normal:"400",medium:"500",semibold:"600",bold:"700"},lineHeight:{tight:1.2,normal:1.5,relaxed:1.8}}},q=i(void 0),G=({children:e,theme:n})=>{const i=o.useMemo((()=>{var e,t,o;return{...B,...n,colors:{...B.colors,...null==n?void 0:n.colors},spacing:{...B.spacing,...null==n?void 0:n.spacing},borderRadius:{...B.borderRadius,...null==n?void 0:n.borderRadius},typography:{...B.typography,...null==n?void 0:n.typography,fontSize:{...B.typography.fontSize,...null===(e=null==n?void 0:n.typography)||void 0===e?void 0:e.fontSize},fontWeight:{...B.typography.fontWeight,...null===(t=null==n?void 0:n.typography)||void 0===t?void 0:t.fontWeight},lineHeight:{...B.typography.lineHeight,...null===(o=null==n?void 0:n.typography)||void 0===o?void 0:o.lineHeight}}}}),[n]),r=o.useCallback((e=>{console.log("Theme update requested, but we are using static theme for now.",e)}),[]);return t(q.Provider,{value:{theme:i,updateTheme:r},children:e})},J=()=>{const e=r(q);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e},K=({children:e,variant:n="bodyMd",align:i="left",weight:r,color:a,truncate:l=!1,numberOfLines:d,style:c,accessibilityLabel:g,testID:p,...h})=>{const{theme:m}=J(),u=o.useMemo((()=>{var e;try{const t=X[n],o=i,l=r?X.weights[r]:t.fontWeight;let s=t.color;if((null===(e=null==m?void 0:m.colors)||void 0===e?void 0:e.text)&&"object"==typeof m.colors.text){const e=m.colors.text[n];e&&(s=e)}const d=a||s,c={fontFamily:t.fontFamily,fontSize:t.fontSize,fontWeight:l,lineHeight:t.lineHeight,color:d,textAlign:o};return t.letterSpacing&&(c.letterSpacing=((e,t)=>{if(e.endsWith("px"))return T(e);if(e.endsWith("%")){const n=parseFloat(e)/100;return("string"==typeof t?T(t):t)*n}return 0})(t.letterSpacing.toString(),t.fontSize)),t.textDecoration&&"none"!==t.textDecoration&&(c.textDecorationLine=t.textDecoration),t.textCase&&"none"!==t.textCase&&("uppercase"===t.textCase?c.textTransform="uppercase":"lowercase"===t.textCase?c.textTransform="lowercase":"capitalize"===t.textCase&&(c.textTransform="capitalize")),c}catch(e){return{fontSize:16,fontWeight:"400",lineHeight:24,color:f,textAlign:i}}}),[n,i,r,a,m]),x=o.useMemo((()=>{const e={...u};if(l){const t={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};Object.assign(e,t)}return c&&Object.assign(e,c),e}),[u,l,c]);return t(s,{style:x,numberOfLines:d||(l?1:void 0),accessibilityLabel:g,testID:p,...h,children:e})},N=({children:e,variant:n="bodyMd",align:i,weight:r,color:l,underline:s=!1,strikethrough:d=!1,italic:c=!1,link:g=!1,onLinkPress:p,style:h,...m})=>{var f;const{theme:u}=J(),b=o.useMemo((()=>{var e;const t={};if(s&&(t.textDecorationLine="underline"),d&&(t.textDecorationLine=t.textDecorationLine?"underline line-through":"line-through"),c&&(t.fontStyle="italic"),g){const n=l||(null===(e=u.colors)||void 0===e?void 0:e.primary)||x;t.color=n,t.textDecorationLine=s?"underline":t.textDecorationLine||I}return t}),[s,d,c,g,l,u]),y=o.useMemo((()=>({...b,...h})),[b,h]);return g&&p?t(a,{onPress:p,accessibilityRole:"link",activeOpacity:.7,children:t(K,{variant:n,align:i,weight:r,color:l||(null===(f=u.colors)||void 0===f?void 0:f.primary)||x,style:y,...m,children:e})}):t(K,{variant:n,align:i,weight:r,color:l,style:y,...m,children:e})},Q={h1:"headingXl",h2:"headingLg",h3:"headingMd",h4:"headingSm",h5:"headingXs",h6:"headingXs"},U=({children:o,level:i="h2",subtitle:r,subtitleProps:a,...l})=>e(n,{children:[t(K,{variant:Q[i],accessibilityRole:i,...l,children:o}),r&&t(K,{variant:"bodySm",color:m,style:{marginTop:parseInt(g)},...a,children:r})]}),Y=({children:n,size:o="md",spacing:i="md",firstLineIndent:r=!1,dropCap:a=!1,style:l,...s})=>{const m=()=>{switch(o){case"xs":return"bodyXs";case"sm":return"bodySm";case"lg":return"bodyLg";default:return"bodyMd"}},f={marginBottom:(()=>{switch(i){case"none":return 0;case"xs":return E(g);case"sm":return E(p);case"lg":return E("2rem");case"xl":return E("2.5rem");default:return E(h)}})(),...r?{textIndent:E(c)||20}:{},...l};if(a&&"string"==typeof n&&n.length>0){const o=n.charAt(0),i=n.slice(1);return t(d,{style:f,children:e(d,{style:{flexDirection:"row",alignItems:"flex-start"},children:[t(N,{variant:"headingLg",style:{lineHeight:1,marginRight:E("0.25rem")/4||2,marginTop:-2},...s,children:o}),t(N,{variant:m(),...s,children:i})]})})}return t(N,{variant:m(),style:f,...s,children:n})};export{V as Button,U as Heading,Y as Paragraph,N as Text,G as ThemeProvider,K as Typography,B as defaultTheme,J as useTheme};
|
|
2
|
+
//# sourceMappingURL=index.esm.js.map
|