@chayns-components/core 5.0.0-beta.1244 → 5.0.0-beta.1245

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.
@@ -11,7 +11,10 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
11
11
  const ProgressBar = ({
12
12
  percentage,
13
13
  label,
14
- shouldHideProgress = false
14
+ shouldHideProgress = false,
15
+ shouldShowLabelInline = false,
16
+ steps,
17
+ colors
15
18
  }) => {
16
19
  const [internalPercentage, setInternalPercentage] = (0, _react.useState)(0);
17
20
  const uuid = (0, _uuid.useUuid)();
@@ -30,6 +33,7 @@ const ProgressBar = ({
30
33
  if (typeof percentage !== 'number') {
31
34
  return /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarProgressWrapper, null, /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledMotionProgressBarProgress, {
32
35
  key: `progress-bar-loop__${uuid}`,
36
+ $color: colors === null || colors === void 0 ? void 0 : colors.progressColor,
33
37
  initial: {
34
38
  width: '200px',
35
39
  left: '-200px'
@@ -48,9 +52,18 @@ const ProgressBar = ({
48
52
  repeatDelay: 0,
49
53
  duration: 1
50
54
  }
51
- }), /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarBackground, null));
55
+ }), /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarBackground, {
56
+ $color: colors === null || colors === void 0 ? void 0 : colors.backgroundColor
57
+ }));
52
58
  }
53
- return /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarProgressWrapper, null, /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledMotionProgressBarProgress, {
59
+ return /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarProgressWrapper, {
60
+ $isBig: shouldShowLabelInline
61
+ }, !!(steps !== null && steps !== void 0 && steps.length) && /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarStepWrapper, null, steps.map(step => /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarStep, {
62
+ $position: step,
63
+ key: `progress-step-${step}`,
64
+ $color: colors === null || colors === void 0 ? void 0 : colors.stepColor
65
+ }))), /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledMotionProgressBarProgress, {
66
+ $color: colors === null || colors === void 0 ? void 0 : colors.progressColor,
54
67
  key: `progress-bar__${uuid}`,
55
68
  initial: {
56
69
  width: '0%'
@@ -64,9 +77,18 @@ const ProgressBar = ({
64
77
  transition: {
65
78
  type: 'tween'
66
79
  }
67
- }), /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarBackground, null));
68
- }, [internalPercentage, percentage, shouldHideProgress, uuid]);
69
- return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBar, null, progressBar, label && /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarLabel, null, label)), [progressBar, label]);
80
+ }), shouldShowLabelInline && label && /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarLabel, {
81
+ $shouldShowLabelInline: shouldShowLabelInline,
82
+ $primaryColor: colors === null || colors === void 0 ? void 0 : colors.primaryTextColor,
83
+ $secondaryColor: colors === null || colors === void 0 ? void 0 : colors.secondaryTextColor,
84
+ $colorSplitPosition: internalPercentage
85
+ }, label), /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarBackground, {
86
+ $color: colors === null || colors === void 0 ? void 0 : colors.backgroundColor
87
+ }));
88
+ }, [colors, internalPercentage, label, percentage, shouldHideProgress, shouldShowLabelInline, steps, uuid]);
89
+ return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBar, null, progressBar, label && !shouldShowLabelInline && /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarLabel, {
90
+ $primaryColor: colors === null || colors === void 0 ? void 0 : colors.primaryTextColor
91
+ }, label)), [progressBar, label, shouldShowLabelInline, colors === null || colors === void 0 ? void 0 : colors.primaryTextColor, colors === null || colors === void 0 ? void 0 : colors.secondaryTextColor]);
70
92
  };
71
93
  ProgressBar.displayName = 'ProgressBar';
72
94
  var _default = exports.default = ProgressBar;
