@hanzogui/progress 3.0.2 → 7.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzogui/progress",
3
- "version": "3.0.2",
3
+ "version": "7.0.0",
4
4
  "source": "src/index.ts",
5
5
  "files": [
6
6
  "src",
@@ -30,21 +30,21 @@
30
30
  "access": "public"
31
31
  },
32
32
  "scripts": {
33
- "build": "hanzo-gui-build",
34
- "watch": "hanzo-gui-build --watch",
35
- "clean": "hanzo-gui-build clean",
36
- "clean:build": "hanzo-gui-build clean:build"
33
+ "build": "hanzogui-build",
34
+ "watch": "hanzogui-build --watch",
35
+ "clean": "hanzogui-build clean",
36
+ "clean:build": "hanzogui-build clean:build"
37
37
  },
38
38
  "dependencies": {
39
- "@hanzogui/compose-refs": "3.0.1",
40
- "@hanzogui/core": "3.0.1",
41
- "@hanzogui/create-context": "3.0.1",
42
- "@hanzogui/get-token": "3.0.1",
43
- "@hanzogui/helpers": "3.0.1",
44
- "@hanzogui/stacks": "3.0.1"
39
+ "@hanzogui/compose-refs": "^7.0.0",
40
+ "@hanzogui/core": "^7.0.0",
41
+ "@hanzogui/create-context": "^7.0.0",
42
+ "@hanzogui/get-token": "^7.0.0",
43
+ "@hanzogui/helpers": "^7.0.0",
44
+ "@hanzogui/stacks": "^7.0.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@hanzogui/build": "3.0.1",
47
+ "@hanzogui/build": "^7.0.0",
48
48
  "react": ">=19",
49
49
  "react-native": "0.83.2"
50
50
  },
@@ -53,4 +53,4 @@
53
53
  "react-native": "*"
54
54
  },
55
55
  "module:jsx": "dist/jsx"
56
- }
56
+ }
package/src/Progress.tsx CHANGED
@@ -43,7 +43,7 @@ export const ProgressIndicatorFrame = styled(YStack, {
43
43
  } as const,
44
44
 
45
45
  defaultVariants: {
46
- unstyled: process.env.HANZO_GUI_HEADLESS === '1',
46
+ unstyled: process.env.HANZOGUI_HEADLESS === '1',
47
47
  },
48
48
  })
49
49
 
@@ -154,7 +154,7 @@ export const ProgressFrame = styled(YStack, {
154
154
  } as const,
155
155
 
156
156
  defaultVariants: {
157
- unstyled: process.env.HANZO_GUI_HEADLESS === '1',
157
+ unstyled: process.env.HANZOGUI_HEADLESS === '1',
158
158
  },
159
159
  })
160
160
 
@@ -1,69 +1,69 @@
1
- import type { GetProps } from '@gui/core';
2
- declare const createProgressScope: import("@gui/create-context").CreateScope;
3
- export declare const ProgressIndicatorFrame: import("@gui/core").GuiComponent<import("@gui/core").TamaDefer, import("@gui/core").GuiElement, import("@gui/core").RNGuiViewNonStyleProps, import("@gui/core").StackStyleBase, {
1
+ import type { GetProps } from '@hanzogui/core';
2
+ declare const createProgressScope: import("@hanzogui/create-context").CreateScope;
3
+ export declare const ProgressIndicatorFrame: import("@hanzogui/core").HanzoguiComponent<import("@hanzogui/core").TamaDefer, import("@hanzogui/core").HanzoguiElement, import("@hanzogui/core").RNHanzoguiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
4
4
  unstyled?: boolean | undefined;
5
- elevation?: number | import("@gui/core").SizeTokens | undefined;
5
+ elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
6
6
  fullscreen?: boolean | undefined;
7
- }, import("@gui/core").StaticConfigPublic>;
7
+ }, import("@hanzogui/core").StaticConfigPublic>;
8
8
  export type ProgressIndicatorProps = GetProps<typeof ProgressIndicatorFrame>;
