@dilicorp/ui 0.2.34 → 0.2.36
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/button.js +2 -14
- package/dist/atoms/checkbox.js +2 -14
- package/dist/atoms/col.js +2 -14
- package/dist/atoms/container.js +2 -14
- package/dist/atoms/icon.js +3 -15
- package/dist/atoms/image.js +2 -13
- package/dist/atoms/input.js +2 -14
- package/dist/atoms/label.js +2 -14
- package/dist/atoms/link.js +3 -14
- package/dist/atoms/radio.js +2 -14
- package/dist/atoms/row.js +1 -1
- package/dist/atoms/skeleton.js +1 -1
- package/dist/atoms/switcher.d.ts +7 -0
- package/dist/atoms/switcher.js +10 -0
- package/dist/atoms/typography.js +2 -14
- package/dist/components/accordion/accordion-body.d.ts +1 -1
- package/dist/components/accordion/accordion-body.js +1 -1
- package/dist/components/accordion/accordion-header.d.ts +1 -1
- package/dist/components/accordion/accordion-header.js +1 -1
- package/dist/components/accordion/accordion-item.d.ts +1 -1
- package/dist/components/accordion/accordion-item.js +1 -1
- package/dist/components/accordion/accordion.d.ts +1 -1
- package/dist/components/accordion/accordion.js +4 -4
- package/dist/components/alert-modal/alert-context-provider.d.ts +17 -0
- package/dist/components/alert-modal/alert-context-provider.js +18 -0
- package/dist/components/alert-modal/alert-modal-content.d.ts +8 -0
- package/dist/components/alert-modal/alert-modal-content.js +57 -0
- package/dist/components/alert-modal/alert-modal-provider.d.ts +7 -0
- package/dist/components/alert-modal/alert-modal-provider.js +12 -0
- package/dist/components/alert-modal/alert-modal-template.d.ts +5 -0
- package/dist/components/alert-modal/alert-modal-template.js +16 -0
- package/dist/components/alert-template/alert-provider.js +2 -14
- package/dist/components/alert-template/alert-template.d.ts +1 -1
- package/dist/components/form-builder/components/button.js +2 -13
- package/dist/components/form-builder/components/checkbox.js +1 -1
- package/dist/components/form-builder/components/datepicker.js +2 -13
- package/dist/components/form-builder/components/dropzone.js +7 -3
- package/dist/components/form-builder/components/input-currency.js +2 -13
- package/dist/components/form-builder/components/input-mask.js +2 -13
- package/dist/components/form-builder/components/input-prefix-suffix.js +7 -18
- package/dist/components/form-builder/components/input.js +30 -22
- package/dist/components/form-builder/components/password.js +2 -13
- package/dist/components/form-builder/components/radio.js +1 -1
- package/dist/components/form-builder/form-builder-element.js +2 -13
- package/dist/components/form-builder/form-builder.js +8 -18
- package/dist/components/navbar/navbar.js +6 -3
- package/dist/components/page-list/column-management-components/modal-config.js +2 -1
- package/dist/components/page-list/filter-components/button-filter-clear.js +1 -1
- package/dist/components/page-list/filter-components/filter-form.js +2 -2
- package/dist/components/page-list/filters/filter-datepicker.js +1 -1
- package/dist/components/page-list/filters/filter-input.js +11 -15
- package/dist/components/page-list/page-list-config/page-list-config-column-management.js +1 -1
- package/dist/components/page-list/page-list-config/page-list-config-dropdown.js +16 -4
- package/dist/components/page-list/page-list-get-filters.js +7 -1
- package/dist/components/page-list/page-list.js +2 -2
- package/dist/components/page-show/page-show.js +2 -2
- package/dist/components/side-navigation-bar/side-navigation-bar-item.js +11 -22
- package/dist/components/side-navigation-bar/side-navigation-bar.js +8 -8
- package/dist/components/tabs/tabs.js +6 -2
- package/dist/css/style.min.css +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/molecules/card-summary/card-summary-container.js +1 -1
- package/dist/molecules/column-order/column-order.d.ts +2 -1
- package/dist/molecules/column-order/column-order.js +4 -2
- package/dist/molecules/dropdown/dropdown-item.js +6 -17
- package/dist/molecules/dropdown/dropdown.js +10 -7
- package/dist/molecules/paginate.js +1 -1
- package/dist/molecules/table-column-management.js +3 -3
- package/dist/molecules/table.js +15 -22
- package/dist/utils/object-helper.js +1 -1
- package/dist/utils/window-helper.js +8 -7
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from './atoms/spinner';
|
|
|
15
15
|
export * from './atoms/typography';
|
|
16
16
|
export * from './atoms/skeleton';
|
|
17
17
|
export * from './atoms/pluxee-icon/pluxee-icon';
|
|
18
|
+
export * from './atoms/switcher';
|
|
18
19
|
export * from './molecules/alert';
|
|
19
20
|
export * from './molecules/breadcrumb';
|
|
20
21
|
export * from './molecules/card';
|
|
@@ -38,6 +39,8 @@ export { AccordionItem } from './components/accordion/accordion-item';
|
|
|
38
39
|
export { AccordionHeader } from './components/accordion/accordion-header';
|
|
39
40
|
export { AccordionBody } from './components/accordion/accordion-body';
|
|
40
41
|
export * from './components/layout/layout';
|
|
42
|
+
export { AlertModalProvider } from './components/alert-modal/alert-modal-provider';
|
|
43
|
+
export { useAlertModal } from './components/alert-modal/alert-context-provider';
|
|
41
44
|
export { AlertProvider } from './components/alert-template/alert-provider';
|
|
42
45
|
export { AlertTemplate, AlertTemplateProps } from './components/alert-template/alert-template';
|
|
43
46
|
export { useAlert, withAlert } from 'react-alert';
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export * from './atoms/spinner';
|
|
|
16
16
|
export * from './atoms/typography';
|
|
17
17
|
export * from './atoms/skeleton';
|
|
18
18
|
export * from './atoms/pluxee-icon/pluxee-icon';
|
|
19
|
+
export * from './atoms/switcher';
|
|
19
20
|
// Molecules
|
|
20
21
|
export * from './molecules/alert';
|
|
21
22
|
export * from './molecules/breadcrumb';
|
|
@@ -41,6 +42,8 @@ export { AccordionItem } from './components/accordion/accordion-item';
|
|
|
41
42
|
export { AccordionHeader } from './components/accordion/accordion-header';
|
|
42
43
|
export { AccordionBody } from './components/accordion/accordion-body';
|
|
43
44
|
export * from './components/layout/layout';
|
|
45
|
+
export { AlertModalProvider } from './components/alert-modal/alert-modal-provider';
|
|
46
|
+
export { useAlertModal } from './components/alert-modal/alert-context-provider';
|
|
44
47
|
export { AlertProvider } from './components/alert-template/alert-provider';
|
|
45
48
|
export { AlertTemplate } from './components/alert-template/alert-template';
|
|
46
49
|
export { useAlert, withAlert } from 'react-alert';
|
|
@@ -11,7 +11,7 @@ export const CardSummaryContainer = ({ children, className, loading, color = 'pr
|
|
|
11
11
|
}
|
|
12
12
|
} }) => {
|
|
13
13
|
if (loading) {
|
|
14
|
-
return React.createElement(Skeleton,
|
|
14
|
+
return React.createElement(Skeleton, { ...skeleton });
|
|
15
15
|
}
|
|
16
16
|
const classes = classNames(`dashboard-card-item ${color}`, className);
|
|
17
17
|
return (React.createElement("div", { className: classes }, children));
|
|
@@ -5,7 +5,8 @@ declare type ColumnOrderProps = {
|
|
|
5
5
|
order: 'asc' | 'desc';
|
|
6
6
|
active: boolean;
|
|
7
7
|
onChange: (id: string, type: string) => void;
|
|
8
|
+
disabled: boolean;
|
|
8
9
|
};
|
|
9
|
-
export declare const ColumnOrder: ({ id, label, order, active, onChange }: ColumnOrderProps) => JSX.Element;
|
|
10
|
+
export declare const ColumnOrder: ({ id, label, order, active, onChange, disabled }: ColumnOrderProps) => JSX.Element;
|
|
10
11
|
export {};
|
|
11
12
|
//# sourceMappingURL=column-order.d.ts.map
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Icon } from '../../atoms/icon';
|
|
3
|
-
export const ColumnOrder = ({ id, label, order, active, onChange }) => {
|
|
3
|
+
export const ColumnOrder = ({ id, label, order, active, onChange, disabled }) => {
|
|
4
4
|
return (React.createElement("button", { onClick: () => {
|
|
5
|
-
|
|
5
|
+
if (!disabled) {
|
|
6
|
+
onChange(id, order === 'asc' ? 'desc' : 'asc');
|
|
7
|
+
}
|
|
6
8
|
}, type: "button", className: `table-column-order ${active ? ' active' : ''}` },
|
|
7
9
|
label,
|
|
8
10
|
order === 'asc' ? React.createElement(Icon, { icon: "fa-sort-amount-up", className: "ms-2" }) : React.createElement(Icon, { icon: "fa-sort-amount-down", className: "ms-2" })));
|
|
@@ -1,14 +1,3 @@
|
|
|
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
1
|
import React from 'react';
|
|
13
2
|
import { Link } from '../../atoms/link';
|
|
14
3
|
import classNames from 'classnames';
|
|
@@ -17,18 +6,18 @@ export const DropdownItem = (props) => {
|
|
|
17
6
|
return React.createElement(React.Fragment, null, props.element);
|
|
18
7
|
if (props.separator)
|
|
19
8
|
return React.createElement("div", { className: "dropdown-divider" });
|
|
20
|
-
const
|
|
9
|
+
const { uri, label, onClick, items, disabled = false, ...attrs } = props;
|
|
21
10
|
if ((items === null || items === void 0 ? void 0 : items.length) && (items === null || items === void 0 ? void 0 : items.length) > 0) {
|
|
22
|
-
return (React.createElement("div",
|
|
11
|
+
return (React.createElement("div", { ...attrs, className: "dropdown-item dropdown-items" },
|
|
23
12
|
label,
|
|
24
|
-
React.createElement("div", { className: "dropdown-items-droplist" }, items.map((item, index) => (React.createElement(DropdownItem,
|
|
13
|
+
React.createElement("div", { className: "dropdown-items-droplist" }, items.map((item, index) => (React.createElement(DropdownItem, { key: `${label}--${index}`, ...item }))))));
|
|
25
14
|
}
|
|
26
15
|
const classnames = classNames('dropdown-item', disabled && 'disabled');
|
|
27
16
|
if (disabled) {
|
|
28
|
-
return React.createElement("div",
|
|
17
|
+
return React.createElement("div", { ...attrs, className: classnames }, label);
|
|
29
18
|
}
|
|
30
19
|
if (onClick) {
|
|
31
|
-
return (React.createElement("div",
|
|
20
|
+
return (React.createElement("div", { ...attrs, className: classnames, onClick: onClick }, label));
|
|
32
21
|
}
|
|
33
|
-
return React.createElement(Link,
|
|
22
|
+
return React.createElement(Link, { ...attrs, href: uri, className: classnames }, label);
|
|
34
23
|
};
|
|
@@ -35,12 +35,15 @@ export const Dropdown = (props) => {
|
|
|
35
35
|
React.createElement("span", null, label),
|
|
36
36
|
React.createElement(Icon, { icon: "fa-chevron-down", pluxee: true })),
|
|
37
37
|
React.createElement("div", { className: classesDropdown }, items.map((item, index) => {
|
|
38
|
-
const _item =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
const _item = {
|
|
39
|
+
...item,
|
|
40
|
+
...('onClick' in item && {
|
|
41
|
+
onClick: () => {
|
|
42
|
+
setToggle(false);
|
|
43
|
+
item.onClick();
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
};
|
|
47
|
+
return (React.createElement(DropdownItem, { key: `dropdown-item-${index}`, ..._item }));
|
|
45
48
|
}))));
|
|
46
49
|
};
|
|
@@ -33,6 +33,6 @@ export const Paginate = (props) => {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
return (React.createElement("div", { className: "box-paginate" },
|
|
36
|
-
React.createElement(ReactPagination,
|
|
36
|
+
React.createElement(ReactPagination, { ...config, activePage: activePage, itemsCountPerPage: perPage, totalItemsCount: totalItems, onChange: handleChange }),
|
|
37
37
|
React.createElement("div", { className: "extra-paginate-info" }, translate.replace(/%(\d+)/g, (_, n) => [`${String(from || 0)} - ${String(to || 0)}`, String(totalItems)][+n - 1]))));
|
|
38
38
|
};
|
|
@@ -44,7 +44,7 @@ export const TableColumnManagement = (props) => {
|
|
|
44
44
|
let invalids = 0;
|
|
45
45
|
const childrenWithIndex = React.Children.map(child.props.children, (subChild, subIndex) => {
|
|
46
46
|
if (subChild === null || subChild === void 0 ? void 0 : subChild.props) {
|
|
47
|
-
return (
|
|
47
|
+
return ({ ...subChild, props: { ...subChild.props, index: (subIndex - invalids) } });
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
50
|
invalids++;
|
|
@@ -52,7 +52,7 @@ export const TableColumnManagement = (props) => {
|
|
|
52
52
|
});
|
|
53
53
|
childrenWithIndex.sort(sortChildren);
|
|
54
54
|
const filteredChildren = React.Children.toArray(childrenWithIndex).filter(filterChildren);
|
|
55
|
-
return (
|
|
55
|
+
return ({ ...child, props: { ...child.props, children: filteredChildren } });
|
|
56
56
|
}
|
|
57
57
|
return child;
|
|
58
58
|
});
|
|
@@ -60,7 +60,7 @@ export const TableColumnManagement = (props) => {
|
|
|
60
60
|
return (React.createElement("table", { className: classesNames },
|
|
61
61
|
!!headers && (React.createElement("thead", null,
|
|
62
62
|
React.createElement("tr", null, headersFiltered.sort(sortHeader).map((head, index) => (React.createElement("th", { key: `th-${index}`, scope: "col", className: classNames(nowrap && 'white-space-nowrap flex-nowrap') }, head.allowOrder
|
|
63
|
-
? React.createElement(ColumnOrder, { id: head.id, label: head.title, active: orderId === head.id, order: orderId === head.id ? orderType : 'desc', onChange: onChangeOrder })
|
|
63
|
+
? React.createElement(ColumnOrder, { id: head.id, label: head.title, active: orderId === head.id, order: orderId === head.id ? orderType : 'desc', onChange: onChangeOrder, disabled: disabled || false })
|
|
64
64
|
: head.title)))))),
|
|
65
65
|
!!body && !childrenFiltered && (React.createElement("tbody", null, body.map((item, index) => {
|
|
66
66
|
return (React.createElement("tr", { key: `tr-${index}` }, Object.keys(item)
|
package/dist/molecules/table.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
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
1
|
import React, { useCallback } from 'react';
|
|
13
2
|
import classNames from 'classnames';
|
|
14
3
|
import { TableColumnManagement } from './table-column-management';
|
|
@@ -30,7 +19,10 @@ export const Table = (props) => {
|
|
|
30
19
|
attributes: null,
|
|
31
20
|
allowOrder: false
|
|
32
21
|
}
|
|
33
|
-
:
|
|
22
|
+
: {
|
|
23
|
+
...head,
|
|
24
|
+
attributes: null
|
|
25
|
+
}))
|
|
34
26
|
: headerArgs;
|
|
35
27
|
const render = (value) => {
|
|
36
28
|
if (!(value.attributes))
|
|
@@ -52,18 +44,19 @@ export const Table = (props) => {
|
|
|
52
44
|
!!header && (React.createElement("thead", null,
|
|
53
45
|
React.createElement("tr", null, headers.map((head, index) => {
|
|
54
46
|
var _a, _b, _c, _d;
|
|
55
|
-
return (React.createElement("th",
|
|
56
|
-
? React.createElement(ColumnOrder, { id: head.id, label: head.title, active: orderId === head.id, order: orderId === head.id ? orderType : 'desc', onChange: callbackChangeOrder })
|
|
47
|
+
return (React.createElement("th", { key: `th-${index}`, scope: "col", ...{ ...(_a = attributes === null || attributes === void 0 ? void 0 : attributes.thead) === null || _a === void 0 ? void 0 : _a.th, ...(_b = head.attributes) === null || _b === void 0 ? void 0 : _b.th }, className: handleClass((_c = attributes === null || attributes === void 0 ? void 0 : attributes.thead) === null || _c === void 0 ? void 0 : _c.th, (_d = head.attributes) === null || _d === void 0 ? void 0 : _d.th) }, head.allowOrder
|
|
48
|
+
? React.createElement(ColumnOrder, { id: head.id, label: head.title, active: orderId === head.id, order: orderId === head.id ? orderType : 'desc', onChange: callbackChangeOrder, disabled: disabled || false })
|
|
57
49
|
: head.title));
|
|
58
50
|
})))),
|
|
59
|
-
!!body && !children && (React.createElement("tbody", null, body.map((
|
|
60
|
-
var
|
|
61
|
-
return (React.createElement("
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
51
|
+
!!body && !children && (React.createElement("tbody", null, body.map(({ attributes: attrs = null, ...item }, index) => (React.createElement("tr", { key: `tr-${index}` }, Object.keys(item).map((key, idx) => {
|
|
52
|
+
var _a, _b, _c, _d, _e, _f;
|
|
53
|
+
return (React.createElement("td", { key: `td-${index}-${idx}`, scope: "row", ...{
|
|
54
|
+
...(_a = attributes === null || attributes === void 0 ? void 0 : attributes.tbody) === null || _a === void 0 ? void 0 : _a.td,
|
|
55
|
+
...attrs === null || attrs === void 0 ? void 0 : attrs.td,
|
|
56
|
+
...(_c = (_b = item[key]) === null || _b === void 0 ? void 0 : _b.attributes) === null || _c === void 0 ? void 0 : _c.td
|
|
57
|
+
}, className: handleClass((_d = attributes === null || attributes === void 0 ? void 0 : attributes.tbody) === null || _d === void 0 ? void 0 : _d.td, attrs === null || attrs === void 0 ? void 0 : attrs.td, (_f = (_e = item[key]) === null || _e === void 0 ? void 0 : _e.attributes) === null || _f === void 0 ? void 0 : _f.td) }, render(item[key])));
|
|
58
|
+
})))))),
|
|
66
59
|
children && !body && (React.createElement("tbody", null, children))));
|
|
67
60
|
}
|
|
68
|
-
return React.createElement(TableColumnManagement,
|
|
61
|
+
return React.createElement(TableColumnManagement, { ...props, columnManagement: props.columnManagement || { columnsOrder: [], hiddenColumns: [] }, tableOrder: { orderId, orderType, onChange: callbackChangeOrder }, disabled: disabled });
|
|
69
62
|
};
|
|
@@ -20,7 +20,7 @@ class ObjectHelper {
|
|
|
20
20
|
}
|
|
21
21
|
destruct(obj, ...keys) {
|
|
22
22
|
// @ts-ignore
|
|
23
|
-
return keys.reduce((a, c) => (
|
|
23
|
+
return keys.reduce((a, c) => ({ ...a, ...(obj[c] && { [c]: obj[c] }) }), {});
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
export default new ObjectHelper();
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
class WindowHelper {
|
|
2
2
|
isMobile() {
|
|
3
|
-
if (navigator.userAgent.match(/Android/i)
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
if (navigator.userAgent.match(/Android/i) ||
|
|
4
|
+
navigator.userAgent.match(/webOS/i) ||
|
|
5
|
+
navigator.userAgent.match(/iPhone/i) ||
|
|
6
|
+
navigator.userAgent.match(/iPad/i) ||
|
|
7
|
+
navigator.userAgent.match(/iPod/i) ||
|
|
8
|
+
navigator.userAgent.match(/BlackBerry/i) ||
|
|
9
|
+
navigator.userAgent.match(/Windows Phone/i)) {
|
|
10
10
|
return true;
|
|
11
|
+
}
|
|
11
12
|
return false;
|
|
12
13
|
}
|
|
13
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dilicorp/ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.36",
|
|
4
4
|
"description": "A simple UI design for Dilicorp",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@storybook/addon-links": "^6.4.9",
|
|
26
26
|
"@storybook/react": "^6.4.9",
|
|
27
27
|
"@types/react": "^17.0.30",
|
|
28
|
-
"@types/react-alert": "^
|
|
28
|
+
"@types/react-alert": "^7.0.6",
|
|
29
29
|
"@types/react-datepicker": "^4.3.2",
|
|
30
30
|
"@types/react-dom": "^17.0.11",
|
|
31
31
|
"@types/react-input-mask": "^3.0.1",
|