@@ -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","internalPercentage","setInternalPercentage","useState","uuid","useUuid","useEffect","progressBar","useMemo","createElement","StyledProgressBarProgressWrapper","StyledMotionProgressBarProgress","key","initial","width","left","animate","exit","transition","type","repeat","Infinity","repeatDelay","duration","StyledProgressBarBackground","StyledProgressBar","StyledProgressBarLabel","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} from './ProgressBar.styles';\n\nexport type ProgressBarProps = {\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?: number;\n /**\n * Whether the progress should be hide and just display the label.\n */\n shouldHideProgress?: boolean;\n};\n\nconst ProgressBar: FC<ProgressBarProps> = ({ percentage, label, shouldHideProgress = false }) => {\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 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 />\n </StyledProgressBarProgressWrapper>\n );\n }\n\n return (\n <StyledProgressBarProgressWrapper>\n <StyledMotionProgressBarProgress\n key={`progress-bar__${uuid}`}\n initial={{ width: '0%' }}\n animate={{ width: `${internalPercentage}%` }}\n exit={{ width: '0%' }}\n transition={{ type: 'tween' }}\n />\n <StyledProgressBarBackground />\n </StyledProgressBarProgressWrapper>\n );\n }, [internalPercentage, percentage, shouldHideProgress, uuid]);\n\n return useMemo(\n () => (\n <StyledProgressBar>\n {progressBar}\n {label && <StyledProgressBarLabel>{label}</StyledProgressBarLabel>}\n </StyledProgressBar>\n ),\n [progressBar, label],\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;AAM8B,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,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,CAAAe,OAAA,CAAAqB,aAAA,CAAChC,YAAA,CAAAiD,sBAAsB,QAAE3B,KAA8B,CAClD,CACtB,EACD,CAACQ,WAAW,EAAER,KAAK,CACvB,CAAC;AACL,CAAC;AAEDF,WAAW,CAAC8B,WAAW,GAAG,aAAa;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAzC,OAAA,GAEzBS,WAAW","ignoreList":[]}
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,C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A,CAAAe,OAAA,CAAAwB,aAAA,CAACnC,YAAA,CAAA8D,sBAAsB;IAACE,aAAa,EAAEtC,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEuC;EAAiB,GAC3D3C,KACmB,CAEb,CACtB,EACD,CACIW,WAAW,EACXX,KAAK,EACLE,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":[]}
@@ -3,42 +3,98 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.StyledProgressBarProgressWrapper = exports.StyledProgressBarLabel = exports.StyledProgressBarBackground = exports.StyledProgressBar = exports.StyledMotionProgressBarProgress = void 0;
6
+ exports.StyledProgressBarStepWrapper = exports.StyledProgressBarStep = exports.StyledProgressBarProgressWrapper = exports.StyledProgressBarLabel = exports.StyledProgressBarBackground = exports.StyledProgressBar = exports.StyledMotionProgressBarProgress = void 0;
7
7
  var _react = require("motion/react");
8
- var _styledComponents = _interopRequireDefault(require("styled-components"));
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
8
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
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); }
10
10
  const StyledProgressBar = exports.StyledProgressBar = _styledComponents.default.div`
11
11
  position: relative;
12
12
  `;
13
13
  const StyledProgressBarBackground = exports.StyledProgressBarBackground = _styledComponents.default.div`
14
- height: 10px;
14
+ height: 100%;
15
15
  width: 100%;
16
- border-radius: 2px;
17
16
  background-color: ${({
18
- theme
19
- }) => theme['104']};
17
+ theme,
18
+ $color
19
+ }) => $color ?? theme['104']};
20
20
  `;
21
21
  const StyledProgressBarProgressWrapper = exports.StyledProgressBarProgressWrapper = _styledComponents.default.div`
22
22
  overflow: hidden;
23
23
  position: relative;
24
24
  width: 100%;
25
- height: 10px;
26
- border-radius: 2px;
25
+ height: ${({
26
+ $isBig
27
+ }) => $isBig ? 20 : 10}px;
28
+ border-radius: ${({
29
+ $isBig
30
+ }) => $isBig ? 20 : 2}px;
27
31
  `;
28
32
  const StyledMotionProgressBarProgress = exports.StyledMotionProgressBarProgress = (0, _styledComponents.default)(_react.motion.div)`
29
- height: 10px;
33
+ height: 100%;
30
34
  position: absolute;
31
35
  top: 0;
32
36
  left: 0;
33
37
  z-index: 2;
38
+ display: flex;
39
+ align-items: center;
40
+ padding-left: 12px;
34
41
  background-color: ${({
35
- theme
36
- }) => theme.headline};
42
+ theme,
43
+ $color
44
+ }) => $color ?? theme.headline};
37
45
  `;
