@chayns-components/core 5.0.21 → 5.0.25
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/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js +5 -1
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.styles.js +37 -0
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
- package/lib/cjs/components/grouped-image/GroupedImage.styles.js +18 -20
- package/lib/cjs/components/grouped-image/GroupedImage.styles.js.map +1 -1
- package/lib/cjs/components/list/List.js +97 -37
- package/lib/cjs/components/list/List.js.map +1 -1
- package/lib/cjs/components/list/list-item/ListItem.js +0 -9
- package/lib/cjs/components/list/list-item/ListItem.js.map +1 -1
- package/lib/cjs/components/number-input/NumberInput.js +213 -132
- package/lib/cjs/components/number-input/NumberInput.js.map +1 -1
- package/lib/cjs/components/progress-bar/ProgressBar.js +181 -66
- package/lib/cjs/components/progress-bar/ProgressBar.js.map +1 -1
- package/lib/cjs/components/progress-bar/ProgressBar.styles.js +36 -1
- package/lib/cjs/components/progress-bar/ProgressBar.styles.js.map +1 -1
- package/lib/cjs/utils/numberInput.js +1 -0
- package/lib/cjs/utils/numberInput.js.map +1 -1
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js +6 -2
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js +38 -1
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
- package/lib/esm/components/grouped-image/GroupedImage.styles.js +18 -20
- package/lib/esm/components/grouped-image/GroupedImage.styles.js.map +1 -1
- package/lib/esm/components/list/List.js +97 -37
- package/lib/esm/components/list/List.js.map +1 -1
- package/lib/esm/components/list/list-item/ListItem.js +0 -9
- package/lib/esm/components/list/list-item/ListItem.js.map +1 -1
- package/lib/esm/components/number-input/NumberInput.js +213 -132
- package/lib/esm/components/number-input/NumberInput.js.map +1 -1
- package/lib/esm/components/progress-bar/ProgressBar.js +173 -68
- package/lib/esm/components/progress-bar/ProgressBar.js.map +1 -1
- package/lib/esm/components/progress-bar/ProgressBar.styles.js +36 -1
- package/lib/esm/components/progress-bar/ProgressBar.styles.js.map +1 -1
- package/lib/esm/utils/numberInput.js +1 -0
- package/lib/esm/utils/numberInput.js.map +1 -1
- package/lib/types/components/color-scheme-provider/ColorSchemeProvider.styles.d.ts +7 -3
- package/lib/types/components/grouped-image/GroupedImage.styles.d.ts +3 -1
- package/lib/types/components/list/List.d.ts +0 -1
- package/lib/types/components/progress-bar/ProgressBar.d.ts +9 -1
- package/lib/types/components/progress-bar/ProgressBar.styles.d.ts +7 -0
- package/package.json +2 -2
|
@@ -4,92 +4,207 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
var _reactCompilerRuntime = require("react-compiler-runtime");
|
|
7
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
9
|
var _uuid = require("../../hooks/uuid");
|
|
9
10
|
var _ProgressBar = require("./ProgressBar.styles");
|
|
11
|
+
var _popup = require("../../types/popup");
|
|
12
|
+
var _styledComponents = require("styled-components");
|
|
13
|
+
var _Popup = _interopRequireDefault(require("../popup/Popup"));
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
15
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
|
-
const ProgressBar =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const ProgressBar = t0 => {
|
|
17
|
+
"use memo";
|
|
18
|
+
|
|
19
|
+
const $ = (0, _reactCompilerRuntime.c)(29);
|
|
20
|
+
const {
|
|
21
|
+
percentage,
|
|
22
|
+
label,
|
|
23
|
+
shouldHideProgress: t1,
|
|
24
|
+
shouldShowLabelInline: t2,
|
|
25
|
+
steps,
|
|
26
|
+
colors,
|
|
27
|
+
thumbLabel,
|
|
28
|
+
showShine: t3
|
|
29
|
+
} = t0;
|
|
30
|
+
const shouldHideProgress = t1 === undefined ? false : t1;
|
|
31
|
+
const shouldShowLabelInline = t2 === undefined ? false : t2;
|
|
32
|
+
const showShine = t3 === undefined ? false : t3;
|
|
20
33
|
const uuid = (0, _uuid.useUuid)();
|
|
21
|
-
(0, _react.
|
|
22
|
-
|
|
23
|
-
|
|
34
|
+
const popupRef = (0, _react.useRef)(null);
|
|
35
|
+
const theme = (0, _react.useContext)(_styledComponents.ThemeContext);
|
|
36
|
+
let t4;
|
|
37
|
+
bb0: {
|
|
38
|
+
if (!showShine || percentage === undefined) {
|
|
39
|
+
t4 = null;
|
|
40
|
+
break bb0;
|
|
24
41
|
}
|
|
25
|
-
|
|
26
|
-
|
|
42
|
+
const shineCount = Math.ceil(6 * (percentage / 100));
|
|
43
|
+
const speed = 5 * (percentage / 100);
|
|
44
|
+
let t5;
|
|
45
|
+
if ($[0] !== shineCount) {
|
|
46
|
+
t5 = Array.from({
|
|
47
|
+
length: shineCount
|
|
48
|
+
});
|
|
49
|
+
$[0] = shineCount;
|
|
50
|
+
$[1] = t5;
|
|
51
|
+
} else {
|
|
52
|
+
t5 = $[1];
|
|
27
53
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
54
|
+
let t6;
|
|
55
|
+
if ($[2] !== shineCount || $[3] !== speed || $[4] !== t5) {
|
|
56
|
+
t6 = t5.map((_, index) => /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarShine, {
|
|
57
|
+
key: `progress-bar-shine__${shineCount}__${index}`,
|
|
58
|
+
$speed: speed,
|
|
59
|
+
$delay: 5 / shineCount * index
|
|
60
|
+
}));
|
|
61
|
+
$[2] = shineCount;
|
|
62
|
+
$[3] = speed;
|
|
63
|
+
$[4] = t5;
|
|
64
|
+
$[5] = t6;
|
|
65
|
+
} else {
|
|
66
|
+
t6 = $[5];
|
|
32
67
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
68
|
+
t4 = t6;
|
|
69
|
+
}
|
|
70
|
+
const shineEffect = t4;
|
|
71
|
+
let t5;
|
|
72
|
+
if ($[6] !== (colors === null || colors === void 0 ? void 0 : colors.backgroundColor) || $[7] !== (colors === null || colors === void 0 ? void 0 : colors.primaryTextColor) || $[8] !== (colors === null || colors === void 0 ? void 0 : colors.progressColor) || $[9] !== (colors === null || colors === void 0 ? void 0 : colors.secondaryTextColor) || $[10] !== (colors === null || colors === void 0 ? void 0 : colors.stepColor) || $[11] !== label || $[12] !== percentage || $[13] !== shineEffect || $[14] !== shouldHideProgress || $[15] !== shouldShowLabelInline || $[16] !== showShine || $[17] !== steps || $[18] !== theme || $[19] !== thumbLabel || $[20] !== uuid) {
|
|
73
|
+
colors === null || colors === void 0 || colors.backgroundColor;
|
|
74
|
+
colors === null || colors === void 0 || colors.primaryTextColor;
|
|
75
|
+
colors === null || colors === void 0 || colors.progressColor;
|
|
76
|
+
colors === null || colors === void 0 || colors.secondaryTextColor;
|
|
77
|
+
colors === null || colors === void 0 || colors.stepColor;
|
|
78
|
+
t5 = (() => {
|
|
79
|
+
if (shouldHideProgress) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
if (percentage === undefined) {
|
|
83
|
+
return /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarProgressWrapper, null, /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledMotionProgressBarProgress, {
|
|
84
|
+
key: `progress-bar-loop__${uuid}`,
|
|
85
|
+
$color: colors === null || colors === void 0 ? void 0 : colors.progressColor,
|
|
86
|
+
initial: {
|
|
87
|
+
width: "200px",
|
|
88
|
+
left: "-200px"
|
|
89
|
+
},
|
|
90
|
+
animate: {
|
|
91
|
+
width: "200px",
|
|
92
|
+
left: "100%"
|
|
93
|
+
},
|
|
94
|
+
exit: {
|
|
95
|
+
width: "200px",
|
|
96
|
+
left: "100%"
|
|
97
|
+
},
|
|
98
|
+
transition: {
|
|
99
|
+
type: "tween",
|
|
100
|
+
repeat: Infinity,
|
|
101
|
+
repeatDelay: 0,
|
|
102
|
+
duration: 1
|
|
103
|
+
}
|
|
104
|
+
}), /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarBackground, {
|
|
105
|
+
$color: colors === null || colors === void 0 ? void 0 : colors.backgroundColor
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
return /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarProgressWrapper, {
|
|
109
|
+
$isBig: shouldShowLabelInline
|
|
110
|
+
}, !!(steps !== null && steps !== void 0 && steps.length) && /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarStepWrapper, null, steps.map(step => /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarStep, {
|
|
111
|
+
$position: step,
|
|
112
|
+
key: `progress-step-${step}`,
|
|
113
|
+
$color: colors === null || colors === void 0 ? void 0 : colors.stepColor
|
|
114
|
+
}))), /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledMotionProgressBarProgress, {
|
|
36
115
|
$color: colors === null || colors === void 0 ? void 0 : colors.progressColor,
|
|
116
|
+
key: `progress-bar__${uuid}`,
|
|
37
117
|
initial: {
|
|
38
|
-
width:
|
|
39
|
-
left: '-200px'
|
|
118
|
+
width: "0%"
|
|
40
119
|
},
|
|
41
120
|
animate: {
|
|
42
|
-
width:
|
|
43
|
-
left: '100%'
|
|
121
|
+
width: `${percentage}%`
|
|
44
122
|
},
|
|
45
123
|
exit: {
|
|
46
|
-
width:
|
|
47
|
-
left: '100%'
|
|
124
|
+
width: "0%"
|
|
48
125
|
},
|
|
49
126
|
transition: {
|
|
50
|
-
type:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
127
|
+
type: "tween"
|
|
128
|
+
},
|
|
129
|
+
onUpdate: () => {
|
|
130
|
+
var _popupRef$current;
|
|
131
|
+
return (_popupRef$current = popupRef.current) === null || _popupRef$current === void 0 ? void 0 : _popupRef$current.show();
|
|
132
|
+
},
|
|
133
|
+
onAnimationComplete: () => {
|
|
134
|
+
var _popupRef$current2;
|
|
135
|
+
return (_popupRef$current2 = popupRef.current) === null || _popupRef$current2 === void 0 ? void 0 : _popupRef$current2.show();
|
|
136
|
+
}
|
|
137
|
+
}, showShine && shineEffect, thumbLabel && /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarThumbLabel, {
|
|
138
|
+
onClick: _temp
|
|
139
|
+
}, /*#__PURE__*/_react.default.createElement(_styledComponents.ThemeProvider, {
|
|
140
|
+
theme: {
|
|
141
|
+
"000": (colors === null || colors === void 0 ? void 0 : colors.backgroundColor) ?? (theme === null || theme === void 0 ? void 0 : theme["104"]),
|
|
142
|
+
text: (colors === null || colors === void 0 ? void 0 : colors.secondaryTextColor) ?? (theme === null || theme === void 0 ? void 0 : theme["300"])
|
|
143
|
+
}
|
|
144
|
+
}, /*#__PURE__*/_react.default.createElement(_Popup.default, {
|
|
145
|
+
ref: popupRef,
|
|
146
|
+
content: thumbLabel,
|
|
147
|
+
alignment: _popup.PopupAlignment.TopCenter,
|
|
148
|
+
onHide: () => {
|
|
149
|
+
var _popupRef$current3;
|
|
150
|
+
return (_popupRef$current3 = popupRef.current) === null || _popupRef$current3 === void 0 ? void 0 : _popupRef$current3.show();
|
|
54
151
|
}
|
|
55
|
-
}), /*#__PURE__*/_react.default.createElement(_ProgressBar.
|
|
152
|
+
})))), shouldShowLabelInline && label && /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarLabel, {
|
|
153
|
+
$shouldShowLabelInline: shouldShowLabelInline,
|
|
154
|
+
$primaryColor: colors === null || colors === void 0 ? void 0 : colors.primaryTextColor,
|
|
155
|
+
$secondaryColor: colors === null || colors === void 0 ? void 0 : colors.secondaryTextColor,
|
|
156
|
+
$colorSplitPosition: percentage
|
|
157
|
+
}, label), /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarBackground, {
|
|
56
158
|
$color: colors === null || colors === void 0 ? void 0 : colors.backgroundColor
|
|
57
159
|
}));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
$
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
160
|
+
})();
|
|
161
|
+
$[6] = colors === null || colors === void 0 ? void 0 : colors.backgroundColor;
|
|
162
|
+
$[7] = colors === null || colors === void 0 ? void 0 : colors.primaryTextColor;
|
|
163
|
+
$[8] = colors === null || colors === void 0 ? void 0 : colors.progressColor;
|
|
164
|
+
$[9] = colors === null || colors === void 0 ? void 0 : colors.secondaryTextColor;
|
|
165
|
+
$[10] = colors === null || colors === void 0 ? void 0 : colors.stepColor;
|
|
166
|
+
$[11] = label;
|
|
167
|
+
$[12] = percentage;
|
|
168
|
+
$[13] = shineEffect;
|
|
169
|
+
$[14] = shouldHideProgress;
|
|
170
|
+
$[15] = shouldShowLabelInline;
|
|
171
|
+
$[16] = showShine;
|
|
172
|
+
$[17] = steps;
|
|
173
|
+
$[18] = theme;
|
|
174
|
+
$[19] = thumbLabel;
|
|
175
|
+
$[20] = uuid;
|
|
176
|
+
$[21] = t5;
|
|
177
|
+
} else {
|
|
178
|
+
t5 = $[21];
|
|
179
|
+
}
|
|
180
|
+
const progressBar = t5;
|
|
181
|
+
colors === null || colors === void 0 || colors.primaryTextColor;
|
|
182
|
+
let t6;
|
|
183
|
+
if ($[22] !== (colors === null || colors === void 0 ? void 0 : colors.primaryTextColor) || $[23] !== label || $[24] !== shouldShowLabelInline) {
|
|
184
|
+
t6 = label && !shouldShowLabelInline && /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarLabel, {
|
|
185
|
+
$primaryColor: colors === null || colors === void 0 ? void 0 : colors.primaryTextColor
|
|
186
|
+
}, label);
|
|
187
|
+
$[22] = colors === null || colors === void 0 ? void 0 : colors.primaryTextColor;
|
|
188
|
+
$[23] = label;
|
|
189
|
+
$[24] = shouldShowLabelInline;
|
|
190
|
+
$[25] = t6;
|
|
191
|
+
} else {
|
|
192
|
+
t6 = $[25];
|
|
193
|
+
}
|
|
194
|
+
let t7;
|
|
195
|
+
if ($[26] !== progressBar || $[27] !== t6) {
|
|
196
|
+
t7 = /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBar, null, progressBar, t6);
|
|
197
|
+
$[26] = progressBar;
|
|
198
|
+
$[27] = t6;
|
|
199
|
+
$[28] = t7;
|
|
200
|
+
} else {
|
|
201
|
+
t7 = $[28];
|
|
202
|
+
}
|
|
203
|
+
return t7;
|
|
92
204
|
};
|
|
93
205
|
ProgressBar.displayName = 'ProgressBar';
|
|
94
206
|
var _default = exports.default = ProgressBar;
|
|
207
|
+
function _temp(event) {
|
|
208
|
+
return event.stopPropagation();
|
|
209
|
+
}
|
|
95
210
|
//# sourceMappingURL=ProgressBar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.js","names":["_react","_interopRequireWildcard","require","_uuid","_ProgressBar","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ProgressBar","percentage","label","shouldHideProgress","shouldShowLabelInline","steps","colors","internalPercentage","setInternalPercentage","useState","uuid","useUuid","useEffect","progressBar","useMemo","createElement","StyledProgressBarProgressWrapper","StyledMotionProgressBarProgress","key","$color","progressColor","initial","width","left","animate","exit","transition","type","repeat","Infinity","repeatDelay","duration","StyledProgressBarBackground","backgroundColor","$isBig","length","StyledProgressBarStepWrapper","map","step","StyledProgressBarStep","$position","stepColor","StyledProgressBarLabel","$shouldShowLabelInline","$primaryColor","primaryTextColor","$secondaryColor","secondaryTextColor","$colorSplitPosition","StyledProgressBar","displayName","_default","exports"],"sources":["../../../../src/components/progress-bar/ProgressBar.tsx"],"sourcesContent":["import React, { FC, useEffect, useMemo, useState } from 'react';\nimport { useUuid } from '../../hooks/uuid';\nimport {\n StyledMotionProgressBarProgress,\n StyledProgressBar,\n StyledProgressBarBackground,\n StyledProgressBarLabel,\n StyledProgressBarProgressWrapper,\n StyledProgressBarStep,\n StyledProgressBarStepWrapper,\n} from './ProgressBar.styles';\n\ntype Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N\n ? Acc[number]\n : Enumerate<N, [...Acc, Acc['length']]>;\n\ntype Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;\n\ninterface Colors {\n backgroundColor?: string;\n progressColor?: string;\n stepColor?: string;\n primaryTextColor?: string;\n secondaryTextColor?: string;\n}\n\nexport type ProgressBarProps = {\n /**\n * The colors of the ProgressBar.\n */\n colors?: Colors;\n /**\n * The label that should be displayed under the progressbar.\n */\n label?: string;\n /**\n * The percentage of the progress. Number between 0 and 100.\n */\n percentage?: Range<0, 101>;\n /**\n * Whether the progress should be hide and just display the label.\n */\n shouldHideProgress?: boolean;\n /**\n * Whether the label should be displayed inside the ProgressBar.\n */\n shouldShowLabelInline?: boolean;\n /**\n * Visual marked steps.\n */\n steps?: Range<0, 101>[];\n};\n\nconst ProgressBar: FC<ProgressBarProps> = ({\n percentage,\n label,\n shouldHideProgress = false,\n shouldShowLabelInline = false,\n steps,\n colors,\n}) => {\n const [internalPercentage, setInternalPercentage] = useState(0);\n const uuid = useUuid();\n\n useEffect(() => {\n if (typeof percentage !== 'number') {\n return;\n }\n\n if (percentage >= 0 && percentage <= 100) {\n setInternalPercentage(percentage);\n }\n }, [percentage]);\n\n const progressBar = useMemo(() => {\n if (shouldHideProgress) {\n return null;\n }\n\n if (typeof percentage !== 'number') {\n return (\n <StyledProgressBarProgressWrapper>\n <StyledMotionProgressBarProgress\n key={`progress-bar-loop__${uuid}`}\n $color={colors?.progressColor}\n initial={{ width: '200px', left: '-200px' }}\n animate={{ width: '200px', left: '100%' }}\n exit={{ width: '200px', left: '100%' }}\n transition={{\n type: 'tween',\n repeat: Infinity,\n repeatDelay: 0,\n duration: 1,\n }}\n />\n <StyledProgressBarBackground $color={colors?.backgroundColor} />\n </StyledProgressBarProgressWrapper>\n );\n }\n\n return (\n <StyledProgressBarProgressWrapper $isBig={shouldShowLabelInline}>\n {!!steps?.length && (\n <StyledProgressBarStepWrapper>\n {steps.map((step) => (\n <StyledProgressBarStep\n $position={step}\n key={`progress-step-${step}`}\n $color={colors?.stepColor}\n />\n ))}\n </StyledProgressBarStepWrapper>\n )}\n <StyledMotionProgressBarProgress\n $color={colors?.progressColor}\n key={`progress-bar__${uuid}`}\n initial={{ width: '0%' }}\n animate={{ width: `${internalPercentage}%` }}\n exit={{ width: '0%' }}\n transition={{ type: 'tween' }}\n />\n {shouldShowLabelInline && label && (\n <StyledProgressBarLabel\n $shouldShowLabelInline={shouldShowLabelInline}\n $primaryColor={colors?.primaryTextColor}\n $secondaryColor={colors?.secondaryTextColor}\n $colorSplitPosition={internalPercentage}\n >\n {label}\n </StyledProgressBarLabel>\n )}\n <StyledProgressBarBackground $color={colors?.backgroundColor} />\n </StyledProgressBarProgressWrapper>\n );\n }, [\n colors,\n internalPercentage,\n label,\n percentage,\n shouldHideProgress,\n shouldShowLabelInline,\n steps,\n uuid,\n ]);\n\n return useMemo(\n () => (\n <StyledProgressBar>\n {progressBar}\n {label && !shouldShowLabelInline && (\n <StyledProgressBarLabel $primaryColor={colors?.primaryTextColor}>\n {label}\n </StyledProgressBarLabel>\n )}\n </StyledProgressBar>\n ),\n [\n progressBar,\n label,\n shouldShowLabelInline,\n colors?.primaryTextColor,\n colors?.secondaryTextColor,\n ],\n );\n};\n\nProgressBar.displayName = 'ProgressBar';\n\nexport default ProgressBar;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAQ8B,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,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,qBAAqB,EACrBE,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEuC,gBAAgB,EACxBvC,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEyC,kBAAkB,CAElC,CAAC;AACL,CAAC;AAED/C,WAAW,CAACkD,WAAW,GAAG,aAAa;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA7D,OAAA,GAEzBS,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ProgressBar.js","names":["_react","_interopRequireWildcard","require","_uuid","_ProgressBar","_popup","_styledComponents","_Popup","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ProgressBar","t0","$","_reactCompilerRuntime","c","percentage","label","shouldHideProgress","t1","shouldShowLabelInline","t2","steps","colors","thumbLabel","showShine","t3","undefined","uuid","useUuid","popupRef","useRef","theme","useContext","ThemeContext","t4","bb0","shineCount","Math","ceil","speed","t5","Array","from","length","t6","map","_","index","createElement","StyledProgressBarShine","key","$delay","shineEffect","backgroundColor","primaryTextColor","progressColor","secondaryTextColor","stepColor","StyledProgressBarProgressWrapper","StyledMotionProgressBarProgress","$color","initial","width","left","animate","exit","transition","type","repeat","Infinity","repeatDelay","duration","StyledProgressBarBackground","StyledProgressBarStepWrapper","step","StyledProgressBarStep","onUpdate","_popupRef$current","current","show","onAnimationComplete","_popupRef$current2","StyledProgressBarThumbLabel","onClick","_temp","ThemeProvider","text","alignment","PopupAlignment","TopCenter","onHide","_popupRef$current3","StyledProgressBarLabel","$primaryColor","$secondaryColor","progressBar","t7","StyledProgressBar","displayName","_default","exports","event","stopPropagation"],"sources":["../../../../src/components/progress-bar/ProgressBar.tsx"],"sourcesContent":["import React, { FC, useContext, useMemo, useRef } from 'react';\nimport { useUuid } from '../../hooks/uuid';\nimport {\n StyledMotionProgressBarProgress,\n StyledProgressBar,\n StyledProgressBarBackground,\n StyledProgressBarLabel,\n StyledProgressBarProgressWrapper,\n StyledProgressBarShine,\n StyledProgressBarStep,\n StyledProgressBarStepWrapper,\n StyledProgressBarThumbLabel,\n} from './ProgressBar.styles';\nimport { PopupAlignment, PopupRef } from '../../types/popup';\nimport { ThemeContext, ThemeProvider } from 'styled-components';\nimport { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport Popup from '../popup/Popup';\n\ntype Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N\n ? Acc[number]\n : Enumerate<N, [...Acc, Acc['length']]>;\n\ntype Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;\n\ninterface Colors {\n backgroundColor?: string;\n progressColor?: string;\n stepColor?: string;\n primaryTextColor?: string;\n secondaryTextColor?: string;\n}\n\nexport type ProgressBarProps = {\n /**\n * The colors of the ProgressBar.\n */\n colors?: Colors;\n /**\n * The label that should be displayed under the progressbar.\n */\n label?: string;\n /**\n * The percentage of the progress. Number between 0 and 100.\n */\n percentage?: Range<0, 101>;\n /**\n * Whether the progress should be hide and just display the label.\n */\n shouldHideProgress?: boolean;\n /**\n * Whether the label should be displayed inside the ProgressBar.\n */\n shouldShowLabelInline?: boolean;\n /**\n * Visual marked steps.\n */\n steps?: Range<0, 101>[];\n /**\n * The label that should be displayed on the thumb of the progress bar.\n */\n thumbLabel?: React.ReactNode;\n /**\n * Whether a shine animation should be shown on the progress bar. The amount of shine is based on the percentage value.\n */\n showShine?: boolean;\n};\n\nconst ProgressBar: FC<ProgressBarProps> = ({\n percentage,\n label,\n shouldHideProgress = false,\n shouldShowLabelInline = false,\n steps,\n colors,\n thumbLabel,\n showShine = false,\n}) => {\n 'use memo';\n\n const uuid = useUuid();\n const popupRef = useRef<PopupRef | null>(null);\n\n const theme = useContext(ThemeContext) as Theme | undefined;\n\n const shineEffect = useMemo(() => {\n if (!showShine || percentage === undefined) return null;\n const FULL_ANIMATION_LENGTH = 5;\n const MAX_SHINE_COUNT = 6;\n\n const shineCount = Math.ceil(MAX_SHINE_COUNT * (percentage / 100));\n const speed = FULL_ANIMATION_LENGTH * (percentage / 100);\n return Array.from({ length: shineCount }).map((_, index) => (\n <StyledProgressBarShine\n /* eslint-disable-next-line react/no-array-index-key */\n key={`progress-bar-shine__${shineCount}__${index}`}\n $speed={speed}\n $delay={(FULL_ANIMATION_LENGTH / shineCount) * index}\n />\n ));\n }, [percentage, showShine]);\n\n const progressBar = useMemo(() => {\n if (shouldHideProgress) {\n return null;\n }\n\n if (percentage === undefined) {\n return (\n <StyledProgressBarProgressWrapper>\n <StyledMotionProgressBarProgress\n key={`progress-bar-loop__${uuid}`}\n $color={colors?.progressColor}\n initial={{ width: '200px', left: '-200px' }}\n animate={{ width: '200px', left: '100%' }}\n exit={{ width: '200px', left: '100%' }}\n transition={{\n type: 'tween',\n repeat: Infinity,\n repeatDelay: 0,\n duration: 1,\n }}\n />\n <StyledProgressBarBackground $color={colors?.backgroundColor} />\n </StyledProgressBarProgressWrapper>\n );\n }\n\n return (\n <StyledProgressBarProgressWrapper $isBig={shouldShowLabelInline}>\n {!!steps?.length && (\n <StyledProgressBarStepWrapper>\n {steps.map((step) => (\n <StyledProgressBarStep\n $position={step}\n key={`progress-step-${step}`}\n $color={colors?.stepColor}\n />\n ))}\n </StyledProgressBarStepWrapper>\n )}\n <StyledMotionProgressBarProgress\n $color={colors?.progressColor}\n key={`progress-bar__${uuid}`}\n initial={{ width: '0%' }}\n animate={{ width: `${percentage}%` }}\n exit={{ width: '0%' }}\n transition={{ type: 'tween' }}\n onUpdate={() => popupRef.current?.show()}\n onAnimationComplete={() => popupRef.current?.show()}\n >\n {showShine && shineEffect}\n {thumbLabel && (\n <StyledProgressBarThumbLabel onClick={(event) => event.stopPropagation()}>\n <ThemeProvider\n theme={{\n '000': colors?.backgroundColor ?? theme?.['104'],\n text: colors?.secondaryTextColor ?? theme?.['300'],\n }}\n >\n <Popup\n ref={popupRef}\n content={thumbLabel}\n alignment={PopupAlignment.TopCenter}\n onHide={() => popupRef.current?.show()}\n >\n {}\n </Popup>\n </ThemeProvider>\n </StyledProgressBarThumbLabel>\n )}\n </StyledMotionProgressBarProgress>\n\n {shouldShowLabelInline && label && (\n <StyledProgressBarLabel\n $shouldShowLabelInline={shouldShowLabelInline}\n $primaryColor={colors?.primaryTextColor}\n $secondaryColor={colors?.secondaryTextColor}\n $colorSplitPosition={percentage}\n >\n {label}\n </StyledProgressBarLabel>\n )}\n\n <StyledProgressBarBackground $color={colors?.backgroundColor} />\n </StyledProgressBarProgressWrapper>\n );\n }, [\n colors?.backgroundColor,\n colors?.primaryTextColor,\n colors?.progressColor,\n colors?.secondaryTextColor,\n colors?.stepColor,\n label,\n percentage,\n shineEffect,\n shouldHideProgress,\n shouldShowLabelInline,\n showShine,\n steps,\n theme,\n thumbLabel,\n uuid,\n ]);\n\n return useMemo(\n () => (\n <StyledProgressBar>\n {progressBar}\n {label && !shouldShowLabelInline && (\n <StyledProgressBarLabel $primaryColor={colors?.primaryTextColor}>\n {label}\n </StyledProgressBarLabel>\n )}\n </StyledProgressBar>\n ),\n [colors?.primaryTextColor, label, progressBar, shouldShowLabelInline],\n );\n};\n\nProgressBar.displayName = 'ProgressBar';\n\nexport default ProgressBar;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAWA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAC,sBAAA,CAAAN,OAAA;AAAmC,SAAAM,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAZ,uBAAA,YAAAA,CAAAQ,CAAA,EAAAG,CAAA,S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EAAA,gBAAAlH,MAAA,CAAAW,OAAA,CAAAuD,aAAA,CAAC9D,YAAA,CAAA+G,iBAAiB,QACbF,WAAW,EACXnD,EAKc,CAAC;IAAAhC,CAAA,OAAAmF,WAAA;IAAAnF,CAAA,OAAAgC,EAAA;IAAAhC,CAAA,OAAAoF,EAAA;EAAA;IAAAA,EAAA,GAAApF,CAAA;EAAA;EAAA,OAPpBoF,EAOoB;AAAA,CAI/B;AAEDtF,WAAW,CAACwF,WAAW,GAAG,aAAa;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA3G,OAAA,GAEzBiB,WAAW;AA1JgB,SAAA0E,MAAAiB,KAAA;EAAA,OAqF+BA,KAAK,CAAAC,eAAgB,CAAC,CAAC;AAAA","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.StyledProgressBarStepWrapper = exports.StyledProgressBarStep = exports.StyledProgressBarProgressWrapper = exports.StyledProgressBarLabel = exports.StyledProgressBarBackground = exports.StyledProgressBar = exports.StyledMotionProgressBarProgress = void 0;
|
|
6
|
+
exports.StyledProgressBarThumbLabel = exports.StyledProgressBarStepWrapper = exports.StyledProgressBarStep = exports.StyledProgressBarShine = exports.StyledProgressBarProgressWrapper = exports.StyledProgressBarLabel = exports.StyledProgressBarBackground = exports.StyledProgressBar = exports.StyledMotionProgressBarProgress = void 0;
|
|
7
7
|
var _react = require("motion/react");
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
9
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
@@ -29,11 +29,42 @@ const StyledProgressBarProgressWrapper = exports.StyledProgressBarProgressWrappe
|
|
|
29
29
|
$isBig
|
|
30
30
|
}) => $isBig ? 20 : 2}px;
|
|
31
31
|
`;
|
|
32
|
+
const shineMove = (0, _styledComponents.keyframes)`
|
|
33
|
+
from {
|
|
34
|
+
transform: translateX(-150%);
|
|
35
|
+
}
|
|
36
|
+
to {
|
|
37
|
+
transform: translateX(150%);
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
const StyledProgressBarShine = exports.StyledProgressBarShine = _styledComponents.default.div.attrs(({
|
|
41
|
+
$delay
|
|
42
|
+
}) => ({
|
|
43
|
+
style: {
|
|
44
|
+
animationDelay: `${$delay ?? 0}s`
|
|
45
|
+
}
|
|
46
|
+
}))`
|
|
47
|
+
position: absolute;
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: 100%;
|
|
50
|
+
background: linear-gradient(
|
|
51
|
+
90deg,
|
|
52
|
+
rgba(255, 255, 255, 0) 33%,
|
|
53
|
+
rgba(255, 255, 255, 0.5) 50%,
|
|
54
|
+
rgba(255, 255, 255, 0) 66%
|
|
55
|
+
);
|
|
56
|
+
transform: translateX(-150%);
|
|
57
|
+
animation: ${shineMove} ${({
|
|
58
|
+
$speed = 5
|
|
59
|
+
}) => `${$speed}s`} linear infinite;
|
|
60
|
+
opacity: 0.95;
|
|
61
|
+
`;
|
|
32
62
|
const StyledMotionProgressBarProgress = exports.StyledMotionProgressBarProgress = (0, _styledComponents.default)(_react.motion.div)`
|
|
33
63
|
height: 100%;
|
|
34
64
|
position: absolute;
|
|
35
65
|
top: 0;
|
|
36
66
|
left: 0;
|
|
67
|
+
overflow: hidden;
|
|
37
68
|
z-index: 2;
|
|
38
69
|
display: flex;
|
|
39
70
|
align-items: center;
|
|
@@ -97,4 +128,8 @@ const StyledProgressBarStep = exports.StyledProgressBarStep = _styledComponents.
|
|
|
97
128
|
$position
|
|
98
129
|
}) => $position}%;
|
|
99
130
|
`;
|
|
131
|
+
const StyledProgressBarThumbLabel = exports.StyledProgressBarThumbLabel = _styledComponents.default.div`
|
|
132
|
+
position: absolute;
|
|
133
|
+
right: 0;
|
|
134
|
+
`;
|
|
100
135
|
//# sourceMappingURL=ProgressBar.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledProgressBar","exports","styled","div","StyledProgressBarBackground","theme","$color","StyledProgressBarProgressWrapper","$isBig","StyledMotionProgressBarProgress","motion","headline","StyledProgressBarLabel","$shouldShowLabelInline","$colorSplitPosition","$primaryColor","$secondaryColor","css","StyledProgressBarStepWrapper","StyledProgressBarStep","$position"],"sources":["../../../../src/components/progress-bar/ProgressBar.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\n\nexport const StyledProgressBar = styled.div`\n position: relative;\n`;\n\ntype StyledProgressBarBackgroundProps = WithTheme<{ $color?: string }>;\n\nexport const StyledProgressBarBackground = styled.div<StyledProgressBarBackgroundProps>`\n height: 100%;\n width: 100%;\n background-color: ${({ theme, $color }: StyledProgressBarBackgroundProps) =>\n $color ?? theme['104']};\n`;\n\ntype StyledProgressBarProgressWrapperProps = WithTheme<{\n $isBig?: boolean;\n}>;\n\nexport const StyledProgressBarProgressWrapper = styled.div<StyledProgressBarProgressWrapperProps>`\n overflow: hidden;\n position: relative;\n width: 100%;\n height: ${({ $isBig }) => ($isBig ? 20 : 10)}px;\n border-radius: ${({ $isBig }) => ($isBig ? 20 : 2)}px;\n`;\n\ntype StyledProgressBarProgressProps = WithTheme<{ $color?: string }>;\n\nexport const StyledMotionProgressBarProgress = styled(motion.div)<StyledProgressBarProgressProps>`\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n z-index: 2;\n display: flex;\n align-items: center;\n padding-left: 12px;\n background-color: ${({ theme, $color }: StyledProgressBarProgressProps) =>\n $color ?? theme.headline};\n`;\n\ntype StyledProgressBarLabelProps = WithTheme<{\n $shouldShowLabelInline?: boolean;\n $primaryColor?: string;\n $secondaryColor?: string;\n $colorSplitPosition?: number;\n}>;\n\nexport const StyledProgressBarLabel = styled.div<StyledProgressBarLabelProps>`\n font-size: 85%;\n color: ${({ theme, $shouldShowLabelInline }: StyledProgressBarLabelProps) =>\n $shouldShowLabelInline ? theme['100'] : theme.headline};\n white-space: nowrap;\n\n ${({ $colorSplitPosition, $primaryColor, $secondaryColor, theme }) =>\n $colorSplitPosition &&\n css`\n position: absolute;\n z-index: 2;\n width: 100%;\n height: 100%;\n\n display: flex;\n align-items: center;\n\n padding-left: 8px;\n\n font-weight: bold;\n\n -webkit-background-clip: text;\n\n color: transparent;\n background-image: linear-gradient(\n 90deg,\n ${$primaryColor ?? theme['100']} ${$colorSplitPosition}%,\n ${$secondaryColor ?? theme['300']} ${$colorSplitPosition}%\n );\n `}\n`;\n\nexport const StyledProgressBarStepWrapper = styled.div`\n height: 100%;\n width: 100%;\n position: absolute;\n`;\n\ntype StyledProgressBarStepProps = WithTheme<{\n $position: number;\n $color?: string;\n}>;\n\nexport const StyledProgressBarStep = styled.div<StyledProgressBarStepProps>`\n background-color: ${({ theme, $color }: StyledProgressBarStepProps) => $color ?? theme['102']};\n height: 100%;\n width: 2px;\n position: absolute;\n top: 0;\n left: ${({ $position }: StyledProgressBarStepProps) => $position}%;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;
|
|
1
|
+
{"version":3,"file":"ProgressBar.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledProgressBar","exports","styled","div","StyledProgressBarBackground","theme","$color","StyledProgressBarProgressWrapper","$isBig","shineMove","keyframes","StyledProgressBarShine","attrs","$delay","style","animationDelay","$speed","StyledMotionProgressBarProgress","motion","headline","StyledProgressBarLabel","$shouldShowLabelInline","$colorSplitPosition","$primaryColor","$secondaryColor","css","StyledProgressBarStepWrapper","StyledProgressBarStep","$position","StyledProgressBarThumbLabel"],"sources":["../../../../src/components/progress-bar/ProgressBar.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css, keyframes } from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\n\nexport const StyledProgressBar = styled.div`\n position: relative;\n`;\n\ntype StyledProgressBarBackgroundProps = WithTheme<{ $color?: string }>;\n\nexport const StyledProgressBarBackground = styled.div<StyledProgressBarBackgroundProps>`\n height: 100%;\n width: 100%;\n background-color: ${({ theme, $color }: StyledProgressBarBackgroundProps) =>\n $color ?? theme['104']};\n`;\n\ntype StyledProgressBarProgressWrapperProps = WithTheme<{\n $isBig?: boolean;\n}>;\n\nexport const StyledProgressBarProgressWrapper = styled.div<StyledProgressBarProgressWrapperProps>`\n overflow: hidden;\n position: relative;\n width: 100%;\n height: ${({ $isBig }) => ($isBig ? 20 : 10)}px;\n border-radius: ${({ $isBig }) => ($isBig ? 20 : 2)}px;\n`;\n\ntype StyledProgressBarProgressProps = WithTheme<{ $color?: string }>;\n\nconst shineMove = keyframes`\n from {\n transform: translateX(-150%);\n }\n to {\n transform: translateX(150%);\n }\n`;\n\nexport const StyledProgressBarShine = styled.div.attrs<{ $speed?: number; $delay?: number }>(\n ({ $delay }) => ({\n style: { animationDelay: `${$delay ?? 0}s` },\n }),\n)`\n position: absolute;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n rgba(255, 255, 255, 0) 33%,\n rgba(255, 255, 255, 0.5) 50%,\n rgba(255, 255, 255, 0) 66%\n );\n transform: translateX(-150%);\n animation: ${shineMove} ${({ $speed = 5 }) => `${$speed}s`} linear infinite;\n opacity: 0.95;\n`;\n\nexport const StyledMotionProgressBarProgress = styled(motion.div)<StyledProgressBarProgressProps>`\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n overflow: hidden;\n z-index: 2;\n display: flex;\n align-items: center;\n padding-left: 12px;\n background-color: ${({ theme, $color }: StyledProgressBarProgressProps) =>\n $color ?? theme.headline};\n`;\n\ntype StyledProgressBarLabelProps = WithTheme<{\n $shouldShowLabelInline?: boolean;\n $primaryColor?: string;\n $secondaryColor?: string;\n $colorSplitPosition?: number;\n}>;\n\nexport const StyledProgressBarLabel = styled.div<StyledProgressBarLabelProps>`\n font-size: 85%;\n color: ${({ theme, $shouldShowLabelInline }: StyledProgressBarLabelProps) =>\n $shouldShowLabelInline ? theme['100'] : theme.headline};\n white-space: nowrap;\n\n ${({ $colorSplitPosition, $primaryColor, $secondaryColor, theme }) =>\n $colorSplitPosition &&\n css`\n position: absolute;\n z-index: 2;\n width: 100%;\n height: 100%;\n\n display: flex;\n align-items: center;\n\n padding-left: 8px;\n\n font-weight: bold;\n\n -webkit-background-clip: text;\n\n color: transparent;\n background-image: linear-gradient(\n 90deg,\n ${$primaryColor ?? theme['100']} ${$colorSplitPosition}%,\n ${$secondaryColor ?? theme['300']} ${$colorSplitPosition}%\n );\n `}\n`;\n\nexport const StyledProgressBarStepWrapper = styled.div`\n height: 100%;\n width: 100%;\n position: absolute;\n`;\n\ntype StyledProgressBarStepProps = WithTheme<{\n $position: number;\n $color?: string;\n}>;\n\nexport const StyledProgressBarStep = styled.div<StyledProgressBarStepProps>`\n background-color: ${({ theme, $color }: StyledProgressBarStepProps) => $color ?? theme['102']};\n height: 100%;\n width: 2px;\n position: absolute;\n top: 0;\n left: ${({ $position }: StyledProgressBarStepProps) => $position}%;\n`;\n\nexport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AK;EAAEgB;AAAoD,CAAC,KACpEA,sBAAsB,GAAGhB,KAAK,CAAC,KAAK,CAAC,GAAGA,KAAK,CAACc,QAAQ;AAC9D;AACA;AACA,MAAM,CAAC;EAAEG,mBAAmB;EAAEC,aAAa;EAAEC,eAAe;EAAEnB;AAAM,CAAC,KAC7DiB,mBAAmB,IACnB,IAAAG,qBAAG;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkBF,aAAa,IAAIlB,KAAK,CAAC,KAAK,CAAC,IAAIiB,mBAAmB;AACtE,kBAAkBE,eAAe,IAAInB,KAAK,CAAC,KAAK,CAAC,IAAIiB,mBAAmB;AACxE;AACA,SAAS;AACT,CAAC;AAEM,MAAMI,4BAA4B,GAAAzB,OAAA,CAAAyB,4BAAA,GAAGxB,yBAAM,CAACC,GAAG;AACtD;AACA;AACA;AACA,CAAC;AAOM,MAAMwB,qBAAqB,GAAA1B,OAAA,CAAA0B,qBAAA,GAAGzB,yBAAM,CAACC,GAA+B;AAC3E,wBAAwB,CAAC;EAAEE,KAAK;EAAEC;AAAmC,CAAC,KAAKA,MAAM,IAAID,KAAK,CAAC,KAAK,CAAC;AACjG;AACA;AACA;AACA;AACA,YAAY,CAAC;EAAEuB;AAAsC,CAAC,KAAKA,SAAS;AACpE,CAAC;AAEM,MAAMC,2BAA2B,GAAA5B,OAAA,CAAA4B,2BAAA,GAAG3B,yBAAM,CAACC,GAAG;AACrD;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numberInput.js","names":["_numberInput","require","parseFloatWithDecimals","stringValue","decimals","parsed","parseFloat","toFixed","exports","formateNumber","number","isMoneyInput","isTimeInput","hours","minutes","firstTwoDigits","substring","includes","replace","firstTwoNumbers","
|
|
1
|
+
{"version":3,"file":"numberInput.js","names":["_numberInput","require","parseFloatWithDecimals","stringValue","decimals","parsed","parseFloat","toFixed","exports","formateNumber","number","isMoneyInput","isTimeInput","Number","isNaN","hours","minutes","firstTwoDigits","substring","includes","replace","firstTwoNumbers","lastTwoNumbers","lastTwoNumbersLength","length","hoursStr","minutesStr","toLocaleString","useGrouping","minimumFractionDigits","undefined","maximumFractionDigits","maximumSignificantDigits","isValidString","isDecimalInput","string","isValid","DECIMAL_TEST","test","MONEY_TEST","TIME_TEST","INTEGER_TEST","startsWith"],"sources":["../../../src/utils/numberInput.ts"],"sourcesContent":["import { DECIMAL_TEST, INTEGER_TEST, MONEY_TEST, TIME_TEST } from '../constants/numberInput';\n\ninterface ParseFloatWithDecimals {\n ({ stringValue, decimals }: { stringValue: string; decimals?: number }): number | null;\n}\n\nexport const parseFloatWithDecimals: ParseFloatWithDecimals = ({ stringValue, decimals }) => {\n if (stringValue === '') {\n return null;\n }\n\n const parsed = parseFloat(stringValue);\n\n if (decimals) {\n return parseFloat(parsed.toFixed(decimals));\n }\n\n return parsed;\n};\n\ninterface FormateNumberOptions {\n number: number | string | null;\n isMoneyInput?: boolean;\n isTimeInput?: boolean;\n}\n\nexport const formateNumber = ({ number, isMoneyInput, isTimeInput }: FormateNumberOptions) => {\n if (Number.isNaN(number)) return '';\n if (isTimeInput && typeof number === 'string') {\n let hours = 0;\n let minutes = 0;\n\n let firstTwoDigits = number.substring(0, 2);\n\n if (firstTwoDigits.includes(':')) {\n firstTwoDigits = firstTwoDigits.replace(':', '');\n\n firstTwoDigits = `0${firstTwoDigits}`;\n }\n\n const firstTwoNumbers = Number(firstTwoDigits);\n let lastTwoNumbers = 0;\n let lastTwoNumbersLength = 0;\n\n if (number.includes(':')) {\n lastTwoNumbers = Number(number.substring(3, 5));\n lastTwoNumbersLength = number.substring(3, 5).length;\n } else {\n lastTwoNumbers = Number(number.substring(2, 4));\n lastTwoNumbersLength = number.substring(2, 4).length;\n }\n\n hours = firstTwoNumbers > 23 ? 23 : firstTwoNumbers;\n\n if (lastTwoNumbers < 7 && lastTwoNumbersLength === 1) {\n minutes = lastTwoNumbers * 10;\n } else {\n minutes = lastTwoNumbers > 59 ? 59 : lastTwoNumbers;\n }\n\n const hoursStr = hours < 10 ? `0${hours}` : `${hours}`;\n const minutesStr = minutes < 10 ? `0${minutes}` : `${minutes}`;\n\n return `${hoursStr}:${minutesStr}`;\n }\n\n if (typeof number !== 'number') {\n return '';\n }\n\n return number.toLocaleString('de-DE', {\n useGrouping: true,\n minimumFractionDigits: isMoneyInput ? 2 : undefined,\n maximumFractionDigits: isMoneyInput ? 2 : undefined,\n maximumSignificantDigits: !isMoneyInput ? 20 : undefined,\n });\n};\n\ninterface IsValidString {\n (config: {\n string: string;\n isDecimalInput?: boolean;\n isMoneyInput?: boolean;\n isTimeInput?: boolean;\n }): boolean;\n}\n\nexport const isValidString: IsValidString = ({\n isDecimalInput,\n isMoneyInput,\n isTimeInput,\n string,\n}) => {\n let isValid = false;\n\n // Allows numbers, one (comma/point) and any number of decimal places\n if (isDecimalInput && DECIMAL_TEST.test(string)) {\n isValid = true;\n }\n\n // Allows numbers but excludes numbers with leading 0\n if (isMoneyInput && MONEY_TEST.test(string)) {\n isValid = true;\n }\n\n if (isTimeInput && TIME_TEST) {\n isValid = true;\n }\n\n // Allows numbers but excludes numbers with leading 0\n if (!isDecimalInput && !isMoneyInput && !isTimeInput && INTEGER_TEST.test(string)) {\n isValid = true;\n }\n\n if (string.length === 0) {\n isValid = true;\n }\n\n if (string.startsWith('0')) {\n isValid = true;\n }\n\n return isValid;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAMO,MAAMC,sBAA8C,GAAGA,CAAC;EAAEC,WAAW;EAAEC;AAAS,CAAC,KAAK;EACzF,IAAID,WAAW,KAAK,EAAE,EAAE;IACpB,OAAO,IAAI;EACf;EAEA,MAAME,MAAM,GAAGC,UAAU,CAACH,WAAW,CAAC;EAEtC,IAAIC,QAAQ,EAAE;IACV,OAAOE,UAAU,CAACD,MAAM,CAACE,OAAO,CAACH,QAAQ,CAAC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;EACA,IAAI,CAACF,cAAc,IAAI,CAACvB,YAAY,IAAI,CAACC,WAAW,IAAI6B,yBAAY,CAACH,IAAI,CAACH,MAAM,CAAC,EAAE;IAC/EC,OAAO,GAAG,IAAI;EAClB;EAEA,IAAID,MAAM,CAACX,MAAM,KAAK,CAAC,EAAE;IACrBY,OAAO,GAAG,IAAI;EAClB;EAEA,IAAID,MAAM,CAACO,UAAU,CAAC,GAAG,CAAC,EAAE;IACxBN,OAAO,GAAG,IAAI;EAClB;EAEA,OAAOA,OAAO;AAClB,CAAC;AAAC5B,OAAA,CAAAyB,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useSite } from 'chayns-api';
|
|
1
|
+
import { useDevice, useSite } from 'chayns-api';
|
|
2
2
|
import React, { createContext, useContext, useMemo } from 'react';
|
|
3
3
|
import { createGlobalStyle, ThemeProvider } from 'styled-components';
|
|
4
4
|
import { StyledColorSchemeProvider } from './ColorSchemeProvider.styles';
|
|
@@ -38,6 +38,9 @@ const ColorSchemeProvider = ({
|
|
|
38
38
|
color: internalColor,
|
|
39
39
|
colorMode: internalColorMode
|
|
40
40
|
} = useSite();
|
|
41
|
+
const {
|
|
42
|
+
browser
|
|
43
|
+
} = useDevice();
|
|
41
44
|
const color = colorProp ?? context?.designSettings?.color ?? internalColor;
|
|
42
45
|
const colorMode = colorModeProp ?? context?.designSettings?.colorMode ?? internalColorMode;
|
|
43
46
|
const overrideParagraphFormat = color && color !== internalColor || colorMode !== internalColorMode;
|
|
@@ -58,7 +61,8 @@ const ColorSchemeProvider = ({
|
|
|
58
61
|
value: contextValue
|
|
59
62
|
}, /*#__PURE__*/React.createElement(StyledColorSchemeProvider, {
|
|
60
63
|
className: "color-scheme-provider",
|
|
61
|
-
style: style
|
|
64
|
+
style: style,
|
|
65
|
+
$browser: browser?.name
|
|
62
66
|
}, children), /*#__PURE__*/React.createElement(GlobalStyle, null)));
|
|
63
67
|
};
|
|
64
68
|
ColorSchemeProvider.displayName = 'ColorSchemeProvider';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorSchemeProvider.js","names":["useSite","React","createContext","useContext","useMemo","createGlobalStyle","ThemeProvider","StyledColorSchemeProvider","useChaynsTheme","GlobalStyle","ColorSchemeContext","undefined","useColorScheme","ColorSchemeProvider","children","color","colorProp","colorMode","colorModeProp","secondaryColor","siteId","style","iconColor","customVariables","context","internalColor","internalColorMode","designSettings","overrideParagraphFormat","paragraphFormat","contextValue","createElement","theme","Provider","value","className","displayName"],"sources":["../../../../src/components/color-scheme-provider/ColorSchemeProvider.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"ColorSchemeProvider.js","names":["useDevice","useSite","React","createContext","useContext","useMemo","createGlobalStyle","ThemeProvider","StyledColorSchemeProvider","useChaynsTheme","GlobalStyle","ColorSchemeContext","undefined","useColorScheme","ColorSchemeProvider","children","color","colorProp","colorMode","colorModeProp","secondaryColor","siteId","style","iconColor","customVariables","context","internalColor","internalColorMode","browser","designSettings","overrideParagraphFormat","paragraphFormat","contextValue","createElement","theme","Provider","value","className","$browser","name","displayName"],"sources":["../../../../src/components/color-scheme-provider/ColorSchemeProvider.tsx"],"sourcesContent":["import {\n ChaynsDesignSettings,\n ChaynsParagraphFormat,\n ColorMode,\n useDevice,\n useSite,\n} from 'chayns-api';\nimport React, { createContext, FC, ReactNode, useContext, useMemo } from 'react';\nimport { createGlobalStyle, ThemeProvider } from 'styled-components';\nimport { StyledColorSchemeProvider } from './ColorSchemeProvider.styles';\nimport { useChaynsTheme } from './hooks/useChaynsTheme';\nimport { BrowserName } from '../../types/chayns';\n\nexport type ColorSchemeProviderProps = {\n /**\n * The content of the application or the components for which the styles should be set\n */\n children: ReactNode;\n /**\n * The hex color to be used for the children\n */\n color?: string;\n /**\n * The color mode to be used for the children\n */\n colorMode?: ColorMode;\n /**\n * The secondary hex color to be used for the children\n */\n secondaryColor?: string;\n /**\n * The site id of the page for which the design settings should be fetched\n */\n siteId?: string;\n /**\n * Additional styles set on the root element\n */\n style?: { [key: string]: string | number };\n /**\n * Additional variables to extend the theme\n */\n customVariables?: Record<string, string>;\n /**\n * An optional color for all icons\n */\n iconColor?: string;\n};\n\nexport interface Theme {\n [key: string]: string;\n}\n\nexport type WithTheme<T> = T & {\n theme: Theme;\n};\n\nconst GlobalStyle = createGlobalStyle`\n .ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n footer {\n font-size: 0.85rem;\n color: #888;\n margin: 10px 0 0;\n\n & a {\n color: #888;\n letter-spacing: -0.3px;\n }\n }\n`;\n\nexport interface ColorSchemeContextProps {\n designSettings?: ChaynsDesignSettings;\n paragraphFormat: ChaynsParagraphFormat[];\n theme: Theme;\n}\n\nexport const ColorSchemeContext = createContext<ColorSchemeContextProps | undefined>(undefined);\n\nexport const useColorScheme = () => useContext(ColorSchemeContext);\n\nconst ColorSchemeProvider: FC<ColorSchemeProviderProps> = ({\n children,\n color: colorProp,\n colorMode: colorModeProp,\n secondaryColor,\n siteId,\n style = {},\n iconColor,\n customVariables,\n}) => {\n const context = useContext(ColorSchemeContext);\n\n const { color: internalColor, colorMode: internalColorMode } = useSite();\n\n const { browser } = useDevice();\n\n const color = colorProp ?? context?.designSettings?.color ?? internalColor;\n const colorMode = colorModeProp ?? context?.designSettings?.colorMode ?? internalColorMode;\n\n const overrideParagraphFormat =\n (color && color !== internalColor) || colorMode !== internalColorMode;\n\n const paragraphFormat = useMemo(\n () => (overrideParagraphFormat ? [] : undefined),\n [overrideParagraphFormat],\n );\n\n const contextValue = useChaynsTheme({\n color,\n iconColor,\n colorMode,\n secondaryColor,\n siteId,\n customVariables,\n // Overrides the paragraphFormat on changed color or colorMode\n paragraphFormat,\n });\n\n return (\n <ThemeProvider theme={contextValue.theme}>\n <ColorSchemeContext.Provider value={contextValue}>\n <StyledColorSchemeProvider\n className=\"color-scheme-provider\"\n style={style}\n $browser={browser?.name as BrowserName}\n >\n {children}\n </StyledColorSchemeProvider>\n <GlobalStyle />\n </ColorSchemeContext.Provider>\n </ThemeProvider>\n );\n};\n\nColorSchemeProvider.displayName = 'ColorSchemeProvider';\n\nexport default ColorSchemeProvider;\n"],"mappings":"AAAA,SAIIA,SAAS,EACTC,OAAO,QACJ,YAAY;AACnB,OAAOC,KAAK,IAAIC,aAAa,EAAiBC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAChF,SAASC,iBAAiB,EAAEC,aAAa,QAAQ,mBAAmB;AACpE,SAASC,yBAAyB,QAAQ,8BAA8B;AACxE,SAASC,cAAc,QAAQ,wBAAwB;AA8CvD,MAAMC,WAAW,GAAGJ,iBAAiB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAQD,OAAO,MAAMK,kBAAkB,gBAAGR,aAAa,CAAsCS,SAAS,CAAC;AAE/F,OAAO,MAAMC,cAAc,GAAGA,CAAA,KAAMT,UAAU,CAACO,kBAAkB,CAAC;AAElE,MAAMG,mBAAiD,GAAGA,CAAC;EACvDC,QAAQ;EACRC,KAAK,EAAEC,SAAS;EAChBC,SAAS,EAAEC,aAAa;EACxBC,cAAc;EACdC,MAAM;EACNC,KAAK,GAAG,CAAC,CAAC;EACVC,SAAS;EACTC;AACJ,CAAC,KAAK;EACF,MAAMC,OAAO,GAAGrB,UAAU,CAACO,kBAAkB,CAAC;EAE9C,MAAM;IAAEK,KAAK,EAAEU,aAAa;IAAER,SAAS,EAAES;EAAkB,CAAC,GAAG1B,OAAO,CAAC,CAAC;EAExE,MAAM;IAAE2B;EAAQ,CAAC,GAAG5B,SAAS,CAAC,CAAC;EAE/B,MAAMgB,KAAK,GAAGC,SAAS,IAAIQ,OAAO,EAAEI,cAAc,EAAEb,KAAK,IAAIU,aAAa;EAC1E,MAAMR,SAAS,GAAGC,aAAa,IAAIM,OAAO,EAAEI,cAAc,EAAEX,SAAS,IAAIS,iBAAiB;EAE1F,MAAMG,uBAAuB,GACxBd,KAAK,IAAIA,KAAK,KAAKU,aAAa,IAAKR,SAAS,KAAKS,iBAAiB;EAEzE,MAAMI,eAAe,GAAG1B,OAAO,CAC3B,MAAOyB,uBAAuB,GAAG,EAAE,GAAGlB,SAAU,EAChD,CAACkB,uBAAuB,CAC5B,CAAC;EAED,MAAME,YAAY,GAAGvB,cAAc,CAAC;IAChCO,KAAK;IACLO,SAAS;IACTL,SAAS;IACTE,cAAc;IACdC,MAAM;IACNG,eAAe;IACf;IACAO;EACJ,CAAC,CAAC;EAEF,oBACI7B,KAAA,CAAA+B,aAAA,CAAC1B,aAAa;IAAC2B,KAAK,EAAEF,YAAY,CAACE;EAAM,gBACrChC,KAAA,CAAA+B,aAAA,CAACtB,kBAAkB,CAACwB,QAAQ;IAACC,KAAK,EAAEJ;EAAa,gBAC7C9B,KAAA,CAAA+B,aAAA,CAACzB,yBAAyB;IACtB6B,SAAS,EAAC,uBAAuB;IACjCf,KAAK,EAAEA,KAAM;IACbgB,QAAQ,EAAEV,OAAO,EAAEW;EAAoB,GAEtCxB,QACsB,CAAC,eAC5Bb,KAAA,CAAA+B,aAAA,CAACvB,WAAW,MAAE,CACW,CAClB,CAAC;AAExB,CAAC;AAEDI,mBAAmB,CAAC0B,WAAW,GAAG,qBAAqB;AAEvD,eAAe1B,mBAAmB","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getAvailableColorList } from '@chayns/colors';
|
|
2
|
-
import { styled } from 'styled-components';
|
|
2
|
+
import { css, styled } from 'styled-components';
|
|
3
3
|
// noinspection CssUnresolvedCustomProperty
|
|
4
4
|
export const StyledColorSchemeProvider = styled.div`
|
|
5
5
|
color: var(--chayns-color--text);
|
|
@@ -21,5 +21,42 @@ export const StyledColorSchemeProvider = styled.div`
|
|
|
21
21
|
.color-scheme-provider :is(h1,.h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6):first-child {
|
|
22
22
|
margin-top: 0;
|
|
23
23
|
}
|
|
24
|
+
|
|
25
|
+
// Styles for custom scrollbar
|
|
26
|
+
.chayns-scrollbar {
|
|
27
|
+
${({
|
|
28
|
+
$browser,
|
|
29
|
+
theme
|
|
30
|
+
}) => $browser === 'firefox' ? css`
|
|
31
|
+
scrollbar-color: rgba(${theme['text-rgb']}, 0.15) transparent;
|
|
32
|
+
scrollbar-width: thin;
|
|
33
|
+
` : css`
|
|
34
|
+
&::-webkit-scrollbar {
|
|
35
|
+
width: 10px;
|
|
36
|
+
height: 10px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&::-webkit-scrollbar-track {
|
|
40
|
+
background-color: transparent;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&::-webkit-scrollbar-button {
|
|
44
|
+
background-color: transparent;
|
|
45
|
+
height: 5px;
|
|
46
|
+
width: 5px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&::-webkit-scrollbar-thumb {
|
|
50
|
+
background-color: rgba(${theme['text-rgb']}, 0.15);
|
|
51
|
+
border-radius: 20px;
|
|
52
|
+
background-clip: padding-box;
|
|
53
|
+
border: solid 3px transparent;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&::-webkit-scrollbar-corner {
|
|
57
|
+
background-color: transparent;
|
|
58
|
+
}
|
|
59
|
+
`}
|
|
60
|
+
}
|
|
24
61
|
`;
|
|
25
62
|
//# sourceMappingURL=ColorSchemeProvider.styles.js.map
|