@mackin.com/styleguide 10.1.5 → 10.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.
package/index.d.ts CHANGED
@@ -667,17 +667,22 @@ interface PopoverProps {
667
667
  declare const Popover: (p: PopoverProps) => React.JSX.Element;
668
668
 
669
669
  interface ProgressBarProps {
670
+ /** The value in whole pct - 55 NOT 0.55. */
670
671
  pct: number;
672
+ /** If `true`, the bar will be rounded at the corners. */
671
673
  round?: boolean;
674
+ /** If `true`, the current percent will be shown as a label. */
672
675
  showPct?: boolean;
676
+ /** Where to place the pct label from `showPct`. Defaults to `bottom`. Ignored if `showPct` is false. */
677
+ showPctPosition?: 'bottom' | 'right';
678
+ /** This will be applied to the bar. */
673
679
  className?: string;
680
+ /** This will be applied to the bar fill. Override this to change the transitions or remove them. */
681
+ barFillClassName?: string;
682
+ /** Applied to the percent label element. Ignored if `showPct` is false. */
683
+ pctLabelClassName?: string;
674
684
  }
675
- declare const ProgressBar: (props: {
676
- pct: number;
677
- round?: boolean;
678
- showPct?: boolean;
679
- className?: string;
680
- }) => React.JSX.Element;
685
+ declare const ProgressBar: (props: ProgressBarProps) => React.JSX.Element;
681
686
 
682
687
  type BaseProps$1 = Omit<TextInputProps, 'rightControl' | 'wrapperClassName' | 'type' | 'className'> & InputOnFocusProps;
683
688
  interface SearchBoxProps extends BaseProps$1 {
package/index.esm.js CHANGED
@@ -3665,6 +3665,7 @@ class ItemPager {
3665
3665
  }
3666
3666
 
3667
3667
  const ProgressBar = (props) => {
3668
+ var _a;
3668
3669
  const bar = React.useRef(null);
3669
3670
  React.useEffect(() => {
3670
3671
  const pct = cleanPct(props.pct);
@@ -3690,12 +3691,23 @@ const ProgressBar = (props) => {
3690
3691
  border-radius: 1rem;
3691
3692
  `}
3692
3693
  `;
3693
- return (React.createElement("div", { className: "progressBar" },
3694
+ const showPctPosition = (_a = props.showPctPosition) !== null && _a !== void 0 ? _a : 'bottom';
3695
+ const wrapStyles = css({
3696
+ label: 'ProgressBar',
3697
+ display: 'flex',
3698
+ flexDirection: showPctPosition === 'bottom' ? 'column' : 'row',
3699
+ alignItems: showPctPosition === 'right' ? 'center' : undefined,
3700
+ gap: showPctPosition === 'right' ? '0.5rem' : undefined,
3701
+ });
3702
+ const pctLabelStyles = (props.showPct && props.showPctPosition === 'right') ? css({
3703
+ width: '3rem'
3704
+ }) : undefined;
3705
+ return (React.createElement("div", { className: cx(wrapStyles, "progressBar") },
3694
3706
  React.createElement("div", { className: cx(barStyles, props.className) },
3695
- React.createElement("div", { ref: bar, className: fillStyles })),
3696
- props.showPct && React.createElement(Text, { align: "center", tag: "div", spacedOut: true },
3697
- props.pct,
3698
- "\u00A0%")));
3707
+ React.createElement("div", { ref: bar, className: cx(fillStyles, props.barFillClassName) })),
3708
+ props.showPct && (React.createElement(Text, { align: "center", tag: "div", spacedOut: true, className: cx(pctLabelStyles, props.pctLabelClassName) },
3709
+ cleanPct(props.pct),
3710
+ "%"))));
3699
3711
  };
3700
3712
  const cleanPct = (value) => {
3701
3713
  if (value) {
package/index.js CHANGED
@@ -3683,6 +3683,7 @@ class ItemPager {
3683
3683
  }
3684
3684
 
3685
3685
  const ProgressBar = (props) => {
3686
+ var _a;
3686
3687
  const bar = React__namespace.useRef(null);
3687
3688
  React__namespace.useEffect(() => {
3688
3689
  const pct = cleanPct(props.pct);
@@ -3708,12 +3709,23 @@ const ProgressBar = (props) => {
3708
3709
  border-radius: 1rem;
3709
3710
  `}
3710
3711
  `;
3711
- return (React__namespace.createElement("div", { className: "progressBar" },
3712
+ const showPctPosition = (_a = props.showPctPosition) !== null && _a !== void 0 ? _a : 'bottom';
3713
+ const wrapStyles = css.css({
3714
+ label: 'ProgressBar',
3715
+ display: 'flex',
3716
+ flexDirection: showPctPosition === 'bottom' ? 'column' : 'row',
3717
+ alignItems: showPctPosition === 'right' ? 'center' : undefined,
3718
+ gap: showPctPosition === 'right' ? '0.5rem' : undefined,
3719
+ });
3720
+ const pctLabelStyles = (props.showPct && props.showPctPosition === 'right') ? css.css({
3721
+ width: '3rem'
3722
+ }) : undefined;
3723
+ return (React__namespace.createElement("div", { className: css.cx(wrapStyles, "progressBar") },
3712
3724
  React__namespace.createElement("div", { className: css.cx(barStyles, props.className) },
3713
- React__namespace.createElement("div", { ref: bar, className: fillStyles })),
3714
- props.showPct && React__namespace.createElement(Text, { align: "center", tag: "div", spacedOut: true },
3715
- props.pct,
3716
- "\u00A0%")));
3725
+ React__namespace.createElement("div", { ref: bar, className: css.cx(fillStyles, props.barFillClassName) })),
3726
+ props.showPct && (React__namespace.createElement(Text, { align: "center", tag: "div", spacedOut: true, className: css.cx(pctLabelStyles, props.pctLabelClassName) },
3727
+ cleanPct(props.pct),
3728
+ "%"))));
3717
3729
  };
3718
3730
  const cleanPct = (value) => {
3719
3731
  if (value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mackin.com/styleguide",
3
- "version": "10.1.5",
3
+ "version": "10.2.0",
4
4
  "description": "",
5
5
  "main": "./index.js",
6
6
  "module": "./index.esm.js",