9
- declare const ProgressIndicator: import("@gui/core").GuiComponent<import("@gui/core").GetFinalProps<import("@gui/core").RNGuiViewNonStyleProps, import("@gui/core").StackStyleBase, {
9
+ declare const ProgressIndicator: import("@hanzogui/core").HanzoguiComponent<import("@hanzogui/core").GetFinalProps<import("@hanzogui/core").RNHanzoguiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
10
10
  unstyled?: boolean | undefined;
11
- elevation?: number | import("@gui/core").SizeTokens | undefined;
11
+ elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
12
12
  fullscreen?: boolean | undefined;
13
- }>, import("@gui/core").GuiElement, import("@gui/core").RNGuiViewNonStyleProps & void, import("@gui/core").StackStyleBase, {
13
+ }>, import("@hanzogui/core").HanzoguiElement, import("@hanzogui/core").RNHanzoguiViewNonStyleProps & void, import("@hanzogui/core").StackStyleBase, {
14
14
  unstyled?: boolean | undefined;
15
- elevation?: number | import("@gui/core").SizeTokens | undefined;
15
+ elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
16
16
  fullscreen?: boolean | undefined;
17
- }, import("@gui/core").StaticConfigPublic>;
18
- export declare const ProgressFrame: import("@gui/core").GuiComponent<import("@gui/core").TamaDefer, import("@gui/core").GuiElement, import("@gui/core").RNGuiViewNonStyleProps, import("@gui/core").StackStyleBase, {
17
+ }, import("@hanzogui/core").StaticConfigPublic>;
18
+ export declare const ProgressFrame: import("@hanzogui/core").HanzoguiComponent<import("@hanzogui/core").TamaDefer, import("@hanzogui/core").HanzoguiElement, import("@hanzogui/core").RNHanzoguiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
19
19
  unstyled?: boolean | undefined;
20
- elevation?: number | import("@gui/core").SizeTokens | undefined;
20
+ elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
21
21
  fullscreen?: boolean | undefined;
22
- size?: import("@gui/core").SizeTokens | undefined;
23
- }, import("@gui/core").StaticConfigPublic>;
22
+ size?: import("@hanzogui/core").SizeTokens | undefined;
23
+ }, import("@hanzogui/core").StaticConfigPublic>;
24
24
  export interface ProgressExtraProps {
25
25
  value?: number | null | undefined;
26
26
  max?: number;
27
27
  getValueLabel?(value: number, max: number): string;
28
28
  }
29
29
  export type ProgressProps = GetProps<typeof ProgressFrame> & ProgressExtraProps;
30
- declare const Progress: import("react").ForwardRefExoticComponent<Omit<import("@gui/core").GetFinalProps<import("@gui/core").RNGuiViewNonStyleProps, import("@gui/core").StackStyleBase, {
30
+ declare const Progress: import("react").ForwardRefExoticComponent<Omit<import("@hanzogui/core").GetFinalProps<import("@hanzogui/core").RNHanzoguiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
31
31
  unstyled?: boolean | undefined;
32
- elevation?: number | import("@gui/core").SizeTokens | undefined;
32
+ elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
33
33
  fullscreen?: boolean | undefined;
34
- size?: import("@gui/core").SizeTokens | undefined;
35
- }>, keyof ProgressExtraProps> & ProgressExtraProps & import("react").RefAttributes<import("@gui/core").GuiElement>> & import("@gui/core").StaticComponentObject<Omit<import("@gui/core").GetFinalProps<import("@gui/core").RNGuiViewNonStyleProps, import("@gui/core").StackStyleBase, {
34
+ size?: import("@hanzogui/core").SizeTokens | undefined;
35
+ }>, keyof ProgressExtraProps> & ProgressExtraProps & import("react").RefAttributes<import("@hanzogui/core").HanzoguiElement>> & import("@hanzogui/core").StaticComponentObject<Omit<import("@hanzogui/core").GetFinalProps<import("@hanzogui/core").RNHanzoguiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
36
36
  unstyled?: boolean | undefined;
37
- elevation?: number | import("@gui/core").SizeTokens | undefined;
37
+ elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
38
38
  fullscreen?: boolean | undefined;
