@app-studio/web 0.9.83 → 0.9.85
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/components/Button/Button/Button.view.d.ts +1 -1
- package/dist/components/Formik/Formik.ColorInput.d.ts +1 -1
- package/dist/components/Gradient/Gradient.d.ts +4 -4
- package/dist/components/Title/Title/Title.props.d.ts +3 -3
- package/dist/components/Title/Title/Title.type.d.ts +1 -1
- package/dist/web.cjs.development.js +755 -784
- package/dist/web.cjs.development.js.map +1 -1
- package/dist/web.cjs.production.min.js +1 -1
- package/dist/web.cjs.production.min.js.map +1 -1
- package/dist/web.esm.js +755 -784
- package/dist/web.esm.js.map +1 -1
- package/dist/web.umd.development.js +755 -784
- package/dist/web.umd.development.js.map +1 -1
- package/dist/web.umd.production.min.js +1 -1
- package/dist/web.umd.production.min.js.map +1 -1
- package/docs/app-studio/Components.md +8 -8
- package/docs/app-studio/Design.md +2 -2
- package/docs/app-studio/Events.md +31 -31
- package/docs/app-studio/Hooks.md +6 -6
- package/docs/app-studio/Providers.md +2 -2
- package/docs/app-studio/README.md +30 -30
- package/docs/app-studio/Responsive.md +3 -3
- package/docs/app-studio/Theming.md +114 -113
- package/docs/app-studio.md +2 -2
- package/docs/component-development/guide.md +10 -10
- package/docs/components/Background.mdx +2 -2
- package/docs/components/Badge.mdx +1 -1
- package/docs/components/Button.mdx +2 -2
- package/docs/components/Carousel.mdx +15 -15
- package/docs/components/Center.mdx +40 -40
- package/docs/components/Checkbox.mdx +5 -5
- package/docs/components/ColorInput.mdx +13 -13
- package/docs/components/ColorPicker.mdx +17 -17
- package/docs/components/ContextMenu.mdx +1 -1
- package/docs/components/DatePicker.mdx +6 -6
- package/docs/components/DragAndDrop.mdx +8 -8
- package/docs/components/Drawer.mdx +3 -3
- package/docs/components/Form.mdx +2 -2
- package/docs/components/Formik.mdx +3 -3
- package/docs/components/Gradient.mdx +32 -32
- package/docs/components/Horizontal.mdx +3 -3
- package/docs/components/HoverCard.mdx +3 -3
- package/docs/components/Icon.mdx +14 -14
- package/docs/components/Label.mdx +28 -28
- package/docs/components/Link.mdx +2 -2
- package/docs/components/Loader.mdx +16 -16
- package/docs/components/OTPInput.mdx +9 -9
- package/docs/components/Password.mdx +1 -1
- package/docs/components/ProgressBar.mdx +9 -9
- package/docs/components/Resizable.mdx +6 -6
- package/docs/components/Selector.mdx +4 -4
- package/docs/components/Sidebar.mdx +2 -2
- package/docs/components/Slider.mdx +10 -10
- package/docs/components/StatusIndicator.mdx +5 -5
- package/docs/components/Switch.mdx +1 -1
- package/docs/components/TagInput.mdx +8 -8
- package/docs/components/Text.mdx +1 -1
- package/docs/components/TextArea.mdx +2 -2
- package/docs/components/TextField.mdx +2 -2
- package/docs/components/Title.mdx +1 -1
- package/docs/components/Vertical.mdx +64 -64
- package/docs/components.md +4 -4
- package/docs/conventions.md +1 -1
- package/docs/design-system/theming.md +19 -19
- package/docs/tutorials/README.md +1 -1
- package/docs/tutorials/basic/creating-a-simple-form.md +2 -2
- package/package.json +2 -2
|
@@ -9,7 +9,7 @@ The `Element` component is the foundation of App-Studio. It is responsible for h
|
|
|
9
9
|
### Usage
|
|
10
10
|
|
|
11
11
|
```jsx
|
|
12
|
-
<Element backgroundColor="color
|
|
12
|
+
<Element backgroundColor="color-blue" padding={10}>This is an element</Element>
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
It is the base component for all other components in the library. It adds additional properties to help manage design:
|
|
@@ -29,7 +29,7 @@ import { View } from 'app-studio';
|
|
|
29
29
|
|
|
30
30
|
<View
|
|
31
31
|
widthHeight={100}
|
|
32
|
-
backgroundColor="color
|
|
32
|
+
backgroundColor="color-white"
|
|
33
33
|
marginTop={20}
|
|
34
34
|
>
|
|
35
35
|
{/* Content */}
|
|
@@ -64,7 +64,7 @@ For displaying text content with theme support. Extends the basic `span` HTML el
|
|
|
64
64
|
import { Text } from 'app-studio';
|
|
65
65
|
|
|
66
66
|
<Text
|
|
67
|
-
color="color
|
|
67
|
+
color="color-black"
|
|
68
68
|
marginRight={10}
|
|
69
69
|
>
|
|
70
70
|
Content
|
|
@@ -72,7 +72,7 @@ import { Text } from 'app-studio';
|
|
|
72
72
|
|
|
73
73
|
// With theme mode
|
|
74
74
|
<Text
|
|
75
|
-
color="color
|
|
75
|
+
color="color-red"
|
|
76
76
|
themeMode="dark"
|
|
77
77
|
>
|
|
78
78
|
Dark mode text
|
|
@@ -129,7 +129,7 @@ import { Input } from 'app-studio';
|
|
|
129
129
|
shadow={9}
|
|
130
130
|
on={{
|
|
131
131
|
hover: {
|
|
132
|
-
backgroundColor: 'color
|
|
132
|
+
backgroundColor: 'color-red'
|
|
133
133
|
}
|
|
134
134
|
}}
|
|
135
135
|
/>
|
|
@@ -144,12 +144,12 @@ import { Button } from 'app-studio';
|
|
|
144
144
|
<Button
|
|
145
145
|
paddingHorizontal={20}
|
|
146
146
|
paddingVertical={10}
|
|
147
|
-
backgroundColor="color
|
|
148
|
-
color="color
|
|
147
|
+
backgroundColor="color-green-500"
|
|
148
|
+
color="color-white"
|
|
149
149
|
borderRadius={5}
|
|
150
150
|
fontWeight="bold"
|
|
151
151
|
on={{
|
|
152
|
-
hover: { backgroundColor: 'color
|
|
152
|
+
hover: { backgroundColor: 'color-green-600' },
|
|
153
153
|
active: { transform: 'scale(0.95)' }
|
|
154
154
|
}}
|
|
155
155
|
>
|
|
@@ -8,7 +8,7 @@ Here is an example:
|
|
|
8
8
|
|
|
9
9
|
```jsx
|
|
10
10
|
<View
|
|
11
|
-
backgroundColor="theme
|
|
11
|
+
backgroundColor="theme-primary"
|
|
12
12
|
padding={20}
|
|
13
13
|
margin={10}
|
|
14
14
|
width={200}
|
|
@@ -25,7 +25,7 @@ The `shadow` prop allows you to apply shadow effects to components. It can accep
|
|
|
25
25
|
Here is an example:
|
|
26
26
|
|
|
27
27
|
```jsx
|
|
28
|
-
<View backgroundColor="theme
|
|
28
|
+
<View backgroundColor="theme-primary" padding={20} shadow={6}>
|
|
29
29
|
I have a shadow
|
|
30
30
|
</View>
|
|
31
31
|
```
|
|
@@ -21,25 +21,25 @@ Here `eventName` is the name of the CSS pseudo-class, `styleProps` are the CSS p
|
|
|
21
21
|
As an alternative to the `on` prop, you can use underscore-prefixed properties directly. This provides a more concise syntax for common event-based styling:
|
|
22
22
|
|
|
23
23
|
```jsx
|
|
24
|
-
_hover={{ backgroundColor: 'blue
|
|
24
|
+
_hover={{ backgroundColor: 'blue-100' }}
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
You can also use string values for simple color changes:
|
|
28
28
|
|
|
29
29
|
```jsx
|
|
30
|
-
_hover="color
|
|
30
|
+
_hover="color-blue-500"
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
Underscore-prefixed properties support all the same events as the `on` prop, but with a more direct syntax. For example, instead of writing:
|
|
34
34
|
|
|
35
35
|
```jsx
|
|
36
|
-
on={{ hover: { backgroundColor: 'blue
|
|
36
|
+
on={{ hover: { backgroundColor: 'blue-100' } }}
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
You can simply write:
|
|
40
40
|
|
|
41
41
|
```jsx
|
|
42
|
-
_hover={{ backgroundColor: 'blue
|
|
42
|
+
_hover={{ backgroundColor: 'blue-100' }}
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
Both approaches achieve the same result, so you can choose the syntax that best fits your coding style. The underscore-prefixed approach is particularly useful when you want to apply styles to multiple different states without nesting them all within a single `on` prop object.
|
|
@@ -54,18 +54,18 @@ Both approaches achieve the same result, so you can choose the syntax that best
|
|
|
54
54
|
<View
|
|
55
55
|
backgroundColor="grey"
|
|
56
56
|
padding={20}
|
|
57
|
-
on={{ hover: { backgroundColor: 'blue
|
|
57
|
+
on={{ hover: { backgroundColor: 'blue-100' } }}
|
|
58
58
|
>
|
|
59
59
|
Hover over me
|
|
60
60
|
</View>
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
In this example, the `View` component's background color will change to `blue
|
|
63
|
+
In this example, the `View` component's background color will change to `blue-100` when the user hovers over it.
|
|
64
64
|
|
|
65
65
|
### Example 2: Background Color Toggle for `Element`
|
|
66
66
|
|
|
67
67
|
```jsx
|
|
68
|
-
<Element backgroundColor="blue" on={{ hover: { backgroundColor: 'color
|
|
68
|
+
<Element backgroundColor="blue" on={{ hover: { backgroundColor: 'color-red' } }} />
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
Here, the `Element` component initially has a background color of `blue`. When hovered over, the background color toggles to `red`.
|
|
@@ -125,10 +125,10 @@ The `on` prop supports a comprehensive set of CSS pseudo-classes, allowing you t
|
|
|
125
125
|
<Form.Input
|
|
126
126
|
value="Focus me"
|
|
127
127
|
on={{
|
|
128
|
-
focus: { borderColor: 'color
|
|
129
|
-
invalid: { borderColor: 'color
|
|
130
|
-
disabled: { backgroundColor: 'color
|
|
131
|
-
placeholder: { color: 'color
|
|
128
|
+
focus: { borderColor: 'color-blue-500', boxShadow: '0 0 0 3px rgba(66, 153, 225, 0.5)' },
|
|
129
|
+
invalid: { borderColor: 'color-red-500' },
|
|
130
|
+
disabled: { backgroundColor: 'color-gray-100', cursor: 'not-allowed' },
|
|
131
|
+
placeholder: { color: 'color-gray-400' }
|
|
132
132
|
}}
|
|
133
133
|
/>
|
|
134
134
|
```
|
|
@@ -140,10 +140,10 @@ This example shows how to style an input field in different states: when it has
|
|
|
140
140
|
```jsx
|
|
141
141
|
<Form.Input
|
|
142
142
|
value="Focus me"
|
|
143
|
-
_focus={{ borderColor: 'color
|
|
144
|
-
_invalid={{ borderColor: 'color
|
|
145
|
-
_disabled={{ backgroundColor: 'color
|
|
146
|
-
_placeholder={{ color: 'color
|
|
143
|
+
_focus={{ borderColor: 'color-blue-500', boxShadow: '0 0 0 3px rgba(66, 153, 225, 0.5)' }}
|
|
144
|
+
_invalid={{ borderColor: 'color-red-500' }}
|
|
145
|
+
_disabled={{ backgroundColor: 'color-gray-100', cursor: 'not-allowed' }}
|
|
146
|
+
_placeholder={{ color: 'color-gray-400' }}
|
|
147
147
|
/>
|
|
148
148
|
```
|
|
149
149
|
|
|
@@ -153,13 +153,13 @@ This example achieves the same result as the previous one but uses the more conc
|
|
|
153
153
|
|
|
154
154
|
```jsx
|
|
155
155
|
<Button
|
|
156
|
-
backgroundColor="color
|
|
156
|
+
backgroundColor="color-blue-500"
|
|
157
157
|
color="white"
|
|
158
158
|
padding={10}
|
|
159
159
|
borderRadius={4}
|
|
160
160
|
on={{
|
|
161
|
-
hover: { backgroundColor: 'color
|
|
162
|
-
active: { backgroundColor: 'color
|
|
161
|
+
hover: { backgroundColor: 'color-blue-600', shadow: 3 },
|
|
162
|
+
active: { backgroundColor: 'color-blue-700', transform: 'scale(0.98)', shadow: 1 },
|
|
163
163
|
focus: { boxShadow: '0 0 0 3px rgba(66, 153, 225, 0.5)' },
|
|
164
164
|
disabled: { opacity: 0.6, cursor: 'not-allowed', shadow: 0 }
|
|
165
165
|
}}
|
|
@@ -176,12 +176,12 @@ This button changes its appearance based on different interaction states, provid
|
|
|
176
176
|
|
|
177
177
|
```jsx
|
|
178
178
|
<Button
|
|
179
|
-
backgroundColor="color
|
|
179
|
+
backgroundColor="color-blue-500"
|
|
180
180
|
color="white"
|
|
181
181
|
padding={10}
|
|
182
182
|
borderRadius={4}
|
|
183
|
-
_hover={{ backgroundColor: 'color
|
|
184
|
-
_active={{ backgroundColor: 'color
|
|
183
|
+
_hover={{ backgroundColor: 'color-blue-600', shadow: 3 }}
|
|
184
|
+
_active={{ backgroundColor: 'color-blue-700', transform: 'scale(0.98)', shadow: 1 }}
|
|
185
185
|
_focus={{ boxShadow: '0 0 0 3px rgba(66, 153, 225, 0.5)' }}
|
|
186
186
|
_disabled={{ opacity: 0.6, cursor: 'not-allowed', shadow: 0 }}
|
|
187
187
|
>
|
|
@@ -199,11 +199,11 @@ This example achieves the same result as the previous one but uses the more conc
|
|
|
199
199
|
<View
|
|
200
200
|
as="li"
|
|
201
201
|
padding={10}
|
|
202
|
-
borderBottom="1px solid color
|
|
202
|
+
borderBottom="1px solid color-gray-200"
|
|
203
203
|
on={{
|
|
204
|
-
firstChild: { borderTop: '1px solid color
|
|
204
|
+
firstChild: { borderTop: '1px solid color-gray-200' },
|
|
205
205
|
lastChild: { borderBottom: 'none' },
|
|
206
|
-
hover: { backgroundColor: 'color
|
|
206
|
+
hover: { backgroundColor: 'color-gray.50' }
|
|
207
207
|
}}
|
|
208
208
|
>
|
|
209
209
|
{item.name}
|
|
@@ -228,7 +228,7 @@ This example shows how to apply different styles to list items based on their po
|
|
|
228
228
|
marginRight={8}
|
|
229
229
|
on={{
|
|
230
230
|
checked: { /* Custom styles for the checked state */ },
|
|
231
|
-
focus: { outline: 'none', boxShadow: '0 0 0 2px color
|
|
231
|
+
focus: { outline: 'none', boxShadow: '0 0 0 2px color-blue-300' }
|
|
232
232
|
}}
|
|
233
233
|
/>
|
|
234
234
|
Accept terms and conditions
|
|
@@ -248,16 +248,16 @@ The `on` prop can be combined with animations to create dynamic effects:
|
|
|
248
248
|
```jsx
|
|
249
249
|
<Button
|
|
250
250
|
padding={10}
|
|
251
|
-
backgroundColor="color
|
|
251
|
+
backgroundColor="color-purple-500"
|
|
252
252
|
color="white"
|
|
253
253
|
borderRadius={4}
|
|
254
254
|
on={{
|
|
255
255
|
hover: {
|
|
256
|
-
backgroundColor: 'color
|
|
256
|
+
backgroundColor: 'color-purple-600',
|
|
257
257
|
animate: Animation.pulse({ duration: '1s', iterationCount: 'infinite' })
|
|
258
258
|
},
|
|
259
259
|
active: {
|
|
260
|
-
backgroundColor: 'color
|
|
260
|
+
backgroundColor: 'color-purple-700',
|
|
261
261
|
animate: Animation.scale({ from: { transform: 'scale(1)' }, to: { transform: 'scale(0.95)' }, duration: '0.1s' })
|
|
262
262
|
}
|
|
263
263
|
}}
|
|
@@ -273,15 +273,15 @@ You can also use underscore-prefixed properties with animations:
|
|
|
273
273
|
```jsx
|
|
274
274
|
<Button
|
|
275
275
|
padding={10}
|
|
276
|
-
backgroundColor="color
|
|
276
|
+
backgroundColor="color-purple-500"
|
|
277
277
|
color="white"
|
|
278
278
|
borderRadius={4}
|
|
279
279
|
_hover={{
|
|
280
|
-
backgroundColor: 'color
|
|
280
|
+
backgroundColor: 'color-purple-600',
|
|
281
281
|
animate: Animation.pulse({ duration: '1s', iterationCount: 'infinite' })
|
|
282
282
|
}}
|
|
283
283
|
_active={{
|
|
284
|
-
backgroundColor: 'color
|
|
284
|
+
backgroundColor: 'color-purple-700',
|
|
285
285
|
animate: Animation.scale({ from: { transform: 'scale(1)' }, to: { transform: 'scale(0.95)' }, duration: '0.1s' })
|
|
286
286
|
}}
|
|
287
287
|
>
|
package/docs/app-studio/Hooks.md
CHANGED
|
@@ -146,7 +146,7 @@ function ThemeComponent() {
|
|
|
146
146
|
<Button onClick={() => setThemeMode(themeMode === 'light' ? 'dark' : 'light')}>
|
|
147
147
|
Toggle Theme
|
|
148
148
|
</Button>
|
|
149
|
-
<View backgroundColor={getColor('theme
|
|
149
|
+
<View backgroundColor={getColor('theme-primary')}>
|
|
150
150
|
Themed content
|
|
151
151
|
</View>
|
|
152
152
|
</>
|
|
@@ -259,7 +259,7 @@ function InViewComponent() {
|
|
|
259
259
|
});
|
|
260
260
|
|
|
261
261
|
return (
|
|
262
|
-
<View ref={ref} height={200} backgroundColor="gray
|
|
262
|
+
<View ref={ref} height={200} backgroundColor="gray-100">
|
|
263
263
|
{inView ? 'Visible' : 'Hidden'}
|
|
264
264
|
</View>
|
|
265
265
|
);
|
|
@@ -324,12 +324,12 @@ function PositionAwareComponent() {
|
|
|
324
324
|
onMouseEnter={handleMouseEnter}
|
|
325
325
|
onMouseLeave={handleMouseLeave}
|
|
326
326
|
padding={20}
|
|
327
|
-
backgroundColor="gray
|
|
327
|
+
backgroundColor="gray-100"
|
|
328
328
|
borderRadius={8}
|
|
329
329
|
>
|
|
330
330
|
Hover me for tooltip
|
|
331
331
|
{relation && (
|
|
332
|
-
<Text fontSize="sm" color="gray
|
|
332
|
+
<Text fontSize="sm" color="gray-600">
|
|
333
333
|
Position: {relation.position.vertical}-{relation.position.horizontal}
|
|
334
334
|
<br />
|
|
335
335
|
More space: {relation.space.vertical}-{relation.space.horizontal}
|
|
@@ -373,7 +373,7 @@ function ManualUpdateExample() {
|
|
|
373
373
|
More space available on {relation.space.vertical} and {relation.space.horizontal}.
|
|
374
374
|
</Text>
|
|
375
375
|
)}
|
|
376
|
-
<View ref={ref} padding={20} backgroundColor="blue
|
|
376
|
+
<View ref={ref} padding={20} backgroundColor="blue-100" marginTop={20}>
|
|
377
377
|
Target Element
|
|
378
378
|
</View>
|
|
379
379
|
</View>
|
|
@@ -390,7 +390,7 @@ function CustomEventsExample() {
|
|
|
390
390
|
});
|
|
391
391
|
|
|
392
392
|
return (
|
|
393
|
-
<View ref={ref} padding={20} backgroundColor="green
|
|
393
|
+
<View ref={ref} padding={20} backgroundColor="green-100">
|
|
394
394
|
Hover, scroll, or resize to see updates
|
|
395
395
|
{relation && (
|
|
396
396
|
<Text fontSize="sm" marginTop={8}>
|
|
@@ -40,8 +40,8 @@ function ThemedComponent() {
|
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
42
|
<View
|
|
43
|
-
backgroundColor={theme
|
|
44
|
-
padding={theme
|
|
43
|
+
backgroundColor={theme-colors.primary}
|
|
44
|
+
padding={theme-spacing.medium}
|
|
45
45
|
>
|
|
46
46
|
<Button onPress={() => setMode(mode === 'light' ? 'dark' : 'light')}>
|
|
47
47
|
Toggle Theme
|
|
@@ -123,10 +123,10 @@ function MyStyledElement() {
|
|
|
123
123
|
<Element
|
|
124
124
|
as="section"
|
|
125
125
|
padding={16}
|
|
126
|
-
backgroundColor="color
|
|
126
|
+
backgroundColor="color-blue-500"
|
|
127
127
|
borderRadius={8}
|
|
128
|
-
color="color
|
|
129
|
-
on={{ hover: { backgroundColor: 'color
|
|
128
|
+
color="color-white"
|
|
129
|
+
on={{ hover: { backgroundColor: 'color-blue-600' } }}
|
|
130
130
|
media={{ mobile: { padding: 8 } }}
|
|
131
131
|
>
|
|
132
132
|
This is a styled section.
|
|
@@ -161,9 +161,9 @@ import { View, Horizontal, Text } from 'app-studio';
|
|
|
161
161
|
|
|
162
162
|
function MyLayout() {
|
|
163
163
|
return (
|
|
164
|
-
<View padding={16} backgroundColor="color
|
|
164
|
+
<View padding={16} backgroundColor="color-gray-100">
|
|
165
165
|
<Horizontal gap={8} alignItems="center">
|
|
166
|
-
<View width={50} height={50} backgroundColor="color
|
|
166
|
+
<View width={50} height={50} backgroundColor="color-red-500" borderRadius="50%" />
|
|
167
167
|
<Text fontSize="lg" fontWeight="bold">Item Title</Text>
|
|
168
168
|
</Horizontal>
|
|
169
169
|
</View>
|
|
@@ -199,7 +199,7 @@ function MyText() {
|
|
|
199
199
|
<Text
|
|
200
200
|
fontSize="xl"
|
|
201
201
|
fontWeight="bold"
|
|
202
|
-
color="theme
|
|
202
|
+
color="theme-primary"
|
|
203
203
|
textAlign="center"
|
|
204
204
|
toUpperCase
|
|
205
205
|
>
|
|
@@ -242,7 +242,7 @@ function MyImage() {
|
|
|
242
242
|
<Image src="logo.png" alt="Company Logo" width={100} height={50} objectFit="contain" />
|
|
243
243
|
|
|
244
244
|
<ImageBackground src="hero.jpg" height={200} width="100%" display="flex" alignItems="center" justifyContent="center">
|
|
245
|
-
<Text color="color
|
|
245
|
+
<Text color="color-white" fontSize="2xl">Overlay Text</Text>
|
|
246
246
|
</ImageBackground>
|
|
247
247
|
</>
|
|
248
248
|
);
|
|
@@ -286,9 +286,9 @@ function MyForm() {
|
|
|
286
286
|
|
|
287
287
|
return (
|
|
288
288
|
<Form onSubmit={handleSubmit} display="flex" flexDirection="column" gap={12}>
|
|
289
|
-
<Input name="username" placeholder="Username" padding={8} borderRadius={4} border="1px solid color
|
|
290
|
-
<Input name="password" type="password" placeholder="Password" padding={8} borderRadius={4} border="1px solid color
|
|
291
|
-
<Button type="submit" backgroundColor="color
|
|
289
|
+
<Input name="username" placeholder="Username" padding={8} borderRadius={4} border="1px solid color-gray-300" />
|
|
290
|
+
<Input name="password" type="password" placeholder="Password" padding={8} borderRadius={4} border="1px solid color-gray-300" />
|
|
291
|
+
<Button type="submit" backgroundColor="color-blue-500" color="color-white" padding={10} borderRadius={4} cursor="pointer">
|
|
292
292
|
Log In
|
|
293
293
|
</Button>
|
|
294
294
|
</Form>
|
|
@@ -346,7 +346,7 @@ function AnimatedComponent() {
|
|
|
346
346
|
<View
|
|
347
347
|
animate={Animation.fadeIn({ duration: '0.5s' })}
|
|
348
348
|
padding={20}
|
|
349
|
-
backgroundColor="color
|
|
349
|
+
backgroundColor="color-blue-200"
|
|
350
350
|
>
|
|
351
351
|
Fades In
|
|
352
352
|
</View>
|
|
@@ -394,7 +394,7 @@ function SequencedAnimation() {
|
|
|
394
394
|
<View
|
|
395
395
|
animate={sequence}
|
|
396
396
|
padding={20}
|
|
397
|
-
backgroundColor="color
|
|
397
|
+
backgroundColor="color-green-200"
|
|
398
398
|
>
|
|
399
399
|
Sequence
|
|
400
400
|
</View>
|
|
@@ -448,7 +448,7 @@ function ResponsiveAnimation() {
|
|
|
448
448
|
return (
|
|
449
449
|
<View
|
|
450
450
|
padding={20}
|
|
451
|
-
backgroundColor="color
|
|
451
|
+
backgroundColor="color-purple-200"
|
|
452
452
|
media={{
|
|
453
453
|
mobile: {
|
|
454
454
|
animate: Animation.fadeIn({ duration: '1s' })
|
|
@@ -496,7 +496,7 @@ import { View } from './components/View'; // Assuming View component path
|
|
|
496
496
|
function HoverComponent() {
|
|
497
497
|
const [hoverRef, isHovered] = useHover();
|
|
498
498
|
return (
|
|
499
|
-
<View ref={hoverRef} padding={20} backgroundColor={isHovered ? 'color
|
|
499
|
+
<View ref={hoverRef} padding={20} backgroundColor={isHovered ? 'color-gray-200' : 'color-white'}>
|
|
500
500
|
Hover over me!
|
|
501
501
|
</View>
|
|
502
502
|
);
|
|
@@ -511,8 +511,8 @@ function ResponsiveComponent() {
|
|
|
511
511
|
return (
|
|
512
512
|
<View>
|
|
513
513
|
<Text>Current Screen: {screen}, Orientation: {orientation}</Text>
|
|
514
|
-
{on('mobile') && <Text color="color
|
|
515
|
-
{on('desktop') && <Text color="color
|
|
514
|
+
{on('mobile') && <Text color="color-red-500">This only shows on mobile!</Text>}
|
|
515
|
+
{on('desktop') && <Text color="color-blue-500">This only shows on desktop!</Text>}
|
|
516
516
|
{/* Check specific breakpoint */}
|
|
517
517
|
{on('md') && <Text>Medium screen size detected.</Text>}
|
|
518
518
|
</View>
|
|
@@ -527,7 +527,7 @@ function LazyLoadComponent() {
|
|
|
527
527
|
const { ref, inView } = useInView({ triggerOnce: true, threshold: 0.1 });
|
|
528
528
|
|
|
529
529
|
return (
|
|
530
|
-
<View ref={ref} height={200} backgroundColor="color
|
|
530
|
+
<View ref={ref} height={200} backgroundColor="color-gray-100">
|
|
531
531
|
{inView ? (
|
|
532
532
|
<View animate={Animation.fadeIn()}>Content loaded!</View>
|
|
533
533
|
) : (
|
|
@@ -552,14 +552,14 @@ Manages the application's theme, including color palettes, light/dark modes, and
|
|
|
552
552
|
|
|
553
553
|
| Prop | Type | Default | Description |
|
|
554
554
|
| :------ | :----------------- | :---------------------------------- | :-------------------------------------------------------------------------------- |
|
|
555
|
-
| `theme` | `object` | `{ primary: 'color
|
|
555
|
+
| `theme` | `object` | `{ primary: 'color-black', ... }` | Custom theme tokens (e.g., `primary`, `secondary`) that map to color strings. |
|
|
556
556
|
| `mode` | `'light' \| 'dark'`| `'light'` | Sets the initial theme mode. |
|
|
557
557
|
| `dark` | `Colors` | Default dark palette & main colors | Configuration object for dark mode containing `main` (singleton colors) and `palette`. |
|
|
558
558
|
| `light` | `Colors` | Default light palette & main colors | Configuration object for light mode containing `main` (singleton colors) and `palette`.|
|
|
559
559
|
|
|
560
560
|
**Context Values (via `useTheme`)**
|
|
561
561
|
|
|
562
|
-
* `getColor(colorName, mode?)`: Resolves a color string (e.g., `color
|
|
562
|
+
* `getColor(colorName, mode?)`: Resolves a color string (e.g., `color-blue-500`, `theme-primary`, `blackAlpha-500`) to its CSS value for the specified or current theme mode. You can also directly access specific theme mode colors using the `light.` or `dark.` prefix (e.g., `light.white` or `dark.red-200`), which will always use that specific theme mode's color regardless of the current theme setting.
|
|
563
563
|
* `theme`: The merged theme configuration object.
|
|
564
564
|
* `themeMode`: The current mode ('light' or 'dark').
|
|
565
565
|
* `setThemeMode(mode)`: Function to change the theme mode.
|
|
@@ -633,8 +633,8 @@ function ThemedComponent() {
|
|
|
633
633
|
|
|
634
634
|
return (
|
|
635
635
|
<View
|
|
636
|
-
backgroundColor={getColor('theme
|
|
637
|
-
color={getColor('color
|
|
636
|
+
backgroundColor={getColor('theme-primary')} // Get theme color
|
|
637
|
+
color={getColor('color-white')} // Get singleton color
|
|
638
638
|
borderRadius={8}
|
|
639
639
|
padding={10}
|
|
640
640
|
>
|
|
@@ -644,8 +644,8 @@ function ThemedComponent() {
|
|
|
644
644
|
<View
|
|
645
645
|
marginTop={10}
|
|
646
646
|
padding={8}
|
|
647
|
-
backgroundColor={getColor('light.blue
|
|
648
|
-
borderColor={getColor('dark.red
|
|
647
|
+
backgroundColor={getColor('light.blue-200')} // Always light mode blue
|
|
648
|
+
borderColor={getColor('dark.red-500')} // Always dark mode red
|
|
649
649
|
borderWidth={2}
|
|
650
650
|
borderStyle="solid"
|
|
651
651
|
borderRadius={4}
|
|
@@ -656,7 +656,7 @@ function ThemedComponent() {
|
|
|
656
656
|
{/* Direct usage in component props without getColor */}
|
|
657
657
|
<View marginTop={10} padding={8}>
|
|
658
658
|
<Text color="light.white">Always light mode white text</Text>
|
|
659
|
-
<Text color="dark.blue
|
|
659
|
+
<Text color="dark.blue-700" marginTop={4}>Always dark mode blue text</Text>
|
|
660
660
|
</View>
|
|
661
661
|
</View>
|
|
662
662
|
);
|
|
@@ -691,16 +691,16 @@ function ResponsiveCard() {
|
|
|
691
691
|
<View
|
|
692
692
|
flexDirection={on('mobile') ? 'column' : 'row'} // Stack on mobile, row otherwise
|
|
693
693
|
padding={16}
|
|
694
|
-
backgroundColor="color
|
|
694
|
+
backgroundColor="color-white"
|
|
695
695
|
borderRadius={8}
|
|
696
696
|
shadow={2} // Apply shadow level 2
|
|
697
697
|
gap={on('mobile') ? 12 : 20}
|
|
698
698
|
>
|
|
699
699
|
<View flex={1}> {/* Use flex for layout control */}
|
|
700
700
|
<Text fontWeight="bold" fontSize="lg">Card Title</Text>
|
|
701
|
-
<Text color="color
|
|
701
|
+
<Text color="color-gray-600">Some descriptive content here.</Text>
|
|
702
702
|
</View>
|
|
703
|
-
<View width={on('mobile') ? '100%' : 100} height={100} backgroundColor="color
|
|
703
|
+
<View width={on('mobile') ? '100%' : 100} height={100} backgroundColor="color-blue-100" borderRadius={4}>
|
|
704
704
|
{/* Image or placeholder */}
|
|
705
705
|
</View>
|
|
706
706
|
</View>
|
|
@@ -718,14 +718,14 @@ function AnimatedButton() {
|
|
|
718
718
|
<Button
|
|
719
719
|
paddingHorizontal={20}
|
|
720
720
|
paddingVertical={10}
|
|
721
|
-
backgroundColor="color
|
|
722
|
-
color="color
|
|
721
|
+
backgroundColor="color-green-500"
|
|
722
|
+
color="color-white"
|
|
723
723
|
borderRadius={5}
|
|
724
724
|
fontWeight="bold"
|
|
725
725
|
animate={Animation.fadeIn({ duration: '0.5s' })}
|
|
726
726
|
on={{
|
|
727
727
|
hover: {
|
|
728
|
-
backgroundColor: 'color
|
|
728
|
+
backgroundColor: 'color-green-600',
|
|
729
729
|
animate: Animation.pulse({ duration: '0.8s', iterationCount: 2 })
|
|
730
730
|
},
|
|
731
731
|
active: {
|
|
@@ -21,13 +21,13 @@ const Example = () => {
|
|
|
21
21
|
<View widthHeight={100}
|
|
22
22
|
media={{
|
|
23
23
|
mobile: {
|
|
24
|
-
backgroundColor: 'color
|
|
24
|
+
backgroundColor: 'color-green',
|
|
25
25
|
},
|
|
26
26
|
tablet: {
|
|
27
|
-
backgroundColor: 'color
|
|
27
|
+
backgroundColor: 'color-yellow',
|
|
28
28
|
},
|
|
29
29
|
xl: {
|
|
30
|
-
backgroundColor: 'color
|
|
30
|
+
backgroundColor: 'color-blue',
|
|
31
31
|
},
|
|
32
32
|
}}
|
|
33
33
|
/>
|