@tamagui/progress 1.114.4 → 1.115.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.
@@ -0,0 +1,172 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
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, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
32
+ var Progress_exports = {};
33
+ __export(Progress_exports, {
34
+ Progress: () => Progress,
35
+ ProgressFrame: () => ProgressFrame,
36
+ ProgressIndicator: () => ProgressIndicator,
37
+ ProgressIndicatorFrame: () => ProgressIndicatorFrame,
38
+ createProgressScope: () => createProgressScope
39
+ });
40
+ module.exports = __toCommonJS(Progress_exports);
41
+ var import_core = require("@tamagui/core"),
42
+ import_create_context = require("@tamagui/create-context"),
43
+ import_get_token = require("@tamagui/get-token"),
44
+ import_helpers = require("@tamagui/helpers"),
45
+ import_stacks = require("@tamagui/stacks"),
46
+ React = __toESM(require("react")),
47
+ import_jsx_runtime = require("react/jsx-runtime");
48
+ const PROGRESS_NAME = "Progress",
49
+ [createProgressContext, createProgressScope] = (0, import_create_context.createContextScope)(PROGRESS_NAME),
50
+ [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME),
51
+ INDICATOR_NAME = "ProgressIndicator",
52
+ ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
53
+ name: INDICATOR_NAME,
54
+ variants: {
55
+ unstyled: {
56
+ false: {
57
+ height: "100%",
58
+ width: "100%",
59
+ backgrounded: !0
60
+ }
61
+ }
62
+ },
63
+ defaultVariants: {
64
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
65
+ }
66
+ }),
67
+ ProgressIndicator = ProgressIndicatorFrame.styleable(function (props, forwardedRef) {
68
+ const {
69
+ __scopeProgress,
70
+ animation,
71
+ ...indicatorProps
72
+ } = props,
73
+ context = useProgressContext(INDICATOR_NAME, __scopeProgress),
74
+ pct = context.max - (context.value ?? 0),
75
+ x = -(context.width === 0 ? 300 : context.width) * (pct / 100);
76
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ProgressIndicatorFrame, {
77
+ "data-state": getProgressState(context.value, context.max),
78
+ "data-value": context.value ?? void 0,
79
+ "data-max": context.max,
80
+ x,
81
+ width: context.width,
82
+ ...(!props.unstyled && {
83
+ animateOnly: ["transform"],
84
+ opacity: context.width === 0 ? 0 : 1
85
+ }),
86
+ ...indicatorProps,
87
+ ref: forwardedRef,
88
+ animation: context.width ? animation : null
89
+ });
90
+ });
91
+ function defaultGetValueLabel(value, max) {
92
+ return `${Math.round(value / max * 100)}%`;
93
+ }
94
+ function getProgressState(value, maxValue) {
95
+ return value == null ? "indeterminate" : value === maxValue ? "complete" : "loading";
96
+ }
97
+ function isNumber(value) {
98
+ return typeof value == "number";
99
+ }
100
+ function isValidMaxNumber(max) {
101
+ return isNumber(max) && !Number.isNaN(max) && max > 0;
102
+ }
103
+ function isValidValueNumber(value, max) {
104
+ return isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0;
105
+ }
106
+ const DEFAULT_MAX = 100,
107
+ ProgressFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
108
+ name: "Progress",
109
+ variants: {
110
+ unstyled: {
111
+ false: {
112
+ borderRadius: 1e5,
113
+ overflow: "hidden",
114
+ backgrounded: !0
115
+ }
116
+ },
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
+ }
127
+ },
128
+ defaultVariants: {
129
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
130
+ }
131
+ }),
132
+ Progress = (0, import_helpers.withStaticProperties)(ProgressFrame.styleable(function (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
+ max = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX,
143
+ value = isValidValueNumber(valueProp, max) ? valueProp : null,
144
+ valueLabel = isNumber(value) ? getValueLabel(value, max) : void 0,
145
+ [width, setWidth] = 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 !== !0 && {
161
+ size
162
+ }),
163
+ ...progressProps,
164
+ onLayout: e => {
165
+ setWidth(e.nativeEvent.layout.width), progressProps.onLayout?.(e);
166
+ },
167
+ ref: forwardedRef
168
+ })
169
+ });
170
+ }), {
171
+ Indicator: ProgressIndicator
172
+ });
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
+ get: () => from[key],
8
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
+ });
10
+ return to;
11
+ },
12
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
14
+ value: !0
15
+ }), mod);
16
+ var src_exports = {};
17
+ module.exports = __toCommonJS(src_exports);
18
+ __reExport(src_exports, require("./Progress.cjs"), module.exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/progress",
3
- "version": "1.114.4",
3
+ "version": "1.115.0",
4
4
  "sideEffects": [
5
5
  "*.css"
6
6
  ],
@@ -29,22 +29,23 @@
29
29
  "react-native": "./dist/cjs/index.native.js",
30
30
  "types": "./types/index.d.ts",
31
31
  "import": "./dist/esm/index.mjs",
32
- "require": "./dist/cjs/index.js"
32
+ "require": "./dist/cjs/index.cjs",
33
+ "default": "./dist/cjs/index.native.js"
33
34
  }
