sevago-library 1.7.7 → 1.7.8

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.
Files changed (24) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +2 -0
  3. package/dist/index.cjs.js +83 -83
  4. package/dist/index.esm.js +11751 -11158
  5. package/dist/src/components/elements/floating-action-hub/floating-action-hub.element.stories.d.ts +1 -0
  6. package/dist/src/components/elements/floating-action-hub/floating-action-hub.interface.d.ts +4 -0
  7. package/dist/src/components/elements/floating-tools/elements/floating-scale-history.element.d.ts +8 -0
  8. package/dist/src/components/elements/floating-tools/floating-scale-panel.element.d.ts +2 -0
  9. package/dist/src/components/elements/floating-tools/floating-scale.constant.d.ts +58 -0
  10. package/dist/src/components/elements/floating-tools/floating-scale.enum.d.ts +16 -0
  11. package/dist/src/components/elements/floating-tools/floating-scale.interface.d.ts +58 -0
  12. package/dist/src/components/elements/floating-tools/floating-scale.util.d.ts +3 -0
  13. package/dist/src/components/elements/floating-tools/floating-tools.argtypes.d.ts +3 -0
  14. package/dist/src/components/elements/floating-tools/floating-tools.element.d.ts +2 -0
  15. package/dist/src/components/elements/floating-tools/floating-tools.element.stories.d.ts +6 -0
  16. package/dist/src/components/elements/floating-tools/index.d.ts +1 -0
  17. package/dist/src/components/elements/floating-tools/use-floating-scale.hook.d.ts +2 -0
  18. package/dist/src/components/elements/text-field/text-field-weight-number.element.d.ts +4 -0
  19. package/dist/src/components/elements/text-field/text-field-weight-number.element.stories.d.ts +1 -1
  20. package/dist/src/components/web-serial-scale/web-serial-scale.enum.d.ts +5 -0
  21. package/dist/src/components/web-serial-scale/web-serial-scale.interface.d.ts +25 -1
  22. package/package.json +1 -1
  23. package/dist/src/components/web-serial-scale/web-serial-scale.argtypes.d.ts +0 -3
  24. package/dist/src/components/web-serial-scale/web-serial-scale.stories.d.ts +0 -9
@@ -4,3 +4,4 @@ declare const meta: Meta<typeof FloatingActionHubElement>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof FloatingActionHubElement>;
6
6
  export declare const Default: Story;
7
+ export declare const PersistentBadge: Story;
@@ -1,5 +1,9 @@
1
1
  import { SxProps, Theme } from '@mui/material';
