@dartech/arsenal-ui 1.4.39 → 1.4.40

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.js CHANGED
@@ -883,11 +883,15 @@ const ControlAutocomplete = _a => {
883
883
  children: "*"
884
884
  })]
885
885
  }) : label,
886
+ InputLabelProps: {
887
+ shrink: !!(autocompleteProps === null || autocompleteProps === void 0 ? void 0 : autocompleteProps.placeholder)
888
+ },
886
889
  sx: {
887
890
  '.MuiInputLabel-root span': {
888
891
  color: '#D6331F'
889
892
  }
890
893
  },
894
+ placeholder: autocompleteProps === null || autocompleteProps === void 0 ? void 0 : autocompleteProps.placeholder,
891
895
  error: !!error,
892
896
  inputRef: ref,
893
897
  helperText: !hideErrorMessage && (error === null || error === void 0 ? void 0 : error.message),
@@ -1057,6 +1061,9 @@ function ControlQueryAutocomplete(_a) {
1057
1061
  children: "*"
1058
1062
  })]
1059
1063
  }) : label,
1064
+ InputLabelProps: {
1065
+ shrink: true
1066
+ },
1060
1067
  sx: {
1061
1068
  '.MuiInputLabel-root span': {
1062
1069
  color: '#D6331F'
@@ -2039,6 +2046,11 @@ const getSinglePropertyFillOptions = ({
2039
2046
  return options;
2040
2047
  };
2041
2048
 
2049
+ const DEFAULT_ERROR_TEXT = {
2050
+ required: DEFAULT_REQUIRED_ERROR_TEXT,
2051
+ notValidNumber: 'Not valid number',
2052
+ notValidInteger: 'Not valid integer'
2053
+ };
2042
2054
  const ControlNumberInput = _a => {
2043
2055
  var _b, _c;
2044
2056
  var {
@@ -2053,22 +2065,25 @@ const ControlNumberInput = _a => {
2053
2065
  onChange: customOnChange,
2054
2066
  decimal = false,
2055
2067
  valueAsNumber = true,
2056
- requiredErrorText = '',
2057
- useFormattedInputValue = false
2068
+ useFormattedInputValue = false,
2069
+ errorText
2058
2070
  } = _a,
2059
- textFieldProps = __rest(_a, ["control", "validate", "name", "label", "required", "defaultValue", "disabled", "hideErrorMessage", "onChange", "decimal", "valueAsNumber", "requiredErrorText", "useFormattedInputValue"]);
2071
+ textFieldProps = __rest(_a, ["control", "validate", "name", "label", "required", "defaultValue", "disabled", "hideErrorMessage", "onChange", "decimal", "valueAsNumber", "useFormattedInputValue", "errorText"]);
2072
+ const textError = useMemo(() => {
2073
+ return errorText || DEFAULT_ERROR_TEXT;
2074
+ }, [errorText]);
2060
2075
  const _d = useController({
2061
2076
  name,
2062
2077
  control,
2063
2078
  defaultValue,
2064
2079
  rules: {
2065
- required: required ? requiredErrorText || DEFAULT_REQUIRED_ERROR_TEXT : false,
2080
+ required: required ? textError.required : false,
2066
2081
  validate: val => {
2067
2082
  if (val === null || val === 0) return true;
2068
2083
  if (decimal && !floatsOnly.test(val) || /^-*0+$/.test(val)) {
2069
- return 'Not valid number';
2084
+ return textError.notValidNumber;
2070
2085
  } else if (!decimal && !digitsOnly.test(val)) {
2071
- return 'Not valid integer';
2086
+ return textError.notValidInteger;
2072
2087
  }
2073
2088
  return validate ? typeof validate === 'function' ? validate(val) : true : true;
2074
2089
  }
@@ -2249,38 +2264,33 @@ const ControlDate = _a => {
2249
2264
  console.error(e);
2250
2265
  }
2251
2266
  }, [format$1]);
2252
- return jsx(DatePicker, Object.assign({}, field, {
2253
- label: required ? jsxs(Fragment, {
2254
- children: [label, " ", jsx("span", {
2255
- children: "*"
2256
- })]
2257
- }) : label
2258
- }, localFormat ? {
2259
- inputFormat: localFormat
2260
- } : {}, {
2261
- value: localFormat ? parse(field.value, localFormat, new Date()) : field.value,
2262
- onChange: handleChange,
2263
- components: {
2264
- OpenPickerIcon: DateIconComponent$1
2265
- }
2266
- }, datePickerProps, {
2267
- renderInput: params => jsx(TextField, Object.assign({}, params, {
2268
- fullWidth: true,
2269
- size: "small",
2270
- sx: {
2271
- '.MuiInputLabel-root span': {
2272
- color: '#D6331F'
2273
- }
2274
- },
2275
- variant: "outlined",
2276
- name: name,
2277
- error: !!error,
2278
- helperText: !hideErrorMessage && (error === null || error === void 0 ? void 0 : error.message),
2279
- FormHelperTextProps: {
2280
- variant: 'standard'
2267
+ return jsxs(Fragment, {
2268
+ children: [jsx(FormLabel, Object.assign({
2269
+ required: required
2270
+ }, {
2271
+ children: label
2272
+ })), jsx(DatePicker, Object.assign({}, field, localFormat ? {
2273
+ inputFormat: localFormat
2274
+ } : {}, {
2275
+ value: localFormat ? parse(field.value, localFormat, new Date()) : field.value,
2276
+ onChange: handleChange,
2277
+ components: {
2278
+ OpenPickerIcon: DateIconComponent$1
2281
2279
  }
2282
- }, textFieldProps))
2283
- }));
2280
+ }, datePickerProps, {
2281
+ renderInput: params => jsx(TextField, Object.assign({}, params, {
2282
+ fullWidth: true,
2283
+ size: "small",
2284
+ variant: "outlined",
2285
+ name: name,
2286
+ error: !!error,
2287
+ helperText: !hideErrorMessage && (error === null || error === void 0 ? void 0 : error.message),
2288
+ FormHelperTextProps: {
2289
+ variant: 'standard'
2290
+ }
2291
+ }, textFieldProps))
2292
+ }))]
2293
+ });
2284
2294
  };
2285
2295
 
2286
2296
  const DateIconComponent = () => {
@@ -7099,6 +7109,10 @@ const inputThemeOptions = {
7099
7109
  },
7100
7110
  MuiFormLabel: {
7101
7111
  styleOverrides: {
7112
+ root: {
7113
+ fontSize: 14,
7114
+ fontWeight: 500
7115
+ },
7102
7116
  asterisk: {
7103
7117
  color: '#D6331F',
7104
7118
  '&$error': {
@@ -8016,4 +8030,4 @@ const Breadcrumbs = ({
8016
8030
  }));
8017
8031
  };
8018
8032
 
8019
- export { AlertDialog, BackButton, Breadcrumbs, ContentLayout, ControlAceEditor, ControlArrayInput, ControlAutocomplete, ControlCheckbox, ControlDate, ControlDateTime, ControlDebouncedInput, ControlInput, ControlNumberInput, ControlPeriodInput, ControlPhoneInput, ControlQueryAutocomplete, ControlRadio, ControlSelect, ControlSwitch, ControlTime, CopyButton, CreateDefinition, CreatePropertiesList, CreatePropertiesListContext, CreatePropertyFormFields, DATE_DEFAULT_FORMAT, DATE_TIME_DEFAULT_FORMAT, DEFAULT_REQUIRED_ERROR_TEXT, DefinitionFiller, DefinitionValueView, InfoItem, JsonModalView, JsonPathPicker, JsonView, Loader, MenuIcon, MultiplePropertyFiller, PropertyFiller, PropertyType, PropertyValueField, RoundingMode, RouteTabs, Sidebar, SimpleTable, Status, StepperView, TIME_DEFAULT_FORMAT, TabPanel, Table, TableAction, TableActionCell, ViewPropertiesList, ViewProperty, capitalize, deepParseJson, defaultDefinitionArrayValue, defaultDefinitionObjectValue, digitsOnly, floatsOnly, formatDefinitionData, formatTableRowValue, getDemPropertyDateFormat, getEntityStarterValue, getJsonStringValue, getMultiplePropertyFillOptions, getSinglePropertyFillOptions, isDateType, isExpression, isPropertyValueEmpty, numberFormat, propertiesArrayToObject, propertiesObjectToArray, removeArrayItem, safeParseJson, sortArrayOfObjects, theme, useDebounce, useToggle, validateJson };
8033
+ export { AlertDialog, BackButton, Breadcrumbs, ContentLayout, ControlAceEditor, ControlArrayInput, ControlAutocomplete, ControlCheckbox, ControlDate, ControlDateTime, ControlDebouncedInput, ControlInput, ControlNumberInput, ControlPeriodInput, ControlPhoneInput, ControlQueryAutocomplete, ControlRadio, ControlSelect, ControlSwitch, ControlTime, CopyButton, CreateDefinition, CreatePropertiesList, CreatePropertiesListContext, CreatePropertyFormFields, DATE_DEFAULT_FORMAT, DATE_TIME_DEFAULT_FORMAT, DEFAULT_ERROR_TEXT, DEFAULT_REQUIRED_ERROR_TEXT, DefinitionFiller, DefinitionValueView, InfoItem, JsonModalView, JsonPathPicker, JsonView, Loader, MenuIcon, MultiplePropertyFiller, PropertyFiller, PropertyType, PropertyValueField, RoundingMode, RouteTabs, Sidebar, SimpleTable, Status, StepperView, TIME_DEFAULT_FORMAT, TabPanel, Table, TableAction, TableActionCell, ViewPropertiesList, ViewProperty, capitalize, deepParseJson, defaultDefinitionArrayValue, defaultDefinitionObjectValue, digitsOnly, floatsOnly, formatDefinitionData, formatTableRowValue, getDemPropertyDateFormat, getEntityStarterValue, getJsonStringValue, getMultiplePropertyFillOptions, getSinglePropertyFillOptions, isDateType, isExpression, isPropertyValueEmpty, numberFormat, propertiesArrayToObject, propertiesObjectToArray, removeArrayItem, safeParseJson, sortArrayOfObjects, theme, useDebounce, useToggle, validateJson };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dartech/arsenal-ui",
3
- "version": "1.4.39",
3
+ "version": "1.4.40",
4
4
  "author": "DAR",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -2,6 +2,16 @@ import type { ReactNode } from 'react';
2
2
  import { TextFieldProps } from '@mui/material/TextField';
3
3
  import { Control } from 'react-hook-form';
4
4
  import { ValidateFunc } from '../../interfaces';
5
+ export interface ErrorText {
6
+ required: string;
7
+ notValidNumber: string;
8
+ notValidInteger: string;
9
+ }
10
+ export declare const DEFAULT_ERROR_TEXT: {
11
+ required: string;
12
+ notValidNumber: string;
13
+ notValidInteger: string;
14
+ };
5
15
  type Props = TextFieldProps & {
6
16
  /**
7
17
  * React Hook Form control `name` propery
@@ -54,9 +64,9 @@ type Props = TextFieldProps & {
54
64
  */
55
65
  useFormattedInputValue?: boolean;
56
66
  /**
57
- * Set required error text
67
+ * Set error text
58
68
  */
59
- requiredErrorText?: string;
69
+ errorText?: ErrorText;
60
70
  };
61
- export declare const ControlNumberInput: ({ control, validate, name, label, required, defaultValue, disabled, hideErrorMessage, onChange: customOnChange, decimal, valueAsNumber, requiredErrorText, useFormattedInputValue, ...textFieldProps }: Props) => JSX.Element;
71
+ export declare const ControlNumberInput: ({ control, validate, name, label, required, defaultValue, disabled, hideErrorMessage, onChange: customOnChange, decimal, valueAsNumber, useFormattedInputValue, errorText, ...textFieldProps }: Props) => JSX.Element;
62
72
  export default ControlNumberInput;
@@ -105,6 +105,10 @@ declare const inputThemeOptions: {
105
105
  };
106
106
  MuiFormLabel: {
107
107
  styleOverrides: {
108
+ root: {
109
+ fontSize: number;
110
+ fontWeight: number;
111
+ };
108
112
  asterisk: {
109
113
  color: string;
110
114
  '&$error': {