38
46
  const StyledProgressBarLabel = exports.StyledProgressBarLabel = _styledComponents.default.div`
39
47
  font-size: 85%;
40
48
  color: ${({
49
+ theme,
50
+ $shouldShowLabelInline
51
+ }) => $shouldShowLabelInline ? theme['100'] : theme.headline};
52
+ white-space: nowrap;
53
+
54
+ ${({
55
+ $colorSplitPosition,
56
+ $primaryColor,
57
+ $secondaryColor,
41
58
  theme
42
- }) => theme.headline};
59
+ }) => $colorSplitPosition && (0, _styledComponents.css)`
60
+ position: absolute;
61
+ z-index: 2;
62
+ width: 100%;
63
+ height: 100%;
64
+
65
+ display: flex;
66
+ align-items: center;
67
+
68
+ padding-left: 8px;
69
+
70
+ font-weight: bold;
71
+
72
+ -webkit-background-clip: text;
73
+
74
+ color: transparent;
75
+ background-image: linear-gradient(
76
+ 90deg,
77
+ ${$primaryColor ?? theme['100']} ${$colorSplitPosition}%,
78
+ ${$secondaryColor ?? theme['300']} ${$colorSplitPosition}%
79
+ );
80
+ `}
81
+ `;
82
+ const StyledProgressBarStepWrapper = exports.StyledProgressBarStepWrapper = _styledComponents.default.div`
83
+ height: 100%;
84
+ width: 100%;
85
+ position: absolute;
86
+ `;
87
+ const StyledProgressBarStep = exports.StyledProgressBarStep = _styledComponents.default.div`
88
+ background-color: ${({
89
+ theme,
90
+ $color
91
+ }) => $color ?? theme['102']};
92
+ height: 100%;
93
+ width: 2px;
94
+ position: absolute;
95
+ top: 0;
96
+ left: ${({
97
+ $position
98
+ }) => $position}%;
43
99
  `;
