@tamagui/progress 3.0.6 → 3.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/dist/cjs/Progress.native.cjs +3 -4
- package/dist/cjs/Progress.native.js +3 -4
- package/dist/cjs/Progress.native.js.map +1 -1
- package/dist/esm/Progress.native.js +3 -4
- package/dist/esm/Progress.native.js.map +1 -1
- package/dist/jsx/Progress.native.cjs +3 -4
- package/dist/jsx/Progress.native.js +3 -4
- package/dist/jsx/Progress.native.js.map +1 -1
- package/package.json +9 -9
|
@@ -46,9 +46,9 @@ var ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
|
46
46
|
width: "100%"
|
|
47
47
|
});
|
|
48
48
|
var ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(props, forwardedRef) {
|
|
49
|
+
var _context_value, _context_value1;
|
|
49
50
|
var { __scopeProgress, transition, ...indicatorProps } = props;
|
|
50
51
|
var context = useProgressContext(INDICATOR_NAME, __scopeProgress);
|
|
51
|
-
var _context_value;
|
|
52
52
|
var progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max;
|
|
53
53
|
var x;
|
|
54
54
|
if (import_core.isWeb) {
|
|
@@ -57,7 +57,6 @@ var ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame,
|
|
|
57
57
|
var baseWidth = context.width || 0;
|
|
58
58
|
x = Math.ceil(-baseWidth * (2 - progressRatio));
|
|
59
59
|
}
|
|
60
|
-
var _context_value1;
|
|
61
60
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressIndicatorFrame, {
|
|
62
61
|
"data-state": getProgressState(context.value, context.max),
|
|
63
62
|
"data-value": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,
|
|
@@ -93,7 +92,7 @@ var progressTrackHeight = {
|
|
|
93
92
|
lg: 12,
|
|
94
93
|
xl: 16
|
|
95
94
|
};
|
|
96
|
-
var resolveProgressSize = function(val) {
|
|
95
|
+
var resolveProgressSize = function resolveProgressSize2(val) {
|
|
97
96
|
if (typeof val === "string" && val in progressTrackHeight) {
|
|
98
97
|
return progressTrackHeight[val];
|
|
99
98
|
}
|
|
@@ -136,7 +135,7 @@ var Progress = (0, import_helpers.withStaticProperties)((0, import_core.createSt
|
|
|
136
135
|
"data-max": max,
|
|
137
136
|
size,
|
|
138
137
|
...progressProps,
|
|
139
|
-
...!import_core.isWeb && { onLayout: function(e) {
|
|
138
|
+
...!import_core.isWeb && { onLayout: function onLayout(e) {
|
|
140
139
|
var _progressProps_onLayout;
|
|
141
140
|
var newWidth = Math.round(e.nativeEvent.layout.width);
|
|
142
141
|
if (newWidth !== width) {
|
|
@@ -46,9 +46,9 @@ var ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
|
46
46
|
width: "100%"
|
|
47
47
|
});
|
|
48
48
|
var ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(props, forwardedRef) {
|
|
49
|
+
var _context_value, _context_value1;
|
|
49
50
|
var { __scopeProgress, transition, ...indicatorProps } = props;
|
|
50
51
|
var context = useProgressContext(INDICATOR_NAME, __scopeProgress);
|
|
51
|
-
var _context_value;
|
|
52
52
|
var progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max;
|
|
53
53
|
var x;
|
|
54
54
|
if (import_core.isWeb) {
|
|
@@ -57,7 +57,6 @@ var ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame,
|
|
|
57
57
|
var baseWidth = context.width || 0;
|
|
58
58
|
x = Math.ceil(-baseWidth * (2 - progressRatio));
|
|
59
59
|
}
|
|
60
|
-
var _context_value1;
|
|
61
60
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressIndicatorFrame, {
|
|
62
61
|
"data-state": getProgressState(context.value, context.max),
|
|
63
62
|
"data-value": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,
|
|
@@ -93,7 +92,7 @@ var progressTrackHeight = {
|
|
|
93
92
|
lg: 12,
|
|
94
93
|
xl: 16
|
|
95
94
|
};
|
|
96
|
-
var resolveProgressSize = function(val) {
|
|
95
|
+
var resolveProgressSize = function resolveProgressSize2(val) {
|
|
97
96
|
if (typeof val === "string" && val in progressTrackHeight) {
|
|
98
97
|
return progressTrackHeight[val];
|
|
99
98
|
}
|
|
@@ -136,7 +135,7 @@ var Progress = (0, import_helpers.withStaticProperties)((0, import_core.createSt
|
|
|
136
135
|
"data-max": max,
|
|
137
136
|
size,
|
|
138
137
|
...progressProps,
|
|
139
|
-
...!import_core.isWeb && { onLayout: function(e) {
|
|
138
|
+
...!import_core.isWeb && { onLayout: function onLayout(e) {
|
|
140
139
|
var _progressProps_onLayout;
|
|
141
140
|
var newWidth = Math.round(e.nativeEvent.layout.width);
|
|
142
141
|
if (newWidth !== width) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progress.native.js","names":[],"sources":["cjs/Progress.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Progress_exports = {};\n__export(Progress_exports, {\n Progress: () => Progress,\n ProgressFrame: () => ProgressFrame,\n ProgressIndicator: () => ProgressIndicator,\n ProgressIndicatorFrame: () => ProgressIndicatorFrame,\n createProgressScope: () => createProgressScope\n});\nmodule.exports = __toCommonJS(Progress_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_core = require(\"@tamagui/core\");\nvar import_create_context = require(\"@tamagui/create-context\");\nvar import_get_token = require(\"@tamagui/get-token\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar import_stacks = require(\"@tamagui/stacks\");\nvar import_react = require(\"react\");\nvar PROGRESS_NAME = \"Progress\";\nvar [createProgressContext, createProgressScope] = (0, import_create_context.createContextScope)(PROGRESS_NAME);\nvar [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME);\nvar INDICATOR_NAME = \"ProgressIndicator\";\nvar ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: INDICATOR_NAME,\n height: \"100%\",\n width: \"100%\"\n});\nvar ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(props, forwardedRef) {\n var { __scopeProgress, transition, ...indicatorProps } = props;\n var context = useProgressContext(INDICATOR_NAME, __scopeProgress);\n var _context_value;\n var progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max;\n var x;\n if (import_core.isWeb) {\n x = `${-100 + progressRatio * 50}%`;\n } else {\n var baseWidth = context.width || 0;\n x = Math.ceil(-baseWidth * (2 - progressRatio));\n }\n var _context_value1;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressIndicatorFrame, {\n \"data-state\": getProgressState(context.value, context.max),\n \"data-value\": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,\n \"data-max\": context.max,\n x,\n width: \"200%\",\n ...!import_core.isWeb && context.width === 0 && {\n opacity: 0\n },\n ...indicatorProps,\n ref: forwardedRef,\n // only the indicator's slide transitions; `width` is a layout jump\n transition: !import_core.isWeb && !context.width ? null : {\n transform: transition\n }\n });\n});\nfunction defaultGetValueLabel(value, max) {\n return `${Math.round(value / max * 100)}%`;\n}\nfunction getProgressState(value, maxValue) {\n return value == null ? \"indeterminate\" : value === maxValue ? \"complete\" : \"loading\";\n}\nfunction isNumber(value) {\n return typeof value === \"number\";\n}\nfunction isValidMaxNumber(max) {\n return isNumber(max) && !Number.isNaN(max) && max > 0;\n}\nfunction isValidValueNumber(value, max) {\n return isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0;\n}\nvar DEFAULT_MAX = 100;\nvar progressTrackHeight = {\n xs: 4,\n sm: 6,\n md: 9,\n lg: 12,\n xl: 16\n};\nvar resolveProgressSize = function(val) {\n if (typeof val === \"string\" && val in progressTrackHeight) {\n return progressTrackHeight[val];\n }\n var resolved = Number((0, import_core.getVariableValue)((0, import_get_token.getSize)(val === true ? 36 : val)));\n var base = Number.isFinite(resolved) ? resolved : Number((0, import_core.getVariableValue)((0, import_get_token.getSize)(36)));\n return Math.round(base * 0.25);\n};\nvar getProgressSize = import_core.styled.dynamic(function(val) {\n var size = resolveProgressSize(val);\n return {\n height: size,\n minWidth: size * 20,\n width: \"100%\"\n };\n});\nvar ProgressFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: \"Progress\",\n overflow: \"hidden\",\n variants: {\n size: getProgressSize\n }\n});\nvar Progress = (0, import_helpers.withStaticProperties)((0, import_core.createStyledHOC)(ProgressFrame, function Progress2(props, forwardedRef) {\n var {\n // @ts-expect-error\n __scopeProgress,\n value: valueProp,\n max: maxProp,\n getValueLabel = defaultGetValueLabel,\n size = true,\n ...progressProps\n } = props;\n var max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;\n var value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;\n var valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0;\n var [width, setWidth] = (0, import_react.useState)(0);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressProvider, {\n scope: __scopeProgress,\n value,\n max,\n width,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressFrame, {\n \"aria-valuemax\": max,\n \"aria-valuemin\": 0,\n \"aria-valuenow\": isNumber(value) ? value : void 0,\n \"aria-valuetext\": valueLabel,\n // @ts-ignore\n role: \"progressbar\",\n \"data-state\": getProgressState(value, max),\n \"data-value\": value !== null && value !== void 0 ? value : void 0,\n \"data-max\": max,\n size,\n ...progressProps,\n ...!import_core.isWeb && {\n onLayout: function(e) {\n var _progressProps_onLayout;\n var newWidth = Math.round(e.nativeEvent.layout.width);\n if (newWidth !== width) {\n setWidth(newWidth);\n }\n (_progressProps_onLayout = progressProps.onLayout) === null || _progressProps_onLayout === void 0 ? void 0 : _progressProps_onLayout.call(progressProps, e);\n }\n },\n ref: forwardedRef\n })\n });\n}), {\n Indicator: ProgressIndicator\n});\n//# sourceMappingURL=Progress.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,mBAAmB,CAAC;AACxB,SAAS,kBAAkB;CACzB,gBAAgB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KAAK,IAAI,wBAAwB,KAAK,eAAe,CAAC;GAC5J,EACF;GACA,KAAK;EACP,CAAC;CACH,CAAC;AACH,CAAC,GAAG,EACF,WAAW,kBACb,CAAC"}
|
|
1
|
+
{"version":3,"file":"Progress.native.js","names":[],"sources":["cjs/Progress.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Progress_exports = {};\n__export(Progress_exports, {\n Progress: () => Progress,\n ProgressFrame: () => ProgressFrame,\n ProgressIndicator: () => ProgressIndicator,\n ProgressIndicatorFrame: () => ProgressIndicatorFrame,\n createProgressScope: () => createProgressScope\n});\nmodule.exports = __toCommonJS(Progress_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_core = require(\"@tamagui/core\");\nvar import_create_context = require(\"@tamagui/create-context\");\nvar import_get_token = require(\"@tamagui/get-token\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar import_stacks = require(\"@tamagui/stacks\");\nvar import_react = require(\"react\");\nvar PROGRESS_NAME = \"Progress\";\nvar [createProgressContext, createProgressScope] = (0, import_create_context.createContextScope)(PROGRESS_NAME);\nvar [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME);\nvar INDICATOR_NAME = \"ProgressIndicator\";\nvar ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: INDICATOR_NAME,\n height: \"100%\",\n width: \"100%\"\n});\nvar ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(props, forwardedRef) {\n var _context_value, _context_value1;\n var { __scopeProgress, transition, ...indicatorProps } = props;\n var context = useProgressContext(INDICATOR_NAME, __scopeProgress);\n var progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max;\n var x;\n if (import_core.isWeb) {\n x = `${-100 + progressRatio * 50}%`;\n } else {\n var baseWidth = context.width || 0;\n x = Math.ceil(-baseWidth * (2 - progressRatio));\n }\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressIndicatorFrame, {\n \"data-state\": getProgressState(context.value, context.max),\n \"data-value\": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,\n \"data-max\": context.max,\n x,\n width: \"200%\",\n ...!import_core.isWeb && context.width === 0 && {\n opacity: 0\n },\n ...indicatorProps,\n ref: forwardedRef,\n // only the indicator's slide transitions; `width` is a layout jump\n transition: !import_core.isWeb && !context.width ? null : {\n transform: transition\n }\n });\n});\nfunction defaultGetValueLabel(value, max) {\n return `${Math.round(value / max * 100)}%`;\n}\nfunction getProgressState(value, maxValue) {\n return value == null ? \"indeterminate\" : value === maxValue ? \"complete\" : \"loading\";\n}\nfunction isNumber(value) {\n return typeof value === \"number\";\n}\nfunction isValidMaxNumber(max) {\n return isNumber(max) && !Number.isNaN(max) && max > 0;\n}\nfunction isValidValueNumber(value, max) {\n return isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0;\n}\nvar DEFAULT_MAX = 100;\nvar progressTrackHeight = {\n xs: 4,\n sm: 6,\n md: 9,\n lg: 12,\n xl: 16\n};\nvar resolveProgressSize = function resolveProgressSize2(val) {\n if (typeof val === \"string\" && val in progressTrackHeight) {\n return progressTrackHeight[val];\n }\n var resolved = Number((0, import_core.getVariableValue)((0, import_get_token.getSize)(val === true ? 36 : val)));\n var base = Number.isFinite(resolved) ? resolved : Number((0, import_core.getVariableValue)((0, import_get_token.getSize)(36)));\n return Math.round(base * 0.25);\n};\nvar getProgressSize = import_core.styled.dynamic(function(val) {\n var size = resolveProgressSize(val);\n return {\n height: size,\n minWidth: size * 20,\n width: \"100%\"\n };\n});\nvar ProgressFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: \"Progress\",\n overflow: \"hidden\",\n variants: {\n size: getProgressSize\n }\n});\nvar Progress = (0, import_helpers.withStaticProperties)((0, import_core.createStyledHOC)(ProgressFrame, function Progress2(props, forwardedRef) {\n var {\n // @ts-expect-error\n __scopeProgress,\n value: valueProp,\n max: maxProp,\n getValueLabel = defaultGetValueLabel,\n size = true,\n ...progressProps\n } = props;\n var max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;\n var value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;\n var valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0;\n var [width, setWidth] = (0, import_react.useState)(0);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressProvider, {\n scope: __scopeProgress,\n value,\n max,\n width,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressFrame, {\n \"aria-valuemax\": max,\n \"aria-valuemin\": 0,\n \"aria-valuenow\": isNumber(value) ? value : void 0,\n \"aria-valuetext\": valueLabel,\n // @ts-ignore\n role: \"progressbar\",\n \"data-state\": getProgressState(value, max),\n \"data-value\": value !== null && value !== void 0 ? value : void 0,\n \"data-max\": max,\n size,\n ...progressProps,\n ...!import_core.isWeb && {\n onLayout: function onLayout(e) {\n var _progressProps_onLayout;\n var newWidth = Math.round(e.nativeEvent.layout.width);\n if (newWidth !== width) {\n setWidth(newWidth);\n }\n (_progressProps_onLayout = progressProps.onLayout) === null || _progressProps_onLayout === void 0 ? void 0 : _progressProps_onLayout.call(progressProps, e);\n }\n },\n ref: forwardedRef\n })\n });\n}), {\n Indicator: ProgressIndicator\n});\n//# sourceMappingURL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AAW,GAAG,IAAI,KAAK,MAAM,SAAS,IAAI;CACzE,IAAI,aAAa,SAAS,KAAK,IAAI,cAAc,OAAO,GAAG,IAAI,KAAK;CACpE,IAAI,CAAC,OAAO,aAAa,GAAG,aAAa,SAAQ,CAAE,CAAC;CACpD,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,kBAAkB;EACnE,OAAO;EACP;EACA;EACA;EACA,UAA0B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,eAAe;GACnE,iBAAiB;GACjB,iBAAiB;GACjB,iBAAiB,SAAS,KAAK,IAAI,QAAQ,KAAK;GAChD,kBAAkB;GAElB,MAAM;GACN,cAAc,iBAAiB,OAAO,GAAG;GACzC,cAAc,UAAU,QAAQ,UAAU,KAAK,IAAI,QAAQ,KAAK;GAChE,YAAY;GACZ;GACA,GAAG;GACH,GAAG,CAAC,YAAY,SAAS,EACvB,UAAU,SAAS,SAAS,GAAG;IAC7B,IAAI;IACJ,IAAI,WAAW,KAAK,MAAM,EAAE,YAAY,OAAO,KAAK;IACpD,IAAI,aAAa,OAAO;KACtB,SAAS,QAAQ;IACnB;IACA,CAAC,0BAA0B,cAAc,cAAc,QAAQ,4BAA4B,KAAK,IAAI,KAAK,IAAI,wBAAwB,KAAK,eAAe,CAAC;GAC5J,EACF;GACA,KAAK;EACP,CAAC;CACH,CAAC;AACH,CAAC,GAAG,EACF,WAAW,kBACb,CAAC"}
|
|
@@ -16,9 +16,9 @@ var ProgressIndicatorFrame = styled(YStack, {
|
|
|
16
16
|
width: "100%"
|
|
17
17
|
});
|
|
18
18
|
var ProgressIndicator = createStyledHOC(ProgressIndicatorFrame, function ProgressIndicator2(props, forwardedRef) {
|
|
19
|
+
var _context_value, _context_value1;
|
|
19
20
|
var { __scopeProgress, transition, ...indicatorProps } = props;
|
|
20
21
|
var context = useProgressContext(INDICATOR_NAME, __scopeProgress);
|
|
21
|
-
var _context_value;
|
|
22
22
|
var progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max;
|
|
23
23
|
var x;
|
|
24
24
|
if (isWeb) {
|
|
@@ -27,7 +27,6 @@ var ProgressIndicator = createStyledHOC(ProgressIndicatorFrame, function Progres
|
|
|
27
27
|
var baseWidth = context.width || 0;
|
|
28
28
|
x = Math.ceil(-baseWidth * (2 - progressRatio));
|
|
29
29
|
}
|
|
30
|
-
var _context_value1;
|
|
31
30
|
return /* @__PURE__ */ jsx(ProgressIndicatorFrame, {
|
|
32
31
|
"data-state": getProgressState(context.value, context.max),
|
|
33
32
|
"data-value": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,
|
|
@@ -63,7 +62,7 @@ var progressTrackHeight = {
|
|
|
63
62
|
lg: 12,
|
|
64
63
|
xl: 16
|
|
65
64
|
};
|
|
66
|
-
var resolveProgressSize = function(val) {
|
|
65
|
+
var resolveProgressSize = function resolveProgressSize2(val) {
|
|
67
66
|
if (typeof val === "string" && val in progressTrackHeight) {
|
|
68
67
|
return progressTrackHeight[val];
|
|
69
68
|
}
|
|
@@ -106,7 +105,7 @@ var Progress = withStaticProperties(createStyledHOC(ProgressFrame, function Prog
|
|
|
106
105
|
"data-max": max,
|
|
107
106
|
size,
|
|
108
107
|
...progressProps,
|
|
109
|
-
...!isWeb && { onLayout: function(e) {
|
|
108
|
+
...!isWeb && { onLayout: function onLayout(e) {
|
|
110
109
|
var _progressProps_onLayout;
|
|
111
110
|
var newWidth = Math.round(e.nativeEvent.layout.width);
|
|
112
111
|
if (newWidth !== width) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progress.native.js","names":[],"sources":["esm/Progress.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { createStyledHOC, getVariableValue, isWeb, styled } from \"@tamagui/core\";\nimport { createContextScope } from \"@tamagui/create-context\";\nimport { getSize } from \"@tamagui/get-token\";\nimport { withStaticProperties } from \"@tamagui/helpers\";\nimport { YStack } from \"@tamagui/stacks\";\nimport { useState } from \"react\";\nvar PROGRESS_NAME = \"Progress\";\nvar [createProgressContext, createProgressScope] = createContextScope(PROGRESS_NAME);\nvar [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME);\nvar INDICATOR_NAME = \"ProgressIndicator\";\nvar ProgressIndicatorFrame = styled(YStack, {\n displayName: INDICATOR_NAME,\n height: \"100%\",\n width: \"100%\"\n});\nvar ProgressIndicator = createStyledHOC(ProgressIndicatorFrame, function ProgressIndicator2(props, forwardedRef) {\n var { __scopeProgress, transition, ...indicatorProps } = props;\n var context = useProgressContext(INDICATOR_NAME, __scopeProgress);\n var
|
|
1
|
+
{"version":3,"file":"Progress.native.js","names":[],"sources":["esm/Progress.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { createStyledHOC, getVariableValue, isWeb, styled } from \"@tamagui/core\";\nimport { createContextScope } from \"@tamagui/create-context\";\nimport { getSize } from \"@tamagui/get-token\";\nimport { withStaticProperties } from \"@tamagui/helpers\";\nimport { YStack } from \"@tamagui/stacks\";\nimport { useState } from \"react\";\nvar PROGRESS_NAME = \"Progress\";\nvar [createProgressContext, createProgressScope] = createContextScope(PROGRESS_NAME);\nvar [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME);\nvar INDICATOR_NAME = \"ProgressIndicator\";\nvar ProgressIndicatorFrame = styled(YStack, {\n displayName: INDICATOR_NAME,\n height: \"100%\",\n width: \"100%\"\n});\nvar ProgressIndicator = createStyledHOC(ProgressIndicatorFrame, function ProgressIndicator2(props, forwardedRef) {\n var _context_value, _context_value1;\n var { __scopeProgress, transition, ...indicatorProps } = props;\n var context = useProgressContext(INDICATOR_NAME, __scopeProgress);\n var progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max;\n var x;\n if (isWeb) {\n x = `${-100 + progressRatio * 50}%`;\n } else {\n var baseWidth = context.width || 0;\n x = Math.ceil(-baseWidth * (2 - progressRatio));\n }\n return /* @__PURE__ */ _jsx(ProgressIndicatorFrame, {\n \"data-state\": getProgressState(context.value, context.max),\n \"data-value\": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,\n \"data-max\": context.max,\n x,\n width: \"200%\",\n ...!isWeb && context.width === 0 && {\n opacity: 0\n },\n ...indicatorProps,\n ref: forwardedRef,\n // only the indicator's slide transitions; `width` is a layout jump\n transition: !isWeb && !context.width ? null : {\n transform: transition\n }\n });\n});\nfunction defaultGetValueLabel(value, max) {\n return `${Math.round(value / max * 100)}%`;\n}\nfunction getProgressState(value, maxValue) {\n return value == null ? \"indeterminate\" : value === maxValue ? \"complete\" : \"loading\";\n}\nfunction isNumber(value) {\n return typeof value === \"number\";\n}\nfunction isValidMaxNumber(max) {\n return isNumber(max) && !Number.isNaN(max) && max > 0;\n}\nfunction isValidValueNumber(value, max) {\n return isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0;\n}\nvar DEFAULT_MAX = 100;\nvar progressTrackHeight = {\n xs: 4,\n sm: 6,\n md: 9,\n lg: 12,\n xl: 16\n};\nvar resolveProgressSize = function resolveProgressSize2(val) {\n if (typeof val === \"string\" && val in progressTrackHeight) {\n return progressTrackHeight[val];\n }\n var resolved = Number(getVariableValue(getSize(val === true ? 36 : val)));\n var base = Number.isFinite(resolved) ? resolved : Number(getVariableValue(getSize(36)));\n return Math.round(base * 0.25);\n};\nvar getProgressSize = styled.dynamic(function(val) {\n var size = resolveProgressSize(val);\n return {\n height: size,\n minWidth: size * 20,\n width: \"100%\"\n };\n});\nvar ProgressFrame = styled(YStack, {\n displayName: \"Progress\",\n overflow: \"hidden\",\n variants: {\n size: getProgressSize\n }\n});\nvar Progress = withStaticProperties(createStyledHOC(ProgressFrame, function Progress2(props, forwardedRef) {\n var {\n // @ts-expect-error\n __scopeProgress,\n value: valueProp,\n max: maxProp,\n getValueLabel = defaultGetValueLabel,\n size = true,\n ...progressProps\n } = props;\n var max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;\n var value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;\n var valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0;\n var [width, setWidth] = useState(0);\n return /* @__PURE__ */ _jsx(ProgressProvider, {\n scope: __scopeProgress,\n value,\n max,\n width,\n children: /* @__PURE__ */ _jsx(ProgressFrame, {\n \"aria-valuemax\": max,\n \"aria-valuemin\": 0,\n \"aria-valuenow\": isNumber(value) ? value : void 0,\n \"aria-valuetext\": valueLabel,\n // @ts-ignore\n role: \"progressbar\",\n \"data-state\": getProgressState(value, max),\n \"data-value\": value !== null && value !== void 0 ? value : void 0,\n \"data-max\": max,\n size,\n ...progressProps,\n ...!isWeb && {\n onLayout: function onLayout(e) {\n var _progressProps_onLayout;\n var newWidth = Math.round(e.nativeEvent.layout.width);\n if (newWidth !== width) {\n setWidth(newWidth);\n }\n (_progressProps_onLayout = progressProps.onLayout) === null || _progressProps_onLayout === void 0 ? void 0 : _progressProps_onLayout.call(progressProps, e);\n }\n },\n ref: forwardedRef\n })\n });\n}), {\n Indicator: ProgressIndicator\n});\nexport {\n Progress,\n ProgressFrame,\n ProgressIndicator,\n ProgressIndicatorFrame,\n createProgressScope\n};\n//# sourceMappingURL=Progress.js.map\n"],"mappings":";;;;;;;;;AAOA,IAAI,gBAAgB;AACpB,IAAI,CAAC,uBAAuB,uBAAuB,mBAAmB,aAAa;AACnF,IAAI,CAAC,kBAAkB,sBAAsB,sBAAsB,aAAa;AAChF,IAAI,iBAAiB;AACrB,IAAI,yBAAyB,OAAO,QAAQ;CAC1C,aAAa;CACb,QAAQ;CACR,OAAO;AACT,CAAC;AACD,IAAI,oBAAoB,gBAAgB,wBAAwB,SAAS,mBAAmB,OAAO,cAAc;CAC/G,IAAI,gBAAgB;CACpB,IAAI,EAAE,iBAAiB,YAAY,GAAG,mBAAmB;CACzD,IAAI,UAAU,mBAAmB,gBAAgB,eAAe;CAChE,IAAI,kBAAkB,iBAAiB,QAAQ,WAAW,QAAQ,mBAAmB,KAA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;IACpD,IAAI,aAAa,OAAO;KACtB,SAAS,QAAQ;IACnB;IACA,CAAC,0BAA0B,cAAc,cAAc,QAAQ,4BAA4B,KAAK,IAAI,KAAK,IAAI,wBAAwB,KAAK,eAAe,CAAC;GAC5J,EACF;GACA,KAAK;EACP,CAAC;CACH,CAAC;AACH,CAAC,GAAG,EACF,WAAW,kBACb,CAAC"}
|
|
@@ -46,9 +46,9 @@ var ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
|
46
46
|
width: "100%"
|
|
47
47
|
});
|
|
48
48
|
var ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(props, forwardedRef) {
|
|
49
|
+
var _context_value, _context_value1;
|
|
49
50
|
var { __scopeProgress, transition, ...indicatorProps } = props;
|
|
50
51
|
var context = useProgressContext(INDICATOR_NAME, __scopeProgress);
|
|
51
|
-
var _context_value;
|
|
52
52
|
var progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max;
|
|
53
53
|
var x;
|
|
54
54
|
if (import_core.isWeb) {
|
|
@@ -57,7 +57,6 @@ var ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame,
|
|
|
57
57
|
var baseWidth = context.width || 0;
|
|
58
58
|
x = Math.ceil(-baseWidth * (2 - progressRatio));
|
|
59
59
|
}
|
|
60
|
-
var _context_value1;
|
|
61
60
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressIndicatorFrame, {
|
|
62
61
|
"data-state": getProgressState(context.value, context.max),
|
|
63
62
|
"data-value": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,
|
|
@@ -93,7 +92,7 @@ var progressTrackHeight = {
|
|
|
93
92
|
lg: 12,
|
|
94
93
|
xl: 16
|
|
95
94
|
};
|
|
96
|
-
var resolveProgressSize = function(val) {
|
|
95
|
+
var resolveProgressSize = function resolveProgressSize2(val) {
|
|
97
96
|
if (typeof val === "string" && val in progressTrackHeight) {
|
|
98
97
|
return progressTrackHeight[val];
|
|
99
98
|
}
|
|
@@ -136,7 +135,7 @@ var Progress = (0, import_helpers.withStaticProperties)((0, import_core.createSt
|
|
|
136
135
|
"data-max": max,
|
|
137
136
|
size,
|
|
138
137
|
...progressProps,
|
|
139
|
-
...!import_core.isWeb && { onLayout: function(e) {
|
|
138
|
+
...!import_core.isWeb && { onLayout: function onLayout(e) {
|
|
140
139
|
var _progressProps_onLayout;
|
|
141
140
|
var newWidth = Math.round(e.nativeEvent.layout.width);
|
|
142
141
|
if (newWidth !== width) {
|
|
@@ -46,9 +46,9 @@ var ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
|
46
46
|
width: "100%"
|
|
47
47
|
});
|
|
48
48
|
var ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(props, forwardedRef) {
|
|
49
|
+
var _context_value, _context_value1;
|
|
49
50
|
var { __scopeProgress, transition, ...indicatorProps } = props;
|
|
50
51
|
var context = useProgressContext(INDICATOR_NAME, __scopeProgress);
|
|
51
|
-
var _context_value;
|
|
52
52
|
var progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max;
|
|
53
53
|
var x;
|
|
54
54
|
if (import_core.isWeb) {
|
|
@@ -57,7 +57,6 @@ var ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame,
|
|
|
57
57
|
var baseWidth = context.width || 0;
|
|
58
58
|
x = Math.ceil(-baseWidth * (2 - progressRatio));
|
|
59
59
|
}
|
|
60
|
-
var _context_value1;
|
|
61
60
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressIndicatorFrame, {
|
|
62
61
|
"data-state": getProgressState(context.value, context.max),
|
|
63
62
|
"data-value": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,
|
|
@@ -93,7 +92,7 @@ var progressTrackHeight = {
|
|
|
93
92
|
lg: 12,
|
|
94
93
|
xl: 16
|
|
95
94
|
};
|
|
96
|
-
var resolveProgressSize = function(val) {
|
|
95
|
+
var resolveProgressSize = function resolveProgressSize2(val) {
|
|
97
96
|
if (typeof val === "string" && val in progressTrackHeight) {
|
|
98
97
|
return progressTrackHeight[val];
|
|
99
98
|
}
|
|
@@ -136,7 +135,7 @@ var Progress = (0, import_helpers.withStaticProperties)((0, import_core.createSt
|
|
|
136
135
|
"data-max": max,
|
|
137
136
|
size,
|
|
138
137
|
...progressProps,
|
|
139
|
-
...!import_core.isWeb && { onLayout: function(e) {
|
|
138
|
+
...!import_core.isWeb && { onLayout: function onLayout(e) {
|
|
140
139
|
var _progressProps_onLayout;
|
|
141
140
|
var newWidth = Math.round(e.nativeEvent.layout.width);
|
|
142
141
|
if (newWidth !== width) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progress.native.js","names":[],"sources":["jsx/Progress.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Progress_exports = {};\n__export(Progress_exports, {\n Progress: () => Progress,\n ProgressFrame: () => ProgressFrame,\n ProgressIndicator: () => ProgressIndicator,\n ProgressIndicatorFrame: () => ProgressIndicatorFrame,\n createProgressScope: () => createProgressScope\n});\nmodule.exports = __toCommonJS(Progress_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_core = require(\"@tamagui/core\");\nvar import_create_context = require(\"@tamagui/create-context\");\nvar import_get_token = require(\"@tamagui/get-token\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar import_stacks = require(\"@tamagui/stacks\");\nvar import_react = require(\"react\");\nvar PROGRESS_NAME = \"Progress\";\nvar [createProgressContext, createProgressScope] = (0, import_create_context.createContextScope)(PROGRESS_NAME);\nvar [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME);\nvar INDICATOR_NAME = \"ProgressIndicator\";\nvar ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: INDICATOR_NAME,\n height: \"100%\",\n width: \"100%\"\n});\nvar ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(props, forwardedRef) {\n var { __scopeProgress, transition, ...indicatorProps } = props;\n var context = useProgressContext(INDICATOR_NAME, __scopeProgress);\n var _context_value;\n var progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max;\n var x;\n if (import_core.isWeb) {\n x = `${-100 + progressRatio * 50}%`;\n } else {\n var baseWidth = context.width || 0;\n x = Math.ceil(-baseWidth * (2 - progressRatio));\n }\n var _context_value1;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressIndicatorFrame, {\n \"data-state\": getProgressState(context.value, context.max),\n \"data-value\": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,\n \"data-max\": context.max,\n x,\n width: \"200%\",\n ...!import_core.isWeb && context.width === 0 && {\n opacity: 0\n },\n ...indicatorProps,\n ref: forwardedRef,\n // only the indicator's slide transitions; `width` is a layout jump\n transition: !import_core.isWeb && !context.width ? null : {\n transform: transition\n }\n });\n});\nfunction defaultGetValueLabel(value, max) {\n return `${Math.round(value / max * 100)}%`;\n}\nfunction getProgressState(value, maxValue) {\n return value == null ? \"indeterminate\" : value === maxValue ? \"complete\" : \"loading\";\n}\nfunction isNumber(value) {\n return typeof value === \"number\";\n}\nfunction isValidMaxNumber(max) {\n return isNumber(max) && !Number.isNaN(max) && max > 0;\n}\nfunction isValidValueNumber(value, max) {\n return isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0;\n}\nvar DEFAULT_MAX = 100;\nvar progressTrackHeight = {\n xs: 4,\n sm: 6,\n md: 9,\n lg: 12,\n xl: 16\n};\nvar resolveProgressSize = function(val) {\n if (typeof val === \"string\" && val in progressTrackHeight) {\n return progressTrackHeight[val];\n }\n var resolved = Number((0, import_core.getVariableValue)((0, import_get_token.getSize)(val === true ? 36 : val)));\n var base = Number.isFinite(resolved) ? resolved : Number((0, import_core.getVariableValue)((0, import_get_token.getSize)(36)));\n return Math.round(base * 0.25);\n};\nvar getProgressSize = import_core.styled.dynamic(function(val) {\n var size = resolveProgressSize(val);\n return {\n height: size,\n minWidth: size * 20,\n width: \"100%\"\n };\n});\nvar ProgressFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: \"Progress\",\n overflow: \"hidden\",\n variants: {\n size: getProgressSize\n }\n});\nvar Progress = (0, import_helpers.withStaticProperties)((0, import_core.createStyledHOC)(ProgressFrame, function Progress2(props, forwardedRef) {\n var {\n // @ts-expect-error\n __scopeProgress,\n value: valueProp,\n max: maxProp,\n getValueLabel = defaultGetValueLabel,\n size = true,\n ...progressProps\n } = props;\n var max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;\n var value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;\n var valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0;\n var [width, setWidth] = (0, import_react.useState)(0);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressProvider, {\n scope: __scopeProgress,\n value,\n max,\n width,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressFrame, {\n \"aria-valuemax\": max,\n \"aria-valuemin\": 0,\n \"aria-valuenow\": isNumber(value) ? value : void 0,\n \"aria-valuetext\": valueLabel,\n // @ts-ignore\n role: \"progressbar\",\n \"data-state\": getProgressState(value, max),\n \"data-value\": value !== null && value !== void 0 ? value : void 0,\n \"data-max\": max,\n size,\n ...progressProps,\n ...!import_core.isWeb && {\n onLayout: function(e) {\n var _progressProps_onLayout;\n var newWidth = Math.round(e.nativeEvent.layout.width);\n if (newWidth !== width) {\n setWidth(newWidth);\n }\n (_progressProps_onLayout = progressProps.onLayout) === null || _progressProps_onLayout === void 0 ? void 0 : _progressProps_onLayout.call(progressProps, e);\n }\n },\n ref: forwardedRef\n })\n });\n}), {\n Indicator: ProgressIndicator\n});\n//# sourceMappingURL=Progress.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,mBAAmB,CAAC;AACxB,SAAS,kBAAkB;CACzB,gBAAgB;CAChB,qBAAqB;CACrB,yBAAyB;CACzB,8BAA8B;CAC9B,2BAA2B;AAC7B,CAAC;AACD,OAAO,UAAU,aAAa,gBAAgB;AAC9C,IAAI,q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AC"}
|
|
1
|
+
{"version":3,"file":"Progress.native.js","names":[],"sources":["jsx/Progress.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Progress_exports = {};\n__export(Progress_exports, {\n Progress: () => Progress,\n ProgressFrame: () => ProgressFrame,\n ProgressIndicator: () => ProgressIndicator,\n ProgressIndicatorFrame: () => ProgressIndicatorFrame,\n createProgressScope: () => createProgressScope\n});\nmodule.exports = __toCommonJS(Progress_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_core = require(\"@tamagui/core\");\nvar import_create_context = require(\"@tamagui/create-context\");\nvar import_get_token = require(\"@tamagui/get-token\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar import_stacks = require(\"@tamagui/stacks\");\nvar import_react = require(\"react\");\nvar PROGRESS_NAME = \"Progress\";\nvar [createProgressContext, createProgressScope] = (0, import_create_context.createContextScope)(PROGRESS_NAME);\nvar [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME);\nvar INDICATOR_NAME = \"ProgressIndicator\";\nvar ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: INDICATOR_NAME,\n height: \"100%\",\n width: \"100%\"\n});\nvar ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(props, forwardedRef) {\n var _context_value, _context_value1;\n var { __scopeProgress, transition, ...indicatorProps } = props;\n var context = useProgressContext(INDICATOR_NAME, __scopeProgress);\n var progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max;\n var x;\n if (import_core.isWeb) {\n x = `${-100 + progressRatio * 50}%`;\n } else {\n var baseWidth = context.width || 0;\n x = Math.ceil(-baseWidth * (2 - progressRatio));\n }\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressIndicatorFrame, {\n \"data-state\": getProgressState(context.value, context.max),\n \"data-value\": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,\n \"data-max\": context.max,\n x,\n width: \"200%\",\n ...!import_core.isWeb && context.width === 0 && {\n opacity: 0\n },\n ...indicatorProps,\n ref: forwardedRef,\n // only the indicator's slide transitions; `width` is a layout jump\n transition: !import_core.isWeb && !context.width ? null : {\n transform: transition\n }\n });\n});\nfunction defaultGetValueLabel(value, max) {\n return `${Math.round(value / max * 100)}%`;\n}\nfunction getProgressState(value, maxValue) {\n return value == null ? \"indeterminate\" : value === maxValue ? \"complete\" : \"loading\";\n}\nfunction isNumber(value) {\n return typeof value === \"number\";\n}\nfunction isValidMaxNumber(max) {\n return isNumber(max) && !Number.isNaN(max) && max > 0;\n}\nfunction isValidValueNumber(value, max) {\n return isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0;\n}\nvar DEFAULT_MAX = 100;\nvar progressTrackHeight = {\n xs: 4,\n sm: 6,\n md: 9,\n lg: 12,\n xl: 16\n};\nvar resolveProgressSize = function resolveProgressSize2(val) {\n if (typeof val === \"string\" && val in progressTrackHeight) {\n return progressTrackHeight[val];\n }\n var resolved = Number((0, import_core.getVariableValue)((0, import_get_token.getSize)(val === true ? 36 : val)));\n var base = Number.isFinite(resolved) ? resolved : Number((0, import_core.getVariableValue)((0, import_get_token.getSize)(36)));\n return Math.round(base * 0.25);\n};\nvar getProgressSize = import_core.styled.dynamic(function(val) {\n var size = resolveProgressSize(val);\n return {\n height: size,\n minWidth: size * 20,\n width: \"100%\"\n };\n});\nvar ProgressFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: \"Progress\",\n overflow: \"hidden\",\n variants: {\n size: getProgressSize\n }\n});\nvar Progress = (0, import_helpers.withStaticProperties)((0, import_core.createStyledHOC)(ProgressFrame, function Progress2(props, forwardedRef) {\n var {\n // @ts-expect-error\n __scopeProgress,\n value: valueProp,\n max: maxProp,\n getValueLabel = defaultGetValueLabel,\n size = true,\n ...progressProps\n } = props;\n var max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;\n var value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;\n var valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0;\n var [width, setWidth] = (0, import_react.useState)(0);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressProvider, {\n scope: __scopeProgress,\n value,\n max,\n width,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressFrame, {\n \"aria-valuemax\": max,\n \"aria-valuemin\": 0,\n \"aria-valuenow\": isNumber(value) ? value : void 0,\n \"aria-valuetext\": valueLabel,\n // @ts-ignore\n role: \"progressbar\",\n \"data-state\": getProgressState(value, max),\n \"data-value\": value !== null && value !== void 0 ? value : void 0,\n \"data-max\": max,\n size,\n ...progressProps,\n ...!import_core.isWeb && {\n onLayout: function onLayout(e) {\n var _progressProps_onLayout;\n var newWidth = Math.round(e.nativeEvent.layout.width);\n if (newWidth !== width) {\n setWidth(newWidth);\n }\n (_progressProps_onLayout = progressProps.onLayout) === null || _progressProps_onLayout === void 0 ? void 0 : _progressProps_onLayout.call(progressProps, e);\n }\n },\n ref: forwardedRef\n })\n });\n}), {\n Indicator: ProgressIndicator\n});\n//# sourceMappingURL=Progress.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe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CAAC,OAAO,aAAa,GAAG,aAAa,SAAQ,CAAE,CAAC;CACpD,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,kBAAkB;EACnE,OAAO;EACP;EACA;EACA;EACA,UAA0B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,eAAe;GACnE,iBAAiB;GACjB,iBAAiB;GACjB,iBAAiB,SAAS,KAAK,IAAI,QAAQ,KAAK;GAChD,kBAAkB;GAElB,MAAM;GACN,cAAc,iBAAiB,OAAO,GAAG;GACzC,cAAc,UAAU,QAAQ,UAAU,KAAK,IAAI,QAAQ,KAAK;GAChE,YAAY;GACZ;GACA,GAAG;GACH,GAAG,CAAC,YAAY,SAAS,EACvB,UAAU,SAAS,SAAS,GAAG;IAC7B,IAAI;IACJ,IAAI,WAAW,KAAK,MAAM,EAAE,YAAY,OAAO,KAAK;IACpD,IAAI,aAAa,OAAO;KACtB,SAAS,QAAQ;IACnB;IACA,CAAC,0BAA0B,cAAc,cAAc,QAAQ,4BAA4B,KAAK,IAAI,KAAK,IAAI,wBAAwB,KAAK,eAAe,CAAC;GAC5J,EACF;GACA,KAAK;EACP,CAAC;CACH,CAAC;AACH,CAAC,GAAG,EACF,WAAW,kBACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/progress",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
"clean:build": "tamagui-build clean:build"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@tamagui/compose-refs": "3.0.
|
|
39
|
-
"@tamagui/core": "3.0.
|
|
40
|
-
"@tamagui/create-context": "3.0.
|
|
41
|
-
"@tamagui/get-token": "3.0.
|
|
42
|
-
"@tamagui/helpers": "3.0.
|
|
43
|
-
"@tamagui/stacks": "3.0.
|
|
38
|
+
"@tamagui/compose-refs": "3.0.8",
|
|
39
|
+
"@tamagui/core": "3.0.8",
|
|
40
|
+
"@tamagui/create-context": "3.0.8",
|
|
41
|
+
"@tamagui/get-token": "3.0.8",
|
|
42
|
+
"@tamagui/helpers": "3.0.8",
|
|
43
|
+
"@tamagui/stacks": "3.0.8"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@tamagui/build": "3.0.
|
|
46
|
+
"@tamagui/build": "3.0.8",
|
|
47
47
|
"react": "19.2.3",
|
|
48
48
|
"react-native": "0.87.1"
|
|
49
49
|
},
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"url": "git+https://github.com/tamagui/tamagui.git",
|
|
57
57
|
"directory": "code/ui/progress"
|
|
58
58
|
},
|
|
59
|
-
"releaseSourceCommit": "
|
|
59
|
+
"releaseSourceCommit": "b723356193510591d9ad15877b8937e8e6a31910"
|
|
60
60
|
}
|