@balena/ui-shared-components 13.0.0-build-rename-and-require-widget-extracontext-155b8dad7f37939103128b808cabac13e0500696-1 → 13.0.0-build-rename-and-require-widget-extracontext-02517a1eb79682c0cdcb0dd0fe8ccb17c7a2f285-1

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 (25) hide show
  1. package/dist/components/RJST/components/Widget/Formats/BooleanAsIconWidget.d.ts +1 -1
  2. package/dist/components/RJST/components/Widget/Formats/BooleanAsIconWidget.js +1 -1
  3. package/dist/components/RJST/components/Widget/Formats/CodeWidget.d.ts +1 -1
  4. package/dist/components/RJST/components/Widget/Formats/CodeWidget.js +1 -1
  5. package/dist/components/RJST/components/Widget/Formats/DisabledTextWidget.d.ts +1 -1
  6. package/dist/components/RJST/components/Widget/Formats/DisabledTextWidget.js +1 -1
  7. package/dist/components/RJST/components/Widget/Formats/DurationWidget.d.ts +1 -6
  8. package/dist/components/RJST/components/Widget/Formats/DurationWidget.js +1 -1
  9. package/dist/components/RJST/components/Widget/Formats/ElapsedTimeWidget.d.ts +1 -1
  10. package/dist/components/RJST/components/Widget/Formats/ElapsedTimeWidget.js +5 -4
  11. package/dist/components/RJST/components/Widget/Formats/HashWidget.d.ts +1 -1
  12. package/dist/components/RJST/components/Widget/Formats/HashWidget.js +1 -1
  13. package/dist/components/RJST/components/Widget/Formats/PercentageWidget.d.ts +1 -1
  14. package/dist/components/RJST/components/Widget/Formats/PercentageWidget.js +1 -1
  15. package/dist/components/RJST/components/Widget/Formats/PlaceholderTextWidget.d.ts +1 -1
  16. package/dist/components/RJST/components/Widget/Formats/PlaceholderTextWidget.js +1 -1
  17. package/dist/components/RJST/components/Widget/Formats/TemperatureWidget.d.ts +1 -1
  18. package/dist/components/RJST/components/Widget/Formats/TemperatureWidget.js +1 -1
  19. package/dist/components/RJST/components/Widget/Formats/TxtWidget.d.ts +1 -1
  20. package/dist/components/RJST/components/Widget/Formats/TxtWidget.js +2 -10
  21. package/dist/components/RJST/components/Widget/Formats/WrapWidget.d.ts +1 -1
  22. package/dist/components/RJST/components/Widget/Formats/WrapWidget.js +1 -1
  23. package/dist/components/RJST/components/Widget/utils.d.ts +4 -4
  24. package/dist/components/RJST/components/Widget/utils.js +1 -2
  25. package/package.json +2 -2
@@ -1 +1 @@
1
- export declare const BooleanAsIconWidget: import("../utils").Widget<object, object>;
1
+ export declare const BooleanAsIconWidget: import("../utils").Widget<object>;
@@ -4,7 +4,7 @@ import { faTimesCircle } from '@fortawesome/free-solid-svg-icons/faTimesCircle';
4
4
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
5
5
  import { JsonTypes, widgetFactory } from '../utils';
6
6
  import { Box, Typography } from '@mui/material';
