@speakapbv/dough-component-library 10.0.1 → 10.1.1

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.
@@ -0,0 +1,17 @@
1
+ import "./progress-bar.scss";
2
+ import { Colors, DoughDataAttributes, FixedColors } from "../../utils/constants";
3
+ export interface Bar {
4
+ color: Colors | FixedColors | string;
5
+ value: number;
6
+ }
7
+ export interface MultiProgressBarProps {
8
+ className?: string;
9
+ dataAttributes?: DoughDataAttributes;
10
+ total: number;
11
+ railColor?: Colors | string;
12
+ data: Array<Bar>;
13
+ }
14
+ export declare const MultiProgressBar: {
15
+ ({ dataAttributes, className, railColor, data, total, }: MultiProgressBarProps): JSX.Element;
16
+ displayName: string;
17
+ };
package/dist/index.d.ts CHANGED
@@ -37,6 +37,7 @@ export { Tooltip, TooltipDirection } from "./components/tooltip/tooltip";
37
37
  export { AppBackground } from "./components/app-background/app-background";
38
38
  export { AppWrapper } from "./components/app-wrapper/app-wrapper";
39
39
  export { PanelOverlay } from "./components/panel-overlay/panel-overlay";
40
+ export { MultiProgressBar, MultiProgressBarProps, } from "./components/progress-bar/multi-progress-bar";
40
41
  export { ProgressBar, ProgressBarProps, } from "./components/progress-bar/progress-bar";
41
42
  export { AlertText } from "./components/alert-textbox/alert-textbox";
42
43
  export { Notification } from "./components/notification/notification";
package/dist/index.es.js CHANGED
@@ -4518,7 +4518,7 @@ var PanelOverlay = function (props) {
4518
4518
  };
4519
4519
  PanelOverlay.displayName = "PanelOverlay";
4520
4520
 
4521
- var css_248z$x = "/* COLORS */\n/* Typography*/\n/*Dennis should provide medium font size*/\n.dough-progress-bar {\n height: 4px;\n width: 100%;\n border-radius: 4px;\n position: relative;\n}\n\n.dough-progress-bar__progress {\n position: absolute;\n height: 100%;\n border-radius: 4px;\n z-index: 1;\n}";
4521
+ var css_248z$x = "/* COLORS */\n/* Typography*/\n/*Dennis should provide medium font size*/\n.dough-progress-bar {\n height: 4px;\n width: 100%;\n border-radius: 4px;\n position: relative;\n}\n\n.dough-progress-bar__progress {\n position: absolute;\n height: 100%;\n border-radius: 4px;\n z-index: 1;\n}\n\n.dough-multi-progress-bar {\n height: 8px;\n width: 100%;\n border-radius: 8px;\n display: flex;\n}\n\n.dough-multi-progress-bar__progress {\n height: 100%;\n z-index: 1;\n border-left: 1px solid rgb(110, 111, 117);\n}\n.dough-multi-progress-bar__progress:first-of-type {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n border-left: unset;\n}\n.dough-multi-progress-bar__progress:not(:last-of-type) {\n border-right: 1px solid rgb(110, 111, 117);\n}\n.dough-multi-progress-bar__progress:last-of-type {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n}";
4522
4522
  styleInject(css_248z$x);
4523
4523
 
