@vention/machine-ui 6.9.0 → 6.10.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
@@ -115,6 +115,7 @@ Components built on an MUI component (noted as "built on MUI `X`") accept that c
115
115
  - With `onRename(index, name)`, clicking the selected tab opens an input over its label. Enter or leaving the input saves, Esc cancels. The name is trimmed, and `onRename` isn't called when it's empty or unchanged.
116
116
  - With `onRemove(index)`, each tab gets a remove button. It shows while the pointer is over the tab and while the tab has keyboard focus. Touch screens have no hover, so there it shows on the selected tab. It isn't rendered when only one tab is left. Removing doesn't change `value`, so pick the new selected tab in `onRemove`. Clicking it moves focus to that tab's label, or to the previous tab's label for the last tab, so once the parent drops the tab, focus is on the tab that took its place.
117
117
  - With `onAdd()`, an add button follows the tabs. Append the new tab to `tabOptions` in `onAdd`.
118
+ - `size` is `"medium"` (default) or `"small"`, which shows 16px names on tabs at least 100px wide.
118
119
  - `VentionSteps`: a vertical list of steps for a guided procedure. Use `size="xx-large"` on touch HMIs; `"small"` always shows dots.
119
120
  - `VentionSidebarItem`: a profile entry in a sidebar.
120
121
  - `VentionTreeItem`: one row of a tree, with nested `VentionTreeItem` children.
package/index.esm.js CHANGED
@@ -10987,6 +10987,7 @@ const VentionTabs = ({
10987
10987
  onRename,
10988
10988
  onRemove,
10989
10989
  onAdd,
10990
+ size: _size = "medium",
10990
10991
  value
10991
10992
  }) => {
10992
10993
  const theme = useTheme();
@@ -10994,6 +10995,7 @@ const VentionTabs = ({
10994
10995
  cx,
10995
10996
  classes
10996
10997
  } = useStyles$l();
10998
+ const isSmall = _size === "small";
10997
10999
  const canRemove = onRemove !== undefined && tabOptions.length > 1;
10998
11000
  const [editingIndex, setEditingIndex] = useState(null);
10999
11001
  const [draft, setDraft] = useState("");
@@ -11063,7 +11065,7 @@ const VentionTabs = ({
11063
11065
  const isSelected = index === value;
11064
11066
  const isEditing = index === editingIndex;
11065
11067
  return jsxs("div", {
11066
- className: cx(classes.tab, isSelected && classes.selectedTab),
11068
+ className: cx(classes.tab, isSmall && classes.smallTab, isSelected && classes.selectedTab),
11067
11069
  children: [jsx("button", {
11068
11070
  ref: labelButton => attachLabelButton(labelButton, index),
11069
11071
  className: cx(classes.label, isEditing && classes.hiddenLabel),
@@ -11072,13 +11074,13 @@ const VentionTabs = ({
11072
11074
  "aria-selected": isSelected,
11073
11075
  onClick: event => handleTabClick(event, index),
11074
11076
  children: jsx(Typography, {
11075
- variant: "heading18SemiBold",
11077
+ variant: isSmall ? "heading16SemiBold" : "heading18SemiBold",
11076
11078
  noWrap: true,
11077
11079
  children: tabLabel
11078
11080
  })
11079
11081
  }), isEditing && jsx("input", {
11080
11082
  ref: focusInputOnMount,
11081
- className: classes.input,
11083
+ className: cx(classes.input, isSmall && classes.smallInput),
11082
11084
  type: "text",
11083
11085
  "aria-label": "Tab name",
11084
11086
  value: draft,
@@ -11168,6 +11170,9 @@ const useStyles$l = tss.withNestedSelectors().create(({
11168
11170
  [`&:hover .${classes.removeControls}`]: shownRemoveControls
11169
11171
  }
11170
11172
  },
11173
+ smallTab: {
11174
+ minWidth: "100px"
11175
+ },
11171
11176
  selectedTab: {
11172
11177
  backgroundColor: theme.palette.background.default,
11173
11178
  boxShadow: theme.shadows[1],
@@ -11213,6 +11218,7 @@ const useStyles$l = tss.withNestedSelectors().create(({
11213
11218
  outline: "none",
11214
11219
  boxShadow: `0 0 0 3px ${alpha(theme.palette.border.blue, 0.18)}`
11215
11220
  }),
11221
+ smallInput: Object.assign({}, theme.typography.heading16SemiBold),
11216
11222
  removeControls: {
11217
11223
  flexShrink: 0,
11218
11224
  alignSelf: "stretch",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vention/machine-ui",
3
- "version": "6.9.0",
3
+ "version": "6.10.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/VentionCo/machine-cloud.git"
@@ -6,6 +6,7 @@ type VentionTabsProps = {
6
6
  onRename?: (index: number, name: string) => void;
7
7
  onRemove?: (index: number) => void;
8
8
  onAdd?: () => void;
9
+ size?: "small" | "medium";
9
10
  };
10
- export declare const VentionTabs: ({ tabOptions, onChange, onRename, onRemove, onAdd, value }: VentionTabsProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const VentionTabs: ({ tabOptions, onChange, onRename, onRemove, onAdd, size, value }: VentionTabsProps) => import("react/jsx-runtime").JSX.Element;
11
12
  export {};