@vention/machine-ui 6.1.11 → 6.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/README.md CHANGED
@@ -94,7 +94,7 @@ Components built on an MUI component (noted as "built on MUI `X`") accept that c
94
94
  - `VentionProgressBar`: a horizontal progress bar. `value` runs from 0 to 100.
95
95
  - `VentionSpinner`: a circular progress indicator. With `type="progress"` it shows `value`, from 0 to 100.
96
96
  - `VentionSkeleton`: a loading placeholder. `variant` (`"text"`, `"rounded"` or `"circular"`) decides which other props it needs.
97
- - `VentionStatusDot`: a small colored dot. `color` takes any CSS color, such as a `COLORS` value.
97
+ - `VentionStatusDot`: a small colored dot. `dotColor` takes the same colors as `VentionBadge`: `"red"`, `"blue"`, `"green"`, `"yellow"` or `"slate"`. The older `color`, which takes any CSS color, is deprecated.
98
98
  - `VentionStatusIndicator`: a status dot with a text label, such as a machine state. Use `size="xx-large"` on touch HMIs.
99
99
  - `VentionBadge`: a small labeled tag. Pair the color with a text label, since color alone is hard to read on a shop floor.
100
100
  - `VentionTooltip`: a tooltip on hover or focus, built on MUI `Tooltip`. `placement` defaults to `"top-end"`. Hover does not exist on touch screens, so don't put information an operator needs only in a tooltip.
package/index.esm.js CHANGED
@@ -5957,6 +5957,93 @@ $$n({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
5957
5957
  }
5958
5958
  });
5959
5959
 
5960
+ const VentionStatusDot = props => {
5961
+ const {
5962
+ size = "small",
5963
+ borderWidth = 2,
5964
+ className
5965
+ } = props;
5966
+ const {
5967
+ classes,
5968
+ cx
5969
+ } = useStyles$J({
5970
+ dotColor: props.dotColor,
5971
+ color: props.color,
5972
+ borderColor: props.borderColor,
5973
+ borderWidth,
5974
+ size
5975
+ });
5976
+ return jsx("div", {
5977
+ className: cx(classes.root, className),
5978
+ "data-testid": "vention-status-dot",
5979
+ children: jsx("div", {
5980
+ className: classes.dot
5981
+ })
5982
+ });
5983
+ };
5984
+ const useStyles$J = tss.withParams().create(({
5985
+ dotColor,
5986
+ color,
5987
+ borderColor,
5988
+ borderWidth,
5989
+ size,
5990
+ theme
5991
+ }) => {
5992
+ const sizeMapping = {
5993
+ small: {
5994
+ rootSize: 16,
5995
+ dotSize: 8
5996
+ },
5997
+ medium: {
5998
+ rootSize: 24,
5999
+ dotSize: 12
6000
+ },
6001
+ "x-large": {
6002
+ rootSize: 28,
6003
+ dotSize: 14
6004
+ },
6005
+ "xx-large": {
6006
+ rootSize: 32,
6007
+ dotSize: 16
6008
+ }
6009
+ };
6010
+ const {
6011
+ rootSize,
6012
+ dotSize
6013
+ } = sizeMapping[size];
6014
+ return {
6015
+ root: {
6016
+ width: rootSize,
6017
+ height: rootSize,
6018
+ padding: rootSize / 4,
6019
+ display: "flex",
6020
+ alignItems: "center",
6021
+ justifyContent: "center"
6022
+ },
6023
+ dot: {
6024
+ width: dotSize,
6025
+ height: dotSize,
6026
+ background: dotColor ? getDotFillColor(dotColor, theme) : color,
6027
+ borderRadius: "50%",
6028
+ border: borderColor ? `${borderWidth}px solid ${borderColor}` : "none"
6029
+ }
6030
+ };
6031
+ });
6032
+ function getDotFillColor(dotColor, theme) {
6033
+ switch (dotColor) {
6034
+ case "red":
6035
+ return theme.palette.background.destructive;
6036
+ case "blue":
6037
+ return theme.palette.background.blue;
6038
+ case "green":
6039
+ return theme.palette.background.success;
6040
+ case "yellow":
6041
+ return theme.palette.background.warning;
6042
+ case "slate":
6043
+ return theme.palette.background.mutedSlate;
6044
+ }
6045
+ }
6046
+
5960
6047
  function VentionAvatar({
5961
6048
  initials,
5962
6049
  name,
@@ -5966,12 +6053,14 @@ function VentionAvatar({
5966
6053
  state = "default",
5967
6054
  className,
5968
6055
  imageUrl,
5969
- focused
6056
+ focused,
6057
+ statusDotColor
5970
6058
  }) {
5971
6059
  const {
5972
6060
  classes,
5973
- cx
5974
- } = useStyles$J({
6061
+ cx,
6062
+ theme
6063
+ } = useStyles$I({
5975
6064
  size,
5976
6065
  variant,
5977
6066
  color,
@@ -5994,10 +6083,14 @@ function VentionAvatar({
5994
6083
  }), focused && jsx("div", {
5995
6084
  className: classes.focusBorder,
5996
6085
  "data-testid": "vention-avatar-focus-border"
5997
- })]
6086
+ }), statusDotColor && jsx(VentionStatusDot, Object.assign({}, getStatusDot(size), {
6087
+ dotColor: statusDotColor,
6088
+ borderColor: theme.palette.border.white,
6089
+ className: classes.statusDot
6090
+ }))]
5998
6091
  });
