@mittwald/flow-react-components 0.2.0-alpha.134 → 0.2.0-alpha.135
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/assets/doc-properties.json +561 -300
- package/dist/css/all.css +1 -1
- package/dist/js/components/src/components/ChartLegend/components/LegendContent/LegendContent.mjs +2 -2
- package/dist/js/components/src/components/ChartLegend/components/LegendContent/LegendContent.mjs.map +1 -1
- package/dist/js/components/src/components/ChartTooltip/components/TooltipContent.mjs +1 -8
- package/dist/js/components/src/components/ChartTooltip/components/TooltipContent.mjs.map +1 -1
- package/dist/js/components/src/components/Legend/components/LegendItem/LegendItem.mjs +2 -2
- package/dist/js/components/src/components/Legend/components/LegendItem/LegendItem.mjs.map +1 -1
- package/dist/js/components/src/components/ProgressBar/ProgressBar.mjs +48 -11
- package/dist/js/components/src/components/ProgressBar/ProgressBar.mjs.map +1 -1
- package/dist/js/components/src/components/ProgressBar/ProgressBar.module.scss.mjs +5 -1
- package/dist/js/components/src/components/ProgressBar/ProgressBar.module.scss.mjs.map +1 -1
- package/dist/js/components/src/components/ProgressBar/components/ProgressBarBar.mjs +25 -0
- package/dist/js/components/src/components/ProgressBar/components/ProgressBarBar.mjs.map +1 -0
- package/dist/js/components/src/components/ProgressBar/components/ProgressBarLegend.mjs +27 -0
- package/dist/js/components/src/components/ProgressBar/components/ProgressBarLegend.mjs.map +1 -0
- package/dist/js/components/src/components/ProgressBar/components/ProgressBarValue.mjs +18 -0
- package/dist/js/components/src/components/ProgressBar/components/ProgressBarValue.mjs.map +1 -0
- package/dist/js/components/src/lib/tokens/getCategoricalColorByIndex.mjs +33 -0
- package/dist/js/components/src/lib/tokens/getCategoricalColorByIndex.mjs.map +1 -0
- package/dist/types/components/ChartLegend/components/LegendContent/LegendContent.d.ts.map +1 -1
- package/dist/types/components/ChartTooltip/components/TooltipContent.d.ts.map +1 -1
- package/dist/types/components/Legend/components/LegendItem/LegendItem.d.ts +3 -4
- package/dist/types/components/Legend/components/LegendItem/LegendItem.d.ts.map +1 -1
- package/dist/types/components/ProgressBar/ProgressBar.d.ts +14 -2
- package/dist/types/components/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/types/components/ProgressBar/components/ProgressBarBar.d.ts +9 -0
- package/dist/types/components/ProgressBar/components/ProgressBarBar.d.ts.map +1 -0
- package/dist/types/components/ProgressBar/components/ProgressBarLegend.d.ts +6 -0
- package/dist/types/components/ProgressBar/components/ProgressBarLegend.d.ts.map +1 -0
- package/dist/types/components/ProgressBar/components/ProgressBarValue.d.ts +8 -0
- package/dist/types/components/ProgressBar/components/ProgressBarValue.d.ts.map +1 -0
- package/dist/types/components/ProgressBar/stories/Default.stories.d.ts +3 -0
- package/dist/types/components/ProgressBar/stories/Default.stories.d.ts.map +1 -1
- package/dist/types/components/ProgressBar/stories/EdgeCases.stories.d.ts +1 -0
- package/dist/types/components/ProgressBar/stories/EdgeCases.stories.d.ts.map +1 -1
- package/dist/types/lib/tokens/getCategoricalColorByIndex.d.ts +2 -0
- package/dist/types/lib/tokens/getCategoricalColorByIndex.d.ts.map +1 -0
- package/package.json +4 -4
package/dist/js/components/src/components/ChartLegend/components/LegendContent/LegendContent.mjs
CHANGED
|
@@ -13,8 +13,8 @@ const LegendContent = (props) => {
|
|
|
13
13
|
return /* @__PURE__ */ jsx(
|
|
14
14
|
LegendItem,
|
|
15
15
|
{
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
color: entry.payload && "fill" in entry.payload ? entry.payload?.fill : tokens.color.gray[100].value,
|
|
17
|
+
children: entry.dataKey ? formatter ? formatter(entry.dataKey?.toString()) : entry.dataKey.toString() : ""
|
|
18
18
|
},
|
|
19
19
|
`legendItem-${index}`
|
|
20
20
|
);
|
package/dist/js/components/src/components/ChartLegend/components/LegendContent/LegendContent.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegendContent.mjs","sources":["../../../../../../../../src/components/ChartLegend/components/LegendContent/LegendContent.tsx"],"sourcesContent":["import type { Props } from \"recharts/types/component/DefaultLegendContent\";\nimport type { WithChartLegendFormatters } from \"../../ChartLegend\";\nimport type { FC } from \"react\";\nimport tokens from \"@mittwald/flow-design-tokens/variables.json\";\nimport Legend, { LegendItem } from \"@/components/Legend\";\n\ntype LegendContentType = Omit<Props, \"formatter\"> & WithChartLegendFormatters;\n\nconst LegendContent: FC<LegendContentType> = (props) => {\n const { formatter, payload } = props;\n\n return (\n <Legend>\n {payload\n ?.filter(\n (entry) =>\n entry.payload &&\n \"fill\" in entry.payload &&\n entry.payload?.fill !== \"none\",\n )\n .map((entry, index) => {\n return (\n <LegendItem\n key={`legendItem-${index}`}\n
|
|
1
|
+
{"version":3,"file":"LegendContent.mjs","sources":["../../../../../../../../src/components/ChartLegend/components/LegendContent/LegendContent.tsx"],"sourcesContent":["import type { Props } from \"recharts/types/component/DefaultLegendContent\";\nimport type { WithChartLegendFormatters } from \"../../ChartLegend\";\nimport type { FC } from \"react\";\nimport tokens from \"@mittwald/flow-design-tokens/variables.json\";\nimport Legend, { LegendItem } from \"@/components/Legend\";\n\ntype LegendContentType = Omit<Props, \"formatter\"> & WithChartLegendFormatters;\n\nconst LegendContent: FC<LegendContentType> = (props) => {\n const { formatter, payload } = props;\n\n return (\n <Legend>\n {payload\n ?.filter(\n (entry) =>\n entry.payload &&\n \"fill\" in entry.payload &&\n entry.payload?.fill !== \"none\",\n )\n .map((entry, index) => {\n return (\n <LegendItem\n key={`legendItem-${index}`}\n color={\n entry.payload && \"fill\" in entry.payload\n ? (entry.payload?.fill as string)\n : tokens.color.gray[100].value\n }\n >\n {entry.dataKey\n ? formatter\n ? formatter(entry.dataKey?.toString())\n : entry.dataKey.toString()\n : \"\"}\n </LegendItem>\n );\n })}\n </Legend>\n );\n};\n\nexport default LegendContent;\n"],"names":[],"mappings":";;;;;AAQM,MAAA,aAAA,GAAuC,CAAC,KAAU,KAAA;AACtD,EAAM,MAAA,EAAE,SAAW,EAAA,OAAA,EAAY,GAAA,KAAA;AAE/B,EACE,uBAAA,GAAA,CAAC,UACE,QACG,EAAA,OAAA,EAAA,MAAA;AAAA,IACA,CAAC,UACC,KAAM,CAAA,OAAA,IACN,UAAU,KAAM,CAAA,OAAA,IAChB,KAAM,CAAA,OAAA,EAAS,IAAS,KAAA;AAAA,GAE3B,CAAA,GAAA,CAAI,CAAC,KAAA,EAAO,KAAU,KAAA;AACrB,IACE,uBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QAEC,KACE,EAAA,KAAA,CAAM,OAAW,IAAA,MAAA,IAAU,KAAM,CAAA,OAAA,GAC5B,KAAM,CAAA,OAAA,EAAS,IAChB,GAAA,MAAA,CAAO,KAAM,CAAA,IAAA,CAAK,GAAG,CAAE,CAAA,KAAA;AAAA,QAG5B,QAAM,EAAA,KAAA,CAAA,OAAA,GACH,SACE,GAAA,SAAA,CAAU,KAAM,CAAA,OAAA,EAAS,QAAS,EAAC,CACnC,GAAA,KAAA,CAAM,OAAQ,CAAA,QAAA,EAChB,GAAA;AAAA,OAAA;AAAA,MAXC,cAAc,KAAK,CAAA;AAAA,KAY1B;AAAA,GAEH,CACL,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -23,14 +23,7 @@ const TooltipContent = (props) => {
|
|
|
23
23
|
/* @__PURE__ */ jsx(PopoverTip, { className: styles$1.tip }),
|
|
24
24
|
/* @__PURE__ */ jsxs("div", { className: styles.content, children: [
|
|
25
25
|
/* @__PURE__ */ jsx(Heading, { level: 3, children: headingFormatter ? headingFormatter(label) : label }),
|
|
26
|
-
payload.filter((i) => i.fill !== "none").map((i, index) => /* @__PURE__ */ jsx(
|
|
27
|
-
LegendItem,
|
|
28
|
-
{
|
|
29
|
-
color: i.fill,
|
|
30
|
-
title: formatter ? formatter(i.value, i.dataKey, index, i.unit) : `${i.dataKey} ${i.value}${i.unit ? ` ${i.unit}` : ""}`
|
|
31
|
-
},
|
|
32
|
-
i.dataKey
|
|
33
|
-
))
|
|
26
|
+
payload.filter((i) => i.fill !== "none").map((i, index) => /* @__PURE__ */ jsx(LegendItem, { color: i.fill, children: formatter ? formatter(i.value, i.dataKey, index, i.unit) : `${i.dataKey} ${i.value}${i.unit ? ` ${i.unit}` : ""}` }, i.dataKey))
|
|
34
27
|
] })
|
|
35
28
|
] });
|
|
36
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipContent.mjs","sources":["../../../../../../../src/components/ChartTooltip/components/TooltipContent.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport styles from \"../ChartTooltip.module.scss\";\nimport popoverStyles from \"../../Popover/Popover.module.scss\";\nimport { PopoverTip } from \"@/components/Popover/components/PopoverTip\";\nimport Heading from \"@/components/Heading\";\nimport { LegendItem } from \"@/components/Legend/components/LegendItem\";\nimport type * as Recharts from \"recharts\";\nimport type {\n NameType,\n ValueType,\n} from \"recharts/types/component/DefaultTooltipContent\";\nimport type { WithTooltipFormatters } from \"../ChartTooltip\";\n\ninterface TooltipContentProps\n extends Pick<\n Recharts.TooltipContentProps<ValueType, NameType>,\n \"active\" | \"payload\" | \"label\" | \"wrapperClassName\"\n >,\n WithTooltipFormatters {}\n\nexport const TooltipContent = (props: TooltipContentProps) => {\n const {\n active,\n payload,\n formatter,\n headingFormatter,\n label,\n wrapperClassName,\n } = props;\n const className = clsx(wrapperClassName, popoverStyles.popover);\n\n if (active && payload && payload.length) {\n return (\n <div className={className}>\n <PopoverTip className={styles.tip} />\n <div className={popoverStyles.content}>\n <Heading level={3}>\n {headingFormatter ? headingFormatter(label) : label}\n </Heading>\n {payload\n .filter((i) => i.fill !== \"none\")\n .map((i, index) => (\n <LegendItem
|
|
1
|
+
{"version":3,"file":"TooltipContent.mjs","sources":["../../../../../../../src/components/ChartTooltip/components/TooltipContent.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport styles from \"../ChartTooltip.module.scss\";\nimport popoverStyles from \"../../Popover/Popover.module.scss\";\nimport { PopoverTip } from \"@/components/Popover/components/PopoverTip\";\nimport Heading from \"@/components/Heading\";\nimport { LegendItem } from \"@/components/Legend/components/LegendItem\";\nimport type * as Recharts from \"recharts\";\nimport type {\n NameType,\n ValueType,\n} from \"recharts/types/component/DefaultTooltipContent\";\nimport type { WithTooltipFormatters } from \"../ChartTooltip\";\n\ninterface TooltipContentProps\n extends Pick<\n Recharts.TooltipContentProps<ValueType, NameType>,\n \"active\" | \"payload\" | \"label\" | \"wrapperClassName\"\n >,\n WithTooltipFormatters {}\n\nexport const TooltipContent = (props: TooltipContentProps) => {\n const {\n active,\n payload,\n formatter,\n headingFormatter,\n label,\n wrapperClassName,\n } = props;\n const className = clsx(wrapperClassName, popoverStyles.popover);\n\n if (active && payload && payload.length) {\n return (\n <div className={className}>\n <PopoverTip className={styles.tip} />\n <div className={popoverStyles.content}>\n <Heading level={3}>\n {headingFormatter ? headingFormatter(label) : label}\n </Heading>\n {payload\n .filter((i) => i.fill !== \"none\")\n .map((i, index) => (\n <LegendItem color={i.fill} key={i.dataKey}>\n {formatter\n ? formatter(i.value, i.dataKey, index, i.unit)\n : `${i.dataKey} ${i.value}${i.unit ? ` ${i.unit}` : \"\"}`}\n </LegendItem>\n ))}\n </div>\n </div>\n );\n }\n\n return null;\n};\n"],"names":["popoverStyles","styles"],"mappings":";;;;;;;;AAoBa,MAAA,cAAA,GAAiB,CAAC,KAA+B,KAAA;AAC5D,EAAM,MAAA;AAAA,IACJ,MAAA;AAAA,IACA,OAAA;AAAA,IACA,SAAA;AAAA,IACA,gBAAA;AAAA,IACA,KAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AACJ,EAAA,MAAM,SAAY,GAAA,IAAA,CAAK,gBAAkB,EAAAA,MAAA,CAAc,OAAO,CAAA;AAE9D,EAAI,IAAA,MAAA,IAAU,OAAW,IAAA,OAAA,CAAQ,MAAQ,EAAA;AACvC,IACE,uBAAA,IAAA,CAAC,SAAI,SACH,EAAA,QAAA,EAAA;AAAA,sBAAC,GAAA,CAAA,UAAA,EAAA,EAAW,SAAW,EAAAC,QAAA,CAAO,GAAK,EAAA,CAAA;AAAA,sBAClC,IAAA,CAAA,KAAA,EAAA,EAAI,SAAW,EAAAD,MAAA,CAAc,OAC5B,EAAA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,WAAQ,KAAO,EAAA,CAAA,EACb,6BAAmB,gBAAiB,CAAA,KAAK,IAAI,KAChD,EAAA,CAAA;AAAA,QACC,OAAA,CACE,OAAO,CAAC,CAAA,KAAM,EAAE,IAAS,KAAA,MAAM,EAC/B,GAAI,CAAA,CAAC,GAAG,KACP,qBAAA,GAAA,CAAC,cAAW,KAAO,EAAA,CAAA,CAAE,MAClB,QACG,EAAA,SAAA,GAAA,SAAA,CAAU,EAAE,KAAO,EAAA,CAAA,CAAE,SAAS,KAAO,EAAA,CAAA,CAAE,IAAI,CAC3C,GAAA,CAAA,EAAG,EAAE,OAAO,CAAA,CAAA,EAAI,EAAE,KAAK,CAAA,EAAG,EAAE,IAAO,GAAA,CAAA,CAAA,EAAI,EAAE,IAAI,CAAA,CAAA,GAAK,EAAE,CAH1B,CAAA,EAAA,EAAA,CAAA,CAAE,OAIlC,CACD;AAAA,OACL,EAAA;AAAA,KACF,EAAA,CAAA;AAAA;AAIJ,EAAO,OAAA,IAAA;AACT;;;;"}
|
|
@@ -7,7 +7,7 @@ import { categoricalColors } from '../../../../lib/tokens/CategoricalColors.mjs'
|
|
|
7
7
|
import { getCategoricalColorValue } from '../../../../lib/tokens/getCategoricalColorValue.mjs';
|
|
8
8
|
|
|
9
9
|
const LegendItem = (props) => {
|
|
10
|
-
const {
|
|
10
|
+
const { children, color } = props;
|
|
11
11
|
return /* @__PURE__ */ jsxs("li", { className: styles.legendItem, children: [
|
|
12
12
|
/* @__PURE__ */ jsx(
|
|
13
13
|
"div",
|
|
@@ -20,7 +20,7 @@ const LegendItem = (props) => {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
),
|
|
23
|
-
/* @__PURE__ */ jsx(Text, { children: /* @__PURE__ */ jsx("small", { children
|
|
23
|
+
/* @__PURE__ */ jsx(Text, { children: /* @__PURE__ */ jsx("small", { children }) })
|
|
24
24
|
] });
|
|
25
25
|
};
|
|
26
26
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegendItem.mjs","sources":["../../../../../../../../src/components/Legend/components/LegendItem/LegendItem.tsx"],"sourcesContent":["import Text from \"@/components/Text\";\nimport type { FC } from \"react\";\nimport styles from \"./LegendItem.module.scss\";\nimport {\n categoricalColors,\n type CategoricalColors,\n} from \"@/lib/tokens/CategoricalColors\";\nimport { getCategoricalColorValue } from \"@/lib/tokens/getCategoricalColorValue\";\n\nexport interface LegendItemProps {\n color
|
|
1
|
+
{"version":3,"file":"LegendItem.mjs","sources":["../../../../../../../../src/components/Legend/components/LegendItem/LegendItem.tsx"],"sourcesContent":["import Text from \"@/components/Text\";\nimport type { FC, PropsWithChildren } from \"react\";\nimport styles from \"./LegendItem.module.scss\";\nimport {\n categoricalColors,\n type CategoricalColors,\n} from \"@/lib/tokens/CategoricalColors\";\nimport { getCategoricalColorValue } from \"@/lib/tokens/getCategoricalColorValue\";\n\nexport interface LegendItemProps extends PropsWithChildren {\n color?: CategoricalColors | string;\n}\n\nexport const LegendItem: FC<LegendItemProps> = (props) => {\n const { children, color } = props;\n\n return (\n <li className={styles.legendItem}>\n <div\n className={styles.colorSquare}\n style={{\n backgroundColor: categoricalColors.includes(\n color as CategoricalColors,\n )\n ? getCategoricalColorValue(color as CategoricalColors)\n : color,\n }}\n />\n <Text>\n <small>{children}</small>\n </Text>\n </li>\n );\n};\n\nexport default LegendItem;\n"],"names":[],"mappings":";;;;;;AAaa,MAAA,UAAA,GAAkC,CAAC,KAAU,KAAA;AACxD,EAAM,MAAA,EAAE,QAAU,EAAA,KAAA,EAAU,GAAA,KAAA;AAE5B,EAAA,uBACG,IAAA,CAAA,IAAA,EAAA,EAAG,SAAW,EAAA,MAAA,CAAO,UACpB,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,WAAW,MAAO,CAAA,WAAA;AAAA,QAClB,KAAO,EAAA;AAAA,UACL,iBAAiB,iBAAkB,CAAA,QAAA;AAAA,YACjC;AAAA,WACF,GACI,wBAAyB,CAAA,KAA0B,CACnD,GAAA;AAAA;AACN;AAAA,KACF;AAAA,oBACC,GAAA,CAAA,IAAA,EAAA,EACC,QAAC,kBAAA,GAAA,CAAA,OAAA,EAAA,EAAO,UAAS,CACnB,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
4
4
|
import * as Aria from 'react-aria-components';
|
|
5
5
|
import 'react';
|
|
6
6
|
import styles from './ProgressBar.module.scss.mjs';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
|
-
import { useLocalizedStringFormatter, useNumberFormatter } from 'react-aria';
|
|
9
8
|
import '../../lib/propsContext/propsContext.mjs';
|
|
10
9
|
import '../../lib/viewComponentContext/viewComponentContext.mjs';
|
|
11
10
|
import { PropsContextProvider } from '../../lib/propsContext/PropsContextProvider.mjs';
|
|
12
|
-
import
|
|
11
|
+
import { ProgressBarValue } from './components/ProgressBarValue.mjs';
|
|
12
|
+
import { ProgressBarBar } from './components/ProgressBarBar.mjs';
|
|
13
|
+
import { ProgressBarLegend } from './components/ProgressBarLegend.mjs';
|
|
13
14
|
|
|
14
15
|
const ProgressBar = (props) => {
|
|
15
16
|
const {
|
|
@@ -18,6 +19,11 @@ const ProgressBar = (props) => {
|
|
|
18
19
|
status = "info",
|
|
19
20
|
showMaxValue,
|
|
20
21
|
size = "m",
|
|
22
|
+
segments,
|
|
23
|
+
value,
|
|
24
|
+
formatOptions,
|
|
25
|
+
showLegend = true,
|
|
26
|
+
maxValue,
|
|
21
27
|
...rest
|
|
22
28
|
} = props;
|
|
23
29
|
const rootClassName = clsx(
|
|
@@ -26,20 +32,51 @@ const ProgressBar = (props) => {
|
|
|
26
32
|
styles[`size-${size}`],
|
|
27
33
|
styles[status]
|
|
28
34
|
);
|
|
29
|
-
const stringFormatter = useLocalizedStringFormatter(locales);
|
|
30
|
-
const formatter = useNumberFormatter(props.formatOptions);
|
|
31
|
-
const maxValueText = showMaxValue && props.maxValue ? formatter.format(props.maxValue) : void 0;
|
|
32
35
|
const propsContext = {
|
|
33
36
|
Label: {
|
|
34
37
|
className: styles.label,
|
|
35
38
|
unstyled: true
|
|
36
39
|
}
|
|
37
40
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const segmentsTotalValue = segments ? segments.map((s) => s.value).reduce((a, b) => a + b, 0) : void 0;
|
|
42
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
43
|
+
Aria.ProgressBar,
|
|
44
|
+
{
|
|
45
|
+
className: rootClassName,
|
|
46
|
+
value: segmentsTotalValue ?? value,
|
|
47
|
+
formatOptions,
|
|
48
|
+
maxValue,
|
|
49
|
+
...rest,
|
|
50
|
+
children: ({ percentage, valueText }) => /* @__PURE__ */ jsxs(PropsContextProvider, { props: propsContext, children: [
|
|
51
|
+
children,
|
|
52
|
+
/* @__PURE__ */ jsx(
|
|
53
|
+
ProgressBarValue,
|
|
54
|
+
{
|
|
55
|
+
showMaxValue,
|
|
56
|
+
maxValue,
|
|
57
|
+
valueText,
|
|
58
|
+
formatOptions
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
/* @__PURE__ */ jsx(
|
|
62
|
+
ProgressBarBar,
|
|
63
|
+
{
|
|
64
|
+
percentage,
|
|
65
|
+
segmentsTotalValue,
|
|
66
|
+
segments
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
/* @__PURE__ */ jsx(
|
|
70
|
+
ProgressBarLegend,
|
|
71
|
+
{
|
|
72
|
+
showLegend,
|
|
73
|
+
segments,
|
|
74
|
+
formatOptions
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
] })
|
|
78
|
+
}
|
|
79
|
+
) });
|
|
43
80
|
};
|
|
44
81
|
|
|
45
82
|
export { ProgressBar, ProgressBar as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.mjs","sources":["../../../../../../src/components/ProgressBar/ProgressBar.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport type { FC, PropsWithChildren } from \"react\";\nimport React from \"react\";\nimport styles from \"./ProgressBar.module.scss\";\nimport clsx from \"clsx\";\nimport {
|
|
1
|
+
{"version":3,"file":"ProgressBar.mjs","sources":["../../../../../../src/components/ProgressBar/ProgressBar.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport type { FC, PropsWithChildren } from \"react\";\nimport React from \"react\";\nimport styles from \"./ProgressBar.module.scss\";\nimport clsx from \"clsx\";\nimport type { PropsWithStatus } from \"@/lib/types/props\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { ProgressBarValue } from \"@/components/ProgressBar/components/ProgressBarValue\";\nimport { ProgressBarBar } from \"@/components/ProgressBar/components/ProgressBarBar\";\nimport { ProgressBarLegend } from \"@/components/ProgressBar/components/ProgressBarLegend\";\nimport type { CategoricalColors } from \"@/lib/tokens/CategoricalColors\";\n\nexport interface ProgressBarProps\n extends PropsWithChildren<Omit<Aria.ProgressBarProps, \"children\">>,\n PropsWithStatus {\n /** Whether the max value should be displayed. */\n showMaxValue?: boolean;\n /** The size variant of the progress bar. @default \"m\" */\n size?: \"s\" | \"m\" | \"l\";\n /** Divides the fill of the progress bar into segments */\n segments?: { value: number; title: string; color?: CategoricalColors }[];\n /**\n * Whether the legend component is shown when segments are used. @default:\n * true\n */\n showLegend?: boolean;\n}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const ProgressBar: FC<ProgressBarProps> = (props) => {\n const {\n children,\n className,\n status = \"info\",\n showMaxValue,\n size = \"m\",\n segments,\n value,\n formatOptions,\n showLegend = true,\n maxValue,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n className,\n styles.progressBar,\n styles[`size-${size}`],\n styles[status],\n );\n\n const propsContext: PropsContext = {\n Label: {\n className: styles.label,\n unstyled: true,\n },\n };\n\n const segmentsTotalValue = segments\n ? segments.map((s) => s.value).reduce((a, b) => a + b, 0)\n : undefined;\n\n return (\n <>\n <Aria.ProgressBar\n className={rootClassName}\n value={segmentsTotalValue ?? value}\n formatOptions={formatOptions}\n maxValue={maxValue}\n {...rest}\n >\n {({ percentage, valueText }) => (\n <PropsContextProvider props={propsContext}>\n {children}\n\n <ProgressBarValue\n showMaxValue={showMaxValue}\n maxValue={maxValue}\n valueText={valueText}\n formatOptions={formatOptions}\n />\n\n <ProgressBarBar\n percentage={percentage}\n segmentsTotalValue={segmentsTotalValue}\n segments={segments}\n />\n\n <ProgressBarLegend\n showLegend={showLegend}\n segments={segments}\n formatOptions={formatOptions}\n />\n </PropsContextProvider>\n )}\n </Aria.ProgressBar>\n </>\n );\n};\n\nexport default ProgressBar;\n"],"names":[],"mappings":";;;;;;;;;;;;AAiCa,MAAA,WAAA,GAAoC,CAAC,KAAU,KAAA;AAC1D,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,MAAS,GAAA,MAAA;AAAA,IACT,YAAA;AAAA,IACA,IAAO,GAAA,GAAA;AAAA,IACP,QAAA;AAAA,IACA,KAAA;AAAA,IACA,aAAA;AAAA,IACA,UAAa,GAAA,IAAA;AAAA,IACb,QAAA;AAAA,IACA,GAAG;AAAA,GACD,GAAA,KAAA;AAEJ,EAAA,MAAM,aAAgB,GAAA,IAAA;AAAA,IACpB,SAAA;AAAA,IACA,MAAO,CAAA,WAAA;AAAA,IACP,MAAA,CAAO,CAAQ,KAAA,EAAA,IAAI,CAAE,CAAA,CAAA;AAAA,IACrB,OAAO,MAAM;AAAA,GACf;AAEA,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,KAAO,EAAA;AAAA,MACL,WAAW,MAAO,CAAA,KAAA;AAAA,MAClB,QAAU,EAAA;AAAA;AACZ,GACF;AAEA,EAAA,MAAM,qBAAqB,QACvB,GAAA,QAAA,CAAS,GAAI,CAAA,CAAC,MAAM,CAAE,CAAA,KAAK,CAAE,CAAA,MAAA,CAAO,CAAC,CAAG,EAAA,CAAA,KAAM,CAAI,GAAA,CAAA,EAAG,CAAC,CACtD,GAAA,MAAA;AAEJ,EAAA,uBAEI,GAAA,CAAA,QAAA,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,IAAK,CAAA,WAAA;AAAA,IAAL;AAAA,MACC,SAAW,EAAA,aAAA;AAAA,MACX,OAAO,kBAAsB,IAAA,KAAA;AAAA,MAC7B,aAAA;AAAA,MACA,QAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEH,QAAA,EAAA,CAAC,EAAE,UAAY,EAAA,SAAA,uBACb,IAAA,CAAA,oBAAA,EAAA,EAAqB,OAAO,YAC1B,EAAA,QAAA,EAAA;AAAA,QAAA,QAAA;AAAA,wBAED,GAAA;AAAA,UAAC,gBAAA;AAAA,UAAA;AAAA,YACC,YAAA;AAAA,YACA,QAAA;AAAA,YACA,SAAA;AAAA,YACA;AAAA;AAAA,SACF;AAAA,wBAEA,GAAA;AAAA,UAAC,cAAA;AAAA,UAAA;AAAA,YACC,UAAA;AAAA,YACA,kBAAA;AAAA,YACA;AAAA;AAAA,SACF;AAAA,wBAEA,GAAA;AAAA,UAAC,iBAAA;AAAA,UAAA;AAAA,YACC,UAAA;AAAA,YACA,QAAA;AAAA,YACA;AAAA;AAAA;AACF,OACF,EAAA;AAAA;AAAA,GAGN,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
3
|
const progressBar = "flow--progress-bar";
|
|
4
|
+
const legend = "flow--progress-bar--legend";
|
|
4
5
|
const label = "flow--progress-bar--label";
|
|
5
6
|
const value = "flow--progress-bar--value";
|
|
6
7
|
const bar = "flow--progress-bar--bar";
|
|
@@ -11,16 +12,19 @@ const danger = "flow--progress-bar--danger";
|
|
|
11
12
|
const warning = "flow--progress-bar--warning";
|
|
12
13
|
const styles = {
|
|
13
14
|
progressBar: progressBar,
|
|
15
|
+
legend: legend,
|
|
14
16
|
label: label,
|
|
15
17
|
value: value,
|
|
16
18
|
bar: bar,
|
|
17
19
|
fill: fill,
|
|
18
20
|
"size-s": "flow--progress-bar--size-s",
|
|
21
|
+
"size-m": "flow--progress-bar--size-m",
|
|
22
|
+
"size-l": "flow--progress-bar--size-l",
|
|
19
23
|
info: info,
|
|
20
24
|
success: success,
|
|
21
25
|
danger: danger,
|
|
22
26
|
warning: warning
|
|
23
27
|
};
|
|
24
28
|
|
|
25
|
-
export { bar, danger, styles as default, fill, info, label, progressBar, success, value, warning };
|
|
29
|
+
export { bar, danger, styles as default, fill, info, label, legend, progressBar, success, value, warning };
|
|
26
30
|
//# sourceMappingURL=ProgressBar.module.scss.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.module.scss.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProgressBar.module.scss.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import styles from '../ProgressBar.module.scss.mjs';
|
|
5
|
+
import 'react';
|
|
6
|
+
import { getCategoricalColorByIndex } from '../../../lib/tokens/getCategoricalColorByIndex.mjs';
|
|
7
|
+
|
|
8
|
+
const ProgressBarBar = (props) => {
|
|
9
|
+
const { segments, segmentsTotalValue, percentage } = props;
|
|
10
|
+
return /* @__PURE__ */ jsx("div", { className: styles.bar, children: /* @__PURE__ */ jsx("div", { className: styles.fill, style: { width: percentage + "%" }, children: segments && segmentsTotalValue && segments.map((s, i) => /* @__PURE__ */ jsx(
|
|
11
|
+
"div",
|
|
12
|
+
{
|
|
13
|
+
"aria-hidden": true,
|
|
14
|
+
style: {
|
|
15
|
+
backgroundColor: `var(--color--categorical--${s.color ?? getCategoricalColorByIndex(i)})`,
|
|
16
|
+
width: 100 / segmentsTotalValue * s.value + "%",
|
|
17
|
+
height: "100%"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
s.title
|
|
21
|
+
)) }) });
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { ProgressBarBar };
|
|
25
|
+
//# sourceMappingURL=ProgressBarBar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBarBar.mjs","sources":["../../../../../../../src/components/ProgressBar/components/ProgressBarBar.tsx"],"sourcesContent":["import styles from \"@/components/ProgressBar/ProgressBar.module.scss\";\nimport React, { type FC } from \"react\";\nimport type { ProgressBarProps } from \"@/components/ProgressBar\";\nimport { getCategoricalColorByIndex } from \"@/lib/tokens/getCategoricalColorByIndex\";\n\ninterface Props extends Pick<ProgressBarProps, \"segments\"> {\n percentage?: number;\n segmentsTotalValue?: number;\n}\n\nexport const ProgressBarBar: FC<Props> = (props) => {\n const { segments, segmentsTotalValue, percentage } = props;\n\n return (\n <div className={styles.bar}>\n <div className={styles.fill} style={{ width: percentage + \"%\" }}>\n {segments &&\n segmentsTotalValue &&\n segments.map((s, i) => (\n <div\n key={s.title}\n aria-hidden\n style={{\n backgroundColor: `var(--color--categorical--${s.color ?? getCategoricalColorByIndex(i)})`,\n width: (100 / segmentsTotalValue) * s.value + \"%\",\n height: \"100%\",\n }}\n />\n ))}\n </div>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;AAUa,MAAA,cAAA,GAA4B,CAAC,KAAU,KAAA;AAClD,EAAA,MAAM,EAAE,QAAA,EAAU,kBAAoB,EAAA,UAAA,EAAe,GAAA,KAAA;AAErD,EACE,uBAAA,GAAA,CAAC,SAAI,SAAW,EAAA,MAAA,CAAO,KACrB,QAAC,kBAAA,GAAA,CAAA,KAAA,EAAA,EAAI,SAAW,EAAA,MAAA,CAAO,IAAM,EAAA,KAAA,EAAO,EAAE,KAAO,EAAA,UAAA,GAAa,KACvD,EAAA,QAAA,EAAA,QAAA,IACC,sBACA,QAAS,CAAA,GAAA,CAAI,CAAC,CAAA,EAAG,CACf,qBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MAEC,aAAW,EAAA,IAAA;AAAA,MACX,KAAO,EAAA;AAAA,QACL,iBAAiB,CAA6B,0BAAA,EAAA,CAAA,CAAE,KAAS,IAAA,0BAAA,CAA2B,CAAC,CAAC,CAAA,CAAA,CAAA;AAAA,QACtF,KAAQ,EAAA,GAAA,GAAM,kBAAsB,GAAA,CAAA,CAAE,KAAQ,GAAA,GAAA;AAAA,QAC9C,MAAQ,EAAA;AAAA;AACV,KAAA;AAAA,IANK,CAAE,CAAA;AAAA,GAQV,GACL,CACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import styles from '../ProgressBar.module.scss.mjs';
|
|
5
|
+
import 'react';
|
|
6
|
+
import { useNumberFormatter } from 'react-aria';
|
|
7
|
+
import { Legend } from '../../Legend/Legend.mjs';
|
|
8
|
+
import { LegendItem } from '../../Legend/components/LegendItem/LegendItem.mjs';
|
|
9
|
+
import { getCategoricalColorByIndex } from '../../../lib/tokens/getCategoricalColorByIndex.mjs';
|
|
10
|
+
|
|
11
|
+
const ProgressBarLegend = (props) => {
|
|
12
|
+
const { segments, showLegend, formatOptions } = props;
|
|
13
|
+
const formatter = useNumberFormatter(formatOptions);
|
|
14
|
+
if (!segments || !showLegend) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return /* @__PURE__ */ jsx(Legend, { className: styles.legend, children: segments.map((s, i) => /* @__PURE__ */ jsx(
|
|
18
|
+
LegendItem,
|
|
19
|
+
{
|
|
20
|
+
color: s.color ?? getCategoricalColorByIndex(i),
|
|
21
|
+
children: `${s.title} (${formatOptions ? formatter.format(s.value) : `${s.value} %`})`
|
|
22
|
+
}
|
|
23
|
+
)) });
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { ProgressBarLegend };
|
|
27
|
+
//# sourceMappingURL=ProgressBarLegend.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBarLegend.mjs","sources":["../../../../../../../src/components/ProgressBar/components/ProgressBarLegend.tsx"],"sourcesContent":["import styles from \"@/components/ProgressBar/ProgressBar.module.scss\";\nimport React, { type FC } from \"react\";\nimport { useNumberFormatter } from \"react-aria\";\nimport type { ProgressBarProps } from \"@/components/ProgressBar\";\nimport { Legend, LegendItem } from \"@/components/Legend\";\nimport { getCategoricalColorByIndex } from \"@/lib/tokens/getCategoricalColorByIndex\";\n\ntype Props = Pick<\n ProgressBarProps,\n \"segments\" | \"showLegend\" | \"formatOptions\"\n>;\n\nexport const ProgressBarLegend: FC<Props> = (props) => {\n const { segments, showLegend, formatOptions } = props;\n\n const formatter = useNumberFormatter(formatOptions);\n\n if (!segments || !showLegend) {\n return null;\n }\n\n return (\n <Legend className={styles.legend}>\n {segments.map((s, i) => (\n <LegendItem\n color={s.color ?? getCategoricalColorByIndex(i)}\n >{`${s.title} (${formatOptions ? formatter.format(s.value) : `${s.value} %`})`}</LegendItem>\n ))}\n </Legend>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAYa,MAAA,iBAAA,GAA+B,CAAC,KAAU,KAAA;AACrD,EAAA,MAAM,EAAE,QAAA,EAAU,UAAY,EAAA,aAAA,EAAkB,GAAA,KAAA;AAEhD,EAAM,MAAA,SAAA,GAAY,mBAAmB,aAAa,CAAA;AAElD,EAAI,IAAA,CAAC,QAAY,IAAA,CAAC,UAAY,EAAA;AAC5B,IAAO,OAAA,IAAA;AAAA;AAGT,EACE,uBAAA,GAAA,CAAC,UAAO,SAAW,EAAA,MAAA,CAAO,QACvB,QAAS,EAAA,QAAA,CAAA,GAAA,CAAI,CAAC,CAAA,EAAG,CAChB,qBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAO,EAAA,CAAA,CAAE,KAAS,IAAA,0BAAA,CAA2B,CAAC,CAAA;AAAA,MAC9C,QAAG,EAAA,CAAA,EAAA,CAAA,CAAE,KAAK,CAAA,EAAA,EAAK,aAAgB,GAAA,SAAA,CAAU,MAAO,CAAA,CAAA,CAAE,KAAK,CAAA,GAAI,CAAG,EAAA,CAAA,CAAE,KAAK,CAAI,EAAA,CAAA,CAAA,CAAA;AAAA;AAAA,GAC5E,CACH,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import styles from '../ProgressBar.module.scss.mjs';
|
|
5
|
+
import 'react';
|
|
6
|
+
import { useNumberFormatter, useLocalizedStringFormatter } from 'react-aria';
|
|
7
|
+
import locales from '../../../../../_virtual/_.locale.json@162914df08c90e5e10d2f78b03d9d768.mjs';
|
|
8
|
+
|
|
9
|
+
const ProgressBarValue = (props) => {
|
|
10
|
+
const { showMaxValue, maxValue, valueText, formatOptions } = props;
|
|
11
|
+
const formatter = useNumberFormatter(formatOptions);
|
|
12
|
+
const stringFormatter = useLocalizedStringFormatter(locales);
|
|
13
|
+
const maxValueText = showMaxValue && maxValue ? formatter.format(maxValue) : void 0;
|
|
14
|
+
return /* @__PURE__ */ jsx("span", { className: styles.value, children: maxValueText ? `${valueText} ${stringFormatter.format("progressBar.of")} ${maxValueText}` : valueText });
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { ProgressBarValue };
|
|
18
|
+
//# sourceMappingURL=ProgressBarValue.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBarValue.mjs","sources":["../../../../../../../src/components/ProgressBar/components/ProgressBarValue.tsx"],"sourcesContent":["import styles from \"@/components/ProgressBar/ProgressBar.module.scss\";\nimport React, { type FC } from \"react\";\nimport { useLocalizedStringFormatter, useNumberFormatter } from \"react-aria\";\nimport locales from \"../locales/*.locale.json\";\nimport type { ProgressBarProps } from \"@/components/ProgressBar\";\n\ninterface Props\n extends Pick<\n ProgressBarProps,\n \"showMaxValue\" | \"maxValue\" | \"formatOptions\"\n > {\n valueText?: string;\n}\n\nexport const ProgressBarValue: FC<Props> = (props) => {\n const { showMaxValue, maxValue, valueText, formatOptions } = props;\n\n const formatter = useNumberFormatter(formatOptions);\n\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const maxValueText =\n showMaxValue && maxValue ? formatter.format(maxValue) : undefined;\n\n return (\n <span className={styles.value}>\n {maxValueText\n ? `${valueText} ${stringFormatter.format(\"progressBar.of\")} ${maxValueText}`\n : valueText}\n </span>\n );\n};\n"],"names":[],"mappings":";;;;;;AAca,MAAA,gBAAA,GAA8B,CAAC,KAAU,KAAA;AACpD,EAAA,MAAM,EAAE,YAAA,EAAc,QAAU,EAAA,SAAA,EAAW,eAAkB,GAAA,KAAA;AAE7D,EAAM,MAAA,SAAA,GAAY,mBAAmB,aAAa,CAAA;AAElD,EAAM,MAAA,eAAA,GAAkB,4BAA4B,OAAO,CAAA;AAE3D,EAAA,MAAM,eACJ,YAAgB,IAAA,QAAA,GAAW,SAAU,CAAA,MAAA,CAAO,QAAQ,CAAI,GAAA,MAAA;AAE1D,EAAA,2BACG,MAAK,EAAA,EAAA,SAAA,EAAW,MAAO,CAAA,KAAA,EACrB,yBACG,CAAG,EAAA,SAAS,CAAI,CAAA,EAAA,eAAA,CAAgB,OAAO,gBAAgB,CAAC,CAAI,CAAA,EAAA,YAAY,KACxE,SACN,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
const getCategoricalColorByIndex = (index) => {
|
|
4
|
+
switch (index) {
|
|
5
|
+
case 0:
|
|
6
|
+
return "sea-green";
|
|
7
|
+
case 1:
|
|
8
|
+
return "palatinate-blue";
|
|
9
|
+
case 2:
|
|
10
|
+
return "tangerine";
|
|
11
|
+
case 3:
|
|
12
|
+
return "magenta";
|
|
13
|
+
case 4:
|
|
14
|
+
return "tropical-indigo";
|
|
15
|
+
case 5:
|
|
16
|
+
return "malachite";
|
|
17
|
+
case 6:
|
|
18
|
+
return "azure";
|
|
19
|
+
case 7:
|
|
20
|
+
return "violet";
|
|
21
|
+
case 8:
|
|
22
|
+
return "yellow";
|
|
23
|
+
case 9:
|
|
24
|
+
return "alloy-orange";
|
|
25
|
+
case 10:
|
|
26
|
+
return "green";
|
|
27
|
+
default:
|
|
28
|
+
return "lime";
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { getCategoricalColorByIndex };
|
|
33
|
+
//# sourceMappingURL=getCategoricalColorByIndex.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCategoricalColorByIndex.mjs","sources":["../../../../../../src/lib/tokens/getCategoricalColorByIndex.tsx"],"sourcesContent":["export const getCategoricalColorByIndex = (index: number) => {\n switch (index) {\n case 0:\n return \"sea-green\";\n case 1:\n return \"palatinate-blue\";\n case 2:\n return \"tangerine\";\n case 3:\n return \"magenta\";\n case 4:\n return \"tropical-indigo\";\n case 5:\n return \"malachite\";\n case 6:\n return \"azure\";\n case 7:\n return \"violet\";\n case 8:\n return \"yellow\";\n case 9:\n return \"alloy-orange\";\n case 10:\n return \"green\";\n default:\n return \"lime\";\n }\n};\n"],"names":[],"mappings":"AAAa,MAAA,0BAAA,GAA6B,CAAC,KAAkB,KAAA;AAC3D,EAAA,QAAQ,KAAO;AAAA,IACb,KAAK,CAAA;AACH,MAAO,OAAA,WAAA;AAAA,IACT,KAAK,CAAA;AACH,MAAO,OAAA,iBAAA;AAAA,IACT,KAAK,CAAA;AACH,MAAO,OAAA,WAAA;AAAA,IACT,KAAK,CAAA;AACH,MAAO,OAAA,SAAA;AAAA,IACT,KAAK,CAAA;AACH,MAAO,OAAA,iBAAA;AAAA,IACT,KAAK,CAAA;AACH,MAAO,OAAA,WAAA;AAAA,IACT,KAAK,CAAA;AACH,MAAO,OAAA,OAAA;AAAA,IACT,KAAK,CAAA;AACH,MAAO,OAAA,QAAA;AAAA,IACT,KAAK,CAAA;AACH,MAAO,OAAA,QAAA;AAAA,IACT,KAAK,CAAA;AACH,MAAO,OAAA,cAAA;AAAA,IACT,KAAK,EAAA;AACH,MAAO,OAAA,OAAA;AAAA,IACT;AACE,MAAO,OAAA,MAAA;AAAA;AAEb;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegendContent.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ChartLegend/components/LegendContent/LegendContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+CAA+C,CAAC;AAC3E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,KAAK,iBAAiB,GAAG,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG,yBAAyB,CAAC;AAE9E,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"LegendContent.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ChartLegend/components/LegendContent/LegendContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+CAA+C,CAAC;AAC3E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,KAAK,iBAAiB,GAAG,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG,yBAAyB,CAAC;AAE9E,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,iBAAiB,CAgCxC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipContent.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChartTooltip/components/TooltipContent.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,QAAQ,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACV,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,UAAU,mBACR,SAAQ,IAAI,CACR,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,CAAC,EACjD,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,kBAAkB,CACpD,EACD,qBAAqB;CAAG;AAE5B,eAAO,MAAM,cAAc,GAAI,OAAO,mBAAmB,
|
|
1
|
+
{"version":3,"file":"TooltipContent.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChartTooltip/components/TooltipContent.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,QAAQ,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACV,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,UAAU,mBACR,SAAQ,IAAI,CACR,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,CAAC,EACjD,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,kBAAkB,CACpD,EACD,qBAAqB;CAAG;AAE5B,eAAO,MAAM,cAAc,GAAI,OAAO,mBAAmB,mDAkCxD,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
2
|
import { CategoricalColors } from '../../../../lib/tokens/CategoricalColors';
|
|
3
|
-
export interface LegendItemProps {
|
|
4
|
-
color
|
|
5
|
-
title: string;
|
|
3
|
+
export interface LegendItemProps extends PropsWithChildren {
|
|
4
|
+
color?: CategoricalColors | string;
|
|
6
5
|
}
|
|
7
6
|
export declare const LegendItem: FC<LegendItemProps>;
|
|
8
7
|
export default LegendItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegendItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Legend/components/LegendItem/LegendItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LegendItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Legend/components/LegendItem/LegendItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,gCAAgC,CAAC;AAGxC,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,KAAK,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC;CACpC;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAoB1C,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import { FC, PropsWithChildren } from 'react';
|
|
2
2
|
import { PropsWithStatus } from '../../lib/types/props';
|
|
3
|
+
import { CategoricalColors } from '../../lib/tokens/CategoricalColors';
|
|
3
4
|
import * as Aria from "react-aria-components";
|
|
4
5
|
export interface ProgressBarProps extends PropsWithChildren<Omit<Aria.ProgressBarProps, "children">>, PropsWithStatus {
|
|
5
6
|
/** Whether the max value should be displayed. */
|
|
6
7
|
showMaxValue?: boolean;
|
|
7
|
-
/** The size variant of the progress bar @default "m" */
|
|
8
|
-
size?: "s" | "m";
|
|
8
|
+
/** The size variant of the progress bar. @default "m" */
|
|
9
|
+
size?: "s" | "m" | "l";
|
|
10
|
+
/** Divides the fill of the progress bar into segments */
|
|
11
|
+
segments?: {
|
|
12
|
+
value: number;
|
|
13
|
+
title: string;
|
|
14
|
+
color?: CategoricalColors;
|
|
15
|
+
}[];
|
|
16
|
+
/**
|
|
17
|
+
* Whether the legend component is shown when segments are used. @default:
|
|
18
|
+
* true
|
|
19
|
+
*/
|
|
20
|
+
showLegend?: boolean;
|
|
9
21
|
}
|
|
10
22
|
/**
|
|
11
23
|
* @flr-generate all
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../../../src/components/ProgressBar/ProgressBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAC9C,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../../../src/components/ProgressBar/ProgressBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAC9C,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAInD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAMzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAExE,MAAM,WAAW,gBACf,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC,EAChE,eAAe;IACjB,iDAAiD;IACjD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,yDAAyD;IACzD,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IACvB,yDAAyD;IACzD,QAAQ,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,iBAAiB,CAAA;KAAE,EAAE,CAAC;IACzE;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAqE5C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ProgressBarProps } from '..';
|
|
3
|
+
interface Props extends Pick<ProgressBarProps, "segments"> {
|
|
4
|
+
percentage?: number;
|
|
5
|
+
segmentsTotalValue?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const ProgressBarBar: FC<Props>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=ProgressBarBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBarBar.d.ts","sourceRoot":"","sources":["../../../../../src/components/ProgressBar/components/ProgressBarBar.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAGjE,UAAU,KAAM,SAAQ,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC;IACxD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,KAAK,CAsBpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBarLegend.d.ts","sourceRoot":"","sources":["../../../../../src/components/ProgressBar/components/ProgressBarLegend.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAIjE,KAAK,KAAK,GAAG,IAAI,CACf,gBAAgB,EAChB,UAAU,GAAG,YAAY,GAAG,eAAe,CAC5C,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,KAAK,CAkBvC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ProgressBarProps } from '..';
|
|
3
|
+
interface Props extends Pick<ProgressBarProps, "showMaxValue" | "maxValue" | "formatOptions"> {
|
|
4
|
+
valueText?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const ProgressBarValue: FC<Props>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=ProgressBarValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBarValue.d.ts","sourceRoot":"","sources":["../../../../../src/components/ProgressBar/components/ProgressBarValue.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,UAAU,KACR,SAAQ,IAAI,CACV,gBAAgB,EAChB,cAAc,GAAG,UAAU,GAAG,eAAe,CAC9C;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,KAAK,CAiBtC,CAAC"}
|
|
@@ -8,4 +8,7 @@ export declare const WithPercentage: Story;
|
|
|
8
8
|
export declare const WithoutUnit: Story;
|
|
9
9
|
export declare const WithMaxValue: Story;
|
|
10
10
|
export declare const Small: Story;
|
|
11
|
+
export declare const WithSegments: Story;
|
|
12
|
+
export declare const WithSegmentsAndUnit: Story;
|
|
13
|
+
export declare const WithSegmentsAndWithoutLegend: Story;
|
|
11
14
|
//# sourceMappingURL=Default.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Default.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/ProgressBar/stories/Default.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIvC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,WAAW,CAyBlC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAC;AAE1C,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,cAAc,EAAE,KAM5B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAazB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAE1B,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAEnB,CAAC"}
|
|
1
|
+
{"version":3,"file":"Default.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/ProgressBar/stories/Default.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIvC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,WAAW,CAyBlC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAC;AAE1C,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,cAAc,EAAE,KAM5B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAazB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAE1B,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAEnB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAa1B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAgBjC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,KAiB1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EdgeCases.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/ProgressBar/stories/EdgeCases.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAMzC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,WAAW,CAGlC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAC;AAE1C,eAAO,MAAM,QAAQ,EAAE,KAatB,CAAC"}
|
|
1
|
+
{"version":3,"file":"EdgeCases.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/ProgressBar/stories/EdgeCases.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAMzC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,WAAW,CAGlC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAC;AAE1C,eAAO,MAAM,QAAQ,EAAE,KAatB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAqB9B,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const getCategoricalColorByIndex: (index: number) => "green" | "violet" | "azure" | "lime" | "magenta" | "yellow" | "sea-green" | "palatinate-blue" | "tangerine" | "tropical-indigo" | "malachite" | "alloy-orange";
|
|
2
|
+
//# sourceMappingURL=getCategoricalColorByIndex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCategoricalColorByIndex.d.ts","sourceRoot":"","sources":["../../../../src/lib/tokens/getCategoricalColorByIndex.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,GAAI,OAAO,MAAM,oKA2BvD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/flow-react-components",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.135",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A React implementation of Flow, mittwald’s design system",
|
|
6
6
|
"homepage": "https://mittwald.github.io/flow",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@chakra-ui/live-region": "^2.1.0",
|
|
55
55
|
"@internationalized/string-compiler": "^3.2.6",
|
|
56
|
-
"@mittwald/react-tunnel": "0.2.0-alpha.
|
|
56
|
+
"@mittwald/react-tunnel": "0.2.0-alpha.135",
|
|
57
57
|
"@mittwald/react-use-promise": "^3.0.4",
|
|
58
58
|
"@react-aria/form": "^3.0.14",
|
|
59
59
|
"@react-aria/utils": "^3.28.1",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@faker-js/faker": "^9.6.0",
|
|
94
94
|
"@internationalized/date": "^3.7.0",
|
|
95
|
-
"@mittwald/flow-design-tokens": "0.2.0-alpha.
|
|
95
|
+
"@mittwald/flow-design-tokens": "0.2.0-alpha.135",
|
|
96
96
|
"@mittwald/react-use-promise": "^2.6.0",
|
|
97
97
|
"@mittwald/remote-dom-react": "1.2.2-mittwald.3",
|
|
98
98
|
"@mittwald/typescript-config": "",
|
|
@@ -173,5 +173,5 @@
|
|
|
173
173
|
"optional": true
|
|
174
174
|
}
|
|
175
175
|
},
|
|
176
|
-
"gitHead": "
|
|
176
|
+
"gitHead": "d6761ade7b9a1ebc62f388158bed53c95815954d"
|
|
177
177
|
}
|