44
100
  //# sourceMappingURL=ProgressBar.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressBar.styles.js","names":["_react","require","_styledComponents","_interopRequireDefault","e","__esModule","default","StyledProgressBar","exports","styled","div","StyledProgressBarBackground","theme","StyledProgressBarProgressWrapper","StyledMotionProgressBarProgress","motion","headline","StyledProgressBarLabel"],"sources":["../../../../src/components/progress-bar/ProgressBar.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled 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<unknown>;\nexport const StyledProgressBarBackground = styled.div<StyledProgressBarBackgroundProps>`\n height: 10px;\n width: 100%;\n border-radius: 2px;\n background-color: ${({ theme }: StyledProgressBarBackgroundProps) => theme['104']};\n`;\n\nexport const StyledProgressBarProgressWrapper = styled.div`\n overflow: hidden;\n position: relative;\n width: 100%;\n height: 10px;\n border-radius: 2px;\n`;\n\ntype StyledProgressBarProgressProps = WithTheme<unknown>;\nexport const StyledMotionProgressBarProgress = styled(motion.div)<StyledProgressBarProgressProps>`\n height: 10px;\n position: absolute;\n top: 0;\n left: 0;\n z-index: 2;\n background-color: ${({ theme }: StyledProgressBarProgressProps) => theme.headline};\n`;\n\ntype StyledProgressBarLabelProps = WithTheme<unknown>;\n\nexport const StyledProgressBarLabel = styled.div<StyledProgressBarLabelProps>`\n font-size: 85%;\n color: ${({ theme }: StyledProgressBarLabelProps) => theme.headline};\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAuC,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGhC,MAAMG,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAGE,yBAAM,CAACC,GAAG;AAC3C;AACA,CAAC;AAGM,MAAMC,2BAA2B,GAAAH,OAAA,CAAAG,2BAAA,GAAGF,yBAAM,CAACC,GAAqC;AACvF;AACA;AACA;AACA,wBAAwB,CAAC;EAAEE;AAAwC,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AACrF,CAAC;AAEM,MAAMC,gCAAgC,GAAAL,OAAA,CAAAK,gCAAA,GAAGJ,yBAAM,CAACC,GAAG;AAC1D;AACA;AACA;AACA;AACA;AACA,CAAC;AAGM,MAAMI,+BAA+B,GAAAN,OAAA,CAAAM,+BAAA,GAAG,IAAAL,yBAAM,EAACM,aAAM,CAACL,GAAG,CAAiC;AACjG;AACA;AACA;AACA;AACA;AACA,wBAAwB,CAAC;EAAEE;AAAsC,CAAC,KAAKA,KAAK,CAACI,QAAQ;AACrF,CAAC;AAIM,MAAMC,sBAAsB,GAAAT,OAAA,CAAAS,sBAAA,GAAGR,yBAAM,CAACC,GAAgC;AAC7E;AACA,aAAa,CAAC;EAAEE;AAAmC,CAAC,KAAKA,KAAK,CAACI,QAAQ;AACvE,CAAC","ignoreList":[]}
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;AAAgD,SAAAE,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,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,M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CAAiC;AACjG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,CAAC;EAAEE,KAAK;EAAEC;AAAuC,CAAC,KAClEA,MAAM,IAAID,KAAK,CAACM,QAAQ;AAChC,CAAC;AASM,MAAMC,sBAAsB,GAAAX,OAAA,CAAAW,sBAAA,GAAGV,yBAAM,CAACC,GAAgC;AAC7E;AACA,aAAa,CAAC;EAAEE,KAAK;EAAEQ;AAAoD,CAAC,KACpEA,sBAAsB,GAAGR,KAAK,CAAC,KAAK,CAAC,GAAGA,KAAK,CAACM,QAAQ;AAC9D;AACA;AACA,MAAM,CAAC;EAAEG,mBAAmB;EAAEC,aAAa;EAAEC,eAAe;EAAEX;AAAM,CAAC,KAC7DS,mBAAmB,IACnB,IAAAG,qBAAG;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkBF,aAAa,IAAIV,KAAK,CAAC,KAAK,CAAC,IAAIS,mBAAmB;AACtE,kBAAkBE,eAAe,IAAIX,KAAK,CAAC,KAAK,CAAC,IAAIS,mBAAmB;AACxE;AACA,SAAS;AACT,CAAC;AAEM,MAAMI,4BAA4B,GAAAjB,OAAA,CAAAiB,4BAAA,GAAGhB,yBAAM,CAACC,GAAG;AACtD;AACA;AACA;AACA,CAAC;AAOM,MAAMgB,qBAAqB,GAAAlB,OAAA,CAAAkB,qBAAA,GAAGjB,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;EAAEe;AAAsC,CAAC,KAAKA,SAAS;AACpE,CAAC","ignoreList":[]}
@@ -1,10 +1,13 @@
1
1
  import React, { useEffect, useMemo, useState } from 'react';
2
2
  import { useUuid } from '../../hooks/uuid';
3
- import { StyledMotionProgressBarProgress, StyledProgressBar, StyledProgressBarBackground, StyledProgressBarLabel, StyledProgressBarProgressWrapper } from './ProgressBar.styles';
3
+ import { StyledMotionProgressBarProgress, StyledProgressBar, StyledProgressBarBackground, StyledProgressBarLabel, StyledProgressBarProgressWrapper, StyledProgressBarStep, StyledProgressBarStepWrapper } from './ProgressBar.styles';
4
4
  const ProgressBar = ({
5
5
  percentage,
6
6
  label,
7
- shouldHideProgress = false
7
+ shouldHideProgress = false,
8
+ shouldShowLabelInline = false,
9
+ steps,
10
+ colors
8
11
  }) => {
9
12
  const [internalPercentage, setInternalPercentage] = useState(0);
10
13
  const uuid = useUuid();
@@ -23,6 +26,7 @@ const ProgressBar = ({
23
26
  if (typeof percentage !== 'number') {
24
27
  return /*#__PURE__*/React.createElement(StyledProgressBarProgressWrapper, null, /*#__PURE__*/React.createElement(StyledMotionProgressBarProgress, {
25
28
  key: `progress-bar-loop__${uuid}`,
29
+ $color: colors?.progressColor,
26
30
  initial: {
27
31
  width: '200px',
28
32
  left: '-200px'
@@ -41,9 +45,18 @@ const ProgressBar = ({
41
45
  repeatDelay: 0,
42
46
  duration: 1
43
47
  }
44
- }), /*#__PURE__*/React.createElement(StyledProgressBarBackground, null));
48
+ }), /*#__PURE__*/React.createElement(StyledProgressBarBackground, {
49
+ $color: colors?.backgroundColor
50
+ }));
45
51
  }
46
- return /*#__PURE__*/React.createElement(StyledProgressBarProgressWrapper, null, /*#__PURE__*/React.createElement(StyledMotionProgressBarProgress, {
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,
47
60
  key: `progress-bar__${uuid}`,
48
61
  initial: {
49
62
  width: '0%'
@@ -57,9 +70,18 @@ const ProgressBar = ({
57
70
  transition: {
58
71
  type: 'tween'
59
72
  }
60
- }), /*#__PURE__*/React.createElement(StyledProgressBarBackground, null));
61
- }, [internalPercentage, percentage, shouldHideProgress, uuid]);
62
- return useMemo(() => /*#__PURE__*/React.createElement(StyledProgressBar, null, progressBar, label && /*#__PURE__*/React.createElement(StyledProgressBarLabel, null, label)), [progressBar, label]);
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]);
63
85
  };