4524
4524
  var DesignTokens = {
@@ -4708,10 +4708,31 @@ var generateStyles = function (props, selector, propToStyleMap, noMediaQuery) {
4708
4708
  var isStandardColor = function (color) {
4709
4709
  return Object.values(Colors).includes(color);
4710
4710
  };
4711
+ var isFixedColor = function (color) {
4712
+ return Object.values(FixedColors).includes(color);
4713
+ };
4711
4714
  var getColorWithFallback = function (color) {
4712
- return isStandardColor(color) ? "var(--" + color + ")" : color;
4715
+ return isStandardColor(color) || isFixedColor(color) ? "var(--" + color + ")" : color;
4713
4716
  };
4714
4717
 
4718
+ var MultiProgressBar = function (_a) {
4719
+ var dataAttributes = _a.dataAttributes, className = _a.className, _b = _a.railColor, railColor = _b === void 0 ? "#EDEDED" : _b, data = _a.data, total = _a.total;
4720
+ var aggregatedTotal = data.reduce(function (agg, el) { return agg + el.value; }, 0);
4721
+ var normalizedTotal = aggregatedTotal > total ? aggregatedTotal : total;
4722
+ return (React.createElement("div", __assign({ className: cn("dough-multi-progress-bar", className) }, dataAttributes, { style: {
4723
+ backgroundColor: getColorWithFallback(railColor),
4724
+ } }),
4725
+ data.filter(Boolean).map(function (_a, index) {
4726
+ var value = _a.value, color = _a.color;
4727
+ return (React.createElement("div", { key: index, className: "dough-multi-progress-bar__progress", style: {
4728
+ backgroundColor: getColorWithFallback(color),
4729
+ width: "calc(" + value + " / " + normalizedTotal + " * 100%)",
4730
+ } }));
4731
+ }),
4732
+ aggregatedTotal < total && (React.createElement("div", { className: "dough-multi-progress-bar__progress" }))));
4733
+ };
4734
+ MultiProgressBar.displayName = "MultiProgressBar";
4735
+
4715
4736
  var ProgressBar = function (_a) {
4716
4737
  var total = _a.total, completed = _a.completed, _b = _a.railColor, railColor = _b === void 0 ? "#EDEDED" : _b, _c = _a.barColor, barColor = _c === void 0 ? Colors.SUCCESS : _c, dataAttributes = _a.dataAttributes, className = _a.className;
4717
4738
  return (React.createElement("div", __assign({ className: cn("dough-progress-bar", className) }, dataAttributes, { style: {
@@ -5651,4 +5672,4 @@ GridItem.displayName = "GridItem";
5651
5672
 
5652
5673
  injectRobotoFont();
5653
5674
 
5654
- export { AlertStatus, AlertText, AppBackground, AppWrapper, Avatar, BR, Badge, BorderStyles, Box, BoxAlign, BoxAlignContent, BoxAlignment, BoxDirection, BoxDisplay, BoxJustifyContent, BoxOverflow, BoxWrap, BreadCrumb, BreadCrumbText, BreakpointViewer, BreakpointViewportSizes, Button, ButtonInputType, Card, Carousel, CheckBox, Collapser, ColorTile, Colors, ColorsIcon, ColorsText, Container, ContentSlider, DatePicker, DateTime, DesignTokens, Dialog, Direction, Divider, DoughDateInput, DoughListItem, DropMenu, Fader, FixedColors, Footer, Grid, GridContentAlignment, GridFlow, GridItem, GridItemsAlignment, H1, H2, H3, H4, H5, H6, H7, Header, HorizontalAlignment, HorizontalListSlider, Image, ImageCarousel, ImageContentShowOnHoverClassName, InputWrapper, LayoutContainer, LayoutFlexBox, Link, Notification, NumericInput, Overlay, OverlayVariant, PanelOverlay, Paragraph, ProgressBar, RadioGroup, RadioOption, SelectBox, Sizes, Skeleton, SkeletonShape, Spacer, Spacings, Spinner, StepsIndicator, StrengthIndicator, Subtitle, Switch, Table, TableCell, TableRow, TableRowStyle, TabsContainer, Tag, Text, TextAlignment, TextArea, TextInput, TimePicker, Toggle, ToggleWithText, Tooltip, TooltipDirection, UnorderedList, VerticalAlignment, cancelEvent, checkComponentType, cn, findParentBySelector, generateUID, hideLastDoughTooltip, isStandardColor, setBreakpointSizeManually };
5675
+ export { AlertStatus, AlertText, AppBackground, AppWrapper, Avatar, BR, Badge, BorderStyles, Box, BoxAlign, BoxAlignContent, BoxAlignment, BoxDirection, BoxDisplay, BoxJustifyContent, BoxOverflow, BoxWrap, BreadCrumb, BreadCrumbText, BreakpointViewer, BreakpointViewportSizes, Button, ButtonInputType, Card, Carousel, CheckBox, Collapser, ColorTile, Colors, ColorsIcon, ColorsText, Container, ContentSlider, DatePicker, DateTime, DesignTokens, Dialog, Direction, Divider, DoughDateInput, DoughListItem, DropMenu, Fader, FixedColors, Footer, Grid, GridContentAlignment, GridFlow, GridItem, GridItemsAlignment, H1, H2, H3, H4, H5, H6, H7, Header, HorizontalAlignment, HorizontalListSlider, Image, ImageCarousel, ImageContentShowOnHoverClassName, InputWrapper, LayoutContainer, LayoutFlexBox, Link, MultiProgressBar, Notification, NumericInput, Overlay, OverlayVariant, PanelOverlay, Paragraph, ProgressBar, RadioGroup, RadioOption, SelectBox, Sizes, Skeleton, SkeletonShape, Spacer, Spacings, Spinner, StepsIndicator, StrengthIndicator, Subtitle, Switch, Table, TableCell, TableRow, TableRowStyle, TabsContainer, Tag, Text, TextAlignment, TextArea, TextInput, TimePicker, Toggle, ToggleWithText, Tooltip, TooltipDirection, UnorderedList, VerticalAlignment, cancelEvent, checkComponentType, cn, findParentBySelector, generateUID, hideLastDoughTooltip, isStandardColor, setBreakpointSizeManually };
package/dist/index.js CHANGED
@@ -4501,7 +4501,7 @@ var PanelOverlay = function (props) {
4501
4501
  };
4502
4502
  PanelOverlay.displayName = "PanelOverlay";
4503
4503
 
4504
- var css_248z$x = "/* COLORS */\n/* Typography*/\n/*Dennis should provide medium font size*/\n.dough-progress-bar {\n height: 4px;\n width: 100%;\n border-radius: 4px;\n position: relative;\n}\n\n.dough-progress-bar__progress {\n position: absolute;\n height: 100%;\n border-radius: 4px;\n z-index: 1;\n}";
4504
+ var css_248z$x = "/* COLORS */\n/* Typography*/\n/*Dennis should provide medium font size*/\n.dough-progress-bar {\n height: 4px;\n width: 100%;\n border-radius: 4px;\n position: relative;\n}\n\n.dough-progress-bar__progress {\n position: absolute;\n height: 100%;\n border-radius: 4px;\n z-index: 1;\n}\n\n.dough-multi-progress-bar {\n height: 8px;\n width: 100%;\n border-radius: 8px;\n display: flex;\n}\n\n.dough-multi-progress-bar__progress {\n height: 100%;\n z-index: 1;\n border-left: 1px solid rgb(110, 111, 117);\n}\n.dough-multi-progress-bar__progress:first-of-type {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n border-left: unset;\n}\n.dough-multi-progress-bar__progress:not(:last-of-type) {\n border-right: 1px solid rgb(110, 111, 117);\n}\n.dough-multi-progress-bar__progress:last-of-type {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n}";
4505
4505
  styleInject(css_248z$x);
4506
4506
 
4507
4507
  var DesignTokens = {
@@ -4691,10 +4691,31 @@ var generateStyles = function (props, selector, propToStyleMap, noMediaQuery) {
4691
4691
  var isStandardColor = function (color) {
4692
4692
  return Object.values(exports.Colors).includes(color);
4693
4693
  };
4694
+ var isFixedColor = function (color) {
4695
+ return Object.values(exports.FixedColors).includes(color);
4696
+ };
4694
4697
  var getColorWithFallback = function (color) {
4695
- return isStandardColor(color) ? "var(--" + color + ")" : color;
4698
+ return isStandardColor(color) || isFixedColor(color) ? "var(--" + color + ")" : color;
4696
4699
  };
4697
4700
 
4701
+ var MultiProgressBar = function (_a) {
4702
+ var dataAttributes = _a.dataAttributes, className = _a.className, _b = _a.railColor, railColor = _b === void 0 ? "#EDEDED" : _b, data = _a.data, total = _a.total;
4703
+ var aggregatedTotal = data.reduce(function (agg, el) { return agg + el.value; }, 0);
4704
+ var normalizedTotal = aggregatedTotal > total ? aggregatedTotal : total;
4705
+ return (React__default.createElement("div", __assign({ className: cn("dough-multi-progress-bar", className) }, dataAttributes, { style: {
4706
+ backgroundColor: getColorWithFallback(railColor),
4707
+ } }),
4708
+ data.filter(Boolean).map(function (_a, index) {
4709
+ var value = _a.value, color = _a.color;
4710
+ return (React__default.createElement("div", { key: index, className: "dough-multi-progress-bar__progress", style: {
4711
+ backgroundColor: getColorWithFallback(color),
4712
+ width: "calc(" + value + " / " + normalizedTotal + " * 100%)",
4713
+ } }));
4714
+ }),
4715
+ aggregatedTotal < total && (React__default.createElement("div", { className: "dough-multi-progress-bar__progress" }))));
4716
+ };
4717
+ MultiProgressBar.displayName = "MultiProgressBar";
4718
+
4698
4719
  var ProgressBar = function (_a) {
4699
4720
  var total = _a.total, completed = _a.completed, _b = _a.railColor, railColor = _b === void 0 ? "#EDEDED" : _b, _c = _a.barColor, barColor = _c === void 0 ? exports.Colors.SUCCESS : _c, dataAttributes = _a.dataAttributes, className = _a.className;
4700
4721
  return (React__default.createElement("div", __assign({ className: cn("dough-progress-bar", className) }, dataAttributes, { style: {
@@ -5673,6 +5694,7 @@ exports.InputWrapper = InputWrapper;
5673
5694
  exports.LayoutContainer = LayoutContainer;
5674
5695
  exports.LayoutFlexBox = LayoutFlexBox;
5675
5696
  exports.Link = Link;
5697
+ exports.MultiProgressBar = MultiProgressBar;
5676
5698
  exports.Notification = Notification;
5677
5699
  exports.NumericInput = NumericInput;
5678
5700
  exports.Overlay = Overlay;
@@ -0,0 +1,6 @@
1
+ declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react").ReactFramework, import("./multi-progress-bar").MultiProgressBarProps>;
2
+ export default _default;
3
+ export declare const Empty: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, import("./multi-progress-bar").MultiProgressBarProps>;
4
+ export declare const SingleData: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, import("./multi-progress-bar").MultiProgressBarProps>;
5
+ export declare const MultipleData: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, import("./multi-progress-bar").MultiProgressBarProps>;
6
+ export declare const FullyFilled: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, import("./multi-progress-bar").MultiProgressBarProps>;
@@ -1,5 +1,6 @@
1
- import { Colors } from "./constants";
1
+ import { Colors, FixedColors } from "./constants";
2
2
  export declare const getIESpecificStyles: (props: Record<string, any>, propToStyleMap: Record<string, Array<string>>) => string;
3
3
  export declare const generateStyles: (props: Record<string, any>, selector: string, propToStyleMap: Record<string, Array<string>>, noMediaQuery?: boolean | undefined) => string;
4
4
  export declare const isStandardColor: (color: Colors | string) => color is Colors;
5
- export declare const getColorWithFallback: (color: Colors | string) => string;
5
+ export declare const isFixedColor: (color: FixedColors | string) => color is FixedColors;
6
+ export declare const getColorWithFallback: (color: Colors | FixedColors | string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@speakapbv/dough-component-library",
3
- "version": "10.0.1",
3
+ "version": "10.1.1",
4
4
  "description": "DOUGH: Speakap React Component Library",
5
5
  "author": "Speakap",
6
6
  "license": "MIT",