@webority-technologies/mobile 0.0.6 → 0.0.8
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 +3 -463
- package/lib/commonjs/components/Badge/Badge.js +23 -13
- package/lib/commonjs/components/BottomSheet/BottomSheet.js +39 -5
- package/lib/commonjs/components/Button/Button.js +25 -6
- package/lib/commonjs/components/Card/Card.js +13 -1
- package/lib/commonjs/components/Checkbox/Checkbox.js +5 -3
- package/lib/commonjs/components/Chip/Chip.js +12 -3
- package/lib/commonjs/components/Dialog/Dialog.js +15 -8
- package/lib/commonjs/components/EmptyState/EmptyState.js +32 -26
- package/lib/commonjs/components/FormField/FormField.js +3 -3
- package/lib/commonjs/components/Input/Input.js +13 -5
- package/lib/commonjs/components/ListItem/ListItem.js +33 -27
- package/lib/commonjs/components/OTPInput/OTPInput.js +6 -3
- package/lib/commonjs/components/Radio/Radio.js +7 -6
- package/lib/commonjs/components/SearchBar/SearchBar.js +9 -5
- package/lib/commonjs/components/Skeleton/Skeleton.js +20 -12
- package/lib/commonjs/components/Skeleton/SkeletonContent.js +25 -9
- package/lib/commonjs/components/Skeleton/SkeletonList.js +7 -2
- package/lib/commonjs/components/Skeleton/SkeletonProvider.js +48 -0
- package/lib/commonjs/components/Skeleton/SkeletonSkip.js +37 -0
- package/lib/commonjs/components/Skeleton/index.js +20 -0
- package/lib/commonjs/components/Switch/Switch.js +31 -2
- package/lib/commonjs/components/Toast/Toast.js +16 -11
- package/lib/commonjs/components/index.js +18 -0
- package/lib/commonjs/theme/Gradient.js +57 -0
- package/lib/commonjs/theme/index.js +20 -0
- package/lib/commonjs/theme/textStyle.js +37 -0
- package/lib/commonjs/theme/tokens.js +260 -2
- package/lib/module/components/Badge/Badge.js +24 -14
- package/lib/module/components/BottomSheet/BottomSheet.js +40 -6
- package/lib/module/components/Button/Button.js +26 -7
- package/lib/module/components/Card/Card.js +14 -2
- package/lib/module/components/Checkbox/Checkbox.js +5 -3
- package/lib/module/components/Chip/Chip.js +13 -4
- package/lib/module/components/Dialog/Dialog.js +16 -9
- package/lib/module/components/EmptyState/EmptyState.js +33 -27
- package/lib/module/components/FormField/FormField.js +4 -4
- package/lib/module/components/Input/Input.js +14 -6
- package/lib/module/components/ListItem/ListItem.js +34 -28
- package/lib/module/components/OTPInput/OTPInput.js +7 -4
- package/lib/module/components/Radio/Radio.js +7 -6
- package/lib/module/components/SearchBar/SearchBar.js +10 -6
- package/lib/module/components/Skeleton/Skeleton.js +20 -12
- package/lib/module/components/Skeleton/SkeletonContent.js +25 -9
- package/lib/module/components/Skeleton/SkeletonList.js +7 -2
- package/lib/module/components/Skeleton/SkeletonProvider.js +41 -0
- package/lib/module/components/Skeleton/SkeletonSkip.js +31 -0
- package/lib/module/components/Skeleton/index.js +2 -0
- package/lib/module/components/Switch/Switch.js +31 -2
- package/lib/module/components/Toast/Toast.js +17 -12
- package/lib/module/components/index.js +1 -1
- package/lib/module/theme/Gradient.js +50 -0
- package/lib/module/theme/index.js +2 -0
- package/lib/module/theme/textStyle.js +32 -0
- package/lib/module/theme/tokens.js +260 -2
- package/lib/typescript/commonjs/components/BottomSheet/BottomSheet.d.ts +10 -0
- package/lib/typescript/commonjs/components/Button/Button.d.ts +8 -0
- package/lib/typescript/commonjs/components/Card/Card.d.ts +8 -0
- package/lib/typescript/commonjs/components/Dialog/Dialog.d.ts +5 -0
- package/lib/typescript/commonjs/components/Input/Input.d.ts +12 -0
- package/lib/typescript/commonjs/components/Skeleton/Skeleton.d.ts +9 -0
- package/lib/typescript/commonjs/components/Skeleton/SkeletonContent.d.ts +6 -0
- package/lib/typescript/commonjs/components/Skeleton/SkeletonList.d.ts +3 -0
- package/lib/typescript/commonjs/components/Skeleton/SkeletonProvider.d.ts +32 -0
- package/lib/typescript/commonjs/components/Skeleton/SkeletonSkip.d.ts +25 -0
- package/lib/typescript/commonjs/components/Skeleton/index.d.ts +4 -0
- package/lib/typescript/commonjs/components/Switch/Switch.d.ts +5 -0
- package/lib/typescript/commonjs/components/Toast/Toast.d.ts +5 -0
- package/lib/typescript/commonjs/components/index.d.ts +2 -2
- package/lib/typescript/commonjs/theme/Gradient.d.ts +11 -0
- package/lib/typescript/commonjs/theme/index.d.ts +5 -1
- package/lib/typescript/commonjs/theme/textStyle.d.ts +18 -0
- package/lib/typescript/commonjs/theme/types.d.ts +178 -0
- package/lib/typescript/module/components/BottomSheet/BottomSheet.d.ts +10 -0
- package/lib/typescript/module/components/Button/Button.d.ts +8 -0
- package/lib/typescript/module/components/Card/Card.d.ts +8 -0
- package/lib/typescript/module/components/Dialog/Dialog.d.ts +5 -0
- package/lib/typescript/module/components/Input/Input.d.ts +12 -0
- package/lib/typescript/module/components/Skeleton/Skeleton.d.ts +9 -0
- package/lib/typescript/module/components/Skeleton/SkeletonContent.d.ts +6 -0
- package/lib/typescript/module/components/Skeleton/SkeletonList.d.ts +3 -0
- package/lib/typescript/module/components/Skeleton/SkeletonProvider.d.ts +32 -0
- package/lib/typescript/module/components/Skeleton/SkeletonSkip.d.ts +25 -0
- package/lib/typescript/module/components/Skeleton/index.d.ts +4 -0
- package/lib/typescript/module/components/Switch/Switch.d.ts +5 -0
- package/lib/typescript/module/components/Toast/Toast.d.ts +5 -0
- package/lib/typescript/module/components/index.d.ts +2 -2
- package/lib/typescript/module/theme/Gradient.d.ts +11 -0
- package/lib/typescript/module/theme/index.d.ts +5 -1
- package/lib/typescript/module/theme/textStyle.d.ts +18 -0
- package/lib/typescript/module/theme/types.d.ts +178 -0
- package/package.json +5 -1
|
@@ -7,6 +7,7 @@ exports.default = exports.SkeletonContent = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _Skeleton = require("./Skeleton.js");
|
|
10
|
+
var _SkeletonSkip = require("./SkeletonSkip.js");
|
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
12
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
13
|
const flattenStyle = style => {
|
|
@@ -27,7 +28,7 @@ const resolveRadius = (raw, fallback) => {
|
|
|
27
28
|
if (typeof raw === 'number') return raw;
|
|
28
29
|
return fallback;
|
|
29
30
|
};
|
|
30
|
-
const skeletonizeNode = (node, variant, speed, keyHint = 'r') => {
|
|
31
|
+
const skeletonizeNode = (node, variant, speed, colors, keyHint = 'r') => {
|
|
31
32
|
if (node == null || typeof node === 'boolean') return null;
|
|
32
33
|
if (typeof node === 'string' || typeof node === 'number') {
|
|
33
34
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Skeleton.Skeleton, {
|
|
@@ -35,11 +36,12 @@ const skeletonizeNode = (node, variant, speed, keyHint = 'r') => {
|
|
|
35
36
|
height: 14,
|
|
36
37
|
radius: "sm",
|
|
37
38
|
variant: variant,
|
|
38
|
-
speed: speed
|
|
39
|
+
speed: speed,
|
|
40
|
+
colors: colors
|
|
39
41
|
}, `${keyHint}-text`);
|
|
40
42
|
}
|
|
41
43
|
if (Array.isArray(node)) {
|
|
42
|
-
return _react.Children.map(node, (child, index) => skeletonizeNode(child, variant, speed, `${keyHint}-${index}`));
|
|
44
|
+
return _react.Children.map(node, (child, index) => skeletonizeNode(child, variant, speed, colors, `${keyHint}-${index}`));
|
|
43
45
|
}
|
|
44
46
|
if (! /*#__PURE__*/(0, _react.isValidElement)(node)) return null;
|
|
45
47
|
const element = node;
|
|
@@ -47,6 +49,13 @@ const skeletonizeNode = (node, variant, speed, keyHint = 'r') => {
|
|
|
47
49
|
const elementStyle = flattenStyle(props.style);
|
|
48
50
|
const elementType = element.type;
|
|
49
51
|
|
|
52
|
+
// <SkeletonSkip /> → opt-out marker; render its children unchanged
|
|
53
|
+
if (elementType === _SkeletonSkip.SkeletonSkip) {
|
|
54
|
+
return /*#__PURE__*/(0, _react.cloneElement)(element, {
|
|
55
|
+
key: `${keyHint}-skip`
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
50
59
|
// <Image /> → fixed-size skeleton block matching style.width/height/borderRadius
|
|
51
60
|
if (elementType === _reactNative.Image) {
|
|
52
61
|
const width = resolveWidth(elementStyle.width, '100%');
|
|
@@ -58,6 +67,7 @@ const skeletonizeNode = (node, variant, speed, keyHint = 'r') => {
|
|
|
58
67
|
radius: radius,
|
|
59
68
|
variant: variant,
|
|
60
69
|
speed: speed,
|
|
70
|
+
colors: colors,
|
|
61
71
|
style: {
|
|
62
72
|
margin: typeof elementStyle.margin === 'number' ? elementStyle.margin : undefined
|
|
63
73
|
}
|
|
@@ -74,6 +84,7 @@ const skeletonizeNode = (node, variant, speed, keyHint = 'r') => {
|
|
|
74
84
|
radius: "sm",
|
|
75
85
|
variant: variant,
|
|
76
86
|
speed: speed,
|
|
87
|
+
colors: colors,
|
|
77
88
|
style: {
|
|
78
89
|
marginVertical: 2
|
|
79
90
|
}
|
|
@@ -84,7 +95,7 @@ const skeletonizeNode = (node, variant, speed, keyHint = 'r') => {
|
|
|
84
95
|
if (props.children != null) {
|
|
85
96
|
return /*#__PURE__*/(0, _react.cloneElement)(element, {
|
|
86
97
|
key: `${keyHint}-w`
|
|
87
|
-
}, skeletonizeNode(props.children, variant, speed, `${keyHint}-c`));
|
|
98
|
+
}, skeletonizeNode(props.children, variant, speed, colors, `${keyHint}-c`));
|
|
88
99
|
}
|
|
89
100
|
|
|
90
101
|
// Leaf <View /> with explicit dimensions → skeleton block
|
|
@@ -97,7 +108,8 @@ const skeletonizeNode = (node, variant, speed, keyHint = 'r') => {
|
|
|
97
108
|
height: height,
|
|
98
109
|
radius: radius,
|
|
99
110
|
variant: variant,
|
|
100
|
-
speed: speed
|
|
111
|
+
speed: speed,
|
|
112
|
+
colors: colors
|
|
101
113
|
}, `${keyHint}-vw`);
|
|
102
114
|
}
|
|
103
115
|
|
|
@@ -110,10 +122,11 @@ const skeletonizeNode = (node, variant, speed, keyHint = 'r') => {
|
|
|
110
122
|
const SkeletonContent = ({
|
|
111
123
|
loading,
|
|
112
124
|
children,
|
|
113
|
-
variant
|
|
114
|
-
speed
|
|
125
|
+
variant,
|
|
126
|
+
speed,
|
|
115
127
|
mode = 'auto',
|
|
116
128
|
count = 1,
|
|
129
|
+
colors,
|
|
117
130
|
style,
|
|
118
131
|
testID
|
|
119
132
|
}) => {
|
|
@@ -133,6 +146,7 @@ const SkeletonContent = ({
|
|
|
133
146
|
testID: testID,
|
|
134
147
|
variant: variant,
|
|
135
148
|
speed: speed,
|
|
149
|
+
colors: colors,
|
|
136
150
|
children: repeated
|
|
137
151
|
});
|
|
138
152
|
}
|
|
@@ -143,7 +157,7 @@ const SkeletonContent = ({
|
|
|
143
157
|
accessibilityLabel: "Loading",
|
|
144
158
|
accessibilityRole: "progressbar",
|
|
145
159
|
accessibilityLiveRegion: "polite",
|
|
146
|
-
children: skeletonizeNode(repeated, variant, speed)
|
|
160
|
+
children: skeletonizeNode(repeated, variant, speed, colors)
|
|
147
161
|
});
|
|
148
162
|
};
|
|
149
163
|
exports.SkeletonContent = SkeletonContent;
|
|
@@ -152,6 +166,7 @@ const BlockSkeleton = ({
|
|
|
152
166
|
children,
|
|
153
167
|
variant,
|
|
154
168
|
speed,
|
|
169
|
+
colors,
|
|
155
170
|
style,
|
|
156
171
|
testID
|
|
157
172
|
}) => {
|
|
@@ -188,7 +203,8 @@ const BlockSkeleton = ({
|
|
|
188
203
|
height: size.height,
|
|
189
204
|
radius: "md",
|
|
190
205
|
variant: variant,
|
|
191
|
-
speed: speed
|
|
206
|
+
speed: speed,
|
|
207
|
+
colors: colors
|
|
192
208
|
})
|
|
193
209
|
}) : null]
|
|
194
210
|
});
|
|
@@ -7,6 +7,7 @@ exports.SkeletonList = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _SkeletonContent = require("./SkeletonContent.js");
|
|
10
|
+
var _SkeletonProvider = require("./SkeletonProvider.js");
|
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
13
|
/**
|
|
@@ -32,9 +33,10 @@ function SkeletonListInner(props) {
|
|
|
32
33
|
data,
|
|
33
34
|
renderItem,
|
|
34
35
|
renderPlaceholder,
|
|
35
|
-
placeholderCount
|
|
36
|
+
placeholderCount,
|
|
36
37
|
variant,
|
|
37
38
|
speed,
|
|
39
|
+
colors,
|
|
38
40
|
placeholderContainerStyle,
|
|
39
41
|
horizontal,
|
|
40
42
|
contentContainerStyle,
|
|
@@ -42,9 +44,11 @@ function SkeletonListInner(props) {
|
|
|
42
44
|
testID,
|
|
43
45
|
...rest
|
|
44
46
|
} = props;
|
|
47
|
+
const defaults = (0, _SkeletonProvider.useSkeletonDefaults)();
|
|
48
|
+
const resolvedCount = placeholderCount ?? defaults.placeholderCount ?? 3;
|
|
45
49
|
if (loading) {
|
|
46
50
|
const slots = Array.from({
|
|
47
|
-
length: Math.max(0,
|
|
51
|
+
length: Math.max(0, resolvedCount)
|
|
48
52
|
}, (_, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.default.Fragment, {
|
|
49
53
|
children: renderPlaceholder ? renderPlaceholder(index) : null
|
|
50
54
|
}, `sk-list-${index}`));
|
|
@@ -52,6 +56,7 @@ function SkeletonListInner(props) {
|
|
|
52
56
|
loading: true,
|
|
53
57
|
variant: variant,
|
|
54
58
|
speed: speed,
|
|
59
|
+
colors: colors,
|
|
55
60
|
style: style,
|
|
56
61
|
testID: testID,
|
|
57
62
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useSkeletonDefaults = exports.SkeletonProvider = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
10
|
+
/**
|
|
11
|
+
* Per-instance color override for a skeleton. `background` is the resting tone
|
|
12
|
+
* of the placeholder; `highlight` is the moving shimmer band (or pulse fade).
|
|
13
|
+
* Either can be omitted — missing keys fall back to the active theme.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const SkeletonDefaultsContext = /*#__PURE__*/(0, _react.createContext)({});
|
|
17
|
+
const SkeletonProvider = ({
|
|
18
|
+
children,
|
|
19
|
+
variant,
|
|
20
|
+
speed,
|
|
21
|
+
placeholderCount,
|
|
22
|
+
radius,
|
|
23
|
+
colors
|
|
24
|
+
}) => {
|
|
25
|
+
const value = (0, _react.useMemo)(() => ({
|
|
26
|
+
variant,
|
|
27
|
+
speed,
|
|
28
|
+
placeholderCount,
|
|
29
|
+
radius,
|
|
30
|
+
colors
|
|
31
|
+
}), [variant, speed, placeholderCount, radius, colors]);
|
|
32
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(SkeletonDefaultsContext.Provider, {
|
|
33
|
+
value: value,
|
|
34
|
+
children: children
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
exports.SkeletonProvider = SkeletonProvider;
|
|
38
|
+
SkeletonProvider.displayName = 'SkeletonProvider';
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Read the current SkeletonProvider defaults. Returns an empty object when no
|
|
42
|
+
* provider is mounted, so the skeleton primitives still work outside of one.
|
|
43
|
+
*/
|
|
44
|
+
const useSkeletonDefaults = () => {
|
|
45
|
+
return (0, _react.useContext)(SkeletonDefaultsContext);
|
|
46
|
+
};
|
|
47
|
+
exports.useSkeletonDefaults = useSkeletonDefaults;
|
|
48
|
+
//# sourceMappingURL=SkeletonProvider.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SkeletonSkip = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
/**
|
|
11
|
+
* Pass-through marker that opts a subtree out of `SkeletonContent`'s auto walker.
|
|
12
|
+
*
|
|
13
|
+
* The walker recognizes this element type and returns its children unchanged
|
|
14
|
+
* even while `loading` is true. Use it to keep a specific Text/Image/View
|
|
15
|
+
* visible inside a skeleton block — e.g., a brand mark, a status icon, or a
|
|
16
|
+
* decorative element that should never shimmer.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <SkeletonContent loading>
|
|
20
|
+
* <View style={styles.card}>
|
|
21
|
+
* <SkeletonSkip>
|
|
22
|
+
* <Image source={Logo} style={styles.brandMark} />
|
|
23
|
+
* </SkeletonSkip>
|
|
24
|
+
* <Text>Loading…</Text>
|
|
25
|
+
* </View>
|
|
26
|
+
* </SkeletonContent>
|
|
27
|
+
*/
|
|
28
|
+
const SkeletonSkip = ({
|
|
29
|
+
children
|
|
30
|
+
}) => {
|
|
31
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
32
|
+
children: children
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
exports.SkeletonSkip = SkeletonSkip;
|
|
36
|
+
SkeletonSkip.displayName = 'SkeletonSkip';
|
|
37
|
+
//# sourceMappingURL=SkeletonSkip.js.map
|
|
@@ -45,6 +45,18 @@ Object.defineProperty(exports, "SkeletonListItem", {
|
|
|
45
45
|
return _Skeleton.SkeletonListItem;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
+
Object.defineProperty(exports, "SkeletonProvider", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _SkeletonProvider.SkeletonProvider;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "SkeletonSkip", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _SkeletonSkip.SkeletonSkip;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
48
60
|
Object.defineProperty(exports, "SkeletonText", {
|
|
49
61
|
enumerable: true,
|
|
50
62
|
get: function () {
|
|
@@ -57,8 +69,16 @@ Object.defineProperty(exports, "default", {
|
|
|
57
69
|
return _Skeleton.default;
|
|
58
70
|
}
|
|
59
71
|
});
|
|
72
|
+
Object.defineProperty(exports, "useSkeletonDefaults", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _SkeletonProvider.useSkeletonDefaults;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
60
78
|
var _Skeleton = _interopRequireWildcard(require("./Skeleton.js"));
|
|
61
79
|
var _SkeletonContent = require("./SkeletonContent.js");
|
|
62
80
|
var _SkeletonList = require("./SkeletonList.js");
|
|
81
|
+
var _SkeletonProvider = require("./SkeletonProvider.js");
|
|
82
|
+
var _SkeletonSkip = require("./SkeletonSkip.js");
|
|
63
83
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
64
84
|
//# sourceMappingURL=index.js.map
|
|
@@ -53,6 +53,7 @@ const Switch = exports.Switch = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
53
53
|
label,
|
|
54
54
|
accessibilityLabel,
|
|
55
55
|
haptic = 'selection',
|
|
56
|
+
bounce = false,
|
|
56
57
|
style,
|
|
57
58
|
trackStyle,
|
|
58
59
|
thumbStyle,
|
|
@@ -60,7 +61,11 @@ const Switch = exports.Switch = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
60
61
|
...rest
|
|
61
62
|
} = props;
|
|
62
63
|
const theme = (0, _index.useTheme)();
|
|
63
|
-
const sizeStyles =
|
|
64
|
+
const sizeStyles = {
|
|
65
|
+
...sizeMap[size],
|
|
66
|
+
...(theme.components.switch?.[size] ?? {})
|
|
67
|
+
};
|
|
68
|
+
const switchThumbColor = theme.components.switch?.thumbColor ?? '#FFFFFF';
|
|
64
69
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
65
70
|
const offTrackColor = theme.mode === 'dark' ? theme.colors.secondary : theme.colors.surface.disabled;
|
|
66
71
|
const onTrackColor = toneColor(theme, tone);
|
|
@@ -93,6 +98,28 @@ const Switch = exports.Switch = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
93
98
|
inputRange: [0, 1],
|
|
94
99
|
outputRange: [offTrackColor, onTrackColor]
|
|
95
100
|
});
|
|
101
|
+
const bounceScale = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
|
|
102
|
+
const isFirstRender = (0, _react.useRef)(true);
|
|
103
|
+
(0, _react.useEffect)(() => {
|
|
104
|
+
if (!bounce) return;
|
|
105
|
+
if (isFirstRender.current) {
|
|
106
|
+
isFirstRender.current = false;
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
_reactNative.Animated.sequence([_reactNative.Animated.spring(bounceScale, {
|
|
110
|
+
toValue: 1.15,
|
|
111
|
+
damping: 10,
|
|
112
|
+
stiffness: 220,
|
|
113
|
+
mass: 1,
|
|
114
|
+
useNativeDriver: true
|
|
115
|
+
}), _reactNative.Animated.spring(bounceScale, {
|
|
116
|
+
toValue: 1,
|
|
117
|
+
damping: 14,
|
|
118
|
+
stiffness: 240,
|
|
119
|
+
mass: 1,
|
|
120
|
+
useNativeDriver: true
|
|
121
|
+
})]).start();
|
|
122
|
+
}, [value, bounce, bounceScale]);
|
|
96
123
|
const handlePress = event => {
|
|
97
124
|
if (disabled) return;
|
|
98
125
|
if (haptic !== false) (0, _hapticUtils.triggerHaptic)(haptic);
|
|
@@ -127,11 +154,14 @@ const Switch = exports.Switch = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
127
154
|
}, trackStyle],
|
|
128
155
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
|
|
129
156
|
style: [styles.thumb, theme.shadows.sm, {
|
|
157
|
+
backgroundColor: switchThumbColor,
|
|
130
158
|
width: sizeStyles.thumbSize,
|
|
131
159
|
height: sizeStyles.thumbSize,
|
|
132
160
|
borderRadius: sizeStyles.thumbSize / 2,
|
|
133
161
|
transform: [{
|
|
134
162
|
translateX
|
|
163
|
+
}, {
|
|
164
|
+
scale: bounceScale
|
|
135
165
|
}]
|
|
136
166
|
}, thumbStyle]
|
|
137
167
|
})
|
|
@@ -160,7 +190,6 @@ const buildStyles = _theme => _reactNative.StyleSheet.create({
|
|
|
160
190
|
justifyContent: 'center'
|
|
161
191
|
},
|
|
162
192
|
thumb: {
|
|
163
|
-
backgroundColor: '#FFFFFF',
|
|
164
193
|
position: 'absolute',
|
|
165
194
|
top: 2
|
|
166
195
|
},
|
|
@@ -23,6 +23,11 @@ const Toast = ({
|
|
|
23
23
|
const position = toast.position ?? 'bottom';
|
|
24
24
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
25
25
|
const tint = (0, _react.useMemo)(() => tintFor(theme, variant), [theme, variant]);
|
|
26
|
+
const toastTokens = theme.components.toast;
|
|
27
|
+
const iconCircleSize = toastTokens?.iconCircleSize ?? 28;
|
|
28
|
+
const iconCircleBorderRadius = toastTokens?.iconCircleBorderRadius ?? 14;
|
|
29
|
+
const iconGlyphFontSize = toastTokens?.iconGlyphFontSize ?? 16;
|
|
30
|
+
const tintBarWidth = toastTokens?.tintBarWidth ?? 4;
|
|
26
31
|
const enterFrom = position === 'top' ? -120 : 120;
|
|
27
32
|
const translateY = (0, _react.useRef)(new _reactNative.Animated.Value(enterFrom)).current;
|
|
28
33
|
const translateX = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
|
|
@@ -112,11 +117,15 @@ const Toast = ({
|
|
|
112
117
|
if (!glyph) return null;
|
|
113
118
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
114
119
|
style: [styles.iconCircle, {
|
|
120
|
+
width: iconCircleSize,
|
|
121
|
+
height: iconCircleSize,
|
|
122
|
+
borderRadius: iconCircleBorderRadius,
|
|
115
123
|
backgroundColor: tint + '22'
|
|
116
124
|
}],
|
|
117
125
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
118
126
|
style: [styles.iconGlyph, {
|
|
119
|
-
color: tint
|
|
127
|
+
color: tint,
|
|
128
|
+
fontSize: iconGlyphFontSize
|
|
120
129
|
}],
|
|
121
130
|
accessible: false,
|
|
122
131
|
children: glyph
|
|
@@ -143,9 +152,10 @@ const Toast = ({
|
|
|
143
152
|
}, {
|
|
144
153
|
scale: stackScale
|
|
145
154
|
}]
|
|
146
|
-
}],
|
|
155
|
+
}, toast.style],
|
|
147
156
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
148
157
|
style: [styles.tintBar, {
|
|
158
|
+
width: tintBarWidth,
|
|
149
159
|
backgroundColor: tint
|
|
150
160
|
}]
|
|
151
161
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
@@ -156,8 +166,8 @@ const Toast = ({
|
|
|
156
166
|
style: [styles.message, {
|
|
157
167
|
color: theme.colors.text.primary,
|
|
158
168
|
fontSize: theme.typography.fontSize.base,
|
|
159
|
-
|
|
160
|
-
}],
|
|
169
|
+
...(0, _index.fontFor)(theme, 'semibold')
|
|
170
|
+
}, toast.textStyle],
|
|
161
171
|
numberOfLines: 2,
|
|
162
172
|
children: toast.message
|
|
163
173
|
}), toast.description ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
@@ -181,7 +191,7 @@ const Toast = ({
|
|
|
181
191
|
style: {
|
|
182
192
|
color: tint,
|
|
183
193
|
fontSize: theme.typography.fontSize.sm,
|
|
184
|
-
|
|
194
|
+
...(0, _index.fontFor)(theme, 'semibold')
|
|
185
195
|
},
|
|
186
196
|
numberOfLines: 1,
|
|
187
197
|
children: toast.action.label
|
|
@@ -230,8 +240,7 @@ const buildStyles = _theme => _reactNative.StyleSheet.create({
|
|
|
230
240
|
position: 'absolute',
|
|
231
241
|
left: 0,
|
|
232
242
|
top: 0,
|
|
233
|
-
bottom: 0
|
|
234
|
-
width: 4
|
|
243
|
+
bottom: 0
|
|
235
244
|
},
|
|
236
245
|
row: {
|
|
237
246
|
flexDirection: 'row',
|
|
@@ -239,15 +248,11 @@ const buildStyles = _theme => _reactNative.StyleSheet.create({
|
|
|
239
248
|
paddingLeft: 8
|
|
240
249
|
},
|
|
241
250
|
iconCircle: {
|
|
242
|
-
width: 28,
|
|
243
|
-
height: 28,
|
|
244
|
-
borderRadius: 14,
|
|
245
251
|
alignItems: 'center',
|
|
246
252
|
justifyContent: 'center',
|
|
247
253
|
marginRight: 12
|
|
248
254
|
},
|
|
249
255
|
iconGlyph: {
|
|
250
|
-
fontSize: 16,
|
|
251
256
|
fontWeight: '700',
|
|
252
257
|
lineHeight: 18
|
|
253
258
|
},
|
|
@@ -273,6 +273,18 @@ Object.defineProperty(exports, "SkeletonListItem", {
|
|
|
273
273
|
return _index35.SkeletonListItem;
|
|
274
274
|
}
|
|
275
275
|
});
|
|
276
|
+
Object.defineProperty(exports, "SkeletonProvider", {
|
|
277
|
+
enumerable: true,
|
|
278
|
+
get: function () {
|
|
279
|
+
return _index35.SkeletonProvider;
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
Object.defineProperty(exports, "SkeletonSkip", {
|
|
283
|
+
enumerable: true,
|
|
284
|
+
get: function () {
|
|
285
|
+
return _index35.SkeletonSkip;
|
|
286
|
+
}
|
|
287
|
+
});
|
|
276
288
|
Object.defineProperty(exports, "SkeletonText", {
|
|
277
289
|
enumerable: true,
|
|
278
290
|
get: function () {
|
|
@@ -345,6 +357,12 @@ Object.defineProperty(exports, "toast", {
|
|
|
345
357
|
return _index41.toast;
|
|
346
358
|
}
|
|
347
359
|
});
|
|
360
|
+
Object.defineProperty(exports, "useSkeletonDefaults", {
|
|
361
|
+
enumerable: true,
|
|
362
|
+
get: function () {
|
|
363
|
+
return _index35.useSkeletonDefaults;
|
|
364
|
+
}
|
|
365
|
+
});
|
|
348
366
|
Object.defineProperty(exports, "useToast", {
|
|
349
367
|
enumerable: true,
|
|
350
368
|
get: function () {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isGradientAvailable = exports.Gradient = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
/**
|
|
12
|
+
* Render a linear gradient using `react-native-linear-gradient` when available.
|
|
13
|
+
*
|
|
14
|
+
* The dep is OPTIONAL — apps that never use gradients don't need it installed.
|
|
15
|
+
* If `<Gradient>` (or any component that accepts a `gradient` prop) is reached
|
|
16
|
+
* without the package present, we fall back to a flat View using the first
|
|
17
|
+
* colour and emit a one-time dev warning so the omission is loud but
|
|
18
|
+
* non-fatal.
|
|
19
|
+
*/
|
|
20
|
+
let LinearGradientImpl = null;
|
|
21
|
+
let warned = false;
|
|
22
|
+
try {
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
24
|
+
LinearGradientImpl = require('react-native-linear-gradient').default;
|
|
25
|
+
} catch {
|
|
26
|
+
// Optional peer; resolved lazily by consumers that need gradients.
|
|
27
|
+
}
|
|
28
|
+
const Gradient = ({
|
|
29
|
+
gradient,
|
|
30
|
+
style,
|
|
31
|
+
children
|
|
32
|
+
}) => {
|
|
33
|
+
if (LinearGradientImpl) {
|
|
34
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(LinearGradientImpl, {
|
|
35
|
+
colors: gradient.colors,
|
|
36
|
+
locations: gradient.locations,
|
|
37
|
+
start: gradient.start,
|
|
38
|
+
end: gradient.end,
|
|
39
|
+
style: style,
|
|
40
|
+
children: children
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (__DEV__ && !warned) {
|
|
44
|
+
warned = true;
|
|
45
|
+
console.warn('[@webority-technologies/mobile] gradient prop set but react-native-linear-gradient is not installed. ' + 'Run `npm install react-native-linear-gradient` to enable.');
|
|
46
|
+
}
|
|
47
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
48
|
+
style: [{
|
|
49
|
+
backgroundColor: gradient.colors[0]
|
|
50
|
+
}, style],
|
|
51
|
+
children: children
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
exports.Gradient = Gradient;
|
|
55
|
+
const isGradientAvailable = () => LinearGradientImpl != null;
|
|
56
|
+
exports.isGradientAvailable = isGradientAvailable;
|
|
57
|
+
//# sourceMappingURL=Gradient.js.map
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "Gradient", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Gradient.Gradient;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "ThemeProvider", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function () {
|
|
@@ -15,7 +21,19 @@ Object.defineProperty(exports, "darkTheme", {
|
|
|
15
21
|
return _tokens.darkTheme;
|
|
16
22
|
}
|
|
17
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "fontFor", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _textStyle.fontFor;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
18
30
|
exports.getTheme = exports.getColorMode = void 0;
|
|
31
|
+
Object.defineProperty(exports, "isGradientAvailable", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return _Gradient.isGradientAvailable;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
19
37
|
Object.defineProperty(exports, "lightTheme", {
|
|
20
38
|
enumerable: true,
|
|
21
39
|
get: function () {
|
|
@@ -44,6 +62,8 @@ Object.defineProperty(exports, "useThemeMode", {
|
|
|
44
62
|
var _tokens = require("./tokens.js");
|
|
45
63
|
var _merge = require("./merge.js");
|
|
46
64
|
var _ThemeContext = require("./ThemeContext.js");
|
|
65
|
+
var _textStyle = require("./textStyle.js");
|
|
66
|
+
var _Gradient = require("./Gradient.js");
|
|
47
67
|
let currentMode = 'light';
|
|
48
68
|
let currentTheme = _tokens.lightTheme;
|
|
49
69
|
let lightOverridesGlobal;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.fontFor = void 0;
|
|
7
|
+
const FAMILY_KEY = {
|
|
8
|
+
normal: 'regular',
|
|
9
|
+
medium: 'medium',
|
|
10
|
+
semibold: 'semibold',
|
|
11
|
+
bold: 'bold'
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Resolve text-weight style for the active theme.
|
|
16
|
+
*
|
|
17
|
+
* When the consumer registers a brand `theme.typography.fontFamily.<weight>`,
|
|
18
|
+
* we set `fontFamily` and leave `fontWeight` undefined — RN can't combine the
|
|
19
|
+
* two reliably across iOS/Android once a custom face is in play, so the brand
|
|
20
|
+
* file controls the weight glyph itself. Falls back to `fontWeight` when no
|
|
21
|
+
* brand font is registered for that weight.
|
|
22
|
+
*
|
|
23
|
+
* Note: the fontWeight scale uses `normal` while FontFamilyScale uses
|
|
24
|
+
* `regular` (the conventional font-name suffix). The helper maps between
|
|
25
|
+
* them transparently.
|
|
26
|
+
*/
|
|
27
|
+
const fontFor = (theme, weight) => {
|
|
28
|
+
const family = theme.typography.fontFamily?.[FAMILY_KEY[weight]];
|
|
29
|
+
if (family) return {
|
|
30
|
+
fontFamily: family
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
fontWeight: theme.typography.fontWeight[weight]
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
exports.fontFor = fontFor;
|
|
37
|
+
//# sourceMappingURL=textStyle.js.map
|