64
86
  ProgressBar.displayName = 'ProgressBar';
65
87
  export default ProgressBar;
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressBar.js","names":["React","useEffect","useMemo","useState","useUuid","StyledMotionProgressBarProgress","StyledProgressBar","StyledProgressBarBackground","StyledProgressBarLabel","StyledProgressBarProgressWrapper","ProgressBar","percentage","label","shouldHideProgress","internalPercentage","setInternalPercentage","uuid","progressBar","createElement","key","initial","width","left","animate","exit","transition","type","repeat","Infinity","repeatDelay","duration","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} from './ProgressBar.styles';\n\nexport type ProgressBarProps = {\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?: number;\n /**\n * Whether the progress should be hide and just display the label.\n */\n shouldHideProgress?: boolean;\n};\n\nconst ProgressBar: FC<ProgressBarProps> = ({ percentage, label, shouldHideProgress = false }) => {\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 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 />\n </StyledProgressBarProgressWrapper>\n );\n }\n\n return (\n <StyledProgressBarProgressWrapper>\n <StyledMotionProgressBarProgress\n key={`progress-bar__${uuid}`}\n initial={{ width: '0%' }}\n animate={{ width: `${internalPercentage}%` }}\n exit={{ width: '0%' }}\n transition={{ type: 'tween' }}\n />\n <StyledProgressBarBackground />\n </StyledProgressBarProgressWrapper>\n );\n }, [internalPercentage, percentage, shouldHideProgress, uuid]);\n\n return useMemo(\n () => (\n <StyledProgressBar>\n {progressBar}\n {label && <StyledProgressBarLabel>{label}</StyledProgressBarLabel>}\n </StyledProgressBar>\n ),\n [progressBar, label],\n );\n};\n\nProgressBar.displayName = 'ProgressBar';\n\nexport default ProgressBar;\n"],"mappings":"AAAA,OAAOA,KAAK,IAA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,WAAW,EAAE,CAAC;UACdC,QAAQ,EAAE;QACd;MAAE,CACL,CAAC,eACF9B,KAAA,CAAAkB,aAAA,CAACX,2BAA2B,MAAE,CACA,CAAC;IAE3C;IAEA,oBACIP,KAAA,CAAAkB,aAAA,CAACT,gCAAgC,qBAC7BT,KAAA,CAAAkB,aAAA,CAACb,+BAA+B;MAC5Bc,GAAG,EAAE,iBAAiBH,IAAI,EAAG;MAC7BI,OAAO,EAAE;QAAEC,KAAK,EAAE;MAAK,CAAE;MACzBE,OAAO,EAAE;QAAEF,KAAK,EAAE,GAAGP,kBAAkB;MAAI,CAAE;MAC7CU,IAAI,EAAE;QAAEH,KAAK,EAAE;MAAK,CAAE;MACtBI,UAAU,EAAE;QAAEC,IAAI,EAAE;MAAQ;IAAE,CACjC,CAAC,eACF1B,KAAA,CAAAkB,aAAA,CAACX,2BAA2B,MAAE,CACA,CAAC;EAE3C,CAAC,EAAE,CAACO,kBAAkB,EAAEH,UAAU,EAAEE,kBAAkB,EAAEG,IAAI,CAAC,CAAC;EAE9D,OAAOd,OAAO,CACV,mBACIF,KAAA,CAAAkB,aAAA,CAACZ,iBAAiB,QACbW,WAAW,EACXL,KAAK,iBAAIZ,KAAA,CAAAkB,aAAA,CAACV,sBAAsB,QAAEI,KAA8B,CAClD,CACtB,EACD,CAACK,WAAW,EAAEL,KAAK,CACvB,CAAC;AACL,CAAC;AAEDF,WAAW,CAACqB,WAAW,GAAG,aAAa;AAEvC,eAAerB,WAAW","ignoreList":[]}
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,O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9B,MAAM,EAAE+B,kBAAmB;MAC5CC,mBAAmB,EAAE/B;IAAmB,GAEvCL,KACmB,CAC3B,eACDd,KAAA,CAAAuB,aAAA,CAAChB,2BAA2B;MAACkB,MAAM,EAAEP,MAAM,EAAEoB;IAAgB,CAAE,CACjC,CAAC;EAE3C,CAAC,EAAE,CACCpB,MAAM,EACNC,kBAAkB,EAClBL,KAAK,EACLD,UAAU,EACVE,kBAAkB,EAClBC,qBAAqB,EACrBC,KAAK,EACLI,IAAI,CACP,CAAC;EAEF,OAAOnB,OAAO,CACV,mBACIF,KAAA,CAAAuB,aAAA,CAACjB,iBAAiB,QACbgB,WAAW,EACXR,KAAK,IAAI,CAACE,qBAAqB,iBAC5BhB,KAAA,CAAAuB,aAAA,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,37 +1,93 @@
1
1
  import { motion } from 'motion/react';
