orcs-design-system 3.2.9 → 3.2.11

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.
@@ -16,11 +16,11 @@ export const defaultProgressBar = () => /*#__PURE__*/_jsxs(Spacer, {
16
16
  children: [/*#__PURE__*/_jsx(ProgressBar, {
17
17
  ariaLabel: "Percent Completed",
18
18
  containerWidth: 100,
19
- fillWidth: 40
19
+ fillWidth: 75
20
20
  }), /*#__PURE__*/_jsx(ProgressBar, {
21
21
  ariaLabel: "Percent Completed",
22
22
  containerWidth: 50,
23
- fillWidth: 70
23
+ fillWidth: 75
24
24
  })]
25
25
  });
26
26
  defaultProgressBar.storyName = "Default";
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { useRef, useEffect, useState } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import styled, { css, keyframes, ThemeProvider } from "styled-components";
4
4
  import { space, layout } from "styled-system";
@@ -8,11 +8,20 @@ const expandWidth = keyframes(["0%{width:0;}"]);
8
8
  const Background = styled.div.withConfig({
9
9
  displayName: "ProgressBar__Background",
10
10
  componentId: "sc-q9qaaf-0"
11
- })(["", " ", " position:relative;background:", ";height:16px;border-radius:8px;"], space, layout, props => themeGet("colors.greyLighter")(props));
11
+ })(["", " ", " position:relative;background:", ";height:16px;border-radius:8px;width:", ";"], space, layout, props => themeGet("colors.greyLighter")(props), props => props.containerWidth ? props.containerWidth + "%" : "100%");
12
12
  const Fill = styled.div.withConfig({
13
13
  displayName: "ProgressBar__Fill",
14
14
  componentId: "sc-q9qaaf-1"
15
- })(["position:absolute;left:3px;top:3px;height:10px;border-radius:5px;animation:", " 1000ms ease-in-out 1;transition:", ";", ";"], expandWidth, props => themeGet("transition.transitionDefault")(props), props => props.gradient ? css(["background:linear-gradient( to right,", " 0%,", " 50%,", " 100% );"], themeGet("colors.danger")(props), themeGet("colors.warning")(props), themeGet("colors.success")(props)) : css(["background:", ";"], themeGet("colors.primary")(props)));
15
+ })(["width:", ";position:absolute;left:3px;top:3px;height:10px;border-radius:5px;animation:", " 1000ms ease-in-out 1;transition:", ";", ";"], props => {
16
+ if (props.fillWidth && props.containerWidthPx) {
17
+ const sixPxInPercentage = 6 / props.containerWidthPx * 100;
18
+ const minPixelValue = 1; // Minimum pixel value for visibility
19
+ const minPercentageValue = minPixelValue / props.containerWidthPx * 100;
20
+ const calculatedWidth = "calc(".concat(props.fillWidth, "% - ").concat(sixPxInPercentage, "%)");
21
+ return "max(".concat(calculatedWidth, ", ").concat(minPercentageValue, "%)");
22
+ }
23
+ return "0";
24
+ }, expandWidth, props => themeGet("transition.transitionDefault")(props), props => props.gradient ? css(["background:linear-gradient( to right,", " 0%,", " 50%,", " 100% );"], themeGet("colors.danger")(props), themeGet("colors.warning")(props), themeGet("colors.success")(props)) : css(["background:", ";"], themeGet("colors.primary")(props)));
16
25
 
17
26
  /**
18
27
  * Progress bar is not intended to be used for loading (that's what the Loading component is for). The intended use is for indicating progress through steps or progress towards a goal.
@@ -24,27 +33,32 @@ const Fill = styled.div.withConfig({
24
33
 
25
34
  export default function ProgressBar(_ref) {
26
35
  let {
27
- containerWidth,
36
+ containerWidth = "100%",
28
37
  fillWidth,
29
38
  gradient,
30
39
  theme,
31
40
  ariaLabel = "Progress",
32
41
  ...props
33
42
  } = _ref;
43
+ const backgroundRef = useRef(null);
44
+ const [containerWidthPx, setContainerWidthPx] = useState(0);
45
+ useEffect(() => {
46
+ if (backgroundRef.current) {
47
+ setContainerWidthPx(backgroundRef.current.offsetWidth);
48
+ }
49
+ }, [containerWidth]);
34
50
  const component = /*#__PURE__*/_jsx(Background, {
35
- style: {
36
- width: containerWidth + "%"
37
- },
51
+ ref: backgroundRef,
52
+ containerWidth: containerWidth,
38
53
  ...props,
39
54
  "aria-label": ariaLabel,
40
55
  "aria-valuenow": fillWidth,
41
56
  "aria-valuemin": "0",
42
57
  "aria-valuemax": "100",
43
58
  children: /*#__PURE__*/_jsx(Fill, {
59
+ containerWidthPx: containerWidthPx,
44
60
  gradient: gradient,
45
- style: {
46
- width: fillWidth + "%"
47
- }
61
+ fillWidth: fillWidth
48
62
  })
49
63
  });
