@indra-inter/neobrutalism-components 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/README.md +1330 -0
- package/dist/module/assets/avatar-profile.png +0 -0
- package/dist/module/components/accordion/accordion.js +203 -0
- package/dist/module/components/accordion/accordion.js.map +1 -0
- package/dist/module/components/app-bar/app-bar.js +140 -0
- package/dist/module/components/app-bar/app-bar.js.map +1 -0
- package/dist/module/components/avatar/avatar.js +184 -0
- package/dist/module/components/avatar/avatar.js.map +1 -0
- package/dist/module/components/badge/badge.js +133 -0
- package/dist/module/components/badge/badge.js.map +1 -0
- package/dist/module/components/bottom-navigation/bottom-navigation.js +166 -0
- package/dist/module/components/bottom-navigation/bottom-navigation.js.map +1 -0
- package/dist/module/components/bottom-sheet/bottom-sheet.js +285 -0
- package/dist/module/components/bottom-sheet/bottom-sheet.js.map +1 -0
- package/dist/module/components/button/button.js +253 -0
- package/dist/module/components/button/button.js.map +1 -0
- package/dist/module/components/calendar/calendar.js +458 -0
- package/dist/module/components/calendar/calendar.js.map +1 -0
- package/dist/module/components/call-item/call-item.js +128 -0
- package/dist/module/components/call-item/call-item.js.map +1 -0
- package/dist/module/components/card/card.js +189 -0
- package/dist/module/components/card/card.js.map +1 -0
- package/dist/module/components/chat-list-item/chat-list-item.js +212 -0
- package/dist/module/components/chat-list-item/chat-list-item.js.map +1 -0
- package/dist/module/components/checkbox/checkbox.js +141 -0
- package/dist/module/components/checkbox/checkbox.js.map +1 -0
- package/dist/module/components/dialog/dialog.js +342 -0
- package/dist/module/components/dialog/dialog.js.map +1 -0
- package/dist/module/components/divider/divider.js +41 -0
- package/dist/module/components/divider/divider.js.map +1 -0
- package/dist/module/components/dropdown/dropdown-menu.js +214 -0
- package/dist/module/components/dropdown/dropdown-menu.js.map +1 -0
- package/dist/module/components/dropdown/dropdown.js +616 -0
- package/dist/module/components/dropdown/dropdown.js.map +1 -0
- package/dist/module/components/dropdown/types.js +4 -0
- package/dist/module/components/dropdown/types.js.map +1 -0
- package/dist/module/components/icon-button/icon-button.js +140 -0
- package/dist/module/components/icon-button/icon-button.js.map +1 -0
- package/dist/module/components/input/currency-input.js +60 -0
- package/dist/module/components/input/currency-input.js.map +1 -0
- package/dist/module/components/input/input.js +281 -0
- package/dist/module/components/input/input.js.map +1 -0
- package/dist/module/components/input/otp-input.js +196 -0
- package/dist/module/components/input/otp-input.js.map +1 -0
- package/dist/module/components/input/password-input.js +74 -0
- package/dist/module/components/input/password-input.js.map +1 -0
- package/dist/module/components/input/phone-input.js +68 -0
- package/dist/module/components/input/phone-input.js.map +1 -0
- package/dist/module/components/input/url-input.js +43 -0
- package/dist/module/components/input/url-input.js.map +1 -0
- package/dist/module/components/list-item/list-item.js +148 -0
- package/dist/module/components/list-item/list-item.js.map +1 -0
- package/dist/module/components/pin-code-field/pin-code-field.js +164 -0
- package/dist/module/components/pin-code-field/pin-code-field.js.map +1 -0
- package/dist/module/components/progress/progress.js +261 -0
- package/dist/module/components/progress/progress.js.map +1 -0
- package/dist/module/components/radio/radio.js +135 -0
- package/dist/module/components/radio/radio.js.map +1 -0
- package/dist/module/components/skeleton/skeleton.js +328 -0
- package/dist/module/components/skeleton/skeleton.js.map +1 -0
- package/dist/module/components/switch/switch.js +170 -0
- package/dist/module/components/switch/switch.js.map +1 -0
- package/dist/module/components/tabs/tabs.js +197 -0
- package/dist/module/components/tabs/tabs.js.map +1 -0
- package/dist/module/components/toast/toast-provider.js +117 -0
- package/dist/module/components/toast/toast-provider.js.map +1 -0
- package/dist/module/components/toast/toast.js +154 -0
- package/dist/module/components/toast/toast.js.map +1 -0
- package/dist/module/index.js +38 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/package.json +1 -0
- package/dist/module/theme/design-tokens.generated.js +379 -0
- package/dist/module/theme/design-tokens.generated.js.map +1 -0
- package/dist/module/theme/theme-provider.js +20 -0
- package/dist/module/theme/theme-provider.js.map +1 -0
- package/dist/module/theme/theme.js +56 -0
- package/dist/module/theme/theme.js.map +1 -0
- package/dist/typescript/components/accordion/accordion.d.ts +40 -0
- package/dist/typescript/components/accordion/accordion.d.ts.map +1 -0
- package/dist/typescript/components/app-bar/app-bar.d.ts +34 -0
- package/dist/typescript/components/app-bar/app-bar.d.ts.map +1 -0
- package/dist/typescript/components/avatar/avatar.d.ts +17 -0
- package/dist/typescript/components/avatar/avatar.d.ts.map +1 -0
- package/dist/typescript/components/badge/badge.d.ts +20 -0
- package/dist/typescript/components/badge/badge.d.ts.map +1 -0
- package/dist/typescript/components/bottom-navigation/bottom-navigation.d.ts +28 -0
- package/dist/typescript/components/bottom-navigation/bottom-navigation.d.ts.map +1 -0
- package/dist/typescript/components/bottom-sheet/bottom-sheet.d.ts +38 -0
- package/dist/typescript/components/bottom-sheet/bottom-sheet.d.ts.map +1 -0
- package/dist/typescript/components/button/button.d.ts +21 -0
- package/dist/typescript/components/button/button.d.ts.map +1 -0
- package/dist/typescript/components/calendar/calendar.d.ts +41 -0
- package/dist/typescript/components/calendar/calendar.d.ts.map +1 -0
- package/dist/typescript/components/call-item/call-item.d.ts +21 -0
- package/dist/typescript/components/call-item/call-item.d.ts.map +1 -0
- package/dist/typescript/components/card/card.d.ts +37 -0
- package/dist/typescript/components/card/card.d.ts.map +1 -0
- package/dist/typescript/components/chat-list-item/chat-list-item.d.ts +37 -0
- package/dist/typescript/components/chat-list-item/chat-list-item.d.ts.map +1 -0
- package/dist/typescript/components/checkbox/checkbox.d.ts +15 -0
- package/dist/typescript/components/checkbox/checkbox.d.ts.map +1 -0
- package/dist/typescript/components/dialog/dialog.d.ts +34 -0
- package/dist/typescript/components/dialog/dialog.d.ts.map +1 -0
- package/dist/typescript/components/divider/divider.d.ts +10 -0
- package/dist/typescript/components/divider/divider.d.ts.map +1 -0
- package/dist/typescript/components/dropdown/dropdown-menu.d.ts +27 -0
- package/dist/typescript/components/dropdown/dropdown-menu.d.ts.map +1 -0
- package/dist/typescript/components/dropdown/dropdown.d.ts +4 -0
- package/dist/typescript/components/dropdown/dropdown.d.ts.map +1 -0
- package/dist/typescript/components/dropdown/types.d.ts +52 -0
- package/dist/typescript/components/dropdown/types.d.ts.map +1 -0
- package/dist/typescript/components/icon-button/icon-button.d.ts +20 -0
- package/dist/typescript/components/icon-button/icon-button.d.ts.map +1 -0
- package/dist/typescript/components/input/currency-input.d.ts +10 -0
- package/dist/typescript/components/input/currency-input.d.ts.map +1 -0
- package/dist/typescript/components/input/input.d.ts +32 -0
- package/dist/typescript/components/input/input.d.ts.map +1 -0
- package/dist/typescript/components/input/otp-input.d.ts +23 -0
- package/dist/typescript/components/input/otp-input.d.ts.map +1 -0
- package/dist/typescript/components/input/password-input.d.ts +14 -0
- package/dist/typescript/components/input/password-input.d.ts.map +1 -0
- package/dist/typescript/components/input/phone-input.d.ts +13 -0
- package/dist/typescript/components/input/phone-input.d.ts.map +1 -0
- package/dist/typescript/components/input/url-input.d.ts +10 -0
- package/dist/typescript/components/input/url-input.d.ts.map +1 -0
- package/dist/typescript/components/list-item/list-item.d.ts +30 -0
- package/dist/typescript/components/list-item/list-item.d.ts.map +1 -0
- package/dist/typescript/components/pin-code-field/pin-code-field.d.ts +25 -0
- package/dist/typescript/components/pin-code-field/pin-code-field.d.ts.map +1 -0
- package/dist/typescript/components/progress/progress.d.ts +18 -0
- package/dist/typescript/components/progress/progress.d.ts.map +1 -0
- package/dist/typescript/components/radio/radio.d.ts +12 -0
- package/dist/typescript/components/radio/radio.d.ts.map +1 -0
- package/dist/typescript/components/skeleton/skeleton.d.ts +16 -0
- package/dist/typescript/components/skeleton/skeleton.d.ts.map +1 -0
- package/dist/typescript/components/switch/switch.d.ts +12 -0
- package/dist/typescript/components/switch/switch.d.ts.map +1 -0
- package/dist/typescript/components/tabs/tabs.d.ts +37 -0
- package/dist/typescript/components/tabs/tabs.d.ts.map +1 -0
- package/dist/typescript/components/toast/toast-provider.d.ts +22 -0
- package/dist/typescript/components/toast/toast-provider.d.ts.map +1 -0
- package/dist/typescript/components/toast/toast.d.ts +15 -0
- package/dist/typescript/components/toast/toast.d.ts.map +1 -0
- package/dist/typescript/index.d.ts +36 -0
- package/dist/typescript/index.d.ts.map +1 -0
- package/dist/typescript/package.json +1 -0
- package/dist/typescript/theme/design-tokens.generated.d.ts +375 -0
- package/dist/typescript/theme/design-tokens.generated.d.ts.map +1 -0
- package/dist/typescript/theme/theme-provider.d.ts +8 -0
- package/dist/typescript/theme/theme-provider.d.ts.map +1 -0
- package/dist/typescript/theme/theme.d.ts +52 -0
- package/dist/typescript/theme/theme.d.ts.map +1 -0
- package/package.json +88 -0
- package/tokens.css +132 -0
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
import { Animated, Easing, Platform, StyleSheet, View } from 'react-native';
|
|
5
|
+
import { useTheme } from "../../theme/theme-provider.js";
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
7
|
+
const TEXT_BLOCK_WIDTHS = ['100%', 261, '100%', 165, 287];
|
|
8
|
+
const LIST_ROWS = [{
|
|
9
|
+
detailWidth: 258,
|
|
10
|
+
titleWidth: 145
|
|
11
|
+
}, {
|
|
12
|
+
detailWidth: 223,
|
|
13
|
+
titleWidth: 194
|
|
14
|
+
}, {
|
|
15
|
+
detailWidth: 258,
|
|
16
|
+
opacity: 0.75,
|
|
17
|
+
titleWidth: 175
|
|
18
|
+
}, {
|
|
19
|
+
detailWidth: 258,
|
|
20
|
+
opacity: 0.5,
|
|
21
|
+
titleWidth: 175
|
|
22
|
+
}, {
|
|
23
|
+
detailWidth: 258,
|
|
24
|
+
opacity: 0.25,
|
|
25
|
+
titleWidth: 175
|
|
26
|
+
}];
|
|
27
|
+
export function Skeleton({
|
|
28
|
+
accessibilityLabel,
|
|
29
|
+
animated = true,
|
|
30
|
+
animationDuration = 900,
|
|
31
|
+
radius,
|
|
32
|
+
rounded = 'sharp',
|
|
33
|
+
shadow = true,
|
|
34
|
+
shadowColor,
|
|
35
|
+
shadowOffset,
|
|
36
|
+
style,
|
|
37
|
+
type = 'textBlock',
|
|
38
|
+
...props
|
|
39
|
+
}) {
|
|
40
|
+
const theme = useTheme();
|
|
41
|
+
const styles = createStyles(theme);
|
|
42
|
+
const opacity = useRef(new Animated.Value(1)).current;
|
|
43
|
+
const resolvedRadius = radius ?? (rounded === 'rounded' ? theme.border.radius : 0);
|
|
44
|
+
const resolvedShadowColor = shadowColor ?? theme.shadow.color;
|
|
45
|
+
const resolvedShadowOffset = shadowOffset ?? theme.shadow.xsOffset;
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
opacity.stopAnimation();
|
|
48
|
+
if (!animated) {
|
|
49
|
+
opacity.setValue(1);
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const animation = Animated.loop(Animated.sequence([Animated.timing(opacity, {
|
|
53
|
+
duration: Math.max(1, animationDuration),
|
|
54
|
+
easing: Easing.inOut(Easing.ease),
|
|
55
|
+
toValue: 0.45,
|
|
56
|
+
useNativeDriver: true
|
|
57
|
+
}), Animated.timing(opacity, {
|
|
58
|
+
duration: Math.max(1, animationDuration),
|
|
59
|
+
easing: Easing.inOut(Easing.ease),
|
|
60
|
+
toValue: 1,
|
|
61
|
+
useNativeDriver: true
|
|
62
|
+
})]));
|
|
63
|
+
animation.start();
|
|
64
|
+
return () => animation.stop();
|
|
65
|
+
}, [animated, animationDuration, opacity]);
|
|
66
|
+
const blockProps = {
|
|
67
|
+
animatedOpacity: opacity,
|
|
68
|
+
radius: resolvedRadius,
|
|
69
|
+
shadow,
|
|
70
|
+
shadowColor: resolvedShadowColor,
|
|
71
|
+
shadowOffset: resolvedShadowOffset,
|
|
72
|
+
styles
|
|
73
|
+
};
|
|
74
|
+
return /*#__PURE__*/_jsxs(Animated.View, {
|
|
75
|
+
accessibilityLabel: accessibilityLabel ?? getAccessibilityLabel(type),
|
|
76
|
+
accessibilityRole: "progressbar",
|
|
77
|
+
accessibilityState: {
|
|
78
|
+
busy: true
|
|
79
|
+
},
|
|
80
|
+
style: [styles.root, styles[`${type}Root`], style],
|
|
81
|
+
...props,
|
|
82
|
+
children: [type === 'chat' ? /*#__PURE__*/_jsx(ChatSkeleton, {
|
|
83
|
+
...blockProps
|
|
84
|
+
}) : null, type === 'list' ? /*#__PURE__*/_jsx(ListSkeleton, {
|
|
85
|
+
...blockProps
|
|
86
|
+
}) : null, type === 'textBlock' ? /*#__PURE__*/_jsx(TextBlockSkeleton, {
|
|
87
|
+
...blockProps
|
|
88
|
+
}) : null]
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function SkeletonBlock({
|
|
92
|
+
animatedOpacity,
|
|
93
|
+
bordered = false,
|
|
94
|
+
height = 12,
|
|
95
|
+
radius,
|
|
96
|
+
shadow,
|
|
97
|
+
shadowColor,
|
|
98
|
+
shadowOffset,
|
|
99
|
+
styles,
|
|
100
|
+
testID,
|
|
101
|
+
width = '100%'
|
|
102
|
+
}) {
|
|
103
|
+
const usesAndroidHardShadow = Platform.OS === 'android' && shadow;
|
|
104
|
+
const usesIOSNativeShadow = Platform.OS === 'ios' && shadow;
|
|
105
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
106
|
+
style: [styles.blockContainer, {
|
|
107
|
+
width
|
|
108
|
+
}],
|
|
109
|
+
children: [usesAndroidHardShadow ? /*#__PURE__*/_jsx(View, {
|
|
110
|
+
pointerEvents: "none",
|
|
111
|
+
style: [styles.hardShadow, {
|
|
112
|
+
backgroundColor: shadowColor,
|
|
113
|
+
borderRadius: radius,
|
|
114
|
+
bottom: -shadowOffset,
|
|
115
|
+
left: shadowOffset,
|
|
116
|
+
right: -shadowOffset,
|
|
117
|
+
top: shadowOffset
|
|
118
|
+
}],
|
|
119
|
+
testID: "skeleton-block-shadow"
|
|
120
|
+
}) : null, /*#__PURE__*/_jsx(Animated.View, {
|
|
121
|
+
pointerEvents: "none",
|
|
122
|
+
style: [styles.block, {
|
|
123
|
+
borderRadius: radius,
|
|
124
|
+
height,
|
|
125
|
+
opacity: animatedOpacity,
|
|
126
|
+
width: '100%'
|
|
127
|
+
}, bordered && styles.borderedBlock, usesIOSNativeShadow && {
|
|
128
|
+
shadowColor,
|
|
129
|
+
shadowOffset: {
|
|
130
|
+
height: shadowOffset,
|
|
131
|
+
width: shadowOffset
|
|
132
|
+
},
|
|
133
|
+
shadowOpacity: 1,
|
|
134
|
+
shadowRadius: 0
|
|
135
|
+
}],
|
|
136
|
+
testID: testID ?? 'skeleton-block'
|
|
137
|
+
})]
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function ChatSkeleton(props) {
|
|
141
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
142
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
143
|
+
style: props.styles.chatHeader,
|
|
144
|
+
children: [/*#__PURE__*/_jsx(SkeletonBlock, {
|
|
145
|
+
...props,
|
|
146
|
+
height: 36,
|
|
147
|
+
testID: "skeleton-chat-avatar",
|
|
148
|
+
width: 36
|
|
149
|
+
}), /*#__PURE__*/_jsx(SkeletonBlock, {
|
|
150
|
+
...props,
|
|
151
|
+
height: 15,
|
|
152
|
+
width: 100
|
|
153
|
+
})]
|
|
154
|
+
}), /*#__PURE__*/_jsxs(SkeletonChatBubble, {
|
|
155
|
+
...props,
|
|
156
|
+
children: [/*#__PURE__*/_jsx(SkeletonBlock, {
|
|
157
|
+
...props,
|
|
158
|
+
bordered: true
|
|
159
|
+
}), /*#__PURE__*/_jsx(SkeletonBlock, {
|
|
160
|
+
...props,
|
|
161
|
+
bordered: true,
|
|
162
|
+
width: 138
|
|
163
|
+
})]
|
|
164
|
+
})]
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function SkeletonChatBubble({
|
|
168
|
+
children,
|
|
169
|
+
...props
|
|
170
|
+
}) {
|
|
171
|
+
const usesAndroidHardShadow = Platform.OS === 'android' && props.shadow;
|
|
172
|
+
const usesIOSNativeShadow = Platform.OS === 'ios' && props.shadow;
|
|
173
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
174
|
+
style: props.styles.chatBubbleFrame,
|
|
175
|
+
children: [usesAndroidHardShadow ? /*#__PURE__*/_jsx(View, {
|
|
176
|
+
pointerEvents: "none",
|
|
177
|
+
style: [props.styles.chatBubbleHardShadow, {
|
|
178
|
+
backgroundColor: props.shadowColor,
|
|
179
|
+
borderRadius: props.radius,
|
|
180
|
+
bottom: -props.shadowOffset,
|
|
181
|
+
left: props.shadowOffset,
|
|
182
|
+
right: -props.shadowOffset,
|
|
183
|
+
top: props.shadowOffset
|
|
184
|
+
}],
|
|
185
|
+
testID: "skeleton-chat-bubble-shadow"
|
|
186
|
+
}) : null, /*#__PURE__*/_jsx(View, {
|
|
187
|
+
style: [props.styles.chatBubble, {
|
|
188
|
+
borderRadius: props.radius
|
|
189
|
+
}, usesIOSNativeShadow && {
|
|
190
|
+
shadowColor: props.shadowColor,
|
|
191
|
+
shadowOffset: {
|
|
192
|
+
height: props.shadowOffset,
|
|
193
|
+
width: props.shadowOffset
|
|
194
|
+
},
|
|
195
|
+
shadowOpacity: 1,
|
|
196
|
+
shadowRadius: 0
|
|
197
|
+
}],
|
|
198
|
+
testID: "skeleton-chat-bubble",
|
|
199
|
+
children: children
|
|
200
|
+
})]
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
function ListSkeleton(props) {
|
|
204
|
+
return /*#__PURE__*/_jsx(View, {
|
|
205
|
+
style: props.styles.listContent,
|
|
206
|
+
children: LIST_ROWS.map((row, index) => /*#__PURE__*/_jsxs(View, {
|
|
207
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
208
|
+
style: [props.styles.listRow, row.opacity ? {
|
|
209
|
+
opacity: row.opacity
|
|
210
|
+
} : undefined],
|
|
211
|
+
testID: "skeleton-list-row",
|
|
212
|
+
children: [/*#__PURE__*/_jsx(SkeletonBlock, {
|
|
213
|
+
...props,
|
|
214
|
+
height: 36,
|
|
215
|
+
width: 36
|
|
216
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
217
|
+
style: props.styles.listText,
|
|
218
|
+
children: [/*#__PURE__*/_jsx(SkeletonBlock, {
|
|
219
|
+
...props,
|
|
220
|
+
height: 15,
|
|
221
|
+
width: row.titleWidth
|
|
222
|
+
}), /*#__PURE__*/_jsx(SkeletonBlock, {
|
|
223
|
+
...props,
|
|
224
|
+
height: 8,
|
|
225
|
+
width: row.detailWidth
|
|
226
|
+
})]
|
|
227
|
+
})]
|
|
228
|
+
}), index < LIST_ROWS.length - 1 ? /*#__PURE__*/_jsx(View, {
|
|
229
|
+
style: props.styles.divider
|
|
230
|
+
}) : null]
|
|
231
|
+
}, index))
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
function TextBlockSkeleton(props) {
|
|
235
|
+
return /*#__PURE__*/_jsx(View, {
|
|
236
|
+
style: props.styles.textBlockContent,
|
|
237
|
+
children: TEXT_BLOCK_WIDTHS.map((width, index) => /*#__PURE__*/_jsx(SkeletonBlock, {
|
|
238
|
+
...props,
|
|
239
|
+
width: width
|
|
240
|
+
}, index))
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
function getAccessibilityLabel(type) {
|
|
244
|
+
const labels = {
|
|
245
|
+
chat: 'Loading chat',
|
|
246
|
+
list: 'Loading list',
|
|
247
|
+
textBlock: 'Loading text block'
|
|
248
|
+
};
|
|
249
|
+
return labels[type];
|
|
250
|
+
}
|
|
251
|
+
function createStyles(theme) {
|
|
252
|
+
return StyleSheet.create({
|
|
253
|
+
block: {
|
|
254
|
+
backgroundColor: theme.colors.disabled
|
|
255
|
+
},
|
|
256
|
+
blockContainer: {
|
|
257
|
+
alignSelf: 'flex-start',
|
|
258
|
+
position: 'relative'
|
|
259
|
+
},
|
|
260
|
+
borderedBlock: {
|
|
261
|
+
borderColor: theme.border.color,
|
|
262
|
+
borderWidth: theme.border.width
|
|
263
|
+
},
|
|
264
|
+
chatBubble: {
|
|
265
|
+
backgroundColor: theme.colors.background,
|
|
266
|
+
gap: 8,
|
|
267
|
+
padding: 14,
|
|
268
|
+
position: 'relative'
|
|
269
|
+
},
|
|
270
|
+
chatBubbleFrame: {
|
|
271
|
+
marginLeft: 44,
|
|
272
|
+
position: 'relative',
|
|
273
|
+
width: '100%'
|
|
274
|
+
},
|
|
275
|
+
chatBubbleHardShadow: {
|
|
276
|
+
position: 'absolute'
|
|
277
|
+
},
|
|
278
|
+
chatHeader: {
|
|
279
|
+
alignItems: 'center',
|
|
280
|
+
flexDirection: 'row',
|
|
281
|
+
gap: 8
|
|
282
|
+
},
|
|
283
|
+
chatRoot: {
|
|
284
|
+
gap: 8,
|
|
285
|
+
padding: 4,
|
|
286
|
+
width: 253
|
|
287
|
+
},
|
|
288
|
+
divider: {
|
|
289
|
+
backgroundColor: theme.colors.semanticBorder,
|
|
290
|
+
height: 1,
|
|
291
|
+
marginVertical: 8,
|
|
292
|
+
width: '100%'
|
|
293
|
+
},
|
|
294
|
+
hardShadow: {
|
|
295
|
+
position: 'absolute'
|
|
296
|
+
},
|
|
297
|
+
listContent: {
|
|
298
|
+
gap: 0,
|
|
299
|
+
width: '100%'
|
|
300
|
+
},
|
|
301
|
+
listRoot: {
|
|
302
|
+
padding: 16,
|
|
303
|
+
width: 350
|
|
304
|
+
},
|
|
305
|
+
listRow: {
|
|
306
|
+
alignItems: 'center',
|
|
307
|
+
flexDirection: 'row',
|
|
308
|
+
gap: 8,
|
|
309
|
+
width: '100%'
|
|
310
|
+
},
|
|
311
|
+
listText: {
|
|
312
|
+
flex: 1,
|
|
313
|
+
gap: 8
|
|
314
|
+
},
|
|
315
|
+
root: {
|
|
316
|
+
alignItems: 'flex-start'
|
|
317
|
+
},
|
|
318
|
+
textBlockContent: {
|
|
319
|
+
gap: 12,
|
|
320
|
+
width: '100%'
|
|
321
|
+
},
|
|
322
|
+
textBlockRoot: {
|
|
323
|
+
padding: 16,
|
|
324
|
+
width: 350
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
//# sourceMappingURL=skeleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","Animated","Easing","Platform","StyleSheet","View","useTheme","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","TEXT_BLOCK_WIDTHS","LIST_ROWS","detailWidth","titleWidth","opacity","Skeleton","accessibilityLabel","animated","animationDuration","radius","rounded","shadow","shadowColor","shadowOffset","style","type","props","theme","styles","createStyles","Value","current","resolvedRadius","border","resolvedShadowColor","color","resolvedShadowOffset","xsOffset","stopAnimation","setValue","undefined","animation","loop","sequence","timing","duration","Math","max","easing","inOut","ease","toValue","useNativeDriver","start","stop","blockProps","animatedOpacity","getAccessibilityLabel","accessibilityRole","accessibilityState","busy","root","children","ChatSkeleton","ListSkeleton","TextBlockSkeleton","SkeletonBlock","bordered","height","testID","width","usesAndroidHardShadow","OS","usesIOSNativeShadow","blockContainer","pointerEvents","hardShadow","backgroundColor","borderRadius","bottom","left","right","top","block","borderedBlock","shadowOpacity","shadowRadius","chatHeader","SkeletonChatBubble","chatBubbleFrame","chatBubbleHardShadow","chatBubble","listContent","map","row","index","listRow","listText","length","divider","textBlockContent","labels","chat","list","textBlock","create","colors","disabled","alignSelf","position","borderColor","borderWidth","background","gap","padding","marginLeft","alignItems","flexDirection","chatRoot","semanticBorder","marginVertical","listRoot","flex","textBlockRoot"],"sourceRoot":"../../../../src","sources":["components/skeleton/skeleton.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SACEC,QAAQ,EACRC,MAAM,EACNC,QAAQ,EACRC,UAAU,EACVC,IAAI,QAIC,cAAc;AAGrB,SAASC,QAAQ,QAAQ,+BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAiBtD,MAAMC,iBAA+C,GAAG,CAAC,MAAM,EAAE,GAAG,E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vC,KAAK,EAAE;IACT,CAAC;IACDoB,oBAAoB,EAAE;MACpBmB,QAAQ,EAAE;IACZ,CAAC;IACDtB,UAAU,EAAE;MACV6B,UAAU,EAAE,QAAQ;MACpBC,aAAa,EAAE,KAAK;MACpBJ,GAAG,EAAE;IACP,CAAC;IACDK,QAAQ,EAAE;MACRL,GAAG,EAAE,CAAC;MACNC,OAAO,EAAE,CAAC;MACV5C,KAAK,EAAE;IACT,CAAC;IACD6B,OAAO,EAAE;MACPtB,eAAe,EAAElD,KAAK,CAAC+E,MAAM,CAACa,cAAc;MAC5CnD,MAAM,EAAE,CAAC;MACToD,cAAc,EAAE,CAAC;MACjBlD,KAAK,EAAE;IACT,CAAC;IACDM,UAAU,EAAE;MACViC,QAAQ,EAAE;IACZ,CAAC;IACDjB,WAAW,EAAE;MACXqB,GAAG,EAAE,CAAC;MACN3C,KAAK,EAAE;IACT,CAAC;IACDmD,QAAQ,EAAE;MACRP,OAAO,EAAE,EAAE;MACX5C,KAAK,EAAE;IACT,CAAC;IACD0B,OAAO,EAAE;MACPoB,UAAU,EAAE,QAAQ;MACpBC,aAAa,EAAE,KAAK;MACpBJ,GAAG,EAAE,CAAC;MACN3C,KAAK,EAAE;IACT,CAAC;IACD2B,QAAQ,EAAE;MACRyB,IAAI,EAAE,CAAC;MACPT,GAAG,EAAE;IACP,CAAC;IACDpD,IAAI,EAAE;MACJuD,UAAU,EAAE;IACd,CAAC;IACDhB,gBAAgB,EAAE;MAChBa,GAAG,EAAE,EAAE;MACP3C,KAAK,EAAE;IACT,CAAC;IACDqD,aAAa,EAAE;MACbT,OAAO,EAAE,EAAE;MACX5C,KAAK,EAAE;IACT;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Platform, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
4
|
+
import { useTheme } from "../../theme/theme-provider.js";
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
export function Switch({
|
|
7
|
+
accessibilityLabel,
|
|
8
|
+
description,
|
|
9
|
+
disabled,
|
|
10
|
+
label,
|
|
11
|
+
labelPosition = 'right',
|
|
12
|
+
onValueChange,
|
|
13
|
+
style,
|
|
14
|
+
value = false,
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
17
|
+
const theme = useTheme();
|
|
18
|
+
const styles = createStyles(theme);
|
|
19
|
+
const isDisabled = disabled ?? false;
|
|
20
|
+
const usesAndroidHardShadow = Platform.OS === 'android' && value;
|
|
21
|
+
const usesAndroidKnobHardShadow = Platform.OS === 'android' && !isDisabled;
|
|
22
|
+
const labelContent = label ? /*#__PURE__*/_jsxs(View, {
|
|
23
|
+
style: [styles.labelContainer, isDisabled && styles.disabledLabel],
|
|
24
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
25
|
+
style: styles.label,
|
|
26
|
+
children: label
|
|
27
|
+
}), description ? /*#__PURE__*/_jsx(Text, {
|
|
28
|
+
style: styles.description,
|
|
29
|
+
children: description
|
|
30
|
+
}) : null]
|
|
31
|
+
}) : null;
|
|
32
|
+
return /*#__PURE__*/_jsxs(Pressable, {
|
|
33
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
34
|
+
accessibilityRole: "switch",
|
|
35
|
+
accessibilityState: {
|
|
36
|
+
checked: value,
|
|
37
|
+
disabled: isDisabled
|
|
38
|
+
},
|
|
39
|
+
disabled: isDisabled,
|
|
40
|
+
onPress: () => onValueChange?.(!value),
|
|
41
|
+
style: [styles.root, style],
|
|
42
|
+
...props,
|
|
43
|
+
children: [labelPosition === 'left' ? labelContent : null, /*#__PURE__*/_jsxs(View, {
|
|
44
|
+
style: usesAndroidHardShadow && styles.androidShadowContainer,
|
|
45
|
+
children: [usesAndroidHardShadow ? /*#__PURE__*/_jsx(View, {
|
|
46
|
+
pointerEvents: "none",
|
|
47
|
+
style: styles.androidHardShadow,
|
|
48
|
+
testID: "switch-hard-shadow"
|
|
49
|
+
}) : null, /*#__PURE__*/_jsx(View, {
|
|
50
|
+
style: [styles.track, value && styles.activeTrack, isDisabled && styles.disabledTrack, value && !usesAndroidHardShadow && styles.iosTrackShadow],
|
|
51
|
+
children: usesAndroidKnobHardShadow ? /*#__PURE__*/_jsxs(View, {
|
|
52
|
+
style: [styles.androidKnobShadowContainer, value ? styles.knobEnd : styles.knobStart],
|
|
53
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
54
|
+
pointerEvents: "none",
|
|
55
|
+
style: styles.androidKnobHardShadow,
|
|
56
|
+
testID: "switch-knob-hard-shadow"
|
|
57
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
58
|
+
style: [styles.knob, isDisabled && styles.disabledKnob]
|
|
59
|
+
})]
|
|
60
|
+
}) : /*#__PURE__*/_jsx(View, {
|
|
61
|
+
style: [styles.knob, value ? styles.knobEnd : styles.knobStart, isDisabled && styles.disabledKnob]
|
|
62
|
+
})
|
|
63
|
+
})]
|
|
64
|
+
}), labelPosition === 'right' ? labelContent : null]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function createStyles(theme) {
|
|
68
|
+
return StyleSheet.create({
|
|
69
|
+
root: {
|
|
70
|
+
alignItems: 'flex-start',
|
|
71
|
+
flexDirection: 'row',
|
|
72
|
+
gap: 6
|
|
73
|
+
},
|
|
74
|
+
labelContainer: {
|
|
75
|
+
flex: 1,
|
|
76
|
+
gap: 2,
|
|
77
|
+
paddingTop: 1
|
|
78
|
+
},
|
|
79
|
+
label: {
|
|
80
|
+
color: theme.colors.foreground,
|
|
81
|
+
fontSize: theme.typography.md,
|
|
82
|
+
fontWeight: theme.typography.weight,
|
|
83
|
+
lineHeight: 24
|
|
84
|
+
},
|
|
85
|
+
description: {
|
|
86
|
+
color: theme.colors.mutedForeground,
|
|
87
|
+
fontSize: theme.typography.sm,
|
|
88
|
+
lineHeight: 20
|
|
89
|
+
},
|
|
90
|
+
disabledLabel: {
|
|
91
|
+
opacity: 0.6
|
|
92
|
+
},
|
|
93
|
+
track: {
|
|
94
|
+
backgroundColor: theme.colors.surface,
|
|
95
|
+
borderColor: theme.border.color,
|
|
96
|
+
borderWidth: theme.border.width,
|
|
97
|
+
height: 28,
|
|
98
|
+
padding: 2,
|
|
99
|
+
width: 50
|
|
100
|
+
},
|
|
101
|
+
activeTrack: {
|
|
102
|
+
backgroundColor: theme.colors.success
|
|
103
|
+
},
|
|
104
|
+
disabledTrack: {
|
|
105
|
+
backgroundColor: theme.colors.disabled,
|
|
106
|
+
borderColor: theme.colors.mutedForeground,
|
|
107
|
+
opacity: 0.6
|
|
108
|
+
},
|
|
109
|
+
knob: {
|
|
110
|
+
backgroundColor: theme.colors.background,
|
|
111
|
+
borderColor: theme.border.color,
|
|
112
|
+
borderWidth: theme.border.width,
|
|
113
|
+
height: 17,
|
|
114
|
+
shadowColor: theme.shadow.color,
|
|
115
|
+
shadowOffset: {
|
|
116
|
+
width: theme.shadow.xsOffset,
|
|
117
|
+
height: theme.shadow.xsOffset
|
|
118
|
+
},
|
|
119
|
+
shadowOpacity: 1,
|
|
120
|
+
shadowRadius: 0,
|
|
121
|
+
width: 17
|
|
122
|
+
},
|
|
123
|
+
knobStart: {
|
|
124
|
+
alignSelf: 'flex-start'
|
|
125
|
+
},
|
|
126
|
+
knobEnd: {
|
|
127
|
+
alignSelf: 'flex-end'
|
|
128
|
+
},
|
|
129
|
+
disabledKnob: {
|
|
130
|
+
backgroundColor: theme.colors.disabled
|
|
131
|
+
},
|
|
132
|
+
androidShadowContainer: {
|
|
133
|
+
paddingBottom: theme.shadow.xsOffset,
|
|
134
|
+
paddingRight: theme.shadow.xsOffset,
|
|
135
|
+
position: 'relative'
|
|
136
|
+
},
|
|
137
|
+
androidHardShadow: {
|
|
138
|
+
backgroundColor: theme.shadow.color,
|
|
139
|
+
bottom: 0,
|
|
140
|
+
left: theme.shadow.xsOffset,
|
|
141
|
+
position: 'absolute',
|
|
142
|
+
right: 0,
|
|
143
|
+
top: theme.shadow.xsOffset
|
|
144
|
+
},
|
|
145
|
+
androidKnobShadowContainer: {
|
|
146
|
+
alignItems: 'flex-start',
|
|
147
|
+
height: 17 + theme.shadow.xsOffset,
|
|
148
|
+
position: 'relative',
|
|
149
|
+
width: 17 + theme.shadow.xsOffset
|
|
150
|
+
},
|
|
151
|
+
androidKnobHardShadow: {
|
|
152
|
+
backgroundColor: theme.shadow.color,
|
|
153
|
+
bottom: 0,
|
|
154
|
+
left: theme.shadow.xsOffset,
|
|
155
|
+
position: 'absolute',
|
|
156
|
+
right: 0,
|
|
157
|
+
top: theme.shadow.xsOffset
|
|
158
|
+
},
|
|
159
|
+
iosTrackShadow: {
|
|
160
|
+
shadowColor: theme.shadow.color,
|
|
161
|
+
shadowOffset: {
|
|
162
|
+
width: theme.shadow.xsOffset,
|
|
163
|
+
height: theme.shadow.xsOffset
|
|
164
|
+
},
|
|
165
|
+
shadowOpacity: 1,
|
|
166
|
+
shadowRadius: 0
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=switch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","Pressable","StyleSheet","Text","View","useTheme","jsx","_jsx","jsxs","_jsxs","Switch","accessibilityLabel","description","disabled","label","labelPosition","onValueChange","style","value","props","theme","styles","createStyles","isDisabled","usesAndroidHardShadow","OS","usesAndroidKnobHardShadow","labelContent","labelContainer","disabledLabel","children","accessibilityRole","accessibilityState","checked","onPress","root","androidShadowContainer","pointerEvents","androidHardShadow","testID","track","activeTrack","disabledTrack","iosTrackShadow","androidKnobShadowContainer","knobEnd","knobStart","androidKnobHardShadow","knob","disabledKnob","create","alignItems","flexDirection","gap","flex","paddingTop","color","colors","foreground","fontSize","typography","md","fontWeight","weight","lineHeight","mutedForeground","sm","opacity","backgroundColor","surface","borderColor","border","borderWidth","width","height","padding","success","background","shadowColor","shadow","shadowOffset","xsOffset","shadowOpacity","shadowRadius","alignSelf","paddingBottom","paddingRight","position","bottom","left","right","top"],"sourceRoot":"../../../../src","sources":["components/switch/switch.tsx"],"mappings":";;AAAA,SACEA,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,IAAI,EACJC,IAAI,QAIC,cAAc;AAGrB,SAASC,QAAQ,QAAQ,+BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAatD,OAAO,SAASC,MAAMA,CAAC;EACrBC,kBAAkB;EAClBC,WAAW;EACXC,QAAQ;EACRC,KAAK;EACLC,aAAa,GAAG,OAAO;EACvBC,aAAa;EACbC,KAAK;EACLC,KAAK,GAAG,KAAK;EACb,GAAGC;AACQ,CAAC,EAAE;EACd,MAAMC,KAAK,GAAGf,QAAQ,CAAC,CAAC;EACxB,MAAMgB,MAAM,GAAGC,YAAY,CAACF,KAAK,CAAC;EAClC,MAAMG,UAAU,GAAGV,QAAQ,IAAI,KAAK;EACpC,MAAMW,qBAAqB,GAAGxB,QAAQ,CAACyB,EAAE,KAAK,SAAS,IAAIP,KAAK;EAChE,MAAMQ,yBAAyB,GAAG1B,QAAQ,CAACyB,EAAE,KAAK,SAAS,IAAI,CAACF,UAAU;EAC1E,MAAMI,YAAY,GAAGb,KAAK,gBACxBL,KAAA,CAACL,IAAI;IAACa,KAAK,EAAE,CAACI,MAAM,CAACO,cAAc,EAAEL,UAAU,IAAIF,MAAM,CAACQ,aAAa,CAAE;IAAAC,QAAA,gBACvEvB,IAAA,CAACJ,IAAI;MAACc,KAAK,EAAEI,MAAM,CAACP,KAAM;MAAAgB,QAAA,EAAEhB;IAAK,CAAO,CAAC,EACxCF,WAAW,gBAAGL,IAAA,CAACJ,IAAI;MAACc,KAAK,EAAEI,MAAM,CAACT,WAAY;MAAAkB,QAAA,EAAElB;IAAW,CAAO,CAAC,GAAG,IAAI;EAAA,CACvE,CAAC,GACL,IAAI;EAER,oBACEH,KAAA,CAACR,SAAS;IACRU,kBAAkB,EAAEA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