@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.
Files changed (73) hide show
  1. package/dist/atoms/button.js +2 -14
  2. package/dist/atoms/checkbox.js +2 -14
  3. package/dist/atoms/col.js +2 -14
  4. package/dist/atoms/container.js +2 -14
  5. package/dist/atoms/icon.js +3 -15
  6. package/dist/atoms/image.js +2 -13
  7. package/dist/atoms/input.js +2 -14
  8. package/dist/atoms/label.js +2 -14
  9. package/dist/atoms/link.js +3 -14
  10. package/dist/atoms/radio.js +2 -14
  11. package/dist/atoms/row.js +1 -1
  12. package/dist/atoms/skeleton.js +1 -1
  13. package/dist/atoms/switcher.d.ts +7 -0
  14. package/dist/atoms/switcher.js +10 -0
  15. package/dist/atoms/typography.js +2 -14
  16. package/dist/components/accordion/accordion-body.d.ts +1 -1
  17. package/dist/components/accordion/accordion-body.js +1 -1
  18. package/dist/components/accordion/accordion-header.d.ts +1 -1
  19. package/dist/components/accordion/accordion-header.js +1 -1
  20. package/dist/components/accordion/accordion-item.d.ts +1 -1
  21. package/dist/components/accordion/accordion-item.js +1 -1
  22. package/dist/components/accordion/accordion.d.ts +1 -1
  23. package/dist/components/accordion/accordion.js +4 -4
  24. package/dist/components/alert-modal/alert-context-provider.d.ts +17 -0
  25. package/dist/components/alert-modal/alert-context-provider.js +18 -0
  26. package/dist/components/alert-modal/alert-modal-content.d.ts +8 -0
  27. package/dist/components/alert-modal/alert-modal-content.js +57 -0
  28. package/dist/components/alert-modal/alert-modal-provider.d.ts +7 -0
  29. package/dist/components/alert-modal/alert-modal-provider.js +12 -0
  30. package/dist/components/alert-modal/alert-modal-template.d.ts +5 -0
  31. package/dist/components/alert-modal/alert-modal-template.js +16 -0
  32. package/dist/components/alert-template/alert-provider.js +2 -14
  33. package/dist/components/alert-template/alert-template.d.ts +1 -1
  34. package/dist/components/form-builder/components/button.js +2 -13
  35. package/dist/components/form-builder/components/checkbox.js +1 -1
  36. package/dist/components/form-builder/components/datepicker.js +2 -13
  37. package/dist/components/form-builder/components/dropzone.js +7 -3
  38. package/dist/components/form-builder/components/input-currency.js +2 -13
  39. package/dist/components/form-builder/components/input-mask.js +2 -13
  40. package/dist/components/form-builder/components/input-prefix-suffix.js +7 -18
  41. package/dist/components/form-builder/components/input.js +30 -22
  42. package/dist/components/form-builder/components/password.js +2 -13
  43. package/dist/components/form-builder/components/radio.js +1 -1
  44. package/dist/components/form-builder/form-builder-element.js +2 -13
  45. package/dist/components/form-builder/form-builder.js +8 -18
  46. package/dist/components/navbar/navbar.js +6 -3
  47. package/dist/components/page-list/column-management-components/modal-config.js +2 -1
  48. package/dist/components/page-list/filter-components/button-filter-clear.js +1 -1
  49. package/dist/components/page-list/filter-components/filter-form.js +2 -2
  50. package/dist/components/page-list/filters/filter-datepicker.js +1 -1
  51. package/dist/components/page-list/filters/filter-input.js +11 -15
  52. package/dist/components/page-list/page-list-config/page-list-config-column-management.js +1 -1
  53. package/dist/components/page-list/page-list-config/page-list-config-dropdown.js +16 -4
  54. package/dist/components/page-list/page-list-get-filters.js +7 -1
  55. package/dist/components/page-list/page-list.js +2 -2
  56. package/dist/components/page-show/page-show.js +2 -2
  57. package/dist/components/side-navigation-bar/side-navigation-bar-item.js +11 -22
  58. package/dist/components/side-navigation-bar/side-navigation-bar.js +8 -8
  59. package/dist/components/tabs/tabs.js +6 -2
  60. package/dist/css/style.min.css +1 -1
  61. package/dist/index.d.ts +3 -0
  62. package/dist/index.js +3 -0
  63. package/dist/molecules/card-summary/card-summary-container.js +1 -1
  64. package/dist/molecules/column-order/column-order.d.ts +2 -1
  65. package/dist/molecules/column-order/column-order.js +4 -2
  66. package/dist/molecules/dropdown/dropdown-item.js +6 -17
  67. package/dist/molecules/dropdown/dropdown.js +10 -7
  68. package/dist/molecules/paginate.js +1 -1
  69. package/dist/molecules/table-column-management.js +3 -3
  70. package/dist/molecules/table.js +15 -22
  71. package/dist/utils/object-helper.js +1 -1
  72. package/dist/utils/window-helper.js +8 -7
  73. 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, Object.assign({}, 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
- onChange(id, order === 'asc' ? 'desc' : 'asc');
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 _a = props, { uri, label, onClick, items, disabled = false } = _a, attrs = __rest(_a, ["uri", "label", "onClick", "items", "disabled"]);
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", Object.assign({}, attrs, { className: "dropdown-item dropdown-items" }),
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, Object.assign({ key: `${label}--${index}` }, item)))))));
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", Object.assign({}, attrs, { className: classnames }), label);
17
+ return React.createElement("div", { ...attrs, className: classnames }, label);
29
18
  }