2
+ import { ReactNode } from 'react';
2
3
  export interface FloatingActionHubItem {
4
+ alwaysVisible?: boolean;
5
+ badgeContent?: ReactNode;
6
+ badgeLabel?: string;
3
7
  backgroundColor?: string;
4
8
  color?: string;
5
9
  disabled?: boolean;
@@ -0,0 +1,8 @@
1
+ import { FLOATING_SCALE_LABELS } from '../floating-scale.constant';
2
+ import { UseFloatingScaleResult } from '../floating-scale.interface';
3
+ interface FloatingScaleHistoryProps extends Pick<UseFloatingScaleResult, 'drops' | 'total' | 'applying' | 'removeDrop'> {
4
+ unit: string;
5
+ labels: typeof FLOATING_SCALE_LABELS;
6
+ }
7
+ export declare const FloatingScaleHistory: ({ drops, total, unit, applying, removeDrop, labels, }: FloatingScaleHistoryProps) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,2 @@
1
+ import { FloatingScalePanelProps } from './floating-scale.interface';
2
+ export declare const FloatingScalePanel: ({ state, open, onClose, onDisconnect, onConnect, options, }: FloatingScalePanelProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,58 @@
1
+ import { FloatingScaleConfig } from './floating-scale.interface';
2
+ import { Theme } from '@mui/material';
3
+ export declare const FLOATING_SCALE_LABELS: {
4
+ title: string;
5
+ single: string;
6
+ accumulated: string;
7
+ connected: string;
8
+ disconnected: string;
9
+ connecting: string;
10
+ disconnecting: string;
11
+ connect: string;
12
+ disconnect: string;
13
+ removeLoad: string;
14
+ liveWeight: string;
15
+ target: string;
16
+ noTarget: string;
17
+ capture: string;
18
+ apply: string;
19
+ reset: string;
20
+ empty: string;
21
+ total: string;
22
+ drop: string;
23
+ dropCount: string;
24
+ maximum: string;
25
+ minimize: string;
26
+ expand: string;
27
+ close: string;
28
+ remove: string;
29
+ missingProvider: string;
30
+ unsupported: string;
31
+ applied: string;
32
+ applyError: string;
33
+ waiting: string;
34
+ moving: string;
35
+ stable: string;
36
+ stale: string;
37
+ overload: string;
38
+ invalid: string;
39
+ negative: string;
40
+ configError: string;
41
+ };
42
+ export declare const FLOATING_SCALE_DEFAULTS: FloatingScaleConfig;
43
+ export declare const FLOATING_SCALE_PANEL_SX: {
44
+ readonly position: "fixed";
45
+ readonly right: "16px";
46
+ readonly bottom: 88;
47
+ readonly width: 360;
48
+ readonly maxWidth: "calc(100vw - 2 * 16px)";
49
+ readonly maxHeight: "calc(100dvh - 112px)";
50
+ readonly overflow: "hidden";
51
+ readonly zIndex: (theme: Theme) => number;
52
+ readonly padding: "16px";
53
+ readonly gap: "8px";
54
+ readonly backgroundColor: string;
55
+ readonly border: `1px solid ${string}`;
56
+ readonly borderRadius: "12px";
57
+ readonly boxShadow: "0 4px 20px rgba(0, 0, 0, 0.12)";
58
+ };
@@ -0,0 +1,16 @@
1
+ export declare enum FloatingScaleReadingStatus {
2
+ Waiting = "waiting",
3
+ Moving = "moving",
4
+ Stable = "stable",
5
+ Stale = "stale",
6
+ Overload = "overload",
7
+ Invalid = "invalid",
8
+ Negative = "negative",
9
+ ConfigError = "configError"
10
+ }
11
+ export declare enum FloatingScaleFeedback {
12
+ Applied = "applied",
13
+ ApplyError = "applyError"
14
+ }
15
+ export declare const FloatingScaleReadingStatusTitle: Record<FloatingScaleReadingStatus, string>;
16
+ export declare const FloatingScaleFeedbackTitle: Record<FloatingScaleFeedback, string>;
@@ -0,0 +1,58 @@
1
+ import { WebSerialScaleMode, WebSerialScaleReading, WebSerialScaleSharedContextValue, WebSerialScaleWeighingAudit } from '../../web-serial-scale';
2
+ import { FloatingScaleFeedback, FloatingScaleReadingStatus } from './floating-scale.enum';
3
+ export interface FloatingScaleConfig {
4
+ unit: string;
5
+ maxWeight: number;
6
+ stableDurationMs: number;
7
+ stableTolerance: number;
8
+ staleAfterMs: number;
9
+ }
10
+ export interface FloatingScaleOptions {
11
+ /** Readings and all thresholds must use this same unit. No unit conversion is performed. */
12
+ unit?: string;
13
+ maxWeight?: number;
14
+ stableDurationMs?: number;
15
+ stableTolerance?: number;
16
+ staleAfterMs?: number;
17
+ deviceId?: string;
18
+ deviceLabel?: string;
19
+ operatorId?: string;
20
+ labels?: Partial<typeof import('./floating-scale.constant').FLOATING_SCALE_LABELS>;
21
+ onApply?: (audit: WebSerialScaleWeighingAudit) => void | Promise<void>;
22
+ }
23
+ export interface FloatingScaleDrop {
24
+ id: number;
25
+ units: bigint;
26
+ reading: WebSerialScaleReading;
27
+ }
28
+ export interface FloatingScaleSample {
29
+ value: number;
30
+ time: number;
31
+ }
32
+ export interface UseFloatingScaleResult {
33
+ scale?: WebSerialScaleSharedContextValue;
34
+ config: FloatingScaleConfig;
35
+ mode: WebSerialScaleMode;
36
+ setMode: (mode: WebSerialScaleMode) => void;
37
+ drops: FloatingScaleDrop[];
38
+ total: number;
39
+ displayWeight: string;
40
+ readingStatus: FloatingScaleReadingStatus;
41
+ locked: boolean;
42
+ applying: boolean;
43
+ feedback?: FloatingScaleFeedback;
44
+ canCapture: boolean;
45
+ canApply: boolean;
46
+ capture: () => void;
47
+ apply: () => Promise<void>;
48
+ removeDrop: (id: number) => void;
49
+ reset: () => void;
50
+ }
51
+ export interface FloatingScalePanelProps {
52
+ state: UseFloatingScaleResult;
53
+ open: boolean;
54
+ onClose: () => void;
55
+ onDisconnect: () => void;
56
+ onConnect: () => void;
57
+ options?: FloatingScaleOptions;
58
+ }
@@ -0,0 +1,3 @@
1
+ /** Decimal arithmetic for the library's four-decimal scale protocol; never sum binary floats. */
2
+ export declare const scaleWeightUnits: (weight: number) => bigint;
3
+ export declare const formatScaleWeight: (units: bigint) => string;
@@ -0,0 +1,3 @@
1
+ import { ArgTypes } from '@storybook/react';
2
+ import { FloatingToolsElementProps } from './floating-tools.element';
3
+ export declare const floatingToolsArgTypes: Partial<ArgTypes<FloatingToolsElementProps>>;
@@ -1,11 +1,13 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  import { FC } from 'react';
3
3
  import { FloatingActionHubItem } from '../floating-action-hub';
4
+ import { FloatingScaleOptions } from './floating-scale.interface';
4
5
  export interface FloatingToolsElementProps {
5
6
  axiosProductManagement?: AxiosInstance;
6
7
  enableFinishGoodGallery?: boolean;
7
8
  enableScale?: boolean;
8
9
  items?: FloatingActionHubItem[];
9
10
  scaleAutoConnectAuthorized?: boolean;
11
+ scaleOptions?: FloatingScaleOptions;
10
12
  }
11
13
  export declare const FloatingToolsElement: FC<FloatingToolsElementProps>;
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { FloatingToolsElement } from './floating-tools.element';
3
+ declare const meta: Meta<typeof FloatingToolsElement>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof FloatingToolsElement>;
6
+ export declare const RealScale: Story;
@@ -1 +1,2 @@
1
1
  export * from './floating-tools.element';
2
+ export type { FloatingScaleOptions } from './floating-scale.interface';
@@ -0,0 +1,2 @@
1
+ import { FloatingScaleOptions, UseFloatingScaleResult } from './floating-scale.interface';
2
+ export declare const useFloatingScale: (options: FloatingScaleOptions, enabled?: boolean) => UseFloatingScaleResult;
@@ -1,9 +1,13 @@
1
1
  import { default as React } from 'react';
2
+ import { WebSerialScaleReading, WebSerialScaleWeighingAudit } from '../../web-serial-scale';
2
3
  import { TextFieldNumberElementProps } from './text-field-number/text-field-number.element';
3
4
  export interface TextFieldWeightNumberElementProps extends TextFieldNumberElementProps {
4
5
  enabled?: boolean;
5
6
  showWeightAdornment?: boolean;
6
7
  weightAdornmentLabel?: React.ReactNode;
7
8
  onEnterConfirm?: (weight: number) => void | Promise<void>;
9
+ onWeighingApply?: (reading: WebSerialScaleReading) => void | Promise<void>;
10
+ weighingAudit?: WebSerialScaleWeighingAudit;
11
+ getWeighingAuditTooltip?: (audit: WebSerialScaleWeighingAudit) => React.ReactNode;
8
12
  }
9
13
  export declare const TextFieldWeightNumberElement: React.FC<TextFieldWeightNumberElementProps>;
@@ -4,7 +4,7 @@ declare const meta: Meta<typeof TextFieldWeightNumberElement>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof TextFieldWeightNumberElement>;
6
6
  export declare const Default: Story;
7
- export declare const WithSharedScaleProvider: Story;
7
+ export declare const WithFloatingTools: Story;
8
8
  export declare const ScaleDisabled: Story;
9
9
  export declare const Disabled: Story;
10
10
  export declare const ErrorState: Story;
@@ -5,6 +5,11 @@ export declare enum WebSerialScaleStatus {
5
5
  Disconnecting = "disconnecting",
6
6
  Error = "error"
7
7
  }
8
+ export declare enum WebSerialScaleMode {
9
+ Single = "SINGLE",
10
+ Accumulated = "ACCUMULATED"
11
+ }
12
+ export declare const WebSerialScaleModeTitle: Record<WebSerialScaleMode, string>;
8
13
  export declare enum ParityWebSerialScaleSerial {
9
14
  None = "none",
10
15
  Even = "even",
@@ -1,4 +1,4 @@
1
- import { ParityWebSerialScaleSerial, FlowControlWebSerialScaleEvent, WebSerialScaleStatus } from './web-serial-scale.enum';
1
+ import { ParityWebSerialScaleSerial, FlowControlWebSerialScaleEvent, WebSerialScaleStatus, WebSerialScaleMode } from './web-serial-scale.enum';
2
2
  import { ReactNode } from 'react';
3
3
  export interface WebSerialScaleReading {
4
4
  rawLine?: string;
@@ -6,6 +6,24 @@ export interface WebSerialScaleReading {
6
6
  numericValue?: number;
7
7
  unit?: string;
8
8
  receivedAt?: number;
9
+ weighingAudit?: WebSerialScaleWeighingAudit;
10
+ overload?: boolean;
11
+ }
12
+ export interface WebSerialScaleWeighingDrop {
13
+ step: number;
14
+ weight: number;
15
+ timestamp: string;
16
+ raw_line?: string;
17
+ }
18
+ export interface WebSerialScaleWeighingAudit {
19
+ mode: WebSerialScaleMode;
20
+ scale_device_id?: string;
21
+ operator_id?: string;
22
+ target_field: string;
23
+ unit: string;
24
+ total_weight: number;
25
+ drops_count: number;
26
+ drops: WebSerialScaleWeighingDrop[];
9
27
  }
10
28
  export interface WebSerialScaleSerialOptions {
11
29
  baudRate: number;
@@ -33,10 +51,12 @@ export interface WebSerialScaleConnectOptions {
33
51
  }
34
52
  export interface WebSerialScaleTarget {
35
53
  name: string;
54
+ fieldName?: string;
36
55
  label?: string;
37
56
  description?: string;
38
57
  disabled?: boolean;
39
58
  onApply?: (reading: WebSerialScaleReading) => void | Promise<void>;
59
+ onConfirm?: (reading: WebSerialScaleReading) => void | Promise<void>;
40
60
  }
41
61
  export interface UseWebSerialScaleOptions {
42
62
  serialOptions: WebSerialScaleSerialOptions;
@@ -72,6 +92,10 @@ export interface WebSerialScaleTargetRegistration {
72
92
  }
73
93
  export interface WebSerialScaleSharedContextValue extends UseWebSerialScaleResult {
74
94
  registerTargets: (registration: WebSerialScaleTargetRegistration) => () => void;
95
+ activeTarget?: Omit<WebSerialScaleTarget, 'onApply' | 'onConfirm'>;
96
+ isManualApply: boolean;
97
+ registerManualController: () => () => void;
98
+ applyToActiveTarget: (reading: WebSerialScaleReading) => Promise<boolean>;
75
99
  }
76
100
  export interface WebSerialScaleProviderElementProps extends Omit<UseWebSerialScaleOptions, 'serialOptions' | 'onReading'> {
77
101
  children: ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sevago-library",
3
- "version": "1.7.7",
3
+ "version": "1.7.8",
4
4
  "description": "Sevago SSO Frontend Library - A comprehensive SSO solution with React components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -1,3 +0,0 @@
1
- import { ArgTypes } from '@storybook/react';
2
- import { WebSerialScaleControllerElementProps } from './web-serial-scale-controller.element';
3
- export declare const webSerialScaleArgTypes: Partial<ArgTypes<WebSerialScaleControllerElementProps>>;
@@ -1,9 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { WebSerialScaleControllerElement } from './web-serial-scale-controller.element';
3
- declare const meta: Meta<typeof WebSerialScaleControllerElement>;
4
- export default meta;
5
- type Story = StoryObj<typeof WebSerialScaleControllerElement>;
6
- export declare const Default: Story;
7
- export declare const FieldFocusFlow: Story;
8
- export declare const WithUsbRequestFilter: Story;
9
- export declare const SharedScaleProviderFlow: Story;