@trackunit/custom-field-components 0.0.443 → 0.0.445
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.cjs.js +1 -8
- package/index.esm.js +1 -8
- package/package.json +5 -6
package/index.cjs.js
CHANGED
|
@@ -6,7 +6,6 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var irisAppRuntimeCoreApi = require('@trackunit/iris-app-runtime-core-api');
|
|
7
7
|
var reactComponents = require('@trackunit/react-components');
|
|
8
8
|
var reactFormComponents = require('@trackunit/react-form-components');
|
|
9
|
-
var tailwindStyledComponents = require('@trackunit/tailwind-styled-components');
|
|
10
9
|
var React = require('react');
|
|
11
10
|
|
|
12
11
|
function _interopNamespace(e) {
|
|
@@ -3510,7 +3509,7 @@ const useCustomFieldResolver = (field, validation, unitPreference = "SI", fieldI
|
|
|
3510
3509
|
return (jsxRuntime.jsx(reactFormComponents.FormGroup, { htmlFor: isEditing ? key || "number-field" : `${key}-number-field`, label: title, isInvalid: errorMessage ? true : false, helpText: errorMessage || description, dataTestId: `${typedDefinition.key}-FormGroup`, disabled: !typedDefinition.uiEditable, children: isEditing ? (jsxRuntime.jsx(reactFormComponents.NumberInput, Object.assign({ id: key || "number-field", dataTestId: typedDefinition.key ? typedDefinition.key : `numberField`, defaultValue: value, readOnly: !typedDefinition.uiEditable, step: typedDefinition.isInteger ? 1 : "any", min: (_u = typedDefinition.minimumNumber) !== null && _u !== void 0 ? _u : undefined, max: (_v = typedDefinition.maximumNumber) !== null && _v !== void 0 ? _v : undefined }, validation.register(key, rules), { onBlur: () => setIsEditing(!isEditing), onChange: e => {
|
|
3511
3510
|
setNumberValue(e.target.value === "" ? null : e.target.value);
|
|
3512
3511
|
validation.register(key, rules).onChange(e);
|
|
3513
|
-
} }, numberProps))) : (jsxRuntime.jsx(reactFormComponents.BaseInput, Object.assign({ type: "text", id: `${key}-number-field`, dataTestId: `${typedDefinition.key}`, defaultValue: value, readOnly: true, actions: jsxRuntime.jsx(
|
|
3512
|
+
} }, numberProps))) : (jsxRuntime.jsx(reactFormComponents.BaseInput, Object.assign({ type: "text", id: `${key}-number-field`, dataTestId: `${typedDefinition.key}`, defaultValue: value, readOnly: true, actions: jsxRuntime.jsx("div", { className: "tu-action-container", children: jsxRuntime.jsx(reactComponents.IconButton, { className: "tu-action-button", dataTestId: `${typedDefinition.key}-editIconButtonId`, size: "small", color: "tertiary", icon: jsxRuntime.jsx(reactComponents.Icon, { size: "small", name: "PencilIcon" }), onClick: () => setIsEditing(!isEditing) }) }) }, numberProps))) }));
|
|
3514
3513
|
}
|
|
3515
3514
|
case irisAppRuntimeCoreApi.CustomFieldType.BOOLEAN: {
|
|
3516
3515
|
const typedDefinition = field.definition;
|
|
@@ -3548,12 +3547,6 @@ const CustomField = ({ field, register, formState, setValue, unitPreference, fie
|
|
|
3548
3547
|
const fieldComponent = useCustomFieldResolver(field, { register, setValue, formState }, unitPreference, fieldId);
|
|
3549
3548
|
return fieldComponent;
|
|
3550
3549
|
};
|
|
3551
|
-
const ActionContainer = tailwindStyledComponents.tw.div `
|
|
3552
|
-
tu-action-container
|
|
3553
|
-
`;
|
|
3554
|
-
const StyledIconButton = tailwindStyledComponents.twx(reactComponents.IconButton) `
|
|
3555
|
-
tu-action-button
|
|
3556
|
-
`;
|
|
3557
3550
|
|
|
3558
3551
|
exports.CustomField = CustomField;
|
|
3559
3552
|
exports.useCustomFieldResolver = useCustomFieldResolver;
|
package/index.esm.js
CHANGED
|
@@ -2,7 +2,6 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { CustomFieldType } from '@trackunit/iris-app-runtime-core-api';
|
|
3
3
|
import { IconButton, Icon } from '@trackunit/react-components';
|
|
4
4
|
import { FormGroup, Checkbox, DateField, Select, NumberInput, BaseInput, TextField, ActionButton } from '@trackunit/react-form-components';
|
|
5
|
-
import { tw, twx } from '@trackunit/tailwind-styled-components';
|
|
6
5
|
import * as React from 'react';
|
|
7
6
|
import { useCallback, useEffect, createElement, useState } from 'react';
|
|
8
7
|
|
|
@@ -3487,7 +3486,7 @@ const useCustomFieldResolver = (field, validation, unitPreference = "SI", fieldI
|
|
|
3487
3486
|
return (jsx(FormGroup, { htmlFor: isEditing ? key || "number-field" : `${key}-number-field`, label: title, isInvalid: errorMessage ? true : false, helpText: errorMessage || description, dataTestId: `${typedDefinition.key}-FormGroup`, disabled: !typedDefinition.uiEditable, children: isEditing ? (jsx(NumberInput, Object.assign({ id: key || "number-field", dataTestId: typedDefinition.key ? typedDefinition.key : `numberField`, defaultValue: value, readOnly: !typedDefinition.uiEditable, step: typedDefinition.isInteger ? 1 : "any", min: (_u = typedDefinition.minimumNumber) !== null && _u !== void 0 ? _u : undefined, max: (_v = typedDefinition.maximumNumber) !== null && _v !== void 0 ? _v : undefined }, validation.register(key, rules), { onBlur: () => setIsEditing(!isEditing), onChange: e => {
|
|
3488
3487
|
setNumberValue(e.target.value === "" ? null : e.target.value);
|
|
3489
3488
|
validation.register(key, rules).onChange(e);
|
|
3490
|
-
} }, numberProps))) : (jsx(BaseInput, Object.assign({ type: "text", id: `${key}-number-field`, dataTestId: `${typedDefinition.key}`, defaultValue: value, readOnly: true, actions: jsx(
|
|
3489
|
+
} }, numberProps))) : (jsx(BaseInput, Object.assign({ type: "text", id: `${key}-number-field`, dataTestId: `${typedDefinition.key}`, defaultValue: value, readOnly: true, actions: jsx("div", { className: "tu-action-container", children: jsx(IconButton, { className: "tu-action-button", dataTestId: `${typedDefinition.key}-editIconButtonId`, size: "small", color: "tertiary", icon: jsx(Icon, { size: "small", name: "PencilIcon" }), onClick: () => setIsEditing(!isEditing) }) }) }, numberProps))) }));
|
|
3491
3490
|
}
|
|
3492
3491
|
case CustomFieldType.BOOLEAN: {
|
|
3493
3492
|
const typedDefinition = field.definition;
|
|
@@ -3525,11 +3524,5 @@ const CustomField = ({ field, register, formState, setValue, unitPreference, fie
|
|
|
3525
3524
|
const fieldComponent = useCustomFieldResolver(field, { register, setValue, formState }, unitPreference, fieldId);
|
|
3526
3525
|
return fieldComponent;
|
|
3527
3526
|
};
|
|
3528
|
-
const ActionContainer = tw.div `
|
|
3529
|
-
tu-action-container
|
|
3530
|
-
`;
|
|
3531
|
-
const StyledIconButton = twx(IconButton) `
|
|
3532
|
-
tu-action-button
|
|
3533
|
-
`;
|
|
3534
3527
|
|
|
3535
3528
|
export { CustomField, useCustomFieldResolver };
|
package/package.json
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/custom-field-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.445",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=18.x"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@trackunit/iris-app-runtime-core": "0.3.
|
|
11
|
-
"@trackunit/iris-app-runtime-core-api": "0.3.
|
|
10
|
+
"@trackunit/iris-app-runtime-core": "0.3.64",
|
|
11
|
+
"@trackunit/iris-app-runtime-core-api": "0.3.57",
|
|
12
12
|
"@trackunit/react-components": "0.1.148",
|
|
13
|
-
"@trackunit/react-core-contexts-test": "0.1.
|
|
14
|
-
"@trackunit/react-form-components": "0.0.
|
|
15
|
-
"@trackunit/tailwind-styled-components": "0.0.60",
|
|
13
|
+
"@trackunit/react-core-contexts-test": "0.1.93",
|
|
14
|
+
"@trackunit/react-form-components": "0.0.119",
|
|
16
15
|
"libphonenumber-js": "1.10.36",
|
|
17
16
|
"react": "18.2.0",
|
|
18
17
|
"react-hook-form": "7.40.0",
|