@sproutsocial/seeds-react-progress 0.1.0 → 0.2.0

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.
@@ -8,14 +8,14 @@ $ tsup --dts
8
8
  CLI Cleaning output folder
9
9
  CJS Build start
10
10
  ESM Build start
11
- CJS dist/index.js 3.27 KB
12
- CJS dist/index.js.map 3.51 KB
13
- CJS ⚡️ Build success in 14ms
14
- ESM dist/esm/index.js 1.46 KB
15
- ESM dist/esm/index.js.map 3.41 KB
16
- ESM ⚡️ Build success in 14ms
11
+ CJS dist/index.js 3.31 KB
12
+ CJS dist/index.js.map 3.70 KB
13
+ CJS ⚡️ Build success in 111ms
14
+ ESM dist/esm/index.js 1.50 KB
15
+ ESM dist/esm/index.js.map 3.60 KB
16
+ ESM ⚡️ Build success in 112ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 3861ms
19
- DTS dist/index.d.ts 1.11 KB
20
- DTS dist/index.d.mts 1.11 KB
21
- Done in 4.84s.
18
+ DTS ⚡️ Build success in 7484ms
19
+ DTS dist/index.d.ts 1.25 KB
20
+ DTS dist/index.d.mts 1.25 KB
21
+ Done in 9.51s.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @sproutsocial/seeds-react-progress
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b3744f2: Add trackStyle prop to Progress component
8
+
9
+ This change adds a dedicated `trackStyle` prop for styling the track (background bar) of the Progress component, enabling cleaner separation of track and indicator styling.
10
+
11
+ **Key Changes:**
12
+
13
+ - Add `trackStyle` prop for styling the track (background bar)
14
+ - Remove generic `style` prop to eliminate API ambiguity
15
+ - Simplify implementation by removing complex prop merging logic
16
+ - Update tests, documentation, and Storybook stories
17
+
18
+ **Migration:**
19
+ This is technically a breaking change (removes `style` prop), but has zero impact on existing consumers - only 2 files in web-app-core use Progress, and neither uses the `style` prop.
20
+
21
+ **Benefits:**
22
+
23
+ - Clear, semantic API with dedicated props for track vs indicator styling
24
+ - Simpler implementation (no runtime merging overhead)
25
+ - Better TypeScript type safety
26
+ - Self-documenting code
27
+
28
+ Resolves GROWTH-1932
29
+
3
30
  ## 0.1.0
4
31
 
5
32
  ### Minor Changes