2
- import styled from 'styled-components';
2
+ import styled, { css } from 'styled-components';
3
3
  export const StyledProgressBar = styled.div`
4
4
  position: relative;
5
5
  `;
6
6
  export const StyledProgressBarBackground = styled.div`
7
- height: 10px;
7
+ height: 100%;
8
8
  width: 100%;
9
- border-radius: 2px;
10
9
  background-color: ${({
11
- theme
12
- }) => theme['104']};
10
+ theme,
11
+ $color
12
+ }) => $color ?? theme['104']};
13
13
  `;
14
14
  export const StyledProgressBarProgressWrapper = styled.div`
15
15
  overflow: hidden;
16
16
  position: relative;
17
17
  width: 100%;
18
- height: 10px;
19
- border-radius: 2px;
18
+ height: ${({
19
+ $isBig
20
+ }) => $isBig ? 20 : 10}px;
21
+ border-radius: ${({
22
+ $isBig
23
+ }) => $isBig ? 20 : 2}px;
20
24
  `;
21
25
  export const StyledMotionProgressBarProgress = styled(motion.div)`
22
- height: 10px;
26
+ height: 100%;
23
27
  position: absolute;
24
28
  top: 0;
25
29
  left: 0;
26
30
  z-index: 2;
31
+ display: flex;
32
+ align-items: center;
33
+ padding-left: 12px;
27
34
  background-color: ${({
28
- theme
29
- }) => theme.headline};
35
+ theme,
36
+ $color
37
+ }) => $color ?? theme.headline};
30
38
  `;
