@xaui/native 0.0.26 → 0.0.28
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/LICENSE +21 -0
- package/README.md +105 -228
- package/dist/alert/index.cjs +92 -166
- package/dist/alert/index.js +2 -1
- package/dist/app-bar/index.cjs +24 -98
- package/dist/app-bar/index.js +2 -1
- package/dist/autocomplete/index.cjs +192 -281
- package/dist/autocomplete/index.js +36 -48
- package/dist/avatar/index.cjs +59 -133
- package/dist/avatar/index.js +2 -1
- package/dist/badge/index.cjs +26 -99
- package/dist/badge/index.js +2 -1
- package/dist/bottom-sheet/index.cjs +5 -456
- package/dist/bottom-sheet/index.js +4 -363
- package/dist/bottom-tab-bar/index.cjs +93 -167
- package/dist/bottom-tab-bar/index.js +2 -2
- package/dist/button/index.cjs +73 -525
- package/dist/button/index.js +3 -2
- package/dist/card/index.cjs +76 -169
- package/dist/card/index.js +2 -2
- package/dist/carousel/index.cjs +68 -145
- package/dist/carousel/index.js +1 -1
- package/dist/chart/index.cjs +132 -173
- package/dist/checkbox/index.cjs +70 -143
- package/dist/checkbox/index.js +2 -1
- package/dist/chip/index.cjs +89 -164
- package/dist/chip/index.js +2 -1
- package/dist/chunk-BD72HIPR.cjs +75 -0
- package/dist/chunk-DHSTKO3K.cjs +19 -0
- package/dist/{chunk-CZFDZPAS.js → chunk-DXXNBF5P.js} +5 -0
- package/dist/{chunk-UI5L26KD.js → chunk-F7WH4DMG.js} +1 -1
- package/dist/chunk-GBHQCAKW.js +19 -0
- package/dist/chunk-HC2SSHNU.js +368 -0
- package/dist/chunk-HSPTLUFA.cjs +7 -0
- package/dist/chunk-JEGEPGVU.js +287 -0
- package/dist/chunk-KTLGDLCB.cjs +287 -0
- package/dist/{chunk-GHCVNQET.js → chunk-LTKYHG5V.js} +5 -12
- package/dist/{chunk-ULJSCNPE.js → chunk-LUBWRVI2.js} +1 -1
- package/dist/chunk-OQ2BLOOG.cjs +138 -0
- package/dist/chunk-QMYWIWSX.cjs +384 -0
- package/dist/chunk-XFPPR2VB.cjs +368 -0
- package/dist/core/index.cjs +22 -168
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +5 -3
- package/dist/datepicker/index.cjs +239 -320
- package/dist/datepicker/index.js +2 -1
- package/dist/divider/index.cjs +5 -145
- package/dist/divider/index.js +3 -2
- package/dist/drawer/index.cjs +39 -112
- package/dist/drawer/index.js +2 -1
- package/dist/expansion-panel/index.cjs +91 -230
- package/dist/expansion-panel/index.js +3 -2
- package/dist/fab/index.cjs +6 -722
- package/dist/fab/index.js +4 -3
- package/dist/fab-menu/index.cjs +81 -814
- package/dist/fab-menu/index.js +4 -3
- package/dist/feature-discovery/index.cjs +72 -139
- package/dist/feature-discovery/index.js +2 -2
- package/dist/index.cjs +1 -18
- package/dist/indicator/index.cjs +5 -445
- package/dist/indicator/index.js +3 -2
- package/dist/input/index.cjs +214 -282
- package/dist/input/index.js +2 -2
- package/dist/list/index.cjs +71 -146
- package/dist/list/index.js +2 -1
- package/dist/menu/index.cjs +59 -127
- package/dist/menu/index.js +2 -2
- package/dist/menubox/index.cjs +60 -132
- package/dist/menubox/index.js +2 -1
- package/dist/pager/index.cjs +42 -80
- package/dist/progress/index.cjs +43 -114
- package/dist/progress/index.js +2 -1
- package/dist/radio/index.cjs +82 -154
- package/dist/radio/index.js +2 -1
- package/dist/segment-button/index.cjs +60 -147
- package/dist/segment-button/index.js +2 -2
- package/dist/select/index.cjs +149 -224
- package/dist/select/index.js +10 -22
- package/dist/skeleton/index.cjs +23 -94
- package/dist/skeleton/index.js +2 -2
- package/dist/slider/index.cjs +77 -156
- package/dist/slider/index.js +2 -1
- package/dist/snackbar/index.cjs +420 -0
- package/dist/snackbar/index.d.cts +175 -0
- package/dist/snackbar/index.d.ts +175 -0
- package/dist/snackbar/index.js +420 -0
- package/dist/stepper/index.cjs +121 -195
- package/dist/stepper/index.js +2 -1
- package/dist/switch/index.cjs +48 -121
- package/dist/switch/index.js +2 -1
- package/dist/tabs/index.cjs +67 -151
- package/dist/tabs/index.js +2 -1
- package/dist/timepicker/index.cjs +135 -593
- package/dist/timepicker/index.js +24 -383
- package/dist/toolbar/index.cjs +59 -128
- package/dist/toolbar/index.js +2 -1
- package/dist/typography/index.cjs +37 -92
- package/dist/typography/index.d.cts +1 -1
- package/dist/typography/index.d.ts +1 -1
- package/dist/typography/index.js +20 -1
- package/dist/view/index.cjs +178 -223
- package/package.json +7 -1
- package/dist/chunk-3XSXTM3G.js +0 -661
- package/dist/chunk-4KSZLONZ.js +0 -79
- package/dist/chunk-I4V5Y5GD.js +0 -76
- package/dist/chunk-URBEEDFX.js +0 -79
package/dist/menubox/index.js
CHANGED
package/dist/pager/index.cjs
CHANGED
|
@@ -1,47 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/components/pager/index.ts
|
|
31
|
-
var pager_exports = {};
|
|
32
|
-
__export(pager_exports, {
|
|
33
|
-
Pager: () => Pager,
|
|
34
|
-
PagerItem: () => PagerItem
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(pager_exports);
|
|
37
|
-
|
|
38
|
-
// src/components/pager/pager.tsx
|
|
39
|
-
var import_react = __toESM(require("react"), 1);
|
|
40
|
-
var import_react_native2 = require("react-native");
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/components/pager/pager.tsx
|
|
2
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
3
|
+
var _reactnative = require('react-native');
|
|
41
4
|
|
|
42
5
|
// src/components/pager/pager.style.ts
|
|
43
|
-
|
|
44
|
-
var styles =
|
|
6
|
+
|
|
7
|
+
var styles = _reactnative.StyleSheet.create({
|
|
45
8
|
container: {
|
|
46
9
|
width: "100%"
|
|
47
10
|
},
|
|
@@ -94,8 +57,8 @@ function clampPage(page, max) {
|
|
|
94
57
|
return Math.max(0, Math.min(page, max));
|
|
95
58
|
}
|
|
96
59
|
function toPages(children) {
|
|
97
|
-
return
|
|
98
|
-
if (!
|
|
60
|
+
return _react2.default.Children.toArray(children).flatMap((child, index) => {
|
|
61
|
+
if (!_react2.default.isValidElement(child) || child.type !== PagerItem) {
|
|
99
62
|
return [];
|
|
100
63
|
}
|
|
101
64
|
return [
|
|
@@ -119,45 +82,45 @@ var Pager = ({
|
|
|
119
82
|
customAppearance
|
|
120
83
|
}) => {
|
|
121
84
|
const isPagerFullscreen = isFullscreen || isfullscreen === true;
|
|
122
|
-
const pages = (0,
|
|
85
|
+
const pages = _react.useMemo.call(void 0, () => toPages(children), [children]);
|
|
123
86
|
const maxPage = Math.max(0, pages.length - 1);
|
|
124
87
|
const isControlled = controlledPage !== void 0;
|
|
125
|
-
const [internalPage, setInternalPage] = (0,
|
|
126
|
-
const [containerWidth, setContainerWidth] = (0,
|
|
127
|
-
const scrollViewRef = (0,
|
|
128
|
-
const initialScrollAppliedRef = (0,
|
|
88
|
+
const [internalPage, setInternalPage] = _react.useState.call(void 0, clampPage(defaultPage, maxPage));
|
|
89
|
+
const [containerWidth, setContainerWidth] = _react.useState.call(void 0, 0);
|
|
90
|
+
const scrollViewRef = _react.useRef.call(void 0, null);
|
|
91
|
+
const initialScrollAppliedRef = _react.useRef.call(void 0, false);
|
|
129
92
|
const activePage = clampPage(
|
|
130
|
-
isControlled ? controlledPage
|
|
93
|
+
isControlled ? _nullishCoalesce(controlledPage, () => ( 0)) : internalPage,
|
|
131
94
|
maxPage
|
|
132
95
|
);
|
|
133
|
-
(0,
|
|
96
|
+
_react.useEffect.call(void 0, () => {
|
|
134
97
|
if (isControlled || pages.length === 0) return;
|
|
135
98
|
setInternalPage((prev) => clampPage(prev, maxPage));
|
|
136
99
|
}, [isControlled, maxPage, pages.length]);
|
|
137
|
-
(0,
|
|
100
|
+
_react.useEffect.call(void 0, () => {
|
|
138
101
|
if (containerWidth <= 0) return;
|
|
139
102
|
if (pages.length <= 1) return;
|
|
140
103
|
const x = activePage * containerWidth;
|
|
141
104
|
if (!initialScrollAppliedRef.current) {
|
|
142
105
|
initialScrollAppliedRef.current = true;
|
|
143
|
-
scrollViewRef.current
|
|
106
|
+
_optionalChain([scrollViewRef, 'access', _2 => _2.current, 'optionalAccess', _3 => _3.scrollTo, 'call', _4 => _4({ x, animated: false })]);
|
|
144
107
|
return;
|
|
145
108
|
}
|
|
146
|
-
scrollViewRef.current
|
|
109
|
+
_optionalChain([scrollViewRef, 'access', _5 => _5.current, 'optionalAccess', _6 => _6.scrollTo, 'call', _7 => _7({ x, animated: true })]);
|
|
147
110
|
}, [activePage, containerWidth, pages.length]);
|
|
148
|
-
const handleLayout = (0,
|
|
111
|
+
const handleLayout = _react.useCallback.call(void 0, (event) => {
|
|
149
112
|
setContainerWidth(event.nativeEvent.layout.width);
|
|
150
113
|
}, []);
|
|
151
|
-
const commitPageChange = (0,
|
|
114
|
+
const commitPageChange = _react.useCallback.call(void 0,
|
|
152
115
|
(nextPage) => {
|
|
153
116
|
if (!isControlled) {
|
|
154
117
|
setInternalPage(nextPage);
|
|
155
118
|
}
|
|
156
|
-
onPageChange
|
|
119
|
+
_optionalChain([onPageChange, 'optionalCall', _8 => _8(nextPage)]);
|
|
157
120
|
},
|
|
158
121
|
[isControlled, onPageChange]
|
|
159
122
|
);
|
|
160
|
-
const handleMomentumScrollEnd = (0,
|
|
123
|
+
const handleMomentumScrollEnd = _react.useCallback.call(void 0,
|
|
161
124
|
(event) => {
|
|
162
125
|
if (containerWidth <= 0 || pages.length === 0) return;
|
|
163
126
|
const rawPage = Math.round(event.nativeEvent.contentOffset.x / containerWidth);
|
|
@@ -168,18 +131,18 @@ var Pager = ({
|
|
|
168
131
|
},
|
|
169
132
|
[activePage, commitPageChange, containerWidth, maxPage, pages.length]
|
|
170
133
|
);
|
|
171
|
-
return /* @__PURE__ */
|
|
172
|
-
|
|
134
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
135
|
+
_reactnative.View,
|
|
173
136
|
{
|
|
174
137
|
onLayout: handleLayout,
|
|
175
138
|
style: [
|
|
176
139
|
styles.container,
|
|
177
140
|
isPagerFullscreen && styles.fullscreenContainer,
|
|
178
|
-
customAppearance
|
|
141
|
+
_optionalChain([customAppearance, 'optionalAccess', _9 => _9.container])
|
|
179
142
|
]
|
|
180
143
|
},
|
|
181
|
-
/* @__PURE__ */
|
|
182
|
-
|
|
144
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
145
|
+
_reactnative.ScrollView,
|
|
183
146
|
{
|
|
184
147
|
ref: scrollViewRef,
|
|
185
148
|
horizontal: true,
|
|
@@ -189,46 +152,46 @@ var Pager = ({
|
|
|
189
152
|
onMomentumScrollEnd: handleMomentumScrollEnd,
|
|
190
153
|
style: [
|
|
191
154
|
isPagerFullscreen && styles.fullscreenScrollView,
|
|
192
|
-
customAppearance
|
|
155
|
+
_optionalChain([customAppearance, 'optionalAccess', _10 => _10.scrollView])
|
|
193
156
|
]
|
|
194
157
|
},
|
|
195
|
-
pages.map((pagerPage) => /* @__PURE__ */
|
|
196
|
-
|
|
158
|
+
pages.map((pagerPage) => /* @__PURE__ */ _react2.default.createElement(
|
|
159
|
+
_reactnative.View,
|
|
197
160
|
{
|
|
198
161
|
key: pagerPage.key,
|
|
199
162
|
style: [
|
|
200
163
|
styles.page,
|
|
201
164
|
isPagerFullscreen && styles.fullscreenPage,
|
|
202
|
-
customAppearance
|
|
165
|
+
_optionalChain([customAppearance, 'optionalAccess', _11 => _11.page]),
|
|
203
166
|
containerWidth > 0 && { width: containerWidth }
|
|
204
167
|
]
|
|
205
168
|
},
|
|
206
169
|
pagerPage.content
|
|
207
170
|
))
|
|
208
171
|
),
|
|
209
|
-
showIndicator && pages.length > 1 && /* @__PURE__ */
|
|
210
|
-
|
|
172
|
+
showIndicator && pages.length > 1 && /* @__PURE__ */ _react2.default.createElement(
|
|
173
|
+
_reactnative.View,
|
|
211
174
|
{
|
|
212
175
|
style: [
|
|
213
176
|
styles.indicatorContainer,
|
|
214
|
-
customAppearance
|
|
177
|
+
_optionalChain([customAppearance, 'optionalAccess', _12 => _12.indicatorContainer]),
|
|
215
178
|
isPagerFullscreen && styles.fullscreenIndicatorContainer
|
|
216
179
|
]
|
|
217
180
|
},
|
|
218
181
|
pages.map((_, index) => {
|
|
219
182
|
const isActive = index === activePage;
|
|
220
183
|
if (renderIndicator) {
|
|
221
|
-
return /* @__PURE__ */
|
|
184
|
+
return /* @__PURE__ */ _react2.default.createElement(_react2.default.Fragment, { key: `indicator-${String(index)}` }, renderIndicator({ index, isActive, total: pages.length }));
|
|
222
185
|
}
|
|
223
|
-
return /* @__PURE__ */
|
|
224
|
-
|
|
186
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
187
|
+
_reactnative.View,
|
|
225
188
|
{
|
|
226
189
|
key: `indicator-${String(index)}`,
|
|
227
190
|
style: [
|
|
228
191
|
styles.indicator,
|
|
229
|
-
customAppearance
|
|
192
|
+
_optionalChain([customAppearance, 'optionalAccess', _13 => _13.indicator]),
|
|
230
193
|
isActive && styles.activeIndicator,
|
|
231
|
-
isActive && customAppearance
|
|
194
|
+
isActive && _optionalChain([customAppearance, 'optionalAccess', _14 => _14.activeIndicator])
|
|
232
195
|
]
|
|
233
196
|
}
|
|
234
197
|
);
|
|
@@ -236,8 +199,7 @@ var Pager = ({
|
|
|
236
199
|
)
|
|
237
200
|
);
|
|
238
201
|
};
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
});
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
exports.Pager = Pager; exports.PagerItem = PagerItem;
|
package/dist/progress/index.cjs
CHANGED
|
@@ -1,113 +1,43 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }require('../chunk-HSPTLUFA.cjs');
|
|
29
2
|
|
|
30
|
-
// src/components/progress/index.ts
|
|
31
|
-
var progress_exports = {};
|
|
32
|
-
__export(progress_exports, {
|
|
33
|
-
Progress: () => Progress
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(progress_exports);
|
|
36
|
-
|
|
37
|
-
// src/components/progress/progress.tsx
|
|
38
|
-
var import_react9 = __toESM(require("react"), 1);
|
|
39
|
-
var import_react_native7 = require("react-native");
|
|
40
3
|
|
|
41
|
-
|
|
42
|
-
var import_react4 = __toESM(require("react"), 1);
|
|
43
|
-
var import_react_native2 = require("react-native");
|
|
44
|
-
var import_theme = require("@xaui/core/theme");
|
|
45
|
-
var import_palette = require("@xaui/core/palette");
|
|
4
|
+
var _chunkOQ2BLOOGcjs = require('../chunk-OQ2BLOOG.cjs');
|
|
46
5
|
|
|
47
|
-
// src/
|
|
48
|
-
var
|
|
6
|
+
// src/components/progress/progress.tsx
|
|
7
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
8
|
+
var _reactnative = require('react-native');
|
|
49
9
|
|
|
50
|
-
// src/
|
|
51
|
-
var import_react = require("react");
|
|
52
|
-
var PortalContext = (0, import_react.createContext)(null);
|
|
10
|
+
// src/components/progress/circular-progress-indicator.tsx
|
|
53
11
|
|
|
54
|
-
// src/core/portal/portal-host.tsx
|
|
55
|
-
var import_react3 = __toESM(require("react"), 1);
|
|
56
|
-
var import_react_native = require("react-native");
|
|
57
|
-
var hostStyles = import_react_native.StyleSheet.create({
|
|
58
|
-
container: {
|
|
59
|
-
flex: 1
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
12
|
|
|
63
|
-
|
|
64
|
-
var
|
|
13
|
+
var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
|
|
14
|
+
var _reactnativesvg = require('react-native-svg'); var _reactnativesvg2 = _interopRequireDefault(_reactnativesvg);
|
|
65
15
|
|
|
66
|
-
// src/
|
|
67
|
-
var import_react5 = require("react");
|
|
68
|
-
var import_react_native3 = require("react-native");
|
|
69
|
-
function useXUITheme() {
|
|
70
|
-
const theme = (0, import_react5.useContext)(XUIThemeContext);
|
|
71
|
-
if (!theme) {
|
|
72
|
-
throw new Error("useXUITheme must be used within XUIProvider");
|
|
73
|
-
}
|
|
74
|
-
return theme;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// src/core/index.ts
|
|
78
|
-
var import_theme2 = require("@xaui/core/theme");
|
|
16
|
+
// src/components/progress/progress.hook.ts
|
|
79
17
|
|
|
80
|
-
// src/components/progress/circular-progress-indicator.tsx
|
|
81
|
-
var import_react7 = __toESM(require("react"), 1);
|
|
82
|
-
var import_react_native5 = require("react-native");
|
|
83
|
-
var import_react_native_reanimated2 = __toESM(require("react-native-reanimated"), 1);
|
|
84
|
-
var import_react_native_svg = __toESM(require("react-native-svg"), 1);
|
|
85
18
|
|
|
86
|
-
// src/components/progress/progress.hook.ts
|
|
87
|
-
var import_react6 = require("react");
|
|
88
|
-
var import_react_native_reanimated = require("react-native-reanimated");
|
|
89
19
|
var MIN_VALUE = 0;
|
|
90
20
|
var MAX_VALUE = 1;
|
|
91
21
|
var clampProgress = (value) => Math.max(MIN_VALUE, Math.min(MAX_VALUE, value));
|
|
92
22
|
var useProgressAnimation = (value, disableAnimation) => {
|
|
93
|
-
const progressAnim = (0,
|
|
94
|
-
(0,
|
|
23
|
+
const progressAnim = _reactnativereanimated.useSharedValue.call(void 0, clampProgress(value));
|
|
24
|
+
_react.useEffect.call(void 0, () => {
|
|
95
25
|
const clampedValue = clampProgress(value);
|
|
96
26
|
if (disableAnimation) {
|
|
97
27
|
progressAnim.value = clampedValue;
|
|
98
28
|
return;
|
|
99
29
|
}
|
|
100
|
-
progressAnim.value = (0,
|
|
30
|
+
progressAnim.value = _reactnativereanimated.withTiming.call(void 0, clampedValue, {
|
|
101
31
|
duration: 500,
|
|
102
|
-
easing:
|
|
32
|
+
easing: _reactnativereanimated.Easing.bezier(0, 0, 0.2, 1)
|
|
103
33
|
});
|
|
104
34
|
}, [value, disableAnimation, progressAnim]);
|
|
105
35
|
return progressAnim;
|
|
106
36
|
};
|
|
107
37
|
|
|
108
38
|
// src/components/progress/progress.style.ts
|
|
109
|
-
|
|
110
|
-
var styles =
|
|
39
|
+
|
|
40
|
+
var styles = _reactnative.StyleSheet.create({
|
|
111
41
|
container: {
|
|
112
42
|
flexShrink: 1,
|
|
113
43
|
flexBasis: "auto",
|
|
@@ -127,7 +57,7 @@ var styles = import_react_native4.StyleSheet.create({
|
|
|
127
57
|
});
|
|
128
58
|
|
|
129
59
|
// src/components/progress/circular-progress-indicator.tsx
|
|
130
|
-
var AnimatedCircle =
|
|
60
|
+
var AnimatedCircle = _reactnativereanimated2.default.createAnimatedComponent(_reactnativesvg.Circle);
|
|
131
61
|
var CircularProgressIndicator = ({
|
|
132
62
|
size = 40,
|
|
133
63
|
color,
|
|
@@ -142,11 +72,11 @@ var CircularProgressIndicator = ({
|
|
|
142
72
|
const circumference = 2 * Math.PI * radius;
|
|
143
73
|
const center = size / 2;
|
|
144
74
|
const strokeCap = borderRadius && borderRadius > 0 ? "round" : "butt";
|
|
145
|
-
const animatedProps = (0,
|
|
75
|
+
const animatedProps = _reactnativereanimated.useAnimatedProps.call(void 0, () => ({
|
|
146
76
|
strokeDashoffset: circumference * (1 - progressAnim.value)
|
|
147
77
|
}));
|
|
148
|
-
return /* @__PURE__ */
|
|
149
|
-
|
|
78
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.circleContainer, { width: size, height: size }] }, /* @__PURE__ */ _react2.default.createElement(_reactnativesvg2.default, { width: size, height: size, style: { transform: [{ rotate: "-90deg" }] } }, /* @__PURE__ */ _react2.default.createElement(
|
|
79
|
+
_reactnativesvg.Circle,
|
|
150
80
|
{
|
|
151
81
|
cx: center,
|
|
152
82
|
cy: center,
|
|
@@ -155,7 +85,7 @@ var CircularProgressIndicator = ({
|
|
|
155
85
|
strokeWidth,
|
|
156
86
|
fill: "none"
|
|
157
87
|
}
|
|
158
|
-
), /* @__PURE__ */
|
|
88
|
+
), /* @__PURE__ */ _react2.default.createElement(
|
|
159
89
|
AnimatedCircle,
|
|
160
90
|
{
|
|
161
91
|
cx: center,
|
|
@@ -172,9 +102,9 @@ var CircularProgressIndicator = ({
|
|
|
172
102
|
};
|
|
173
103
|
|
|
174
104
|
// src/components/progress/linear-progress-indicator.tsx
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
178
108
|
var LinearProgressIndicator = ({
|
|
179
109
|
size = 4,
|
|
180
110
|
color,
|
|
@@ -184,12 +114,12 @@ var LinearProgressIndicator = ({
|
|
|
184
114
|
disableAnimation
|
|
185
115
|
}) => {
|
|
186
116
|
const progressAnim = useProgressAnimation(value, disableAnimation);
|
|
187
|
-
const radius = Math.max(0, Math.min(size / 2, borderRadius
|
|
188
|
-
const animatedStyle = (0,
|
|
117
|
+
const radius = Math.max(0, Math.min(size / 2, _nullishCoalesce(borderRadius, () => ( 0))));
|
|
118
|
+
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, () => ({
|
|
189
119
|
width: `${progressAnim.value * 100}%`
|
|
190
120
|
}));
|
|
191
|
-
return /* @__PURE__ */
|
|
192
|
-
|
|
121
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
122
|
+
_reactnative.View,
|
|
193
123
|
{
|
|
194
124
|
style: [
|
|
195
125
|
styles.track,
|
|
@@ -200,8 +130,8 @@ var LinearProgressIndicator = ({
|
|
|
200
130
|
}
|
|
201
131
|
]
|
|
202
132
|
},
|
|
203
|
-
/* @__PURE__ */
|
|
204
|
-
|
|
133
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
134
|
+
_reactnativereanimated2.default.View,
|
|
205
135
|
{
|
|
206
136
|
style: [
|
|
207
137
|
styles.progress,
|
|
@@ -227,10 +157,10 @@ var Progress = (props) => {
|
|
|
227
157
|
size,
|
|
228
158
|
disableAnimation = false
|
|
229
159
|
} = props;
|
|
230
|
-
const theme = useXUITheme();
|
|
160
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
231
161
|
const colorScheme = theme.colors[themeColor];
|
|
232
|
-
const mainColor = color
|
|
233
|
-
const trackColor = backgroundColor
|
|
162
|
+
const mainColor = _nullishCoalesce(color, () => ( colorScheme.main));
|
|
163
|
+
const trackColor = _nullishCoalesce(backgroundColor, () => ( colorScheme.background));
|
|
234
164
|
const clampedValue = clampProgress(value);
|
|
235
165
|
const accessibilityValue = {
|
|
236
166
|
min: 0,
|
|
@@ -238,17 +168,17 @@ var Progress = (props) => {
|
|
|
238
168
|
now: clampedValue * 100
|
|
239
169
|
};
|
|
240
170
|
if (variant === "circular") {
|
|
241
|
-
const circleSize = size
|
|
171
|
+
const circleSize = _nullishCoalesce(size, () => ( 40));
|
|
242
172
|
const borderRadius2 = "borderRadius" in props ? props.borderRadius : void 0;
|
|
243
|
-
return /* @__PURE__ */
|
|
244
|
-
|
|
173
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
174
|
+
_reactnative.View,
|
|
245
175
|
{
|
|
246
176
|
style: [styles.circleContainer, { width: circleSize, height: circleSize }],
|
|
247
177
|
accessible: true,
|
|
248
178
|
accessibilityRole: "progressbar",
|
|
249
179
|
accessibilityValue
|
|
250
180
|
},
|
|
251
|
-
/* @__PURE__ */
|
|
181
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
252
182
|
CircularProgressIndicator,
|
|
253
183
|
{
|
|
254
184
|
size: circleSize,
|
|
@@ -261,17 +191,17 @@ var Progress = (props) => {
|
|
|
261
191
|
)
|
|
262
192
|
);
|
|
263
193
|
}
|
|
264
|
-
const linearSize = size
|
|
194
|
+
const linearSize = _nullishCoalesce(size, () => ( 4));
|
|
265
195
|
const borderRadius = "borderRadius" in props ? props.borderRadius : void 0;
|
|
266
|
-
return /* @__PURE__ */
|
|
267
|
-
|
|
196
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
197
|
+
_reactnative.View,
|
|
268
198
|
{
|
|
269
199
|
style: styles.container,
|
|
270
200
|
accessible: true,
|
|
271
201
|
accessibilityRole: "progressbar",
|
|
272
202
|
accessibilityValue
|
|
273
203
|
},
|
|
274
|
-
/* @__PURE__ */
|
|
204
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
275
205
|
LinearProgressIndicator,
|
|
276
206
|
{
|
|
277
207
|
size: linearSize,
|
|
@@ -284,7 +214,6 @@ var Progress = (props) => {
|
|
|
284
214
|
)
|
|
285
215
|
);
|
|
286
216
|
};
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
});
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
exports.Progress = Progress;
|