@tamagui/progress 1.110.4 → 1.111.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/dist/cjs/Progress.native.js +29 -121
- package/dist/cjs/Progress.native.js.map +2 -2
- package/dist/esm/Progress.native.js +29 -120
- package/dist/esm/Progress.native.js.map +2 -2
- package/dist/esm/Progress.native.mjs +139 -0
- package/dist/esm/Progress.native.mjs.map +1 -0
- package/dist/esm/index.native.mjs +2 -0
- package/dist/esm/index.native.mjs.map +1 -0
- package/dist/jsx/Progress.native.js +29 -120
- package/dist/jsx/Progress.native.js.map +2 -2
- package/package.json +8 -8
|
@@ -30,100 +30,7 @@ __export(Progress_exports, {
|
|
|
30
30
|
createProgressScope: () => createProgressScope
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(Progress_exports);
|
|
33
|
-
var import_jsx_runtime = require("react/jsx-runtime"), import_core = require("@tamagui/core"), import_create_context = require("@tamagui/create-context"), import_get_token = require("@tamagui/get-token"), import_helpers = require("@tamagui/helpers"), import_stacks = require("@tamagui/stacks"), React = __toESM(require("react"))
|
|
34
|
-
function _array_like_to_array(arr, len) {
|
|
35
|
-
(len == null || len > arr.length) && (len = arr.length);
|
|
36
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
37
|
-
return arr2;
|
|
38
|
-
}
|
|
39
|
-
function _array_with_holes(arr) {
|
|
40
|
-
if (Array.isArray(arr)) return arr;
|
|
41
|
-
}
|
|
42
|
-
function _define_property(obj, key, value) {
|
|
43
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
44
|
-
value,
|
|
45
|
-
enumerable: !0,
|
|
46
|
-
configurable: !0,
|
|
47
|
-
writable: !0
|
|
48
|
-
}) : obj[key] = value, obj;
|
|
49
|
-
}
|
|
50
|
-
function _iterable_to_array_limit(arr, i) {
|
|
51
|
-
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
52
|
-
if (_i != null) {
|
|
53
|
-
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
54
|
-
try {
|
|
55
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
56
|
-
;
|
|
57
|
-
} catch (err) {
|
|
58
|
-
_d = !0, _e = err;
|
|
59
|
-
} finally {
|
|
60
|
-
try {
|
|
61
|
-
!_n && _i.return != null && _i.return();
|
|
62
|
-
} finally {
|
|
63
|
-
if (_d) throw _e;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return _arr;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function _non_iterable_rest() {
|
|
70
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
71
|
-
}
|
|
72
|
-
function _object_spread(target) {
|
|
73
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
74
|
-
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
75
|
-
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
76
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
77
|
-
}))), ownKeys2.forEach(function(key) {
|
|
78
|
-
_define_property(target, key, source[key]);
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
return target;
|
|
82
|
-
}
|
|
83
|
-
function ownKeys(object, enumerableOnly) {
|
|
84
|
-
var keys = Object.keys(object);
|
|
85
|
-
if (Object.getOwnPropertySymbols) {
|
|
86
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
87
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
88
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
89
|
-
})), keys.push.apply(keys, symbols);
|
|
90
|
-
}
|
|
91
|
-
return keys;
|
|
92
|
-
}
|
|
93
|
-
function _object_spread_props(target, source) {
|
|
94
|
-
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
95
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
96
|
-
}), target;
|
|
97
|
-
}
|
|
98
|
-
function _object_without_properties(source, excluded) {
|
|
99
|
-
if (source == null) return {};
|
|
100
|
-
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
101
|
-
if (Object.getOwnPropertySymbols) {
|
|
102
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
103
|
-
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
104
|
-
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
105
|
-
}
|
|
106
|
-
return target;
|
|
107
|
-
}
|
|
108
|
-
function _object_without_properties_loose(source, excluded) {
|
|
109
|
-
if (source == null) return {};
|
|
110
|
-
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
111
|
-
for (i = 0; i < sourceKeys.length; i++)
|
|
112
|
-
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
113
|
-
return target;
|
|
114
|
-
}
|
|
115
|
-
function _sliced_to_array(arr, i) {
|
|
116
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
117
|
-
}
|
|
118
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
119
|
-
if (o) {
|
|
120
|
-
if (typeof o == "string") return _array_like_to_array(o, minLen);
|
|
121
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
122
|
-
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n);
|
|
123
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
var PROGRESS_NAME = "Progress", _createContextScope = _sliced_to_array((0, import_create_context.createContextScope)(PROGRESS_NAME), 2), createProgressContext = _createContextScope[0], createProgressScope = _createContextScope[1], _createProgressContext = _sliced_to_array(createProgressContext(PROGRESS_NAME), 2), ProgressProvider = _createProgressContext[0], useProgressContext = _createProgressContext[1], INDICATOR_NAME = "ProgressIndicator", ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime"), import_core = require("@tamagui/core"), import_create_context = require("@tamagui/create-context"), import_get_token = require("@tamagui/get-token"), import_helpers = require("@tamagui/helpers"), import_stacks = require("@tamagui/stacks"), React = __toESM(require("react")), PROGRESS_NAME = "Progress", [createProgressContext, createProgressScope] = (0, import_create_context.createContextScope)(PROGRESS_NAME), [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME), INDICATOR_NAME = "ProgressIndicator", ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
127
34
|
name: INDICATOR_NAME,
|
|
128
35
|
variants: {
|
|
129
36
|
unstyled: {
|
|
@@ -138,29 +45,27 @@ var PROGRESS_NAME = "Progress", _createContextScope = _sliced_to_array((0, impor
|
|
|
138
45
|
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
139
46
|
}
|
|
140
47
|
}), ProgressIndicator = ProgressIndicatorFrame.styleable(function(props, forwardedRef) {
|
|
141
|
-
var __scopeProgress = props
|
|
142
|
-
|
|
143
|
-
"animation"
|
|
144
|
-
]), context = useProgressContext(INDICATOR_NAME, __scopeProgress), _context_value, pct = context.max - ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0), x = -(context.width === 0 ? 300 : context.width) * (pct / 100), _context_value1;
|
|
145
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressIndicatorFrame, _object_spread_props(_object_spread({
|
|
48
|
+
var { __scopeProgress, animation, ...indicatorProps } = props, context = useProgressContext(INDICATOR_NAME, __scopeProgress), _context_value, pct = context.max - ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0), x = -(context.width === 0 ? 300 : context.width) * (pct / 100), _context_value1;
|
|
49
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressIndicatorFrame, {
|
|
146
50
|
"data-state": getProgressState(context.value, context.max),
|
|
147
51
|
"data-value": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,
|
|
148
52
|
"data-max": context.max,
|
|
149
53
|
x,
|
|
150
|
-
width: context.width
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
54
|
+
width: context.width,
|
|
55
|
+
...!props.unstyled && {
|
|
56
|
+
animateOnly: [
|
|
57
|
+
"transform"
|
|
58
|
+
],
|
|
59
|
+
opacity: context.width === 0 ? 0 : 1
|
|
60
|
+
},
|
|
61
|
+
...indicatorProps,
|
|
157
62
|
ref: forwardedRef,
|
|
158
63
|
// avoid animation on first render so the progress doesn't bounce to initial location
|
|
159
64
|
animation: context.width ? animation : null
|
|
160
|
-
})
|
|
65
|
+
});
|
|
161
66
|
});
|
|
162
67
|
function defaultGetValueLabel(value, max) {
|
|
163
|
-
return
|
|
68
|
+
return `${Math.round(value / max * 100)}%`;
|
|
164
69
|
}
|
|
165
70
|
function getProgressState(value, maxValue) {
|
|
166
71
|
return value == null ? "indeterminate" : value === maxValue ? "complete" : "loading";
|
|
@@ -199,19 +104,21 @@ var DEFAULT_MAX = 100, ProgressFrame = (0, import_core.styled)(import_stacks.The
|
|
|
199
104
|
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
200
105
|
}
|
|
201
106
|
}), Progress = (0, import_helpers.withStaticProperties)(ProgressFrame.styleable(function(props, forwardedRef) {
|
|
202
|
-
var
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
107
|
+
var {
|
|
108
|
+
// @ts-expect-error
|
|
109
|
+
__scopeProgress,
|
|
110
|
+
value: valueProp,
|
|
111
|
+
max: maxProp,
|
|
112
|
+
getValueLabel = defaultGetValueLabel,
|
|
113
|
+
size = "$true",
|
|
114
|
+
...progressProps
|
|
115
|
+
} = props, max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX, value = isValidValueNumber(valueProp, max) ? valueProp : null, valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0, [width, setWidth] = React.useState(0);
|
|
209
116
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressProvider, {
|
|
210
117
|
scope: __scopeProgress,
|
|
211
118
|
value,
|
|
212
119
|
max,
|
|
213
120
|
width,
|
|
214
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressFrame,
|
|
121
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressFrame, {
|
|
215
122
|
"aria-valuemax": max,
|
|
216
123
|
"aria-valuemin": 0,
|
|
217
124
|
"aria-valuenow": isNumber(value) ? value : void 0,
|
|
@@ -220,16 +127,17 @@ var DEFAULT_MAX = 100, ProgressFrame = (0, import_core.styled)(import_stacks.The
|
|
|
220
127
|
role: "progressbar",
|
|
221
128
|
"data-state": getProgressState(value, max),
|
|
222
129
|
"data-value": value ?? void 0,
|
|
223
|
-
"data-max": max
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
130
|
+
"data-max": max,
|
|
131
|
+
...progressProps.unstyled !== !0 && {
|
|
132
|
+
size
|
|
133
|
+
},
|
|
134
|
+
...progressProps,
|
|
227
135
|
onLayout: function(e) {
|
|
228
136
|
var _progressProps_onLayout;
|
|
229
137
|
setWidth(e.nativeEvent.layout.width), (_progressProps_onLayout = progressProps.onLayout) === null || _progressProps_onLayout === void 0 || _progressProps_onLayout.call(progressProps, e);
|
|
230
138
|
},
|
|
231
139
|
ref: forwardedRef
|
|
232
|
-
})
|
|
140
|
+
})
|
|
233
141
|
});
|
|
234
142
|
}), {
|
|
235
143
|
Indicator: ProgressIndicator
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/ui/progress/src/Progress.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAIA,cAAyC,0BAEzC,wBAAmC,oCACnC,mBAAwB,+BACxB,iBAAqC,6BACrC,gBAA+B,4BAC/B,QAAuB
|
|
5
|
-
"names": ["PROGRESS_NAME", "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAIA,cAAyC,0BAEzC,wBAAmC,oCACnC,mBAAwB,+BACxB,iBAAqC,6BACrC,gBAA+B,4BAC/B,QAAuB,2BAEjBA,gBAAgB,YAEhB,CAACC,uBAAuBC,mBAAAA,QAAuBC,0CAAmBH,aAAAA,GAElE,CAACI,kBAAkBC,kBAAAA,IACvBJ,sBAA4CD,aAAAA,GAMxCM,iBAAiB,qBAEVC,6BAAyBC,oBAAOC,8BAAgB;EAC3DC,MAAMJ;EAENK,UAAU;IACRC,UAAU;MACRC,OAAO;QACLC,QAAQ;QACRC,OAAO;QACPC,cAAc;MAChB;IACF;EACF;EAEAC,iBAAiB;IACfL,UAAUM,QAAQC,IAAIC,qBAAqB;EAC7C;AACF,CAAA,GAIMC,oBAAoBd,uBAAuBe,UAAU,SACzDC,OACAC,cAAY;AAEZ,MAAM,EAAEC,iBAAiBC,WAAW,GAAGC,eAAAA,IAAmBJ,OACpDK,UAAUvB,mBAAmBC,gBAAgBmB,eAAAA,GACxBG,gBAArBC,MAAMD,QAAQE,QAAOF,iBAAAA,QAAQG,WAAK,QAAbH,mBAAAA,SAAAA,iBAAiB,IAEtCI,IAAI,EAAEJ,QAAQb,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AAQyC;UACRI,cAAUF,8BAAiBF,IAAAA,IAAQ;UACnCxC,OAAO;QACT;MACF;IACF;EACF;EAEAE,iBAAiB;IACfL,UAAUM,QAAQC,IAAIC,qBAAqB;EAC7C;AACF,CAAA,GAUMwC,eAAWC,qCACfT,cAAc9B,UAA8B,SAAkBC,OAAOC,cAAY;AAC/E,MAAM;;IAEJC;IACAM,OAAO+B;IACPhC,KAAKiC;IACLC,gBAAgBtB;IAChBa,OAAO;IACP,GAAGU;EAAAA,IACD1C,OAEEO,MAAMiB,iBAAiBgB,OAAAA,IAAWA,UAAUZ,aAC5CpB,QAAQmB,mBAAmBY,WAAWhC,GAAAA,IAAOgC,YAAY,MACzDI,aAAapB,SAASf,KAAAA,IAASiC,cAAcjC,OAAOD,GAAAA,IAAOO,QAC3D,CAACtB,OAAOoD,QAAAA,IAAYC,MAAMC,SAAS,CAAA;AAEzC,SACE,uCAAApC,KAAC7B,kBAAAA;IAAiBkE,OAAO7C;IAAiBM;IAAcD;IAAUf;cAChE,uCAAAkB,KAACmB,eAAAA;MACCmB,iBAAezC;MACf0C,iBAAe;MACfC,iBAAe3B,SAASf,KAAAA,IAASA,QAAQM;MACzCqC,kBAAgBR;;MAEhBS,MAAK;MACLzC,cAAYC,iBAAiBJ,OAAOD,GAAAA;MACpCM,cAAYL,SAASM;MACrBC,YAAUR;MACT,GAAImC,cAAcrD,aAAa,MAAQ;QACtC2C;MACF;MACC,GAAGU;MACJW,UAAU,SAACC,GAAAA;YAETZ;AADAE,iBAASU,EAAEC,YAAYC,OAAOhE,KAAK,IACnCkD,0BAAAA,cAAcW,cAAQ,QAAtBX,4BAAAA,UAAAA,wBAAAA,KAAAA,eAAyBY,CAAAA;MAC3B;MACApC,KAAKjB;;;AAIb,CAAA,GACA;EACEwD,WAAW3D;AACb,CAAA;",
|
|
5
|
+
"names": ["PROGRESS_NAME", "createProgressContext", "createProgressScope", "createContextScope", "ProgressProvider", "useProgressContext", "INDICATOR_NAME", "ProgressIndicatorFrame", "styled", "ThemeableStack", "name", "variants", "unstyled", "false", "height", "width", "backgrounded", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS", "ProgressIndicator", "styleable", "props", "forwardedRef", "__scopeProgress", "animation", "indicatorProps", "context", "pct", "max", "value", "x", "_jsx", "data-state", "getProgressState", "data-value", "undefined", "data-max", "animateOnly", "opacity", "ref", "defaultGetValueLabel", "Math", "round", "maxValue", "isNumber", "isValidMaxNumber", "Number", "isNaN", "isValidValueNumber", "DEFAULT_MAX", "ProgressFrame", "borderRadius", "overflow", "size", "val", "getVariableValue", "getSize", "minWidth", "Progress", "withStaticProperties", "valueProp", "maxProp", "getValueLabel", "progressProps", "valueLabel", "setWidth", "React", "useState", "scope", "aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-valuetext", "role", "onLayout", "e", "nativeEvent", "layout", "Indicator"]
|
|
6
6
|
}
|
|
@@ -5,99 +5,7 @@ import { getSize } from "@tamagui/get-token";
|
|
|
5
5
|
import { withStaticProperties } from "@tamagui/helpers";
|
|
6
6
|
import { ThemeableStack } from "@tamagui/stacks";
|
|
7
7
|
import * as React from "react";
|
|
8
|
-
|
|
9
|
-
(len == null || len > arr.length) && (len = arr.length);
|
|
10
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
11
|
-
return arr2;
|
|
12
|
-
}
|
|
13
|
-
function _array_with_holes(arr) {
|
|
14
|
-
if (Array.isArray(arr)) return arr;
|
|
15
|
-
}
|
|
16
|
-
function _define_property(obj, key, value) {
|
|
17
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
18
|
-
value,
|
|
19
|
-
enumerable: !0,
|
|
20
|
-
configurable: !0,
|
|
21
|
-
writable: !0
|
|
22
|
-
}) : obj[key] = value, obj;
|
|
23
|
-
}
|
|
24
|
-
function _iterable_to_array_limit(arr, i) {
|
|
25
|
-
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
26
|
-
if (_i != null) {
|
|
27
|
-
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
28
|
-
try {
|
|
29
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
30
|
-
;
|
|
31
|
-
} catch (err) {
|
|
32
|
-
_d = !0, _e = err;
|
|
33
|
-
} finally {
|
|
34
|
-
try {
|
|
35
|
-
!_n && _i.return != null && _i.return();
|
|
36
|
-
} finally {
|
|
37
|
-
if (_d) throw _e;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return _arr;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function _non_iterable_rest() {
|
|
44
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
45
|
-
}
|
|
46
|
-
function _object_spread(target) {
|
|
47
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
48
|
-
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
49
|
-
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
50
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
51
|
-
}))), ownKeys2.forEach(function(key) {
|
|
52
|
-
_define_property(target, key, source[key]);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
return target;
|
|
56
|
-
}
|
|
57
|
-
function ownKeys(object, enumerableOnly) {
|
|
58
|
-
var keys = Object.keys(object);
|
|
59
|
-
if (Object.getOwnPropertySymbols) {
|
|
60
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
61
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
62
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
63
|
-
})), keys.push.apply(keys, symbols);
|
|
64
|
-
}
|
|
65
|
-
return keys;
|
|
66
|
-
}
|
|
67
|
-
function _object_spread_props(target, source) {
|
|
68
|
-
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
69
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
70
|
-
}), target;
|
|
71
|
-
}
|
|
72
|
-
function _object_without_properties(source, excluded) {
|
|
73
|
-
if (source == null) return {};
|
|
74
|
-
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
75
|
-
if (Object.getOwnPropertySymbols) {
|
|
76
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
77
|
-
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
78
|
-
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
79
|
-
}
|
|
80
|
-
return target;
|
|
81
|
-
}
|
|
82
|
-
function _object_without_properties_loose(source, excluded) {
|
|
83
|
-
if (source == null) return {};
|
|
84
|
-
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
85
|
-
for (i = 0; i < sourceKeys.length; i++)
|
|
86
|
-
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
87
|
-
return target;
|
|
88
|
-
}
|
|
89
|
-
function _sliced_to_array(arr, i) {
|
|
90
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
91
|
-
}
|
|
92
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
93
|
-
if (o) {
|
|
94
|
-
if (typeof o == "string") return _array_like_to_array(o, minLen);
|
|
95
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
96
|
-
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n);
|
|
97
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
var PROGRESS_NAME = "Progress", _createContextScope = _sliced_to_array(createContextScope(PROGRESS_NAME), 2), createProgressContext = _createContextScope[0], createProgressScope = _createContextScope[1], _createProgressContext = _sliced_to_array(createProgressContext(PROGRESS_NAME), 2), ProgressProvider = _createProgressContext[0], useProgressContext = _createProgressContext[1], INDICATOR_NAME = "ProgressIndicator", ProgressIndicatorFrame = styled(ThemeableStack, {
|
|
8
|
+
var PROGRESS_NAME = "Progress", [createProgressContext, createProgressScope] = createContextScope(PROGRESS_NAME), [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME), INDICATOR_NAME = "ProgressIndicator", ProgressIndicatorFrame = styled(ThemeableStack, {
|
|
101
9
|
name: INDICATOR_NAME,
|
|
102
10
|
variants: {
|
|
103
11
|
unstyled: {
|
|
@@ -112,29 +20,27 @@ var PROGRESS_NAME = "Progress", _createContextScope = _sliced_to_array(createCon
|
|
|
112
20
|
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
113
21
|
}
|
|
114
22
|
}), ProgressIndicator = ProgressIndicatorFrame.styleable(function(props, forwardedRef) {
|
|
115
|
-
var __scopeProgress = props
|
|
116
|
-
|
|
117
|
-
"animation"
|
|
118
|
-
]), context = useProgressContext(INDICATOR_NAME, __scopeProgress), _context_value, pct = context.max - ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0), x = -(context.width === 0 ? 300 : context.width) * (pct / 100), _context_value1;
|
|
119
|
-
return /* @__PURE__ */ _jsx(ProgressIndicatorFrame, _object_spread_props(_object_spread({
|
|
23
|
+
var { __scopeProgress, animation, ...indicatorProps } = props, context = useProgressContext(INDICATOR_NAME, __scopeProgress), _context_value, pct = context.max - ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0), x = -(context.width === 0 ? 300 : context.width) * (pct / 100), _context_value1;
|
|
24
|
+
return /* @__PURE__ */ _jsx(ProgressIndicatorFrame, {
|
|
120
25
|
"data-state": getProgressState(context.value, context.max),
|
|
121
26
|
"data-value": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,
|
|
122
27
|
"data-max": context.max,
|
|
123
28
|
x,
|
|
124
|
-
width: context.width
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
29
|
+
width: context.width,
|
|
30
|
+
...!props.unstyled && {
|
|
31
|
+
animateOnly: [
|
|
32
|
+
"transform"
|
|
33
|
+
],
|
|
34
|
+
opacity: context.width === 0 ? 0 : 1
|
|
35
|
+
},
|
|
36
|
+
...indicatorProps,
|
|
131
37
|
ref: forwardedRef,
|
|
132
38
|
// avoid animation on first render so the progress doesn't bounce to initial location
|
|
133
39
|
animation: context.width ? animation : null
|
|
134
|
-
})
|
|
40
|
+
});
|
|
135
41
|
});
|
|
136
42
|
function defaultGetValueLabel(value, max) {
|
|
137
|
-
return
|
|
43
|
+
return `${Math.round(value / max * 100)}%`;
|
|
138
44
|
}
|
|
139
45
|
function getProgressState(value, maxValue) {
|
|
140
46
|
return value == null ? "indeterminate" : value === maxValue ? "complete" : "loading";
|
|
@@ -173,19 +79,21 @@ var DEFAULT_MAX = 100, ProgressFrame = styled(ThemeableStack, {
|
|
|
173
79
|
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
174
80
|
}
|
|
175
81
|
}), Progress = withStaticProperties(ProgressFrame.styleable(function(props, forwardedRef) {
|
|
176
|
-
var
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
82
|
+
var {
|
|
83
|
+
// @ts-expect-error
|
|
84
|
+
__scopeProgress,
|
|
85
|
+
value: valueProp,
|
|
86
|
+
max: maxProp,
|
|
87
|
+
getValueLabel = defaultGetValueLabel,
|
|
88
|
+
size = "$true",
|
|
89
|
+
...progressProps
|
|
90
|
+
} = props, max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX, value = isValidValueNumber(valueProp, max) ? valueProp : null, valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0, [width, setWidth] = React.useState(0);
|
|
183
91
|
return /* @__PURE__ */ _jsx(ProgressProvider, {
|
|
184
92
|
scope: __scopeProgress,
|
|
185
93
|
value,
|
|
186
94
|
max,
|
|
187
95
|
width,
|
|
188
|
-
children: /* @__PURE__ */ _jsx(ProgressFrame,
|
|
96
|
+
children: /* @__PURE__ */ _jsx(ProgressFrame, {
|
|
189
97
|
"aria-valuemax": max,
|
|
190
98
|
"aria-valuemin": 0,
|
|
191
99
|
"aria-valuenow": isNumber(value) ? value : void 0,
|
|
@@ -194,16 +102,17 @@ var DEFAULT_MAX = 100, ProgressFrame = styled(ThemeableStack, {
|
|
|
194
102
|
role: "progressbar",
|
|
195
103
|
"data-state": getProgressState(value, max),
|
|
196
104
|
"data-value": value ?? void 0,
|
|
197
|
-
"data-max": max
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
105
|
+
"data-max": max,
|
|
106
|
+
...progressProps.unstyled !== !0 && {
|
|
107
|
+
size
|
|
108
|
+
},
|
|
109
|
+
...progressProps,
|
|
201
110
|
onLayout: function(e) {
|
|
202
111
|
var _progressProps_onLayout;
|
|
203
112
|
setWidth(e.nativeEvent.layout.width), (_progressProps_onLayout = progressProps.onLayout) === null || _progressProps_onLayout === void 0 || _progressProps_onLayout.call(progressProps, e);
|
|
204
113
|
},
|
|
205
114
|
ref: forwardedRef
|
|
206
|
-
})
|
|
115
|
+
})
|
|
207
116
|
});
|
|
208
117
|
}), {
|
|
209
118
|
Indicator: ProgressIndicator
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/ui/progress/src/Progress.tsx"],
|
|
4
|
-
"mappings": ";AAIA,SAASA,kBAAkBC,cAAc;AAEzC,SAASC,0BAA0B;AACnC,SAASC,eAAe;AACxB,SAASC,4BAA4B;AACrC,SAASC,sBAAsB;AAC/B,YAAYC,WAAW
|
|
5
|
-
"names": ["getVariableValue", "styled", "createContextScope", "getSize", "withStaticProperties", "ThemeableStack", "React", "PROGRESS_NAME", "createProgressContext", "createProgressScope", "ProgressProvider", "useProgressContext", "INDICATOR_NAME", "ProgressIndicatorFrame", "name", "variants", "unstyled", "false", "height", "width", "backgrounded", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS", "ProgressIndicator", "styleable", "props", "forwardedRef", "__scopeProgress", "animation", "indicatorProps", "context", "pct", "max", "value", "x", "data-state", "getProgressState", "data-value", "undefined", "data-max", "animateOnly", "opacity", "ref", "defaultGetValueLabel", "Math", "round", "maxValue", "isNumber", "isValidMaxNumber", "Number", "isNaN", "isValidValueNumber", "DEFAULT_MAX", "ProgressFrame", "borderRadius", "overflow", "size", "val", "minWidth", "Progress", "valueProp", "maxProp", "getValueLabel", "progressProps", "valueLabel", "
|
|
4
|
+
"mappings": ";AAIA,SAASA,kBAAkBC,cAAc;AAEzC,SAASC,0BAA0B;AACnC,SAASC,eAAe;AACxB,SAASC,4BAA4B;AACrC,SAASC,sBAAsB;AAC/B,YAAYC,WAAW;AAEvB,IAAMC,gBAAgB,YAEhB,CAACC,uBAAuBC,mBAAAA,IAAuBP,mBAAmBK,aAAAA,GAElE,CAACG,kBAAkBC,kBAAAA,IACvBH,sBAA4CD,aAAAA,GAMxCK,iBAAiB,qBAEVC,yBAAyBZ,OAAOI,gBAAgB;EAC3DS,MAAMF;EAENG,UAAU;IACRC,UAAU;MACRC,OAAO;QACLC,QAAQ;QACRC,OAAO;QACPC,cAAc;MAChB;IACF;EACF;EAEAC,iBAAiB;IACfL,UAAUM,QAAQC,IAAIC,qBAAqB;EAC7C;AACF,CAAA,GAIMC,oBAAoBZ,uBAAuBa,UAAU,SACzDC,OACAC,cAAY;AAEZ,MAAM,EAAEC,iBAAiBC,WAAW,GAAGC,eAAAA,IAAmBJ,OACpDK,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D,WAAWtD;AACb,CAAA;",
|
|
5
|
+
"names": ["getVariableValue", "styled", "createContextScope", "getSize", "withStaticProperties", "ThemeableStack", "React", "PROGRESS_NAME", "createProgressContext", "createProgressScope", "ProgressProvider", "useProgressContext", "INDICATOR_NAME", "ProgressIndicatorFrame", "name", "variants", "unstyled", "false", "height", "width", "backgrounded", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS", "ProgressIndicator", "styleable", "props", "forwardedRef", "__scopeProgress", "animation", "indicatorProps", "context", "pct", "max", "value", "x", "data-state", "getProgressState", "data-value", "undefined", "data-max", "animateOnly", "opacity", "ref", "defaultGetValueLabel", "Math", "round", "maxValue", "isNumber", "isValidMaxNumber", "Number", "isNaN", "isValidValueNumber", "DEFAULT_MAX", "ProgressFrame", "borderRadius", "overflow", "size", "val", "minWidth", "Progress", "valueProp", "maxProp", "getValueLabel", "progressProps", "valueLabel", "setWidth", "useState", "scope", "aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-valuetext", "role", "onLayout", "e", "nativeEvent", "layout", "Indicator"]
|
|
6
6
|
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getVariableValue, styled } from "@tamagui/core";
|
|
3
|
+
import { createContextScope } from "@tamagui/create-context";
|
|
4
|
+
import { getSize } from "@tamagui/get-token";
|
|
5
|
+
import { withStaticProperties } from "@tamagui/helpers";
|
|
6
|
+
import { ThemeableStack } from "@tamagui/stacks";
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
var PROGRESS_NAME = "Progress",
|
|
9
|
+
[createProgressContext, createProgressScope] = createContextScope(PROGRESS_NAME),
|
|
10
|
+
[ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME),
|
|
11
|
+
INDICATOR_NAME = "ProgressIndicator",
|
|
12
|
+
ProgressIndicatorFrame = styled(ThemeableStack, {
|
|
13
|
+
name: INDICATOR_NAME,
|
|
14
|
+
variants: {
|
|
15
|
+
unstyled: {
|
|
16
|
+
false: {
|
|
17
|
+
height: "100%",
|
|
18
|
+
width: "100%",
|
|
19
|
+
backgrounded: !0
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
25
|
+
}
|
|
26
|
+
}),
|
|
27
|
+
ProgressIndicator = ProgressIndicatorFrame.styleable(function (props, forwardedRef) {
|
|
28
|
+
var {
|
|
29
|
+
__scopeProgress,
|
|
30
|
+
animation,
|
|
31
|
+
...indicatorProps
|
|
32
|
+
} = props,
|
|
33
|
+
context = useProgressContext(INDICATOR_NAME, __scopeProgress),
|
|
34
|
+
_context_value,
|
|
35
|
+
pct = context.max - ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0),
|
|
36
|
+
x = -(context.width === 0 ? 300 : context.width) * (pct / 100),
|
|
37
|
+
_context_value1;
|
|
38
|
+
return /* @__PURE__ */_jsx(ProgressIndicatorFrame, {
|
|
39
|
+
"data-state": getProgressState(context.value, context.max),
|
|
40
|
+
"data-value": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,
|
|
41
|
+
"data-max": context.max,
|
|
42
|
+
x,
|
|
43
|
+
width: context.width,
|
|
44
|
+
...(!props.unstyled && {
|
|
45
|
+
animateOnly: ["transform"],
|
|
46
|
+
opacity: context.width === 0 ? 0 : 1
|
|
47
|
+
}),
|
|
48
|
+
...indicatorProps,
|
|
49
|
+
ref: forwardedRef,
|
|
50
|
+
// avoid animation on first render so the progress doesn't bounce to initial location
|
|
51
|
+
animation: context.width ? animation : null
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
function defaultGetValueLabel(value, max) {
|
|
55
|
+
return `${Math.round(value / max * 100)}%`;
|
|
56
|
+
}
|
|
57
|
+
function getProgressState(value, maxValue) {
|
|
58
|
+
return value == null ? "indeterminate" : value === maxValue ? "complete" : "loading";
|
|
59
|
+
}
|
|
60
|
+
function isNumber(value) {
|
|
61
|
+
return typeof value == "number";
|
|
62
|
+
}
|
|
63
|
+
function isValidMaxNumber(max) {
|
|
64
|
+
return isNumber(max) && !Number.isNaN(max) && max > 0;
|
|
65
|
+
}
|
|
66
|
+
function isValidValueNumber(value, max) {
|
|
67
|
+
return isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0;
|
|
68
|
+
}
|
|
69
|
+
var DEFAULT_MAX = 100,
|
|
70
|
+
ProgressFrame = styled(ThemeableStack, {
|
|
71
|
+
name: "Progress",
|
|
72
|
+
variants: {
|
|
73
|
+
unstyled: {
|
|
74
|
+
false: {
|
|
75
|
+
borderRadius: 1e5,
|
|
76
|
+
overflow: "hidden",
|
|
77
|
+
backgrounded: !0
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
size: {
|
|
81
|
+
"...size": function (val) {
|
|
82
|
+
var size = Math.round(getVariableValue(getSize(val)) * 0.25);
|
|
83
|
+
return {
|
|
84
|
+
height: size,
|
|
85
|
+
minWidth: getVariableValue(size) * 20,
|
|
86
|
+
width: "100%"
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
defaultVariants: {
|
|
92
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
93
|
+
}
|
|
94
|
+
}),
|
|
95
|
+
Progress = withStaticProperties(ProgressFrame.styleable(function (props, forwardedRef) {
|
|
96
|
+
var {
|
|
97
|
+
// @ts-expect-error
|
|
98
|
+
__scopeProgress,
|
|
99
|
+
value: valueProp,
|
|
100
|
+
max: maxProp,
|
|
101
|
+
getValueLabel = defaultGetValueLabel,
|
|
102
|
+
size = "$true",
|
|
103
|
+
...progressProps
|
|
104
|
+
} = props,
|
|
105
|
+
max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX,
|
|
106
|
+
value = isValidValueNumber(valueProp, max) ? valueProp : null,
|
|
107
|
+
valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0,
|
|
108
|
+
[width, setWidth] = React.useState(0);
|
|
109
|
+
return /* @__PURE__ */_jsx(ProgressProvider, {
|
|
110
|
+
scope: __scopeProgress,
|
|
111
|
+
value,
|
|
112
|
+
max,
|
|
113
|
+
width,
|
|
114
|
+
children: /* @__PURE__ */_jsx(ProgressFrame, {
|
|
115
|
+
"aria-valuemax": max,
|
|
116
|
+
"aria-valuemin": 0,
|
|
117
|
+
"aria-valuenow": isNumber(value) ? value : void 0,
|
|
118
|
+
"aria-valuetext": valueLabel,
|
|
119
|
+
// @ts-ignore
|
|
120
|
+
role: "progressbar",
|
|
121
|
+
"data-state": getProgressState(value, max),
|
|
122
|
+
"data-value": value ?? void 0,
|
|
123
|
+
"data-max": max,
|
|
124
|
+
...(progressProps.unstyled !== !0 && {
|
|
125
|
+
size
|
|
126
|
+
}),
|
|
127
|
+
...progressProps,
|
|
128
|
+
onLayout: function (e) {
|
|
129
|
+
var _progressProps_onLayout;
|
|
130
|
+
setWidth(e.nativeEvent.layout.width), (_progressProps_onLayout = progressProps.onLayout) === null || _progressProps_onLayout === void 0 || _progressProps_onLayout.call(progressProps, e);
|
|
131
|
+
},
|
|
132
|
+
ref: forwardedRef
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
}), {
|
|
136
|
+
Indicator: ProgressIndicator
|
|
137
|
+
});
|
|
138
|
+
export { Progress, ProgressFrame, ProgressIndicator, ProgressIndicatorFrame, createProgressScope };
|
|
139
|
+
//# sourceMappingURL=Progress.native.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["jsx","_jsx","getVariableValue","styled","createContextScope","getSize","withStaticProperties","ThemeableStack","React","PROGRESS_NAME","createProgressContext","createProgressScope","ProgressProvider","useProgressContext","INDICATOR_NAME","ProgressIndicatorFrame","name","variants","unstyled","false","height","width","backgrounded","defaultVariants","process","env","TAMAGUI_HEADLESS","ProgressIndicator","styleable","props","forwardedRef","__scopeProgress","animation","indicatorProps","context","_context_value","pct","max","value","x","_context_value1","getProgressState","animateOnly","opacity","ref","defaultGetValueLabel","Math","round","maxValue","isNumber","isValidMaxNumber","Number","isNaN","isValidValueNumber","DEFAULT_MAX","ProgressFrame","borderRadius","overflow","size","...size","val","minWidth","Progress","valueProp","maxProp","getValueLabel","progressProps","valueLabel","setWidth","useState","scope","children","role","onLayout","e","_progressProps_onLayout","nativeEvent","layout","call"],"sources":["../../src/Progress.tsx"],"sourcesContent":[null],"mappings":"AAIA,SAASA,GAAA,IAAAC,IAAA,QAAkB,mBAAc;AAEzC,SAASC,gBAAA,EAAAC,MAAA,QAA0B;AACnC,SAASC,kBAAe;AACxB,SAASC,OAAA,4BAA4B;AACrC,SAASC,oBAAA,QAAsB;AAC/B,SAAAC,cAAuB;AA8CnB,YAAAC,KAAA;AA5CJ,IAAAC,aAAM,aAAgB;EAAA,CAAAC,qBAEf,EAAAC,mBAAuB,IAAmBP,kBAAI,CAAAK,aAAmB;EAAa,CAAAG,gBAE9E,EAAAC,kBAAkB,IAAkBH,qBACzC,CAAAD,aAA4C;EAAaK,cAMrD,sBAAiB;EAAAC,sBAEV,GAAAZ,MAAyB,CAAAI,cAAO;IAC3CS,IAAA,EAAMF,cAAA;IAENG,QAAA,EAAU;MACRC,QAAA,EAAU;QACRC,KAAA,EAAO;UACLC,MAAA,EAAQ;UACRC,KAAA,EAAO;UACPC,YAAA,EAAc;QAChB;MACF;IACF;IAEAC,eAAA,EAAiB;MACfL,QAAA,EAAUM,OAAA,CAAQC,GAAA,CAAIC,gBAAA,KAAqB;IAC7C;EACF,CAAC;EAIKC,iBAAA,GAAoBZ,sBAAA,CAAuBa,SAAA,CAAU,UACzDC,KAAA,EACAC,YAAA,EACA;IACA;QAAMC,eAAE;QAAAC,SAAiB;QAAA,GAAWC;MAAG,IAAeJ,KAAI;MAAAK,OACpD,GAAArB,kBAAU,CAAAC,cAAmB,EAAAiB,eAAgB;MAAeI,cACtD;MAAQC,GAAA,GAAAF,OAAO,CAAAG,GAAQ,KAAA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AAA6D,QAAA;IAAA,OACD,eAEQpE,IAAA,CAAAW,gBAAwB;MAKpC0D,KAAA,EACEvC,eAAA;MACEO,KAAC;MAAAD,GAAA;MAAAhB,KACC;MAAekD,QACf,iBAAetE,IAAA,CAAAsD,aAAA;QAAA,eACf,EAAAlB,GAAe;QAA0B,eACzC;QAAgB,eAEX,EAAAY,QAAA,CAAAX,KAAA,IAAAA,KAAA;QAAA,gBACO,EAAA6B,UAAA;QAA2B;QAClBK,IACrB,eAAU;QAAA,YACL,EAAA/B,gBAAc,CAAAH,KAAa,EAAQD,GAAA;QAAA,YACtC,EAAAC,KAAA;QAAA,UACF,EAAAD,GAAA;QAAA,IACC6B,aAAG,CAAAhD,QAAA;UACJwC;QACE;QAC0B,GAC5BQ,aAAA;QAAAO,QACK,WAAAA,CAAAC,CAAA;UAAA,IAAAC,uBAAA;UAETP,QAAA,CAAAM,CAAA,CAAAE,WAAA,CAAAC,MAAA,CAAAxD,KAAA,IAAAsD,uBAAA,GAAAT,aAAA,CAAAO,QAAA,cAAAE,uBAAA,eAAAA,uBAAA,CAAAG,IAAA,CAAAZ,aAAA,EAAAQ,CAAA;QAEH;QACD9B,GAAA,EAAAd;MACE;IACF;EACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
|
|
@@ -5,99 +5,7 @@ import { getSize } from "@tamagui/get-token";
|
|
|
5
5
|
import { withStaticProperties } from "@tamagui/helpers";
|
|
6
6
|
import { ThemeableStack } from "@tamagui/stacks";
|
|
7
7
|
import * as React from "react";
|
|
8
|
-
|
|
9
|
-
(len == null || len > arr.length) && (len = arr.length);
|
|
10
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
11
|
-
return arr2;
|
|
12
|
-
}
|
|
13
|
-
function _array_with_holes(arr) {
|
|
14
|
-
if (Array.isArray(arr)) return arr;
|
|
15
|
-
}
|
|
16
|
-
function _define_property(obj, key, value) {
|
|
17
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
18
|
-
value,
|
|
19
|
-
enumerable: !0,
|
|
20
|
-
configurable: !0,
|
|
21
|
-
writable: !0
|
|
22
|
-
}) : obj[key] = value, obj;
|
|
23
|
-
}
|
|
24
|
-
function _iterable_to_array_limit(arr, i) {
|
|
25
|
-
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
26
|
-
if (_i != null) {
|
|
27
|
-
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
28
|
-
try {
|
|
29
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
30
|
-
;
|
|
31
|
-
} catch (err) {
|
|
32
|
-
_d = !0, _e = err;
|
|
33
|
-
} finally {
|
|
34
|
-
try {
|
|
35
|
-
!_n && _i.return != null && _i.return();
|
|
36
|
-
} finally {
|
|
37
|
-
if (_d) throw _e;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return _arr;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function _non_iterable_rest() {
|
|
44
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
45
|
-
}
|
|
46
|
-
function _object_spread(target) {
|
|
47
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
48
|
-
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
49
|
-
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
50
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
51
|
-
}))), ownKeys2.forEach(function(key) {
|
|
52
|
-
_define_property(target, key, source[key]);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
return target;
|
|
56
|
-
}
|
|
57
|
-
function ownKeys(object, enumerableOnly) {
|
|
58
|
-
var keys = Object.keys(object);
|
|
59
|
-
if (Object.getOwnPropertySymbols) {
|
|
60
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
61
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
62
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
63
|
-
})), keys.push.apply(keys, symbols);
|
|
64
|
-
}
|
|
65
|
-
return keys;
|
|
66
|
-
}
|
|
67
|
-
function _object_spread_props(target, source) {
|
|
68
|
-
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
69
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
70
|
-
}), target;
|
|
71
|
-
}
|
|
72
|
-
function _object_without_properties(source, excluded) {
|
|
73
|
-
if (source == null) return {};
|
|
74
|
-
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
75
|
-
if (Object.getOwnPropertySymbols) {
|
|
76
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
77
|
-
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
78
|
-
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
79
|
-
}
|
|
80
|
-
return target;
|
|
81
|
-
}
|
|
82
|
-
function _object_without_properties_loose(source, excluded) {
|
|
83
|
-
if (source == null) return {};
|
|
84
|
-
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
85
|
-
for (i = 0; i < sourceKeys.length; i++)
|
|
86
|
-
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
87
|
-
return target;
|
|
88
|
-
}
|
|
89
|
-
function _sliced_to_array(arr, i) {
|
|
90
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
91
|
-
}
|
|
92
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
93
|
-
if (o) {
|
|
94
|
-
if (typeof o == "string") return _array_like_to_array(o, minLen);
|
|
95
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
96
|
-
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n);
|
|
97
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
var PROGRESS_NAME = "Progress", _createContextScope = _sliced_to_array(createContextScope(PROGRESS_NAME), 2), createProgressContext = _createContextScope[0], createProgressScope = _createContextScope[1], _createProgressContext = _sliced_to_array(createProgressContext(PROGRESS_NAME), 2), ProgressProvider = _createProgressContext[0], useProgressContext = _createProgressContext[1], INDICATOR_NAME = "ProgressIndicator", ProgressIndicatorFrame = styled(ThemeableStack, {
|
|
8
|
+
var PROGRESS_NAME = "Progress", [createProgressContext, createProgressScope] = createContextScope(PROGRESS_NAME), [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME), INDICATOR_NAME = "ProgressIndicator", ProgressIndicatorFrame = styled(ThemeableStack, {
|
|
101
9
|
name: INDICATOR_NAME,
|
|
102
10
|
variants: {
|
|
103
11
|
unstyled: {
|
|
@@ -112,29 +20,27 @@ var PROGRESS_NAME = "Progress", _createContextScope = _sliced_to_array(createCon
|
|
|
112
20
|
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
113
21
|
}
|
|
114
22
|
}), ProgressIndicator = ProgressIndicatorFrame.styleable(function(props, forwardedRef) {
|
|
115
|
-
var __scopeProgress = props
|
|
116
|
-
|
|
117
|
-
"animation"
|
|
118
|
-
]), context = useProgressContext(INDICATOR_NAME, __scopeProgress), _context_value, pct = context.max - ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0), x = -(context.width === 0 ? 300 : context.width) * (pct / 100), _context_value1;
|
|
119
|
-
return /* @__PURE__ */ _jsx(ProgressIndicatorFrame, _object_spread_props(_object_spread({
|
|
23
|
+
var { __scopeProgress, animation, ...indicatorProps } = props, context = useProgressContext(INDICATOR_NAME, __scopeProgress), _context_value, pct = context.max - ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0), x = -(context.width === 0 ? 300 : context.width) * (pct / 100), _context_value1;
|
|
24
|
+
return /* @__PURE__ */ _jsx(ProgressIndicatorFrame, {
|
|
120
25
|
"data-state": getProgressState(context.value, context.max),
|
|
121
26
|
"data-value": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,
|
|
122
27
|
"data-max": context.max,
|
|
123
28
|
x,
|
|
124
|
-
width: context.width
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
29
|
+
width: context.width,
|
|
30
|
+
...!props.unstyled && {
|
|
31
|
+
animateOnly: [
|
|
32
|
+
"transform"
|
|
33
|
+
],
|
|
34
|
+
opacity: context.width === 0 ? 0 : 1
|
|
35
|
+
},
|
|
36
|
+
...indicatorProps,
|
|
131
37
|
ref: forwardedRef,
|
|
132
38
|
// avoid animation on first render so the progress doesn't bounce to initial location
|
|
133
39
|
animation: context.width ? animation : null
|
|
134
|
-
})
|
|
40
|
+
});
|
|
135
41
|
});
|
|
136
42
|
function defaultGetValueLabel(value, max) {
|
|
137
|
-
return
|
|
43
|
+
return `${Math.round(value / max * 100)}%`;
|
|
138
44
|
}
|
|
139
45
|
function getProgressState(value, maxValue) {
|
|
140
46
|
return value == null ? "indeterminate" : value === maxValue ? "complete" : "loading";
|
|
@@ -173,19 +79,21 @@ var DEFAULT_MAX = 100, ProgressFrame = styled(ThemeableStack, {
|
|
|
173
79
|
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
174
80
|
}
|
|
175
81
|
}), Progress = withStaticProperties(ProgressFrame.styleable(function(props, forwardedRef) {
|
|
176
|
-
var
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
82
|
+
var {
|
|
83
|
+
// @ts-expect-error
|
|
84
|
+
__scopeProgress,
|
|
85
|
+
value: valueProp,
|
|
86
|
+
max: maxProp,
|
|
87
|
+
getValueLabel = defaultGetValueLabel,
|
|
88
|
+
size = "$true",
|
|
89
|
+
...progressProps
|
|
90
|
+
} = props, max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX, value = isValidValueNumber(valueProp, max) ? valueProp : null, valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0, [width, setWidth] = React.useState(0);
|
|
183
91
|
return /* @__PURE__ */ _jsx(ProgressProvider, {
|
|
184
92
|
scope: __scopeProgress,
|
|
185
93
|
value,
|
|
186
94
|
max,
|
|
187
95
|
width,
|
|
188
|
-
children: /* @__PURE__ */ _jsx(ProgressFrame,
|
|
96
|
+
children: /* @__PURE__ */ _jsx(ProgressFrame, {
|
|
189
97
|
"aria-valuemax": max,
|
|
190
98
|
"aria-valuemin": 0,
|
|
191
99
|
"aria-valuenow": isNumber(value) ? value : void 0,
|
|
@@ -194,16 +102,17 @@ var DEFAULT_MAX = 100, ProgressFrame = styled(ThemeableStack, {
|
|
|
194
102
|
role: "progressbar",
|
|
195
103
|
"data-state": getProgressState(value, max),
|
|
196
104
|
"data-value": value ?? void 0,
|
|
197
|
-
"data-max": max
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
105
|
+
"data-max": max,
|
|
106
|
+
...progressProps.unstyled !== !0 && {
|
|
107
|
+
size
|
|
108
|
+
},
|
|
109
|
+
...progressProps,
|
|
201
110
|
onLayout: function(e) {
|
|
202
111
|
var _progressProps_onLayout;
|
|
203
112
|
setWidth(e.nativeEvent.layout.width), (_progressProps_onLayout = progressProps.onLayout) === null || _progressProps_onLayout === void 0 || _progressProps_onLayout.call(progressProps, e);
|
|
204
113
|
},
|
|
205
114
|
ref: forwardedRef
|
|
206
|
-
})
|
|
115
|
+
})
|
|
207
116
|
});
|
|
208
117
|
}), {
|
|
209
118
|
Indicator: ProgressIndicator
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/ui/progress/src/Progress.tsx"],
|
|
4
|
-
"mappings": ";AAIA,SAASA,kBAAkBC,cAAc;AAEzC,SAASC,0BAA0B;AACnC,SAASC,eAAe;AACxB,SAASC,4BAA4B;AACrC,SAASC,sBAAsB;AAC/B,YAAYC,WAAW
|
|
5
|
-
"names": ["getVariableValue", "styled", "createContextScope", "getSize", "withStaticProperties", "ThemeableStack", "React", "PROGRESS_NAME", "createProgressContext", "createProgressScope", "ProgressProvider", "useProgressContext", "INDICATOR_NAME", "ProgressIndicatorFrame", "name", "variants", "unstyled", "false", "height", "width", "backgrounded", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS", "ProgressIndicator", "styleable", "props", "forwardedRef", "__scopeProgress", "animation", "indicatorProps", "context", "pct", "max", "value", "x", "data-state", "getProgressState", "data-value", "undefined", "data-max", "animateOnly", "opacity", "ref", "defaultGetValueLabel", "Math", "round", "maxValue", "isNumber", "isValidMaxNumber", "Number", "isNaN", "isValidValueNumber", "DEFAULT_MAX", "ProgressFrame", "borderRadius", "overflow", "size", "val", "minWidth", "Progress", "valueProp", "maxProp", "getValueLabel", "progressProps", "valueLabel", "
|
|
4
|
+
"mappings": ";AAIA,SAASA,kBAAkBC,cAAc;AAEzC,SAASC,0BAA0B;AACnC,SAASC,eAAe;AACxB,SAASC,4BAA4B;AACrC,SAASC,sBAAsB;AAC/B,YAAYC,WAAW;AAEvB,IAAMC,gBAAgB,YAEhB,CAACC,uBAAuBC,mBAAAA,IAAuBP,mBAAmBK,aAAAA,GAElE,CAACG,kBAAkBC,kBAAAA,IACvBH,sBAA4CD,aAAAA,GAMxCK,iBAA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AAYC,iBAAiBH,OAAOD,GAAAA;MACpCK,cAAYJ,SAASK;MACrBC,YAAUP;MACT,GAAI+B,cAAcjD,aAAa,MAAQ;QACtC0C;MACF;MACC,GAAGO;MACJU,UAAU,SAACC,GAAAA;YAETX;AADAE,iBAASS,EAAEC,YAAYC,OAAO3D,KAAK,IACnC8C,0BAAAA,cAAcU,cAAQ,QAAtBV,4BAAAA,UAAAA,wBAAAA,KAAAA,eAAyBW,CAAAA;MAC3B;MACAhC,KAAKhB;;;AAIb,CAAA,GACA;EACEmD,WAAWtD;AACb,CAAA;",
|
|
5
|
+
"names": ["getVariableValue", "styled", "createContextScope", "getSize", "withStaticProperties", "ThemeableStack", "React", "PROGRESS_NAME", "createProgressContext", "createProgressScope", "ProgressProvider", "useProgressContext", "INDICATOR_NAME", "ProgressIndicatorFrame", "name", "variants", "unstyled", "false", "height", "width", "backgrounded", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS", "ProgressIndicator", "styleable", "props", "forwardedRef", "__scopeProgress", "animation", "indicatorProps", "context", "pct", "max", "value", "x", "data-state", "getProgressState", "data-value", "undefined", "data-max", "animateOnly", "opacity", "ref", "defaultGetValueLabel", "Math", "round", "maxValue", "isNumber", "isValidMaxNumber", "Number", "isNaN", "isValidValueNumber", "DEFAULT_MAX", "ProgressFrame", "borderRadius", "overflow", "size", "val", "minWidth", "Progress", "valueProp", "maxProp", "getValueLabel", "progressProps", "valueLabel", "setWidth", "useState", "scope", "aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-valuetext", "role", "onLayout", "e", "nativeEvent", "layout", "Indicator"]
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/progress",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.111.0",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -33,18 +33,18 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@tamagui/compose-refs": "1.
|
|
37
|
-
"@tamagui/core": "1.
|
|
38
|
-
"@tamagui/create-context": "1.
|
|
39
|
-
"@tamagui/get-token": "1.
|
|
40
|
-
"@tamagui/helpers": "1.
|
|
41
|
-
"@tamagui/stacks": "1.
|
|
36
|
+
"@tamagui/compose-refs": "1.111.0",
|
|
37
|
+
"@tamagui/core": "1.111.0",
|
|
38
|
+
"@tamagui/create-context": "1.111.0",
|
|
39
|
+
"@tamagui/get-token": "1.111.0",
|
|
40
|
+
"@tamagui/helpers": "1.111.0",
|
|
41
|
+
"@tamagui/stacks": "1.111.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": "*"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@tamagui/build": "1.
|
|
47
|
+
"@tamagui/build": "1.111.0",
|
|
48
48
|
"react": "^18.2.0 || ^19.0.0",
|
|
49
49
|
"react-native": "0.74.1"
|
|
50
50
|
},
|