@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.
Files changed (42) hide show
  1. package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js +5 -1
  2. package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
  3. package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.styles.js +37 -0
  4. package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
  5. package/lib/cjs/components/grouped-image/GroupedImage.styles.js +18 -20
  6. package/lib/cjs/components/grouped-image/GroupedImage.styles.js.map +1 -1
  7. package/lib/cjs/components/list/List.js +97 -37
  8. package/lib/cjs/components/list/List.js.map +1 -1
  9. package/lib/cjs/components/list/list-item/ListItem.js +0 -9
  10. package/lib/cjs/components/list/list-item/ListItem.js.map +1 -1
  11. package/lib/cjs/components/number-input/NumberInput.js +213 -132
  12. package/lib/cjs/components/number-input/NumberInput.js.map +1 -1
  13. package/lib/cjs/components/progress-bar/ProgressBar.js +181 -66
  14. package/lib/cjs/components/progress-bar/ProgressBar.js.map +1 -1
  15. package/lib/cjs/components/progress-bar/ProgressBar.styles.js +36 -1
  16. package/lib/cjs/components/progress-bar/ProgressBar.styles.js.map +1 -1
  17. package/lib/cjs/utils/numberInput.js +1 -0
  18. package/lib/cjs/utils/numberInput.js.map +1 -1
  19. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js +6 -2
  20. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
  21. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js +38 -1
  22. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
  23. package/lib/esm/components/grouped-image/GroupedImage.styles.js +18 -20
  24. package/lib/esm/components/grouped-image/GroupedImage.styles.js.map +1 -1
  25. package/lib/esm/components/list/List.js +97 -37
  26. package/lib/esm/components/list/List.js.map +1 -1
  27. package/lib/esm/components/list/list-item/ListItem.js +0 -9
  28. package/lib/esm/components/list/list-item/ListItem.js.map +1 -1
  29. package/lib/esm/components/number-input/NumberInput.js +213 -132
  30. package/lib/esm/components/number-input/NumberInput.js.map +1 -1
  31. package/lib/esm/components/progress-bar/ProgressBar.js +173 -68
  32. package/lib/esm/components/progress-bar/ProgressBar.js.map +1 -1
  33. package/lib/esm/components/progress-bar/ProgressBar.styles.js +36 -1
  34. package/lib/esm/components/progress-bar/ProgressBar.styles.js.map +1 -1
  35. package/lib/esm/utils/numberInput.js +1 -0
  36. package/lib/esm/utils/numberInput.js.map +1 -1
  37. package/lib/types/components/color-scheme-provider/ColorSchemeProvider.styles.d.ts +7 -3
  38. package/lib/types/components/grouped-image/GroupedImage.styles.d.ts +3 -1
  39. package/lib/types/components/list/List.d.ts +0 -1
  40. package/lib/types/components/progress-bar/ProgressBar.d.ts +9 -1
  41. package/lib/types/components/progress-bar/ProgressBar.styles.d.ts +7 -0
  42. package/package.json +2 -2
@@ -1,88 +1,193 @@
1
- import React, { useEffect, useMemo, useState } from 'react';
1
+ import { c as _c } from "react-compiler-runtime";
2
+ import React, { useContext, useMemo, useRef } from 'react';
2
3
  import { useUuid } from '../../hooks/uuid';
