frst-components 0.25.3 → 0.25.4
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/index.js +30 -4
- package/dist/src/components/DS/progressGoalBar/index.d.ts.map +1 -1
- package/dist/src/components/DS/progressGoalBar/progressTexts.d.ts +1 -1
- package/dist/src/components/DS/progressGoalBar/useProgressGoalBar.d.ts +16 -0
- package/dist/src/components/DS/progressGoalBar/useProgressGoalBar.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8168,7 +8168,7 @@ const MESSAGES = {
|
|
|
8168
8168
|
currentTextResult: jsxRuntime.jsx("div", { children: "RESULTADO" }),
|
|
8169
8169
|
currentTextInitAndResult: jsxRuntime.jsx("div", { children: "IN\u00CDCIO E RESULTADO" }),
|
|
8170
8170
|
currentTextInit: jsxRuntime.jsx("div", { children: "IN\u00CDCIO" }),
|
|
8171
|
-
|
|
8171
|
+
stabilizeExceedingText: jsxRuntime.jsx("div", { children: "IN\u00CDCIO E META" })
|
|
8172
8172
|
};
|
|
8173
8173
|
|
|
8174
8174
|
function toRange(start, middle, end) {
|
|
@@ -8188,6 +8188,7 @@ const useProgressGoalBar = ({ start, current, goal }) => {
|
|
|
8188
8188
|
const noGoal = (start < goal && currentValue < start) || (start > goal && currentValue > start);
|
|
8189
8189
|
const noResult = (start < goal && currentValue == start) || (start > goal && currentValue == start);
|
|
8190
8190
|
const resultEvolved = (start < goal && currentValue > start && currentValue);
|
|
8191
|
+
const stabilizeExceeding = (start === goal && currentValue > start && currentValue > goal);
|
|
8191
8192
|
// Cálculo do progresso
|
|
8192
8193
|
const progressPercentage = React.useMemo(() => {
|
|
8193
8194
|
let percentage;
|
|
@@ -8234,6 +8235,18 @@ const useProgressGoalBar = ({ start, current, goal }) => {
|
|
|
8234
8235
|
currenText: MESSAGES?.currentTextResult,
|
|
8235
8236
|
currentTextInit: MESSAGES?.currentTextInit
|
|
8236
8237
|
};
|
|
8238
|
+
//stabilizeExceeding
|
|
8239
|
+
if (start === goal && currentValue > start && currentValue > goal)
|
|
8240
|
+
return {
|
|
8241
|
+
start: 0,
|
|
8242
|
+
current: 100,
|
|
8243
|
+
goal: 0,
|
|
8244
|
+
barRef: 'current',
|
|
8245
|
+
currentVariant: CurrentVariant?.Star,
|
|
8246
|
+
message: MESSAGES?.progressExceeded,
|
|
8247
|
+
currenText: MESSAGES?.currentTextResult,
|
|
8248
|
+
stabilizeExceedingText: MESSAGES?.stabilizeExceedingText
|
|
8249
|
+
};
|
|
8237
8250
|
// exceededTargetDecreased
|
|
8238
8251
|
if (start > goal && currentValue < goal)
|
|
8239
8252
|
return {
|
|
@@ -8328,7 +8341,8 @@ const useProgressGoalBar = ({ start, current, goal }) => {
|
|
|
8328
8341
|
positions,
|
|
8329
8342
|
noGoal,
|
|
8330
8343
|
noResult,
|
|
8331
|
-
resultEvolved
|
|
8344
|
+
resultEvolved,
|
|
8345
|
+
stabilizeExceeding
|
|
8332
8346
|
};
|
|
8333
8347
|
};
|
|
8334
8348
|
|
|
@@ -8494,12 +8508,24 @@ const TypeProgressText = styled__default["default"].p `
|
|
|
8494
8508
|
`;
|
|
8495
8509
|
|
|
8496
8510
|
const ProgressGoalBar = ({ start, current, goal, isVisibleMessage = true }) => {
|
|
8497
|
-
const { isGoalExceeded, isGoalReached, positions, noGoal, noResult, resultEvolved } = useProgressGoalBar({
|
|
8511
|
+
const { isGoalExceeded, isGoalReached, positions, noGoal, noResult, resultEvolved, stabilizeExceeding } = useProgressGoalBar({
|
|
8498
8512
|
start,
|
|
8499
8513
|
current,
|
|
8500
8514
|
goal
|
|
8501
8515
|
});
|
|
8502
|
-
|
|
8516
|
+
const getDisplayText = () => {
|
|
8517
|
+
if (noResult) {
|
|
8518
|
+
return positions?.currenText;
|
|
8519
|
+
}
|
|
8520
|
+
else if (stabilizeExceeding) {
|
|
8521
|
+
return positions?.stabilizeExceedingText;
|
|
8522
|
+
}
|
|
8523
|
+
else {
|
|
8524
|
+
return positions?.currentTextInit;
|
|
8525
|
+
}
|
|
8526
|
+
};
|
|
8527
|
+
return (jsxRuntime.jsxs(WrapperProgressGoalBar, { children: [isVisibleMessage && jsxRuntime.jsx(TextUP, { children: positions?.message }), jsxRuntime.jsxs(ProgressGoalBarContainer, { children: [jsxRuntime.jsx(StartIndicator, { position: positions?.start, children: jsxRuntime.jsx(LocalizationIcon, {}) }), jsxRuntime.jsx(IndicatorText, { noResult: noResult, position: positions?.start, isGoalReached: isGoalReached, isGoalExceeded: isGoalExceeded, resultEvolved: resultEvolved, start: positions?.start, children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Number$1, { children: start }), jsxRuntime.jsx(TypeProgressText, { children: getDisplayText() })] }) }), !isGoalReached && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CurrentIndicator, { status: positions?.currentVariant, position: positions?.current, children: isGoalExceeded ? jsxRuntime.jsx(StarIcon$1, { color: 'white', width: 14, height: 13 }) : jsxRuntime.jsx(ExclamationIcon, {}) }), jsxRuntime.jsx(IndicatorTextCurrent, { position: positions?.current, noGoal: noGoal, noResult: noResult, children: !noResult && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Number$1, { children: current }), jsxRuntime.jsx(TypeProgressText, { children: positions?.currenText })] })) })] })), stabilizeExceeding ? '' :
|
|
8528
|
+
jsxRuntime.jsx(EndIndicator, { position: positions?.goal, isGoalExceeded: isGoalExceeded, isGoalReached: isGoalReached, children: jsxRuntime.jsx(GoalIcon, {}) }), jsxRuntime.jsxs(IndicatorText, { position: positions?.goal, children: [jsxRuntime.jsx(Number$1, { children: !stabilizeExceeding && goal }), jsxRuntime.jsx(TypeProgressText, { children: !stabilizeExceeding && 'META' })] }), jsxRuntime.jsx(ProgressBarColor, { isGoalExceeded: isGoalExceeded, width: positions[positions.barRef], hasRegressed: noGoal })] })] }));
|
|
8503
8529
|
};
|
|
8504
8530
|
|
|
8505
8531
|
const ModalContainer = styled__default["default"].div `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/DS/progressGoalBar/index.tsx"],"names":[],"mappings":"AAIA,UAAU,oBAAoB;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC7B;AAED,eAAO,MAAM,eAAe,+CAAuD,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/DS/progressGoalBar/index.tsx"],"names":[],"mappings":"AAIA,UAAU,oBAAoB;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC7B;AAED,eAAO,MAAM,eAAe,+CAAuD,oBAAoB,4CAmFtG,CAAA"}
|
|
@@ -7,6 +7,6 @@ export declare const MESSAGES: {
|
|
|
7
7
|
currentTextResult: import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
currentTextInitAndResult: import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
currentTextInit: import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
|
|
10
|
+
stabilizeExceedingText: import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
};
|
|
12
12
|
//# sourceMappingURL=progressTexts.d.ts.map
|
|
@@ -24,6 +24,7 @@ export declare const useProgressGoalBar: ({ start, current, goal }: {
|
|
|
24
24
|
message: import("react/jsx-runtime").JSX.Element;
|
|
25
25
|
currentTextInit: import("react/jsx-runtime").JSX.Element;
|
|
26
26
|
currenText?: undefined;
|
|
27
|
+
stabilizeExceedingText?: undefined;
|
|
27
28
|
bar?: undefined;
|
|
28
29
|
} | {
|
|
29
30
|
start: number;
|
|
@@ -34,6 +35,7 @@ export declare const useProgressGoalBar: ({ start, current, goal }: {
|
|
|
34
35
|
message: import("react/jsx-runtime").JSX.Element;
|
|
35
36
|
currenText: import("react/jsx-runtime").JSX.Element;
|
|
36
37
|
currentTextInit: import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
stabilizeExceedingText?: undefined;
|
|
37
39
|
bar?: undefined;
|
|
38
40
|
} | {
|
|
39
41
|
start: number;
|
|
@@ -43,8 +45,20 @@ export declare const useProgressGoalBar: ({ start, current, goal }: {
|
|
|
43
45
|
currentVariant: CurrentVariant;
|
|
44
46
|
message: import("react/jsx-runtime").JSX.Element;
|
|
45
47
|
currenText: import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
stabilizeExceedingText: import("react/jsx-runtime").JSX.Element;
|
|
46
49
|
currentTextInit?: undefined;
|
|
47
50
|
bar?: undefined;
|
|
51
|
+
} | {
|
|
52
|
+
start: number;
|
|
53
|
+
current: number;
|
|
54
|
+
goal: number;
|
|
55
|
+
barRef: string;
|
|
56
|
+
currentVariant: CurrentVariant;
|
|
57
|
+
message: import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
currenText: import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
currentTextInit?: undefined;
|
|
60
|
+
stabilizeExceedingText?: undefined;
|
|
61
|
+
bar?: undefined;
|
|
48
62
|
} | {
|
|
49
63
|
start: number;
|
|
50
64
|
current: number;
|
|
@@ -55,9 +69,11 @@ export declare const useProgressGoalBar: ({ start, current, goal }: {
|
|
|
55
69
|
currenText: import("react/jsx-runtime").JSX.Element;
|
|
56
70
|
barRef?: undefined;
|
|
57
71
|
currentTextInit?: undefined;
|
|
72
|
+
stabilizeExceedingText?: undefined;
|
|
58
73
|
};
|
|
59
74
|
noGoal: boolean;
|
|
60
75
|
noResult: boolean;
|
|
61
76
|
resultEvolved: any;
|
|
77
|
+
stabilizeExceeding: boolean;
|
|
62
78
|
};
|
|
63
79
|
//# sourceMappingURL=useProgressGoalBar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProgressGoalBar.d.ts","sourceRoot":"","sources":["../../../../../src/components/DS/progressGoalBar/useProgressGoalBar.tsx"],"names":[],"mappings":"AAQA,oBAAY,cAAc;IACtB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,IAAI,SAAS;CAChB;AACD,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAA;AAEtF,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"useProgressGoalBar.d.ts","sourceRoot":"","sources":["../../../../../src/components/DS/progressGoalBar/useProgressGoalBar.tsx"],"names":[],"mappings":"AAQA,oBAAY,cAAc;IACtB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,IAAI,SAAS;CAChB;AACD,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAA;AAEtF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwL9B,CAAA"}
|