@tamagui/progress 2.0.0-rc.4 → 2.0.0-rc.40-1776053246040

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.
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
14
  get: () => from[key],
14
15
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
16
  });
16
- return to;
17
- };
17
+ }
18
+ return to;
19
+ };
18
20
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
21
+ value: true
20
22
  }), mod);
21
23
  var Progress_exports = {};
22
24
  __export(Progress_exports, {
@@ -27,63 +29,65 @@ __export(Progress_exports, {
27
29
  createProgressScope: () => createProgressScope
28
30
  });
29
31
  module.exports = __toCommonJS(Progress_exports);
30
- var import_core = require("@tamagui/core"),
31
- import_create_context = require("@tamagui/create-context"),
32
- import_get_token = require("@tamagui/get-token"),
33
- import_helpers = require("@tamagui/helpers"),
34
- import_stacks = require("@tamagui/stacks"),
35
- import_react = require("react"),
36
- import_jsx_runtime = require("react/jsx-runtime");
37
- const PROGRESS_NAME = "Progress",
38
- [createProgressContext, createProgressScope] = (0, import_create_context.createContextScope)(PROGRESS_NAME),
39
- [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME),
40
- INDICATOR_NAME = "ProgressIndicator",
41
- ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {
42
- name: INDICATOR_NAME,
43
- variants: {
44
- unstyled: {
45
- false: {
46
- height: "100%",
47
- width: "100%",
48
- backgroundColor: "$background"
49
- }
32
+ var import_core = require("@tamagui/core");
33
+ var import_create_context = require("@tamagui/create-context");
34
+ var import_get_token = require("@tamagui/get-token");
35
+ var import_helpers = require("@tamagui/helpers");
36
+ var import_stacks = require("@tamagui/stacks");
37
+ var import_react = require("react");
38
+ var import_jsx_runtime = require("react/jsx-runtime");
39
+ const PROGRESS_NAME = "Progress";
40
+ const [createProgressContext, createProgressScope] = (0, import_create_context.createContextScope)(PROGRESS_NAME);
41
+ const [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME);
42
+ const INDICATOR_NAME = "ProgressIndicator";
43
+ const ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {
44
+ name: INDICATOR_NAME,
45
+ variants: {
46
+ unstyled: {
47
+ false: {
48
+ height: "100%",
49
+ width: "100%",
50
+ backgroundColor: "$background"
50
51
  }
51
- },
52
- defaultVariants: {
53
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
54
- }
55
- }),
56
- ProgressIndicator = ProgressIndicatorFrame.styleable(function (props, forwardedRef) {
57
- const {
58
- __scopeProgress,
59
- transition,
60
- ...indicatorProps
61
- } = props,
62
- context = useProgressContext(INDICATOR_NAME, __scopeProgress),
63
- progressRatio = (context.value ?? 0) / context.max;
64
- let x;
65
- if (import_core.isWeb) x = `${-100 + progressRatio * 50}%`;else {
66
- const baseWidth = context.width || 0;
67
- x = Math.ceil(-baseWidth * (2 - progressRatio));
68
52
  }
69
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ProgressIndicatorFrame, {
70
- "data-state": getProgressState(context.value, context.max),
71
- "data-value": context.value ?? void 0,
72
- "data-max": context.max,
73
- x,
74
- width: "200%",
75
- ...(!props.unstyled && {
76
- animateOnly: ["transform"],
77
- // on native, hide until we have width measurement
78
- ...(!import_core.isWeb && context.width === 0 && {
79
- opacity: 0
80
- })
81
- }),
82
- ...indicatorProps,
83
- ref: forwardedRef,
84
- transition: !import_core.isWeb && !context.width ? null : transition
85
- });
53
+ },
54
+ defaultVariants: {
55
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
56
+ }
57
+ });
58
+ const ProgressIndicator = ProgressIndicatorFrame.styleable(function ProgressIndicator2(props, forwardedRef) {
59
+ const {
60
+ __scopeProgress,
61
+ transition,
62
+ ...indicatorProps
63
+ } = props;
64
+ const context = useProgressContext(INDICATOR_NAME, __scopeProgress);
65
+ const progressRatio = (context.value ?? 0) / context.max;
66
+ let x;
67
+ if (import_core.isWeb) {
68
+ x = `${-100 + progressRatio * 50}%`;
69
+ } else {
70
+ const baseWidth = context.width || 0;
71
+ x = Math.ceil(-baseWidth * (2 - progressRatio));
72
+ }
73
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ProgressIndicatorFrame, {
74
+ "data-state": getProgressState(context.value, context.max),
75
+ "data-value": context.value ?? void 0,
76
+ "data-max": context.max,
77
+ x,
78
+ width: "200%",
79
+ ...(!props.unstyled && {
80
+ animateOnly: ["transform"],
81
+ // on native, hide until we have width measurement
82
+ ...(!import_core.isWeb && context.width === 0 && {
83
+ opacity: 0
84
+ })
85
+ }),
86
+ ...indicatorProps,
87
+ ref: forwardedRef,
88
+ transition: !import_core.isWeb && !context.width ? null : transition
86
89
  });
90
+ });
87
91
  function defaultGetValueLabel(value, max) {
88
92
  return `${Math.round(value / max * 100)}%`;
89
93
  }
@@ -91,7 +95,7 @@ function getProgressState(value, maxValue) {
91
95
  return value == null ? "indeterminate" : value === maxValue ? "complete" : "loading";
92
96
  }
93
97
  function isNumber(value) {
94
- return typeof value == "number";
98
+ return typeof value === "number";
95
99
  }
96
100
  function isValidMaxNumber(max) {
97
101
  return isNumber(max) && !Number.isNaN(max) && max > 0;
@@ -99,73 +103,76 @@ function isValidMaxNumber(max) {
99
103
  function isValidValueNumber(value, max) {
100
104
  return isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0;
101
105
  }
102
- const DEFAULT_MAX = 100,
103
- ProgressFrame = (0, import_core.styled)(import_stacks.YStack, {
104
- name: "Progress",
105
- variants: {
106
- unstyled: {
107
- false: {
108
- borderRadius: 1e5,
109
- overflow: "hidden",
110
- backgroundColor: "$background"
111
- }
112
- },
113
- size: {
114
- "...size": val => {
115
- const size = Math.round((0, import_core.getVariableValue)((0, import_get_token.getSize)(val)) * 0.25);
116
- return {
117
- height: size,
118
- minWidth: (0, import_core.getVariableValue)(size) * 20,
119
- width: "100%"
120
- };
121
- }
106
+ const DEFAULT_MAX = 100;
107
+ const ProgressFrame = (0, import_core.styled)(import_stacks.YStack, {
108
+ name: "Progress",
109
+ variants: {
110
+ unstyled: {
111
+ false: {
112
+ borderRadius: 1e5,
113
+ overflow: "hidden",
114
+ backgroundColor: "$background"
122
115
  }
123
116
  },
124
- defaultVariants: {
125
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
117
+ size: {
118
+ "...size": val => {
119
+ const size = Math.round((0, import_core.getVariableValue)((0, import_get_token.getSize)(val)) * 0.25);
120
+ return {
121
+ height: size,
122
+ minWidth: (0, import_core.getVariableValue)(size) * 20,
123
+ width: "100%"
124
+ };
125
+ }
126
126
  }
127
- }),
128
- Progress = (0, import_helpers.withStaticProperties)(ProgressFrame.styleable(function (props, forwardedRef) {
129
- const {
130
- // @ts-expect-error
131
- __scopeProgress,
132
- value: valueProp,
133
- max: maxProp,
134
- getValueLabel = defaultGetValueLabel,
135
- size = "$true",
136
- ...progressProps
137
- } = props,
138
- max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX,
139
- value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null,
140
- valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0,
141
- [width, setWidth] = (0, import_react.useState)(0);
142
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ProgressProvider, {
143
- scope: __scopeProgress,
144
- value,
145
- max,
146
- width,
147
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ProgressFrame, {
148
- "aria-valuemax": max,
149
- "aria-valuemin": 0,
150
- "aria-valuenow": isNumber(value) ? value : void 0,
151
- "aria-valuetext": valueLabel,
152
- role: "progressbar",
153
- "data-state": getProgressState(value, max),
154
- "data-value": value ?? void 0,
155
- "data-max": max,
156
- ...(progressProps.unstyled !== !0 && {
157
- size
158
- }),
159
- ...progressProps,
160
- ...(!import_core.isWeb && {
161
- onLayout: e => {
162
- const newWidth = Math.round(e.nativeEvent.layout.width);
163
- newWidth !== width && setWidth(newWidth), progressProps.onLayout?.(e);
127
+ },
128
+ defaultVariants: {
129
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
130
+ }
131
+ });
132
+ const Progress = (0, import_helpers.withStaticProperties)(ProgressFrame.styleable(function Progress2(props, forwardedRef) {
133
+ const {
134
+ // @ts-expect-error
135
+ __scopeProgress,
136
+ value: valueProp,
137
+ max: maxProp,
138
+ getValueLabel = defaultGetValueLabel,
139
+ size = "$true",
140
+ ...progressProps
141
+ } = props;
142
+ const max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;
143
+ const value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;
144
+ const valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0;
145
+ const [width, setWidth] = (0, import_react.useState)(0);
146
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ProgressProvider, {
147
+ scope: __scopeProgress,
148
+ value,
149
+ max,
150
+ width,
151
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ProgressFrame, {
152
+ "aria-valuemax": max,
153
+ "aria-valuemin": 0,
154
+ "aria-valuenow": isNumber(value) ? value : void 0,
155
+ "aria-valuetext": valueLabel,
156
+ role: "progressbar",
157
+ "data-state": getProgressState(value, max),
158
+ "data-value": value ?? void 0,
159
+ "data-max": max,
160
+ ...(progressProps.unstyled !== true && {
161
+ size
162
+ }),
163
+ ...progressProps,
164
+ ...(!import_core.isWeb && {
165
+ onLayout: e => {
166
+ const newWidth = Math.round(e.nativeEvent.layout.width);
167
+ if (newWidth !== width) {
168
+ setWidth(newWidth);
164
169
  }
165
- }),
166
- ref: forwardedRef
167
- })
168
- });
169
- }), {
170
- Indicator: ProgressIndicator
171
- });
170
+ progressProps.onLayout?.(e);
171
+ }
172
+ }),
173
+ ref: forwardedRef
174
+ })
175
+ });
176
+ }), {
177
+ Indicator: ProgressIndicator
178
+ });
@@ -5,20 +5,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: !0
23
+ value: true
22
24
  }), mod);
23
25
  var Progress_exports = {};
24
26
  __export(Progress_exports, {
@@ -29,65 +31,67 @@ __export(Progress_exports, {
29
31
  createProgressScope: () => createProgressScope
30
32
  });
31
33
  module.exports = __toCommonJS(Progress_exports);
32
- var import_jsx_runtime = require("react/jsx-runtime"),
33
- import_core = require("@tamagui/core"),
34
- import_create_context = require("@tamagui/create-context"),
35
- import_get_token = require("@tamagui/get-token"),
36
- import_helpers = require("@tamagui/helpers"),
37
- import_stacks = require("@tamagui/stacks"),
38
- import_react = require("react"),
39
- PROGRESS_NAME = "Progress",
40
- [createProgressContext, createProgressScope] = (0, import_create_context.createContextScope)(PROGRESS_NAME),
41
- [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME),
42
- INDICATOR_NAME = "ProgressIndicator",
43
- ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {
44
- name: INDICATOR_NAME,
45
- variants: {
46
- unstyled: {
47
- false: {
48
- height: "100%",
49
- width: "100%",
50
- backgroundColor: "$background"
51
- }
34
+ var import_jsx_runtime = require("react/jsx-runtime");
35
+ var import_core = require("@tamagui/core");
36
+ var import_create_context = require("@tamagui/create-context");
37
+ var import_get_token = require("@tamagui/get-token");
38
+ var import_helpers = require("@tamagui/helpers");
39
+ var import_stacks = require("@tamagui/stacks");
40
+ var import_react = require("react");
41
+ var PROGRESS_NAME = "Progress";
42
+ var [createProgressContext, createProgressScope] = (0, import_create_context.createContextScope)(PROGRESS_NAME);
43
+ var [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME);
44
+ var INDICATOR_NAME = "ProgressIndicator";
45
+ var ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.YStack, {
46
+ name: INDICATOR_NAME,
47
+ variants: {
48
+ unstyled: {
49
+ false: {
50
+ height: "100%",
51
+ width: "100%",
52
+ backgroundColor: "$background"
52
53
  }
53
- },
54
- defaultVariants: {
55
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
56
- }
57
- }),
58
- ProgressIndicator = ProgressIndicatorFrame.styleable(function (props, forwardedRef) {
59
- var {
60
- __scopeProgress,
61
- transition,
62
- ...indicatorProps
63
- } = props,
64
- context = useProgressContext(INDICATOR_NAME, __scopeProgress),
65
- _context_value,
66
- progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max,
67
- x;
68
- if (import_core.isWeb) x = `${-100 + progressRatio * 50}%`;else {
69
- var baseWidth = context.width || 0;
70
- x = Math.ceil(-baseWidth * (2 - progressRatio));
71
54
  }
72
- var _context_value1;
73
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ProgressIndicatorFrame, {
74
- "data-state": getProgressState(context.value, context.max),
75
- "data-value": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,
76
- "data-max": context.max,
77
- x,
78
- width: "200%",
79
- ...(!props.unstyled && {
80
- animateOnly: ["transform"],
81
- // on native, hide until we have width measurement
82
- ...(!import_core.isWeb && context.width === 0 && {
83
- opacity: 0
84
- })
85
- }),
86
- ...indicatorProps,
87
- ref: forwardedRef,
88
- transition: !import_core.isWeb && !context.width ? null : transition
89
- });
55
+ },
56
+ defaultVariants: {
57
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
58
+ }
59
+ });
60
+ var ProgressIndicator = ProgressIndicatorFrame.styleable(function ProgressIndicator2(props, forwardedRef) {
61
+ var {
62
+ __scopeProgress,
63
+ transition,
64
+ ...indicatorProps
65
+ } = props;
66
+ var context = useProgressContext(INDICATOR_NAME, __scopeProgress);
67
+ var _context_value;
68
+ var progressRatio = ((_context_value = context.value) !== null && _context_value !== void 0 ? _context_value : 0) / context.max;
69
+ var x;
70
+ if (import_core.isWeb) {
71
+ x = `${-100 + progressRatio * 50}%`;
72
+ } else {
73
+ var baseWidth = context.width || 0;
74
+ x = Math.ceil(-baseWidth * (2 - progressRatio));
75
+ }
76
+ var _context_value1;
77
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ProgressIndicatorFrame, {
78
+ "data-state": getProgressState(context.value, context.max),
79
+ "data-value": (_context_value1 = context.value) !== null && _context_value1 !== void 0 ? _context_value1 : void 0,
80
+ "data-max": context.max,
81
+ x,
82
+ width: "200%",
83
+ ...(!props.unstyled && {
84
+ animateOnly: ["transform"],
85
+ // on native, hide until we have width measurement
86
+ ...(!import_core.isWeb && context.width === 0 && {
87
+ opacity: 0
88
+ })
89
+ }),
90
+ ...indicatorProps,
91
+ ref: forwardedRef,
92
+ transition: !import_core.isWeb && !context.width ? null : transition
90
93
  });
94
+ });
91
95
  function defaultGetValueLabel(value, max) {
92
96
  return `${Math.round(value / max * 100)}%`;
93
97
  }
@@ -95,7 +99,7 @@ function getProgressState(value, maxValue) {
95
99
  return value == null ? "indeterminate" : value === maxValue ? "complete" : "loading";
96
100
  }
97
101
  function isNumber(value) {
98
- return typeof value == "number";
102
+ return typeof value === "number";
99
103
  }
100
104
  function isValidMaxNumber(max) {
101
105
  return isNumber(max) && !Number.isNaN(max) && max > 0;
@@ -103,76 +107,79 @@ function isValidMaxNumber(max) {
103
107
  function isValidValueNumber(value, max) {
104
108
  return isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0;
105
109
  }
106
- var DEFAULT_MAX = 100,
107
- ProgressFrame = (0, import_core.styled)(import_stacks.YStack, {
108
- name: "Progress",
109
- variants: {
110
- unstyled: {
111
- false: {
112
- borderRadius: 1e5,
113
- overflow: "hidden",
114
- backgroundColor: "$background"
115
- }
116
- },
117
- size: {
118
- "...size": function (val) {
119
- var size = Math.round((0, import_core.getVariableValue)((0, import_get_token.getSize)(val)) * 0.25);
120
- return {
121
- height: size,
122
- minWidth: (0, import_core.getVariableValue)(size) * 20,
123
- width: "100%"
124
- };
125
- }
110
+ var DEFAULT_MAX = 100;
111
+ var ProgressFrame = (0, import_core.styled)(import_stacks.YStack, {
112
+ name: "Progress",
113
+ variants: {
114
+ unstyled: {
115
+ false: {
116
+ borderRadius: 1e5,
117
+ overflow: "hidden",
118
+ backgroundColor: "$background"
126
119
  }
127
120
  },
128
- defaultVariants: {
129
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
121
+ size: {
122
+ "...size": function (val) {
123
+ var size = Math.round((0, import_core.getVariableValue)((0, import_get_token.getSize)(val)) * 0.25);
124
+ return {
125
+ height: size,
126
+ minWidth: (0, import_core.getVariableValue)(size) * 20,
127
+ width: "100%"
128
+ };
129
+ }
130
130
  }
131
- }),
132
- Progress = (0, import_helpers.withStaticProperties)(ProgressFrame.styleable(function (props, forwardedRef) {
133
- var {
134
- // @ts-expect-error
135
- __scopeProgress,
136
- value: valueProp,
137
- max: maxProp,
138
- getValueLabel = defaultGetValueLabel,
139
- size = "$true",
140
- ...progressProps
141
- } = props,
142
- max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX,
143
- value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null,
144
- valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0,
145
- [width, setWidth] = (0, import_react.useState)(0);
146
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ProgressProvider, {
147
- scope: __scopeProgress,
148
- value,
149
- max,
150
- width,
151
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ProgressFrame, {
152
- "aria-valuemax": max,
153
- "aria-valuemin": 0,
154
- "aria-valuenow": isNumber(value) ? value : void 0,
155
- "aria-valuetext": valueLabel,
156
- // @ts-ignore
157
- role: "progressbar",
158
- "data-state": getProgressState(value, max),
159
- "data-value": value ?? void 0,
160
- "data-max": max,
161
- ...(progressProps.unstyled !== !0 && {
162
- size
163
- }),
164
- ...progressProps,
165
- ...(!import_core.isWeb && {
166
- onLayout: function (e) {
167
- var _progressProps_onLayout,
168
- newWidth = Math.round(e.nativeEvent.layout.width);
169
- newWidth !== width && setWidth(newWidth), (_progressProps_onLayout = progressProps.onLayout) === null || _progressProps_onLayout === void 0 || _progressProps_onLayout.call(progressProps, e);
131
+ },
132
+ defaultVariants: {
133
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
134
+ }
135
+ });
136
+ var Progress = (0, import_helpers.withStaticProperties)(ProgressFrame.styleable(function Progress2(props, forwardedRef) {
137
+ var {
138
+ // @ts-expect-error
139
+ __scopeProgress,
140
+ value: valueProp,
141
+ max: maxProp,
142
+ getValueLabel = defaultGetValueLabel,
143
+ size = "$true",
144
+ ...progressProps
145
+ } = props;
146
+ var max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;
147
+ var value = isValidValueNumber(valueProp, max) ? Math.round(valueProp) : null;
148
+ var valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0;
149
+ var [width, setWidth] = (0, import_react.useState)(0);
150
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ProgressProvider, {
151
+ scope: __scopeProgress,
152
+ value,
153
+ max,
154
+ width,
155
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ProgressFrame, {
156
+ "aria-valuemax": max,
157
+ "aria-valuemin": 0,
158
+ "aria-valuenow": isNumber(value) ? value : void 0,
159
+ "aria-valuetext": valueLabel,
160
+ // @ts-ignore
161
+ role: "progressbar",
162
+ "data-state": getProgressState(value, max),
163
+ "data-value": value !== null && value !== void 0 ? value : void 0,
164
+ "data-max": max,
165
+ ...(progressProps.unstyled !== true && {
166
+ size
167
+ }),
168
+ ...progressProps,
169
+ ...(!import_core.isWeb && {
170
+ onLayout: function (e) {
171
+ var _progressProps_onLayout;
172
+ var newWidth = Math.round(e.nativeEvent.layout.width);
173
+ if (newWidth !== width) {
174
+ setWidth(newWidth);
170
175
  }
171
- }),
172
- ref: forwardedRef
173
- })
174
- });
175
- }), {
176
- Indicator: ProgressIndicator
176
+ (_progressProps_onLayout = progressProps.onLayout) === null || _progressProps_onLayout === void 0 ? void 0 : _progressProps_onLayout.call(progressProps, e);
177
+ }
178
+ }),
179
+ ref: forwardedRef
180
+ })
177
181
  });
182
+ }), {
183
+ Indicator: ProgressIndicator
184
+ });
178
185
  //# sourceMappingURL=Progress.native.js.map