34
35
  },
35
36
  "dependencies": {
36
- "@tamagui/compose-refs": "1.114.4",
37
- "@tamagui/core": "1.114.4",
38
- "@tamagui/create-context": "1.114.4",
39
- "@tamagui/get-token": "1.114.4",
40
- "@tamagui/helpers": "1.114.4",
41
- "@tamagui/stacks": "1.114.4"
37
+ "@tamagui/compose-refs": "1.115.0",
38
+ "@tamagui/core": "1.115.0",
39
+ "@tamagui/create-context": "1.115.0",
40
+ "@tamagui/get-token": "1.115.0",
41
+ "@tamagui/helpers": "1.115.0",
42
+ "@tamagui/stacks": "1.115.0"
42
43
  },
43
44
  "peerDependencies": {
44
45
  "react": "*"
45
46
  },
46
47
  "devDependencies": {
47
- "@tamagui/build": "1.114.4",
48
+ "@tamagui/build": "1.115.0",
48
49
  "react": "^18.2.0 || ^19.0.0",
49
50
  "react-native": "0.74.1"
50
51
  },
@@ -1,143 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
15
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
- // If the importer is in node compatibility mode or this is not an ESM
17
- // file that has been converted to a CommonJS file using a Babel-
18
- // compatible transform (i.e. "__esModule" has not been set), then set
19
- // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
- var Progress_exports = {};
24
- __export(Progress_exports, {
25
- Progress: () => Progress,
26
- ProgressFrame: () => ProgressFrame,
27
- ProgressIndicator: () => ProgressIndicator,
28
- ProgressIndicatorFrame: () => ProgressIndicatorFrame,
29
- createProgressScope: () => createProgressScope
30
- });
31
- module.exports = __toCommonJS(Progress_exports);
32
- var import_core = require("@tamagui/core"), import_create_context = require("@tamagui/create-context"), import_get_token = require("@tamagui/get-token"), import_helpers = require("@tamagui/helpers"), import_stacks = require("@tamagui/stacks"), React = __toESM(require("react")), import_jsx_runtime = require("react/jsx-runtime");
33
- const PROGRESS_NAME = "Progress", [createProgressContext, createProgressScope] = (0, import_create_context.createContextScope)(PROGRESS_NAME), [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME), INDICATOR_NAME = "ProgressIndicator", ProgressIndicatorFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
34
- name: INDICATOR_NAME,
35
- variants: {
36
- unstyled: {
37
- false: {
38
- height: "100%",
39
- width: "100%",
40
- backgrounded: !0
41
- }
42
- }
43
- },
44
- defaultVariants: {
45
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
46
- }
47
- }), ProgressIndicator = ProgressIndicatorFrame.styleable(function(props, forwardedRef) {
48
- const { __scopeProgress, animation, ...indicatorProps } = props, context = useProgressContext(INDICATOR_NAME, __scopeProgress), pct = context.max - (context.value ?? 0), x = -(context.width === 0 ? 300 : context.width) * (pct / 100);
49
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
50
- ProgressIndicatorFrame,
51
- {
52
- "data-state": getProgressState(context.value, context.max),
53
- "data-value": context.value ?? void 0,
54
- "data-max": context.max,
55
- x,
56
- width: context.width,
57
- ...!props.unstyled && {
58
- animateOnly: ["transform"],
59
- opacity: context.width === 0 ? 0 : 1
60
- },
61
- ...indicatorProps,
62
- ref: forwardedRef,
63
- animation: context.width ? animation : null
64
- }
65
- );
66
- });
67
- function defaultGetValueLabel(value, max) {
68
- return `${Math.round(value / max * 100)}%`;
69
- }
70
- function getProgressState(value, maxValue) {
71
- return value == null ? "indeterminate" : value === maxValue ? "complete" : "loading";
72
- }
73
- function isNumber(value) {
74
- return typeof value == "number";
75
- }
76
- function isValidMaxNumber(max) {
77
- return isNumber(max) && !Number.isNaN(max) && max > 0;
78
- }
79
- function isValidValueNumber(value, max) {
80
- return isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0;
81
- }
82
- const DEFAULT_MAX = 100, ProgressFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
83
- name: "Progress",
84
- variants: {
85
- unstyled: {
86
- false: {
87
- borderRadius: 1e5,
88
- overflow: "hidden",
89
- backgrounded: !0
90
- }
91
- },
92
- size: {
93
- "...size": (val) => {
94
- const size = Math.round((0, import_core.getVariableValue)((0, import_get_token.getSize)(val)) * 0.25);
95
- return {
96
- height: size,
97
- minWidth: (0, import_core.getVariableValue)(size) * 20,
98
- width: "100%"
99
- };
100
- }
101
- }
102
- },
103
- defaultVariants: {
104
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
105
- }
106
- }), Progress = (0, import_helpers.withStaticProperties)(
107
- ProgressFrame.styleable(function(props, forwardedRef) {
108
- const {
109
- // @ts-expect-error
110
- __scopeProgress,
111
- value: valueProp,
112
- max: maxProp,
113
- getValueLabel = defaultGetValueLabel,
114
- size = "$true",
115
- ...progressProps
116
- } = 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);
117
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressProvider, { scope: __scopeProgress, value, max, width, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
118
- ProgressFrame,
119
- {
120
- "aria-valuemax": max,
121
- "aria-valuemin": 0,
122
- "aria-valuenow": isNumber(value) ? value : void 0,
123
- "aria-valuetext": valueLabel,
124
- role: "progressbar",
125
- "data-state": getProgressState(value, max),
126
- "data-value": value ?? void 0,
127
- "data-max": max,
128
- ...progressProps.unstyled !== !0 && {
129
- size
130
- },
131
- ...progressProps,
132
- onLayout: (e) => {
133
- setWidth(e.nativeEvent.layout.width), progressProps.onLayout?.(e);
134
- },
135
- ref: forwardedRef
136
- }
137
- ) });
138
- }),
139
- {
140
- Indicator: ProgressIndicator
141
- }
142
- );
143
- //# sourceMappingURL=Progress.js.map
package/dist/cjs/index.js DELETED
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from == "object" || typeof from == "function")
7
- for (let key of __getOwnPropNames(from))
8
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
- return to;
10
- }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
11
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
12
- var src_exports = {};
13
- module.exports = __toCommonJS(src_exports);
14
- __reExport(src_exports, require("./Progress"), module.exports);
15
- //# sourceMappingURL=index.js.map
File without changes
File without changes