39
- size?: import("@gui/core").SizeTokens | undefined;
40
- }>, keyof ProgressExtraProps> & ProgressExtraProps, import("@gui/core").GuiElement, import("@gui/core").RNGuiViewNonStyleProps & ProgressExtraProps, import("@gui/core").StackStyleBase, {
39
+ size?: import("@hanzogui/core").SizeTokens | undefined;
40
+ }>, keyof ProgressExtraProps> & ProgressExtraProps, import("@hanzogui/core").HanzoguiElement, import("@hanzogui/core").RNHanzoguiViewNonStyleProps & ProgressExtraProps, import("@hanzogui/core").StackStyleBase, {
41
41
  unstyled?: boolean | undefined;
42
- elevation?: number | import("@gui/core").SizeTokens | undefined;
42
+ elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
43
43
  fullscreen?: boolean | undefined;
44
- size?: import("@gui/core").SizeTokens | undefined;
45
- }, import("@gui/core").StaticConfigPublic> & Omit<import("@gui/core").StaticConfigPublic, "staticConfig" | "styleable"> & {
46
- __tama: [Omit<import("@gui/core").GetFinalProps<import("@gui/core").RNGuiViewNonStyleProps, import("@gui/core").StackStyleBase, {
44
+ size?: import("@hanzogui/core").SizeTokens | undefined;
45
+ }, import("@hanzogui/core").StaticConfigPublic> & Omit<import("@hanzogui/core").StaticConfigPublic, "staticConfig" | "styleable"> & {
46
+ __tama: [Omit<import("@hanzogui/core").GetFinalProps<import("@hanzogui/core").RNHanzoguiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
47
47
  unstyled?: boolean | undefined;
48
- elevation?: number | import("@gui/core").SizeTokens | undefined;
48
+ elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
49
49
  fullscreen?: boolean | undefined;
50
- size?: import("@gui/core").SizeTokens | undefined;
51
- }>, keyof ProgressExtraProps> & ProgressExtraProps, import("@gui/core").GuiElement, import("@gui/core").RNGuiViewNonStyleProps & ProgressExtraProps, import("@gui/core").StackStyleBase, {
50
+ size?: import("@hanzogui/core").SizeTokens | undefined;
51
+ }>, keyof ProgressExtraProps> & ProgressExtraProps, import("@hanzogui/core").HanzoguiElement, import("@hanzogui/core").RNHanzoguiViewNonStyleProps & ProgressExtraProps, import("@hanzogui/core").StackStyleBase, {
52
52
  unstyled?: boolean | undefined;
53
- elevation?: number | import("@gui/core").SizeTokens | undefined;
53
+ elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
54
54
  fullscreen?: boolean | undefined;
55
- size?: import("@gui/core").SizeTokens | undefined;
56
- }, import("@gui/core").StaticConfigPublic];
55
+ size?: import("@hanzogui/core").SizeTokens | undefined;
56
+ }, import("@hanzogui/core").StaticConfigPublic];
57
57
  } & {
58
- Indicator: import("@gui/core").GuiComponent<import("@gui/core").GetFinalProps<import("@gui/core").RNGuiViewNonStyleProps, import("@gui/core").StackStyleBase, {
58
+ Indicator: import("@hanzogui/core").HanzoguiComponent<import("@hanzogui/core").GetFinalProps<import("@hanzogui/core").RNHanzoguiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
59
59
  unstyled?: boolean | undefined;
60
- elevation?: number | import("@gui/core").SizeTokens | undefined;
60
+ elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
61
61
  fullscreen?: boolean | undefined;
62
- }>, import("@gui/core").GuiElement, import("@gui/core").RNGuiViewNonStyleProps & void, import("@gui/core").StackStyleBase, {
62
+ }>, import("@hanzogui/core").HanzoguiElement, import("@hanzogui/core").RNHanzoguiViewNonStyleProps & void, import("@hanzogui/core").StackStyleBase, {
63
63
  unstyled?: boolean | undefined;
64
- elevation?: number | import("@gui/core").SizeTokens | undefined;
64
+ elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
65
65
  fullscreen?: boolean | undefined;
66
- }, import("@gui/core").StaticConfigPublic>;
66
+ }, import("@hanzogui/core").StaticConfigPublic>;
67
67
  };
68
68
  export { createProgressScope, Progress, ProgressIndicator };
69
69
  //# sourceMappingURL=Progress.d.ts.map
