@trackunit/custom-field-components 0.0.973 → 0.0.975

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 CHANGED
@@ -7,7 +7,6 @@ var reactFormComponents = require('@trackunit/react-form-components');
7
7
  var sharedUtils = require('@trackunit/shared-utils');
8
8
  var React = require('react');
9
9
  var reactHookForm = require('react-hook-form');
10
- var uuid = require('uuid');
11
10
 
12
11
  function _interopNamespaceDefault(e) {
13
12
  var n = Object.create(null);
@@ -145,7 +144,7 @@ const setupLibraryTranslations = () => {
145
144
  const BooleanCustomField = ({ defaultValue, dataTestId = "booleanField", onChange, value, id, setValue, register, validationRules, disabled = false, label, tip, isInvalid, errorMessage, helpAddon, maxLength, helpText, ...rest }) => {
146
145
  const initialValue = value !== undefined ? value : defaultValue ? defaultValue : false;
147
146
  const renderAsInvalid = isInvalid || Boolean(errorMessage);
148
- const htmlForId = id ? id : "boolean-custom-field-" + uuid.v4();
147
+ const htmlForId = id ? id : "boolean-custom-field-" + sharedUtils.uuidv4();
149
148
  const [internalValue, setInternalValue] = React__namespace.useState(initialValue);
150
149
  React__namespace.useEffect(() => {
151
150
  setInternalValue((value === undefined ? defaultValue : value) || false);
@@ -199,7 +198,7 @@ const convertToValueFormat = (value) => {
199
198
  */
200
199
  const DropdownCustomField = ({ defaultValue, dataTestId, onChange, onBlur, id, disabled = false, allValues, multiSelect = false, register, validationRules, setValue, label, tip, errorMessage, helpText, isInvalid, helpAddon, }) => {
201
200
  const renderAsInvalid = isInvalid || Boolean(errorMessage);
202
- const htmlForId = id ? id : "dropdown-custom-field-" + uuid.v4();
201
+ const htmlForId = id ? id : "dropdown-custom-field-" + sharedUtils.uuidv4();
203
202
  const [selectedValue, setSelectedValue] = React__namespace.useState(defaultValue ? defaultValue.map(convertToValueFormat) : []);
204
203
  const onChangeHandler = React__namespace.useCallback((selected) => {
205
204
  var _a, _b;
@@ -245,7 +244,6 @@ const getWebAddressValidationRules = (definition) => {
245
244
  return definition.uiEditable
246
245
  ? {
247
246
  ...pattern,
248
- ...defaultRules,
249
247
  }
250
248
  : defaultRules;
251
249
  };
@@ -319,7 +317,6 @@ const getStringValidationRules = (definition) => {
319
317
  ...maxLength,
320
318
  ...minLength,
321
319
  ...pattern,
322
- ...defaultRules,
323
320
  }
324
321
  : defaultRules;
325
322
  };
@@ -377,7 +374,6 @@ const getEmailValidationRules = (definition) => {
377
374
  return definition.uiEditable
378
375
  ? {
379
376
  ...pattern,
380
- ...defaultRules,
381
377
  }
382
378
  : defaultRules;
383
379
  };
package/index.esm.js CHANGED
@@ -2,11 +2,10 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import { registerTranslations, useNamespaceTranslation } from '@trackunit/i18n-library-translation';
3
3
  import { getCustomFieldValueForDisplayInUI } from '@trackunit/iris-app-runtime-core';
4
4
  import { FormGroup, Checkbox, DateField, Select, useGetPhoneValidationRules, NumberField, TextField, PhoneField, ActionButton } from '@trackunit/react-form-components';
5
- import { exhaustiveCheck } from '@trackunit/shared-utils';
5
+ import { uuidv4, exhaustiveCheck } from '@trackunit/shared-utils';
6
6
  import * as React from 'react';
7
7
  import { useCallback, useEffect, createElement, useState } from 'react';
8
8
  import { useWatch } from 'react-hook-form';
9
- import { v4 } from 'uuid';
10
9
 
11
10
  var defaultTranslations = {
12
11
  "customfield.unit.ACRE": "acre",
@@ -125,7 +124,7 @@ const setupLibraryTranslations = () => {
125
124
  const BooleanCustomField = ({ defaultValue, dataTestId = "booleanField", onChange, value, id, setValue, register, validationRules, disabled = false, label, tip, isInvalid, errorMessage, helpAddon, maxLength, helpText, ...rest }) => {
126
125
  const initialValue = value !== undefined ? value : defaultValue ? defaultValue : false;
127
126
  const renderAsInvalid = isInvalid || Boolean(errorMessage);
128
- const htmlForId = id ? id : "boolean-custom-field-" + v4();
127
+ const htmlForId = id ? id : "boolean-custom-field-" + uuidv4();
129
128
  const [internalValue, setInternalValue] = React.useState(initialValue);
130
129
  React.useEffect(() => {
131
130
  setInternalValue((value === undefined ? defaultValue : value) || false);
@@ -179,7 +178,7 @@ const convertToValueFormat = (value) => {
179
178
  */
180
179
  const DropdownCustomField = ({ defaultValue, dataTestId, onChange, onBlur, id, disabled = false, allValues, multiSelect = false, register, validationRules, setValue, label, tip, errorMessage, helpText, isInvalid, helpAddon, }) => {
181
180
  const renderAsInvalid = isInvalid || Boolean(errorMessage);
182
- const htmlForId = id ? id : "dropdown-custom-field-" + v4();
181
+ const htmlForId = id ? id : "dropdown-custom-field-" + uuidv4();
183
182
  const [selectedValue, setSelectedValue] = React.useState(defaultValue ? defaultValue.map(convertToValueFormat) : []);
184
183
  const onChangeHandler = React.useCallback((selected) => {
185
184
  var _a, _b;
@@ -225,7 +224,6 @@ const getWebAddressValidationRules = (definition) => {
225
224
  return definition.uiEditable
226
225
  ? {
227
226
  ...pattern,
228
- ...defaultRules,
229
227
  }
230
228
  : defaultRules;
231
229
  };
@@ -299,7 +297,6 @@ const getStringValidationRules = (definition) => {
299
297
  ...maxLength,
300
298
  ...minLength,
301
299
  ...pattern,
302
- ...defaultRules,
303
300
  }
304
301
  : defaultRules;
305
302
  };
@@ -357,7 +354,6 @@ const getEmailValidationRules = (definition) => {
357
354
  return definition.uiEditable
358
355
  ? {
359
356
  ...pattern,
360
- ...defaultRules,
361
357
  }
362
358
  : defaultRules;
363
359
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/custom-field-components",
3
- "version": "0.0.973",
3
+ "version": "0.0.975",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -9,10 +9,9 @@
9
9
  "dependencies": {
10
10
  "@trackunit/react-form-components": "*",
11
11
  "react": "18.3.1",
12
- "react-hook-form": "7.40.0",
12
+ "react-hook-form": "7.53.0",
13
13
  "@trackunit/custom-field-api": "*",
14
14
  "@trackunit/shared-utils": "*",
15
- "uuid": "^9.0.1",
16
15
  "@trackunit/iris-app-runtime-core": "*",
17
16
  "@trackunit/iris-app-runtime-core-api": "*",
18
17
  "react-select": "^5.8.0",