31
39
  export const StyledProgressBarLabel = styled.div`
32
40
  font-size: 85%;
33
41
  color: ${({
42
+ theme,
43
+ $shouldShowLabelInline
44
+ }) => $shouldShowLabelInline ? theme['100'] : theme.headline};
45
+ white-space: nowrap;
46
+
47
+ ${({
48
+ $colorSplitPosition,
49
+ $primaryColor,
50
+ $secondaryColor,
34
51
  theme
35
- }) => theme.headline};
52
+ }) => $colorSplitPosition && css`
53
+ position: absolute;
54
+ z-index: 2;
55
+ width: 100%;
56
+ height: 100%;
57
+
58
+ display: flex;
59
+ align-items: center;
60
+
61
+ padding-left: 8px;
62
+
63
+ font-weight: bold;
64
+
65
+ -webkit-background-clip: text;
66
+
67
+ color: transparent;
68
+ background-image: linear-gradient(
69
+ 90deg,
70
+ ${$primaryColor ?? theme['100']} ${$colorSplitPosition}%,
71
+ ${$secondaryColor ?? theme['300']} ${$colorSplitPosition}%
72
+ );
73
+ `}
74
+ `;
75
+ export const StyledProgressBarStepWrapper = styled.div`
76
+ height: 100%;
77
+ width: 100%;
78
+ position: absolute;
79
+ `;
80
+ export const StyledProgressBarStep = styled.div`
81
+ background-color: ${({
82
+ theme,
83
+ $color
84
+ }) => $color ?? theme['102']};
85
+ height: 100%;
86
+ width: 2px;
87
+ position: absolute;
88
+ top: 0;
89
+ left: ${({
90
+ $position
91
+ }) => $position}%;
36
92
  `;
37
93
  //# sourceMappingURL=ProgressBar.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressBar.styles.js","names":["motion","styled","StyledProgressBar","div","StyledProgressBarBackground","theme","StyledProgressBarProgressWrapper","StyledMotionProgressBarProgress","headline","StyledProgressBarLabel"],"sources":["../../../../src/components/progress-bar/ProgressBar.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled 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<unknown>;\nexport const StyledProgressBarBackground = styled.div<StyledProgressBarBackgroundProps>`\n height: 10px;\n width: 100%;\n border-radius: 2px;\n background-color: ${({ theme }: StyledProgressBarBackgroundProps) => theme['104']};\n`;\n\nexport const StyledProgressBarProgressWrapper = styled.div`\n overflow: hidden;\n position: relative;\n width: 100%;\n height: 10px;\n border-radius: 2px;\n`;\n\ntype StyledProgressBarProgressProps = WithTheme<unknown>;\nexport const StyledMotionProgressBarProgress = styled(motion.div)<StyledProgressBarProgressProps>`\n height: 10px;\n position: absolute;\n top: 0;\n left: 0;\n z-index: 2;\n background-color: ${({ theme }: StyledProgressBarProgressProps) => theme.headline};\n`;\n\ntype StyledProgressBarLabelProps = WithTheme<unknown>;\n\nexport const StyledProgressBarLabel = styled.div<StyledProgressBarLabelProps>`\n font-size: 85%;\n color: ${({ theme }: StyledProgressBarLabelProps) => theme.headline};\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,MAAM,mBAAmB;AAGtC,OAAO,MAAMC,iBAAiB,GAAGD,MAAM,CAACE,GAAG;AAC3C;AACA,CAAC;AAGD,OAAO,MAAMC,2BAA2B,GAAGH,MAAM,CAACE,GAAqC;AACvF;AACA;AACA;AACA,wBAAwB,CAAC;EAAEE;AAAwC,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AACrF,CAAC;AAED,OAAO,MAAMC,gCAAgC,GAAGL,MAAM,CAACE,GAAG;AAC1D;AACA;AACA;AACA;AACA;AACA,CAAC;AAGD,OAAO,MAAMI,+BAA+B,GAAGN,MAAM,CAACD,MAAM,CAACG,GAAG,CAAiC;AACjG;AACA;AACA;AACA;AACA;AACA,wBAAwB,CAAC;EAAEE;AAAsC,CAAC,KAAKA,KAAK,CAACG,QAAQ;AACrF,CAAC;AAID,OAAO,MAAMC,sBAAsB,GAAGR,MAAM,CAACE,GAAgC;AAC7E;AACA,aAAa,CAAC;EAAEE;AAAmC,CAAC,KAAKA,KAAK,CAACG,QAAQ;AACvE,CAAC","ignoreList":[]}
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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B,CAAC;EAAEE,KAAK;EAAEC;AAAmC,CAAC,KAAKA,MAAM,IAAID,KAAK,CAAC,KAAK,CAAC;AACjG;AACA;AACA;AACA;AACA,YAAY,CAAC;EAAEa;AAAsC,CAAC,KAAKA,SAAS;AACpE,CAAC","ignoreList":[]}
@@ -1,5 +1,18 @@
1
1
  import { FC } from 'react';