@@ -1,171 +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 __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, {
13
- get: () => from[key],
14
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
- });
16
- return to;
17
- };
18
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
20
- }), mod);
21
- var Progress_exports = {};
22
- __export(Progress_exports, {
23
- Progress: () => Progress,
24
- ProgressFrame: () => ProgressFrame,
25
- ProgressIndicator: () => ProgressIndicator,
26
- ProgressIndicatorFrame: () => ProgressIndicatorFrame,
27
- createProgressScope: () => createProgressScope
28
- });
29
- module.exports = __toCommonJS(Progress_exports);
30
- var import_gui_core = require("@hanzogui/core"),
31
- import_gui_create_context = require("@hanzogui/create-context"),
32
- import_gui_get_token = require("@hanzogui/get-token"),
33
- import_gui_helpers = require("@hanzogui/helpers"),
34
- import_gui_stacks = require("@hanzogui/stacks"),
35
- import_react = require("react"),
36
- import_jsx_runtime = require("react/jsx-runtime");
37
- const PROGRESS_NAME = "Progress",
38
- [createProgressContext, createProgressScope] = (0, import_gui_create_context.createContextScope)(PROGRESS_NAME),
39
- [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME),
40
- INDICATOR_NAME = "ProgressIndicator",
41
- ProgressIndicatorFrame = (0, import_gui_core.styled)(import_gui_stacks.YStack, {
42
- name: INDICATOR_NAME,
43
- variants: {
44
- unstyled: {
45
- false: {
46
- height: "100%",
47
- width: "100%",
48
- backgroundColor: "$background"
49
- }
50
- }
51
- },
52
- defaultVariants: {
53
- unstyled: process.env.HANZO_GUI_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_gui_core.isWeb) x = `${-100 + progressRatio * 50}%`;else {
66
- const baseWidth = context.width || 0;
67
- x = Math.ceil(-baseWidth * (2 - progressRatio));
68
- }
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_gui_core.isWeb && context.width === 0 && {
79
- opacity: 0
80
- })
81
- }),
82
- ...indicatorProps,
83
- ref: forwardedRef,
84
- transition: !import_gui_core.isWeb && !context.width ? null : transition
85
- });
86
- });
87
- function defaultGetValueLabel(value, max) {
88
- return `${Math.round(value / max * 100)}%`;
89
- }
90
- function getProgressState(value, maxValue) {
91
- return value == null ? "indeterminate" : value === maxValue ? "complete" : "loading";
92
- }
93
- function isNumber(value) {
94
- return typeof value == "number";
95
- }
96
- function isValidMaxNumber(max) {
97
- return isNumber(max) && !Number.isNaN(max) && max > 0;
98
- }
99
- function isValidValueNumber(value, max) {
100
- return isNumber(value) && !Number.isNaN(value) && value <= max && value >= 0;
101
- }
102
- const DEFAULT_MAX = 100,
103
- ProgressFrame = (0, import_gui_core.styled)(import_gui_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_gui_core.getVariableValue)((0, import_gui_get_token.getSize)(val)) * 0.25);
116
- return {
117
- height: size,
118
- minWidth: (0, import_gui_core.getVariableValue)(size) * 20,
119
- width: "100%"
120
- };
121
- }
122
- }
123
- },
124
- defaultVariants: {
125
- unstyled: process.env.HANZO_GUI_HEADLESS === "1"
126
- }
127
- }),
128
- Progress = (0, import_gui_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_gui_core.isWeb && {
161
- onLayout: e => {
162
- const newWidth = Math.round(e.nativeEvent.layout.width);
163
- newWidth !== width && setWidth(newWidth), progressProps.onLayout?.(e);
164
- }
165
- }),
166
- ref: forwardedRef
167
- })
168
- });
169
- }), {
170
- Indicator: ProgressIndicator
171
- });
@@ -1,178 +0,0 @@
1
- "use strict";
2
-
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __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 __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: !0
22
- }), 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_jsx_runtime = require("react/jsx-runtime"),
33
- import_gui_core = require("@hanzogui/core"),
34
- import_gui_create_context = require("@hanzogui/create-context"),
35
- import_gui_get_token = require("@hanzogui/get-token"),
36
- import_gui_helpers = require("@hanzogui/helpers"),
37
- import_gui_stacks = require("@hanzogui/stacks"),
38
- import_react = require("react"),
39
- PROGRESS_NAME = "Progress",
40
- [createProgressContext, createProgressScope] = (0, import_gui_create_context.createContextScope)(PROGRESS_NAME),
41
- [ProgressProvider, useProgressContext] = createProgressContext(PROGRESS_NAME),
42
- INDICATOR_NAME = "ProgressIndicator",
43
- ProgressIndicatorFrame = (0, import_gui_core.styled)(import_gui_stacks.YStack, {
44
- name: INDICATOR_NAME,
45
- variants: {
46
- unstyled: {
47
- false: {
48
- height: "100%",
49
- width: "100%",
50
- backgroundColor: "$background"
51
- }
52
- }
53
- },
54
- defaultVariants: {
55
- unstyled: process.env.HANZO_GUI_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_gui_core.isWeb) x = `${-100 + progressRatio * 50}%`;else {
69
- var baseWidth = context.width || 0;
70
- x = Math.ceil(-baseWidth * (2 - progressRatio));
71
- }
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_gui_core.isWeb && context.width === 0 && {
83
- opacity: 0
84
- })
85
- }),
86
- ...indicatorProps,
87
- ref: forwardedRef,
88
- transition: !import_gui_core.isWeb && !context.width ? null : transition
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
- var DEFAULT_MAX = 100,
107
- ProgressFrame = (0, import_gui_core.styled)(import_gui_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_gui_core.getVariableValue)((0, import_gui_get_token.getSize)(val)) * 0.25);
120
- return {
121
- height: size,
122
- minWidth: (0, import_gui_core.getVariableValue)(size) * 20,
123
- width: "100%"
124
- };
125
- }
126
- }
127
- },
128
- defaultVariants: {
129
- unstyled: process.env.HANZO_GUI_HEADLESS === "1"
130
- }
131
- }),
132
- Progress = (0, import_gui_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_gui_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);
170
- }
171
- }),
172
- ref: forwardedRef
173
- })
174
- });
175
- }), {
176
- Indicator: ProgressIndicator
177
- });
178
- //# sourceMappingURL=Progress.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","Progress_exports","__export","Progress","ProgressFrame","ProgressIndicator","ProgressIndicatorFrame","createProgressScope","module","exports","import_jsx_runtime","require","import_gui_core","import_gui_create_context","import_gui_get_token","import_gui_helpers","import_gui_stacks","import_react","PROGRESS_NAME","createProgressContext","createContextScope","ProgressProvider","useProgressContext","INDICATOR_NAME","styled","YStack","name","variants","unstyled","false","height","width","backgroundColor","defaultVariants","process","env","HANZO_GUI_HEADLESS","styleable","props","forwardedRef","__scopeProgress","transition","indicatorProps","context","_context_value","progressRatio","max","x","isWeb","baseWidth","Math","ceil","_context_value1","jsx","getProgressState","animateOnly","opacity","ref","defaultGetValueLabel","round","maxValue","isNumber","isValidMaxNumber","Number","isNaN","isValidValueNumber","DEFAULT_MAX","borderRadius","overflow","size","...size","val","getVariableValue","getSize","minWidth","withStaticProperties","valueProp","maxProp","getValueLabel","progressProps","valueLabel","setWidth","useState","scope","children","role","onLayout","e","_progressProps_onLayout","newW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YAAA0D,QAAA,KAAA1D,KAAA,IAAAkD,QAAA,CAAAQ,QAAA,IAAAD,uBAAA,GAAAT,aAAA,CAAAO,QAAA,cAAAE,uBAAA,eAAAA,uBAAA,CAAAI,IAAA,CAAAb,aAAA,EAAAQ,CAAA;UAET;QAEH;QACD9B,GAAA,EAAAlB;MACE;IACF;EACF","ignoreList":[]}
@@ -1,18 +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") 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 index_exports = {};
17
- module.exports = __toCommonJS(index_exports);
18
- __reExport(index_exports, require("./Progress.cjs"), module.exports);
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
9
- get: () => from[key],
10
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
- });
12
- return to;
13
- },
14
- __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
- value: !0
17
- }), mod);
18
- var index_exports = {};
19
- module.exports = __toCommonJS(index_exports);
20
- __reExport(index_exports, require("./Progress.native.js"), module.exports);
21
- //# sourceMappingURL=index.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA","ignoreList":[]}