50
64
  return theme ? /*#__PURE__*/_jsx(ThemeProvider, {
@@ -69,21 +83,25 @@ ProgressBar.__docgenInfo = {
69
83
  "methods": [],
70
84
  "displayName": "ProgressBar",
71
85
  "props": {
72
- "ariaLabel": {
86
+ "containerWidth": {
73
87
  "defaultValue": {
74
- "value": "\"Progress\"",
88
+ "value": "\"100%\"",
75
89
  "computed": false
76
90
  },
77
- "description": "Specifies the aria-label for the progress bar",
91
+ "description": "Sets the percentage width of the parent container",
78
92
  "type": {
79
- "name": "object"
93
+ "name": "number"
80
94
  },
81
95
  "required": false
82
96
  },
83
- "containerWidth": {
84
- "description": "Sets the percentage width of the parent container",
97
+ "ariaLabel": {
98
+ "defaultValue": {
99
+ "value": "\"Progress\"",
100
+ "computed": false
101
+ },
102
+ "description": "Specifies the aria-label for the progress bar",
85
103
  "type": {
86
- "name": "number"
104
+ "name": "object"
87
105
  },
88
106
  "required": false
89
107
  },
@@ -68,6 +68,20 @@ export const withIcon = () => /*#__PURE__*/_jsx(Box, {
68
68
  children: /*#__PURE__*/_jsxs(Spacer, {
69
69
  m: "xxs",
70
70
  children: [/*#__PURE__*/_jsx(Popover, {
71
+ direction: "top",
72
+ text: "Additional info",
73
+ textAlign: "center",
74
+ width: "110px",
75
+ children: /*#__PURE__*/_jsx(StatusDot, {
76
+ icon: true,
77
+ children: /*#__PURE__*/_jsx(Icon, {
78
+ icon: ["fas", "question"],
79
+ color: "white",
80
+ size: "xs",
81
+ transform: "up-2"
82
+ })
83
+ })
84
+ }), /*#__PURE__*/_jsx(Popover, {
71
85
  direction: "top",
72
86
  text: "Target met",
73
87
  textAlign: "center",
@@ -18,18 +18,30 @@ const StatusDotItem = styled("div").withConfig({
18
18
  display: "flex",
19
19
  alignItems: "center",
20
20
  justifyContent: "center",
21
- lineHeight: "0"
21
+ lineHeight: "0",
22
+ svg: {
23
+ filter: props.icon ? "drop-shadow(0 1px 1px rgba(0,0,0,0.7))" : "none"
24
+ }
22
25
  }), props => variant({
23
26
  variants: {
24
27
  default: {},
25
28
  success: {
26
- bg: themeGet("colors.success")(props)
29
+ bg: themeGet("colors.success")(props),
30
+ svg: {
31
+ filter: props.icon ? "drop-shadow(0 1px 1px rgba(0,0,0,0.6))" : "none"
32
+ }
27
33
  },
28
34
  warning: {
29
- bg: themeGet("colors.warning")(props)
35
+ bg: themeGet("colors.warning")(props),
36
+ svg: {
37
+ filter: props.icon ? "drop-shadow(0 1px 1px rgba(147,101,0,1))" : "none"
38
+ }
30
39
  },
31
40
  danger: {
32
- bg: themeGet("colors.danger")(props)
41
+ bg: themeGet("colors.danger")(props),
42
+ svg: {
43
+ filter: props.icon ? "drop-shadow(0 1px 1px rgba(0,0,0,0.7))" : "none"
44
+ }
33
45
  }
34
46
  }
35
47
  }), StatusDotStyles);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orcs-design-system",
3
- "version": "3.2.9",
3
+ "version": "3.2.11",
4
4
  "engines": {
5
5
  "node": "20.12.2"
6
6
  },