package/dist/esm/index.js CHANGED
@@ -31,6 +31,7 @@ var Progress2 = ({
31
31
  value,
32
32
  max = 100,
33
33
  getValueLabel,
34
+ trackStyle,
34
35
  indicatorStyle,
35
36
  ...rest
36
37
  }) => {
@@ -42,6 +43,7 @@ var Progress2 = ({
42
43
  max,
43
44
  getValueLabel,
44
45
  "data-qa-progress": "",
46
+ style: trackStyle,
45
47
  ...rest,
46
48
  children: /* @__PURE__ */ jsx(
47
49
  StyledIndicator,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Progress.tsx","../../src/styles.ts","../../src/ProgressTypes.ts","../../src/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport { StyledRoot, StyledIndicator } from \"./styles\";\nimport type { TypeProgressProps } from \"./ProgressTypes\";\n\nexport const Progress = ({\n value,\n max = 100,\n getValueLabel,\n indicatorStyle,\n ...rest\n}: TypeProgressProps) => {\n const percentage = max > 0 ? Math.min((value / max) * 100, 100) : 0;\n\n return (\n <StyledRoot\n value={value}\n max={max}\n getValueLabel={getValueLabel}\n data-qa-progress=\"\"\n {...rest}\n >\n <StyledIndicator\n style={{\n transform: `translateX(-${100 - percentage}%)`,\n ...indicatorStyle,\n }}\n />\n </StyledRoot>\n );\n};\n","import styled from \"styled-components\";\nimport * as Progress from \"@radix-ui/react-progress\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\n\nexport const StyledRoot = styled(Progress.Root).attrs({\n className: \"Progress\",\n})`\n position: relative;\n overflow: hidden;\n width: 100%;\n height: 8px;\n border-radius: ${(p) => p.theme.radii.outer};\n background-color: ${(p) => p.theme.colors.container.border.base};\n\n ${COMMON}\n`;\n\nexport const StyledIndicator = styled(Progress.Indicator)`\n height: 100%;\n width: 100%;\n border-radius: ${(p) => p.theme.radii.outer};\n background-color: ${(p) => p.theme.colors.icon.base};\n transition: transform 150ms ease;\n`;\n","import * as React from \"react\";\nimport type {\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\ntype TypeAriaLabel =\n | { \"aria-label\": string; \"aria-labelledby\"?: string }\n | { \"aria-label\"?: string; \"aria-labelledby\": string };\n\nexport type TypeProgressProps = TypeStyledComponentsCommonProps &\n TypeSystemCommonProps &\n Omit<React.ComponentPropsWithoutRef<\"div\">, \"color\"> &\n TypeAriaLabel & {\n /** The current progress value */\n value: number;\n /** The maximum progress value. Defaults to 100 */\n max?: number;\n /** A function to get the accessible label text representing the current value. Defaults to \"{value}%\" */\n getValueLabel?: (value: number, max: number) => string;\n /** Custom CSS for the indicator (fill) element, e.g. a gradient background */\n indicatorStyle?: React.CSSProperties;\n };\n","import { Progress } from \"./Progress\";\n\nexport default Progress;\nexport { Progress };\nexport * from \"./ProgressTypes\";\n"],"mappings":";AAAA,OAAuB;;;ACAvB,OAAO,YAAY;AACnB,YAAY,cAAc;AAC1B,SAAS,cAAc;AAEhB,IAAM,aAAa,OAAgB,aAAI,EAAE,MAAM;AAAA,EACpD,WAAW;AACb,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,mBAKkB,CAAC,MAAM,EAAE,MAAM,MAAM,KAAK;AAAA,sBACvB,CAAC,MAAM,EAAE,MAAM,OAAO,UAAU,OAAO,IAAI;AAAA;AAAA,IAE7D,MAAM;AAAA;AAGH,IAAM,kBAAkB,OAAgB,kBAAS;AAAA;AAAA;AAAA,mBAGrC,CAAC,MAAM,EAAE,MAAM,MAAM,KAAK;AAAA,sBACvB,CAAC,MAAM,EAAE,MAAM,OAAO,KAAK,IAAI;AAAA;AAAA;;;ADA/C;AAjBC,IAAMA,YAAW,CAAC;AAAA,EACvB;AAAA,EACA,MAAM;AAAA,EACN;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,QAAM,aAAa,MAAM,IAAI,KAAK,IAAK,QAAQ,MAAO,KAAK,GAAG,IAAI;AAElE,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,oBAAiB;AAAA,MAChB,GAAG;AAAA,MAEJ;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,YACL,WAAW,eAAe,MAAM,UAAU;AAAA,YAC1C,GAAG;AAAA,UACL;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;;;AE7BA,OAAuB;;;ACEvB,IAAO,gBAAQC;","names":["Progress","Progress"]}
1
+ {"version":3,"sources":["../../src/Progress.tsx","../../src/styles.ts","../../src/ProgressTypes.ts","../../src/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport { StyledRoot, StyledIndicator } from \"./styles\";\nimport type { TypeProgressProps } from \"./ProgressTypes\";\n\nexport const Progress = ({\n value,\n max = 100,\n getValueLabel,\n trackStyle,\n indicatorStyle,\n ...rest\n}: TypeProgressProps) => {\n const percentage = max > 0 ? Math.min((value / max) * 100, 100) : 0;\n\n return (\n <StyledRoot\n value={value}\n max={max}\n getValueLabel={getValueLabel}\n data-qa-progress=\"\"\n style={trackStyle}\n {...rest}\n >\n <StyledIndicator\n style={{\n transform: `translateX(-${100 - percentage}%)`,\n ...indicatorStyle,\n }}\n />\n </StyledRoot>\n );\n};\n","import styled from \"styled-components\";\nimport * as Progress from \"@radix-ui/react-progress\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\n\nexport const StyledRoot = styled(Progress.Root).attrs({\n className: \"Progress\",\n})`\n position: relative;\n overflow: hidden;\n width: 100%;\n height: 8px;\n border-radius: ${(p) => p.theme.radii.outer};\n background-color: ${(p) => p.theme.colors.container.border.base};\n\n ${COMMON}\n`;\n\nexport const StyledIndicator = styled(Progress.Indicator)`\n height: 100%;\n width: 100%;\n border-radius: ${(p) => p.theme.radii.outer};\n background-color: ${(p) => p.theme.colors.icon.base};\n transition: transform 150ms ease;\n`;\n","import * as React from \"react\";\nimport type {\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\ntype TypeAriaLabel =\n | { \"aria-label\": string; \"aria-labelledby\"?: string }\n | { \"aria-label\"?: string; \"aria-labelledby\": string };\n\nexport type TypeProgressProps = TypeStyledComponentsCommonProps &\n TypeSystemCommonProps &\n Omit<React.ComponentPropsWithoutRef<\"div\">, \"color\" | \"style\"> &\n TypeAriaLabel & {\n /** The current progress value */\n value: number;\n /** The maximum progress value. Defaults to 100 */\n max?: number;\n /** A function to get the accessible label text representing the current value. Defaults to \"{value}%\" */\n getValueLabel?: (value: number, max: number) => string;\n /** Custom CSS for the track (background) element, e.g. backgroundColor */\n trackStyle?: React.CSSProperties;\n /** Custom CSS for the indicator (fill) element, e.g. a gradient background */\n indicatorStyle?: React.CSSProperties;\n };\n","import { Progress } from \"./Progress\";\n\nexport default Progress;\nexport { Progress };\nexport * from \"./ProgressTypes\";\n"],"mappings":";AAAA,OAAuB;;;ACAvB,OAAO,YAAY;AACnB,YAAY,cAAc;AAC1B,SAAS,cAAc;AAEhB,IAAM,aAAa,OAAgB,aAAI,EAAE,MAAM;AAAA,EACpD,WAAW;AACb,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,mBAKkB,CAAC,MAAM,EAAE,MAAM,MAAM,KAAK;AAAA,sBACvB,CAAC,MAAM,EAAE,MAAM,OAAO,UAAU,OAAO,IAAI;AAAA;AAAA,IAE7D,MAAM;AAAA;AAGH,IAAM,kBAAkB,OAAgB,kBAAS;AAAA;AAAA;AAAA,mBAGrC,CAAC,MAAM,EAAE,MAAM,MAAM,KAAK;AAAA,sBACvB,CAAC,MAAM,EAAE,MAAM,OAAO,KAAK,IAAI;AAAA;AAAA;;;ADE/C;AAnBC,IAAMA,YAAW,CAAC;AAAA,EACvB;AAAA,EACA,MAAM;AAAA,EACN;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,QAAM,aAAa,MAAM,IAAI,KAAK,IAAK,QAAQ,MAAO,KAAK,GAAG,IAAI;AAElE,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,oBAAiB;AAAA,MACjB,OAAO;AAAA,MACN,GAAG;AAAA,MAEJ;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,YACL,WAAW,eAAe,MAAM,UAAU;AAAA,YAC1C,GAAG;AAAA,UACL;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;;;AE/BA,OAAuB;;;ACEvB,IAAO,gBAAQC;","names":["Progress","Progress"]}
package/dist/index.d.mts CHANGED
@@ -9,17 +9,19 @@ type TypeAriaLabel = {
9
9
  "aria-label"?: string;
10
10
  "aria-labelledby": string;
11
11
  };
12
- type TypeProgressProps = TypeStyledComponentsCommonProps & TypeSystemCommonProps & Omit<React.ComponentPropsWithoutRef<"div">, "color"> & TypeAriaLabel & {
12
+ type TypeProgressProps = TypeStyledComponentsCommonProps & TypeSystemCommonProps & Omit<React.ComponentPropsWithoutRef<"div">, "color" | "style"> & TypeAriaLabel & {
13
13
  /** The current progress value */
14
14
  value: number;
15
15
  /** The maximum progress value. Defaults to 100 */
16
16
  max?: number;
17
17
  /** A function to get the accessible label text representing the current value. Defaults to "{value}%" */
18
18
  getValueLabel?: (value: number, max: number) => string;
19
+ /** Custom CSS for the track (background) element, e.g. backgroundColor */
20
+ trackStyle?: React.CSSProperties;
19
21
  /** Custom CSS for the indicator (fill) element, e.g. a gradient background */
20
22
  indicatorStyle?: React.CSSProperties;
21
23
  };
22
24
 
23
- declare const Progress: ({ value, max, getValueLabel, indicatorStyle, ...rest }: TypeProgressProps) => react_jsx_runtime.JSX.Element;
25
+ declare const Progress: ({ value, max, getValueLabel, trackStyle, indicatorStyle, ...rest }: TypeProgressProps) => react_jsx_runtime.JSX.Element;
24
26
 
25
27
  export { Progress, type TypeProgressProps, Progress as default };
package/dist/index.d.ts CHANGED
@@ -9,17 +9,19 @@ type TypeAriaLabel = {
9
9
  "aria-label"?: string;
10
10
  "aria-labelledby": string;
11
11
  };
12
- type TypeProgressProps = TypeStyledComponentsCommonProps & TypeSystemCommonProps & Omit<React.ComponentPropsWithoutRef<"div">, "color"> & TypeAriaLabel & {
12
+ type TypeProgressProps = TypeStyledComponentsCommonProps & TypeSystemCommonProps & Omit<React.ComponentPropsWithoutRef<"div">, "color" | "style"> & TypeAriaLabel & {
13
13
  /** The current progress value */
14
14
  value: number;
15
15
  /** The maximum progress value. Defaults to 100 */
16
16
  max?: number;
17
17
  /** A function to get the accessible label text representing the current value. Defaults to "{value}%" */
18
18
  getValueLabel?: (value: number, max: number) => string;
19
+ /** Custom CSS for the track (background) element, e.g. backgroundColor */
20
+ trackStyle?: React.CSSProperties;
19
21
  /** Custom CSS for the indicator (fill) element, e.g. a gradient background */
20
22
  indicatorStyle?: React.CSSProperties;
21
23
  };
22
24
 
23
- declare const Progress: ({ value, max, getValueLabel, indicatorStyle, ...rest }: TypeProgressProps) => react_jsx_runtime.JSX.Element;
25
+ declare const Progress: ({ value, max, getValueLabel, trackStyle, indicatorStyle, ...rest }: TypeProgressProps) => react_jsx_runtime.JSX.Element;
24
26
 
25
27
  export { Progress, type TypeProgressProps, Progress as default };
package/dist/index.js CHANGED
@@ -68,6 +68,7 @@ var Progress2 = ({
68
68
  value,
69
69
  max = 100,
70
70
  getValueLabel,
71
+ trackStyle,
71
72
  indicatorStyle,
72
73
  ...rest
73
74
  }) => {
@@ -79,6 +80,7 @@ var Progress2 = ({
79
80
  max,
80
81
  getValueLabel,
81
82
  "data-qa-progress": "",
83
+ style: trackStyle,
82
84
  ...rest,
83
85
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
84
86
  StyledIndicator,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/Progress.tsx","../src/styles.ts","../src/ProgressTypes.ts"],"sourcesContent":["import { Progress } from \"./Progress\";\n\nexport default Progress;\nexport { Progress };\nexport * from \"./ProgressTypes\";\n","import * as React from \"react\";\nimport { StyledRoot, StyledIndicator } from \"./styles\";\nimport type { TypeProgressProps } from \"./ProgressTypes\";\n\nexport const Progress = ({\n value,\n max = 100,\n getValueLabel,\n indicatorStyle,\n ...rest\n}: TypeProgressProps) => {\n const percentage = max > 0 ? Math.min((value / max) * 100, 100) : 0;\n\n return (\n <StyledRoot\n value={value}\n max={max}\n getValueLabel={getValueLabel}\n data-qa-progress=\"\"\n {...rest}\n >\n <StyledIndicator\n style={{\n transform: `translateX(-${100 - percentage}%)`,\n ...indicatorStyle,\n }}\n />\n </StyledRoot>\n );\n};\n","import styled from \"styled-components\";\nimport * as Progress from \"@radix-ui/react-progress\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\n\nexport const StyledRoot = styled(Progress.Root).attrs({\n className: \"Progress\",\n})`\n position: relative;\n overflow: hidden;\n width: 100%;\n height: 8px;\n border-radius: ${(p) => p.theme.radii.outer};\n background-color: ${(p) => p.theme.colors.container.border.base};\n\n ${COMMON}\n`;\n\nexport const StyledIndicator = styled(Progress.Indicator)`\n height: 100%;\n width: 100%;\n border-radius: ${(p) => p.theme.radii.outer};\n background-color: ${(p) => p.theme.colors.icon.base};\n transition: transform 150ms ease;\n`;\n","import * as React from \"react\";\nimport type {\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\ntype TypeAriaLabel =\n | { \"aria-label\": string; \"aria-labelledby\"?: string }\n | { \"aria-label\"?: string; \"aria-labelledby\": string };\n\nexport type TypeProgressProps = TypeStyledComponentsCommonProps &\n TypeSystemCommonProps &\n Omit<React.ComponentPropsWithoutRef<\"div\">, \"color\"> &\n TypeAriaLabel & {\n /** The current progress value */\n value: number;\n /** The maximum progress value. Defaults to 100 */\n max?: number;\n /** A function to get the accessible label text representing the current value. Defaults to \"{value}%\" */\n getValueLabel?: (value: number, max: number) => string;\n /** Custom CSS for the indicator (fill) element, e.g. a gradient background */\n indicatorStyle?: React.CSSProperties;\n };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,kBAAAA;AAAA,EAAA;AAAA;AAAA;;;ACAA,YAAuB;;;ACAvB,+BAAmB;AACnB,eAA0B;AAC1B,sCAAuB;AAEhB,IAAM,iBAAa,yBAAAC,SAAgB,aAAI,EAAE,MAAM;AAAA,EACpD,WAAW;AACb,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,mBAKkB,CAAC,MAAM,EAAE,MAAM,MAAM,KAAK;AAAA,sBACvB,CAAC,MAAM,EAAE,MAAM,OAAO,UAAU,OAAO,IAAI;AAAA;AAAA,IAE7D,sCAAM;AAAA;AAGH,IAAM,sBAAkB,yBAAAA,SAAgB,kBAAS;AAAA;AAAA;AAAA,mBAGrC,CAAC,MAAM,EAAE,MAAM,MAAM,KAAK;AAAA,sBACvB,CAAC,MAAM,EAAE,MAAM,OAAO,KAAK,IAAI;AAAA;AAAA;;;ADA/C;AAjBC,IAAMC,YAAW,CAAC;AAAA,EACvB;AAAA,EACA,MAAM;AAAA,EACN;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,QAAM,aAAa,MAAM,IAAI,KAAK,IAAK,QAAQ,MAAO,KAAK,GAAG,IAAI;AAElE,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,oBAAiB;AAAA,MAChB,GAAG;AAAA,MAEJ;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,YACL,WAAW,eAAe,MAAM,UAAU;AAAA,YAC1C,GAAG;AAAA,UACL;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;;;AE7BA,IAAAC,SAAuB;;;AHEvB,IAAO,gBAAQC;","names":["Progress","styled","Progress","React","Progress"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/Progress.tsx","../src/styles.ts","../src/ProgressTypes.ts"],"sourcesContent":["import { Progress } from \"./Progress\";\n\nexport default Progress;\nexport { Progress };\nexport * from \"./ProgressTypes\";\n","import * as React from \"react\";\nimport { StyledRoot, StyledIndicator } from \"./styles\";\nimport type { TypeProgressProps } from \"./ProgressTypes\";\n\nexport const Progress = ({\n value,\n max = 100,\n getValueLabel,\n trackStyle,\n indicatorStyle,\n ...rest\n}: TypeProgressProps) => {\n const percentage = max > 0 ? Math.min((value / max) * 100, 100) : 0;\n\n return (\n <StyledRoot\n value={value}\n max={max}\n getValueLabel={getValueLabel}\n data-qa-progress=\"\"\n style={trackStyle}\n {...rest}\n >\n <StyledIndicator\n style={{\n transform: `translateX(-${100 - percentage}%)`,\n ...indicatorStyle,\n }}\n />\n </StyledRoot>\n );\n};\n","import styled from \"styled-components\";\nimport * as Progress from \"@radix-ui/react-progress\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\n\nexport const StyledRoot = styled(Progress.Root).attrs({\n className: \"Progress\",\n})`\n position: relative;\n overflow: hidden;\n width: 100%;\n height: 8px;\n border-radius: ${(p) => p.theme.radii.outer};\n background-color: ${(p) => p.theme.colors.container.border.base};\n\n ${COMMON}\n`;\n\nexport const StyledIndicator = styled(Progress.Indicator)`\n height: 100%;\n width: 100%;\n border-radius: ${(p) => p.theme.radii.outer};\n background-color: ${(p) => p.theme.colors.icon.base};\n transition: transform 150ms ease;\n`;\n","import * as React from \"react\";\nimport type {\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\ntype TypeAriaLabel =\n | { \"aria-label\": string; \"aria-labelledby\"?: string }\n | { \"aria-label\"?: string; \"aria-labelledby\": string };\n\nexport type TypeProgressProps = TypeStyledComponentsCommonProps &\n TypeSystemCommonProps &\n Omit<React.ComponentPropsWithoutRef<\"div\">, \"color\" | \"style\"> &\n TypeAriaLabel & {\n /** The current progress value */\n value: number;\n /** The maximum progress value. Defaults to 100 */\n max?: number;\n /** A function to get the accessible label text representing the current value. Defaults to \"{value}%\" */\n getValueLabel?: (value: number, max: number) => string;\n /** Custom CSS for the track (background) element, e.g. backgroundColor */\n trackStyle?: React.CSSProperties;\n /** Custom CSS for the indicator (fill) element, e.g. a gradient background */\n indicatorStyle?: React.CSSProperties;\n };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,kBAAAA;AAAA,EAAA;AAAA;AAAA;;;ACAA,YAAuB;;;ACAvB,+BAAmB;AACnB,eAA0B;AAC1B,sCAAuB;AAEhB,IAAM,iBAAa,yBAAAC,SAAgB,aAAI,EAAE,MAAM;AAAA,EACpD,WAAW;AACb,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,mBAKkB,CAAC,MAAM,EAAE,MAAM,MAAM,KAAK;AAAA,sBACvB,CAAC,MAAM,EAAE,MAAM,OAAO,UAAU,OAAO,IAAI;AAAA;AAAA,IAE7D,sCAAM;AAAA;AAGH,IAAM,sBAAkB,yBAAAA,SAAgB,kBAAS;AAAA;AAAA;AAAA,mBAGrC,CAAC,MAAM,EAAE,MAAM,MAAM,KAAK;AAAA,sBACvB,CAAC,MAAM,EAAE,MAAM,OAAO,KAAK,IAAI;AAAA;AAAA;;;ADE/C;AAnBC,IAAMC,YAAW,CAAC;AAAA,EACvB;AAAA,EACA,MAAM;AAAA,EACN;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,QAAM,aAAa,MAAM,IAAI,KAAK,IAAK,QAAQ,MAAO,KAAK,GAAG,IAAI;AAElE,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,oBAAiB;AAAA,MACjB,OAAO;AAAA,MACN,GAAG;AAAA,MAEJ;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,YACL,WAAW,eAAe,MAAM,UAAU;AAAA,YAC1C,GAAG;AAAA,UACL;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;;;AE/BA,IAAAC,SAAuB;;;AHEvB,IAAO,gBAAQC;","names":["Progress","styled","Progress","React","Progress"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sproutsocial/seeds-react-progress",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Seeds React Progress",
5
5
  "author": "Sprout Social, Inc.",
6
6
  "license": "MIT",
@@ -81,3 +81,18 @@ export const CustomGradient: Story = {
81
81
  },
82
82
  },
83
83
  };
84
+
85
+ export const CustomTrackAndIndicator: Story = {
86
+ args: {
87
+ value: 67,
88
+ "aria-label": "Progress",
89
+ trackStyle: {
90
+ backgroundColor: "#F59E0B",
91
+ },
92
+ indicatorStyle: {
93
+ backgroundColor: "#059669",
94
+ },
95
+ },
96
+ };
97
+
98
+ CustomTrackAndIndicator.storyName = "Custom Track and Indicator";
package/src/Progress.tsx CHANGED
@@ -6,6 +6,7 @@ export const Progress = ({
6
6
  value,
7
7
  max = 100,
8
8
  getValueLabel,
9
+ trackStyle,
9
10
  indicatorStyle,
10
11
  ...rest
11
12
  }: TypeProgressProps) => {
@@ -17,6 +18,7 @@ export const Progress = ({
17
18
  max={max}
18
19
  getValueLabel={getValueLabel}
19
20
  data-qa-progress=""
21
+ style={trackStyle}
20
22
  {...rest}
21
23
  >
22
24
  <StyledIndicator
@@ -10,7 +10,7 @@ type TypeAriaLabel =
10
10
 
11
11
  export type TypeProgressProps = TypeStyledComponentsCommonProps &
12
12
  TypeSystemCommonProps &
13
- Omit<React.ComponentPropsWithoutRef<"div">, "color"> &
13
+ Omit<React.ComponentPropsWithoutRef<"div">, "color" | "style"> &
14
14
  TypeAriaLabel & {
15
15
  /** The current progress value */
16
16
  value: number;
@@ -18,6 +18,8 @@ export type TypeProgressProps = TypeStyledComponentsCommonProps &
18
18
  max?: number;
19
19
  /** A function to get the accessible label text representing the current value. Defaults to "{value}%" */
20
20
  getValueLabel?: (value: number, max: number) => string;
21
+ /** Custom CSS for the track (background) element, e.g. backgroundColor */
22
+ trackStyle?: React.CSSProperties;
21
23
  /** Custom CSS for the indicator (fill) element, e.g. a gradient background */
22
24
  indicatorStyle?: React.CSSProperties;
23
25
  };
@@ -117,4 +117,17 @@ describe("Progress", () => {
117
117
  screen.getByRole("progressbar").closest("[data-qa-progress]")
118
118
  ).toBeTruthy();
119
119
  });
120
+
121
+ it("should apply trackStyle to the track", () => {
122
+ const { container } = render(
123
+ <Progress
124
+ value={50}
125
+ aria-label="Credits remaining"
126
+ trackStyle={{ backgroundColor: "red" }}
127
+ />
128
+ );
129
+
130
+ const track = container.querySelector(".Progress");
131
+ expect(track).toHaveStyle("background-color: red");
132
+ });
120
133
  });