@vention/machine-apps-components 0.5.0 → 0.6.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.esm.js CHANGED
@@ -135,6 +135,16 @@ var enTranslations = {
135
135
  error: "Error"
136
136
  }
137
137
  },
138
+ pressButton: {
139
+ dispense: "Dispense",
140
+ dispensing: "Dispensing",
141
+ grip: "Grip",
142
+ gripping: "Gripping",
143
+ press: "Press",
144
+ pressing: "Pressing",
145
+ hold: "Hold",
146
+ holding: "Holding"
147
+ },
138
148
  productFormList: {
139
149
  add: "Add",
140
150
  cancel: "Cancel",
@@ -266,6 +276,16 @@ var frTranslations = {
266
276
  error: "Erreur"
267
277
  }
268
278
  },
279
+ pressButton: {
280
+ dispense: "Distribuer",
281
+ dispensing: "Distribution",
282
+ grip: "Saisir",
283
+ gripping: "Saisie",
284
+ press: "Appuyer",
285
+ pressing: "Appui",
286
+ hold: "Maintenir",
287
+ holding: "Maintien"
288
+ },
269
289
  productFormList: {
270
290
  add: "Ajouter",
271
291
  cancel: "Annuler",
@@ -397,6 +417,16 @@ var deTranslations = {
397
417
  error: "Fehler"
398
418
  }
399
419
  },
420
+ pressButton: {
421
+ dispense: "Dosieren",
422
+ dispensing: "Dosierung",
423
+ grip: "Greifen",
424
+ gripping: "Greifend",
425
+ press: "Drücken",
426
+ pressing: "Drückend",
427
+ hold: "Halten",
428
+ holding: "Haltend"
429
+ },
400
430
  productFormList: {
401
431
  add: "Hinzufügen",
402
432
  cancel: "Abbrechen",
@@ -528,6 +558,16 @@ var esTranslations = {
528
558
  error: "Error"
529
559
  }
530
560
  },