7
- export const BooleanAsIconWidget = widgetFactory('BooleanAsIcon', {}, [
7
+ export const BooleanAsIconWidget = widgetFactory('BooleanAsIcon', [
8
8
  JsonTypes.boolean,
9
9
  JsonTypes.number,
10
10
  JsonTypes.null,
@@ -1 +1 @@
1
- export declare const CodeWidget: import("../utils").Widget<object, object>;
1
+ export declare const CodeWidget: import("../utils").Widget<object>;
@@ -3,6 +3,6 @@ import { Tooltip } from '@mui/material';
3
3
  import { Copy } from '../../../../Copy';
4
4
  import { JsonTypes, widgetFactory } from '../utils';
5
5
  import { Code } from '../../../../Code';
6
- export const CodeWidget = widgetFactory('Code', {}, [JsonTypes.string])(({ value, }) => {
6
+ export const CodeWidget = widgetFactory('Code', [JsonTypes.string])(({ value, }) => {
7
7
  return (_jsx(Copy, { copy: value, children: _jsx(Tooltip, { title: value, children: _jsx(Code, { noWrap: true, children: value }) }) }));
8
8
  });
@@ -1 +1 @@
1
- export declare const DisabledTextWidget: import("../utils").Widget<object, object>;
1
+ export declare const DisabledTextWidget: import("../utils").Widget<object>;
@@ -3,7 +3,7 @@ import { Tooltip, Typography } from '@mui/material';
3
3
  import { useTranslation } from '../../../../../hooks/useTranslations';
4
4
  import { JsonTypes, widgetFactory } from '../utils';
5
5
  import { token } from '../../../../../utils/token';
6
- export const DisabledTextWidget = widgetFactory('DisabledText', {}, [
6
+ export const DisabledTextWidget = widgetFactory('DisabledText', [
7
7
  JsonTypes.string,
8
8
  JsonTypes.number,
9
9
  JsonTypes.null,
@@ -1,6 +1 @@
1
- export declare const DurationWidget: import("../utils").Widget<object, {
2
- value: {
3
- start?: number | Date | null;
4
- end?: number | Date | null;
5
- };
6
- }>;
1
+ export declare const DurationWidget: import("../utils").Widget<object>;
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import { intervalToDuration } from 'date-fns';
4
4
  import { JsonTypes, widgetFactory } from '../utils';
5
5
  import { Typography } from '@mui/material';
6
- export const DurationWidget = widgetFactory('Duration', {}, [JsonTypes.object])(({ value, }) => {
6
+ export const DurationWidget = widgetFactory('Duration', [JsonTypes.object])(({ value, }) => {
7
7
  const duration = React.useMemo(() => {
8
8
  var _a, _b, _c;
9
9
  if (!value.start || !value.end) {
@@ -1 +1 @@
1
- export declare const ElapsedTimeWidget: import("../utils").Widget<object, object>;
1
+ export declare const ElapsedTimeWidget: import("../utils").Widget<object>;
@@ -1,10 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { UiOption, JsonTypes, widgetFactory, formatTimestamp, timeSince, } from '../utils';
2
+ import { JsonTypes, widgetFactory, formatTimestamp, timeSince } from '../utils';
3
3
  import { Material, Tooltip } from '../../../../..';
4
4
  const { Typography } = Material;
5
- export const ElapsedTimeWidget = widgetFactory('ElapsedTime', {
6
- dtFormat: UiOption.string,
7
- }, [JsonTypes.string, JsonTypes.number])(({ value }) => {
5
+ export const ElapsedTimeWidget = widgetFactory('ElapsedTime', [
6
+ JsonTypes.string,
7
+ JsonTypes.number,
8
+ ])(({ value }) => {
8
9
  if (!value) {
9
10
  return null;
10
11
  }
@@ -1 +1 @@
1
- export declare const HashWidget: import("../utils").Widget<object, object>;
1
+ export declare const HashWidget: import("../utils").Widget<object>;
@@ -2,6 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Code } from '@mui/icons-material';
3
3
  import { Copy } from '../../../../Copy';
4
4
  import { JsonTypes, truncateHash, widgetFactory } from '../utils';
5
- export const HashWidget = widgetFactory('Hash', {}, [JsonTypes.string])(({ value, }) => {
5
+ export const HashWidget = widgetFactory('Hash', [JsonTypes.string])(({ value, }) => {
6
6
  return (_jsx(Copy, { copy: value, children: _jsx(Code, { children: truncateHash(value) }) }));
7
7
  });
@@ -1 +1 @@
1
- export declare const PercentageWidget: import("../utils").Widget<object, object>;
1
+ export declare const PercentageWidget: import("../utils").Widget<object>;
@@ -1,6 +1,6 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
2
  import { JsonTypes, widgetFactory } from '../utils';
3
- export const PercentageWidget = widgetFactory('Percentage', {}, [
3
+ export const PercentageWidget = widgetFactory('Percentage', [
4
4
  JsonTypes.string,
5
5
  JsonTypes.number,
6
6
  ])(({ value }) => {
@@ -1 +1 @@
1
- export declare const PlaceholderTextWidget: import("../utils").Widget<object, object>;
1
+ export declare const PlaceholderTextWidget: import("../utils").Widget<object>;
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Typography } from '@mui/material';
3
3
  import { JsonTypes, widgetFactory } from '../utils';
4
4
  import { token } from '../../../../../utils/token';
5
- export const PlaceholderTextWidget = widgetFactory('PlaceholderText', {}, [
5
+ export const PlaceholderTextWidget = widgetFactory('PlaceholderText', [
6
6
  JsonTypes.string,
7
7
  JsonTypes.number,
8
8
  JsonTypes.null,
@@ -1 +1 @@
1
- export declare const TemperatureWidget: import("../utils").Widget<object, object>;
1
+ export declare const TemperatureWidget: import("../utils").Widget<object>;
@@ -1,6 +1,6 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
2
  import { JsonTypes, widgetFactory } from '../utils';
3
- export const TemperatureWidget = widgetFactory('Temperature', {}, [
3
+ export const TemperatureWidget = widgetFactory('Temperature', [
4
4
  JsonTypes.number,
5
5
  ])(({ value }) => {
6
6
  return _jsx(_Fragment, { children: value ? `~${value}°C` : '-' });
@@ -1,2 +1,2 @@
1
- declare const TxtWidget: import("../utils").Widget<object, object>;
1
+ declare const TxtWidget: import("../utils").Widget<object>;
2
2
  export default TxtWidget;
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import get from 'lodash/get';
3
3
  import invokeMap from 'lodash/invokeMap';
4
4
  import isArray from 'lodash/isArray';
5
- import { UiOption, JsonTypes, widgetFactory, formatTimestamp } from '../utils';
5
+ import { JsonTypes, widgetFactory, formatTimestamp } from '../utils';
6
6
  import { Truncate } from '../../../../Truncate';
7
7
  import { Typography } from '@mui/material';
8
8
  const getArrayValue = (value, uiSchema) => {
@@ -19,15 +19,7 @@ const getArrayValue = (value, uiSchema) => {
19
19
  return arrayString;
20
20
  };
21
21
  const DATE_TIME_FORMATS = ['date-time', 'date', 'time'];
22
- const TxtWidget = widgetFactory('Txt', {
23
- dtFormat: UiOption.string,
24
- align: Object.assign(Object.assign({}, UiOption.string), { enum: ['inherit', 'left', 'center', 'right', 'justify'] }),
25
- gutterBottom: UiOption.bolean,
26
- noWrap: UiOption.boolean,
27
- paragraph: UiOption.boolean,
28
- sx: UiOption.object,
29
- variant: UiOption.string,
30
- }, [
22
+ const TxtWidget = widgetFactory('Txt', [
31
23
  JsonTypes.string,
32
24
  JsonTypes.null,
33
25
  JsonTypes.integer,
@@ -1 +1 @@
1
- export declare const WrapWidget: import("../utils").Widget<object, object>;
1
+ export declare const WrapWidget: import("../utils").Widget<object>;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Typography } from '@mui/material';
3
3
  import { JsonTypes, widgetFactory } from '../utils';
4
- export const WrapWidget = widgetFactory('Wrap', {}, [JsonTypes.string])(({ value, }) => {
4
+ export const WrapWidget = widgetFactory('Wrap', [JsonTypes.string])(({ value, }) => {
5
5
  return (_jsx(Typography, { sx: { maxWidth: '475px', whitespace: 'normal' }, children: value }));
6
6
  });
@@ -21,11 +21,11 @@ export interface WidgetProps<T extends object = object> {
21
21
  uiSchema?: UiSchema;
22
22
  resource: T;
23
23
  }
24
- export interface Widget<T extends object = object, ExtraProps = object> {
24
+ export interface Widget<T extends object = object> {
25
25
  uiOptions?: UiOptions;
26
26
  supportedTypes?: string[];
27
27
  displayName: string;
28
- (props: WidgetProps<T> & ExtraProps): JSX.Element | null;
28
+ (props: WidgetProps<T>): JSX.Element | null;
29
29
  }
30
30
  export declare const JsonTypes: {
31
31
  readonly array: "array";
@@ -49,9 +49,9 @@ export type UiOptions = {
49
49
  [key: string]: JSONSchema;
50
50
  };
51
51
  export declare const UiOption: UiOptions;
52
- export declare const widgetFactory: <ST extends Array<keyof JsonTypesTypeMap>>(displayName: string, uiOptions: Widget["uiOptions"], supportedTypes: ST) => <T extends object, ExtraProps extends object = object, V extends WidgetProps["value"] | null = JsonTypesTypeMap[ST[number]]>(widgetFn: (props: Overwrite<WidgetProps<T>, {
52
+ export declare const widgetFactory: <ST extends Array<keyof JsonTypesTypeMap>>(displayName: string, supportedTypes: ST) => <T extends object, V extends WidgetProps["value"] | null = JsonTypesTypeMap[ST[number]]>(widgetFn: (props: Overwrite<WidgetProps<T>, {
53
53
  value: V;
54
- }> & ExtraProps) => JSX.Element | null) => Widget<T, ExtraProps>;
54
+ }>) => JSX.Element | null) => Widget<T>;
55
55
  export declare const formatTimestamp: (timestamp: string | number, uiSchema?: UiSchema) => string;
56
56
  export declare const truncateHash: (str: string, maxLength?: number) => string;
57
57
  export declare const timeSince: (timestamp: string | number, suffix?: boolean) => string;
@@ -33,12 +33,11 @@ export const UiOption = {
33
33
  // TODO: Replace the HOF with a plain function once TS supports optional generic types
34
34
  // See: https://github.com/microsoft/TypeScript/issues/14400
35
35
  // TODO: convert the fn args to an object once we bump TS
36
- export const widgetFactory = (displayName, uiOptions, supportedTypes) => {
36
+ export const widgetFactory = (displayName, supportedTypes) => {
37
37
  return (widgetFn) => {
38
38
  const widget = widgetFn;
39
39
  Object.assign(widget, {
40
40
  displayName,
41
- uiOptions,
42
41
  supportedTypes,
43
42
  });
44
43
  return widget;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@balena/ui-shared-components",
3
- "version": "13.0.0-build-rename-and-require-widget-extracontext-155b8dad7f37939103128b808cabac13e0500696-1",
3
+ "version": "13.0.0-build-rename-and-require-widget-extracontext-02517a1eb79682c0cdcb0dd0fe8ccb17c7a2f285-1",
4
4
  "main": "./dist/index.js",
5
5
  "sideEffects": false,
6
6
  "files": [
@@ -138,6 +138,6 @@
138
138
  },
139
139
  "homepage": "https://github.com/balena-io/ui-shared-components#readme",
140
140
  "versionist": {
141
- "publishedAt": "2025-05-08T13:54:42.817Z"
141
+ "publishedAt": "2025-05-08T18:53:24.991Z"
142
142
  }
143
143
  }