@tamagui/progress 1.113.0 → 1.113.2
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.
|
@@ -5,52 +5,40 @@ import { getSize } from "@tamagui/get-token";
|
|
|
5
5
|
import { withStaticProperties } from "@tamagui/helpers";
|
|
6
6
|
import { ThemeableStack } from "@tamagui/stacks";
|
|
7
7
|
import * as React from "react";
|
|
8
|
-
var PROGRESS_NAME = "Progress",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
false: {
|
|
17
|
-
height: "100%",
|
|
18
|
-
width: "100%",
|
|
19
|
-
backgrounded: !0
|
|
20
|
-
}
|
|
8
|
+
var PROGRESS_NAME = "Progress", [createProgressContext, createProgressScope] = createContextScope(PROGRESS_NAME), [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME), INDICATOR_NAME = "ProgressIndicator", ProgressIndicatorFrame = styled(ThemeableStack, {
|
|
9
|
+
name: INDICATOR_NAME,
|
|
10
|
+
variants: {
|
|
11
|
+
unstyled: {
|
|
12
|
+
false: {
|
|
13
|
+
height: "100%",
|
|
14
|
+
width: "100%",
|
|
15
|
+
backgrounded: !0
|
|
21
16
|
}
|
|
22
|
-
},
|
|
23
|
-
defaultVariants: {
|
|
24
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
25
17
|
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
...indicatorProps,
|
|
49
|
-
ref: forwardedRef,
|
|
50
|
-
// avoid animation on first render so the progress doesn't bounce to initial location
|
|
51
|
-
animation: context.width ? animation : null
|
|
52
|
-
});
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: {
|
|
20
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
21
|
+
}
|
|
22
|
+
}), ProgressIndicator = ProgressIndicatorFrame.styleable(function(props, forwardedRef) {
|
|
23
|
+
var { __scopeProgress, animation, ...indicatorProps } = props, context = useProgressContext(INDICATOR_NAME, __scopeProgress), _context_value, pct = context.max - ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0), x = -(context.width === 0 ? 300 : context.width) * (pct / 100), _context_value1;
|
|
24
|
+
return /* @__PURE__ */ _jsx(ProgressIndicatorFrame, {
|
|
25
|
+
"data-state": getProgressState(context.value, context.max),
|
|
26
|
+
"data-value": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,
|
|
27
|
+
"data-max": context.max,
|
|
28
|
+
x,
|
|
29
|
+
width: context.width,
|
|
30
|
+
...!props.unstyled && {
|
|
31
|
+
animateOnly: [
|
|
32
|
+
"transform"
|
|
33
|
+
],
|
|
34
|
+
opacity: context.width === 0 ? 0 : 1
|
|
35
|
+
},
|
|
36
|
+
...indicatorProps,
|
|
37
|
+
ref: forwardedRef,
|
|
38
|
+
// avoid animation on first render so the progress doesn't bounce to initial location
|
|
39
|
+
animation: context.width ? animation : null
|
|
53
40
|
});
|
|
41
|
+
});
|
|
54
42
|
function defaultGetValueLabel(value, max) {
|
|
55
43
|
return `${Math.round(value / max * 100)}%`;
|
|
56
44
|
}
|
|
@@ -66,74 +54,74 @@ function isValidMaxNumber(max) {
|
|
|
66
54
|
function isValidValueNumber(value, max) {
|
|
67
55
|
return isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0;
|
|
68
56
|
}
|
|
69
|
-
var DEFAULT_MAX = 100,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
backgrounded: !0
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
size: {
|
|
81
|
-
"...size": function (val) {
|
|
82
|
-
var size = Math.round(getVariableValue(getSize(val)) * 0.25);
|
|
83
|
-
return {
|
|
84
|
-
height: size,
|
|
85
|
-
minWidth: getVariableValue(size) * 20,
|
|
86
|
-
width: "100%"
|
|
87
|
-
};
|
|
88
|
-
}
|
|
57
|
+
var DEFAULT_MAX = 100, ProgressFrame = styled(ThemeableStack, {
|
|
58
|
+
name: "Progress",
|
|
59
|
+
variants: {
|
|
60
|
+
unstyled: {
|
|
61
|
+
false: {
|
|
62
|
+
borderRadius: 1e5,
|
|
63
|
+
overflow: "hidden",
|
|
64
|
+
backgrounded: !0
|
|
89
65
|
}
|
|
90
66
|
},
|
|
91
|
-
|
|
92
|
-
|
|
67
|
+
size: {
|
|
68
|
+
"...size": function(val) {
|
|
69
|
+
var size = Math.round(getVariableValue(getSize(val)) * 0.25);
|
|
70
|
+
return {
|
|
71
|
+
height: size,
|
|
72
|
+
minWidth: getVariableValue(size) * 20,
|
|
73
|
+
width: "100%"
|
|
74
|
+
};
|
|
75
|
+
}
|
|
93
76
|
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
})
|
|
134
|
-
});
|
|
135
|
-
}), {
|
|
136
|
-
Indicator: ProgressIndicator
|
|
77
|
+
},
|
|
78
|
+
defaultVariants: {
|
|
79
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
80
|
+
}
|
|
81
|
+
}), Progress = withStaticProperties(ProgressFrame.styleable(function(props, forwardedRef) {
|
|
82
|
+
var {
|
|
83
|
+
// @ts-expect-error
|
|
84
|
+
__scopeProgress,
|
|
85
|
+
value: valueProp,
|
|
86
|
+
max: maxProp,
|
|
87
|
+
getValueLabel = defaultGetValueLabel,
|
|
88
|
+
size = "$true",
|
|
89
|
+
...progressProps
|
|
90
|
+
} = props, max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX, value = isValidValueNumber(valueProp, max) ? valueProp : null, valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0, [width, setWidth] = React.useState(0);
|
|
91
|
+
return /* @__PURE__ */ _jsx(ProgressProvider, {
|
|
92
|
+
scope: __scopeProgress,
|
|
93
|
+
value,
|
|
94
|
+
max,
|
|
95
|
+
width,
|
|
96
|
+
children: /* @__PURE__ */ _jsx(ProgressFrame, {
|
|
97
|
+
"aria-valuemax": max,
|
|
98
|
+
"aria-valuemin": 0,
|
|
99
|
+
"aria-valuenow": isNumber(value) ? value : void 0,
|
|
100
|
+
"aria-valuetext": valueLabel,
|
|
101
|
+
// @ts-ignore
|
|
102
|
+
role: "progressbar",
|
|
103
|
+
"data-state": getProgressState(value, max),
|
|
104
|
+
"data-value": value ?? void 0,
|
|
105
|
+
"data-max": max,
|
|
106
|
+
...progressProps.unstyled !== !0 && {
|
|
107
|
+
size
|
|
108
|
+
},
|
|
109
|
+
...progressProps,
|
|
110
|
+
onLayout: function(e) {
|
|
111
|
+
var _progressProps_onLayout;
|
|
112
|
+
setWidth(e.nativeEvent.layout.width), (_progressProps_onLayout = progressProps.onLayout) === null || _progressProps_onLayout === void 0 || _progressProps_onLayout.call(progressProps, e);
|
|
113
|
+
},
|
|
114
|
+
ref: forwardedRef
|
|
115
|
+
})
|
|
137
116
|
});
|
|
138
|
-
|
|
139
|
-
|
|
117
|
+
}), {
|
|
118
|
+
Indicator: ProgressIndicator
|
|
119
|
+
});
|
|
120
|
+
export {
|
|
121
|
+
Progress,
|
|
122
|
+
ProgressFrame,
|
|
123
|
+
ProgressIndicator,
|
|
124
|
+
ProgressIndicatorFrame,
|
|
125
|
+
createProgressScope
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=Progress.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/ui/progress/src/Progress.tsx"],
|
|
4
|
+
"mappings": ";AAIA,SAASA,kBAAkBC,cAAc;AAEzC,SAASC,0BAA0B;AACnC,SAASC,eAAe;AACxB,SAASC,4BAA4B;AACrC,SAASC,sBAAsB;AAC/B,YAAYC,WAAW;AAEvB,IAAMC,gBAAgB,YAEhB,CAACC,uBAAuBC,mBAAAA,IAAuBP,mBAAmBK,aAAAA,GAElE,CAACG,kBAAkBC,kBAAAA,IACvBH,sBAA4CD,aAAAA,GAMxCK,iBAAiB,qBAEVC,yBAAyBZ,OAAOI,gBAAgB;EAC3DS,MAAMF;EAENG,UAAU;IACRC,UAAU;MACRC,OAAO;QACLC,QAAQ;QACRC,OAAO;QACPC,cAAc;MAChB;IACF;EACF;EAEAC,iBAAiB;IACfL,UAAUM,QAAQC,IAAIC,qBAAqB;EAC7C;AACF,CAAA,GAIMC,oBAAoBZ,uBAAuBa,UAAU,SACzDC,OACAC,cAAY;AAEZ,MAAM,EAAEC,iBAAiBC,WAAW,GAAGC,eAAAA,IAAmBJ,OACpDK,UAAUrB,mBAAmBC,gBAAgBiB,eAAAA,GACxBG,gBAArBC,MAAMD,QAAQE,QAAOF,iBAAAA,QAAQG,WAAK,QAAbH,mBAAAA,SAAAA,iBAAiB,IAEtCI,IAAI,EAAEJ,QAAQb,UAAU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D,iBAAiB0D,IAAAA,IAAQ;UACnCvC,OAAO;QACT;MACF;IACF;EACF;EAEAE,iBAAiB;IACfL,UAAUM,QAAQC,IAAIC,qBAAqB;EAC7C;AACF,CAAA,GAUMqC,WAAWzD,qBACfmD,cAAc7B,UAA8B,SAAkBC,OAAOC,cAAY;AAC/E,MAAM;;IAEJC;IACAM,OAAO2B;IACP5B,KAAK6B;IACLC,gBAAgBnB;IAChBa,OAAO;IACP,GAAGO;EAAAA,IACDtC,OAEEO,MAAMgB,iBAAiBa,OAAAA,IAAWA,UAAUT,aAC5CnB,QAAQkB,mBAAmBS,WAAW5B,GAAAA,IAAO4B,YAAY,MACzDI,aAAajB,SAASd,KAAAA,IAAS6B,cAAc7B,OAAOD,GAAAA,IAAOM,QAC3D,CAACrB,OAAOgD,QAAAA,IAAY7D,MAAM8D,SAAS,CAAA;AAEzC,SACE,qBAAC1D,kBAAAA;IAAiB2D,OAAOxC;IAAiBM;IAAcD;IAAUf;cAChE,qBAACoC,eAAAA;MACCe,iBAAepC;MACfqC,iBAAe;MACfC,iBAAevB,SAASd,KAAAA,IAASA,QAAQK;MACzCiC,kBAAgBP;;MAEhBQ,MAAK;MACLrC,cAAYC,iBAAiBH,OAAOD,GAAAA;MACpCK,cAAYJ,SAASK;MACrBC,YAAUP;MACT,GAAI+B,cAAcjD,aAAa,MAAQ;QACtC0C;MACF;MACC,GAAGO;MACJU,UAAU,SAACC,GAAAA;YAETX;AADAE,iBAASS,EAAEC,YAAYC,OAAO3D,KAAK,IACnC8C,0BAAAA,cAAcU,cAAQ,QAAtBV,4BAAAA,UAAAA,wBAAAA,KAAAA,eAAyBW,CAAAA;MAC3B;MACAhC,KAAKhB;;;AAIb,CAAA,GACA;EACEmD,WAAWtD;AACb,CAAA;",
|
|
5
|
+
"names": ["getVariableValue", "styled", "createContextScope", "getSize", "withStaticProperties", "ThemeableStack", "React", "PROGRESS_NAME", "createProgressContext", "createProgressScope", "ProgressProvider", "useProgressContext", "INDICATOR_NAME", "ProgressIndicatorFrame", "name", "variants", "unstyled", "false", "height", "width", "backgrounded", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS", "ProgressIndicator", "styleable", "props", "forwardedRef", "__scopeProgress", "animation", "indicatorProps", "context", "pct", "max", "value", "x", "data-state", "getProgressState", "data-value", "undefined", "data-max", "animateOnly", "opacity", "ref", "defaultGetValueLabel", "Math", "round", "maxValue", "isNumber", "isValidMaxNumber", "Number", "isNaN", "isValidValueNumber", "DEFAULT_MAX", "ProgressFrame", "borderRadius", "overflow", "size", "val", "minWidth", "Progress", "valueProp", "maxProp", "getValueLabel", "progressProps", "valueLabel", "setWidth", "useState", "scope", "aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-valuetext", "role", "onLayout", "e", "nativeEvent", "layout", "Indicator"]
|
|
6
|
+
}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./Progress
|
|
2
|
-
//# sourceMappingURL=index.
|
|
1
|
+
export * from "./Progress";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/progress",
|
|
3
|
-
"version": "1.113.
|
|
3
|
+
"version": "1.113.2",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -33,18 +33,18 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@tamagui/compose-refs": "1.113.
|
|
37
|
-
"@tamagui/core": "1.113.
|
|
38
|
-
"@tamagui/create-context": "1.113.
|
|
39
|
-
"@tamagui/get-token": "1.113.
|
|
40
|
-
"@tamagui/helpers": "1.113.
|
|
41
|
-
"@tamagui/stacks": "1.113.
|
|
36
|
+
"@tamagui/compose-refs": "1.113.2",
|
|
37
|
+
"@tamagui/core": "1.113.2",
|
|
38
|
+
"@tamagui/create-context": "1.113.2",
|
|
39
|
+
"@tamagui/get-token": "1.113.2",
|
|
40
|
+
"@tamagui/helpers": "1.113.2",
|
|
41
|
+
"@tamagui/stacks": "1.113.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": "*"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@tamagui/build": "1.113.
|
|
47
|
+
"@tamagui/build": "1.113.2",
|
|
48
48
|
"react": "^18.2.0 || ^19.0.0",
|
|
49
49
|
"react-native": "0.74.1"
|
|
50
50
|
},
|