30
19
  if (onClick) {
31
- return (React.createElement("div", Object.assign({}, attrs, { className: classnames, onClick: onClick }), label));
20
+ return (React.createElement("div", { ...attrs, className: classnames, onClick: onClick }, label));
32
21
  }
33
- return React.createElement(Link, Object.assign({}, attrs, { href: uri, className: classnames }), label);
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 = Object.assign(Object.assign({}, item), ('onClick' in item && {
39
- onClick: () => {
40
- setToggle(false);
41
- item.onClick();
42
- }
43
- }));
44
- return (React.createElement(DropdownItem, Object.assign({ key: `dropdown-item-${index}` }, _item)));
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, Object.assign({}, config, { activePage: activePage, itemsCountPerPage: perPage, totalItemsCount: totalItems, onChange: handleChange })),
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 (Object.assign(Object.assign({}, subChild), { props: Object.assign(Object.assign({}, subChild.props), { index: (subIndex - invalids) }) }));
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 (Object.assign(Object.assign({}, child), { props: Object.assign(Object.assign({}, child.props), { children: filteredChildren }) }));
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)
@@ -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
- : Object.assign(Object.assign({}, head), { attributes: null })))
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", Object.assign({ key: `th-${index}`, scope: "col" }, Object.assign(Object.assign({}, (_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
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((_a, index) => {
60
- var { attributes: attrs = null } = _a, item = __rest(_a, ["attributes"]);
61
- return (React.createElement("tr", { key: `tr-${index}` }, Object.keys(item).map((key, idx) => {
62
- var _a, _b, _c, _d, _e, _f;
63
- return (React.createElement("td", Object.assign({ key: `td-${index}-${idx}`, scope: "row" }, Object.assign(Object.assign(Object.assign({}, (_a = attributes === null || attributes === void 0 ? void 0 : attributes.tbody) === null || _a === void 0 ? void 0 : _a.td), attrs === null || attrs === void 0 ? void 0 : attrs.td), (_c = (_b = item[key]) === null || _b === void 0 ? void 0 : _b.attributes) === null || _c === void 0 ? void 0 : _c.td), { 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])));
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, Object.assign({}, props, { columnManagement: props.columnManagement || { columnsOrder: [], hiddenColumns: [] }, tableOrder: { orderId, orderType, onChange: callbackChangeOrder }, disabled: disabled }));
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) => (Object.assign(Object.assign({}, a), (obj[c] && { [c]: obj[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
- || 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))
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.34",
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": "^5.2.1",
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",