@dilicorp/ui 0.2.17 → 0.2.19
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/dist/atoms/icon.d.ts +2 -1
- package/dist/atoms/icon.js +15 -3
- package/dist/atoms/input-datepicker.d.ts +1 -0
- package/dist/atoms/input-datepicker.js +2 -2
- package/dist/components/form-builder/components/checkbox.d.ts +1 -0
- package/dist/components/form-builder/components/checkbox.js +4 -3
- package/dist/components/form-builder/components/input-currency.js +15 -2
- package/dist/components/form-builder/components/input-mask.js +15 -2
- package/dist/components/form-builder/components/input-prefix-suffix.js +15 -2
- package/dist/components/form-builder/components/input.d.ts +1 -0
- package/dist/components/form-builder/components/input.js +6 -4
- package/dist/components/form-builder/components/radio.d.ts +1 -0
- package/dist/components/form-builder/components/radio.js +4 -3
- package/dist/components/side-navigation-bar/side-navigation-bar-item.js +1 -1
- package/package.json +1 -1
package/dist/atoms/icon.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare type IconProps = {
|
|
|
6
6
|
className?: string;
|
|
7
7
|
id?: string;
|
|
8
8
|
size?: 'lg' | 'md' | 'sm';
|
|
9
|
+
title?: string;
|
|
9
10
|
};
|
|
10
|
-
export declare const Icon: ({ icon, brand,
|
|
11
|
+
export declare const Icon: ({ pluxee, icon, brand, className, id, size, ...props }: IconProps) => JSX.Element;
|
|
11
12
|
//# sourceMappingURL=icon.d.ts.map
|
package/dist/atoms/icon.js
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
2
13
|
import * as fab from '@fortawesome/free-brands-svg-icons';
|
|
3
14
|
import * as fa from '@fortawesome/free-solid-svg-icons';
|
|
4
15
|
import stringHelper from '../utils/string-helper';
|
|
5
16
|
import React from 'react';
|
|
6
17
|
import { PluxeeIcon } from './pluxee-icon/pluxee-icon';
|
|
7
|
-
export const Icon = (
|
|
18
|
+
export const Icon = (_a) => {
|
|
19
|
+
var { pluxee, icon, brand, className = '', id, size } = _a, props = __rest(_a, ["pluxee", "icon", "brand", "className", "id", "size"]);
|
|
8
20
|
if (pluxee) {
|
|
9
|
-
return React.createElement(PluxeeIcon, { icon: icon, size: size });
|
|
21
|
+
return (React.createElement(PluxeeIcon, Object.assign({ icon: icon, size: size }, props)));
|
|
10
22
|
}
|
|
11
23
|
const sanitize = stringHelper.toCamelCase(icon);
|
|
12
24
|
const ico = brand ? fab[sanitize] : fa[sanitize];
|
|
13
|
-
return React.createElement(FontAwesomeIcon, { id: id, icon: ico, className: className });
|
|
25
|
+
return (React.createElement(FontAwesomeIcon, Object.assign({ id: id, icon: ico, className: className }, props)));
|
|
14
26
|
};
|
|
@@ -13,6 +13,7 @@ export declare type InputDatepickerProps = {
|
|
|
13
13
|
minDate?: Date | null;
|
|
14
14
|
maxDate?: Date | null;
|
|
15
15
|
currentValue?: string;
|
|
16
|
+
disabled?: boolean;
|
|
16
17
|
};
|
|
17
18
|
export declare const InputDatepicker: (props: InputDatepickerProps) => JSX.Element;
|
|
18
19
|
//# sourceMappingURL=input-datepicker.d.ts.map
|
|
@@ -11,7 +11,7 @@ registerLocale('es-CO', es);
|
|
|
11
11
|
registerLocale('en-US', en);
|
|
12
12
|
// example use https://reactdatepicker.com
|
|
13
13
|
export const InputDatepicker = (props) => {
|
|
14
|
-
const { name, id = name, value, onChange, onBlur, locale = 'pt-BR', dateFormat = 'dd/MM/yyyy', placeholder = 'DD/MM/YYYY', minDate, maxDate, currentValue } = props;
|
|
14
|
+
const { name, id = name, value, onChange, onBlur, locale = 'pt-BR', dateFormat = 'dd/MM/yyyy', placeholder = 'DD/MM/YYYY', minDate, maxDate, currentValue, disabled } = props;
|
|
15
15
|
const [date, setDate] = React.useState(dateHelper.stringToDate(currentValue || value));
|
|
16
16
|
const handleDateSelect = (currentDate) => {
|
|
17
17
|
if (onChange) {
|
|
@@ -29,5 +29,5 @@ export const InputDatepicker = (props) => {
|
|
|
29
29
|
return (React.createElement(ReactDatePicker, { name: name, id: id, "data-testid": id, locale: locale, dateFormat: dateFormat, className: "form-control", selected: date, onChange: handleDateSelect, placeholderText: placeholder, autoComplete: "off",
|
|
30
30
|
// showMonthDropdown
|
|
31
31
|
// useShortMonthInDropdown
|
|
32
|
-
minDate: minDate, maxDate: maxDate, showYearDropdown: true, yearDropdownItemNumber: 5, scrollableYearDropdown: true, tabIndex: 2, onBlur: handleBlur, customInput: React.createElement(MaskedTextInput, { type: "text", mask: mask }) }));
|
|
32
|
+
minDate: minDate, maxDate: maxDate, showYearDropdown: true, yearDropdownItemNumber: 5, scrollableYearDropdown: true, tabIndex: 2, onBlur: handleBlur, customInput: React.createElement(MaskedTextInput, { type: "text", mask: mask }), disabled: disabled }));
|
|
33
33
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { FastField } from 'formik';
|
|
2
|
+
import { FastField, Field } from 'formik';
|
|
3
3
|
export default function Checkbox(props) {
|
|
4
|
-
const { name, actions, value = [], options, id = name, tabIndex = 0, disabled } = props;
|
|
4
|
+
const { name, actions, value = [], options, id = name, tabIndex = 0, disabled, fastField = true } = props;
|
|
5
5
|
if (!options.length)
|
|
6
6
|
return null;
|
|
7
7
|
const curValue = actions.values[name] || value || [];
|
|
@@ -21,7 +21,8 @@ export default function Checkbox(props) {
|
|
|
21
21
|
: [...values, value]);
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
+
const Tag = fastField ? FastField : Field;
|
|
24
25
|
return options.map((option, index) => (React.createElement("div", { className: "form-check", key: `${name}-${index}` },
|
|
25
|
-
React.createElement(
|
|
26
|
+
React.createElement(Tag, Object.assign({ value: option.value, name: name, id: `${id}-${index}`, "data-testid": `${id}-${index}`, checked: isChecked(option) }, { disabled }, { className: "form-check-input", type: "checkbox", tabIndex: tabIndex, onChange: handleChange })),
|
|
26
27
|
React.createElement("label", { className: "form-check-label", htmlFor: `${id}-${index}` }, option.label))));
|
|
27
28
|
}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { FastField, Field } from 'formik';
|
|
2
13
|
import React from 'react';
|
|
3
14
|
import numberHelper from '../../../utils/number-helper';
|
|
4
15
|
export const InputCurrency = ({ attrs, handleChange, currency, name }) => {
|
|
@@ -13,5 +24,7 @@ export const InputCurrency = ({ attrs, handleChange, currency, name }) => {
|
|
|
13
24
|
}
|
|
14
25
|
});
|
|
15
26
|
};
|
|
16
|
-
|
|
27
|
+
const { fastField = true } = attrs, restAttrs = __rest(attrs, ["fastField"]);
|
|
28
|
+
const Tag = fastField ? FastField : Field;
|
|
29
|
+
return (React.createElement(Tag, { name: name }, ({ field }) => React.createElement("input", Object.assign({}, field, restAttrs, { onChange: handleChangeCurrency, min: "0", maxLength: maxLength }))));
|
|
17
30
|
};
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { FastField, Field } from 'formik';
|
|
2
13
|
import React from 'react';
|
|
3
14
|
import ReactInputMask from 'react-input-mask';
|
|
4
15
|
export const InputMask = ({ attrs, mask, name }) => {
|
|
5
|
-
|
|
16
|
+
const { fastField = true } = attrs, restAttrs = __rest(attrs, ["fastField"]);
|
|
17
|
+
const Tag = fastField ? FastField : Field;
|
|
18
|
+
return (React.createElement(Tag, { name: name }, ({ field }) => React.createElement(ReactInputMask, Object.assign({}, field, restAttrs, { mask: mask }))));
|
|
6
19
|
};
|
|
@@ -1,10 +1,23 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import React from 'react';
|
|
2
|
-
import { FastField } from 'formik';
|
|
13
|
+
import { FastField, Field } from 'formik';
|
|
3
14
|
export const InputPrefixSuffix = ({ attrs, suffix, prefix }) => {
|
|
4
15
|
var _a;
|
|
16
|
+
const { fastField = true } = attrs, restAttrs = __rest(attrs, ["fastField"]);
|
|
17
|
+
const Tag = fastField ? FastField : Field;
|
|
5
18
|
return (React.createElement("div", { className: "position-relative" },
|
|
6
19
|
prefix && React.createElement("div", { className: "input-prefix" }, typeof prefix === 'string' ? React.createElement("span", null, prefix) : prefix),
|
|
7
|
-
React.createElement(
|
|
20
|
+
React.createElement(Tag, Object.assign({}, restAttrs, { readOnly: true, onFocus: (event) => {
|
|
8
21
|
event.currentTarget.readOnly = false;
|
|
9
22
|
} }, ((prefix && typeof prefix === 'string') && {
|
|
10
23
|
style: {
|
|
@@ -12,6 +12,7 @@ export interface FormBuildItemInput extends Omit<FormBuilderBasicsItem, 'prefix'
|
|
|
12
12
|
};
|
|
13
13
|
suffix?: string | React.ReactNode;
|
|
14
14
|
prefix?: string | React.ReactNode;
|
|
15
|
+
fastField?: boolean;
|
|
15
16
|
}
|
|
16
17
|
declare type Props = Omit<FormBuildItemInput, 'component'> & {
|
|
17
18
|
actions: FormikProps<any>;
|
|
@@ -10,13 +10,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import { FastField } from 'formik';
|
|
13
|
+
import { FastField, Field } from 'formik';
|
|
14
14
|
import classNames from 'classnames';
|
|
15
15
|
import { InputCurrency } from './input-currency';
|
|
16
16
|
import { InputMask } from './input-mask';
|
|
17
17
|
import { InputPrefixSuffix } from './input-prefix-suffix';
|
|
18
18
|
export default function Input(props) {
|
|
19
|
-
const { name, id = name, type = 'text', tabIndex = 0, actions, mask, multiple = false, currency, className, prefix, suffix } = props, elements = __rest(props, ["name", "id", "type", "tabIndex", "actions", "mask", "multiple", "currency", "className", "prefix", "suffix"]);
|
|
19
|
+
const { name, id = name, type = 'text', tabIndex = 0, actions, mask, multiple = false, currency, className, prefix, suffix, fastField = true } = props, elements = __rest(props, ["name", "id", "type", "tabIndex", "actions", "mask", "multiple", "currency", "className", "prefix", "suffix", "fastField"]);
|
|
20
20
|
const validOptions = {
|
|
21
21
|
alt: elements.alt,
|
|
22
22
|
autoComplete: elements.autoComplete,
|
|
@@ -57,15 +57,17 @@ export default function Input(props) {
|
|
|
57
57
|
};
|
|
58
58
|
const curValue = actions.values[name];
|
|
59
59
|
const classes = classNames(className, 'form-control');
|
|
60
|
-
const
|
|
60
|
+
const attrsInput = Object.assign(Object.assign({}, validOptions), { value: curValue, className: classes, name,
|
|
61
61
|
id, 'data-testid': id, type: type === 'number' ? 'text' : type, tabIndex, autoComplete: 'none', onChange: handleChange });
|
|
62
|
+
const attrs = Object.assign(Object.assign({}, attrsInput), { fastField });
|
|
62
63
|
if (currency)
|
|
63
64
|
return React.createElement(InputCurrency, Object.assign({}, { name, attrs, currency, handleChange }));
|
|
64
65
|
if (mask)
|
|
65
66
|
return React.createElement(InputMask, Object.assign({}, { name, attrs, mask }));
|
|
66
67
|
if (prefix || suffix)
|
|
67
68
|
return React.createElement(InputPrefixSuffix, Object.assign({}, { attrs, suffix, prefix }));
|
|
68
|
-
|
|
69
|
+
const Tag = fastField ? FastField : Field;
|
|
70
|
+
return (React.createElement(Tag, Object.assign({}, attrsInput, { as: multiple ? 'textarea' : 'input', readOnly: true, onFocus: (event) => {
|
|
69
71
|
event.currentTarget.readOnly = false;
|
|
70
72
|
} })));
|
|
71
73
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { FastField } from 'formik';
|
|
2
|
+
import { FastField, Field } from 'formik';
|
|
3
3
|
export default function Radio(props) {
|
|
4
|
-
const { name, actions, value, options, id = name, tabIndex = 0, disabled } = props;
|
|
4
|
+
const { name, actions, value, options, id = name, tabIndex = 0, disabled, fastField = true } = props;
|
|
5
5
|
if (!options.length)
|
|
6
6
|
return null;
|
|
7
7
|
const curValue = actions.values[name] || value;
|
|
@@ -18,7 +18,8 @@ export default function Radio(props) {
|
|
|
18
18
|
actions.setFieldValue(name, event.currentTarget.value);
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
+
const Tag = fastField ? FastField : Field;
|
|
21
22
|
return options.map((option, index) => (React.createElement("div", { className: "form-check", key: `${name}-${index}` },
|
|
22
|
-
React.createElement(
|
|
23
|
+
React.createElement(Tag, Object.assign({ value: option.value, name: name, id: `${id}-${index}`, "data-testid": `${id}-${index}` }, isChecked(option), { disabled }, { type: "radio", tabIndex: tabIndex, className: "form-check-input", onChange: handleChange })),
|
|
23
24
|
React.createElement("label", { className: "form-check-label", htmlFor: `${id}-${index}` }, option.label))));
|
|
24
25
|
}
|
|
@@ -14,7 +14,7 @@ import { Icon } from '../../atoms/icon';
|
|
|
14
14
|
import { Link } from '../../index';
|
|
15
15
|
const InnerItem = ({ icon, iconSize = 'md', pluxee, label, dataLink }) => {
|
|
16
16
|
return (React.createElement(React.Fragment, null,
|
|
17
|
-
icon && React.createElement(Icon, { icon: icon, pluxee: pluxee, size: iconSize }),
|
|
17
|
+
icon && React.createElement(Icon, { title: label, icon: icon, pluxee: pluxee, size: iconSize }),
|
|
18
18
|
React.createElement("span", { title: label, style: Object.assign({}, (iconSize === 'sm' && { fontSize: 12 })), className: "link_name", "data-link": `${dataLink ? 'link' : 'container'}` }, label)));
|
|
19
19
|
};
|
|
20
20
|
export const SideNavigationBarItem = (props) => {
|