561
+ pressButton: {
562
+ dispense: "Dispensar",
563
+ dispensing: "Dispensando",
564
+ grip: "Agarrar",
565
+ gripping: "Agarrando",
566
+ press: "Presionar",
567
+ pressing: "Presionando",
568
+ hold: "Mantener",
569
+ holding: "Manteniendo"
570
+ },
531
571
  productFormList: {
532
572
  add: "Agregar",
533
573
  cancel: "Cancelar",
@@ -832,7 +872,7 @@ const I18nSettings = function I18nSettings({
832
872
  const {
833
873
  classes,
834
874
  cx
835
- } = useStyles$g({
875
+ } = useStyles$h({
836
876
  layout
837
877
  });
838
878
  const {
@@ -922,7 +962,7 @@ const I18nSettings = function I18nSettings({
922
962
  });
923
963
  };
924
964
  I18nSettings.displayName = "I18nSettings";
925
- const useStyles$g = tss.withParams().create(({
965
+ const useStyles$h = tss.withParams().create(({
926
966
  theme,
927
967
  layout
928
968
  }) => ({
@@ -1024,7 +1064,7 @@ const NavigationConfirmationModal = function NavigationConfirmationModal(props)
1024
1064
  } = props;
1025
1065
  const {
1026
1066
  classes
1027
- } = useStyles$f();
1067
+ } = useStyles$g();
1028
1068
  const {
1029
1069
  t
1030
1070
  } = useI18n();
@@ -1087,7 +1127,7 @@ const NavigationConfirmationModal = function NavigationConfirmationModal(props)
1087
1127
  })
1088
1128
  });
1089
1129
  };
1090
- const useStyles$f = tss.create(({
1130
+ const useStyles$g = tss.create(({
1091
1131
  theme
1092
1132
  }) => ({
1093
1133
  modalContent: {
@@ -1151,7 +1191,7 @@ const PasswordProtectionModal = function PasswordProtectionModal(props) {
1151
1191
  const [isKeyboardVisible, setIsKeyboardVisible] = useState(false);
1152
1192
  const {
1153
1193
  classes
1154
- } = useStyles$e();
1194
+ } = useStyles$f();
1155
1195
  const {
1156
1196
  t
1157
1197
  } = useI18n();
@@ -1275,7 +1315,7 @@ const PasswordProtectionModal = function PasswordProtectionModal(props) {
1275
1315
  })]
1276
1316
  });
1277
1317
  };
1278
- const useStyles$e = tss.create(({
1318
+ const useStyles$f = tss.create(({
1279
1319
  theme
1280
1320
  }) => ({
1281
1321
  modalContent: {
@@ -1347,7 +1387,7 @@ const NavigationBarItem = function NavigationBarItem(props) {
1347
1387
  const {
1348
1388
  classes,
1349
1389
  cx
1350
- } = useStyles$d();
1390
+ } = useStyles$e();
1351
1391
  const {
1352
1392
  t
1353
1393
  } = useI18n();
@@ -1380,7 +1420,7 @@ const NavigationBarItem = function NavigationBarItem(props) {
1380
1420
  })]
1381
1421
  });
1382
1422
  };
1383
- const useStyles$d = tss.create(({
1423
+ const useStyles$e = tss.create(({
1384
1424
  theme
1385
1425
  }) => ({
1386
1426
  tabButton: {
@@ -1451,7 +1491,7 @@ const NavigationBarRoot = function NavigationBarRoot(props) {
1451
1491
  const theme = useTheme();
1452
1492
  const {
1453
1493
  classes
1454
- } = useStyles$c({
1494
+ } = useStyles$d({
1455
1495
  variant
1456
1496
  });
1457
1497
  const {
@@ -1592,7 +1632,7 @@ const NavigationBarRoot = function NavigationBarRoot(props) {
1592
1632
  })]
1593
1633
  });
1594
1634
  };
1595
- const useStyles$c = tss.withParams().create(({
1635
+ const useStyles$d = tss.withParams().create(({
1596
1636
  theme,
1597
1637
  variant
1598
1638
  }) => ({
@@ -1702,7 +1742,7 @@ const StatusTopBarButton = function StatusTopBarButton(props) {
1702
1742
  } = props;
1703
1743
  const {
1704
1744
  classes
1705
- } = useStyles$b();
1745
+ } = useStyles$c();
1706
1746
  if (!visible) return null;
1707
1747
  const getFadedColor = function getFadedColor(color, opacity = 1) {
1708
1748
  return `${color}${Math.round(opacity * 255).toString(16).padStart(2, "0")}`;
@@ -1748,7 +1788,7 @@ const StatusTopBarButton = function StatusTopBarButton(props) {
1748
1788
  })
1749
1789
  });
1750
1790
  };
1751
- const useStyles$b = tss.create(({
1791
+ const useStyles$c = tss.create(({
1752
1792
  theme
1753
1793
  }) => ({
1754
1794
  actionButton: {
@@ -1784,7 +1824,7 @@ const StatusTopBarRoot = function StatusTopBarRoot(props) {
1784
1824
  } = props;
1785
1825
  const {
1786
1826
  classes
1787
- } = useStyles$a({
1827
+ } = useStyles$b({
1788
1828
  variant
1789
1829
  });
1790
1830
  const visibleButtons = buttonConfigs.filter(config => config.visible !== false);
@@ -1811,7 +1851,7 @@ const StatusTopBarRoot = function StatusTopBarRoot(props) {
1811
1851
  })]
1812
1852
  });
1813
1853
  };
1814
- const useStyles$a = tss.withParams().create(({
1854
+ const useStyles$b = tss.withParams().create(({
1815
1855
  theme,
1816
1856
  variant
1817
1857
  }) => ({
@@ -1860,7 +1900,7 @@ const Sidebar = function Sidebar(props) {
1860
1900
  } = props;
1861
1901
  const {
1862
1902
  classes
1863
- } = useStyles$9({
1903
+ } = useStyles$a({
1864
1904
  variant
1865
1905
  });
1866
1906
  return jsx(Box, {
@@ -1924,7 +1964,7 @@ const SidebarItemComponent = function SidebarItemComponent(props) {
1924
1964
  })
1925
1965
  });
1926
1966
  };
1927
- const useStyles$9 = tss.withParams().create(({
1967
+ const useStyles$a = tss.withParams().create(({
1928
1968
  theme,
1929
1969
  variant
1930
1970
  }) => ({
@@ -2049,7 +2089,7 @@ const LogsTable = memo(({
2049
2089
  const {
2050
2090
  classes,
2051
2091
  cx
2052
- } = useStyles$8({
2092
+ } = useStyles$9({
2053
2093
  tableHeight
2054
2094
  });
2055
2095
  const theme = useTheme();
@@ -2314,7 +2354,7 @@ const LogsTable = memo(({
2314
2354
  });
2315
2355
  });
2316
2356
  LogsTable.displayName = "LogsTable";
2317
- const useStyles$8 = tss.withParams().create(({
2357
+ const useStyles$9 = tss.withParams().create(({
2318
2358
  theme,
2319
2359
  tableHeight
2320
2360
  }) => ({
@@ -2428,7 +2468,7 @@ const LogFilterForm = memo(({
2428
2468
  var _a, _b, _c, _d;
2429
2469
  const {
2430
2470
  classes
2431
- } = useStyles$7();
2471
+ } = useStyles$8();
2432
2472
  const {
2433
2473
  t
2434
2474
  } = useI18n();
@@ -2565,7 +2605,7 @@ const LogFilterForm = memo(({
2565
2605
  });
2566
2606
  });
2567
2607
  LogFilterForm.displayName = "LogFilterForm";
2568
- const useStyles$7 = tss.create(({
2608
+ const useStyles$8 = tss.create(({
2569
2609
  theme
2570
2610
  }) => ({
2571
2611
  filterSection: {
@@ -2629,7 +2669,7 @@ const LogsPagination = memo(({
2629
2669
  }) => {
2630
2670
  const {
2631
2671
  classes
2632
- } = useStyles$6();
2672
+ } = useStyles$7();
2633
2673
  const {
2634
2674
  t
2635
2675
  } = useI18n();
@@ -2668,7 +2708,7 @@ const LogsPagination = memo(({
2668
2708
  });
2669
2709
  });
2670
2710
  LogsPagination.displayName = "LogsPagination";
2671
- const useStyles$6 = tss.create(({
2711
+ const useStyles$7 = tss.create(({
2672
2712
  theme
2673
2713
  }) => ({
2674
2714
  paginationSection: {
@@ -2719,7 +2759,7 @@ const LogsPanel = forwardRef((props, ref) => {
2719
2759
  const {
2720
2760
  classes,
2721
2761
  cx
2722
- } = useStyles$5();
2762
+ } = useStyles$6();
2723
2763
  const [logs, setLogs] = useState([]);
2724
2764
  const [isLoading, setIsLoading] = useState(true);
2725
2765
  const [error, setError] = useState(null);
@@ -2855,7 +2895,7 @@ const LogsPanel = forwardRef((props, ref) => {
2855
2895
  });
2856
2896
  });
2857
2897
  LogsPanel.displayName = "LogsPanel";
2858
- const useStyles$5 = tss.create(({
2898
+ const useStyles$6 = tss.create(({
2859
2899
  theme
2860
2900
  }) => ({
2861
2901
  root: {
@@ -2873,7 +2913,7 @@ const SettingsPage = function SettingsPage({
2873
2913
  }) {
2874
2914
  const {
2875
2915
  classes
2876
- } = useStyles$4({
2916
+ } = useStyles$5({
2877
2917
  sidebarWidth
2878
2918
  });
2879
2919
  return jsxs(Box, {
@@ -2890,7 +2930,7 @@ const SettingsPage = function SettingsPage({
2890
2930
  });
2891
2931
  };
2892
2932
  SettingsPage.displayName = "SettingsPage";
2893
- const useStyles$4 = tss.withParams().create(({
2933
+ const useStyles$5 = tss.withParams().create(({
2894
2934
  theme,
2895
2935
  sidebarWidth
2896
2936
  }) => ({
@@ -2936,7 +2976,7 @@ function FileUploadPanel({
2936
2976
  const {
2937
2977
  classes,
2938
2978
  cx
2939
- } = useStyles$3({
2979
+ } = useStyles$4({
2940
2980
  maxHeight
2941
2981
  });
2942
2982
  const {
@@ -2989,7 +3029,7 @@ function FileUploadPanel({
2989
3029
  });
2990
3030
  }
2991
3031
  FileUploadPanel.displayName = "FileUploadPanel";
2992
- const useStyles$3 = tss.withParams().create(({
3032
+ const useStyles$4 = tss.withParams().create(({
2993
3033
  theme,
2994
3034
  maxHeight
2995
3035
  }) => ({
@@ -3040,7 +3080,7 @@ function StepProgressCircle({
3040
3080
  const {
3041
3081
  classes,
3042
3082
  cx
3043
- } = useStyles$2({
3083
+ } = useStyles$3({
3044
3084
  size,
3045
3085
  strokeWidth,
3046
3086
  variant
@@ -3098,7 +3138,7 @@ function StepProgressCircle({
3098
3138
  });
3099
3139
  }
3100
3140
  StepProgressCircle.displayName = "StepProgressCircle";
3101
- const useStyles$2 = tss.withParams().create(({
3141
+ const useStyles$3 = tss.withParams().create(({
3102
3142
  theme,
3103
3143
  size,
3104
3144
  strokeWidth,
@@ -3168,7 +3208,7 @@ const ActionButton = function ActionButton({
3168
3208
  const {
3169
3209
  classes,
3170
3210
  cx
3171
- } = useStyles$1({
3211
+ } = useStyles$2({
3172
3212
  size
3173
3213
  });
3174
3214
  const {
@@ -3200,7 +3240,7 @@ const ActionButton = function ActionButton({
3200
3240
  });
3201
3241
  };
3202
3242
  ActionButton.displayName = "ActionButton";
3203
- const useStyles$1 = tss.withParams().create(({
3243
+ const useStyles$2 = tss.withParams().create(({
3204
3244
  theme,
3205
3245
  size
3206
3246
  }) => ({
@@ -3227,6 +3267,130 @@ const useStyles$1 = tss.withParams().create(({
3227
3267
  }
3228
3268
  }));
3229
3269
 
3270
+ const PressButton = function PressButton({
3271
+ onPress,
3272
+ onRelease,
3273
+ disabled = false,
3274
+ icon,
3275
+ label,
3276
+ activeLabel,
3277
+ size = 96,
3278
+ labelVariant = "uiText14SemiBold",
3279
+ className,
3280
+ sx
3281
+ }) {
3282
+ const [isPressed, setIsPressed] = useState(false);
3283
+ const isTouchActive = useRef(false);
3284
+ const {
3285
+ classes,
3286
+ cx
3287
+ } = useStyles$1({
3288
+ size
3289
+ });
3290
+ const {
3291
+ t
3292
+ } = useTranslation();
3293
+ const currentLabel = isPressed && activeLabel ? activeLabel : label;
3294
+ const translationKey = currentLabel.toLowerCase().replace(/\s+/g, "_");
3295
+ const translatedLabel = t(`pressButton.${translationKey}`, {
3296
+ defaultValue: currentLabel
3297
+ });
3298
+ function handlePress() {
3299
+ if (disabled) return;
3300
+ setIsPressed(true);
3301
+ onPress();
3302
+ }
3303
+ function handleRelease() {
3304
+ if (!isPressed) return;
3305
+ setIsPressed(false);
3306
+ onRelease();
3307
+ }
3308
+ function handleMouseDown() {
3309
+ if (isTouchActive.current) return;
3310
+ handlePress();
3311
+ }
3312
+ function handleMouseUp() {
3313
+ if (isTouchActive.current) return;
3314
+ handleRelease();
3315
+ }
3316
+ function handleMouseLeave() {
3317
+ if (isTouchActive.current) return;
3318
+ handleRelease();
3319
+ }
3320
+ function handleTouchStart(event) {
3321
+ event.preventDefault();
3322
+ isTouchActive.current = true;
3323
+ handlePress();
3324
+ }
3325
+ function handleTouchEnd(event) {
3326
+ event.preventDefault();
3327
+ handleRelease();
3328
+ setTimeout(() => {
3329
+ isTouchActive.current = false;
3330
+ }, 400);
3331
+ }
3332
+ return jsx(VentionIconButton, {
3333
+ disabled: disabled,
3334
+ size: "x-large",
3335
+ variant: "filled",
3336
+ className: cx(classes.button, isPressed && classes.buttonActive, className),
3337
+ sx: sx,
3338
+ "data-testid": "press-button",
3339
+ onMouseDown: handleMouseDown,
3340
+ onMouseUp: handleMouseUp,
3341
+ onMouseLeave: handleMouseLeave,
3342
+ onTouchStart: handleTouchStart,
3343
+ onTouchEnd: handleTouchEnd,
3344
+ onTouchCancel: handleTouchEnd,
3345
+ children: jsxs(Box, {
3346
+ className: classes.content,
3347
+ children: [jsx(Box, {
3348
+ className: classes.iconContainer,
3349
+ children: icon
3350
+ }), jsx(Typography, {
3351
+ variant: labelVariant,
3352
+ className: classes.label,
3353
+ children: translatedLabel
3354
+ })]
3355
+ })
3356
+ });
3357
+ };
3358
+ PressButton.displayName = "PressButton";
3359
+ const useStyles$1 = tss.withParams().create(({
3360
+ theme,
3361
+ size
3362
+ }) => ({
3363
+ button: {
3364
+ height: size,
3365
+ width: size,
3366
+ minWidth: size,
3367
+ padding: theme.spacing(2),
3368
+ transition: "border-color 0.2s ease, transform 0.1s ease",
3369
+ border: "3px solid transparent",
3370
+ "&:active": {
3371
+ transform: "scale(0.98)"
3372
+ }
3373
+ },
3374
+ buttonActive: {
3375
+ borderColor: theme.palette.primary.main
3376
+ },
3377
+ content: {
3378
+ display: "flex",
3379
+ flexDirection: "column",
3380
+ alignItems: "center",
3381
+ justifyContent: "center",
3382
+ gap: theme.spacing(1)
3383
+ },
3384
+ iconContainer: {
3385
+ display: "flex",
3386
+ alignItems: "center",
3387
+ justifyContent: "center"
3388
+ },
3389
+ label: {
3390
+ textAlign: "center"
3391
+ }
3392
+ }));
3393
+
3230
3394
  function useAutoScrollInput(enabled, options = {}) {
3231
3395
  const {
3232
3396
  targetPositionPercent = 25,
@@ -3682,4 +3846,4 @@ function getApiBaseUrl(options) {
3682
3846
  return getExecutionEngineHttpUrl(processName);
3683
3847
  }
3684
3848
 
3685
- export { ActionButton, FileUploadPanel, I18nProvider, I18nSettings, LogFilterForm, LogsPagination, LogsPanel, LogsTable, NavigationBar, NavigationConfirmationModal, PasswordProtectionModal, ProductFormList, SettingsPage, Sidebar, StatusTopBar, StepProgressCircle, TimeLabel, UserLevel, Z_INDEX, closeCustomUi, formatDateToInput, getApiBaseUrl, getAvailableTimezones, getLanguageDisplayName, getSupportedLanguages, hasSufficientLevel, isOnEdge, isTouchScreenDevice, navigateControlCenter, parseLogDate, useAutoScrollInput, useI18n };
3849
+ export { ActionButton, FileUploadPanel, I18nProvider, I18nSettings, LogFilterForm, LogsPagination, LogsPanel, LogsTable, NavigationBar, NavigationConfirmationModal, PasswordProtectionModal, PressButton, ProductFormList, SettingsPage, Sidebar, StatusTopBar, StepProgressCircle, TimeLabel, UserLevel, Z_INDEX, closeCustomUi, formatDateToInput, getApiBaseUrl, getAvailableTimezones, getLanguageDisplayName, getSupportedLanguages, hasSufficientLevel, isOnEdge, isTouchScreenDevice, navigateControlCenter, parseLogDate, useAutoScrollInput, useI18n };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vention/machine-apps-components",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/VentionCo/machine-cloud.git"
@@ -21,7 +21,7 @@
21
21
  "react": "17.0.2",
22
22
  "react-router-dom": "^6.0.0",
23
23
  "@mui/material": "^5.0.0",
24
- "@vention/machine-ui": "3.38.0"
24
+ "@vention/machine-ui": "^3.38.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@nx/vite": "21.1.3",
@@ -116,6 +116,16 @@ declare const _default: {
116
116
  error: string;
117
117
  };
118
118
  };
119
+ pressButton: {
120
+ dispense: string;
121
+ dispensing: string;
122
+ grip: string;
123
+ gripping: string;
124
+ press: string;
125
+ pressing: string;
126
+ hold: string;
127
+ holding: string;
128
+ };
119
129
  productFormList: {
120
130
  add: string;
121
131
  cancel: string;
@@ -116,6 +116,16 @@ declare const _default: {
116
116
  error: string;
117
117
  };
118
118
  };
119
+ pressButton: {
120
+ dispense: string;
121
+ dispensing: string;
122
+ grip: string;
123
+ gripping: string;
124
+ press: string;
125
+ pressing: string;
126
+ hold: string;
127
+ holding: string;
128
+ };
119
129
  productFormList: {
120
130
  add: string;
121
131
  cancel: string;
@@ -116,6 +116,16 @@ declare const _default: {
116
116
  error: string;
117
117
  };
118
118
  };
119
+ pressButton: {
120
+ dispense: string;
121
+ dispensing: string;
122
+ grip: string;
123
+ gripping: string;
124
+ press: string;
125
+ pressing: string;
126
+ hold: string;
127
+ holding: string;
128
+ };
119
129
  productFormList: {
120
130
  add: string;
121
131
  cancel: string;
@@ -116,6 +116,16 @@ declare const _default: {
116
116
  error: string;
117
117
  };
118
118
  };
119
+ pressButton: {
120
+ dispense: string;
121
+ dispensing: string;
122
+ grip: string;
123
+ gripping: string;
124
+ press: string;
125
+ pressing: string;
126
+ hold: string;
127
+ holding: string;
128
+ };
119
129
  productFormList: {
120
130
  add: string;
121
131
  cancel: string;
package/src/index.d.ts CHANGED
@@ -19,6 +19,7 @@ export * from "./lib/settings-page/settings-page";
19
19
  export * from "./lib/file-upload-panel/file-upload-panel";
20
20
  export * from "./lib/step-progress-circle/step-progress-circle";
21
21
  export * from "./lib/action-button/action-button";
22
+ export * from "./lib/press-button/press-button";
22
23
  export * from "./lib/product-form-list/product-form-list";
23
24
  export * from "./hooks/use-auto-scroll-input";
24
25
  export * from "./types/user-level";
@@ -0,0 +1,18 @@
1
+ import { ReactNode } from "react";
2
+ import { TypographyProps, SxProps, Theme } from "@mui/material";
3
+ export interface PressButtonProps {
4
+ onPress: () => void;
5
+ onRelease: () => void;
6
+ disabled?: boolean;
7
+ icon: ReactNode;
8
+ label: string;
9
+ activeLabel?: string;
10
+ size?: number;
11
+ labelVariant?: TypographyProps["variant"];
12
+ className?: string;
13
+ sx?: SxProps<Theme>;
14
+ }
15
+ export declare const PressButton: {
16
+ ({ onPress, onRelease, disabled, icon, label, activeLabel, size, labelVariant, className, sx, }: PressButtonProps): import("react/jsx-runtime").JSX.Element;
17
+ displayName: string;
18
+ };
@@ -0,0 +1,14 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { PressButton } from "./press-button";
3
+ declare const meta: Meta<typeof PressButton>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof PressButton>;
6
+ export declare const Default: Story;
7
+ export declare const WithActiveLabel: Story;
8
+ export declare const GripButton: Story;
9
+ export declare const Disabled: Story;
10
+ export declare const SmallSize: Story;
11
+ export declare const LargeSize: Story;
12
+ export declare const HmiLabelVariant: Story;
13
+ export declare const WithSxOverride: Story;
14
+ export declare const MachineControlExample: Story;