5999
6092
  }
6000
- const useStyles$J = tss.withParams().create(({
6093
+ const useStyles$I = tss.withParams().create(({
6001
6094
  size,
6002
6095
  variant,
6003
6096
  color,
@@ -6006,6 +6099,9 @@ const useStyles$J = tss.withParams().create(({
6006
6099
  }) => {
6007
6100
  const diameter = getAvatarDiameter(size);
6008
6101
  const focusInset = getAvatarFocusInset(size);
6102
+ const {
6103
+ borderWidth: ringWidth
6104
+ } = getStatusDot(size);
6009
6105
  const {
6010
6106
  background,
6011
6107
  borderColor,
@@ -6044,6 +6140,14 @@ const useStyles$J = tss.withParams().create(({
6044
6140
  inset: focusInset,
6045
6141
  border: `2px solid ${COLORS.blue[400]}`,
6046
6142
  borderRadius: "50%"
6143
+ },
6144
+ statusDot: {
6145
+ position: "absolute",
6146
+ top: -ringWidth,
6147
+ right: -ringWidth,
6148
+ padding: 0,
6149
+ width: "auto",
6150
+ height: "auto"
6047
6151
  }
6048
6152
  };
6049
6153
  });
@@ -6065,6 +6169,25 @@ function getAvatarFocusInset(size) {
6065
6169
  return -1.5;
6066
6170
  }
6067
6171
  }
6172
+ function getStatusDot(size) {
6173
+ switch (size) {
6174
+ case "large":
6175
+ return {
6176
+ size: "medium",
6177
+ borderWidth: 2
6178
+ };
6179
+ case "medium":
6180
+ return {
6181
+ size: "small",
6182
+ borderWidth: 1
6183
+ };
6184
+ case "small":
6185
+ return {
6186
+ size: "small",
6187
+ borderWidth: 1
6188
+ };
6189
+ }
6190
+ }
6068
6191
  function getInitialsTypographyVariant(size) {
6069
6192
  switch (size) {
6070
6193
  case "large":
@@ -6112,7 +6235,7 @@ const VentionBadge = props => {
6112
6235
  const {
6113
6236
  classes,
6114
6237
  cx
6115
- } = useStyles$I({
6238
+ } = useStyles$H({
6116
6239
  size: props.size,
6117
6240
  color: props.color,
6118
6241
  variant: props.variant,
@@ -6133,7 +6256,7 @@ const VentionBadge = props => {
6133
6256
  })]
6134
6257
  });
6135
6258
  };
6136
- const useStyles$I = tss.withParams().create(({
6259
+ const useStyles$H = tss.withParams().create(({
6137
6260
  size,
6138
6261
  color,
6139
6262
  variant,
@@ -6309,7 +6432,7 @@ const VentionIconButton = /*#__PURE__*/forwardRef((inputProps, ref) => {
6309
6432
  const {
6310
6433
  classes,
6311
6434
  cx
6312
- } = useStyles$H({
6435
+ } = useStyles$G({
6313
6436
  variant: variant,
6314
6437
  size: size
6315
6438
  });
@@ -6324,7 +6447,7 @@ const VentionIconButton = /*#__PURE__*/forwardRef((inputProps, ref) => {
6324
6447
  }));
6325
6448
  });
6326
6449
  VentionIconButton.displayName = "VentionIconButton";
6327
- const useStyles$H = tss.withParams().create(({
6450
+ const useStyles$G = tss.withParams().create(({
6328
6451
  variant,
6329
6452
  size,
6330
6453
  theme
@@ -6381,7 +6504,7 @@ const VentionDropdownButton = _a => {
6381
6504
  const {
6382
6505
  classes,
6383
6506
  cx
6384
- } = useStyles$G({
6507
+ } = useStyles$F({
6385
6508
  variant,
6386
6509
  size,
6387
6510
  contentColor,
@@ -6444,7 +6567,7 @@ const VentionDropdownButton = _a => {
6444
6567
  })
6445
6568
  });
6446
6569
  };
6447
- const useStyles$G = tss.withParams().create(({
6570
+ const useStyles$F = tss.withParams().create(({
6448
6571
  variant,
6449
6572
  size,
6450
6573
  contentColor,
@@ -6556,7 +6679,7 @@ const VentionCallout = inputProps => {
6556
6679
  const calloutProps = applyDefaultProps(inputProps, defaultProps$6);
6557
6680
  const {
6558
6681
  classes
6559
- } = useStyles$F({
6682
+ } = useStyles$E({
6560
6683
  isSingleLine: calloutProps.isSingleLine,
6561
6684
  variant: calloutProps.variant,
6562
6685
  size: calloutProps.size
@@ -6678,7 +6801,7 @@ function getBottomMarginForDescription(isSingleLine, size) {
6678
6801
  }
6679
6802
  return "16px";
6680
6803
  }
6681
- const useStyles$F = tss.withParams().create(({
6804
+ const useStyles$E = tss.withParams().create(({
6682
6805
  isSingleLine,
6683
6806
  variant,
6684
6807
  size,
@@ -6736,7 +6859,7 @@ if (NOT_GENERIC || INCORRECT_NAME) {
6736
6859
  const VentionCounter = props => {
6737
6860
  const {
6738
6861
  classes
6739
- } = useStyles$E({
6862
+ } = useStyles$D({
6740
6863
  size: props.size,
6741
6864
  color: props.color,
6742
6865
  variant: props.variant
@@ -6759,7 +6882,7 @@ const getShownValue = props => {
6759
6882
  const displayCap = size === "small" ? 9 : 99;
6760
6883
  return value > displayCap ? `${displayCap}+` : value.toString();
6761
6884
  };
6762
- const useStyles$E = tss.withParams().create(({
6885
+ const useStyles$D = tss.withParams().create(({
6763
6886
  size,
6764
6887
  color,
6765
6888
  variant,
@@ -6909,7 +7032,7 @@ const VentionModalBase = props => {
6909
7032
  const {
6910
7033
  classes,
6911
7034
  cx
6912
- } = useStyles$D({
7035
+ } = useStyles$C({
6913
7036
  modalSize,
6914
7037
  isTouchDevice,
6915
7038
  width
@@ -6987,7 +7110,7 @@ const getModalStyle = (modalSize, width) => {
6987
7110
  };
6988
7111
  return modalStyles[modalSize];
6989
7112
  };
6990
- const useStyles$D = tss.withParams().create(({
7113
+ const useStyles$C = tss.withParams().create(({
6991
7114
  modalSize,
6992
7115
  isTouchDevice,
6993
7116
  width,
@@ -7056,7 +7179,7 @@ const VentionModal = props => {
7056
7179
  } = props;
7057
7180
  const {
7058
7181
  classes
7059
- } = useStyles$C({
7182
+ } = useStyles$B({
7060
7183
  modalSize,
7061
7184
  isTouchDevice,
7062
7185
  type,
@@ -7134,7 +7257,7 @@ const VentionModal = props => {
7134
7257
  })
7135
7258
  });
7136
7259
  };
7137
- const useStyles$C = tss.withParams().create(({
7260
+ const useStyles$B = tss.withParams().create(({
7138
7261
  type,
7139
7262
  modalSize,
7140
7263
  isTouchDevice,
@@ -7276,7 +7399,7 @@ const VentionProgressBar = inputProps => {
7276
7399
  const isStatusState = props.state === "error" || props.state === "success";
7277
7400
  const {
7278
7401
  classes
7279
- } = useStyles$B({
7402
+ } = useStyles$A({
7280
7403
  size: props.size,
7281
7404
  colored: props.colored,
7282
7405
  state: props.state
@@ -7314,7 +7437,7 @@ const VentionProgressBar = inputProps => {
7314
7437
  })]
7315
7438
  });
7316
7439
  };
7317
- const useStyles$B = tss.withParams().create(({
7440
+ const useStyles$A = tss.withParams().create(({
7318
7441
  size,
7319
7442
  colored,
7320
7443
  state,
@@ -7383,7 +7506,7 @@ function VentionSkeleton(props) {
7383
7506
  const {
7384
7507
  classes,
7385
7508
  cx
7386
- } = useStyles$A({
7509
+ } = useStyles$z({
7387
7510
  typography: props.variant === "text" ? props.typography : undefined
7388
7511
  });
7389
7512
  const className = cx(classes.root, props.className);
@@ -7416,7 +7539,7 @@ function VentionSkeleton(props) {
7416
7539
  "data-testid": testId
7417
7540
  });
7418
7541
  }
7419
- const useStyles$A = tss.withParams().create(({
7542
+ const useStyles$z = tss.withParams().create(({
7420
7543
  theme,
7421
7544
  typography
7422
7545
  }) => ({
@@ -7695,7 +7818,7 @@ const VentionSteps = props => {
7695
7818
  const {
7696
7819
  classes,
7697
7820
  cx
7698
- } = useStyles$z(props);
7821
+ } = useStyles$y(props);
7699
7822
  const typographyVariants = getTypographyVariants$1(props.size);
7700
7823
  let variant = props.variant;
7701
7824
  if (props.size === "small" && variant === "number") {
@@ -7748,7 +7871,7 @@ const VentionSteps = props => {
7748
7871
  })
7749
7872
  });
7750
7873
  };
7751
- const useStyles$z = tss.withParams().withNestedSelectors().create(({
7874
+ const useStyles$y = tss.withParams().withNestedSelectors().create(({
7752
7875
  theme,
7753
7876
  size,
7754
7877
  classes
@@ -7929,72 +8052,6 @@ const VARIABLE_SIZES = {
7929
8052
  }
7930
8053
  };
7931
8054
 
7932
- const VentionStatusDot = props => {
7933
- const {
7934
- size = "small",
7935
- className
7936
- } = props;
7937
- const {
7938
- classes,
7939
- cx
7940
- } = useStyles$y({
7941
- color: props.color,
7942
- borderColor: props.borderColor,
7943
- size
7944
- });
7945
- return jsx("div", {
7946
- className: cx(classes.root, className),
7947
- children: jsx("div", {
7948
- className: classes.dot
7949
- })
7950
- });
7951
- };
7952
- const useStyles$y = tss.withParams().create(({
7953
- color,
7954
- borderColor,
7955
- size
7956
- }) => {
7957
- const sizeMapping = {
7958
- small: {
7959
- rootSize: 16,
7960
- dotSize: 8
7961
- },
7962
- medium: {
7963
- rootSize: 24,
7964
- dotSize: 12
7965
- },
7966
- "x-large": {
7967
- rootSize: 28,
7968
- dotSize: 14
7969
- },
7970
- "xx-large": {
7971
- rootSize: 32,
7972
- dotSize: 16
7973
- }
7974
- };
7975
- const {
7976
- rootSize,
7977
- dotSize
7978
- } = sizeMapping[size];
7979
- return {
7980
- root: {
7981
- width: rootSize,
7982
- height: rootSize,
7983
- padding: rootSize / 4,
7984
- display: "flex",
7985
- alignItems: "center",
7986
- justifyContent: "center"
7987
- },
7988
- dot: {
7989
- width: dotSize,
7990
- height: dotSize,
7991
- background: color,
7992
- borderRadius: "50%",
7993
- border: borderColor ? `2px solid ${borderColor}` : "none"
7994
- }
7995
- };
7996
- });
7997
-
7998
8055
  const VentionTextInput = _a => {
7999
8056
  var {
8000
8057
  state = "default",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vention/machine-ui",
3
- "version": "6.1.11",
3
+ "version": "6.2.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/VentionCo/machine-cloud.git"
@@ -1,4 +1,5 @@
1
1
  import { Sizes, StrictExtract } from "../../theme/machine-ui-theme";
2
+ import { VentionStatusDotColors } from "../vention-status-dot/vention-status-dot";
2
3
  export type VentionAvatarSizes = StrictExtract<Sizes, "small" | "medium" | "large">;
3
4
  export type VentionAvatarVariants = "image" | "initials-filled" | "initials-subtle";
4
5
  export type VentionAvatarColors = "grayscale";
@@ -12,7 +13,8 @@ export interface VentionAvatarProps {
12
13
  imageUrl?: string;
13
14
  initials?: string;
14
15
  focused?: boolean;
16
+ statusDotColor?: VentionStatusDotColors;
15
17
  className?: string;
16
18
  }
17
- export declare function VentionAvatar({ initials, name, size, variant, color, state, className, imageUrl, focused, }: VentionAvatarProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare function VentionAvatar({ initials, name, size, variant, color, state, className, imageUrl, focused, statusDotColor, }: VentionAvatarProps): import("react/jsx-runtime").JSX.Element;
18
20
  export declare function getAvatarDiameter(size: VentionAvatarSizes): number;
@@ -1,10 +1,19 @@
1
1
  import { Sizes, StrictExtract } from "../../theme/machine-ui-theme";
2
2
  import React from "react";
3
- export interface VentionStatusDotProps {
4
- color: string;
5
- borderColor?: string;
3
+ export type VentionStatusDotColors = "red" | "blue" | "green" | "yellow" | "slate";
4
+ type VentionStatusDotBorderProps = {
5
+ borderColor: string;
6
+ borderWidth?: number;
7
+ } | {
8
+ borderColor?: undefined;
9
+ borderWidth?: undefined;
10
+ };
11
+ export type VentionStatusDotProps = VentionStatusDotBorderProps & {
12
+ dotColor?: VentionStatusDotColors;
13
+ /** @deprecated Use `dotColor` instead. */
14
+ color?: string;
6
15
  size?: StrictExtract<Sizes, "small" | "medium" | "x-large" | "xx-large">;
7
16
  className?: string;
8
- }
17
+ };
9
18
  export declare const VentionStatusDot: React.FunctionComponent<VentionStatusDotProps>;
10
19
  export default VentionStatusDot;