2
+ type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc['length']]>;
3
+ type Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
4
+ interface Colors {
5
+ backgroundColor?: string;
6
+ progressColor?: string;
7
+ stepColor?: string;
8
+ primaryTextColor?: string;
9
+ secondaryTextColor?: string;
10
+ }
2
11
  export type ProgressBarProps = {
12
+ /**
13
+ * The colors of the ProgressBar.
14
+ */
15
+ colors?: Colors;
3
16
  /**
4
17
  * The label that should be displayed under the progressbar.
5
18
  */
@@ -7,11 +20,19 @@ export type ProgressBarProps = {
7
20
  /**
8
21
  * The percentage of the progress. Number between 0 and 100.
9
22
  */
10
- percentage?: number;
23
+ percentage?: Range<0, 101>;
11
24
  /**
12
25
  * Whether the progress should be hide and just display the label.
13
26
  */
14
27
  shouldHideProgress?: boolean;
28
+ /**
29
+ * Whether the label should be displayed inside the ProgressBar.
30
+ */
31
+ shouldShowLabelInline?: boolean;
32
+ /**
33
+ * Visual marked steps.
34
+ */
35
+ steps?: Range<0, 101>[];
15
36
  };
16
37
  declare const ProgressBar: FC<ProgressBarProps>;
17
38
  export default ProgressBar;
@@ -1,13 +1,30 @@
1
+ import type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';
1
2
  export declare const StyledProgressBar: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
- export declare const StyledProgressBarBackground: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
3
- theme: import("../color-scheme-provider/ColorSchemeProvider").Theme;
4
- }>> & string;
5
- export declare const StyledProgressBarProgressWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
+ type StyledProgressBarBackgroundProps = WithTheme<{
4
+ $color?: string;
5
+ }>;
6
+ export declare const StyledProgressBarBackground: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledProgressBarBackgroundProps>> & string;
7
+ type StyledProgressBarProgressWrapperProps = WithTheme<{
8
+ $isBig?: boolean;
9
+ }>;
10
+ export declare const StyledProgressBarProgressWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledProgressBarProgressWrapperProps>> & string;
11
+ type StyledProgressBarProgressProps = WithTheme<{
12
+ $color?: string;
13
+ }>;
6
14
  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"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
7
15
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null | undefined;
8
- }, {
9
- theme: import("../color-scheme-provider/ColorSchemeProvider").Theme;
10
- }>> & string & Omit<import("motion/react").ForwardRefComponent<HTMLDivElement, import("motion/react").HTMLMotionProps<"div">>, keyof import("react").Component<any, {}, any>>;
11
- export declare const StyledProgressBarLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
12
- theme: import("../color-scheme-provider/ColorSchemeProvider").Theme;
13
- }>> & string;
16
+ }, StyledProgressBarProgressProps>> & string & Omit<import("motion/react").ForwardRefComponent<HTMLDivElement, import("motion/react").HTMLMotionProps<"div">>, keyof import("react").Component<any, {}, any>>;
17
+ type StyledProgressBarLabelProps = WithTheme<{
18
+ $shouldShowLabelInline?: boolean;
19
+ $primaryColor?: string;
20
+ $secondaryColor?: string;
21
+ $colorSplitPosition?: number;
22
+ }>;
23
+ export declare const StyledProgressBarLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledProgressBarLabelProps>> & string;
24
+ export declare const StyledProgressBarStepWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
25
+ type StyledProgressBarStepProps = WithTheme<{
26
+ $position: number;
27
+ $color?: string;
28
+ }>;
29
+ export declare const StyledProgressBarStep: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledProgressBarStepProps>> & string;
30
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chayns-components/core",
3
- "version": "5.0.0-beta.1244",
3
+ "version": "5.0.0-beta.1245",
4
4
  "description": "A set of beautiful React components for developing your own applications with chayns.",
5
5
  "sideEffects": false,
6
6
  "browserslist": [
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "e741a930f6869b7b2c1fd1372d61a60edb87f2e1"
88
+ "gitHead": "1c089dcb06440d098f4a048b2b2b7cd00116772a"
89
89
  }