3
- import { StyledMotionProgressBarProgress, StyledProgressBar, StyledProgressBarBackground, StyledProgressBarLabel, StyledProgressBarProgressWrapper, StyledProgressBarStep, StyledProgressBarStepWrapper } from './ProgressBar.styles';
4
- const ProgressBar = ({
5
- percentage,
6
- label,
7
- shouldHideProgress = false,
8
- shouldShowLabelInline = false,
9
- steps,
10
- colors
11
- }) => {
12
- const [internalPercentage, setInternalPercentage] = useState(0);
4
+ import { StyledMotionProgressBarProgress, StyledProgressBar, StyledProgressBarBackground, StyledProgressBarLabel, StyledProgressBarProgressWrapper, StyledProgressBarShine, StyledProgressBarStep, StyledProgressBarStepWrapper, StyledProgressBarThumbLabel } from './ProgressBar.styles';
5
+ import { PopupAlignment } from '../../types/popup';
6
+ import { ThemeContext, ThemeProvider } from 'styled-components';
7
+ import Popup from '../popup/Popup';
8
+ const ProgressBar = t0 => {
9
+ "use memo";
10
+
11
+ const $ = _c(29);
12
+ const {
13
+ percentage,
14
+ label,
15
+ shouldHideProgress: t1,
16
+ shouldShowLabelInline: t2,
17
+ steps,
18
+ colors,
19
+ thumbLabel,
20
+ showShine: t3
21
+ } = t0;
22
+ const shouldHideProgress = t1 === undefined ? false : t1;
23
+ const shouldShowLabelInline = t2 === undefined ? false : t2;
24
+ const showShine = t3 === undefined ? false : t3;
13
25
  const uuid = useUuid();
14
- useEffect(() => {
15
- if (typeof percentage !== 'number') {
16
- return;
26
+ const popupRef = useRef(null);
27
+ const theme = useContext(ThemeContext);
28
+ let t4;
29
+ bb0: {
30
+ if (!showShine || percentage === undefined) {
31
+ t4 = null;
32
+ break bb0;
17
33
  }
18
- if (percentage >= 0 && percentage <= 100) {
19
- setInternalPercentage(percentage);
34
+ const shineCount = Math.ceil(6 * (percentage / 100));
35
+ const speed = 5 * (percentage / 100);
36
+ let t5;
37
+ if ($[0] !== shineCount) {
38
+ t5 = Array.from({
39
+ length: shineCount
40
+ });
41
+ $[0] = shineCount;
42
+ $[1] = t5;
43
+ } else {
44
+ t5 = $[1];
20
45
  }
21
- }, [percentage]);
22
- const progressBar = useMemo(() => {
23
- if (shouldHideProgress) {
24
- return null;
46
+ let t6;
47
+ if ($[2] !== shineCount || $[3] !== speed || $[4] !== t5) {
48
+ t6 = t5.map((_, index) => /*#__PURE__*/React.createElement(StyledProgressBarShine, {
49
+ key: `progress-bar-shine__${shineCount}__${index}`,
50
+ $speed: speed,
51
+ $delay: 5 / shineCount * index
52
+ }));
53
+ $[2] = shineCount;
54
+ $[3] = speed;
55
+ $[4] = t5;
56
+ $[5] = t6;
57
+ } else {
58
+ t6 = $[5];
25
59
  }
26
- if (typeof percentage !== 'number') {
27
- return /*#__PURE__*/React.createElement(StyledProgressBarProgressWrapper, null, /*#__PURE__*/React.createElement(StyledMotionProgressBarProgress, {
28
- key: `progress-bar-loop__${uuid}`,
60
+ t4 = t6;
61
+ }
62
+ const shineEffect = t4;
63
+ let t5;
64
+ if ($[6] !== colors?.backgroundColor || $[7] !== colors?.primaryTextColor || $[8] !== colors?.progressColor || $[9] !== colors?.secondaryTextColor || $[10] !== colors?.stepColor || $[11] !== label || $[12] !== percentage || $[13] !== shineEffect || $[14] !== shouldHideProgress || $[15] !== shouldShowLabelInline || $[16] !== showShine || $[17] !== steps || $[18] !== theme || $[19] !== thumbLabel || $[20] !== uuid) {
65
+ colors?.backgroundColor;
66
+ colors?.primaryTextColor;
67
+ colors?.progressColor;
68
+ colors?.secondaryTextColor;
69
+ colors?.stepColor;
70
+ t5 = (() => {
71
+ if (shouldHideProgress) {
72
+ return null;
73
+ }
74
+ if (percentage === undefined) {
75
+ return /*#__PURE__*/React.createElement(StyledProgressBarProgressWrapper, null, /*#__PURE__*/React.createElement(StyledMotionProgressBarProgress, {
76
+ key: `progress-bar-loop__${uuid}`,
77
+ $color: colors?.progressColor,
78
+ initial: {
79
+ width: "200px",
80
+ left: "-200px"
81
+ },
82
+ animate: {
83
+ width: "200px",
84
+ left: "100%"
85
+ },
86
+ exit: {
87
+ width: "200px",
88
+ left: "100%"
89
+ },
90
+ transition: {
91
+ type: "tween",
92
+ repeat: Infinity,
93
+ repeatDelay: 0,
94
+ duration: 1
95
+ }
96
+ }), /*#__PURE__*/React.createElement(StyledProgressBarBackground, {
97
+ $color: colors?.backgroundColor
98
+ }));
99
+ }
100
+ return /*#__PURE__*/React.createElement(StyledProgressBarProgressWrapper, {
101
+ $isBig: shouldShowLabelInline
102
+ }, !!steps?.length && /*#__PURE__*/React.createElement(StyledProgressBarStepWrapper, null, steps.map(step => /*#__PURE__*/React.createElement(StyledProgressBarStep, {
103
+ $position: step,
104
+ key: `progress-step-${step}`,
105
+ $color: colors?.stepColor
106
+ }))), /*#__PURE__*/React.createElement(StyledMotionProgressBarProgress, {
29
107
  $color: colors?.progressColor,
108
+ key: `progress-bar__${uuid}`,
30
109
  initial: {
31
- width: '200px',
32
- left: '-200px'
110
+ width: "0%"
33
111
  },
34
112
  animate: {
35
- width: '200px',
36
- left: '100%'
113
+ width: `${percentage}%`
37
114
  },
38
115
  exit: {
39
- width: '200px',
40
- left: '100%'
116
+ width: "0%"
41
117
  },
42
118
  transition: {
43
- type: 'tween',
44
- repeat: Infinity,
45
- repeatDelay: 0,
46
- duration: 1
119
+ type: "tween"
120
+ },
121
+ onUpdate: () => popupRef.current?.show(),
122
+ onAnimationComplete: () => popupRef.current?.show()
123
+ }, showShine && shineEffect, thumbLabel && /*#__PURE__*/React.createElement(StyledProgressBarThumbLabel, {
124
+ onClick: _temp
125
+ }, /*#__PURE__*/React.createElement(ThemeProvider, {
126
+ theme: {
127
+ "000": colors?.backgroundColor ?? theme?.["104"],
128
+ text: colors?.secondaryTextColor ?? theme?.["300"]
47
129
  }
48
- }), /*#__PURE__*/React.createElement(StyledProgressBarBackground, {
130
+ }, /*#__PURE__*/React.createElement(Popup, {
131
+ ref: popupRef,
132
+ content: thumbLabel,
133
+ alignment: PopupAlignment.TopCenter,
134
+ onHide: () => popupRef.current?.show()
135
+ })))), shouldShowLabelInline && label && /*#__PURE__*/React.createElement(StyledProgressBarLabel, {
136
+ $shouldShowLabelInline: shouldShowLabelInline,
137
+ $primaryColor: colors?.primaryTextColor,
138
+ $secondaryColor: colors?.secondaryTextColor,
139
+ $colorSplitPosition: percentage
140
+ }, label), /*#__PURE__*/React.createElement(StyledProgressBarBackground, {
49
141
  $color: colors?.backgroundColor
50
142
  }));
51
- }
52
- return /*#__PURE__*/React.createElement(StyledProgressBarProgressWrapper, {
53
- $isBig: shouldShowLabelInline
54
- }, !!steps?.length && /*#__PURE__*/React.createElement(StyledProgressBarStepWrapper, null, steps.map(step => /*#__PURE__*/React.createElement(StyledProgressBarStep, {
55
- $position: step,
56
- key: `progress-step-${step}`,
57
- $color: colors?.stepColor
58
- }))), /*#__PURE__*/React.createElement(StyledMotionProgressBarProgress, {
59
- $color: colors?.progressColor,
60
- key: `progress-bar__${uuid}`,
61
- initial: {
62
- width: '0%'
63
- },
64
- animate: {
65
- width: `${internalPercentage}%`
66
- },
67
- exit: {
68
- width: '0%'
69
- },
70
- transition: {
71
- type: 'tween'
72
- }
73
- }), shouldShowLabelInline && label && /*#__PURE__*/React.createElement(StyledProgressBarLabel, {
74
- $shouldShowLabelInline: shouldShowLabelInline,
75
- $primaryColor: colors?.primaryTextColor,
76
- $secondaryColor: colors?.secondaryTextColor,
77
- $colorSplitPosition: internalPercentage
78
- }, label), /*#__PURE__*/React.createElement(StyledProgressBarBackground, {
79
- $color: colors?.backgroundColor
80
- }));
81
- }, [colors, internalPercentage, label, percentage, shouldHideProgress, shouldShowLabelInline, steps, uuid]);
82
- return useMemo(() => /*#__PURE__*/React.createElement(StyledProgressBar, null, progressBar, label && !shouldShowLabelInline && /*#__PURE__*/React.createElement(StyledProgressBarLabel, {
83
- $primaryColor: colors?.primaryTextColor
84
- }, label)), [progressBar, label, shouldShowLabelInline, colors?.primaryTextColor, colors?.secondaryTextColor]);
143
+ })();
144
+ $[6] = colors?.backgroundColor;
145
+ $[7] = colors?.primaryTextColor;
146
+ $[8] = colors?.progressColor;
147
+ $[9] = colors?.secondaryTextColor;
148
+ $[10] = colors?.stepColor;
149
+ $[11] = label;
150
+ $[12] = percentage;
151
+ $[13] = shineEffect;
152
+ $[14] = shouldHideProgress;
153
+ $[15] = shouldShowLabelInline;
154
+ $[16] = showShine;
155
+ $[17] = steps;
156
+ $[18] = theme;
157
+ $[19] = thumbLabel;
158
+ $[20] = uuid;
159
+ $[21] = t5;
160
+ } else {
161
+ t5 = $[21];
162
+ }
163
+ const progressBar = t5;
164
+ colors?.primaryTextColor;
165
+ let t6;
166
+ if ($[22] !== colors?.primaryTextColor || $[23] !== label || $[24] !== shouldShowLabelInline) {
167
+ t6 = label && !shouldShowLabelInline && /*#__PURE__*/React.createElement(StyledProgressBarLabel, {
168
+ $primaryColor: colors?.primaryTextColor
169
+ }, label);
170
+ $[22] = colors?.primaryTextColor;
171
+ $[23] = label;
172
+ $[24] = shouldShowLabelInline;
173
+ $[25] = t6;
174
+ } else {
175
+ t6 = $[25];
176
+ }
177
+ let t7;
178
+ if ($[26] !== progressBar || $[27] !== t6) {
179
+ t7 = /*#__PURE__*/React.createElement(StyledProgressBar, null, progressBar, t6);
180
+ $[26] = progressBar;
181
+ $[27] = t6;
182
+ $[28] = t7;
183
+ } else {
184
+ t7 = $[28];
185
+ }
186
+ return t7;
85
187
  };
86
188
  ProgressBar.displayName = 'ProgressBar';
87
189
  export default ProgressBar;
190
+ function _temp(event) {
191
+ return event.stopPropagation();
192
+ }
88
193
  //# sourceMappingURL=ProgressBar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressBar.js","names":["React","useEffect","useMemo","useState","useUuid","StyledMotionProgressBarProgress","StyledProgressBar","StyledProgressBarBackground","StyledProgressBarLabel","StyledProgressBarProgressWrapper","StyledProgressBarStep","StyledProgressBarStepWrapper","ProgressBar","percentage","label","shouldHideProgress","shouldShowLabelInline","steps","colors","internalPercentage","setInternalPercentage","uuid","progressBar","createElement","key","$color","progressColor","initial","width","left","animate","exit","transition","type","repeat","Infinity","repeatDelay","duration","backgroundColor","$isBig","length","map","step","$position","stepColor","$shouldShowLabelInline","$primaryColor","primaryTextColor","$secondaryColor","secondaryTextColor","$colorSplitPosition","displayName"],"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,OAAOA,KAAK,IAAQC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC/D,SAASC,OAAO,QAAQ,kBAAkB;AAC1C,SACIC,+BAA+B,EAC/BC,iBAAiB,EACjBC,2BAA2B,EAC3BC,sBAAsB,EACtBC,gCAAgC,EAChCC,qBAAqB,EACrBC,4BAA4B,QACzB,sBAAsB;AA2C7B,MAAMC,WAAiC,GAAGA,CAAC;EACvCC,UAAU;EACVC,KAAK;EACLC,kBAAkB,GAAG,KAAK;EAC1BC,qBAAqB,GAAG,KAAK;EAC7BC,KAAK;EACLC;AACJ,CAAC,KAAK;EACF,MAAM,CAACC,kBAAkB,EAAEC,qBAAqB,CAAC,GAAGjB,QAAQ,CAAC,CAAC,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AA,CAACf,sBAAsB;IAACsC,aAAa,EAAE5B,MAAM,EAAE6B;EAAiB,GAC3DjC,KACmB,CAEb,CACtB,EACD,CACIQ,WAAW,EACXR,KAAK,EACLE,qBAAqB,EACrBE,MAAM,EAAE6B,gBAAgB,EACxB7B,MAAM,EAAE+B,kBAAkB,CAElC,CAAC;AACL,CAAC;AAEDrC,WAAW,CAACuC,WAAW,GAAG,aAAa;AAEvC,eAAevC,WAAW","ignoreList":[]}
1
+ {"version":3,"file":"ProgressBar.js","names":["React","useContext","useMemo","useRef","useUuid","StyledMotionProgressBarProgress","StyledProgressBar","StyledProgressBarBackground","StyledProgressBarLabel","StyledProgressBarProgressWrapper","StyledProgressBarShine","StyledProgressBarStep","StyledProgressBarStepWrapper","StyledProgressBarThumbLabel","PopupAlignment","ThemeContext","ThemeProvider","Popup","ProgressBar","t0","$","_c","percentage","label","shouldHideProgress","t1","shouldShowLabelInline","t2","steps","colors","thumbLabel","showShine","t3","undefined","uuid","popupRef","theme","t4","bb0","shineCount","Math","ceil","speed","t5","Array","from","length","t6","map","_","index","createElement","key","$delay","shineEffect","backgroundColor","primaryTextColor","progressColor","secondaryTextColor","stepColor","$color","initial","width","left","animate","exit","transition","type","repeat","Infinity","repeatDelay","duration","step","onUpdate","current","show","onAnimationComplete","onClick","_temp","text","alignment","TopCenter","onHide","$primaryColor","$secondaryColor","progressBar","t7","displayName","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,OAAOA,KAAK,IAAQC,UAAU,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAC9D,SAASC,OAAO,QAAQ,kBAAkB;AAC1C,SACIC,+BAA+B,EAC/BC,iBAAiB,EACjBC,2BAA2B,EAC3BC,sBAAsB,EACtBC,gCAAgC,EAChCC,sBAAsB,EACtBC,qBAAqB,EACrBC,4BAA4B,EAC5BC,2BAA2B,QACxB,sBAAsB;AAC7B,SAASC,cAAc,QAAkB,mBAAmB;AAC5D,SAASC,YAAY,EAAEC,aAAa,QAAQ,mBAAmB;AAE/D,OAAOC,KAAK,MAAM,gBAAgB;AAmDlC,MAAMC,WAAiC,GAAGC,EAAA;EAAA;;EAAA,MAAAC,CAAA,GAAAC,EAAA;EAAC;IAAAC,UAAA;IAAAC,KAAA;IAAAC,kBAAA,EAAAC,EAAA;IAAAC,qBAAA,EAAAC,EAAA;IAAAC,KAAA;IAAAC,MAAA;IAAAC,UAAA;IAAAC,SAAA,EAAAC;EAAA,IAAAb,EAS1C;EANG,MAAAK,kBAAA,GAAAC,EAA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AAA;IAAAjE,CAAA,OAAA2B,EAAA;IAAA3B,CAAA,OAAAkE,EAAA;EAAA;IAAAA,EAAA,GAAAlE,CAAA;EAAA;EAAA,OAPpBkE,EAOoB;AAAA,CAI/B;AAEDpE,WAAW,CAACqE,WAAW,GAAG,aAAa;AAEvC,eAAerE,WAAW;AA1JgB,SAAA4D,MAAAU,KAAA;EAAA,OAqF+BA,KAAK,CAAAC,eAAgB,CAAC,CAAC;AAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import { motion } from 'motion/react';
2
- import styled, { css } from 'styled-components';
2
+ import styled, { css, keyframes } from 'styled-components';
3
3
  export const StyledProgressBar = styled.div`
4
4
  position: relative;
5
5
  `;
@@ -22,11 +22,42 @@ export const StyledProgressBarProgressWrapper = styled.div`
22
22
  $isBig
23
23
  }) => $isBig ? 20 : 2}px;
24
24
  `;
25
+ const shineMove = keyframes`
26
+ from {
27
+ transform: translateX(-150%);
28
+ }
29
+ to {
30
+ transform: translateX(150%);
31
+ }
32
+ `;
33
+ export const StyledProgressBarShine = styled.div.attrs(({
34
+ $delay
35
+ }) => ({
36
+ style: {
37
+ animationDelay: `${$delay ?? 0}s`
38
+ }
39
+ }))`
40
+ position: absolute;
41
+ width: 100%;
42
+ height: 100%;
43
+ background: linear-gradient(
44
+ 90deg,
45
+ rgba(255, 255, 255, 0) 33%,
46
+ rgba(255, 255, 255, 0.5) 50%,
47
+ rgba(255, 255, 255, 0) 66%
48
+ );
49
+ transform: translateX(-150%);
50
+ animation: ${shineMove} ${({
51
+ $speed = 5
52
+ }) => `${$speed}s`} linear infinite;
53
+ opacity: 0.95;
54
+ `;
25
55
  export const StyledMotionProgressBarProgress = styled(motion.div)`
26
56
  height: 100%;
27
57
  position: absolute;
28
58
  top: 0;
29
59
  left: 0;
60
+ overflow: hidden;
30
61
  z-index: 2;
31
62
  display: flex;
32
63
  align-items: center;
@@ -90,4 +121,8 @@ export const StyledProgressBarStep = styled.div`
90
121
  $position
91
122
  }) => $position}%;
92
123
  `;
124
+ export const StyledProgressBarThumbLabel = styled.div`
125
+ position: absolute;
126
+ right: 0;
127
+ `;
93
128
  //# sourceMappingURL=ProgressBar.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressBar.styles.js","names":["motion","styled","css","StyledProgressBar","div","StyledProgressBarBackground","theme","$color","StyledProgressBarProgressWrapper","$isBig","StyledMotionProgressBarProgress","headline","StyledProgressBarLabel","$shouldShowLabelInline","$colorSplitPosition","$primaryColor","$secondaryColor","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,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAG/C,OAAO,MAAMC,iBAAiB,GAAGF,MAAM,CAACG,GAAG;AAC3C;AACA,CAAC;AAID,OAAO,MAAMC,2BAA2B,GAAGJ,MAAM,CAACG,GAAqC;AACvF;AACA;AACA,wBAAwB,CAAC;EAAEE,KAAK;EAAEC;AAAyC,CAAC,KACpEA,MAAM,IAAID,KAAK,CAAC,KAAK,CAAC;AAC9B,CAAC;AAMD,OAAO,MAAME,gCAAgC,GAAGP,MAAM,CAACG,GAA0C;AACjG;AACA;AACA;AACA,cAAc,CAAC;EAAEK;AAAO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
+ {"version":3,"file":"ProgressBar.styles.js","names":["motion","styled","css","keyframes","StyledProgressBar","div","StyledProgressBarBackground","theme","$color","StyledProgressBarProgressWrapper","$isBig","shineMove","StyledProgressBarShine","attrs","$delay","style","animationDelay","$speed","StyledMotionProgressBarProgress","headline","StyledProgressBarLabel","$shouldShowLabelInline","$colorSplitPosition","$primaryColor","$secondaryColor","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 const StyledProgressBarThumbLabel = styled.div`\n position: absolute;\n right: 0;\n`;\n"],"mappings":"AAAA,SAASA,MAAM,Q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M,CAACI,GAAgC;AAC7E;AACA,aAAa,CAAC;EAAEE,KAAK;EAAEc;AAAoD,CAAC,KACpEA,sBAAsB,GAAGd,KAAK,CAAC,KAAK,CAAC,GAAGA,KAAK,CAACY,QAAQ;AAC9D;AACA;AACA,MAAM,CAAC;EAAEG,mBAAmB;EAAEC,aAAa;EAAEC,eAAe;EAAEjB;AAAM,CAAC,KAC7De,mBAAmB,IACnBpB,GAAG;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkBqB,aAAa,IAAIhB,KAAK,CAAC,KAAK,CAAC,IAAIe,mBAAmB;AACtE,kBAAkBE,eAAe,IAAIjB,KAAK,CAAC,KAAK,CAAC,IAAIe,mBAAmB;AACxE;AACA,SAAS;AACT,CAAC;AAED,OAAO,MAAMG,4BAA4B,GAAGxB,MAAM,CAACI,GAAG;AACtD;AACA;AACA;AACA,CAAC;AAOD,OAAO,MAAMqB,qBAAqB,GAAGzB,MAAM,CAACI,GAA+B;AAC3E,wBAAwB,CAAC;EAAEE,KAAK;EAAEC;AAAmC,CAAC,KAAKA,MAAM,IAAID,KAAK,CAAC,KAAK,CAAC;AACjG;AACA;AACA;AACA;AACA,YAAY,CAAC;EAAEoB;AAAsC,CAAC,KAAKA,SAAS;AACpE,CAAC;AAED,OAAO,MAAMC,2BAA2B,GAAG3B,MAAM,CAACI,GAAG;AACrD;AACA;AACA,CAAC","ignoreList":[]}
@@ -17,6 +17,7 @@ export const formateNumber = ({
17
17
  isMoneyInput,
18
18
  isTimeInput
19
19
  }) => {
20
+ if (Number.isNaN(number)) return '';
20
21
  if (isTimeInput && typeof number === 'string') {
21
22
  let hours = 0;
22
23
  let minutes = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"numberInput.js","names":["DECIMAL_TEST","INTEGER_TEST","MONEY_TEST","TIME_TEST","parseFloatWithDecimals","stringValue","decimals","parsed","parseFloat","toFixed","formateNumber","number","isMoneyInput","isTimeInput","hours","minutes","firstTwoDigits","substring","includes","replace","firstTwoNumbers","Number","lastTwoNumbers","lastTwoNumbersLength","length","hoursStr","minutesStr","toLocaleString","useGrouping","minimumFractionDigits","undefined","maximumFractionDigits","maximumSignificantDigits","isValidString","isDecimalInput","string","isValid","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 (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,SAASA,YAAY,EAAEC,YAAY,EAAEC,UAAU,EAAEC,SAAS,QAAQ,0BAA0B;AAM5F,OAAO,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,CAAC;EAC/C;EAEA,OAAOC,MAAM;AACjB,CAAC;AAQD,OA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BY,OAAO,GAAG,IAAI;EAClB;EAEA,IAAID,MAAM,CAACG,UAAU,CAAC,GAAG,CAAC,EAAE;IACxBF,OAAO,GAAG,IAAI;EAClB;EAEA,OAAOA,OAAO;AAClB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"numberInput.js","names":["DECIMAL_TEST","INTEGER_TEST","MONEY_TEST","TIME_TEST","parseFloatWithDecimals","stringValue","decimals","parsed","parseFloat","toFixed","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","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,SAASA,YAAY,EAAEC,YAAY,EAAEC,UAAU,EAAEC,SAAS,QAAQ,0BAA0B;AAM5F,OAAO,M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;;EAEA;EACA,IAAIzB,YAAY,IAAIV,UAAU,CAACoC,IAAI,CAACF,MAAM,CAAC,EAAE;IACzCC,OAAO,GAAG,IAAI;EAClB;EAEA,IAAIxB,WAAW,IAAIV,SAAS,EAAE;IAC1BkC,OAAO,GAAG,IAAI;EAClB;;EAEA;EACA,IAAI,CAACF,cAAc,IAAI,CAACvB,YAAY,IAAI,CAACC,WAAW,IAAIZ,YAAY,CAACqC,IAAI,CAACF,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,CAACG,UAAU,CAAC,GAAG,CAAC,EAAE;IACxBF,OAAO,GAAG,IAAI;EAClB;EAEA,OAAOA,OAAO;AAClB,CAAC","ignoreList":[]}
@@ -1,3 +1,7 @@
1
- export declare const StyledColorSchemeProvider: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
2
- theme: import("./ColorSchemeProvider").Theme;
3
- }>> & string;
1
+ import type { WithTheme } from './ColorSchemeProvider';
2
+ import { BrowserName } from '../../types/chayns';
3
+ type ColorSchemeProviderProps = WithTheme<{
4
+ $browser: BrowserName;
5
+ }>;
6
+ export declare const StyledColorSchemeProvider: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, ColorSchemeProviderProps>> & string;
7
+ export {};
@@ -13,7 +13,9 @@ type StyledImageProps = WithTheme<{
13
13
  $hasMultipleImages: boolean;
14
14
  $uuid: string;
15
15
  }>;
16
- export declare const StyledGroupImageElement: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledImageProps>> & string;
16
+ export declare const StyledGroupImageElement: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
17
+ ref?: React.RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null | undefined;
18
+ }>, StyledImageProps>, never>> & string;
17
19
  type StyledCornerImageProps = WithTheme<{
18
20
  $background?: CSSProperties['background'];
19
21
  $shouldPreventBackground?: boolean;
@@ -1,6 +1,5 @@
1
1
  import React, { FC, ReactNode } from 'react';
2
2
  interface IListContext {
3
- incrementExpandableItemCount: () => () => void;
4
3
  isAnyItemExpandable: boolean;
5
4
  isWrapped: boolean;
6
5
  openItemUuid: string | undefined;
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import React, { FC } from 'react';
2
2
  type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc['length']]>;
3
3
  type Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
4
4
  interface Colors {
@@ -33,6 +33,14 @@ export type ProgressBarProps = {
33
33
  * Visual marked steps.
34
34
  */
35
35
  steps?: Range<0, 101>[];
36
+ /**
37
+ * The label that should be displayed on the thumb of the progress bar.
38
+ */
39
+ thumbLabel?: React.ReactNode;
40
+ /**
41
+ * Whether a shine animation should be shown on the progress bar. The amount of shine is based on the percentage value.
42
+ */
43
+ showShine?: boolean;
36
44
  };
37
45
  declare const ProgressBar: FC<ProgressBarProps>;
38
46
  export default ProgressBar;
@@ -11,6 +11,12 @@ export declare const StyledProgressBarProgressWrapper: import("styled-components
11
11
  type StyledProgressBarProgressProps = WithTheme<{
12
12
  $color?: string;
13
13
  }>;
14
+ export declare const StyledProgressBarShine: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
15
+ ref?: React.RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null | undefined;
16
+ }>, {
17
+ $speed?: number;
18
+ $delay?: number;
19
+ }>, never>> & string;
14
20
  export declare const StyledMotionProgressBarProgress: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<import("motion/react").HTMLMotionProps<"div">, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & {
15
21
  ref?: React.RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null | undefined;
16
22
  }, StyledProgressBarProgressProps>> & string & Omit<import("motion/react").ForwardRefComponent<HTMLDivElement, import("motion/react").HTMLMotionProps<"div">>, keyof React.Component<any, {}, any>>;
@@ -27,4 +33,5 @@ type StyledProgressBarStepProps = WithTheme<{
27
33
  $color?: string;
28
34
  }>;
29
35
  export declare const StyledProgressBarStep: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledProgressBarStepProps>> & string;
36
+ export declare const StyledProgressBarThumbLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
30
37
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chayns-components/core",
3
- "version": "5.0.21",
3
+ "version": "5.0.25",
4
4
  "description": "A set of beautiful React components for developing your own applications with chayns.",
5
5
  "sideEffects": false,
6
6
  "browserslist": [
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "access": "public"
88
88
  },
89
- "gitHead": "bb71f793404d168943ca75bde5b462f34a80a1cd"
89
+ "gitHead": "c7f8c9b84a5800ab68c7608d619f2b74291bee98"
90
90
  }