@tamagui/progress 3.0.17 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Progress.cjs +4 -2
- package/dist/cjs/Progress.native.cjs +4 -2
- package/dist/cjs/Progress.native.js +4 -2
- package/dist/cjs/Progress.native.js.map +1 -1
- package/dist/esm/Progress.mjs +4 -2
- package/dist/esm/Progress.mjs.map +1 -1
- package/dist/esm/Progress.native.js +4 -2
- package/dist/esm/Progress.native.js.map +1 -1
- package/dist/jsx/Progress.mjs +4 -2
- package/dist/jsx/Progress.mjs.map +1 -1
- package/dist/jsx/Progress.native.cjs +4 -2
- package/dist/jsx/Progress.native.js +4 -2
- package/dist/jsx/Progress.native.js.map +1 -1
- package/package.json +11 -11
- package/src/Progress.tsx +51 -47
- package/types/Progress.d.ts +12 -36
- package/types/Progress.d.ts.map +1 -1
package/dist/cjs/Progress.cjs
CHANGED
|
@@ -43,7 +43,8 @@ const ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
|
43
43
|
height: "100%",
|
|
44
44
|
width: "100%"
|
|
45
45
|
});
|
|
46
|
-
const ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(
|
|
46
|
+
const ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(propsIn, forwardedRef) {
|
|
47
|
+
const props = propsIn;
|
|
47
48
|
const { __scopeProgress, transition, ...indicatorProps } = props;
|
|
48
49
|
const context = useProgressContext(INDICATOR_NAME, __scopeProgress);
|
|
49
50
|
const progressRatio = (context.value ?? 0) / context.max;
|
|
@@ -110,7 +111,8 @@ const ProgressFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
|
110
111
|
overflow: "hidden",
|
|
111
112
|
variants: { size: getProgressSize }
|
|
112
113
|
});
|
|
113
|
-
const Progress = (0, import_helpers.withStaticProperties)((0, import_core.createStyledHOC)(ProgressFrame, function Progress2(
|
|
114
|
+
const Progress = (0, import_helpers.withStaticProperties)((0, import_core.createStyledHOC)(ProgressFrame, function Progress2(propsIn, forwardedRef) {
|
|
115
|
+
const props = propsIn;
|
|
114
116
|
const { __scopeProgress, value: valueProp, max: maxProp, getValueLabel = defaultGetValueLabel, size = true, ...progressProps } = props;
|
|
115
117
|
const max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;
|
|
116
118
|
const value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;
|
|
@@ -45,8 +45,9 @@ var ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
|
45
45
|
height: "100%",
|
|
46
46
|
width: "100%"
|
|
47
47
|
});
|
|
48
|
-
var ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(
|
|
48
|
+
var ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(propsIn, forwardedRef) {
|
|
49
49
|
var _context_value, _context_value1;
|
|
50
|
+
var props = propsIn;
|
|
50
51
|
var { __scopeProgress, transition, ...indicatorProps } = props;
|
|
51
52
|
var context = useProgressContext(INDICATOR_NAME, __scopeProgress);
|
|
52
53
|
var progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max;
|
|
@@ -113,7 +114,8 @@ var ProgressFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
|
113
114
|
overflow: "hidden",
|
|
114
115
|
variants: { size: getProgressSize }
|
|
115
116
|
});
|
|
116
|
-
var Progress = (0, import_helpers.withStaticProperties)((0, import_core.createStyledHOC)(ProgressFrame, function Progress2(
|
|
117
|
+
var Progress = (0, import_helpers.withStaticProperties)((0, import_core.createStyledHOC)(ProgressFrame, function Progress2(propsIn, forwardedRef) {
|
|
118
|
+
var props = propsIn;
|
|
117
119
|
var { __scopeProgress, value: valueProp, max: maxProp, getValueLabel = defaultGetValueLabel, size = true, ...progressProps } = props;
|
|
118
120
|
var max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;
|
|
119
121
|
var value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;
|
|
@@ -45,8 +45,9 @@ var ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
|
45
45
|
height: "100%",
|
|
46
46
|
width: "100%"
|
|
47
47
|
});
|
|
48
|
-
var ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(
|
|
48
|
+
var ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(propsIn, forwardedRef) {
|
|
49
49
|
var _context_value, _context_value1;
|
|
50
|
+
var props = propsIn;
|
|
50
51
|
var { __scopeProgress, transition, ...indicatorProps } = props;
|
|
51
52
|
var context = useProgressContext(INDICATOR_NAME, __scopeProgress);
|
|
52
53
|
var progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max;
|
|
@@ -113,7 +114,8 @@ var ProgressFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
|
113
114
|
overflow: "hidden",
|
|
114
115
|
variants: { size: getProgressSize }
|
|
115
116
|
});
|
|
116
|
-
var Progress = (0, import_helpers.withStaticProperties)((0, import_core.createStyledHOC)(ProgressFrame, function Progress2(
|
|
117
|
+
var Progress = (0, import_helpers.withStaticProperties)((0, import_core.createStyledHOC)(ProgressFrame, function Progress2(propsIn, forwardedRef) {
|
|
118
|
+
var props = propsIn;
|
|
117
119
|
var { __scopeProgress, value: valueProp, max: maxProp, getValueLabel = defaultGetValueLabel, size = true, ...progressProps } = props;
|
|
118
120
|
var max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;
|
|
119
121
|
var value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;
|
|
@@ -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 _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,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,K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;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"}
|
|
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(propsIn, forwardedRef) {\n var _context_value, _context_value1;\n var props = propsIn;\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(propsIn, forwardedRef) {\n var props = propsIn;\n var { __scopeProgress, value: valueProp, max: maxProp, getValueLabel = defaultGetValueLabel, size = true, ...progressProps } = 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,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,mBAAm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D,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/dist/esm/Progress.mjs
CHANGED
|
@@ -15,7 +15,8 @@ const ProgressIndicatorFrame = styled(YStack, {
|
|
|
15
15
|
height: "100%",
|
|
16
16
|
width: "100%"
|
|
17
17
|
});
|
|
18
|
-
const ProgressIndicator = createStyledHOC(ProgressIndicatorFrame, function ProgressIndicator2(
|
|
18
|
+
const ProgressIndicator = createStyledHOC(ProgressIndicatorFrame, function ProgressIndicator2(propsIn, forwardedRef) {
|
|
19
|
+
const props = propsIn;
|
|
19
20
|
const { __scopeProgress, transition, ...indicatorProps } = props;
|
|
20
21
|
const context = useProgressContext(INDICATOR_NAME, __scopeProgress);
|
|
21
22
|
const progressRatio = (context.value ?? 0) / context.max;
|
|
@@ -82,7 +83,8 @@ const ProgressFrame = styled(YStack, {
|
|
|
82
83
|
overflow: "hidden",
|
|
83
84
|
variants: { size: getProgressSize }
|
|
84
85
|
});
|
|
85
|
-
const Progress = withStaticProperties(createStyledHOC(ProgressFrame, function Progress2(
|
|
86
|
+
const Progress = withStaticProperties(createStyledHOC(ProgressFrame, function Progress2(propsIn, forwardedRef) {
|
|
87
|
+
const props = propsIn;
|
|
86
88
|
const { __scopeProgress, value: valueProp, max: maxProp, getValueLabel = defaultGetValueLabel, size = true, ...progressProps } = props;
|
|
87
89
|
const max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;
|
|
88
90
|
const value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progress.js","names":[],"sources":["esm/Progress.js"],"sourcesContent":["import { 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\";\nimport { jsx } from \"react/jsx-runtime\";\nconst PROGRESS_NAME = \"Progress\";\nconst [createProgressContext, createProgressScope] = createContextScope(PROGRESS_NAME);\nconst [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME);\nconst INDICATOR_NAME = \"ProgressIndicator\";\nconst ProgressIndicatorFrame = styled(YStack, {\n displayName: INDICATOR_NAME,\n height: \"100%\",\n width: \"100%\"\n});\nconst ProgressIndicator = createStyledHOC(\n ProgressIndicatorFrame,\n function ProgressIndicator2(
|
|
1
|
+
{"version":3,"file":"Progress.js","names":[],"sources":["esm/Progress.js"],"sourcesContent":["import { 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\";\nimport { jsx } from \"react/jsx-runtime\";\nconst PROGRESS_NAME = \"Progress\";\nconst [createProgressContext, createProgressScope] = createContextScope(PROGRESS_NAME);\nconst [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME);\nconst INDICATOR_NAME = \"ProgressIndicator\";\nconst ProgressIndicatorFrame = styled(YStack, {\n displayName: INDICATOR_NAME,\n height: \"100%\",\n width: \"100%\"\n});\nconst ProgressIndicator = createStyledHOC(\n ProgressIndicatorFrame,\n function ProgressIndicator2(propsIn, forwardedRef) {\n const props = propsIn;\n const { __scopeProgress, transition, ...indicatorProps } = props;\n const context = useProgressContext(INDICATOR_NAME, __scopeProgress);\n const progressRatio = (context.value ?? 0) / context.max;\n let x;\n if (isWeb) {\n x = `${-100 + progressRatio * 50}%`;\n } else {\n const baseWidth = context.width || 0;\n x = Math.ceil(-baseWidth * (2 - progressRatio));\n }\n return /* @__PURE__ */ jsx(\n ProgressIndicatorFrame,\n {\n \"data-state\": getProgressState(context.value, context.max),\n \"data-value\": context.value ?? void 0,\n \"data-max\": context.max,\n x,\n width: \"200%\",\n ...!isWeb && context.width === 0 && { opacity: 0 },\n ...indicatorProps,\n ref: forwardedRef,\n transition: !isWeb && !context.width ? null : { transform: transition }\n }\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}\nconst DEFAULT_MAX = 100;\nconst progressTrackHeight = {\n xs: 4,\n sm: 6,\n md: 9,\n lg: 12,\n xl: 16\n};\nconst resolveProgressSize = (val) => {\n if (typeof val === \"string\" && val in progressTrackHeight) {\n return progressTrackHeight[val];\n }\n const resolved = Number(getVariableValue(getSize(val === true ? 36 : val)));\n const base = Number.isFinite(resolved) ? resolved : Number(getVariableValue(getSize(36)));\n return Math.round(base * 0.25);\n};\nconst getProgressSize = styled.dynamic((val) => {\n const size = resolveProgressSize(val);\n return {\n height: size,\n minWidth: size * 20,\n width: \"100%\"\n };\n});\nconst ProgressFrame = styled(YStack, {\n displayName: \"Progress\",\n overflow: \"hidden\",\n variants: {\n size: getProgressSize\n }\n});\nconst Progress = withStaticProperties(\n createStyledHOC(\n ProgressFrame,\n function Progress2(propsIn, forwardedRef) {\n const props = propsIn;\n const {\n __scopeProgress,\n value: valueProp,\n max: maxProp,\n getValueLabel = defaultGetValueLabel,\n size = true,\n ...progressProps\n } = props;\n const max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;\n const value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;\n const valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0;\n const [width, setWidth] = useState(0);\n return /* @__PURE__ */ jsx(ProgressProvider, { scope: __scopeProgress, value, max, width, children: /* @__PURE__ */ jsx(\n ProgressFrame,\n {\n \"aria-valuemax\": max,\n \"aria-valuemin\": 0,\n \"aria-valuenow\": isNumber(value) ? value : void 0,\n \"aria-valuetext\": valueLabel,\n role: \"progressbar\",\n \"data-state\": getProgressState(value, max),\n \"data-value\": value ?? void 0,\n \"data-max\": max,\n size,\n ...progressProps,\n ...!isWeb && {\n onLayout: (e) => {\n const newWidth = Math.round(e.nativeEvent.layout.width);\n if (newWidth !== width) {\n setWidth(newWidth);\n }\n progressProps.onLayout?.(e);\n }\n },\n ref: forwardedRef\n }\n ) });\n }\n ),\n {\n Indicator: ProgressIndicator\n }\n);\nexport {\n Progress,\n ProgressFrame,\n ProgressIndicator,\n ProgressIndicatorFrame,\n createProgressScope\n};\n//# sourceMappingURL=Progress.js.map\n"],"mappings":";;;;;;;;;AAOA,MAAM,gBAAgB;AACtB,MAAM,CAAC,uBAAuB,uBAAuB,mBAAmB,aAAa;AACrF,MAAM,CAAC,kBAAkB,sBAAsB,sBAAsB,aAAa;AAClF,MAAM,iBAAiB;AACvB,MAAM,yBAAyB,OAAO,QAAQ;CAC5C,aAAa;CACb,QAAQ;CACR,OAAO;AACT,CAAC;AACD,MAAM,oBAAoB,gBACxB,wBACA,SAAS,mBAAmB,SAAS,cAAc;CACjD,MAAM,QAAQ;CACd,MAAM,EAAE,iBAAiB,YAAY,GAAG,mBAAmB;CAC3D,MAAM,UAAU,mBAAmB,gBAAgB,eAAe;CAClE,MAAM,iBAAiB,QAAQ,SAAS,KAAK,QAAQ;CACrD,IAAI;CACJ,IAAI,OAAO;EACT,IAAI,GAAG,CAAC,MAAM,gBAAgB,GAAG;CACnC,OAAO;EACL,MAAM,YAAY,QAAQ,SAAS;EACnC,IAAI,KAAK,KAAK,CAAC,aAAa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CAC9C,MAAM,OAAO,oBAAoB,GAAG;CACpC,OAAO;EACL,QAAQ;EACR,UAAU,OAAO;EACjB,OAAO;CACT;AACF,CAAC;AACD,MAAM,gBAAgB,OAAO,QAAQ;CACnC,aAAa;CACb,UAAU;CACV,UAAU,EACR,MAAM,gBACR;AACF,CAAC;AACD,MAAM,WAAW,qBACf,gBACE,eACA,SAAS,UAAU,SAAS,cAAc;CACxC,MAAM,QAAQ;CACd,MAAM,EACJ,iBACA,OAAO,WACP,KAAK,SACL,gBAAgB,sBAChB,OAAO,MACP,GAAG,kBACD;CACJ,MAAM,MAAM,iBAAiB,OAAO,IAAI,UAAU;CAClD,MAAM,QAAQ,mBAAmB,WAAW,GAAG,IAAI,KAAK,MAAM,SAAS,IAAI;CAC3E,MAAM,aAAa,SAAS,KAAK,IAAI,cAAc,OAAO,GAAG,IAAI,KAAK;CACtE,MAAM,CAAC,OAAO,YAAY,SAAS,CAAC;CACpC,OAAuB,oBAAI,kBAAkB;EAAE,OAAO;EAAiB;EAAO;EAAK;EAAO,UAA0B,oBAClH,eACA;GACE,iBAAiB;GACjB,iBAAiB;GACjB,iBAAiB,SAAS,KAAK,IAAI,QAAQ,KAAK;GAChD,kBAAkB;GAClB,MAAM;GACN,cAAc,iBAAiB,OAAO,GAAG;GACzC,cAAc,SAAS,KAAK;GAC5B,YAAY;GACZ;GACA,GAAG;GACH,GAAG,CAAC,SAAS,EACX,WAAW,MAAM;IACf,MAAM,WAAW,KAAK,MAAM,EAAE,YAAY,OAAO,KAAK;IACtD,IAAI,aAAa,OAAO;KACtB,SAAS,QAAQ;IACnB;IACA,cAAc,WAAW,CAAC;GAC5B,EACF;GACA,KAAK;EACP,CACF;CAAE,CAAC;AACL,CACF,GACA,EACE,WAAW,kBACb,CACF"}
|
|
@@ -15,8 +15,9 @@ var ProgressIndicatorFrame = styled(YStack, {
|
|
|
15
15
|
height: "100%",
|
|
16
16
|
width: "100%"
|
|
17
17
|
});
|
|
18
|
-
var ProgressIndicator = createStyledHOC(ProgressIndicatorFrame, function ProgressIndicator2(
|
|
18
|
+
var ProgressIndicator = createStyledHOC(ProgressIndicatorFrame, function ProgressIndicator2(propsIn, forwardedRef) {
|
|
19
19
|
var _context_value, _context_value1;
|
|
20
|
+
var props = propsIn;
|
|
20
21
|
var { __scopeProgress, transition, ...indicatorProps } = props;
|
|
21
22
|
var context = useProgressContext(INDICATOR_NAME, __scopeProgress);
|
|
22
23
|
var progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max;
|
|
@@ -83,7 +84,8 @@ var ProgressFrame = styled(YStack, {
|
|
|
83
84
|
overflow: "hidden",
|
|
84
85
|
variants: { size: getProgressSize }
|
|
85
86
|
});
|
|
86
|
-
var Progress = withStaticProperties(createStyledHOC(ProgressFrame, function Progress2(
|
|
87
|
+
var Progress = withStaticProperties(createStyledHOC(ProgressFrame, function Progress2(propsIn, forwardedRef) {
|
|
88
|
+
var props = propsIn;
|
|
87
89
|
var { __scopeProgress, value: valueProp, max: maxProp, getValueLabel = defaultGetValueLabel, size = true, ...progressProps } = props;
|
|
88
90
|
var max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;
|
|
89
91
|
var value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;
|
|
@@ -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(
|
|
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(propsIn, forwardedRef) {\n var _context_value, _context_value1;\n var props = propsIn;\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(propsIn, forwardedRef) {\n var props = propsIn;\n var { __scopeProgress, value: valueProp, max: maxProp, getValueLabel = defaultGetValueLabel, size = true, ...progressProps } = 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,SAAS,cAAc;CACjH,IAAI,gBAAgB;CACpB,IAAI,QAAQ;CACZ,IAAI,EAAE,iBAAiB,YAAY,GAAG,mBAAmB;CACzD,IAAI,UAAU,mBAAmB,gBAAgB,eAAe;CAChE,IAAI,kBAAkB,iBAAiB,QAAQ,WAAW,QAAQ,mBAAmB,KAAK,IAAI,iBAAiB,KAAK,QAAQ;CAC5H,IAAI;CACJ,IAAI,OAAO;EACT,IAAI,GAAG,CAAC,MAAM,gBAAgB,GAAG;CACnC,OAAO;EACL,IAAI,YAAY,QAAQ,SAAS;EACjC,IAAI,KAAK,KAAK,CAAC,aAAa,IAAI,cAAc;CAChD;CACA,OAAuB,oBAAK,wBA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AACH,CAAC,GAAG,EACF,WAAW,kBACb,CAAC"}
|
package/dist/jsx/Progress.mjs
CHANGED
|
@@ -15,7 +15,8 @@ const ProgressIndicatorFrame = styled(YStack, {
|
|
|
15
15
|
height: "100%",
|
|
16
16
|
width: "100%"
|
|
17
17
|
});
|
|
18
|
-
const ProgressIndicator = createStyledHOC(ProgressIndicatorFrame, function ProgressIndicator2(
|
|
18
|
+
const ProgressIndicator = createStyledHOC(ProgressIndicatorFrame, function ProgressIndicator2(propsIn, forwardedRef) {
|
|
19
|
+
const props = propsIn;
|
|
19
20
|
const { __scopeProgress, transition, ...indicatorProps } = props;
|
|
20
21
|
const context = useProgressContext(INDICATOR_NAME, __scopeProgress);
|
|
21
22
|
const progressRatio = (context.value ?? 0) / context.max;
|
|
@@ -82,7 +83,8 @@ const ProgressFrame = styled(YStack, {
|
|
|
82
83
|
overflow: "hidden",
|
|
83
84
|
variants: { size: getProgressSize }
|
|
84
85
|
});
|
|
85
|
-
const Progress = withStaticProperties(createStyledHOC(ProgressFrame, function Progress2(
|
|
86
|
+
const Progress = withStaticProperties(createStyledHOC(ProgressFrame, function Progress2(propsIn, forwardedRef) {
|
|
87
|
+
const props = propsIn;
|
|
86
88
|
const { __scopeProgress, value: valueProp, max: maxProp, getValueLabel = defaultGetValueLabel, size = true, ...progressProps } = props;
|
|
87
89
|
const max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;
|
|
88
90
|
const value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progress.js","names":[],"sources":["jsx/Progress.js"],"sourcesContent":["import { 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\";\nimport { jsx } from \"react/jsx-runtime\";\nconst PROGRESS_NAME = \"Progress\";\nconst [createProgressContext, createProgressScope] = createContextScope(PROGRESS_NAME);\nconst [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME);\nconst INDICATOR_NAME = \"ProgressIndicator\";\nconst ProgressIndicatorFrame = styled(YStack, {\n displayName: INDICATOR_NAME,\n height: \"100%\",\n width: \"100%\"\n});\nconst ProgressIndicator = createStyledHOC(\n ProgressIndicatorFrame,\n function ProgressIndicator2(
|
|
1
|
+
{"version":3,"file":"Progress.js","names":[],"sources":["jsx/Progress.js"],"sourcesContent":["import { 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\";\nimport { jsx } from \"react/jsx-runtime\";\nconst PROGRESS_NAME = \"Progress\";\nconst [createProgressContext, createProgressScope] = createContextScope(PROGRESS_NAME);\nconst [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME);\nconst INDICATOR_NAME = \"ProgressIndicator\";\nconst ProgressIndicatorFrame = styled(YStack, {\n displayName: INDICATOR_NAME,\n height: \"100%\",\n width: \"100%\"\n});\nconst ProgressIndicator = createStyledHOC(\n ProgressIndicatorFrame,\n function ProgressIndicator2(propsIn, forwardedRef) {\n const props = propsIn;\n const { __scopeProgress, transition, ...indicatorProps } = props;\n const context = useProgressContext(INDICATOR_NAME, __scopeProgress);\n const progressRatio = (context.value ?? 0) / context.max;\n let x;\n if (isWeb) {\n x = `${-100 + progressRatio * 50}%`;\n } else {\n const baseWidth = context.width || 0;\n x = Math.ceil(-baseWidth * (2 - progressRatio));\n }\n return /* @__PURE__ */ jsx(\n ProgressIndicatorFrame,\n {\n \"data-state\": getProgressState(context.value, context.max),\n \"data-value\": context.value ?? void 0,\n \"data-max\": context.max,\n x,\n width: \"200%\",\n ...!isWeb && context.width === 0 && { opacity: 0 },\n ...indicatorProps,\n ref: forwardedRef,\n transition: !isWeb && !context.width ? null : { transform: transition }\n }\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}\nconst DEFAULT_MAX = 100;\nconst progressTrackHeight = {\n xs: 4,\n sm: 6,\n md: 9,\n lg: 12,\n xl: 16\n};\nconst resolveProgressSize = (val) => {\n if (typeof val === \"string\" && val in progressTrackHeight) {\n return progressTrackHeight[val];\n }\n const resolved = Number(getVariableValue(getSize(val === true ? 36 : val)));\n const base = Number.isFinite(resolved) ? resolved : Number(getVariableValue(getSize(36)));\n return Math.round(base * 0.25);\n};\nconst getProgressSize = styled.dynamic((val) => {\n const size = resolveProgressSize(val);\n return {\n height: size,\n minWidth: size * 20,\n width: \"100%\"\n };\n});\nconst ProgressFrame = styled(YStack, {\n displayName: \"Progress\",\n overflow: \"hidden\",\n variants: {\n size: getProgressSize\n }\n});\nconst Progress = withStaticProperties(\n createStyledHOC(\n ProgressFrame,\n function Progress2(propsIn, forwardedRef) {\n const props = propsIn;\n const {\n __scopeProgress,\n value: valueProp,\n max: maxProp,\n getValueLabel = defaultGetValueLabel,\n size = true,\n ...progressProps\n } = props;\n const max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;\n const value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;\n const valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0;\n const [width, setWidth] = useState(0);\n return /* @__PURE__ */ jsx(ProgressProvider, { scope: __scopeProgress, value, max, width, children: /* @__PURE__ */ jsx(\n ProgressFrame,\n {\n \"aria-valuemax\": max,\n \"aria-valuemin\": 0,\n \"aria-valuenow\": isNumber(value) ? value : void 0,\n \"aria-valuetext\": valueLabel,\n role: \"progressbar\",\n \"data-state\": getProgressState(value, max),\n \"data-value\": value ?? void 0,\n \"data-max\": max,\n size,\n ...progressProps,\n ...!isWeb && {\n onLayout: (e) => {\n const newWidth = Math.round(e.nativeEvent.layout.width);\n if (newWidth !== width) {\n setWidth(newWidth);\n }\n progressProps.onLayout?.(e);\n }\n },\n ref: forwardedRef\n }\n ) });\n }\n ),\n {\n Indicator: ProgressIndicator\n }\n);\nexport {\n Progress,\n ProgressFrame,\n ProgressIndicator,\n ProgressIndicatorFrame,\n createProgressScope\n};\n//# sourceMappingURL=Progress.js.map\n"],"mappings":";;;;;;;;;AAOA,MAAM,gBAAgB;AACtB,MAAM,CAAC,uBAAuB,uBAAuB,mBAAmB,aAAa;AACrF,MAAM,CAAC,kBAAkB,sBAAsB,sBAAsB,aAAa;AAClF,MAAM,iBAAiB;AACvB,MAAM,yBAAyB,OAAO,QAAQ;CAC5C,aAAa;CACb,QAAQ;CACR,OAAO;AACT,CAAC;AACD,MAAM,oBAAoB,gBACxB,wBACA,SAAS,mBAAmB,SAAS,cAAc;CACjD,MAAM,QAAQ;CACd,MAAM,EAAE,iBAAiB,YAAY,GAAG,mBAAmB;CAC3D,MAAM,UAAU,mBAAmB,gBAAgB,eAAe;CAClE,MAAM,iBAAiB,QAAQ,SAAS,KAAK,QAAQ;CACrD,IAAI;CACJ,IAAI,OAAO;EACT,IAAI,GAAG,CAAC,MAAM,gBAAgB,GAAG;CACnC,OAAO;EACL,MAAM,YAAY,QAAQ,SAAS;EACnC,IAAI,KAAK,KAAK,CAAC,aAAa,IAAI,cAAc;CAChD;CACA,OAAuB,oBACrB,wBACA;EACE,cAAc,iBAAiB,QAAQ,OAAO,QAAQ,GAAG;EACzD,cAAc,QAAQ,SAAS,KAAK;EACpC,YAAY,QAAQ;EACpB;EACA,OAAO;EACP,GAAG,CAAC,SAAS,QAA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;AACF,CAAC;AACD,MAAM,WAAW,qBACf,gBACE,eACA,SAAS,UAAU,SAAS,cAAc;CACxC,MAAM,QAAQ;CACd,MAAM,EACJ,iBACA,OAAO,WACP,KAAK,SACL,gBAAgB,sBAChB,OAAO,MACP,GAAG,kBACD;CACJ,MAAM,MAAM,iBAAiB,OAAO,IAAI,UAAU;CAClD,MAAM,QAAQ,mBAAmB,WAAW,GAAG,IAAI,KAAK,MAAM,SAAS,IAAI;CAC3E,MAAM,aAAa,SAAS,KAAK,IAAI,cAAc,OAAO,GAAG,IAAI,KAAK;CACtE,MAAM,CAAC,OAAO,YAAY,SAAS,CAAC;CACpC,OAAuB,oBAAI,kBAAkB;EAAE,OAAO;EAAiB;EAAO;EAAK;EAAO,UAA0B,oBAClH,eACA;GACE,iBAAiB;GACjB,iBAAiB;GACjB,iBAAiB,SAAS,KAAK,IAAI,QAAQ,KAAK;GAChD,kBAAkB;GAClB,MAAM;GACN,cAAc,iBAAiB,OAAO,GAAG;GACzC,cAAc,SAAS,KAAK;GAC5B,YAAY;GACZ;GACA,GAAG;GACH,GAAG,CAAC,SAAS,EACX,WAAW,MAAM;IACf,MAAM,WAAW,KAAK,MAAM,EAAE,YAAY,OAAO,KAAK;IACtD,IAAI,aAAa,OAAO;KACtB,SAAS,QAAQ;IACnB;IACA,cAAc,WAAW,CAAC;GAC5B,EACF;GACA,KAAK;EACP,CACF;CAAE,CAAC;AACL,CACF,GACA,EACE,WAAW,kBACb,CACF"}
|
|
@@ -45,8 +45,9 @@ var ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
|
45
45
|
height: "100%",
|
|
46
46
|
width: "100%"
|
|
47
47
|
});
|
|
48
|
-
var ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(
|
|
48
|
+
var ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(propsIn, forwardedRef) {
|
|
49
49
|
var _context_value, _context_value1;
|
|
50
|
+
var props = propsIn;
|
|
50
51
|
var { __scopeProgress, transition, ...indicatorProps } = props;
|
|
51
52
|
var context = useProgressContext(INDICATOR_NAME, __scopeProgress);
|
|
52
53
|
var progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max;
|
|
@@ -113,7 +114,8 @@ var ProgressFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
|
113
114
|
overflow: "hidden",
|
|
114
115
|
variants: { size: getProgressSize }
|
|
115
116
|
});
|
|
116
|
-
var Progress = (0, import_helpers.withStaticProperties)((0, import_core.createStyledHOC)(ProgressFrame, function Progress2(
|
|
117
|
+
var Progress = (0, import_helpers.withStaticProperties)((0, import_core.createStyledHOC)(ProgressFrame, function Progress2(propsIn, forwardedRef) {
|
|
118
|
+
var props = propsIn;
|
|
117
119
|
var { __scopeProgress, value: valueProp, max: maxProp, getValueLabel = defaultGetValueLabel, size = true, ...progressProps } = props;
|
|
118
120
|
var max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;
|
|
119
121
|
var value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;
|
|
@@ -45,8 +45,9 @@ var ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
|
45
45
|
height: "100%",
|
|
46
46
|
width: "100%"
|
|
47
47
|
});
|
|
48
|
-
var ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(
|
|
48
|
+
var ProgressIndicator = (0, import_core.createStyledHOC)(ProgressIndicatorFrame, function ProgressIndicator2(propsIn, forwardedRef) {
|
|
49
49
|
var _context_value, _context_value1;
|
|
50
|
+
var props = propsIn;
|
|
50
51
|
var { __scopeProgress, transition, ...indicatorProps } = props;
|
|
51
52
|
var context = useProgressContext(INDICATOR_NAME, __scopeProgress);
|
|
52
53
|
var progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max;
|
|
@@ -113,7 +114,8 @@ var ProgressFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
|
113
114
|
overflow: "hidden",
|
|
114
115
|
variants: { size: getProgressSize }
|
|
115
116
|
});
|
|
116
|
-
var Progress = (0, import_helpers.withStaticProperties)((0, import_core.createStyledHOC)(ProgressFrame, function Progress2(
|
|
117
|
+
var Progress = (0, import_helpers.withStaticProperties)((0, import_core.createStyledHOC)(ProgressFrame, function Progress2(propsIn, forwardedRef) {
|
|
118
|
+
var props = propsIn;
|
|
117
119
|
var { __scopeProgress, value: valueProp, max: maxProp, getValueLabel = defaultGetValueLabel, size = true, ...progressProps } = props;
|
|
118
120
|
var max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;
|
|
119
121
|
var value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;
|
|
@@ -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 _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,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,IAA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F,WAAW,kBACb,CAAC"}
|
|
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(propsIn, forwardedRef) {\n var _context_value, _context_value1;\n var props = propsIn;\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(propsIn, forwardedRef) {\n var props = propsIn;\n var { __scopeProgress, value: valueProp, max: maxProp, getValueLabel = defaultGetValueLabel, size = true, ...progressProps } = 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;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,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/progress",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -35,17 +35,17 @@
|
|
|
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.1.0",
|
|
39
|
+
"@tamagui/core": "3.1.0",
|
|
40
|
+
"@tamagui/create-context": "3.1.0",
|
|
41
|
+
"@tamagui/get-token": "3.1.0",
|
|
42
|
+
"@tamagui/helpers": "3.1.0",
|
|
43
|
+
"@tamagui/stacks": "3.1.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@tamagui/build": "3.0
|
|
47
|
-
"react": "19.
|
|
48
|
-
"react-native": "0.
|
|
46
|
+
"@tamagui/build": "3.1.0",
|
|
47
|
+
"react": "19.3.0",
|
|
48
|
+
"react-native": "0.88.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"react": ">=19"
|
|
@@ -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": "690ee7d9f451e684f0f197d160c261cdf37dd79f"
|
|
60
60
|
}
|
package/src/Progress.tsx
CHANGED
|
@@ -39,7 +39,8 @@ export type ProgressIndicatorProps = GetProps<typeof ProgressIndicatorFrame>
|
|
|
39
39
|
|
|
40
40
|
const ProgressIndicator = createStyledHOC(
|
|
41
41
|
ProgressIndicatorFrame,
|
|
42
|
-
function ProgressIndicator(
|
|
42
|
+
function ProgressIndicator(propsIn: ScopedProps<{}>, forwardedRef) {
|
|
43
|
+
const props: ScopedProps<ProgressIndicatorProps> = propsIn
|
|
43
44
|
const { __scopeProgress, transition, ...indicatorProps } = props
|
|
44
45
|
const context = useProgressContext(INDICATOR_NAME, __scopeProgress)
|
|
45
46
|
|
|
@@ -173,52 +174,55 @@ export interface ProgressExtraProps {
|
|
|
173
174
|
export type ProgressProps = GetProps<typeof ProgressFrame> & ProgressExtraProps
|
|
174
175
|
|
|
175
176
|
const Progress = withStaticProperties(
|
|
176
|
-
createStyledHOC(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
177
|
+
createStyledHOC(
|
|
178
|
+
ProgressFrame,
|
|
179
|
+
function Progress(propsIn: ScopedProps<ProgressExtraProps>, forwardedRef) {
|
|
180
|
+
const props: ScopedProps<ProgressProps> = propsIn
|
|
181
|
+
const {
|
|
182
|
+
__scopeProgress,
|
|
183
|
+
value: valueProp,
|
|
184
|
+
max: maxProp,
|
|
185
|
+
getValueLabel = defaultGetValueLabel,
|
|
186
|
+
size = true,
|
|
187
|
+
...progressProps
|
|
188
|
+
} = props
|
|
189
|
+
|
|
190
|
+
const max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX
|
|
191
|
+
const value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null
|
|
192
|
+
const valueLabel = isNumber(value) ? getValueLabel(value, max) : undefined
|
|
193
|
+
|
|
194
|
+
// only needed for native where we can't use percentage-based transforms
|
|
195
|
+
const [width, setWidth] = useState(0)
|
|
196
|
+
|
|
197
|
+
return (
|
|
198
|
+
<ProgressProvider scope={__scopeProgress} value={value} max={max} width={width}>
|
|
199
|
+
<ProgressFrame
|
|
200
|
+
aria-valuemax={max}
|
|
201
|
+
aria-valuemin={0}
|
|
202
|
+
aria-valuenow={isNumber(value) ? value : undefined}
|
|
203
|
+
aria-valuetext={valueLabel}
|
|
204
|
+
// @ts-ignore
|
|
205
|
+
role="progressbar"
|
|
206
|
+
data-state={getProgressState(value, max)}
|
|
207
|
+
data-value={value ?? undefined}
|
|
208
|
+
data-max={max}
|
|
209
|
+
size={size}
|
|
210
|
+
{...progressProps}
|
|
211
|
+
{...(!isWeb && {
|
|
212
|
+
onLayout: (e) => {
|
|
213
|
+
const newWidth = Math.round(e.nativeEvent.layout.width)
|
|
214
|
+
if (newWidth !== width) {
|
|
215
|
+
setWidth(newWidth)
|
|
216
|
+
}
|
|
217
|
+
progressProps.onLayout?.(e)
|
|
218
|
+
},
|
|
219
|
+
})}
|
|
220
|
+
ref={forwardedRef}
|
|
221
|
+
/>
|
|
222
|
+
</ProgressProvider>
|
|
223
|
+
)
|
|
224
|
+
}
|
|
225
|
+
),
|
|
222
226
|
{
|
|
223
227
|
Indicator: ProgressIndicator,
|
|
224
228
|
}
|
package/types/Progress.d.ts
CHANGED
|
@@ -1,53 +1,29 @@
|
|
|
1
1
|
import type { ComponentSize, GetProps, SizeTokens } from '@tamagui/core';
|
|
2
2
|
import type { Scope } from '@tamagui/create-context';
|
|
3
3
|
declare const createProgressScope: import("@tamagui/create-context").CreateScope;
|
|
4
|
-
export declare const ProgressIndicatorFrame: import("
|
|
5
|
-
ref?: import("react").Ref<import("@tamagui/core").TamaguiElement> | undefined;
|
|
6
|
-
}> & import("@tamagui/core").StaticComponentObject<import("@tamagui/core").TamaDefer, import("@tamagui/core").TamaguiElement, import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/core").StackStyleBase, {}, import("@tamagui/core").StaticConfigPublic> & Omit<import("@tamagui/core").StaticConfigPublic, "staticConfig"> & {
|
|
7
|
-
__tama: [import("@tamagui/core").TamaDefer, import("@tamagui/core").TamaguiElement, import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/core").StackStyleBase, {}, import("@tamagui/core").StaticConfigPublic];
|
|
8
|
-
};
|
|
4
|
+
export declare const ProgressIndicatorFrame: import("@tamagui/core").TamaguiComponent<import("@tamagui/core").TamaDefer, import("@tamagui/core").TamaguiElement, import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/core").StackStyleBase, {}, import("@tamagui/core").StaticConfigPublic>;
|
|
9
5
|
export type ProgressIndicatorProps = GetProps<typeof ProgressIndicatorFrame>;
|
|
10
|
-
declare const ProgressIndicator: import("@tamagui/core").TamaguiComponent<import("@tamagui/core").TamaDefer, import("@tamagui/core").TamaguiElement, Omit<import("@tamagui/core").RNTamaguiViewNonStyleProps, "__scopeProgress"
|
|
6
|
+
declare const ProgressIndicator: import("@tamagui/core").TamaguiComponent<import("@tamagui/core").TamaDefer, import("@tamagui/core").TamaguiElement, Omit<import("@tamagui/core").RNTamaguiViewNonStyleProps, "__scopeProgress"> & {
|
|
11
7
|
__scopeProgress?: Scope;
|
|
12
|
-
}, import("@tamagui/core").StackStyleBase, Omit<{}, "__scopeProgress"
|
|
8
|
+
}, import("@tamagui/core").StackStyleBase, Omit<{}, "__scopeProgress">, import("@tamagui/core").StaticConfigPublic>;
|
|
13
9
|
export type ProgressSize = ComponentSize | SizeTokens | number | boolean;
|
|
14
|
-
export declare const ProgressFrame: import("
|
|
10
|
+
export declare const ProgressFrame: import("@tamagui/core").TamaguiComponent<import("@tamagui/core").TamaDefer, import("@tamagui/core").TamaguiElement, import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/core").StackStyleBase, {
|
|
15
11
|
size?: ProgressSize | undefined;
|
|
16
|
-
}
|
|
17
|
-
ref?: import("react").Ref<import("@tamagui/core").TamaguiElement> | undefined;
|
|
18
|
-
}> & import("@tamagui/core").StaticComponentObject<import("@tamagui/core").TamaDefer, import("@tamagui/core").TamaguiElement, import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/core").StackStyleBase, {
|
|
19
|
-
size?: ProgressSize | undefined;
|
|
20
|
-
}, import("@tamagui/core").StaticConfigPublic> & Omit<import("@tamagui/core").StaticConfigPublic, "staticConfig"> & {
|
|
21
|
-
__tama: [import("@tamagui/core").TamaDefer, import("@tamagui/core").TamaguiElement, import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/core").StackStyleBase, {
|
|
22
|
-
size?: ProgressSize | undefined;
|
|
23
|
-
}, import("@tamagui/core").StaticConfigPublic];
|
|
24
|
-
};
|
|
12
|
+
}, import("@tamagui/core").StaticConfigPublic>;
|
|
25
13
|
export interface ProgressExtraProps {
|
|
26
14
|
value?: number | null | undefined;
|
|
27
15
|
max?: number;
|
|
28
16
|
getValueLabel?(value: number, max: number): string;
|
|
29
17
|
}
|
|
30
18
|
export type ProgressProps = GetProps<typeof ProgressFrame> & ProgressExtraProps;
|
|
31
|
-
declare const Progress: import("
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
size?: ProgressSize | undefined;
|
|
35
|
-
}, "size" | keyof ProgressExtraProps | keyof import("@tamagui/core").RNTamaguiViewNonStyleProps | keyof import("@tamagui/core").StackStyleBase>> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase>>, "size" | keyof ProgressExtraProps | keyof import("@tamagui/core").RNTamaguiViewNonStyleProps | keyof import("@tamagui/core").StackStyleBase> & {
|
|
36
|
-
ref?: import("react").Ref<import("@tamagui/core").TamaguiElement> | undefined;
|
|
37
|
-
}> & import("@tamagui/core").StaticComponentObject<import("@tamagui/core").TamaDefer, import("@tamagui/core").TamaguiElement, Omit<import("@tamagui/core").RNTamaguiViewNonStyleProps, "size" | keyof ProgressExtraProps | keyof import("@tamagui/core").RNTamaguiViewNonStyleProps | keyof import("@tamagui/core").StackStyleBase> & Omit<import("@tamagui/core").RNTamaguiViewNonStyleProps, "size"> & Omit<import("@tamagui/core").WithThemeValues<Omit<import("@tamagui/core").StackStyleBase, "size">> & import("@tamagui/core").WithFlatVariantValues<{
|
|
38
|
-
size?: ProgressSize | undefined;
|
|
39
|
-
}> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase>>, keyof import("@tamagui/core").RNTamaguiViewNonStyleProps> & ProgressExtraProps, import("@tamagui/core").StackStyleBase, Omit<{
|
|
19
|
+
declare const Progress: import("@tamagui/helpers").Combined<import("@tamagui/core").TamaguiComponent<import("@tamagui/core").TamaDefer, import("@tamagui/core").TamaguiElement, Omit<import("@tamagui/core").RNTamaguiViewNonStyleProps, "__scopeProgress" | keyof ProgressExtraProps> & ProgressExtraProps & {
|
|
20
|
+
__scopeProgress?: Scope;
|
|
21
|
+
}, import("@tamagui/core").StackStyleBase, Omit<{
|
|
40
22
|
size?: ProgressSize | undefined;
|
|
41
|
-
}, "
|
|
42
|
-
|
|
43
|
-
size?: ProgressSize | undefined;
|
|
44
|
-
}> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase>>, keyof import("@tamagui/core").RNTamaguiViewNonStyleProps> & ProgressExtraProps, import("@tamagui/core").StackStyleBase, Omit<{
|
|
45
|
-
size?: ProgressSize | undefined;
|
|
46
|
-
}, "size" | keyof ProgressExtraProps | keyof import("@tamagui/core").RNTamaguiViewNonStyleProps | keyof import("@tamagui/core").StackStyleBase>, import("@tamagui/core").StaticConfigPublic];
|
|
47
|
-
} & {
|
|
48
|
-
Indicator: import("@tamagui/core").TamaguiComponent<import("@tamagui/core").TamaDefer, import("@tamagui/core").TamaguiElement, Omit<import("@tamagui/core").RNTamaguiViewNonStyleProps, "__scopeProgress" | keyof import("@tamagui/core").RNTamaguiViewNonStyleProps | keyof import("@tamagui/core").StackStyleBase> & Omit<import("@tamagui/core").RNTamaguiViewNonStyleProps, never> & Omit<import("@tamagui/core").WithThemeValues<Omit<import("@tamagui/core").StackStyleBase, never>> & import("@tamagui/core").WithFlatVariantValues<{}> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase>>, keyof import("@tamagui/core").RNTamaguiViewNonStyleProps> & {
|
|
23
|
+
}, "__scopeProgress" | keyof ProgressExtraProps>, import("@tamagui/core").StaticConfigPublic>, {
|
|
24
|
+
Indicator: import("@tamagui/core").TamaguiComponent<import("@tamagui/core").TamaDefer, import("@tamagui/core").TamaguiElement, Omit<import("@tamagui/core").RNTamaguiViewNonStyleProps, "__scopeProgress"> & {
|
|
49
25
|
__scopeProgress?: Scope;
|
|
50
|
-
}, import("@tamagui/core").StackStyleBase, Omit<{}, "__scopeProgress"
|
|
51
|
-
}
|
|
26
|
+
}, import("@tamagui/core").StackStyleBase, Omit<{}, "__scopeProgress">, import("@tamagui/core").StaticConfigPublic>;
|
|
27
|
+
}>;
|
|
52
28
|
export { createProgressScope, Progress, ProgressIndicator };
|
|
53
29
|
//# sourceMappingURL=Progress.d.ts.map
|
package/types/Progress.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progress.d.ts","sourceRoot":"","sources":["../src/Progress.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAExE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AASpD,QAAA,MAA8B,mBAAmB,+CAAqC,CAAA;AAiBtF,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"Progress.d.ts","sourceRoot":"","sources":["../src/Progress.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAExE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AASpD,QAAA,MAA8B,mBAAmB,+CAAqC,CAAA;AAiBtF,eAAO,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